CyberLink for C

cdevice.h File Reference

#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_MANUFACTURER   "manufacturer"
#define CG_UPNP_DEVICE_MANUFACTURER_URL   "manufacturerURL"
#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_setmanufacturer(dev, value)   cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURER, value)
#define cg_upnp_device_getmanufacturer(dev)   cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURER)
#define cg_upnp_device_setmanufacturerurl(dev, value)   cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURER_URL, value)
#define cg_upnp_device_getmanufacturerurl(dev)   cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURER_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_waitforlock(dev, t)   cg_mutex_waitforlock(dev->mutex,t)
#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((CgList*)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_getnservices(dev)   cg_upnp_servicelist_size(dev->serviceList)
#define cg_upnp_device_getservice(dev, idx)   ((CgUpnpService *)cg_list_get((CgList *)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_get(devList, index)   (CgUpnpDevice *)cg_list_get((CgList *)devList, index)
#define cg_upnp_devicelist_add(devList, dev)   cg_list_add((CgList *)devList, (CgList *)dev)
#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_gethttpserverlist(dev)   (dev->httpServerList)
#define cg_upnp_device_getssdpserverlist(dev)   (dev->ssdpServerList)
#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 struct _CgUpnpDevice CgUpnpDevice
 The generic UPnP device structure.
typedef struct _CgUpnpDevice CgUpnpDeviceList

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_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_updateudn (CgUpnpDevice *dev)
void cg_upnp_device_seturlbase (CgUpnpDevice *dev, char *value)
BOOL cg_upnp_device_start (CgUpnpDevice *dev)
BOOL cg_upnp_device_stop (CgUpnpDevice *dev)
BOOL cg_upnp_device_isrunning (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)
CgUpnpIcon * cg_upnp_device_getsmallesticon (CgUpnpDevice *dev)
CgUpnpIcon * cg_upnp_device_getsmallesticonbymimetype (CgUpnpDevice *dev, char *mimeType)
BOOL cg_upnp_device_getabsoluteiconurl (CgUpnpDevice *dev, CgUpnpIcon *icon, CgString *buf)
BOOL cg_upnp_device_addicon (CgUpnpDevice *dev, CgUpnpIcon *icon)
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)
BOOL cg_upnp_device_advertiser_isrunning (CgUpnpDevice *dev)

Define Documentation

#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

Parameters:
devThe device in question
#define cg_upnp_device_getdescriptionuri (   dev)    cg_string_getvalue(dev->descriptionURI)

Get the device's description URI

Parameters:
devDevice in question
#define cg_upnp_device_getdevice (   dev,
  idx 
)    ((CgUpnpDevice *)cg_list_get((CgList*)dev->deviceList,idx))

Find a certain device from the given device list

Parameters:
devDevice in question
idxDevice index number in list
Returns:
NULL if not found; otherwise the device pointer
#define cg_upnp_device_getdevicelist (   dev)    (dev->deviceList)

Get the device's internal device list

Parameters:
devDevice in question
#define cg_upnp_device_getdevicenode (   dev)    (dev->deviceNode)

Return the device XML description node

Parameters:
devDevice in question
#define cg_upnp_device_getdevices (   dev)    ((CgUpnpDevice *)cg_list_gets((CgList *)dev->deviceList))
Todo:
Correct explanation...
Parameters:
devDevice in question
#define cg_upnp_device_getdevicetype (   dev)    cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_DEVICE_TYPE)

Return the device type

Parameters:
devDevice in question
Returns:
Device type
#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.

Parameters:
devDevice in question
Returns:
The device's friendly name
#define cg_upnp_device_gethttplistener (   dev)    (dev->httpListener)

Get the device's HTTP listener function

Parameters:
devThe device in question
#define cg_upnp_device_gethttpport (   dev)    (dev->httpPort)

Get the device's HTTP port

Parameters:
devThe device in question
#define cg_upnp_device_gethttpserverlist (   dev)    (dev->httpServerList)

Get the HTTP server list

