|
Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
|
#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) |
| #define FLAG_ACK 0x10 |
Definition at line 15 of file tcp.c.
Referenced by handle_tcp(), and send_tcp_data().
| #define FLAG_FIN 0x01 |
Definition at line 11 of file tcp.c.
Referenced by handle_tcp(), and send_tcp_data().
| #define FLAG_PSH 0x08 |
Definition at line 14 of file tcp.c.
Referenced by handle_tcp(), and send_tcp_data().
| #define FLAG_SYN 0x02 |
Definition at line 12 of file tcp.c.
Referenced by handle_tcp().
| 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().
| void handle_tcp | ( | netdev_t * | dev, |
| struct ipv4_header * | ip, | ||
| uint8_t | mac_dst[6] ) |
Definition at line 18 of file tcp.c.
References FLAG_ACK, FLAG_FIN, FLAG_PSH, FLAG_SYN, flags, parse_tcp_options(), send_command(), send_tcp_data(), strncmp(), ipv4_header::total_length, ipv4_header::version_ihl, and vxNtohs().
Referenced by socket_receive().
| void parse_tcp_options | ( | struct tcp_header * | tcp, |
| tcp_options_t * | out ) |
Definition at line 214 of file tcp.c.
References tcp_options_t::has_timestamp, tcp_options_t::has_wscale, memset(), tcp_options_t::mss, tcp_options_t::sack_permitted, tcp_options_t::ts_ecr, tcp_options_t::ts_val, and tcp_options_t::wscale.
Referenced by handle_tcp().
| 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 at line 81 of file tcp.c.
References build_synack_options(), checksum16_raw(), create_netbuff(), dst_ip, ipv4_header::dst_ip, flags, free_netbuff(), ipv4_send(), memcopy(), netbuff_push(), protocol, ipv4_header::src_ip, src_ip, TCP_PROTOCOL, vxHtonl(), vxHtons(), vxNtohl(), vxRand(), and __attribute__::zero.
Referenced by handle_tcp().
| 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 at line 139 of file tcp.c.
References checksum16_raw(), create_netbuff(), data, dst_ip, ipv4_header::dst_ip, FLAG_ACK, FLAG_FIN, FLAG_PSH, free_netbuff(), ipv4_send(), len, memcopy(), netbuff_push(), netbuff_put(), protocol, ipv4_header::src_ip, src_ip, TCP_PROTOCOL, ipv4_header::total_length, ipv4_header::version_ihl, vxHtonl(), vxHtons(), vxNtohl(), vxNtohs(), and __attribute__::zero.
Referenced by handle_tcp().