Subversion Repositories HelenOS

Rev

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

Rev 4701 Rev 4712
Line 37... Line 37...
37
 */
37
 */
38
 
38
 
39
#ifndef __NET_SOCKET_H__
39
#ifndef __NET_SOCKET_H__
40
#define __NET_SOCKET_H__
40
#define __NET_SOCKET_H__
41
 
41
 
42
#include <sys/types.h>
-
 
43
 
-
 
44
#include "byteorder.h"
42
#include "byteorder.h"
45
#include "in.h"
43
#include "in.h"
46
#include "inet.h"
44
#include "inet.h"
47
 
45
 
48
/** @name Address families definitions
-
 
49
*/
-
 
50
/*@{*/
-
 
51
/** Unspecified address family.
-
 
52
 */
-
 
53
#define AF_UNSPEC   0
-
 
54
 
-
 
55
/** Unix domain sockets address family.
-
 
56
 */
-
 
57
#define AF_UNIXL    1
-
 
58
 
-
 
59
/** POSIX name for AF_UNIX address family.
-
 
60
 */
-
 
61
#define AF_LOCAL    1
-
 
62
 
-
 
63
/** Internet IP Protocol address family.
-
 
64
 */
-
 
65
#define AF_INET     2
-
 
66
 
-
 
67
/** Amateur Radio AX.25 address family.
-
 
68
 */
-
 
69
#define AF_AX25     3
-
 
70
 
-
 
71
/** Novell IPX address family.
-
 
72
 */
-
 
73
#define AF_IPX      4
-
 
74
 
-
 
75
/** AppleTalk DDP address family.
-
 
76
 */
-
 
77
#define AF_APPLETALK    5
-
 
78
 
-
 
79
/** Amateur Radio NET/ROM address family.
-
 
80
 */
-
 
81
#define AF_NETROM   6
-
 
82
 
-
 
83
/** Multiprotocol bridge address family.
-
 
84
 */
-
 
85
#define AF_BRIDGE   7
-
 
86
 
-
 
87
/** ATM PVCs address family.
-
 
88
 */
-
 
89
#define AF_ATMPVC   8
-
 
90
 
-
 
91
/** Reserved for X.25 project address family.
-
 
92
 */
-
 
93
#define AF_X25      9
-
 
94
 
-
 
95
/** IP version 6 address family.
-
 
96
 */
-
 
97
#define AF_INET6    10
-
 
98
 
-
 
99
/** Amateur Radio X.25 PLP address family.
-
 
100
 */
-
 
101
#define AF_ROSE     11
-
 
102
 
-
 
103
/** Reserved for DECnet project address family.
-
 
104
 */
-
 
105
#define AF_DECnet   12
-
 
106
 
-
 
107
/** Reserved for 802.2LLC project address family.
-
 
108
 */
-
 
109
#define AF_NETBEUI  13
-
 
110
 
-
 
111
/** Security callback pseudo AF address family.
-
 
112
 */
-
 
113
#define AF_SECURITY 14
-
 
114
 
-
 
115
/** PF_KEY key management API address family.
-
 
116
 */
-
 
117
#define AF_KEY      15
-
 
118
 
-
 
119
/** Alias to emulate 4.4BSD address family.
-
 
120
 */
-
 
121
#define AF_NETLINK  16
-
 
122
 
-
 
123
/** Packet family address family.
-
 
124
 */
-
 
125
#define AF_PACKET   17
-
 
126
 
-
 
127
/** Ash address family.
-
 
128
 */
-
 
129
#define AF_ASH      18
-
 
130
 
-
 
131
/** Acorn Econet address family.
-
 
132
 */
-
 
133
#define AF_ECONET   19
-
 
134
 
-
 
135
/** ATM SVCs address family.
-
 
136
 */
-
 
137
#define AF_ATMSVC   20
-
 
138
 
-
 
139
/** Linux SNA Project (nutters!) address family.
-
 
140
 */
-
 
141
#define AF_SNA      22
-
 
142
 
-
 
143
/** IRDA sockets address family.
-
 
144
 */
