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 * $Log: h224handler.h,v $ 00022 * Revision 1.3 2007/04/19 06:17:20 csoutheren 00023 * Fixes for precompiled headers with gcc 00024 * 00025 * Revision 1.2 2006/04/23 18:52:19 dsandras 00026 * Removed warnings when compiling with gcc on Linux. 00027 * 00028 * Revision 1.1 2006/04/20 16:48:17 hfriederich 00029 * Initial version of H.224/H.281 implementation. 00030 * 00031 */ 00032 00033 #ifndef __OPAL_H224HANDLER_H 00034 #define __OPAL_H224HANDLER_H 00035 00036 #ifdef P_USE_PRAGMA 00037 #pragma interface 00038 #endif 00039 00040 #ifndef _PTLIB_H 00041 #include <ptlib.h> 00042 #endif 00043 00044 #include <opal/connection.h> 00045 #include <opal/transports.h> 00046 #include <rtp/rtp.h> 00047 #include <h224/h281handler.h> 00048 00049 #define H281_CLIENT_ID 0x01 00050 00051 class H224_Frame; 00052 class OpalH224Handler; 00053 00054 class OpalH224ReceiverThread : public PThread 00055 { 00056 PCLASSINFO(OpalH224ReceiverThread, PThread); 00057 00058 public: 00059 00060 OpalH224ReceiverThread(OpalH224Handler *h224Handler, RTP_Session & rtpSession); 00061 ~OpalH224ReceiverThread(); 00062 00063 virtual void Main(); 00064 00065 void Close(); 00066 00067 private: 00068 00069 OpalH224Handler *h224Handler; 00070 mutable PMutex inUse; 00071 unsigned timestamp; 00072 RTP_Session & rtpSession; 00073 BOOL terminate; 00074 }; 00075 00076 class OpalH281Handler; 00077 class OpalConnection; 00078 00079 class OpalH224Handler : public PObject 00080 { 00081 PCLASSINFO(OpalH224Handler, PObject); 00082 00083 public: 00084 00085 OpalH224Handler(OpalConnection & connection, unsigned sessionID); 00086 ~OpalH224Handler(); 00087 00088 virtual void StartTransmit(); 00089 virtual void StopTransmit(); 00090 virtual void StartReceive(); 00091 virtual void StopReceive(); 00092 00093 BOOL SendClientList(); 00094 BOOL SendExtraCapabilities(); 00095 BOOL SendClientListCommand(); 00096 BOOL SendExtraCapabilitiesCommand(BYTE clientID); 00097 00098 BOOL SendExtraCapabilitiesMessage(BYTE clientID, BYTE *data, PINDEX length); 00099 00100 BOOL TransmitClientFrame(BYTE clientID, H224_Frame & frame); 00101 00102 virtual BOOL OnReceivedFrame(H224_Frame & frame); 00103 virtual BOOL OnReceivedCMEMessage(H224_Frame & frame); 00104 virtual BOOL OnReceivedClientList(H224_Frame & frame); 00105 virtual BOOL OnReceivedClientListCommand(); 00106 virtual BOOL OnReceivedExtraCapabilities(H224_Frame & frame); 00107 virtual BOOL OnReceivedExtraCapabilitiesCommand(); 00108 00109 PMutex & GetTransmitMutex() { return transmitMutex; } 00110 00111 RTP_Session * GetSession() const { return session; } 00112 00113 virtual OpalH224ReceiverThread * CreateH224ReceiverThread(); 00114 00115 OpalH281Handler *GetH281Handler() { return h281Handler; } 00116 00117 protected: 00118 00119 RTP_Session * session; 00120 00121 BOOL canTransmit; 00122 PMutex transmitMutex; 00123 RTP_DataFrame *transmitFrame; 00124 BYTE transmitBitIndex; 00125 PTime *transmitStartTime; 00126 00127 OpalH224ReceiverThread *receiverThread; 00128 00129 OpalH281Handler *h281Handler; 00130 00131 private: 00132 00133 void TransmitFrame(H224_Frame & frame); 00134 00135 }; 00136 00137 #endif // __OPAL_H224HANDLER_H 00138