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_icmp.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_icmp.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_ICMP_H
43
#define _NETINET6_IPV6_ICMP_H 1
44
 
45
/*
46
 * ICMPv6 header.
47
 */
48
 
49
struct ipv6_icmp
50
{
51
  uint8_t icmp_type;
52
  uint8_t icmp_code;
53
  uint16_t icmp_cksum;
54
  union
55
    {
56
      uint32_t ih_reserved;
57
      struct
58
        {
59
          uint16_t ihs_id;
60
          uint16_t ihs_seq;
61
        } ih_idseq;
62
      struct
63
        {
64
          uint8_t ihr_hoplimit;
65
          uint8_t ihr_bits;
66
          uint16_t ihr_lifetime;
67
        } ih_radv;
68
    } icmp_hun;
69
#define icmp_unused icmp_hun.ih_reserved
70
#define icmp_nexthopmtu icmp_hun.ih_reserved
71
#define icmp_paramptr icmp_hun.ih_reserved
72
#define icmp_echoid icmp_hun.ih_idseq.ihs_id
73
#define icmp_echoseq icmp_hun.ih_idseq.ihs_seq
74
#define icmp_grpdelay icmp_hun.ih_idseq.ihs_id
75
#define icmp_grpunused icmp_hun.ih_idseq.ihs_seq
76
#define icmp_nadvbits icmp_hun.ih_reserved
77
#define icmp_radvhop icmp_hun.ih_radv.ihr_hoplimit
78
#define icmp_radvbits icmp_hun.ih_radv.ihr_bits
79
#define icmp_radvlifetime icmp_hun.ih_radv.ihr_lifetime
80
  union
81
    {
82
      struct
83
        {
84
          struct ipv6 ido_ipv6;
85
          uint8_t ido_remaining[1];
86
        } id_offending;
87
      uint8_t id_data[1];
88
      struct
89
        {
90
          struct in6_addr idn_addr;
91
          uint8_t idn_ext[1];
92
        } id_neighbor;
93
      struct
94
        {
95
          struct in6_addr idr_addr1;
96
          struct in6_addr idr_addr2;
97
          uint8_t idr_ext[1];
98
        } id_redirect;
99
      struct
100
        {
101
          uint32_t ida_reachable;
102
          uint32_t ida_retrans;
103
          uint8_t ida_opt[1];
104
        } id_radv;
105
    } icmp_dun;
106
#define icmp_offending icmp_dun.id_offending
107
#define icmp_ipv6 icmp_dun.id_offending.ido_ipv6
108
 
109
#define icmp_echodata icmp_dun.id_data
110
 
111
#define icmp_grpaddr icmp_dun.id_neighbor.idn_addr
112
 
113
#define icmp_radvreach icmp_dun.id_radv.ida_reachable
114
#define icmp_radvretrans icmp_dun.id_radv.ida_retrans
115
#define icmp_radvext icmp_dun.id_radv.ida_opt
116
 
117
#define icmp_nsoltarg icmp_dun.id_neighbor.idn_addr
118
#define icmp_nsolext icmp_dun.id_neighbor.idn_ext
119
#define icmp_nadvaddr icmp_dun.id_neighbor.idn_addr
120
#define icmp_nadvext icmp_dun.id_neighbor.idn_ext
121
 
122
#define icmp_redirtarg icmp_dun.id_redirect.idr_addr1
123
#define icmp_redirdest icmp_dun.id_redirect.idr_addr2
124
#define icmp_redirext icmp_dun.id_redirect.idr_ext
125
};
126
 
127
/*
128
 * ICMPv6 extension constants.
129
 */
130
 
131
#define EXT_SOURCELINK 1
132
#define EXT_TARGETLINK 2
133
#define EXT_PREFIX 3
134
#define EXT_REDIR 4
135
#define EXT_MTU 5
136
 
137
/*
138
 * Extension structures for IPv6 discovery messages.
139
 */
140
 
