CyberLink for C

cservice.h File Reference

#include <cybergarage/typedef.h>
#include <cybergarage/xml/cxml.h>
#include <cybergarage/util/ctime.h>
#include <cybergarage/util/clist.h>
#include <cybergarage/util/cstring.h>
#include <cybergarage/util/cmutex.h>
#include <cybergarage/net/curl.h>
#include <cybergarage/upnp/caction.h>
#include <cybergarage/upnp/cstatevariable.h>
#include <cybergarage/upnp/ssdp/cssdp_server.h>
#include <cybergarage/upnp/event/csubscriber.h>

Data Structures

struct  _CgUpnpService

Defines

#define CG_UPNP_SERVICE_ELEM_NAME   "service"
#define CG_UPNP_SERVICELIST_ELEM_NAME   "serviceList"
#define CG_UPNP_SERVICE_TYPE   "serviceType"
#define CG_UPNP_SERVICE_ID   "serviceId"
#define CG_UPNP_SERVICE_SCPDURL   "SCPDURL"
#define CG_UPNP_SERVICE_CONTROL_URL   "controlURL"
#define CG_UPNP_SERVICE_EVENT_SUB_URL   "eventSubURL"
#define CG_UPNP_SERVICE_EVENT_KEY_INVALID   0
#define CG_UPNP_SERVICE_NOTIFY_WAITTIME   1000
#define cg_upnp_service_next(service)   (CgUpnpService *)cg_list_next((CgList *)service)
#define cg_upnp_service_isservicenode(node)   cg_xml_node_isname(node, CG_UPNP_SERVICE_ELEM_NAME)
#define cg_upnp_service_getscpdnode(service)   cg_xml_nodelist_gets(service->scpdNodeList)
#define cg_upnp_service_setservicenode(service, node)   (service->serviceNode = node)
#define cg_upnp_service_getservicenode(service)   (service->serviceNode)
#define cg_upnp_service_getdevicenode(service)   cg_xml_node_getparentnode(cg_xml_node_getparentnode(service->serviceNode))
#define cg_upnp_service_isparsed(service)   (service->parsed)
#define cg_upnp_service_setservicetype(service, value)   cg_xml_node_setchildnode(cg_upnp_service_getservicenode(service), CG_UPNP_SERVICE_TYPE, value)
#define cg_upnp_service_getservicetype(service)   cg_xml_node_getchildnodevalue(cg_upnp_service_getservicenode(service), CG_UPNP_SERVICE_TYPE)
#define cg_upnp_service_setserviceid(service, value)   cg_xml_node_setchildnode(cg_upnp_service_getservicenode(service), CG_UPNP_SERVICE_ID, value)
#define cg_upnp_service_getserviceid(service)   cg_xml_node_getchildnodevalue(cg_upnp_service_getservicenode(service), CG_UPNP_SERVICE_ID)
#define cg_upnp_service_setscpdurl(service, value)   cg_xml_node_setchildnode(cg_upnp_service_getservicenode(service), CG_UPNP_SERVICE_SCPDURL, value)
#define cg_upnp_service_setcontrolurl(service, value)   cg_xml_node_setchildnode(cg_upnp_service_getservicenode(service), CG_UPNP_SERVICE_CONTROL_URL, value)
#define cg_upnp_service_seteventsuburl(service, value)   cg_xml_node_setchildnode(cg_upnp_service_getservicenode(service), CG_UPNP_SERVICE_EVENT_SUB_URL, value)
#define cg_upnp_service_hasactionbyname(service, name)   ((cg_upnp_service_getactionbyname(service,name) != NULL) ? TRUE : FALSE)
#define cg_upnp_service_hasstatevariablebyname(service, name)   ((cg_upnp_service_getstatevariablebyname(service,name) != NULL) ? TRUE : FALSE)
#define cg_upnp_service_setdevice(service, dev)   (service->parentDevice = 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_service_getsubscribers(service)   cg_upnp_subscriberlist_gets(service->subscriberList)
#define cg_upnp_service_getnsubscribers(service)   cg_upnp_subscriberlist_size(service->subscriberList)
#define cg_upnp_service_notifyallstatevariables(service)   cg_upnp_service_notifyall(service, FALSE);
#define cg_upnp_service_lock(service)   cg_mutex_lock(service->mutex)
#define cg_upnp_service_unlock(service)   cg_mutex_unlock(service->mutex)
#define cg_upnp_service_setsubscriptionsid(service, value)   cg_string_setvalue(service->subscriptionSid, value)
#define cg_upnp_service_getsubscriptionsid(service)   cg_string_getvalue(service->subscriptionSid)
#define cg_upnp_service_issubscribed(service)   ((0 < cg_string_length(service->subscriptionSid)) ? TRUE : FALSE)
#define cg_upnp_service_clearsubscriptionsid(service)   cg_string_setvalue(service->subscriptionSid, "")
#define cg_upnp_service_setsubscriptiontimeout(service, value)   (service->subscriptionTimeout = value)
#define cg_upnp_service_getsubscriptiontimeout(service)   (service->subscriptionTimeout)
#define cg_upnp_service_setuserdata(service, value)   (service->userData = value)
#define cg_upnp_service_getuserdata(service)   (service->userData)
#define cg_upnp_service_seteventkey(service, value)   (service->eventKey = value)
#define cg_upnp_service_geteventkey(service)   (service->eventKey)
#define cg_upnp_service_setsubscriptiontimestamp(service, value)   (service->subscriptionTimestamp = value)
#define cg_upnp_service_getsubscriptiontimestamp(service)   (service->subscriptionTimestamp)
#define cg_upnp_service_getsubscriptionexpiration(service)   (service->subscriptionTimestamp + service->subscriptionTimeout - CG_UPNP_SUBSCRIPTION_DELAY)
#define cg_upnp_servicelist_clear(serviceList)   cg_list_clear((CgList *)serviceList, (CG_LIST_DESTRUCTORFUNC)cg_upnp_service_delete)
#define cg_upnp_servicelist_size(serviceList)   cg_list_size((CgList *)serviceList)
#define cg_upnp_servicelist_gets(serviceList)   (CgUpnpService *)cg_list_next((CgList *)serviceList)
#define cg_upnp_servicelist_add(serviceList, service)   cg_list_add((CgList *)serviceList, (CgList *)service)

