ccontrolpoint.c File Reference

#include <cybergarage/upnp/ccontrolpoint.h>
#include <cybergarage/upnp/cupnp_limit.h>
#include <cybergarage/upnp/control/ccontrol.h>
#include <cybergarage/util/clog.h>

Functions

static void cg_upnp_controlpoint_ssdplistner (CgUpnpSSDPPacket *ssdpPkt)
static void cg_upnp_controlpoint_ssdpresponselistner (CgUpnpSSDPPacket *ssdpPkt)
char * cg_upnp_controlpoint_geteventsubcallbackurl (CgUpnpControlPoint *ctrlPoint, char *ifaddr, char *buf, int bufLen)
CgUpnpControlPointcg_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_lock (CgUpnpControlPoint *ctrlPoint)
BOOL cg_upnp_controlpoint_unlock (CgUpnpControlPoint *ctrlPoint)
CgUpnpDevicecg_upnp_controlpoint_getdevicebyexacttype (CgUpnpControlPoint *ctrlPoint, char *exacttype)
CgUpnpDevicecg_upnp_controlpoint_getdevicebytype (CgUpnpControlPoint *ctrlPoint, char *type)
CgUpnpDevicecg_upnp_controlpoint_getdevicebyudn (CgUpnpControlPoint *ctrlPoint, char *udn)
BOOL cg_upnp_controlpoint_parsescservicescpd (CgUpnpService *service)
BOOL cg_upnp_controlpoint_parseservicesfordevice (CgUpnpDevice *dev, CgUpnpSSDPPacket *ssdpPkt)
static CgUpnpDevicecg_upnp_controlpoint_createdevicefromssdkpacket (CgUpnpSSDPPacket *ssdpPkt)
void cg_upnp_controlpoint_adddevicebyssdppacket (CgUpnpControlPoint *ctrlPoint, CgUpnpSSDPPacket *ssdpPkt)
void cg_upnp_controlpoint_removedevicebyssdppacket (CgUpnpControlPoint *ctrlPoint, CgUpnpSSDPPacket *ssdpPkt)
BOOL cg_upnp_controlpoint_search (CgUpnpControlPoint *ctrlPoint, char *target)
BOOL cg_upnp_controlpoint_ipchanged (CgUpnpControlPoint *ctrlPoint)

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:
ctrlPoint The control point, whose device list to handle
ssdpPkt The received SSDP packet

static CgUpnpDevice* cg_upnp_controlpoint_createdevicefromssdkpacket ( CgUpnpSSDPPacket ssdpPkt  )  [static]

void cg_upnp_controlpoint_delete ( CgUpnpControlPoint ctrlPoint  ) 

Destroy the given control point

Parameters:
ctrlPoint The control point struct to destroy

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:
ctrlPoint Controlpoint in question
exacttype Type 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:
ctrlPoint Controlpoint in question
type Type 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:
ctrlPoint Controlpoint in question
udn Type of the device

char* cg_upnp_controlpoint_geteventsubcallbackurl ( CgUpnpControlPoint ctrlPoint,
char *  ifaddr,
char *  buf,
int  bufLen 
)

Get the event subscription callback URI

Parameters:
ctrlPoint The control point in question
ifaddr Interface address
buf Buffer used to store callback url
bufLen Buffer length
Returns:
Event callback url (pointer to buf)

BOOL cg_upnp_controlpoint_ipchanged ( CgUpnpControlPoint ctrlpoint  ) 

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

Parameters:
ctrlpoint The control point in use
Returns:
success of changing used interfaces

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:
ctrlPoint The 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:
service The 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:
dev The device in question
ssdpPkt An 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:
ctrlPoint The control point, whose device list to handle
ssdpPkt The received SSDP packet

BOOL cg_upnp_controlpoint_search ( CgUpnpControlPoint ctrlPoint,
char *  target 
)

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

Parameters:
ctrlPoint The control point in question
target The Search Target parameter (ex. "ssdp:all")

static void cg_upnp_controlpoint_ssdplistner ( CgUpnpSSDPPacket ssdpPkt  )  [static]

static void cg_upnp_controlpoint_ssdpresponselistner ( CgUpnpSSDPPacket ssdpPkt  )  [static]

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:
ctrlPoint The 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:
ctrlPoint The control point to stop
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:
ctrlPoint The control point in question


Generated on Tue Aug 8 14:56:29 2006 for CyberLinkC by  doxygen 1.4.7