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