00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CONEXUS_IPV4TCP_H
00020 #define CONEXUS_IPV4TCP_H
00021
00022 #include <boost/shared_ptr.hpp>
00023
00024 #include <conexus/ipv4_ip.h>
00025
00030 namespace Conexus
00031 {
00032
00033 namespace IPv4
00034 {
00035
00042 class TCP : public IP
00043 {
00044 public:
00045 friend class TCPServer;
00046
00047 typedef boost::shared_ptr<TCP> pointer;
00048
00049 TCP(uint16_t port=0);
00050
00051 static TCP::pointer create(uint16_t port=0);
00052
00053 virtual ~TCP() throw();
00054
00059 int pending_input_size();
00060
00064 int pending_output_size();
00065
00070 virtual ssize_t write(const void* data, size_t size) throw (write_error);
00071
00078 virtual Data read(size_t s = -1) throw (read_error);
00079
00080 virtual void connect() throw (connect_error);
00081 virtual void connect(Address& a) throw (connect_error)
00082 {
00083 Socket::connect(a);
00084 }
00085
00086 virtual const std::string& object_type() { static std::string s("Conexus::IPv4::TCP"); return s; }
00087
00088 protected:
00089
00094 TCP(int accepted_fd, bool);
00095
00096 static TCP::pointer create(int accepted_fd, bool);
00097
00098 virtual void on_local_interface_changed(unsigned which);
00099 virtual void on_remote_address_changed(unsigned which);
00100 };
00101
00102 }
00103
00104 }
00105
00106 #endif