OPAL Version 3.10.4

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

h323caps.h
Go to the documentation of this file.
1 /*
2 * h323caps.h
3 *
4 * H.323 protocol handler
5 *
6 * Open H323 Library
7 *
8 * Copyright (c) 1998-2001 Equivalence Pty. Ltd.
9 *
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/
14 *
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.
19 *
20 * The Original Code is Open H323 Library.
21 *
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23 *
24 * Portions of this code were written with the assisance of funding from
25 * Vovida Networks, Inc. http://www.vovida.com.
26 *
27 * Contributor(s): ______________________________________.
28 *
29 * $Revision: 26128 $
30 * $Author: rjongbloed $
31 * $Date: 2011-07-07 21:36:57 -0500 (Thu, 07 Jul 2011) $
32 */
33
34 #ifndef OPAL_H323_H323CAPS_H
35 #define OPAL_H323_H323CAPS_H
36
37 #ifdef P_USE_PRAGMA
38 #pragma interface
39 #endif
40
41 #include <opal/buildopts.h>
42
43 #if OPAL_H323
44
45 #include <opal/mediafmt.h>
46 #include <h323/channels.h>
47
48
49 /* The following classes have forward references to avoid including the VERY
50 large header files for H225 and H245. If an application requires access
51 to the protocol classes they can include them, but for simple usage their
52 inclusion can be avoided.
53 */
54 class PASN_Choice;
55 class H245_Capability;
56 class H245_DataType;
57 class H245_ModeElement;
58 class H245_AudioCapability;
59 class H245_AudioMode;
60 class H245_VideoCapability;
61 class H245_VideoMode;
62 class H245_DataApplicationCapability;
63 class H245_DataMode;
64 class H245_DataProtocolCapability;
65 class H245_H2250LogicalChannelParameters;
66 class H245_TerminalCapabilitySet;
67 class H245_NonStandardParameter;
68 class H323Connection;
69 class H323Capabilities;
70 class H245_CapabilityIdentifier;
71 class H245_GenericCapability;
72 class H245_GenericParameter;
73
75
89 class H323Capability : public PObject
90 {
91 PCLASSINFO(H323Capability, PObject);
92
93 public:
98 H323Capability();
100
106 Comparison Compare(const PObject & obj) const;
107
110 void PrintOn(ostream & strm) const;
112
115 enum MainTypes {
117 e_Audio,
119 e_Video,
121 e_Data,
123 e_UserInput,
125 e_GenericControl,
127 e_NumMainTypes
128 };
129
135 virtual MainTypes GetMainType() const = 0;
136
140 virtual unsigned GetSubType() const = 0;
141
144 virtual PString GetFormatName() const = 0;
146
152 static H323Capability * Create(
153 const PString & name
154 );
155
156 enum {
157 DefaultAudioSessionID = 1,
158 DefaultVideoSessionID = 2,
159 DefaultDataSessionID = 3,
160 DefaultH224SessionID = 4
161 };
162
171 virtual unsigned GetDefaultSessionID() const;
172
181 virtual void SetTxFramesInPacket(
182 unsigned frames
183 );
184
189 virtual unsigned GetTxFramesInPacket() const;
190
195 virtual unsigned GetRxFramesInPacket() const;
196
202 virtual H323Channel * CreateChannel(
203 H323Connection & connection,
204 H323Channel::Directions dir,
205 unsigned sessionID,
206 const H245_H2250LogicalChannelParameters * param
208 ) const = 0;
210
213 enum CommandType {
214 e_TCS,
215 e_OLC,
216 e_ReqMode
217 };
218
226 virtual PBoolean OnSendingPDU(
227 H245_Capability & pdu
228 ) const = 0;
229
237 virtual PBoolean OnSendingPDU(
238 H245_DataType & pdu
239 ) const;
240
248 virtual PBoolean OnSendingPDU(
249 H245_ModeElement & pdu
250 ) const = 0;
251
264 virtual PBoolean OnReceivedPDU(
265 const H245_Capability & pdu
266 );
267
275 virtual PBoolean OnReceivedPDU(
276 const H245_DataType & pdu,
277 PBoolean receiver
278 );
279
282 virtual PBoolean IsMatch(
283 const PASN_Choice & subTypePDU
284 ) const;
285
293 virtual PBoolean IsUsable(
294 const H323Connection & connection
295 ) const;
297
300 enum CapabilityDirection {
301 e_Unknown,
302 e_Receive,
303 e_Transmit,
304 e_ReceiveAndTransmit,
305 e_NoDirection,
306 NumCapabilityDirections
307 };
308
311 CapabilityDirection GetCapabilityDirection() const { return capabilityDirection; }
312
315 void SetCapabilityDirection(
316 CapabilityDirection dir
317 ) { capabilityDirection = dir; }
318
320 unsigned GetCapabilityNumber() const { return assignedCapabilityNumber; }
321
323 void SetCapabilityNumber(unsigned num) { assignedCapabilityNumber = num; }
324
327 OpalMediaFormat GetMediaFormat() const;
328
331 bool UpdateMediaFormat(
332 const OpalMediaFormat & format
333 );
334
336 RTP_DataFrame::PayloadTypes GetPayloadType() const { return GetMediaFormat().GetPayloadType(); }
337
339 void SetPayloadType(RTP_DataFrame::PayloadTypes pt) { GetWritableMediaFormat().SetPayloadType(pt); }
340
342 virtual void AttachQoS(RTP_QOS *) { }
344
345 #if PTRACING
346 friend ostream & operator<<(ostream & o , MainTypes t);
347 friend ostream & operator<<(ostream & o , CapabilityDirection d);
348 #endif
349
350 protected:
351 OpalMediaFormat & GetWritableMediaFormat() const;
352
353 unsigned assignedCapabilityNumber;
354 CapabilityDirection capabilityDirection;
355
356 private:
357 mutable OpalMediaFormat m_mediaFormat;
358
359 friend class H323Capabilities;
360 };
361
362
363
372 class H323NonStandardCapabilityInfo
373 {
374 public:
375 typedef PObject::Comparison (*CompareFuncType)(struct PluginCodec_H323NonStandardCodecData *);
376
379 H323NonStandardCapabilityInfo(
380 CompareFuncType compareFunc,
381 const BYTE * dataBlock,
382 PINDEX dataSize
383 );
384
387 H323NonStandardCapabilityInfo(
388 const BYTE * dataBlock,
389 PINDEX dataSize,
390 PINDEX comparisonOffset = 0,
391 PINDEX comparisonLength = P_MAX_INDEX
392 );
393
396 H323NonStandardCapabilityInfo(
397 const PString & oid,
398 const BYTE * dataBlock,
399 PINDEX dataSize,
400 PINDEX comparisonOffset = 0,
401 PINDEX comparisonLength = P_MAX_INDEX
402 );
403
406 H323NonStandardCapabilityInfo(
407 BYTE country,
408 BYTE extension,
409 WORD maufacturer,
410 const BYTE * dataBlock,
411 PINDEX dataSize,
412 PINDEX comparisonOffset = 0,
413 PINDEX comparisonLength = P_MAX_INDEX
414 );
415
418 virtual ~H323NonStandardCapabilityInfo();
419
424 virtual PBoolean OnSendingPDU(
425 PBYTEArray & data
426 ) const;
427
432 virtual PBoolean OnReceivedPDU(
433 const PBYTEArray & data
434 );
435
436 PBoolean IsMatch(const H245_NonStandardParameter & param) const;
437
438 PObject::Comparison CompareParam(
439 const H245_NonStandardParameter & param
440 ) const;
441
442 protected:
443 PBoolean OnSendingNonStandardPDU(
444 PASN_Choice & pdu,
445 unsigned nonStandardTag
446 ) const;
447 PBoolean OnReceivedNonStandardPDU(
448 const PASN_Choice & pdu,
449 unsigned nonStandardTag
450 );
451
452 PObject::Comparison CompareInfo(
453 const H323NonStandardCapabilityInfo & obj
454 ) const;
455 PObject::Comparison CompareData(
456 const PBYTEArray & data
457 ) const;
458
459 PString oid;
460 BYTE t35CountryCode;
461 BYTE t35Extension;
462 WORD manufacturerCode;
463 PBYTEArray nonStandardData;
464 PINDEX comparisonOffset;
465 PINDEX comparisonLength;
466 CompareFuncType compareFunc;
467 };
468
478 class H323GenericCapabilityInfo
479 {
480 public:
481 H323GenericCapabilityInfo(
482 const PString & id,
483 unsigned maxBitRate = 0
484 );
485
486 virtual ~H323GenericCapabilityInfo() { }
487
488 protected:
489 virtual PBoolean OnSendingGenericPDU(
490 H245_GenericCapability & pdu,
491 const OpalMediaFormat & mediaFormat,
492 H323Capability::CommandType type
493 ) const;
494 virtual PBoolean OnReceivedGenericPDU(
495 OpalMediaFormat & mediaFormat,
496 const H245_GenericCapability & pdu,
497 H323Capability::CommandType type
498 );
499
500 PBoolean IsMatch(
501 const H245_GenericCapability & param
502 ) const;
503 PObject::Comparison CompareInfo(
504 const H323GenericCapabilityInfo & obj
505 ) const;
506
507
508 PString m_identifier;
509 unsigned maxBitRate;
510 };
511
518 class H323RealTimeCapability : public H323Capability
519 {
520 PCLASSINFO(H323RealTimeCapability, H323Capability);
521
522 public:
527 virtual H323Channel * CreateChannel(
528 H323Connection & connection,
529 H323Channel::Directions dir,
530 unsigned sessionID,
531 const H245_H2250LogicalChannelParameters * param
533 ) const;
534
535 H323RealTimeCapability();
536 H323RealTimeCapability(const H323RealTimeCapability &rtc);
537 virtual ~H323RealTimeCapability();
538 void AttachQoS(RTP_QOS * _rtpqos);
539
540 protected:
541 RTP_QOS * rtpqos;
543 };
544
545
552 class H323AudioCapability : public H323RealTimeCapability
553 {
554 PCLASSINFO(H323AudioCapability, H323RealTimeCapability);
555
556 public:
561 H323AudioCapability();
563
569 virtual MainTypes GetMainType() const;
571
582 virtual unsigned GetDefaultSessionID() const;
583
592 virtual void SetTxFramesInPacket(
593 unsigned frames
594 );
595
601 virtual unsigned GetTxFramesInPacket() const;
602
608 virtual unsigned GetRxFramesInPacket() const;
610
621 virtual PBoolean OnSendingPDU(
622 H245_Capability & pdu
623 ) const;
624
633 virtual PBoolean OnSendingPDU(
634 H245_DataType & pdu
635 ) const;
636
645 virtual PBoolean OnSendingPDU(
646 H245_ModeElement & pdu
647 ) const;
648
657 virtual PBoolean OnSendingPDU(
658 H245_AudioCapability & pdu,
659 unsigned packetSize
660 ) const;
661 virtual PBoolean OnSendingPDU(
662 H245_AudioCapability & pdu,
663 unsigned packetSize,
664 CommandType type
665 ) const;
666
675 virtual PBoolean OnSendingPDU(
676 H245_AudioMode & pdu
677 ) const;
678
690 virtual PBoolean OnReceivedPDU(
691 const H245_Capability & pdu
692 );
693
703 virtual PBoolean OnReceivedPDU(
704 const H245_DataType & pdu,
705 PBoolean receiver
706 );
707
716 virtual PBoolean OnReceivedPDU(
717 const H245_AudioCapability & pdu,
718 unsigned & packetSize
719 );
720 virtual PBoolean OnReceivedPDU(
721 const H245_AudioCapability & pdu,
722 unsigned & packetSize,
723 CommandType type
724 );
726 };
727
728
736 class H323NonStandardAudioCapability : public H323AudioCapability,
737 public H323NonStandardCapabilityInfo
738 {
739 PCLASSINFO(H323NonStandardAudioCapability, H323AudioCapability);
740
741 public:
744 H323NonStandardAudioCapability(
745 H323NonStandardCapabilityInfo::CompareFuncType compareFunc,
746 const BYTE * dataBlock,
747 PINDEX dataSize
748 );
751 H323NonStandardAudioCapability(
752 const BYTE * dataBlock = NULL,
753 PINDEX dataSize = 0,
754 PINDEX comparisonOffset = 0,
755 PINDEX comparisonLength = P_MAX_INDEX
756 );
757
760 H323NonStandardAudioCapability(
761 const PString & oid,
762 const BYTE * dataBlock = NULL,
763 PINDEX dataSize = 0,
764 PINDEX comparisonOffset = 0,
765 PINDEX comparisonLength = P_MAX_INDEX
766 );
767
770 H323NonStandardAudioCapability(
771 BYTE country,
772 BYTE extension,
773 WORD maufacturer,
774 const BYTE * dataBlock = NULL,
775 PINDEX dataSize = 0,
776 PINDEX comparisonOffset = 0,
777 PINDEX comparisonLength = P_MAX_INDEX
778 );
780
786 Comparison Compare(const PObject & obj) const;
788
796 virtual unsigned GetSubType() const;
798
809 virtual PBoolean OnSendingPDU(
810 H245_AudioCapability & pdu,
811 unsigned packetSize
812 ) const;
813
822 virtual PBoolean OnSendingPDU(
823 H245_AudioMode & pdu
824 ) const;
825
834 virtual PBoolean OnReceivedPDU(
835 const H245_AudioCapability & pdu,
836 unsigned & packetSize
837 );
838
841 virtual PBoolean IsMatch(
842 const PASN_Choice & subTypePDU
843 ) const;
845 };
846
854 class H323GenericAudioCapability : public H323AudioCapability,
855 public H323GenericCapabilityInfo
856 {
857 PCLASSINFO(H323NonStandardAudioCapability, H323AudioCapability);
858
859 public:
864 H323GenericAudioCapability(
865 const PString & capabilityId,
866 PINDEX maxBitRate = 0
867 );
869
875 Comparison Compare(const PObject & obj) const;
877
885 virtual unsigned GetSubType() const;
887
898 virtual PBoolean OnSendingPDU(
899 H245_AudioCapability & pdu,
900 unsigned packetSize,
901 CommandType type
902 ) const;
903
912 virtual PBoolean OnSendingPDU(
913 H245_AudioMode & pdu
914 ) const;
915
924 virtual PBoolean OnReceivedPDU(
925 const H245_AudioCapability & pdu,
926 unsigned & packetSize,
927 CommandType type
928 );
929
932 virtual PBoolean IsMatch(
933 const PASN_Choice & subTypePDU
934 ) const;
936 };
937
938
939 #if OPAL_VIDEO
940
947 class H323VideoCapability : public H323RealTimeCapability
948 {
949 PCLASSINFO(H323VideoCapability, H323RealTimeCapability);
950
951 public:
957 virtual MainTypes GetMainType() const;
959
970 virtual unsigned GetDefaultSessionID() const;
972
983 virtual PBoolean OnSendingPDU(
984 H245_Capability & pdu
985 ) const;
986
995 virtual PBoolean OnSendingPDU(
996 H245_DataType & pdu
997 ) const;
998
1007 virtual PBoolean OnSendingPDU(
1008 H245_ModeElement & pdu
1009 ) const;
1010
1018 virtual PBoolean OnSendingPDU(
1019 H245_VideoCapability & pdu
1020 ) const;
1021 virtual PBoolean OnSendingPDU(
1022 H245_VideoCapability & pdu,
1023 CommandType type
1024 ) const;
1025
1034 virtual PBoolean OnSendingPDU(
1035 H245_VideoMode & pdu
1036 ) const = 0;
1037
1047 virtual PBoolean OnReceivedPDU(
1048 const H245_Capability & pdu
1049 );
1050
1058 virtual PBoolean OnReceivedPDU(
1059 const H245_DataType & pdu,
1060 PBoolean receiver
1061 );
1062
1070 virtual PBoolean OnReceivedPDU(
1071 const H245_VideoCapability & pdu
1072 );
1073 virtual PBoolean OnReceivedPDU(
1074 const H245_VideoCapability & pdu,
1075 CommandType type
1076 );
1078 };
1079
1080
1088 class H323NonStandardVideoCapability : public H323VideoCapability,
1089 public H323NonStandardCapabilityInfo
1090 {
1091 PCLASSINFO(H323NonStandardVideoCapability, H323VideoCapability);
1092
1093 public:
1096 H323NonStandardVideoCapability(
1097 H323NonStandardCapabilityInfo::CompareFuncType compareFunc,
1098 const BYTE * dataBlock,
1099 PINDEX dataSize
1100 );
1103 H323NonStandardVideoCapability(
1104 const BYTE * dataBlock = NULL,
1105 PINDEX dataSize = 0,
1106 PINDEX comparisonOffset = 0,
1107 PINDEX comparisonLength = P_MAX_INDEX
1108 );
1109
1112 H323NonStandardVideoCapability(
1113 const PString & oid,
1114 const BYTE * dataBlock = NULL,
1115 PINDEX dataSize = 0,
1116 PINDEX comparisonOffset = 0,
1117 PINDEX comparisonLength = P_MAX_INDEX
1118 );
1119
1122 H323NonStandardVideoCapability(
1123 BYTE country,
1124 BYTE extension,
1125 WORD maufacturer,
1126 const BYTE * dataBlock = NULL,
1127 PINDEX dataSize = 0,
1128 PINDEX comparisonOffset = 0,
1129 PINDEX comparisonLength = P_MAX_INDEX
1130 );
1132
1138 Comparison Compare(const PObject & obj) const;
1140
1149 virtual unsigned GetSubType() const;
1151
1162 virtual PBoolean OnSendingPDU(
1163 H245_VideoCapability & pdu
1164 ) const;
1165
1174 virtual PBoolean OnSendingPDU(
1175 H245_VideoMode & pdu
1176 ) const;
1177
1186 virtual PBoolean OnReceivedPDU(
1187 const H245_VideoCapability & pdu
1188 );
1189
1192 virtual PBoolean IsMatch(
1193 const PASN_Choice & subTypePDU
1194 ) const;
1196 };
1197
1205 class H323GenericVideoCapability : public H323VideoCapability,
1206 public H323GenericCapabilityInfo
1207 {
1208 PCLASSINFO(H323GenericVideoCapability, H323VideoCapability);
1209
1210 public:
1215 H323GenericVideoCapability(
1216 const PString & capabilityId,
1217 PINDEX maxBitRate = 0
1218 );
1220
1226 Comparison Compare(const PObject & obj) const;
1228
1236 virtual unsigned GetSubType() const;
1238
1249 virtual PBoolean OnSendingPDU(
1250 H245_VideoCapability & pdu,
1251 CommandType type
1252 ) const;
1253
1262 virtual PBoolean OnSendingPDU(
1263 H245_VideoMode & pdu
1264 ) const;
1265
1274 virtual PBoolean OnReceivedPDU(
1275 const H245_VideoCapability & pdu,
1276 CommandType type
1277 );
1278
1281 virtual PBoolean IsMatch(
1282 const PASN_Choice & subTypePDU
1283 ) const;
1285 };
1286
1287
1288 #if OPAL_H239
1289
1292 class H323ExtendedVideoCapability : public H323GenericVideoCapability
1293 {
1294 PCLASSINFO(H323ExtendedVideoCapability, H323GenericVideoCapability);
1295
1296 public:
1301 H323ExtendedVideoCapability(
1302 const PString & identifier
1303 );
1305
1313 virtual unsigned GetSubType() const;
1315
1326 virtual PBoolean OnSendingPDU(
1327 H245_VideoCapability & pdu,
1328 CommandType type
1329 ) const;
1330
1339 virtual PBoolean OnSendingPDU(
1340 H245_VideoMode & pdu
1341 ) const;
1342
1351 virtual PBoolean OnReceivedPDU(
1352 const H245_VideoCapability & pdu,
1353 CommandType type
1354 );
1355
1358 virtual PBoolean IsMatch(
1359 const PASN_Choice & subTypePDU
1360 ) const;
1362
1363 protected:
1364 OpalMediaFormatList m_videoFormats;
1365 };
1366
1367
1369
1372 class H323GenericControlCapability : public H323Capability,
1373 public H323GenericCapabilityInfo
1374 {
1375 PCLASSINFO(H323GenericControlCapability, H323Capability);
1376
1377 public:
1382 H323GenericControlCapability(
1383 const PString & identifier
1384 );
1386
1392 virtual MainTypes GetMainType() const;
1393
1399 virtual unsigned GetSubType() const;
1401
1412 virtual PBoolean OnSendingPDU(
1413 H245_Capability & pdu
1414 ) const;
1415
1423 virtual PBoolean OnSendingPDU(
1424 H245_ModeElement & pdu
1425 ) const;
1426
1436 virtual PBoolean OnReceivedPDU(
1437 const H245_Capability & pdu
1438 );
1439
1442 virtual PBoolean IsMatch(
1443 const PASN_Choice & subTypePDU
1444 ) const;
1446
1454 virtual H323Channel * CreateChannel(
1455 H323Connection & connection,
1456 H323Channel::Directions dir,
1457 unsigned sessionID,
1458 const H245_H2250LogicalChannelParameters * param
1460 ) const;
1462 };
1463
1464
1466
1467 class H323H239VideoCapability : public H323ExtendedVideoCapability
1468 {
1469 PCLASSINFO(H323H239VideoCapability, H323ExtendedVideoCapability);
1470
1471 public:
1476 H323H239VideoCapability(
1477 const OpalMediaFormat & videoFormat
1478 );
1480
1486 Comparison Compare(const PObject & obj) const;
1487
1490 virtual PObject * Clone() const;
1491
1494 void PrintOn(ostream & strm) const;
1496
1501 virtual PString GetFormatName() const;
1503
1514 virtual PBoolean OnSendingPDU(
1515 H245_VideoCapability & pdu,
1516 CommandType type
1517 ) const;
1518
1527 virtual PBoolean OnReceivedPDU(
1528 const H245_VideoCapability & pdu,
1529 CommandType type
1530 );
1532 };
1533
1534
1536
1537 class H323H239ControlCapability : public H323GenericControlCapability
1538 {
1539 PCLASSINFO(H323H239ControlCapability, H323GenericControlCapability);
1540
1541 public:
1546 H323H239ControlCapability();
1548
1553 virtual PObject * Clone() const;
1555
1560 virtual PString GetFormatName() const;
1562 };
1563
1564
1565 #endif // OPAL_H239
1566
1567 #endif // OPAL_VIDEO
1568
1569
1576 class H323DataCapability : public H323Capability
1577 {
1578 PCLASSINFO(H323DataCapability, H323Capability);
1579
1580 public:
1585 H323DataCapability(
1586 unsigned maxBitRate = 0
1587 );
1589
1595 virtual MainTypes GetMainType() const;
1597
1607 virtual unsigned GetDefaultSessionID() const;
1609
1620 virtual PBoolean OnSendingPDU(
1621 H245_Capability & pdu
1622 ) const;
1623
1632 virtual PBoolean OnSendingPDU(
1633 H245_DataType & pdu
1634 ) const;
1635
1644 virtual PBoolean OnSendingPDU(
1645 H245_ModeElement & pdu
1646 ) const;
1647
1655 virtual PBoolean OnSendingPDU(
1656 H245_DataApplicationCapability & pdu
1657 ) const;
1658 virtual PBoolean OnSendingPDU(
1659 H245_DataApplicationCapability & pdu,
1660 CommandType type
1661 ) const;
1662
1671 virtual PBoolean OnSendingPDU(
1672 H245_DataMode & pdu
1673 ) const = 0;
1674
1684 virtual PBoolean OnReceivedPDU(
1685 const H245_Capability & pdu
1686 );
1687
1695 virtual PBoolean OnReceivedPDU(
1696 const H245_DataType & pdu,
1697 PBoolean receiver
1698 );
1699
1707 virtual PBoolean OnReceivedPDU(
1708 const H245_DataApplicationCapability & pdu
1709 );
1710 virtual PBoolean OnReceivedPDU(
1711 const H245_DataApplicationCapability & pdu,
1712 CommandType type
1713 );
1715
1716 protected:
1717 unsigned maxBitRate;
1718 };
1719
1720
1728 class H323NonStandardDataCapability : public H323DataCapability,
1729 public H323NonStandardCapabilityInfo
1730 {
1731 PCLASSINFO(H323NonStandardDataCapability, H323DataCapability);
1732
1733 public:
1738 H323NonStandardDataCapability(
1739 unsigned maxBitRate,
1740 const BYTE * dataBlock = NULL,
1741 PINDEX dataSize = 0,
1742 PINDEX comparisonOffset = 0,
1743 PINDEX comparisonLength = P_MAX_INDEX
1744 );
1745
1748 H323NonStandardDataCapability(
1749 unsigned maxBitRate,
1750 const PString & oid,
1751 const BYTE * dataBlock = NULL,
1752 PINDEX dataSize = 0,
1753 PINDEX comparisonOffset = 0,
1754 PINDEX comparisonLength = P_MAX_INDEX
1755 );
1756
1759 H323NonStandardDataCapability(
1760 unsigned maxBitRate,
1761 BYTE country,
1762 BYTE extension,
1763 WORD maufacturer,
1764 const BYTE * dataBlock = NULL,
1765 PINDEX dataSize = 0,
1766 PINDEX comparisonOffset = 0,
1767 PINDEX comparisonLength = P_MAX_INDEX
1768 );
1770
1776 Comparison Compare(const PObject & obj) const;
1778
1787 virtual unsigned GetSubType() const;
1789
1800 virtual PBoolean OnSendingPDU(
1801 H245_DataApplicationCapability & pdu
1802 ) const;
1803
1812 virtual PBoolean OnSendingPDU(
1813 H245_DataMode & pdu
1814 ) const;
1815
1824 virtual PBoolean OnReceivedPDU(
1825 const H245_DataApplicationCapability & pdu
1826 );
1827
1830 virtual PBoolean IsMatch(
1831 const PASN_Choice & subTypePDU
1832 ) const;
1834 };
1835
1836
1838 // Known audio codecs
1839
1842 class H323_G711Capability : public H323AudioCapability
1843 {
1844 PCLASSINFO(H323_G711Capability, H323AudioCapability)
1845
1846 public:
1848 enum Mode {
1850 ALaw,
1852 muLaw
1853 };
1855 enum Speed {
1857 At64k,
1859 At56k
1860 };
1861
1866 H323_G711Capability(
1867 Mode mode = muLaw,
1868 Speed speed = At64k
1869 );
1871
1876 virtual PObject * Clone() const;
1878
1887 virtual unsigned GetSubType() const;
1888
1891 virtual PString GetFormatName() const;
1893
1894 protected:
1895 Mode mode;
1896 Speed speed;
1897 };
1898
1900
1903 class H323_UserInputCapability : public H323Capability
1904 {
1905 PCLASSINFO(H323_UserInputCapability, H323Capability);
1906
1907 public:
1910 enum SubTypes {
1911 BasicString,
1912 IA5String,
1913 GeneralString,
1914 SignalToneH245,
1915 HookFlashH245,
1916 SignalToneRFC2833,
1917 NumSubTypes
1918 };
1919 static const char * GetSubTypeName(SubTypes subType);
1920 friend ostream & operator<<(ostream & strm, SubTypes subType) { return strm << GetSubTypeName(subType); }
1921
1926 H323_UserInputCapability(
1927 SubTypes subType
1928 );
1930
1935 virtual PObject * Clone() const;
1937
1945 virtual MainTypes GetMainType() const;
1946
1950 virtual unsigned GetSubType() const;
1951
1954 virtual PString GetFormatName() const;
1956
1964 virtual H323Channel * CreateChannel(
1965 H323Connection & connection,
1966 H323Channel::Directions dir,
1967 unsigned sessionID,
1968 const H245_H2250LogicalChannelParameters * param
1970 ) const;
1972
1982 virtual PBoolean OnSendingPDU(
1983 H245_Capability & pdu
1984 ) const;
1985
1993 virtual PBoolean OnSendingPDU(
1994 H245_DataType & pdu
1995 ) const;
1996
2005 virtual PBoolean OnSendingPDU(
2006 H245_ModeElement & pdu
2007 ) const;
2008
2018 virtual PBoolean OnReceivedPDU(
2019 const H245_Capability & pdu
2020 );
2021
2029 virtual PBoolean OnReceivedPDU(
2030 const H245_DataType & pdu,
2031 PBoolean receiver
2032 );
2033
2042 virtual PBoolean IsUsable(
2043 const H323Connection & connection
2044 ) const;
2046
2047 static void AddAllCapabilities(
2048 H323Capabilities & capabilities,
2049 PINDEX descriptorNum,
2050 PINDEX simultaneous,
2051 bool includeRFC2833 = true
2052 );
2053
2054 protected:
2055 SubTypes subType;
2056 };
2057
2058
2059
2061
2062 PARRAY(H323CapabilitiesList, H323Capability);
2063
2064 PARRAY(H323CapabilitiesListArray, H323CapabilitiesList);
2065
2066 class H323SimultaneousCapabilities : public H323CapabilitiesListArray
2067 {
2068 PCLASSINFO(H323SimultaneousCapabilities, H323CapabilitiesListArray);
2069 public:
2070 PBoolean SetSize(PINDEX newSize);
2071 };
2072
2073
2074 PARRAY(H323CapabilitiesSetArray, H323SimultaneousCapabilities);
2075
2076
2077 class H323CapabilitiesSet : public H323CapabilitiesSetArray
2078 {
2079 PCLASSINFO(H323CapabilitiesSet, H323CapabilitiesSetArray);
2080 public:
2082 PBoolean SetSize(PINDEX newSize);
2083 };
2084
2085
2088 class H323Capabilities : public PObject
2089 {
2090 PCLASSINFO(H323Capabilities, PObject);
2091 public:
2096 H323Capabilities();
2097
2100 H323Capabilities(
2101 const H323Connection & connection,
2102 const H245_TerminalCapabilitySet & pdu
2103 );
2104
2109 H323Capabilities(
2110 const H323Capabilities & original
2111 );
2112
2117 H323Capabilities & operator=(
2118 const H323Capabilities & original
2119 );
2121
2126 void PrintOn(
2127 ostream & strm
2128 ) const;
2130
2135 PINDEX GetSize() const { return table.GetSize(); }
2136
2139 H323Capability & operator[](PINDEX i) const { return table[i]; }
2140
2161 PINDEX SetCapability(
2162 PINDEX descriptorNum,
2163 PINDEX simultaneous,
2164 H323Capability * cap
2165 );
2166
2169 PINDEX AddMediaFormat(
2170 PINDEX descriptorNum,
2171 PINDEX simultaneous,
2172 const OpalMediaFormat & mediaFormat
2173 );
2174
2179 PINDEX AddAllCapabilities(
2180 PINDEX descriptorNum,
2181 PINDEX simultaneous,
2182 const PString & name,
2183 PBoolean exact = false
2184 );
2185
2186 // this function is retained for backwards compatibility
2187 PINDEX AddAllCapabilities(
2188 const H323EndPoint &,
2189 PINDEX descriptorNum,
2190 PINDEX simultaneous,
2191 const PString & name,
2192 PBoolean exact = false
2193 )
2194 { return AddAllCapabilities(descriptorNum, simultaneous, name, exact); }
2195
2204 void Add(
2205 H323Capability * capability
2206 );
2207
2214 H323Capability * Copy(
2215 const H323Capability & capability
2216 );
2217
2222 void Remove(
2223 H323Capability * capability
2224 );
2225
2230 void Remove(
2231 const PString & formatName
2232 );
2233
2237 void Remove(
2238 const PStringArray & formatNames
2239 );
2240
2243 void RemoveAll();
2244
2252 H323Capability * FindCapability(
2253 unsigned capabilityNumber
2254 ) const;
2255
2271 H323Capability * FindCapability(
2272 const PString & formatName,
2273 H323Capability::CapabilityDirection direction = H323Capability::e_Unknown,
2275 PBoolean exact = false
2276 ) const;
2277
2283 H323Capability * FindCapability(
2284 H323Capability::CapabilityDirection direction
2285 ) const;
2286
2294 H323Capability * FindCapability(
2295 const H323Capability & capability
2296 ) const;
2297
2303 H323Capability * FindCapability(
2304 const H245_Capability & cap
2305 ) const;
2306
2312 H323Capability * FindCapability(
2313 const H245_DataType & dataType
2314 ) const;
2315
2321 H323Capability * FindCapability(
2322 const H245_ModeElement & modeElement
2323 ) const;
2324
2330 H323Capability * FindCapability(
2331 H323Capability::MainTypes mainType,
2332 unsigned subType = UINT_MAX
2333 ) const;
2334
2337 void BuildPDU(
2338 const H323Connection & connection,
2339 H245_TerminalCapabilitySet & pdu
2340 ) const;
2341
2344 PBoolean Merge(
2345 const H323Capabilities & newCaps
2346 );
2347
2354 void Reorder(
2355 const PStringArray & preferenceOrder
2356 );
2357
2360 PBoolean IsAllowed(
2361 const H323Capability & capability
2362 );
2363
2366 PBoolean IsAllowed(
2367 unsigned capabilityNumber
2368 );
2369
2372 PBoolean IsAllowed(
2373 const H323Capability & capability1,
2374 const H323Capability & capability2
2375 );
2376
2379 PBoolean IsAllowed(
2380 unsigned capabilityNumber1,
2381 unsigned capabilityNumber2
2382 );
2383
2386 OpalMediaFormatList GetMediaFormats() const;
2387
2388 const PStringSet & GetMediaPacketizations() const { return mediaPacketizations; }
2390
2391 protected:
2392 void SetMediaPacketizations(const PStringSet & packetizations) { mediaPacketizations = packetizations; }
2393
2394 H323CapabilitiesList table;
2395 H323CapabilitiesSet set;
2396 PStringSet mediaPacketizations;
2397 };
2398
2399
2401
2402 /* New capability registration macros based on abstract factories
2403 */
2404 typedef PFactory<H323Capability, std::string> H323CapabilityFactory;
2405
2406 #define H323_REGISTER_CAPABILITY(cls, capName) static H323CapabilityFactory::Worker<cls> cls##Factory(capName, true); \
2407
2408
2409 #endif // OPAL_H323
2410
2411 #endif // OPAL_H323_H323CAPS_H
2412
2413