some more ipv6 code
This commit is contained in:
parent
d5e60b1ba0
commit
a53cf6534d
12 changed files with 528 additions and 60 deletions
|
|
@ -36,6 +36,6 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
|
|||
grub_net_ethertype_t ethertype);
|
||||
grub_err_t
|
||||
grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
|
||||
const struct grub_net_card *card);
|
||||
struct grub_net_card *card);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -25,20 +25,29 @@ typedef enum grub_net_ip_protocol
|
|||
{
|
||||
GRUB_NET_IP_ICMP = 1,
|
||||
GRUB_NET_IP_TCP = 6,
|
||||
GRUB_NET_IP_UDP = 17
|
||||
GRUB_NET_IP_UDP = 17,
|
||||
GRUB_NET_IP_ICMPV6 = 58
|
||||
} grub_net_ip_protocol_t;
|
||||
#define GRUB_NET_IP_BROADCAST 0xFFFFFFFF
|
||||
|
||||
static inline grub_uint64_t
|
||||
grub_net_ipv6_get_id (const grub_net_link_level_address_t *addr)
|
||||
{
|
||||
return grub_cpu_to_be64 (((grub_uint64_t) (addr->mac[0] ^ 2) << 56)
|
||||
| ((grub_uint64_t) addr->mac[1] << 48)
|
||||
| ((grub_uint64_t) addr->mac[2] << 40)
|
||||
| 0xfffe000000ULL
|
||||
| ((grub_uint64_t) addr->mac[3] << 16)
|
||||
| ((grub_uint64_t) addr->mac[4] << 8)
|
||||
| ((grub_uint64_t) addr->mac[5]));
|
||||
}
|
||||
|
||||
grub_uint16_t grub_net_ip_chksum(void *ipv, grub_size_t len);
|
||||
|
||||
grub_err_t
|
||||
grub_net_recv_ip4_packets (struct grub_net_buff *nb,
|
||||
const struct grub_net_card *card,
|
||||
const grub_net_link_level_address_t *hwaddress);
|
||||
grub_err_t
|
||||
grub_net_recv_ip6_packets (struct grub_net_buff *nb,
|
||||
const struct grub_net_card *card,
|
||||
const grub_net_link_level_address_t *hwaddress);
|
||||
grub_net_recv_ip_packets (struct grub_net_buff *nb,
|
||||
struct grub_net_card *card,
|
||||
const grub_net_link_level_address_t *hwaddress);
|
||||
|
||||
grub_err_t
|
||||
grub_net_send_ip_packet (struct grub_net_network_level_interface *inf,
|
||||
|
|
@ -51,6 +60,12 @@ grub_net_recv_icmp_packet (struct grub_net_buff *nb,
|
|||
struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *src);
|
||||
grub_err_t
|
||||
grub_net_recv_icmp6_packet (struct grub_net_buff *nb,
|
||||
struct grub_net_card *card,
|
||||
struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *source,
|
||||
const grub_net_network_level_address_t *dest);
|
||||
grub_err_t
|
||||
grub_net_recv_udp_packet (struct grub_net_buff *nb,
|
||||
struct grub_net_network_level_interface *inf,
|
||||
const grub_net_network_level_address_t *src);
|
||||
|
|
@ -65,4 +80,8 @@ grub_net_ip_transport_checksum (struct grub_net_buff *nb,
|
|||
const grub_net_network_level_address_t *src,
|
||||
const grub_net_network_level_address_t *dst);
|
||||
|
||||
struct grub_net_network_level_interface *
|
||||
grub_net_ipv6_get_link_local (struct grub_net_card *card,
|
||||
const grub_net_link_level_address_t *hwaddr);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue