Networking Stack
[HelenOS Services]

Collaboration diagram for Networking Stack:

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_tnetif_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_tchar_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_tdyn_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_tmeasured_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_tmodule_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 Documentation

#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.

Parameters:
[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.
Returns:
The computed CRC32 of the length bits of the data.

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.

Parameters:
[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)

The destination address required.

Referenced by connect(), and sendto().

#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)
#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
#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)
#define ERROR_PROPAGATE ( value   )     if(ERROR_OCCURRED(value)) return ERROR_CODE
#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   ) 
Value:
\
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.

Parameters:
[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.

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   ) 
Value:
\
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.

Parameters:
[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.

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).

Parameters:
[in] number The number in the host byte order to be converted.
Returns:
The number in the network byte order.

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).

Parameters:
[in] number The number in the host byte order to be converted.
Returns:
The number in the network byte order.

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.

Parameters:
[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.

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.

Parameters:
[in] call The message call structure.
#define IPC_GET_DEVICE ( call   )     (device_id_t) IPC_GET_ARG1(*call)

Returns the device identifier message argument.

Parameters:
[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.

Parameters:
[in] call The message call structure.
#define IPC_GET_MTU ( call   )     (size_t) IPC_GET_ARG2(*call)

Returns the maximum transmission unit message argument.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[in] call The message call structure.
#define IPC_GET_SERVICE ( call   )     (services_t) IPC_GET_ARG3(*call)

Returns the device driver service message argument.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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

Activates the char map self test.

The NET_SELF_TEST has to be activated.

See also:
char_map.h
#define NET_SELF_TEST_CRC   1

Activates the CRC computation self test.

The NET_SELF_TEST has to be activated.

See also:
crc.h
#define NET_SELF_TEST_DYNAMIC_FIFO   1

Activates the dynamic fifo self test.

The NET_SELF_TEST has to be activated.

See also:
dynamic_fifo.h
#define NET_SELF_TEST_GENERIC_CHAR_MAP   1

Activates the generic char map self test.

The NET_SELF_TEST has to be activated.

See also:
generic_char_map.h
#define NET_SELF_TEST_GENERIC_FIELD   1

Activates the generic field self test.

The NET_SELF_TEST has to be activated.

See also:
generic_field.h
#define NET_SELF_TEST_INT_MAP   1

Activates the integral map self test.

The NET_SELF_TEST has to be activated.

See also:
int_map.h
#define NET_SELF_TEST_MEASURED_STRINGS   1

Activates the measured strings self test.

The NET_SELF_TEST has to be activated.

See also:
measured_strings.h
#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.

Parameters:
[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.

Parameters:
[in] number The number in the network byte order to be converted.
Returns:
The number in the host byte order.

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.

Parameters:
[in] number The number in the network byte order to be converted.
Returns:
The number in the host byte order.

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.

Parameters:
[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.

See also:
configuration.h
Returns:
EOK on success.
The first error occurred.

Referenced by main().

#define TRY_AGAIN   (-11002)

The requested operation was not performed.

Try again later.


Typedef Documentation

typedef struct addrinfo addrinfo_t

Type definition of the address information.

See also:
addrinfo

Type definition of the character string to integer map pointer.

See also:
char_map
typedef struct char_map char_map_t

Type definition of the character string to integer map.

See also:
char_map
typedef int connect_module_t(services_t need)

Connect to the needed module function type definition.

Parameters:
[in] need The needed module service.
Returns:
The phone of the needed service.

Type definition of the dynamic fifo queue pointer.

See also:
dyn_fifo
typedef struct dyn_fifo dyn_fifo_t

Type definition of the dynamic fifo queue.

See also:
dyn_fifo
typedef struct in6_addr in6_addr_t

Type definition of the INET6 address.

See also:
in6_addr
typedef struct in_addr in_addr_t

Type definition of the INET address.

See also:
in_addr

Type definition of the character string with measured length pointer.

See also:
measured_string

Type definition of the character string with measured length.

See also:
measured_string
typedef module_t* module_ref

Type definition of the module structure pointer.

See also:
module_struct
typedef struct module_struct module_t

Type definition of the module structure.

See also:
module_struct
typedef struct net_globals net_globals_t

Type definition of the networking module global data.

See also:
net_globals
typedef netif_t* netif_ref

Type definition of the network interface specific data pointer.

See also:
netif
typedef struct netif netif_t

Type definition of the network interface specific data.

See also:
netif
typedef struct sockaddr_in6 sockaddr_in6_t

Type definition of the INET6 socket address.

See also:
sockaddr_in6
typedef struct sockaddr_in sockaddr_in_t

Type definition of the INET socket address.

See also:
sockaddr_in
typedef struct sockaddr sockaddr_t

Type definition of the socket address.

See also:
sockaddr

Enumeration Type Documentation

Networking subsystem central module messages.

Enumerator:
NET_NET_GET_CONF 

Returns the general configuration.

See also:
net_get_conf_req()
NET_NET_GET_DEVICE_CONF 

Returns the device specific configuration.

See also:
net_get_device_conf_req()
NET_NET_STARTUP 

Starts the networking stack.


Function Documentation

int add_configuration ( measured_strings_ref  configuration,
const char *  name,
const char *  value 
)

Adds the configured setting to the configuration map.

Parameters:
[in] configuration The configuration map.
[in] name The setting name.
[in] value The setting value.
Returns:
EOK on success.
ENOMEM if there is not enough memory left.
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.

Parameters:
[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.
Returns:
EOK on success.
ENOMEM if there is not enough memory left.
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 
)
void answer_call ( ipc_callid_t  callid,
int  result,
ipc_call_t *  answer,
int  answer_count 
)

Answers the call.

Parameters:
[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().

Here is the caller graph for this function:

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.

Parameters:
[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.
Returns:
The phone of the needed service.
Other error codes as defined for the ipc_connect_to_me() function.

Referenced by ip_bind_service(), and netif_bind_service().

Here is the caller graph for this function:

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.

Parameters:
[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).
Returns:
The phone of the needed service.
ETIMEOUT if the connection timeouted.
Other error codes as defined for the ipc_connect_to_me() function.

Referenced by socket_get_tcp_phone(), and socket_get_udp_phone().

Here is the caller graph for this function:

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.

Parameters:
[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.
Returns:
EOK on success.
EINVAL if the map is not valid.
EINVAL if the identifier parameter is NULL.
EINVAL if the length parameter zero (0) and the identifier parameter is an empty character string (the first character is the terminating zero ('\0') character.
EEXIST if the key character string is already used.
Other error codes as defined for the char_map_add_item() function.

Referenced by startup().

Here is the caller graph for this function:

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.

Parameters:
[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.
Returns:
EOK on success.
ENOMEM if there is not enough memory left.
EEXIST if the key character string is already used.

References char_map::c, char_map_initialize(), CHAR_MAP_NULL, free, char_map::items, char_map::next, char_map::size, and char_map::value.

Here is the call graph for this function:

void char_map_destroy ( char_map_ref  map  ) 

Clears and destroys the map.

Parameters:
[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.

Parameters:
[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.
Returns:
The integral value assigned to the key character string.
CHAR_MAP_NULL if the key is not assigned a value.
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.

Parameters:
[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.
Returns:
The integral value assigned to the key character string.
CHAR_MAP_NULL if the key is not assigned a value.
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.

Parameters:
[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.
Returns:
The node holding the integral value assigned to the key character string.
NULL if the key is not assigned a node.

References char_map::c, char_map_is_valid(), char_map::items, and char_map::next.

Here is the call graph for this function:

int char_map_get_value ( const char_map_ref  map  ) 

Returns the value assigned to the map.

Parameters:
[in] map The character string to integer map.
Returns:
The integral value assigned to the map.
CHAR_MAP_NULL if the map is not assigned a value.

References char_map_is_valid(), CHAR_MAP_NULL, and char_map::value.

Here is the call graph for this function:

int char_map_initialize ( char_map_ref  map  ) 

Initializes the map.

Parameters:
[in,out] map The character string to integer map.
Returns:
EOK on success.
EINVAL if the map parameter is NULL.
ENOMEM if there is not enough memory left.

Referenced by char_map_add_item(), and net_initialize().

Here is the caller graph for this function:

int char_map_is_valid ( const char_map_ref  map  ) 

Checks if the map is valid.

Parameters:
[in] map The character string to integer map.
Returns:
TRUE if the map is valid.
FALSE otherwise.

References CHAR_MAP_MAGIC_VALUE, and char_map::magic.

Referenced by char_map_find_node(), and char_map_get_value().

Here is the caller graph for this function:

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.

Parameters:
[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.
Returns:
EOK on success.
EINVAL if the map is not valid.
EINVAL if the identifier parameter is NULL.
EINVAL if the length parameter zero (0) and the identifier parameter is an empty character string (the first character is the terminating zero ('\0) character.
EEXIST if the key character string is already used.
Other error codes as defined for the char_map_add_item() function.
void client_connection ( ipc_callid_t  iid,
ipc_call_t *  icall 
)

Default thread for new connections.

Parameters:
[in] iid The initial message identifier.
[in] icall The initial message call structure.

References answer_call(), module_message(), and refresh_answer().

Here is the call graph for this function:

uint16_t compact_checksum ( uint32_t  sum  ) 

Compacts the computed checksum to the 16 bit number adding the carries.

Parameters:
[in] sum Computed checksum.
Returns:
Compacted computed checksum to the 16 bits.

Referenced by tcp_process_packet(), tcp_send_prepare_packet(), udp_process_packet(), and udp_sendto_message().

Here is the caller graph for this function:

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.

Parameters:
[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.
Returns:
The computed checksum of the length bytes of the data.

Referenced by tcp_process_packet(), tcp_send_prepare_packet(), udp_process_packet(), and udp_sendto_message().

Here is the caller graph for this function:

uint32_t compute_crc32_be ( uint32_t  seed,
uint8_t *  data,
size_t  length 
)

Computes CRC32 value in the big-endian environment.

Parameters:
[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.
Returns:
The computed CRC32 of the length bits of the data.
uint32_t compute_crc32_le ( uint32_t  seed,
uint8_t *  data,
size_t  length 
)

Computes CRC32 value in the little-endian environment.

Parameters:
[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.
Returns:
The computed CRC32 of the length bits of the data.
int connect_to_service ( services_t  need  ) 

Connects to the needed module.

Parameters:
[in] need The needed module service.
Returns:
The phone of the needed service.

Referenced by arp_connect_module(), ip_connect_module(), main(), net_connect_module(), and net_initialize().

Here is the caller graph for this function:

int connect_to_service_timeout ( services_t  need,
suseconds_t  timeout 
)

Connects to the needed module.

Parameters:
[in] need The needed module service.
[in] timeout The connection timeout in microseconds. No timeout if set to zero (0).
Returns:
The phone of the needed service.
ETIMEOUT if the connection timeouted.

Referenced by icmp_connect_module().

Here is the caller graph for this function:

int data_receive ( void **  data,
size_t *  length 
)

Receives data from the other party.

The received data buffer is allocated and returned.

Parameters:
[out] data The data buffer to be filled.
[out] length The buffer length.
Returns:
EOK on success.
EBADMEM if the data or the length parameter is NULL.
EINVAL if the client does not send data.
ENOMEM if there is not enough memory left.
Other error codes as defined for the async_data_write_finalize() function.

Referenced by tcp_process_client_messages(), and udp_process_client_messages().

Here is the caller graph for this function:

int data_reply ( void *  data,
size_t  data_length 
)

Replies the data to the other party.

Parameters:
[in] data The data buffer to be sent.
[in] data_length The buffer length.
Returns:
EOK on success.
EINVAL if the client does not expect the data.
EOVERFLOW if the client does not expect all the data. Only partial data are transfered.
Other error codes as defined for the async_data_read_finalize() function.

Referenced by tcp_accept_message(), tcp_recvfrom_message(), and udp_recvfrom_message().

Here is the caller graph for this function:

int dyn_fifo_destroy ( dyn_fifo_ref  fifo  ) 

Clears and destroys the queue.

Parameters:
[in,out] fifo The dynamic queue.
Returns:
EOK on success.
EINVAL if the queue is not valid.

Referenced by socket(), socket_destroy(), and socket_destroy_core().

Here is the caller graph for this function:

int dyn_fifo_initialize ( dyn_fifo_ref  fifo,
int  size 
)

Initializes the dynamic queue.

Parameters:
[in,out] fifo The dynamic queue.
[in] size The initial queue size.
Returns:
EOK on success.
EINVAL if the queue is not valid.
EBADMEM if the fifo parameter is NULL.
ENOMEM if there is not enough memory left.

Referenced by socket_initialize().

Here is the caller graph for this function:

int dyn_fifo_is_valid ( dyn_fifo_ref  fifo  ) 

Checks if the queue is valid.

Parameters:
[in] fifo The dynamic queue.
Returns:
TRUE if the queue is valid.
FALSE otherwise.

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.

Parameters:
[in,out] fifo The dynamic queue.
Returns:
Value of the first item in the queue.
EINVAL if the queue is not valid.
ENOENT if the queue is empty.

Referenced by accept(), recvfrom_core(), socket_destroy(), socket_destroy_core(), tcp_accept_message(), tcp_recvfrom_message(), and udp_recvfrom_message().

Here is the caller graph for this function:

int dyn_fifo_push ( dyn_fifo_ref  fifo,
int  value,
int  max_size 
)

Appends a new item to the queue end.

Parameters:
[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.
Returns:
EOK on success.
EINVAL if the queue is not valid.
ENOMEM if there is not enough memory left.

Referenced by socket_connection(), tcp_process_syn_received(), tcp_queue_received_packet(), and udp_process_packet().

Here is the caller graph for this function:

int dyn_fifo_value ( dyn_fifo_ref  fifo  ) 

Returns and keeps the first item in the queue.

Parameters:
[in,out] fifo The dynamic queue.
Returns:
Value of the first item in the queue.
EINVAL if the queue is not valid.
ENOENT if the queue is empty.

Referenced by accept(), recvfrom_core(), tcp_accept_message(), tcp_recvfrom_message(), and udp_recvfrom_message().

Here is the caller graph for this function:

uint16_t flip_checksum ( uint16_t  checksum  ) 

Returns or flips the checksum if zero.

Parameters:
[in] checksum The computed checksum.
Returns:
The internet protocol header checksum.
0xFFFF if the computed checksum is zero.

Referenced by tcp_process_packet(), tcp_send_prepare_packet(), udp_process_packet(), and udp_sendto_message().

Here is the caller graph for this function:

device_id_t generate_new_device_id ( void   ) 

Generates new system-unique device identifier.

Returns:
The system-unique devic identifier.

Referenced by startup().

Here is the caller graph for this function:

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.

Parameters:
[in] modules The module map.
[in] name The module name.
Returns:
The running module found. It does not have to be connected.
NULL if there is no such module.

Referenced by ip_netif_initialize(), and start_device().

Here is the caller graph for this function:

int inet_ntop ( uint16_t  family,
const uint8_t *  data,
char *  address,
size_t  length 
)

Prints the address into the character buffer.

Parameters:
[in] family The address family.
[in] data The address data.
[out] address The character buffer to be filled.
[in] length The buffer length.
Returns:
EOK on success.
EINVAL if the data or address parameter is NULL.
ENOMEM if the character buffer is not long enough.
ENOTSUP if the address family is not supported.

References AF_INET, AF_INET6, INET6_ADDRSTRLEN, and INET_ADDRSTRLEN.

Referenced by main().

Here is the caller graph for this function:

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.

Parameters:
[in] family The address family.
[in] address The character buffer to be parsed.
[out] data The address data to be filled.
Returns:
EOK on success.
EINVAL if the data parameter is NULL.
ENOENT if the address parameter is NULL.
ENOTSUP if the address family is not supported.

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().

Here is the caller graph for this function:

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.

Parameters:
[in] data The header data.
[in] length The header length in bytes.
Returns:
The internet protocol header checksum.
0xFFFF if the computed checksum is zero.
int main ( int  argc,
char *  argv[] 
)

Starts the module.

Module entry point.

Parameters:
argc The count of the command line arguments. Ignored parameter.
argv The command line parameters. Ignored parameter.
Returns:
EOK on success.
Other error codes as defined for each specific module start function.
Parameters:
[in] argc The number of command line parameters.
[in] argv The command line parameters.
Returns:
EOK on success.
EINVAL if the net module cannot be started.
Other error codes as defined for the self_test() function.
Other error codes as defined for the NET_NET_STARTUP message.

References connect_to_service(), ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, NAME, NET_NET_STARTUP, self_test, and spawn().

Here is the call graph for this function:

measured_string_ref measured_string_copy ( measured_string_ref  source  ) 

Copies the given measured string with separated header and data parts.

Parameters:
[in] source The source measured string to be copied.
Returns:
The copy of the given measured string.
NULL if the source parameter is NULL.
NULL if there is not enough memory left.
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.

Parameters:
[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.
Returns:
The new bundled character string with measured length.
NULL if there is not enough memory left.

Referenced by arp_receive_message(), nil_initialize(), and parse_line().

Here is the caller graph for this function:

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.

Parameters:
[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.
Returns:
EOK on success.
EINVAL if the strings or data parameter is NULL.
EINVAL if the count parameter is zero (0).
EINVAL if the sent array differs in size.
EINVAL if there is inconsistency in sent measured strings' lengths (should not occur).
ENOMEM if there is not enough memory left.
Other error codes as defined for the async_data_write_finalize() function.
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.

Parameters:
[in] strings The measured strings array to be transferred.
[in] count The measured strings array size.
Returns:
EOK on success.
EINVAL if the strings parameter is NULL.
EINVAL if the count parameter is zero (0).
EINVAL if the calling module does not accept the given array size.
EINVAL if there is inconsistency in sent measured strings' lengths (should not occur).
Other error codes as defined for the async_data_read_finalize() function.

Referenced by nil_message().

Here is the caller graph for this function:

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.

Parameters:
[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.
Returns:
EOK on success.
EINVAL if the strings or data parameter is NULL.
EINVAL if the phone or count parameter is not positive (<=0).
EINVAL if the sent array differs in size.
ENOMEM if there is not enough memory left.
Other error codes as defined for the async_data_read_start() function.

Referenced by generic_get_addr_req(), and generic_translate_req().

Here is the caller graph for this function:

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.

Parameters:
[in] phone The other module phone.
[in] strings The measured strings array to be transferred.
[in] count The measured strings array size.
Returns:
EOK on success.
EINVAL if the strings parameter is NULL.
EINVAL if the phone or count parameter is not positive (<=0).
Other error codes as defined for the async_data_write_start() function.

Referenced by arp_clear_address_req(), arp_device_req(), and generic_translate_req().

Here is the caller graph for this function:

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.

Parameters:
[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.
Returns:
EOK on success.
ENOTSUP if the message is not known.
Other error codes as defined for each specific module message function.

Distributes the message to the right bundled module.

Parameters:
[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.
Returns:
EOK on success.
ENOTSUP if the message is not known.
Other error codes as defined for each bundled module message function.

References IS_NET_PACKET_MESSAGE, net_message(), and packet_server_message().

Here is the call graph for this function:

void module_print_name ( void   ) 

External function to print the module name.

Prints the module name.

Should print the module name. The function has to be defined in each module.

See also:
NAME

References NAME.

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.

Parameters:
[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.

Parameters:
[in] client_connection The client connection processing function. The module skeleton propagates its own one.
Returns:
EOK on successful module termination.
Other error codes as defined for the net_initialize() function.
Other error codes as defined for the REGISTER_ME() macro function.

References ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, net_initialize(), pm_destroy(), pm_init(), and REGISTER_ME.

Here is the call graph for this function:

int net_connect_module ( services_t  service  ) 

Connects to the networking module.

Parameters:
service The networking module service. Ignored parameter.
Returns:
The networking module phone on success.
0 if called by the bundle module.

References connect_to_service().

Referenced by module_start().

Here is the call graph for this function:

Here is the caller graph for this function:

void net_free_settings ( measured_string_ref  settings,
char *  data 
)

Frees the received settings.

Parameters:
[in] settings The received settings.
[in] data The received settings data.
See also:
net_get_device_conf_req()
net_get_conf_req()

References free.

Referenced by eth_device_message(), and ip_netif_initialize().

Here is the caller graph for this function:

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.

Parameters:
[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.
Returns:
EOK.

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.

Parameters:
[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.
Returns:
EOK on success.
EINVAL if the configuration is NULL.
EINVAL if the count is zero (0).
Other error codes as defined for the generic_translate_req() function.

References generic_translate_req(), and NET_NET_GET_DEVICE_CONF.

Here is the call graph for this function:

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.

Parameters:
[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.
Returns:
EOK on success.
EINVAL if the configuration is NULL.
EINVAL if the count is zero (0).
Other error codes as defined for the generic_translate_req() function.

References generic_translate_req(), and NET_NET_GET_DEVICE_CONF.

Referenced by eth_device_message(), and ip_netif_initialize().

Here is the call graph for this function:

Here is the caller graph for this function:

int net_initialize ( async_client_conn_t  client_connection  ) 

Initializes the networking module.

Parameters:
[in] client_connection The client connection processing function. The module skeleton propagates its own one.
Returns:
EOK on success.
ENOMEM if there is not enough memory left.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

int net_initialize_build ( async_client_conn_t  client_connection  ) 

Initializes the networking module for the chosen subsystem build type.

Parameters:
[in] client_connection The client connection processing function. The module skeleton propagates its own one.
Returns:
EOK on success.
ENOMEM if there is not enough memory left.

References add_module(), ERROR_DECLARE, ERROR_PROPAGATE, ip_connect_module(), IP_FILENAME, IP_NAME, net_globals::modules, and spawn().

Referenced by net_initialize().

Here is the call graph for this function:

Here is the caller graph for this function:

int net_message ( ipc_callid_t  callid,
ipc_call_t *  call,
ipc_call_t *  answer,
int *  answer_count 
)

Processes the networking message.

Parameters:
[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.
Returns:
EOK on success.
ENOTSUP if the message is not known.
See also:
net_interface.h
IS_NET_NET_MESSAGE()

Referenced by module_message().

Here is the caller graph for this function:

int parse_line ( measured_strings_ref  configuration,
char *  line 
)
Todo:

References ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, free, and measured_string_create_bulk().

Referenced by read_configuration_file().

Here is the call graph for this function:

Here is the caller graph for this function:

size_t * prepare_lengths ( const measured_string_ref  strings,
size_t  count 
)

Computes the lengths of the measured strings in the given array.

Parameters:
[in] strings The measured strings array to be processed.
[in] count The measured strings array size.
Returns:
The computed sizes array.
NULL if there is not enough memory left.

References measured_string::length.

int read_configuration ( void   ) 

Reads the networking subsystem global configuration.

Returns:
EOK on success.
Other error codes as defined for the add_configuration() function.

References CONF_DIR, CONF_GENERAL_FILE, net_globals::configuration, and read_configuration_file().

Referenced by net_initialize().

Here is the call graph for this function:

Here is the caller graph for this function:

int read_configuration_file ( const char *  directory,
const char *  filename,
measured_strings_ref  configuration 
)
Todo:

References BUFFER_SIZE, ERROR_DECLARE, ERROR_OCCURRED, and parse_line().

Referenced by read_configuration(), and read_netif_configuration().

Here is the call graph for this function:

Here is the caller graph for this function:

int read_netif_configuration ( const char *  name,
netif_ref  netif 
)

Reads the network interface specific configuration.

Parameters:
[in] name The network interface name.
[in,out] netif The network interface structure.
Returns:
EOK on success.
Other error codes as defined for the add_configuration() function.

References CONF_DIR, netif::configuration, and read_configuration_file().

Referenced by startup().

Here is the call graph for this function:

Here is the caller graph for this function:

void refresh_answer ( ipc_call_t *  answer,
int *  answer_count 
)

Refreshes answer structure and parameters count.

Erases all attributes.

Parameters:
[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().

Here is the caller graph for this function:

task_id_t spawn ( const char *  fname  ) 

Starts the module.

Starts the given module.

Parameters:
[in] fname The module absolute name.
Returns:
The started module task identifier.
Other error codes as defined for the task_spawn() function.
Parameters:
[in] fname The module full or relative path filename.
Returns:
The new module task identifier on success.
0 if there is no such module.

Referenced by main(), and net_initialize_build().

Here is the caller graph for this function:

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.

Parameters:
[in] netif The network interface specific data.
Returns:
EOK on success.
EINVAL if there are some settings missing.
ENOENT if the internet protocol module is not known.
Other error codes as defined for the netif_probe_req() function.
Other error codes as defined for the nil_device_req() function.
Other error codes as defined for the needed internet layer registering function.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

int startup ( void   ) 

Reads the configuration and starts all network interfaces.

Returns:
EOK on success.
EXDEV if there is no available system-unique device identifier.
EINVAL if any of the network interface names are not configured.
ENOMEM if there is not enough memory left.
Other error codes as defined for the read_configuration() function.
Other error codes as defined for the read_netif_configuration() function.
Other error codes as defined for the start_device() function.

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.

Here is the call graph for this function:


Variable Documentation

Networking module global data.

Networking module global data.

Networking module global data.


Generated on Thu Mar 11 20:46:29 2010 for Networking and TCP/IP stack for HelenOS system by  doxygen 1.6.1