Upgraded GRUB2 to 2.00 release.
[AROS.git] / arch / all-pc / boot / grub2-aros / include / grub / net / ip.h
blob7a8e614794df555ea77782c9e46bc9ea83eb0010
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2010,2011 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_NET_IP_HEADER
20 #define GRUB_NET_IP_HEADER 1
21 #include <grub/misc.h>
22 #include <grub/net.h>
24 typedef enum grub_net_ip_protocol
26 GRUB_NET_IP_ICMP = 1,
27 GRUB_NET_IP_TCP = 6,
28 GRUB_NET_IP_UDP = 17,
29 GRUB_NET_IP_ICMPV6 = 58
30 } grub_net_ip_protocol_t;
31 #define GRUB_NET_IP_BROADCAST 0xFFFFFFFF
33 static inline grub_uint64_t
34 grub_net_ipv6_get_id (const grub_net_link_level_address_t *addr)
36 return grub_cpu_to_be64 (((grub_uint64_t) (addr->mac[0] ^ 2) << 56)
37 | ((grub_uint64_t) addr->mac[1] << 48)
38 | ((grub_uint64_t) addr->mac[2] << 40)
39 | 0xfffe000000ULL
40 | ((grub_uint64_t) addr->mac[3] << 16)
41 | ((grub_uint64_t) addr->mac[4] << 8)
42 | ((grub_uint64_t) addr->mac[5]));
45 grub_uint16_t grub_net_ip_chksum(void *ipv, grub_size_t len);
47 grub_err_t
48 grub_net_recv_ip_packets (struct grub_net_buff *nb,
49 struct grub_net_card *card,
50 const grub_net_link_level_address_t *hwaddress,
51 const grub_net_link_level_address_t *src_hwaddress);
53 grub_err_t
54 grub_net_send_ip_packet (struct grub_net_network_level_interface *inf,
55 const grub_net_network_level_address_t *target,
56 const grub_net_link_level_address_t *ll_target_addr,
57 struct grub_net_buff *nb,
58 grub_net_ip_protocol_t proto);
60 grub_err_t
61 grub_net_recv_icmp_packet (struct grub_net_buff *nb,
62 struct grub_net_network_level_interface *inf,
63 const grub_net_link_level_address_t *ll_src,
64 const grub_net_network_level_address_t *src);
65 grub_err_t
66 grub_net_recv_icmp6_packet (struct grub_net_buff *nb,
67 struct grub_net_card *card,
68 struct grub_net_network_level_interface *inf,
69 const grub_net_link_level_address_t *ll_src,
70 const grub_net_network_level_address_t *source,
71 const grub_net_network_level_address_t *dest,
72 grub_uint8_t ttl);
73 grub_err_t
74 grub_net_recv_udp_packet (struct grub_net_buff *nb,
75 struct grub_net_network_level_interface *inf,
76 const grub_net_network_level_address_t *src);
77 grub_err_t
78 grub_net_recv_tcp_packet (struct grub_net_buff *nb,
79 struct grub_net_network_level_interface *inf,
80 const grub_net_network_level_address_t *source);
82 grub_uint16_t
83 grub_net_ip_transport_checksum (struct grub_net_buff *nb,
84 grub_uint16_t proto,
85 const grub_net_network_level_address_t *src,
86 const grub_net_network_level_address_t *dst);
88 struct grub_net_network_level_interface *
89 grub_net_ipv6_get_link_local (struct grub_net_card *card,
90 const grub_net_link_level_address_t *hwaddr);
91 grub_err_t
92 grub_net_icmp6_send_request (struct grub_net_network_level_interface *inf,
93 const grub_net_network_level_address_t *proto_addr);
95 #endif