Subversion Repositories HelenOS

Rev

Rev 4743 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4743 Rev 4756
Line 29... Line 29...
29
/** @addtogroup net
29
/** @addtogroup net
30
 *  @{
30
 *  @{
31
 */
31
 */
32
 
32
 
33
/** @file
33
/** @file
34
 *  \todo
34
 *  Networking common message definitions.
35
 */
35
 */
36
 
36
 
37
#ifndef __NET_MESSAGES_H__
37
#ifndef __NET_MESSAGES_H__
38
#define __NET_MESSAGES_H__
38
#define __NET_MESSAGES_H__
39
 
39
 
Line 45... Line 45...
45
#include "include/device.h"
45
#include "include/device.h"
46
 
46
 
47
#include "structures/measured_strings.h"
47
#include "structures/measured_strings.h"
48
#include "structures/packet/packet.h"
48
#include "structures/packet/packet.h"
49
 
49
 
-
 
50
/** @name Networking message counts
-
 
51
 */
-
 
52
/*@{*/
-
 
53
 
-
 
54
/** The number of network interface driver messages.
-
 
55
 */
50
#define NET_NETIF_COUNT     6
56
#define NET_NETIF_COUNT     6
-
 
57
 
-
 
58
/** The number of general networking messages.
-
 
59
 */
51
#define NET_NET_COUNT       3
60
#define NET_NET_COUNT       3
-
 
61
 
-
 
62
/** The number of network interface layer messages.
-
 
63
 */
52
#define NET_NIL_COUNT       7
64
#define NET_NIL_COUNT       7
-
 
65
 
-
 
66
/** The number of Ethernet messages.
-
 
67
 */
53
#define NET_ETH_COUNT       0
68
#define NET_ETH_COUNT       0
-
 
69
 
-
 
70
/** The number of inter-network messages.
-
 
71
 */
54
#define NET_IL_COUNT        6
72
#define NET_IL_COUNT        6
-
 
73
 
-
 
74
/** The number of IP messages.
-
 
75
 */
55
#define NET_IP_COUNT        4
76
#define NET_IP_COUNT        4
-
 
77
 
-
 
78
/** The number of ARP messages.
-
 
79
 */
56
#define NET_ARP_COUNT       5
80
#define NET_ARP_COUNT       5
-
 
81
 
-
 
82
/** The number of ICMP messages.
-
 
83
 */
57
#define NET_ICMP_COUNT      6
84
#define NET_ICMP_COUNT      6
-
 
85
 
-
 
86
/** The number of transport layer messages.
-
 
87
 */
58
#define NET_TL_COUNT        1
88
#define NET_TL_COUNT        1
-
 
89
 
-
 
90
/** The number of UDP messages.
-
 
91
 */
59
#define NET_UDP_COUNT       0
92
#define NET_UDP_COUNT       0
-
 
93
 
-
 
94
/** The number of TCP messages.
-
 
95
 */
60
#define NET_TCP_COUNT       0
96
#define NET_TCP_COUNT       0
-
 
97
 
-
 
98
/** The number of packet management system messages.
-
 
99
 */
61
#define NET_PACKET_COUNT    5
100
#define NET_PACKET_COUNT    5
-
 
101
 
-
 
102
/** The number of socket messages.
-
 
103
 */
62
#define NET_SOCKET_COUNT    14
104
#define NET_SOCKET_COUNT    14
63
 
105
 
-
 
106
/*@}*/
-
 
107
 
-
 
108
/** @name Networking message intervals
-
 
109
 */
-
 
110
/*@{*/
-
 
111
 
-
 
112
/** The first networking message.
-
 
113
 */
64
#define NET_FIRST           2000
114
#define NET_FIRST           2000
65
 
115
 
-
 
116
/** The first network interface layer message.
-
 
117
 */
66
#define NET_NETIF_FIRST     NET_FIRST
118
#define NET_NETIF_FIRST     NET_FIRST
-
 
119
 
-
 
