|
Data Structures | |
| struct | tcp_timeout |
| TCP reply timeout data. More... | |
| struct | tcp_operation |
| TCP operation data. More... | |
| struct | tcp_socket_data |
| TCP socket specific data. More... | |
| struct | tcp_globals |
| TCP global data. More... | |
| struct | tcp_header |
| Transmission datagram header. More... | |
| struct | tcp_option |
| Transmission datagram header option. More... | |
| struct | tcp_max_segment_size_option |
| Maximum segment size TCP option. More... | |
Files | |
| file | tcp_codes.h |
TCP options definitions. | |
| file | tcp.c |
TCP module implementation. | |
| file | tcp.h |
TCP module. | |
| file | tcp_header.h |
TCP header definition. | |
| file | tcp_module.c |
TCP standalone module implementation. | |
| file | tcp_module.h |
TCP module functions. | |
Defines | |
| #define | TCPOPT_END_OF_LIST 0x0 |
| End of list TCP option. | |
| #define | TCPOPT_NO_OPERATION 0x1 |
| No operation TCP option. | |
| #define | TCPOPT_MAX_SEGMENT_SIZE 0x2 |
| Maximum segment size TCP option. | |
| #define | TCPOPT_MAX_SEGMENT_SIZE_LENGTH 4 |
| Maximum segment size TCP option length. | |
| #define | TCPOPT_WINDOW_SCALE 0x3 |
| Window scale TCP option. | |
| #define | TCPOPT_WINDOW_SCALE_LENGTH 3 |
| Window scale TCP option length. | |
| #define | TCPOPT_SACK_PERMITTED 0x4 |
| Selective acknowledgement permitted TCP option. | |
| #define | TCPOPT_SACK_PERMITTED_LENGTH 2 |
| Selective acknowledgement permitted TCP option length. | |
| #define | TCPOPT_SACK 0x5 |
| Selective acknowledgement TCP option. | |
| #define | TCPOPT_TIMESTAMP 0x8 |
| Timestamp TCP option. | |
| #define | TCPOPT_TIMESTAMP_LENGTH 10 |
| Timestamp TCP option length. | |
| #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. | |
| #define | TCP_HEADER_SIZE sizeof(tcp_header_t) |
| TCP header size in bytes. | |
| #define | TCP_HEADER_LENGTH(header) ((header)->header_length * 4u) |
| Returns the actual TCP header length in bytes. | |
| #define | TCP_COMPUTE_HEADER_LENGTH(length) ((uint8_t) ((length) / 4u)) |
| Returns the TCP header length. | |
| #define | NAME "TCP protocol" |
| TCP module name. | |
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. | |
| typedef struct tcp_globals | tcp_globals_t |
| Type definition of the TCP global data. | |
| typedef struct tcp_socket_data | tcp_socket_data_t |
| Type definition of the TCP socket specific data. | |
| typedef tcp_socket_data_t * | tcp_socket_data_ref |
| Type definition of the TCP socket specific data pointer. | |
| typedef struct tcp_operation | tcp_operation_t |
| Type definition of the TCP operation data. | |
| typedef tcp_operation_t * | tcp_operation_ref |
| Type definition of the TCP operation data pointer. | |
| typedef enum tcp_socket_state | tcp_socket_state_t |
| TCP socket state type definition. | |
| typedef struct tcp_header | tcp_header_t |
| Type definition of the transmission datagram header. | |
| typedef tcp_header_t * | tcp_header_ref |
| Type definition of the transmission datagram header pointer. | |
| typedef struct tcp_option | tcp_option_t |
| Type definition of the transmission datagram header option. | |
| typedef tcp_option_t * | tcp_option_ref |
| Type definition of the transmission datagram header option pointer. | |
| typedef struct tcp_max_segment_size_option | tcp_max_segment_size_option_t |
| Type definition of the Maximum segment size TCP option. | |
| typedef tcp_max_segment_size_option_t * | tcp_max_segment_size_option_ref |
| Type definition of the Maximum segment size TCP option pointer. | |
Enumerations | |
| enum | tcp_socket_state { TCP_SOCKET_INITIAL, TCP_SOCKET_LISTEN, TCP_SOCKET_SYN_SENT, TCP_SOCKET_SYN_RECEIVED, TCP_SOCKET_ESTABLISHED, TCP_SOCKET_FIN_WAIT_1, TCP_SOCKET_FIN_WAIT_2, TCP_SOCKET_CLOSING, TCP_SOCKET_CLOSE_WAIT, TCP_SOCKET_LAST_ACK, TCP_SOCKET_TIME_WAIT, TCP_SOCKET_CLOSED } |
TCP socket state. More... | |
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. | |
| void | module_print_name (void) |
| Prints the module name. | |
| int | module_start (async_client_conn_t client_connection) |
| Starts the TCP module. | |
| int | module_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_globals_t | tcp_globals |
| TCP module global data. | |
| #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.
The high end and/or the value may overflow, be lower than the low value.
| [in] | lower | The last value before the interval. |
| [in] | value | The value to be checked. |
| [in] | higher_equal | The last value in the interval. |
Referenced by tcp_get_packets_to_send(), tcp_process_acknowledgement(), and tcp_process_established().
| #define MAX_TCP_FRAGMENT_SIZE 65535 |
Maximum TCP fragment size.
Referenced by tcp_initialize_socket_data().
| #define NAME "TCP protocol" |
TCP module name.
| #define NET_DEFAULT_TCP_INITIAL_TIMEOUT 3000000L |
Initial timeout for new connections.
Referenced by tcp_connect_core(), and tcp_refresh_socket_data().
| #define NET_DEFAULT_TCP_TIME_WAIT_TIMEOUT 2000L |
Default timeout for closing.
Referenced by tcp_process_acknowledgement().
| #define NET_DEFAULT_TCP_WINDOW 10240 |
The TCP window default value.
Referenced by tcp_refresh_socket_data().
| #define TCP_COMPUTE_HEADER_LENGTH | ( | length | ) | ((uint8_t) ((length) / 4u)) |
Returns the TCP header length.
| [in] | length | The TCP header length in bytes. |
Referenced by tcp_prepare_operation_header().
| #define TCP_FAST_RETRANSMIT_COUNT 3 |
The number of acknowledgements before retransmit.
Referenced by tcp_process_acknowledgement().
| #define TCP_FREE_PORTS_END 65535 |
Free ports pool end.
Referenced by tcp_connect_core(), and tcp_process_client_messages().
| #define TCP_FREE_PORTS_START 1025 |
Free ports pool start.
Referenced by tcp_connect_core(), and tcp_process_client_messages().
| #define TCP_HEADER_LENGTH | ( | header | ) | ((header)->header_length * 4u) |
Returns the actual TCP header length in bytes.
| [in] | header | The TCP packet header. |
Referenced by tcp_process_established().
| #define TCP_HEADER_SIZE sizeof(tcp_header_t) |
TCP header size in bytes.
Referenced by tcp_create_notification_packet(), tcp_process_client_messages(), tcp_process_packet(), tcp_process_syn_received(), and tcp_send_message().
| #define TCP_INITIAL_SEQUENCE_NUMBER 2999 |
The initial outgoing sequence number.
Referenced by tcp_refresh_socket_data().
| #define TCP_MAX_TIMEOUTS 8 |
The maximum number of timeouts in a row before singaling connection lost.
Referenced by tcp_timeout().
| #define TCP_SYN_SENT_TIMEOUT 1000000L |
Timeout for connection initialization, SYN sent.
| #define TCPOPT_END_OF_LIST 0x0 |
End of list TCP option.
| #define TCPOPT_MAX_SEGMENT_SIZE 0x2 |
Maximum segment size TCP option.
| #define TCPOPT_MAX_SEGMENT_SIZE_LENGTH 4 |
Maximum segment size TCP option length.
| #define TCPOPT_NO_OPERATION 0x1 |
No operation TCP option.
| #define TCPOPT_SACK 0x5 |
Selective acknowledgement TCP option.
Has variable length.
| #define TCPOPT_SACK_PERMITTED 0x4 |
Selective acknowledgement permitted TCP option.
| #define TCPOPT_SACK_PERMITTED_LENGTH 2 |
Selective acknowledgement permitted TCP option length.
| #define TCPOPT_TIMESTAMP 0x8 |
Timestamp TCP option.
| #define TCPOPT_TIMESTAMP_LENGTH 10 |
Timestamp TCP option length.
| #define TCPOPT_WINDOW_SCALE 0x3 |
Window scale TCP option.
| #define TCPOPT_WINDOW_SCALE_LENGTH 3 |
Window scale TCP option length.
| typedef struct tcp_globals tcp_globals_t |
Type definition of the TCP global data.
| typedef tcp_header_t* tcp_header_ref |
Type definition of the transmission datagram header pointer.
| typedef struct tcp_header tcp_header_t |
Type definition of the transmission datagram header.
Type definition of the Maximum segment size TCP option pointer.
| typedef struct tcp_max_segment_size_option tcp_max_segment_size_option_t |
Type definition of the Maximum segment size TCP option.
| typedef tcp_operation_t* tcp_operation_ref |
Type definition of the TCP operation data pointer.
| typedef struct tcp_operation tcp_operation_t |
Type definition of the TCP operation data.
| typedef tcp_option_t* tcp_option_ref |
Type definition of the transmission datagram header option pointer.
| typedef struct tcp_option tcp_option_t |
Type definition of the transmission datagram header option.
| typedef tcp_socket_data_t* tcp_socket_data_ref |
Type definition of the TCP socket specific data pointer.
| typedef struct tcp_socket_data tcp_socket_data_t |
Type definition of the TCP socket specific data.
| typedef enum tcp_socket_state tcp_socket_state_t |
TCP socket state type definition.
| typedef tcp_timeout_t* tcp_timeout_ref |
Type definition of the TCP timeout pointer.
| typedef struct tcp_timeout tcp_timeout_t |
Type definition of the TCP timeout.
| enum tcp_socket_state |
TCP socket state.
| TCP_SOCKET_INITIAL |
Initial. Not connected or bound. |
| TCP_SOCKET_LISTEN |
Listening. Awaiting a connection request from another TCP layer. When SYN is received a new bound socket in the TCP_SOCKET_SYN_RECEIVED state should be created. |
| TCP_SOCKET_SYN_SENT |
Connecting issued. A~SYN has been sent, and TCP is awaiting the response SYN. Should continue to the TCP_SOCKET_ESTABLISHED state. |
| TCP_SOCKET_SYN_RECEIVED |
Connecting received. A~SYN has been received, a~SYN has been sent, and TCP is awaiting an ACK. Should continue to the TCP_SOCKET_ESTABLISHED state. |
| TCP_SOCKET_ESTABLISHED |
Connected. The three-way handshake has been completed. |
| TCP_SOCKET_FIN_WAIT_1 |
Closing started. The local application has issued a~CLOSE. TCP has sent a~FIN, and is awaiting an ACK or a~FIN. Should continue to the TCP_SOCKET_FIN_WAIT_2 state when an ACK is received. Should continue to the TCP_SOCKET_CLOSING state when a~FIN is received. |
| TCP_SOCKET_FIN_WAIT_2 |
Closing confirmed. A~FIN has been sent, and an ACK received. TCP is awaiting a~FIN from the remote TCP layer. Should continue to the TCP_SOCKET_CLOSING state. |
| TCP_SOCKET_CLOSING |
Closing. A FIN has been sent, a FIN has been received, and an ACK has been sent. TCP is awaiting an ACK for the FIN that was sent. Should continue to the TCP_SOCKET_TIME_WAIT state. |
| TCP_SOCKET_CLOSE_WAIT |
Closing received. TCP has received a~FIN, and has sent an ACK. It is awaiting a~close request from the local application before sending a~FIN. Should continue to the TCP_SOCKET_SOCKET_LAST_ACK state. |
| TCP_SOCKET_LAST_ACK |
A~FIN has been received, and an ACK and a~FIN have been sent. TCP is awaiting an ACK. Should continue to the TCP_SOCKET_TIME_WAIT state. |
| TCP_SOCKET_TIME_WAIT |
Closing finished. FINs have been received and ACK’d, and TCP is waiting two MSLs to remove the connection from the table. |
| TCP_SOCKET_CLOSED |
Closed. Imaginary, this indicates that a~connection has been removed from the connection table. |
| int module_message | ( | ipc_callid_t | callid, | |
| ipc_call_t * | call, | |||
| ipc_call_t * | answer, | |||
| int * | answer_count | |||
| ) |
Processes the TCP message.
| [in] | callid | The message identifier. |
| [in] | call | The message parameters. |
| [out] | answer | The message answer parameters. |
| [out] | answer_count | The last parameter for the actual answer in the answer parameter. |
References tcp_message().

