OPAL  Version 3.18.8
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 
36 #ifndef OPAL_H460_STD24_H
37 #define OPAL_H460_STD24_H
38 
39 #include <opal_config.h>
40 
41 #if OPAL_H460_24
42 
43 #include <h460/h4601.h>
44 #include <rtp/rtp_session.h>
45 #include <ptclib/pstun.h>
46 
47 
48 #if _MSC_VER
49 #pragma once
50 #endif
51 
52 
53 class PSTUNClient;
54 
55 
56 class PNatMethod_H46024 : public PSTUNClient
57 {
58  PCLASSINFO(PNatMethod_H46024, PSTUNClient);
59  public:
60  enum
61  {
62  DefaultPriority = 10
63  };
64  PNatMethod_H46024(unsigned priority = DefaultPriority);
65 
66  static const char * MethodName();
67  virtual PCaselessString GetMethodName() const;
68 
69  virtual bool IsAvailable(const PIPSocket::Address & binding, PObject * context);
70 };
71 
72 
74 
75 class H460_FeatureStd24 : public H460_Feature
76 {
77  PCLASSINFO_WITH_CLONE(H460_FeatureStd24, H460_Feature);
78  public:
79  H460_FeatureStd24();
80 
81  static const H460_FeatureID & ID();
82  virtual bool Initialise(H323EndPoint & ep, H323Connection * con);
83 
85  enum MediaStrategyIndicator
86  {
87  e_Unknown,
88  e_NoAssist,
89  e_LocalMediaMaster,
90  e_RemoteMediaMaster,
91  e_LocalProxy,
92  e_RemoteProxy,
93  e_FullProxy,
94  e_ProbeSameNAT, // Annex A
95  e_ProbeExternalNAT, // Annex B
96  e_MediaFailure = 100
97  };
98 
99  // Messages
101  virtual void OnReceiveAdmissionConfirm(const H460_FeatureDescriptor & pdu);
102  virtual void OnReceiveAdmissionReject(const H460_FeatureDescriptor & pdu);
103 
104  virtual bool OnSendSetup_UUIE(H460_FeatureDescriptor & pdu);
105  virtual void OnReceiveSetup_UUIE(const H460_FeatureDescriptor & pdu);
106 
107  MediaStrategyIndicator GetStrategy() const { return m_strategy; }
108  bool IsDisabledH46019() const;
109 
110  protected:
111  void HandleStrategy(const H460_FeatureDescriptor & pdu);
112 
113  PNatMethod_H46024 * m_natMethod;
114  MediaStrategyIndicator m_strategy;
115 };
116 
118 
119 #if OPAL_H460_24A
120 
121 class H460_FeatureStd24AnnexA : public H460_Feature
122 {
123  PCLASSINFO_WITH_CLONE(H460_FeatureStd24AnnexA, H460_Feature);
124  public:
125  H460_FeatureStd24AnnexA();
126  ~H460_FeatureStd24AnnexA();
127 
128  static const H460_FeatureID & ID();
129 
130  virtual bool OnSendingOLCGenericInformation(unsigned sessionID, H245_ArrayOf_GenericParameter & param, bool isAck);
131  virtual void OnReceiveOLCGenericInformation(unsigned sessionID, const H245_ArrayOf_GenericParameter & param, bool isAck);
132 
133  protected:
134  bool InitProbe(unsigned sessionID);
135  void StartProbe();
136  void SendProbe();
137 
138  PDECLARE_MUTEX( m_mutex);
139  OpalRTPSession * m_session;
140  PString m_localCUI;
141  PIPSocketAddressAndPort m_directMediaAddress;
142  PIPSocketAddressAndPort m_directControlAddress;
143  PTimer m_probeTimer;
144  PSimpleTimer m_probeTimeout;
145  PBYTEArray m_localSHA1;
146  PBYTEArray m_remoteSHA1;
147 
149  OpalRTPSession::ApplDefinedNotifier m_probeNotifier;
150  PDECLARE_NOTIFIER(PTimer, H460_FeatureStd24AnnexA, ProbeTimeout);
151  PDECLARE_NOTIFIER2(OpalRTPSession, H460_FeatureStd24AnnexA, ProbeResponse, const RTP_ControlFrame::ApplDefinedInfo &);
152 };
153 
154 #endif // OPAL_H460_24A
155 
156 #endif // OPAL_H460_24
157 
158 #endif // OPAL_H460_STD24_H
virtual void OnReceiveSetup_UUIE(const H460_FeatureDescriptor &)
Definition: h4601.h:571
virtual bool OnSendAdmissionRequest(H460_FeatureDescriptor &)
Definition: h4601.h:523
Definition: h4601.h:267
PNotifierTemplate< const RTP_ControlFrame::ApplDefinedInfo & > ApplDefinedNotifier
Definition: rtp_session.h:290
virtual void OnReceiveOLCGenericInformation(unsigned, const H245_ArrayOf_GenericParameter &, bool)
Definition: h4601.h:592
virtual bool OnSendSetup_UUIE(H460_FeatureDescriptor &)
Definition: h4601.h:570
virtual bool Initialise(H323EndPoint &ep, H323Connection *con)
Definition: rtp_session.h:90
Definition: h323con.h:137
virtual void OnReceiveAdmissionConfirm(const H460_FeatureDescriptor &)
Definition: h4601.h:528
virtual void OnReceiveAdmissionReject(const H460_FeatureDescriptor &)
Definition: h4601.h:529
virtual bool OnSendingOLCGenericInformation(unsigned, H245_ArrayOf_GenericParameter &, bool)
Definition: h4601.h:591
Definition: h4601.h:75
Definition: h323ep.h:82
Definition: h4601.h:369