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  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneTCP Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 #ifndef _TCP_FSM_H
30 #define _TCP_FSM_H
31 
32 //Dependencies
33 #include "core/tcp.h"
34 
35 //C++ guard
36 #ifdef __cplusplus
37  extern "C" {
38 #endif
39 
40 //TCP FSM related functions
42  IpPseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset);
43 
45  IpPseudoHeader *pseudoHeader, TcpHeader *segment, size_t length);
46 
48  IpPseudoHeader *pseudoHeader, TcpHeader *segment, size_t length);
49 
50 void tcpStateSynSent(Socket *socket, TcpHeader *segment, size_t length);
51 
53  const NetBuffer *buffer, size_t offset, size_t length);
54 
56  const NetBuffer *buffer, size_t offset, size_t length);
57 
58 void tcpStateCloseWait(Socket *socket, TcpHeader *segment, size_t length);
59 
60 void tcpStateLastAck(Socket *socket, TcpHeader *segment, size_t length);
61 
62 void tcpStateFinWait1(Socket *socket, TcpHeader *segment,
63  const NetBuffer *buffer, size_t offset, size_t length);
64 
65 void tcpStateFinWait2(Socket *socket, TcpHeader *segment,
66  const NetBuffer *buffer, size_t offset, size_t length);
67 
68 void tcpStateClosing(Socket *socket, TcpHeader *segment, size_t length);
69 
70 void tcpStateTimeWait(Socket *socket, TcpHeader *segment, size_t length);
71 
72 //C++ guard
73 #ifdef __cplusplus
74  }
75 #endif
76 
77 #endif
void tcpStateTimeWait(Socket *socket, TcpHeader *segment, size_t length)
TIME-WAIT state.
Definition: tcp_fsm.c:1139
void tcpStateLastAck(Socket *socket, TcpHeader *segment, size_t length)
LAST-ACK state.
Definition: tcp_fsm.c:891
void tcpProcessSegment(NetInterface *interface, IpPseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset)
Incoming TCP segment processing.
Definition: tcp_fsm.c:70
NetInterface * interface
Definition: tcp.h:373
void tcpStateClosed(NetInterface *interface, IpPseudoHeader *pseudoHeader, TcpHeader *segment, size_t length)
CLOSED state.
Definition: tcp_fsm.c:392
__start_packed struct @124 TcpHeader
TCP header.
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:106
#define Socket
Definition: socket.h:34
void tcpStateEstablished(Socket *socket, TcpHeader *segment, const NetBuffer *buffer, size_t offset, size_t length)
ESTABLISHED state.
Definition: tcp_fsm.c:758
void tcpStateSynSent(Socket *socket, TcpHeader *segment, size_t length)
SYN-SENT state.
Definition: tcp_fsm.c:562
void tcpStateFinWait1(Socket *socket, TcpHeader *segment, const NetBuffer *buffer, size_t offset, size_t length)
FIN-WAIT-1 state.
Definition: tcp_fsm.c:939
void tcpStateCloseWait(Socket *socket, TcpHeader *segment, size_t length)
CLOSE-WAIT state.
Definition: tcp_fsm.c:835
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:86
void tcpStateSynReceived(Socket *socket, TcpHeader *segment, const NetBuffer *buffer, size_t offset, size_t length)
SYN-RECEIVED state.
Definition: tcp_fsm.c:686
#define NetInterface
Definition: net.h:34
IP pseudo header.
Definition: ip.h:76
void tcpStateClosing(Socket *socket, TcpHeader *segment, size_t length)
CLOSING state.
Definition: tcp_fsm.c:1087
void tcpStateListen(Socket *socket, NetInterface *interface, IpPseudoHeader *pseudoHeader, TcpHeader *segment, size_t length)
LISTEN state.
Definition: tcp_fsm.c:418
uint8_t length
Definition: dtls_misc.h:140
TCP (Transmission Control Protocol)
void tcpStateFinWait2(Socket *socket, TcpHeader *segment, const NetBuffer *buffer, size_t offset, size_t length)
FIN-WAIT-2 state.
Definition: tcp_fsm.c:1024