Changeset 89c57b6 in mainline for uspace/lib/net/il/arp_remote.c


Ignore:
Timestamp:
2011-04-13T14:45:41Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
88634420
Parents:
cefb126 (diff), 17279ead (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/il/arp_remote.c

    rcefb126 r89c57b6  
    2727 */
    2828
    29 /** @addtogroup arp
    30  *  @{
     29/** @addtogroup libnet
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  ARP interface implementation for remote modules.
    35  *  @see arp_interface.h
     34 * ARP interface implementation for remote modules.
     35 * @see arp_interface.h
    3636 */
     37
     38#include <arp_interface.h>
     39#include <generic.h>
    3740
    3841#include <async.h>
    3942#include <errno.h>
    40 #include <ipc/ipc.h>
    4143#include <ipc/services.h>
     44#include <ipc/arp.h>
    4245
    43 #include <net_messages.h>
    44 #include <net_modules.h>
    45 #include <net_device.h>
    46 #include <arp_interface.h>
     46#include <net/modules.h>
     47#include <net/device.h>
    4748#include <adt/measured_strings.h>
    48 #include <arp_messages.h>
    4949
    50 int arp_connect_module(services_t service){
    51         if(service != SERVICE_ARP){
     50/** Connects to the ARP module.
     51 *
     52 * @param service       The ARP module service. Ignored parameter.
     53 * @return              The ARP module phone on success.
     54 */
     55int arp_connect_module(services_t service)
     56{
     57        if (service != SERVICE_ARP)
    5258                return EINVAL;
    53         }
     59
    5460        return connect_to_service(SERVICE_ARP);
    5561}
    5662
    57 int arp_clean_cache_req(int arp_phone){
     63/** Cleans the cache.
     64 *
     65 * @param[in] arp_phone The ARP module phone used for (semi)remote calls.
     66 * @return              EOK on success.
     67 */
     68int arp_clean_cache_req(int arp_phone)
     69{
    5870        return (int) async_req_0_0(arp_phone, NET_ARP_CLEAN_CACHE);
    5971}
    6072
    61 int arp_clear_address_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address){
     73/** Clears the given protocol address from the cache.
     74 *
     75 * @param[in] arp_phone The ARP module phone used for (semi)remote calls.
     76 * @param[in] device_id The device identifier.
     77 * @param[in] protocol  The requesting protocol service.
     78 * @param[in] address   The protocol address to be cleared.
     79 * @return              EOK on success.
     80 * @return              ENOENT if the mapping is not found.
     81 */
     82int
     83arp_clear_address_req(int arp_phone, device_id_t device_id, services_t protocol,
     84    measured_string_t *address)
     85{
    6286        aid_t message_id;
    63         ipcarg_t result;
     87        sysarg_t result;
    6488
    65         message_id = async_send_2(arp_phone, NET_ARP_CLEAR_ADDRESS, (ipcarg_t) device_id, protocol, NULL);
     89        message_id = async_send_2(arp_phone, NET_ARP_CLEAR_ADDRESS,
     90            (sysarg_t) device_id, protocol, NULL);
    6691        measured_strings_send(arp_phone, address, 1);
    6792        async_wait_for(message_id, &result);
     93
    6894        return (int) result;
    6995}
    7096
    71 int arp_clear_device_req(int arp_phone, device_id_t device_id){
    72         return (int) async_req_1_0(arp_phone, NET_ARP_CLEAR_DEVICE, (ipcarg_t) device_id);
     97/** Clears the device cache.
     98 *
     99 * @param[in] arp_phone The ARP module phone used for (semi)remote calls.
     100 * @param[in] device_id The device identifier.
     101 * @return              EOK on success.
     102 * @return              ENOENT if the device is not found.
     103 */
     104int arp_clear_device_req(int arp_phone, device_id_t device_id)
     105{
     106        return (int) async_req_1_0(arp_phone, NET_ARP_CLEAR_DEVICE,
     107            (sysarg_t) device_id);
    73108}
    74109
    75 int arp_device_req(int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address){
     110/** Registers the new device and the requesting protocol service.
     111 *
     112 * Connects to the network interface layer service.
     113 * Determines the device broadcast address, its address lengths and packet size.
     114 *
     115 * @param[in] arp_phone The ARP module phone used for (semi)remote calls.
     116 * @param[in] device_id The new device identifier.
     117 * @param[in] protocol  The requesting protocol service.
     118 * @param[in] netif     The underlying device network interface layer service.
     119 * @param[in] address   The local requesting protocol address of the device.
     120 * @return              EOK on success.
     121 * @return              EEXIST if the device is already used.
     122 * @return              ENOMEM if there is not enough memory left.
     123 * @return              ENOENT if the network interface service is not known.
     124 * @return              EREFUSED if the network interface service is not
     125 *                      responding.
     126 * @return              Other error codes as defined for the
     127 *                      nil_packet_get_size() function.
     128 * @return              Other error codes as defined for the nil_get_addr()
     129 *                      function.
     130 * @return              Other error codes as defined for the
     131 *                      nil_get_broadcast_addr() function.
     132 */
     133int arp_device_req(int arp_phone, device_id_t device_id, services_t protocol,
     134    services_t netif, measured_string_t *address)
     135{
    76136        aid_t message_id;
    77         ipcarg_t result;
     137        sysarg_t result;
    78138
    79         message_id = async_send_3(arp_phone, NET_ARP_DEVICE, (ipcarg_t) device_id, protocol, netif, NULL);
     139        message_id = async_send_3(arp_phone, NET_ARP_DEVICE,
     140            (sysarg_t) device_id, protocol, netif, NULL);
    80141        measured_strings_send(arp_phone, address, 1);
    81142        async_wait_for(message_id, &result);
     143
    82144        return (int) result;
    83145}
    84146
    85 task_id_t arp_task_get_id(void){
    86         return 0;
    87 }
    88 
    89 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){
    90         return generic_translate_req(arp_phone, NET_ARP_TRANSLATE, device_id, protocol, address, 1, translation, data);
     147/** Translates the given protocol address to the network interface address.
     148 *
     149 * Broadcasts the ARP request if the mapping is not found.
     150 * Allocates and returns the needed memory block as the data parameter.
     151 *
     152 * @param[in] arp_phone The ARP module phone used for (semi)remote calls.
     153 * @param[in] device_id The device identifier.
     154 * @param[in] protocol  The requesting protocol service.
     155 * @param[in] address   The local requesting protocol address.
     156 * @param[out] translation The translation of the local protocol address.
     157 * @param[out] data     The allocated raw translation data container.
     158 * @return              EOK on success.
     159 * @return              EINVAL if the address parameter is NULL.
     160 * @return              EBADMEM if the translation or the data parameters are
     161 *                      NULL.
     162 * @return              ENOENT if the mapping is not found.
     163 */
     164int
     165arp_translate_req(int arp_phone, device_id_t device_id, services_t protocol,
     166    measured_string_t *address, measured_string_t **translation, uint8_t **data)
     167{
     168        return generic_translate_req(arp_phone, NET_ARP_TRANSLATE, device_id,
     169            protocol, address, 1, translation, data);
    91170}
    92171
Note: See TracChangeset for help on using the changeset viewer.