Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

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-2000 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 1.47  2004/08/24 14:23:09  csoutheren
00031  * Fixed problem with plugin codecs using capability compare functions
00032  *
00033  * Revision 1.46  2004/06/30 12:31:09  rjongbloed
00034  * Rewrite of plug in system to use single global variable for all factories to avoid all sorts
00035  *   of issues with startup orders and Windows DLL multiple instances.
00036  *
00037  * Revision 1.45  2004/06/08 01:20:28  csoutheren
00038  * Provide backwards compatibility for applications using old capability API
00039  *
00040  * Revision 1.44  2004/06/01 05:47:58  csoutheren
00041  * Changed capability table to use abstract factory routines rather than internal linked list
00042  *
00043  * Revision 1.43  2004/05/13 12:49:32  rjongbloed
00044  * Fixed usage of the compare function in non-standard capabilities.
00045  *
00046  * Revision 1.42  2004/04/03 10:38:24  csoutheren
00047  * Added in initial cut at codec plugin code. Branches are for wimps :)
00048  *
00049  * Revision 1.41.2.1  2004/03/31 11:11:58  csoutheren
00050  * Initial public release of plugin codec code
00051  *
00052  * Revision 1.41  2004/03/02 11:48:14  rjongbloed
00053  * Fixed correct capability table matching when FindCapability with a mode change,
00054  *   uses different enum so needs translation table.
00055  *
00056  * Revision 1.40  2003/10/27 06:03:39  csoutheren
00057  * Added support for QoS
00058  *   Thanks to Henry Harrison of AliceStreet
00059  *
00060  * Revision 1.39  2003/06/06 02:13:10  rjongbloed
00061  * Changed non-standard capability semantics so can use C style strings as
00062  *   the embedded data block (ie automatically call strlen)
00063  *
00064  * Revision 1.38  2003/04/28 07:00:00  robertj
00065  * Fixed problem with compiler(s) not correctly initialising static globals
00066  *
00067  * Revision 1.37  2003/04/27 23:49:21  craigs
00068  * Fixed some comments and made list of registered codecs
00069  * available outside h323caps.cxx
00070  *
00071  * Revision 1.36  2002/11/09 04:24:01  robertj
00072  * Fixed minor documentation errors.
00073  *
00074  * Revision 1.35  2002/09/16 01:14:15  robertj
00075  * Added #define so can select if #pragma interface/implementation is used on
00076  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00077  *
00078  * Revision 1.34  2002/09/03 06:19:36  robertj
00079  * Normalised the multi-include header prevention ifdef/define symbol.
00080  *
00081  * Revision 1.33  2002/08/05 10:03:47  robertj
00082  * Cosmetic changes to normalise the usage of pragma interface/implementation.
00083  *
00084  * Revision 1.32  2002/05/29 03:55:17  robertj
00085  * Added protocol version number checking infrastructure, primarily to improve
00086  *   interoperability with stacks that are unforgiving of new features.
00087  *
00088  * Revision 1.31  2002/05/10 05:44:50  robertj
00089  * Added the max bit rate field to the data channel capability class.
00090  *
00091  * Revision 1.30  2002/01/22 06:25:02  robertj
00092  * Moved payload type to ancestor so any capability can adjust it on logical channel.
00093  *
00094  * Revision 1.29  2002/01/17 07:04:57  robertj
00095  * Added support for RFC2833 embedded DTMF in the RTP stream.
00096  *
00097  * Revision 1.28  2002/01/16 05:37:41  robertj
00098  * Added missing mode change functions on non standard capabilities.
00099  *
00100  * Revision 1.27  2002/01/09 00:21:36  robertj
00101  * Changes to support outgoing H.245 RequstModeChange.
00102  *
00103  * Revision 1.26  2001/12/22 01:44:05  robertj
00104  * Added more support for H.245 RequestMode operation.
00105  *
00106  * Revision 1.25  2001/10/24 01:20:34  robertj
00107  * Added code to help with static linking of H323Capability names database.
00108  *
00109  * Revision 1.24  2001/09/21 02:48:51  robertj
00110  * Added default implementation for PDU encode/decode for codecs
00111  *   that have simple integer as frames per packet.
00112  *
00113  * Revision 1.23  2001/09/11 10:21:40  robertj
00114  * Added direction field to capabilities, thanks Nick Hoath.
00115  *
00116  * Revision 1.22  2001/07/19 09:50:40  robertj
00117  * Added code for default session ID on data channel being three.
00118  *
00119  * Revision 1.21  2001/07/17 04:44:29  robertj
00120  * Partial implementation of T.120 and T.38 logical channels.
00121  *
00122  * Revision 1.20  2001/05/21 07:20:47  robertj
00123  * Removed redundent class name in declaration.
00124  *
00125  * Revision 1.19  2001/05/14 05:56:26  robertj
00126  * Added H323 capability registration system so can add capabilities by
00127  *   string name instead of having to instantiate explicit classes.
00128  *
00129  * Revision 1.18  2001/05/02 16:22:21  rogerh
00130  * Add IsAllow() for a single capability to check if it is in the
00131  * capabilities set. This fixes the bug where OpenH323 would accept
00132  * incoming H261 video even when told not to accept it.
00133  *
00134  * Revision 1.17  2001/03/16 23:00:21  robertj
00135  * Improved validation of codec selection against capability set, thanks Chris Purvis.
00136  *
00137  * Revision 1.16  2001/02/09 05:16:24  robertj
00138  * Added #pragma interface for GNU C++.
00139  *
00140  * Revision 1.15  2001/01/25 07:27:14  robertj
00141  * Major changes to add more flexible OpalMediaFormat class to normalise
00142  *   all information about media types, especially codecs.
00143  *
00144  * Revision 1.14  2001/01/09 23:05:22  robertj
00145  * Fixed inability to have 2 non standard codecs in capability table.
00146  *
00147  * Revision 1.13  2000/10/16 08:49:30  robertj
00148  * Added single function to add all UserInput capability types.
00149  *
00150  * Revision 1.12  2000/08/23 14:23:11  craigs
00151  * Added prototype support for Microsoft GSM codec
00152  *
00153  * Revision 1.11  2000/07/13 12:25:47  robertj
00154  * Fixed problems with fast start frames per packet adjustment.
00155  *
00156  * Revision 1.10  2000/07/10 16:01:50  robertj
00157  * Started fixing capability set merging, still more to do.
00158  *
00159  * Revision 1.9  2000/07/04 01:16:49  robertj
00160  * Added check for capability allowed in "combinations" set, still needs more done yet.
00161  *
00162  * Revision 1.8  2000/06/03 03:16:47  robertj
00163  * Fixed using the wrong capability table (should be connections) for some operations.
00164  *
00165  * Revision 1.7  2000/05/23 11:32:27  robertj
00166  * Rewrite of capability table to combine 2 structures into one and move functionality into that class
00167  *    allowing some normalisation of usage across several applications.
00168  * Changed H323Connection so gets a copy of capabilities instead of using endponts, allows adjustments
00169  *    to be done depending on the remote client application.
00170  *
00171  * Revision 1.6  2000/05/18 11:53:34  robertj
00172  * Changes to support doc++ documentation generation.
00173  *
00174  * Revision 1.5  2000/05/10 04:05:26  robertj
00175  * Changed capabilities so has a function to get name of codec, instead of relying on PrintOn.
00176  *
00177  * Revision 1.4  2000/05/02 04:32:24  robertj
00178  * Fixed copyright notice comment.
00179  *
00180  * Revision 1.3  2000/04/05 19:01:12  robertj
00181  * Added function so can change desired transmit packet size.
00182  *
00183  * Revision 1.2  2000/03/21 03:06:47  robertj
00184  * Changes to make RTP TX of exact numbers of frames in some codecs.
00185  *
00186  * Revision 1.1  1999/12/23 23:02:35  robertj
00187  * File reorganision for separating RTP from H.323 and creation of LID for VPB support.
00188  *
00189  */
00190 
00191 #ifndef __OPAL_H323CAPS_H
00192 #define __OPAL_H323CAPS_H
00193 
00194 #ifdef P_USE_PRAGMA
00195 #pragma interface
00196 #endif
00197 
00198 
00199 #include "codecs.h"
00200 #include "channels.h"
00201 
00202 
00203 /* The following classes have forward references to avoid including the VERY
00204    large header files for H225 and H245. If an application requires access
00205    to the protocol classes they can include them, but for simple usage their
00206    inclusion can be avoided.
00207  */
00208 class PASN_Choice;
00209 class H245_Capability;
00210 class H245_DataType;
00211 class H245_ModeElement;
00212 class H245_AudioCapability;
00213 class H245_AudioMode;
00214 class H245_VideoCapability;
00215 class H245_VideoMode;
00216 class H245_DataApplicationCapability;
00217 class H245_DataMode;
00218 class H245_DataProtocolCapability;
00219 class H245_H2250LogicalChannelParameters;
00220 class H245_TerminalCapabilitySet;
00221 class H245_NonStandardParameter;
00222 class H323Connection;
00223 class H323Capabilities;
00224 
00225 
00226 
00228 
00242 class H323Capability : public PObject
00243 {
00244   PCLASSINFO(H323Capability, PObject);
00245 
00246   public:
00251     H323Capability();
00253 
00259     Comparison Compare(const PObject & obj) const;
00260 
00263     void PrintOn(ostream & strm) const;
00265 
00268     enum MainTypes {
00270       e_Audio,
00272       e_Video,
00274       e_Data,
00276       e_UserInput,
00278       e_NumMainTypes
00279     };
00280 
00286     virtual MainTypes GetMainType() const = 0;
00287 
00291     virtual unsigned  GetSubType()  const = 0;
00292 
00295     virtual PString GetFormatName() const = 0;
00297 
00303     static H323Capability * Create(
00304       const PString & name    
00305     );
00306 
00310     static H323Capability * Create(
00311       H323EndPoint &,         
00312       const PString & name    
00313     )
00314     { return Create(name); }
00315 
00324     virtual unsigned GetDefaultSessionID() const;
00325 
00334     virtual void SetTxFramesInPacket(
00335       unsigned frames   
00336     );
00337 
00342     virtual unsigned GetTxFramesInPacket() const;
00343 
00348     virtual unsigned GetRxFramesInPacket() const;
00349 
00355     virtual H323Channel * CreateChannel(
00356       H323Connection & connection,    
00357       H323Channel::Directions dir,    
00358       unsigned sessionID,             
00359       const H245_H2250LogicalChannelParameters * param
00361     ) const = 0;
00362 
00365     virtual H323Codec * CreateCodec(
00366       H323Codec::Direction direction  
00367     ) const = 0;
00369 
00379     virtual BOOL OnSendingPDU(
00380       H245_Capability & pdu  
00381     ) const = 0;
00382 
00390     virtual BOOL OnSendingPDU(
00391       H245_DataType & pdu  
00392     ) const = 0;
00393 
00401     virtual BOOL OnSendingPDU(
00402       H245_ModeElement & pdu  
00403     ) const = 0;
00404 
00417     virtual BOOL OnReceivedPDU(
00418       const H245_Capability & pdu 
00419     );
00420 
00428     virtual BOOL OnReceivedPDU(
00429       const H245_DataType & pdu,  
00430       BOOL receiver               
00431     ) = 0;
00432 
00435     virtual BOOL IsNonStandardMatch(
00436       const H245_NonStandardParameter & param  
00437     ) const;
00438 
00446     virtual BOOL IsUsable(
00447       const H323Connection & connection
00448     ) const;
00450 
00453     enum CapabilityDirection {
00454       e_Unknown,
00455       e_Receive,
00456       e_Transmit,
00457       e_ReceiveAndTransmit,
00458       e_NoDirection,
00459       NumCapabilityDirections
00460     };
00461 
00464     CapabilityDirection GetCapabilityDirection() const { return capabilityDirection; }
00465 
00468     void SetCapabilityDirection(
00469       CapabilityDirection dir   
00470     ) { capabilityDirection = dir; }
00471 
00473     unsigned GetCapabilityNumber() const { return assignedCapabilityNumber; }
00474 
00476     void SetCapabilityNumber(unsigned num) { assignedCapabilityNumber = num; }
00477 
00479     RTP_DataFrame::PayloadTypes GetPayloadType() const { return rtpPayloadType; }
00480 
00482     virtual void AttachQoS(RTP_QOS *)
00483     {}
00485 
00486 #if PTRACING
00487     friend ostream & operator<<(ostream & o , MainTypes t);
00488     friend ostream & operator<<(ostream & o , CapabilityDirection d);
00489 #endif
00490 
00491   protected:
00492     unsigned assignedCapabilityNumber;  
00493     CapabilityDirection capabilityDirection;
00494     RTP_DataFrame::PayloadTypes rtpPayloadType;
00495 };
00496 
00497 
00498 
00508 class H323NonStandardCapabilityInfo
00509 {
00510   public:
00511     typedef PObject::Comparison (*CompareFuncType)(struct PluginCodec_H323NonStandardCodecData *);
00512 
00515     H323NonStandardCapabilityInfo(
00516       CompareFuncType compareFunc,
00517       const BYTE * dataBlock,         
00518       PINDEX dataSize                 
00519     );
00520 
00521     H323NonStandardCapabilityInfo(
00522       const BYTE * dataBlock,         
00523       PINDEX dataSize,                
00524       PINDEX comparisonOffset = 0,    
00525       PINDEX comparisonLength = P_MAX_INDEX    
00526     );
00527 
00530     H323NonStandardCapabilityInfo(
00531       const PString & oid,
00532       const BYTE * dataBlock,         
00533       PINDEX dataSize,                
00534       PINDEX comparisonOffset = 0,
00535       PINDEX comparisonLength = P_MAX_INDEX
00536     );
00537 
00540     H323NonStandardCapabilityInfo(
00541       BYTE country,                  
00542       BYTE extension,                
00543       WORD maufacturer,              
00544       const BYTE * dataBlock,        
00545       PINDEX dataSize,               
00546       PINDEX comparisonOffset = 0,   
00547       PINDEX comparisonLength = P_MAX_INDEX  
00548     );
00549 
00552     virtual ~H323NonStandardCapabilityInfo();
00553 
00558     virtual BOOL OnSendingPDU(
00559       PBYTEArray & data  
00560     ) const;
00561 
00566     virtual BOOL OnReceivedPDU(
00567       const PBYTEArray & data  
00568     );
00569 
00570   protected:
00571     BOOL OnSendingNonStandardPDU(
00572       PASN_Choice & pdu,
00573       unsigned nonStandardTag
00574     ) const;
00575     BOOL OnReceivedNonStandardPDU(
00576       const PASN_Choice & pdu,
00577       unsigned nonStandardTag
00578     );
00579 
00580     PObject::Comparison CompareParam(
00581       const H245_NonStandardParameter & param
00582     ) const;
00583     PObject::Comparison CompareInfo(
00584       const H323NonStandardCapabilityInfo & obj
00585     ) const;
00586     PObject::Comparison CompareData(
00587       const PBYTEArray & data  
00588     ) const;
00589 
00590     PString    oid;
00591     BYTE       t35CountryCode;
00592     BYTE       t35Extension;
00593     WORD       manufacturerCode;
00594     PBYTEArray nonStandardData;
00595     PINDEX     comparisonOffset;
00596     PINDEX     comparisonLength;
00597     CompareFuncType compareFunc;
00598 };
00599 
00600 
00607 class H323RealTimeCapability : public H323Capability
00608 {
00609   PCLASSINFO(H323RealTimeCapability, H323Capability);
00610 
00611   public:
00616     virtual H323Channel * CreateChannel(
00617       H323Connection & connection,    
00618       H323Channel::Directions dir,    
00619       unsigned sessionID,             
00620       const H245_H2250LogicalChannelParameters * param
00622     ) const;
00623 
00624     H323RealTimeCapability();
00625     H323RealTimeCapability(const H323RealTimeCapability &rtc);
00626     virtual ~H323RealTimeCapability();
00627     void AttachQoS(RTP_QOS * _rtpqos);
00628 
00629   protected:
00630     RTP_QOS * rtpqos;
00632 };
00633 
00634 
00641 class H323AudioCapability : public H323RealTimeCapability
00642 {
00643   PCLASSINFO(H323AudioCapability, H323RealTimeCapability);
00644 
00645   public:
00650     H323AudioCapability(
00651       unsigned rxPacketSize, 
00652       unsigned txPacketSize  
00653     );
00655 
00661     virtual MainTypes GetMainType() const;
00663 
00674     virtual unsigned GetDefaultSessionID() const;
00675 
00684     virtual void SetTxFramesInPacket(
00685       unsigned frames   
00686     );
00687 
00693     virtual unsigned GetTxFramesInPacket() const;
00694 
00700     virtual unsigned GetRxFramesInPacket() const;
00702 
00713     virtual BOOL OnSendingPDU(
00714       H245_Capability & pdu  
00715     ) const;
00716 
00725     virtual BOOL OnSendingPDU(
00726       H245_DataType & pdu  
00727     ) const;
00728 
00737     virtual BOOL OnSendingPDU(
00738       H245_ModeElement & pdu  
00739     ) const;
00740 
00749     virtual BOOL OnSendingPDU(
00750       H245_AudioCapability & pdu,  
00751       unsigned packetSize          
00752     ) const;
00753 
00762     virtual BOOL OnSendingPDU(
00763       H245_AudioMode & pdu  
00764     ) const;
00765 
00777     virtual BOOL OnReceivedPDU(
00778       const H245_Capability & pdu  
00779     );
00780 
00790     virtual BOOL OnReceivedPDU(
00791       const H245_DataType & pdu,  
00792       BOOL receiver               
00793     );
00794 
00803     virtual BOOL OnReceivedPDU(
00804       const H245_AudioCapability & pdu,  
00805       unsigned & packetSize              
00806     );
00808 
00809   protected:
00810     unsigned rxFramesInPacket;
00811     unsigned txFramesInPacket;
00812 };
00813 
00814 
00822 class H323NonStandardAudioCapability : public H323AudioCapability,
00823                                        public H323NonStandardCapabilityInfo
00824 {
00825   PCLASSINFO(H323NonStandardAudioCapability, H323AudioCapability);
00826 
00827   public:
00832     H323NonStandardAudioCapability(
00833       unsigned maxPacketSize,         
00834       unsigned desiredPacketSize,     
00835       H323NonStandardCapabilityInfo::CompareFuncType compareFunc,
00836       const BYTE * dataBlock,         
00837       PINDEX dataSize                 
00838     );
00839     H323NonStandardAudioCapability(
00840       unsigned maxPacketSize,         
00841       unsigned desiredPacketSize,     
00842       const BYTE * dataBlock,         
00843       PINDEX dataSize,                
00844       PINDEX comparisonOffset = 0,    
00845       PINDEX comparisonLength = P_MAX_INDEX     
00846      );
00850     H323NonStandardAudioCapability(
00851       unsigned maxPacketSize,         
00852       unsigned desiredPacketSize,     
00853       H323EndPoint &,
00854       H323NonStandardCapabilityInfo::CompareFuncType compareFunc,
00855       const BYTE * dataBlock,         
00856       PINDEX dataSize                 
00857     );
00858     H323NonStandardAudioCapability(
00859       unsigned maxPacketSize,         
00860       unsigned desiredPacketSize,     
00861       H323EndPoint &,
00862       const BYTE * dataBlock,         
00863       PINDEX dataSize,                
00864       PINDEX comparisonOffset = 0,    
00865       PINDEX comparisonLength = P_MAX_INDEX         
00866      );
00867 
00870     H323NonStandardAudioCapability(
00871       unsigned maxPacketSize,         
00872       unsigned desiredPacketSize,     
00873       const PString & oid,            
00874       const BYTE * dataBlock,         
00875       PINDEX dataSize,                
00876       PINDEX comparisonOffset = 0,    
00877       PINDEX comparisonLength = P_MAX_INDEX  
00878     );
00879 
00882     H323NonStandardAudioCapability(
00883       unsigned maxPacketSize,         
00884       unsigned desiredPacketSize,     
00885       BYTE country,                   
00886       BYTE extension,                 
00887       WORD maufacturer,               
00888       const BYTE * dataBlock,         
00889       PINDEX dataSize,                
00890       PINDEX comparisonOffset = 0,        
00891       PINDEX comparisonLength = P_MAX_INDEX        
00892     );
00894 
00900     Comparison Compare(const PObject & obj) const;
00902 
00910     virtual unsigned GetSubType() const;
00912 
00923     virtual BOOL OnSendingPDU(
00924       H245_AudioCapability & pdu,  
00925       unsigned packetSize          
00926     ) const;
00927 
00936     virtual BOOL OnSendingPDU(
00937       H245_AudioMode & pdu  
00938     ) const;
00939 
00948     virtual BOOL OnReceivedPDU(
00949       const H245_AudioCapability & pdu,  
00950       unsigned & packetSize              
00951     );
00952 
00955     virtual BOOL IsNonStandardMatch(
00956       const H245_NonStandardParameter & param  
00957     ) const;
00959 };
00960 
00961 
00968 class H323VideoCapability : public H323RealTimeCapability
00969 {
00970   PCLASSINFO(H323VideoCapability, H323RealTimeCapability);
00971 
00972   public:
00978     virtual MainTypes GetMainType() const;
00980 
00991     virtual unsigned GetDefaultSessionID() const;
00993 
01004     virtual BOOL OnSendingPDU(
01005       H245_Capability & pdu  
01006     ) const;
01007 
01016     virtual BOOL OnSendingPDU(
01017       H245_DataType & pdu  
01018     ) const;
01019 
01028     virtual BOOL OnSendingPDU(
01029       H245_ModeElement & pdu  
01030     ) const;
01031 
01039     virtual BOOL OnSendingPDU(
01040       H245_VideoCapability & pdu  
01041     ) const = 0;
01042 
01051     virtual BOOL OnSendingPDU(
01052       H245_VideoMode & pdu  
01053     ) const = 0;
01054 
01064     virtual BOOL OnReceivedPDU(
01065       const H245_Capability & pdu  
01066     );
01067 
01075     virtual BOOL OnReceivedPDU(
01076       const H245_DataType & pdu,  
01077       BOOL receiver               
01078     );
01079 
01087     virtual BOOL OnReceivedPDU(
01088       const H245_VideoCapability & pdu  
01089     ) = 0;
01091 };
01092 
01093 
01101 class H323NonStandardVideoCapability : public H323VideoCapability,
01102                                        public H323NonStandardCapabilityInfo
01103 {
01104   PCLASSINFO(H323NonStandardVideoCapability, H323VideoCapability);
01105 
01106   public:
01111     H323NonStandardVideoCapability(
01112       const BYTE * dataBlock,         
01113       PINDEX dataSize,                
01114       PINDEX comparisonOffset = 0,    
01115       PINDEX comparisonLength = P_MAX_INDEX  
01116     );
01117 
01121     H323NonStandardVideoCapability(
01122       H323EndPoint &,
01123       const BYTE * dataBlock,         
01124       PINDEX dataSize,                
01125       PINDEX comparisonOffset = 0,    
01126       PINDEX comparisonLength = P_MAX_INDEX  
01127     );
01128 
01131     H323NonStandardVideoCapability(
01132       const PString & oid,            
01133       const BYTE * dataBlock,         
01134       PINDEX dataSize,                
01135       PINDEX comparisonOffset = 0,    
01136       PINDEX comparisonLength = P_MAX_INDEX  
01137     );
01138 
01141     H323NonStandardVideoCapability(
01142       BYTE country,                   
01143       BYTE extension,                 
01144       WORD maufacturer,               
01145       const BYTE * dataBlock,         
01146       PINDEX dataSize,                
01147       PINDEX comparisonOffset = 0,    
01148       PINDEX comparisonLength = P_MAX_INDEX  
01149     );
01151 
01157     Comparison Compare(const PObject & obj) const;
01159 
01168     virtual unsigned GetSubType() const;
01170 
01181     virtual BOOL OnSendingPDU(
01182       H245_VideoCapability & pdu  
01183     ) const;
01184 
01193     virtual BOOL OnSendingPDU(
01194       H245_VideoMode & pdu  
01195     ) const;
01196 
01205     virtual BOOL OnReceivedPDU(
01206       const H245_VideoCapability & pdu  
01207     );
01208 
01211     virtual BOOL IsNonStandardMatch(
01212       const H245_NonStandardParameter & param  
01213     ) const;
01215 };
01216 
01217 
01224 class H323DataCapability : public H323Capability
01225 {
01226   PCLASSINFO(H323DataCapability, H323Capability);
01227 
01228   public:
01233     H323DataCapability(
01234       unsigned maxBitRate = 0  
01235     );
01237 
01243     virtual MainTypes GetMainType() const;
01245 
01255     virtual unsigned GetDefaultSessionID() const;
01256 
01260     virtual H323Codec * CreateCodec(
01261       H323Codec::Direction direction  
01262     ) const;
01264 
01275     virtual BOOL OnSendingPDU(
01276       H245_Capability & pdu  
01277     ) const;
01278 
01287     virtual BOOL OnSendingPDU(
01288       H245_DataType & pdu  
01289     ) const;
01290 
01299     virtual BOOL OnSendingPDU(
01300       H245_ModeElement & pdu  
01301     ) const;
01302 
01310     virtual BOOL OnSendingPDU(
01311       H245_DataApplicationCapability & pdu  
01312     ) const = 0;
01313 
01322     virtual BOOL OnSendingPDU(
01323       H245_DataMode & pdu  
01324     ) const = 0;
01325 
01335     virtual BOOL OnReceivedPDU(
01336       const H245_Capability & pdu  
01337     );
01338 
01346     virtual BOOL OnReceivedPDU(
01347       const H245_DataType & pdu,  
01348       BOOL receiver               
01349     );
01350 
01358     virtual BOOL OnReceivedPDU(
01359       const H245_DataApplicationCapability & pdu  
01360     ) = 0;
01362 
01363   protected:
01364     unsigned maxBitRate;
01365 };
01366 
01367 
01375 class H323NonStandardDataCapability : public H323DataCapability,
01376                                       public H323NonStandardCapabilityInfo
01377 {
01378   PCLASSINFO(H323NonStandardDataCapability, H323DataCapability);
01379 
01380   public:
01385     H323NonStandardDataCapability(
01386       unsigned maxBitRate,            
01387       const BYTE * dataBlock,         
01388       PINDEX dataSize,                
01389       PINDEX comparisonOffset = 0,    
01390       PINDEX comparisonLength = P_MAX_INDEX  
01391     );
01392 
01395     H323NonStandardDataCapability(
01396       unsigned maxBitRate,            
01397       const PString & oid,            
01398       const BYTE * dataBlock,         
01399       PINDEX dataSize,                
01400       PINDEX comparisonOffset = 0,    
01401       PINDEX comparisonLength = P_MAX_INDEX  
01402     );
01403 
01406     H323NonStandardDataCapability(
01407       unsigned maxBitRate,            
01408       BYTE country,                   
01409       BYTE extension,                 
01410       WORD maufacturer,               
01411       const BYTE * dataBlock,         
01412       PINDEX dataSize,                
01413       PINDEX comparisonOffset = 0,    
01414       PINDEX comparisonLength = P_MAX_INDEX  
01415     );
01417 
01423     Comparison Compare(const PObject & obj) const;
01425 
01434     virtual unsigned GetSubType() const;
01436 
01447     virtual BOOL OnSendingPDU(
01448       H245_DataApplicationCapability & pdu  
01449     ) const;
01450 
01459     virtual BOOL OnSendingPDU(
01460       H245_DataMode & pdu  
01461     ) const;
01462 
01471     virtual BOOL OnReceivedPDU(
01472       const H245_DataApplicationCapability & pdu  
01473     );
01474 
01477     virtual BOOL IsNonStandardMatch(
01478       const H245_NonStandardParameter & param  
01479     ) const;
01481 };
01482 
01483 
01485 // The simplest codec is the G.711 PCM codec.
01486 
01489 class H323_G711Capability : public H323AudioCapability
01490 {
01491   PCLASSINFO(H323_G711Capability, H323AudioCapability)
01492 
01493   public:
01495     enum Mode {
01497       ALaw,
01499       muLaw
01500     };
01502     enum Speed {
01504       At64k,
01506       At56k
01507     };
01508 
01513     H323_G711Capability(
01514       Mode mode = muLaw,    
01515       Speed speed = At64k   
01516     );
01518 
01523     virtual PObject * Clone() const;
01525 
01534     virtual unsigned GetSubType() const;
01535 
01538     virtual PString GetFormatName() const;
01540 
01545     virtual H323Codec * CreateCodec(
01546       H323Codec::Direction direction  
01547     ) const;
01549 
01550   protected:
01551     Mode     mode;
01552     Speed    speed;
01553 };
01554 
01555 
01557 
01560 class H323_UserInputCapability : public H323Capability
01561 {
01562   PCLASSINFO(H323_UserInputCapability, H323Capability);
01563 
01564   public:
01567     enum SubTypes {
01568       BasicString,
01569       IA5String,
01570       GeneralString,
01571       SignalToneH245,
01572       HookFlashH245,
01573       SignalToneRFC2833,
01574       NumSubTypes
01575     };
01576     static const char * const SubTypeNames[NumSubTypes];
01577 
01582     H323_UserInputCapability(
01583       SubTypes subType
01584     );
01586 
01591     virtual PObject * Clone() const;
01593 
01601     virtual MainTypes GetMainType() const;
01602 
01606     virtual unsigned  GetSubType()  const;
01607 
01610     virtual PString GetFormatName() const;
01612 
01620     virtual H323Channel * CreateChannel(
01621       H323Connection & connection,    
01622       H323Channel::Directions dir,    
01623       unsigned sessionID,             
01624       const H245_H2250LogicalChannelParameters * param
01626     ) const;
01627 
01630     virtual H323Codec * CreateCodec(
01631       H323Codec::Direction direction  
01632     ) const;
01634 
01644     virtual BOOL OnSendingPDU(
01645       H245_Capability & pdu  
01646     ) const;
01647 
01655     virtual BOOL OnSendingPDU(
01656       H245_DataType & pdu  
01657     ) const;
01658 
01667     virtual BOOL OnSendingPDU(
01668       H245_ModeElement & pdu  
01669     ) const;
01670 
01680     virtual BOOL OnReceivedPDU(
01681       const H245_Capability & pdu  
01682     );
01683 
01691     virtual BOOL OnReceivedPDU(
01692       const H245_DataType & pdu,  
01693       BOOL receiver               
01694     );
01695 
01704     virtual BOOL IsUsable(
01705       const H323Connection & connection
01706     ) const;
01708 
01709     static void AddAllCapabilities(
01710       H323Capabilities & capabilities,        
01711       PINDEX descriptorNum,   
01712       PINDEX simultaneous     
01713     );
01714 
01715   protected:
01716     SubTypes subType;
01717 };
01718 
01719 
01720 
01722 
01723 PLIST(H323CapabilitiesList, H323Capability);
01724 
01725 PARRAY(H323CapabilitiesListArray, H323CapabilitiesList);
01726 
01727 class H323SimultaneousCapabilities : public H323CapabilitiesListArray
01728 {
01729   PCLASSINFO(H323SimultaneousCapabilities, H323CapabilitiesListArray);
01730   public:
01731     BOOL SetSize(PINDEX newSize);
01732 };
01733 
01734 
01735 PARRAY(H323CapabilitiesSetArray, H323SimultaneousCapabilities);
01736 
01737 
01738 class H323CapabilitiesSet : public H323CapabilitiesSetArray
01739 {
01740   PCLASSINFO(H323CapabilitiesSet, H323CapabilitiesSetArray);
01741   public:
01743     BOOL SetSize(PINDEX newSize);
01744 };
01745 
01746 
01749 class H323Capabilities : public PObject
01750 {
01751     PCLASSINFO(H323Capabilities, PObject);
01752   public:
01757     H323Capabilities();
01758 
01761     H323Capabilities(
01762       const H323Connection & connection,      
01763       const H245_TerminalCapabilitySet & pdu  
01764     );
01765 
01770     H323Capabilities(
01771       const H323Capabilities & original 
01772     );
01773 
01778     H323Capabilities & operator=(
01779       const H323Capabilities & original 
01780     );
01782 
01787     void PrintOn(
01788       ostream & strm    
01789     ) const;
01791 
01796     PINDEX GetSize() const { return table.GetSize(); }
01797 
01800     H323Capability & operator[](PINDEX i) const { return table[i]; }
01801 
01822     PINDEX SetCapability(
01823       PINDEX descriptorNum, 
01824       PINDEX simultaneous,  
01825       H323Capability * cap  
01826     );
01827 
01832     PINDEX AddAllCapabilities(
01833       PINDEX descriptorNum, 
01834       PINDEX simultaneous,  
01835       const PString & name  
01836     );
01837     PINDEX AddAllCapabilities(
01838       H323EndPoint &,
01839       PINDEX descriptorNum, 
01840       PINDEX simultaneous,  
01841       const PString & name  
01842     )
01843     { return AddAllCapabilities(descriptorNum, simultaneous, name); }
01844 
01853     void Add(
01854       H323Capability * capability   
01855     );
01856 
01863     H323Capability * Copy(
01864       const H323Capability & capability   
01865     );
01866 
01871     void Remove(
01872       H323Capability * capability   
01873     );
01874 
01879     void Remove(
01880       const PString & formatName   
01881     );
01882 
01886     void Remove(
01887       const PStringArray & formatNames  
01888     );
01889 
01892     void RemoveAll();
01893 
01901     H323Capability * FindCapability(
01902       unsigned capabilityNumber
01903     ) const;
01904 
01920     H323Capability * FindCapability(
01921       const PString & formatName, 
01922       H323Capability::CapabilityDirection direction = H323Capability::e_Unknown
01924     ) const;
01925 
01931     H323Capability * FindCapability(
01932       H323Capability::CapabilityDirection direction 
01933     ) const;
01934 
01942     H323Capability * FindCapability(
01943       const H323Capability & capability 
01944     ) const;
01945 
01951     H323Capability * FindCapability(
01952       const H245_Capability & cap  
01953     ) const;
01954 
01960     H323Capability * FindCapability(
01961       const H245_DataType & dataType  
01962     ) const;
01963 
01969     H323Capability * FindCapability(
01970       const H245_ModeElement & modeElement  
01971     ) const;
01972 
01978     H323Capability * FindCapability(
01979       H323Capability::MainTypes mainType, 
01980       const PASN_Choice & subTypePDU,     
01981       const unsigned * translationTable   
01982     ) const;
01983 
01989     H323Capability * FindCapability(
01990       H323Capability::MainTypes mainType, 
01991       unsigned subType = UINT_MAX         
01992     ) const;
01993 
01996     void BuildPDU(
01997       const H323Connection & connection,  
01998       H245_TerminalCapabilitySet & pdu    
01999     ) const;
02000 
02003     BOOL Merge(
02004       const H323Capabilities & newCaps
02005     );
02006 
02013     void Reorder(
02014       const PStringArray & preferenceOrder  
02015     );
02016 
02019     BOOL IsAllowed(
02020       const H323Capability & capability
02021     );
02022 
02025     BOOL IsAllowed(
02026       unsigned capabilityNumber
02027     );
02028 
02031     BOOL IsAllowed(
02032       const H323Capability & capability1,
02033       const H323Capability & capability2
02034     );
02035 
02038     BOOL IsAllowed(
02039       unsigned capabilityNumber1,
02040       unsigned capabilityNumber2
02041     );
02043 
02044   protected:
02045     H323CapabilitiesList table;
02046     H323CapabilitiesSet  set;
02047 };
02048 
02049 
02051 
02052 typedef PFactory<H323Capability> H323CapabilityFactory;
02053 
02054 #define H323_REGISTER_CAPABILITY(cls, capName)   static H323CapabilityFactory::Worker<cls> cls##Factory(capName, true); \
02055 
02056 #define H323_DEFINE_CAPABILITY(cls, capName, fmtName) \
02057 class cls : public H323Capability { \
02058   public: \
02059     cls() : H323Capability() { } \
02060     PString GetFormatName() const \
02061     { return fmtName; } \
02062 }; \
02063 H323_REGISTER_CAPABILITY(cls, capName) \
02064 
02065 #define H323_DEFINE_CAPABILITY_FROM(cls, ancestor, capName, fmtName) \
02066 class cls : public ancestor { \
02067   public: \
02068     cls() : ancestor() { } \
02069     PString GetFormatName() const \
02070     { return fmtName; } \
02071 }; \
02072 H323_REGISTER_CAPABILITY(cls, capName) \
02073 
02074 #endif // __OPAL_H323CAPS_H
02075 
02076 

Generated on Mon Sep 26 15:44:46 2005 for OpenH323 by  doxygen 1.4.4