diff options
author | Marvin Borner | 2020-11-03 21:09:34 +0100 |
---|---|---|
committer | Marvin Borner | 2020-11-03 21:09:34 +0100 |
commit | 5951024ab35e6cdd1ed6b97d76e28f1a253f6593 (patch) | |
tree | 52670f12af4a1274f9ce6e8a642ad055658255ed /kernel/inc | |
parent | 36bd8f09d359d176a2a1ca59864838269e887c4b (diff) |
Started TCP implementation
Diffstat (limited to 'kernel/inc')
-rw-r--r-- | kernel/inc/net.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/kernel/inc/net.h b/kernel/inc/net.h index 78aed51..f2fbb20 100644 --- a/kernel/inc/net.h +++ b/kernel/inc/net.h @@ -20,6 +20,16 @@ #define IP_PROT_TCP 0x06 #define IP_PROT_UDP 0x11 +#define TCP_FLAG_FIN (1 << 0) +#define TCP_FLAG_SYN (1 << 1) +#define TCP_FLAG_RES (1 << 2) +#define TCP_FLAG_PSH (1 << 3) +#define TCP_FLAG_ACK (1 << 4) +#define TCP_FLAG_URG (1 << 5) +#define TCP_FLAG_ECE (1 << 6) +#define TCP_FLAG_CWR (1 << 7) +#define TCP_FLAG_NS (1 << 8) + #define ARP_REQUEST 1 #define ARP_REPLY 2 @@ -91,6 +101,27 @@ struct udp_packet { u8 data[]; } __attribute__((packed)); +struct tcp_packet { + u16 src_port; + u16 dst_port; + u32 seq_number; + u32 ack_number; + u16 flags; + u16 window_size; + u16 checksum; + u16 urgent; + u8 data[]; +} __attribute__((packed)); + +struct tcp_pseudo_header { + u32 source; + u32 destination; + u8 zeros; + u8 protocol; + u16 tcp_len; + u8 tcp_header[]; +}; + struct icmp_packet { u8 type; u8 version; |