1 /*
2  * h323t38.h
3  *
4  * H.323 T.38 logical channel establishment
5  *
6  * Open H323 Library
7  *
8  * Copyright (c) 2001 Equivalence Pty. Ltd.
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 H323 Library.
21  *
22  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23  *
24  * Contributor(s): ______________________________________.
25  *
26  * $Revision: 22645 $
27  * $Author: rjongbloed $
28  * $Date: 2009-05-18 23:02:17 -0500 (Mon, 18 May 2009) $
29  */
30 
31 #ifndef OPAL_T38_H323T38_H
32 #define OPAL_T38_H323T38_H
33 
34 #ifdef P_USE_PRAGMA
35 #pragma interface
36 #endif
37 
38 #include <opal/buildopts.h>
39 
40 #if OPAL_T38_CAPABILITY
41 
42 #include <h323/h323caps.h>
43 
44 
45 class H245_T38FaxProfile;
46 
47 
48 ///////////////////////////////////////////////////////////////////////////////
49 
50 /**This class describes the T.38 standard capability.
51  */
52 class H323_T38Capability : public H323DataCapability
53 {
54     PCLASSINFO(H323_T38Capability, H323DataCapability);
55   public:
56   /**@name Construction */
57   //@{
58     enum TransportMode {
59       e_UDP,
60       e_DualTCP,
61       e_SingleTCP,
62       NumTransportModes
63     };
64 
65     /**Create a new capability.
66      */
67     H323_T38Capability(
68       TransportMode mode = e_UDP
69     );
70   //@}
71 
72   /**@name Overrides from class PObject */
73   //@{
74     /**Compare two capability instances. This compares the main and sub-types
75        of the capability.
76      */
77     Comparison Compare(const PObject & obj) const;
78 
79     /**Create a copy of the object.
80       */
81     virtual PObject * Clone() const;
82   //@}
83 
84   /**@name Identification functions */
85   //@{
86     /**Get the sub-type of the capability. This is a code dependent on the
87        main type of the capability.
88 
89        This returns the e_t38fax enum value from the protocol ASN
90        H245_DataApplicationCapability_application class.
91      */
92     virtual unsigned GetSubType() const;
93 
94     /**Get the name of the media data format this class represents.
95      */
96     virtual PString GetFormatName() const;
97   //@}
98 
99   /**@name Operations */
100   //@{
101     /**Create the channel instance, allocating resources as required.
102      */
103     virtual H323Channel * CreateChannel(
104       H323Connection & connection,    ///<  Owner connection for channel
105       H323Channel::Directions dir,    ///<  Direction of channel
106       unsigned sessionID,             ///<  Session ID for RTP channel
107       const H245_H2250LogicalChannelParameters * param
108                                       ///<  Parameters for channel
109     ) const;
110   //@}
111 
112   /**@name Protocol manipulation */
113   //@{
114     /**This function is called whenever and outgoing TerminalCapabilitySet
115        or OpenLogicalChannel PDU is being constructed for the control channel.
116        It allows the capability to set the PDU fields from information in
117        members specific to the class.
118 
119        The default behaviour sets the pdu and calls OnSendingPDU with a
120        H245_DataProtocolCapability parameter.
121      */
122     virtual PBoolean OnSendingPDU(
123       H245_DataApplicationCapability & pdu
124     ) const;
125 
126     /**This function is called whenever and outgoing RequestMode
127        PDU is being constructed for the control channel. It allows the
128        capability to set the PDU fields from information in members specific
129        to the class.
130 
131        The default behaviour sets the pdu and calls OnSendingPDU with a
132        H245_DataProtocolCapability parameter.
133      */
134     virtual PBoolean OnSendingPDU(
135       H245_DataMode & pdu  ///<  PDU to set information on
136     ) const;
137 
138     /**This function is called whenever and outgoing PDU is being constructed
139        for the control channel. It allows the capability to set the PDU fields
140        from information in members specific to the class.
141 
142        The default behaviour sets tcp or udp as required.
143      */
144     virtual PBoolean OnSendingPDU(
145       H245_DataProtocolCapability & proto,  ///<  PDU to set information on
146       H245_T38FaxProfile & profile          ///<  PDU to set information on
147     ) const;
148 
149     /**This function is called whenever and incoming TerminalCapabilitySet
150        or OpenLogicalChannel PDU has been used to construct the control
151        channel. It allows the capability to set from the PDU fields,
152        information in members specific to the class.
153 
154        The default behaviour gets the data rate field from the PDU.
155      */
156     virtual PBoolean OnReceivedPDU(
157       const H245_DataApplicationCapability & pdu  ///<  PDU to set information on
158     );
159   //@}
160 
GetTransportMode()161     TransportMode GetTransportMode() const { return mode; }
162 
163   protected:
164     TransportMode mode;
165 };
166 
167 
168 /**This class describes the T.38 non-standard capability.
169  */
170 class H323_T38NonStandardCapability : public H323NonStandardDataCapability
171 {
172     PCLASSINFO(H323_T38NonStandardCapability, H323NonStandardDataCapability);
173   public:
174   /**@name Construction */
175   //@{
176     /**Create a new capability.
177      */
178     H323_T38NonStandardCapability(
179       BYTE country = 181,            ///<  t35 information
180       BYTE extension = 0,            ///<  t35 information
181       WORD maufacturer = 18          ///<  t35 information
182     );
183   //@}
184 
185   /**@name Overrides from class PObject */
186   //@{
187     /**Create a copy of the object.
188       */
189     virtual PObject * Clone() const;
190   //@}
191 
192   /**@name Identification functions */
193   //@{
194     /**Get the name of the media data format this class represents.
195      */
196     virtual PString GetFormatName() const;
197   //@}
198 
199   /**@name Operations */
200   //@{
201     /**Create the channel instance, allocating resources as required.
202      */
203     virtual H323Channel * CreateChannel(
204       H323Connection & connection,    ///<  Owner connection for channel
205       H323Channel::Directions dir,    ///<  Direction of channel
206       unsigned sessionID,             ///<  Session ID for RTP channel
207       const H245_H2250LogicalChannelParameters * param
208                                       ///<  Parameters for channel
209     ) const;
210   //@}
211 };
212 
213 
214 #endif //OPAL_T38_CAPABILITY
215 
216 #endif // OPAL_T38_H323T38_H
217 
218 
219 /////////////////////////////////////////////////////////////////////////////
220