Subversion Repositories HelenOS

Rev

Rev 4307 | Rev 4704 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4307 Rev 4350
Line 28... Line 28...
28
 
28
 
29
/** @addtogroup net_nil
29
/** @addtogroup net_nil
30
 *  @{
30
 *  @{
31
 */
31
 */
32
 
32
 
33
/**
-
 
34
 * @file
33
/** @file
-
 
34
 *  Network interface layer interface.
-
 
35
 *  The same interface is used for standalone remote device modules as well as for bundle device modules.
-
 
36
 *  The standalone remote device modules have to be compiled with the nil_remote.c source file.
-
 
37
 *  The bundle device modules with the appropriate network interface layer source file (eth.c etc.).
-
 
38
 *  The upper layers cannot be bundled with the network interface layer.
35
 */
39
 */
36
 
40
 
37
#ifndef __NET_NIL_INTERFACE_H__
41
#ifndef __NET_NIL_INTERFACE_H__
38
#define __NET_NIL_INTERFACE_H__
42
#define __NET_NIL_INTERFACE_H__
39
 
43
 
Line 49... Line 53...
49
 
53
 
50
#include "../nil/nil_messages.h"
54
#include "../nil/nil_messages.h"
51
 
55
 
52
#include "device.h"
56
#include "device.h"
53
 
57
 
-
 
58
/** Returns the device local hardware address.
-
 
59
 *  @param nil_phone The network interface layer phone. Input parameter.
-
 
60
 *  @param device_id The device identifier. Input parameter.
-
 
61
 *  @param address The device local hardware address. Output parameter.
-
 
62
 *  @param data The address data. Output parameter.
-
 
63
 *  @returns EOK on success.
-
 
64
 *  @returns EBADMEM if the address parameter is NULL.
-
 
65
 *  @returns ENOENT if there no such device.
-
 
66
 *  @returns Other error codes as defined for the generic_get_addr() function.
-
 
67
 */
54
#define nil_get_addr( nil_phone, device_id, address, data ) \
68
#define nil_get_addr( nil_phone, device_id, address, data ) \
55
    generic_get_addr( nil_phone, NET_NIL_ADDR, device_id, address, data )
69
    generic_get_addr( nil_phone, NET_NIL_ADDR, device_id, address, data )
56
 
70
 
-
 
71
/** Returns the device broadcast hardware address.
-
 
72
 *  @param nil_phone The network interface layer phone. Input parameter.
-
 
73
 *  @param device_id The device identifier. Input parameter.
-
 
74
 *  @param address The device broadcast hardware address. Output parameter.
-
 
75
 *  @param data The address data. Output parameter.
-
 
76
 *  @returns EOK on success.
-
 
77
 *  @returns EBADMEM if the address parameter is NULL.
-
 
78
 *  @returns ENOENT if there no such device.
-
 
79
 *  @returns Other error codes as defined for the generic_get_addr() function.
-
 
80
 */
57
#define nil_get_broadcast_addr( nil_phone, device_id, address, data )   \
81
#define nil_get_broadcast_addr( nil_phone, device_id, address, data )   \
58
    generic_get_addr( nil_phone, NET_NIL_BROADCAST_ADDR, device_id, address, data )
82
    generic_get_addr( nil_phone, NET_NIL_BROADCAST_ADDR, device_id, address, data )
59
 
83
 
-
 
84
/** Sends the packet queue.
-
 
85
 *  @param nil_phone The network interface layer phone. Input parameter.
-
 
86
 *  @param device_id The device identifier. Input parameter.
-
 
87
 *  @param packet The packet queue. Input parameter.
-
 
88
 *  @param sender The sending module service. Input parameter.
-
 
89
 *  @returns EOK on success.
-
 
90
 *  @returns Other error codes as defined for the generic_send_msg() function.
-
 
91
 */
60
#define nil_send_msg( nil_phone, device_id, packet, sender )    \
92
#define nil_send_msg( nil_phone, device_id, packet, sender )    \
61
    generic_send_msg( nil_phone, NET_NIL_SEND, device_id, packet_get_id( packet ), sender )
