Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/il/arp/arp.c

    r14f1db0 r849ed54  
    5757#include <packet/packet.h>
    5858#include <packet/packet_client.h>
    59 #include <packet_remote.h>
    6059#include <il_messages.h>
    61 #include <il_interface.h>
    62 #include <il_local.h>
    6360#include <arp_messages.h>
    6461
     
    7168/** ARP module name.
    7269 */
    73 #define NAME  "arp"
     70#define NAME    "ARP protocol"
    7471
    7572/** ARP global data.
     
    341338                        return ERROR_CODE;
    342339                }
    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);
     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);
    345341        }
    346342        fibril_rwlock_write_unlock(&arp_globals.lock);
     
    373369}
    374370
    375 int arp_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    376     ipc_call_t *answer, int *answer_count)
    377 {
     371int arp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    378372        ERROR_DECLARE;
    379        
     373
    380374        measured_string_ref address;
    381375        measured_string_ref translation;
     
    383377        packet_t packet;
    384378        packet_t next;
    385        
     379
     380//      printf("message %d - %d\n", IPC_GET_METHOD(*call), NET_ARP_FIRST);
    386381        *answer_count = 0;
    387         switch (IPC_GET_METHOD(*call)) {
     382        switch(IPC_GET_METHOD(*call)){
    388383                case IPC_M_PHONE_HUNGUP:
    389384                        return EOK;
     
    422417                        return EOK;
    423418                case NET_IL_RECEIVED:
    424                         if(! ERROR_OCCURRED(packet_translate_remote(arp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
     419                        if(! ERROR_OCCURRED(packet_translate(arp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
    425420                                fibril_rwlock_read_lock(&arp_globals.lock);
    426421                                do{
     
    428423                                        ERROR_CODE = arp_receive_message(IPC_GET_DEVICE(call), packet);
    429424                                        if(ERROR_CODE != 1){
    430                                                 pq_release_remote(arp_globals.net_phone, packet_get_id(packet));
     425                                                pq_release(arp_globals.net_phone, packet_get_id(packet));
    431426                                        }
    432427                                        packet = next;
     
    438433                        return arp_mtu_changed_message(IPC_GET_DEVICE(call), IPC_GET_MTU(call));
    439434        }
    440        
    441435        return ENOTSUP;
    442436}
     
    575569                return NULL;
    576570        }
    577         packet = packet_get_4_remote(arp_globals.net_phone, device->packet_dimension.addr_len, device->packet_dimension.prefix, length, device->packet_dimension.suffix);
     571        packet = packet_get_4(arp_globals.net_phone, device->packet_dimension.addr_len, device->packet_dimension.prefix, length, device->packet_dimension.suffix);
    578572        if(! packet){
    579573                return NULL;
     
    581575        header = (arp_header_ref) packet_suffix(packet, length);
    582576        if(! header){
    583                 pq_release_remote(arp_globals.net_phone, packet_get_id(packet));
     577                pq_release(arp_globals.net_phone, packet_get_id(packet));
    584578                return NULL;
    585579        }
     
    598592        memcpy(((uint8_t *) header) + length, target->value, target->length);
    599593        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){
    600                 pq_release_remote(arp_globals.net_phone, packet_get_id(packet));
     594                pq_release(arp_globals.net_phone, packet_get_id(packet));
    601595                return NULL;
    602596        }
     
    624618        }
    625619}
     620
     621#ifdef CONFIG_NETWORKING_modular
     622
     623#include <il_standalone.h>
    626624
    627625/** Default thread for new connections.
     
    651649               
    652650                /* Process the message */
    653                 int res = il_module_message_standalone(callid, &call, &answer,
    654                     &answer_count);
     651                int res = il_module_message(callid, &call, &answer, &answer_count);
    655652               
    656653                /* End if said to either by the message or the processing result */
     
    676673        ERROR_DECLARE;
    677674       
     675        /* Print the module label */
     676        printf("Task %d - %s\n", task_get_id(), NAME);
     677       
    678678        /* Start the module */
    679         if (ERROR_OCCURRED(il_module_start_standalone(il_client_connection)))
     679        if (ERROR_OCCURRED(il_module_start(il_client_connection))) {
     680                printf(" - ERROR %i\n", ERROR_CODE);
    680681                return ERROR_CODE;
     682        }
    681683       
    682684        return EOK;
    683685}
    684686
     687#endif /* CONFIG_NETWORKING_modular */
     688
    685689/** @}
    686690 */
Note: See TracChangeset for help on using the changeset viewer.