Ignore:
File:
1 edited

Legend:

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

    r849ed54 r14f1db0  
    5757#include <packet/packet.h>
    5858#include <packet/packet_client.h>
     59#include <packet_remote.h>
    5960#include <il_messages.h>
     61#include <il_interface.h>
     62#include <il_local.h>
    6063#include <arp_messages.h>
    6164
     
    6871/** ARP module name.
    6972 */
    70 #define NAME    "ARP protocol"
     73#define NAME  "arp"
    7174
    7275/** ARP global data.
     
    338341                        return ERROR_CODE;
    339342                }
    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);
    341345        }
    342346        fibril_rwlock_write_unlock(&arp_globals.lock);
     
    369373}
    370374
    371 int arp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
     375int arp_message_standalone(ipc_callid_t callid, ipc_call_t *call,
     376    ipc_call_t *answer, int *answer_count)
     377{
    372378        ERROR_DECLARE;
    373 
     379       
    374380        measured_string_ref address;
    375381        measured_string_ref translation;
     
    377383        packet_t packet;
    378384        packet_t next;
    379 
    380 //      printf("message %d - %d\n", IPC_GET_METHOD(*call), NET_ARP_FIRST);
     385       
    381386        *answer_count = 0;
    382         switch(IPC_GET_METHOD(*call)){
     387        switch (IPC_GET_METHOD(*call)) {
    383388                case IPC_M_PHONE_HUNGUP:
    384389                        return EOK;
     
    417422                        return EOK;
    418423                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)))){
    420425                                fibril_rwlock_read_lock(&arp_globals.lock);
    421426                                do{
     
    423428                                        ERROR_CODE = arp_receive_message(IPC_GET_DEVICE(call), packet);
    424429                                        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));
    426431                                        }
    427432                                        packet = next;
     
    433438                        return arp_mtu_changed_message(IPC_GET_DEVICE(call), IPC_GET_MTU(call));
    434439        }
     440       
    435441        return ENOTSUP;
    436442}
     
    569575                return NULL;
    570576        }
    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);
    572578        if(! packet){
    573579                return NULL;
     
    575581        header = (arp_header_ref) packet_suffix(packet, length);
    576582        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));
    578584                return NULL;
    579585        }
     
    592598        memcpy(((uint8_t *) header) + length, target->value, target->length);
    593599        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));
    595601                return NULL;
    596602        }
     
    618624        }
    619625}
    620 
    621 #ifdef CONFIG_NETWORKING_modular
    622 
    623 #include <il_standalone.h>
    624626
    625627/** Default thread for new connections.
     
    649651               
    650652                /* 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);
    652655               
    653656                /* End if said to either by the message or the processing result */
     
    673676        ERROR_DECLARE;
    674677       
    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;
    677681       
    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}
    688684
    689685/** @}
Note: See TracChangeset for help on using the changeset viewer.