Changeset a46e56b in mainline for uspace/srv/net/inetsrv/inetping.c
- Timestamp:
- 2018-03-22T06:49:35Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 77f0a1d
- Parents:
- 3e242d2
- git-author:
- Jakub Jermar <jakub@…> (2018-03-21 23:29:06)
- git-committer:
- Jakub Jermar <jakub@…> (2018-03-22 06:49:35)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/inetsrv/inetping.c
r3e242d2 ra46e56b 136 136 } 137 137 138 static void inetping_send_srv(inetping_client_t *client, cap_call_handle_t i id,138 static void inetping_send_srv(inetping_client_t *client, cap_call_handle_t icall_handle, 139 139 ipc_call_t *icall) 140 140 { … … 146 146 sdu.seq_no = IPC_GET_ARG1(*icall); 147 147 148 cap_call_handle_t c allid;148 cap_call_handle_t chandle; 149 149 size_t size; 150 if (!async_data_write_receive(&c allid, &size)) {151 async_answer_0(c allid, EREFUSED);152 async_answer_0(i id, EREFUSED);150 if (!async_data_write_receive(&chandle, &size)) { 151 async_answer_0(chandle, EREFUSED); 152 async_answer_0(icall_handle, EREFUSED); 153 153 return; 154 154 } 155 155 156 156 if (size != sizeof(sdu.src)) { 157 async_answer_0(c allid, EINVAL);158 async_answer_0(i id, EINVAL);159 return; 160 } 161 162 rc = async_data_write_finalize(c allid, &sdu.src, size);163 if (rc != EOK) { 164 async_answer_0(c allid, rc);165 async_answer_0(i id, rc);166 return; 167 } 168 169 if (!async_data_write_receive(&c allid, &size)) {170 async_answer_0(c allid, EREFUSED);171 async_answer_0(i id, EREFUSED);157 async_answer_0(chandle, EINVAL); 158 async_answer_0(icall_handle, EINVAL); 159 return; 160 } 161 162 rc = async_data_write_finalize(chandle, &sdu.src, size); 163 if (rc != EOK) { 164 async_answer_0(chandle, rc); 165 async_answer_0(icall_handle, rc); 166 return; 167 } 168 169 if (!async_data_write_receive(&chandle, &size)) { 170 async_answer_0(chandle, EREFUSED); 171 async_answer_0(icall_handle, EREFUSED); 172 172 return; 173 173 } 174 174 175 175 if (size != sizeof(sdu.dest)) { 176 async_answer_0(c allid, EINVAL);177 async_answer_0(i id, EINVAL);178 return; 179 } 180 181 rc = async_data_write_finalize(c allid, &sdu.dest, size);182 if (rc != EOK) { 183 async_answer_0(c allid, rc);184 async_answer_0(i id, rc);176 async_answer_0(chandle, EINVAL); 177 async_answer_0(icall_handle, EINVAL); 178 return; 179 } 180 181 rc = async_data_write_finalize(chandle, &sdu.dest, size); 182 if (rc != EOK) { 183 async_answer_0(chandle, rc); 184 async_answer_0(icall_handle, rc); 185 185 return; 186 186 } … … 189 189 &sdu.size); 190 190 if (rc != EOK) { 191 async_answer_0(i id, rc);191 async_answer_0(icall_handle, rc); 192 192 return; 193 193 } … … 196 196 free(sdu.data); 197 197 198 async_answer_0(i id, rc);198 async_answer_0(icall_handle, rc); 199 199 } 200 200 201 201 static void inetping_get_srcaddr_srv(inetping_client_t *client, 202 cap_call_handle_t i id, ipc_call_t *icall)202 cap_call_handle_t icall_handle, ipc_call_t *icall) 203 203 { 204 204 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetping_get_srcaddr_srv()"); 205 205 206 cap_call_handle_t c allid;206 cap_call_handle_t chandle; 207 207 size_t size; 208 208 … … 210 210 inet_addr_t remote; 211 211 212 if (!async_data_write_receive(&c allid, &size)) {213 async_answer_0(c allid, EREFUSED);214 async_answer_0(i id, EREFUSED);212 if (!async_data_write_receive(&chandle, &size)) { 213 async_answer_0(chandle, EREFUSED); 214 async_answer_0(icall_handle, EREFUSED); 215 215 return; 216 216 } 217 217 218 218 if (size != sizeof(remote)) { 219 async_answer_0(c allid, EINVAL);220 async_answer_0(i id, EINVAL);221 return; 222 } 223 224 errno_t rc = async_data_write_finalize(c allid, &remote, size);225 if (rc != EOK) { 226 async_answer_0(c allid, rc);227 async_answer_0(i id, rc);219 async_answer_0(chandle, EINVAL); 220 async_answer_0(icall_handle, EINVAL); 221 return; 222 } 223 224 errno_t rc = async_data_write_finalize(chandle, &remote, size); 225 if (rc != EOK) { 226 async_answer_0(chandle, rc); 227 async_answer_0(icall_handle, rc); 228 228 return; 229 229 } … … 231 231 rc = inetping_get_srcaddr(client, &remote, &local); 232 232 if (rc != EOK) { 233 async_answer_0(i id, rc);234 return; 235 } 236 237 if (!async_data_read_receive(&c allid, &size)) {238 async_answer_0(c allid, EREFUSED);239 async_answer_0(i id, EREFUSED);233 async_answer_0(icall_handle, rc); 234 return; 235 } 236 237 if (!async_data_read_receive(&chandle, &size)) { 238 async_answer_0(chandle, EREFUSED); 239 async_answer_0(icall_handle, EREFUSED); 240 240 return; 241 241 } 242 242 243 243 if (size != sizeof(local)) { 244 async_answer_0(c allid, EINVAL);245 async_answer_0(i id, EINVAL);246 return; 247 } 248 249 rc = async_data_read_finalize(c allid, &local, size);244 async_answer_0(chandle, EINVAL); 245 async_answer_0(icall_handle, EINVAL); 246 return; 247 } 248 249 rc = async_data_read_finalize(chandle, &local, size); 250 250 if (rc != EOK) 251 async_answer_0(c allid, rc);252 253 async_answer_0(i id, rc);251 async_answer_0(chandle, rc); 252 253 async_answer_0(icall_handle, rc); 254 254 } 255 255 … … 281 281 } 282 282 283 void inetping_conn(cap_call_handle_t i id, ipc_call_t *icall, void *arg)283 void inetping_conn(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg) 284 284 { 285 285 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetping_conn()"); 286 286 287 287 /* Accept the connection */ 288 async_answer_0(i id, EOK);288 async_answer_0(icall_handle, EOK); 289 289 290 290 inetping_client_t client; … … 295 295 while (true) { 296 296 ipc_call_t call; 297 cap_call_handle_t c allid= async_get_call(&call);297 cap_call_handle_t chandle = async_get_call(&call); 298 298 sysarg_t method = IPC_GET_IMETHOD(call); 299 299 300 300 if (!method) { 301 301 /* The other side has hung up */ 302 async_answer_0(c allid, EOK);302 async_answer_0(chandle, EOK); 303 303 break; 304 304 } … … 306 306 switch (method) { 307 307 case INETPING_SEND: 308 inetping_send_srv(&client, c allid, &call);308 inetping_send_srv(&client, chandle, &call); 309 309 break; 310 310 case INETPING_GET_SRCADDR: 311 inetping_get_srcaddr_srv(&client, c allid, &call);311 inetping_get_srcaddr_srv(&client, chandle, &call); 312 312 break; 313 313 default: 314 async_answer_0(c allid, EINVAL);314 async_answer_0(chandle, EINVAL); 315 315 } 316 316 }
Note:
See TracChangeset
for help on using the changeset viewer.