small change in the interface structure.

This commit is contained in:
Manoel R. Abranches 2010-04-29 17:56:09 -03:00
parent 066528b4b1
commit 8d402bc9a8
7 changed files with 48 additions and 35 deletions

View file

@ -26,8 +26,22 @@
struct grub_net_card;
typedef enum
{
GRUB_NET_TFTP_ID,
GRUB_NET_UDP_ID,
GRUB_NET_IPV4_ID,
GRUB_NET_IPV6_ID,
GRUB_NET_ETHERNET_ID,
GRUB_NET_ARP_ID,
GRUB_NET_DHCP_ID
}protocol_type_t;
struct grub_net_card_driver
{
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 *nb);
grub_size_t (*recv) (struct grub_net_card *dev,struct grub_net_buff *nb);
};

View file

@ -2,16 +2,26 @@
#define GRUB_INTERFACE_HEADER
#include <grub/net.h>
#include <grub/net/protocol.h>
/*
extern struct grub_net_topprotocol;
struct grub_net_protstack
{
struct grub_net_protstack *next;
struct grub_net_protocol* prot;
};
struct grub_net_interface
{
struct grub_net_card *card;
struct grub_net_topprotocol* topprot;
struct grub_net_protstack* protstack;
char *path;
char *username;
char *password;
/*transport layer addres*/
struct grub_net_addr *tla;
/*internet layer addres*/
struct grub_net_addr *ila;
/*link layer addres*/
struct grub_net_addr *lla;
};
*/
#endif

View file

@ -4,47 +4,32 @@
#include <grub/net/protocol.h>
#include <grub/net/netbuff.h>
#include <grub/net.h>
struct protocol_operations;
struct grub_net_protocol;
struct grub_net_interface;
struct grub_net_protstack;
struct grub_net_protocol
{
struct grub_net_protocol *next;
char *name;
grub_err_t (*open) (struct grub_net_interface* inf,
struct grub_net_protocol *prot, struct grub_net_buff *nb);
struct grub_net_protstack *protstack, struct grub_net_buff *nb);
grub_err_t (*open_confirm) (struct grub_net_interface *inf,
struct grub_net_protocol *prot, struct grub_net_buff *nb);
struct grub_net_protstack *protstack, struct grub_net_buff *nb);
grub_err_t (*get_payload) (struct grub_net_interface *inf,
struct grub_net_protocol *prot, struct grub_net_buff *nb);
struct grub_net_protstack *protstack, struct grub_net_buff *nb);
grub_err_t (*get_payload_confirm) (struct grub_net_interface* inf,
struct grub_net_protocol *prot, struct grub_net_buff *nb);
struct grub_net_protstack *protstack, struct grub_net_buff *nb);
grub_err_t (*close) (struct grub_net_interface *inf,
struct grub_net_protocol *prot, struct grub_net_buff *nb);
struct grub_net_protstack *protstack, struct grub_net_buff *nb);
grub_err_t (*send) (struct grub_net_interface *inf ,
struct grub_net_protocol *prot, struct grub_net_buff *nb);
struct grub_net_protstack *protstack, struct grub_net_buff *nb);
grub_err_t (*recv) (struct grub_net_interface *inf ,
struct grub_net_protocol *prot, struct grub_net_buff *nb);
struct grub_net_protstack *protstack, struct grub_net_buff *nb);
};
typedef struct grub_net_protocol *grub_net_protocol_t;
struct grub_net_interface
{
struct grub_net_card *card;
struct grub_net_protocol* prot;
char *path;
char *username;
char *password;
/*transport layer addres*/
struct grub_net_addr *tla;
/*internet layer addres*/
struct grub_net_addr *ila;
/*link layer addres*/
struct grub_net_addr *lla;
};
void grub_protocol_register (grub_net_protocol_t prot);
void grub_protocol_unregister (grub_net_protocol_t prot);
#endif