Major codec API update:
[opal.git] / include / h323 / h323caps.h
blobd5b57c3861424138db0400ccc17b8fcc36c245ee
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.19 2007/06/22 05:49:12 rjongbloed
31 * Major codec API update:
32 * Automatically map OpalMediaOptions to SIP/SDP FMTP parameters.
33 * Automatically map OpalMediaOptions to H.245 Generic Capability parameters.
34 * Largely removed need to distinguish between SIP and H.323 codecs.
35 * New mechanism for setting OpalMediaOptions from within a plug in.
36 * Fixed removal of H.323 capabilities just because media format name is a
37 * substring of capability name.
38 * Fixed inadequacies in H.245 Generic Capabilities (must be able to
39 * distinguish between TCS, OLC and ReqMode).
41 * Revision 2.18 2007/04/10 05:15:53 rjongbloed
42 * Fixed issue with use of static C string variables in DLL environment,
43 * must use functional interface for correct initialisation.
45 * Revision 2.17 2006/08/11 07:52:01 csoutheren
46 * Fix problem with media format factory in VC 2005
47 * Fixing problems with Speex codec
48 * Remove non-portable usages of PFactory code
50 * Revision 2.16 2006/07/24 14:03:38 csoutheren
51 * Merged in audio and video plugins from CVS branch PluginBranch
53 * Revision 2.15.4.3 2006/04/10 06:24:29 csoutheren
54 * Backport from CVS head up to Plugin_Merge3
56 * Revision 2.15.4.2 2006/04/06 01:21:17 csoutheren
57 * More implementation of video codec plugins
59 * Revision 2.15.4.1 2006/03/23 07:55:18 csoutheren
60 * Audio plugin H.323 capability merging completed.
61 * GSM, LBC, G.711 working. Speex and LPC-10 are not
63 * Revision 2.15 2005/11/30 13:35:26 csoutheren
64 * Changed tags for Doxygen
66 * Revision 2.14 2005/02/21 12:19:45 rjongbloed
67 * Added new "options list" to the OpalMediaFormat class.
69 * Revision 2.13 2004/09/01 12:21:27 rjongbloed
70 * Added initialisation of H323EndPoints capability table to be all codecs so can
71 * correctly build remote caps from fqast connect params. This had knock on effect
72 * with const keywords added in numerous places.
74 * Revision 2.12 2004/02/19 10:46:43 rjongbloed
75 * Merged OpenH323 version 1.13.1 changes.
77 * Revision 2.11 2002/11/10 11:33:16 robertj
78 * Updated to OpenH323 v1.10.3
80 * Revision 2.10 2002/09/16 02:52:33 robertj
81 * Added #define so can select if #pragma interface/implementation is used on
82 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
84 * Revision 2.9 2002/09/04 06:01:46 robertj
85 * Updated to OpenH323 v1.9.6
87 * Revision 2.8 2002/07/01 04:56:29 robertj
88 * Updated to OpenH323 v1.9.1
90 * Revision 2.7 2002/02/19 07:44:13 robertj
91 * Added function to set teh RTP payload type for the capability.
93 * Revision 2.6 2002/02/11 09:32:11 robertj
94 * Updated to openH323 v1.8.0
96 * Revision 2.5 2002/01/22 04:59:04 robertj
97 * Update from OpenH323, RFC2833 support
99 * Revision 2.4 2002/01/14 06:35:56 robertj
100 * Updated to OpenH323 v1.7.9
102 * Revision 2.3 2001/11/02 10:45:19 robertj
103 * Updated to OpenH323 v1.7.3
105 * Revision 2.2 2001/10/05 00:22:13 robertj
106 * Updated to PWLib 1.2.0 and OpenH323 1.7.0
108 * Revision 2.1 2001/08/01 05:12:04 robertj
109 * Major changes to H.323 capabilities, uses OpalMediaFormat for base name.
110 * Added "known" codecs capability clases.
112 * Revision 2.0 2001/07/27 15:48:24 robertj
113 * Conversion of OpenH323 to Open Phone Abstraction Library (OPAL)
115 * Revision 1.40 2003/10/27 06:03:39 csoutheren
116 * Added support for QoS
117 * Thanks to Henry Harrison of AliceStreet
119 * Revision 1.39 2003/06/06 02:13:10 rjongbloed
120 * Changed non-standard capability semantics so can use C style strings as
121 * the embedded data block (ie automatically call strlen)
123 * Revision 1.38 2003/04/28 07:00:00 robertj
124 * Fixed problem with compiler(s) not correctly initialising static globals
126 * Revision 1.37 2003/04/27 23:49:21 craigs
127 * Fixed some comments and made list of registered codecs
128 * available outside h323caps.cxx
130 * Revision 1.36 2002/11/09 04:24:01 robertj
131 * Fixed minor documentation errors.
133 * Revision 1.35 2002/09/16 01:14:15 robertj
134 * Added #define so can select if #pragma interface/implementation is used on
135 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
137 * Revision 1.34 2002/09/03 06:19:36 robertj
138 * Normalised the multi-include header prevention ifdef/define symbol.
140 * Revision 1.33 2002/08/05 10:03:47 robertj
141 * Cosmetic changes to normalise the usage of pragma interface/implementation.
143 * Revision 1.32 2002/05/29 03:55:17 robertj
144 * Added protocol version number checking infrastructure, primarily to improve
145 * interoperability with stacks that are unforgiving of new features.
147 * Revision 1.31 2002/05/10 05:44:50 robertj
148 * Added the max bit rate field to the data channel capability class.
150 * Revision 1.30 2002/01/22 06:25:02 robertj
151 * Moved payload type to ancestor so any capability can adjust it on logical channel.
153 * Revision 1.29 2002/01/17 07:04:57 robertj
154 * Added support for RFC2833 embedded DTMF in the RTP stream.
156 * Revision 1.28 2002/01/16 05:37:41 robertj
157 * Added missing mode change functions on non standard capabilities.
159 * Revision 1.27 2002/01/09 00:21:36 robertj
160 * Changes to support outgoing H.245 RequstModeChange.
162 * Revision 1.26 2001/12/22 01:44:05 robertj
163 * Added more support for H.245 RequestMode operation.
165 * Revision 1.25 2001/10/24 01:20:34 robertj
166 * Added code to help with static linking of H323Capability names database.
168 * Revision 1.24 2001/09/21 02:48:51 robertj
169 * Added default implementation for PDU encode/decode for codecs
170 * that have simple integer as frames per packet.
172 * Revision 1.23 2001/09/11 10:21:40 robertj
173 * Added direction field to capabilities, thanks Nick Hoath.
175 * Revision 1.22 2001/07/19 09:50:40 robertj
176 * Added code for default session ID on data channel being three.
178 * Revision 1.21 2001/07/17 04:44:29 robertj
179 * Partial implementation of T.120 and T.38 logical channels.
181 * Revision 1.20 2001/05/21 07:20:47 robertj
182 * Removed redundent class name in declaration.
184 * Revision 1.19 2001/05/14 05:56:26 robertj
185 * Added H323 capability registration system so can add capabilities by
186 * string name instead of having to instantiate explicit classes.
188 * Revision 1.18 2001/05/02 16:22:21 rogerh
189 * Add IsAllow() for a single capability to check if it is in the
190 * capabilities set. This fixes the bug where OpenH323 would accept
191 * incoming H261 video even when told not to accept it.
193 * Revision 1.17 2001/03/16 23:00:21 robertj
194 * Improved validation of codec selection against capability set, thanks Chris Purvis.
196 * Revision 1.16 2001/02/09 05:16:24 robertj
197 * Added #pragma interface for GNU C++.
199 * Revision 1.15 2001/01/25 07:27:14 robertj
200 * Major changes to add more flexible OpalMediaFormat class to normalise
201 * all information about media types, especially codecs.
203 * Revision 1.14 2001/01/09 23:05:22 robertj
204 * Fixed inability to have 2 non standard codecs in capability table.
206 * Revision 1.13 2000/10/16 08:49:30 robertj
207 * Added single function to add all UserInput capability types.
209 * Revision 1.12 2000/08/23 14:23:11 craigs
210 * Added prototype support for Microsoft GSM codec
212 * Revision 1.11 2000/07/13 12:25:47 robertj
213 * Fixed problems with fast start frames per packet adjustment.
215 * Revision 1.10 2000/07/10 16:01:50 robertj
216 * Started fixing capability set merging, still more to do.
218 * Revision 1.9 2000/07/04 01:16:49 robertj
219 * Added check for capability allowed in "combinations" set, still needs more done yet.
221 * Revision 1.8 2000/06/03 03:16:47 robertj
222 * Fixed using the wrong capability table (should be connections) for some operations.
224 * Revision 1.7 2000/05/23 11:32:27 robertj
225 * Rewrite of capability table to combine 2 structures into one and move functionality into that class
226 * allowing some normalisation of usage across several applications.
227 * Changed H323Connection so gets a copy of capabilities instead of using endponts, allows adjustments
228 * to be done depending on the remote client application.
230 * Revision 1.6 2000/05/18 11:53:34 robertj
231 * Changes to support doc++ documentation generation.
233 * Revision 1.5 2000/05/10 04:05:26 robertj
234 * Changed capabilities so has a function to get name of codec, instead of relying on PrintOn.
236 * Revision 1.4 2000/05/02 04:32:24 robertj
237 * Fixed copyright notice comment.
239 * Revision 1.3 2000/04/05 19:01:12 robertj
240 * Added function so can change desired transmit packet size.
242 * Revision 1.2 2000/03/21 03:06:47 robertj
243 * Changes to make RTP TX of exact numbers of frames in some codecs.
245 * Revision 1.1 1999/12/23 23:02:35 robertj
246 * File reorganision for separating RTP from H.323 and creation of LID for VPB support.
250 #ifndef __OPAL_H323CAPS_H
251 #define __OPAL_H323CAPS_H
253 #ifdef P_USE_PRAGMA
254 #pragma interface
255 #endif
258 #include <opal/mediafmt.h>
259 #include <h323/channels.h>
262 /* The following classes have forward references to avoid including the VERY
263 large header files for H225 and H245. If an application requires access
264 to the protocol classes they can include them, but for simple usage their
265 inclusion can be avoided.
267 class PASN_Choice;
268 class H245_Capability;
269 class H245_DataType;
270 class H245_ModeElement;
271 class H245_AudioCapability;
272 class H245_AudioMode;
273 class H245_VideoCapability;
274 class H245_VideoMode;
275 class H245_DataApplicationCapability;
276 class H245_DataMode;
277 class H245_DataProtocolCapability;
278 class H245_H2250LogicalChannelParameters;
279 class H245_TerminalCapabilitySet;
280 class H245_NonStandardParameter;
281 class H323Connection;
282 class H323Capabilities;
283 class H245_CapabilityIdentifier;
284 class H245_GenericCapability;
285 class H245_GenericParameter;
287 ///////////////////////////////////////////////////////////////////////////////
289 /**This class describes the interface to a capability of the endpoint, usually
290 a codec, used to transfer data via the logical channels opened and managed
291 by the H323 control channel.
293 Note that this is not an instance of the codec itself. Merely the
294 description of that codec. There is typically only one instance of this
295 class contained in the capability tables of the endpoint. There may be
296 several instances of the actualy codec managing the conversion of an
297 individual stream of data.
299 An application may create a descendent off this class and override
300 functions as required for describing a codec that it implements.
302 class H323Capability : public PObject
304 PCLASSINFO(H323Capability, PObject);
306 public:
307 /**@name Construction */
308 //@{
309 /**Create a new capability specification.
311 H323Capability();
312 //@}
314 /**@name Overrides from class PObject */
315 //@{
316 /**Compare two capability instances. This compares the main and sub-types
317 of the capability.
319 Comparison Compare(const PObject & obj) const;
321 /**Print out the object to the stream, virtual version of << operator.
323 void PrintOn(ostream & strm) const;
324 //@}
326 /**@name Identification functions */
327 //@{
328 enum MainTypes {
329 /// Audio codec capability
330 e_Audio,
331 /// Video codec capability
332 e_Video,
333 /// Arbitrary data capability
334 e_Data,
335 /// User Input capability
336 e_UserInput,
337 /// Count of main types
338 e_NumMainTypes
341 /**Get the main type of the capability.
343 This function is overridden by one of the three main sub-classes off
344 which real capabilities would be descendend.
346 virtual MainTypes GetMainType() const = 0;
348 /**Get the sub-type of the capability. This is a code dependent on the
349 main type of the capability.
351 virtual unsigned GetSubType() const = 0;
353 /**Get the name of the media data format this class represents.
355 virtual PString GetFormatName() const = 0;
356 //@}
358 /**@name Operations */
359 //@{
360 /**Create an H323Capability descendant given a string name.
361 This uses the registration system to create the capability.
363 static H323Capability * Create(
364 const PString & name ///< Name of capability
367 /**Get the default RTP session.
368 This function gets the default RTP session ID for the capability
369 type. For example audio capabilities return the value
370 RTP_Session::DefaultAudioSessionID etc.
372 The default behaviour returns zero, indicating it is not an RTP
373 based capability.
375 virtual unsigned GetDefaultSessionID() const;
377 /**Set the maximum size (in frames) of data that will be transmitted in a
378 single PDU.
380 This will also be the desired number that will be sent by most codec
381 implemetations.
383 The default behaviour does nothing.
385 virtual void SetTxFramesInPacket(
386 unsigned frames ///< Number of frames per packet
389 /**Get the maximum size (in frames) of data that will be transmitted in a single PDU.
391 The default behaviour returns the value 1.
393 virtual unsigned GetTxFramesInPacket() const;
395 /**Get the maximum size (in frames) of data that can be received in a single PDU.
397 The default behaviour returns the value 1.
399 virtual unsigned GetRxFramesInPacket() const;
401 /**Create the channel instance, allocating resources as required.
402 This creates a logical channel object appropriate for the parameters
403 provided. Not if param is NULL, sessionID must be provided, otherwise
404 this is taken from the fields in param.
406 virtual H323Channel * CreateChannel(
407 H323Connection & connection, ///< Owner connection for channel
408 H323Channel::Directions dir, ///< Direction of channel
409 unsigned sessionID, ///< Session ID for RTP channel
410 const H245_H2250LogicalChannelParameters * param
411 ///< Parameters for channel
412 ) const = 0;
413 //@}
415 /**@name Protocol manipulation */
416 //@{
417 enum CommandType {
418 e_TCS,
419 e_OLC,
420 e_ReqMode
423 /**This function is called whenever and outgoing TerminalCapabilitySet
424 PDU is being constructed for the control channel. It allows the
425 capability to set the PDU fields from information in members specific
426 to the class.
428 The default behaviour is pure.
430 virtual BOOL OnSendingPDU(
431 H245_Capability & pdu ///< PDU to set information on
432 ) const = 0;
434 /**This function is called whenever and outgoing OpenLogicalChannel
435 PDU is being constructed for the control channel. It allows the
436 capability to set the PDU fields from information in members specific
437 to the class.
439 The default behaviour is pure.
441 virtual BOOL OnSendingPDU(
442 H245_DataType & pdu ///< PDU to set information on
443 ) const = 0;
445 /**This function is called whenever and outgoing RequestMode
446 PDU is being constructed for the control channel. It allows the
447 capability to set the PDU fields from information in members specific
448 to the class.
450 The default behaviour is pure.
452 virtual BOOL OnSendingPDU(
453 H245_ModeElement & pdu ///< PDU to set information on
454 ) const = 0;
456 /**This function is called whenever and incoming TerminalCapabilitySet
457 PDU is received on the control channel, and a new H323Capability
458 descendent was created. This completes reading fields from the PDU
459 into the classes members.
461 If the function returns FALSE then the received PDU codec description
462 is not supported, so will be ignored.
464 The default behaviour sets the capabilityDirection member variable
465 from the PDU and then returns TRUE. Note that this means it is very
466 important to call the ancestor function when overriding.
468 virtual BOOL OnReceivedPDU(
469 const H245_Capability & pdu ///< PDU to get information from
472 /**This function is called whenever and incoming OpenLogicalChannel
473 PDU has been used to construct the control channel. It allows the
474 capability to set from the PDU fields, information in members specific
475 to the class.
477 The default behaviour is pure.
479 virtual BOOL OnReceivedPDU(
480 const H245_DataType & pdu, ///< PDU to get information from
481 BOOL receiver ///< Is receiver OLC
482 ) = 0;
484 /**Compare the PDU part of the capability.
486 virtual BOOL IsMatch(
487 const PASN_Choice & subTypePDU ///< sub-type PDU of H323Capability
488 ) const;
490 /**Validate that the capability is usable given the connection.
491 This checks agains the negotiated protocol version number and remote
492 application to determine if this capability should be used in TCS or
493 OLC pdus.
495 The default behaviour returns TRUE.
497 virtual BOOL IsUsable(
498 const H323Connection & connection
499 ) const;
500 //@}
502 /**@name Member variable access */
503 //@{
504 enum CapabilityDirection {
505 e_Unknown,
506 e_Receive,
507 e_Transmit,
508 e_ReceiveAndTransmit,
509 e_NoDirection,
510 NumCapabilityDirections
513 /**Get the direction for this capability.
515 CapabilityDirection GetCapabilityDirection() const { return capabilityDirection; }
517 /**Set the direction for this capability.
519 void SetCapabilityDirection(
520 CapabilityDirection dir ///< New direction code
521 ) { capabilityDirection = dir; }
523 /// Get unique capability number.
524 unsigned GetCapabilityNumber() const { return assignedCapabilityNumber; }
526 /// Set unique capability number.
527 void SetCapabilityNumber(unsigned num) { assignedCapabilityNumber = num; }
529 /**Get media format of the media data this class represents.
531 const OpalMediaFormat & GetMediaFormat() const;
533 /// Get the payload type for the capaibility
534 RTP_DataFrame::PayloadTypes GetPayloadType() const { return rtpPayloadType; }
536 /// Set the payload type for the capaibility
537 void SetPayloadType(RTP_DataFrame::PayloadTypes pt) { rtpPayloadType = pt; }
539 /// Attach a QoS specification to this channel
540 virtual void AttachQoS(RTP_QOS *) { }
541 //@}
543 #if PTRACING
544 friend ostream & operator<<(ostream & o , MainTypes t);
545 friend ostream & operator<<(ostream & o , CapabilityDirection d);
546 #endif
548 protected:
549 OpalMediaFormat & GetWritableMediaFormat();
551 unsigned assignedCapabilityNumber; /// Unique ID assigned to capability
552 CapabilityDirection capabilityDirection;
553 RTP_DataFrame::PayloadTypes rtpPayloadType;
555 private:
556 OpalMediaFormat mediaFormat;
561 /**This class describes the interface to a non-standard codec used to
562 transfer data via the logical channels opened and managed by the H323
563 control channel.
565 It is expected that an application makes a descendent off
566 H323NonStandardAudioCapability or H323NonStandardVideoCapability which
567 multiply inherit from this class.
569 class H323NonStandardCapabilityInfo
571 public:
572 typedef PObject::Comparison (*CompareFuncType)(struct PluginCodec_H323NonStandardCodecData *);
574 /**Create a new set of information about a non-standard codec.
576 H323NonStandardCapabilityInfo(
577 CompareFuncType compareFunc,
578 const BYTE * dataBlock, ///< Non-Standard data for codec type
579 PINDEX dataSize ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
582 /**Create a new set of information about a non-standard codec.
584 H323NonStandardCapabilityInfo(
585 const BYTE * dataBlock, ///< Non-Standard data for codec type
586 PINDEX dataSize, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
587 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
588 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
591 /**Create a new set of information about a non-standard codec.
593 H323NonStandardCapabilityInfo(
594 const PString & oid,
595 const BYTE * dataBlock, ///< Non-Standard data for codec type
596 PINDEX dataSize, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
597 PINDEX comparisonOffset = 0,
598 PINDEX comparisonLength = P_MAX_INDEX
601 /**Create a new set of information about a non-standard codec.
603 H323NonStandardCapabilityInfo(
604 BYTE country, ///< t35 information
605 BYTE extension, ///< t35 information
606 WORD maufacturer, ///< t35 information
607 const BYTE * dataBlock, ///< Non-Standard data for codec type
608 PINDEX dataSize, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
609 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
610 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
613 /**Destroy the capability information
615 virtual ~H323NonStandardCapabilityInfo();
617 /**This function gets the non-standard data field.
619 The default behaviour sets data to fixedData.
621 virtual BOOL OnSendingPDU(
622 PBYTEArray & data ///< Data field in PDU to send
623 ) const;
625 /**This function validates and uses the non-standard data field.
627 The default behaviour returns TRUE if data is equal to fixedData.
629 virtual BOOL OnReceivedPDU(
630 const PBYTEArray & data ///< Data field in PDU received
633 BOOL IsMatch(const H245_NonStandardParameter & param) const;
635 PObject::Comparison CompareParam(
636 const H245_NonStandardParameter & param
637 ) const;
639 protected:
640 BOOL OnSendingNonStandardPDU(
641 PASN_Choice & pdu,
642 unsigned nonStandardTag
643 ) const;
644 BOOL OnReceivedNonStandardPDU(
645 const PASN_Choice & pdu,
646 unsigned nonStandardTag
649 PObject::Comparison CompareInfo(
650 const H323NonStandardCapabilityInfo & obj
651 ) const;
652 PObject::Comparison CompareData(
653 const PBYTEArray & data ///< Data field in PDU received
654 ) const;
656 PString oid;
657 BYTE t35CountryCode;
658 BYTE t35Extension;
659 WORD manufacturerCode;
660 PBYTEArray nonStandardData;
661 PINDEX comparisonOffset;
662 PINDEX comparisonLength;
663 CompareFuncType compareFunc;
666 /**This class describes the interface to a generic codec used to
667 transfer data via the logical channels opened and managed by the H323
668 control channel.
670 It is expected that an application makes a descendent off
671 H323GenericAudioCapability or H323GenericVideoCapability which
672 multiply inherit from this class.
675 class H323GenericCapabilityInfo
677 public:
678 H323GenericCapabilityInfo(
679 const PString & id, ///< generic codec identifier
680 PINDEX maxBitRate = 0 ///< maxBitRate parameter for the GenericCapability
682 H323GenericCapabilityInfo(const H323GenericCapabilityInfo & obj);
683 ~H323GenericCapabilityInfo();
685 protected:
686 virtual BOOL OnSendingGenericPDU(
687 H245_GenericCapability & pdu,
688 const OpalMediaFormat & mediaFormat,
689 H323Capability::CommandType type
690 ) const;
691 virtual BOOL OnReceivedGenericPDU(
692 OpalMediaFormat & mediaFormat,
693 const H245_GenericCapability & pdu,
694 H323Capability::CommandType type
697 BOOL IsMatch(
698 const H245_GenericCapability & param ///< Non standard field in PDU received
699 ) const;
700 PObject::Comparison CompareInfo(
701 const H323GenericCapabilityInfo & obj
702 ) const;
705 H245_CapabilityIdentifier * identifier;
706 unsigned maxBitRate;
709 /**This class describes the interface to a codec that has channels based on
710 the RTP protocol.
712 An application may create a descendent off this class and override
713 functions as required for descibing the codec.
715 class H323RealTimeCapability : public H323Capability
717 PCLASSINFO(H323RealTimeCapability, H323Capability);
719 public:
720 /**@name Operations */
721 //@{
722 /**Create the channel instance, allocating resources as required.
724 virtual H323Channel * CreateChannel(
725 H323Connection & connection, ///< Owner connection for channel
726 H323Channel::Directions dir, ///< Direction of channel
727 unsigned sessionID, ///< Session ID for RTP channel
728 const H245_H2250LogicalChannelParameters * param
729 ///< Parameters for channel
730 ) const;
732 H323RealTimeCapability();
733 H323RealTimeCapability(const H323RealTimeCapability &rtc);
734 virtual ~H323RealTimeCapability();
735 void AttachQoS(RTP_QOS * _rtpqos);
737 protected:
738 RTP_QOS * rtpqos;
739 //@}
742 #if OPAL_AUDIO
744 /**This class describes the interface to an audio codec used to transfer data
745 via the logical channels opened and managed by the H323 control channel.
747 An application may create a descendent off this class and override
748 functions as required for descibing the codec.
750 class H323AudioCapability : public H323RealTimeCapability
752 PCLASSINFO(H323AudioCapability, H323RealTimeCapability);
754 public:
755 /**@name Construction */
756 //@{
757 /**Create an audio based capability.
759 H323AudioCapability();
760 //@}
762 /**@name Identification functions */
763 //@{
764 /**Get the main type of the capability.
765 Always returns e_Audio.
767 virtual MainTypes GetMainType() const;
768 //@}
770 /**@name Operations */
771 //@{
772 /**Get the default RTP session.
773 This function gets the default RTP session ID for the capability
774 type. For example audio capabilities return the value
775 RTP_Session::DefaultAudioSessionID etc.
777 The default behaviour returns zero, indicating it is not an RTP
778 based capability.
780 virtual unsigned GetDefaultSessionID() const;
782 /**Set the maximum size (in frames) of data that will be transmitted in a
783 single PDU.
785 This will also be the desired number that will be sent by most codec
786 implemetations.
788 The default behaviour sets the txFramesInPacket variable.
790 virtual void SetTxFramesInPacket(
791 unsigned frames ///< Number of frames per packet
794 /**Get the maximum size (in frames) of data that will be transmitted in a
795 single PDU.
797 The default behaviour sends the txFramesInPacket variable.
799 virtual unsigned GetTxFramesInPacket() const;
801 /**Get the maximum size (in frames) of data that can be received in a
802 single PDU.
804 The default behaviour sends the rxFramesInPacket variable.
806 virtual unsigned GetRxFramesInPacket() const;
807 //@}
809 /**@name Protocol manipulation */
810 //@{
811 /**This function is called whenever and outgoing TerminalCapabilitySet
812 PDU is being constructed for the control channel. It allows the
813 capability to set the PDU fields from information in members specific
814 to the class.
816 The default behaviour calls the OnSendingPDU() function with a more
817 specific PDU type.
819 virtual BOOL OnSendingPDU(
820 H245_Capability & pdu ///< PDU to set information on
821 ) const;
823 /**This function is called whenever and outgoing OpenLogicalChannel
824 PDU is being constructed for the control channel. It allows the
825 capability to set the PDU fields from information in members specific
826 to the class.
828 The default behaviour calls the OnSendingPDU() function with a more
829 specific PDU type.
831 virtual BOOL OnSendingPDU(
832 H245_DataType & pdu ///< PDU to set information on
833 ) const;
835 /**This function is called whenever and outgoing RequestMode
836 PDU is being constructed for the control channel. It allows the
837 capability to set the PDU fields from information in members specific
838 to the class.
840 The default behaviour calls the OnSendingPDU() function with a more
841 specific PDU type.
843 virtual BOOL OnSendingPDU(
844 H245_ModeElement & pdu ///< PDU to set information on
845 ) const;
847 /**This function is called whenever and outgoing TerminalCapabilitySet
848 or OpenLogicalChannel PDU is being constructed for the control channel.
849 It allows the capability to set the PDU fields from information in
850 members specific to the class.
852 The default behaviour assumes the pdu is an integer number of frames
853 per packet.
855 virtual BOOL OnSendingPDU(
856 H245_AudioCapability & pdu, ///< PDU to set information on
857 unsigned packetSize ///< Packet size to use in capability
858 ) const;
859 virtual BOOL OnSendingPDU(
860 H245_AudioCapability & pdu, ///< PDU to set information on
861 unsigned packetSize, ///< Packet size to use in capability
862 CommandType type ///< Type of PDU to send in
863 ) const;
865 /**This function is called whenever and outgoing RequestMode
866 PDU is being constructed for the control channel. It allows the
867 capability to set the PDU fields from information in members specific
868 to the class.
870 The default behaviour sets the PDUs tag according to the GetSubType()
871 function (translated to different enum).
873 virtual BOOL OnSendingPDU(
874 H245_AudioMode & pdu ///< PDU to set information on
875 ) const;
877 /**This function is called whenever and incoming TerminalCapabilitySet
878 PDU is received on the control channel, and a new H323Capability
879 descendent was created. This completes reading fields from the PDU
880 into the classes members.
882 If the function returns FALSE then the received PDU codec description
883 is not supported, so will be ignored.
885 The default behaviour calls the OnReceivedPDU() that takes a
886 H245_AudioCapability and clamps the txFramesInPacket.
888 virtual BOOL OnReceivedPDU(
889 const H245_Capability & pdu ///< PDU to get information from
892 /**This function is called whenever and incoming OpenLogicalChannel
893 PDU has been used to construct the control channel. It allows the
894 capability to set from the PDU fields, information in members specific
895 to the class.
897 The default behaviour calls the OnReceivedPDU() that takes a
898 H245_AudioCapability and clamps the txFramesInPacket or
899 rxFramesInPacket.
901 virtual BOOL OnReceivedPDU(
902 const H245_DataType & pdu, ///< PDU to get information from
903 BOOL receiver ///< Is receiver OLC
906 /**This function is called whenever and incoming TerminalCapabilitySet
907 or OpenLogicalChannel PDU has been used to construct the control
908 channel. It allows the capability to set from the PDU fields,
909 information in members specific to the class.
911 The default behaviour assumes the pdu is an integer number of frames
912 per packet.
914 virtual BOOL OnReceivedPDU(
915 const H245_AudioCapability & pdu, ///< PDU to get information from
916 unsigned & packetSize ///< Packet size to use in capability
918 virtual BOOL OnReceivedPDU(
919 const H245_AudioCapability & pdu, ///< PDU to get information from
920 unsigned & packetSize, ///< Packet size to use in capability
921 CommandType type ///< Type of PDU to send in
923 //@}
927 /**This class describes the interface to a non-standard audio codec used to
928 transfer data via the logical channels opened and managed by the H323
929 control channel.
931 An application may create a descendent off this class and override
932 functions as required for descibing the codec.
934 class H323NonStandardAudioCapability : public H323AudioCapability,
935 public H323NonStandardCapabilityInfo
937 PCLASSINFO(H323NonStandardAudioCapability, H323AudioCapability);
939 public:
940 /**@name Construction */
941 //@{
942 H323NonStandardAudioCapability(
943 H323NonStandardCapabilityInfo::CompareFuncType compareFunc,
944 const BYTE * dataBlock, ///< Non-Standard data for codec type
945 PINDEX dataSize ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
947 /**Create a new set of information about a non-standard codec.
949 H323NonStandardAudioCapability(
950 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
951 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
952 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
953 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
956 /**Create a new set of information about a non-standard codec.
958 H323NonStandardAudioCapability(
959 const PString & oid, ///< OID for indentification of codec
960 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
961 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
962 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
963 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
966 /**Create a new set of information about a non-standard codec.
968 H323NonStandardAudioCapability(
969 BYTE country, ///< t35 information
970 BYTE extension, ///< t35 information
971 WORD maufacturer, ///< t35 information
972 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
973 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
974 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
975 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
977 //@}
979 /**@name Overrides from class PObject */
980 //@{
981 /**Compare two capability instances. This compares the main and sub-types
982 of the capability.
984 Comparison Compare(const PObject & obj) const;
985 //@}
987 /**@name Identification functions */
988 //@{
989 /**Get the sub-type of the capability. This is a code dependent on the
990 main type of the capability.
992 This returns H245_AudioCapability::e_nonStandard.
994 virtual unsigned GetSubType() const;
995 //@}
997 /**@name Protocol manipulation */
998 //@{
999 /**This function is called whenever and outgoing TerminalCapabilitySet
1000 or OpenLogicalChannel PDU is being constructed for the control channel.
1001 It allows the capability to set the PDU fields from information in
1002 members specific to the class.
1004 The default behaviour calls H323NonStandardCapabilityinfo::OnSendingPDU()
1005 to handle the PDU.
1007 virtual BOOL OnSendingPDU(
1008 H245_AudioCapability & pdu, ///< PDU to set information on
1009 unsigned packetSize ///< Packet size to use in capability
1010 ) const;
1012 /**This function is called whenever and outgoing RequestMode
1013 PDU is being constructed for the control channel. It allows the
1014 capability to set the PDU fields from information in members specific
1015 to the class.
1017 The default behaviour calls H323NonStandardCapabilityinfo::OnSendingPDU()
1018 to handle the PDU.
1020 virtual BOOL OnSendingPDU(
1021 H245_AudioMode & pdu ///< PDU to set information on
1022 ) const;
1024 /**This function is called whenever and incoming TerminalCapabilitySet
1025 or OpenLogicalChannel PDU has been used to construct the control
1026 channel. It allows the capability to set from the PDU fields,
1027 information in members specific to the class.
1029 The default behaviour calls H323NonStandardCapabilityinfo::OnReceivedPDU()
1030 to handle the provided PDU.
1032 virtual BOOL OnReceivedPDU(
1033 const H245_AudioCapability & pdu, ///< PDU to get information from
1034 unsigned & packetSize ///< Packet size to use in capability
1037 /**Compare the nonStandardData part of the capability, if applicable.
1039 virtual BOOL IsMatch(
1040 const PASN_Choice & subTypePDU ///< sub-type PDU of H323Capability
1041 ) const;
1042 //@}
1045 /**This class describes the interface to a generic audio codec used to
1046 transfer data via the logical channels opened and managed by the H323
1047 control channel.
1049 An application may create a descendent off this class and override
1050 functions as required for descibing the codec.
1052 class H323GenericAudioCapability : public H323AudioCapability,
1053 public H323GenericCapabilityInfo
1055 PCLASSINFO(H323NonStandardAudioCapability, H323AudioCapability);
1057 public:
1058 /**@name Construction */
1059 //@{
1060 /**Create a new set of information about a non-standard codec.
1062 H323GenericAudioCapability(
1063 const PString & capabilityId, ///< generic codec identifier
1064 PINDEX maxBitRate = 0 ///< maxBitRate parameter for the GenericCapability
1066 //@}
1068 /**@name Overrides from class PObject */
1069 //@{
1070 /**Compare two capability instances. This compares the main and sub-types
1071 of the capability.
1073 Comparison Compare(const PObject & obj) const;
1074 //@}
1076 /**@name Identification functions */
1077 //@{
1078 /**Get the sub-type of the capability. This is a code dependent on the
1079 main type of the capability.
1081 This returns H245_AudioCapability::e_genericCapability.
1083 virtual unsigned GetSubType() const;
1084 //@}
1086 /**@name Protocol manipulation */
1087 //@{
1088 /**This function is called whenever and outgoing TerminalCapabilitySet
1089 or OpenLogicalChannel PDU is being constructed for the control channel.
1090 It allows the capability to set the PDU fields from information in
1091 members specific to the class.
1093 The default behaviour calls H323GenericCapabilityinfo::OnSendingPDU()
1094 to handle the PDU.
1096 virtual BOOL OnSendingPDU(
1097 H245_AudioCapability & pdu, ///< PDU to set information on
1098 unsigned packetSize, ///< Packet size to use in capability
1099 CommandType type ///< Type of PDU to send in
1100 ) const;
1102 /**This function is called whenever and outgoing RequestMode
1103 PDU is being constructed for the control channel. It allows the
1104 capability to set the PDU fields from information in members specific
1105 to the class.
1107 The default behaviour sets the PDUs tag according to the GetSubType()
1108 function (translated to different enum).
1110 virtual BOOL OnSendingPDU(
1111 H245_AudioMode & pdu ///< PDU to set information on
1112 ) const;
1114 /**This function is called whenever and incoming TerminalCapabilitySet
1115 or OpenLogicalChannel PDU has been used to construct the control
1116 channel. It allows the capability to set from the PDU fields,
1117 information in members specific to the class.
1119 The default behaviour calls H323GenericCapabilityinfo::OnReceivedPDU()
1120 to handle the provided PDU.
1122 virtual BOOL OnReceivedPDU(
1123 const H245_AudioCapability & pdu, ///< PDU to get information from
1124 unsigned & packetSize, ///< Packet size to use in capability
1125 CommandType type ///< Type of PDU to send in
1128 /**Compare the generic part of the capability, if applicable.
1130 virtual BOOL IsMatch(
1131 const PASN_Choice & subTypePDU ///< sub-type PDU of H323Capability
1132 ) const;
1133 //@}
1136 #endif // OPAL_AUDIO
1138 #if OPAL_VIDEO
1140 /**This class describes the interface to a video codec used to transfer data
1141 via the logical channels opened and managed by the H323 control channel.
1143 An application may create a descendent off this class and override
1144 functions as required for descibing a codec.
1146 class H323VideoCapability : public H323RealTimeCapability
1148 PCLASSINFO(H323VideoCapability, H323RealTimeCapability);
1150 public:
1151 /**@name Identification functions */
1152 //@{
1153 /**Get the main type of the capability.
1154 Always returns e_Video.
1156 virtual MainTypes GetMainType() const;
1157 //@}
1159 /**@name Operations */
1160 //@{
1161 /**Get the default RTP session.
1162 This function gets the default RTP session ID for the capability
1163 type. For example audio capabilities return the value
1164 RTP_Session::DefaultAudioSessionID etc.
1166 The default behaviour returns zero, indicating it is not an RTP
1167 based capability.
1169 virtual unsigned GetDefaultSessionID() const;
1170 //@}
1172 /**@name Protocol manipulation */
1173 //@{
1174 /**This function is called whenever and outgoing TerminalCapabilitySet
1175 PDU is being constructed for the control channel. It allows the
1176 capability to set the PDU fields from information in members specific
1177 to the class.
1179 The default behaviour calls the OnSendingPDU() function with a more
1180 specific PDU type.
1182 virtual BOOL OnSendingPDU(
1183 H245_Capability & pdu ///< PDU to set information on
1184 ) const;
1186 /**This function is called whenever and outgoing OpenLogicalChannel
1187 PDU is being constructed for the control channel. It allows the
1188 capability to set the PDU fields from information in members specific
1189 to the class.
1191 The default behaviour calls the OnSendingPDU() function with a more
1192 specific PDU type.
1194 virtual BOOL OnSendingPDU(
1195 H245_DataType & pdu ///< PDU to set information on
1196 ) const;
1198 /**This function is called whenever and outgoing RequestMode
1199 PDU is being constructed for the control channel. It allows the
1200 capability to set the PDU fields from information in members specific
1201 to the class.
1203 The default behaviour calls the OnSendingPDU() function with a more
1204 specific PDU type.
1206 virtual BOOL OnSendingPDU(
1207 H245_ModeElement & pdu ///< PDU to set information on
1208 ) const;
1210 /**This function is called whenever and outgoing TerminalCapabilitySet
1211 or OpenLogicalChannel PDU is being constructed for the control channel.
1212 It allows the capability to set the PDU fields from information in
1213 members specific to the class.
1215 The default behaviour is pure.
1217 virtual BOOL OnSendingPDU(
1218 H245_VideoCapability & pdu ///< PDU to set information on
1219 ) const;
1220 virtual BOOL OnSendingPDU(
1221 H245_VideoCapability & pdu, ///< PDU to set information on
1222 CommandType type ///< Type of PDU to send in
1223 ) const;
1225 /**This function is called whenever and outgoing RequestMode
1226 PDU is being constructed for the control channel. It allows the
1227 capability to set the PDU fields from information in members specific
1228 to the class.
1230 The default behaviour sets the PDUs tag according to the GetSubType()
1231 function (translated to different enum).
1233 virtual BOOL OnSendingPDU(
1234 H245_VideoMode & pdu ///< PDU to set information on
1235 ) const = 0;
1237 /**This function is called whenever and incoming TerminalCapabilitySet
1238 PDU is received on the control channel, and a new H323Capability
1239 descendent was created. This completes reading fields from the PDU
1240 into the classes members.
1242 If the function returns FALSE then the received PDU codec description
1243 is not supported, so will be ignored. The default behaviour simply
1244 returns TRUE.
1246 virtual BOOL OnReceivedPDU(
1247 const H245_Capability & pdu ///< PDU to get information from
1250 /**This function is called whenever and incoming OpenLogicalChannel
1251 PDU has been used to construct the control channel. It allows the
1252 capability to set from the PDU fields, information in members specific
1253 to the class.
1255 The default behaviour is pure.
1257 virtual BOOL OnReceivedPDU(
1258 const H245_DataType & pdu, ///< PDU to get information from
1259 BOOL receiver ///< Is receiver OLC
1262 /**This function is called whenever and incoming TerminalCapabilitySet
1263 or OpenLogicalChannel PDU has been used to construct the control
1264 channel. It allows the capability to set from the PDU fields,
1265 information in members specific to the class.
1267 The default behaviour is pure.
1269 virtual BOOL OnReceivedPDU(
1270 const H245_VideoCapability & pdu ///< PDU to set information on
1272 virtual BOOL OnReceivedPDU(
1273 const H245_VideoCapability & pdu, ///< PDU to get information from
1274 CommandType type ///< Type of PDU to send in
1276 //@}
1280 /**This class describes the interface to a non-standard video codec used to
1281 transfer data via the logical channels opened and managed by the H323
1282 control channel.
1284 An application may create a descendent off this class and override
1285 functions as required for descibing the codec.
1287 class H323NonStandardVideoCapability : public H323VideoCapability,
1288 public H323NonStandardCapabilityInfo
1290 PCLASSINFO(H323NonStandardVideoCapability, H323VideoCapability);
1292 public:
1293 /**@name Construction */
1294 //@{
1295 H323NonStandardVideoCapability(
1296 H323NonStandardCapabilityInfo::CompareFuncType compareFunc,
1297 const BYTE * dataBlock, ///< Non-Standard data for codec type
1298 PINDEX dataSize ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
1300 /**Create a new set of information about a non-standard codec.
1302 H323NonStandardVideoCapability(
1303 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
1304 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
1305 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
1306 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
1309 /**Create a new set of information about a non-standard codec.
1311 H323NonStandardVideoCapability(
1312 const PString & oid, ///< OID for indentification of codec
1313 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
1314 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
1315 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
1316 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
1319 /**Create a new set of information about a non-standard codec.
1321 H323NonStandardVideoCapability(
1322 BYTE country, ///< t35 information
1323 BYTE extension, ///< t35 information
1324 WORD maufacturer, ///< t35 information
1325 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
1326 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
1327 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
1328 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
1330 //@}
1332 /**@name Overrides from class PObject */
1333 //@{
1334 /**Compare two capability instances. This compares the main and sub-types
1335 of the capability.
1337 Comparison Compare(const PObject & obj) const;
1338 //@}
1340 /**@name Identification functions */
1341 //@{
1342 /**Get the sub-type of the capability. This is a code dependent on the
1343 main type of the capability.
1345 This returns one of the four possible combinations of mode and speed
1346 using the enum values of the protocol ASN H245_AudioCapability class.
1348 virtual unsigned GetSubType() const;
1349 //@}
1351 /**@name Protocol manipulation */
1352 //@{
1353 /**This function is called whenever and outgoing TerminalCapabilitySet
1354 or OpenLogicalChannel PDU is being constructed for the control channel.
1355 It allows the capability to set the PDU fields from information in
1356 members specific to the class.
1358 The default behaviour calls H323NonStandardCapabilityinfo::OnSendingPDU()
1359 to handle the PDU.
1361 virtual BOOL OnSendingPDU(
1362 H245_VideoCapability & pdu ///< PDU to set information on
1363 ) const;
1365 /**This function is called whenever and outgoing RequestMode
1366 PDU is being constructed for the control channel. It allows the
1367 capability to set the PDU fields from information in members specific
1368 to the class.
1370 The default behaviour calls H323NonStandardCapabilityinfo::OnSendingPDU()
1371 to handle the PDU.
1373 virtual BOOL OnSendingPDU(
1374 H245_VideoMode & pdu ///< PDU to set information on
1375 ) const;
1377 /**This function is called whenever and incoming TerminalCapabilitySet
1378 or OpenLogicalChannel PDU has been used to construct the control
1379 channel. It allows the capability to set from the PDU fields,
1380 information in members specific to the class.
1382 The default behaviour calls H323NonStandardCapabilityinfo::OnReceivedPDU()
1383 to handle the provided PDU.
1385 virtual BOOL OnReceivedPDU(
1386 const H245_VideoCapability & pdu ///< PDU to set information on
1389 /**Compare the nonStandardData part of the capability, if applicable.
1391 virtual BOOL IsMatch(
1392 const PASN_Choice & subTypePDU ///< sub-type PDU of H323Capability
1393 ) const;
1394 //@}
1397 /**This class describes the interface to a generic video codec used to
1398 transfer data via the logical channels opened and managed by the H323
1399 control channel.
1401 An application may create a descendent off this class and override
1402 functions as required for descibing the codec.
1404 class H323GenericVideoCapability : public H323VideoCapability,
1405 public H323GenericCapabilityInfo
1407 PCLASSINFO(H323GenericVideoCapability, H323VideoCapability);
1409 public:
1410 /**@name Construction */
1411 //@{
1412 /**Create a new set of information about a non-standard codec.
1414 H323GenericVideoCapability(
1415 const PString & capabilityId, ///< generic codec identifier (OID)
1416 PINDEX maxBitRate = 0 ///< maxBitRate parameter for the GenericCapability
1418 //@}
1420 /**@name Overrides from class PObject */
1421 //@{
1422 /**Compare two capability instances. This compares the main and sub-types
1423 of the capability.
1425 Comparison Compare(const PObject & obj) const;
1426 //@}
1428 /**@name Identification functions */
1429 //@{
1430 /**Get the sub-type of the capability. This is a code dependent on the
1431 main type of the capability.
1433 This returns H245_VideoCapability::e_genericCapability.
1435 virtual unsigned GetSubType() const;
1436 //@}
1438 /**@name Protocol manipulation */
1439 //@{
1440 /**This function is called whenever and outgoing TerminalCapabilitySet
1441 or OpenLogicalChannel PDU is being constructed for the control channel.
1442 It allows the capability to set the PDU fields from information in
1443 members specific to the class.
1445 The default behaviour calls H323GenericCapabilityinfo::OnSendingPDU()
1446 to handle the PDU.
1448 virtual BOOL OnSendingPDU(
1449 H245_VideoCapability & pdu, ///< PDU to set information on
1450 CommandType type ///< Type of PDU to send in
1451 ) const;
1453 /**This function is called whenever and outgoing RequestMode
1454 PDU is being constructed for the control channel. It allows the
1455 capability to set the PDU fields from information in members specific
1456 to the class.
1458 The default behaviour sets the PDUs tag according to the GetSubType()
1459 function (translated to different enum).
1461 virtual BOOL OnSendingPDU(
1462 H245_VideoMode & pdu ///< PDU to set information on
1463 ) const;
1465 /**This function is called whenever and incoming TerminalCapabilitySet
1466 or OpenLogicalChannel PDU has been used to construct the control
1467 channel. It allows the capability to set from the PDU fields,
1468 information in members specific to the class.
1470 The default behaviour calls H323GenericCapabilityinfo::OnReceivedPDU()
1471 to handle the provided PDU.
1473 virtual BOOL OnReceivedPDU(
1474 const H245_VideoCapability & pdu, ///< PDU to get information from
1475 CommandType type ///< Type of PDU to send in
1477 //@}
1479 /**Compare the generic part of the capability, if applicable.
1481 virtual BOOL IsMatch(
1482 const PASN_Choice & subTypePDU ///< sub-type PDU of H323Capability
1483 ) const;
1486 #endif // OPAL_VIDEO
1488 /**This class describes the interface to a data channel used to transfer data
1489 via the logical channels opened and managed by the H323 control channel.
1491 An application may create a descendent off this class and override
1492 functions as required for descibing a codec.
1494 class H323DataCapability : public H323Capability
1496 PCLASSINFO(H323DataCapability, H323Capability);
1498 public:
1499 /**@name Construction */
1500 //@{
1501 /**Create a new data capability.
1503 H323DataCapability(
1504 unsigned maxBitRate = 0 ///< Maximum bit rate for data in 100's b/s
1506 //@}
1508 /**@name Identification functions */
1509 //@{
1510 /**Get the main type of the capability.
1511 Always returns e_Data.
1513 virtual MainTypes GetMainType() const;
1514 //@}
1516 /**@name Operations */
1517 //@{
1518 /**Get the default RTP session.
1519 This function gets the default RTP session ID for the capability
1520 type. For example audio capabilities return the value
1521 RTP_Session::DefaultAudioSessionID etc.
1523 The default behaviour returns 3, indicating a data session.
1525 virtual unsigned GetDefaultSessionID() const;
1526 //@}
1528 /**@name Protocol manipulation */
1529 //@{
1530 /**This function is called whenever and outgoing TerminalCapabilitySet
1531 PDU is being constructed for the control channel. It allows the
1532 capability to set the PDU fields from information in members specific
1533 to the class.
1535 The default behaviour calls the OnSendingPDU() function with a more
1536 specific PDU type.
1538 virtual BOOL OnSendingPDU(
1539 H245_Capability & pdu ///< PDU to set information on
1540 ) const;
1542 /**This function is called whenever and outgoing OpenLogicalChannel
1543 PDU is being constructed for the control channel. It allows the
1544 capability to set the PDU fields from information in members specific
1545 to the class.
1547 The default behaviour calls the OnSendingPDU() function with a more
1548 specific PDU type.
1550 virtual BOOL OnSendingPDU(
1551 H245_DataType & pdu ///< PDU to set information on
1552 ) const;
1554 /**This function is called whenever and outgoing RequestMode
1555 PDU is being constructed for the control channel. It allows the
1556 capability to set the PDU fields from information in members specific
1557 to the class.
1559 The default behaviour calls the OnSendingPDU() function with a more
1560 specific PDU type.
1562 virtual BOOL OnSendingPDU(
1563 H245_ModeElement & pdu ///< PDU to set information on
1564 ) const;
1566 /**This function is called whenever and outgoing TerminalCapabilitySet
1567 or OpenLogicalChannel PDU is being constructed for the control channel.
1568 It allows the capability to set the PDU fields from information in
1569 members specific to the class.
1571 The default behaviour is pure.
1573 virtual BOOL OnSendingPDU(
1574 H245_DataApplicationCapability & pdu ///< PDU to set information on
1575 ) const;
1576 virtual BOOL OnSendingPDU(
1577 H245_DataApplicationCapability & pdu, ///< PDU to set information on
1578 CommandType type ///< Type of PDU to send in
1579 ) const;
1581 /**This function is called whenever and outgoing RequestMode
1582 PDU is being constructed for the control channel. It allows the
1583 capability to set the PDU fields from information in members specific
1584 to the class.
1586 The default behaviour sets the PDUs tag according to the GetSubType()
1587 function (translated to different enum).
1589 virtual BOOL OnSendingPDU(
1590 H245_DataMode & pdu ///< PDU to set information on
1591 ) const = 0;
1593 /**This function is called whenever and incoming TerminalCapabilitySet
1594 PDU is received on the control channel, and a new H323Capability
1595 descendent was created. This completes reading fields from the PDU
1596 into the classes members.
1598 If the function returns FALSE then the received PDU codec description
1599 is not supported, so will be ignored. The default behaviour simply
1600 returns TRUE.
1602 virtual BOOL OnReceivedPDU(
1603 const H245_Capability & pdu ///< PDU to get information from
1606 /**This function is called whenever and incoming OpenLogicalChannel
1607 PDU has been used to construct the control channel. It allows the
1608 capability to set from the PDU fields, information in members specific
1609 to the class.
1611 The default behaviour is pure.
1613 virtual BOOL OnReceivedPDU(
1614 const H245_DataType & pdu, ///< PDU to get information from
1615 BOOL receiver ///< Is receiver OLC
1618 /**This function is called whenever and incoming TerminalCapabilitySet
1619 or OpenLogicalChannel PDU has been used to construct the control
1620 channel. It allows the capability to set from the PDU fields,
1621 information in members specific to the class.
1623 The default behaviour is pure.
1625 virtual BOOL OnReceivedPDU(
1626 const H245_DataApplicationCapability & pdu ///< PDU to set information on
1628 virtual BOOL OnReceivedPDU(
1629 const H245_DataApplicationCapability & pdu, ///< PDU to set information on
1630 CommandType type ///< Type of PDU to send in
1632 //@}
1634 protected:
1635 unsigned maxBitRate;
1639 /**This class describes the interface to a non-standard data codec used to
1640 transfer data via the logical channels opened and managed by the H323
1641 control channel.
1643 An application may create a descendent off this class and override
1644 functions as required for descibing the codec.
1646 class H323NonStandardDataCapability : public H323DataCapability,
1647 public H323NonStandardCapabilityInfo
1649 PCLASSINFO(H323NonStandardDataCapability, H323DataCapability);
1651 public:
1652 /**@name Construction */
1653 //@{
1654 /**Create a new set of information about a non-standard codec.
1656 H323NonStandardDataCapability(
1657 unsigned maxBitRate, ///< Maximum bit rate for data in 100's b/s
1658 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
1659 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
1660 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
1661 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
1664 /**Create a new set of information about a non-standard codec.
1666 H323NonStandardDataCapability(
1667 unsigned maxBitRate, ///< Maximum bit rate for data in 100's b/s
1668 const PString & oid, ///< OID for indentification of codec
1669 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
1670 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
1671 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
1672 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
1675 /**Create a new set of information about a non-standard codec.
1677 H323NonStandardDataCapability(
1678 unsigned maxBitRate, ///< Maximum bit rate for data in 100's b/s
1679 BYTE country, ///< t35 information
1680 BYTE extension, ///< t35 information
1681 WORD maufacturer, ///< t35 information
1682 const BYTE * dataBlock = NULL, ///< Non-Standard data for codec type
1683 PINDEX dataSize = 0, ///< Size of dataBlock. If 0 and dataBlock != NULL use strlen(dataBlock)
1684 PINDEX comparisonOffset = 0, ///< Offset into dataBlock to compare
1685 PINDEX comparisonLength = P_MAX_INDEX ///< Length of bytes to compare
1687 //@}
1689 /**@name Overrides from class PObject */
1690 //@{
1691 /**Compare two capability instances. This compares the main and sub-types
1692 of the capability.
1694 Comparison Compare(const PObject & obj) const;
1695 //@}
1697 /**@name Identification functions */
1698 //@{
1699 /**Get the sub-type of the capability. This is a code dependent on the
1700 main type of the capability.
1702 This returns one of the four possible combinations of mode and speed
1703 using the enum values of the protocol ASN H245_AudioCapability class.
1705 virtual unsigned GetSubType() const;
1706 //@}
1708 /**@name Protocol manipulation */
1709 //@{
1710 /**This function is called whenever and outgoing TerminalCapabilitySet
1711 or OpenLogicalChannel PDU is being constructed for the control channel.
1712 It allows the capability to set the PDU fields from information in
1713 members specific to the class.
1715 The default behaviour calls H323NonStandardCapabilityinfo::OnSendingPDU()
1716 to handle the PDU.
1718 virtual BOOL OnSendingPDU(
1719 H245_DataApplicationCapability & pdu ///< PDU to set information on
1720 ) const;
1722 /**This function is called whenever and outgoing RequestMode
1723 PDU is being constructed for the control channel. It allows the
1724 capability to set the PDU fields from information in members specific
1725 to the class.
1727 The default behaviour calls H323NonStandardCapabilityinfo::OnSendingPDU()
1728 to handle the PDU.
1730 virtual BOOL OnSendingPDU(
1731 H245_DataMode & pdu ///< PDU to set information on
1732 ) const;
1734 /**This function is called whenever and incoming TerminalCapabilitySet
1735 or OpenLogicalChannel PDU has been used to construct the control
1736 channel. It allows the capability to set from the PDU fields,
1737 information in members specific to the class.
1739 The default behaviour calls H323NonStandardCapabilityinfo::OnReceivedPDU()
1740 to handle the provided PDU.
1742 virtual BOOL OnReceivedPDU(
1743 const H245_DataApplicationCapability & pdu ///< PDU to set information on
1746 /**Compare the nonStandardData part of the capability, if applicable.
1748 virtual BOOL IsMatch(
1749 const PASN_Choice & subTypePDU ///< sub-type PDU of H323Capability
1750 ) const;
1751 //@}
1755 ///////////////////////////////////////////////////////////////////////////////
1756 // Known audio codecs
1758 /**This class describes the G.711 codec capability.
1760 class H323_G711Capability : public H323AudioCapability
1762 PCLASSINFO(H323_G711Capability, H323AudioCapability)
1764 public:
1765 /// Specific G.711 encoding algorithm.
1766 enum Mode {
1767 /// European standard
1768 ALaw,
1769 /// American standard
1770 muLaw
1772 /// Specific G.711 encoding bit rates.
1773 enum Speed {
1774 /// European standard
1775 At64k,
1776 /// American standard
1777 At56k
1780 /**@name Construction */
1781 //@{
1782 /**Create a new G.711 capability.
1784 H323_G711Capability(
1785 Mode mode = muLaw, ///< Type of encoding.
1786 Speed speed = At64k ///< Encoding bit rate.
1788 //@}
1790 /**@name Overrides from class PObject */
1791 //@{
1792 /**Create a copy of the object.
1794 virtual PObject * Clone() const;
1795 //@}
1797 /**@name Identification functions */
1798 //@{
1799 /**Get the sub-type of the capability. This is a code dependent on the
1800 main type of the capability.
1802 This returns one of the four possible combinations of mode and speed
1803 using the enum values of the protocol ASN H245_AudioCapability class.
1805 virtual unsigned GetSubType() const;
1807 /**Get the name of the media data format this class represents.
1809 virtual PString GetFormatName() const;
1810 //@}
1812 protected:
1813 Mode mode;
1814 Speed speed;
1817 #if 0
1819 /**This class describes the G.728 codec capability.
1821 class H323_G728Capability : public H323AudioCapability
1823 PCLASSINFO(H323_G728Capability, H323AudioCapability)
1825 public:
1826 /**@name Construction */
1827 //@{
1828 /**Create a new G.728 capability.
1830 H323_G728Capability();
1831 //@}
1833 /**@name Overrides from class PObject */
1834 //@{
1835 /**Create a copy of the object.
1837 virtual PObject * Clone() const;
1838 //@}
1840 /**@name Identification functions */
1841 //@{
1842 /**Get the sub-type of the capability. This is a code dependent on the
1843 main type of the capability.
1845 virtual unsigned GetSubType() const;
1847 /**Get the name of the media data format this class represents.
1849 virtual PString GetFormatName() const;
1850 //@}
1854 /**This class describes the G.729 codec capability.
1856 class H323_G729Capability : public H323AudioCapability
1858 PCLASSINFO(H323_G729Capability, H323AudioCapability)
1860 public:
1861 /// Specific G.729 encoding algorithm.
1862 enum Mode {
1863 e_Normal,
1864 e_AnnexA,
1865 e_AnnexB,
1866 e_AnnexA_AnnexB
1869 /**@name Construction */
1870 //@{
1871 /**Create a new G.729 capability.
1873 H323_G729Capability(
1874 Mode mode
1876 //@}
1878 /**@name Overrides from class PObject */
1879 //@{
1880 /**Create a copy of the object.
1882 virtual PObject * Clone() const;
1883 //@}
1885 /**@name Identification functions */
1886 //@{
1887 /**Get the sub-type of the capability. This is a code dependent on the
1888 main type of the capability.
1890 virtual unsigned GetSubType() const;
1892 /**Get the name of the media data format this class represents.
1894 virtual PString GetFormatName() const;
1895 //@}
1897 protected:
1898 Mode mode;
1902 /**This class describes the G.723.1 codec capability.
1904 class H323_G7231Capability : public H323AudioCapability
1906 PCLASSINFO(H323_G7231Capability, H323AudioCapability)
1908 public:
1909 /**@name Construction */
1910 //@{
1911 /**Create a new G.723.1 capability.
1913 H323_G7231Capability(
1914 BOOL allowSIDFrames = TRUE ///< Allow SID frames in data stream.
1916 //@}
1918 /**@name Overrides from class PObject */
1919 //@{
1920 /**Create a copy of the object.
1922 virtual PObject * Clone() const;
1923 //@}
1925 /**@name Identification functions */
1926 //@{
1927 /**Get the sub-type of the capability. This is a code dependent on the
1928 main type of the capability.
1930 virtual unsigned GetSubType() const;
1932 /**Get the name of the media data format this class represents.
1934 virtual PString GetFormatName() const;
1935 //@}
1937 /**@name Protocol manipulation */
1938 //@{
1939 /**This function is called whenever and outgoing TerminalCapabilitySet
1940 or OpenLogicalChannel PDU is being constructed for the control channel.
1941 It allows the capability to set the PDU fields from information in
1942 members specific to the class.
1944 The default behaviour sets the data rate field in the PDU.
1946 virtual BOOL OnSendingPDU(
1947 H245_AudioCapability & pdu, ///< PDU to set information on
1948 unsigned packetSize ///< Packet size to use in capability
1949 ) const;
1951 /**This function is called whenever and incoming TerminalCapabilitySet
1952 or OpenLogicalChannel PDU has been used to construct the control
1953 channel. It allows the capability to set from the PDU fields,
1954 information in members specific to the class.
1956 The default behaviour gets the data rate field from the PDU.
1958 virtual BOOL OnReceivedPDU(
1959 const H245_AudioCapability & pdu, ///< PDU to get information from
1960 unsigned & packetSize ///< Packet size to use in capability
1962 //@}
1964 protected:
1965 BOOL allowSIDFrames;
1969 /**This class describes the GSM 06.10 codec capability.
1971 class H323_GSM0610Capability : public H323AudioCapability
1973 PCLASSINFO(H323_GSM0610Capability, H323AudioCapability)
1975 public:
1976 /**@name Construction */
1977 //@{
1978 /**Create a new GSM 06.10 capability.
1980 H323_GSM0610Capability();
1981 //@}
1983 /**@name Overrides from class PObject */
1984 //@{
1985 /**Create a copy of the object.
1987 virtual PObject * Clone() const;
1988 //@}
1990 /**@name Identification functions */
1991 //@{
1992 /**Get the sub-type of the capability. This is a code dependent on the
1993 main type of the capability.
1995 This returns one of the four possible combinations of mode and speed
1996 using the enum values of the protocol ASN H245_AudioCapability class.
1998 virtual unsigned GetSubType() const;
2000 /**Get the name of the media data format this class represents.
2002 virtual PString GetFormatName() const;
2004 /**Set the maximum size (in frames) of data that will be transmitted in a
2005 single PDU.
2007 This will also be the desired number that will be sent by most codec
2008 implemetations.
2010 The default behaviour sets the txFramesInPacket variable.
2012 virtual void SetTxFramesInPacket(
2013 unsigned frames ///< Number of frames per packet
2015 //@}
2017 /**@name Protocol manipulation */
2018 //@{
2019 /**This function is called whenever and outgoing TerminalCapabilitySet
2020 or OpenLogicalChannel PDU is being constructed for the control channel.
2021 It allows the capability to set the PDU fields from information in
2022 members specific to the class.
2024 The default behaviour sets the data rate field in the PDU.
2026 virtual BOOL OnSendingPDU(
2027 H245_AudioCapability & pdu, ///< PDU to set information on
2028 unsigned packetSize ///< Packet size to use in capability
2029 ) const;
2031 /**This function is called whenever and incoming TerminalCapabilitySet
2032 or OpenLogicalChannel PDU has been used to construct the control
2033 channel. It allows the capability to set from the PDU fields,
2034 information in members specific to the class.
2036 The default behaviour gets the data rate field from the PDU.
2038 virtual BOOL OnReceivedPDU(
2039 const H245_AudioCapability & pdu, ///< PDU to get information from
2040 unsigned & packetSize ///< Packet size to use in capability
2042 //@}
2045 #endif
2048 ///////////////////////////////////////////////////////////////////////////////
2050 /**This class describes the UserInput psuedo-channel.
2052 class H323_UserInputCapability : public H323Capability
2054 PCLASSINFO(H323_UserInputCapability, H323Capability);
2056 public:
2057 /**@name Construction */
2058 //@{
2059 enum SubTypes {
2060 BasicString,
2061 IA5String,
2062 GeneralString,
2063 SignalToneH245,
2064 HookFlashH245,
2065 SignalToneRFC2833,
2066 NumSubTypes
2068 static const char * GetSubTypeName(SubTypes subType);
2069 friend ostream & operator<<(ostream & strm, SubTypes subType) { return strm << GetSubTypeName(subType); }
2071 /**Create the capability for User Input.
2072 The subType parameter is a value from the enum
2073 H245_UserInputCapability::Choices.
2075 H323_UserInputCapability(
2076 SubTypes subType
2078 //@}
2080 /**@name Overrides from class PObject */
2081 //@{
2082 /**Create a copy of the object.
2084 virtual PObject * Clone() const;
2085 //@}
2087 /**@name Identification functions */
2088 //@{
2089 /**Get the main type of the capability.
2091 This function is overridden by one of the three main sub-classes off
2092 which real capabilities would be descendend.
2094 virtual MainTypes GetMainType() const;
2096 /**Get the sub-type of the capability. This is a code dependent on the
2097 main type of the capability.
2099 virtual unsigned GetSubType() const;
2101 /**Get the name of the media data format this class represents.
2103 virtual PString GetFormatName() const;
2104 //@}
2106 /**@name Operations */
2107 //@{
2108 /**Create the channel instance, allocating resources as required.
2109 This creates a logical channel object appropriate for the parameters
2110 provided. Not if param is NULL, sessionID must be provided, otherwise
2111 this is taken from the fields in param.
2113 virtual H323Channel * CreateChannel(
2114 H323Connection & connection, ///< Owner connection for channel
2115 H323Channel::Directions dir, ///< Direction of channel
2116 unsigned sessionID, ///< Session ID for RTP channel
2117 const H245_H2250LogicalChannelParameters * param
2118 ///< Parameters for channel
2119 ) const;
2120 //@}
2122 /**@name Protocol manipulation */
2123 //@{
2124 /**This function is called whenever and outgoing TerminalCapabilitySet
2125 PDU is being constructed for the control channel. It allows the
2126 capability to set the PDU fields from information in members specific
2127 to the class.
2129 The default behaviour is pure.
2131 virtual BOOL OnSendingPDU(
2132 H245_Capability & pdu ///< PDU to set information on
2133 ) const;
2135 /**This function is called whenever and outgoing OpenLogicalChannel
2136 PDU is being constructed for the control channel. It allows the
2137 capability to set the PDU fields from information in members specific
2138 to the class.
2140 The default behaviour is pure.
2142 virtual BOOL OnSendingPDU(
2143 H245_DataType & pdu ///< PDU to set information on
2144 ) const;
2146 /**This function is called whenever and outgoing RequestMode
2147 PDU is being constructed for the control channel. It allows the
2148 capability to set the PDU fields from information in members specific
2149 to the class.
2151 The default behaviour calls the OnSendingPDU() function with a more
2152 specific PDU type.
2154 virtual BOOL OnSendingPDU(
2155 H245_ModeElement & pdu ///< PDU to set information on
2156 ) const;
2158 /**This function is called whenever and incoming TerminalCapabilitySet
2159 PDU is received on the control channel, and a new H323Capability
2160 descendent was created. This completes reading fields from the PDU
2161 into the classes members.
2163 If the function returns FALSE then the received PDU codec description
2164 is not supported, so will be ignored. The default behaviour simply
2165 returns TRUE.
2167 virtual BOOL OnReceivedPDU(
2168 const H245_Capability & pdu ///< PDU to get information from
2171 /**This function is called whenever and incoming OpenLogicalChannel
2172 PDU has been used to construct the control channel. It allows the
2173 capability to set from the PDU fields, information in members specific
2174 to the class.
2176 The default behaviour is pure.
2178 virtual BOOL OnReceivedPDU(
2179 const H245_DataType & pdu, ///< PDU to get information from
2180 BOOL receiver ///< Is receiver OLC
2183 /**Validate that the capability is usable given the connection.
2184 This checks agains the negotiated protocol version number and remote
2185 application to determine if this capability should be used in TCS or
2186 OLC pdus.
2188 The default behaviour will check for early versions and return FALSE
2189 for RFC2833 mode.
2191 virtual BOOL IsUsable(
2192 const H323Connection & connection
2193 ) const;
2194 //@}
2196 static void AddAllCapabilities(
2197 H323Capabilities & capabilities, ///< Table to add capabilities to
2198 PINDEX descriptorNum, ///< The member of the capabilityDescriptor to add
2199 PINDEX simultaneous ///< The member of the SimultaneousCapabilitySet to add
2202 protected:
2203 SubTypes subType;
2208 ///////////////////////////////////////////////////////////////////////////////
2210 PLIST(H323CapabilitiesList, H323Capability);
2212 PARRAY(H323CapabilitiesListArray, H323CapabilitiesList);
2214 class H323SimultaneousCapabilities : public H323CapabilitiesListArray
2216 PCLASSINFO(H323SimultaneousCapabilities, H323CapabilitiesListArray);
2217 public:
2218 BOOL SetSize(PINDEX newSize);
2222 PARRAY(H323CapabilitiesSetArray, H323SimultaneousCapabilities);
2225 class H323CapabilitiesSet : public H323CapabilitiesSetArray
2227 PCLASSINFO(H323CapabilitiesSet, H323CapabilitiesSetArray);
2228 public:
2229 /// Set the new size of the table, internal use only.
2230 BOOL SetSize(PINDEX newSize);
2234 /**This class contains all of the capabilities and their combinations.
2236 class H323Capabilities : public PObject
2238 PCLASSINFO(H323Capabilities, PObject);
2239 public:
2240 /**@name Construction */
2241 //@{
2242 /**Construct an empty capability set.
2244 H323Capabilities();
2246 /**Construct a capability set from the H.245 PDU provided.
2248 H323Capabilities(
2249 const H323Connection & connection, ///< Connection for capabilities
2250 const H245_TerminalCapabilitySet & pdu ///< PDU to convert to a capability set.
2253 /**Construct a copy of a capability set.
2254 Note this will completely duplicate the set by making clones of every
2255 capability in the original set.
2257 H323Capabilities(
2258 const H323Capabilities & original ///< Original capabilities to duplicate
2261 /**Assign a copy of a capability set.
2262 Note this will completely duplicate the set by making clones of every
2263 capability in the original set.
2265 H323Capabilities & operator=(
2266 const H323Capabilities & original ///< Original capabilities to duplicate
2268 //@}
2270 /**@name Overrides from class PObject */
2271 //@{
2272 /**Print out the object to the stream, virtual version of << operator.
2274 void PrintOn(
2275 ostream & strm ///< Stream to print out to.
2276 ) const;
2277 //@}
2279 /**@name Operations */
2280 //@{
2281 /**Get the number of capabilities in the set.
2283 PINDEX GetSize() const { return table.GetSize(); }
2285 /**Get the capability at the specified index.
2287 H323Capability & operator[](PINDEX i) const { return table[i]; }
2289 /**Set the capability descriptor lists. This is three tier set of
2290 codecs. The top most level is a list of particular capabilities. Each
2291 of these consists of a list of alternatives that can operate
2292 simultaneously. The lowest level is a list of codecs that cannot
2293 operate together. See H323 section 6.2.8.1 and H245 section 7.2 for
2294 details.
2296 If descriptorNum is P_MAX_INDEX, the the next available index in the
2297 array of descriptors is used. Similarly if simultaneous is P_MAX_INDEX
2298 the the next available SimultaneousCapabilitySet is used. The return
2299 value is the index used for the new entry. Note if both are P_MAX_INDEX
2300 then the return value is the descriptor index as the simultaneous index
2301 must be zero.
2303 Note that the capability specified here is automatically added to the
2304 capability table using the AddCapability() function. A specific
2305 instance of a capability is only ever added once, so multiple
2306 SetCapability() calls with the same H323Capability pointer will only
2307 add that capability once.
2309 PINDEX SetCapability(
2310 PINDEX descriptorNum, ///< The member of the capabilityDescriptor to add
2311 PINDEX simultaneous, ///< The member of the SimultaneousCapabilitySet to add
2312 H323Capability * cap ///< New capability specification
2315 /**Add all matching capabilities to descriptor lists.
2316 All capabilities that match the specified name are added as in the other
2317 form of the SetCapability() function.
2319 PINDEX AddAllCapabilities(
2320 PINDEX descriptorNum, ///< The member of the capabilityDescriptor to add
2321 PINDEX simultaneous, ///< The member of the SimultaneousCapabilitySet to add
2322 const PString & name, ///< New capabilities name, if using "known" one.
2323 BOOL exact = FALSE ///< Capability name must be exact match
2326 // this function is retained for backwards compatibility
2327 PINDEX AddAllCapabilities(
2328 const H323EndPoint &, ///< The endpoint adding the capabilities.
2329 PINDEX descriptorNum, ///< The member of the capabilityDescriptor to add
2330 PINDEX simultaneous, ///< The member of the SimultaneousCapabilitySet to add
2331 const PString & name, ///< New capabilities name, if using "known" one.
2332 BOOL exact = FALSE ///< Capability name must be exact match
2334 { return AddAllCapabilities(descriptorNum, simultaneous, name, exact); }
2336 /**Add a codec to the capabilities table. This will assure that the
2337 assignedCapabilityNumber field in the capability is unique for all
2338 capabilities installed on this set.
2340 If the specific instance of the capability is already in the table, it
2341 is not added again. Ther can be multiple instances of the same
2342 capability class however.
2344 void Add(
2345 H323Capability * capability ///< New capability specification
2348 /**Copy a codec to the capabilities table. This will make a clone of the
2349 capability and assure that the assignedCapabilityNumber field in the
2350 capability is unique for all capabilities installed on this set.
2352 Returns the copy that is put in the table.
2354 H323Capability * Copy(
2355 const H323Capability & capability ///< New capability specification
2358 /**Remove a capability from the table. Note that the the parameter must be
2359 the actual instance of the capability in the table. The instance is
2360 deleted when removed from the table.
2362 void Remove(
2363 H323Capability * capability ///< Existing capability specification
2366 /**Remove all capabilities matching the string. This uses FindCapability()
2367 to locate the first capability whose format name does a partial match
2368 for the argument.
2370 void Remove(
2371 const PString & formatName ///< Format name to search for.
2374 /**Remove all capabilities matching any of the strings provided. This
2375 simply calls Remove() for each string in the list.
2377 void Remove(
2378 const PStringArray & formatNames ///< Array of format names to remove
2381 /**Remove all of the capabilities.
2383 void RemoveAll();
2385 /**Find the capability given the capability number. This number is
2386 guarenteed to be unique for a give capability table. Note that is may
2387 not be the same as the index into the table.
2389 Returns:
2390 NULL if no capability meeting the criteria was found
2392 H323Capability * FindCapability(
2393 unsigned capabilityNumber
2394 ) const;
2396 /**Find the capability given the capability format name string. This does
2397 a partial match for the supplied argument. If the argument matches a
2398 substring of the actual capabilities name, then it is returned. For
2399 example "GSM" or "0610" will match "GSM 0610". Note case is not
2400 significant.
2402 The user should be carefull of using short strings such as "G"!
2404 The direction parameter can further refine the search for specific
2405 receive or transmit capabilities. The default value of e_Unknown will
2406 wildcard that field.
2408 Returns:
2409 NULL if no capability meeting the criteria was found
2411 H323Capability * FindCapability(
2412 const PString & formatName, ///< Wildcard format name to search for
2413 H323Capability::CapabilityDirection direction = H323Capability::e_Unknown,
2414 ///< Optional direction to include into search criteria
2415 BOOL exact = FALSE ///< Capability name must be exact match
2416 ) const;
2418 /**Find the first capability in the table of the specified direction.
2420 Returns:
2421 NULL if no capability meeting the criteria was found
2423 H323Capability * FindCapability(
2424 H323Capability::CapabilityDirection direction ///< Direction to search for
2425 ) const;
2427 /**Find the capability given the capability. This does a value compare of
2428 the two capabilities. Usually this means the mainType and subType are
2429 the same.
2431 Returns:
2432 NULL if no capability meeting the criteria was found
2434 H323Capability * FindCapability(
2435 const H323Capability & capability ///< Capability to search for
2436 ) const;
2438 /**Find the capability given the H.245 capability PDU.
2440 Returns:
2441 NULL if no capability meeting the criteria was found
2443 H323Capability * FindCapability(
2444 const H245_Capability & cap ///< H245 capability table entry
2445 ) const;
2447 /**Find the capability given the H.245 data type PDU.
2449 Returns:
2450 NULL if no capability meeting the criteria was found
2452 H323Capability * FindCapability(
2453 const H245_DataType & dataType ///< H245 data type of codec
2454 ) const;
2456 /**Find the capability given the H.245 data type PDU.
2458 Returns:
2459 NULL if no capability meeting the criteria was found
2461 H323Capability * FindCapability(
2462 const H245_ModeElement & modeElement ///< H245 data type of codec
2463 ) const;
2465 /**Find the capability given the type codecs.
2467 Returns:
2468 NULL if no capability meeting the criteria was found
2470 H323Capability * FindCapability(
2471 H323Capability::MainTypes mainType, ///< Main type to find
2472 unsigned subType = UINT_MAX ///< Sub-type to find (UINT_MAX=ignore)
2473 ) const;
2475 /**Build a H.245 PDU from the information in the capability set.
2477 void BuildPDU(
2478 const H323Connection & connection, ///< Connection building PDU for
2479 H245_TerminalCapabilitySet & pdu ///< PDU to build
2480 ) const;
2482 /**Merge the capabilities into this set.
2484 BOOL Merge(
2485 const H323Capabilities & newCaps
2488 /**Change the order of capabilities in the table to the order specified.
2489 Note that this does not change the unique capability numbers assigned
2490 when the capability is first added to the set.
2492 The string matching rules are as for the FindCapability() function.
2494 void Reorder(
2495 const PStringArray & preferenceOrder ///< New order
2498 /**Test if the capability is allowed.
2500 BOOL IsAllowed(
2501 const H323Capability & capability
2504 /**Test if the capability is allowed.
2506 BOOL IsAllowed(
2507 unsigned capabilityNumber
2510 /**Test if the capabilities are an allowed combination.
2512 BOOL IsAllowed(
2513 const H323Capability & capability1,
2514 const H323Capability & capability2
2517 /**Test if the capabilities are an allowed combination.
2519 BOOL IsAllowed(
2520 unsigned capabilityNumber1,
2521 unsigned capabilityNumber2
2524 /**Get the list of capabilities as a list of media formats.
2526 OpalMediaFormatList GetMediaFormats() const;
2527 //@}
2529 protected:
2530 H323CapabilitiesList table;
2531 H323CapabilitiesSet set;
2535 ///////////////////////////////////////////////////////////////////////////////
2537 /* New capability registration macros based on abstract factories
2539 typedef PFactory<H323Capability, std::string> H323CapabilityFactory;
2541 #define H323_REGISTER_CAPABILITY(cls, capName) static H323CapabilityFactory::Worker<cls> cls##Factory(capName, true); \
2543 #define H323_DECLARE_CAPABILITY_CLASS(cls, anc) \
2544 class cls : public anc \
2546 public: \
2547 cls() \
2549 #endif // __OPAL_H323CAPS_H
2552 /////////////////////////////////////////////////////////////////////////////