[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Hurdextras-hackers] Device interface
From: |
James A Morrison |
Subject: |
[Hurdextras-hackers] Device interface |
Date: |
Thu, 16 Jan 2003 22:16:45 -0500 (EST) |
Hi,
I've thought of how I would like the upper levels talk to the
lower levels. The obvious thing is that there needs to be at least
two functions, read and write. I think that these functions should be
called though function pointers. So, we would have
struct dev
{
error_t *(start) (dev_t this);
error_t *(stop) (dev_t this);
error_t *(read) (dev_t this, packet_t to_rcv);
error_t *(write) (dev_t this, packet_t to_send);
}
struct packet
{
size_t len;
char *data;
}
If something tries to write a packet that is too big then write can
return E2BIG.
I'll look into some arp stuff tommorrow, I think we might need a third
element into the packet struct that is char *to. I don't think it is
needed for most applications to need more than a read and a write to the
interface. A third struct may be useful that contains the functionality
of an interface, e.g. changing the mac address of a card, setting a hard
mtu limit.
Other things that can be added to struct dev are a get_stats function,
and set/get flags functions.
I'm getting this mostly out of reading ethernet.c in pfinet.
James A. Morrison
- [Hurdextras-hackers] Device interface,
James A Morrison <=