120
/** The last network interface layer message.
-
 
121
 */
67
#define NET_NETIF_LAST      ( NET_NETIF_FIRST + NET_NETIF_COUNT )
122
#define NET_NETIF_LAST      ( NET_NETIF_FIRST + NET_NETIF_COUNT )
68
 
123
 
-
 
124
/** The first general networking message.
-
 
125
 */
69
#define NET_NET_FIRST       ( NET_NETIF_LAST + 0 )
126
#define NET_NET_FIRST       ( NET_NETIF_LAST + 0 )
-
 
127
 
-
 
128
/** The last general networking message.
-
 
129
 */
70
#define NET_NET_LAST        ( NET_NET_FIRST + NET_NET_COUNT )
130
#define NET_NET_LAST        ( NET_NET_FIRST + NET_NET_COUNT )
71
 
131
 
-
 
132
/** The first network interface layer message.
-
 
133
 */
72
#define NET_NIL_FIRST       ( NET_NET_LAST + 0 )
134
#define NET_NIL_FIRST       ( NET_NET_LAST + 0 )
-
 
135
 
-
 
136
/** The last network interface layer message.
-
 
137
 */
73
#define NET_NIL_LAST        ( NET_NIL_FIRST + NET_NIL_COUNT )
138
#define NET_NIL_LAST        ( NET_NIL_FIRST + NET_NIL_COUNT )
-
 
139
 
-
 
140
/** The first Ethernet message.
-
 
141
 */
74
#define NET_ETH_FIRST       ( NET_NIL_LAST + 0 )
142
#define NET_ETH_FIRST       ( NET_NIL_LAST + 0 )
-
 
143
 
-
 
144
/** The last Ethernet message.
-
 
145
 */
75
#define NET_ETH_LAST        ( NET_ETH_FIRST + NET_ETH_COUNT )
146
#define NET_ETH_LAST        ( NET_ETH_FIRST + NET_ETH_COUNT )
76
 
147
 
-
 
148
/** The first inter-network message.
-
 
149
 */
77
#define NET_IL_FIRST        ( NET_ETH_LAST + 0 )
150
#define NET_IL_FIRST        ( NET_ETH_LAST + 0 )
-
 
151
 
-
 
152
/** The last inter-network message.
-
 
153
 */
78
#define NET_IL_LAST         ( NET_IL_FIRST + NET_IL_COUNT )
154
#define NET_IL_LAST         ( NET_IL_FIRST + NET_IL_COUNT )
-
 
155
 
-
 
156
/** The first IP message.
-
 
157
 */
79
#define NET_IP_FIRST        ( NET_IL_LAST + 0 )
158
#define NET_IP_FIRST        ( NET_IL_LAST + 0 )
-
 
159
 
-
 
160
/** The last IP message.
-
 
161
 */
80
#define NET_IP_LAST         ( NET_IP_FIRST + NET_IP_COUNT )
162
#define NET_IP_LAST         ( NET_IP_FIRST + NET_IP_COUNT )
81
 
163
 
-
 
164
/** The first ARP message.
-
 
165
 */
82
#define NET_ARP_FIRST       ( NET_IP_LAST + 0 )
166
#define NET_ARP_FIRST       ( NET_IP_LAST + 0 )
-
 
167
 
-
 
168
/** The last ARP message.
-
 
169
 */
83
#define NET_ARP_LAST        ( NET_ARP_FIRST + NET_ARP_COUNT )
170
#define NET_ARP_LAST        ( NET_ARP_FIRST + NET_ARP_COUNT )
-
 
171
 
-
 
172
/** The first ICMP message.
-
 
173
 */
84
#define NET_ICMP_FIRST      ( NET_ARP_LAST + 0 )
174
#define NET_ICMP_FIRST      ( NET_ARP_LAST + 0 )
-
 
175
 
-
 
176
/** The last ICMP message.
-
 
177
 */
