CyberLink for C

ccontrolpoint.h File Reference

#include <cybergarage/util/cstring.h>
#include <cybergarage/util/cmutex.h>
#include <cybergarage/util/ccond.h>
#include <cybergarage/xml/cxml.h>
#include <cybergarage/net/cinterface.h>
#include <cybergarage/upnp/cdevice.h>
#include <cybergarage/upnp/cargument.h>
#include <cybergarage/upnp/cupnp_status.h>
#include <cybergarage/upnp/ssdp/cssdp_server.h>
#include <cybergarage/upnp/event/cevent.h>
#include <cybergarage/upnp/event/cnotify.h>

Data Structures

struct  _CgUpnpControlPoint

Defines

#define CG_UPNP_CONTROLPOINT_SSDP_DEFAULT_SEARCH_MX   3
#define CG_UPNP_CONTROLPOINT_SSDP_MIN_DELAY   20
#define CG_UPNP_CONTROLPOINT_SSDP_RESPONSE_DEFAULT_PORT   39400
#define CG_UPNP_CONTROLPOINT_SSDP_RESPONSE_PORT_MAX_TRIES_INDEX   80
#define CG_UPNP_CONTROLPOINT_HTTP_EVENT_DEFAULT_PORT   39500
#define CG_UPNP_CONTROLPOINT_HTTP_EVENTSUB_URI   "/eventSub"
#define cg_upnp_controlpoint_getssdpserverlist(ctrlPoint)   (ctrlPoint->ssdpServerList)
#define cg_upnp_controlpoint_getssdpresponseserverlist(ctrlPoint)   (ctrlPoint->ssdpResServerList)
#define cg_upnp_controlpoint_gethttpserverlist(ctrlPoint)   (ctrlPoint->httpServerList)
#define cg_upnp_controlpoint_setssdplistener(ctrlPoint, func)   (ctrlPoint->ssdpListener = func)
#define cg_upnp_controlpoint_getssdplistener(ctrlPoint)   (ctrlPoint->ssdpListener)
#define cg_upnp_controlpoint_setssdpresponselistener(ctrlPoint, func)   (ctrlPoint->ssdpResListener = func)
#define cg_upnp_controlpoint_getssdpresponselistener(ctrlPoint)   (ctrlPoint->ssdpResListener)
#define cg_upnp_controlpoint_setdevicelistener(ctrlPoint, func)   (ctrlPoint->deviceListener = func)
#define cg_upnp_controlpoint_getdevicelistener(ctrlPoint)   (ctrlPoint->deviceListener)
#define cg_upnp_controlpoint_addeventlistener(ctrlPoint, listener)   (cg_upnp_eventlistenerlist_add(ctrlPoint->eventListeners, listener))
#define cg_upnp_controlpoint_removeeventlistener(ctrlPoint, listener)   (cg_upnp_eventlistenerlist_remove(ctrlPoint->eventListeners, listener))
#define cg_upnp_controlpoint_seteventlistener(ctrlPoint, evlistener)
#define cg_upnp_controlpoint_geteventlistener(ctrlPoint)   (ctrlPoint->eventListeners->next->listener)
#define cg_upnp_controlpoint_geteventlisteners(ctrlPoint)   (ctrlPoint->eventListeners)
#define cg_upnp_controlpoint_setssdpresponseport(ctrlPoint, port)   (ctrlPoint->ssdpResPort = port)
#define cg_upnp_controlpoint_getssdpresponseport(ctrlPoint)   (ctrlPoint->ssdpResPort)
#define cg_upnp_controlpoint_seteventport(ctrlPoint, port)   (ctrlPoint->httpEventPort = port)
#define cg_upnp_controlpoint_geteventport(ctrlPoint)   (ctrlPoint->httpEventPort)
#define cg_upnp_controlpoint_seteventsuburi(ctrlPoint, uri)   cg_string_setvalue(ctrlPoint->httpEventURI, uri)
#define cg_upnp_controlpoint_geteventsuburi(ctrlPoint)   cg_string_getvalue(ctrlPoint->httpEventURI)
#define cg_upnp_controlpoint_setssdpsearchmx(ctrlPoint, value)   (ctrlPoint->ssdpSearchMx = value)
#define cg_upnp_controlpoint_getssdpsearchmx(ctrlPoint)   (ctrlPoint->ssdpSearchMx)
#define cg_upnp_controlpoint_sethttplistener(ctrlPoint, func)   (ctrlPoint->httpListener = func)
#define cg_upnp_controlpoint_gethttplistener(ctrlPoint)   (ctrlPoint->httpListener)
#define cg_upnp_controlpoint_setuserdata(ctrlPoint, value)   (ctrlPoint->userData = value)
#define cg_upnp_controlpoint_getuserdata(ctrlPoint)   (ctrlPoint->userData)
#define cg_upnp_controlpoint_getdevices(ctrlPoint)   cg_upnp_devicelist_gets(ctrlPoint->deviceList)
#define cg_upnp_controlpoint_getndevices(ctrlPoint)   cg_upnp_devicelist_size(ctrlPoint->deviceList)
#define cg_upnp_controlpoint_getdevice(ctrlPoint, index)   cg_upnp_devicelist_get(ctrlPoint->deviceList, index)
#define cg_upnp_controlpoint_adddevice(ctrlPoint, dev)   cg_upnp_devicelist_add(ctrlPoint->deviceList, dev)