| int module_start | ( | async_client_conn_t | client_connection | ) |
Starts the TCP module.
Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
| [in] | client_connection | The client connection processing function. The module skeleton propagates its own one. |
References ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, net_connect_module(), tcp_globals::net_phone, pm_destroy(), pm_init(), REGISTER_ME, and tcp_initialize().

| int tcp_accept_message | ( | socket_cores_ref | local_sockets, | |
| int | socket_id, | |||
| int | new_socket_id, | |||
| size_t * | data_fragment_size, | |||
| size_t * | addrlen | |||
| ) |
References socket_core::accepted, tcp_socket_data::addr, tcp_socket_data::addrlen, packet_dimension::content, tcp_socket_data::data_fragment_size, data_reply(), tcp_socket_data::device_id, tcp_globals::dimensions, dyn_fifo_pop(), dyn_fifo_value(), ENOTSOCK, ERROR_DECLARE, ERROR_PROPAGATE, tcp_globals::ip_phone, socket_core::socket_id, socket_core::specific_data, tcp_socket_data::state, TCP_SOCKET_ESTABLISHED, TCP_SOCKET_LISTEN, and tl_get_ip_packet_dimension().
Referenced by tcp_process_client_messages().


| int tcp_close_message | ( | socket_cores_ref | local_sockets, | |
| int | socket_id | |||
| ) |
References tcp_socket_data::device_id, ENOTSOCK, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, tcp_socket_data::local_lock, tcp_globals::lock, tcp_globals::net_phone, socket_destroy(), tcp_globals::sockets, socket_core::specific_data, tcp_socket_data::state, tcp_create_notification_packet(), tcp_free_socket_data(), tcp_get_packets_to_send(), tcp_queue_packet(), tcp_send_packets(), TCP_SOCKET_CLOSE_WAIT, TCP_SOCKET_ESTABLISHED, TCP_SOCKET_FIN_WAIT_1, and TCP_SOCKET_LAST_ACK.
Referenced by tcp_process_client_messages().