Typedefs

typedef struct _CgUpnpService CgUpnpService
typedef struct _CgUpnpService CgUpnpServiceList

Functions

CgUpnpService * cg_upnp_service_new ()
void cg_upnp_service_delete (CgUpnpService *service)
void cg_upnp_service_clear (CgUpnpService *service)
BOOL cg_upnp_service_parsedescription (CgUpnpService *service, char *description, int descriptionLen)
BOOL cg_upnp_service_parsedescriptionurl (CgUpnpService *service, CgNetURL *url)
char * cg_upnp_service_getdescription (CgUpnpService *service, CgString *descStr)
char * cg_upnp_servicetype_getidentifier (char *serviceType)
char * cg_upnp_servicetype_geturn (char *serviceType)
char * cg_upnp_servicetype_getservice (char *serviceType)
char * cg_upnp_servicetype_gettype (char *serviceType)
char * cg_upnp_servicetype_getschematype (char *serviceType)
char * cg_upnp_servicetype_getversion (char *serviceType)
CgNetURL * cg_upnp_service_getscpdurl (CgUpnpService *service)
BOOL cg_upnp_service_isscpdurl (CgUpnpService *service, char *url)
CgNetURL * cg_upnp_service_getcontrolurl (CgUpnpService *service)
CgNetURL * cg_upnp_service_geteventsuburl (CgUpnpService *service)
CgUpnpActionList * cg_upnp_service_getactionlist (CgUpnpService *service)
CgUpnpAction * cg_upnp_service_getactions (CgUpnpService *service)
CgUpnpAction * cg_upnp_service_getactionbyname (CgUpnpService *service, char *name)
CgUpnpServiceStateTable * cg_upnp_service_getservicestatetable (CgUpnpService *service)
CgUpnpStateVariable * cg_upnp_service_getstatevariables (CgUpnpService *service)
CgUpnpStateVariable * cg_upnp_service_getstatevariablebyname (CgUpnpService *service, char *name)
BOOL cg_upnp_service_announcefrom (CgUpnpService *service, char *bindAddr)
BOOL cg_upnp_service_byebyefrom (CgUpnpService *service, char *bindAddr)
void cg_upnp_service_setactionlistener (CgUpnpService *service, CG_UPNP_ACTION_LISTNER actionListener)
void cg_upnp_service_setquerylistener (CgUpnpService *service, CG_UPNP_STATEVARIABLE_LISTNER queryListener)
BOOL cg_upnp_service_addsubscriber (CgUpnpService *service, CgUpnpSubscriber *sub)
BOOL cg_upnp_service_removesubscriber (CgUpnpService *service, CgUpnpSubscriber *sub)
CgUpnpSubscriber * cg_upnp_service_getsubscriberbysid (CgUpnpService *service, char *sid)
char * cg_upnp_service_getnotifyservicetypent (CgUpnpService *service, char *buf, int bufSize)
char * cg_upnp_service_getnotifyservicetypeusn (CgUpnpService *service, char *buf, int bufSize)
BOOL cg_upnp_service_notify (CgUpnpService *service, CgUpnpStateVariable *statVar)
BOOL cg_upnp_service_notifyall (CgUpnpService *service, BOOL doBracket)
void cg_upnp_service_createnotifyallthread (CgUpnpService *service, CgSysTime waitTime)
CgUpnpServiceList * cg_upnp_servicelist_new ()
void cg_upnp_servicelist_delete (CgUpnpServiceList *serviceList)
void cg_upnp_service_ssdpmessagereceived (CgUpnpService *service, CgUpnpSSDPPacket *ssdpPkt)

