OPAL
Version 3.14.3
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
h224handler.h
Go to the documentation of this file.
1
/*
2
* h224handler.h
3
*
4
* H.224 protocol handler 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: 31467 $
22
* $Author: rjongbloed $
23
* $Date: 2014-02-14 17:10:49 +1100 (Fri, 14 Feb 2014) $
24
*/
25
26
#ifndef OPAL_H224_H224HANDLER_H
27
#define OPAL_H224_H224HANDLER_H
28
29
#ifdef P_USE_PRAGMA
30
#pragma interface
31
#endif
32
33
#include <
opal_config.h
>
34
35
#if OPAL_HAS_H224
36
37
#include <
opal/connection.h
>
38
#include <
opal/transports.h
>
39
#include <
opal/mediastrm.h
>
40
#include <
rtp/rtp.h
>
41
#include <
h224/h224.h
>
42
43
class
OpalH224Handler
;
44
45
class
OpalH224Client
:
public
PObject
46
{
47
PCLASSINFO(
OpalH224Client
, PObject);
48
49
public
:
50
51
OpalH224Client
();
52
~OpalH224Client
();
53
54
enum
{
55
CMEClientID
= 0x00,
56
H281ClientID
= 0x01,
57
ExtendedClientID
= 0x7e,
58
NonStandardClientID
= 0x7f,
59
};
60
64
virtual
BYTE
GetClientID
()
const
= 0;
65
68
virtual
BYTE
GetExtendedClientID
()
const
{
return
0x00; }
69
73
virtual
BYTE
GetCountryCode
()
const
{
return
0xff;
/* CountryCodeEscape */
}
74
78
virtual
BYTE
GetCountryCodeExtension
()
const
{
return
0x00; }
79
83
virtual
WORD
GetManufacturerCode
()
const
{
return
0x0000; }
84
88
virtual
BYTE
GetManufacturerClientID
()
const
{
return
0x00; }
89
93
virtual
bool
HasExtraCapabilities
()
const
{
return
false
; }
94
98
virtual
void
OnReceivedExtraCapabilities
(
const
BYTE *
/*capabilities*/
, PINDEX
/*size*/
) { }
99
103
virtual
void
OnReceivedMessage
(
const
H224_Frame
&
/*message*/
) { }
104
108
virtual
void
SendExtraCapabilities
()
const
{ }
109
110
virtual
Comparison
Compare
(
const
PObject & obj);
111
113
void
SetH224Handler
(
OpalH224Handler
* handler) {
m_h224Handler
= handler; }
114
116
void
SetRemoteClientAvailable
(
bool
remoteClientAvailable,
bool
remoteClientHasExtraCapabilities);
117
118
bool
GetRemoteClientAvailable
()
const
{
return
m_remoteClientAvailable
; }
119
bool
GetRemoteClientHasExtraCapabilities
()
const
{
return
m_remoteClientHasExtraCapabilities
; }
120
121
protected
:
122
bool
m_remoteClientAvailable
;
123
bool
m_remoteClientHasExtraCapabilities
;
124
OpalH224Handler
*
m_h224Handler
;
125
};
126
127
PSORTED_LIST
(OpalH224ClientList,
OpalH224Client
);
128
129
131
132
class
OpalH224MediaStream
;
133
134
class
OpalH224Handler
:
public
PObject
135
{
136
PCLASSINFO(
OpalH224Handler
, PObject);
137
138
public
:
139
140
OpalH224Handler
();
141
~OpalH224Handler
();
142
143
enum
{
144
Broadcast
= 0x0000,
145
146
CMEClientListCode
= 0x01,
147
CMEExtraCapabilitiesCode
= 0x02,
148
CMEMessage
= 0x00,
149
CMECommand
= 0xff,
150
151
CountryCodeEscape
= 0xff,
152
};
153
155
bool
AddClient
(
OpalH224Client
& client);
156
bool
RemoveClient
(
OpalH224Client
& client);
157
159
void
SetTransmitMediaStream
(
OpalH224MediaStream
* transmitMediaStream);
160
161
virtual
void
StartTransmit
();
162
virtual
void
StopTransmit
();
163
165
bool
SendClientList
();
166
168
bool
SendExtraCapabilities
();
169
171
bool
SendClientListCommand
();
172
174
bool
SendExtraCapabilitiesCommand
(
const
OpalH224Client
& client);
175
177
bool
SendExtraCapabilitiesMessage
(
const
OpalH224Client
& client, BYTE *data, PINDEX length);
178
180
bool
TransmitClientFrame
(
const
OpalH224Client
& client,
H224_Frame
& frame);
181
182
virtual
bool
OnReceivedFrame
(
H224_Frame
& frame);
183
virtual
bool
OnReceivedCMEMessage
(
H224_Frame
& frame);
184
virtual
bool
OnReceivedClientList
(
H224_Frame
& frame);
185
virtual
bool
OnReceivedClientListCommand
();
186
virtual
bool
OnReceivedExtraCapabilities
(
H224_Frame
& frame);
187
virtual
bool
OnReceivedExtraCapabilitiesCommand
();
188
189
protected
:
190
bool
TransmitFrame
(
H224_Frame
& frame);
191
OpalH224Client
*
FindClient
(
192
BYTE clientID,
193
BYTE extendedClientID,
194
BYTE countryCode,
195
BYTE countryCodeExtension,
196
WORD manufacturerCode,
197
BYTE manufacturerClientID
198
)
const
;
199
200
PMutex
m_transmitMutex
;
201
bool
m_canTransmit
;
202
bool
m_transmitHDLCTunneling
;
203
PINDEX
m_transmitBitIndex
;
204
PTime
m_transmitStartTime
;
205
OpalH224MediaStream
*
m_transmitMediaStream
;
206
207
OpalH224ClientList
m_clients
;
208
};
209
211
212
class
OpalH224MediaStream
:
public
OpalMediaStream
213
{
214
PCLASSINFO(
OpalH224MediaStream
,
OpalMediaStream
);
215
216
public
:
217
OpalH224MediaStream
(
OpalConnection
&
connection
,
218
OpalH224Handler
& h224Handler,
219
const
OpalMediaFormat
&
mediaFormat
,
220
unsigned
sessionID
,
221
bool
isSource);
222
~OpalH224MediaStream
();
223
224
virtual
void
OnStartMediaPatch
();
225
virtual
PBoolean
ReadPacket
(
RTP_DataFrame
& packet);
226
virtual
PBoolean
WritePacket
(
RTP_DataFrame
& packet);
227
virtual
PBoolean
IsSynchronous
()
const
{
return
false
; }
228
virtual
PBoolean
RequiresPatchThread
()
const
{
return
IsSink
(); }
229
230
private
:
231
virtual
void
InternalClose();
232
233
OpalH224Handler
& m_h224Handler;
234
unsigned
m_consecutiveErrors;
235
};
236
237
238
#endif // OPAL_HAS_H224
239
240
#endif // OPAL_H224_H224HANDLER_H
include
h224
h224handler.h
Generated on Fri Oct 10 2014 21:36:57 for OPAL by
1.8.3.1