# 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  * $Revision: 21004 $
    00030  * $Author: rjongbloed $
    00031  * $Date: 2008-09-16 07:08:56 +0000 (Tue, 16 Sep 2008) $
    00032  */
    00033
    00034 #ifndef __OPAL_H323CAPS_H
    00035 #define __OPAL_H323CAPS_H
    00036
    00037 #ifdef P_USE_PRAGMA
    00038 #pragma interface
    00039 #endif
    00040
    00041 #include <opal/buildopts.h>
    00042
    00043 #include <opal/mediafmt.h>
    00044 #include <h323/channels.h>
    00045
    00046
    00047 /* The following classes have forward references to avoid including the VERY
    00048    large header files for H225 and H245. If an application requires access
    00049    to the protocol classes they can include them, but for simple usage their
    00050    inclusion can be avoided.
    00051  */
    00052 class PASN_Choice;
    00053 class H245_Capability;
    00054 class H245_DataType;
    00055 class H245_ModeElement;
    00056 class H245_AudioCapability;
    00057 class H245_AudioMode;
    00058 class H245_VideoCapability;
    00059 class H245_VideoMode;
    00060 class H245_DataApplicationCapability;
    00061 class H245_DataMode;
    00062 class H245_DataProtocolCapability;
    00063 class H245_H2250LogicalChannelParameters;
    00064 class H245_TerminalCapabilitySet;
    00065 class H245_NonStandardParameter;
    00066 class H323Connection;
    00067 class H323Capabilities;
    00068 class H245_CapabilityIdentifier;
    00069 class H245_GenericCapability;
    00070 class H245_GenericParameter;
    00071
    00073
    00087 class H323Capability : public PObject
    00088 {
    00089   PCLASSINFO(H323Capability, PObject);
    00090
    00091   public:
    00096     H323Capability();
    00098
    00104     Comparison Compare(const PObject & obj) const;
    00105
    00108     void PrintOn(ostream & strm) const;
    00110
    00113     enum MainTypes {
    00115       e_Audio,
    00117       e_Video,
    00119       e_Data,
    00121       e_UserInput,
    00123       e_NumMainTypes
    00124     };
    00125
    00131     virtual MainTypes GetMainType() const = 0;
    00132
    00136     virtual unsigned  GetSubType()  const = 0;
    00137
    00140     virtual PString GetFormatName() const = 0;
    00142
    00148     static H323Capability * Create(
    00149       const PString & name
    00150     );
    00151
    00160     virtual unsigned GetDefaultSessionID() const;
    00161
    00170     virtual void SetTxFramesInPacket(
    00171       unsigned frames
    00172     );
    00173
    00178     virtual unsigned GetTxFramesInPacket() const;
    00179
    00184     virtual unsigned GetRxFramesInPacket() const;
    00185
    00191     virtual H323Channel * CreateChannel(
    00192       H323Connection & connection,
    00193       H323Channel::Directions dir,
    00194       unsigned sessionID,
    00195       const H245_H2250LogicalChannelParameters * param
    00197     ) const = 0;
    00199
    00202     enum CommandType {
    00203       e_TCS,
    00204       e_OLC,
    00205       e_ReqMode
    00206     };
    00207
    00215     virtual PBoolean OnSendingPDU(
    00216       H245_Capability & pdu
    00217     ) const = 0;
    00218
    00226     virtual PBoolean OnSendingPDU(
    00227       H245_DataType & pdu
    00228     ) const;
    00229
    00237     virtual PBoolean OnSendingPDU(
    00238       H245_ModeElement & pdu
    00239     ) const = 0;
    00240
    00253     virtual PBoolean OnReceivedPDU(
    00254       const H245_Capability & pdu
    00255     );
    00256
    00264     virtual PBoolean OnReceivedPDU(
    00265       const H245_DataType & pdu,
    00266       PBoolean receiver
    00267     );
    00268
    00271     virtual PBoolean IsMatch(
    00272       const PASN_Choice & subTypePDU
    00273     ) const;
    00274
    00282     virtual PBoolean IsUsable(
    00283       const H323Connection & connection
    00284     ) const;
    00286
    00289     enum CapabilityDirection {
    00290       e_Unknown,
    00291       e_Receive,
    00292       e_Transmit,
    00293       e_ReceiveAndTransmit,
    00294       e_NoDirection,
    00295       NumCapabilityDirections
    00296     };
    00297
    00300     CapabilityDirection GetCapabilityDirection() const { return capabilityDirection; }
    00301
    00304     void SetCapabilityDirection(
    00305       CapabilityDirection dir
    00306     ) { capabilityDirection = dir; }
    00307
    00309     unsigned GetCapabilityNumber() const { return assignedCapabilityNumber; }
    00310
    00312     void SetCapabilityNumber(unsigned num) { assignedCapabilityNumber = num; }
    00313
    00316     OpalMediaFormat GetMediaFormat() const;
    00317
    00320     bool SetMediaFormatOptions(
    00321       const OpalMediaFormat & format
    00322     );
    00323
    00325     RTP_DataFrame::PayloadTypes GetPayloadType() const { return rtpPayloadType; }
    00326
    00328     void SetPayloadType(RTP_DataFrame::PayloadTypes pt) { rtpPayloadType = pt; }
    00329
    00331     virtual void AttachQoS(RTP_QOS *) { }
    00333
    00334 #if PTRACING
    00335     friend ostream & operator<<(ostream & o , MainTypes t);
    00336     friend ostream & operator<<(ostream & o , CapabilityDirection d);
    00337 #endif
    00338
    00339   protected:
    00340     OpalMediaFormat & GetWritableMediaFormat();
    00341
    00342     unsigned            assignedCapabilityNumber;
    00343     CapabilityDirection capabilityDirection;
    00344     RTP_DataFrame::PayloadTypes rtpPayloadType;
    00345
    00346   private:
    00347     mutable OpalMediaFormat mediaFormat;
    00348
    00349   friend class H323Capabilities;
    00350 };
    00351
    00352
    00353
    00362 class H323NonStandardCapabilityInfo
    00363 {
    00364   public:
    00365     typedef PObject::Comparison (*CompareFuncType)(struct PluginCodec_H323NonStandardCodecData *);
    00366
    00369     H323NonStandardCapabilityInfo(
    00370       CompareFuncType compareFunc,
    00371       const BYTE * dataBlock,
    00372       PINDEX dataSize
    00373     );
    00374
    00377     H323NonStandardCapabilityInfo(
    00378       const BYTE * dataBlock,
    00379       PINDEX dataSize,
    00380       PINDEX comparisonOffset = 0,
    00381       PINDEX comparisonLength = P_MAX_INDEX
    00382     );
    00383
    00386     H323NonStandardCapabilityInfo(
    00387       const PString & oid,
    00388       const BYTE * dataBlock,
    00389       PINDEX dataSize,
    00390       PINDEX comparisonOffset = 0,
    00391       PINDEX comparisonLength = P_MAX_INDEX
    00392     );
    00393
    00396     H323NonStandardCapabilityInfo(
    00397       BYTE country,
    00398       BYTE extension,
    00399       WORD maufacturer,
    00400       const BYTE * dataBlock,
    00401       PINDEX dataSize,
    00402       PINDEX comparisonOffset = 0,
    00403       PINDEX comparisonLength = P_MAX_INDEX
    00404     );
    00405
    00408     virtual ~H323NonStandardCapabilityInfo();
    00409
    00414     virtual PBoolean OnSendingPDU(
    00415       PBYTEArray & data
    00416     ) const;
    00417
    00422     virtual PBoolean OnReceivedPDU(
    00423       const PBYTEArray & data
    00424     );
    00425
    00426     PBoolean IsMatch(const H245_NonStandardParameter & param) const;
    00427
    00428     PObject::Comparison CompareParam(
    00429       const H245_NonStandardParameter & param
    00430     ) const;
    00431
    00432   protected:
    00433     PBoolean OnSendingNonStandardPDU(
    00434       PASN_Choice & pdu,
    00435       unsigned nonStandardTag
    00436     ) const;
    00437     PBoolean OnReceivedNonStandardPDU(
    00438       const PASN_Choice & pdu,
    00439       unsigned nonStandardTag
    00440     );
    00441
    00442     PObject::Comparison CompareInfo(
    00443       const H323NonStandardCapabilityInfo & obj
    00444     ) const;
    00445     PObject::Comparison CompareData(
    00446       const PBYTEArray & data
    00447     ) const;
    00448
    00449     PString    oid;
    00450     BYTE       t35CountryCode;
    00451     BYTE       t35Extension;
    00452     WORD       manufacturerCode;
    00453     PBYTEArray nonStandardData;
    00454     PINDEX     comparisonOffset;
    00455     PINDEX     comparisonLength;
    00456     CompareFuncType compareFunc;
    00457 };
    00458
    00468 class H323GenericCapabilityInfo
    00469 {
    00470   public:
    00471     H323GenericCapabilityInfo(
    00472       const PString & id,
    00473       PINDEX maxBitRate = 0
    00474     );
    00475     H323GenericCapabilityInfo(const H323GenericCapabilityInfo & obj);
    00476     virtual ~H323GenericCapabilityInfo();
    00477
    00478   protected:
    00479     virtual PBoolean OnSendingGenericPDU(
    00480       H245_GenericCapability & pdu,
    00481       const OpalMediaFormat & mediaFormat,
    00482       H323Capability::CommandType type
    00483     ) const;
    00484     virtual PBoolean OnReceivedGenericPDU(
    00485       OpalMediaFormat & mediaFormat,
    00486       const H245_GenericCapability & pdu,
    00487       H323Capability::CommandType type
    00488     );
    00489
    00490     PBoolean IsMatch(
    00491       const H245_GenericCapability & param
    00492     ) const;
    00493     PObject::Comparison CompareInfo(
    00494       const H323GenericCapabilityInfo & obj
    00495     ) const;
    00496
    00497
    00498     H245_CapabilityIdentifier * identifier;
    00499     unsigned                    maxBitRate;
    00500 };
    00501
    00508 class H323RealTimeCapability : public H323Capability
    00509 {
    00510   PCLASSINFO(H323RealTimeCapability, H323Capability);
    00511
    00512   public:
    00517     virtual H323Channel * CreateChannel(
    00518       H323Connection & connection,
    00519       H323Channel::Directions dir,
    00520       unsigned sessionID,
    00521       const H245_H2250LogicalChannelParameters * param
    00523     ) const;
    00524
    00525     H323RealTimeCapability();
    00526     H323RealTimeCapability(const H323RealTimeCapability &rtc);
    00527     virtual ~H323RealTimeCapability();
    00528     void AttachQoS(RTP_QOS * _rtpqos);
    00529
    00530   protected:
    00531     RTP_QOS * rtpqos;
    00533 };
    00534
    00535
    00542 class H323AudioCapability : public H323RealTimeCapability
    00543 {
    00544   PCLASSINFO(H323AudioCapability, H323RealTimeCapability);
    00545
    00546   public:
    00551     H323AudioCapability();
    00553
    00559     virtual MainTypes GetMainType() const;
    00561
    00572     virtual unsigned GetDefaultSessionID() const;
    00573
    00582     virtual void SetTxFramesInPacket(
    00583       unsigned frames
    00584     );
    00585
    00591     virtual unsigned GetTxFramesInPacket() const;
    00592
    00598     virtual unsigned GetRxFramesInPacket() const;
    00600
    00611     virtual PBoolean OnSendingPDU(
    00612       H245_Capability & pdu
    00613     ) const;
    00614
    00623     virtual PBoolean OnSendingPDU(
    00624       H245_DataType & pdu
    00625     ) const;
    00626
    00635     virtual PBoolean OnSendingPDU(
    00636       H245_ModeElement & pdu
    00637     ) const;
    00638
    00647     virtual PBoolean OnSendingPDU(
    00648       H245_AudioCapability & pdu,
    00649       unsigned packetSize
    00650     ) const;
    00651     virtual PBoolean OnSendingPDU(
    00652       H245_AudioCapability & pdu,
    00653       unsigned packetSize,
    00654       CommandType type
    00655     ) const;
    00656
    00665     virtual PBoolean OnSendingPDU(
    00666       H245_AudioMode & pdu
    00667     ) const;
    00668
    00680     virtual PBoolean OnReceivedPDU(
    00681       const H245_Capability & pdu
    00682     );
    00683
    00693     virtual PBoolean OnReceivedPDU(
    00694       const H245_DataType & pdu,
    00695       PBoolean receiver
    00696     );
    00697
    00706     virtual PBoolean OnReceivedPDU(
    00707       const H245_AudioCapability & pdu,
    00708       unsigned & packetSize
    00709     );
    00710     virtual PBoolean OnReceivedPDU(
    00711       const H245_AudioCapability & pdu,
    00712       unsigned & packetSize,
    00713       CommandType type
    00714     );
    00716 };
    00717
    00718
    00726 class H323NonStandardAudioCapability : public H323AudioCapability,
    00727                                        public H323NonStandardCapabilityInfo
    00728 {
    00729   PCLASSINFO(H323NonStandardAudioCapability, H323AudioCapability);
    00730
    00731   public:
    00734     H323NonStandardAudioCapability(
    00735       H323NonStandardCapabilityInfo::CompareFuncType compareFunc,
    00736       const BYTE * dataBlock,
    00737       PINDEX dataSize
    00738     );
    00741     H323NonStandardAudioCapability(
    00742       const BYTE * dataBlock = NULL,
    00743       PINDEX dataSize = 0,
    00744       PINDEX comparisonOffset = 0,
    00745       PINDEX comparisonLength = P_MAX_INDEX
    00746      );
    00747
    00750     H323NonStandardAudioCapability(
    00751       const PString & oid,
    00752       const BYTE * dataBlock = NULL,
    00753       PINDEX dataSize = 0,
    00754       PINDEX comparisonOffset = 0,
    00755       PINDEX comparisonLength = P_MAX_INDEX
    00756     );
    00757
    00760     H323NonStandardAudioCapability(
    00761       BYTE country,
    00762       BYTE extension,
    00763       WORD maufacturer,
    00764       const BYTE * dataBlock = NULL,
    00765       PINDEX dataSize = 0,
    00766       PINDEX comparisonOffset = 0,
    00767       PINDEX comparisonLength = P_MAX_INDEX
    00768     );
    00770
    00776     Comparison Compare(const PObject & obj) const;
    00778
    00786     virtual unsigned GetSubType() const;
    00788
    00799     virtual PBoolean OnSendingPDU(
    00800       H245_AudioCapability & pdu,
    00801       unsigned packetSize
    00802     ) const;
    00803
    00812     virtual PBoolean OnSendingPDU(
    00813       H245_AudioMode & pdu
    00814     ) const;
    00815
    00824     virtual PBoolean OnReceivedPDU(
    00825       const H245_AudioCapability & pdu,
    00826       unsigned & packetSize
    00827     );
    00828
    00831     virtual PBoolean IsMatch(
    00832       const PASN_Choice & subTypePDU
    00833     ) const;
    00835 };
    00836
    00844 class H323GenericAudioCapability : public H323AudioCapability,
    00845                                    public H323GenericCapabilityInfo
    00846 {
    00847   PCLASSINFO(H323NonStandardAudioCapability, H323AudioCapability);
    00848
    00849   public:
    00854     H323GenericAudioCapability(
    00855       const PString & capabilityId,
    00856       PINDEX maxBitRate = 0
    00857     );
    00859
    00865     Comparison Compare(const PObject & obj) const;
    00867
    00875     virtual unsigned GetSubType() const;
    00877
    00888     virtual PBoolean OnSendingPDU(
    00889       H245_AudioCapability & pdu,
    00890       unsigned packetSize,
    00891       CommandType type
    00892     ) const;
    00893
    00902     virtual PBoolean OnSendingPDU(
    00903       H245_AudioMode & pdu
    00904     ) const;
    00905
    00914     virtual PBoolean OnReceivedPDU(
    00915       const H245_AudioCapability & pdu,
    00916       unsigned & packetSize,
    00917       CommandType type
    00918     );
    00919
    00922     virtual PBoolean IsMatch(
    00923       const PASN_Choice & subTypePDU
    00924     ) const;
    00926 };
    00927
    00928
    00929 #if OPAL_VIDEO
    00930
    00937 class H323VideoCapability : public H323RealTimeCapability
    00938 {
    00939   PCLASSINFO(H323VideoCapability, H323RealTimeCapability);
    00940
    00941   public:
    00947     virtual MainTypes GetMainType() const;
    00949
    00960     virtual unsigned GetDefaultSessionID() const;
    00962
    00973     virtual PBoolean OnSendingPDU(
    00974       H245_Capability & pdu
    00975     ) const;
    00976
    00985     virtual PBoolean OnSendingPDU(
    00986       H245_DataType & pdu
    00987     ) const;
    00988
    00997     virtual PBoolean OnSendingPDU(
    00998       H245_ModeElement & pdu
    00999     ) const;
    01000
    01008     virtual PBoolean OnSendingPDU(
    01009       H245_VideoCapability & pdu
    01010     ) const;
    01011     virtual PBoolean OnSendingPDU(
    01012       H245_VideoCapability & pdu,
    01013       CommandType type
    01014     ) const;
    01015
    01024     virtual PBoolean OnSendingPDU(
    01025       H245_VideoMode & pdu
    01026     ) const = 0;
    01027
    01037     virtual PBoolean OnReceivedPDU(
    01038       const H245_Capability & pdu
    01039     );
    01040
    01048     virtual PBoolean OnReceivedPDU(
    01049       const H245_DataType & pdu,
    01050       PBoolean receiver
    01051     );
    01052
    01060     virtual PBoolean OnReceivedPDU(
    01061       const H245_VideoCapability & pdu
    01062     );
    01063     virtual PBoolean OnReceivedPDU(
    01064       const H245_VideoCapability & pdu,
    01065       CommandType type
    01066     );
    01068 };
    01069
    01070
    01078 class H323NonStandardVideoCapability : public H323VideoCapability,
    01079                                        public H323NonStandardCapabilityInfo
    01080 {
    01081   PCLASSINFO(H323NonStandardVideoCapability, H323VideoCapability);
    01082
    01083   public:
    01086     H323NonStandardVideoCapability(
    01087       H323NonStandardCapabilityInfo::CompareFuncType compareFunc,
    01088       const BYTE * dataBlock,
    01089       PINDEX dataSize
    01090     );
    01093     H323NonStandardVideoCapability(
    01094       const BYTE * dataBlock = NULL,
    01095       PINDEX dataSize = 0,
    01096       PINDEX comparisonOffset = 0,
    01097       PINDEX comparisonLength = P_MAX_INDEX
    01098     );
    01099
    01102     H323NonStandardVideoCapability(
    01103       const PString & oid,
    01104       const BYTE * dataBlock = NULL,
    01105       PINDEX dataSize = 0,
    01106       PINDEX comparisonOffset = 0,
    01107       PINDEX comparisonLength = P_MAX_INDEX
    01108     );
    01109
    01112     H323NonStandardVideoCapability(
    01113       BYTE country,
    01114       BYTE extension,
    01115       WORD maufacturer,
    01116       const BYTE * dataBlock = NULL,
    01117       PINDEX dataSize = 0,
    01118       PINDEX comparisonOffset = 0,
    01119       PINDEX comparisonLength = P_MAX_INDEX
    01120     );
    01122
    01128     Comparison Compare(const PObject & obj) const;
    01130
    01139     virtual unsigned GetSubType() const;
    01141
    01152     virtual PBoolean OnSendingPDU(
    01153       H245_VideoCapability & pdu
    01154     ) const;
    01155
    01164     virtual PBoolean OnSendingPDU(
    01165       H245_VideoMode & pdu
    01166     ) const;
    01167
    01176     virtual PBoolean OnReceivedPDU(
    01177       const H245_VideoCapability & pdu
    01178     );
    01179
    01182     virtual PBoolean IsMatch(
    01183       const PASN_Choice & subTypePDU
    01184     ) const;
    01186 };
    01187
    01195 class H323GenericVideoCapability : public H323VideoCapability,
    01196                                    public H323GenericCapabilityInfo
    01197 {
    01198   PCLASSINFO(H323GenericVideoCapability, H323VideoCapability);
    01199
    01200   public:
    01205     H323GenericVideoCapability(
    01206       const PString & capabilityId,
    01207       PINDEX maxBitRate = 0
    01208     );
    01210
    01216     Comparison Compare(const PObject & obj) const;
    01218
    01226     virtual unsigned GetSubType() const;
    01228
    01239     virtual PBoolean OnSendingPDU(
    01240       H245_VideoCapability & pdu,
    01241       CommandType type
    01242     ) const;
    01243
    01252     virtual PBoolean OnSendingPDU(
    01253       H245_VideoMode & pdu
    01254     ) const;
    01255
    01264     virtual PBoolean OnReceivedPDU(
    01265       const H245_VideoCapability & pdu,
    01266       CommandType type
    01267     );
    01269
    01272     virtual PBoolean IsMatch(
    01273       const PASN_Choice & subTypePDU
    01274     ) const;
    01275 };
    01276
    01277 #endif  // OPAL_VIDEO
    01278
    01285 class H323DataCapability : public H323Capability
    01286 {
    01287   PCLASSINFO(H323DataCapability, H323Capability);
    01288
    01289   public:
    01294     H323DataCapability(
    01295       unsigned maxBitRate = 0
    01296     );
    01298
    01304     virtual MainTypes GetMainType() const;
    01306
    01316     virtual unsigned GetDefaultSessionID() const;
    01318
    01329     virtual PBoolean OnSendingPDU(
    01330       H245_Capability & pdu
    01331     ) const;
    01332
    01341     virtual PBoolean OnSendingPDU(
    01342       H245_DataType & pdu
    01343     ) const;
    01344
    01353     virtual PBoolean OnSendingPDU(
    01354       H245_ModeElement & pdu
    01355     ) const;
    01356
    01364     virtual PBoolean OnSendingPDU(
    01365       H245_DataApplicationCapability & pdu
    01366     ) const;
    01367     virtual PBoolean OnSendingPDU(
    01368       H245_DataApplicationCapability & pdu,
    01369       CommandType type
    01370     ) const;
    01371
    01380     virtual PBoolean OnSendingPDU(
    01381       H245_DataMode & pdu
    01382     ) const = 0;
    01383
    01393     virtual PBoolean OnReceivedPDU(
    01394       const H245_Capability & pdu
    01395     );
    01396
    01404     virtual PBoolean OnReceivedPDU(
    01405       const H245_DataType & pdu,
    01406       PBoolean receiver
    01407     );
    01408
    01416     virtual PBoolean OnReceivedPDU(
    01417       const H245_DataApplicationCapability & pdu
    01418     );
    01419     virtual PBoolean OnReceivedPDU(
    01420       const H245_DataApplicationCapability & pdu,
    01421       CommandType type
    01422     );
    01424
    01425   protected:
    01426     unsigned maxBitRate;
    01427 };
    01428
    01429
    01437 class H323NonStandardDataCapability : public H323DataCapability,
    01438                                       public H323NonStandardCapabilityInfo
    01439 {
    01440   PCLASSINFO(H323NonStandardDataCapability, H323DataCapability);
    01441
    01442   public:
    01447     H323NonStandardDataCapability(
    01448       unsigned maxBitRate,
    01449       const BYTE * dataBlock = NULL,
    01450       PINDEX dataSize = 0,
    01451       PINDEX comparisonOffset = 0,
    01452       PINDEX comparisonLength = P_MAX_INDEX
    01453     );
    01454
    01457     H323NonStandardDataCapability(
    01458       unsigned maxBitRate,
    01459       const PString & oid,
    01460       const BYTE * dataBlock = NULL,
    01461       PINDEX dataSize = 0,
    01462       PINDEX comparisonOffset = 0,
    01463       PINDEX comparisonLength = P_MAX_INDEX
    01464     );
    01465
    01468     H323NonStandardDataCapability(
    01469       unsigned maxBitRate,
    01470       BYTE country,
    01471       BYTE extension,
    01472       WORD maufacturer,
    01473       const BYTE * dataBlock = NULL,
    01474       PINDEX dataSize = 0,
    01475       PINDEX comparisonOffset = 0,
    01476       PINDEX comparisonLength = P_MAX_INDEX
    01477     );
    01479
    01485     Comparison Compare(const PObject & obj) const;
    01487
    01496     virtual unsigned GetSubType() const;
    01498
    01509     virtual PBoolean OnSendingPDU(
    01510       H245_DataApplicationCapability & pdu
    01511     ) const;
    01512
    01521     virtual PBoolean OnSendingPDU(
    01522       H245_DataMode & pdu
    01523     ) const;
    01524
    01533     virtual PBoolean OnReceivedPDU(
    01534       const H245_DataApplicationCapability & pdu
    01535     );
    01536
    01539     virtual PBoolean IsMatch(
    01540       const PASN_Choice & subTypePDU
    01541     ) const;
    01543 };
    01544
    01545
    01547 // Known audio codecs
    01548
    01551 class H323_G711Capability : public H323AudioCapability
    01552 {
    01553   PCLASSINFO(H323_G711Capability, H323AudioCapability)
    01554
    01555   public:
    01557     enum Mode {
    01559       ALaw,
    01561       muLaw
    01562     };
    01564     enum Speed {
    01566       At64k,
    01568       At56k
    01569     };
    01570
    01575     H323_G711Capability(
    01576       Mode mode = muLaw,
    01577       Speed speed = At64k
    01578     );
    01580
    01585     virtual PObject * Clone() const;
    01587
    01596     virtual unsigned GetSubType() const;
    01597
    01600     virtual PString GetFormatName() const;
    01602
    01603   protected:
    01604     Mode     mode;
    01605     Speed    speed;
    01606 };
    01607
    01608 #if 0
    01609
    01612 class H323_G728Capability : public H323AudioCapability
    01613 {
    01614   PCLASSINFO(H323_G728Capability, H323AudioCapability)
    01615
    01616   public:
    01621     H323_G728Capability();
    01623
    01628     virtual PObject * Clone() const;
    01630
    01636     virtual unsigned GetSubType() const;
    01637
    01640     virtual PString GetFormatName() const;
    01642 };
    01643
    01644
    01647 class H323_G729Capability : public H323AudioCapability
    01648 {
    01649   PCLASSINFO(H323_G729Capability, H323AudioCapability)
    01650
    01651   public:
    01653     enum Mode {
    01654       e_Normal,
    01655       e_AnnexA,
    01656       e_AnnexB,
    01657       e_AnnexA_AnnexB
    01658     };
    01659
    01664     H323_G729Capability(
    01665       Mode mode
    01666     );
    01668
    01673     virtual PObject * Clone() const;
    01675
    01681     virtual unsigned GetSubType() const;
    01682
    01685     virtual PString GetFormatName() const;
    01687
    01688   protected:
    01689     Mode mode;
    01690 };
    01691
    01692
    01695 class H323_G7231Capability : public H323AudioCapability
    01696 {
    01697   PCLASSINFO(H323_G7231Capability, H323AudioCapability)
    01698
    01699   public:
    01704     H323_G7231Capability(
    01705       PBoolean allowSIDFrames = PTrue
    01706     );
    01708
    01713     virtual PObject * Clone() const;
    01715
    01721     virtual unsigned GetSubType() const;
    01722
    01725     virtual PString GetFormatName() const;
    01727
    01737     virtual PBoolean OnSendingPDU(
    01738       H245_AudioCapability & pdu,
    01739       unsigned packetSize
    01740     ) const;
    01741
    01749     virtual PBoolean OnReceivedPDU(
    01750       const H245_AudioCapability & pdu,
    01751       unsigned & packetSize
    01752     );
    01754
    01755   protected:
    01756     PBoolean allowSIDFrames;
    01757 };
    01758
    01759
    01762 class H323_GSM0610Capability : public H323AudioCapability
    01763 {
    01764   PCLASSINFO(H323_GSM0610Capability, H323AudioCapability)
    01765
    01766   public:
    01771     H323_GSM0610Capability();
    01773
    01778     virtual PObject * Clone() const;
    01780
    01789     virtual unsigned GetSubType() const;
    01790
    01793     virtual PString GetFormatName() const;
    01794
    01803     virtual void SetTxFramesInPacket(
    01804       unsigned frames
    01805     );
    01807
    01817     virtual PBoolean OnSendingPDU(
    01818       H245_AudioCapability & pdu,
    01819       unsigned packetSize
    01820     ) const;
    01821
    01829     virtual PBoolean OnReceivedPDU(
    01830       const H245_AudioCapability & pdu,
    01831       unsigned & packetSize
    01832     );
    01834 };
    01835
    01836 #endif
    01837
    01838
    01840
    01843 class H323_UserInputCapability : public H323Capability
    01844 {
    01845   PCLASSINFO(H323_UserInputCapability, H323Capability);
    01846
    01847   public:
    01850     enum SubTypes {
    01851       BasicString,
    01852       IA5String,
    01853       GeneralString,
    01854       SignalToneH245,
    01855       HookFlashH245,
    01856       SignalToneRFC2833,
    01857       NumSubTypes
    01858     };
    01859     static const char * GetSubTypeName(SubTypes subType);
    01860     friend ostream & operator<<(ostream & strm, SubTypes subType) { return strm << GetSubTypeName(subType); }
    01861
    01866     H323_UserInputCapability(
    01867       SubTypes subType
    01868     );
    01870
    01875     virtual PObject * Clone() const;
    01877
    01885     virtual MainTypes GetMainType() const;
    01886
    01890     virtual unsigned  GetSubType()  const;
    01891
    01894     virtual PString GetFormatName() const;
    01896
    01904     virtual H323Channel * CreateChannel(
    01905       H323Connection & connection,
    01906       H323Channel::Directions dir,
    01907       unsigned sessionID,
    01908       const H245_H2250LogicalChannelParameters * param
    01910     ) const;
    01912
    01922     virtual PBoolean OnSendingPDU(
    01923       H245_Capability & pdu
    01924     ) const;
    01925
    01933     virtual PBoolean OnSendingPDU(
    01934       H245_DataType & pdu
    01935     ) const;
    01936
    01945     virtual PBoolean OnSendingPDU(
    01946       H245_ModeElement & pdu
    01947     ) const;
    01948
    01958     virtual PBoolean OnReceivedPDU(
    01959       const H245_Capability & pdu
    01960     );
    01961
    01969     virtual PBoolean OnReceivedPDU(
    01970       const H245_DataType & pdu,
    01971       PBoolean receiver
    01972     );
    01973
    01982     virtual PBoolean IsUsable(
    01983       const H323Connection & connection
    01984     ) const;
    01986
    01987     static void AddAllCapabilities(
    01988       H323Capabilities & capabilities,
    01989       PINDEX descriptorNum,
    01990       PINDEX simultaneous
    01991     );
    01992
    01993   protected:
    01994     SubTypes subType;
    01995 };
    01996
    01997
    01998
    02000
    02001 PARRAY(H323CapabilitiesList, H323Capability);
    02002
    02003 PARRAY(H323CapabilitiesListArray, H323CapabilitiesList);
    02004
    02005 class H323SimultaneousCapabilities : public H323CapabilitiesListArray
    02006 {
    02007   PCLASSINFO(H323SimultaneousCapabilities, H323CapabilitiesListArray);
    02008   public:
    02009     PBoolean SetSize(PINDEX newSize);
    02010 };
    02011
    02012
    02013 PARRAY(H323CapabilitiesSetArray, H323SimultaneousCapabilities);
    02014
    02015
    02016 class H323CapabilitiesSet : public H323CapabilitiesSetArray
    02017 {
    02018   PCLASSINFO(H323CapabilitiesSet, H323CapabilitiesSetArray);
    02019   public:
    02021     PBoolean SetSize(PINDEX newSize);
    02022 };
    02023
    02024
    02027 class H323Capabilities : public PObject
    02028 {
    02029     PCLASSINFO(H323Capabilities, PObject);
    02030   public:
    02035     H323Capabilities();
    02036
    02039     H323Capabilities(
    02040       const H323Connection & connection,
    02041       const H245_TerminalCapabilitySet & pdu
    02042     );
    02043
    02048     H323Capabilities(
    02049       const H323Capabilities & original
    02050     );
    02051
    02056     H323Capabilities & operator=(
    02057       const H323Capabilities & original
    02058     );
    02060
    02065     void PrintOn(
    02066       ostream & strm
    02067     ) const;
    02069
    02074     PINDEX GetSize() const { return table.GetSize(); }
    02075
    02078     H323Capability & operator[](PINDEX i) const { return table[i]; }
    02079
    02100     PINDEX SetCapability(
    02101       PINDEX descriptorNum,
    02102       PINDEX simultaneous,
    02103       H323Capability * cap
    02104     );
    02105
    02108     PINDEX AddMediaFormat(
    02109       PINDEX descriptorNum,
    02110       PINDEX simultaneous,
    02111       const OpalMediaFormat & mediaFormat
    02112     );
    02113
    02118     PINDEX AddAllCapabilities(
    02119       PINDEX descriptorNum,
    02120       PINDEX simultaneous,
    02121       const PString & name,
    02122       PBoolean exact = PFalse
    02123     );
    02124
    02125     // this function is retained for backwards compatibility
    02126     PINDEX AddAllCapabilities(
    02127       const H323EndPoint &,
    02128       PINDEX descriptorNum,
    02129       PINDEX simultaneous,
    02130       const PString & name,
    02131       PBoolean exact = PFalse
    02132     )
    02133     { return AddAllCapabilities(descriptorNum, simultaneous, name, exact); }
    02134
    02143     void Add(
    02144       H323Capability * capability
    02145     );
    02146
    02153     H323Capability * Copy(
    02154       const H323Capability & capability
    02155     );
    02156
    02161     void Remove(
    02162       H323Capability * capability
    02163     );
    02164
    02169     void Remove(
    02170       const PString & formatName
    02171     );
    02172
    02176     void Remove(
    02177       const PStringArray & formatNames
    02178     );
    02179
    02182     void RemoveAll();
    02183
    02191     H323Capability * FindCapability(
    02192       unsigned capabilityNumber
    02193     ) const;
    02194
    02210     H323Capability * FindCapability(
    02211       const PString & formatName,
    02212       H323Capability::CapabilityDirection direction = H323Capability::e_Unknown,
    02214       PBoolean exact = PFalse
    02215     ) const;
    02216
    02222     H323Capability * FindCapability(
    02223       H323Capability::CapabilityDirection direction
    02224     ) const;
    02225
    02233     H323Capability * FindCapability(
    02234       const H323Capability & capability
    02235     ) const;
    02236
    02242     H323Capability * FindCapability(
    02243       const H245_Capability & cap
    02244     ) const;
    02245
    02251     H323Capability * FindCapability(
    02252       const H245_DataType & dataType
    02253     ) const;
    02254
    02260     H323Capability * FindCapability(
    02261       const H245_ModeElement & modeElement
    02262     ) const;
    02263
    02269     H323Capability * FindCapability(
    02270       H323Capability::MainTypes mainType,
    02271       unsigned subType = UINT_MAX
    02272     ) const;
    02273
    02276     void BuildPDU(
    02277       const H323Connection & connection,
    02278       H245_TerminalCapabilitySet & pdu
    02279     ) const;
    02280
    02283     PBoolean Merge(
    02284       const H323Capabilities & newCaps
    02285     );
    02286
    02293     void Reorder(
    02294       const PStringArray & preferenceOrder
    02295     );
    02296
    02299     PBoolean IsAllowed(
    02300       const H323Capability & capability
    02301     );
    02302
    02305     PBoolean IsAllowed(
    02306       unsigned capabilityNumber
    02307     );
    02308
    02311     PBoolean IsAllowed(
    02312       const H323Capability & capability1,
    02313       const H323Capability & capability2
    02314     );
    02315
    02318     PBoolean IsAllowed(
    02319       unsigned capabilityNumber1,
    02320       unsigned capabilityNumber2
    02321     );
    02322
    02325     OpalMediaFormatList GetMediaFormats() const;
    02326
    02327     const PStringSet & GetMediaPacketizations() const { return mediaPacketizations; }
    02329
    02330   protected:
    02331     H323CapabilitiesList table;
    02332     H323CapabilitiesSet  set;
    02333     PStringSet           mediaPacketizations;
    02334 };
    02335
    02336
    02338
    02339 /* New capability registration macros based on abstract factories
    02340  */
    02341 typedef PFactory<H323Capability, std::string> H323CapabilityFactory;
    02342
    02343 #define H323_REGISTER_CAPABILITY(cls, capName)   static H323CapabilityFactory::Worker<cls> cls##Factory(capName, true); \
    02344
    02345 #endif // __OPAL_H323CAPS_H
    02346
    02347