--- a/src/lib/misc.h Sun Oct 12 01:09:00 2008 +0300
+++ b/src/lib/misc.h Sun Oct 12 14:57:06 2008 +0300
@@ -1,10 +1,24 @@
#ifndef LIB_UTIL_H
#define LIB_UTIL_H
+#include <arpa/inet.h>
+
/*
* Initialize the given *value* with zeros
*/
#define ZINIT(obj) memset(&(obj), 0, sizeof((obj)))
+/*
+ * 64-bit hton{s,l,q}
+ */
+#ifndef WORDS_BIGENDIAN /* i.e. if (little endian) */
+#define htonq(x) (((uint64_t)htonl((x)>>32))|(((uint64_t)htonl(x))<<32))
+#define ntohq(x) htonq(x)
+#else
+#define htonq(x) ((uint64_t)(x))
+#define ntohq(x) ((uint64_t)(x))
+#endif
+
+
#endif /* LIB_UTIL_H */