Address Resolution Protocol (ARP) Service
[Inter-networking layer]

Collaboration diagram for Address Resolution Protocol (ARP) Service:

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_tarp_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_tarp_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_tarp_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 Documentation

#define ARP_GET_NETIF ( call   )     (services_t) IPC_GET_ARG2(*call)

Returns the protocol service message parameter.

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

Type definition of the ARP device specific data pointer.

See also:
arp_device
typedef struct arp_device arp_device_t

Type definition of the ARP device specific data.

See also:
arp_device
typedef struct arp_globals arp_globals_t

Type definition of the ARP global data.

See also:
arp_globals

Type definition of an ARP protocol header pointer.

See also:
arp_header
typedef struct arp_header arp_header_t

Type definition of an ARP protocol header.

See also:
arp_header

Type definition of the ARP protocol specific data pointer.

See also:
arp_proto
typedef struct arp_proto arp_proto_t

Type definition of the ARP protocol specific data.

See also:
arp_proto

Enumeration Type Documentation

ARP module messages.

Enumerator:
NET_ARP_CLEAN_CACHE 

Clean cache message.

See also:
arp_clean_cache()
NET_ARP_CLEAR_ADDRESS 

Clear address cache message.

See also:
arp_clear_address_msg()
NET_ARP_CLEAR_DEVICE 

Clear device cache message.

See also:
arp_clear_device_req()
NET_ARP_DEVICE 

New device message.

See also:
arp_device_req()
NET_ARP_TRANSLATE 

Address translation message.

See also:
arp_translate_req()

Function Documentation

int arp_clean_cache_req ( int  arp_phone  ) 

Cleans the cache.

Parameters:
[in] arp_phone The ARP module phone used for (semi)remote calls.
Returns:
EOK on success.

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.

Parameters:
[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.
Returns:
EOK on success.
ENOENT if the mapping is not found.

References measured_strings_send(), and NET_ARP_CLEAR_ADDRESS.

Here is the call graph for this function:

void arp_clear_device ( arp_device_ref  device  ) 

Clears the device specific data.

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

Parameters:
[in] arp_phone The ARP module phone used for (semi)remote calls.
[in] device_id The device identifier.
Returns:
EOK on success.
ENOENT if the device is not found.

References NET_ARP_CLEAR_DEVICE.

int arp_connect_module ( services_t  service  ) 

Connects to the ARP module.

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

References connect_to_service().

Here is the call graph for this function:

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.

Parameters:
[in] device_id The device identifier.
[in] service The device driver service.
[in] protocol The protocol service.
[in] address The actual device protocol address.
Returns:
EOK on success.
EEXIST if another device with the same device identifier and different driver service exists.
ENOMEM if there is not enough memory left.
Other error codes as defined for the measured_strings_return() function.

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.

Here is the call graph for this function:

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.

Parameters:
[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.
Returns:
EOK on success.
EEXIST if the device is already used.
ENOMEM if there is not enough memory left.
ENOENT if the network interface service is not known.
EREFUSED if the network interface service is not responding.
Other error codes as defined for the nil_packet_get_size() function.
Other error codes as defined for the nil_get_addr() function.
Other error codes as defined for the nil_get_broadcast_addr() function.

References measured_strings_send(), and NET_ARP_DEVICE.

Referenced by ip_netif_initialize().

Here is the call graph for this function:

Here is the caller graph for this function:

int arp_initialize ( async_client_conn_t  client_connection  ) 

Initializes the ARP 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.

Referenced by module_start().

Here is the caller graph for this function:

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

Processes the ARP 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:
arp_interface.h
IS_NET_ARP_MESSAGE()

Referenced by module_message().

Here is the caller graph for this function:

int arp_mtu_changed_message ( device_id_t  device_id,
size_t  mtu 
)

Updates the device content length according to the new MTU value.

Parameters:
[in] device_id The device identifier.
[in] mtu The new mtu value.
Returns:
ENOENT if device is not found.
EOK on success.

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.

Parameters:
[out] proto The allocated protocol specific data.
[in] service The protocol module service.
[in] address The actual protocol device address.
Returns:
EOK on success.
ENOMEM if there is not enough memory left.

References ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, free, arp_proto::service, and measured_string::value.

Referenced by arp_device_message().

Here is the caller graph for this function:

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.

Parameters:
[in] device_id The source device identifier.
[in,out] packet The received packet.
Returns:
EOK on success and the packet is no longer needed.
1 on success and the packet has been reused.
EINVAL if the packet is too small to carry an ARP packet.
EINVAL if the received address lengths differs from the registered values.
ENOENT if the device is not found in the cache.
ENOENT if the protocol for the device is not found in the cache.
ENOMEM if there is not enough memory left.

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.

Here is the call graph for this function:

task_id_t arp_task_get_id ( void   ) 

Returns the ARP task identifier.

Returns:
The current task identifier if called by the bundle module.
0 if called by the remote module.
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.

Parameters:
[in] device_id The device identifier.
[in] protocol The protocol service.
[in] target The target protocol address.
Returns:
The hardware address of the target.
NULL if the target parameter is NULL.
NULL if the device is not found.
NULL if the device packet is too small to send a request.
NULL if the hardware address is not found in the cache.

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.

Here is the call graph for this function:

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.

Parameters:
[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.
Returns:
EOK on success.
EINVAL if the address parameter is NULL.
EBADMEM if the translation or the data parameters are NULL.
ENOENT if the mapping is not found.

References generic_translate_req(), and NET_ARP_TRANSLATE.

Referenced by ip_send_route().

Here is the call graph for this function:

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 
)

Processes the ARP message.

Delegates the messages to the netif_message() function.

Processes the module 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.
Other error codes as defined for the arp_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.
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.

References arp_message().

Referenced by client_connection().

Here is the call graph for this function:

Here is the caller graph for this function:

void module_print_name ( void   ) 

Prints the module name.

See also:
NAME

References NAME.

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.

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 arp_initialize() function.
Other error codes as defined for the REGISTER_ME() macro function.

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.

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 success.
Other error codes as defined for each specific module message function.

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.

Here is the call graph for this function:


Variable Documentation

ARP module global data.

ARP global data.

ARP module global data.


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