OPAL  Version 3.12.9
h224.h
Go to the documentation of this file.
1 /*
2  * h224.h
3  *
4  * H.224 PDU implementation for the OpenH323 Project.
5  *
6  * Copyright (c) 2006 Network for Educational Technology, ETH Zurich.
7  * Written by Hannes Friederich.
8  *
9  * The contents of this file are subject to the Mozilla Public License
10  * Version 1.0 (the "License"); you may not use this file except in
11  * compliance with the License. You may obtain a copy of the License at
12  * http://www.mozilla.org/MPL/
13  *
14  * Software distributed under the License is distributed on an "AS IS"
15  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
16  * the License for the specific language governing rights and limitations
17  * under the License.
18  *
19  * Contributor(s): ______________________________________.
20  *
21  * $Revision: 30922 $
22  * $Author: rjongbloed $
23  * $Date: 2013-11-18 14:33:50 +1100 (Mon, 18 Nov 2013) $
24  */
25 
26 #ifndef OPAL_H224_H224_H
27 #define OPAL_H224_H224_H
28 
29 #ifdef P_USE_PRAGMA
30 #pragma interface
31 #endif
32 
33 #ifndef _PTLIB_H
34 #include <ptlib.h>
35 #endif
36 
37 #include <opal/buildopts.h>
38 
39 #if OPAL_HAS_H224
40 
41 #include <opal/mediatype.h>
42 #include <opal/mediafmt.h>
43 #include <h224/q922.h>
44 
45 #define H224_HEADER_SIZE 6
46 
48 //
49 // declare a media type for H.224
50 //
51 
53 {
54  public:
55  static const char * Name();
56 
58 
59  static const OpalMediaType & MediaType();
60 
61 #if OPAL_SIP
62  static const PCaselessString & GetSDPMediaType();
63 
64  virtual bool MatchesSDP(
65  const PCaselessString & sdpMediaType,
66  const PCaselessString & sdpTransport,
67  const PStringArray & sdpLines,
68  PINDEX index
69  );
70 
72  const OpalTransportAddress & localAddress
73  ) const;
74 #endif // OPAL_SIP
75 };
76 
78 //
79 // H.224 Media Format
80 //
81 
83 {
85 
86  public:
88  const char * fullName,
89  RTP_DataFrame::PayloadTypes rtpPayloadType
90  );
91  virtual PObject * Clone() const;
92  virtual PBoolean IsValidForProtocol(const PString & protocol) const;
93 };
94 
97 
98 
99 #define OpalH224AnnexQ GetOpalH224_H323AnnexQ()
100 #define OpalH224Tunnelled GetOpalH224_HDLCTunneling()
101 
103 
104 class OpalH224Client;
105 
106 class H224_Frame : public Q922_Frame
107 {
108  PCLASSINFO(H224_Frame, Q922_Frame);
109 
110 public:
111 
112  H224_Frame(PINDEX clientDataSize = 254);
113  H224_Frame(const OpalH224Client & h224Client, PINDEX clientDataSize = 254);
114  ~H224_Frame();
115 
116  PBoolean IsHighPriority() const { return (GetLowOrderAddressOctet() == 0x71); }
117  void SetHighPriority(PBoolean flag);
118 
119  WORD GetDestinationTerminalAddress() const;
120  void SetDestinationTerminalAddress(WORD destination);
121 
122  WORD GetSourceTerminalAddress() const;
123  void SetSourceTerminalAddress(WORD source);
124 
126  void SetClient(const OpalH224Client & h224Client);
127 
128  BYTE GetClientID() const;
129  void SetClientID(BYTE clientID);
130 
132  BYTE GetExtendedClientID() const;
134  void SetExtendedClientID(BYTE extendedClientID);
135 
137  BYTE GetCountryCode() const;
138  BYTE GetCountryCodeExtension() const;
139  WORD GetManufacturerCode() const;
140  BYTE GetManufacturerClientID() const;
141 
143  void SetNonStandardClientInformation(BYTE countryCode,
144  BYTE countryCodeExtension,
145  WORD manufacturerCode,
146  BYTE manufacturerClientID);
147 
150  PBoolean GetBS() const;
151  void SetBS(PBoolean bs);
152 
153  PBoolean GetES() const;
154  void SetES(PBoolean es);
155 
156  PBoolean GetC1() const;
157  void SetC1(PBoolean c1);
158 
159  PBoolean GetC0() const;
160  void SetC0(PBoolean c0);
161 
162  BYTE GetSegmentNumber() const;
163  void SetSegmentNumber(BYTE segmentNumber);
164 
165  BYTE *GetClientDataPtr() const;
166 
167  PINDEX GetClientDataSize() const;
168  void SetClientDataSize(PINDEX size);
169 
170  PBoolean DecodeAnnexQ(const BYTE *data, PINDEX size);
171  PBoolean DecodeHDLC(const BYTE *data, PINDEX size);
172 
173 private:
174  PINDEX GetHeaderSize() const;
175 };
176 
177 
178 #endif // OPAL_HAS_H224
179 
180 #endif // OPAL_H224_H224_H