eacdb7954febb098be3500219f8c3f886727a82e
[oftp] / libs / watt32 / netinet / ipv6.h
1 /*!\file netinet/ipv6.h
2  * Linux IPv6 definitions.
3  */
4
5 /*
6  *      Linux INET6 implementation
7  *
8  *      Authors:
9  *      Pedro Roque             <roque@di.fc.ul.pt>
10  *
11  *      $Id: ipv6.h,v 1.6 1997/04/01 02:22:58 davem Exp $
12  *
13  *      This program is free software; you can redistribute it and/or
14  *      modify it under the terms of the GNU General Public License
15  *      as published by the Free Software Foundation; either version
16  *      2 of the License, or (at your option) any later version.
17  *
18  *  NB! Don't ue this file. Use <netinet/in.h> instread.
19  */
20
21 #ifndef _NET_IPV6_H
22 #define _NET_IPV6_H
23
24 #ifndef __NETINET_IN_H
25 #include <netinet/in.h>  /* in6_addr */
26 #endif
27
28 /*
29  *  Advanced API
30  *  source interface/address selection, source routing, etc...
31  *  *under construction*
32  */
33
34 #include <sys/packon.h>
35
36 /*
37  *  IPv6 fixed header
38  */
39 struct ipv6hdr {
40        unsigned char   ipv6_priority:4;
41        unsigned char   ipv6_version:4;
42        unsigned char   ipv6_flow_lbl[3];
43        unsigned short  ipv6_len;
44        unsigned char   ipv6_nextheader;
45        unsigned char   ipv6_hoplimit;
46        struct in6_addr ipv6_src;
47        struct in6_addr ipv6_dst;
48      };
49
50
51
52 /*
53  *  The length of this struct cannot be greater than the length of
54  *  the proto_priv field in a sk_buff which is currently
55  *  defined to be 16 bytes.
56  *  Pointers take upto 8 bytes (sizeof(void *) is 8 on the alpha).
57  */
58 struct ipv6_options  {
59        /* length of extension headers */
60        unsigned short opt_flen;       /* after fragment hdr */
61        unsigned short opt_nflen;      /* before fragment hdr */
62       /*
63        * protocol options
64        * usualy carried in IPv6 extension headers
65        */
66        struct ipv6_rt_hdr *srcrt; /* Routing Header */
67       };
68
69 struct in6_pktinfo {
70        struct in6_addr ipi6_addr;
71        int             ipi6_ifindex;
72      };
73
74
75 struct in6_ifreq {
76        struct in6_addr ifr6_addr;
77        unsigned long   ifr6_prefixlen;
78        unsigned long   ifr6_ifindex;
79      };
80
81 #define IPV6_SRCRT_STRICT       0x01    /* this hop must be a neighbor  */
82 #define IPV6_SRCRT_TYPE_0       0       /* IPv6 type 0 Routing Header   */
83
84 /*
85  *      routing header
86  */
87 struct ipv6_rt_hdr {
88        unsigned char  nexthdr;
89        unsigned char  hdrlen;
90        unsigned char  type;
91        unsigned char  segments_left;
92        /*
93         * type specific data
94         * variable length field
95         */
96      };
97
98 /*
99  * routing header type 0 (used in cmsghdr struct)
100  */
101 struct ipv6_rt0_hdr {
102        struct ipv6_rt_hdr rt_hdr;
103        unsigned long      bitmap;         /* strict/loose bit map */
104 #ifndef __WATCOMC__
105        struct in6_addr    addr[0];
106 #endif
107 #define rt0_type rt_hdr.type;
108      };
109
110 /*
111  *  NextHeader field of IPv6 header
112  */
113
114 #define NEXTHDR_HOP             0       /* Hop-by-hop option header. */
115 #define NEXTHDR_TCP             6       /* TCP segment. */
116 #define NEXTHDR_UDP             17      /* UDP message. */
117 #define NEXTHDR_IPV6            41      /* IPv6 in IPv6 */
118 #define NEXTHDR_ROUTING         43      /* Routing header. */
119 #define NEXTHDR_FRAGMENT        44      /* Fragmentation/reassembly header. */
120 #define NEXTHDR_ESP             50      /* Encapsulating security payload. */
121 #define NEXTHDR_AUTH            51      /* Authentication header. */
122 #define NEXTHDR_ICMP            58      /* ICMP for IPv6. */
123 #define NEXTHDR_NONE            59      /* No next header */
124 #define NEXTHDR_DEST            60      /* Destination options header. */
125
126 #define NEXTHDR_MAX             255
127
128
129 #define IPV6_DEFAULT_HOPLIMIT   64
130 #define IPV6_DEFAULT_MCASTHOPS  1
131
132 /*
133  *      Addr type
134  *      
135  *      type    -       unicast | multicast | anycast
136  *      scope   -       local   | site      | global
137  *      v4      -       compat
138  *      v4mapped
139  *      any
140  *      loopback
141  */
142
143 #define IPV6_ADDR_ANY           0x0000U
144
145 #define IPV6_ADDR_UNICAST       0x0001U 
146 #define IPV6_ADDR_MULTICAST     0x0002U 
147 #define IPV6_ADDR_ANYCAST       0x0004U
148
149 #define IPV6_ADDR_LOOPBACK      0x0010U
150 #define IPV6_ADDR_LINKLOCAL     0x0020U
151 #define IPV6_ADDR_SITELOCAL     0x0040U
152
153 #define IPV6_ADDR_COMPATv4      0x0080U
154
155 #define IPV6_ADDR_SCOPE_MASK    0x00f0U
156
157 #define IPV6_ADDR_MAPPED        0x1000U
158 #define IPV6_ADDR_RESERVED      0x2000U /* reserved address space */
159
160 /*
161  *      fragmentation header
162  */
163
164 struct ipv6_fraghdr {
165        unsigned char   nexthdr;
166        unsigned char   reserved;
167        unsigned short  frag_off;
168        unsigned long   identification;
169      };
170 #define fraghdr ipv6_fraghdr
171
172 #include <sys/packoff.h>
173
174 #endif
175