Manage GENA Devices. More...
#include <assert.h>
#include <gena.hpp>
#include <httpreadwrite.hpp>
#include <parsetools.hpp>
#include <ssdp_common.hpp>
#include <statcodes.hpp>
#include <unixutil.hpp>
#include <upnpapi.hpp>
#include <uuid.hpp>
#include <UpnpSubscriptionRequest.hpp>
#include <webserver.hpp>
Go to the source code of this file.
Macros | |
#define | STALE_JOBID (INVALID_JOB_ID - 1) |
Invalid job id. | |
Functions | |
int | anonymous_namespace{gena_device.cpp}::GeneratePropertySet (char **names, char **values, int count, DOMString *out) |
Generates XML property set for notifications. | |
void | anonymous_namespace{gena_device.cpp}::free_notify_struct (notify_thread_struct *input) |
Frees memory used in notify_threads if the reference count is 0, otherwise decrements the refrence count. | |
int | anonymous_namespace{gena_device.cpp}::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. | |
int | anonymous_namespace{gena_device.cpp}::genaNotify (char *headers, char *propertySet, subscription *sub) |
Function to Notify a particular subscription of a particular event. | |
void | anonymous_namespace{gena_device.cpp}::genaNotifyThread (void *input) |
Thread job to Notify a control point. | |
char * | anonymous_namespace{gena_device.cpp}::AllocGenaHeaders (const DOMString propertySet) |
Allocates the GENA header. | |
int | anonymous_namespace{gena_device.cpp}::genaInitNotifyCommon (UpnpDevice_Handle device_handle, char *UDN, char *servId, DOMString propertySet, const Upnp_SID sid) |
We take ownership of propertySet and will free it. | |
void | anonymous_namespace{gena_device.cpp}::maybeDiscardEvents (LinkedList *listp) |
This gets called before queuing a new event. | |
int | anonymous_namespace{gena_device.cpp}::genaNotifyAllCommon (UpnpDevice_Handle device_handle, char *UDN, char *servId, DOMString propertySet) |
We take ownership of propertySet and will free it. | |
int | anonymous_namespace{gena_device.cpp}::respond_ok (SOCKINFO *info, int time_out, subscription *sub, http_message_t *request) |
Returns OK message in the case of a subscription request. | |
int | anonymous_namespace{gena_device.cpp}::create_url_list (memptr *url_list, URL_list *out) |
Function to parse the Callback header value in subscription requests. | |
int | genaUnregisterDevice (UpnpDevice_Handle device_handle) |
Cleans the service table of the device. | |
void | freeSubscriptionQueuedEvents (subscription *sub) |
??? | |
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. | |
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 table and sends the intial state table dump to newly subscribed control point. | |
int | genaNotifyAllExt (UpnpDevice_Handle device_handle, char *UDN, char *servId, IXML_Document *PropSet) |
Sends a notification to all the subscribed control points. | |
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. | |
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. | |
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. | |
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. | |
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 return. | |
Manage GENA Devices.
Definition in file gena_device.cpp.
#define STALE_JOBID (INVALID_JOB_ID - 1) |
Invalid job id.
Definition at line 53 of file gena_device.cpp.
int genaUnregisterDevice | ( | UpnpDevice_Handle | device_handle | ) |
Cleans the service table of the device.
[in] | device_handle | Handle of the root device |
Definition at line 887 of file gena_device.cpp.
void freeSubscriptionQueuedEvents | ( | subscription * | sub | ) |
???
Definition at line 905 of file gena_device.cpp.
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.
[in] | device_handle | Device handle. |
[in] | UDN | Device udn. |
[in] | servId | Service ID. |
[in] | VarNames | Array of variable names. |
[in] | VarValues | Array of variable values. |
[in] | var_count | Array size. |
[in] | sid | Subscription ID. |
Definition at line 928 of file gena_device.cpp.
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 table and sends the intial state table dump to newly subscribed control point.
[in] | device_handle | Device handle. |
[in] | UDN | Device udn. |
[in] | servId | Service ID. |
[in] | PropSet | Document of the state table. |
[in] | sid | subscription ID. |
Definition at line 962 of file gena_device.cpp.
int genaNotifyAllExt | ( | UpnpDevice_Handle | device_handle, |
char * | UDN, | ||
char * | servId, | ||
IXML_Document * | PropSet | ||
) |
Sends a notification to all the subscribed control points.
[in] | device_handle | Device handle. |
[in] | UDN | Device udn. |
[in] | servId | Service ID. |
[in] | PropSet | XML document Event varible property set. |
Definition at line 997 of file gena_device.cpp.
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.
[in] | device_handle | Device handle. |
[in] | UDN | Device udn. |
[in] | servId | Service ID. |
[in] | VarNames | Array of varible names. |
[in] | VarValues | Array of variable values. |
[in] | var_count | Number of variables. |
Definition at line 1026 of file gena_device.cpp.
Validate that the URLs passed by the user are on the same network segment than the device.
Note: This is a fix for CallStanger a.k.a. CVE-2020-12695
[in] | info | . |
[in] | url_list | . |
Definition at line 1061 of file gena_device.cpp.
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.
[in] | info | Socket info of the device. |
[in] | request | Subscription request from the control point. |
Definition at line 1148 of file gena_device.cpp.
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.
[in] | info | Socket info of the device. |
[in] | request | Subscription renewal request from the control point. |
Definition at line 1340 of file gena_device.cpp.
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 return.
[in] | info | Socket info of the device. |
[in] | request | UNSUBSCRIBE request from the control point. |
Definition at line 1443 of file gena_device.cpp.