Typedefs

typedef enum _CgUpnpDeviceStatus CgUpnpDeviceStatus
typedef struct _CgUpnpControlPoint CgUpnpControlPoint
typedef void(* CG_UPNP_DEVICE_LISTENER )(CgUpnpControlPoint *ctrlPoint, char *udn, CgUpnpDeviceStatus status)

Enumerations

enum  _CgUpnpDeviceStatus { CgUpnpDeviceStatusAdded = 0, CgUpnpDeviceStatusUpdated, CgUpnpDeviceStatusInvalid, CgUpnpDeviceStatusRemoved }

Functions

CgUpnpControlPoint * cg_upnp_controlpoint_new ()
void cg_upnp_controlpoint_delete (CgUpnpControlPoint *ctrlPoint)
BOOL cg_upnp_controlpoint_start (CgUpnpControlPoint *ctrlPoint)
BOOL cg_upnp_controlpoint_stop (CgUpnpControlPoint *ctrlPoint)
BOOL cg_upnp_controlpoint_isrunning (CgUpnpControlPoint *ctrlPoint)
BOOL cg_upnp_controlpoint_lock (CgUpnpControlPoint *ctrlPoint)
BOOL cg_upnp_controlpoint_unlock (CgUpnpControlPoint *ctrlPoint)
CgUpnpDevice * cg_upnp_controlpoint_getdevicebyexacttype (CgUpnpControlPoint *ctrlPoint, char *exacttype)
CgUpnpDevice * cg_upnp_controlpoint_getdevicebytype (CgUpnpControlPoint *ctrlPoint, char *type)
CgUpnpDevice * cg_upnp_controlpoint_getdevicebyudn (CgUpnpControlPoint *ctrlPoint, char *udn)
BOOL cg_upnp_controlpoint_search (CgUpnpControlPoint *ctrlPoint, char *target)
void cg_upnp_controlpoint_httprequestreceived (CgHttpRequest *httpReq)
void cg_upnp_controlpoint_updatestatetablefromproperty (CgUpnpService *service, CgUpnpProperty *prop)
BOOL cg_upnp_controlpoint_parsescservicescpd (CgUpnpService *service)
BOOL cg_upnp_controlpoint_parseservicesfordevice (CgUpnpDevice *dev, CgUpnpSSDPPacket *ssdpPkt)
void cg_upnp_controlpoint_adddevicebyssdppacket (CgUpnpControlPoint *ctrlPoint, CgUpnpSSDPPacket *ssdpPkt)
void cg_upnp_controlpoint_removedevicebyssdppacket (CgUpnpControlPoint *ctrlPoint, CgUpnpSSDPPacket *ssdpPkt)
BOOL cg_upnp_controlpoint_subscribe (CgUpnpControlPoint *ctrlPoint, CgUpnpService *service, long timeout)
BOOL cg_upnp_controlpoint_resubscribe (CgUpnpControlPoint *ctrlPoint, CgUpnpService *service, long timeout)
BOOL cg_upnp_controlpoint_unsubscribe (CgUpnpControlPoint *ctrlPoint, CgUpnpService *service)
BOOL cg_upnp_controlpoint_subscribeall (CgUpnpControlPoint *ctrlPoint, CgUpnpDevice *dev, long timeout)
BOOL cg_upnp_controlpoint_resubscribeall (CgUpnpControlPoint *ctrlPoint, CgUpnpDevice *dev, long timeout)
BOOL cg_upnp_controlpoint_unsubscribeall (CgUpnpControlPoint *ctrlPoint, CgUpnpDevice *dev)
void cg_upnp_controlpoint_expirationhandler (CgThread *thread)
BOOL cg_upnp_controlpoint_ipchanged (CgUpnpControlPoint *ctrlpoint)
char * cg_upnp_controlpoint_geteventsubcallbackurl (CgUpnpControlPoint *ctrlPoint, char *ifaddr, char *buf, int bufLen)

