Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
tcp.h
Go to the documentation of this file.
1#ifndef __NET__TCP_H__
2#define __NET__TCP_H__
3
4#include "net/ipv4.h"
5#include "net/netdev.h"
6#include <type.h>
7
8struct __attribute__((packed)) tcp_header {
10 uint16_t destination_port;
12 uint32_t acknowledgment;
13
16
17 uint16_t window;
19 uint16_t urgent_ptr;
20} __attribute__((packed));
21
22void handle_tcp(netdev_t* dev, struct ipv4_header* ip, uint8_t mac_dst[6]);
23
33
34void send_tcp_data(netdev_t* dev, struct ipv4_header* ip,
35 struct tcp_header* tcp, uint8_t* data, size_t len,
36 uint8_t mac_dst[6]);
37
38void parse_tcp_options(struct tcp_header* tcp, tcp_options_t* out);
40build_synack_options(netdev_t* dev, uint8_t* buf, tcp_options_t* client_opts);
41
42void send_command(netdev_t* dev, struct ipv4_header* ip, struct tcp_header* tcp,
43 tcp_options_t* opt, uint8_t flags, uint8_t mac_dst[6]);
44
45#endif // __NET__TCP_H__
struct fs_data data
Definition filesystem.h:1
uint8_t checksum
Definition hpet.h:3
uint16_t flags
Definition thread.h:5
typedef __attribute__
Definition msi.c:47
uint16_t sequence
Definition icmp.h:5
struct netdev netdev_t
Definition netdev.h:19
size_t len
Definition oct2bin.h:7
uint16_t source_port
Definition udp.h:7
uint8_t wscale
Definition tcp.h:27
uint8_t has_wscale
Definition tcp.h:26
uint32_t ts_ecr
Definition tcp.h:31
uint8_t has_timestamp
Definition tcp.h:29
uint8_t sack_permitted
Definition tcp.h:28
uint16_t mss
Definition tcp.h:25
uint32_t ts_val
Definition tcp.h:30
void handle_tcp(netdev_t *dev, struct ipv4_header *ip, uint8_t mac_dst[6])
Definition tcp.c:18
void send_command(netdev_t *dev, struct ipv4_header *ip, struct tcp_header *tcp, tcp_options_t *opt, uint8_t flags, uint8_t mac_dst[6])
Definition tcp.c:81
void send_tcp_data(netdev_t *dev, struct ipv4_header *ip, struct tcp_header *tcp, uint8_t *data, size_t len, uint8_t mac_dst[6])
Definition tcp.c:139
uint8_t build_synack_options(netdev_t *dev, uint8_t *buf, tcp_options_t *client_opts)
Definition tcp.c:273
void parse_tcp_options(struct tcp_header *tcp, tcp_options_t *out)
Definition tcp.c:214
unsigned short uint16_t
Definition type.h:13
unsigned int uint32_t
Definition type.h:19
unsigned char uint8_t
Definition type.h:7
uint32_t offset
Definition virtio.h:6