Changes in uspace/lib/net/include/nil_interface.h [14f1db0:849ed54] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/include/nil_interface.h
r14f1db0 r849ed54 31 31 */ 32 32 33 /** @file 34 * Network interface layer module interface. 35 * The same interface is used for standalone remote device modules as well as for bundle device modules. 36 * The standalone remote device modules have to be compiled with the nil_remote.c source file. 37 * The bundle device modules with the appropriate network interface layer source file (eth.c etc.). 38 * The upper layers cannot be bundled with the network interface layer. 39 */ 40 33 41 #ifndef __NET_NIL_INTERFACE_H__ 34 42 #define __NET_NIL_INTERFACE_H__ … … 45 53 #include <net_device.h> 46 54 47 #define nil_bind_service(service, device_id, me, receiver) \ 48 bind_service(service, device_id, me, 0, receiver) 55 /** @name Network interface layer module interface 56 * This interface is used by other modules. 57 */ 58 /*@{*/ 49 59 50 #define nil_packet_size_req(nil_phone, device_id, packet_dimension) \ 51 generic_packet_size_req_remote(nil_phone, NET_NIL_PACKET_SPACE, device_id, \ 52 packet_dimension) 53 54 #define nil_get_addr_req(nil_phone, device_id, address, data) \ 60 /** Returns the device local hardware address. 61 * @param[in] nil_phone The network interface layer phone. 62 * @param[in] device_id The device identifier. 63 * @param[out] address The device local hardware address. 64 * @param[out] data The address data. 65 * @returns EOK on success. 66 * @returns EBADMEM if the address parameter and/or the data parameter is NULL. 67 * @returns ENOENT if there no such device. 68 * @returns Other error codes as defined for the generic_get_addr_req() function. 69 */ 70 #define nil_get_addr_req(nil_phone, device_id, address, data) \ 55 71 generic_get_addr_req(nil_phone, NET_NIL_ADDR, device_id, address, data) 56 72 57 #define nil_get_broadcast_addr_req(nil_phone, device_id, address, data) \ 58 generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, \ 59 address, data) 73 /** Returns the device broadcast hardware address. 74 * @param[in] nil_phone The network interface layer phone. 75 * @param[in] device_id The device identifier. 76 * @param[out] address The device broadcast hardware address. 77 * @param[out] data The address data. 78 * @returns EOK on success. 79 * @returns EBADMEM if the address parameter is NULL. 80 * @returns ENOENT if there no such device. 81 * @returns Other error codes as defined for the generic_get_addr_req() function. 82 */ 83 #define nil_get_broadcast_addr_req(nil_phone, device_id, address, data) \ 84 generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, address, data) 60 85 61 #define nil_send_msg(nil_phone, device_id, packet, sender) \ 62 generic_send_msg_remote(nil_phone, NET_NIL_SEND, device_id, \ 63 packet_get_id(packet), sender, 0) 86 /** Sends the packet queue. 87 * @param[in] nil_phone The network interface layer phone. 88 * @param[in] device_id The device identifier. 89 * @param[in] packet The packet queue. 90 * @param[in] sender The sending module service. 91 * @returns EOK on success. 92 * @returns Other error codes as defined for the generic_send_msg() function. 93 */ 94 #define nil_send_msg(nil_phone, device_id, packet, sender) \ 95 generic_send_msg(nil_phone, NET_NIL_SEND, device_id, packet_get_id(packet), sender, 0) 64 96 65 #define nil_device_req(nil_phone, device_id, mtu, netif_service) \ 66 generic_device_req_remote(nil_phone, NET_NIL_DEVICE, device_id, mtu, \ 67 netif_service) 97 /** Returns the device packet dimension for sending. 98 * @param[in] nil_phone The network interface layer phone. 99 * @param[in] device_id The device identifier. 100 * @param[out] packet_dimension The packet dimensions. 101 * @returns EOK on success. 102 * @returns ENOENT if there is no such device. 103 * @returns Other error codes as defined for the generic_packet_size_req() function. 104 */ 105 #define nil_packet_size_req(nil_phone, device_id, packet_dimension) \ 106 generic_packet_size_req(nil_phone, NET_NIL_PACKET_SPACE, device_id, packet_dimension) 68 107 108 /** Registers new device or updates the MTU of an existing one. 109 * @param[in] nil_phone The network interface layer phone. 110 * @param[in] device_id The new device identifier. 111 * @param[in] mtu The device maximum transmission unit. 112 * @param[in] netif_service The device driver service. 113 * @returns EOK on success. 114 * @returns EEXIST if the device with the different service exists. 115 * @returns ENOMEM if there is not enough memory left. 116 * @returns Other error codes as defined for the generic_device_req() function. 117 */ 118 #define nil_device_req(nil_phone, device_id, mtu, netif_service) \ 119 generic_device_req(nil_phone, NET_NIL_DEVICE, device_id, mtu, netif_service) 69 120 70 #ifdef CONFIG_NETIF_NIL_BUNDLE 121 /** Notifies the network interface layer about the device state change. 122 * @param[in] nil_phone The network interface layer phone. 123 * @param[in] device_id The device identifier. 124 * @param[in] state The new device state. 125 * @returns EOK on success. 126 * @returns Other error codes as defined for each specific module device state function. 127 */ 128 extern int nil_device_state_msg(int nil_phone, device_id_t device_id, int state); 71 129 72 #include <nil_local.h> 73 #include <packet/packet_server.h> 130 /** Passes the packet queue to the network interface layer. 131 * Processes and redistributes the received packet queue to the registered upper layers. 132 * @param[in] nil_phone The network interface layer phone. 133 * @param[in] device_id The source device identifier. 134 * @param[in] packet The received packet or the received packet queue. 135 * @param target The target service. Ignored parameter. 136 * @returns EOK on success. 137 * @returns Other error codes as defined for each specific module received function. 138 */ 139 extern int nil_received_msg(int nil_phone, device_id_t device_id, packet_t packet, services_t target); 74 140 75 #define nil_device_state_msg nil_device_state_msg_local 76 #define nil_received_msg nil_received_msg_local 77 78 #else /* CONFIG_NETIF_NIL_BUNDLE */ 79 80 #include <nil_remote.h> 81 #include <packet/packet_server.h> 82 83 #define nil_device_state_msg nil_device_state_msg_remote 84 #define nil_received_msg nil_received_msg_remote85 86 #endif /* CONFIG_NETIF_NIL_BUNDLE*/141 /** Creates bidirectional connection with the network interface layer module and registers the message receiver. 142 * @param[in] service The network interface layer module service. 143 * @param[in] device_id The device identifier. 144 * @param[in] me The requesting module service. 145 * @param[in] receiver The message receiver. 146 * @returns The phone of the needed service. 147 * @returns EOK on success. 148 * @returns Other error codes as defined for the bind_service() function. 149 */ 150 #define nil_bind_service(service, device_id, me, receiver) \ 151 bind_service(service, device_id, me, 0, receiver); 152 /*@}*/ 87 153 88 154 #endif
Note:
See TracChangeset
for help on using the changeset viewer.