service_table.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef SERVICE_TABLE_H
00034 #define SERVICE_TABLE_H
00035
00036
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045
00046
00047 #include "config.h"
00048 #include "uri.h"
00049 #include "ixml.h"
00050 #include "upnp.h"
00051 #include "upnpdebug.h"
00052
00053
00054 #include <stdio.h>
00055 #include <time.h>
00056
00057
00058 #define SID_SIZE 41
00059
00060
00061 #ifdef INCLUDE_DEVICE_APIS
00062
00063
00064 typedef struct SUBSCRIPTION {
00065 Upnp_SID sid;
00066 int eventKey;
00067 int ToSendEventKey;
00068 time_t expireTime;
00069 int active;
00070 URL_list DeliveryURLs;
00071 struct SUBSCRIPTION *next;
00072 } subscription;
00073
00074
00075 typedef struct SERVICE_INFO {
00076 DOMString serviceType;
00077 DOMString serviceId;
00078 char *SCPDURL ;
00079 char *controlURL;
00080 char *eventURL;
00081 DOMString UDN;
00082 int active;
00083 int TotalSubscriptions;
00084 subscription *subscriptionList;
00085 struct SERVICE_INFO *next;
00086 } service_info;
00087
00088
00089 typedef struct SERVICE_TABLE {
00090 DOMString URLBase;
00091 service_info *serviceList;
00092 service_info *endServiceList;
00093 } service_table;
00094
00095
00096
00097
00098
00104 int copy_subscription(
00106 subscription *in,
00108 subscription *out);
00109
00110
00111
00112
00113
00114
00115 void RemoveSubscriptionSID(
00117 Upnp_SID sid,
00119 service_info *service);
00120
00121
00128 subscription *GetSubscriptionSID(
00130 const Upnp_SID sid,
00132 service_info *service);
00133
00134
00140 subscription *GetFirstSubscription(
00142 service_info *service);
00143
00144
00150 subscription *GetNextSubscription(
00152 service_info *service,
00154 subscription *current);
00155
00156
00160 void freeSubscription(
00162 subscription *sub);
00163
00164
00168 void freeSubscriptionList(
00170 subscription * head);
00171
00172
00179 service_info *FindServiceId(
00181 service_table *table,
00184 const char *serviceId,
00187 const char *UDN);
00188
00189
00197 service_info *FindServiceEventURLPath(
00199 service_table *table,
00201 char *eventURLPath);
00202
00203
00211 service_info * FindServiceControlURLPath(
00213 service_table *table,
00215 const char *controlURLPath);
00216
00217
00222 #ifdef DEBUG
00223 void printService(
00225 service_info *service,
00227 Upnp_LogLevel level,
00229 Dbg_Module module);
00230 #else
00231 static UPNP_INLINE void printService(
00232 service_info *service,
00233 Upnp_LogLevel level,
00234 Dbg_Module module) {}
00235 #endif
00236
00237
00242 #ifdef DEBUG
00243 void printServiceList(
00245 service_info *service,
00247 Upnp_LogLevel level,
00249 Dbg_Module module);
00250 #else
00251 static UPNP_INLINE void printServiceList(
00252 service_info *service,
00253 Upnp_LogLevel level,
00254 Dbg_Module module) {}
00255 #endif
00256
00257
00262 #ifdef DEBUG
00263 void printServiceTable(
00265 service_table *table,
00267 Upnp_LogLevel level,
00269 Dbg_Module module);
00270 #else
00271 static UPNP_INLINE void printServiceTable(
00272 service_table *table,
00273 Upnp_LogLevel level,
00274 Dbg_Module module) {}
00275 #endif
00276
00277
00282 void freeService(
00284 service_info *in);
00285
00286
00291 void freeServiceList(
00293 service_info *head);
00294
00295
00300 void freeServiceTable(
00302 service_table *table);
00303
00304
00313 int removeServiceTable(
00315 IXML_Node *node,
00317 service_table *in);
00318
00319
00323 int addServiceTable(
00325 IXML_Node *node,
00327 service_table *in,
00330 const char *DefaultURLBase);
00331
00332
00338 int getServiceTable(
00340 IXML_Node *node,
00342 service_table *out,
00344 const char *DefaultURLBase);
00345
00346
00347
00348
00349
00357 DOMString getElementValue(
00359 IXML_Node *node);
00360
00361
00370 int getSubElement(
00372 const char *element_name,
00374 IXML_Node *node,
00376 IXML_Node **out);
00377
00378
00379 #endif
00380
00381 #ifdef __cplusplus
00382 }
00383 #endif
00384
00385 #endif
00386