4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Thorsten Horstmann <tho@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief MIHTypes public header */
26 #ifndef HH_SENF_Packets_80221Bundle_MIHTypes_
27 #define HH_SENF_Packets_80221Bundle_MIHTypes_ 1
30 #include <senf/Socket/Protocols/Raw/MACAddress.hh>
31 #include <senf/Socket/Protocols/INet/INet4Address.hh>
32 #include <senf/Socket/Protocols/INet/INet6Address.hh>
33 #include <boost/function_output_iterator.hpp>
34 #include <boost/iterator/filter_iterator.hpp>
35 #include <boost/variant.hpp>
37 //#include "MIHTypes.mpp"
38 ///////////////////////////////hh.p////////////////////////////////////////
43 : public boost::variant< boost::blank, senf::MACAddress, senf::INet4Address,
44 senf::INet6Address, std::string, senf::EUI64 >,
45 public boost::less_than_comparable<MIHFId>,
46 public boost::equality_comparable<MIHFId>
49 enum Type { Empty, MACAddress, INet4Address, INet6Address, String, EUI64 };
51 MIHFId(); ///< Create empty instance.
52 MIHFId(senf::MACAddress const & addr); ///< Construct id with given MACAddress
53 MIHFId(senf::INet4Address const & addr); ///< Construct id with given INet4Address
54 MIHFId(senf::INet6Address const & addr); ///< Construct id with given INet6Address
55 MIHFId(std::string const & addr); ///< Construct id with given String
56 MIHFId(senf::EUI64 const & addr); ///< Construct id with given EUI64
59 bool operator==(MIHFId const & other) const;
60 bool operator<(MIHFId const & other) const;
63 struct GetTypeVisitor : public boost::static_visitor<Type> {
64 Type operator()(boost::blank const &) const { return Empty; }
65 Type operator()(senf::MACAddress const &) const { return MACAddress; }
66 Type operator()(senf::INet4Address const &) const { return INet4Address; }
67 Type operator()(senf::INet6Address const &) const { return INet6Address; }
68 Type operator()(std::string const & ) const { return String; }
69 Type operator()(senf::EUI64 const &) const { return EUI64; }
71 struct EqualsVisitor : public boost::static_visitor<bool> {
72 template <typename T, typename U>
73 bool operator()(T const &, U const &) const {
77 bool operator()( const T & lhs, const T & rhs ) const {
81 struct LessThanVisitor : public boost::static_visitor<bool> {
82 template <typename T, typename U>
83 bool operator()(T const &, U const &) const {
87 bool operator()( const T & lhs, const T & rhs ) const {
95 ///////////////////////////////hh.e////////////////////////////////////////
96 #include "MIHTypes.cci"
97 //#include "MIHTypes.ct"
98 //#include "MIHTypes.cti"
105 // comment-column: 40
106 // c-file-style: "senf"
107 // indent-tabs-mode: nil
108 // ispell-local-dictionary: "american"
109 // compile-command: "scons -u test"