| int tcp_connect_core | ( | socket_core_ref | socket, | |
| socket_cores_ref | local_sockets, | |||
| struct sockaddr * | addr, | |||
| socklen_t | addrlen | |||
| ) |
References tcp_socket_data::addr, tcp_socket_data::addrlen, tcp_operation::condvar, tcp_socket_data::dest_port, tcp_socket_data::device_id, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, tcp_socket_data::headerlen, ip_get_route_req(), tcp_globals::ip_phone, IPPROTO_TCP, tcp_globals::last_used_port, tcp_socket_data::local_lock, tcp_globals::lock, tcp_operation::mutex, NET_DEFAULT_TCP_INITIAL_TIMEOUT, tcp_socket_data::operation, packet_get_id(), socket_core::port, tcp_socket_data::pseudo_header, tcp_operation::result, socket_bind_free_port(), tcp_globals::sockets, socket_core::specific_data, tcp_socket_data::state, tcp_create_notification_packet(), TCP_FREE_PORTS_END, TCP_FREE_PORTS_START, tcp_get_packets_to_send(), tcp_prepare_timeout(), tcp_queue_packet(), tcp_send_packets(), TCP_SOCKET_INITIAL, TCP_SOCKET_LISTEN, and tl_get_address_port().
Referenced by tcp_connect_message().


