Manage GENA control point. More...
#include <gena.hpp>
#include <httpreadwrite.hpp>
#include <parsetools.hpp>
#include <statcodes.hpp>
#include <upnpapi.hpp>
#include <uuid.hpp>
Go to the source code of this file.
Classes | |
struct | job_arg |
job_arg More... | |
Functions | |
void | anonymous_namespace{gena_ctrlpt.cpp}::free_subscribe_arg (job_arg *arg) |
Free memory associated with job's argument. | |
void | anonymous_namespace{gena_ctrlpt.cpp}::GenaAutoRenewSubscription (void *input) |
This is a thread function to send the renewal just before the subscription times out. | |
int | anonymous_namespace{gena_ctrlpt.cpp}::ScheduleGenaAutoRenew (int client_handle, int TimeOut, GenlibClientSubscription *sub) |
Schedules a job to renew the subscription just before time out. | |
int | anonymous_namespace{gena_ctrlpt.cpp}::gena_unsubscribe (const UpnpString *url, const UpnpString *sid, http_parser_t *response) |
Sends the UNSUBCRIBE gena request and recieves the response from the device and returns it as a parameter. | |
int | anonymous_namespace{gena_ctrlpt.cpp}::gena_subscribe (const UpnpString *url, int *timeout, const UpnpString *renewal_sid, UpnpString *sid) |
Subscribes or renew subscription. | |
int | clientSubscribeMutexInit () |
Initialize the client subsribe mutex. | |
int | clientSubscribeMutexDestroy () |
Destroy the client subsribe mutex. | |
int | genaUnregisterClient (UpnpClient_Handle client_handle) |
Unsubcribes all the outstanding subscriptions and cleans the subscription list. | |
int | genaUnSubscribe (UpnpClient_Handle client_handle, const UpnpString *in_sid) |
Unsubscribes a SID. | |
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). | |
int | genaRenewSubscription (UpnpClient_Handle client_handle, const UpnpString *in_sid, int *TimeOut) |
Renews a SID. | |
void | gena_process_notification_event (SOCKINFO *info, http_message_t *event) |
This function processes NOTIFY events that are sent by devices. | |
Variables | |
pthread_mutex_t | anonymous_namespace{gena_ctrlpt.cpp}::ctrlpntSubscribe_mutex {} |
Mutex to synchronize the subscription handling at the control point side. | |
Manage GENA control point.
Definition in file gena_ctrlpt.cpp.
struct job_arg |
Definition at line 377 of file upnpapi.cpp.
Class Members | ||
---|---|---|
struct job_arg.advertise | advertise | advertise |
struct UpnpNonblockParam | action | UpnpNonblockParam. |
int | handle | |
int | eventId | |
void * | Event |
int clientSubscribeMutexInit | ( | ) |
Initialize the client subsribe mutex.
Definition at line 415 of file gena_ctrlpt.cpp.
int clientSubscribeMutexDestroy | ( | ) |
Destroy the client subsribe mutex.
Definition at line 427 of file gena_ctrlpt.cpp.
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. |
Definition at line 431 of file gena_ctrlpt.cpp.
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. |
Definition at line 472 of file gena_ctrlpt.cpp.
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" |
[in,out] | TimeOut | requested Duration:
|
[out] | out_sid | sid of subscription, memory passed in by caller. |
Definition at line 517 of file gena_ctrlpt.cpp.
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. |
Definition at line 614 of file gena_ctrlpt.cpp.
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. |
Definition at line 705 of file gena_ctrlpt.cpp.