示例#1
0
文件: upnpavdump.c 项目: Coramo/mupnp
void PrintDMSInfo(mUpnpDevice* dev, int dmsNum)
{
  mUpnpService* conDirService;
  mUpnpAction* browseAction;
  mUpnpStateVariable* searchCap;
  mUpnpStateVariable* sorpCap;

  if (!mupnp_device_isdevicetype(dev, UPNPAVDUMP_DMS_DEVICETYPE))
    return;

  printf("[%d] : %s\n", dmsNum, mupnp_device_getfriendlyname(dev));

  conDirService = mupnp_device_getservicebytype(dev, UPNPAVDUMP_DMS_CONTENTDIR_SERVICETYPE);
  if (!conDirService)
    return;

  searchCap = mupnp_service_getstatevariablebyname(conDirService, "SearchCapabilities");
  if (searchCap) {
    if (mupnp_statevariable_post(searchCap))
      printf(" SearchCapabilities = %s\n", mupnp_statevariable_getvalue(searchCap));
  }

  sorpCap = mupnp_service_getstatevariablebyname(conDirService, "SortCapabilities");
  if (sorpCap) {
    if (mupnp_statevariable_post(sorpCap))
      printf(" SortCapabilities = %s\n", mupnp_statevariable_getvalue(sorpCap));
  }

  browseAction = mupnp_service_getactionbyname(conDirService, UPNPAVDUMP_DMS_BROWSE_ACTIONNAME);
  if (!browseAction)
    return;

  PrintContentDirectory(browseAction, 0, "0");
}
示例#2
0
void round_finder_upnpdevicelistener(mUpnpControlPoint* cp, const char* udn, mUpnpDeviceStatus devStatus)
{
  RoundFinder* finder = mupnp_controlpoint_getuserdata(cp);
  if (!finder)
    return;

  mUpnpDevice* dev = mupnp_controlpoint_getdevicebyudn(cp, (char*)udn);
  if (!dev)
    return;

  if (!mupnp_device_isdevicetype(dev, ROUND_UPNP_DEVICE_TYPE))
    return;

  RoundNode* node = round_node_new();
  round_node_setaddress(node, mupnp_device_getaddress(dev));
  round_node_setport(node, mupnp_device_gethttpport(dev));

  switch (devStatus) {
  case mUpnpDeviceStatusAdded:
  case mUpnpDeviceStatusUpdated: {
    if (finder->addedListener) {
      finder->addedListener(finder, node);
    }
  } break;
  case mUpnpDeviceStatusRemoved: {
    if (finder->removedListener) {
      finder->removedListener(finder, node);
    }
  } break;
  default:
    break;
  }

  round_node_delete(node);
}
示例#3
0
文件: upnpavdump.c 项目: Coramo/mupnp
void PrintDMSInfos(mUpnpControlPoint* ctrlPoint)
{
  mUpnpDevice* dev;
  int dmsNum;

  dmsNum = 0;
  for (dev = mupnp_controlpoint_getdevices(ctrlPoint); dev != NULL; dev = mupnp_device_next(dev)) {
    if (mupnp_device_isdevicetype(dev, UPNPAVDUMP_DMS_DEVICETYPE))
      PrintDMSInfo(dev, ++dmsNum);
  }

  if (dmsNum <= 0)
    printf("Media Server is not found !!\n");
}
示例#4
0
void PrintIGDInfos(mUpnpControlPoint *ctrlPoint)
{
	mUpnpDevice *dev;
	int igdNum;
		
	igdNum = 0;
	for (dev = mupnp_controlpoint_getdevices(ctrlPoint); dev != NULL; dev = mupnp_device_next(dev)) {
		if (mupnp_device_isdevicetype(dev, UPNPAVDUMP_IGD_DEVICETYPE))
			PrintIGDInfo(dev, ++igdNum);
	}

	if (igdNum <= 0)
		printf("IGD is not found !!\n");
}
示例#5
0
void PrintIGDInfo(mUpnpDevice *dev, int igdNum)
{
	mUpnpService *ipConService;
	mUpnpAction *extIpAddrAction;
	mUpnpService *wanComIfCfgService;
	mUpnpAction *totalBytesSentAction;
	mUpnpAction *totalBytesRecvAction;

	if (!mupnp_device_isdevicetype(dev, UPNPAVDUMP_IGD_DEVICETYPE))
		return;
	
	printf("[%d] : %s\n", igdNum, mupnp_device_getfriendlyname(dev));

	ipConService = mupnp_device_getservicebytype(dev, UPNPAVDUMP_IGD_WANIPCON_SERVICETYPE);
	if (ipConService) {
		extIpAddrAction = mupnp_service_getactionbyname(ipConService, "GetExternalIPAddress");
		if (extIpAddrAction) {
			if (mupnp_action_post(extIpAddrAction))
				printf("  GetExternalIPAddress = %s\n", mupnp_action_getargumentvaluebyname(extIpAddrAction, "NewExternalIPAddress"));
		}
	}

	wanComIfCfgService = mupnp_device_getservicebytype(dev, UPNPAVDUMP_IGD_WANCOMIFCFG_SERVICETYPE);
	if (wanComIfCfgService) {
		totalBytesSentAction = mupnp_service_getactionbyname(ipConService, "GetTotalBytesSent");
		if (totalBytesSentAction) {
			if (mupnp_action_post(totalBytesSentAction))
				printf("  GetTotalBytesSent = %s\n", mupnp_action_getargumentvaluebyname(totalBytesSentAction, "NewTotalBytesSent"));
		}
		totalBytesRecvAction = mupnp_service_getactionbyname(ipConService, "GetTotalBytesReceived");
		if (totalBytesRecvAction) {
			if (mupnp_action_post(totalBytesRecvAction))
				printf("  GetTotalBytesSent = %s\n", mupnp_action_getargumentvaluebyname(totalBytesRecvAction, "NewTotalBytesReceived"));
		}
	}
}