Data Structures | |
struct | arp_device |
ARP address map. More... | |
struct | arp_globals |
ARP global data. More... | |
struct | arp_proto |
ARP protocol specific data. More... | |
struct | arp_header |
ARP protocol header. More... | |
Files | |
file | arp.c |
ARP module implementation. | |
file | arp.h |
ARP module. | |
file | arp_header.h |
ARP protocol header. | |
file | arp_messages.h |
ARP module messages. | |
file | arp_module.c |
ARP standalone module implementation. | |
file | arp_module.h |
ARP module functions. | |
file | arp_oc.h |
ARP operation codes according to the on-line IANA - Address Resolution Protocol (ARP) Parameters - <http://www.iana.org/assignments/arp-parameters/arp-parameters.xml>, cited January 14 2009. | |
file | arp_remote.c |
ARP interface implementation for standalone remote modules. | |
file | arp_interface.h |
ARP module interface. | |
Defines | |
#define | NAME "ARP protocol" |
ARP module name. | |
Typedefs | |
typedef struct arp_device | arp_device_t |
Type definition of the ARP device specific data. | |
typedef arp_device_t * | arp_device_ref |
Type definition of the ARP device specific data pointer. | |
typedef struct arp_globals | arp_globals_t |
Type definition of the ARP global data. | |
typedef struct arp_proto | arp_proto_t |
Type definition of the ARP protocol specific data. | |
typedef arp_proto_t * | arp_proto_ref |
Type definition of the ARP protocol specific data pointer. | |
typedef struct arp_header | arp_header_t |
Type definition of an ARP protocol header. | |
typedef arp_header_t * | arp_header_ref |
Type definition of an ARP protocol header pointer. | |
Enumerations | |
enum | arp_messages { NET_ARP_CLEAN_CACHE = NET_ARP_FIRST, NET_ARP_CLEAR_ADDRESS, NET_ARP_CLEAR_DEVICE, NET_ARP_DEVICE, NET_ARP_TRANSLATE } |
ARP module messages. More... | |
Functions | |
void | arp_clear_device (arp_device_ref device) |
Clears the device specific data. | |
int | arp_proto_create (arp_proto_ref *proto, services_t service, measured_string_ref address) |
Creates new protocol specific data. | |
int | arp_initialize (async_client_conn_t client_connection) |
Initializes the ARP module. | |
int | arp_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count) |
Processes the ARP message. | |
int | module_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count) |
Processes the ARP message. | |
void | module_print_name (void) |
Prints the module name. | |
int | module_start (async_client_conn_t client_connection) |
Starts the ARP module. | |
Variables | |
arp_globals_t | arp_globals |
ARP global data. | |
arp_globals_t | arp_globals |
ARP module global data. | |
Message processing functions | |
| |
int | arp_device_message (device_id_t device_id, services_t service, services_t protocol, measured_string_ref address) |
Registers the device. | |
int | arp_mtu_changed_message (device_id_t device_id, size_t mtu) |
Updates the device content length according to the new MTU value. | |
int | arp_receive_message (device_id_t device_id, packet_t packet) |
Processes the received ARP packet. | |
measured_string_ref | arp_translate_message (device_id_t device_id, services_t protocol, measured_string_ref target) |
Returns the hardware address for the given protocol address. | |
ARP module interface | |
This interface is used by other modules. | |
int | arp_clean_cache_req (int arp_phone) |
Cleans the cache. | |
int | arp_clear_address_req (int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address) |
Clears the given protocol address from the cache. | |
int | arp_clear_device_req (int arp_phone, device_id_t device_id) |
Clears the device cache. | |
int | arp_connect_module (services_t service) |
Connects to the ARP module. | |
int | arp_device_req (int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address) |
Registers the new device and the requesting protocol service. | |
task_id_t | arp_task_get_id (void) |
Returns the ARP task identifier. | |
int | arp_translate_req (int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref *translation, char **data) |
Translates the given protocol address to the network interface address. | |
ARP specific message parameters definitions | |
| |
#define | ARP_GET_NETIF(call) (services_t) IPC_GET_ARG2(*call) |
Returns the protocol service message parameter. | |
ARP operation codes definitions | |
| |
#define | ARPOP_REQUEST 1 |
REQUEST operation code. | |
#define | ARPOP_REPLY 2 |
REPLY operation code. | |
#define | ARPOP_RREQUEST 3 |
Reverse request operation code. | |
#define | ARPOP_RREPLY 4 |
Reverse reply operation code. | |
#define | ARPOP_DRARP_Request 5 |
DRARP-Request operation code. | |
#define | ARPOP_DRARP_Reply 6 |
DRARP-Reply operation code. | |
#define | ARPOP_DRARP_Error 7 |
DRARP-Error operation code. | |
#define | ARPOP_InREQUEST 8 |
InARP-Request operation code. | |
#define | ARPOP_InREPLY 9 |
InARP-Reply operation code. | |
#define | ARPOP_NAK 10 |
ARP-NAK operation code. | |
#define | ARPOP_MARS_Request 11 |
MARS-Request operation code. | |
#define | ARPOP_MARS_Multi 12 |
MARS-Multi operation code. | |
#define | ARPOP_MARS_MServ 13 |
MARS-MServ operation code. | |
#define | ARPOP_MARS_Join 14 |
MARS-Join operation code. | |
#define | ARPOP_MARS_Leave 15 |
MARS-Leave operation code. | |
#define | ARPOP_MARS_NAK 16 |
MARS-NAK operation code. | |
#define | ARPOP_MARS_Unserv 17 |
MARS-Unserv operation code. | |
#define | ARPOP_MARS_SJoin 18 |
MARS-SJoin operation code. | |
#define | ARPOP_MARS_SLeave 19 |
MARS-SLeave operation code. | |
#define | ARPOP_MARS_Grouplist_Request 20 |
MARS-Grouplist-Request operation code. | |
#define | ARPOP_MARS_Grouplist_Reply 21 |
MARS-Grouplist-Reply operation code. | |
#define | ARPOP_MARS_Redirect_Map 22 |
MARS-Redirect-Map operation code. | |
#define | ARPOP_MAPOS_UNARP 23 |
MAPOS-UNARP operation code. |
#define ARP_GET_NETIF | ( | call | ) | (services_t) IPC_GET_ARG2(*call) |
Returns the protocol service message parameter.
[in] | call | The message call structure. |
#define ARPOP_DRARP_Error 7 |
DRARP-Error operation code.
#define ARPOP_DRARP_Reply 6 |
DRARP-Reply operation code.
#define ARPOP_DRARP_Request 5 |
DRARP-Request operation code.
#define ARPOP_InREPLY 9 |
InARP-Reply operation code.
#define ARPOP_InREQUEST 8 |
InARP-Request operation code.
#define ARPOP_MAPOS_UNARP 23 |
MAPOS-UNARP operation code.
#define ARPOP_MARS_Grouplist_Reply 21 |
MARS-Grouplist-Reply operation code.
#define ARPOP_MARS_Grouplist_Request 20 |
MARS-Grouplist-Request operation code.
#define ARPOP_MARS_Join 14 |
MARS-Join operation code.
#define ARPOP_MARS_Leave 15 |
MARS-Leave operation code.
#define ARPOP_MARS_MServ 13 |
MARS-MServ operation code.
#define ARPOP_MARS_Multi 12 |
MARS-Multi operation code.
#define ARPOP_MARS_NAK 16 |
MARS-NAK operation code.
#define ARPOP_MARS_Redirect_Map 22 |
MARS-Redirect-Map operation code.
#define ARPOP_MARS_Request 11 |
MARS-Request operation code.
#define ARPOP_MARS_SJoin 18 |
MARS-SJoin operation code.
#define ARPOP_MARS_SLeave 19 |
MARS-SLeave operation code.
#define ARPOP_MARS_Unserv 17 |
MARS-Unserv operation code.
#define ARPOP_NAK 10 |
ARP-NAK operation code.
#define ARPOP_REPLY 2 |
REPLY operation code.
Referenced by arp_receive_message().
#define ARPOP_REQUEST 1 |
REQUEST operation code.
Referenced by arp_receive_message(), and arp_translate_message().
#define ARPOP_RREPLY 4 |
Reverse reply operation code.
#define ARPOP_RREQUEST 3 |
Reverse request operation code.
#define NAME "ARP protocol" |
ARP module name.
typedef arp_device_t* arp_device_ref |
Type definition of the ARP device specific data pointer.
typedef struct arp_device arp_device_t |
Type definition of the ARP device specific data.
typedef struct arp_globals arp_globals_t |
Type definition of the ARP global data.
typedef arp_header_t* arp_header_ref |
Type definition of an ARP protocol header pointer.
typedef struct arp_header arp_header_t |
Type definition of an ARP protocol header.
typedef arp_proto_t* arp_proto_ref |
Type definition of the ARP protocol specific data pointer.
typedef struct arp_proto arp_proto_t |
Type definition of the ARP protocol specific data.
enum arp_messages |
ARP module messages.
NET_ARP_CLEAN_CACHE |
Clean cache message.
|
NET_ARP_CLEAR_ADDRESS |
Clear address cache message.
|
NET_ARP_CLEAR_DEVICE |
Clear device cache message.
|
NET_ARP_DEVICE |
New device message.
|
NET_ARP_TRANSLATE |
Address translation message.
|
int arp_clean_cache_req | ( | int | arp_phone | ) |
Cleans the cache.
[in] | arp_phone | The ARP module phone used for (semi)remote calls. |
References NET_ARP_CLEAN_CACHE.
int arp_clear_address_req | ( | int | arp_phone, | |
device_id_t | device_id, | |||
services_t | protocol, | |||
measured_string_ref | address | |||
) |
Clears the given protocol address from the cache.
[in] | arp_phone | The ARP module phone used for (semi)remote calls. |
[in] | device_id | The device identifier. |
[in] | protocol | The requesting protocol service. |
[in] | address | The protocol address to be cleared. |
References measured_strings_send(), and NET_ARP_CLEAR_ADDRESS.
void arp_clear_device | ( | arp_device_ref | device | ) |
Clears the device specific data.
[in] | device | The device specific data. |
References arp_proto::addr, arp_proto::addr_data, arp_proto::addresses, free, and arp_device::protos.
int arp_clear_device_req | ( | int | arp_phone, | |
device_id_t | device_id | |||
) |
Clears the device cache.
[in] | arp_phone | The ARP module phone used for (semi)remote calls. |
[in] | device_id | The device identifier. |
References NET_ARP_CLEAR_DEVICE.
int arp_connect_module | ( | services_t | service | ) |
Connects to the ARP module.
service | The ARP module service. Ignored parameter. |
References connect_to_service().
int arp_device_message | ( | device_id_t | device_id, | |
services_t | service, | |||
services_t | protocol, | |||
measured_string_ref | address | |||
) |
Registers the device.
Creates new device entry in the cache or updates the protocol address if the device with the device identifier and the driver service exists.
[in] | device_id | The device identifier. |
[in] | service | The device driver service. |
[in] | protocol | The protocol service. |
[in] | address | The actual device protocol address. |
References arp_device::addr, arp_proto::addr, arp_device::addr_data, arp_proto::addr_data, arp_proto_create(), arp_device::broadcast_addr, arp_device::broadcast_data, arp_globals::cache, arp_globals::client_connection, arp_device::device_id, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, free, arp_device::hardware, hardware_map(), arp_globals::lock, nil_bind_service, nil_get_addr_req, nil_get_broadcast_addr_req, nil_packet_size_req, arp_device::packet_dimension, arp_device::phone, arp_device::protos, arp_proto::service, arp_device::service, and measured_string::value.
int arp_device_req | ( | int | arp_phone, | |
device_id_t | device_id, | |||
services_t | protocol, | |||
services_t | netif, | |||
measured_string_ref | address | |||
) |
Registers the new device and the requesting protocol service.
Connects to the network interface layer service. Determines the device broadcast address, its address lengths and packet size.
[in] | arp_phone | The ARP module phone used for (semi)remote calls. |
[in] | device_id | The new device identifier. |
[in] | protocol | The requesting protocol service. |
[in] | netif | The underlying device network interface layer service. |
[in] | address | The local requesting protocol address of the device. |
References measured_strings_send(), and NET_ARP_DEVICE.
Referenced by ip_netif_initialize().
int arp_initialize | ( | async_client_conn_t | client_connection | ) |
Initializes the ARP module.
[in] | client_connection | The client connection processing function. The module skeleton propagates its own one. |
Referenced by module_start().
int arp_message | ( | ipc_callid_t | callid, | |
ipc_call_t * | call, | |||
ipc_call_t * | answer, | |||
int * | answer_count | |||
) |
Processes the ARP message.
[in] | callid | The message identifier. |
[in] | call | The message parameters. |
[out] | answer | The message answer parameters. |
[out] | answer_count | The last parameter for the actual answer in the answer parameter. |
Referenced by module_message().
int arp_mtu_changed_message | ( | device_id_t | device_id, | |
size_t | mtu | |||
) |
Updates the device content length according to the new MTU value.
[in] | device_id | The device identifier. |
[in] | mtu | The new mtu value. |
References arp_globals::cache, packet_dimension::content, arp_globals::lock, and arp_device::packet_dimension.
int arp_proto_create | ( | arp_proto_ref * | proto, | |
services_t | service, | |||
measured_string_ref | address | |||
) |
Creates new protocol specific data.
Allocates and returns the needed memory block as the proto parameter.
[out] | proto | The allocated protocol specific data. |
[in] | service | The protocol module service. |
[in] | address | The actual protocol device address. |
References ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, free, arp_proto::service, and measured_string::value.
Referenced by arp_device_message().
int arp_receive_message | ( | device_id_t | device_id, | |
packet_t | packet | |||
) |
Processes the received ARP packet.
Updates the source hardware address if the source entry exists or the packet is targeted to my protocol address. Responses to the ARP request if the packet is the ARP request and is targeted to my address.
References arp_device::addr, arp_proto::addr, packet_dimension::addr_len, arp_proto::addresses, ARPOP_REPLY, ARPOP_REQUEST, arp_globals::cache, CONVERT_SIZE, ERROR_DECLARE, ERROR_PROPAGATE, arp_device::hardware, arp_header::hardware, arp_header::hardware_length, htons, measured_string::length, measured_string_create_bulk(), nil_send_msg, ntohs, arp_header::operation, arp_device::packet_dimension, packet_get_data(), packet_get_data_length(), packet_set_addr(), arp_device::phone, arp_header::protocol, arp_header::protocol_length, protocol_unmap(), arp_device::protos, arp_device::service, and measured_string::value.
task_id_t arp_task_get_id | ( | void | ) |
Returns the ARP task identifier.
measured_string_ref arp_translate_message | ( | device_id_t | device_id, | |
services_t | protocol, | |||
measured_string_ref | target | |||
) |
Returns the hardware address for the given protocol address.
Sends the ARP request packet if the hardware address is not found in the cache.
[in] | device_id | The device identifier. |
[in] | protocol | The protocol service. |
[in] | target | The target protocol address. |
References arp_device::addr, arp_proto::addr, packet_dimension::addr_len, arp_proto::addresses, ARPOP_REQUEST, arp_device::broadcast_addr, arp_globals::cache, packet_dimension::content, CONVERT_SIZE, arp_device::hardware, arp_header::hardware, arp_header::hardware_length, htons, measured_string::length, arp_globals::net_phone, nil_send_msg, arp_header::operation, arp_device::packet_dimension, packet_get_4(), packet_get_id(), packet_set_addr(), packet_suffix(), arp_device::phone, pq_release(), packet_dimension::prefix, arp_header::protocol, arp_header::protocol_length, protocol_map(), arp_device::protos, arp_device::service, packet_dimension::suffix, and measured_string::value.
int arp_translate_req | ( | int | arp_phone, | |
device_id_t | device_id, | |||
services_t | protocol, | |||
measured_string_ref | address, | |||
measured_string_ref * | translation, | |||
char ** | data | |||
) |
Translates the given protocol address to the network interface address.
Broadcasts the ARP request if the mapping is not found. Allocates and returns the needed memory block as the data parameter.
[in] | arp_phone | The ARP module phone used for (semi)remote calls. |
[in] | device_id | The device identifier. |
[in] | protocol | The requesting protocol service. |
[in] | address | The local requesting protocol address. |
[out] | translation | The translation of the local protocol address. |
[out] | data | The allocated raw translation data container. |
References generic_translate_req(), and NET_ARP_TRANSLATE.
Referenced by ip_send_route().
int module_message | ( | ipc_callid_t | callid, | |
ipc_call_t * | call, | |||
ipc_call_t * | answer, | |||
int * | answer_count | |||
) |
Processes the ARP message.
Delegates the messages to the netif_message() function.
Processes the module message.
[in] | callid | The message identifier. |
[in] | call | The message parameters. |
[out] | answer | The message answer parameters. |
[out] | answer_count | The last parameter for the actual answer in the answer parameter. |
Distributes the message to the right bundled module.
[in] | callid | The message identifier. |
[in] | call | The message parameters. |
[out] | answer | The message answer parameters. |
[out] | answer_count | The last parameter for the actual answer in the answer parameter. |
[in] | callid | The message identifier. |
[in] | call | The message parameters. |
[out] | answer | The message answer parameters. |
[out] | answer_count | The last parameter for the actual answer in the answer parameter. |
References arp_message().
Referenced by client_connection().
int module_start | ( | async_client_conn_t | client_connection | ) |
Starts the ARP module.
Starts the network interface module.
Starts the networking module.
Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
[in] | client_connection | The client connection processing function. The module skeleton propagates its own one. |
Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
[in] | client_connection | The client connection processing function. The module skeleton propagates its own one. |
Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
[in] | client_connection | The client connection processing function. The module skeleton propagates its own one. |
References arp_initialize(), ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, net_connect_module(), arp_globals::net_phone, pm_destroy(), pm_init(), and REGISTER_ME.
ARP module global data.
ARP global data.
ARP module global data.