UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
service_table.cpp File Reference

This file defines the functions for UPnP Services. More...

#include <service_table.hpp>
+ Include dependency graph for service_table.cpp:

Go to the source code of this file.

Functions

service_infoanonymous_namespace{service_table.cpp}::getServiceList (IXML_Node *node, service_info **end, char *URLBase)
 Returns pointer to service info after getting the sub-elements of the service info.
 
service_infoanonymous_namespace{service_table.cpp}::getAllServiceList (IXML_Node *node, char *URLBase, service_info **out_end)
 Returns pointer to service info after getting the sub-elements of the service info.
 
int copy_subscription (subscription *in, subscription *out)
 Makes a copy of the subscription.
 
void RemoveSubscriptionSID (Upnp_SID sid, service_info *service)
 Remove the subscription from the service table and update it.
 
subscriptionGetSubscriptionSID (const Upnp_SID sid, service_info *service)
 Return the subscription from the service table that matches const Upnp_SID sid value.
 
subscriptionGetFirstSubscription (service_info *service)
 Gets pointer to the first subscription node in the service table.
 
subscriptionGetNextSubscription (service_info *service, subscription *current)
 Get current and valid subscription from the service table.
 
void freeSubscription (subscription *sub)
 Free's the memory allocated for storing the URL of the subscription.
 
void freeSubscriptionList (subscription *head)
 Free's memory allocated for all the subscriptions in the service table.
 
service_infoFindServiceId (service_table *table, const char *serviceId, const char *UDN)
 Traverses through the service table to find a service.
 
service_infoFindServiceEventURLPath (service_table *table, const char *eventURLPath)
 Traverses the service table and finds the node whose event URL Path matches a known value.
 
service_infoFindServiceControlURLPath (service_table *table, const char *controlURLPath)
 Traverses the service table and finds the node whose control URL Path matches a known value.
 
void printService (service_info *service, Upnp_LogLevel level, Dbg_Module module)
 prints information from the service passed into the function.
 
void printServiceList (service_info *service, Upnp_LogLevel level, Dbg_Module module)
 Prints information of each service from the service table passed into the function.
 
void printServiceTable (service_table *table, Upnp_LogLevel level, Dbg_Module module)
 Prints the URL base of the table and information of each service from the service table.
 
void freeService (service_info *in)
 Free's memory allocated for the various components of the service entry in the service table.
 
void freeServiceList (service_info *head)
 Free's memory allocated for the various components of each service entry in the service table.
 
void freeServiceTable (service_table *table)
 Free's dynamic memory in table (does not free table, only memory within the structure).
 
int removeServiceTable (IXML_Node *node, service_table *in)
 Remove all services for a root device.
 
int addServiceTable (IXML_Node *node, service_table *in, const char *DefaultURLBase)
 Add Service to the table.
 
int getServiceTable (IXML_Node *node, service_table *out, const char *DefaultURLBase)
 Retrieve service from the table.
 
DOMString getElementValue (IXML_Node *node)
 Returns the clone of the element value.
 
int getSubElement (const char *element_name, IXML_Node *node, IXML_Node **out)
 Traverses through a list of XML nodes to find the node with the known element name.
 

Detailed Description

This file defines the functions for UPnP Services.

It defines functions for adding and removing services to and from the service table, adding and accessing subscription and other attributes pertaining to the service.

Note
This is only available if the Device Module was selected at compile time.

Definition in file service_table.cpp.

Function Documentation

◆ copy_subscription()

int copy_subscription ( subscription in,
subscription out 
)

Makes a copy of the subscription.

Note
Only available with the Device GENA module compiled in.
Returns
On success: HTTP_SUCCESS
On error: Error codes from copy_URL_list.
Parameters
[in]inSource subscription.
[out]outDestination subscription.

Definition at line 233 of file service_table.cpp.

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

◆ RemoveSubscriptionSID()

