Changeset f3386d7 in mainline for uspace/srv/net/inetsrv/inetcfg.c
- Timestamp:
- 2013-07-15T20:44:54Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f8d3df3
- Parents:
- 273c976 (diff), a940f1d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/inetsrv/inetcfg.c
r273c976 rf3386d7 56 56 inet_link_t *ilink; 57 57 inet_addrobj_t *addr; 58 i plink_addr_t iaddr;58 inet_addr_t iaddr; 59 59 int rc; 60 60 … … 82 82 } 83 83 84 i addr.ipv4 = addr->naddr.ipv4;84 inet_naddr_addr(&addr->naddr, &iaddr); 85 85 rc = iplink_addr_add(ilink->iplink, &iaddr); 86 86 if (rc != EOK) { … … 236 236 } 237 237 238 static void inetcfg_addr_create_static_srv(ipc_callid_t callid, 239 ipc_call_t *call) 240 { 238 static void inetcfg_addr_create_static_srv(ipc_callid_t iid, 239 ipc_call_t *icall) 240 { 241 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_create_static_srv()"); 242 243 sysarg_t link_id = IPC_GET_ARG1(*icall); 244 245 ipc_callid_t callid; 246 size_t size; 247 if (!async_data_write_receive(&callid, &size)) { 248 async_answer_0(callid, EINVAL); 249 async_answer_0(iid, EINVAL); 250 return; 251 } 252 253 if (size != sizeof(inet_naddr_t)) { 254 async_answer_0(callid, EINVAL); 255 async_answer_0(iid, EINVAL); 256 return; 257 } 258 259 inet_naddr_t naddr; 260 int rc = async_data_write_finalize(callid, &naddr, size); 261 if (rc != EOK) { 262 async_answer_0(callid, rc); 263 async_answer_0(iid, rc); 264 return; 265 } 266 241 267 char *name; 242 inet_naddr_t naddr;243 sysarg_t link_id;244 sysarg_t addr_id;245 int rc;246 247 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_create_static_srv()");248 249 268 rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN, 250 269 0, NULL); 251 270 if (rc != EOK) { 252 async_answer_0(callid, rc); 253 return; 254 } 255 256 naddr.ipv4 = IPC_GET_ARG1(*call); 257 naddr.bits = IPC_GET_ARG2(*call); 258 link_id = IPC_GET_ARG3(*call); 259 260 addr_id = 0; 271 async_answer_0(iid, rc); 272 return; 273 } 274 275 sysarg_t addr_id = 0; 261 276 rc = inetcfg_addr_create_static(name, &naddr, link_id, &addr_id); 262 277 free(name); 263 async_answer_1( callid, rc, addr_id);278 async_answer_1(iid, rc, addr_id); 264 279 } 265 280 … … 277 292 } 278 293 279 static void inetcfg_addr_get_srv(ipc_callid_t callid, ipc_call_t *call)280 { 281 ipc_callid_t rcallid;282 size_t max_size;283 284 sysarg_t addr_id;294 static void inetcfg_addr_get_srv(ipc_callid_t iid, ipc_call_t *icall) 295 { 296 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_get_srv()"); 297 298 sysarg_t addr_id = IPC_GET_ARG1(*icall); 299 285 300 inet_addr_info_t ainfo; 286 int rc; 287 288 addr_id = IPC_GET_ARG1(*call); 289 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_get_srv()"); 290 291 ainfo.naddr.ipv4 = 0; 292 ainfo.naddr.bits = 0; 301 302 inet_naddr_any(&ainfo.naddr); 293 303 ainfo.ilink = 0; 294 304 ainfo.name = NULL; 295 296 if (!async_data_read_receive(&rcallid, &max_size)) { 297 async_answer_0(rcallid, EREFUSED); 298 async_answer_0(callid, EREFUSED); 299 return; 300 } 301 302 rc = inetcfg_addr_get(addr_id, &ainfo); 303 if (rc != EOK) { 304 async_answer_0(callid, rc); 305 return; 306 } 307 308 sysarg_t retval = async_data_read_finalize(rcallid, ainfo.name, 309 min(max_size, str_size(ainfo.name))); 305 306 int rc = inetcfg_addr_get(addr_id, &ainfo); 307 if (rc != EOK) { 308 async_answer_0(iid, rc); 309 return; 310 } 311 312 ipc_callid_t callid; 313 size_t size; 314 if (!async_data_read_receive(&callid, &size)) { 315 async_answer_0(callid, EREFUSED); 316 async_answer_0(iid, EREFUSED); 317 return; 318 } 319 320 if (size != sizeof(inet_naddr_t)) { 321 async_answer_0(callid, EINVAL); 322 async_answer_0(iid, EINVAL); 323 return; 324 } 325 326 rc = async_data_read_finalize(callid, &ainfo.naddr, size); 327 if (rc != EOK) { 328 async_answer_0(callid, rc); 329 async_answer_0(iid, rc); 330 return; 331 } 332 333 if (!async_data_read_receive(&callid, &size)) { 334 async_answer_0(callid, EREFUSED); 335 async_answer_0(iid, EREFUSED); 336 return; 337 } 338 339 rc = async_data_read_finalize(callid, ainfo.name, 340 min(size, str_size(ainfo.name))); 310 341 free(ainfo.name); 311 312 async_answer_3(callid, retval, ainfo.naddr.ipv4, ainfo.naddr.bits, 313 ainfo.ilink); 342 343 if (rc != EOK) { 344 async_answer_0(callid, rc); 345 async_answer_0(iid, rc); 346 return; 347 } 348 349 async_answer_1(iid, (sysarg_t) rc, ainfo.ilink); 314 350 } 315 351 … … 372 408 } 373 409 374 375 410 static void inetcfg_get_link_list_srv(ipc_callid_t callid, ipc_call_t *call) 376 411 { … … 473 508 } 474 509 475 static void inetcfg_sroute_create_srv(ipc_callid_t callid, 476 ipc_call_t *call) 477 { 510 static void inetcfg_sroute_create_srv(ipc_callid_t iid, 511 ipc_call_t *icall) 512 { 513 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_create_srv()"); 514 515 ipc_callid_t callid; 516 size_t size; 517 if (!async_data_write_receive(&callid, &size)) { 518 async_answer_0(callid, EINVAL); 519 async_answer_0(iid, EINVAL); 520 return; 521 } 522 523 if (size != sizeof(inet_naddr_t)) { 524 async_answer_0(callid, EINVAL); 525 async_answer_0(iid, EINVAL); 526 return; 527 } 528 529 inet_naddr_t dest; 530 int rc = async_data_write_finalize(callid, &dest, size); 531 if (rc != EOK) { 532 async_answer_0(callid, rc); 533 async_answer_0(iid, rc); 534 return; 535 } 536 537 if (!async_data_write_receive(&callid, &size)) { 538 async_answer_0(callid, EINVAL); 539 async_answer_0(iid, EINVAL); 540 return; 541 } 542 543 if (size != sizeof(inet_addr_t)) { 544 async_answer_0(callid, EINVAL); 545 async_answer_0(iid, EINVAL); 546 return; 547 } 548 549 inet_addr_t router; 550 rc = async_data_write_finalize(callid, &router, size); 551 if (rc != EOK) { 552 async_answer_0(callid, rc); 553 async_answer_0(iid, rc); 554 return; 555 } 556 478 557 char *name; 479 inet_naddr_t dest;480 inet_addr_t router;481 sysarg_t sroute_id;482 int rc;483 484 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_create_srv()");485 486 558 rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN, 487 559 0, NULL); 488 560 if (rc != EOK) { 489 async_answer_0(callid, rc); 490 return; 491 } 492 493 dest.ipv4 = IPC_GET_ARG1(*call); 494 dest.bits = IPC_GET_ARG2(*call); 495 router.ipv4 = IPC_GET_ARG3(*call); 496 497 sroute_id = 0; 561 async_answer_0(iid, rc); 562 return; 563 } 564 565 sysarg_t sroute_id = 0; 498 566 rc = inetcfg_sroute_create(name, &dest, &router, &sroute_id); 499 567 free(name); 500 async_answer_1( callid, rc, sroute_id);568 async_answer_1(iid, rc, sroute_id); 501 569 } 502 570 … … 514 582 } 515 583 516 static void inetcfg_sroute_get_srv(ipc_callid_t callid, ipc_call_t *call)517 { 518 ipc_callid_t rcallid;519 size_t max_size;520 521 sysarg_t sroute_id;584 static void inetcfg_sroute_get_srv(ipc_callid_t iid, ipc_call_t *icall) 585 { 586 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_get_srv()"); 587 588 sysarg_t sroute_id = IPC_GET_ARG1(*icall); 589 522 590 inet_sroute_info_t srinfo; 523 int rc; 524 525 sroute_id = IPC_GET_ARG1(*call); 526 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_get_srv()"); 527 528 srinfo.dest.ipv4 = 0; 529 srinfo.dest.bits = 0; 530 srinfo.router.ipv4 = 0; 591 592 inet_naddr_any(&srinfo.dest); 593 inet_addr_any(&srinfo.router); 531 594 srinfo.name = NULL; 532 533 if (!async_data_read_receive(&rcallid, &max_size)) { 534 async_answer_0(rcallid, EREFUSED); 535 async_answer_0(callid, EREFUSED); 536 return; 537 } 538 539 rc = inetcfg_sroute_get(sroute_id, &srinfo); 540 if (rc != EOK) { 541 async_answer_0(callid, rc); 542 return; 543 } 544 545 sysarg_t retval = async_data_read_finalize(rcallid, srinfo.name, 546 min(max_size, str_size(srinfo.name))); 595 596 int rc = inetcfg_sroute_get(sroute_id, &srinfo); 597 if (rc != EOK) { 598 async_answer_0(iid, rc); 599 return; 600 } 601 602 ipc_callid_t callid; 603 size_t size; 604 if (!async_data_read_receive(&callid, &size)) { 605 async_answer_0(callid, EREFUSED); 606 async_answer_0(iid, EREFUSED); 607 return; 608 } 609 610 if (size != sizeof(inet_naddr_t)) { 611 async_answer_0(callid, EINVAL); 612 async_answer_0(iid, EINVAL); 613 return; 614 } 615 616 rc = async_data_read_finalize(callid, &srinfo.dest, size); 617 if (rc != EOK) { 618 async_answer_0(callid, rc); 619 async_answer_0(iid, rc); 620 return; 621 } 622 623 if (!async_data_read_receive(&callid, &size)) { 624 async_answer_0(callid, EREFUSED); 625 async_answer_0(iid, EREFUSED); 626 return; 627 } 628 629 if (size != sizeof(inet_addr_t)) { 630 async_answer_0(callid, EINVAL); 631 async_answer_0(iid, EINVAL); 632 return; 633 } 634 635 rc = async_data_read_finalize(callid, &srinfo.router, size); 636 if (rc != EOK) { 637 async_answer_0(callid, rc); 638 async_answer_0(iid, rc); 639 return; 640 } 641 642 if (!async_data_read_receive(&callid, &size)) { 643 async_answer_0(callid, EREFUSED); 644 async_answer_0(iid, EREFUSED); 645 return; 646 } 647 648 rc = async_data_read_finalize(callid, srinfo.name, 649 min(size, str_size(srinfo.name))); 547 650 free(srinfo.name); 548 549 async_answer_3(callid, retval, srinfo.dest.ipv4, srinfo.dest.bits, 550 srinfo.router.ipv4); 651 652 async_answer_0(iid, (sysarg_t) rc); 551 653 } 552 654
Note:
See TracChangeset
for help on using the changeset viewer.