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 LCFTPSEND_H 00025 #define LCFTPSEND_H 00026 00027 /* include some files */ 00028 #include <unistd.h> 00029 #include <string.h> 00030 #include "sh/FileStreamerGM.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 LCFtpSend : public GMUser 00039 { 00040 private: 00041 /* vars */ 00042 char* version_text; 00043 MNlogger logger; 00044 MNMutex initialized; 00045 00046 /* filestreamer vars */ 00047 // MNLCRTPFileStreamer* filestreamer; 00048 FileStreamerGM* filestreamer; 00049 ProtectedVar<unsigned int> bandwidth; 00050 ProtectedVar<int> packetsize; 00051 ProtectedVar<int> port; 00052 ProtectedVar<int> id; 00053 char* _target; 00054 MNMutex target_mutex; 00055 char* file_name; 00056 MNMutex file_name_mutex; 00057 ProtectedBool forced; 00058 ProtectedVar<unsigned int> forced_timeout; 00059 ProtectedVar<unsigned int> forced_packet_size; 00060 ProtectedVar<int> ttl; 00061 ProtectedVar<int> lcrepeat; 00062 ProtectedVar<int> lcend_timeout; 00063 ProtectedVar<int> lclist_timeout; 00064 00065 /* flags */ 00066 ProtectedBool verbose; 00067 ProtectedBool log; 00068 ProtectedBool ende; 00069 ProtectedBool started; 00070 00071 /* pipe comm */ 00072 PipeNotifier<LCFtpSend> _notify_pipe; 00073 MNSelector _selector; 00074 00075 /* functions */ 00076 void wake(const char* text); 00077 void init(); 00078 void selectIT(); 00079 void wokenup( ); 00080 void closedDown( ); 00081 00082 /* callbacks */ 00083 virtual void StreamEvent(stream_event_t event, int fd); 00084 virtual void StreamError(int error, int fd); 00085 virtual void RTCPbye_cb(u_int32 ssrc, text_item_t *bye_text); 00086 00087 public: 00088 LCFtpSend(); 00089 virtual ~LCFtpSend(); 00090 00091 virtual const SDP::PayloadTypeTable* getPayloadTypes(); 00092 virtual SDP::PayloadTypes getInternalPayloadType(); 00093 virtual int getRTPPayloadType(); 00094 virtual const SDP::PayloadTypeTable* getPayloadTypes(int idx); 00095 virtual SDP::PayloadTypes getInternalPayloadType(int idx); 00096 virtual int getRTPPayloadType(int idx); 00097 virtual void fileComplete( const char* filename, bool comp ); 00098 00099 bool ParseCmdLine(int argc, char* argv[]); 00100 char* GetVer(); 00101 const char* Usage(); 00102 void TzStart(); 00103 void Stop(); 00104 00105 /* options */ 00106 void SetVerbose(); 00107 void UnsetVerbose(); 00108 void SetLog(); 00109 void UnsetLog(); 00110 void SetBandwidth(unsigned int bw); 00111 unsigned int GetBandwidth(); 00112 void SetPort(int port_); 00113 int GetPort(); 00114 void SetId(int id_); 00115 int GetId(); 00116 void SetHost(const char* host); 00117 char* GetHost(); 00118 void SetForced(); 00119 void UnsetForced(); 00120 bool GetForced(); 00121 void SetFname(const char* text); 00122 char* GetFname(); 00123 void SetForcedPacketSize(unsigned int val); 00124 unsigned int GetForcedPacketSize(); 00125 void SetForcedTimeout(unsigned int val); 00126 unsigned int GetForcedTimeout(); 00127 void SetTtl(int val); 00128 int GetTtl(); 00129 void SetPacketSize(int val); 00130 int GetPacketSize(); 00131 00132 /* LC Specific */ 00133 void SetLCRepeat(int val); 00134 int GetLCRepeat(); 00135 void SetLCEndTimeout(int sec); 00136 int GetLCEndTimeout(); 00137 void SetLCListTimeout(int sec); 00138 int GetLCListTimeout(); 00139 00140 private: 00150 SDP::PayloadTypeTable _payloadTypes; 00151 }; 00152 00153 #endif 00154