85
#define NET_ICMP_LAST       ( NET_ICMP_FIRST + NET_ICMP_COUNT )
178
#define NET_ICMP_LAST       ( NET_ICMP_FIRST + NET_ICMP_COUNT )
86
 
179
 
-
 
180
/** The first ICMP message.
-
 
181
 */
87
#define NET_TL_FIRST        ( NET_ICMP_LAST + 0 )
182
#define NET_TL_FIRST        ( NET_ICMP_LAST + 0 )
-
 
183
 
-
 
184
/** The last ICMP message.
-
 
185
 */
88
#define NET_TL_LAST         ( NET_TL_FIRST + NET_TL_COUNT )
186
#define NET_TL_LAST         ( NET_TL_FIRST + NET_TL_COUNT )
-
 
187
 
-
 
188
/** The first UDP message.
-
 
189
 */
89
#define NET_UDP_FIRST       ( NET_TL_LAST + 0 )
190
#define NET_UDP_FIRST       ( NET_TL_LAST + 0 )
-
 
191
 
-
 
192
/** The last UDP message.
-
 
193
 */
90
#define NET_UDP_LAST        ( NET_UDP_FIRST + NET_UDP_COUNT )
194
#define NET_UDP_LAST        ( NET_UDP_FIRST + NET_UDP_COUNT )
-
 
195
 
-
 
196
/** The first TCP message.
-
 
197
 */
91
#define NET_TCP_FIRST       ( NET_UDP_LAST + 0 )
198
#define NET_TCP_FIRST       ( NET_UDP_LAST + 0 )
-
 
199
 
-
 
200
/** The last TCP message.
-
 
201
 */
92
#define NET_TCP_LAST        ( NET_TCP_FIRST + NET_TCP_COUNT )
202
#define NET_TCP_LAST        ( NET_TCP_FIRST + NET_TCP_COUNT )
93
 
203
 
-
 
204
/** The first socket message.
-
 
205
 */
94
#define NET_SOCKET_FIRST    ( NET_TCP_LAST + 0 )
206
#define NET_SOCKET_FIRST    ( NET_TCP_LAST + 0 )
-
 
207
 
-
 
208
/** The last socket message.
-
 
209
 */
95
#define NET_SOCKET_LAST     ( NET_SOCKET_FIRST + NET_SOCKET_COUNT )
210
#define NET_SOCKET_LAST     ( NET_SOCKET_FIRST + NET_SOCKET_COUNT )
96
 
211
 
-
 
212
/** The first packet management system message.
-
 
213
 */
97
#define NET_PACKET_FIRST    ( NET_SOCKET_LAST + 0 )
214
#define NET_PACKET_FIRST    ( NET_SOCKET_LAST + 0 )
-
 
215
 
-
 
216
/** The last packet management system message.
-
 
217
 */
98
#define NET_PACKET_LAST     ( NET_PACKET_FIRST + NET_PACKET_COUNT )
218
#define NET_PACKET_LAST     ( NET_PACKET_FIRST + NET_PACKET_COUNT )
99
 
219
 
-
 
220
/** The last networking message.
-
 
221
 */
100
#define NET_LAST            NET_PACKET_LAST
222
#define NET_LAST            NET_PACKET_LAST
101
 
223
 
-
 
224
/** The number of networking messages.
-
 
225
 */
102
#define NET_COUNT           ( NET_LAST - NET_FIRST )
226
#define NET_COUNT           ( NET_LAST - NET_FIRST )
103
 
227
 
-
 
228
/** Returns a value indicating whether the value is in the interval.
-
 
229
 *  @param[in] item The value to be checked.
-
 
230
 *  @param[in] first_inclusive The first value in the interval inclusive.
-
 
231
 *  @param[in] last_exclusive The first value after the interval.
-
 
232
 */
104
#define IS_IN_INTERVAL( item, first_inclusive, last_exclusive ) ((( item ) >= ( first_inclusive )) && (( item ) < ( last_exclusive )))
233
#define IS_IN_INTERVAL( item, first_inclusive, last_exclusive ) ((( item ) >= ( first_inclusive )) && (( item ) < ( last_exclusive )))
105
 
