|
Retro Rocket Kernel
BASIC-Powered Operating System
|
#include "kernel.h"Data Structures | |
| struct | tcp_ip_pseudo_header_t |
| union | tcp_segment_flags_t |
| struct | tcp_segment |
| struct | tcp_options_t |
| struct | tcp_ordered_list_t |
| struct | tcp_conn_t |
Macros | |
| #define | TCP_WINDOW_SIZE 65535 |
| #define | TCP_PACKET_SIZE_OFF 5 |
Functions | |
| struct tcp_ip_pseudo_header_t | __attribute__ ((packed)) tcp_ip_pseudo_header_t |
| void | tcp_handle_packet ([[maybe_unused]] ip_packet_t *encap_packet, tcp_segment_t *segment, size_t len) |
| TCP handler called by the IP layer. More... | |
| void | tcp_init () |
| Initialise TCP protocol, must happen after IP. More... | |
| int | connect (uint32_t target_addr, uint16_t target_port, uint16_t source_port, bool blocking) |
| Connect to a TCP port at a given IPv4 address. More... | |
| int | closesocket (int socket) |
| Close a TCP connection. More... | |
| int | send (int socket, const void *buffer, uint32_t length) |
| Send data to an open socket. More... | |
| int | recv (int socket, void *buffer, uint32_t maxlen, bool blocking, uint32_t timeout) |
| Receive data from an open socket. The data is buffered, and this function will fill the buffer when there is data in the buffer to read. More... | |
| bool | is_connected (int socket) |
| Returns true if the socket is connected. More... | |
| const char * | socket_error (int error_code) |
| Return the error description associated with an error code. More... | |
| void | tcp_idle () |
| Idle loop ran from timer ISR. More... | |
Variables | |
| typedef | __attribute__ |
| System Description Table Header. More... | |
| uint32_t | src |
| uint32_t | dst |
| uint8_t | reserved |
| uint8_t | protocol |
| uint16_t | len |
| uint8_t | body [] |
| uint8_t | bits1 |
| uint8_t | bits2 |
| struct { | |
| uint8_t reserved:4 | |
| uint8_t off:4 | |
| uint8_t fin:1 | |
| uint8_t syn:1 | |
| uint8_t rst:1 | |
| uint8_t psh:1 | |
| uint8_t ack:1 | |
| uint8_t urg:1 | |
| uint8_t ece:1 | |
| uint8_t cwr:1 | |
| }; | |
| uint16_t | src_port |
| uint16_t | dst_port |
| uint32_t | seq |
| tcp_segment_flags_t | flags |
| uint16_t | window_size |
| uint16_t | checksum |
| uint16_t | urgent |
| uint8_t | options [0] |
| uint8_t | payload [] |
| #define TCP_PACKET_SIZE_OFF 5 |
| #define TCP_WINDOW_SIZE 65535 |
| enum tcp_error_code_t |
Error codes which can be returned by socket functions.
| enum tcp_error_t |
| enum tcp_opt_t |
| enum tcp_port_type_t |
| enum tcp_state_flags_t |
| enum tcp_state_t |
| struct tcp_ip_pseudo_header_t __attribute__ | ( | (packed) | ) |
| int closesocket | ( | int | socket | ) |
Close a TCP connection.
| socket | socket descriptor to close |
| int connect | ( | uint32_t | target_addr, |
| uint16_t | target_port, | ||
| uint16_t | source_port, | ||
| bool | blocking | ||
| ) |
Connect to a TCP port at a given IPv4 address.
| target_addr | Target address to connect to |
| target_port | Target port to connect to |
| source_port | Our source port to use, or 0 to choose automatically |
| blocking | Set to true if this call is to block until the connection is established or errors |
| bool is_connected | ( | int | socket | ) |
| int recv | ( | int | socket, |
| void * | buffer, | ||
| uint32_t | maxlen, | ||
| bool | blocking, | ||
| uint32_t | timeout | ||
| ) |
Receive data from an open socket. The data is buffered, and this function will fill the buffer when there is data in the buffer to read.
| socket | socket descriptor from connect() |
| buffer | buffer to receive data to |
| maxlen | maximum size of data to receive to buffer |
| blocking | true if this call should block until the buffer has data |
| timeout | read timeout when blocking (seconds) |
| int send | ( | int | socket, |
| const void * | buffer, | ||
| uint32_t | length | ||
| ) |
Send data to an open socket.
| socket | socket descriptor from connect() |
| buffer | buffer to send |
| length | number of bytes to send |
| const char* socket_error | ( | int | error_code | ) |
Return the error description associated with an error code.
| error_code | error code |
| void tcp_handle_packet | ( | [[maybe_unused] ] ip_packet_t * | encap_packet, |
| tcp_segment_t * | segment, | ||
| size_t | len | ||
| ) |
TCP handler called by the IP layer.
| encap_packet | encapsulating IP packet |
| segment | TCP segment |
| len | length of TCP segment including header |
| void tcp_idle | ( | ) |
Idle loop ran from timer ISR.
| void tcp_init | ( | ) |
Initialise TCP protocol, must happen after IP.
| struct { ... } |
| enum tcp_opt_t __attribute__ |
System Description Table Header.
A disk partition table consisiting of four partition_t.
Structure for an IP packet.
Long filename entry, overlays a directory_entry_t. These entries repeat before a non-lfn entry, each holding up to 13 UCS-2 characters. Note that they are not stored in order, the 'order' attribute indicates which order they go in.
FAT32 BIOS parameter block (BPB), stored in the boot sector of the drive.
A directory entry, e.g. file, volume label, directory, long filename entry.
Root System Description Table.
| uint32_t ack |
| uint8_t bits1 |
| uint8_t bits2 |
| uint8_t body[] |
| uint16_t checksum |
| uint8_t cwr |
| uint32_t dst |
| uint16_t dst_port |
| uint8_t ece |
| uint8_t fin |
| tcp_segment_flags_t flags |
| uint16_t len |
| uint8_t off |
| uint8_t options[0] |
| uint8_t payload[] |
| uint8_t protocol |
| uint8_t psh |
| uint8_t reserved |
| uint8_t rst |
| uint32_t seq |
| uint32_t src |
| uint16_t src_port |
| uint8_t syn |
| uint8_t urg |
| uint16_t urgent |
| uint16_t window_size |