OPAL Version 3.10.4

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

- File List
- Globals

h323pdu.h
Go to the documentation of this file.
1 /*
2 * h323pdu.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: 24880 $
30 * $Author: rjongbloed $
31 * $Date: 2010-11-18 01:23:46 -0600 (Thu, 18 Nov 2010) $
32 */
33
34 #ifndef OPAL_H323_H323PDU_H
35 #define OPAL_H323_H323PDU_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 <ptlib/sockets.h>
46 #include <h323/h323con.h>
47 #include <h323/transaddr.h>
48 #include <h323/q931.h>
49 #include <h323/h235auth.h>
50 #include <h323/h323trans.h>
51 #include <rtp/rtp.h>
52 #include <asn/h225.h>
53 #include <asn/h245.h>
54
55
56 class H323Connection;
57 class H323TransportAddress;
58 class H225_RAS;
59 class OpalGloballyUniqueID;
60
61
62 #define H225_PROTOCOL_VERSION 6
63 #define H245_PROTOCOL_VERSION 13
64
65
67
70 class H323SignalPDU : public H225_H323_UserInformation
71 {
72 PCLASSINFO(H323SignalPDU, H225_H323_UserInformation);
73
74 public:
79 H323SignalPDU();
80
83 H225_Setup_UUIE & BuildSetup(
84 const H323Connection & connection,
85 const H323TransportAddress & destAddr
86 );
87
90 H225_CallProceeding_UUIE & BuildCallProceeding(
91 const H323Connection & connection
92 );
93
96 H225_Connect_UUIE & BuildConnect(
97 const H323Connection & connection
98 );
99
102 H225_Connect_UUIE & BuildConnect(
103 const H323Connection & connection,
104 const PIPSocket::Address & h245Address,
105 WORD port
106 );
107
110 H225_Alerting_UUIE & BuildAlerting(
111 const H323Connection & connection
112 );
113
116 H225_Information_UUIE & BuildInformation(
117 const H323Connection & connection
118 );
119
122 H225_ReleaseComplete_UUIE & BuildReleaseComplete(
123 const H323Connection & connection
124 );
125
128 H225_Facility_UUIE * BuildFacility(
129 const H323Connection & connection,
130 bool empty,
131 unsigned reason = H225_FacilityReason::e_undefinedReason
132 );
133
136 H225_Progress_UUIE & BuildProgress(
137 const H323Connection & connection
138 );
139
142 H225_Status_UUIE & BuildStatus(
143 const H323Connection & connection
144 );
145
148 H225_StatusInquiry_UUIE & BuildStatusInquiry(
149 const H323Connection & connection
150 );
151
154 H225_SetupAcknowledge_UUIE & BuildSetupAcknowledge(
155 const H323Connection & connection
156 );
157
160 H225_Notify_UUIE & BuildNotify(
161 const H323Connection & connection
162 );
164
165
170 void PrintOn(
171 ostream & strm
172 ) const;
173
176 PBoolean Read(
177 H323Transport & transport
178 );
179
182 PBoolean Write(
183 H323Transport & transport
184 );
185
188 const Q931 & GetQ931() const { return q931pdu; }
189
192 Q931 & GetQ931() { return q931pdu; }
193
196 void SetQ931(const Q931 & _q931pdu) { q931pdu = _q931pdu; }
197
202 void BuildQ931();
203
208 PString GetSourceAliases(
209 const H323Transport * transport = NULL
210 ) const;
211
216 PString GetDestinationAlias(
217 PBoolean firstAliasOnly = false
218 ) const;
219
224 PBoolean GetSourceE164(
225 PString & number
226 ) const;
227
232 PBoolean GetDestinationE164(
233 PString & number
234 ) const;
235
239 unsigned GetDistinctiveRing() const;
240
245 void SetQ931Fields(
246 const H323Connection & connection,
247 bool insertPartyNumbers = false
248 );
249
250 #ifdef OPAL_H460
251
255 void InsertH460Setup(
256 const H323Connection & connection,
257 H225_Setup_UUIE & setup
258 );
259 #endif
260
261 protected:
262 // Even though we generally deal with the H323 protocol (H225) it is
263 // actually contained within a field of the Q931 protocol.
264 Q931 q931pdu;
265 };
266
267
269
272 class H323ControlPDU : public H245_MultimediaSystemControlMessage
273 {
274 PCLASSINFO(H323ControlPDU, H245_MultimediaSystemControlMessage);
275
276 public:
277 H245_RequestMessage & Build(H245_RequestMessage ::Choices request);
278 H245_ResponseMessage & Build(H245_ResponseMessage ::Choices response);
279 H245_CommandMessage & Build(H245_CommandMessage ::Choices command);
280 H245_IndicationMessage & Build(H245_IndicationMessage::Choices indication);
281
282 H245_MasterSlaveDetermination & BuildMasterSlaveDetermination(
283 unsigned terminalType,
284 unsigned statusDeterminationNumber
285 );
286 H245_MasterSlaveDeterminationAck & BuildMasterSlaveDeterminationAck(
287 PBoolean isMaster
288 );
289 H245_MasterSlaveDeterminationReject & BuildMasterSlaveDeterminationReject(
290 unsigned cause
291 );
292
293 H245_TerminalCapabilitySet & BuildTerminalCapabilitySet(
294 const H323Connection & connection,
295 unsigned sequenceNumber,
296 PBoolean empty
297 );
298 H245_TerminalCapabilitySetAck & BuildTerminalCapabilitySetAck(
299 unsigned sequenceNumber
300 );
301 H245_TerminalCapabilitySetReject & BuildTerminalCapabilitySetReject(
302 unsigned sequenceNumber,
303 unsigned cause
304 );
305
306 H245_OpenLogicalChannel & BuildOpenLogicalChannel(
307 unsigned forwardLogicalChannelNumber
308 );
309 H245_RequestChannelClose & BuildRequestChannelClose(
310 unsigned channelNumber,
311 unsigned reason
312 );
313 H245_CloseLogicalChannel & BuildCloseLogicalChannel(
314 unsigned channelNumber
315 );
316 H245_OpenLogicalChannelAck & BuildOpenLogicalChannelAck(
317 unsigned channelNumber
318 );
319 H245_OpenLogicalChannelReject & BuildOpenLogicalChannelReject(
320 unsigned channelNumber,
321 unsigned cause
322 );
323 H245_OpenLogicalChannelConfirm & BuildOpenLogicalChannelConfirm(
324 unsigned channelNumber
325 );
326 H245_CloseLogicalChannelAck & BuildCloseLogicalChannelAck(
327 unsigned channelNumber
328 );
329 H245_RequestChannelCloseAck & BuildRequestChannelCloseAck(
330 unsigned channelNumber
331 );
332 H245_RequestChannelCloseReject & BuildRequestChannelCloseReject(
333 unsigned channelNumber
334 );
335 H245_RequestChannelCloseRelease & BuildRequestChannelCloseRelease(
336 unsigned channelNumber
337 );
338
339 H245_RequestMode & BuildRequestMode(
340 unsigned sequenceNumber
341 );
342 H245_RequestModeAck & BuildRequestModeAck(
343 unsigned sequenceNumber,
344 unsigned response
345 );
346 H245_RequestModeReject & BuildRequestModeReject(
347 unsigned sequenceNumber,
348 unsigned cause
349 );
350
351 H245_RoundTripDelayRequest & BuildRoundTripDelayRequest(
352 unsigned sequenceNumber
353 );
354 H245_RoundTripDelayResponse & BuildRoundTripDelayResponse(
355 unsigned sequenceNumber
356 );
357
358 H245_UserInputIndication & BuildUserInputIndication(
359 const PString & value
360 );
361 H245_UserInputIndication & BuildUserInputIndication(
362 char tone,
363 unsigned duration,
364 unsigned logicalChannel,
365 unsigned rtpTimestamp
366 );
367
368 H245_MiscellaneousCommand & BuildMiscellaneousCommand(
369 unsigned channelNumber,
370 unsigned type
371 );
372
373 H245_FlowControlCommand & BuildFlowControlCommand(
374 unsigned channelNumber,
375 unsigned maxBitRate
376 );
377
378 H245_MiscellaneousIndication & BuildMiscellaneousIndication(
379 unsigned channelNumber,
380 unsigned type
381 );
382
383 H245_GenericMessage & BuildGenericRequest(
384 const PString & identifier,
385 unsigned subMsgId
386 );
387 H245_GenericMessage & BuildGenericResponse(
388 const PString & identifier,
389 unsigned subMsgId
390 );
391 H245_GenericMessage & BuildGenericCommand(
392 const PString & identifier,
393 unsigned subMsgId
394 );
395 H245_GenericMessage & BuildGenericIndication(
396 const PString & identifier,
397 unsigned subMsgId
398 );
399
400 H245_FunctionNotUnderstood & BuildFunctionNotUnderstood(
401 const H323ControlPDU & pdu
402 );
403
404 H245_EndSessionCommand & BuildEndSessionCommand(
405 unsigned reason
406 );
407 };
408
409
411
414 class H323RasPDU : public H225_RasMessage, public H323TransactionPDU
415 {
416 PCLASSINFO(H323RasPDU, H225_RasMessage);
417
418 public:
419 H323RasPDU();
420 H323RasPDU(
421 const H235Authenticators & authenticators
422 );
423
424 // overrides from PObject
425 virtual PObject * Clone() const;
426
427 // overrides from H323TransactionPDU
428 virtual PASN_Object & GetPDU();
429 virtual PASN_Choice & GetChoice();
430 virtual const PASN_Object & GetPDU() const;
431 virtual const PASN_Choice & GetChoice() const;
432 virtual unsigned GetSequenceNumber() const;
433 virtual unsigned GetRequestInProgressDelay() const;
434 #if PTRACING
435 virtual const char * GetProtocolName() const;
436 #endif
437 virtual H323TransactionPDU * ClonePDU() const;
438 virtual void DeletePDU();
439
440 // new functions
441 H225_GatekeeperRequest & BuildGatekeeperRequest(unsigned seqNum);
442 H225_GatekeeperConfirm & BuildGatekeeperConfirm(unsigned seqNum);
443 H225_GatekeeperReject & BuildGatekeeperReject(unsigned seqNum, unsigned reason = H225_GatekeeperRejectReason::e_undefinedReason);
444 H225_RegistrationRequest & BuildRegistrationRequest(unsigned seqNum);
445 H225_RegistrationConfirm & BuildRegistrationConfirm(unsigned seqNum);
446 H225_RegistrationReject & BuildRegistrationReject(unsigned seqNum, unsigned reason = H225_RegistrationRejectReason::e_undefinedReason);
447 H225_UnregistrationRequest & BuildUnregistrationRequest(unsigned seqNum);
448 H225_UnregistrationConfirm & BuildUnregistrationConfirm(unsigned seqNum);
449 H225_UnregistrationReject & BuildUnregistrationReject(unsigned seqNum, unsigned reason = H225_UnregRejectReason::e_undefinedReason);
450 H225_LocationRequest & BuildLocationRequest(unsigned seqNum);
451 H225_LocationConfirm & BuildLocationConfirm(unsigned seqNum);
452 H225_LocationReject & BuildLocationReject(unsigned seqNum, unsigned reason = H225_LocationRejectReason::e_undefinedReason);
453 H225_AdmissionRequest & BuildAdmissionRequest(unsigned seqNum);
454 H225_AdmissionConfirm & BuildAdmissionConfirm(unsigned seqNum);
455 H225_AdmissionReject & BuildAdmissionReject(unsigned seqNum, unsigned reason = H225_AdmissionRejectReason::e_undefinedReason);
456 H225_DisengageRequest & BuildDisengageRequest(unsigned seqNum);
457 H225_DisengageConfirm & BuildDisengageConfirm(unsigned seqNum);
458 H225_DisengageReject & BuildDisengageReject(unsigned seqNum, unsigned reason = H225_DisengageRejectReason::e_securityDenial);
459 H225_BandwidthRequest & BuildBandwidthRequest(unsigned seqNum);
460 H225_BandwidthConfirm & BuildBandwidthConfirm(unsigned seqNum, unsigned bandwidth = 0);
461 H225_BandwidthReject & BuildBandwidthReject(unsigned seqNum, unsigned reason = H225_BandRejectReason::e_undefinedReason);
462 H225_InfoRequest & BuildInfoRequest(unsigned seqNum, unsigned callRef = 0, const OpalGloballyUniqueID * id = NULL);
463 H225_InfoRequestResponse & BuildInfoRequestResponse(unsigned seqNum);
464 H225_InfoRequestAck & BuildInfoRequestAck(unsigned seqNum);
465 H225_InfoRequestNak & BuildInfoRequestNak(unsigned seqNum, unsigned reason = H225_InfoRequestNakReason::e_undefinedReason);
466 H225_ServiceControlIndication& BuildServiceControlIndication(unsigned seqNum, const OpalGloballyUniqueID * id = NULL);
467 H225_ServiceControlResponse & BuildServiceControlResponse(unsigned seqNum);
468 H225_UnknownMessageResponse & BuildUnknownMessageResponse(unsigned seqNum);
469 H225_RequestInProgress & BuildRequestInProgress(unsigned seqNum, unsigned delay);
470 };
471
472
474
475 void H323SetAliasAddresses(const H323TransportAddressArray & addresses, H225_ArrayOf_AliasAddress & aliases);
476 void H323SetAliasAddresses(const PStringArray & names, H225_ArrayOf_AliasAddress & aliases, int tag = -1);
477 void H323SetAliasAddresses(const PStringList & names, H225_ArrayOf_AliasAddress & aliases, int tag = -1);
478 void H323SetAliasAddress(const H323TransportAddress & address, H225_AliasAddress & alias);
479 void H323SetAliasAddress(const PString & name, H225_AliasAddress & alias, int tag = -1);
480 PStringArray H323GetAliasAddressStrings(const H225_ArrayOf_AliasAddress & aliases);
481 PString H323GetAliasAddressString(const H225_AliasAddress & alias);
482 PString H323GetAliasAddressE164(const H225_AliasAddress & alias);
483 PString H323GetAliasAddressE164(const H225_ArrayOf_AliasAddress & aliases);
484
485 H323Connection::CallEndReason H323TranslateToCallEndReason(
486 Q931::CauseValues cause,
487 unsigned reason
488 );
489 Q931::CauseValues H323TranslateFromCallEndReason(
490 H323Connection::CallEndReason callEndReason,
491 H225_ReleaseCompleteReason & releaseCompleteReason
492 );
493
494 void H323GetApplicationInfo(OpalProductInfo & info, const H225_VendorIdentifier & vendor);
495
496 void H323SetRTPPacketization(
497 H245_ArrayOf_RTPPayloadType & rtpPacketizations,
498 PINDEX & packetizationsCount,
499 const OpalMediaFormat & mediaFormat,
500 RTP_DataFrame::PayloadTypes payloadType
501 );
502 bool H323SetRTPPacketization(
503 H245_RTPPayloadType & rtpPacketization,
504 const OpalMediaFormat & mediaFormat,
505 RTP_DataFrame::PayloadTypes payloadType
506 );
507 bool H323SetRTPPacketization(
508 H245_RTPPayloadType & rtpPacketization,
509 const PString & mediaPacketizationString,
510 const OpalMediaFormat & mediaFormat,
511 RTP_DataFrame::PayloadTypes payloadType
512 );
513 PString H323GetRTPPacketization(
514 const H245_RTPPayloadType & rtpPacketization
515 );
516
517 PString H323GetCapabilityIdentifier(
518 const H245_CapabilityIdentifier & capId
519 );
520 bool H323SetCapabilityIdentifier(
521 const PString & str,
522 H245_CapabilityIdentifier & capId
523 );
524
525 const H245_ParameterValue * H323GetGenericParameter(
526 const H245_ArrayOf_GenericParameter & params,
527 unsigned ordinal
528 );
529 bool H323GetGenericParameterBoolean(
530 const H245_ArrayOf_GenericParameter & params,
531 unsigned ordinal
532 );
533 unsigned H323GetGenericParameterInteger(
534 const H245_ArrayOf_GenericParameter & params,
535 unsigned ordinal,
536 unsigned defValue = 0,
537 H245_ParameterValue::Choices subType = H245_ParameterValue::e_unsignedMin
538 );
539 H245_ParameterValue * H323AddGenericParameter(
540 H245_ArrayOf_GenericParameter & params,
541 unsigned ordinal,
542 bool reorder = true
543 );
544 void H323AddGenericParameterBoolean(
545 H245_ArrayOf_GenericParameter & params,
546 unsigned ordinal,
547 bool value = true,
548 bool reorder = true
549 );
550 void H323AddGenericParameterInteger(
551 H245_ArrayOf_GenericParameter & params,
552 unsigned ordinal,
553 unsigned value,
554 H245_ParameterValue::Choices subType = H245_ParameterValue::e_unsignedMin,
555 bool reorder = true
556 );
557 void H323AddGenericParameterString(
558 H245_ArrayOf_GenericParameter & params,
559 unsigned ordinal,
560 const PString & value,
561 bool reorder = true
562 );
563 void H323AddGenericParameterOctets(
564 H245_ArrayOf_GenericParameter & params,
565 unsigned ordinal,
566 const PBYTEArray & value,
567 bool reorder = true
568 );
569
570 #if PTRACING
571 void H323TraceDumpPDU(
572 const char * proto,
573 PBoolean writing,
574 const PBYTEArray & rawData,
575 const PASN_Object & pdu,
576 const PASN_Choice & tag1,
577 unsigned seqNum
578 );
579 #else
580 #define H323TraceDumpPDU(proto, writing, rawData, pdu, tag1, seqNum)
581 #endif
582
583
584 #endif // OPAL_H323
585
586 #endif // OPAL_H323_H323PDU_H
587
588