|
Data Structures | |
| struct | udp_globals |
| UDP global data. More... | |
| struct | udp_header |
| User datagram header. More... | |
Files | |
| file | udp.c |
UDP module implementation. | |
| file | udp.h |
UDP module. | |
| file | udp_header.h |
UDP header definition. | |
| file | udp_module.c |
UDP standalone module implementation. | |
| file | udp_module.h |
UDP module functions. | |
Defines | |
| #define | NET_DEFAULT_UDP_CHECKSUM_COMPUTING true |
| Default UDP checksum computing. | |
| #define | NET_DEFAULT_UDP_AUTOBINDING true |
| Default UDP autobind when sending via unbound sockets. | |
| #define | MAX_UDP_FRAGMENT_SIZE 65535 |
| Maximum UDP fragment size. | |
| #define | UDP_FREE_PORTS_START 1025 |
| Free ports pool start. | |
| #define | UDP_FREE_PORTS_END 65535 |
| Free ports pool end. | |
| #define | UDP_HEADER_SIZE sizeof(udp_header_t) |
| UDP header size in bytes. | |
| #define | NAME "UDP protocol" |
| UDP module name. | |
Typedefs | |
| typedef struct udp_globals | udp_globals_t |
| Type definition of the UDP global data. | |
| typedef struct udp_header | udp_header_t |
| Type definition of the user datagram header. | |
| typedef udp_header_t * | udp_header_ref |
| Type definition of the user datagram header pointer. | |
Functions | |
| int | udp_received_msg (device_id_t device_id, packet_t packet, services_t receiver, services_t error) |
| Processes the received UDP packet queue. | |
| int | udp_process_packet (device_id_t device_id, packet_t packet, services_t error) |
| Processes the received UDP packet queue. | |
| int | udp_release_and_return (packet_t packet, int result) |
| Releases the packet and returns the result. | |
| int | udp_initialize (async_client_conn_t client_connection) |
| Initializes the UDP module. | |
| int | udp_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count) |
| Processes the UDP message. | |
| void | module_print_name (void) |
| Prints the module name. | |
| int | module_start (async_client_conn_t client_connection) |
| Starts the UDP module. | |
| int | module_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count) |
| Processes the UDP message. | |
Variables | |
| udp_globals_t | udp_globals |
| UDP global data. | |
| udp_globals_t | udp_globals |
| UDP module global data. | |
Socket messages processing functions | |
|
| |
| int | udp_process_client_messages (ipc_callid_t callid, ipc_call_t call) |
| Processes the socket client messages. | |
| int | udp_sendto_message (socket_cores_ref local_sockets, int socket_id, const struct sockaddr *addr, socklen_t addrlen, int fragments, size_t *data_fragment_size, int flags) |
| Sends data from the socket to the remote address. | |
| int | udp_recvfrom_message (socket_cores_ref local_sockets, int socket_id, int flags, size_t *addrlen) |
| Receives data to the socket. | |
| #define MAX_UDP_FRAGMENT_SIZE 65535 |
Maximum UDP fragment size.
| #define NAME "UDP protocol" |
UDP module name.
| #define NET_DEFAULT_UDP_AUTOBINDING true |
Default UDP autobind when sending via unbound sockets.
| #define NET_DEFAULT_UDP_CHECKSUM_COMPUTING true |
Default UDP checksum computing.
| #define UDP_FREE_PORTS_END 65535 |
Free ports pool end.
Referenced by udp_process_client_messages(), and udp_sendto_message().
| #define UDP_FREE_PORTS_START 1025 |
Free ports pool start.
Referenced by udp_process_client_messages(), and udp_sendto_message().
| #define UDP_HEADER_SIZE sizeof(udp_header_t) |
UDP header size in bytes.
Referenced by udp_process_client_messages(), udp_process_packet(), udp_recvfrom_message(), and udp_sendto_message().
| typedef struct udp_globals udp_globals_t |
Type definition of the UDP global data.
| typedef udp_header_t* udp_header_ref |
Type definition of the user datagram header pointer.
| typedef struct udp_header udp_header_t |
Type definition of the user datagram header.
| int module_message | ( | ipc_callid_t | callid, | |
| ipc_call_t * | call, | |||
| ipc_call_t * | answer, | |||
| int * | answer_count | |||
| ) |
Processes the UDP 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 udp_message().

| int module_start | ( | async_client_conn_t | client_connection | ) |
Starts the UDP 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(), udp_globals::net_phone, pm_destroy(), pm_init(), REGISTER_ME, and udp_initialize().

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

| int udp_message | ( | ipc_callid_t | callid, | |
| ipc_call_t * | call, | |||
| ipc_call_t * | answer, | |||
| int * | answer_count | |||
| ) |
Processes the UDP 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().

| int udp_process_client_messages | ( | ipc_callid_t | callid, | |
| ipc_call_t | call | |||
| ) |
Processes the socket client messages.
Runs until the client module disconnects.
| [in] | callid | The message identifier. |
| [in] | call | The message parameters. |
References answer_call(), packet_dimension::content, data_receive(), DEVICE_INVALID_ID, udp_globals::dimensions, free, udp_globals::ip_phone, IPC_GET_PHONE, udp_globals::last_used_port, udp_globals::lock, udp_globals::net_phone, NET_SOCKET, NET_SOCKET_BIND, NET_SOCKET_CLOSE, NET_SOCKET_GETSOCKOPT, NET_SOCKET_RECVFROM, NET_SOCKET_SENDTO, NET_SOCKET_SETSOCKOPT, refresh_answer(), socket_bind(), socket_cores_release(), socket_create(), socket_destroy(), SOCKET_GET_DATA_FRAGMENTS, SOCKET_GET_FLAGS, 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, udp_globals::sockets, tl_get_ip_packet_dimension(), UDP_FREE_PORTS_END, UDP_FREE_PORTS_START, UDP_HEADER_SIZE, udp_recvfrom_message(), and udp_sendto_message().

