• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _GPXE_IP6_H
2 #define _GPXE_IP6_H
3 
4 /** @file
5  *
6  * IP6 protocol
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER );
11 
12 #include <stdint.h>
13 #include <gpxe/in.h>
14 
15 /* IP6 constants */
16 
17 #define IP6_VERSION	0x6
18 #define IP6_HOP_LIMIT	255
19 
20 /**
21  * I/O buffer contents
22  * This is duplicated in tcp.h and here. Ideally it should go into iobuf.h
23  */
24 #define MAX_HDR_LEN	100
25 #define MAX_IOB_LEN	1500
26 #define MIN_IOB_LEN	MAX_HDR_LEN + 100 /* To account for padding by LL */
27 
28 #define IP6_EQUAL( in6_addr1, in6_addr2 ) \
29         ( memcmp ( ( char* ) &( in6_addr1 ), ( char* ) &( in6_addr2 ),\
30 	sizeof ( struct in6_addr ) ) == 0 )
31 
32 #define IS_UNSPECIFIED( addr ) \
33 	( ( (addr).in6_u.u6_addr32[0] == 0x00000000 ) && \
34 	( (addr).in6_u.u6_addr32[1] == 0x00000000 ) && \
35 	( (addr).in6_u.u6_addr32[2] == 0x00000000 ) && \
36 	( (addr).in6_u.u6_addr32[3] == 0x00000000 ) )
37 /* IP6 header */
38 struct ip6_header {
39 	uint32_t 	ver_traffic_class_flow_label;
40 	uint16_t 	payload_len;
41 	uint8_t 	nxt_hdr;
42 	uint8_t 	hop_limit;
43 	struct in6_addr src;
44 	struct in6_addr dest;
45 };
46 
47 /* IP6 pseudo header */
48 struct ipv6_pseudo_header {
49 	struct in6_addr src;
50 	struct in6_addr dest;
51 	uint8_t zero_padding;
52 	uint8_t nxt_hdr;
53 	uint16_t len;
54 };
55 
56 /* Next header numbers */
57 #define IP6_HOPBYHOP 		0x00
58 #define IP6_ROUTING 		0x43
59 #define IP6_FRAGMENT		0x44
60 #define IP6_AUTHENTICATION	0x51
61 #define IP6_DEST_OPTS		0x60
62 #define IP6_ESP			0x50
63 #define IP6_ICMP6		0x58
64 #define IP6_NO_HEADER		0x59
65 
66 struct io_buffer;
67 struct net_device;
68 struct net_protocol;
69 
70 extern struct net_protocol ipv6_protocol;
71 extern struct tcpip_net_protocol ipv6_tcpip_protocol;
72 extern char * inet6_ntoa ( struct in6_addr in6 );
73 
74 extern int add_ipv6_address ( struct net_device *netdev,
75 			      struct in6_addr prefix, int prefix_len,
76 			      struct in6_addr address,
77 			      struct in6_addr gateway );
78 extern void del_ipv6_address ( struct net_device *netdev );
79 
80 #endif /* _GPXE_IP6_H */
81