Data Structures | |
struct | in_addr |
INET address. More... | |
struct | sockaddr_in |
INET socket address. More... | |
struct | in6_addr |
INET6 address. More... | |
struct | sockaddr_in6 |
INET6 socket address. More... | |
struct | sockaddr |
Socket address. More... | |
struct | net_globals |
Configuration settings. More... | |
struct | netif |
Present network interface device. More... | |
struct | char_map |
Character string to integer map item. More... | |
struct | dyn_fifo |
Dynamic first in first out positive integer queue. More... | |
struct | measured_string |
Character string with measured length. More... | |
struct | module_struct |
Module map. More... | |
Modules | |
Network interface drivers | |
Network interface layer | |
Inter-networking layer | |
Transport layer | |
Packet management system | |
Applications | |
Application library | |
Files | |
file | checksum.c |
General CRC and checksum computation implementation. | |
file | configuration.h |
Networking subsystem compilation configuration. | |
file | err.h |
Common error processing codes and routines. | |
file | byteorder.h |
Host - network byte order manipulation functions. | |
file | checksum.h |
General CRC and checksum computation. | |
file | in.h |
INET family common definitions. | |
file | in6.h |
INET6 family common definitions. | |
file | inet.h |
Internet common definitions. | |
file | net_interface.h |
Networking module interface. | |
file | socket_errno.h |
Socket error codes. | |
file | inet.c |
Internet protocol address conversion functions implementation. | |
file | messages.h |
Networking common message definitions. | |
file | module.c |
Generic module skeleton implementation. | |
file | modules.c |
Generic module functions implementation. | |
file | modules.h |
Generic module functions. | |
file | net.c |
Networking subsystem central module implementation. | |
file | net.h |
Networking subsystem central module. | |
file | net_bundle.c |
Wrapper for the bundled networking and TCP/IP stact modules. | |
file | net_messages.h |
Networking subsystem central module messages. | |
file | net_remote.c |
Networking interface implementation for standalone remote modules. | |
file | net_standalone.c |
Wrapper for the standalone networking module. | |
file | netstart.c |
Starts the networking subsystem. | |
file | self_test.c |
Self tests implementation. | |
file | self_test.h |
Self tests. | |
file | char_map.c |
Character string to integer map implementation. | |
file | char_map.h |
Character string to integer map. | |
file | dynamic_fifo.c |
Dynamic first in first out positive integer queue implementation. | |
file | dynamic_fifo.h |
Dynamic first in first out positive integer queue. | |
file | generic_char_map.h |
Character string to generic type map. | |
file | generic_field.h |
Generic type field. | |
file | int_map.h |
Integer to generic type map. | |
file | measured_strings.c |
Character string with measured length implementation. | |
file | measured_strings.h |
Character string with measured length. | |
file | module_map.c |
Character string to module map implementation. | |
file | module_map.h |
Character string to module map. | |
Defines | |
#define | CRC_DIVIDER_BE 0x04C11DB7 |
Big-endian encoding CRC divider. | |
#define | CRC_DIVIDER_LE 0xEDB88320 |
Little-endian encoding CRC divider. | |
#define | NET_SELF_TEST 0 |
Activates the self test. | |
#define | ERROR_CODE error_check_return_value |
An actual stored error code. | |
#define | ERROR_DECLARE int ERROR_CODE |
An error processing routines declaration. | |
#define | ERROR_OCCURRED(value) ((ERROR_CODE = (value)) != EOK) |
Stores the value as an error code and checks if an error occurred. | |
#define | ERROR_PROPAGATE(value) if(ERROR_OCCURRED(value)) return ERROR_CODE |
Checks if an error occurred and immediately exits the actual function returning the error code. | |
#define | htons(number) host2uint16_t_be(number) |
Converts the given short number (16 bit) from the host byte order to the network byte order (big endian). | |
#define | htonl(number) host2uint32_t_be(number) |
Converts the given long number (32 bit) from the host byte order to the network byte order (big endian). | |
#define | ntohs(number) uint16_t_be2host(number) |
Converts the given short number (16 bit) from the network byte order (big endian) to the host byte order. | |
#define | ntohl(number) uint32_t_be2host(number) |
Converts the given long number (32 bit) from the network byte order (big endian) to the host byte order. | |
#define | IP_CHECKSUM_ZERO 0xFFFFu |
IP checksum value for computed zero checksum. | |
#define | compute_crc32(seed, data, length) compute_crc32_le(seed, (uint8_t *) data, length) |
Computes CRC32 value. | |
#define | INET_ADDRSTRLEN (4 * 3 + 3 + 1) |
INET string address maximum length. | |
#define | INET6_ADDRSTRLEN (8 * 4 + 7 + 1) |
INET6 string address maximum length. | |
#define | IS_IN_INTERVAL(item, first_inclusive, last_exclusive) (((item) >= (first_inclusive)) && ((item) < (last_exclusive))) |
Returns a value indicating whether the value is in the interval. | |
#define | MODULE_WAIT_TIME (10 * 1000) |
The time between connect requests in microseconds. | |
#define | CONVERT_SIZE(type_from, type_to, count) ((sizeof(type_from) / sizeof(type_to)) * (count)) |
Converts the data length between different types. | |
#define | REGISTER_ME(me, phonehash) ipc_connect_to_me(PHONE_NS, (me), 0, 0, (phonehash)) |
Registers the module service at the name server. | |
#define | BUFFER_SIZE 256 |
File read buffer size. | |
#define | NAME "Networking" |
Networking module name. | |
#define | CONF_DIR "/cfg/net" |
Configuration directory. | |
#define | CONF_GENERAL_FILE "general" |
General configuration file. | |
#define | NAME "Networking startup" |
Networking startup module name. | |
#define | self_test() EOK |
Self test start function. | |
#define | CHAR_MAP_MAGIC_VALUE 0x12345611 |
Internal magic value for a consistency check. | |
#define | CHAR_MAP_NULL (-1) |
Invalid assigned value used also if an entry does not exist. | |
#define | DYN_FIFO_MAGIC_VALUE 0x58627659 |
Internal magic value for a consistency check. | |
#define | NEXT_INDEX(fifo, index) (((index) + 1) % ((fifo)->size + 1)) |
Returns the next queue index. | |
#define | GENERIC_CHAR_MAP_MAGIC_VALUE 0x12345622 |
Internal magic value for a map consistency check. | |
#define | GENERIC_CHAR_MAP_DECLARE(name, type) |
Character string to generic type map declaration. | |
#define | GENERIC_CHAR_MAP_IMPLEMENT(name, type) |
Character string to generic type map implementation. | |
#define | GENERIC_FIELD_MAGIC_VALUE 0x55667788 |
Internal magic value for a field consistency check. | |
#define | GENERIC_FIELD_DECLARE(name, type) |
Generic type field declaration. | |
#define | GENERIC_FIELD_IMPLEMENT(name, type) |
Generic type field implementation. | |
#define | INT_MAP_MAGIC_VALUE 0x11223344 |
Internal magic value for a map consistency check. | |
#define | INT_MAP_ITEM_MAGIC_VALUE 0x55667788 |
Internal magic value for an item consistency check. | |
#define | INT_MAP_DECLARE(name, type) |
Integer to generic type map declaration. | |
#define | INT_MAP_IMPLEMENT(name, type) |
Integer to generic type map implementation. | |
Typedefs | |
typedef struct in_addr | in_addr_t |
Type definition of the INET address. | |
typedef struct sockaddr_in | sockaddr_in_t |
Type definition of the INET socket address. | |
typedef struct in6_addr | in6_addr_t |
Type definition of the INET6 address. | |
typedef struct sockaddr_in6 | sockaddr_in6_t |
Type definition of the INET6 socket address. | |
typedef struct sockaddr | sockaddr_t |
Type definition of the socket address. | |
typedef struct addrinfo | addrinfo_t |
Type definition of the address information. | |
typedef int | connect_module_t (services_t need) |
Connect to the needed module function type definition. | |
typedef struct net_globals | net_globals_t |
Type definition of the networking module global data. | |
typedef struct netif | netif_t |
Type definition of the network interface specific data. | |
typedef netif_t * | netif_ref |
Type definition of the network interface specific data pointer. | |
typedef struct char_map | char_map_t |
Type definition of the character string to integer map. | |
typedef char_map_t * | char_map_ref |
Type definition of the character string to integer map pointer. | |
typedef struct dyn_fifo | dyn_fifo_t |
Type definition of the dynamic fifo queue. | |
typedef dyn_fifo_t * | dyn_fifo_ref |
Type definition of the dynamic fifo queue pointer. | |
typedef struct measured_string | measured_string_t |
Type definition of the character string with measured length. | |
typedef measured_string_t * | measured_string_ref |
Type definition of the character string with measured length pointer. | |
typedef struct module_struct | module_t |
Type definition of the module structure. | |
typedef module_t * | module_ref |
Type definition of the module structure pointer. | |
Enumerations | |
enum | net_messages { NET_NET_GET_CONF = NET_FIRST, NET_NET_GET_DEVICE_CONF, NET_NET_STARTUP } |
Networking subsystem central module messages. More... | |
Functions | |
uint16_t | compact_checksum (uint32_t sum) |
Compacts the computed checksum to the 16 bit number adding the carries. | |
uint32_t | compute_checksum (uint32_t seed, uint8_t *data, size_t length) |
Computes sum of the 2 byte fields. | |
uint32_t | compute_crc32_be (uint32_t seed, uint8_t *data, size_t length) |
Computes CRC32 value in the big-endian environment. | |
uint32_t | compute_crc32_le (uint32_t seed, uint8_t *data, size_t length) |
Computes CRC32 value in the little-endian environment. | |
uint16_t | flip_checksum (uint16_t checksum) |
Returns or flips the checksum if zero. | |
uint16_t | ip_checksum (uint8_t *data, size_t length) |
Computes the ip header checksum. | |
int | inet_ntop (uint16_t family, const uint8_t *data, char *address, size_t length) |
Prints the address into the character buffer. | |
int | inet_pton (uint16_t family, const char *address, uint8_t *data) |
Parses the character string into the address. | |
void | client_connection (ipc_callid_t iid, ipc_call_t *icall) |
Default thread for new connections. | |
int | main (int argc, char *argv[]) |
Starts the module. | |
void | answer_call (ipc_callid_t callid, int result, ipc_call_t *answer, int answer_count) |
Answers the call. | |
int | bind_service (services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver) |
Creates bidirectional connection with the needed module service and registers the message receiver. | |
int | bind_service_timeout (services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout) |
Creates bidirectional connection with the needed module service and registers the message receiver. | |
int | connect_to_service (services_t need) |
Connects to the needed module. | |
int | connect_to_service_timeout (services_t need, suseconds_t timeout) |
Connects to the needed module. | |
int | data_receive (void **data, size_t *length) |
Receives data from the other party. | |
int | data_reply (void *data, size_t data_length) |
Replies the data to the other party. | |
void | refresh_answer (ipc_call_t *answer, int *answer_count) |
Refreshes answer structure and parameters count. | |
device_id_t | generate_new_device_id (void) |
Generates new system-unique device identifier. | |
int | net_get_conf (measured_strings_ref netif_conf, measured_string_ref configuration, size_t count, char **data) |
Returns the configured values. | |
int | net_initialize (async_client_conn_t client_connection) |
Initializes the networking module. | |
int | parse_line (measured_strings_ref configuration, char *line) |
int | read_configuration (void) |
Reads the networking subsystem global configuration. | |
int | read_configuration_file (const char *directory, const char *filename, measured_strings_ref configuration) |
int | read_netif_configuration (const char *name, netif_ref netif) |
Reads the network interface specific configuration. | |
int | start_device (netif_ref netif) |
Starts the network interface according to its configuration. | |
int | startup (void) |
Reads the configuration and starts all network interfaces. | |
int | add_configuration (measured_strings_ref configuration, const char *name, const char *value) |
Adds the configured setting to the configuration map. | |
int | net_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count) |
Processes the networking message. | |
int | net_initialize_build (async_client_conn_t client_connection) |
Initializes the networking module for the chosen subsystem build type. | |
task_id_t | spawn (const char *fname) |
Starts the module. | |
int | char_map_add_item (char_map_ref map, const char *identifier, size_t length, const int value) |
Adds the value with the key to the map. | |
char_map_ref | char_map_find_node (const char_map_ref map, const char *identifier, const size_t length) |
Returns the node assigned to the key from the map. | |
int | char_map_get_value (const char_map_ref map) |
Returns the value assigned to the map. | |
int | char_map_is_valid (const char_map_ref map) |
Checks if the map is valid. | |
int | char_map_add (char_map_ref map, const char *identifier, size_t length, const int value) |
Adds the value with the key to the map. | |
void | char_map_destroy (char_map_ref map) |
Clears and destroys the map. | |
int | char_map_exclude (char_map_ref map, const char *identifier, size_t length) |
Excludes the value assigned to the key from the map. | |
int | char_map_find (const char_map_ref map, const char *identifier, size_t length) |
Returns the value assigned to the key from the map. | |
int | char_map_initialize (char_map_ref map) |
Initializes the map. | |
int | char_map_update (char_map_ref map, const char *identifier, size_t length, const int value) |
Adds or updates the value with the key to the map. | |
int | dyn_fifo_is_valid (dyn_fifo_ref fifo) |
Checks if the queue is valid. | |
int | dyn_fifo_initialize (dyn_fifo_ref fifo, int size) |
Initializes the dynamic queue. | |
int | dyn_fifo_push (dyn_fifo_ref fifo, int value, int max_size) |
Appends a new item to the queue end. | |
int | dyn_fifo_pop (dyn_fifo_ref fifo) |
Returns and excludes the first item in the queue. | |
int | dyn_fifo_value (dyn_fifo_ref fifo) |
Returns and keeps the first item in the queue. | |
int | dyn_fifo_destroy (dyn_fifo_ref fifo) |
Clears and destroys the queue. | |
size_t * | prepare_lengths (const measured_string_ref strings, size_t count) |
Computes the lengths of the measured strings in the given array. | |
measured_string_ref | measured_string_create_bulk (const char *string, size_t length) |
Creates a new measured string bundled with a copy of the given string itself as one memory block. | |
measured_string_ref | measured_string_copy (measured_string_ref source) |
Copies the given measured string with separated header and data parts. | |
int | measured_strings_receive (measured_string_ref *strings, char **data, size_t count) |
Receives a measured strings array from a calling module. | |
int | measured_strings_reply (const measured_string_ref strings, size_t count) |
Replies the given measured strings array to a calling module. | |
int | measured_strings_return (int phone, measured_string_ref *strings, char **data, size_t count) |
Receives a measured strings array from another module. | |
int | measured_strings_send (int phone, const measured_string_ref strings, size_t count) |
Sends the given measured strings array to another module. | |
int | add_module (module_ref *module, modules_ref modules, const char *name, const char *filename, services_t service, task_id_t task_id, connect_module_t connect_module) |
module_ref | get_running_module (modules_ref modules, char *name) |
Searches and returns the specified module. | |
int | add_module (module_ref *module, modules_ref modules, const char *name, const char *filename, services_t service, task_id_t task_id, connect_module_t *connect_module) |
Adds module to the module map. | |
Variables | |
net_globals_t | net_globals |
Networking module global data. | |
net_globals_t | net_globals |
Networking module global data. | |
net_globals_t | net_globals |
Networking module global data. | |
Networking module interface | |
This interface is used by other modules. | |
int | net_get_device_conf_req (int net_phone, device_id_t device_id, measured_string_ref *configuration, size_t count, char **data) |
Returns the device specific configuration. | |
int | net_get_conf_req (int net_phone, measured_string_ref *configuration, size_t count, char **data) |
Returns the global configuration. | |
void | net_free_settings (measured_string_ref settings, char *data) |
Frees the received settings. | |
int | net_connect_module (services_t service) |
Connects to the networking module. | |
External module functions. | |
This functions have to be implemented in every module. | |
int | module_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count) |
External message processing function. | |
void | module_print_name (void) |
External function to print the module name. | |
int | module_start (async_client_conn_t client_connection) |
External module startup function. | |
Specific self tests switches | |
| |
#define | NET_SELF_TEST_CHAR_MAP 1 |
Activates the char map self test. | |
#define | NET_SELF_TEST_CRC 1 |
Activates the CRC computation self test. | |
#define | NET_SELF_TEST_DYNAMIC_FIFO 1 |
Activates the dynamic fifo self test. | |
#define | NET_SELF_TEST_GENERIC_CHAR_MAP 1 |
Activates the generic char map self test. | |
#define | NET_SELF_TEST_GENERIC_FIELD 1 |
Activates the generic field self test. | |
#define | NET_SELF_TEST_INT_MAP 1 |
Activates the integral map self test. | |
#define | NET_SELF_TEST_MEASURED_STRINGS 1 |
Activates the measured strings self test. | |
Socket error codes definitions | |
| |
#define | EINPROGRESS (-10036) |
An API function is called while another blocking function is in progress. | |
#define | ENOTSOCK (-10038) |
The socket identifier is not valid. | |
#define | EDESTADDRREQ (-10039) |
The destination address required. | |
#define | EPROTONOSUPPORT (-10043) |
Protocol is not supported. | |
#define | ESOCKTNOSUPPORT (-10044) |
Socket type is not supported. | |
#define | EPFNOSUPPORT (-10046) |
Protocol family is not supported. | |
#define | EAFNOSUPPORT (-10047) |
Address family is not supported. | |
#define | EADDRINUSE (-10048) |
Address is already in use. | |
#define | ENOTCONN (-10057) |
The socket is not connected or bound. | |
#define | TRY_AGAIN (-11002) |
The requested operation was not performed. | |
#define | NO_DATA (-11004) |
No data. | |
Networking message counts | |
| |
#define | NET_ARP_COUNT 5 |
The number of ARP messages. | |
#define | NET_ETH_COUNT 0 |
The number of Ethernet messages. | |
#define | NET_ICMP_COUNT 6 |
The number of ICMP messages. | |
#define | NET_IL_COUNT 6 |
The number of inter-network messages. | |
#define | NET_IP_COUNT 4 |
The number of IP messages. | |
#define | NET_NET_COUNT 3 |
The number of general networking messages. | |
#define | NET_NETIF_COUNT 6 |
The number of network interface driver messages. | |
#define | NET_NIL_COUNT 7 |
The number of network interface layer messages. | |
#define | NET_PACKET_COUNT 5 |
The number of packet management system messages. | |
#define | NET_SOCKET_COUNT 14 |
The number of socket messages. | |
#define | NET_TCP_COUNT 0 |
The number of TCP messages. | |
#define | NET_TL_COUNT 1 |
The number of transport layer messages. | |
#define | NET_UDP_COUNT 0 |
The number of UDP messages. | |
Networking message intervals | |
| |
#define | NET_FIRST 2000 |
The first networking message. | |
#define | NET_NETIF_FIRST NET_FIRST |
The first network interface layer message. | |
#define | NET_NETIF_LAST (NET_NETIF_FIRST + NET_NETIF_COUNT) |
The last network interface layer message. | |
#define | NET_NET_FIRST (NET_NETIF_LAST + 0) |
The first general networking message. | |
#define | NET_NET_LAST (NET_NET_FIRST + NET_NET_COUNT) |
The last general networking message. | |
#define | NET_NIL_FIRST (NET_NET_LAST + 0) |
The first network interface layer message. | |
#define | NET_NIL_LAST (NET_NIL_FIRST + NET_NIL_COUNT) |
The last network interface layer message. | |
#define | NET_ETH_FIRST (NET_NIL_LAST + 0) |
The first Ethernet message. | |
#define | NET_ETH_LAST (NET_ETH_FIRST + NET_ETH_COUNT) |
The last Ethernet message. | |
#define | NET_IL_FIRST (NET_ETH_LAST + 0) |
The first inter-network message. | |
#define | NET_IL_LAST (NET_IL_FIRST + NET_IL_COUNT) |
The last inter-network message. | |
#define | NET_IP_FIRST (NET_IL_LAST + 0) |
The first IP message. | |
#define | NET_IP_LAST (NET_IP_FIRST + NET_IP_COUNT) |
The last IP message. | |
#define | NET_ARP_FIRST (NET_IP_LAST + 0) |
The first ARP message. | |
#define | NET_ARP_LAST (NET_ARP_FIRST + NET_ARP_COUNT) |
The last ARP message. | |
#define | NET_ICMP_FIRST (NET_ARP_LAST + 0) |
The first ICMP message. | |
#define | NET_ICMP_LAST (NET_ICMP_FIRST + NET_ICMP_COUNT) |
The last ICMP message. | |
#define | NET_TL_FIRST (NET_ICMP_LAST + 0) |
The first ICMP message. | |
#define | NET_TL_LAST (NET_TL_FIRST + NET_TL_COUNT) |
The last ICMP message. | |
#define | NET_UDP_FIRST (NET_TL_LAST + 0) |
The first UDP message. | |
#define | NET_UDP_LAST (NET_UDP_FIRST + NET_UDP_COUNT) |
The last UDP message. | |
#define | NET_TCP_FIRST (NET_UDP_LAST + 0) |
The first TCP message. | |
#define | NET_TCP_LAST (NET_TCP_FIRST + NET_TCP_COUNT) |
The last TCP message. | |
#define | NET_SOCKET_FIRST (NET_TCP_LAST + 0) |
The first socket message. | |
#define | NET_SOCKET_LAST (NET_SOCKET_FIRST + NET_SOCKET_COUNT) |
The last socket message. | |
#define | NET_PACKET_FIRST (NET_SOCKET_LAST + 0) |
The first packet management system message. | |
#define | NET_PACKET_LAST (NET_PACKET_FIRST + NET_PACKET_COUNT) |
The last packet management system message. | |
#define | NET_LAST NET_PACKET_LAST |
The last networking message. | |
#define | NET_COUNT (NET_LAST - NET_FIRST) |
The number of networking messages. | |
#define | IS_NET_MESSAGE(call) IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_FIRST, NET_LAST) |
Returns a value indicating whether the IPC call is a generic networking message. | |
#define | IS_NET_ARP_MESSAGE(call) IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ARP_FIRST, NET_ARP_LAST) |
Returns a value indicating whether the IPC call is an ARP message. | |
#define | IS_NET_ETH_MESSAGE(call) IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ETH_FIRST, NET_ETH_LAST) |
Returns a value indicating whether the IPC call is an Ethernet message. | |
#define | IS_NET_ICMP_MESSAGE(call) IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ICMP_FIRST, NET_ICMP_LAST) |
Returns a value indicating whether the IPC call is an ICMP message. | |
#define | IS_NET_IL_MESSAGE(call) IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IL_FIRST, NET_IL_LAST) |
Returns a value indicating whether the IPC call is an inter-network layer message. | |
#define | IS_NET_IP_MESSAGE(call) IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IP_FIRST, NET_IP_LAST) |
Returns a value indicating whether the IPC call is an IP message. | |
#define | IS_NET_NET_MESSAGE(call) IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NET_FIRST, NET_NET_LAST) |
Returns a value indicating whether the IPC call is a generic networking message. | |
#define | IS_NET_NIL_MESSAGE(call) IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NIL_FIRST, NET_NIL_LAST) |
Returns a value indicating whether the IPC call is a network interface layer message. | |
#define | IS_NET_PACKET_MESSAGE(call) IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_PACKET_FIRST, NET_PACKET_LAST) |
Returns a value indicating whether the IPC call is a packet manaagement system message. | |
#define | IS_NET_SOCKET_MESSAGE(call) IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_SOCKET_FIRST, NET_SOCKET_LAST) |
Returns a value indicating whether the IPC call is a socket message. | |
#define | IS_NET_TCP_MESSAGE(call) IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TCP_FIRST, NET_TCP_LAST) |
Returns a value indicating whether the IPC call is a TCP message. | |
#define | IS_NET_TL_MESSAGE(call) IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TL_FIRST, NET_TL_LAST) |
Returns a value indicating whether the IPC call is a transport layer message. | |
#define | IS_NET_UDP_MESSAGE(call) IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_UDP_FIRST, NET_UDP_LAST) |
Returns a value indicating whether the IPC call is a UDP message. | |
First arguments | |
| |
#define | IPC_GET_DEVICE(call) (device_id_t) IPC_GET_ARG1(*call) |
Returns the device identifier message argument. | |
Second arguments | |
| |
#define | IPC_GET_PACKET(call) (packet_id_t) IPC_GET_ARG2(*call) |
Returns the packet identifier message argument. | |
#define | IPC_GET_COUNT(call) (size_t) IPC_GET_ARG2(*call) |
Returns the count message argument. | |
#define | IPC_GET_STATE(call) (device_state_t) IPC_GET_ARG2(*call) |
Returns the device state message argument. | |
#define | IPC_GET_MTU(call) (size_t) IPC_GET_ARG2(*call) |
Returns the maximum transmission unit message argument. | |
Third arguments | |
| |
#define | IPC_GET_SERVICE(call) (services_t) IPC_GET_ARG3(*call) |
Returns the device driver service message argument. | |
#define | IPC_GET_TARGET(call) (services_t) IPC_GET_ARG3(*call) |
Returns the target service message argument. | |
#define | IPC_GET_SENDER(call) (services_t) IPC_GET_ARG3(*call) |
Returns the sender service message argument. | |
Fourth arguments | |
| |
#define | IPC_GET_ERROR(call) (services_t) IPC_GET_ARG4(*call) |
Returns the error service message argument. | |
Fifth arguments | |
| |
#define | IPC_GET_PHONE(call) (int) IPC_GET_ARG5(*call) |
Returns the phone message argument. | |
First answers | |
| |
#define | IPC_SET_DEVICE(answer) ((device_id_t *) &IPC_GET_ARG1(*answer)) |
Sets the device identifier in the message answer. | |
#define | IPC_SET_ADDR(answer) ((size_t *) &IPC_GET_ARG1(*answer)) |
Sets the minimum address length in the message answer. | |
Second answers | |
| |
#define | IPC_SET_PREFIX(answer) ((size_t *) &IPC_GET_ARG2(*answer)) |
Sets the minimum prefix size in the message answer. | |
Third answers | |
| |
#define | IPC_SET_CONTENT(answer) ((size_t *) &IPC_GET_ARG3(*answer)) |
Sets the maximum content size in the message answer. | |
Fourth answers | |
| |
#define | IPC_SET_SUFFIX(answer) ((size_t *) &IPC_GET_ARG4(*answer)) |
Sets the minimum suffix size in the message answer. | |
Modules definitions | |
| |
#define | DP8390_FILENAME "/srv/dp8390" |
DP8390 network interface module full path filename. | |
#define | DP8390_NAME "dp8390" |
DP8390 network interface module name. | |
#define | ETHERNET_FILENAME "/srv/eth" |
Ethernet module full path filename. | |
#define | ETHERNET_NAME "ethernet" |
Ethernet module name. | |
#define | IP_FILENAME "/srv/ip" |
IP module full path filename. | |
#define | IP_NAME "ip" |
IP module name. | |
#define | LO_FILENAME "/srv/lo" |
Loopback network interface module full path filename. | |
#define | LO_NAME "lo" |
Loopback network interface module name. | |
#define | NILDUMMY_FILENAME "/srv/nildummy" |
Ethernet module full path filename. | |
#define | NILDUMMY_NAME "nildummy" |
Ethernet module name. | |
Configuration setting names definitions | |
| |
#define | CONF_IL "IL" |
Internet protocol module name configuration label. | |
#define | CONF_IO "IO" |
Device input/output address configuration label. | |
#define | CONF_IRQ "IRQ" |
Interrupt number configuration label. | |
#define | CONF_MTU "MTU" |
Maximum transmission unit configuration label. | |
#define | CONF_NAME "NAME" |
Network interface name configuration label. | |
#define | CONF_NETIF "NETIF" |
Network interface module name configuration label. | |
#define | CONF_NIL "NIL" |
Network interface layer module name configuration label. |
#define BUFFER_SIZE 256 |
File read buffer size.
Referenced by read_configuration_file().
#define CHAR_MAP_MAGIC_VALUE 0x12345611 |
Internal magic value for a consistency check.
Referenced by char_map_is_valid().
#define CHAR_MAP_NULL (-1) |
Invalid assigned value used also if an entry does not exist.
Referenced by char_map_add_item(), and char_map_get_value().
#define compute_crc32 | ( | seed, | |||
data, | |||||
length | ) | compute_crc32_le(seed, (uint8_t *) data, length) |
Computes CRC32 value.
[in] | seed | Initial value. Often used as 0 or ~0. |
[in] | data | Pointer to the beginning of data to process. |
[in] | length | Length of the data in bits. |
Referenced by eth_prepare_packet(), and eth_process_packet().
#define CONF_DIR "/cfg/net" |
Configuration directory.
Referenced by read_configuration(), and read_netif_configuration().
#define CONF_GENERAL_FILE "general" |
General configuration file.
Referenced by read_configuration().
#define CONF_IL "IL" |
Internet protocol module name configuration label.
Referenced by start_device().
#define CONF_IO "IO" |
Device input/output address configuration label.
Referenced by start_device().
#define CONF_IRQ "IRQ" |
Interrupt number configuration label.
Referenced by start_device().
#define CONF_MTU "MTU" |
Maximum transmission unit configuration label.
Referenced by start_device().
#define CONF_NAME "NAME" |
Network interface name configuration label.
Referenced by startup().
#define CONF_NETIF "NETIF" |
Network interface module name configuration label.
Referenced by start_device().
#define CONF_NIL "NIL" |
Network interface layer module name configuration label.
Referenced by start_device().
#define CONVERT_SIZE | ( | type_from, | |||
type_to, | |||||
count | ) | ((sizeof(type_from) / sizeof(type_to)) * (count)) |
Converts the data length between different types.
[in] | type_from | The source type. |
[in] | type_to | The destination type. |
[in] | count | The number units of the source type size. |
Referenced by arp_receive_message(), arp_translate_message(), ip_netif_initialize(), ip_prepare_packet(), ip_send_route(), netif_get_addr_message(), and nil_initialize().
#define CRC_DIVIDER_BE 0x04C11DB7 |
Big-endian encoding CRC divider.
#define CRC_DIVIDER_LE 0xEDB88320 |
Little-endian encoding CRC divider.
#define DP8390_FILENAME "/srv/dp8390" |
DP8390 network interface module full path filename.
Referenced by net_initialize().
#define DP8390_NAME "dp8390" |
DP8390 network interface module name.
Referenced by net_initialize().
#define DYN_FIFO_MAGIC_VALUE 0x58627659 |
Internal magic value for a consistency check.
Referenced by dyn_fifo_is_valid().
#define EADDRINUSE (-10048) |
Address is already in use.
#define EAFNOSUPPORT (-10047) |
Address family is not supported.
Referenced by ip_deliver_local(), ip_prepare_icmp(), ip_process_packet(), and main().
#define EDESTADDRREQ (-10039) |
#define EINPROGRESS (-10036) |
An API function is called while another blocking function is in progress.
Referenced by closesocket().
#define ENOTCONN (-10057) |
The socket is not connected or bound.
Referenced by icmp_bind_free_id(), tcp_recvfrom_message(), and tcp_send_message().
#define ENOTSOCK (-10038) |
The socket identifier is not valid.
Referenced by accept(), closesocket(), getsockopt(), listen(), recvfrom_core(), sendto_core(), socket_connection(), socket_send_data(), tcp_accept_message(), tcp_close_message(), tcp_connect_message(), tcp_listen_message(), tcp_process_listen(), tcp_recvfrom_message(), tcp_send_message(), udp_recvfrom_message(), and udp_sendto_message().
#define EPFNOSUPPORT (-10046) |
Protocol family is not supported.
Referenced by socket().
#define EPROTONOSUPPORT (-10043) |
Protocol is not supported.
Referenced by socket().
#define ERROR_CODE error_check_return_value |
An actual stored error code.
Referenced by add_module(), arp_device_message(), arp_proto_create(), eth_device_message(), eth_receiver(), icmp_echo(), icmp_process_client_messages(), icmp_process_message(), icmp_received_msg(), icmp_send_packet(), ip_deliver_local(), ip_fragment_packet(), ip_send_route(), main(), module_start(), netif_probe_message(), netif_start_message(), nil_initialize(), nildummy_device_message(), nildummy_receiver(), packet_return(), parse_line(), socket(), socket_bind_insert(), socket_connection(), socket_port_add_core(), startup(), tcp_close_message(), tcp_connect_core(), tcp_connect_message(), tcp_process_established(), tcp_process_listen(), tcp_process_packet(), tcp_process_syn_sent(), tcp_queue_packet(), tcp_queue_received_packet(), tcp_received_msg(), udp_process_packet(), udp_recvfrom_message(), and udp_sendto_message().
#define ERROR_DECLARE int ERROR_CODE |
An error processing routines declaration.
This has to be declared in the block where the error processing is desired.
Referenced by add_module(), arp_device_message(), arp_proto_create(), arp_receive_message(), closesocket(), eth_device_message(), eth_process_packet(), eth_receiver(), eth_send_message(), icmp_echo(), icmp_process_client_messages(), icmp_process_message(), icmp_process_packet(), icmp_received_msg(), icmp_send_packet(), ip_deliver_local(), ip_fragment_packet(), ip_fragment_packet_data(), ip_netif_initialize(), ip_prepare_packet(), ip_process_packet(), ip_send_route(), main(), module_start(), net_initialize(), net_initialize_build(), netif_get_addr_message(), netif_get_device_stats(), netif_probe_message(), netif_send_message(), netif_start_message(), nil_initialize(), nil_message(), nildummy_device_message(), nildummy_receiver(), packet_create(), packet_return(), parse_line(), read_configuration_file(), register_message(), socket(), socket_bind_insert(), socket_connection(), socket_port_add_core(), start_device(), startup(), tcp_accept_message(), tcp_close_message(), tcp_connect_core(), tcp_connect_message(), tcp_create_notification_packet(), tcp_get_packets_to_send(), 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(), tcp_received_msg(), tcp_recvfrom_message(), tcp_send_message(), tcp_send_prepare_packet(), udp_process_packet(), udp_recvfrom_message(), and udp_sendto_message().
#define ERROR_OCCURRED | ( | value | ) | ((ERROR_CODE = (value)) != EOK) |
Stores the value as an error code and checks if an error occurred.
[in] | value | The value to be checked. May be a function call. |
Referenced by add_module(), arp_device_message(), arp_proto_create(), eth_device_message(), eth_process_packet(), eth_receiver(), eth_send_message(), icmp_echo(), icmp_process_client_messages(), icmp_process_message(), icmp_received_msg(), icmp_send_packet(), ip_deliver_local(), ip_fragment_packet(), ip_netif_initialize(), ip_send_route(), main(), module_start(), netif_probe_message(), netif_start_message(), nil_initialize(), nildummy_device_message(), nildummy_receiver(), packet_create(), packet_return(), parse_line(), read_configuration_file(), socket(), socket_bind_insert(), socket_connection(), socket_port_add_core(), startup(), tcp_close_message(), tcp_connect_core(), tcp_connect_message(), tcp_get_packets_to_send(), 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(), tcp_received_msg(), tcp_send_prepare_packet(), udp_process_packet(), udp_recvfrom_message(), and udp_sendto_message().
#define ERROR_PROPAGATE | ( | value | ) | if(ERROR_OCCURRED(value)) return ERROR_CODE |
Checks if an error occurred and immediately exits the actual function returning the error code.
[in] | value | The value to be checked. May be a function call. |
Referenced by arp_receive_message(), closesocket(), icmp_echo(), icmp_process_packet(), ip_fragment_packet_data(), ip_netif_initialize(), ip_prepare_packet(), ip_process_packet(), main(), module_start(), net_initialize(), net_initialize_build(), netif_get_addr_message(), netif_get_device_stats(), netif_probe_message(), netif_send_message(), netif_start_message(), nil_initialize(), nil_message(), register_message(), start_device(), startup(), tcp_accept_message(), tcp_close_message(), tcp_connect_core(), tcp_create_notification_packet(), tcp_process_established(), tcp_process_syn_received(), tcp_queue_packet(), tcp_recvfrom_message(), tcp_send_message(), udp_recvfrom_message(), and udp_sendto_message().
#define ESOCKTNOSUPPORT (-10044) |
Socket type is not supported.
Referenced by socket().
#define ETHERNET_FILENAME "/srv/eth" |
Ethernet module full path filename.
Referenced by net_initialize().
#define ETHERNET_NAME "ethernet" |
Ethernet module name.
Referenced by net_initialize().
#define GENERIC_CHAR_MAP_DECLARE | ( | name, | |||
type | ) |
\ GENERIC_FIELD_DECLARE(name##_items, type) \ \ typedef struct name name##_t; \ typedef name##_t * name##_ref; \ \ struct name{ \ char_map_t names; \ name##_items_t values; \ int magic; \ }; \ \ int name##_add(name##_ref map, const char * name, const size_t length, type * value); \ int name##_count(name##_ref map); \ void name##_destroy(name##_ref map); \ void name##_exclude(name##_ref map, const char * name, const size_t length); \ type * name##_find(name##_ref map, const char * name, const size_t length); \ int name##_initialize(name##_ref map); \ int name##_is_valid(name##_ref map);
Character string to generic type map declaration.
[in] | name | Name of the map. |
[in] | type | Inner object type. |
#define GENERIC_CHAR_MAP_IMPLEMENT | ( | name, | |||
type | ) |
Character string to generic type map implementation.
Should follow declaration with the same parameters.
[in] | name | Name of the map. |
[in] | type | Inner object type. |
#define GENERIC_CHAR_MAP_MAGIC_VALUE 0x12345622 |
Internal magic value for a map consistency check.
#define GENERIC_FIELD_DECLARE | ( | name, | |||
type | ) |
\ typedef struct name name##_t; \ typedef name##_t * name##_ref; \ \ struct name{ \ int size; \ int next; \ type ** items; \ int magic; \ }; \ \ int name##_add(name##_ref field, type * value); \ int name##_count(name##_ref field); \ void name##_destroy(name##_ref field); \ void name##_exclude_index(name##_ref field, int index); \ type ** name##_get_field(name##_ref field); \ type * name##_get_index(name##_ref field, int index); \ int name##_initialize(name##_ref field); \ int name##_is_valid(name##_ref field);
Generic type field declaration.
[in] | name | Name of the field. |
[in] | type | Inner object type. |
#define GENERIC_FIELD_IMPLEMENT | ( | name, | |||
type | ) |
Generic type field implementation.
Should follow declaration with the same parameters.
[in] | name | Name of the field. |
[in] | type | Inner object type. |
#define GENERIC_FIELD_MAGIC_VALUE 0x55667788 |
Internal magic value for a field consistency check.
#define htonl | ( | number | ) | host2uint32_t_be(number) |
Converts the given long number (32 bit) from the host byte order to the network byte order (big endian).
[in] | number | The number in the host byte order to be converted. |
Referenced by eth_prepare_packet(), tcp_queue_prepare_packet(), and tcp_send_prepare_packet().
#define htons | ( | number | ) | host2uint16_t_be(number) |
Converts the given short number (16 bit) from the host byte order to the network byte order (big endian).
[in] | number | The number in the host byte order to be converted. |
Referenced by arp_receive_message(), arp_translate_message(), eth_prepare_packet(), eth_send_message(), ip_fragment_packet_data(), ip_prepare_packet(), main(), tcp_prepare_operation_header(), tcp_queue_prepare_packet(), tcp_send_prepare_packet(), and udp_sendto_message().
#define INET6_ADDRSTRLEN (8 * 4 + 7 + 1) |
INET6 string address maximum length.
Referenced by inet_ntop(), and main().
#define INET_ADDRSTRLEN (4 * 3 + 3 + 1) |
INET string address maximum length.
Referenced by inet_ntop().
#define INT_MAP_DECLARE | ( | name, | |||
type | ) |
Integer to generic type map declaration.
[in] | name | Name of the map. |
[in] | type | Inner object type. |
#define INT_MAP_IMPLEMENT | ( | name, | |||
type | ) |
Integer to generic type map implementation.
Should follow declaration with the same parameters.
[in] | name | Name of the map. |
[in] | type | Inner object type. |
#define INT_MAP_ITEM_MAGIC_VALUE 0x55667788 |
Internal magic value for an item consistency check.
#define INT_MAP_MAGIC_VALUE 0x11223344 |
Internal magic value for a map consistency check.
#define IP_CHECKSUM_ZERO 0xFFFFu |
IP checksum value for computed zero checksum.
Zero is returned as 0xFFFF (not flipped)
Referenced by icmp_process_packet(), ip_process_packet(), tcp_process_packet(), and udp_process_packet().
#define IP_FILENAME "/srv/ip" |
IP module full path filename.
Referenced by net_initialize_build().
#define IP_NAME "ip" |
IP module name.
Referenced by net_initialize_build().
#define IPC_GET_COUNT | ( | call | ) | (size_t) IPC_GET_ARG2(*call) |
Returns the count message argument.
[in] | call | The message call structure. |
#define IPC_GET_DEVICE | ( | call | ) | (device_id_t) IPC_GET_ARG1(*call) |
Returns the device identifier message argument.
[in] | call | The message call structure. |
Referenced by eth_receiver(), ip_get_route_req(), nil_message(), and nildummy_receiver().
#define IPC_GET_ERROR | ( | call | ) | (services_t) IPC_GET_ARG4(*call) |
Returns the error service message argument.
[in] | call | The message call structure. |
#define IPC_GET_MTU | ( | call | ) | (size_t) IPC_GET_ARG2(*call) |
Returns the maximum transmission unit message argument.
[in] | call | The message call structure. |
Referenced by nil_message().
#define IPC_GET_PACKET | ( | call | ) | (packet_id_t) IPC_GET_ARG2(*call) |
Returns the packet identifier message argument.
[in] | call | The message call structure. |
Referenced by eth_receiver(), icmp_process_message(), nil_message(), and nildummy_receiver().
#define IPC_GET_PHONE | ( | call | ) | (int) IPC_GET_ARG5(*call) |
Returns the phone message argument.
[in] | call | The message call structure. |
Referenced by nil_message(), tcp_process_client_messages(), and udp_process_client_messages().
#define IPC_GET_SENDER | ( | call | ) | (services_t) IPC_GET_ARG3(*call) |
Returns the sender service message argument.
[in] | call | The message call structure. |
#define IPC_GET_SERVICE | ( | call | ) | (services_t) IPC_GET_ARG3(*call) |
Returns the device driver service message argument.
[in] | call | The message call structure. |
Referenced by nil_message().
#define IPC_GET_STATE | ( | call | ) | (device_state_t) IPC_GET_ARG2(*call) |
Returns the device state message argument.
[in] | call | The message call structure. |
Referenced by eth_receiver(), and nildummy_receiver().
#define IPC_GET_TARGET | ( | call | ) | (services_t) IPC_GET_ARG3(*call) |
Returns the target service message argument.
[in] | call | The message call structure. |
#define IPC_SET_ADDR | ( | answer | ) | ((size_t *) &IPC_GET_ARG1(*answer)) |
Sets the minimum address length in the message answer.
[out] | answer | The message answer structure. |
Referenced by nil_message().
#define IPC_SET_CONTENT | ( | answer | ) | ((size_t *) &IPC_GET_ARG3(*answer)) |
Sets the maximum content size in the message answer.
[out] | answer | The message answer structure. |
Referenced by nil_message().
#define IPC_SET_DEVICE | ( | answer | ) | ((device_id_t *) &IPC_GET_ARG1(*answer)) |
Sets the device identifier in the message answer.
[out] | answer | The message answer structure. |
#define IPC_SET_PREFIX | ( | answer | ) | ((size_t *) &IPC_GET_ARG2(*answer)) |
Sets the minimum prefix size in the message answer.
[out] | answer | The message answer structure. |
Referenced by nil_message().
#define IPC_SET_SUFFIX | ( | answer | ) | ((size_t *) &IPC_GET_ARG4(*answer)) |
Sets the minimum suffix size in the message answer.
[out] | answer | The message answer structure. |
Referenced by nil_message().
#define IS_IN_INTERVAL | ( | item, | |||
first_inclusive, | |||||
last_exclusive | ) | (((item) >= (first_inclusive)) && ((item) < (last_exclusive))) |
Returns a value indicating whether the value is in the interval.
[in] | item | The value to be checked. |
[in] | first_inclusive | The first value in the interval inclusive. |
[in] | last_exclusive | The first value after the interval. |
Referenced by tcp_process_established().
#define IS_NET_ARP_MESSAGE | ( | call | ) | IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ARP_FIRST, NET_ARP_LAST) |
Returns a value indicating whether the IPC call is an ARP message.
[in] | call | The IPC call to be checked. |
#define IS_NET_ETH_MESSAGE | ( | call | ) | IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ETH_FIRST, NET_ETH_LAST) |
Returns a value indicating whether the IPC call is an Ethernet message.
[in] | call | The IPC call to be checked. |
#define IS_NET_ICMP_MESSAGE | ( | call | ) | IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ICMP_FIRST, NET_ICMP_LAST) |
Returns a value indicating whether the IPC call is an ICMP message.
[in] | call | The IPC call to be checked. |
#define IS_NET_IL_MESSAGE | ( | call | ) | IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IL_FIRST, NET_IL_LAST) |
Returns a value indicating whether the IPC call is an inter-network layer message.
[in] | call | The IPC call to be checked. |
#define IS_NET_IP_MESSAGE | ( | call | ) | IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IP_FIRST, NET_IP_LAST) |
Returns a value indicating whether the IPC call is an IP message.
[in] | call | The IPC call to be checked. |
#define IS_NET_MESSAGE | ( | call | ) | IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_FIRST, NET_LAST) |
Returns a value indicating whether the IPC call is a generic networking message.
[in] | call | The IPC call to be checked. |
#define IS_NET_NET_MESSAGE | ( | call | ) | IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NET_FIRST, NET_NET_LAST) |
Returns a value indicating whether the IPC call is a generic networking message.
[in] | call | The IPC call to be checked. |
#define IS_NET_NIL_MESSAGE | ( | call | ) | IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NIL_FIRST, NET_NIL_LAST) |
Returns a value indicating whether the IPC call is a network interface layer message.
[in] | call | The IPC call to be checked. |
#define IS_NET_PACKET_MESSAGE | ( | call | ) | IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_PACKET_FIRST, NET_PACKET_LAST) |
Returns a value indicating whether the IPC call is a packet manaagement system message.
[in] | call | The IPC call to be checked. |
Referenced by module_message().
#define IS_NET_SOCKET_MESSAGE | ( | call | ) | IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_SOCKET_FIRST, NET_SOCKET_LAST) |
Returns a value indicating whether the IPC call is a socket message.
[in] | call | The IPC call to be checked. |
#define IS_NET_TCP_MESSAGE | ( | call | ) | IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TCP_FIRST, NET_TCP_LAST) |
Returns a value indicating whether the IPC call is a TCP message.
[in] | call | The IPC call to be checked. |
#define IS_NET_TL_MESSAGE | ( | call | ) | IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TL_FIRST, NET_TL_LAST) |
Returns a value indicating whether the IPC call is a transport layer message.
[in] | call | The IPC call to be checked. |
#define IS_NET_UDP_MESSAGE | ( | call | ) | IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_UDP_FIRST, NET_UDP_LAST) |
Returns a value indicating whether the IPC call is a UDP message.
[in] | call | The IPC call to be checked. |
#define LO_FILENAME "/srv/lo" |
Loopback network interface module full path filename.
Referenced by net_initialize().
#define LO_NAME "lo" |
Loopback network interface module name.
Referenced by net_initialize().
#define MODULE_WAIT_TIME (10 * 1000) |
The time between connect requests in microseconds.
#define NAME "Networking startup" |
Networking startup module name.
#define NAME "Networking" |
Networking module name.
#define NET_ARP_COUNT 5 |
The number of ARP messages.
#define NET_ARP_FIRST (NET_IP_LAST + 0) |
The first ARP message.
#define NET_ARP_LAST (NET_ARP_FIRST + NET_ARP_COUNT) |
The last ARP message.
#define NET_COUNT (NET_LAST - NET_FIRST) |
The number of networking messages.
#define NET_ETH_COUNT 0 |
The number of Ethernet messages.
#define NET_ETH_FIRST (NET_NIL_LAST + 0) |
The first Ethernet message.
#define NET_ETH_LAST (NET_ETH_FIRST + NET_ETH_COUNT) |
The last Ethernet message.
#define NET_FIRST 2000 |
The first networking message.
#define NET_ICMP_COUNT 6 |
The number of ICMP messages.
#define NET_ICMP_FIRST (NET_ARP_LAST + 0) |
The first ICMP message.
#define NET_ICMP_LAST (NET_ICMP_FIRST + NET_ICMP_COUNT) |
The last ICMP message.
#define NET_IL_COUNT 6 |
The number of inter-network messages.
#define NET_IL_FIRST (NET_ETH_LAST + 0) |
The first inter-network message.
#define NET_IL_LAST (NET_IL_FIRST + NET_IL_COUNT) |
The last inter-network message.
#define NET_IP_COUNT 4 |
The number of IP messages.
#define NET_IP_FIRST (NET_IL_LAST + 0) |
The first IP message.
#define NET_IP_LAST (NET_IP_FIRST + NET_IP_COUNT) |
The last IP message.
#define NET_LAST NET_PACKET_LAST |
The last networking message.
#define NET_NET_COUNT 3 |
The number of general networking messages.
#define NET_NET_FIRST (NET_NETIF_LAST + 0) |
The first general networking message.
#define NET_NET_LAST (NET_NET_FIRST + NET_NET_COUNT) |
The last general networking message.
#define NET_NETIF_COUNT 6 |
The number of network interface driver messages.
#define NET_NETIF_FIRST NET_FIRST |
The first network interface layer message.
#define NET_NETIF_LAST (NET_NETIF_FIRST + NET_NETIF_COUNT) |
The last network interface layer message.
#define NET_NIL_COUNT 7 |
The number of network interface layer messages.
#define NET_NIL_FIRST (NET_NET_LAST + 0) |
The first network interface layer message.
#define NET_NIL_LAST (NET_NIL_FIRST + NET_NIL_COUNT) |
The last network interface layer message.
#define NET_PACKET_COUNT 5 |
The number of packet management system messages.
#define NET_PACKET_FIRST (NET_SOCKET_LAST + 0) |
The first packet management system message.
#define NET_PACKET_LAST (NET_PACKET_FIRST + NET_PACKET_COUNT) |
The last packet management system message.
#define NET_SELF_TEST 0 |
Activates the self test.
#define NET_SELF_TEST_CHAR_MAP 1 |
#define NET_SELF_TEST_CRC 1 |
Activates the CRC computation self test.
The NET_SELF_TEST has to be activated.
#define NET_SELF_TEST_DYNAMIC_FIFO 1 |
Activates the dynamic fifo self test.
The NET_SELF_TEST has to be activated.
#define NET_SELF_TEST_GENERIC_CHAR_MAP 1 |
Activates the generic char map self test.
The NET_SELF_TEST has to be activated.
#define NET_SELF_TEST_GENERIC_FIELD 1 |
Activates the generic field self test.
The NET_SELF_TEST has to be activated.
#define NET_SELF_TEST_INT_MAP 1 |
#define NET_SELF_TEST_MEASURED_STRINGS 1 |
Activates the measured strings self test.
The NET_SELF_TEST has to be activated.
#define NET_SOCKET_COUNT 14 |
The number of socket messages.
#define NET_SOCKET_FIRST (NET_TCP_LAST + 0) |
The first socket message.
#define NET_SOCKET_LAST (NET_SOCKET_FIRST + NET_SOCKET_COUNT) |
The last socket message.
#define NET_TCP_COUNT 0 |
The number of TCP messages.
#define NET_TCP_FIRST (NET_UDP_LAST + 0) |
The first TCP message.
#define NET_TCP_LAST (NET_TCP_FIRST + NET_TCP_COUNT) |
The last TCP message.
#define NET_TL_COUNT 1 |
The number of transport layer messages.
#define NET_TL_FIRST (NET_ICMP_LAST + 0) |
The first ICMP message.
#define NET_TL_LAST (NET_TL_FIRST + NET_TL_COUNT) |
The last ICMP message.
#define NET_UDP_COUNT 0 |
The number of UDP messages.
#define NET_UDP_FIRST (NET_TL_LAST + 0) |
The first UDP message.
#define NET_UDP_LAST (NET_UDP_FIRST + NET_UDP_COUNT) |
The last UDP message.
#define NEXT_INDEX | ( | fifo, | |||
index | ) | (((index) + 1) % ((fifo)->size + 1)) |
Returns the next queue index.
The queue field is circular.
[in] | fifo | The dynamic queue. |
[in] | index | The actual index to be shifted. |
#define NILDUMMY_FILENAME "/srv/nildummy" |
Ethernet module full path filename.
Referenced by net_initialize().
#define NILDUMMY_NAME "nildummy" |
Ethernet module name.
Referenced by net_initialize().
#define NO_DATA (-11004) |
No data.
#define ntohl | ( | number | ) | uint32_t_be2host(number) |
Converts the given long number (32 bit) from the network byte order (big endian) to the host byte order.
[in] | number | The number in the network byte order to be converted. |
Referenced by eth_process_packet(), tcp_process_acknowledgement(), tcp_process_established(), tcp_process_listen(), tcp_process_syn_received(), tcp_process_syn_sent(), and tcp_send_prepare_packet().
#define ntohs | ( | number | ) | uint16_t_be2host(number) |
Converts the given short number (16 bit) from the network byte order (big endian) to the host byte order.
[in] | number | The number in the network byte order to be converted. |
Referenced by arp_receive_message(), eth_prepare_packet(), eth_process_packet(), main(), tcp_process_acknowledgement(), tcp_process_listen(), tcp_process_packet(), udp_process_packet(), and udp_recvfrom_message().
#define REGISTER_ME | ( | me, | |||
phonehash | ) | ipc_connect_to_me(PHONE_NS, (me), 0, 0, (phonehash)) |
Registers the module service at the name server.
[in] | me | The module service. |
[out] | phonehash | The created phone hash. |
Referenced by module_start(), and netif_initialize().
#define self_test | ( | ) | EOK |
Self test start function.
Runs all the configured self tests.
Referenced by main().
#define TRY_AGAIN (-11002) |
The requested operation was not performed.
Try again later.
typedef struct addrinfo addrinfo_t |
Type definition of the address information.
typedef char_map_t* char_map_ref |
Type definition of the character string to integer map pointer.
typedef struct char_map char_map_t |
Type definition of the character string to integer map.
typedef int connect_module_t(services_t need) |
Connect to the needed module function type definition.
[in] | need | The needed module service. |
typedef dyn_fifo_t* dyn_fifo_ref |
Type definition of the dynamic fifo queue pointer.
typedef struct dyn_fifo dyn_fifo_t |
Type definition of the dynamic fifo queue.
typedef struct in6_addr in6_addr_t |
Type definition of the INET6 address.
typedef measured_string_t* measured_string_ref |
Type definition of the character string with measured length pointer.
typedef struct measured_string measured_string_t |
Type definition of the character string with measured length.
typedef module_t* module_ref |
Type definition of the module structure pointer.
typedef struct module_struct module_t |
Type definition of the module structure.
typedef struct net_globals net_globals_t |
Type definition of the networking module global data.
Type definition of the network interface specific data pointer.
typedef struct sockaddr_in6 sockaddr_in6_t |
Type definition of the INET6 socket address.
typedef struct sockaddr_in sockaddr_in_t |
Type definition of the INET socket address.
typedef struct sockaddr sockaddr_t |
enum net_messages |
Networking subsystem central module messages.
NET_NET_GET_CONF |
Returns the general configuration.
|
NET_NET_GET_DEVICE_CONF |
Returns the device specific configuration.
|
NET_NET_STARTUP |
Starts the networking stack. |
int add_configuration | ( | measured_strings_ref | configuration, | |
const char * | name, | |||
const char * | value | |||
) |
Adds the configured setting to the configuration map.
[in] | configuration | The configuration map. |
[in] | name | The setting name. |
[in] | value | The setting value. |
int add_module | ( | module_ref * | module, | |
modules_ref | modules, | |||
const char * | name, | |||
const char * | filename, | |||
services_t | service, | |||
task_id_t | task_id, | |||
connect_module_t * | connect_module | |||
) |
Adds module to the module map.
[out] | module | The module structure added. |
[in] | modules | The module map. |
[in] | name | The module name. |
[in] | filename | The full path filename. |
[in] | service | The module service. |
[in] | task_id | The module current task identifier. Zero (0) means not running. |
[in] | connect_module | The module connecting function. |
int add_module | ( | module_ref * | module, | |
modules_ref | modules, | |||
const char * | name, | |||
const char * | filename, | |||
services_t | service, | |||
task_id_t | task_id, | |||
connect_module_t | connect_module | |||
) |
References module_struct::connect_module, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, module_struct::filename, free, module_struct::name, module_struct::phone, module_struct::service, module_struct::task_id, and module_struct::usage.
Referenced by net_initialize(), and net_initialize_build().
void answer_call | ( | ipc_callid_t | callid, | |
int | result, | |||
ipc_call_t * | answer, | |||
int | answer_count | |||
) |
Answers the call.
[in] | callid | The call identifier. |
[in] | result | The message processing result. |
[in] | answer | The message processing answer. |
[in] | answer_count | The number of answer parameters. |
Referenced by client_connection(), icmp_process_client_messages(), tcp_process_client_messages(), and udp_process_client_messages().
int bind_service | ( | services_t | need, | |
ipcarg_t | arg1, | |||
ipcarg_t | arg2, | |||
ipcarg_t | arg3, | |||
async_client_conn_t | client_receiver | |||
) |
Creates bidirectional connection with the needed module service and registers the message receiver.
[in] | need | The needed module service. |
[in] | arg1 | The first parameter. |
[in] | arg2 | The second parameter. |
[in] | arg3 | The third parameter. |
[in] | client_receiver | The message receiver. |
Referenced by ip_bind_service(), and netif_bind_service().
int bind_service_timeout | ( | services_t | need, | |
ipcarg_t | arg1, | |||
ipcarg_t | arg2, | |||
ipcarg_t | arg3, | |||
async_client_conn_t | client_receiver, | |||
suseconds_t | timeout | |||
) |
Creates bidirectional connection with the needed module service and registers the message receiver.
[in] | need | The needed module service. |
[in] | arg1 | The first parameter. |
[in] | arg2 | The second parameter. |
[in] | arg3 | The third parameter. |
[in] | client_receiver | The message receiver. |
[in] | timeout | The connection timeout in microseconds. No timeout if set to zero (0). |
Referenced by socket_get_tcp_phone(), and socket_get_udp_phone().
int char_map_add | ( | char_map_ref | map, | |
const char * | identifier, | |||
size_t | length, | |||
const int | value | |||
) |
Adds the value with the key to the map.
[in,out] | map | The character string to integer map. |
[in] | identifier | The key zero ('\0') terminated character string. The key character string is processed until the first terminating zero ('\0') character after the given length is found. |
[in] | length | The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\0') character is found. |
[in] | value | The integral value to be stored for the key character string. |
Referenced by startup().
int char_map_add_item | ( | char_map_ref | map, | |
const char * | identifier, | |||
size_t | length, | |||
const int | value | |||
) |
Adds the value with the key to the map.
Creates new nodes to map the key.
[in,out] | map | The character string to integer map. |
[in] | identifier | The key zero ('\0') terminated character string. The key character string is processed until the first terminating zero ('\0') character after the given length is found. |
[in] | length | The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\0') character is found. |
[in] | value | The integral value to be stored for the key character string. |
References char_map::c, char_map_initialize(), CHAR_MAP_NULL, free, char_map::items, char_map::next, char_map::size, and char_map::value.
void char_map_destroy | ( | char_map_ref | map | ) |
Clears and destroys the map.
[in,out] | map | The character string to integer map. |
int char_map_exclude | ( | char_map_ref | map, | |
const char * | identifier, | |||
size_t | length | |||
) |
Excludes the value assigned to the key from the map.
The entry is cleared from the map.
[in,out] | map | The character string to integer map. |
[in] | identifier | The key zero ('\0') terminated character string. The key character string is processed until the first terminating zero ('\0') character after the given length is found. |
[in] | length | The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\0') character is found. |
int char_map_find | ( | const char_map_ref | map, | |
const char * | identifier, | |||
size_t | length | |||
) |
Returns the value assigned to the key from the map.
[in] | map | The character string to integer map. |
[in] | identifier | The key zero ('\0') terminated character string. The key character string is processed until the first terminating zero ('\0') character after the given length is found. |
[in] | length | The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\0') character is found. |
char_map_ref char_map_find_node | ( | const char_map_ref | map, | |
const char * | identifier, | |||
const size_t | length | |||
) |
Returns the node assigned to the key from the map.
[in] | map | The character string to integer map. |
[in] | identifier | The key zero ('\0') terminated character string. The key character string is processed until the first terminating zero ('\0') character after the given length is found. |
[in] | length | The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\0') character is found. |
References char_map::c, char_map_is_valid(), char_map::items, and char_map::next.
int char_map_get_value | ( | const char_map_ref | map | ) |
Returns the value assigned to the map.
[in] | map | The character string to integer map. |
References char_map_is_valid(), CHAR_MAP_NULL, and char_map::value.
int char_map_initialize | ( | char_map_ref | map | ) |
Initializes the map.
[in,out] | map | The character string to integer map. |
Referenced by char_map_add_item(), and net_initialize().
int char_map_is_valid | ( | const char_map_ref | map | ) |
Checks if the map is valid.
[in] | map | The character string to integer map. |
References CHAR_MAP_MAGIC_VALUE, and char_map::magic.
Referenced by char_map_find_node(), and char_map_get_value().
int char_map_update | ( | char_map_ref | map, | |
const char * | identifier, | |||
size_t | length, | |||
const int | value | |||
) |
Adds or updates the value with the key to the map.
[in,out] | map | The character string to integer map. |
[in] | identifier | The key zero ('\0') terminated character string. The key character string is processed until the first terminating zero ('\0') character after the given length is found. |
[in] | length | The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\0') character is found. |
[in] | value | The integral value to be stored for the key character string. |
void client_connection | ( | ipc_callid_t | iid, | |
ipc_call_t * | icall | |||
) |
Default thread for new connections.
[in] | iid | The initial message identifier. |
[in] | icall | The initial message call structure. |
References answer_call(), module_message(), and refresh_answer().
uint16_t compact_checksum | ( | uint32_t | sum | ) |
Compacts the computed checksum to the 16 bit number adding the carries.
[in] | sum | Computed checksum. |
Referenced by tcp_process_packet(), tcp_send_prepare_packet(), udp_process_packet(), and udp_sendto_message().
uint32_t compute_checksum | ( | uint32_t | seed, | |
uint8_t * | data, | |||
size_t | length | |||
) |
Computes sum of the 2 byte fields.
Padds one zero (0) byte if odd.
[in] | seed | Initial value. Often used as 0 or ~0. |
[in] | data | Pointer to the beginning of data to process. |
[in] | length | Length of the data in bytes. |
Referenced by tcp_process_packet(), tcp_send_prepare_packet(), udp_process_packet(), and udp_sendto_message().
uint32_t compute_crc32_be | ( | uint32_t | seed, | |
uint8_t * | data, | |||
size_t | length | |||
) |
Computes CRC32 value in the big-endian environment.
[in] | seed | Initial value. Often used as 0 or ~0. |
[in] | data | Pointer to the beginning of data to process. |
[in] | length | Length of the data in bits. |
uint32_t compute_crc32_le | ( | uint32_t | seed, | |
uint8_t * | data, | |||
size_t | length | |||
) |
Computes CRC32 value in the little-endian environment.
[in] | seed | Initial value. Often used as 0 or ~0. |
[in] | data | Pointer to the beginning of data to process. |
[in] | length | Length of the data in bits. |
int connect_to_service | ( | services_t | need | ) |
Connects to the needed module.
[in] | need | The needed module service. |
Referenced by arp_connect_module(), ip_connect_module(), main(), net_connect_module(), and net_initialize().
int connect_to_service_timeout | ( | services_t | need, | |
suseconds_t | timeout | |||
) |
Connects to the needed module.
[in] | need | The needed module service. |
[in] | timeout | The connection timeout in microseconds. No timeout if set to zero (0). |
Referenced by icmp_connect_module().
int data_receive | ( | void ** | data, | |
size_t * | length | |||
) |
Receives data from the other party.
The received data buffer is allocated and returned.
[out] | data | The data buffer to be filled. |
[out] | length | The buffer length. |
Referenced by tcp_process_client_messages(), and udp_process_client_messages().
int data_reply | ( | void * | data, | |
size_t | data_length | |||
) |
Replies the data to the other party.
[in] | data | The data buffer to be sent. |
[in] | data_length | The buffer length. |
Referenced by tcp_accept_message(), tcp_recvfrom_message(), and udp_recvfrom_message().
int dyn_fifo_destroy | ( | dyn_fifo_ref | fifo | ) |
Clears and destroys the queue.
[in,out] | fifo | The dynamic queue. |
Referenced by socket(), socket_destroy(), and socket_destroy_core().
int dyn_fifo_initialize | ( | dyn_fifo_ref | fifo, | |
int | size | |||
) |
Initializes the dynamic queue.
[in,out] | fifo | The dynamic queue. |
[in] | size | The initial queue size. |
Referenced by socket_initialize().
int dyn_fifo_is_valid | ( | dyn_fifo_ref | fifo | ) |
Checks if the queue is valid.
[in] | fifo | The dynamic queue. |
References DYN_FIFO_MAGIC_VALUE, and dyn_fifo::magic_value.
int dyn_fifo_pop | ( | dyn_fifo_ref | fifo | ) |
Returns and excludes the first item in the queue.
[in,out] | fifo | The dynamic queue. |
Referenced by accept(), recvfrom_core(), socket_destroy(), socket_destroy_core(), tcp_accept_message(), tcp_recvfrom_message(), and udp_recvfrom_message().
int dyn_fifo_push | ( | dyn_fifo_ref | fifo, | |
int | value, | |||
int | max_size | |||
) |
Appends a new item to the queue end.
[in,out] | fifo | The dynamic queue. |
[in] | value | The new item value. Should be positive. |
[in] | max_size | The maximum queue size. The queue is not resized beyound this limit. May be zero or negative (<=0) to indicate no limit. |
Referenced by socket_connection(), tcp_process_syn_received(), tcp_queue_received_packet(), and udp_process_packet().
int dyn_fifo_value | ( | dyn_fifo_ref | fifo | ) |
Returns and keeps the first item in the queue.
[in,out] | fifo | The dynamic queue. |
Referenced by accept(), recvfrom_core(), tcp_accept_message(), tcp_recvfrom_message(), and udp_recvfrom_message().
uint16_t flip_checksum | ( | uint16_t | checksum | ) |
Returns or flips the checksum if zero.
[in] | checksum | The computed checksum. |
Referenced by tcp_process_packet(), tcp_send_prepare_packet(), udp_process_packet(), and udp_sendto_message().
device_id_t generate_new_device_id | ( | void | ) |
Generates new system-unique device identifier.
Referenced by startup().
module_ref get_running_module | ( | modules_ref | modules, | |
char * | name | |||
) |
Searches and returns the specified module.
If the module is not running, the module filaname is spawned. If the module is not connected, the connect_function is called.
[in] | modules | The module map. |
[in] | name | The module name. |
Referenced by ip_netif_initialize(), and start_device().
int inet_ntop | ( | uint16_t | family, | |
const uint8_t * | data, | |||
char * | address, | |||
size_t | length | |||
) |
Prints the address into the character buffer.
[in] | family | The address family. |
[in] | data | The address data. |
[out] | address | The character buffer to be filled. |
[in] | length | The buffer length. |
References AF_INET, AF_INET6, INET6_ADDRSTRLEN, and INET_ADDRSTRLEN.
Referenced by main().
int inet_pton | ( | uint16_t | family, | |
const char * | address, | |||
uint8_t * | data | |||
) |
Parses the character string into the address.
If the string is shorter than the full address, zero bytes are added.
[in] | family | The address family. |
[in] | address | The character buffer to be parsed. |
[out] | data | The address data to be filled. |
The base number of the values.
The number of bytes per a section.
The number of bytes of the address data.
References AF_INET, AF_INET6, and count.
Referenced by ip_netif_initialize(), and main().
uint16_t ip_checksum | ( | uint8_t * | data, | |
size_t | length | |||
) |
Computes the ip header checksum.
To compute the checksum of a new packet, the checksum header field must be zero. To check the checksum of a received packet, the checksum may be left set. The zero (0) value will be returned in this case if valid.
[in] | data | The header data. |
[in] | length | The header length in bytes. |
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Starts the module.
Module entry point.
argc | The count of the command line arguments. Ignored parameter. | |
argv | The command line parameters. Ignored parameter. |
[in] | argc | The number of command line parameters. |
[in] | argv | The command line parameters. |
References connect_to_service(), ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, NAME, NET_NET_STARTUP, self_test, and spawn().
measured_string_ref measured_string_copy | ( | measured_string_ref | source | ) |
Copies the given measured string with separated header and data parts.
[in] | source | The source measured string to be copied. |
measured_string_ref measured_string_create_bulk | ( | const char * | string, | |
size_t | length | |||
) |
Creates a new measured string bundled with a copy of the given string itself as one memory block.
If the measured string is being freed, whole memory block is freed. The measured string should be used only as a constant.
[in] | string | The initial character string to be stored. |
[in] | length | The length of the given string without the terminating zero ('/0') character. If the length is zero (0), the actual length is computed. The given length is used and appended with the terminating zero ('\0') character otherwise. |
Referenced by arp_receive_message(), nil_initialize(), and parse_line().
int measured_strings_receive | ( | measured_string_ref * | strings, | |
char ** | data, | |||
size_t | count | |||
) |
Receives a measured strings array from a calling module.
Creates the array and the data memory blocks. This method should be used only while processing IPC messages as the array size has to be negotiated in advance.
[out] | strings | The received measured strings array. |
[out] | data | The measured strings data. This memory block stores the actual character strings. |
[in] | count | The size of the measured strings array. |
int measured_strings_reply | ( | const measured_string_ref | strings, | |
size_t | count | |||
) |
Replies the given measured strings array to a calling module.
This method should be used only while processing IPC messages as the array size has to be negotiated in advance.
[in] | strings | The measured strings array to be transferred. |
[in] | count | The measured strings array size. |
Referenced by nil_message().
int measured_strings_return | ( | int | phone, | |
measured_string_ref * | strings, | |||
char ** | data, | |||
size_t | count | |||
) |
Receives a measured strings array from another module.
Creates the array and the data memory blocks. This method should be used only following other IPC messages as the array size has to be negotiated in advance.
[in] | phone | The other module phone. |
[out] | strings | The returned measured strings array. |
[out] | data | The measured strings data. This memory block stores the actual character strings. |
[in] | count | The size of the measured strings array. |
Referenced by generic_get_addr_req(), and generic_translate_req().
int measured_strings_send | ( | int | phone, | |
const measured_string_ref | strings, | |||
size_t | count | |||
) |
Sends the given measured strings array to another module.
This method should be used only following other IPC messages as the array size has to be negotiated in advance.
[in] | phone | The other module phone. |
[in] | strings | The measured strings array to be transferred. |
[in] | count | The measured strings array size. |
Referenced by arp_clear_address_req(), arp_device_req(), and generic_translate_req().
int module_message | ( | ipc_callid_t | callid, | |
ipc_call_t * | call, | |||
ipc_call_t * | answer, | |||
int * | answer_count | |||
) |
External message processing function.
Processes the module message.
Should process the messages. The function has to be defined in each module.
[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. |
Distributes the message to the right bundled module.
[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 IS_NET_PACKET_MESSAGE, net_message(), and packet_server_message().
void module_print_name | ( | void | ) |
int module_start | ( | async_client_conn_t | client_connection | ) |
External module startup function.
Starts the networking module.
Should start and initialize the module and register the given client connection function. The function has to be defined in each module.
[in] | client_connection | The client connection function to be registered. |
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_initialize(), pm_destroy(), pm_init(), and REGISTER_ME.
int net_connect_module | ( | services_t | service | ) |
Connects to the networking module.
service | The networking module service. Ignored parameter. |
References connect_to_service().
Referenced by module_start().
void net_free_settings | ( | measured_string_ref | settings, | |
char * | data | |||
) |
Frees the received settings.
[in] | settings | The received settings. |
[in] | data | The received settings data. |
References free.
Referenced by eth_device_message(), and ip_netif_initialize().
int net_get_conf | ( | measured_strings_ref | netif_conf, | |
measured_string_ref | configuration, | |||
size_t | count, | |||
char ** | data | |||
) |
Returns the configured values.
The network interface configuration is searched first.
[in] | netif_conf | The network interface configuration setting. |
[out] | configuration | The found configured values. |
[in] | count | The desired settings count. |
[out] | data | The found configuration settings data. |
References net_globals::configuration, measured_string::length, and measured_string::value.
int net_get_conf_req | ( | int | net_phone, | |
measured_string_ref * | configuration, | |||
size_t | count, | |||
char ** | data | |||
) |
Returns the global configuration.
The configuration names are read and the appropriate settings are set instead. Call net_free_settings() function to release the returned configuration.
[in] | net_phone | The networking module phone. |
[in,out] | configuration | The requested configuration. The names are read and the appropriate settings are set instead. |
[in] | count | The configuration entries count. |
[in,out] | data | The configuration and settings data. |
References generic_translate_req(), and NET_NET_GET_DEVICE_CONF.
int net_get_device_conf_req | ( | int | net_phone, | |
device_id_t | device_id, | |||
measured_string_ref * | configuration, | |||
size_t | count, | |||
char ** | data | |||
) |
Returns the device specific configuration.
Returns the global configuration if the device specific is not found. The configuration names are read and the appropriate settings are set instead. Call net_free_settings() function to release the returned configuration.
[in] | net_phone | The networking module phone. |
[in] | device_id | The device identifier. |
[in,out] | configuration | The requested device configuration. The names are read and the appropriate settings are set instead. |
[in] | count | The configuration entries count. |
[in,out] | data | The configuration and settings data. |
References generic_translate_req(), and NET_NET_GET_DEVICE_CONF.
Referenced by eth_device_message(), and ip_netif_initialize().
int net_initialize | ( | async_client_conn_t | client_connection | ) |
Initializes the networking module.
[in] | client_connection | The client connection processing function. The module skeleton propagates its own one. |
References add_module(), char_map_initialize(), net_globals::configuration, connect_to_service(), DP8390_FILENAME, DP8390_NAME, ERROR_DECLARE, ERROR_PROPAGATE, ETHERNET_FILENAME, ETHERNET_NAME, LO_FILENAME, LO_NAME, net_globals::modules, net_initialize_build(), net_globals::netif_names, net_globals::netifs, NILDUMMY_FILENAME, NILDUMMY_NAME, and read_configuration().
Referenced by module_start().
int net_initialize_build | ( | async_client_conn_t | client_connection | ) |
Initializes the networking module for the chosen subsystem build type.
[in] | client_connection | The client connection processing function. The module skeleton propagates its own one. |
References add_module(), ERROR_DECLARE, ERROR_PROPAGATE, ip_connect_module(), IP_FILENAME, IP_NAME, net_globals::modules, and spawn().
Referenced by net_initialize().
int net_message | ( | ipc_callid_t | callid, | |
ipc_call_t * | call, | |||
ipc_call_t * | answer, | |||
int * | answer_count | |||
) |
Processes the networking 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 parse_line | ( | measured_strings_ref | configuration, | |
char * | line | |||
) |
References ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, free, and measured_string_create_bulk().
Referenced by read_configuration_file().
size_t * prepare_lengths | ( | const measured_string_ref | strings, | |
size_t | count | |||
) |
Computes the lengths of the measured strings in the given array.
[in] | strings | The measured strings array to be processed. |
[in] | count | The measured strings array size. |
References measured_string::length.
int read_configuration | ( | void | ) |
Reads the networking subsystem global configuration.
References CONF_DIR, CONF_GENERAL_FILE, net_globals::configuration, and read_configuration_file().
Referenced by net_initialize().
int read_configuration_file | ( | const char * | directory, | |
const char * | filename, | |||
measured_strings_ref | configuration | |||
) |
References BUFFER_SIZE, ERROR_DECLARE, ERROR_OCCURRED, and parse_line().
Referenced by read_configuration(), and read_netif_configuration().
int read_netif_configuration | ( | const char * | name, | |
netif_ref | netif | |||
) |
Reads the network interface specific configuration.
[in] | name | The network interface name. |
[in,out] | netif | The network interface structure. |
References CONF_DIR, netif::configuration, and read_configuration_file().
Referenced by startup().
void refresh_answer | ( | ipc_call_t * | answer, | |
int * | answer_count | |||
) |
Refreshes answer structure and parameters count.
Erases all attributes.
[in,out] | answer | The message processing answer structure. |
[in,out] | answer_count | The number of answer parameters. |
Referenced by client_connection(), icmp_process_client_messages(), tcp_process_client_messages(), and udp_process_client_messages().
task_id_t spawn | ( | const char * | fname | ) |
Starts the module.
Starts the given module.
[in] | fname | The module absolute name. |
[in] | fname | The module full or relative path filename. |
Referenced by main(), and net_initialize_build().
int start_device | ( | netif_ref | netif | ) |
Starts the network interface according to its configuration.
Registers the network interface with the subsystem modules. Starts the needed subsystem modules.
[in] | netif | The network interface specific data. |
References CONF_IL, CONF_IO, CONF_IRQ, CONF_MTU, CONF_NETIF, CONF_NIL, net_globals::configuration, netif::configuration, netif::driver, ERROR_DECLARE, ERROR_PROPAGATE, get_running_module(), netif::id, netif::il, ip_device_req(), net_globals::modules, netif_probe_req(), netif_start_req(), netif::nil, nil_device_req, module_struct::phone, module_struct::service, and measured_string::value.
Referenced by startup().
int startup | ( | void | ) |
Reads the configuration and starts all network interfaces.
References char_map_add(), CONF_NAME, netif::configuration, netif::driver, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, free, generate_new_device_id(), netif::id, netif::il, module_struct::name, netif::name, net_globals::netif_names, net_globals::netifs, netif::nil, read_netif_configuration(), start_device(), module_struct::usage, and measured_string::value.
Networking module global data.
Networking module global data.
Networking module global data.