senfscons: Fix 'Object' build helper to work with empty source list in SCons 0.96.1
[senf.git] / Packets / DefaultBundle / UDPPacket.hh
index 5ea93db..1e566a1 100644 (file)
 // Free Software Foundation, Inc.,
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+/** \file
+    \brief UDPPacket public header */
+
 #ifndef HH_UDPPacket_
 #define HH_UDPPacket_ 1
 
 // Custom includes
-#include "Packets/Packets.hh"
+#include "../../Packets/Packets.hh"
 
 //#include "UDPPacket.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
@@ -50,16 +53,21 @@ namespace senf {
             ((Field)( source,      Parse_16bit ))
             ((Field)( destination, Parse_16bit ))
             ((Field)( length,      Parse_16bit ))
-            ((Field)( crc,         Parse_16bit )) );
+            ((Field)( checksum,    Parse_16bit )) );
 
 #       else
 
         Parse_16bit source();
         Parse_16bit destination();
         Parse_16bit length();
-        Parse_16bit crc();
+        Parse_16bit checksum();
 
 #       endif
+
+        boost::uint16_t calcChecksum() const;
+        bool validateChecksum() const {
+            return checksum() == 0u || checksum() == calcChecksum();
+        }
     };
 
     /** \brief UDP packet
@@ -85,6 +93,8 @@ namespace senf {
         using mixin::init;
 
         static void dump(packet p, std::ostream & os);
+
+        static void finalize(packet p);
     };
 
     /** \brief UDP packet typedef */