1 #ifndef _LIBRARIES_BSDSOCKET_H
2 #define _LIBRARIES_BSDSOCKET_H
9 * Copyright © 2006 by Pavel Fedin
11 * Taken from 'Roadshow' -- Amiga TCP/IP stack
12 * Copyright © 2001-2004 by Olaf Barthel.
13 * All Rights Reserved.
15 * Amiga specific TCP/IP 'C' header files;
16 * Freely Distributable
19 /****************************************************************************/
22 #include <exec/ports.h>
23 #endif /* EXEC_PORTS_H */
25 #ifndef UTILITY_TAGITEM_H
26 #include <utility/tagitem.h>
27 #endif /* UTILITY_TAGITEM_H */
33 #include <bsdsocket/socketbasetags.h>
35 /****************************************************************************/
37 #ifndef _SYS_SOCKET_H_
38 #include <sys/socket.h>
39 #endif /* _SYS_SOCKET_H_ */
41 #ifndef _NETINET_IN_H_
42 #include <netinet/in.h>
43 #endif /* _NETINET_IN_H_ */
47 #endif /* _NET_IF_H_ */
49 /****************************************************************************/
53 #endif /* __cplusplus */
55 /****************************************************************************/
61 #elif defined(__VBCC__)
65 /****************************************************************************/
68 * Additional parameters for SocketBaseTagList().
69 * Standard bsdsocket.library v4 tags are placed in amitcp/socketbasetags.h
72 /* Number of Berkeley packet filter channels available. */
73 #define SBTC_NUM_PACKET_FILTER_CHANNELS 40
75 /* Whether or not the routing API is supported. */
76 #define SBTC_HAVE_ROUTING_API 41
78 /* Enable/Disable UDP checksums? */
79 #define SBTC_UDP_CHECKSUM 42
81 /* Enable/Disable IP packet forwarding? */
82 #define SBTC_IP_FORWARDING 43
84 /* Get/set the default IP packet TTL value. */
85 #define SBTC_IP_DEFAULT_TTL 44
87 /* Respond to ICMP mask requests? */
88 #define SBTC_ICMP_MASK_REPLY 45
90 /* Enable/Disable sending of redirection messages? */
91 #define SBTC_ICMP_SEND_REDIRECTS 46
93 /* Whether or not the interface API is supported. */
94 #define SBTC_HAVE_INTERFACE_API 47
96 /* How ICMP echo messages should be processed. */
97 #define SBTC_ICMP_PROCESS_ECHO 48
99 /* How ICMP time stamp messages should be processed. */
100 #define SBTC_ICMP_PROCESS_TSTAMP 49
102 /* Whether or not the monitoring API is supported. */
103 #define SBTC_HAVE_MONITORING_API 50
105 /* Whether or not library bases can be shared by different
107 #define SBTC_CAN_SHARE_LIBRARY_BASES 51
109 /* Set the name of the log output file or get a pointer
110 to the current file name. */
111 #define SBTC_LOG_FILE_NAME 52
113 /* Whether or not the status API is supported. */
114 #define SBTC_HAVE_STATUS_API 53
116 /* Whether or not the DNS API is supported. */
117 #define SBTC_HAVE_DNS_API 54
119 /* Set or get a pointer to the currently installed log hook. */
120 #define SBTC_LOG_HOOK 55
122 /* Get the system status, with regard to whether the TCP/IP stack
123 has access to network interfaces and name resolution servers. */
124 #define SBTC_SYSTEM_STATUS 56
126 /* Get or set the signal mask used to send a notification when
127 the address of an interface has changed. */
128 #define SBTC_SIG_ADDRESS_CHANGE_MASK 57
130 /* If the IP filter API is supported, which version of that API
132 #define SBTC_IPF_API_VERSION 58
134 /* Whether or not the local database access API is supported. */
135 #define SBTC_HAVE_LOCAL_DATABASE_API 59
137 /* Whether or not the address conversion API is supported. */
138 #define SBTC_HAVE_ADDRESS_CONVERSION_API 60
140 /* Whether or not the kernel memory API is supported. */
141 #define SBTC_HAVE_KERNEL_MEMORY_API 61
143 /* Get or set the IP filter hook which is invoked whenever a
144 datagram has arrived or is about to be sent. */
145 #define SBTC_IP_FILTER_HOOK 62
147 /* Whether or not the server API is supported. */
148 #define SBTC_HAVE_SERVER_API 63
150 /* Query the number of bytes received so far. */
151 #define SBTC_GET_BYTES_RECEIVED 64
153 /* Query the number of bytes sent so far. */
154 #define SBTC_GET_BYTES_SENT 65
156 /****************************************************************************/
159 * Flags returned by a SocketBaseTagList() 'SBTC_SYSTEM_STATUS' query.
162 #define SBSYSSTAT_Interfaces (1L<<0) /* Interfaces are available,
165 #define SBSYSSTAT_PTP_Interfaces (1L<<1) /* Point-to-point interfaces
166 are available, configured
168 #define SBSYSSTAT_BCast_Interfaces (1L<<2) /* Broadcast interfaces are
169 available, configured and
171 #define SBSYSSTAT_Resolver (1L<<3) /* Domain name servers are
172 known and available */
173 #define SBSYSSTAT_Routes (1L<<4) /* Routing information is
175 #define SBSYSSTAT_DefaultRoute (1L<<5) /* A default route is
178 /****************************************************************************/
181 * Data structures for use with the log hook.
184 struct LogHookMessage
186 LONG lhm_Size
; /* Size of this data structure in bytes. */
187 LONG lhm_Priority
; /* Log entry priority (LOG_EMERG..LOG_DEBUG) */
189 lhm_Date
; /* Time and date when this log entry was
191 STRPTR lhm_Tag
; /* Name of the facility which added this entry;
193 ULONG lhm_ID
; /* ID of the facility which added this entry;
195 STRPTR lhm_Message
; /* NUL-terminated string which contains the
196 log message to be displayed. */
199 /****************************************************************************/
202 * Options for configuring how ICMP echo and time stamp
203 * requests should be processed.
205 #define IR_Process 0 /* Process the request and respond to it */
206 #define IR_Ignore 1 /* Ignore the request, but feed it into the
207 raw IP packet processing framework */
208 #define IR_Drop 2 /* Ignore the request and treat it as if
209 it had a checksum error */
211 /****************************************************************************/
214 * For use with ReleaseSocket() and ReleaseCopyOfSocket().
217 #define UNIQUE_ID (-1)
219 /****************************************************************************/
222 * Tags for use with the routing API.
225 #define RTA_BASE (TAG_USER+1600)
227 #define RTA_Destination (RTA_BASE+1) /* Route destination
229 #define RTA_Gateway (RTA_BASE+2) /* Gateway address */
230 #define RTA_DefaultGateway (RTA_BASE+3) /* Default gateway address */
231 #define RTA_DestinationHost (RTA_BASE+4) /* Route destination
232 address; destination is
233 assumed to be a host and
235 #define RTA_DestinationNet (RTA_BASE+5) /* Route destination
236 address; destination is
237 assumed to be a network
240 /****************************************************************************/
243 * Tags for use with the interface management API,
244 * specifically the AddInterfaceTagList() call.
246 #define IFA_BASE (TAG_USER+1700)
248 #define IFA_IPType (IFA_BASE+1) /* IP packet type */
249 #define IFA_ARPType (IFA_BASE+2) /* ARP packet type */
250 #define IFA_NumReadRequests (IFA_BASE+3) /* Number of read requests
252 #define IFA_NumWriteRequests (IFA_BASE+4) /* Number of write requests
254 #define IFA_NumARPRequests (IFA_BASE+5) /* Number of ARP requests
256 #define IFA_PacketFilterMode (IFA_BASE+6) /* Operating mode of the
257 Berkeley packet filter */
258 #define IFA_PointToPoint (IFA_BASE+7) /* Whether or not this
260 point-to-point type */
261 #define IFA_Reserved0 (IFA_BASE+8) /* This tag is reserved for
263 #define IFA_Multicast (IFA_BASE+9) /* Whether or not this
264 interface is allowed to
265 send multicast packets */
266 #define IFA_DownGoesOffline (IFA_BASE+10) /* Whether or not this
267 interface will go offline
268 when it is taken down */
269 #define IFA_ReportOffline (IFA_BASE+11) /* Whether or not this
270 interface will cause a
271 notification message to
272 be logged when it goes
274 #define IFA_RequiresInitDelay (IFA_BASE+12) /* Whether or not this
275 interface requires a short
277 device initialization */
278 #define IFA_CopyMode (IFA_BASE+13) /* Special data copy options
279 for this interface */
280 #define IFA_HardwareAddress (IFA_BASE+14) /* Set the interface hardware
283 #define IFA_SetDebugMode (IFA_BASE+15) /* Enable or disable debugging
284 mode for this interface. */
286 /****************************************************************************/
288 /* This is used with the 'IFA_HardwareAddress' tag above. */
289 struct InterfaceHardwareAddress
291 LONG iha_Length
; /* Number of bits in address */
292 UBYTE
* iha_Address
; /* Points to first address byte */
295 /****************************************************************************/
298 * Options available for use with the IFA_PacketFilterMode tag.
300 #define PFM_Nothing 0 /* Filter is disabled for this interface. */
301 #define PFM_Local 1 /* Filter is enabled; only packets intended
302 for this interface are filtered */
303 #define PFM_IPandARP 2 /* Filter is enabled; all IP and ARP packets
304 are filtered, even if they are not intended
305 for this interface */
306 #define PFM_Everything 3 /* Filter is enabled; all packets are filtered
307 that pass by, regardless of their type and
310 /****************************************************************************/
313 * Options available for use with the IFA_CopyMode tag.
315 #define CM_SlowWordCopy 0 /* Disables the S2_CopyFromBuff16 SANA-II
316 buffer management option (default). */
317 #define CM_FastWordCopy 1 /* Enables the S2_CopyFromBuff16 SANA-II
318 buffer management option. */
320 /****************************************************************************/
323 * Tags for use with the interface management API,
324 * specifically the ConfigureInterfaceTagList() call.
326 #define IFC_BASE (TAG_USER+1800)
328 #define IFC_Address (IFC_BASE+1) /* The address to assign to
329 the interface itself */
330 #define IFC_NetMask (IFC_BASE+2) /* The interface's address
332 #define IFC_DestinationAddress (IFC_BASE+3) /* The address of the other
333 end of a point-to-point
335 #define IFC_BroadcastAddress (IFC_BASE+4) /* The broadcast address to
336 be used by the interface */
337 #define IFC_Metric (IFC_BASE+5) /* The routing metric value */
339 #define IFC_AddAliasAddress (IFC_BASE+6) /* Add another alias address
340 for this interface */
341 #define IFC_DeleteAliasAddress (IFC_BASE+7) /* Remove an alias address
342 for this interface */
343 #define IFC_State (IFC_BASE+8) /* Mark an interface up, down,
345 #define IFC_GetPeerAddress (IFC_BASE+9) /* If available, obtain the
346 interface's local address
347 and the address of its
348 point to point partner */
349 #define IFC_GetDNS (IFC_BASE+10) /* If available, obtain the
350 domain name servers known
352 #define IFC_AssociatedRoute (IFC_BASE+12) /* That interface is associated
354 #define IFC_AssociatedDNS (IFC_BASE+13) /* That interface is associated
356 #define IFC_ReleaseAddress (IFC_BASE+14) /* Release the address allocated
357 for this interface (via the
359 #define IFC_SetDebugMode (IFC_BASE+15) /* Enable or disable debugging
360 mode for this interface. */
361 #define IFC_Complete (IFC_BASE+16) /* Indicate that the configuration
362 for this interface is complete */
364 /****************************************************************************/
367 * Tags for use with the interface management API,
368 * specifically the QueryInterfaceTagList() call.
370 #define IFQ_BASE (TAG_USER+1900)
372 #define IFQ_DeviceName (IFQ_BASE+1) /* Query the associated
373 SANA-II device name */
374 #define IFQ_DeviceUnit (IFQ_BASE+2) /* Query the associated
375 SANA-II unit number */
376 #define IFQ_HardwareAddressSize (IFQ_BASE+3) /* Query the hardware address
378 #define IFQ_HardwareAddress (IFQ_BASE+4) /* Query the hardware
380 #define IFQ_MTU (IFQ_BASE+5) /* Query the maximum
382 #define IFQ_BPS (IFQ_BASE+6) /* Query the transmission
384 #define IFQ_HardwareType (IFQ_BASE+7) /* Query the SANA-II hardware
386 #define IFQ_PacketsReceived (IFQ_BASE+8) /* Query the number of
387 packets received by this
389 #define IFQ_PacketsSent (IFQ_BASE+9) /* Query the number of
392 #define IFQ_BadData (IFQ_BASE+10) /* Query the number of bad
393 packets dropped by this
395 #define IFQ_Overruns (IFQ_BASE+11) /* Query the number of buffer
397 #define IFQ_UnknownTypes (IFQ_BASE+12) /* Query the number of unknown
398 packet types dropped by this
400 #define IFQ_LastStart (IFQ_BASE+13) /* Query the last time the
401 interface went online */
402 #define IFQ_Address (IFQ_BASE+14) /* Query the IP address
405 #define IFQ_DestinationAddress (IFQ_BASE+15) /* Query the interface's
406 destination address */
407 #define IFQ_BroadcastAddress (IFQ_BASE+16) /* Query the interface's
409 #define IFQ_NetMask (IFQ_BASE+17) /* Query the interface's
411 #define IFQ_Metric (IFQ_BASE+18) /* Query the interface's
413 #define IFQ_State (IFQ_BASE+19) /* Query the interface's
415 #define IFQ_AddressBindType (IFQ_BASE+20) /* Query whether the address
416 bound to this interface
417 is statically, manually
418 or dynamically bound. */
419 #define IFQ_AddressLeaseExpires (IFQ_BASE+21) /* Find out whether and when
420 the address bound to this
421 interface expires. */
422 #define IFQ_PrimaryDNSAddress (IFQ_BASE+22) /* Query the primary domain
423 name server address known
425 #define IFQ_SecondaryDNSAddress (IFQ_BASE+23) /* Query the secondary domain
426 name server address known
428 #define IFQ_NumReadRequests (IFQ_BASE+24) /* Number of read I/O requests
431 #define IFQ_MaxReadRequests (IFQ_BASE+25) /* Maximum number of read I/O
432 requests in use at a time
434 #define IFQ_NumWriteRequests (IFQ_BASE+26) /* Number of write I/O requests
437 #define IFQ_MaxWriteRequests (IFQ_BASE+27) /* Maximum number of write I/O
438 requests in use at a time
440 #define IFQ_GetBytesIn (IFQ_BASE+28) /* Query the number of bytes
442 #define IFQ_GetBytesOut (IFQ_BASE+29) /* Query the number of bytes
444 #define IFQ_GetDebugMode (IFQ_BASE+30) /* Check if this interface has
445 the debug mode enabled */
446 #define IFQ_GetSANA2CopyStats (IFQ_BASE+31) /* Obtain the SANA-II data
448 #define IFQ_NumReadRequestsPending (IFQ_BASE+32)
449 /* Number of read I/O requests
453 #define IFQ_NumWriteRequestsPending (IFQ_BASE+33)
454 /* Number of write I/O requests
459 /****************************************************************************/
461 /* This is used with the 'IFQ_GetSANA2CopyStats' tag above. */
462 struct SANA2CopyStats
464 ULONG s2cs_DMAIn
; /* How many times data was received via the
465 DMA transfer function */
466 ULONG s2cs_DMAOut
; /* How many times data was sent via the
467 DMA transfer function */
469 ULONG s2cs_ByteIn
; /* How many times data was received via the
470 byte wide copy function */
471 ULONG s2cs_ByteOut
; /* How many times data was sent via the
472 byte wide copy function */
474 ULONG s2cs_WordOut
; /* How many times data was sent via the
475 word wide copy function */
478 /****************************************************************************/
480 /* The different types of interface address binding. */
481 #define IFABT_Unknown 0 /* The interface address has not been bound
482 or is in transitional state; check later
483 for more information. */
484 #define IFABT_Static 1 /* The address was assigned manually, or
485 by an automated configuration process
486 and is not expected to change. */
487 #define IFABT_Dynamic 2 /* The address was assigned by an automated
488 configuration process and may change in the
491 /****************************************************************************/
494 * The 64 bit integer value used by the IFQ_GetBytesIn..IFQ_GetResetBytesOut
503 /****************************************************************************/
506 * Options available for use with the IFC_State and IFQ_State tags.
508 #define SM_Offline 0 /* Interface is offline and not ready to
509 receive and transmit data */
510 #define SM_Online 1 /* Interface is online and ready to receive
512 #define SM_Down 2 /* Interface is not ready to receive and
513 transmit data, but might still be
515 #define SM_Up 3 /* Interface is ready to receive and transmit
516 data, but not necessarily online. */
518 /****************************************************************************/
521 * Types of monitoring hooks that can be installed.
523 #define MHT_ICMP 0 /* ICMP message monitoring */
524 #define MHT_UDP 1 /* UDP datagram monitoring */
525 #define MHT_TCP_Connect 2 /* TCP connection monitoring */
526 #define MHT_Connect 3 /* connect() call monitoring */
527 #define MHT_Send 4 /* sendto() and sendmsg() monitoring */
528 #define MHT_Packet 5 /* Low level packet monitoring */
529 #define MHT_Bind 6 /* bind() call monitoring */
531 /****************************************************************************/
534 * Parameters passed to the different monitoring hooks.
537 /* This type of message parameter is passed to 'MHT_Connect'
538 * type monitoring hooks.
540 struct ConnectMonitorMsg
542 LONG cmm_Size
; /* Size of this data
544 STRPTR cmm_Caller
; /* The name of the calling
545 program, if it chose to be
547 LONG cmm_Socket
; /* The socket to connect to
550 cmm_Name
; /* The address to connect
552 LONG cmm_NameLen
; /* The size of the address */
555 /* This type of message parameter is passed to 'MHT_Bind'
556 * type monitoring hooks.
558 struct BindMonitorMsg
560 LONG bmm_Size
; /* Size of this data
562 STRPTR bmm_Caller
; /* The name of the calling
563 program, if it chose to be
565 LONG bmm_Socket
; /* The socket to bind to the
568 bmm_Name
; /* The address to bind */
569 LONG bmm_NameLen
; /* The size of the address */
572 /* This type of message is passed to 'MHT_Send' type monitoring hooks. */
573 struct SendMonitorMessage
575 LONG smm_Size
; /* Size of this data structure */
576 STRPTR smm_Caller
; /* The name of the calling
577 program, if it chose to be
579 LONG smm_Socket
; /* The socket to connect to the
581 APTR smm_Buffer
; /* Data to be sent */
582 LONG smm_Len
; /* Amount of data to be sent */
583 LONG smm_Flags
; /* Control flags, including
584 MSG_OOB or MSG_DONTROUTE */
586 smm_To
; /* The address to send the
587 data to; this may be NULL */
588 LONG smm_ToLen
; /* The size of the address to send
589 this data to; this may be
591 struct msghdr
* smm_Msg
; /* The message to send; this may
595 /* This type of message is passed to 'MHT_TCP_Connect' type
598 struct TCPConnectMonitorMessage
600 LONG tcmm_Size
; /* Size of this data structure */
602 tcmm_Src
; /* Source internet address */
604 tcmm_Dst
; /* Destination internet address */
605 struct tcphdr
* tcmm_TCP
; /* TCP header */
608 /* This type of message is passed to 'MHT_UDP' type monitoring hooks. */
609 struct UDPMonitorMessage
611 LONG umm_Size
; /* Size of this data structure */
613 umm_Src
; /* Source internet address */
615 umm_Dst
; /* Destination internet address */
616 struct udphdr
* umm_UDP
; /* UDP header */
619 /* This type of message is passed to 'MHT_ICMP' type monitoring hooks. */
620 struct ICMPMonitorMessage
622 LONG imm_Size
; /* Size of this data structure */
624 imm_Src
; /* Source internet address */
626 imm_Dst
; /* Destination internet address */
627 struct icmp
* imm_ICMP
; /* ICMP header */
630 /* This type of message is passed to 'MHT_Packet' type monitoring hooks. */
631 struct PacketMonitorMessage
633 LONG pmm_Size
; /* Size of this data structure */
634 LONG pmm_Direction
; /* Whether the packet was received
635 or is about to be sent */
636 APTR pmm_LinkLayerData
;
637 /* Points to the link layer part
638 of the packet, typically an
639 Ethernet header per RFC 894.
641 LONG pmm_LinkLayerSize
;
642 /* Size of the link layer data part
643 of the packet; this may be 0. */
644 APTR pmm_PacketData
; /* Points to the packet 'payload'. */
645 LONG pmm_PacketSize
; /* Size of the packet 'payload'. */
648 /* Possible values for 'pmm_Direction'. */
649 #define PMMD_Receive 0 /* Packet was received and is waiting to be
651 #define PMMD_Send 1 /* Packet is about to be sent */
653 /****************************************************************************/
656 * Possible actions to be taken after a monitoring hook has
657 * examined the data it was passed. Any positive return value
658 * will cause the data to be dropped and the corresponding
659 * errno value to be set to the result.
661 #define MA_Continue 0 /* Proceed as if no filtering had
663 #define MA_Ignore -1 /* Ignore the data and skip the
664 normal route processing would
666 #define MA_Drop -2 /* Drop the data */
667 #define MA_DropWithReset -3 /* Drop the data and also reset the
670 /****************************************************************************/
673 * Parameters for use with the GetNetworkStatus() function.
676 /* What version of the statistics data should be returned; so far
677 there is only version #1. */
678 #define NETWORKSTATUS_VERSION 1
680 /* What statistics should be provided */
682 #define NETSTATUS_icmp 0 /* Internet control message
683 protocol statistics */
684 #define NETSTATUS_igmp 1 /* Internet group management
685 protocol statistics */
686 #define NETSTATUS_ip 2 /* Internet protocol statistics */
687 #define NETSTATUS_mb 3 /* Memory buffer statistics */
688 #define NETSTATUS_mrt 4 /* Multicast routing statistics */
689 #define NETSTATUS_rt 5 /* Routing statistics */
690 #define NETSTATUS_tcp 6 /* Transmission control protocol
692 #define NETSTATUS_udp 7 /* User datagram protocol
694 #define NETSTATUS_tcp_sockets 9 /* TCP socket statistics */
695 #define NETSTATUS_udp_sockets 10 /* UDP socket statistics */
697 /* Protocol connection data returned for each TCP/UDP socket. */
698 struct protocol_connection_data
701 pcd_foreign_address
; /* Foreign host address */
702 UWORD pcd_foreign_port
; /* Foreign port number */
704 pcd_local_address
; /* Local host address */
705 UWORD pcd_local_port
; /* Local port number */
706 ULONG pcd_receive_queue_size
; /* Socket receive queue size */
707 ULONG pcd_send_queue_size
; /* Socket send queue size */
708 LONG pcd_tcp_state
; /* Socket TCP state */
711 /****************************************************************************/
714 * Interface address allocation (BOOTP and DHCP).
717 /* The message to send to the interface configuration process
718 to start looking for an IP address. */
719 struct AddressAllocationMessage
724 LONG aam_Result
; /* What kind of result this
726 LONG aam_Version
; /* Version number associated with
727 this data structure. */
728 LONG aam_Protocol
; /* What kind of configuration
729 protocol should be used. */
730 char aam_InterfaceName
[16]; /* Name of interface an
733 LONG aam_Timeout
; /* Number of seconds to
736 ULONG aam_LeaseTime
; /* Requested lease time in
737 seconds; 0 to accept the
739 ULONG aam_RequestedAddress
; /* Interface address that should
740 be assigned, if possible; 0
741 to accept the server's choice. */
742 STRPTR aam_ClientIdentifier
; /* Unique identifier for this
744 ULONG aam_Address
; /* Interface address
747 ULONG aam_ServerAddress
; /* Address of BOOTP server. */
748 ULONG aam_SubnetMask
; /* Interface subnet
749 mask; ignore if zero. */
751 STRPTR aam_NAKMessage
; /* In case of failure,
754 LONG aam_NAKMessageSize
; /* Maximum length of the
755 negative ack message. */
757 ULONG
* aam_RouterTable
; /* A list of router addresses
759 LONG aam_RouterTableSize
; /* Maximum number of valid
762 ULONG
* aam_DNSTable
; /* A list of domain name servers
764 LONG aam_DNSTableSize
; /* Maximum number of valid
768 ULONG
* aam_StaticRouteTable
; /* A list of static routes
770 LONG aam_StaticRouteTableSize
;
771 /* Maximum number of valid
774 STRPTR aam_HostName
; /* If available, the name
775 assigned to this host will
777 LONG aam_HostNameSize
; /* Maximum size of the host
780 STRPTR aam_DomainName
; /* If available, the name
781 of the domain assigned to
782 this host will be put here. */
783 LONG aam_DomainNameSize
; /* Maximum size of the domain
785 UBYTE
* aam_BOOTPMessage
; /* Points to buffer to place
786 the BOOTP message in. */
787 LONG aam_BOOTPMessageSize
; /* Size of the buffer to place
788 the BOOTP message in. */
790 aam_LeaseExpires
; /* Points to buffer to place the
791 lease expire date and time in.
792 in. This will be 0 if no data
793 is provided or if the lease
797 /* This data structure version. */
798 #define AAM_VERSION 1
800 /* Available result codes. */
801 #define AAMR_Success 0 /* Allocation has succeeded */
802 #define AAMR_Aborted 1 /* The allocation was aborted */
803 #define AAMR_InterfaceNotKnown 2 /* The interface name is not
805 #define AAMR_InterfaceWrongType 3 /* The interface must support
807 #define AAMR_AddressKnown 4 /* The interface address is already
809 #define AAMR_VersionUnknown 5 /* The data structure version is
811 #define AAMR_NoMemory 6 /* Not enough memory to process
813 #define AAMR_Timeout 7 /* The allocation request did not
814 succeed in the requested time
816 #define AAMR_AddressInUse 8 /* The address to be allocated is
818 #define AAMR_AddrChangeFailed 9 /* The interface address could
820 #define AAMR_MaskChangeFailed 10 /* The interface subnet mask could
822 #define AAMR_Ignored -1 /* The message type was not
825 /* The minimum timeout value supported for an allocation to succeed. */
826 #define AAM_TIMEOUT_MIN 10
828 /* The special DHCP lease times. */
829 #define DHCP_DEFAULT_LEASE_TIME 0
830 #define DHCP_INFINITE_LEASE_TIME 0xFFFFFFFF
832 /* The configuration protocols to use. */
833 #define AAMP_BOOTP 0 /* Bootstrap Protocol (RFC 951) */
834 #define AAMP_DHCP 1 /* Dynamic Host Configuration Protocol
836 #define AAMP_SLOWAUTO 2 /* Automatic address allocation; slower
837 version for Ethernet networks with
838 switches which use the IEEE Spanning
839 Tree Protocol (802.1d) */
840 #define AAMP_FASTAUTO 3 /* Automatic address allocation; faster
841 version for wireless devices */
843 /* Tags for use with CreateAddressAllocationMessage(). */
844 #define CAAMTA_BASE (TAG_USER+2000)
846 /* This corresponds to the 'aam_Timeout' member of the
847 * AddressAllocationMessage.
849 #define CAAMTA_Timeout (CAAMTA_BASE+1)
851 /* This corresponds to the 'aam_LeaseTime' member of the
852 * AddressAllocationMessage.
854 #define CAAMTA_LeaseTime (CAAMTA_BASE+2)
856 /* This corresponds to the 'aam_RequestedAddress' member of the
857 * AddressAllocationMessage.
859 #define CAAMTA_RequestedAddress (CAAMTA_BASE+3)
861 /* Pointer to the client identifier string to be used; this
862 * string must be at least 2 characters long. The string will
863 * be duplicated and stored in the 'aam_ClientIdentifier' member
864 * of the AddressAllocationMessage.
866 #define CAAMTA_ClientIdentifier (CAAMTA_BASE+4)
868 /* Size of the buffer to allocate for the NAK message, as
869 * stored in the 'aam_NAKMessage' member of the AddressAllocationMessage.
871 #define CAAMTA_NAKMessageSize (CAAMTA_BASE+5)
873 /* Size of the buffer to allocate for the router address table, as
874 * stored in the 'aam_RouterTable' member of the
875 * AddressAllocationMessage.
877 #define CAAMTA_RouterTableSize (CAAMTA_BASE+6)
879 /* Size of the buffer to allocate for the DNS address table, as
880 * stored in the 'aam_DNSTable' member of the AddressAllocationMessage.
882 #define CAAMTA_DNSTableSize (CAAMTA_BASE+7)
884 /* Size of the buffer to allocate for the static route address table, as
885 * stored in the 'aam_StaticRouteTable' member of the
886 * AddressAllocationMessage.
888 #define CAAMTA_StaticRouteTableSize (CAAMTA_BASE+8)
890 /* Size of the buffer to allocate for the host name, as stored in
891 * the 'aam_HostName' member of the AddressAllocationMessage.
893 #define CAAMTA_HostNameSize (CAAMTA_BASE+9)
895 /* Size of the buffer to allocate for the domain name, as stored in
896 * the 'aam_DomainName' member of the AddressAllocationMessage.
898 #define CAAMTA_DomainNameSize (CAAMTA_BASE+10)
900 /* Size of the buffer to allocate for the BOOTP message, as stored in
901 * the 'aam_BOOTPMessage' member of the AddressAllocationMessage.
903 #define CAAMTA_BOOTPMessageSize (CAAMTA_BASE+11)
905 /* Either FALSE or TRUE; if TRUE, will allocate a buffer for a
906 * DateStamp and put its address into the 'aam_LeaseExpires'
907 * member of the AddressAllocationMessage.
909 #define CAAMTA_RecordLeaseExpiration (CAAMTA_BASE+12)
911 /* The MsgPort to send the AddressAllocationMessage to after
912 * the configuration has finished.
914 #define CAAMTA_ReplyPort (CAAMTA_BASE+13)
916 /* Codes returned by CreateAddressAllocationMessage(). */
917 #define CAAME_Success 0 /* It worked */
918 #define CAAME_Invalid_result_ptr 1 /* No proper result pointer
920 #define CAAME_Not_enough_memory 2 /* No enough memory available */
921 #define CAAME_Invalid_version 3 /* The version number is not
923 #define CAAME_Invalid_protocol 4 /* The protocol is neither BOOTP
925 #define CAAME_Invalid_interface_name 5 /* The interface name is
927 #define CAAME_Interface_not_found 6 /* The name of the interface
929 #define CAAME_Invalid_client_identifier 7 /* The client identifier is not
931 #define CAAME_Client_identifier_too_short 8 /* The client identifier is too
933 #define CAAME_Client_identifier_too_long 9 /* The client identifier is too
936 /****************************************************************************/
939 * The DNS management data structures.
942 /* These nodes are returned by the DNS API. */
943 struct DomainNameServerNode
947 LONG dnsn_Size
; /* Size of this data structure */
948 STRPTR dnsn_Address
; /* Points to NUL-terminated string
949 which holds the IP address in
950 dotted-decimal notation */
951 LONG dnsn_UseCount
; /* Usage count of this address;
952 negative values indicate
953 statically-configured servers. */
956 /****************************************************************************/
959 * Filtering for incoming and outgoing IP packets.
962 /* This identifies whether a packet was received or is about
963 * to be sent. Check the IPFilterMsg->ifm_Direction field to
966 #define IFMD_Incoming 0 /* Packet was received */
967 #define IFMD_Outgoing 1 /* Packet is about to be sent */
969 /* The full definition of 'struct mbuf' is in <sys/mbuf.h> */
972 /* The packet filter hook is invoked with a message of
977 LONG ifm_Size
; /* Size of this data structure */
978 struct ip
* ifm_IP
; /* Points to IP packet header */
979 LONG ifm_IPLength
; /* Size of the IP packet header */
980 struct ifnet
* ifm_Interface
; /* Interface this packet either
981 came in from or is to be
983 LONG ifm_Direction
; /* Whether this packet came in
984 or is about to go out */
985 struct mbuf
* ifm_Packet
; /* The entire packet, as stored
986 in a memory buffer */
989 /****************************************************************************/
995 /* To shut down the network, send a message of the following form to the
996 * network controller message port.
998 struct NetShutdownMessage
1000 struct Message nsm_Message
; /* Standard Message header */
1002 ULONG nsm_Command
; /* The action to be performed */
1004 APTR nsm_Data
; /* Payload */
1005 ULONG nsm_Length
; /* Payload size */
1007 LONG nsm_Error
; /* Whether or not the command
1009 ULONG nsm_Actual
; /* How much data was transferred */
1012 /* The command to be sent to the network controller message port must
1013 * be one of the following:
1016 #define NSMC_Shutdown 1 /* Shut down the network; a pointer to an
1017 ULONG may be placed in nsm_Data (if the
1018 shutdown does not succeed, this is where
1019 the number of active clients will be
1022 #define NSMC_Cancel 2 /* Cancel a shutdown request; this recalls
1023 a shutdown message, to which a pointer must
1024 be placed in nsm_Data. */
1026 /* Error codes that may be set when a message returns: */
1028 #define NSME_Success 0 /* Command was processed successfully */
1030 #define NSME_Aborted 1 /* Command was aborted */
1032 #define NSME_InUse 2 /* Network is still running, since clients are
1035 #define NSME_Ignored 3 /* Command was ignored (network may be shutting
1038 #define NSME_NotFound 4 /* Shutdown command to be cancelled could not
1041 /* The name of the public network controller message port: */
1042 #define NETWORK_CONTROLLER_PORT_NAME "TCP/IP Control"
1044 /* The network controller message port data structure; check the magic
1045 * cookie before you post a message to it!
1047 struct NetControlPort
1049 struct MsgPort ncp_Port
;
1053 /* The magic cookie stored in ncp_Magic: */
1054 #define NCPM_Cookie 0x20040306
1056 /****************************************************************************/
1062 #elif defined(__VBCC__)
1063 #pragma default-align
1066 /****************************************************************************/
1070 #endif /* __cplusplus */
1072 /****************************************************************************/
1074 #endif /* _LIBRARIES_BSDSOCKET_H */