# h224handler.h

Go to the documentation of this file.

    00001 /*
    00002  * h224handler.h
    00003  *
    00004  * H.224 protocol handler 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: 21004 $
    00022  * $Author: rjongbloed $
    00023  * $Date: 2008-09-16 07:08:56 +0000 (Tue, 16 Sep 2008) $
    00024  */
    00025
    00026 #ifndef __OPAL_H224HANDLER_H
    00027 #define __OPAL_H224HANDLER_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/connection.h>
    00040 #include <opal/transports.h>
    00041 #include <rtp/rtp.h>
    00042 #include <h224/h281handler.h>
    00043
    00044 #define H281_CLIENT_ID 0x01
    00045
    00046 class H224_Frame;
    00047
    00048 #if 0
    00049
    00050 class OpalH224ReceiverThread : public PThread
    00051 {
    00052   PCLASSINFO(OpalH224ReceiverThread, PThread);
    00053
    00054 public:
    00055
    00056   OpalH224ReceiverThread(OpalH224Handler *h224Handler, RTP_Session & rtpSession);
    00057   ~OpalH224ReceiverThread();
    00058
    00059   virtual void Main();
    00060
    00061   void Close();
    00062
    00063 private:
    00064
    00065   OpalH224Handler *h224Handler;
    00066   mutable PMutex inUse;
    00067   unsigned timestamp;
    00068   RTP_Session & rtpSession;
    00069   PBoolean terminate;
    00070 };
    00071
    00072 class OpalH281Handler;
    00073 class OpalConnection;
    00074
    00075 class OpalH224Handler : public PObject
    00076 {
    00077   PCLASSINFO(OpalH224Handler, PObject);
    00078
    00079 public:
    00080
    00081   OpalH224Handler(OpalRTPConnection & connection, unsigned sessionID);
    00082   ~OpalH224Handler();
    00083
    00084   virtual void StartTransmit();
    00085   virtual void StopTransmit();
    00086   virtual void StartReceive();
    00087   virtual void StopReceive();
    00088
    00089   PBoolean SendClientList();
    00090   PBoolean SendExtraCapabilities();
    00091   PBoolean SendClientListCommand();
    00092   PBoolean SendExtraCapabilitiesCommand(BYTE clientID);
    00093
    00094   PBoolean SendExtraCapabilitiesMessage(BYTE clientID, BYTE *data, PINDEX length);
    00095
    00096   PBoolean TransmitClientFrame(BYTE clientID, H224_Frame & frame);
    00097
    00098   virtual PBoolean OnReceivedFrame(H224_Frame & frame);
    00099   virtual PBoolean OnReceivedCMEMessage(H224_Frame & frame);
    00100   virtual PBoolean OnReceivedClientList(H224_Frame & frame);
    00101   virtual PBoolean OnReceivedClientListCommand();
    00102   virtual PBoolean OnReceivedExtraCapabilities(H224_Frame & frame);
    00103   virtual PBoolean OnReceivedExtraCapabilitiesCommand();
    00104
    00105   PMutex & GetTransmitMutex() { return transmitMutex; }
    00106
    00107   RTP_Session * GetSession() const { return session; }
    00108
    00109   virtual OpalH224ReceiverThread * CreateH224ReceiverThread();
    00110
    00111   OpalH281Handler *GetH281Handler() { return h281Handler; }
    00112
    00113 protected:
    00114
    00115   RTP_Session * session;
    00116
    00117   PBoolean canTransmit;
    00118   PMutex transmitMutex;
    00119   RTP_DataFrame *transmitFrame;
    00120   BYTE transmitBitIndex;
    00121   PTime *transmitStartTime;
    00122
    00123   OpalH224ReceiverThread *receiverThread;
    00124
    00125   OpalH281Handler *h281Handler;
    00126
    00127 private:
    00128
    00129   void TransmitFrame(H224_Frame & frame);
    00130
    00131 };
    00132
    00133 #endif //
    00134
    00135
    00136 #endif // __OPAL_H224HANDLER_H
    00137