OpenWSN Firmware
opentcp.h
Go to the documentation of this file.
1 #ifndef __OPENTCP_H
2 #define __OPENTCP_H
3 
11 #include "opentimers.h"
12 
13 //=========================== define ==========================================
14 
15 enum {
17  TCP_TIMEOUT = 1500, //in ms
18 };
19 
21  //listen state is not declared but emulated by a closed state with shouldIlisten==TRUE
43 };
44 
49 };
50 
55 };
56 
61 };
62 
67 };
68 
73 };
74 
79 };
80 
82  TCP_ACK = 4,
83  TCP_PSH = 3,
84  TCP_RST = 2,
85  TCP_SYN = 1,
86  TCP_FIN = 0,
87 };
88 
89 //=========================== typedef =========================================
90 
91 typedef struct {
92  uint16_t source_port;
93  uint16_t destination_port;
94  uint32_t sequence_number;
95  uint32_t ack_number;
96  uint8_t data_offset;
97  uint8_t control_bits;
98  uint16_t window_size;
99  uint16_t checksum;
100  uint16_t urgent_pointer;
101 } tcp_ht;
102 
103 //=========================== module variables ================================
104 
105 typedef struct {
106  uint8_t state;
107  uint32_t mySeqNum;
108  uint16_t myPort;
109  uint32_t hisNextSeqNum;
110  uint16_t hisPort;
116 } tcp_vars_t;
117 
118 //=========================== prototypes ======================================
119 
120 void opentcp_init(void);
121 owerror_t opentcp_connect(open_addr_t* dest, uint16_t param_hisPort, uint16_t param_myPort);
126 bool opentcp_debugPrint(void);
127 
133 #endif
Definition: opentcp.h:41
TCP_DEFAULTS_enum
Definition: opentcp.h:45
Definition: opentcp.h:66
TCP_FIN_FLAG_enum
Definition: opentcp.h:75
void opentcp_init()
Definition: opentcp.c:30
Definition: opentcp.h:30
Definition: opentcp.h:23
Definition: opentcp.h:70
Definition: opentcp.h:25
OpenQueueEntry_t * dataReceived
Definition: opentcp.h:113
TCP_ACK_FLAG_enum
Definition: opentcp.h:51
uint16_t destination_port
Definition: opentcp.h:93
bool opentcp_debugPrint(void)
Definition: opentcp.h:32
Definition: opentcp.h:59
Definition: opentcp.h:48
Definition: opentcp.h:27
uint32_t sequence_number
Definition: opentcp.h:94
owerror_t opentcp_send(OpenQueueEntry_t *msg)
Definition: opentcp.c:71
Definition: opentcp.h:76
uint16_t source_port
Definition: opentcp.h:92
Definition: opentcp.h:24
opentimer_id_t timerId
Definition: opentcp.h:115
Definition: opentcp.h:52
Definition: opentcp.h:35
Definition: opentcp.h:40
void opentcp_sendDone(OpenQueueEntry_t *msg, owerror_t error)
Definition: opentcp.c:104
Definition: opentcp.h:60
uint16_t checksum
Definition: opentcp.h:99
Definition: opentcp.h:78
Definition: opentcp.h:84
Definition: opentcp.h:77
Definition: opentcp.h:38
Definition: opentcp.h:28
Definition: opentcp.h:65
uint8_t owerror_t
Definition: openwsn.h:265
Definition: opentcp.h:22
TCP_STATE_enums
Definition: opentcp.h:20
Definition: opentcp.h:83
TCP_FLAG_POSITIONS_enum
Definition: opentcp.h:81
uint8_t state
Definition: opentcp.h:106
Definition: opentcp.h:91
OpenQueueEntry_t * dataToSend
Definition: opentcp.h:112
Definition: opentcp.h:86
uint16_t hisPort
Definition: opentcp.h:110
bool timerStarted
Definition: opentcp.h:114
Definition: opentcp.h:82
Definition: opentcp.h:85
open_addr_t hisIPv6Address
Definition: opentcp.h:111
Definition: opentcp.h:53
Definition: opentcp.h:33
TCP_PSH_FLAG_enum
Definition: opentcp.h:57
Definition: opentcp.h:29
owerror_t opentcp_connect(open_addr_t *dest, uint16_t param_tcp_hisPort, uint16_t param_tcp_myPort)
Definition: opentcp.c:37
#define opentimer_id_t
Definition: opentimers.h:28
TCP_RST_FLAG_enum
Definition: opentcp.h:63
uint8_t data_offset
Definition: opentcp.h:96
Definition: opentcp.h:34
Definition: openwsn.h:276
Definition: opentcp.h:54
Definition: opentcp.h:39
void opentcp_receive(OpenQueueEntry_t *msg)
Definition: opentcp.c:227
uint16_t window_size
Definition: opentcp.h:98
TCP_SYN_FLAG_enum
Definition: opentcp.h:69
Definition: opentcp.h:31
Definition: opentcp.h:105
Definition: opentcp.h:26
Definition: opentcp.h:17
uint8_t control_bits
Definition: opentcp.h:97
uint32_t ack_number
Definition: opentcp.h:95
uint32_t mySeqNum
Definition: opentcp.h:107
Definition: openwsn.h:288
uint16_t myPort
Definition: opentcp.h:108
owerror_t opentcp_close()
Definition: opentcp.c:618
Definition: opentcp.h:36
Definition: opentcp.h:42
uint32_t hisNextSeqNum
Definition: opentcp.h:109
Definition: opentcp.h:71
Definition: opentcp.h:64
Definition: opentcp.h:16
Definition: opentcp.h:46
Definition: opentcp.h:72
uint16_t urgent_pointer
Definition: opentcp.h:100
Definition: opentcp.h:37
Definition: opentcp.h:58
Definition: opentcp.h:47