a bunch of bug fixes (changed a bunch of cpu_to_net_u32 that should have been cpu_to_net_u16 and dropped the use of the __BYTE_ORDER__ symbol that no one was defining)

This commit is contained in:
cozis
2023-05-17 23:20:14 +02:00
parent df70d98661
commit 4de61f7cc7
6 changed files with 65 additions and 33 deletions
+3 -7
View File
@@ -21,19 +21,15 @@ typedef struct {
uint16_t dst_port;
uint32_t seq_no;
uint32_t ack_no;
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
uint8_t unused: 4;
uint8_t offset: 4;
#else
uint8_t offset: 4;
uint8_t unused: 4;
#endif
uint8_t offset1: 4; // When CPU is big endian
uint8_t offset2: 4; // When CPU is little endian
uint8_t flags;
uint16_t window;
uint16_t checksum;
uint16_t urgent_pointer;
char payload[];
} tcp_segment_t;
static_assert(sizeof(tcp_segment_t) == 20);
typedef struct tcp_connection_t tcp_connection_t;
typedef struct tcp_listener_t tcp_listener_t;