Adapt protocols to new network struct.

This commit is contained in:
Manoel Rebelo Abranches 2011-04-01 05:42:34 -03:00
parent 09375846b9
commit 25f1579b43
15 changed files with 296 additions and 208 deletions

View file

@ -27,8 +27,7 @@ struct arphdr {
grub_uint16_t op;
} __attribute__ ((packed));
extern grub_err_t grub_net_arp_receive(struct grub_net_network_level_interface *inf,
struct grub_net_buff *nb);
extern grub_err_t grub_net_arp_receive(struct grub_net_buff *nb);
extern grub_err_t grub_net_arp_resolve(struct grub_net_network_level_interface *inf,
const grub_net_network_level_address_t *addr,

View file

@ -1,7 +0,0 @@
struct grub_net_card
{
struct grub_net_card *next;
char *name;
struct grub_net_card_driver *driver;
void *data;
};

View file

@ -52,8 +52,6 @@ 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_network_level_interface *inf,
struct grub_net_buff *nb,
grub_uint16_t ethertype);
grub_net_recv_ethernet_packet (struct grub_net_buff *nb);
#endif

View file

@ -26,7 +26,7 @@ struct ip6hdr
grub_uint8_t daddr[16];
} __attribute__ ((packed));
#define IP_UDP 17 /* UDP protocol */
#define IP_UDP 0x11 /* UDP protocol */
#define IP_BROADCAST 0xFFFFFFFF
grub_uint16_t ipchksum(void *ipv, int len);

View file

@ -14,7 +14,6 @@
/* IP port for the TFTP server */
#define TFTP_SERVER_PORT 69
#define TFTP_CLIENT_PORT 26300
/* We define these based on what's in arpa/tftp.h. We just like our
@ -40,10 +39,17 @@
#define TFTP_EBADID 5 /* unknown transfer ID */
#define TFTP_EEXISTS 6 /* file already exists */
#define TFTP_ENOUSER 7 /* no such user */
#define TFTP_DEFAULT_FILENAME "kernel"
/* * own here because this is cleaner, and maps to the same data layout.
* */
typedef struct tftp_data
{
int file_size;
int block;
} *tftp_data_t;
struct tftphdr {
grub_uint16_t opcode;
union {
@ -65,6 +71,4 @@ struct tftphdr {
} u;
} __attribute__ ((packed)) ;
void tftp_ini(void);
void tftp_fini(void);
#endif

View file

@ -12,20 +12,12 @@ struct udphdr
} __attribute__ ((packed));
grub_err_t
grub_net_send_udp_packet (const grub_net_network_level_address_t *target,
struct grub_net_buff *nb, grub_uint16_t srcport,
grub_uint16_t destport);
grub_net_send_udp_packet (const grub_net_socket_t socket , struct grub_net_buff *nb);
grub_err_t
grub_net_recv_udp_packets (struct grub_net_network_level_interface *inf);
grub_net_recv_udp_packet (struct grub_net_buff *nb);
grub_err_t
grub_net_recv_udp_packet (const grub_net_network_level_address_t *target,
struct grub_net_buff *buf,
grub_uint16_t srcport, grub_uint16_t destport);
#define FOR_NET_UDP_PACKETS(inf, var) FOR_PACKETS(inf->udp_pending, var)
#endif