00001 #ifndef TCPIP_HPP_ 00002 #define TCPIP_HPP_ 00003 00004 #include "ariba/utility/transport/transport.hpp" 00005 #include <pthread.h> 00006 00007 // forward declaration 00008 namespace protlib { 00009 template<class X, class Y> 00010 class ThreadStarter; 00011 class TPoverTCP; 00012 class TPoverTCPParam; 00013 } 00014 00015 namespace ariba { 00016 namespace transport { 00017 00018 using namespace protlib; 00019 00025 class tcpip : public transport_protocol { 00026 public: 00027 tcpip( uint16_t port ); 00028 virtual ~tcpip(); 00029 virtual void start(); 00030 virtual void stop(); 00031 virtual void send( const address_v* remote, const uint8_t* data, size_t size ); 00032 virtual void send( const endpoint_set& endpoints, const uint8_t* data, size_t size ); 00033 virtual void terminate( const address_v* remote ); 00034 virtual void register_listener( transport_listener* listener ); 00035 00036 private: 00037 volatile bool done, running; 00038 uint16_t port; 00039 pthread_t tpreceivethread; 00040 ThreadStarter<TPoverTCP, TPoverTCPParam>* tpthread; 00041 static void* receiverThread( void* ptp ); 00042 transport_listener* listener; 00043 }; 00044 00045 }} // namespace ariba::transport 00046 00047 #endif /* TCPIP_HPP_ */