tcp_fsm.h
Go to the documentation of this file.
1 /**
2  * @file tcp_fsm.h
3  * @brief TCP finite state machine
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2023 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.2.4
29  **/
30 
31 #ifndef _TCP_FSM_H
32 #define _TCP_FSM_H
33 
34 //Dependencies
35 #include "core/tcp.h"
36 
37 //C++ guard
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 //TCP FSM related functions
44  const NetBuffer *buffer, size_t offset, NetRxAncillary *ancillary);
45 
47  IpPseudoHeader *pseudoHeader, TcpHeader *segment, size_t length);
48 
50  IpPseudoHeader *pseudoHeader, TcpHeader *segment, size_t length);
51 
52 void tcpStateSynSent(Socket *socket, TcpHeader *segment, size_t length);
53 
55  const NetBuffer *buffer, size_t offset, size_t length);
56 
58  const NetBuffer *buffer, size_t offset, size_t length);
59 
60 void tcpStateCloseWait(Socket *socket, TcpHeader *segment, size_t length);
61 
62 void tcpStateLastAck(Socket *socket, TcpHeader *segment, size_t length);
63 
64 void tcpStateFinWait1(Socket *socket, TcpHeader *segment,
65  const NetBuffer *buffer, size_t offset, size_t length);
66 
67 void tcpStateFinWait2(Socket *socket, TcpHeader *segment,
68  const NetBuffer *buffer, size_t offset, size_t length);
69 
70 void tcpStateClosing(Socket *socket, TcpHeader *segment, size_t length);
71 
72 void tcpStateTimeWait(Socket *socket, TcpHeader *segment, size_t length);
73 
74 //C++ guard
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #endif
uint8_t length
Definition: coap_common.h:193
void tcpStateTimeWait(Socket *socket, TcpHeader *segment, size_t length)
TIME-WAIT state.
Definition: tcp_fsm.c:1266
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
void tcpStateClosed(NetInterface *interface, IpPseudoHeader *pseudoHeader, TcpHeader *segment, size_t length)
CLOSED state.
Definition: tcp_fsm.c:433
void tcpStateClosing(Socket *socket, TcpHeader *segment, size_t length)
CLOSING state.
Definition: tcp_fsm.c:1214
void tcpStateLastAck(Socket *socket, TcpHeader *segment, size_t length)
LAST-ACK state.
Definition: tcp_fsm.c:1008
IP pseudo header.
Definition: ip.h:98
void tcpStateFinWait2(Socket *socket, TcpHeader *segment, const NetBuffer *buffer, size_t offset, size_t length)
FIN-WAIT-2 state.
Definition: tcp_fsm.c:1146
int_t socket(int_t family, int_t type, int_t protocol)
Create a socket that is bound to a specific transport service provider.
Definition: bsd_socket.c:63
void tcpStateSynReceived(Socket *socket, TcpHeader *segment, const NetBuffer *buffer, size_t offset, size_t length)
SYN-RECEIVED state.
Definition: tcp_fsm.c:792
#define NetRxAncillary
Definition: net_misc.h:40
#define NetInterface
Definition: net.h:36
NetInterface * interface
Definition: tcp.h:398
void tcpStateListen(Socket *socket, NetInterface *interface, IpPseudoHeader *pseudoHeader, TcpHeader *segment, size_t length)
LISTEN state.
Definition: tcp_fsm.c:461
void tcpStateSynSent(Socket *socket, TcpHeader *segment, size_t length)
SYN-SENT state.
Definition: tcp_fsm.c:645
__start_packed struct @0 TcpHeader
TCP header.
TCP (Transmission Control Protocol)
void tcpStateCloseWait(Socket *socket, TcpHeader *segment, size_t length)
CLOSE-WAIT state.
Definition: tcp_fsm.c:950
#define Socket
Definition: socket.h:36
void tcpStateEstablished(Socket *socket, TcpHeader *segment, const NetBuffer *buffer, size_t offset, size_t length)
ESTABLISHED state.
Definition: tcp_fsm.c:865
void tcpStateFinWait1(Socket *socket, TcpHeader *segment, const NetBuffer *buffer, size_t offset, size_t length)
FIN-WAIT-1 state.
Definition: tcp_fsm.c:1056
void tcpProcessSegment(NetInterface *interface, IpPseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset, NetRxAncillary *ancillary)
Incoming TCP segment processing.
Definition: tcp_fsm.c:75