Define Documentation

#define cg_upnp_service_clearsubscriptionsid (   service)    cg_string_setvalue(service->subscriptionSid, "")

Clear (i.e. empty) the service's SID (subscription ID)

Parameters:
serviceThe service in question
#define CG_UPNP_SERVICE_CONTROL_URL   "controlURL"
#define CG_UPNP_SERVICE_ELEM_NAME   "service"
#define CG_UPNP_SERVICE_EVENT_KEY_INVALID   0
#define CG_UPNP_SERVICE_EVENT_SUB_URL   "eventSubURL"
#define cg_upnp_service_getdevice (   service)    ((CgUpnpDevice *)service->parentDevice)

Get the service's parent device

Parameters:
serviceThe service in question
Returns:
CgUpnpDevice*
#define cg_upnp_service_getdevicenode (   service)    cg_xml_node_getparentnode(cg_xml_node_getparentnode(service->serviceNode))

Get the parent device's XML node for the service

Parameters:
serviceThe service in question
#define cg_upnp_service_geteventkey (   service)    (service->eventKey)

Get the service's event key

Parameters:
serviceThe service in question
Returns:
uint
#define cg_upnp_service_getnsubscribers (   service)    cg_upnp_subscriberlist_size(service->subscriberList)

Get the number of subscribers for the service

Parameters:
serviceThe service in question
Returns:
int
#define cg_upnp_service_getrootdevice (   service)    cg_upnp_device_getrootdevice((CgUpnpDevice *)service->parentDevice)

Get the service's top-most root device

Parameters:
serviceThe service in question
Returns:
CgUpnpDevice*
#define cg_upnp_service_getscpdnode (   service)    cg_xml_nodelist_gets(service->scpdNodeList)

Get the service's SCPD node

Parameters:
serviceThe service in question
#define cg_upnp_service_getserviceid (   service)    cg_xml_node_getchildnodevalue(cg_upnp_service_getservicenode(service), CG_UPNP_SERVICE_ID)

Get the service's service ID

Parameters:
serviceThe service in question
Returns:
char*
#define cg_upnp_service_getservicenode (   service)    (service->serviceNode)

Get the root XML node for the service

Parameters:
serviceThe service in question
#define cg_upnp_service_getservicetype (   service)    cg_xml_node_getchildnodevalue(cg_upnp_service_getservicenode(service), CG_UPNP_SERVICE_TYPE)

