bool mupnp_upnpav_dms_condir_init(mUpnpAvServer *dms) { mUpnpDevice *dev; mUpnpService *service; mUpnpAction* action; dev = mupnp_upnpav_dms_getdevice(dms); if (!dev) return false; service = mupnp_device_getservicebytype(dev, CG_UPNPAV_DMS_CONTENTDIRECTORY_SERVICE_TYPE); if (!service) return false; if (mupnp_service_parsedescription(service, CG_UPNPAV_DMS_CONTENTDIRECTORY_SERVICE_DESCRIPTION, mupnp_strlen(CG_UPNPAV_DMS_CONTENTDIRECTORY_SERVICE_DESCRIPTION)) == false) return false; mupnp_service_setactionlistener(service, mupnp_upnpav_dms_condir_actionreceived); for (action=mupnp_service_getactions(service); action; action=mupnp_action_next(action)) mupnp_action_setuserdata(action, dms); mupnp_upnpav_dms_condir_setsystemupdateid(dms, 1); return true; }
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"); }
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")); } } }