ContentDirectoryService Class Reference

This class is responsible for the UPnP Content Directory Service operations. More...

#include <upnp_cds.h>

Inheritance diagram for ContentDirectoryService:
Singleton< ContentDirectoryService > zmm::Object

Public Member Functions

 ContentDirectoryService ()
 Constructor for the CDS, saves the service type and service id in internal variables.
virtual ~ContentDirectoryService ()
void process_action_request (zmm::Ref< ActionRequest > request)
 Dispatches the ActionRequest between the available actions.
void process_subscription_request (zmm::Ref< SubscriptionRequest > request)
 Processes an incoming SubscriptionRequest.
void subscription_update (zmm::String containerUpdateIDs_CSV)
 Sends out an event to all subscribed devices.
void retain ()
void release ()
int getRefCount ()

Static Public Member Functions

static void setStaticArgs (zmm::String serviceType, zmm::String serviceID)
static zmm::Ref
< ContentDirectoryService
getInstance ()
static void * operator new (size_t size)
static void operator delete (void *ptr)

Protected Member Functions

void upnp_action_Browse (zmm::Ref< ActionRequest > request)
 UPnP standard defined action: Browse().
void upnp_action_GetSearchCapabilities (zmm::Ref< ActionRequest > request)
 UPnP standard defined action: GetSearchCapabilities().
void upnp_action_GetSortCapabilities (zmm::Ref< ActionRequest > request)
 UPnP standard defined action: GetSortCapabilities().
void upnp_action_GetSystemUpdateID (zmm::Ref< ActionRequest > request)
 UPnP standard defined action: GetSystemUpdateID().
virtual void init ()
virtual void shutdown ()
virtual void registerSingleton ()

Protected Attributes

int systemUpdateID
 The system update ID indicates changes in the content directory.
int stringLimit
 All strings in the XML will be cut at this length.
mt_atomic_t _ref_count

Static Protected Attributes

static zmm::String serviceType = nil
 UPnP standard defined service type.
static zmm::String serviceID = nil
 ID of the service.
static zmm::Ref< Mutexmutex
static zmm::Ref
< ContentDirectoryService
instance
static bool singletonActive

Detailed Description

This class is responsible for the UPnP Content Directory Service operations.

Handles subscription and action invocation requests for the CDS.

Definition at line 43 of file upnp_cds.h.


Constructor & Destructor Documentation

ContentDirectoryService::ContentDirectoryService (  ) 

Constructor for the CDS, saves the service type and service id in internal variables.

Todo:
Check if it makes sense to use it as it is done now...why not define them as constants?

Definition at line 46 of file upnp_cds.cc.

References _, _Exception, CFG_SERVER_UPNP_TITLE_AND_DESC_STRING_LIMIT, Singleton< ContentDirectoryService >::getInstance(), nil, serviceID, serviceType, stringLimit, and systemUpdateID.

ContentDirectoryService::~ContentDirectoryService (  )  [virtual]

Definition at line 55 of file upnp_cds.cc.

References nil, serviceID, and serviceType.


Member Function Documentation

static zmm::Ref<ContentDirectoryService > Singleton< ContentDirectoryService >::getInstance (  )  [inline, static, inherited]
int Object::getRefCount (  )  [inherited]

Definition at line 78 of file object.cc.

References zmm::Object::_ref_count, and atomic_get().

virtual void Singleton< ContentDirectoryService >::init (  )  [inline, protected, virtual, inherited]

Definition at line 87 of file singleton.h.

void Object::operator delete ( void *  ptr  )  [static, inherited]

Definition at line 87 of file object.cc.

References FREE.

void * Object::operator new ( size_t  size  )  [static, inherited]

Definition at line 83 of file object.cc.

References MALLOC.

void ContentDirectoryService::process_action_request ( zmm::Ref< ActionRequest request  ) 

Dispatches the ActionRequest between the available actions.

Parameters:
request ActionRequest to be processed by the function.

This function looks at the incoming ActionRequest and passes it on to the appropriate action for processing.

Definition at line 180 of file upnp_cds_actions.cc.

References log_debug, upnp_action_Browse(), upnp_action_GetSearchCapabilities(), upnp_action_GetSortCapabilities(), upnp_action_GetSystemUpdateID(), and UPNP_E_INVALID_ACTION.

void ContentDirectoryService::process_subscription_request ( zmm::Ref< SubscriptionRequest request  ) 
virtual void Singleton< ContentDirectoryService >::registerSingleton (  )  [inline, protected, virtual, inherited]

Definition at line 94 of file singleton.h.

