debian/tmp/usr/include/conexus-0.5/conexus/ipaddress.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_IPADDRESS_H
00020 #define CONEXUS_IPADDRESS_H
00021 
00022 #include <string>
00023 
00024 #include <sys/socket.h>
00025 #include <netinet/in.h>
00026 #include <arpa/inet.h>
00027 
00028 #include <sigc++/sigc++.h>
00029 
00030 #include <conexus/enums.h>
00031 #include <conexus/address.h>
00032 #include <conexus/except.h>
00033 
00034 namespace Conexus
00035   {
00036 
00046     class IPAddress: public Address
00047       {
00048       public:
00049         typedef ConexusPointer<IPAddress> pointer;
00050 
00051         IPAddress() { }
00052 
00053         IPAddress(const struct sockaddr_storage& addr): Address(addr) { }
00054 
00055         virtual ~IPAddress() { }
00056 
00058         virtual std::string address_string() const = 0;
00059 
00061         virtual std::string subnet_mask_string() const = 0;
00062 
00064         virtual unsigned prefix_length() const = 0;
00065 
00067         virtual std::string prefix_length_string() const = 0;
00068 
00070         virtual std::string address_subnet_mask_string() const = 0;
00071 
00073         virtual std::string cidr_address_string() const = 0;
00074 
00076         virtual std::string prefix_string() const = 0;
00077 
00079         virtual std::string local_address_string() const = 0;
00080 
00082         virtual uint16_t port() const = 0;
00083 
00085         virtual std::string port_string() const = 0;
00086 
00088         virtual void set_address(std::string address) = 0;
00089 
00091         virtual void set_address(std::string address, uint16_t port) = 0;
00092 
00094         virtual void set_prefix_length(unsigned prefix_length) = 0;
00095 
00097         virtual void set_prefix_length(std::string prefix_length) = 0;
00098 
00100         virtual void set_port(uint16_t port) = 0;
00101 
00103         virtual void set_port(std::string port) = 0;
00104 
00106         virtual std::string hostname() const = 0;
00107 
00109         virtual std::string servicename() const = 0;
00110 
00112         virtual bool is_multicast() const = 0;
00113 
00115         virtual bool is_any() const = 0;
00116 
00118         virtual bool is_loopback() const = 0;
00119 
00120         sigc::signal<void, unsigned> signal_address_port_changed( )  { return m_signal_address_port_changed; }
00121         sigc::signal<void> signal_prefix_changed( ) { return m_signal_prefix_changed; }
00122 
00123         virtual const std::string& object_type() { static std::string s("Conexus::IP::Address"); return s; }
00124 
00125         virtual bool is_ipv4() = 0;
00126 
00127         virtual bool is_ipv6() = 0;
00128 
00129         protected:
00130           sigc::signal<void, unsigned> m_signal_address_port_changed;
00131           sigc::signal<void> m_signal_prefix_changed;
00132 
00133       };
00134 
00135 }
00136 
00137 #endif

Generated on Tue Mar 13 19:54:43 2007 by  doxygen 1.5.1