42#include <httpreadwrite.hpp>
50#include <webserver.hpp>
53#define STALE_JOBID (INVALID_JOB_ID - 1)
84 size += strlen(
"</e:propertyset>\n\n");
85 for (counter = 0; counter < count; counter++) {
86 size += strlen(
"<e:property>\n</e:property>\n");
87 size += 2 * strlen(names[counter]) + strlen(values[counter]) +
91 size_t buffer_len{size + 1};
92 buffer = (
char*)malloc(buffer_len);
95 memset(buffer, 0, size + 1);
101 for (counter = 0; counter < count; counter++) {
102 strcat(buffer,
"<e:property>\n");
103 snprintf(&buffer[strlen(buffer)], buffer_len,
104 "<%s>%s</%s>\n</e:property>\n", names[counter],
105 values[counter], names[counter]);
107 strcat(buffer,
"</e:propertyset>\n\n");
155 const char* CRLF =
"\r\n";
158 UpnpPrintf(UPNP_ALL, GENA, __FILE__, __LINE__,
"gena notify to: %.*s\n",
176 HTTPMETHOD_NOTIFY, &url, mid_msg->
buf) != 0) {
184 start_msg.
length, propertySet,
185 strlen(propertySet), CRLF, strlen(CRLF));
231 int return_code = -1;
238 headers,
"SID: ", sub->
sid,
253 if (response.msg.status_code == HTTP_OK)
256 if (response.msg.status_code == HTTP_PRECONDITION_FAILED)
372 static const char* HEADER_LINE_1 =
373 "CONTENT-TYPE: text/xml; charset=\"utf-8\"\r\n";
374 static const char* HEADER_LINE_2A =
"CONTENT-LENGTH: ";
375 static const char* HEADER_LINE_2B =
"\r\n";
376 static const char* HEADER_LINE_3 =
"NT: upnp:event\r\n";
377 static const char* HEADER_LINE_4 =
"NTS: upnp:propchange\r\n";
378 char* headers = NULL;
379 size_t headers_size = 0;
383 headers_size = strlen(HEADER_LINE_1) + strlen(HEADER_LINE_2A) +
385 strlen(HEADER_LINE_3) + strlen(HEADER_LINE_4) + 1;
386 headers = (
char*)malloc(headers_size);
387 if (headers == NULL) {
391 rc = snprintf(headers, headers_size,
"%s%s%" PRIzu
"%s%s%s", HEADER_LINE_1,
392 HEADER_LINE_2A, strlen(propertySet) + 2, HEADER_LINE_2B,
393 HEADER_LINE_3, HEADER_LINE_4);
396 if (headers == NULL || rc < 0 || (
unsigned int)rc >= headers_size) {
398 "AllocGenaHeaders(): Error UPNP_E_OUTOF_MEMORY\n");
410 int* reference_count = NULL;
411 char* UDN_copy = NULL;
412 char* servId_copy = NULL;
413 char* headers = NULL;
421 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
422 "GENA BEGIN INITIAL NOTIFY COMMON\n");
432 reference_count = (
int*)malloc(
sizeof(
int));
433 if (reference_count == NULL) {
438 *reference_count = 0;
440 UDN_copy = strdup(UDN);
441 if (UDN_copy == NULL) {
447 servId_copy = strdup(servId);
448 if (servId_copy == NULL) {
456 if (
GetHandleInfo(device_handle, &handle_info) != HND_DEVICE) {
463 if (service == NULL) {
468 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
469 "FOUND SERVICE IN INIT NOTFY: UDN %s, ServID: %s", UDN, servId);
472 if (sub == NULL || sub->
active) {
477 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
478 "FOUND SUBSCRIPTION IN INIT NOTIFY: SID %s", sid);
482 if (headers == NULL) {
491 if (thread_struct == NULL) {
495 *reference_count = 1;
496 thread_struct->
servId = servId_copy;
497 thread_struct->
UDN = UDN_copy;
498 thread_struct->
headers = headers;
500 memset(thread_struct->
sid, 0,
sizeof(thread_struct->
sid));
501 strncpy(thread_struct->
sid, sid,
sizeof(thread_struct->
sid) - 1);
502 thread_struct->
ctime = time(0);
537 free(reference_count);
543 "GENA END INITIAL NOTIFY COMMON, ret = %d\n", ret);
558 time_t now = time(0L);
564 if (node == 0 || (node = node->next) == 0) {
566 fprintf(stderr,
"gena_device: maybeDiscardEvents: "
567 "list is inconsistent\n");
591 int* reference_count = NULL;
592 char* UDN_copy = NULL;
593 char* servId_copy = NULL;
594 char* headers = NULL;
601 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
602 "GENA BEGIN NOTIFY ALL COMMON\n");
605 reference_count = (
int*)malloc(
sizeof(
int));
606 if (reference_count == NULL) {
611 *reference_count = 0;
613 UDN_copy = strdup(UDN);
614 if (UDN_copy == NULL) {
620 servId_copy = strdup(servId);
621 if (servId_copy == NULL) {
628 if (headers == NULL) {
636 if (
GetHandleInfo(device_handle, &handle_info) != HND_DEVICE) {
641 if (service != NULL) {
649 if (thread_s == NULL) {
655 (*reference_count)++;
657 thread_s->
UDN = UDN_copy;
658 thread_s->
servId = servId_copy;
661 strncpy(thread_s->
sid, finger->
sid,
sizeof thread_s->
sid);
662 thread_s->
sid[
sizeof thread_s->
sid - 1] = 0;
663 thread_s->
ctime = time(0);
711 if (reference_count && *reference_count == 0) {
716 free(reference_count);
722 "GENA END NOTIFY ALL COMMON, ret = %d\n", ret);
745 char timeout_str[100];
753 rc = snprintf(timeout_str,
sizeof(timeout_str),
"TIMEOUT: Second-%d",
756 memset(timeout_str, 0,
sizeof(timeout_str));
757 strncpy(timeout_str,
"TIMEOUT: Second-infinite",
758 sizeof(timeout_str) - 1);
760 if (rc < 0 || (
unsigned int)rc >=
sizeof(timeout_str)) {
807 size_t URLcount = 0, URLcount2 = 0;
822 for (i = 0; i < URLS->
size; i++) {
823 if ((URLS->
buff[i] ==
'<') && (i + 1 < URLS->
size)) {
825 URLS->
size - i + 1, &temp)) ==
838 out->
URLs = (
char*)malloc(URLS->
size + 1);
849 for (i = 0; i < URLS->
size; i++) {
850 if ((URLS->
buff[i] ==
'<') && (i + 1 < URLS->
size)) {
852 &out->
URLs[i + 1], URLS->
size - i + 1,
856 if (URLcount2 >= URLcount)
879 out->
size = URLcount;
881 return (
int)URLcount;
892 if (
GetHandleInfo(device_handle, &handle_info) != HND_DEVICE) {
893 UpnpPrintf(UPNP_CRITICAL, GENA, __FILE__, __LINE__,
894 "genaUnregisterDevice: BAD Handle: %d\n", device_handle);
929 char** VarNames,
char** VarValues,
int var_count,
935 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
936 "GENA BEGIN INITIAL NOTIFY\n");
938 if (var_count <= 0) {
949 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
950 "GENERATED PROPERTY SET IN INIT NOTIFY: %s", propertySet);
957 "GENA END INITIAL NOTIFY, ret = %d\n", ret);
969 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
970 "GENA BEGIN INITIAL NOTIFY EXT\n");
979 if (propertySet == NULL) {
984 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
985 "GENERATED PROPERTY SET IN INIT EXT NOTIFY: %s", propertySet);
992 "GENA END INITIAL NOTIFY EXT, ret = %d\n", ret);
1004 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
1005 "GENA BEGIN NOTIFY ALL EXT\n");
1008 if (propertySet == NULL) {
1013 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
1014 "GENERATED PROPERTY SET IN EXT NOTIFY: %s", propertySet);
1021 "GENA END NOTIFY ALL EXT, ret = %d\n", ret);
1027 char** VarNames,
char** VarValues,
int var_count) {
1033 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
"GENA BEGIN NOTIFY ALL\n");
1040 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
1041 "GENERATED PROPERTY SET IN EXT NOTIFY: %s", propertySet);
1048 "GENA END NOTIFY ALL, ret = %d\n", ret);
1067 struct in_addr genaAddr4;
1068 struct in_addr genaNetmask;
1069 struct sockaddr_in* deliveryAddr4 = NULL;
1070 struct in6_addr genaAddr6Lla;
1071 struct in6_addr genaAddr6UlaGua;
1072 struct in6_addr* genaAddr6 = NULL;
1073 unsigned int if_prefix;
1074 struct sockaddr_in6* deliveryAddr6 = NULL;
1075 char deliveryAddrString[INET6_ADDRSTRLEN];
1077 if (info == NULL || url_list == NULL) {
1083 if (!inet_pton(AF_INET,
gIF_IPV4, &genaAddr4)) {
1091 for (i = 0; i < url_list->
size; i++) {
1092 deliveryAddr4 = (
struct sockaddr_in*)&url_list->
parsedURLs[i]
1094 if ((deliveryAddr4->sin_addr.s_addr & genaNetmask.s_addr) !=
1095 (genaAddr4.s_addr & genaNetmask.s_addr)) {
1096 inet_ntop(AF_INET, &deliveryAddr4->sin_addr, deliveryAddrString,
1097 sizeof(deliveryAddrString));
1098 UpnpPrintf(UPNP_CRITICAL, GENA, __FILE__, __LINE__,
1099 "DeliveryURL %s is invalid.\n"
1100 "It is not in the expected network "
1101 "segment (IPv4: %s, netmask: %s)\n",
1108 if (!inet_pton(AF_INET6,
gIF_IPV6, &genaAddr6Lla)) {
1116 for (i = 0; i < url_list->
size; i++) {
1117 deliveryAddr6 = (
struct sockaddr_in6*)&url_list->
parsedURLs[i]
1119 if (IN6_IS_ADDR_LINKLOCAL(&deliveryAddr6->sin6_addr)) {
1120 genaAddr6 = &genaAddr6Lla;
1123 genaAddr6 = &genaAddr6UlaGua;
1127 if (memcmp(deliveryAddr6->sin6_addr.s6_addr, genaAddr6->s6_addr,
1129 inet_ntop(AF_INET6, &deliveryAddr6->sin6_addr,
1130 deliveryAddrString,
sizeof(deliveryAddrString));
1131 UpnpPrintf(UPNP_CRITICAL, GENA, __FILE__, __LINE__,
1132 "DeliveryURL %s is invalid.\n"
1133 "It is not in the expected network "
1134 "segment (IPv6: %s, prefix: %d)\n",
1136 IN6_IS_ADDR_LINKLOCAL(&deliveryAddr6->sin6_addr)
1152 int return_code = 1;
1153 int time_out = 1801;
1162 char* event_url_path = NULL;
1167 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
1168 "Subscription Request Received:\n");
1192 if (event_url_path == NULL) {
1197 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
1198 "SubscriptionRequest for event URL path: %s\n", event_url_path);
1204 &handle_info, &service) != HND_DEVICE) {
1205 free(event_url_path);
1210 free(event_url_path);
1212 if (service == NULL || !service->
active) {
1218 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
1219 "Subscription Request: Number of Subscriptions already %d\n "
1220 "Max Subscriptions allowed: %d\n",
1257 if (return_code == 0) {
1270 if (return_code != 0) {
1295 if (time_out >= 0) {
1305 rc = snprintf(sub->
sid,
sizeof(sub->
sid),
"uuid:%s", temp_sid);
1308 if (rc < 0 || (
unsigned int)rc >=
sizeof(sub->
sid) ||
1326 callback_fun = handle_info->
Callback;
1327 cookie = handle_info->
Cookie;
1344 int time_out = 1801;
1364 memcpy(sid, temp_hdr.
buf, temp_hdr.
length);
1365 sid[temp_hdr.
length] =
'\0';
1379 &device_handle, &handle_info, &service) != HND_DEVICE) {
1388 if (service == NULL || !service->
active ||
1395 UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
1396 "Renew request: Number of subscriptions already: %d\n "
1397 "Max Subscriptions allowed:%d\n",
1430 if (time_out == -1) {
1464 memcpy(sid, temp_hdr.
buf, temp_hdr.
length);
1465 sid[temp_hdr.
length] =
'\0';
1479 &device_handle, &handle_info, &service) != HND_DEVICE) {
1488 if (service == NULL || !service->
active ||
@ UPNP_EVENT_SUBSCRIPTION_REQUEST
int(* Upnp_FunPtr)(Upnp_EventType EventType, const void *Event, void *Cookie)
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice(),UpnpRegisterRootDevice2(),...
int http_SendMessage(SOCKINFO *info, int *TimeOut, const char *fmt,...)
Sends a message to the destination based on the format parameter.
SOCKET http_Connect(uri_type *destination_url, uri_type *url)
Gets destination address from URL and then connects to the remote end.
void http_CalcResponseVersion(int request_major_vers, int request_minor_vers, int *response_major_vers, int *response_minor_vers)
Calculate HTTP response versions based on the request versions.
int http_RecvMessage(SOCKINFO *info, http_parser_t *parser, http_method_t request_method, int *timeout_secs, int *http_error_code)
Get the data on the socket and take actions based on the read data to modify the parser objects buffe...
int http_MakeMessage(membuffer *buf, int http_major_version, int http_minor_version, const char *fmt,...)
Generate an HTTP message based on the format that is specified in the input parameters.
http_message_t msg
entire raw message
uri_type uri
Type of a uri, e.g. absolute, relative, etc.
int major_version
Http major version.
#define HDR_NT
Type of a HTTP header.
#define HDR_CALLBACK
Type of a HTTP header.
int minor_version
Http minor version.
#define HDR_TIMEOUT
Type of a HTTP header.
#define HDR_SID
Type of a HTTP header.
Structure of an HTTP parser object.
Structure of an HTTP message.
char * URLs
Dynamic memory for all urls, delimited by <>
hostport_type hostport
Member variable.
uri_type * parsedURLs
parsed URLs
size_t size
Size of the buffer.
token pathquery
Member variable.
sockaddr_storage IPaddress
Network socket address.
constexpr int HTTP_SUCCESS
Yet another success code.
token text
Pointing to the full host:port string representation.
Represents a list of URLs as in the "callback" header of SUBSCRIBE message in GENA.
Represents a URI used in parse_uri and elsewhere.
Buffer used in parsinghttp messages, urls, etc. Generally this simply holds a pointer into a larger a...
#define X_USER_AGENT
Can be overwritten by configure CFLAGS argument.
long ListSize(LinkedList *list)
Returns the size of the list.
void * ListDelNode(LinkedList *list, ListNode *dnode, int freeItem)
Removes a node from the list. The memory for the node is freed.
ListNode * ListHead(LinkedList *list)
Returns the head of the list.
ListNode * ListAddTail(LinkedList *list, void *item)
Adds a node to the tail of the list. Node gets added immediately before list.tail.
int ListInit(LinkedList *list, cmp_routine cmp_func, free_function free_func)
Initializes LinkedList. Must be called first and only once for List.
#define EOUTOFMEM
Error condition for "out of memory".
Linked list node. Stores generic item and pointers to next and prev.
Linked list (no protection).
int ThreadPoolAdd(ThreadPool *tp, ThreadPoolJob *job, int *jobId)
Adds a job to the thread pool.
int TPJobSetFreeFunction(ThreadPoolJob *job, free_routine func)
Sets the jobs free function.
int TPJobSetPriority(ThreadPoolJob *job, ThreadPriority priority)
Sets the priority of the threadpool job.
int TPJobInit(ThreadPoolJob *job, UPnPsdk::start_routine func, void *arg)
Initializes thread pool job.
void(* free_routine)(void *arg)
s_UpnpSubscriptionRequest
Header file for UpnpSubscriptionRequest methods.
PUPNP_Api int UpnpSubscriptionRequest_strcpy_SID(UpnpSubscriptionRequest *p, const char *s)
PUPNP_Api UpnpSubscriptionRequest * UpnpSubscriptionRequest_new(void)
PUPNP_Api void UpnpSubscriptionRequest_delete(UpnpSubscriptionRequest *p)
PUPNP_Api int UpnpSubscriptionRequest_strcpy_UDN(UpnpSubscriptionRequest *p, const char *s)
PUPNP_Api int UpnpSubscriptionRequest_strcpy_ServiceId(UpnpSubscriptionRequest *p, const char *s)
#define GENA_NOTIFICATION_SENDING_TIMEOUT
The GENA_NOTIFICATION_SENDING_TIMEOUT specifies the number of seconds to wait for sending GENA notifi...
#define GENA_NOTIFICATION_ANSWERING_TIMEOUT
The GENA_NOTIFICATION_ANSWERING_TIMEOUT specifies the number of seconds to wait for receiving the ans...
Manage Eventing with GENA, the General Event Notification Architecture.
#define GENA_E_BAD_HANDLE
UpnpDevice_Handle device_handle
#define XML_PROPERTYSET_HEADER
#define GENA_E_NOTIFY_UNACCEPTED
#define GENA_E_NOTIFY_UNACCEPTED_REMOVE_SUB
#define MAX_CONTENT_LENGTH
#define GENA_E_BAD_SERVICE
void error_respond(SOCKINFO *info, int error_code, http_message_t *hmsg)
Sends an error message to the control point in the case of incorrect GENA requests.
void freeSubscriptionQueuedEvents(subscription *sub)
???
void gena_process_subscription_request(SOCKINFO *info, http_message_t *request)
Handles a subscription request from a ctrl point. The socket is not closed on return.
int genaNotifyAll(UpnpDevice_Handle device_handle, char *UDN, char *servId, char **VarNames, char **VarValues, int var_count)
Sends a notification to all the subscribed control points.
void gena_process_unsubscribe_request(SOCKINFO *info, http_message_t *request)
Handles a subscription cancellation request from a ctrl point. The connection is not destroyed on ret...
int genaUnregisterDevice(UpnpDevice_Handle device_handle)
Cleans the service table of the device.
void gena_process_subscription_renewal_request(SOCKINFO *info, http_message_t *request)
Handles a subscription renewal request from a ctrl point. The connection is not destroyed on return.
int gena_validate_delivery_urls(SOCKINFO *info, URL_list *url_list)
Validate that the URLs passed by the user are on the same network segment than the device.
int genaNotifyAllExt(UpnpDevice_Handle device_handle, char *UDN, char *servId, IXML_Document *PropSet)
Sends a notification to all the subscribed control points.
int genaInitNotifyExt(UpnpDevice_Handle device_handle, char *UDN, char *servId, IXML_Document *PropSet, const Upnp_SID sid)
Similar to the genaInitNofity. The only difference is that it takes the xml document for the state ta...
#define STALE_JOBID
Invalid job id.
int genaInitNotify(UpnpDevice_Handle device_handle, char *UDN, char *servId, char **VarNames, char **VarValues, int var_count, const Upnp_SID sid)
Sends the intial state table dump to newly subscribed control point.
Data structure common to all types of nodes.
Data structure representing the DOM Document.
PUPNP_Api DOMString ixmlPrintNode(IXML_Node *doc)
Renders a Node and all sub-elements into an XML text representation.
#define DOMString
The type of DOM strings.
PUPNP_Api void ixmlFreeDOMString(DOMString buf)
Frees a DOMString.
PUPNP_Api DOMString ixmlCloneDOMString(const DOMString src)
Clones an existing DOMString.
http_header_t * httpmsg_find_hdr(http_message_t *msg, int header_name_id, memptr *value)
Finds header from a list, with the given 'name_id'.
void httpmsg_destroy(http_message_t *msg)
Free memory allocated for the http message.
parse_status_t matchstr(char *str, size_t slen, const char *fmt,...)
Matches a variable parameter list with a string and takes actions based on the data type specified.
void membuffer_destroy(membuffer *m)
Free's memory allocated for membuffer* m.
char * str_alloc(const char *str, size_t str_len)
Allocate memory and copy information from the input string to the newly allocated memory.
void membuffer_init(membuffer *m)
Wrapper to membuffer_initialize().
int membuffer_append(membuffer *m, const void *buf, size_t buf_len)
Invokes function to appends data from a constant buffer to the buffer.
int memptr_cmp_nocase(memptr *m, const char *s)
Compares characters of 2 strings irrespective of the case for a specific count of bytes.
size_t size_inc
used to increase size; MUST be > 0; (read/write).
size_t length
length of buffer without terminating null byte (read-only).
char * buf
mem buffer; must not write beyond buf[length-1] (read/write).
size_t length
length of memory (read-only).
char * buf
start of memory (read/write).
pointer to a chunk of memory.
Maintains a block of dynamically allocated memory.
#define UPNP_E_SOCKET_CONNECT
The SDK had a problem connecting to a remote host.
#define UPNP_E_SUCCESS
The operation completed successfully.
#define UPNP_E_OUTOF_MEMORY
Not enough resources are currently available to complete the operation.
#define UPNP_E_INVALID_PARAM
One or more of the parameters passed to the function is not valid.
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 genaInitNotifyCommon(UpnpDevice_Handle device_handle, char *UDN, char *servId, DOMString propertySet, const Upnp_SID sid)
We take ownership of propertySet and will free it.
char * AllocGenaHeaders(const DOMString propertySet)
Allocates the GENA header.
void maybeDiscardEvents(LinkedList *listp)
This gets called before queuing a new event.
int genaNotify(char *headers, char *propertySet, subscription *sub)
Function to Notify a particular subscription of a particular event.
int GeneratePropertySet(char **names, char **values, int count, DOMString *out)
Generates XML property set for notifications.
int genaNotifyAllCommon(UpnpDevice_Handle device_handle, char *UDN, char *servId, DOMString propertySet)
We take ownership of propertySet and will free it.
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.
void free_notify_struct(notify_thread_struct *input)
Frees memory used in notify_threads if the reference count is 0, otherwise decrements the refrence co...
void genaNotifyThread(void *input)
Thread job to Notify a control point.
int create_url_list(memptr *url_list, URL_list *out)
Function to parse the Callback header value in subscription requests.
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 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).
void freeSubscription(subscription *sub)
Free's the memory allocated for storing the URL of the subscription.
void RemoveSubscriptionSID(Upnp_SID sid, service_info *service)
Remove the subscription from the service table and update it.
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.
service_info * FindServiceId(service_table *table, const char *serviceId, const char *UDN)
Traverses through the service table to find a service.
int TotalSubscriptions
Part of Service information.
URL_list DeliveryURLs
Part of subscription.
int active
Part of subscription.
struct subscription * next
Part of subscription.
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.
int ToSendEventKey
Part of subscription.
time_t expireTime
Part of subscription.
int active
Part of Service information.
-brief Service information
int sock_destroy(SOCKINFO *info, int ShutdownMethod)
Shutsdown the socket using the ShutdownMethod to indicate whether sends and receives on the socket wi...
int sock_init(SOCKINFO *info, SOCKET sockfd)
Assign the passed in socket descriptor to socket descriptor in the SOCKINFO structure.
sockaddr_storage foreign_sockaddr
Socket address of the remote node only filled in incoming requests.
Additional socket information for connections and ssl.
Manage "Step 1: Discovery" of the UPnP+™ specification with SSDP.
Unix-specific network utilities.
unsigned gIF_IPV6_ULA_GUA_PREFIX_LENGTH
IPv6 ULA or GUA prefix length. (extern'ed in upnp.h)
Upnp_Handle_Type GetHandleInfo(UpnpClient_Handle Hnd, Handle_Info **HndInfo)
Get handle information.
ThreadPool gSendThreadPool
Send thread pool.
char gIF_IPV6_ULA_GUA[INET6_ADDRSTRLEN]
Static buffer to contain interface IPv6 unique-local or globally-unique address (ULA or GUA)....
Upnp_Handle_Type GetDeviceHandleInfoForPath(const char *path, int AddressFamily, UpnpDevice_Handle *device_handle_out, struct Handle_Info **HndInfo, service_info **serv_info)
Retrieves the device handle and information of the first device of the address family specified,...
unsigned gIF_IPV6_PREFIX_LENGTH
IPv6 LLA prefix length. (extern'ed in upnp.h)
int g_UpnpSdkEQMaxLen
Global variable to determines the maximum number of events.
char gIF_IPV4[INET_ADDRSTRLEN]
Static buffer to contain interface IPv4 address. (extern'ed in upnp.h)
char gIF_IPV4_NETMASK[INET_ADDRSTRLEN]
Static buffer to contain interface IPv4 netmask. (extern'ed in upnp.h)
int g_UpnpSdkEQMaxAge
Global variable to determine the maximum number of seconds which an event can spend on a subscription...
char gIF_IPV6[INET6_ADDRSTRLEN]
Static buffer to contain interface IPv6 link-local address (LLA). (extern'ed in upnp....
Inititalize the compatible library before it can be used.
#define HandleLock()
HandleLock.
service_table ServiceTable
Table holding subscriptions and URL information.
#define UPNP_TIMEOUT
UPNP_TIMEOUT.
#define HandleUnlock()
HandleUnlock.
Upnp_FunPtr Callback
Callback function pointer.
int MaxSubscriptionTimeOut
???
Data to be stored in handle table for Handle Info.
UPnPsdk_VIS void UpnpPrintf(Upnp_LogLevel DLevel, Dbg_Module Module, const char *DbgFileName, int DbgLineNo, const char *FmtStr,...)
Prints the debug statement.
int parse_uri(const char *in, size_t max, uri_type *out)
Parses a uri as defined in RFC 2396 (explaining URIs).
void upnp_uuid_unpack(uuid_upnp *u, char *out)
Unpack a UUID.
int uuid_create(uuid_upnp *uid)
Generate a UUID.