#include <cybergarage/typedef.h>
#include <cybergarage/xml/cxml.h>
#include <cybergarage/util/clist.h>
#include <cybergarage/util/cstring.h>
#include <cybergarage/util/cmutex.h>
#include <cybergarage/util/cthread.h>
#include <cybergarage/http/chttp.h>
#include <cybergarage/net/curl.h>
#include <cybergarage/net/cinterface.h>
#include <cybergarage/upnp/cservice.h>
#include <cybergarage/upnp/cicon.h>
#include <cybergarage/upnp/ssdp/cssdp_server.h>
Data Structures | |
struct | _CgUpnpDevice |
The generic UPnP device structure. More... | |
Defines | |
#define | CG_UPNP_DEVICE_ELEM_NAME "device" |
#define | CG_UPNP_DEVICELIST_ELEM_NAME "deviceList" |
#define | CG_UPNP_DEVICE_UPNP_ROOTDEVICE "upnp:rootdevice" |
#define | CG_UPNP_DEVICE_DEFAULT_STARTUP_WAIT_TIME 1000 |
#define | CG_UPNP_DEVICE_DEFAULT_DISCOVERY_WAIT_TIME 500 |
#define | CG_UPNP_DEVICE_DEFAULT_LEASE_TIME (30 * 60) |
#define | CG_UPNP_DEVICE_HTTP_DEFAULT_PORT 38400 |
#define | CG_UPNP_DEVICE_DEFAULT_DESCRIPTION_URI "/description.xml" |
#define | CG_UPNP_DEVICE_URLBASE_MAXLEN 64 |
#define | CG_UPNP_DEVICE_M_SEARCH_FILTER_INTERVAL 15 |
#define | CG_UPNP_DEVICE_URLBASE_NAME "URLBase" |
#define | CG_UPNP_DEVICE_DEVICE_TYPE "deviceType" |
#define | CG_UPNP_DEVICE_FRIENDLY_NAME "friendlyName" |
#define | CG_UPNP_DEVICE_MANUFACTURE "manufacture" |
#define | CG_UPNP_DEVICE_MANUFACTURE_URL "manufactureURL" |
#define | CG_UPNP_DEVICE_MODEL_DESCRIPTION "modelDescription" |
#define | CG_UPNP_DEVICE_MODEL_NAME "modelName" |
#define | CG_UPNP_DEVICE_MODEL_NUMBER "modelNumber" |
#define | CG_UPNP_DEVICE_MODEL_URL "modelURL" |
#define | CG_UPNP_DEVICE_SERIAL_NUMBER "serialNumber" |
#define | CG_UPNP_DEVICE_UDN "UDN" |
#define | CG_UPNP_DEVICE_UPC "UPC" |
#define | CG_UPNP_DEVICE_PRESENTATION_URL "presentationURL" |
#define | cg_upnp_device_next(dev) (CgUpnpDevice *)cg_list_next((CgList *)dev) |
#define | cg_upnp_device_remove(dev) cg_list_remove((CgList *)dev) |
#define | cg_upnp_device_isdevicenode(node) cg_xml_node_isname(node, CG_UPNP_DEVICE_ELEM_NAME) |
#define | cg_upnp_device_getrootnode(dev) cg_xml_nodelist_gets(dev->rootNodeList) |
#define | cg_upnp_device_getdevicenode(dev) (dev->deviceNode) |
#define | cg_upnp_device_isrootdevice(dev) ((dev->rootNodeList != NULL) ? TRUE : FALSE) |
#define | cg_upnp_device_setparentdevice(dev, pDev) (dev->parentDevice = pDev) |
#define | cg_upnp_device_getparentdevice(dev) (dev->parentDevice) |
#define | cg_upnp_device_setdevicetype(dev, value) cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_DEVICE_TYPE, value) |
#define | cg_upnp_device_getdevicetype(dev) cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_DEVICE_TYPE) |
#define | cg_upnp_device_isdevicetype(dev, value) cg_streq(cg_upnp_device_getdevicetype(dev), value) |
#define | cg_upnp_device_setfriendlyname(dev, value) cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_FRIENDLY_NAME, value) |
#define | cg_upnp_device_getfriendlyname(dev) cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_FRIENDLY_NAME) |
#define | cg_upnp_device_setmanufacture(dev, value) cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURE, value) |
#define | cg_upnp_device_getmanufacture(dev) cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURE) |
#define | cg_upnp_device_setmanufactureurl(dev, value) cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURE_URL, value) |
#define | cg_upnp_device_getmanufactureurl(dev) cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURE_URL) |
#define | cg_upnp_device_setmodeldescription(dev, value) cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_DESCRIPTION, value) |
#define | cg_upnp_device_getmodeldescription(dev) cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_DESCRIPTION) |
#define | cg_upnp_device_setmodelname(dev, value) cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_NAME, value) |
#define | cg_upnp_device_getmodelname(dev) cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_NAME) |
#define | cg_upnp_device_setmodelnumber(dev, value) cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_NUMBER, value) |
#define | cg_upnp_device_getmodelnumber(dev) cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_NUMBER) |
#define | cg_upnp_device_setmodelurl(dev, value) cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_URL, value) |
#define | cg_upnp_device_getmodelurl(dev) cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_URL) |
#define | cg_upnp_device_setserialnumber(dev, value) cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_SERIAL_NUMBER, value) |
#define | cg_upnp_device_getserialnumber(dev) cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_SERIAL_NUMBER) |
#define | cg_upnp_device_setudn(dev, value) cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_UDN, value) |
#define | cg_upnp_device_getudn(dev) cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_UDN) |
#define | cg_upnp_device_hasudn(dev) ((0 < cg_strlen(cg_upnp_device_getudn(dev))) ? TRUE : FALSE) |
#define | cg_upnp_device_setupc(dev, value) cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_UPC, value) |
#define | cg_upnp_device_getupc(dev) cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_UPC) |
#define | cg_upnp_device_setpresentationurl(dev, value) cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_PRESENTATION_URL, value) |
#define | cg_upnp_device_getpresentationurl(dev) cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_PRESENTATION_URL) |
#define | cg_upnp_device_geturlbase(dev) cg_xml_node_getchildnodevalue(cg_upnp_device_getrootnode(cg_upnp_device_getrootdevice(dev)), CG_UPNP_DEVICE_URLBASE_NAME) |
#define | cg_upnp_device_lock(dev) cg_mutex_lock(dev->mutex) |
#define | cg_upnp_device_unlock(dev) cg_mutex_unlock(dev->mutex) |
#define | cg_upnp_device_setuserdata(dev, value) (dev->userData = value) |
#define | cg_upnp_device_getuserdata(dev) (dev->userData) |
#define | cg_upnp_device_setdescriptionuri(dev, url) cg_string_setvalue(dev->descriptionURI, url) |
#define | cg_upnp_device_getdescriptionuri(dev) cg_string_getvalue(dev->descriptionURI) |
#define | cg_upnp_device_isdescriptionuri(dev, url) cg_streq(cg_string_getvalue(dev->descriptionURI), url) |
#define | cg_upnp_device_setleasetime(dev, value) (dev->leaseTime = value) |
#define | cg_upnp_device_getleasetime(dev) (dev->leaseTime) |
#define | cg_upnp_device_getdevicelist(dev) (dev->deviceList) |
#define | cg_upnp_device_getdevice(dev, idx) ((CgUpnpDevice *)cg_list_get(dev->deviceList,idx)) |
#define | cg_upnp_device_getdevices(dev) ((CgUpnpDevice *)cg_list_gets((CgList *)dev->deviceList)) |
#define | cg_upnp_device_getservicelist(dev) (dev->serviceList) |
#define | cg_upnp_device_getservice(dev, idx) ((CgUpnpService *)cg_list_get(dev->serviceList,idx)) |
#define | cg_upnp_device_getservices(dev) ((CgUpnpService *)cg_list_gets((CgList *)dev->serviceList)) |
#define | cg_upnp_device_geticonlist(dev) (dev->iconList) |
#define | cg_upnp_device_geticon(dev, idx) ((CgUpnpIcon *)cg_list_get((CgList *)dev->iconList,idx)) |
#define | cg_upnp_device_geticons(dev) ((CgUpnpIcon *)cg_list_gets((CgList *)dev->iconList)) |
#define | cg_upnp_devicelist_clear(devList) cg_list_clear((CgList *)devList, (CG_LIST_DESTRUCTORFUNC)cg_upnp_device_delete) |
#define | cg_upnp_devicelist_size(devList) cg_list_size((CgList *)devList) |
#define | cg_upnp_devicelist_gets(devList) (CgUpnpDevice *)cg_list_next((CgList *)devList) |
#define | cg_upnp_devicelist_add(devList, dev) cg_list_add((CgList *)devList, (CgList *)dev) |
#define | cg_upnp_service_getdevice(service) ((CgUpnpDevice *)service->parentDevice) |
#define | cg_upnp_service_getrootdevice(service) cg_upnp_device_getrootdevice((CgUpnpDevice *)service->parentDevice) |
#define | cg_upnp_device_sethttpport(dev, value) (dev->httpPort = value) |
#define | cg_upnp_device_gethttpport(dev) (dev->httpPort) |
#define | cg_upnp_device_sethttplistener(dev, func) (dev->httpListener = func) |
#define | cg_upnp_device_gethttplistener(dev) (dev->httpListener) |
#define | cg_upnp_device_getssdpserverlist(dev) (dev->ssdpServerList) |
#define | cg_upnp_device_getssdppacket(dev) (dev->ssdpPkt) |
#define | cg_upnp_device_setssdppacket(dev, srcSsdpPkt) cg_upnp_ssdp_packet_copy(dev->ssdpPkt, srcSsdpPkt) |
#define | cg_upnp_device_getlocationfromssdppacket(dev) cg_upnp_ssdp_packet_getlocation(dev->ssdpPkt) |
#define | cg_upnp_device_getinterfaceaddressfromssdppacket(dev) cg_upnp_ssdp_packet_getlocaladdress(dev->ssdpPkt) |
#define | cg_upnp_device_getadvertiserthead(dev) (dev->advertiser) |
Typedefs | |
typedef _CgUpnpDevice | CgUpnpDevice |
The generic UPnP device structure. | |
typedef _CgUpnpDevice | CgUpnpDeviceList |
The generic UPnP device structure. | |
Functions | |
CgUpnpDevice * | cg_upnp_device_new () |
void | cg_upnp_device_delete (CgUpnpDevice *dev) |
void | cg_upnp_device_clear (CgUpnpDevice *dev) |
void | cg_upnp_device_setdevicenode (CgUpnpDevice *dev, CgXmlNode *node) |
CgUpnpDevice * | cg_upnp_device_getrootdevice (CgUpnpDevice *dev) |
BOOL | cg_upnp_device_parsedescription (CgUpnpDevice *dev, char *desciption, int descriptionLen) |
BOOL | cg_upnp_device_parsedescriptionurl (CgUpnpDevice *dev, CgNetURL *url) |
BOOL | cg_upnp_device_loaddescriptionfile (CgUpnpDevice *dev, char *fileName) |
BOOL | cg_upnp_device_updatefromssdppacket (CgUpnpDevice *dev, CgUpnpSSDPPacket *ssdpPkt) |
char * | cg_upnp_devicetype_getidentifier (char *deviceType) |
char * | cg_upnp_devicetype_geturn (char *deviceType) |
char * | cg_upnp_devicetype_getdevice (char *deviceType) |
char * | cg_upnp_devicetype_gettype (char *deviceType) |
char * | cg_upnp_devicetype_getschematype (char *deviceType) |
char * | cg_upnp_devicetype_getversion (char *deviceType) |
void | cg_upnp_device_seturlbase (CgUpnpDevice *dev, char *value) |
BOOL | cg_upnp_device_start (CgUpnpDevice *dev) |
BOOL | cg_upnp_device_stop (CgUpnpDevice *dev) |
char * | cg_upnp_device_getlocationurl (CgUpnpDevice *dev, char *host, char *buf, int bufSize) |
void | cg_upnp_device_announce (CgUpnpDevice *dev) |
void | cg_upnp_device_byebye (CgUpnpDevice *dev) |
void | cg_upnp_device_setactionlistener (CgUpnpDevice *dev, CG_UPNP_ACTION_LISTNER actionListner) |
void | cg_upnp_device_setquerylistener (CgUpnpDevice *dev, CG_UPNP_STATEVARIABLE_LISTNER queryListner) |
CgUpnpDevice * | cg_upnp_device_getdevicebyexacttype (CgUpnpDevice *dev, char *exacttype) |
CgUpnpDevice * | cg_upnp_device_getdevicebytype (CgUpnpDevice *dev, char *type) |
CgUpnpDevice * | cg_upnp_device_getdevicebyudn (CgUpnpDevice *dev, char *udn) |
CgUpnpDevice * | cg_upnp_device_getdevicebydescriptionuri (CgUpnpDevice *dev, char *url) |
CgUpnpService * | cg_upnp_device_getservicebyserviceid (CgUpnpDevice *dev, char *serviceId) |
CgUpnpService * | cg_upnp_device_getservicebyexacttype (CgUpnpDevice *dev, char *type) |
CgUpnpService * | cg_upnp_device_getservicebytype (CgUpnpDevice *dev, char *type) |
CgUpnpService * | cg_upnp_device_getservicebysid (CgUpnpDevice *dev, char *sid) |
CgUpnpService * | cg_upnp_device_getservicebyscpdurl (CgUpnpDevice *dev, char *url) |
CgUpnpService * | cg_upnp_device_getservicebycontrolurl (CgUpnpDevice *dev, char *url) |
CgUpnpService * | cg_upnp_device_getservicebyeventsuburl (CgUpnpDevice *dev, char *url) |
CgUpnpAction * | cg_upnp_device_getactionbyname (CgUpnpDevice *dev, char *name) |
CgUpnpStateVariable * | cg_upnp_device_getstatevariablebyname (CgUpnpDevice *dev, char *name) |
CgUpnpDeviceList * | cg_upnp_devicelist_new () |
void | cg_upnp_devicelist_delete (CgUpnpDeviceList *devList) |
void | cg_upnp_device_httprequestrecieved (CgHttpRequest *httpReq) |
void | cg_upnp_device_ssdplistener (CgUpnpSSDPPacket *ssdpPkt) |
char * | cg_upnp_device_getnotifydevicent (CgUpnpDevice *dev, char *buf, int bufSize) |
char * | cg_upnp_device_getnotifydeviceusn (CgUpnpDevice *dev, char *buf, int bufSize) |
char * | cg_upnp_device_getnotifydevicetypent (CgUpnpDevice *dev, char *buf, int bufSize) |
char * | cg_upnp_device_getnotifydevicetypeusn (CgUpnpDevice *dev, char *buf, int bufSize) |
void | cg_upnp_device_ssdpmessagereceived (CgUpnpDevice *dev, CgUpnpSSDPPacket *ssdpPkt, int filter) |
BOOL | cg_upnp_device_postsearchresponse (CgUpnpDevice *dev, CgUpnpSSDPPacket *ssdpPkt, char *st, char *usn) |
BOOL | cg_upnp_device_ipchanged (CgUpnpDevice *dev) |
BOOL | cg_upnp_device_advertiser_start (CgUpnpDevice *dev) |
BOOL | cg_upnp_device_advertiser_stop (CgUpnpDevice *dev) |
#define CG_UPNP_DEVICE_DEFAULT_DESCRIPTION_URI "/description.xml" |
Definition for default description file "location"
#define CG_UPNP_DEVICE_DEFAULT_DISCOVERY_WAIT_TIME 500 |
Definition for default device discovery wait time
#define CG_UPNP_DEVICE_DEFAULT_LEASE_TIME (30 * 60) |
Definition for default device lease time
#define CG_UPNP_DEVICE_DEFAULT_STARTUP_WAIT_TIME 1000 |
Definition for default device start up wait time
#define CG_UPNP_DEVICE_DEVICE_TYPE "deviceType" |
Definition for device type XML element name
#define CG_UPNP_DEVICE_ELEM_NAME "device" |
Definition for device XML element name
#define CG_UPNP_DEVICE_FRIENDLY_NAME "friendlyName" |
Definition for device friendly name XML element name
#define cg_upnp_device_getadvertiserthead | ( | dev | ) | (dev->advertiser) |
Get the advertiser thread from the device
dev | The device in question |
#define cg_upnp_device_getdescriptionuri | ( | dev | ) | cg_string_getvalue(dev->descriptionURI) |
Get the device's description URI
dev | Device in question |
#define cg_upnp_device_getdevice | ( | dev, | |||
idx | ) | ((CgUpnpDevice *)cg_list_get(dev->deviceList,idx)) |
Find a certain device from the given device list
dev | Device in question | |
idx | Device index number in list |
#define cg_upnp_device_getdevicelist | ( | dev | ) | (dev->deviceList) |
Get the device's internal device list
dev | Device in question |
#define cg_upnp_device_getdevicenode | ( | dev | ) | (dev->deviceNode) |
Return the device XML description node
dev | Device in question |
#define cg_upnp_device_getdevices | ( | dev | ) | ((CgUpnpDevice *)cg_list_gets((CgList *)dev->deviceList)) |
#define cg_upnp_device_getdevicetype | ( | dev | ) | cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_DEVICE_TYPE) |
Return the device type
dev | Device in question |
#define cg_upnp_device_getfriendlyname | ( | dev | ) | cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_FRIENDLY_NAME) |
Return the device's friendly name.
dev | Device in question |
#define cg_upnp_device_gethttplistener | ( | dev | ) | (dev->httpListener) |
Get the device's HTTP listener function
dev | The device in question |
#define cg_upnp_device_gethttpport | ( | dev | ) | (dev->httpPort) |
Get the device's HTTP port
dev | The device in question |
#define cg_upnp_device_geticon | ( | dev, | |||
idx | ) | ((CgUpnpIcon *)cg_list_get((CgList *)dev->iconList,idx)) |
Get an icon by its index from the device's list of icons
dev | Device in question | |
idx | Icon index number |
#define cg_upnp_device_geticonlist | ( | dev | ) | (dev->iconList) |
Get the device's list of icons
dev | Device in question |
#define cg_upnp_device_geticons | ( | dev | ) | ((CgUpnpIcon *)cg_list_gets((CgList *)dev->iconList)) |
#define cg_upnp_device_getinterfaceaddressfromssdppacket | ( | dev | ) | cg_upnp_ssdp_packet_getlocaladdress(dev->ssdpPkt) |
Extract the interface address from the device's SSDP packet
dev | The device in question |
#define cg_upnp_device_getleasetime | ( | dev | ) | (dev->leaseTime) |
#define cg_upnp_device_getlocationfromssdppacket | ( | dev | ) | cg_upnp_ssdp_packet_getlocation(dev->ssdpPkt) |
Extract location information from the device's SSDP packet
dev | The device in question |
#define cg_upnp_device_getmanufacture | ( | dev | ) | cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURE) |
Get the device's manufacturer.
dev | Device in question |
#define cg_upnp_device_getmanufactureurl | ( | dev | ) | cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURE_URL) |
Get the device's manufacturer URL
dev | Device in question |
#define cg_upnp_device_getmodeldescription | ( | dev | ) | cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_DESCRIPTION) |
Get the device model description
dev | Device in question |
#define cg_upnp_device_getmodelname | ( | dev | ) | cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_NAME) |
Get the device's model name
dev | Device in question |
#define cg_upnp_device_getmodelnumber | ( | dev | ) | cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_NUMBER) |
Get the device's model number
dev | Device in question |
#define cg_upnp_device_getmodelurl | ( | dev | ) | cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_URL) |
Get the device's model URL
dev | Device in question |
#define cg_upnp_device_getparentdevice | ( | dev | ) | (dev->parentDevice) |
Return the device's parent device
dev | Device in question |
#define cg_upnp_device_getpresentationurl | ( | dev | ) | cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_PRESENTATION_URL) |
Get the device's presentation URL
dev | Device in question |
#define cg_upnp_device_getrootnode | ( | dev | ) | cg_xml_nodelist_gets(dev->rootNodeList) |
#define cg_upnp_device_getserialnumber | ( | dev | ) | cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_SERIAL_NUMBER) |
Get the device's model number
dev | Device in question |
#define cg_upnp_device_getservice | ( | dev, | |||
idx | ) | ((CgUpnpService *)cg_list_get(dev->serviceList,idx)) |
Get a service from <idx> from the device
dev | Device in question | |
idx | Device index number |
#define cg_upnp_device_getservicelist | ( | dev | ) | (dev->serviceList) |
Get the device's list of services
dev | Device in question |
#define cg_upnp_device_getservices | ( | dev | ) | ((CgUpnpService *)cg_list_gets((CgList *)dev->serviceList)) |
#define cg_upnp_device_getssdppacket | ( | dev | ) | (dev->ssdpPkt) |
Get the device's SSDP packet
dev | The device in question |
#define cg_upnp_device_getssdpserverlist | ( | dev | ) | (dev->ssdpServerList) |
Get the device's list of SSDP servers
dev | The device in question |
#define cg_upnp_device_getudn | ( | dev | ) | cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_UDN) |
Get the device's Unique Device Name (UDN)
dev | Device in question |
#define cg_upnp_device_getupc | ( | dev | ) | cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_UPC) |
Get the device's Universal Product Code (UPC)
dev | Device in question |
#define cg_upnp_device_geturlbase | ( | dev | ) | cg_xml_node_getchildnodevalue(cg_upnp_device_getrootnode(cg_upnp_device_getrootdevice(dev)), CG_UPNP_DEVICE_URLBASE_NAME) |
Get the device's base URL. The base URL is the root for all relative URLs.
dev | Device in question |
#define cg_upnp_device_getuserdata | ( | dev | ) | (dev->userData) |
Get device's user data pointer
dev | Device in question |
#define cg_upnp_device_hasudn | ( | dev | ) | ((0 < cg_strlen(cg_upnp_device_getudn(dev))) ? TRUE : FALSE) |
Check whether the device has a Unique Device Name (UDN)
dev | Device in question |
#define CG_UPNP_DEVICE_HTTP_DEFAULT_PORT 38400 |
Definition for default device HTTP port
#define cg_upnp_device_isdescriptionuri | ( | dev, | |||
url | ) | cg_streq(cg_string_getvalue(dev->descriptionURI), url) |
Check, whether the given URL matches the device's description URI
dev | Device in question | |
url | Description URL to check |
#define cg_upnp_device_isdevicenode | ( | node | ) | cg_xml_node_isname(node, CG_UPNP_DEVICE_ELEM_NAME) |
Check whether the given node is of type CG_UPNP_DEVICE_ELEM_NAME
node | CgXmlAttribute |
#define cg_upnp_device_isdevicetype | ( | dev, | |||
value | ) | cg_streq(cg_upnp_device_getdevicetype(dev), value) |
Check, whether the device is of the exact specified type (including version)
dev | Device in question | |
value | Device type |
#define cg_upnp_device_isrootdevice | ( | dev | ) | ((dev->rootNodeList != NULL) ? TRUE : FALSE) |
Check whether the given device contains a list of root nodes i.e. is it the root device
dev | Device in question |
#define cg_upnp_device_lock | ( | dev | ) | cg_mutex_lock(dev->mutex) |
Lock the device's mutex (grant exclusive access to the device) until cg_upnp_device_unlock is called.
dev | Device in question |
#define CG_UPNP_DEVICE_M_SEARCH_FILTER_INTERVAL 15 |
Definition for M-SEARCH filter interval
#define CG_UPNP_DEVICE_MANUFACTURE "manufacture" |
Definition for device manufacturer XML element name
#define CG_UPNP_DEVICE_MANUFACTURE_URL "manufactureURL" |
Definition for manufacturer URL XML element name
#define CG_UPNP_DEVICE_MODEL_DESCRIPTION "modelDescription" |
Definition for device model description XML element name
#define CG_UPNP_DEVICE_MODEL_NAME "modelName" |
Definition fo device model name XML element name
#define CG_UPNP_DEVICE_MODEL_NUMBER "modelNumber" |
Definition for device model number XML element name
#define CG_UPNP_DEVICE_MODEL_URL "modelURL" |
Definition for device model URL XML element name
#define cg_upnp_device_next | ( | dev | ) | (CgUpnpDevice *)cg_list_next((CgList *)dev) |
Get the next device in the device list. Use as an iterator.
dev | Current device |
#define CG_UPNP_DEVICE_PRESENTATION_URL "presentationURL" |
Definition for device presentation URL XML element name
#define cg_upnp_device_remove | ( | dev | ) | cg_list_remove((CgList *)dev) |
Remove the device from the device list.
dev | Device in question |
#define CG_UPNP_DEVICE_SERIAL_NUMBER "serialNumber" |
Definition for device serial number XML element name
#define cg_upnp_device_setdescriptionuri | ( | dev, | |||
url | ) | cg_string_setvalue(dev->descriptionURI, url) |
Set the given URL as the device's description URI
dev | Device in question | |
url | Description URL |
#define cg_upnp_device_setdevicetype | ( | dev, | |||
value | ) | cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_DEVICE_TYPE, value) |
Modify the device type.
dev | Device in question | |
value | Type to set |
#define cg_upnp_device_setfriendlyname | ( | dev, | |||
value | ) | cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_FRIENDLY_NAME, value) |
Modify the device's friendly name.
dev | Device in question | |
value | The friendly name |
#define cg_upnp_device_sethttplistener | ( | dev, | |||
func | ) | (dev->httpListener = func) |
Set an HTTP listener function to the device
dev | The device in question | |
func | The listener function |
#define cg_upnp_device_sethttpport | ( | dev, | |||
value | ) | (dev->httpPort = value) |
Modify the port that the device's HTTP server is listening
dev | The device in question | |
value | Port number |
#define cg_upnp_device_setleasetime | ( | dev, | |||
value | ) | (dev->leaseTime = value) |
Set the device's lease time. The lease time is basically the maximum amount of time that can elapse before an advertisement is broadcast again. It does not set the exact advertisement interval, but rather a time window for each advertisement. Advertisement actually occurs at (more or less) random intervals inside this time window.
dev | Device in question | |
value | Lease time in seconds |
#define cg_upnp_device_setmanufacture | ( | dev, | |||
value | ) | cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURE, value) |
Modify the device's manufacturer.
dev | Device in question | |
value | The manufacturer's name |
#define cg_upnp_device_setmanufactureurl | ( | dev, | |||
value | ) | cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURE_URL, value) |
Modify the device's manufacturer URL
dev | Device in question | |
value | The manufacturer URL |
#define cg_upnp_device_setmodeldescription | ( | dev, | |||
value | ) | cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_DESCRIPTION, value) |
Modify the device model description
dev | Device in question | |
value | The device model description |
#define cg_upnp_device_setmodelname | ( | dev, | |||
value | ) | cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_NAME, value) |
Modify the device's model name
dev | Device in question | |
value | The model name |
#define cg_upnp_device_setmodelnumber | ( | dev, | |||
value | ) | cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_NUMBER, value) |
Modify the device's model number
dev | Device in question | |
value | The model number |
#define cg_upnp_device_setmodelurl | ( | dev, | |||
value | ) | cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MODEL_URL, value) |
Modify the device's model URL
dev | Device in question | |
value | The model URL |
#define cg_upnp_device_setparentdevice | ( | dev, | |||
pDev | ) | (dev->parentDevice = pDev) |
Set a parent device for the given child device
dev | Child device | |
pDev | Parent device |
#define cg_upnp_device_setpresentationurl | ( | dev, | |||
value | ) | cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_PRESENTATION_URL, value) |
Modify the device's presentation URL
dev | Device in question | |
value | The presentation URL |
#define cg_upnp_device_setserialnumber | ( | dev, | |||
value | ) | cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_SERIAL_NUMBER, value) |
Modify the device's serial number
dev | Device in question | |
value | The serial number |
#define cg_upnp_device_setssdppacket | ( | dev, | |||
srcSsdpPkt | ) | cg_upnp_ssdp_packet_copy(dev->ssdpPkt, srcSsdpPkt) |
Modify the device's SSDP packet (creates a copy of the original)
dev | The device in question | |
srcSsdpPkt | The SSDP packet |
#define cg_upnp_device_setudn | ( | dev, | |||
value | ) | cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_UDN, value) |
Modify the device's Unique Device Name (UDN)
dev | Device in question | |
value | The Unique Device Name |
#define cg_upnp_device_setupc | ( | dev, | |||
value | ) | cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_UPC, value) |
Modify the device's Universal Product Code (UPC)
dev | Device in question | |
value | The Universal Product Code |
#define cg_upnp_device_setuserdata | ( | dev, | |||
value | ) | (dev->userData = value) |
Set device's user data pointer
dev | Device in question | |
value | User data pointer |
#define CG_UPNP_DEVICE_UDN "UDN" |
Definition for device UDN XML element name
#define cg_upnp_device_unlock | ( | dev | ) | cg_mutex_unlock(dev->mutex) |
Unlock the device's mutex (release exclusive access to the device) locked previously with cg_upnp_device_lock.
dev | Device in question |
#define CG_UPNP_DEVICE_UPC "UPC" |
Definition for device UPC XML element name
#define CG_UPNP_DEVICE_UPNP_ROOTDEVICE "upnp:rootdevice" |
Definition for UPnP rootdevice ID
#define CG_UPNP_DEVICE_URLBASE_MAXLEN 64 |
Definition for maximum URL base length
#define CG_UPNP_DEVICE_URLBASE_NAME "URLBase" |
Definition for urlbase XML element name
Add a device to the device list
devList | The device list | |
dev | The device to add |
#define cg_upnp_devicelist_clear | ( | devList | ) | cg_list_clear((CgList *)devList, (CG_LIST_DESTRUCTORFUNC)cg_upnp_device_delete) |
Clear the contents of a device list. Use cg_upnp_devicelist_delete instead of this function.
devList | The device list to clear |
#define CG_UPNP_DEVICELIST_ELEM_NAME "deviceList" |
Definition for device XML element list name
#define cg_upnp_devicelist_gets | ( | devList | ) | (CgUpnpDevice *)cg_list_next((CgList *)devList) |
#define cg_upnp_devicelist_size | ( | devList | ) | cg_list_size((CgList *)devList) |
Get the size of the device list
devList | The device list |
#define cg_upnp_service_getdevice | ( | service | ) | ((CgUpnpDevice *)service->parentDevice) |
Get the device associated to the given service
service | The service in question |
#define cg_upnp_service_getrootdevice | ( | service | ) | cg_upnp_device_getrootdevice((CgUpnpDevice *)service->parentDevice) |
Get the root device of the given service
service | The service in question |
typedef struct _CgUpnpDevice CgUpnpDevice |
The generic UPnP device structure.
typedef struct _CgUpnpDevice CgUpnpDeviceList |
The generic UPnP device structure.
BOOL cg_upnp_device_advertiser_start | ( | CgUpnpDevice * | dev | ) |
cg_upnp_device_advertiser_start
Start the advertiser thread for the given device
dev | The device that is to be advertised |
BOOL cg_upnp_device_advertiser_stop | ( | CgUpnpDevice * | dev | ) |
cg_upnp_device_advertiser_stop
Stop the advertiser thread for the given device
dev | Device that is being advertised |
void cg_upnp_device_announce | ( | CgUpnpDevice * | dev | ) |
Broadcast an SSDP:alive to notify control points that the device is available.
dev | Device in question |
void cg_upnp_device_byebye | ( | CgUpnpDevice * | dev | ) |
Broadcast an SSDP:byebye message to notify control points that the device is no longer available.
dev | Device in question |
void cg_upnp_device_clear | ( | CgUpnpDevice * | dev | ) |
Clear a UPnP device structure. This is an internal function and should not be called from outside.
dev | Device in question |
void cg_upnp_device_delete | ( | CgUpnpDevice * | dev | ) |
Delete a UPnP device
dev | Device in question |
CgUpnpAction* cg_upnp_device_getactionbyname | ( | CgUpnpDevice * | dev, | |
char * | name | |||
) |
Find an action from a device by its name
dev | Device in question | |
name | Name of the action |
CgUpnpDevice* cg_upnp_device_getdevicebydescriptionuri | ( | CgUpnpDevice * | dev, | |
char * | url | |||
) |
Find a child device by its description URI.
dev | Device in question | |
url | Description URI |
CgUpnpDevice* cg_upnp_device_getdevicebyexacttype | ( | CgUpnpDevice * | dev, | |
char * | exacttype | |||
) |
Find a device from the device's children by the type of the device. This function searches for devices, whose *complete type string* matches the given string, including version number. For example: "urn:schemas-upnp-org:device:FooDevice:1". If you need to disregard the version number, use cg_upnp_device_getdevicebytype
dev | Device in question | |
exacttype | Type of the device |
CgUpnpDevice* cg_upnp_device_getdevicebytype | ( | CgUpnpDevice * | dev, | |
char * | type | |||
) |
Find a device from the device's children by the type of the device. This function searches for devices, whose *type part* (i.e. not including the version) of the device type string matches the given string. For example: "urn:schemas-upnp-org:device:FooDevice". If you need to know the version of a device, use cg_upnp_devicetype_getversion
dev | Device in question | |
type | Type of the device |
CgUpnpDevice* cg_upnp_device_getdevicebyudn | ( | CgUpnpDevice * | dev, | |
char * | udn | |||
) |
Find a device from the device's children by the UDN of the device.
dev | Device in question | |
udn | Type of the device |
char* cg_upnp_device_getlocationurl | ( | CgUpnpDevice * | dev, | |
char * | host, | |||
char * | buf, | |||
int | bufSize | |||
) |
Get device's location URL. Transforms the given <host> address to URL form: "http://<host>:<port>/description.xml". Port is usually 80 or 38400. If <host> is an IPv6 address, the address is "http://[<host>]:<port>/description.xml".
dev | Device in question | |
host | The device host | |
buf | Buffer to store the resulting URL | |
bufSize | Buffer length |
char* cg_upnp_device_getnotifydevicent | ( | CgUpnpDevice * | dev, | |
char * | buf, | |||
int | bufSize | |||
) |
Get the device's Notification Type (NT). For the root device this is "upnp:rootdevice", otherwise the device's UDN (Unique Device Name).
dev | The device in question | |
buf | Buffer for the Notification Type | |
bufSize | Buffer length |
char* cg_upnp_device_getnotifydevicetypent | ( | CgUpnpDevice * | dev, | |
char * | buf, | |||
int | bufSize | |||
) |
Get the device type
dev | The device in question | |
buf | Buffer for the device type | |
bufSize | Buffer length |
char* cg_upnp_device_getnotifydevicetypeusn | ( | CgUpnpDevice * | dev, | |
char * | buf, | |||
int | bufSize | |||
) |
Get the device's USN (Unique Service Name). For the root device this is "<UDN>::upnp:rootdevice", otherwise the UDN (Unique Device Name).
dev | The device in question | |
buf | Buffer where USN is stored after call | |
bufSize | Buffer size |
char* cg_upnp_device_getnotifydeviceusn | ( | CgUpnpDevice * | dev, | |
char * | buf, | |||
int | bufSize | |||
) |
TODO: cg_upnp_device_getnotifydeviceusn doc
CgUpnpDevice* cg_upnp_device_getrootdevice | ( | CgUpnpDevice * | dev | ) |
Return the root (i.e. the topmost) device in the device structure
dev | Traverses the device tree upwards starting from this device |
CgUpnpService* cg_upnp_device_getservicebycontrolurl | ( | CgUpnpDevice * | dev, | |
char * | url | |||
) |
Find a service from a device by its control URL
dev | Device in question | |
url | Control URL |
CgUpnpService* cg_upnp_device_getservicebyeventsuburl | ( | CgUpnpDevice * | dev, | |
char * | url | |||
) |
Find a service from a device by its event subscription URL
dev | Device in question | |
url | Event Subscription URL |
CgUpnpService* cg_upnp_device_getservicebyexacttype | ( | CgUpnpDevice * | dev, | |
char * | type | |||
) |
Find a service from the device by the type of the service. This function searches for services, whose *complete type string* matches the given string, including version number. For example: "urn:schemas-upnp-org:service:ContentDirectory:1". If you need to know the version of a service, use cg_upnp_servicetype_getversion
dev | Device in question | |
type | Type of the service |
CgUpnpService* cg_upnp_device_getservicebyscpdurl | ( | CgUpnpDevice * | dev, | |
char * | url | |||
) |
Find a service from the device by the SCPD (Service Control Protocol Definition) URL of the service.
dev | Device in question | |
url | SCPD URL |
CgUpnpService* cg_upnp_device_getservicebyserviceid | ( | CgUpnpDevice * | dev, | |
char * | serviceId | |||
) |
Find service from the device by a given serviceId. This function searches recursively device and its subdevices for a service with a given serviceId
dev | Device in question | |
serviceId | serviceId of the service |
CgUpnpService* cg_upnp_device_getservicebysid | ( | CgUpnpDevice * | dev, | |
char * | sid | |||
) |
Find a service from the device by the subscribtion ID
dev | Device in question | |
sid | Subscription ID of the service |
CgUpnpService* cg_upnp_device_getservicebytype | ( | CgUpnpDevice * | dev, | |
char * | type | |||
) |
Find a service from the device by the type of the service. This function searches for services, whose *type part* (i.e. not including the version) of the service type string matches the given string. For example: "urn:schemas-upnp-org:service:ContentDirectory". If you need to know the version of a service, use cg_upnp_servicetype_getversion
dev | Device in question | |
type | Type of the service |
CgUpnpStateVariable* cg_upnp_device_getstatevariablebyname | ( | CgUpnpDevice * | dev, | |
char * | name | |||
) |
Find a state variable from a device by its name
dev | Device in question | |
name | Name of the state variable |
void cg_upnp_device_httprequestrecieved | ( | CgHttpRequest * | httpReq | ) |
Handler function for a received HTTP request. Delegates GET and POST requests to their respective handlers, or treats as a BAD REQUEST, when appropriate.
httpReq | Received HTTP request |
BOOL cg_upnp_device_ipchanged | ( | CgUpnpDevice * | dev | ) |
Notify device that IP address of the host has been changed.
dev | dev The device in question |
BOOL cg_upnp_device_loaddescriptionfile | ( | CgUpnpDevice * | dev, | |
char * | fileName | |||
) |
Load and parse the device description from an XML file. Not available for T-Engine, ITron and BTron platforms.
dev | Device in question | |
fileName | The file name containing the device description XML document |
CgUpnpDevice* cg_upnp_device_new | ( | ) |
Create a new UPnP device
BOOL cg_upnp_device_parsedescription | ( | CgUpnpDevice * | dev, | |
char * | desciption, | |||
int | descriptionLen | |||
) |
Parse the device description XML document.
dev | Device in question | |
desciption | Buffer containing the device description in XML format | |
descriptionLen | Buffer length |
BOOL cg_upnp_device_parsedescriptionurl | ( | CgUpnpDevice * | dev, | |
CgNetURL * | url | |||
) |
Fetch and parse the device description XML file, located in the given URL.
dev | Device in question | |
url | An internet resource |
BOOL cg_upnp_device_postsearchresponse | ( | CgUpnpDevice * | dev, | |
CgUpnpSSDPPacket * | ssdpPkt, | |||
char * | st, | |||
char * | usn | |||
) |
Post a response to an SSDP search message
dev | The device in question | |
ssdpPkt | Received SSDP packet | |
st | Service Type (ST) | |
usn | Unique Service Name (USN) |
void cg_upnp_device_setactionlistener | ( | CgUpnpDevice * | dev, | |
CG_UPNP_ACTION_LISTNER | actionListner | |||
) |
Set an action listener to the device. Actions are basically commands, that the device (service) responds to.
dev | Device in question | |
actionListner | The action listener |
void cg_upnp_device_setdevicenode | ( | CgUpnpDevice * | dev, | |
CgXmlNode * | node | |||
) |
Set the device description node and initialise its child nodes
dev | Device in question | |
node | The XML structure to be set as the device's description |
void cg_upnp_device_setquerylistener | ( | CgUpnpDevice * | dev, | |
CG_UPNP_STATEVARIABLE_LISTNER | queryListner | |||
) |
Set a query listener to the device. Queries are meant for state variables.
dev | Device in question | |
queryListner | The query listener |
void cg_upnp_device_seturlbase | ( | CgUpnpDevice * | dev, | |
char * | value | |||
) |
Modify the device's URL base The base URL is the root for all relative URLs.
dev | Device in question | |
value | The URL base |
void cg_upnp_device_ssdplistener | ( | CgUpnpSSDPPacket * | ssdpPkt | ) |
The SSDP message handler function.
ssdpPkt | SSDP Packet |
void cg_upnp_device_ssdpmessagereceived | ( | CgUpnpDevice * | dev, | |
CgUpnpSSDPPacket * | ssdpPkt, | |||
int | filter | |||
) |
SSDP message handler
dev | The device in question | |
ssdpPkt | Received SSDP packet |
BOOL cg_upnp_device_start | ( | CgUpnpDevice * | dev | ) |
Start the device. This essentially starts:
dev | Device in question |
BOOL cg_upnp_device_stop | ( | CgUpnpDevice * | dev | ) |
Stop the device. This concerns:
dev | Device in question |
BOOL cg_upnp_device_updatefromssdppacket | ( | CgUpnpDevice * | dev, | |
CgUpnpSSDPPacket * | ssdpPkt | |||
) |
Update the device's contents from an SSDP packet if necessary.
dev | The device to potentially update | |
ssdpPkt | The SSDP packet to make decisions on |
void cg_upnp_devicelist_delete | ( | CgUpnpDeviceList * | devList | ) |
Delete a device list completely, freeing all devices and their contents.
devList | The device list to delete |
CgUpnpDeviceList* cg_upnp_devicelist_new | ( | ) |
Create a new device list
char* cg_upnp_devicetype_getdevice | ( | char * | deviceType | ) |
Get the device part of a device type string (usually just "device")
deviceType | A device type string (usually the result from cg_upnp_device_getdevicetype) |
char* cg_upnp_devicetype_getidentifier | ( | char * | deviceType | ) |
Get the identifier-part of a device type string (usually "urn")
deviceType | A device type string (usually the result from cg_upnp_device_getdevicetype) |
char* cg_upnp_devicetype_getschematype | ( | char * | deviceType | ) |
Get the schema type part of a device type string (without last colon) (ex. "urn:schemas-upnp-org:device:ContentDirectory")
deviceType | A device type string (usually the result from cg_upnp_device_getdevicetype) |
char* cg_upnp_devicetype_gettype | ( | char * | deviceType | ) |
Get the type part of a device type string (ex. "ContentDirectory")
deviceType | A device type string (usually the result from cg_upnp_device_getdevicetype) |
char* cg_upnp_devicetype_geturn | ( | char * | deviceType | ) |
Get the URN part of a device type string (usually "schemas-upnp-org")
deviceType | A device type string (usually the result from cg_upnp_device_getdevicetype) |
char* cg_upnp_devicetype_getversion | ( | char * | deviceType | ) |
Get the version part of a device type string (ex. "1")
deviceType | A device type string (usually the result from cg_upnp_device_getdevicetype) |