Define Documentation

#define cg_upnp_controlpoint_adddevice (   ctrlPoint,
  dev 
)    cg_upnp_devicelist_add(ctrlPoint->deviceList, dev)

Add a device to the control point's list of devices. Do not call this from user applications.

Parameters:
ctrlPointThe control point in use
devThe device to add
#define cg_upnp_controlpoint_addeventlistener (   ctrlPoint,
  listener 
)    (cg_upnp_eventlistenerlist_add(ctrlPoint->eventListeners, listener))

Set an event listener for the control point. Use this function to get event notifications to user-space applications.

Parameters:
ctrlPointThe control point in question
listenerA callback function that is of type CG_UPNP_EVENT_LISTENER
#define cg_upnp_controlpoint_getdevice (   ctrlPoint,
  index 
)    cg_upnp_devicelist_get(ctrlPoint->deviceList, index)

Get the head of the control point's list of devices (use for iteration)

Parameters:
ctrlPointThe control point in use
indexThe index of the device to get
Returns:
The specified device
#define cg_upnp_controlpoint_getdevicelistener (   ctrlPoint)    (ctrlPoint->deviceListener)

Get the device listener for the control point.

Parameters:
ctrlPointThe control point in question
Returns:
A callback function that is of type CG_UPNP_DEVICE_LISTENER or NULL
#define cg_upnp_controlpoint_getdevices (   ctrlPoint)    cg_upnp_devicelist_gets(ctrlPoint->deviceList)

Get the head of the control point's list of devices (use for iteration)

Parameters:
ctrlPointThe control point in use
Returns:
The head of the device list
#define cg_upnp_controlpoint_geteventlistener (   ctrlPoint)    (ctrlPoint->eventListeners->next->listener)

Get the single event listener for the control point.

Parameters:
ctrlPointThe control point in question
Returns:
The callback function, that is of type CG_UPNP_EVENT_LISTENER, or NULL if there is no listener
#define cg_upnp_controlpoint_geteventlisteners (   ctrlPoint)    (ctrlPoint->eventListeners)

Get the list of event listeners for the control point.

Parameters:
ctrlPointThe control point in question
Returns:
List of CG_UPNP_EVENT_LISTENER functions
#define cg_upnp_controlpoint_geteventport (   ctrlPoint)    (ctrlPoint->httpEventPort)

Get the IP port number for the control point's event reception

Parameters:
ctrlPointThe control point in question
#define cg_upnp_controlpoint_geteventsuburi (   ctrlPoint)    cg_string_getvalue(ctrlPoint->httpEventURI)

Get the URI used for the control point's event subscription notifications

Parameters:
ctrlPointThe control point in question
#define cg_upnp_controlpoint_gethttplistener (   ctrlPoint)    (ctrlPoint->httpListener)

Get the HTTP listener function for the control point.

Parameters:
ctrlPointThe control point in question
Returns:
The listener function, that is of type CG_HTTP_LISTENER
#define cg_upnp_controlpoint_gethttpserverlist (   ctrlPoint)    (ctrlPoint->httpServerList)

Get the list of HTTP servers associated to the control point

Parameters:
ctrlPointThe control point in question
#define cg_upnp_controlpoint_getndevices (   ctrlPoint)    cg_upnp_devicelist_size(ctrlPoint->deviceList)

Get the number of devices known by the control point

