FreeRTOS
[armadillo_firmware.git] / FreeRTOS / Common / ethernet / lwIP / netif / ppp / vjbsdhdr.h
bloba7d180c16c80de16b992d13a8037ee210178557c
1 #ifndef VJBSDHDR_H
2 #define VJBSDHDR_H
4 #include "lwip/tcp.h"
7 /*
8 * Structure of an internet header, naked of options.
10 * We declare ip_len and ip_off to be short, rather than u_short
11 * pragmatically since otherwise unsigned comparisons can result
12 * against negative integers quite easily, and fail in subtle ways.
14 PACK_STRUCT_BEGIN
15 struct ip
17 #if defined(NO_CHAR_BITFIELDS)
18 u_char ip_hl_v; /* bug in GCC for mips means the bitfield stuff will sometimes break - so we use a char for both and get round it with macro's instead... */
19 #else
20 #if BYTE_ORDER == LITTLE_ENDIAN
21 unsigned ip_hl:4, /* header length */
22 ip_v:4; /* version */
23 #elif BYTE_ORDER == BIG_ENDIAN
24 unsigned ip_v:4, /* version */
25 ip_hl:4; /* header length */
26 #else
27 COMPLAIN - NO BYTE ORDER SELECTED!
28 #endif
29 #endif
30 u_char ip_tos; /* type of service */
31 u_short ip_len; /* total length */
32 u_short ip_id; /* identification */
33 u_short ip_off; /* fragment offset field */
34 #define IP_DF 0x4000 /* dont fragment flag */
35 #define IP_MF 0x2000 /* more fragments flag */
36 #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
37 u_char ip_ttl; /* time to live */
38 u_char ip_p; /* protocol */
39 u_short ip_sum; /* checksum */
40 struct in_addr ip_src,ip_dst; /* source and dest address */
42 PACK_STRUCT_END
44 typedef u32_t tcp_seq;
47 * TCP header.
48 * Per RFC 793, September, 1981.
50 PACK_STRUCT_BEGIN
51 struct tcphdr
53 u_short th_sport; /* source port */
54 u_short th_dport; /* destination port */
55 tcp_seq th_seq; /* sequence number */
56 tcp_seq th_ack; /* acknowledgement number */
57 #if defined(NO_CHAR_BITFIELDS)
58 u_char th_x2_off;
59 #else
60 #if BYTE_ORDER == LITTLE_ENDIAN
61 unsigned th_x2:4, /* (unused) */
62 th_off:4; /* data offset */
63 #endif
64 #if BYTE_ORDER == BIG_ENDIAN
65 unsigned th_off:4, /* data offset */
66 th_x2:4; /* (unused) */
67 #endif
68 #endif
69 u_char th_flags;
70 u_short th_win; /* window */
71 u_short th_sum; /* checksum */
72 u_short th_urp; /* urgent pointer */
74 PACK_STRUCT_END
76 #endif /* VJBSDHDR_H */