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
00040 namespace Conexus
00041 {
00042
00043 namespace IPv6
00044 {
00045
00052 class UDP : public IP
00053 {
00054 public:
00055 typedef boost::shared_ptr<UDP> pointer;
00056
00057 UDP(uint16_t localport=0, uint16_t remoteport=0);
00058
00059 static UDP::pointer create(uint16_t localport=0, uint16_t remoteport=0);
00060
00061 virtual ~UDP() throw();
00062
00063 virtual void bind() throw (bind_error);
00064
00065 virtual void bind(Conexus::Address& a) throw (bind_error);
00066
00067 virtual void close() throw (close_error);
00068
00073 int pending_input_datagram_size();
00074
00078 int pending_output_datagram_size();
00079
00084 virtual ssize_t write(const void* data, size_t size) throw (write_error);
00085
00092 virtual Data read(size_t s = -1) throw (read_error);
00093
00094 virtual void connect() throw (connect_error);
00095 virtual void connect(Address& a) throw (connect_error)
00096 {
00097 Socket::connect(a);
00098 }
00099
00117 void set_write_without_connect(bool value=true);
00118
00119
00120 bool write_without_connect() const;
00121
00122 bool multicast_auto_join() const;
00123
00124 void set_multicast_auto_join(bool value=true);
00125
00129 int multicast_hops();
00130
00134 void set_multicast_hops(int hops);
00135
00139 bool multicast_loop();
00140
00144 void set_multicast_loop(bool loop);
00145
00146 virtual const std::string& object_type() { static std::string s("Conexus::IPv6::UDP"); return s; }
00147
00148 protected:
00149 bool m_write_without_connect;
00150 bool m_multicast_auto_join;
00151 struct ipv6_mreq* m_multicast_request;
00152
00153
00155 void join();
00156
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