Subversion Repositories HelenOS

Rev

Rev 4695 | Rev 4723 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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