OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [Common/] [ethernet/] [lwIP_130/] [src/] [netif/] [ppp/] [vjbsdhdr.h] - Blame information for rev 606

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.