Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

tcp.h File Reference

tcp.h File Reference

TCP API (to be used from TCPIP thread)
See also TCP. More...

Go to the source code of this file.

Data Structures

struct  tcp_sack_range
 SACK ranges to include in ACK packets. More...
struct  tcp_ext_arg_callbacks
 A table of callback functions that is invoked for ext arguments. More...
struct  tcp_pcb_listen
 the TCP protocol control block for listening pcbs More...
struct  tcp_pcb
 the TCP protocol control block More...

Typedefs

typedef err_t(* tcp_accept_fn )(void *arg, struct tcp_pcb *newpcb, err_t err)
 Function prototype for tcp accept callback functions.
typedef err_t(* tcp_recv_fn )(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)
 Function prototype for tcp receive callback functions.
typedef err_t(* tcp_sent_fn )(void *arg, struct tcp_pcb *tpcb, u16_t len)
 Function prototype for tcp sent callback functions.
typedef err_t(* tcp_poll_fn )(void *arg, struct tcp_pcb *tpcb)
 Function prototype for tcp poll callback functions.
typedef void(* tcp_err_fn )(void *arg, err_t err)
 Function prototype for tcp error callback functions.
typedef err_t(* tcp_connected_fn )(void *arg, struct tcp_pcb *tpcb, err_t err)
 Function prototype for tcp connected callback functions.
typedef void(* tcp_extarg_callback_pcb_destroyed_fn )(u8_t id, void *data)
 Function prototype for deallocation of arguments.
typedef err_t(* tcp_extarg_callback_passive_open_fn )(u8_t id, struct tcp_pcb_listen *lpcb, struct tcp_pcb *cpcb)
 Function prototype to transition arguments from a listening pcb to an accepted pcb.

Functions

struct tcp_pcbtcp_new (void)
 Creates a new TCP protocol control block but doesn't place it on any of the TCP PCB lists.
struct tcp_pcbtcp_new_ip_type (u8_t type)
 Creates a new TCP protocol control block but doesn't place it on any of the TCP PCB lists.
void tcp_arg (struct tcp_pcb *pcb, void *arg)
 Specifies the program specific state that should be passed to all other callback functions.
void tcp_recv (struct tcp_pcb *pcb, tcp_recv_fn recv)
 Sets the callback function that will be called when new data arrives.
void tcp_sent (struct tcp_pcb *pcb, tcp_sent_fn sent)
 Specifies the callback function that should be called when data has successfully been received (i.e., acknowledged) by the remote host.
void tcp_err (struct tcp_pcb *pcb, tcp_err_fn err)
 Used to specify the function that should be called when a fatal error has occurred on the connection.
void tcp_accept (struct tcp_pcb *pcb, tcp_accept_fn accept)
 Used for specifying the function that should be called when a LISTENing connection has been connected to another host.
void tcp_poll (struct tcp_pcb *pcb, tcp_poll_fn poll, u8_t interval)
 Specifies the polling interval and the callback function that should be called to poll the application.
void tcp_backlog_delayed (struct tcp_pcb *pcb)
 Delay accepting a connection in respect to the listen backlog: the number of outstanding connections is increased until tcp_backlog_accepted() is called.
void tcp_backlog_accepted (struct tcp_pcb *pcb)
 A delayed-accept a connection is accepted (or closed/aborted): decreases the number of outstanding connections after calling tcp_backlog_delayed().
void tcp_recved (struct tcp_pcb *pcb, u16_t len)
 This function should be called by the application when it has processed the data.
err_t tcp_bind (struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
 Binds the connection to a local port number and IP address.
void tcp_bind_netif (struct tcp_pcb *pcb, const struct netif *netif)
 Binds the connection to a netif and IP address.
err_t tcp_connect (struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, tcp_connected_fn connected)
 Connects to another host.
struct tcp_pcbtcp_listen_with_backlog_and_err (struct tcp_pcb *pcb, u8_t backlog, err_t *err)
 Set the state of the connection to be LISTEN, which means that it is able to accept incoming connections.
struct tcp_pcbtcp_listen_with_backlog (struct tcp_pcb *pcb, u8_t backlog)
 Set the state of the connection to be LISTEN, which means that it is able to accept incoming connections.
void tcp_abort (struct tcp_pcb *pcb)
 Aborts the connection by sending a RST (reset) segment to the remote host.
err_t tcp_close (struct tcp_pcb *pcb)
 Closes the connection held by the PCB.
err_t tcp_shutdown (struct tcp_pcb *pcb, int shut_rx, int shut_tx)
 Causes all or part of a full-duplex connection of this PCB to be shut down.
err_t tcp_write (struct tcp_pcb *pcb, const void *dataptr, u16_t len, u8_t apiflags)
 Write data for sending (but does not send it immediately).
void tcp_setprio (struct tcp_pcb *pcb, u8_t prio)
 Sets the priority of a connection.
err_t tcp_output (struct tcp_pcb *pcb)
 Find out what we can send and send it.
u8_t tcp_ext_arg_alloc_id (void)
 Allocate an index to store data in ext_args member of struct tcp_pcb.
void tcp_ext_arg_set_callbacks (struct tcp_pcb *pcb, uint8_t id, const struct tcp_ext_arg_callbacks *const callbacks)
 Set callbacks for a given index of ext_args on the specified pcb.
void tcp_ext_arg_set (struct tcp_pcb *pcb, uint8_t id, void *arg)
 Set data for a given index of ext_args on the specified pcb.
void * tcp_ext_arg_get (const struct tcp_pcb *pcb, uint8_t id)
 Set data for a given index of ext_args on the specified pcb.

Detailed Description

TCP API (to be used from TCPIP thread)
See also TCP.

Definition in file lwipstack/lwip/src/include/lwip/tcp.h.


Typedef Documentation

typedef err_t(* tcp_accept_fn)(void *arg, struct tcp_pcb *newpcb, err_t err)

Function prototype for tcp accept callback functions.

Called when a new connection can be accepted on a listening pcb.

Parameters:
argAdditional argument to pass to the callback function (
See also:
tcp_arg())
Parameters:
newpcbThe new connection pcb
errAn error code if there has been an error accepting. Only return ERR_ABRT if you have called tcp_abort from within the callback function!

Definition at line 70 of file lwipstack/lwip/src/include/lwip/tcp.h.

typedef err_t(* tcp_connected_fn)(void *arg, struct tcp_pcb *tpcb, err_t err)

Function prototype for tcp connected callback functions.

Called when a pcb is connected to the remote side after initiating a connection attempt by calling tcp_connect().

Parameters:
argAdditional argument to pass to the callback function (
See also:
tcp_arg())
Parameters:
tpcbThe connection pcb which is connected
errAn unused error code, always ERR_OK currently ;-)
Note:
When a connection attempt fails, the error callback is currently called!

