blob: 451a9c3895813ad8bb3f77596f5f239fbaf8fc24 [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001/*************************************************************************
2*
3* Copyright 1993 Mentor Graphics Corporation
4* All Rights Reserved.
5*
6* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS
7* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS
8* SUBJECT TO LICENSE TERMS.
9*
10*************************************************************************/
11
12/***************************************************************************
13*
14* FILENAME
15*
16* nal_public_defs.h
17*
18* COMPONENTS
19*
20* Sockets
21*
22* DESCRIPTION
23*
24* This include file will define socket type error return codes, socket
25* options, and socket protocol types.
26*
27* DATA STRUCTURES
28*
29* None
30*
31* DEPENDENCIES
32*
33* None
34*
35***************************************************************************/
36
37#ifndef NAL_PUBLIC_SOCKDEFS_H
38#define NAL_PUBLIC_SOCKDEFS_H
39
40#ifdef __cplusplus
41extern "C" { /* C declarations in C++ */
42#endif /* _cplusplus */
43
44#include "nal_general_types.h"
45
46#define MOD_NAL MOD_NIL
47
48/* Defines for TRUE/ FALSE conditions */
49#define NAL_FALSE 0
50#define NAL_TRUE 1
51
52/* Do not redefine these macros if using the Nucleus builder to compile the
53* code. If not using the Nucleus builder, all macros must be explicitly
54* configured here; otherwise, configure the respective .metadata file.
55*/
56#ifndef CFG_NAL_OS_NET_STACK_CFG_H
57
58/* Set this to NU_FALSE to exclude UDP. */
59#define NAL_INCLUDE_UDP NAL_TRUE
60
61/* Set this to NU_FALSE to exclude TCP. */
62#define NAL_INCLUDE_TCP NAL_TRUE
63
64/* By default raw IP is not included in the Nucleus NET build. Set this
65 to NU_TRUE to include raw IP.
66*/
67#define NAL_INCLUDE_IP_RAW NAL_TRUE
68
69/* By default IPv4 is included in the Nucleus NET library. Change this
70 definition to NU_FALSE to exclude IPv4. */
71#define NAL_INCLUDE_IPV4 NAL_TRUE
72
73/* By default IPv6 is not included in the Nucleus NET library. Change this
74 definition to NU_TRUE to include IPv6. Note that IPv6 is a separate product
75 and must have been purchased and installed for this option to work. */
76#define NAL_INCLUDE_IPV6 NAL_TRUE
77
78
79#endif
80
81/*Constant used in service parameters*/
82#define NAL_SUSPEND KAL_SUSPEND
83#define NAL_NO_SUSPEND 0
84
85/* A generic catch-all for unused parameters. */
86#define NAL_NONE 0
87
88/* Address family equates */
89#define NAL_FAM_UNSPEC 0 /* unspecified */
90#define NAL_FAM_LOCAL 1
91#define NAL_FAM_UNIX NAL_FAM_LOCAL
92#define NAL_FAM_IP 2 /* Internet: UDP, TCP, etc. */
93#define NAL_FAM_ROUTE 17 /* Internal routing protocol */
94#define NAL_FAM_LINK 18 /* Link layer interface. */
95#define NAL_FAM_IP6 28 /* IPv6 */
96
97/* These equates are for backwards compatibility */
98#define NAL_FAMILY_UNIX NAL_FAM_UNIX /* Unix */
99#define NAL_FAMILY_IP NAL_FAM_IP /* Internet - valid entry */
100#define NAL_FAMILY_IP6 NAL_FAM_IP6 /* IPv6 */
101#define NAL_FAMILY_UNSPEC NAL_FAM_UNSPEC
102
103/* TYPE equates */
104#define NAL_TYPE_STREAM 0 /* stream Socket - valid entry */
105#define NAL_TYPE_DGRAM 1 /* datagram Socket - valid entry */
106#define NAL_TYPE_RAW 2 /* raw Socket - valid entry */
107#define NAL_TYPE_SEQPACKET 3 /* sequenced packet Socket */
108#define NAL_TYPE_RDM 4 /* reliably delivered msg Socket */
109
110/* PROTOCOL equates */
111#define NAL_PROTO_INVALID 0
112#define NAL_PROTO_TCP 1
113#define NAL_PROTO_UDP 2
114#define NAL_PROTO_ICMP 3
115
116/* Shutdown options - bit settings */
117#define NAL_SHUT_RD 0x00000001 /* Close read-half */
118#define NAL_SHUT_WR 0x00000002 /* Close write-half */
119#define NAL_SHUT_RDWR (NAL_SHUT_RD|NAL_SHUT_WR)
120
121/* Application Protocol Information */
122typedef enum {
123 NAL_ICD_APP_PROT_OTHER,
124 NAL_ICD_APP_PROT_DNS,
125 NAL_ICD_APP_PROT_NATT_KEEP_ALV_ISAKMP,
126 NAL_ICD_APP_PROT_SIP,
127 NAL_ICD_APP_PROT_RTP,
128 NAL_ICD_APP_PROT_SIP_DECRYPT,
129 NAL_ICD_APP_PROT_MAX
130} nal_icd_app_prot_type_t;
131
132/* Bitmap for Nucleus Net initialized modules */
133#define NAL_DHCP_CLIENT_MODULE 0x00000001
134
135/* Select index defines */
136#define NAL_SEL_READABLE_IDX 0
137#define NAL_SEL_WRITABLE_IDX 1
138#define NAL_SEL_MAX_FDSET 2
139
140/* Socket multitask flags */
141#define NAL_SCK_RES_BUFF 2
142
143#define NAL_IGNORE_VALUE -1 /* Null parameter value */
144#define NAL_NULL_IP 0 /* Used to initialize ip addresses to NULL */
145
146#if (NAL_INCLUDE_IPV6 == NAL_TRUE)
147#define NAL_MAX_ADDR_SIZE 16
148#else
149#define NAL_MAX_ADDR_SIZE 4
150#endif
151
152#define NAL_UDP_MAX_PORTS 50 /* Maximum number of UDP ports. */
153
154#define NAL_TCP_MAX_PORTS 50 /* Maximum number of TCP ports. */
155
156#if NAL_INCLUDE_IP_RAW == NAL_TRUE
157#define NAL_IPR_MAX_PORTS 30
158#else
159#define NAL_IPR_MAX_PORTS 1
160#endif
161
162/* Total number of socket descriptors. This should be
163 TCP_MAX_PORTS + UDP_MAX_PORTS + IPR_MAX_PORTS */
164#define NAL_NSOCKETS (NAL_TCP_MAX_PORTS + NAL_UDP_MAX_PORTS + NAL_IPR_MAX_PORTS)
165
166
167/*Window size*/
168#define NAL_WINDOW_SIZE 16000
169
170/*
171 * Socket state bits.
172 */
173#define NAL_SS_NOFDREF 0x0001 /* no file table ref any more */
174#define NAL_SS_ISCONNECTED 0x0002 /* socket connected to a peer */
175#define NAL_SS_ISCONNECTING 0x0004 /* in process of connecting to peer */
176#define NAL_SS_ISDISCONNECTING 0x0008 /* in process of disconnecting */
177#define NAL_SS_DEVICEDOWN 0x0010 /* Used only by UDP sockets. Indicates
178 that the device that was being used by
179 a UDP socket/port has gone down. */
180#define NAL_SS_TIMEDOUT 0x0020 /* The connection timed out */
181#define NAL_SS_WAITWINDOW 0x0040 /* Used for the waiting window */
182#define NAL_SS_CANTRCVMORE 0x0080 /* Indicate that a socket's read-half is
183 closed. */
184#define NAL_SS_CANTWRTMORE 0x0100 /* The socket's write-half is closed. */
185/*
186 * Socket Flag bits.
187 */
188#define NAL_SF_BLOCK 0x0001 /* Indicates blocking or non-blocking */
189#define NAL_SF_LISTENER 0x0002 /* Is a TCP server listening */
190#define NAL_SF_ZC_MODE 0x0004 /* Set zerocopy mode for this socket */
191#define NAL_SF_V4_MAPPED 0x0008
192#define NAL_SF_BIND 0x0010
193
194/* Defines added for the NAL_Select service call. */
195#define NAL_FD_BITS 32
196#define NAL_FD_ELEMENTS ((NAL_NSOCKETS/NAL_FD_BITS)+1)
197
198#define NAL_SCK_EVENT_Q_ELEMENT_SIZE 3 /* event queue element size
199 do not change the size */
200
201/* Socket event bits */
202#define NAL_SOCKET_EVENT_NONE 0x00 /* Remove socket from monitoring list */
203#define NAL_SOCKET_EVENT_READ 0x01 /* Wait for socket to become available for reading */
204#define NAL_SOCKET_EVENT_WRITE 0x02 /* Wait for socket to become available for writing */
205#define NAL_SOCKET_EVENT_EXCEPT 0x04 /* Wait for socket exceptions */
206
207
208/*************************** SOCKET OPTIONS *****************************/
209/* SOCKET OPTION control flags */
210#define NAL_SETFLAG 1
211#define NAL_BLOCK 1
212#define NAL_NO_BLOCK 0
213
214/* {DCP 1-30-02} Added ZeroCopy mode flags */
215
216#define NAL_SET_ZC_MODE 2
217#define NAL_ZC_ENABLE 1
218#define NAL_ZC_DISABLE 0
219
220#define NAL_DSCP_LOW_MIN 0
221#define NAL_DSCP_LOW_MAX 7
222
223#define NAL_DSCP_LOWHI_MIN 8
224#define NAL_DSCP_LOWHI_MAX 15
225
226#define NAL_DSCP_NORMAL_MIN 16
227#define NAL_DSCP_NORMAL_MAX 23
228
229#define NAL_DSCP_NORMALHI_MIN 24
230#define NAL_DSCP_NORMALHI_MAX 31
231
232#define NAL_DSCP_MEDIUM_MIN 32
233#define NAL_DSCP_MEDIUM_MAX 39
234
235#define NAL_DSCP_MEDIUMHI_MIN 40
236#define NAL_DSCP_MEDIUMHI_MAX 47
237
238#define NAL_DSCP_HIGH_MIN 48
239#define NAL_DSCP_HIGH_MAX 55
240
241#define NAL_DSCP_HIGHHI_MIN 56
242#define NAL_DSCP_HIGHHI_MAX 63
243
244/* Note when VLAN is enabled the three bit priority field is extracted from */
245/* the IP_TOS field set for the socket by use of the NAL_Setsockopt function. */
246/* The name IP_TOS should not cause confusion when using DiffServ. The DSCP */
247/* will be inserted into the IP_TOS field. The VLAN priority is computed by */
248/* shifting the DSCP value 3 positions to the right (dividing by 8). This */
249/* correctly maps the 64 DSCP values to the 8 available VLAN priorities. */
250
251#define NAL_MAP_DSCP_VLAN_PRIORITY(x) (NAL_UINT8)((x) >> 3)
252
253
254
255/* IP TOS FIELD Bit Layout | 7 | 6 5 4 3 | 2 1 0 | */
256/* 0 | T O S | V L P | */
257
258/* TOS PRECEDENCE HAS BEEN REPLACED BY DIFFSERV VALUES PER RFC2474 */
259
260#define NAL_IP_TOS_NORMAL_SERVICE 0x0
261#define NAL_IP_TOS_MIN_DELAY 0x8 /* MIN-DELAY service = 1 << 3 */
262#define NAL_IP_TOS_MAX_THRUPUT 0x10 /* MAX-THRUPUT service = 2 << 3 */
263#define NAL_IP_TOS_MAX_REL 0x20 /* MAX-RELIABILITY service = 4 << 3 */
264#define NAL_IP_TOS_MIN_DOLLARS 0x40 /* MIN-DOLLAR COST service = 8 << 3 */
265
266
267/*
268 * Options for use with [gs]etsockopt at the TCP level.
269*/
270
271#define NAL_TCP_NODELAY 1
272#define NAL_SO_KEEPALIVE 2
273#define NAL_TCP_FIRST_PROBE_TIMEOUT 3
274#define NAL_TCP_PROBE_TIMEOUT 4
275#define NAL_TCP_MAX_PROBES 5
276#define NAL_TCP_MSL 6
277#define NAL_TCP_FIRST_RTO 7
278#define NAL_TCP_MAX_RTO 8
279#define NAL_TCP_MAX_R2 9
280#define NAL_TCP_MAX_SYN_R2 10
281#define NAL_TCP_DELAY_ACK 11
282#define NAL_TCP_KEEPALIVE_WAIT 12
283#define NAL_TCP_KEEPALIVE_R2 13
284#define NAL_TCP_CONGESTION_CTRL 14
285#define NAL_TCP_CFG_SACK 15
286#define NAL_TCP_CFG_DSACK 16
287#define NAL_TCP_WINDOWSCALE 17
288#define NAL_TCP_SND_WINDOWSIZE 18
289#define NAL_TCP_RCV_WINDOWSIZE 19
290#define NAL_TCP_TIMESTAMP 20
291#define NAL_TCP_KEEPINTVL 21
292#define NAL_TCP_MAXSEG 22
293#define NAL_TCP_MIN_RTO 23
294
295#define FOREIGN_MAX_SEGMENT_LEN 536
296
297/*
298 * Options for use with [gs]etsockopt at the UDP level.
299*/
300#define NAL_UDP_NOCHECKSUM 38
301#define NAL_UDP_MAX_DATAGRAMS 39
302#define NAL_UDP_IGNORE_CHECKSUM 40
303
304
305/* PROTOCOL LEVELS */
306#define NAL_SOCKET_LEVEL 0
307
308
309/* Levels used in the call to NAL_Setsockopt */
310#define NAL_IPPROTO_IP 0
311#define NAL_IPPROTO_ICMP 1
312#define NAL_IPPROTO_IGMP 2
313#define NAL_IPPROTO_GGP 3
314#define NAL_IPPROTO_TCP 6
315#define NAL_IPPROTO_EGP 8
316#define NAL_IPPROTO_PUP 12
317#define NAL_IPPROTO_UDP 17
318#define NAL_IPPROTO_IPV6 41
319#define NAL_SOL_SOCKET 100
320
321/* Protocol used int call to NAL_Socket with a Raw IP socket */
322#define NAL_IPPROTO_HELLO 63
323#define NAL_IPPROTO_RAW 255
324#define NAL_IPPROTO_OSPF 89
325
326#define NAL_IS_RAW_PROTOCOL(next) \
327 (next == NAL_IPPROTO_RAW) || \
328 (next == NAL_IPPROTO_HELLO) || (next == NAL_IPPROTO_OSPF)
329
330/* IPv6 Defines */
331#define NAL_IPPROTO_HOPBYHOP 0 /* Hop-by-Hop Options */
332#define NAL_IPPROTO_ROUTING 43 /* Routing Header */
333#define NAL_IPPROTO_FRAGMENT 44 /* Fragment Header */
334#define NAL_IPPROTO_ESP 50
335#define NAL_IPPROTO_AUTH 51
336#define NAL_IPPROTO_ICMPV6 58
337#define NAL_IPPROTO_NONEXTHDR 59
338#define NAL_IPPROTO_DEST 60 /* Destination Options Header */
339
340/*
341 * Options for use with [gs]etsockopt at the socket level.
342 * First word of comment is data type; bool is stored in int.
343 */
344#define NAL_SO_BROADCAST 1 /* permission to transmit broadcast messages? */
345#define NAL_SO_LINGER 2 /* linger on socket close */
346#define NAL_SO_REUSEADDR 3 /* socket option to bind multiple addresses to
347 the same port number. */
348#define NAL_SO_RCVBUF 4 /* socket option to set the local TCP Window Size
349 for a socket. */
350#define NAL_SO_AUTO_CLEAR 5 /* socket option to clear all errors on a UDP socket. */
351
352#define NAL_SO_BINDTODEVICE 6 /*socket option to set the socket to be bound to a specified device*/
353
354#define NAL_SO_INFO_FIELDS 8 /* fields enabled for nal_recv_with_info() */
355#define NAL_SO_MASTER_FILTER_LIST 9 /* master downlink filter list, used with for example WiFi device.
356 * Size: master filter count * sizeof(nal_int)
357 */
358#define NAL_SO_FILTER_CONFIG 10 /* filter config */
359#define NAL_SO_ICD_INFO 11 /* Information required to dump the UL/DL packets to AP for MDMI */
360#define NAL_SO_AUTORST 12 /* Auto reset accepted TCP Ports on IPSec key del */
361
362#define NAL_FILTER_CONFIG_NONE 0x00
363#define NAL_FILTER_CONFIG_NON_ESP_MARKER 0x01
364#define NAL_FILTER_CONFIG_NAT_KEEPALIVE 0x02
365
366/*
367 * Options for use with [gs]etsockopt at the IP level.
368 * First word of comment is data type; bool is stored in int.
369 */
370#define NAL_IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
371#define NAL_IP_HDRINCL 2 /* int; header is included with data */
372#define NAL_IP_TOS 3 /* int; IP type of service and precedence. */
373#define NAL_IP_TTL 4 /* int; IP time to live */
374#define NAL_IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */
375#define NAL_IP_RECVRETOPTS 6 /* bool; receive IP opts for response */
376#define NAL_IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */
377#define NAL_IP_RETOPTS 8 /* ip_opts; set/get IP options */
378#define NAL_IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */
379#define NAL_IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
380#define NAL_IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
381#define NAL_IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
382#define NAL_IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
383#define NAL_IP_BROADCAST_IF 14 /* u_char; set/get IP broadcast IF */
384#define NAL_IP_RECVIFADDR 15 /* bool; recv IP of IF of last RX datagram */
385
386/* IPv6 socket options */
387#define NAL_IPV6_UNICAST_HOPS 16
388#define NAL_IPV6_MULTICAST_IF 17
389#define NAL_IPV6_MULTICAST_HOPS 18
390#define NAL_IPV6_MULTICAST_LOOP 19
391#define NAL_IPV6_JOIN_GROUP 20
392#define NAL_IPV6_LEAVE_GROUP 21
393#define NAL_IPV6_RECVHOPLIMIT 22
394#define NAL_IPV6_RECVRTHDR 23
395#define NAL_IPV6_RECVHOPOPTS 24
396#define NAL_IPV6_RECVDSTOPTS 25
397#define NAL_IPV6_RECVTCLASS 26
398#define NAL_IPV6_RECVPKTINFO 27
399#define NAL_IPV6_PKTINFO 28
400#define NAL_IPV6_HOPLIMIT 29
401#define NAL_IPV6_NEXTHOP 30
402#define NAL_IPV6_RTHDR 31
403#define NAL_IPV6_HOPOPTS 32
404#define NAL_IPV6_DSTOPTS 33
405#define NAL_IPV6_RTHDRDSTOPTS 34
406#define NAL_IPV6_TCLASS 35
407#define NAL_IPV6_V6ONLY 36
408#define NAL_IPV6_CHECKSUM 37
409
410/* NOTE ...Please note that Options (optname)for use with [gs]etsockopt
411 * at the UDP level use 38- 40 and are defined in udp.h.
412 */
413
414/* Additional socket options. */
415#define NAL_IP_PKTINFO 41
416
417
418#define NAL_IP_RECVIFADDR_OP 0x001
419#define NAL_SO_REUSEADDR_OP 0x002 /* SO_REUSEADDR has been set on the socket */
420#define NAL_SO_IPV6_PKTINFO_OP 0x004
421#define NAL_SO_IPV6_HOPLIMIT_OP 0x008
422#define NAL_SO_IPV6_TCLASS_OP 0x010
423#define NAL_SO_IPV6_RTHDR_OP 0x020
424#define NAL_SO_IPV6_HOPOPTS 0x040
425#define NAL_SO_IPV6_DESTOPTS 0x080
426#define NAL_SO_IPV6_V6ONLY 0x100 /* NAL_FAMILY_IP6 socket for IPv6 comm. only */
427#define NAL_SO_IPV6_CHECKSUM 0x200
428
429#define NAL_SO_UDP_NOCHECKSUM 0x400
430#define NAL_SO_IP_HDRINCL 0x800
431#define NAL_SO_BROADCAST_OP 0x1000
432#define NAL_SO_IP_PKTINFO_OP 0x2000
433
434#if (INCLUDE_MSG_PEEK == NAL_TRUE)
435/* Read operation flags. */
436#define NAL_MSG_PEEK 0x001 /* Leave the received data in queue. */
437#endif
438
439/* Define NAL service completion status constants*/
440#define NAL_RUNLEVEL_COMP_INITIALIZING 2
441#define NAL_SUCCESS 0
442#define NAL_RETURN_ERROR -1
443#define NAL_INVALID_ENTRY -6
444#define NAL_INVALID_OPERATION -13
445#define NAL_INVALID_POINTER -15
446#define NAL_NO_MEMORY -32
447#define NAL_NOT_PRESENT -35
448#define NAL_QUEUE_FULL -45
449#define NAL_TIMEOUT -49
450#define NAL_UNAVAILABLE -50
451#define NAL_RUNLEVEL_COMP_FAILED -84
452
453/* Define NAL Filter error codes*/
454#define FIL_IS_REPEATED -100
455#define FIL_INVALID_PARM -101
456#define FIL_INVALID_SOCK -102
457#define FIL_INVALID_DEST -103
458#define FIL_HAS_DELETED -104
459#define FIL_NEED_BIND -105
460#define FIL_RUN_OUT -106
461#define FIL_ADD_FAIL -107
462#define FIL_DEL_FAIL -108
463#define FIL_INVALID_PROT -109
464
465#define NAL_DEL_ALL -888
466
467/******************* TRANSFER ERROR CODES ***************************
468 The range for NAL transfer error codes is -201 to -250
469*/
470
471#define NAL_STRUCT_TRANS_ERROR -201 /* Fail to transfer the struct type*/
472
473/******************* SOCKET ERROR CODES ****************************
474
475 The range for Nucleus NET error codes is -251 to -500.
476
477*/
478
479#define NAL_INVALID_PROTOCOL -251 /* Invalid network protocol */
480#define NAL_NO_DATA_TRANSFER -252 /* Data was not written/read
481 during send/receive function */
482#define NAL_NO_PORT_NUMBER -253 /* No local port number was stored
483 in the socket descriptor */
484#define NAL_NO_TASK_MATCH -254 /* No task/port number combination
485 existed in the task table */
486#define NAL_NO_SOCKET_SPACE -255 /* The socket structure list was full
487 when a new socket descriptor was
488 requested */
489#define NAL_NO_ACTION -256 /* No action was processed by
490 the function */
491#define NAL_NOT_CONNECTED -257 /* A connection has been closed
492 by the network. */
493#define NAL_INVALID_SOCKET -258 /* The socket ID passed in was
494 not in a valid range. */
495#define NAL_NO_SOCK_MEMORY -259 /* Memory allocation failed for
496 internal sockets structure. */
497#define NAL_INVALID_ADDRESS -260 /* An incomplete address was sent */
498#define NAL_NO_HOST_NAME -261 /* No host name specified in a */
499#define NAL_RARP_INIT_FAILED -262 /* During initialization RARP failed. */
500#define NAL_BOOTP_INIT_FAILED -263 /* During initialization BOOTP failed. */
501#define NAL_INVALID_PORT -264 /* The port number passed in was
502 not in a valid range. */
503#define NAL_NO_BUFFERS -265 /* There were no buffers to place */
504 /* the outgoing packet in. */
505#define NAL_NOT_ESTAB -266 /* A connection is open but not in
506 an established state. */
507#define NAL_WINDOW_FULL -267 /* The foreign host's in window is
508 full. */
509#define NAL_NO_SOCKETS -268 /* No sockets were specified. */
510#define NAL_NO_DATA -269 /* None of the specified sockets were
511 data ready. NAL_Select. */
512
513
514
515/* The following errors are reported by the NAL_Setsockopt and NAL_Getsockopt
516 service calls. */
517#define NAL_INVALID_LEVEL -270 /* The specified level is invalid. */
518#define NAL_INVALID_OPTION -271 /* The specified option is invalid. */
519#define NAL_INVAL -272 /* General purpose error condition. */
520#define NAL_ACCESS -273 /* The attempted operation is not */
521 /* allowed on the socket */
522#define NAL_ADDRINUSE -274
523
524#define NAL_HOST_UNREACHABLE -275 /* Host unreachable */
525#define NAL_MSGSIZE -276 /* Packet is to large for interface. */
526#define NAL_NOBUFS -277 /* Could not allocate a memory buffer. */
527#define NAL_UNRESOLVED_ADDR -278 /* The MAC address was not resolved.*/
528#define NAL_CLOSING -279 /* The other side in a TCP connection*/
529 /* has sent a FIN */
530#define NAL_MEM_ALLOC -280 /* Failed to allocate memory. */
531#define NAL_RESET -281
532#define NAL_DEVICE_DOWN -282 /* A device being used by the socket has
533 gone down. Most likely because a PPP
534 link has been disconnected or a DHCP
535 IP address lease has expired. */
536/* These error codes are returned by DNS. */
537#define NAL_INVALID_LABEL -283 /* Indicates a domain name with an
538 invalid label. */
539#define NAL_FAILED_QUERY -284 /* No response received for a DNS
540 Query. */
541#define NAL_DNS_ERROR -285 /* A general DNS error status. */
542#define NAL_NOT_A_HOST -286 /* The host name was not found. */
543#define NAL_INVALID_PARM -287 /* A parameter has an invalid value. */
544
545#define NAL_NO_DNS_SERVER -288 /* No DNS server has been registered with
546 the stack. */
547
548/* Error codes for DHCP */
549#define NAL_DHCP_INIT_FAILED -289 /* During initialization DHCP failed. */
550#define NAL_DHCP_REQUEST_FAILED -290
551
552/* Error codes for BOOTP */
553#define NAL_BOOTP_SEND_FAILED -291
554#define NAL_BOOTP_RECV_FAILED -292
555#define NAL_BOOTP_ATTACH_IP_FAILED -293
556#define NAL_BOOTP_SELECT_FAILED -294
557#define NAL_BOOTP_FAILED -295
558
559#define NAL_NO_ROUTE_TO_HOST -296 /* ICMP Destination Unreachable specific error */
560#define NAL_CONNECTION_REFUSED -297 /* ICMP Destination Unreachable specific error */
561#define NAL_MSG_TOO_LONG -298 /* ICMP Destination Unreachable specific error */
562
563#define NAL_BAD_SOCKETD -299
564#define NAL_BAD_LEVEL -300
565#define NAL_BAD_OPTION -301
566
567/* IPv6 Errors */
568#define NAL_DUP_ADDR_FAILED -302
569#define NAL_DISCARD_PACKET -303
570
571/* ICMP Error Codes */
572#define NAL_DEST_UNREACH_ADMIN -304
573#define NAL_DEST_UNREACH_ADDRESS -305
574#define NAL_DEST_UNREACH_PORT -306
575#define NAL_TIME_EXCEED_HOPLIMIT -307
576#define NAL_TIME_EXCEED_REASM -308
577#define NAL_PARM_PROB_HEADER -309
578#define NAL_PARM_PROB_NEXT_HDR -310
579#define NAL_PARM_PROB_OPTION -311
580#define NAL_DEST_UNREACH_NET -312
581#define NAL_DEST_UNREACH_HOST -313
582#define NAL_DEST_UNREACH_PROT -314
583#define NAL_DEST_UNREACH_FRAG -315
584#define NAL_DEST_UNREACH_SRCFAIL -316
585#define NAL_PARM_PROB -317
586#define NAL_SOURCE_QUENCH -318
587
588/* This macro will determine whether an error code is an ICMP error message -
589 * if any ICMP error messages are added above, be sure to change this macro
590 * to reflect the additions/changes.
591 */
592#define NAL_ICMP_ERROR_CODE(a) ( (a <= NAL_DEST_UNREACH_ADMIN) && (a >= NAL_SOURCE_QUENCH) ) ? NAL_TRUE : NAL_FALSE
593
594/* Error Code for NON Blocking */
595#define NAL_WOULD_BLOCK -319
596
597/* Error Code for TCP Keep-Alive */
598#define NAL_CONNECTION_TIMED_OUT -320
599
600/* Return status for NON Blocking connect */
601#define NAL_IS_CONNECTING -321
602
603#define NAL_SOCKET_CLOSED -322 /* The specified socket has been closed */
604
605/* Error codes for event registration functions. */
606#define NAL_TABLE_FULL -323
607#define NAL_NOT_FOUND -324
608
609/* IPv6 error codes for processing incoming extension headers */
610#define NAL_INVAL_NEXT_HEADER -325
611#define NAL_SEND_ICMP_ERROR -326
612
613/* Error Codes for multicasting */
614#define NAL_MULTI_TOO_MANY_SRC_ADDRS -327
615#define NAL_NOT_A_GROUP_MEMBER -328
616#define NAL_TOO_MANY_GROUP_MEMBERS -329
617
618#define NAL_ETH_CABLE_UNPLUGGED -330
619#define NAL_ETH_CABLE_PLUGGED_IN -331
620#define NAL_DEVICE_NOT_DOWN -332
621#define NAL_INVALID_DEVICE -333
622#define NAL_FILTER_ERROR -334
623
624#define NAL_INFO_FIELD_RECV_TIME 0x01
625#define NAL_INFO_FIELD_DSCP 0x02
626#define NAL_INFO_FIELD_TS_CONFIDENCE 0x04
627#define NAL_INFO_FIELD_TTL 0x08
628#define NAL_INFO_FIELD_UDP_CHECKSUM 0x10
629
630struct nal_sck_sockaddr_ip_struct
631{
632 nal_uint8 sck_len;
633 nal_uint8 sck_family;
634 nal_uint16 sck_port;
635 nal_uint32 sck_addr;
636 nal_int8 sck_unused[8];
637};
638
639typedef struct _nal_fdset
640{
641 nal_uint32 words[NAL_FD_ELEMENTS];
642} nal_fdset;
643
644/* Structure for scatter/gather I/O. */
645typedef struct _nal_iovec
646{
647 void *iov_base; /* Pointer to data. */
648 nal_size_t iov_len; /* Length of data. */
649}nal_iovec;
650
651/* Structure describing messages sent by
652 `sendmsg' and received by `recvmsg'. */
653typedef struct _nal_msghdr
654{
655 void* msg_name; /* Address to send to/receive from. */
656 nal_socklen_t msg_namelen; /* Length of address data. */
657
658 nal_iovec *msg_iov; /* Vector of data to send/receive into. */
659 nal_size_t msg_iovlen; /* Number of elements in the vector. (size_t = unsigned long = kal_uint32)*/
660
661 void* msg_control; /* Ancillary data (eg BSD filedesc passing). */
662 nal_size_t msg_controllen; /* Ancillary data buffer length.
663 !! The type should be socklen_t but the
664 definition of the kernel is incompatible
665 with this. */
666
667 nal_int msg_flags; /* Flags on received message. */
668}nal_msghdr;
669
670/* 32-bit structure containing 4-digit ip number */
671typedef struct _nal_id_struct
672{
673 nal_uint8 is_ip_addrs[NAL_MAX_ADDR_SIZE]; /* IP address number */
674}nal_id_struct;
675
676typedef struct _nal_addr_struct
677{
678 nal_int16 family; /* family = INTERNET */
679 nal_uint16 port; /* machine's port number */
680 nal_id_struct id; /* contains the 4-digit ip number for the host machine */
681 nal_char *name; /* points to machine's name */
682}nal_addr_struct;
683
684typedef struct _nal_sockaddr_struct
685{
686 nal_id_struct ip_num; /* the address = the ip num */
687 nal_uint16 port_num; /* the process = the port num */
688 nal_int16 family;
689}nal_sockaddr_struct;
690
691typedef struct _nal_linger_struct
692{
693 kal_int32 linger_on;
694 kal_uint32 linger_ticks;
695}nal_linger_struct;
696
697typedef enum _nal_filter_type_t {
698 NAL_FIL_UDP = 0x0,
699 NAL_FIL_TCP,
700 NAL_FIL_ICMP = 0x10,
701 NAL_FIL_OTHER = 0x20
702}nal_filter_type_t;
703
704typedef struct _nal_filter_info_t {
705 kal_int32 socketd;
706 nal_addr_struct* dest;
707 kal_uint8 icmpv4_type;
708 kal_uint8 icmpv6_type;
709}nal_filter_info_t;
710
711typedef struct _nal_info_struct {
712 nal_uint32 fields; /* see NAL_INFO_FIELD_x */
713 nal_uint32 recv_time;
714 nal_uint16 ttl;
715 nal_uint8 dscp;
716 nal_uint8 ts_confidence;
717 nal_uint8 udp_checksum_invalid;
718} nal_info_struct;
719
720
721#ifdef __cplusplus
722}
723#endif /* _cplusplus */
724
725#endif /* NAL_PUBLIC_SOCKDEFS_H */