tizen 2.3.1 release
[external/qemu.git] / roms / ipxe / src / include / ipxe / ip6.h
1 #ifndef _IPXE_IP6_H
2 #define _IPXE_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 <ipxe/in.h>
14 #include <ipxe/netdevice.h>
15 #include <ipxe/tcpip.h>
16
17 /* IP6 constants */
18
19 #define IP6_VERSION     0x6
20 #define IP6_HOP_LIMIT   255
21
22 /**
23  * I/O buffer contents
24  * This is duplicated in tcp.h and here. Ideally it should go into iobuf.h
25  */
26 #define MAX_HDR_LEN     100
27 #define MAX_IOB_LEN     1500
28 #define MIN_IOB_LEN     MAX_HDR_LEN + 100 /* To account for padding by LL */
29
30 #define IP6_EQUAL( in6_addr1, in6_addr2 ) \
31         ( memcmp ( ( char* ) &( in6_addr1 ), ( char* ) &( in6_addr2 ),\
32         sizeof ( struct in6_addr ) ) == 0 )
33
34 #define IS_UNSPECIFIED( addr ) \
35         ( ( (addr).in6_u.u6_addr32[0] == 0x00000000 ) && \
36         ( (addr).in6_u.u6_addr32[1] == 0x00000000 ) && \
37         ( (addr).in6_u.u6_addr32[2] == 0x00000000 ) && \
38         ( (addr).in6_u.u6_addr32[3] == 0x00000000 ) )
39 /* IP6 header */
40 struct ip6_header {
41         uint32_t        ver_traffic_class_flow_label;
42         uint16_t        payload_len;
43         uint8_t         nxt_hdr;
44         uint8_t         hop_limit;
45         struct in6_addr src;
46         struct in6_addr dest;
47 };
48
49 /* IP6 pseudo header */
50 struct ipv6_pseudo_header {
51         struct in6_addr src;
52         struct in6_addr dest;
53         uint8_t zero_padding;
54         uint8_t nxt_hdr;
55         uint16_t len;
56 };
57
58 /* Next header numbers */
59 #define IP6_HOPBYHOP            0x00
60 #define IP6_ROUTING             0x43
61 #define IP6_FRAGMENT            0x44
62 #define IP6_AUTHENTICATION      0x51
63 #define IP6_DEST_OPTS           0x60
64 #define IP6_ESP                 0x50
65 #define IP6_ICMP6               0x58
66 #define IP6_NO_HEADER           0x59
67
68 struct io_buffer;
69
70 extern struct net_protocol ipv6_protocol __net_protocol;
71 extern struct tcpip_net_protocol ipv6_tcpip_protocol __tcpip_net_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 /* _IPXE_IP6_H */