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 INet6Address inline template implementation */
17 #include "INet6Address.ih"
20 #include <boost/integer/integer_mask.hpp>
22 #define prefix_ inline
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
28 prefix_ bool senf::detail::CheckINet6Network_impl5<a,0,0>::match(boost::uint8_t v0,
34 template <unsigned a, unsigned restbits>
35 prefix_ bool senf::detail::CheckINet6Network_impl5<a,0,restbits>::match(boost::uint8_t v0,
38 return (v0 & ~boost::low_bits_mask_t<8-restbits>::sig_bits) ==
39 (boost::uint8_t(a>>8) & ~boost::low_bits_mask_t<8-restbits>::sig_bits);
43 prefix_ bool senf::detail::CheckINet6Network_impl5<a,1,0>::match(boost::uint8_t v0,
46 return v0 == boost::uint8_t(a>>8);
49 template <unsigned a, unsigned restbits>
50 prefix_ bool senf::detail::CheckINet6Network_impl5<a,1,restbits>::match(boost::uint8_t v0,
53 return (v0 == boost::uint8_t(a>>8)) &&
54 ((v1 & ~boost::low_bits_mask_t<8-restbits>::sig_bits)
55 == (boost::uint8_t(a) & ~boost::low_bits_mask_t<8-restbits>::sig_bits));
58 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5,
59 unsigned a6, unsigned a7, unsigned restbits>
60 prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,0,restbits>::
61 match(INet6Address const & addr)
63 return CheckINet6Network_impl4<a0,restbits>::match(addr[0],addr[1]);
66 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5,
67 unsigned a6, unsigned a7, unsigned restbits>
68 prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,1,restbits>::
69 match(INet6Address const & addr)
72 addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) &&
73 CheckINet6Network_impl4<a1,restbits>::match(addr[2],addr[3]);
76 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5,
77 unsigned a6, unsigned a7, unsigned restbits>
78 prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,2,restbits>::
79 match(INet6Address const & addr)
82 addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) &&
83 addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) &&
84 CheckINet6Network_impl4<a1,restbits>::match(addr[4],addr[5]);
87 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5,
88 unsigned a6, unsigned a7, unsigned restbits>
89 prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,3,restbits>::
90 match(INet6Address const & addr)
93 addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) &&
94 addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) &&
95 addr[4] == boost::uint8_t(a2>>8) && addr[5] == boost::uint8_t(a2) &&
96 CheckINet6Network_impl4<a3,restbits>::match(addr[6],addr[7]);
99 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5,
100 unsigned a6, unsigned a7, unsigned restbits>
101 prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,4,restbits>::
102 match(INet6Address const & addr)
105 addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) &&
106 addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) &&
107 addr[4] == boost::uint8_t(a2>>8) && addr[5] == boost::uint8_t(a2) &&
108 addr[6] == boost::uint8_t(a3>>8) && addr[7] == boost::uint8_t(a3) &&
109 CheckINet6Network_impl4<a4,restbits>::match(addr[8],addr[9]);
112 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5,
113 unsigned a6, unsigned a7, unsigned restbits>
114 prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,5,restbits>::
115 match(INet6Address const & addr)
118 addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) &&
119 addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) &&
120 addr[4] == boost::uint8_t(a2>>8) && addr[5] == boost::uint8_t(a2) &&
121 addr[6] == boost::uint8_t(a3>>8) && addr[7] == boost::uint8_t(a3) &&
122 addr[8] == boost::uint8_t(a4>>8) && addr[9] == boost::uint8_t(a4) &&
123 CheckINet6Network_impl4<a5,restbits>::match(addr[10],addr[11]);
126 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5,
127 unsigned a6, unsigned a7, unsigned restbits>
128 prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,6,restbits>::
129 match(INet6Address const & addr)
132 addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) &&
133 addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) &&
134 addr[4] == boost::uint8_t(a2>>8) && addr[5] == boost::uint8_t(a2) &&
135 addr[6] == boost::uint8_t(a3>>8) && addr[7] == boost::uint8_t(a3) &&
136 addr[8] == boost::uint8_t(a4>>8) && addr[9] == boost::uint8_t(a4) &&
137 addr[10] == boost::uint8_t(a5>>8) && addr[11] == boost::uint8_t(a5) &&
138 CheckINet6Network_impl4<a6,restbits>::match(addr[12],addr[13]);
141 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5,
142 unsigned a6, unsigned a7, unsigned restbits>
143 prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,7,restbits>::
144 match(INet6Address const & addr)
147 addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) &&
148 addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) &&
149 addr[4] == boost::uint8_t(a2>>8) && addr[5] == boost::uint8_t(a2) &&
150 addr[6] == boost::uint8_t(a3>>8) && addr[7] == boost::uint8_t(a3) &&
151 addr[8] == boost::uint8_t(a4>>8) && addr[9] == boost::uint8_t(a4) &&
152 addr[10] == boost::uint8_t(a5>>8) && addr[11] == boost::uint8_t(a5) &&
153 addr[12] == boost::uint8_t(a6>>8) && addr[13] == boost::uint8_t(a6) &&
154 CheckINet6Network_impl4<a7,restbits>::match(addr[14],addr[15]);
159 //-/////////////////////////////////////////////////////////////////////////////////////////////////
166 // comment-column: 40
167 // c-file-style: "senf"
168 // indent-tabs-mode: nil
169 // ispell-local-dictionary: "american"
170 // compile-command: "scons -u test"