SayoriOS  0.3.3
tcp.h
1 //
2 // Created by ndraey on 21.4.2024.
3 //
4 
5 #pragma once
6 
7 #include "common.h"
8 #include "cards.h"
9 
10 typedef struct {
11  uint16_t source;
12  uint16_t destination;
13  uint32_t seq;
14  uint32_t ack_seq;
15  uint16_t res1:4;
16  uint16_t doff:4;
17  uint16_t fin:1;
18  uint16_t syn:1;
19  uint16_t rst:1;
20  uint16_t psh:1;
21  uint16_t ack:1;
22  uint16_t urg:1;
23  uint16_t res2:2;
24  uint16_t window;
25  uint16_t check;
26  uint16_t urg_ptr;
27 } tcp_packet_t;
28 
29 typedef enum {
30  TCP_NONE,
31  TCP_CREATED,
32  TCP_LISTENING,
33  TCP_ESTABLISHED
34 } tcp_connection_status_t;
35 
36 typedef struct {
37  netcard_entry_t* card;
38  uint32_t dest_ip_addr;
39  uint16_t source_port;
40  uint16_t dest_port;
41  uint32_t seq;
42  uint32_t ack;
43  tcp_connection_status_t status;
45 
46 void tcp_handle_packet(netcard_entry_t *card, tcp_packet_t *packet);
Основные определения ядра
Definition: cards.h:5