4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@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 EUI64 inline non-template implementation */
30 #include <boost/lambda/lambda.hpp>
31 #include "MACAddress.hh"
33 #define prefix_ inline
34 ///////////////////////////////cci.p///////////////////////////////////////
36 prefix_ senf::EUI64::EUI64(boost::uint64_t v)
38 (*this)[0] = (v>>56) & 0xffu;
39 (*this)[1] = (v>>48) & 0xffu;
40 (*this)[2] = (v>>40) & 0xffu;
41 (*this)[3] = (v>>32) & 0xffu;
42 (*this)[4] = (v>>24) & 0xffu;
43 (*this)[5] = (v>>16) & 0xffu;
44 (*this)[6] = (v>> 8) & 0xffu;
45 (*this)[7] = (v ) & 0xffu;
48 prefix_ senf::EUI64::EUI64(senf::NoInit_t)
51 prefix_ senf::EUI64 senf::EUI64::from_mac(MACAddress const & mac)
53 EUI64 eui (senf::noinit);
65 prefix_ bool senf::EUI64::isMACCompatible()
68 return (*this)[3] == 0xffu && (*this)[4] == 0xfeu;
71 prefix_ bool senf::EUI64::local()
74 return (*this)[0]&0x02;
77 prefix_ bool senf::EUI64::group()
80 return (*this)[0]&0x01;
83 prefix_ bool senf::EUI64::boolean_test()
86 using boost::lambda::_1;
87 return std::find_if(begin(),end(), _1 != 0x00u) != end();
90 prefix_ boost::uint64_t senf::EUI64::uint64()
93 return (boost::uint64_t((*this)[0])<<56)
94 | (boost::uint64_t((*this)[1])<<48)
95 | (boost::uint64_t((*this)[2])<<40)
96 | (boost::uint64_t((*this)[3])<<32)
97 | (boost::uint64_t((*this)[4])<<24)
98 | (boost::uint64_t((*this)[5])<<16)
99 | (boost::uint64_t((*this)[6])<< 8)
100 | (boost::uint64_t((*this)[7]) );
103 ///////////////////////////////cci.e///////////////////////////////////////
110 // comment-column: 40
111 // c-file-style: "senf"
112 // indent-tabs-mode: nil
113 // ispell-local-dictionary: "american"
114 // compile-command: "scons -u test"