Parameters:
ctrlPointThe control point in use
Returns:
The number of devices in the control point's device list
#define cg_upnp_controlpoint_getssdplistener (   ctrlPoint)    (ctrlPoint->ssdpListener)

Get the SSDP message listener for the control point.

Parameters:
ctrlPointThe control point in question
Returns:
A callback function that is of type CG_UPNP_SSDP_LISTNER or NULL
#define cg_upnp_controlpoint_getssdpresponselistener (   ctrlPoint)    (ctrlPoint->ssdpResListener)

Get the SSDP response listener for the control point.

Parameters:
ctrlPointThe control point in question
Returns:
A callback function that is of type CG_UPNP_SSDP_RESPONSE_LISTNER or NULL
#define cg_upnp_controlpoint_getssdpresponseport (   ctrlPoint)    (ctrlPoint->ssdpResPort)

Get the IP port number used for the control point's SSDP responses

Parameters:
ctrlPointThe control point in question
#define cg_upnp_controlpoint_getssdpresponseserverlist (   ctrlPoint)    (ctrlPoint->ssdpResServerList)

Get the list of SSDP response servers associated to the control point

Parameters:
ctrlPointThe control point in question
#define cg_upnp_controlpoint_getssdpsearchmx (   ctrlPoint)    (ctrlPoint->ssdpSearchMx)

Get the MX-parameter used for SSDP searches

Parameters:
ctrlPointThe control point in question
Returns:
value MX; Time to wait
#define cg_upnp_controlpoint_getssdpserverlist (   ctrlPoint)    (ctrlPoint->ssdpServerList)

Get the list of SSDP servers associated to the control point

Parameters:
ctrlPointThe control point in question
#define cg_upnp_controlpoint_getuserdata (   ctrlPoint)    (ctrlPoint->userData)

Get the user data pointer (arbitrary user data) from the control point.

Parameters:
devThe control point in question
Returns:
Pointer to user data or NULL
#define CG_UPNP_CONTROLPOINT_HTTP_EVENT_DEFAULT_PORT   39500

Definition for HTTP event default port

#define CG_UPNP_CONTROLPOINT_HTTP_EVENTSUB_URI   "/eventSub"

Definition for default controlpoint event callback "location"

#define cg_upnp_controlpoint_removeeventlistener (   ctrlPoint,
  listener 
)    (cg_upnp_eventlistenerlist_remove(ctrlPoint->eventListeners, listener))

Remove an event listener from the control point.

Parameters:
ctrlPointThe control point in question
listenerThe callback function to remove, that is of type CG_UPNP_EVENT_LISTENER
#define cg_upnp_controlpoint_setdevicelistener (   ctrlPoint,
  func 
)    (ctrlPoint->deviceListener = func)

Set device listener for the control point.

Parameters:
ctrlPointThe control point
funcA callback function that is type CG_UPNP_DEVICE_LISTENER or NULL
#define cg_upnp_controlpoint_seteventlistener (   ctrlPoint,
  evlistener 
)
Value:
do {\
                if (evlistener == NULL) \
                        cg_upnp_eventlistenerlist_remove(ctrlPoint->eventListeners, ctrlPoint->eventListeners->next->listener); \
                else \
                        cg_upnp_eventlistenerlist_add(ctrlPoint->eventListeners, evlistener); \
        } while(0)

Set a single event listener for the control point. Use this function to get event notifications to user-space applications if you need only one listener.

Parameters:
ctrlPointThe control point in question
evlistenerThe callback function to set, that is of type CG_UPNP_EVENT_LISTENER, or NULL
#define cg_upnp_controlpoint_seteventport (   ctrlPoint,
  port 
)    (ctrlPoint->httpEventPort = port)

Set the IP port number for the control point's event reception

Parameters:
ctrlPointThe control point in question
portThe IP port number
#define cg_upnp_controlpoint_seteventsuburi (   ctrlPoint,
  uri 
)    cg_string_setvalue(ctrlPoint->httpEventURI, uri)

Set the URI used for the control point's event subscription notifications

Parameters:
ctrlPointThe control point in question
uriThe URI to set
#define cg_upnp_controlpoint_sethttplistener (   ctrlPoint,
  func 
)    (ctrlPoint->httpListener = func)

Set an HTTP listener function to the control point. Use this function to get HTTP requests to user-space applications.