234
 
-
 
235
/** Returns a value indicating whether the IPC call is a generic networking message.
-
 
236
 *  @param[in] call The IPC call to be checked.
-
 
237
 */
106
#define IS_NET_MESSAGE( call )          IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_FIRST, NET_LAST )
238
#define IS_NET_MESSAGE( call )          IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_FIRST, NET_LAST )
-
 
239
 
-
 
240
/** Returns a value indicating whether the IPC call is a generic networking message.
-
 
241
 *  @param[in] call The IPC call to be checked.
-
 
242
 */
107
#define IS_NET_NET_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_NET_FIRST, NET_NET_LAST )
243
#define IS_NET_NET_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_NET_FIRST, NET_NET_LAST )
-
 
244
 
-
 
245
/** Returns a value indicating whether the IPC call is a network interface layer message.
-
 
246
 *  @param[in] call The IPC call to be checked.
-
 
247
 */
108
#define IS_NET_NIL_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_NIL_FIRST, NET_NIL_LAST )
248
#define IS_NET_NIL_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_NIL_FIRST, NET_NIL_LAST )
-
 
249
 
-
 
250
/** Returns a value indicating whether the IPC call is an Ethernet message.
-
 
251
 *  @param[in] call The IPC call to be checked.
-
 
252
 */
109
#define IS_NET_ETH_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_ETH_FIRST, NET_ETH_LAST )
253
#define IS_NET_ETH_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_ETH_FIRST, NET_ETH_LAST )
-
 
254
 
-
 
255
/** Returns a value indicating whether the IPC call is an inter-network layer message.
-
 
256
 *  @param[in] call The IPC call to be checked.
-
 
257
 */
110
#define IS_NET_IL_MESSAGE( call )       IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_IL_FIRST, NET_IL_LAST )
258
#define IS_NET_IL_MESSAGE( call )       IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_IL_FIRST, NET_IL_LAST )
-
 
259
 
-
 
260
/** Returns a value indicating whether the IPC call is an IP message.
-
 
261
 *  @param[in] call The IPC call to be checked.
-
 
262
 */
111
#define IS_NET_IP_MESSAGE( call )       IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_IP_FIRST, NET_IP_LAST )
263
#define IS_NET_IP_MESSAGE( call )       IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_IP_FIRST, NET_IP_LAST )
-
 
264
 
-
 
265
/** Returns a value indicating whether the IPC call is an ARP message.
-
 
266
 *  @param[in] call The IPC call to be checked.
-
 
267
 */
112
#define IS_NET_ARP_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_ARP_FIRST, NET_ARP_LAST )
268
#define IS_NET_ARP_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_ARP_FIRST, NET_ARP_LAST )
-
 
269
 
-
 
270
/** Returns a value indicating whether the IPC call is an ICMP message.
-
 
271
 *  @param[in] call The IPC call to be checked.
-
 
272
 */
113
#define IS_NET_ICMP_MESSAGE( call )     IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_ICMP_FIRST, NET_ICMP_LAST )
273
#define IS_NET_ICMP_MESSAGE( call )     IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_ICMP_FIRST, NET_ICMP_LAST )
-
 
274
 
-
 
275
/** Returns a value indicating whether the IPC call is a transport layer message.
-
 
276
 *  @param[in] call The IPC call to be checked.
-
 
277
 */
114
#define IS_NET_TL_MESSAGE( call )       IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_TL_FIRST, NET_TL_LAST )
278
#define IS_NET_TL_MESSAGE( call )       IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_TL_FIRST, NET_TL_LAST )
-
 
279
 
-
 
280
/** Returns a value indicating whether the IPC call is a UDP message.
-
 
281
 *  @param[in] call The IPC call to be checked.
-
 
282
 */