void Object::release (  )  [inherited]
void Object::retain (  )  [inherited]
void ContentDirectoryService::setStaticArgs ( zmm::String  serviceType,
zmm::String  serviceID 
) [static]

Definition at line 61 of file upnp_cds.cc.

References serviceID, and serviceType.

Referenced by Server::init().

virtual void Singleton< ContentDirectoryService >::shutdown (  )  [inline, protected, virtual, inherited]

Definition at line 88 of file singleton.h.

void ContentDirectoryService::subscription_update ( zmm::String  containerUpdateIDs_CSV  ) 

Sends out an event to all subscribed devices.

Parameters:
containerUpdateIDs_CSV Comma Separated Value list of container update ID's (as defined in the UPnP CDS specs)

When something in the content directory chagnes, we will send out an event to all subscribed devices. Container updates are supported, and of course the mimimum required - systemUpdateID.

Todo:
add another error code

Definition at line 75 of file upnp_cds_subscriptions.cc.

References _, zmm::String::c_str(), CFG_SERVER_UDN, Singleton< ConfigManager >::getInstance(), Singleton< Server >::getInstance(), IXML_SUCCESS, ixmlDocument_free(), ixmlParseBufferEx(), log_debug, NULL, serviceID, systemUpdateID, UPNP_E_SUBSCRIPTION_FAILED, UpnpNotifyExt(), and UpnpXML_CreateEventPropertySet().

void ContentDirectoryService::upnp_action_Browse ( zmm::Ref< ActionRequest request  )  [protected]
void ContentDirectoryService::upnp_action_GetSearchCapabilities ( zmm::Ref< ActionRequest request  )  [protected]

UPnP standard defined action: GetSearchCapabilities().

Parameters:
request Incoming ActionRequest.

GetSearchCapabilities(string SearchCaps)

Definition at line 141 of file upnp_cds_actions.cc.

References _, log_debug, serviceType, and UpnpXML_CreateResponse().

Referenced by process_action_request().

void ContentDirectoryService::upnp_action_GetSortCapabilities ( zmm::Ref< ActionRequest request  )  [protected]

UPnP standard defined action: GetSortCapabilities().

Parameters:
request Incoming ActionRequest.

GetSortCapabilities(string SortCaps)

Definition at line 154 of file upnp_cds_actions.cc.

References _, log_debug, serviceType, and UpnpXML_CreateResponse().

Referenced by process_action_request().

void ContentDirectoryService::upnp_action_GetSystemUpdateID ( zmm::Ref< ActionRequest request  )  [protected]

UPnP standard defined action: GetSystemUpdateID().

Parameters:
request Incoming ActionRequest.

GetSystemUpdateID(ui4 Id)

Definition at line 167 of file upnp_cds_actions.cc.

References _, log_debug, serviceType, systemUpdateID, and UpnpXML_CreateResponse().

Referenced by process_action_request().


Field Documentation

mt_atomic_t zmm::Object::_ref_count [protected, inherited]

Definition at line 91 of file singleton.h.

zmm::Ref<Mutex> Singleton< ContentDirectoryService >::mutex [static, protected, inherited]

Reimplemented from zmm::Object.

Definition at line 90 of file singleton.h.

String ContentDirectoryService::serviceID = nil [static, protected]
String ContentDirectoryService::serviceType = nil [static, protected]

UPnP standard defined service type.

Todo:
Check if it makes sense to use it as it is done now...why not define constants here?

Definition at line 86 of file upnp_cds.h.

Referenced by ContentDirectoryService(), setStaticArgs(), upnp_action_Browse(), upnp_action_GetSearchCapabilities(), upnp_action_GetSortCapabilities(), upnp_action_GetSystemUpdateID(), and ~ContentDirectoryService().

bool Singleton< ContentDirectoryService >::singletonActive [static, protected, inherited]

Definition at line 92 of file singleton.h.

All strings in the XML will be cut at this length.

Definition at line 56 of file upnp_cds.h.

Referenced by ContentDirectoryService(), and upnp_action_Browse().

The system update ID indicates changes in the content directory.

Whenever something in the content directory changes, the value of systemUpdateID is increased and an event is sent out to all subscribed devices. Also, this variable is returned by the upnp_action_GetSystemUpdateID() action.

Definition at line 53 of file upnp_cds.h.

Referenced by ContentDirectoryService(), process_subscription_request(), subscription_update(), upnp_action_Browse(), and upnp_action_GetSystemUpdateID().


The documentation for this class was generated from the following files:

Generated on Fri Mar 26 20:16:56 2010 for MediaTomb by  doxygen 1.6.1