00001 /* 00002 * h224.h 00003 * 00004 * H.224 PDU implementation for the OpenH323 Project. 00005 * 00006 * Copyright (c) 2006 Network for Educational Technology, ETH Zurich. 00007 * Written by Hannes Friederich. 00008 * 00009 * The contents of this file are subject to the Mozilla Public License 00010 * Version 1.0 (the "License"); you may not use this file except in 00011 * compliance with the License. You may obtain a copy of the License at 00012 * http://www.mozilla.org/MPL/ 00013 * 00014 * Software distributed under the License is distributed on an "AS IS" 00015 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00016 * the License for the specific language governing rights and limitations 00017 * under the License. 00018 * 00019 * Contributor(s): ______________________________________. 00020 * 00021 * $Revision: 21862 $ 00022 * $Author: csoutheren $ 00023 * $Date: 2008-12-23 03:24:53 +0000 (Tue, 23 Dec 2008) $ 00024 */ 00025 00026 #ifndef OPAL_H224_H224_H 00027 #define OPAL_H224_H224_H 00028 00029 #ifdef P_USE_PRAGMA 00030 #pragma interface 00031 #endif 00032 00033 #ifndef _PTLIB_H 00034 #include <ptlib.h> 00035 #endif 00036 00037 #include <opal/buildopts.h> 00038 00039 #include <opal/mediatype.h> 00040 #include <opal/mediafmt.h> 00041 #include <h224/q922.h> 00042 00043 #define H224_HEADER_SIZE 6 00044 00046 // 00047 // declare a media type for H.224 00048 // 00049 00050 class OpalH224MediaType : public OpalRTPAVPMediaType 00051 { 00052 public: 00053 OpalH224MediaType(); 00054 00055 static const OpalMediaType & MediaType(); 00056 00057 #if OPAL_SIP 00058 SDPMediaDescription * CreateSDPMediaDescription(const OpalTransportAddress & localAddress); 00059 #endif 00060 }; 00061 00063 // 00064 // H.224 Media Format 00065 // 00066 00067 class OpalH224MediaFormat : public OpalMediaFormat 00068 { 00069 PCLASSINFO(OpalH224MediaFormat, OpalMediaFormat); 00070 00071 public: 00072 OpalH224MediaFormat( 00073 const char * fullName, 00074 RTP_DataFrame::PayloadTypes rtpPayloadType 00075 ); 00076 virtual PObject * Clone() const; 00077 virtual PBoolean IsValidForProtocol(const PString & protocol) const; 00078 }; 00079 00080 extern const OpalMediaFormat & GetOpalH224_H323AnnexQ(); 00081 extern const OpalMediaFormat & GetOpalH224_HDLCTunneling(); 00082 00083 00084 #define OpalH224AnnexQ GetOpalH224_H323AnnexQ() 00085 #define OpalH224Tunnelled GetOpalH224_HDLCTunneling() 00086 00088 00089 class OpalH224Client; 00090 00091 class H224_Frame : public Q922_Frame 00092 { 00093 PCLASSINFO(H224_Frame, Q922_Frame); 00094 00095 public: 00096 00097 H224_Frame(PINDEX clientDataSize = 254); 00098 H224_Frame(const OpalH224Client & h224Client, PINDEX clientDataSize = 254); 00099 ~H224_Frame(); 00100 00101 PBoolean IsHighPriority() const { return (GetLowOrderAddressOctet() == 0x71); } 00102 void SetHighPriority(PBoolean flag); 00103 00104 WORD GetDestinationTerminalAddress() const; 00105 void SetDestinationTerminalAddress(WORD destination); 00106 00107 WORD GetSourceTerminalAddress() const; 00108 void SetSourceTerminalAddress(WORD source); 00109 00111 void SetClient(const OpalH224Client & h224Client); 00112 00113 BYTE GetClientID() const; 00114 void SetClientID(BYTE clientID); 00115 00117 BYTE GetExtendedClientID() const; 00119 void SetExtendedClientID(BYTE extendedClientID); 00120 00122 BYTE GetCountryCode() const; 00123 BYTE GetCountryCodeExtension() const; 00124 WORD GetManufacturerCode() const; 00125 BYTE GetManufacturerClientID() const; 00126 00128 void SetNonStandardClientInformation(BYTE countryCode, 00129 BYTE countryCodeExtension, 00130 WORD manufacturerCode, 00131 BYTE manufacturerClientID); 00132 00135 PBoolean GetBS() const; 00136 void SetBS(PBoolean bs); 00137 00138 PBoolean GetES() const; 00139 void SetES(PBoolean es); 00140 00141 PBoolean GetC1() const; 00142 void SetC1(PBoolean c1); 00143 00144 PBoolean GetC0() const; 00145 void SetC0(PBoolean c0); 00146 00147 BYTE GetSegmentNumber() const; 00148 void SetSegmentNumber(BYTE segmentNumber); 00149 00150 BYTE *GetClientDataPtr() const; 00151 00152 PINDEX GetClientDataSize() const; 00153 void SetClientDataSize(PINDEX size); 00154 00155 PBoolean DecodeAnnexQ(const BYTE *data, PINDEX size); 00156 PBoolean DecodeHDLC(const BYTE *data, PINDEX size); 00157 00158 private: 00159 PINDEX GetHeaderSize() const; 00160 }; 00161 00162 #endif // OPAL_H224_H224_H 00163