Changeset 779541b in mainline for uspace/lib/c/include/inet/tcp.h


Ignore:
Timestamp:
2015-05-09T13:43:50Z (9 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1d4b815
Parents:
99ea91b2
Message:

TCP transport layer API - somewhat working.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/inet/tcp.h

    r99ea91b2 r779541b  
    3636#define LIBC_INET_TCP_H_
    3737
     38#include <fibril_synch.h>
    3839#include <inet/addr.h>
    3940#include <inet/endpoint.h>
    4041#include <inet/inet.h>
    4142
     43/** TCP connection */
    4244typedef struct {
     45        fibril_mutex_t lock;
     46        fibril_condvar_t cv;
     47        struct tcp *tcp;
     48        link_t ltcp;
     49        sysarg_t id;
     50        struct tcp_cb *cb;
     51        void *cb_arg;
     52        /** Some received data available in TCP server */
     53        bool data_avail;
    4354} tcp_conn_t;
    4455
     56/** TCP connection listener */
    4557typedef struct {
     58        struct tcp *tcp;
     59        link_t ltcp;
     60        sysarg_t id;
     61        struct tcp_listen_cb *lcb;
     62        void *lcb_arg;
     63        struct tcp_cb *cb;
     64        void *cb_arg;
    4665} tcp_listener_t;
    4766
    48 typedef struct {
     67/** TCP connection callbacks */
     68typedef struct tcp_cb {
    4969        void (*connected)(tcp_conn_t *);
    5070        void (*conn_failed)(tcp_conn_t *);
     
    5474} tcp_cb_t;
    5575
    56 typedef struct {
     76/** TCP listener callbacks */
     77typedef struct tcp_listen_cb {
    5778        void (*new_conn)(tcp_listener_t *, tcp_conn_t *);
    5879} tcp_listen_cb_t;
    5980
    60 typedef struct {
     81/** TCP service */
     82typedef struct tcp {
     83        /** TCP session */
     84        async_sess_t *sess;
     85        /** List of connections */
     86        list_t conn; /* of tcp_conn_t */
     87        /** List of listeners */
     88        list_t listener; /* of tcp_listener_t */
    6189} tcp_t;
    6290
     
    76104extern int tcp_conn_send_fin(tcp_conn_t *);
    77105extern int tcp_conn_push(tcp_conn_t *);
    78 extern void tcp_conn_reset(tcp_conn_t *);
     106extern int tcp_conn_reset(tcp_conn_t *);
    79107
    80108extern int tcp_conn_recv(tcp_conn_t *, void *, size_t, size_t *);
Note: See TracChangeset for help on using the changeset viewer.