2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
4 // Stefan Bund <g0dil@berlios.de>
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 \brief INet4Address public header */
24 #ifndef HH_INet4Address_
25 #define HH_INet4Address_ 1
30 #include <boost/cstdint.hpp>
31 #include "Utils/SafeBool.hh"
33 //#include "INet4Address.mpp"
34 ///////////////////////////////hh.p////////////////////////////////////////
41 : public ComparableSafeBool<INet4Address>
44 typedef uint32_t address_type;
46 static INet4Address const None;
47 static INet4Address const Loopback;
48 static INet4Address const Broadcast;
51 explicit INet4Address(address_type value);
53 static INet4Address from_string(std::string const & s);
54 template <class InputIterator>
55 static INet4Address from_data(InputIterator i);
56 static INet4Address from_inaddr(unsigned long v);
59 bool loopback() const;
60 bool multicast() const;
61 bool broadcast() const;
62 bool boolean_test() const;
64 unsigned long raw() const;
66 struct SyntaxException : public std::exception
67 { virtual char const * what() const throw() { return "invalid INet4 address syntax"; } };
70 // Hmm ... address_type or unsigned long? I'd use address_type but the man pages for in_addr
71 // have sa_addr as unsigned long
75 std::ostream & operator<<(std::ostream & os, INet4Address const & addr);
79 ///////////////////////////////hh.e////////////////////////////////////////
80 #include "INet4Address.cci"
81 //#include "INet4Address.ct"
82 #include "INet4Address.cti"
90 // c-file-style: "senf"
91 // indent-tabs-mode: nil
92 // ispell-local-dictionary: "american"
93 // compile-command: "scons -u test"