Networking common message definitions. More...
#include <async.h>
#include <ipc/ipc.h>
#include <ipc/services.h>
#include "include/device.h"
#include "structures/measured_strings.h"
#include "structures/packet/packet.h"
Defines | |
#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. | |
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. | |
Functions | |
static int | generic_device_state_msg (int phone, int message, device_id_t device_id, int state, services_t target) |
Notifies the module about the device state change. | |
static int | generic_device_req (int phone, int message, device_id_t device_id, int arg2, services_t service) |
Notifies a module about the device. | |
static int | generic_get_addr_req (int phone, int message, device_id_t device_id, measured_string_ref *address, char **data) |
Returns the address. | |
static int | generic_packet_size_req (int phone, int message, device_id_t device_id, packet_dimension_ref packet_dimension) |
Returns the device packet dimension for sending. | |
static int | generic_received_msg (int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t target, services_t error) |
Passes the packet queue to the module. | |
static int | generic_send_msg (int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t sender, services_t error) |
Sends the packet queue. | |
static int | generic_translate_req (int phone, int message, device_id_t device_id, services_t service, measured_string_ref configuration, size_t count, measured_string_ref *translation, char **data) |
Translates the given strings. |
Networking common message definitions.
static int generic_device_req | ( | int | phone, | |
int | message, | |||
device_id_t | device_id, | |||
int | arg2, | |||
services_t | service | |||
) | [inline, static] |
Notifies a module about the device.
[in] | phone | The service module phone. |
[in] | message | The service specific message. |
[in] | device_id | The device identifier. |
[in] | arg2 | The second argument of the message. |
[in] | service | The device module service. |
Referenced by ip_device_req().
static int generic_device_state_msg | ( | int | phone, | |
int | message, | |||
device_id_t | device_id, | |||
int | state, | |||
services_t | target | |||
) | [inline, static] |
Notifies the module about the device state change.
[in] | phone | The service module phone. |
[in] | message | The service specific message. |
[in] | device_id | The device identifier. |
[in] | state | The new device state. |
[in] | target | The target module service. |
Referenced by il_device_state_msg(), il_mtu_changed_msg(), and nil_device_state_msg().
static int generic_get_addr_req | ( | int | phone, | |
int | message, | |||
device_id_t | device_id, | |||
measured_string_ref * | address, | |||
char ** | data | |||
) | [inline, static] |
Returns the address.
[in] | phone | The service module phone. |
[in] | message | The service specific message. |
[in] | device_id | The device identifier. |
[out] | address | The desired address. |
[out] | data | The address data container. |
References free, and measured_strings_return().
Referenced by netif_get_addr_req().
static int generic_packet_size_req | ( | int | phone, | |
int | message, | |||
device_id_t | device_id, | |||
packet_dimension_ref | packet_dimension | |||
) | [inline, static] |
Returns the device packet dimension for sending.
[in] | phone | The service module phone. |
[in] | message | The service specific message. |
[in] | device_id | The device identifier. |
[out] | packet_dimension | The packet dimension. |
References packet_dimension::addr_len, packet_dimension::content, packet_dimension::prefix, and packet_dimension::suffix.
Referenced by ip_packet_size_req().
static int generic_received_msg | ( | int | phone, | |
int | message, | |||
device_id_t | device_id, | |||
packet_id_t | packet_id, | |||
services_t | target, | |||
services_t | error | |||
) | [inline, static] |
Passes the packet queue to the module.
[in] | phone | The service module phone. |
[in] | message | The service specific message. |
[in] | device_id | The device identifier. |
[in] | packet_id | The received packet or the received packet queue identifier. |
[in] | target | The target module service. |
[in] | error | The error module service. |
Referenced by il_received_msg(), ip_received_error_msg(), nil_received_msg(), and tl_received_msg().
static int generic_send_msg | ( | int | phone, | |
int | message, | |||
device_id_t | device_id, | |||
packet_id_t | packet_id, | |||
services_t | sender, | |||
services_t | error | |||
) | [inline, static] |
Sends the packet queue.
[in] | phone | The service module phone. |
[in] | message | The service specific message. |
[in] | device_id | The device identifier. |
[in] | packet_id | The packet or the packet queue identifier. |
[in] | sender | The sending module service. |
[in] | error | The error module service. |
Referenced by ip_send_msg(), and netif_send_msg().
static int generic_translate_req | ( | int | phone, | |
int | message, | |||
device_id_t | device_id, | |||
services_t | service, | |||
measured_string_ref | configuration, | |||
size_t | count, | |||
measured_string_ref * | translation, | |||
char ** | data | |||
) | [inline, static] |
Translates the given strings.
Allocates and returns the needed memory block as the data parameter.
[in] | phone | The service module phone. |
[in] | message | The service specific message. |
[in] | device_id | The device identifier. |
[in] | service | The module service. |
[in] | configuration | The key strings. |
[in] | count | The number of configuration keys. |
[out] | translation | The translated values. |
[out] | data | The translation data container. |
References free, measured_strings_return(), and measured_strings_send().
Referenced by arp_translate_req(), net_get_conf_req(), and net_get_device_conf_req().