gnrc_tcp_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 
9 #pragma once
10 
22 #include <stdint.h>
23 #include "mbox.h"
24 #include "net/gnrc.h"
25 #include "net/gnrc/tcp/tcb.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
34 typedef enum {
35  FSM_STATE_CLOSED = 0,
36  FSM_STATE_LISTEN,
37  FSM_STATE_SYN_SENT,
38  FSM_STATE_SYN_RCVD,
39  FSM_STATE_ESTABLISHED,
40  FSM_STATE_CLOSE_WAIT,
41  FSM_STATE_LAST_ACK,
42  FSM_STATE_FIN_WAIT_1,
43  FSM_STATE_FIN_WAIT_2,
44  FSM_STATE_CLOSING,
45  FSM_STATE_TIME_WAIT
47 
51 typedef enum {
52  FSM_EVENT_CALL_OPEN, /* User function call: open */
53  FSM_EVENT_CALL_SEND, /* User function call: send */
54  FSM_EVENT_CALL_RECV, /* User function call: recv */
55  FSM_EVENT_CALL_CLOSE, /* User function call: close */
56  FSM_EVENT_CALL_ABORT, /* User function call: abort */
57  FSM_EVENT_RCVD_PKT, /* Packet received from peer */
58  FSM_EVENT_TIMEOUT_TIMEWAIT, /* Timeout: timewait */
59  FSM_EVENT_TIMEOUT_RETRANSMIT, /* Timeout: retransmit */
60  FSM_EVENT_TIMEOUT_CONNECTION, /* Timeout: connection */
61  FSM_EVENT_SEND_PROBE, /* Send zero window probe */
62  FSM_EVENT_CLEAR_RETRANSMIT /* Clear retransmission mechanism */
64 
79  gnrc_pktsnip_t *in_pkt, void *buf, size_t len);
80 
89 
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
Includes all essential GNRC network stack base modules.
_gnrc_tcp_fsm_state_t _gnrc_tcp_fsm_get_state(gnrc_tcp_tcb_t *tcb)
Get latest FSM state from given TCB.
void _gnrc_tcp_fsm_set_mbox(gnrc_tcp_tcb_t *tcb, mbox_t *mbox)
Associate mbox with tcb.
int _gnrc_tcp_fsm(gnrc_tcp_tcb_t *tcb, _gnrc_tcp_fsm_event_t event, gnrc_pktsnip_t *in_pkt, void *buf, size_t len)
TCP finite state machine.
_gnrc_tcp_fsm_event_t
Events that trigger transitions in TCP FSM.
Definition: gnrc_tcp_fsm.h:51
_gnrc_tcp_fsm_state_t
The TCP FSM states.
Definition: gnrc_tcp_fsm.h:34
Mailbox API.
event structure
Definition: event.h:145
Type to represent parts (either headers or payload) of a packet, called snips.
Definition: pkt.h:108
Mailbox struct definition.
Definition: mbox.h:40
TCP sock type.
Definition: sock_types.h:101
GNRC TCP transmission control block (TCB)