| int tcp_connect_message | ( | socket_cores_ref | local_sockets, | |
| int | socket_id, | |||
| struct sockaddr * | addr, | |||
| socklen_t | addrlen | |||
| ) |
References ENOTSOCK, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, socket_core::port, tcp_globals::sockets, tcp_connect_core(), and tcp_free_socket_data().
Referenced by tcp_process_client_messages().


| int tcp_create_notification_packet | ( | packet_t * | packet, | |
| socket_core_ref | socket, | |||
| tcp_socket_data_ref | socket_data, | |||
| int | synchronize, | |||
| int | finalize | |||
| ) |
References packet_dimension::addr_len, tcp_socket_data::device_id, tcp_globals::dimensions, ERROR_DECLARE, ERROR_PROPAGATE, tcp_globals::ip_phone, tcp_globals::net_phone, packet_get_4(), PACKET_SUFFIX, packet_dimension::prefix, packet_dimension::suffix, TCP_HEADER_SIZE, tcp_prepare_operation_header(), tcp_release_and_return(), and tl_get_ip_packet_dimension().
Referenced by tcp_close_message(), tcp_connect_core(), tcp_process_established(), and tcp_process_syn_received().


| void tcp_free_socket_data | ( | socket_core_ref | socket | ) |
References tcp_socket_data::addr, tcp_socket_data::addrlen, free, tcp_socket_data::headerlen, tcp_socket_data::pseudo_header, socket_core::socket_id, and socket_core::specific_data.
Referenced by tcp_close_message(), tcp_connect_message(), tcp_process_client_messages(), tcp_process_listen(), and tcp_release_after_timeout().

| packet_t tcp_get_packets_to_send | ( | socket_core_ref | socket, | |
| tcp_socket_data_ref | socket_data | |||
| ) |
References ERROR_DECLARE, ERROR_OCCURRED, tcp_socket_data::expected, IS_IN_INTERVAL_OVERFLOW, tcp_socket_data::last_outgoing, tcp_globals::net_phone, tcp_socket_data::next_outgoing, tcp_socket_data::outgoing, packet_get_id(), pq_find(), pq_get_order(), pq_insert_after(), pq_next(), pq_release(), socket_core::specific_data, tcp_prepare_copy(), and tcp_socket_data::treshold.
Referenced by tcp_close_message(), tcp_connect_core(), tcp_process_established(), tcp_process_listen(), tcp_process_syn_received(), tcp_process_syn_sent(), and tcp_send_message().


| int tcp_initialize | ( | async_client_conn_t | client_connection | ) |
Initializes the TCP module.
| [in] | client_connection | The client connection processing function. The module skeleton propagates its own one. |
Referenced by module_start().

| void tcp_initialize_socket_data | ( | tcp_socket_data_ref | socket_data | ) |
References tcp_operation::condvar, tcp_socket_data::data_fragment_size, MAX_TCP_FRAGMENT_SIZE, tcp_operation::mutex, tcp_socket_data::operation, and tcp_refresh_socket_data().
Referenced by tcp_process_client_messages(), and tcp_process_listen().


| int tcp_listen_message | ( | socket_cores_ref | local_sockets, | |
| int | socket_id, | |||
| int | backlog | |||
| ) |
References tcp_socket_data::backlog, ENOTSOCK, and socket_core::specific_data.
Referenced by tcp_process_client_messages().

| int tcp_message | ( | ipc_callid_t | callid, | |
| ipc_call_t * | call, | |||
| ipc_call_t * | answer, | |||
| int * | answer_count | |||
| ) |
Processes the TCP message.
| [in] | callid | The message identifier. |
| [in] | call | The message parameters. |
| [out] | answer | The message answer parameters. |
| [out] | answer_count | The last parameter for the actual answer in the answer parameter. |
Referenced by module_message().