void RemoveSubscriptionSID ( Upnp_SID  sid,
service_info service 
)

Remove the subscription from the service table and update it.

Note
Only available with the Device GENA module compiled in.
Parameters
[in]sidSubscription ID.
[in]serviceService object providing the list of subscriptions.

Definition at line 250 of file service_table.cpp.

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

◆ GetSubscriptionSID()

subscription * GetSubscriptionSID ( const Upnp_SID  sid,
service_info service 
)

Return the subscription from the service table that matches const Upnp_SID sid value.

Note
Only available with the Device GENA module compiled in.
Returns
Pointer to the matching subscription node.
Parameters
[in]sidSubscription ID.
[in]serviceService object providing the list of subscriptions.

Definition at line 272 of file service_table.cpp.

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

◆ GetFirstSubscription()

subscription * GetFirstSubscription ( service_info service)

Gets pointer to the first subscription node in the service table.

Note
Only available with the Device GENA module compiled in.
Returns
Pointer to the first subscription node.
Parameters
[in]serviceService object providing the list of subscriptions.

Definition at line 304 of file service_table.cpp.

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

◆ GetNextSubscription()

subscription * GetNextSubscription ( service_info service,
subscription current 
)

Get current and valid subscription from the service table.

Note
Only available with the Device GENA module compiled in.
Returns
Pointer to the next subscription node.
Parameters
[in]serviceService object providing the list of subscriptions.
[in]currentCurrent subscription object.

Definition at line 316 of file service_table.cpp.

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

◆ freeSubscription()

void freeSubscription ( subscription sub)

Free's the memory allocated for storing the URL of the subscription.

Note
Only available with the Device GENA module compiled in.
Parameters
[in]subSubscription object to be freed.

Definition at line 346 of file service_table.cpp.

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

◆ freeSubscriptionList()

void freeSubscriptionList ( subscription head)

Free's memory allocated for all the subscriptions in the service table.

Note
Only available with the Device GENA module compiled in.
Parameters
[in]headHead of the subscription list.

Definition at line 353 of file service_table.cpp.

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

◆ FindServiceId()

service_info * FindServiceId ( service_table table,
const char *  serviceId,
const char *  UDN 
)

Traverses through the service table to find a service.

Returns a pointer to the service node that matches a known service id and a known UDN.

Note
Only available with the Device GENA module compiled in.
Returns
Pointer to the matching service_info node.
Parameters
[in]tableService table.
[in]serviceIdString representing the service id to be found among those in the table.
[in]UDNString representing the UDN to be found among those in the table.

Definition at line 364 of file service_table.cpp.

+ Here is the caller graph for this function:

◆ FindServiceEventURLPath()

service_info * FindServiceEventURLPath ( service_table table,
const char *  eventURLPath 
)

Traverses the service table and finds the node whose event URL Path matches a known value.

Returns
Pointer to the service list node from the service table whose event URL matches a known event URL.
Parameters
[in]tableService table.
[in]eventURLPathEvent URL path used to find a service from the table.

Definition at line 383 of file service_table.cpp.

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

◆ FindServiceControlURLPath()

service_info * FindServiceControlURLPath ( service_table table,
const char *  controlURLPath 
)

Traverses the service table and finds the node whose control URL Path matches a known value.

Returns
Pointer to the service list node from the service table whose control URL Path matches a known value.
Parameters
[in]tableService table.
[in]controlURLPathControl URL path used to find a service from the table.

Definition at line 412 of file service_table.cpp.

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

◆ printService()

void printService ( service_info service,
Upnp_LogLevel  level,
Dbg_Module  module 
)

prints information from the service passed into the function.

Note
Only available if DEBUG was selected on compiling.
Parameters
[in]serviceService whose information is to be printed.
[in]levelDebug level specified to the print function.
[in]moduleDebug module specified to the print function.

Definition at line 442 of file service_table.cpp.

+ Here is the call graph for this function:

◆ printServiceList()