Get the service's complete type string (ex. "urn:schemas-upnp-org:service:FooService:1")

Parameters:
serviceThe service in question
Returns:
char*
#define cg_upnp_service_getsubscribers (   service)    cg_upnp_subscriberlist_gets(service->subscriberList)

Get the first node in the service's list of event subscribers. Use as the starting point in iteration loops.

Parameters:
serviceThe service in question
#define cg_upnp_service_getsubscriptionexpiration (   service)    (service->subscriptionTimestamp + service->subscriptionTimeout - CG_UPNP_SUBSCRIPTION_DELAY)

Get the service's subscription expiration time

Parameters:
serviceThe service in question
Returns:
CgSysTime
#define cg_upnp_service_getsubscriptionsid (   service)    cg_string_getvalue(service->subscriptionSid)

Get the service's SID (subscription ID)

Parameters:
serviceThe service in question
Returns:
char*
#define cg_upnp_service_getsubscriptiontimeout (   service)    (service->subscriptionTimeout)

Get the service's subscription timeout (expiration) value

Parameters:
serviceThe service in question
Returns:
long
#define cg_upnp_service_getsubscriptiontimestamp (   service)    (service->subscriptionTimestamp)

Get the service's subscription time stamp

Parameters:
serviceThe service in question
Returns:
CgSysTime
#define cg_upnp_service_getuserdata (   service)    (service->userData)

Get the service's arbitrary user data pointer

Parameters:
serviceThe service in question
Returns:
void*
#define cg_upnp_service_hasactionbyname (   service,
  name 
)    ((cg_upnp_service_getactionbyname(service,name) != NULL) ? TRUE : FALSE)

Check, whether a service has an action by the given name

Parameters:
serviceThe service in question
nameThe name of the action
#define cg_upnp_service_hasstatevariablebyname (   service,
  name 
)    ((cg_upnp_service_getstatevariablebyname(service,name) != NULL) ? TRUE : FALSE)

Check, whether the service has the given state variable

Parameters:
serviceThe service in question
nameThe name of the state variable
Returns:
TRUE if found; otherwise FALSE
#define CG_UPNP_SERVICE_ID   "serviceId"
#define cg_upnp_service_isparsed (   service)    (service->parsed)

Get the service's parsing status (i.e. whether the service has been completely constructed). Useful mainly in optimized control point mode.

Parameters:
serviceThe service in question
#define cg_upnp_service_isservicenode (   node)    cg_xml_node_isname(node, CG_UPNP_SERVICE_ELEM_NAME)

Check, whether the given XML node is a service root node

Parameters:
nodeCgXmlNode*
Returns:
TRUE if the node is a service root node; otherwise FALSE
#define cg_upnp_service_issubscribed (   service)    ((0 < cg_string_length(service->subscriptionSid)) ? TRUE : FALSE)

Check, whether the service has any subscribers

Parameters:
serviceThe service in question
Returns:
TRUE if at least one subscriber is found; otherwise FALSE
#define cg_upnp_service_lock (   service)    cg_mutex_lock(service->mutex)

Lock the service's mutex

Parameters:
serviceThe service in question
#define cg_upnp_service_next (   service)    (CgUpnpService *)cg_list_next((CgList *)service)

Get the next service in a service list. Use as an iterator.

Parameters:
serviceCurrent service
#define CG_UPNP_SERVICE_NOTIFY_WAITTIME   1000
#define cg_upnp_service_notifyallstatevariables (   service)    cg_upnp_service_notifyall(service, FALSE);

Send a notification message to all of the service's subscribers

Parameters:
serviceThe service in question
Deprecated:
Use cg_upnp_service_notifyall().
#define CG_UPNP_SERVICE_SCPDURL   "SCPDURL"
#define cg_upnp_service_setcontrolurl (   service,
  value 
)    cg_xml_node_setchildnode(cg_upnp_service_getservicenode(service), CG_UPNP_SERVICE_CONTROL_URL, value)

Set the service's control URL

