00001 /* Copyright (C) 2000 KOM/Darmstadt University of Technology 00002 * 00003 * You are allowed to use all other parts of the code under the following terms: 00004 * 00005 * For non-commercial use, code may be used in unmodified form provided 00006 * that this copyright notice and this permission notice appear in 00007 * supporting documentation. 00008 * 00009 * This software is provided "as is" and without any express or implied 00010 * warranties, including, without limitation, the implied warranty of 00011 * fitness for a particular purpose. 00012 * 00013 * The code may be subjected to the GNU General Public License, Version 2, 00014 * and re-distributed under the terms of this license. 00015 * As a special exception, permission is granted to link this code 00016 * with the Qt library and distribute executables, as long as you 00017 * follow the requirements of the GNU GPL in regard to all of the 00018 * software in the executable aside from Qt. 00019 * 00020 * Commercial use other than under the terms of the GNU General Public 00021 * License is allowed only after express negotiation of conditions 00022 * with the authors. 00023 */ 00024 #ifndef LCFTPRECV_H 00025 #define LCFTPRECV_H 00026 00027 /* include some files */ 00028 #include <unistd.h> 00029 #include <string.h> 00030 #include "sh/LCRTPFileRecorderGM.h" 00031 #include "sdp/PayloadTypeEntry.h" 00032 #include "MNMutex.h" 00033 #include "MNProtectedVar.h" 00034 #include "MNlogger.h" 00035 #include "MNSelector.h" 00036 #include "MNPipeNotifier.h" 00037 00038 class LCFtpRecv : public GMUser 00039 { 00040 static const int DefaultPort = 9068; 00041 static const unsigned int DefaultBandwidth = 153500; 00042 00043 private: 00044 /* vars */ 00045 MNlogger logger; 00046 MNMutex initialized; 00047 00048 /* filestreamer vars */ 00049 LCRTPFileRecorderGM* filestreamer; 00050 unsigned int _bandwidth; 00051 int _port; 00052 int _id; 00053 char* _target; 00054 char* file_name; 00055 bool forced; 00056 unsigned int forced_timeout; 00057 unsigned int forced_packet_size; 00058 int ttl; 00059 int lcrepeat; 00060 int lcend_timeout; 00061 int lclist_timeout; 00062 00063 /* flags */ 00064 bool verbose; 00065 bool ende; 00066 bool started; 00067 00068 /* pipe comm */ 00069 PipeNotifier<LCFtpRecv> _notify_pipe; 00070 MNSelector _selector; 00071 00072 private: 00073 /* functions */ 00074 void wake(const char* text); 00075 void wokenup( ); 00076 void closedDown( ); 00077 void selectIT(); 00078 00079 /* callbacks */ 00080 virtual void StreamEvent(stream_event_t event, int fd); 00081 virtual void StreamError(int error, int fd); 00082 virtual void RTCPbye_cb(u_int32 ssrc, text_item_t *bye_text); 00083 00084 public: 00085 LCFtpRecv(); 00086 virtual ~LCFtpRecv(); 00087 00088 virtual const SDP::PayloadTypeTable* getPayloadTypes(); 00089 virtual SDP::PayloadTypes getInternalPayloadType(); 00090 virtual int getRTPPayloadType(); 00091 virtual const SDP::PayloadTypeTable* getPayloadTypes(int idx); 00092 virtual SDP::PayloadTypes getInternalPayloadType(int idx); 00093 virtual int getRTPPayloadType(int idx); 00094 virtual void fileComplete( const char* filename, bool comp ); 00095 00096 bool ParseCmdLine(int argc, char* argv[]); 00097 const char* GetVer(); 00098 const char* Usage(); 00099 00103 void TzStart(); 00104 void Stop(); 00105 00106 /* options */ 00107 void SetVerbose(); 00108 void UnsetVerbose(); 00109 // void SetLog(); 00110 // void UnsetLog(); 00111 void SetBandwidth(unsigned int bw); 00112 unsigned int GetBandwidth() const; 00113 void SetPort(int port_); 00114 int GetPort() const; 00115 void SetId(int id_); 00116 int GetId() const; 00117 void SetHost(const char* host); 00118 char* GetHost(); 00119 void SetForced(); 00120 void UnsetForced(); 00121 bool GetForced(); 00122 void SetFname(const char* text); 00123 char* GetFname(); 00124 void SetForcedPacketSize(unsigned int val); 00125 unsigned int GetForcedPacketSize(); 00126 void SetForcedTimeout(unsigned int val); 00127 unsigned int GetForcedTimeout(); 00128 void SetTtl(int val); 00129 int GetTtl(); 00130 00131 /* LC Specific */ 00132 void SetLCRepeat(int val); 00133 int GetLCRepeat(); 00134 void SetLCEndTimeout(int sec); 00135 int GetLCEndTimeout(); 00136 void SetLCListTimeout(int sec); 00137 int GetLCListTimeout(); 00138 00139 private: 00149 SDP::PayloadTypeTable _payloadTypes; 00150 }; 00151 00152 #endif 00153