]> git.sur5r.net Git - freertos/blob - Demo/Common/ethernet/lwIP_130/src/netif/ppp/vjbsdhdr.h
Added extra compiler specific structure packing options.
[freertos] / Demo / Common / ethernet / lwIP_130 / src / netif / ppp / vjbsdhdr.h
1 #ifndef VJBSDHDR_H\r
2 #define VJBSDHDR_H\r
3 \r
4 #include "lwip/tcp.h"\r
5 \r
6 /*\r
7  * Structure of an internet header, naked of options.\r
8  *\r
9  * We declare ip_len and ip_off to be short, rather than u_short\r
10  * pragmatically since otherwise unsigned comparisons can result\r
11  * against negative integers quite easily, and fail in subtle ways.\r
12  */\r
13 PACK_STRUCT_BEGIN\r
14 #if (defined(__MWERKS__)  || defined(__CWCC__))\r
15         #pragma options align= packed\r
16 #endif\r
17 struct ip\r
18 {\r
19 #if defined(NO_CHAR_BITFIELDS)\r
20   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... */\r
21 #else\r
22 #if BYTE_ORDER == LITTLE_ENDIAN\r
23   unsigned ip_hl:4,              /* header length */\r
24            ip_v :4;              /* version */\r
25 #elif BYTE_ORDER == BIG_ENDIAN \r
26   unsigned ip_v :4,              /* version */\r
27            ip_hl:4;              /* header length */\r
28 #else\r
29   COMPLAIN - NO BYTE ORDER SELECTED!\r
30 #endif\r
31 #endif\r
32   u_char  ip_tos;                /* type of service */\r
33   u_short ip_len;                /* total length */\r
34   u_short ip_id;                 /* identification */\r
35   u_short ip_off;                /* fragment offset field */\r
36 #define  IP_DF 0x4000            /* dont fragment flag */\r
37 #define  IP_MF 0x2000            /* more fragments flag */\r
38 #define  IP_OFFMASK 0x1fff       /* mask for fragmenting bits */\r
39   u_char  ip_ttl;                /* time to live */\r
40   u_char  ip_p;                  /* protocol */\r
41   u_short ip_sum;                /* checksum */\r
42   struct  in_addr ip_src,ip_dst; /* source and dest address */\r
43 };\r
44 PACK_STRUCT_END\r
45 \r
46 typedef u32_t tcp_seq;\r
47 \r
48 /*\r
49  * TCP header.\r
50  * Per RFC 793, September, 1981.\r
51  */\r
52 PACK_STRUCT_BEGIN\r
53 #if (defined(__MWERKS__)  || defined(__CWCC__))\r
54         #pragma options align= packed\r
55 #endif\r
56 struct tcphdr  \r
57 {\r
58   u_short  th_sport;    /* source port */\r
59   u_short  th_dport;    /* destination port */\r
60   tcp_seq  th_seq;      /* sequence number */\r
61   tcp_seq  th_ack;      /* acknowledgement number */\r
62 #if defined(NO_CHAR_BITFIELDS)\r
63   u_char   th_x2_off;\r
64 #else\r
65 #if BYTE_ORDER == LITTLE_ENDIAN\r
66   unsigned th_x2 :4,    /* (unused) */\r
67            th_off:4;    /* data offset */\r
68 #endif\r
69 #if BYTE_ORDER == BIG_ENDIAN \r
70   unsigned th_off:4,    /* data offset */\r
71            th_x2 :4;    /* (unused) */\r
72 #endif\r
73 #endif\r
74   u_char   th_flags;\r
75   u_short  th_win;      /* window */\r
76   u_short  th_sum;      /* checksum */\r
77   u_short  th_urp;      /* urgent pointer */\r
78 };\r
79 PACK_STRUCT_END\r
80 \r
81 #endif /* VJBSDHDR_H */\r