| 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 | |||
| ) |
References tcp_globals::net_phone, packet_get_copy(), socket_core::specific_data, and tcp_send_prepare_packet().
Referenced by tcp_get_packets_to_send(), and tcp_retransmit_packet().


| void tcp_prepare_operation_header | ( | socket_core_ref | socket, | |
| tcp_socket_data_ref | socket_data, | |||
| tcp_header_ref | header, | |||
| int | synchronize, | |||
| int | finalize | |||
| ) |
References tcp_socket_data::dest_port, tcp_header::finalize, tcp_header::header_length, htons, socket_core::port, tcp_header::source_port, socket_core::specific_data, tcp_header::synchronize, and TCP_COMPUTE_HEADER_LENGTH.
Referenced by tcp_create_notification_packet(), tcp_process_listen(), tcp_process_syn_sent(), and tcp_send_message().

| int tcp_prepare_timeout | ( | int(*)(void *tcp_timeout_t) | timeout_function, | |
| 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 | |||
| ) |
References free, tcp_timeout::globals_read_only, socket_core::key, tcp_timeout::key, tcp_timeout::key_length, socket_core::key_length, tcp_socket_data::local_sockets, tcp_timeout::local_sockets, socket_core::port, tcp_timeout::port, tcp_timeout::sequence_number, socket_core::socket_id, tcp_timeout::socket_id, socket_core::specific_data, tcp_timeout::state, and tcp_timeout::timeout.
Referenced by tcp_connect_core(), tcp_process_acknowledgement(), and tcp_send_prepare_packet().

| void tcp_process_acknowledgement | ( | socket_core_ref | socket, | |
| tcp_socket_data_ref | socket_data, | |||
| tcp_header_ref | header | |||
| ) |
References tcp_header::acknowledge, tcp_header::acknowledgement_number, tcp_socket_data::expected, tcp_socket_data::expected_count, tcp_socket_data::fin_outgoing, IS_IN_INTERVAL_OVERFLOW, NET_DEFAULT_TCP_TIME_WAIT_TIMEOUT, tcp_globals::net_phone, ntohl, ntohs, tcp_socket_data::outgoing, packet_get_id(), pq_add(), pq_detach(), pq_get_order(), pq_release(), socket_core::specific_data, tcp_socket_data::state, TCP_FAST_RETRANSMIT_COUNT, tcp_prepare_timeout(), tcp_release_after_timeout(), TCP_SOCKET_CLOSING, TCP_SOCKET_FIN_WAIT_1, TCP_SOCKET_FIN_WAIT_2, TCP_SOCKET_LAST_ACK, TCP_SOCKET_TIME_WAIT, tcp_socket_data::treshold, and tcp_header::window.
Referenced by tcp_process_established(), tcp_process_syn_received(), and tcp_process_syn_sent().


| int tcp_process_client_messages | ( | ipc_callid_t | callid, | |
| ipc_call_t | call | |||
| ) |
References answer_call(), packet_dimension::content, tcp_socket_data::data_fragment_size, data_receive(), DEVICE_INVALID_ID, tcp_globals::dimensions, free, tcp_globals::ip_phone, IPC_GET_PHONE, tcp_globals::last_used_port, tcp_socket_data::local_lock, tcp_socket_data::local_sockets, tcp_globals::lock, lock, tcp_globals::net_phone, NET_SOCKET, NET_SOCKET_ACCEPT, NET_SOCKET_BIND, NET_SOCKET_CLOSE, NET_SOCKET_CONNECT, NET_SOCKET_GETSOCKOPT, NET_SOCKET_LISTEN, NET_SOCKET_RECV, NET_SOCKET_RECVFROM, NET_SOCKET_SEND, NET_SOCKET_SENDTO, NET_SOCKET_SETSOCKOPT, refresh_answer(), socket_bind(), socket_cores_release(), socket_create(), SOCKET_GET_BACKLOG, SOCKET_GET_DATA_FRAGMENTS, SOCKET_GET_FLAGS, SOCKET_GET_NEW_SOCKET_ID, SOCKET_GET_SOCKET_ID, SOCKET_SET_ADDRESS_LENGTH, SOCKET_SET_DATA_FRAGMENT_SIZE, SOCKET_SET_HEADER_SIZE, SOCKET_SET_READ_DATA_LENGTH, SOCKET_SET_SOCKET_ID, tcp_globals::sockets, socket_core::specific_data, tcp_socket_data::state, tcp_accept_message(), tcp_close_message(), tcp_connect_message(), TCP_FREE_PORTS_END, TCP_FREE_PORTS_START, tcp_free_socket_data(), TCP_HEADER_SIZE, tcp_initialize_socket_data(), tcp_listen_message(), tcp_recvfrom_message(), tcp_send_message(), TCP_SOCKET_LISTEN, and tl_get_ip_packet_dimension().

