48#ifndef COMPA_INTERNAL_CONFIG_HPP
49#error "No or wrong config.hpp header file included."
52#ifdef COMPA_HAVE_DEVICE_GENA
84 long unsigned int NumOfServices = 0lu;
85 long unsigned int i = 0lu;
92 if (serviceNodeList) {
94 for (i = 0lu; i < NumOfServices; i++) {
100 current = current->
next;
110 current->
next = NULL;
126 if (!
getSubElement(
"serviceId", current_service, &serviceId) ||
135 tempDOMString = NULL;
141 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
142 "BAD OR MISSING CONTROL URL");
143 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
144 "CONTROL URL SET TO NULL IN "
150 tempDOMString = NULL;
151 if (!
getSubElement(
"eventSubURL", current_service, &eventURL) ||
155 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
156 "BAD OR MISSING EVENT URL");
157 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
158 "EVENT URL SET TO NULL IN "
164 tempDOMString = NULL;
168 previous->
next = NULL;
205 long unsigned int NumOfDevices = 0lu;
206 long unsigned int i = 0lu;
213 for (i = 0lu; i < NumOfDevices; i++) {
255 if (!strcmp(sid, finger->
sid)) {
267 finger = finger->
next;
278 while (next && !found) {
279 if (!strcmp(next->
sid, sid))
325 while (notDone && current) {
327 current = current->
next;
334 current->
next = NULL;
338 }
else if (current->
active) {
371 if (!strcmp(serviceId, finger->
serviceId) &&
372 !strcmp(UDN, finger->
UDN)) {
375 finger = finger->
next;
384 const char* eventURLPath) {
389 if (!table || !eventURLPath) {
392 if (
parse_uri(eventURLPath, strlen(eventURLPath), &parsed_url_in) ==
405 finger = finger->
next;
413 const char* controlURLPath) {
418 if (!table || !controlURLPath) {
421 if (
parse_uri(controlURLPath, strlen(controlURLPath), &parsed_url_in) ==
434 finger = finger->
next;
446 UpnpPrintf(level, module, __FILE__, __LINE__,
"serviceType: %s\n",
450 UpnpPrintf(level, module, __FILE__, __LINE__,
"serviceId: %s\n",
454 UpnpPrintf(level, module, __FILE__, __LINE__,
"SCPDURL: %s\n",
458 UpnpPrintf(level, module, __FILE__, __LINE__,
"controlURL: %s\n",
462 UpnpPrintf(level, module, __FILE__, __LINE__,
"eventURL: %s\n",
466 UpnpPrintf(level, module, __FILE__, __LINE__,
"UDN: %s\n\n",
471 "Service is active\n");
474 "Service is inactive\n");
485 UpnpPrintf(level, module, __FILE__, __LINE__,
"serviceType: %s\n",
489 UpnpPrintf(level, module, __FILE__, __LINE__,
"serviceId: %s\n",
493 UpnpPrintf(level, module, __FILE__, __LINE__,
"SCPDURL: %s\n",
497 UpnpPrintf(level, module, __FILE__, __LINE__,
"controlURL: %s\n",
501 UpnpPrintf(level, module, __FILE__, __LINE__,
"eventURL: %s\n",
505 UpnpPrintf(level, module, __FILE__, __LINE__,
"UDN: %s\n\n",
510 "Service is active\n");
513 "Service is inactive\n");
515 service = service->
next;
523 UpnpPrintf(level, module, __FILE__, __LINE__,
"URL_BASE: %s\n",
525 UpnpPrintf(level, module, __FILE__, __LINE__,
"Services: \n");
530#ifdef COMPA_HAVE_DEVICE_GENA
600 long unsigned int NumOfDevices = 0lu;
601 long unsigned int i = 0lu;
609 for (i = 0lu; i < NumOfDevices; i++) {
610 if ((start_search) &&
613 current_service = start_search;
619 while ((current_service) &&
620 (strcmp(current_service->
UDN, UDN))) {
621 current_service = current_service->
next;
622 if (current_service != NULL)
623 prev_service = current_service->
next;
625 while ((current_service) &&
626 (!strcmp(current_service->
UDN, UDN))) {
628 prev_service->
next = current_service->
next;
634 start_search = current_service->
next;
636 current_service = start_search;
650 const char* DefaultURLBase) {
663 if (DefaultURLBase) {
680 const char* DefaultURLBase) {
688 if (DefaultURLBase) {
723 while (child && !found) {
727 if (!strcmp(NodeName, element_name)) {
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
token pathquery
Member variable.
constexpr int HTTP_SUCCESS
Yet another success code.
Represents a URI used in parse_uri and elsewhere.
int ListInit(LinkedList *list, cmp_routine cmp_func, free_function free_func)
Initializes LinkedList. Must be called first and only once for List.
void freeSubscriptionQueuedEvents(subscription *sub)
???
Data structure common to all types of nodes.
Data structure representing a list of nodes.
Data structure representing an Element node.
PUPNP_Api unsigned short ixmlNode_getNodeType(IXML_Node *nodeptr)
Retrieves the type of a Node. Note that not all possible return values are actually implemented.
#define DOMString
The type of DOM strings.
PUPNP_Api IXML_Node * ixmlNode_getNextSibling(IXML_Node *nodeptr)
Retrieves the sibling Node immediately following this Node.
PUPNP_Api const DOMString ixmlNode_getNodeValue(IXML_Node *nodeptr)
Returns the value of the Node as a string.
PUPNP_Api const DOMString ixmlNode_getNodeName(IXML_Node *nodeptr)
Returns the name of the Node, depending on what type of Node it is, in a read-only string.
PUPNP_Api void ixmlFreeDOMString(DOMString buf)
Frees a DOMString.
PUPNP_Api unsigned long ixmlNodeList_length(IXML_NodeList *nList)
Returns the number of Nodes in a NodeList.
PUPNP_Api void ixmlNodeList_free(IXML_NodeList *nList)
Frees a NodeList object.
PUPNP_Api DOMString ixmlCloneDOMString(const DOMString src)
Clones an existing DOMString.
PUPNP_Api IXML_Node * ixmlNode_getFirstChild(IXML_Node *nodeptr)
Retrieves the first child Node of a Node.
PUPNP_Api IXML_Node * ixmlNodeList_item(IXML_NodeList *nList, unsigned long index)
Retrieves a Node from a NodeList specified by a numerical index.
PUPNP_Api IXML_NodeList * ixmlElement_getElementsByTagName(IXML_Element *element, const DOMString tagName)
Returns a NodeList of all descendant Elements with a given tag name, in the order in which they are e...
service_info * getAllServiceList(IXML_Node *node, char *URLBase, service_info **out_end)
Returns pointer to service info after getting the sub-elements of the service info.
service_info * getServiceList(IXML_Node *node, service_info **end, char *URLBase)
Returns pointer to service info after getting the sub-elements of the service info.
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.
void printService(service_info *service, Upnp_LogLevel level, Dbg_Module module)
prints information from the service 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.
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.
void printServiceList(service_info *service, Upnp_LogLevel level, Dbg_Module module)
Prints information of each service from the service table passed into the function.
subscription * GetFirstSubscription(service_info *service)
Gets pointer to the first subscription node in the service table.
subscription * GetSubscriptionSID(const Upnp_SID sid, service_info *service)
Return the subscription from the service table that matches const Upnp_SID sid value.
void freeService(service_info *in)
Free's memory allocated for the various components of the service entry in the service table.
int copy_subscription(subscription *in, subscription *out)
Makes a copy of the subscription.
void freeServiceTable(service_table *table)
Free's dynamic memory in table (does not free table, only memory within the structure).
int addServiceTable(IXML_Node *node, service_table *in, const char *DefaultURLBase)
Add Service to the table.
void freeServiceList(service_info *head)
Free's memory allocated for the various components of each service entry in the service table.
void freeSubscription(subscription *sub)
Free's the memory allocated for storing the URL of the subscription.
int removeServiceTable(IXML_Node *node, service_table *in)
Remove all services for a root device.
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.
void RemoveSubscriptionSID(Upnp_SID sid, service_info *service)
Remove the subscription from the service table and update it.
int getServiceTable(IXML_Node *node, service_table *out, const char *DefaultURLBase)
Retrieve service from the table.
void freeSubscriptionList(subscription *head)
Free's memory allocated for all the subscriptions in the service table.
subscription * GetNextSubscription(service_info *service, subscription *current)
Get current and valid subscription from the service table.
DOMString getElementValue(IXML_Node *node)
Returns the clone of the element value.
service_info * FindServiceId(service_table *table, const char *serviceId, const char *UDN)
Traverses through the service table to find a service.
Manage the UPnP Services of a UPnP Device if available.
int TotalSubscriptions
Part of Service information.
service_info * serviceList
Part of the service table.
URL_list DeliveryURLs
Part of subscription.
int active
Part of subscription.
char * eventURL
Part of Service information.
struct subscription * next
Part of subscription.
service_info * endServiceList
Part of the service table.
struct service_info * next
Part of Service information.
DOMString URLBase
Part of the service table.
Upnp_SID sid
Part of subscription.
subscription * subscriptionList
Part of Service information.
DOMString UDN
Part of Service information.
DOMString serviceId
Part of Service information.
LinkedList outgoing
List of queued events for this subscription.
DOMString serviceType
Part of Service information.
char * SCPDURL
Part of Service information.
int ToSendEventKey
Part of subscription.
time_t expireTime
Part of subscription.
int active
Part of Service information.
char * controlURL
Part of Service information.
-brief Service information
enum Upnp_Module Dbg_Module
Only debug messages from this program module.
UPnPsdk_VIS void UpnpPrintf(Upnp_LogLevel DLevel, Dbg_Module Module, const char *DbgFileName, int DbgLineNo, const char *FmtStr,...)
Prints the debug statement.
enum Upnp_LogLevel_e Upnp_LogLevel
Upnp_LogLevel.
char * resolve_rel_url(char *base_url, char *rel_url)
Resolves a relative url with a base url.
int copy_URL_list(URL_list *in, URL_list *out)
Copies one URL_list into another.
int token_cmp(token *in1, token *in2)
Compares two tokens.
int parse_uri(const char *in, size_t max, uri_type *out)
Parses a uri as defined in RFC 2396 (explaining URIs).
void free_URL_list(URL_list *list)
Frees the memory associated with a URL_list.