]> mj.ucw.cz Git - nwho.git/blobdiff - nwho.h
Moved calculation of packet size to an extra function
[nwho.git] / nwho.h
diff --git a/nwho.h b/nwho.h
index 1c22c54f4e611b14768e0b6e7e49d9b4509d0dad..8413e9d19a59927f68f7fd969c32b3586eea45f0 100644 (file)
--- a/nwho.h
+++ b/nwho.h
@@ -40,3 +40,8 @@ struct nwho_pkt {
 
 #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);
+}