| 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 | |||
| ) |
References tcp_socket_data::device_id, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, tcp_socket_data::fin_incoming, tcp_header::finalize, tcp_socket_data::incoming, IS_IN_INTERVAL, IS_IN_INTERVAL_OVERFLOW, tcp_socket_data::last_outgoing, tcp_socket_data::local_lock, tcp_globals::net_phone, tcp_socket_data::next_incoming, ntohl, packet_get_data_length(), packet_get_id(), packet_trim(), pq_add(), pq_detach(), pq_get_order(), pq_insert_after(), pq_next(), pq_release(), pq_set_order(), tcp_header::sequence_number, socket_core::specific_data, tcp_socket_data::state, tcp_create_notification_packet(), tcp_get_packets_to_send(), TCP_HEADER_LENGTH, tcp_process_acknowledgement(), tcp_queue_prepare_packet(), tcp_queue_received_packet(), tcp_release_and_return(), tcp_send_packets(), tcp_send_prepare_packet(), TCP_SOCKET_CLOSE_WAIT, TCP_SOCKET_CLOSING, TCP_SOCKET_FIN_WAIT_1, TCP_SOCKET_FIN_WAIT_2, and tcp_socket_data::window.
Referenced by tcp_process_packet().


| 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 | |||
| ) |
References tcp_socket_data::addr, tcp_socket_data::addrlen, tcp_socket_data::dest_port, tcp_socket_data::device_id, ENOTSOCK, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, free, tcp_socket_data::headerlen, tcp_socket_data::listening_socket_id, tcp_socket_data::local_lock, tcp_socket_data::local_sockets, tcp_globals::lock, tcp_globals::net_phone, tcp_socket_data::next_incoming, ntohl, ntohs, packet_get_data_length(), packet_get_id(), packet_trim(), socket_core::phone, socket_core::port, pq_detach(), pq_release(), tcp_socket_data::pseudo_header, tcp_header::sequence_number, socket_create(), socket_destroy(), socket_core::socket_id, SOCKET_MAP_KEY_LISTENING, socket_port_add(), socket_port_find(), tcp_globals::sockets, tcp_header::source_port, socket_core::specific_data, tcp_socket_data::state, tcp_header::synchronize, tcp_free_socket_data(), tcp_get_packets_to_send(), tcp_initialize_socket_data(), tcp_prepare_operation_header(), tcp_queue_packet(), tcp_release_and_return(), tcp_send_packets(), TCP_SOCKET_LISTEN, TCP_SOCKET_SYN_RECEIVED, tl_set_address_port(), tcp_socket_data::treshold, and tcp_header::window.
Referenced by tcp_process_packet().


| int tcp_process_packet | ( | device_id_t | device_id, | |
| packet_t | packet, | |||
| services_t | error | |||
| ) |
References tcp_header::checksum, compact_checksum(), compute_checksum(), tcp_header::destination_port, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, flip_checksum(), free, tcp_socket_data::headerlen, icmp_client_process_packet(), icmp_destination_unreachable_msg(), ICMP_PARAM_POINTER, icmp_parameter_problem_msg(), tcp_globals::icmp_phone, ICMP_PORT_UNREACH, IP_CHECKSUM_ZERO, ip_client_get_pseudo_header(), ip_client_process_packet(), ip_client_set_pseudo_header_data_length(), IPPROTO_TCP, tcp_socket_data::local_lock, tcp_globals::lock, tcp_globals::net_phone, NO_DATA, ntohs, packet_get_addr(), packet_get_data(), packet_get_data_length(), packet_get_id(), packet_trim(), pq_next(), pq_release(), tcp_socket_data::pseudo_header, socket_core::socket_id, SOCKET_MAP_KEY_LISTENING, socket_port_find(), tcp_globals::sockets, tcp_header::source_port, socket_core::specific_data, tcp_socket_data::state, TCP_HEADER_SIZE, tcp_process_established(), tcp_process_listen(), tcp_process_syn_received(), tcp_process_syn_sent(), tcp_release_and_return(), TCP_SOCKET_CLOSING, TCP_SOCKET_ESTABLISHED, TCP_SOCKET_FIN_WAIT_1, TCP_SOCKET_FIN_WAIT_2, TCP_SOCKET_LAST_ACK, TCP_SOCKET_LISTEN, TCP_SOCKET_SYN_RECEIVED, TCP_SOCKET_SYN_SENT, tcp_socket_data::timeout_count, tl_prepare_icmp_packet(), and tl_set_address_port().
Referenced by tcp_received_msg().


| int tcp_process_syn_received | ( | socket_core_ref | socket, | |
| tcp_socket_data_ref | socket_data, | |||
| tcp_header_ref | header, | |||
| packet_t | packet | |||
| ) |
References socket_core::accepted, tcp_header::acknowledge, tcp_socket_data::backlog, tcp_socket_data::data_fragment_size, tcp_socket_data::device_id, dyn_fifo_push(), ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, tcp_socket_data::listening_socket_id, tcp_socket_data::local_lock, tcp_socket_data::local_sockets, tcp_globals::net_phone, NET_SOCKET_ACCEPTED, tcp_socket_data::next_incoming, ntohl, packet_get_id(), socket_core::phone, pq_release(), tcp_header::sequence_number, socket_core::socket_id, socket_core::specific_data, tcp_socket_data::state, tcp_create_notification_packet(), tcp_get_packets_to_send(), TCP_HEADER_SIZE, tcp_process_acknowledgement(), tcp_queue_packet(), tcp_release_and_return(), tcp_send_packets(), TCP_SOCKET_ESTABLISHED, and TCP_SOCKET_FIN_WAIT_1.
Referenced by tcp_process_packet().


