OPAL  Version 3.14.3
rtpconn.h
Go to the documentation of this file.
1 /*
2  * rtpconn.h
3  *
4  * Connection abstraction
5  *
6  * Open Phone Abstraction Library (OPAL)
7  *
8  * Copyright (C) 2007 Post Increment
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Open Phone Abstraction Library.
21  *
22  * The Initial Developer of the Original Code is Post Increment
23  *
24  * Contributor(s): ______________________________________.
25  *
26  * $Revision: 31587 $
27  * $Author: rjongbloed $
28  * $Date: 2014-03-16 11:17:30 +1100 (Sun, 16 Mar 2014) $
29  */
30 
31 #ifndef OPAL_OPAL_RTPCONN_H
32 #define OPAL_OPAL_RTPCONN_H
33 
34 #ifdef P_USE_PRAGMA
35 #pragma interface
36 #endif
37 
38 #include <opal_config.h>
39 
40 #include <opal/connection.h>
41 #include <opal/mediatype.h>
42 #include <opal/mediasession.h>
43 #include <rtp/rtp_session.h>
44 #include <ptlib/bitwise_enum.h>
45 
46 
47 class OpalRTPEndPoint;
48 
49 
54 {
55  PCLASSINFO(OpalRTPConnection, OpalConnection);
56  public:
62  OpalCall & call,
64  const PString & token,
65  unsigned options = 0,
66  OpalConnection::StringOptions * stringOptions = NULL
67  );
68 
72 
90  virtual void OnReleased();
92 
93 
109  const OpalMediaFormat & mediaFormat,
110  unsigned sessionID,
111  PBoolean isSource
112  );
113 
123  virtual bool GetMediaTransportAddresses(
124  OpalConnection & otherConnection,
125  const OpalMediaType & mediaType,
126  OpalTransportAddressArray & transports
127  ) const;
128 
142  virtual void AdjustMediaFormats(
143  bool local,
144  const OpalConnection * otherConnection,
145  OpalMediaFormatList & mediaFormats
146  ) const;
147 
156  virtual void OnPatchMediaStream(
157  PBoolean isSource,
158  OpalMediaPatch & patch
159  );
160 
166  virtual bool OnMediaCommand(
167  OpalMediaStream & stream,
168  const OpalMediaCommand & command
169  );
170 
171  virtual PBoolean SendUserInputTone(
172  char tone,
173  unsigned duration = 0
174  );
176 
177 
182  virtual unsigned GetNextSessionID(
183  const OpalMediaType & mediaType,
184  bool isSource
185  );
186 
187  P_DECLARE_BITWISE_ENUM(CreateMediaSessionsSecurity, 2, (e_NoMediaSessions, e_ClearMediaSession, e_SecureMediaSession));
188 
198  vector<bool> CreateAllMediaSessions(
199  CreateMediaSessionsSecurity security
200  );
201 
207  unsigned sessionId,
208  const OpalMediaType & mediaType,
209  const PString & sessionType = PString::Empty()
210  );
211 
216  unsigned sessionID
217  ) const;
218 
223  const OpalMediaType & mediaType
224  ) const;
225 
230  WORD port
231  ) const;
232 
242  unsigned sessionId,
243  const OpalMediaType & mediaType,
244  const PString & sessionType = PString::Empty()
245  );
246 
249  virtual void ReleaseMediaSession(
250  unsigned sessionID
251  );
252 
258  virtual bool ChangeSessionID(
259  unsigned fromSessionID,
260  unsigned toSessionID
261  );
262 
265  virtual void ReplaceMediaSession(
266  unsigned sessionId,
267  OpalMediaSession * mediaSession
268  );
269 
272  virtual bool SetSessionQoS(
273  OpalRTPSession * session
274  );
276 
296  virtual void DetermineRTPNAT(
297  const OpalTransport & transport,
298  const OpalTransportAddress & signalAddr
299  );
301 
302  class SessionMap : public PSafeDictionary<PKey<unsigned>, OpalMediaSession>
303  {
304  public:
305  void MoveFrom(SessionMap & other);
306  };
307 
308  protected:
309  virtual bool GarbageCollection();
310  PDECLARE_NOTIFIER(OpalRFC2833Info, OpalRTPConnection, OnUserInputInlineRFC2833);
311 
312  virtual bool NoMediaBypass(const OpalConnection & otherConnection, const OpalMediaType & mediaType) const;
313 
314 #if OPAL_RTP_FEC
315  OpalMediaFormatList NegotiateFECMediaFormats(OpalMediaSession & session);
316 #endif
317 
318 
321 
323 #if OPAL_T38_CAPABILITY
324  OpalRFC2833Proto * m_ciscoNSEHandler;
325 #endif
326 
327  P_REMOVE_VIRTUAL(PBoolean,IsRTPNATEnabled(const PIPSocket::Address&,const PIPSocket::Address&,const PIPSocket::Address&,PBoolean),false);
328 };
329 
330 
331 #endif // OPAL_OPAL_RTPCONN_H