TCP module implementation. More...
#include <assert.h>
#include <async.h>
#include <fibril_synch.h>
#include <malloc.h>
#include <stdio.h>
#include <ipc/ipc.h>
#include <ipc/services.h>
#include "../../err.h"
#include "../../messages.h"
#include "../../modules.h"
#include "../../structures/dynamic_fifo.h"
#include "../../structures/packet/packet_client.h"
#include "../../include/checksum.h"
#include "../../include/in.h"
#include "../../include/in6.h"
#include "../../include/inet.h"
#include "../../include/ip_client.h"
#include "../../include/ip_interface.h"
#include "../../include/ip_protocols.h"
#include "../../include/icmp_client.h"
#include "../../include/icmp_interface.h"
#include "../../include/net_interface.h"
#include "../../include/socket_codes.h"
#include "../../include/socket_errno.h"
#include "../../include/tcp_codes.h"
#include "../../socket/socket_core.h"
#include "../../socket/socket_messages.h"
#include "../tl_common.h"
#include "../tl_messages.h"
#include "tcp.h"
#include "tcp_header.h"
#include "tcp_module.h"
Data Structures | |
struct | tcp_timeout |
TCP reply timeout data. More... | |
Defines | |
#define | NET_DEFAULT_TCP_WINDOW 10240 |
The TCP window default value. | |
#define | NET_DEFAULT_TCP_INITIAL_TIMEOUT 3000000L |
Initial timeout for new connections. | |
#define | NET_DEFAULT_TCP_TIME_WAIT_TIMEOUT 2000L |
Default timeout for closing. | |
#define | TCP_INITIAL_SEQUENCE_NUMBER 2999 |
The initial outgoing sequence number. | |
#define | MAX_TCP_FRAGMENT_SIZE 65535 |
Maximum TCP fragment size. | |
#define | TCP_FREE_PORTS_START 1025 |
Free ports pool start. | |
#define | TCP_FREE_PORTS_END 65535 |
Free ports pool end. | |
#define | TCP_SYN_SENT_TIMEOUT 1000000L |
Timeout for connection initialization, SYN sent. | |
#define | TCP_MAX_TIMEOUTS 8 |
The maximum number of timeouts in a row before singaling connection lost. | |
#define | TCP_FAST_RETRANSMIT_COUNT 3 |
The number of acknowledgements before retransmit. | |
#define | IS_IN_INTERVAL_OVERFLOW(lower, value, higher_equal) ((((lower) < (value)) && (((value) <= (higher_equal)) || ((higher_equal) < (lower)))) || (((value) <= (higher_equal)) && ((higher_equal) < (lower)))) |
Returns a value indicating whether the value is in the interval respecting the possible overflow. | |
Typedefs | |
typedef struct tcp_timeout | tcp_timeout_t |
Type definition of the TCP timeout. | |
typedef tcp_timeout_t * | tcp_timeout_ref |
Type definition of the TCP timeout pointer. | |
Functions | |
int | tcp_release_and_return (packet_t packet, int result) |
Releases the packet and returns the result. | |
void | tcp_prepare_operation_header (socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, int synchronize, int finalize) |
int | tcp_prepare_timeout (int(*timeout_function)(void *tcp_timeout_t), socket_core_ref socket, tcp_socket_data_ref socket_data, size_t sequence_number, tcp_socket_state_t state, suseconds_t timeout, int globals_read_only) |
void | tcp_free_socket_data (socket_core_ref socket) |
int | tcp_timeout (void *data) |
int | tcp_release_after_timeout (void *data) |
int | tcp_process_packet (device_id_t device_id, packet_t packet, services_t error) |
int | tcp_connect_core (socket_core_ref socket, socket_cores_ref local_sockets, struct sockaddr *addr, socklen_t addrlen) |
int | tcp_queue_prepare_packet (socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length) |
int | tcp_queue_packet (socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length) |
packet_t | tcp_get_packets_to_send (socket_core_ref socket, tcp_socket_data_ref socket_data) |
void | tcp_send_packets (device_id_t device_id, packet_t packet) |
void | tcp_process_acknowledgement (socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header) |
packet_t | tcp_send_prepare_packet (socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length, size_t sequence_number) |
packet_t | tcp_prepare_copy (socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length, size_t sequence_number) |
void | tcp_retransmit_packet (socket_core_ref socket, tcp_socket_data_ref socket_data, size_t sequence_number) |
int | tcp_create_notification_packet (packet_t *packet, socket_core_ref socket, tcp_socket_data_ref socket_data, int synchronize, int finalize) |
void | tcp_refresh_socket_data (tcp_socket_data_ref socket_data) |
void | tcp_initialize_socket_data (tcp_socket_data_ref socket_data) |
int | tcp_process_listen (socket_core_ref listening_socket, tcp_socket_data_ref listening_socket_data, tcp_header_ref header, packet_t packet, struct sockaddr *src, struct sockaddr *dest, size_t addrlen) |
int | tcp_process_syn_sent (socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet) |
int | tcp_process_syn_received (socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet) |
int | tcp_process_established (socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet, int fragments, size_t total_length) |
int | tcp_queue_received_packet (socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, int fragments, size_t total_length) |
int | tcp_received_msg (device_id_t device_id, packet_t packet, services_t receiver, services_t error) |
int | tcp_process_client_messages (ipc_callid_t callid, ipc_call_t call) |
int | tcp_listen_message (socket_cores_ref local_sockets, int socket_id, int backlog) |
int | tcp_connect_message (socket_cores_ref local_sockets, int socket_id, struct sockaddr *addr, socklen_t addrlen) |
int | tcp_recvfrom_message (socket_cores_ref local_sockets, int socket_id, int flags, size_t *addrlen) |
int | tcp_send_message (socket_cores_ref local_sockets, int socket_id, int fragments, size_t *data_fragment_size, int flags) |
int | tcp_accept_message (socket_cores_ref local_sockets, int socket_id, int new_socket_id, size_t *data_fragment_size, size_t *addrlen) |
int | tcp_close_message (socket_cores_ref local_sockets, int socket_id) |
int | tcp_initialize (async_client_conn_t client_connection) |
Initializes the TCP module. | |
int | tcp_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count) |
Processes the TCP message. | |
Variables | |
tcp_globals_t | tcp_globals |
TCP global data. |
TCP module implementation.