OPAL  Version 3.18.8
sdphttpep.h
Go to the documentation of this file.
1 /*
2  * sdpep.h
3  *
4  * Open Phone Abstraction Library (OPAL)
5  *
6  * Copyright (C) 2014 Vox Lucida Pty. Ltd.
7  *
8  * The contents of this file are subject to the Mozilla Public License
9  * Version 1.0 (the "License"); you may not use this file except in
10  * compliance with the License. You may obtain a copy of the License at
11  * http://www.mozilla.org/MPL/
12  *
13  * Software distributed under the License is distributed on an "AS IS"
14  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15  * the License for the specific language governing rights and limitations
16  * under the License.
17  *
18  * The Original Code is Open Phone Abstraction Library.
19  *
20  * The Initial Developer of the Original Code is Post Increment
21  *
22  * Contributor(s): ______________________________________.
23  */
24 
25 #ifndef OPAL_OPAL_SDPHTTPEP_H
26 #define OPAL_OPAL_SDPHTTPEP_H
27 
28 #ifdef P_USE_PRAGMA
29 #pragma interface
30 #endif
31 
32 #include <opal_config.h>
33 
34 
35 #if OPAL_SDP_HTTP
36 
37 #include <sdp/sdpep.h>
38 #include <opal.h>
39 
40 
43 class OpalSDPHTTPEndPoint : public OpalSDPEndPoint
44 {
45  PCLASSINFO(OpalSDPHTTPEndPoint, OpalSDPEndPoint);
46  public:
47  enum
48  {
49  DefaultPort = 5080,
50  DefaultSecurePort = 5081
51  };
52 
57  OpalSDPHTTPEndPoint(
58  OpalManager & manager,
59  const PCaselessString & prefix = OPAL_PREFIX_SDP
60  );
61 
64  ~OpalSDPHTTPEndPoint();
66 
75  virtual PString GetDefaultTransport() const;
76 
79  virtual WORD GetDefaultSignalPort() const;
80 
83  virtual void NewIncomingConnection(
84  OpalListener & listener,
85  const OpalTransportPtr & transport
86  );
87 
117  virtual PSafePtr<OpalConnection> MakeConnection(
118  OpalCall & call,
119  const PString & party,
120  void * userData,
121  unsigned int options,
122  OpalConnection::StringOptions * stringOptions
123  );
125 
131  virtual OpalSDPHTTPConnection * CreateConnection(
132  OpalCall & call,
133  void * userData,
134  unsigned options,
135  OpalConnection::StringOptions * stringOptions
136  );
137 
139  virtual bool OnReceivedHTTP(
140  PHTTPServer & server,
141  const PHTTPConnectionInfo & conInfo
142  );
144 
145  protected:
146  PHTTPSpace m_httpSpace;
147 };
148 
149 
151 
155 class OpalSDPHTTPResource : public PHTTPResource
156 {
157  PCLASSINFO(OpalSDPHTTPResource, PHTTPResource)
158  public:
159  OpalSDPHTTPResource(
160  OpalSDPHTTPEndPoint & ep,
161  const PURL & url
162  );
163  OpalSDPHTTPResource(
164  OpalSDPHTTPEndPoint & ep,
165  const PURL & url,
166  const PHTTPAuthority & auth
167  );
168 
169  virtual bool OnGET(
170  PHTTPServer & server,
171  const PHTTPConnectionInfo & conInfo
172  );
173  virtual bool OnPOST(
174  PHTTPServer & server,
175  const PHTTPConnectionInfo & conInfo
176  );
177 
178  protected:
179  OpalSDPHTTPEndPoint & m_endpoint;
180 };
181 
182 
184 
187 class OpalSDPHTTPConnection : public OpalSDPConnection
188 {
189  PCLASSINFO(OpalSDPHTTPConnection, OpalSDPConnection);
190  public:
195  OpalSDPHTTPConnection(
196  OpalCall & call,
197  OpalSDPHTTPEndPoint & endpoint,
198  unsigned options = 0,
199  OpalConnection::StringOptions * stringOptions = NULL
200  );
201 
204  ~OpalSDPHTTPConnection();
206 
216  virtual PBoolean SetUpConnection();
217 
228  virtual PBoolean SetConnected();
229 
247  virtual void OnReleased();
248 
257  virtual PString GetDestinationAddress();
258 
260  virtual PString GetMediaInterface();
261 
263  virtual OpalTransportAddress GetRemoteMediaAddress();
265 
268  virtual bool OnReceivedHTTP(
270  PHTTPServer & server,
271  const PHTTPConnectionInfo & conInfo
272  );
274 
275  protected:
276  void InternalSetMediaAddresses(PIndirectChannel & channel);
277 
278  PString m_destination;
279  PString m_mediaInterface;
280  OpalTransportAddress m_remoteAddress;
281  SDPSessionDescription * m_offerSDP;
282  SDPSessionDescription * m_answerSDP;
283  PSyncPoint m_connected;
284 
285  friend class OpalSDPHTTPEndPoint;
286 };
287 
288 #endif // OPAL_SDP_HTTP
289 
290 #endif // OPAL_OPAL_SDPHTTPEP_H
Definition: manager.h:150
#define OPAL_PREFIX_SDP
SDP over HTTP (e.g. for WebRTC) supported string for OpalInitialise()
Definition: opal.h:349
This file contains a simplified API to the OPAL system. It provides a pure &quot;C&quot; language interface as ...
Definition: transports.h:411
Definition: connection.h:530
Definition: call.h:62
PSafePtr< OpalTransport > OpalTransportPtr
Definition: transports.h:50
Definition: transports.h:151