source: mainline/uspace/lib/net/include/arp_interface.h@ 24ab58b3

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 24ab58b3 was 849ed54, checked in by Martin Decky <martin@…>, 15 years ago

Networking work:
Split the networking stack into end-user library (libsocket) and two helper libraries (libnet and libnetif).
Don't use over-the-hand compiling and linking, but rather separation of conserns.
There might be still some issues and the non-modular networking architecture is currently broken, but this will be fixed soon.

  • Property mode set to 100644
File size: 5.5 KB
Line 
1/*
2 * Copyright (c) 2009 Lukas Mejdrech
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup arp
30 * @{
31 */
32
33/** @file
34 * ARP module interface.
35 * The same interface is used for standalone remote modules as well as for bundle modules.
36 * The standalone remote modules have to be compiled with the arp_remote.c source file.
37 * The bundle modules with the arp.c source file.
38 */
39
40#ifndef __NET_ARP_INTERFACE_H__
41#define __NET_ARP_INTERFACE_H__
42
43#include <adt/measured_strings.h>
44#include <net_device.h>
45
46/** @name ARP module interface
47 * This interface is used by other modules.
48 */
49/*@{*/
50
51/** Registers the new device and the requesting protocol service.
52 * Connects to the network interface layer service.
53 * Determines the device broadcast address, its address lengths and packet size.
54 * @param[in] arp_phone The ARP module phone used for (semi)remote calls.
55 * @param[in] device_id The new device identifier.
56 * @param[in] protocol The requesting protocol service.
57 * @param[in] netif The underlying device network interface layer service.
58 * @param[in] address The local requesting protocol address of the device.
59 * @returns EOK on success.
60 * @returns EEXIST if the device is already used.
61 * @returns ENOMEM if there is not enough memory left.
62 * @returns ENOENT if the network interface service is not known.
63 * @returns EREFUSED if the network interface service is not responding.
64 * @returns Other error codes as defined for the nil_packet_get_size() function.
65 * @returns Other error codes as defined for the nil_get_addr() function.
66 * @returns Other error codes as defined for the nil_get_broadcast_addr() function.
67 */
68extern int arp_device_req(int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address);
69
70/** Translates the given protocol address to the network interface address.
71 * Broadcasts the ARP request if the mapping is not found.
72 * Allocates and returns the needed memory block as the data parameter.
73 * @param[in] arp_phone The ARP module phone used for (semi)remote calls.
74 * @param[in] device_id The device identifier.
75 * @param[in] protocol The requesting protocol service.
76 * @param[in] address The local requesting protocol address.
77 * @param[out] translation The translation of the local protocol address.
78 * @param[out] data The allocated raw translation data container.
79 * @returns EOK on success.
80 * @returns EINVAL if the address parameter is NULL.
81 * @returns EBADMEM if the translation or the data parameters are NULL.
82 * @returns ENOENT if the mapping is not found.
83 */
84extern 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);
85
86/** Clears the device cache.
87 * @param[in] arp_phone The ARP module phone used for (semi)remote calls.
88 * @param[in] device_id The device identifier.
89 * @returns EOK on success.
90 * @returns ENOENT if the device is not found.
91 */
92extern int arp_clear_device_req(int arp_phone, device_id_t device_id);
93
94/** Clears the given protocol address from the cache.
95 * @param[in] arp_phone The ARP module phone used for (semi)remote calls.
96 * @param[in] device_id The device identifier.
97 * @param[in] protocol The requesting protocol service.
98 * @param[in] address The protocol address to be cleared.
99 * @returns EOK on success.
100 * @returns ENOENT if the mapping is not found.
101 */
102extern int arp_clear_address_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address);
103
104/** Cleans the cache.
105 * @param[in] arp_phone The ARP module phone used for (semi)remote calls.
106 * @returns EOK on success.
107 */
108extern int arp_clean_cache_req(int arp_phone);
109
110/** Connects to the ARP module.
111 * @param service The ARP module service. Ignored parameter.
112 * @returns The ARP module phone on success.
113 * @returns 0 if called by the bundle module.
114 */
115extern int arp_connect_module(services_t service);
116
117/** Returns the ARP task identifier.
118 * @returns The current task identifier if called by the bundle module.
119 * @returns 0 if called by the remote module.
120 */
121extern task_id_t arp_task_get_id(void);
122
123/*@}*/
124
125#endif
126
127/** @}
128 */
Note: See TracBrowser for help on using the repository browser.