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: 21283 $
00030  * $Author: rjongbloed $
00031  * $Date: 2008-10-11 07:10:58 +0000 (Sat, 11 Oct 2008) $
00032  */
00033 
00034 #ifndef OPAL_H323_H323PDU_H
00035 #define OPAL_H323_H323PDU_H
00036 
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040 
00041 #include <opal/buildopts.h>
00042 
00043 #if OPAL_H323
00044 
00045 #include <ptlib/sockets.h>
00046 #include <h323/h323con.h>
00047 #include <h323/transaddr.h>
00048 #include <h323/q931.h>
00049 #include <h323/h235auth.h>
00050 #include <h323/h323trans.h>
00051 #include <rtp/rtp.h>
00052 #include <asn/h225.h>
00053 #include <asn/h245.h>
00054 
00055 
00056 class H323Connection;
00057 class H323TransportAddress;
00058 class H225_RAS;
00059 class OpalGloballyUniqueID;
00060 
00061 
00062 #define H225_PROTOCOL_VERSION 6
00063 #define H245_PROTOCOL_VERSION 13
00064 
00065 
00067 
00070 class H323SignalPDU : public H225_H323_UserInformation
00071 {
00072   PCLASSINFO(H323SignalPDU, H225_H323_UserInformation);
00073 
00074   public:
00079     H323SignalPDU();
00080 
00083     H225_Setup_UUIE & BuildSetup(
00084       const H323Connection & connection,    
00085       const H323TransportAddress & destAddr 
00086     );
00087 
00090     H225_CallProceeding_UUIE & BuildCallProceeding(
00091       const H323Connection & connection    
00092     );
00093 
00096     H225_Connect_UUIE & BuildConnect(
00097       const H323Connection & connection    
00098     );
00099 
00102     H225_Connect_UUIE & BuildConnect(
00103       const H323Connection & connection,    
00104       const PIPSocket::Address & h245Address, 
00105       WORD port                               
00106     );
00107 
00110     H225_Alerting_UUIE & BuildAlerting(
00111       const H323Connection & connection    
00112     );
00113 
00116     H225_Information_UUIE & BuildInformation(
00117       const H323Connection & connection    
00118     );
00119 
00122     H225_ReleaseComplete_UUIE & BuildReleaseComplete(
00123       const H323Connection & connection    
00124     );
00125 
00128     H225_Facility_UUIE * BuildFacility(
00129       const H323Connection & connection,  
00130       bool empty,                         
00131       unsigned reason = H225_FacilityReason::e_undefinedReason 
00132     );
00133 
00136     H225_Progress_UUIE & BuildProgress(
00137       const H323Connection & connection    
00138     );
00139 
00142     H225_Status_UUIE & BuildStatus(
00143       const H323Connection & connection    
00144     );
00145 
00148     H225_StatusInquiry_UUIE & BuildStatusInquiry(
00149       const H323Connection & connection    
00150     );
00151 
00154     H225_SetupAcknowledge_UUIE & BuildSetupAcknowledge(
00155       const H323Connection & connection    
00156     );
00157 
00160     H225_Notify_UUIE & BuildNotify(
00161       const H323Connection & connection    
00162     );
00164 
00165 
00170     void PrintOn(
00171       ostream & strm
00172     ) const;
00173 
00176     PBoolean Read(
00177       H323Transport & transport   
00178     );
00179 
00182     PBoolean Write(
00183       H323Transport & transport   
00184     );
00185 
00188     const Q931 & GetQ931() const { return q931pdu; }
00189 
00192     Q931 & GetQ931() { return q931pdu; }
00193 
00196     void SetQ931(const Q931 & _q931pdu) { q931pdu = _q931pdu; }
00197 
00202     void BuildQ931();
00203 
00208     PString GetSourceAliases(
00209       const H323Transport * transport = NULL  
00210     ) const;
00211 
00216     PString GetDestinationAlias(
00217       PBoolean firstAliasOnly = PFalse   
00218     ) const;
00219 
00224     PBoolean GetSourceE164(
00225       PString & number    
00226     ) const;
00227 
00232     PBoolean GetDestinationE164(
00233       PString & number    
00234     ) const;
00235 
00239     unsigned GetDistinctiveRing() const;
00240 
00245     void SetQ931Fields(
00246       const H323Connection & connection,
00247       PBoolean insertPartyNumbers = PFalse,
00248       unsigned plan = 1,
00249       unsigned type = 0,
00250       int presentation = -1,
00251       int screening = -1
00252     );
00253 
00254 #ifdef H323_H460
00255 
00259     void InsertH460Setup(
00260       const H323Connection & connection,
00261       H225_Setup_UUIE & setup
00262     );
00263 #endif
00264 
00265   protected:
00266     // Even though we generally deal with the H323 protocol (H225) it is
00267     // actually contained within a field of the Q931 protocol.
00268     Q931 q931pdu;
00269 };
00270 
00271 
00273 
00276 class H323ControlPDU : public H245_MultimediaSystemControlMessage
00277 {
00278   PCLASSINFO(H323ControlPDU, H245_MultimediaSystemControlMessage);
00279 
00280   public:
00281     H245_RequestMessage    & Build(H245_RequestMessage   ::Choices request);
00282     H245_ResponseMessage   & Build(H245_ResponseMessage  ::Choices response);
00283     H245_CommandMessage    & Build(H245_CommandMessage   ::Choices command);
00284     H245_IndicationMessage & Build(H245_IndicationMessage::Choices indication);
00285 
00286     H245_MasterSlaveDetermination & BuildMasterSlaveDetermination(
00287       unsigned terminalType,
00288       unsigned statusDeterminationNumber
00289     );
00290     H245_MasterSlaveDeterminationAck & BuildMasterSlaveDeterminationAck(
00291       PBoolean isMaster
00292     );
00293     H245_MasterSlaveDeterminationReject & BuildMasterSlaveDeterminationReject(
00294       unsigned cause
00295     );
00296 
00297     H245_TerminalCapabilitySet & BuildTerminalCapabilitySet(
00298       const H323Connection & connection,
00299       unsigned sequenceNumber,
00300       PBoolean empty
00301     );
00302     H245_TerminalCapabilitySetAck & BuildTerminalCapabilitySetAck(
00303       unsigned sequenceNumber
00304     );
00305     H245_TerminalCapabilitySetReject & BuildTerminalCapabilitySetReject(
00306       unsigned sequenceNumber,
00307       unsigned cause
00308     );
00309 
00310     H245_OpenLogicalChannel & BuildOpenLogicalChannel(
00311       unsigned forwardLogicalChannelNumber
00312     );
00313     H245_RequestChannelClose & BuildRequestChannelClose(
00314       unsigned channelNumber,
00315       unsigned reason
00316     );
00317     H245_CloseLogicalChannel & BuildCloseLogicalChannel(
00318       unsigned channelNumber
00319     );
00320     H245_OpenLogicalChannelAck & BuildOpenLogicalChannelAck(
00321       unsigned channelNumber
00322     );
00323     H245_OpenLogicalChannelReject & BuildOpenLogicalChannelReject(
00324       unsigned channelNumber,
00325       unsigned cause
00326     );
00327     H245_OpenLogicalChannelConfirm & BuildOpenLogicalChannelConfirm(
00328       unsigned channelNumber
00329     );
00330     H245_CloseLogicalChannelAck & BuildCloseLogicalChannelAck(
00331       unsigned channelNumber
00332     );
00333     H245_RequestChannelCloseAck & BuildRequestChannelCloseAck(
00334       unsigned channelNumber
00335     );
00336     H245_RequestChannelCloseReject & BuildRequestChannelCloseReject(
00337       unsigned channelNumber
00338     );
00339     H245_RequestChannelCloseRelease & BuildRequestChannelCloseRelease(
00340       unsigned channelNumber
00341     );
00342 
00343     H245_RequestMode & BuildRequestMode(
00344       unsigned sequenceNumber
00345     );
00346     H245_RequestModeAck & BuildRequestModeAck(
00347       unsigned sequenceNumber,
00348       unsigned response
00349     );
00350     H245_RequestModeReject & BuildRequestModeReject(
00351       unsigned sequenceNumber,
00352       unsigned cause
00353     );
00354 
00355     H245_RoundTripDelayRequest & BuildRoundTripDelayRequest(
00356       unsigned sequenceNumber
00357     );
00358     H245_RoundTripDelayResponse & BuildRoundTripDelayResponse(
00359       unsigned sequenceNumber
00360     );
00361 
00362     H245_UserInputIndication & BuildUserInputIndication(
00363       const PString & value
00364     );
00365     H245_UserInputIndication & BuildUserInputIndication(
00366       char tone,               
00367       unsigned duration,       
00368       unsigned logicalChannel, 
00369       unsigned rtpTimestamp    
00370     );
00371 
00372     H245_MiscellaneousCommand & BuildMiscellaneousCommand(
00373       unsigned channelNumber,
00374       unsigned type
00375     );
00376     
00377     H245_FlowControlCommand & BuildFlowControlCommand(
00378       unsigned channelNumber, 
00379       unsigned maxBitRate
00380     );
00381 
00382     H245_MiscellaneousIndication & BuildMiscellaneousIndication(
00383       unsigned channelNumber,
00384       unsigned type
00385     );
00386 
00387     H245_FunctionNotUnderstood & BuildFunctionNotUnderstood(
00388       const H323ControlPDU & pdu
00389     );
00390 
00391     H245_EndSessionCommand & BuildEndSessionCommand(
00392       unsigned reason
00393     );
00394 };
00395 
00396 
00398 
00401 class H323RasPDU : public H225_RasMessage, public H323TransactionPDU
00402 {
00403   PCLASSINFO(H323RasPDU, H225_RasMessage);
00404 
00405   public:
00406     H323RasPDU();
00407     H323RasPDU(
00408       const H235Authenticators & authenticators
00409     );
00410 
00411     // overrides from PObject
00412     virtual PObject * Clone() const;
00413 
00414     // overrides from H323TransactionPDU
00415     virtual PASN_Object & GetPDU();
00416     virtual PASN_Choice & GetChoice();
00417     virtual const PASN_Object & GetPDU() const;
00418     virtual const PASN_Choice & GetChoice() const;
00419     virtual unsigned GetSequenceNumber() const;
00420     virtual unsigned GetRequestInProgressDelay() const;
00421 #if PTRACING
00422     virtual const char * GetProtocolName() const;
00423 #endif
00424     virtual H323TransactionPDU * ClonePDU() const;
00425     virtual void DeletePDU();
00426 
00427     // new functions
00428     H225_GatekeeperRequest       & BuildGatekeeperRequest(unsigned seqNum);
00429     H225_GatekeeperConfirm       & BuildGatekeeperConfirm(unsigned seqNum);
00430     H225_GatekeeperReject        & BuildGatekeeperReject(unsigned seqNum, unsigned reason = H225_GatekeeperRejectReason::e_undefinedReason);
00431     H225_RegistrationRequest     & BuildRegistrationRequest(unsigned seqNum);
00432     H225_RegistrationConfirm     & BuildRegistrationConfirm(unsigned seqNum);
00433     H225_RegistrationReject      & BuildRegistrationReject(unsigned seqNum, unsigned reason = H225_RegistrationRejectReason::e_undefinedReason);
00434     H225_UnregistrationRequest   & BuildUnregistrationRequest(unsigned seqNum);
00435     H225_UnregistrationConfirm   & BuildUnregistrationConfirm(unsigned seqNum);
00436     H225_UnregistrationReject    & BuildUnregistrationReject(unsigned seqNum, unsigned reason = H225_UnregRejectReason::e_undefinedReason);
00437     H225_LocationRequest         & BuildLocationRequest(unsigned seqNum);
00438     H225_LocationConfirm         & BuildLocationConfirm(unsigned seqNum);
00439     H225_LocationReject          & BuildLocationReject(unsigned seqNum, unsigned reason = H225_LocationRejectReason::e_undefinedReason);
00440     H225_AdmissionRequest        & BuildAdmissionRequest(unsigned seqNum);
00441     H225_AdmissionConfirm        & BuildAdmissionConfirm(unsigned seqNum);
00442     H225_AdmissionReject         & BuildAdmissionReject(unsigned seqNum, unsigned reason = H225_AdmissionRejectReason::e_undefinedReason);
00443     H225_DisengageRequest        & BuildDisengageRequest(unsigned seqNum);
00444     H225_DisengageConfirm        & BuildDisengageConfirm(unsigned seqNum);
00445     H225_DisengageReject         & BuildDisengageReject(unsigned seqNum, unsigned reason = H225_DisengageRejectReason::e_securityDenial);
00446     H225_BandwidthRequest        & BuildBandwidthRequest(unsigned seqNum);
00447     H225_BandwidthConfirm        & BuildBandwidthConfirm(unsigned seqNum, unsigned bandwidth = 0);
00448     H225_BandwidthReject         & BuildBandwidthReject(unsigned seqNum, unsigned reason = H225_BandRejectReason::e_undefinedReason);
00449     H225_InfoRequest             & BuildInfoRequest(unsigned seqNum, unsigned callRef = 0, const OpalGloballyUniqueID * id = NULL);
00450     H225_InfoRequestResponse     & BuildInfoRequestResponse(unsigned seqNum);
00451     H225_InfoRequestAck          & BuildInfoRequestAck(unsigned seqNum);
00452     H225_InfoRequestNak          & BuildInfoRequestNak(unsigned seqNum, unsigned reason = H225_InfoRequestNakReason::e_undefinedReason);
00453     H225_ServiceControlIndication& BuildServiceControlIndication(unsigned seqNum, const OpalGloballyUniqueID * id = NULL);
00454     H225_ServiceControlResponse  & BuildServiceControlResponse(unsigned seqNum);
00455     H225_UnknownMessageResponse  & BuildUnknownMessageResponse(unsigned seqNum);
00456     H225_RequestInProgress       & BuildRequestInProgress(unsigned seqNum, unsigned delay);
00457 };
00458 
00459 
00461 
00462 void H323SetAliasAddresses(const H323TransportAddressArray & addresses, H225_ArrayOf_AliasAddress & aliases);
00463 void H323SetAliasAddresses(const PStringArray & names, H225_ArrayOf_AliasAddress & aliases, int tag = -1);
00464 void H323SetAliasAddresses(const PStringList & names, H225_ArrayOf_AliasAddress & aliases, int tag = -1);
00465 void H323SetAliasAddress(const H323TransportAddress & address, H225_AliasAddress & alias);
00466 void H323SetAliasAddress(const PString & name, H225_AliasAddress & alias, int tag = -1);
00467 PStringArray H323GetAliasAddressStrings(const H225_ArrayOf_AliasAddress & aliases);
00468 PString H323GetAliasAddressString(const H225_AliasAddress & alias);
00469 PString H323GetAliasAddressE164(const H225_AliasAddress & alias);
00470 PString H323GetAliasAddressE164(const H225_ArrayOf_AliasAddress & aliases);
00471 
00472 H323Connection::CallEndReason H323TranslateToCallEndReason(
00473   Q931::CauseValues cause,
00474   const H225_ReleaseCompleteReason & reason
00475 );
00476 Q931::CauseValues H323TranslateFromCallEndReason(
00477   const H323Connection & connection,
00478   H225_ReleaseCompleteReason & rcReason
00479 );
00480 
00481 void H323GetApplicationInfo(OpalProductInfo & info, const H225_VendorIdentifier & vendor);
00482 
00483 bool H323SetRTPPacketization(
00484   H245_RTPPayloadType & rtpPacketization,
00485   const OpalMediaFormat & mediaFormat,
00486   RTP_DataFrame::PayloadTypes payloadType
00487 );
00488 PString H323GetRTPPacketization(
00489   const H245_RTPPayloadType & rtpPacketization
00490 );
00491 bool H323GetRTPPacketization(
00492   OpalMediaFormat & mediaFormat,
00493   const H245_RTPPayloadType & rtpPacketization
00494 );
00495 
00496 #if PTRACING
00497 void H323TraceDumpPDU(
00498   const char * proto,
00499   PBoolean writing,
00500   const PBYTEArray & rawData,
00501   const PASN_Object & pdu,
00502   const PASN_Choice & tag1,
00503   unsigned seqNum
00504 );
00505 #else
00506 #define H323TraceDumpPDU(proto, writing, rawData, pdu, tag1, seqNum)
00507 #endif
00508 
00509 
00510 #endif // OPAL_H323
00511 
00512 #endif // OPAL_H323_H323PDU_H
00513 
00514 

Generated on Mon Feb 23 02:01:30 2009 for OPAL by  doxygen 1.5.1