Parameters:
ctrlPointThe control point in question
funcThe listener function, that is of type CG_HTTP_LISTENER
#define cg_upnp_controlpoint_setssdplistener (   ctrlPoint,
  func 
)    (ctrlPoint->ssdpListener = func)

Set an SSDP message listener for the control point. Use this function to get SSDP messages to user-space applications.

Parameters:
ctrlPointThe control point in question
funcA callback function that is of type CG_UPNP_SSDP_LISTNER
#define cg_upnp_controlpoint_setssdpresponselistener (   ctrlPoint,
  func 
)    (ctrlPoint->ssdpResListener = func)

Set an SSDP response listener for the control point. Use this function to get SSDP responses to user-space applications.

Parameters:
ctrlPointThe control point in question
funcA callback function that is of type CG_UPNP_SSDP_RESPONSE_LISTNER
#define cg_upnp_controlpoint_setssdpresponseport (   ctrlPoint,
  port 
)    (ctrlPoint->ssdpResPort = port)

Set the IP port number used for the control point's SSDP responses

Parameters:
ctrlPointThe control point in question
portThe IP port number
#define cg_upnp_controlpoint_setssdpsearchmx (   ctrlPoint,
  value 
)    (ctrlPoint->ssdpSearchMx = value)

Set the MX-parameter used for SSDP searches i.e. Set the time to wait (in seconds) for device responses to an M-SEARCH

Parameters:
ctrlPointThe control point in question
valueMX; Time to wait
#define cg_upnp_controlpoint_setuserdata (   ctrlPoint,
  value 
)    (ctrlPoint->userData = value)

Set the user data pointer (arbitrary user data) to the control point.

Parameters:
ctrlPointThe control point in question
valueArbitrary user data
#define CG_UPNP_CONTROLPOINT_SSDP_DEFAULT_SEARCH_MX   3

Definition for SSDP default search MX

#define CG_UPNP_CONTROLPOINT_SSDP_MIN_DELAY   20

Definition for control point SSDP minimum delay

#define CG_UPNP_CONTROLPOINT_SSDP_RESPONSE_DEFAULT_PORT   39400

Definition for control point default response port

#define CG_UPNP_CONTROLPOINT_SSDP_RESPONSE_PORT_MAX_TRIES_INDEX   80

Definition for numeric constant to specify the max tries to open a SSDP Response Port (rosfran.borges)


Typedef Documentation

typedef void(* CG_UPNP_DEVICE_LISTENER)(CgUpnpControlPoint *ctrlPoint, char *udn, CgUpnpDeviceStatus status)

Prototype for control point's device listener callback.

Parameters:
udnThe UDN of the device, that the status update concerns
statusThe new status

Device listener status parameters.

CgUpnpDeviceStatusAdded means a device has been added to local cache. CgUpnpDeviceStatusUpdated means a device description has been updated because its IP address or description has changed. The user should renew any active subscriptions if this has been received.

CgUpnpDeviceStatusInvalid is basically the same as CgUpnpDeviceStatusRemoved, but CgUpnpDeviceStatusRemoved is sent only when a device leaves the network in a proper way (i.e. with UPnP ByeBye messages). The user should immediately cease using the device, because it will be removed in both cases.


Enumeration Type Documentation

Device listener status parameters.

CgUpnpDeviceStatusAdded means a device has been added to local cache. CgUpnpDeviceStatusUpdated means a device description has been updated because its IP address or description has changed. The user should renew any active subscriptions if this has been received.

CgUpnpDeviceStatusInvalid is basically the same as CgUpnpDeviceStatusRemoved, but CgUpnpDeviceStatusRemoved is sent only when a device leaves the network in a proper way (i.e. with UPnP ByeBye messages). The user should immediately cease using the device, because it will be removed in both cases.

Enumerator:
CgUpnpDeviceStatusAdded 
CgUpnpDeviceStatusUpdated 
CgUpnpDeviceStatusInvalid 
CgUpnpDeviceStatusRemoved 

Function Documentation

void cg_upnp_controlpoint_adddevicebyssdppacket ( CgUpnpControlPoint *  ctrlPoint,
CgUpnpSSDPPacket *  ssdpPkt 
)

