00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CONEXUS_IPV6UDPPOSET_H
00020 #define CONEXUS_IPV6UDPPOSET_H
00021
00022 #include <conexus/ipv6_udp.h>
00023
00024 #include <map>
00025 #include <set>
00026
00054 namespace Conexus
00055 {
00056
00057 namespace IPv6
00058 {
00059
00080 class UDPPoset : public UDP
00081 {
00082 protected:
00083
00085 UDPPoset( const struct in6_addr& local_if, uint16_t localport = 0 );
00086
00088 UDPPoset( const std::string& local_if, uint16_t localport = 0 );
00089
00090 public:
00095 typedef std::multimap<int,Address> Destinations;
00096
00098 typedef ConexusPointer<UDPPoset> pointer;
00099
00101 static UDPPoset::pointer create( uint16_t localport = 0 );
00102
00104 static UDPPoset::pointer create( const struct in6_addr& local_if, uint16_t localport = 0 );
00105
00107 static UDPPoset::pointer create( const std::string& local_if, uint16_t localport = 0 );
00108
00110 virtual ~UDPPoset() throw();
00111
00113 virtual void bind() throw ( bind_exception );
00114
00116 virtual void bind( const Conexus::Address& a ) throw ( bind_exception );
00117
00119 virtual void close() throw ( close_exception );
00120
00127 virtual void connect() throw ( connect_exception );
00128
00135 virtual void connect( const Address& a ) throw ( connect_exception );
00136
00138 virtual void set_write_without_connect( bool value = true );
00139
00197 bool add_destination( const Address& destination, int priority=0, bool singleton=true );
00198
00199 bool add_destination( uint32_t host, uint16_t port, int priority = 0, bool singleton = true );
00200
00201 bool add_destination( const struct in6_addr& host, uint16_t port, int priority = 0, bool singleton = true );
00202
00203 bool add_destination( const std::string& host, uint16_t port, int priority = 0, bool singleton = true );
00204
00206 void remove_destination(const Address& destination, int priority );
00207
00209 void remove_destination(const Address& destination );
00210
00212 bool is_destination( const Address& destination );
00213
00215 bool is_destination( const Address& destination, int priority );
00216
00221 std::set<int> priorities( const Address& destination );
00222
00224 const Destinations& destinations();
00225
00227 sigc::signal<void,Address,int> signal_destination_added();
00228
00230 sigc::signal<void,Address,int> signal_destination_removed();
00231
00232 protected:
00234 Destinations m_addresses;
00235
00237 sigc::signal<void,Address,int> m_signal_destination_added;
00238
00240 sigc::signal<void,Address,int> m_signal_destination_removed;
00241
00243 virtual void on_local_address_changed( );
00244
00246 virtual void on_remote_address_changed( );
00247
00252 virtual ssize_t write_data(long int timeout, const Data data) throw (write_exception);
00253
00254 };
00255
00256 }
00257
00258 }
00259
00260 #endif