]> mj.ucw.cz Git - nwho.git/blobdiff - nwho.h
More work on bringing the Debian packaging up to date
[nwho.git] / nwho.h
diff --git a/nwho.h b/nwho.h
index 23fdf3088f09bf5b986752a6b9fc92347cc8ecbb..69bc7a469b5ea3bc8aceca1dd4541b34487cb326 100644 (file)
--- a/nwho.h
+++ b/nwho.h
@@ -5,6 +5,7 @@
  */
 
 #include <inttypes.h>
+#include <netinet/in.h>
 
 typedef uint32_t u32;
 
@@ -37,3 +38,15 @@ struct nwho_pkt {
 #define DEFAULT_PRUNE_TIME 30
 #define DEFAULT_DOWN_TIME 120
 #define DEFAULT_DEAD_TIME 4*86400
+
+#define STRINGIFY(x) STRINGIFY2(x)
+#define STRINGIFY2(x) #x
+
+static inline int nwho_pkt_size(struct nwho_pkt *pkt)
+{
+  return sizeof(struct nwho_pkt) - (MAX_USERS - ntohl(pkt->num_users))*sizeof(struct userinfo);
+}
+
+/* util.c */
+
+void die(char *msg, ...) __attribute__((noreturn));