115
#define IS_NET_UDP_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_UDP_FIRST, NET_UDP_LAST )
283
#define IS_NET_UDP_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_UDP_FIRST, NET_UDP_LAST )
-
 
284
 
-
 
285
/** Returns a value indicating whether the IPC call is a TCP message.
-
 
286
 *  @param[in] call The IPC call to be checked.
-
 
287
 */
116
#define IS_NET_TCP_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_TCP_FIRST, NET_TCP_LAST )
288
#define IS_NET_TCP_MESSAGE( call )      IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_TCP_FIRST, NET_TCP_LAST )
-
 
289
 
-
 
290
/** Returns a value indicating whether the IPC call is a socket message.
-
 
291
 *  @param[in] call The IPC call to be checked.
-
 
292
 */
117
#define IS_NET_SOCKET_MESSAGE( call )   IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_SOCKET_FIRST, NET_SOCKET_LAST )
293
#define IS_NET_SOCKET_MESSAGE( call )   IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_SOCKET_FIRST, NET_SOCKET_LAST )
-
 
294
 
-
 
295
/** Returns a value indicating whether the IPC call is a packet manaagement system message.
-
 
296
 *  @param[in] call The IPC call to be checked.
-
 
297
 */
118
#define IS_NET_PACKET_MESSAGE( call )   IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_PACKET_FIRST, NET_PACKET_LAST )
298
#define IS_NET_PACKET_MESSAGE( call )   IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_PACKET_FIRST, NET_PACKET_LAST )
119
 
299
 
-
 
300
/*@}*/
-
 
301
 
-
 
302
/** @name Networking specific message parameters definitions
-
 
303
 */
-
 
304
/*@{*/
-
 
305
 
120
/** Returns the device identifier message parameter.
306
/** Returns the device identifier message parameter.
-
 
307
 *  @param[in] call The message call structure.
121
 */
308
 */
122
#define IPC_GET_DEVICE( call )      ( device_id_t ) IPC_GET_ARG1( * call )
309
#define IPC_GET_DEVICE( call )      ( device_id_t ) IPC_GET_ARG1( * call )
123
 
310
 
124
/** Returns the packet identifier message parameter.
311
/** Returns the packet identifier message parameter.
-
 
312
 *  @param[in] call The message call structure.
125
 */
313
 */
126
#define IPC_GET_PACKET( call )      ( packet_id_t ) IPC_GET_ARG2( * call )
314
#define IPC_GET_PACKET( call )      ( packet_id_t ) IPC_GET_ARG2( * call )
-
 
315
 
-
 
316
/** Returns the count message parameter.
-
 
317
 *  @param[in] call The message call structure.
-
 
318
 */
127
#define IPC_GET_COUNT( call )       ( size_t ) IPC_GET_ARG2( * call )
319
#define IPC_GET_COUNT( call )       ( size_t ) IPC_GET_ARG2( * call )
-
 
320
 
-
 
321
/** Returns the device state message parameter.
-
 
322
 *  @param[in] call The message call structure.
-
 
323
 */
128
#define IPC_GET_STATE( call )       ( device_state_t ) IPC_GET_ARG2( * call )
324
#define IPC_GET_STATE( call )       ( device_state_t ) IPC_GET_ARG2( * call )
129
 
325
 
130
/** Returns the maximum transmission unit message parameter.
326
/** Returns the maximum transmission unit message parameter.
-
 
327
 *  @param[in] call The message call structure.
131
 */
328
 */
132
#define IPC_GET_MTU( call )         ( size_t ) IPC_GET_ARG2( * call )
329
#define IPC_GET_MTU( call )         ( size_t ) IPC_GET_ARG2( * call )
133
 
330
 
134
/** Returns the device driver service message parameter.
331
/** Returns the device driver service message parameter.
-
 
332
 *  @param[in] call The message call structure.
135
 */
333
 */
136
#define IPC_GET_SERVICE( call )     ( services_t ) IPC_GET_ARG3( * call )
334
#define IPC_GET_SERVICE( call )     ( services_t ) IPC_GET_ARG3( * call )
-
 
