2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
15 \brief EthernetPacket inline non-template implementation */
19 #define prefix_ inline
20 //-/////////////////////////////////////////////////////////////////////////////////////////////////
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
23 // senf::MACAddressParser
25 prefix_ bool senf::MACAddressParser::local()
28 return (*this)[0] & 0x02;
31 prefix_ bool senf::MACAddressParser::multicast()
34 return (*this)[0] & 0x01;
37 prefix_ bool senf::MACAddressParser::broadcast()
40 return (*reinterpret_cast<std::uint32_t const *>(&(*this)[0]) ^ *reinterpret_cast<std::uint16_t const *>(&(*this)[4])) == 0xffff0000;
43 prefix_ bool senf::MACAddressParser::null()
46 return (*reinterpret_cast<std::uint32_t const *>(&(*this)[0]) | *reinterpret_cast<std::uint16_t const *>(&(*this)[4])) == 0;
49 prefix_ void senf::MACAddressParser::hash(boost::uint64_t * hash, boost::uint16_t const & otherKey)
52 std::copy(&(*this)[0], &(*this)[6], (std::uint8_t*)hash);
53 *(((std::uint16_t*)hash) + 3) = otherKey;
57 //-/////////////////////////////////////////////////////////////////////////////////////////////////
64 // c-file-style: "senf"
65 // indent-tabs-mode: nil
66 // ispell-local-dictionary: "american"
67 // compile-command: "scons -u test"