# h224.h

Go to the documentation of this file.

    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: 27956 $
    00022  * $Author: rjongbloed $
    00023  * $Date: 2012-07-04 01:56:20 -0500 (Wed, 04 Jul 2012) $
    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     static const char * Name();
    00054
    00055     OpalH224MediaType();
    00056
    00057     static const OpalMediaType & MediaType();
    00058
    00059 #if OPAL_SIP
    00060     static const PCaselessString & GetSDPMediaType();
    00061
    00062     virtual bool MatchesSDP(
    00063       const PCaselessString & sdpMediaType,
    00064       const PCaselessString & sdpTransport,
    00065       const PStringArray & sdpLines,
    00066       PINDEX index
    00067     );
    00068
    00069     virtual SDPMediaDescription * CreateSDPMediaDescription(
    00070       const OpalTransportAddress & localAddress
    00071     ) const;
    00072 #endif // OPAL_SIP
    00073 };
    00074
    00076 //
    00077 // H.224 Media Format
    00078 //
    00079
    00080 class OpalH224MediaFormat : public OpalMediaFormat
    00081 {
    00082   PCLASSINFO(OpalH224MediaFormat, OpalMediaFormat);
    00083
    00084   public:
    00085     OpalH224MediaFormat(
    00086       const char * fullName,
    00087       RTP_DataFrame::PayloadTypes rtpPayloadType
    00088     );
    00089     virtual PObject * Clone() const;
    00090     virtual PBoolean IsValidForProtocol(const PString & protocol) const;
    00091 };
    00092
    00093 extern const OpalMediaFormat & GetOpalH224_H323AnnexQ();
    00094 extern const OpalMediaFormat & GetOpalH224_HDLCTunneling();
    00095
    00096
    00097 #define OpalH224AnnexQ      GetOpalH224_H323AnnexQ()
    00098 #define OpalH224Tunnelled   GetOpalH224_HDLCTunneling()
    00099
    00101
    00102 class OpalH224Client;
    00103
    00104 class H224_Frame : public Q922_Frame
    00105 {
    00106   PCLASSINFO(H224_Frame, Q922_Frame);
    00107
    00108 public:
    00109
    00110   H224_Frame(PINDEX clientDataSize = 254);
    00111   H224_Frame(const OpalH224Client & h224Client, PINDEX clientDataSize = 254);
    00112   ~H224_Frame();
    00113
    00114   PBoolean IsHighPriority() const { return (GetLowOrderAddressOctet() == 0x71); }
    00115   void SetHighPriority(PBoolean flag);
    00116
    00117   WORD GetDestinationTerminalAddress() const;
    00118   void SetDestinationTerminalAddress(WORD destination);
    00119
    00120   WORD GetSourceTerminalAddress() const;
    00121   void SetSourceTerminalAddress(WORD source);
    00122
    00124   void SetClient(const OpalH224Client & h224Client);
    00125
    00126   BYTE GetClientID() const;
    00127   void SetClientID(BYTE clientID);
    00128
    00130   BYTE GetExtendedClientID() const;
    00132   void SetExtendedClientID(BYTE extendedClientID);
    00133
    00135   BYTE GetCountryCode() const;
    00136   BYTE GetCountryCodeExtension() const;
    00137   WORD GetManufacturerCode() const;
    00138   BYTE GetManufacturerClientID() const;
    00139
    00141   void SetNonStandardClientInformation(BYTE countryCode,
    00142                                        BYTE countryCodeExtension,
    00143                                        WORD manufacturerCode,
    00144                                        BYTE manufacturerClientID);
    00145
    00148   PBoolean GetBS() const;
    00149   void SetBS(PBoolean bs);
    00150
    00151   PBoolean GetES() const;
    00152   void SetES(PBoolean es);
    00153
    00154   PBoolean GetC1() const;
    00155   void SetC1(PBoolean c1);
    00156
    00157   PBoolean GetC0() const;
    00158   void SetC0(PBoolean c0);
    00159
    00160   BYTE GetSegmentNumber() const;
    00161   void SetSegmentNumber(BYTE segmentNumber);
    00162
    00163   BYTE *GetClientDataPtr() const;
    00164
    00165   PINDEX GetClientDataSize() const;
    00166   void SetClientDataSize(PINDEX size);
    00167
    00168   PBoolean DecodeAnnexQ(const BYTE *data, PINDEX size);
    00169   PBoolean DecodeHDLC(const BYTE *data, PINDEX size);
    00170
    00171 private:
    00172   PINDEX GetHeaderSize() const;
    00173 };
    00174
    00175 #endif // OPAL_H224_H224_H
    00176