Move sourcecode into 'senf/' directory
[senf.git] / senf / Socket / Protocols / INet / INet6Address.cti
diff --git a/senf/Socket/Protocols/INet/INet6Address.cti b/senf/Socket/Protocols/INet/INet6Address.cti
new file mode 100644 (file)
index 0000000..1947b12
--- /dev/null
@@ -0,0 +1,180 @@
+// $Id$
+//
+// Copyright (C) 2007
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+//     Stefan Bund <g0dil@berlios.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+/** \file
+    \brief INet6Address inline template implementation */
+
+#include "INet6Address.ih"
+
+// Custom includes
+#include <boost/integer/integer_mask.hpp>
+
+#define prefix_ inline
+///////////////////////////////cti.p///////////////////////////////////////
+
+#ifndef DOXYGEN
+
+template <unsigned a>
+prefix_ bool senf::detail::CheckINet6Network_impl5<a,0,0>::match(boost::uint8_t v0,
+                                                                 boost::uint8_t v1)
+{
+    return true;
+}
+
+template <unsigned a, unsigned restbits>
+prefix_ bool senf::detail::CheckINet6Network_impl5<a,0,restbits>::match(boost::uint8_t v0,
+                                                                        boost::uint8_t v1)
+{
+    return v0 & ~boost::low_bits_mask_t<8-restbits>::sig_bits 
+        == boost::uint8_t(a>>8) & ~boost::low_bits_mask_t<8-restbits>::sig_bits;
+}
+
+template <unsigned a>
+prefix_ bool senf::detail::CheckINet6Network_impl5<a,1,0>::match(boost::uint8_t v0,
+                                                                 boost::uint8_t v1)
+{
+    return v0 == boost::uint8_t(a>>8);
+}
+
+template <unsigned a, unsigned restbits>
+prefix_ bool senf::detail::CheckINet6Network_impl5<a,1,restbits>::match(boost::uint8_t v0,
+                                                                        boost::uint8_t v1)
+{
+    return v0 == boost::uint8_t(a>>8) &&
+        v1 & ~boost::low_bits_mask_t<8-restbits>::sig_bits 
+            == boost::uint8_t(a) & ~boost::low_bits_mask_t<8-restbits>::sig_bits;
+}
+
+template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5, 
+          unsigned a6, unsigned a7, unsigned restbits>
+prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,0,restbits>::
+match(INet6Address const & addr)
+{
+    return CheckINet6Network_impl4<a0,restbits>::match(addr[0],addr[1]);
+}
+
+template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5, 
+          unsigned a6, unsigned a7, unsigned restbits>
+prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,1,restbits>::
+match(INet6Address const & addr)
+{
+    return 
+        addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) &&
+        CheckINet6Network_impl4<a1,restbits>::match(addr[2],addr[3]);
+}
+
+template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5, 
+          unsigned a6, unsigned a7, unsigned restbits>
+prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,2,restbits>::
+match(INet6Address const & addr)
+{
+    return 
+        addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) &&
+        addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) &&
+        CheckINet6Network_impl4<a1,restbits>::match(addr[4],addr[5]);
+}
+
+template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5, 
+          unsigned a6, unsigned a7, unsigned restbits>
+prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,3,restbits>::
+match(INet6Address const & addr)
+{
+    return 
+        addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) &&
+        addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) &&
+        addr[4] == boost::uint8_t(a2>>8) && addr[5] == boost::uint8_t(a2) &&
+        CheckINet6Network_impl4<a3,restbits>::match(addr[6],addr[7]);
+}
+
+template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5, 
+          unsigned a6, unsigned a7, unsigned restbits>
+prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,4,restbits>::
+match(INet6Address const & addr)
+{
+    return 
+        addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) &&
+        addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) &&
+        addr[4] == boost::uint8_t(a2>>8) && addr[5] == boost::uint8_t(a2) &&
+        addr[6] == boost::uint8_t(a3>>8) && addr[7] == boost::uint8_t(a3) &&
+        CheckINet6Network_impl4<a4,restbits>::match(addr[8],addr[9]);
+}
+
+template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5, 
+          unsigned a6, unsigned a7, unsigned restbits>
+prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,5,restbits>::
+match(INet6Address const & addr)
+{
+    return 
+        addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) &&
+        addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) &&
+        addr[4] == boost::uint8_t(a2>>8) && addr[5] == boost::uint8_t(a2) &&
+        addr[6] == boost::uint8_t(a3>>8) && addr[7] == boost::uint8_t(a3) &&
+        addr[8] == boost::uint8_t(a4>>8) && addr[9] == boost::uint8_t(a4) &&
+        CheckINet6Network_impl4<a5,restbits>::match(addr[10],addr[11]);
+}
+
+template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5, 
+          unsigned a6, unsigned a7, unsigned restbits>
+prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,6,restbits>::
+match(INet6Address const & addr)
+{
+    return 
+        addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) &&
+        addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) &&
+        addr[4] == boost::uint8_t(a2>>8) && addr[5] == boost::uint8_t(a2) &&
+        addr[6] == boost::uint8_t(a3>>8) && addr[7] == boost::uint8_t(a3) &&
+        addr[8] == boost::uint8_t(a4>>8) && addr[9] == boost::uint8_t(a4) &&
+        addr[10] == boost::uint8_t(a5>>8) && addr[11] == boost::uint8_t(a5) &&
+        CheckINet6Network_impl4<a6,restbits>::match(addr[12],addr[13]);
+}
+
+template <unsigned a0, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5, 
+          unsigned a6, unsigned a7, unsigned restbits>
+prefix_ bool senf::detail::CheckINet6Network_impl3<a0,a1,a2,a3,a4,a5,a6,a7,7,restbits>::
+match(INet6Address const & addr)
+{
+    return 
+        addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) &&
+        addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) &&
+        addr[4] == boost::uint8_t(a2>>8) && addr[5] == boost::uint8_t(a2) &&
+        addr[6] == boost::uint8_t(a3>>8) && addr[7] == boost::uint8_t(a3) &&
+        addr[8] == boost::uint8_t(a4>>8) && addr[9] == boost::uint8_t(a4) &&
+        addr[10] == boost::uint8_t(a5>>8) && addr[11] == boost::uint8_t(a5) &&
+        addr[12] == boost::uint8_t(a6>>8) && addr[13] == boost::uint8_t(a6) &&
+        CheckINet6Network_impl4<a7,restbits>::match(addr[14],addr[15]);
+}
+
+#endif
+
+///////////////////////////////cti.e///////////////////////////////////////
+#undef prefix_
+
+\f
+// 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: