grub/net/interface.c
Paulo de Rezende Pinatti 10830203a0 Added ARP protocol to network stack and fixed bug in grub_netbuff_alloc function.
* include/grub/net/arp.h: added arp header, arp cache entry and related constants and functions
* net/arp.c: added functions arp_init_table, arp_find_entry, arp_resolve and arp_receive
* net/ethernet.c (send_ethernet_packet): replaced hardcoded hardware address by parameter target_addr
* net/ethernet.c (recv_ethernet_packet): added call to arp_receive when packet is of type 0x803 (ARP) and only return when packet is of type determined by parameter ethertype
* net/ip.c (send_ip_packet): added call to arp_resolve to determine hardware address of destination
* net/netbuff.c (grub_netbuff_alloc): fixed swapped parameters in call to grub_memalign
2010-08-13 14:42:16 -03:00

37 lines
1.1 KiB
C

/*#include <grub/net/interface.h>
#define INTERFACE_REGISTER_FUNCTIONS(layerprevious,layernext) \
struct grub_net_##layername_layer_protocol *grub_net_##layername_layer_protocols;\
\
void grub_net_##layerprevious_##layernext_interface_register (struct grub_net_##layername_layer_protocol *prot)\
{\
grub_list_push (GRUB_AS_LIST_P (&grub_net_##layername_layer_protocols),\
GRUB_AS_LIST (prot));\
}\
\
void grub_net_##layerprevious_##layernext_interface_unregister (struct grub_net_##layername_layer_protocol *prot);\
{\
grub_list_remove (GRUB_AS_LIST_P (&grub_net_##layername_layer_protocols),\
GRUB_AS_LIST (prot));\
}\
INTERFACE_REGISTER_FUNCTIONS("application","transport");
INTERFACE_REGISTER_FUNCTIONS("transport","network");
INTERFACE_REGISTER_FUNCTIONS("network","link");
INTERFACE_REGISTER_FUNCTIONS("link");*/
#include <grub/mm.h>
#include <grub/net/interface.h>
struct grub_net_protocol_stack
*grub_net_protocol_stack_get (char *name)
{
struct grub_net_protocol_stack *p;
for (p = grub_net_protocol_stacks; p; p = p->next)
{
if (!grub_strcmp(p->name,name))
return p;
}
return NULL;
}