Add a device on the basis of an SSDP packet. Do not call this from user applications.

Parameters:
ctrlPointThe control point, whose device list to handle
ssdpPktThe received SSDP packet
void cg_upnp_controlpoint_delete ( CgUpnpControlPoint *  ctrlPoint)

Destroy the given control point

Parameters:
ctrlPointThe control point struct to destroy
void cg_upnp_controlpoint_expirationhandler ( CgThread *  thread)

Worker thread for handling expirations.

Parameters:
threadthe thread in question
CgUpnpDevice* cg_upnp_controlpoint_getdevicebyexacttype ( CgUpnpControlPoint *  ctrlPoint,
char *  exacttype 
)

Find a device from the control point 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_controlpoint_getdevicebytype

Parameters:
ctrlPointControlpoint in question
exacttypeType of the device

Find a device from the control point 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_controlpoint_getdevicebytype

Parameters:
ctrlPointControlpoint in question
exacttypeType of the device
CgUpnpDevice* cg_upnp_controlpoint_getdevicebytype ( CgUpnpControlPoint *  ctrlPoint,
char *  type 
)

Find a device from the controlpoint 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:
ctrlPointControlpoint in question
typeType of the device

Find a device from the controlpoint 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:
ctrlPointControlpoint in question
typeType of the device
CgUpnpDevice* cg_upnp_controlpoint_getdevicebyudn ( CgUpnpControlPoint *  ctrlPoint,
char *  udn 
)

Find a device from the controlpoint by the UDN of the device.

Parameters:
ctrlPointControlpoint in question
typeType of the device

Find a device from the controlpoint by the UDN of the device.

Parameters:
ctrlPointControlpoint in question
udnType of the device
char* cg_upnp_controlpoint_geteventsubcallbackurl ( CgUpnpControlPoint *  ctrlPoint,
char *  ifaddr,
char *  buf,
int  bufLen 
)

Get the event subscription callback URI

Parameters:
ctrlPointThe control point in question

Get the event subscription callback URI

Parameters:
ctrlPointThe control point in question
ifaddrInterface address
bufBuffer used to store callback url
bufLenBuffer length
Returns:
Event callback url (pointer to buf)
void cg_upnp_controlpoint_httprequestreceived ( CgHttpRequest *  httpReq)

The function that calls all HTTP listener callback functions. Do not call this from applications.

Parameters:
httpReqThe received HTTP request
BOOL cg_upnp_controlpoint_ipchanged ( CgUpnpControlPoint *  ctrlpoint)

Notify the control point that any IP of the host has been changed.

Parameters:
ctrlpointThe control point in use
Returns:
success of changing used interfaces
BOOL cg_upnp_controlpoint_isrunning ( CgUpnpControlPoint *  ctrlPoint)

Check if the control point is activated.

Parameters:
ctrlPointThe control point to stop
Returns:
TRUE if running; otherwise FALSE
BOOL cg_upnp_controlpoint_lock ( CgUpnpControlPoint *  ctrlPoint)

Lock the control point's mutex. The control point should be ALWAYS locked, when a CgUpnpDevice*, CgUpnpService*, CgUpnpAction* or other pointer has been taken into use from the stack. This effectively prevents devices/services from being updated/ removed or added while the control point is locked. You should release the lock as soon as possible with cg_upnp_controlpoint_unlock

Note:
Do NOT save any CgUpnp* pointers to user-space variables. Use them only as local variables (inside one function) after gaining a mutex lock. Release the lock as soon as you are done accessing the pointer, and then discard the pointer immediately.
Parameters:
ctrlPointThe control point in question
CgUpnpControlPoint* cg_upnp_controlpoint_new ( )

Create a new control point. Does not start any threads.

Returns:
A newly-created CgUpnpControlPoint
BOOL cg_upnp_controlpoint_parsescservicescpd ( CgUpnpService *  service)

Parse the service description from the service's SCPD URL. Do not call this from user applications.

Parameters:
serviceThe service in question
Returns:
TRUE if successful; otherwise FALSE
BOOL cg_upnp_controlpoint_parseservicesfordevice ( CgUpnpDevice *  dev,
CgUpnpSSDPPacket *  ssdpPkt 
)

Parse the device's services using the received SSDP packet. Do not call this from user applications.

