00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CONEXUS_IPV6UDP_H
00020 #define CONEXUS_IPV6UDP_H
00021
00022 #include <conexus/ipv6_ip.h>
00023
00028 namespace Conexus
00029 {
00030
00031 namespace IPv6
00032 {
00033
00040 class UDP : public IP
00041 {
00042 public:
00043 typedef boost::shared_ptr<UDP> pointer;
00044
00045 UDP(uint16_t localport=0, uint16_t remoteport=0);
00046
00047 static UDP::pointer create(uint16_t localport=0, uint16_t remoteport=0);
00048
00049 virtual ~UDP() throw();
00050
00051 virtual void bind() throw (bind_error);
00052
00053 virtual void bind(Conexus::Address& a) throw (bind_error);
00054
00055 virtual void close() throw (close_error);
00056
00061 int pending_input_datagram_size();
00062
00066 int pending_output_datagram_size();
00067
00072 virtual ssize_t write(const void* data, size_t size) throw (write_error);
00073
00080 virtual Data read(size_t s = -1) throw (read_error);
00081
00082 virtual void connect() throw (connect_error);
00083 virtual void connect(Address& a) throw (connect_error)
00084 {
00085 Socket::connect(a);
00086 }
00087
00105 void set_write_without_connect(bool value=true);
00106
00107
00108 bool write_without_connect() const;
00109
00110 bool multicast_auto_join() const;
00111
00112 void set_multicast_auto_join(bool value=true);
00113
00117 int multicast_hops();
00118
00122 void set_multicast_hops(int hops);
00123
00127 bool multicast_loop();
00128
00132 void set_multicast_loop(bool loop);
00133
00134 virtual const std::string& object_type() { static std::string s("Conexus::IPv6::UDP"); return s; }
00135
00136 protected:
00137 bool m_write_without_connect;
00138 bool m_multicast_auto_join;
00139 struct ipv6_mreq* m_multicast_request;
00140
00141
00149 void join();
00150
00158 void leave();
00159
00160 virtual void on_local_interface_changed(unsigned which);
00161 virtual void on_remote_address_changed(unsigned which);
00162 };
00163
00164 }
00165
00166 }
00167
00168 #endif