335
 
-
 
336
/** Returns the target service message parameter.
-
 
337
 *  @param[in] call The message call structure.
-
 
338
 */
137
#define IPC_GET_TARGET( call )      ( services_t ) IPC_GET_ARG3( * call )
339
#define IPC_GET_TARGET( call )      ( services_t ) IPC_GET_ARG3( * call )
-
 
340
 
-
 
341
/** Returns the sender service message parameter.
-
 
342
 *  @param[in] call The message call structure.
-
 
343
 */
138
#define IPC_GET_SENDER( call )      ( services_t ) IPC_GET_ARG3( * call )
344
#define IPC_GET_SENDER( call )      ( services_t ) IPC_GET_ARG3( * call )
139
 
345
 
-
 
346
/** Returns the error service message parameter.
-
 
347
 *  @param[in] call The message call structure.
-
 
348
 */
140
#define IPC_GET_ERROR( call )       ( services_t ) IPC_GET_ARG4( * call )
349
#define IPC_GET_ERROR( call )       ( services_t ) IPC_GET_ARG4( * call )
141
 
350
 
-
 
351
/** Returns the phone message parameter.
-
 
352
 *  @param[in] call The message call structure.
-
 
353
 */
142
#define IPC_GET_PHONE( call )       ( int ) IPC_GET_ARG5( * call )
354
#define IPC_GET_PHONE( call )       ( int ) IPC_GET_ARG5( * call )
143
 
355
 
-
 
356
/** Sets the device identifier in the message answer.
-
 
357
 *  @param[out] answer The message answer structure.
-
 
358
 */
144
#define IPC_SET_DEVICE( answer )    (( device_id_t * ) & IPC_GET_ARG1( * answer ))
359
#define IPC_SET_DEVICE( answer )    (( device_id_t * ) & IPC_GET_ARG1( * answer ))
145
 
360
 
-
 
361
/** Sets the minimum address length in the message answer.
-
 
362
 *  @param[out] answer The message answer structure.
-
 
363
 */
146
#define IPC_SET_ADDR( answer )      (( size_t * ) & IPC_GET_ARG1( * answer ))
364
#define IPC_SET_ADDR( answer )      (( size_t * ) & IPC_GET_ARG1( * answer ))
-
 
365
 
-
 
366
/** Sets the minimum prefix size in the message answer.
-
 
367
 *  @param[out] answer The message answer structure.
-
 
368
 */
147
#define IPC_SET_PREFIX( answer )    (( size_t * ) & IPC_GET_ARG2( * answer ))
369
#define IPC_SET_PREFIX( answer )    (( size_t * ) & IPC_GET_ARG2( * answer ))
-
 
370
 
-
 
371
/** Sets the maximum content size in the message answer.
-
 
372
 *  @param[out] answer The message answer structure.
-
 
373
 */
148
#define IPC_SET_CONTENT( answer )   (( size_t * ) & IPC_GET_ARG3( * answer ))
374
#define IPC_SET_CONTENT( answer )   (( size_t * ) & IPC_GET_ARG3( * answer ))
-
 
375
 
-
 
376
/** Sets the minimum suffix size in the message answer.
-
 
377
 *  @param[out] answer The message answer structure.
-
 
378
 */
149
#define IPC_SET_SUFFIX( answer )    (( size_t * ) & IPC_GET_ARG4( * answer ))
379
#define IPC_SET_SUFFIX( answer )    (( size_t * ) & IPC_GET_ARG4( * answer ))
150
 
380
 
-
 
381
/*@}*/
-
 
382
 
-
 
383
/** Returns the address.
-
 
384
 *  @param[in] phone The service module phone.
-
 
385
 *  @param[in] message The service specific message.
-
 
386
 *  @param[in] device_id The device identifier.
-
 
387
 *  @param[out] address The desired address.
-
 
388
 *  @param[out] data The address data container.
-
 
389
 *  @returns EOK on success.
-
 
390
 *  @returns EBADMEM if the address parameter and/or the data parameter is NULL.
-
 
391
 *  @returns Other error codes as defined for the specific service message.
-
 
392
 */