-
 
145
#define AF_IRDA     23
-
 
146
 
-
 
147
/** PPPoX sockets address family.
-
 
148
 */
-
 
149
#define AF_PPPOX    24
-
 
150
 
-
 
151
/** Wanpipe API Sockets address family.
-
 
152
 */
-
 
153
#define AF_WANPIPE  25
-
 
154
 
-
 
155
/** Linux LLC address family.
-
 
156
 */
-
 
157
#define AF_LLC      26
-
 
158
 
-
 
159
/** Controller Area Network address family.
-
 
160
 */
-
 
161
#define AF_CAN      29
-
 
162
 
-
 
163
/** TIPC sockets address family.
-
 
164
 */
-
 
165
#define AF_TIPC     30
-
 
166
 
-
 
167
/** Bluetooth sockets address family.
-
 
168
 */
-
 
169
#define AF_BLUETOOTH    31
-
 
170
 
-
 
171
/** IUCV sockets address family.
-
 
172
 */
-
 
173
#define AF_IUCV     32
-
 
174
 
-
 
175
/** RxRPC sockets address family.
-
 
176
 */
-
 
177
#define AF_RXRPC    33
-
 
178
 
-
 
179
/** Maximum address family.
-
 
180
 */
-
 
181
#define AF_MAX      34
-
 
182
/*@}*/
-
 
183
 
-
 
184
/** @name Protocol families definitions
-
 
185
 *  Same as address families.
-
 
186
 */
-
 
187
/*@{*/
-
 
188
/** Unspecified protocol family.
-
 
189
 */
-
 
190
#define PF_UNSPEC   AF_UNSPEC
-
 
191
 
-
 
192
/** Unix domain sockets protocol family.
-
 
193
 */
-
 
194
#define PF_UNIXL    AF_UNIXL
-
 
195
 
-
 
196
/** POSIX name for AF_UNIX protocol family.
-
 
197
 */
-
 
198
#define PF_LOCAL    AF_LOCAL
-
 
199
 
-
 
200
/** Internet IP Protocol protocol family.
-
 
201
 */
-
 
202
#define PF_INET     AF_INET
-
 
203
 
-
 
204
/** Amateur Radio AX.25 protocol family.
-
 
205
 */
-
 
206
#define PF_AX25     AF_AX25
-
 
207
 
-
 
208
/** Novell IPX protocol family.
-
 
209
 */
-
 
210
#define PF_IPX      AF_IPX
-
 
211
 
-
 
212
/** AppleTalk DDP protocol family.
-
 
213
 */
-
 
214
#define PF_APPLETALK    AF_APPLETALK
-
 
215
 
-
 
216
/** Amateur Radio NET/ROM protocol family.
-
 
217
 */
-
 
218
#define PF_NETROM   AF_NETROM
-
 
219
 
-
 
220
/** Multiprotocol bridge protocol family.
-
 
221
 */
-
 
222
#define PF_BRIDGE   AF_BRIDGE
-
 
223
 
-
 
224
/** ATM PVCs protocol family.
-
 
225
 */
-
 
226
#define PF_ATMPVC   AF_ATMPVC
-
 
227
 
-
 
228
/** Reserved for X.25 project protocol family.
-
 
229
 */
-
 
230
#define PF_X25      AF_X25
-
 
231
 
-
 
232
/** IP version 6 protocol family.
-
 
233
 */
-
 
234
#define PF_INET6    AF_INET6
-
 
235
 
-
 
236
/** Amateur Radio X.25 PLP protocol family.
-
 
237
 */
-
 
238
#define PF_ROSE     AF_ROSE
-
 
239
 
-
 
240
/** Reserved for DECnet project protocol family.
-
 
241
 */
-
 
242
#define PF_DECnet   AF_DECnet
-
 
243
 
-
 
244
/** Reserved for 802.2LLC project protocol family.
-
 
245
 */
-
 
246
#define PF_NETBEUI  AF_NETBEUI
-
 
247
 
-
 
