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 internal header */
17 #ifndef IH_SENF_Socket_Protocols_INet_INet6Address_
18 #define IH_SENF_Socket_Protocols_INet_INet6Address_ 1
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
32 template <unsigned a, unsigned bytes, unsigned restbits>
33 struct CheckINet6Network_impl5
37 struct CheckINet6Network_impl5<a,0,0>
39 static bool match(boost::uint8_t v0, boost::uint8_t v1);
42 template <unsigned a, unsigned restbits>
43 struct CheckINet6Network_impl5<a,0,restbits>
45 static bool match(boost::uint8_t v0, boost::uint8_t v1);
49 struct CheckINet6Network_impl5<a,1,0>
51 static bool match(boost::uint8_t v0, boost::uint8_t v1);
54 template <unsigned a, unsigned restbits>
55 struct CheckINet6Network_impl5<a,1,restbits>
57 static bool match(boost::uint8_t v0, boost::uint8_t v1);
60 template <unsigned a, unsigned bits>
61 struct CheckINet6Network_impl4
62 : public CheckINet6Network_impl5<a,bits/8,bits%8>
65 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4,
66 unsigned a5, unsigned a6, unsigned a7, unsigned words, unsigned restbits>
67 struct CheckINet6Network_impl3
70 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4,
71 unsigned a5, unsigned a6, unsigned a7, unsigned restbits>
72 struct CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,0,restbits>
74 static bool match(INet6Address const & addr);
77 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4,
78 unsigned a5, unsigned a6, unsigned a7, unsigned restbits>
79 struct CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,1,restbits>
81 static bool match(INet6Address const & addr);
84 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4,
85 unsigned a5, unsigned a6, unsigned a7, unsigned restbits>
86 struct CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,2,restbits>
88 static bool match(INet6Address const & addr);
91 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4,
92 unsigned a5, unsigned a6, unsigned a7, unsigned restbits>
93 struct CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,3,restbits>
95 static bool match(INet6Address const & addr);
98 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4,
99 unsigned a5, unsigned a6, unsigned a7, unsigned restbits>
100 struct CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,4,restbits>
102 static bool match(INet6Address const & addr);
105 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4,
106 unsigned a5, unsigned a6, unsigned a7, unsigned restbits>
107 struct CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,5,restbits>
109 static bool match(INet6Address const & addr);
112 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4,
113 unsigned a5, unsigned a6, unsigned a7, unsigned restbits>
114 struct CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,6,restbits>
116 static bool match(INet6Address const & addr);
119 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4,
120 unsigned a5, unsigned a6, unsigned a7, unsigned restbits>
121 struct CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,7,restbits>
123 static bool match(INet6Address const & addr);
126 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4,
127 unsigned a5, unsigned a6, unsigned a7, unsigned bits>
128 struct CheckINet6Network_impl2
129 : public CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,bits/16,bits%16>
132 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4,
133 unsigned a5, unsigned a6, unsigned a7, unsigned a8>
134 struct CheckINet6Network_impl
135 : public CheckINet6Network_impl2<a0,a1,a2,a3,a4,a5,a6,a7,a8>
138 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4,
139 unsigned a5, unsigned a6, unsigned a7>
140 struct CheckINet6Network_impl<a0,a1,a2,a3,a4,a5,a6,a7,0>
141 : public CheckINet6Network_impl2<a0,a1,a2,a3,a4,a5,a6,0,a7>
144 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4,
145 unsigned a5, unsigned a6>
146 struct CheckINet6Network_impl<a0,a1,a2,a3,a4,a5,a6,0,0>
147 : public CheckINet6Network_impl2<a0,a1,a2,a3,a4,a5,0,0,a6>
150 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4,
152 struct CheckINet6Network_impl<a0,a1,a2,a3,a4,a5,0,0,0>
153 : public CheckINet6Network_impl2<a0,a1,a2,a3,a4,0,0,0,a5>
156 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4>
157 struct CheckINet6Network_impl<a0,a1,a2,a3,a4,0,0,0,0>
158 : public CheckINet6Network_impl2<a0,a1,a2,a3,0,0,0,0,a4>
161 template <unsigned a0, unsigned a1, unsigned a2, unsigned a3>
162 struct CheckINet6Network_impl<a0,a1,a2,a3,0,0,0,0,0>
163 : public CheckINet6Network_impl2<a0,a1,a2,0,0,0,0,0,a3>
166 template <unsigned a0, unsigned a1, unsigned a2>
167 struct CheckINet6Network_impl<a0,a1,a2,0,0,0,0,0,0>
168 : public CheckINet6Network_impl2<a0,a1,0,0,0,0,0,0,a2>
171 template <unsigned a0, unsigned a1>
172 struct CheckINet6Network_impl<a0,a1,0,0,0,0,0,0,0>
173 : public CheckINet6Network_impl2<a0,0,0,0,0,0,0,0,a1>
178 boost::uint8_t low_bits_mask(unsigned bits);
180 template <class ForwardIterator, class Function>
181 void apply_mask(unsigned bits, ForwardIterator b, ForwardIterator e, Function fn);
183 template <class ForwardIterator1, class ForwardIterator2, class Function>
184 ForwardIterator1 find_if_mask(unsigned bits,
185 ForwardIterator1 b1, ForwardIterator1 e1, ForwardIterator2 b2,
190 //-/////////////////////////////////////////////////////////////////////////////////////////////////
197 // comment-column: 40
198 // c-file-style: "senf"
199 // indent-tabs-mode: nil
200 // ispell-local-dictionary: "american"
201 // compile-command: "scons -u test"