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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [tcpip/] [current/] [include/] [netinet6/] [ipv6.h] - Blame information for rev 792

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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