conexus logo

ipaddress.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2001 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the conexus library.                             *
00006  *                                                                         *
00007  *   The conexus library is free software; you can redistribute it and/or  *
00008  *   modify it under the terms of the GNU General Public License           *
00009  *   version 3 as published by the Free Software Foundation.               *
00010  *                                                                         *
00011  *   The conexus library is distributed in the hope that it will be        *
00012  *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty   *
00013  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
00014  *   General Public License for more details.                              *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU General Public License     *
00017  *   along with this software. If not see <http://www.gnu.org/licenses/>.  *
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 
00045     class IPAddress: public Address
00046       {
00047       public:
00048         typedef ConexusPointer<IPAddress> pointer;
00049 
00050         IPAddress():Address() { }
00051 
00052         IPAddress(const struct sockaddr_storage& addr): Address(addr) { }
00053 
00054         virtual ~IPAddress() { }
00055 
00057         virtual std::string address_string() const = 0;
00058 
00060         virtual std::string subnet_mask_string() const = 0;
00061 
00063         virtual unsigned prefix_length() const = 0;
00064 
00066         virtual std::string prefix_length_string() const = 0;
00067 
00069         virtual std::string address_subnet_mask_string() const = 0;
00070 
00072         virtual std::string cidr_address_string() const = 0;
00073 
00075         virtual std::string prefix_string() const = 0;
00076 
00078         virtual std::string local_address_string() const = 0;
00079 
00081         virtual uint16_t port() const = 0;
00082 
00084         virtual std::string port_string() const = 0;
00085 
00087         virtual void set_address(const std::string& address) = 0;
00088 
00090         virtual void set_address(const std::string& address, uint16_t port) = 0;
00091 
00093         virtual void set_prefix_length(unsigned prefix_length) = 0;
00094 
00096         virtual void set_prefix_length(const std::string& prefix_length) = 0;
00097 
00099         virtual void set_port(uint16_t port) = 0;
00100 
00102         virtual void set_port(const std::string& port) = 0;
00103 
00105         virtual std::string hostname() const = 0;
00106 
00108         virtual std::string servicename() const = 0;
00109 
00111         virtual bool is_multicast() const = 0;
00112 
00114         virtual bool is_any() const = 0;
00115 
00117         virtual bool is_loopback() const = 0;
00118 
00119         virtual sigc::signal<void> signal_changed() = 0;
00120         virtual sigc::signal<void> signal_address_changed( ) = 0;
00121         virtual sigc::signal<void> signal_port_changed( ) = 0;
00122         virtual sigc::signal<void> signal_prefix_changed( ) = 0;
00123 
00124         virtual bool is_ipv4() = 0;
00125 
00126         virtual bool is_ipv6() = 0;
00127 
00128       };
00129 
00130 }
00131 
00132 #endif

Generated on Tue Jun 9 10:01:55 2009 for conexus by doxygen 1.5.7.1