6b7493acf4ff7c5f034a80be09e40750157392d8
[tpg/acess2.git] / Kernel / include / tpl_drv_network.h
1 /**\r
2  * \file tpl_drv_network.h\r
3  * \brief Network Interface Driver Interface Definitions\r
4  * \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
13  * call is optional)\r
14  * \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
27  * will not be sent.\r
28  */\r
29 #ifndef _TPL_NETWORK_H\r
30 #define _TPL_NETWORK_H\r
31 \r
32 #include <tpl_drv_common.h>\r
33 \r
34 /**\r
35  * \enum eTplNetwork_IOCtl\r
36  * \brief Common Network IOCtl Calls\r
37  * \extends eTplDrv_IOCtl\r
38  */\r
39 enum eTplNetwork_IOCtl {\r
40         /**\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
44          * \r
45          * Copies the six byte Media Access Control (MAC) address of the\r
46          * adapter to the \a MAC array.\r
47         */\r
48         NET_IOCTL_GETMAC = 4\r
49 };\r
50 \r
51 /**\r
52  * \brief IOCtl name strings for use with eTplDrv_IOCtl.DRV_IOCTL_LOOKUP\r
53  */\r
54 #define DRV_NETWORK_IOCTLNAMES  "get_mac_addr"\r
55 \r
56 #endif\r

UCC git Repository :: git.ucc.asn.au