93
    generic_send_msg( nil_phone, NET_NIL_SEND, device_id, packet_get_id( packet ), sender )
62
 
94
 
-
 
95
/** Returns the device packet dimensions for sending.
-
 
96
 *  @param nil_phone The network interface layer phone. Input parameter.
-
 
97
 *  @param device_id The device identifier. Input parameter.
-
 
98
 *  @param addr_len The minimum reserved address length. Output parameter.
-
 
99
 *  @param prefix The minimum reserved prefix size. Output parameter.
-
 
100
 *  @param content The maximum content size. Output parameter.
-
 
101
 *  @param suffix The minimum reserved suffix size. Output parameter.
-
 
102
 *  @returns EOK on success.
-
 
103
 *  @returns EBADMEM if either one of the parameters is NULL.
-
 
104
 *  @returns ENOENT if there is no such device.
-
 
105
 *  @returns Other error codes as defined for the generic_packet_size_req() function.
-
 
106
 */
63
#define nil_packet_size_req( nil_phone, device_id, addr_len, prefix, content, suffix )  \
107
#define nil_packet_size_req( nil_phone, device_id, addr_len, prefix, content, suffix )  \
64
    generic_packet_size_req( nil_phone, NET_NIL_PACKET_SPACE, device_id, addr_len, prefix, content, suffix )
108
    generic_packet_size_req( nil_phone, NET_NIL_PACKET_SPACE, device_id, addr_len, prefix, content, suffix )
65
 
109
 
-
 
110
/** Registers new device or updates the MTU of an existing one.
-
 
111
 *  @param nil_phone The network interface layer phone. Input parameter.
-
 
112
 *  @param device_id The new device identifier. Input parameter.
-
 
113
 *  @param mtu The device maximum transmission unit. Input parameter.
-
 
114
 *  @param netif_service The device driver service. Input parameter.
-
 
115
 *  @returns EOK on success.
-
 
116
 *  @returns EEXIST if the device with the different service exists.
-
 
117
 *  @returns ENOMEM if there is not enough memory left.
-
 
118
 *  @returns Other error codes as defined for the generic_device_req() function.
-
 
119
 */
66
#define nil_device_req( nil_phone, device_id, mtu, netif_service )  \
120
#define nil_device_req( nil_phone, device_id, mtu, netif_service )  \
67
    generic_device_req( nil_phone, NET_NIL_DEVICE, device_id, mtu, netif_service )
121
    generic_device_req( nil_phone, NET_NIL_DEVICE, device_id, mtu, netif_service )
68
 
122
 
-
 
123
/** Notifies the network interface layer about the device state change.
-
 
124
 *  @param nil_phone The network interface layer phone. Input parameter.
-
 
125
 *  @param device_id The device identifier. Input parameter.
-
 
126
 *  @param state The new device state. Input parameter.
-
 
127
 *  @returns EOK on success.
-
 
128
 *  @returns Other error codes as defined for each specific module device state function.
-
 
129
 */
69
int nil_device_state_msg( int nil_phone, device_id_t device_id, int state );
130
int nil_device_state_msg( int nil_phone, device_id_t device_id, int state );
70
 
131
 
-
 
132
/** Passes the packet queue to the network interface layer.
-
 
133
 *  Processes and redistributes the received packet queue to the registered upper layers.
-
 
134
 *  @param nil_phone The network interface layer phone. Input parameter.
-
 
135
 *  @param device_id The source device identifier. Input parameter.
-
 
136
 *  @param packet The received packet or the received packet queue. Input parameter.
-
 
137
 *  @param target The target service. Ignored parameter.
-
 
138
 *  @returns EOK on success.
-
 
139
 *  @returns Other error codes as defined for each specific module received function.
-
 
140
 */
71
int nil_received_msg( int nil_phone, device_id_t device_id, packet_t packet, services_t target );
141
int nil_received_msg( int nil_phone, device_id_t device_id, packet_t packet, services_t target );
72
 
142
 
73
#endif
143
#endif
74
 
144
 
75
/** @}
145
/** @}