Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tl/icmp/icmp.c

    r14f1db0 r849ed54  
    5151#include <net_modules.h>
    5252#include <packet/packet_client.h>
    53 #include <packet_remote.h>
    5453#include <net_byteorder.h>
    5554#include <net_checksum.h>
     
    6867#include <socket_errno.h>
    6968#include <tl_messages.h>
    70 #include <tl_interface.h>
    71 #include <tl_local.h>
    7269#include <icmp_messages.h>
    7370#include <icmp_header.h>
     
    291288        // TODO do not ask all the time
    292289        ERROR_PROPAGATE(ip_packet_size_req(icmp_globals.ip_phone, -1, &icmp_globals.packet_dimension));
    293         packet = packet_get_4_remote(icmp_globals.net_phone, size, icmp_globals.packet_dimension.addr_len, ICMP_HEADER_SIZE + icmp_globals.packet_dimension.prefix, icmp_globals.packet_dimension.suffix);
     290        packet = packet_get_4(icmp_globals.net_phone, size, icmp_globals.packet_dimension.addr_len, ICMP_HEADER_SIZE + icmp_globals.packet_dimension.prefix, icmp_globals.packet_dimension.suffix);
    294291        if(! packet){
    295292                return ENOMEM;
     
    629626        // compute the reply key
    630627        reply_key = ICMP_GET_REPLY_KEY(header->un.echo.identifier, header->un.echo.sequence_number);
    631         pq_release_remote(icmp_globals.net_phone, packet_get_id(packet));
     628        pq_release(icmp_globals.net_phone, packet_get_id(packet));
    632629        // lock the globals
    633630        fibril_rwlock_write_lock(&icmp_globals.lock);
     
    644641}
    645642
    646 int icmp_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
     643int icmp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    647644        ERROR_DECLARE;
    648645
     
    652649        switch(IPC_GET_METHOD(*call)){
    653650                case NET_TL_RECEIVED:
    654                         if(! ERROR_OCCURRED(packet_translate_remote(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
     651                        if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
    655652                                ERROR_CODE = icmp_received_msg(IPC_GET_DEVICE(call), packet, SERVICE_ICMP, IPC_GET_ERROR(call));
    656653                        }
     
    762759        switch(IPC_GET_METHOD(*call)){
    763760                case NET_ICMP_DEST_UNREACH:
    764                         if(! ERROR_OCCURRED(packet_translate_remote(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
     761                        if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
    765762                                ERROR_CODE = icmp_destination_unreachable_msg(0, ICMP_GET_CODE(call), ICMP_GET_MTU(call), packet);
    766763                        }
    767764                        return ERROR_CODE;
    768765                case NET_ICMP_SOURCE_QUENCH:
    769                         if(! ERROR_OCCURRED(packet_translate_remote(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
     766                        if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
    770767                                ERROR_CODE = icmp_source_quench_msg(0, packet);
    771768                        }
    772769                        return ERROR_CODE;
    773770                case NET_ICMP_TIME_EXCEEDED:
    774                         if(! ERROR_OCCURRED(packet_translate_remote(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
     771                        if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
    775772                                ERROR_CODE = icmp_time_exceeded_msg(0, ICMP_GET_CODE(call), packet);
    776773                        }
    777774                        return ERROR_CODE;
    778775                case NET_ICMP_PARAMETERPROB:
    779                         if(! ERROR_OCCURRED(packet_translate_remote(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
     776                        if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
    780777                                ERROR_CODE = icmp_parameter_problem_msg(0, ICMP_GET_CODE(call), ICMP_GET_POINTER(call), packet);
    781778                        }
     
    787784
    788785int icmp_release_and_return(packet_t packet, int result){
    789         pq_release_remote(icmp_globals.net_phone, packet_get_id(packet));
     786        pq_release(icmp_globals.net_phone, packet_get_id(packet));
    790787        return result;
    791788}
     
    822819}
    823820
     821#ifdef CONFIG_NETWORKING_modular
     822
     823#include <tl_standalone.h>
     824
    824825/** Default thread for new connections.
    825826 *
     
    848849               
    849850                /* Process the message */
    850                 int res = tl_module_message_standalone(callid, &call, &answer,
    851                     &answer_count);
     851                int res = tl_module_message(callid, &call, &answer, &answer_count);
    852852               
    853853                /* End if said to either by the message or the processing result */
     
    873873        ERROR_DECLARE;
    874874       
     875        /* Print the module label */
     876        printf("Task %d - %s\n", task_get_id(), NAME);
     877       
    875878        /* Start the module */
    876         if (ERROR_OCCURRED(tl_module_start_standalone(tl_client_connection)))
     879        if (ERROR_OCCURRED(tl_module_start(tl_client_connection))) {
     880                printf(" - ERROR %i\n", ERROR_CODE);
    877881                return ERROR_CODE;
     882        }
    878883       
    879884        return EOK;
    880885}
    881886
     887#endif /* CONFIG_NETWORKING_modular */
     888
    882889/** @}
    883890 */
Note: See TracChangeset for help on using the changeset viewer.