fsm.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2017 Simon Brummer
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
22 #ifndef FSM_H
23 #define FSM_H
24 
25 #include <stdint.h>
26 #include "net/gnrc/pkt.h"
27 #include "net/gnrc/tcp/tcb.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 typedef enum {
37  FSM_STATE_CLOSED = 0,
38  FSM_STATE_LISTEN,
39  FSM_STATE_SYN_SENT,
40  FSM_STATE_SYN_RCVD,
41  FSM_STATE_ESTABLISHED,
42  FSM_STATE_CLOSE_WAIT,
43  FSM_STATE_LAST_ACK,
44  FSM_STATE_FIN_WAIT_1,
45  FSM_STATE_FIN_WAIT_2,
46  FSM_STATE_CLOSING,
47  FSM_STATE_TIME_WAIT
48 } fsm_state_t;
49 
53 typedef enum {
54  FSM_EVENT_CALL_OPEN, /* User function call: open */
55  FSM_EVENT_CALL_SEND, /* User function call: send */
56  FSM_EVENT_CALL_RECV, /* User function call: recv */
57  FSM_EVENT_CALL_CLOSE, /* User function call: close */
58  FSM_EVENT_CALL_ABORT, /* User function call: abort */
59  FSM_EVENT_RCVD_PKT, /* Paket received from peer */
60  FSM_EVENT_TIMEOUT_TIMEWAIT, /* Timeout: timewait */
61  FSM_EVENT_TIMEOUT_RETRANSMIT, /* Timeout: retransmit */
62  FSM_EVENT_TIMEOUT_CONNECTION, /* Timeout: connection */
63  FSM_EVENT_SEND_PROBE, /* Send zero window probe */
64  FSM_EVENT_CLEAR_RETRANSMIT /* Clear retransmission mechanism */
65 } fsm_event_t;
66 
80 int _fsm(gnrc_tcp_tcb_t *tcb, fsm_event_t event, gnrc_pktsnip_t *in_pkt, void *buf, size_t len);
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif /* FSM_H */
87 
GNRC TCP transmission control block (TCB)
General definitions for network packets and their helper functions.
fsm_state_t
The TCP FSM states.
Definition: fsm.h:36
Transmission control block of GNRC TCP.
Definition: tcb.h:51
int _fsm(gnrc_tcp_tcb_t *tcb, fsm_event_t event, gnrc_pktsnip_t *in_pkt, void *buf, size_t len)
TCP finite state maschine.
fsm_event_t
Events that trigger transitions in TCP FSM.
Definition: fsm.h:53
Type to represent parts (either headers or payload) of a packet, called snips.