blob: 651bba084c6b304260a2a2e94bf43f553bd6f0c1 (
plain) (
blame)
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
|
// MIT License, Copyright (c) 2020 Marvin Borner
#ifndef SOCKET_H
#define SOCKET_H
#include <def.h>
// TODO: Use actual socket types (stream etc)
enum socket_type { S_TCP, S_UDP };
enum socket_state { S_CONNECTING, S_CONNECTED, S_OPEN, S_CLOSED, S_FAILED };
struct tcp_socket {
u32 seq_no;
u32 ack_no;
u32 state;
};
struct socket {
u32 ip_addr;
u32 dst_port;
u32 src_port;
enum socket_state state;
enum socket_type type;
u32 bytes_available;
u32 bytes_read;
void *current_packet;
union {
struct tcp_socket tcp;
/* struct udp_socket udp; */
} prot;
};
#endif
|