Changes in uspace/srv/net/netif/lo/lo.c [774e6d1a:f87c900] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/netif/lo/lo.c
r774e6d1a rf87c900 49 49 #include <net/device.h> 50 50 #include <nil_interface.h> 51 #include <netif_skel.h> 51 #include <netif_interface.h> 52 #include <netif_local.h> 52 53 53 54 /** Default hardware address. */ 54 #define DEFAULT_ADDR 055 #define DEFAULT_ADDR "\0\0\0\0\0\0" 55 56 56 57 /** Default address length. */ 57 #define DEFAULT_ADDR_LEN 658 #define DEFAULT_ADDR_LEN (sizeof(DEFAULT_ADDR) / sizeof(char)) 58 59 59 60 /** Loopback module name. */ … … 61 62 62 63 /** Network interface global data. */ 63 netif_globals_t 64 netif_globals_t netif_globals; 64 65 65 66 int netif_specific_message(ipc_callid_t callid, ipc_call_t *call, 66 ipc_call_t *answer, size_t *count)67 ipc_call_t *answer, int *answer_count) 67 68 { 68 69 return ENOTSUP; … … 73 74 if (!address) 74 75 return EBADMEM; 75 76 uint8_t *addr = (uint8_t *) malloc(DEFAULT_ADDR_LEN); 77 memset(addr, DEFAULT_ADDR, DEFAULT_ADDR_LEN); 78 79 address->value = addr; 76 77 address->value = str_dup(DEFAULT_ADDR); 80 78 address->length = DEFAULT_ADDR_LEN; 81 79 82 80 return EOK; 83 81 } … … 171 169 } 172 170 173 int netif_probe_message(device_id_t device_id, int irq, void *io)171 int netif_probe_message(device_id_t device_id, int irq, uintptr_t io) 174 172 { 175 173 netif_device_t *device; … … 232 230 } 233 231 232 /** Default thread for new connections. 233 * 234 * @param[in] iid The initial message identifier. 235 * @param[in] icall The initial message call structure. 236 */ 237 static void netif_client_connection(ipc_callid_t iid, ipc_call_t *icall) 238 { 239 /* 240 * Accept the connection 241 * - Answer the first IPC_M_CONNECT_ME_TO call. 242 */ 243 ipc_answer_0(iid, EOK); 244 245 while (true) { 246 ipc_call_t answer; 247 int answer_count; 248 249 /* Clear the answer structure */ 250 refresh_answer(&answer, &answer_count); 251 252 /* Fetch the next message */ 253 ipc_call_t call; 254 ipc_callid_t callid = async_get_call(&call); 255 256 /* Process the message */ 257 int res = netif_module_message(NAME, callid, &call, &answer, 258 &answer_count); 259 260 /* 261 * End if told to either by the message or the processing 262 * result. 263 */ 264 if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) || 265 (res == EHANGUP)) 266 return; 267 268 /* Answer the message */ 269 answer_call(callid, res, &answer, answer_count); 270 } 271 } 272 234 273 int main(int argc, char *argv[]) 235 274 { 275 int rc; 276 236 277 /* Start the module */ 237 return netif_module_start(); 278 rc = netif_module_start(netif_client_connection); 279 return rc; 238 280 } 239 281
Note:
See TracChangeset
for help on using the changeset viewer.