Changes in uspace/srv/net/nil/nildummy/nildummy.c [77a69ea:8d7ec69d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/nil/nildummy/nildummy.c
r77a69ea r8d7ec69d 2 2 * Copyright (c) 2009 Lukas Mejdrech 3 3 * Copyright (c) 2011 Radim Vansa 4 * Copyright (c) 2011 Jiri Svoboda 4 5 * All rights reserved. 5 6 * … … 69 70 DEVICE_MAP_IMPLEMENT(nildummy_devices, nildummy_device_t); 70 71 71 int nil_device_state_msg_local(nic_device_id_t device_id, sysarg_t state) 72 static void nildummy_nic_cb_conn(ipc_callid_t iid, ipc_call_t *icall, 73 void *arg); 74 75 static int nildummy_device_state(nic_device_id_t device_id, sysarg_t state) 72 76 { 73 77 fibril_rwlock_read_lock(&nildummy_globals.protos_lock); … … 78 82 79 83 return EOK; 84 } 85 86 static int nildummy_addr_changed(nic_device_id_t device_id) 87 { 88 return ENOTSUP; 80 89 } 81 90 … … 173 182 } 174 183 175 nic_connect_to_nil(device->sess, SERVICE_NILDUMMY, device_id); 184 int rc = nic_callback_create(device->sess, device_id, 185 nildummy_nic_cb_conn, NULL); 186 if (rc != EOK) { 187 async_hangup(device->sess); 188 189 return ENOENT; 190 } 176 191 177 192 /* Get hardware address */ 178 intrc = nic_get_address(device->sess, &device->addr);193 rc = nic_get_address(device->sess, &device->addr); 179 194 if (rc != EOK) { 180 195 fibril_rwlock_write_unlock(&nildummy_globals.devices_lock); … … 445 460 *answer_count = 1; 446 461 return rc; 447 case NET_NIL_DEVICE_STATE:448 rc = nil_device_state_msg_local(IPC_GET_DEVICE(*call),449 IPC_GET_STATE(*call));450 async_answer_0(callid, (sysarg_t) rc);451 return rc;452 453 case NET_NIL_RECEIVED:454 rc = nildummy_received(IPC_GET_ARG1(*call));455 async_answer_0(callid, (sysarg_t) rc);456 return rc;457 462 } 458 463 459 464 return ENOTSUP; 460 465 } 466 467 static void nildummy_nic_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg) 468 { 469 int rc; 470 471 async_answer_0(iid, EOK); 472 473 while (true) { 474 ipc_call_t call; 475 ipc_callid_t callid = async_get_call(&call); 476 477 if (!IPC_GET_IMETHOD(call)) 478 break; 479 480 switch (IPC_GET_IMETHOD(call)) { 481 case NIC_EV_DEVICE_STATE: 482 rc = nildummy_device_state(IPC_GET_ARG1(call), 483 IPC_GET_ARG2(call)); 484 async_answer_0(callid, (sysarg_t) rc); 485 break; 486 case NIC_EV_RECEIVED: 487 rc = nildummy_received(IPC_GET_ARG1(call)); 488 async_answer_0(callid, (sysarg_t) rc); 489 break; 490 case NIC_EV_ADDR_CHANGED: 491 rc = nildummy_addr_changed(IPC_GET_ARG1(call)); 492 async_answer_0(callid, (sysarg_t) rc); 493 break; 494 default: 495 async_answer_0(callid, ENOTSUP); 496 } 497 } 498 } 499 461 500 462 501 int main(int argc, char *argv[])
Note:
See TracChangeset
for help on using the changeset viewer.