h323caps.h

Go to the documentation of this file.
00001 /*
00002  * h323caps.h
00003  *
00004  * H.323 protocol handler
00005  *
00006  * Open H323 Library
00007  *
00008  * Copyright (c) 1998-2001 Equivalence Pty. Ltd.
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Open H323 Library.
00021  *
00022  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00023  *
00024  * Portions of this code were written with the assisance of funding from
00025  * Vovida Networks, Inc. http://www.vovida.com.
00026  *
00027  * Contributor(s): ______________________________________.
00028  *
00029  * $Log: h323caps.h,v $
00030  * Revision 2.15  2005/11/30 13:35:26  csoutheren
00031  * Changed tags for Doxygen
00032  *
00033  * Revision 2.14  2005/02/21 12:19:45  rjongbloed
00034  * Added new "options list" to the OpalMediaFormat class.
00035  *
00036  * Revision 2.13  2004/09/01 12:21:27  rjongbloed
00037  * Added initialisation of H323EndPoints capability table to be all codecs so can
00038  *   correctly build remote caps from fqast connect params. This had knock on effect
00039  *   with const keywords added in numerous places.
00040  *
00041  * Revision 2.12  2004/02/19 10:46:43  rjongbloed
00042  * Merged OpenH323 version 1.13.1 changes.
00043  *
00044  * Revision 2.11  2002/11/10 11:33:16  robertj
00045  * Updated to OpenH323 v1.10.3
00046  *
00047  * Revision 2.10  2002/09/16 02:52:33  robertj
00048  * Added #define so can select if #pragma interface/implementation is used on
00049  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00050  *
00051  * Revision 2.9  2002/09/04 06:01:46  robertj
00052  * Updated to OpenH323 v1.9.6
00053  *
00054  * Revision 2.8  2002/07/01 04:56:29  robertj
00055  * Updated to OpenH323 v1.9.1
00056  *
00057  * Revision 2.7  2002/02/19 07:44:13  robertj
00058  * Added function to set teh RTP payload type for the capability.
00059  *
00060  * Revision 2.6  2002/02/11 09:32:11  robertj
00061  * Updated to openH323 v1.8.0
00062  *
00063  * Revision 2.5  2002/01/22 04:59:04  robertj
00064  * Update from OpenH323, RFC2833 support
00065  *
00066  * Revision 2.4  2002/01/14 06:35:56  robertj
00067  * Updated to OpenH323 v1.7.9
00068  *
00069  * Revision 2.3  2001/11/02 10:45:19  robertj
00070  * Updated to OpenH323 v1.7.3
00071  *
00072  * Revision 2.2  2001/10/05 00:22:13  robertj
00073  * Updated to PWLib 1.2.0 and OpenH323 1.7.0
00074  *
00075  * Revision 2.1  2001/08/01 05:12:04  robertj
00076  * Major changes to H.323 capabilities, uses OpalMediaFormat for base name.
00077  * Added "known" codecs capability clases.
00078  *
00079  * Revision 2.0  2001/07/27 15:48:24  robertj
00080  * Conversion of OpenH323 to Open Phone Abstraction Library (OPAL)
00081  *
00082  * Revision 1.40  2003/10/27 06:03:39  csoutheren
00083  * Added support for QoS
00084  *   Thanks to Henry Harrison of AliceStreet
00085  *
00086  * Revision 1.39  2003/06/06 02:13:10  rjongbloed
00087  * Changed non-standard capability semantics so can use C style strings as
00088  *   the embedded data block (ie automatically call strlen)
00089  *
00090  * Revision 1.38  2003/04/28 07:00:00  robertj
00091  * Fixed problem with compiler(s) not correctly initialising static globals
00092  *
00093  * Revision 1.37  2003/04/27 23:49:21  craigs
00094  * Fixed some comments and made list of registered codecs
00095  * available outside h323caps.cxx
00096  *
00097  * Revision 1.36  2002/11/09 04:24:01  robertj
00098  * Fixed minor documentation errors.
00099  *
00100  * Revision 1.35  2002/09/16 01:14:15  robertj
00101  * Added #define so can select if #pragma interface/implementation is used on
00102  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00103  *
00104  * Revision 1.34  2002/09/03 06:19:36  robertj
00105  * Normalised the multi-include header prevention ifdef/define symbol.
00106  *
00107  * Revision 1.33  2002/08/05 10:03:47  robertj
00108  * Cosmetic changes to normalise the usage of pragma interface/implementation.
00109  *
00110  * Revision 1.32  2002/05/29 03:55:17  robertj
00111  * Added protocol version number checking infrastructure, primarily to improve
00112  *   interoperability with stacks that are unforgiving of new features.
00113  *
00114  * Revision 1.31  2002/05/10 05:44:50  robertj
00115  * Added the max bit rate field to the data channel capability class.
00116  *
00117  * Revision 1.30  2002/01/22 06:25:02  robertj
00118  * Moved payload type to ancestor so any capability can adjust it on logical channel.
00119  *
00120  * Revision 1.29  2002/01/17 07:04:57  robertj
00121  * Added support for RFC2833 embedded DTMF in the RTP stream.
00122  *
00123  * Revision 1.28  2002/01/16 05:37:41  robertj
00124  * Added missing mode change functions on non standard capabilities.
00125  *
00126  * Revision 1.27  2002/01/09 00:21:36  robertj
00127  * Changes to support outgoing H.245 RequstModeChange.
00128  *
00129  * Revision 1.26  2001/12/22 01:44:05  robertj
00130  * Added more support for H.245 RequestMode operation.
00131  *
00132  * Revision 1.25  2001/10/24 01:20:34  robertj
00133  * Added code to help with static linking of H323Capability names database.
00134  *
00135  * Revision 1.24  2001/09/21 02:48:51  robertj
00136  * Added default implementation for PDU encode/decode for codecs
00137  *   that have simple integer as frames per packet.
00138  *
00139  * Revision 1.23  2001/09/11 10:21:40  robertj
00140  * Added direction field to capabilities, thanks Nick Hoath.
00141  *
00142  * Revision 1.22  2001/07/19 09:50:40  robertj
00143  * Added code for default session ID on data channel being three.
00144  *
00145  * Revision 1.21  2001/07/17 04:44:29  robertj
00146  * Partial implementation of T.120 and T.38 logical channels.
00147  *
00148  * Revision 1.20  2001/05/21 07:20:47  robertj
00149  * Removed redundent class name in declaration.
00150  *
00151  * Revision 1.19  2001/05/14 05:56:26  robertj
00152  * Added H323 capability registration system so can add capabilities by
00153  *   string name instead of having to instantiate explicit classes.
00154  *
00155  * Revision 1.18  2001/05/02 16:22:21  rogerh
00156  * Add IsAllow() for a single capability to check if it is in the
00157  * capabilities set. This fixes the bug where OpenH323 would accept
00158  * incoming H261 video even when told not to accept it.
00159  *
00160  * Revision 1.17  2001/03/16 23:00:21  robertj
00161  * Improved validation of codec selection against capability set, thanks Chris Purvis.
00162  *
00163  * Revision 1.16  2001/02/09 05:16:24  robertj
00164  * Added #pragma interface for GNU C++.
00165  *
00166  * Revision 1.15  2001/01/25 07:27:14  robertj
00167  * Major changes to add more flexible OpalMediaFormat class to normalise
00168  *   all information about media types, especially codecs.
00169  *
00170  * Revision 1.14  2001/01/09 23:05:22  robertj
00171  * Fixed inability to have 2 non standard codecs in capability table.
00172  *
00173  * Revision 1.13  2000/10/16 08:49:30  robertj
00174  * Added single function to add all UserInput capability types.
00175  *
00176  * Revision 1.12  2000/08/23 14:23:11  craigs
00177  * Added prototype support for Microsoft GSM codec
00178  *
00179  * Revision 1.11  2000/07/13 12:25:47  robertj
00180  * Fixed problems with fast start frames per packet adjustment.
00181  *
00182  * Revision 1.10  2000/07/10 16:01:50  robertj
00183  * Started fixing capability set merging, still more to do.
00184  *
00185  * Revision 1.9  2000/07/04 01:16:49  robertj
00186  * Added check for capability allowed in "combinations" set, still needs more done yet.
00187  *
00188  * Revision 1.8  2000/06/03 03:16:47  robertj
00189  * Fixed using the wrong capability table (should be connections) for some operations.
00190  *
00191  * Revision 1.7  2000/05/23 11:32:27  robertj
00192  * Rewrite of capability table to combine 2 structures into one and move functionality into that class
00193  *    allowing some normalisation of usage across several applications.
00194  * Changed H323Connection so gets a copy of capabilities instead of using endponts, allows adjustments
00195  *    to be done depending on the remote client application.
00196  *
00197  * Revision 1.6  2000/05/18 11:53:34  robertj
00198  * Changes to support doc++ documentation generation.
00199  *
00200  * Revision 1.5  2000/05/10 04:05:26  robertj
00201  * Changed capabilities so has a function to get name of codec, instead of relying on PrintOn.
00202  *
00203  * Revision 1.4  2000/05/02 04:32:24  robertj
00204  * Fixed copyright notice comment.
00205  *
00206  * Revision 1.3  2000/04/05 19:01:12  robertj
00207  * Added function so can change desired transmit packet size.
00208  *
00209  * Revision 1.2  2000/03/21 03:06:47  robertj
00210  * Changes to make RTP TX of exact numbers of frames in some codecs.
00211  *
00212  * Revision 1.1  1999/12/23 23:02:35  robertj
00213  * File reorganision for separating RTP from H.323 and creation of LID for VPB support.
00214  *
00215  */
00216 
00217 #ifndef __OPAL_H323CAPS_H
00218 #define __OPAL_H323CAPS_H
00219 
00220 #ifdef P_USE_PRAGMA
00221 #pragma interface
00222 #endif
00223 
00224 
00225 #include <opal/mediafmt.h>
00226 #include <h323/channels.h>
00227 
00228 
00229 /* The following classes have forward references to avoid including the VERY
00230    large header files for H225 and H245. If an application requires access
00231    to the protocol classes they can include them, but for simple usage their
00232    inclusion can be avoided.
00233  */
00234 class PASN_Choice;
00235 class H245_Capability;
00236 class H245_DataType;
00237 class H245_ModeElement;
00238 class H245_AudioCapability;
00239 class H245_AudioMode;
00240 class H245_VideoCapability;
00241 class H245_VideoMode;
00242 class H245_DataApplicationCapability;
00243 class H245_DataMode;
00244 class H245_DataProtocolCapability;
00245 class H245_H2250LogicalChannelParameters;
00246 class H245_TerminalCapabilitySet;
00247 class H245_NonStandardParameter;
00248 class H323Connection;
00249 class H323Capabilities;
00250 
00251 
00252 
00254 
00268 class H323Capability : public PObject
00269 {
00270   PCLASSINFO(H323Capability, PObject);
00271 
00272   public:
00277     H323Capability();
00279 
00285     Comparison Compare(const PObject & obj) const;
00286 
00289     void PrintOn(ostream & strm) const;
00291 
00294     enum MainTypes {
00296       e_Audio,
00298       e_Video,
00300       e_Data,
00302       e_UserInput,
00304       e_NumMainTypes
00305     };
00306 
00312     virtual MainTypes GetMainType() const = 0;
00313 
00317     virtual unsigned  GetSubType()  const = 0;
00318 
00321     virtual PString GetFormatName() const = 0;
00323 
00329     static H323Capability * Create(
00330       const H323EndPoint & ep, 
00331       const PString & name     
00332     );
00333 
00342     virtual unsigned GetDefaultSessionID() const;
00343 
00352     virtual void SetTxFramesInPacket(
00353       unsigned frames   
00354     );
00355 
00360     virtual unsigned GetTxFramesInPacket() const;
00361 
00366     virtual unsigned GetRxFramesInPacket() const;
00367 
00373     virtual H323Channel * CreateChannel(
00374       H323Connection & connection,    
00375       H323Channel::Directions dir,    
00376       unsigned sessionID,             
00377       const H245_H2250LogicalChannelParameters * param
00379     ) const = 0;
00381 
00391     virtual BOOL OnSendingPDU(
00392       H245_Capability & pdu  
00393     ) const = 0;
00394 
00402     virtual BOOL OnSendingPDU(
00403       H245_DataType & pdu  
00404     ) const = 0;
00405 
00413     virtual BOOL OnSendingPDU(
00414       H245_ModeElement & pdu  
00415     ) const = 0;
00416 
00429     virtual BOOL OnReceivedPDU(
00430       const H245_Capability & pdu 
00431     );
00432 
00440     virtual BOOL OnReceivedPDU(
00441       const H245_DataType & pdu,  
00442       BOOL receiver               
00443     ) = 0;
00444 
00447     virtual BOOL IsNonStandardMatch(
00448       const H245_NonStandardParameter & param  
00449     ) const;
00450 
00458     virtual BOOL IsUsable(
00459       const H323Connection & connection
00460     ) const;
00462 
00465     enum CapabilityDirection {
00466       e_Unknown,
00467       e_Receive,
00468       e_Transmit,
00469       e_ReceiveAndTransmit,
00470       e_NoDirection,
00471       NumCapabilityDirections
00472     };
00473 
00476     CapabilityDirection GetCapabilityDirection() const { return capabilityDirection; }
00477 
00480     void SetCapabilityDirection(
00481       CapabilityDirection dir   
00482     ) { capabilityDirection = dir; }
00483 
00485     unsigned GetCapabilityNumber() const { return assignedCapabilityNumber; }
00486 
00488     void SetCapabilityNumber(unsigned num) { assignedCapabilityNumber = num; }
00489 
00492     const OpalMediaFormat & GetMediaFormat() const;
00493 
00495     RTP_DataFrame::PayloadTypes GetPayloadType() const { return rtpPayloadType; }
00496 
00498     void SetPayloadType(RTP_DataFrame::PayloadTypes pt) { rtpPayloadType = pt; }
00499 
00501     virtual void AttachQoS(RTP_QOS *) { }
00503 
00504 #if PTRACING
00505     friend ostream & operator<<(ostream & o , MainTypes t);
00506     friend ostream & operator<<(ostream & o , CapabilityDirection d);
00507 #endif
00508 
00509   protected:
00510     OpalMediaFormat & GetWritableMediaFormat();
00511 
00512     unsigned            assignedCapabilityNumber;  
00513     CapabilityDirection capabilityDirection;
00514     RTP_DataFrame::PayloadTypes rtpPayloadType;
00515 
00516   private:
00517     OpalMediaFormat     mediaFormat;
00518 };
00519 
00520 
00521 
00530 class H323NonStandardCapabilityInfo
00531 {
00532   public:
00535     H323NonStandardCapabilityInfo(
00536       const H323EndPoint & endpoint,  
00537       const BYTE * dataBlock,         
00538       PINDEX dataSize,                
00539       PINDEX comparisonOffset = 0,    
00540       PINDEX comparisonLength = P_MAX_INDEX  
00541     );
00542 
00545     H323NonStandardCapabilityInfo(
00546       const PString & oid,
00547       const BYTE * dataBlock,         
00548       PINDEX dataSize,                
00549       PINDEX comparisonOffset = 0,
00550       PINDEX comparisonLength = P_MAX_INDEX
00551     );
00552 
00555     H323NonStandardCapabilityInfo(
00556       BYTE country,                  
00557       BYTE extension,                
00558       WORD maufacturer,              
00559       const BYTE * dataBlock,         
00560       PINDEX dataSize,                
00561       PINDEX comparisonOffset = 0,    
00562       PINDEX comparisonLength = P_MAX_INDEX  
00563     );
00564 
00567     virtual ~H323NonStandardCapabilityInfo();
00568 
00573     virtual BOOL OnSendingPDU(
00574       PBYTEArray & data  
00575     ) const;
00576 
00581     virtual BOOL OnReceivedPDU(
00582       const PBYTEArray & data  
00583     );
00584 
00585     PObject::Comparison CompareParam(
00586       const H245_NonStandardParameter & param
00587     ) const;
00588 
00589   protected:
00590     BOOL OnSendingNonStandardPDU(
00591       PASN_Choice & pdu,
00592       unsigned nonStandardTag
00593     ) const;
00594     BOOL OnReceivedNonStandardPDU(
00595       const PASN_Choice & pdu,
00596       unsigned nonStandardTag
00597     );
00598 
00599     PObject::Comparison CompareInfo(
00600       const H323NonStandardCapabilityInfo & obj
00601     ) const;
00602     PObject::Comparison CompareData(
00603       const PBYTEArray & data  
00604     ) const;
00605 
00606     PString    oid;
00607     BYTE       t35CountryCode;
00608     BYTE       t35Extension;
00609     WORD       manufacturerCode;
00610     PBYTEArray nonStandardData;
00611     PINDEX     comparisonOffset;
00612     PINDEX     comparisonLength;
00613 };
00614 
00615 
00622 class H323RealTimeCapability : public H323Capability
00623 {
00624   PCLASSINFO(H323RealTimeCapability, H323Capability);
00625 
00626   public:
00631     virtual H323Channel * CreateChannel(
00632       H323Connection & connection,    
00633       H323Channel::Directions dir,    
00634       unsigned sessionID,             
00635       const H245_H2250LogicalChannelParameters * param
00637     ) const;
00638 
00639     H323RealTimeCapability();
00640     H323RealTimeCapability(const H323RealTimeCapability &rtc);
00641     virtual ~H323RealTimeCapability();
00642     void AttachQoS(RTP_QOS * _rtpqos);
00643 
00644   protected:
00645     RTP_QOS * rtpqos;
00647 };
00648 
00649 
00656 class H323AudioCapability : public H323RealTimeCapability
00657 {
00658   PCLASSINFO(H323AudioCapability, H323RealTimeCapability);
00659 
00660   public:
00665     H323AudioCapability();
00667 
00673     virtual MainTypes GetMainType() const;
00675 
00686     virtual unsigned GetDefaultSessionID() const;
00687 
00696     virtual void SetTxFramesInPacket(
00697       unsigned frames   
00698     );
00699 
00705     virtual unsigned GetTxFramesInPacket() const;
00706 
00712     virtual unsigned GetRxFramesInPacket() const;
00714 
00725     virtual BOOL OnSendingPDU(
00726       H245_Capability & pdu  
00727     ) const;
00728 
00737     virtual BOOL OnSendingPDU(
00738       H245_DataType & pdu  
00739     ) const;
00740 
00749     virtual BOOL OnSendingPDU(
00750       H245_ModeElement & pdu  
00751     ) const;
00752 
00761     virtual BOOL OnSendingPDU(
00762       H245_AudioCapability & pdu,  
00763       unsigned packetSize          
00764     ) const;
00765 
00774     virtual BOOL OnSendingPDU(
00775       H245_AudioMode & pdu  
00776     ) const;
00777 
00789     virtual BOOL OnReceivedPDU(
00790       const H245_Capability & pdu  
00791     );
00792 
00802     virtual BOOL OnReceivedPDU(
00803       const H245_DataType & pdu,  
00804       BOOL receiver               
00805     );
00806 
00815     virtual BOOL OnReceivedPDU(
00816       const H245_AudioCapability & pdu,  
00817       unsigned & packetSize              
00818     );
00820 };
00821 
00822 
00830 class H323NonStandardAudioCapability : public H323AudioCapability,
00831                                        public H323NonStandardCapabilityInfo
00832 {
00833   PCLASSINFO(H323NonStandardAudioCapability, H323AudioCapability);
00834 
00835   public:
00840     H323NonStandardAudioCapability(
00841       const H323EndPoint & endpoint,  
00842       const BYTE * dataBlock = NULL,  
00843       PINDEX dataSize = 0,            
00844       PINDEX comparisonOffset = 0,    
00845       PINDEX comparisonLength = P_MAX_INDEX  
00846      );
00847 
00850     H323NonStandardAudioCapability(
00851       const PString & oid,            
00852       const BYTE * dataBlock = NULL,  
00853       PINDEX dataSize = 0,            
00854       PINDEX comparisonOffset = 0,    
00855       PINDEX comparisonLength = P_MAX_INDEX  
00856     );
00857 
00860     H323NonStandardAudioCapability(
00861       BYTE country,                   
00862       BYTE extension,                 
00863       WORD maufacturer,               
00864       const BYTE * dataBlock = NULL,  
00865       PINDEX dataSize = 0,            
00866       PINDEX comparisonOffset = 0,    
00867       PINDEX comparisonLength = P_MAX_INDEX  
00868     );
00870 
00876     Comparison Compare(const PObject & obj) const;
00878 
00886     virtual unsigned GetSubType() const;
00888 
00899     virtual BOOL OnSendingPDU(
00900       H245_AudioCapability & pdu,  
00901       unsigned packetSize          
00902     ) const;
00903 
00912     virtual BOOL OnSendingPDU(
00913       H245_AudioMode & pdu  
00914     ) const;
00915 
00924     virtual BOOL OnReceivedPDU(
00925       const H245_AudioCapability & pdu,  
00926       unsigned & packetSize              
00927     );
00928 
00931     virtual BOOL IsNonStandardMatch(
00932       const H245_NonStandardParameter & param  
00933     ) const;
00935 };
00936 
00937 
00944 class H323VideoCapability : public H323RealTimeCapability
00945 {
00946   PCLASSINFO(H323VideoCapability, H323RealTimeCapability);
00947 
00948   public:
00954     virtual MainTypes GetMainType() const;
00956 
00967     virtual unsigned GetDefaultSessionID() const;
00969 
00980     virtual BOOL OnSendingPDU(
00981       H245_Capability & pdu  
00982     ) const;
00983 
00992     virtual BOOL OnSendingPDU(
00993       H245_DataType & pdu  
00994     ) const;
00995 
01004     virtual BOOL OnSendingPDU(
01005       H245_ModeElement & pdu  
01006     ) const;
01007 
01015     virtual BOOL OnSendingPDU(
01016       H245_VideoCapability & pdu  
01017     ) const = 0;
01018 
01027     virtual BOOL OnSendingPDU(
01028       H245_VideoMode & pdu  
01029     ) const = 0;
01030 
01040     virtual BOOL OnReceivedPDU(
01041       const H245_Capability & pdu  
01042     );
01043 
01051     virtual BOOL OnReceivedPDU(
01052       const H245_DataType & pdu,  
01053       BOOL receiver               
01054     );
01055 
01063     virtual BOOL OnReceivedPDU(
01064       const H245_VideoCapability & pdu  
01065     ) = 0;
01067 };
01068 
01069 
01077 class H323NonStandardVideoCapability : public H323VideoCapability,
01078                                        public H323NonStandardCapabilityInfo
01079 {
01080   PCLASSINFO(H323NonStandardVideoCapability, H323VideoCapability);
01081 
01082   public:
01087     H323NonStandardVideoCapability(
01088       const H323EndPoint & endpoint,  
01089       const BYTE * dataBlock = NULL,  
01090       PINDEX dataSize = 0,            
01091       PINDEX comparisonOffset = 0,    
01092       PINDEX comparisonLength = P_MAX_INDEX  
01093     );
01094 
01097     H323NonStandardVideoCapability(
01098       const PString & oid,            
01099       const BYTE * dataBlock = NULL,  
01100       PINDEX dataSize = 0,            
01101       PINDEX comparisonOffset = 0,    
01102       PINDEX comparisonLength = P_MAX_INDEX  
01103     );
01104 
01107     H323NonStandardVideoCapability(
01108       BYTE country,                   
01109       BYTE extension,                 
01110       WORD maufacturer,               
01111       const BYTE * dataBlock = NULL,  
01112       PINDEX dataSize = 0,            
01113       PINDEX comparisonOffset = 0,    
01114       PINDEX comparisonLength = P_MAX_INDEX  
01115     );
01117 
01123     Comparison Compare(const PObject & obj) const;
01125 
01134     virtual unsigned GetSubType() const;
01136 
01147     virtual BOOL OnSendingPDU(
01148       H245_VideoCapability & pdu  
01149     ) const;
01150 
01159     virtual BOOL OnSendingPDU(
01160       H245_VideoMode & pdu  
01161     ) const;
01162 
01171     virtual BOOL OnReceivedPDU(
01172       const H245_VideoCapability & pdu  
01173     );
01174 
01177     virtual BOOL IsNonStandardMatch(
01178       const H245_NonStandardParameter & param  
01179     ) const;
01181 };
01182 
01183 
01190 class H323DataCapability : public H323Capability
01191 {
01192   PCLASSINFO(H323DataCapability, H323Capability);
01193 
01194   public:
01199     H323DataCapability(
01200       unsigned maxBitRate = 0  
01201     );
01203 
01209     virtual MainTypes GetMainType() const;
01211 
01221     virtual unsigned GetDefaultSessionID() const;
01223 
01234     virtual BOOL OnSendingPDU(
01235       H245_Capability & pdu  
01236     ) const;
01237 
01246     virtual BOOL OnSendingPDU(
01247       H245_DataType & pdu  
01248     ) const;
01249 
01258     virtual BOOL OnSendingPDU(
01259       H245_ModeElement & pdu  
01260     ) const;
01261 
01269     virtual BOOL OnSendingPDU(
01270       H245_DataApplicationCapability & pdu  
01271     ) const = 0;
01272 
01281     virtual BOOL OnSendingPDU(
01282       H245_DataMode & pdu  
01283     ) const = 0;
01284 
01294     virtual BOOL OnReceivedPDU(
01295       const H245_Capability & pdu  
01296     );
01297 
01305     virtual BOOL OnReceivedPDU(
01306       const H245_DataType & pdu,  
01307       BOOL receiver               
01308     );
01309 
01317     virtual BOOL OnReceivedPDU(
01318       const H245_DataApplicationCapability & pdu  
01319     ) = 0;
01321 
01322   protected:
01323     unsigned maxBitRate;
01324 };
01325 
01326 
01334 class H323NonStandardDataCapability : public H323DataCapability,
01335                                       public H323NonStandardCapabilityInfo
01336 {
01337   PCLASSINFO(H323NonStandardDataCapability, H323DataCapability);
01338 
01339   public:
01344     H323NonStandardDataCapability(
01345       unsigned maxBitRate,            
01346       const H323EndPoint & endpoint,  
01347       const BYTE * dataBlock = NULL,  
01348       PINDEX dataSize = 0,            
01349       PINDEX comparisonOffset = 0,    
01350       PINDEX comparisonLength = P_MAX_INDEX  
01351     );
01352 
01355     H323NonStandardDataCapability(
01356       unsigned maxBitRate,            
01357       const PString & oid,            
01358       const BYTE * dataBlock = NULL,  
01359       PINDEX dataSize = 0,            
01360       PINDEX comparisonOffset = 0,    
01361       PINDEX comparisonLength = P_MAX_INDEX  
01362     );
01363 
01366     H323NonStandardDataCapability(
01367       unsigned maxBitRate,            
01368       BYTE country,                   
01369       BYTE extension,                 
01370       WORD maufacturer,               
01371       const BYTE * dataBlock = NULL,  
01372       PINDEX dataSize = 0,            
01373       PINDEX comparisonOffset = 0,    
01374       PINDEX comparisonLength = P_MAX_INDEX  
01375     );
01377 
01383     Comparison Compare(const PObject & obj) const;
01385 
01394     virtual unsigned GetSubType() const;
01396 
01407     virtual BOOL OnSendingPDU(
01408       H245_DataApplicationCapability & pdu  
01409     ) const;
01410 
01419     virtual BOOL OnSendingPDU(
01420       H245_DataMode & pdu  
01421     ) const;
01422 
01431     virtual BOOL OnReceivedPDU(
01432       const H245_DataApplicationCapability & pdu  
01433     );
01434 
01437     virtual BOOL IsNonStandardMatch(
01438       const H245_NonStandardParameter & param  
01439     ) const;
01441 };
01442 
01443 
01445 // Known audio codecs
01446 
01449 class H323_G711Capability : public H323AudioCapability
01450 {
01451   PCLASSINFO(H323_G711Capability, H323AudioCapability)
01452 
01453   public:
01455     enum Mode {
01457       ALaw,
01459       muLaw
01460     };
01462     enum Speed {
01464       At64k,
01466       At56k
01467     };
01468 
01473     H323_G711Capability(
01474       Mode mode = muLaw,    
01475       Speed speed = At64k   
01476     );
01478 
01483     virtual PObject * Clone() const;
01485 
01494     virtual unsigned GetSubType() const;
01495 
01498     virtual PString GetFormatName() const;
01500 
01501   protected:
01502     Mode     mode;
01503     Speed    speed;
01504 };
01505 
01506 
01509 class H323_G728Capability : public H323AudioCapability
01510 {
01511   PCLASSINFO(H323_G728Capability, H323AudioCapability)
01512 
01513   public:
01518     H323_G728Capability();
01520 
01525     virtual PObject * Clone() const;
01527 
01533     virtual unsigned GetSubType() const;
01534 
01537     virtual PString GetFormatName() const;
01539 };
01540 
01541 
01544 class H323_G729Capability : public H323AudioCapability
01545 {
01546   PCLASSINFO(H323_G729Capability, H323AudioCapability)
01547 
01548   public:
01550     enum Mode {
01551       e_Normal,
01552       e_AnnexA,
01553       e_AnnexB,
01554       e_AnnexA_AnnexB
01555     };
01556 
01561     H323_G729Capability(
01562       Mode mode 
01563     );
01565 
01570     virtual PObject * Clone() const;
01572 
01578     virtual unsigned GetSubType() const;
01579 
01582     virtual PString GetFormatName() const;
01584 
01585   protected:
01586     Mode mode;
01587 };
01588 
01589 
01592 class H323_G7231Capability : public H323AudioCapability
01593 {
01594   PCLASSINFO(H323_G7231Capability, H323AudioCapability)
01595 
01596   public:
01601     H323_G7231Capability(
01602       BOOL allowSIDFrames = TRUE   
01603     );
01605 
01610     virtual PObject * Clone() const;
01612 
01618     virtual unsigned GetSubType() const;
01619 
01622     virtual PString GetFormatName() const;
01624 
01634     virtual BOOL OnSendingPDU(
01635       H245_AudioCapability & pdu,  
01636       unsigned packetSize          
01637     ) const;
01638 
01646     virtual BOOL OnReceivedPDU(
01647       const H245_AudioCapability & pdu,  
01648       unsigned & packetSize              
01649     );
01651 
01652   protected:
01653     BOOL allowSIDFrames;
01654 };
01655 
01656 
01659 class H323_GSM0610Capability : public H323AudioCapability
01660 {
01661   PCLASSINFO(H323_GSM0610Capability, H323AudioCapability)
01662 
01663   public:
01668     H323_GSM0610Capability();
01670 
01675     virtual PObject * Clone() const;
01677 
01686     virtual unsigned GetSubType() const;
01687 
01690     virtual PString GetFormatName() const;
01691 
01700     virtual void SetTxFramesInPacket(
01701       unsigned frames   
01702     );
01704 
01714     virtual BOOL OnSendingPDU(
01715       H245_AudioCapability & pdu,  
01716       unsigned packetSize          
01717     ) const;
01718 
01726     virtual BOOL OnReceivedPDU(
01727       const H245_AudioCapability & pdu,  
01728       unsigned & packetSize              
01729     );
01731 };
01732 
01733 
01735 
01738 class H323_UserInputCapability : public H323Capability
01739 {
01740   PCLASSINFO(H323_UserInputCapability, H323Capability);
01741 
01742   public:
01745     enum SubTypes {
01746       BasicString,
01747       IA5String,
01748       GeneralString,
01749       SignalToneH245,
01750       HookFlashH245,
01751       SignalToneRFC2833,
01752       NumSubTypes
01753     };
01754     static const char * const SubTypeNames[NumSubTypes];
01755 
01760     H323_UserInputCapability(
01761       SubTypes subType
01762     );
01764 
01769     virtual PObject * Clone() const;
01771 
01779     virtual MainTypes GetMainType() const;
01780 
01784     virtual unsigned  GetSubType()  const;
01785 
01788     virtual PString GetFormatName() const;
01790 
01798     virtual H323Channel * CreateChannel(
01799       H323Connection & connection,    
01800       H323Channel::Directions dir,    
01801       unsigned sessionID,             
01802       const H245_H2250LogicalChannelParameters * param
01804     ) const;
01806 
01816     virtual BOOL OnSendingPDU(
01817       H245_Capability & pdu  
01818     ) const;
01819 
01827     virtual BOOL OnSendingPDU(
01828       H245_DataType & pdu  
01829     ) const;
01830 
01839     virtual BOOL OnSendingPDU(
01840       H245_ModeElement & pdu  
01841     ) const;
01842 
01852     virtual BOOL OnReceivedPDU(
01853       const H245_Capability & pdu  
01854     );
01855 
01863     virtual BOOL OnReceivedPDU(
01864       const H245_DataType & pdu,  
01865       BOOL receiver               
01866     );
01867 
01876     virtual BOOL IsUsable(
01877       const H323Connection & connection
01878     ) const;
01880 
01881     static void AddAllCapabilities(
01882       H323Capabilities & capabilities,        
01883       PINDEX descriptorNum,   
01884       PINDEX simultaneous     
01885     );
01886 
01887   protected:
01888     SubTypes subType;
01889 };
01890 
01891 
01892 
01894 
01895 PLIST(H323CapabilitiesList, H323Capability);
01896 
01897 PARRAY(H323CapabilitiesListArray, H323CapabilitiesList);
01898 
01899 class H323SimultaneousCapabilities : public H323CapabilitiesListArray
01900 {
01901   PCLASSINFO(H323SimultaneousCapabilities, H323CapabilitiesListArray);
01902   public:
01903     BOOL SetSize(PINDEX newSize);
01904 };
01905 
01906 
01907 PARRAY(H323CapabilitiesSetArray, H323SimultaneousCapabilities);
01908 
01909 
01910 class H323CapabilitiesSet : public H323CapabilitiesSetArray
01911 {
01912   PCLASSINFO(H323CapabilitiesSet, H323CapabilitiesSetArray);
01913   public:
01915     BOOL SetSize(PINDEX newSize);
01916 };
01917 
01918 
01921 class H323Capabilities : public PObject
01922 {
01923     PCLASSINFO(H323Capabilities, PObject);
01924   public:
01929     H323Capabilities();
01930 
01933     H323Capabilities(
01934       const H323Connection & connection,      
01935       const H245_TerminalCapabilitySet & pdu  
01936     );
01937 
01942     H323Capabilities(
01943       const H323Capabilities & original 
01944     );
01945 
01950     H323Capabilities & operator=(
01951       const H323Capabilities & original 
01952     );
01954 
01959     void PrintOn(
01960       ostream & strm    
01961     ) const;
01963 
01968     PINDEX GetSize() const { return table.GetSize(); }
01969 
01972     H323Capability & operator[](PINDEX i) const { return table[i]; }
01973 
01994     PINDEX SetCapability(
01995       PINDEX descriptorNum, 
01996       PINDEX simultaneous,  
01997       H323Capability * cap  
01998     );
01999 
02004     PINDEX AddAllCapabilities(
02005       const H323EndPoint & ep, 
02006       PINDEX descriptorNum,    
02007       PINDEX simultaneous,     
02008       const PString & name     
02009     );
02010 
02019     void Add(
02020       H323Capability * capability   
02021     );
02022 
02029     H323Capability * Copy(
02030       const H323Capability & capability   
02031     );
02032 
02037     void Remove(
02038       H323Capability * capability   
02039     );
02040 
02045     void Remove(
02046       const PString & formatName   
02047     );
02048 
02052     void Remove(
02053       const PStringArray & formatNames  
02054     );
02055 
02058     void RemoveAll();
02059 
02067     H323Capability * FindCapability(
02068       unsigned capabilityNumber
02069     ) const;
02070 
02086     H323Capability * FindCapability(
02087       const PString & formatName, 
02088       H323Capability::CapabilityDirection direction = H323Capability::e_Unknown
02090     ) const;
02091 
02097     H323Capability * FindCapability(
02098       H323Capability::CapabilityDirection direction 
02099     ) const;
02100 
02108     H323Capability * FindCapability(
02109       const H323Capability & capability 
02110     ) const;
02111 
02117     H323Capability * FindCapability(
02118       const H245_Capability & cap  
02119     ) const;
02120 
02126     H323Capability * FindCapability(
02127       const H245_DataType & dataType  
02128     ) const;
02129 
02135     H323Capability * FindCapability(
02136       const H245_ModeElement & modeElement  
02137     ) const;
02138 
02144     H323Capability * FindCapability(
02145       H323Capability::MainTypes mainType, 
02146       const PASN_Choice & subTypePDU,         
02147       unsigned nonStandardTag             
02148     ) const;
02149 
02155     H323Capability * FindCapability(
02156       H323Capability::MainTypes mainType, 
02157       unsigned subType = UINT_MAX         
02158     ) const;
02159 
02162     void BuildPDU(
02163       const H323Connection & connection,  
02164       H245_TerminalCapabilitySet & pdu    
02165     ) const;
02166 
02169     BOOL Merge(
02170       const H323Capabilities & newCaps
02171     );
02172 
02179     void Reorder(
02180       const PStringArray & preferenceOrder  
02181     );
02182 
02185     BOOL IsAllowed(
02186       const H323Capability & capability
02187     );
02188 
02191     BOOL IsAllowed(
02192       unsigned capabilityNumber
02193     );
02194 
02197     BOOL IsAllowed(
02198       const H323Capability & capability1,
02199       const H323Capability & capability2
02200     );
02201 
02204     BOOL IsAllowed(
02205       unsigned capabilityNumber1,
02206       unsigned capabilityNumber2
02207     );
02208 
02211     OpalMediaFormatList GetMediaFormats() const;
02213 
02214   protected:
02215     H323CapabilitiesList table;
02216     H323CapabilitiesSet  set;
02217 };
02218 
02219 
02221 
02226 class H323CapabilityRegistration : public PCaselessString
02227 {
02228     PCLASSINFO(H323CapabilityRegistration, PCaselessString);
02229   public:
02230     H323CapabilityRegistration(
02231       const char * name
02232     );
02233     virtual H323Capability * Create(const H323EndPoint & ep) const = 0;
02234 
02235   protected:
02236     static PMutex & GetMutex();
02237     static H323CapabilityRegistration * registeredCapabilitiesListHead;
02238 
02239     H323CapabilityRegistration * link;
02240 
02241   friend class H323Capability;
02242   friend class H323Capabilities;
02243   friend class OpalDynaCodecDLL;
02244 };
02245 
02246 
02247 
02248 
02249 #define H323_REGISTER_CAPABILITY_FUNCTION(cls, name, epvar) \
02250 class cls##_Registration : public H323CapabilityRegistration { \
02251   public: \
02252     cls##_Registration() : H323CapabilityRegistration(name) { } \
02253     H323Capability * Create(const H323EndPoint & ep) const; \
02254 } cls##_Registration_Instance; \
02255 H323Capability * cls##_Registration::Create(const H323EndPoint & epvar) const
02256 
02257 #define H323_NO_EP_VAR
02258 
02259 #define H323_REGISTER_CAPABILITY(cls, name) \
02260   H323_REGISTER_CAPABILITY_FUNCTION(cls, name, H323_NO_EP_VAR) \
02261   { return new cls; }
02262 
02263 #define H323_REGISTER_CAPABILITY_EP(cls, name) \
02264   H323_REGISTER_CAPABILITY_FUNCTION(cls, name, ep) \
02265   { return new cls(ep); }
02266 
02267 
02268 #define H323_STATIC_LOAD_REGISTER_CAPABILITY(cls) \
02269   class cls##_Registration; \
02270   extern cls##_Registration cls##_Registration_Instance; \
02271   static cls##_Registration * cls##_Registration_Static_Library_Loader = &cls##_Registration_Instance
02272 
02273 
02274 #endif // __OPAL_H323CAPS_H
02275 
02276 

Generated on Mon Sep 25 16:19:59 2006 for OPAL by  doxygen 1.4.7