|
libUPnP
1.8.4
|
#include "config.h"#include "EventSubscribe.h"#include "gena.h"#include "httpparser.h"#include "httpreadwrite.h"#include "parsetools.h"#include "statcodes.h"#include "sysdep.h"#include "uuid.h"#include "upnpapi.h"
Functions | |
| static void | GenaAutoRenewSubscription (IN void *input) |
| This is a thread function to send the renewal just before the subscription times out. More... | |
| static int | ScheduleGenaAutoRenew (IN int client_handle, IN int TimeOut, IN GenlibClientSubscription *sub) |
| Schedules a job to renew the subscription just before time out. More... | |
| static int | gena_unsubscribe (IN const UpnpString *url, IN const UpnpString *sid, OUT http_parser_t *response) |
| Sends the UNSUBCRIBE gena request and recieves the response from the device and returns it as a parameter. More... | |
| static int | gena_subscribe (IN const UpnpString *url, INOUT int *timeout, IN const UpnpString *renewal_sid, OUT UpnpString *sid) |
| Subscribes or renew subscription. More... | |
| int | genaUnregisterClient (UpnpClient_Handle client_handle) |
| Unsubcribes all the outstanding subscriptions and cleans the subscription list. More... | |
| int | genaUnSubscribe (UpnpClient_Handle client_handle, const UpnpString *in_sid) |
| Unsubscribes a SID. More... | |
| int | genaSubscribe (UpnpClient_Handle client_handle, const UpnpString *PublisherURL, int *TimeOut, UpnpString *out_sid) |
| This function subscribes to a PublisherURL (also mentioned as EventURL in some places). More... | |
| int | genaRenewSubscription (UpnpClient_Handle client_handle, const UpnpString *in_sid, int *TimeOut) |
| Renews a SID. More... | |
| void | gena_process_notification_event (SOCKINFO *info, http_message_t *event) |
| This function processes NOTIFY events that are sent by devices. More... | |
Variables | |
| ithread_mutex_t | GlobalClientSubscribeMutex |
| void gena_process_notification_event | ( | SOCKINFO * | info, |
| http_message_t * | event | ||
| ) |
This function processes NOTIFY events that are sent by devices.
Parameters: IN SOCKINFO *info: Socket structure containing the device socket information IN http_message_t *event: The http message contains the GENA notification
| [in] | info | Socket info of the device. |
| [in] | event | The http message contains the GENA notification. |
|
static |
Subscribes or renew subscription.
| [in] | url | URL of service to subscribe. |
| [in,out] | timeout | Subscription time desired (in secs). |
| [in] | renewal_sid | for renewal, this contains a currently held subscription SID. For first time subscription, this must be NULL. |
| [out] | sid | SID returned by the subscription or renew msg. |
|
static |
Sends the UNSUBCRIBE gena request and recieves the response from the device and returns it as a parameter.
| [in] | url | Event URL of the service. |
| [in] | sid | The subcription ID. |
| [out] | response | The UNSUBCRIBE response from the device. |
|
static |
This is a thread function to send the renewal just before the subscription times out.
| [in] | input | Thread data(upnp_timeout *) needed to send the renewal. |
| int genaRenewSubscription | ( | UpnpClient_Handle | client_handle, |
| const UpnpString * | in_sid, | ||
| int * | TimeOut | ||
| ) |
Renews a SID.
It first validates the SID and client_handle and copies the subscription. It sends RENEW (modified SUBSCRIBE) http request to service and processes the response.
| [in] | client_handle | Client handle. |
| [in] | in_sid | Subscription ID. |
| [in,out] | TimeOut | requested Duration, if -1, then "infinite". In the OUT case: actual Duration granted by Service, -1 for infinite. |
| int genaSubscribe | ( | UpnpClient_Handle | client_handle, |
| const UpnpString * | PublisherURL, | ||
| int * | TimeOut, | ||
| UpnpString * | out_sid | ||
| ) |
This function subscribes to a PublisherURL (also mentioned as EventURL in some places).
It sends SUBSCRIBE http request to service processes request. Finally adds a Subscription to the clients subscription list, if service responds with OK.
| [in] | client_handle | The client handle. |
| [in] | PublisherURL | Of the form: "http://134.134.156.80:4000/RedBulb/Event @param[in,out] TimeOut requested Duration:
\li if -1, then "infinite".
|
| [out] | out_sid | sid of subscription, memory passed in by caller. |
| int genaUnregisterClient | ( | UpnpClient_Handle | client_handle | ) |
Unsubcribes all the outstanding subscriptions and cleans the subscription list.
This function is called when control point unregisters.
| [in] | client_handle | Handle containing all the control point related information. |
References TRUE, and UPNP_E_SUCCESS.
| int genaUnSubscribe | ( | UpnpClient_Handle | client_handle, |
| const UpnpString * | in_sid | ||
| ) |
Unsubscribes a SID.
It first validates the SID and client_handle,copies the subscription, sends UNSUBSCRIBE http request to service processes request and finally removes the subscription.
| [in] | client_handle | UPnP client handle. |
| [in] | in_sid | The subscription ID. |
|
static |
Schedules a job to renew the subscription just before time out.
| [in] | client_handle | Handle that also contains the subscription list. |
| [in] | TimeOut | The time out value of the subscription. |
| [in] | sub | Subscription being renewed. |
1.8.13