Parameters:
devThe 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

Parameters:
devDevice in question
idxIcon index number
#define cg_upnp_device_geticonlist (   dev)    (dev->iconList)

Get the device's list of icons

Parameters:
devDevice in question
#define cg_upnp_device_geticons (   dev)    ((CgUpnpIcon *)cg_list_gets((CgList *)dev->iconList))
Todo:
Correct explanation...
Parameters:
devDevice in question
#define cg_upnp_device_getinterfaceaddressfromssdppacket (   dev)    cg_upnp_ssdp_packet_getlocaladdress(dev->ssdpPkt)

Extract the interface address from the device's SSDP packet

Parameters:
devThe device in question
#define cg_upnp_device_getleasetime (   dev)    (dev->leaseTime)

Get the device's lease time. See cg_upnp_device_setleasetime.

Parameters:
devDevice in question
#define cg_upnp_device_getlocationfromssdppacket (   dev)    cg_upnp_ssdp_packet_getlocation(dev->ssdpPkt)

Extract location information from the device's SSDP packet

Parameters:
devThe device in question
#define cg_upnp_device_getmanufacturer (   dev)    cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURER)

Get the device's manufacturer.

Parameters:
devDevice in question
Returns:
value The manufacturer's name
#define cg_upnp_device_getmanufacturerurl (   dev)    cg_xml_node_getchildnodevalue(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURER_URL)

Get the device's manufacturer URL

Parameters:
devDevice in question
Returns:
The manufacturer URL
#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

Parameters:
devDevice in question
Returns:
The device model description
#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

Parameters:
devDevice in question
Returns:
The model name
#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

Parameters:
devDevice in question
Returns:
The model number
#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

Parameters:
devDevice in question
Returns:
The model URL
#define cg_upnp_device_getnservices (   dev)    cg_upnp_servicelist_size(dev->serviceList)

Get the number of services known by the device

Parameters:
devDevice in question
Returns:
The number of devices in the control point's device list
#define cg_upnp_device_getparentdevice (   dev)    (dev->parentDevice)

Return the device's parent device

Parameters:
devDevice 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

Parameters:
devDevice in question
Returns:
The presentation URL
#define cg_upnp_device_getrootnode (   dev)    cg_xml_nodelist_gets(dev->rootNodeList)

Return the device's root node

Todo:
Correct explanation...
Parameters:
devDevice in question
#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

Parameters:
devDevice in question
Returns:
The serial number
#define cg_upnp_device_getservice (   dev,
  idx 
)    ((CgUpnpService *)cg_list_get((CgList *)dev->serviceList,idx))

Get a service from <idx> from the device

Parameters:
devDevice in question
idxDevice index number
#define cg_upnp_device_getservicelist (   dev)    (dev->serviceList)

Get the device's list of services

Parameters:
devDevice in question
#define cg_upnp_device_getservices (   dev)    ((CgUpnpService *)cg_list_gets((CgList *)dev->serviceList))
Todo:
Correct explanation...
Parameters:
devDevice in question
#define cg_upnp_device_getssdppacket (   dev)    (dev->ssdpPkt)

Get the device's SSDP packet

Parameters:
devThe device in question
#define cg_upnp_device_getssdpserverlist (   dev)    (dev->ssdpServerList)

Get the device's list of SSDP servers

Parameters:
devThe device in question

Get the SSDP server list

Parameters:
devThe device in question
#define cg_upnp_device_getssdpserverlist (   dev)    (dev->ssdpServerList)

Get the device's list of SSDP servers

Parameters:
devThe device in question

Get the SSDP server list

Parameters:
devThe 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)

Parameters:
devDevice in question
Returns:
The Unique Device Name
#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)

Parameters:
devDevice in question
Returns:
The Universal Product Code
#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.

Parameters:
devDevice in question
Returns:
The URL base
#define cg_upnp_device_getuserdata (   dev)    (dev->userData)

Get device's user data pointer

Parameters:
devDevice in question
Returns:
pointer to user data
#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)