Parameters:
serviceThe service in question
valueThe control URL string
#define cg_upnp_service_setdevice (   service,
  dev 
)    (service->parentDevice = dev)

Set the service's parent device

Parameters:
serviceThe service in question
devThe parent device
#define cg_upnp_service_seteventkey (   service,
  value 
)    (service->eventKey = value)

Set the service's event key (i.e. the sequential number used in events)

Parameters:
serviceThe service in question
valueThe event key value (uint)
#define cg_upnp_service_seteventsuburl (   service,
  value 
)    cg_xml_node_setchildnode(cg_upnp_service_getservicenode(service), CG_UPNP_SERVICE_EVENT_SUB_URL, value)

Get the service's event subscription URL

Parameters:
serviceThe service in question
valueThe event subscription URL string
#define cg_upnp_service_setscpdurl (   service,
  value 
)    cg_xml_node_setchildnode(cg_upnp_service_getservicenode(service), CG_UPNP_SERVICE_SCPDURL, value)

Set the service's SCPD (service description) URL

Parameters:
serviceThe service in question
valueThe SCPD URL string
#define cg_upnp_service_setserviceid (   service,
  value 
)    cg_xml_node_setchildnode(cg_upnp_service_getservicenode(service), CG_UPNP_SERVICE_ID, value)

Set the service's service ID

Parameters:
serviceThe service in question
valueService ID string
#define cg_upnp_service_setservicenode (   service,
  node 
)    (service->serviceNode = node)

Set the root XML node for the service

Parameters:
serviceThe service in question
nodeThe node to set
#define cg_upnp_service_setservicetype (   service,
  value 
)    cg_xml_node_setchildnode(cg_upnp_service_getservicenode(service), CG_UPNP_SERVICE_TYPE, value)

Set the service's complete type string (ex. "urn:schemas-upnp-org:service:FooService:1")

Parameters:
serviceThe service in question
valueThe type string
#define cg_upnp_service_setsubscriptionsid (   service,
  value 
)    cg_string_setvalue(service->subscriptionSid, value)

Set the service's subscription's SID (subscription ID)

Parameters:
serviceThe service in question
valueThe SID
#define cg_upnp_service_setsubscriptiontimeout (   service,
  value 
)    (service->subscriptionTimeout = value)

Set the service's subscription timeout (expiration) value

Parameters:
serviceThe service in question
valueThe timeout value
#define cg_upnp_service_setsubscriptiontimestamp (   service,
  value 
)    (service->subscriptionTimestamp = value)

Set the service's subscription time stamp

Parameters:
serviceThe service in question
valueThe time stamp
#define cg_upnp_service_setuserdata (   service,
  value 
)    (service->userData = value)

Set the service's arbitrary user data pointer

Parameters:
serviceThe service in question
valueThe user data pointer
#define CG_UPNP_SERVICE_TYPE   "serviceType"
#define cg_upnp_service_unlock (   service)    cg_mutex_unlock(service->mutex)

Unlock the service's mutex

Parameters:
serviceThe service in question
#define cg_upnp_servicelist_add (   serviceList,
  service 
)    cg_list_add((CgList *)serviceList, (CgList *)service)

Add a service to a list of services

Parameters:
serviceListThe list to add the service to
serviceThe service to add to the list
#define cg_upnp_servicelist_clear (   serviceList)    cg_list_clear((CgList *)serviceList, (CG_LIST_DESTRUCTORFUNC)cg_upnp_service_delete)

Clear the contents of a list of services

Parameters:
serviceListThe list of services to clear
#define CG_UPNP_SERVICELIST_ELEM_NAME   "serviceList"
#define cg_upnp_servicelist_gets (   serviceList)    (CgUpnpService *)cg_list_next((CgList *)serviceList)

Get the first service in a list of services. Use as the starting point in iteration loops.

Parameters:
serviceListThe service list
#define cg_upnp_servicelist_size (   serviceList)    cg_list_size((CgList *)serviceList)

Get the number of services in a list of services

Parameters:
serviceListThe list of services
Returns:
int

Typedef Documentation

typedef struct _CgUpnpService CgUpnpService

Function Documentation

