// $Id$ // // Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // // The contents of this file are subject to the Fraunhofer FOKUS Public License // Version 1.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // http://senf.berlios.de/license.html // // The Fraunhofer FOKUS Public License Version 1.0 is based on, // but modifies the Mozilla Public License Version 1.1. // See the full license text for the amendments. // // Software distributed under the License is distributed on an "AS IS" basis, // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License // for the specific language governing rights and limitations under the License. // // The Original Code is Fraunhofer FOKUS code. // // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. // (registered association), Hansastraße 27 c, 80686 Munich, Germany. // All Rights Reserved. // // Contributor(s): // Stefan Bund /** \file \brief EUI64 inline non-template implementation */ //#include "EUI64.ih" // Custom includes #include #include #include "MACAddress.hh" #define prefix_ inline //-///////////////////////////////////////////////////////////////////////////////////////////////// prefix_ senf::EUI64::EUI64(boost::uint64_t v) { (*this)[0] = (v>>56) & 0xffu; (*this)[1] = (v>>48) & 0xffu; (*this)[2] = (v>>40) & 0xffu; (*this)[3] = (v>>32) & 0xffu; (*this)[4] = (v>>24) & 0xffu; (*this)[5] = (v>>16) & 0xffu; (*this)[6] = (v>> 8) & 0xffu; (*this)[7] = (v ) & 0xffu; } prefix_ senf::EUI64::EUI64(senf::NoInit_t) {} prefix_ senf::EUI64 senf::EUI64::from_mac(MACAddress const & mac) { EUI64 eui (senf::noinit); eui[0] = mac[0]; eui[1] = mac[1]; eui[2] = mac[2]; eui[3] = 0xffu; eui[4] = 0xfeu; eui[5] = mac[3]; eui[6] = mac[4]; eui[7] = mac[5]; return eui; } prefix_ bool senf::EUI64::isMACCompatible() const { return (*this)[3] == 0xffu && (*this)[4] == 0xfeu; } prefix_ bool senf::EUI64::local() const { return (*this)[0]&0x02; } prefix_ bool senf::EUI64::group() const { return (*this)[0]&0x01; } prefix_ bool senf::EUI64::boolean_test() const { using boost::lambda::_1; return std::find_if(begin(),end(), _1 != 0x00u) != end(); } prefix_ boost::uint64_t senf::EUI64::uint64() const { return (boost::uint64_t((*this)[0])<<56) | (boost::uint64_t((*this)[1])<<48) | (boost::uint64_t((*this)[2])<<40) | (boost::uint64_t((*this)[3])<<32) | (boost::uint64_t((*this)[4])<<24) | (boost::uint64_t((*this)[5])<<16) | (boost::uint64_t((*this)[6])<< 8) | (boost::uint64_t((*this)[7]) ); } //-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_ // Local Variables: // mode: c++ // fill-column: 100 // comment-column: 40 // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" // compile-command: "scons -u test" // End: