ipv6_udpposet.h

00001 /***************************************************************************
00002  *   Copyright (C) 2001 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation version 2.1.                *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU Lesser General Public      *
00015  *   License along with this library; if not, write to the                 *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA              *
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       public:
00087         typedef std::multimap<int,Address> Destinations;
00088         
00090         typedef boost::shared_ptr<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_error );
00103 
00105         virtual void bind( Conexus::Address& a ) throw ( bind_error );
00106 
00108         virtual void close() throw ( close_error );
00109 
00114         virtual ssize_t write( const void* data, size_t size ) throw ( write_error );
00115 
00122         virtual void connect() throw ( connect_error );
00123 
00130         virtual void connect( Address& a ) throw ( connect_error );
00131 
00133         virtual void set_write_without_connect( bool value = true );
00134 
00192         bool add_destination( const Address& destination, int priority=0, bool singleton=true );
00193 
00195         void remove_destination(const Address& destination, int priority );
00196 
00198         void remove_destination(const Address& destination );
00199         
00201         bool is_destination( const Address& destination );
00202         
00204         bool is_destination( const Address& destination, int priority );
00205         
00210         std::set<int> priorities( const Address& destination );
00211         
00213         const Destinations& destinations();
00214 
00216         sigc::signal<void,Address,int> signal_destination_added();
00217         
00219         sigc::signal<void,Address,int> signal_destination_removed();
00220 
00222         virtual const std::string& object_type()
00223         {
00224           static std::string s( "Conexus::IPv6::UDPPoset" );
00225           return s;
00226         }
00227 
00228       protected:
00230         Destinations m_addresses;
00231 
00233         sigc::signal<void,Address,int> m_signal_destination_added;
00234         
00236         sigc::signal<void,Address,int> m_signal_destination_removed;
00237 
00239         virtual void on_local_interface_changed( unsigned which );
00240         
00242         virtual void on_remote_address_changed( unsigned which );
00243     };
00244 
00245   }
00246 
00247 }
00248 
00249 #endif

Generated on Sat Aug 26 17:34:53 2006 by  doxygen 1.4.6