Parameters:
devDevice in question
Returns:
TRUE if the device has a UDN; otherwise FALSE
#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

Parameters:
devDevice in question
urlDescription 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

Parameters:
nodeCgXmlAttribute
#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)

Parameters:
devDevice in question
valueDevice type
Returns:
BOOL: TRUE if device matches given type; otherwise FALSE
#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

Parameters:
devDevice 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.

Parameters:
devDevice in question
#define CG_UPNP_DEVICE_M_SEARCH_FILTER_INTERVAL   15

Definition for M-SEARCH filter interval

#define CG_UPNP_DEVICE_MANUFACTURER   "manufacturer"

Definition for device manufacturer XML element name

#define CG_UPNP_DEVICE_MANUFACTURER_URL   "manufacturerURL"

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.

Parameters:
devCurrent 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.

Parameters:
devDevice 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

Parameters:
devDevice in question
urlDescription 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.

Parameters:
devDevice in question
valueType 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.

Parameters:
devDevice in question
valueThe friendly name
#define cg_upnp_device_sethttplistener (   dev,
  func 
)    (dev->httpListener = func)

Set an HTTP listener function to the device

Parameters:
devThe device in question
funcThe listener function
#define cg_upnp_device_sethttpport (   dev,
  value 
)    (dev->httpPort = value)

Get the device associated to the given service

Parameters:
serviceThe service in question Get the root device of the given service
serviceThe service in question Modify the port that the device's HTTP server is listening
devThe device in question
valuePort 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.

Parameters:
devDevice in question
valueLease time in seconds
#define cg_upnp_device_setmanufacturer (   dev,
  value 
)    cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURER, value)

Modify the device's manufacturer.

Parameters:
devDevice in question
valueThe manufacturer's name
#define cg_upnp_device_setmanufacturerurl (   dev,
  value 
)    cg_xml_node_setchildnode(cg_upnp_device_getdevicenode(dev), CG_UPNP_DEVICE_MANUFACTURER_URL, value)

Modify the device's manufacturer URL

Parameters:
devDevice in question
valueThe 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

Parameters:
devDevice in question
valueThe 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

Parameters:
devDevice in question
valueThe 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

Parameters:
devDevice in question
valueThe 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

Parameters:
devDevice in question
valueThe model URL
#define cg_upnp_device_setparentdevice (   dev,
  pDev 
)    (dev->parentDevice = pDev)

Set a parent device for the given child device

Parameters:
devChild device
pDevParent 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

Parameters:
devDevice in question
valueThe 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

Parameters:
devDevice in question
valueThe 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)

Parameters:
devThe device in question
srcSsdpPktThe 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)

Parameters:
devDevice in question
valueThe 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)

Parameters:
devDevice in question
valueThe Universal Product Code
#define cg_upnp_device_setuserdata (   dev,
  value 
)    (dev->userData = value)

Set device's user data pointer

Parameters:
devDevice in question
valueUser 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.

Parameters:
devDevice 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

#define cg_upnp_device_waitforlock (   dev,
  t 
)    cg_mutex_waitforlock(dev->mutex,t)

Lock the device's mutex with timeout, return TRUE if exclusive access is gained Release lock with cg_upnp_device_unlock is called.

Parameters:
devDevice in question
ttimeout in ms
#define cg_upnp_devicelist_add (   devList,
  dev 
)    cg_list_add((CgList *)devList, (CgList *)dev)

Add a device to the device list

Parameters:
devListThe device list
devThe 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.

Parameters:
devListThe device list to clear
#define CG_UPNP_DEVICELIST_ELEM_NAME   "deviceList"

Definition for device XML element list name

#define cg_upnp_devicelist_get (   devList,
  index 
)    (CgUpnpDevice *)cg_list_get((CgList *)devList, index)

Get an device from the device list by the index

Parameters:
devListThe device list
indexThe index of the device to get
#define cg_upnp_devicelist_gets (   devList)    (CgUpnpDevice *)cg_list_next((CgList *)devList)
Todo:
Correct description
Parameters:
devListThe device list
#define cg_upnp_devicelist_size (   devList)    cg_list_size((CgList *)devList)

