~jakub/helenos/ia64-revival

« back to all changes in this revision

Viewing changes to uspace/lib/net/include/arp_interface.h

  • Committer: Jakub Jermar
  • Date: 2011-04-13 14:45:41 UTC
  • mfrom: (527.1.397 main-clone)
  • Revision ID: jakub@jermar.eu-20110413144541-x0j3r1zxqhsljx1o
MergeĀ mainlineĀ changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
27
 */
28
28
 
29
 
/** @addtogroup arp
30
 
 *  @{
 
29
/** @addtogroup libnet
 
30
 * @{
31
31
 */
32
32
 
33
 
#ifndef __NET_ARP_INTERFACE_H__
34
 
#define __NET_ARP_INTERFACE_H__
 
33
#ifndef LIBNET_ARP_INTERFACE_H_
 
34
#define LIBNET_ARP_INTERFACE_H_
35
35
 
36
36
#include <adt/measured_strings.h>
37
 
#include <net_device.h>
 
37
#include <task.h>
 
38
 
 
39
#include <ipc/services.h>
 
40
 
 
41
#include <net/device.h>
 
42
#include <net/socket.h>
38
43
 
39
44
/** @name ARP module interface
40
 
 *  This interface is used by other modules.
 
45
 * This interface is used by other modules.
41
46
 */
42
47
/*@{*/
43
48
 
44
 
/** Registers the new device and the requesting protocol service.
45
 
 *  Connects to the network interface layer service.
46
 
 *  Determines the device broadcast address, its address lengths and packet size.
47
 
 *  @param[in] arp_phone The ARP module phone used for (semi)remote calls.
48
 
 *  @param[in] device_id The new device identifier.
49
 
 *  @param[in] protocol The requesting protocol service.
50
 
 *  @param[in] netif The underlying device network interface layer service.
51
 
 *  @param[in] address The local requesting protocol address of the device.
52
 
 *  @returns EOK on success.
53
 
 *  @returns EEXIST if the device is already used.
54
 
 *  @returns ENOMEM if there is not enough memory left.
55
 
 *  @returns ENOENT if the network interface service is not known.
56
 
 *  @returns EREFUSED if the network interface service is not responding.
57
 
 *  @returns Other error codes as defined for the nil_packet_get_size() function.
58
 
 *  @returns Other error codes as defined for the nil_get_addr() function.
59
 
 *  @returns Other error codes as defined for the nil_get_broadcast_addr() function.
60
 
 */
61
 
extern int arp_device_req(int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address);
62
 
 
63
 
/** Translates the given protocol address to the network interface address.
64
 
 *  Broadcasts the ARP request if the mapping is not found.
65
 
 *  Allocates and returns the needed memory block as the data parameter.
66
 
 *  @param[in] arp_phone The ARP module phone used for (semi)remote calls.
67
 
 *  @param[in] device_id The device identifier.
68
 
 *  @param[in] protocol The requesting protocol service.
69
 
 *  @param[in] address The local requesting protocol address.
70
 
 *  @param[out] translation The translation of the local protocol address.
71
 
 *  @param[out] data The allocated raw translation data container.
72
 
 *  @returns EOK on success.
73
 
 *  @returns EINVAL if the address parameter is NULL.
74
 
 *  @returns EBADMEM if the translation or the data parameters are NULL.
75
 
 *  @returns ENOENT if the mapping is not found.
76
 
 */
77
 
extern 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);
78
 
 
79
 
/** Clears the device cache.
80
 
 *  @param[in] arp_phone The ARP module phone used for (semi)remote calls.
81
 
 *  @param[in] device_id The device identifier.
82
 
 *  @returns EOK on success.
83
 
 *  @returns ENOENT if the device is not found.
84
 
 */
85
 
extern int arp_clear_device_req(int arp_phone, device_id_t device_id);
86
 
 
87
 
/** Clears the given protocol address from the cache.
88
 
 *  @param[in] arp_phone The ARP module phone used for (semi)remote calls.
89
 
 *  @param[in] device_id The device identifier.
90
 
 *  @param[in] protocol The requesting protocol service.
91
 
 *  @param[in] address The protocol address to be cleared.
92
 
 *  @returns EOK on success.
93
 
 *  @returns ENOENT if the mapping is not found.
94
 
 */
95
 
extern int arp_clear_address_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address);
96
 
 
97
 
/** Cleans the cache.
98
 
 *  @param[in] arp_phone The ARP module phone used for (semi)remote calls.
99
 
 *  @returns EOK on success.
100
 
 */
101
 
extern int arp_clean_cache_req(int arp_phone);
102
 
 
103
 
/** Connects to the ARP module.
104
 
 *  @param service The ARP module service. Ignored parameter.
105
 
 *  @returns The ARP module phone on success.
106
 
 *  @returns 0 if called by the bundle module.
107
 
 */
108
 
extern int arp_connect_module(services_t service);
109
 
 
110
 
/** Returns the ARP task identifier.
111
 
 *  @returns The current task identifier if called by the bundle module.
112
 
 *  @returns 0 if called by the remote module.
113
 
 */
114
 
extern task_id_t arp_task_get_id(void);
 
49
extern int arp_device_req(int, device_id_t, services_t, services_t,
 
50
    measured_string_t *);
 
51
extern int arp_translate_req(int, device_id_t, services_t, measured_string_t *,
 
52
    measured_string_t **, uint8_t **);
 
53
extern int arp_clear_device_req(int, device_id_t);
 
54
extern int arp_clear_address_req(int, device_id_t, services_t,
 
55
    measured_string_t *);
 
56
extern int arp_clean_cache_req(int);
 
57
extern int arp_connect_module(services_t);
115
58
 
116
59
/*@}*/
117
60