Fixed issue with use of static C string variables in DLL environment,
[opal.git] / include / h323 / h323caps.h
blob07f0d262dfaae21ffe886fe143576f33c642074a
1 /*
2 * h323caps.h
4 * H.323 protocol handler
6 * Open H323 Library
8 * Copyright (c) 1998-2001 Equivalence Pty. Ltd.
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
18 * under the License.
20 * The Original Code is Open H323 Library.
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 * Portions of this code were written with the assisance of funding from
25 * Vovida Networks, Inc. http://www.vovida.com.
27 * Contributor(s): ______________________________________.
29 * $Log$
30 * Revision 2.18 2007/04/10 05:15:53 rjongbloed
31 * Fixed issue with use of static C string variables in DLL environment,
32 * must use functional interface for correct initialisation.
34 * Revision 2.17 2006/08/11 07:52:01 csoutheren
35 * Fix problem with media format factory in VC 2005
36 * Fixing problems with Speex codec
37 * Remove non-portable usages of PFactory code
39 * Revision 2.16 2006/07/24 14:03:38 csoutheren
40 * Merged in audio and video plugins from CVS branch PluginBranch
42 * Revision 2.15.4.3 2006/04/10 06:24:29 csoutheren
43 * Backport from CVS head up to Plugin_Merge3
45 * Revision 2.15.4.2 2006/04/06 01:21:17 csoutheren
46 * More implementation of video codec plugins
48 * Revision 2.15.4.1 2006/03/23 07:55:18 csoutheren
49 * Audio plugin H.323 capability merging completed.
50 * GSM, LBC, G.711 working. Speex and LPC-10 are not
52 * Revision 2.15 2005/11/30 13:35:26 csoutheren
53 * Changed tags for Doxygen
55 * Revision 2.14 2005/02/21 12:19:45 rjongbloed
56 * Added new "options list" to the OpalMediaFormat class.
58 * Revision 2.13 2004/09/01 12:21:27 rjongbloed
59 * Added initialisation of H323EndPoints capability table to be all codecs so can
60 * correctly build remote caps from fqast connect params. This had knock on effect
61 * with const keywords added in numerous places.
63 * Revision 2.12 2004/02/19 10:46:43 rjongbloed
64 * Merged OpenH323 version 1.13.1 changes.
66 * Revision 2.11 2002/11/10 11:33:16 robertj
67 * Updated to OpenH323 v1.10.3
69 * Revision 2.10 2002/09/16 02:52:33 robertj
70 * Added #define so can select if #pragma interface/implementation is used on
71 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
73 * Revision 2.9 2002/09/04 06:01:46 robertj
74 * Updated to OpenH323 v1.9.6
76 * Revision 2.8 2002/07/01 04:56:29 robertj
77 * Updated to OpenH323 v1.9.1
79 * Revision 2.7 2002/02/19 07:44:13 robertj
80 * Added function to set teh RTP payload type for the capability.
82 * Revision 2.6 2002/02/11 09:32:11 robertj
83 * Updated to openH323 v1.8.0
85 * Revision 2.5 2002/01/22 04:59:04 robertj
86 * Update from OpenH323, RFC2833 support
88 * Revision 2.4 2002/01/14 06:35:56 robertj
89 * Updated to OpenH323 v1.7.9
91 * Revision 2.3 2001/11/02 10:45:19 robertj
92 * Updated to OpenH323 v1.7.3
94 * Revision 2.2 2001/10/05 00:22:13 robertj
95 * Updated to PWLib 1.2.0 and OpenH323 1.7.0
97 * Revision 2.1 2001/08/01 05:12:04 robertj
98 * Major changes to H.323 capabilities, uses OpalMediaFormat for base name.
99 * Added "known" codecs capability clases.
101 * Revision 2.0 2001/07/27 15:48:24 robertj
102 * Conversion of OpenH323 to Open Phone Abstraction Library (OPAL)
104 * Revision 1.40 2003/10/27 06:03:39 csoutheren
105 * Added support for QoS
106 * Thanks to Henry Harrison of AliceStreet
108 * Revision 1.39 2003/06/06 02:13:10 rjongbloed
109 * Changed non-standard capability semantics so can use C style strings as
110 * the embedded data block (ie automatically call strlen)
112 * Revision 1.38 2003/04/28 07:00:00 robertj
113 * Fixed problem with compiler(s) not correctly initialising static globals
115 * Revision 1.37 2003/04/27 23:49:21 craigs
116 * Fixed some comments and made list of registered codecs
117 * available outside h323caps.cxx
119 * Revision 1.36 2002/11/09 04:24:01 robertj
120 * Fixed minor documentation errors.
122 * Revision 1.35 2002/09/16 01:14:15 robertj
123 * Added #define so can select if #pragma interface/implementation is used on
124 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
126 * Revision 1.34 2002/09/03 06:19:36 robertj
127 * Normalised the multi-include header prevention ifdef/define symbol.
129 * Revision 1.33 2002/08/05 10:03:47 robertj
130 * Cosmetic changes to normalise the usage of pragma interface/implementation.
132 * Revision 1.32 2002/05/29 03:55:17 robertj
133 * Added protocol version number checking infrastructure, primarily to improve
134 * interoperability with stacks that are unforgiving of new features.
136 * Revision 1.31 2002/05/10 05:44:50 robertj
137 * Added the max bit rate field to the data channel capability class.
139 * Revision 1.30 2002/01/22 06:25:02 robertj
140 * Moved payload type to ancestor so any capability can adjust it on logical channel.
142 * Revision 1.29 2002/01/17 07:04:57 robertj
143 * Added support for RFC2833 embedded DTMF in the RTP stream.
145 * Revision 1.28 2002/01/16 05:37:41 robertj
146 * Added missing mode change functions on non standard capabilities.
148 * Revision 1.27 2002/01/09 00:21:36 robertj
149 * Changes to support outgoing H.245 RequstModeChange.
151 * Revision 1.26 2001/12/22 01:44:05 robertj
152 * Added more support for H.245 RequestMode operation.
154 * Revision 1.25 2001/10/24 01:20:34 robertj
155 * Added code to help with static linking of H323Capability names database.
157 * Revision 1.24 2001/09/21 02:48:51 robertj
158 * Added default implementation for PDU encode/decode for codecs
159 * that have simple integer as frames per packet.
161 * Revision 1.23 2001/09/11 10:21:40 robertj
162 * Added direction field to capabilities, thanks Nick Hoath.
164 * Revision 1.22 2001/07/19 09:50:40 robertj
165 * Added code for default session ID on data channel being three.
167 * Revision 1.21 2001/07/17 04:44:29 robertj
168 * Partial implementation of T.120 and T.38 logical channels.
170 * Revision 1.20 2001/05/21 07:20:47 robertj
171 * Removed redundent class name in declaration.
173 * Revision 1.19 2001/05/14 05:56:26 robertj
174 * Added H323 capability registration system so can add capabilities by
175 * string name instead of having to instantiate explicit classes.
177 * Revision 1.18 2001/05/02 16:22:21 rogerh
178 * Add IsAllow() for a single capability to check if it is in the
179 * capabilities set. This fixes the bug where OpenH323 would accept
180 * incoming H261 video even when told not to accept it.
182 * Revision 1.17 2001/03/16 23:00:21 robertj
183 * Improved validation of codec selection against capability set, thanks Chris Purvis.
185 * Revision 1.16 2001/02/09 05:16:24 robertj
186 * Added #pragma interface for GNU C++.
188 * Revision 1.15 2001/01/25 07:27:14 robertj
189 * Major changes to add more flexible OpalMediaFormat class to normalise
190 * all information about media types, especially codecs.
192 * Revision 1.14 2001/01/09 23:05:22 robertj
193 * Fixed inability to have 2 non standard codecs in capability table.
195 * Revision 1.13 2000/10/16 08:49:30 robertj
196 * Added single function to add all UserInput capability types.
198 * Revision 1.12 2000/08/23 14:23:11 craigs
199 * Added prototype support for Microsoft GSM codec
201 * Revision 1.11 2000/07/13 12:25:47 robertj
202 * Fixed problems with fast start frames per packet adjustment.
204 * Revision 1.10 2000/07/10 16:01:50 robertj
205 * Started fixing capability set merging, still more to do.
207 * Revision 1.9 2000/07/04 01:16:49 robertj
208 * Added check for capability allowed in "combinations" set, still needs more done yet.
210 * Revision 1.8 2000/06/03 03:16:47 robertj
211 * Fixed using the wrong capability table (should be connections) for some operations.
213 * Revision 1.7 2000/05/23 11:32:27 robertj
214 * Rewrite of capability table to combine 2 structures into one and move functionality into that class
215 * allowing some normalisation of usage across several applications.
216 * Changed H323Connection so gets a copy of capabilities instead of using endponts, allows adjustments
217 * to be done depending on the remote client application.
219 * Revision 1.6 2000/05/18 11:53:34 robertj
220 * Changes to support doc++ documentation generation.
222 * Revision 1.5 2000/05/10 04:05:26 robertj
223 * Changed capabilities so has a function to get name of codec, instead of relying on PrintOn.
225 * Revision 1.4 2000/05/02 04:32:24 robertj
226 * Fixed copyright notice comment.
228 * Revision 1.3 2000/04/05 19:01:12 robertj
229 * Added function so can change desired transmit packet size.
231 * Revision 1.2 2000/03/21 03:06:47 robertj
232 * Changes to make RTP TX of exact numbers of frames in some codecs.
234 * Revision 1.1 1999/12/23 23:02:35 robertj
235 * File reorganision for separating RTP from H.323 and creation of LID for VPB support.
239 #ifndef __OPAL_H323CAPS_H
240 #define __OPAL_H323CAPS_H
242 #ifdef P_USE_PRAGMA
243 #pragma interface
244 #endif
247 #include <opal/mediafmt.h>
248 #include <h323/channels.h>
251 /* The following classes have forward references to avoid including the VERY
252 large header files for H225 and H245. If an application requires access
253 to the protocol classes they can include them, but for simple usage their
254 inclusion can be avoided.
256 class PASN_Choice;
257 class H245_Capability;
258 class H245_DataType;
259 class H245_ModeElement;
260 class H245_AudioCapability;
261 class H245_AudioMode;
262 class H245_VideoCapability;
263 class H245_VideoMode;
264 class H245_DataApplicationCapability;
265 class H245_DataMode;
266 class H245_DataProtocolCapability;
267 class H245_H2250LogicalChannelParameters;
268 class H245_TerminalCapabilitySet;
269 class H245_NonStandardParameter;
270 class H323Connection;
271 class H323Capabilities;
272 class H245_CapabilityIdentifier;
273 class H245_GenericCapability;
274 class H245_GenericParameter;
276 ///////////////////////////////////////////////////////////////////////////////
278 /**This class describes the interface to a capability of the endpoint, usually
279 a codec, used to transfer data via the logical channels opened and managed
280 by the H323 control channel.
282 Note that this is not an instance of the codec itself. Merely the
283 description of that codec. There is typically only one instance of this
284 class contained in the capability tables of the endpoint. There may be
285 several instances of the actualy codec managing the conversion of an
286 individual stream of data.
288 An application may create a descendent off this class and override
289 functions as required for describing a codec that it implements.
291 class H323Capability : public PObject
293 PCLASSINFO(H323Capability, PObject);
295 public:
296 /**@name Construction */
297 //@{
298 /**Create a new capability specification.
300 H323Capability();
301 //@}
303 /**@name Overrides from class PObject */
304 //@{
305 /**Compare two capability instances. This compares the main and sub-types
306 of the capability.
308 Comparison Compare(const PObject & obj) const;
310 /**Print out the object to the stream, virtual version of << operator.
312 void PrintOn(ostream & strm) const;
313 //@}
315 /**@name Identification functions */
316 //@{
317 enum MainTypes {
318 /// Audio codec capability
319 e_Audio,
320 /// Video codec capability
321 e_Video,
322 /// Arbitrary data capability
323 e_Data,
324 /// User Input capability
325 e_UserInput,
326 /// Count of main types
327 e_NumMainTypes
330 /**Get the main type of the capability.
332 This function is overridden by one of the three main sub-classes off
333 which real capabilities would be descendend.
335 virtual MainTypes GetMainType() const = 0;
337 /**Get the sub-type of the capability. This is a code dependent on the
338 main type of the capability.
340 virtual unsigned GetSubType() const = 0;
342 /**Get the name of the media data format this class represents.
344 virtual PString GetFormatName() const = 0;
345 //@}
347 /**@name Operations */
348 //@{
349 /**Create an H323Capability descendant given a string name.
350 This uses the registration system to create the capability.
352 static H323Capability * Create(
353 const PString & name ///< Name of capability
356 /**Get the default RTP session.
357 This function gets the default RTP session ID for the capability
358 type. For example audio capabilities return the value
359 RTP_Session::DefaultAudioSessionID etc.
361 The default behaviour returns zero, indicating it is not an RTP
362 based capability.
364 virtual unsigned GetDefaultSessionID() const;
366 /**Set the maximum size (in frames) of data that will be transmitted in a
367 single PDU.
369 This will also be the desired number that will be sent by most codec
370 implemetations.
372 The default behaviour does nothing.
374 virtual void SetTxFramesInPacket(
375 unsigned frames ///< Number of frames per packet
378 /**Get the maximum size (in frames) of data that will be transmitted in a single PDU.
380 The default behaviour returns the value 1.
382 virtual unsigned GetTxFramesInPacket() const;
384 /**Get the maximum size (in frames) of data that can be received in a single PDU.
386 The default behaviour returns the value 1.
388 virtual unsigned GetRxFramesInPacket() const;
390 /**Create the channel instance, allocating resources as required.
391 This creates a logical channel object appropriate for the parameters
392 provided. Not if param is NULL, sessionID must be provided, otherwise
393 this is taken from the fields in param.
395 virtual H323Channel * CreateChannel(
396 H323Connection & connection, ///< Owner connection for channel
397 H323Channel::Directions dir, ///< Direction of channel
398 unsigned sessionID, ///< Session ID for RTP channel
399 const H245_H2250LogicalChannelParameters * param
400 ///< Parameters for channel
401 ) const = 0;
402 //@}
404 /**@name Protocol manipulation */
405 //@{
406 /**This function is called whenever and outgoing TerminalCapabilitySet
407 PDU is being constructed for the control channel. It allows the
408 capability to set the PDU fields from information in members specific
409 to the class.
411 The default behaviour is pure.
413 virtual BOOL OnSendingPDU(
414 H245_Capability & pdu ///< PDU to set information on
415 ) const = 0;
417 /**This function is called whenever and outgoing OpenLogicalChannel
418 PDU is being constructed for the control channel. It allows the
419 capability to set the PDU fields from information in members specific
420 to the class.
422 The default behaviour is pure.
424 virtual BOOL OnSendingPDU(
425 H245_DataType & pdu ///< PDU to set information on
426 ) const = 0;
428 /**This function is called whenever and outgoing RequestMode
429 PDU is being constructed for the control channel. It allows the
430 capability to set the PDU fields from information in members specific
431 to the class.
433 The default behaviour is pure.
435 virtual BOOL OnSendingPDU(
436 H245_ModeElement & pdu ///< PDU to set information on
437 ) const = 0;
439 /**This function is called whenever and incoming TerminalCapabilitySet
440 PDU is received on the control channel, and a new H323Capability
441 descendent was created. This completes reading fields from the PDU
442 into the classes members.
444 If the function returns FALSE then the received PDU codec description
445 is not supported, so will be ignored.
447 The default behaviour sets the capabilityDirection member variable
448 from the PDU and then returns TRUE. Note that this means it is very
449 important to call the ancestor function when overriding.
451 virtual BOOL OnReceivedPDU(
452 const H245_Capability & pdu ///< PDU to get information from
455 /**This function is called whenever and incoming OpenLogicalChannel
456 PDU has been used to construct the control channel. It allows the
457 capability to set from the PDU fields, information in members specific
458 to the class.
460 The default behaviour is pure.
462 virtual BOOL OnReceivedPDU(
463 const H245_DataType & pdu, ///< PDU to get information from
464 BOOL receiver ///< Is receiver OLC
465 ) = 0;
467 /**Compare the nonStandardData part of the capability, if applicable.
469 virtual BOOL IsNonStandardMatch(
470 const H245_NonStandardParameter & param ///< Non standard field in PDU received
471 ) const;
473 /**Validate that the capability is usable given the connection.
474 This checks agains the negotiated protocol version number and remote
475 application to determine if this capability should be used in TCS or
476 OLC pdus.
478 The default behaviour returns TRUE.
480 virtual BOOL IsUsable(
481 const H323Connection & connection
482 ) const;
483 //@}
485 /**@name Member variable access */
486 //@{
487 enum CapabilityDirection {
488 e_Unknown,
489 e_Receive,
490 e_Transmit,
491 e_ReceiveAndTransmit,
492 e_NoDirection,
493 NumCapabilityDirections
496 /**Get the direction for this capability.
498 CapabilityDirection GetCapabilityDirection() const { return capabilityDirection; }
500 /**Set the direction for this capability.
502 void SetCapabilityDirection(
503 CapabilityDirection dir ///< New direction code
504 ) { capabilityDirection = dir; }
506 /// Get unique capability number.
507 unsigned GetCapabilityNumber() const { return assignedCapabilityNumber; }
509 /// Set unique capability number.
510 void SetCapabilityNumber(unsigned num) { assignedCapabilityNumber = num; }
512 /**Get media format of the media data this class represents.
514 const OpalMediaFormat & GetMediaFormat() const;
516 /// Get the payload type for the capaibility
517 RTP_DataFrame::PayloadTypes GetPayloadType() const { return rtpPayloadType; }
519 /// Set the payload type for the capaibility
520 void SetPayloadType(RTP_DataFrame::PayloadTypes pt) { rtpPayloadType = pt; }
522 /// Attach a QoS specification to this channel
523 virtual void AttachQoS(RTP_QOS *) { }
524 //@}
526 #if PTRACING
527 friend ostream & operator<<(ostream & o , MainTypes t);
528 friend ostream & operator<<(ostream & o , CapabilityDirection d);
529 #endif
531 protected:
532 OpalMediaFormat & GetWritableMediaFormat();
534 unsigned assignedCapabilityNumber; /// Unique ID assigned to capability
535 CapabilityDirection capabilityDirection;
536 RTP_DataFrame::PayloadTypes rtpPayloadType;
538 private:
539 OpalMediaFormat mediaFormat;
544 /**This class describes the interface to a non-standard codec used to
545 transfer data via the logical channels opened and managed by the H323
546 control channel.
548 It is expected that an application makes a descendent off
549 H323NonStandardAudioCapability or H323NonStandardVideoCapability which
550 multiply inherit from this class.
552 class H323NonStandardCapabilityInfo
554 public:
555 typedef PObject::Comparison (*CompareFuncType)(struct PluginCodec_H323NonStandardCodecData *);
557 /**Create a new set of information about a non-standard codec.
559 H323NonStandardCapabilityInfo(
560 CompareFuncType compareFunc,
561 const BYTE * dataBlock, ///< Non-Standard data for codec type
562 PINDEX dataSize ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
565 /**Create a new set of information about a non-standard codec.
567 H323NonStandardCapabilityInfo(
568 const BYTE * dataBlock, ///< Non-Standard data for codec type
569 PINDEX dataSize, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
570 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
571 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
574 /**Create a new set of information about a non-standard codec.
576 H323NonStandardCapabilityInfo(
577 const PString & oid,
578 const BYTE * dataBlock, ///< Non-Standard data for codec type
579 PINDEX dataSize, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
580 PINDEX comparisonOffset = 0,
581 PINDEX comparisonLength = P_MAX_INDEX
584 /**Create a new set of information about a non-standard codec.
586 H323NonStandardCapabilityInfo(
587 BYTE country, ///< t35 information
588 BYTE extension, ///< t35 information
589 WORD maufacturer, ///< t35 information
590 const BYTE * dataBlock, ///< Non-Standard data for codec type
591 PINDEX dataSize, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
592 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
593 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
596 /**Destroy the capability information
598 virtual ~H323NonStandardCapabilityInfo();
600 /**This function gets the non-standard data field.
602 The default behaviour sets data to fixedData.
604 virtual BOOL OnSendingPDU(
605 PBYTEArray & data ///< Data field in PDU to send
606 ) const;
608 /**This function validates and uses the non-standard data field.
610 The default behaviour returns TRUE if data is equal to fixedData.
612 virtual BOOL OnReceivedPDU(
613 const PBYTEArray & data ///< Data field in PDU received
616 PObject::Comparison CompareParam(
617 const H245_NonStandardParameter & param
618 ) const;
620 protected:
621 BOOL OnSendingNonStandardPDU(
622 PASN_Choice & pdu,
623 unsigned nonStandardTag
624 ) const;
625 BOOL OnReceivedNonStandardPDU(
626 const PASN_Choice & pdu,
627 unsigned nonStandardTag
630 PObject::Comparison CompareInfo(
631 const H323NonStandardCapabilityInfo & obj
632 ) const;
633 PObject::Comparison CompareData(
634 const PBYTEArray & data ///< Data field in PDU received
635 ) const;
637 PString oid;
638 BYTE t35CountryCode;
639 BYTE t35Extension;
640 WORD manufacturerCode;
641 PBYTEArray nonStandardData;
642 PINDEX comparisonOffset;
643 PINDEX comparisonLength;
644 CompareFuncType compareFunc;
647 /**This class describes the interface to a generic codec used to
648 transfer data via the logical channels opened and managed by the H323
649 control channel.
651 It is expected that an application makes a descendent off
652 H323GenericAudioCapability or H323GenericVideoCapability which
653 multiply inherit from this class.
656 class H323GenericCapabilityInfo
658 public:
659 H323GenericCapabilityInfo(
660 const PString &capabilityId, ///< generic codec identifier
661 PINDEX maxBitRate = 0 ///< maxBitRate parameter for the GenericCapability
663 H323GenericCapabilityInfo(const H323GenericCapabilityInfo &obj);
664 virtual ~H323GenericCapabilityInfo();
666 /**Compare the genericCapability part of the capability, if applicable.
668 virtual BOOL IsGenericMatch(
669 const H245_GenericCapability & param ///< Non standard field in PDU received
670 ) const;
672 /** Add a parameter which will be used in the TerminalCapabilitySet and
673 * OpenLogicalChannel messages */
674 virtual BOOL AddIntegerGenericParameter(
675 BOOL collapsing,
676 int standardId,
677 int type, ///< should be one of opalplugin.h:PluginCodec_H323GenericParameterType
678 long int value
681 protected:
682 virtual BOOL OnSendingGenericPDU(H245_GenericCapability & pdu) const;
683 virtual BOOL OnReceivedGenericPDU(const H245_GenericCapability &pdu);
685 PObject::Comparison CompareInfo(
686 const H323GenericCapabilityInfo & obj
687 ) const;
689 PINDEX maxBitRate;
690 H245_CapabilityIdentifier *capId;
692 /* parameters sent in the TerminalCapabilitySet and OpenLogicalChannel
693 messages */
694 PList<H245_GenericParameter> collapsingParameters;
695 PList<H245_GenericParameter> nonCollapsingParameters;
698 /**This class describes the interface to a codec that has channels based on
699 the RTP protocol.
701 An application may create a descendent off this class and override
702 functions as required for descibing the codec.
704 class H323RealTimeCapability : public H323Capability
706 PCLASSINFO(H323RealTimeCapability, H323Capability);
708 public:
709 /**@name Operations */
710 //@{
711 /**Create the channel instance, allocating resources as required.
713 virtual H323Channel * CreateChannel(
714 H323Connection & connection, ///< Owner connection for channel
715 H323Channel::Directions dir, ///< Direction of channel
716 unsigned sessionID, ///< Session ID for RTP channel
717 const H245_H2250LogicalChannelParameters * param
718 ///< Parameters for channel
719 ) const;
721 H323RealTimeCapability();
722 H323RealTimeCapability(const H323RealTimeCapability &rtc);
723 virtual ~H323RealTimeCapability();
724 void AttachQoS(RTP_QOS * _rtpqos);
726 protected:
727 RTP_QOS * rtpqos;
728 //@}
731 #if OPAL_AUDIO
733 /**This class describes the interface to an audio codec used to transfer data
734 via the logical channels opened and managed by the H323 control channel.
736 An application may create a descendent off this class and override
737 functions as required for descibing the codec.
739 class H323AudioCapability : public H323RealTimeCapability
741 PCLASSINFO(H323AudioCapability, H323RealTimeCapability);
743 public:
744 /**@name Construction */
745 //@{
746 /**Create an audio based capability.
748 H323AudioCapability();
749 //@}
751 /**@name Identification functions */
752 //@{
753 /**Get the main type of the capability.
754 Always returns e_Audio.
756 virtual MainTypes GetMainType() const;
757 //@}
759 /**@name Operations */
760 //@{
761 /**Get the default RTP session.
762 This function gets the default RTP session ID for the capability
763 type. For example audio capabilities return the value
764 RTP_Session::DefaultAudioSessionID etc.
766 The default behaviour returns zero, indicating it is not an RTP
767 based capability.
769 virtual unsigned GetDefaultSessionID() const;
771 /**Set the maximum size (in frames) of data that will be transmitted in a
772 single PDU.
774 This will also be the desired number that will be sent by most codec
775 implemetations.
777 The default behaviour sets the txFramesInPacket variable.
779 virtual void SetTxFramesInPacket(
780 unsigned frames ///< Number of frames per packet
783 /**Get the maximum size (in frames) of data that will be transmitted in a
784 single PDU.
786 The default behaviour sends the txFramesInPacket variable.
788 virtual unsigned GetTxFramesInPacket() const;
790 /**Get the maximum size (in frames) of data that can be received in a
791 single PDU.
793 The default behaviour sends the rxFramesInPacket variable.
795 virtual unsigned GetRxFramesInPacket() const;
796 //@}
798 /**@name Protocol manipulation */
799 //@{
800 /**This function is called whenever and outgoing TerminalCapabilitySet
801 PDU is being constructed for the control channel. It allows the
802 capability to set the PDU fields from information in members specific
803 to the class.
805 The default behaviour calls the OnSendingPDU() function with a more
806 specific PDU type.
808 virtual BOOL OnSendingPDU(
809 H245_Capability & pdu ///< PDU to set information on
810 ) const;
812 /**This function is called whenever and outgoing OpenLogicalChannel
813 PDU is being constructed for the control channel. It allows the
814 capability to set the PDU fields from information in members specific
815 to the class.
817 The default behaviour calls the OnSendingPDU() function with a more
818 specific PDU type.
820 virtual BOOL OnSendingPDU(
821 H245_DataType & pdu ///< PDU to set information on
822 ) const;
824 /**This function is called whenever and outgoing RequestMode
825 PDU is being constructed for the control channel. It allows the
826 capability to set the PDU fields from information in members specific
827 to the class.
829 The default behaviour calls the OnSendingPDU() function with a more
830 specific PDU type.
832 virtual BOOL OnSendingPDU(
833 H245_ModeElement & pdu ///< PDU to set information on
834 ) const;
836 /**This function is called whenever and outgoing TerminalCapabilitySet
837 or OpenLogicalChannel PDU is being constructed for the control channel.
838 It allows the capability to set the PDU fields from information in
839 members specific to the class.
841 The default behaviour assumes the pdu is an integer number of frames
842 per packet.
844 virtual BOOL OnSendingPDU(
845 H245_AudioCapability & pdu, ///< PDU to set information on
846 unsigned packetSize ///< Packet size to use in capability
847 ) const;
849 /**This function is called whenever and outgoing RequestMode
850 PDU is being constructed for the control channel. It allows the
851 capability to set the PDU fields from information in members specific
852 to the class.
854 The default behaviour sets the PDUs tag according to the GetSubType()
855 function (translated to different enum).
857 virtual BOOL OnSendingPDU(
858 H245_AudioMode & pdu ///< PDU to set information on
859 ) const;
861 /**This function is called whenever and incoming TerminalCapabilitySet
862 PDU is received on the control channel, and a new H323Capability
863 descendent was created. This completes reading fields from the PDU
864 into the classes members.
866 If the function returns FALSE then the received PDU codec description
867 is not supported, so will be ignored.
869 The default behaviour calls the OnReceivedPDU() that takes a
870 H245_AudioCapability and clamps the txFramesInPacket.
872 virtual BOOL OnReceivedPDU(
873 const H245_Capability & pdu ///< PDU to get information from
876 /**This function is called whenever and incoming OpenLogicalChannel
877 PDU has been used to construct the control channel. It allows the
878 capability to set from the PDU fields, information in members specific
879 to the class.
881 The default behaviour calls the OnReceivedPDU() that takes a
882 H245_AudioCapability and clamps the txFramesInPacket or
883 rxFramesInPacket.
885 virtual BOOL OnReceivedPDU(
886 const H245_DataType & pdu, ///< PDU to get information from
887 BOOL receiver ///< Is receiver OLC
890 /**This function is called whenever and incoming TerminalCapabilitySet
891 or OpenLogicalChannel PDU has been used to construct the control
892 channel. It allows the capability to set from the PDU fields,
893 information in members specific to the class.
895 The default behaviour assumes the pdu is an integer number of frames
896 per packet.
898 virtual BOOL OnReceivedPDU(
899 const H245_AudioCapability & pdu, ///< PDU to get information from
900 unsigned & packetSize ///< Packet size to use in capability
902 //@}
906 /**This class describes the interface to a non-standard audio codec used to
907 transfer data via the logical channels opened and managed by the H323
908 control channel.
910 An application may create a descendent off this class and override
911 functions as required for descibing the codec.
913 class H323NonStandardAudioCapability : public H323AudioCapability,
914 public H323NonStandardCapabilityInfo
916 PCLASSINFO(H323NonStandardAudioCapability, H323AudioCapability);
918 public:
919 /**@name Construction */
920 //@{
921 H323NonStandardAudioCapability(
922 H323NonStandardCapabilityInfo::CompareFuncType compareFunc,
923 const BYTE * dataBlock, ///< Non-Standard data for codec type
924 PINDEX dataSize ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
926 /**Create a new set of information about a non-standard codec.
928 H323NonStandardAudioCapability(
929 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
930 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
931 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
932 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
935 /**Create a new set of information about a non-standard codec.
937 H323NonStandardAudioCapability(
938 const PString & oid, ///< OID for indentification of codec
939 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
940 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
941 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
942 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
945 /**Create a new set of information about a non-standard codec.
947 H323NonStandardAudioCapability(
948 BYTE country, ///< t35 information
949 BYTE extension, ///< t35 information
950 WORD maufacturer, ///< t35 information
951 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
952 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
953 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
954 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
956 //@}
958 /**@name Overrides from class PObject */
959 //@{
960 /**Compare two capability instances. This compares the main and sub-types
961 of the capability.
963 Comparison Compare(const PObject & obj) const;
964 //@}
966 /**@name Identification functions */
967 //@{
968 /**Get the sub-type of the capability. This is a code dependent on the
969 main type of the capability.
971 This returns H245_AudioCapability::e_nonStandard.
973 virtual unsigned GetSubType() const;
974 //@}
976 /**@name Protocol manipulation */
977 //@{
978 /**This function is called whenever and outgoing TerminalCapabilitySet
979 or OpenLogicalChannel PDU is being constructed for the control channel.
980 It allows the capability to set the PDU fields from information in
981 members specific to the class.
983 The default behaviour calls H323NonStandardCapabilityinfo::OnSendingPDU()
984 to handle the PDU.
986 virtual BOOL OnSendingPDU(
987 H245_AudioCapability & pdu, ///< PDU to set information on
988 unsigned packetSize ///< Packet size to use in capability
989 ) const;
991 /**This function is called whenever and outgoing RequestMode
992 PDU is being constructed for the control channel. It allows the
993 capability to set the PDU fields from information in members specific
994 to the class.
996 The default behaviour calls H323NonStandardCapabilityinfo::OnSendingPDU()
997 to handle the PDU.
999 virtual BOOL OnSendingPDU(
1000 H245_AudioMode & pdu ///< PDU to set information on
1001 ) const;
1003 /**This function is called whenever and incoming TerminalCapabilitySet
1004 or OpenLogicalChannel PDU has been used to construct the control
1005 channel. It allows the capability to set from the PDU fields,
1006 information in members specific to the class.
1008 The default behaviour calls H323NonStandardCapabilityinfo::OnReceivedPDU()
1009 to handle the provided PDU.
1011 virtual BOOL OnReceivedPDU(
1012 const H245_AudioCapability & pdu, ///< PDU to get information from
1013 unsigned & packetSize ///< Packet size to use in capability
1016 /**Compare the nonStandardData part of the capability, if applicable.
1018 virtual BOOL IsNonStandardMatch(
1019 const H245_NonStandardParameter & param ///< Non standard field in PDU received
1020 ) const;
1021 //@}
1024 /**This class describes the interface to a generic audio codec used to
1025 transfer data via the logical channels opened and managed by the H323
1026 control channel.
1028 An application may create a descendent off this class and override
1029 functions as required for descibing the codec.
1031 class H323GenericAudioCapability : public H323AudioCapability,
1032 public H323GenericCapabilityInfo
1034 PCLASSINFO(H323NonStandardAudioCapability, H323AudioCapability);
1036 public:
1037 /**@name Construction */
1038 //@{
1039 /**Create a new set of information about a non-standard codec.
1041 H323GenericAudioCapability(
1042 const PString & capabilityId, ///< generic codec identifier
1043 PINDEX maxBitRate = 0 ///< maxBitRate parameter for the GenericCapability
1046 //@}
1048 /**@name Overrides from class PObject */
1049 //@{
1050 /**Compare two capability instances. This compares the main and sub-types
1051 of the capability.
1053 Comparison Compare(const PObject & obj) const;
1054 //@}
1056 /**@name Identification functions */
1057 //@{
1058 /**Get the sub-type of the capability. This is a code dependent on the
1059 main type of the capability.
1061 This returns H245_AudioCapability::e_genericCapability.
1063 virtual unsigned GetSubType() const;
1064 //@}
1066 /**@name Protocol manipulation */
1067 //@{
1068 /**This function is called whenever and outgoing TerminalCapabilitySet
1069 or OpenLogicalChannel PDU is being constructed for the control channel.
1070 It allows the capability to set the PDU fields from information in
1071 members specific to the class.
1073 The default behaviour calls H323GenericCapabilityinfo::OnSendingPDU()
1074 to handle the PDU.
1076 virtual BOOL OnSendingPDU(
1077 H245_AudioCapability & pdu, ///< PDU to set information on
1078 unsigned packetSize ///< Packet size to use in capability
1079 ) const;
1081 /**This function is called whenever and incoming TerminalCapabilitySet
1082 or OpenLogicalChannel PDU has been used to construct the control
1083 channel. It allows the capability to set from the PDU fields,
1084 information in members specific to the class.
1086 The default behaviour calls H323GenericCapabilityinfo::OnReceivedPDU()
1087 to handle the provided PDU.
1089 virtual BOOL OnReceivedPDU(
1090 const H245_AudioCapability & pdu, ///< PDU to get information from
1091 unsigned & packetSize ///< Packet size to use in capability
1094 /**Compare the generic part of the capability, if applicable.
1096 virtual BOOL IsGenericMatch(
1097 const H245_GenericCapability & param ///< Generic field in PDU received
1098 ) const { return H323GenericCapabilityInfo::IsGenericMatch(param); }
1100 //@}
1103 #endif // OPAL_AUDIO
1105 #if OPAL_VIDEO
1107 /**This class describes the interface to a video codec used to transfer data
1108 via the logical channels opened and managed by the H323 control channel.
1110 An application may create a descendent off this class and override
1111 functions as required for descibing a codec.
1113 class H323VideoCapability : public H323RealTimeCapability
1115 PCLASSINFO(H323VideoCapability, H323RealTimeCapability);
1117 public:
1118 /**@name Identification functions */
1119 //@{
1120 /**Get the main type of the capability.
1121 Always returns e_Video.
1123 virtual MainTypes GetMainType() const;
1124 //@}
1126 /**@name Operations */
1127 //@{
1128 /**Get the default RTP session.
1129 This function gets the default RTP session ID for the capability
1130 type. For example audio capabilities return the value
1131 RTP_Session::DefaultAudioSessionID etc.
1133 The default behaviour returns zero, indicating it is not an RTP
1134 based capability.
1136 virtual unsigned GetDefaultSessionID() const;
1137 //@}
1139 /**@name Protocol manipulation */
1140 //@{
1141 /**This function is called whenever and outgoing TerminalCapabilitySet
1142 PDU is being constructed for the control channel. It allows the
1143 capability to set the PDU fields from information in members specific
1144 to the class.
1146 The default behaviour calls the OnSendingPDU() function with a more
1147 specific PDU type.
1149 virtual BOOL OnSendingPDU(
1150 H245_Capability & pdu ///< PDU to set information on
1151 ) const;
1153 /**This function is called whenever and outgoing OpenLogicalChannel
1154 PDU is being constructed for the control channel. It allows the
1155 capability to set the PDU fields from information in members specific
1156 to the class.
1158 The default behaviour calls the OnSendingPDU() function with a more
1159 specific PDU type.
1161 virtual BOOL OnSendingPDU(
1162 H245_DataType & pdu ///< PDU to set information on
1163 ) const;
1165 /**This function is called whenever and outgoing RequestMode
1166 PDU is being constructed for the control channel. It allows the
1167 capability to set the PDU fields from information in members specific
1168 to the class.
1170 The default behaviour calls the OnSendingPDU() function with a more
1171 specific PDU type.
1173 virtual BOOL OnSendingPDU(
1174 H245_ModeElement & pdu ///< PDU to set information on
1175 ) const;
1177 /**This function is called whenever and outgoing TerminalCapabilitySet
1178 or OpenLogicalChannel PDU is being constructed for the control channel.
1179 It allows the capability to set the PDU fields from information in
1180 members specific to the class.
1182 The default behaviour is pure.
1184 virtual BOOL OnSendingPDU(
1185 H245_VideoCapability & pdu ///< PDU to set information on
1186 ) const = 0;
1188 /**This function is called whenever and outgoing RequestMode
1189 PDU is being constructed for the control channel. It allows the
1190 capability to set the PDU fields from information in members specific
1191 to the class.
1193 The default behaviour sets the PDUs tag according to the GetSubType()
1194 function (translated to different enum).
1196 virtual BOOL OnSendingPDU(
1197 H245_VideoMode & pdu ///< PDU to set information on
1198 ) const = 0;
1200 /**This function is called whenever and incoming TerminalCapabilitySet
1201 PDU is received on the control channel, and a new H323Capability
1202 descendent was created. This completes reading fields from the PDU
1203 into the classes members.
1205 If the function returns FALSE then the received PDU codec description
1206 is not supported, so will be ignored. The default behaviour simply
1207 returns TRUE.
1209 virtual BOOL OnReceivedPDU(
1210 const H245_Capability & pdu ///< PDU to get information from
1213 /**This function is called whenever and incoming OpenLogicalChannel
1214 PDU has been used to construct the control channel. It allows the
1215 capability to set from the PDU fields, information in members specific
1216 to the class.
1218 The default behaviour is pure.
1220 virtual BOOL OnReceivedPDU(
1221 const H245_DataType & pdu, ///< PDU to get information from
1222 BOOL receiver ///< Is receiver OLC
1225 /**This function is called whenever and incoming TerminalCapabilitySet
1226 or OpenLogicalChannel PDU has been used to construct the control
1227 channel. It allows the capability to set from the PDU fields,
1228 information in members specific to the class.
1230 The default behaviour is pure.
1232 virtual BOOL OnReceivedPDU(
1233 const H245_VideoCapability & pdu ///< PDU to set information on
1234 ) = 0;
1235 //@}
1239 /**This class describes the interface to a non-standard video codec used to
1240 transfer data via the logical channels opened and managed by the H323
1241 control channel.
1243 An application may create a descendent off this class and override
1244 functions as required for descibing the codec.
1246 class H323NonStandardVideoCapability : public H323VideoCapability,
1247 public H323NonStandardCapabilityInfo
1249 PCLASSINFO(H323NonStandardVideoCapability, H323VideoCapability);
1251 public:
1252 /**@name Construction */
1253 //@{
1254 H323NonStandardVideoCapability(
1255 H323NonStandardCapabilityInfo::CompareFuncType compareFunc,
1256 const BYTE * dataBlock, ///< Non-Standard data for codec type
1257 PINDEX dataSize ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
1259 /**Create a new set of information about a non-standard codec.
1261 H323NonStandardVideoCapability(
1262 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
1263 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
1264 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
1265 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
1268 /**Create a new set of information about a non-standard codec.
1270 H323NonStandardVideoCapability(
1271 const PString & oid, ///< OID for indentification of codec
1272 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
1273 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
1274 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
1275 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
1278 /**Create a new set of information about a non-standard codec.
1280 H323NonStandardVideoCapability(
1281 BYTE country, ///< t35 information
1282 BYTE extension, ///< t35 information
1283 WORD maufacturer, ///< t35 information
1284 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
1285 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
1286 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
1287 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
1289 //@}
1291 /**@name Overrides from class PObject */
1292 //@{
1293 /**Compare two capability instances. This compares the main and sub-types
1294 of the capability.
1296 Comparison Compare(const PObject & obj) const;
1297 //@}
1299 /**@name Identification functions */
1300 //@{
1301 /**Get the sub-type of the capability. This is a code dependent on the
1302 main type of the capability.
1304 This returns one of the four possible combinations of mode and speed
1305 using the enum values of the protocol ASN H245_AudioCapability class.
1307 virtual unsigned GetSubType() const;
1308 //@}
1310 /**@name Protocol manipulation */
1311 //@{
1312 /**This function is called whenever and outgoing TerminalCapabilitySet
1313 or OpenLogicalChannel PDU is being constructed for the control channel.
1314 It allows the capability to set the PDU fields from information in
1315 members specific to the class.
1317 The default behaviour calls H323NonStandardCapabilityinfo::OnSendingPDU()
1318 to handle the PDU.
1320 virtual BOOL OnSendingPDU(
1321 H245_VideoCapability & pdu ///< PDU to set information on
1322 ) const;
1324 /**This function is called whenever and outgoing RequestMode
1325 PDU is being constructed for the control channel. It allows the
1326 capability to set the PDU fields from information in members specific
1327 to the class.
1329 The default behaviour calls H323NonStandardCapabilityinfo::OnSendingPDU()
1330 to handle the PDU.
1332 virtual BOOL OnSendingPDU(
1333 H245_VideoMode & pdu ///< PDU to set information on
1334 ) const;
1336 /**This function is called whenever and incoming TerminalCapabilitySet
1337 or OpenLogicalChannel PDU has been used to construct the control
1338 channel. It allows the capability to set from the PDU fields,
1339 information in members specific to the class.
1341 The default behaviour calls H323NonStandardCapabilityinfo::OnReceivedPDU()
1342 to handle the provided PDU.
1344 virtual BOOL OnReceivedPDU(
1345 const H245_VideoCapability & pdu ///< PDU to set information on
1348 /**Compare the nonStandardData part of the capability, if applicable.
1350 virtual BOOL IsNonStandardMatch(
1351 const H245_NonStandardParameter & param ///< Non standard field in PDU received
1352 ) const;
1353 //@}
1356 /**This class describes the interface to a generic video codec used to
1357 transfer data via the logical channels opened and managed by the H323
1358 control channel.
1360 An application may create a descendent off this class and override
1361 functions as required for descibing the codec.
1363 class H323GenericVideoCapability : public H323VideoCapability,
1364 public H323GenericCapabilityInfo
1366 PCLASSINFO(H323GenericVideoCapability, H323VideoCapability);
1368 public:
1369 /**@name Construction */
1370 //@{
1371 /**Create a new set of information about a non-standard codec.
1373 H323GenericVideoCapability(
1374 const PString & capabilityId, ///< generic codec identifier
1375 PINDEX maxBitRate = 0 ///< maxBitRate parameter for the GenericCapability
1378 //@}
1380 /**@name Overrides from class PObject */
1381 //@{
1382 /**Compare two capability instances. This compares the main and sub-types
1383 of the capability.
1385 Comparison Compare(const PObject & obj) const;
1386 //@}
1388 /**@name Identification functions */
1389 //@{
1390 /**Get the sub-type of the capability. This is a code dependent on the
1391 main type of the capability.
1393 This returns H245_VideoCapability::e_genericCapability.
1395 virtual unsigned GetSubType() const;
1396 //@}
1398 /**@name Protocol manipulation */
1399 //@{
1400 /**This function is called whenever and outgoing TerminalCapabilitySet
1401 or OpenLogicalChannel PDU is being constructed for the control channel.
1402 It allows the capability to set the PDU fields from information in
1403 members specific to the class.
1405 The default behaviour calls H323GenericCapabilityinfo::OnSendingPDU()
1406 to handle the PDU.
1408 virtual BOOL OnSendingPDU(
1409 H245_VideoCapability & pdu ///< PDU to set information on
1410 ) const;
1412 /**This function is called whenever and outgoing RequestMode
1413 PDU is being constructed for the control channel. It allows the
1414 capability to set the PDU fields from information in members specific
1415 to the class.
1417 The default behaviour sets the PDUs tag according to the GetSubType()
1418 function (translated to different enum).
1420 virtual BOOL OnSendingPDU(
1421 H245_VideoMode & pdu ///< PDU to set information on
1422 ) const;
1424 /**This function is called whenever and incoming TerminalCapabilitySet
1425 or OpenLogicalChannel PDU has been used to construct the control
1426 channel. It allows the capability to set from the PDU fields,
1427 information in members specific to the class.
1429 The default behaviour calls H323GenericCapabilityinfo::OnReceivedPDU()
1430 to handle the provided PDU.
1432 virtual BOOL OnReceivedPDU(
1433 const H245_VideoCapability & pdu ///< PDU to get information from
1436 /**Compare the generic part of the capability, if applicable.
1438 virtual BOOL IsGenericMatch(
1439 const H245_GenericCapability & param ///< Generic field in PDU received
1440 ) const { return H323GenericCapabilityInfo::IsGenericMatch(param); }
1442 //@}
1445 #endif // OPAL_VIDEO
1447 /**This class describes the interface to a data channel used to transfer data
1448 via the logical channels opened and managed by the H323 control channel.
1450 An application may create a descendent off this class and override
1451 functions as required for descibing a codec.
1453 class H323DataCapability : public H323Capability
1455 PCLASSINFO(H323DataCapability, H323Capability);
1457 public:
1458 /**@name Construction */
1459 //@{
1460 /**Create a new data capability.
1462 H323DataCapability(
1463 unsigned maxBitRate = 0 ///< Maximum bit rate for data in 100's b/s
1465 //@}
1467 /**@name Identification functions */
1468 //@{
1469 /**Get the main type of the capability.
1470 Always returns e_Data.
1472 virtual MainTypes GetMainType() const;
1473 //@}
1475 /**@name Operations */
1476 //@{
1477 /**Get the default RTP session.
1478 This function gets the default RTP session ID for the capability
1479 type. For example audio capabilities return the value
1480 RTP_Session::DefaultAudioSessionID etc.
1482 The default behaviour returns 3, indicating a data session.
1484 virtual unsigned GetDefaultSessionID() const;
1485 //@}
1487 /**@name Protocol manipulation */
1488 //@{
1489 /**This function is called whenever and outgoing TerminalCapabilitySet
1490 PDU is being constructed for the control channel. It allows the
1491 capability to set the PDU fields from information in members specific
1492 to the class.
1494 The default behaviour calls the OnSendingPDU() function with a more
1495 specific PDU type.
1497 virtual BOOL OnSendingPDU(
1498 H245_Capability & pdu ///< PDU to set information on
1499 ) const;
1501 /**This function is called whenever and outgoing OpenLogicalChannel
1502 PDU is being constructed for the control channel. It allows the
1503 capability to set the PDU fields from information in members specific
1504 to the class.
1506 The default behaviour calls the OnSendingPDU() function with a more
1507 specific PDU type.
1509 virtual BOOL OnSendingPDU(
1510 H245_DataType & pdu ///< PDU to set information on
1511 ) const;
1513 /**This function is called whenever and outgoing RequestMode
1514 PDU is being constructed for the control channel. It allows the
1515 capability to set the PDU fields from information in members specific
1516 to the class.
1518 The default behaviour calls the OnSendingPDU() function with a more
1519 specific PDU type.
1521 virtual BOOL OnSendingPDU(
1522 H245_ModeElement & pdu ///< PDU to set information on
1523 ) const;
1525 /**This function is called whenever and outgoing TerminalCapabilitySet
1526 or OpenLogicalChannel PDU is being constructed for the control channel.
1527 It allows the capability to set the PDU fields from information in
1528 members specific to the class.
1530 The default behaviour is pure.
1532 virtual BOOL OnSendingPDU(
1533 H245_DataApplicationCapability & pdu ///< PDU to set information on
1534 ) const = 0;
1536 /**This function is called whenever and outgoing RequestMode
1537 PDU is being constructed for the control channel. It allows the
1538 capability to set the PDU fields from information in members specific
1539 to the class.
1541 The default behaviour sets the PDUs tag according to the GetSubType()
1542 function (translated to different enum).
1544 virtual BOOL OnSendingPDU(
1545 H245_DataMode & pdu ///< PDU to set information on
1546 ) const = 0;
1548 /**This function is called whenever and incoming TerminalCapabilitySet
1549 PDU is received on the control channel, and a new H323Capability
1550 descendent was created. This completes reading fields from the PDU
1551 into the classes members.
1553 If the function returns FALSE then the received PDU codec description
1554 is not supported, so will be ignored. The default behaviour simply
1555 returns TRUE.
1557 virtual BOOL OnReceivedPDU(
1558 const H245_Capability & pdu ///< PDU to get information from
1561 /**This function is called whenever and incoming OpenLogicalChannel
1562 PDU has been used to construct the control channel. It allows the
1563 capability to set from the PDU fields, information in members specific
1564 to the class.
1566 The default behaviour is pure.
1568 virtual BOOL OnReceivedPDU(
1569 const H245_DataType & pdu, ///< PDU to get information from
1570 BOOL receiver ///< Is receiver OLC
1573 /**This function is called whenever and incoming TerminalCapabilitySet
1574 or OpenLogicalChannel PDU has been used to construct the control
1575 channel. It allows the capability to set from the PDU fields,
1576 information in members specific to the class.
1578 The default behaviour is pure.
1580 virtual BOOL OnReceivedPDU(
1581 const H245_DataApplicationCapability & pdu ///< PDU to set information on
1582 ) = 0;
1583 //@}
1585 protected:
1586 unsigned maxBitRate;
1590 /**This class describes the interface to a non-standard data codec used to
1591 transfer data via the logical channels opened and managed by the H323
1592 control channel.
1594 An application may create a descendent off this class and override
1595 functions as required for descibing the codec.
1597 class H323NonStandardDataCapability : public H323DataCapability,
1598 public H323NonStandardCapabilityInfo
1600 PCLASSINFO(H323NonStandardDataCapability, H323DataCapability);
1602 public:
1603 /**@name Construction */
1604 //@{
1605 /**Create a new set of information about a non-standard codec.
1607 H323NonStandardDataCapability(
1608 unsigned maxBitRate, ///< Maximum bit rate for data in 100's b/s
1609 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
1610 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
1611 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
1612 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
1615 /**Create a new set of information about a non-standard codec.
1617 H323NonStandardDataCapability(
1618 unsigned maxBitRate, ///< Maximum bit rate for data in 100's b/s
1619 const PString & oid, ///< OID for indentification of codec
1620 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
1621 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
1622 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
1623 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
1626 /**Create a new set of information about a non-standard codec.
1628 H323NonStandardDataCapability(
1629 unsigned maxBitRate, ///< Maximum bit rate for data in 100's b/s
1630 BYTE country, ///< t35 information
1631 BYTE extension, ///< t35 information
1632 WORD maufacturer, ///< t35 information
1633 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
1634 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
1635 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
1636 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
1638 //@}
1640 /**@name Overrides from class PObject */
1641 //@{
1642 /**Compare two capability instances. This compares the main and sub-types
1643 of the capability.
1645 Comparison Compare(const PObject & obj) const;
1646 //@}
1648 /**@name Identification functions */
1649 //@{
1650 /**Get the sub-type of the capability. This is a code dependent on the
1651 main type of the capability.
1653 This returns one of the four possible combinations of mode and speed
1654 using the enum values of the protocol ASN H245_AudioCapability class.
1656 virtual unsigned GetSubType() const;
1657 //@}
1659 /**@name Protocol manipulation */
1660 //@{
1661 /**This function is called whenever and outgoing TerminalCapabilitySet
1662 or OpenLogicalChannel PDU is being constructed for the control channel.
1663 It allows the capability to set the PDU fields from information in
1664 members specific to the class.
1666 The default behaviour calls H323NonStandardCapabilityinfo::OnSendingPDU()
1667 to handle the PDU.
1669 virtual BOOL OnSendingPDU(
1670 H245_DataApplicationCapability & pdu ///< PDU to set information on
1671 ) const;
1673 /**This function is called whenever and outgoing RequestMode
1674 PDU is being constructed for the control channel. It allows the
1675 capability to set the PDU fields from information in members specific
1676 to the class.
1678 The default behaviour calls H323NonStandardCapabilityinfo::OnSendingPDU()
1679 to handle the PDU.
1681 virtual BOOL OnSendingPDU(
1682 H245_DataMode & pdu ///< PDU to set information on
1683 ) const;
1685 /**This function is called whenever and incoming TerminalCapabilitySet
1686 or OpenLogicalChannel PDU has been used to construct the control
1687 channel. It allows the capability to set from the PDU fields,
1688 information in members specific to the class.
1690 The default behaviour calls H323NonStandardCapabilityinfo::OnReceivedPDU()
1691 to handle the provided PDU.
1693 virtual BOOL OnReceivedPDU(
1694 const H245_DataApplicationCapability & pdu ///< PDU to set information on
1697 /**Compare the nonStandardData part of the capability, if applicable.
1699 virtual BOOL IsNonStandardMatch(
1700 const H245_NonStandardParameter & param ///< Non standard field in PDU received
1701 ) const;
1702 //@}
1706 ///////////////////////////////////////////////////////////////////////////////
1707 // Known audio codecs
1709 /**This class describes the G.711 codec capability.
1711 class H323_G711Capability : public H323AudioCapability
1713 PCLASSINFO(H323_G711Capability, H323AudioCapability)
1715 public:
1716 /// Specific G.711 encoding algorithm.
1717 enum Mode {
1718 /// European standard
1719 ALaw,
1720 /// American standard
1721 muLaw
1723 /// Specific G.711 encoding bit rates.
1724 enum Speed {
1725 /// European standard
1726 At64k,
1727 /// American standard
1728 At56k
1731 /**@name Construction */
1732 //@{
1733 /**Create a new G.711 capability.
1735 H323_G711Capability(
1736 Mode mode = muLaw, ///< Type of encoding.
1737 Speed speed = At64k ///< Encoding bit rate.
1739 //@}
1741 /**@name Overrides from class PObject */
1742 //@{
1743 /**Create a copy of the object.
1745 virtual PObject * Clone() const;
1746 //@}
1748 /**@name Identification functions */
1749 //@{
1750 /**Get the sub-type of the capability. This is a code dependent on the
1751 main type of the capability.
1753 This returns one of the four possible combinations of mode and speed
1754 using the enum values of the protocol ASN H245_AudioCapability class.
1756 virtual unsigned GetSubType() const;
1758 /**Get the name of the media data format this class represents.
1760 virtual PString GetFormatName() const;
1761 //@}
1763 protected:
1764 Mode mode;
1765 Speed speed;
1768 #if 0
1770 /**This class describes the G.728 codec capability.
1772 class H323_G728Capability : public H323AudioCapability
1774 PCLASSINFO(H323_G728Capability, H323AudioCapability)
1776 public:
1777 /**@name Construction */
1778 //@{
1779 /**Create a new G.728 capability.
1781 H323_G728Capability();
1782 //@}
1784 /**@name Overrides from class PObject */
1785 //@{
1786 /**Create a copy of the object.
1788 virtual PObject * Clone() const;
1789 //@}
1791 /**@name Identification functions */
1792 //@{
1793 /**Get the sub-type of the capability. This is a code dependent on the
1794 main type of the capability.
1796 virtual unsigned GetSubType() const;
1798 /**Get the name of the media data format this class represents.
1800 virtual PString GetFormatName() const;
1801 //@}
1805 /**This class describes the G.729 codec capability.
1807 class H323_G729Capability : public H323AudioCapability
1809 PCLASSINFO(H323_G729Capability, H323AudioCapability)
1811 public:
1812 /// Specific G.729 encoding algorithm.
1813 enum Mode {
1814 e_Normal,
1815 e_AnnexA,
1816 e_AnnexB,
1817 e_AnnexA_AnnexB
1820 /**@name Construction */
1821 //@{
1822 /**Create a new G.729 capability.
1824 H323_G729Capability(
1825 Mode mode
1827 //@}
1829 /**@name Overrides from class PObject */
1830 //@{
1831 /**Create a copy of the object.
1833 virtual PObject * Clone() const;
1834 //@}
1836 /**@name Identification functions */
1837 //@{
1838 /**Get the sub-type of the capability. This is a code dependent on the
1839 main type of the capability.
1841 virtual unsigned GetSubType() const;
1843 /**Get the name of the media data format this class represents.
1845 virtual PString GetFormatName() const;
1846 //@}
1848 protected:
1849 Mode mode;
1853 /**This class describes the G.723.1 codec capability.
1855 class H323_G7231Capability : public H323AudioCapability
1857 PCLASSINFO(H323_G7231Capability, H323AudioCapability)
1859 public:
1860 /**@name Construction */
1861 //@{
1862 /**Create a new G.723.1 capability.
1864 H323_G7231Capability(
1865 BOOL allowSIDFrames = TRUE ///< Allow SID frames in data stream.
1867 //@}
1869 /**@name Overrides from class PObject */
1870 //@{
1871 /**Create a copy of the object.
1873 virtual PObject * Clone() const;
1874 //@}
1876 /**@name Identification functions */
1877 //@{
1878 /**Get the sub-type of the capability. This is a code dependent on the
1879 main type of the capability.
1881 virtual unsigned GetSubType() const;
1883 /**Get the name of the media data format this class represents.
1885 virtual PString GetFormatName() const;
1886 //@}
1888 /**@name Protocol manipulation */
1889 //@{
1890 /**This function is called whenever and outgoing TerminalCapabilitySet
1891 or OpenLogicalChannel PDU is being constructed for the control channel.
1892 It allows the capability to set the PDU fields from information in
1893 members specific to the class.
1895 The default behaviour sets the data rate field in the PDU.
1897 virtual BOOL OnSendingPDU(
1898 H245_AudioCapability & pdu, ///< PDU to set information on
1899 unsigned packetSize ///< Packet size to use in capability
1900 ) const;
1902 /**This function is called whenever and incoming TerminalCapabilitySet
1903 or OpenLogicalChannel PDU has been used to construct the control
1904 channel. It allows the capability to set from the PDU fields,
1905 information in members specific to the class.
1907 The default behaviour gets the data rate field from the PDU.
1909 virtual BOOL OnReceivedPDU(
1910 const H245_AudioCapability & pdu, ///< PDU to get information from
1911 unsigned & packetSize ///< Packet size to use in capability
1913 //@}
1915 protected:
1916 BOOL allowSIDFrames;
1920 /**This class describes the GSM 06.10 codec capability.
1922 class H323_GSM0610Capability : public H323AudioCapability
1924 PCLASSINFO(H323_GSM0610Capability, H323AudioCapability)
1926 public:
1927 /**@name Construction */
1928 //@{
1929 /**Create a new GSM 06.10 capability.
1931 H323_GSM0610Capability();
1932 //@}
1934 /**@name Overrides from class PObject */
1935 //@{
1936 /**Create a copy of the object.
1938 virtual PObject * Clone() const;
1939 //@}
1941 /**@name Identification functions */
1942 //@{
1943 /**Get the sub-type of the capability. This is a code dependent on the
1944 main type of the capability.
1946 This returns one of the four possible combinations of mode and speed
1947 using the enum values of the protocol ASN H245_AudioCapability class.
1949 virtual unsigned GetSubType() const;
1951 /**Get the name of the media data format this class represents.
1953 virtual PString GetFormatName() const;
1955 /**Set the maximum size (in frames) of data that will be transmitted in a
1956 single PDU.
1958 This will also be the desired number that will be sent by most codec
1959 implemetations.
1961 The default behaviour sets the txFramesInPacket variable.
1963 virtual void SetTxFramesInPacket(
1964 unsigned frames ///< Number of frames per packet
1966 //@}
1968 /**@name Protocol manipulation */
1969 //@{
1970 /**This function is called whenever and outgoing TerminalCapabilitySet
1971 or OpenLogicalChannel PDU is being constructed for the control channel.
1972 It allows the capability to set the PDU fields from information in
1973 members specific to the class.
1975 The default behaviour sets the data rate field in the PDU.
1977 virtual BOOL OnSendingPDU(
1978 H245_AudioCapability & pdu, ///< PDU to set information on
1979 unsigned packetSize ///< Packet size to use in capability
1980 ) const;
1982 /**This function is called whenever and incoming TerminalCapabilitySet
1983 or OpenLogicalChannel PDU has been used to construct the control
1984 channel. It allows the capability to set from the PDU fields,
1985 information in members specific to the class.
1987 The default behaviour gets the data rate field from the PDU.
1989 virtual BOOL OnReceivedPDU(
1990 const H245_AudioCapability & pdu, ///< PDU to get information from
1991 unsigned & packetSize ///< Packet size to use in capability
1993 //@}
1996 #endif
1999 ///////////////////////////////////////////////////////////////////////////////
2001 /**This class describes the UserInput psuedo-channel.
2003 class H323_UserInputCapability : public H323Capability
2005 PCLASSINFO(H323_UserInputCapability, H323Capability);
2007 public:
2008 /**@name Construction */
2009 //@{
2010 enum SubTypes {
2011 BasicString,
2012 IA5String,
2013 GeneralString,
2014 SignalToneH245,
2015 HookFlashH245,
2016 SignalToneRFC2833,
2017 NumSubTypes
2019 static const char * GetSubTypeName(SubTypes subType);
2020 friend ostream & operator<<(ostream & strm, SubTypes subType) { return strm << GetSubTypeName(subType); }
2022 /**Create the capability for User Input.
2023 The subType parameter is a value from the enum
2024 H245_UserInputCapability::Choices.
2026 H323_UserInputCapability(
2027 SubTypes subType
2029 //@}
2031 /**@name Overrides from class PObject */
2032 //@{
2033 /**Create a copy of the object.
2035 virtual PObject * Clone() const;
2036 //@}
2038 /**@name Identification functions */
2039 //@{
2040 /**Get the main type of the capability.
2042 This function is overridden by one of the three main sub-classes off
2043 which real capabilities would be descendend.
2045 virtual MainTypes GetMainType() const;
2047 /**Get the sub-type of the capability. This is a code dependent on the
2048 main type of the capability.
2050 virtual unsigned GetSubType() const;
2052 /**Get the name of the media data format this class represents.
2054 virtual PString GetFormatName() const;
2055 //@}
2057 /**@name Operations */
2058 //@{
2059 /**Create the channel instance, allocating resources as required.
2060 This creates a logical channel object appropriate for the parameters
2061 provided. Not if param is NULL, sessionID must be provided, otherwise
2062 this is taken from the fields in param.
2064 virtual H323Channel * CreateChannel(
2065 H323Connection & connection, ///< Owner connection for channel
2066 H323Channel::Directions dir, ///< Direction of channel
2067 unsigned sessionID, ///< Session ID for RTP channel
2068 const H245_H2250LogicalChannelParameters * param
2069 ///< Parameters for channel
2070 ) const;
2071 //@}
2073 /**@name Protocol manipulation */
2074 //@{
2075 /**This function is called whenever and outgoing TerminalCapabilitySet
2076 PDU is being constructed for the control channel. It allows the
2077 capability to set the PDU fields from information in members specific
2078 to the class.
2080 The default behaviour is pure.
2082 virtual BOOL OnSendingPDU(
2083 H245_Capability & pdu ///< PDU to set information on
2084 ) const;
2086 /**This function is called whenever and outgoing OpenLogicalChannel
2087 PDU is being constructed for the control channel. It allows the
2088 capability to set the PDU fields from information in members specific
2089 to the class.
2091 The default behaviour is pure.
2093 virtual BOOL OnSendingPDU(
2094 H245_DataType & pdu ///< PDU to set information on
2095 ) const;
2097 /**This function is called whenever and outgoing RequestMode
2098 PDU is being constructed for the control channel. It allows the
2099 capability to set the PDU fields from information in members specific
2100 to the class.
2102 The default behaviour calls the OnSendingPDU() function with a more
2103 specific PDU type.
2105 virtual BOOL OnSendingPDU(
2106 H245_ModeElement & pdu ///< PDU to set information on
2107 ) const;
2109 /**This function is called whenever and incoming TerminalCapabilitySet
2110 PDU is received on the control channel, and a new H323Capability
2111 descendent was created. This completes reading fields from the PDU
2112 into the classes members.
2114 If the function returns FALSE then the received PDU codec description
2115 is not supported, so will be ignored. The default behaviour simply
2116 returns TRUE.
2118 virtual BOOL OnReceivedPDU(
2119 const H245_Capability & pdu ///< PDU to get information from
2122 /**This function is called whenever and incoming OpenLogicalChannel
2123 PDU has been used to construct the control channel. It allows the
2124 capability to set from the PDU fields, information in members specific
2125 to the class.
2127 The default behaviour is pure.
2129 virtual BOOL OnReceivedPDU(
2130 const H245_DataType & pdu, ///< PDU to get information from
2131 BOOL receiver ///< Is receiver OLC
2134 /**Validate that the capability is usable given the connection.
2135 This checks agains the negotiated protocol version number and remote
2136 application to determine if this capability should be used in TCS or
2137 OLC pdus.
2139 The default behaviour will check for early versions and return FALSE
2140 for RFC2833 mode.
2142 virtual BOOL IsUsable(
2143 const H323Connection & connection
2144 ) const;
2145 //@}
2147 static void AddAllCapabilities(
2148 H323Capabilities & capabilities, ///< Table to add capabilities to
2149 PINDEX descriptorNum, ///< The member of the capabilityDescriptor to add
2150 PINDEX simultaneous ///< The member of the SimultaneousCapabilitySet to add
2153 protected:
2154 SubTypes subType;
2159 ///////////////////////////////////////////////////////////////////////////////
2161 PLIST(H323CapabilitiesList, H323Capability);
2163 PARRAY(H323CapabilitiesListArray, H323CapabilitiesList);
2165 class H323SimultaneousCapabilities : public H323CapabilitiesListArray
2167 PCLASSINFO(H323SimultaneousCapabilities, H323CapabilitiesListArray);
2168 public:
2169 BOOL SetSize(PINDEX newSize);
2173 PARRAY(H323CapabilitiesSetArray, H323SimultaneousCapabilities);
2176 class H323CapabilitiesSet : public H323CapabilitiesSetArray
2178 PCLASSINFO(H323CapabilitiesSet, H323CapabilitiesSetArray);
2179 public:
2180 /// Set the new size of the table, internal use only.
2181 BOOL SetSize(PINDEX newSize);
2185 /**This class contains all of the capabilities and their combinations.
2187 class H323Capabilities : public PObject
2189 PCLASSINFO(H323Capabilities, PObject);
2190 public:
2191 /**@name Construction */
2192 //@{
2193 /**Construct an empty capability set.
2195 H323Capabilities();
2197 /**Construct a capability set from the H.245 PDU provided.
2199 H323Capabilities(
2200 const H323Connection & connection, ///< Connection for capabilities
2201 const H245_TerminalCapabilitySet & pdu ///< PDU to convert to a capability set.
2204 /**Construct a copy of a capability set.
2205 Note this will completely duplicate the set by making clones of every
2206 capability in the original set.
2208 H323Capabilities(
2209 const H323Capabilities & original ///< Original capabilities to duplicate
2212 /**Assign a copy of a capability set.
2213 Note this will completely duplicate the set by making clones of every
2214 capability in the original set.
2216 H323Capabilities & operator=(
2217 const H323Capabilities & original ///< Original capabilities to duplicate
2219 //@}
2221 /**@name Overrides from class PObject */
2222 //@{
2223 /**Print out the object to the stream, virtual version of << operator.
2225 void PrintOn(
2226 ostream & strm ///< Stream to print out to.
2227 ) const;
2228 //@}
2230 /**@name Operations */
2231 //@{
2232 /**Get the number of capabilities in the set.
2234 PINDEX GetSize() const { return table.GetSize(); }
2236 /**Get the capability at the specified index.
2238 H323Capability & operator[](PINDEX i) const { return table[i]; }
2240 /**Set the capability descriptor lists. This is three tier set of
2241 codecs. The top most level is a list of particular capabilities. Each
2242 of these consists of a list of alternatives that can operate
2243 simultaneously. The lowest level is a list of codecs that cannot
2244 operate together. See H323 section 6.2.8.1 and H245 section 7.2 for
2245 details.
2247 If descriptorNum is P_MAX_INDEX, the the next available index in the
2248 array of descriptors is used. Similarly if simultaneous is P_MAX_INDEX
2249 the the next available SimultaneousCapabilitySet is used. The return
2250 value is the index used for the new entry. Note if both are P_MAX_INDEX
2251 then the return value is the descriptor index as the simultaneous index
2252 must be zero.
2254 Note that the capability specified here is automatically added to the
2255 capability table using the AddCapability() function. A specific
2256 instance of a capability is only ever added once, so multiple
2257 SetCapability() calls with the same H323Capability pointer will only
2258 add that capability once.
2260 PINDEX SetCapability(
2261 PINDEX descriptorNum, ///< The member of the capabilityDescriptor to add
2262 PINDEX simultaneous, ///< The member of the SimultaneousCapabilitySet to add
2263 H323Capability * cap ///< New capability specification
2266 /**Add all matching capabilities to descriptor lists.
2267 All capabilities that match the specified name are added as in the other
2268 form of the SetCapability() function.
2270 PINDEX AddAllCapabilities(
2271 PINDEX descriptorNum, ///< The member of the capabilityDescriptor to add
2272 PINDEX simultaneous, ///< The member of the SimultaneousCapabilitySet to add
2273 const PString & name ///< New capabilities name, if using "known" one.
2276 // this function is retained for backwards compatibility
2277 PINDEX AddAllCapabilities(
2278 const H323EndPoint &, ///< The endpoint adding the capabilities.
2279 PINDEX descriptorNum, ///< The member of the capabilityDescriptor to add
2280 PINDEX simultaneous, ///< The member of the SimultaneousCapabilitySet to add
2281 const PString & name ///< New capabilities name, if using "known" one.
2283 { return AddAllCapabilities(descriptorNum, simultaneous, name); }
2285 /**Add a codec to the capabilities table. This will assure that the
2286 assignedCapabilityNumber field in the capability is unique for all
2287 capabilities installed on this set.
2289 If the specific instance of the capability is already in the table, it
2290 is not added again. Ther can be multiple instances of the same
2291 capability class however.
2293 void Add(
2294 H323Capability * capability ///< New capability specification
2297 /**Copy a codec to the capabilities table. This will make a clone of the
2298 capability and assure that the assignedCapabilityNumber field in the
2299 capability is unique for all capabilities installed on this set.
2301 Returns the copy that is put in the table.
2303 H323Capability * Copy(
2304 const H323Capability & capability ///< New capability specification
2307 /**Remove a capability from the table. Note that the the parameter must be
2308 the actual instance of the capability in the table. The instance is
2309 deleted when removed from the table.
2311 void Remove(
2312 H323Capability * capability ///< Existing capability specification
2315 /**Remove all capabilities matching the string. This uses FindCapability()
2316 to locate the first capability whose format name does a partial match
2317 for the argument.
2319 void Remove(
2320 const PString & formatName ///< Format name to search for.
2323 /**Remove all capabilities matching any of the strings provided. This
2324 simply calls Remove() for each string in the list.
2326 void Remove(
2327 const PStringArray & formatNames ///< Array of format names to remove
2330 /**Remove all of the capabilities.
2332 void RemoveAll();
2334 /**Find the capability given the capability number. This number is
2335 guarenteed to be unique for a give capability table. Note that is may
2336 not be the same as the index into the table.
2338 Returns:
2339 NULL if no capability meeting the criteria was found
2341 H323Capability * FindCapability(
2342 unsigned capabilityNumber
2343 ) const;
2345 /**Find the capability given the capability format name string. This does
2346 a partial match for the supplied argument. If the argument matches a
2347 substring of the actual capabilities name, then it is returned. For
2348 example "GSM" or "0610" will match "GSM 0610". Note case is not
2349 significant.
2351 The user should be carefull of using short strings such as "G"!
2353 The direction parameter can further refine the search for specific
2354 receive or transmit capabilities. The default value of e_Unknown will
2355 wildcard that field.
2357 Returns:
2358 NULL if no capability meeting the criteria was found
2360 H323Capability * FindCapability(
2361 const PString & formatName, ///< Wildcard format name to search for
2362 H323Capability::CapabilityDirection direction = H323Capability::e_Unknown
2363 ///< Optional direction to include into search criteria
2364 ) const;
2366 /**Find the first capability in the table of the specified direction.
2368 Returns:
2369 NULL if no capability meeting the criteria was found
2371 H323Capability * FindCapability(
2372 H323Capability::CapabilityDirection direction ///< Direction to search for
2373 ) const;
2375 /**Find the capability given the capability. This does a value compare of
2376 the two capabilities. Usually this means the mainType and subType are
2377 the same.
2379 Returns:
2380 NULL if no capability meeting the criteria was found
2382 H323Capability * FindCapability(
2383 const H323Capability & capability ///< Capability to search for
2384 ) const;
2386 /**Find the capability given the H.245 capability PDU.
2388 Returns:
2389 NULL if no capability meeting the criteria was found
2391 H323Capability * FindCapability(
2392 const H245_Capability & cap ///< H245 capability table entry
2393 ) const;
2395 /**Find the capability given the H.245 data type PDU.
2397 Returns:
2398 NULL if no capability meeting the criteria was found
2400 H323Capability * FindCapability(
2401 const H245_DataType & dataType ///< H245 data type of codec
2402 ) const;
2404 /**Find the capability given the H.245 data type PDU.
2406 Returns:
2407 NULL if no capability meeting the criteria was found
2409 H323Capability * FindCapability(
2410 const H245_ModeElement & modeElement ///< H245 data type of codec
2411 ) const;
2413 /**Find the capability given the sub-type info.
2415 Returns:
2416 NULL if no capability meeting the criteria was found
2418 H323Capability * FindCapability(
2419 H323Capability::MainTypes mainType, ///< Main type to find
2420 const PASN_Choice & subTypePDU, ///< Sub-type info
2421 unsigned nonStandardTag ///< NOn-standard tag ID for sub-type
2422 ) const;
2424 /**Find the capability given the type codecs.
2426 Returns:
2427 NULL if no capability meeting the criteria was found
2429 H323Capability * FindCapability(
2430 H323Capability::MainTypes mainType, ///< Main type to find
2431 unsigned subType = UINT_MAX ///< Sub-type to find (UINT_MAX=ignore)
2432 ) const;
2434 /**Build a H.245 PDU from the information in the capability set.
2436 void BuildPDU(
2437 const H323Connection & connection, ///< Connection building PDU for
2438 H245_TerminalCapabilitySet & pdu ///< PDU to build
2439 ) const;
2441 /**Merge the capabilities into this set.
2443 BOOL Merge(
2444 const H323Capabilities & newCaps
2447 /**Change the order of capabilities in the table to the order specified.
2448 Note that this does not change the unique capability numbers assigned
2449 when the capability is first added to the set.
2451 The string matching rules are as for the FindCapability() function.
2453 void Reorder(
2454 const PStringArray & preferenceOrder ///< New order
2457 /**Test if the capability is allowed.
2459 BOOL IsAllowed(
2460 const H323Capability & capability
2463 /**Test if the capability is allowed.
2465 BOOL IsAllowed(
2466 unsigned capabilityNumber
2469 /**Test if the capabilities are an allowed combination.
2471 BOOL IsAllowed(
2472 const H323Capability & capability1,
2473 const H323Capability & capability2
2476 /**Test if the capabilities are an allowed combination.
2478 BOOL IsAllowed(
2479 unsigned capabilityNumber1,
2480 unsigned capabilityNumber2
2483 /**Get the list of capabilities as a list of media formats.
2485 OpalMediaFormatList GetMediaFormats() const;
2486 //@}
2488 protected:
2489 H323CapabilitiesList table;
2490 H323CapabilitiesSet set;
2494 ///////////////////////////////////////////////////////////////////////////////
2496 /* New capability registration macros based on abstract factories
2498 typedef PFactory<H323Capability, std::string> H323CapabilityFactory;
2500 #define H323_REGISTER_CAPABILITY(cls, capName) static H323CapabilityFactory::Worker<cls> cls##Factory(capName, true); \
2502 #define H323_DECLARE_CAPABILITY_CLASS(cls, anc) \
2503 class cls : public anc \
2505 public: \
2506 cls() \
2508 #endif // __OPAL_H323CAPS_H
2511 /////////////////////////////////////////////////////////////////////////////