151
static inline int generic_get_addr_req( int phone, int message, device_id_t device_id, measured_string_ref * address, char ** data ){
393
static inline int generic_get_addr_req( int phone, int message, device_id_t device_id, measured_string_ref * address, char ** data ){
152
    aid_t           message_id;
394
    aid_t           message_id;
153
    ipcarg_t        result;
395
    ipcarg_t        result;
154
    int             string;
396
    int             string;
155
 
397
 
Line 162... Line 404...
162
        free( * data );
404
        free( * data );
163
    }
405
    }
164
    return ( int ) result;
406
    return ( int ) result;
165
}
407
}
166
 
408
 
-
 
409
/** Translates the given strings.
-
 
410
 *  Allocates and returns the needed memory block as the data parameter.
-
 
411
 *  @param[in] phone The service module phone.
-
 
412
 *  @param[in] message The service specific message.
-
 
413
 *  @param[in] device_id The device identifier.
-
 
414
 *  @param[in] service The module service.
-
 
415
 *  @param[in] configuration The key strings.
-
 
416
 *  @param[in] count The number of configuration keys.
-
 
417
 *  @param[out] translation The translated values.
-
 
418
 *  @param[out] data The translation data container.
-
 
419
 *  @returns EOK on success.
-
 
420
 *  @returns EINVAL if the configuration parameter is NULL.
-
 
421
 *  @returns EINVAL if the count parameter is zero (0).
-
 
422
 *  @returns EBADMEM if the translation or the data parameters are NULL.
-
 
423
 *  @returns Other error codes as defined for the specific service message.
-
 
424
 */
167
static inline int   generic_translate_req( int phone, int message, device_id_t device_id, services_t service, measured_string_ref configuration, size_t count, measured_string_ref * translation, char ** data ){
425
static inline int   generic_translate_req( int phone, int message, device_id_t device_id, services_t service, measured_string_ref configuration, size_t count, measured_string_ref * translation, char ** data ){
168
    aid_t           message_id;
426
    aid_t           message_id;
169
    ipcarg_t        result;
427
    ipcarg_t        result;
170
    int             string;
428
    int             string;
171
 
429
 
Line 180... Line 438...
180
        free( * data );
438
        free( * data );
181
    }
439
    }
182
    return ( int ) result;
440
    return ( int ) result;
183
}
441
}
184
 
442
 
-
 
443
/** Sends the packet queue.
-
 
444
 *  @param[in] phone The service module phone.
-
 
445
 *  @param[in] message The service specific message.
-
 
446
 *  @param[in] device_id The device identifier.
-
 
447
 *  @param[in] packet_id The packet or the packet queue identifier.
-
 
448
 *  @param[in] sender The sending module service.
-
 
449
 *  @param[in] error The error module service.
-
 
450
 *  @returns EOK on success.
-
 
451
 */
185
static inline int   generic_send_msg( int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t sender, services_t error ){
452
static inline int   generic_send_msg( int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t sender, services_t error ){
186
    if( error ){
453
    if( error ){
187
        async_msg_4( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) packet_id, ( ipcarg_t ) sender, ( ipcarg_t ) error );
454
        async_msg_4( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) packet_id, ( ipcarg_t ) sender, ( ipcarg_t ) error );
188
    }else{
455
    }else{
189
        async_msg_3( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) packet_id, ( ipcarg_t ) sender );
456
        async_msg_3( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) packet_id, ( ipcarg_t ) sender );
190
    }
457
    }
191
    return EOK;
458
    return EOK;
192
}
459
}
193
 
460
 
-
 
