mUPnP for C
|
#include <mupnp/control/control.h>
#include <mupnp/controlpoint.h>
#include <mupnp/device.h>
#include <mupnp/io/file.h>
#include <mupnp/net/interface.h>
#include <mupnp/net/url.h>
#include <mupnp/ssdp/ssdp.h>
#include <mupnp/ssdp/ssdp_server.h>
#include <mupnp/upnp_function.h>
#include <mupnp/upnp_limit.h>
#include <mupnp/util/log.h>
#include <mupnp/util/string.h>
#include <mupnp/util/time.h>
bool mupnp_device_addicon | ( | mUpnpDevice * | dev, |
mUpnpIcon * | icon ) |
Get a smallest icon
dev | Device in question |
icon | Icon to add |
void mupnp_device_announce | ( | mUpnpDevice * | dev | ) |
Broadcast an SSDP:alive to notify control points that the device is available.
dev | Device in question |
bool mupnp_device_announcefrom | ( | mUpnpDevice * | dev, |
char * | bindAddr ) |
void mupnp_device_byebye | ( | mUpnpDevice * | dev | ) |
Broadcast an SSDP:byebye message to notify control points that the device is no longer available.
dev | Device in question |
bool mupnp_device_byebyefrom | ( | mUpnpDevice * | dev, |
char * | bindAddr ) |
void mupnp_device_clear | ( | mUpnpDevice * | dev | ) |
Clear a UPnP device structure. This is an internal function and should not be called from outside.
dev | Device in question |
void mupnp_device_delete | ( | mUpnpDevice * | dev | ) |
Delete a UPnP device
dev | Device in question |
bool mupnp_device_getabsoluteiconurl | ( | mUpnpDevice * | dev, |
mUpnpIcon * | icon, | ||
mUpnpString * | buf ) |
Get an icon by its index from the device's list of icons
dev | Device in question |
icon | Icon in question |
buf | Buffer to return the full icon's url |
mUpnpAction * mupnp_device_getactionbyname | ( | mUpnpDevice * | dev, |
const char * | name ) |
Find an action from a device by its name
dev | Device in question |
name | Name of the action |
mUpnpDevice * mupnp_device_getdevicebydescriptionuri | ( | mUpnpDevice * | dev, |
const char * | url ) |
Find a child device by its description URI.
dev | Device in question |
url | Description URI |
mUpnpDevice * mupnp_device_getdevicebyexacttype | ( | mUpnpDevice * | dev, |
const 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 mupnp_device_getdevicebytype
dev | Device in question |
exacttype | Type of the device |
mUpnpDevice * mupnp_device_getdevicebytype | ( | mUpnpDevice * | dev, |
const 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 mupnp_devicetype_getversion
dev | Device in question |
type | Type of the device |
mUpnpDevice * mupnp_device_getdevicebyudn | ( | mUpnpDevice * | dev, |
const 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 |
const char * mupnp_device_getlocationurl | ( | mUpnpDevice * | dev, |
const 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 * mupnp_device_getnotifydevicent | ( | mUpnpDevice * | 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 * mupnp_device_getnotifydevicetypent | ( | mUpnpDevice * | dev, |
char * | buf, | ||
int | bufSize ) |
Get the device type
dev | The device in question |
buf | Buffer for the device type |
bufSize | Buffer length |
char * mupnp_device_getnotifydevicetypeusn | ( | mUpnpDevice * | 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 * mupnp_device_getnotifydeviceusn | ( | mUpnpDevice * | 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 |
mUpnpDevice * mupnp_device_getrootdevice | ( | mUpnpDevice * | dev | ) |
Return the root (i.e. the topmost) device in the device structure
dev | Traverses the device tree upwards starting from this device |
mUpnpService * mupnp_device_getservicebycontrolurl | ( | mUpnpDevice * | dev, |
const char * | url ) |
Find a service from a device by its control URL
dev | Device in question |
url | Control URL |
mUpnpService * mupnp_device_getservicebyeventsuburl | ( | mUpnpDevice * | dev, |
const char * | url ) |
Find a service from a device by its event subscription URL
dev | Device in question |
url | Event Subscription URL |
mUpnpService * mupnp_device_getservicebyexacttype | ( | mUpnpDevice * | dev, |
const 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 mupnp_servicetype_getversion
dev | Device in question |
type | Type of the service |
mUpnpService * mupnp_device_getservicebyscpdurl | ( | mUpnpDevice * | dev, |
const 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 |
mUpnpService * mupnp_device_getservicebyserviceid | ( | mUpnpDevice * | dev, |
const 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 |
mUpnpService * mupnp_device_getservicebysid | ( | mUpnpDevice * | dev, |
const char * | sid ) |
Find a service from its Subscription ID
dev | Device in question |
char* | Subscription-ID (SID) |
mUpnpService * mupnp_device_getservicebytype | ( | mUpnpDevice * | dev, |
const 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 mupnp_servicetype_getversion
dev | Device in question |
type | Type of the service |
mUpnpIcon * mupnp_device_getsmallesticon | ( | mUpnpDevice * | dev | ) |
Get a smallest icon
dev | Device in question |
mUpnpIcon * mupnp_device_getsmallesticonbymimetype | ( | mUpnpDevice * | dev, |
const char * | mimeType ) |
Get a smallest icon of a specified mime type
dev | Device in question |
mimeType | Mime type to get |
mUpnpStateVariable * mupnp_device_getstatevariablebyname | ( | mUpnpDevice * | dev, |
const char * | name ) |
Find a state variable from a device by its name
dev | Device in question |
name | Name of the state variable |
|
static |
|
static |
|
static |
|
static |
bool mupnp_device_ipchanged | ( | mUpnpDevice * | dev | ) |
Notify device that IP address of the host has been changed.
dev | dev The device in question |
bool mupnp_device_isrunning | ( | mUpnpDevice * | dev | ) |
Check if the device] has been started
dev | Device that is being advertised |
mUpnpDevice * mupnp_device_new | ( | void | ) |
Create a new UPnP device
|
static |
bool mupnp_device_parsedescription | ( | mUpnpDevice * | dev, |
const char * | desciption, | ||
size_t | descriptionLen ) |
Parse the device description XML document.
dev | Device in question |
description | Buffer containing the device description in XML format |
descriptionLen | Buffer length |
bool mupnp_device_parsedescriptionurl | ( | mUpnpDevice * | dev, |
mUpnpNetURL * | url ) |
Fetch and parse the device description XML file, located in the given URL.
dev | Device in question |
url | An internet resource |
bool mupnp_device_postsearchresponse | ( | mUpnpDevice * | dev, |
mUpnpSSDPPacket * | ssdpPkt, | ||
const char * | st, | ||
const 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 mupnp_device_setactionlistener | ( | mUpnpDevice * | dev, |
MUPNP_ACTION_LISTNER | actionListner ) |
Set an action listener to the device. Actions are basically commands, that the device (service) responds to.
dev | Device in question |
actionListener | The action listener |
void mupnp_device_setdevicenode | ( | mUpnpDevice * | dev, |
mUpnpXmlNode * | 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 mupnp_device_setpresentationlistener | ( | mUpnpDevice * | dev, |
MUPNP_PRESENTATION_LISTNER | func ) |
void mupnp_device_setquerylistener | ( | mUpnpDevice * | dev, |
MUPNP_STATEVARIABLE_LISTNER | queryListner ) |
Set a query listener to the device. Queries are meant for state variables.
dev | Device in question |
actionListener | The query listener |
bool mupnp_device_start | ( | mUpnpDevice * | dev | ) |
Start the device. This essentially starts:
dev | Device in question |
bool mupnp_device_stop | ( | mUpnpDevice * | dev | ) |
Stop the device. This concerns:
dev | Device in question |
bool mupnp_device_updatefromssdppacket | ( | mUpnpDevice * | dev, |
mUpnpSSDPPacket * | 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 |
void mupnp_device_updateudn | ( | mUpnpDevice * | dev | ) |
Update new Unique Device Name (UDN)
dev | Device in question |
char * mupnp_devicetype_getdevice | ( | const char * | deviceType | ) |
Get the device part of a device type string (usually just "device")
deviceType | A device type string (usually the result from mupnp_device_getdevicetype) |
char * mupnp_devicetype_getidentifier | ( | const char * | deviceType | ) |
Get the identifier-part of a device type string (usually "urn")
deviceType | A device type string (usually the result from mupnp_device_getdevicetype) |
char * mupnp_devicetype_getschematype | ( | const 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 mupnp_device_getdevicetype) |
char * mupnp_devicetype_gettype | ( | const char * | deviceType | ) |
Get the type part of a device type string (ex. "ContentDirectory")
deviceType | A device type string (usually the result from mupnp_device_getdevicetype) |
char * mupnp_devicetype_geturn | ( | const char * | deviceType | ) |
Get the URN part of a device type string (usually "schemas-upnp-org")
deviceType | A device type string (usually the result from mupnp_device_getdevicetype) |
char * mupnp_devicetype_getversion | ( | const char * | deviceType | ) |
Get the version part of a device type string (ex. "1")
deviceType | A device type string (usually the result from mupnp_device_getdevicetype) |