Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
tcp.c File Reference
#include "tcp.h"
#include "libk/serial.h"
#include "net/ip_type.h"
#include "net/ipv4.h"
#include "net/netbuff.h"
#include "net/netdev.h"
#include "net/netutils.h"
#include <hal/rand/rand.h>
#include <str.h>

Go to the source code of this file.

Macros

#define FLAG_FIN   0x01
 
#define FLAG_SYN   0x02
 
#define FLAG_RST   0x04
 
#define FLAG_PSH   0x08
 
#define FLAG_ACK   0x10
 
#define FLAG_URG   0x20
 

Functions

void handle_tcp (netdev_t *dev, struct ipv4_header *ip, uint8_t mac_dst[6])
 
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])
 
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])
 
void parse_tcp_options (struct tcp_header *tcp, tcp_options_t *out)
 
uint8_t build_synack_options (netdev_t *dev, uint8_t *buf, tcp_options_t *client_opts)
 

Macro Definition Documentation

◆ FLAG_ACK

#define FLAG_ACK   0x10

Definition at line 15 of file tcp.c.

Referenced by handle_tcp(), and send_tcp_data().

◆ FLAG_FIN

#define FLAG_FIN   0x01

Definition at line 11 of file tcp.c.

Referenced by handle_tcp(), and send_tcp_data().

◆ FLAG_PSH

#define FLAG_PSH   0x08

Definition at line 14 of file tcp.c.

Referenced by handle_tcp(), and send_tcp_data().

◆ FLAG_RST

#define FLAG_RST   0x04

Definition at line 13 of file tcp.c.

◆ FLAG_SYN

#define FLAG_SYN   0x02

Definition at line 12 of file tcp.c.

Referenced by handle_tcp().

◆ FLAG_URG

#define FLAG_URG   0x20

Definition at line 16 of file tcp.c.

Function Documentation

◆ build_synack_options()

uint8_t build_synack_options ( netdev_t * dev,
uint8_t * buf,
tcp_options_t * client_opts )

Definition at line 273 of file tcp.c.

References tcp_options_t::mss, and netdev::mtu.

Referenced by send_command().

◆ handle_tcp()

void handle_tcp ( netdev_t * dev,
struct ipv4_header * ip,
uint8_t mac_dst[6] )

◆ parse_tcp_options()

void parse_tcp_options ( struct tcp_header * tcp,
tcp_options_t * out )

◆ send_command()

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] )

◆ send_tcp_data()