diff options
author | Anton Kling <anton@kling.gg> | 2024-06-22 14:34:21 +0200 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-06-22 14:34:21 +0200 |
commit | 01b88a7bf9fb4c78bd632bfccb06f3d320a21fd5 (patch) | |
tree | 20d9a6dcc155e7c8b6e067c6ba6d7b42df4365fd /kernel/network/tcp.h | |
parent | af313dec6b7698b6f948b97669aa7be91717a451 (diff) |
Kernel stuff
Diffstat (limited to 'kernel/network/tcp.h')
-rw-r--r-- | kernel/network/tcp.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/kernel/network/tcp.h b/kernel/network/tcp.h index ec253bd..90975e4 100644 --- a/kernel/network/tcp.h +++ b/kernel/network/tcp.h @@ -1,9 +1,31 @@ #include <socket.h> #include <typedefs.h> -void tcp_send_syn(struct TcpConnection *con); -void tcp_wait_reply(struct TcpConnection *con); -void handle_tcp(ipv4_t src_ip, ipv4_t dst_ip, const u8 *payload, u32 payload_length); + +#define CWR (1 << 7) +#define ECE (1 << 6) +#define URG (1 << 5) +#define ACK (1 << 4) +#define PSH (1 << 3) +#define RST (1 << 2) +#define SYN (1 << 1) +#define FIN (1 << 0) + +#define TCP_STATE_CLOSED 0 +#define TCP_STATE_LISTEN 1 +#define TCP_STATE_SYN_SENT 2 +#define TCP_STATE_SYN_RECIEVED 3 +#define TCP_STATE_ESTABLISHED 4 +#define TCP_STATE_CLOSE_WAIT 5 +#define TCP_STATE_FIN_WAIT1 6 +#define TCP_STATE_CLOSING 7 +#define TCP_STATE_LAST_ACK 8 +#define TCP_STATE_FIN_WAIT2 9 +#define TCP_STATE_TIME_WAIT 10 + +void handle_tcp(ipv4_t src_ip, ipv4_t dst_ip, const u8 *payload, + u32 payload_length); int send_tcp_packet(struct TcpConnection *con, const u8 *payload, u16 payload_length); void tcp_close_connection(struct TcpConnection *con); u16 tcp_can_send(struct TcpConnection *con); +void tcp_send_empty_payload(struct TcpConnection *con, u8 flags); |