Ignore:
File:
1 edited

Legend:

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

    r46d4d9f rfb04cba8  
    127127typedef struct tcp_timeout tcp_timeout_t;
    128128
     129/** Type definition of the TCP timeout pointer.
     130 *  @see tcp_timeout
     131 */
     132typedef tcp_timeout_t *tcp_timeout_ref;
     133
    129134/** TCP reply timeout data.
    130135 *  Used as a timeouting fibril argument.
     
    139144
    140145        /** Local sockets. */
    141         socket_cores_t *local_sockets;
     146        socket_cores_ref local_sockets;
    142147
    143148        /** Socket identifier. */
     
    160165};
    161166
    162 static int tcp_release_and_return(packet_t *, int);
    163 static void tcp_prepare_operation_header(socket_core_t *, tcp_socket_data_t *,
    164     tcp_header_t *, int synchronize, int);
    165 static int tcp_prepare_timeout(int (*)(void *), socket_core_t *,
    166     tcp_socket_data_t *, size_t, tcp_socket_state_t, suseconds_t, int);
    167 static void tcp_free_socket_data(socket_core_t *);
     167static int tcp_release_and_return(packet_t, int);
     168static void tcp_prepare_operation_header(socket_core_ref, tcp_socket_data_ref,
     169    tcp_header_ref, int synchronize, int);
     170static int tcp_prepare_timeout(int (*)(void *), socket_core_ref,
     171    tcp_socket_data_ref, size_t, tcp_socket_state_t, suseconds_t, int);
     172static void tcp_free_socket_data(socket_core_ref);
    168173
    169174static int tcp_timeout(void *);
     
    171176static int tcp_release_after_timeout(void *);
    172177
    173 static int tcp_process_packet(device_id_t, packet_t *, services_t);
    174 static int tcp_connect_core(socket_core_t *, socket_cores_t *,
     178static int tcp_process_packet(device_id_t, packet_t, services_t);
     179static int tcp_connect_core(socket_core_ref, socket_cores_ref,
    175180    struct sockaddr *, socklen_t);
    176 static int tcp_queue_prepare_packet(socket_core_t *, tcp_socket_data_t *,
    177     packet_t *, size_t);
    178 static int tcp_queue_packet(socket_core_t *, tcp_socket_data_t *, packet_t *,
     181static int tcp_queue_prepare_packet(socket_core_ref, tcp_socket_data_ref,
     182    packet_t, size_t);
     183static int tcp_queue_packet(socket_core_ref, tcp_socket_data_ref, packet_t,
    179184    size_t);
    180 static packet_t *tcp_get_packets_to_send(socket_core_t *, tcp_socket_data_t *);
    181 static void tcp_send_packets(device_id_t, packet_t *);
    182 
    183 static void tcp_process_acknowledgement(socket_core_t *, tcp_socket_data_t *,
    184     tcp_header_t *);
    185 static packet_t *tcp_send_prepare_packet(socket_core_t *, tcp_socket_data_t *,
    186     packet_t *, size_t, size_t);
    187 static packet_t *tcp_prepare_copy(socket_core_t *, tcp_socket_data_t *,
    188     packet_t *, size_t, size_t);
    189 /* static */ void tcp_retransmit_packet(socket_core_t *, tcp_socket_data_t *,
     185static packet_t tcp_get_packets_to_send(socket_core_ref, tcp_socket_data_ref);
     186static void tcp_send_packets(device_id_t, packet_t);
     187
     188static void tcp_process_acknowledgement(socket_core_ref, tcp_socket_data_ref,
     189    tcp_header_ref);
     190static packet_t tcp_send_prepare_packet(socket_core_ref, tcp_socket_data_ref,
     191    packet_t, size_t, size_t);
     192static packet_t tcp_prepare_copy(socket_core_ref, tcp_socket_data_ref, packet_t,
     193    size_t, size_t);
     194/* static */ void tcp_retransmit_packet(socket_core_ref, tcp_socket_data_ref,
    190195    size_t);
    191 static int tcp_create_notification_packet(packet_t **, socket_core_t *,
    192     tcp_socket_data_t *, int, int);
    193 static void tcp_refresh_socket_data(tcp_socket_data_t *);
    194 
    195 static void tcp_initialize_socket_data(tcp_socket_data_t *);
    196 
    197 static int tcp_process_listen(socket_core_t *, tcp_socket_data_t *,
    198     tcp_header_t *, packet_t *, struct sockaddr *, struct sockaddr *, size_t);
    199 static int tcp_process_syn_sent(socket_core_t *, tcp_socket_data_t *,
    200     tcp_header_t *, packet_t *);
    201 static int tcp_process_syn_received(socket_core_t *, tcp_socket_data_t *,
    202     tcp_header_t *, packet_t *);
    203 static int tcp_process_established(socket_core_t *, tcp_socket_data_t *,
    204     tcp_header_t *, packet_t *, int, size_t);
    205 static int tcp_queue_received_packet(socket_core_t *, tcp_socket_data_t *,
    206     packet_t *, int, size_t);
    207 
    208 static int tcp_received_msg(device_id_t, packet_t *, services_t, services_t);
     196static int tcp_create_notification_packet(packet_t *, socket_core_ref,
     197    tcp_socket_data_ref, int, int);
     198static void tcp_refresh_socket_data(tcp_socket_data_ref);
     199
     200static void tcp_initialize_socket_data(tcp_socket_data_ref);
     201
     202static int tcp_process_listen(socket_core_ref, tcp_socket_data_ref,
     203    tcp_header_ref, packet_t, struct sockaddr *, struct sockaddr *, size_t);
     204static int tcp_process_syn_sent(socket_core_ref, tcp_socket_data_ref,
     205    tcp_header_ref, packet_t);
     206static int tcp_process_syn_received(socket_core_ref, tcp_socket_data_ref,
     207    tcp_header_ref, packet_t);
     208static int tcp_process_established(socket_core_ref, tcp_socket_data_ref,
     209    tcp_header_ref, packet_t, int, size_t);
     210static int tcp_queue_received_packet(socket_core_ref, tcp_socket_data_ref,
     211    packet_t, int, size_t);
     212
     213static int tcp_received_msg(device_id_t, packet_t, services_t, services_t);
    209214static int tcp_process_client_messages(ipc_callid_t, ipc_call_t);
    210215
    211 static int tcp_listen_message(socket_cores_t *, int, int);
    212 static int tcp_connect_message(socket_cores_t *, int, struct sockaddr *,
     216static int tcp_listen_message(socket_cores_ref, int, int);
     217static int tcp_connect_message(socket_cores_ref, int, struct sockaddr *,
    213218    socklen_t);
    214 static int tcp_recvfrom_message(socket_cores_t *, int, int, size_t *);
    215 static int tcp_send_message(socket_cores_t *, int, int, size_t *, int);
    216 static int tcp_accept_message(socket_cores_t *, int, int, size_t *, size_t *);
    217 static int tcp_close_message(socket_cores_t *, int);
     219static int tcp_recvfrom_message(socket_cores_ref, int, int, size_t *);
     220static int tcp_send_message(socket_cores_ref, int, int, size_t *, int);
     221static int tcp_accept_message(socket_cores_ref, int, int, size_t *, size_t *);
     222static int tcp_close_message(socket_cores_ref, int);
    218223
    219224/** TCP global data. */
     
    224229 * @param[in] client_connection The client connection processing function. The
    225230 *                      module skeleton propagates its own one.
    226  * @return              EOK on success.
    227  * @return              ENOMEM if there is not enough memory left.
     231 * @returns             EOK on success.
     232 * @returns             ENOMEM if there is not enough memory left.
    228233 */
    229234int tcp_initialize(async_client_conn_t client_connection)
     
    262267}
    263268
    264 int tcp_received_msg(device_id_t device_id, packet_t *packet,
     269int tcp_received_msg(device_id_t device_id, packet_t packet,
    265270    services_t receiver, services_t error)
    266271{
     
    280285}
    281286
    282 int tcp_process_packet(device_id_t device_id, packet_t *packet, services_t error)
     287int tcp_process_packet(device_id_t device_id, packet_t packet, services_t error)
    283288{
    284289        size_t length;
    285290        size_t offset;
    286291        int result;
    287         tcp_header_t *header;
    288         socket_core_t *socket;
    289         tcp_socket_data_t *socket_data;
    290         packet_t *next_packet;
     292        tcp_header_ref header;
     293        socket_core_ref socket;
     294        tcp_socket_data_ref socket_data;
     295        packet_t next_packet;
    291296        size_t total_length;
    292297        uint32_t checksum;
     
    338343
    339344        /* Get tcp header */
    340         header = (tcp_header_t *) packet_get_data(packet);
     345        header = (tcp_header_ref) packet_get_data(packet);
    341346        if (!header)
    342347                return tcp_release_and_return(packet, NO_DATA);
     
    375380
    376381        printf("socket id %d\n", socket->socket_id);
    377         socket_data = (tcp_socket_data_t *) socket->specific_data;
     382        socket_data = (tcp_socket_data_ref) socket->specific_data;
    378383        assert(socket_data);
    379384
     
    492497}
    493498
    494 int tcp_process_established(socket_core_t *socket, tcp_socket_data_t *
    495     socket_data, tcp_header_t *header, packet_t *packet, int fragments,
     499int tcp_process_established(socket_core_ref socket, tcp_socket_data_ref
     500    socket_data, tcp_header_ref header, packet_t packet, int fragments,
    496501    size_t total_length)
    497502{
    498         packet_t *next_packet;
    499         packet_t *tmp_packet;
     503        packet_t next_packet;
     504        packet_t tmp_packet;
    500505        uint32_t old_incoming;
    501506        size_t order;
     
    800805}
    801806
    802 int tcp_queue_received_packet(socket_core_t *socket,
    803     tcp_socket_data_t *socket_data, packet_t *packet, int fragments,
     807int tcp_queue_received_packet(socket_core_ref socket,
     808    tcp_socket_data_ref socket_data, packet_t packet, int fragments,
    804809    size_t total_length)
    805810{
    806         packet_dimension_t *packet_dimension;
     811        packet_dimension_ref packet_dimension;
    807812        int rc;
    808813
     
    837842}
    838843
    839 int tcp_process_syn_sent(socket_core_t *socket, tcp_socket_data_t *
    840     socket_data, tcp_header_t *header, packet_t *packet)
    841 {
    842         packet_t *next_packet;
     844int tcp_process_syn_sent(socket_core_ref socket, tcp_socket_data_ref
     845    socket_data, tcp_header_ref header, packet_t packet)
     846{
     847        packet_t next_packet;
    843848        int rc;
    844849
     
    895900}
    896901
    897 int tcp_process_listen(socket_core_t *listening_socket,
    898     tcp_socket_data_t *listening_socket_data, tcp_header_t *header,
    899     packet_t *packet, struct sockaddr *src, struct sockaddr *dest,
     902int tcp_process_listen(socket_core_ref listening_socket,
     903    tcp_socket_data_ref listening_socket_data, tcp_header_ref header,
     904    packet_t packet, struct sockaddr *src, struct sockaddr *dest,
    900905    size_t addrlen)
    901906{
    902         packet_t *next_packet;
    903         socket_core_t *socket;
    904         tcp_socket_data_t *socket_data;
     907        packet_t next_packet;
     908        socket_core_ref socket;
     909        tcp_socket_data_ref socket_data;
    905910        int socket_id;
    906911        int listening_socket_id = listening_socket->socket_id;
     
    917922                return tcp_release_and_return(packet, EINVAL);
    918923
    919         socket_data = (tcp_socket_data_t *) malloc(sizeof(*socket_data));
     924        socket_data = (tcp_socket_data_ref) malloc(sizeof(*socket_data));
    920925        if (!socket_data)
    921926                return tcp_release_and_return(packet, ENOMEM);
     
    974979        }
    975980        listening_socket_data =
    976             (tcp_socket_data_t *) listening_socket->specific_data;
     981            (tcp_socket_data_ref) listening_socket->specific_data;
    977982        assert(listening_socket_data);
    978983
     
    986991                return ENOTSOCK;
    987992        }
    988         socket_data = (tcp_socket_data_t *) socket->specific_data;
     993        socket_data = (tcp_socket_data_ref) socket->specific_data;
    989994        assert(socket_data);
    990995
     
    10551060}
    10561061
    1057 int tcp_process_syn_received(socket_core_t *socket,
    1058     tcp_socket_data_t *socket_data, tcp_header_t *header, packet_t *packet)
    1059 {
    1060         socket_core_t *listening_socket;
    1061         tcp_socket_data_t *listening_socket_data;
     1062int tcp_process_syn_received(socket_core_ref socket,
     1063    tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet)
     1064{
     1065        socket_core_ref listening_socket;
     1066        tcp_socket_data_ref listening_socket_data;
    10621067        int rc;
    10631068
     
    10811086        if (listening_socket) {
    10821087                listening_socket_data =
    1083                     (tcp_socket_data_t *) listening_socket->specific_data;
     1088                    (tcp_socket_data_ref) listening_socket->specific_data;
    10841089                assert(listening_socket_data);
    10851090
     
    11221127}
    11231128
    1124 void tcp_process_acknowledgement(socket_core_t *socket,
    1125     tcp_socket_data_t *socket_data, tcp_header_t *header)
     1129void tcp_process_acknowledgement(socket_core_ref socket,
     1130    tcp_socket_data_ref socket_data, tcp_header_ref header)
    11261131{
    11271132        size_t number;
    11281133        size_t length;
    1129         packet_t *packet;
    1130         packet_t *next;
    1131         packet_t *acknowledged = NULL;
     1134        packet_t packet;
     1135        packet_t next;
     1136        packet_t acknowledged = NULL;
    11321137        uint32_t old;
    11331138
     
    12221227 * @param[out] answer_count The last parameter for the actual answer in the
    12231228 *                      answer parameter.
    1224  * @return              EOK on success.
    1225  * @return              ENOTSUP if the message is not known.
     1229 * @returns             EOK on success.
     1230 * @returns             ENOTSUP if the message is not known.
    12261231 *
    12271232 * @see tcp_interface.h
     
    12321237    ipc_call_t *answer, int *answer_count)
    12331238{
    1234         packet_t *packet;
     1239        packet_t packet;
    12351240        int rc;
    12361241
     
    12601265}
    12611266
    1262 void tcp_refresh_socket_data(tcp_socket_data_t *socket_data)
     1267void tcp_refresh_socket_data(tcp_socket_data_ref socket_data)
    12631268{
    12641269        assert(socket_data);
     
    12761281}
    12771282
    1278 void tcp_initialize_socket_data(tcp_socket_data_t *socket_data)
     1283void tcp_initialize_socket_data(tcp_socket_data_ref socket_data)
    12791284{
    12801285        assert(socket_data);
     
    12991304        ipc_call_t answer;
    13001305        int answer_count;
    1301         tcp_socket_data_t *socket_data;
    1302         socket_core_t *socket;
    1303         packet_dimension_t *packet_dimension;
     1306        tcp_socket_data_ref socket_data;
     1307        socket_core_ref socket;
     1308        packet_dimension_ref packet_dimension;
    13041309
    13051310        /*
     
    13311336                case NET_SOCKET:
    13321337                        socket_data =
    1333                             (tcp_socket_data_t *) malloc(sizeof(*socket_data));
     1338                            (tcp_socket_data_ref) malloc(sizeof(*socket_data));
    13341339                        if (!socket_data) {
    13351340                                res = ENOMEM;
     
    13781383                                    SOCKET_GET_SOCKET_ID(call));
    13791384                                if (socket) {
    1380                                         socket_data = (tcp_socket_data_t *)
     1385                                        socket_data = (tcp_socket_data_ref)
    13811386                                            socket->specific_data;
    13821387                                        assert(socket_data);
     
    15351540int tcp_timeout(void *data)
    15361541{
    1537         tcp_timeout_t *timeout = data;
     1542        tcp_timeout_ref timeout = data;
    15381543        int keep_write_lock = false;
    1539         socket_core_t *socket;
    1540         tcp_socket_data_t *socket_data;
     1544        socket_core_ref socket;
     1545        tcp_socket_data_ref socket_data;
    15411546
    15421547        assert(timeout);
     
    15561561                goto out;
    15571562       
    1558         socket_data = (tcp_socket_data_t *) socket->specific_data;
     1563        socket_data = (tcp_socket_data_ref) socket->specific_data;
    15591564        assert(socket_data);
    15601565        if (socket_data->local_sockets != timeout->local_sockets)
     
    16121617int tcp_release_after_timeout(void *data)
    16131618{
    1614         tcp_timeout_t *timeout = data;
    1615         socket_core_t *socket;
    1616         tcp_socket_data_t *socket_data;
     1619        tcp_timeout_ref timeout = data;
     1620        socket_core_ref socket;
     1621        tcp_socket_data_ref socket_data;
    16171622        fibril_rwlock_t *local_lock;
    16181623
     
    16301635
    16311636        if (socket && (socket->socket_id == timeout->socket_id)) {
    1632                 socket_data = (tcp_socket_data_t *) socket->specific_data;
     1637                socket_data = (tcp_socket_data_ref) socket->specific_data;
    16331638                assert(socket_data);
    16341639                if (socket_data->local_sockets == timeout->local_sockets) {
     
    16511656}
    16521657
    1653 void tcp_retransmit_packet(socket_core_t *socket, tcp_socket_data_t *
     1658void tcp_retransmit_packet(socket_core_ref socket, tcp_socket_data_ref
    16541659    socket_data, size_t sequence_number)
    16551660{
    1656         packet_t *packet;
    1657         packet_t *copy;
     1661        packet_t packet;
     1662        packet_t copy;
    16581663        size_t data_length;
    16591664
     
    16781683}
    16791684
    1680 int tcp_listen_message(socket_cores_t *local_sockets, int socket_id,
     1685int tcp_listen_message(socket_cores_ref local_sockets, int socket_id,
    16811686    int backlog)
    16821687{
    1683         socket_core_t *socket;
    1684         tcp_socket_data_t *socket_data;
     1688        socket_core_ref socket;
     1689        tcp_socket_data_ref socket_data;
    16851690
    16861691        assert(local_sockets);
     
    16951700       
    16961701        /* Get the socket specific data */
    1697         socket_data = (tcp_socket_data_t *) socket->specific_data;
     1702        socket_data = (tcp_socket_data_ref) socket->specific_data;
    16981703        assert(socket_data);
    16991704
     
    17041709}
    17051710
    1706 int tcp_connect_message(socket_cores_t *local_sockets, int socket_id,
     1711int tcp_connect_message(socket_cores_ref local_sockets, int socket_id,
    17071712    struct sockaddr *addr, socklen_t addrlen)
    17081713{
    1709         socket_core_t *socket;
     1714        socket_core_ref socket;
    17101715        int rc;
    17111716
     
    17321737}
    17331738
    1734 int tcp_connect_core(socket_core_t *socket, socket_cores_t *local_sockets,
     1739int tcp_connect_core(socket_core_ref socket, socket_cores_ref local_sockets,
    17351740    struct sockaddr *addr, socklen_t addrlen)
    17361741{
    1737         tcp_socket_data_t *socket_data;
    1738         packet_t *packet;
     1742        tcp_socket_data_ref socket_data;
     1743        packet_t packet;
    17391744        int rc;
    17401745
     
    17441749
    17451750        /* Get the socket specific data */
    1746         socket_data = (tcp_socket_data_t *) socket->specific_data;
     1751        socket_data = (tcp_socket_data_ref) socket->specific_data;
    17471752        assert(socket_data);
    17481753        assert(socket->specific_data == socket_data);
     
    18231828}
    18241829
    1825 int tcp_queue_prepare_packet(socket_core_t *socket,
    1826     tcp_socket_data_t *socket_data, packet_t *packet, size_t data_length)
    1827 {
    1828         tcp_header_t *header;
     1830int tcp_queue_prepare_packet(socket_core_ref socket,
     1831    tcp_socket_data_ref socket_data, packet_t packet, size_t data_length)
     1832{
     1833        tcp_header_ref header;
    18291834        int rc;
    18301835
     
    18341839
    18351840        /* Get TCP header */
    1836         header = (tcp_header_t *) packet_get_data(packet);
     1841        header = (tcp_header_ref) packet_get_data(packet);
    18371842        if (!header)
    18381843                return NO_DATA;
     
    18541859}
    18551860
    1856 int tcp_queue_packet(socket_core_t *socket, tcp_socket_data_t *socket_data,
    1857     packet_t *packet, size_t data_length)
     1861int tcp_queue_packet(socket_core_ref socket, tcp_socket_data_ref socket_data,
     1862    packet_t packet, size_t data_length)
    18581863{
    18591864        int rc;
     
    18761881}
    18771882
    1878 packet_t *tcp_get_packets_to_send(socket_core_t *socket, tcp_socket_data_t *
     1883packet_t tcp_get_packets_to_send(socket_core_ref socket, tcp_socket_data_ref
    18791884    socket_data)
    18801885{
    1881         packet_t *packet;
    1882         packet_t *copy;
    1883         packet_t *sending = NULL;
    1884         packet_t *previous = NULL;
     1886        packet_t packet;
     1887        packet_t copy;
     1888        packet_t sending = NULL;
     1889        packet_t previous = NULL;
    18851890        size_t data_length;
    18861891        int rc;
     
    19361941}
    19371942
    1938 packet_t *tcp_send_prepare_packet(socket_core_t *socket, tcp_socket_data_t *
    1939     socket_data, packet_t *packet, size_t data_length, size_t sequence_number)
    1940 {
    1941         tcp_header_t *header;
     1943packet_t tcp_send_prepare_packet(socket_core_ref socket, tcp_socket_data_ref
     1944    socket_data, packet_t packet, size_t data_length, size_t sequence_number)
     1945{
     1946        tcp_header_ref header;
    19421947        uint32_t checksum;
    19431948        int rc;
     
    19561961
    19571962        /* Get the header */
    1958         header = (tcp_header_t *) packet_get_data(packet);
     1963        header = (tcp_header_ref) packet_get_data(packet);
    19591964        if (!header) {
    19601965                pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
     
    19972002}
    19982003
    1999 packet_t *tcp_prepare_copy(socket_core_t *socket, tcp_socket_data_t *
    2000     socket_data, packet_t *packet, size_t data_length, size_t sequence_number)
    2001 {
    2002         packet_t *copy;
     2004packet_t tcp_prepare_copy(socket_core_ref socket, tcp_socket_data_ref
     2005    socket_data, packet_t packet, size_t data_length, size_t sequence_number)
     2006{
     2007        packet_t copy;
    20032008
    20042009        assert(socket);
     
    20152020}
    20162021
    2017 void tcp_send_packets(device_id_t device_id, packet_t *packet)
    2018 {
    2019         packet_t *next;
     2022void tcp_send_packets(device_id_t device_id, packet_t packet)
     2023{
     2024        packet_t next;
    20202025
    20212026        while (packet) {
     
    20272032}
    20282033
    2029 void tcp_prepare_operation_header(socket_core_t *socket,
    2030     tcp_socket_data_t *socket_data, tcp_header_t *header, int synchronize,
     2034void tcp_prepare_operation_header(socket_core_ref socket,
     2035    tcp_socket_data_ref socket_data, tcp_header_ref header, int synchronize,
    20312036    int finalize)
    20322037{
     
    20452050
    20462051int tcp_prepare_timeout(int (*timeout_function)(void *tcp_timeout_t),
    2047     socket_core_t *socket, tcp_socket_data_t *socket_data,
     2052    socket_core_ref socket, tcp_socket_data_ref socket_data,
    20482053    size_t sequence_number, tcp_socket_state_t state, suseconds_t timeout,
    20492054    int globals_read_only)
    20502055{
    2051         tcp_timeout_t *operation_timeout;
     2056        tcp_timeout_ref operation_timeout;
    20522057        fid_t fibril;
    20532058
     
    20912096}
    20922097
    2093 int tcp_recvfrom_message(socket_cores_t *local_sockets, int socket_id,
     2098int tcp_recvfrom_message(socket_cores_ref local_sockets, int socket_id,
    20942099    int flags, size_t *addrlen)
    20952100{
    2096         socket_core_t *socket;
    2097         tcp_socket_data_t *socket_data;
     2101        socket_core_ref socket;
     2102        tcp_socket_data_ref socket_data;
    20982103        int packet_id;
    2099         packet_t *packet;
     2104        packet_t packet;
    21002105        size_t length;
    21012106        int rc;
     
    21122117                return NO_DATA;
    21132118
    2114         socket_data = (tcp_socket_data_t *) socket->specific_data;
     2119        socket_data = (tcp_socket_data_ref) socket->specific_data;
    21152120
    21162121        /* Check state */
     
    21492154}
    21502155
    2151 int tcp_send_message(socket_cores_t *local_sockets, int socket_id,
     2156int tcp_send_message(socket_cores_ref local_sockets, int socket_id,
    21522157    int fragments, size_t *data_fragment_size, int flags)
    21532158{
    2154         socket_core_t *socket;
    2155         tcp_socket_data_t *socket_data;
    2156         packet_dimension_t *packet_dimension;
    2157         packet_t *packet;
     2159        socket_core_ref socket;
     2160        tcp_socket_data_ref socket_data;
     2161        packet_dimension_ref packet_dimension;
     2162        packet_t packet;
    21582163        size_t total_length;
    2159         tcp_header_t *header;
     2164        tcp_header_ref header;
    21602165        int index;
    21612166        int result;
     
    21742179                return NO_DATA;
    21752180
    2176         socket_data = (tcp_socket_data_t *) socket->specific_data;
     2181        socket_data = (tcp_socket_data_ref) socket->specific_data;
    21772182
    21782183        /* Check state */
     
    22252230
    22262231int
    2227 tcp_close_message(socket_cores_t *local_sockets, int socket_id)
    2228 {
    2229         socket_core_t *socket;
    2230         tcp_socket_data_t *socket_data;
    2231         packet_t *packet;
     2232tcp_close_message(socket_cores_ref local_sockets, int socket_id)
     2233{
     2234        socket_core_ref socket;
     2235        tcp_socket_data_ref socket_data;
     2236        packet_t packet;
    22322237        int rc;
    22332238
     
    22382243
    22392244        /* Get the socket specific data */
    2240         socket_data = (tcp_socket_data_t *) socket->specific_data;
     2245        socket_data = (tcp_socket_data_ref) socket->specific_data;
    22412246        assert(socket_data);
    22422247
     
    22932298}
    22942299
    2295 int tcp_create_notification_packet(packet_t **packet, socket_core_t *socket,
    2296     tcp_socket_data_t *socket_data, int synchronize, int finalize)
    2297 {
    2298         packet_dimension_t *packet_dimension;
    2299         tcp_header_t *header;
     2300int tcp_create_notification_packet(packet_t *packet, socket_core_ref socket,
     2301    tcp_socket_data_ref socket_data, int synchronize, int finalize)
     2302{
     2303        packet_dimension_ref packet_dimension;
     2304        tcp_header_ref header;
    23002305        int rc;
    23012306
     
    23272332}
    23282333
    2329 int tcp_accept_message(socket_cores_t *local_sockets, int socket_id,
     2334int tcp_accept_message(socket_cores_ref local_sockets, int socket_id,
    23302335    int new_socket_id, size_t *data_fragment_size, size_t *addrlen)
    23312336{
    2332         socket_core_t *accepted;
    2333         socket_core_t *socket;
    2334         tcp_socket_data_t *socket_data;
    2335         packet_dimension_t *packet_dimension;
     2337        socket_core_ref accepted;
     2338        socket_core_ref socket;
     2339        tcp_socket_data_ref socket_data;
     2340        packet_dimension_ref packet_dimension;
    23362341        int rc;
    23372342
     
    23462351
    23472352        /* Get the socket specific data */
    2348         socket_data = (tcp_socket_data_t *) socket->specific_data;
     2353        socket_data = (tcp_socket_data_ref) socket->specific_data;
    23492354        assert(socket_data);
    23502355
     
    23642369
    23652370                /* Get the socket specific data */
    2366                 socket_data = (tcp_socket_data_t *) accepted->specific_data;
     2371                socket_data = (tcp_socket_data_ref) accepted->specific_data;
    23672372                assert(socket_data);
    23682373                /* TODO can it be in another state? */
     
    24002405}
    24012406
    2402 void tcp_free_socket_data(socket_core_t *socket)
    2403 {
    2404         tcp_socket_data_t *socket_data;
     2407void tcp_free_socket_data(socket_core_ref socket)
     2408{
     2409        tcp_socket_data_ref socket_data;
    24052410
    24062411        assert(socket);
     
    24092414
    24102415        /* Get the socket specific data */
    2411         socket_data = (tcp_socket_data_t *) socket->specific_data;
     2416        socket_data = (tcp_socket_data_ref) socket->specific_data;
    24122417        assert(socket_data);
    24132418
     
    24422447 * @return              The result parameter.
    24432448 */
    2444 int tcp_release_and_return(packet_t *packet, int result)
     2449int tcp_release_and_return(packet_t packet, int result)
    24452450{
    24462451        pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
     
    24942499/** Starts the module.
    24952500 *
    2496  * @return              EOK on success.
    2497  * @return              Other error codes as defined for each specific module
     2501 * @returns             EOK on success.
     2502 * @returns             Other error codes as defined for each specific module
    24982503 *                      start function.
    24992504 */
Note: See TracChangeset for help on using the changeset viewer.