summaryrefslogtreecommitdiffstats
path: root/ffd/packet.h
diff options
context:
space:
mode:
Diffstat (limited to 'ffd/packet.h')
-rw-r--r--ffd/packet.h29
1 files changed, 9 insertions, 20 deletions
diff --git a/ffd/packet.h b/ffd/packet.h
index 9252c4e..a44824a 100644
--- a/ffd/packet.h
+++ b/ffd/packet.h
@@ -27,31 +27,20 @@
#ifndef _FFD_PACKET_H_
#define _FFD_PACKET_H_
-#include "util.h"
+#include "types.h"
-typedef enum _ffd_packet_type_t {
- PACKET_UNSPEC = 0,
- PACKET_ANNOUNCE,
- PACKET_ORIG,
-} ffd_packet_type_t;
+#define FFD_MAGIC 0xffd
+#define FFD_VERSION 0
-typedef struct __attribute__((packed)) _ffd_packet_head_t {
- uint8_t version;
- uint8_t type;
-} ffd_packet_head_t;
+#define FFD_VERSION_MAGIC ((FFD_MAGIC<<4)|FFD_VERSION)
-typedef struct __attribute__((packed)) _ffd_packet_announce_t {
- uint8_t version;
- uint8_t type;
- uint64_t self_rev;
- uint8_t flags;
- uint8_t n_origs;
- uint64_t origs[];
-} ffd_packet_announce_t;
+struct __attribute__((packed)) _ffd_packet_t {
+ uint16_t version_magic;
+ uint16_t len;
+ uint8_t tlv[0];
+};
-#define PACKET_ANNOUNCE_MAX_ORIGS 16
-#define PACKET_ANNOUNCE_SIZE(n_origs) (sizeof(ffd_packet_announce_t) + (n_origs)*sizeof(uint64_t))
#endif /* _FFD_PACKET_H_ */