| int tcp_process_syn_sent | ( | socket_core_ref | socket, | |
| tcp_socket_data_ref | socket_data, | |||
| tcp_header_ref | header, | |||
| packet_t | packet | |||
| ) |
References tcp_operation::condvar, tcp_socket_data::device_id, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, tcp_socket_data::local_lock, tcp_operation::mutex, tcp_globals::net_phone, tcp_socket_data::next_incoming, ntohl, tcp_socket_data::operation, packet_get_data_length(), packet_get_id(), packet_trim(), pq_detach(), pq_release(), tcp_operation::result, tcp_header::sequence_number, socket_core::specific_data, tcp_socket_data::state, tcp_header::synchronize, tcp_get_packets_to_send(), tcp_prepare_operation_header(), tcp_process_acknowledgement(), tcp_queue_packet(), tcp_release_and_return(), tcp_send_packets(), and TCP_SOCKET_ESTABLISHED.
Referenced by tcp_process_packet().


| int tcp_queue_packet | ( | socket_core_ref | socket, | |
| tcp_socket_data_ref | socket_data, | |||
| packet_t | packet, | |||
| size_t | data_length | |||
| ) |
References ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, tcp_socket_data::next_outgoing, tcp_socket_data::outgoing, pq_add(), socket_core::specific_data, tcp_queue_prepare_packet(), and tcp_release_and_return().
Referenced by tcp_close_message(), tcp_connect_core(), tcp_process_listen(), tcp_process_syn_received(), tcp_process_syn_sent(), and tcp_send_message().


| int tcp_queue_prepare_packet | ( | socket_core_ref | socket, | |
| tcp_socket_data_ref | socket_data, | |||
| packet_t | packet, | |||
| size_t | data_length | |||
| ) |
References tcp_socket_data::addr, tcp_socket_data::addrlen, tcp_socket_data::dest_port, tcp_header::destination_port, ERROR_DECLARE, ERROR_OCCURRED, tcp_socket_data::fin_outgoing, tcp_header::finalize, htonl, htons, tcp_socket_data::next_outgoing, NO_DATA, packet_get_data(), packet_set_addr(), socket_core::port, tcp_header::sequence_number, tcp_header::source_port, socket_core::specific_data, and tcp_release_and_return().
Referenced by tcp_process_established(), and tcp_queue_packet().


| int tcp_queue_received_packet | ( | socket_core_ref | socket, | |
| tcp_socket_data_ref | socket_data, | |||
| packet_t | packet, | |||
| int | fragments, | |||
| size_t | total_length | |||
| ) |
References packet_dimension::content, tcp_socket_data::data_fragment_size, tcp_socket_data::device_id, tcp_globals::dimensions, dyn_fifo_push(), ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, tcp_globals::ip_phone, NET_SOCKET_RECEIVED, packet_get_id(), socket_core::phone, socket_core::received, socket_core::socket_id, SOCKET_MAX_RECEIVED_SIZE, socket_core::specific_data, tcp_release_and_return(), tl_get_ip_packet_dimension(), and tcp_socket_data::window.
Referenced by tcp_process_established().


| int tcp_received_msg | ( | device_id_t | device_id, | |
| packet_t | packet, | |||
| services_t | receiver, | |||
| services_t | error | |||
| ) |
References ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, tcp_globals::lock, and tcp_process_packet().

| int tcp_recvfrom_message | ( | socket_cores_ref | local_sockets, | |
| int | socket_id, | |||
| int | flags, | |||
| size_t * | addrlen | |||
| ) |
References tcp_socket_data::addr, tcp_socket_data::addrlen, data_reply(), dyn_fifo_pop(), dyn_fifo_value(), ENOTCONN, ENOTSOCK, ERROR_DECLARE, ERROR_PROPAGATE, tcp_globals::net_phone, NO_DATA, packet_get_id(), packet_translate(), pq_release(), socket_core::received, socket_reply_packets(), socket_core::specific_data, tcp_socket_data::state, TCP_SOCKET_CLOSE_WAIT, and TCP_SOCKET_ESTABLISHED.
Referenced by tcp_process_client_messages().


| void tcp_refresh_socket_data | ( | tcp_socket_data_ref | socket_data | ) |
References tcp_socket_data::acknowledged, tcp_socket_data::device_id, DEVICE_INVALID_ID, tcp_socket_data::expected, tcp_socket_data::last_outgoing, NET_DEFAULT_TCP_INITIAL_TIMEOUT, NET_DEFAULT_TCP_WINDOW, tcp_socket_data::next_outgoing, tcp_socket_data::state, TCP_INITIAL_SEQUENCE_NUMBER, TCP_SOCKET_INITIAL, tcp_socket_data::timeout, tcp_socket_data::treshold, and tcp_socket_data::window.
Referenced by tcp_initialize_socket_data().

