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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [tcpip/] [v2_0/] [include/] [netinet6/] [ipv6.h] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      include/netinet6_ipv6.h
4
//
5
//      
6
//
7
//==========================================================================
8
//####BSDCOPYRIGHTBEGIN####
9
//
10
// -------------------------------------------
11
//
12
// Portions of this software may have been derived from OpenBSD or other sources,
13
// and are covered by the appropriate copyright disclaimers included herein.
14
//
15
// -------------------------------------------
16
//
17
//####BSDCOPYRIGHTEND####
18
//==========================================================================
19
//#####DESCRIPTIONBEGIN####
20
//
21
// Author(s):    gthomas
22
// Contributors: gthomas
23
// Date:         2000-01-10
24
// Purpose:      
25
// Description:  
26
//              
27
//
28
//####DESCRIPTIONEND####
29
//
30
//==========================================================================
31
 
32
 
33
/*
34
%%% copyright-nrl-95
35
This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
36
Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All
37
rights under this copyright have been assigned to the US Naval Research
38
Laboratory (NRL). The NRL Copyright Notice and License Agreement Version
39
1.1 (January 17, 1995) applies to this software.
40
You should have received a copy of the license with this software. If you
41
didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
42
 
43
*/
44
 
45
#ifndef _NETINET6_IPV6_H
46
#define _NETINET6_IPV6_H 1
47
 
48
#define IPV6VERSION 6
49
 
50
/*
51
 * Header structures.
52
 */
53
 
54
struct ipv6
55
{
56
  uint32_t ipv6_versfl;      /* Version and flow label word. */
57
 
58
  uint16_t ipv6_length;      /* Datagram length (not including the length
59
                               of this header). */
60
  uint8_t ipv6_nexthdr;      /* Next header type. */
61
  uint8_t ipv6_hoplimit;     /* Hop limit. */
62
 
63
  struct in6_addr ipv6_src; /* Source address. */
64
  struct in6_addr ipv6_dst; /* Destination address. */
65
};
66
 
67
#if __linux__
68
#include <endian.h>
69
#else /* __linux__ */
70
#include <machine/endian.h>
71
#endif /* __linux__ */
72
 
73
struct ipv6hdr {
74
#if BYTE_ORDER == LITTLE_ENDIAN
75
  uint8_t ipv6_priority:4; /* going away? */
76
  uint8_t ipv6_version:4;
77
  uint32_t ipv6_flowid:24;
78
#elif BYTE_ORDER == BIG_ENDIAN
79
  uint32_t ipv6_flowid:24;
80
  uint8_t ipv6_priority:4; /* going away? */
81
  uint8_t ipv6_version:4;
82
#else
83
#error "Don't know what endian to use."
84
#endif
85
  uint16_t ipv6_len;
86
  uint8_t ipv6_nextheader;
87
  uint8_t ipv6_hoplimit;
88
  struct in6_addr ipv6_src;   /* source address */
89
  struct in6_addr ipv6_dst;   /* destination address */
90
};
91
 
92
/*
93
 * Macros and defines for header fields, and values thereof.
94
 * Assume things are in host order for these three macros.
95
 */
96
 
97
#define IPV6_VERSION(h) ((h)->ipv6_versfl >> 28)
98
#define IPV6_PRIORITY(h)  (((h)->ipv6_versfl & 0x0f000000) >> 24)
99
#define IPV6_FLOWID(h)  ((h)->ipv6_versfl & 0x00ffffff)
100
 
101
#define MAXHOPLIMIT 64
102
#define IPV6_MINMTU 576
103
 
104
/*
105
 * Other IPv6 header definitions.
106
 */
107
 
108
/* Fragmentation header & macros for it.  NOTE:  Host order assumption. */
109
 
110
struct ipv6_fraghdr
111
{
112
  uint8_t frag_nexthdr;      /* Next header type. */
113
  uint8_t frag_reserved;
114
  uint16_t frag_bitsoffset;  /* More bit and fragment offset. */
115
  uint32_t frag_id;          /* Fragment identifier. */
116
};
117
 
118
#define FRAG_MOREMASK 0x1
119
#define FRAG_OFFMASK 0xFFF8
120
#define FRAG_MORE_BIT(fh)       ((fh)->frag_bitsoffset & FRAG_MOREMASK)
121
#define FRAG_OFFSET(fh)         ((fh)->frag_bitsoffset & FRAG_OFFMASK)
122
 
123
/* Source routing header.  Host order assumption for macros. */
124
 
125
struct ipv6_srcroute0
126
{
127
  uint8_t i6sr_nexthdr;    /* Next header type. */
128
  uint8_t i6sr_len;        /* RH len in 8-byte addrs, !incl this structure */
129
  uint8_t i6sr_type;       /* Routing type, should be 0 */
130
  uint8_t i6sr_left;       /* Segments left */
131
  uint32_t i6sr_reserved;  /* 8 bits of reserved padding. */
132
};
133
 
134
#define I6SR_BITMASK(i6sr)      ((i6sr)->i6sr_reserved & 0xffffff)
135
 
136
/* Options header.  For "ignoreable" options. */
137
 
138
struct ipv6_opthdr
139
{
140
  uint8_t oh_nexthdr;        /* Next header type. */
141
  uint8_t oh_extlen;         /* Header extension length. */
142
  uint8_t oh_data[6];        /* Option data, may be reserved for
143
                               alignment purposes. */
144
};
145
 
146
#define OPT_PAD1 0
147
#define OPT_PADN 1
148
#define OPT_JUMBO 194
149
 
150
struct ipv6_option
151
{
152
  uint8_t opt_type;      /* Option type. */
153
  uint8_t opt_datalen;   /* Option data length. */
154
  uint8_t opt_data[1];   /* Option data. */
155
};
156
#endif /* _NETINET6_IPV6_H */

powered by: WebSVN 2.1.0

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