UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
gena_ctrlpt.cpp File Reference

Manage GENA control point. More...

#include <gena.hpp>
#include <httpreadwrite.hpp>
#include <parsetools.hpp>
#include <statcodes.hpp>
#include <upnpapi.hpp>
#include <uuid.hpp>
+ Include dependency graph for gena_ctrlpt.cpp:

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.
 

Detailed Description

Manage GENA control point.

Definition in file gena_ctrlpt.cpp.


Class Documentation

◆ job_arg

struct job_arg

job_arg

Definition at line 377 of file upnpapi.cpp.

+ Collaboration diagram for job_arg:
Class Members
struct job_arg.advertise advertise advertise
struct UpnpNonblockParam action UpnpNonblockParam.
int handle
int eventId
void * Event

Function Documentation

◆ clientSubscribeMutexInit()

int clientSubscribeMutexInit ( )

Initialize the client subsribe mutex.

Definition at line 415 of file gena_ctrlpt.cpp.

+ Here is the caller graph for this function:

◆ clientSubscribeMutexDestroy()

int clientSubscribeMutexDestroy ( )

Destroy the client subsribe mutex.

Definition at line 427 of file gena_ctrlpt.cpp.

+ Here is the caller graph for this function:

◆ genaUnregisterClient()

int genaUnregisterClient ( UpnpClient_Handle  client_handle)

Unsubcribes all the outstanding subscriptions and cleans the subscription list.

This function is called when control point unregisters.

Returns
UPNP_E_SUCCESS if successful, otherwise returns the appropriate error code.
Parameters
[in]client_handleHandle containing all the control point related information.

Definition at line 431 of file gena_ctrlpt.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ genaUnSubscribe()

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.

Returns
UPNP_E_SUCCESS if service response is OK, otherwise returns the appropriate error code.
Parameters
[in]client_handleUPnP client handle.
[in]in_sidThe subscription ID.

Definition at line 472 of file gena_ctrlpt.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ genaSubscribe()

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.

Returns
UPNP_E_SUCCESS if service response is OK, otherwise returns the appropriate error code
Parameters
[in]client_handleThe client handle.
[in]PublisherURLOf the form: "http://134.134.156.80:4000/RedBulb/Event"
[in,out]TimeOutrequested Duration:
  • if -1, then "infinite".
  • in the OUT case: actual Duration granted by Service, -1 for infinite.
[out]out_sidsid of subscription, memory passed in by caller.

Definition at line 517 of file gena_ctrlpt.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ genaRenewSubscription()

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.

Returns
UPNP_E_SUCCESS if service response is OK, otherwise the appropriate error code.
Parameters
[in]client_handleClient handle.
[in]in_sidSubscription ID.
[in,out]TimeOutrequested 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.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gena_process_notification_event()

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

Note
called by genacallback()
Parameters
[in]infoSocket info of the device.
[in]eventThe http message contains the GENA notification.

Definition at line 705 of file gena_ctrlpt.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: