summaryrefslogtreecommitdiffstats
path: root/src/packet.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-03-27 22:43:19 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-03-27 22:43:19 +0200
commit3065f96f7b833701a03f5759bfc593a7f6943c4e (patch)
tree7413b460332130fc760f1c3a579a502e5e7454ea /src/packet.h
parent2190d635c1bb7d917c16b543b78d74a4ca9a735d (diff)
downloadfastd-3065f96f7b833701a03f5759bfc593a7f6943c4e.tar
fastd-3065f96f7b833701a03f5759bfc593a7f6943c4e.zip
New handshake format; don't respond to data packets from unknown peers with handshakes, but request a re-handshake
Diffstat (limited to 'src/packet.h')
-rw-r--r--src/packet.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/packet.h b/src/packet.h
index 0960cce..b99f7de 100644
--- a/src/packet.h
+++ b/src/packet.h
@@ -28,7 +28,6 @@
#ifndef _FASTD_PACKET_H_
#define _FASTD_PACKET_H_
-#include <asm/byteorder.h>
#include <stdint.h>
@@ -39,7 +38,8 @@ typedef enum _fastd_packet_type {
} fastd_packet_type;
typedef enum _fastd_handshake_record_type {
- RECORD_REPLY_CODE = 0,
+ RECORD_HANDSHAKE_TYPE = 0,
+ RECORD_REPLY_CODE,
RECORD_ERROR_DETAIL,
RECORD_FLAGS,
RECORD_MODE,
@@ -47,6 +47,13 @@ typedef enum _fastd_handshake_record_type {
RECORD_MAX,
} fastd_handshake_record_type;
+typedef enum _fastd_handshake_type {
+ HANDSHAKE_REQUEST = 0,
+ HANDSHAKE_REPLY,
+ HANDSHAKE_REHANDSHAKE_REQUEST,
+ HANDSHAKE_MAX,
+} fastd_handshake_type;
+
typedef enum _fastd_reply_code {
REPLY_SUCCESS = 0,
REPLY_MANDATORY_MISSING,
@@ -56,18 +63,7 @@ typedef enum _fastd_reply_code {
typedef struct __attribute__ ((__packed__)) _fastd_packet {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
- unsigned req_id : 6;
- unsigned cp : 1;
- unsigned reply : 1;
-#elif defined (__BIG_ENDIAN_BITFIELD)
- unsigned reply : 1;
- unsigned cp : 1;
- unsigned req_id : 6;
-#else
-#error "Bitfield endianess not defined."
-#endif
-
+ uint8_t req_id;
uint16_t rsv;
uint8_t tlv_data[];
} fastd_packet;