PPI: Checkin of first compiling (yet not working) version
[senf.git] / Socket / Protocols / INet / INet4Address.cti
index e13fdbb..d731ce3 100644 (file)
@@ -1,3 +1,5 @@
+// $Id$
+//
 // Copyright (C) 2007 
 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
 //#include "INet4Address.ih"
 
 // Custom includes
+#include <boost/integer/integer_mask.hpp>
 
 #define prefix_ inline
 ///////////////////////////////cti.p///////////////////////////////////////
 
 ///////////////////////////////////////////////////////////////////////////
-// senf::INet4Address
+// senf::CheckINet4Network<address,prefix_len>
 
-template <class InputIterator>
-prefix_ senf::INet4Address senf::INet4Address::from_data(InputIterator i)
+template <boost::uint32_t address, unsigned prefix_len>
+prefix_ bool senf::CheckINet4Network<address,prefix_len>::match(INet4Address const & addr)
 {
-    address_type v ((address_type(*i)&0xFF) << 24);
-    v |= (address_type(*++i)&0xFF) << 16;
-    v |= (address_type(*++i)&0xFF) <<  8;
-    v |= (address_type(*++i)&0xFF);
-    return senf::INet4Address(v);
+    return (addr.address() & ~boost::uint32_t(boost::low_bits_mask_t<32-prefix_len>::sig_bits)) ==
+        (address & ~boost::uint32_t(boost::low_bits_mask_t<32-prefix_len>::sig_bits));
 }
 
 ///////////////////////////////cti.e///////////////////////////////////////