ip6.h
001:
002:
003:
004:
005:
006:
007:
008:
009:
010:
011:
012:
013:
014:
015:
016:
017:
018:
019: #ifndef _NETINET_IP6_H
020: #define _NETINET_IP6_H 1
021:
022: #include <inttypes.h>
023: #include <netinet/in.h>
024:
025: struct ip6_hdr
026: {
027: union
028: {
029: struct ip6_hdrctl
030: {
031: uint32_t ip6_un1_flow;
032:
033: uint16_t ip6_un1_plen;
034: uint8_t ip6_un1_nxt;
035: uint8_t ip6_un1_hlim;
036: } ip6_un1;
037: uint8_t ip6_un2_vfc;
038: } ip6_ctlun;
039: struct in6_addr ip6_src;
040: struct in6_addr ip6_dst;
041: };
042:
043: #define ip6_vfc ip6_ctlun.ip6_un2_vfc
044: #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
045: #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
046: #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
047: #define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
048: #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
049:
050:
051: struct ip6_ext
052: {
053: uint8_t ip6e_nxt;
054: uint8_t ip6e_len;
055: };
056:
057:
058: struct ip6_hbh
059: {
060: uint8_t ip6h_nxt;
061: uint8_t ip6h_len;
062:
063: };
064:
065:
066: struct ip6_dest
067: {
068: uint8_t ip6d_nxt;
069: uint8_t ip6d_len;
070:
071: };
072:
073:
074: struct ip6_rthdr
075: {
076: uint8_t ip6r_nxt;
077: uint8_t ip6r_len;
078: uint8_t ip6r_type;
079: uint8_t ip6r_segleft;
080:
081: };
082:
083:
084: struct ip6_rthdr0
085: {
086: uint8_t ip6r0_nxt;
087: uint8_t ip6r0_len;
088: uint8_t ip6r0_type;
089: uint8_t ip6r0_segleft;
090: uint8_t ip6r0_reserved;
091: uint8_t ip6r0_slmap[3];
092:
093: struct in6_addr ip6r0_addr[0];
094: };
095:
096:
097: struct ip6_frag
098: {
099: uint8_t ip6f_nxt;
100: uint8_t ip6f_reserved;
101: uint16_t ip6f_offlg;
102: uint32_t ip6f_ident;
103: };
104:
105: #if BYTE_ORDER == BIG_ENDIAN
106: # define IP6F_OFF_MASK 0xfff8
107: # define IP6F_RESERVED_MASK 0x0006
108: # define IP6F_MORE_FRAG 0x0001
109: #else
110: # define IP6F_OFF_MASK 0xf8ff
111: # define IP6F_RESERVED_MASK 0x0600
112: # define IP6F_MORE_FRAG 0x0100
113: #endif
114:
115:
116: struct ip6_opt
117: {
118: uint8_t ip6o_type;
119: uint8_t ip6o_len;
120: };
121:
122:
123:
124:
125:
126: #define IP6OPT_TYPE(o) ((o) & 0xc0)
127: #define IP6OPT_TYPE_SKIP 0x00
128: #define IP6OPT_TYPE_DISCARD 0x40
129: #define IP6OPT_TYPE_FORCEICMP 0x80
130: #define IP6OPT_TYPE_ICMP 0xc0
131: #define IP6OPT_TYPE_MUTABLE 0x20
132:
133:
134: #define IP6OPT_PAD1 0
135: #define IP6OPT_PADN 1
136:
137: #define IP6OPT_JUMBO 0xc2
138: #define IP6OPT_NSAP_ADDR 0xc3
139: #define IP6OPT_TUNNEL_LIMIT 0x04
140: #define IP6OPT_ROUTER_ALERT 0x05
141:
142:
143: struct ip6_opt_jumbo
144: {
145: uint8_t ip6oj_type;
146: uint8_t ip6oj_len;
147: uint8_t ip6oj_jumbo_len[4];
148: };
149: #define IP6OPT_JUMBO_LEN 6
150:
151:
152: struct ip6_opt_nsap
153: {
154: uint8_t ip6on_type;
155: uint8_t ip6on_len;
156: uint8_t ip6on_src_nsap_len;
157: uint8_t ip6on_dst_nsap_len;
158:
159:
160: };
161:
162:
163: struct ip6_opt_tunnel
164: {
165: uint8_t ip6ot_type;
166: uint8_t ip6ot_len;
167: uint8_t ip6ot_encap_limit;
168: };
169:
170:
171: struct ip6_opt_router
172: {
173: uint8_t ip6or_type;
174: uint8_t ip6or_len;
175: uint8_t ip6or_value[2];
176: };
177:
178:
179: #if BYTE_ORDER == BIG_ENDIAN
180: # define IP6_ALERT_MLD 0x0000
181: # define IP6_ALERT_RSVP 0x0001
182: # define IP6_ALERT_AN 0x0002
183: #else
184: # define IP6_ALERT_MLD 0x0000
185: # define IP6_ALERT_RSVP 0x0100
186: # define IP6_ALERT_AN 0x0200
187: #endif
188:
189: #endif
190:
© Andrew Scott 2006 -
2025,
All Rights Reserved