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: 20352 $
00030  * $Author: rjongbloed $
00031  * $Date: 2008-06-01 07:30:08 +0000 (Sun, 01 Jun 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       bool empty,                         
00128       unsigned reason = H225_FacilityReason::e_undefinedReason 
00129     );
00130 
00133     H225_Progress_UUIE & BuildProgress(
00134       const H323Connection & connection    
00135     );
00136 
00139     H225_Status_UUIE & BuildStatus(
00140       const H323Connection & connection    
00141     );
00142 
00145     H225_StatusInquiry_UUIE & BuildStatusInquiry(
00146       const H323Connection & connection    
00147     );
00148 
00151     H225_SetupAcknowledge_UUIE & BuildSetupAcknowledge(
00152       const H323Connection & connection    
00153     );
00154 
00157     H225_Notify_UUIE & BuildNotify(
00158       const H323Connection & connection    
00159     );
00161 
00162 
00167     void PrintOn(
00168       ostream & strm
00169     ) const;
00170 
00173     PBoolean Read(
00174       H323Transport & transport   
00175     );
00176 
00179     PBoolean Write(
00180       H323Transport & transport   
00181     );
00182 
00185     const Q931 & GetQ931() const { return q931pdu; }
00186 
00189     Q931 & GetQ931() { return q931pdu; }
00190 
00193     void SetQ931(const Q931 & _q931pdu) { q931pdu = _q931pdu; }
00194 
00199     void BuildQ931();
00200 
00205     PString GetSourceAliases(
00206       const H323Transport * transport = NULL  
00207     ) const;
00208 
00213     PString GetDestinationAlias(
00214       PBoolean firstAliasOnly = PFalse   
00215     ) const;
00216 
00221     PBoolean GetSourceE164(
00222       PString & number    
00223     ) const;
00224 
00229     PBoolean GetDestinationE164(
00230       PString & number    
00231     ) const;
00232 
00236     unsigned GetDistinctiveRing() const;
00237 
00242     void SetQ931Fields(
00243       const H323Connection & connection,
00244       PBoolean insertPartyNumbers = PFalse,
00245       unsigned plan = 1,
00246       unsigned type = 0,
00247       int presentation = -1,
00248       int screening = -1
00249     );
00250 
00251 #ifdef H323_H460
00252 
00256     void InsertH460Setup(
00257       const H323Connection & connection,
00258       H225_Setup_UUIE & setup
00259     );
00260 #endif
00261 
00262   protected:
00263     // Even though we generally deal with the H323 protocol (H225) it is
00264     // actually contained within a field of the Q931 protocol.
00265     Q931 q931pdu;
00266 };
00267 
00268 
00270 
00273 class H323ControlPDU : public H245_MultimediaSystemControlMessage
00274 {
00275   PCLASSINFO(H323ControlPDU, H245_MultimediaSystemControlMessage);
00276 
00277   public:
00278     H245_RequestMessage    & Build(H245_RequestMessage   ::Choices request);
00279     H245_ResponseMessage   & Build(H245_ResponseMessage  ::Choices response);
00280     H245_CommandMessage    & Build(H245_CommandMessage   ::Choices command);
00281     H245_IndicationMessage & Build(H245_IndicationMessage::Choices indication);
00282 
00283     H245_MasterSlaveDetermination & BuildMasterSlaveDetermination(
00284       unsigned terminalType,
00285       unsigned statusDeterminationNumber
00286     );
00287     H245_MasterSlaveDeterminationAck & BuildMasterSlaveDeterminationAck(
00288       PBoolean isMaster
00289     );
00290     H245_MasterSlaveDeterminationReject & BuildMasterSlaveDeterminationReject(
00291       unsigned cause
00292     );
00293 
00294     H245_TerminalCapabilitySet & BuildTerminalCapabilitySet(
00295       const H323Connection & connection,
00296       unsigned sequenceNumber,
00297       PBoolean empty
00298     );
00299     H245_TerminalCapabilitySetAck & BuildTerminalCapabilitySetAck(
00300       unsigned sequenceNumber
00301     );
00302     H245_TerminalCapabilitySetReject & BuildTerminalCapabilitySetReject(
00303       unsigned sequenceNumber,
00304       unsigned cause
00305     );
00306 
00307     H245_OpenLogicalChannel & BuildOpenLogicalChannel(
00308       unsigned forwardLogicalChannelNumber
00309     );
00310     H245_RequestChannelClose & BuildRequestChannelClose(
00311       unsigned channelNumber,
00312       unsigned reason
00313     );
00314     H245_CloseLogicalChannel & BuildCloseLogicalChannel(
00315       unsigned channelNumber
00316     );
00317     H245_OpenLogicalChannelAck & BuildOpenLogicalChannelAck(
00318       unsigned channelNumber
00319     );
00320     H245_OpenLogicalChannelReject & BuildOpenLogicalChannelReject(
00321       unsigned channelNumber,
00322       unsigned cause
00323     );
00324     H245_OpenLogicalChannelConfirm & BuildOpenLogicalChannelConfirm(
00325       unsigned channelNumber
00326     );
00327     H245_CloseLogicalChannelAck & BuildCloseLogicalChannelAck(
00328       unsigned channelNumber
00329     );
00330     H245_RequestChannelCloseAck & BuildRequestChannelCloseAck(
00331       unsigned channelNumber
00332     );
00333     H245_RequestChannelCloseReject & BuildRequestChannelCloseReject(
00334       unsigned channelNumber
00335     );
00336     H245_RequestChannelCloseRelease & BuildRequestChannelCloseRelease(
00337       unsigned channelNumber
00338     );
00339 
00340     H245_RequestMode & BuildRequestMode(
00341       unsigned sequenceNumber
00342     );
00343     H245_RequestModeAck & BuildRequestModeAck(
00344       unsigned sequenceNumber,
00345       unsigned response
00346     );
00347     H245_RequestModeReject & BuildRequestModeReject(
00348       unsigned sequenceNumber,
00349       unsigned cause
00350     );
00351 
00352     H245_RoundTripDelayRequest & BuildRoundTripDelayRequest(
00353       unsigned sequenceNumber
00354     );
00355     H245_RoundTripDelayResponse & BuildRoundTripDelayResponse(
00356       unsigned sequenceNumber
00357     );
00358 
00359     H245_UserInputIndication & BuildUserInputIndication(
00360       const PString & value
00361     );
00362     H245_UserInputIndication & BuildUserInputIndication(
00363       char tone,               
00364       unsigned duration,       
00365       unsigned logicalChannel, 
00366       unsigned rtpTimestamp    
00367     );
00368 
00369     H245_MiscellaneousCommand & BuildMiscellaneousCommand(
00370       unsigned channelNumber,
00371       unsigned type
00372     );
00373     
00374     H245_FlowControlCommand & BuildFlowControlCommand(
00375       unsigned channelNumber, 
00376       unsigned maxBitRate
00377     );
00378 
00379     H245_MiscellaneousIndication & BuildMiscellaneousIndication(
00380       unsigned channelNumber,
00381       unsigned type
00382     );
00383 
00384     H245_FunctionNotUnderstood & BuildFunctionNotUnderstood(
00385       const H323ControlPDU & pdu
00386     );
00387 
00388     H245_EndSessionCommand & BuildEndSessionCommand(
00389       unsigned reason
00390     );
00391 };
00392 
00393 
00395 
00398 class H323RasPDU : public H225_RasMessage, public H323TransactionPDU
00399 {
00400   PCLASSINFO(H323RasPDU, H225_RasMessage);
00401 
00402   public:
00403     H323RasPDU();
00404     H323RasPDU(
00405       const H235Authenticators & authenticators
00406     );
00407 
00408     // overrides from PObject
00409     virtual PObject * Clone() const;
00410 
00411     // overrides from H323TransactionPDU
00412     virtual PASN_Object & GetPDU();
00413     virtual PASN_Choice & GetChoice();
00414     virtual const PASN_Object & GetPDU() const;
00415     virtual const PASN_Choice & GetChoice() const;
00416     virtual unsigned GetSequenceNumber() const;
00417     virtual unsigned GetRequestInProgressDelay() const;
00418 #if PTRACING
00419     virtual const char * GetProtocolName() const;
00420 #endif
00421     virtual H323TransactionPDU * ClonePDU() const;
00422     virtual void DeletePDU();
00423 
00424     // new functions
00425     H225_GatekeeperRequest       & BuildGatekeeperRequest(unsigned seqNum);
00426     H225_GatekeeperConfirm       & BuildGatekeeperConfirm(unsigned seqNum);
00427     H225_GatekeeperReject        & BuildGatekeeperReject(unsigned seqNum, unsigned reason = H225_GatekeeperRejectReason::e_undefinedReason);
00428     H225_RegistrationRequest     & BuildRegistrationRequest(unsigned seqNum);
00429     H225_RegistrationConfirm     & BuildRegistrationConfirm(unsigned seqNum);
00430     H225_RegistrationReject      & BuildRegistrationReject(unsigned seqNum, unsigned reason = H225_RegistrationRejectReason::e_undefinedReason);
00431     H225_UnregistrationRequest   & BuildUnregistrationRequest(unsigned seqNum);
00432     H225_UnregistrationConfirm   & BuildUnregistrationConfirm(unsigned seqNum);
00433     H225_UnregistrationReject    & BuildUnregistrationReject(unsigned seqNum, unsigned reason = H225_UnregRejectReason::e_undefinedReason);
00434     H225_LocationRequest         & BuildLocationRequest(unsigned seqNum);
00435     H225_LocationConfirm         & BuildLocationConfirm(unsigned seqNum);
00436     H225_LocationReject          & BuildLocationReject(unsigned seqNum, unsigned reason = H225_LocationRejectReason::e_undefinedReason);
00437     H225_AdmissionRequest        & BuildAdmissionRequest(unsigned seqNum);
00438     H225_AdmissionConfirm        & BuildAdmissionConfirm(unsigned seqNum);
00439     H225_AdmissionReject         & BuildAdmissionReject(unsigned seqNum, unsigned reason = H225_AdmissionRejectReason::e_undefinedReason);
00440     H225_DisengageRequest        & BuildDisengageRequest(unsigned seqNum);
00441     H225_DisengageConfirm        & BuildDisengageConfirm(unsigned seqNum);
00442     H225_DisengageReject         & BuildDisengageReject(unsigned seqNum, unsigned reason = H225_DisengageRejectReason::e_securityDenial);
00443     H225_BandwidthRequest        & BuildBandwidthRequest(unsigned seqNum);
00444     H225_BandwidthConfirm        & BuildBandwidthConfirm(unsigned seqNum, unsigned bandwidth = 0);
00445     H225_BandwidthReject         & BuildBandwidthReject(unsigned seqNum, unsigned reason = H225_BandRejectReason::e_undefinedReason);
00446     H225_InfoRequest             & BuildInfoRequest(unsigned seqNum, unsigned callRef = 0, const OpalGloballyUniqueID * id = NULL);
00447     H225_InfoRequestResponse     & BuildInfoRequestResponse(unsigned seqNum);
00448     H225_InfoRequestAck          & BuildInfoRequestAck(unsigned seqNum);
00449     H225_InfoRequestNak          & BuildInfoRequestNak(unsigned seqNum, unsigned reason = H225_InfoRequestNakReason::e_undefinedReason);
00450     H225_ServiceControlIndication& BuildServiceControlIndication(unsigned seqNum, const OpalGloballyUniqueID * id = NULL);
00451     H225_ServiceControlResponse  & BuildServiceControlResponse(unsigned seqNum);
00452     H225_UnknownMessageResponse  & BuildUnknownMessageResponse(unsigned seqNum);
00453     H225_RequestInProgress       & BuildRequestInProgress(unsigned seqNum, unsigned delay);
00454 };
00455 
00456 
00458 
00459 void H323SetAliasAddresses(const H323TransportAddressArray & addresses, H225_ArrayOf_AliasAddress & aliases);
00460 void H323SetAliasAddresses(const PStringArray & names, H225_ArrayOf_AliasAddress & aliases, int tag = -1);
00461 void H323SetAliasAddresses(const PStringList & names, H225_ArrayOf_AliasAddress & aliases, int tag = -1);
00462 void H323SetAliasAddress(const H323TransportAddress & address, H225_AliasAddress & alias);
00463 void H323SetAliasAddress(const PString & name, H225_AliasAddress & alias, int tag = -1);
00464 PStringArray H323GetAliasAddressStrings(const H225_ArrayOf_AliasAddress & aliases);
00465 PString H323GetAliasAddressString(const H225_AliasAddress & alias);
00466 PString H323GetAliasAddressE164(const H225_AliasAddress & alias);
00467 PString H323GetAliasAddressE164(const H225_ArrayOf_AliasAddress & aliases);
00468 
00469 H323Connection::CallEndReason H323TranslateToCallEndReason(
00470   Q931::CauseValues cause,
00471   const H225_ReleaseCompleteReason & reason
00472 );
00473 Q931::CauseValues H323TranslateFromCallEndReason(
00474   const H323Connection & connection,
00475   H225_ReleaseCompleteReason & rcReason
00476 );
00477 
00478 void H323GetApplicationInfo(OpalProductInfo & info, const H225_VendorIdentifier & vendor);
00479 
00480 bool H323SetRTPPacketization(
00481   H245_RTPPayloadType & rtpPacketization,
00482   const OpalMediaFormat & mediaFormat,
00483   RTP_DataFrame::PayloadTypes payloadType
00484 );
00485 PString H323GetRTPPacketization(
00486   const H245_RTPPayloadType & rtpPacketization
00487 );
00488 bool H323GetRTPPacketization(
00489   OpalMediaFormat & mediaFormat,
00490   const H245_RTPPayloadType & rtpPacketization
00491 );
00492 
00493 #if PTRACING
00494 void H323TraceDumpPDU(
00495   const char * proto,
00496   PBoolean writing,
00497   const PBYTEArray & rawData,
00498   const PASN_Object & pdu,
00499   const PASN_Choice & tag1,
00500   unsigned seqNum
00501 );
00502 #else
00503 #define H323TraceDumpPDU(proto, writing, rawData, pdu, tag1, seqNum)
00504 #endif
00505 
00506 
00507 #endif // __OPAL_H323PDU_H
00508 
00509 

Generated on Mon Sep 15 11:49:05 2008 for OPAL by  doxygen 1.5.1