Get the size of the device list

Parameters:
devListThe device list

Typedef Documentation

typedef struct _CgUpnpDevice CgUpnpDevice

The generic UPnP device structure.

Note:
This struct can also be cast to a CgList* and used as a node in a linked list with cg_list_* functions.

Function Documentation

BOOL cg_upnp_device_addicon ( CgUpnpDevice *  dev,
CgUpnpIcon *  icon 
)

Get a smallest icon

Parameters:
devDevice in question
iconIcon to add
BOOL cg_upnp_device_advertiser_isrunning ( CgUpnpDevice *  dev)

Check if the advertiser has been started

Parameters:
devDevice that is being advertised

cg_upnp_device_advertiser_isrunning

Check if the advertiser has been started

Parameters:
devDevice that is being advertised
BOOL cg_upnp_device_advertiser_start ( CgUpnpDevice *  dev)

Start the advertiser thread for the given device

Parameters:
devThe device in question

cg_upnp_device_advertiser_start

Start the advertiser thread for the given device

Parameters:
devThe device that is to be advertised
BOOL cg_upnp_device_advertiser_stop ( CgUpnpDevice *  dev)

Stop the advertiser thread for the given device

Parameters:
devThe device in question

cg_upnp_device_advertiser_stop

Stop the advertiser thread for the given device

Parameters:
devDevice that is being advertised
void cg_upnp_device_announce ( CgUpnpDevice *  dev)

Broadcast an SSDP:alive to notify control points that the device is available.

Parameters:
devDevice 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.

Parameters:
devDevice 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.

Parameters:
devDevice in question
void cg_upnp_device_delete ( CgUpnpDevice *  dev)

Delete a UPnP device

Parameters:
devDevice in question
BOOL cg_upnp_device_getabsoluteiconurl ( CgUpnpDevice *  dev,
CgUpnpIcon *  icon,
CgString *  buf 
)

Get an icon by its index from the device's list of icons

Parameters:
devDevice in question
iconIcon in question
bufBuffer to return the full icon's url
Returns:
TRUE if the absolute url is created, otherwise FALSE.
CgUpnpAction* cg_upnp_device_getactionbyname ( CgUpnpDevice *  dev,
char *  name 
)

Find an action from a device by its name

Parameters:
devDevice in question
nameName of the action
CgUpnpDevice* cg_upnp_device_getdevicebydescriptionuri ( CgUpnpDevice *  dev,
char *  url 
)

Find a child device by its description URI.

Parameters:
devDevice in question
urlDescription URI
CgUpnpDevice* cg_upnp_device_getdevicebyexacttype ( CgUpnpDevice *  dev,
char *  exacttype 
)

Find a device from the device's children by the exact 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, use cg_upnp_device_getdevicebytype

Parameters:
ctrlPointControlpoint in question
exacttypeType of the device

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

Parameters:
devDevice in question
exacttypeType 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

Parameters:
devDevice in question
typeType 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.

Parameters:
devDevice in question
typeType of the device

Find a device from the device's children by the UDN of the device.

Parameters:
devDevice in question
udnType 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".

Parameters:
devDevice in question
hostThe device host
bufBuffer to store the resulting URL
bufSizeBuffer 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).

Parameters:
devThe device in question
bufBuffer for the Notification Type
bufSizeBuffer length
char* cg_upnp_device_getnotifydevicetypent ( CgUpnpDevice *  dev,
char *  buf,
int  bufSize 
)

Get the device type

Parameters:
devThe device in question
bufBuffer for the device type
bufSizeBuffer 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).

Parameters:
devThe device in question
bufBuffer where USN is stored after call
bufSizeBuffer size
Returns:
Pointer to buf
char* cg_upnp_device_getnotifydeviceusn ( 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).

Parameters:
devThe device in question
CgUpnpDevice* cg_upnp_device_getrootdevice ( CgUpnpDevice *  dev)