461
/** Returns the device packet dimensions for sending.
-
 
462
 *  @param[in] phone The service module phone.
-
 
463
 *  @param[in] message The service specific message.
-
 
464
 *  @param[in] device_id The device identifier.
-
 
465
 *  @param[out] addr_len The minimum reserved address length.
-
 
466
 *  @param[out] prefix The minimum reserved prefix size.
-
 
467
 *  @param[out] content The maximum content size.
-
 
468
 *  @param[out] suffix The minimum reserved suffix size.
-
 
469
 *  @returns EOK on success.
-
 
470
 *  @returns Other error codes as defined for the specific service message.
-
 
471
 */
194
static inline int   generic_packet_size_req( int phone, int message, device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix ){
472
static inline int   generic_packet_size_req( int phone, int message, device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix ){
195
    return ( int ) async_req_1_4( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t * ) addr_len, ( ipcarg_t * ) prefix, ( ipcarg_t * ) content, ( ipcarg_t * ) suffix );
473
    return ( int ) async_req_1_4( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t * ) addr_len, ( ipcarg_t * ) prefix, ( ipcarg_t * ) content, ( ipcarg_t * ) suffix );
196
}
474
}
197
 
475
 
-
 
476
/** Notifies the module about the device state change.
-
 
477
 *  @param[in] phone The service module phone.
-
 
478
 *  @param[in] message The service specific message.
-
 
479
 *  @param[in] device_id The device identifier.
-
 
480
 *  @param[in] state The new device state.
-
 
481
 *  @param[in] target The target module service.
-
 
482
 *  @returns EOK on success.
-
 
483
 */
198
static inline int   generic_device_state_msg( int phone, int message, device_id_t device_id, int state, services_t target ){
484
static inline int   generic_device_state_msg( int phone, int message, device_id_t device_id, int state, services_t target ){
199
    async_msg_3( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) state, target );
485
    async_msg_3( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) state, target );
200
    return EOK;
486
    return EOK;
201
}
487
}
202
 
488
 
-
 
489
/** Passes the packet queue to the module.
-
 
490
 *  @param[in] phone The service module phone.
-
 
491
 *  @param[in] message The service specific message.
-
 
492
 *  @param[in] device_id The device identifier.
-
 
493
 *  @param[in] packet_id The received packet or the received packet queue identifier.
-
 
494
 *  @param[in] target The target module service.
-
 
495
 *  @param[in] error The error module service.
-
 
496
 *  @returns EOK on success.
-
 
497
 */
203
static inline int   generic_received_msg( int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t target, services_t error ){
498
static inline int   generic_received_msg( int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t target, services_t error ){
204
    if( error ){
499
    if( error ){
205
        async_msg_4( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) packet_id, ( ipcarg_t ) target, ( ipcarg_t ) error );
500
        async_msg_4( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) packet_id, ( ipcarg_t ) target, ( ipcarg_t ) error );
206
    }else{
501
    }else{
207
        async_msg_3( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) packet_id, ( ipcarg_t ) target );
502
        async_msg_3( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) packet_id, ( ipcarg_t ) target );
208
    }
503
    }
209
    return EOK;
504
    return EOK;
210
}
505
}
211
 
506
 
-
 
507
/** Notifies a module about the device.
-
 
508
 *  @param[in] phone The service module phone.
-
 
509
 *  @param[in] message The service specific message.
-
 
510
 *  @param[in] device_id The device identifier.
-
 
511
 *  @param[in] arg2 The second argument of the message.
-
 
512
 *  @param[in] service The device module service.
-
 
513
 *  @returns EOK on success.
-
 
514
 *  @returns Other error codes as defined for the specific service message.
-
 
515
 */
212
static inline int   generic_device_req( int phone, int message, device_id_t device_id, int arg2, services_t service ){
516
static inline int   generic_device_req( int phone, int message, device_id_t device_id, int arg2, services_t service ){
213
    return ( int ) async_req_3_0( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) arg2, ( ipcarg_t ) service );
517
    return ( int ) async_req_3_0( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) arg2, ( ipcarg_t ) service );
214
}
518
}
215
 
519
 
216
#endif
520
#endif