Definition at line 134 of file lwipstack/lwip/src/include/lwip/tcp.h.

typedef void(* tcp_err_fn)(void *arg, err_t err)

Function prototype for tcp error callback functions.

Called when the pcb receives a RST or is unexpectedly closed for any other reason.

Note:
The corresponding pcb is already freed when this callback is called!
Parameters:
argAdditional argument to pass to the callback function (
See also:
tcp_arg())
Parameters:
errError code to indicate why the pcb has been closed ERR_ABRT: aborted through tcp_abort or by a TCP timer ERR_RST: the connection was reset by the remote host

Definition at line 120 of file lwipstack/lwip/src/include/lwip/tcp.h.

typedef err_t(* tcp_extarg_callback_passive_open_fn)(u8_t id, struct tcp_pcb_listen *lpcb, struct tcp_pcb *cpcb)

Function prototype to transition arguments from a listening pcb to an accepted pcb.

Parameters:
idext arg id (allocated via tcp_ext_arg_alloc_id)
lpcbthe listening pcb accepting a connection
cpcbthe newly allocated connection pcb
Returns:
ERR_OK if OK, any error if connection should be dropped

Definition at line 182 of file lwipstack/lwip/src/include/lwip/tcp.h.

typedef void(* tcp_extarg_callback_pcb_destroyed_fn)(u8_t id, void *data)

Function prototype for deallocation of arguments.

Called *just before* the pcb is freed, so don't expect to be able to do anything with this pcb!

Parameters:
idext arg id (allocated via tcp_ext_arg_alloc_id)
datapointer to the data (set via tcp_ext_arg_set before)

Definition at line 173 of file lwipstack/lwip/src/include/lwip/tcp.h.

typedef err_t(* tcp_poll_fn)(void *arg, struct tcp_pcb *tpcb)

Function prototype for tcp poll callback functions.

Called periodically as specified by

See also:
tcp_poll.
Parameters:
argAdditional argument to pass to the callback function (
See also:
tcp_arg())
Parameters:
tpcbtcp pcb
Returns:
ERR_OK: try to send some data by calling tcp_output Only return ERR_ABRT if you have called tcp_abort from within the callback function!

Definition at line 108 of file lwipstack/lwip/src/include/lwip/tcp.h.

typedef err_t(* tcp_recv_fn)(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)

Function prototype for tcp receive callback functions.

Called when data has been received.

Parameters:
argAdditional argument to pass to the callback function (
See also:
tcp_arg())
Parameters:
tpcbThe connection pcb which received data
pThe received data (or NULL when the connection has been closed!)
errAn error code if there has been an error receiving Only return ERR_ABRT if you have called tcp_abort from within the callback function!

Definition at line 82 of file lwipstack/lwip/src/include/lwip/tcp.h.

typedef err_t(* tcp_sent_fn)(void *arg, struct tcp_pcb *tpcb, u16_t len)

Function prototype for tcp sent callback functions.

Called when sent data has been acknowledged by the remote side. Use it to free corresponding resources. This also means that the pcb has now space available to send new data.

Parameters:
argAdditional argument to pass to the callback function (
See also:
tcp_arg())
Parameters:
tpcbThe connection pcb for which data has been acknowledged
lenThe amount of bytes acknowledged
Returns:
ERR_OK: try to send some data by calling tcp_output Only return ERR_ABRT if you have called tcp_abort from within the callback function!

Definition at line 96 of file lwipstack/lwip/src/include/lwip/tcp.h.


Function Documentation

void tcp_setprio ( struct tcp_pcb pcb,
u8_t  prio 
)

Sets the priority of a connection.

Parameters:
pcbthe tcp_pcb to manipulate
prionew priority

Definition at line 1644 of file lwip_tcp.c.