From 13281109e3658f2c91af248ed96970c896ab4e14 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 11 Apr 2024 16:44:16 +0200 Subject: [PATCH] decode/tcp: reduce TCPVars by turning bools into bitfields To reduce Packet size and make similar fields follow the same pattern. Ticket: #6938. --- src/decode-tcp.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/decode-tcp.h b/src/decode-tcp.h index 4b31514455..c0ce5c20d2 100644 --- a/src/decode-tcp.h +++ b/src/decode-tcp.h @@ -162,20 +162,20 @@ typedef struct TCPHdr_ typedef struct TCPVars_ { /* commonly used and needed opts */ - bool md5_option_present; - bool ao_option_present; - bool ts_set; - bool sack_ok; - bool mss_set; - bool tfo_set; + uint8_t md5_option_present : 1; + uint8_t ao_option_present : 1; + uint8_t ts_set : 1; + uint8_t sack_ok : 1; + uint8_t mss_set : 1; + uint8_t tfo_set : 1; uint8_t wscale_set : 1; - uint8_t wscale : 4; - uint16_t mss; /**< MSS value in host byte order */ + uint8_t sack_set : 1; + uint8_t wscale; + uint8_t sack_cnt; /**< number of sack records */ + uint16_t mss; /**< MSS value in host byte order */ uint16_t stream_pkt_flags; uint32_t ts_val; /* host-order */ uint32_t ts_ecr; /* host-order */ - bool sack_set; - uint8_t sack_cnt; /**< number of sack records */ uint16_t sack_offset; /**< offset relative to tcp header start */ } TCPVars;