Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

tcp.h File Reference

tcp.h File Reference

TCP (Transmission Control Protocol) More...

Go to the source code of this file.

Data Structures

struct  TcpTimer
 TCP timer. More...
struct  _TcpQueueItem
 Retransmission queue item. More...
struct  _TcpSynQueueItem
 SYN queue item. More...
struct  TcpSackBlock
 SACK block. More...
struct  TcpTxBuffer
 Transmit buffer. More...
struct  TcpRxBuffer
 Receive buffer. More...

Typedefs

typedef struct _TcpQueueItem TcpQueueItem
 Retransmission queue item.
typedef struct _TcpSynQueueItem TcpSynQueueItem
 SYN queue item.

Enumerations

enum  TcpState
 

TCP FSM states.

More...
enum  TcpCongestState
 

TCP congestion states.

More...
enum  TcpFlags
 

TCP control flags.

More...
enum  TcpOptionKind
 

TCP option types.

More...

Functions

error_t tcpInit (void)
 TCP related initialization.
uint16_t tcpGetDynamicPort (void)
 Get an ephemeral port number.
error_t tcpConnect (Socket *socket, const IpAddr *remoteIpAddr, uint16_t remotePort)
 Establish a TCP connection.
error_t tcpListen (Socket *socket, uint_t backlog)
 Place a socket in the listening state.
Socket * tcpAccept (Socket *socket, IpAddr *clientIpAddr, uint16_t *clientPort)
 Permit an incoming connection attempt on a TCP socket.
error_t tcpSend (Socket *socket, const uint8_t *data, size_t length, size_t *written, uint_t flags)
 Send data to a connected socket.
error_t tcpReceive (Socket *socket, uint8_t *data, size_t size, size_t *received, uint_t flags)
 Receive data from a connected socket.
error_t tcpShutdown (Socket *socket, uint_t how)
 Shutdown gracefully reception, transmission, or both.
error_t tcpAbort (Socket *socket)
 Abort an existing TCP connection.
TcpState tcpGetState (Socket *socket)
 Get the current state of the TCP FSM.
Socket * tcpKillOldestConnection (void)
 Kill the oldest socket in the TIME-WAIT state.

Detailed Description

TCP (Transmission Control Protocol)

License

Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author:
Oryx Embedded SARL (www.oryx-embedded.com)
Version:
1.7.6

Definition in file tcp.h.


Typedef Documentation

typedef struct _TcpQueueItem TcpQueueItem

Retransmission queue item.

SYN queue item.


Enumeration Type Documentation

TCP congestion states.

Definition at line 244 of file tcp.h.

enum TcpFlags

TCP control flags.

Definition at line 256 of file tcp.h.

TCP option types.

Definition at line 271 of file tcp.h.

enum TcpState

TCP FSM states.

Definition at line 224 of file tcp.h.


Function Documentation

error_t tcpAbort ( Socket *  socket )

Abort an existing TCP connection.

Parameters:
[in]socketHandle identifying the socket to close
Returns:
Error code

Definition at line 866 of file tcp.c.

Socket* tcpAccept ( Socket *  socket,
IpAddr clientIpAddr,
uint16_t *  clientPort 
)

Permit an incoming connection attempt on a TCP socket.

Parameters:
[in]socketHandle to a socket previously placed in a listening state
[out]clientIpAddrIP address of the client
[out]clientPortPort number used by the client
Returns:
Handle to the socket in which the actual connection is made

Definition at line 259 of file tcp.c.

error_t tcpConnect ( Socket *  socket,
const IpAddr remoteIpAddr,
uint16_t  remotePort 
)

Establish a TCP connection.

Parameters:
[in]socketHandle to an unconnected socket
[in]remoteIpAddrIP address of the remote host
[in]remotePortRemote port number that will be used to establish the connection
Returns:
Error code

Definition at line 112 of file tcp.c.

uint16_t tcpGetDynamicPort ( void   )

Get an ephemeral port number.

Returns:
Ephemeral port

Definition at line 72 of file tcp.c.

TcpState tcpGetState ( Socket *  socket )

Get the current state of the TCP FSM.

Parameters:
[in]socketHandle identifying the socket
Returns:
TCP FSM state

Definition at line 930 of file tcp.c.

error_t tcpInit ( void   )

TCP related initialization.

Returns:
Error code

Definition at line 57 of file tcp.c.

Socket* tcpKillOldestConnection ( void   )

Kill the oldest socket in the TIME-WAIT state.

Returns:
Handle identifying the oldest TCP connection in the TIME-WAIT state. NULL is returned if no socket is currently in the TIME-WAIT state

Definition at line 954 of file tcp.c.

error_t tcpListen ( Socket *  socket,
uint_t  backlog 
)

Place a socket in the listening state.

Place a socket in a state in which it is listening for an incoming connection

Parameters:
[in]socketSocket to place in the listening state
[in]backlogbacklog The maximum length of the pending connection queue. If this parameter is zero, then the default backlog value is used instead
Returns:
Error code

Definition at line 232 of file tcp.c.

error_t tcpReceive ( Socket *  socket,
uint8_t *  data,
size_t  size,
size_t *  received,
uint_t  flags 
)

Receive data from a connected socket.

Parameters:
[in]socketHandle that identifies a connected socket
[out]dataBuffer where to store the incoming data
[in]sizeMaximum number of bytes that can be received
[out]receivedNumber of bytes that have been received
[in]flagsSet of flags that influences the behavior of this function
Returns:
Error code

Definition at line 566 of file tcp.c.

error_t tcpSend ( Socket *  socket,
const uint8_t *  data,
size_t  length,
size_t *  written,
uint_t  flags 
)

Send data to a connected socket.

Parameters:
[in]socketHandle that identifies a connected socket
[in]dataPointer to a buffer containing the data to be transmitted
[in]lengthNumber of bytes to be transmitted
[out]writtenActual number of bytes written (optional parameter)
[in]flagsSet of flags that influences the behavior of this function
Returns:
Error code

Definition at line 442 of file tcp.c.

error_t tcpShutdown ( Socket *  socket,
uint_t  how 
)

Shutdown gracefully reception, transmission, or both.

Note that socketShutdown() does not close the socket, and resources attached to the socket will not be freed until socketClose() is invoked

Parameters:
[in]socketHandle to a socket
[in]howFlag that describes what types of operation will no longer be allowed
Returns:
Error code

Definition at line 714 of file tcp.c.