| int tcp_release_after_timeout | ( | void * | data | ) |
References free, tcp_timeout::key, tcp_timeout::key_length, tcp_socket_data::local_lock, tcp_timeout::local_sockets, tcp_socket_data::local_sockets, tcp_globals::lock, tcp_globals::net_phone, tcp_timeout::port, socket_destroy(), tcp_timeout::socket_id, socket_core::socket_id, socket_port_find(), tcp_globals::sockets, socket_core::specific_data, tcp_free_socket_data(), and tcp_timeout::timeout.
Referenced by tcp_process_acknowledgement().


| int tcp_release_and_return | ( | packet_t | packet, | |
| int | result | |||
| ) |
Releases the packet and returns the result.
References tcp_globals::net_phone, packet_get_id(), and pq_release().
Referenced by tcp_create_notification_packet(), tcp_process_established(), tcp_process_listen(), tcp_process_packet(), tcp_process_syn_received(), tcp_process_syn_sent(), tcp_queue_packet(), tcp_queue_prepare_packet(), tcp_queue_received_packet(), and tcp_send_message().


| void tcp_retransmit_packet | ( | socket_core_ref | socket, | |
| tcp_socket_data_ref | socket_data, | |||
| size_t | sequence_number | |||
| ) |
References tcp_socket_data::device_id, tcp_socket_data::local_lock, tcp_socket_data::outgoing, packet_get_id(), pq_find(), pq_get_order(), socket_core::specific_data, tcp_prepare_copy(), and tcp_send_packets().

| int tcp_send_message | ( | socket_cores_ref | local_sockets, | |
| int | socket_id, | |||
| int | fragments, | |||
| size_t * | data_fragment_size, | |||
| int | flags | |||
| ) |
References tcp_socket_data::addr, tcp_socket_data::addrlen, packet_dimension::content, tcp_socket_data::data_fragment_size, tcp_socket_data::device_id, tcp_globals::dimensions, ENOTCONN, ENOTSOCK, ERROR_DECLARE, ERROR_PROPAGATE, tcp_globals::ip_phone, tcp_socket_data::local_lock, tcp_globals::lock, tcp_globals::net_phone, NO_DATA, PACKET_PREFIX, socket_core::specific_data, tcp_socket_data::state, tcp_get_packets_to_send(), TCP_HEADER_SIZE, tcp_prepare_operation_header(), tcp_queue_packet(), tcp_release_and_return(), tcp_send_packets(), TCP_SOCKET_CLOSE_WAIT, TCP_SOCKET_ESTABLISHED, tl_get_ip_packet_dimension(), and tl_socket_read_packet_data().
Referenced by tcp_process_client_messages().


| void tcp_send_packets | ( | device_id_t | device_id, | |
| packet_t | packet | |||
| ) |
References tcp_globals::ip_phone, ip_send_msg(), and pq_detach().
Referenced by tcp_close_message(), tcp_connect_core(), tcp_process_established(), tcp_process_listen(), tcp_process_syn_received(), tcp_process_syn_sent(), tcp_retransmit_packet(), and tcp_send_message().


| 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 | |||
| ) |
References tcp_header::acknowledge, tcp_header::acknowledgement_number, tcp_header::checksum, compact_checksum(), compute_checksum(), ERROR_DECLARE, ERROR_OCCURRED, flip_checksum(), tcp_socket_data::headerlen, htonl, htons, ip_client_prepare_packet(), ip_client_set_pseudo_header_data_length(), IPPROTO_TCP, tcp_globals::net_phone, tcp_socket_data::next_incoming, ntohl, packet_get_data(), packet_get_data_length(), packet_get_id(), pq_release(), tcp_socket_data::pseudo_header, tcp_header::sequence_number, socket_core::specific_data, tcp_socket_data::state, tcp_prepare_timeout(), tcp_socket_data::timeout, tcp_socket_data::window, and tcp_header::window.
Referenced by tcp_prepare_copy(), and tcp_process_established().


| int tcp_timeout | ( | void * | data | ) |
References tcp_operation::condvar, free, tcp_timeout::globals_read_only, tcp_timeout::key, tcp_timeout::key_length, tcp_socket_data::local_lock, tcp_timeout::local_sockets, tcp_socket_data::local_sockets, tcp_globals::lock, tcp_operation::mutex, tcp_socket_data::operation, tcp_timeout::port, tcp_operation::result, tcp_timeout::sequence_number, tcp_timeout::socket_id, socket_core::socket_id, socket_port_find(), tcp_globals::sockets, socket_core::specific_data, tcp_timeout::state, tcp_socket_data::state, TCP_MAX_TIMEOUTS, tcp_timeout::timeout, and tcp_socket_data::timeout_count.

TCP module global data.
TCP global data.
TCP module global data.
1.6.1