Return the root (i.e. the topmost) device in the device structure

Parameters:
devTraverses 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

Parameters:
devDevice in question
urlControl URL
CgUpnpService* cg_upnp_device_getservicebyeventsuburl ( CgUpnpDevice *  dev,
char *  url 
)

Find a service from a device by its event subscription URL

Parameters:
devDevice in question
urlEvent 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

Parameters:
devDevice in question
typeType 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.

Parameters:
devDevice in question
urlSCPD 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

Parameters:
devDevice in question
serviceIdserviceId of the service
Returns:
service matching the given serviceId
CgUpnpService* cg_upnp_device_getservicebysid ( CgUpnpDevice *  dev,
char *  sid 
)

Find a service from the device by the subscribtion ID

Parameters:
devDevice in question
sidSubscription ID of the service

Find a service from its Subscription ID

Parameters:
devDevice in question
char*Subscription-ID (SID)
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 of the service type string matches the given string. For example: "ContentDirectory". If you need to search for an exact service type, use cg_upnp_device_getservicebyname

Parameters:
devDevice in question
typeType of the service

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

Parameters:
devDevice in question
typeType of the service
CgUpnpIcon* cg_upnp_device_getsmallesticon ( CgUpnpDevice *  dev)

Get a smallest icon

Parameters:
devDevice in question
Returns:
A smallest icon.
CgUpnpIcon* cg_upnp_device_getsmallesticonbymimetype ( CgUpnpDevice *  dev,
char *  mimeType 
)

Get a smallest icon of a specified mime type

Parameters:
devDevice in question
mimeTypeMime type to get
Returns:
A smallest icon.
CgUpnpStateVariable* cg_upnp_device_getstatevariablebyname ( CgUpnpDevice *  dev,
char *  name 
)

Find a state variable from a device by its name

Parameters:
devDevice in question
nameName 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.

Parameters:
httpReqReceived HTTP request
BOOL cg_upnp_device_ipchanged ( CgUpnpDevice *  dev)

Notify device that IP address of the host has been changed.

Parameters:
devdev The device in question
Returns:
success of changing used interfaces
BOOL cg_upnp_device_isrunning ( CgUpnpDevice *  dev)

Check if the device] has been started

Parameters:
devDevice that is being advertised
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.

Parameters:
devDevice in question
descriptionBuffer containing the device description in XML format
descriptionLenBuffer length
Returns:
TRUE, if the buffer was successfully parsed; otherwise FALSE
BOOL cg_upnp_device_parsedescriptionurl ( CgUpnpDevice *  dev,
CgNetURL *  url 
)

Fetch and parse the device description XML file, located in the given URL.

Parameters:
devDevice in question
urlAn internet resource
Returns:
TRUE, if the buffer was successfully parsed; otherwise FALSE
BOOL cg_upnp_device_postsearchresponse ( CgUpnpDevice *  dev,
CgUpnpSSDPPacket *  ssdpPkt,
char *  st,
char *  usn 
)

Post a response to an SSDP search message

Parameters:
devThe device in question
ssdpPktReceived SSDP packet
stService Type (ST)
usnUnique 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.

Parameters:
devDevice in question
actionListenerThe action listener
void cg_upnp_device_setdevicenode ( CgUpnpDevice *  dev,
CgXmlNode *  node 
)

Set the device description node and initialise its child nodes

Parameters:
devDevice in question
nodeThe 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.

Parameters:
devDevice in question
actionListenerThe 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.

Parameters:
devDevice in question
valueThe URL base
void cg_upnp_device_ssdplistener ( CgUpnpSSDPPacket *  ssdpPkt)

The SSDP message handler function.

Parameters:
ssdpPktSSDP Packet
void cg_upnp_device_ssdpmessagereceived ( CgUpnpDevice *  dev,
CgUpnpSSDPPacket *  ssdpPkt,
int  filter 
)

SSDP message handler

