if defined __GNUC__ define PACKED __attribute__ packed else error Unkn

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#if defined __GNUC__
#define PACKED __attribute__((packed))
#else
#error Unknown compiler, modify types.h for it
#endif
...
typedef struct socks4_req_t {
uint8_t ver;
uint8_t cmd;
uint16_t port;
uint32_t addr;
char login[1]; // we need at least zero-byte
} PACKED socks4_req;