~vanvugt/ubuntu/oneiric/mediatomb/fix-770964-784431

« back to all changes in this revision

Viewing changes to src/upnp_cds.h

  • Committer: Bazaar Package Importer
  • Author(s): Andres Mejia
  • Date: 2008-02-02 01:42:48 UTC
  • Revision ID: james.westby@ubuntu.com-20080202014248-cjouolddb8gi2zkz
Tags: upstream-0.10.0.dfsg1
ImportĀ upstreamĀ versionĀ 0.10.0.dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*MT*
 
2
    
 
3
    MediaTomb - http://www.mediatomb.cc/
 
4
    
 
5
    upnp_cds.h - this file is part of MediaTomb.
 
6
    
 
7
    Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
 
8
                       Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
 
9
    
 
10
    Copyright (C) 2006-2007 Gena Batyan <bgeradz@mediatomb.cc>,
 
11
                            Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>,
 
12
                            Leonhard Wimmer <leo@mediatomb.cc>
 
13
    
 
14
    MediaTomb is free software; you can redistribute it and/or modify
 
15
    it under the terms of the GNU General Public License version 2
 
16
    as published by the Free Software Foundation.
 
17
    
 
18
    MediaTomb is distributed in the hope that it will be useful,
 
19
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
21
    GNU General Public License for more details.
 
22
    
 
23
    You should have received a copy of the GNU General Public License
 
24
    version 2 along with MediaTomb; if not, write to the Free Software
 
25
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 
26
    
 
27
    $Id: upnp_cds.h 1294 2007-05-13 16:28:24Z lww $
 
28
*/
 
29
 
 
30
/// \file upnp_cds.h
 
31
/// \brief Definition of the ContentDirectoryService class.
 
32
#ifndef __UPNP_CDS_H__
 
33
#define __UPNP_CDS_H__
 
34
 
 
35
#include "common.h"
 
36
#include "singleton.h"
 
37
#include "action_request.h"
 
38
#include "subscription_request.h"
 
39
 
 
40
/// \brief This class is responsible for the UPnP Content Directory Service operations.
 
41
///
 
42
/// Handles subscription and action invocation requests for the CDS.
 
43
class ContentDirectoryService : public Singleton<ContentDirectoryService>
 
44
{
 
45
protected:
 
46
    /// \brief The system update ID indicates changes in the content directory.
 
47
    ///
 
48
    /// Whenever something in the content directory changes, the value of
 
49
    /// systemUpdateID is increased and an event is sent out to all subscribed
 
50
    /// devices.
 
51
    /// Also, this variable is returned by the upnp_action_GetSystemUpdateID()
 
52
    /// action.
 
53
    int systemUpdateID;
 
54
 
 
55
    /// \brief All strings in the XML will be cut at this length.
 
56
    int stringLimit;
 
57
 
 
58
    /// \brief UPnP standard defined action: Browse()
 
59
    /// \param request Incoming ActionRequest.
 
60
    ///
 
61
    /// Browse(string ObjectID, string BrowseFlag, string Filter, ui4 StartingIndex, 
 
62
    /// ui4 RequestedCount, string SortCriteria, string Result, ui4 NumberReturned, 
 
63
    /// ui4 TotalMatches, ui4 UpdateID)
 
64
    void upnp_action_Browse(zmm::Ref<ActionRequest> request);
 
65
 
 
66
    /// \brief UPnP standard defined action: GetSearchCapabilities()
 
67
    /// \param request Incoming ActionRequest.
 
68
    ///
 
69
    /// GetSearchCapabilities(string SearchCaps)
 
70
    void upnp_action_GetSearchCapabilities(zmm::Ref<ActionRequest> request);
 
71
 
 
72
    /// \brief UPnP standard defined action: GetSortCapabilities() 
 
73
    /// \param request Incoming ActionRequest.
 
74
    ///
 
75
    /// GetSortCapabilities(string SortCaps)
 
76
    void upnp_action_GetSortCapabilities(zmm::Ref<ActionRequest> request);
 
77
 
 
78
    /// \brief UPnP standard defined action: GetSystemUpdateID()
 
79
    /// \param request Incoming ActionRequest.
 
80
    ///
 
81
    /// GetSystemUpdateID(ui4 Id)
 
82
    void upnp_action_GetSystemUpdateID(zmm::Ref<ActionRequest> request);
 
83
    
 
84
    /// \brief UPnP standard defined service type
 
85
    /// \todo Check if it makes sense to use it as it is done now...why not define constants here?
 
86
    static zmm::String serviceType;
 
87
    /// \brief ID of the service.
 
88
    static zmm::String serviceID;
 
89
    
 
90
public:
 
91
    /// \brief Constructor for the CDS, saves the service type and service id
 
92
    /// in internal variables.
 
93
    /// \todo Check if it makes sense to use it as it is done now...why not define them as constants?
 
94
    ContentDirectoryService();
 
95
    virtual ~ContentDirectoryService();
 
96
    
 
97
    static void setStaticArgs(zmm::String serviceType, zmm::String serviceID);
 
98
    
 
99
    /// \brief Dispatches the ActionRequest between the available actions.
 
100
    /// \param request ActionRequest to be processed by the function.
 
101
    ///
 
102
    /// This function looks at the incoming ActionRequest and passes it on
 
103
    /// to the appropriate action for processing.
 
104
    void process_action_request(zmm::Ref<ActionRequest> request);
 
105
    
 
106
    /// \brief Processes an incoming SubscriptionRequest.
 
107
    /// \param request SubscriptionRequest to be processed by the function.
 
108
    ///
 
109
    /// Looks at the incoming SubscriptionRequest and accepts the subscription
 
110
    /// if everything is ok.
 
111
    void process_subscription_request(zmm::Ref<SubscriptionRequest> request);
 
112
    
 
113
    /// \brief Sends out an event to all subscribed devices.
 
114
    /// \param containerUpdateIDs_CSV Comma Separated Value list of container update ID's (as defined in the UPnP CDS specs)
 
115
    /// 
 
116
    /// When something in the content directory chagnes, we will send out
 
117
    /// an event to all subscribed devices. Container updates are supported,
 
118
    /// and of course the mimimum required - systemUpdateID.
 
119
    void subscription_update(zmm::String containerUpdateIDs_CSV);
 
120
};
 
121
 
 
122
#endif // __UPNP_CDS_H__