248
/** Security callback pseudo AF protocol family.
-
 
249
 */
-
 
250
#define PF_SECURITY AF_SECURITY
-
 
251
 
-
 
252
/** PF_KEY key management API protocol family.
-
 
253
 */
-
 
254
#define PF_KEY      AF_KEY
-
 
255
 
-
 
256
/** Alias to emulate 4.4BSD protocol family.
-
 
257
 */
-
 
258
#define PF_NETLINK  AF_NETLINK
-
 
259
 
-
 
260
/** Packet family protocol family.
-
 
261
 */
-
 
262
#define PF_PACKET   AF_PACKET
-
 
263
 
-
 
264
/** Ash protocol family.
-
 
265
 */
-
 
266
#define PF_ASH      AF_ASH
-
 
267
 
-
 
268
/** Acorn Econet protocol family.
-
 
269
 */
-
 
270
#define PF_ECONET   AF_ECONET
-
 
271
 
-
 
272
/** ATM SVCs protocol family.
-
 
273
 */
-
 
274
#define PF_ATMSVC   AF_ATMSVC
-
 
275
 
-
 
276
/** Linux SNA Project (nutters!) protocol family.
-
 
277
 */
-
 
278
#define PF_SNA      AF_SNA
-
 
279
 
-
 
280
/** IRDA sockets protocol family.
-
 
281
 */
-
 
282
#define PF_IRDA     AF_IRDA
-
 
283
 
-
 
284
/** PPPoX sockets protocol family.
-
 
285
 */
-
 
286
#define PF_PPPOX    AF_PPPOX
-
 
287
 
-
 
288
/** Wanpipe API Sockets protocol family.
-
 
289
 */
-
 
290
#define PF_WANPIPE  AF_WANPIPE
-
 
291
 
-
 
292
/** Linux LLC protocol family.
-
 
293
 */
-
 
294
#define PF_LLC      AF_LLC
-
 
295
 
-
 
296
/** Controller Area Network protocol family.
-
 
297
 */
-
 
298
#define PF_CAN      AF_CAN
-
 
299
 
-
 
300
/** TIPC sockets protocol family.
-
 
301
 */
-
 
302
#define PF_TIPC     AF_TIPC
-
 
303
 
-
 
304
/** Bluetooth sockets protocol family.
-
 
305
 */
-
 
306
#define PF_BLUETOOTH    AF_BLUETOOTH
-
 
307
 
-
 
308
/** IUCV sockets protocol family.
-
 
309
 */
-
 
310
#define PF_IUCV     AF_IUCV
-
 
311
 
-
 
312
/** RxRPC sockets protocol family.
-
 
313
 */
-
 
314
#define PF_RXRPC    AF_RXRPC
-
 
315
 
-
 
316
/** Maximum protocol family.
-
 
317
 */
-
 
318
#define PF_MAX      AF_MAX
-
 
319
/*@}*/
-
 
320
 
-
 
321
/** @name Socket option levels definitions
-
 
322
 *  Thanks to BSD these must match IPPROTO_xxx
-
 
323
 */
-
 
324
/*@{*/
-
 
325
 
-
 
326
/** IP socket option level.
-
 
327
 */
-
 
328
#define SOL_IP      0
-
 
329
 
-
 
330
/** ICMP socket option level.
-
 
331
 */
-
 
332
#define SOL_ICMP    1
-
 
333
 
-
 
334
/** TCP socket option level.
-
 
335
 */
-
 
336
#define SOL_TCP     6
-
 
337
 
-
 
338
/** UDP socket option level.
-
 
339
 */
-
 
340
#define SOL_UDP     17
-
 
341
 
-
 
342
/** IPV socket option level.
-
 
343
 */
-
 
344
#define SOL_IPV6    41
-
 
345
 
-
 
346
/** ICMPV socket option level.
-
 
347
 */
-
 
348
#define SOL_ICMPV6  58
-
 
349
 
-
 
350
/** SCTP socket option level.
-
 
351
 */
-
 
352
#define SOL_SCTP    132
-
 
353
 
-
 
