2014-06-21 23:23:39 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* net/tcp/tcp.h
|
|
|
|
*
|
2016-01-22 22:52:14 +01:00
|
|
|
* Copyright (C) 2014-2016 Gregory Nutt. All rights reserved.
|
2014-06-21 23:23:39 +02:00
|
|
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
|
|
* used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _NET_TCP_TCP_H
|
|
|
|
#define _NET_TCP_TCP_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
2014-06-24 16:03:44 +02:00
|
|
|
#include <sys/types.h>
|
2014-07-06 20:34:27 +02:00
|
|
|
#include <queue.h>
|
|
|
|
|
|
|
|
#include <nuttx/net/iob.h>
|
|
|
|
#include <nuttx/net/ip.h>
|
2014-06-24 16:03:44 +02:00
|
|
|
|
2014-06-21 23:23:39 +02:00
|
|
|
#ifdef CONFIG_NET_TCP
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
2015-01-30 14:09:25 +01:00
|
|
|
/* Conditions for support TCP poll/select operations */
|
|
|
|
|
|
|
|
#if !defined(CONFIG_DISABLE_POLL) && CONFIG_NSOCKET_DESCRIPTORS > 0 && \
|
|
|
|
defined(CONFIG_NET_TCP_READAHEAD)
|
|
|
|
# define HAVE_TCP_POLL
|
|
|
|
#endif
|
2014-06-21 23:23:39 +02:00
|
|
|
|
2014-06-29 02:36:09 +02:00
|
|
|
/* Allocate a new TCP data callback */
|
|
|
|
|
2015-05-30 17:12:27 +02:00
|
|
|
#ifdef CONFIG_NETDEV_MULTINIC
|
2015-05-30 19:29:47 +02:00
|
|
|
/* These macros allocate and free callback structures used for receiving
|
|
|
|
* notifications of TCP data-related events.
|
|
|
|
*/
|
|
|
|
|
2015-05-30 17:12:27 +02:00
|
|
|
# define tcp_callback_alloc(conn) \
|
|
|
|
devif_callback_alloc(conn->dev, &conn->list)
|
|
|
|
# define tcp_callback_free(conn,cb) \
|
2015-06-03 16:11:57 +02:00
|
|
|
devif_conn_callback_free(conn->dev, cb, &conn->list)
|
2015-05-30 19:29:47 +02:00
|
|
|
|
|
|
|
/* These macros allocate and free callback structures used for receiving
|
|
|
|
* notifications of device-related events.
|
|
|
|
*/
|
|
|
|
|
|
|
|
# define tcp_monitor_callback_alloc(conn) \
|
|
|
|
devif_callback_alloc(conn->dev, NULL)
|
|
|
|
# define tcp_monitor_callback_free(conn,cb) \
|
2015-06-03 16:11:57 +02:00
|
|
|
devif_conn_callback_free(conn->dev, cb, NULL)
|
2015-05-30 19:29:47 +02:00
|
|
|
|
2015-05-30 17:12:27 +02:00
|
|
|
#else
|
2015-05-30 19:29:47 +02:00
|
|
|
/* These macros allocate and free callback structures used for receiving
|
|
|
|
* notifications of TCP data-related events.
|
|
|
|
*/
|
|
|
|
|
2015-05-30 17:12:27 +02:00
|
|
|
# define tcp_callback_alloc(conn) \
|
|
|
|
devif_callback_alloc(g_netdevices, &conn->list)
|
|
|
|
# define tcp_callback_free(conn,cb) \
|
2015-06-03 16:11:57 +02:00
|
|
|
devif_conn_callback_free(g_netdevices, cb, &conn->list)
|
2015-05-30 19:29:47 +02:00
|
|
|
|
|
|
|
/* These macros allocate and free callback structures used for receiving
|
|
|
|
* notifications of device-related events.
|
|
|
|
*/
|
|
|
|
|
|
|
|
# define tcp_monitor_callback_alloc(conn) \
|
|
|
|
devif_callback_alloc(g_netdevices, NULL)
|
|
|
|
# define tcp_monitor_callback_free(conn,cb) \
|
2015-06-03 16:11:57 +02:00
|
|
|
devif_conn_callback_free(g_netdevices, cb, NULL)
|
2015-05-30 17:12:27 +02:00
|
|
|
#endif
|
2014-06-29 02:36:09 +02:00
|
|
|
|
2014-07-06 20:34:27 +02:00
|
|
|
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
|
|
|
/* TCP write buffer access macros */
|
|
|
|
|
|
|
|
# define WRB_SEQNO(wrb) ((wrb)->wb_seqno)
|
|
|
|
# define WRB_PKTLEN(wrb) ((wrb)->wb_iob->io_pktlen)
|
|
|
|
# define WRB_SENT(wrb) ((wrb)->wb_sent)
|
|
|
|
# define WRB_NRTX(wrb) ((wrb)->wb_nrtx)
|
|
|
|
# define WRB_IOB(wrb) ((wrb)->wb_iob)
|
|
|
|
# define WRB_COPYOUT(wrb,dest,n) (iob_copyout(dest,(wrb)->wb_iob,(n),0))
|
|
|
|
# define WRB_COPYIN(wrb,src,n) (iob_copyin((wrb)->wb_iob,src,(n),0,false))
|
|
|
|
|
|
|
|
# define WRB_TRIM(wrb,n) \
|
|
|
|
do { (wrb)->wb_iob = iob_trimhead((wrb)->wb_iob,(n)); } while (0)
|
|
|
|
|
2016-06-11 22:14:08 +02:00
|
|
|
#ifdef CONFIG_DEBUG_FEATURES
|
2014-07-06 20:34:27 +02:00
|
|
|
# define WRB_DUMP(msg,wrb,len,offset) \
|
|
|
|
tcp_wrbuffer_dump(msg,wrb,len,offset)
|
|
|
|
#else
|
|
|
|
# define WRB_DUMP(msg,wrb,len,offset)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2014-06-21 23:23:39 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Type Definitions
|
|
|
|
****************************************************************************/
|
2016-02-26 14:35:55 +01:00
|
|
|
|
2014-07-06 20:34:27 +02:00
|
|
|
/* Representation of a TCP connection.
|
|
|
|
*
|
|
|
|
* The tcp_conn_s structure is used for identifying a connection. All
|
|
|
|
* but one field in the structure are to be considered read-only by an
|
|
|
|
* application. The only exception is the 'private' fields whose purpose
|
|
|
|
* is to let the application store application-specific state (e.g.,
|
|
|
|
* file pointers) for the connection.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct net_driver_s; /* Forward reference */
|
|
|
|
struct devif_callback_s; /* Forward reference */
|
|
|
|
struct tcp_backlog_s; /* Forward reference */
|
2015-01-15 22:06:46 +01:00
|
|
|
struct tcp_hdr_s; /* Forward reference */
|
2014-07-06 20:34:27 +02:00
|
|
|
|
|
|
|
struct tcp_conn_s
|
|
|
|
{
|
|
|
|
dq_entry_t node; /* Implements a doubly linked list */
|
2015-01-16 17:01:54 +01:00
|
|
|
union ip_binding_u u; /* IP address binding */
|
2014-07-06 20:34:27 +02:00
|
|
|
uint8_t rcvseq[4]; /* The sequence number that we expect to
|
|
|
|
* receive next */
|
|
|
|
uint8_t sndseq[4]; /* The sequence number that was last sent by us */
|
|
|
|
uint8_t crefs; /* Reference counts on this instance */
|
2015-01-17 21:13:56 +01:00
|
|
|
#if defined(CONFIG_NET_IPv4) && defined(CONFIG_NET_IPv6)
|
2016-02-26 13:45:37 +01:00
|
|
|
uint8_t domain; /* IP domain: PF_INET or PF_INET6 */
|
2015-01-17 21:13:56 +01:00
|
|
|
#endif
|
2014-07-06 20:34:27 +02:00
|
|
|
uint8_t sa; /* Retransmission time-out calculation state
|
|
|
|
* variable */
|
|
|
|
uint8_t sv; /* Retransmission time-out calculation state
|
|
|
|
* variable */
|
|
|
|
uint8_t rto; /* Retransmission time-out */
|
|
|
|
uint8_t tcpstateflags; /* TCP state and flags */
|
|
|
|
uint8_t timer; /* The retransmission timer (units: half-seconds) */
|
|
|
|
uint8_t nrtx; /* The number of retransmissions for the last
|
|
|
|
* segment sent */
|
|
|
|
uint16_t lport; /* The local TCP port, in network byte order */
|
|
|
|
uint16_t rport; /* The remoteTCP port, in network byte order */
|
|
|
|
uint16_t mss; /* Current maximum segment size for the
|
|
|
|
* connection */
|
|
|
|
uint16_t winsize; /* Current window size of the connection */
|
|
|
|
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
|
|
|
uint32_t unacked; /* Number bytes sent but not yet ACKed */
|
|
|
|
#else
|
|
|
|
uint16_t unacked; /* Number bytes sent but not yet ACKed */
|
|
|
|
#endif
|
|
|
|
|
2015-05-30 17:12:27 +02:00
|
|
|
#ifdef CONFIG_NETDEV_MULTINIC
|
|
|
|
/* If the TCP socket is bound to a local address, then this is
|
|
|
|
* a reference to the device that routes traffic on the corresponding
|
|
|
|
* network.
|
|
|
|
*/
|
|
|
|
|
|
|
|
FAR struct net_driver_s *dev;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_TCP_READAHEAD
|
2014-07-06 20:34:27 +02:00
|
|
|
/* Read-ahead buffering.
|
|
|
|
*
|
|
|
|
* readahead - A singly linked list of type struct iob_qentry_s
|
|
|
|
* where the TCP/IP read-ahead data is retained.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct iob_queue_s readahead; /* Read-ahead buffering */
|
|
|
|
#endif
|
|
|
|
|
2015-05-30 17:12:27 +02:00
|
|
|
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
2014-07-06 20:34:27 +02:00
|
|
|
/* Write buffering
|
|
|
|
*
|
|
|
|
* write_q - The queue of unsent I/O buffers. The head of this
|
|
|
|
* list may be partially sent. FIFO ordering.
|
|
|
|
* unacked_q - A queue of completely sent, but unacked I/O buffer
|
|
|
|
* chains. Sequence number ordering.
|
|
|
|
*/
|
|
|
|
|
|
|
|
sq_queue_t write_q; /* Write buffering for segments */
|
|
|
|
sq_queue_t unacked_q; /* Write buffering for un-ACKed segments */
|
|
|
|
uint16_t expired; /* Number segments retransmitted but not yet ACKed,
|
2014-07-07 00:10:26 +02:00
|
|
|
* it can only be updated at TCP_ESTABLISHED state */
|
2015-05-11 15:14:25 +02:00
|
|
|
uint32_t sent; /* The number of bytes sent (ACKed and un-ACKed) */
|
2014-07-06 20:34:27 +02:00
|
|
|
uint32_t isn; /* Initial sequence number */
|
While working with version 7.10 I discovered a problem in TCP stack that could be observed on high network load. Generally speaking, the problem is that RST flag is set in unnecessary case, in which between loss of some TCP packet and its proper retransmission, another packets had been successfully sent. The scenario is as follows: NuttX did not receive ACK for some sent packet, so it has been probably lost somewhere. But before its retransmission starts, NuttX is correctly issuing next TCP packets, with sequence numbers increasing properly. When the retransmission of previously lost packet finally succeeds, tcp_input receives the accumulated ACK value, which acknowledges also the packets sent in the meantime (i.e. between unsuccessful sending of lost packet and its proper retransmission). However, variable unackseq is still set to conn->isn + conn->sent, which is truth only if no further packets transmission occurred in the meantime. Because of incorrect (in such specific case) unackseq value, few lines further condition if (ackseq <= unackseq)is not met, and, as a result, we are going to reset label.
2016-06-20 14:55:29 +02:00
|
|
|
uint32_t sndseq_max; /* The sequence number of next not-retransmitted
|
|
|
|
* segment (next greater sndseq) */
|
2014-07-06 20:34:27 +02:00
|
|
|
#endif
|
|
|
|
|
2015-05-30 17:12:27 +02:00
|
|
|
#ifdef CONFIG_NET_TCPBACKLOG
|
2014-07-06 20:34:27 +02:00
|
|
|
/* Listen backlog support
|
|
|
|
*
|
|
|
|
* blparent - The backlog parent. If this connection is backlogged,
|
|
|
|
* this field will be non-null and will refer to the TCP connection
|
|
|
|
* structure in which this connection is backlogged.
|
|
|
|
* backlog - The pending connection backlog. If this connection is
|
|
|
|
* configured as a listener with backlog, then this refers to the
|
|
|
|
* struct tcp_backlog_s tear-off structure that manages that backlog.
|
|
|
|
*/
|
|
|
|
|
|
|
|
FAR struct tcp_conn_s *blparent;
|
|
|
|
FAR struct tcp_backlog_s *backlog;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Application callbacks:
|
|
|
|
*
|
|
|
|
* Data transfer events are retained in 'list'. Event handlers in 'list'
|
|
|
|
* are called for events specified in the flags set within struct
|
|
|
|
* devif_callback_s
|
|
|
|
*
|
|
|
|
* When an callback is executed from 'list', the input flags are normally
|
|
|
|
* returned, however, the implementation may set one of the following:
|
|
|
|
*
|
2014-07-07 01:22:02 +02:00
|
|
|
* TCP_CLOSE - Gracefully close the current connection
|
|
|
|
* TCP_ABORT - Abort (reset) the current connection on an error that
|
|
|
|
* prevents TCP_CLOSE from working.
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
* And/Or set/clear the following:
|
|
|
|
*
|
2014-07-07 01:22:02 +02:00
|
|
|
* TCP_NEWDATA - May be cleared to indicate that the data was consumed
|
2014-07-06 20:34:27 +02:00
|
|
|
* and that no further process of the new data should be
|
|
|
|
* attempted.
|
2014-07-07 01:22:02 +02:00
|
|
|
* TCP_SNDACK - If TCP_NEWDATA is cleared, then TCP_SNDACK may be set
|
2014-07-06 20:34:27 +02:00
|
|
|
* to indicate that an ACK should be included in the response.
|
2014-07-07 01:22:02 +02:00
|
|
|
* (In TCP_NEWDATA is cleared bu TCP_SNDACK is not set, then
|
2014-07-06 20:34:27 +02:00
|
|
|
* dev->d_len should also be cleared).
|
|
|
|
*/
|
|
|
|
|
|
|
|
FAR struct devif_callback_s *list;
|
|
|
|
|
2015-05-30 19:29:47 +02:00
|
|
|
/* accept() is called when the TCP logic has created a connection
|
|
|
|
*
|
|
|
|
* accept_private: This is private data that will be available to the
|
|
|
|
* accept() handler when it is invoked with a point to this structure
|
|
|
|
* as an argument.
|
|
|
|
* accept: This is the the pointer to the accept handler.
|
|
|
|
*/
|
2014-07-06 20:34:27 +02:00
|
|
|
|
|
|
|
FAR void *accept_private;
|
|
|
|
int (*accept)(FAR struct tcp_conn_s *listener, FAR struct tcp_conn_s *conn);
|
|
|
|
|
|
|
|
/* connection_event() is called on any of the subset of connection-related
|
|
|
|
* events.
|
2015-05-30 19:29:47 +02:00
|
|
|
*
|
|
|
|
* connection_private: This is private data that will be available to
|
|
|
|
* the connection_event() handler when it is invoked with a point to
|
|
|
|
* this structure as an argument.
|
|
|
|
* connection_devcb: this is the allocated callback structure that is
|
|
|
|
* used to
|
|
|
|
* connection_event: This is the the pointer to the connection event
|
|
|
|
* handler.
|
2014-07-06 20:34:27 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
FAR void *connection_private;
|
2015-05-30 19:29:47 +02:00
|
|
|
FAR struct devif_callback_s *connection_devcb;
|
|
|
|
uint16_t (*connection_event)(FAR struct net_driver_s *dev,
|
|
|
|
FAR void *pvconn, FAR void *pvpriv,
|
|
|
|
uint16_t flags);
|
2014-07-06 20:34:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* This structure supports TCP write buffering */
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
|
|
|
struct tcp_wrbuffer_s
|
|
|
|
{
|
|
|
|
sq_entry_t wb_node; /* Supports a singly linked list */
|
|
|
|
uint32_t wb_seqno; /* Sequence number of the write segment */
|
|
|
|
uint16_t wb_sent; /* Number of bytes sent from the I/O buffer chain */
|
|
|
|
uint8_t wb_nrtx; /* The number of retransmissions for the last
|
|
|
|
* segment sent */
|
|
|
|
struct iob_s *wb_iob; /* Head of the I/O buffer chain */
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Support for listen backlog:
|
|
|
|
*
|
|
|
|
* struct tcp_blcontainer_s describes one backlogged connection
|
|
|
|
* struct tcp_backlog_s is a "tear-off" describing all backlog for a
|
|
|
|
* listener connection
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_TCPBACKLOG
|
|
|
|
struct tcp_blcontainer_s
|
|
|
|
{
|
|
|
|
sq_entry_t bc_node; /* Implements a singly linked list */
|
|
|
|
FAR struct tcp_conn_s *bc_conn; /* Holds reference to the new connection structure */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tcp_backlog_s
|
|
|
|
{
|
|
|
|
sq_queue_t bl_free; /* Implements a singly-linked list of free containers */
|
|
|
|
sq_queue_t bl_pending; /* Implements a singly-linked list of pending connections */
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2014-06-21 23:23:39 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
# define EXTERN extern "C"
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#else
|
|
|
|
# define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2015-05-30 17:12:27 +02:00
|
|
|
#if CONFIG_NSOCKET_DESCRIPTORS > 0
|
2015-05-31 16:34:03 +02:00
|
|
|
/* List of registered Ethernet device drivers. You must have the network
|
|
|
|
* locked in order to access this list.
|
|
|
|
*
|
|
|
|
* NOTE that this duplicates a declaration in net/netdev/netdev.h
|
2015-05-30 17:12:27 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
EXTERN struct net_driver_s *g_netdevices;
|
|
|
|
#endif
|
|
|
|
|
2014-06-21 23:23:39 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
2015-01-25 22:46:05 +01:00
|
|
|
struct sockaddr; /* Forward reference */
|
|
|
|
struct socket; /* Forward reference */
|
2015-01-30 14:25:01 +01:00
|
|
|
struct pollfd; /* Forward reference */
|
2014-06-26 17:32:39 +02:00
|
|
|
|
2014-07-06 20:34:27 +02:00
|
|
|
/****************************************************************************
|
2015-01-15 22:06:46 +01:00
|
|
|
* Name: tcp_initialize
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Initialize the TCP/IP connection structures. Called only once and only
|
|
|
|
* from the UIP layer at start-up in normal user mode.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-25 02:12:49 +02:00
|
|
|
void tcp_initialize(void);
|
2014-07-06 20:34:27 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2015-01-15 22:06:46 +01:00
|
|
|
* Name: tcp_alloc
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Find a free TCP/IP connection structure and allocate it
|
|
|
|
* for use. This is normally something done by the implementation of the
|
2015-01-15 22:06:46 +01:00
|
|
|
* socket() API but is also called from the driver level when a TCP
|
2014-07-06 20:34:27 +02:00
|
|
|
* packet is received while "listening"
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2015-01-17 20:07:48 +01:00
|
|
|
FAR struct tcp_conn_s *tcp_alloc(uint8_t domain);
|
2014-07-06 20:34:27 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2015-01-15 22:06:46 +01:00
|
|
|
* Name: tcp_free
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Free a connection structure that is no longer in use. This should be
|
|
|
|
* done by the implementation of close()
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void tcp_free(FAR struct tcp_conn_s *conn);
|
|
|
|
|
|
|
|
/****************************************************************************
|
2015-01-15 22:06:46 +01:00
|
|
|
* Name: tcp_active
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Find a connection structure that is the appropriate
|
|
|
|
* connection to be used with the provided TCP/IP header
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2015-01-15 22:06:46 +01:00
|
|
|
FAR struct tcp_conn_s *tcp_active(FAR struct net_driver_s *dev,
|
|
|
|
FAR struct tcp_hdr_s *tcp);
|
2014-07-06 20:34:27 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2015-01-15 22:06:46 +01:00
|
|
|
* Name: tcp_nextconn
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Traverse the list of active TCP connections
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
FAR struct tcp_conn_s *tcp_nextconn(FAR struct tcp_conn_s *conn);
|
|
|
|
|
2015-05-30 17:12:27 +02:00
|
|
|
/****************************************************************************
|
2015-09-03 03:48:31 +02:00
|
|
|
* Function: tcp_local_ipv4_device
|
2015-05-30 17:12:27 +02:00
|
|
|
*
|
|
|
|
* Description:
|
2015-09-03 03:48:31 +02:00
|
|
|
* Select the network driver to use with the IPv4 TCP transaction based
|
|
|
|
* on the locally bound IPv4 address
|
2015-05-30 17:12:27 +02:00
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* conn - TCP connection structure. The locally bound address, laddr,
|
|
|
|
* should be set to a non-zero value in this structure.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) is returned on success. A negated errno value is returned
|
2015-09-03 04:03:28 +02:00
|
|
|
* on failure. -ENETUNREACH is the only expected error value.
|
2015-05-30 17:12:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_IPv4
|
2015-09-03 03:48:31 +02:00
|
|
|
int tcp_local_ipv4_device(FAR struct tcp_conn_s *conn);
|
2015-05-30 17:12:27 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
2015-09-03 03:48:31 +02:00
|
|
|
* Function: tcp_remote_ipv4_device
|
2015-05-30 17:12:27 +02:00
|
|
|
*
|
|
|
|
* Description:
|
2015-09-03 03:48:31 +02:00
|
|
|
* Select the network driver to use with the IPv4 TCP transaction based
|
|
|
|
* on the remotely connected IPv4 address
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* conn - TCP connection structure. The remotely conected address, raddr,
|
|
|
|
* should be set to a non-zero value in this structure.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) is returned on success. A negated errno value is returned
|
2015-09-03 04:03:28 +02:00
|
|
|
* on failure. -ENETUNREACH is the only expected error value.
|
2015-09-03 03:48:31 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_IPv4
|
|
|
|
int tcp_remote_ipv4_device(FAR struct tcp_conn_s *conn);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_local_ipv6_device
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Select the network driver to use with the IPv6 TCP transaction based
|
|
|
|
* on the locally bound IPv6 address
|
2015-05-30 17:12:27 +02:00
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* conn - TCP connection structure. The locally bound address, laddr,
|
|
|
|
* should be set to a non-zero value in this structure.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) is returned on success. A negated errno value is returned
|
|
|
|
* on failure. -EHOSTUNREACH is the only expected error value.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_IPv6
|
2015-09-03 03:48:31 +02:00
|
|
|
int tcp_local_ipv6_device(FAR struct tcp_conn_s *conn);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_remote_ipv6_device
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Select the network driver to use with the IPv6 TCP transaction based
|
|
|
|
* on the remotely conected IPv6 address
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* conn - TCP connection structure. The remotely connected address, raddr,
|
|
|
|
* should be set to a non-zero value in this structure.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) is returned on success. A negated errno value is returned
|
|
|
|
* on failure. -EHOSTUNREACH is the only expected error value.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_IPv6
|
|
|
|
int tcp_remote_ipv6_device(FAR struct tcp_conn_s *conn);
|
2015-05-30 17:12:27 +02:00
|
|
|
#endif
|
|
|
|
|
2014-07-06 20:34:27 +02:00
|
|
|
/****************************************************************************
|
2015-01-15 22:06:46 +01:00
|
|
|
* Name: tcp_alloc_accept
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
* Description:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called when driver processing matches the incoming packet with a
|
|
|
|
* connection in LISTEN. In that case, this function will create a new
|
|
|
|
* connection and initialize it to send a SYNACK in return.
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-11-15 20:13:23 +01:00
|
|
|
FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct net_driver_s *dev,
|
2015-01-15 22:06:46 +01:00
|
|
|
FAR struct tcp_hdr_s *tcp);
|
2014-07-06 20:34:27 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2015-01-15 22:06:46 +01:00
|
|
|
* Name: tcp_bind
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* This function implements the lower level parts of the standard TCP
|
|
|
|
* bind() operation.
|
|
|
|
*
|
|
|
|
* Return:
|
|
|
|
* 0 on success or -EADDRINUSE on failure
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* This function is called from normal user level code.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2015-01-18 00:07:54 +01:00
|
|
|
int tcp_bind(FAR struct tcp_conn_s *conn, FAR const struct sockaddr *addr);
|
2014-07-06 20:34:27 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_connect
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* This function implements the lower level parts of the standard
|
|
|
|
* TCP connect() operation: It connects to a remote host using TCP.
|
|
|
|
*
|
|
|
|
* This function is used to start a new connection to the specified
|
|
|
|
* port on the specified host. It uses the connection structure that was
|
|
|
|
* allocated by a preceding socket() call. It sets the connection to
|
|
|
|
* the SYN_SENT state and sets the retransmission timer to 0. This will
|
|
|
|
* cause a TCP SYN segment to be sent out the next time this connection
|
|
|
|
* is periodically processed, which usually is done within 0.5 seconds
|
|
|
|
* after the call to tcp_connect().
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* This function is called from normal user level code.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2015-01-17 22:17:35 +01:00
|
|
|
int tcp_connect(FAR struct tcp_conn_s *conn, FAR const struct sockaddr *addr);
|
2014-06-25 02:12:49 +02:00
|
|
|
|
2015-01-17 14:42:09 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_ipv4_select
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Configure to send or receive an TCP IPv4 packet
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_IPv4
|
|
|
|
void tcp_ipv4_select(FAR struct net_driver_s *dev);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_ipv6_select
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Configure to send or receive an TCP IPv6 packet
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_IPv6
|
|
|
|
void tcp_ipv6_select(FAR struct net_driver_s *dev);
|
|
|
|
#endif
|
|
|
|
|
2014-07-06 20:34:27 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_setsequence
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Set the TCP/IP sequence number
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
2014-06-25 02:12:49 +02:00
|
|
|
|
|
|
|
void tcp_setsequence(FAR uint8_t *seqno, uint32_t value);
|
2014-07-06 20:34:27 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_getsequence
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Get the TCP/IP sequence number
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-25 02:12:49 +02:00
|
|
|
uint32_t tcp_getsequence(FAR uint8_t *seqno);
|
2014-07-06 20:34:27 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_addsequence
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Add the length to get the next TCP sequence number.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-25 02:12:49 +02:00
|
|
|
uint32_t tcp_addsequence(FAR uint8_t *seqno, uint16_t len);
|
2014-07-06 20:34:27 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_initsequence
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Set the (initial) the TCP/IP sequence number when a TCP connection is
|
|
|
|
* established.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-25 02:12:49 +02:00
|
|
|
void tcp_initsequence(FAR uint8_t *seqno);
|
2014-07-06 20:34:27 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_nextsequence
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Increment the TCP/IP sequence number
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-25 02:12:49 +02:00
|
|
|
void tcp_nextsequence(void);
|
|
|
|
|
2014-07-06 20:34:27 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_poll
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Poll a TCP connection structure for availability of TX data
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* dev - The device driver structure to use in the send operation
|
|
|
|
* conn - The TCP "connection" to poll for TX data
|
|
|
|
*
|
|
|
|
* Return:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
2014-06-25 02:12:49 +02:00
|
|
|
|
2014-06-28 00:48:12 +02:00
|
|
|
void tcp_poll(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn);
|
2014-06-25 02:12:49 +02:00
|
|
|
|
2014-07-06 20:34:27 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_timer
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Handle a TCP timer expiration for the provided TCP connection
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* dev - The device driver structure to use in the send operation
|
|
|
|
* conn - The TCP "connection" to poll for TX data
|
While working with version 7.10 I discovered a problem in TCP stack that could be observed on high network load. Generally speaking, the problem is that RST flag is set in unnecessary case, in which between loss of some TCP packet and its proper retransmission, another packets had been successfully sent. The scenario is as follows: NuttX did not receive ACK for some sent packet, so it has been probably lost somewhere. But before its retransmission starts, NuttX is correctly issuing next TCP packets, with sequence numbers increasing properly. When the retransmission of previously lost packet finally succeeds, tcp_input receives the accumulated ACK value, which acknowledges also the packets sent in the meantime (i.e. between unsuccessful sending of lost packet and its proper retransmission). However, variable unackseq is still set to conn->isn + conn->sent, which is truth only if no further packets transmission occurred in the meantime. Because of incorrect (in such specific case) unackseq value, few lines further condition if (ackseq <= unackseq)is not met, and, as a result, we are going to reset label.
2016-06-20 14:55:29 +02:00
|
|
|
* hsec - The polling interval in halves of a second
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
* Return:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
2014-06-25 02:12:49 +02:00
|
|
|
|
2014-06-28 00:48:12 +02:00
|
|
|
void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
2014-06-25 02:12:49 +02:00
|
|
|
int hsec);
|
|
|
|
|
2014-07-06 20:34:27 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_listen_initialize
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Setup the listening data structures
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called early in the initialization phase while the system is still
|
|
|
|
* single-threaded.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void tcp_listen_initialize(void);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_unlisten
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Stop listening to the port bound to the specified TCP connection
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called from normal user code.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int tcp_unlisten(FAR struct tcp_conn_s *conn);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_listen
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Start listening to the port bound to the specified TCP connection
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called from normal user code.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int tcp_listen(FAR struct tcp_conn_s *conn);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_islistener
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Return true is there is a listener for the specified port
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
bool tcp_islistener(uint16_t portno);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_accept_connection
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Accept the new connection for the specified listening port.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
2014-06-25 02:12:49 +02:00
|
|
|
|
2014-06-28 00:48:12 +02:00
|
|
|
int tcp_accept_connection(FAR struct net_driver_s *dev,
|
2014-06-25 02:12:49 +02:00
|
|
|
FAR struct tcp_conn_s *conn, uint16_t portno);
|
|
|
|
|
2014-07-06 20:34:27 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_send
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Setup to send a TCP packet
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* dev - The device driver structure to use in the send operation
|
|
|
|
* conn - The TCP connection structure holding connection information
|
|
|
|
* flags - flags to apply to the TCP header
|
|
|
|
* len - length of the message
|
|
|
|
*
|
|
|
|
* Return:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
2014-06-25 02:12:49 +02:00
|
|
|
|
2014-06-28 00:48:12 +02:00
|
|
|
void tcp_send(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
2014-06-25 02:12:49 +02:00
|
|
|
uint16_t flags, uint16_t len);
|
2014-07-06 20:34:27 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_reset
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Send a TCP reset (no-data) message
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* dev - The device driver structure to use in the send operation
|
|
|
|
*
|
|
|
|
* Return:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-28 00:48:12 +02:00
|
|
|
void tcp_reset(FAR struct net_driver_s *dev);
|
2014-07-06 20:34:27 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_ack
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Send the SYN or SYNACK response.
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* dev - The device driver structure to use in the send operation
|
|
|
|
* conn - The TCP connection structure holding connection information
|
|
|
|
* ack - The ACK response to send
|
|
|
|
*
|
|
|
|
* Return:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-28 00:48:12 +02:00
|
|
|
void tcp_ack(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
2014-06-25 02:12:49 +02:00
|
|
|
uint8_t ack);
|
|
|
|
|
2014-07-06 20:34:27 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_appsend
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Handle application or TCP protocol response. If this function is called
|
|
|
|
* with dev->d_sndlen > 0, then this is an application attempting to send
|
|
|
|
* packet.
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* dev - The device driver structure to use in the send operation
|
|
|
|
* conn - The TCP connection structure holding connection information
|
|
|
|
* result - App result event sent
|
|
|
|
*
|
|
|
|
* Return:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
2014-06-25 02:12:49 +02:00
|
|
|
|
2014-06-28 00:48:12 +02:00
|
|
|
void tcp_appsend(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
2014-06-25 02:12:49 +02:00
|
|
|
uint16_t result);
|
2014-07-06 20:34:27 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_rexmit
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Handle application retransmission
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* dev - The device driver structure to use in the send operation
|
|
|
|
* conn - The TCP connection structure holding connection information
|
|
|
|
* result - App result event sent
|
|
|
|
*
|
|
|
|
* Return:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-28 00:48:12 +02:00
|
|
|
void tcp_rexmit(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
2014-06-25 02:12:49 +02:00
|
|
|
uint16_t result);
|
|
|
|
|
2014-07-06 20:34:27 +02:00
|
|
|
/****************************************************************************
|
2015-01-15 22:06:46 +01:00
|
|
|
* Name: tcp_ipv4_input
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
* Description:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Handle incoming TCP input with IPv4 header
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* dev - The device driver structure containing the received TCP packet.
|
|
|
|
*
|
|
|
|
* Return:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from the Ethernet driver with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
2014-06-25 02:12:49 +02:00
|
|
|
|
2015-01-15 22:06:46 +01:00
|
|
|
#ifdef CONFIG_NET_IPv4
|
|
|
|
void tcp_ipv4_input(FAR struct net_driver_s *dev);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_ipv6_input
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Handle incoming TCP input with IPv4 header
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* dev - The device driver structure containing the received TCP packet.
|
|
|
|
*
|
|
|
|
* Return:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called from the Ethernet driver with the network stack locked
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_IPv6
|
|
|
|
void tcp_ipv6_input(FAR struct net_driver_s *dev);
|
|
|
|
#endif
|
2014-06-25 02:12:49 +02:00
|
|
|
|
2014-07-06 20:34:27 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_callback
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Inform the application holding the TCP socket of a change in state.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
2014-06-25 02:12:49 +02:00
|
|
|
|
2014-06-28 00:48:12 +02:00
|
|
|
uint16_t tcp_callback(FAR struct net_driver_s *dev,
|
2014-06-25 02:12:49 +02:00
|
|
|
FAR struct tcp_conn_s *conn, uint16_t flags);
|
2014-07-06 20:34:27 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_datahandler
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Handle data that is not accepted by the application. This may be called
|
|
|
|
* either (1) from the data receive logic if it cannot buffer the data, or
|
|
|
|
* (2) from the TCP event logic is there is no listener in place ready to
|
|
|
|
* receive the data.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* conn - A pointer to the TCP connection structure
|
|
|
|
* buffer - A pointer to the buffer to be copied to the read-ahead
|
|
|
|
* buffers
|
|
|
|
* buflen - The number of bytes to copy to the read-ahead buffer.
|
|
|
|
*
|
|
|
|
* Returned value:
|
|
|
|
* The number of bytes actually buffered is returned. This will be either
|
|
|
|
* zero or equal to buflen; partial packets are not buffered.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2014-07-07 01:22:02 +02:00
|
|
|
* - The caller has checked that TCP_NEWDATA is set in flags and that is no
|
2014-07-06 20:34:27 +02:00
|
|
|
* other handler available to process the incoming data.
|
2015-01-15 22:06:46 +01:00
|
|
|
* - Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-25 02:12:49 +02:00
|
|
|
#ifdef CONFIG_NET_TCP_READAHEAD
|
2014-07-06 20:34:27 +02:00
|
|
|
uint16_t tcp_datahandler(FAR struct tcp_conn_s *conn, FAR uint8_t *buffer,
|
|
|
|
uint16_t nbytes);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_backlogcreate
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Called from the listen() logic to setup the backlog as specified in the
|
|
|
|
* the listen arguments.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called from normal user code. Interrupts may be disabled.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_TCPBACKLOG
|
|
|
|
int tcp_backlogcreate(FAR struct tcp_conn_s *conn, int nblg);
|
|
|
|
#else
|
|
|
|
# define tcp_backlogcreate(c,n) (-ENOSYS)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_backlogdestroy
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* (1) Called from tcp_free() whenever a connection is freed.
|
|
|
|
* (2) Called from tcp_backlogcreate() to destroy any old backlog
|
|
|
|
*
|
|
|
|
* NOTE: This function may re-enter tcp_free when a connection that
|
|
|
|
* is freed that has pending connections.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_TCPBACKLOG
|
|
|
|
int tcp_backlogdestroy(FAR struct tcp_conn_s *conn);
|
|
|
|
#else
|
|
|
|
# define tcp_backlogdestroy(conn) (-ENOSYS)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_backlogadd
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Called tcp_listen when a new connection is made with a listener socket
|
|
|
|
* but when there is no accept() in place to receive the connection. This
|
|
|
|
* function adds the new connection to the backlog.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_TCPBACKLOG
|
|
|
|
int tcp_backlogadd(FAR struct tcp_conn_s *conn,
|
|
|
|
FAR struct tcp_conn_s *blconn);
|
|
|
|
#else
|
|
|
|
# define tcp_backlogadd(conn,blconn) (-ENOSYS)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_backlogavailable
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Called from poll(). Before waiting for a new connection, poll will
|
|
|
|
* call this API to see if there are pending connections in the backlog.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called from normal user code, but with interrupts disabled,
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#if defined(CONFIG_NET_TCPBACKLOG) && !defined(CONFIG_DISABLE_POLL)
|
|
|
|
bool tcp_backlogavailable(FAR struct tcp_conn_s *conn);
|
|
|
|
#else
|
|
|
|
# define tcp_backlogavailable(c) (false);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_backlogremove
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Called from accept(). Before waiting for a new connection, accept will
|
|
|
|
* call this API to see if there are pending connections in the backlog.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called from normal user code, but with interrupts disabled,
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_TCPBACKLOG
|
|
|
|
FAR struct tcp_conn_s *tcp_backlogremove(FAR struct tcp_conn_s *conn);
|
|
|
|
#else
|
|
|
|
# define tcp_backlogremove(c) (NULL)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_backlogdelete
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Called from tcp_free() when a connection is freed that this also
|
|
|
|
* retained in the pending connection list of a listener. We simply need
|
|
|
|
* to remove the defunct connection from the list.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-07-06 20:34:27 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_TCPBACKLOG
|
|
|
|
int tcp_backlogdelete(FAR struct tcp_conn_s *conn,
|
2014-07-07 01:58:36 +02:00
|
|
|
FAR struct tcp_conn_s *blconn);
|
2014-07-06 20:34:27 +02:00
|
|
|
#else
|
|
|
|
# define tcp_backlogdelete(c,b) (-ENOSYS)
|
2014-06-25 02:12:49 +02:00
|
|
|
#endif
|
|
|
|
|
2015-01-25 22:46:05 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_accept
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* This function implements accept() for TCP/IP sockets. See the
|
|
|
|
* description of accept() for further information.
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* psock The listening TCP socket structure
|
|
|
|
* addr Receives the address of the connecting client
|
|
|
|
* addrlen Input: allocated size of 'addr', Return: returned size of 'addr'
|
|
|
|
* newconn The new, accepted TCP connection structure
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Returns zero (OK) on success or a negated errno value on failure.
|
|
|
|
* See the description of accept of the possible errno values in the
|
|
|
|
* description of accept().
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Network is locked.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int psock_tcp_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
|
|
|
|
FAR socklen_t *addrlen, FAR void **newconn);
|
|
|
|
|
2014-06-24 16:03:44 +02:00
|
|
|
/****************************************************************************
|
2014-06-25 02:12:49 +02:00
|
|
|
* Function: psock_tcp_send
|
2014-06-24 16:03:44 +02:00
|
|
|
*
|
|
|
|
* Description:
|
2014-06-25 02:12:49 +02:00
|
|
|
* The psock_tcp_send() call may be used only when the TCP socket is in a
|
2014-06-24 16:03:44 +02:00
|
|
|
* connected state (so that the intended recipient is known).
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* psock An instance of the internal socket structure.
|
|
|
|
* buf Data to send
|
|
|
|
* len Length of data to send
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* On success, returns the number of characters sent. On error,
|
|
|
|
* -1 is returned, and errno is set appropriately:
|
|
|
|
*
|
|
|
|
* EAGAIN or EWOULDBLOCK
|
|
|
|
* The socket is marked non-blocking and the requested operation
|
|
|
|
* would block.
|
|
|
|
* EBADF
|
|
|
|
* An invalid descriptor was specified.
|
|
|
|
* ECONNRESET
|
|
|
|
* Connection reset by peer.
|
|
|
|
* EDESTADDRREQ
|
|
|
|
* The socket is not connection-mode, and no peer address is set.
|
|
|
|
* EFAULT
|
|
|
|
* An invalid user space address was specified for a parameter.
|
|
|
|
* EINTR
|
|
|
|
* A signal occurred before any data was transmitted.
|
|
|
|
* EINVAL
|
|
|
|
* Invalid argument passed.
|
|
|
|
* EISCONN
|
|
|
|
* The connection-mode socket was connected already but a recipient
|
|
|
|
* was specified. (Now either this error is returned, or the recipient
|
|
|
|
* specification is ignored.)
|
|
|
|
* EMSGSIZE
|
|
|
|
* The socket type requires that message be sent atomically, and the
|
|
|
|
* size of the message to be sent made this impossible.
|
|
|
|
* ENOBUFS
|
|
|
|
* The output queue for a network interface was full. This generally
|
|
|
|
* indicates that the interface has stopped sending, but may be
|
|
|
|
* caused by transient congestion.
|
|
|
|
* ENOMEM
|
|
|
|
* No memory available.
|
|
|
|
* ENOTCONN
|
|
|
|
* The socket is not connected, and no target has been given.
|
|
|
|
* ENOTSOCK
|
|
|
|
* The argument s is not a socket.
|
|
|
|
* EPIPE
|
|
|
|
* The local end has been shut down on a connection oriented socket.
|
|
|
|
* In this case the process will also receive a SIGPIPE unless
|
|
|
|
* MSG_NOSIGNAL is set.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
struct socket;
|
2014-06-25 02:12:49 +02:00
|
|
|
ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
|
|
|
|
size_t len);
|
2014-06-24 16:03:44 +02:00
|
|
|
|
2016-01-22 22:52:14 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Function: psock_tcp_cansend
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* psock_tcp_cansend() returns a value indicating if a write to the socket
|
|
|
|
* would block. No space in the buffer is actually reserved, so it is
|
|
|
|
* possible that the write may still block if the buffer is filled by
|
|
|
|
* another means.
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* psock An instance of the internal socket structure.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* OK
|
|
|
|
* At least one byte of data could be succesfully written.
|
|
|
|
* -EWOULDBLOCK
|
|
|
|
* There is no room in the output buffer.
|
|
|
|
* -EBADF
|
|
|
|
* An invalid descriptor was specified.
|
|
|
|
* -ENOTCONN
|
|
|
|
* The socket is not connected.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Not running at the interrupt level
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int psock_tcp_cansend(FAR struct socket *psock);
|
|
|
|
|
2014-06-21 23:23:39 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_wrbuffer_initialize
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Initialize the list of free write buffers
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called once early initialization.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
|
|
|
void tcp_wrbuffer_initialize(void);
|
|
|
|
#endif /* CONFIG_NET_TCP_WRITE_BUFFERS */
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_wrbuffer_alloc
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Allocate a TCP write buffer by taking a pre-allocated buffer from
|
|
|
|
* the free list. This function is called from TCP logic when a buffer
|
|
|
|
* of TCP data is about to sent
|
|
|
|
*
|
2014-06-24 19:53:19 +02:00
|
|
|
* Input parameters:
|
|
|
|
* None
|
|
|
|
*
|
2014-06-21 23:23:39 +02:00
|
|
|
* Assumptions:
|
2015-01-28 18:56:11 +01:00
|
|
|
* Called from user logic with the network locked.
|
2014-06-21 23:23:39 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
|
|
|
struct tcp_wrbuffer_s;
|
|
|
|
|
2014-06-22 19:27:57 +02:00
|
|
|
FAR struct tcp_wrbuffer_s *tcp_wrbuffer_alloc(void);
|
2014-06-21 23:23:39 +02:00
|
|
|
#endif /* CONFIG_NET_TCP_WRITE_BUFFERS */
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_wrbuffer_release
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Release a TCP write buffer by returning the buffer to the free list.
|
|
|
|
* This function is called from user logic after it is consumed the
|
|
|
|
* buffered data.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2015-01-15 22:06:46 +01:00
|
|
|
* Called from network stack logic with the network stack locked
|
2014-06-21 23:23:39 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
2014-06-22 19:27:57 +02:00
|
|
|
void tcp_wrbuffer_release(FAR struct tcp_wrbuffer_s *wrb);
|
|
|
|
#endif /* CONFIG_NET_TCP_WRITE_BUFFERS */
|
|
|
|
|
2016-01-22 22:52:14 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_wrbuffer_test
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Check if there is room in the write buffer. Does not reserve any space.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* None.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
|
|
|
int tcp_wrbuffer_test(void);
|
|
|
|
#endif /* CONFIG_NET_TCP_WRITE_BUFFERS */
|
|
|
|
|
2014-06-22 19:27:57 +02:00
|
|
|
/****************************************************************************
|
2014-06-23 02:53:18 +02:00
|
|
|
* Function: tcp_wrbuffer_dump
|
2014-06-22 19:27:57 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Dump the contents of a write buffer.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
2016-06-11 22:14:08 +02:00
|
|
|
#ifdef CONFIG_DEBUG_FEATURES
|
2014-06-23 17:40:17 +02:00
|
|
|
void tcp_wrbuffer_dump(FAR const char *msg, FAR struct tcp_wrbuffer_s *wrb,
|
|
|
|
unsigned int len, unsigned int offset);
|
2014-06-22 19:27:57 +02:00
|
|
|
#else
|
2014-06-23 02:53:18 +02:00
|
|
|
# define tcp_wrbuffer_dump(msg,wrb)
|
2014-06-22 19:27:57 +02:00
|
|
|
#endif
|
2014-06-21 23:23:39 +02:00
|
|
|
#endif /* CONFIG_NET_TCP_WRITE_BUFFERS */
|
|
|
|
|
2015-01-30 14:25:01 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_pollsetup
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Setup to monitor events on one TCP/IP socket
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* psock - The TCP/IP socket of interest
|
|
|
|
* fds - The structure describing the events to be monitored, OR NULL if
|
|
|
|
* this is a request to stop monitoring events.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* 0: Success; Negated errno on failure
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef HAVE_TCP_POLL
|
|
|
|
int tcp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Function: tcp_pollteardown
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Teardown monitoring of events on an TCP/IP socket
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* psock - The TCP/IP socket of interest
|
|
|
|
* fds - The structure describing the events to be monitored, OR NULL if
|
|
|
|
* this is a request to stop monitoring events.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* 0: Success; Negated errno on failure
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef HAVE_TCP_POLL
|
|
|
|
int tcp_pollteardown(FAR struct socket *psock, FAR struct pollfd *fds);
|
|
|
|
#endif
|
|
|
|
|
2014-06-21 23:23:39 +02:00
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* CONFIG_NET_TCP */
|
|
|
|
#endif /* _NET_TCP_TCP_H */
|