Main Page | Class Hierarchy | Class List | File List | 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.46 2004/06/30 12:31:09 rjongbloed 00031 * Rewrite of plug in system to use single global variable for all factories to avoid all sorts 00032 * of issues with startup orders and Windows DLL multiple instances. 00033 * 00034 * Revision 1.45 2004/06/08 01:20:28 csoutheren 00035 * Provide backwards compatibility for applications using old capability API 00036 * 00037 * Revision 1.44 2004/06/01 05:47:58 csoutheren 00038 * Changed capability table to use abstract factory routines rather than internal linked list 00039 * 00040 * Revision 1.43 2004/05/13 12:49:32 rjongbloed 00041 * Fixed usage of the compare function in non-standard capabilities. 00042 * 00043 * Revision 1.42 2004/04/03 10:38:24 csoutheren 00044 * Added in initial cut at codec plugin code. Branches are for wimps :) 00045 * 00046 * Revision 1.41.2.1 2004/03/31 11:11:58 csoutheren 00047 * Initial public release of plugin codec code 00048 * 00049 * Revision 1.41 2004/03/02 11:48:14 rjongbloed 00050 * Fixed correct capability table matching when FindCapability with a mode change, 00051 * uses different enum so needs translation table. 00052 * 00053 * Revision 1.40 2003/10/27 06:03:39 csoutheren 00054 * Added support for QoS 00055 * Thanks to Henry Harrison of AliceStreet 00056 * 00057 * Revision 1.39 2003/06/06 02:13:10 rjongbloed 00058 * Changed non-standard capability semantics so can use C style strings as 00059 * the embedded data block (ie automatically call strlen) 00060 * 00061 * Revision 1.38 2003/04/28 07:00:00 robertj 00062 * Fixed problem with compiler(s) not correctly initialising static globals 00063 * 00064 * Revision 1.37 2003/04/27 23:49:21 craigs 00065 * Fixed some comments and made list of registered codecs 00066 * available outside h323caps.cxx 00067 * 00068 * Revision 1.36 2002/11/09 04:24:01 robertj 00069 * Fixed minor documentation errors. 00070 * 00071 * Revision 1.35 2002/09/16 01:14:15 robertj 00072 * Added #define so can select if #pragma interface/implementation is used on 00073 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00074 * 00075 * Revision 1.34 2002/09/03 06:19:36 robertj 00076 * Normalised the multi-include header prevention ifdef/define symbol. 00077 * 00078 * Revision 1.33 2002/08/05 10:03:47 robertj 00079 * Cosmetic changes to normalise the usage of pragma interface/implementation. 00080 * 00081 * Revision 1.32 2002/05/29 03:55:17 robertj 00082 * Added protocol version number checking infrastructure, primarily to improve 00083 * interoperability with stacks that are unforgiving of new features. 00084 * 00085 * Revision 1.31 2002/05/10 05:44:50 robertj 00086 * Added the max bit rate field to the data channel capability class. 00087 * 00088 * Revision 1.30 2002/01/22 06:25:02 robertj 00089 * Moved payload type to ancestor so any capability can adjust it on logical channel. 00090 * 00091 * Revision 1.29 2002/01/17 07:04:57 robertj 00092 * Added support for RFC2833 embedded DTMF in the RTP stream. 00093 * 00094 * Revision 1.28 2002/01/16 05:37:41 robertj 00095 * Added missing mode change functions on non standard capabilities. 00096 * 00097 * Revision 1.27 2002/01/09 00:21:36 robertj 00098 * Changes to support outgoing H.245 RequstModeChange. 00099 * 00100 * Revision 1.26 2001/12/22 01:44:05 robertj 00101 * Added more support for H.245 RequestMode operation. 00102 * 00103 * Revision 1.25 2001/10/24 01:20:34 robertj 00104 * Added code to help with static linking of H323Capability names database. 00105 * 00106 * Revision 1.24 2001/09/21 02:48:51 robertj 00107 * Added default implementation for PDU encode/decode for codecs 00108 * that have simple integer as frames per packet. 00109 * 00110 * Revision 1.23 2001/09/11 10:21:40 robertj 00111 * Added direction field to capabilities, thanks Nick Hoath. 00112 * 00113 * Revision 1.22 2001/07/19 09:50:40 robertj 00114 * Added code for default session ID on data channel being three. 00115 * 00116 * Revision 1.21 2001/07/17 04:44:29 robertj 00117 * Partial implementation of T.120 and T.38 logical channels. 00118 * 00119 * Revision 1.20 2001/05/21 07:20:47 robertj 00120 * Removed redundent class name in declaration. 00121 * 00122 * Revision 1.19 2001/05/14 05:56:26 robertj 00123 * Added H323 capability registration system so can add capabilities by 00124 * string name instead of having to instantiate explicit classes. 00125 * 00126 * Revision 1.18 2001/05/02 16:22:21 rogerh 00127 * Add IsAllow() for a single capability to check if it is in the 00128 * capabilities set. This fixes the bug where OpenH323 would accept 00129 * incoming H261 video even when told not to accept it. 00130 * 00131 * Revision 1.17 2001/03/16 23:00:21 robertj 00132 * Improved validation of codec selection against capability set, thanks Chris Purvis. 00133 * 00134 * Revision 1.16 2001/02/09 05:16:24 robertj 00135 * Added #pragma interface for GNU C++. 00136 * 00137 * Revision 1.15 2001/01/25 07:27:14 robertj 00138 * Major changes to add more flexible OpalMediaFormat class to normalise 00139 * all information about media types, especially codecs. 00140 * 00141 * Revision 1.14 2001/01/09 23:05:22 robertj 00142 * Fixed inability to have 2 non standard codecs in capability table. 00143 * 00144 * Revision 1.13 2000/10/16 08:49:30 robertj 00145 * Added single function to add all UserInput capability types. 00146 * 00147 * Revision 1.12 2000/08/23 14:23:11 craigs 00148 * Added prototype support for Microsoft GSM codec 00149 * 00150 * Revision 1.11 2000/07/13 12:25:47 robertj 00151 * Fixed problems with fast start frames per packet adjustment. 00152 * 00153 * Revision 1.10 2000/07/10 16:01:50 robertj 00154 * Started fixing capability set merging, still more to do. 00155 * 00156 * Revision 1.9 2000/07/04 01:16:49 robertj 00157 * Added check for capability allowed in "combinations" set, still needs more done yet. 00158 * 00159 * Revision 1.8 2000/06/03 03:16:47 robertj 00160 * Fixed using the wrong capability table (should be connections) for some operations. 00161 * 00162 * Revision 1.7 2000/05/23 11:32:27 robertj 00163 * Rewrite of capability table to combine 2 structures into one and move functionality into that class 00164 * allowing some normalisation of usage across several applications. 00165 * Changed H323Connection so gets a copy of capabilities instead of using endponts, allows adjustments 00166 * to be done depending on the remote client application. 00167 * 00168 * Revision 1.6 2000/05/18 11:53:34 robertj 00169 * Changes to support doc++ documentation generation. 00170 * 00171 * Revision 1.5 2000/05/10 04:05:26 robertj 00172 * Changed capabilities so has a function to get name of codec, instead of relying on PrintOn. 00173 * 00174 * Revision 1.4 2000/05/02 04:32:24 robertj 00175 * Fixed copyright notice comment. 00176 * 00177 * Revision 1.3 2000/04/05 19:01:12 robertj 00178 * Added function so can change desired transmit packet size. 00179 * 00180 * Revision 1.2 2000/03/21 03:06:47 robertj 00181 * Changes to make RTP TX of exact numbers of frames in some codecs. 00182 * 00183 * Revision 1.1 1999/12/23 23:02:35 robertj 00184 * File reorganision for separating RTP from H.323 and creation of LID for VPB support. 00185 * 00186 */ 00187 00188 #ifndef __OPAL_H323CAPS_H 00189 #define __OPAL_H323CAPS_H 00190 00191 #ifdef P_USE_PRAGMA 00192 #pragma interface 00193 #endif 00194 00195 00196 #include "codecs.h" 00197 #include "channels.h" 00198 00199 00200 /* The following classes have forward references to avoid including the VERY 00201 large header files for H225 and H245. If an application requires access 00202 to the protocol classes they can include them, but for simple usage their 00203 inclusion can be avoided. 00204 */ 00205 class PASN_Choice; 00206 class H245_Capability; 00207 class H245_DataType; 00208 class H245_ModeElement; 00209 class H245_AudioCapability; 00210 class H245_AudioMode; 00211 class H245_VideoCapability; 00212 class H245_VideoMode; 00213 class H245_DataApplicationCapability; 00214 class H245_DataMode; 00215 class H245_DataProtocolCapability; 00216 class H245_H2250LogicalChannelParameters; 00217 class H245_TerminalCapabilitySet; 00218 class H245_NonStandardParameter; 00219 class H323Connection; 00220 class H323Capabilities; 00221 00222 00223 00225 00239 class H323Capability : public PObject 00240 { 00241 PCLASSINFO(H323Capability, PObject); 00242 00243 public: 00248 H323Capability(); 00250 00256 Comparison Compare(const PObject & obj) const; 00257 00260 void PrintOn(ostream & strm) const; 00262 00265 enum MainTypes { 00267 e_Audio, 00269 e_Video, 00271 e_Data, 00273 e_UserInput, 00275 e_NumMainTypes 00276 }; 00277 00283 virtual MainTypes GetMainType() const = 0; 00284 00288 virtual unsigned GetSubType() const = 0; 00289 00292 virtual PString GetFormatName() const = 0; 00294 00300 static H323Capability * Create( 00301 const PString & name 00302 ); 00303 00307 static H323Capability * Create( 00308 H323EndPoint &, 00309 const PString & name 00310 ) 00311 { return Create(name); } 00312 00321 virtual unsigned GetDefaultSessionID() const; 00322 00331 virtual void SetTxFramesInPacket( 00332 unsigned frames 00333 ); 00334 00339 virtual unsigned GetTxFramesInPacket() const; 00340 00345 virtual unsigned GetRxFramesInPacket() const; 00346 00352 virtual H323Channel * CreateChannel( 00353 H323Connection & connection, 00354 H323Channel::Directions dir, 00355 unsigned sessionID, 00356 const H245_H2250LogicalChannelParameters * param 00358 ) const = 0; 00359 00362 virtual H323Codec * CreateCodec( 00363 H323Codec::Direction direction 00364 ) const = 0; 00366 00376 virtual BOOL OnSendingPDU( 00377 H245_Capability & pdu 00378 ) const = 0; 00379 00387 virtual BOOL OnSendingPDU( 00388 H245_DataType & pdu 00389 ) const = 0; 00390 00398 virtual BOOL OnSendingPDU( 00399 H245_ModeElement & pdu 00400 ) const = 0; 00401 00414 virtual BOOL OnReceivedPDU( 00415 const H245_Capability & pdu 00416 ); 00417 00425 virtual BOOL OnReceivedPDU( 00426 const H245_DataType & pdu, 00427 BOOL receiver 00428 ) = 0; 00429 00432 virtual BOOL IsNonStandardMatch( 00433 const H245_NonStandardParameter & param 00434 ) const; 00435 00443 virtual BOOL IsUsable( 00444 const H323Connection & connection 00445 ) const; 00447 00450 enum CapabilityDirection { 00451 e_Unknown, 00452 e_Receive, 00453 e_Transmit, 00454 e_ReceiveAndTransmit, 00455 e_NoDirection, 00456 NumCapabilityDirections 00457 }; 00458 00461 CapabilityDirection GetCapabilityDirection() const { return capabilityDirection; } 00462 00465 void SetCapabilityDirection( 00466 CapabilityDirection dir 00467 ) { capabilityDirection = dir; } 00468 00470 unsigned GetCapabilityNumber() const { return assignedCapabilityNumber; } 00471 00473 void SetCapabilityNumber(unsigned num) { assignedCapabilityNumber = num; } 00474 00476 RTP_DataFrame::PayloadTypes GetPayloadType() const { return rtpPayloadType; } 00477 00479 virtual void AttachQoS(RTP_QOS *) 00480 {} 00482 00483 #if PTRACING 00484 friend ostream & operator<<(ostream & o , MainTypes t); 00485 friend ostream & operator<<(ostream & o , CapabilityDirection d); 00486 #endif 00487 00488 protected: 00489 unsigned assignedCapabilityNumber; 00490 CapabilityDirection capabilityDirection; 00491 RTP_DataFrame::PayloadTypes rtpPayloadType; 00492 }; 00493 00494 00495 00505 class H323NonStandardCapabilityInfo 00506 { 00507 public: 00508 typedef PObject::Comparison (*CompareFuncType)(struct PluginCodec_H323NonStandardCodecData *); 00509 00512 H323NonStandardCapabilityInfo( 00513 CompareFuncType compareFunc 00514 ); 00515 00516 H323NonStandardCapabilityInfo( 00517 const BYTE * dataBlock, 00518 PINDEX dataSize, 00519 PINDEX comparisonOffset = 0, 00520 PINDEX comparisonLength = P_MAX_INDEX 00521 ); 00522 00525 H323NonStandardCapabilityInfo( 00526 const PString & oid, 00527 const BYTE * dataBlock, 00528 PINDEX dataSize, 00529 PINDEX comparisonOffset = 0, 00530 PINDEX comparisonLength = P_MAX_INDEX 00531 ); 00532 00535 H323NonStandardCapabilityInfo( 00536 BYTE country, 00537 BYTE extension, 00538 WORD maufacturer, 00539 const BYTE * dataBlock, 00540 PINDEX dataSize, 00541 PINDEX comparisonOffset = 0, 00542 PINDEX comparisonLength = P_MAX_INDEX 00543 ); 00544 00547 virtual ~H323NonStandardCapabilityInfo(); 00548 00553 virtual BOOL OnSendingPDU( 00554 PBYTEArray & data 00555 ) const; 00556 00561 virtual BOOL OnReceivedPDU( 00562 const PBYTEArray & data 00563 ); 00564 00565 protected: 00566 BOOL OnSendingNonStandardPDU( 00567 PASN_Choice & pdu, 00568 unsigned nonStandardTag 00569 ) const; 00570 BOOL OnReceivedNonStandardPDU( 00571 const PASN_Choice & pdu, 00572 unsigned nonStandardTag 00573 ); 00574 00575 PObject::Comparison CompareParam( 00576 const H245_NonStandardParameter & param 00577 ) const; 00578 PObject::Comparison CompareInfo( 00579 const H323NonStandardCapabilityInfo & obj 00580 ) const; 00581 PObject::Comparison CompareData( 00582 const PBYTEArray & data 00583 ) const; 00584 00585 PString oid; 00586 BYTE t35CountryCode; 00587 BYTE t35Extension; 00588 WORD manufacturerCode; 00589 PBYTEArray nonStandardData; 00590 PINDEX comparisonOffset; 00591 PINDEX comparisonLength; 00592 CompareFuncType compareFunc; 00593 }; 00594 00595 00602 class H323RealTimeCapability : public H323Capability 00603 { 00604 PCLASSINFO(H323RealTimeCapability, H323Capability); 00605 00606 public: 00611 virtual H323Channel * CreateChannel( 00612 H323Connection & connection, 00613 H323Channel::Directions dir, 00614 unsigned sessionID, 00615 const H245_H2250LogicalChannelParameters * param 00617 ) const; 00618 00619 H323RealTimeCapability(); 00620 H323RealTimeCapability(const H323RealTimeCapability &rtc); 00621 virtual ~H323RealTimeCapability(); 00622 void AttachQoS(RTP_QOS * _rtpqos); 00623 00624 protected: 00625 RTP_QOS * rtpqos; 00627 }; 00628 00629 00636 class H323AudioCapability : public H323RealTimeCapability 00637 { 00638 PCLASSINFO(H323AudioCapability, H323RealTimeCapability); 00639 00640 public: 00645 H323AudioCapability( 00646 unsigned rxPacketSize, 00647 unsigned txPacketSize 00648 ); 00650 00656 virtual MainTypes GetMainType() const; 00658 00669 virtual unsigned GetDefaultSessionID() const; 00670 00679 virtual void SetTxFramesInPacket( 00680 unsigned frames 00681 ); 00682 00688 virtual unsigned GetTxFramesInPacket() const; 00689 00695 virtual unsigned GetRxFramesInPacket() const; 00697 00708 virtual BOOL OnSendingPDU( 00709 H245_Capability & pdu 00710 ) const; 00711 00720 virtual BOOL OnSendingPDU( 00721 H245_DataType & pdu 00722 ) const; 00723 00732 virtual BOOL OnSendingPDU( 00733 H245_ModeElement & pdu 00734 ) const; 00735 00744 virtual BOOL OnSendingPDU( 00745 H245_AudioCapability & pdu, 00746 unsigned packetSize 00747 ) const; 00748 00757 virtual BOOL OnSendingPDU( 00758 H245_AudioMode & pdu 00759 ) const; 00760 00772 virtual BOOL OnReceivedPDU( 00773 const H245_Capability & pdu 00774 ); 00775 00785 virtual BOOL OnReceivedPDU( 00786 const H245_DataType & pdu, 00787 BOOL receiver 00788 ); 00789 00798 virtual BOOL OnReceivedPDU( 00799 const H245_AudioCapability & pdu, 00800 unsigned & packetSize 00801 ); 00803 00804 protected: 00805 unsigned rxFramesInPacket; 00806 unsigned txFramesInPacket; 00807 }; 00808 00809 00817 class H323NonStandardAudioCapability : public H323AudioCapability, 00818 public H323NonStandardCapabilityInfo 00819 { 00820 PCLASSINFO(H323NonStandardAudioCapability, H323AudioCapability); 00821 00822 public: 00827 H323NonStandardAudioCapability( 00828 unsigned maxPacketSize, 00829 unsigned desiredPacketSize, 00830 H323NonStandardCapabilityInfo::CompareFuncType compareFunc 00831 ); 00832 H323NonStandardAudioCapability( 00833 unsigned maxPacketSize, 00834 unsigned desiredPacketSize, 00835 const BYTE * dataBlock = NULL, 00836 PINDEX dataSize = 0, 00837 PINDEX comparisonOffset = 0, 00838 PINDEX comparisonLength = P_MAX_INDEX 00839 ); 00843 H323NonStandardAudioCapability( 00844 unsigned maxPacketSize, 00845 unsigned desiredPacketSize, 00846 H323EndPoint &, 00847 H323NonStandardCapabilityInfo::CompareFuncType compareFunc 00848 ); 00849 H323NonStandardAudioCapability( 00850 unsigned maxPacketSize, 00851 unsigned desiredPacketSize, 00852 H323EndPoint &, 00853 const BYTE * dataBlock = NULL, 00854 PINDEX dataSize = 0, 00855 PINDEX comparisonOffset = 0, 00856 PINDEX comparisonLength = P_MAX_INDEX 00857 ); 00858 00861 H323NonStandardAudioCapability( 00862 unsigned maxPacketSize, 00863 unsigned desiredPacketSize, 00864 const PString & oid, 00865 const BYTE * dataBlock = NULL, 00866 PINDEX dataSize = 0, 00867 PINDEX comparisonOffset = 0, 00868 PINDEX comparisonLength = P_MAX_INDEX 00869 ); 00870 00873 H323NonStandardAudioCapability( 00874 unsigned maxPacketSize, 00875 unsigned desiredPacketSize, 00876 BYTE country, 00877 BYTE extension, 00878 WORD maufacturer, 00879 const BYTE * dataBlock = NULL, 00880 PINDEX dataSize = 0, 00881 PINDEX comparisonOffset = 0, 00882 PINDEX comparisonLength = P_MAX_INDEX 00883 ); 00885 00891 Comparison Compare(const PObject & obj) const; 00893 00901 virtual unsigned GetSubType() const; 00903 00914 virtual BOOL OnSendingPDU( 00915 H245_AudioCapability & pdu, 00916 unsigned packetSize 00917 ) const; 00918 00927 virtual BOOL OnSendingPDU( 00928 H245_AudioMode & pdu 00929 ) const; 00930 00939 virtual BOOL OnReceivedPDU( 00940 const H245_AudioCapability & pdu, 00941 unsigned & packetSize 00942 ); 00943 00946 virtual BOOL IsNonStandardMatch( 00947 const H245_NonStandardParameter & param 00948 ) const; 00950 }; 00951 00952 00959 class H323VideoCapability : public H323RealTimeCapability 00960 { 00961 PCLASSINFO(H323VideoCapability, H323RealTimeCapability); 00962 00963 public: 00969 virtual MainTypes GetMainType() const; 00971 00982 virtual unsigned GetDefaultSessionID() const; 00984 00995 virtual BOOL OnSendingPDU( 00996 H245_Capability & pdu 00997 ) const; 00998 01007 virtual BOOL OnSendingPDU( 01008 H245_DataType & pdu 01009 ) const; 01010 01019 virtual BOOL OnSendingPDU( 01020 H245_ModeElement & pdu 01021 ) const; 01022 01030 virtual BOOL OnSendingPDU( 01031 H245_VideoCapability & pdu 01032 ) const = 0; 01033 01042 virtual BOOL OnSendingPDU( 01043 H245_VideoMode & pdu 01044 ) const = 0; 01045 01055 virtual BOOL OnReceivedPDU( 01056 const H245_Capability & pdu 01057 ); 01058 01066 virtual BOOL OnReceivedPDU( 01067 const H245_DataType & pdu, 01068 BOOL receiver 01069 ); 01070 01078 virtual BOOL OnReceivedPDU( 01079 const H245_VideoCapability & pdu 01080 ) = 0; 01082 }; 01083 01084 01092 class H323NonStandardVideoCapability : public H323VideoCapability, 01093 public H323NonStandardCapabilityInfo 01094 { 01095 PCLASSINFO(H323NonStandardVideoCapability, H323VideoCapability); 01096 01097 public: 01102 H323NonStandardVideoCapability( 01103 const BYTE * dataBlock = NULL, 01104 PINDEX dataSize = 0, 01105 PINDEX comparisonOffset = 0, 01106 PINDEX comparisonLength = P_MAX_INDEX 01107 ); 01108 01112 H323NonStandardVideoCapability( 01113 H323EndPoint &, 01114 const BYTE * dataBlock = NULL, 01115 PINDEX dataSize = 0, 01116 PINDEX comparisonOffset = 0, 01117 PINDEX comparisonLength = P_MAX_INDEX 01118 ); 01119 01122 H323NonStandardVideoCapability( 01123 const PString & oid, 01124 const BYTE * dataBlock = NULL, 01125 PINDEX dataSize = 0, 01126 PINDEX comparisonOffset = 0, 01127 PINDEX comparisonLength = P_MAX_INDEX 01128 ); 01129 01132 H323NonStandardVideoCapability( 01133 BYTE country, 01134 BYTE extension, 01135 WORD maufacturer, 01136 const BYTE * dataBlock = NULL, 01137 PINDEX dataSize = 0, 01138 PINDEX comparisonOffset = 0, 01139 PINDEX comparisonLength = P_MAX_INDEX 01140 ); 01142 01148 Comparison Compare(const PObject & obj) const; 01150 01159 virtual unsigned GetSubType() const; 01161 01172 virtual BOOL OnSendingPDU( 01173 H245_VideoCapability & pdu 01174 ) const; 01175 01184 virtual BOOL OnSendingPDU( 01185 H245_VideoMode & pdu 01186 ) const; 01187 01196 virtual BOOL OnReceivedPDU( 01197 const H245_VideoCapability & pdu 01198 ); 01199 01202 virtual BOOL IsNonStandardMatch( 01203 const H245_NonStandardParameter & param 01204 ) const; 01206 }; 01207 01208 01215 class H323DataCapability : public H323Capability 01216 { 01217 PCLASSINFO(H323DataCapability, H323Capability); 01218 01219 public: 01224 H323DataCapability( 01225 unsigned maxBitRate = 0 01226 ); 01228 01234 virtual MainTypes GetMainType() const; 01236 01246 virtual unsigned GetDefaultSessionID() const; 01247 01251 virtual H323Codec * CreateCodec( 01252 H323Codec::Direction direction 01253 ) const; 01255 01266 virtual BOOL OnSendingPDU( 01267 H245_Capability & pdu 01268 ) const; 01269 01278 virtual BOOL OnSendingPDU( 01279 H245_DataType & pdu 01280 ) const; 01281 01290 virtual BOOL OnSendingPDU( 01291 H245_ModeElement & pdu 01292 ) const; 01293 01301 virtual BOOL OnSendingPDU( 01302 H245_DataApplicationCapability & pdu 01303 ) const = 0; 01304 01313 virtual BOOL OnSendingPDU( 01314 H245_DataMode & pdu 01315 ) const = 0; 01316 01326 virtual BOOL OnReceivedPDU( 01327 const H245_Capability & pdu 01328 ); 01329 01337 virtual BOOL OnReceivedPDU( 01338 const H245_DataType & pdu, 01339 BOOL receiver 01340 ); 01341 01349 virtual BOOL OnReceivedPDU( 01350 const H245_DataApplicationCapability & pdu 01351 ) = 0; 01353 01354 protected: 01355 unsigned maxBitRate; 01356 }; 01357 01358 01366 class H323NonStandardDataCapability : public H323DataCapability, 01367 public H323NonStandardCapabilityInfo 01368 { 01369 PCLASSINFO(H323NonStandardDataCapability, H323DataCapability); 01370 01371 public: 01376 H323NonStandardDataCapability( 01377 unsigned maxBitRate, 01378 const BYTE * dataBlock = NULL, 01379 PINDEX dataSize = 0, 01380 PINDEX comparisonOffset = 0, 01381 PINDEX comparisonLength = P_MAX_INDEX 01382 ); 01383 01386 H323NonStandardDataCapability( 01387 unsigned maxBitRate, 01388 const PString & oid, 01389 const BYTE * dataBlock = NULL, 01390 PINDEX dataSize = 0, 01391 PINDEX comparisonOffset = 0, 01392 PINDEX comparisonLength = P_MAX_INDEX 01393 ); 01394 01397 H323NonStandardDataCapability( 01398 unsigned maxBitRate, 01399 BYTE country, 01400 BYTE extension, 01401 WORD maufacturer, 01402 const BYTE * dataBlock = NULL, 01403 PINDEX dataSize = 0, 01404 PINDEX comparisonOffset = 0, 01405 PINDEX comparisonLength = P_MAX_INDEX 01406 ); 01408 01414 Comparison Compare(const PObject & obj) const; 01416 01425 virtual unsigned GetSubType() const; 01427 01438 virtual BOOL OnSendingPDU( 01439 H245_DataApplicationCapability & pdu 01440 ) const; 01441 01450 virtual BOOL OnSendingPDU( 01451 H245_DataMode & pdu 01452 ) const; 01453 01462 virtual BOOL OnReceivedPDU( 01463 const H245_DataApplicationCapability & pdu 01464 ); 01465 01468 virtual BOOL IsNonStandardMatch( 01469 const H245_NonStandardParameter & param 01470 ) const; 01472 }; 01473 01474 01476 // The simplest codec is the G.711 PCM codec. 01477 01480 class H323_G711Capability : public H323AudioCapability 01481 { 01482 PCLASSINFO(H323_G711Capability, H323AudioCapability) 01483 01484 public: 01486 enum Mode { 01488 ALaw, 01490 muLaw 01491 }; 01493 enum Speed { 01495 At64k, 01497 At56k 01498 }; 01499 01504 H323_G711Capability( 01505 Mode mode = muLaw, 01506 Speed speed = At64k 01507 ); 01509 01514 virtual PObject * Clone() const; 01516 01525 virtual unsigned GetSubType() const; 01526 01529 virtual PString GetFormatName() const; 01531 01536 virtual H323Codec * CreateCodec( 01537 H323Codec::Direction direction 01538 ) const; 01540 01541 protected: 01542 Mode mode; 01543 Speed speed; 01544 }; 01545 01546 01548 01551 class H323_UserInputCapability : public H323Capability 01552 { 01553 PCLASSINFO(H323_UserInputCapability, H323Capability); 01554 01555 public: 01558 enum SubTypes { 01559 BasicString, 01560 IA5String, 01561 GeneralString, 01562 SignalToneH245, 01563 HookFlashH245, 01564 SignalToneRFC2833, 01565 NumSubTypes 01566 }; 01567 static const char * const SubTypeNames[NumSubTypes]; 01568 01573 H323_UserInputCapability( 01574 SubTypes subType 01575 ); 01577 01582 virtual PObject * Clone() const; 01584 01592 virtual MainTypes GetMainType() const; 01593 01597 virtual unsigned GetSubType() const; 01598 01601 virtual PString GetFormatName() const; 01603 01611 virtual H323Channel * CreateChannel( 01612 H323Connection & connection, 01613 H323Channel::Directions dir, 01614 unsigned sessionID, 01615 const H245_H2250LogicalChannelParameters * param 01617 ) const; 01618 01621 virtual H323Codec * CreateCodec( 01622 H323Codec::Direction direction 01623 ) const; 01625 01635 virtual BOOL OnSendingPDU( 01636 H245_Capability & pdu 01637 ) const; 01638 01646 virtual BOOL OnSendingPDU( 01647 H245_DataType & pdu 01648 ) const; 01649 01658 virtual BOOL OnSendingPDU( 01659 H245_ModeElement & pdu 01660 ) const; 01661 01671 virtual BOOL OnReceivedPDU( 01672 const H245_Capability & pdu 01673 ); 01674 01682 virtual BOOL OnReceivedPDU( 01683 const H245_DataType & pdu, 01684 BOOL receiver 01685 ); 01686 01695 virtual BOOL IsUsable( 01696 const H323Connection & connection 01697 ) const; 01699 01700 static void AddAllCapabilities( 01701 H323Capabilities & capabilities, 01702 PINDEX descriptorNum, 01703 PINDEX simultaneous 01704 ); 01705 01706 protected: 01707 SubTypes subType; 01708 }; 01709 01710 01711 01713 01714 PLIST(H323CapabilitiesList, H323Capability); 01715 01716 PARRAY(H323CapabilitiesListArray, H323CapabilitiesList); 01717 01718 class H323SimultaneousCapabilities : public H323CapabilitiesListArray 01719 { 01720 PCLASSINFO(H323SimultaneousCapabilities, H323CapabilitiesListArray); 01721 public: 01722 BOOL SetSize(PINDEX newSize); 01723 }; 01724 01725 01726 PARRAY(H323CapabilitiesSetArray, H323SimultaneousCapabilities); 01727 01728 01729 class H323CapabilitiesSet : public H323CapabilitiesSetArray 01730 { 01731 PCLASSINFO(H323CapabilitiesSet, H323CapabilitiesSetArray); 01732 public: 01734 BOOL SetSize(PINDEX newSize); 01735 }; 01736 01737 01740 class H323Capabilities : public PObject 01741 { 01742 PCLASSINFO(H323Capabilities, PObject); 01743 public: 01748 H323Capabilities(); 01749 01752 H323Capabilities( 01753 const H323Connection & connection, 01754 const H245_TerminalCapabilitySet & pdu 01755 ); 01756 01761 H323Capabilities( 01762 const H323Capabilities & original 01763 ); 01764 01769 H323Capabilities & operator=( 01770 const H323Capabilities & original 01771 ); 01773 01778 void PrintOn( 01779 ostream & strm 01780 ) const; 01782 01787 PINDEX GetSize() const { return table.GetSize(); } 01788 01791 H323Capability & operator[](PINDEX i) const { return table[i]; } 01792 01813 PINDEX SetCapability( 01814 PINDEX descriptorNum, 01815 PINDEX simultaneous, 01816 H323Capability * cap 01817 ); 01818 01823 PINDEX AddAllCapabilities( 01824 PINDEX descriptorNum, 01825 PINDEX simultaneous, 01826 const PString & name 01827 ); 01828 PINDEX AddAllCapabilities( 01829 H323EndPoint &, 01830 PINDEX descriptorNum, 01831 PINDEX simultaneous, 01832 const PString & name 01833 ) 01834 { return AddAllCapabilities(descriptorNum, simultaneous, name); } 01835 01844 void Add( 01845 H323Capability * capability 01846 ); 01847 01854 H323Capability * Copy( 01855 const H323Capability & capability 01856 ); 01857 01862 void Remove( 01863 H323Capability * capability 01864 ); 01865 01870 void Remove( 01871 const PString & formatName 01872 ); 01873 01877 void Remove( 01878 const PStringArray & formatNames 01879 ); 01880 01883 void RemoveAll(); 01884 01892 H323Capability * FindCapability( 01893 unsigned capabilityNumber 01894 ) const; 01895 01911 H323Capability * FindCapability( 01912 const PString & formatName, 01913 H323Capability::CapabilityDirection direction = H323Capability::e_Unknown 01915 ) const; 01916 01922 H323Capability * FindCapability( 01923 H323Capability::CapabilityDirection direction 01924 ) const; 01925 01933 H323Capability * FindCapability( 01934 const H323Capability & capability 01935 ) const; 01936 01942 H323Capability * FindCapability( 01943 const H245_Capability & cap 01944 ) const; 01945 01951 H323Capability * FindCapability( 01952 const H245_DataType & dataType 01953 ) const; 01954 01960 H323Capability * FindCapability( 01961 const H245_ModeElement & modeElement 01962 ) const; 01963 01969 H323Capability * FindCapability( 01970 H323Capability::MainTypes mainType, 01971 const PASN_Choice & subTypePDU, 01972 const unsigned * translationTable 01973 ) const; 01974 01980 H323Capability * FindCapability( 01981 H323Capability::MainTypes mainType, 01982 unsigned subType = UINT_MAX 01983 ) const; 01984 01987 void BuildPDU( 01988 const H323Connection & connection, 01989 H245_TerminalCapabilitySet & pdu 01990 ) const; 01991 01994 BOOL Merge( 01995 const H323Capabilities & newCaps 01996 ); 01997 02004 void Reorder( 02005 const PStringArray & preferenceOrder 02006 ); 02007 02010 BOOL IsAllowed( 02011 const H323Capability & capability 02012 ); 02013 02016 BOOL IsAllowed( 02017 unsigned capabilityNumber 02018 ); 02019 02022 BOOL IsAllowed( 02023 const H323Capability & capability1, 02024 const H323Capability & capability2 02025 ); 02026 02029 BOOL IsAllowed( 02030 unsigned capabilityNumber1, 02031 unsigned capabilityNumber2 02032 ); 02034 02035 protected: 02036 H323CapabilitiesList table; 02037 H323CapabilitiesSet set; 02038 }; 02039 02040 02042 02043 typedef PFactory<H323Capability> H323CapabilityFactory; 02044 02045 #define H323_REGISTER_CAPABILITY(cls, capName) static H323CapabilityFactory::Worker<cls> cls##Factory(capName, true); \ 02046 02047 #define H323_DEFINE_CAPABILITY(cls, capName, fmtName) \ 02048 class cls : public H323Capability { \ 02049 public: \ 02050 cls() : H323Capability() { } \ 02051 PString GetFormatName() const \ 02052 { return fmtName; } \ 02053 }; \ 02054 H323_REGISTER_CAPABILITY(cls, capName) \ 02055 02056 #define H323_DEFINE_CAPABILITY_FROM(cls, ancestor, capName, fmtName) \ 02057 class cls : public ancestor { \ 02058 public: \ 02059 cls() : ancestor() { } \ 02060 PString GetFormatName() const \ 02061 { return fmtName; } \ 02062 }; \ 02063 H323_REGISTER_CAPABILITY(cls, capName) \ 02064 02065 #endif // __OPAL_H323CAPS_H 02066 02067

Generated on Sat Jul 24 17:03:31 2004 for OpenH323 by doxygen 1.3.7