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 MACAddress inline non-template implementation */
26 #include <boost/lambda/lambda.hpp>
28 #define prefix_ inline
29 ///////////////////////////////cci.p///////////////////////////////////////
31 ///////////////////////////////////////////////////////////////////////////
34 prefix_ senf::MACAddress::MACAddress()
36 std::fill(begin(),end(),0u);
39 prefix_ senf::MACAddress::MACAddress(NoInit_t)
42 prefix_ bool senf::MACAddress::local()
45 return (*this)[0] & 0x02;
48 prefix_ bool senf::MACAddress::group()
51 return (*this)[0] & 0x01;
54 prefix_ bool senf::MACAddress::broadcast()
57 using boost::lambda::_1;
58 return std::find_if(begin(),end(), _1 != 0xffu) == end();
61 prefix_ bool senf::MACAddress::boolean_test()
64 using boost::lambda::_1;
65 return std::find_if(begin(),end(), _1 != 0x00u) != end();
68 prefix_ boost::uint32_t senf::MACAddress::oui()
72 (boost::uint32_t((*this)[0])<<16) |
73 (boost::uint32_t((*this)[1])<<8) |
77 prefix_ boost::uint32_t senf::MACAddress::nic()
81 (boost::uint32_t((*this)[3])<<16) |
82 (boost::uint32_t((*this)[4])<<8) |
86 prefix_ boost::uint64_t senf::MACAddress::eui64()
90 (boost::uint64_t( (*this)[0] ) << 56) |
91 (boost::uint64_t( (*this)[1] ) << 48) |
92 (boost::uint64_t( (*this)[2] ) << 40) |
93 (boost::uint64_t( 0xfffe ) << 24) |
94 (boost::uint64_t( (*this)[3] ) << 16) |
95 (boost::uint64_t( (*this)[4] ) << 8) |
96 (boost::uint64_t( (*this)[5] ) );
99 ///////////////////////////////cci.e///////////////////////////////////////
106 // comment-column: 40
107 // c-file-style: "senf"
108 // indent-tabs-mode: nil
109 // ispell-local-dictionary: "american"
110 // compile-command: "scons -u test"