]> git.sur5r.net Git - freertos/blob - Demo/Common/ethernet/lwIP_130/src/netif/ppp/vjbsdhdr.h
c641ee472266c3796ba22935760ed7a344f4a71b
[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 struct ip\r
15 {\r
16 #if defined(NO_CHAR_BITFIELDS)\r
17   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
18 #else\r
19 #if BYTE_ORDER == LITTLE_ENDIAN\r
20   unsigned ip_hl:4,              /* header length */\r
21            ip_v :4;              /* version */\r
22 #elif BYTE_ORDER == BIG_ENDIAN \r
23   unsigned ip_v :4,              /* version */\r
24            ip_hl:4;              /* header length */\r
25 #else\r
26   COMPLAIN - NO BYTE ORDER SELECTED!\r
27 #endif\r
28 #endif\r
29   u_char  ip_tos;                /* type of service */\r
30   u_short ip_len;                /* total length */\r
31   u_short ip_id;                 /* identification */\r
32   u_short ip_off;                /* fragment offset field */\r
33 #define  IP_DF 0x4000            /* dont fragment flag */\r
34 #define  IP_MF 0x2000            /* more fragments flag */\r
35 #define  IP_OFFMASK 0x1fff       /* mask for fragmenting bits */\r
36   u_char  ip_ttl;                /* time to live */\r
37   u_char  ip_p;                  /* protocol */\r
38   u_short ip_sum;                /* checksum */\r
39   struct  in_addr ip_src,ip_dst; /* source and dest address */\r
40 };\r
41 PACK_STRUCT_END\r
42 \r
43 typedef u32_t tcp_seq;\r
44 \r
45 /*\r
46  * TCP header.\r
47  * Per RFC 793, September, 1981.\r
48  */\r
49 PACK_STRUCT_BEGIN\r
50 struct tcphdr  \r
51 {\r
52   u_short  th_sport;    /* source port */\r
53   u_short  th_dport;    /* destination port */\r
54   tcp_seq  th_seq;      /* sequence number */\r
55   tcp_seq  th_ack;      /* acknowledgement number */\r
56 #if defined(NO_CHAR_BITFIELDS)\r
57   u_char   th_x2_off;\r
58 #else\r
59 #if BYTE_ORDER == LITTLE_ENDIAN\r
60   unsigned th_x2 :4,    /* (unused) */\r
61            th_off:4;    /* data offset */\r
62 #endif\r
63 #if BYTE_ORDER == BIG_ENDIAN \r
64   unsigned th_off:4,    /* data offset */\r
65            th_x2 :4;    /* (unused) */\r
66 #endif\r
67 #endif\r
68   u_char   th_flags;\r
69   u_short  th_win;      /* window */\r
70   u_short  th_sum;      /* checksum */\r
71   u_short  th_urp;      /* urgent pointer */\r
72 };\r
73 PACK_STRUCT_END\r
74 \r
75 #endif /* VJBSDHDR_H */\r