Parameters:
devThe device in question
ssdpPktAn SSDP packet
void cg_upnp_controlpoint_removedevicebyssdppacket ( CgUpnpControlPoint *  ctrlPoint,
CgUpnpSSDPPacket *  ssdpPkt 
)

Remove a device on the basis of an SSDP packet. Do not call this from user applications.

Parameters:
ctrlPointThe control point, whose device list to handle
ssdpPktThe received SSDP packet
BOOL cg_upnp_controlpoint_resubscribe ( CgUpnpControlPoint *  ctrlPoint,
CgUpnpService *  service,
long  timeout 
)

Re-subscribe to a service's events (i.e. renew subscription)

Parameters:
ctrlPointThe control point in use
serviceThe service to subscribe to
timeoutTimeout for subscription expiration/renewal
Returns:
TRUE if successful; otherwise FALSE
BOOL cg_upnp_controlpoint_resubscribeall ( CgUpnpControlPoint *  ctrlPoint,
CgUpnpDevice *  dev,
long  timeout 
)

Re-subscribe to all of the device's services' events (i.e. renew subscription)

Parameters:
ctrlPointThe control point in use
devThe device to subscribe to
timeoutTimeout for subscription expiration/renewal
Returns:
TRUE if successful; otherwise FALSE
BOOL cg_upnp_controlpoint_search ( CgUpnpControlPoint *  ctrlPoint,
char *  target 
)

Do an M-SEARCH to look for devices in the network.

Parameters:
ctrlPointThe control point in question
targetThe Search Target parameter (ex. "ssdp:all")
BOOL cg_upnp_controlpoint_start ( CgUpnpControlPoint *  ctrlPoint)

Activate the control point. Starts listening for SSDP messages etc. You must call this function before you can actually use a control point.

Parameters:
ctrlPointThe control point to start
Returns:
TRUE if successful; otherwise FALSE
BOOL cg_upnp_controlpoint_stop ( CgUpnpControlPoint *  ctrlPoint)

Stop the control point. Stops sending/receiveing/responding to any messages.

Parameters:
ctrlPointThe control point to stop
Returns:
TRUE if successful; otherwise FALSE
BOOL cg_upnp_controlpoint_subscribe ( CgUpnpControlPoint *  ctrlPoint,
CgUpnpService *  service,
long  timeout 
)

Subscribe to a service's events

Parameters:
ctrlPointThe control point in use
serviceThe service to subscribe to
timeoutTimeout for subscription expiration/renewal
Returns:
TRUE if successful; otherwise FALSE
BOOL cg_upnp_controlpoint_subscribeall ( CgUpnpControlPoint *  ctrlPoint,
CgUpnpDevice *  dev,
long  timeout 
)

Subscribe to all of the device's services' events

Parameters:
ctrlPointThe control point in use
devThe device to subscribe to
timeoutTimeout for subscription expiration/renewal
Returns:
TRUE if successful; otherwise FALSE
BOOL cg_upnp_controlpoint_unlock ( CgUpnpControlPoint *  ctrlPoint)

Release a previously locked control point mutex. See cg_upnp_controlpoint_lock for a more detailed description on the control point locking mechanism.

Parameters:
ctrlPointThe control point in question
BOOL cg_upnp_controlpoint_unsubscribe ( CgUpnpControlPoint *  ctrlPoint,
CgUpnpService *  service 
)

Unsubscribe to a service's events (i.e. cancel subscription)

Parameters:
ctrlPointThe control point in use
serviceThe service to unsubscribe to
Returns:
TRUE if successful; otherwise FALSE
BOOL cg_upnp_controlpoint_unsubscribeall ( CgUpnpControlPoint *  ctrlPoint,
CgUpnpDevice *  dev 
)

Unsubscribe to all of the device's services' events (i.e. cancel subscription)

Parameters:
ctrlPointThe control point in use
devThe device to unsubscribe to
Returns:
TRUE if successful; otherwise FALSE
void cg_upnp_controlpoint_updatestatetablefromproperty ( CgUpnpService *  service,
CgUpnpProperty *  prop 
)

When an event is received, update also the associated service's state table to include the evented state variable.

Parameters:
serviceThe service, whose state table to update
propThe evented property from which to update