bootp support
This commit is contained in:
parent
4700d08bb4
commit
8b51fd98b9
12 changed files with 360 additions and 91 deletions
6
include/grub/emu/export.h
Normal file
6
include/grub/emu/export.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
void EXPORT_FUNC (open64) (void);
|
||||
void EXPORT_FUNC (close) (void);
|
||||
void EXPORT_FUNC (read) (void);
|
||||
void EXPORT_FUNC (write) (void);
|
||||
void EXPORT_FUNC (ioctl) (void);
|
||||
|
|
@ -62,8 +62,10 @@ struct grub_net_card_driver
|
|||
char *name;
|
||||
grub_err_t (*init) (struct grub_net_card *dev);
|
||||
grub_err_t (*fini) (struct grub_net_card *dev);
|
||||
grub_err_t (*send) (struct grub_net_card *dev, struct grub_net_buff *buf);
|
||||
grub_ssize_t (*recv) (struct grub_net_card *dev, struct grub_net_buff *buf);
|
||||
grub_err_t (*send) (const struct grub_net_card *dev,
|
||||
struct grub_net_buff *buf);
|
||||
grub_ssize_t (*recv) (const struct grub_net_card *dev,
|
||||
struct grub_net_buff *buf);
|
||||
};
|
||||
|
||||
extern struct grub_net_card_driver *grub_net_card_drivers;
|
||||
|
@ -116,6 +118,7 @@ struct grub_net_network_level_interface;
|
|||
|
||||
typedef enum grub_network_level_protocol_id
|
||||
{
|
||||
GRUB_NET_NETWORK_LEVEL_PROTOCOL_PROMISC,
|
||||
GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4
|
||||
} grub_network_level_protocol_id_t;
|
||||
|
||||
|
@ -243,12 +246,13 @@ extern grub_err_t (*EXPORT_VAR (grub_file_net_seek)) (struct grub_file *file, gr
|
|||
struct grub_net_network_level_interface
|
||||
{
|
||||
struct grub_net_network_level_interface *next;
|
||||
struct grub_net_network_level_interface **prev;
|
||||
char *name;
|
||||
struct grub_net_card *card;
|
||||
const struct grub_net_card *card;
|
||||
grub_net_network_level_address_t address;
|
||||
grub_net_link_level_address_t hwaddress;
|
||||
grub_net_interface_flags_t flags;
|
||||
struct grub_net_bootp_ack *dhcp_ack;
|
||||
struct grub_net_bootp_packet *dhcp_ack;
|
||||
grub_size_t dhcp_acklen;
|
||||
void *data;
|
||||
};
|
||||
|
@ -291,7 +295,8 @@ grub_net_session_recv (struct grub_net_session *session, void *buf,
|
|||
}
|
||||
|
||||
struct grub_net_network_level_interface *
|
||||
grub_net_add_addr (const char *name, struct grub_net_card *card,
|
||||
grub_net_add_addr (const char *name,
|
||||
const struct grub_net_card *card,
|
||||
grub_net_network_level_address_t addr,
|
||||
grub_net_link_level_address_t hwaddress,
|
||||
grub_net_interface_flags_t flags);
|
||||
|
@ -369,7 +374,7 @@ grub_net_add_route_gw (const char *name,
|
|||
|
||||
typedef grub_uint8_t grub_net_bootp_mac_addr_t[GRUB_NET_BOOTP_MAC_ADDR_LEN];
|
||||
|
||||
struct grub_net_bootp_ack
|
||||
struct grub_net_bootp_packet
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t hw_type; /* hardware type. */
|
||||
|
@ -391,11 +396,21 @@ struct grub_net_bootp_ack
|
|||
#define GRUB_NET_BOOTP_RFC1048_MAGIC 0x63825363L
|
||||
|
||||
struct grub_net_network_level_interface *
|
||||
grub_net_configure_by_dhcp_ack (const char *name, struct grub_net_card *card,
|
||||
grub_net_configure_by_dhcp_ack (const char *name,
|
||||
const struct grub_net_card *card,
|
||||
grub_net_interface_flags_t flags,
|
||||
struct grub_net_bootp_ack *bp,
|
||||
const struct grub_net_bootp_packet *bp,
|
||||
grub_size_t size);
|
||||
|
||||
void
|
||||
grub_net_process_dhcp (struct grub_net_buff *nb,
|
||||
const struct grub_net_card *card);
|
||||
|
||||
int
|
||||
grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a,
|
||||
const grub_net_link_level_address_t *b);
|
||||
|
||||
|
||||
/*
|
||||
Currently suppoerted adresses:
|
||||
IPv4: XXX.XXX.XXX.XXX
|
||||
|
@ -420,8 +435,11 @@ typedef int
|
|||
grub_err_t grub_net_recv_link_layer (struct grub_net_network_level_interface *inf,
|
||||
grub_net_packet_handler_t handler);
|
||||
|
||||
grub_err_t
|
||||
grub_net_recv_ip_packets (struct grub_net_buff *nb);
|
||||
|
||||
grub_err_t
|
||||
grub_net_recv_ip_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_send_ip_packet (struct grub_net_network_level_interface *inf,
|
||||
|
|
|
@ -12,19 +12,6 @@ struct etherhdr
|
|||
grub_uint16_t type;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define PCP(x) x & 0xe000
|
||||
#define CFI(x) x & 0x1000
|
||||
#define VID(x) x & 0x0fff
|
||||
#define PRINT_ETH_ADDR(name,addr) grub_printf("%s %x:%x:%x:%x:%x:%x\n",\
|
||||
name,\
|
||||
addr[0],\
|
||||
addr[1],\
|
||||
addr[2],\
|
||||
addr[3],\
|
||||
addr[4],\
|
||||
addr[5]\
|
||||
)
|
||||
|
||||
struct llchdr
|
||||
{
|
||||
grub_uint8_t dsap;
|
||||
|
@ -52,6 +39,7 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
|
|||
grub_net_link_level_address_t target_addr,
|
||||
grub_uint16_t ethertype);
|
||||
grub_err_t
|
||||
grub_net_recv_ethernet_packet (struct grub_net_buff *nb);
|
||||
grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
|
||||
const struct grub_net_card *card);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,5 +26,5 @@ grub_err_t grub_netbuff_reserve (struct grub_net_buff *net_buff ,grub_size_t len
|
|||
grub_err_t grub_netbuff_clear (struct grub_net_buff *net_buff);
|
||||
struct grub_net_buff * grub_netbuff_alloc ( grub_size_t len );
|
||||
grub_err_t grub_netbuff_free (struct grub_net_buff *net_buff);
|
||||
grub_err_t grub_netbuff_clear (struct grub_net_buff *net_buff);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,8 +14,9 @@ struct udphdr
|
|||
grub_err_t
|
||||
grub_net_send_udp_packet (const grub_net_socket_t socket , struct grub_net_buff *nb);
|
||||
|
||||
grub_err_t
|
||||
grub_net_recv_udp_packet (struct grub_net_buff *nb);
|
||||
grub_err_t
|
||||
grub_net_recv_udp_packet (struct grub_net_buff *nb,
|
||||
struct grub_net_network_level_interface *inf);
|
||||
|
||||
|
||||
#define FOR_NET_UDP_PACKETS(inf, var) FOR_PACKETS(inf->udp_pending, var)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue