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-2019 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 1.9.6
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  IpPseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset);
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: dtls_misc.h:149
void tcpStateTimeWait(Socket *socket, TcpHeader *segment, size_t length)
TIME-WAIT state.
Definition: tcp_fsm.c:1144
__start_packed struct @120 TcpHeader
TCP header.
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:88
void tcpStateClosed(NetInterface *interface, IpPseudoHeader *pseudoHeader, TcpHeader *segment, size_t length)
CLOSED state.
Definition: tcp_fsm.c:395
void tcpStateClosing(Socket *socket, TcpHeader *segment, size_t length)
CLOSING state.
Definition: tcp_fsm.c:1092
void tcpStateLastAck(Socket *socket, TcpHeader *segment, size_t length)
LAST-ACK state.
Definition: tcp_fsm.c:896
IP pseudo header.
Definition: ip.h:90
void tcpStateFinWait2(Socket *socket, TcpHeader *segment, const NetBuffer *buffer, size_t offset, size_t length)
FIN-WAIT-2 state.
Definition: tcp_fsm.c:1029
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:108
void tcpStateSynReceived(Socket *socket, TcpHeader *segment, const NetBuffer *buffer, size_t offset, size_t length)
SYN-RECEIVED state.
Definition: tcp_fsm.c:690
#define NetInterface
Definition: net.h:36
NetInterface * interface
Definition: tcp.h:375
void tcpStateListen(Socket *socket, NetInterface *interface, IpPseudoHeader *pseudoHeader, TcpHeader *segment, size_t length)
LISTEN state.
Definition: tcp_fsm.c:421
void tcpStateSynSent(Socket *socket, TcpHeader *segment, size_t length)
SYN-SENT state.
Definition: tcp_fsm.c:565
void tcpProcessSegment(NetInterface *interface, IpPseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset)
Incoming TCP segment processing.
Definition: tcp_fsm.c:73
TCP (Transmission Control Protocol)
void tcpStateCloseWait(Socket *socket, TcpHeader *segment, size_t length)
CLOSE-WAIT state.
Definition: tcp_fsm.c:840
#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:763
void tcpStateFinWait1(Socket *socket, TcpHeader *segment, const NetBuffer *buffer, size_t offset, size_t length)
FIN-WAIT-1 state.
Definition: tcp_fsm.c:944