Changeset 14f1db0 in mainline for uspace/srv/net/tl/icmp/icmp.c


Ignore:
Timestamp:
2010-04-09T12:54:57Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1caa3c2
Parents:
24ab58b3
Message:

networking overhaul:

  • separation of conserns
  • removal of (almost all) overlaping symbols, libnetif is not needed anymore
  • again, it is possible to build the networking in multiple architecture configurations (however, currently only the bundling netif and nil layers is supported, more to come)
  • code style updates and fixes (still a huge amount of work to do)
File:
1 edited

Legend:

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

    r24ab58b3 r14f1db0  
    5151#include <net_modules.h>
    5252#include <packet/packet_client.h>
     53#include <packet_remote.h>
    5354#include <net_byteorder.h>
    5455#include <net_checksum.h>
     
    6768#include <socket_errno.h>
    6869#include <tl_messages.h>
     70#include <tl_interface.h>
     71#include <tl_local.h>
    6972#include <icmp_messages.h>
    7073#include <icmp_header.h>
     
    288291        // TODO do not ask all the time
    289292        ERROR_PROPAGATE(ip_packet_size_req(icmp_globals.ip_phone, -1, &icmp_globals.packet_dimension));
    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);
     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);
    291294        if(! packet){
    292295                return ENOMEM;
     
    626629        // compute the reply key
    627630        reply_key = ICMP_GET_REPLY_KEY(header->un.echo.identifier, header->un.echo.sequence_number);
    628         pq_release(icmp_globals.net_phone, packet_get_id(packet));
     631        pq_release_remote(icmp_globals.net_phone, packet_get_id(packet));
    629632        // lock the globals
    630633        fibril_rwlock_write_lock(&icmp_globals.lock);
     
    641644}
    642645
    643 int icmp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
     646int icmp_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    644647        ERROR_DECLARE;
    645648
     
    649652        switch(IPC_GET_METHOD(*call)){
    650653                case NET_TL_RECEIVED:
    651                         if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
     654                        if(! ERROR_OCCURRED(packet_translate_remote(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
    652655                                ERROR_CODE = icmp_received_msg(IPC_GET_DEVICE(call), packet, SERVICE_ICMP, IPC_GET_ERROR(call));
    653656                        }
     
    759762        switch(IPC_GET_METHOD(*call)){
    760763                case NET_ICMP_DEST_UNREACH:
    761                         if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
     764                        if(! ERROR_OCCURRED(packet_translate_remote(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
    762765                                ERROR_CODE = icmp_destination_unreachable_msg(0, ICMP_GET_CODE(call), ICMP_GET_MTU(call), packet);
    763766                        }
    764767                        return ERROR_CODE;
    765768                case NET_ICMP_SOURCE_QUENCH:
    766                         if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
     769                        if(! ERROR_OCCURRED(packet_translate_remote(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
    767770                                ERROR_CODE = icmp_source_quench_msg(0, packet);
    768771                        }
    769772                        return ERROR_CODE;
    770773                case NET_ICMP_TIME_EXCEEDED:
    771                         if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
     774                        if(! ERROR_OCCURRED(packet_translate_remote(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
    772775                                ERROR_CODE = icmp_time_exceeded_msg(0, ICMP_GET_CODE(call), packet);
    773776                        }
    774777                        return ERROR_CODE;
    775778                case NET_ICMP_PARAMETERPROB:
    776                         if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
     779                        if(! ERROR_OCCURRED(packet_translate_remote(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
    777780                                ERROR_CODE = icmp_parameter_problem_msg(0, ICMP_GET_CODE(call), ICMP_GET_POINTER(call), packet);
    778781                        }
     
    784787
    785788int icmp_release_and_return(packet_t packet, int result){
    786         pq_release(icmp_globals.net_phone, packet_get_id(packet));
     789        pq_release_remote(icmp_globals.net_phone, packet_get_id(packet));
    787790        return result;
    788791}
     
    819822}
    820823
    821 #ifdef CONFIG_NETWORKING_modular
    822 
    823 #include <tl_standalone.h>
    824 
    825824/** Default thread for new connections.
    826825 *
     
    849848               
    850849                /* Process the message */
    851                 int res = tl_module_message(callid, &call, &answer, &answer_count);
     850                int res = tl_module_message_standalone(callid, &call, &answer,
     851                    &answer_count);
    852852               
    853853                /* End if said to either by the message or the processing result */
     
    874874       
    875875        /* Start the module */
    876         if (ERROR_OCCURRED(tl_module_start(tl_client_connection)))
     876        if (ERROR_OCCURRED(tl_module_start_standalone(tl_client_connection)))
    877877                return ERROR_CODE;
    878878       
     
    880880}
    881881
    882 #endif /* CONFIG_NETWORKING_modular */
    883 
    884882/** @}
    885883 */
Note: See TracChangeset for help on using the changeset viewer.