Parameters:
devThe device in question
ssdpPktReceived SSDP packet
BOOL cg_upnp_device_start ( CgUpnpDevice *  dev)

Start the device. This essentially starts:

  • The HTTP server
  • The SSDP server
  • Advertising the device
  • Alive notification
Parameters:
devDevice in question
BOOL cg_upnp_device_stop ( CgUpnpDevice *  dev)

Stop the device. This concerns:

  • The HTTP server
  • The SSDP server
  • Advertising the device
  • Byebye notification
Parameters:
devDevice in question
BOOL cg_upnp_device_updatefromssdppacket ( CgUpnpDevice *  dev,
CgUpnpSSDPPacket *  ssdpPkt 
)

Update the device's contents from an SSDP packet if necessary.

Parameters:
devThe device to potentially update
ssdpPktThe SSDP packet to make decisions on
Returns:
TRUE if the device was updated; otherwise FALSE
void cg_upnp_device_updateudn ( CgUpnpDevice *  dev)

Update new Unique Device Name (UDN)

Parameters:
devDevice in question
void cg_upnp_devicelist_delete ( CgUpnpDeviceList *  devList)

Delete a device list completely, freeing all devices and their contents.

Parameters:
devListThe 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")

Parameters:
deviceTypeA device type string (usually the result from cg_upnp_device_getdevicetype)
Returns:
A newly-created char* if successful; otherwise NULL

Get the device part of a device type string (usually just "device")

Parameters:
deviceTypeA device type string (usually the result from cg_upnp_device_getdevicetype)
Returns:
A newly-created char* if successful; otherwise NULL
char* cg_upnp_devicetype_getidentifier ( char *  deviceType)

Get the identifier-part of a device type string (usually "urn")

Parameters:
deviceTypeA device type string (usually the result from cg_upnp_device_getdevicetype)
Returns:
A newly-created char* if successful; otherwise NULL

Get the identifier-part of a device type string (usually "urn")

Parameters:
deviceTypeA device type string (usually the result from cg_upnp_device_getdevicetype)
Returns:
A newly-created char* if successful; otherwise NULL
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")

Parameters:
deviceTypeA device type string (usually the result from cg_upnp_device_getdevicetype)
Returns:
A newly-created char* if successful; otherwise NULL

Get the schema type part of a device type string (without last colon) (ex. "urn:schemas-upnp-org:device:ContentDirectory")

Parameters:
deviceTypeA device type string (usually the result from cg_upnp_device_getdevicetype)
Returns:
A newly-created char* if successful; otherwise NULL
char* cg_upnp_devicetype_gettype ( char *  deviceType)

Get the type part of a device type string (ex. "ContentDirectory")

Parameters:
deviceTypeA device type string (usually the result from cg_upnp_device_getdevicetype)
Returns:
A newly-created char* if successful; otherwise NULL

Get the type part of a device type string (ex. "ContentDirectory")

Parameters:
deviceTypeA device type string (usually the result from cg_upnp_device_getdevicetype)
Returns:
A newly-created char* if successful; otherwise NULL
char* cg_upnp_devicetype_geturn ( char *  deviceType)

Get the URN part of a device type string (usually "schemas-upnp-org")

Parameters:
deviceTypeA device type string (usually the result from cg_upnp_device_getdevicetype)
Returns:
A newly-created char* if successful; otherwise NULL

Get the URN part of a device type string (usually "schemas-upnp-org")

Parameters:
deviceTypeA device type string (usually the result from cg_upnp_device_getdevicetype)
Returns:
A newly-created char* if successful; otherwise NULL
char* cg_upnp_devicetype_getversion ( char *  deviceType)

Get the version part of a device type string (ex. "1")

Parameters:
deviceTypeA device type string (usually the result from cg_upnp_device_getdevicetype)
Returns:
A newly-created char* if successful; otherwise NULL

Get the version part of a device type string (ex. "1")

Parameters:
deviceTypeA device type string (usually the result from cg_upnp_device_getdevicetype)
Returns:
A newly-created char* if successful; otherwise NULL