BOOL cg_upnp_service_addsubscriber ( CgUpnpService *  service,
CgUpnpSubscriber *  sub 
)

Add a subscriber to the service

Parameters:
serviceThe service in question
subThe subscriber
BOOL cg_upnp_service_announcefrom ( CgUpnpService *  service,
char *  bindAddr 
)

Send a service announcement (advertisement) from the given address

Parameters:
serviceThe service to advertise
bindAddrThe address to attach to the announcement
BOOL cg_upnp_service_byebyefrom ( CgUpnpService *  service,
char *  bindAddr 
)

Send a byebye announcement (i.e. a cancelling advertisement) from the given address

Parameters:
serviceThe service to announce from
bindAddrThe address to attach to the announcement
void cg_upnp_service_clear ( CgUpnpService *  service)

Clear the contents of a UPnP service

Parameters:
serviceThe service to clear
void cg_upnp_service_createnotifyallthread ( CgUpnpService *  service,
CgSysTime  waitTime 
)

Create a new thread to send a notification message to all of the service's subscribers

Parameters:
serviceThe service in question
waitTimeThe wait time to send
void cg_upnp_service_delete ( CgUpnpService *  service)

Destroy a UPnP service

Parameters:
serviceThe service to destroy
CgUpnpAction* cg_upnp_service_getactionbyname ( CgUpnpService *  service,
char *  name 
)

Get an action from the service by the action's name

Parameters:
serviceThe service in question
nameThe name of the action to look for
Returns:
CgUpnpAction* or NULL
CgUpnpActionList* cg_upnp_service_getactionlist ( CgUpnpService *  service)

Get the service's list of actions (head of list)

Parameters:
serviceThe service in question
CgUpnpAction* cg_upnp_service_getactions ( CgUpnpService *  service)

Get the first action in the service's list of actions. Use as the starting point in iteration loops.

Parameters:
serviceThe service in question
CgNetURL* cg_upnp_service_getcontrolurl ( CgUpnpService *  service)

Get the service's control URL

Parameters:
serviceThe service in question
Returns:
CgNetURL Pointer to URL/URI structure

Get the service's control URL

Parameters:
serviceThe service in question
Returns:
char*
char* cg_upnp_service_getdescription ( CgUpnpService *  service,
CgString *  descStr 
)

Get the service's description XML nodes as a string

Parameters:
serviceThe service in question
descStrThe description string
CgNetURL* cg_upnp_service_geteventsuburl ( CgUpnpService *  service)

Get the service's event subscription URL

Parameters:
serviceThe service in question
Returns:
CgNetURL Pointer to URL/URI structure

Get the service's event subscription URL

Parameters:
serviceThe service in question
Returns:
char*
char* cg_upnp_service_getnotifyservicetypent ( CgUpnpService *  service,
char *  buf,
int  bufSize 
)
char* cg_upnp_service_getnotifyservicetypeusn ( CgUpnpService *  service,
char *  buf,
int  bufSize 
)
CgNetURL* cg_upnp_service_getscpdurl ( CgUpnpService *  service)

Get the service's SCPD (service description) URL

Parameters:
serviceThe service in question
Returns:
CgNetURL Pointer to URL/URI structure
CgUpnpServiceStateTable* cg_upnp_service_getservicestatetable ( CgUpnpService *  service)

Get the service's state table

Parameters:
serviceThe service in question
CgUpnpStateVariable* cg_upnp_service_getstatevariablebyname ( CgUpnpService *  service,
char *  name 
)

Get a state variable from the service's state table by the variable's name

Parameters:
serviceThe service in question
namethe name of the variable
Returns:
CgUpnpStateVariable* or NULL
CgUpnpStateVariable* cg_upnp_service_getstatevariables ( CgUpnpService *  service)

Get the first state variable in the service's state table. Use as the starting point in iteration loops.

Parameters:
serviceThe service in question
CgUpnpSubscriber* cg_upnp_service_getsubscriberbysid ( CgUpnpService *  service,
char *  sid 
)

Find a subscriber from the service's list of subscribers by its SID (Subscription ID)

