h224handler.h
Go to the documentation of this file.
/*
* h224handler.h
*
* H.224 protocol handler implementation for the OpenH323 Project.
*
* Copyright (c) 2006 Network for Educational Technology, ETH Zurich.
* Written by Hannes Friederich.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* Contributor(s): ______________________________________.
*
* $Revision: 27149 $
* $Author: rjongbloed $
* $Date: 2012-03-07 18:32:36 -0600 (Wed, 07 Mar 2012) $
*/
#ifndef OPAL_H224_H224HANDLER_H
#define OPAL_H224_H224HANDLER_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#ifndef _PTLIB_H
#include <ptlib.h>
#endif
#include <opal/buildopts.h>
#include <opal/connection.h>
#include <opal/transports.h>
#include <opal/mediastrm.h>
#include <rtp/rtp.h>
#include <h224/h224.h>
class OpalH224Handler;
class OpalH224Client : public PObject
{
PCLASSINFO(OpalH224Client, PObject);
public:
OpalH224Client();
~OpalH224Client();
enum {
CMEClientID = 0x00,
H281ClientID = 0x01,
ExtendedClientID = 0x7e,
NonStandardClientID = 0x7f,
};
virtual BYTE GetClientID() const = 0;
virtual BYTE GetExtendedClientID() const { return 0x00; }
virtual BYTE GetCountryCode() const { return 0xff; /* CountryCodeEscape */ }
virtual BYTE GetCountryCodeExtension() const { return 0x00; }
virtual WORD GetManufacturerCode() const { return 0x0000; }
virtual BYTE GetManufacturerClientID() const { return 0x00; }
virtual PBoolean HasExtraCapabilities() const { return false; }
virtual void OnReceivedExtraCapabilities(const BYTE * /*capabilities*/, PINDEX /*size*/) { }
virtual void OnReceivedMessage(const H224_Frame & /*message*/) { }
virtual void SendExtraCapabilities() const { }
virtual Comparison Compare(const PObject & obj);
void SetH224Handler(OpalH224Handler * handler) { h224Handler = handler; }
void SetRemoteClientAvailable(PBoolean remoteClientAvailable, PBoolean remoteClientHasExtraCapabilities);
PBoolean GetRemoteClientAvailable() const { return remoteClientAvailable; }
PBoolean GetRemoteClientHasExtraCapabilities() const { return remoteClientHasExtraCapabilities; }
protected:
PBoolean remoteClientAvailable;
PBoolean remoteClientHasExtraCapabilities;
OpalH224Handler * h224Handler;
};
PSORTED_LIST(OpalH224ClientList, OpalH224Client);
class OpalH224MediaStream;
class OpalH224Handler : public PObject
{
PCLASSINFO(OpalH224Handler, PObject);
public:
OpalH224Handler();
~OpalH224Handler();
enum {
Broadcast = 0x0000,
CMEClientListCode = 0x01,
CMEExtraCapabilitiesCode = 0x02,
CMEMessage = 0x00,
CMECommand = 0xff,
CountryCodeEscape = 0xff,
};
PBoolean AddClient(OpalH224Client & client);
PBoolean RemoveClient(OpalH224Client & client);
void SetTransmitMediaFormat(const OpalMediaFormat & mediaFormat);
void SetReceiveMediaFormat(const OpalMediaFormat & mediaFormat);
void SetTransmitMediaStream(OpalH224MediaStream * transmitMediaStream);
virtual void StartTransmit();
virtual void StopTransmit();
PBoolean SendClientList();
PBoolean SendExtraCapabilities();
PBoolean SendClientListCommand();
PBoolean SendExtraCapabilitiesCommand(const OpalH224Client & client);
PBoolean SendExtraCapabilitiesMessage(const OpalH224Client & client, BYTE *data, PINDEX length);
PBoolean TransmitClientFrame(const OpalH224Client & client, H224_Frame & frame);
PBoolean HandleFrame(const RTP_DataFrame & rtpFrame);
virtual PBoolean OnReceivedFrame(H224_Frame & frame);
virtual PBoolean OnReceivedCMEMessage(H224_Frame & frame);
virtual PBoolean OnReceivedClientList(H224_Frame & frame);
virtual PBoolean OnReceivedClientListCommand();
virtual PBoolean OnReceivedExtraCapabilities(H224_Frame & frame);
virtual PBoolean OnReceivedExtraCapabilitiesCommand();
PMutex & GetTransmitMutex() { return transmitMutex; }
protected:
PMutex transmitMutex;
PBoolean canTransmit;
RTP_DataFrame transmitFrame;
BYTE transmitBitIndex;
PTime *transmitStartTime;
OpalH224MediaStream * transmitMediaStream;
H224_Frame receiveFrame;
OpalH224ClientList clients;
private:
void TransmitFrame(H224_Frame & frame);
PBoolean transmitHDLCTunneling;
PBoolean receiveHDLCTunneling;
};
class OpalH224MediaStream : public OpalMediaStream
{
PCLASSINFO(OpalH224MediaStream, OpalMediaStream);
public:
OpalH224MediaStream(OpalConnection & connection,
OpalH224Handler & h224Handler,
const OpalMediaFormat & mediaFormat,
unsigned sessionID,
PBoolean isSource);
~OpalH224MediaStream();
virtual void OnStartMediaPatch();
virtual PBoolean ReadPacket(RTP_DataFrame & packet);
virtual PBoolean WritePacket(RTP_DataFrame & packet);
virtual PBoolean IsSynchronous() const { return false; }
virtual PBoolean RequiresPatchThread() const { return isSource ? false : true; }
private:
virtual void InternalClose();
OpalH224Handler & h224Handler;
};
#endif // OPAL_H224_H224HANDLER_H
OpalH224Client::OpalH224Client
OpalH224Client()
OpalH224Handler::transmitMediaStream
OpalH224MediaStream * transmitMediaStream
Definition: h224handler.h:205
OpalH224Handler::CountryCodeEscape
Definition: h224handler.h:153
OpalH224Handler::HandleFrame
PBoolean HandleFrame(const RTP_DataFrame &rtpFrame)
OpalH224Handler::SendClientListCommand
PBoolean SendClientListCommand()
OpalH224Handler
Definition: h224handler.h:136
OpalH224Handler::GetTransmitMutex
PMutex & GetTransmitMutex()
Definition: h224handler.h:196
OpalH224Client::ExtendedClientID
Definition: h224handler.h:59
OpalH224MediaStream::IsSynchronous
virtual PBoolean IsSynchronous() const
Definition: h224handler.h:235
OpalMediaStream::isSource
bool isSource
Definition: mediastrm.h:421
OpalH224Client::GetCountryCode
virtual BYTE GetCountryCode() const
Definition: h224handler.h:75
OpalH224Client::GetManufacturerClientID
virtual BYTE GetManufacturerClientID() const
Definition: h224handler.h:90
OpalH224Client
Definition: h224handler.h:47
connection.h
buildopts.h
OpalH224MediaStream::RequiresPatchThread
virtual PBoolean RequiresPatchThread() const
Definition: h224handler.h:236
OpalH224Handler::CMEClientListCode
Definition: h224handler.h:148
OpalH224Handler::SendExtraCapabilitiesMessage
PBoolean SendExtraCapabilitiesMessage(const OpalH224Client &client, BYTE *data, PINDEX length)
OpalH224Client::OnReceivedExtraCapabilities
virtual void OnReceivedExtraCapabilities(const BYTE *, PINDEX)
Definition: h224handler.h:100
OpalH224Handler::StopTransmit
virtual void StopTransmit()
OpalH224Handler::CMEExtraCapabilitiesCode
Definition: h224handler.h:149
OpalH224Handler::transmitStartTime
PTime * transmitStartTime
Definition: h224handler.h:204
OpalH224Handler::SendExtraCapabilitiesCommand
PBoolean SendExtraCapabilitiesCommand(const OpalH224Client &client)
H224_Frame
Definition: h224.h:91
OpalH224Handler::TransmitClientFrame
PBoolean TransmitClientFrame(const OpalH224Client &client, H224_Frame &frame)
OpalH224Handler::AddClient
PBoolean AddClient(OpalH224Client &client)
OpalH224Handler::CMECommand
Definition: h224handler.h:151
OpalH224Handler::OnReceivedClientList
virtual PBoolean OnReceivedClientList(H224_Frame &frame)
OpalH224Handler::~OpalH224Handler
~OpalH224Handler()
OpalH224Client::~OpalH224Client
~OpalH224Client()
OpalH224Handler::OpalH224Handler
OpalH224Handler()
OpalH224Handler::SetTransmitMediaFormat
void SetTransmitMediaFormat(const OpalMediaFormat &mediaFormat)
OpalH224Handler::transmitBitIndex
BYTE transmitBitIndex
Definition: h224handler.h:203
OpalH224Handler::transmitFrame
RTP_DataFrame transmitFrame
Definition: h224handler.h:202
OpalH224Handler::OnReceivedExtraCapabilitiesCommand
virtual PBoolean OnReceivedExtraCapabilitiesCommand()
OpalMediaStream::sessionID
unsigned sessionID
Definition: mediastrm.h:417
RTP_DataFrame
Definition: rtp.h:71
OpalH224Handler::SendClientList
PBoolean SendClientList()
OpalMediaFormat
Definition: mediafmt.h:724
OpalH224Handler::transmitMutex
PMutex transmitMutex
Definition: h224handler.h:200
OpalH224Client::GetRemoteClientAvailable
PBoolean GetRemoteClientAvailable() const
Definition: h224handler.h:120
OpalH224Client::remoteClientAvailable
PBoolean remoteClientAvailable
Definition: h224handler.h:125
OpalH224Client::OnReceivedMessage
virtual void OnReceivedMessage(const H224_Frame &)
Definition: h224handler.h:105
OpalH224Handler::StartTransmit
virtual void StartTransmit()
OpalH224MediaStream::WritePacket
virtual PBoolean WritePacket(RTP_DataFrame &packet)
OpalH224Client::SendExtraCapabilities
virtual void SendExtraCapabilities() const
Definition: h224handler.h:110
OpalH224MediaStream::OpalH224MediaStream
OpalH224MediaStream(OpalConnection &connection, OpalH224Handler &h224Handler, const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource)
PSORTED_LIST
PSORTED_LIST(OpalH224ClientList, OpalH224Client)
OpalH224Client::GetManufacturerCode
virtual WORD GetManufacturerCode() const
Definition: h224handler.h:85
transports.h
OpalH224Client::h224Handler
OpalH224Handler * h224Handler
Definition: h224handler.h:127
OpalH224Handler::SetTransmitMediaStream
void SetTransmitMediaStream(OpalH224MediaStream *transmitMediaStream)
OpalH224Handler::canTransmit
PBoolean canTransmit
Definition: h224handler.h:201
OpalH224MediaStream::~OpalH224MediaStream
~OpalH224MediaStream()
OpalH224Handler::SendExtraCapabilities
PBoolean SendExtraCapabilities()
OpalH224Client::GetRemoteClientHasExtraCapabilities
PBoolean GetRemoteClientHasExtraCapabilities() const
Definition: h224handler.h:121
OpalH224Handler::OnReceivedFrame
virtual PBoolean OnReceivedFrame(H224_Frame &frame)
OpalH224Client::SetH224Handler
void SetH224Handler(OpalH224Handler *handler)
Definition: h224handler.h:115
OpalH224MediaStream::OnStartMediaPatch
virtual void OnStartMediaPatch()
OpalH224Client::HasExtraCapabilities
virtual PBoolean HasExtraCapabilities() const
Definition: h224handler.h:95
OpalH224Handler::SetReceiveMediaFormat
void SetReceiveMediaFormat(const OpalMediaFormat &mediaFormat)
OpalH224Handler::OnReceivedExtraCapabilities
virtual PBoolean OnReceivedExtraCapabilities(H224_Frame &frame)
OpalH224MediaStream::ReadPacket
virtual PBoolean ReadPacket(RTP_DataFrame &packet)
OpalMediaStream
Definition: mediastrm.h:111
OpalMediaStream::mediaFormat
OpalMediaFormat mediaFormat
Definition: mediastrm.h:419
OpalH224Handler::OnReceivedClientListCommand
virtual PBoolean OnReceivedClientListCommand()
OpalConnection
Definition: connection.h:353
OpalMediaStream::connection
OpalConnection & connection
Definition: mediastrm.h:416
OpalH224MediaStream
Definition: h224handler.h:220
OpalH224Handler::receiveFrame
H224_Frame receiveFrame
Definition: h224handler.h:207
OpalH224Client::H281ClientID
Definition: h224handler.h:58
OpalH224Handler::CMEMessage
Definition: h224handler.h:150
mediastrm.h
OpalH224Client::GetClientID
virtual BYTE GetClientID() const =0
OpalH224Handler::Broadcast
Definition: h224handler.h:146
rtp.h
OpalH224Handler::clients
OpalH224ClientList clients
Definition: h224handler.h:209
OpalH224Client::Compare
virtual Comparison Compare(const PObject &obj)
OpalH224Client::CMEClientID
Definition: h224handler.h:57
OpalH224Client::NonStandardClientID
Definition: h224handler.h:60
OpalH224Handler::OnReceivedCMEMessage
virtual PBoolean OnReceivedCMEMessage(H224_Frame &frame)
OpalH224Client::SetRemoteClientAvailable
void SetRemoteClientAvailable(PBoolean remoteClientAvailable, PBoolean remoteClientHasExtraCapabilities)
OpalH224Client::GetExtendedClientID
virtual BYTE GetExtendedClientID() const
Definition: h224handler.h:70
OpalH224Client::remoteClientHasExtraCapabilities
PBoolean remoteClientHasExtraCapabilities
Definition: h224handler.h:126
OpalH224Handler::RemoveClient
PBoolean RemoveClient(OpalH224Client &client)
OpalH224Client::GetCountryCodeExtension
virtual BYTE GetCountryCodeExtension() const
Definition: h224handler.h:80
h224.h