00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CONEXUS_IPV4UDPPOSET_H
00020 #define CONEXUS_IPV4UDPPOSET_H
00021
00022 #include <conexus/ipv4_udp.h>
00023
00024 #include <map>
00025 #include <set>
00026
00054 namespace Conexus
00055 {
00056
00057 namespace IPv4
00058 {
00059
00080 class UDPPoset : public UDP
00081 {
00082 public:
00087 typedef std::multimap<int,Address> Destinations;
00088
00090 typedef ConexusPointer<UDPPoset> pointer;
00091
00093 UDPPoset( uint16_t localport = 0 );
00094
00096 static UDPPoset::pointer create( uint16_t localport = 0 );
00097
00099 virtual ~UDPPoset() throw();
00100
00102 virtual void bind() throw ( bind_exception );
00103
00105 virtual void bind( Conexus::Address& a ) throw ( bind_exception );
00106
00108 virtual void close() throw ( close_exception );
00109
00116 virtual void connect() throw ( connect_exception );
00117
00124 virtual void connect( Address& a ) throw ( connect_exception );
00125
00127 virtual void set_write_without_connect( bool value = true );
00128
00186 bool add_destination( const Address& destination, int priority = 0, bool singleton = true );
00187
00189 void remove_destination( const Address& destination, int priority );
00190
00192 void remove_destination( const Address& destination );
00193
00195 bool is_destination( const Address& destination );
00196
00198 bool is_destination( const Address& destination, int priority );
00199
00204 std::set<int> priorities( const Address& destination );
00205
00207 const Destinations& destinations();
00208
00210 sigc::signal<void,Address,int> signal_destination_added();
00211
00213 sigc::signal<void,Address,int> signal_destination_removed();
00214
00216 virtual const std::string& object_type() {
00217 static std::string s( "Conexus::IPv4::UDPPoset" );
00218 return s;
00219 }
00220
00221 protected:
00223 Destinations m_addresses;
00224
00226 sigc::signal<void,Address,int> m_signal_destination_added;
00227
00229 sigc::signal<void,Address,int> m_signal_destination_removed;
00230
00232 virtual void on_local_interface_changed( unsigned which );
00233
00235 virtual void on_remote_address_changed( unsigned which );
00236
00241 virtual ssize_t write_data(long int timeout, Data::const_pointer data) throw (write_exception);
00242
00243 };
00244
00245 }
00246
00247 }
00248
00249 #endif