2 * \file api_drv_network.h
\r
3 * \brief Network Interface Driver Interface Definitions
\r
5 * \section dirs VFS Layout
\r
6 * All network drivers must have the following basic VFS structure
\r
7 * The root of the driver will only contain files that are named from zero
\r
8 * upwards that represent the present network adapters that this driver
\r
9 * controls. All VFS nodes must implement ::eTplDrv_IOCtl with
\r
10 * DRV_IOCTL_TYPE returning DRV_TYPE_NETWORK.
\r
11 * The adapter nodes must also implement ::eTplNetwork_IOCtl fully
\r
12 * (unless it is noted in the ::eTplNetwork_IOCtl documentation that a
\r
15 * \section files Adapter Files
\r
16 * \subsection Reading
\r
17 * When an adapter file is read from, the driver will block the reading
\r
18 * thread until a packet arrives (if there is not already an unhandled
\r
19 * packet in the queue) this will then be read into the destination buffer.
\r
20 * If the packet does not fit in the buffer, the end of it is discarded.
\r
21 * Likewise, if the packet does not completely fill the buffer, the call
\r
22 * will still read to the buffer and then return the size of the packet.
\r
23 * \subsection Writing
\r
24 * When an adapter is written to, the data written is encoded as a packet
\r
25 * and sent, if the data is not the correct size to be sent (if the packet
\r
26 * is too small, or if it is too large) -1 should be returned and the packet
\r
29 #ifndef _API_DRV_NETWORK_H
\r
30 #define _API_DRV_NETWORK_H
\r
32 #include <api_drv_common.h>
\r
35 * \enum eTplNetwork_IOCtl
\r
36 * \brief Common Network IOCtl Calls
\r
37 * \extends eTplDrv_IOCtl
\r
39 enum eTplNetwork_IOCtl {
\r
41 * ioctl(..., Uint8 *MAC[6])
\r
42 * \brief Get the MAC address of the interface
\r
43 * \return 1 on success, 0 if the file is the root, -1 on error
\r
45 * Copies the six byte Media Access Control (MAC) address of the
\r
46 * adapter to the \a MAC array.
\r
48 NET_IOCTL_GETMAC = 4
\r
52 * \brief IOCtl name strings for use with eTplDrv_IOCtl.DRV_IOCTL_LOOKUP
\r
54 #define DRV_NETWORK_IOCTLNAMES "get_mac_addr"
\r