UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
anonymous_namespace{gena_device.cpp} Namespace Reference

Functions

int GeneratePropertySet (char **names, char **values, int count, DOMString *out)
 Generates XML property set for notifications.
 
void free_notify_struct (notify_thread_struct *input)
 Frees memory used in notify_threads if the reference count is 0, otherwise decrements the refrence count.
 
int notify_send_and_recv (uri_type *destination_url, membuffer *mid_msg, char *propertySet, http_parser_t *response)
 Sends the notify message and returns a reply.
 
int genaNotify (char *headers, char *propertySet, subscription *sub)
 Function to Notify a particular subscription of a particular event.
 
void genaNotifyThread (void *input)
 Thread job to Notify a control point.
 
char * AllocGenaHeaders (const DOMString propertySet)
 Allocates the GENA header.
 
int genaInitNotifyCommon (UpnpDevice_Handle device_handle, char *UDN, char *servId, DOMString propertySet, const Upnp_SID sid)
 We take ownership of propertySet and will free it.
 
void maybeDiscardEvents (LinkedList *listp)
 This gets called before queuing a new event.
 
int genaNotifyAllCommon (UpnpDevice_Handle device_handle, char *UDN, char *servId, DOMString propertySet)
 We take ownership of propertySet and will free it.
 
int respond_ok (SOCKINFO *info, int time_out, subscription *sub, http_message_t *request)
 Returns OK message in the case of a subscription request.
 
int create_url_list (memptr *url_list, URL_list *out)
 Function to parse the Callback header value in subscription requests.
 

Function Documentation

◆ GeneratePropertySet()

int anonymous_namespace{gena_device.cpp}::GeneratePropertySet ( char **  names,
char **  values,
int  count,
DOMString out 
)

Generates XML property set for notifications.

Returns
UPNP_E_SUCCESS if successful else returns GENA_E_BAD_HANDLE.
Note
The XML_VERSION comment is NOT sent due to interoperability issues with other UPnP vendors.
Parameters
[in]namesArray of variable names (go in the event notify).
[in]valuesArray of variable values (go in the event notify).
[in]countnumber of variables.
[out]outPropertySet node in the string format.

Definition at line 69 of file gena_device.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_notify_struct()

void anonymous_namespace{gena_device.cpp}::free_notify_struct ( notify_thread_struct input)

Frees memory used in notify_threads if the reference count is 0, otherwise decrements the refrence count.

Parameters
[in]inputNotify structure.

Definition at line 118 of file gena_device.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ notify_send_and_recv()

int anonymous_namespace{gena_device.cpp}::notify_send_and_recv ( uri_type destination_url,
membuffer mid_msg,
char *  propertySet,
http_parser_t response 
)
inline

Sends the notify message and returns a reply.

Returns
on success returns UPNP_E_SUCCESS, otherwise returns a UPNP error.
Note
called by genaNotify
Parameters
[in]destination_urlsubscription callback URL (URL of the control point).
[in]mid_msgCommon HTTP headers.
[in]propertySetThe evented XML.
[out]responseThe response from the control point.

Definition at line 139 of file gena_device.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ genaNotify()

int anonymous_namespace{gena_device.cpp}::genaNotify ( char *  headers,
char *  propertySet,
subscription sub 
)

Function to Notify a particular subscription of a particular event.

In general the service should NOT be blocked around this call (this may cause deadlock with a client).

NOTIFY http request is sent and the reply is processed.

Returns
GENA_SUCCESS if the event was delivered, otherwise returns the appropriate error code.
Parameters
[in]headersNull terminated, includes all headers (including \r\n) except SID and SEQ.
[in]propertySetThe evented XML.
[in]subsubscription to be Notified, assumes this is valid for life of function.

Definition at line 218 of file gena_device.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ genaNotifyThread()

void anonymous_namespace{gena_device.cpp}::genaNotifyThread ( void *  input)

Thread job to Notify a control point.

It validates the subscription and copies the subscription. Also make sure that events are sent in order.

Note
calls the genaNotify to do the actual work.
Parameters
[in]inputnotify thread structure containing all the headers and property set info.

Definition at line 276 of file gena_device.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AllocGenaHeaders()

char * anonymous_namespace{gena_device.cpp}::AllocGenaHeaders ( const DOMString  propertySet)

Allocates the GENA header.

Note
The header must be destroyed after with a call to free(), otherwise there will be a memory leak.
Returns
Pointer to the constructed header string.
Parameters
[in]propertySetPointer to the property set string.

Definition at line 369 of file gena_device.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ genaInitNotifyCommon()

int anonymous_namespace{gena_device.cpp}::genaInitNotifyCommon ( UpnpDevice_Handle  device_handle,
char *  UDN,
char *  servId,
DOMString  propertySet,
const Upnp_SID  sid 
)

We take ownership of propertySet and will free it.

Definition at line 404 of file gena_device.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maybeDiscardEvents()

void anonymous_namespace{gena_device.cpp}::maybeDiscardEvents ( LinkedList listp)

This gets called before queuing a new event.

  • The list size can never go over MAX_SUBSCRIPTION_QUEUED_EVENTS so we discard the oldest non-active event if it is already at the max
  • We also discard any non-active event older than MAX_SUBSCRIPTION_EVENT_AGE. non-active: any but the head of queue, which is already copied to the thread pool

Definition at line 557 of file gena_device.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ genaNotifyAllCommon()

int anonymous_namespace{gena_device.cpp}::genaNotifyAllCommon ( UpnpDevice_Handle  device_handle,
char *  UDN,
char *  servId,
DOMString  propertySet 
)

We take ownership of propertySet and will free it.

Definition at line 586 of file gena_device.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ respond_ok()

int anonymous_namespace{gena_device.cpp}::respond_ok ( SOCKINFO info,
int  time_out,
subscription sub,
http_message_t request 
)

Returns OK message in the case of a subscription request.

Returns
UPNP_E_SUCCESS if successful, otherwise the appropriate error code.
Parameters
[in]infoSocket connection of request.
[in]time_outAccepted duration.
[in]subAccepted subscription.
[in]requestHttp request.

Definition at line 732 of file gena_device.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_url_list()

int anonymous_namespace{gena_device.cpp}::create_url_list ( memptr url_list,
URL_list out 
)

Function to parse the Callback header value in subscription requests.

Takes in a buffer containing URLS delimited by '<' and '>'. The entire buffer is copied into dynamic memory and stored in the URL_list. Pointers to the individual urls within this buffer are allocated and stored in the URL_list. Only URLs with network addresses are considered (i.e. host:port or domain name).

Returns
The number of URLs parsed if successful, otherwise UPNP_E_OUTOF_MEMORY.
Parameters
[in]url_list.
[out]out.

Definition at line 802 of file gena_device.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: