#include <cybergarage/upnp/cdevice.h>
#include <cybergarage/upnp/ccontrolpoint.h>
#include <cybergarage/upnp/cupnp_limit.h>
#include <cybergarage/util/ctime.h>
#include <cybergarage/net/cinterface.h>
#include <cybergarage/net/curl.h>
#include <cybergarage/upnp/cupnp_function.h>
#include <cybergarage/upnp/ssdp/cssdp.h>
#include <cybergarage/upnp/ssdp/cssdp_server.h>
#include <cybergarage/upnp/control/ccontrol.h>
#include <cybergarage/io/cfile.h>
#include <cybergarage/util/clog.h>
#include <cybergarage/util/cstring.h>
void cg_upnp_device_announce | ( | CgUpnpDevice * | dev | ) |
Broadcast an SSDP:alive to notify control points that the device is available.
dev | Device in question |
BOOL cg_upnp_device_announcefrom | ( | CgUpnpDevice * | dev, | |
char * | bindAddr | |||
) |
void cg_upnp_device_byebye | ( | CgUpnpDevice * | dev | ) |
Broadcast an SSDP:byebye message to notify control points that the device is no longer available.
dev | Device in question |
BOOL cg_upnp_device_byebyefrom | ( | CgUpnpDevice * | dev, | |
char * | bindAddr | |||
) |
void cg_upnp_device_clear | ( | CgUpnpDevice * | dev | ) |
Clear a UPnP device structure. This is an internal function and should not be called from outside.
dev | Device in question |
void cg_upnp_device_delete | ( | CgUpnpDevice * | dev | ) |
Delete a UPnP device
dev | Device in question |
CgUpnpAction* cg_upnp_device_getactionbyname | ( | CgUpnpDevice * | dev, | |
char * | name | |||
) |
Find an action from a device by its name
dev | Device in question | |
name | Name of the action |
CgUpnpDevice* cg_upnp_device_getdevicebydescriptionuri | ( | CgUpnpDevice * | dev, | |
char * | url | |||
) |
Find a child device by its description URI.
dev | Device in question | |
url | Description URI |
CgUpnpDevice* cg_upnp_device_getdevicebyexacttype | ( | CgUpnpDevice * | dev, | |
char * | exacttype | |||
) |
Find a device from the device's children by the type of the device. This function searches for devices, whose *complete type string* matches the given string, including version number. For example: "urn:schemas-upnp-org:device:FooDevice:1". If you need to disregard the version number, use cg_upnp_device_getdevicebytype
dev | Device in question | |
exacttype | Type of the device |
CgUpnpDevice* cg_upnp_device_getdevicebytype | ( | CgUpnpDevice * | dev, | |
char * | type | |||
) |
Find a device from the device's children by the type of the device. This function searches for devices, whose *type part* (i.e. not including the version) of the device type string matches the given string. For example: "urn:schemas-upnp-org:device:FooDevice". If you need to know the version of a device, use cg_upnp_devicetype_getversion
dev | Device in question | |
type | Type of the device |
CgUpnpDevice* cg_upnp_device_getdevicebyudn | ( | CgUpnpDevice * | dev, | |
char * | udn | |||
) |
Find a device from the device's children by the UDN of the device.
dev | Device in question | |
udn | Type of the device |
char* cg_upnp_device_getlocationurl | ( | CgUpnpDevice * | dev, | |
char * | host, | |||
char * | buf, | |||
int | bufSize | |||
) |
Get device's location URL. Transforms the given <host> address to URL form: "http://<host>:<port>/description.xml". Port is usually 80 or 38400. If <host> is an IPv6 address, the address is "http://[<host>]:<port>/description.xml".
dev | Device in question | |
host | The device host | |
buf | Buffer to store the resulting URL | |
bufSize | Buffer length |
char* cg_upnp_device_getnotifydevicent | ( | CgUpnpDevice * | dev, | |
char * | buf, | |||
int | bufSize | |||
) |
Get the device's Notification Type (NT). For the root device this is "upnp:rootdevice", otherwise the device's UDN (Unique Device Name).
dev | The device in question | |
buf | Buffer for the Notification Type | |
bufSize | Buffer length |
char* cg_upnp_device_getnotifydevicetypent | ( | CgUpnpDevice * | dev, | |
char * | buf, | |||
int | bufSize | |||
) |
Get the device type
dev | The device in question | |
buf | Buffer for the device type | |
bufSize | Buffer length |
char* cg_upnp_device_getnotifydevicetypeusn | ( | CgUpnpDevice * | dev, | |
char * | buf, | |||
int | bufSize | |||
) |
Get the device's USN (Unique Service Name). For the root device this is "<UDN>::upnp:rootdevice", otherwise the UDN (Unique Device Name).
dev | The device in question | |
buf | Buffer where USN is stored after call | |
bufSize | Buffer size |
char* cg_upnp_device_getnotifydeviceusn | ( | CgUpnpDevice * | dev, | |
char * | buf, | |||
int | bufSize | |||
) |
TODO: cg_upnp_device_getnotifydeviceusn doc
CgUpnpDevice* cg_upnp_device_getrootdevice | ( | CgUpnpDevice * | dev | ) |
Return the root (i.e. the topmost) device in the device structure
dev | Traverses the device tree upwards starting from this device |
CgUpnpService* cg_upnp_device_getservicebycontrolurl | ( | CgUpnpDevice * | dev, | |
char * | url | |||
) |
Find a service from a device by its control URL
dev | Device in question | |
url | Control URL |
CgUpnpService* cg_upnp_device_getservicebyeventsuburl | ( | CgUpnpDevice * | dev, | |
char * | url | |||
) |
Find a service from a device by its event subscription URL
dev | Device in question | |
url | Event Subscription URL |
CgUpnpService* cg_upnp_device_getservicebyexacttype | ( | CgUpnpDevice * | dev, | |
char * | type | |||
) |
Find a service from the device by the type of the service. This function searches for services, whose *complete type string* matches the given string, including version number. For example: "urn:schemas-upnp-org:service:ContentDirectory:1". If you need to know the version of a service, use cg_upnp_servicetype_getversion
dev | Device in question | |
type | Type of the service |
CgUpnpService* cg_upnp_device_getservicebyscpdurl | ( | CgUpnpDevice * | dev, | |
char * | url | |||
) |
Find a service from the device by the SCPD (Service Control Protocol Definition) URL of the service.
dev | Device in question | |
url | SCPD URL |
CgUpnpService* cg_upnp_device_getservicebyserviceid | ( | CgUpnpDevice * | dev, | |
char * | serviceId | |||
) |
Find service from the device by a given serviceId. This function searches recursively device and its subdevices for a service with a given serviceId
dev | Device in question | |
serviceId | serviceId of the service |
CgUpnpService* cg_upnp_device_getservicebysid | ( | CgUpnpDevice * | dev, | |
char * | sid | |||
) |
Find a service from the device by the subscribtion ID
dev | Device in question | |
sid | Subscription ID of the service |
CgUpnpService* cg_upnp_device_getservicebytype | ( | CgUpnpDevice * | dev, | |
char * | type | |||
) |
Find a service from the device by the type of the service. This function searches for services, whose *type part* (i.e. not including the version) of the service type string matches the given string. For example: "urn:schemas-upnp-org:service:ContentDirectory". If you need to know the version of a service, use cg_upnp_servicetype_getversion
dev | Device in question | |
type | Type of the service |
CgUpnpStateVariable* cg_upnp_device_getstatevariablebyname | ( | CgUpnpDevice * | dev, | |
char * | name | |||
) |
Find a state variable from a device by its name
dev | Device in question | |
name | Name of the state variable |
static void cg_upnp_device_initchildnodes | ( | CgUpnpDevice * | dev | ) | [static] |
static void cg_upnp_device_initdevicelist | ( | CgUpnpDevice * | dev | ) | [static] |
static void cg_upnp_device_initiconlist | ( | CgUpnpDevice * | dev | ) | [static] |
static void cg_upnp_device_initservicelist | ( | CgUpnpDevice * | dev | ) | [static] |
BOOL cg_upnp_device_ipchanged | ( | CgUpnpDevice * | dev | ) |
Notify device that IP address of the host has been changed.
dev | dev The device in question |
BOOL cg_upnp_device_loaddescriptionfile | ( | CgUpnpDevice * | dev, | |
char * | fileName | |||
) |
Load and parse the device description from an XML file. Not available for T-Engine, ITron and BTron platforms.
dev | Device in question | |
fileName | The file name containing the device description XML document |
CgUpnpDevice* cg_upnp_device_new | ( | ) |
Create a new UPnP device
static void cg_upnp_device_notifywait | ( | CgUpnpDevice * | dev | ) | [static] |
BOOL cg_upnp_device_parsedescription | ( | CgUpnpDevice * | dev, | |
char * | desciption, | |||
int | descriptionLen | |||
) |
Parse the device description XML document.
dev | Device in question | |
desciption | Buffer containing the device description in XML format | |
descriptionLen | Buffer length |
BOOL cg_upnp_device_parsedescriptionurl | ( | CgUpnpDevice * | dev, | |
CgNetURL * | url | |||
) |
Fetch and parse the device description XML file, located in the given URL.
dev | Device in question | |
url | An internet resource |
BOOL cg_upnp_device_postsearchresponse | ( | CgUpnpDevice * | dev, | |
CgUpnpSSDPPacket * | ssdpPkt, | |||
char * | st, | |||
char * | usn | |||
) |
Post a response to an SSDP search message
dev | The device in question | |
ssdpPkt | Received SSDP packet | |
st | Service Type (ST) | |
usn | Unique Service Name (USN) |
void cg_upnp_device_setactionlistener | ( | CgUpnpDevice * | dev, | |
CG_UPNP_ACTION_LISTNER | actionListner | |||
) |
Set an action listener to the device. Actions are basically commands, that the device (service) responds to.
dev | Device in question | |
actionListner | The action listener |
void cg_upnp_device_setdevicenode | ( | CgUpnpDevice * | dev, | |
CgXmlNode * | node | |||
) |
Set the device description node and initialise its child nodes
dev | Device in question | |
node | The XML structure to be set as the device's description |
void cg_upnp_device_setquerylistener | ( | CgUpnpDevice * | dev, | |
CG_UPNP_STATEVARIABLE_LISTNER | queryListner | |||
) |
Set a query listener to the device. Queries are meant for state variables.
dev | Device in question | |
queryListner | The query listener |
BOOL cg_upnp_device_start | ( | CgUpnpDevice * | dev | ) |
Start the device. This essentially starts:
dev | Device in question |
BOOL cg_upnp_device_stop | ( | CgUpnpDevice * | dev | ) |
Stop the device. This concerns:
dev | Device in question |
BOOL cg_upnp_device_updatefromssdppacket | ( | CgUpnpDevice * | dev, | |
CgUpnpSSDPPacket * | ssdpPkt | |||
) |
Update the device's contents from an SSDP packet if necessary.
dev | The device to potentially update | |
ssdpPkt | The SSDP packet to make decisions on |
char* cg_upnp_devicetype_getdevice | ( | char * | deviceType | ) |
Get the device part of a device type string (usually just "device")
deviceType | A device type string (usually the result from cg_upnp_device_getdevicetype) |
char* cg_upnp_devicetype_getidentifier | ( | char * | deviceType | ) |
Get the identifier-part of a device type string (usually "urn")
deviceType | A device type string (usually the result from cg_upnp_device_getdevicetype) |
char* cg_upnp_devicetype_getschematype | ( | char * | deviceType | ) |
Get the schema type part of a device type string (without last colon) (ex. "urn:schemas-upnp-org:device:ContentDirectory")
deviceType | A device type string (usually the result from cg_upnp_device_getdevicetype) |
char* cg_upnp_devicetype_gettype | ( | char * | deviceType | ) |
Get the type part of a device type string (ex. "ContentDirectory")
deviceType | A device type string (usually the result from cg_upnp_device_getdevicetype) |
char* cg_upnp_devicetype_geturn | ( | char * | deviceType | ) |
Get the URN part of a device type string (usually "schemas-upnp-org")
deviceType | A device type string (usually the result from cg_upnp_device_getdevicetype) |
char* cg_upnp_devicetype_getversion | ( | char * | deviceType | ) |
Get the version part of a device type string (ex. "1")
deviceType | A device type string (usually the result from cg_upnp_device_getdevicetype) |