Changeset 41811af in mainline for uspace/srv/net/tl/tcp/tcp.c


Ignore:
Timestamp:
2011-06-10T10:14:26Z (14 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ab547063
Parents:
9536e6e (diff), 390d80d (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

File:
1 edited

Legend:

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

    r9536e6e r41811af  
    3838#include <assert.h>
    3939#include <async.h>
     40#include <async_obsolete.h>
    4041#include <fibril_synch.h>
    4142#include <malloc.h>
     
    7273#include "tcp.h"
    7374#include "tcp_header.h"
     75
     76// FIXME: remove this header
     77#include <kernel/ipc/ipc_methods.h>
    7478
    7579/** TCP module name. */
     
    476480        old_incoming = socket_data->next_incoming;
    477481
    478         if (header->finalize) {
     482        if (GET_TCP_HEADER_FINALIZE(header)) {
    479483                socket_data->fin_incoming = new_sequence_number +
    480484                    total_length - TCP_HEADER_LENGTH(header);
     
    799803
    800804        /* Notify the destination socket */
    801         async_msg_5(socket->phone, NET_SOCKET_RECEIVED,
     805        async_obsolete_msg_5(socket->phone, NET_SOCKET_RECEIVED,
    802806            (sysarg_t) socket->socket_id,
    803807            ((packet_dimension->content < socket_data->data_fragment_size) ?
     
    820824
    821825        /* Notify the destination socket */
    822         async_msg_5(socket->phone, NET_SOCKET_RECEIVED,
     826        async_obsolete_msg_5(socket->phone, NET_SOCKET_RECEIVED,
    823827            (sysarg_t) socket->socket_id,
    824828            0, 0, 0,
     
    838842        assert(packet);
    839843
    840         if (!header->synchronize)
     844        if (!GET_TCP_HEADER_SYNCHRONIZE(header))
    841845                return tcp_release_and_return(packet, EINVAL);
    842846       
     
    903907        assert(packet);
    904908
    905         if (!header->synchronize)
     909        if (!GET_TCP_HEADER_SYNCHRONIZE(header))
    906910                return tcp_release_and_return(packet, EINVAL);
    907911
     
    10571061        assert(packet);
    10581062
    1059         if (!header->acknowledge)
     1063        if (!GET_TCP_HEADER_ACKNOWLEDGE(header))
    10601064                return tcp_release_and_return(packet, EINVAL);
    10611065
     
    10781082                if (rc == EOK) {
    10791083                        /* Notify the destination socket */
    1080                         async_msg_5(socket->phone, NET_SOCKET_ACCEPTED,
     1084                        async_obsolete_msg_5(socket->phone, NET_SOCKET_ACCEPTED,
    10811085                            (sysarg_t) listening_socket->socket_id,
    10821086                            socket_data->data_fragment_size, TCP_HEADER_SIZE,
     
    11261130        assert(header);
    11271131
    1128         if (!header->acknowledge)
     1132        if (!GET_TCP_HEADER_ACKNOWLEDGE(header))
    11291133                return;
    11301134
     
    12691273{
    12701274        int res;
    1271         bool keep_on_going = true;
    12721275        socket_cores_t local_sockets;
    12731276        int app_phone = IPC_GET_PHONE(call);
     
    12931296        fibril_rwlock_initialize(&lock);
    12941297
    1295         while (keep_on_going) {
     1298        while (true) {
    12961299
    12971300                /* Answer the call */
     
    13011304                /* Get the next call */
    13021305                callid = async_get_call(&call);
     1306               
     1307                if (!IPC_GET_IMETHOD(call)) {
     1308                        res = EHANGUP;
     1309                        break;
     1310                }
    13031311
    13041312                /* Process the call */
    13051313                switch (IPC_GET_IMETHOD(call)) {
    1306                 case IPC_M_PHONE_HUNGUP:
    1307                         keep_on_going = false;
    1308                         res = EHANGUP;
    1309                         break;
    1310 
    13111314                case NET_SOCKET:
    13121315                        socket_data =
     
    15061509
    15071510        /* Release the application phone */
    1508         async_hangup(app_phone);
     1511        async_obsolete_hangup(app_phone);
    15091512
    15101513        printf("release\n");
     
    18331836
    18341837        /* Remember the outgoing FIN */
    1835         if (header->finalize)
     1838        if (GET_TCP_HEADER_FINALIZE(header))
    18361839                socket_data->fin_outgoing = socket_data->next_outgoing;
    18371840       
     
    19521955                header->acknowledgement_number =
    19531956                    htonl(socket_data->next_incoming);
    1954                 header->acknowledge = 1;
     1957                SET_TCP_HEADER_ACKNOWLEDGE(header, 1);
    19551958        }
    19561959        header->window = htons(socket_data->window);
     
    20242027        header->source_port = htons(socket->port);
    20252028        header->source_port = htons(socket_data->dest_port);
    2026         header->header_length = TCP_COMPUTE_HEADER_LENGTH(sizeof(*header));
    2027         header->synchronize = synchronize;
    2028         header->finalize = finalize;
     2029        SET_TCP_HEADER_LENGTH(header,
     2030            TCP_COMPUTE_HEADER_LENGTH(sizeof(*header)));
     2031        SET_TCP_HEADER_SYNCHRONIZE(header, synchronize);
     2032        SET_TCP_HEADER_FINALIZE(header, finalize);
    20292033}
    20302034
Note: See TracChangeset for help on using the changeset viewer.