From 142689dcb7407536cab5ef544dc18f5486b6a805 Mon Sep 17 00:00:00 2001 From: Avril Date: Sun, 19 May 2019 10:39:30 +0100 Subject: [PATCH] switched to fixed size message headers --- libsipc/include/sipc.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libsipc/include/sipc.h b/libsipc/include/sipc.h index 75ca030..7d7f26e 100644 --- a/libsipc/include/sipc.h +++ b/libsipc/include/sipc.h @@ -29,14 +29,19 @@ typedef enum { #define _SI_HEADER_CHECK 0xbeefbeefabad1deaul typedef struct { - si_type type; - unsigned int flags; - unsigned int data_len; - unsigned long check0; + union { + si_type type; + uint32_t __pad; + }; + uint32_t flags; + uint32_t data_len; + uint64_t check0; uint64_t check; - unsigned char data[]; + uint8_t data[]; } si_message; +_Static_assert(sizeof(union { si_type t0; uint32_t pad;}) == sizeof(uint32_t), "packing error: sizeof(enum)!=sizeof(uint32_t)"); + #define SIEF_WARNING 0xaff000 typedef enum { SIE_ACCEPT= 0, //Sock accept failure