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: 19522 $
00030  * $Author: rjongbloed $
00031  * $Date: 2008-02-15 11:37:24 +0000 (Fri, 15 Feb 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 
00042 #include <ptlib/sockets.h>
00043 #include <h323/h323con.h>
00044 #include <h323/transaddr.h>
00045 #include <h323/q931.h>
00046 #include <h323/h235auth.h>
00047 #include <h323/h323trans.h>
00048 #include <rtp/rtp.h>
00049 #include <asn/h225.h>
00050 #include <asn/h245.h>
00051 
00052 
00053 class H323Connection;
00054 class H323TransportAddress;
00055 class H225_RAS;
00056 class OpalGloballyUniqueID;
00057 
00058 
00059 #define H225_PROTOCOL_VERSION 6
00060 #define H245_PROTOCOL_VERSION 13
00061 
00062 
00064 
00067 class H323SignalPDU : public H225_H323_UserInformation
00068 {
00069   PCLASSINFO(H323SignalPDU, H225_H323_UserInformation);
00070 
00071   public:
00076     H323SignalPDU();
00077 
00080     H225_Setup_UUIE & BuildSetup(
00081       const H323Connection & connection,    
00082       const H323TransportAddress & destAddr 
00083     );
00084 
00087     H225_CallProceeding_UUIE & BuildCallProceeding(
00088       const H323Connection & connection    
00089     );
00090 
00093     H225_Connect_UUIE & BuildConnect(
00094       const H323Connection & connection    
00095     );
00096 
00099     H225_Connect_UUIE & BuildConnect(
00100       const H323Connection & connection,    
00101       const PIPSocket::Address & h245Address, 
00102       WORD port                               
00103     );
00104 
00107     H225_Alerting_UUIE & BuildAlerting(
00108       const H323Connection & connection    
00109     );
00110 
00113     H225_Information_UUIE & BuildInformation(
00114       const H323Connection & connection    
00115     );
00116 
00119     H225_ReleaseComplete_UUIE & BuildReleaseComplete(
00120       const H323Connection & connection    
00121     );
00122 
00125     H225_Facility_UUIE * BuildFacility(
00126       const H323Connection & connection,  
00127       PBoolean empty                          
00128     );
00129 
00132     H225_Progress_UUIE & BuildProgress(
00133       const H323Connection & connection    
00134     );
00135 
00138     H225_Status_UUIE & BuildStatus(
00139       const H323Connection & connection    
00140     );
00141 
00144     H225_StatusInquiry_UUIE & BuildStatusInquiry(
00145       const H323Connection & connection    
00146     );
00147 
00150     H225_SetupAcknowledge_UUIE & BuildSetupAcknowledge(
00151       const H323Connection & connection    
00152     );
00153 
00156     H225_Notify_UUIE & BuildNotify(
00157       const H323Connection & connection    
00158     );
00160 
00161 
00166     void PrintOn(
00167       ostream & strm
00168     ) const;
00169 
00172     PBoolean Read(
00173       H323Transport & transport   
00174     );
00175 
00178     PBoolean Write(
00179       H323Transport & transport   
00180     );
00181 
00184     const Q931 & GetQ931() const { return q931pdu; }
00185 
00188     Q931 & GetQ931() { return q931pdu; }
00189 
00192     void SetQ931(const Q931 & _q931pdu) { q931pdu = _q931pdu; }
00193 
00198     void BuildQ931();
00199 
00204     PString GetSourceAliases(
00205       const H323Transport * transport = NULL  
00206     ) const;
00207 
00212     PString GetDestinationAlias(
00213       PBoolean firstAliasOnly = PFalse   
00214     ) const;
00215 
00220     PBoolean GetSourceE164(
00221       PString & number    
00222     ) const;
00223 
00228     PBoolean GetDestinationE164(
00229       PString & number    
00230     ) const;
00231 
00235     unsigned GetDistinctiveRing() const;
00236 
00241     void SetQ931Fields(
00242       const H323Connection & connection,
00243       PBoolean insertPartyNumbers = PFalse,
00244       unsigned plan = 1,
00245       unsigned type = 0,
00246       int presentation = -1,
00247       int screening = -1
00248     );
00249 
00250   protected:
00251     // Even though we generally deal with the H323 protocol (H225) it is
00252     // actually contained within a field of the Q931 protocol.
00253     Q931 q931pdu;
00254 };
00255 
00256 
00258 
00261 class H323ControlPDU : public H245_MultimediaSystemControlMessage
00262 {
00263   PCLASSINFO(H323ControlPDU, H245_MultimediaSystemControlMessage);
00264 
00265   public:
00266     H245_RequestMessage    & Build(H245_RequestMessage   ::Choices request);
00267     H245_ResponseMessage   & Build(H245_ResponseMessage  ::Choices response);
00268     H245_CommandMessage    & Build(H245_CommandMessage   ::Choices command);
00269     H245_IndicationMessage & Build(H245_IndicationMessage::Choices indication);
00270 
00271     H245_MasterSlaveDetermination & BuildMasterSlaveDetermination(
00272       unsigned terminalType,
00273       unsigned statusDeterminationNumber
00274     );
00275     H245_MasterSlaveDeterminationAck & BuildMasterSlaveDeterminationAck(
00276       PBoolean isMaster
00277     );
00278     H245_MasterSlaveDeterminationReject & BuildMasterSlaveDeterminationReject(
00279       unsigned cause
00280     );
00281 
00282     H245_TerminalCapabilitySet & BuildTerminalCapabilitySet(
00283       const H323Connection & connection,
00284       unsigned sequenceNumber,
00285       PBoolean empty
00286     );
00287     H245_TerminalCapabilitySetAck & BuildTerminalCapabilitySetAck(
00288       unsigned sequenceNumber
00289     );
00290     H245_TerminalCapabilitySetReject & BuildTerminalCapabilitySetReject(
00291       unsigned sequenceNumber,
00292       unsigned cause
00293     );
00294 
00295     H245_OpenLogicalChannel & BuildOpenLogicalChannel(
00296       unsigned forwardLogicalChannelNumber
00297     );
00298     H245_RequestChannelClose & BuildRequestChannelClose(
00299       unsigned channelNumber,
00300       unsigned reason
00301     );
00302     H245_CloseLogicalChannel & BuildCloseLogicalChannel(
00303       unsigned channelNumber
00304     );
00305     H245_OpenLogicalChannelAck & BuildOpenLogicalChannelAck(
00306       unsigned channelNumber
00307     );
00308     H245_OpenLogicalChannelReject & BuildOpenLogicalChannelReject(
00309       unsigned channelNumber,
00310       unsigned cause
00311     );
00312     H245_OpenLogicalChannelConfirm & BuildOpenLogicalChannelConfirm(
00313       unsigned channelNumber
00314     );
00315     H245_CloseLogicalChannelAck & BuildCloseLogicalChannelAck(
00316       unsigned channelNumber
00317     );
00318     H245_RequestChannelCloseAck & BuildRequestChannelCloseAck(
00319       unsigned channelNumber
00320     );
00321     H245_RequestChannelCloseReject & BuildRequestChannelCloseReject(
00322       unsigned channelNumber
00323     );
00324     H245_RequestChannelCloseRelease & BuildRequestChannelCloseRelease(
00325       unsigned channelNumber
00326     );
00327 
00328     H245_RequestMode & BuildRequestMode(
00329       unsigned sequenceNumber
00330     );
00331     H245_RequestModeAck & BuildRequestModeAck(
00332       unsigned sequenceNumber,
00333       unsigned response
00334     );
00335     H245_RequestModeReject & BuildRequestModeReject(
00336       unsigned sequenceNumber,
00337       unsigned cause
00338     );
00339 
00340     H245_RoundTripDelayRequest & BuildRoundTripDelayRequest(
00341       unsigned sequenceNumber
00342     );
00343     H245_RoundTripDelayResponse & BuildRoundTripDelayResponse(
00344       unsigned sequenceNumber
00345     );
00346 
00347     H245_UserInputIndication & BuildUserInputIndication(
00348       const PString & value
00349     );
00350     H245_UserInputIndication & BuildUserInputIndication(
00351       char tone,               
00352       unsigned duration,       
00353       unsigned logicalChannel, 
00354       unsigned rtpTimestamp    
00355     );
00356 
00357     H245_MiscellaneousCommand & BuildMiscellaneousCommand(
00358       unsigned channelNumber,
00359       unsigned type
00360     );
00361     
00362     H245_FlowControlCommand & BuildFlowControlCommand(
00363       unsigned channelNumber, 
00364       unsigned maxBitRate
00365     );
00366 
00367     H245_MiscellaneousIndication & BuildMiscellaneousIndication(
00368       unsigned channelNumber,
00369       unsigned type
00370     );
00371 
00372     H245_FunctionNotUnderstood & BuildFunctionNotUnderstood(
00373       const H323ControlPDU & pdu
00374     );
00375 
00376     H245_EndSessionCommand & BuildEndSessionCommand(
00377       unsigned reason
00378     );
00379 };
00380 
00381 
00383 
00386 class H323RasPDU : public H225_RasMessage, public H323TransactionPDU
00387 {
00388   PCLASSINFO(H323RasPDU, H225_RasMessage);
00389 
00390   public:
00391     H323RasPDU();
00392     H323RasPDU(
00393       const H235Authenticators & authenticators
00394     );
00395 
00396     // overrides from PObject
00397     virtual PObject * Clone() const;
00398 
00399     // overrides from H323TransactionPDU
00400     virtual PASN_Object & GetPDU();
00401     virtual PASN_Choice & GetChoice();
00402     virtual const PASN_Object & GetPDU() const;
00403     virtual const PASN_Choice & GetChoice() const;
00404     virtual unsigned GetSequenceNumber() const;
00405     virtual unsigned GetRequestInProgressDelay() const;
00406 #if PTRACING
00407     virtual const char * GetProtocolName() const;
00408 #endif
00409     virtual H323TransactionPDU * ClonePDU() const;
00410     virtual void DeletePDU();
00411 
00412     // new functions
00413     H225_GatekeeperRequest       & BuildGatekeeperRequest(unsigned seqNum);
00414     H225_GatekeeperConfirm       & BuildGatekeeperConfirm(unsigned seqNum);
00415     H225_GatekeeperReject        & BuildGatekeeperReject(unsigned seqNum, unsigned reason = H225_GatekeeperRejectReason::e_undefinedReason);
00416     H225_RegistrationRequest     & BuildRegistrationRequest(unsigned seqNum);
00417     H225_RegistrationConfirm     & BuildRegistrationConfirm(unsigned seqNum);
00418     H225_RegistrationReject      & BuildRegistrationReject(unsigned seqNum, unsigned reason = H225_RegistrationRejectReason::e_undefinedReason);
00419     H225_UnregistrationRequest   & BuildUnregistrationRequest(unsigned seqNum);
00420     H225_UnregistrationConfirm   & BuildUnregistrationConfirm(unsigned seqNum);
00421     H225_UnregistrationReject    & BuildUnregistrationReject(unsigned seqNum, unsigned reason = H225_UnregRejectReason::e_undefinedReason);
00422     H225_LocationRequest         & BuildLocationRequest(unsigned seqNum);
00423     H225_LocationConfirm         & BuildLocationConfirm(unsigned seqNum);
00424     H225_LocationReject          & BuildLocationReject(unsigned seqNum, unsigned reason = H225_LocationRejectReason::e_undefinedReason);
00425     H225_AdmissionRequest        & BuildAdmissionRequest(unsigned seqNum);
00426     H225_AdmissionConfirm        & BuildAdmissionConfirm(unsigned seqNum);
00427     H225_AdmissionReject         & BuildAdmissionReject(unsigned seqNum, unsigned reason = H225_AdmissionRejectReason::e_undefinedReason);
00428     H225_DisengageRequest        & BuildDisengageRequest(unsigned seqNum);
00429     H225_DisengageConfirm        & BuildDisengageConfirm(unsigned seqNum);
00430     H225_DisengageReject         & BuildDisengageReject(unsigned seqNum, unsigned reason = H225_DisengageRejectReason::e_securityDenial);
00431     H225_BandwidthRequest        & BuildBandwidthRequest(unsigned seqNum);
00432     H225_BandwidthConfirm        & BuildBandwidthConfirm(unsigned seqNum, unsigned bandwidth = 0);
00433     H225_BandwidthReject         & BuildBandwidthReject(unsigned seqNum, unsigned reason = H225_BandRejectReason::e_undefinedReason);
00434     H225_InfoRequest             & BuildInfoRequest(unsigned seqNum, unsigned callRef = 0, const OpalGloballyUniqueID * id = NULL);
00435     H225_InfoRequestResponse     & BuildInfoRequestResponse(unsigned seqNum);
00436     H225_InfoRequestAck          & BuildInfoRequestAck(unsigned seqNum);
00437     H225_InfoRequestNak          & BuildInfoRequestNak(unsigned seqNum, unsigned reason = H225_InfoRequestNakReason::e_undefinedReason);
00438     H225_ServiceControlIndication& BuildServiceControlIndication(unsigned seqNum, const OpalGloballyUniqueID * id = NULL);
00439     H225_ServiceControlResponse  & BuildServiceControlResponse(unsigned seqNum);
00440     H225_UnknownMessageResponse  & BuildUnknownMessageResponse(unsigned seqNum);
00441     H225_RequestInProgress       & BuildRequestInProgress(unsigned seqNum, unsigned delay);
00442 };
00443 
00444 
00446 
00447 void H323SetAliasAddresses(const H323TransportAddressArray & addresses, H225_ArrayOf_AliasAddress & aliases);
00448 void H323SetAliasAddresses(const PStringArray & names, H225_ArrayOf_AliasAddress & aliases, int tag = -1);
00449 void H323SetAliasAddresses(const PStringList & names, H225_ArrayOf_AliasAddress & aliases, int tag = -1);
00450 void H323SetAliasAddress(const H323TransportAddress & address, H225_AliasAddress & alias);
00451 void H323SetAliasAddress(const PString & name, H225_AliasAddress & alias, int tag = -1);
00452 PStringArray H323GetAliasAddressStrings(const H225_ArrayOf_AliasAddress & aliases);
00453 PString H323GetAliasAddressString(const H225_AliasAddress & alias);
00454 PString H323GetAliasAddressE164(const H225_AliasAddress & alias);
00455 PString H323GetAliasAddressE164(const H225_ArrayOf_AliasAddress & aliases);
00456 
00457 H323Connection::CallEndReason H323TranslateToCallEndReason(
00458   Q931::CauseValues cause,
00459   const H225_ReleaseCompleteReason & reason
00460 );
00461 Q931::CauseValues H323TranslateFromCallEndReason(
00462   const H323Connection & connection,
00463   H225_ReleaseCompleteReason & rcReason
00464 );
00465 
00466 void H323GetApplicationInfo(OpalProductInfo & info, const H225_VendorIdentifier & vendor);
00467 
00468 bool H323SetRTPPacketization(
00469   H245_RTPPayloadType & rtpPacketization,
00470   const OpalMediaFormat & mediaFormat,
00471   RTP_DataFrame::PayloadTypes payloadType
00472 );
00473 PString H323GetRTPPacketization(
00474   const H245_RTPPayloadType & rtpPacketization
00475 );
00476 bool H323GetRTPPacketization(
00477   OpalMediaFormat & mediaFormat,
00478   const H245_RTPPayloadType & rtpPacketization
00479 );
00480 
00481 #if PTRACING
00482 void H323TraceDumpPDU(
00483   const char * proto,
00484   PBoolean writing,
00485   const PBYTEArray & rawData,
00486   const PASN_Object & pdu,
00487   const PASN_Choice & tag1,
00488   unsigned seqNum
00489 );
00490 #else
00491 #define H323TraceDumpPDU(proto, writing, rawData, pdu, tag1, seqNum)
00492 #endif
00493 
00494 
00495 #endif // __OPAL_H323PDU_H
00496 
00497 

Generated on Fri Mar 7 07:36:29 2008 for OPAL by  doxygen 1.5.1