UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
service_table.hpp
Go to the documentation of this file.
1#ifndef COMPA_SERVICE_TABLE_HPP
2#define COMPA_SERVICE_TABLE_HPP
3/*******************************************************************************
4 *
5 * Copyright (c) 2000-2003 Intel Corporation
6 * All rights reserved.
7 * Copyright (c) 2012 France Telecom All rights reserved.
8 * Copyright (C) 2022+ GPL 3 and higher by Ingo Höft, <Ingo@Hoeft-online.de>
9 * Redistribution only with this Copyright remark. Last modified: 2024-03-02
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * - Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 * - Redistributions in binary form must reproduce the above copyright notice,
17 * this list of conditions and the following disclaimer in the documentation
18 * and/or other materials provided with the distribution.
19 * - Neither name of Intel Corporation nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
27 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
31 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 ******************************************************************************/
43#include <config.hpp>
44
45#include <LinkedList.hpp>
46#include <upnpdebug.hpp>
47#include <uri.hpp>
48
50#define SID_SIZE (size_t)41
51
69
86
87#ifdef COMPA_HAVE_DEVICE_SSDP
88
91
101
102/* Functions for Subscriptions */
103
104#ifdef COMPA_HAVE_DEVICE_GENA
116 subscription* in,
118 subscription* out);
119
127 Upnp_SID sid,
129 service_info* service);
130
141 const Upnp_SID sid,
143 service_info* service);
144
154 service_info* service);
155
165 service_info* service,
167 subscription* current);
168
176 subscription* sub);
177
186 subscription* head);
187
201 service_table* table,
204 const char* serviceId,
207 const char* UDN);
208
209#endif /* COMPA_HAVE_DEVICE_GENA */
210
220 service_table* table,
222 const char* eventURLPath);
223
234 service_table* table,
236 const char* controlURLPath);
237
242#ifdef DEBUG
243void printService(
245 service_info* service,
247 Upnp_LogLevel level,
249 Dbg_Module module);
250#else
251#define printService(service, level, module) \
252 do { \
253 } while (0)
254#endif
255
261#ifdef DEBUG
264 service_info* service,
266 Upnp_LogLevel level,
268 Dbg_Module module);
269#else
270#define printServiceList(service, level, module) \
271 do { \
272 } while (0)
273#endif
274
280#ifdef DEBUG
283 service_table* table,
285 Upnp_LogLevel level,
287 Dbg_Module module);
288#else
289#define printServiceTable(table, level, module) \
290 do { \
291 } while (0)
292#endif
293
294#ifdef COMPA_HAVE_DEVICE_GENA
301void freeService(
303 service_info* in);
304
311void freeServiceList(
313 service_info* head);
314
323 service_table* table);
324
339 IXML_Node* node,
341 service_table* in);
342
350 IXML_Node* node,
352 service_table* in,
355 const char* DefaultURLBase);
356
366 IXML_Node* node,
368 service_table* out,
370 const char* DefaultURLBase);
371
372/* Misc helper functions */
373
384 IXML_Node* node);
385
396int getSubElement(
398 const char* element_name,
400 IXML_Node* node,
402 IXML_Node** out);
403
404#endif /* COMPA_HAVE_DEVICE_GENA */
405#endif /* COMPA_HAVE_DEVICE_SSDP */
406#endif /* COMPA_SERVICE_TABLE_HPP */
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition API.hpp:434
Represents a list of URLs as in the "callback" header of SUBSCRIBE message in GENA.
Definition uri.hpp:108
Manage a linked list (for internal use only).
Linked list (no protection).
C++ interface for the Uri module.
Main program configuration file.
Data structure common to all types of nodes.
Definition ixml.hpp:132
#define DOMString
The type of DOM strings.
Definition ixml.hpp:47
int TotalSubscriptions
Part of Service information.
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.
service_info * serviceList
Part of the service table.
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.
void freeSubscriptionQueuedEvents(subscription *sub)
???
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.
URL_list DeliveryURLs
Part of subscription.
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.
int active
Part of subscription.
char * eventURL
Part of Service information.
void freeService(service_info *in)
Free's memory allocated for the various components of the service entry in the service table.
struct subscription * next
Part of subscription.
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).
service_info * endServiceList
Part of the service table.
struct service_info * next
Part of Service information.
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.
DOMString URLBase
Part of the service table.
Upnp_SID sid
Part of subscription.
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.
subscription * subscriptionList
Part of Service information.
DOMString UDN
Part of Service information.
DOMString serviceId
Part of Service information.
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.
LinkedList outgoing
List of queued events for this subscription.
void RemoveSubscriptionSID(Upnp_SID sid, service_info *service)
Remove the subscription from the service table and update it.
DOMString serviceType
Part of Service information.
int getServiceTable(IXML_Node *node, service_table *out, const char *DefaultURLBase)
Retrieve service from the table.
char * SCPDURL
Part of Service information.
void freeSubscriptionList(subscription *head)
Free's memory allocated for all the subscriptions in the service table.
int ToSendEventKey
Part of subscription.
time_t expireTime
Part of subscription.
int active
Part of Service information.
subscription * GetNextSubscription(service_info *service, subscription *current)
Get current and valid subscription from the service table.
char * controlURL
Part of Service information.
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.
device subscriptions
table of services
-brief Service information
Manage Debug messages with levels "critical" to "all".
enum Upnp_Module Dbg_Module
Only debug messages from this program module.
enum Upnp_LogLevel_e Upnp_LogLevel
Upnp_LogLevel.