h323pdu.h

Go to the documentation of this file.
00001 /*
00002  * h323pdu.h
00003  *
00004  * H.323 protocol handler
00005  *
00006  * Open H323 Library
00007  *
00008  * Copyright (c) 1998-2001 Equivalence Pty. Ltd.
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Open H323 Library.
00021  *
00022  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00023  *
00024  * Portions of this code were written with the assisance of funding from
00025  * Vovida Networks, Inc. http://www.vovida.com.
00026  *
00027  * Contributor(s): ______________________________________.
00028  *
00029  * $Revision: 21004 $
00030  * $Author: rjongbloed $
00031  * $Date: 2008-09-16 07:08:56 +0000 (Tue, 16 Sep 2008) $
00032  */
00033 
00034 #ifndef __OPAL_H323PDU_H
00035 #define __OPAL_H323PDU_H
00036 
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040 
00041 #include <opal/buildopts.h>
00042 
00043 #include <ptlib/sockets.h>
00044 #include <h323/h323con.h>
00045 #include <h323/transaddr.h>
00046 #include <h323/q931.h>
00047 #include <h323/h235auth.h>
00048 #include <h323/h323trans.h>
00049 #include <rtp/rtp.h>
00050 #include <asn/h225.h>
00051 #include <asn/h245.h>
00052 
00053 
00054 class H323Connection;
00055 class H323TransportAddress;
00056 class H225_RAS;
00057 class OpalGloballyUniqueID;
00058 
00059 
00060 #define H225_PROTOCOL_VERSION 6
00061 #define H245_PROTOCOL_VERSION 13
00062 
00063 
00065 
00068 class H323SignalPDU : public H225_H323_UserInformation
00069 {
00070   PCLASSINFO(H323SignalPDU, H225_H323_UserInformation);
00071 
00072   public:
00077     H323SignalPDU();
00078 
00081     H225_Setup_UUIE & BuildSetup(
00082       const H323Connection & connection,    
00083       const H323TransportAddress & destAddr 
00084     );
00085 
00088     H225_CallProceeding_UUIE & BuildCallProceeding(
00089       const H323Connection & connection    
00090     );
00091 
00094     H225_Connect_UUIE & BuildConnect(
00095       const H323Connection & connection    
00096     );
00097 
00100     H225_Connect_UUIE & BuildConnect(
00101       const H323Connection & connection,    
00102       const PIPSocket::Address & h245Address, 
00103       WORD port                               
00104     );
00105 
00108     H225_Alerting_UUIE & BuildAlerting(
00109       const H323Connection & connection    
00110     );
00111 
00114     H225_Information_UUIE & BuildInformation(
00115       const H323Connection & connection    
00116     );
00117 
00120     H225_ReleaseComplete_UUIE & BuildReleaseComplete(
00121       const H323Connection & connection    
00122     );
00123 
00126     H225_Facility_UUIE * BuildFacility(
00127       const H323Connection & connection,  
00128       bool empty,                         
00129       unsigned reason = H225_FacilityReason::e_undefinedReason 
00130     );
00131 
00134     H225_Progress_UUIE & BuildProgress(
00135       const H323Connection & connection    
00136     );
00137 
00140     H225_Status_UUIE & BuildStatus(
00141       const H323Connection & connection    
00142     );
00143 
00146     H225_StatusInquiry_UUIE & BuildStatusInquiry(
00147       const H323Connection & connection    
00148     );
00149 
00152     H225_SetupAcknowledge_UUIE & BuildSetupAcknowledge(
00153       const H323Connection & connection    
00154     );
00155 
00158     H225_Notify_UUIE & BuildNotify(
00159       const H323Connection & connection    
00160     );
00162 
00163 
00168     void PrintOn(
00169       ostream & strm
00170     ) const;
00171 
00174     PBoolean Read(
00175       H323Transport & transport   
00176     );
00177 
00180     PBoolean Write(
00181       H323Transport & transport   
00182     );
00183 
00186     const Q931 & GetQ931() const { return q931pdu; }
00187 
00190     Q931 & GetQ931() { return q931pdu; }
00191 
00194     void SetQ931(const Q931 & _q931pdu) { q931pdu = _q931pdu; }
00195 
00200     void BuildQ931();
00201 
00206     PString GetSourceAliases(
00207       const H323Transport * transport = NULL  
00208     ) const;
00209 
00214     PString GetDestinationAlias(
00215       PBoolean firstAliasOnly = PFalse   
00216     ) const;
00217 
00222     PBoolean GetSourceE164(
00223       PString & number    
00224     ) const;
00225 
00230     PBoolean GetDestinationE164(
00231       PString & number    
00232     ) const;
00233 
00237     unsigned GetDistinctiveRing() const;
00238 
00243     void SetQ931Fields(
00244       const H323Connection & connection,
00245       PBoolean insertPartyNumbers = PFalse,
00246       unsigned plan = 1,
00247       unsigned type = 0,
00248       int presentation = -1,
00249       int screening = -1
00250     );
00251 
00252 #ifdef H323_H460
00253 
00257     void InsertH460Setup(
00258       const H323Connection & connection,
00259       H225_Setup_UUIE & setup
00260     );
00261 #endif
00262 
00263   protected:
00264     // Even though we generally deal with the H323 protocol (H225) it is
00265     // actually contained within a field of the Q931 protocol.
00266     Q931 q931pdu;
00267 };
00268 
00269 
00271 
00274 class H323ControlPDU : public H245_MultimediaSystemControlMessage
00275 {
00276   PCLASSINFO(H323ControlPDU, H245_MultimediaSystemControlMessage);
00277 
00278   public:
00279     H245_RequestMessage    & Build(H245_RequestMessage   ::Choices request);
00280     H245_ResponseMessage   & Build(H245_ResponseMessage  ::Choices response);
00281     H245_CommandMessage    & Build(H245_CommandMessage   ::Choices command);
00282     H245_IndicationMessage & Build(H245_IndicationMessage::Choices indication);
00283 
00284     H245_MasterSlaveDetermination & BuildMasterSlaveDetermination(
00285       unsigned terminalType,
00286       unsigned statusDeterminationNumber
00287     );
00288     H245_MasterSlaveDeterminationAck & BuildMasterSlaveDeterminationAck(
00289       PBoolean isMaster
00290     );
00291     H245_MasterSlaveDeterminationReject & BuildMasterSlaveDeterminationReject(
00292       unsigned cause
00293     );
00294 
00295     H245_TerminalCapabilitySet & BuildTerminalCapabilitySet(
00296       const H323Connection & connection,
00297       unsigned sequenceNumber,
00298       PBoolean empty
00299     );
00300     H245_TerminalCapabilitySetAck & BuildTerminalCapabilitySetAck(
00301       unsigned sequenceNumber
00302     );
00303     H245_TerminalCapabilitySetReject & BuildTerminalCapabilitySetReject(
00304       unsigned sequenceNumber,
00305       unsigned cause
00306     );
00307 
00308     H245_OpenLogicalChannel & BuildOpenLogicalChannel(
00309       unsigned forwardLogicalChannelNumber
00310     );
00311     H245_RequestChannelClose & BuildRequestChannelClose(
00312       unsigned channelNumber,
00313       unsigned reason
00314     );
00315     H245_CloseLogicalChannel & BuildCloseLogicalChannel(
00316       unsigned channelNumber
00317     );
00318     H245_OpenLogicalChannelAck & BuildOpenLogicalChannelAck(
00319       unsigned channelNumber
00320     );
00321     H245_OpenLogicalChannelReject & BuildOpenLogicalChannelReject(
00322       unsigned channelNumber,
00323       unsigned cause
00324     );
00325     H245_OpenLogicalChannelConfirm & BuildOpenLogicalChannelConfirm(
00326       unsigned channelNumber
00327     );
00328     H245_CloseLogicalChannelAck & BuildCloseLogicalChannelAck(
00329       unsigned channelNumber
00330     );
00331     H245_RequestChannelCloseAck & BuildRequestChannelCloseAck(
00332       unsigned channelNumber
00333     );
00334     H245_RequestChannelCloseReject & BuildRequestChannelCloseReject(
00335       unsigned channelNumber
00336     );
00337     H245_RequestChannelCloseRelease & BuildRequestChannelCloseRelease(
00338       unsigned channelNumber
00339     );
00340 
00341     H245_RequestMode & BuildRequestMode(
00342       unsigned sequenceNumber
00343     );
00344     H245_RequestModeAck & BuildRequestModeAck(
00345       unsigned sequenceNumber,
00346       unsigned response
00347     );
00348     H245_RequestModeReject & BuildRequestModeReject(
00349       unsigned sequenceNumber,
00350       unsigned cause
00351     );
00352 
00353     H245_RoundTripDelayRequest & BuildRoundTripDelayRequest(
00354       unsigned sequenceNumber
00355     );
00356     H245_RoundTripDelayResponse & BuildRoundTripDelayResponse(
00357       unsigned sequenceNumber
00358     );
00359 
00360     H245_UserInputIndication & BuildUserInputIndication(
00361       const PString & value
00362     );
00363     H245_UserInputIndication & BuildUserInputIndication(
00364       char tone,               
00365       unsigned duration,       
00366       unsigned logicalChannel, 
00367       unsigned rtpTimestamp    
00368     );
00369 
00370     H245_MiscellaneousCommand & BuildMiscellaneousCommand(
00371       unsigned channelNumber,
00372       unsigned type
00373     );
00374     
00375     H245_FlowControlCommand & BuildFlowControlCommand(
00376       unsigned channelNumber, 
00377       unsigned maxBitRate
00378     );
00379 
00380     H245_MiscellaneousIndication & BuildMiscellaneousIndication(
00381       unsigned channelNumber,
00382       unsigned type
00383     );
00384 
00385     H245_FunctionNotUnderstood & BuildFunctionNotUnderstood(
00386       const H323ControlPDU & pdu
00387     );
00388 
00389     H245_EndSessionCommand & BuildEndSessionCommand(
00390       unsigned reason
00391     );
00392 };
00393 
00394 
00396 
00399 class H323RasPDU : public H225_RasMessage, public H323TransactionPDU
00400 {
00401   PCLASSINFO(H323RasPDU, H225_RasMessage);
00402 
00403   public:
00404     H323RasPDU();
00405     H323RasPDU(
00406       const H235Authenticators & authenticators
00407     );
00408 
00409     // overrides from PObject
00410     virtual PObject * Clone() const;
00411 
00412     // overrides from H323TransactionPDU
00413     virtual PASN_Object & GetPDU();
00414     virtual PASN_Choice & GetChoice();
00415     virtual const PASN_Object & GetPDU() const;
00416     virtual const PASN_Choice & GetChoice() const;
00417     virtual unsigned GetSequenceNumber() const;
00418     virtual unsigned GetRequestInProgressDelay() const;
00419 #if PTRACING
00420     virtual const char * GetProtocolName() const;
00421 #endif
00422     virtual H323TransactionPDU * ClonePDU() const;
00423     virtual void DeletePDU();
00424 
00425     // new functions
00426     H225_GatekeeperRequest       & BuildGatekeeperRequest(unsigned seqNum);
00427     H225_GatekeeperConfirm       & BuildGatekeeperConfirm(unsigned seqNum);
00428     H225_GatekeeperReject        & BuildGatekeeperReject(unsigned seqNum, unsigned reason = H225_GatekeeperRejectReason::e_undefinedReason);
00429     H225_RegistrationRequest     & BuildRegistrationRequest(unsigned seqNum);
00430     H225_RegistrationConfirm     & BuildRegistrationConfirm(unsigned seqNum);
00431     H225_RegistrationReject      & BuildRegistrationReject(unsigned seqNum, unsigned reason = H225_RegistrationRejectReason::e_undefinedReason);
00432     H225_UnregistrationRequest   & BuildUnregistrationRequest(unsigned seqNum);
00433     H225_UnregistrationConfirm   & BuildUnregistrationConfirm(unsigned seqNum);
00434     H225_UnregistrationReject    & BuildUnregistrationReject(unsigned seqNum, unsigned reason = H225_UnregRejectReason::e_undefinedReason);
00435     H225_LocationRequest         & BuildLocationRequest(unsigned seqNum);
00436     H225_LocationConfirm         & BuildLocationConfirm(unsigned seqNum);
00437     H225_LocationReject          & BuildLocationReject(unsigned seqNum, unsigned reason = H225_LocationRejectReason::e_undefinedReason);
00438     H225_AdmissionRequest        & BuildAdmissionRequest(unsigned seqNum);
00439     H225_AdmissionConfirm        & BuildAdmissionConfirm(unsigned seqNum);
00440     H225_AdmissionReject         & BuildAdmissionReject(unsigned seqNum, unsigned reason = H225_AdmissionRejectReason::e_undefinedReason);
00441     H225_DisengageRequest        & BuildDisengageRequest(unsigned seqNum);
00442     H225_DisengageConfirm        & BuildDisengageConfirm(unsigned seqNum);
00443     H225_DisengageReject         & BuildDisengageReject(unsigned seqNum, unsigned reason = H225_DisengageRejectReason::e_securityDenial);
00444     H225_BandwidthRequest        & BuildBandwidthRequest(unsigned seqNum);
00445     H225_BandwidthConfirm        & BuildBandwidthConfirm(unsigned seqNum, unsigned bandwidth = 0);
00446     H225_BandwidthReject         & BuildBandwidthReject(unsigned seqNum, unsigned reason = H225_BandRejectReason::e_undefinedReason);
00447     H225_InfoRequest             & BuildInfoRequest(unsigned seqNum, unsigned callRef = 0, const OpalGloballyUniqueID * id = NULL);
00448     H225_InfoRequestResponse     & BuildInfoRequestResponse(unsigned seqNum);
00449     H225_InfoRequestAck          & BuildInfoRequestAck(unsigned seqNum);
00450     H225_InfoRequestNak          & BuildInfoRequestNak(unsigned seqNum, unsigned reason = H225_InfoRequestNakReason::e_undefinedReason);
00451     H225_ServiceControlIndication& BuildServiceControlIndication(unsigned seqNum, const OpalGloballyUniqueID * id = NULL);
00452     H225_ServiceControlResponse  & BuildServiceControlResponse(unsigned seqNum);
00453     H225_UnknownMessageResponse  & BuildUnknownMessageResponse(unsigned seqNum);
00454     H225_RequestInProgress       & BuildRequestInProgress(unsigned seqNum, unsigned delay);
00455 };
00456 
00457 
00459 
00460 void H323SetAliasAddresses(const H323TransportAddressArray & addresses, H225_ArrayOf_AliasAddress & aliases);
00461 void H323SetAliasAddresses(const PStringArray & names, H225_ArrayOf_AliasAddress & aliases, int tag = -1);
00462 void H323SetAliasAddresses(const PStringList & names, H225_ArrayOf_AliasAddress & aliases, int tag = -1);
00463 void H323SetAliasAddress(const H323TransportAddress & address, H225_AliasAddress & alias);
00464 void H323SetAliasAddress(const PString & name, H225_AliasAddress & alias, int tag = -1);
00465 PStringArray H323GetAliasAddressStrings(const H225_ArrayOf_AliasAddress & aliases);
00466 PString H323GetAliasAddressString(const H225_AliasAddress & alias);
00467 PString H323GetAliasAddressE164(const H225_AliasAddress & alias);
00468 PString H323GetAliasAddressE164(const H225_ArrayOf_AliasAddress & aliases);
00469 
00470 H323Connection::CallEndReason H323TranslateToCallEndReason(
00471   Q931::CauseValues cause,
00472   const H225_ReleaseCompleteReason & reason
00473 );
00474 Q931::CauseValues H323TranslateFromCallEndReason(
00475   const H323Connection & connection,
00476   H225_ReleaseCompleteReason & rcReason
00477 );
00478 
00479 void H323GetApplicationInfo(OpalProductInfo & info, const H225_VendorIdentifier & vendor);
00480 
00481 bool H323SetRTPPacketization(
00482   H245_RTPPayloadType & rtpPacketization,
00483   const OpalMediaFormat & mediaFormat,
00484   RTP_DataFrame::PayloadTypes payloadType
00485 );
00486 PString H323GetRTPPacketization(
00487   const H245_RTPPayloadType & rtpPacketization
00488 );
00489 bool H323GetRTPPacketization(
00490   OpalMediaFormat & mediaFormat,
00491   const H245_RTPPayloadType & rtpPacketization
00492 );
00493 
00494 #if PTRACING
00495 void H323TraceDumpPDU(
00496   const char * proto,
00497   PBoolean writing,
00498   const PBYTEArray & rawData,
00499   const PASN_Object & pdu,
00500   const PASN_Choice & tag1,
00501   unsigned seqNum
00502 );
00503 #else
00504 #define H323TraceDumpPDU(proto, writing, rawData, pdu, tag1, seqNum)
00505 #endif
00506 
00507 
00508 #endif // __OPAL_H323PDU_H
00509 
00510 

Generated on Mon Sep 22 12:24:44 2008 for OPAL by  doxygen 1.5.1