conexus logo

ipaddress_interface.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/pointer.h>
00031 
00032 namespace Conexus
00033   {
00034 
00043     class IPAddressInterface
00044       {
00045       public:
00046         typedef ConexusPointer<IPAddressInterface> pointer;
00047 
00048         IPAddressInterface() { }
00049 
00050         virtual ~IPAddressInterface() { }
00051 
00053         virtual std::string host_string() const = 0;
00054 
00056         virtual std::string subnet_mask_string() const = 0;
00057 
00059         virtual unsigned prefix_length() const = 0;
00060 
00062         virtual std::string prefix_length_string() const = 0;
00063 
00065         virtual std::string host_subnet_mask_string() const = 0;
00066 
00068         virtual std::string cidr_host_string() const = 0;
00069 
00071         virtual std::string prefix_string() const = 0;
00072 
00074         virtual std::string local_address_string() const = 0;
00075 
00077         virtual uint16_t port() const = 0;
00078 
00080         virtual std::string port_string() const = 0;
00081 
00083         virtual void set_host(const std::string& host) = 0;
00084 
00086         virtual void set_host(const std::string& host, uint16_t port) = 0;
00087 
00089         virtual void set_prefix_length(unsigned prefix_length) = 0;
00090 
00092         virtual void set_prefix_length(const std::string& prefix_length) = 0;
00093 
00095         virtual void set_port(uint16_t port) = 0;
00096 
00098         virtual void set_port(const std::string& port) = 0;
00099 
00101         virtual std::string hostname() const = 0;
00102 
00104         virtual std::string servicename() const = 0;
00105 
00107         virtual bool is_multicast() const = 0;
00108 
00110         virtual bool is_any() const = 0;
00111 
00113         virtual bool is_loopback() const = 0;
00114 
00115         virtual sigc::signal<void>& signal_changed() = 0;
00116         virtual sigc::signal<void>& signal_host_changed( ) = 0;
00117         virtual sigc::signal<void>& signal_port_changed( ) = 0;
00118         virtual sigc::signal<void>& signal_prefix_changed( ) = 0;
00119 
00120         virtual bool is_ipv4() = 0;
00121 
00122         virtual bool is_ipv6() = 0;
00123 
00124       };
00125 
00126 }
00127 
00128 #endif

Generated on Wed Jul 8 15:50:07 2009 for conexus by doxygen 1.5.8