Merge pull request #26220 from 78andyp/blurayfixes
[xbmc.git] / lib / libUPnP / Platinum / Source / Core / PltUPnP.h
blob7822bf3458f02d2fa985dbbdef94accbf733baed
1 /*****************************************************************
3 | Platinum - UPnP Engine
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 Devices and ControlPoints Manager
39 #ifndef _PLT_UPNP_H_
40 #define _PLT_UPNP_H_
42 /*----------------------------------------------------------------------
43 | includes
44 +---------------------------------------------------------------------*/
45 #include "PltTaskManager.h"
46 #include "PltCtrlPoint.h"
47 #include "PltDeviceHost.h"
48 #include "PltUtilities.h"
50 /*----------------------------------------------------------------------
51 | constants
52 +---------------------------------------------------------------------*/
53 #define PLT_DLNA_SSDP_DELAY 0.05f
54 #define PLT_DLNA_SSDP_DELAY_GROUP 0.2f
56 /*----------------------------------------------------------------------
57 | forward definitions
58 +---------------------------------------------------------------------*/
59 class PLT_SsdpListenTask;
61 /*----------------------------------------------------------------------
62 | PLT_UPnP class
63 +---------------------------------------------------------------------*/
64 /**
65 The PLT_UPnP class maintains a list of devices (PLT_DeviceHost) to advertise and/or
66 control points (PLT_CtrlPoint).
68 class PLT_UPnP
70 public:
71 /**
72 Create a UPnP instance.
74 PLT_UPnP();
75 ~PLT_UPnP();
77 /**
78 Add and start a device inside this UPnP context.
79 @param device device to start.
81 NPT_Result AddDevice(PLT_DeviceHostReference& device);
83 /**
84 Add and start a control point inside this UPnP context.
85 @param ctrlpoint control point to start.
87 NPT_Result AddCtrlPoint(PLT_CtrlPointReference& ctrlpoint);
89 /**
90 Remove an existing device from this UPnP context.
91 @param device device to stop.
93 NPT_Result RemoveDevice(PLT_DeviceHostReference& device);
95 /**
96 Remove an existing control point from this UPnP context.
97 @param ctrlpoint control point to stop.
99 NPT_Result RemoveCtrlPoint(PLT_CtrlPointReference& ctrlpoint);
102 Start the UPnP context and all existing devices and control points
103 associated with it.
105 NPT_Result Start();
108 Stop the UPnP context and all existing devices and control points
109 associated with it.
111 NPT_Result Stop();
114 Return the UPnP Engine state.
115 @return True if the UPnP engine is running.
117 bool IsRunning() { return m_Started; }
120 When a device and a control point are added to the same UPnP context, it is
121 desired that the device be not discovered by the control point. For example when
122 creating a combo UPnP Renderer/CtrlPoint. This methods tells the control point
123 to ignore devices associated with the same UPnP context.
124 @param ignore boolean to ignore devices in context
126 void SetIgnoreLocalUUIDs(bool ignore) { m_IgnoreLocalUUIDs = ignore; }
128 private:
129 // members
130 NPT_Mutex m_Lock;
131 NPT_List<PLT_DeviceHostReference> m_Devices;
132 NPT_List<PLT_CtrlPointReference> m_CtrlPoints;
133 NPT_Reference<PLT_TaskManager> m_TaskManager;
135 // Since we can only have one socket listening on port 1900,
136 // we create it in here and we will attach every control points
137 // and devices to it when they're added
138 bool m_Started;
139 PLT_SsdpListenTask* m_SsdpListenTask;
140 bool m_IgnoreLocalUUIDs;
143 #endif /* _PLT_UPNP_H_ */