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.1 2006/06/22 11:07:22 shorne 00023 * Backport of FECC (H.224) from Opal 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 #include <ptlib.h> 00041 //#include <opal/connection.h> 00042 //#include <transports.h> 00043 #include <rtp.h> 00044 #include <h281handler.h> 00045 00046 #define H281_CLIENT_ID 0x01 00047 00048 class H224_Frame; 00049 class OpalH224Handler; 00050 00051 class OpalH224ReceiverThread : public PThread 00052 { 00053 PCLASSINFO(OpalH224ReceiverThread, PThread); 00054 00055 public: 00056 00057 OpalH224ReceiverThread(OpalH224Handler *h224Handler, RTP_Session & rtpSession); 00058 ~OpalH224ReceiverThread(); 00059 00060 virtual void Main(); 00061 00062 void Close(); 00063 00064 private: 00065 00066 OpalH224Handler *h224Handler; 00067 mutable PMutex inUse; 00068 unsigned timestamp; 00069 RTP_Session & rtpSession; 00070 BOOL terminate; 00071 }; 00072 00073 class OpalH281Handler; 00074 class H323Connection; 00075 00076 class OpalH224Handler : public PObject 00077 { 00078 PCLASSINFO(OpalH224Handler, PObject); 00079 00080 public: 00081 00082 OpalH224Handler(H323Connection & connection, unsigned sessionID); 00083 ~OpalH224Handler(); 00084 00085 virtual void StartTransmit(); 00086 virtual void StopTransmit(); 00087 virtual void StartReceive(); 00088 virtual void StopReceive(); 00089 00090 BOOL SendClientList(); 00091 BOOL SendExtraCapabilities(); 00092 BOOL SendClientListCommand(); 00093 BOOL SendExtraCapabilitiesCommand(BYTE clientID); 00094 00095 BOOL SendExtraCapabilitiesMessage(BYTE clientID, BYTE *data, PINDEX length); 00096 00097 BOOL TransmitClientFrame(BYTE clientID, H224_Frame & frame); 00098 00099 virtual BOOL OnReceivedFrame(H224_Frame & frame); 00100 virtual BOOL OnReceivedCMEMessage(H224_Frame & frame); 00101 virtual BOOL OnReceivedClientList(H224_Frame & frame); 00102 virtual BOOL OnReceivedClientListCommand(); 00103 virtual BOOL OnReceivedExtraCapabilities(H224_Frame & frame); 00104 virtual BOOL OnReceivedExtraCapabilitiesCommand(); 00105 00106 PMutex & GetTransmitMutex() { return transmitMutex; } 00107 00108 RTP_Session * GetSession() const { return session; } 00109 00110 virtual OpalH224ReceiverThread * CreateH224ReceiverThread(); 00111 00112 OpalH281Handler *GetH281Handler() { return h281Handler; } 00113 00114 protected: 00115 00116 RTP_Session * session; 00117 00118 BOOL canTransmit; 00119 PMutex transmitMutex; 00120 RTP_DataFrame *transmitFrame; 00121 BYTE transmitBitIndex; 00122 PTime *transmitStartTime; 00123 00124 OpalH224ReceiverThread *receiverThread; 00125 00126 OpalH281Handler *h281Handler; 00127 00128 private: 00129 00130 void TransmitFrame(H224_Frame & frame); 00131 00132 }; 00133 00134 #endif // __OPAL_H224HANDLER_H 00135