forked from pandax381/microps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tcp.h
46 lines (39 loc) · 1018 Bytes
/
tcp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef TCP_H
#define TCP_H
#include <stdint.h>
#include <sys/types.h>
#include "ip.h"
#define TCP_STATE_CLOSED 1
#define TCP_STATE_LISTEN 2
#define TCP_STATE_SYN_SENT 3
#define TCP_STATE_SYN_RECEIVED 4
#define TCP_STATE_ESTABLISHED 5
#define TCP_STATE_FIN_WAIT1 6
#define TCP_STATE_FIN_WAIT2 7
#define TCP_STATE_CLOSING 8
#define TCP_STATE_TIME_WAIT 9
#define TCP_STATE_CLOSE_WAIT 10
#define TCP_STATE_LAST_ACK 11
extern int
tcp_init(void);
extern int
tcp_open_rfc793(struct ip_endpoint *local, struct ip_endpoint *foreign, int active);
extern int
tcp_state(int id);
extern int
tcp_close(int id);
extern ssize_t
tcp_send(int id, uint8_t *data, size_t len);
extern ssize_t
tcp_receive(int id, uint8_t *buf, size_t size);
extern int
tcp_open(void);
extern int
tcp_bind(int id, struct ip_endpoint *local);
extern int
tcp_connect(int id, struct ip_endpoint *foreign);
extern int
tcp_listen(int id, int backlog);
extern int
tcp_accept(int id, struct ip_endpoint *foreign);
#endif