From 3065f96f7b833701a03f5759bfc593a7f6943c4e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 27 Mar 2012 22:43:19 +0200 Subject: New handshake format; don't respond to data packets from unknown peers with handshakes, but request a re-handshake --- src/packet.h | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src/packet.h') 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 #include @@ -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; -- cgit v1.2.3