This class is responsible for the UPnP Content Directory Service operations. More...
#include <upnp_cds.h>
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< Mutex > | mutex |
| static zmm::Ref < ContentDirectoryService > | instance |
| static bool | singletonActive |
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.
| ContentDirectoryService::ContentDirectoryService | ( | ) |
Constructor for the CDS, saves the service type and service id in internal variables.
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.
| static zmm::Ref<ContentDirectoryService > Singleton< ContentDirectoryService >::getInstance | ( | ) | [inline, static, inherited] |
Definition at line 62 of file singleton.h.
Referenced by ContentDirectoryService(), process_subscription_request(), and upnp_action_Browse().
| 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] |
| void * Object::operator new | ( | size_t | size | ) | [static, inherited] |
| void ContentDirectoryService::process_action_request | ( | zmm::Ref< ActionRequest > | request | ) |
Dispatches the ActionRequest between the available actions.
| 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 | ) |
Processes an incoming SubscriptionRequest.
| request | SubscriptionRequest to be processed by the function. |
Looks at the incoming SubscriptionRequest and accepts the subscription if everything is ok.
Definition at line 45 of file upnp_cds_subscriptions.cc.
References _, zmm::String::c_str(), CFG_SERVER_UDN, Singleton< ConfigManager >::getInstance(), Singleton< Server >::getInstance(), Singleton< ContentDirectoryService >::getInstance(), IXML_SUCCESS, ixmlDocument_free(), ixmlParseBufferEx(), log_debug, NULL, RefCast, serviceID, systemUpdateID, UPNP_E_SUBSCRIPTION_FAILED, UpnpAcceptSubscriptionExt(), and UpnpXML_CreateEventPropertySet().
| virtual void Singleton< ContentDirectoryService >::registerSingleton | ( | ) | [inline, protected, virtual, inherited] |
Definition at line 94 of file singleton.h.
| void Object::release | ( | ) | [inherited] |
Definition at line 66 of file object.cc.
References zmm::Object::_ref_count, atomic_dec(), and zmm::Object::mutex.
Referenced by zmm::ArrayBase::clear(), zmm::String::operator=(), DSOHash< zmm::Array< CacheObject > >::releaseData(), DSBHash< VT >::releaseData(), DSOHash< zmm::Array< CacheObject > >::remove(), zmm::ArrayBase::remove(), zmm::ArrayBase::removeUnordered(), zmm::ArrayBase::set(), zmm::ArrayBase::~ArrayBase(), DSOHash< zmm::Array< CacheObject > >::~DSOHash(), zmm::ObjectQueue< AutoscanDirectory >::~ObjectQueue(), zmm::ObjectStack< Element >::~ObjectStack(), and zmm::String::~String().
| void Object::retain | ( | ) | [inherited] |
Definition at line 58 of file object.cc.
References zmm::Object::_ref_count, atomic_inc(), and zmm::Object::mutex.
Referenced by zmm::ArrayBase::append(), zmm::ObjectQueue< AutoscanDirectory >::enqueue(), zmm::ArrayBase::insert(), zmm::String::operator=(), zmm::ObjectStack< Element >::push(), DSOHash< zmm::Array< CacheObject > >::put(), DSBHash< VT >::put(), zmm::ArrayBase::set(), and zmm::String::String().
| 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.
| 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.
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] |
UPnP standard defined action: Browse().
| request | Incoming ActionRequest. |
Browse(string ObjectID, string BrowseFlag, string Filter, ui4 StartingIndex, ui4 RequestedCount, string SortCriteria, string Result, ui4 NumberReturned, ui4 TotalMatches, ui4 UpdateID)
Definition at line 43 of file upnp_cds_actions.cc.
References _, BROWSE_CONTAINERS, BROWSE_DIRECT_CHILDREN, BROWSE_EXACT_CHILDCOUNT, BROWSE_HIDE_FS_ROOT, BROWSE_ITEMS, BROWSE_TRACK_SORT, CFG_SERVER_EXTOPTS_MARK_PLAYED_ITEMS_ENABLED, CFG_SERVER_EXTOPTS_MARK_PLAYED_ITEMS_STRING, CFG_SERVER_EXTOPTS_MARK_PLAYED_ITEMS_STRING_MODE_PREPEND, CFG_SERVER_HIDE_PC_DIRECTORY, Singleton< ConfigManager >::getInstance(), Singleton< ContentDirectoryService >::getInstance(), log_debug, nil, OBJECT_FLAG_PLAYED, serviceType, stringLimit, systemUpdateID, zmm::String::toInt(), UPNP_DEFAULT_CLASS_MUSIC_ALBUM, UPNP_DEFAULT_CLASS_PLAYLIST_CONTAINER, UPNP_E_NO_SUCH_ID, UPNP_SOAP_E_INVALID_ARGS, UpnpXML_CreateResponse(), UpnpXML_DIDLRenderObject(), XML_DC_NAMESPACE, XML_DC_NAMESPACE_ATTR, XML_DIDL_LITE_NAMESPACE, XML_NAMESPACE_ATTR, XML_UPNP_NAMESPACE, and XML_UPNP_NAMESPACE_ATTR.
Referenced by process_action_request().
| void ContentDirectoryService::upnp_action_GetSearchCapabilities | ( | zmm::Ref< ActionRequest > | request | ) | [protected] |
UPnP standard defined action: GetSearchCapabilities().
| 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().
| 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().
| 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().
mt_atomic_t zmm::Object::_ref_count [protected, inherited] |
Definition at line 54 of file object.h.
Referenced by zmm::Object::getRefCount(), zmm::Object::Object(), zmm::Object::release(), and zmm::Object::retain().
zmm::Ref<ContentDirectoryService > Singleton< ContentDirectoryService >::instance [static, 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] |
ID of the service.
Definition at line 88 of file upnp_cds.h.
Referenced by ContentDirectoryService(), process_subscription_request(), setStaticArgs(), subscription_update(), and ~ContentDirectoryService().
String ContentDirectoryService::serviceType = nil [static, protected] |
UPnP standard defined service type.
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.
int ContentDirectoryService::stringLimit [protected] |
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().
int ContentDirectoryService::systemUpdateID [protected] |
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().
1.6.1