Merge pull request #25959 from neo1973/TagLib_deprecation_warnings
[xbmc.git] / lib / libUPnP / Platinum / Source / Core / PltCtrlPointTask.h
blob15ac8870f3451cbae0d9677f547970e41ec67b9a
1 /*****************************************************************
3 | Platinum - Control Point Tasks
5 | Copyright (c) 2004-2010, Plutinosoft, LLC.
6 | All rights reserved.
7 | http://www.plutinosoft.com
9 | This program is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU General Public License
11 | as published by the Free Software Foundation; either version 2
12 | of the License, or (at your option) any later version.
14 | OEMs, ISVs, VARs and other distributors that combine and
15 | distribute commercially licensed software with Platinum software
16 | and do not wish to distribute the source code for the commercially
17 | licensed software under version 2, or (at your option) any later
18 | version, of the GNU General Public License (the "GPL") must enter
19 | into a commercial license agreement with Plutinosoft, LLC.
20 | licensing@plutinosoft.com
22 | This program is distributed in the hope that it will be useful,
23 | but WITHOUT ANY WARRANTY; without even the implied warranty of
24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 | GNU General Public License for more details.
27 | You should have received a copy of the GNU General Public License
28 | along with this program; see the file LICENSE.txt. If not, write to
29 | the Free Software Foundation, Inc.,
30 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 | http://www.gnu.org/licenses/gpl-2.0.html
33 ****************************************************************/
35 /** @file
36 UPnP ControlPoint Tasks
39 #ifndef _PLT_CONTROL_POINT_TASK_H_
40 #define _PLT_CONTROL_POINT_TASK_H_
42 /*----------------------------------------------------------------------
43 | includes
44 +---------------------------------------------------------------------*/
45 #include "Neptune.h"
46 #include "PltHttpClientTask.h"
47 #include "PltDatagramStream.h"
48 #include "PltDeviceData.h"
49 #include "PltCtrlPoint.h"
51 /*----------------------------------------------------------------------
52 | forward declarations
53 +---------------------------------------------------------------------*/
54 class PLT_Action;
56 /*----------------------------------------------------------------------
57 | PLT_CtrlPointGetDescriptionTask class
58 +---------------------------------------------------------------------*/
59 /**
60 The PLT_CtrlPointGetDescriptionTask class fetches the description xml document
61 from a UPnP device
63 class PLT_CtrlPointGetDescriptionTask : public PLT_HttpClientSocketTask
65 public:
66 PLT_CtrlPointGetDescriptionTask(const NPT_HttpUrl& url,
67 PLT_CtrlPoint* ctrl_point,
68 NPT_TimeInterval leasetime,
69 NPT_String uuid);
70 ~PLT_CtrlPointGetDescriptionTask() override;
72 protected:
73 // PLT_HttpClientSocketTask methods
74 NPT_Result ProcessResponse(NPT_Result res,
75 const NPT_HttpRequest& request,
76 const NPT_HttpRequestContext& context,
77 NPT_HttpResponse* response) override;
79 protected:
80 PLT_CtrlPoint* m_CtrlPoint;
81 NPT_TimeInterval m_LeaseTime;
82 NPT_String m_UUID;
85 /*----------------------------------------------------------------------
86 | PLT_CtrlPointGetSCPDRequest class
87 +---------------------------------------------------------------------*/
88 /**
89 The PLT_CtrlPointGetSCPDRequest class is used by a PLT_CtrlPointGetSCPDsTask task
90 to fetch a specific SCPD xml document for a given service of a given device.
92 class PLT_CtrlPointGetSCPDRequest : public NPT_HttpRequest
94 public:
95 PLT_CtrlPointGetSCPDRequest(PLT_DeviceDataReference& device,
96 const char* url,
97 const char* method = "GET",
98 const char* protocol = NPT_HTTP_PROTOCOL_1_1) : // 1.1 for pipelining
99 NPT_HttpRequest(url, method, protocol), m_Device(device) {}
100 ~PLT_CtrlPointGetSCPDRequest() override {}
102 // members
103 PLT_DeviceDataReference m_Device;
106 /*----------------------------------------------------------------------
107 | PLT_CtrlPointGetSCPDsTask class
108 +---------------------------------------------------------------------*/
110 The PLT_CtrlPointGetSCPDsTask class fetches the SCPD xml document of one or more
111 services for a given device.
113 class PLT_CtrlPointGetSCPDsTask : public PLT_HttpClientSocketTask
115 public:
116 PLT_CtrlPointGetSCPDsTask(PLT_CtrlPoint* ctrl_point, PLT_DeviceDataReference& root_device);
117 ~PLT_CtrlPointGetSCPDsTask() override {}
119 NPT_Result AddSCPDRequest(PLT_CtrlPointGetSCPDRequest* request) {
120 return PLT_HttpClientSocketTask::AddRequest((NPT_HttpRequest*)request);
123 // override to prevent calling this directly
124 NPT_Result AddRequest(NPT_HttpRequest*) override {
125 // only queuing PLT_CtrlPointGetSCPDRequest allowed
126 return NPT_ERROR_NOT_SUPPORTED;
129 protected:
130 // PLT_HttpClientSocketTask methods
131 NPT_Result ProcessResponse(NPT_Result res,
132 const NPT_HttpRequest& request,
133 const NPT_HttpRequestContext& context,
134 NPT_HttpResponse* response) override;
136 protected:
137 PLT_CtrlPoint* m_CtrlPoint;
138 PLT_DeviceDataReference m_RootDevice;
141 /*----------------------------------------------------------------------
142 | PLT_CtrlPointInvokeActionTask class
143 +---------------------------------------------------------------------*/
145 The PLT_CtrlPointInvokeActionTask class is used by a PLT_CtrlPoint to invoke
146 a specific action of a given service for a given device.
148 class PLT_CtrlPointInvokeActionTask : public PLT_HttpClientSocketTask
150 public:
151 PLT_CtrlPointInvokeActionTask(NPT_HttpRequest* request,
152 PLT_CtrlPoint* ctrl_point,
153 PLT_ActionReference& action,
154 void* userdata);
155 ~PLT_CtrlPointInvokeActionTask() override;
157 protected:
158 // PLT_HttpClientSocketTask methods
159 NPT_Result ProcessResponse(NPT_Result res,
160 const NPT_HttpRequest& request,
161 const NPT_HttpRequestContext& context,
162 NPT_HttpResponse* response) override;
164 protected:
165 PLT_CtrlPoint* m_CtrlPoint;
166 PLT_ActionReference m_Action;
167 void* m_Userdata;
170 /*----------------------------------------------------------------------
171 | PLT_CtrlPointHouseKeepingTask class
172 +---------------------------------------------------------------------*/
174 The PLT_CtrlPointHouseKeepingTask class is used by a PLT_CtrlPoint to keep
175 track of expired devices and autmatically renew event subscribers.
177 class PLT_CtrlPointHouseKeepingTask : public PLT_ThreadTask
179 public:
180 PLT_CtrlPointHouseKeepingTask(PLT_CtrlPoint* ctrl_point,
181 NPT_TimeInterval timer = NPT_TimeInterval(5.));
183 protected:
184 ~PLT_CtrlPointHouseKeepingTask() override {}
186 // PLT_ThreadTask methods
187 void DoRun() override;
189 protected:
190 PLT_CtrlPoint* m_CtrlPoint;
191 NPT_TimeInterval m_Timer;
194 /*----------------------------------------------------------------------
195 | PLT_CtrlPointSubscribeEventTask class
196 +---------------------------------------------------------------------*/
198 The PLT_CtrlPointSubscribeEventTask class is used to subscribe, renew or cancel
199 a subscription for a given service of a given device.
201 class PLT_CtrlPointSubscribeEventTask : public PLT_HttpClientSocketTask
203 public:
204 PLT_CtrlPointSubscribeEventTask(NPT_HttpRequest* request,
205 PLT_CtrlPoint* ctrl_point,
206 PLT_DeviceDataReference& device,
207 PLT_Service* service,
208 void* userdata = NULL);
209 ~PLT_CtrlPointSubscribeEventTask() override;
211 protected:
212 // PLT_HttpClientSocketTask methods
213 NPT_Result ProcessResponse(NPT_Result res,
214 const NPT_HttpRequest& request,
215 const NPT_HttpRequestContext& context,
216 NPT_HttpResponse* response) override;
218 protected:
219 PLT_CtrlPoint* m_CtrlPoint;
220 PLT_Service* m_Service;
221 PLT_DeviceDataReference m_Device; // force to keep a reference to device owning m_Service
222 void* m_Userdata;
225 #endif /* _PLT_CONTROL_POINT_TASK_H_ */