141
struct icmp_exthdr    /* Generic extension */
142
{
143
  uint8_t ext_id;
144
  uint8_t ext_length;    /* Length is 8 * this field, 0 is invalid. */
145
  uint8_t ext_data[6];   /* Padded to 8 bytes. */
146
};
147
 
148
struct ext_prefinfo    /* Prefix information */
149
{
150
  uint8_t pre_extid;
151
  uint8_t pre_length;
152
 
153
  uint8_t pre_prefixsize;
154
  uint8_t pre_bits;
155
 
156
  uint32_t pre_valid;
157
  uint32_t pre_preferred;
158
  uint32_t pre_reserved;
159
 
160
  struct in6_addr pre_prefix;
161
};
162
 
163
/*
164
 * Values for pre_bits
165
 */
166
#define ICMPV6_PREFIX_ONLINK 0x80
167
#define ICMPV6_PREFIX_AUTO 0x40
168
 
169
struct ext_redir    /* Redirected header */
170
{
171
  uint8_t rd_extid;
172
  uint8_t rd_length;
173
  uint8_t rd_reserved[6];
174
  struct ipv6 rd_header;
175
};
176
 
177
struct ext_mtu      /* Recommended link MTU. */
178
{
179
  uint8_t mtu_extid;
180
  uint8_t mtu_length;
181
  uint16_t mtu_reserved;
182
  uint32_t mtu_mtu;
183
};
184
 
185
/*
186
 * Constants
187
 */
188
 
189
/*
190
 * Lower bounds on packet lengths for various types.
191
 * For the error advice packets must first insure that the
192
 * packet is large enought to contain the returned ip header.
193
 * Only then can we do the check to see if enough bits of packet
194
 * data have been returned, since we need to check the returned
195
 * ipv6 header length.
196
 */
197
#define ICMPV6_MINLEN   8                               /* abs minimum */
198
#define ICMPV6_TSLEN    (8 + 3 * sizeof (n_time))       /* timestamp */
199
#define ICMPV6_NADVMINLEN 24    /* min neighbor advertisement */
200
#define ICMPV6_NSOLMINLEN 24    /* min neighbor solicit */
201
#define ICMPV6_RADVMINLEN 16    /* min router advertisement */
202
#define ICMPV6_RSOLMINLEN 8     /* min router solicit */
203
#define ICMPV6_REDIRMINLEN 40   /* min redirect */
204
#define ICMPV6_HLPMINLEN (8 + sizeof(struct ipv6) + 8)  /* HLP demux len. */
205
#define ICMPV6_MAXLEN     576   /* This should be whatever IPV6_MINMTU
206
                                   will be.  I take this to be the WHOLE
207
                                   packet, including IPv6 header, and any
208
                                   IPv6 options before the ICMP message. */
209
 
210
/*
211
 * Definition of type and code field values.
212
 * ICMPv6 fixes things so that info messages are >= 128.
213
 */
214
 
215
/* Error messages and codes. */
216
 
217
#define ICMPV6_UNREACH          1               /* dest unreachable, codes: */
218
#define         ICMPV6_UNREACH_NOROUTE 0                  /* No route to dest. */
219
#define         ICMPV6_UNREACH_ADMIN   1                  /* Admin. prohibited */
220
#define         ICMPV6_UNREACH_NOTNEIGHBOR 2              /* For strict source
221
                                                           routing. */
222
#define         ICMPV6_UNREACH_ADDRESS 3                  /* Address unreach. */
223
#define         ICMPV6_UNREACH_PORT  4                    /* Port unreachable */
224
#define ICMPV6_TOOBIG             2               /* Packet too big. */
225
#define ICMPV6_TIMXCEED         3               /* time exceeded, code: */
226
#define         ICMPV6_TIMXCEED_INTRANS 0                /* ttl==0 in transit */
227
#define         ICMPV6_TIMXCEED_REASS   1               /* Reassembly t.o. */
228
#define ICMPV6_PARAMPROB                4               /* ip header bad */
229
#define         ICMPV6_PARAMPROB_PROB    0                /* Actual incorrect
230
                                                           parameter. */
