ipv6_udp.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_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

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