Changeset f4f866c in mainline for uspace/srv/net/tl/udp/udp.c


Ignore:
Timestamp:
2010-04-23T21:42:26Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6c39a907
Parents:
38aaacc2 (diff), 80badbe (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r38aaacc2 rf4f866c  
    4848#include <adt/dynamic_fifo.h>
    4949#include <packet/packet_client.h>
     50#include <packet_remote.h>
    5051#include <net_checksum.h>
    5152#include <in.h>
     
    6364#include <socket_messages.h>
    6465#include <tl_common.h>
     66#include <tl_local.h>
     67#include <tl_interface.h>
    6568#include <tl_messages.h>
    6669
     
    258261        icmp_type_t type;
    259262        icmp_code_t code;
    260         ip_pseudo_header_ref ip_header;
     263        void *ip_header;
    261264        struct sockaddr * src;
    262265        struct sockaddr * dest;
     
    356359                        while(tmp_packet){
    357360                                next_packet = pq_detach(tmp_packet);
    358                                 pq_release(udp_globals.net_phone, packet_get_id(tmp_packet));
     361                                pq_release_remote(udp_globals.net_phone, packet_get_id(tmp_packet));
    359362                                tmp_packet = next_packet;
    360363                        }
     
    382385        // queue the received packet
    383386        if(ERROR_OCCURRED(dyn_fifo_push(&socket->received, packet_get_id(packet), SOCKET_MAX_RECEIVED_SIZE))
    384                 || ERROR_OCCURRED(tl_get_ip_packet_dimension(udp_globals.ip_phone, &udp_globals.dimensions, device_id, &packet_dimension))){
     387            || ERROR_OCCURRED(tl_get_ip_packet_dimension(udp_globals.ip_phone, &udp_globals.dimensions, device_id, &packet_dimension))){
    385388                return udp_release_and_return(packet, ERROR_CODE);
    386389        }
     
    392395}
    393396
    394 int udp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
     397int udp_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    395398        ERROR_DECLARE;
    396399
     
    400403        switch(IPC_GET_METHOD(*call)){
    401404                case NET_TL_RECEIVED:
    402                         if(! ERROR_OCCURRED(packet_translate(udp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
     405                        if(! ERROR_OCCURRED(packet_translate_remote(udp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
    403406                                ERROR_CODE = udp_received_msg(IPC_GET_DEVICE(call), packet, SERVICE_UDP, IPC_GET_ERROR(call));
    404407                        }
     
    457460
    458461                                if(res == EOK){
    459                                         if(tl_get_ip_packet_dimension(udp_globals.ip_phone, &udp_globals.dimensions, DEVICE_INVALID_ID, &packet_dimension) == EOK){
     462                                        if (tl_get_ip_packet_dimension(udp_globals.ip_phone, &udp_globals.dimensions, DEVICE_INVALID_ID, &packet_dimension) == EOK){
    460463                                                SOCKET_SET_DATA_FRAGMENT_SIZE(answer, packet_dimension->content);
    461464                                        }
     
    533536        uint16_t dest_port;
    534537        uint32_t checksum;
    535         ip_pseudo_header_ref ip_header;
     538        void *ip_header;
    536539        size_t headerlen;
    537540        device_id_t device_id;
     
    662665                return NO_DATA;
    663666        }
    664         ERROR_PROPAGATE(packet_translate(udp_globals.net_phone, &packet, packet_id));
     667        ERROR_PROPAGATE(packet_translate_remote(udp_globals.net_phone, &packet, packet_id));
    665668        // get udp header
    666669        data = packet_get_data(packet);
    667670        if(! data){
    668                 pq_release(udp_globals.net_phone, packet_id);
     671                pq_release_remote(udp_globals.net_phone, packet_id);
    669672                return NO_DATA;
    670673        }
     
    674677        result = packet_get_addr(packet, (uint8_t **) &addr, NULL);
    675678        if(ERROR_OCCURRED(tl_set_address_port(addr, result, ntohs(header->source_port)))){
    676                 pq_release(udp_globals.net_phone, packet_id);
     679                pq_release_remote(udp_globals.net_phone, packet_id);
    677680                return ERROR_CODE;
    678681        }
     
    689692        // release the packet
    690693        dyn_fifo_pop(&socket->received);
    691         pq_release(udp_globals.net_phone, packet_get_id(packet));
     694        pq_release_remote(udp_globals.net_phone, packet_get_id(packet));
    692695        // return the total length
    693696        return (int) length;
     
    695698
    696699int udp_release_and_return(packet_t packet, int result){
    697         pq_release(udp_globals.net_phone, packet_get_id(packet));
     700        pq_release_remote(udp_globals.net_phone, packet_get_id(packet));
    698701        return result;
    699702}
    700 
    701 #ifdef CONFIG_NETWORKING_modular
    702 
    703 #include <tl_standalone.h>
    704703
    705704/** Default thread for new connections.
     
    729728               
    730729                /* Process the message */
    731                 int res = tl_module_message(callid, &call, &answer, &answer_count);
     730                int res = tl_module_message_standalone(callid, &call, &answer,
     731                    &answer_count);
    732732               
    733733                /* End if said to either by the message or the processing result */
     
    753753        ERROR_DECLARE;
    754754       
    755         /* Print the module label */
    756         printf("Task %d - %s\n", task_get_id(), NAME);
    757        
    758755        /* Start the module */
    759         if (ERROR_OCCURRED(tl_module_start(tl_client_connection))) {
    760                 printf(" - ERROR %i\n", ERROR_CODE);
     756        if (ERROR_OCCURRED(tl_module_start_standalone(tl_client_connection)))
    761757                return ERROR_CODE;
    762         }
    763758       
    764759        return EOK;
    765760}
    766761
    767 #endif /* CONFIG_NETWORKING_modular */
    768 
    769762/** @}
    770763 */
Note: See TracChangeset for help on using the changeset viewer.