231
#define         ICMPV6_PARAMPROB_NEXTHDR 1              /* Bad next hdr. */
232
#define         ICMPV6_PARAMPROB_BADOPT  2                /* Unrec. option */
233
 
234
/* Info messages. */
235
 
236
#define ICMPV6_ECHO             128             /* echo service */
237
#define ICMPV6_ECHOREPLY        129             /* echo reply */
238
#define ICMPV6_GRPQUERY         130             /* Query group membership. */
239
#define ICMPV6_GRPREPORT        131             /* Join mcast group. */
240
#define ICMPV6_GRPTERM          132             /* Leave mcast group. */
241
 
242
#define ICMPV6_ROUTERSOL        133             /* Router solicit. */
243
#define ICMPV6_ROUTERADV        134             /* Router advertisement. */
244
#define ICMPV6_NEIGHBORSOL      135             /* Neighbor solicit. */
245
#define ICMPV6_NEIGHBORADV      136             /* Neighbor advertisement. */
246
 
247
#define ICMPV6_REDIRECT         137             /* ICMPv6 redirect. */
248
 
249
/* Defined this way to save some HTONL cycles on little-endian boxes. */
250
#if BYTE_ORDER == BIG_ENDIAN
251
#define           ICMPV6_NEIGHBORADV_RTR   0x80000000  /* Router flag. */
252
#define           ICMPV6_NEIGHBORADV_SOL   0x40000000  /* Solicited flag. */
253
#define           ICMPV6_NEIGHBORADV_OVERRIDE 0x20000000 /* Override flag. */
254
#else  /* BYTE_ORDER == LITTLE_ENDIAN */
255
#define           ICMPV6_NEIGHBORADV_RTR   0x80  /* Router flag. */
256
#define           ICMPV6_NEIGHBORADV_SOL   0x40  /* Solicited flag. */
257
#define           ICMPV6_NEIGHBORADV_OVERRIDE 0x20 /* Override flag. */
258
#endif
259
 
260
#define ICMPV6_MAXTYPE          137
261
 
262
#define ICMPV6_INFOTYPE(type) ((type) >= 128)
263
 
264
#if defined(_KERNEL) || defined(KERNEL)
265
#include <netinet6/ipv6_var.h>
266
 
267
/* Function prototypes */
268
void ipv6_icmp_error(struct mbuf *, int, int, uint32_t);
269
void ipv6_icmp_input(struct mbuf *, int);
270
void ipv6_gsolicit(struct ifnet *, struct mbuf *, struct rtentry *);
271
void ipv6_rtrequest(int, struct rtentry *, struct sockaddr *);
272
int ipv6_icmp_output(struct mbuf *,struct socket *, struct in6_addr *);
273
int ipv6_icmp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
274
#if __NetBSD__ || __FreeBSD__
275
int ipv6_icmp_usrreq(struct socket *,int, struct mbuf *,struct mbuf *, struct mbuf *, struct proc *);
276
#else /* __NetBSD__ || __FreeBSD__ */
277
int ipv6_icmp_usrreq(struct socket *,int, struct mbuf *,struct mbuf *, struct mbuf *);
278
#endif /* __NetBSD__ || __FreeBSD__ */
279
 
280
void ipv6_routersol_input(struct mbuf *, int);
281
void ipv6_routeradv_input(struct mbuf *, int);
282
void ipv6_neighborsol_input(struct mbuf *, int);
283
void ipv6_neighboradv_input(struct mbuf *, int);
284
void ipv6_redirect_input(struct mbuf *, int);
285
#endif /* defined(_KERNEL) || defined(KERNEL) */
286
 
287
#endif /* _NETINET6_IPV6_ICMP_H */

powered by: WebSVN 2.1.0

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