354
/** UDP-Lite (RFC 3828) socket option level.
-
 
355
 */
-
 
356
#define SOL_UDPLITE 136
-
 
357
 
-
 
358
/** RAW socket option level.
-
 
359
 */
-
 
360
#define SOL_RAW     255
-
 
361
 
-
 
362
/** IPX socket option level.
-
 
363
 */
-
 
364
#define SOL_IPX     256
-
 
365
 
-
 
366
/** AX socket option level.
-
 
367
 */
-
 
368
#define SOL_AX25    257
-
 
369
 
-
 
370
/** ATALK socket option level.
-
 
371
 */
-
 
372
#define SOL_ATALK   258
-
 
373
 
-
 
374
/** NETROM socket option level.
-
 
375
 */
-
 
376
#define SOL_NETROM  259
-
 
377
 
-
 
378
/** ROSE socket option level.
-
 
379
 */
-
 
380
#define SOL_ROSE    260
-
 
381
 
-
 
382
/** DECNET socket option level.
-
 
383
 */
-
 
384
#define SOL_DECNET  261
-
 
385
 
-
 
386
/** X25 socket option level.
-
 
387
 */
-
 
388
#define SOL_X25     262
-
 
389
 
-
 
390
/** PACKET socket option level.
-
 
391
 */
-
 
392
#define SOL_PACKET  263
-
 
393
 
-
 
394
/** ATM layer (cell level) socket option level.
-
 
395
 */
-
 
396
#define SOL_ATM     264
-
 
397
 
-
 
398
/** ATM Adaption Layer (packet level) socket option level.
-
 
399
 */
-
 
400
#define SOL_AAL     265
-
 
401
 
-
 
402
/** IRDA socket option level.
-
 
403
 */
-
 
404
#define SOL_IRDA    266
-
 
405
 
-
 
406
/** NETBEUI socket option level.
-
 
407
 */
-
 
408
#define SOL_NETBEUI 267
-
 
409
 
-
 
410
/** LLC socket option level.
-
 
411
 */
-
 
412
#define SOL_LLC     268
-
 
413
 
-
 
414
/** DCCP socket option level.
-
 
415
 */
-
 
416
#define SOL_DCCP    269
-
 
417
 
-
 
418
/** NETLINK socket option level.
-
 
419
 */
-
 
420
#define SOL_NETLINK 270
-
 
421
 
-
 
422
/** TIPC socket option level.
-
 
423
 */
-
 
424
#define SOL_TIPC    271
-
 
425
 
-
 
426
/** RXRPC socket option level.
-
 
427
 */
-
 
428
#define SOL_RXRPC   272
-
 
429
 
-
 
430
/** PPPOL socket option level.
-
 
431
 */
-
 
432
#define SOL_PPPOL2TP    273
-
 
433
 
-
 
434
/** BLUETOOTH socket option level.
-
 
435
 */
-
 
436
#define SOL_BLUETOOTH   274
-
 
437
 
-
 
438
/*@}*/
-
 
439
 
-
 
440
//
-
 
441
/* * IPX options.
-
 
442
 */
-
 
443
//#define IPX_TYPE  1
-
 
444
 
-
 
445
/** Socket types.
46
#include "socket_codes.h"
446
 */
-
 
447
typedef enum sock_type{
-
 
448
    /** Stream (connection oriented) socket.
-
 
449
     */
-
 
450
    SOCK_STREAM = 1,
-
 
451
    /** Datagram (connectionless oriented) socket.
-
 
452
     */
-
 
453
    SOCK_DGRAM  = 2,
-
 
454
    /** Raw socket.
-
 
455
     */
-
 
456
    SOCK_RAW    = 3
-
 
457
} sock_type_t;
-
 
458
 
-
 
459
/** Type definition of the socket length.
-
 
460
 */
-
 
461
typedef int32_t socklen_t;
-
 
462
 
47
 
463
/** @name Socket application programming interface
48
/** @name Socket application programming interface
464
 */
49
 */
465
/*@{*/
50
/*@{*/
466
 
51