diff --git a/src/serialize.h b/src/serialize.h
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -71,6 +71,11 @@
     s.write((char *)&obj, 4);
 }
 template <typename Stream>
+inline void ser_writedata32be(Stream &s, uint32_t obj) {
+    obj = htobe32(obj);
+    s.write((char *)&obj, 4);
+}
+template <typename Stream>
 inline void ser_writedata64(Stream &s, uint64_t obj) {
     obj = htole64(obj);
     s.write((char *)&obj, 8);
@@ -90,6 +95,11 @@
     s.read((char *)&obj, 4);
     return le32toh(obj);
 }
+template <typename Stream> inline uint32_t ser_readdata32be(Stream &s) {
+    uint32_t obj;
+    s.read((char *)&obj, 4);
+    return be32toh(obj);
+}
 template <typename Stream> inline uint64_t ser_readdata64(Stream &s) {
     uint64_t obj;
     s.read((char *)&obj, 8);