Changeset 2f19103 in mainline for uspace/srv/net/tcp/tcp_type.h


Ignore:
Timestamp:
2015-05-22T07:21:37Z (9 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
58e9dec
Parents:
bf7587b0
Message:

TCP and UDP servers can make use of inet/endpoint.h types internally.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tcp/tcp_type.h

    rbf7587b0 r2f19103  
    11/*
    2  * Copyright (c) 2011 Jiri Svoboda
     2 * Copyright (c) 2015 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4343#include <sys/types.h>
    4444#include <inet/addr.h>
     45#include <inet/endpoint.h>
    4546
    4647struct tcp_conn;
     
    8990        /* Connection reset */
    9091        TCP_ERESET,
    91         /* Foreign socket unspecified */
     92        /* Remote endpoint unspecified */
    9293        TCP_EUNSPEC,
    9394        /* Insufficient resources */
     
    112113} tcp_control_t;
    113114
    114 typedef struct {
    115         inet_addr_t addr;
    116         uint16_t port;
    117 } tcp_sock_t;
    118 
    119115enum tcp_port {
    120116        TCP_PORT_ANY = 0
    121117};
    122 
    123 typedef struct {
    124         tcp_sock_t local;
    125         tcp_sock_t foreign;
    126 } tcp_sockpair_t;
    127118
    128119/** Connection incoming segments queue */
     
    171162        void *cb_arg;
    172163
    173         /** Connection identification (local and foreign socket) */
    174         tcp_sockpair_t ident;
     164        /** Connection identification (local and remote endpoint) */
     165        inet_ep2_t ident;
    175166
    176167        /** Active or passive connection */
     
    280271typedef struct {
    281272        link_t link;
    282         tcp_sockpair_t sp;
     273        inet_ep2_t epp;
    283274        tcp_segment_t *seg;
    284275} tcp_rqueue_entry_t;
     
    288279        link_t link;
    289280        suseconds_t delay;
    290         tcp_sockpair_t sp;
     281        inet_ep2_t epp;
    291282        tcp_segment_t *seg;
    292283} tcp_squeue_entry_t;
     
    339330typedef struct tcp_clst {
    340331        /** Local endpoint */
    341         tcp_sock_t elocal;
     332        inet_ep_t elocal;
    342333        /** Connection */
    343334        tcp_conn_t *conn;
     
    360351} tcp_client_t;
    361352
    362 #define TCP_SOCK_FRAGMENT_SIZE 1024
    363 
    364 typedef struct tcp_sockdata {
    365         /** Lock */
    366         fibril_mutex_t lock;
    367         /** Socket core */
    368 //      socket_core_t *sock_core;
    369         /** Client */
    370         tcp_client_t *client;
    371         /** Connection */
    372         tcp_conn_t *conn;
    373         /** Local address */
    374         inet_addr_t laddr;
    375         /** Backlog size */
    376         int backlog;
    377         /** Array of listening connections, @c backlog elements */
    378         struct tcp_sock_lconn **lconn;
    379         /** List of connections (from lconn) that are ready to be accepted */
    380         list_t ready;
    381         /** Receiving fibril */
    382         fid_t recv_fibril;
    383         uint8_t recv_buffer[TCP_SOCK_FRAGMENT_SIZE];
    384         size_t recv_buffer_used;
    385         fibril_mutex_t recv_buffer_lock;
    386         fibril_condvar_t recv_buffer_cv;
    387         tcp_error_t recv_error;
    388 } tcp_sockdata_t;
    389 
    390 typedef struct tcp_sock_lconn {
    391         tcp_conn_t *conn;
    392         tcp_sockdata_t *socket;
    393         int index;
    394         link_t ready_list;
    395 } tcp_sock_lconn_t;
    396 
    397353#endif
    398354
Note: See TracChangeset for help on using the changeset viewer.