| int udp_process_packet | ( | device_id_t | device_id, | |
| packet_t | packet, | |||
| services_t | error | |||
| ) |
Processes the received UDP packet queue.
Notifies the destination socket application. Releases the packet on error or sends an ICMP error notification..
| [in] | device_id | The receiving device identifier. |
| [in,out] | packet | The received packet queue. |
| [in] | error | The packet error reporting service. Prefixes the received packet. |
References udp_header::checksum, compact_checksum(), compute_checksum(), packet_dimension::content, udp_header::destination_port, udp_globals::dimensions, dyn_fifo_push(), ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, flip_checksum(), free, icmp_client_process_packet(), icmp_destination_unreachable_msg(), ICMP_PARAM_POINTER, icmp_parameter_problem_msg(), udp_globals::icmp_phone, ICMP_PORT_UNREACH, IP_CHECKSUM_ZERO, ip_client_get_pseudo_header(), ip_client_process_packet(), udp_globals::ip_phone, IPPROTO_UDP, udp_globals::lock, udp_globals::net_phone, NET_SOCKET_RECEIVED, NO_DATA, ntohs, packet_get_addr(), packet_get_data(), packet_get_data_length(), packet_get_id(), packet_trim(), socket_core::phone, pq_detach(), pq_next(), pq_release(), socket_core::received, socket_core::socket_id, SOCKET_MAP_KEY_LISTENING, SOCKET_MAX_RECEIVED_SIZE, socket_port_find(), udp_globals::sockets, tl_get_ip_packet_dimension(), tl_prepare_icmp_packet(), udp_header::total_length, UDP_HEADER_SIZE, and udp_release_and_return().
Referenced by udp_received_msg().


| int udp_received_msg | ( | device_id_t | device_id, | |
| packet_t | packet, | |||
| services_t | receiver, | |||
| services_t | error | |||
| ) |
Processes the received UDP packet queue.
Is used as an entry point from the underlying IP module. Locks the global lock and calls udp_process_packet() function.
| [in] | device_id | The receiving device identifier. |
| [in,out] | packet | The received packet queue. |
| receiver | The target service. Ignored parameter. | |
| [in] | error | The packet error reporting service. Prefixes the received packet. |
References udp_globals::lock, and udp_process_packet().

| int udp_recvfrom_message | ( | socket_cores_ref | local_sockets, | |
| int | socket_id, | |||
| int | flags, | |||
| size_t * | addrlen | |||
| ) |
Receives data to the socket.
Handles the NET_SOCKET_RECVFROM message. Replies the source address as well.
| [in] | local_sockets | The application local sockets. |
| [in] | socket_id | Socket identifier. |
| [in] | flags | Various receive flags. |
| [out] | addrlen | The source address length. |
References data_reply(), dyn_fifo_pop(), dyn_fifo_value(), ENOTSOCK, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, udp_globals::net_phone, NO_DATA, ntohs, packet_get_addr(), packet_get_data(), packet_get_id(), packet_translate(), packet_trim(), pq_release(), socket_core::received, socket_reply_packets(), udp_header::source_port, tl_set_address_port(), and UDP_HEADER_SIZE.
Referenced by udp_process_client_messages().


| int udp_release_and_return | ( | packet_t | packet, | |
| int | result | |||
| ) |
Releases the packet and returns the result.
References udp_globals::net_phone, packet_get_id(), and pq_release().
Referenced by udp_process_packet(), and udp_sendto_message().


| int udp_sendto_message | ( | socket_cores_ref | local_sockets, | |
| int | socket_id, | |||
| const struct sockaddr * | addr, | |||
| socklen_t | addrlen, | |||
| int | fragments, | |||
| size_t * | data_fragment_size, | |||
| int | flags | |||
| ) |
Sends data from the socket to the remote address.
Binds the socket to a free port if not already connected/bound. Handles the NET_SOCKET_SENDTO message. Supports AF_INET and AF_INET6 address families.
| [in,out] | local_sockets | The application local sockets. |
| [in] | socket_id | Socket identifier. |
| [in] | addr | The destination address. |
| [in] | addrlen | The address length. |
| [in] | fragments | The number of data fragments. |
| [out] | data_fragment_size | The data fragment size in bytes. |
| [in] | flags | Various send flags. |
References udp_globals::autobinding, udp_header::checksum, udp_globals::checksum_computing, compact_checksum(), compute_checksum(), udp_header::destination_port, DEVICE_INVALID_ID, ENOTSOCK, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, flip_checksum(), free, htons, ip_client_prepare_packet(), ip_client_set_pseudo_header_data_length(), ip_get_route_req(), ip_packet_size_req(), udp_globals::ip_phone, ip_send_msg(), IPPROTO_UDP, udp_globals::last_used_port, udp_globals::lock, udp_globals::net_phone, udp_globals::packet_dimension, packet_get_data(), packet_get_data_length(), PACKET_PREFIX, socket_core::port, pq_add(), socket_bind_free_port(), udp_globals::sockets, udp_header::source_port, tl_get_address_port(), tl_socket_read_packet_data(), udp_header::total_length, UDP_FREE_PORTS_END, UDP_FREE_PORTS_START, UDP_HEADER_SIZE, and udp_release_and_return().
Referenced by udp_process_client_messages().


UDP module global data.
UDP global data.
UDP module global data.
1.6.1