OPAL  Version 3.14.3
h460_std24.h
Go to the documentation of this file.
1 /*
2  * h460_std24.h
3  *
4  * Copyright (c) 2009 ISVO (Asia) Pte Ltd. All Rights Reserved.
5  *
6  * The contents of this file are subject to the Mozilla Public License
7  * Version 1.1 (the "License"); you may not use this file except in
8  * compliance with the License. You may obtain a copy of the License at
9  * http://www.mozilla.org/MPL/
10  *
11  * Alternatively, the contents of this file may be used under the terms
12  * of the General Public License (the "GNU License"), in which case the
13  * provisions of GNU License are applicable instead of those
14  * above. If you wish to allow use of your version of this file only
15  * under the terms of the GNU License and not to allow others to use
16  * your version of this file under the MPL, indicate your decision by
17  * deleting the provisions above and replace them with the notice and
18  * other provisions required by the GNU License. If you do not delete
19  * the provisions above, a recipient may use your version of this file
20  * under either the MPL or the GNU License."
21  *
22  * Software distributed under the License is distributed on an "AS IS"
23  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
24  * the License for the specific language governing rights and limitations
25  * under the License.
26  *
27  * The Original Code is derived from and used in conjunction with the
28  * H323Plus Project (www.h323plus.org/)
29  *
30  * The Initial Developer of the Original Code is ISVO (Asia) Pte Ltd.
31  *
32  * Contributor(s): Many thanks to Simon Horne.
33  * Robert Jongbloed (robertj@voxlucida.com.au).
34  *
35  * $Revision: 31399 $
36  * $Author: rjongbloed $
37  * $Date: 2014-02-07 16:34:04 +1100 (Fri, 07 Feb 2014) $
38  */
39 
40 #ifndef OPAL_H460_STD24_H
41 #define OPAL_H460_STD24_H
42 
43 #include <opal_config.h>
44 
45 #if OPAL_H460_24
46 
47 #include <h460/h4601.h>
48 #include <rtp/rtp_session.h>
49 #include <ptclib/pstun.h>
50 
51 
52 #if _MSC_VER
53 #pragma once
54 #endif
55 
56 
57 class PSTUNClient;
58 
59 
60 class PNatMethod_H46024 : public PSTUNClient
61 {
62  PCLASSINFO(PNatMethod_H46024, PSTUNClient);
63  public:
64  enum
65  {
66  DefaultPriority = 10
67  };
68  PNatMethod_H46024(unsigned priority = DefaultPriority);
69 
70  static const char * MethodName();
71  virtual PCaselessString GetMethodName() const;
72 
73  virtual bool IsAvailable(const PIPSocket::Address & binding, PObject * context);
74 };
75 
76 
78 
79 class H460_FeatureStd24 : public H460_Feature
80 {
81  PCLASSINFO_WITH_CLONE(H460_FeatureStd24, H460_Feature);
82  public:
83  H460_FeatureStd24();
84 
85  static const H460_FeatureID & ID();
86  virtual bool Initialise(H323EndPoint & ep, H323Connection * con);
87 
89  enum MediaStrategyIndicator
90  {
91  e_Unknown,
92  e_NoAssist,
93  e_LocalMediaMaster,
94  e_RemoteMediaMaster,
95  e_LocalProxy,
96  e_RemoteProxy,
97  e_FullProxy,
98  e_ProbeSameNAT, // Annex A
99  e_ProbeExternalNAT, // Annex B
100  e_MediaFailure = 100
101  };
102 
103  // Messages
105  virtual void OnReceiveAdmissionConfirm(const H460_FeatureDescriptor & pdu);
106  virtual void OnReceiveAdmissionReject(const H460_FeatureDescriptor & pdu);
107 
108  virtual bool OnSendSetup_UUIE(H460_FeatureDescriptor & pdu);
109  virtual void OnReceiveSetup_UUIE(const H460_FeatureDescriptor & pdu);
110 
111  MediaStrategyIndicator GetStrategy() const { return m_strategy; }
112  bool IsDisabledH46019() const;
113 
114  protected:
115  void HandleStrategy(const H460_FeatureDescriptor & pdu);
116 
117  PNatMethod_H46024 * m_natMethod;
118  MediaStrategyIndicator m_strategy;
119 };
120 
122 
123 #if OPAL_H460_24A
124 
125 class H460_FeatureStd24AnnexA : public H460_Feature
126 {
127  PCLASSINFO_WITH_CLONE(H460_FeatureStd24AnnexA, H460_Feature);
128  public:
129  H460_FeatureStd24AnnexA();
130  ~H460_FeatureStd24AnnexA();
131 
132  static const H460_FeatureID & ID();
133 
134  virtual bool OnSendingOLCGenericInformation(unsigned sessionID, H245_ArrayOf_GenericParameter & param, bool isAck);
135  virtual void OnReceiveOLCGenericInformation(unsigned sessionID, const H245_ArrayOf_GenericParameter & param, bool isAck);
136 
137  protected:
138  bool InitProbe(unsigned sessionID);
139  void StartProbe();
140  void SendProbe();
141 
142  PMutex m_mutex;
143  OpalRTPSession * m_session;
144  PString m_localCUI;
145  PIPSocketAddressAndPort m_directMediaAddress;
146  PIPSocketAddressAndPort m_directControlAddress;
147  PTimer m_probeTimer;
148  PSimpleTimer m_probeTimeout;
149  PBYTEArray m_localSHA1;
150  PBYTEArray m_remoteSHA1;
151 
153  OpalRTPSession::ApplDefinedNotifier m_probeNotifier;
154  PDECLARE_NOTIFIER(PTimer, H460_FeatureStd24AnnexA, ProbeTimeout);
155  PDECLARE_NOTIFIER2(OpalRTPSession, H460_FeatureStd24AnnexA, ProbeResponse, const RTP_ControlFrame::ApplDefinedInfo &);
156 };
157 
158 #endif // OPAL_H460_24A
159 
160 #endif // OPAL_H460_24
161 
162 #endif // OPAL_H460_STD24_H