Changes in uspace/srv/net/il/arp/arp.c [849ed54:14f1db0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/il/arp/arp.c
r849ed54 r14f1db0 57 57 #include <packet/packet.h> 58 58 #include <packet/packet_client.h> 59 #include <packet_remote.h> 59 60 #include <il_messages.h> 61 #include <il_interface.h> 62 #include <il_local.h> 60 63 #include <arp_messages.h> 61 64 … … 68 71 /** ARP module name. 69 72 */ 70 #define NAME "ARP protocol"73 #define NAME "arp" 71 74 72 75 /** ARP global data. … … 338 341 return ERROR_CODE; 339 342 } 340 printf("New device registered:\n\tid\t= %d\n\ttype\t= 0x%x\n\tservice\t= %d\n\tproto\t= %d\n", device->device_id, device->hardware, device->service, protocol); 343 printf("%s: Device registered (id: %d, type: 0x%x, service: %d, proto: %d)\n", 344 NAME, device->device_id, device->hardware, device->service, protocol); 341 345 } 342 346 fibril_rwlock_write_unlock(&arp_globals.lock); … … 369 373 } 370 374 371 int arp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){ 375 int arp_message_standalone(ipc_callid_t callid, ipc_call_t *call, 376 ipc_call_t *answer, int *answer_count) 377 { 372 378 ERROR_DECLARE; 373 379 374 380 measured_string_ref address; 375 381 measured_string_ref translation; … … 377 383 packet_t packet; 378 384 packet_t next; 379 380 // printf("message %d - %d\n", IPC_GET_METHOD(*call), NET_ARP_FIRST); 385 381 386 *answer_count = 0; 382 switch (IPC_GET_METHOD(*call)){387 switch (IPC_GET_METHOD(*call)) { 383 388 case IPC_M_PHONE_HUNGUP: 384 389 return EOK; … … 417 422 return EOK; 418 423 case NET_IL_RECEIVED: 419 if(! ERROR_OCCURRED(packet_translate (arp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){424 if(! ERROR_OCCURRED(packet_translate_remote(arp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){ 420 425 fibril_rwlock_read_lock(&arp_globals.lock); 421 426 do{ … … 423 428 ERROR_CODE = arp_receive_message(IPC_GET_DEVICE(call), packet); 424 429 if(ERROR_CODE != 1){ 425 pq_release (arp_globals.net_phone, packet_get_id(packet));430 pq_release_remote(arp_globals.net_phone, packet_get_id(packet)); 426 431 } 427 432 packet = next; … … 433 438 return arp_mtu_changed_message(IPC_GET_DEVICE(call), IPC_GET_MTU(call)); 434 439 } 440 435 441 return ENOTSUP; 436 442 } … … 569 575 return NULL; 570 576 } 571 packet = packet_get_4 (arp_globals.net_phone, device->packet_dimension.addr_len, device->packet_dimension.prefix, length, device->packet_dimension.suffix);577 packet = packet_get_4_remote(arp_globals.net_phone, device->packet_dimension.addr_len, device->packet_dimension.prefix, length, device->packet_dimension.suffix); 572 578 if(! packet){ 573 579 return NULL; … … 575 581 header = (arp_header_ref) packet_suffix(packet, length); 576 582 if(! header){ 577 pq_release (arp_globals.net_phone, packet_get_id(packet));583 pq_release_remote(arp_globals.net_phone, packet_get_id(packet)); 578 584 return NULL; 579 585 } … … 592 598 memcpy(((uint8_t *) header) + length, target->value, target->length); 593 599 if(packet_set_addr(packet, (uint8_t *) device->addr->value, (uint8_t *) device->broadcast_addr->value, CONVERT_SIZE(char, uint8_t, device->addr->length)) != EOK){ 594 pq_release (arp_globals.net_phone, packet_get_id(packet));600 pq_release_remote(arp_globals.net_phone, packet_get_id(packet)); 595 601 return NULL; 596 602 } … … 618 624 } 619 625 } 620 621 #ifdef CONFIG_NETWORKING_modular622 623 #include <il_standalone.h>624 626 625 627 /** Default thread for new connections. … … 649 651 650 652 /* Process the message */ 651 int res = il_module_message(callid, &call, &answer, &answer_count); 653 int res = il_module_message_standalone(callid, &call, &answer, 654 &answer_count); 652 655 653 656 /* End if said to either by the message or the processing result */ … … 673 676 ERROR_DECLARE; 674 677 675 /* Print the module label */ 676 printf("Task %d - %s\n", task_get_id(), NAME); 678 /* Start the module */ 679 if (ERROR_OCCURRED(il_module_start_standalone(il_client_connection))) 680 return ERROR_CODE; 677 681 678 /* Start the module */ 679 if (ERROR_OCCURRED(il_module_start(il_client_connection))) { 680 printf(" - ERROR %i\n", ERROR_CODE); 681 return ERROR_CODE; 682 } 683 684 return EOK; 685 } 686 687 #endif /* CONFIG_NETWORKING_modular */ 682 return EOK; 683 } 688 684 689 685 /** @}
Note:
See TracChangeset
for help on using the changeset viewer.