TCP (Transmission Control Protocol) More...
#include "core/net.h"
#include "core/socket.h"
#include "core/socket_misc.h"
#include "core/tcp.h"
#include "core/tcp_misc.h"
#include "core/tcp_timer.h"
#include "mibs/mib2_module.h"
#include "mibs/tcp_mib_module.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL TCP_TRACE_LEVEL |
Functions | |
error_t | tcpInit (void) |
TCP related initialization. More... | |
error_t | tcpSetInitialRto (NetInterface *interface, systime_t initialRto) |
Set TCP initial retransmission timeout. More... | |
uint16_t | tcpGetDynamicPort (void) |
Get an ephemeral port number. More... | |
error_t | tcpConnect (Socket *socket, const IpAddr *remoteIpAddr, uint16_t remotePort) |
Establish a TCP connection. More... | |
error_t | tcpListen (Socket *socket, uint_t backlog) |
Place a socket in the listening state. More... | |
Socket * | tcpAccept (Socket *socket, IpAddr *clientIpAddr, uint16_t *clientPort) |
Permit an incoming connection attempt on a TCP socket. More... | |
error_t | tcpSend (Socket *socket, const uint8_t *data, size_t length, size_t *written, uint_t flags) |
Send data to a connected socket. More... | |
error_t | tcpReceive (Socket *socket, uint8_t *data, size_t size, size_t *received, uint_t flags) |
Receive data from a connected socket. More... | |
error_t | tcpShutdown (Socket *socket, uint_t how) |
Shutdown gracefully reception, transmission, or both. More... | |
error_t | tcpAbort (Socket *socket) |
Abort an existing TCP connection. More... | |
TcpState | tcpGetState (Socket *socket) |
Get the current state of the TCP FSM. More... | |
Socket * | tcpKillOldestConnection (void) |
Kill the oldest socket in the TIME-WAIT state. More... | |
Variables | |
systime_t | tcpTickCounter |
Detailed Description
TCP (Transmission Control Protocol)
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 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.
- Version
- 2.4.4
Definition in file tcp.c.
Macro Definition Documentation
◆ TRACE_LEVEL
Function Documentation
◆ tcpAbort()
◆ tcpAccept()
Permit an incoming connection attempt on a TCP socket.
- Parameters
-
[in] socket Handle to a socket previously placed in a listening state [out] clientIpAddr IP address of the client [out] clientPort Port number used by the client
- Returns
- Handle to the socket in which the actual connection is made
◆ tcpConnect()
◆ tcpGetDynamicPort()
uint16_t tcpGetDynamicPort | ( | void | ) |
◆ tcpGetState()
◆ tcpInit()
error_t tcpInit | ( | void | ) |
◆ tcpKillOldestConnection()
Socket* tcpKillOldestConnection | ( | void | ) |
◆ tcpListen()
Place a socket in the listening state.
Place a socket in a state in which it is listening for an incoming connection
- Parameters
-
[in] socket Socket to place in the listening state [in] backlog backlog The maximum length of the pending connection queue. If this parameter is zero, then the default backlog value is used instead
- Returns
- Error code
◆ tcpReceive()
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] socket Handle that identifies a connected socket [out] data Buffer where to store the incoming data [in] size Maximum number of bytes that can be received [out] received Number of bytes that have been received [in] flags Set of flags that influences the behavior of this function
- Returns
- Error code
◆ tcpSend()
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] socket Handle that identifies a connected socket [in] data Pointer to a buffer containing the data to be transmitted [in] length Number of bytes to be transmitted [out] written Actual number of bytes written (optional parameter) [in] flags Set of flags that influences the behavior of this function
- Returns
- Error code
◆ tcpSetInitialRto()
error_t tcpSetInitialRto | ( | NetInterface * | interface, |
systime_t | initialRto | ||
) |
◆ tcpShutdown()
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] socket Handle to a socket [in] how Flag that describes what types of operation will no longer be allowed
- Returns
- Error code