Changes in uspace/lib/c/generic/inetping.c [6428115:3e66428] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/inetping.c
r6428115 r3e66428 49 49 50 50 assert(inetping_sess == NULL); 51 51 52 52 inetping_ev_ops = ev_ops; 53 53 54 54 rc = loc_service_get_id(SERVICE_NAME_INETPING, &inetping_svc, 55 55 IPC_FLAG_BLOCKING); 56 56 if (rc != EOK) 57 57 return ENOENT; 58 58 59 59 inetping_sess = loc_service_connect(EXCHANGE_SERIALIZE, inetping_svc, 60 60 IPC_FLAG_BLOCKING); 61 61 if (inetping_sess == NULL) 62 62 return ENOENT; 63 63 64 64 async_exch_t *exch = async_exchange_begin(inetping_sess); 65 65 66 66 rc = async_connect_to_me(exch, 0, 0, 0, inetping_cb_conn, NULL); 67 67 async_exchange_end(exch); 68 68 69 69 if (rc != EOK) { 70 70 async_hangup(inetping_sess); … … 72 72 return rc; 73 73 } 74 74 75 75 return EOK; 76 76 } … … 79 79 { 80 80 async_exch_t *exch = async_exchange_begin(inetping_sess); 81 81 82 82 ipc_call_t answer; 83 aid_t req = async_send_3(exch, INETPING_SEND, sdu->src.ipv4,84 sdu->dest.ipv4, sdu->seq_no, &answer);83 aid_t req = async_send_3(exch, INETPING_SEND, (sysarg_t) sdu->src, 84 (sysarg_t) sdu->dest, sdu->seq_no, &answer); 85 85 sysarg_t retval = async_data_write_start(exch, sdu->data, sdu->size); 86 86 87 87 async_exchange_end(exch); 88 88 89 89 if (retval != EOK) { 90 async_ wait_for(req, NULL);90 async_forget(req); 91 91 return retval; 92 92 } 93 93 94 94 async_wait_for(req, &retval); 95 95 return retval; 96 96 } 97 97 98 int inetping_get_srcaddr( inet_addr_t *remote, inet_addr_t *local)98 int inetping_get_srcaddr(uint32_t remote, uint32_t *local) 99 99 { 100 async_exch_t *exch = async_exchange_begin(inetping_sess); 101 100 102 sysarg_t local_addr; 101 async_exch_t *exch = async_exchange_begin(inetping_sess); 102 103 int rc = async_req_1_1(exch, INETPING_GET_SRCADDR, remote->ipv4, 103 int rc = async_req_1_1(exch, INETPING_GET_SRCADDR, (sysarg_t) remote, 104 104 &local_addr); 105 105 106 async_exchange_end(exch); 106 107 107 108 if (rc != EOK) 108 109 return rc; 109 110 local->ipv4 =local_addr;110 111 *local = (uint32_t) local_addr; 111 112 return EOK; 112 113 } … … 114 115 static void inetping_ev_recv(ipc_callid_t callid, ipc_call_t *call) 115 116 { 116 int rc;117 117 inetping_sdu_t sdu; 118 119 sdu.src .ipv4= IPC_GET_ARG1(*call);120 sdu.dest .ipv4= IPC_GET_ARG2(*call);118 119 sdu.src = IPC_GET_ARG1(*call); 120 sdu.dest = IPC_GET_ARG2(*call); 121 121 sdu.seq_no = IPC_GET_ARG3(*call); 122 123 rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size);122 123 int rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size); 124 124 if (rc != EOK) { 125 125 async_answer_0(callid, rc); 126 126 return; 127 127 } 128 128 129 129 rc = inetping_ev_ops->recv(&sdu); 130 130 free(sdu.data);
Note:
See TracChangeset
for help on using the changeset viewer.