diff options
author | Waldemar Brodkorb <wbx@openadk.org> | 2017-06-22 22:20:20 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2017-06-22 23:47:24 +0200 |
commit | 58a5ba12bffad5916d9897c2870fc483f1db8282 (patch) | |
tree | 5a8f178deea7839831d275f968254fd9b944a4dd /include/netinet | |
parent | cdc93474623ced1357303ef2ac8e96b65d37615d (diff) |
remove __FAVOR_BSD
Remove __FAVOR_BSD and sync with GNU C library
Some issues compiling knock application fixed.
Reported-By: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'include/netinet')
-rw-r--r-- | include/netinet/tcp.h | 123 | ||||
-rw-r--r-- | include/netinet/udp.h | 33 |
2 files changed, 80 insertions, 76 deletions
diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h index 04032bb68..ade01cd0d 100644 --- a/include/netinet/tcp.h +++ b/include/netinet/tcp.h @@ -65,75 +65,78 @@ #ifdef __USE_MISC # include <sys/types.h> # include <sys/socket.h> +# include <stdint.h> -# ifdef __FAVOR_BSD -typedef u_int32_t tcp_seq; +typedef uint32_t tcp_seq; /* * TCP header. * Per RFC 793, September, 1981. */ struct tcphdr { - u_int16_t th_sport; /* source port */ - u_int16_t th_dport; /* destination port */ - tcp_seq th_seq; /* sequence number */ - tcp_seq th_ack; /* acknowledgement number */ -# if __BYTE_ORDER == __LITTLE_ENDIAN - u_int8_t th_x2:4; /* (unused) */ - u_int8_t th_off:4; /* data offset */ -# endif -# if __BYTE_ORDER == __BIG_ENDIAN - u_int8_t th_off:4; /* data offset */ - u_int8_t th_x2:4; /* (unused) */ -# endif - u_int8_t th_flags; -# define TH_FIN 0x01 -# define TH_SYN 0x02 -# define TH_RST 0x04 -# define TH_PUSH 0x08 -# define TH_ACK 0x10 -# define TH_URG 0x20 - u_int16_t th_win; /* window */ - u_int16_t th_sum; /* checksum */ - u_int16_t th_urp; /* urgent pointer */ + __extension__ union + { + struct + { + uint16_t th_sport; /* source port */ + uint16_t th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ +# if __BYTE_ORDER == __LITTLE_ENDIAN + uint8_t th_x2:4; /* (unused) */ + uint8_t th_off:4; /* data offset */ +# endif +# if __BYTE_ORDER == __BIG_ENDIAN + uint8_t th_off:4; /* data offset */ + uint8_t th_x2:4; /* (unused) */ +# endif + uint8_t th_flags; +# define TH_FIN 0x01 +# define TH_SYN 0x02 +# define TH_RST 0x04 +# define TH_PUSH 0x08 +# define TH_ACK 0x10 +# define TH_URG 0x20 + uint16_t th_win; /* window */ + uint16_t th_sum; /* checksum */ + uint16_t th_urp; /* urgent pointer */ + }; + struct + { + uint16_t source; + uint16_t dest; + uint32_t seq; + uint32_t ack_seq; +# if __BYTE_ORDER == __LITTLE_ENDIAN + uint16_t res1:4; + uint16_t doff:4; + uint16_t fin:1; + uint16_t syn:1; + uint16_t rst:1; + uint16_t psh:1; + uint16_t ack:1; + uint16_t urg:1; + uint16_t res2:2; +# elif __BYTE_ORDER == __BIG_ENDIAN + uint16_t doff:4; + uint16_t res1:4; + uint16_t res2:2; + uint16_t urg:1; + uint16_t ack:1; + uint16_t psh:1; + uint16_t rst:1; + uint16_t syn:1; + uint16_t fin:1; +# else +# error "Adjust your <bits/endian.h> defines" +# endif + uint16_t window; + uint16_t check; + uint16_t urg_ptr; + }; + }; }; -# else /* !__FAVOR_BSD */ -struct tcphdr - { - u_int16_t source; - u_int16_t dest; - u_int32_t seq; - u_int32_t ack_seq; -# if __BYTE_ORDER == __LITTLE_ENDIAN - u_int16_t res1:4; - u_int16_t doff:4; - u_int16_t fin:1; - u_int16_t syn:1; - u_int16_t rst:1; - u_int16_t psh:1; - u_int16_t ack:1; - u_int16_t urg:1; - u_int16_t res2:2; -# elif __BYTE_ORDER == __BIG_ENDIAN - u_int16_t doff:4; - u_int16_t res1:4; - u_int16_t res2:2; - u_int16_t urg:1; - u_int16_t ack:1; - u_int16_t psh:1; - u_int16_t rst:1; - u_int16_t syn:1; - u_int16_t fin:1; -# else -# error "Adjust your <bits/endian.h> defines" -# endif - u_int16_t window; - u_int16_t check; - u_int16_t urg_ptr; -}; -# endif /* __FAVOR_BSD */ - enum { TCP_ESTABLISHED = 1, diff --git a/include/netinet/udp.h b/include/netinet/udp.h index 7d4976885..ac6f23413 100644 --- a/include/netinet/udp.h +++ b/include/netinet/udp.h @@ -52,27 +52,28 @@ /* UDP header as specified by RFC 768, August 1980. */ -#ifdef __FAVOR_BSD struct udphdr { - u_int16_t uh_sport; /* source port */ - u_int16_t uh_dport; /* destination port */ - u_int16_t uh_ulen; /* udp length */ - u_int16_t uh_sum; /* udp checksum */ + __extension__ union + { + struct + { + uint16_t uh_sport; /* source port */ + uint16_t uh_dport; /* destination port */ + uint16_t uh_ulen; /* udp length */ + uint16_t uh_sum; /* udp checksum */ + }; + struct + { + uint16_t source; + uint16_t dest; + uint16_t len; + uint16_t check; + }; + }; }; -#else - -struct udphdr -{ - u_int16_t source; - u_int16_t dest; - u_int16_t len; - u_int16_t check; -}; -#endif - /* UDP socket options */ #define UDP_CORK 1 /* Never send partially complete segments. */ #define UDP_ENCAP 100 /* Set the socket to accept |