Parameters:
serviceThe service in question
sidThe SID
BOOL cg_upnp_service_isscpdurl ( CgUpnpService *  service,
char *  url 
)

Compare the service's SCPD URL and the given location

Parameters:
serviceThe service in question
urlThe URL (location) to compare
Returns:
TRUE if location is found from URL; otherwise FALSE
CgUpnpService* cg_upnp_service_new ( )

Create a new UPnP service

BOOL cg_upnp_service_notify ( CgUpnpService *  service,
CgUpnpStateVariable *  statVar 
)

Send a notification of a service's changed state variable

Parameters:
serviceThe service in question
statVarThe changed state variable
BOOL cg_upnp_service_notifyall ( CgUpnpService *  service,
BOOL  doBracket 
)

Send a notification message to all of the service's subscribers

Parameters:
serviceThe service in question
BOOL cg_upnp_service_parsedescription ( CgUpnpService *  service,
char *  description,
int  descriptionLen 
)

Create the service's contents from the given XML document

Parameters:
serviceThe service to create
descriptionThe XML document to parse
descriptionLenThe length of the XML document
BOOL cg_upnp_service_parsedescriptionurl ( CgUpnpService *  service,
CgNetURL *  url 
)

Create the service's contents from the given URL. Gets the XML document from the URL and passes it again to cg_upnp_service_parsedescription

Parameters:
serviceThe service to create
urlThe URL of the document to parse
BOOL cg_upnp_service_removesubscriber ( CgUpnpService *  service,
CgUpnpSubscriber *  sub 
)

Remove a subscriber from the service

Parameters:
serviceThe service in question
subThe subscriber to remove
void cg_upnp_service_setactionlistener ( CgUpnpService *  service,
CG_UPNP_ACTION_LISTNER  actionListener 
)

Set an action listener to the service

Parameters:
serviceThe service in question
actionListenerA callback function of type CG_UPNP_ACTION_LISTNER
void cg_upnp_service_setquerylistener ( CgUpnpService *  service,
CG_UPNP_STATEVARIABLE_LISTNER  queryListener 
)

Set a query listener to the service

Parameters:
serviceThe service in question
queryListenerA callback function of type CG_UPNP_STATEVARIABLE_LISTNER
void cg_upnp_service_ssdpmessagereceived ( CgUpnpService *  service,
CgUpnpSSDPPacket *  ssdpPkt 
)

The service's handler function that deals with received SSDP messages.

Parameters:
serviceThe service in question
ssdpPktThe received SSDP packet
void cg_upnp_servicelist_delete ( CgUpnpServiceList *  serviceList)

Destroy a list of services

Parameters:
serviceListThe list of services to destroy
CgUpnpServiceList* cg_upnp_servicelist_new ( )

Create a new list of services

char* cg_upnp_servicetype_getidentifier ( char *  serviceType)

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

Parameters:
serviceTypeA service type string (usually the result from cg_upnp_service_getservicetype)
Returns:
A newly-created char* if successful; otherwise NULL
char* cg_upnp_servicetype_getschematype ( char *  serviceType)

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

Parameters:
serviceTypeA service type string (usually the result from cg_upnp_service_getservicetype)
Returns:
A newly-created char* if successful; otherwise NULL
char* cg_upnp_servicetype_getservice ( char *  serviceType)

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

Parameters:
serviceTypeA service type string (usually the result from cg_upnp_service_getservicetype)
Returns:
A newly-created char* if successful; otherwise NULL
char* cg_upnp_servicetype_gettype ( char *  serviceType)

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

Parameters:
serviceTypeA service type string (usually the result from cg_upnp_service_getservicetype)
Returns:
A newly-created char* if successful; otherwise NULL
char* cg_upnp_servicetype_geturn ( char *  serviceType)

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

Parameters:
serviceTypeA service type string (usually the result from cg_upnp_service_getservicetype)
Returns:
A newly-created char* if successful; otherwise NULL
char* cg_upnp_servicetype_getversion ( char *  serviceType)

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

Parameters:
serviceTypeA service type string (usually the result from cg_upnp_service_getservicetype)
Returns:
A newly-created char* if successful; otherwise NULL