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


Ignore:
Timestamp:
2015-04-08T21:25:30Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
99ea91b2
Parents:
ba0eac5
Message:

New transport layer API. Only UDP implemented.

File:
1 moved

Legend:

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

    rba0eac5 rfab2746  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2015 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2828
    2929/** @addtogroup libc
    30  *  @{
     30 * @{
     31 */
     32/** @file
    3133 */
    3234
    33 /** @file
    34  *  Socket codes and definitions.
    35  *  This is a part of the network application library.
    36  */
     35#ifndef LIBC_INET_TCP_H_
     36#define LIBC_INET_TCP_H_
    3737
    38 #ifndef LIBC_SOCKET_CODES_H_
    39 #define LIBC_SOCKET_CODES_H_
     38#include <inet/addr.h>
     39#include <inet/endpoint.h>
     40#include <inet/inet.h>
    4041
    41 #include <sys/types.h>
     42typedef struct {
     43} tcp_conn_t;
    4244
    43 /** @name Address families definitions */
    44 /*@{*/
     45typedef struct {
     46} tcp_listener_t;
    4547
    46 enum {
    47         AF_NONE = 0,
    48         AF_INET,  /* IPv4 address */
    49         AF_INET6  /* IPv6 address */
    50 };
     48typedef struct {
     49        void (*connected)(tcp_conn_t *);
     50        void (*conn_failed)(tcp_conn_t *);
     51        void (*conn_reset)(tcp_conn_t *);
     52        void (*data_avail)(tcp_conn_t *);
     53        void (*urg_data)(tcp_conn_t *);
     54} tcp_cb_t;
    5155
    52 /*@}*/
     56typedef struct {
     57        void (*new_conn)(tcp_listener_t *, tcp_conn_t *);
     58} tcp_listen_cb_t;
    5359
    54 /** @name Protocol families definitions
    55  * Same as address families.
    56  */
    57 /*@{*/
     60typedef struct {
     61} tcp_t;
    5862
    59 #define PF_INET   AF_INET
    60 #define PF_INET6  AF_INET6
     63extern int tcp_create(tcp_t **);
     64extern void tcp_destroy(tcp_t *);
     65extern int tcp_conn_create(tcp_t *, inet_ep2_t *, tcp_cb_t *, void *,
     66    tcp_conn_t **);
     67extern void tcp_conn_destroy(tcp_conn_t *);
     68extern void *tcp_conn_userptr(tcp_conn_t *);
     69extern int tcp_listener_create(tcp_t *, inet_ep_t *, tcp_listen_cb_t *, void *,
     70    tcp_cb_t *, void *, tcp_listener_t **);
     71extern void tcp_listener_destroy(tcp_listener_t *);
     72extern void *tcp_listener_userptr(tcp_listener_t *);
    6173
    62 /*@}*/
     74extern int tcp_conn_wait_connected(tcp_conn_t *);
     75extern int tcp_conn_send(tcp_conn_t *, const void *, size_t);
     76extern int tcp_conn_send_fin(tcp_conn_t *);
     77extern int tcp_conn_push(tcp_conn_t *);
     78extern void tcp_conn_reset(tcp_conn_t *);
    6379
    64 /** Socket types. */
    65 typedef enum sock_type {
    66         /** Stream (connection oriented) socket. */
    67         SOCK_STREAM = 1,
    68         /** Datagram (connectionless oriented) socket. */
    69         SOCK_DGRAM = 2,
    70         /** Raw socket. */
    71         SOCK_RAW = 3
    72 } sock_type_t;
     80extern int tcp_conn_recv(tcp_conn_t *, void *, size_t, size_t *);
     81extern int tcp_conn_recv_wait(tcp_conn_t *, void *, size_t, size_t *);
    7382
    74 /** Type definition of the socket length. */
    75 typedef int32_t socklen_t;
    76 
    77 /* Socket options */
    78 
    79 enum {
    80         SOL_SOCKET = 1,
    81 
    82         /* IP link to transmit on */
    83         SO_IPLINK
    84 };
    8583
    8684#endif
Note: See TracChangeset for help on using the changeset viewer.