void PrintIGDInfo(CgUpnpDevice *dev, int igdNum) { CgUpnpService *ipConService; CgUpnpAction *extIpAddrAction; CgUpnpService *wanComIfCfgService; CgUpnpAction *totalBytesSentAction; CgUpnpAction *totalBytesRecvAction; if (!cg_upnp_device_isdevicetype(dev, UPNPAVDUMP_IGD_DEVICETYPE)) return; printf("[%d] : %s\n", igdNum, cg_upnp_device_getfriendlyname(dev)); ipConService = cg_upnp_device_getservicebytype(dev, UPNPAVDUMP_IGD_WANIPCON_SERVICETYPE); if (ipConService) { extIpAddrAction = cg_upnp_service_getactionbyname(ipConService, "GetExternalIPAddress"); if (extIpAddrAction) { if (cg_upnp_action_post(extIpAddrAction)) printf(" GetExternalIPAddress = %s\n", cg_upnp_action_getargumentvaluebyname(extIpAddrAction, "NewExternalIPAddress")); } } wanComIfCfgService = cg_upnp_device_getservicebytype(dev, UPNPAVDUMP_IGD_WANCOMIFCFG_SERVICETYPE); if (wanComIfCfgService) { totalBytesSentAction = cg_upnp_service_getactionbyname(ipConService, "GetTotalBytesSent"); if (totalBytesSentAction) { if (cg_upnp_action_post(totalBytesSentAction)) printf(" GetTotalBytesSent = %s\n", cg_upnp_action_getargumentvaluebyname(totalBytesSentAction, "NewTotalBytesSent")); } totalBytesRecvAction = cg_upnp_service_getactionbyname(ipConService, "GetTotalBytesReceived"); if (totalBytesRecvAction) { if (cg_upnp_action_post(totalBytesRecvAction)) printf(" GetTotalBytesSent = %s\n", cg_upnp_action_getargumentvaluebyname(totalBytesRecvAction, "NewTotalBytesReceived")); } } }
BOOL cg_upnpav_dms_conmgr_init(CgUpnpAvServer* dms) { CgUpnpDevice* dev; CgUpnpService* service; CgUpnpAction* action; dev = cg_upnpav_dms_getdevice(dms); if (!dev) return FALSE; service = cg_upnp_device_getservicebytype(dev, CG_UPNPAV_DMS_CONNECTIONMANAGER_SERVICE_TYPE); if (!service) return FALSE; if (cg_upnp_service_parsedescription(service, CG_UPNPAV_DMS_CONNECTIONMANAGER_SERVICE_DESCRIPTION, cg_strlen(CG_UPNPAV_DMS_CONNECTIONMANAGER_SERVICE_DESCRIPTION)) == FALSE) return FALSE; cg_upnp_service_setuserdata(service, dms); for (action = cg_upnp_service_getactions(service); action; action = cg_upnp_action_next(action)) cg_upnp_action_setuserdata(action, dms); return TRUE; }