void printServiceList ( service_info service,
Upnp_LogLevel  level,
Dbg_Module  module 
)

Prints information of each service from the service table passed into the function.

Note
Only available if DEBUG was selected on compiling.
Parameters
[in]serviceService whose information is to be printed.
[in]levelDebug level specified to the print function.
[in]moduleDebug module specified to the print function.

Definition at line 481 of file service_table.cpp.

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

◆ printServiceTable()

void printServiceTable ( service_table table,
Upnp_LogLevel  level,
Dbg_Module  module 
)

Prints the URL base of the table and information of each service from the service table.

Note
Only available if DEBUG was selected on compiling.
Parameters
[in]tableService table to be printed.
[in]levelDebug level specified to the print function.
[in]moduleDebug module specified to the print function.

Definition at line 521 of file service_table.cpp.

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

◆ freeService()

void freeService ( service_info in)

Free's memory allocated for the various components of the service entry in the service table.

Note
Only available with the Device GENA module compiled in.
Parameters
[in]inService information that is to be freed.

Definition at line 531 of file service_table.cpp.

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

◆ freeServiceList()

void freeServiceList ( service_info head)

Free's memory allocated for the various components of each service entry in the service table.

Note
Only available with the Device GENA module compiled in.
Parameters
[in]headHead of the service list to be freed.

Definition at line 559 of file service_table.cpp.

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

◆ freeServiceTable()

void freeServiceTable ( service_table table)

Free's dynamic memory in table (does not free table, only memory within the structure).

Note
Only available with the Device GENA module compiled in.
Parameters
[in]tableService table whose internal memory needs to be freed.

Definition at line 585 of file service_table.cpp.

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

◆ removeServiceTable()

int removeServiceTable ( IXML_Node node,
service_table in 
)

Remove all services for a root device.

Note
Only available with the Device GENA module compiled in.

This function assumes that services for a particular root device are placed linearly in the service table, and in the order in which they are found in the description document all services for this root device are removed from the list.

Returns
An integer.
Parameters
[in]nodeXML node information.
[in]inService table from which services will be removed.

Definition at line 592 of file service_table.cpp.

+ Here is the call graph for this function:

◆ addServiceTable()

int addServiceTable ( IXML_Node node,
service_table in,
const char *  DefaultURLBase 
)

Add Service to the table.

Note
Only available with the Device GENA module compiled in.
Parameters
[in]nodeXML node information.
[in]inService table that will be initialized with services.
[in]DefaultURLBaseDefault base URL on which the URL will be returned to the service list.

Definition at line 649 of file service_table.cpp.

+ Here is the call graph for this function:

◆ getServiceTable()

int getServiceTable ( IXML_Node node,
service_table out,
const char *  DefaultURLBase 
)

Retrieve service from the table.

Note
Only available with the Device GENA module compiled in.
Returns
An integer
Parameters
[in]nodeXML node information.
[in]outOutput parameter which will contain the service list and URL.
[in]DefaultURLBaseDefault base URL on which the URL will be returned.

Definition at line 679 of file service_table.cpp.

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

◆ getElementValue()

DOMString getElementValue ( IXML_Node node)

Returns the clone of the element value.

Note
Value must be freed with DOMString_free.
Only available with the Device GENA module compiled in.
Returns
DOMString
Parameters
[in]nodeInput node which provides the list of child nodes.

Definition at line 704 of file service_table.cpp.

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

◆ getSubElement()

int getSubElement ( const char *  element_name,
IXML_Node node,
IXML_Node **  out 
)

Traverses through a list of XML nodes to find the node with the known element name.

Note
Only available with the Device GENA module compiled in.
Returns
On success: 1
On error: 0
Parameters
[in]element_nameSub element name to be searched for.
[in]nodeInput node which provides the list of child nodes.
[out]outOuput node to which the matched child node is returned.

Definition at line 717 of file service_table.cpp.

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