commit 231b4f93bf0e64c4587d0791f89587a62938881c Author: Carsten Larsen Date: Fri May 5 20:36:04 2017 +0200 Initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..4078578 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +# What is "Roadshow"? + +Roadshow is an Amiga TCP/IP stack allows you to connect to the Internet, access your e-mail, web pages, +chat, etc. It can also help you access and exchange files within your local home network. Roadshow is one +of the fastest, if not the fastest Amiga TCP/IP stack. In sustained data transmission tests, Roadshow was able +to receive 997 KBytes/s (tested on an Amiga 3000T, using 40 MHz 68040 WarpEngine CPU card and an Ariadne Ethernet card). Roadshow is compatible with the vast majority of Amiga networking programs which use the AmiTCP program interface, such as OWB, IBrowse, AWeb-II, YAM, SabreMSN, ATC and others. + +Roadshow comes with comprehensive documentation, in the form of AmigaGuide files and a printable PDF reference document (more than 100 pages). The reference document covers everything from installation, to configuration files, the shell commands which make up Roadshow, to the individual command and configuration file parameters. Roadshow includes not only the TCP/IP stack software, but also a firewall. A full set of shell commands to control both is included, as well diagnostic and file transfer commands. Drivers for PPP networking are included as well, which allow you to connect your Amiga via ADSL modems and serial lines (modem, ISDN, etc.). + +# Requirements + +Amiga operating system versions 2.04 or higher are required. This includes AmigaOS 3.0, 3.1, 3.5 and 3.9. Operating systems which are highly compatible with these original Amiga operating system versions, such as MorphOS, are also expected to work with Roadshow. Roadshow supports the SANA-II driver software standard, and standard compliant drivers for accessing the network are a requirement. An Amiga computer with at least 2 MBytes of memory installed is the bare minimum on which Roadshow can run. The most basic hardware configuration with which the software was successfully tested was an Amiga 600HD running Amiga operating system version 3.1, equipped with 2 MBytes of memory, using a PCMCIA network adaptor. Roadshow benefits from faster computers and more memory. + +Networking hardware such as an Ethernet adaptor is recommended. Ethernet adaptors include devices such as: + +* Commodore A2065 +* Village Tronic Ariadne I +* Village Tronic Ariadne II +* Any PCMCIA network adaptor for which a working driver exists, e.g. "cnet.device" with PCMCIA NE2000 hardware + +Software-only drivers such as "slip.device", "plip.device" or the "ppp-serial.device" driver included with Roadshow are supported, too. Note that you still need a serial or parallel port to use these drivers. + +# Limitations + +Documentation is currently available only in English. There is no graphical configuration/management utility included with Roadshow. This means that you need to use a text editor to change and create configuration files. Also, the software which allows you to connect to the Internet through a serial line or ADSL modem can only be run from the command line shell. Because there is no graphical user interface to speak of, Roadshow is expected to be most useful for knowledgable, experienced Amiga users rather than for beginners. + +# Demo version + +A free demonstration version of Roadshow is available, which save for restricted versions of the TCP/IP stack and PPP driver software, is identical to the regular version which you can buy. The demonstration version restricts network access to 15 minutes at a time, after which Roadshow will shut down. The regular version has no such time limit. The regular version ships with a specially optimized TCP/IP stack and PPP drivers for Amiga computers eqipped with 68020/68030/68040/68060 CPUs. + +# Software development kit (SDK) + +The free software development kit includes comprehensive API documentation, plus source code for the Roadshow management, monitoring and file transfer commands. Also included is developer documentation for the SANA-II networking driver standard. The 'C' language header files required for writing new Amiga software to use the Roadshow APIs are included as well. + +## A brief list of some of Roadshow's features + +* Compatible with the AmiTCP 4.0 API +* Amiga-ized configuration utilities rather than the terse and somewhat cryptic Unix legacy tools +* DHCP configuration for Ethernet devices +* Support for ZeroConf automatic network interface IPv4 address assignment, in case no DHCP server is available +* IP packet filter/network address translation (firewall) +* Built-in DNS cache, which reduces the number of server lookups +* Built-in support for international domain names using the ISO Latin 1 character encoding. Roadshow will transparently translate between domain names using the ISO Latin 1 character set encoding (umlauts, accented characters, etc.) and their internal PunyCode form. +* Support for local Amiga Internet server programs ("inetd" style "Internet superserver") +* Berkeley Packet Filter support ("tcpdump" command included) +* Multicast support +* "TCP:" device support, for use with e.g. ARexx scripts +* Integration into the AmigaOS installation; configuration files go into "DEVS:" subdirectories, no special "Roadshow:" assignment necessary +* Installation script can backup/restore network settings, and also uninstall Roadshow again +* "Simple" configuration: one single shell command can bring up the entire network; no unnecessarily complex configuration utilities +* Networking driver configuration concept similar to "mount files", with drivers getting configured in the "User-Startup" script file +* Changes to global configuration files are tracked by file system notification; updates are made right after a change is detected +* Complete SANA-IIR3 support, including DMA access feature +* Enhanced API to allow developers to take greater control of the TCP/IP stack, including features for monitoring and packet filtering +* Enhanced & cleaned-up software development kit, which includes the complete source code of all the configuration tools and sample programs +* Complete localization of all tools and error messages +* Roadshow also includes network device drivers and tools for use with dial-up (PPP) and ADSL (PPPoE) networking. + +# Availability + +Roadshow is available both for download and direct at APC&TCP. diff --git a/doc/bsdsocket.doc b/doc/bsdsocket.doc new file mode 100644 index 0000000..886fa29 --- /dev/null +++ b/doc/bsdsocket.doc @@ -0,0 +1,10437 @@ +TABLE OF CONTENTS + +bsdsocket.library/-icmp- +bsdsocket.library/-inet- +bsdsocket.library/-ip- +bsdsocket.library/-networking- +bsdsocket.library/-route- +bsdsocket.library/-tcp- +bsdsocket.library/-udp- +bsdsocket.library/AbortInterfaceConfig +bsdsocket.library/accept +bsdsocket.library/AddDomainNameServer +bsdsocket.library/AddInterfaceTagList +bsdsocket.library/AddNetMonitorHookTagList +bsdsocket.library/AddRouteTagList +bsdsocket.library/BeginInterfaceConfig +bsdsocket.library/bind +bsdsocket.library/bpf_close +bsdsocket.library/bpf_data_waiting +bsdsocket.library/bpf_ioctl +bsdsocket.library/bpf_open +bsdsocket.library/bpf_read +bsdsocket.library/bpf_set_interrupt_mask +bsdsocket.library/bpf_set_notify_mask +bsdsocket.library/bpf_write +bsdsocket.library/ChangeRoadshowData +bsdsocket.library/CloseSocket +bsdsocket.library/ConfigureInterfaceTagList +bsdsocket.library/connect +bsdsocket.library/CreateAddrAllocMessageA +bsdsocket.library/DeleteAddrAllocMessage +bsdsocket.library/DeleteRouteTagList +bsdsocket.library/Dup2Socket +bsdsocket.library/endnetent +bsdsocket.library/endprotoent +bsdsocket.library/endservent +bsdsocket.library/Errno +bsdsocket.library/freeaddrinfo +bsdsocket.library/FreeRouteInfo +bsdsocket.library/gai_strerror +bsdsocket.library/getaddrinfo +bsdsocket.library/GetDefaultDomainName +bsdsocket.library/getdtablesize +bsdsocket.library/gethostbyaddr +bsdsocket.library/gethostbyname +bsdsocket.library/gethostbyname_r +bsdsocket.library/gethostid +bsdsocket.library/gethostname +bsdsocket.library/getnameinfo +bsdsocket.library/getnetbyaddr +bsdsocket.library/getnetbyname +bsdsocket.library/getnetent +bsdsocket.library/GetNetworkStatistics +bsdsocket.library/getpeername +bsdsocket.library/getprotobyname +bsdsocket.library/getprotobynumber +bsdsocket.library/getprotoent +bsdsocket.library/GetRouteInfo +bsdsocket.library/getservbyname +bsdsocket.library/getservbyport +bsdsocket.library/getservent +bsdsocket.library/GetSocketEvents +bsdsocket.library/getsockname +bsdsocket.library/getsockopt +bsdsocket.library/In_CanForward +bsdsocket.library/In_LocalAddr +bsdsocket.library/inet_addr +bsdsocket.library/inet_aton +bsdsocket.library/Inet_LnaOf +bsdsocket.library/Inet_MakeAddr +bsdsocket.library/Inet_NetOf +bsdsocket.library/inet_network +bsdsocket.library/Inet_NtoA +bsdsocket.library/inet_ntop +bsdsocket.library/inet_pton +bsdsocket.library/IoctlSocket +bsdsocket.library/listen +bsdsocket.library/mbuf_adj +bsdsocket.library/mbuf_cat +bsdsocket.library/mbuf_copyback +bsdsocket.library/mbuf_copydata +bsdsocket.library/mbuf_copym +bsdsocket.library/mbuf_free +bsdsocket.library/mbuf_freem +bsdsocket.library/mbuf_get +bsdsocket.library/mbuf_gethdr +bsdsocket.library/mbuf_prepend +bsdsocket.library/mbuf_pullup +bsdsocket.library/ObtainDomainNameServerList +bsdsocket.library/ObtainInterfaceList +bsdsocket.library/ObtainRoadshowData +bsdsocket.library/ObtainServerSocket +bsdsocket.library/ObtainSocket +bsdsocket.library/OpenLibrary +bsdsocket.library/ProcessIsServer +bsdsocket.library/QueryInterfaceTagList +bsdsocket.library/recv +bsdsocket.library/recvfrom +bsdsocket.library/recvmsg +bsdsocket.library/ReleaseCopyOfSocket +bsdsocket.library/ReleaseDomainNameServerList +bsdsocket.library/ReleaseInterfaceList +bsdsocket.library/ReleaseRoadshowData +bsdsocket.library/ReleaseSocket +bsdsocket.library/RemoveDomainNameServer +bsdsocket.library/RemoveInterface +bsdsocket.library/RemoveNetMonitorHook +bsdsocket.library/send +bsdsocket.library/sendmsg +bsdsocket.library/sendto +bsdsocket.library/SetDefaultDomainName +bsdsocket.library/SetErrnoPtr +bsdsocket.library/setnetent +bsdsocket.library/setprotoent +bsdsocket.library/setservent +bsdsocket.library/SetSocketSignals +bsdsocket.library/setsockopt +bsdsocket.library/shutdown +bsdsocket.library/socket +bsdsocket.library/SocketBaseTagList +bsdsocket.library/vsyslog +bsdsocket.library/gethostbyname_r +bsdsocket.library/WaitSelect + bsdsocket.library/-icmp- bsdsocket.library/-icmp- + + NAME + icmp - Internet Control Message Protocol + + SYNOPSIS + #include + #include + + FUNCTION + ICMP is the error and control message protocol used by IP and the + Internet protocol family. It may be accessed through a ``raw socket'' + for network monitoring and diagnostic functions. The proto parameter + to the socket call to create an ICMP socket is obtained from + getprotobyname(). ICMP sockets are connectionless, and are normally + used with the sendto and recvfrom calls, though the connect() call + may also be used to fix the destination for future packets (in which + case the recv() and send() system calls may be used). + + Outgoing packets automatically have an IP header prepended to them + (based on the destination address). Incoming packets are received + with the IP header and options intact. + + ERRORS + A socket operation may fail with one of the following errors + returned: + + [EISCONN] + When trying to establish a connection on a socket which already + has one, or when trying to send a datagram with the destination + address specified and the socket is already connected. + + [ENOTCONN] + When trying to send a datagram, but no destination address is + specified, and the socket hasn't been connected. + + [ENOBUFS] + When the system runs out of memory for an internal data + structure. + + [EADDRNOTAVAIL] + When an attempt is made to create a socket with a network address + for which no network interface exists. + + SEE ALSO + send(), recv(), inet, ip + + bsdsocket.library/-inet- bsdsocket.library/-inet- + + NAME + inet - Internet protocol family + + SYNOPSIS + #include + #include + + FUNCTION + The Internet protocol family is a collection of protocols layered + atop the Internet Protocol (IP) transport layer, and utilizing the + Internet address format. The Internet family provides protocol + support for the SOCK_STREAM, SOCK_DGRAM, and SOCK_RAW socket types; + the SOCK_RAW interface provides access to the IP protocol. + + ADDRESSING + Internet addresses are four byte quantities, stored in network + standard format. The include file defines this address + as a discriminated union. + + Sockets bound to the Internet protocol family utilize the following + addressing structure, + + struct sockaddr_in { + short sin_family; + u_short sin_port; + struct in_addr sin_addr; + char sin_zero[8]; + }; + + Sockets may be created with the local address INADDR_ANY to effect + ``wildcard'' matching on incoming messages. The address in a + connect() or sendto() call may be given as INADDR_ANY to mean ``this + host''. The distinguished address INADDR_BROADCAST is allowed as a + shorthand for the broadcast address on the primary network if the + first network configured supports broadcast. + + PROTOCOLS + The Internet protocol family is comprised of the IP transport + protocol, Internet Control Message Protocol (ICMP), Transmission + Control Protocol (TCP), and User Datagram Protocol (UDP). TCP is used + to support the SOCK_STREAM abstraction while UDP is used to support + the SOCK_DGRAM abstraction. A raw interface to IP is available by + creating an Internet socket of type SOCK_RAW. The ICMP message + protocol is accessible from a raw socket. + + The 32-bit Internet address contains both network and host parts. It + is frequency-encoded; the most-significant bit is clear in Class A + addresses, in which the high-order 8 bits are the network number. + Class B addresses use the high-order 16 bits as the network field, + and Class C addresses have a 24-bit network part. Sites with a + cluster of local networks and a connection to the Internet may chose + to use a single network number for the cluster; this is done by using + subnet addressing. The local (host) portion of the address is further + subdivided into subnet and host parts. Within a subnet, each subnet + appears to be an individual network; externally, the entire cluster + appears to be a single, uniform network requiring only a single + routing entry. Subnet addressing is enabled and examined by the + following IoctlSocket() commands on a datagram socket in the Internet + domain; they have the same form as the SIOCIFADDR command. + + SIOCSIFNETMASK + Set interface network mask. The network mask defines the network + part of the address; if it contains more of the address than the + address type would indicate, then subnets are in use. + + SIOCGIFNETMASK + Get interface network mask. + + bsdsocket.library/-ip- bsdsocket.library/-ip- + + NAME + ip - Internet Protocol + + SYNOPSIS + #include + #include + + int socket(AF_INET, SOCK_RAW, proto); + + FUNCTION + IP is the transport layer protocol used by the Internet protocol + family. Options may be set at the IP level when using higher-level + protocols that are based on IP (such as TCP and UDP). It may also be + accessed through a ``raw socket'' when developing new protocols, or + special-purpose applications. + + There are several IP-level setsockopt()/getsockopt() options. + IP_OPTIONS may be used to provide IP options to be transmitted in the + IP header of each outgoing packet or to examine the header options on + incoming packets. IP options may be used with any socket type in the + Internet family. The format of IP options to be sent is that + specified by the IP protocol specification (RFC-791), with one + exception: the list of addresses for Source Route options must + include the first-hop gateway at the beginning of the list of + gateways. The first-hop gateway address will be extracted from the + option list and the size adjusted accordingly before use. To disable + previously specified options, use a zero-length buffer: + + setsockopt(s, IPPROTO_IP, IP_OPTIONS, NULL, 0); + + IP_TOS and IP_TTL may be used to set the type-of-service and + time-to-live fields in the IP header for SOCK_STREAM and SOCK_DGRAM + sockets. For example, + + int tos = IPTOS_LOWDELAY; /* see */ + setsockopt(s, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); + + int ttl = 60; /* max = 255 */ + setsockopt(s, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl)); + + If the IP_RECVDSTADDR option is enabled on a SOCK_DGRAM socket, the + recvmsg call will return the destination IP address for a UDP + datagram. The msg_control field in the msghdr structure points to a + buffer that contains a cmsghdr structure followed by the IP address. + The cmsghdr fields have the following values: + + cmsg_len = sizeof(struct in_addr) + cmsg_level = IPPROTO_IP + cmsg_type = IP_RECVDSTADDR + + + Multicast Options: + + IP multicasting is supported only on AF_INET sockets of type + SOCK_DGRAM and SOCK_RAW, and only on networks where the interface + driver supports multicasting. + + The IP_MULTICAST_TTL option changes the time-to-live (TTL) for + outgoing multicast datagrams in order to control the scope of the + multicasts: + + u_char ttl; /* range: 0 to 255, default = 1 */ + setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)); + + Datagrams with a TTL of 1 are not forwarded beyond the local network. + Multicast datagrams with a TTL of 0 will not be transmitted on any + network, but may be delivered locally if the sending host belongs to + the destination group and if multicast loopback has not been disabled + on the sending socket (see below). Multicast datagrams with TTL + greater than 1 may be forwarded to other networks if a multicast + router is attached to the local network. + + For hosts with multiple interfaces, each multicast transmission is + sent from the primary network interface. The IP_MULTICAST_IF option + overrides the default for subsequent transmissions from a given + socket: + + struct in_addr addr; + setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF, &addr, sizeof(addr)); + + where "addr" is the local IP address of the desired interface or + INADDR_ANY to specify the default interface. An interface's local IP + address and multicast capability can be obtained via the SIOCGIFCONF + and SIOCGIFFLAGS ioctls. Normal applications should not need to use + this option. + + If a multicast datagram is sent to a group to which the sending host + itself belongs (on the outgoing interface), a copy of the datagram + is, by default, looped back by the IP layer for local delivery. The + IP_MULTICAST_LOOP option gives the sender explicit control over + whether or not subsequent datagrams are looped back: + + u_char loop; /* 0 = disable, 1 = enable (default) */ + setsockopt(s, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop)); + + This option improves performance for applications that may have no + more than one instance on a single host (such as a router demon), by + eliminating the overhead of receiving their own transmissions. It + should generally not be used by applications for which there may be + more than one instance on a single host (such as a conferencing + program) or for which the sender does not belong to the destination + group (such as a time querying program). + + A multicast datagram sent with an initial TTL greater than 1 may be + delivered to the sending host on a different interface from that on + which it was sent, if the host belongs to the destination group on + that other interface. The loopback control option has no effect on + such delivery. + + A host must become a member of a multicast group before it can + receive datagrams sent to the group. To join a multicast group, use + the IP_ADD_MEMBERSHIP option: + + struct ip_mreq mreq; + setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)); + + where mreq is the following structure: + + struct ip_mreq { + struct in_addr imr_multiaddr; /* multicast group to join */ + struct in_addr imr_interface; /* interface to join on */ + } + + imr_interface should be INADDR_ANY to choose the default multicast + interface, or the IP address of a particular multicast-capable + interface if the host is multihomed. Membership is associated with a + single interface; programs running on multihomed hosts may need to + join the same group on more than one interface. Up to + IP_MAX_MEMBERSHIPS (currently 20) memberships may be added on a + single socket. + + To drop a membership, use: + + struct ip_mreq mreq; + setsockopt(s, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)); + + where mreq contains the same values as used to add the membership. + Memberships are dropped when the socket is closed or the process + exits. + + + Raw IP Sockets: + + Raw IP sockets are connectionless, and are normally used with the + sendto and recvfrom calls, though the connect() call may also be used + to fix the destination for future packets (in which case the recv() + and send() system calls may be used). + + If proto is 0, the default protocol IPPROTO_RAW is used for outgoing + packets, and only incoming packets destined for that protocol are + received. If proto is non-zero, that protocol number will be used on + outgoing packets and to filter incoming packets. + + Outgoing packets automatically have an IP header prepended to them + (based on the destination address and the protocol number the socket + is created with), unless the IP_HDRINCL option has been set. Incoming + packets are received with IP header and options intact. + + IP_HDRINCL indicates the complete IP header is included with the data + and may be used only with the SOCK_RAW type. + + #include + + int hincl = 1; /* 1 = on, 0 = off */ + setsockopt(s, IPPROTO_IP, IP_HDRINCL, &hincl, sizeof(hincl)); + + Unlike previous BSD releases, the program must set all the fields of + the IP header, including the following: + + ip->ip_v = IPVERSION; + ip->ip_hl = hlen / 4; + ip->ip_id = 0; /* 0 means kernel set appropriate value */ + ip->ip_off = offset; + + If the header source address is set to INADDR_ANY, the kernel will + choose an appropriate address. + + ERRORS + A socket operation may fail with one of the following errors + returned: + + [EISCONN] + When trying to establish a connection on a socket which already + has one, or when trying to send a datagram with the destination + address specified and the socket is already connected. + + [ENOTCONN] + When trying to send a datagram, but no destination address is + specified, and the socket hasn't been connected. + + [ENOBUFS] + When the system runs out of memory for an internal data + structure. + + [EADDRNOTAVAIL] + When an attempt is made to create a socket with a network address + for which no network interface exists. + + [EACESS] + register When an attempt is made to create a raw IP socket by a + register non-privileged process. + + + The following errors specific to IP may occur when setting or getting IP + options: + + [EINVAL] + An unknown socket option name was given. + + [EINVAL] + The IP option field was improperly formed; an option field was + shorter than the minimum value or longer than the option buffer + provided. + + SEE ALSO + getsockopt(), send(), recv(), icmp, inet + + bsdsocket.library/-networking- bsdsocket.library/-networking- + + NAME + networking - introduction to networking facilities + + SYNOPSIS + #include + #include + #include + + This section is a general introduction to the networking facilities + available in the system. Documentation is broken up into three areas: + protocol families (domains), protocols, and network interfaces. + + All network protocols are associated with a specific protocol family. + A protocol family provides basic services to the protocol + implementation to allow it to function within a specific network + environment. These services may include packet fragmentation and + reassembly, routing, addressing, and basic transport. A protocol + family may support multiple methods of addressing, though the current + protocol implementations do not. A protocol family is normally + comprised of a number of protocols, one per socket() type. It is not + required that a protocol family support all socket types. A protocol + family may contain multiple protocols supporting the same socket + abstraction. + + A protocol supports one of the socket abstractions detailed in + socket(). A specific protocol may be accessed either by creating a + socket of the appropriate type and protocol family, or by requesting + the protocol explicitly when creating a socket. Protocols normally + accept only one type of address format, usually determined by the + addressing structure inherent in the design of the protocol + family/network architecture. Certain semantics of the basic socket + abstractions are protocol specific. All protocols are expected to + support the basic model for their particular socket type, but may, in + addition, provide non-standard facilities or extensions to a + mechanism. For example, a protocol supporting the SOCK_STREAM + abstraction may allow more than one byte of out-of-band data to be + transmitted per out-of-band message. + + A network interface is similar to a device interface. Network + interfaces comprise the lowest layer of the networking subsystem, + interacting with the actual transport hardware. An interface may + support one or more protocol families and/or address formats. + + ADDRESSING + Associated with each protocol family is an address format. All + network address adhere to a general structure, called a sockaddr, + described below. However, each protocol imposes finer and more + specific structure, generally renaming the variant, which is + discussed in the protocol family manual page alluded to above. + + struct sockaddr { + u_char sa_len; + u_char sa_family; + char sa_data[14]; + }; + + The field sa_len contains the total length of the of the structure, + which may exceed 16 bytes. The following address value for sa_family + is known to the system: + + #define AF_INET 2 /* internetwork: UDP, TCP, etc. */ + + INTERFACES + Each network interface in a system corresponds to a path through + which messages may be sent and received. A network interface usually + has a hardware device associated with it, though certain interfaces + such as the loopback interface, do not. + + The following IoctlSocket() calls may be used to manipulate network + interfaces. The ioctl is made on a socket (typically of type + SOCK_DGRAM) in the desired domain. Most of the requests supported in + earlier releases take an ifreq structure as its parameter. This + structure has the form + + struct ifreq { + #define IFNAMSIZ 16 + char ifr_name[IFNAMSIZE]; /* if name, e.g. "en0" */ + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + short ifru_flags; + int ifru_metric; + caddr_t ifru_data; + } ifr_ifru; + #define ifr_addr ifr_ifru.ifru_addr /* address */ + #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of point + to point link */ + #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ + #define ifr_flags ifr_ifru.ifru_flags /* flags */ + #define ifr_metric ifr_ifru.ifru_metric /* metric */ + #define ifr_data ifr_ifru.ifru_data /* for use by interface */ + }; + + Calls which are now deprecated are: + + SIOCSIFADDR + Set interface address for protocol family. Following the address + assignment, the ``initialization'' routine for the interface is + called. + + SIOCSIFDSTADDR + Set point to point address for protocol family and interface. + + SIOCSIFBRDADDR + Set broadcast address for protocol family and interface. ioctl + requests to obtain addresses and requests both to set and + retrieve other data are still fully supported and use the ifreq + structure. + + SIOCGIFADDR + Get interface address for protocol family. + + SIOCGIFDSTADDR + Get point to point address for protocol family and interface. + + SIOCGIFBRDADDR + Get broadcast address for protocol family and interface. + + SIOCSIFFLAGS + Set interface flags field. If the interface is marked down, any + processes currently routing packets through the interface are + notified; some interfaces may be reset so that incoming packets + are no longer received. When marked up again, the interface is + reinitialized. + + SIOCGIFFLAGS + Get interface flags. + + SIOCSIFMETRIC + Set interface routing metric. The metric is used only by + user-level routers. + + SIOCGIFMETRIC + Get interface metric. + + + There are two requests that make use of a new structure: + + SIOCAIFADDR + An interface may have more than one address associated with it in + some protocols. This request provides a means to add additional + addresses (or modify characteristics of the primary address if + the default address for the address family is specified). Rather + than making separate calls to set destination or broadcast + addresses, or network masks (now an integral feature of multiple + protocols) a separate structure is used to specify all three + facets simultaneously (see below). One would use a slightly + tailored version of this struct specific to each family + (replacing each sockaddr by one of the family-specific type). + Where the sockaddr itself is larger than the default size, one + needs to modify the ioctl identifier itself to include the total + size, as described in IoctlSocket(). + + SIOCDIFADDR + This requests deletes the specified address from the list + associated with an interface. It also uses the if_aliasreq + structure to allow for the possibility of protocols allowing + multiple masks or destination addresses, and also adopts the + convention that specification of the default address means to + delete the first address for the interface belonging to the + address family in which the original socket was opened. + + SIOCGIFCONF + Get interface configuration list. This request takes an ifconf + structure (see below) as a value-result parameter. The ifc_len + field should be initially set to the size of the buffer pointed + to by ifc_buf. On return it will contain the length, in bytes, of + the configuration list. + + /* + * Structure used in SIOCAIFCONF request. + */ + struct ifaliasreq { + char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct sockaddr ifra_addr; + struct sockaddr ifra_broadaddr; + struct sockaddr ifra_mask; + }; + + /* + * Structure used in SIOCGIFCONF request. + * Used to retrieve interface configuration + * for machine (useful for programs which + * must know all networks accessible). + */ + struct ifconf { + int ifc_len; /* size of associated buffer */ + union { + caddr_t ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; + #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ + #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ + }; + + SEE ALSO + socket(), IoctlSocket() + + bsdsocket.library/-route- bsdsocket.library/-route- + + NAME + route - kernel packet forwarding database + + SYNOPSIS + #include + #include + #include + + int socket(PF_ROUTE, SOCK_RAW, int family); + + FUNCTION + The kernel maintains a routing information database, which is used in + selecting the appropriate network interface when transmitting + packets. + + A user process (or possibly multiple co-operating processes) + maintains this database by sending messages over a special kind of + socket. This supplants fixed size IoctlSocket()'s used in earlier + releases. Routing table changes may only be carried out by the super + user. + + The operating system may spontaneously emit routing messages in + response to external events, such as receipt of a re-direct, or + failure to locate a suitable route for a request. The message types + are described in greater detail below. + + Routing database entries come in two flavors: for a specific host, or + for all hosts on a generic subnetwork (as specified by a bit mask and + value under the mask. The effect of wildcard or default route may be + achieved by using a mask of all zeros, and there may be hierarchical + routes. + + When the system is booted and addresses are assigned to the network + interfaces, each protocol family installs a routing table entry for + each interface when it is ready for traffic. Normally the protocol + specifies the route through each interface as a ``direct'' connection + to the destination host or network. If the route is direct, the + transport layer of a protocol family usually requests the packet be + sent to the same host specified in the packet. Otherwise, the + interface is requested to address the packet to the gateway listed in + the routing entry (i.e. the packet is forwarded). + + When routing a packet, the kernel will attempt to find the most + specific route matching the destination. (If there are two different + mask and value-under-the-mask pairs that match, the more specific is + the one with more bits in the mask. A route to a host is regarded as + being supplied with a mask of as many ones as there are bits in the + destination). If no entry is found, the destination is declared to be + unreachable, and a routing-miss message is generated if there are any + listers on the routing control socket described below. + + A wildcard routing entry is specified with a zero destination address + value, and a mask of all zeroes. Wildcard routes will be used when + the system fails to find other routes matching the destination. The + combination of wildcard routes and routing redirects can provide an + economical mechanism for routing traffic. + + One opens the channel for passing routing control messages by using + the socket call shown in the synopsis above: + + The family parameter may be AF_UNSPEC which will provide routing + information for all address families, or can be restricted to a + specific address family by specifying which one is desired. There can + be more than one routing socket open per system. + + Messages are formed by a header followed by a small number of + sockadders, interpreted by position, and delimited by the new length + entry in the sockaddr. The interpretation of which address are + present is given by a bit mask within the header, and the sequence is + least significant to most significant bit within the vector. + + Any messages sent to the kernel are returned, and copies are sent to + all interested listeners. The kernel will provide the process id. for + the sender, and the sender may use an additional sequence field to + distinguish between outstanding messages. However, message replies + may be lost when kernel buffers are exhausted. + + The kernel may reject certain messages, and will indicate this by + filling in the rtm_errno field. The routing code returns EEXIST if + requested to duplicate an existing entry, ESRCH if requested to + delete a non-existent entry, or ENOBUFS if insufficient resources + were available to install a new route. In the current implementation, + all routing process run locally, and the values for rtm_errno are + available through the normal errno mechanism, even if the routing + reply message is lost. + + A process may avoid the expense of reading replies to its own + messages by issuing a setsockopt() call indicating that the + SO_USELOOPBACK option at the SOL_SOCKET level is to be turned off. A + process may ignore all messages from the routing socket by doing a + shutdown() system call for further input. + + If a route is in use when it is deleted, the routing entry will be + marked down and removed from the routing table, but the resources + associated with it will not be reclaimed until all references to it + are released. User processes can obtain information about the routing + entry to a specific destination by using a RTM_GET message. + + Messages include: + + #define RTM_ADD 0x1 /* Add Route */ + #define RTM_DELETE 0x2 /* Delete Route */ + #define RTM_CHANGE 0x3 /* Change Metrics, Flags, or Gateway */ + #define RTM_GET 0x4 /* Report Information */ + #define RTM_LOOSING 0x5 /* Kernel Suspects Partitioning */ + #define RTM_REDIRECT 0x6 /* Told to use different route */ + #define RTM_MISS 0x7 /* Lookup failed on this address */ + #define RTM_RESOLVE 0xb /* request to resolve dst to LL addr */ + + A message header consists of: + + struct rt_msghdr { + u_short rmt_msglen; /* to skip over non-understood messages */ + u_char rtm_version; /* future binary compatibility */ + u_char rtm_type; /* message type */ + u_short rmt_index; /* index for associated ifp */ + pid_t rmt_pid; /* identify sender */ + int rtm_addrs; /* bitmask identifying sockaddrs in msg */ + int rtm_seq; /* for sender to identify action */ + int rtm_errno; /* why failed */ + int rtm_flags; /* flags, incl kern & message, e.g. DONE */ + int rtm_use; /* from rtentry */ + u_long rtm_inits; /* which values we are initializing */ + struct rt_metrics rtm_rmx; /* metrics themselves */ + }; + + where: + + struct rt_metrics { + u_long rmx_locks; /* Kernel must leave these values alone */ + u_long rmx_mtu; /* MTU for this path */ + u_long rmx_hopcount; /* max hops expected */ + u_long rmx_expire; /* lifetime for route, e.g. redirect */ + u_long rmx_recvpipe; /* inbound delay-bandwith product */ + u_long rmx_sendpipe; /* outbound delay-bandwith product */ + u_long rmx_ssthresh; /* outbound gateway buffer limit */ + u_long rmx_rtt; /* estimated round trip time */ + u_long rmx_rttvar; /* estimated rtt variance */ + }; + + Flags include the values: + + #define RTF_UP 0x1 /* route usable */ + #define RTF_GATEWAY 0x2 /* destination is a gateway */ + #define RTF_HOST 0x4 /* host entry (net otherwise) */ + #define RTF_REJECT 0x8 /* host or net unreachable */ + #define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */ + #define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */ + #define RTF_DONE 0x40 /* message confirmed */ + #define RTF_MASK 0x80 /* subnet mask present */ + #define RTF_CLONING 0x100 /* generate new routes on use */ + #define RTF_XRESOLVE 0x200 /* external daemon resolves name */ + #define RTF_LLINFO 0x400 /* generated by ARP or ESIS */ + #define RTF_STATIC 0x800 /* manually added */ + #define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ + #define RTF_PROTO2 0x4000 /* protocol specific routing flag #1 */ + #define RTF_PROTO1 0x8000 /* protocol specific routing flag #2 */ + + Specifiers for metric values in rmx_locks and rtm_inits are: + + #define RTV_SSTHRESH 0x1 /* init or lock _ssthresh */ + #define RTV_RPIPE 0x2 /* init or lock _recvpipe */ + #define RTV_SPIPE 0x4 /* init or lock _sendpipe */ + #define RTV_HOPCOUNT 0x8 /* init or lock _hopcount */ + #define RTV_RTT 0x10 /* init or lock _rtt */ + #define RTV_RTTVAR 0x20 /* init or lock _rttvar */ + #define RTV_MTU 0x40 /* init or lock _mtu */ + + Specifiers for which addresses are present in the messages are: + + #define RTA_DST 0x1 /* destination sockaddr present */ + #define RTA_GATEWAY 0x2 /* gateway sockaddr present */ + #define RTA_NETMASK 0x4 /* netmask sockaddr present */ + #define RTA_GENMASK 0x8 /* cloning mask sockaddr present */ + #define RTA_IFP 0x10 /* interface name sockaddr present */ + #define RTA_IFA 0x20 /* interface addr sockaddr present */ + #define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ + + NOTES + Routing sockets were not part of the original AmiTCP specification. + This is because the 4.3 BSD TCP/IP kernel, which AmiTCP is based + upon, implemented this functionality differently. + + bsdsocket.library/-tcp- bsdsocket.library/-tcp- + + NAME + tcp - Internet Transmission Control Protocol + + SYNOPSIS + #include + #include + + int socket(AF_INET, SOCK_STREAM, 0); + + FUNCTION + The TCP protocol provides reliable, flow-controlled, two-way + transmission of data. It is a byte-stream protocol used to support + the SOCK_STREAM abstraction. TCP uses the standard Internet address + format and, in addition, provides a per-host collection of ``port + addresses''. Thus, each address is composed of an Internet address + specifying the host and network, with a specific TCP port on the host + identifying the peer entity. + + Sockets utilizing the tcp protocol are either ``active'' or + ``passive''. Active sockets initiate connections to passive sockets. + By default TCP sockets are created active; to create a passive socket + the listen() system call must be used after binding the socket with + the bind() system call. Only passive sockets may use the accept() + call to accept incoming connections. Only active sockets may use the + connect() call to initiate connections. + + Passive sockets may ``underspecify'' their location to match incoming + connection requests from multiple networks. This technique, termed + ``wildcard addressing'', allows a single server to provide service to + clients on multiple networks. To create a socket which listens on all + networks, the Internet address INADDR_ANY must be bound. The TCP port + may still be specified at this time; if the port is not specified the + system will assign one. Once a connection has been established the + socket's address is fixed by the peer entity's location. The address + assigned the socket is the address associated with the network + interface through which packets are being transmitted and received. + Normally this address corresponds to the peer entity's network. + + TCP supports one socket option which is set with setsockopt() and + tested with getsockopt(). Under most circumstances, TCP sends data + when it is presented; when outstanding data has not yet been + acknowledged, it gathers small amounts of output to be sent in a + single packet once an acknowledgement is received. For a small number + of clients, such as window systems that send a stream of mouse events + which receive no replies, this packetization may cause significant + delays. Therefore, TCP provides a boolean option, TCP_NODELAY (from + , to defeat this algorithm. The option level for the + setsockopt call is the protocol number for TCP, available from + getprotobyname(). + + Options at the IP transport level may be used with TCP; see ip. + Incoming connection requests that are source-routed are noted, and + the reverse source route is used in responding. + + ERRORS + A socket operation may fail with one of the following errors + returned: + + [EISCONN] + When trying to establish a connection on a socket which already + has one. + + [ENOBUFS] + When the system runs out of memory for an internal data + structure. + + [ETIMEDOUT] + When a connection was dropped due to excessive retransmissions. + + [ECONNRESET] + When the remote peer forces the connection to be closed. + + [ECONNREFUSED] + When the remote peer actively refuses connection establishment + (usually because no process is listening to the port). + + [EADDRINUSE] + When an attempt is made to create a socket with a port which has + already been allocated. + + [EADDRNOTAVAIL] + When an attempt is made to create a socket with a network address + for which no network interface exists. + + SEE ALSO + getsockopt(), socket(), inet, ip + + bsdsocket.library/-udp- bsdsocket.library/-udp- + + NAME + udp - Internet User Datagram Protocol + + SYNOPSIS + #include + #include + + int socket(AF_INET, SOCK_DGRAM, 0); + + FUNCTION + UDP is a simple, unreliable datagram protocol which is used to + support the SOCK_DGRAM abstraction for the Internet protocol family. + UDP sockets are connectionless, and are normally used with the sendto + and recvfrom calls, though the connect() call may also be used to fix + the destination for future packets (in which case the recv() and + send() system calls may be used). + + UDP address formats are identical to those used by TCP. In particular + UDP provides a port identifier in addition to the normal Internet + address format. Note that the UDP port space is separate from the TCP + port space (i.e. a UDP port may not be ``connected'' to a TCP port). + In addition broadcast packets may be sent (assuming the underlying + network supports this) by using a reserved ``broadcast address''; + this address is network interface dependent. + + Options at the IP transport level may be used with UDP; see ip. + + ERRORS + A socket operation may fail with one of the following errors + returned: + + [EISCONN] + When trying to establish a connection on a socket which already has + one, or when trying to send a datagram with the destination address + specified and the socket is already connected. + + [ENOTCONN] + When trying to send a datagram, but no destination address is + specified, and the socket hasn't been connected. + + [ENOBUFS] + When the system runs out of memory for an internal data structure. + + [EADDRINUSE] + When an attempt is made to create a socket with a port which has + already been allocated. + + [EADDRNOTAVAIL] + When an attempt is made to create a socket with a network address for + which no network interface exists. + + SEE ALSO + getsockopt(), recv(), send(), socket(), inet, ip + + bsdsocket.library/AbortInterfaceConfig bsdsocket.library/AbortInterfaceConfig + + NAME + AbortInterfaceConfig - Attempt to abort an IP address allocation + process currently in progress. + + SYNOPSIS + AbortInterfaceConfig(message) + A0 + + VOID AbortInterfaceConfig(struct AddressAllocationMessage * message); + + FUNCTION + The interface address allocation process is asynchronous by + nature; it may take its time to complete, but you may not + want to wait for this to happen. You can try to abort the + process with this routine. + + INPUTS + message -- Pointer to a 'struct AddressAllocationMessage' + message which has been sent using the + BeginInterfaceConfig() routine. + + NOTES + The AbortInterfaceConfig() call is an extension to the + AmiTCP V4 API and cannot be assumed to be present in all versions + of "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_INTERFACE_API tag with the + SocketBaseTagList() function. + + There is no guarantee that the message can be intercepted and the + IP address allocation process aborted by this routine. In fact, + the process can complete before this routine has managed to + abort it. + + SEE ALSO + BeginInterfaceConfig() + + bsdsocket.library/accept bsdsocket.library/accept + + NAME + accept - accept a connection on a socket + + SYNOPSIS + #include + #include + + socket = accept(s, addr, addrlen) + D0 D0 A0 A1 + + long accept(long s, struct sockaddr *addr, long *addrlen); + + FUNCTION + The argument s is a socket that has been created with socket(), bound + to an address with bind(), and is listening for connections after a + listen(). The accept() argument extracts the first connection request + on the queue of pending connections, creates a new socket with the + same properties of s and allocates a new file descriptor for the + socket. If no pending connections are present on the queue, and the + socket is not marked as non-blocking, accept() blocks the caller + until a connection is present. If the socket is marked non-blocking + and no pending connections are present on the queue, accept() returns + an error as described below. The accepted socket may not be used to + accept more connections. The original socket s remains open. + + The argument addr is a result parameter that is filled in with the + address of the connecting entity, as known to the communications + layer. The exact format of the addr parameter is determined by the + domain in which the communication is occurring. The addrlen is a + value-result parameter; it should initially contain the amount of + space pointed to by addr; on return it will contain the actual length + (in bytes) of the address returned. This call is used with + connection-based socket types, currently with SOCK_STREAM. + + It is possible to WaitSelect() a socket for the purposes of doing an + accept() by selecting it for read. + + One can obtain user connection request data without confirming the + connection by issuing a recvmsg() call with an msg_iovlen of 0 and a + non-zero msg_controllen, or by issuing a getsockopt() request. + Similarly, one can provide user connection rejection information by + issuing a sendmsg() call with providing only the control information, + or by calling setsockopt(). + + RESULT + The call returns -1 on error. If it succeeds, it returns a + non-negative integer that is a descriptor for the accepted socket. + + ERRORS + The accept() will fail if: + + [EBADF] + The descriptor is invalid. + + [ENOTSOCK] + The descriptor references a file, not a socket. + + [EOPNOTSUPP] + The referenced socket is not of type SOCK_STREAM. + + [EFAULT] + The addr parameter is not in a writable part of the user + address space. + + [EWOULDBLOCK] + The socket is marked non-blocking and no connections are + present to be accepted. + + SEE ALSO + bind(), connect(), listen(), WaitSelect(), socket() + + bsdsocket.library/AddDomainNameServer bsdsocket.library/AddDomainNameServer + + NAME + AddDomainNameServer - Add another domain name server address to the + local resolver database. + + SYNOPSIS + success = AddDomainNameServer(address) + D0 A0 + + LONG AddDomainNameServer(STRPTR address); + + FUNCTION + AddDomainNameServer() adds another address to the local resolver + database. This does not modify the on-disk resolver database, + the change only affects the in-memory copy. + + INPUTS + address -- Domain name server address as a pointer to a + NUL-terminated string; the address must be given in + dotted-decimal notation (per RFC1700). + + RESULT + If the address could be added, a 0 value is returned. A return value + of -1 indicates an error, which is further specified in the global + errno. + + ERRORS + The AddDomainNameServer() call will fail if: + + [ENOBUFS] + There was not enough memory left to add a new database entry. + + [EINVAL] + The IP address is not valid. + + [EFAULT] + The address parameter is not valid. + + NOTES + The AddDomainNameServer() call is an extension to the + AmiTCP V4 API and cannot be assumed to be present in all versions + of "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_DNS_API tag with the + SocketBaseTagList() function. + + This call nests, i.e. adding the same address twice will + require two calls RemoveDomainNameServer() to remove it again. + + The local in-memory domain name server database is scanned + before the on-disk configuration file is examined. + + SEE ALSO + RemoveDomainNameServer(), SocketBaseTagList() + + bsdsocket.library/AddInterfaceTagList bsdsocket.library/AddInterfaceTagList + + NAME + AddInterfaceTagList - Make a new interface available for network + access + + SYNOPSIS + success = AddInterfaceTagList(name,device,unit,tags) + D0 A0 A1 D0 A2 + + long AddInterfaceTagList(STRPTR name,STRPTR device,LONG unit, + struct TagItem *tags); + + long AddInterfaceTags(STRPTR name,STRPTR device, LONG unit,...); + + FUNCTION + This function makes another device available for network access. + Each such device must be assigned a unique interface name and + refer to a SANA-II device name and unit number. + + INPUTS + name -- Unique name of the interface, as will be later referred + to with the stack's API (e.g. IoctlSocket()). This name + cannot be longer than 15 characters. + + device -- Name of the SANA-II device driver to associate with + the interface. + + unit -- The device driver unit to use. + + tags -- Pointer to a 'struct TagItem' list. + + TAGS + IFA_IPType (LONG) - Overrides the packet type the stack uses + when sending IP packets. Default is 2048. + + IFA_ARPType (LONG) - Overrides the packet type the stack uses + when sending ARP packets. Default is 2054. + + IFA_NumReadRequests (LONG) - Overrides the number of IP read + requests to allocate and queue for the underlying SANA-II + device driver to use. Default is 32. + + IFA_NumWriteRequests (LONG) - Overrides the number of IP write + requests to allocate and queue for the underlying SANA-II + device driver to use. Default is 32. + + IFA_NumARPRequests (LONG) - Overrides the number of ARP + requests to allocate and queue for the underlying SANA-II + device driver to use. Default is 4. +. + IFA_PacketFilterMode (LONG) - Configure the packet filter mode + access permitted for this interface. Possible options are: + + PFM_Nothing + The filter is disabled for this interface. + + PFM_Local + Enables filtering on all IP and ARP packets that + are intended for this particular interface. Packets + intended for other interfaces or hosts are ignored. + + PFM_IPandARP + Enables filtering on all IP and ARP packets that + happen to fly by this interface, no matter whether + the packets are intended for it or not. This requires + that the underlying network device driver is opened + for exclusive access in so-called 'promiscuous' mode. + This may not work if other clients (Envoy, ACS) need + to keep the driver opened. + + PFM_Everything + Enables filtering on all packet types that happen + to pass by, regardless of their type and contents. + This requires that the underlying network device + driver is opened for exclusive access in so-called + 'promiscuous' mode. This may not work if other clients + (Envoy, ACS) need to keep the driver opened. + + Please note that packets which are not of the IP + and ARP types will not be processed by the TCP/IP + stack. Thus, your filter may see the packets but + they will eventually be quietly discarded. + + Default is PFM_Local. Note that this option only configures + the limits and possibilities open to the Berkeley Packet Filter + mechanism, but does not enable the filter. + + IFA_PointToPoint (BOOL) - Choose whether this interface is of + the point-to-point type. Not normally necessary since + the stack can figure this out all by itself. + + IFA_Multicast (BOOL) - This option tells the stack that this device + can handle multicast packets. It is enabled by default for + Ethernet hardware, and is assumed to be FALSE for all other + hardware types. Default for this option is TRUE for Ethernet + hardware and FALSE for every other kind of hardware. + + IFA_DownGoesOffline (BOOL) - This option is useful with + point-to-point devices, like 'ppp.device'. When specified, + bringing the interface 'down' or shutting down the stack will + cause the associated SANA-II device driver to be switched + offline (via the 'S2_OFFLINE' command). Default is FALSE. + + IFA_ReportOffline (BOOL) - When a device is switched offline, + you may want to know about it. This is helpful with SLIP/PPP + connections which run over a serial link which accumulates costs + while it is open. When the connection is broken and the device + goes offline, you will receive a brief notification of what + happened. However, if you tell the library itself to shut down, + no notification that a device was switched offline will be shown. + Default is FALSE. + + IFA_RequiresInitDelay (BOOL) - Some devices need a little time to + settle after they have been opened or they will hickup and lose + data after the first packet has been sent. For these devices, + this option will cause a delay of about a second before the first + packet is sent. Default is TRUE. + + IFA_CopyMode (LONG) - This enables special data copying code which + may not be compatible with all SANA-II devices. This can + be one of the following options: + + CM_SlowWordCopy + Use the default data copying code. Not necessarily + the fastest way to transfer the data, but should work + with all drivers. + + CM_FastWordCopy + Use the faster data copying code. This may not + work reliably with all devices. + + Default is CM_SlowWordCopy. + + IFA_HardwareAddress (struct InterfaceHardwareAddress *) - You can + try to configure the interface's hardware address when it is + added. Note that this typically works only once for every + driver. The address to be used must be stored in the following + data structure: + + struct InterfaceHardwareAddress + { + LONG iha_Length; + UBYTE * iha_Address; + }; + + The structure members have the following purposes: + + iha_Length + Address length, given in number of bits. For example, + an Ethernet MAC address would be 48 bits in size. + + iha_Address + Points to the first byte that contains the address. + For example, there are six bytes in an Ethernet MAC + address. + + Addresses that are too long for the underlying hardware to + fit will be truncated. + + IFA_SetDebugMode (BOOL) - Enable or disable debugging mode for + this interface. This option defaults to FALSE. + + IFA_LimitMTU (ULONG) - You can limit the size of the maximum + transmission unit (MTU) configured for this interface. Normally, + this value is predefined by the hardware driver, but you can + request that a smaller size is used. This can help if, in order + to route packets properly, an artificial limit is imposed on + the maximum packet size. By default the MTU value provided by + the hardware driver is used. + + RESULT + success -- 0 for success, -1 for failure; the failure code will + be stored in the 'errno' variable. + + NOTES + The AddInterfaceTagList() call is an extension to the AmiTCP V4 API + and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_INTERFACE_API tag with the + SocketBaseTagList() function. + + This function is intended to be a simplified, specialized front end + to the underlying interface socket API. If you want more than this + function can do for you, use the interface socket API. + + SEE ALSO + ConfigureInterfaceTagList(), QueryInterfaceTagList() + + bsdsocket.library/AddNetMonitorHookTagListet.library/AddNetMonitorHookTagList + + NAME + AddNetMonitorHookTagList - Add a network monitoring callback hook. + + SYNOPSIS + success = AddNetMonitorHookTagList(type,hook,tags) + D0 D0 A0 A1 + + long AddNetMonitorHookTagList(long type,struct Hook *hook, + struct TagItem *tags) + + long AddNetMonitorHookTags(long type,struct Hook *hook,...); + + FUNCTION + This function is for adding network monitoring callback hooks. + There are different types of hooks to be installed, each for + one particular purpose. Monitoring hooks can be used both for + inspecting and filtering data that enters the stack, or for + denying access to certain APIs. More than one hook can be + installed for each monitoring task. + + INPUTS + type -- The type of monitoring hook to install; this must be + one of the following: + + MHT_ICMP + Monitor incoming ICMP messages. + + MHT_UDP + Monitor incoming UDP datagrams. + + MHT_TCP_Connect + Monitor incoming TCP segments that are about to + initiate a connection. + + MHT_Connect + Monitor calls to the connect() function. + + MHT_Send + Monitor calls to the send(), sendto() and + sendmsg() calls. + + MHT_Packet + Monitor incoming and outgoing packets. + + MHT_Bind + Monitor calls to the bind() function. + + hook -- Pointer to a Hook to be invoked for monitoring; the + Hook will be added to an interal list and must be + removed before the library is closed. Depending on the + type of monitoring task, the hook will be invoked with + different parameters: + + MHT_ICMP + + action = hookfunc(hook,reserved,imm) + D0 A0 A2 A1 + + LONG hookfunc(struct Hook *hook, APTR reserved, + struct ICMPMonitorMessage *imm); + + The hook function will be invoked from withing + the TCP/IP stack itself, which disallows calls + into "bsdsocket.library". Since the hook code + may be invoked frequently, your code should + perform its tasks swiftly and without delay. + + The 'reserved' parameter will be set to NULL + for future expansion. + + The contents of the 'ICMPMonitorMessage' must + not be modified as they will be forwarded to the + next hook in line, which will want to take another + look at it. + + The 'action' value the hook function returns + decides the fate of the ICMP message. The following + actions are supported: + + MA_Continue + The ICMP message will be processed + as usual. + + MA_Ignore + The ICMP message will be ignored, but + will end up in the raw IP processing + framework. + + MA_Drop + The ICMP message will be ignored and + dropped as if it had a checksum error. + + MHT_UDP + + action = hookfunc(hook,reserved,umm) + D0 A0 A2 A1 + + LONG hookfunc(struct Hook *hook, APTR reserved, + struct UDPMonitorMessage *umm); + + The hook function will be invoked from withing + the TCP/IP stack itself, which disallows calls + into "bsdsocket.library". Since the hook code + may be invoked frequently, your code should + perform its tasks swiftly and without delay. + + The 'reserved' parameter will be set to NULL + for future expansion. + + The contents of the 'UDPMonitorMessage' must + not be modified as they will be forwarded to the + next hook in line, which will want to take another + look at it. + + The 'action' value the hook function returns + decides the fate of the UDP datagram. The following + actions are supported: + + MA_Continue + The UDP datagram will be processed + as usual. + + MA_Drop + The UDP datagram will be ignored and + dropped as if it had a checksum error. + + MHT_TCP_Connect + + action = hookfunc(hook,reserved,tcmm) + D0 A0 A2 A1 + + LONG hookfunc(struct Hook *hook, APTR reserved, + struct TCPConnectMonitorMessage *tcmm); + + The hook function will be invoked from withing + the TCP/IP stack itself, which disallows calls + into "bsdsocket.library". Since the hook code + may be invoked frequently, your code should + perform its tasks swiftly and without delay. + + The 'reserved' parameter will be set to NULL + for future expansion. + + The contents of the 'TCPConnectMonitorMessage' must + not be modified as they will be forwarded to the + next hook in line, which will want to take another + look at it. + + The hook will be invoked before the regular TCP + segment processing begins, which attempts to + establish a connection. Specifically, the hook + code is invoked before the TCP three way handshake + procedure has even started, or the stack has + determined whether there is a socket ready to + accept the incoming connection request. + + The 'action' value the hook function returns + decides the fate of the TCP segment. The following + actions are supported: + + MA_Continue + The TCP segment will be processed + as usual. + + MA_Drop + The TCP segment will be ignored and + dropped as if it had a checksum error. + The remote will not receive any notification + of the segment having been dropped and may + have to time out and retransmit it. + + MA_DropWithReset + The TCP segment will be ignored and + dropped as if it had a checksum error. + In return the remote will receive a + notification in the form of a connection + reset, which will allow it to recover + immediately. If you want to reject a + connection request, this is the most + graceful way to do it. + + MHT_Connect + + error = hookfunc(hook,reserved,cmm) + D0 A0 A2 A1 + + LONG hookfunc(struct Hook *hook, APTR reserved, + struct ConnectMonitorMsg *cmm); + + The hook function will be invoked before + dropping into the kernel 'connect()' call. This + allows you to perform any necessary "bsdsocket.library" + calls before you decide whether the call should + proceed or be terminated with an error. + + The 'reserved' parameter will be set to NULL + for future expansion. + + The contents of the 'ConnectMonitorMessage' must + not be modified as they will be forwarded to the + next hook in line, which will want to take another + look at it. + + The 'error' value the hook function returns + decides whether the call can proceed as usual + or not. An error value of 0 will allow the call + to proceed (unless another hook denies this), and + any error value > 0 will cause the call to be + aborted and the errno variable to be set to this value. + + MHT_Bind + + error = hookfunc(hook,reserved,cmm) + D0 A0 A2 A1 + + LONG hookfunc(struct Hook *hook, APTR reserved, + struct BindMonitorMsg *cmm); + + The hook function will be invoked before + dropping into the kernel 'bind()' call. This + allows you to perform any necessary "bsdsocket.library" + calls before you decide whether the call should + proceed or be terminated with an error. + + The 'reserved' parameter will be set to NULL + for future expansion. + + The contents of the 'BindMonitorMessage' must + not be modified as they will be forwarded to the + next hook in line, which will want to take another + look at it. + + The 'error' value the hook function returns + decides whether the call can proceed as usual + or not. An error value of 0 will allow the call + to proceed (unless another hook denies this), and + any error value > 0 will cause the call to be + aborted and the errno variable to be set to this value. + + MHT_Send + + error = hookfunc(hook,reserved,smm) + D0 A0 A2 A1 + + LONG hookfunc(struct Hook *hook, APTR reserved, + struct SendMonitorMsg *smm); + + The hook function will be invoked before + dropping into the kernel 'send()', 'sendto()' or + 'sendmsg()' calls. This allows you to perform any + necessary "bsdsocket.library" calls before you decide + whether the call should proceed or be terminated with + an error. + + The 'reserved' parameter will be set to NULL + for future expansion. + + The contents of the 'SendMonitorMessage' must + not be modified as they will be forwarded to the + next hook in line, which will want to take another + look at it. + + The 'error' value the hook function returns + decides whether the call can proceed as usual + or not. An error value of 0 will allow the call + to proceed (unless another hook denies this), and + any error value > 0 will cause the call to be + aborted and the errno variable to be set to this value. + + Depending upon the type of function to perform, the + contents of the SendMonitorMessage may look different. + For example, either the 'smm_To' or the 'smm_Msg' field + will be NULL. + + MHT_Packet + + action = hookfunc(hook,reserved,pmm) + D0 A0 A2 A1 + + LONG hookfunc(struct Hook *hook, APTR reserved, + struct PacketMonitorMessage *pmm); + + The hook function will be invoked from withing + the TCP/IP stack itself, which disallows calls + into "bsdsocket.library". Since the hook code + may be invoked frequently, your code should + perform its tasks swiftly and without delay. + + The 'reserved' parameter will be set to NULL + for future expansion. + + The contents of the 'PacketMonitorMessage' must + not be modified as they will be forwarded to the + next hook in line, which will want to take another + look at it. + + The 'action' value the hook function returns + decides the fate of the packet. The following + actions are supported: + + MA_Continue + The packet will be processed + as usual. + + MA_Drop + The packet will be ignored and dropped + as if it had a checksum error. + + tags -- Pointer to a 'struct TagItem' list. No tags are + defined yet. + + RESULT + If the action is successful, a 0 value is returned. A return value of + -1 indicates an error, which is further specified in the global + errno. + + ERRORS + The AddNetMonitorHookTagList() call fails if: + + [EFAULT] + The hook parameter is not valid. + + [EINVAL] + The monitor type is not supported. + + NOTES + The AddNetMonitorHookTagList() call is an extension to the AmiTCP V4 + API and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_MONITORING_API tag with the + SocketBaseTagList() function. + + SEE ALSO + RemoveNetMonitorHook() + + bsdsocket.library/AddRouteTagList bsdsocket.library/AddRouteTagList + + NAME + AddRouteTagList - Add entries to the networking routing tables + + SYNOPSIS + success = AddRouteTagList(tags) + D0 A0 + + long AddRouteTagList(struct TagItem *tags); + + long AddRouteTags(Tag tag1,...); + + FUNCTION + This function is for manipulating the networking routing tables + by adding new entries to them. Typical applications involve adding + a route to a point to point partner or selecting the default + route any packet not intended for the local host should take. + + INPUTS + tags -- Pointer to a 'struct TagItem' list. + + TAGS + RTA_Destination (STRPTR) -- The route's destination address, which + must be specified as a NUL-terminated string. The string can + contain a host name to be resolved or an IP address in + dotted-decimal notation (see RFC1700). The RTA_Destination tag + can be used in conjunction with the RTA_Gateway tag. + + RTA_Gateway (STRPTR) -- The address of the gateway that forwards + packets to the destination address. This must be a NUL- + terminated string referring to a host name to be resolved or + an IP address in dotted-decimal notation (see RFC1700). The + RTA_Gateway tag requires the use of the RTA_Destination tag. + + RTA_DefaultGateway (STRPTR) -- The address of the default gateway + all packets will be forwarded to which cannot be sent along + any other known route. This must be a NUL-terminated string + referring to a host name to be resolved or an IP address in + dotted-decimal notation. The RTA_DefaultGateway tag excludes + the use of the RTA_Destination and RTA_Gateway tags. + + RTA_DestinationHost (STRPTR) - Like RTA_Destination, but forces + the destination address to be interpreted as a host. Otherwise, + if the destination has a local address part of INADDR_ANY or + if the destination is the symbolic name of a network, then the + route is assumed to be a to a network. + + RTA_DestinationNet (STRPTR) - Like RTA_Destination, but forces the + destination address to be interpreted as a network. + + RESULT + success -- 0 for success, -1 for failure; the failure code will + be stored in the 'errno' variable. + + NOTES + The AddRouteTagList() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_ROUTING_API tag with the + SocketBaseTagList() function. + + This function is intended to be a simplified, specialized front end + to the underlying routing socket API. If you want more than this + function can do for you, use the routing socket API. Take care, as + this functionality is not present in the original AmiTCP implementation. + + SEE ALSO + DeleteRouteTagList(), route + + bsdsocket.library/BeginInterfaceConfig bsdsocket.library/BeginInterfaceConfig + + NAME + BeginInterfaceConfig - Attempt to allocate an IP address for + an interface. + + SYNOPSIS + BeginInterfaceConfig(message) + A0 + + VOID BeginInterfaceConfig(struct AddressAllocationMessage * message); + + FUNCTION + This routine uses the Bootstrap Protocol (BOOTP; see RFC951), + the Dynamic Host Configuration Protocol (DHCP; RFC 2131) or a + different dynamic address configuration protocol to obtain + configuration information for a specific network interface. + A BOOTP request will be set up, sent and resent in regular + intervals until either a timeout occurs or a BOOTP/DHCP server + responds. Since this process is asynchronous by nature, + it is started by sending a message whose contents the + caller has to fill in and in which the BOOTP message result + will be returned. + + INPUTS + message -- Pointer to a 'struct AddressAllocationMessage' + message which must be properly initialized (see below). + When the message has been processed, it will be + returned to the caller via 'ReplyMsg()'. + + MESSAGE + The message must be initialized like any other kind of + 'struct Message' that is to be attached to a MsgPort + and eventually replied with 'ReplyMsg()'. Unless described + otherwise, all members of the message must be set to zero + before it is handed over to BeginInterfaceConfig(). + The individual structure members should be initialized + as follows: + + aam_Version + The version of the message, corresponding to a + particular layout and contents. The message + format may change in future releases. The + version described in this documentation is #1. + You must fill in this member or the message + will be rejected. + + aam_Protocol + This must be one of AAMP_BOOTP, AAMP_DHCP, AAMP_SLOWAUTO + or AAMP_FASTAUTO. + + AAMP_BOOTP stands for the Bootstrap Protocol (RFC 951). + AAMP_DHCP stands for the Dynamic Host Configuration + Protocol (RFC 2131). + AAMP_SLOWAUTO stands for an automatic IPv4 address + configuration protocol with conflict detection which + is currently being standardized. AAMP_FASTAUTO stands + for the same protocol, which runs through the individual + steps of the protocol much faster than AAMP_SLOWAUTO. + + Only the DHCP protocol honours your choice of IP address + and net mask. The others will ignore this information. + The AAMP_SLOWAUTO/AAMP_FASTAUTO protocol only configures + the IP address and nothing else. The same is true for + the BOOTP protocol. + + The AAMP_SLOWAUTO/AAMP_FASTAUTO protocol will pick an + IP address from the 169.254/16 range, with the two last + octets of the address filled in with random data. The + address will be tested to avoid collisions. Eventually, + the configuration process will settle on a choice that + works. If somewhere down the line an address collision + is detected, the address picked will be defended. But + if further collisions are found, a new address will be + picked. This can disrupt TCP/IP traffic for the local + host but it should be very rare to happen. To keep the + likelyhood of collisions low, do not use this protocol + in an environment in which more than 1,300 are using + the same protocol. The same protocol is used by 'MacOS 9' + and beyond and by the Microsoft Windows operating system + family starting with 'Windows 98'. + + The main difference between the AAMP_SLOWAUTO and + AAMP_FASTAUTO protocol flavours is that they use timeouts + of different length. The AAMP_SLOWAUTO protocol is intended + to be used in Ethernet networks with switches which use + the IEEE Spanning Tree Protocol (802.1d). The route + configuration in such networks can take a while, which is + why the AAMP_SLOWAUTO timeouts have to be on the order of + several seconds. AAMP_FASTAUTO protocol is intended to be + used for wireless networks which react faster to route + changes; the timeouts are therefore on the order of several + milliseconds which is far more responsive than the + AAMP_SLOWAUTO protocol. + + aam_InterfaceName + The name of the interface to allocate an IP + address for. + + aam_Timeout + Number of seconds to wait for a BOOTP/DHCP server + to respond. Due to how the configuration process + works, the timeout must be at least 10 seconds + long. If it is shorter, it is automatically + extended to 10 seconds. + + aam_LeaseTime + This option is relevant only for DHCP. It allows + you to specify the interface address lease time + to request from the server. The default is + DHCP_DEFAULT_LEASE_TIME, which accepts the + server's choice. The value DHCP_INFINITE_LEASE_TIME + will attempt to bind the interface address permanently. + All other values refer to the number of seconds the + lease should be allocated. + + Note that the server may choose to ignore your + preferred lease time. + + aam_RequestedAddress + A DHCP client can make a wish, as to which IP address + should be allocated for it. This is where you provide + your choice. Leave 'aam_RequestedAddress' zero to + accept the default. Note that the server may ignore + your wish. Make sure that your application does not + assume that it is always allocated the IP address + you requested. The allocation process will eventually + reset 'aam_RequestedAddress' to zero. + + aam_ClientIdentifier + Allocating an IP address for a DHCP client is not that + helpful if the client cannot be referred to by its name + after an address has been assigned to it. You can + request a name to be bound to the IP address to assign + using the 'aam_ClientIdentifier' member: it must point + to a NUL-terminated string which can be up to 255 + characters in size. Names longer than 255 characters + will be truncated, names shorter than 2 characters will + be ignored. The name string should contain only 7-bit + ASCII characters and preferably, should be short, + too. Not all DHCP servers can store client names of + arbitrary length. If you do not want a name to be + assigned, set 'aam_ClientIdentifier' to NULL. + + aam_NAKMessage + aam_NAKMessageSize + The server may refuse to allocate an IP address + for this interface and provide an explanation. + To obtain the explanatory text, put a pointer to + a string into 'aam_NAKMessage' and the size of + that string into 'aam_NAKMessageSize'. If a + response text is received, it will be copied to + the string. + + aam_RouterTable + aam_RouterTableSize + The server may provide a list of routers the + protocol stack should use when forwarding + packets. To find out which routers were + provided, put the address of a table of + 32 bit integers (unsigned long) into + 'aam_RouterTable' and the number of entries + in that table into 'aam_RouterTableSize'. + If a list of routers is received, their + addresses will be copied into the table. + A router address of 0 should be ignored. + + aam_DNSTable + aam_DNSTableSize + The server may provide a list of domain name + servers the resolver should use. To find out + which name servers were provided, put the + address of a table of 32 bit integers (unsigned + long) into 'aam_DNSTable' and the number of + entries in that table into 'aam_DNSTableSize'. + If a list of domain servers is received, their + addresses will be copied into the table. + A server address of 0 should be ignored. + + aam_StaticRouteTable + aam_StaticRouteTableSize + The server may provide a list of static + routes the protocol stack should use. + To find out which static routes were + provided, put the address of a table of + 32 bit integers (unsigned long) into + 'aam_StaticRouteTable' and the number of + entries in that table into + 'aam_StaticRouteTableSize'. If a list of + static routes is received, their + addresses will be copied into the table. + A route address of 0 should be ignored. + + aam_HostName + aam_HostNameSize + The server may provide the name to be used by + the local host. To find out which name was + assigned, put the address of a string into + 'aam_HostName' and the size of that string + into 'aam_HostNameSize'. If a host name is + received, you will receive a NUL-terminated + string. + + aam_DomainName + aam_DomainNameSize + The server may provide the name of the domain + the local host is in. To find out which name + was assigned, put the address of a string into + 'aam_DomainName' and the size of that string + into 'aam_DomainNameSize'. If a domain name is + received, you will receive a NUL-terminated + string. + + aam_BOOTPMessage + aam_BOOTPMessageSize + You can receive a copy of the BOOTP response + message that was received by the protocol stack. + Put the address of your local message buffer + into 'aam_BOOTPMessage' and the size of that + buffer (in bytes) into 'aam_BOOTPMessageSize'. + If the BOOTP request is answered, you will + find a copy of the BOOTP response message + in the buffer. + + aam_LeaseExpires + When the interface is first configured using DHCP + the lease expiration time can be copied to a user + supplied DateStamp. If the lease is infinitely + long, then the DateStamp will contain all zeroes. + + When the message is eventually replied, the following + structure members will have been filled in: + + aam_Result + This can be one of the following values: + + AAMR_Success + An IP address was successfully allocated. + + AAMR_Aborted + The allocation request was aborted. + + AAMR_Timeout + The allocation has failed since it could + not be completed in the requested time + span. + + AAMR_InterfaceNotKnown + The name of the network interface you + provided is not known. + + AAMR_InterfaceWrongType + The BOOTP protocol only works with broadcast + interfaces (e.g. Ethernet hardware). The + interface you provided is not of this kind. + + AAMR_AddressKnown + The interface already has an IP address assigned. + + AAMR_VersionUnknown + The data structure version you provided is + not supported. + + AAMR_NoMemory + There was not enough memory available to + process your request. + + AAMR_AddrChangeFailed + The interface address could not be changed. + + AAMR_MaskChangeFailed + The interface network mask could not be changed. + + AAMR_Ignored + Your request was not understood and was + therefore ignored. + + AAMR_Busy + Address allocation is already in progress for + this interface. + + aam_Address + The IP address assigned to this interface. + + aam_ServerAddress + The IP address of the BOOTP server which responsed + to the query; this may be 0. + + aam_SubnetMask + The interface's subnet mask; this may be 0. + + aam_NAKMessage + Filled in with an error message; may be empty. + + aam_RouterTable + Filled in with the addresses of the routers to + use. The addresses are listed in descending order of + preference. This list may be empty and contain + invalid IP addresses (e.g. 0.0.0.0). + + aam_DNSTable + Filled in with the addresses of the domain name servers + use. The addresses are listed in descending order of + preference. This list may be empty and contain + invalid IP addresses (e.g. 0.0.0.0). + + aam_StaticRouteTable + Filled in with the destination addresses of static + routes. The addresses are listed in descending order + of preference. This list may be empty and contain + invalid IP addresses (e.g. 0.0.0.0). + + aam_HostName + The name assigned to this host; this may be empty. + + aam_DomainName + The domain name assigned to this host; this may be empty. + + aam_BOOTPMessage + A copy of the BOOTP response; this may be empty if + 'aam_Result != AAMR_Success'. + + NOTES + The BeginInterfaceConfig() call is an extension to the + AmiTCP V4 API and cannot be assumed to be present in all versions + of "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_INTERFACE_API tag with the + SocketBaseTagList() function. + + This routine starts an asynchronous operation, very much like + exec.library/SendIO(). It may take its time to complete. To + abort it before it has completed, use the + AbortInterfaceConfig() routine. + + DHCP is built on top of BOOTP, which is why the documentation + uses both terms interchangeably. Note, however, that the actual + protocols work very differently and support different features. + BOOTP only reports an IP address for you to use permanently + whereas DHCP will cause the interface address to be updated and + renewed repeatedly over time. + + SEE ALSO + AbortInterfaceConfig() + + bsdsocket.library/bind bsdsocket.library/bind + + NAME + bind - bind a name to a socket + + SYNOPSIS + #include + #include + + success = bind(s, name, namelen) + D0 D0 A0 D1 + + long bind(long s, struct sockaddr *name, long namelen); + + FUNCTION + bind() assigns a name to an unnamed socket. When a socket is created + with socket() it exists in a name space (address family) but has no + name assigned. bind() requests that name be assigned to the socket. + + RESULT + If the bind is successful, a 0 value is returned. A return value of + -1 indicates an error, which is further specified in the global + errno. + + ERRORS + The bind() call will fail if: + + [EBADF] + S is not a valid descriptor. + + [ENOTSOCK] + S is not a socket. + + [EADDRNOTAVAIL] + The specified address is not available from the local machine. + + [EADDRINUSE] + The specified address is already in use. + + [EINVAL] + The socket is already bound to an address. + + [EACCES] + The requested address is protected, and the current user has + inadequate permission to access it. + + [EFAULT] + The name parameter is not in a valid part of the user address + space. + + SEE ALSO + connect(), listen(), socket(), getsockname() + + bsdsocket.library/bpf_close bsdsocket.library/bpf_close + + NAME + bpf_close - close a packet filter channel + + SYNOPSIS + success = bpf_close(handle) + D0 D0 + + long bpf_close(long handle); + + FUNCTION + The bpf_close() call will close a packet filter channel previously + allocated with bpf_open(). + + INPUTS + handle -- Handle number returned by previous call to bpf_open(). + + RESULT + A 0 is returned if the call succeeds, -1 if it fails. + + NOTES + The bpf_close() call is an extension to the AmiTCP V4 API and cannot + be assumed to be present in all versions of "bsdsocket.library". To + find out whether your library version supports it, you must query the + number of filter channels supported by it using SocketBaseTagList() + with the SBTC_NUM_PACKET_FILTER_CHANNELS tag. + + ERRORS + The call succeeds unless: + + [ENXIO] + The channel handle does not refer to a valid packet + filter channel. + + [EPERM] + You are not the owner of this channel. + + SEE ALSO + bpf_open(), bpf_read(), bpf_write(), bpf_set_notify_mask(), + bpf_set_interrupt_mask(), bpf_ioctl(), bpf_data_waiting() + + bsdsocket.library/bpf_data_waiting bsdsocket.library/bpf_data_waiting + + NAME + bpf_data_waiting - query whether there is data waiting to be read + with bpf_read() + + SYNOPSIS + waiting = bpf_data_waiting(handle) + D0 D0 + + long bpf_data_waiting(long handle); + + FUNCTION + The bpf_data_waiting() call allows you to query whether there + is currently data waiting to be read via bpf_read(). + + INPUTS + handle -- Handle number returned by previous call to bpf_open(). + + RESULT + A return value of 0 indicates that there is no data waiting to + be read, a 1 that there is data waiting. A value of -1 indicates + an error. + + NOTES + The bpf_data_waiting() call is an extension to the AmiTCP V4 + API and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, you must query the number of filter channels supported + by it using SocketBaseTagList() with the + SBTC_NUM_PACKET_FILTER_CHANNELS tag. + + ERRORS + The call succeeds unless: + + [ENXIO] + The channel handle does not refer to a valid packet + filter channel. + + [EPERM] + You are not the owner of this channel. + + SEE ALSO + bpf_open(), bpf_close(), bpf_read(), bpf_write(), + bpf_set_notify_mask(), bpf_set_interrupt_mask(), bpf_ioctl() + + bsdsocket.library/bpf_ioctl bsdsocket.library/bpf_ioctl + + NAME + bpf_ioctl - control packet filter parameters + + SYNOPSIS + #include + #include + #include + #include + #include + + success = bpf_ioctl(handle, request, argp) + D0 D0 D1 A0 + + long bpf_ioctl(long handle, unsigned long request, char *argp); + + FUNCTION + The bpf_ioctl() function manipulates the underlying device + parameters of the packet filter. + + An ioctl request has encoded in it whether the argument is an ``in'' + parameter or ``out'' parameter, and the size of the argument argp in + bytes. Macros and defines used in specifying an ioctl request are + located in the file . + + The following request types are supported: + + FIONREAD + The argument must be (long *). The variable pointed to will be set + to 0 if there is no data waiting to be read, otherwise it will + contain the number of bytes waiting. + + SIOCGIFADDR + The argument must be (struct sockaddr_in *). It will be filled + with the address of the interface associated with this channel. + + BIOCGBLEN + The argument must be (long *). The size of the buffer, as to be + passed to bpf_read(), will be returned. + + BIOCSBLEN + The argument must be (long *). Sets the buffer length for reads + on bpf files. The buffer must be set before the file is attached + to an interface with BIOCSETIF. If the requested buffer size + cannot be accomodated, the closest allowable size will be set and + returned in the argument. A read call will result in EIO if it is + passed a buffer that is not this size. + + BIOCSETF + The argument must be (struct bpf_program *). Sets the filter + program used by the kernel to discard uninteresting packets. An + array of instructions and its length is passed in using the + following structure: + + struct bpf_program { + int bf_len; + struct bpf_insn *bf_insns; + }; + + The filter program is pointed to by the bf_insns field while its + length in units of `struct bpf_insn' is given by the bf_len + field. Also, the actions of BIOCFLUSH are performed. + + See the section FILTER MACHINE for an explanation of the filter + language. + + BIOCFLUSH + Flushes the buffer of incoming packets, and resets the statistics + that are returned by BIOCGSTATS. + + BIOCGDLT + The argument must be (long *). The link layer type is returned, + which can be either DLT_EN10MB, DLT_NULL or DLT_SLIP. DLT_EN10MB + stands for Ethernet link layer encapsulation, DLT_SLIP and DLT_NULL + stand for no link layer encapsulation. + + BIOCGETIF + The argument must be (struct ifreq *). Returns the name of the + hardware interface that the file is listening on. The name is + returned in the if_name field of ifr. All other fields are + undefined. + + BIOCSETIF + The argument must be (struct ifreq *). Sets the hardware + interface associate with the file. This command must be performed + before any packets can be read. The device is indicated by name + using the if_name field of the ifreq. Additionally, performs the + actions of BIOCFLUSH. + + BIOCSRTIMEOUT + The argument must be (struct timeval *). Set the timeout for + the bpf_read() command. + + BIOCGRTIMEOUT + The argument must be (struct timeval *). Returns the timeout + used by the bpf_read() command. + + BIOCGSTATS + The argument must be (struct bpf_stat *). Returns the following + structure of packet statistics: + + struct bpf_stat { + u_int bs_recv; + u_int bs_drop; + }; + + The fields are: + + bs_recv + The number of packets received by the descriptor since + opened or reset (including any buffered since the last + read call). + + bs_drop + The number of packets which were accepted by the filter + but dropped by the kernel because of buffer overflows + (i.e., the application's reads aren't keeping up with the + packet traffic). + + BIOCIMMEDIATE + The argument must be (long *). Enable or disable ``immediate + mode'', based on the truth value of the argument. When immediate + mode is enabled, reads return immediately upon packet reception. + Otherwise, a read will block until either the kernel buffer + becomes full or a timeout occurs. This is useful for programs + like rarpd, which must respond to messages in real time. The + default for a new file is off. + + BIOCVERSION + The argument must be (struct bpf_version *). Returns the major + and minor version numbers of the filter languange currently + recognized by the kernel. Before installing a filter, + applications must check that the current version is compatible + with the running kernel. Version numbers are compatible if the + major numbers match and the application minor is less than or + equal to the kernel minor. The kernel version number is returned + in the following structure: + + struct bpf_version { + u_short bv_major; + u_short bv_minor; + }; + + The current version numbers are given by BPF_MAJOR_VERSION and + BPF_MINOR_VERSION from . An incompatible filter may + result in undefined behavior (most likely, an error returned by + bpf_ioctl() or haphazard packet matching). + + RESULT + A 0 is returned if the call succeeds, -1 if it fails. + + NOTES + The bpf_ioctl() call is an extension to the AmiTCP V4 + API and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, you must query the number of filter channels supported + by it using SocketBaseTagList() with the + SBTC_NUM_PACKET_FILTER_CHANNELS tag. + + ERRORS + bpf_ioctl() will fail if: + + [ENXIO] + The channel handle does not refer to a valid packet + filter channel. + + [EPERM] + You are not the owner of this channel. + + [EINVAL] + Request or argp is not valid, the filter is not attached + to an interface, or the buffer size is too large. + + FILTER MACHINE + A filter program is an array of instructions, with all branches + forwardly directed, terminated by a return instruction. Each + instruction performs some action on the pseudo-machine state, which + consists of an accumulator, index register, scratch memory store, and + implicit program counter. + + The following structure defines the instruction format: + + struct bpf_insn { + u_short code; + u_char jt; + u_char jf; + long k; + }; + + The k field is used in differnet ways by different insutructions, and + the jt and jf fields are used as offsets by the branch intructions. + The opcodes are encoded in a semi-hierarchical fashion. There are + eight classes of intructions: BPF_LD, BPF_LDX, BPF_ST, BPF_STX, + BPF_ALU, BPF_JMP, BPF_RET, and BPF_MISC. Various other mode and + operator bits are or'd into the class to give the actual + instructions. The classes and modes are defined in . + + Below are the semantics for each defined BPF instruction. We use the + convention that A is the accumulator, X is the index register, P[] + packet data, and M[] scratch memory store. P[i:n] gives the data at + byte offset ``i'' in the packet, interpreted as a word (n=4), + unsigned halfword (n=2), or unsigned byte (n=1). M[i] gives the i'th + word in the scratch memory store, which is only addressed in word + units. The memory store is indexed from 0 to BPF_MEMWORDS-1. k, jt, + and jf are the corresponding fields in the instruction definition. + ``len'' refers to the length of the packet. + + BPF_LD + These instructions copy a value into the accumulator. The type of + the source operand is specified by an ``addressing mode'' and can + be a constant (BPF_IMM), packet data at a fixed offset (BPF_ABS), + packet data at a variable offset (BPF_IND), the packet length + (BPF_LEN), or a word in the scratch memory store (BPF_MEM). For + BPF_IND and BPF_ABS, the data size must be specified as a word + (BPF_W), halfword (BPF_H), or byte (BPF_B). The semantics of all + the recognized BPF_LD instructions follow. + + BPF_LD+BPF_W+BPF_ABS A <- P[k:4] + BPF_LD+BPF_H+BPF_ABS A <- P[k:2] + BPF_LD+BPF_B+BPF_ABS A <- P[k:1] + BPF_LD+BPF_W+BPF_IND A <- P[X+k:4] + BPF_LD+BPF_H+BPF_IND A <- P[X+k:2] + BPF_LD+BPF_B+BPF_IND A <- P[X+k:1] + BPF_LD+BPF_W+BPF_LEN A <- len + BPF_LD+BPF_IMM A <- k + BPF_LD+BPF_MEM A <- M[k] + + BPF_LDX + These instructions load a value into the index register. Note + that the addressing modes are more retricted than those of the + accumulator loads, but they include BPF_MSH, a hack for + efficiently loading the IP header length. + + BPF_LDX+BPF_W+BPF_IMM X <- k + BPF_LDX+BPF_W+BPF_MEM X <- M[k] + BPF_LDX+BPF_W+BPF_LEN X <- len + BPF_LDX+BPF_B+BPF_MSH X <- 4*(P[k:1]&0xf) + + BPF_ST + This instruction stores the accumulator into the + scratch memory. We do not need an addressing + mode since there is only one possibility for the + destination. + + BPF_ST M[k] <- A + + BPF_STX + This instruction stores the index register in the scratch memory + store. + + BPF_STX M[k] <- X + + BPF_ALU + The alu instructions perform operations between the accumulator + and index register or constant, and store the result back in the + accumulator. For binary operations, a source mode is required + (BPF_K or BPF_X). + + BPF_ALU+BPF_ADD+BPF_K A <- A + k + BPF_ALU+BPF_SUB+BPF_K A <- A - k + BPF_ALU+BPF_MUL+BPF_K A <- A * k + BPF_ALU+BPF_DIV+BPF_K A <- A / k + BPF_ALU+BPF_AND+BPF_K A <- A & k + BPF_ALU+BPF_OR+BPF_K A <- A | k + BPF_ALU+BPF_LSH+BPF_K A <- A << k + BPF_ALU+BPF_RSH+BPF_K A <- A >> k + BPF_ALU+BPF_ADD+BPF_X A <- A + X + BPF_ALU+BPF_SUB+BPF_X A <- A - X + BPF_ALU+BPF_MUL+BPF_X A <- A * X + BPF_ALU+BPF_DIV+BPF_X A <- A / X + BPF_ALU+BPF_AND+BPF_X A <- A & X + BPF_ALU+BPF_OR+BPF_X A <- A | X + BPF_ALU+BPF_LSH+BPF_X A <- A << X + BPF_ALU+BPF_RSH+BPF_X A <- A >> X + BPF_ALU+BPF_NEG A <- -A + + BPF_JMP + The jump instructions alter flow of control. Conditional jumps + compare the accumulator against a constant (BPF_K) or the index + register (BPF_X). If the result is true (or non-zero), the true + branch is taken, otherwise the false branch is taken. Jump + offsets are encoded in 8 bits so the longest jump is 256 + instructions. However, the jump always (BPF_JA) opcode uses the + 32 bit k field as the offset, allowing arbi- trarily distant + destinations. All conditionals use unsigned comparison + conventions. + + BPF_JMP+BPF_JA pc += k + BPF_JMP+BPF_JGT+BPF_K pc += (A > k) ? jt : jf + BPF_JMP+BPF_JGE+BPF_K pc += (A >= k) ? jt : jf + BPF_JMP+BPF_JEQ+BPF_K pc += (A == k) ? jt : jf + BPF_JMP+BPF_JSET+BPF_K pc += (A & k) ? jt : jf + BPF_JMP+BPF_JGT+BPF_X pc += (A > X) ? jt : jf + BPF_JMP+BPF_JGE+BPF_X pc += (A >= X) ? jt : jf + BPF_JMP+BPF_JEQ+BPF_X pc += (A == X) ? jt : jf + BPF_JMP+BPF_JSET+BPF_X pc += (A & X) ? jt : jf + + BPF_RET + The return instructions terminate the filter program and specify + the amount of packet to accept (i.e., they return the truncation + amount). A return value of zero indicates that the packet should + be ignored. The return value is either a constant (BPF_K) or the + accumulator (BPF_A). + + BPF_RET+BPF_A accept A bytes + BPF_RET+BPF_K accept k bytes + + BPF_MISC + The miscellaneous category was created for anything that doesn't + fit into the above classes, and for any new instructions that + might need to be added. Currently, these are the register + transfer intructions that copy the index register to the + accumulator or vice versa. + + BPF_MISC+BPF_TAX X <- A + BPF_MISC+BPF_TXA A <- X + + The BPF interface provides the following macros to facilitate + array initializers: + + BPF_STMT(opcode, operand) + + and + + BPF_JUMP(opcode, operand, true_offset, false_offset) + + EXAMPLES + The following filter is taken from the Reverse ARP Daemon. It accepts + only Reverse ARP requests. + + struct bpf_insn insns[] = { + BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 12), + BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ETHERTYPE_REVARP, 0, 3), + BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 20), + BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, REVARP_REQUEST, 0, 1), + BPF_STMT(BPF_RET+BPF_K, sizeof(struct ether_arp) + + sizeof(struct ether_header)), + BPF_STMT(BPF_RET+BPF_K, 0), + }; + + This filter accepts only IP packets between host 128.3.112.15 and + 128.3.112.35. + + struct bpf_insn insns[] = { + BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 12), + BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ETHERTYPE_IP, 0, 8), + BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 26), + BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x8003700f, 0, 2), + BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 30), + BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x80037023, 3, 4), + BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x80037023, 0, 3), + BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 30), + BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x8003700f, 0, 1), + BPF_STMT(BPF_RET+BPF_K, (u_int)-1), + BPF_STMT(BPF_RET+BPF_K, 0), + }; + + Finally, this filter returns only TCP finger packets. We must parse + the IP header to reach the TCP header. The BPF_JSET instruction + checks that the IP fragment offset is 0 so we are sure that we have a + TCP header. + + struct bpf_insn insns[] = { + BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 12), + BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ETHERTYPE_IP, 0, 10), + BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 23), + BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, IPPROTO_TCP, 0, 8), + BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 20), + BPF_JUMP(BPF_JMP+BPF_JSET+BPF_K, 0x1fff, 6, 0), + BPF_STMT(BPF_LDX+BPF_B+BPF_MSH, 14), + BPF_STMT(BPF_LD+BPF_H+BPF_IND, 14), + BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 79, 2, 0), + BPF_STMT(BPF_LD+BPF_H+BPF_IND, 16), + BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 79, 0, 1), + BPF_STMT(BPF_RET+BPF_K, (u_int)-1), + BPF_STMT(BPF_RET+BPF_K, 0), + }; + + bsdsocket.library/bpf_open bsdsocket.library/bpf_open + + NAME + bpf_open - open a packet filter channel + + SYNOPSIS + handle = bpf_open(channel) + D0 D0 + + long bpf_open(long channel); + + FUNCTION + The bpf_open() call will attempt to allocate a packet filter which + can later be attached to an interface. How many channels are + available and whether this "bsdsocket.library" version supports the + packet filter mechanism in the first place can be queried using the + SocketBaseTagList() function with the SBTC_NUM_PACKET_FILTER_CHANNELS + tag. + + The Berkeley Packet Filter provides a raw interface to data link + layers in a protocol independent fashion. All packets on the network, + even those destined for other hosts, are accessible through this + mechanism. + + After opening the device, the file descriptor must be bound to a + specific network interface with the BIOSETIF ioctl. A given interface + can be shared be multiple listeners, and the filter underlying each + descriptor will see an identical packet stream. + + A separate device file is required for each channel. If a file is in + use, the open will fail and errno will be set to EBUSY. + + Associated with each open instance of a bpf file is a user-settable + packet filter. Whenever a packet is received by an interface, all + file descriptors listening on that interface apply their filter. Each + descriptor that accepts the packet receives its own copy. + + Reads from these files return the next group of packets that have + matched the filter. To improve performance, the buffer passed to read + must be the same size as the buffers used internally by bpf. This + size is returned by the BIOCGBLEN bpf_ioctl(), and under + BSD, can be set with BIOCSBLEN. Note that an individual packet larger + than this size is necessarily truncated. + + The packet filter will support any link level protocol that has fixed + length headers. Currently, only Ethernet, SLIP and PPP drivers have + been modified to interact with bpf. + + Since packet data is in network byte order, applications should use + the byteorder macros to extract multi-byte values. + + A packet can be sent out on the network by writing to a bpf file + descriptor. The writes are unbuffered, meaning only one packet can be + processed per write. Currently, only writes to Ethernets and SLIP + links are supported. + + INPUTS + channel -- Index number of the channel to allocate, or -1 to allocate + the next available channel. If a channel number is requested, + it must be a non-negative integer that is smaller than the + maximum number of channels this "bsdsocket.library" version + supports. + + RESULT + A channel handle > 0 is returned if the call succeeds, -1 if it fails. + + NOTES + The bpf_open() call is an extension to the AmiTCP V4 API and cannot + be assumed to be present in all versions of "bsdsocket.library". To + find out whether your library version supports it, you must query the + number of filter channels supported by it using SocketBaseTagList() + with the SBTC_NUM_PACKET_FILTER_CHANNELS tag. + + The packet filter channel you allocate will be associated with the + library base. When no longer needed, it should be released with the + bpf_close() call. It will be automatically closed when the library is + closed. + + ERRORS + The call succeeds unless: + + [ENXIO] + The channel index number does not refer to a valid packet + filter channel. + + [EBUSY] + This channel is already in use; try a different number. + + SEE ALSO + bpf_close(), bpf_read(), bpf_write(), bpf_set_notify_mask(), + bpf_set_interrupt_mask(), bpf_ioctl(), bpf_data_waiting() + + bsdsocket.library/bpf_read bsdsocket.library/bpf_read + + NAME + bpf_read - read data from a packet filter channel + + SYNOPSIS + nbytes = bpf_read(handle, buffer, len) + D0 D0 A0 D1 + + long bpf_read(long handle,void *buffer,long len); + + FUNCTION + The bpf_read() call will attempt to read packet data from a filter + channel. If there is no data currently available for reading, this + function will block until sufficient data has arrived, the read was + interrupted or a timeout has elapsed. The duration of the timeout can + be changed using the bpf_ioctl() function and the BIOCSRTIMEOUT + command. + + INPUTS + handle -- Handle number returned by previous call to bpf_open(). + + buffer -- Points to the memory where the data will be copied to. + + len -- Number of bytes to read; this must be exactly the same + number the packet filter uses for buffering. This number can + be set and read with the bpf_ioctl() function and the + BIOCGBLEN/BIOCSBLEN commands. + + RESULT + The number of bytes read is returned if the call succeeds, + -1 if it fails. + + BPF HEADER + The following structure is prepended to each packet + returned by bpf_read(): + + struct bpf_hdr { + struct timeval bh_tstamp; + u_long bh_caplen; + u_long bh_datalen; + u_short bh_hdrlen; + }; + + The fields, whose values are stored in host order, and are: + + bh_tstamp + The time at which the packet was processed by the packet + filter. + + bh_caplen + The length of the captured portion of the packet. This is the + minimum of the truncation amount specified by the filter and + the length of the packet. + + bh_datalen + The length of the packet off the wire. This value is + independent of the truncation amount specified by the filter. + + bh_hdrlen + The length of the BPF header, which may not be equal to + sizeof(struct bpf_hdr). + + The bh_hdrlen field exists to account for padding between the + header and the link level protocol. The purpose here is to + guarantee proper alignment of the packet data structures, which + is required on alignment sensitive architectures and and improves + performance on many other architectures. The packet filter + insures that the bpf_hdr and the network layer header will be + word aligned. Suitable precautions must be taken when accessing + the link layer protocol fields on alignment restricted machines. + (This isn't a problem on an Ethernet, since the type field is a + short falling on an even offset, and the addresses are probably + accessed in a bytewise fashion). + + Additionally, individual packets are padded so that each starts + on a word boundary. This requires that an application has some + knowledge of how to get from packet to packet. The macro + BPF_WORDALIGN is defined in to facilitate this + process. It rounds up its argument to the nearest word aligned + value (where a word is BPF_ALIGNMENT bytes wide). + + For example, if `p' points to the start of a packet, this + expression will advance it to the next packet: + + p = (char *)p + BPF_WORDALIGN(p->bh_hdrlen + p->bh_caplen) + + For the alignment mechanisms to work properly, the buffer passed + to bpf_read() must itself be word aligned. AllocMem() and + AllocVec() will always return an aligned buffer. + + NOTES + The bpf_read() call is an extension to the AmiTCP V4 API and cannot + be assumed to be present in all versions of "bsdsocket.library". To + find out whether your library version supports it, you must query the + number of filter channels supported by it using SocketBaseTagList() + with the SBTC_NUM_PACKET_FILTER_CHANNELS tag. + + ERRORS + The call succeeds unless: + + [ENXIO] + The channel handle does not refer to a valid packet + filter channel. + + [EPERM] + You are not the owner of this channel. + + [EINVAL] + The number of bytes to read does not exactly match the + filter's buffer size. + + [EINTR] + An interrupt signal was received while the read command was + still waiting for new data to arrive. + + SEE ALSO + bpf_open(), bpf_close(), bpf_write(), bpf_set_notify_mask(), + bpf_set_interrupt_mask(), bpf_ioctl(), bpf_data_waiting() + + bsdsocket.library/bpf_set_interrupt_masksocket.library/bpf_set_interrupt_mask + + NAME + bpf_set_interrupt_mask - choose which signals will cause the + bpf_read() call to be interrupted + + SYNOPSIS + success = bpf_set_interrupt_mask(handle, mask) + D0 D0 D1 + + long bpf_set_interrupt_mask(long handle, unsigned long mask); + + FUNCTION + The bpf_set_interrupt_mask() call allows you to choose which signals + will cause the bpf_read() call to be interrupted when received. By + default, bpf_open() resets this signal mask to 0, which means that no + signal will interrupt bpf_read(). + + INPUTS + handle -- Handle number returned by previous call to bpf_open(). + + mask -- The signal mask to hand to exec.library/Wait(); a value + of 0 disables this mechanism. + + RESULT + A 0 return value indicates success; -1 indicates an error. + + NOTES + The bpf_set_interrupt_mask() call is an extension to the AmiTCP V4 + API and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, you must query the number of filter channels supported + by it using SocketBaseTagList() with the + SBTC_NUM_PACKET_FILTER_CHANNELS tag. + + ERRORS + The call succeeds unless: + + [ENXIO] + The channel handle does not refer to a valid packet + filter channel. + + [EPERM] + You are not the owner of this channel. + + SEE ALSO + bpf_open(), bpf_close(), bpf_read(), bpf_write(), + bpf_set_notify_mask(), bpf_ioctl(), bpf_data_waiting(), + exec.library/Signal, exec.library/Wait + + bsdsocket.library/bpf_set_notify_mask bsdsocket.library/bpf_set_notify_mask + + NAME + bpf_set_notify_mask - choose the signals to send when new packet + data is available for reading + + SYNOPSIS + success = bpf_set_notify_mask(handle, mask) + D0 D0 D1 + + long bpf_set_notify_mask(long handle, unsigned long mask); + + FUNCTION + The bpf_set_notify_mask() call allows you to choose whether you want + to receive a notification signal whenever there is new packet data to + be read with bpf_read() becomes available. By default, bpf_open() + resets this signal to 0, which means that no notification signal will + be sent. + + INPUTS + handle -- Handle number returned by previous call to bpf_open(). + + mask -- The signal mask to hand to exec.library/Signal(); a value + of 0 disables the notification. + + RESULT + A 0 return value indicates success; -1 indicates an error. + + NOTES + The bpf_set_notify_mask() call is an extension to the AmiTCP V4 API + and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, you must query the number of filter channels supported + by it using SocketBaseTagList() with the + SBTC_NUM_PACKET_FILTER_CHANNELS tag. + + ERRORS + The call succeeds unless: + + [ENXIO] + The channel handle does not refer to a valid packet + filter channel. + + [EPERM] + You are not the owner of this channel. + + SEE ALSO + bpf_open(), bpf_close(), bpf_read(), bpf_write(), + bpf_set_interrupt_mask(), bpf_ioctl(), bpf_data_waiting(), + exec.library/Signal + + bsdsocket.library/bpf_write bsdsocket.library/bpf_write + + NAME + bpf_write - write data to an interface associated with a + packet filter channel + + SYNOPSIS + nbytes = bpf_write(handle, buffer, len) + D0 D0 A0 D1 + + long bpf_write(long handle,void *buffer,long len); + + FUNCTION + The bpf_write() call will write data to the interface attached to + this channel. You have to provide a complete link level frame, which + for an Ethernet interface includes the Ethernet header. The data you + provide will be committed to the wire exactly as you write it. + + INPUTS + handle -- Handle number returned by previous call to bpf_open(). + + buffer -- Points to the memory to copy the data from. + + len -- Number of bytes to write. + + RESULT + The number of bytes written is returned if the call succeeds, + -1 if it fails. + + NOTES + The bpf_write() call is an extension to the AmiTCP V4 API and cannot + be assumed to be present in all versions of "bsdsocket.library". To + find out whether your library version supports it, you must query the + number of filter channels supported by it using SocketBaseTagList() + with the SBTC_NUM_PACKET_FILTER_CHANNELS tag. + + ERRORS + The call succeeds unless: + + [ENXIO] + The channel handle does not refer to a valid packet + filter channel, or the channel is not attached to an + interface. + + [EIO] + The packet does not fit into a single memory chunk. + + [ENOBUFS] + Not enough memory for the packet to be sent. + + [EPERM] + You are not the owner of this channel. + + [EMSGSIZE] + The number of bytes to be written exceeds the interface's + maximum transfer unit. + + SEE ALSO + bpf_open(), bpf_close(), bpf_read(), bpf_set_notify_mask(), + bpf_set_interrupt_mask(), bpf_ioctl(), bpf_data_waiting() + + bsdsocket.library/ChangeRoadshowData bsdsocket.library/ChangeRoadshowData + + NAME + ChangeRoadshowData - Change internal Roadshow configuration data + + SYNOPSIS + success = ChangeRoadshowData(list,name,length,data) + D0 A0 A1 D0 A2 + + BOOL ChangeRoadshowData(struct List *list,STRPTR name, + ULONG length,APTR data); + + FUNCTION + Several internal options control how the TCP/IP stack works. + These do not normally need to be changed, but there are times + when you might want to override or check them. + + ChangeRoadshowData() will change a configuration data item. + + INPUTS + list -- The pointer you received from ObtainRoadshowData() + + name -- Pointer to a NUL-terminated string which gives the + name of the option to change. Option names are not + case-sensitive. + + length -- Number of bytes in the option data to change the + current settings to. + + data -- Pointer to the option data to change the current + settings to. + + RESULT + success -- TRUE if the option could be changed, FALSE otherwise. + + ERRORS + The ChangeRoadshowData() call fails if: + + [EINVAL] + The list parameter you supplied is invalid. + + [EACCES] + You did not call ObtainRoadshowData() with the ORD_WriteAccess + parameter. + + [ENOENT] + The option you wanted to change is not known by the + name you gave. + + [ENOSPC] + The size of the option data you specified is not supported, + e.g. the wrong size or there is not enough space available + to store it. + + [EPERM] + You tried to modify a read-only option. + + OPTIONS + Here is a brief list of options that may be supported by your + Roadshow installation. + + bpf.bufsize + The size of the Berkeley Packet Filter buffer. + + icmp.maskrepl + Controls if the ICMP layer responds to mask requests. + This can be 1 (accept) or 0 (ignore). + + icmp.processecho + Controls if the ICMP layer responds to echo requests. + This can be 0 (accept), 1 (ignore) or 2 (drop). + + icmp.procesststamp + Controls if the ICMP layer responds to time stamp requests. + This can be 0 (accept), 1 (ignore) or 2 (drop). + + if.receive.useclusters + Data received from a network interface is normally stored + in a chunk of memory of 2048 bytes in size, which is called + a cluster. This use of memory can be wasteful, but choosing + to use less memory may slightly impair performance because + the inbound data will need to be copied again. + This option can be 1 (use clusters; this is the default) + or 0 to use less memory at the expense of performance. + + if.minclustersize + Whether data received or to be transmitted is stored in + a single 2048 byte chunk of data or in smaller portions is + controlled by this threshold value. Smaller threshold values + will cause more memory to be used, larger threshold values + may use less memory at the expense of slight performance + impairment. The default value is 208 bytes. + + ip.defttl + Controls the default time-to-live value of IP packets + generated. + + ip.forwarding + Controls if IP packets may be forwarded or not. + This can be 1 (forward) or 0 (drop). + + ip.sendredirects + Controls if ICMP redirect messages may be generated. + This can be 1 (yes) or 0 (no). + + ip.subnetsarelocal + Controls if the Internet addresses of directly + connected hosts should be considered local, or if + this also applies to hosts on the same subnet. + This can be 1 (subnets are local) or 0 (they are not). + + task.controller.priority + Selects the priority at which the network I/O + controller Task runs. The priority can affect overall + network performance. + + tcp.do_rfc1323 + Controls whether or not the TCP extensions for high + performance (RFC1323) should be enabled or not. + Specifically, this covers round trip time measurement + and the TCP window scale option. + This can be 1 (enable) or 0 (disable). + + tcp.do_timestamps + Controls whether or not the round trip time measurement + feature should be enabled if the tcp.do_rfc1323 option + is enabled. + This can be 1 (enable) or 0 (disable). + + tcp.do_win_scale + Controls whether or not the TCP window scale option + should be enabled if the tcp.do_rfc1323 option + is enabled. + This can be 1 (enable) or 0 (disable). + + tcp.mssdflt + Controls the default TCP maximum segment size value. + + tcp.recvspace + Controls the size of the default TCP receive buffer. + + tcp.rttdflt + Controls the default TCP retransmit time value. + + tcp.sendspace + Controls the size of the default TCP transmit buffer. + + tcp.use_mssdflt_for_remote + Controls if the TCP protocol should use a smaller + maximum segment size value for packets sent to + hosts which are not in the local network. + This can be 1 (yes) or 0 (no). + + udp.cksum + Controls if checksums should be calculated over + UDP datagrams to be sent and verified for UDP + datagrams received. + This can be 1 (yes) or 0 (no). + + udp.recvspace + Controls the size of the default UDP receive buffer. + + udp.sendspace + Controls the size of the default UDP transmit buffer. + + NOTES + The ChangeRoadshowData() call is an extension to the AmiTCP V4 + API and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_ROADSHOWDATA_API tag with the + SocketBaseTagList() function. + + SEE ALSO + ObtainRoadshowData(), ChangeRoadshowData() + + bsdsocket.library/CloseSocket bsdsocket.library/CloseSocket + + NAME + CloseSocket - delete a socket descriptor + + SYNOPSIS + success = CloseSocket(s) + D0 D0 + + long CloseSocket(long s); + + FUNCTION + The CloseSocket() call deletes a descriptor from the per-library + object reference table. If this is the last reference to the + underlying object, the object will be deactivated. For example, on + the last close of a socket() associated naming information and queued + data are discarded. + + When a library base is closed, all associated socket descriptors are + freed, but since there is a limit on active descriptors per library + base, the CloseSocket() function call is useful when a large quantity + of file descriptors are being handled. + + RESULT + Upon successful completion, a value of 0 is returned. Otherwise, a + value of -1 is returned and the global integer variable errno is set + to indicate the error. + + ERRORS + CloseSocket() will fail if: + + [EBADF] + s is not an active socket descriptor. + + [EINTR] + An interrupt was received. + + SEE ALSO + accept(), socket(), IoctlSocket() + + bsdsocket.library/ConfigureInterfaceTagList.library/ConfigureInterfaceTagList + + NAME + ConfigureInterfaceTagList - Configure an interface + + SYNOPSIS + success = ConfigureInterfaceTagList(name,tags) + D0 A0 A1 + + long ConfigureInterfaceTagList(STRPTR name,struct TagItem *tags); + + long ConfigureInterfaceTags(STRPTR name,...); + + FUNCTION + This function is for changing the configuration of an interface + previously added with AddInterfaceTagList(), such as setting + interface addresses, status and routing metrics. + + INPUTS + name -- Name of the interface to query/configure. This name cannot + be longer than 15 characters. + + tags -- Pointer to a 'struct TagItem' list. + + TAGS + IFC_Address (STRPTR) - Address to assign to this interface; + this must be a NUL-terminated string which can hold a + host name to be resolved or an IP address in dotted-decimal + notation (per RFC1700). + + IFC_NetMask (STRPTR) - Network mask to assign to this + interface; this must be a NUL-terminated string. + + IFC_DestinationAddress (STRPTR) - Address of the other end + of a point-to-point link. This must be a NUL-terminated + string which can hold a host name to be resolved or + an IP address in dotted-decimal notation (per RFC1700). + This tag requires the IFC_Address tag to be present and + only works for point-to-point interfaces. + + IFC_BroadcastAddress (STRPTR) - Broadcast address this + interface should use; this only works for interfaces + which support broadcasts in the first place, such as + Ethernet hardware. This must be specified as NUL-terminated + string in dotted-decimal notation (per RFC1700). + + IFC_Metric (LONG) - The routing metric of this interface, + as used by the routing protocol. + + IFC_AddAliasAddress (STRPTR) - Additional address to associate + this interface with. This must be a NUL-terminated string + which can hold a host name to be resolved or an IP address + in dotted-decimal notation (per RFC1700). + + This tag and the IFC_DeleteAliasAddress tag are mutually + exclusive. + + IFC_DeleteAliasAddress (STRPTR) - An alias address to remove + from this interface. This must be a NUL-terminated string + which can hold a host name to be resolved or an IP address + in dotted-decimal notation (per RFC1700). + + This tag and the IFC_AddAliasAddress tag are mutually + exclusive. + + IFC_State (LONG) - State this interface should be set to. This + must be one of the following options: + + SM_Down + The stack will no longer attempt to transmit messags + through this interface. However, the underlying SANA-II + device driver may still be connected to the network. + + SM_Up + The stack will attempt to transmit messages through + this interface. However, the underlying SANA-II device + driver may not be connected to the network yet. + + SM_Offline + Same as 'SM_Down', but also sends an 'S2_OFFLINE' + command to the underlying SANA-II device first. + + SM_Online + Same as 'SM_Up', but tries to send an 'S2_ONLINE' + command to the underlying SANA-II device first; if + the command succeeds, the other necessary configuration + operations will take place. If it fails, then this + function will return with an error code set and + no further configuration will have been done. + + IFC_GetPeerAddress (BOOL) - Try to obtain the interface's local + and its point to point partner's address. This only works + for devices implementing point to point protocols like + SLIP or PPP. The addresses will be copied to the interface's + default address (overriding the IFC_Address tag) and the + interface's destination address (overriding the + IFC_DestinationAddress tag). The interface's net mask will + be configured according to the default address. + + IFC_GetDNS (BOOL) - Try to obtain the primary and secondary + domain name server addresses, if these are known to the + interface. This only works for devices implementing PPP. + The addresses will be stored for future reference, if + successful. + + IFC_AssociatedRoute (BOOL) - Tag this interface as having a + route attached which should be removed should the interface + go down or offline. + + IFC_AssociatedDNS (BOOL) - Tag this interface as making domain + name servers available which should be removed should the + interface go down or offline. + + IFC_ReleaseAddress (BOOL) - If this interface's address was + dynamically bound (via DHCP or BOOTP), it will be released + and the interface will be taken out of service. + + IFC_SetDebugMode (BOOL) - Enable or disable debugging mode for + this interface. + + IFC_Complete (BOOL) -- Indicate that the configuration for this + interface is now complete. This has the effect of causing + the default route configuration file to be read and + processed for the first time. + + IFC_LimitMTU (ULONG) - You can limit the size of the maximum + transmission unit (MTU) configured for this interface. Normally, + this value is predefined by the hardware driver, but you can + request that a smaller size is used. This can help if, in order + to route packets properly, an artificial limit is imposed on + the maximum packet size. By default the MTU value provided by + the hardware driver is used. Before the maximum transmission + unit size is limited, the hardware MTU settings will be reread + and taken into account. + + RESULT + success -- 0 for success, -1 for failure; the failure code will + be stored in the 'errno' variable. + + NOTES + The ConfigureInterfaceTagList() call is an extension to the + AmiTCP V4 API and cannot be assumed to be present in all versions + of "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_INTERFACE_API tag with the + SocketBaseTagList() function. + + This function is intended to be a simplified, specialized front end + to the underlying interface socket API. If you want more than this + function can do for you, use the interface socket API. + + The IFC_GetPeerAddress and IFC_GetDNS tags require that the + underlying device driver supports the SANA-IIR4 extensions, which + at this time of writing not many drivers do. Take care. + + SEE ALSO + AddInterfaceTagList(), QueryInterfaceTagList() + + bsdsocket.library/connect bsdsocket.library/connect + + NAME + connect - initiate a connection on a socket + + SYNOPSIS + #include + #include + + success = connect(s, name, namelen) + D0 D0 A0 D1 + + long connect(long s, struct sockaddr *name, long namelen); + + FUNCTION + The parameter s is a socket. If it is of type SOCK_DGRAM, this call + specifies the peer with which the socket is to be associated; this + address is that to which datagrams are to be sent, and the only + address from which datagrams are to be received. If the socket is of + type SOCK_STREAM, this call attempts to make a connection to another + socket. The other socket is specified by name, which is an address in + the communications space of the socket. Each communications space + interprets the name parameter in its own way. Generally, stream + sockets may successfully connect() only once; datagram sockets may + use connect() multiple times to change their association. Datagram + sockets may dissolve the association by connecting to an invalid + address, such as a null address. + + RESULT + If the connection or binding succeeds, 0 is returned. Otherwise a -1 + is returned, and a more specific error code is stored in errno. + + ERRORS + The connect() call fails if: + + [EBADF] + S is not a valid descriptor. + + [ENOTSOCK] + S is a descriptor for a file, not a socket. + + [EADDRNOTAVAIL] + The specified address is not available on this machine. + + [EAFNOSUPPORT] + Addresses in the specified address family cannot be + used with this socket. + + [EISCONN] + The socket is already connected. + + [ETIMEDOUT] + Connection establishment timed out without establishing + a connection. + + [ECONNREFUSED] + The attempt to connect was forcefully rejected. + + [ENETUNREACH] + The network isn't reachable from this host. + + [EADDRINUSE] + The address is already in use. + + [EFAULT] + The name parameter specifies an area outside the process + address space. + + [EINPROGRESS] + The socket is non-blocking and the connection cannot be + completed immediately. It is possible to WaitSelect() + for completion by selecting the socket for writing. + + [EALREADY] + The socket is non-blocking and a previous connection + attempt has not yet been completed. + + SEE ALSO + accept(), WaitSelect(), socket(), getsockname() + + bsdsocket.library/CreateAddrAllocMessageAcket.library/CreateAddrAllocMessageA + + NAME + CreateAddrAllocMessageA - Create a message to be used with the + BeginInterfaceConfig() DHCP interface configuration routine. + + SYNOPSIS + error = CreateAddrAllocMessageA(version,protocol,interface_name, + D0 D0 D1 A0 + result_ptr, tags) + A1 A2 + + LONG CreateAddrAllocMessageA(LONG version,LONG protocol, + STRPTR interface_name, + struct AddressAllocationMessage * result_ptr, + struct TagItem * tags); + + LONG CreateAddrAllocMessage(LONG version, + LONG protocol, + STRPTR interface_name, + struct AddressAllocationMessage * result_ptr, ...); + + FUNCTION + The AddressAllocationMessage used by the BeginInterfaceConfig() + DHCP configuration routine needs to be created and properly + initialized before it can be used. While this initialization can + be performed manually, it is recommended that you use the + CreateAddrAllocMessageA() routine instead which will fill in + proper defaults and can allocate extra memory for data to be + returned by the configuration process. + + INPUTS + version -- Data structure version; this must be AAM_VERSION + (see the BeginInterfaceConfig() autodoc for more). + + protocol -- Configuration protocol type, either AAMP_BOOTP + or AAMP_DHCP. + + interface_name -- The name of the network interface to be + configured. + + result_ptr -- Reference to a pointer which will be filled + with the address of the AddressAllocationMessage created. + + tags -- Pointer to a tag item list which contains more + information on how the AddressAllocationMessage should + be filled in. + + TAGS + CAAMTA_Timeout (ULONG) - Number of seconds to wait for a + BOOTP/DHCP server to respond. Due to how the configuration + process works, the timeout must be at least 10 seconds + long. If it is shorter, it is automatically extended to 10 + seconds. Default for this option is 10 seconds. + + CAAMTA_LeaseTime (ULONG) - This option is relevant only for DHCP. + It allows you to specify the interface address lease time + to request from the server. The default is + DHCP_DEFAULT_LEASE_TIME, which accepts the + server's choice. The value DHCP_INFINITE_LEASE_TIME + will attempt to bind the interface address permanently. + All other values refer to the number of seconds the + lease should be allocated. + + Note that the server may choose to ignore your + preferred lease time. + + CAAMTA_RequestedAddress (ULONG) - A DHCP client can make a wish, + as to which IP address should be allocated for it. This is where + you provide your choice. Note that the server may ignore + your wish. Make sure that your application does not + assume that it is always allocated the IP address + you requested. + + Default for this option is to accept the server's coice. + + CAAMTA_ClientIdentifier (STRPTR) - Allocating an IP address for a + DHCP client is not that helpful if the client cannot be referred + to by its name after an address has been assigned to it. You can + request a name to be bound to the IP address to assign + by specifying it here. The name will be duplicated and stored + in the allocation message. The name must be at least 2 characters + long and it cannot be longer than 255 characters. + + Default for this option is to accept the server's choice. + + CAAMTA_NAKMessageSize (LONG) - Size of the buffer to reserve for the + NAK message the server may return (in bytes). This will fill in + the 'aam_NAKMessage' and 'aam_NAKMessageSize' members of the + allocation message. + + Default for this option is not to reserve any memory for the + NAK message buffer. + + CAAMTA_RouterTableSize (LONG) - This is where you specify for how + many router table entries you want memory to be allocated. + This will fill in the 'aam_RouterTable' and 'aam_RouterTableSize' + members of the allocation message. + + Default for this option is not to reserve any memory for + the router table. + + CAAMTA_DNSTableSize (LONG) - This is where you specify for how + many DNS address table entries you want memory to be allocated. + This will fill in the 'aam_DNSTable' and 'aam_DNSTableSize' + members of the allocation message. + + Default for this option is not to reserve any memory for + the DNS address table. + + CAAMTA_StaticRouteTableSize (LONG) - This is where you specify for + how many static route address table entries you want memory to be + allocated. This will fill in the 'aam_StaticRouteTable' and + 'aam_StaticRouteTableSize' members of the allocation message. + + Default for this option is not to reserve any memory for + the static route address table. + + CAAMTA_HostNameSize (LONG) - How many bytes to reserve for the + host name the server may provide for the client. This will + fill in the 'aam_HostName' and 'aam_HostNameSize' members of + the address allocation message. + + Default for this option is not to reserve any memory for + the host name. + + CAAMTA_DomainNameSize (LONG) - How many bytes to reserve for the + domain name the server may provide for the client. This will + fill in the 'aam_DomainName' and 'aam_DomainNameSize' members of + the address allocation message. + + Default for this option is not to reserve any memory for + the domain name. + + CAAMTA_BOOTPMessageSize (LONG) - How many bytes to reserve for the + BOOTP message the server will return. This will fill in the + 'aam_BOOTPMessage' and 'aam_BOOTPMessageSize' members of the + address allocation message. + + Default for this option is not to reserve any memory for the + BOOTP message. + + CAAMTA_RecordLeaseExpiration (BOOL) - If set to TRUE, memory for + a DateStamp in the 'aam_LeaseExpires' member of the address + allocation message will be reserved, which later will hold + the time and date when the DHCP lease expires. + + Default for this option is not to reserve any memory for the + lease expiration date stamp. + + CAAMTA_ReplyPort (struct MsgPort *) - You can have the MsgPort + stored in the allocation message the message should be returned + to when the allocation process has finished. + + CAAMTA_RequestUnicast (BOOL) - If set to TRUE, ask the DHCP + server responding to send replies using unicast instead of + broadcast (the default). Note that the DHCP server + is free to ignore this request and may send replies + using broadcast even if requested to use unicast. + + RESULT + error -- If the creation of the address allocation message + failed for one reason or another, then this routine will + return a non-zero error code, otherwise the result will + be zero. + + result_ptr -- If successful, a pointer to the newly allocated + address allocation message will be stored in the reference + this parameter points to. + + ERRORS + CAAME_Success + The address allocation message was allocated and + filled in successfully. This is not an error. + + CAAME_Invalid_result_ptr + The 'result_ptr' parameter you provided is not valid, + e.g. it is NULL. + + CAAME_Not_enough_memory + The routine ran out of memory whilst trying to fill + in your address allocation message. + + CAAME_Invalid_version + The version number you requested is not supported. + + CAAME_Invalid_protocol + The configuration protocol you requested is not + supported. + + CAAME_Invalid_interface_name + The interface name you provided is not valid, e.g. + you provided a NULL pointer, or the name is empty. + + CAAME_Interface_not_found + The interface whose name you provided could not + be found. + + CAAME_Invalid_client_identifier + The client identifier you provided is not valid, + e.g. empty. + + CAAME_Client_identifier_too_short + The client identifier you provided is too short. + + CAAME_Client_identifier_too_long + The client identifier you provided is too long. + + NOTES + The BeginInterfaceConfig() call is an extension to the + AmiTCP V4 API and cannot be assumed to be present in all versions + of "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_INTERFACE_API tag with the + SocketBaseTagList() function. + + SEE ALSO + BeginInterfaceConfig() + DeleteAddrAllocMessage() + + bsdsocket.library/DeleteAddrAllocMessagesocket.library/DeleteAddrAllocMessage + + NAME + DeleteAddrAllocMessage - Release the memory allocation for an + address allocation message created by CreateAddrAllocMessageA(). + + SYNOPSIS + DeleteAddrAllocMessage(message) + A0 + + VOID DeleteAddrAllocMessage(struct AddressAllocationMessage * m); + + FUNCTION + This routine is the counterpart to CreateAddrAllocMessageA(). + When the message is no longer used, it should be deallocated + by calling this routine. + + INPUTS + message -- An address allocation message as created by + CreateAddrAllocMessageA(). Passing a NULL pointer in + place of a valid message address is harmless. + + NOTES + The BeginInterfaceConfig() call is an extension to the + AmiTCP V4 API and cannot be assumed to be present in all versions + of "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_INTERFACE_API tag with the + SocketBaseTagList() function. + + Never delete a message that is still in use by the configuration + process, or strange things will happen, such as operating system + crashes. + + This routine can only deallocate address allocation messages + created by CreateAddrAllocMessageA() and will not work with + anything else. + + SEE ALSO + BeginInterfaceConfig() + CreateAddrAllocMessageA() + + bsdsocket.library/DeleteRouteTagList bsdsocket.library/DeleteRouteTagList + + NAME + DeleteRouteTagList - Remove entries from the networking + routing tables + + SYNOPSIS + success = DeleteRouteTagList(tags) + D0 A0 + + long DeleteRouteTagList(struct TagItem *tags); + + long DeleteRouteTags(Tag tag1,...); + + FUNCTION + This function is for manipulating the networking routing tables + by removing entries from them. + + INPUTS + tags -- Pointer to a 'struct TagItem' list. + + TAGS + RTA_Destination (STRPTR) -- The destination address of the route + previously added, which must be specified as a NUL-terminated + string. The string can contain a host name to be resolved or + an IP address in dotted-decimal notation (per RFC1700). The + use of the RTA_Destination parameter excludes the user of + the RTA_DefaultGateway parameter. + + RTA_DefaultGateway (STRPTR) -- The address of the default gateway + all packets were forwarded to which could not be sent along + any other known route. This must be a NUL-terminated string + referring to a host name to be resolved or an IP address in + dotted-decimal notation (per RFC1700). The use of the + RTA_DefaultGateway parameter excludes the user of + the RTA_Destination parameter. + + RESULT + success -- 0 for success, -1 for failure; the failure code will + be stored in the 'errno' variable. + + NOTES + The DeleteRouteTagList() call is an extension to the AmiTCP V4 API + and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_ROUTING_API tag with the + SocketBaseTagList() function. + + This function is intended to be a simplified, specialized front end + to the underlying routing socket API. If you want more than this + function can do for you, use the routing socket API. Take care, as + this functionality is not present in the original AmiTCP implementation. + + SEE ALSO + AddRouteTagList(), route + + bsdsocket.library/Dup2Socket bsdsocket.library/Dup2Socket + + NAME + Dup2Socket - duplicate a socket descriptor + + SYNOPSIS + s = Dup2Socket(old_socket, new_socket) + D0 D0 D1 + + long Dup2Socket(long old_socket, long new_socket); + + FUNCTION + Dup2Socket() duplicates an existing socket descriptor and returns its + value to the caller. The argument old_socket is a small nonnegative + integer index in the per-library base descriptor table. The value + must be less than the size of the table, which is returned by + getdtablesize(). + + The new_socket parameter refers to the socket which should be used as + the new socket descriptor number. If that value refers to an existing + socket, then this socket will be closed before it is used. If the + new_socket parameter is -1, then the lowest numbered descriptor + currently not in use will be claimed. + + RESULT + The value -1 is returned if an error occurs; otherwise, the new + socket descriptor value is returned. + + ERRORS + Dup2Socket fails if: + + [EBADF] + old_socket or new_socket is not a valid active descriptor, + and new_socket is not -1. + + [EMFILE] + Too many descriptors are active. + + SEE ALSO + accept(), CloseSocket(), IoctlSocket(), socket(), + getdtablesize() + + bsdsocket.library/endnetent bsdsocket.library/endnetent + + NAME + endnetent - get network entry + + SYNOPSIS + #include + + endnetent() + + void endnetent(void); + + FUNCTION + The endnetent() function closes the net database. + + SEE ALSO + getnetent(), getnetbyaddr(), getnetbyname(), setnetent() + + BUGS + The data space used by these functions is static; if future use + requires the data, it should be copied before any subsequent calls to + these functions overwrite it. Only Internet network numbers are + currently understood. Expecting network numbers to fit in no more + than 32 bits is probably naive. + + NOTES + The endnetent() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_LOCAL_DATABASE_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/endprotoent bsdsocket.library/endprotoent + + NAME + endprotoent - get protocol entry + + SYNOPSIS + #include + + endprotoent() + + void endprotoent(void); + + FUNCTION + The endprotoent() function closes the protocol database. + + SEE ALSO + getprotoent(), getprotobynumber(), getprotobyname(), setprotoent() + + BUGS + These functions use a static data space; if the data is needed for + future use, it should be copied before any subsequent calls overwrite + it. Only the Internet protocols are currently understood. + + NOTES + The endprotoent() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_LOCAL_DATABASE_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/endservent bsdsocket.library/endservent + + NAME + endservent - get service entry + + SYNOPSIS + #include + + endservent() + + void endservent(void); + + FUNCTION + The endservent() function closes the service database. + + SEE ALSO + getservent(), getservbyname(), getservbyport(), setservent() + + NOTES + The endservent() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_LOCAL_DATABASE_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/Errno bsdsocket.library/Errno + + NAME + Errno - get error value after unsuccessful function call + + SYNOPSIS + error = Errno() + D0 + + long Errno(void); + + FUNCTION + This function is deprecated; SocketBaseTags() with the + SBTC_ERRNO tag should be used instead. + + After a function call has failed, the Errno() function will return + the error code associated with the cause of the failure. + + RESULT + The error code set by the previous function call. + + SEE ALSO + SetErrnoPtr() + + bsdsocket.library/freeaddrinfo bsdsocket.library/freeaddrinfo + + NAME + freeaddrinfo - free memory allocated by getaddrinfo() + + SYNOPSIS + #include + #include + + freeaddrinfo(ai) + A0 + + VOID freeaddrinfo(struct addrinfo *ai); + + FUNCTION + The gai_strerror() function releases the memory allocated for + the result data provided by the getaddrinfo() function. + + INPUTS + addrinfo -- Pointer to the result data produced by the + getaddrinfo() function. This would be the pointer filled + in through the fourth parameter ('res'). It is safe to + call this function with a NULL 'ai' parameter. + + SEE ALSO + getaddrinfo() + + NOTES + The freeaddrinfo() call is an extension to the AmiTCP V4 + API and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_GETHOSTADDR_R_API tag with the + SocketBaseTagList() function. + + While it is safe to call this version of the freeaddrinfo() + function with a NULL 'ai' parameter, this may not be the + case with other implementations. + + bsdsocket.library/FreeRouteInfo bsdsocket.library/FreeRouteInfo + + NAME + FreeRouteInfo - Release information obtained by GetRouteInfo(). + + SYNOPSIS + FreeRouteInfo(table) + A0 + + VOID FreeRouteInfo(struct rt_msghdr *table); + + FUNCTION + This function is the counterpart to GetRouteInfo() in that + it releases the memory allocated for the copy of the routing + table information previously returned. + + INPUTS + table -- Pointer to the routing table information as returned + by GetRouteInfo(). This parameter can be NULL in which case + this routine does nothing. + + NOTES + The FreeRouteInfo() call is an extension to the AmiTCP V4 API + and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_ROUTING_API tag with the + SocketBaseTagList() function. + + SEE ALSO + GetRouteInfo(), route + + bsdsocket.library/gai_strerror bsdsocket.library/gai_strerror + + NAME + gai_strerror - get error message string from EAI_xxx error code + + SYNOPSIS + #include + #include + + error_message = gai_strerror(LONG error_code) + D0 D0 + + STRPTR gai_strerror(LONG error_code); + + FUNCTION + The gai_strerror() function returns an error message string + corresponding to the error code returned by getaddrinfo() + or getnameinfo(). + + RESULT + error_message - Pointer to a human readable error message text + corresponding to the error code. Note that this message text + is read-only and must not be modified. + + SEE ALSO + getaddrinfo() + + NOTES + The gai_strerror() call is an extension to the AmiTCP V4 + API and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_GETHOSTADDR_R_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/getaddrinfo bsdsocket.library/getaddrinfo + + NAME + getaddrinfo - nodename-to-address translation in + protocol-independent manner + + SYNOPSIS + #include + #include + + status = getaddrinfo(hostname, servname, hints, res) + D0 A0 A1 A2 A3 + + LONG getaddrinfo(STRPTR hostname, STRPTR servname, + struct addrinfo *hints, struct addrinfo **res); + + FUNCTION + The getaddrinfo() function is defined for protocol-independent nodename- + to-address translation. It performs the functionality of + gethostbyname() and getservbyname(), but in a more sophisticated manner. + + The addrinfo structure is defined as a result of including the + header: + + struct addrinfo { + int ai_flags; /* input flags */ + int ai_family; /* protocol family for socket */ + int ai_socktype; /* socket type */ + int ai_protocol; /* protocol for socket */ + socklen_t ai_addrlen; /* length of socket-address */ + struct sockaddr *ai_addr; /* socket-address for socket */ + char *ai_canonname; /* canonical name for service location */ + struct addrinfo *ai_next; /* pointer to next in list */ + }; + + The nodename and servname arguments are pointers to NUL-terminated + strings or NULL. One or both of these two arguments must be a non-null + pointer. In the normal client scenario, both the nodename and servname + are specified. In the normal server scenario, only the servname is spec- + ified. A non-null nodename string can be either a node name or a numeric + host address string (i.e., a dotted-decimal IPv4 address or an IPv6 hex + address). A non-null servname string can be either a service name or a + decimal port number. + + The caller can optionally pass an addrinfo structure, pointed to by the + third argument, to provide hints concerning the type of socket that the + caller supports. In this hints structure all members other than + ai_flags, ai_family, ai_socktype, and ai_protocol must be zero or a null + pointer. A value of PF_UNSPEC for ai_family means the caller will accept + any protocol family. A value of 0 for ai_socktype means the caller will + accept any socket type. A value of 0 for ai_protocol means the caller + will accept any protocol. For example, if the caller handles only TCP + and not UDP, then the ai_socktype member of the hints structure should be + set to SOCK_STREAM when getaddrinfo() is called. The ai_family member of + the hints structure should be set to PF_INET when getaddrinfo() is called. + If the third argument to getaddrinfo() is a null pointer, this is the same + as if the caller had filled in an addrinfo structure initialized to zero + with ai_family set to PF_UNSPEC. + + Upon successful return a pointer to a linked list of one or more addrinfo + structures is returned through the final argument. The caller can + process each addrinfo structure in this list by following the ai_next + pointer, until a null pointer is encountered. In each returned addrinfo + structure the three members ai_family, ai_socktype, and ai_protocol are + the corresponding arguments for a call to the socket() function. In each + addrinfo structure the ai_addr member points to a filled-in socket + address structure whose length is specified by the ai_addrlen member. + + If the AI_PASSIVE bit is set in the ai_flags member of the hints struc- + ture, then the caller plans to use the returned socket address structure + in a call to bind(). In this case, if the nodename argument is a null + pointer, then the IP address portion of the socket address structure will + be set to INADDR_ANY. + + If the AI_PASSIVE bit is not set in the ai_flags member of the hints + structure, then the returned socket address structure will be ready for a + call to connect() (for a connection-oriented protocol) or either + connect(), sendto(), or sendmsg() (for a connectionless protocol). In + this case, if the nodename argument is a null pointer, then the IP + address portion of the socket address structure will be set to the loop- + back address. + + If the AI_CANONNAME bit is set in the ai_flags member of the hints struc- + ture, then upon successful return the ai_canonname member of the first + addrinfo structure in the linked list will point to a NUL-terminated + string containing the canonical name of the specified nodename. + + If the AI_NUMERICHOST bit is set in the ai_flags member of the hints + structure, then a non-null nodename string must be a numeric host address + string. Otherwise an error of EAI_NONAME is returned. This flag pre- + vents any type of name resolution service (e.g., the DNS) from being + called. + + If the AI_NUMERICSERV bit is set in the ai_flags member of the hints + structure, then a non-null servname string must be a numeric port string. + Otherwise an error of EAI_NONAME is returned. This flag prevents any + type of name resolution service (e.g., the NIS) from being called. + + The arguments to getaddrinfo() must sufficiently be consistent and unam- + biguous. Here are pitfall cases you may encounter: + + o getaddrinfo() will raise an error if members of the hints structure + are not consistent. For example, for internet address families, + getaddrinfo() will raise an error if you specify SOCK_STREAM to + ai_socktype while you specify IPPROTO_UDP to ai_protocol. + + o If you specify a servname which is defined only for certain + ai_socktype, getaddrinfo() will raise an error because the arguments + are not consistent. For example, getaddrinfo() will raise an error + if you ask for ``tftp'' service on SOCK_STREAM. + + o For internet address families, if you specify servname while you set + ai_socktype to SOCK_RAW, getaddrinfo() will raise an error, because + service names are not defined for the internet SOCK_RAW space. + + o If you specify a numeric servname, while leaving ai_socktype and + ai_protocol unspecified, getaddrinfo() will raise an error. This is + because the numeric servname does not identify any socket type, and + getaddrinfo() is not allowed to glob the argument in such case. + + All of the information returned by getaddrinfo() is dynamically allo- + cated: the addrinfo structures, the socket address structures, and canon- + ical node name strings pointed to by the addrinfo structures. To return + this information to the system the function freeaddrinfo() is called. + The addrinfo structure pointed to by the ai argument is freed, along with + any dynamic storage pointed to by the structure. This operation is + repeated until a NULL ai_next pointer is encountered. + + To aid applications in printing error messages based on the EAI_xxx codes + returned by getaddrinfo(), gai_strerror() is defined. The argument is + one of the EAI_xxx values defined earlier and the return value points to + a string describing the error. If the argument is not one of the EAI_xxx + values, the function still returns a pointer to a string whose contents + indicate an unknown error. + + RESULT + Error return status from getaddrinfo() is zero on success and non-zero on + errors. Non-zero error codes are defined in , and as follows: + + EAI_ADDRFAMILY Address family for nodename not supported. + EAI_AGAIN Temporary failure in name resolution. + EAI_BADFLAGS Invalid value for ai_flags. + EAI_FAIL Non-recoverable failure in name resolution. + EAI_FAMILY ai_family not supported. + EAI_MEMORY Memory allocation failure. + EAI_NODATA No address associated with nodename. + EAI_NONAME nodename nor servname provided, or not known. + EAI_SERVICE servname not supported for ai_socktype. + EAI_SOCKTYPE ai_socktype not supported. + EAI_SYSTEM System error returned in errno. + + If called with proper argument, gai_strerror() returns a pointer to a + string describing the given error code. If the argument is not one of + the EAI_xxx values, the function still returns a pointer to a string + whose contents indicate an unknown error. + + SEE ALSO + gethostbyname(), getservbyname(), gai_strerror(), freeaddrinfo() + + NOTES + While getaddrinfo() is safe to be called by multiple + processes at the same time sharing the same SocketBase, + it is not safe to mix calls to getaddrinfo() with the + regular gethostbyname()/gethostbyaddr() functions. The functions + all use the same per-SocketBase name resolution state + information, serializing access. The name resolution state + will be overwritten by each access, invalidating whatever + calls to gethostbyname()/gethostbyaddr() had returned. + + The getaddrinfo() call is an extension to the AmiTCP V4 + API and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_GETHOSTADDR_R_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/GetDefaultDomainName bsdsocket.library/GetDefaultDomainName + + NAME + GetDefaultDomainName - Retrieve the domain name that will be added + to the end of host names which lack a domain name. + + SYNOPSIS + success = GetDefaultDomainName(buffer,buffer_size) + D0 A0 D0 + + BOOL GetDefaultDomainName(STRPTR buffer,LONG buffer_size); + + FUNCTION + If no domain name is part of a host name, a default domain name can be + added to it if the host name lookup fails. This is normally controlled + by the name server configuration file but may be overridden either + through an environment variable or a call to SetDefaultDomainName(). + The domain name configured through SetDefaultDomainName() can be + queried via GetDefaultDomainName(). + + INPUTS + buffer -- The string buffer to copy the default domain name to. + + buffer_size -- Number of bytes in the string buffer to copy the + default domain name to; this must include the terminating + NUL byte. If the default domain name is larger than will + fit into the buffer, then the name will be truncated. + + RESULT + success -- FALSE if the default domain name is not set, TRUE + otherwise. + + NOTES + The GetDefaultDomainName() call is an extension to the + AmiTCP V4 API and cannot be assumed to be present in all versions + of "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_DNS_API tag with the + SocketBaseTagList() function. + + SEE ALSO + SetDefaultDomainName(), SocketBaseTagList() + + bsdsocket.library/getdtablesize bsdsocket.library/getdtablesize + + NAME + getdtablesize - get descriptor table size + + SYNOPSIS + nfds = getdtablesize() + D0 + + int getdtablesize(void); + + FUNCTION + This function is deprecated; SocketBaseTags() with the + SBTC_DTABLESIZE tag should be used instead. + + Each library base has a fixed size descriptor table, which is + guaranteed to have at least 20 slots. The entries in the descriptor + table are numbered with small integers starting at 0. The call + getdtablesize() returns the size of this table. + + RESULT + The size of the descriptor table. + + SEE ALSO + CloseSocket(), socket(), WaitSelect(), SocketBaseTagList() + + bsdsocket.library/gethostbyaddr bsdsocket.library/gethostbyaddr + + NAME + gethostbyaddr - get network host entry + + SYNOPSIS + #include + extern long h_errno; + + hostent = gethostbyaddr(addr, len, type) + D0 A0 D0 D1 + + struct hostent * gethostbyaddr(char *addr, long len, long type); + + FUNCTION + The gethostbyname() and gethostbyaddr() functions each return a + pointer to an object with the following structure describing an + internet host referenced by name or by address, respectively. This + structure contains either the information obtained from the name + server, or broken-out fields from a line in the local hosts database. + If the local name server is not running these routines do a lookup + in the local hosts database. + + struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + long h_addrtype; /* host address type */ + long h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ + }; + #define h_addr h_addr_list[0] /* address, for backward compatibility */ + + The members of this structure are: + + h_name + Official name of the host. + + h_aliases + A zero terminated array of alternate names for the host. + + h_addrtype + The type of address being returned; currently always + AF_INET. + + h_length + The length, in bytes, of the address. + + h_addr_list + A zero terminated array of network addresses for the host. + Host addresses are returned in network byte order. + + h_addr + The first address in h_addr_list; this is for backward + compatibility. + + When using the nameserver, gethostbyname() will search for + the named host in the current domain and its parents unless + the name ends in a dot. If the name contains no dot, and if + the environment variable ``HOSTALIASES'' contains the name + of an alias file, the alias file will first be searched for + an alias matching the input name. + + RESULT + Error return status from gethostbyname() and gethostbyaddr() is + indicated by return of a null pointer. The external integer h_errno + may then be checked to see whether this is a temporary failure or an + invalid or unknown host. + + The variable h_errno can have the following values: + + HOST_NOT_FOUND + No such host is known. + + TRY_AGAIN + This is usually a temporary error and means that the local + server did not receive a response from an authoritative + server. A retry at some later time may succeed. + + NO_RECOVERY + Some unexpected server failure was encountered. This is + a non-recoverable error. + + NO_DATA + The requested name is valid but does not have an IP address; + this is not a temporary error. This means that the name is + known to the name server but there is no address associated + with this name. Another type of request to the name server + using this domain name will result in an answer; for example, + a mail-forwarder may be registered for this domain. + + BUGS + These functions use static data storage; if the data is needed for + future use, it should be copied before any subsequent calls overwrite + it. Only the Internet address format is currently understood. + + bsdsocket.library/gethostbyname bsdsocket.library/gethostbyname + + NAME + gethostbyname - get network host entry + + SYNOPSIS + #include + extern long h_errno; + + hostent = gethostbyname(name) + D0 A0 + + struct hostent * gethostbyname(char *name); + + FUNCTION + The gethostbyname() and gethostbyaddr() functions each return a + pointer to an object with the following structure describing an + internet host referenced by name or by address, respectively. This + structure contains either the information obtained from the name + server, or broken-out fields from a line in the hosts database. If + the local name server is not running these routines do a lookup in + the local host database. + + struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + long h_addrtype; /* host address type */ + long h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ + }; + #define h_addr h_addr_list[0] /* address, for backward compatibility */ + + The members of this structure are: + + h_name + Official name of the host. + + h_aliases + A zero terminated array of alternate names for the host. + + h_addrtype + The type of address being returned; currently always + AF_INET. + + h_length + The length, in bytes, of the address. + + h_addr_list + A zero terminated array of network addresses for the host. + Host addresses are returned in network byte order. + + h_addr + The first address in h_addr_list; this is for backward + compatibility. + + When using the nameserver, gethostbyname() will search for + the named host in the current domain and its parents unless + the name ends in a dot. If the name contains no dot, and if + the environment variable ``HOSTALIASES'' contains the name + of an alias file, the alias file will first be searched for + an alias matching the input name. + + RESULT + Error return status from gethostbyname() and gethostbyaddr() is + indicated by return of a null pointer. The external integer h_errno + may then be checked to see whether this is a temporary failure or an + invalid or unknown host. + + The variable h_errno can have the following values: + + HOST_NOT_FOUND + No such host is known. + + TRY_AGAIN + This is usually a temporary error and means that the local + server did not receive a response from an authoritative + server. A retry at some later time may succeed. + + NO_RECOVERY + Some unexpected server failure was encountered. This is + a non-recoverable error. + + NO_DATA + The requested name is valid but does not have an IP address; + this is not a temporary error. This means that the name is + known to the name server but there is no address associated + with this name. Another type of request to the name server + using this domain name will result in an answer; for example, + a mail-forwarder may be registered for this domain. + + BUGS + These functions use static data storage; if the data is needed for + future use, it should be copied before any subsequent calls overwrite + it. Only the Internet address format is currently understood. + + bsdsocket.library/gethostbyname_r bsdsocket.library/gethostbyname_r + + NAME + gethostbyname_r - get network host entry (reentrant) + + SYNOPSIS + #include + + hostent = gethostbyname_r(name, hp, buf, buflen, he) + D0 A0 A1 A2 D0 A3 + + struct hostent * gethostbyname_r(char *name, struct hostent *hp, char *buf, + ULONG buflen, LONG *he); + + FUNCTION + The gethostbyname_r() function is a variant of the regular + gethostbyname() which does not store the queried information in + a static buffer. For this reason, gethostbyname_r() can be used + concurrently by several processes at the same time which share + the same SocketBase without causing the queried information to get lost. + + INPUTS + name -- The name of the host (or an IPv4 address in dotted decimal + notation) which should be resolved to an IPv4 address. + hp -- Pointer to a 'struct hostent' which will be filled in with + the information retrieved. + buf -- Buffer which will be used to store all the information + retrieved. This should be at least 1024 bytes in size. + buflen -- Size of the buffer in which all the information retrieved + will be stored. + he -- Pointer to a LONG in which an error code will be stored if + the host name lookup failed. With gethostbyname() that error + code would show up in h_error, here it is provided to the + caller. + + RESULT + hostent -- Pointer to the retrieved information, or NULL for + failure. + + SEE ALSO + gethostbyname(), getaddrinfo() + + NOTES + gethostbyname_r() is considered obsolete and is provided only for the + sake of making it easier to port multithreaded software. You should + use the getaddrinfo() API instead, if you can. + + gethostbyname_r() is not a standardized API function, with well-defined + parameters and behaviour. This implementation follows the BSD Unix + example, and not the Linux example. + + Note that if you call gethostbyname_r() with a SocketBase shared + with other clients, and the call fails returning NULL, then you may + not be able to retrieve the h_error value to explain why the + lookup failed. This is because a different process may have already + overwritten the h_error value. As hinted above, this is one good + reason to switch to use the getaddrinfo() API. + + While gethostbyname_r() is safe to be called by multiple + processes at the same time sharing the same SocketBase, + it is not safe to mix calls to gethostbyname_r() with the + regular gethostbyname()/gethostbyaddr() function. The functions + all use the same per-SocketBase name resolution state + information, serializing access. The name resolution state + will be overwritten by each access, invalidating whatever + calls to gethostbyname()/gethostbyaddr() had returned. + + The gethostbyname_r() call is an extension to the AmiTCP V4 + API and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_GETHOSTADDR_R_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/gethostid bsdsocket.library/gethostid + + NAME + gethostid - get unique identifier of current host + + SYNOPSIS + id = gethostid() + D0 + + long gethostid(void); + + FUNCTION + This function has been deprecated. + + gethostid() returns the 32-bit identifier for the current processor. + + NOTES + This function should not be used in new code since its result is + essentially unpredictable and depends upon the current state of the + interfaces configured. + + RESULT + 32-bit identifier for the current processor. + + SEE ALSO + gethostname() + + BUGS + 32 bits for the identifier is too small. + + bsdsocket.library/gethostname bsdsocket.library/gethostname + + NAME + gethostname - get name of current host + + SYNOPSIS + success = gethostname(name,namelen) + D0 A0 D0 + + long gethostname(char *name, long namelen); + + FUNCTION + gethostname() returns the standard host name for the current + processor. The parameter namelen specifies the size of the name + array. The returned name is null-terminated unless insufficient space + is provided. + + NOTES + This function will attempt to match the host's IP address, as obtained + by querying the first interface that is online, against the host + database. If that fails, it will attempt to perform a reverse name + resolution. If that fails, it will query the 'HOSTNAME' environment + variable. If that fails, it will return the name "localhost". + + RESULT + If the call succeeds a value of 0 is returned. If the call fails, a + value of -1 is returned and an error code is placed in the global + location errno. + + ERRORS + The following errors may be returned by this call: + + [EFAULT] + The name or namelen parameter gave an invalid address. + + [EPERM] + The caller tried to set the hostname and was not the superuser. + + SEE ALSO + gethostid() + + BUGS + Host names are limited to MAXHOSTNAMELEN (from ) + characters, currently 256. + + bsdsocket.library/getnameinfo bsdsocket.library/getnameinfo + + NAME + getnameinfo - address-to-nodename translation in protocol- + independent manner. + + SYNOPSIS + #include + #include + + status = getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) + D0 A0 D0 A1 D1 A2 D2 D3 + + LONG getnameinfo(struct sockaddr *sa, ULONG salen, STRPTR host, + ULONG hostlen, STRPTR serv, ULONG servlen, ULONG flags); + + FUNCTION + The getnameinfo() function is defined for protocol-independent address- + to-nodename translation. Its functionality is a reverse conversion of + getaddrinfo(), and implements similar functionality to gethostbyaddr() + and getservbyport() in a more sophisticated manner. + + This function looks up an IP address and port number provided by the + caller in the DNS and system-specific database, and returns text strings + for both in buffers provided by the caller. The function indicates suc- + cessful completion by a zero return value; a non-zero return value indi- + cates failure. + + The first argument, sa, points to a sockaddr_in structurethat holds the + IP address and port number. The salen argument gives the length of the + sockaddr_in structure. + + The function returns the nodename associated with the IP address in the + buffer pointed to by the host argument. The caller provides the size of + this buffer via the hostlen argument. The service name associated with + the port number is returned in the buffer pointed to by serv, and the + servlen argument gives the length of this buffer. The caller specifies + not to return either string by providing a zero value for the hostlen or + servlen arguments. Otherwise, the caller must provide buffers large + enough to hold the nodename and the service name, including the terminat- + ing null characters. + + Unfortunately most systems do not provide constants that specify the max- + imum size of either a fully-qualified domain name or a service name. + Therefore to aid the application in allocating buffers for these two + returned strings the following constants are defined in : + + #define NI_MAXHOST MAXHOSTNAMELEN + #define NI_MAXSERV 32 + + The first value is actually defined as the constant MAXDNAME in recent + versions of BIND's header (older versions of BIND define + this constant to be 256) and the second is a guess based on the services + listed in the current Assigned Numbers RFC. + + The final argument is a flag that changes the default actions of this + function. By default the fully-qualified domain name (FQDN) for the host + is looked up in the DNS and returned. If the flag bit NI_NOFQDN is set, + only the nodename portion of the FQDN is returned for local hosts. + + If the flag bit NI_NUMERICHOST is set, or if the host's name cannot be + located in the DNS, the numeric form of the host's address is returned + instead of its name (e.g., by calling inet_ntop() instead of + gethostbyaddr()). If the flag bit NI_NAMEREQD is set, an error is + returned if the host's name cannot be located in the DNS. + + If the flag bit NI_NUMERICSERV is set, the numeric form of the service + address is returned (e.g., its port number) instead of its name. The two + NI_NUMERICxxx flags are required to support the -n flag that many com- + mands provide. + + A fifth flag bit, NI_DGRAM, specifies that the service is a datagram ser- + vice, and causes getservbyport() to be called with a second argument of + "udp" instead of its default of "tcp". This is required for the few + ports (512-514) that have different services for UDP and TCP. + + These NI_xxx flags are defined in . + + RESULT + The function indicates successful completion by a zero return value; a + non-zero return value indicates failure. Error codes are as below: + + EAI_AGAIN The name could not be resolved at this time. Future + attempts may succeed. + + EAI_BADFLAGS The flags had an invalid value. + + EAI_FAIL A non-recoverable error occurred. + + EAI_FAMILY The address family was not recognized or the address + length was invalid for the specified family. + + EAI_MEMORY There was a memory allocation failure. + + EAI_NONAME The name does not resolve for the supplied parameters. + NI_NAMEREQD is set and the host's name cannot be + located, or both nodename and servname were null. + + EAI_SYSTEM A system error occurred. The error code can be found + in errno. + + SEE ALSO + gethostbyaddr(), getservbyport(), getaddrinfo(), gai_strerror() + + NOTES + While getnameinfo() is safe to be called by multiple + processes at the same time sharing the same SocketBase, + it is not safe to mix calls to getaddrinfo() with the + regular gethostbyaddr()/getservbyport() functions. The functions + all use the same per-SocketBase name resolution state + information, serializing access. The name resolution state + will be overwritten by each access, invalidating whatever + calls to gethostbyaddr()/getservbyport() had returned. + + The getnameinfo() call is an extension to the AmiTCP V4 + API and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_GETHOSTADDR_R_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/getnetbyaddr bsdsocket.library/getnetbyaddr + + NAME + getnetbyaddr - get network entry + + SYNOPSIS + #include + + netent = getnetbyaddr(net,type) + D0 D0 D1 + + struct netent * getnetbyaddr(unsigned long net, long type); + + FUNCTION + The getnetbyname() and getnetbyaddr() functions each return a pointer + to an object with the following structure containing the broken-out + fields of a line in the network data base. + + struct netent { + char *n_name; /* official name of net */ + char **n_aliases; /* alias list */ + long n_addrtype; /* net number type */ + unsigned long n_net; /* net number */ + }; + + The members of this structure are: + + n_name + The official name of the network. + + n_aliases + A zero terminated list of alternate names for the network. + + n_addrtype + The type of the network number returned; currently only + AF_INET. + + n_net + The network number. Network numbers are returned in machine + byte order. + + The getnetbyname() function and getnetbyaddr() sequentially search + from the beginning of the file until a matching net name or net + address and type is found, or until EOF is encountered. Network + numbers are supplied in host order. + + RESULT + Null pointer (0) returned on EOF or error. + + BUGS + The data space used by these functions is static; if future use + requires the data, it should be copied before any subsequent calls to + these functions overwrite it. Only Internet network numbers are + currently understood. Expecting network numbers to fit in no more + than 32 bits is probably naive. + + bsdsocket.library/getnetbyname bsdsocket.library/getnetbyname + + NAME + getnetbyname - get network entry + + SYNOPSIS + #include + + netent = getnetbyname(name) + D0 A0 + + struct netent * getnetbyname(char *name); + + FUNCTION + The getnetbyname() and getnetbyaddr() functions each return a pointer + to an object with the following structure containing the broken-out + fields of a line in the network data base. + + struct netent { + char *n_name; /* official name of net */ + char **n_aliases; /* alias list */ + long n_addrtype; /* net number type */ + unsigned long n_net; /* net number */ + }; + + The members of this structure are: + + n_name + The official name of the network. + + n_aliases + A zero terminated list of alternate names for the network. + + n_addrtype + The type of the network number returned; currently only + AF_INET. + + n_net + The network number. Network numbers are returned in machine + byte order. + + The getnetbyname() function and getnetbyaddr() sequentially search + from the beginning of the file until a matching net name or net + address and type is found, or until EOF is encountered. Network + numbers are supplied in host order. + + RESULT + Null pointer (0) returned on EOF or error. + + BUGS + The data space used by these functions is static; if future use + requires the data, it should be copied before any subsequent calls to + these functions overwrite it. Only Internet network numbers are + currently understood. Expecting network numbers to fit in no more + than 32 bits is probably naive. + + bsdsocket.library/getnetent bsdsocket.library/getnetent + + NAME + getnetent - get network entry + + SYNOPSIS + #include + + entry = getnetent() + D0 + + struct netent * getnetent(void); + + FUNCTION + The getnetent() function reads the next line of the net database, + opening the database if necessary. + + RESULT + Null pointer (0) returned on EOF or error. + + SEE ALSO + endnetent(), getnetbyaddr(), getnetbyname(), setnetent() + + BUGS + The data space used by these functions is static; if future use + requires the data, it should be copied before any subsequent calls to + these functions overwrite it. Only Internet network numbers are + currently understood. Expecting network numbers to fit in no more + than 32 bits is probably naive. + + NOTES + The getnetent() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_LOCAL_DATABASE_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/GetNetworkStatistics bsdsocket.library/GetNetworkStatistics + + NAME + GetNetworkStatistics - Obtain network usage statistics + + SYNOPSIS + length = GetNetworkStatistics(type,version,destination,size) + D0 D0 D1 A0 D2 + + LONG GetNetworkStatistics(LONG type,LONG version, + APTR destination,LONG size); + + FUNCTION + This function will provide a local copy of internal statistics + information maintained by the protocol stack. Different kinds of + statistics are available, each covering different aspects of the + implementation. + + INPUTS + type -- The type of information to be returned. This must be + one of NETSTATUS_icmp, NETSTATUS_igmp, NETSTATUS_ip, + NETSTATUS_mb, NETSTATUS_mrt, NETSTATUS_rt, NETSTATUS_tcp, + NETSTATUS_udp, NETSTATUS_tcp_sockets or NETSTATUS_udp_sockets. + + version -- Since the data structures to be returned can change + as new protocol stack implementations are released, you + must specify which version of the data structures you need + to see. The version described in this documentation is 1. + + destination -- Points to the memory where the data should be + stored. Pass a NULL pointer to find out how much memory + would be required for a complete copy of the data you + requested. + + size -- Number of bytes to copy from the internal data + structures to the destination memory. + + TYPES + NETSTATUS_icmp - Internet control message protocol statistics + The statistics data will be of the following format: + + struct icmpstat + { + /* statistics related to icmp packets generated */ + ULONG icps_error; /* # of calls to icmp_error */ + ULONG icps_oldshort; /* no error 'cuz old ip too short */ + ULONG icps_oldicmp; /* no error 'cuz old was icmp */ + ULONG icps_outhist[ICMP_MAXTYPE + 1]; + + /* statistics related to input messages processed */ + ULONG icps_badcode; /* icmp_code out of range */ + ULONG icps_tooshort; /* packet < ICMP_MINLEN */ + ULONG icps_checksum; /* bad checksum */ + ULONG icps_badlen; /* calculated bound mismatch */ + ULONG icps_reflect; /* number of responses */ + ULONG icps_inhist[ICMP_MAXTYPE + 1]; + }; + + NETSTATUS_igmp - Internet group management protocol statistics + The statistics data will be of the following format: + + struct igmpstat + { + ULONG igps_rcv_total; /* total IGMP messages received */ + ULONG igps_rcv_tooshort; /* received with too few bytes */ + ULONG igps_rcv_badsum; /* received with bad checksum */ + ULONG igps_rcv_queries; /* received membership queries */ + ULONG igps_rcv_badqueries; /* received invalid queries */ + ULONG igps_rcv_reports; /* received membership reports */ + ULONG igps_rcv_badreports; /* received invalid reports */ + ULONG igps_rcv_ourreports; /* received reports for our groups */ + ULONG igps_snd_reports; /* sent membership reports */ + }; + + NETSTATUS_ip - Internet protocol statistics + The statistics data will be of the following format: + + struct ipstat + { + ULONG ips_total; /* total packets received */ + ULONG ips_badsum; /* checksum bad */ + ULONG ips_tooshort; /* packet too short */ + ULONG ips_toosmall; /* not enough data */ + ULONG ips_badhlen; /* ip header length < data size */ + ULONG ips_badlen; /* ip length < ip header length */ + ULONG ips_fragments; /* fragments received */ + ULONG ips_fragdropped; /* frags dropped (dups, out of space) */ + ULONG ips_fragtimeout; /* fragments timed out */ + ULONG ips_forward; /* packets forwarded */ + ULONG ips_cantforward; /* packets rcvd for unreachable dest */ + ULONG ips_redirectsent; /* packets forwarded on same net */ + ULONG ips_noproto; /* unknown or unsupported protocol */ + ULONG ips_delivered; /* datagrams delivered to upper level*/ + ULONG ips_localout; /* total ip packets generated here */ + ULONG ips_odropped; /* lost packets due to nobufs, etc. */ + ULONG ips_reassembled; /* total packets reassembled ok */ + ULONG ips_fragmented; /* datagrams sucessfully fragmented */ + ULONG ips_ofragments; /* output fragments created */ + ULONG ips_cantfrag; /* don't fragment flag was set, etc. */ + ULONG ips_badoptions; /* error in option processing */ + ULONG ips_noroute; /* packets discarded due to no route */ + ULONG ips_badvers; /* ip version != 4 */ + ULONG ips_rawout; /* total raw ip packets generated */ + }; + + NETSTATUS_mb - Memory buffer statistics + The statistics data will be of the following format: + + struct mbstat + { + ULONG m_mbufs; /* mbufs obtained from page pool */ + ULONG m_clusters; /* clusters obtained from page pool */ + ULONG m_spare; /* spare field */ + ULONG m_clfree; /* free clusters */ + ULONG m_drops; /* times failed to find space */ + ULONG m_wait; /* times waited for space */ + ULONG m_drain; /* times drained protocols for space */ + }; + + NETSTATUS_mrt - Multicast routing statistics + The statistics data will be of the following format: + + struct mrtstat + { + ULONG mrts_mrt_lookups; /* # multicast route lookups */ + ULONG mrts_mrt_misses; /* # multicast route cache misses */ + ULONG mrts_grp_lookups; /* # group address lookups */ + ULONG mrts_grp_misses; /* # group address cache misses */ + ULONG mrts_no_route; /* no route for packet's origin */ + ULONG mrts_bad_tunnel; /* malformed tunnel options */ + ULONG mrts_cant_tunnel; /* no room for tunnel options */ + ULONG mrts_wrong_if; /* arrived on the wrong interface */ + }; + + NETSTATUS_rt - Routing statistics + The statistics data will be of the following format: + + struct rtstat + { + WORD rts_badredirect; /* bogus redirect calls */ + WORD rts_dynamic; /* routes created by redirects */ + WORD rts_newgateway; /* routes modified by redirects */ + WORD rts_unreach; /* lookups which failed */ + WORD rts_wildcard; /* lookups satisfied by a wildcard */ + }; + + NETSTATUS_tcp - Transmission control protocol statistics + The statistics data will be of the following format: + + struct tcpstat + { + ULONG tcps_connattempt; /* connections initiated */ + ULONG tcps_accepts; /* connections accepted */ + ULONG tcps_connects; /* connections established */ + ULONG tcps_drops; /* connections dropped */ + ULONG tcps_conndrops; /* embryonic connections dropped */ + ULONG tcps_closed; /* conn. closed (includes drops) */ + ULONG tcps_segstimed; /* segs where we tried to get rtt */ + ULONG tcps_rttupdated; /* times we succeeded */ + ULONG tcps_delack; /* delayed acks sent */ + ULONG tcps_timeoutdrop; /* conn. dropped in rxmt timeout */ + ULONG tcps_rexmttimeo; /* retransmit timeouts */ + ULONG tcps_persisttimeo; /* persist timeouts */ + ULONG tcps_keeptimeo; /* keepalive timeouts */ + ULONG tcps_keepprobe; /* keepalive probes sent */ + ULONG tcps_keepdrops; /* connections dropped in keepalive */ + + ULONG tcps_sndtotal; /* total packets sent */ + ULONG tcps_sndpack; /* data packets sent */ + ULONG tcps_sndbyte; /* data bytes sent */ + ULONG tcps_sndrexmitpack; /* data packets retransmitted */ + ULONG tcps_sndrexmitbyte; /* data bytes retransmitted */ + ULONG tcps_sndacks; /* ack-only packets sent */ + ULONG tcps_sndprobe; /* window probes sent */ + ULONG tcps_sndurg; /* packets sent with URG only */ + ULONG tcps_sndwinup; /* window update-only packets sent */ + ULONG tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */ + + ULONG tcps_rcvtotal; /* total packets received */ + ULONG tcps_rcvpack; /* packets received in sequence */ + ULONG tcps_rcvbyte; /* bytes received in sequence */ + ULONG tcps_rcvbadsum; /* packets received with ccksum errs */ + ULONG tcps_rcvbadoff; /* packets received with bad offset */ + ULONG tcps_rcvshort; /* packets received too short */ + ULONG tcps_rcvduppack; /* duplicate-only packets received */ + ULONG tcps_rcvdupbyte; /* duplicate-only bytes received */ + ULONG tcps_rcvpartduppack; /* packets with some duplicate data */ + ULONG tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */ + ULONG tcps_rcvoopack; /* out-of-order packets received */ + ULONG tcps_rcvoobyte; /* out-of-order bytes received */ + ULONG tcps_rcvpackafterwin; /* packets with data after window */ + ULONG tcps_rcvbyteafterwin; /* bytes rcvd after window */ + ULONG tcps_rcvafterclose; /* packets rcvd after "close" */ + ULONG tcps_rcvwinprobe; /* rcvd window probe packets */ + ULONG tcps_rcvdupack; /* rcvd duplicate acks */ + ULONG tcps_rcvacktoomuch; /* rcvd acks for unsent data */ + ULONG tcps_rcvackpack; /* rcvd ack packets */ + ULONG tcps_rcvackbyte; /* bytes acked by rcvd acks */ + ULONG tcps_rcvwinupd; /* rcvd window update packets */ + ULONG tcps_pawsdrop; /* segments dropped due to PAWS */ + ULONG tcps_predack; /* times hdr predict ok for acks */ + ULONG tcps_preddat; /* times hdr predict ok for data pkts */ + ULONG tcps_pcbcachemiss; + ULONG tcps_persistdrop; /* timeout in persist state */ + ULONG tcps_badsyn; /* bogus SYN, e.g. premature ACK */ + }; + + NETSTATUS_udp - User datagram protocol statistics + The statistics data will be of the following format: + + struct udpstat + { + /* input statistics: */ + ULONG udps_ipackets; /* total input packets */ + ULONG udps_hdrops; /* packet shorter than header */ + ULONG udps_badsum; /* checksum error */ + ULONG udps_badlen; /* data length larger than packet */ + ULONG udps_noport; /* no socket on port */ + ULONG udps_noportbcast; /* of above, arrived as broadcast */ + ULONG udps_fullsock; /* not delivered, input socket full */ + ULONG udpps_pcbcachemiss; /* input packets missing pcb cache */ + + /* output statistics: */ + ULONG udps_opackets; /* total output packets */ + }; + + NETSTATUS_tcp_sockets - Information on all TCP connections; the + data will be in the following format (one such entry for each + connection): + + struct protocol_connection_data + { + struct in_addr pcd_foreign_address; /* Foreign host + address */ + UWORD pcd_foreign_port; /* Foreign port number */ + struct in_addr pcd_local_address; /* Local host address */ + UWORD pcd_local_port; /* Local port number */ + ULONG pcd_receive_queue_size; /* Socket receive + queue size */ + ULONG pcd_send_queue_size; /* Socket send + queue size */ + LONG pcd_tcp_state; /* Socket TCP state */ + }; + + The 'pcd_tcp_state' member will contain the socket's TCP + state, as defined in . Note that this + can be -1 if the case cannot be safely determined. + + NETSTATUS_udp_sockets - Information on all UDP sockets; the + data will be in the same format as with 'NETSTATUS_tcp_sockets'. + However, the 'pcd_tcp_state' member of each entry will be -1 + since that information is valid only for TCP. + + RESULT + length -- Number of bytes copied, or -1 for failure. The failure + code will be stored in the 'errno' variable. + + NOTES + The GetNetworkStatistics() call is an extension to the AmiTCP V4 + API and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_STATUS_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/getpeername bsdsocket.library/getpeername + + NAME + getpeername - get name of connected peer + + SYNOPSIS + success = getpeername(s, name,namelen) + D0 D0 A0 A1 + + long getpeername(long s, struct sockaddr *name, long *namelen); + + FUNCTION + getpeername() returns the name of the peer connected to socket s. The + namelen parameter should be initialized to indicate the amount of + space pointed to by name. On return it contains the actual size of + the name returned (in bytes). The name is truncated if the buffer + provided is too small. + + RESULT + A 0 is returned if the call succeeds, -1 if it fails. + + ERRORS + The call succeeds unless: + + [EBADF] + The argument s is not a valid descriptor. + + [ENOTSOCK] + The argument s is a file, not a socket. + + [ENOTCONN] + The socket is not connected. + + [ENOBUFS] + Insufficient resources were available in the system to + perform the operation. + + [EFAULT] + The name parameter points to memory not in a valid part of + the process address space. + + SEE ALSO + accept(), bind(), socket(), getsockname() + + bsdsocket.library/getprotobyname bsdsocket.library/getprotobyname + + NAME + getprotobyname - get protocol entry + + SYNOPSIS + #include + + protoent = getprotobyname(name) + D0 A0 + + struct protoent * getprotobyname(char *name); + + FUNCTION + The getprotobyname() and getprotobynumber() functions each return a + pointer to an object with the following structure containing the + broken-out fields of a line in the network protocol data base. + + struct protoent { + char *p_name; /* official name of protocol */ + char **p_aliases; /* alias list */ + long p_proto; /* protocol number */ + }; + + The members of this structure are: + + p_name + The official name of the protocol. + + p_aliases + A zero terminated list of alternate names for the protocol. + + p_proto + The protocol number. + + The getprotobyname() function and getprotobynumber() sequentially + search from the beginning of the file until a matching protocol name + or protocol number is found, or until EOF is encountered. + + RESULT + Null pointer (0) returned on EOF or error. + + BUGS + These functions use a static data space; if the data is needed for + future use, it should be copied before any subsequent calls overwrite + it. Only the Internet protocols are currently understood. + + bsdsocket.library/getprotobynumber bsdsocket.library/getprotobynumber + + NAME + getprotobynumber - get protocol entry + + SYNOPSIS + #include + + protoent = getprotobynumber(proto) + D0 D0 + + struct protoent * getprotobynumber(long proto); + + FUNCTION + The getprotobyname() and getprotobynumber() functions each return a + pointer to an object with the following structure containing the + broken-out fields of a line in the network protocol data base. + + struct protoent { + char *p_name; /* official name of protocol */ + char **p_aliases; /* alias list */ + long p_proto; /* protocol number */ + }; + + The members of this structure are: + + p_name + The official name of the protocol. + + p_aliases + A zero terminated list of alternate names for the protocol. + + p_proto + The protocol number. + + The getprotobyname() function and getprotobynumber() sequentially + search from the beginning of the file until a matching protocol name + or protocol number is found, or until EOF is encountered. + + RESULT + Null pointer (0) returned on EOF or error. + + BUGS + These functions use a static data space; if the data is needed for + future use, it should be copied before any subsequent calls overwrite + it. Only the Internet protocols are currently understood. + + bsdsocket.library/getprotoent bsdsocket.library/getprotoent + + NAME + getprotoent - get protocol entry + + SYNOPSIS + #include + + entry = getprotoent() + D0 + + struct protoent * getprotoent(void); + + FUNCTION + The getprotoent() function reads the next line of the protocol, + database, opening the database file if necessary. + + RESULT + Null pointer (0) returned on EOF or error. + + SEE ALSO + endprotoent(), getprotobynumber(), getprotobyname(), setprotoent() + + BUGS + These functions use a static data space; if the data is needed for + future use, it should be copied before any subsequent calls overwrite + it. Only the Internet protocols are currently understood. + + NOTES + The getprotoent() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_LOCAL_DATABASE_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/GetRouteInfo bsdsocket.library/GetRouteInfo + + NAME + GetRouteInfo - Obtain information on the routing tables. + + SYNOPSIS + table = GetRouteInfo(address_family, flags) + D0 D0 D1 + + struct rt_msghdr *GetRouteInfo(LONG address_family, LONG flags); + + FUNCTION + This function will make a copy of the kernel's routing tables + and return it to you for inspection. Each table entry takes the + shape of a 'struct rt_msghdr'. + + INPUTS + address_family -- The address family to obtain routing information + for; this can be AF_UNSPEC or AF_INET. + + flags -- Flags which have to be set in each routing table entry + to be returned (a combination of RTF_UP, RTF_GATEWAY, RTF_HOST, + RTF_REJECT, RTF_DYNAMIC, RTF_MODIFIED, RTF_DONE, RTF_MASK, + RTF_CLONING, RTF_XRESOLVE, RTF_LLINFO, RTF_STATIC or + RTF_BLACKHOLE). A 'flags' value of 0 will cause the entire + routing table to be returned. + + RESULT + success -- a pointer to a copy of the routing table information + or NULL for failure; the failure code will be stored in the + 'errno' variable. + + Each table entry has the following format (see ): + + struct rt_msghdr { + u_short rtm_msglen; + u_char rtm_version; + u_char rtm_type; + u_short rtm_index; + pid_t rtm_pid; + int rtm_addrs; + int rtm_seq; + int rtm_errno; + int rtm_flags; + int rtm_use; + u_long rtm_inits; + struct rt_metrics rtm_rmx; + }; + + The table is terminated by a dummy entry whose 'rtm_msglen' + member is zero. + + NOTES + The GetRouteInfo() call is an extension to the AmiTCP V4 API + and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_ROUTING_API tag with the + SocketBaseTagList() function. + + The format and layout of the data to be returned may change. + Check the 'rtm_version' member of each table entry to verify that + your code is really referring to the expected information. The + 'struct rt_msghdr' layout described above corresponds to version 3. + + SEE ALSO + FreeRouteInfo(), route + + bsdsocket.library/getservbyname bsdsocket.library/getservbyname + + NAME + getservbyname - get service entry + + SYNOPSIS + #include + + servent = getservbyname(name, proto) + D0 A0 A1 + + struct servent * getservbyname(char *name, char *proto); + + FUNCTION + The getservbyname() and getservbyport() functions each return a + pointer to an object with the following structure containing the + broken-out fields of a line in the network services data base. + + struct servent { + char *s_name; /* official name of service */ + char **s_aliases; /* alias list */ + long s_port; /* port service resides at */ + char *s_proto; /* protocol to use */ + }; + + The members of this structure are: + + s_name + The official name of the service. + + s_aliases + A zero terminated list of alternate names for the service. + + s_port + The port number at which the service resides. Port numbers + are returned in network byte order. + + s_proto + The name of the protocol to use when contacting the service. + + The getservbyname() and getservbyport() functions sequentially search + from the beginning of the file until a matching protocol name or port + number is found, or until EOF is encountered. If a protocol name is + also supplied (non-NULL), searches must also match the protocol. + + RESULT + Null pointer (0) returned on EOF or error. + + SEE ALSO + getservent(), setservent(), endservent() + + BUGS + These functions use static data storage; if the data is needed for + future use, it should be copied before any subsequent calls overwrite + it. Expecting port numbers to fit in a 32 bit quantity is probably + naive. + + bsdsocket.library/getservbyport bsdsocket.library/getservbyport + + NAME + getservbyport - get service entry + + SYNOPSIS + #include + + servent = getservbyport(port, proto) + D0 D0 A0 + + struct servent * getservbyport(long port, char *proto); + + FUNCTION + The getservbyname() and getservbyport() functions each return a + pointer to an object with the following structure containing the + broken-out fields of a line in the network services data base. + + struct servent { + char *s_name; /* official name of service */ + char **s_aliases; /* alias list */ + long s_port; /* port service resides at */ + char *s_proto; /* protocol to use */ + }; + + The members of this structure are: + + s_name + The official name of the service. + + s_aliases + A zero terminated list of alternate names for the service. + + s_port + The port number at which the service resides. Port numbers + are returned in network byte order. + + s_proto + The name of the protocol to use when contacting the service. + + The getservbyname() and getservbyport() functions sequentially search + from the beginning of the file until a matching protocol name or port + number is found, or until EOF is encountered. If a protocol name is + also supplied (non-NULL), searches must also match the protocol. + + RESULT + Null pointer (0) returned on EOF or error. + + BUGS + These functions use static data storage; if the data is needed for + future use, it should be copied before any subsequent calls overwrite + it. Expecting port numbers to fit in a 32 bit quantity is probably + naive. + + bsdsocket.library/getservent bsdsocket.library/getservent + + NAME + getservent - get service entry + + SYNOPSIS + #include + + entry = getservent() + D0 + + struct servent * getservent(void); + + FUNCTION + The getservent() function reads the next line of the service + database, opening the database if necessary. + + RESULT + Null pointer (0) returned on EOF or error. + + SEE ALSO + setservent(), getservbyname(), getservbyport(), endservent() + + BUGS + These functions use static data storage; if the data is needed for + future use, it should be copied before any subsequent calls overwrite + it. Expecting port numbers to fit in a 32 bit quantity is probably + naive. + + NOTES + The getservent() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_LOCAL_DATABASE_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/GetSocketEvents bsdsocket.library/GetSocketEvents + + NAME + GetSocketEvents - get the next asynchronous event triggered by + socket I/O [AmiTCP V4] + + SYNOPSIS + socket = GetSocketEvents(events_ptr) + D0 A0 + + long GetSocketEvents(ULONG * events_ptr); + + FUNCTION + GetSocketEvents() returns the next asynchronous event for sockets, + and removes it from the internal queue. The socket number for which + the event has occured is returned. If no asynchronous event is + pending then -1 is returned. + + Applications are notified of asynchronous events through the event + signal (which has to be set earlier by calling SocketBaseTags() with + the SBTC_SIGEVENTMASK tag). + + Several different events can occur for each socket. To enable + reporting of specific events for a socket call setsockopt() with the + option SO_EVENTMASK. After calling GetSocketEvents() the ULONG + pointed to by events_ptr contains the mask of all events that have + occured for the returned socket. + + Possible events include: + + FD_ACCEPT + A new connection is waiting to be accepted. The kernel keeps + track of each pending connection. If more than one connection + is pending then the kernel immediately generates a new FD_ACCEPT + event until all pending connections are accounted for. + + FD_CLOSE + The connection was closed. If it was closed due to an error + then the FD_ERROR event is set as well. + + FD_CONNECT + A pending connection has been established. This event is + an indication that a non-blocking connect() has been completed. + + FD_ERROR + An asynchronous error has occured. When this event is found, + the 'errno' variable will be set to the error code associated + with the socket which triggered the error event. The error + code associated with the socket is not cleared. Use the + getsockopt(socket,SO_ERROR,..) function to do that, which + will read and clear the error code. + + FD_OOB + New out-of-band data is available for reading. + + FD_READ + New data is available for reading. + + FD_WRITE + The socket is able to accept data for writing again without + blocking (only for non-blocking sockets). + + RESULT + The value -1 is returned if no asynchronous events are pending. + Otherwise, a socket descriptor number will be returned. + + SEE ALSO + setsockopt(), getsockopt() + + bsdsocket.library/getsockname bsdsocket.library/getsockname + + NAME + getsockname - get socket name + + SYNOPSIS + success = getsockname(s, name, namelen) + D0 D0 A0 A1 + + long getsockname(long s, struct sockaddr *name, long *namelen); + + FUNCTION + getsockname() returns the current name for the specified socket. The + namelen parameter should be initialized to indicate the amount of + space pointed to by name. On return it contains the actual size of + the name returned (in bytes). + + RESULT + A 0 is returned if the call succeeds, -1 if it fails. + + ERRORS + The call succeeds unless: + + [EBADF] + The argument s is not a valid descriptor. + + [ENOTSOCK] + The argument s is not a socket. + + [ENOBUFS] + Insufficient resources were available in the system to perform + the operation. + + [EFAULT] + The name parameter points to memory not in a valid part of + the process address space. + + SEE ALSO + bind(), socket() + + bsdsocket.library/getsockopt bsdsocket.library/getsockopt + + NAME + getsockopt - get options on sockets + + SYNOPSIS + #include + #include + + success = getsockopt(s, level, optname, optval, optlen) + D0 D0 D1 D2 A0 A1 + + long getsockopt(long s, long level, long optname, + void *optval, long *optlen); + + FUNCTION + getsockopt() and setsockopt() manipulate the options associated with + a socket. Options may exist at multiple protocol levels; they are + always present at the uppermost ``socket'' level. + + When manipulating socket options the level at which the option + resides and the name of the option must be specified. To manipulate + options at the socket level, level is specified as SOL_SOCKET. To + manipulate options at any other level the protocol number of the + appropriate protocol controlling the option is supplied. For example, + to indicate that an option is to be interpreted by the TCP protocol, + level should be set to the protocol number of TCP. + + The parameters optval and optlen are used to access option values for + setsockopt(). For getsockopt() they identify a buffer in which the + value for the requested option(s) are to be returned. For + getsockopt(), optlen is a value-result parameter, initially + containing the size of the buffer pointed to by optval, and modified + on return to indicate the actual size of the value returned. If no + option value is to be supplied or returned, optval may be NULL. + + Optname and any specified options are passed uninterpreted to the + appropriate protocol module for interpretation. The include file + contains definitions for socket level options, + described below. Options at other protocol levels vary in format and + name; consult the appropriate entries in section 4 of the manual. + + Most socket-level options utilize an int parameter for optval. For + setsockopt(), the parameter should be non-zero to enable a boolean + option, or zero if the option is to be disabled. SO_LINGER uses a + struct linger parameter, defined in , which specifies + the desired state of the option and the linger interval (see below). + SO_SNDTIMEO and SO_RCVTIMEO use a struct timeval parameter, defined + in . + + The following options are recognized at the socket level. Except as + noted, each may be examined with getsockopt() and set with + setsockopt(). + + SO_DEBUG + enables recording of debugging information + SO_REUSEADDR + enables local address reuse + SO_REUSEPORT + enables duplicate address and port bindings + SO_KEEPALIVE + enables keep connections alive + SO_DONTROUTE + enables routing bypass for outgoing messages + SO_LINGER + linger on close if data present + SO_BROADCAST + enables permission to transmit broadcast messages + SO_OOBINLINE + enables reception of out-of-band data in band + SO_SNDBUF + set buffer size for output + SO_RCVBUF + set buffer size for input + + SO_SNDLOWAT + set minimum count for output + SO_RCVLOWAT + set minimum count for input + SO_SNDTIMEO + set timeout value for output + SO_RCVTIMEO + set timeout value for input + SO_TYPE + get the type of the socket (get only) + SO_ERROR + get and clear error on the socket (get only) + + SO_DEBUG enables debugging in the underlying protocol modules. + SO_REUSEADDR indicates that the rules used in validating addresses + supplied in a bind() call should allow reuse of local addresses. + SO_REUSEPORT allows completely duplicate bindings by multiple + processes if they all set SO_REUSEPORT before binding the port. This + option permits multiple instances of a program to each receive UDP/IP + multicast or broadcast datagrams destined for the bound port. + SO_KEEPALIVE enables the periodic transmission of messages on a + connected socket. SO_DONTROUTE indicates that outgoing messages should + bypass the standard routing facilities. Instead, messages are directed + to the appropriate network interface according to the network portion + of the destination address. + + SO_LINGER controls the action taken when unsent messages are queued + on socket and a CloseSocket() is performed. If the socket promises + reliable delivery of data and SO_LINGER is set, the system will block + the process on the close attempt until it is able to transmit the + data or until it decides it is unable to deliver the information (a + timeout period, termed the linger interval, is specified in seconds + in the setsockopt() call when SO_LINGER is requested). If SO_LINGER + is disabled and a close is issued, the system will process the close + in a manner that allows the process to continue as quickly as + possible. + + The option SO_BROADCAST requests permission to send broadcast + datagrams on the socket. Broadcast was a privileged operation in + earlier versions of the system. With protocols that support + out-of-band data, the SO_OOBINLINE option requests that out-of-band + data be placed in the normal data input queue as received; it will + then be accessible with recv or read calls without the MSG_OOB flag. + Some protocols always behave as if this option is set. SO_SNDBUF and + SO_RCVBUF are options to adjust the normal buffer sizes allocated for + output and input buffers, respectively. The buffer size may be + increased for high-volume connections, or may be decreased to limit + the possible backlog of incoming data. The system places an absolute + limit on these values. + + SO_SNDLOWAT is an option to set the minimum count for output + operations. Most output operations process all of the data supplied + by the call, delivering data to the protocol for transmission and + blocking as necessary for flow control. Nonblocking output operations + will process as much data as permitted subject to flow control + without blocking, but will process no data if flow control does not + allow the smaller of the low water mark value or the entire request + to be processed. A WaitSelect() operation testing the ability to + write to a socket will return true only if the low water mark amount + could be processed. The default value for SO_SNDLOWAT is set to a + convenient size for network efficiency, often 1024. SO_RCVLOWAT is an + option to set the minimum count for input operations. In general, + receive calls will block until any (non-zero) amount of data is + received, then return with the smaller of the amount available or the + amount requested. The default value for SO_RCVLOWAT is 1. If + SO_RCVLOWAT is set to a larger value, blocking receive calls normally + wait until they have received the smaller of the low water mark value + or the requested amount. Receive calls may still return less than the + low water mark if an error occurs, a signal is caught, or the type of + data next in the receive queue is different than that returned. + + SO_SNDTIMEO is an option to set a timeout value for output + operations. It accepts a struct timeval parameter with the number of + seconds and microseconds used to limit waits for output operations to + complete. If a send operation has blocked for this much time, it + returns with a partial count or with the error EWOULDBLOCK if no data + were sent. In the current implementation, this timer is restarted + each time additional data are delivered to the protocol, implying + that the limit applies to output portions ranging in size from the + low water mark to the high water mark for output. SO_RCVTIMEO is an + option to set a timeout value for input operations. It accepts a + struct timeval parameter with the number of seconds and microseconds + used to limit waits for input operations to complete. In the current + implementation, this timer is restarted each time additional data are + received by the protocol, and thus the limit is in effect an + inactivity timer. If a receive operation has been blocked for this + much time without receiving additional data, it returns with a short + count or with the error EWOULDBLOCK if no data were received. + + Finally, SO_TYPE and SO_ERROR are options used only with + getsockopt(). SO_TYPE returns the type of the socket, such as + SOCK_STREAM; it is useful for servers that inherit sockets on + startup. SO_ERROR returns any pending error on the socket and clears + the error status. It may be used to check for asynchronous errors on + connected datagram sockets or for other asynchronous errors. + + RESULT + A 0 is returned if the call succeeds, -1 if it fails. + + ERRORS + The call succeeds unless: + + [EBADF] + The argument s is not a valid descriptor. + + [ENOTSOCK] + The argument s is a file, not a socket. + + [ENOPROTOOPT] + The option is unknown at the level indicated. + + [EFAULT] + The address pointed to by optval is not in a valid part of + the process address space. For getsockopt(), this error + may also be returned if optlen is not in a valid part of + the process address space. + + SEE ALSO + IoctlSocket(), socket() + + bsdsocket.library/In_CanForward bsdsocket.library/In_CanForward + + NAME + In_CanForward - Determine whether an IP address is in a reserved + set of addresses that may not be forwarded, or whether datagrams + to that destination may be forwarded. + + SYNOPSIS + #include + + result = In_CanForward(address) + D0 D0 + + LONG In_CanForward(ULONG address); + + FUNCTION + The In_CanForward() routine will check if an IP address is in a + reserved set of addresses that may not be forwarded, or whether + datagrams to that destination may be forwarded. + + This should not be confused with the set of addresses reserved + for use in private internets (as described in RFC1918). + + INPUTS + address -- The internet address to be tested. + + RESULT + Returns 1 if datagrams may be forwarded to the address and 0 + otherwise. + + NOTES + The In_CanForward() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_ADDRESS_CONVERSION_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/In_LocalAddr bsdsocket.library/In_LocalAddr + + NAME + In_LocalAddr - Check if an internet address is for a 'local' + host. + + SYNOPSIS + #include + + result = In_LocalAddr(address) + D0 D0 + + LONG In_LocalAddr(ULONG address); + + FUNCTION + The In_LocalAddr() routine will check if an internet address + is for a 'local' host (one to which we have a connection). + + INPUTS + address -- The internet address to be tested. + + RESULT + Returns 1 if the address was for a local host and 0 + otherwise. + + NOTES + The In_LocalAddr() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_ADDRESS_CONVERSION_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/inet_addr bsdsocket.library/inet_addr + + NAME + inet_addr - Internet address manipulation + + SYNOPSIS + #include + #include + #include + + addr = inet_addr(cp) + D0 A0 + + unsigned long inet_addr(char *cp); + + FUNCTION + The routines inet_aton(), inet_addr() and inet_network() interpret + character strings representing numbers expressed in the Internet + standard `.' notation. The inet_aton() routine interprets the + specified character string as an Internet address, placing the + address into the structure provided. It returns 1 if the string was + successfully interpreted, or 0 if the string is invalid. The + inet_addr() and inet_network() functions return numbers suitable for + use as Internet addresses and Internet net work numbers, + respectively. The routine Inet_NtoA() takes an Internet address and + returns an ASCII string representing the address in `.' notation. The + routine inet_makeaddr() takes an Internet network number and a local + network address and constructs an Internet address from it. The + routines inet_netof() and inet_lnaof() break apart Internet host + addresses, returning the network number and local network address + part, respectively. + + All Internet addresses are returned in network order (bytes ordered + from left to right). All network numbers and local address parts are + returned as machine format integer values. + + INTERNET ADDRESSES + Values specified using the `.' notation take one of the following + forms: + + a.b.c.d + a.b.c + a.b + a + + When four parts are specified, each is interpreted as a byte of data + and assigned, from left to right, to the four bytes of an Internet + address. + + When a three part address is specified, the last part is interpreted + as a 16-bit quantity and placed in the right-most two bytes of the + network address. This makes the three part address format convenient + for specifying Class B network addresses as ``128.net.host''. + + When a two part address is supplied, the last part is interpreted as + a 24-bit quantity and placed in the right most three bytes of the + network address. This makes the two part address format convenient + for specifying Class A network addresses as ``net.host''. + + When only one part is given, the value is stored directly in the + network address without any byte rearrangement. + + All numbers supplied as ``parts'' in a `.' notation may be decimal, + octal, or hexadecimal, as specified in the C language (i.e., a + leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies + octal; otherwise, the number is interpreted as decimal). + + RESULT + The constant INADDR_NONE is returned by inet_addr() and inet_network() + for malformed requests. + + SEE ALSO + gethostbyname() + + BUGS + The value INADDR_NONE (0xffffffff) is a valid broadcast address, but + inet_addr() cannot return that value without indicating failure. The + newer inet_aton() function does not share this problem. The problem + of host byte ordering versus network byte ordering is confusing. The + string returned by Inet_NtoA() resides in a static memory area. + + bsdsocket.library/inet_aton bsdsocket.library/inet_aton + + NAME + inet_aton - Internet address manipulation + + SYNOPSIS + #include + #include + #include + + valid = inet_aton(cp,addr) + D0 A0 A1 + + long inet_aton(char *cp,struct in_addr *addr); + + FUNCTION + The routines inet_aton(), inet_addr() and inet_network() interpret + character strings representing numbers expressed in the Internet + standard `.' notation. The inet_aton() routine interprets the + specified character string as an Internet address, placing the + address into the structure provided. It returns 1 if the string was + successfully interpreted, or 0 if the string is invalid. + + All Internet addresses are returned in network order (bytes ordered + from left to right). All network numbers and local address parts are + returned as machine format integer values. + + INTERNET ADDRESSES + Values specified using the `.' notation take one of the following + forms: + + a.b.c.d + a.b.c + a.b + a + + When four parts are specified, each is interpreted as a byte of data + and assigned, from left to right, to the four bytes of an Internet + address. + + When a three part address is specified, the last part is interpreted + as a 16-bit quantity and placed in the right-most two bytes of the + network address. This makes the three part address format convenient + for specifying Class B network addresses as ``128.net.host''. + + When a two part address is supplied, the last part is interpreted as + a 24-bit quantity and placed in the right most three bytes of the + network address. This makes the two part address format convenient + for specifying Class A network addresses as ``net.host''. + + When only one part is given, the value is stored directly in the + network address without any byte rearrangement. + + All numbers supplied as ``parts'' in a `.' notation may be decimal, + octal, or hexadecimal, as specified in the C language (i.e., a + leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies + octal; otherwise, the number is interpreted as decimal). + + RESULT + Returns 1 if the IP address was valid, and initializes the address + pointed to by the second parameter, or 0 for an invalid IP address. + + SEE ALSO + gethostbyname(), inet_addr() + + NOTES + The inet_aton() call is an extension to the AmiTCP V4 API and cannot + be assumed to be present in all versions of "bsdsocket.library". To + find out whether your library version supports it, use the + SBTC_HAVE_ADDRESS_CONVERSION_API tag with the SocketBaseTagList() + function. + + bsdsocket.library/Inet_LnaOf bsdsocket.library/Inet_LnaOf + + NAME + Inet_LnaOf - Internet address manipulation + + SYNOPSIS + #include + #include + #include + + lna = Inet_LnaOf(in) + D0 D0 + + unsigned long Inet_LnaOf(unsigned long in); + + FUNCTION + The routines inet_aton(), inet_addr() and inet_network() interpret + character strings representing numbers expressed in the Internet + standard `.' notation. The inet_aton() routine interprets the + specified character string as an Internet address, placing the + address into the structure provided. It returns 1 if the string was + successfully interpreted, or 0 if the string is invalid. The + inet_addr() and inet_network() functions return numbers suitable for + use as Internet addresses and Internet net work numbers, + respectively. The routine Inet_NtoA() takes an Internet address and + returns an ASCII string representing the address in `.' notation. The + routine inet_makeaddr() takes an Internet network number and a local + network address and constructs an Internet address from it. The + routines inet_netof() and inet_lnaof() break apart Internet host + addresses, returning the network number and local network address + part, respectively. + + All Internet addresses are returned in network order (bytes ordered + from left to right). All network numbers and local address parts are + returned as machine format integer values. + + NOTES + Inet_LnaOf() corresponds to inet_lnaof(), which accepts a + 'struct in_addr' parameter. Effectively, only the in_addr.s_addr + member is used by that library function, which is what the + Inet_Lnaof() function uses as a parameter. + + INTERNET ADDRESSES + Values specified using the `.' notation take one of the following + forms: + + a.b.c.d + a.b.c + a.b + a + + When four parts are specified, each is interpreted as a byte of data + and assigned, from left to right, to the four bytes of an Internet + address. + + When a three part address is specified, the last part is interpreted + as a 16-bit quantity and placed in the right-most two bytes of the + network address. This makes the three part address format convenient + for specifying Class B network addresses as ``128.net.host''. + + When a two part address is supplied, the last part is interpreted as + a 24-bit quantity and placed in the right most three bytes of the + network address. This makes the two part address format convenient + for specifying Class A network addresses as ``net.host''. + + When only one part is given, the value is stored directly in the + network address without any byte rearrangement. + + All numbers supplied as ``parts'' in a `.' notation may be decimal, + octal, or hexadecimal, as specified in the C language (i.e., a + leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies + octal; otherwise, the number is interpreted as decimal). + + RESULT + The constant INADDR_NONE is returned by inet_addr() and inet_network() + for malformed requests. + + SEE ALSO + gethostbyname() + + NOTES + This function predates a change in the Internet architecture known + as "Classless Internet Domain Routing" (CIDR). Following this change + it is no longer safe to determine the local network address part + of an IP address merely by checking the type of the address. + + BUGS + The value INADDR_NONE (0xffffffff) is a valid broadcast address, but + inet_addr() cannot return that value without indicating failure. The + newer inet_aton() function does not share this problem. The problem + of host byte ordering versus network byte ordering is confusing. The + string returned by Inet_NtoA() resides in a static memory area. + + bsdsocket.library/Inet_MakeAddr bsdsocket.library/Inet_MakeAddr + + NAME + Inet_MakeAddr - Internet address manipulation + + SYNOPSIS + #include + #include + #include + + in_addr = Inet_MakeAddr(net, lna) + D0 D0 D1 + + unsigned long Inet_MakeAddr(long net, long lna); + + FUNCTION + The routines inet_aton(), inet_addr() and inet_network() interpret + char acter strings representing numbers expressed in the Internet + standard `.' notation. The inet_aton() routine interprets the + specified character string as an Internet address, placing the + address into the structure provided. It returns 1 if the string was + successfully interpreted, or 0 if the string is invalid. The + inet_addr() and inet_network() functions return numbers suitable for + use as Internet addresses and Internet net work numbers, + respectively. The routine Inet_NtoA() takes an Internet address and + returns an ASCII string representing the address in `.' notation. The + routine inet_makeaddr() takes an Internet network number and a local + network address and constructs an Internet address from it. The + routines inet_netof() and inet_lnaof() break apart Internet host + addresses, returning the network number and local network address + part, respectively. + + All Internet addresses are returned in network order (bytes ordered + from left to right). All network numbers and local address parts are + returned as machine format integer values. + + NOTES + Inet_MakeAddr() corresponds to inet_makeaddr(), which returns a + 'struct in_addr' value. Effectively, only the in_addr.s_addr + member is filled in which is what the inet_makeaddr() function + returns as its result. + + INTERNET ADDRESSES + Values specified using the `.' notation take one of the following + forms: + + a.b.c.d + a.b.c + a.b + a + + When four parts are specified, each is interpreted as a byte of data + and assigned, from left to right, to the four bytes of an Internet + address. + + When a three part address is specified, the last part is interpreted + as a 16-bit quantity and placed in the right-most two bytes of the + network address. This makes the three part address format convenient + for specifying Class B network addresses as ``128.net.host''. + + When a two part address is supplied, the last part is interpreted as + a 24-bit quantity and placed in the right most three bytes of the + network address. This makes the two part address format convenient + for specifying Class A network addresses as ``net.host''. + + When only one part is given, the value is stored directly in the + network address without any byte rearrangement. + + All numbers supplied as ``parts'' in a `.' notation may be decimal, + octal, or hexadecimal, as specified in the C language (i.e., a + leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies + octal; otherwise, the number is interpreted as decimal). + + RESULT + The constant INADDR_NONE is returned by inet_addr() and inet_network() + for malformed requests. + + SEE ALSO + gethostbyname() + + BUGS + The value INADDR_NONE (0xffffffff) is a valid broadcast address, but + inet_addr() cannot return that value without indicating failure. The + newer inet_aton() function does not share this problem. The problem + of host byte ordering versus network byte ordering is confusing. The + string returned by Inet_NtoA() resides in a static memory area. + + bsdsocket.library/Inet_NetOf bsdsocket.library/Inet_NetOf + + NAME + Inet_NetOf - Internet address manipulation + + SYNOPSIS + #include + #include + #include + + net = Inet_NetOf(in) + D0 D0 + + unsigned long Inet_NetOf(unsigned long in); + + FUNCTION + The routines inet_aton(), inet_addr() and inet_network() interpret + character strings representing numbers expressed in the Internet + standard `.' notation. The inet_aton() routine interprets the + specified character string as an Internet address, placing the + address into the structure provided. It returns 1 if the string was + successfully interpreted, or 0 if the string is invalid. The + inet_addr() and inet_network() functions return numbers suitable for + use as Internet addresses and Internet net work numbers, + respectively. The routine Inet_NtoA() takes an Internet address and + returns an ASCII string representing the address in `.' notation. The + routine inet_makeaddr() takes an Internet network number and a local + network address and constructs an Internet address from it. The + routines inet_netof() and inet_lnaof() break apart Internet host + addresses, returning the network number and local network address + part, respectively. + + All Internet addresses are returned in network order (bytes ordered + from left to right). All network numbers and local address parts are + returned as machine format integer values. + + NOTES + Inet_NetOf() corresponds to inet_netof(), which accepts a + 'struct in_addr' parameter. Effectively, only the in_addr.s_addr + member is used by that library function, which is what the + Inet_Netof() function uses as a parameter. + + INTERNET ADDRESSES + Values specified using the `.' notation take one of the following + forms: + + a.b.c.d + a.b.c + a.b + a + + When four parts are specified, each is interpreted as a byte of data + and assigned, from left to right, to the four bytes of an Internet + address. + + When a three part address is specified, the last part is interpreted + as a 16-bit quantity and placed in the right-most two bytes of the + network address. This makes the three part address format convenient + for specifying Class B network addresses as ``128.net.host''. + + When a two part address is supplied, the last part is interpreted as + a 24-bit quantity and placed in the right most three bytes of the + network address. This makes the two part address format convenient + for specifying Class A network addresses as ``net.host''. + + When only one part is given, the value is stored directly in the + network address without any byte rearrangement. + + All numbers supplied as ``parts'' in a `.' notation may be decimal, + octal, or hexadecimal, as specified in the C language (i.e., a + leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies + octal; otherwise, the number is interpreted as decimal). + + RESULT + The constant INADDR_NONE is returned by inet_addr() and inet_network() + for malformed requests. + + SEE ALSO + gethostbyname() + + NOTES + This function predates a change in the Internet architecture known + as "Classless Internet Domain Routing" (CIDR). Following this change + it is no longer safe to determine the local network number part + of an IP address merely by checking the type of the address. + + BUGS + The value INADDR_NONE (0xffffffff) is a valid broadcast address, but + inet_addr() cannot return that value without indicating failure. The + newer inet_aton() function does not share this problem. The problem + of host byte ordering versus network byte ordering is confusing. The + string returned by Inet_NtoA() resides in a static memory area. + + bsdsocket.library/inet_network bsdsocket.library/inet_network + + NAME + inet_network - Internet address manipulation + + SYNOPSIS + #include + #include + #include + + net = inet_network(cp) + D0 A0 + + unsigned long inet_network(char *cp); + + FUNCTION + The routines inet_aton(), inet_addr() and inet_network() interpret + char acter strings representing numbers expressed in the Internet + standard `.' notation. The inet_aton() routine interprets the + specified character string as an Internet address, placing the + address into the structure provided. It returns 1 if the string was + successfully interpreted, or 0 if the string is invalid. The + inet_addr() and inet_network() functions return numbers suitable for + use as Internet addresses and Internet net work numbers, + respectively. The routine Inet_NtoA() takes an Internet address and + returns an ASCII string representing the address in `.' notation. The + routine inet_makeaddr() takes an Internet network number and a local + network address and constructs an Internet address from it. The + routines inet_netof() and inet_lnaof() break apart Internet host + addresses, returning the network number and local network address + part, respectively. + + All Internet addresses are returned in network order (bytes ordered + from left to right). All network numbers and local address parts are + returned as machine format integer values. + + INTERNET ADDRESSES + Values specified using the `.' notation take one of the following + forms: + + a.b.c.d + a.b.c + a.b + a + + When four parts are specified, each is interpreted as a byte of data + and assigned, from left to right, to the four bytes of an Internet + address. + + When a three part address is specified, the last part is interpreted + as a 16-bit quantity and placed in the right-most two bytes of the + network address. This makes the three part address format convenient + for specifying Class B network addresses as ``128.net.host''. + + When a two part address is supplied, the last part is interpreted as + a 24-bit quantity and placed in the right most three bytes of the + network address. This makes the two part address format convenient + for specifying Class A network addresses as ``net.host''. + + When only one part is given, the value is stored directly in the + network address without any byte rearrangement. + + All numbers supplied as ``parts'' in a `.' notation may be decimal, + octal, or hexadecimal, as specified in the C language (i.e., a + leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies + octal; otherwise, the number is interpreted as decimal). + + RESULT + The constant INADDR_NONE is returned by inet_addr() and inet_network() + for malformed requests. + + SEE ALSO + gethostbyname() + + BUGS + The value INADDR_NONE (0xffffffff) is a valid broadcast address, but + inet_addr() cannot return that value without indicating failure. The + newer inet_aton() function does not share this problem. The problem + of host byte ordering versus network byte ordering is confusing. The + string returned by Inet_NtoA() resides in a static memory area. + + bsdsocket.library/Inet_NtoA bsdsocket.library/Inet_NtoA + + NAME + Inet_NtoA - Internet address manipulation + + SYNOPSIS + #include + #include + #include + + addr = Inet_NtoA(in) + D0 D0 + + char * Inet_NtoA(unsigned long in); + + FUNCTION + The routines inet_aton(), inet_addr() and inet_network() interpret + char acter strings representing numbers expressed in the Internet + standard `.' notation. The inet_aton() routine interprets the + specified character string as an Internet address, placing the + address into the structure provided. It returns 1 if the string was + successfully interpreted, or 0 if the string is invalid. The + inet_addr() and inet_network() functions return numbers suitable for + use as Internet addresses and Internet net work numbers, + respectively. The routine inet_ntoa() takes an Internet address and + returns an ASCII string representing the address in `.' notation. The + routine inet_makeaddr() takes an Internet network number and a local + network address and constructs an Internet address from it. The + routines inet_netof() and inet_lnaof() break apart Internet host + addresses, returning the network number and local network address + part, respectively. + + All Internet addresses are returned in network order (bytes ordered + from left to right). All network numbers and local address parts are + returned as machine format integer values. + + NOTES + Inet_NtoA() corresponds to inet_ntoa(), which accepts a + 'struct in_addr' parameter. Effectively, only the in_addr.s_addr + member is used by that library function, which is what the + Inet_NtoA() function uses as a parameter. + + INTERNET ADDRESSES + Values specified using the `.' notation take one of the following + forms: + + a.b.c.d + a.b.c + a.b + a + + When four parts are specified, each is interpreted as a byte of data + and assigned, from left to right, to the four bytes of an Internet + address. + + When a three part address is specified, the last part is interpreted + as a 16-bit quantity and placed in the right-most two bytes of the + network address. This makes the three part address format convenient + for specifying Class B network addresses as ``128.net.host''. + + When a two part address is supplied, the last part is interpreted as + a 24-bit quantity and placed in the right most three bytes of the + network address. This makes the two part address format convenient + for specifying Class A network addresses as ``net.host''. + + When only one part is given, the value is stored directly in the + network address without any byte rearrangement. + + All numbers supplied as ``parts'' in a `.' notation may be decimal, + octal, or hexadecimal, as specified in the C language (i.e., a + leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies + octal; otherwise, the number is interpreted as decimal). + + RESULT + The constant INADDR_NONE is returned by inet_addr() and inet_network() + for malformed requests. + + SEE ALSO + gethostbyname() + + BUGS + The string returned by Inet_NtoA() resides in a static memory area. + + bsdsocket.library/inet_ntop bsdsocket.library/inet_ntop + + NAME + inet_ntop - convert a network format address to presentation format. + + SYNOPSIS + #include + #include + #include + + success = inet_ntop(af,src,dst,size) + D0 D0 A0 A1 D1 + + STRPTR inet_ntop(LONG af,APTR src,STRPTR dst,LONG size); + + FUNCTION + The inet_ntop() routine will convert a network address into + an ASCII text representation. This is similar to inet_ntoa(), + except that the output buffer is user-supplied and not statically + allocated somewhere. + + INPUTS + af -- Address family that identifies the encoding of the + 'src' parameter; this must be AF_INET for IPv4 addresses. + + src -- Pointer to a network address, encoded in the form + indicated by the 'af' parameter. + + dst -- Buffer to store the ASCII text representation in. This + buffer must contain at least as many bytes of room as + indicated by the 'size' parameter. + + size -- Size of the buffer pointed to by 'dst'. + + RESULT + This routine returns the value of the 'dst' parameter, or NULL for + failure. + + SEE ALSO + gethostbyname(), inet_addr(), inet_ntoa(), inet_pton() + + NOTES + The inet_ntop() call is an extension to the AmiTCP V4 API and cannot + be assumed to be present in all versions of "bsdsocket.library". To + find out whether your library version supports it, use the + SBTC_HAVE_ADDRESS_CONVERSION_API tag with the SocketBaseTagList() + function. + + bsdsocket.library/inet_pton bsdsocket.library/inet_pton + + NAME + inet_pton - Convert a presentation format address to network format. + + SYNOPSIS + #include + #include + #include + + result = inet_pton(af,src,dst) + D0 D0 A0 A1 + + LONG inet_pton(LONG af,STRPTR src,APTR dst); + + FUNCTION + The inet_pton() routine will convert an ASCII text representation + of an IP address to network format, depending upon the type of + address given. This is similar to inet_aton(). + + INPUTS + af -- Address family that identifies the encoding of the + 'src' parameter; this must be AF_INET for IPv4 addresses. + + src -- Pointer to the presentation format address, in the + format indicated by the 'af' parameter. For IPv4 addresses, + 'src' must point to a dotted-decimal representation of an + IP address. That representation must be of the 'a.b.c.d' + form, with 'a', 'b', 'c' and 'd', being numbers in the + range 0..255 (inclusive). + + dst -- Buffer to store the network format address in. + + RESULT + Returns 1 if the address was valid for the specified address + family, 0 if the address was not valid ('dst' will not be + modified in this case) and -1 if any other error occured + ('dst' will not be modified in this case either). + + SEE ALSO + gethostbyname(), inet_addr(), inet_ntoa(), inet_ntop() + + NOTES + The inet_pton() call is an extension to the AmiTCP V4 API and cannot + be assumed to be present in all versions of "bsdsocket.library". To + find out whether your library version supports it, use the + SBTC_HAVE_ADDRESS_CONVERSION_API tag with the SocketBaseTagList() + function. + + bsdsocket.library/IoctlSocket bsdsocket.library/IoctlSocket + + NAME + IoctlSocket - control socket parameters + + SYNOPSIS + #include + + success = IoctlSocket(s, request, argp) + D0 D0 D1 A0 + + long IoctlSocket(long s, unsigned long request, char *argp); + + FUNCTION + The IoctlSocket() function manipulates the underlying device + parameters of special files. The argument s must be a socket file + descriptor. + + An ioctl request has encoded in it whether the argument is an ``in'' + parameter or ``out'' parameter, and the size of the argument argp in + bytes. Macros and defines used in specifying an ioctl request are + located in the file . + + The following request types are supported: + + FIONBIO + The argument must be (long *). A value of 1 enables non-blocking + I/O on the socket, a value of 0 disables it. + + FIOASYNC + The argument must be (long *). A value of 1 enables asynchronous + I/O on the socket, a value of 0 disables it. + + FIONREAD + The argument must be (long *). The number of characters + readable on this socket will be returned. + + SIOCATMARK + The argument must be (long *). If the socket points to a mark + in the data stream then the value pointed to by the argument + will be set to 1; otherwise it will be set to 0. + + NOTES + Depending on the type of socket involved, other ioctl requests are + supported, too. The table above only refers to the request types + supported by the kernel code itself. + + RESULT + If an error has occurred, a value of -1 is returned and errno is set to + indicate the error. + + ERRORS + IoctlSocket() will fail if: + + [EBADF] + s is not a valid descriptor. + + [ENOTTY] + s is not associated with a character special device. + + [ENOTTY] + The specified request does not apply to the kind of object that + the descriptor s references. + + [EINVAL] + Request or argp is not valid. + + bsdsocket.library/listen bsdsocket.library/listen + + NAME + listen - listen for connections on a socket + + SYNOPSIS + #include + + success = listen(s, backlog) + D0 D0 D1 + + long listen(long s, long backlog); + + FUNCTION + To accept connections, a socket is first created with socket(), a + willingness to accept incoming connections and a queue limit for + incoming connections are specified with listen(), and then the + connections are accepted with accept(). The listen() call applies + only to sockets of type SOCK_STREAM or SOCK_SEQPACKET. + + The backlog parameter defines the maximum length the queue of pending + connections may grow to. If a connection request arrives with the + queue full the client may receive an error with an indication of + ECONNREFUSED, or, if the underlying protocol supports retransmission, + the request may be ignored so that retries may succeed. + + RESULT + A 0 return value indicates success; -1 indicates an error. + + ERRORS + listen() will fail if: + + [EBADF] + The argument s is not a valid descriptor. + + [ENOTSOCK] + The argument s is not a socket. + + [EOPNOTSUPP] + The socket is not of a type that supports the operation + listen(). + + SEE ALSO + accept(), connect(), socket() + + BUGS + The backlog is currently limited (silently) to 5. + + bsdsocket.library/mbuf_adj bsdsocket.library/mbuf_adj + + NAME + mbuf_adj - Remove bytes from an mbuf chain. + + SYNOPSIS + #include + + success = mbuf_adj(buffer,length) + D0 A0 D0 + + LONG mbuf_adj(struct mbuf *buffer,LONG length); + + FUNCTION + This function will remove bytes either from the beginning or + the end of the mbuf chain. + + INPUTS + buffer -- The mbuf chain to be modified; this must not + be NULL. + + length -- Number of bytes to remove; if this is a positive + value, the bytes will be removed from the beginning of + the chain, otherwise they will be removed from the + end of the chain. + + RESULT + A success code is returned (0 == success, anything else indicates + an error); this function will always succeed provided that the + parameters are sane. + + NOTES + The mbuf_adj() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_KERNEL_MEMORY_API tag with the + SocketBaseTagList() function. + + This routine is expected to be called on the context of the + kernel from within the IP filter hook. Do not call it from + user code or you will crash the stack. + + mbuf_adj() is functionally identical to the BSD kernel + routine "m_adj()". + + bsdsocket.library/mbuf_cat bsdsocket.library/mbuf_cat + + NAME + mbuf_cat - Concatenate two mbuf chains. + + SYNOPSIS + #include + + success = mbuf_cat(first_chain,second_chain) + D0 A0 A1 + + LONG mbuf_cat(struct mbuf *first_chain,struct mbuf *second_chain); + + FUNCTION + This function will concatenate the contents of one mbuf chain + to another. + + INPUTS + first_chain -- The mbuf chain the second chain will be appended + to; this must not be NULL. + + second_chain -- The mbuf chain to be appended to the first + chain; this must not be NULL. + + This buffer will be released after it has been copied. + + RESULT + A success code is returned (0 == success, anything else indicates + an error); this function will always succeed provided that the + parameters are sane. + + NOTES + The mbuf_cat() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_KERNEL_MEMORY_API tag with the + SocketBaseTagList() function. + + This routine is expected to be called on the context of the + kernel from within the IP filter hook. Do not call it from + user code or you will crash the stack. + + mbuf_cat() is functionally identical to the BSD kernel + routine "m_cat()". + + The 'first_chain->m_pkthdr' field will not be updated. + + The 'second_chain' buffer is destroyed by this function. + + bsdsocket.library/mbuf_copyback bsdsocket.library/mbuf_copyback + + NAME + mbuf_copyback - Copy data from a buffer back into an mbuf chain. + + SYNOPSIS + #include + + success = mbuf_copyback(buffer,offset,length,data) + D0 A0 D0 D1 A1 + + LONG mbuf_copyback(struct mbuf *buffer,LONG offset, + LONG length,APTR data); + + FUNCTION + Copy data from a buffer back into the indicated mbuf chain, + starting "offset" bytes from the beginning, extending the mbuf + chain if necessary. + + INPUTS + buffer -- The mbuf chain to be modified; this must not + be NULL. + + offset -- How many bytes into the buffer contents the data + should be copied; must be >= 0. + + length -- How many bytes should be copied; must be >= 0. + + data -- Refers to the data to be copied; this must not + be NULL. + + RESULT + A success code is returned (0 == success, anything else indicates + an error). This function can fail if it runs out of memory whilst + trying to extend the mbuf chain. + + NOTES + The mbuf_copyback() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_KERNEL_MEMORY_API tag with the + SocketBaseTagList() function. + + This routine is expected to be called on the context of the + kernel from within the IP filter hook. Do not call it from + user code or you will crash the stack. + + mbuf_copyback() is functionally identical to the BSD kernel + routine "m_copyback()". + + bsdsocket.library/mbuf_copydata bsdsocket.library/mbuf_copydata + + NAME + mbuf_copydata - Copy data from an mbuf chain into a buffer. + + SYNOPSIS + #include + + success = mbuf_copydata(buffer,offset,length,data) + D0 A0 D0 D1 A1 + + LONG mbuf_copydata(struct mbuf *buffer,LONG offset,LONG length, + APTR data); + + FUNCTION + Copy data from an mbuf chain starting "offset" bytes from the + beginning, continuing for "length" bytes, into the indicated buffer. + + INPUTS + buffer -- The mbuf chain to be copied; this must not + be NULL. + + offset -- How many bytes into the buffer contents the data + should be copied; must be >= 0. + + length -- How many bytes should be copied; must be >= 0. + + data -- Where the bytes should be copied to; this must not + be NULL. + + RESULT + A success code is returned (0 == success, anything else indicates + an error). + + NOTES + The mbuf_copydata() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_KERNEL_MEMORY_API tag with the + SocketBaseTagList() function. + + This routine is expected to be called on the context of the + kernel from within the IP filter hook. Do not call it from + user code or you will crash the stack. + + mbuf_copydata() is functionally identical to the BSD kernel + routine "m_copydata()". + + bsdsocket.library/mbuf_copym bsdsocket.library/mbuf_copym + + NAME + mbuf_copym - Make a copy of an mbuf chain. + + SYNOPSIS + #include + + copy = mbuf_copym(buffer,offset,length) + D0 A0 D0 D1 + + struct mbuf * mbuf_copym(struct mbuf *buffer,LONG offset,LONG length); + + FUNCTION + Make a copy of an mbuf chain starting "offset" bytes from the + beginning, continuing for "length" bytes. If length==M_COPYALL, + copy to end of mbuf. + + INPUTS + buffer -- The mbuf chain to be copied. + + offset -- How many bytes into the buffer contents the data + should be copied; must be >= 0. + + length -- How many bytes should be copied; must be >= 0. + + RESULT + A copy of the original buffer is returned, taking the offset + and length into account. If the copy could not be created, + NULL is returned. + + NOTES + The mbuf_copym() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_KERNEL_MEMORY_API tag with the + SocketBaseTagList() function. + + This routine is expected to be called on the context of the + kernel from within the IP filter hook. Do not call it from + user code or you will crash the stack. + + mbuf_copym() is functionally identical to the BSD kernel + routine "m_copym()". + + bsdsocket.library/mbuf_free bsdsocket.library/mbuf_free + + NAME + mbuf_free - Free a single mbuf and return a pointer to the next + mbuf in the chain. + + SYNOPSIS + #include + + next = mbuf_free(buffer) + D0 A0 + + struct mbuf * mbuf_free(struct mbuf *buffer); + + FUNCTION + Free a single mbuf, as pointed to by the 'buffer' parameter. + If the 'buffer' parameter refers to a cluster, then the memory + will not be freed immediately, but rather when the usage count + of the cluster drops to zero. If the mbuf is part of a chain, + then the next following chain member will be returned. + + INPUTS + buffer -- The mbuf to be freed; this can be NULL in which + case this function will do nothing. + + RESULT + A pointer to the next mbuf in the chain the 'buffer' parameter + is a part of will be returned. If there is no such next mbuf, + NULL will be returned instead. + + NOTES + The mbuf_free() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_KERNEL_MEMORY_API tag with the + SocketBaseTagList() function. + + This routine is expected to be called on the context of the + kernel from within the IP filter hook. Do not call it from + user code or you will crash the stack. + + mbuf_free() is functionally identical to the BSD kernel + routine "m_free()". + + bsdsocket.library/mbuf_freem bsdsocket.library/mbuf_freem + + NAME + mbuf_freem - Free all mbufs in a chain. + + SYNOPSIS + #include + + mbuf_freem(chain) + A0 + + VOID mbuf_freem(struct mbuf *chain); + + FUNCTION + Free all mbufs in a chain. + + INPUTS + buffer -- The mbuf chain to be freed; this can be NULL in which + case this function will do nothing. + + NOTES + The mbuf_freem() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_KERNEL_MEMORY_API tag with the + SocketBaseTagList() function. + + This routine is expected to be called on the context of the + kernel from within the IP filter hook. Do not call it from + user code or you will crash the stack. + + mbuf_freem() is functionally identical to the BSD kernel + routine "m_freem()". + + bsdsocket.library/mbuf_get bsdsocket.library/mbuf_get + + NAME + mbuf_get - Allocate memory for an mbuf and initialize it. + + SYNOPSIS + #include + + buffer = mbuf_get() + D0 + + struct mbuf * mbuf_get(VOID); + + FUNCTION + Allocate memory for a single mbuf and initialize it. + + RESULT + A pointer to the allocated mbuf will be returned, or NULL if + there was not enough memory available to allocate it. + + NOTES + The mbuf_get() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_KERNEL_MEMORY_API tag with the + SocketBaseTagList() function. + + This routine is expected to be called on the context of the + kernel from within the IP filter hook. Do not call it from + user code or you will crash the stack. + + mbuf_get() is functionally identical to the BSD kernel + routine "m_get()". + + bsdsocket.library/mbuf_gethdr bsdsocket.library/mbuf_gethdr + + NAME + mbuf_gethdr - Allocate memory for a single mbuf and initialize + it as a packet header. + + SYNOPSIS + #include + + buffer = mbuf_gethdr() + D0 + + struct mbuf * mbuf_gethdr(VOID); + + FUNCTION + Allocate memory for a single mbuf and initialize it as a packet + header. + + RESULT + A pointer to the allocated mbuf will be returned, or NULL if + there was not enough memory available to allocate it. + + NOTES + The mbuf_gethdr() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_KERNEL_MEMORY_API tag with the + SocketBaseTagList() function. + + This routine is expected to be called on the context of the + kernel from within the IP filter hook. Do not call it from + user code or you will crash the stack. + + mbuf_gethdr() is functionally identical to the BSD kernel + routine "m_gethdr()". + + bsdsocket.library/mbuf_prepend bsdsocket.library/mbuf_prepend + + NAME + mbuf_prepend - Allocate new mbuf to be prepended to chain. + + SYNOPSIS + #include + + new_buffer = mbuf_prepend(buffer,length) + D0 A0 D0 + + LONG mbuf_prepend(struct mbuf *buffer,LONG length); + + FUNCTION + This function allocates a new mbuf which will be prepended + to the mbuf chain provided; if the new mbuf cannot be + allocated, then the provided mbuf chain will be deallocated. + + INPUTS + buffer -- The mbuf chain a new mbuf is to be prepended to; + this must not be NULL. + + length -- How many bytes to prepend; must be >= 0. + + RESULT + Returns the new mbuf chain with the new buffer prepended, or + NULL if memory was short; in case of failure, the original + memory buffer chain will be deallocated. + + NOTES + The mbuf_prepend() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_KERNEL_MEMORY_API tag with the + SocketBaseTagList() function. + + This routine is expected to be called on the context of the + kernel from within the IP filter hook. Do not call it from + user code or you will crash the stack. + + mbuf_prepend() is functionally identical to the BSD kernel + routine "m_prepend()". + + bsdsocket.library/mbuf_pullup bsdsocket.library/mbuf_pullup + + NAME + mbuf_pullup - Rearrange an mbuf chain so that len bytes are contiguous + and in the data area of an mbuf. + + SYNOPSIS + #include + + new_buffer = mbuf_pullup(buffer,length) + D0 A0 D0 + + struct mbuf * mbuf_pullup(struct mbuf *buffer,LONG length); + + FUNCTION + Rearrange an mbuf chain so that len bytes are contiguous and in the + data area of an mbuf (so that mtod() and dtom() macros will work + for a structure of size 'length'). Returns the resulting mbuf chain + on success. + + If there is room, it will add up to max_protohdr-len extra bytes to + the contiguous region in an attempt to avoid being called next time. + + INPUTS + buffer -- The mbuf chain to be rearranged. + + length -- How many bytes should be stored contiguously in the + first mbuf of the chain. + + RESULT + This function returns the rearranged mbuf chain on success. + If there was not enough memory available, NULL will be + returned instead. + + NOTES + The mbuf_pullup() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_KERNEL_MEMORY_API tag with the + SocketBaseTagList() function. + + This routine is expected to be called on the context of the + kernel from within the IP filter hook. Do not call it from + user code or you will crash the stack. + + mbuf_pullup() is functionally identical to the BSD kernel + routine "m_pullup()". + + bsdsocket.library/ObtainDomainNameServerListibrary/ObtainDomainNameServerList + + NAME + ObtainDomainNameServerList - Obtain the local in-memory list of + domain name server addresses used by the resolver. + + SYNOPSIS + list = ObtainDomainNameServerList() + D0 + + struct List * ObtainDomainNameServerList(void); + + FUNCTION + The ObtainDomainNameServerList() function will make a copy of the + current list of local domain name server addresses, as used by the + resolver. A list will be returned and must be released later via the + ReleaseDomainNameServerList() function. + + RESULT + list -- Pointer to a 'struct List', whose individual nodes + contain the addresses. Each node contains the following + structure members: + + dnsn_MinNode + A regular 'struct MinNode' which introduces each + list entry. + + dnsn_Size + The size of this data structure in bytes. Future + versions of this library may offer additional + members; by comparing the size you can find out + whether this is the case. + + dnsn_Address + The address of a domain name server, expressed + as a NUL-terminated string in dotted-decimal + notation (per RFC1700). + + dnsn_UseCount + How many times this server address has been + added to the list so far. A negative value + indicates that this server was configured + statically in the 'DEVS:Internet/resolver' + file. + + The result can be NULL if there was not enough memory + available to fill it. If no local name server addresses have + been added yet, you will receive an empty list. + + NOTES + The ObtainDomainNameServerList() call is an extension to the + AmiTCP V4 API and cannot be assumed to be present in all versions + of "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_DNS_API tag with the + SocketBaseTagList() function. + + SEE ALSO + ReleaseDomainNameServerList() + + bsdsocket.library/ObtainInterfaceList bsdsocket.library/ObtainInterfaceList + + NAME + ObtainInterfaceList - Obtain a list of available interfaces + + SYNOPSIS + list = ObtainInterfaceList() + D0 + + struct List * ObtainInterfaceList(void); + + FUNCTION + The ObtainInterfaceList() function will make a copy of the current + list of interfaces, as available for use by the stack. This list + will be returned and must be released later via the + ReleaseInterfaceList() function. + + RESULT + list -- Pointer to a 'struct List', whose individual Nodes + contain the names of the respective interfaces (found in + node->ln_Name). + + The result can be NULL if there was not enough memory + available to fill it. If no interfaces have been added + yet, you will receive an empty list. + + NOTES + The ObtainInterfaceList() call is an extension to the + AmiTCP V4 API and cannot be assumed to be present in all versions + of "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_INTERFACE_API tag with the + SocketBaseTagList() function. + + SEE ALSO + ReleaseInterfaceList() + + bsdsocket.library/ObtainRoadshowData bsdsocket.library/ObtainRoadshowData + + NAME + ObtainRoadshowData - Access internal Roadshow configuration data + + SYNOPSIS + list = ObtainRoadshowData(access) + D0 D0 + + struct List *ObtainRoadshowData(LONG access); + + FUNCTION + Several internal options control how the TCP/IP stack works. + These do not normally need to be changed, but there are times + when you might want to override or check them. + + ObtainRoadshowData() gives you access to the list of known + configurable options. + + INPUTS + access -- This must be one of the following values: + + ORD_ReadAccess + You just want to examine the options. + + ORD_WriteAccess + You want to modify and possibly examine the options. + + RESULT + list -- Pointer to a list, or NULL in case of error. Note that + the list and its contents are read-only! + + The list items look as follows: + + struct RoadshowDataNode + { + struct MinNode rdn_MinNode; + STRPTR rdn_Name; + UWORD rdn_Flags; + WORD rdn_Type; + ULONG rdn_Length; + APTR rdn_Data; + }; + + The structure members serve the following purposes: + + rdn_MinNode + This is a standard list node link. + + rdn_Name + Points to the NUL-terminated name of the + option. + + rdn_Flags + This node may have special properties, such + as: + + RDNF_ReadOnly + If this flag is set, it means that + you can examine the option, but it + cannot be modified with the + ChangeRoadshowData() function. + + rdn_Type + The type of data this option represents, such as: + + RDNT_Integer + This is a signed 32 bit integer. + + rdn_Length + This holds the size of the data associated with + this option, given as the number of bytes + allocated for it. + + rdn_Data + Points to the data associated with this option. + + ERRORS + The ObtainRoadshowData() call fails if: + + [EINVAL] + The list access mode is neither ORD_ReadAccess nor + ORD_WriteAccess. + + NOTES + The ObtainRoadshowData() call is an extension to the AmiTCP V4 + API and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_ROADSHOWDATA_API tag with the + SocketBaseTagList() function. + + Only one caller can modify the options at a time. + + SEE ALSO + ReleaseRoadshowData(), ChangeRoadshowData() + + bsdsocket.library/ObtainServerSocket bsdsocket.library/ObtainServerSocket + + NAME + ObtainServerSocket - Claim the socket associated with the current + Process' Internet server connection. + + SYNOPSIS + socket = ObtainServerSocket() + D0 + + LONG ObtainServerSocket(VOID); + + FUNCTION + Programs can be launched by the Internet superserver. These programs + will have sockets associated with them, connected to a client on + the network. A program can call ObtainServerSocket() to claim this + socket. + + RESULT + socket -- The socket assigned to this server program, or -1 if + no such socket is assigned or was already claimed. + + NOTES + The ObtainServerSocket() call is an extension to the AmiTCP V4 API + and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_SERVER_API tag with the + SocketBaseTagList() function. + + SEE ALSO + ObtainSocket() + ProcessIsServer() + + bsdsocket.library/ObtainSocket bsdsocket.library/ObtainSocket + + NAME + ObtainSocket - acquire a socket from the public list + + SYNOPSIS + socket = ObtainSocket(id, domain, type, protocol) + D0 D0 D1 D2 D3 + + long ObtainSocket(long id, long domain, long type, long protocol); + + FUNCTION + This function is for passing control of a socket from one process + to another. The socket to be handed over must be identified by + an ID, a domain, type and protocol number. + + RESULT + A -1 is returned if an error occurs, otherwise the return value is a + descriptor referencing the socket. + + ERRORS + The ObtainSocket() call fails if: + + [EBADF] + No socket with the given Id could be found. + + [EPROTONOSUPPORT] + The protocol type or the specified protocol is not + supported within this domain. + + [EMFILE] + The per-process descriptor table is full. + + [ENFILE] + The system file table is full. + + [EACCESS] + Permission to create a socket of the specified type + and/or protocol is denied. + + [ENOBUFS] + Insufficient buffer space is available. The socket + cannot be created until sufficient resources are + freed. + + SEE ALSO + socket(), accept(), bind(), connect(), getsockname(), + getsockopt(), IoctlSocket(), listen(), recv(), WaitSelect(), + send(), shutdown(), ReleaseSocket() + + bsdsocket.library/OpenLibrary bsdsocket.library/OpenLibrary + + NAME + OpenLibrary -- Open "bsdsocket.library", binding the opening Process + to the library base returned. + + SYNOPSIS + #include + + Library = OpenLibrary(Name,Version) + D0 A1 D0 + + struct Library * OpenLibrary(STRPTR name,ULONG version); + + FUNCTION + Each time "bsdsocket.library" is opened, a pointer to a specially + crafted library base will be returned to the opener. This library + base must be considered private in that it was created for the + opener's use only. It is unwise to share this library base with + other Processes since, for example, signals will be delivered only + to the opener but not to the Process which shares the library base + with the opener. This can be an issue for features such as interface + address change notification, asynchronous I/O, out of band data or + event notification. These signals will be posted only for the library + opener. + + The recommended approach, if several Processes need to use the + "bsdsocket.library" functions, is to reopen the library for every + user. Reopening the library can be costly in terms of memory consumed + and time required to initialize library data, so it should be used + sparingly. This implementation of the "bsdsocket.library" attempts to + allocate very little memory per library base (< 500 bytes). However, + using the name/address resolution functionality (such as through the + gethostbyname() and gethostbyaddr() functions) and the database + functions (getservbyname(), getprotobyname(), etc.) may claim + significantly more memory. + + This implementation of the "bsdsocket.library" specifically denies + Processes other than the opener access to the library functions, thus + preventing sharing of the resource. Also, Tasks are prevented from + calling library functions. The library may not even open for a + Task. + + If your application does not need all clients to use the signal + notification mechanisms and is aware of the restrictions, it can + enable library base sharing with the SBTC_CAN_SHARE_LIBRARY_BASES + feature of the SocketBaseTagList() function. + + This implementation of "bsdsocket.library" follows the AmiTCP V4.0 + API definition. The "V4.0" corresponds to library version 4. + + INPUTS + Name -- The name of the library to open + + Version -- The version of the library required + + RESULT + Library -- Pointer to a private library base, suitable to call + "bsdsocket.library" functions. + + SEE ALSO + SocketBaseTagList(), exec.library/CloseLibrary + + bsdsocket.library/ProcessIsServer bsdsocket.library/ProcessIsServer + + NAME + ProcessIsServer - Find out if a Process is an Internet server. + + SYNOPSIS + is_server = ProcessIsServer(process) + D0 A0 + + BOOL ProcessIsServer(struct Process * process); + + FUNCTION + Programs can be launched by the Internet superserver. These programs + will have sockets associated with them, connected to a client on + the network. To find out whether a program was launched in this + fashion, use the ProcessIsServer() function. + + INPUTS + process -- Address of a Process to examine, or NULL to use + the calling Process' address instead. + + RESULT + is_server -- TRUE if the Process in question was launched from + the Internet superserver, FALSE otherwise. + + NOTES + The ProcessIsServer() call is an extension to the AmiTCP V4 API + and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_SERVER_API tag with the + SocketBaseTagList() function. + + SEE ALSO + ObtainServerSocket() + + bsdsocket.library/QueryInterfaceTagListsdsocket.library/QueryInterfaceTagList + + NAME + QueryInterfaceTagList - Obtain information on an interface and the + associated SANA-II device driver. + + SYNOPSIS + success = QueryInterfaceTagList(name,tags) + D0 A0 A1 + + long QueryInterfaceTagList(STRPTR name,struct TagItem *tags); + + long QueryInterfaceTags(STRPTR name,...); + + FUNCTION + The QueryInterfaceTagList() will retrieve information about + an interface, both referring to stack-internal properties and + data accumulated and associated with the underlying SANA-II + device driver. + + INPUTS + name -- Name of the interface to be queried. This name + cannot be longer than 15 characters. + + tags -- Pointer to a 'struct TagItem' list. + + TAGS + IFQ_DeviceName (STRPTR *) - Retrieve the name of the SANA-II + device associated with this interface. A pointer to the + name will be returned. + + IFQ_DeviceUnit (LONG *) - Retrieve the unit number of the + SANA-II device associated with this interface. + + IFQ_HardwareAddressSize (LONG *) - Retrieve the hardware + address size associated with this interface; the number + returned will be the number of bits in the address. + For example, for an Ethernet interface the number 48 + would be returned. + + IFQ_HardwareAddress (UBYTE *) - Retrieve the hardware address + associated with this interface; a maximum of 16 bytes + will be copied. Please note that these are bytes, not + a NUL-terminated string. For example, an Ethernet + interface would use a 48 bit address, which comes out as + six bytes. Other network interfaces may use hardware + addresses which could be shorter than six bytes. + + IFQ_MTU (LONG *) - Retrieve the maximum transmission unit + size currently associated with this interface; the number + of bytes will be returned. Note that this is the MTU + value used by the TCP/IP stack, which may be smaller than + what the hardware can support. To find out how far the + hardware will let you set the MTU value, use the + IFQ_HardwareMTU tag. + + IFQ_HardwareMTU (LONG *) - Retrieve the maximum transmission + unit size supported by the driver hardware. This will + also magically update the MTU size used by the TCP/IP stack. + + IFQ_BPS (LONG *) - Retrieve the transmission speed associated + with this interface; the number of bits per second will + be returned. + + IFQ_HardwareType (LONG *) - Retrieve the SANA-II hardware type + associated with this interface. + + IFQ_PacketsReceived (ULONG *) - Retrieve the number of packets + received by this interface. + + IFQ_PacketsSent (ULONG *) - Retrieve the number of packets + sent by this interface. + + IFQ_BadData (ULONG *) - Retrieve the number of bad packets + dropped by this interface. + + IFQ_Overruns (ULONG *) - Retrieve the number of buffer overruns + registered on this interface. + + IFQ_UnknownTypes (ULONG *) - Retrieve the number of packets + dropped by this interface since their type was not known. + + IFQ_LastStart (struct timeval *) - Retrieve the time when the + interface was last made online. + + IFQ_Address (struct sockaddr *) - Retrieve the IP address + associated with this interface. + + IFQ_DestinationAddress (struct sockaddr *) - Retrieve the + IP address of the point-to-point partner associated with + this interface. + + IFQ_BroadcastAddress (struct sockaddr *) - Retrieve the + broadcast address associated with this interface. + + IFQ_NetMask (struct sockaddr_in *) - Retrieve the subnet mask + associated with this interface. + + IFQ_Metric (LONG *) - Retrieve the routing metric value associated + with this interface. + + IFQ_State (LONG *) - Retrieve the state of the interface; the + values returned can be either 'SM_Down' or 'SM_Up'. + + IFQ_AddressBindType (LONG *) - Find out how the interface address + is bound. This can be one of the following: + + IFABT_Unknown - The address has not been bound or is in + transitional state. You should check later to see + what state the interface ended up in. + + IFABT_Static - The address was assigned manually or by + an automated configuration process (e.g. BOOTP or + DHCP with an infinite lease) and is not expected + to change all by itself. + + IFABT_Dynamic - The address was assigned by an automated + configuration process (e.g. DHCP) and may change + in the future as part of the configuration process. + + IFQ_AddressLeaseExpires (struct DateStamp *) - Find out when and + if the interface address lease expires. The date stamp will + be set to the date and time when the lease will be terminated + if no steps were taken to extend it. Normally, leases will be + dynamically extended as time goes by. If the date stamp + contains all zeroes, it means that the lease lasts infinitely. + + IFQ_PrimaryDNSAddress (struct sockaddr_in *) - Try to obtain the + address of the primary domain name server, if known to this + interface. If the address is not known, then the IP address + filled in by this tag will be zero. + + IFQ_SecondaryDNSAddress (struct sockaddr_in *) - Try to obtain the + address of the secondary domain name server, if known to this + interface. If the address is not known, then the IP address + filled in by this tag will be zero. + + IFQ_NumReadRequests (LONG *) - Query the number of read I/O + requests allocated for this interface. + + IFQ_MaxReadRequests (LONG) - Query the number of read I/O requests + in use at a time. + + IFQ_NumReadRequestsPending (LONG *) - Query the number of read I/O + requests pending for this interface, waiting to be satisfied. + + IFQ_NumWriteRequests (LONG *) - Query the number of write I/O + requests allocated for this interface. + + IFQ_MaxWriteRequests (LONG) - Query the number of write I/O requests + in use at a time. + + IFQ_NumWriteRequestsPending (LONG *) - Query the number of write I/O + requests pending for this interface, waiting to be satisfied. + + IFQ_GetBytesIn (SBQUAD_T *) - Query the number of data bytes received + by this interface. This includes both the payload and the header + data added by all protocol layers involved. Note that this is an + unsigned 64 bit integer. + + IFQ_GetBytesOut (SBQUAD_T *) - Query the number of data bytes sent + by this interface. This includes both the payload and the header + data added by all protocol layers involved. Note that this is an + unsigned 64 bit integer. + + IFQ_GetDebugMode (LONG *) - Check if this interface is operating + in debugging mode. The result is either TRUE or FALSE. + + IFQ_GetSANA2CopyStats (struct SANA2CopyStats *) - Obtain statistics + covering how often the different SANA-II data transfer functions + were invoked so far. The data filled in explains how many times + each respective transfer function was called; it does _not_ + list the number of bytes transferred. Because the networking + device driver is free to ignore the data offered by the DMA + transfer functions, the DMA transfer statistics may not be + entirely accurate. + + IFQ_OutputDrops (LONG *) - Query the number of packets dropped + before they could get transmitted. + + IFQ_InputDrops (LONG *) - Query the number of packets which were + received, but were dropped before they could be processed. + + IFQ_OutputErrors (LONG *) - Query the number of errors that + were generated during transmission for this interface. + + IFQ_InputErrors (LONG *) - Query the number of errors that + were generated during reception for this interface. + + IFQ_OutputMulticasts (LONG *) - Query the number of multicasts + sent through this interface. + + IFQ_InputMulticasts (LONG *) - Query the number of multicasts + received by this interface. + + IFQ_IPDrops (LONG *) - Query the total number of all IP + packets dropped. + + IFQ_ARPDrops (LONG *) - Query the total number of all ARP + packets dropped. + + RESULT + success -- 0 for success, -1 for failure; the failure code will + be stored in the 'errno' variable. + + NOTES + The QueryInterfaceTagList() call is an extension to the + AmiTCP V4 API and cannot be assumed to be present in all versions + of "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_INTERFACE_API tag with the + SocketBaseTagList() function. + + The IFQ_PrimaryDNSAddress and IFQ_SecondaryDNSAddress tags require + that the underlying device driver supports the SANA-IIR4 extensions, + which at this time of writing not many drivers do. Take care. + + SEE ALSO + AddInterfaceTagList(), ConfigureInterfaceTagList() + + bsdsocket.library/recv bsdsocket.library/recv + + NAME + recv - receive a message from a socket + + SYNOPSIS + #include + #include + + nbytes = recv(s, buf, len, flags) + D0 D0 A0 D1 D2 + + long recv(long s, void *buf, long len, long flags); + + FUNCTION + recvfrom() and recvmsg() are used to receive messages from a socket, + and may be used to receive data on a socket whether or not it is + connectionoriented. + + If from is not NULL, and the socket is not connection-oriented, the + source address of the message is filled in. Fromlen is a value-result + parameter, initialized to the size of the buffer associated with + from, and modified on return to indicate the actual size of the + address stored there. + + The recv() call is normally used only on a connected socket (see + connect()) and is identical to recvfrom() with a NULL from parameter. + As it is redundant, it may not be supported in future releases. + + All three routines return the length of the message on successful + completion. If a message is too long to fit in the supplied buffer, + excess bytes may be discarded depending on the type of socket the + message is received from (see socket()). + + If no messages are available at the socket, the receive call waits + for a message to arrive, unless the socket is nonblocking (see + IoctlSocket()) in which case the value -1 is returned and the + external variable errno set to EAGAIN. The receive calls normally + return any data available, up to the requested amount, rather than + waiting for receipt of the full amount requested; this behavior is + affected by the socket-level options SO_RCVLOWAT and SO_RCVTIMEO + described in getsockopt(). + + The WaitSelect() call may be used to determine when more data arrive. + + The flags argument to a recv call is formed by oring one or more of + the values: + + MSG_OOB + process out-of-band data + + MSG_PEEK + peek at incoming message + + MSG_WAITALL + wait for full request or error + + The MSG_OOB flag requests receipt of out-of-band data that would not + be received in the normal data stream. Some protocols place expedited + data at the head of the normal data queue, and thus this flag cannot + be used with such protocols. The MSG_PEEK flag causes the receive + operation to return data from the beginning of the receive queue + without removing that data from the queue. Thus, a subsequent receive + call will return the same data. The MSG_WAITALL flag requests that + the operation block until the full request is satisfied. However, the + call may still return less data than requested if a signal is caught, + an error or disconnect occurs, or the next data to be received is of + a different type than that returned. + + The recvmsg() call uses a msghdr structure to minimize the number of + directly supplied parameters. This structure has the following form, + as defined in : + + struct msghdr { + caddr_t msg_name; /* optional address */ + u_int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter\gather array */ + u_int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_control; /* ancillary data, see below */ + u_int msg_controllen; /* ancillary data buffer len */ + int msg_flags; /* flags on received message */ + }; + + Here msg_name and msg_namelen specify the destination address if the + socket is unconnected; msg_name may be given as a null pointer if no + names are desired or required. msg_iov and msg_iovlen describe + scatter gather locations. msg_control, which has length + msg_controllen, points to a buffer for other protocol control related + messages or other miscellaneous ancillary data. The messages are of + the form: + + struct cmsghdr { + u_int cmsg_len; /* data byte count, including hdr */ + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ + /* followed by + u_char cmsg_data[]; */ + }; + + As an example, one could use this to learn of changes in the + data-stream in XNS/SPP, or in ISO, to obtain user-connection-request + data by requesting a recvmsg with no data buffer provided immediately + after an accept() call. + + The msg_flags field is set on return according to the message + received. MSG_EOR indicates end-of-record; the data returned + completed a record (generally used with sockets of type + SOCK_SEQPACKET). MSG_TRUNC indicates that the trailing portion of a + datagram was discarded because the datagram was larger than the + buffer supplied. MSG_CTRUNC indicates that some control data were + discarded due to lack of space in the buffer for ancillary data. + MSG_OOB is returned to indicate that expedited or out-of-band data + were received. + + RESULT + These calls return the number of bytes received, or -1 if an error + occurred. + + NOTES + Technically, "recv(socket,buf,len,flags)" is equivalent to + calling "recvfrom(socket,buf,len,flags,NULL,0)". + + ERRORS + The calls fail if: + + [EBADF] + The argument s is an invalid descriptor. + + [ENOTCONN] + The socket is associated with a connection-oriented protocol + and has not been connected (see connect() and accept()). + + [ENOTSOCK] + The argument s does not refer to a socket. + + [EAGAIN] + The socket is marked non-blocking, and the receive operation + would block, or a receive timeout had been set, and the + timeout expired before data were received. + + [EINTR] + The receive was interrupted by delivery of a signal before + any data were available. + + [EFAULT] + The receive buffer pointer(s) point outside the process's + address space. + + SEE ALSO + IoctlSocket(), WaitSelect(), getsockopt(), socket() + + bsdsocket.library/recvfrom bsdsocket.library/recvfrom + + NAME + recvfrom - receive a message from a socket + + SYNOPSIS + #include + #include + + nbytes = recvfrom(s, buf, len, flags, from, fromlen) + D0 D0 A0 D1 D2 A1 A2 + + long recvfrom(long s, void *buf, long len, long flags, + struct sockaddr *from,long *fromlen); + + FUNCTION + recvfrom() and recvmsg() are used to receive messages from a socket, + and may be used to receive data on a socket whether or not it is + connectionoriented. + + If from is not NULL, and the socket is not connection-oriented, the + source address of the message is filled in. Fromlen is a value-result + parameter, initialized to the size of the buffer associated with + from, and modified on return to indicate the actual size of the + address stored there. + + The recv() call is normally used only on a connected socket (see + connect()) and is identical to recvfrom() with a NULL from parameter. + As it is redundant, it may not be supported in future releases. + + All three routines return the length of the message on successful + completion. If a message is too long to fit in the supplied buffer, + excess bytes may be discarded depending on the type of socket the + message is received from (see socket()). + + If no messages are available at the socket, the receive call waits + for a message to arrive, unless the socket is nonblocking (see + IoctlSocket()) in which case the value -1 is returned and the + external variable errno set to EAGAIN. The receive calls normally + return any data available, up to the requested amount, rather than + waiting for receipt of the full amount requested; this behavior is + affected by the socket-level options SO_RCVLOWAT and SO_RCVTIMEO + described in getsockopt(). + + The WaitSelect() call may be used to determine when more data arrive. + + The flags argument to a recv call is formed by oring one or more of + the values: + + MSG_OOB + process out-of-band data + + MSG_PEEK + peek at incoming message + + MSG_WAITALL + wait for full request or error + + The MSG_OOB flag requests receipt of out-of-band data that would not + be received in the normal data stream. Some protocols place expedited + data at the head of the normal data queue, and thus this flag cannot + be used with such protocols. The MSG_PEEK flag causes the receive + operation to return data from the beginning of the receive queue + without removing that data from the queue. Thus, a subsequent receive + call will return the same data. The MSG_WAITALL flag requests that + the operation block until the full request is satisfied. However, the + call may still return less data than requested if a signal is caught, + an error or disconnect occurs, or the next data to be received is of + a different type than that returned. + + The recvmsg() call uses a msghdr structure to minimize the number of + directly supplied parameters. This structure has the following form, + as defined in : + + struct msghdr { + caddr_t msg_name; /* optional address */ + u_int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter\gather array */ + u_int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_control; /* ancillary data, see below */ + u_int msg_controllen; /* ancillary data buffer len */ + int msg_flags; /* flags on received message */ + }; + + Here msg_name and msg_namelen specify the destination address if the + socket is unconnected; msg_name may be given as a null pointer if no + names are desired or required. msg_iov and msg_iovlen describe + scatter gather locations. msg_control, which has length + msg_controllen, points to a buffer for other protocol control related + messages or other miscellaneous ancillary data. The messages are of + the form: + + struct cmsghdr { + u_int cmsg_len; /* data byte count, including hdr */ + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ + /* followed by + u_char cmsg_data[]; */ + }; + + As an example, one could use this to learn of changes in the + data-stream in XNS/SPP, or in ISO, to obtain user-connection-request + data by requesting a recvmsg with no data buffer provided immediately + after an accept() call. + + The msg_flags field is set on return according to the message + received. MSG_EOR indicates end-of-record; the data returned + completed a record (generally used with sockets of type + SOCK_SEQPACKET). MSG_TRUNC indicates that the trailing portion of a + datagram was discarded because the datagram was larger than the + buffer supplied. MSG_CTRUNC indicates that some control data were + discarded due to lack of space in the buffer for ancillary data. + MSG_OOB is returned to indicate that expedited or out-of-band data + were received. + + RESULT + These calls return the number of bytes received, or -1 if an error + occurred. + + ERRORS + The calls fail if: + + [EBADF] + The argument s is an invalid descriptor. + + [ENOTCONN] + The socket is associated with a connection-oriented protocol + and has not been connected (see connect() and accept()). + + [ENOTSOCK] + The argument s does not refer to a socket. + + [EAGAIN] + The socket is marked non-blocking, and the receive operation + would block, or a receive timeout had been set, and the + timeout expired before data were received. + + [EINTR] + The receive was interrupted by delivery of a signal before + any data were available. + + [EFAULT] + The receive buffer pointer(s) point outside the process's + address space. + + SEE ALSO + IoctlSocket(), WaitSelect(), getsockopt(), socket() + + bsdsocket.library/recvmsg bsdsocket.library/recvmsg + + NAME + recvmsg - receive a message from a socket + + SYNOPSIS + #include + #include + + nbytes = recvmsg(s, msg, flags) + D0 D0 A0 D1 + + long recvmsg(long s, struct msghdr *msg, long flags); + + FUNCTION + recvfrom() and recvmsg() are used to receive messages from a socket, + and may be used to receive data on a socket whether or not it is + connectionoriented. + + If from is not NULL, and the socket is not connection-oriented, the + source address of the message is filled in. Fromlen is a value-result + parameter, initialized to the size of the buffer associated with + from, and modified on return to indicate the actual size of the + address stored there. + + The recv() call is normally used only on a connected socket (see + connect()) and is identical to recvfrom() with a NULL from parameter. + As it is redundant, it may not be supported in future releases. + + All three routines return the length of the message on successful + completion. If a message is too long to fit in the supplied buffer, + excess bytes may be discarded depending on the type of socket the + message is received from (see socket()). + + If no messages are available at the socket, the receive call waits + for a message to arrive, unless the socket is nonblocking (see + IoctlSocket()) in which case the value -1 is returned and the + external variable errno set to EAGAIN. The receive calls normally + return any data available, up to the requested amount, rather than + waiting for receipt of the full amount requested; this behavior is + affected by the socket-level options SO_RCVLOWAT and SO_RCVTIMEO + described in getsockopt(). + + The WaitSelect() call may be used to determine when more data arrive. + + The flags argument to a recv call is formed by oring one or more of + the values: + + MSG_OOB + process out-of-band data + + MSG_PEEK + peek at incoming message + + MSG_WAITALL + wait for full request or error + + The MSG_OOB flag requests receipt of out-of-band data that would not + be received in the normal data stream. Some protocols place expedited + data at the head of the normal data queue, and thus this flag cannot + be used with such protocols. The MSG_PEEK flag causes the receive + operation to return data from the beginning of the receive queue + without removing that data from the queue. Thus, a subsequent receive + call will return the same data. The MSG_WAITALL flag requests that + the operation block until the full request is satisfied. However, the + call may still return less data than requested if a signal is caught, + an error or disconnect occurs, or the next data to be received is of + a different type than that returned. + + The recvmsg() call uses a msghdr structure to minimize the number of + directly supplied parameters. This structure has the following form, + as defined in : + + struct msghdr { + caddr_t msg_name; /* optional address */ + u_int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter\gather array */ + u_int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_control; /* ancillary data, see below */ + u_int msg_controllen; /* ancillary data buffer len */ + int msg_flags; /* flags on received message */ + }; + + Here msg_name and msg_namelen specify the destination address if the + socket is unconnected; msg_name may be given as a null pointer if no + names are desired or required. msg_iov and msg_iovlen describe + scatter gather locations. msg_control, which has length + msg_controllen, points to a buffer for other protocol control related + messages or other miscellaneous ancillary data. The messages are of + the form: + + struct cmsghdr { + u_int cmsg_len; /* data byte count, including hdr */ + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ + /* followed by + u_char cmsg_data[]; */ + }; + + As an example, one could use this to learn of changes in the + data-stream in XNS/SPP, or in ISO, to obtain user-connection-request + data by requesting a recvmsg with no data buffer provided immediately + after an accept() call. + + The msg_flags field is set on return according to the message + received. MSG_EOR indicates end-of-record; the data returned + completed a record (generally used with sockets of type + SOCK_SEQPACKET). MSG_TRUNC indicates that the trailing portion of a + datagram was discarded because the datagram was larger than the + buffer supplied. MSG_CTRUNC indicates that some control data were + discarded due to lack of space in the buffer for ancillary data. + MSG_OOB is returned to indicate that expedited or out-of-band data + were received. + + RESULT + These calls return the number of bytes received, or -1 if an error + occurred. + + ERRORS + The calls fail if: + + [EBADF] + The argument s is an invalid descriptor. + + [ENOTCONN] + The socket is associated with a connection-oriented protocol + and has not been connected (see connect() and accept()). + + [ENOTSOCK] + The argument s does not refer to a socket. + + [EAGAIN] + The socket is marked non-blocking, and the receive operation + would block, or a receive timeout had been set, and the + timeout expired before data were received. + + [EINTR] + The receive was interrupted by delivery of a signal before + any data were available. + + [EFAULT] + The receive buffer pointer(s) point outside the process's + address space. + + SEE ALSO + IoctlSocket(), WaitSelect(), getsockopt(), socket() + + bsdsocket.library/ReleaseCopyOfSocket bsdsocket.library/ReleaseCopyOfSocket + + NAME + ReleaseCopyOfSocket - duplicate a socket descriptor, then release + the duplicate to the public list + + SYNOPSIS + id = ReleaseCopyOfSocket(fd, Id) + D0 D0 D1 + + long ReleaseCopyOfSocket(long fd, long Id); + + FUNCTION + This function is for passing control of a socket from one process + to another. + + INPUTS + fd - The descriptor associated with the socket whose duplicate + is to be released + + id - The key value to associate the duplicate with. If the id value + is between 0 and 65535 (inclusively), then the id is considered + non-unique and anyone can pick it up via ObtainSocket() by + specifying the right combination of socket type and protocol. + If the id value is greater than 65535 then it must be unique + number (this function will fail if it is not). If the id + value matches the constant UNIQUE_ID then this function + will generate a unique id and return it. + + RESULT + A -1 is returned if an error occurs, otherwise the return value is + the Id with which the socket has been associated. + + ERRORS + The ReleaseCopyOfSocket() call fails if: + + [ENOMEM] + There is not enough memory left to put this socket onto the + public list. + + [EINVAL] + The Id number requested is not unique. + + [EBADF] + The socket descriptor number is not valid. + + [EMFILE] + Too many descriptors are active. + + SEE ALSO + socket(), accept(), bind(), connect(), getsockname(), + getsockopt(), IoctlSocket(), listen(), recv(), WaitSelect(), + send(), shutdown(), ObtainSocket(), ReleaseSocket(), + Dup2Socket() + + bsdsocket.library/ReleaseDomainNameServerListrary/ReleaseDomainNameServerList + + NAME + ReleaseDomainNameServerList - Release a list of local domain server + addresses as returned by ObtainDomainNameServerList(). + + SYNOPSIS + ReleaseDomainNameServerList(list) + A0 + + void ReleaseDomainNameServerList(struct List *list); + + FUNCTION + ReleaseDomainNameServerList() is the counterpart to + ObtainDomainNameServerList() and will release the list + returned by it. + + INPUTS + list -- Pointer to a list as returned by + ObtainDomainNameServerList(). This can be NULL in which case this + routine will do nothing. + + NOTES + The ReleaseDomainNameServerList() call is an extension to the + AmiTCP V4 API and cannot be assumed to be present in all versions + of "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_DNS_API tag with the + SocketBaseTagList() function. + + SEE ALSO + ObtainDomainNameServerList() + + bsdsocket.library/ReleaseInterfaceList bsdsocket.library/ReleaseInterfaceList + + NAME + ReleaseInterfaceList - Release a list of available interfaces, as + returned by ObtainInterfaceList(). + + SYNOPSIS + ReleaseInterfaceList(list) + A0 + + void ReleaseInterfaceList(struct List *list); + + FUNCTION + ReleaseInterfaceList() is the counterpart to ObtainInterfaceList() + and will release the list returned by it. + + INPUTS + list -- Pointer to a list as returned by ObtainInterfaceList(). + This can be NULL in which case this routine will do nothing. + + NOTES + The ReleaseInterfaceList() call is an extension to the + AmiTCP V4 API and cannot be assumed to be present in all versions + of "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_INTERFACE_API tag with the + SocketBaseTagList() function. + + SEE ALSO + ObtainInterfaceList() + + bsdsocket.library/ReleaseRoadshowData bsdsocket.library/ReleaseRoadshowData + + NAME + ReleaseRoadshowData - Release access to internal Roadshow + configuration data. + + SYNOPSIS + ReleaseRoadshowData(list) + D0 + + VOID ReleaseRoadshowData(struct List *list); + + FUNCTION + Several internal options control how the TCP/IP stack works. + These do not normally need to be changed, but there are times + when you might want to override or check them. + + ObtainRoadshowData() gives you access to the list of known + configurable options. ReleaseRoadshowData() complements it by + releasing access to it. + + INPUTS + list -- The list pointer you received by calling the + ObtainRoadshowData() function. If this is NULL, it will + be ignored. + + NOTES + The ObtainRoadshowData() call is an extension to the AmiTCP V4 + API and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_ROADSHOWDATA_API tag with the + SocketBaseTagList() function. + + SEE ALSO + ObtainRoadshowData(), ChangeRoadshowData() + + bsdsocket.library/ReleaseSocket bsdsocket.library/ReleaseSocket + + NAME + ReleaseSocket - release a socket to the public list + + SYNOPSIS + id = ReleaseSocket(fd, Id) + D0 D0 D1 + + long ReleaseSocket(long fd, long Id); + + FUNCTION + This function is for passing control of a socket from one process + to another. + + INPUTS + fd - The descriptor associated with the socket to be released + + Id - The key value to associate this socket with. If the Id value + is between 0 and 65535 (inclusively), then the id is considered + non-unique and anyone can pick it up via ObtainSocket() by + specifying the right combination of socket type and protocol. + If the Id value is greater than 65535 then it must be unique + number (this function will fail if it is not). If the Id + value matches the constant UNIQUE_ID then this function + will generate a unique id and return it. + + RESULT + A -1 is returned if an error occurs, otherwise the return value is + the Id with which the socket has been associated. + + ERRORS + The ReleaseSocket() call fails if: + + [ENOMEM] + There is not enough memory left to put this socket onto the + public list. + + [EINVAL] + The Id number requested is not unique. + + [EBADF] + The socket descriptor number is not valid. + + SEE ALSO + socket(), accept(), bind(), connect(), getsockname(), + getsockopt(), IoctlSocket(), listen(), recv(), WaitSelect(), + send(), shutdown(), ObtainSocket(), CloseSocket() + + bsdsocket.library/RemoveDomainNameServersocket.library/RemoveDomainNameServer + + NAME + RemoveDomainNameServer - Remove a domain name server address from + the local resolver database. + + SYNOPSIS + success = RemoveDomainNameServer(address) + D0 A0 + + LONG RemoveDomainNameServer(STRPTR address); + + FUNCTION + RemoveDomainNameServer() removes an address from the local resolver + database. This does not modify the on-disk resolver database, + the change only affects the in-memory copy. + + INPUTS + address -- Domain name server address as a pointer to a + NUL-terminated string; the address must be given in + dotted-decimal notation (per RFC1700). + + RESULT + If the address could be removed, a 0 value is returned. A return + value of -1 indicates an error, which is further specified in the + global errno. + + ERRORS + The RemoveDomainNameServer() call will fail if: + + [ENOBUFS] + There was not enough memory left to add a new database entry. + + [ENOENT] + The IP address to remove was not found. + + [EFAULT] + The address parameter is not valid. + + NOTES + The AddDomainNameServer() call is an extension to the + AmiTCP V4 API and cannot be assumed to be present in all versions + of "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_DNS_API tag with the + SocketBaseTagList() function. + + SEE ALSO + AddDomainNameServer(), SocketBaseTagList() + + bsdsocket.library/RemoveInterface bsdsocket.library/RemoveInterface + + NAME + RemoveInterface - Pull a network interface out of circulation + + SYNOPSIS + success = RemoveInterface(name,force) + D0 A0 D0 + + BOOL RemoveInterface(STRPTR name,BOOL force); + + FUNCTION + This is the counterpart to AddInterface(). It tries to release + all the resources associated with a networking interface, thus + permitting it to be added again with new parameters. + + INPUTS + name -- Unique name of the interface, assigned at the time it + was originally added. + + force -- RemoveInterface() will refuse to remove an interface + which is still in use. Use a 'force' parameter of TRUE to + make it remove the interface anyway. Note that if you force + an interface to be removed memory may remain allocated until + you shut down the network (with the "NetShutdown" command). + + RESULT + success -- TRUE for success, 0 for failure; the failure code will + be stored in the 'errno' variable. + + NOTES + The RemoveInterface() call is an extension to the AmiTCP V4 API + and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_INTERFACE_API tag with the + SocketBaseTagList() function. + + SEE ALSO + AddInterfaceTagList() + + bsdsocket.library/RemoveNetMonitorHook bsdsocket.library/RemoveNetMonitorHook + + NAME + RemoveNetMonitorHook - Remove a network monitoring callback hook + previously installed with AddNetMonitorHookTagList(). + + SYNOPSIS + RemoveNetMonitorHook(hook) + A0 + + VOID RemoveNetMonitorHook(struct Hook *hook); + + FUNCTION + This function will remove a network monitoring hook that + was previously installed with AddNetMonitorHookTagList(). + It must be called before the library is closed, or the library + will stay in memory indefinitely. + + INPUTS + hook -- Pointer to the Hook previously installed; this may be + NULL in which case this function does nothing. + + NOTES + The RemoveNetMonitorHook() call is an extension to the AmiTCP V4 API + and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_MONITORING_API tag with the + SocketBaseTagList() function. + + SEE ALSO + AddNetMonitorHookTagList() + + bsdsocket.library/send bsdsocket.library/send + + NAME + send - send a message from a socket + + SYNOPSIS + #include + #include + + nbytes = send(s, msg, len, flags) + D0 D0 A0 D1 D2 + + long send(long s, void *msg, long len, long flags); + + FUNCTION + send(), sendto(), and sendmsg() are used to transmit a message to + another socket. Send() may be used only when the socket is in a + connected state, while sendto() and sendmsg() may be used at any + time. + + The address of the target is given by to with tolen specifying its + size. The length of the message is given by len. If the message is + too long to pass atomically through the underlying protocol, the + error EMSGSIZE is returned, and the message is not transmitted. + + No indication of failure to deliver is implicit in a send(). Locally + detected errors are indicated by a return value of -1. + + If no messages space is available at the socket to hold the message + to be transmitted, then send() normally blocks, unless the socket has + been placed in non-blocking I/O mode. The WaitSelect() call may be + used to determine when it is possible to send more data. + + The flags parameter may include one or more of the following: + + #define MSG_OOB 0x1 /* process out-of-band data */ + #define MSG_DONTROUTE 0x4 /* bypass routing, use direct interface */ + + The flag MSG_OOB is used to send ``out-of-band'' data on sockets that + support this notion (e.g. SOCK_STREAM); the underlying protocol must + also support ``out-of-band'' data. MSG_DONTROUTE is usually used only + by diagnostic or routing programs. + + See recv() for a description of the msghdr structure. + + RESULT + The call returns the number of characters sent, or -1 if an error + occurred. + + NOTES + Technically, "send(socket,buf,len,flags)" is equivalent to + calling "sendto(socket,buf,len,flags,NULL,0)". + + ERRORS + send(), sendto(), and sendmsg() fail if: + + [EBADF] + An invalid descriptor was specified. + + [ENOTSOCK] + The argument s is not a socket. + + [EFAULT] + An invalid user space address was specified for a parameter. + + [EMSGSIZE] + The socket requires that message be sent atomically, and the + size of the message to be sent made this impossible. + + [EAGAIN] + The socket is marked non-blocking and the requested operation + would block. + + [ENOBUFS] + The system was unable to allocate an internal buffer. The + operation may succeed when buffers become available. + + [ENOBUFS] + The output queue for a network interface was full. This + generally indicates that the interface has stopped sending, + but may be caused by transient congestion. + + SEE ALSO + IoctlSocket(), recv(), WaitSelect(), getsockopt(), socket() + + bsdsocket.library/sendmsg bsdsocket.library/sendmsg + + NAME + sendmsg - send a message from a socket + + SYNOPSIS + #include + #include + + nbytes = sendmsg(s, msg, flags) + D0 D0 A0 D1 + + long sendmsg(long s, struct msghdr *msg, long flags); + + FUNCTION + send(), sendto(), and sendmsg() are used to transmit a message to + another socket. Send() may be used only when the socket is in a + connected state, while sendto() and sendmsg() may be used at any + time. + + The address of the target is given by to with tolen specifying its + size. The length of the message is given by len. If the message is + too long to pass atomically through the underlying protocol, the + error EMSGSIZE is returned, and the message is not transmitted. + + No indication of failure to deliver is implicit in a send(). Locally + detected errors are indicated by a return value of -1. + + If no messages space is available at the socket to hold the message + to be transmitted, then send() normally blocks, unless the socket has + been placed in non-blocking I/O mode. The WaitSelect() call may be + used to determine when it is possible to send more data. + + The flags parameter may include one or more of the following: + + #define MSG_OOB 0x1 /* process out-of-band data */ + #define MSG_DONTROUTE 0x4 /* bypass routing, use direct interface */ + + The flag MSG_OOB is used to send ``out-of-band'' data on sockets that + support this notion (e.g. SOCK_STREAM); the underlying protocol must + also support ``out-of-band'' data. MSG_DONTROUTE is usually used only + by diagnostic or routing programs. + + See recv() for a description of the msghdr structure. + + RESULT + The call returns the number of characters sent, or -1 if an error + occurred. + + ERRORS + send(), sendto(), and sendmsg() fail if: + + [EBADF] + An invalid descriptor was specified. + + [ENOTSOCK] + The argument s is not a socket. + + [EFAULT] + An invalid user space address was specified for a parameter. + + [EMSGSIZE] + The socket requires that message be sent atomically, and the + size of the message to be sent made this impossible. + + [EAGAIN] + The socket is marked non-blocking and the requested operation + would block. + + [ENOBUFS] + The system was unable to allocate an internal buffer. The + operation may succeed when buffers become available. + + [ENOBUFS] + The output queue for a network interface was full. This + generally indicates that the interface has stopped sending, + but may be caused by transient congestion. + + SEE ALSO + IoctlSocket(), recv(), WaitSelect(), getsockopt(), socket() + + bsdsocket.library/sendto bsdsocket.library/sendto + + NAME + sendto - send a message from a socket + + SYNOPSIS + #include + #include + + nbytes = sendto(s, msg, len, flags, to, tolen) + D0 D0 A0 D1 D2 A1 D3 + + long sendto(long s, void *msg, long len, long flags, + struct sockaddr *to, long tolen); + + FUNCTION + send(), sendto(), and sendmsg() are used to transmit a message to + another socket. Send() may be used only when the socket is in a + connected state, while sendto() and sendmsg() may be used at any + time. + + The address of the target is given by to with tolen specifying its + size. The length of the message is given by len. If the message is + too long to pass atomically through the underlying protocol, the + error EMSGSIZE is returned, and the message is not transmitted. + + No indication of failure to deliver is implicit in a send(). Locally + detected errors are indicated by a return value of -1. + + If no messages space is available at the socket to hold the message + to be transmitted, then send() normally blocks, unless the socket has + been placed in non-blocking I/O mode. The WaitSelect() call may be + used to determine when it is possible to send more data. + + The flags parameter may include one or more of the following: + + #define MSG_OOB 0x1 /* process out-of-band data */ + #define MSG_DONTROUTE 0x4 /* bypass routing, use direct interface */ + + The flag MSG_OOB is used to send ``out-of-band'' data on sockets that + support this notion (e.g. SOCK_STREAM); the underlying protocol must + also support ``out-of-band'' data. MSG_DONTROUTE is usually used only + by diagnostic or routing programs. + + See recv() for a description of the msghdr structure. + + RESULT + The call returns the number of characters sent, or -1 if an error + occurred. + + ERRORS + send(), sendto(), and sendmsg() fail if: + + [EBADF] + An invalid descriptor was specified. + + [ENOTSOCK] + The argument s is not a socket. + + [EFAULT] + An invalid user space address was specified for a parameter. + + [EMSGSIZE] + The socket requires that message be sent atomically, and the + size of the message to be sent made this impossible. + + [EAGAIN] + The socket is marked non-blocking and the requested operation + would block. + + [ENOBUFS] + The system was unable to allocate an internal buffer. The + operation may succeed when buffers become available. + + [ENOBUFS] + The output queue for a network interface was full. This + generally indicates that the interface has stopped sending, + but may be caused by transient congestion. + + SEE ALSO + IoctlSocket(), recv(), WaitSelect(), getsockopt(), socket() + + bsdsocket.library/SetDefaultDomainName bsdsocket.library/SetDefaultDomainName + + NAME + SetDefaultDomainName - Configure the domain name that will be added + to the end of host names which lack a domain name. + + SYNOPSIS + SetDefaultDomainName(name) + A0 + + VOID SetDefaultDomainName(STRPTR name); + + FUNCTION + If no domain name is part of a host name, a default domain name can be + added to it if the host name lookup fails. This is normally controlled + by the name server configuration file but may be overridden either + through an environment variable or a call to SetDefaultDomainName(). + + INPUTS + name -- The default domain name (as per RFC 1035). This cannot be + longer than 255 characters in total and preferrably should be + much shorter. Only a single domain name can be configured here. + If you need more, either use the LOCALDOMAIN environment + variable or edit the file "DEVS:Internet/name_resolution". + + NOTES + The SetDefaultDomainName() call is an extension to the + AmiTCP V4 API and cannot be assumed to be present in all versions + of "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_DNS_API tag with the + SocketBaseTagList() function. + + SEE ALSO + GetDefaultDomainName(), SocketBaseTagList() + + bsdsocket.library/SetErrnoPtr bsdsocket.library/SetErrnoPtr + + NAME + SetErrnoPtr - set the reference to the errno variable + + SYNOPSIS + SetErrnoPtr(errno_ptr, size) + A0 D0 + + void SetErrnoPtr(void *errno_ptr, long size); + + FUNCTION + This function is deprecated; SocketBaseTags() with the + SBTC_ERRNOPTR tag should be used instead. + + This function is for linking an program's local 'errno' variable + to the kernel's error code state information, as set when a + function call fails. + + INPUTS + errno_ptr - Pointer to the local program's 'errno' variable, + e.g. '&errno'. + + size - Size of the local program's 'errno' variable, e.g. + 'sizeof(errno)'. + + SEE ALSO + Errno() + + bsdsocket.library/setnetent bsdsocket.library/setnetent + + NAME + setnetent - get network entry + + SYNOPSIS + #include + + setnetent(stayopen) + D0 + + void setnetent(int stayopen); + + FUNCTION + The setnetent() function opens and 'rewinds' the net database. If the + 'stayopen' flag is non-zero, the net data base will not be closed + after each call to getnetbyname() or getnetbyaddr(). + + SEE ALSO + getnetent(), getnetbyaddr(), getnetbyname(), endnetent() + + BUGS + The data space used by these functions is static; if future use + requires the data, it should be copied before any subsequent calls to + these functions overwrite it. Only Internet network numbers are + currently understood. Expecting network numbers to fit in no more + than 32 bits is probably naive. + + NOTES + The setnetent() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_LOCAL_DATABASE_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/setprotoent bsdsocket.library/setprotoent + + NAME + setprotoent - get protocol entry + + SYNOPSIS + #include + + setprotoent(stayopen) + D0 + + void setprotoent(LONG stayopen); + + FUNCTION + The setprotoent() function opens and 'rewinds' the protocol database. + If the 'stayopen' flag is non-zero, the protocol data base will not + be closed after each call to getprotobyname() or getprotobynumber(). + + SEE ALSO + getprotoent(), getprotobynumber(), getprotobyname(), endprotoent() + + BUGS + These functions use a static data space; if the data is needed for + future use, it should be copied before any subsequent calls overwrite + it. Only the Internet protocols are currently understood. + + NOTES + The setprotoent() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_LOCAL_DATABASE_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/setservent bsdsocket.library/setservent + + NAME + setservent - get service entry + + SYNOPSIS + #include + + setservent(stayopen) + D0 + + void setservent(LONG stayopen); + + FUNCTION + The setservent() function opens and 'rewinds' the service database. + If the 'stayopen' flag is non-zero, the database will not be + closed after each call to getservbyname() or getservbyport(). + + SEE ALSO + getservent(), getservbyname(), getservbyport(), endservent() + + BUGS + These functions use static data storage; if the data is needed for + future use, it should be copied before any subsequent calls overwrite + it. Expecting port numbers to fit in a 32 bit quantity is probably + naive. + + NOTES + The setservent() call is an extension to the AmiTCP V4 API and + cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_LOCAL_DATABASE_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/SetSocketSignals bsdsocket.library/SetSocketSignals + + NAME + SetSocketSignals - set the signals to be sent for socket events + + SYNOPSIS + SetSocketSignals(int_mask, io_mask, urgent_mask) + D0 D1 D2 + + void SetSocketSignals(ULONG int_mask, ULONG io_mask, ULONG urgent_mask); + + FUNCTION + This function is deprecated. SocketBaseTags() should be used instead + with the SBTC_BREAKMASK, SBTC_SIGIOMASK and SBTC_SIGURGMASK tags. + + The purpose of this function is to associate Exec signal masks with + the Unix signals SIGINT (= int_mask), SIGIO (= io_mask) and + SIGURG (= urgent_mask). + + SIGINT is the signal to send to the process which owns the socket + in order to abort a blocking operation, such as recv(). + + SIGIO is the signal which will be sent to the owner of the socket + when an asynchronous notification of socket events arrives. + + SIGURG is the signal which will be sent to the owner of the socket + when out-of-band data arrives. + + SEE ALSO + IoctlSocket(), recv(), send(), WaitSelect() + + bsdsocket.library/setsockopt bsdsocket.library/setsockopt + + NAME + setsockopt - set options on sockets + + SYNOPSIS + #include + #include + + success = setsockopt(s, level, optname, optval, optlen) + D0 D0 D1 D2 A0 D3 + + long setsockopt(long s, long level, long optname, + void *optval, long optlen); + + FUNCTION + getsockopt() and setsockopt() manipulate the options associated with + a socket. Options may exist at multiple protocol levels; they are + always present at the uppermost ``socket'' level. + + When manipulating socket options the level at which the option + resides and the name of the option must be specified. To manipulate + options at the socket level, level is specified as SOL_SOCKET. To + manipulate options at any other level the protocol number of the + appropriate protocol controlling the option is supplied. For example, + to indicate that an option is to be interpreted by the TCP protocol, + level should be set to the protocol number of TCP. + + The parameters optval and optlen are used to access option values for + setsockopt(). For getsockopt() they identify a buffer in which the + value for the requested option(s) are to be returned. For + getsockopt(), optlen is a value-result parameter, initially + containing the size of the buffer pointed to by optval, and modified + on return to indicate the actual size of the value returned. If no + option value is to be supplied or returned, optval may be NULL. + + Optname and any specified options are passed uninterpreted to the + appropriate protocol module for interpretation. The include file + contains definitions for socket level options, + described below. Options at other protocol levels vary in format and + name; consult the appropriate entries in section 4 of the manual. + + Most socket-level options utilize an int parameter for optval. For + setsockopt(), the parameter should be non-zero to enable a boolean + option, or zero if the option is to be disabled. SO_LINGER uses a + struct linger parameter, defined in , which specifies + the desired state of the option and the linger interval (see below). + SO_SNDTIMEO and SO_RCVTIMEO use a struct timeval parameter, defined + in . + + The following options are recognized at the socket level. Except as + noted, each may be examined with getsockopt() and set with + setsockopt(). + + SO_DEBUG + enables recording of debugging information + SO_REUSEADDR + enables local address reuse + SO_REUSEPORT + enables duplicate address and port bindings + SO_KEEPALIVE + enables keep connections alive + SO_DONTROUTE + enables routing bypass for outgoing messages + SO_LINGER + linger on close if data present + SO_BROADCAST + enables permission to transmit broadcast messages + SO_OOBINLINE + enables reception of out-of-band data in band + SO_SNDBUF + set buffer size for output + SO_RCVBUF + set buffer size for input + + SO_SNDLOWAT + set minimum count for output + SO_RCVLOWAT + set minimum count for input + SO_SNDTIMEO + set timeout value for output + SO_RCVTIMEO + set timeout value for input + SO_TYPE + get the type of the socket (get only) + SO_ERROR + get and clear error on the socket (get only) + + SO_DEBUG enables debugging in the underlying protocol modules. + SO_REUSEADDR indicates that the rules used in validating addresses + supplied in a bind() call should allow reuse of local addresses. + SO_REUSEPORT allows completely duplicate bindings by multiple + processes if they all set SO_REUSEPORT before binding the port. This + option permits multiple instances of a program to each receive UDP/IP + multicast or broadcast datagrams destined for the bound port. + SO_KEEPALIVE enables the periodic transmission of messages on a + connected socket. SO_DONTROUTE indicates that outgoing messages should + bypass the standard routing facilities. Instead, messages are directed + to the appropriate network interface according to the network portion + of the destination address. + + SO_LINGER controls the action taken when unsent messages are queued + on socket and a CloseSocket() is performed. If the socket promises + reliable delivery of data and SO_LINGER is set, the system will block + the process on the close attempt until it is able to transmit the + data or until it decides it is unable to deliver the information (a + timeout period, termed the linger interval, is specified in seconds + in the setsockopt() call when SO_LINGER is requested). If SO_LINGER + is disabled and a close is issued, the system will process the close + in a manner that allows the process to continue as quickly as + possible. + + The option SO_BROADCAST requests permission to send broadcast + datagrams on the socket. Broadcast was a privileged operation in + earlier versions of the system. With protocols that support + out-of-band data, the SO_OOBINLINE option requests that out-of-band + data be placed in the normal data input queue as received; it will + then be accessible with recv or read calls without the MSG_OOB flag. + Some protocols always behave as if this option is set. SO_SNDBUF and + SO_RCVBUF are options to adjust the normal buffer sizes allocated for + output and input buffers, respectively. The buffer size may be + increased for high-volume connections, or may be decreased to limit + the possible backlog of incoming data. The system places an absolute + limit on these values. + + SO_SNDLOWAT is an option to set the minimum count for output + operations. Most output operations process all of the data supplied + by the call, delivering data to the protocol for transmission and + blocking as necessary for flow control. Nonblocking output operations + will process as much data as permitted subject to flow control + without blocking, but will process no data if flow control does not + allow the smaller of the low water mark value or the entire request + to be processed. A WaitSelect() operation testing the ability to + write to a socket will return true only if the low water mark amount + could be processed. The default value for SO_SNDLOWAT is set to a + convenient size for network efficiency, often 1024. SO_RCVLOWAT is an + option to set the minimum count for input operations. In general, + receive calls will block until any (non-zero) amount of data is + received, then return with the smaller of the amount available or the + amount requested. The default value for SO_RCVLOWAT is 1. If + SO_RCVLOWAT is set to a larger value, blocking receive calls normally + wait until they have received the smaller of the low water mark value + or the requested amount. Receive calls may still return less than the + low water mark if an error occurs, a signal is caught, or the type of + data next in the receive queue is different than that returned. + + SO_SNDTIMEO is an option to set a timeout value for output + operations. It accepts a struct timeval parameter with the number of + seconds and microseconds used to limit waits for output operations to + complete. If a send operation has blocked for this much time, it + returns with a partial count or with the error EWOULDBLOCK if no data + were sent. In the current implementation, this timer is restarted + each time additional data are delivered to the protocol, implying + that the limit applies to output portions ranging in size from the + low water mark to the high water mark for output. SO_RCVTIMEO is an + option to set a timeout value for input operations. It accepts a + struct timeval parameter with the number of seconds and microseconds + used to limit waits for input operations to complete. In the current + implementation, this timer is restarted each time additional data are + received by the protocol, and thus the limit is in effect an + inactivity timer. If a receive operation has been blocked for this + much time without receiving additional data, it returns with a short + count or with the error EWOULDBLOCK if no data were received. + + Finally, SO_TYPE and SO_ERROR are options used only with + getsockopt(). SO_TYPE returns the type of the socket, such as + SOCK_STREAM; it is useful for servers that inherit sockets on + startup. SO_ERROR returns any pending error on the socket and clears + the error status. It may be used to check for asynchronous errors on + connected datagram sockets or for other asynchronous errors. + + RESULT + A 0 is returned if the call succeeds, -1 if it fails. + + ERRORS + The call succeeds unless: + + [EBADF] + The argument s is not a valid descriptor. + + [ENOTSOCK] + The argument s is a file, not a socket. + + [ENOPROTOOPT] + The option is unknown at the level indicated. + + [EFAULT] + The address pointed to by optval is not in a valid part of + the process address space. For getsockopt(), this error + may also be returned if optlen is not in a valid part of + the process address space. + + SEE ALSO + IoctlSocket(), socket(), ip + + bsdsocket.library/shutdown bsdsocket.library/shutdown + + NAME + shutdown - shut down part of a full-duplex connection + + SYNOPSIS + #include + + success = shutdown(s, how) + D0 D0 D1 + + long shutdown(long s, long how); + + FUNCTION + The shutdown() call causes all or part of a full-duplex connection on + the socket associated with s to be shut down. If how is 0, further + receives will be disallowed. If how is 1, further sends will be + disallowed. If how is 2, further sends and receives will be + disallowed. + + RESULT + A 0 is returned if the call succeeds, -1 if it fails. + + ERRORS + The call succeeds unless: + + [EBADF] + s is not a valid descriptor. + + [ENOTSOCK] + s is a file, not a socket. + + [ENOTCONN] + The specified socket is not connected. + + SEE ALSO + connect(), socket() + + bsdsocket.library/socket bsdsocket.library/socket + + NAME + socket - create an endpoint for communication + + SYNOPSIS + #include + #include + + s = socket(domain, type, protocol) + D0 D0 D1 D2 + + long socket(long domain, long type, long protocol); + + FUNCTION + socket() creates an endpoint for communication and returns a + descriptor. + + The domain parameter specifies a communications domain within which + communication will take place; this selects the protocol family which + should be used. These families are defined in the include file + . The only supported domain is: + + AF_INET + ARPA Internet protocols + + The socket has the indicated type, which specifies the semantics of + communication. Currently defined types are: + + SOCK_STREAM + SOCK_DGRAM + SOCK_RAW + SOCK_SEQPACKET + SOCK_RDM + + A SOCK_STREAM type provides sequenced, reliable, two-way connection + based byte streams. An out-of-band data transmission mechanism may be + supported. A SOCK_DGRAM socket supports datagrams (connectionless, + unreliable messages of a fixed (typically small) maximum length). A + SOCK_SEQPACKET socket may provide a sequenced, reliable, two-way + connection-based data transmission path for datagrams of fixed + maximum length; a consumer may be required to read an entire packet + with each read system call. This facility is protocol specific, and + presently implemented only for PF_NS. SOCK_RAW sockets provide access + to internal network protocols and interfaces. The types SOCK_RAW, + which is available only to the super-user, and SOCK_RDM, which is + planned, but not yet implemented, are not described here. + + The protocol specifies a particular protocol to be used with the + socket. Normally only a single protocol exists to support a + particular socket type within a given protocol family. However, it is + possible that many protocols may exist, in which case a particular + protocol must be specified in this manner. The protocol number to use + is particular to the communication domain in which communication is + to take place. + + Sockets of type SOCK_STREAM are full-duplex byte streams, similar to + pipes. A stream socket must be in a connected state before any data + may be sent or received on it. A connection to another socket is + created with a connect() call. Once connected, data may be + transferred using some variant of the send() and recv() calls. When a + session has been completed a CloseSocket() may be performed. + Out-of-band data may also be transmitted as described in send() and + received as described in recv(). + + The communications protocols used to implement a SOCK_STREAM insure + that data is not lost or duplicated. If a piece of data for which the + peer protocol has buffer space cannot be successfully transmitted + within a reasonable length of time, then the connection is considered + broken and calls will indicate an error with -1 returns and with + ETIMEDOUT as the specific code in the global variable errno. The + protocols optionally keep sockets ``warm'' by forcing transmissions + roughly every minute in the absence of other activity. An error is + then indicated if no response can be elicited on an otherwise idle + connection for a extended period (e.g. 5 minutes). + + SOCK_SEQPACKET sockets employ the same system calls as SOCK_STREAM + sockets. The only difference is that recv() calls will return only + the amount of data requested, and any remaining in the arriving + packet will be discarded. + + SOCK_DGRAM and SOCK_RAW sockets allow sending of datagrams to + correspondents named in send() calls. Datagrams are generally + received with recvfrom(), which returns the next datagram with its + return address. + + An IoctlSocket() call can be used to specify a process group to + receive a SIGURG signal when the out-of-band data arrives. It may + also enable nonblocking I/O and asynchronous notification of I/O + events via SIGIO. + + The operation of sockets is controlled by socket level options. These + options are defined in the file . setsockopt() and + getsockopt() are used to set and get options, respectively. + + RESULT + A -1 is returned if an error occurs, otherwise the return value is a + descriptor referencing the socket. + + ERRORS + The socket() call fails if: + + [EPROTONOSUPPORT] + The protocol type or the specified protocol is not + supported within this domain. + + [EMFILE] + The per-process descriptor table is full. + + [ENFILE] + The system file table is full. + + [EACCESS] + Permission to create a socket of the specified type + and/or protocol is denied. + + [ENOBUFS] + Insufficient buffer space is available. The socket + cannot be created until sufficient resources are + freed. + + SEE ALSO + accept(), bind(), connect(), getsockname(), + getsockopt(), IoctlSocket(2), listen(), recv(), WaitSelect(), + send(), shutdown(), icmp, tcp, udp + + bsdsocket.library/SocketBaseTagList bsdsocket.library/SocketBaseTagList + + NAME + SocketBaseTagList - get/set global library attributes + + SYNOPSIS + result = SocketBaseTagList(tags) + D0 A0 + + long SocketBaseTagList(struct TagItem *tags); + + long SocketBaseTags(Tag first_tag, ...); + + FUNCTION + This function is for querying and changing attributes of the + stack's state information. + + The header file defines macros for base + tag code values. Base tag code macro names begin with `SBTC_' (as in + 'Socket Base Tag Code'). The base tag value defines the data item + which the tag item refers to. + + The tag code contains other information besides the referred data + item. It controls whether the SocketBaseTagList() should set or get + the appropriate parameter, and whether the argument of the tag in + question is passed by value or by reference. + + The header file defines the following + macros, which are used to construct the ti_Tag values from the base + tag codes: + + SBTM_GETREF(code) - get by reference + SBTM_GETVAL(code) - get by value + SBTM_SETREF(code) - set by reference + SBTM_SETVAL(code) - set by value + + If the actual data is stored directly in the ti_Data field, you + should use the 'by value' macros, SBTM_GETVAL() or SBTM_SETVAL(). + This is not recommended since it runs counter to the TagItem + concept. + + However, if the ti_Data field contains a pointer to actual data, you + should use the 'by reference' macros, SBTM_GETREF() or SBTM_SETREF(). + In either case the actual data should always be a LONG aligned to + an even address. + + According the tag naming scheme a tag which has a "PTR" suffix + takes a pointer as its argument. Don't mix the pointer arguments + with 'by reference' argument passing. It is possible to pass a + pointer by reference (in which case the ti_Data is a pointer to the + actual pointer). + + The list of all defined base tag codes is as follows: + + SBTC_SIG_ADDRESS_CHANGE_MASK + Tag data contains the Exec signal mask to be sent when an + interface address has changed. The receiver is responsible for + figuring out what exactly has changed and whether the change + needs reacting to. Default for this mask is 0, i.e. no + notification will be sent. + + This tag is an extension to the AmiTCP V4 API and cannot + be expected to be supported by older "bsdsocket.library" + versions. + + SBTC_BREAKMASK + Tag data contains the Exec signal mask to be associated with + the Unix SIGINT signal. By default, this is SIGBREAKF_CTRL_C. + + SBTC_CAN_SHARE_LIBRARY_BASES + This tag is an extension to the AmiTCP V4 API and cannot + be expected to be supported by older "bsdsocket.library" + versions. + + Normally, every client to call "bsdsocket.library" + routines will have to reopen the library and obtain its + own instance of the per-library base variables. The + SBTC_CAN_SHARE_LIBRARY_BASES tag can be used to allow + several Tasks/Processes to share a single library + base. Note that error reporting will become rather + difficult if you do this, as there is only one instance + of the library state variables per base. Also, the + signal delivery mechanisms behind SBTC_SIGIOMASK, + SBTC_SIGEVENTMASK and SBTC_SIGURGMASK will only work for + the Process that configured them. + + This option only has local impact in that it affects only + the single library base for which it was configured. + + SBTC_DTABLESIZE + Tag data contains the number of entries in the socket + descriptor table. This number indicates how many sockets may + be use at a time per process. + + For Roadshow, the default is 256 sockets. Other TCP/IP stacks + may use a smaller number. + + SBTC_ERRNO + The value of the 'errno' state variable. + + SBTC_ERRNOBYTEPTR + SBTC_ERRNOWORDPTR + SBTC_ERRNOLONGPTR + SBTC_ERRNOPTR(size) + Link the program's global 'errno' variable to the protocol + stack's internal errno variable, by passing a pointer to the + program's variable to the protocol stack. + + The SBTC_ERRNOPTR(size) is a macro, which expands to one of + the other (BYTE, WORD or LONG) tag codes, meaning that only + 1, 2 and 4 are legal size values. + + SBTC_ERRNOSTRPTR + The error string corresponding to an error code. The tag + is used both for input and output: in goes the error code + (a pointer to an integer), out goes a pointer to the + corresponding error string. + + SBTC_ERROR_HOOK + Install or remove a hook which is called whenever the global + 'errno' or 'h_errno' variables are changed. The hook is always + called on the context of the caller and can be used together + with SBTC_CAN_SHARE_LIBRARY_BASES feature to safely deliver + the error codes to concurrent processes. + + The hook will be called with the following parameters: + + error = hookfunc(hook,reserved,ehm) + D0 A0 A2 A1 + + LONG hookfunc(struct Hook *hook, APTR reserved, + struct ErrorHookMsg *ehm); + + The 'reserved' parameter will be set to NULL + for future expansion. + + The contents of the ErrorHookMsg are as follows: + + ehm_Size + Size of the data structure in bytes. This + May grow in future releases. Always make sure + to verify that the message size is exactly as + you expected it. + + ehm_Action + This can be EHMA_Set_errno, or EHMA_Set_h_errno, + indicating which variable should be changed. + Any other value should be ignored. + + ehm_Code + The error code to be set. + + The SBTC_ERROR_HOOK tag is an extension to the AmiTCP V4 API + and cannot be expected to be supported by older "bsdsocket.library" + versions. + + SBTC_FDCALLBACK + This function is deprecated and should not used by new code. + + Install a callback hook that is called by the kernel whenever + the file descriptor table is modified. + + SBTC_GET_BYTES_RECEIVED + Obtain the number of bytes received by the TCP/IP stack. + The parameter must be of type 'SBQUAD_T'. Note that the + data must be passed by reference. + + Older version of "bsdsocket.library" may return a failure + code when querying this option. + + SBTC_GET_BYTES_SENT + Obtain the number of bytes sent by the TCP/IP stack. + The parameter must be of type 'SBQUAD_T'. Note that the + data must be passed by reference. + + Older version of "bsdsocket.library" may return a failure + code when querying this option. + + SBTC_HAVE_ADDRESS_CONVERSION_API + This tag is an extension to the AmiTCP V4 API and must be + used prior to calling any of the address conversion API + functions, such as inet_aton(), inet_ntop() and inet_pton(). + Since older "bsdsocket.library" implementations do not + process this tag you should be prepared to handle failure of + the query operation. + + This tag will return TRUE if the address conversion API is + supported, and FALSE or failure otherwise. + + SBTC_HAVE_DNS_API + This tag is an extension to the AmiTCP V4 API and must be + used prior to calling any of the DNS API functions, + such as AddDomainNameServer() and RemoveDomainNameServer(). + Since older "bsdsocket.library" implementations do not + process this tag you should be prepared to handle failure of + the query operation. + + This tag will return TRUE if the DNS API is supported, + and FALSE or failure otherwise. + + SBTC_HAVE_GETHOSTADDR_R_API + This tag is an extension to the AmiTCP V4 API and must be + used prior to calling the gethostbyname_r() or + gethostbyaddr_r() functions. Since older "bsdsocket.library" + implementations do not process this tag you should be prepared + to handle failure of the query operation. + + This tag will return TRUE if the gethostbyname_r() and + gethostbyaddr_r() functions are supported, + and FALSE or failure otherwise. + + SBTC_HAVE_INTERFACE_API + This tag is an extension to the AmiTCP V4 API and must be + used prior to calling any of the interface API functions, + such as AddInterfaceTagList() and ConfigureInterfaceTagList(). + Since older "bsdsocket.library" implementations do not + process this tag you should be prepared to handle failure of + the query operation. + + This tag will return TRUE if the interface API is supported, + and FALSE or failure otherwise. + + SBTC_HAVE_KERNEL_MEMORY_API + This tag is an extension to the AmiTCP V4 API and must be + used prior to calling any of the kernel memory API functions, + such as mbuf_copym(), mbuf_free() or mbuf_mget(). + Since older "bsdsocket.library" implementations do not + process this tag you should be prepared to handle failure of + the query operation. + + This tag will return TRUE if the kernel memory API is supported, + and FALSE or failure otherwise. + + SBTC_HAVE_LOCAL_DATABASE_API + This tag is an extension to the AmiTCP V4 API and must be + used prior to calling any of the local database access API + functions, setnetent() and getprotoent(). Since older + "bsdsocket.library" implementations do not process this tag + you should be prepared to handle failure of the query + operation. + + This tag will return TRUE if the local database access API + is supported, and FALSE or failure otherwise. + + SBTC_HAVE_MONITORING_API + This tag is an extension to the AmiTCP V4 API and must be + used prior to calling any of the interface API functions, + such as AddNetMonitorHookTagList() and RemoveNetMonitorHook(). + Since older "bsdsocket.library" implementations do not + process this tag you should be prepared to handle failure of + the query operation. + + This tag will return TRUE if the monitoring API is supported, + and FALSE or failure otherwise. + + SBTC_HAVE_ROADSHOWDATA_API + This tag is an extension to the AmiTCP V4 API and must be + used prior to calling any of the RoadshowData API functions, + such as ObtainRoadshowData() and ReleaseRoadshowData(). + Since older "bsdsocket.library" implementations do not + process this tag you should be prepared to handle failure of + the query operation. + + This tag will return TRUE if the RoadshowData API is supported, + and FALSE or failure otherwise. + + SBTC_HAVE_ROUTING_API + This tag is an extension to the AmiTCP V4 API and must be + used prior to calling any of the routing API functions, + such as AddRouteTagList() and DeleteRouteTagList(). Since + older "bsdsocket.library" implementations do not process + this tag you should be prepared to handle failure of the + query operation. + + This tag will return TRUE if the routing API is supported, + and FALSE or failure otherwise. + + SBTC_HAVE_SERVER_API + This tag is an extension to the AmiTCP V4 API and must be + used prior to calling any of the server API functions, + such as ProcessIsServer() and ObtainServerSocket(). Since + older "bsdsocket.library" implementations do not process + this tag you should be prepared to handle failure of the + query operation. + + This tag will return TRUE if the server API is supported, + and FALSE or failure otherwise. + + SBTC_HAVE_STATUS_API + This tag is an extension to the AmiTCP V4 API and must be + used prior to calling any of the interface API functions, + such as GetNetworkStatistics(). Since older "bsdsocket.library" + implementations do not process this tag you should be prepared + to handle failure of the query operation. + + This tag will return TRUE if the status API is supported, + and FALSE or failure otherwise. + + SBTC_HERRNO + The current value of the h_errno variable which contains the + error code from the resolver. Note: the protocol stack assumes + that sizeof(h_errno) == sizeof(long). + + SBTC_HERRNOSTRPTR + The error string corresponding to a resolver error code. The + tag is used both for input and output: in goes the error code + (a pointer to an integer), out goes a pointer to the + corresponding error string. + + SBTC_ICMP_MASK_REPLY + This tag is an extension to the AmiTCP V4 API and cannot + be expected to be supported by older "bsdsocket.library" + versions. + + This tag is for querying and changing whether ICMP address + mask requests will be answered. This option is disabled + by default. + + SBTC_ICMP_PROCESS_ECHO + This tag is an extension to the AmiTCP V4 API and cannot + be expected to be supported by older "bsdsocket.library" + versions. + + This tag is for querying and changing how the stack should + process an incoming ICMP echo request (such as sent by the + 'ping' utility). The following reactions are possible: + + IR_Process + The request will be processed and a corresponding + ICMP_ECHOREPLY message will be sent. + + IR_Ignore + The request will be ignored, but fed into the + raw IP packet processing framework. + + IR_Drop + The request will be ignored and treated as if it + had a checksum error. + + The default is IR_Process. Note that this option affects + the entire protocol stack and is not limited to the + library base you set it with. + + SBTC_ICMP_PROCESS_TSTAMP + This tag is an extension to the AmiTCP V4 API and cannot + be expected to be supported by older "bsdsocket.library" + versions. + + This tag is for querying and changing how the stack should + process an incoming ICMP time stamp request. The following + reactions are possible: + + IR_Process + The request will be processed and a corresponding + ICMP_TSTAMPREPLY message will be sent. + + IR_Ignore + The request will be ignored, but fed into the + raw IP packet processing framework. + + IR_Drop + The request will be ignored and treated as if it + had a checksum error. + + The default is IR_Process. Note that this option affects + the entire protocol stack and is not limited to the + library base you set it with. + + SBTC_ICMP_SEND_REDIRECTS + This tag is an extension to the AmiTCP V4 API and cannot + be expected to be supported by older "bsdsocket.library" + versions. + + This tag is for querying and changing whether ICMP redirect + messages will be sent when forwarding IP datagrams. This + option is enabled by default, but will have no effect unless + the protocol stack is configured to forward IP datagrams + (using the SBTC_IP_FORWARDING option). + + Note that this option affects the entire protocol stack + and is not limited to the library base you set it with. + + SBTC_IDN_DEFAULT_CHARACTER_SET + This tag is an extension to the AmiTCP V4 API and cannot + be expected to be supported by older "bsdsocket.library" + versions. + + "Roadshow" can perform international domain name translations + during host name and IP resolution. This takes place on the fly + without the application really noticing what happened. To + perform this translation, it must be known which character set + the domain names should be represented in. By default, this is + the native Amiga ISO 8859 Latin 1 character set. Possible + choices are: + + IDNCS_ASCII + + Do not perform any translation; this leaves this task + to the application calling the name resolution + functions. + + IDNCS_ISO_8859_LATIN_1 + + This is the default. Perform translations using the + ISO 8859 Latin 1 character set; if this translation + is not possible, return the domain name unchanged. + + More character sets may be added in future releases. Note that + if the library does not understand the character set code you + select, then it will behave as if IDNCS_ASCII had been + selected. + + SBTC_IOERRNOSTRPTR + This function is deprecated and should not used by new code. + + The error string corresponding to an Exec I/O error code. The + tag is used both for input and output: in goes the error code + (a pointer to a positive integer), out goes a pointer to the + corresponding error string. + + SBTC_IPF_API_VERSION + This tag is an extension to the AmiTCP V4 API and must be + used prior to calling any of the IP filter API functions, + such as ipf_open() and ipf_ioctl(). Since older + "bsdsocket.library" implementations do not process this tag + you should be prepared to handle failure of the query + operation. + + This tag can be used to query if the IP filter API is + implemented, and which version of that API is available. + Version numbers that do not exactly match the number you + expected must be rejected. Future version of the IP filter + may use different data structures and/or drop existing + functionality. + + Older version of "bsdsocket.library" may return a failure + code when querying this option. + + Because the IP filter API is subject to change, it is + intentionally not documented or otherwise supported by + public source code. + + SBTC_IP_FILTER_HOOK + This tag is an extension to the AmiTCP V4 API and cannot + be expected to be supported by older "bsdsocket.library" + versions. + + This tag is for querying and installing a hook that will + be called for every datagram that arrives and for every + datagram to be sent. To remove a hook that was installed, + install one with an address of NULL. + + The hook will be called with the following parameters: + + error = hookfunc(hook,reserved,ifm) + D0 A0 A2 A1 + + LONG hookfunc(struct Hook *hook, APTR reserved, + struct IPFilterMsg *ifm); + + The 'reserved' parameter will be set to NULL + for future expansion. + + The contents of the IPFilterMsg are as follows: + + ifm_Size + Size of the data structure in bytes. This + May grow in future releases. Always make sure + to verify that the message size is exactly as + you expected it. + + ifm_IP + Pointer to the IP packet header. + + ifm_IPLength + Size of the IP packet header in bytes. + + ifm_Interface + Refers to the interface the packet either arrived + at or is about to be sent to. + + ifm_Direction + This indicates whether the packet submitted to your + filter has arrived (IFMD_Incoming) or is about to + be sent (IFMD_Outgoing). + + ifm_Packet + Points to the packet to be sent, as stored in an + linked list of memory buffer structures (mbufs). + + Your hook function must evaluate the contents of the packet + and, based upon that evaluation, return an error code. If + that error code (see ) is non-zero, the packet + will be dropped. That is, it will either not enter the TCP/IP + stack's processing (IFMD_Incoming) or it will not be sent + (IFMD_Outgoing). Return 0 if the packet may pass. You must + perform your filtering as quickly as possible because your + hook function will be invoked by the kernel itself and + data processing may be be delayed otherwise. + + The contents of the IPFilterMsg are essentially read-only, + but if you must, you can make modifications to the ifm_Packet + data. If you do so, you *must* make a copy of the packet, + release the old packet and put the address of the modified + copy into the ifm_Packet field. You can also force a packet + to be dropped by setting the ifm_Packet field to NULL. + + To make copies of packets, to extract information from + them or to release them, you must use the kernel memory + API. + + SBTC_IP_FORWARDING + This tag is an extension to the AmiTCP V4 API and cannot + be expected to be supported by older "bsdsocket.library" + versions. + + This tag is for querying and changing whether IP datagrams + will be forwarded or not. This option is disabled by + default which means that IP datagrams are not forwarded. + + Note that this option affects the entire protocol stack + and is not limited to the library base you set it with. + + SBTC_IP_DEFAULT_TTL + This tag is an extension to the AmiTCP V4 API and cannot + be expected to be supported by older "bsdsocket.library" + versions. + + This tag is for querying and changing the default IP + packet TTL value. The default value is 64 (per RFC 1340). + + Note that this option affects the entire protocol stack + and is not limited to the library base you set it with. + + SBTC_LOGFACILITY + Facility code for the syslog messages as defined in the + header file . Defaults to LOG_USER. + + SBTC_LOG_FILE_NAME + This tag is an extension to the AmiTCP V4 API and cannot + be expected to be supported by older "bsdsocket.library" + versions. + + This tag can be used to alter or query the name of the + file log messages will be sent to. To change the name, + pass in a pointer to the new file name; it will be + copied. To find out what the current name is, post a + query request; you will receive a pointer to the string + containing the name. + + The size of the name buffer is limited to about 510 + characters. File names longer than this will be truncated. + An empty file name has the effect of turning log message + reporting off entirely. + + If the output file is not a console window, then any + new messages will be appended to the existing log file. + + Note that this option affects the entire protocol stack + and is not limited to the library base you set it with. + + SBTC_LOG_HOOK + This tag is an extension to the AmiTCP V4 API and cannot + be expected to be supported by older "bsdsocket.library" + versions. + + The logging mechanism can call a hook rather than sending + log messages to the process which records and displays them. + It's this hook which can be installed or queried using this + tag. Installing a NULL pointer in place of a hook will cause + logging messages to be displayed and recorded again. Note + that the hook will be invoked on the context of the process + which called into 'vsyslog()', which may be the TCP/IP stack + itself. You should therefore process the message as quickly + as possible. + + The hook will be called with the following parameters: + + hookfunc(hook,reserved,lhm) + A0 A2 A1 + + VOID hookfunc(struct Hook *hook, APTR reserved, + struct LogHookMessage *lhm); + + The 'reserved' parameter will be set to NULL + for future expansion. + + The contents of the LogHookMessage are read-only and must + not be modified. + + SBTC_LOGMASK + Sets the filter mask of the syslog messages. By default the + mask is 0xFF, meaning that all messages are passed to the + logging system. + + SBTC_LOGSTAT + Syslog options as defined in . + + SBTC_LOGTAGPTR + A pointer to a string which is used by syslog() to mark + individual syslog messages. This defaults to NULL. + + SBTC_NUM_PACKET_FILTER_CHANNELS + This tag is an extension to the AmiTCP V4 API and must be + used prior to calling any of the Berkeley packet filter + functions (e.g. bpf_open(), bpf_close(), etc.). Since older + "bsdsocket.library" implementations do not process this tag + you should be prepared to handle failure of the query + operation. + + This tag will return the number of Berkeley packet filter + channels available for allocation. + + SBTC_RELEASESTRPTR + Return a pointer to the protocol stack's name and + version information string. + + SBTC_S2ERRNOSTRPTR + This function is deprecated and should not used by new code. + + The error string corresponding to a SANA-II I/O error code. The + tag is used both for input and output: in goes the error code + (a pointer to an integer), out goes a pointer to the + corresponding error string. + + SBTC_S2WERRNOSTRPTR + This function is deprecated and should not used by new code. + + The error string corresponding to a SANA-II wire error code. + The tag is used both for input and output: in goes the error + code (a pointer to an integer), out goes a pointer to the + corresponding error string. + + SBTC_SIGEVENTMASK + Exec signal mask for asynchronous event notification (see + GetSocketEvents()). + + SBTC_SIGIOMASK + This function is deprecated and should not used by new code. + + Exec signal mask for asynchronous socket events. + + SBTC_SIGURGMASK + This function is deprecated and should not used by new code. + + Exec signal mask for out-of-band data. + + SBTC_SYSTEM_STATUS + This tag is an extension to the AmiTCP V4 API and cannot + be expected to be supported by older "bsdsocket.library" + versions. + + The bsdsocket.library may be opened by any client, yet this + does not imply that all the services it supports will be + configured as well. To find out whether the TCP/IP stack is + operational, you can use use the 'SBTC_SYSTEM_STATUS' tag. + The status long word filled in will have the following + flags set provided that the associated conditions are + true: + + SBSYSSTAT_Interfaces + Network interfaces are available, have IP addresses + assigned, are configured and operational. Note that + 'network interfaces' does not imply the loopback + interface, which is always available and configured. + + SBSYSSTAT_PTP_Interfaces + Point-to-point network interfaces, such as for SLIP + or PPP, have IP addresses assigned, are configured + and operational. + + SBSYSSTAT_BCast_Interfaces + Broadcast network interfaces, such as Ethernet, have + IP addresses assigned, are configured and + operational. + + SBSYSSTAT_Resolver + Domain name server addresses are configured. Address + resolution is possible. + + SBSYSSTAT_Routes + Routes are configured and operational. IP packets + sent will find a way to their destinations. Note + such routes will by default be assigned to interfaces + that have IP addresses configured, too. + + SBSYSSTAT_DefaultRoute + A default route is configured. + + SBTC_UDP_CHECKSUM + This tag is an extension to the AmiTCP V4 API and cannot + be expected to be supported by older "bsdsocket.library" + versions. + + This tag is for querying and changing whether UDP datagram + checksums are enabled or not. If enabled, UDP checksums are + calculated for outgoing UDP datagrams, and incoming UDP + datagrams containing nonzero checksums will have their + checksums verified. If disabled, no UDP checksums will be + calculated for outgoing datagrams, and no checksums of + incoming datagrams will be verified. + + UDP datagram checksums are enabled by default. + + Note that this option affects the entire protocol stack + and is not limited to the library base you set it with. + + RESULT + Returns 0 on success, and a (positive) index of the failing tag on + error. The first tag corresponds to index #1, the second to + index #2 and so on. + + EXAMPLES + /* Link the local program's 'errno' variable to the stack's + internal 'errno' variable. */ + #include + #include + + SocketBaseTags( + SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), &errno, + TAG_END); + + /* Obtain the descriptive text associated with an error + number that may have been generated by the stack. */ + struct TagItem tags[2]; + STRPTR text; + int error; + + /* This query will modify the TagItem list. */ + tags[0].ti_Tag = SBTM_GETVAL(SBTC_ERRNOSTRPTR); + tags[0].ti_Data = error; + tags[1].ti_Tag = TAG_END; + + SocketBaseTagList(tags); + + text = (STRPTR)tags[0].ti_Data; + + /* Disable Ctrl+C checking. */ + SocketBaseTags( + SBTM_SETVAL(SBTC_BREAKMASK),0, + TAG_END); + + /* Find out how many packet filter channels are + available. Note that this option is not supported + by all "bsdsocket.library" implementations and + should therefore be assumed to return an error or + fail to initialize the variable queried. The following + example handles this case. */ + LONG num_packet_filter_channels; + + /* Initialize the variable to zero, so that we will always + have a meaningful result, even if the library fails to + fill it in. */ + num_filter_channels = 0; + + if(SocketBaseTags( + SBTM_GETREF(SBTC_NUM_PACKET_FILTER_CHANNELS),&num_filter_channels, + TAG_END) != 0) + { + /* We didn't get what we wanted. Play it safe and + reset the number of channels to zero. */ + num_filter_channels = 0; + } + + /* Disable ICMP echo message processing, which will cause + any attempts to 'ping' this host to fail. */ + SocketBaseTags( + SBTM_SETVAL(SBTC_ICMP_PROCESS_ECHO),IR_Drop, + TAG_END); + + NOTES + The 'SBTC_BREAKMASK' tag code gives you control over the signal mask + which is used for testing whether an interrupt signal was received, + intended to stop a network operation in progress. Due to how this + test is performed, it only takes effect if the operation in progress + is currently waiting for something to happen, e.g. more data to + arrive or data to become ready for transmission. This means that you + cannot expect bsdsocket.library function to respond at all times to + the break signal. If there is no reason for the respective function + to wait, it will ignore the break signal altogether. Consequently, + you may have to perform additional break signal testing in your own + application software. + + SEE ALSO + bpf_open(), bpf_close(), bpf_read(), bpf_write(), bpf_set_notify_mask(), + bpf_set_interrupt_mask(), bpf_ioctl(), bpf_data_waiting(), + GetSocketEvents(), AddRouteTagList(), DeleteRouteTagList(), + AddInterfaceTagList(), ConfigureInterfaceTagList(), + AddNetMonitorHookTagList(), RemoveNetMonitorHook(). + + bsdsocket.library/vsyslog bsdsocket.library/vsyslog + + NAME + vsyslog - control system log + + SYNOPSIS + #include + #include + + vsyslog(priority, message, args) + D0 A0 A1 + + void vsyslog(long priority, char *message, va_list args); + + void syslog(long priority, char *message, ...); + + FUNCTION + The syslog() function writes message to the system message logger. + The message is then written to the system console, log files, + logged-in users, or forwarded to other machines as appropriate. + + The message is identical to a printf() format string, except that + `%m' is replaced by the current error message. (As denoted by the + global variable errno; see strerror().) A trailing newline is added + if none is present. + + The vsyslog() function is an alternate form in which the arguments + have already been captured using variable-length argument facilities. + + The message is tagged with priority. Priorities are encoded as a + facility and a level. The facility describes the part of the system + generating the message. The level is selected from the following + ordered (high to low) list: + + LOG_EMERG + A panic condition. This is normally broadcast to all + users. + + LOG_ALERT + A condition that should be corrected immediately, such as a + corrupted system database. + + LOG_CRIT + Critical conditions, e.g. hard device errors. + + LOG_ERR + Errors. + + LOG_WARNING + Warning messages. + + LOG_NOTICE + Conditions that are not error conditions, but should possibly + be handled specially. + + LOG_INFO + Informational messages. + + LOG_DEBUG + Messages that contain information normally of use only when + debugging a program. + + NOTES + This function should not be called from interrupt code. + + bsdsocket.library/gethostbyname_r bsdsocket.library/gethostbyname_r + + NAME + gethostbyname_r - get network host entry (reentrant) + + SYNOPSIS + #include + + hostent = gethostbyaddr_r(addr, len, type, hp, buf, buflen, he) + D0 A0 D0 D1 A1 A2 D2 A3 + + struct hostent * gethostbyaddr_r(char *addr, LONG len, LONG type, + struct hostent *hp, char *buf, + ULONG buflen, LONG *he); + + FUNCTION + The gethostbyaddr_r() function is a variant of the regular + gethostbyaddr() which does not store the queried information in + a static buffer. For this reason, gethostbyaddr_r() can be used + concurrently by several processes at the same time which share + the same SocketBase without causing the queried information to get lost. + + INPUTS + address -- Pointer to the address to be resolved. + len -- Size of the address to be resolved, in bytes. + type -- Type of the address to be resolved. + hp -- Pointer to a 'struct hostent' which will be filled in with + the information retrieved. + buf -- Buffer which will be used to store all the information + retrieved. This should be at least 1024 bytes in size. + buflen -- Size of the buffer in which all the information retrieved + will be stored. + he -- Pointer to a LONG in which an error code will be stored if + the host name lookup failed. With gethostbyname() that error + code would show up in h_error, here it is provided to the + caller. + + RESULT + hostent -- Pointer to the retrieved information, or NULL for + failure. + + SEE ALSO + gethostbyaddr(), getnameinfo() + + NOTES + gethostbyaddr_r() is considered obsolete and is provided only for the + sake of making it easier to port multithreaded software. You should + use the getnameinfo() API instead, if you can. + + gethostbyaddr_r() is not a standardized API function, with well-defined + parameters and behaviour. This implementation follows the BSD Unix + example, and not the Linux example. + + Note that if you call gethostbyaddr_r() with a SocketBase shared + with other clients, and the call fails returning NULL, then you may + not be able to retrieve the h_error value to explain why the + lookup failed. This is because a different process may have already + overwritten the h_error value. As hinted above, this is one good + reason to switch to use the getnameinfo() API. + + While gethostbyaddr_r() is safe to be called by multiple + processes at the same time sharing the same SocketBase, + it is not safe to mix calls to gethostbyaddr_r() with the + regular gethostbyname()/gethostbyaddr() functions. The functions + all use the same per-SocketBase name resolution state + information, serializing access. The name resolution state + will be overwritten by each access, invalidating whatever + calls to gethostbyname()/gethostbyaddr() had returned. + + The gethostbyaddr_r() call is an extension to the AmiTCP V4 + API and cannot be assumed to be present in all versions of + "bsdsocket.library". To find out whether your library version + supports it, use the SBTC_HAVE_GETHOSTADDR_R_API tag with the + SocketBaseTagList() function. + + bsdsocket.library/WaitSelect bsdsocket.library/WaitSelect + + NAME + WaitSelect - synchronous I/O multiplexing + + SYNOPSIS + #include + #include + #include + + n = WaitSelect(nfds, readfds, writefds, exceptfds, timeout, signals) + D0 D0 A0 A1 A2 A3 D1 + + long Waitselect(long nfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout, + ULONG *signals); + + FD_SET(fd, &fdset); + + FD_CLR(fd, &fdset); + + FD_ISSET(fd, &fdset); + + FD_ZERO(&fdset); + + FUNCTION + WaitSelect() examines the I/O descriptor sets whose addresses are + passed in readfds, writefds, and exceptfds to see if some of their + descriptors are ready for reading, are ready for writing, or have an + exceptional condition pending, respectively. The first nfds + descriptors are checked in each set; i.e., the descriptors from 0 + through nfds-1 in the descriptor sets are examined. On return, + WaitSelect() replaces the given descriptor sets with subsets + consisting of those descriptors that are ready for the requested + operation. WaitSelect() returns the total number of ready descriptors + in all the sets. + + The descriptor sets are stored as bit fields in arrays of integers. + The following macros are provided for manipulating such descriptor + sets: FD_ZERO(&fdsetx) initializes a descriptor set fdset to the null + set. FD_SET(fd, &fdset) includes a particular descriptor fd in fdset. + FD_CLR(fd, &fdset) removes fd from fdset. FD_ISSET(fd, &fdset) is + nonzero if fd is a member of fdset, zero otherwise. The behavior of + these macros is undefined if a descriptor value is less than zero or + greater than or equal to FD_SETSIZE, which is normally at least equal + to the maximum number of descriptors supported by the system. + + If timeout is not a NULL pointer, it specifies a maximum interval to + wait for the selection to complete. If timeout is a NULL pointer, the + select blocks indefinitely. To affect a poll, the timeout argument + should not be NULL, pointing to a zero-valued timeval structure. Any + of readfds, writefds, and exceptfds may be given as NULL pointers if + no descriptors are of interest. + + NOTES + WaitSelect() corresponds to select(). It will block until the wait + criteria could be satisfied (a socket has become ready), the timeout + has elapsed or a signal was received before any of the other two + events could occur. By default one of these signals is the standard + break signal which can be configured using the SocketBaseTagList() + 'SBTC_BREAKMASK' tag. To specify user signals that should cause + WaitSelect() to return immediately, use the 'signals' parameter. The + long word pointed to should contain a signal mask. + + If WaitSelect() is called with a timeout of 0 seconds and 0 + microseconds, it will effectively "poll" the current state of the + files/sockets specified and return without waiting for any of them + to become ready. + + Reception of the standard break signal (e.g. via Ctrl+C) will cause + WaitSelect() to return -1 and set the error code to EINTR. + Additionally, the standard break signal will be posted. This means + that the signal will still be set when WaitSelect() returns, and + can be tested. If -1 is returned, the contents of the user signal + mask pointed to by the 'signals' parameter will be undefined. + + Reception of a user signal with no socket ready will cause + WaitSelect() to stop and to return 0. + + If WaitSelect() returns a value of 0 or greater, the current Task's + received signal mask will be updated according to which bits were + set in the user signal mask pointed to by the 'signals' parameter. + If the received signal mask and the user signal mask have the same + bits set, then these bits will remain set in the user signal mask + and the received signal mask will have them cleared. If a user + signal mask bit is set, and the corresponding received signal mask + bit is clear, then the user signal mask bit will be cleared. + + Passing a NULL for the 'signals' parameter will cause WaitSelect() to + operate like select(), i.e. the function will return only if the + timeout has elapsed, a socket has become ready or an break signal + was received (e.g. via Ctrl+C). The same is true if the long word + pointed to by the 'signals' parameter is zero. + + The timeout value must be sound. This means that the number of + microseconds must be smaller than 1000000 and the number of + seconds must not be larger than 100000000. If you want the + WaitSelect() function to wait indefinitely, do not set up a very + long wait interval and use it repeatedly. Use a NULL pointer for + for the timeout parameter instead. + + The 'nfds' parameter may be truncated if it covers more sockets than + are currently in use. This has the side-effect of filling in only + as many socket bits in the fd_set parameters you provide as are + currently in use, and not as many as you asked for. You should + therefore take care not to ask for more sockets to be checked than + you know are still in use, or the results produced by WaitSelect() + will be ambiguous. + + The break signal mask and the user signal mask pointed to by the + 'signals' parameter should not share common signal bits. Otherwise + the information returned in the data pointed to by the 'signals' + parameter, or the break signal handling itself, will be + ambiguous. For example, the bits common to the break signal mask + and the user signal mask will be attributed to the user signals, + and when WaitSelect() returns the break signal mask will not be + posted. + + Owing to the use of the 'fd_set' data structure, WaitSelect() + may need to use several thousands bytes of stack space for each + invocation, and might also allocate additional memory. The extra + memory allocation may have a negative impact on performance if + you expect the function to do its job quickly. The stack size + requirements of at least 4000 bytes may need care and attention + in your software: do not shave the stack too closely. + + RESULT + WaitSelect() returns the number of ready descriptors that are + contained in the descriptor sets, or -1 if an error occurred. If the + time limit expires, WaitSelect() returns 0. If WaitSelect() returns + with an error, including one due to an interrupted call, the + descriptor sets will be unmodified. + + ERRORS + An error return from WaitSelect() indicates: + + [EBADF] + One of the descriptor sets specified an invalid descriptor. + + [EINTR] + A signal was delivered before the time limit expired and + before any of the selected events occurred. + + [EINVAL] + The specified time limit is invalid. One of its components + is negative or too large. + + SEE ALSO + accept(), connect(), getdtablesize(), recv(), send() + + BUGS + Although the provision of getdtablesize() was intended to allow user + programs to be written independent of the kernel limit on the number + of open files, the dimension of a sufficiently large bit field for + select remains a problem. The default size FD_SETSIZE (currently 256) + is somewhat larger than the current kernel limit to the number of + open files. However, in order to accommodate programs which might + potentially use a larger number of open files with select, it is + possible to increase this size within a program by providing a larger + definition of FD_SETSIZE before the inclusion of . + + WaitSelect() should probably return the time remaining from the + original timeout, if any, by modifying the time value in place. This + may be implemented in future versions of the system. Thus, it is + unwise to assume that the timeout value will be unmodified by the + WaitSelect() call. + + WaitSelect() may ignore the break signal altogether if a zero length + timeout is given, or sockets are ready at the time the function is + entered. This behaviour was changed in bsdsocket.library V4.289, + which will always make sure that the break signal is tested and + acted upon -- note that no other AmiTCP-alike Amiga TCP/IP stack may + check the break signal under these circumstances, which means that + if you need to know whether a break signal was pending at the time + WaitSelect() was called, you may have to do it yourself. + + \ No newline at end of file diff --git a/examples/AddNetInterface.c b/examples/AddNetInterface.c new file mode 100644 index 0000000..0bac343 --- /dev/null +++ b/examples/AddNetInterface.c @@ -0,0 +1,4191 @@ +/* + * $Id$ + * + * :ts=4 + * + * Copyright © 2001-2013 by Olaf Barthel. All Rights Reserved. + */ + +/* There is a deliberate incompatibility in the 'struct AnchorPath' + definition between the AmigaOS 2.x/3.x and 4.x header files which + we will need to work around here. */ +#if defined(__amigaos4__) +#define ap_Buf ap_Buffer +#else +#define USE_OLD_ANCHORPATH +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +/****************************************************************************/ + +#if defined(__amigaos4__) +#include +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +/* These are options relevant for the prototype header files + included below. */ +#if !defined(__amigaos4__) +#define NO_INLINE_STDARG +#endif /* __amigaos4__ */ + +#define __NOLIBBASE__ +#define __NOGLOBALIFACE__ +#define __USE_INLINE__ + +/****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +/****************************************************************************/ + +#include +#include + +/****************************************************************************/ + +#include "macros.h" + +/****************************************************************************/ + +/* this macro lets us long-align structures on the stack */ +#define D_S(type,name) \ + char a_##name[sizeof(type)+3]; \ + type *name = (type *)((ULONG)(a_##name+3) & ~3UL) + +/****************************************************************************/ + +/* These two bits indicate the kind of address + represented by an IEEE 802.3 MAC address. These + are the two least significant bits of the first + address byte. */ +#define MAC_Is_Group_Address 0x01 +#define MAC_Is_Logical_Address 0x02 + +/****************************************************************************/ + +#include "AddNetInterface_rev.h" + +/****************************************************************************/ + +#ifndef AbsExecBase +#define AbsExecBase (*(struct ExecBase **)4) +#endif /* AbsExecBase */ + +/* This is missing in the AmigaOS 2.x/3.x header files. */ +#ifndef FORMAT_DEF +#define FORMAT_DEF 4 +#endif /* FORMAT_DEF */ + +/****************************************************************************/ + +typedef LONG * NUMBER; +typedef LONG SWITCH; +typedef STRPTR KEY; + +/****************************************************************************/ + +#define MAX_FILENAME_LEN 512 + +/****************************************************************************/ + +/* This context information is handed around for all the routines and + subroutines below. */ +struct CommandContext +{ + struct Library * cc_SysBase; + struct Library * cc_DOSBase; + struct Library * cc_UtilityBase; + struct Library * cc_SocketBase; + struct Library * cc_LocaleBase; + struct Library * cc_IconBase; + struct Library * cc_IntuitionBase; + + #if defined(__amigaos4__) + + /************************************************************************/ + + struct ExecIFace * cc_IExec; + struct DOSIFace * cc_IDOS; + struct UtilityIFace * cc_IUtility; + struct SocketIFace * cc_ISocket; + struct LocaleIFace * cc_ILocale; + struct IconIFace * cc_IIcon; + struct IntuitionIFace * cc_IIntuition; + + /************************************************************************/ + + #endif /* __amigaos4__ */ + + struct Catalog * cc_Catalog; + UBYTE cc_ProgramName[256]; + struct WBStartup * cc_StartupMessage; + struct RDArgs * cc_RDA; + BPTR cc_File; + struct AnchorPath * cc_AnchorPath; + BOOL cc_Quiet; + struct TagItem * cc_Tags; + LONG cc_NumTags; + LONG cc_MaxTags; + struct MsgPort * cc_ReplyPort; + struct AddressAllocationMessage + cc_AllocationMessage; + ULONG cc_RouterTable[16]; + ULONG cc_DNSTable[16]; + struct DateStamp cc_LeaseExpires; +}; + +/****************************************************************************/ + +/* The following set of DECLARE_... macros are used to load the library + bases in every routine that needs them. These are portable macros in + the sense that they allow the same code to be built both for AmigaOS 2.x/3.x + and 4.x. */ + +/****************************************************************************/ + +#if defined(__amigaos4__) + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct ExecIFace * IExec = cc->cc_IExec; \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct DOSIFace * IDOS = cc->cc_IDOS; \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_UTILITYBASE(cc) \ + struct UtilityIFace * IUtility = cc->cc_IUtility; \ + struct Library * UtilityBase = cc->cc_UtilityBase + +#define DECLARE_LOCALEBASE(cc) \ + struct LocaleIFace * ILocale = cc->cc_ILocale; \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct SocketIFace * ISocket = cc->cc_ISocket; \ + struct Library * SocketBase = cc->cc_SocketBase + +#define DECLARE_ICONBASE(cc) \ + struct IconIFace * IIcon = cc->cc_IIcon; \ + struct Library * IconBase = cc->cc_IconBase + +#define DECLARE_INTUITIONBASE(cc) \ + struct IntuitionIFace * IIntuition = cc->cc_IIntuition; \ + struct Library * IntuitionBase = cc->cc_IntuitionBase + +/****************************************************************************/ + +#else + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_UTILITYBASE(cc) \ + struct Library * UtilityBase = cc->cc_UtilityBase + +#define DECLARE_LOCALEBASE(cc) \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct Library * SocketBase = cc->cc_SocketBase + +#define DECLARE_ICONBASE(cc) \ + struct Library * IconBase = cc->cc_IconBase + +#define DECLARE_INTUITIONBASE(cc) \ + struct Library * IntuitionBase = cc->cc_IntuitionBase + +/****************************************************************************/ + +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +/* This program performs two passes on the interfaces it has to take + care of it. First it adds the interfaces, then it configures them. + Here is a definition of what each pass does. */ +enum add_interface_mode_t +{ + AIM_Add, + AIM_Configure +}; + +/****************************************************************************/ + +LONG _start(VOID); + +/****************************************************************************/ + +STATIC VOID close_libs(struct CommandContext *cc); +STATIC LONG open_libs(struct CommandContext *cc, struct Library *SysBase); +STATIC LONG cmd(struct CommandContext *cc); +STATIC LONG match_key(struct CommandContext *cc, STRPTR what); +STATIC LONG add_tag(struct CommandContext *cc, Tag tag, ULONG data); +STATIC BOOL is_blank_space(UBYTE c); +STATIC STRPTR get_next_token(STRPTR input, STRPTR string, LONG string_len); +STATIC LONG get_hex_value(struct CommandContext *cc, STRPTR str); +STATIC VOID get_hex_string(LONG value, STRPTR str); +STATIC VOID strip_unprintable_characters(STRPTR s); +STATIC VOID strip_extra_blank_spaces(STRPTR s); +STATIC LONG add_interface(struct CommandContext *cc, STRPTR name, enum add_interface_mode_t operating_mode, LONG timeout); +STATIC BOOL validate_ip_address(struct CommandContext *cc, STRPTR key, STRPTR address, LONG line_number, STRPTR file); +STATIC VOID get_errno_and_code(struct CommandContext *cc, LONG *errno_ptr, STRPTR *code_ptr); +STATIC BOOL substring_matches(struct CommandContext *cc, STRPTR pattern, STRPTR string); +STATIC VOID add_interface_node(struct CommandContext *cc, struct List *list, struct Node *new_node); +STATIC VOID VARARGS68K error_printf(struct CommandContext *cc, STRPTR format, ...); +STATIC VOID VARARGS68K warning_printf(struct CommandContext *cc, STRPTR format, ...); +STATIC VOID VARARGS68K info_printf(struct CommandContext *cc, STRPTR format, ...); +STATIC VOID info_print_fault(struct CommandContext *cc, LONG code); +STATIC VOID error_print_fault(struct CommandContext *cc, LONG code); +STATIC VOID error_print_fault_prefix(struct CommandContext *cc, LONG code, STRPTR prefix); +STATIC STRPTR get_builtin_str(LONG id); +STATIC STRPTR get_str(struct CommandContext *cc, LONG id); +STATIC LONG VARARGS68K Local_ConfigureInterfaceTags(struct CommandContext *cc, STRPTR interface_name, ...); +STATIC LONG VARARGS68K Local_SocketBaseTags(struct CommandContext *cc, ...); +STATIC LONG VARARGS68K Local_AddRouteTags(struct CommandContext *cc, ...); + +/****************************************************************************/ + +/****** ROADSHOW/ADDNETINTERFACE ************************************************** +* +* NAME +* AddNetInterface - Make network interfaces known to the protocol stack. +* +* FORMAT +* AddNetInterface [QUIET] [TIMEOUT=] INTERFACE +* +* TEMPLATE +* INTERFACE/M,QUIET/S,TIMEOUT/K/N +* +* PATH +* C:ADDNETINTERFACE +* +* FUNCTION +* ADDNETINTERFACE starts the specified network interfaces, thus starting +* the connection. +* +* OPTIONS +* INTERFACE/M +* The name of the interface to add; this can be a plain interface +* name, such as "Ariadne", or the fully qualified file name which +* contains the interface configuration information. The tool +* expects the name of the file in question (without the prefixed +* path) to become the name of the interface. For historic reasons +* interface names cannot be longer than 15 characters. +* +* For your convenience, a wild card pattern can be specified in +* place of the file name to use. +* +* If several interface names are specified, they will be sorted in +* alphabetical order before they are added. If the interface +* files have icons attached, you can use tool types such as +* "PRI=5" or "PRIORITY=5" to select the order in which the interfaces +* will be sorted. Higher priority entries will appear before lower +* priority entries. If the priorities for two entries is identical, +* then the interface names will be compared. If no priority is +* given, the value 0 will be used. +* +* QUIET/S +* This option causes the program not to emit any error messages +* or progress reports. Also, if the program encounters an error +* it will flag this as failure code 5 which can be looked at +* using the "if warn" shell script command. If this option is +* not in effect, failure codes will be more severe and all sorts +* of progress information will be displayed. +* +* TIMEOUT/K/N +* If you're going to use DHCP configuration for any of the +* interfaces, a default timeout value of 60 seconds will +* limit the time an interface can take to be configured. +* This parameter allows you to use a different timeout value. +* Note that due to how the configuration protocol works, +* the timeout cannot be shorter than ten seconds. +* +* The 'AddNetInterface' command can be invoked from Workbench, too. It +* operates on the same configuration files with the same keywords, etc. +* To make it work, create an icon for your interface configuration file +* (it must be a project icon) and put 'AddNetInterface' into its default +* tool. Make sure that the project has enough stack space assigned (4000 +* bytes minimum), then double-click on the icon. If things should go +* wrong, you will see an error requester pop up, and no further +* initialization will be done. You can configure two options in the +* project file's tool types: QUIET and TIMEOUT. These are identical to +* the two parameters of the same name you could pass on the command +* line; they define whether the command should print any error messages +* (the default is to print them) and how long the command should wait +* for DHCP configuration to conclude (default is a timeout of 60 +* seconds). +* +* NOTES +* This command is similar to the Unix "ifconfig" command. +* +* The program makes two passes over the configuration files to be +* taken into account. In the first pass information is gathered +* on the interfaces to add, which is subsequently used to add those +* interfaces found. In the second pass interfaces are configured, +* setting their IP addresses, etc. If anything goes wrong in the +* first pass, processing will stop and no second pass will be +* done. If anything goes wrong in either the first or the second +* pass, that pass will not be completed. +* +* CONFIGURATION FILES +* Interfaces are configured through files stored in the +* "DEVS:NetInterfaces" or "SYS:Storage/NetInterfaces" directories. +* These are text files whose contents are described below. +* +* Each line of the file must correspond to an option; if a line is +* introduced by a '#' or ';' character it will be ignored (so are empty +* lines). The following options are supported: +* +* DEVICE/K +* Must be provided; the name of the SANA-II device driver. This +* should be the complete, fully qualified path to the driver. If +* no complete path is provided, the 'Devs:Networks' drawer will be +* checked. Thus, "DEVS:Networks/ariadne.device" is equivalent to +* "ariadne.device". +* +* UNIT/K/N +* Unit number of the device driver to open. The default is to +* use unit 0. +* +* IPTYPE/K/N +* You can use this parameter to override the packet type the +* stack uses when sending IP packets; default is 2048 (for +* Ethernet hardware). +* +* ARPTYPE/K/N +* You can use this parameter to override the packet type the +* stack uses when sending ARP packets. Default is 2054; this +* parameter only works with Ethernet hardware and should not be +* changed. +* +* IPREQUESTS/K/N +* The number of IP read requests to allocate and queue for the +* SANA-II device driver to use. The default value is 32, larger +* values can improve performance, especially with fast device +* drivers. +* +* WRITEREQUESTS/K/N +* The number of IP write requests to allocate and queue for the +* SANA-II device driver to use. The default value is 32, larger +* values can improve performance, especially with fast device +* drivers. +* +* ARPREQUESTS/K/N +* The number of ARP read requests to allocate and queue for the +* SANA-II device driver to use. The default value is 4. +* +* DEBUG/K (possible parameters: YES or NO) +* You can enable debug output for this interface (don't worry, +* you can always disable it later) to help in tracking down +* configuration problems. At this time of writing, the debug +* mode will, if enabled, produce information on the progress of +* the DHCP configuration process. +* +* POINTTOPOINT/K (possible parameters: YES or NO) +* This indicates that the device is used for point to point +* connections. The stack automatically figures out whether the +* SANA-II device driver is of the point to point type, so you +* should not need to specify this option. +* +* MULTICAST/K (possible parameters: YES or NO) +* This tells the stack that this device can handle multicast +* packets. 'YES' only works with Ethernet hardware (where it's +* enabled by default anyway). +* +* DOWNGOESOFFLINE/K (possible parameters: YES or NO) +* This option is useful with point to point devices, like +* 'ppp.device'. When specified, bringing the interface 'down' +* (via the 'ConfigureNetInterface' program) or shutting down the +* stack will cause the associated SANA-II device driver to be +* switched offline (via the 'S2_OFFLINE' command). +* +* REPORTOFFLINE/K (possible parameters: YES or NO) +* When a device is switched offline, you may want to know about +* it. This is helpful with SLIP/PPP connections which run over a +* serial link which accumulates costs while it is open. When the +* connection is broken and the device goes offline, you will +* receive a brief notification of what happened. However, if you +* tell the library itself to shut down, no notification that a +* device was switched offline will be shown. +* +* REQUIRESINITDELAY/K (possible parameters: YES or NO) +* Some devices need a little time to settle after they have been +* opened or they will hickup and lose data after the first +* packet has been sent. The original 'Ariadne I' card is one +* such device. For these devices, the 'REQUIRESINITDELAY=YES' +* option will cause a delay of about a second before the first +* packet is sent. +* +* This option defaults to YES. +* +* COPYMODE/K (possible parameters: SLOW or FAST) +* This option is for chasing subtle bugs in the driver interface +* with cards like the original 'Ariadne I'. Cards like these do +* not support writing to the hardware transmit buffer in units +* other than 16 bits a piece. Default is 'SLOW', which is +* compatible with the Ariadne I. But if you're feeling +* adventurous, try the 'FAST' option (and don't complain if it +* doesn't work for you!). +* +* FILTER/K (possible parameters: OFF, LOCAL, IPANDARP or EVERYTHING) +* This option enables the use of the Berkeley packet filter for +* this particular interface. Possible choices for the key are: +* +* FILTER=OFF +* Disables the filter. +* +* FILTER=LOCAL +* Enables filtering on all IP and ARP packets that are +* intended for this particular interface. Packets +* intended for other interfaces or hosts are ignored. +* +* FILTER=IPANDARP +* Enables filtering on all IP and ARP packets that +* happen to fly by this interface, no matter whether the +* packets are intended for it or not. This requires that +* the underlying network device driver is opened for +* exclusive access in so-called 'promiscuous' mode. This +* may not work if other clients (Envoy, ACS) need to +* keep the driver opened. +* +* FILTER=EVERYTHING +* Identical to FILTER=IPANDARP, but will also filter all +* other kinds of packets that may show up. +* +* Default for this option is 'FILTER=LOCAL'. Note that by using +* this option you merely define what the filter mechanism can do +* and what it cannot do. The filter is not enabled when you add +* the interface. +* +* HARDWAREADDRESS/K +* You can specify the hardware address (layer 2 address, MAC +* address) this interface should respond to when it is first +* added and configured. This usually works only once for each +* interface, which means that once an address has been chosen +* you have to stick with it until the system is rebooted. And it +* also means that the first program to configure the address +* will manage to make its choice stick. +* +* The hardware address must be given as six bytes in hexadecimal +* notation, separated by colon characters, like this: +* +* HARDWAREADDRESS=00:60:30:00:11:22 +* +* Take care, there are rules that apply to the choice of the +* hardware address, which means that you cannot simply pick a +* convenient number and get away with it. It is assumed that you +* will want to configure an IEEE 802.3 MAC address, which works for +* Ethernet hardware and is six bytes (48 bits) in size. +* +* In addition to the purely static interface configuration information you +* can also tell the configuration program to do something about the +* interfaces once they have all been added. That's when the following +* configuration file parameters will be taken into account: +* +* ADDRESS/K +* This configures the IP address of the interface. The parameter +* you supply should be an IP address in dotted-decimal notation +* ("192.168.0.1"). Don't pick a symbolic host name as the system +* may not yet be in a position to talk to name resolution server +* and translate the symbolic name. +* +* In place of the IP address you can also specify "DHCP" +* (Dynamic Host Configuration Protocol). As the name suggests, +* this will start a configuration process involving the DHCP +* protocol which should eventually yield the right IP address +* for this host. Note that this configuration procedure only +* works for Ethernet hardware. +* +* ALIAS/K/M +* In addition to the primary interface address you can assign +* several aliases to it. These must be specified in +* dotted-decimal notation ("192.168.0.1"). Alias addresses are +* added after the primary interface address has been configured. +* +* STATE/K +* By default, interfaces whose addresses are configured will +* switch automatically to 'up' state, making it possible for the +* TCP/IP stack to use them for network I/O. You can override +* this by using the 'STATE=DOWN' switch. The alternatives +* 'online' (implies 'up', but tells the underlying network +* interface driver to go online first) and 'offline' (implies +* 'down' but tells the driver to go offline first) are available +* as well. +* +* NETMASK/K +* This selects the subnet mask for the interface, which must be +* specified in dotted-decimal notation ("192.0.168.1"). +* +* In place of the subnet mask you can also specify "DHCP" +* (Dynamic Host Configuration Protocol). As the name suggests, +* this will start a configuration process involving the DHCP +* protocol which should eventually yield the right subnet mask +* for this host. Note that this configuration procedure only +* works for Ethernet hardware. +* +* DESTINATION=DESTINATIONADDR/K +* The address of the point-to-point partner for this interface; +* must be specified in dotted-decimal notation ("192.168.0.1"). +* Only works for point-to-point connections, such as PPP. +* +* METRIC/K/N +* This configures the interface route metric value. Default +* is 0. +* +* MTU/K/N +* You can limit the maximum transmission size used by the TCP/IP +* stack to push data through the interface. The interface driver +* will have its own ideas about the maximum transmission size. +* You can therefore only suggest a smaller value than the +* driver's preferred hardware MTU size. +* +* CONFIGURE/K (possible parameters: DHCP, AUTO or FASTAUTO) +* You can use DHCP configuration for this interface and protocol +* stack internals, namely the list of routers (and the default +* gateway) to use and the domain name servers. This option +* allows you to bring up the complete network configuration in +* one single step. +* +* You can request that a particular IP address is assigned to +* this interface by the DHCP process by specifying +* CONFIGURE=DHCP and your choice of ADDRESS=xxx.xxx.xxx.xxx. +* +* If your network has no DHCP server, you may choose +* CONFIGURE=AUTO to use automatic IPv4 address selection, +* based upon a protocol called ZeroConf. This protocol will +* select a currently unused address from a specially +* designated address range. +* +* If you choose automatic configuration in a wireless network, +* you might want to use CONFIGURE=FASTAUTO instead of +* CONFIGURE=AUTO. +* +* Note that only the CONFIGURE=DHCP option will attempt to +* set up a default route and a set of DNS servers for you to +* use. The alternatives of CONFIGURE=FASTAUTO and +* CONFIGURE=AUTO are restricted to selecting the network +* interface IPv4 addresses. +* +* LEASE/K +* This is a complex option which can be used to request how long +* an IP address should be bound to an interface, via the DHCP +* protocol. Several combinations of options are possible. Here +* is a short list: +* +* LEASE=300 +* LEASE=300seconds +* This requests a lease of exactly 300 seconds, or +* five minutes. +* +* LEASE=30min +* This requests a lease of 30 minutes. +* +* LEASE=2hours +* This requests a lease of 2 hours. +* +* LEASE=1day +* This requests a lease of 1 day. +* +* LEASE=4weeks +* This requests a lease of 4 weeks. +* +* LEASE=infinite +* This requests that the IP address should be +* permanently bound. +* +* Blank spaces between the numbers and the qualifiers are +* supported. The qualifiers are tested using substring matching, +* which means for example that "30 minutes" is the same as "30 +* min" and "30 m". +* +* Note that the requested lease time may be ignored by the DHCP +* server. After all, it is just a suggestion and not an order. +* +* ID/K +* This option works along with the CONFIGURE=DHCP process. It +* can be used to tell the DHCP server by which name the local +* host should be referred to. Some DHCP servers are on good +* terms with their local name resolution services and will add +* the name and the associated IP address to the local host +* database. The name you can supply here cannot be longer than +* 255 characters and must be at least 2 characters long. Keep it +* brief: not all DHCP servers have room for the whole 255 +* characters. +* +* DHCPUNICAST/K +* Some DHCP servers may not be able to respond to requests for +* assigning IP addresses unless the responses are sent directly +* to the computer which sent the requests. In such cases you +* might want to use DHCPUNICAST=YES option. +* +* Unsupported keywords in the configuration file (or typos) will be +* reported, along with the name of the file and the line number. +* +* The name of the configuration file defines the name of the respective +* interface. Interface names must be unique, and the case of the names +* does not matter. For historic reasons interface names cannot be longer +* than 15 characters. Beyond this no restrictions on naming conventions +* apply. +* +* DHCP PROTOCOL +* A few words on DHCP (Dynamic Host Configuration Protocol). First, it +* only works for Ethernet hardware, so please don't try it with PPP or +* SLIP. Now it gets a bit technical. Unless you request an address to be +* permanently assigned, DHCP will assign addresses only for a limited +* period of time. This is called a 'lease'. Once an IP address has been +* assigned through DHCP, the lease will be repeatedly extended. The DHCP +* server may over time decide not to extend the lease or assign a new IP +* address to the interface. To stop the lease from getting extended over +* and over again, you must either change the interface's primary IP +* address or mark it 'down'. The library will make a brave attempt to +* get a DHCPRELEASE datagram out to notify the server that the +* previously allocated IP address is no longer in use. Don't count on it +* to work, though. First, the protocol stack might be going down so fast +* that it cannot get the datagram out. Second, when you mark an +* interface 'down' you will effectively pull it out of circulation, it +* will not send any further datagrams. Third, DHCP rides on UDP whose +* second name is 'unreliable datagram protocol', meaning that any +* datagram may get lost or corrupted and nobody will hear about it; this +* is rather hard on DHCP since the release message is sent only once. +* Don't worry. Unless you request permanent leases, the leases will +* eventually time out and the now unused IP address will finally return +* to the pool of addresses available for allocation. +* +* EXAMPLES +* Start the interface called "DSL" and run quietly. +* +* 1> AddNetInterface DSL QUIET +* +* An example configuration file for the "Ariadne" interface, with +* some options commented out: +* +* 1> Type Devs:NetInterfaces/Ariadne +* device=ariadne.device +* unit=0 +* #iprequests=64 +* #writerequests=64 +* copymode=fast +* #configure=dhcp +* address=192.168.0.1 +* netmask=255.255.255.0 +* #alias=192.168.0.9 +* #hardwareaddress=00:60:30:00:11:22 +* #id=a3000ux +* #debug=yes +* #filter=everything +* +* SEE ALSO +* ConfigureNetInterface +* NetShutdown +* +****************************************************************************** +*/ + +LONG +_start(VOID) +{ + struct Library *SysBase = (struct Library *)AbsExecBase; + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + struct CommandContext _cc,*cc = &_cc; + LONG result = RETURN_FAIL; + struct Process * pr; + LONG error; + + memset(cc,0,sizeof(*cc)); + + /* If launched from Workbench, pick up the startup message. */ + pr = (struct Process *)FindTask(NULL); + if(pr->pr_CLI == ZERO) + { + struct MsgPort * mp = &pr->pr_MsgPort; + + WaitPort(mp); + + cc->cc_StartupMessage = (struct WBStartup *)GetMsg(mp); + } + + /* Try to open the necessary libraries. */ + error = open_libs(cc,SysBase); + if(error == OK) + { + DECLARE_LOCALEBASE(cc); + DECLARE_DOSBASE(cc); + + /* If possible, open the catalog which contains the localized + program message. */ + if(cc->cc_LocaleBase != NULL) + cc->cc_Catalog = OpenCatalogA(NULL,"roadshow.catalog",NULL); + + /* Do what the program needs to do. */ + result = cmd(cc); + + /* Clean up... */ + if(cc->cc_Catalog != NULL) + CloseCatalog(cc->cc_Catalog); + + if(cc->cc_Tags != NULL) + FreeVec(cc->cc_Tags); + + if(cc->cc_AnchorPath != NULL) + { + MatchEnd(cc->cc_AnchorPath); + + #if defined(__amigaos4__) + { + FreeDosObject(DOS_ANCHORPATH,cc->cc_AnchorPath); + } + #else + { + FreeVec(cc->cc_AnchorPath); + } + #endif /* __amigaos4__ */ + } + + if(cc->cc_RDA != NULL) + { + FreeArgs(cc->cc_RDA); + FreeDosObject(DOS_RDARGS,cc->cc_RDA); + } + + if(cc->cc_File != ZERO) + Close(cc->cc_File); + } + else + { + pr->pr_Result2 = error; + } + + close_libs(cc); + + /* Return the Workbench startup message. */ + if(cc->cc_StartupMessage != NULL) + { + Forbid(); + + ReplyMsg((struct Message *)cc->cc_StartupMessage); + } + + return(result); +} + +/****************************************************************************/ + +/* Close all the libraries opened by open_libs(). */ +STATIC VOID +close_libs(struct CommandContext * cc) +{ + DECLARE_SYSBASE(cc); + + #if defined(__amigaos4__) + { + if(cc->cc_IDOS != NULL) + DropInterface((struct Interface *)cc->cc_IDOS); + + if(cc->cc_ILocale != NULL) + DropInterface((struct Interface *)cc->cc_ILocale); + + if(cc->cc_ISocket != NULL) + DropInterface((struct Interface *)cc->cc_ISocket); + + if(cc->cc_IUtility != NULL) + DropInterface((struct Interface *)cc->cc_IUtility); + + if(cc->cc_IIcon != NULL) + DropInterface((struct Interface *)cc->cc_IIcon); + + if(cc->cc_IIntuition != NULL) + DropInterface((struct Interface *)cc->cc_IIntuition); + } + #endif /* __amigaos4__ */ + + if(cc->cc_IntuitionBase != NULL) + CloseLibrary(cc->cc_IntuitionBase); + + if(cc->cc_IconBase != NULL) + CloseLibrary(cc->cc_IconBase); + + if(cc->cc_UtilityBase != NULL) + CloseLibrary(cc->cc_UtilityBase); + + if(cc->cc_SocketBase != NULL) + CloseLibrary(cc->cc_SocketBase); + + if(cc->cc_LocaleBase != NULL) + CloseLibrary(cc->cc_LocaleBase); + + if(cc->cc_DOSBase != NULL) + CloseLibrary(cc->cc_DOSBase); +} + +/****************************************************************************/ + +/* Open all the required libraries. */ +STATIC LONG +open_libs(struct CommandContext * cc,struct Library *SysBase) +{ + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + LONG error; + + cc->cc_SysBase = SysBase; + + #if defined(__amigaos4__) + { + cc->cc_IExec = IExec; + } + #endif /* __amigaos4__ */ + + cc->cc_DOSBase = OpenLibrary("dos.library",36); + + #if defined(__amigaos4__) + { + if(cc->cc_DOSBase != NULL) + { + cc->cc_IDOS = (struct DOSIFace *)GetInterface(cc->cc_DOSBase, "main", 1, 0); + if(cc->cc_IDOS == NULL) + { + CloseLibrary(cc->cc_DOSBase); + cc->cc_DOSBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + if(cc->cc_DOSBase == NULL) + { + error = ERROR_INVALID_RESIDENT_LIBRARY; + goto out; + } + + cc->cc_LocaleBase = OpenLibrary("locale.library",38); + + #if defined(__amigaos4__) + { + if(cc->cc_LocaleBase != NULL) + { + cc->cc_ILocale = (struct LocaleIFace *)GetInterface(cc->cc_LocaleBase, "main", 1, 0); + if(cc->cc_ILocale == NULL) + { + CloseLibrary(cc->cc_LocaleBase); + cc->cc_LocaleBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + cc->cc_UtilityBase = OpenLibrary("utility.library",37); + + #if defined(__amigaos4__) + { + if(cc->cc_UtilityBase != NULL) + { + cc->cc_IUtility = (struct UtilityIFace *)GetInterface(cc->cc_UtilityBase, "main", 1, 0); + if(cc->cc_IUtility == NULL) + { + CloseLibrary(cc->cc_UtilityBase); + cc->cc_UtilityBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + cc->cc_IconBase = OpenLibrary("icon.library",37); + + #if defined(__amigaos4__) + { + if(cc->cc_IconBase != NULL) + { + cc->cc_IIcon = (struct IconIFace *)GetInterface(cc->cc_IconBase, "main", 1, 0); + if(cc->cc_IIcon == NULL) + { + CloseLibrary(cc->cc_IconBase); + cc->cc_IconBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + cc->cc_IntuitionBase = OpenLibrary("intuition.library",37); + + #if defined(__amigaos4__) + { + if(cc->cc_IntuitionBase != NULL) + { + cc->cc_IIntuition = (struct IntuitionIFace *)GetInterface(cc->cc_IntuitionBase, "main", 1, 0); + if(cc->cc_IIntuition == NULL) + { + CloseLibrary(cc->cc_IntuitionBase); + cc->cc_IntuitionBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + /* The following may be necessary to flush out an inoperable + bsdsocket.library which reached the end of the shutdown + process. */ + #if 1 + { + struct ExecBase * ex = (struct ExecBase *)SysBase; + struct Library * lib; + + Forbid(); + + lib = (struct Library *)FindName(&ex->LibList,"bsdsocket.library"); + if(lib != NULL) + RemLibrary(lib); + + Permit(); + } + #endif + + cc->cc_SocketBase = OpenLibrary("bsdsocket.library",4); + + #if defined(__amigaos4__) + { + if(cc->cc_SocketBase != NULL) + { + cc->cc_ISocket = (struct SocketIFace *)GetInterface(cc->cc_SocketBase, "main", 1, 0); + if(cc->cc_ISocket == NULL) + { + CloseLibrary(cc->cc_SocketBase); + cc->cc_SocketBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + error = OK; + + out: + + return(error); +} + +/****************************************************************************/ + +#define CATCOMP_ARRAY +#define ADDNETINTERFACE_CATALOG_STRINGS +#include "roadshow.h" + +/****************************************************************************/ + +/* This is the main() program, so to speak. */ +STATIC LONG +cmd(struct CommandContext * cc) +{ + STRPTR devs_prefix = "DEVS:NetInterfaces"; + STRPTR storage_prefix = "SYS:Storage/NetInterfaces"; + + struct + { + KEY * Interface; + SWITCH Quiet; + NUMBER Timeout; + } args; + + STRPTR args_template = + "INTERFACE/M," + "QUIET/S," + "TIMEOUT/K/N" + VERSTAG; + + DECLARE_SYSBASE(cc); + DECLARE_DOSBASE(cc); + DECLARE_UTILITYBASE(cc); + DECLARE_ICONBASE(cc); + DECLARE_SOCKETBASE(cc); + + struct List interface_list; + ULONG interface_list_size; + UBYTE * buf = NULL; + LONG result = RETURN_FAIL; + struct RDArgs * rda = NULL; + LONG timeout = 60; + BPTR old_cd = ZERO; + BOOL old_cd_valid = FALSE; + struct DiskObject * icon = NULL; + BOOL configuration_trouble = FALSE; + + NewList(&interface_list); + interface_list_size = 0; + + GetProgramName(cc->cc_ProgramName,sizeof(cc->cc_ProgramName)); + + memset(&args,0,sizeof(args)); + + /* If started from shell, read the command arguments. */ + if(cc->cc_StartupMessage == NULL) + { + rda = ReadArgs(args_template,(LONG *)&args,NULL); + if(rda == NULL) + { + error_print_fault(cc,IoErr()); + goto out; + } + + cc->cc_Quiet = (BOOL)(args.Quiet != 0); + } + + /* Did we manage to open utility.library? */ + if(UtilityBase == NULL) + { + if(NOT cc->cc_Quiet) + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NO_UTILITY_TXT)); + + goto out; + } + + /* Did we manage to open bsdsocket.library? */ + if(SocketBase == NULL) + { + if(NOT cc->cc_Quiet) + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_CANNOT_OPEN_BSDSOCKET_TXT)); + + goto out; + } + else + { + LONG have_interface_api = FALSE; + LONG have_routing_api = FALSE; + LONG have_address_conversion_api = FALSE; + + /* Check if the bsdsocket.library we managed to open supports the + various APIs we expect below. */ + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_HAVE_INTERFACE_API),&have_interface_api, + TAG_END) != 0) + { + have_interface_api = FALSE; + } + + if(NOT have_interface_api) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_BSDSOCKET_HAS_NO_INTERFACE_API_TXT), + SocketBase->lib_Node.ln_Name, SocketBase->lib_Version, SocketBase->lib_Revision); + } + + goto out; + } + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_HAVE_ROUTING_API),&have_routing_api, + TAG_END) != 0) + { + have_routing_api = FALSE; + } + + if(NOT have_routing_api) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_BSDSOCKET_HAS_NO_ROUTE_API_TXT), + SocketBase->lib_Node.ln_Name, SocketBase->lib_Version, SocketBase->lib_Revision); + } + + goto out; + } + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_HAVE_ADDRESS_CONVERSION_API),&have_address_conversion_api, + TAG_END) != 0) + { + have_address_conversion_api = FALSE; + } + + if(NOT have_address_conversion_api) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_HAS_NO_ADDRESS_CONVERSION_API_TXT), + SocketBase->lib_Node.ln_Name, SocketBase->lib_Version, SocketBase->lib_Revision); + } + + goto out; + } + } + + /* This is required by the code that reads the configuration + file. And we allocate this data here because if we had + allocated it before Intuition was opened, error display + would have been difficult. */ + cc->cc_RDA = AllocDosObject(DOS_RDARGS,NULL); + if(cc->cc_RDA == NULL) + { + if(NOT cc->cc_Quiet) + error_print_fault(cc,IoErr()); + + goto out; + } + + /* If started from shell, process the command line arguments. */ + if(cc->cc_StartupMessage == NULL) + { + KEY * interface_table; + int operating_mode; + STRPTR interface; + struct Node * node; + + /* This is to be used for pattern matching when trying to find + the interfaces to add. */ + #if defined(__amigaos4__) + { + cc->cc_AnchorPath = AllocDosObjectTags(DOS_ANCHORPATH, + ADO_Strlen, MAX_FILENAME_LEN, + ADO_Mask, SIGBREAKF_CTRL_C, + TAG_END); + } + #else + { + cc->cc_AnchorPath = AllocVec(sizeof(*cc->cc_AnchorPath) + MAX_FILENAME_LEN,MEMF_ANY|MEMF_PUBLIC); + if(cc->cc_AnchorPath != NULL) + memset(cc->cc_AnchorPath,0,sizeof(*cc->cc_AnchorPath)); + } + #endif /* __amigaos4__ */ + + if(cc->cc_AnchorPath == NULL) + { + if(NOT cc->cc_Quiet) + error_print_fault(cc,IoErr()); + + goto out; + } + + if(args.Timeout != NULL && (*args.Timeout) > 0) + { + timeout = (*args.Timeout); + if(timeout < AAM_TIMEOUT_MIN) + { + if(NOT cc->cc_Quiet) + { + warning_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_TIMEOUT_TOO_SHORT_TXT), + timeout,AAM_TIMEOUT_MIN); + } + + timeout = 10; + } + } + + /* There has to be at least one interface name we can work with. */ + if(args.Interface == NULL) + { + if(NOT cc->cc_Quiet) + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NO_INTERFACE_NAME_GIVEN_TXT)); + + result = RETURN_ERROR; + + goto out; + } + + result = RETURN_OK; + + /* Check each interface name given; if it's a wildcard pattern, expand it. */ + interface_table = args.Interface; + + while((interface = (*interface_table++)) != NULL) + { + /* Not an absolute path name? Look into DEVS: instead. */ + if(FilePart(interface) == interface) + { + LONG len = strlen(interface); + LONG max_name_size = strlen(storage_prefix) + 1 + len + 1; + BPTR file_lock; + D_S(struct FileInfoBlock,fib); + BOOL have_name = FALSE; + LONG error = 0; + + if(CheckSignal(SIGBREAKF_CTRL_C)) + { + if(NOT cc->cc_Quiet) + error_print_fault(cc,ERROR_BREAK); + + goto out; + } + + node = AllocVec(sizeof(*node) + max_name_size,MEMF_ANY|MEMF_PUBLIC); + if(node == NULL) + { + if(NOT cc->cc_Quiet) + error_print_fault(cc,IoErr()); + + result = RETURN_ERROR; + + goto out; + } + + node->ln_Name = (char *)(node + 1); + node->ln_Pri = 0; + + /* Check if the interface file exists in the local directory. + Make sure that it's a file, too. */ + file_lock = Lock(interface,SHARED_LOCK); + if(file_lock != ZERO && Examine(file_lock,fib)) + { + if(fib->fib_DirEntryType < 0) + { + strcpy(node->ln_Name,interface); + have_name = TRUE; + } + else + { + error = ERROR_OBJECT_WRONG_TYPE; + } + } + else + { + error = IoErr(); + } + + UnLock(file_lock); + + /* If we still don't have a name, look into "DEVS:NetInterfaces". */ + if(NOT have_name && (error == ERROR_OBJECT_WRONG_TYPE || error == ERROR_OBJECT_NOT_FOUND)) + { + strcpy(node->ln_Name,devs_prefix); + AddPart(node->ln_Name,interface,max_name_size); + + file_lock = Lock(node->ln_Name,SHARED_LOCK); + if(file_lock != ZERO && Examine(file_lock,fib)) + { + if(fib->fib_DirEntryType < 0) + have_name = TRUE; + else + error = ERROR_OBJECT_WRONG_TYPE; + } + else + { + error = IoErr(); + } + + UnLock(file_lock); + } + + /* If we still don't have a name, look into "SYS:Storage/NetInterfaces". */ + if(NOT have_name && (error == ERROR_OBJECT_WRONG_TYPE || error == ERROR_OBJECT_NOT_FOUND)) + { + strcpy(node->ln_Name,storage_prefix); + AddPart(node->ln_Name,interface,max_name_size); + + file_lock = Lock(node->ln_Name,SHARED_LOCK); + if(file_lock != ZERO && Examine(file_lock,fib)) + { + if(fib->fib_DirEntryType < 0) + have_name = TRUE; + else + error = ERROR_OBJECT_WRONG_TYPE; + } + else + { + error = IoErr(); + } + + UnLock(file_lock); + } + + if(have_name) + { + /* Try to read the interface priority from the + icon attached to the file, if there is any. */ + if(IconBase != NULL) + { + struct DiskObject * icon; + + icon = GetDiskObject(node->ln_Name); + if(icon != NULL) + { + STRPTR priority; + + priority = FindToolType(icon->do_ToolTypes,"PRI"); + if(priority == NULL) + priority = FindToolType(icon->do_ToolTypes,"PRIORITY"); + + if(priority != NULL) + { + LONG value; + + if(StrToLong(priority,&value) > 0) + { + if(-128 <= value && value <= 127) + node->ln_Pri = value; + } + } + + FreeDiskObject(icon); + } + } + + add_interface_node(cc,&interface_list,node); + interface_list_size++; + } + else + { + if(NOT cc->cc_Quiet) + error_print_fault_prefix(cc,error,interface); + + result = RETURN_ERROR; + + goto out; + } + } + else + { + static STRPTR info_suffix = ".info"; + const int info_suffix_len = strlen(info_suffix); + LONG error; + + /* We may have to check an icon or two, so icon.library better be open. */ + if(IconBase == NULL) + { + if(NOT cc->cc_Quiet) + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NO_ICON_TXT)); + + goto out; + } + + MatchEnd(cc->cc_AnchorPath); + + #ifndef __amigaos4__ + { + memset(cc->cc_AnchorPath,0,sizeof(*cc->cc_AnchorPath)); + + cc->cc_AnchorPath->ap_Strlen = MAX_FILENAME_LEN; + cc->cc_AnchorPath->ap_BreakBits = SIGBREAKF_CTRL_C; + } + #endif /* __amigaos4__ */ + + /* Find all the files that match the pattern, if any. */ + error = MatchFirst(interface,cc->cc_AnchorPath); + while(error == OK) + { + /* Careful there, only check files! */ + if(cc->cc_AnchorPath->ap_Info.fib_DirEntryType < 0) + { + int len = strlen(cc->cc_AnchorPath->ap_Buf); + + /* Files whose names end with ".info" are ignored. */ + if(len < info_suffix_len || Stricmp(&cc->cc_AnchorPath->ap_Buf[len - info_suffix_len],info_suffix) != SAME) + { + struct DiskObject * icon; + + node = AllocVec(sizeof(*node) + strlen(cc->cc_AnchorPath->ap_Buf)+1,MEMF_ANY); + if(node == NULL) + { + error = ERROR_NO_FREE_STORE; + break; + } + + node->ln_Name = (char *)(node + 1); + node->ln_Pri = 0; + + strcpy(node->ln_Name,cc->cc_AnchorPath->ap_Buf); + + icon = GetDiskObject(node->ln_Name); + if(icon != NULL) + { + STRPTR priority; + + priority = FindToolType(icon->do_ToolTypes,"PRI"); + if(priority == NULL) + priority = FindToolType(icon->do_ToolTypes,"PRIORITY"); + + if(priority != NULL) + { + LONG value; + + if(StrToLong(priority,&value) > 0) + { + if(-128 <= value && value <= 127) + node->ln_Pri = value; + } + } + + FreeDiskObject(icon); + } + + add_interface_node(cc,&interface_list,node); + interface_list_size++; + } + } + + error = MatchNext(cc->cc_AnchorPath); + } + + if(error != OK && error != ERROR_NO_MORE_ENTRIES) + { + if(NOT cc->cc_Quiet) + error_print_fault(cc,IoErr()); + + result = RETURN_ERROR; + + goto out; + } + } + } + + /* Now run through all the steps of the configuration process, + adding each interface in turn. */ + for(operating_mode = AIM_Add ; operating_mode <= AIM_Configure ; operating_mode++) + { + for(node = interface_list.lh_Head ; node->ln_Succ != NULL ; node = node->ln_Succ) + { + result = add_interface(cc,node->ln_Name,operating_mode,timeout); + if(result != OK) + { + /* Fail only if there is one single interface involved. */ + if(interface_list_size == 1) + goto out; + + configuration_trouble = TRUE; + } + } + } + } + else + { + result = RETURN_OK; + + /* We may have to check an icon or two, so icon.library better be open. */ + if(IconBase == NULL) + { + if(NOT cc->cc_Quiet) + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NO_ICON_TXT)); + + goto out; + } + + /* We need at least one project icon to be invoked with this command. */ + if(cc->cc_StartupMessage->sm_NumArgs > 1) + { + D_S(struct FileInfoBlock,fib); + int operating_mode; + BOOL fib_valid; + BPTR lock; + LONG i; + + memset(fib,0,sizeof(fib)); + + /* Run down the project icons. */ + for(i = 1 ; i < cc->cc_StartupMessage->sm_NumArgs ; i++) + { + /* These are the default settings which can be + overridden through icon tool types. */ + timeout = 60; + cc->cc_Quiet = FALSE; + + /* Free the last icon we may have dealt with. */ + if(icon != NULL) + { + FreeDiskObject(icon); + icon = NULL; + } + + /* Remember the current directory we started with. It has + to be restored, eventually. */ + if(NOT old_cd_valid) + { + old_cd = CurrentDir(cc->cc_StartupMessage->sm_ArgList[i].wa_Lock); + + old_cd_valid = TRUE; + } + else + { + CurrentDir(cc->cc_StartupMessage->sm_ArgList[i].wa_Lock); + } + + fib_valid = FALSE; + + /* Try to figure out what kind of object we are dealing + with and, if it's a file, check the icon tool types. */ + lock = Lock(cc->cc_StartupMessage->sm_ArgList[i].wa_Name,SHARED_LOCK); + if(lock != ZERO) + { + if(Examine(lock,fib)) + { + fib_valid = TRUE; + + if(icon == NULL) + { + icon = GetDiskObject(cc->cc_StartupMessage->sm_ArgList[i].wa_Name); + if(icon != NULL) + { + STRPTR str; + + str = FindToolType(icon->do_ToolTypes,"QUIET"); + if(str != NULL) + cc->cc_Quiet = TRUE; + + str = FindToolType(icon->do_ToolTypes,"TIMEOUT"); + if(str != NULL) + { + LONG val; + + if((StrToLong(str,&val) > 0) && (val > 0)) + { + if(val < 10) + val = 10; + + timeout = val; + } + } + } + } + } + + UnLock(lock); + } + + /* If we found a likely configuration file, take care of it. */ + if(fib_valid && (fib->fib_DirEntryType < 0)) + { + /* Run through the configuration steps for this icon. */ + for(operating_mode = AIM_Add ; operating_mode <= AIM_Configure ; operating_mode++) + { + result = add_interface(cc,cc->cc_StartupMessage->sm_ArgList[i].wa_Name,operating_mode,timeout); + if(result != OK) + { + /* Fail only if there is one single interface involved. */ + if(cc->cc_StartupMessage->sm_NumArgs == 1) + goto out; + + configuration_trouble = TRUE; + } + } + } + } + } + } + + if(configuration_trouble) + result = RETURN_WARN; + + out: + + if(NOT IsListEmpty(&interface_list)) + { + struct Node * node; + + while((node = RemHead(&interface_list)) != NULL) + FreeVec(node); + } + + if(old_cd_valid) + CurrentDir(old_cd); + + if(icon != NULL) + FreeDiskObject(icon); + + DeleteMsgPort(cc->cc_ReplyPort); + + if(cc->cc_Quiet && result != RETURN_OK) + result = RETURN_WARN; + + FreeVec(buf); + + if(rda != NULL) + FreeArgs(rda); + + return(result); +} + +/****************************************************************************/ + +/* Check if a string reads as YES/NO or ON/OFF. */ +STATIC LONG +match_key(struct CommandContext * cc,STRPTR what) +{ + DECLARE_UTILITYBASE(cc); + + LONG result; + + if(Stricmp(what,"YES") == SAME || + Stricmp(what,"ON") == SAME) + { + result = TRUE; + } + else if (Stricmp(what,"NO") == SAME || + Stricmp(what,"OFF") == SAME) + { + result = FALSE; + } + else + { + result = -1; + } + + return(result); +} + +/****************************************************************************/ + +/* Add a new tag item to a list being built. */ +STATIC LONG +add_tag(struct CommandContext * cc,Tag tag,ULONG data) +{ + DECLARE_SYSBASE(cc); + + LONG error = OK; + LONG which = -1; + LONG i; + + for(i = 0 ; i < cc->cc_NumTags ; i++) + { + if(cc->cc_Tags[i].ti_Tag == tag) + { + which = i; + break; + } + } + + if(which == -1 && cc->cc_NumTags + 1 >= cc->cc_MaxTags) + { + struct TagItem * new_tags; + + new_tags = AllocVec(sizeof(*new_tags) * (cc->cc_MaxTags+10),MEMF_ANY|MEMF_PUBLIC); + if(new_tags == NULL) + { + error = ERROR_NO_FREE_STORE; + goto out; + } + + if(cc->cc_Tags != NULL) + CopyMem(cc->cc_Tags,new_tags,sizeof(*new_tags) * cc->cc_NumTags); + + FreeVec(cc->cc_Tags); + cc->cc_Tags = new_tags; + cc->cc_MaxTags += 10; + } + + if(which == -1) + which = cc->cc_NumTags++; + + cc->cc_Tags[which].ti_Tag = tag; + cc->cc_Tags[which].ti_Data = data; + + out: + + return(error); +} + +/****************************************************************************/ + +/* Check if a character is considered a blank space. This includes + the ' ', '\t' and '\240' characters. */ +STATIC BOOL +is_blank_space(UBYTE c) +{ + BOOL result; + + result = (BOOL)(c == ' ' || c == '\t' || c == (UBYTE)'\240'); + + return(result); +} + +/****************************************************************************/ + +/* Get the next token from a string; tokens are separated by blank spaces + or the colon character. This is used for configuring the hardware + address of an Ethernet interface. */ +STATIC STRPTR +get_next_token( + STRPTR input, + STRPTR string, + LONG string_len) +{ + if((*input) == '\0') + { + input = NULL; + } + else + { + UBYTE c; + + while(is_blank_space(*input) || (*input) == ':') + input++; + + while(TRUE) + { + c = (*input++); + + /* Stop at the end of the string or when a blank + space is found. */ + if(c == '\0') + { + input--; + break; + } + else if (is_blank_space(c) || c == ':') + { + break; + } + + if(string_len > 1) + { + (*string++) = c; + string_len--; + } + } + + if(string_len > 0) + (*string) = '\0'; + } + + return(input); +} + +/****************************************************************************/ + +/* Convert a hexadecimal number into a 32 bit integer. */ +STATIC LONG +get_hex_value(struct CommandContext * cc,STRPTR str) +{ + DECLARE_UTILITYBASE(cc); + + LONG result = -1; + LONG value = 0; + LONG len = 0; + UBYTE c; + + while((c = ToUpper(*str++)) != '\0') + { + len++; + if(len > 2) + goto out; + + if('0' <= c && c <= '9') + c = c - '0'; + else if ('A' <= c && c <= 'F') + c = c - 'A' + 10; + else + goto out; + + value = (16 * value) + c; + } + + result = value; + + out: + + return(result); +} + +/****************************************************************************/ + +/* Turn an 8 bit integer into a hexadecimal string. */ +STATIC VOID +get_hex_string(LONG value,STRPTR str) +{ + STATIC UBYTE code[] = "0123456789ABCDEF"; + + str[0] = code[(value & 0xF0) >> 4]; + str[1] = code[(value & 0x0F) ]; + str[2] = '\0'; +} + +/****************************************************************************/ + +/* Remove all unprintable characters from a string. */ +STATIC VOID +strip_unprintable_characters(STRPTR s) +{ + STRPTR t = s; + UBYTE c; + + while((c = (*s++)) != '\0') + { + if((c >= ' ' || c == '\t') && (c < '\177' || c >= (UBYTE)'\240')) + (*t++) = c; + } + + (*t) = '\0'; +} + +/****************************************************************************/ + +/* Strip leading and trailing blank spaces from a string. */ +STATIC VOID +strip_extra_blank_spaces(STRPTR s) +{ + LONG num_leading_spaces; + LONG num_trailing_spaces; + LONG len,i; + + len = strlen(s); + + num_leading_spaces = 0; + + for(i = 0 ; i < len ; i++) + { + if(NOT is_blank_space(s[i])) + break; + + num_leading_spaces++; + } + + num_trailing_spaces = 0; + + for(i = len-1 ; i >= 0 ; i--) + { + if(NOT is_blank_space(s[i])) + break; + + num_trailing_spaces++; + } + + if(num_trailing_spaces > 0) + { + len -= num_trailing_spaces; + s[len] = '\0'; + } + + if(num_leading_spaces > 0) + memmove(s,&s[num_leading_spaces],len+1); +} + +/****************************************************************************/ + +/* This is the big one. It reads the configuration file and acts upon what it finds. */ +STATIC LONG +add_interface(struct CommandContext * cc,STRPTR name,enum add_interface_mode_t operating_mode,LONG timeout) +{ + /* This is where the configuration file data will go. */ + struct + { + KEY Device; + NUMBER Unit; + NUMBER IPType; + NUMBER ARPType; + NUMBER IPRequests; + NUMBER WriteRequests; + NUMBER ARPRequests; + KEY HardwareType; /* This is always ignored; it's only for the prefs editor to use! */ + KEY Debug; + KEY Filter; + KEY PointToPoint; + KEY Multicast; + KEY DownGoesOffline; + KEY ReportOffline; + KEY RequiresInitDelay; + KEY CopyMode; + KEY Address; + KEY * Alias; + KEY NetMask; + KEY State; + KEY BroadcastAddress; + KEY DestinationAddress; + KEY HardwareAddress; + NUMBER Metric; + NUMBER MTU; + KEY Configure; + KEY Lease; + KEY ID; + KEY DHCPUnicast; + } args; + + /* This command template corresponds to the parameter definitions above. */ + STRPTR args_template = + "DEVICE/K," + "UNIT/K/N," + "IPTYPE/K/N," + "ARPTYPE/K/N," + "IPREQUESTS/K/N," + "WRITEREQUESTS/K/N," + "ARPREQUESTS/K/N," + "HARDWARETYPE/K," + "DEBUG/K," + "FILTER/K," + "POINTTOPOINT/K," + "MULTICAST/K," + "DOWNGOESOFFLINE/K," + "REPORTOFFLINE/K," + "REQUIRESINITDELAY/K," + "COPYMODE/K," + "ADDRESS/K," + "ALIAS/K/M," + "NETMASK/K," + "STATE/K," + "BROADCASTADDRESS/K," + "DESTINATION=DESTINATIONADDRESS/K," + "HARDWAREADDRESS/K," + "METRIC/K/N," + "MTU/K/N," + "CONFIGURE/K," + "LEASE/K," + "ID/K," + "DHCPUNICAST/K"; + + DECLARE_SYSBASE(cc); + DECLARE_DOSBASE(cc); + DECLARE_UTILITYBASE(cc); + DECLARE_SOCKETBASE(cc); + + STRPTR hardware_address = NULL; + struct InterfaceHardwareAddress iha; + LONG interface_state = SM_Up; + STRPTR address = NULL; + STRPTR net_mask = NULL; + STRPTR broadcast_address = NULL; + STRPTR destination_address = NULL; + LONG metric = 0; + STRPTR device_name = NULL; + LONG device_unit = 0; + LONG result = RETURN_FAIL; + STRPTR interface_name = FilePart(name); + UBYTE default_domain_name[256]; + UBYTE str[512]; + UBYTE *s; + UBYTE *t; + UBYTE *v; + LONG line_number; + LONG error; + LONG len; + LONG i; + LONG separator_index; + UBYTE separator_char; + BOOL configure_dynamic = FALSE; + BOOL configure_auto = FALSE; + BOOL configure_slow_auto = FALSE; + ULONG lease_time = DHCP_DEFAULT_LEASE_TIME; + STRPTR client_id = NULL; + struct List alias_list; + struct Node * node; + LONG dhcp_unicast = FALSE; + + NewList(&alias_list); + + memset(&iha,0,sizeof(iha)); + + /* Try to open the configuration file. */ + cc->cc_File = Open(name,MODE_OLDFILE); + if(cc->cc_File == ZERO) + { + if(NOT cc->cc_Quiet) + { + error = IoErr(); + + Fault(error,NULL,str,sizeof(str)); + + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_CANNOT_OPEN_FILE_TXT), + name,str); + } + + goto out; + } + + /* Use a larger buffer to make reading from the configuration + file a little more efficient. */ + SetVBuf(cc->cc_File,NULL,BUF_LINE,sizeof(str)); + + /* Free any configuration items allocated before. */ + FreeVec(cc->cc_Tags); + cc->cc_Tags = NULL; + + cc->cc_MaxTags = cc->cc_NumTags = 0; + + line_number = 0; + + /* Read the configuration file line by line. */ + while(FGets(cc->cc_File,str,sizeof(str)-2) != NULL) + { + line_number++; + + /* Drop anything from the line that we don't want. */ + strip_unprintable_characters(str); + + /* Skip leading blank spaces. */ + s = str; + while(is_blank_space(*s)) + s++; + + /* A # or ; introduces a comment. We just ignore that. */ + if((*s) == '#' || (*s) == ';') + continue; + + /* Drop trailing blank spaces. */ + len = strlen(s); + while(len > 0 && (is_blank_space(s[len-1]) || s[len-1] == '\r' || s[len-1] == '\n')) + len--; + + if(len == 0) + continue; + + s[len] = '\0'; + + /* There's a key and a value in this line. The key and the value + are separated by blank spaces or a '=' character. */ + t = v = s; + + /* Isolate the key; the key is everything that's not a blank + space or a '=' character. */ + while(NOT is_blank_space(*t) && (*t) != '=' && (*t) != '\0') + { + v++; + t++; + } + + /* Find the value. */ + if((*t) != '\0') + { + (*v++) = ' '; + + t++; + + while(is_blank_space(*t) || (*t) == '=') + t++; + + while((*t) != '\0') + (*v++) = (*t++); + } + + (*v) = '\0'; + + /* Figure out where the separator character (blank space or '=') is. */ + len = strlen(s); + + separator_index = -1; + separator_char = '\0'; + + for(i = 0 ; i < len ; i++) + { + if(is_blank_space(s[i]) || s[i] == '=') + { + separator_index = i; + separator_char = s[i]; + + /* Chop off the string after the key. */ + s[i] = '\0'; + break; + } + } + + /* Check if we know the key for this line. */ + if(FindArg(args_template,s) == -1) + { + /* We don't know it, so we'll ignore it. */ + if(NOT cc->cc_Quiet) + { + warning_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_UNKNOWN_KEYWORD_TXT), + s,line_number,name); + } + + continue; + } + + /* Restore the character following the key. */ + if(separator_index != -1) + s[separator_index] = separator_char; + + s[len++] = '\n'; + s[len] = '\0'; + + /* Process what's in this line. */ + FreeArgs(cc->cc_RDA); + memset(&args,0,sizeof(args)); + + cc->cc_RDA->RDA_Source.CS_Buffer = s; + cc->cc_RDA->RDA_Source.CS_Length = len; + cc->cc_RDA->RDA_Source.CS_CurChr = 0; + cc->cc_RDA->RDA_Flags |= RDAF_NOPROMPT; + + if(CANNOT ReadArgs((STRPTR)args_template,(LONG *)&args,cc->cc_RDA)) + { + if(NOT cc->cc_Quiet) + { + error = IoErr(); + + Fault(error,NULL,str,sizeof(str)); + + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_PARSE_ERROR_TXT), + line_number,name,str); + } + + goto out; + } + + /* Did we get a device name? */ + if(args.Device != NULL) + { + FreeVec(device_name); + + device_name = AllocVec(strlen(args.Device)+1,MEMF_ANY|MEMF_PUBLIC); + if(device_name == NULL) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + + strcpy(device_name,args.Device); + } + + /* Did we get a unit number? */ + if(args.Unit != NULL) + device_unit = (*args.Unit); + + /* Did we get an IP packet type? */ + if(args.IPType != NULL) + { + error = add_tag(cc,IFA_IPType,(*args.IPType)); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + } + + /* Did we get an ARP packet type? */ + if(args.ARPType != NULL) + { + error = add_tag(cc,IFA_ARPType,(*args.ARPType)); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + } + + /* Did we get a number for the total number of IP requests? */ + if(args.IPRequests != NULL) + { + error = add_tag(cc,IFA_NumReadRequests,(*args.IPRequests)); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + } + + /* Did we get a number for the total number of write requests? */ + if(args.WriteRequests != NULL) + { + error = add_tag(cc,IFA_NumWriteRequests,(*args.WriteRequests)); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + } + + /* Did we get a number for the total number of ARP requests? */ + if(args.ARPRequests != NULL) + { + error = add_tag(cc,IFA_NumARPRequests,(*args.ARPRequests)); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + } + + /* Did we get a filter mode? */ + if(args.Filter != NULL) + { + LONG mode; + + /* What is the filter set to? */ + if(Stricmp(args.Filter,"OFF") == SAME) + mode = PFM_Nothing; + else if (Stricmp(args.Filter,"LOCAL") == SAME) + mode = PFM_Local; + else if (Stricmp(args.Filter,"IPANDARP") == SAME) + mode = PFM_IPandARP; + else if (Stricmp(args.Filter,"EVERYTHING") == SAME) + mode = PFM_Everything; + else + mode = -1; + + if(mode < 0) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_UNKNOWN_PARAMETER_TXT), + args.Filter,line_number,name); + } + + goto out; + } + + error = add_tag(cc,IFA_PacketFilterMode,mode); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + } + + /* Is this a point-to-point device? */ + if(args.PointToPoint != NULL) + { + LONG mode; + + mode = match_key(cc,args.PointToPoint); + if(mode < 0) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_UNKNOWN_PARAMETER_TXT), + args.PointToPoint,line_number,name); + } + + goto out; + } + + error = add_tag(cc,IFA_PointToPoint,mode); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + } + + /* Enable or disable debug mode on this interface? */ + if(args.Debug != NULL) + { + LONG mode; + + mode = match_key(cc,args.Debug); + if(mode < 0) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_UNKNOWN_PARAMETER_TXT), + args.Debug,line_number,name); + } + + goto out; + } + + error = add_tag(cc,IFA_SetDebugMode,mode); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + } + + /* Is this interface capable of multicasts? */ + if(args.Multicast != NULL) + { + LONG mode; + + mode = match_key(cc,args.Multicast); + if(mode < 0) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_UNKNOWN_PARAMETER_TXT), + args.Multicast,line_number,name); + } + + goto out; + } + + error = add_tag(cc,IFA_Multicast,mode); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + } + + /* Should marking the interface "down" also take it offline? */ + if(args.DownGoesOffline != NULL) + { + LONG mode; + + mode = match_key(cc,args.DownGoesOffline); + if(mode < 0) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_UNKNOWN_PARAMETER_TXT), + args.DownGoesOffline,line_number,name); + } + + goto out; + } + + error = add_tag(cc,IFA_DownGoesOffline,mode); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + } + + /* Report when the interface goes offline? */ + if(args.ReportOffline != NULL) + { + LONG mode; + + mode = match_key(cc,args.ReportOffline); + if(mode < 0) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_UNKNOWN_PARAMETER_TXT), + args.ReportOffline,line_number,name); + } + + goto out; + } + + error = add_tag(cc,IFA_ReportOffline,mode); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + } + + /* Is a small delay required after initializing the interface? */ + if(args.RequiresInitDelay != NULL) + { + LONG mode; + + mode = match_key(cc,args.RequiresInitDelay); + if(mode < 0) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_UNKNOWN_PARAMETER_TXT), + args.RequiresInitDelay,line_number,name); + } + + goto out; + } + + error = add_tag(cc,IFA_RequiresInitDelay,mode); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + } + + /* Use a particular copying mode? */ + if(args.CopyMode != NULL) + { + LONG mode; + + if(Stricmp(args.CopyMode,"SLOW") == SAME) + mode = CM_SlowWordCopy; + else if (Stricmp(args.CopyMode,"FAST") == SAME) + mode = CM_FastWordCopy; + else + mode = -1; + + if(mode < 0) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_UNKNOWN_PARAMETER_TXT), + args.CopyMode,line_number,name); + } + + goto out; + } + + error = add_tag(cc,IFA_CopyMode,mode); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + } + + /* Use a particular IP address, or DHCP? */ + if(args.Address != NULL) + { + struct in_addr in; + + /* Is this an IP address? */ + if(Stricmp(args.Address,"DHCP") != SAME) + { + /* Is is a well-formed address? */ + if(CANNOT validate_ip_address(cc,"ADDRESS",args.Address,line_number,name)) + goto out; + } + + /* If this is an IP address, have a closer look at it. */ + if(inet_aton(args.Address,&in)) + { + /* Neither 0 nor the broadcast address are permitted. */ + if(in.s_addr == 0 || in.s_addr == ~0UL) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INVALID_ADDRESS_TXT), + args.Address,line_number,name); + } + + goto out; + } + + /* And no reserved range either. */ + if(((in.s_addr >> 24) & 0xFF) == 169 && + ((in.s_addr >> 16) & 0xFF) == 254) + { + warning_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_DYNAMIC_ADDRESS_SHOULD_NOT_BE_BOUND_TXT), + args.Address,line_number,name); + } + } + + FreeVec(address); + + address = AllocVec(strlen(args.Address)+1,MEMF_ANY|MEMF_PUBLIC); + if(address == NULL) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + + strcpy(address,args.Address); + } + + /* Set the interface to a particular state? */ + if(args.State != NULL) + { + if(Stricmp(args.State,"UP") == SAME) + { + interface_state = SM_Up; + } + else if (Stricmp(args.State,"DOWN") == SAME) + { + interface_state = SM_Down; + } + else if (Stricmp(args.State,"ONLINE") == SAME) + { + interface_state = SM_Online; + } + else if (Stricmp(args.State,"OFFLINE") == SAME) + { + interface_state = SM_Offline; + } + else + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_UNKNOWN_STATE_PARAMETER_TXT), + args.State,line_number); + } + + goto out; + } + } + + /* Use a particular broadcast address? */ + if(args.BroadcastAddress != NULL) + { + if(CANNOT validate_ip_address(cc,"BROADCASTADDRESS",args.BroadcastAddress,line_number,name)) + goto out; + + FreeVec(broadcast_address); + + broadcast_address = AllocVec(strlen(args.BroadcastAddress)+1,MEMF_ANY|MEMF_PUBLIC); + if(broadcast_address == NULL) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + + strcpy(broadcast_address,args.BroadcastAddress); + } + + /* For a point-to-point address, use a particular destination address for the peer? */ + if(args.DestinationAddress != NULL) + { + if(CANNOT validate_ip_address(cc,"DESTINATIONADDRESS",args.DestinationAddress,line_number,name)) + goto out; + + FreeVec(destination_address); + + destination_address = AllocVec(strlen(args.DestinationAddress)+1,MEMF_ANY|MEMF_PUBLIC); + if(destination_address == NULL) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + + strcpy(destination_address,args.DestinationAddress); + } + + /* Use a particular hardware address? */ + if(args.HardwareAddress != NULL) + { + UBYTE token[40]; + UBYTE buf[10]; + STRPTR arg; + LONG num_tokens; + LONG i; + + /* Collect individual tokens; these are octet separated by + blank spaces or ':' characters. */ + num_tokens = 0; + + arg = args.HardwareAddress; + while((arg = get_next_token(arg,token,sizeof(token))) != NULL) + { + if(get_hex_value(cc,token) < 0) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INVALID_HARDWARE_ADDRESS_TXT), + args.HardwareAddress,line_number,name); + } + + goto out; + } + + num_tokens++; + } + + /* Complain if we didn't get anything. */ + if(num_tokens == 0) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_MISSING_HARDWARE_ADDRESS_TXT), + line_number,name); + } + + goto out; + } + + FreeVec(iha.iha_Address); + FreeVec(hardware_address); + + /* Allocate memory for the address. */ + iha.iha_Length = num_tokens * 8; + iha.iha_Address = AllocVec(num_tokens,MEMF_ANY|MEMF_PUBLIC|MEMF_CLEAR); + if(iha.iha_Address == NULL) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_FOR_HARDWARE_ADDRESS_TXT), + args.HardwareAddress); + } + + goto out; + } + + hardware_address = AllocVec(3 * num_tokens,MEMF_ANY|MEMF_PUBLIC|MEMF_CLEAR); + if(hardware_address == NULL) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_FOR_HARDWARE_ADDRESS_TXT), + args.HardwareAddress); + } + + goto out; + } + + /* Now parse the individual octets. */ + i = 0; + arg = args.HardwareAddress; + while((arg = get_next_token(arg,token,sizeof(token))) != NULL) + { + iha.iha_Address[i] = get_hex_value(cc,token); + + get_hex_string(iha.iha_Address[i],buf); + if(i != 0) + strcat(hardware_address,":"); + + strcat(hardware_address,buf); + + i++; + } + + /* Assuming that this is probably an IEEE 802.3 family + address, we're going to check for a few likely + configuration errors due to poor choice of + address. */ + if(NOT cc->cc_Quiet) + { + if(num_tokens < 6) + { + warning_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_TOO_SHORT_TXT), + args.HardwareAddress,line_number,name); + } + else if (num_tokens > 6) + { + warning_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_TOO_LONG_TXT), + args.HardwareAddress,line_number,name); + } + + if(FLAG_IS_SET(iha.iha_Address[0],MAC_Is_Group_Address)) + { + BOOL is_broadcast_address = TRUE; + + for(i = 0 ; i < num_tokens ; i++) + { + if(iha.iha_Address[i] != 0xFF) + { + is_broadcast_address = FALSE; + break; + } + } + + if(is_broadcast_address) + { + warning_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_IS_BROADCAST_TXT), + args.HardwareAddress,line_number,name); + } + else + { + warning_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_IS_GROUP_TXT), + args.HardwareAddress,line_number,name); + } + } + } + } + + /* Use a particular netmask, or DHCP? */ + if(args.NetMask != NULL) + { + /* Is this an IP address? */ + if(Stricmp(args.NetMask,"DHCP") != SAME) + { + /* Is is a well-formed address? */ + if(CANNOT validate_ip_address(cc,"NETMASK",args.NetMask,line_number,name)) + goto out; + } + + FreeVec(net_mask); + + net_mask = AllocVec(strlen(args.NetMask)+1,MEMF_ANY|MEMF_PUBLIC); + if(net_mask == NULL) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + + strcpy(net_mask,args.NetMask); + } + + /* Use a particular routing metric? */ + if(args.Metric != NULL) + metric = (*args.Metric); + + /* Use a particular MTU value? */ + if(args.MTU != NULL && (*args.MTU) > 0) + { + error = add_tag(cc,IFA_LimitMTU,(*args.MTU)); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + } + + /* Use a particular configuration method? */ + if(args.Configure != NULL) + { + if(Stricmp(args.Configure,"DHCP") == SAME) + { + /* Dynamic Host Configuration Protocol */ + configure_dynamic = TRUE; + configure_auto = FALSE; + } + else if (Stricmp(args.Configure,"SLOWAUTO") == SAME || Stricmp(args.Configure,"AUTO") == SAME) + { + /* ZeroConf; "slow" method for spanning tree routing. */ + configure_dynamic = configure_auto = configure_slow_auto = TRUE; + } + else if (Stricmp(args.Configure,"FASTAUTO") == SAME) + { + /* ZeroConf; "fast" method for wireless applications, etc. */ + configure_dynamic = configure_auto = TRUE; + configure_slow_auto = FALSE; + } + else + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_UNKNOWN_PARAMETER_TXT), + args.Configure,line_number,name); + } + + goto out; + } + } + + /* Ask for a particular lease time? */ + if(args.Lease != NULL) + { + STRPTR s = args.Lease; + STRPTR key = NULL; + LONG number; + LONG len; + + /* Skip all leading blank spaces. */ + while(is_blank_space(*s)) + s++; + + /* If it's a number, convert it now. */ + len = 0; + number = 0; + while('0' <= (*s) && (*s) <= '9') + { + number = (10 * number) + (*s) - '0'; + len++; + s++; + } + + /* Skip all following blank spaces, if any. */ + while(is_blank_space(*s)) + s++; + + if(s[0] != '\0') + key = s; + + /* Check if there's a keyword instead. */ + if(len == 0 && key != NULL) + { + /* This should be "infinite", "infinity" or + simply "inf". */ + if(substring_matches(cc,"INF",key) == SAME) + { + lease_time = DHCP_INFINITE_LEASE_TIME; + } + else + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_UNKNOWN_LEASE_PARAMETER_TXT), + key,line_number,name); + } + + goto out; + } + } + else if (len > 0) + { + lease_time = number; + + /* This could be qualifier, which stands for seconds, + minutes, hours, days or weeks. */ + if(key != NULL) + { + if(substring_matches(cc,"SECOND",key) == SAME) + { + /* This is the default unit */ + } + else if (substring_matches(cc,"MINUTE",key) == SAME) + { + lease_time *= 60; + } + else if (substring_matches(cc,"HOUR",key) == SAME) + { + lease_time *= 60 * 60; + } + else if (substring_matches(cc,"DAY",key) == SAME) + { + lease_time *= 24 * 60 * 60; + } + else if (substring_matches(cc,"WEEK",key) == SAME) + { + lease_time *= 7 * 24 * 60 * 60; + } + else + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_UNKNOWN_LEASE_PARAMETER_TXT), + key,line_number,name); + } + + goto out; + } + } + } + else + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INVALID_LEASE_PARAMETER_TXT), + args.Lease,line_number,name); + } + + goto out; + } + } + + /* Use a particular client ID (for DHCP)? */ + if(args.ID != NULL) + { + LONG len; + + len = strlen(args.ID); + + if(len > 255 && NOT cc->cc_Quiet) + { + warning_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_ID_TOO_LONG_TXT), + args.ID,line_number,name); + } + + if(len < 2) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_ID_TOO_SHORT_TXT), + args.ID,line_number,name); + } + + goto out; + } + + FreeVec(client_id); + + client_id = AllocVec(len+1,MEMF_ANY|MEMF_PUBLIC); + if(client_id == NULL) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_NO_MEMORY_TXT), + interface_name); + } + + goto out; + } + + strncpy(client_id,args.ID,len); + client_id[len] = '\0'; + } + + /* Request that the DHCP server sends replies using + unicast instead of broadcast? */ + if(args.DHCPUnicast != NULL) + { + LONG mode; + + mode = match_key(cc,args.DHCPUnicast); + if(mode < 0) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_UNKNOWN_PARAMETER_TXT), + args.DHCPUnicast,line_number,name); + } + + goto out; + } + + dhcp_unicast = mode; + } + + /* Use an alias for this interface? */ + if(args.Alias != NULL) + { + STRPTR * alias = (STRPTR *)args.Alias; + struct in_addr in; + STRPTR address; + + while((address = (*alias++)) != NULL) + { + /* Check if the IP address is well-formed. */ + if(CANNOT validate_ip_address(cc,"ALIAS",address,line_number,name)) + goto out; + + /* Have a closer look at the address. */ + if(inet_aton(address,&in)) + { + /* Don't permit 0 or the broadcast address. */ + if(in.s_addr == 0 || in.s_addr == ~0UL) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INVALID_ADDRESS_TXT), + address,line_number,name); + } + + goto out; + } + + /* Don't use the reserved range. */ + if(((in.s_addr >> 24) & 0xFF) == 169 && + ((in.s_addr >> 16) & 0xFF) == 254) + { + warning_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_DYNAMIC_ADDRESS_SHOULD_NOT_BE_BOUND_TXT), + address,line_number,name); + } + } + + node = AllocVec(sizeof(*node) + strlen(address)+1,MEMF_ANY|MEMF_PUBLIC); + if(node == NULL) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT), + line_number,name); + } + + goto out; + } + + node->ln_Name = (char *)(node + 1); + strcpy(node->ln_Name,address); + + AddTail(&alias_list,node); + } + } + } + + /* When adding the interface, use the provided hardware address. */ + if(operating_mode == AIM_Add && iha.iha_Address != NULL) + { + error = add_tag(cc,IFA_HardwareAddress,(ULONG)&iha); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_HARDWARE_ADDRESS_TXT), + interface_name); + } + + goto out; + } + } + + /* This concludes the parameter list. */ + error = add_tag(cc,TAG_END,0); + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_ADD_INTERFACE_TXT), + name); + } + + goto out; + } + + /* Stop right here if no device name was given. */ + if(device_name == NULL) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NO_DEVICE_NAME_PROVIDED_TXT), + name); + } + + goto out; + } + + /* In the "add" stage, add the interface with the parameters given. */ + if(operating_mode == AIM_Add) + { + if(AddInterfaceTagList(interface_name,device_name,device_unit,cc->cc_Tags) != 0) + { + if(NOT cc->cc_Quiet) + { + LONG errno; + STRPTR code; + + get_errno_and_code(cc,&errno,&code); + + if(code != NULL && errno > 0) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_COULD_NOT_ADD_INTERFACE_ERROR_CODE_TXT), + interface_name,code); + } + else + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_COULD_NOT_ADD_INTERFACE_TXT), + interface_name); + } + } + + goto out; + } + + if(NOT cc->cc_Quiet) + { + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INTERFACE_ADDED_TXT), + interface_name); + + if(hardware_address != NULL) + { + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INTERFACE_HARDWARE_ADDRESS_SET_TO_TXT), + interface_name,hardware_address); + } + } + } + else if (operating_mode == AIM_Configure) + { + /* In the configure state, set up the interface address and aliases. */ + if(address != NULL || configure_dynamic) + { + struct AddressAllocationMessage * aam = &cc->cc_AllocationMessage; + BOOL want_address = (BOOL)(address != NULL && Stricmp(address,"DHCP") == SAME); + BOOL want_netmask = (BOOL)(net_mask != NULL && Stricmp(net_mask,"DHCP") == SAME); + + /* Do we need to configure anything dynamically? */ + if(configure_dynamic || want_address || want_netmask) + { + LONG signals; + + /* Remember the client identifier. */ + aam->aam_ClientIdentifier = client_id; + + /* We have to have the reply port ready. */ + if(cc->cc_ReplyPort == NULL) + { + cc->cc_ReplyPort = CreateMsgPort(); + if(cc->cc_ReplyPort == NULL) + { + if(NOT cc->cc_Quiet) + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_TXT),name); + + goto out; + } + } + + /* Before we begin, we will need to mark this + interface 'up' so that the protocol stack will + send messages through it. For some devices it + is not sufficient to mark the interface as up. + These also have to be switched online, too. */ + if(Local_ConfigureInterfaceTags(cc,interface_name, + IFC_State,SM_Online, + TAG_DONE) != 0) + { + if(NOT cc->cc_Quiet) + { + LONG errno; + STRPTR code; + + get_errno_and_code(cc,&errno,&code); + + if(code != NULL && errno > 0) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_CANNOT_MARK_INTERFACE_UP_ERROR_CODE_TXT), + interface_name,code); + } + else + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_CANNOT_MARK_INTERFACE_UP_TXT), + interface_name); + } + } + + goto out; + } + + if(NOT cc->cc_Quiet) + { + if(cc->cc_StartupMessage == NULL) + { + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_TRYING_INTERFACE_CONFIGURATION_TXT), + interface_name); + + Flush(Output()); + } + } + + /* Initialize the message, then send it. */ + aam->aam_Message.mn_Node.ln_Type = NT_REPLYMSG; + aam->aam_Message.mn_ReplyPort = cc->cc_ReplyPort; + aam->aam_Message.mn_Length = sizeof(*aam); + + memcpy(aam->aam_InterfaceName,interface_name,sizeof(aam->aam_InterfaceName)-1); + aam->aam_InterfaceName[sizeof(aam->aam_InterfaceName)-1] = '\0'; + + if(configure_auto) + { + if(configure_slow_auto) + aam->aam_Protocol = AAMP_SLOWAUTO; + else + aam->aam_Protocol = AAMP_FASTAUTO; + } + else + { + aam->aam_Protocol = AAMP_DHCP; + } + + aam->aam_Version = AAM_VERSION; + aam->aam_Timeout = timeout; + aam->aam_LeaseTime = lease_time; + aam->aam_RouterTable = cc->cc_RouterTable; + aam->aam_RouterTableSize = NUM_ENTRIES(cc->cc_RouterTable); + aam->aam_DNSTable = cc->cc_DNSTable; + aam->aam_DNSTableSize = NUM_ENTRIES(cc->cc_DNSTable); + aam->aam_LeaseExpires = &cc->cc_LeaseExpires; + aam->aam_DomainName = default_domain_name; + aam->aam_DomainNameSize = sizeof(default_domain_name); + aam->aam_Unicast = dhcp_unicast; /* Note: this field only exists in version 2 and above */ + + strcpy(default_domain_name,""); + + if(address != NULL && Stricmp(address,"DHCP") != SAME) + aam->aam_RequestedAddress = inet_addr(address); + + BeginInterfaceConfig(aam); + + /* Wait for something to happen. */ + signals = Wait(SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_F | (1UL << cc->cc_ReplyPort->mp_SigBit)); + + /* ^C means "stop everything". */ + if(signals & SIGBREAKF_CTRL_C) + { + AbortInterfaceConfig(aam); + WaitPort(cc->cc_ReplyPort); + GetMsg(cc->cc_ReplyPort); + + if(NOT cc->cc_Quiet) + { + info_printf(cc,"\n"); + + info_print_fault(cc,ERROR_BREAK); + } + + goto out; + } + else if (signals & SIGBREAKF_CTRL_F) + { + /* ^F means "stop configuring this interface". */ + AbortInterfaceConfig(aam); + WaitPort(cc->cc_ReplyPort); + GetMsg(cc->cc_ReplyPort); + + if(NOT cc->cc_Quiet) + { + info_printf(cc,"\n"); + + warning_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_ABORTED_TXT), + interface_name); + } + + result = RETURN_OK; + goto out; + } + else + { + if(NOT cc->cc_Quiet) + info_printf(cc,"\n"); + + WaitPort(cc->cc_ReplyPort); + GetMsg(cc->cc_ReplyPort); + + /* If that didn't work out, print an error message. */ + if(aam->aam_Result != AAMR_Success && NOT cc->cc_Quiet) + { + STATIC CONST error_map_table[][2] = + { + { AAMR_Aborted, MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_ABORTED_TXT }, + { AAMR_Timeout, MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_ATTEMPT_TIMED_OUT_TXT }, + { AAMR_InterfaceNotKnown, MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_TXT }, + { AAMR_InterfaceWrongType, MSG_ADDNETINTERFACE_INTERFACE_WRONG_TYPE_TXT }, + { AAMR_AddressKnown, MSG_ADDNETINTERFACE_INTERFACE_ALREADY_CONFIGURED_TXT }, + { AAMR_VersionUnknown, MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_VERSION_CONFLICT_TXT }, + { AAMR_NoMemory, MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_NO_MEMORY_TXT }, + { AAMR_AddressInUse, MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_ADDRESS_IN_USE_TXT }, + { AAMR_AddrChangeFailed, MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_ADDRESS_CHANGE_FAILED_TXT }, + { AAMR_MaskChangeFailed, MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_MASK_CHANGE_FAILED_TXT }, + { AAMR_Busy, MSG_ADDNETINTERFACE_INTERFACE_IS_BUSY_TXT }, + { -1, -1} + }; + + LONG message_code; + size_t i; + + message_code = MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_UNKNOWN_ERROR_TXT; + + for(i = 0 ; error_map_table[i][0] != -1 ; i++) + { + if(aam->aam_Result == error_map_table[i][0]) + { + message_code = error_map_table[i][1]; + break; + } + } + + error_printf(cc,get_str(cc,message_code), + interface_name,aam->aam_Result); + } + + /* Even if an error occured, don't stop the show. */ + if(aam->aam_Result != AAMR_Success) + { + result = RETURN_OK; + goto out; + } + + /* Check if we got the required IP address. */ + if(configure_dynamic || want_address) + { + UBYTE str[20]; + + /* Did we really get something? */ + if(aam->aam_Address == 0) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_INVALID_ADDRESS_TXT), + interface_name); + } + + goto out; + } + + /* Remember the address. */ + strcpy(str,Inet_NtoA(aam->aam_Address)); + + FreeVec(address); + address = AllocVec(strlen(str)+1,MEMF_ANY|MEMF_PUBLIC); + if(address == NULL) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_NO_MEMORY_TXT), + interface_name); + } + + goto out; + } + + strcpy(address,str); + } + + /* Check if we got the required subnet mask. */ + if(configure_dynamic || want_netmask) + { + /* Did we really get something? */ + if(aam->aam_SubnetMask == 0x00000000 || + aam->aam_SubnetMask == 0xFFFFFFFF) + { + FreeVec(net_mask); + net_mask = NULL; + } + else + { + UBYTE str[20]; + + /* Remember the subnet mask. */ + strcpy(str,Inet_NtoA(aam->aam_SubnetMask)); + + FreeVec(net_mask); + net_mask = AllocVec(strlen(str)+1,MEMF_ANY|MEMF_PUBLIC); + if(net_mask == NULL) + { + if(NOT cc->cc_Quiet) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_NO_MEMORY_TXT), + interface_name); + } + + goto out; + } + + strcpy(net_mask,str); + } + } + + /* Validate the router and DNS address tables. */ + if(configure_dynamic) + { + LONG i,n; + + n = 0; + for(i = 0 ; i < aam->aam_RouterTableSize ; i++) + { + if(aam->aam_RouterTable[i] != 0) + n++; + } + + if(n == 0) + aam->aam_RouterTable = NULL; + + n = 0; + for(i = 0 ; i < aam->aam_DNSTableSize ; i++) + { + if(aam->aam_DNSTable[i] != 0) + n++; + } + + if(n == 0) + aam->aam_DNSTable = NULL; + } + } + } + + /* Finally, configure the interface using the information obtained above. */ + if(Local_ConfigureInterfaceTags(cc,interface_name, + (NOT (configure_dynamic || want_address) && address != NULL) ? IFC_Address : TAG_IGNORE, address, + (NOT (configure_dynamic || want_netmask) && net_mask != NULL) ? IFC_NetMask : TAG_IGNORE, net_mask, + + (broadcast_address != NULL) ? IFC_BroadcastAddress : TAG_IGNORE, broadcast_address, + (destination_address != NULL) ? IFC_DestinationAddress : TAG_IGNORE, destination_address, + (metric != 0) ? IFC_Metric : TAG_IGNORE, metric, + IFC_State, interface_state, + IFC_Complete, TRUE, + TAG_DONE) != 0) + { + if(NOT cc->cc_Quiet) + { + LONG errno; + STRPTR code; + + get_errno_and_code(cc,&errno,&code); + + if(code != NULL && errno > 0) + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_COULD_NOT_CONFIGURE_INTERFACE_ERROR_CODE_TXT), + interface_name,code); + } + else + { + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_COULD_NOT_CONFIGURE_INTERFACE_TXT), + interface_name); + } + } + + goto out; + } + + /* Unless we shouldn't do so, say what we did above. */ + if(NOT cc->cc_Quiet) + { + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_TXT), + interface_name); + + if(address != NULL) + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_ADDRESS_TXT),address); + + if(net_mask != NULL) + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_MASK_TXT),net_mask); + + if(broadcast_address != NULL) + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_BROADCAST_ADDRESS_TXT),broadcast_address); + + if(destination_address != NULL) + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_DESTINATION_ADDRESS_TXT),destination_address); + + if(metric != 0) + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_METRIC_TXT),metric); + + info_printf(cc,".\n"); + } + + /* Check if we got any router information from the server. */ + if(configure_dynamic && aam->aam_RouterTable != NULL) + { + LONG i,n; + + n = 0; + for(i = 0 ; i < aam->aam_RouterTableSize ; i++) + { + if(aam->aam_RouterTable[i] != 0) + { + UBYTE str[20]; + LONG error = OK; + STRPTR code = NULL; + + /* Use this router address. */ + strcpy(str,Inet_NtoA(aam->aam_RouterTable[i])); + + /* The first is the default gateway address. */ + if(n == 0) + { + if(Local_AddRouteTags(cc, + RTA_DefaultGateway,str, + TAG_DONE) != OK) + { + get_errno_and_code(cc,&error,&code); + } + + /* Say what we did. */ + if(error == OK && NOT cc->cc_Quiet) + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_DEFAULT_ROUTE_TXT),str); + } + else + { + /* The second is a destination address. */ + if(Local_AddRouteTags(cc, + RTA_Destination,str, + TAG_DONE) != OK) + { + get_errno_and_code(cc,&error,&code); + } + + /* Say what we did. */ + if(error == OK && NOT cc->cc_Quiet) + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_ROUTE_TXT),str); + } + + /* Print an error message if that didn't work. */ + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + LONG message_code; + + if(code != NULL && error > 0) + message_code = MSG_ADDNETINTERFACE_COULD_NOT_ADD_ROUTE_ERROR_CODE_TXT; + else + message_code = MSG_ADDNETINTERFACE_COULD_NOT_ADD_ROUTE_TXT; + + error_printf(cc,get_str(cc,message_code),str,code); + } + + goto out; + } + + n++; + } + } + } + + /* Check if we got a default domain name to use for DNS lookups. */ + if(configure_dynamic) + { + STRPTR domain_name; + + if(aam->aam_DomainName != NULL && aam->aam_DomainName[0] != '\0') + domain_name = aam->aam_DomainName; + else + domain_name = ""; + + SetDefaultDomainName(domain_name); + + if(domain_name[0] != '\0' && NOT cc->cc_Quiet) + { + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_DEFAULT_DOMAIN_NAME_TXT), + domain_name); + } + } + + /* Check if we got a DNS server table to use. */ + if(configure_dynamic && aam->aam_DNSTable != NULL) + { + LONG i; + + for(i = 0 ; i < aam->aam_DNSTableSize ; i++) + { + if(aam->aam_DNSTable[i] != 0) + { + UBYTE str[20]; + LONG error = OK; + STRPTR code = NULL; + + strcpy(str,Inet_NtoA(aam->aam_DNSTable[i])); + + if(AddDomainNameServer(str) != OK) + get_errno_and_code(cc,&error,&code); + + /* Say what we did. */ + if(error == OK && NOT cc->cc_Quiet) + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_DNS_TXT),str); + + if(error != OK) + { + if(NOT cc->cc_Quiet) + { + LONG message_code; + + if(code != NULL && error > 0) + message_code = MSG_ADDNETINTERFACE_COULD_NOT_ADD_DNS_ERROR_CODE_TXT; + else + message_code = MSG_ADDNETINTERFACE_COULD_NOT_ADD_DNS_TXT; + + error_printf(cc,get_str(cc,message_code),str,code); + } + + goto out; + } + } + } + } + + /* If we received a lease from a DHCP server, say how long it will last. */ + if((configure_dynamic || want_address) && aam->aam_Protocol == AAMP_DHCP && NOT cc->cc_Quiet) + { + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_ADDRESS_TXT), + interface_name,address); + + if(cc->cc_LeaseExpires.ds_Days == 0 && + cc->cc_LeaseExpires.ds_Minute == 0 && + cc->cc_LeaseExpires.ds_Tick == 0) + { + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_LEASED_PERMANENTLY_TXT)); + } + else + { + struct DateTime dat; + UBYTE date[LEN_DATSTRING+1]; + UBYTE time[LEN_DATSTRING+1]; + + memset(&dat,0,sizeof(dat)); + + dat.dat_Stamp = cc->cc_LeaseExpires; + dat.dat_Format = FORMAT_DEF; + dat.dat_StrDate = date; + dat.dat_StrTime = time; + + DateToStr(&dat); + + strip_extra_blank_spaces(date); + strip_extra_blank_spaces(time); + + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_LEASED_UNTIL_TXT), + date,time); + } + } + } + + /* Finally, try to add alias addresses for this interface. */ + if(NOT IsListEmpty(&alias_list)) + { + for(node = alias_list.lh_Head ; + node->ln_Succ != NULL ; + node = node->ln_Succ) + { + if(Local_ConfigureInterfaceTags(cc,interface_name, + IFC_AddAliasAddress,node->ln_Name, + TAG_DONE) != 0) + { + if(NOT cc->cc_Quiet) + { + LONG message_code; + LONG errno; + STRPTR code; + + get_errno_and_code(cc,&errno,&code); + + if(code != NULL && errno > 0) + message_code = MSG_ADDNETINTERFACE_COULD_NOT_ADD_ALIAS_ERROR_CODE_TXT; + else + message_code = MSG_ADDNETINTERFACE_COULD_NOT_ADD_ALIAS_TXT; + + error_printf(cc,get_str(cc,message_code),interface_name,node->ln_Name,code); + } + + goto out; + } + + /* Say what we did. */ + if(NOT cc->cc_Quiet) + info_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_ALIAS_TXT),node->ln_Name); + } + } + } + + result = RETURN_OK; + + out: + + /* Clean up the lot... */ + while((node = RemHead(&alias_list)) != NULL) + FreeVec(node); + + FreeVec(client_id); + FreeVec(address); + FreeVec(net_mask); + FreeVec(broadcast_address); + FreeVec(destination_address); + + FreeVec(device_name); + + FreeVec(hardware_address); + FreeVec(iha.iha_Address); + + if(cc->cc_File != ZERO) + { + Close(cc->cc_File); + cc->cc_File = ZERO; + } + + return(result); +} + +/****************************************************************************/ + +/* Try to convert an IP address specification into a number an complain + if that doesn't work. */ +STATIC BOOL +validate_ip_address(struct CommandContext * cc,STRPTR key,STRPTR address,LONG line_number,STRPTR file) +{ + DECLARE_SOCKETBASE(cc); + + struct in_addr in; + BOOL result; + + if(inet_aton(address,&in)) + { + result = TRUE; + } + else + { + if(NOT cc->cc_Quiet) + error_printf(cc,get_str(cc,MSG_ADDNETINTERFACE_INVALID_IP_ADDRESS_AT_TXT),key,address,line_number,file); + + result = FALSE; + } + + return(result); +} + +/****************************************************************************/ + +/* Get the error message text corresponding to an error number. */ +STATIC VOID +get_errno_and_code(struct CommandContext * cc,LONG * errno_ptr,STRPTR * code_ptr) +{ + LONG errno = 0; + LONG code; + + Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_ERRNO),&errno, + TAG_END); + + code = errno; + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_ERRNOSTRPTR),&code, + TAG_END) != 0) + { + code = 0; + } + + (*errno_ptr) = errno; + (*code_ptr) = (STRPTR)code; +} + +/****************************************************************************/ + +/* Check if part of a string matches a shorter string. */ +STATIC BOOL +substring_matches(struct CommandContext * cc,STRPTR pattern,STRPTR string) +{ + DECLARE_UTILITYBASE(cc); + + BOOL result = FALSE; + LONG i,len,pattern_len; + + len = strlen(string); + pattern_len = strlen(pattern); + + for(i = 0 ; i <= len - pattern_len ; i++) + { + if(Strnicmp(&string[len],pattern,pattern_len) == SAME) + { + result = TRUE; + break; + } + } + + return(result); +} + +/****************************************************************************/ + +/* Add a new interface node to the list, sorting its contents by priority + and name. The list is sorted by descending priority, and where the priority + is identical, by name (in lexical order). */ +STATIC VOID +add_interface_node(struct CommandContext * cc,struct List * list,struct Node * new_node) +{ + DECLARE_UTILITYBASE(cc); + DECLARE_DOSBASE(cc); + + struct Node * list_node; + + /* Find a node on the list that's "larger" than the node + we are about to add. */ + for(list_node = list->lh_Head ; + list_node->ln_Succ != NULL ; + list_node = list_node->ln_Succ) + { + if((list_node->ln_Pri < new_node->ln_Pri) || (list_node->ln_Pri == new_node->ln_Pri && Stricmp(FilePart(list_node->ln_Name),FilePart(new_node->ln_Name)) > 0)) + break; + } + + /* Now insert the new node in the right position, + in front of the list node found above. */ + new_node->ln_Succ = (struct Node *)list_node; + new_node->ln_Pred = (struct Node *)list_node->ln_Pred; + + list_node->ln_Pred = (struct Node *)new_node; + new_node->ln_Pred->ln_Succ = (struct Node *)new_node; +} + +/****************************************************************************/ + +/* Print an error message or show an error requester instead. */ +STATIC VOID VARARGS68K +error_printf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + DECLARE_SYSBASE(cc); + DECLARE_INTUITIONBASE(cc); + + va_list args; + + if(cc->cc_StartupMessage == NULL) + { + STRPTR program_name = cc->cc_ProgramName; + BPTR fh; + + /* Try to use the error output stream associated with the shell. */ + #if defined(__amigaos4__) + { + fh = ErrorOutput(); + } + #else + { + struct Process * this_process = (struct Process *)FindTask(NULL); + + fh = this_process->pr_CES; + } + #endif /* __amigaos4__ */ + + if(fh == ZERO) + fh = Output(); + + VFPrintf(fh,"%s: ",&program_name); + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + VFPrintf(fh,format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + VFPrintf(fh,format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + VFPrintf(fh,"\n",NULL); + } + else + { + if(IntuitionBase != NULL) + { + struct EasyStruct es; + + memset(&es,0,sizeof(es)); + + es.es_StructSize = sizeof(es); + es.es_Title = get_str(cc,MSG_ADDNETINTERFACE_ERROR_MESSAGE_TITLE_TXT); + es.es_TextFormat = format; + es.es_GadgetFormat = get_str(cc,MSG_ADDNETINTERFACE_ERROR_MESSAGE_BUTTON_LABEL_TXT); + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + EasyRequestArgs(NULL,&es,NULL,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + EasyRequestArgs(NULL,&es,NULL,args); + va_end(args); + } + #endif /* __amigaos4__ */ + } + } +} + +/****************************************************************************/ + +/* Print a warning message in the shell window. */ +STATIC VOID VARARGS68K +warning_printf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + + if(cc->cc_StartupMessage == NULL) + { + STRPTR program_name = cc->cc_ProgramName; + va_list args; + + VPrintf("%s: ",&program_name); + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + VPrintf(format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + VPrintf(format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + VPrintf("\n",NULL); + } +} + +/****************************************************************************/ + +/* Print an informational message in the shell window. */ +STATIC VOID VARARGS68K +info_printf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + + if(cc->cc_StartupMessage == NULL) + { + va_list args; + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + VPrintf(format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + VPrintf(format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + } +} + +/****************************************************************************/ + +/* Print an error string in the shell window; this is supposed to be + an informational message only. */ +STATIC VOID +info_print_fault(struct CommandContext * cc,LONG code) +{ + DECLARE_DOSBASE(cc); + + if(cc->cc_StartupMessage == NULL) + { + UBYTE str[100]; + + Fault(code,NULL,str,sizeof(str)); + + info_printf(cc,"%s: %s\n",cc->cc_ProgramName,str); + } +} + +/****************************************************************************/ + +/* Print an error string in the shell window, corresponding to a code. */ +STATIC VOID +error_print_fault(struct CommandContext * cc,LONG code) +{ + DECLARE_DOSBASE(cc); + + if(cc->cc_StartupMessage == NULL) + { + PrintFault(code,cc->cc_ProgramName); + } + else + { + UBYTE str[100]; + + Fault(code,NULL,str,sizeof(str)); + + error_printf(cc,"%s",str); + } +} + +/****************************************************************************/ + +/* Print an error string in the shell window, corresponding to a code, using + a special prefix. */ +STATIC VOID +error_print_fault_prefix(struct CommandContext * cc,LONG code,STRPTR prefix) +{ + DECLARE_DOSBASE(cc); + + if(cc->cc_StartupMessage == NULL) + { + PrintFault(code,prefix); + } + else + { + UBYTE str[100]; + + Fault(code,NULL,str,sizeof(str)); + + error_printf(cc,"%s: %s",prefix,str); + } +} + +/****************************************************************************/ + +/* This looks up a locale string ID in the builtin database; adapted + from CygnusEd because I couldn't find my own implementation for this + application... */ +STATIC STRPTR +get_builtin_str(LONG id) +{ + LONG top,middle,bottom; + STRPTR builtin_string; + + /* The search area is all those message between bottom and top, inclusive. */ + bottom = 0; + top = NUM_ENTRIES(CatCompArray) - 1; + + /* Binary search through the CatCompArray to find the requested string. + Note that this assumes that the strings are sorted. Catcomp defaults + to creating sorted arrays, but it does _not_ force it. If in the .cd + file you specify out of order string numbers this routine will fail. */ + while(bottom != top) + { + middle = (bottom + top) / 2; + + if(CatCompArray[middle].cca_ID >= id) + top = middle; + else + bottom = middle + 1; + } + + /* The only time this error message should occur is if you've passed + a garbage number OR if the CatCompArray is not sorted. */ + if(CatCompArray[bottom].cca_ID == id) + builtin_string = (STRPTR)CatCompArray[bottom].cca_Str; + else + builtin_string = ""; + + return(builtin_string); +} + +STATIC STRPTR +get_str(struct CommandContext * cc, LONG id) +{ + DECLARE_LOCALEBASE(cc); + + STRPTR builtin_string; + STRPTR result; + + builtin_string = get_builtin_str(id); + + if(cc->cc_Catalog != NULL) + result = (STRPTR)GetCatalogStr(cc->cc_Catalog,id,builtin_string); + else + result = builtin_string; + + return(result); +} + +/****************************************************************************/ + +/* The following are varargs stubs for several bsdsocket.library routines + which are necessary for the 68k GCC build. */ +STATIC LONG VARARGS68K +Local_ConfigureInterfaceTags(struct CommandContext * cc,STRPTR interface_name,...) +{ + DECLARE_SOCKETBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,interface_name); + result = ConfigureInterfaceTagList(interface_name,va_getlinearva(args,struct TagItem *)); + va_end(args); + } + #else + { + va_start(args,interface_name); + result = ConfigureInterfaceTagList(interface_name,(struct TagItem *)args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +STATIC LONG VARARGS68K +Local_SocketBaseTags(struct CommandContext * cc,...) +{ + DECLARE_SOCKETBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,cc); + result = SocketBaseTagList(va_getlinearva(args,struct TagItem *)); + va_end(args); + } + #else + { + va_start(args,cc); + result = SocketBaseTagList((struct TagItem *)args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +STATIC LONG VARARGS68K +Local_AddRouteTags(struct CommandContext * cc,...) +{ + DECLARE_SOCKETBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,cc); + result = AddRouteTagList(va_getlinearva(args,struct TagItem *)); + va_end(args); + } + #else + { + va_start(args,cc); + result = AddRouteTagList((struct TagItem *)args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} diff --git a/examples/AddNetInterface_rev.h b/examples/AddNetInterface_rev.h new file mode 100644 index 0000000..6b9661e --- /dev/null +++ b/examples/AddNetInterface_rev.h @@ -0,0 +1,6 @@ +#define VERSION 4 +#define REVISION 53 +#define DATE "12.12.2015" +#define VERS "AddNetInterface 4.53" +#define VSTRING "AddNetInterface 4.53 (12.12.2015)\r\n" +#define VERSTAG "\0$VER: AddNetInterface 4.53 (12.12.2015)" diff --git a/examples/AddNetRoute.c b/examples/AddNetRoute.c new file mode 100644 index 0000000..6e0f491 --- /dev/null +++ b/examples/AddNetRoute.c @@ -0,0 +1,953 @@ +/* + * $Id: AddNetRoute.c,v 1.11 2007-08-26 12:30:15 obarthel Exp $ + * + * :ts=4 + * + * Copyright © 2001-2007 by Olaf Barthel. All Rights Reserved. + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +/****************************************************************************/ + +#if defined(__amigaos4__) +#include +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +#if !defined(__amigaos4__) +#define NO_INLINE_STDARG +#endif /* __amigaos4__ */ + +#define __NOLIBBASE__ +#define __NOGLOBALIFACE__ +#define __USE_INLINE__ + +/****************************************************************************/ + +#include +#include +#include +#include + +/****************************************************************************/ + +#include +#include + +/****************************************************************************/ + +#include "AddNetRoute_rev.h" + +/****************************************************************************/ + +#include "macros.h" + +/****************************************************************************/ + +#ifndef AbsExecBase +#define AbsExecBase (*(struct ExecBase **)4) +#endif /* AbsExecBase */ + +/****************************************************************************/ + +typedef LONG * NUMBER; +typedef LONG SWITCH; +typedef STRPTR KEY; + +/****************************************************************************/ + +struct CommandContext +{ + struct Library * cc_SysBase; + struct Library * cc_DOSBase; + struct Library * cc_LocaleBase; + struct Library * cc_SocketBase; + + #if defined(__amigaos4__) + + /************************************************************************/ + + struct ExecIFace * cc_IExec; + struct DOSIFace * cc_IDOS; + struct LocaleIFace * cc_ILocale; + struct SocketIFace * cc_ISocket; + + /************************************************************************/ + + #endif /* __amigaos4__ */ + + struct Catalog * cc_Catalog; + UBYTE cc_ProgramName[256]; + struct TagItem * cc_Tags; + LONG cc_NumTags; + LONG cc_MaxTags; +}; + +/****************************************************************************/ + +#if defined(__amigaos4__) + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct ExecIFace * IExec = cc->cc_IExec; \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct DOSIFace * IDOS = cc->cc_IDOS; \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_LOCALEBASE(cc) \ + struct LocaleIFace * ILocale = cc->cc_ILocale; \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct SocketIFace * ISocket = cc->cc_ISocket; \ + struct Library * SocketBase = cc->cc_SocketBase + +/****************************************************************************/ + +#else + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_LOCALEBASE(cc) \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct Library * SocketBase = cc->cc_SocketBase + +/****************************************************************************/ + +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +LONG _start(VOID); + +/****************************************************************************/ + +STATIC VOID close_libs(struct CommandContext *cc); +STATIC LONG open_libs(struct CommandContext *cc, struct Library *SysBase); +STATIC LONG cmd(struct CommandContext *cc); +STATIC LONG add_tag(struct CommandContext *cc, Tag tag, ULONG data); +STATIC LONG Local_Printf(struct CommandContext *cc, STRPTR format, ...); +STATIC LONG VARARGS68K Local_ErrorPrintf(struct CommandContext *cc, STRPTR format, ...); +STATIC STRPTR get_builtin_str(LONG id); +STATIC STRPTR get_str(struct CommandContext *cc, LONG id); +STATIC LONG VARARGS68K Local_SocketBaseTags(struct CommandContext *cc, ...); + +/****************************************************************************/ + +/****** ROADSHOW/ADDNETROUTE ************************************************** +* +* NAME +* AddNetRoute - Add message routing paths. +* +* FORMAT +* AddNetRoute [QUIET] [DESTINATION=] [HOSTDESTINATION=] +* [NETDESTINATION=] [GATEWAY=] [DEFAULTGATEWAY=] +* +* TEMPLATE +* QUIET/S,DST=DESTINATION/K,HOSTDST=HOSTDESTINATION/K, +* NETDST=NETDESTINATION/K,VIA=GATEWAY/K,DEFAULT=DEFAULTGATEWAY/K +* +* PATH +* C:ADDNETROUTE +* +* FUNCTION +* ADDNETROUTE allows to define routes to hosts or networks via an +* interface. +* +* OPTIONS +* QUIET/S +* This option causes the program not to emit any error messages +* or progress reports. Also, if the program encounters an error +* it will flag this as failure code 5 which can be looked at +* using the "if warn" shell script command. If this option is +* not in effect, failure codes will be more severe and all sorts +* of progress information will be displayed. +* +* DST=DESTINATION/K +* The destination address of a route (or in other words, where +* the route to be added leads to). This must be an IP address +* or a symbolic name. Some routes may require you to specify +* a gateway address through which the route has to pass. +* Depending upon the address you specify, the protocol stack +* will attempt to figure out whether the destination is +* supposed to be a host or a network. +* +* HOSTDST=HOSTDESTINATION/K +* Same as the "DST=DESTINATION/K" parameter, except that the +* destination is assumed to be a host (rather than a network). +* +* NETDST=NETDESTINATION/K +* Same as the "DST=DESTINATION/K" parameter, except that the +* destination is assumed to be a network (rather than a host). +* +* VIA=GATEWAY/K +* This parameter complements the route destination address; +* it indicates the address to which a message should be sent +* for it to be passed to the destination. This must be an IP +* address or a symbolic name. +* +* DEFAULT=DEFAULTGATEWAY/K +* This parameter selects the default gateway address (which +* must be specified as an IP address or a symbolic host name) +* all messages are sent to which don't have any particular +* other routes associated with them. +* Another, perhaps less misleading name for "default gateway +* address" is "default route". +* +* NOTES +* The command is similar to the Unix "route" command. +* +* If you use the "DEFAULT=DEFAULTGATEWAY/K" parameter, all +* other destination addresses you may have specified will be +* ignored. Only one of "DESTINATION", "HOSTDESTINATION" or +* "NETDESTINATION" will be used; choose only one. Before you add +* a new default gateway you should delete the old one or you'll +* get an error message instead. +* +* EXAMPLES +* Define a route to the host 192.168.10.12 through a +* gateway at 192.168.1.1 +* +* 1> ADDNETROUTE HOSTDESTINATION 192.168.10.12 VIA 192.168.1.1 +* +* SEE ALSO +* DeleteNetRoute +* +****************************************************************************** +*/ +LONG +_start(VOID) +{ + struct Library *SysBase = (struct Library *)AbsExecBase; + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + struct CommandContext _cc,*cc = &_cc; + LONG result = RETURN_FAIL; + struct Process * pr; + LONG error; + + memset(cc,0,sizeof(*cc)); + + pr = (struct Process *)FindTask(NULL); + if(pr->pr_CLI == ZERO) + { + struct MsgPort * mp = &pr->pr_MsgPort; + struct Message * mn; + + WaitPort(mp); + mn = GetMsg(mp); + + Forbid(); + ReplyMsg(mn); + goto out; + } + + error = open_libs(cc,SysBase); + if(error == OK) + { + DECLARE_LOCALEBASE(cc); + + if(cc->cc_LocaleBase != NULL) + cc->cc_Catalog = OpenCatalogA(NULL,"roadshow.catalog",NULL); + + result = cmd(cc); + + if(cc->cc_Tags != NULL) + FreeVec(cc->cc_Tags); + + if(cc->cc_Catalog != NULL) + CloseCatalog(cc->cc_Catalog); + } + else + { + pr->pr_Result2 = error; + } + + close_libs(cc); + + out: + + return(result); +} + +/****************************************************************************/ + +STATIC VOID +close_libs(struct CommandContext * cc) +{ + DECLARE_SYSBASE(cc); + + #if defined(__amigaos4__) + { + if(cc->cc_IDOS != NULL) + DropInterface((struct Interface *)cc->cc_IDOS); + + if(cc->cc_ILocale != NULL) + DropInterface((struct Interface *)cc->cc_ILocale); + + if(cc->cc_ISocket != NULL) + DropInterface((struct Interface *)cc->cc_ISocket); + } + #endif /* __amigaos4__ */ + + if(cc->cc_SocketBase != NULL) + CloseLibrary(cc->cc_SocketBase); + + if(cc->cc_LocaleBase != NULL) + CloseLibrary(cc->cc_LocaleBase); + + if(cc->cc_DOSBase != NULL) + CloseLibrary(cc->cc_DOSBase); +} + +/****************************************************************************/ + +STATIC LONG +open_libs(struct CommandContext * cc,struct Library *SysBase) +{ + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + LONG error; + + cc->cc_SysBase = SysBase; + + #if defined(__amigaos4__) + { + cc->cc_IExec = IExec; + } + #endif /* __amigaos4__ */ + + cc->cc_DOSBase = OpenLibrary("dos.library",36); + + #if defined(__amigaos4__) + { + if(cc->cc_DOSBase != NULL) + { + cc->cc_IDOS = (struct DOSIFace *)GetInterface(cc->cc_DOSBase, "main", 1, 0); + if(cc->cc_IDOS == NULL) + { + CloseLibrary(cc->cc_DOSBase); + cc->cc_DOSBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + if(cc->cc_DOSBase == NULL) + { + error = ERROR_INVALID_RESIDENT_LIBRARY; + goto out; + } + + cc->cc_LocaleBase = OpenLibrary("locale.library",38); + + #if defined(__amigaos4__) + { + if(cc->cc_LocaleBase != NULL) + { + cc->cc_ILocale = (struct LocaleIFace *)GetInterface(cc->cc_LocaleBase, "main", 1, 0); + if(cc->cc_ILocale == NULL) + { + CloseLibrary(cc->cc_LocaleBase); + cc->cc_LocaleBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + /* The following may be necessary to flush out an inoperable + bsdsocket.library which reached the end of the shutdown + process. */ + #if 1 + { + struct ExecBase * ex = (struct ExecBase *)SysBase; + struct Library * lib; + + Forbid(); + + lib = (struct Library *)FindName(&ex->LibList,"bsdsocket.library"); + if(lib != NULL) + RemLibrary(lib); + + Permit(); + } + #endif + + cc->cc_SocketBase = OpenLibrary("bsdsocket.library",4); + + #if defined(__amigaos4__) + { + if(cc->cc_SocketBase != NULL) + { + cc->cc_ISocket = (struct SocketIFace *)GetInterface(cc->cc_SocketBase, "main", 1, 0); + if(cc->cc_ISocket == NULL) + { + CloseLibrary(cc->cc_SocketBase); + cc->cc_SocketBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + error = OK; + + out: + + return(error); +} + +/****************************************************************************/ + +#define CATCOMP_ARRAY +#define ADDNETROUTE_CATALOG_STRINGS +#include "roadshow.h" + +/****************************************************************************/ + +STATIC LONG +cmd(struct CommandContext * cc) +{ + struct + { + SWITCH Quiet; + KEY Destination; + KEY DestinationHost; + KEY DestinationNet; + KEY Gateway; + KEY DefaultGateway; + } args; + + STRPTR args_template = + "QUIET/S," + "DST=DESTINATION/K," + "HOSTDST=HOSTDESTINATION/K," + "NETDST=NETDESTINATION/K," + "VIA=GATEWAY/K," + "DEFAULT=DEFAULTGATEWAY/K" + VERSTAG; + + DECLARE_DOSBASE(cc); + DECLARE_SOCKETBASE(cc); + + LONG result = RETURN_FAIL; + LONG have_routing_api = FALSE; + struct RDArgs * rda; + LONG error; + BOOL quiet = FALSE; + + GetProgramName(cc->cc_ProgramName,sizeof(cc->cc_ProgramName)); + + memset(&args,0,sizeof(args)); + + rda = ReadArgs(args_template,(LONG *)&args,NULL); + if(rda == NULL) + { + PrintFault(IoErr(),cc->cc_ProgramName); + goto out; + } + + quiet = (BOOL)(args.Quiet != 0); + + if(SocketBase == NULL) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_CANNOT_OPEN_BSDSOCKET_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_HAVE_ROUTING_API),&have_routing_api, + TAG_END) != 0) + { + have_routing_api = FALSE; + } + + if(NOT have_routing_api) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_BSDSOCKET_HAS_NO_ROUTE_API_TXT), + cc->cc_ProgramName, SocketBase->lib_Node.ln_Name, SocketBase->lib_Version, SocketBase->lib_Revision); + } + + goto out; + } + + if(args.DefaultGateway != NULL) + { + error = add_tag(cc,RTA_DefaultGateway,(ULONG)args.DefaultGateway); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_NO_MEMORY_FOR_DEFAULT_GATEWAY_TXT), + cc->cc_ProgramName,args.DefaultGateway); + } + + goto out; + } + + if(NOT quiet) + { + if(args.Destination != NULL) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_DESTINATION_IGNORED_TXT), + cc->cc_ProgramName,args.Destination); + } + + if(args.DestinationHost != NULL) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_HOSTDESTINATION_IGNORED_TXT), + cc->cc_ProgramName,args.DestinationHost); + } + + if(args.DestinationNet != NULL) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_NETDESTINATION_IGNORED_TXT), + cc->cc_ProgramName,args.DestinationNet); + } + + if(args.Gateway != NULL) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_GATEWAY_IGNORED_TXT), + cc->cc_ProgramName,args.Gateway); + } + } + } + else if (args.Gateway != NULL) + { + STRPTR dst; + + if(args.Destination != NULL) + dst = args.Destination; + else if (args.DestinationHost != NULL) + dst = args.DestinationHost; + else if (args.DestinationNet != NULL) + dst = args.DestinationNet; + else + dst = NULL; + + if(dst == NULL) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_GATEWAY_NEEDS_DESTINATION_TXT), + cc->cc_ProgramName,args.Gateway); + } + + goto out; + } + + error = add_tag(cc,RTA_Gateway,(ULONG)args.Gateway); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_GATEWAY_TXT), + cc->cc_ProgramName,args.Gateway); + } + + goto out; + } + } + else + { + PrintFault(ERROR_REQUIRED_ARG_MISSING,cc->cc_ProgramName); + goto out; + } + + if(args.Destination != NULL) + { + error = add_tag(cc,RTA_Destination,(ULONG)args.Destination); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_ROUTE_TXT), + cc->cc_ProgramName,args.Destination); + } + + goto out; + } + + if(NOT quiet && args.DestinationHost != NULL) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_HOSTDESTINATION_IGNORED_TXT), + cc->cc_ProgramName,args.DestinationHost); + } + + if(NOT quiet && args.DestinationNet != NULL) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_NETDESTINATION_IGNORED_TXT), + cc->cc_ProgramName,args.DestinationNet); + } + } + else if (args.DestinationHost != NULL) + { + error = add_tag(cc,RTA_DestinationHost,(ULONG)args.DestinationHost); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_ROUTE_TO_HOST_TXT), + cc->cc_ProgramName,args.Destination); + } + + goto out; + } + + if(NOT quiet && args.DestinationNet != NULL) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_NETDESTINATION_IGNORED_TXT), + cc->cc_ProgramName,args.DestinationNet); + } + } + else if (args.DestinationNet != NULL) + { + error = add_tag(cc,RTA_DestinationNet,(ULONG)args.DestinationNet); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_ROUTE_TO_NET_TXT), + cc->cc_ProgramName,args.Destination); + } + + goto out; + } + } + + if(cc->cc_NumTags > 0) + { + error = add_tag(cc,TAG_END,0); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_TO_ADD_ROUTE_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + if(AddRouteTagList(cc->cc_Tags) != OK) + { + if(NOT quiet) + { + LONG errno = 0; + LONG code; + + Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_ERRNO),&errno, + TAG_END); + + code = errno; + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_ERRNOSTRPTR),&code, + TAG_END) != 0) + { + code = 0; + } + + Local_ErrorPrintf(cc,get_str(cc,MSG_ADDNETROUTE_COULD_NOT_ADD_ROUTE_TXT), + cc->cc_ProgramName); + + if(code > 0 && errno > 0) + Local_ErrorPrintf(cc," (%s)",code); + + Local_ErrorPrintf(cc,".\n"); + } + + goto out; + } + + if(NOT quiet) + { + STRPTR prefix = ""; + + Local_Printf(cc,get_str(cc,MSG_ADDNETROUTE_ROUTE_ADDED_TXT), + cc->cc_ProgramName); + + if(args.DefaultGateway != NULL) + { + Local_Printf(cc,get_str(cc,MSG_ADDNETROUTE_DEFAULT_GATEWAY_TXT),prefix,args.DefaultGateway); + prefix = ", "; + } + + if(args.Destination != NULL) + { + Local_Printf(cc,get_str(cc,MSG_ADDNETROUTE_DESTINATION_TXT),prefix,args.Destination); + prefix = ", "; + } + + if(args.DestinationHost != NULL) + { + Local_Printf(cc,get_str(cc,MSG_ADDNETROUTE_DESTINATION_HOST_TXT),prefix,args.DestinationHost); + prefix = ", "; + } + + if(args.DestinationNet != NULL) + Local_Printf(cc,get_str(cc,MSG_ADDNETROUTE_DESTINATION_NET_TXT),prefix,args.DestinationNet); + + if(args.Gateway != NULL) + Local_Printf(cc,get_str(cc,MSG_ADDNETROUTE_VIA_GATEWAY_TXT),prefix,args.Gateway); + + Local_Printf(cc,").\n"); + } + } + + result = RETURN_OK; + + out: + + if(quiet && result != RETURN_OK) + result = RETURN_WARN; + + if(rda != NULL) + FreeArgs(rda); + + return(result); +} + +/****************************************************************************/ + +STATIC LONG +add_tag(struct CommandContext * cc,Tag tag,ULONG data) +{ + DECLARE_SYSBASE(cc); + + LONG error = OK; + LONG which = -1; + LONG i; + + for(i = 0 ; i < cc->cc_NumTags ; i++) + { + if(cc->cc_Tags[i].ti_Tag == tag) + { + which = i; + break; + } + } + + if(which == -1 && cc->cc_NumTags + 1 >= cc->cc_MaxTags) + { + struct TagItem * new_tags; + + new_tags = AllocVec(sizeof(*new_tags) * (cc->cc_MaxTags+10),MEMF_ANY|MEMF_PUBLIC); + if(new_tags == NULL) + { + error = ERROR_NO_FREE_STORE; + goto out; + } + + if(cc->cc_Tags != NULL) + CopyMem(cc->cc_Tags,new_tags,sizeof(*new_tags) * cc->cc_NumTags); + + FreeVec(cc->cc_Tags); + cc->cc_Tags = new_tags; + cc->cc_MaxTags += 10; + } + + if(which == -1) + which = cc->cc_NumTags++; + + cc->cc_Tags[which].ti_Tag = tag; + cc->cc_Tags[which].ti_Data = data; + + out: + + return(error); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_Printf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + result = VPrintf(format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + result = VPrintf(format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_ErrorPrintf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + DECLARE_SYSBASE(cc); + + va_list args; + LONG result; + BPTR fh; + + #if defined(__amigaos4__) + { + fh = ErrorOutput(); + } + #else + { + struct Process * this_process = (struct Process *)FindTask(NULL); + + fh = this_process->pr_CES; + } + #endif /* __amigaos4__ */ + + if(fh == ZERO) + fh = Output(); + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + result = VFPrintf(fh,format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + result = VFPrintf(fh,format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +/****************************************************************************/ + +/* This looks up a locale string ID in the builtin database; adapted + from CygnusEd because I couldn't find my own implementation for this + application... */ +STATIC STRPTR +get_builtin_str(LONG id) +{ + LONG top,middle,bottom; + STRPTR builtin_string; + + /* The search area is all those message between bottom and top, inclusive. */ + bottom = 0; + top = NUM_ENTRIES(CatCompArray) - 1; + + /* Binary search through the CatCompArray to find the requested string. + Note that this assumes that the strings are sorted. Catcomp defaults + to creating sorted arrays, but it does _not_ force it. If in the .cd + file you specify out of order string numbers this routine will fail. */ + while(bottom != top) + { + middle = (bottom + top) / 2; + + if(CatCompArray[middle].cca_ID >= id) + top = middle; + else + bottom = middle + 1; + } + + /* The only time this error message should occur is if you've passed + a garbage number OR if the CatCompArray is not sorted. */ + if(CatCompArray[bottom].cca_ID == id) + builtin_string = (STRPTR)CatCompArray[bottom].cca_Str; + else + builtin_string = ""; + + return(builtin_string); +} + +STATIC STRPTR +get_str(struct CommandContext * cc, LONG id) +{ + STRPTR builtin_string; + STRPTR result; + + builtin_string = get_builtin_str(id); + + if(cc->cc_Catalog != NULL) + { + DECLARE_LOCALEBASE(cc); + + result = (STRPTR)GetCatalogStr(cc->cc_Catalog,id,builtin_string); + } + else + { + result = builtin_string; + } + + return(result); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_SocketBaseTags(struct CommandContext * cc,...) +{ + DECLARE_SOCKETBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,cc); + result = SocketBaseTagList(va_getlinearva(args,struct TagItem *)); + va_end(args); + } + #else + { + va_start(args,cc); + result = SocketBaseTagList((struct TagItem *)args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} diff --git a/examples/AddNetRoute_rev.h b/examples/AddNetRoute_rev.h new file mode 100644 index 0000000..57ae1e5 --- /dev/null +++ b/examples/AddNetRoute_rev.h @@ -0,0 +1,6 @@ +#define VERSION 4 +#define REVISION 8 +#define DATE "11.3.2009" +#define VERS "AddNetRoute 4.8" +#define VSTRING "AddNetRoute 4.8 (11.3.2009)\r\n" +#define VERSTAG "\0$VER: AddNetRoute 4.8 (11.3.2009)" diff --git a/examples/ConfigureNetInterface.c b/examples/ConfigureNetInterface.c new file mode 100644 index 0000000..9f632a6 --- /dev/null +++ b/examples/ConfigureNetInterface.c @@ -0,0 +1,2374 @@ +/* + * $Id: ConfigureNetInterface.c,v 1.17 2007-08-26 12:30:15 obarthel Exp $ + * + * :ts=4 + * + * Copyright © 2001-2007 by Olaf Barthel. All Rights Reserved. + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +/****************************************************************************/ + +#if defined(__amigaos4__) +#include +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +#if !defined(__amigaos4__) +#define NO_INLINE_STDARG +#endif /* __amigaos4__ */ + +#define __NOLIBBASE__ +#define __NOGLOBALIFACE__ +#define __USE_INLINE__ + +/****************************************************************************/ + +#include +#include +#include +#include +#include + +/****************************************************************************/ + +#if defined(__amigaos4__) && !defined(Flush) +#define Flush(fh) FFlush(fh) +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +#include +#include + +/****************************************************************************/ + +#include "macros.h" + +/****************************************************************************/ + +#include "ConfigureNetInterface_rev.h" + +/****************************************************************************/ + +#ifndef AbsExecBase +#define AbsExecBase (*(struct ExecBase **)4) +#endif /* AbsExecBase */ + +/****************************************************************************/ + +#ifndef FORMAT_DEF +#define FORMAT_DEF 4 +#endif /* FORMAT_DEF */ + +/****************************************************************************/ + +typedef LONG * NUMBER; +typedef LONG SWITCH; +typedef STRPTR KEY; + +/****************************************************************************/ + +struct CommandContext +{ + struct Library * cc_SysBase; + struct Library * cc_DOSBase; + struct Library * cc_UtilityBase; + struct Library * cc_LocaleBase; + struct Library * cc_SocketBase; + + #if defined(__amigaos4__) + + /************************************************************************/ + + struct ExecIFace * cc_IExec; + struct DOSIFace * cc_IDOS; + struct UtilityIFace * cc_IUtility; + struct LocaleIFace * cc_ILocale; + struct SocketIFace * cc_ISocket; + + /************************************************************************/ + + #endif /* __amigaos4__ */ + + struct Catalog * cc_Catalog; + UBYTE cc_ProgramName[256]; + struct TagItem * cc_Tags; + LONG cc_NumTags; + LONG cc_MaxTags; + struct MsgPort * cc_ReplyPort; + struct AddressAllocationMessage + cc_AllocationMessage; + ULONG cc_RouterTable[16]; + ULONG cc_DNSTable[16]; + struct DateStamp cc_LeaseExpires; +}; + +/****************************************************************************/ + +#if defined(__amigaos4__) + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct ExecIFace * IExec = cc->cc_IExec; \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct DOSIFace * IDOS = cc->cc_IDOS; \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_UTILITYBASE(cc) \ + struct UtilityIFace * IUtility = cc->cc_IUtility; \ + struct Library * UtilityBase = cc->cc_UtilityBase + +#define DECLARE_LOCALEBASE(cc) \ + struct LocaleIFace * ILocale = cc->cc_ILocale; \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct SocketIFace * ISocket = cc->cc_ISocket; \ + struct Library * SocketBase = cc->cc_SocketBase + +/****************************************************************************/ + +#else + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_UTILITYBASE(cc) \ + struct Library * UtilityBase = cc->cc_UtilityBase + +#define DECLARE_LOCALEBASE(cc) \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct Library * SocketBase = cc->cc_SocketBase + +/****************************************************************************/ + +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +LONG _start(VOID); + +/****************************************************************************/ + +STATIC VOID close_libs(struct CommandContext *cc); +STATIC LONG open_libs(struct CommandContext *cc, struct Library *SysBase); +STATIC LONG cmd(struct CommandContext *cc); +STATIC BOOL validate_ip_address(struct CommandContext *cc, BOOL quiet, STRPTR key, STRPTR address); +STATIC LONG add_tag(struct CommandContext *cc, Tag tag, ULONG data); +STATIC VOID get_errno_and_code(struct CommandContext *cc, LONG *errno_ptr, STRPTR *code_ptr); +STATIC BOOL substring_matches(struct CommandContext *cc, STRPTR pattern, STRPTR string); +STATIC BOOL is_blank_space(UBYTE c); +STATIC VOID strip_extra_blank_spaces(STRPTR s); +STATIC LONG VARARGS68K Local_Printf(struct CommandContext *cc, STRPTR format, ...); +STATIC VOID Local_PrintFault(struct CommandContext *cc, LONG error, STRPTR prefix); +STATIC LONG VARARGS68K Local_ErrorPrintf(struct CommandContext *cc, STRPTR format, ...); +STATIC STRPTR get_builtin_str(LONG id); +STATIC STRPTR get_str(struct CommandContext *cc, LONG id); +STATIC LONG VARARGS68K Local_AddRouteTags(struct CommandContext *cc, ...); +STATIC LONG VARARGS68K Local_ConfigureInterfaceTags(struct CommandContext *cc, STRPTR interface_name, ...); +STATIC LONG VARARGS68K Local_SocketBaseTags(struct CommandContext *cc, ...); + +/****************************************************************************/ + +/****** ROADSHOW/CONFIGURENETINTERFACE **************************************** +* +* NAME +* ConfigureNetInterface - Configure network interface parameters. +* +* FORMAT +* ConfigureNetInterface [QUIET] [TIMEOUT=] INTERFACE +* +* TEMPLATE +* INTERFACE/A,QUIET/S,ADDRESS/K,NETMASK/K,BROADCASTADDR/K, +* DESTINATION=DESTINATIONADDR/K,METRIC/K/N,MTU/K/N,ALIASADDR/K, +* DELETEADDR/K,ONLINE/S,OFFLINE/S,UP/S,DOWN/S,DEBUG/K,COMPLETE/K, +* CONFIGURE/K,LEASE/K,RELEASE=RELEASEADDRESS/S,ID/K,TIMEOUT/K/N, +* DHCPUNICAST/K +* +* PATH +* C:CONFIGURENETINTERFACE +* +* FUNCTION +* CONFIGURENETINTERFACE is used to define how a network interface will +* react and how it will interact with your network. +* +* OPTIONS +* INTERFACE/A +* The name of the interface to be configured. This is a required +* parameter. +* +* QUIET/S +* This option causes the program not to emit any error messages +* or progress reports. Also, if the program encounters an error +* it will flag this as failure code 5 which can be looked at +* using the 'if warn' shell script command. If this option is +* not in effect, failure codes will be more severe and all sorts +* of progress information will be displayed. +* +* ADDRESS/K +* The IP address to assign to this interface. This should be +* specified in dotted-decimal notation ("192.168.0.1") and not as +* symbolic name since the system may not be in a state to perform a +* name resolution. +* +* In place of the IP address you can also specify "DHCP". As the +* name suggests, this will start a configuration process involving +* the DHCP protocol which should eventually yield the right IP +* address for this host. Note that this configuration procedure only +* works for Ethernet hardware. +* +* NETMASK/K +* The subnet mask to assign to this interface. This must be +* specified in dotted-decimal notation ("192.168.0.1"). +* +* In place of the subnet mask you can also specify "DHCP". As the +* name suggests, this will start a configuration process involving +* the DHCP protocol which should eventually yield the right +* subnet mask for this host. Note that this configuration procedure +* only works for Ethernet hardware. +* +* BROADCASTADDR/K +* The broadcast address to be used by this interface; must be +* specified in dotted-decimal notation ("192.168.0.1") and only +* works with interfaces that support broadcasts in the first place +* (i.e. Ethernet hardware). +* +* DESTINATION=DESTINATIONADDR/K +* The address of the point-to-point partner for this interface; must +* be specified in dotted-decimal notation ("192.168.0.1"). Only +* works for point-to-point connections, such as PPP. +* +* METRIC/K/N +* Route metric value for this interface. +* +* MTU/K/N +* You can limit the maximum transmission size used by the TCP/IP +* stack to push data through the interface. The interface driver +* will have its own ideas about the maximum transmission size. +* You can therefore only suggest a smaller value than the +* driver's preferred hardware MTU size. +* +* ALIASADDR/K +* This adds another address to this interface to respond to. You +* can add as many aliases as you like, provided you don't run out +* of memory. +* +* DELETEADDR/K +* This removes an alias address from the list the interface is to +* respond to. +* +* UP +* DOWN +* ONLINE +* OFFLINE +* This configures the 'line state' of the interface; four states +* are supported: +* +* UP +* The protocol stack will attempt to transmit messages +* through this interface (even though it might not be +* online yet). +* +* DOWN +* The protocol stack will no longer attempt to transmit +* messages through this interface (even though it might +* still be online). +* +* OFFLINE +* The underlying networking device driver is put offline +* and the protocol stack will no longer try to send +* messages through the interface either. +* +* ONLINE +* An attempt is made to put the underlying networking +* driver online. If that works, then the protocol stack +* will attempt to transmit messages through this +* interface. +* +* DEBUG/K (possible parameters: YES or NO) +* You can enable debug output for this interface to help in tracking +* down configuration problems. At this time of writing, the debug +* mode will, if enabled, produce information on the progress of the +* DHCP configuration process. +* +* COMPLETE/K (possible parameters: YES or NO) +* If you configure an interface in several steps, use this parameter +* in the final invocation of the program. It will tell the TCP/IP +* stack that the configuration for this interface is complete. This +* has the effect of causing the static route definition file to be +* reread, if necessary. +* +* RELEASEADDRESS +* If an IP address was dynamically assigned to an interface, this +* switch will tell ConfigureNetInterface to release it. Note that +* you can only release what was previously allocated. +* +* CONFIGURE/K (possible parameters: DHCP, AUTO or FASTAUTO) +* You can use DHCP configuration for this interface and protocol +* stack internals, namely the list of routers (and the default +* gateway) to use and the domain name servers. This option allows +* you to bring up the complete network configuration in one +* single step. +* +* You can request that a particular IP address is assigned to this +* interface by the DHCP process by specifying CONFIGURE=DHCP and +* your choice of ADDRESS=xxx.xxx.xxx.xxx. +* +* If your network has no DHCP server, you may choose +* CONFIGURE=AUTO to use automatic IPv4 address selection, +* based upon a protocol called ZeroConf. This protocol will +* select a currently unused address from a specially +* designated address range. +* +* If you choose automatic configuration in a wireless network, +* you might want to use CONFIGURE=FASTAUTO instead of +* CONFIGURE=AUTO. +* +* Note that only the CONFIGURE=DHCP option will attempt to +* set up a default route and a set of DNS servers for you to +* use. The alternatives of CONFIGURE=FASTAUTO and +* CONFIGURE=AUTO are restricted to selecting the network +* interface IPv4 addresses. +* +* TIMEOUT/K/N +* If you're going to use DHCP configuration for any of the +* interfaces, a default timeout value of 60 seconds will +* limit the time an interface can take to be configured. +* This parameter allows you to use a different timeout value. +* Note that due to how the configuration protocol works, +* the timeout cannot be shorter than ten seconds. +* +* LEASE/K +* This is a complex option which can be used to request how long an +* IP address should be bound to an interface. Several combinations +* of options are possible. Here is a short list: +* +* LEASE=300 +* LEASE=300seconds +* +* This requests a lease of exactly 300 seconds, or +* five minutes. +* +* LEASE=30min +* +* This requests a lease of 30 minutes. +* +* LEASE=2hours +* +* This requests a lease of 2 hours. +* +* LEASE=1day +* +* This requests a lease of 1 day. +* +* LEASE=4weeks +* +* This requests a lease of 4 weeks. +* +* LEASE=infinite +* +* This requests that the IP address should be +* permanently bound. +* +* Blank spaces between the numbers and the qualifiers are supported. +* The qualifiers are tested using substring matching, which means +* for example that "30 minutes" is the same as "30 min" and "30 m". +* +* Note that the requested lease time may be ignored by the DHCP +* server. After all, it is just a suggestion and not an order. +* +* ID/K +* This option works along with the CONFIGURE=DHCP process. It can be +* used to tell the DHCP server by which name the local host should be +* referred to. Some DHCP servers are on good terms with their local name +* resolution services and will add the name and the associated IP +* address to the local host database. The name you can supply here +* cannot be longer than 255 characters and must be at least 2 characters +* long. Keep it brief: not all DHCP servers have room for the whole 255 +* characters. +* +* DHCPUNICAST/K (possible parameters: YES or NO) +* Some DHCP servers may not be able to respond to requests for +* assigning IP addresses unless the responses are sent directly +* to the computer which sent the requests. In such cases you +* might want to use DHCPUNICAST=YES option. +* +* NOTES +* The command is similar to the Unix "ifconfig" command. +* +* If you tell an interface to go online then the program's return +* code will tell you if the command succeeded: a return value of 0 +* indicates success (the interface is now online), and a value +* of 5 indicates that it didn't quite work. +* +* Configuring the address of an interface has two effects: first, +* the interface will be marked as 'up', meaning that the protocol +* stack will attempt to send messages through it when appropriate. +* Second, a direct route to the interface will be established. +* +* SEE ALSO +* AddNetInterface +* +****************************************************************************** +*/ +LONG +_start(VOID) +{ + struct Library *SysBase = (struct Library *)AbsExecBase; + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + struct CommandContext _cc,*cc = &_cc; + LONG result = RETURN_FAIL; + struct Process * pr; + LONG error; + + memset(cc,0,sizeof(*cc)); + + pr = (struct Process *)FindTask(NULL); + if(pr->pr_CLI == ZERO) + { + struct MsgPort * mp = &pr->pr_MsgPort; + struct Message * mn; + + WaitPort(mp); + mn = GetMsg(mp); + + Forbid(); + ReplyMsg(mn); + goto out; + } + + error = open_libs(cc,SysBase); + if(error == OK) + { + DECLARE_LOCALEBASE(cc); + + if(cc->cc_LocaleBase != NULL) + cc->cc_Catalog = OpenCatalogA(NULL,"roadshow.catalog",NULL); + + result = cmd(cc); + + if(cc->cc_Tags != NULL) + FreeVec(cc->cc_Tags); + + if(cc->cc_Catalog != NULL) + CloseCatalog(cc->cc_Catalog); + } + else + { + pr->pr_Result2 = error; + } + + close_libs(cc); + + out: + + return(result); +} + +/****************************************************************************/ + +STATIC VOID +close_libs(struct CommandContext * cc) +{ + DECLARE_SYSBASE(cc); + + #if defined(__amigaos4__) + { + if(cc->cc_IDOS != NULL) + DropInterface((struct Interface *)cc->cc_IDOS); + + if(cc->cc_ILocale != NULL) + DropInterface((struct Interface *)cc->cc_ILocale); + + if(cc->cc_ISocket != NULL) + DropInterface((struct Interface *)cc->cc_ISocket); + + if(cc->cc_IUtility != NULL) + DropInterface((struct Interface *)cc->cc_IUtility); + } + #endif /* __amigaos4__ */ + + if(cc->cc_UtilityBase != NULL) + CloseLibrary(cc->cc_UtilityBase); + + if(cc->cc_SocketBase != NULL) + CloseLibrary(cc->cc_SocketBase); + + if(cc->cc_LocaleBase != NULL) + CloseLibrary(cc->cc_LocaleBase); + + if(cc->cc_DOSBase != NULL) + CloseLibrary(cc->cc_DOSBase); +} + +/****************************************************************************/ + +STATIC LONG +open_libs(struct CommandContext * cc,struct Library *SysBase) +{ + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + LONG error; + + cc->cc_SysBase = SysBase; + + #if defined(__amigaos4__) + { + cc->cc_IExec = IExec; + } + #endif /* __amigaos4__ */ + + cc->cc_DOSBase = OpenLibrary("dos.library",36); + + #if defined(__amigaos4__) + { + if(cc->cc_DOSBase != NULL) + { + cc->cc_IDOS = (struct DOSIFace *)GetInterface(cc->cc_DOSBase, "main", 1, 0); + if(cc->cc_IDOS == NULL) + { + CloseLibrary(cc->cc_DOSBase); + cc->cc_DOSBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + if(cc->cc_DOSBase == NULL) + { + error = ERROR_INVALID_RESIDENT_LIBRARY; + goto out; + } + + cc->cc_LocaleBase = OpenLibrary("locale.library",38); + + #if defined(__amigaos4__) + { + if(cc->cc_LocaleBase != NULL) + { + cc->cc_ILocale = (struct LocaleIFace *)GetInterface(cc->cc_LocaleBase, "main", 1, 0); + if(cc->cc_ILocale == NULL) + { + CloseLibrary(cc->cc_LocaleBase); + cc->cc_LocaleBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + cc->cc_UtilityBase = OpenLibrary("utility.library",37); + + #if defined(__amigaos4__) + { + if(cc->cc_UtilityBase != NULL) + { + cc->cc_IUtility = (struct UtilityIFace *)GetInterface(cc->cc_UtilityBase, "main", 1, 0); + if(cc->cc_IUtility == NULL) + { + CloseLibrary(cc->cc_UtilityBase); + cc->cc_UtilityBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + /* The following may be necessary to flush out an inoperable + bsdsocket.library which reached the end of the shutdown + process. */ + #if 1 + { + struct ExecBase * ex = (struct ExecBase *)SysBase; + struct Library * lib; + + Forbid(); + + lib = (struct Library *)FindName(&ex->LibList,"bsdsocket.library"); + if(lib != NULL) + RemLibrary(lib); + + Permit(); + } + #endif + + cc->cc_SocketBase = OpenLibrary("bsdsocket.library",4); + + #if defined(__amigaos4__) + { + if(cc->cc_SocketBase != NULL) + { + cc->cc_ISocket = (struct SocketIFace *)GetInterface(cc->cc_SocketBase, "main", 1, 0); + if(cc->cc_ISocket == NULL) + { + CloseLibrary(cc->cc_SocketBase); + cc->cc_SocketBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + error = OK; + + out: + + return(error); +} + +/****************************************************************************/ + +#define CATCOMP_ARRAY +#define CONFIGURENETINTERFACE_CATALOG_STRINGS +#include "roadshow.h" + +/****************************************************************************/ + +STATIC LONG +cmd(struct CommandContext * cc) +{ + struct + { + KEY Interface; + SWITCH Quiet; + KEY Address; + KEY NetMask; + KEY BroadcastAddress; + KEY DestinationAddress; + NUMBER Metric; + NUMBER MTU; + KEY AddAddress; + KEY DeleteAddress; + SWITCH Online; + SWITCH Offline; + SWITCH Up; + SWITCH Down; + KEY Debug; + KEY Complete; + KEY Configure; + KEY Lease; + SWITCH ReleaseAddress; + KEY ID; + NUMBER Timeout; + KEY DHCPUnicast; + } args; + + STRPTR args_template = + "INTERFACE/A," + "QUIET/S," + "ADDRESS/K," + "NETMASK/K," + "BROADCASTADDR/K," + "DESTINATION=DESTINATIONADDR/K," + "METRIC/K/N," + "MTU/K/N," + "ALIASADDR/K," + "DELETEADDR/K," + "ONLINE/S," + "OFFLINE/S," + "UP/S," + "DOWN/S," + "DEBUG/K," + "COMPLETE/K," + "CONFIGURE/K," + "LEASE/K," + "RELEASE=RELEASEADDRESS/S," + "ID/K," + "TIMEOUT/K/N," + "DHCPUNICAST/K" + VERSTAG; + + DECLARE_SYSBASE(cc); + DECLARE_DOSBASE(cc); + DECLARE_UTILITYBASE(cc); + DECLARE_SOCKETBASE(cc); + + struct AddressAllocationMessage * aam = &cc->cc_AllocationMessage; + LONG result = RETURN_FAIL; + LONG have_interface_api = FALSE; + LONG have_routing_api = FALSE; + LONG have_address_conversion_api = FALSE; + struct RDArgs * rda; + STRPTR state_name = NULL; + int state = -1; + LONG error; + BOOL quiet = FALSE; + STRPTR address = NULL; + STRPTR net_mask = NULL; + BOOL configure_dynamic = FALSE; + BOOL configure_auto = FALSE; + BOOL configure_slow_auto = FALSE; + LONG timeout; + UBYTE default_domain_name[256]; + ULONG lease_time = DHCP_DEFAULT_LEASE_TIME; + STRPTR client_id = NULL; + LONG dhcp_unicast = FALSE; + + GetProgramName(cc->cc_ProgramName,sizeof(cc->cc_ProgramName)); + + memset(&args,0,sizeof(args)); + + rda = ReadArgs(args_template,(LONG *)&args,NULL); + if(rda == NULL) + { + PrintFault(IoErr(),cc->cc_ProgramName); + goto out; + } + + quiet = (BOOL)(args.Quiet != 0); + + if(UtilityBase == NULL) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NO_UTILITY_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + if(SocketBase == NULL) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_CANNOT_OPEN_BSDSOCKET_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_HAVE_INTERFACE_API),&have_interface_api, + TAG_END) != 0) + { + have_interface_api = FALSE; + } + + if(NOT have_interface_api) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_BSDSOCKET_HAS_NO_INTERFACE_API_TXT), + cc->cc_ProgramName, SocketBase->lib_Node.ln_Name, SocketBase->lib_Version, SocketBase->lib_Revision); + } + + goto out; + } + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_HAVE_ROUTING_API),&have_routing_api, + TAG_END) != 0) + { + have_routing_api = FALSE; + } + + if(NOT have_routing_api) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_BSDSOCKET_HAS_NO_ROUTE_API_TXT), + cc->cc_ProgramName, SocketBase->lib_Node.ln_Name, SocketBase->lib_Version, SocketBase->lib_Revision); + } + + goto out; + } + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_HAVE_ADDRESS_CONVERSION_API),&have_address_conversion_api, + TAG_END) != 0) + { + have_address_conversion_api = FALSE; + } + + if(NOT have_address_conversion_api) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_HAS_NO_ADDRESS_CONVERSION_API_TXT), + cc->cc_ProgramName, SocketBase->lib_Node.ln_Name, SocketBase->lib_Version, SocketBase->lib_Revision); + } + + goto out; + } + + if(args.Address != NULL) + { + struct in_addr in; + + if(Stricmp(args.Address,"DHCP") != SAME) + { + if(CANNOT validate_ip_address(cc,quiet,"ADDRESS",args.Address)) + goto out; + } + + if(inet_aton(args.Address,&in)) + { + if(in.s_addr == 0 || in.s_addr == ~0UL) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INVALID_ADDRESS_TXT), + cc->cc_ProgramName,args.Address); + } + + goto out; + } + + if(((in.s_addr >> 24) & 0xFF) == 169 && + ((in.s_addr >> 16) & 0xFF) == 254) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_DYNAMIC_ADDRESS_SHOULD_NOT_BE_BOUND_TXT), + cc->cc_ProgramName,args.Address); + } + } + + FreeVec(address); + + address = AllocVec(strlen(args.Address) + 1,MEMF_ANY|MEMF_PUBLIC); + if(address != NULL) + { + strcpy(address,args.Address); + } + else + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_ADDRESS_TXT), + cc->cc_ProgramName,args.Interface); + } + + goto out; + } + } + + if(args.NetMask != NULL) + { + if(Stricmp(args.NetMask,"DHCP") != SAME) + { + if(CANNOT validate_ip_address(cc,quiet,"NETMASK",args.NetMask)) + goto out; + } + + FreeVec(net_mask); + + net_mask = AllocVec(strlen(args.NetMask) + 1,MEMF_ANY|MEMF_PUBLIC); + if(net_mask != NULL) + { + strcpy(net_mask,args.NetMask); + } + else + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_MASK_TXT), + cc->cc_ProgramName,args.Interface); + } + + goto out; + } + } + + if(args.DestinationAddress != NULL) + { + if(CANNOT validate_ip_address(cc,quiet,"DESTINATIONADDR",args.DestinationAddress)) + goto out; + + error = add_tag(cc,IFC_DestinationAddress,(ULONG)args.DestinationAddress); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_DESTINATION_ADDRESS_TXT), + cc->cc_ProgramName,args.Interface,args.DestinationAddress); + } + + goto out; + } + } + + if(args.BroadcastAddress != NULL) + { + if(CANNOT validate_ip_address(cc,quiet,"BROADCASTADDR",args.BroadcastAddress)) + goto out; + + error = add_tag(cc,IFC_BroadcastAddress,(ULONG)args.BroadcastAddress); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_BROADCAST_ADDRESS_TXT), + cc->cc_ProgramName,args.Interface,args.BroadcastAddress); + } + + goto out; + } + } + + if(args.Metric != NULL) + { + error = add_tag(cc,IFC_Metric,(*args.Metric)); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_METRIC_TXT), + cc->cc_ProgramName,args.Interface,(*args.Metric)); + } + + goto out; + } + } + + if(args.MTU != NULL && (*args.MTU) > 0) + { + error = add_tag(cc,IFC_LimitMTU,(*args.MTU)); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_MTU_TXT), + cc->cc_ProgramName,args.Interface,(*args.MTU)); + } + + goto out; + } + } + + if(args.Timeout != NULL && (*args.Timeout) > 0) + { + timeout = (*args.Timeout); + if(timeout < AAM_TIMEOUT_MIN) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_TIMEOUT_TOO_SHORT_TXT), + cc->cc_ProgramName,timeout); + } + + timeout = AAM_TIMEOUT_MIN; + } + } + else + { + timeout = 60; + } + + if(args.AddAddress != NULL) + { + if(CANNOT validate_ip_address(cc,quiet,"ALIASADDR",args.AddAddress)) + goto out; + + error = add_tag(cc,IFC_AddAliasAddress,(ULONG)args.AddAddress); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_ADD_ALIAS_ADDRESS_TXT), + cc->cc_ProgramName,args.Interface,args.AddAddress); + } + + goto out; + } + } + + if(args.DeleteAddress != NULL) + { + if(CANNOT validate_ip_address(cc,quiet,"DELETEADDR",args.DeleteAddress)) + goto out; + + error = add_tag(cc,IFC_DeleteAliasAddress,(ULONG)args.DeleteAddress); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_DELETE_ALIAS_ADDRESS_TXT), + cc->cc_ProgramName,args.Interface,args.DeleteAddress); + } + + goto out; + } + } + + if(args.Debug != NULL) + { + BOOL mode = FALSE; + + if(Stricmp(args.Debug,"ON") == SAME || Stricmp(args.Debug,"YES") == SAME) + { + mode = TRUE; + } + else if (Stricmp(args.Debug,"OFF") != SAME && Stricmp(args.Debug,"NO") != SAME) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_UNKNOWN_DEBUG_PARAMETER_TXT), + cc->cc_ProgramName,args.Debug); + } + + goto out; + } + + error = add_tag(cc,IFC_SetDebugMode,(ULONG)mode); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_TXT), + cc->cc_ProgramName,args.Interface); + } + + goto out; + } + } + + if(args.Complete != NULL) + { + BOOL complete = FALSE; + + if(Stricmp(args.Complete,"ON") == SAME || Stricmp(args.Complete,"YES") == SAME) + { + complete = TRUE; + } + else if (Stricmp(args.Complete,"OFF") != SAME && Stricmp(args.Complete,"NO") != SAME) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_UNKNOWN_COMPLETE_PARAMETER_TXT), + cc->cc_ProgramName,args.Complete); + } + + goto out; + } + + error = add_tag(cc,IFC_Complete,(ULONG)complete); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_TXT), + cc->cc_ProgramName,args.Interface); + } + + goto out; + } + } + + if(args.Configure != NULL) + { + if(Stricmp(args.Configure,"DHCP") == SAME) + { + configure_dynamic = TRUE; + configure_auto = FALSE; + } + else if (Stricmp(args.Configure,"SLOWAUTO") == SAME || Stricmp(args.Configure,"AUTO") == SAME) + { + configure_dynamic = configure_auto = configure_slow_auto = TRUE; + } + else if (Stricmp(args.Configure,"FASTAUTO") == SAME) + { + configure_dynamic = configure_auto = TRUE; + configure_slow_auto = FALSE; + } + else + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_UNKNOWN_CONFIGURE_PARAMETER_TXT), + cc->cc_ProgramName,args.Configure); + } + + goto out; + } + } + + if(args.Online || args.Offline || args.Up || args.Down) + { + STRPTR switches[4]; + LONG count; + + memset(switches,0,sizeof(switches)); + + count = 0; + + if(args.Online) + { + state_name = "ONLINE"; + state = SM_Online; + + switches[count++] = state_name; + } + + if(args.Offline) + { + state_name = "OFFLINE"; + state = SM_Offline; + + switches[count++] = state_name; + } + + if(args.Up) + { + state_name = "UP"; + state = SM_Up; + + switches[count++] = state_name; + } + + if(args.Down) + { + state_name = "DOWN"; + state = SM_Down; + + switches[count++] = state_name; + } + + if(count > 1) + { + if(NOT quiet) + { + LONG i; + + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_PICK_ONLY_ONE_STATE_TXT),cc->cc_ProgramName); + + for(i = 0 ; i < count ; i++) + { + if(i > 0) + Local_ErrorPrintf(cc,","); + + Local_ErrorPrintf(cc," %s",switches[i]); + } + + Local_ErrorPrintf(cc,".\n"); + } + + goto out; + } + } + + if(args.Lease != NULL) + { + STRPTR s = args.Lease; + STRPTR key = NULL; + LONG number; + LONG len; + + while(is_blank_space(*s)) + s++; + + len = 0; + number = 0; + while('0' <= (*s) && (*s) <= '9') + { + number = (10 * number) + (*s) - '0'; + len++; + s++; + } + + while(is_blank_space(*s)) + s++; + + if(s[0] != '\0') + key = s; + + if(len == 0 && key != NULL) + { + if(substring_matches(cc,"INF",key) == SAME) + { + lease_time = DHCP_INFINITE_LEASE_TIME; + } + else + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_UNKNOWN_LEASE_PARAMETER_TXT), + cc->cc_ProgramName,key); + } + + goto out; + } + } + else if (len > 0) + { + lease_time = number; + + if(key != NULL) + { + if(substring_matches(cc,"SECOND",key) == SAME) + { + /* This is the default unit */ + } + else if (substring_matches(cc,"MINUTE",key) == SAME) + { + lease_time *= 60; + } + else if (substring_matches(cc,"HOUR",key) == SAME) + { + lease_time *= 60 * 60; + } + else if (substring_matches(cc,"DAY",key) == SAME) + { + lease_time *= 24 * 60 * 60; + } + else if (substring_matches(cc,"WEEK",key) == SAME) + { + lease_time *= 7 * 24 * 60 * 60; + } + else + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_UNKNOWN_LEASE_PARAMETER_TXT), + cc->cc_ProgramName,key); + } + + goto out; + } + } + } + else + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INVALID_LEASE_PARAMETER_TXT), + cc->cc_ProgramName,args.Lease); + } + + goto out; + } + } + + if(args.ID != NULL) + { + if(strlen(args.ID) > 255 && NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_ID_TOO_LONG_TXT), + args.ID); + } + + if(strlen(args.ID) < 2) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_ID_TOO_SHORT_TXT), + args.ID); + } + + goto out; + } + + client_id = args.ID; + } + + /* Request that the DHCP server sends replies using + unicast instead of broadcast? */ + if(args.DHCPUnicast != NULL) + { + LONG mode = FALSE; + + if(Stricmp(args.DHCPUnicast,"ON") == SAME || Stricmp(args.DHCPUnicast,"YES") == SAME) + { + mode = TRUE; + } + else if (Stricmp(args.DHCPUnicast,"OFF") != SAME && Stricmp(args.DHCPUnicast,"NO") != SAME) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_UNKNOWN_UNICAST_PARAMETER_TXT), + cc->cc_ProgramName,args.DHCPUnicast); + } + + goto out; + } + + dhcp_unicast = mode; + } + + if(args.ReleaseAddress) + { + if(Local_ConfigureInterfaceTags(cc,args.Interface, + IFC_ReleaseAddress,TRUE, + TAG_DONE) != 0) + { + if(NOT quiet) + { + LONG errno; + STRPTR code; + + get_errno_and_code(cc,&errno,&code); + + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_COULD_NOT_RELEASE_INTERFACE_ADDRESS_TXT), + cc->cc_ProgramName,args.Interface); + + if(code != NULL && errno > 0) + Local_ErrorPrintf(cc," (%s)",code); + + Local_ErrorPrintf(cc,".\n"); + } + + goto out; + } + + if(NOT quiet) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INTERFACE_ADDRESS_WAS_RELEASED_TXT), + args.Interface); + } + } + + if(address != NULL || configure_dynamic) + { + BOOL want_address = (BOOL)(address != NULL && Stricmp(address,"DHCP") == SAME); + BOOL want_netmask = (BOOL)(net_mask != NULL && Stricmp(net_mask,"DHCP") == SAME); + + if(configure_dynamic || want_address || want_netmask) + { + LONG signals; + + /* Remember the client identifier. */ + aam->aam_ClientIdentifier = client_id; + + /* We have to have the reply port ready. */ + if(cc->cc_ReplyPort == NULL) + { + cc->cc_ReplyPort = CreateMsgPort(); + if(cc->cc_ReplyPort == NULL) + { + if(NOT quiet) + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_TXT),cc->cc_ProgramName,args.Interface); + + goto out; + } + } + + /* Before we begin, we will need to mark this + interface 'up' so that the protocol stack will + send messages through it. */ + if(Local_ConfigureInterfaceTags(cc,args.Interface, + IFC_State,SM_Up, + TAG_DONE) != 0) + { + if(NOT quiet) + { + LONG errno; + STRPTR code; + + get_errno_and_code(cc,&errno,&code); + + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_COULD_NOT_MARK_INTERFACE_UP_TXT), + cc->cc_ProgramName,args.Interface); + + if(code != NULL && errno > 0) + Local_ErrorPrintf(cc," (%s)",code); + + Local_ErrorPrintf(cc,".\n"); + } + + goto out; + } + + if(NOT quiet) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_TRYING_INTERFACE_CONFIGURATION_TXT), + cc->cc_ProgramName,args.Interface); + + Flush(Output()); + } + + /* Initialize the message, then send it. */ + aam->aam_Message.mn_Node.ln_Type = NT_REPLYMSG; + aam->aam_Message.mn_ReplyPort = cc->cc_ReplyPort; + aam->aam_Message.mn_Length = sizeof(*aam); + + memcpy(aam->aam_InterfaceName,args.Interface,sizeof(aam->aam_InterfaceName)-1); + aam->aam_InterfaceName[sizeof(aam->aam_InterfaceName)-1] = '\0'; + + if(configure_auto) + { + if(configure_slow_auto) + aam->aam_Protocol = AAMP_SLOWAUTO; + else + aam->aam_Protocol = AAMP_FASTAUTO; + } + else + { + aam->aam_Protocol = AAMP_DHCP; + } + + aam->aam_Version = AAM_VERSION; + aam->aam_Timeout = timeout; + aam->aam_LeaseTime = lease_time; + aam->aam_RouterTable = cc->cc_RouterTable; + aam->aam_RouterTableSize = NUM_ENTRIES(cc->cc_RouterTable); + aam->aam_DNSTable = cc->cc_DNSTable; + aam->aam_DNSTableSize = NUM_ENTRIES(cc->cc_DNSTable); + aam->aam_LeaseExpires = &cc->cc_LeaseExpires; + aam->aam_DomainName = default_domain_name; + aam->aam_DomainNameSize = sizeof(default_domain_name); + aam->aam_Unicast = dhcp_unicast; /* Note: this field only exists in version 2 and above */ + + strcpy(default_domain_name,""); + + if(address != NULL && Stricmp(address,"DHCP") != SAME) + aam->aam_RequestedAddress = inet_addr(address); + + BeginInterfaceConfig(aam); + + /* Wait for something to happen. */ + signals = Wait(SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_F | (1UL << cc->cc_ReplyPort->mp_SigBit)); + + if(signals & SIGBREAKF_CTRL_C) + { + AbortInterfaceConfig(aam); + WaitPort(cc->cc_ReplyPort); + GetMsg(cc->cc_ReplyPort); + + if(NOT quiet) + { + Local_Printf(cc,"\n"); + Local_PrintFault(cc,ERROR_BREAK,cc->cc_ProgramName); + } + + goto out; + } + else if (signals & SIGBREAKF_CTRL_F) + { + AbortInterfaceConfig(aam); + WaitPort(cc->cc_ReplyPort); + GetMsg(cc->cc_ReplyPort); + + if(NOT quiet) + { + Local_Printf(cc,"\n"); + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ABORTED_TXT), + cc->cc_ProgramName,args.Interface); + } + + result = RETURN_OK; + goto out; + } + else + { + if(NOT quiet) + Local_Printf(cc,"\n"); + + WaitPort(cc->cc_ReplyPort); + GetMsg(cc->cc_ReplyPort); + + if(aam->aam_Result != AAMR_Success && NOT quiet) + { + STATIC CONST error_map_table[][2] = + { + { AAMR_Aborted, MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ABORTED_TXT }, + { AAMR_Timeout, MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_TIMED_OUT_TXT }, + { AAMR_InterfaceNotKnown, MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NAME_UNKNOWN_TXT }, + { AAMR_InterfaceWrongType, MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_WRONG_TYPE_TXT }, + { AAMR_AddressKnown, MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ALREADY_CONFIGURED_TXT }, + { AAMR_VersionUnknown, MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NOT_COMPATIBLE_TXT }, + { AAMR_NoMemory, MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NOT_ENOUGH_MEMORY_TXT }, + { AAMR_AddressInUse, MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ADDRESS_IN_USE_TXT }, + { AAMR_AddrChangeFailed, MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ADDRESS_NOT_CHANGED_TXT }, + { AAMR_MaskChangeFailed, MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_MASK_NOT_CHANGED_TXT }, + { AAMR_Busy, MSG_CONFIGURENETINTERFACE_INTERFACE_IS_BUSY_TXT }, + { -1, -1} + }; + + LONG message_code; + size_t i; + + message_code = MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_UNKNOWN_ERROR_TXT ; + + for(i = 0 ; error_map_table[i][0] != -1 ; i++) + { + if(aam->aam_Result == error_map_table[i][0]) + { + message_code = error_map_table[i][1]; + break; + } + } + + Local_ErrorPrintf(cc,get_str(cc,message_code), + cc->cc_ProgramName,args.Interface,aam->aam_Result); + } + + if(aam->aam_Result != AAMR_Success) + { + result = RETURN_OK; + goto out; + } + + if(configure_dynamic || want_address) + { + UBYTE str[20]; + + if(aam->aam_Address == 0) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INTERFACE_NOT_CONFIGURED_ADDRESS_INVALID_TXT), + cc->cc_ProgramName,args.Interface); + } + + goto out; + } + + strcpy(str,Inet_NtoA(aam->aam_Address)); + + FreeVec(address); + + address = AllocVec(strlen(str)+1,MEMF_ANY|MEMF_PUBLIC); + if(address == NULL) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NOT_ENOUGH_MEMORY_TXT), + cc->cc_ProgramName,args.Interface); + } + + goto out; + } + + strcpy(address,str); + } + + if(configure_dynamic || want_netmask) + { + if(aam->aam_SubnetMask == 0x00000000 || + aam->aam_SubnetMask == 0xFFFFFFFF) + { + FreeVec(net_mask); + net_mask = NULL; + } + else + { + UBYTE str[20]; + + strcpy(str,Inet_NtoA(aam->aam_SubnetMask)); + + FreeVec(net_mask); + + net_mask = AllocVec(strlen(str)+1,MEMF_ANY|MEMF_PUBLIC); + if(net_mask == NULL) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NOT_ENOUGH_MEMORY_TXT), + cc->cc_ProgramName,args.Interface); + } + + goto out; + } + + strcpy(net_mask,str); + } + } + + if(configure_dynamic) + { + LONG i,n; + + n = 0; + for(i = 0 ; i < aam->aam_RouterTableSize ; i++) + { + if(aam->aam_RouterTable[i] != 0) + n++; + } + + if(n == 0) + aam->aam_RouterTable = NULL; + + n = 0; + for(i = 0 ; i < aam->aam_DNSTableSize ; i++) + { + if(aam->aam_DNSTable[i] != 0) + n++; + } + + if(n == 0) + aam->aam_DNSTable = NULL; + } + + /* If we are about to set the interface address, we will also + have to take care of the interface state, which defaults to + 'up'. */ + if(state == -1) + state = SM_Up; + } + } + } + + if(address != NULL) + { + error = add_tag(cc,IFC_Address,(ULONG)address); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_ADDRESS_TXT), + cc->cc_ProgramName,args.Interface,address); + } + + goto out; + } + } + + if(net_mask != NULL) + { + error = add_tag(cc,IFC_NetMask,(ULONG)net_mask); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_NETMASK_TXT), + cc->cc_ProgramName,args.Interface,net_mask); + } + + goto out; + } + } + + if(cc->cc_NumTags > 0) + { + if(state == SM_Online || state == SM_Up) + { + error = add_tag(cc,IFC_State,state); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_STATE_TXT), + cc->cc_ProgramName,args.Interface); + } + + goto out; + } + + state = -1; + } + + error = add_tag(cc,TAG_END,0); + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_TXT), + cc->cc_ProgramName,args.Interface); + } + + goto out; + } + + if(ConfigureInterfaceTagList(args.Interface,cc->cc_Tags) != OK) + { + if(NOT quiet) + { + LONG error = OK; + STRPTR code = NULL; + + get_errno_and_code(cc,&error,&code); + + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_COULD_NOT_CONFIGURE_INTERFACE_TXT), + cc->cc_ProgramName,args.Interface); + + if(code != NULL && error > 0) + Local_ErrorPrintf(cc," (%s)",code); + + Local_ErrorPrintf(cc,".\n"); + } + + goto out; + } + + if(NOT quiet) + { + STRPTR prefix = ""; + + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURED_TXT), + cc->cc_ProgramName,args.Interface); + + if(args.Address != NULL) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INTERFACE_ADDRESS_IS_TXT),prefix,args.Address); + prefix = ", "; + } + + if(args.NetMask != NULL) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INTERFACE_MASK_TXT),prefix,args.NetMask); + prefix = ", "; + } + + if(args.DestinationAddress != NULL) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INTERFACE_DESTINATION_ADDRESS_TXT),prefix,args.DestinationAddress); + prefix = ", "; + } + + if(args.BroadcastAddress != NULL) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INTERFACE_BROADCAST_ADDRESS_TXT),prefix,args.BroadcastAddress); + prefix = ", "; + } + + if(args.Metric != NULL) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INTERFACE_METRIC_TXT),prefix,(*args.Metric)); + prefix = ", "; + } + + if(args.AddAddress != NULL) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INTERFACE_ADD_ADDRESS_TXT),prefix,args.AddAddress); + prefix = ", "; + } + + if(args.DeleteAddress != NULL) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INTERFACE_DELETE_ADDRESS_TXT),prefix,args.DeleteAddress); + } + + Local_Printf(cc,").\n"); + } + } + + if(configure_dynamic) + { + STRPTR domain_name; + + if(aam->aam_DomainName != NULL && aam->aam_DomainName[0] != '\0') + domain_name = aam->aam_DomainName; + else + domain_name = ""; + + SetDefaultDomainName(domain_name); + + if(domain_name[0] != '\0' && NOT quiet) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_DEFAULT_DOMAIN_NAME_TXT), + cc->cc_ProgramName,domain_name); + } + } + + if(configure_dynamic && aam->aam_RouterTable != NULL) + { + LONG i,n; + + n = 0; + for(i = 0 ; i < aam->aam_RouterTableSize ; i++) + { + if(aam->aam_RouterTable[i] != 0) + { + UBYTE str[20]; + LONG error = OK; + STRPTR code = NULL; + + strcpy(str,Inet_NtoA(aam->aam_RouterTable[i])); + + if(n == 0) + { + if(Local_AddRouteTags(cc, + RTA_DefaultGateway,str, + TAG_DONE) != OK) + { + get_errno_and_code(cc,&error,&code); + } + + if(error == OK && NOT quiet) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_ADDED_DEFAULT_ROUTE_TXT), + cc->cc_ProgramName,str); + } + } + else + { + if(Local_AddRouteTags(cc, + RTA_Destination,str, + TAG_DONE) != OK) + { + get_errno_and_code(cc,&error,&code); + } + + if(error == OK && NOT quiet) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_ADDED_ROUTE_TXT), + cc->cc_ProgramName,str); + } + } + + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_COULD_NOT_ADD_ROUTE_TO_TXT), + cc->cc_ProgramName,str); + + if(code != NULL && error > 0) + Local_ErrorPrintf(cc," (%s)",code); + + Local_ErrorPrintf(cc,".\n"); + } + + goto out; + } + + n++; + } + } + } + + if(configure_dynamic && aam->aam_DNSTable != NULL) + { + LONG i; + + for(i = 0 ; i < aam->aam_DNSTableSize ; i++) + { + if(aam->aam_DNSTable[i] != 0) + { + UBYTE str[20]; + LONG error = OK; + STRPTR code = NULL; + + strcpy(str,Inet_NtoA(aam->aam_DNSTable[i])); + + if(AddDomainNameServer(str) != OK) + get_errno_and_code(cc,&error,&code); + + if(error != OK) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_COULD_NOT_ADD_DNS_TXT), + cc->cc_ProgramName,str); + + if(code != NULL && error > 0) + Local_ErrorPrintf(cc," (%s)",code); + + Local_ErrorPrintf(cc,".\n"); + } + + goto out; + } + + if(NOT quiet) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_ADDED_DNS_TXT), + cc->cc_ProgramName,str); + } + } + } + } + + if(configure_dynamic && aam->aam_Protocol == AAMP_DHCP && NOT quiet) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INTERFACE_ADDRESS_TXT), + cc->cc_ProgramName,args.Interface,address); + + if(cc->cc_LeaseExpires.ds_Days == 0 && + cc->cc_LeaseExpires.ds_Minute == 0 && + cc->cc_LeaseExpires.ds_Tick == 0) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_LEASED_PERMANENTLY_TXT)); + } + else + { + struct DateTime dat; + UBYTE date[LEN_DATSTRING+1]; + UBYTE time[LEN_DATSTRING+1]; + + memset(&dat,0,sizeof(dat)); + + dat.dat_Stamp = cc->cc_LeaseExpires; + dat.dat_Format = FORMAT_DEF; + dat.dat_StrDate = date; + dat.dat_StrTime = time; + + DateToStr(&dat); + + strip_extra_blank_spaces(date); + strip_extra_blank_spaces(time); + + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_LEASED_UNTIL_TXT), + date,time); + } + } + + if(state != -1) + { + if(Local_ConfigureInterfaceTags(cc,args.Interface, + IFC_State,state, + TAG_END) != OK) + { + if(NOT quiet) + { + LONG error = OK; + STRPTR code = NULL; + + get_errno_and_code(cc,&error,&code); + + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_COULD_NOT_SET_STATE_TXT), + cc->cc_ProgramName,args.Interface,state_name); + + if(code != NULL && error > 0) + Local_ErrorPrintf(cc," (%s)",code); + + Local_ErrorPrintf(cc,".\n"); + } + + if(state == SM_Online) + result = RETURN_WARN; + + goto out; + } + + if(NOT quiet) + { + Local_Printf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_STATE_CHANGED_TXT), + cc->cc_ProgramName,args.Interface,state_name); + } + } + + result = RETURN_OK; + + out: + + DeleteMsgPort(cc->cc_ReplyPort); + + FreeVec(address); + FreeVec(net_mask); + + if(quiet && result != RETURN_OK) + result = RETURN_WARN; + + if(rda != NULL) + FreeArgs(rda); + + return(result); +} + +/****************************************************************************/ + +STATIC BOOL +validate_ip_address(struct CommandContext * cc,BOOL quiet,STRPTR key,STRPTR address) +{ + DECLARE_SOCKETBASE(cc); + + struct in_addr in; + BOOL result; + + if(inet_aton(address,&in)) + { + result = TRUE; + } + else + { + if(NOT quiet) + Local_ErrorPrintf(cc,get_str(cc,MSG_CONFIGURENETINTERFACE_INVALID_IP_ADDRESS_AT_TXT),cc->cc_ProgramName,key,address); + + result = FALSE; + } + + return(result); +} + +/****************************************************************************/ + +STATIC LONG +add_tag(struct CommandContext * cc,Tag tag,ULONG data) +{ + DECLARE_SYSBASE(cc); + + LONG error = OK; + LONG which = -1; + LONG i; + + for(i = 0 ; i < cc->cc_NumTags ; i++) + { + if(cc->cc_Tags[i].ti_Tag == tag) + { + which = i; + break; + } + } + + if(which == -1 && cc->cc_NumTags + 1 >= cc->cc_MaxTags) + { + struct TagItem * new_tags; + + new_tags = AllocVec(sizeof(*new_tags) * (cc->cc_MaxTags+10),MEMF_ANY|MEMF_PUBLIC); + if(new_tags == NULL) + { + error = ERROR_NO_FREE_STORE; + goto out; + } + + if(cc->cc_Tags != NULL) + CopyMem(cc->cc_Tags,new_tags,sizeof(*new_tags) * cc->cc_NumTags); + + FreeVec(cc->cc_Tags); + cc->cc_Tags = new_tags; + cc->cc_MaxTags += 10; + } + + if(which == -1) + which = cc->cc_NumTags++; + + cc->cc_Tags[which].ti_Tag = tag; + cc->cc_Tags[which].ti_Data = data; + + out: + + return(error); +} + +/****************************************************************************/ + +STATIC VOID +get_errno_and_code(struct CommandContext * cc,LONG * errno_ptr,STRPTR * code_ptr) +{ + LONG errno = 0; + LONG code; + + Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_ERRNO),&errno, + TAG_END); + + code = errno; + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_ERRNOSTRPTR),&code, + TAG_END) != 0) + { + code = 0; + } + + (*errno_ptr) = errno; + (*code_ptr) = (STRPTR)code; +} + +/****************************************************************************/ + +STATIC BOOL +substring_matches(struct CommandContext * cc,STRPTR pattern,STRPTR string) +{ + DECLARE_UTILITYBASE(cc); + + BOOL result = FALSE; + LONG i,len,pattern_len; + + len = strlen(string); + pattern_len = strlen(pattern); + + for(i = 0 ; i <= len - pattern_len ; i++) + { + if(Strnicmp(&string[len],pattern,pattern_len) == SAME) + { + result = TRUE; + break; + } + } + + return(result); +} + +/****************************************************************************/ + +STATIC BOOL +is_blank_space(UBYTE c) +{ + BOOL result; + + result = (BOOL)(c == ' ' || c == '\t' || c == (UBYTE)'\240'); + + return(result); +} + +/****************************************************************************/ + +STATIC VOID +strip_extra_blank_spaces(STRPTR s) +{ + LONG num_leading_spaces; + LONG num_trailing_spaces; + LONG len,i; + + len = strlen(s); + + num_leading_spaces = 0; + + for(i = 0 ; i < len ; i++) + { + if(NOT is_blank_space(s[i])) + break; + + num_leading_spaces++; + } + + num_trailing_spaces = 0; + + for(i = len-1 ; i >= 0 ; i--) + { + if(NOT is_blank_space(s[i])) + break; + + num_trailing_spaces++; + } + + if(num_trailing_spaces > 0) + { + len -= num_trailing_spaces; + s[len] = '\0'; + } + + if(num_leading_spaces > 0) + memmove(s,&s[num_leading_spaces],len+1); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_Printf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + result = VPrintf(format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + result = VPrintf(format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +/****************************************************************************/ + +STATIC VOID +Local_PrintFault(struct CommandContext * cc,LONG error,STRPTR prefix) +{ + DECLARE_DOSBASE(cc); + + UBYTE str[100]; + + Fault(error,NULL,str,sizeof(str)); + + Local_Printf(cc,"%s: %s\n",prefix,str); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_ErrorPrintf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + DECLARE_SYSBASE(cc); + + va_list args; + LONG result; + BPTR fh; + + #if defined(__amigaos4__) + { + fh = ErrorOutput(); + } + #else + { + struct Process * this_process = (struct Process *)FindTask(NULL); + + fh = this_process->pr_CES; + } + #endif /* __amigaos4__ */ + + if(fh == ZERO) + fh = Output(); + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + result = VFPrintf(fh,format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + result = VFPrintf(fh,format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +/****************************************************************************/ + +/* This looks up a locale string ID in the builtin database; adapted + from CygnusEd because I couldn't find my own implementation for this + application... */ +STATIC STRPTR +get_builtin_str(LONG id) +{ + LONG top,middle,bottom; + STRPTR builtin_string; + + /* The search area is all those message between bottom and top, inclusive. */ + bottom = 0; + top = NUM_ENTRIES(CatCompArray) - 1; + + /* Binary search through the CatCompArray to find the requested string. + Note that this assumes that the strings are sorted. Catcomp defaults + to creating sorted arrays, but it does _not_ force it. If in the .cd + file you specify out of order string numbers this routine will fail. */ + while(bottom != top) + { + middle = (bottom + top) / 2; + + if(CatCompArray[middle].cca_ID >= id) + top = middle; + else + bottom = middle + 1; + } + + /* The only time this error message should occur is if you've passed + a garbage number OR if the CatCompArray is not sorted. */ + if(CatCompArray[bottom].cca_ID == id) + builtin_string = (STRPTR)CatCompArray[bottom].cca_Str; + else + builtin_string = ""; + + return(builtin_string); +} + +STATIC STRPTR +get_str(struct CommandContext * cc, LONG id) +{ + STRPTR builtin_string; + STRPTR result; + + builtin_string = get_builtin_str(id); + + if(cc->cc_Catalog != NULL) + { + DECLARE_LOCALEBASE(cc); + + result = (STRPTR)GetCatalogStr(cc->cc_Catalog,id,builtin_string); + } + else + { + result = builtin_string; + } + + return(result); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_AddRouteTags(struct CommandContext * cc,...) +{ + DECLARE_SOCKETBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,cc); + result = AddRouteTagList(va_getlinearva(args,struct TagItem *)); + va_end(args); + } + #else + { + va_start(args,cc); + result = AddRouteTagList((struct TagItem *)args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +STATIC LONG VARARGS68K +Local_ConfigureInterfaceTags(struct CommandContext * cc,STRPTR interface_name,...) +{ + DECLARE_SOCKETBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,interface_name); + result = ConfigureInterfaceTagList(interface_name,va_getlinearva(args,struct TagItem *)); + va_end(args); + } + #else + { + va_start(args,interface_name); + result = ConfigureInterfaceTagList(interface_name,(struct TagItem *)args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +STATIC LONG VARARGS68K +Local_SocketBaseTags(struct CommandContext * cc,...) +{ + DECLARE_SOCKETBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,cc); + result = SocketBaseTagList(va_getlinearva(args,struct TagItem *)); + va_end(args); + } + #else + { + va_start(args,cc); + result = SocketBaseTagList((struct TagItem *)args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} diff --git a/examples/ConfigureNetInterface_rev.h b/examples/ConfigureNetInterface_rev.h new file mode 100644 index 0000000..ef1cf58 --- /dev/null +++ b/examples/ConfigureNetInterface_rev.h @@ -0,0 +1,6 @@ +#define VERSION 4 +#define REVISION 37 +#define DATE "26.1.2017" +#define VERS "ConfigureNetInterface 4.37" +#define VSTRING "ConfigureNetInterface 4.37 (26.1.2017)\r\n" +#define VERSTAG "\0$VER: ConfigureNetInterface 4.37 (26.1.2017)" diff --git a/examples/DeleteNetRoute.c b/examples/DeleteNetRoute.c new file mode 100644 index 0000000..1ff0579 --- /dev/null +++ b/examples/DeleteNetRoute.c @@ -0,0 +1,732 @@ +/* + * $Id: DeleteNetRoute.c,v 1.11 2007-08-26 12:30:15 obarthel Exp $ + * + * :ts=4 + * + * Copyright © 2001-2007 by Olaf Barthel. All Rights Reserved. + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +/****************************************************************************/ + +#if defined(__amigaos4__) +#include +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +#if !defined(__amigaos4__) +#define NO_INLINE_STDARG +#endif /* __amigaos4__ */ + +#define __NOLIBBASE__ +#define __NOGLOBALIFACE__ +#define __USE_INLINE__ + +/****************************************************************************/ + +#include +#include +#include +#include + +/****************************************************************************/ + +#include +#include + +/****************************************************************************/ + +#include "macros.h" + +/****************************************************************************/ + +#include "DeleteNetRoute_rev.h" + +/****************************************************************************/ + +#ifndef AbsExecBase +#define AbsExecBase (*(struct ExecBase **)4) +#endif /* AbsExecBase */ + +/****************************************************************************/ + +typedef LONG * NUMBER; +typedef LONG SWITCH; +typedef STRPTR KEY; + +/****************************************************************************/ + +struct CommandContext +{ + struct Library * cc_SysBase; + struct Library * cc_DOSBase; + struct Library * cc_SocketBase; + struct Library * cc_LocaleBase; + + #if defined(__amigaos4__) + + /************************************************************************/ + + struct ExecIFace * cc_IExec; + struct DOSIFace * cc_IDOS; + struct SocketIFace * cc_ISocket; + struct LocaleIFace * cc_ILocale; + + /************************************************************************/ + + #endif /* __amigaos4__ */ + + struct Catalog * cc_Catalog; + UBYTE cc_ProgramName[256]; +}; + +/****************************************************************************/ + +#if defined(__amigaos4__) + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct ExecIFace * IExec = cc->cc_IExec; \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct DOSIFace * IDOS = cc->cc_IDOS; \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_LOCALEBASE(cc) \ + struct LocaleIFace * ILocale = cc->cc_ILocale; \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct SocketIFace * ISocket = cc->cc_ISocket; \ + struct Library * SocketBase = cc->cc_SocketBase + +/****************************************************************************/ + +#else + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_LOCALEBASE(cc) \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct Library * SocketBase = cc->cc_SocketBase + +/****************************************************************************/ + +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +LONG _start(VOID); + +/****************************************************************************/ + +STATIC VOID close_libs(struct CommandContext *cc); +STATIC LONG open_libs(struct CommandContext *cc, struct Library *SysBase); +STATIC LONG cmd(struct CommandContext *cc); +STATIC LONG VARARGS68K Local_Printf(struct CommandContext *cc, STRPTR format, ...); +STATIC LONG VARARGS68K Local_ErrorPrintf(struct CommandContext *cc, STRPTR format, ...); +STATIC STRPTR get_builtin_str(LONG id); +STATIC STRPTR get_str(struct CommandContext *cc, LONG id); +STATIC LONG VARARGS68K Local_SocketBaseTags(struct CommandContext *cc, ...); +STATIC LONG VARARGS68K Local_DeleteRouteTags(struct CommandContext *cc, ...); + +/****************************************************************************/ + +/****** ROADSHOW/DELETENETROUTE ************************************************ +* +* NAME +* DeleteNetRoute - Delete a message routing path currently in use. +* +* FORMAT +* DeleteNetRoute [QUIET] [DESTINATION=] [DEFAULTGATEWAY=] +* +* TEMPLATE +* QUIET/S,DST=DESTINATION/K,DEFAULT=DEFAULTGATEWAY/K +* +* PATH +* C:DELETENETROUTE +* +* FUNCTION +* The commands removes a route that was defined in your network. +* +* OPTIONS +* QUIET/S +* This option causes the program not to emit any error messages +* or progress reports. Also, if the program encounters an error +* it will flag this as failure code 5 which can be looked at +* using the "if warn" shell script command. If this option is +* not in effect, failure codes will be more severe and all sorts +* of progress information will be displayed. +* +* DST=DESTINATION/K +* The destination address of a route (or in other words, where +* the route to be added leads to) that should be deleted. This +* must be an IP address or a symbolic name. +* +* DEFAULT=DEFAULTGATEWAY/K +* The default gateway address to be deleted. This must be an +* IP address or a symbolic name. +* +* NOTES +* This command is similar to the Unix "route" command. +* +* You can try to delete a route that doesn't exist, but it will +* get you an error message instead of failing gracefully. +* +* SEE ALSO +* AddNetRoute +****************************************************************************** +*/ +LONG +_start(VOID) +{ + struct Library *SysBase = (struct Library *)AbsExecBase; + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + struct CommandContext _cc,*cc = &_cc; + LONG result = RETURN_FAIL; + struct Process * pr; + LONG error; + + memset(cc,0,sizeof(*cc)); + + pr = (struct Process *)FindTask(NULL); + if(pr->pr_CLI == ZERO) + { + struct MsgPort * mp = &pr->pr_MsgPort; + struct Message * mn; + + WaitPort(mp); + mn = GetMsg(mp); + + Forbid(); + ReplyMsg(mn); + goto out; + } + + error = open_libs(cc,SysBase); + if(error == OK) + { + DECLARE_LOCALEBASE(cc); + + if(cc->cc_LocaleBase != NULL) + cc->cc_Catalog = OpenCatalogA(NULL,"roadshow.catalog",NULL); + + result = cmd(cc); + + if(cc->cc_Catalog != NULL) + CloseCatalog(cc->cc_Catalog); + } + else + { + pr->pr_Result2 = error; + } + + close_libs(cc); + + out: + + return(result); +} + +/****************************************************************************/ + +STATIC VOID +close_libs(struct CommandContext * cc) +{ + DECLARE_SYSBASE(cc); + + #if defined(__amigaos4__) + { + if(cc->cc_IDOS != NULL) + DropInterface((struct Interface *)cc->cc_IDOS); + + if(cc->cc_ILocale != NULL) + DropInterface((struct Interface *)cc->cc_ILocale); + + if(cc->cc_ISocket != NULL) + DropInterface((struct Interface *)cc->cc_ISocket); + } + #endif /* __amigaos4__ */ + + if(cc->cc_SocketBase != NULL) + CloseLibrary(cc->cc_SocketBase); + + if(cc->cc_LocaleBase != NULL) + CloseLibrary(cc->cc_LocaleBase); + + if(cc->cc_DOSBase != NULL) + CloseLibrary(cc->cc_DOSBase); +} + +/****************************************************************************/ + +STATIC LONG +open_libs(struct CommandContext * cc,struct Library *SysBase) +{ + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + LONG error; + + cc->cc_SysBase = SysBase; + + #if defined(__amigaos4__) + { + cc->cc_IExec = IExec; + } + #endif /* __amigaos4__ */ + + cc->cc_DOSBase = OpenLibrary("dos.library",36); + + #if defined(__amigaos4__) + { + if(cc->cc_DOSBase != NULL) + { + cc->cc_IDOS = (struct DOSIFace *)GetInterface(cc->cc_DOSBase, "main", 1, 0); + if(cc->cc_IDOS == NULL) + { + CloseLibrary(cc->cc_DOSBase); + cc->cc_DOSBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + if(cc->cc_DOSBase == NULL) + { + error = ERROR_INVALID_RESIDENT_LIBRARY; + goto out; + } + + cc->cc_LocaleBase = OpenLibrary("locale.library",38); + + #if defined(__amigaos4__) + { + if(cc->cc_LocaleBase != NULL) + { + cc->cc_ILocale = (struct LocaleIFace *)GetInterface(cc->cc_LocaleBase, "main", 1, 0); + if(cc->cc_ILocale == NULL) + { + CloseLibrary(cc->cc_LocaleBase); + cc->cc_LocaleBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + /* The following may be necessary to flush out an inoperable + bsdsocket.library which reached the end of the shutdown + process. */ + #if 1 + { + struct ExecBase * ex = (struct ExecBase *)SysBase; + struct Library * lib; + + Forbid(); + + lib = (struct Library *)FindName(&ex->LibList,"bsdsocket.library"); + if(lib != NULL) + RemLibrary(lib); + + Permit(); + } + #endif + + cc->cc_SocketBase = OpenLibrary("bsdsocket.library",4); + + #if defined(__amigaos4__) + { + if(cc->cc_SocketBase != NULL) + { + cc->cc_ISocket = (struct SocketIFace *)GetInterface(cc->cc_SocketBase, "main", 1, 0); + if(cc->cc_ISocket == NULL) + { + CloseLibrary(cc->cc_SocketBase); + cc->cc_SocketBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + error = OK; + + out: + + return(error); +} + +/****************************************************************************/ + +#define CATCOMP_ARRAY +#define DELETENETROUTE_CATALOG_STRINGS +#include "roadshow.h" + +/****************************************************************************/ + +STATIC LONG +cmd(struct CommandContext * cc) +{ + struct + { + SWITCH Quiet; + KEY Destination; + KEY DefaultGateway; + } args; + + STRPTR args_template = + "QUIET/S," + "DST=DESTINATION/K," + "DEFAULT=DEFAULTGATEWAY/K" + VERSTAG; + + DECLARE_DOSBASE(cc); + DECLARE_SOCKETBASE(cc); + + LONG result = RETURN_FAIL; + LONG have_routing_api = FALSE; + struct RDArgs * rda; + BOOL quiet = FALSE; + + GetProgramName(cc->cc_ProgramName,sizeof(cc->cc_ProgramName)); + + memset(&args,0,sizeof(args)); + + rda = ReadArgs(args_template,(LONG *)&args,NULL); + if(rda == NULL) + { + PrintFault(IoErr(),cc->cc_ProgramName); + goto out; + } + + quiet = (BOOL)(args.Quiet != 0); + + if(SocketBase == NULL) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_DELETENETROUTE_CANNOT_OPEN_BSDSOCKET_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_HAVE_ROUTING_API),&have_routing_api, + TAG_END) != 0) + { + have_routing_api = FALSE; + } + + if(NOT have_routing_api) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_DELETENETROUTE_BSDSOCKET_HAS_NO_ROUTE_API_TXT), + cc->cc_ProgramName, SocketBase->lib_Node.ln_Name, SocketBase->lib_Version, SocketBase->lib_Revision); + } + + goto out; + } + + if(args.Destination == NULL && args.DefaultGateway == NULL) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_DELETENETROUTE_NEED_EITHER_DESTINATION_OR_DEFAULT_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + if(args.DefaultGateway != NULL && args.Destination != NULL) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_DELETENETROUTE_DESTINATION_IGNORED_TXT), + cc->cc_ProgramName,args.Destination); + } + + args.Destination = NULL; + } + + if(Local_DeleteRouteTags(cc, + (args.Destination != NULL) ? RTA_Destination : TAG_IGNORE, args.Destination, + (args.DefaultGateway != NULL) ? RTA_DefaultGateway : TAG_IGNORE, args.DefaultGateway, + TAG_END) != OK) + { + if(NOT quiet) + { + LONG errno = 0; + LONG code; + + Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_ERRNO),&errno, + TAG_END); + + code = errno; + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_ERRNOSTRPTR),&code, + TAG_END) != 0) + { + code = 0; + } + + if(args.DefaultGateway != NULL) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_DELETENETROUTE_ROUTE_TO_DEFAULT_GATEWAY_NOT_DELETED_TXT), + cc->cc_ProgramName,args.DefaultGateway); + } + else + { + Local_ErrorPrintf(cc,get_str(cc,MSG_DELETENETROUTE_ROUTE_NOT_DELETED_TXT), + cc->cc_ProgramName,args.Destination); + } + + if(code > 0 && errno > 0) + Local_ErrorPrintf(cc," (%s)",code); + + Local_ErrorPrintf(cc,".\n"); + } + + goto out; + } + + if(NOT quiet) + { + LONG message_code; + + if(args.DefaultGateway != NULL) + message_code = MSG_DELETENETROUTE_ROUTE_TO_DEFAULT_DELETED_TXT; + else + message_code = MSG_DELETENETROUTE_ROUTE_DELETED_TXT; + + Local_Printf(cc,get_str(cc,message_code), + cc->cc_ProgramName,args.DefaultGateway); + } + + result = RETURN_OK; + + out: + + if(quiet && result != RETURN_OK) + result = RETURN_WARN; + + if(rda != NULL) + FreeArgs(rda); + + return(result); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_Printf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + result = VPrintf(format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + result = VPrintf(format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_ErrorPrintf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + DECLARE_SYSBASE(cc); + + va_list args; + LONG result; + BPTR fh; + + #if defined(__amigaos4__) + { + fh = ErrorOutput(); + } + #else + { + struct Process * this_process = (struct Process *)FindTask(NULL); + + fh = this_process->pr_CES; + } + #endif /* __amigaos4__ */ + + if(fh == ZERO) + fh = Output(); + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + result = VFPrintf(fh,format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + result = VFPrintf(fh,format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +/****************************************************************************/ + +/* This looks up a locale string ID in the builtin database; adapted + from CygnusEd because I couldn't find my own implementation for this + application... */ +STATIC STRPTR +get_builtin_str(LONG id) +{ + LONG top,middle,bottom; + STRPTR builtin_string; + + /* The search area is all those message between bottom and top, inclusive. */ + bottom = 0; + top = NUM_ENTRIES(CatCompArray) - 1; + + /* Binary search through the CatCompArray to find the requested string. + Note that this assumes that the strings are sorted. Catcomp defaults + to creating sorted arrays, but it does _not_ force it. If in the .cd + file you specify out of order string numbers this routine will fail.*/ + while(bottom != top) + { + middle = (bottom + top) / 2; + + if(CatCompArray[middle].cca_ID >= id) + top = middle; + else + bottom = middle + 1; + } + + /* The only time this error message should occur is if you've passed + a garbage number OR if the CatCompArray is not sorted. */ + if(CatCompArray[bottom].cca_ID == id) + builtin_string = (STRPTR)CatCompArray[bottom].cca_Str; + else + builtin_string = ""; + + return(builtin_string); +} + +STATIC STRPTR +get_str(struct CommandContext * cc, LONG id) +{ + STRPTR builtin_string; + STRPTR result; + + builtin_string = get_builtin_str(id); + + if(cc->cc_Catalog != NULL) + { + DECLARE_LOCALEBASE(cc); + + result = (STRPTR)GetCatalogStr(cc->cc_Catalog,id,builtin_string); + } + else + { + result = builtin_string; + } + + return(result); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_SocketBaseTags(struct CommandContext * cc,...) +{ + DECLARE_SOCKETBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,cc); + result = SocketBaseTagList(va_getlinearva(args,struct TagItem *)); + va_end(args); + } + #else + { + va_start(args,cc); + result = SocketBaseTagList((struct TagItem *)args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +STATIC LONG VARARGS68K +Local_DeleteRouteTags(struct CommandContext * cc,...) +{ + DECLARE_SOCKETBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,cc); + result = DeleteRouteTagList(va_getlinearva(args,struct TagItem *)); + va_end(args); + } + #else + { + va_start(args,cc); + result = DeleteRouteTagList((struct TagItem *)args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} diff --git a/examples/DeleteNetRoute_rev.h b/examples/DeleteNetRoute_rev.h new file mode 100644 index 0000000..d79bec8 --- /dev/null +++ b/examples/DeleteNetRoute_rev.h @@ -0,0 +1,6 @@ +#define VERSION 4 +#define REVISION 8 +#define DATE "11.3.2009" +#define VERS "DeleteNetRoute 4.8" +#define VSTRING "DeleteNetRoute 4.8 (11.3.2009)\r\n" +#define VERSTAG "\0$VER: DeleteNetRoute 4.8 (11.3.2009)" diff --git a/examples/GetNetStatus.c b/examples/GetNetStatus.c new file mode 100644 index 0000000..39ff3fa --- /dev/null +++ b/examples/GetNetStatus.c @@ -0,0 +1,1003 @@ +/* + * $Id: GetNetStatus.c,v 1.11 2007-08-26 12:30:15 obarthel Exp $ + * + * :ts=4 + * + * Copyright © 2001-2007 by Olaf Barthel. All Rights Reserved. + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +/****************************************************************************/ + +#if defined(__amigaos4__) +#include +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +#if !defined(__amigaos4__) +#define NO_INLINE_STDARG +#endif /* __amigaos4__ */ + +#define __NOLIBBASE__ +#define __NOGLOBALIFACE__ +#define __USE_INLINE__ + +/****************************************************************************/ + +#include +#include +#include +#include +#include + +/****************************************************************************/ + +#include +#include + +/****************************************************************************/ + +#include "macros.h" + +/****************************************************************************/ + +#include "GetNetStatus_rev.h" + +/****************************************************************************/ + +#ifndef AbsExecBase +#define AbsExecBase (*(struct ExecBase **)4) +#endif /* AbsExecBase */ + +/****************************************************************************/ + +typedef LONG * NUMBER; +typedef LONG SWITCH; +typedef STRPTR KEY; + +/****************************************************************************/ + +struct CommandContext +{ + struct Library * cc_SysBase; + struct Library * cc_DOSBase; + struct Library * cc_UtilityBase; + struct Library * cc_LocaleBase; + struct Library * cc_SocketBase; + + #if defined(__amigaos4__) + + /************************************************************************/ + + struct ExecIFace * cc_IExec; + struct DOSIFace * cc_IDOS; + struct UtilityIFace * cc_IUtility; + struct LocaleIFace * cc_ILocale; + struct SocketIFace * cc_ISocket; + + /************************************************************************/ + + #endif /* __amigaos4__ */ + + struct Catalog * cc_Catalog; + UBYTE cc_ProgramName[256]; +}; + +/****************************************************************************/ + +#if defined(__amigaos4__) + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct ExecIFace * IExec = cc->cc_IExec; \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct DOSIFace * IDOS = cc->cc_IDOS; \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_UTILITYBASE(cc) \ + struct UtilityIFace * IUtility = cc->cc_IUtility; \ + struct Library * UtilityBase = cc->cc_UtilityBase + +#define DECLARE_LOCALEBASE(cc) \ + struct LocaleIFace * ILocale = cc->cc_ILocale; \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct SocketIFace * ISocket = cc->cc_ISocket; \ + struct Library * SocketBase = cc->cc_SocketBase + +/****************************************************************************/ + +#else + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_UTILITYBASE(cc) \ + struct Library * UtilityBase = cc->cc_UtilityBase + +#define DECLARE_LOCALEBASE(cc) \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct Library * SocketBase = cc->cc_SocketBase + +/****************************************************************************/ + +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +LONG _start(VOID); + +/****************************************************************************/ + +STATIC VOID close_libs(struct CommandContext *cc); +STATIC LONG open_libs(struct CommandContext *cc, struct Library *SysBase); +STATIC LONG cmd(struct CommandContext *cc); +STATIC STRPTR begin_bold(struct CommandContext *cc); +STATIC STRPTR end_bold(struct CommandContext *cc); +STATIC STRPTR get_next_token(STRPTR input, STRPTR string, LONG string_len); +STATIC LONG VARARGS68K Local_Printf(struct CommandContext *cc, STRPTR format, ...); +STATIC LONG VARARGS68K Local_ErrorPrintf(struct CommandContext *cc, STRPTR format, ...); +STATIC STRPTR get_builtin_str(LONG id); +STATIC STRPTR get_str(struct CommandContext *cc, LONG id); +STATIC LONG VARARGS68K Local_SocketBaseTags(struct CommandContext *cc, ...); + +/****************************************************************************/ + +/****** ROADSHOW/GETNETSTATUS ************************************************** +* +* NAME +* GetNetStatus - Query whether the network is operational. +* +* FORMAT +* GetNetStatus [CHECK=condition[,condition...]] [QUIET] +* +* TEMPLATE +* CHECK/K,QUIET/S +* +* FUNCTION +* The command is used to check/display which interfaces are currently +* running and which settings are being configured. It can be used in +* script files or for quick diagnostic purposes. +* +* OPTIONS +* CHECK/K +* A list of conditions to check, which must be separated by commas. +* the following conditions can be checked: +* +* INTERFACES +* Are any networking interfaces configured and operational? +* +* PTPINTERFACES +* Are any point-to-point interfaces, e.g. SLIP and PPP, +* configured and operational? +* +* BCASTINTERFACES +* Are any broadcast interfaces, e.g. Ethernet, configured +* and operational? +* +* RESOLVER +* Are any name resolution servers configured? +* +* ROUTES +* Is any routing information configured? +* +* DEFAULTROUTE +* Is the default route configured? +* +* If any of the conditions to test for is not satisfied, a message +* to this effect will be printed and the command will exit with +* status 5, which can be tested in script files using the +* 'IF WARN' command. +* +* QUIET/S +* Whatever happens, except for errors no output will be produced. +* +* NOTES +* If no conditions are to be checked for, then this command will print +* version information and the list of conditions that can be tested +* for, indicating which ones are satisfied and which are not. +* +****************************************************************************** +*/ + +LONG +_start(VOID) +{ + struct Library *SysBase = (struct Library *)AbsExecBase; + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + struct CommandContext _cc,*cc = &_cc; + LONG result = RETURN_FAIL; + struct Process * pr; + LONG error; + + memset(cc,0,sizeof(*cc)); + + pr = (struct Process *)FindTask(NULL); + if(pr->pr_CLI == ZERO) + { + struct MsgPort * mp = &pr->pr_MsgPort; + struct Message * mn; + + WaitPort(mp); + mn = GetMsg(mp); + + Forbid(); + ReplyMsg(mn); + goto out; + } + + error = open_libs(cc,SysBase); + if(error == OK) + { + DECLARE_LOCALEBASE(cc); + + if(cc->cc_LocaleBase != NULL) + cc->cc_Catalog = OpenCatalogA(NULL,"roadshow.catalog",NULL); + + result = cmd(cc); + + if(cc->cc_Catalog != NULL) + CloseCatalog(cc->cc_Catalog); + } + else + { + pr->pr_Result2 = error; + } + + close_libs(cc); + + out: + + return(result); +} + +/****************************************************************************/ + +STATIC VOID +close_libs(struct CommandContext * cc) +{ + DECLARE_SYSBASE(cc); + + #if defined(__amigaos4__) + { + if(cc->cc_IDOS != NULL) + DropInterface((struct Interface *)cc->cc_IDOS); + + if(cc->cc_ILocale != NULL) + DropInterface((struct Interface *)cc->cc_ILocale); + + if(cc->cc_ISocket != NULL) + DropInterface((struct Interface *)cc->cc_ISocket); + + if(cc->cc_IUtility != NULL) + DropInterface((struct Interface *)cc->cc_IUtility); + } + #endif /* __amigaos4__ */ + + if(cc->cc_UtilityBase != NULL) + CloseLibrary(cc->cc_UtilityBase); + + if(cc->cc_SocketBase != NULL) + CloseLibrary(cc->cc_SocketBase); + + if(cc->cc_LocaleBase != NULL) + CloseLibrary(cc->cc_LocaleBase); + + if(cc->cc_DOSBase != NULL) + CloseLibrary(cc->cc_DOSBase); +} + +/****************************************************************************/ + +STATIC LONG +open_libs(struct CommandContext * cc,struct Library *SysBase) +{ + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + LONG error; + + cc->cc_SysBase = SysBase; + + #if defined(__amigaos4__) + { + cc->cc_IExec = IExec; + } + #endif /* __amigaos4__ */ + + cc->cc_DOSBase = OpenLibrary("dos.library",36); + + #if defined(__amigaos4__) + { + if(cc->cc_DOSBase != NULL) + { + cc->cc_IDOS = (struct DOSIFace *)GetInterface(cc->cc_DOSBase, "main", 1, 0); + if(cc->cc_IDOS == NULL) + { + CloseLibrary(cc->cc_DOSBase); + cc->cc_DOSBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + if(cc->cc_DOSBase == NULL) + { + error = ERROR_INVALID_RESIDENT_LIBRARY; + goto out; + } + + cc->cc_LocaleBase = OpenLibrary("locale.library",38); + + #if defined(__amigaos4__) + { + if(cc->cc_LocaleBase != NULL) + { + cc->cc_ILocale = (struct LocaleIFace *)GetInterface(cc->cc_LocaleBase, "main", 1, 0); + if(cc->cc_ILocale == NULL) + { + CloseLibrary(cc->cc_LocaleBase); + cc->cc_LocaleBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + cc->cc_UtilityBase = OpenLibrary("utility.library",37); + + #if defined(__amigaos4__) + { + if(cc->cc_UtilityBase != NULL) + { + cc->cc_IUtility = (struct UtilityIFace *)GetInterface(cc->cc_UtilityBase, "main", 1, 0); + if(cc->cc_IUtility == NULL) + { + CloseLibrary(cc->cc_UtilityBase); + cc->cc_UtilityBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + /* The following may be necessary to flush out an inoperable + bsdsocket.library which reached the end of the shutdown + process. */ + #if 1 + { + struct ExecBase * ex = (struct ExecBase *)SysBase; + struct Library * lib; + + Forbid(); + + lib = (struct Library *)FindName(&ex->LibList,"bsdsocket.library"); + if(lib != NULL) + RemLibrary(lib); + + Permit(); + } + #endif + + cc->cc_SocketBase = OpenLibrary("bsdsocket.library",4); + + #if defined(__amigaos4__) + { + if(cc->cc_SocketBase != NULL) + { + cc->cc_ISocket = (struct SocketIFace *)GetInterface(cc->cc_SocketBase, "main", 1, 0); + if(cc->cc_ISocket == NULL) + { + CloseLibrary(cc->cc_SocketBase); + cc->cc_SocketBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + error = OK; + + out: + + return(error); +} + +/****************************************************************************/ + +#define CATCOMP_ARRAY +#define GETNETSTATUS_CATALOG_STRINGS +#include "roadshow.h" + +/****************************************************************************/ + +STATIC LONG +cmd(struct CommandContext * cc) +{ + struct + { + KEY Check; + SWITCH Quiet; + } args; + + STRPTR args_template = + "CHECK/K," + "QUIET/S" + VERSTAG; + + DECLARE_DOSBASE(cc); + DECLARE_UTILITYBASE(cc); + DECLARE_SOCKETBASE(cc); + + BOOL check_interfaces = FALSE; + BOOL check_ptp_interfaces = FALSE; + BOOL check_broadcast_interfaces = FALSE; + BOOL check_resolver = FALSE; + BOOL check_routes = FALSE; + BOOL check_default_route = FALSE; + LONG result = RETURN_FAIL; + struct RDArgs * rda; + ULONG system_status; + + GetProgramName(cc->cc_ProgramName,sizeof(cc->cc_ProgramName)); + + memset(&args,0,sizeof(args)); + + rda = ReadArgs(args_template,(LONG *)&args,NULL); + if(rda == NULL) + { + PrintFault(IoErr(),cc->cc_ProgramName); + goto out; + } + + if(UtilityBase == NULL) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_GETNETSTATUS_NO_UTILITY_TXT), + cc->cc_ProgramName); + + goto out; + } + + if(SocketBase == NULL) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_GETNETSTATUS_CANNOT_OPEN_BSDSOCKET_TXT), + cc->cc_ProgramName); + + goto out; + } + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_SYSTEM_STATUS),&system_status, + TAG_END) != 0) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_GETNETSTATUS_BSDSOCKET_HAS_NO_STATUS_API_TXT), + cc->cc_ProgramName, SocketBase->lib_Node.ln_Name, SocketBase->lib_Version, SocketBase->lib_Revision); + + goto out; + } + + if(args.Check != NULL) + { + STRPTR arg; + + arg = args.Check; + + if(strcmp(arg,"?") == SAME) + { + Local_Printf(cc, + "INTERFACES/S," + "PTPINTERFACES=PTP/S," + "BCASTINTERFACES=BCAST=BROADCAST/S," + "RESOLVER=NAMERESOLUTION=DNS/S," + "ROUTES/S," + "DEFAULTROUTE=DEFAULTGATEWAY/S" + "\n"); + } + else + { + UBYTE token[40]; + + while((arg = get_next_token(arg,token,sizeof(token))) != NULL) + { + if(Stricmp(token,"INTERFACES") == SAME) + check_interfaces = TRUE; + else if (Stricmp(token,"PTPINTERFACES") == SAME || Stricmp(token,"PTP") == SAME) + check_ptp_interfaces = TRUE; + else if (Stricmp(token,"BCASTINTERFACES") == SAME || Stricmp(token,"BCAST") == SAME || Stricmp(token,"BROADCAST") == SAME) + check_broadcast_interfaces = TRUE; + else if (Stricmp(token,"RESOLVER") == SAME || Stricmp(token,"NAMERESOLUTION") == SAME || Stricmp(token,"DNS") == SAME) + check_resolver = TRUE; + else if (Stricmp(token,"ROUTES") == SAME) + check_routes = TRUE; + else if (Stricmp(token,"DEFAULTROUTE") == SAME || Stricmp(token,"DEFAULTGATEWAY") == SAME) + check_default_route = TRUE; + else + Local_ErrorPrintf(cc,get_str(cc,MSG_GETNETSTATUS_UNKNOWN_CONDITION_TXT),cc->cc_ProgramName,token); + } + } + } + else if (NOT args.Quiet) + { + UBYTE string[256]; + LONG len; + + if(SocketBase->lib_IdString != NULL) + { + strncpy(string,SocketBase->lib_IdString,sizeof(string)-1); + string[sizeof(string)-1] = '\0'; + } + else + { + strcpy(string,""); + } + + len = strlen(string); + while(len > 0 && (string[len-1] == '\r' || string[len-1] == '\n')) + string[--len] = '\0'; + + if(len > 0) + { + STRPTR release_string = NULL; + BOOL need_line_feed = FALSE; + LONG i; + + for(i = 0 ; i < len ; i++) + { + if(string[i] == '\n') + { + need_line_feed = TRUE; + break; + } + } + + Local_Printf(cc,"%s",string); + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_RELEASESTRPTR),&release_string, + TAG_END) != 0) + { + release_string = NULL; + } + + if(release_string != NULL) + { + strncpy(string,release_string,sizeof(string)-1); + string[sizeof(string)-1] = '\0'; + } + else + { + strcpy(string,""); + } + + len = strlen(string); + while(len > 0 && (string[len-1] == '\r' || string[len-1] == '\n')) + string[--len] = '\0'; + + if(len > 0) + { + if(need_line_feed) + Local_Printf(cc,"\n"); + else + Local_Printf(cc," "); + + Local_Printf(cc,"[%s]",string); + } + + Local_Printf(cc,"\n"); + } + } + + result = RETURN_OK; + + if(FLAG_IS_SET(system_status,SBSYSSTAT_Interfaces)) + { + if(NOT args.Quiet && args.Check == NULL) + Local_Printf(cc,get_str(cc,MSG_GETNETSTATUS_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT)); + } + else + { + if(NOT args.Quiet && (args.Check == NULL || check_interfaces)) + Local_Printf(cc,get_str(cc,MSG_GETNETSTATUS_NO_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT),begin_bold(cc),end_bold(cc)); + + if(check_interfaces) + result = RETURN_WARN; + } + + if(FLAG_IS_SET(system_status,SBSYSSTAT_PTP_Interfaces)) + { + if(NOT args.Quiet && args.Check == NULL) + Local_Printf(cc,get_str(cc,MSG_GETNETSTATUS_POINT_TO_POINT_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT)); + } + else + { + if(NOT args.Quiet && (args.Check == NULL || check_ptp_interfaces)) + Local_Printf(cc,get_str(cc,MSG_GETNETSTATUS_NO_POINT_TO_POINT_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT),begin_bold(cc),end_bold(cc)); + + if(check_ptp_interfaces) + result = RETURN_WARN; + } + + if(FLAG_IS_SET(system_status,SBSYSSTAT_BCast_Interfaces)) + { + if(NOT args.Quiet && args.Check == NULL) + Local_Printf(cc,get_str(cc,MSG_GETNETSTATUS_BROADCAST_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT)); + } + else + { + if(NOT args.Quiet && (args.Check == NULL || check_broadcast_interfaces)) + Local_Printf(cc,get_str(cc,MSG_GETNETSTATUS_NO_BROADCAST_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT),begin_bold(cc),end_bold(cc)); + + if(check_broadcast_interfaces) + result = RETURN_WARN; + } + + if(FLAG_IS_SET(system_status,SBSYSSTAT_Resolver)) + { + if(NOT args.Quiet && args.Check == NULL) + Local_Printf(cc,get_str(cc,MSG_GETNETSTATUS_DNS_CONFIGURED_TXT)); + } + else + { + if(NOT args.Quiet && (args.Check == NULL || check_resolver)) + Local_Printf(cc,get_str(cc,MSG_GETNETSTATUS_NO_DNS_CONFIGURED_TXT),begin_bold(cc),end_bold(cc)); + + if(check_resolver) + result = RETURN_WARN; + } + + if(FLAG_IS_SET(system_status,SBSYSSTAT_Routes)) + { + if(NOT args.Quiet && args.Check == NULL) + Local_Printf(cc,get_str(cc,MSG_GETNETSTATUS_ROUTE_CONFIGURED_TXT)); + } + else + { + if(NOT args.Quiet && (args.Check == NULL || check_routes)) + Local_Printf(cc,get_str(cc,MSG_GETNETSTATUS_NO_ROUTE_CONFIGURED_TXT),begin_bold(cc),end_bold(cc)); + + if(check_routes) + result = RETURN_WARN; + } + + if(FLAG_IS_SET(system_status,SBSYSSTAT_DefaultRoute)) + { + if(NOT args.Quiet && args.Check == NULL) + Local_Printf(cc,get_str(cc,MSG_GETNETSTATUS_DEFAULT_ROUTE_CONFIGURED_TXT)); + } + else + { + if(NOT args.Quiet && (args.Check == NULL || check_default_route)) + Local_Printf(cc,get_str(cc,MSG_GETNETSTATUS_NO_DEFAULT_ROUTE_CONFIGURED_TXT),begin_bold(cc),end_bold(cc)); + + if(check_default_route) + result = RETURN_WARN; + } + + out: + + if(rda != NULL) + FreeArgs(rda); + + return(result); +} + +/****************************************************************************/ + +STATIC STRPTR +begin_bold(struct CommandContext * cc) +{ + DECLARE_DOSBASE(cc); + + STRPTR result; + + if(IsInteractive(Output())) + result = "\33[1m"; + else + result = ""; + + return(result); +} + +STATIC STRPTR +end_bold(struct CommandContext * cc) +{ + DECLARE_DOSBASE(cc); + + STRPTR result; + + if(IsInteractive(Output())) + result = "\33[0m"; + else + result = ""; + + return(result); +} + +/****************************************************************************/ + +STATIC STRPTR +get_next_token( + STRPTR input, + STRPTR string, + LONG string_len) +{ + if((*input) == '\0') + { + input = NULL; + } + else + { + BOOL is_escape = FALSE; + BOOL is_quote = FALSE; + BOOL done; + UBYTE c; + + while((*input) == ' ' || (*input) == (UBYTE)'\240' || (*input) == '\t' || (*input) == ',') + input++; + + done = FALSE; + + do + { + c = (*input++); + if(c == '\0') + { + input--; + break; + } + + if(is_escape) + { + if(string_len > 1) + { + (*string++) = c; + string_len--; + } + + is_escape = FALSE; + continue; + } + + switch(c) + { + case '\\': + + is_escape = TRUE; + break; + + case ' ': + case '\240': + case '\t': + case ',': + + if(is_quote) + { + if(string_len > 1) + { + (*string++) = c; + string_len--; + } + } + else + { + done = TRUE; + } + + break; + + case '\"': + + if(is_quote) + { + done = TRUE; + } + else + { + is_quote ^= TRUE; + } + + break; + + default: + + if(string_len > 1) + { + (*string++) = c; + string_len--; + } + + break; + } + } + while(NOT done); + + if(string_len > 0) + (*string) = '\0'; + } + + return(input); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_Printf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + result = VPrintf(format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + result = VPrintf(format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_ErrorPrintf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + DECLARE_SYSBASE(cc); + + va_list args; + LONG result; + BPTR fh; + + #if defined(__amigaos4__) + { + fh = ErrorOutput(); + } + #else + { + struct Process * this_process = (struct Process *)FindTask(NULL); + + fh = this_process->pr_CES; + } + #endif /* __amigaos4__ */ + + if(fh == ZERO) + fh = Output(); + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + result = VFPrintf(fh,format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + result = VFPrintf(fh,format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +/****************************************************************************/ + +/* This looks up a locale string ID in the builtin database; adapted + from CygnusEd because I couldn't find my own implementation for this + application... */ +STATIC STRPTR +get_builtin_str(LONG id) +{ + LONG top,middle,bottom; + STRPTR builtin_string; + + /* The search area is all those message between bottom and top, inclusive. */ + bottom = 0; + top = NUM_ENTRIES(CatCompArray) - 1; + + /* Binary search through the CatCompArray to find the requested string. + Note that this assumes that the strings are sorted. Catcomp defaults + to creating sorted arrays, but it does _not_ force it. If in the .cd + file you specify out of order string numbers this routine will fail. */ + while(bottom != top) + { + middle = (bottom + top) / 2; + + if(CatCompArray[middle].cca_ID >= id) + top = middle; + else + bottom = middle + 1; + } + + /* The only time this error message should occur is if you've passed + a garbage number OR if the CatCompArray is not sorted. */ + if(CatCompArray[bottom].cca_ID == id) + builtin_string = (STRPTR)CatCompArray[bottom].cca_Str; + else + builtin_string = ""; + + return(builtin_string); +} + +STATIC STRPTR +get_str(struct CommandContext * cc, LONG id) +{ + STRPTR builtin_string; + STRPTR result; + + builtin_string = get_builtin_str(id); + + if(cc->cc_Catalog != NULL) + { + DECLARE_LOCALEBASE(cc); + + result = (STRPTR)GetCatalogStr(cc->cc_Catalog,id,builtin_string); + } + else + { + result = builtin_string; + } + + return(result); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_SocketBaseTags(struct CommandContext * cc,...) +{ + DECLARE_SOCKETBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,cc); + result = SocketBaseTagList(va_getlinearva(args,struct TagItem *)); + va_end(args); + } + #else + { + va_start(args,cc); + result = SocketBaseTagList((struct TagItem *)args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} diff --git a/examples/GetNetStatus_rev.h b/examples/GetNetStatus_rev.h new file mode 100644 index 0000000..cb64ca9 --- /dev/null +++ b/examples/GetNetStatus_rev.h @@ -0,0 +1,6 @@ +#define VERSION 4 +#define REVISION 9 +#define DATE "11.3.2009" +#define VERS "GetNetStatus 4.9" +#define VSTRING "GetNetStatus 4.9 (11.3.2009)\r\n" +#define VERSTAG "\0$VER: GetNetStatus 4.9 (11.3.2009)" diff --git a/examples/NetShutdown.c b/examples/NetShutdown.c new file mode 100644 index 0000000..85e729b --- /dev/null +++ b/examples/NetShutdown.c @@ -0,0 +1,755 @@ +/* + * $Id: NetShutdown.c,v 1.15 2007-08-26 12:30:16 obarthel Exp $ + * + * :ts=4 + * + * Copyright © 2001-2007 by Olaf Barthel. All Rights Reserved. + */ + +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + +/****************************************************************************/ + +#if defined(__amigaos4__) +#include +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +#if !defined(__amigaos4__) +#define NO_INLINE_STDARG +#endif /* __amigaos4__ */ + +#define __NOLIBBASE__ +#define __NOGLOBALIFACE__ +#define __USE_INLINE__ + +/****************************************************************************/ + +#include +#include +#include + +/****************************************************************************/ + +#include +#include + +/****************************************************************************/ + +#include "macros.h" + +/****************************************************************************/ + +#include "NetShutdown_rev.h" + +/****************************************************************************/ + +#ifndef AbsExecBase +#define AbsExecBase (*(struct ExecBase **)4) +#endif /* AbsExecBase */ + +/****************************************************************************/ + +typedef LONG * NUMBER; +typedef LONG SWITCH; +typedef STRPTR KEY; + +/****************************************************************************/ + +struct CommandContext +{ + struct Library * cc_SysBase; + struct Library * cc_DOSBase; + struct Library * cc_LocaleBase; + + #if defined(__amigaos4__) + + /************************************************************************/ + + struct ExecIFace * cc_IExec; + struct DOSIFace * cc_IDOS; + struct LocaleIFace * cc_ILocale; + + /************************************************************************/ + + #endif /* __amigaos4__ */ + + struct Catalog * cc_Catalog; + UBYTE cc_ProgramName[256]; +}; + +/****************************************************************************/ + +#if defined(__amigaos4__) + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct ExecIFace * IExec = cc->cc_IExec; \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct DOSIFace * IDOS = cc->cc_IDOS; \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_LOCALEBASE(cc) \ + struct LocaleIFace * ILocale = cc->cc_ILocale; \ + struct Library * LocaleBase = cc->cc_LocaleBase + +/****************************************************************************/ + +#else + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_LOCALEBASE(cc) \ + struct Library * LocaleBase = cc->cc_LocaleBase + +/****************************************************************************/ + +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +LONG _start(VOID); + +/****************************************************************************/ + +STATIC VOID close_libs(struct CommandContext *cc); +STATIC LONG open_libs(struct CommandContext *cc, struct Library *SysBase); +STATIC LONG cmd(struct CommandContext *cc); +STATIC LONG VARARGS68K Local_Printf(struct CommandContext *cc, STRPTR format, ...); +STATIC LONG VARARGS68K Local_ErrorPrintf(struct CommandContext *cc, STRPTR format, ...); +STATIC STRPTR get_builtin_str(LONG id); +STATIC STRPTR get_str(struct CommandContext *cc, LONG id); + +/****************************************************************************/ + +/****** ROADSHOW/NETSHUTDOWN ************************************************** +* +* NAME +* NetShutdown - Attempt to shut down the network in an orderly fashion. +* +* FORMAT +* NetShutdown [TIMEOUT=] [QUIET] +* +* TEMPLATE +* TIMEOUT/N,QUIET/S +* +* FUNCTION +* The command will stop all running interfaces. +* +* OPTIONS +* TIMEOUT/N +* How many seconds this command should wait until it gives up. By +* default, it will wait up to 5 seconds for the network to shut +* down once it has triggered the shutdown process. +* +* QUIET/S +* Use this parameter to stop the command from reporting what it +* is currently doing. +* +* NOTES +* The "NetShutdown" command will trigger the shutdown process of the +* network. This process cannot be stopped once it has started. However, +* this command can make an attempt to wait until the shutdown has +* completed. Normally, the shutdown should be finished in a fraction of +* a second, but at times when other clients still hang onto the network +* resources, the shutdown can fail to complete quite so quickly. In that +* case, the "NetShutdown" command will tell you that it could not +* complete its task within the allocated time frame (within five +* seconds, or whatever timeout you specified). The shutdown, however, +* will proceed and may conclude at a later time. +* +* When this command starts up it begins by checking if the network is +* currently operational. If this is not the case, it will exit +* immediately, printing a message to this effect. +* +* SEE ALSO +* AddNetInterface +* ShowNetStatus +******************************************************************************* +*/ +LONG +_start(VOID) +{ + struct Library *SysBase = (struct Library *)AbsExecBase; + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + struct CommandContext _cc,*cc = &_cc; + LONG result = RETURN_FAIL; + struct Process * pr; + LONG error; + + memset(cc,0,sizeof(*cc)); + + pr = (struct Process *)FindTask(NULL); + if(pr->pr_CLI == ZERO) + { + struct MsgPort * mp = &pr->pr_MsgPort; + struct Message * mn; + + WaitPort(mp); + mn = GetMsg(mp); + + Forbid(); + ReplyMsg(mn); + goto out; + } + + error = open_libs(cc,SysBase); + if(error == OK) + { + DECLARE_LOCALEBASE(cc); + + if(cc->cc_LocaleBase != NULL) + cc->cc_Catalog = OpenCatalogA(NULL,"roadshow.catalog",NULL); + + result = cmd(cc); + + if(cc->cc_Catalog != NULL) + CloseCatalog(cc->cc_Catalog); + } + else + { + pr->pr_Result2 = error; + } + + close_libs(cc); + + out: + + return(result); +} + +/****************************************************************************/ + +STATIC VOID +close_libs(struct CommandContext * cc) +{ + DECLARE_SYSBASE(cc); + + #if defined(__amigaos4__) + { + if(cc->cc_IDOS != NULL) + DropInterface((struct Interface *)cc->cc_IDOS); + + if(cc->cc_ILocale != NULL) + DropInterface((struct Interface *)cc->cc_ILocale); + } + #endif /* __amigaos4__ */ + + if(cc->cc_LocaleBase != NULL) + CloseLibrary(cc->cc_LocaleBase); + + if(cc->cc_DOSBase != NULL) + CloseLibrary(cc->cc_DOSBase); +} + +/****************************************************************************/ + +STATIC LONG +open_libs(struct CommandContext * cc,struct Library *SysBase) +{ + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + LONG error; + + cc->cc_SysBase = SysBase; + + #if defined(__amigaos4__) + { + cc->cc_IExec = IExec; + } + #endif /* __amigaos4__ */ + + cc->cc_DOSBase = OpenLibrary("dos.library",36); + + #if defined(__amigaos4__) + { + if(cc->cc_DOSBase != NULL) + { + cc->cc_IDOS = (struct DOSIFace *)GetInterface(cc->cc_DOSBase, "main", 1, 0); + if(cc->cc_IDOS == NULL) + { + CloseLibrary(cc->cc_DOSBase); + cc->cc_DOSBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + if(cc->cc_DOSBase == NULL) + { + error = ERROR_INVALID_RESIDENT_LIBRARY; + goto out; + } + + cc->cc_LocaleBase = OpenLibrary("locale.library",38); + + #if defined(__amigaos4__) + { + if(cc->cc_LocaleBase != NULL) + { + cc->cc_ILocale = (struct LocaleIFace *)GetInterface(cc->cc_LocaleBase, "main", 1, 0); + if(cc->cc_ILocale == NULL) + { + CloseLibrary(cc->cc_LocaleBase); + cc->cc_LocaleBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + error = OK; + + out: + + return(error); +} + +/****************************************************************************/ + +#define CATCOMP_ARRAY +#define NETSHUTDOWN_CATALOG_STRINGS +#include "roadshow.h" + +/****************************************************************************/ + +STATIC LONG +cmd(struct CommandContext * cc) +{ + struct + { + NUMBER Timeout; + SWITCH Quiet; + } args; + + STRPTR args_template = + "TIMEOUT/N," + "QUIET/S" + VERSTAG; + + DECLARE_SYSBASE(cc); + DECLARE_DOSBASE(cc); + + struct MsgPort * timer_port = NULL; + struct timerequest * timer_request = NULL; + BOOL timer_ticking = FALSE; + LONG result = RETURN_FAIL; + struct RDArgs * rda; + struct MsgPort * reply_port = NULL; + LONG timeout; + ULONG reply_mask; + ULONG timer_mask; + ULONG signals; + struct NetControlPort * control_port; + struct NetShutdownMessage * shutdown_message = NULL; + struct NetShutdownMessage * recall_message = NULL; + LONG client_count = 0; + BOOL network_in_use; + + GetProgramName(cc->cc_ProgramName,sizeof(cc->cc_ProgramName)); + + memset(&args,0,sizeof(args)); + + rda = ReadArgs(args_template,(LONG *)&args,NULL); + if(rda == NULL) + { + PrintFault(IoErr(),cc->cc_ProgramName); + goto out; + } + + /* We wait for up to 5 seconds for the network to shut down. */ + timeout = 5; + + if(args.Timeout != NULL) + { + /* The user can override the timeout, but the minimum wait time + is exactly one second. */ + timeout = (*args.Timeout); + if(timeout < 1) + { + if(NOT args.Quiet) + PrintFault(ERROR_BAD_NUMBER,cc->cc_ProgramName); + + goto out; + } + } + + shutdown_message = AllocVec(sizeof(*shutdown_message),MEMF_ANY|MEMF_PUBLIC|MEMF_CLEAR); + recall_message = AllocVec(sizeof(*shutdown_message),MEMF_ANY|MEMF_PUBLIC|MEMF_CLEAR); + + if(shutdown_message == NULL || recall_message == NULL) + { + if(NOT args.Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_NETSHUTDOWN_NO_MEMORY_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + reply_port = CreateMsgPort(); + if(reply_port == NULL) + { + if(NOT args.Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_NETSHUTDOWN_NO_MSGPORT_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + shutdown_message->nsm_Message.mn_ReplyPort = reply_port; + shutdown_message->nsm_Message.mn_Length = sizeof(*shutdown_message); + shutdown_message->nsm_Command = NSMC_Shutdown; + shutdown_message->nsm_Data = &client_count; + shutdown_message->nsm_Length = sizeof(client_count); + + recall_message->nsm_Message.mn_ReplyPort = reply_port; + recall_message->nsm_Message.mn_Length = sizeof(*recall_message); + recall_message->nsm_Command = NSMC_Cancel; + recall_message->nsm_Data = shutdown_message; + recall_message->nsm_Length = sizeof(shutdown_message); + + timer_port = CreateMsgPort(); + if(timer_port == NULL) + { + if(NOT args.Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_NETSHUTDOWN_NO_MSGPORT_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + timer_request = (struct timerequest *)CreateIORequest(timer_port,sizeof(*timer_request)); + if(timer_request == NULL) + { + if(NOT args.Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_NETSHUTDOWN_NO_TIMER_REQUEST_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + if(OpenDevice(TIMERNAME,UNIT_VBLANK,(struct IORequest *)timer_request,0) != OK) + { + if(NOT args.Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_NETSHUTDOWN_NO_TIMER_DEVICE_TXT), + cc->cc_ProgramName,TIMERNAME); + } + + goto out; + } + + /* Try to send the shutdown message. */ + Forbid(); + + control_port = (struct NetControlPort *)FindPort(NETWORK_CONTROLLER_PORT_NAME); + + if(control_port != NULL && control_port->ncp_Magic == NCPM_Cookie) + { + network_in_use = TRUE; + + PutMsg(&control_port->ncp_Port,(struct Message *)shutdown_message); + } + else + { + network_in_use = FALSE; + } + + Permit(); + + if(NOT network_in_use) + { + if(NOT args.Quiet) + Local_ErrorPrintf(cc,get_str(cc,MSG_NETSHUTDOWN_NETWORK_NOT_IN_USE_TXT),cc->cc_ProgramName); + + result = RETURN_WARN; + goto out; + } + + reply_mask = (1UL << reply_port->mp_SigBit); + timer_mask = (1UL << timer_port->mp_SigBit); + + /* Get the timeout rolling... */ + timer_request->tr_node.io_Command = TR_ADDREQUEST; + timer_request->tr_time.tv_secs = timeout; + timer_request->tr_time.tv_micro = 0; + + SendIO((struct IORequest *)timer_request); + timer_ticking = TRUE; + + if(NOT args.Quiet) + { + Local_Printf(cc,get_str(cc,MSG_NETSHUTDOWN_TRYING_TO_SHUT_DOWN_TXT)); + Flush(Output()); + } + + /* Wait for one of three events: the 'all clear' signal from the network + controller, the user not wanting to wait any longer and the timer to + elapse. */ + signals = Wait(SIGBREAKF_CTRL_C | reply_mask | timer_mask); + + /* Did we get the 'all clear' signal? */ + if(signals & reply_mask) + { + struct ExecBase * ExecBase = (struct ExecBase *)SysBase; + struct Library * lib; + + /* Pick up the message that is waiting. */ + GetMsg(reply_port); + + /* Flush the library from memory. */ + Forbid(); + + lib = (struct Library *)FindName(&ExecBase->LibList,"bsdsocket.library"); + if(lib != NULL) + RemLibrary(lib); + + Permit(); + + if(NOT args.Quiet) + Local_Printf(cc,get_str(cc,MSG_NETSHUTDOWN_SHUTDOWN_DONE_TXT)); + + result = RETURN_OK; + } + else + { + /* OK, so we need to recall the shutdown message before we bow out. */ + + Forbid(); + + /* Look for the controller port again since it may have gone away + while we were printing messages to the console, etc. above. */ + control_port = (struct NetControlPort *)FindPort(NETWORK_CONTROLLER_PORT_NAME); + if(control_port != NULL && control_port->ncp_Magic != NCPM_Cookie) + PutMsg(&control_port->ncp_Port,(struct Message *)recall_message); + + Permit(); + + /* Wait for the two messages to return. This is indicated by the + message node types changing from NT_MESSAGE to NT_REPLYMSG, or + the message type never even changing to NT_MESSAGE (if the + message is never sent). */ + while(shutdown_message->nsm_Message.mn_Node.ln_Type == NT_MESSAGE || + recall_message->nsm_Message.mn_Node.ln_Type == NT_MESSAGE) + { + WaitPort(reply_port); + + while(TRUE) + { + if(GetMsg(reply_port) == NULL) + break; + } + } + + result = RETURN_WARN; + + if(NOT args.Quiet) + { + LONG message_code; + + if(signals & SIGBREAKF_CTRL_C) + message_code = MSG_NETSHUTDOWN_SHUTDOWN_ABORTED_TXT; + else + message_code = MSG_NETSHUTDOWN_SHUTDOWN_TIMEOUT_TXT; + + Local_Printf(cc,get_str(cc,message_code)); + } + } + + out: + + if(timer_request != NULL) + { + if(timer_ticking) + { + if(CheckIO((struct IORequest *)timer_request) == NULL) + AbortIO((struct IORequest *)timer_request); + + WaitIO((struct IORequest *)timer_request); + } + + if(timer_request->tr_node.io_Device != NULL) + CloseDevice((struct IORequest *)timer_request); + + DeleteIORequest((struct IORequest *)timer_request); + } + + DeleteMsgPort(timer_port); + + DeleteMsgPort(reply_port); + + FreeVec(shutdown_message); + FreeVec(recall_message); + + if(rda != NULL) + FreeArgs(rda); + + return(result); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_Printf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + result = VPrintf(format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + result = VPrintf(format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_ErrorPrintf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + DECLARE_SYSBASE(cc); + + va_list args; + LONG result; + BPTR fh; + + #if defined(__amigaos4__) + { + fh = ErrorOutput(); + } + #else + { + struct Process * this_process = (struct Process *)FindTask(NULL); + + fh = this_process->pr_CES; + } + #endif /* __amigaos4__ */ + + if(fh == ZERO) + fh = Output(); + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + result = VFPrintf(fh,format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + result = VFPrintf(fh,format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +/****************************************************************************/ + +/* This looks up a locale string ID in the builtin database; adapted + from CygnusEd because I couldn't find my own implementation for this + application... */ +STATIC STRPTR +get_builtin_str(LONG id) +{ + LONG top,middle,bottom; + STRPTR builtin_string; + + /* The search area is all those message between bottom and top, inclusive. */ + bottom = 0; + top = NUM_ENTRIES(CatCompArray) - 1; + + /* Binary search through the CatCompArray to find the requested string. + Note that this assumes that the strings are sorted. Catcomp defaults + to creating sorted arrays, but it does _not_ force it. If in the .cd + file you specify out of order string numbers this routine will fail. */ + while(bottom != top) + { + middle = (bottom + top) / 2; + + if(CatCompArray[middle].cca_ID >= id) + top = middle; + else + bottom = middle + 1; + } + + /* The only time this error message should occur is if you've passed + a garbage number OR if the CatCompArray is not sorted. */ + if(CatCompArray[bottom].cca_ID == id) + builtin_string = (STRPTR)CatCompArray[bottom].cca_Str; + else + builtin_string = ""; + + return(builtin_string); +} + +STATIC STRPTR +get_str(struct CommandContext * cc, LONG id) +{ + STRPTR builtin_string; + STRPTR result; + + builtin_string = get_builtin_str(id); + + if(cc->cc_Catalog != NULL) + { + DECLARE_LOCALEBASE(cc); + + result = (STRPTR)GetCatalogStr(cc->cc_Catalog,id,builtin_string); + } + else + { + result = builtin_string; + } + + return(result); +} diff --git a/examples/NetShutdown_rev.h b/examples/NetShutdown_rev.h new file mode 100644 index 0000000..08933dc --- /dev/null +++ b/examples/NetShutdown_rev.h @@ -0,0 +1,6 @@ +#define VERSION 4 +#define REVISION 7 +#define DATE "11.3.2009" +#define VERS "NetShutdown 4.7" +#define VSTRING "NetShutdown 4.7 (11.3.2009)\r\n" +#define VERSTAG "\0$VER: NetShutdown 4.7 (11.3.2009)" diff --git a/examples/README b/examples/README new file mode 100644 index 0000000..75088fb --- /dev/null +++ b/examples/README @@ -0,0 +1,12 @@ +This directory contains the source code of the programs that call into +the Roadshow bsdsocket.library to configure the TCP/IP stack and to query +status information. These programs should compile out of the box, provided +you have the necessary SDK header files installed. I tried to keep all +the necessary files together, but it might not be the complete set. +Don't worry, though, the code is merely intended to be a demonstration +as to how to do what the configuration/query programs are doing. + +This software is copyrighted, which means that you may create your own +programs using the techniques demonstrated in the source code, and +you may reuse parts of it, but you must not take this code as a whole +and claim it as your own. diff --git a/examples/RemoveNetInterface.c b/examples/RemoveNetInterface.c new file mode 100644 index 0000000..1b8b7f1 --- /dev/null +++ b/examples/RemoveNetInterface.c @@ -0,0 +1,650 @@ +/* + * $Id: RemoveNetInterface.c,v 1.6 2007-08-26 12:30:16 obarthel Exp $ + * + * :ts=4 + * + * Copyright © 2001-2007 by Olaf Barthel. All Rights Reserved. + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +/****************************************************************************/ + +#if defined(__amigaos4__) +#include +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +#if !defined(__amigaos4__) +#define NO_INLINE_STDARG +#endif /* __amigaos4__ */ + +#define __NOLIBBASE__ +#define __NOGLOBALIFACE__ +#define __USE_INLINE__ + +/****************************************************************************/ + +#include +#include +#include +#include + +/****************************************************************************/ + +#include +#include + +/****************************************************************************/ + +#include "macros.h" + +/****************************************************************************/ + +#include "RemoveNetInterface_rev.h" + +/****************************************************************************/ + +#ifndef AbsExecBase +#define AbsExecBase (*(struct ExecBase **)4) +#endif /* AbsExecBase */ + +/****************************************************************************/ + +typedef LONG * NUMBER; +typedef LONG SWITCH; +typedef STRPTR KEY; + +/****************************************************************************/ + +struct CommandContext +{ + struct Library * cc_SysBase; + struct Library * cc_DOSBase; + struct Library * cc_SocketBase; + struct Library * cc_LocaleBase; + + #if defined(__amigaos4__) + + /************************************************************************/ + + struct ExecIFace * cc_IExec; + struct DOSIFace * cc_IDOS; + struct SocketIFace * cc_ISocket; + struct LocaleIFace * cc_ILocale; + + /************************************************************************/ + + #endif /* __amigaos4__ */ + + struct Catalog * cc_Catalog; + UBYTE cc_ProgramName[256]; +}; + +/****************************************************************************/ + +#if defined(__amigaos4__) + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct ExecIFace * IExec = cc->cc_IExec; \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct DOSIFace * IDOS = cc->cc_IDOS; \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_LOCALEBASE(cc) \ + struct LocaleIFace * ILocale = cc->cc_ILocale; \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct SocketIFace * ISocket = cc->cc_ISocket; \ + struct Library * SocketBase = cc->cc_SocketBase + +/****************************************************************************/ + +#else + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_LOCALEBASE(cc) \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct Library * SocketBase = cc->cc_SocketBase + +/****************************************************************************/ + +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +LONG _start(VOID); + +/****************************************************************************/ + +STATIC VOID close_libs(struct CommandContext *cc); +STATIC LONG open_libs(struct CommandContext *cc, struct Library *SysBase); +STATIC LONG cmd(struct CommandContext *cc); +STATIC LONG VARARGS68K Local_Printf(struct CommandContext *cc, STRPTR format, ...); +STATIC LONG VARARGS68K Local_ErrorPrintf(struct CommandContext *cc, STRPTR format, ...); +STATIC STRPTR get_builtin_str(LONG id); +STATIC STRPTR get_str(struct CommandContext *cc, LONG id); +STATIC LONG VARARGS68K Local_SocketBaseTags(struct CommandContext *cc, ...); + +/****************************************************************************/ + +LONG +_start(VOID) +{ + struct Library *SysBase = (struct Library *)AbsExecBase; + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + struct CommandContext _cc,*cc = &_cc; + LONG result = RETURN_FAIL; + struct Process * pr; + LONG error; + + memset(cc,0,sizeof(*cc)); + + pr = (struct Process *)FindTask(NULL); + if(pr->pr_CLI == ZERO) + { + struct MsgPort * mp = &pr->pr_MsgPort; + struct Message * mn; + + WaitPort(mp); + mn = GetMsg(mp); + + Forbid(); + ReplyMsg(mn); + goto out; + } + + error = open_libs(cc,SysBase); + if(error == OK) + { + DECLARE_LOCALEBASE(cc); + + if(cc->cc_LocaleBase != NULL) + cc->cc_Catalog = OpenCatalogA(NULL,"roadshow.catalog",NULL); + + result = cmd(cc); + + if(cc->cc_Catalog != NULL) + CloseCatalog(cc->cc_Catalog); + } + else + { + pr->pr_Result2 = error; + } + + close_libs(cc); + + out: + + return(result); +} + +/****************************************************************************/ + +STATIC VOID +close_libs(struct CommandContext * cc) +{ + DECLARE_SYSBASE(cc); + + #if defined(__amigaos4__) + { + if(cc->cc_IDOS != NULL) + DropInterface((struct Interface *)cc->cc_IDOS); + + if(cc->cc_ILocale != NULL) + DropInterface((struct Interface *)cc->cc_ILocale); + + if(cc->cc_ISocket != NULL) + DropInterface((struct Interface *)cc->cc_ISocket); + } + #endif /* __amigaos4__ */ + + if(cc->cc_SocketBase != NULL) + CloseLibrary(cc->cc_SocketBase); + + if(cc->cc_LocaleBase != NULL) + CloseLibrary(cc->cc_LocaleBase); + + if(cc->cc_DOSBase != NULL) + CloseLibrary(cc->cc_DOSBase); +} + +/****************************************************************************/ + +STATIC LONG +open_libs(struct CommandContext * cc,struct Library *SysBase) +{ + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + LONG error; + + cc->cc_SysBase = SysBase; + + #if defined(__amigaos4__) + { + cc->cc_IExec = IExec; + } + #endif /* __amigaos4__ */ + + cc->cc_DOSBase = OpenLibrary("dos.library",36); + + #if defined(__amigaos4__) + { + if(cc->cc_DOSBase != NULL) + { + cc->cc_IDOS = (struct DOSIFace *)GetInterface(cc->cc_DOSBase, "main", 1, 0); + if(cc->cc_IDOS == NULL) + { + CloseLibrary(cc->cc_DOSBase); + cc->cc_DOSBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + if(cc->cc_DOSBase == NULL) + { + error = ERROR_INVALID_RESIDENT_LIBRARY; + goto out; + } + + cc->cc_LocaleBase = OpenLibrary("locale.library",38); + + #if defined(__amigaos4__) + { + if(cc->cc_LocaleBase != NULL) + { + cc->cc_ILocale = (struct LocaleIFace *)GetInterface(cc->cc_LocaleBase, "main", 1, 0); + if(cc->cc_ILocale == NULL) + { + CloseLibrary(cc->cc_LocaleBase); + cc->cc_LocaleBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + /* The following may be necessary to flush out an inoperable + bsdsocket.library which reached the end of the shutdown + process. */ + #if 1 + { + struct ExecBase * ex = (struct ExecBase *)SysBase; + struct Library * lib; + + Forbid(); + + lib = (struct Library *)FindName(&ex->LibList,"bsdsocket.library"); + if(lib != NULL) + RemLibrary(lib); + + Permit(); + } + #endif + + cc->cc_SocketBase = OpenLibrary("bsdsocket.library",4); + + #if defined(__amigaos4__) + { + if(cc->cc_SocketBase != NULL) + { + cc->cc_ISocket = (struct SocketIFace *)GetInterface(cc->cc_SocketBase, "main", 1, 0); + if(cc->cc_ISocket == NULL) + { + CloseLibrary(cc->cc_SocketBase); + cc->cc_SocketBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + error = OK; + + out: + + return(error); +} + +/****************************************************************************/ + +#define CATCOMP_ARRAY +#define REMOVENETINTERFACE_CATALOG_STRINGS +#include "roadshow.h" + +/****************************************************************************/ + +/****** ROADSHOW/REMOVENETINTERFACE ****************************************** +* +* NAME +* RemoveNetInterface - Make the protocol stack forget about +* a network interface +* +* FORMAT +* RemoveNetInterface [QUIET] [FORCE] INTERFACE +* +* TEMPLATE +* INTERFACE/K,QUIET/S,FORCE/S +* +* PATH +* C:REMOVENETINTERFACE +* +* FUNCTION +* REMOVENETINTERFACE attempts to shut down the specified network +* interface, so that it may be added again with different parameters. +* +* OPTIONS +* INTERFACE/K +* The name of the interface to shut down. This must be the name +* previously given to ADDNETINTERFACE. +* +* QUIET/S +* This option causes the program not to emit any error messages +* or progress reports. Also, if the program encounters an error +* it will flag this as failure code 5 which can be looked at +* using the "if warn" shell script command. If this option is +* not in effect, failure codes will be more severe and all sorts +* of progress information will be displayed. +* +* FORCE/S +* REMOVENETINTERFACE tries not to shut down an interface which +* may still be in use. You can override this with the FORCE +* option which, however, carries the risk that not all the +* resources associated with the network interface may be released +* until you shut down the network with the NETSHUTDOWN command. +* +* EXAMPLES +* Shut down the interface called "DSL", and run quietly. +* +* 1> RemoveNetInterface DSL QUIET +* +* SEE ALSO +* AddNetInterface +* NetShutdown +* +****************************************************************************** +*/ +STATIC LONG +cmd(struct CommandContext * cc) +{ + struct + { + KEY Interface; + SWITCH Force; + SWITCH Quiet; + } args; + + STRPTR args_template = + "INTERFACE/A," + "FORCE/S," + "QUIET/S" + VERSTAG; + + DECLARE_DOSBASE(cc); + DECLARE_SOCKETBASE(cc); + + LONG result = RETURN_FAIL; + struct RDArgs * rda; + BOOL quiet = FALSE; + + GetProgramName(cc->cc_ProgramName,sizeof(cc->cc_ProgramName)); + + memset(&args,0,sizeof(args)); + + rda = ReadArgs(args_template,(LONG *)&args,NULL); + if(rda == NULL) + { + PrintFault(IoErr(),cc->cc_ProgramName); + goto out; + } + + quiet = (BOOL)(args.Quiet != 0); + + if(SocketBase == NULL) + { + if(NOT quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_REMOVENETINTERFACE_CANNOT_OPEN_BSDSOCKET_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + if(CANNOT RemoveInterface(args.Interface,args.Force)) + { + result = RETURN_ERROR; + + if(NOT quiet) + { + LONG error,code; + + /* Older bsdsocket.library versions do not support the RemoveInterface() + functionality, which is why we will substitute the error code. */ + error = Errno(); + if(error == OK) + error = EBUSY; + + code = error; + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_ERRNOSTRPTR),&code, + TAG_END) != 0) + { + code = (LONG)""; + } + + Local_ErrorPrintf(cc,get_str(cc,MSG_REMOVENETINTERFACE_COULD_NOT_REMOVE_INTERFACE_TXT), + cc->cc_ProgramName,args.Interface,error,code); + } + + goto out; + } + + if(NOT quiet) + { + Local_Printf(cc,get_str(cc,MSG_REMOVENETINTERFACE_INTERFACE_REMOVED_TXT), + cc->cc_ProgramName,args.Interface); + } + + result = RETURN_OK; + + out: + + if(quiet && result != RETURN_OK) + result = RETURN_WARN; + + if(rda != NULL) + FreeArgs(rda); + + return(result); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_Printf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + result = VPrintf(format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + result = VPrintf(format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_ErrorPrintf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + DECLARE_SYSBASE(cc); + + va_list args; + LONG result; + BPTR fh; + + #if defined(__amigaos4__) + { + fh = ErrorOutput(); + } + #else + { + struct Process * this_process = (struct Process *)FindTask(NULL); + + fh = this_process->pr_CES; + } + #endif /* __amigaos4__ */ + + if(fh == ZERO) + fh = Output(); + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + result = VFPrintf(fh,format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + result = VFPrintf(fh,format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +/****************************************************************************/ + +/* This looks up a locale string ID in the builtin database; adapted + from CygnusEd because I couldn't find my own implementation for this + application... */ +STATIC STRPTR +get_builtin_str(LONG id) +{ + LONG top,middle,bottom; + STRPTR builtin_string; + + /* The search area is all those message between bottom and top, inclusive. */ + bottom = 0; + top = NUM_ENTRIES(CatCompArray) - 1; + + /* Binary search through the CatCompArray to find the requested string. + Note that this assumes that the strings are sorted. Catcomp defaults + to creating sorted arrays, but it does _not_ force it. If in the .cd + file you specify out of order string numbers this routine will fail.*/ + while(bottom != top) + { + middle = (bottom + top) / 2; + + if(CatCompArray[middle].cca_ID >= id) + top = middle; + else + bottom = middle + 1; + } + + /* The only time this error message should occur is if you've passed + a garbage number OR if the CatCompArray is not sorted. */ + if(CatCompArray[bottom].cca_ID == id) + builtin_string = (STRPTR)CatCompArray[bottom].cca_Str; + else + builtin_string = ""; + + return(builtin_string); +} + +STATIC STRPTR +get_str(struct CommandContext * cc, LONG id) +{ + STRPTR builtin_string; + STRPTR result; + + builtin_string = get_builtin_str(id); + + if(cc->cc_Catalog != NULL) + { + DECLARE_LOCALEBASE(cc); + + result = (STRPTR)GetCatalogStr(cc->cc_Catalog,id,builtin_string); + } + else + { + result = builtin_string; + } + + return(result); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_SocketBaseTags(struct CommandContext * cc,...) +{ + DECLARE_SOCKETBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,cc); + result = SocketBaseTagList(va_getlinearva(args,struct TagItem *)); + va_end(args); + } + #else + { + va_start(args,cc); + result = SocketBaseTagList((struct TagItem *)args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} diff --git a/examples/RemoveNetInterface_rev.h b/examples/RemoveNetInterface_rev.h new file mode 100644 index 0000000..de649c8 --- /dev/null +++ b/examples/RemoveNetInterface_rev.h @@ -0,0 +1,6 @@ +#define VERSION 4 +#define REVISION 3 +#define DATE "11.3.2009" +#define VERS "RemoveNetInterface 4.3" +#define VSTRING "RemoveNetInterface 4.3 (11.3.2009)\r\n" +#define VERSTAG "\0$VER: RemoveNetInterface 4.3 (11.3.2009)" diff --git a/examples/RoadshowControl.c b/examples/RoadshowControl.c new file mode 100644 index 0000000..2fd6968 --- /dev/null +++ b/examples/RoadshowControl.c @@ -0,0 +1,1218 @@ +/* + * RoadshowControl.c + * + * :ts=4 + * + * Copyright © 2001-2017 by Olaf Barthel. All Rights Reserved. + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +/****************************************************************************/ + +#if defined(__amigaos4__) +#include +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +#if !defined(__amigaos4__) +#define NO_INLINE_STDARG +#endif /* __amigaos4__ */ + +#define __NOLIBBASE__ +#define __NOGLOBALIFACE__ +#define __USE_INLINE__ + +/****************************************************************************/ + +#include +#include +#include +#include +#include + +/****************************************************************************/ + +#include +#include + +/****************************************************************************/ + +#include "macros.h" + +/****************************************************************************/ + +#include "RoadshowControl_rev.h" + +/****************************************************************************/ + +#ifndef AbsExecBase +#define AbsExecBase (*(struct ExecBase **)4) +#endif /* AbsExecBase */ + +/****************************************************************************/ + +typedef LONG * NUMBER; +typedef LONG SWITCH; +typedef STRPTR KEY; + +/****************************************************************************/ + +struct CommandContext +{ + struct Library * cc_SysBase; + struct Library * cc_DOSBase; + struct Library * cc_UtilityBase; + struct Library * cc_SocketBase; + struct Library * cc_LocaleBase; + + #if defined(__amigaos4__) + + /************************************************************************/ + + struct ExecIFace * cc_IExec; + struct DOSIFace * cc_IDOS; + struct UtilityIFace * cc_IUtility; + struct SocketIFace * cc_ISocket; + struct LocaleIFace * cc_ILocale; + + /************************************************************************/ + + #endif /* __amigaos4__ */ + + struct Catalog * cc_Catalog; + UBYTE cc_ProgramName[256]; +}; + +/****************************************************************************/ + +#if defined(__amigaos4__) + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct ExecIFace * IExec = cc->cc_IExec; \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct DOSIFace * IDOS = cc->cc_IDOS; \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_UTILITYBASE(cc) \ + struct UtilityIFace * IUtility = cc->cc_IUtility; \ + struct Library * UtilityBase = cc->cc_UtilityBase + +#define DECLARE_LOCALEBASE(cc) \ + struct LocaleIFace * ILocale = cc->cc_ILocale; \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct SocketIFace * ISocket = cc->cc_ISocket; \ + struct Library * SocketBase = cc->cc_SocketBase + +/****************************************************************************/ + +#else + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_UTILITYBASE(cc) \ + struct Library * UtilityBase = cc->cc_UtilityBase + +#define DECLARE_LOCALEBASE(cc) \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct Library * SocketBase = cc->cc_SocketBase + +/****************************************************************************/ + +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +LONG _start(VOID); + +/****************************************************************************/ + +STATIC VOID close_libs(struct CommandContext *cc); +STATIC LONG open_libs(struct CommandContext *cc, struct Library *SysBase); +STATIC LONG cmd(struct CommandContext *cc); +STATIC BOOL is_blank_space(UBYTE c); +STATIC BOOL save_settings(struct CommandContext *cc, BOOL quiet, STRPTR name, LONG value); +STATIC VOID get_errno_and_code(struct CommandContext *cc, LONG *errno_ptr, STRPTR *code_ptr); +STATIC LONG VARARGS68K Local_Printf(struct CommandContext *cc, STRPTR format, ...); +STATIC LONG VARARGS68K Local_ErrorPrintf(struct CommandContext *cc, STRPTR format, ...); +STATIC VARARGS68K VOID lsprintf(struct CommandContext *cc, STRPTR buffer, STRPTR formatString, ...); +STATIC BOOL create_path(struct CommandContext *cc, CONST_STRPTR name); +STATIC STRPTR get_builtin_str(LONG id); +STATIC STRPTR get_str(struct CommandContext *cc, LONG id); +STATIC LONG VARARGS68K Local_SocketBaseTags(struct CommandContext *cc, ...); + +/****************************************************************************/ + +LONG +_start(VOID) +{ + struct Library *SysBase = (struct Library *)AbsExecBase; + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + struct CommandContext _cc,*cc = &_cc; + LONG result = RETURN_FAIL; + struct Process * pr; + LONG error; + + memset(cc,0,sizeof(*cc)); + + pr = (struct Process *)FindTask(NULL); + if(pr->pr_CLI == ZERO) + { + struct MsgPort * mp = &pr->pr_MsgPort; + struct Message * mn; + + WaitPort(mp); + mn = GetMsg(mp); + + Forbid(); + ReplyMsg(mn); + goto out; + } + + error = open_libs(cc,SysBase); + if(error == OK) + { + DECLARE_LOCALEBASE(cc); + + if(cc->cc_LocaleBase != NULL) + cc->cc_Catalog = OpenCatalogA(NULL,"roadshow.catalog",NULL); + + result = cmd(cc); + + if(cc->cc_Catalog != NULL) + CloseCatalog(cc->cc_Catalog); + } + else + { + pr->pr_Result2 = error; + } + + close_libs(cc); + + out: + + return(result); +} + +/****************************************************************************/ + +STATIC VOID +close_libs(struct CommandContext * cc) +{ + DECLARE_SYSBASE(cc); + + #if defined(__amigaos4__) + { + if(cc->cc_IDOS != NULL) + DropInterface((struct Interface *)cc->cc_IDOS); + + if(cc->cc_ILocale != NULL) + DropInterface((struct Interface *)cc->cc_ILocale); + + if(cc->cc_ISocket != NULL) + DropInterface((struct Interface *)cc->cc_ISocket); + + if(cc->cc_IUtility != NULL) + DropInterface((struct Interface *)cc->cc_IUtility); + } + #endif /* __amigaos4__ */ + + if(cc->cc_UtilityBase != NULL) + CloseLibrary(cc->cc_UtilityBase); + + if(cc->cc_SocketBase != NULL) + CloseLibrary(cc->cc_SocketBase); + + if(cc->cc_LocaleBase != NULL) + CloseLibrary(cc->cc_LocaleBase); + + if(cc->cc_DOSBase != NULL) + CloseLibrary(cc->cc_DOSBase); +} + +/****************************************************************************/ + +STATIC LONG +open_libs(struct CommandContext * cc,struct Library *SysBase) +{ + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + LONG error; + + cc->cc_SysBase = SysBase; + + #if defined(__amigaos4__) + { + cc->cc_IExec = IExec; + } + #endif /* __amigaos4__ */ + + cc->cc_DOSBase = OpenLibrary("dos.library",36); + + #if defined(__amigaos4__) + { + if(cc->cc_DOSBase != NULL) + { + cc->cc_IDOS = (struct DOSIFace *)GetInterface(cc->cc_DOSBase, "main", 1, 0); + if(cc->cc_IDOS == NULL) + { + CloseLibrary(cc->cc_DOSBase); + cc->cc_DOSBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + if(cc->cc_DOSBase == NULL) + { + error = ERROR_INVALID_RESIDENT_LIBRARY; + goto out; + } + + cc->cc_LocaleBase = OpenLibrary("locale.library",38); + + #if defined(__amigaos4__) + { + if(cc->cc_LocaleBase != NULL) + { + cc->cc_ILocale = (struct LocaleIFace *)GetInterface(cc->cc_LocaleBase, "main", 1, 0); + if(cc->cc_ILocale == NULL) + { + CloseLibrary(cc->cc_LocaleBase); + cc->cc_LocaleBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + cc->cc_UtilityBase = OpenLibrary("utility.library",37); + + #if defined(__amigaos4__) + { + if(cc->cc_UtilityBase != NULL) + { + cc->cc_IUtility = (struct UtilityIFace *)GetInterface(cc->cc_UtilityBase, "main", 1, 0); + if(cc->cc_IUtility == NULL) + { + CloseLibrary(cc->cc_UtilityBase); + cc->cc_UtilityBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + /* The following may be necessary to flush out an inoperable + bsdsocket.library which reached the end of the shutdown + process. */ + #if 1 + { + struct ExecBase * ex = (struct ExecBase *)SysBase; + struct Library * lib; + + Forbid(); + + lib = (struct Library *)FindName(&ex->LibList,"bsdsocket.library"); + if(lib != NULL) + RemLibrary(lib); + + Permit(); + } + #endif + + cc->cc_SocketBase = OpenLibrary("bsdsocket.library",4); + + #if defined(__amigaos4__) + { + if(cc->cc_SocketBase != NULL) + { + cc->cc_ISocket = (struct SocketIFace *)GetInterface(cc->cc_SocketBase, "main", 1, 0); + if(cc->cc_ISocket == NULL) + { + CloseLibrary(cc->cc_SocketBase); + cc->cc_SocketBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + error = OK; + + out: + + return(error); +} + +/****************************************************************************/ + +#define CATCOMP_ARRAY +#define ROADSHOWCONTROL_CATALOG_STRINGS +#include "roadshow.h" + +/****************************************************************************/ + +/****** ROADSHOW/ROADSHOWCONTROL *********************************************** +* +* NAME +* RoadshowControl - Display and change internal configuration options +* +* FORMAT +* RoadshowControl [SAVE] [QUIET] [GET option] [SET option=value] +* +* TEMPLATE +* SAVE/S,QUIET/S,GET/K,SET/K/F +* +* FUNCTION +* Several internal configuration options which determine the behaviour +* of the TCP/IP stack can be changed at run time. This command will +* display/query option values and can be used to change them, too. +* +* OPTIONS +* GET/K +* Determine if a named option is supported and print its current +* value. If the option does not exist, the command will print +* an error message and return with a warning. You can test for +* the warning with the "IF" shell command. +* +* SET/K +* Change the value of an option. +* +* SAVE/S +* When combined with the SET option, also save these settings +* permanently so that they will be used the next time you start +* the TCP/IP stack. +* +* QUIET/S +* If this option is in effect, neither the SET nor the GET options +* will print the current value of an option. +* +* If you do no specify and option, all known options and their values +* will be printed. +* +* EXAMPLES +* Check if the udp.cksum option exists: +* +* 1> RoadshowControl get udp.cksum +* udp.cksum = 1 +* +* Check if the bpf.bufsize option exists: +* 1> RoadshowControl get bpf.bufsize +* bpf.bufsize: Object not found +* +* Change the tcp.use_mssdflt_for_remote option: +* 1> RoadshowControl set tcp.use_mssdflt_for_remote = 1 +* tcp.use_mssdflt_for_remote = 1 +* +* NOTES +* You really should know what you are doing when you are changing +* internal configuration options to values which are not the default +* settings. The wrong choices may render the TCP/IP inoperable! +* +* OPTIONS +* Here is a brief list of options that may be supported by your +* Roadshow installation. +* +* bpf.bufsize +* The size of the Berkeley Packet Filter buffer. +* +* icmp.maskrepl +* Controls if the ICMP layer responds to mask requests. +* This can be 1 (accept) or 0 (ignore). +* +* icmp.processecho +* Controls if the ICMP layer responds to echo requests. +* This can be 0 (accept), 1 (ignore) or 2 (drop). +* +* icmp.procesststamp +* Controls if the ICMP layer responds to time stamp requests. +* This can be 0 (accept), 1 (ignore) or 2 (drop). +* +* if.receive.useclusters +* Data received from a network interface is normally stored +* in a chunk of memory of 2048 bytes in size, which is called +* a cluster. This use of memory can be wasteful, but choosing +* to use less memory may slightly impair performance because +* the inbound data will need to be copied again. +* This option can be 1 (use clusters; this is the default) +* or 0 to use less memory at the expense of performance. +* +* if.minclustersize +* Whether data received or to be transmitted is stored in +* a single 2048 byte chunk of data or in smaller portions is +* controlled by this threshold value. Smaller threshold values +* will cause more memory to be used, larger threshold values +* may use less memory at the expense of slight performance +* impairment. The default value is 208 bytes. +* +* ip.defttl +* Controls the default time-to-live value of IP packets +* generated. +* +* ip.forwarding +* Controls if IP packets may be forwarded or not. +* This can be 1 (forward) or 0 (drop). +* +* ip.sendredirects +* Controls if ICMP redirect messages may be generated. +* This can be 1 (yes) or 0 (no). +* +* ip.subnetsarelocal +* Controls if the Internet addresses of directly +* connected hosts should be considered local, or if +* this also applies to hosts on the same subnet. +* This can be 1 (subnets are local) or 0 (they are not). +* +* task.controller.priority +* Selects the priority at which the network I/O +* controller Task runs. The priority can affect overall +* network performance. +* This must be in the range -128..127. Default is 0. +* +* tcp.do_rfc1323 +* Controls whether or not the TCP extensions for high +* performance (RFC1323) should be enabled or not. +* Specifically, this covers round trip time measurement +* and the TCP window scale option. +* This can be 1 (enable) or 0 (disable). +* +* tcp.do_timestamps +* Controls whether or not the round trip time measurement +* feature should be enabled if the tcp.do_rfc1323 option +* is enabled. +* This can be 1 (enable) or 0 (disable). +* +* tcp.do_win_scale +* Controls whether or not the TCP window scale option +* should be enabled if the tcp.do_rfc1323 option +* is enabled. +* This can be 1 (enable) or 0 (disable). +* +* tcp.mssdflt +* Controls the default TCP maximum segment size value. +* +* tcp.recvspace +* Controls the size of the default TCP receive buffer. +* +* tcp.rttdflt +* Controls the default TCP retransmit time value. +* +* tcp.sendspace +* Controls the size of the default TCP transmit buffer. +* +* tcp.use_mssdflt_for_remote +* Controls if the TCP protocol should use a smaller +* maximum segment size value for packets sent to +* hosts which are not in the local network. +* This can be 1 (yes) or 0 (no). +* +* udp.cksum +* Controls if checksums should be calculated over +* UDP datagrams to be sent and verified for UDP +* datagrams received. +* This can be 1 (yes) or 0 (no). +* +* udp.recvspace +* Controls the size of the default UDP receive buffer. +* +* udp.sendspace +* Controls the size of the default UDP transmit buffer. +* +* ENVIRONMENT VARIABLES +* It is not necessary to change the TCP/IP stack options every time you +* start it. You can also set up global environment variables with the +* SetEnv command which the TCP/IP stack will check when it is started. +* +* The environment variable names correspond to the options listed above. +* For example, Roadshow/tcp/do_win_scale corresponds to the +* tcp.do_win_scale option, Roadshow/ip/forwarding corresponds to the +* ip.forwarding option, etc. +* +* To change an environment variable, you would enter the following +* in the shell: +* +* SetEnv SAVE Roadshow/ip/forwarding 1 +* +* Note that your shell may not support the SAVE switch, or might have +* problems with environment variable names longer than 31 letters. In +* such a case you would have to get by with the MakeDir, Echo and +* Copy commands, like this: +* +* MakeDir ENV:Roadshow +* MakeDir ENV:Roadshow/ip +* Echo >ENV:Roadshow/ip/forwarding 1 +* Copy ENV:Roadshow ENVARC:Roadshow ALL QUIET +* +* To remove all the variables set by RoadshowControl, so that they are +* no longer active immediately when Roadshow starts up, delete the +* ENVARC:Roadshow folder, like this: +* +* Delete ALL QUIET ENVARC:Roadshow +* +* After the folder has been deleted you might want to restart your +* computer. +* +****************************************************************************** +*/ + +STATIC LONG +cmd(struct CommandContext * cc) +{ + struct + { + SWITCH Save; + SWITCH Quiet; + KEY Get; + KEY Set; + } args; + + STRPTR args_template = + "SAVE/S," + "QUIET/S," + "GET/K," + "SET/K/F" + VERSTAG; + + DECLARE_DOSBASE(cc); + DECLARE_UTILITYBASE(cc); + DECLARE_SOCKETBASE(cc); + + LONG result = RETURN_FAIL; + struct RDArgs * rda; + ULONG have_api = 0; + struct List * list = NULL; + struct RoadshowDataNode * rdn; + + GetProgramName(cc->cc_ProgramName,sizeof(cc->cc_ProgramName)); + + memset(&args,0,sizeof(args)); + + rda = ReadArgs(args_template,(LONG *)&args,NULL); + if(rda == NULL) + { + PrintFault(IoErr(),cc->cc_ProgramName); + goto out; + } + + if(UtilityBase == NULL) + { + if(NOT args.Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ROADSHOWCONTROL_NO_UTILITY_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + if(SocketBase == NULL) + { + if(NOT args.Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ROADSHOWCONTROL_CANNOT_OPEN_BSDSOCKET_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_HAVE_ROADSHOWDATA_API),&have_api, + TAG_END) != 0 || have_api == 0) + { + if(NOT args.Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_ROADSHOWCONTROL_BSDSOCKET_HAS_NO_ROADSHOWDATA_API_TXT), + cc->cc_ProgramName, SocketBase->lib_Node.ln_Name, SocketBase->lib_Version, SocketBase->lib_Revision); + } + + goto out; + } + + if(args.Set) + { + size_t len,i; + STRPTR key,value; + LONG number; + + list = ObtainRoadshowData(ORD_WriteAccess); + if(list == NULL) + { + if(NOT args.Quiet) + { + STRPTR error_message; + LONG errno; + + get_errno_and_code(cc,&errno,&error_message); + + Local_ErrorPrintf(cc,get_str(cc,MSG_ROADSHOWCONTROL_NO_ROADSHOW_DATA_TXT), + cc->cc_ProgramName, errno, error_message); + } + + goto out; + } + + key = args.Set; + while(is_blank_space(*key)) + key++; + + value = NULL; + + len = strlen(key); + + for(i = 0 ; i < len ; i++) + { + if(is_blank_space(key[i]) || key[i] == '=') + { + if(value == NULL) + { + value = &key[i+1]; + key[i] = '\0'; + break; + } + } + } + + if(value != NULL) + { + while(is_blank_space(*value) || (*value) == '=') + value++; + } + + if((*key) == '\0' || value == NULL || (*value) == '\0') + { + if(NOT args.Quiet) + PrintFault(ERROR_REQUIRED_ARG_MISSING,cc->cc_ProgramName); + + goto out; + } + + if(StrToLong(value,&number) < 1) + { + if(NOT args.Quiet) + PrintFault(ERROR_BAD_NUMBER,value); + + goto out; + } + + if(CANNOT ChangeRoadshowData(list,key,sizeof(number),&number)) + { + if(NOT args.Quiet) + { + STRPTR error_message; + LONG errno; + + get_errno_and_code(cc,&errno,&error_message); + + Local_ErrorPrintf(cc,get_str(cc,MSG_ROADSHOWCONTROL_COULD_NOT_SET_OPTION_TXT), + cc->cc_ProgramName, key, number, errno, error_message); + } + + goto out; + } + + if(args.Save) + { + if(CANNOT save_settings(cc,args.Quiet,key,number)) + goto out; + } + + if(NOT args.Quiet) + { + struct RoadshowDataNode * found = NULL; + + for(rdn = (struct RoadshowDataNode *)list->lh_Head ; + rdn->rdn_MinNode.mln_Succ != NULL ; + rdn = (struct RoadshowDataNode *)rdn->rdn_MinNode.mln_Succ) + { + if(Stricmp(rdn->rdn_Name,key) == SAME) + { + found = rdn; + break; + } + } + + if(found != NULL && found->rdn_Type == RDNT_Integer) + Local_Printf(cc,"%s = %ld\n",found->rdn_Name,*(int *)found->rdn_Data); + } + } + else + { + list = ObtainRoadshowData(ORD_ReadAccess); + if(list == NULL) + { + if(NOT args.Quiet) + { + STRPTR error_message; + LONG errno; + + get_errno_and_code(cc,&errno,&error_message); + + Local_ErrorPrintf(cc,get_str(cc,MSG_ROADSHOWCONTROL_NO_ROADSHOW_DATA_TXT), + cc->cc_ProgramName, errno, error_message); + } + + goto out; + } + + if(args.Get) + { + struct RoadshowDataNode * found = NULL; + + for(rdn = (struct RoadshowDataNode *)list->lh_Head ; + rdn->rdn_MinNode.mln_Succ != NULL ; + rdn = (struct RoadshowDataNode *)rdn->rdn_MinNode.mln_Succ) + { + if(Stricmp(rdn->rdn_Name,args.Get) == SAME) + { + found = rdn; + break; + } + } + + if(found == NULL || found->rdn_Type != RDNT_Integer) + { + if(NOT args.Quiet) + PrintFault(ERROR_OBJECT_NOT_FOUND,args.Get); + + result = RETURN_WARN; + goto out; + } + + if(NOT args.Quiet) + Local_Printf(cc,"%s = %ld\n",found->rdn_Name,*(int *)found->rdn_Data); + } + else + { + for(rdn = (struct RoadshowDataNode *)list->lh_Head ; + rdn->rdn_MinNode.mln_Succ != NULL ; + rdn = (struct RoadshowDataNode *)rdn->rdn_MinNode.mln_Succ) + { + if(CheckSignal(SIGBREAKF_CTRL_C)) + { + PrintFault(ERROR_BREAK,cc->cc_ProgramName); + + result = RETURN_WARN; + goto out; + } + + if(rdn->rdn_Type != RDNT_Integer) + continue; + + Local_Printf(cc,"%s = %ld\n",rdn->rdn_Name,*(int *)rdn->rdn_Data); + } + } + } + + result = RETURN_OK; + + out: + + if(list != NULL) + ReleaseRoadshowData(list); + + if(rda != NULL) + FreeArgs(rda); + + return(result); +} + +/****************************************************************************/ + +STATIC BOOL +is_blank_space(UBYTE c) +{ + BOOL result; + + result = (BOOL)(c == ' ' || c == '\t' || c == (UBYTE)'\240'); + + return(result); +} + +/****************************************************************************/ + +STATIC BOOL +save_settings(struct CommandContext * cc,BOOL quiet,STRPTR name,LONG value) +{ + DECLARE_DOSBASE(cc); + + BOOL success = FALSE; + TEXT variable_name[512]; + TEXT value_str[30]; + BPTR file = ZERO; + size_t i; + + strcpy(variable_name,"ENVARC:Roadshow/"); + strcat(variable_name,name); + + for(i = 0 ; i < strlen(variable_name) ; i++) + { + if(variable_name[i] == '.') + variable_name[i] = '/'; + } + + lsprintf(cc,(STRPTR)value_str,"%ld\n",value); + + if(CANNOT SetVar(&variable_name[7],value_str,-1,GVF_GLOBAL_ONLY)) + { + if(NOT quiet) + { + TEXT error_string[100]; + + Fault(IoErr(),NULL,error_string,sizeof(error_string)); + + Local_ErrorPrintf(cc,get_str(cc,MSG_ROADSHOWCONTROL_COULD_NOT_SET_ENV_VARIABLE_TXT), + cc->cc_ProgramName, &variable_name[7], IoErr(), error_string); + } + + goto out; + } + + if(CANNOT create_path(cc,variable_name) || + (file = Open(variable_name,MODE_NEWFILE)) == ZERO || + Write(file,value_str,strlen(value_str)) == -1) + { + if(NOT quiet) + { + TEXT error_string[100]; + + Fault(IoErr(),NULL,error_string,sizeof(error_string)); + + Local_ErrorPrintf(cc,get_str(cc,MSG_ROADSHOWCONTROL_COULD_NOT_SET_ENV_VARIABLE_TXT), + cc->cc_ProgramName, variable_name, IoErr(), error_string); + } + + goto out; + } + + success = TRUE; + + out: + + if(file != ZERO) + Close(file); + + return(success); +} + +/****************************************************************************/ + +STATIC VOID +get_errno_and_code(struct CommandContext * cc,LONG * errno_ptr,STRPTR * code_ptr) +{ + LONG errno = 0; + LONG code; + + Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_ERRNO),&errno, + TAG_END); + + code = errno; + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_ERRNOSTRPTR),&code, + TAG_END) != 0) + { + code = 0; + } + + (*errno_ptr) = errno; + (*code_ptr) = (STRPTR)code; +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_Printf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + result = VPrintf(format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + result = VPrintf(format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_ErrorPrintf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + DECLARE_SYSBASE(cc); + + va_list args; + LONG result; + BPTR fh; + + #if defined(__amigaos4__) + { + fh = ErrorOutput(); + } + #else + { + struct Process * this_process = (struct Process *)FindTask(NULL); + + fh = this_process->pr_CES; + } + #endif /* __amigaos4__ */ + + if(fh == ZERO) + fh = Output(); + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + result = VFPrintf(fh,format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + result = VFPrintf(fh,format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +/****************************************************************************/ + +STATIC VARARGS68K VOID +lsprintf(struct CommandContext * cc,STRPTR buffer,STRPTR formatString,...) +{ + DECLARE_SYSBASE(cc); + + va_list varArgs; + + #if defined(__amigaos4__) + { + va_startlinear(varArgs,formatString); + RawDoFmt(formatString,va_getlinearva(varArgs,APTR),NULL,buffer); + va_end(varArgs); + } + #else + { + va_start(varArgs,formatString); + RawDoFmt(formatString,varArgs,(VOID (*)())"\x16\xC0\x4E\x75",buffer); + va_end(varArgs); + } + #endif /* __amigaos4__ */ +} + +/****************************************************************************/ + +STATIC BOOL +create_path(struct CommandContext * cc,CONST_STRPTR name) +{ + DECLARE_SYSBASE(cc); + DECLARE_DOSBASE(cc); + + STRPTR name_copy = NULL; + BPTR lock = ZERO; + BOOL result = FALSE; + + /* Don't try to do anything if the name is just a name and does not + include any path component. */ + if(FilePart((STRPTR)name) != (STRPTR)name) + { + size_t len,i; + STRPTR tail; + + len = strlen(name); + + name_copy = AllocVec((ULONG)len+1,MEMF_ANY|MEMF_PUBLIC); + if(name_copy == NULL) + goto out; + + memcpy(name_copy,name,len+1); + + /* Isolate the path name component. */ + tail = PathPart(name_copy); + (*tail) = '\0'; + + /* Now figure out if there is any path to be created. */ + len = strlen(name_copy); + if(len == 0 || name_copy[len-1] == ':') + { + result = TRUE; + goto out; + } + + /* Now rattle down the path, checking if all the components are + present. If one is missing, create it and move on. */ + for(i = 0 ; i <= len ; i++) + { + if(name_copy[i] == '/' || name_copy[i] == '\0') + { + TEXT c; + + /* Cut off anything to follow this part of the + directory path. */ + c = name_copy[i]; + name_copy[i] = '\0'; + + /* Does the path exist? */ + lock = Lock(name_copy,SHARED_LOCK); + if(lock == ZERO) + { + /* It doesn't. But is this because a directory is missing? */ + if(IoErr() != ERROR_OBJECT_NOT_FOUND) + goto out; + + /* Try to create the missing path part. */ + lock = CreateDir(name_copy); + if(lock == ZERO) + goto out; + } + + name_copy[i] = c; + + UnLock(lock); + lock = ZERO; + } + } + } + + result = TRUE; + + out: + + UnLock(lock); + + FreeVec(name_copy); + + return(result); +} + +/****************************************************************************/ + +/* This looks up a locale string ID in the builtin database; adapted + from CygnusEd because I couldn't find my own implementation for this + application... */ +STATIC STRPTR +get_builtin_str(LONG id) +{ + LONG top,middle,bottom; + STRPTR builtin_string; + + /* The search area is all those message between bottom and top, inclusive. */ + bottom = 0; + top = NUM_ENTRIES(CatCompArray) - 1; + + /* Binary search through the CatCompArray to find the requested string. + Note that this assumes that the strings are sorted. Catcomp defaults + to creating sorted arrays, but it does _not_ force it. If in the .cd + file you specify out of order string numbers this routine will fail. */ + while(bottom != top) + { + middle = (bottom + top) / 2; + + if(CatCompArray[middle].cca_ID >= id) + top = middle; + else + bottom = middle + 1; + } + + /* The only time this error message should occur is if you've passed + a garbage number OR if the CatCompArray is not sorted. */ + if(CatCompArray[bottom].cca_ID == id) + builtin_string = (STRPTR)CatCompArray[bottom].cca_Str; + else + builtin_string = ""; + + return(builtin_string); +} + +STATIC STRPTR +get_str(struct CommandContext * cc, LONG id) +{ + STRPTR builtin_string; + STRPTR result; + + builtin_string = get_builtin_str(id); + + if(cc->cc_Catalog != NULL) + { + DECLARE_LOCALEBASE(cc); + + result = (STRPTR)GetCatalogStr(cc->cc_Catalog,id,builtin_string); + } + else + { + result = builtin_string; + } + + return(result); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_SocketBaseTags(struct CommandContext * cc,...) +{ + DECLARE_SOCKETBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,cc); + result = SocketBaseTagList(va_getlinearva(args,struct TagItem *)); + va_end(args); + } + #else + { + va_start(args,cc); + result = SocketBaseTagList((struct TagItem *)args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} diff --git a/examples/RoadshowControl_rev.h b/examples/RoadshowControl_rev.h new file mode 100644 index 0000000..537e205 --- /dev/null +++ b/examples/RoadshowControl_rev.h @@ -0,0 +1,6 @@ +#define VERSION 4 +#define REVISION 9 +#define DATE "23.4.2017" +#define VERS "RoadshowControl 4.9" +#define VSTRING "RoadshowControl 4.9 (23.4.2017)\r\n" +#define VERSTAG "\0$VER: RoadshowControl 4.9 (23.4.2017)" diff --git a/examples/SampleNetSpeed.c b/examples/SampleNetSpeed.c new file mode 100644 index 0000000..c2a888c --- /dev/null +++ b/examples/SampleNetSpeed.c @@ -0,0 +1,1125 @@ +/* + * $Id: SampleNetSpeed.c,v 1.13 2007-08-26 12:30:16 obarthel Exp $ + * + * :ts=4 + * + * Copyright © 2001-2007 by Olaf Barthel. All Rights Reserved. + */ + +/****************************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include +#include + +#include + +/*****************************************************************************/ + +#undef __NOGLOBALIFACE__ +#define __USE_INLINE__ +#define __NOLIBBASE__ + +/*****************************************************************************/ + +#include +#include +#include +#include +#include +#include + +/*****************************************************************************/ + +#include +#include +#include + +/****************************************************************************/ + +/* A quick workaround for the timeval/timerequest->TimeVal/TimeRequest + change in the recent OS4 header files. */ + +#if defined(__NEW_TIMEVAL_DEFINITION_USED__) + +#define timeval TimeVal +#define tv_secs Seconds +#define tv_micro Microseconds + +#define timerequest TimeRequest +#define tr_node Request +#define tr_time Time + +#endif /* __NEW_TIMEVAL_DEFINITION_USED__ */ + +/****************************************************************************/ + +#include "SampleNetSpeed_rev.h" +STRPTR Version = VERSTAG; + +/****************************************************************************/ + +#include "macros.h" + +/****************************************************************************/ + +/*#define DEBUG*/ +#include "assert.h" + +/****************************************************************************/ + +#define PORT_SIG_MASK(mp) (1UL << (mp)->mp_SigBit) + +/****************************************************************************/ + +extern struct Library * SysBase; +extern struct Library * DOSBase; + +/****************************************************************************/ + +struct Library * IntuitionBase; +struct Library * GfxBase; +struct Library * SocketBase; +struct Device * TimerBase; + +/****************************************************************************/ + +#if defined(__amigaos4__) + +struct IntuitionIFace * IIntuition; +struct GraphicsIFace * IGraphics; +struct SocketIFace * ISocket; +struct TimerIFace * ITimer; + +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +struct MsgPort * TimePort; +struct timerequest * TimeRequest; + +/****************************************************************************/ + +UBYTE Title[100]; +struct Window * Window; +struct DrawInfo * DrawInfo; +struct TextFont * Font; + +/****************************************************************************/ + +UBYTE InterfaceName[20]; +struct timeval LastSampleTime; +SBQUAD_T LastSampleIn; +SBQUAD_T LastSampleOut; + +/****************************************************************************/ + +ULONG MaxSent; +ULONG MaxSentReceived; +ULONG MaxReceived; +ULONG LastSent; +ULONG LastReceived; +ULONG TotalReceived; +ULONG TotalSent; +ULONG TotalCounted; + +/****************************************************************************/ + +ULONG * HistoryReceived; +ULONG * HistorySent; +LONG HistorySize; + +/****************************************************************************/ + +VOID local_sprintf(STRPTR buffer, STRPTR formatString, ...); +VOID cleanup(void); +BOOL setup(void); +void print_stats(void); +void clear_display(void); +void redraw_display(void); +void update_display(BOOL can_draw); + +/****************************************************************************/ + +#if defined(__GNUC__) && !defined(__amigaos4__) + +#undef Printf + +LONG +Printf(STRPTR format,...) +{ + va_list arg; + LONG result; + + va_start(arg,format); + result = VPrintf(format,arg); + va_end(arg); + + return(result); +} + +#endif /* __GNUC__ && !__amigaos4__ */ + +/****************************************************************************/ + +VOID VARARGS68K +local_sprintf(STRPTR buffer, STRPTR formatString, ...) +{ + va_list varArgs; + + #if defined(__amigaos4__) + { + va_startlinear(varArgs,formatString); + RawDoFmt(formatString,va_getlinearva(varArgs,APTR),(VOID (*)())NULL,buffer); + va_end(varArgs); + } + #else + { + va_start(varArgs,formatString); + RawDoFmt(formatString,varArgs,(VOID (*)())"\x16\xC0\x4E\x75",buffer); + va_end(varArgs); + } + #endif /* __amigaos4__ */ +} + +/****************************************************************************/ + +VOID +cleanup(void) +{ + if(HistoryReceived != NULL) + { + FreeVec(HistoryReceived); + HistoryReceived = NULL; + } + + if(DrawInfo != NULL) + { + FreeScreenDrawInfo(Window->WScreen,DrawInfo); + DrawInfo = NULL; + } + + if(Window != NULL) + { + CloseWindow(Window); + Window = NULL; + } + + #if defined(__amigaos4__) + { + DropInterface((struct Interface *)ITimer); + } + #endif /* __amigaos4__ */ + + if(TimeRequest != NULL) + { + if(TimeRequest->tr_node.io_Device != NULL) + CloseDevice((struct IORequest *)TimeRequest); + + DeleteIORequest((struct IORequest *)TimeRequest); + TimeRequest = NULL; + } + + if(TimePort != NULL) + { + DeleteMsgPort(TimePort); + TimePort = NULL; + } + + if(Font != NULL) + { + CloseFont(Font); + Font = NULL; + } + + #if defined(__amigaos4__) + { + DropInterface((struct Interface *)ISocket); + DropInterface((struct Interface *)IGraphics); + DropInterface((struct Interface *)IIntuition); + } + #endif /* __amigaos4__ */ + + if(SocketBase != NULL) + { + CloseLibrary(SocketBase); + SocketBase = NULL; + } + + if(GfxBase != NULL) + { + CloseLibrary(GfxBase); + GfxBase = NULL; + } + + if(IntuitionBase != NULL) + { + CloseLibrary(IntuitionBase); + IntuitionBase = NULL; + } +} + +/****************************************************************************/ + +BOOL +setup(void) +{ + STATIC struct TextAttr topaz = + { + "topaz.font", + 8, + FS_NORMAL, + FPF_ROMFONT|FPF_DESIGNED + }; + + struct + { + STRPTR Interface; + LONG * Left; + LONG * Top; + LONG * Width; + LONG * Height; + STRPTR Screen; + } args; + + struct RDArgs * rda = NULL; + BOOL success = FALSE; + LONG left,top,width,height; + + if(SysBase->lib_Version < 36) + goto out; + + /* The following may be necessary to flush out an inoperable + bsdsocket.library which reached the end of the shutdown + process. */ + #if 1 + { + struct ExecBase * ex = (struct ExecBase *)SysBase; + struct Library * lib; + + Forbid(); + + lib = (struct Library *)FindName(&ex->LibList,"bsdsocket.library"); + if(lib != NULL) + RemLibrary(lib); + + Permit(); + } + #endif + + SocketBase = OpenLibrary("bsdsocket.library",4); + + #if defined(__amigaos4__) + { + if(SocketBase != NULL) + { + ISocket = (struct SocketIFace *)GetInterface(SocketBase, "main", 1, 0); + if(ISocket == NULL) + { + CloseLibrary(SocketBase); + SocketBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + if(SocketBase == NULL) + { + Printf("Could not open 'bsdsocket.library' V4.\n"); + goto out; + } + + IntuitionBase = OpenLibrary("intuition.library",37); + + #if defined(__amigaos4__) + { + if(IntuitionBase != NULL) + { + IIntuition = (struct IntuitionIFace *)GetInterface(IntuitionBase, "main", 1, 0); + if(IIntuition == NULL) + { + CloseLibrary(IntuitionBase); + IntuitionBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + if(IntuitionBase == NULL) + { + Printf("Could not open 'intuition.library' V37.\n"); + goto out; + } + + GfxBase = OpenLibrary("graphics.library",37); + + #if defined(__amigaos4__) + { + if(GfxBase != NULL) + { + IGraphics = (struct GraphicsIFace *)GetInterface(GfxBase, "main", 1, 0); + if(IGraphics == NULL) + { + CloseLibrary(GfxBase); + GfxBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + if(GfxBase == NULL) + { + Printf("Could not open 'graphics.library' V37.\n"); + goto out; + } + + TimePort = CreateMsgPort(); + if(TimePort == NULL) + { + Printf("Could not create timer message port.\n"); + goto out; + } + + TimeRequest = (struct timerequest *)CreateIORequest(TimePort,sizeof(*TimeRequest)); + if(TimeRequest == NULL) + { + Printf("Could not create timer I/O request.\n"); + goto out; + } + + if(OpenDevice(TIMERNAME,UNIT_VBLANK,(struct IORequest *)TimeRequest,0) != OK) + { + Printf("Could not open 'timer.device'.\n"); + goto out; + } + + TimerBase = TimeRequest->tr_node.io_Device; + + #if defined(__amigaos4__) + { + ITimer = (struct TimerIFace *)GetInterface((struct Library *)TimerBase, "main", 1, 0); + if(ITimer == NULL) + { + Printf("Could not access 'timer.device' interface.\n"); + goto out; + } + } + #endif /* __amigaos4__ */ + + memset(&args,0,sizeof(args)); + + rda = ReadArgs("INTERFACE,LEFT/N,TOP/N,WIDTH/N,HEIGHT/N,SCREEN/K",(LONG *)&args,NULL); + if(rda == NULL) + { + PrintFault(IoErr(),"Sample"); + goto out; + } + + if(args.Interface != NULL) + { + LONG len; + + len = strlen(args.Interface); + if(len > sizeof(InterfaceName)-1) + len = sizeof(InterfaceName)-1; + + memcpy(InterfaceName,args.Interface,len); + InterfaceName[len] = '\0'; + } + + if(args.Left != NULL) + left = (*args.Left); + else + left = -1; + + if(args.Top != NULL) + top = (*args.Top); + else + top = -1; + + if(args.Width != NULL) + width = (*args.Width); + else + width = 300; + + if(args.Height != NULL) + height = (*args.Height); + else + height = 50; + + if(width < 30) + width = 30; + + if(height < 40) + height = 40; + + GetSysTime(&LastSampleTime); + + if(InterfaceName[0] != '\0') + { + local_sprintf(Title,"%s I/O performance",InterfaceName); + + if(QueryInterfaceTags(InterfaceName, + IFQ_GetBytesIn, &LastSampleIn, + IFQ_GetBytesOut, &LastSampleOut, + TAG_END) != 0) + { + Printf("Could not query data throughput statistics for interface '%s'.\n",InterfaceName); + goto out; + } + } + else + { + strcpy(Title,"TCP/IP I/O performance"); + + if(SocketBaseTags( + SBTM_GETREF(SBTC_GET_BYTES_RECEIVED), &LastSampleIn, + SBTM_GETREF(SBTC_GET_BYTES_SENT), &LastSampleOut, + TAG_END) != 0) + { + Printf("Could not query data throughput statistics.\n"); + goto out; + } + } + + Font = OpenFont(&topaz); + if(Font == NULL) + { + Printf("Could not open default font topaz/8.\n"); + goto out; + } + + Window = OpenWindowTags(NULL, + WA_Title, Title, + WA_SizeGadget, TRUE, + WA_DragBar, TRUE, + WA_DepthGadget, TRUE, + WA_CloseGadget, TRUE, + WA_NoCareRefresh, TRUE, + WA_RMBTrap, TRUE, + WA_SmartRefresh, TRUE, + WA_SizeBRight, TRUE, + (left >= 0) ? WA_Left : TAG_IGNORE,left, + (top >= 0) ? WA_Top : TAG_IGNORE,top, + WA_InnerWidth, width, + WA_InnerHeight, height, + WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_NEWSIZE | IDCMP_VANILLAKEY, + (args.Screen != NULL) ? WA_PubScreenName : TAG_IGNORE, args.Screen, + TAG_END); + if(Window == NULL) + { + Printf("Could not open window.\n"); + goto out; + } + + HistorySize = Window->WScreen->Width; + + HistoryReceived = AllocVec(HistorySize * 2 * sizeof(ULONG),MEMF_ANY|MEMF_CLEAR); + if(HistoryReceived) + HistorySent = HistoryReceived + HistorySize; + else + HistorySize = 0; + + WindowLimits(Window, + Window->BorderLeft + 10 + Window->BorderRight, + Window->BorderTop + 20 + Font->tf_YSize+1 + Window->BorderBottom, + Window->WScreen->Width, + Window->WScreen->Height); + + DrawInfo = GetScreenDrawInfo(Window->WScreen); + if(DrawInfo == NULL) + { + Printf("Could not get screen drawing information.\n"); + goto out; + } + + SetBPen(Window->RPort,DrawInfo->dri_Pens[BACKGROUNDPEN]); + SetDrMd(Window->RPort,JAM2); + + SetFont(Window->RPort,Font); + + clear_display(); + + success = TRUE; + + out: + + if(rda != NULL) + FreeArgs(rda); + + if(NO success) + cleanup(); + + return(success); +} + +/****************************************************************************/ + +void +print_stats(void) +{ + struct RastPort * rp = Window->RPort; + UBYTE buffer[300]; + ULONG avg_sent; + ULONG avg_received; + struct TextExtent te; + LONG width; + LONG len; + + if(TotalCounted > 0) + { + avg_sent = TotalSent / TotalCounted; + avg_received = TotalReceived / TotalCounted; + } + else + { + avg_sent = 0; + avg_received = 0; + } + + local_sprintf(buffer,"max %lD/%lD avg %lD/%lD last %lD/%lD", + MaxReceived,MaxSent, + avg_received,avg_sent, + LastReceived,LastSent); + + width = Window->Width - (Window->BorderLeft + Window->BorderRight); + + len = TextFit(rp,buffer,strlen(buffer),&te,NULL,1,width,32767); + + if(len > 0) + { + SetAPen(rp,DrawInfo->dri_Pens[TEXTPEN]); + + Move(rp,Window->BorderLeft,Window->Height - (Window->BorderBottom + Font->tf_YSize - Font->tf_Baseline)); + Text(rp,buffer,len); + + SetAPen(rp,DrawInfo->dri_Pens[BACKGROUNDPEN]); + + RectFill(rp, + Window->BorderLeft,Window->Height - (Window->BorderBottom + Font->tf_YSize + 1), + Window->Width - (Window->BorderRight + 1),Window->Height - (Window->BorderBottom + Font->tf_YSize + 1)); + } + + if(te.te_Width < width) + { + SetAPen(rp,DrawInfo->dri_Pens[BACKGROUNDPEN]); + + RectFill(rp, + Window->BorderLeft + te.te_Width,Window->Height - (Window->BorderBottom + Font->tf_YSize), + Window->Width - (Window->BorderRight + 1),Window->Height - (Window->BorderBottom + 1)); + } +} + +/****************************************************************************/ + +void +clear_display(void) +{ + struct RastPort * rp = Window->RPort; + LONG height; + LONG top; + + SetAPen(rp,DrawInfo->dri_Pens[BACKGROUNDPEN]); + RectFill(rp, + Window->BorderLeft, + Window->BorderTop, + Window->Width - (Window->BorderRight+1), + Window->Height - (Window->BorderBottom+1)); + + height = Window->Height - (Window->BorderTop + Window->BorderBottom + (Font->tf_YSize+1)); + top = height - ((height / 2) + 1); + + SetAPen(rp,DrawInfo->dri_Pens[SHADOWPEN]); + RectFill(rp, + Window->BorderLeft,Window->BorderTop + top, + Window->Width - (Window->BorderRight + 1),Window->BorderTop + top); + + print_stats(); +} + +/****************************************************************************/ + +void +redraw_display(void) +{ + struct RastPort * rp = Window->RPort; + LONG width,height; + LONG mid; + LONG top; + LONG bottom; + LONG i; + + SetAPen(rp,DrawInfo->dri_Pens[BACKGROUNDPEN]); + RectFill(rp, + Window->BorderLeft, + Window->BorderTop, + Window->Width - (Window->BorderRight+1), + Window->Height - (Window->BorderBottom+1)); + + height = Window->Height - (Window->BorderTop + Window->BorderBottom + (Font->tf_YSize+1)); + width = Window->Width - (Window->BorderLeft + Window->BorderRight); + + mid = height / 2; + + top = height - (mid + 1); + bottom = height - (top + 1); + + for(i = 0 ; i < width ; i++) + { + if(MaxSentReceived > 0) + { + ULONG received = (HistoryReceived[HistorySize - width + i] * top) / MaxSentReceived; + ULONG sent = (HistorySent[HistorySize - width + i] * bottom) / MaxSentReceived; + + if(received > 0) + { + SetAPen(rp,DrawInfo->dri_Pens[SHINEPEN]); + RectFill(rp, + Window->BorderLeft+i,Window->BorderTop + top - received, + Window->BorderLeft+i,Window->BorderTop + top - 1); + } + + if(sent > 0) + { + SetAPen(rp,DrawInfo->dri_Pens[FILLPEN]); + RectFill(rp, + Window->BorderLeft+i,Window->BorderTop + top + 1, + Window->BorderLeft+i,Window->BorderTop + top + 1 + sent - 1); + } + } + } + + SetAPen(rp,DrawInfo->dri_Pens[SHADOWPEN]); + RectFill(rp, + Window->BorderLeft,Window->BorderTop + top, + Window->Width - (Window->BorderRight + 1),Window->BorderTop + top); + + print_stats(); +} + +/****************************************************************************/ + +ULONG +quad_delta(const SBQUAD_T * a,const SBQUAD_T * b) +{ + ULONG result = 0; + SBQUAD_T delta; + + delta = (*a); + + if(delta.sbq_Low < b->sbq_Low) + { + if(delta.sbq_High == 0) + goto out; + + delta.sbq_High--; + + delta.sbq_Low = (~0UL) - b->sbq_Low + 1 + a->sbq_Low; + } + else + { + delta.sbq_Low -= b->sbq_Low; + } + + if(delta.sbq_High < b->sbq_High) + goto out; + + /*delta.sbq_High -= b->sbq_High;*/ + + result = delta.sbq_Low; + + out: + + return(result); +} + +/****************************************************************************/ + +#define REDRAW_DISPLAY TRUE +#define PRETEND_TO_REDRAW_DISPLAY FALSE + +/****************************************************************************/ + +void +update_display(BOOL can_draw) +{ + STATIC BOOL catch_up; + struct RastPort * rp = Window->RPort; + struct timeval now; + SBQUAD_T sample_in; + SBQUAD_T sample_out; + struct timeval tv; + LONG height; + LONG mid; + LONG top; + LONG bottom; + ULONG sent; + ULONG received; + BOOL redraw; + + GetSysTime(&now); + + if(InterfaceName[0] != '\0') + { + if(QueryInterfaceTags(InterfaceName, + IFQ_GetBytesIn, &sample_in, + IFQ_GetBytesOut, &sample_out, + TAG_END) != 0) + { + memset(&sample_in,0,sizeof(sample_in)); + memset(&sample_out,0,sizeof(sample_out)); + } + } + else + { + if(SocketBaseTags( + SBTM_GETREF(SBTC_GET_BYTES_RECEIVED), &sample_in, + SBTM_GETREF(SBTC_GET_BYTES_SENT), &sample_out, + TAG_END) != 0) + { + memset(&sample_in,0,sizeof(sample_in)); + memset(&sample_out,0,sizeof(sample_out)); + } + } + + if(NOT can_draw) + catch_up = TRUE; + + height = Window->Height - (Window->BorderTop + Window->BorderBottom + (Font->tf_YSize+1)); + + mid = height / 2; + + top = height - (mid + 1); + bottom = height - (top + 1); + + tv = now; + SubTime(&tv,&LastSampleTime); + + received = quad_delta(&sample_in,&LastSampleIn); + sent = quad_delta(&sample_out,&LastSampleOut); + + LastSampleTime = now; + LastSampleIn = sample_in; + LastSampleOut = sample_out; + + if(tv.tv_secs > 0 || tv.tv_micro > 0) + { + double f; + + f = (double)tv.tv_secs + (double)tv.tv_micro / 1000000.0; + + sent = (ULONG)((double)sent / f); + received = (ULONG)((double)received / f); + } + else + { + sent = received = 0; + } + + if(HistorySize > 0) + { + memmove(HistoryReceived,HistoryReceived+1,sizeof(ULONG) * (HistorySize-1)); + memmove(HistorySent,HistorySent+1,sizeof(ULONG) * (HistorySize-1)); + + HistoryReceived[HistorySize-1] = received; + HistorySent[HistorySize-1] = sent; + } + + if(sent != 0) + LastSent = sent; + + if(received != 0) + LastReceived = received; + + TotalSent += sent; + TotalReceived += received; + TotalCounted += 1; + + redraw = FALSE; + + if(sent > MaxSent) + { + MaxSent = sent; + if(sent > MaxSentReceived) + MaxSentReceived = sent; + + redraw = TRUE; + } + + if(received > MaxReceived) + { + MaxReceived = received; + if(received > MaxSentReceived) + MaxSentReceived = received; + + redraw = TRUE; + } + + if(catch_up) + { + if(NOT redraw) + clear_display(); + + redraw = TRUE; + } + + if(can_draw) + { + if(redraw && HistorySize > 0) + { + redraw_display(); + } + else + { + SetBPen(rp,DrawInfo->dri_Pens[BACKGROUNDPEN]); + ScrollRaster(rp,1,0, + Window->BorderLeft, + Window->BorderTop, + Window->Width - (Window->BorderRight+1), + Window->Height - (Window->BorderBottom+1+Font->tf_YSize+1)); + + SetAPen(rp,DrawInfo->dri_Pens[SHADOWPEN]); + WritePixel(rp,Window->Width - (Window->BorderRight+1),Window->BorderTop + top); + + if(MaxSentReceived > 0) + { + received = (received * top) / MaxSentReceived; + sent = (sent * bottom) / MaxSentReceived; + } + else + { + received = 0; + sent = 0; + } + + if(received > 0) + { + SetAPen(rp,DrawInfo->dri_Pens[SHINEPEN]); + RectFill(rp, + Window->Width - (Window->BorderRight+1),Window->BorderTop + top - received, + Window->Width - (Window->BorderRight+1),Window->BorderTop + top - 1); + } + + if(sent > 0) + { + SetAPen(rp,DrawInfo->dri_Pens[FILLPEN]); + RectFill(rp, + Window->Width - (Window->BorderRight+1),Window->BorderTop + top + 1, + Window->Width - (Window->BorderRight+1),Window->BorderTop + top + 1 + sent - 1); + } + } + + print_stats(); + + catch_up = FALSE; + } +} + +/****************************************************************************/ + +/****** ROADSHOW/SAMPLENETSPEED ************************************************ +* +* NAME +* SampleNetSpeed - Display network I/O performance +* +* FORMAT +* SampleNetSpeed [[INTERFACE] ] [LEFT ] +* [TOP ] [WIDTH ] +* [HEIGHT ] [SCREEN ] +* +* TEMPLATE +* INTERFACE,LEFT/N,TOP/N,WIDTH/N,HEIGHT/N,SCREEN/K +* +* FUNCTION +* The command can be used to gather statistics on the performance of +* a specific network interface or all network interfaces used by the +* TCP/IP stack. Performance is measured as data throughput when sending +* or receiving data packets to/from the network. +* +* The performance data is sampled once every second and visualized in +* a window which is updated regularly. In the top half of the window +* the amount of data received is displayed, while the bottom half shows +* the amount of data sent. The sizes of the bars representing the +* performance are always using the same scale. At the bottom of the +* window three figures are printed (from left to right): maximum +* throughput, averaged throughput, last throughput. For each of these +* figures the values are displayed in the form "number of bytes +* received per second / number of bytes sent per second". +* +* OPTIONS +* INTERFACE +* The name of the interface whose performance should be sampled. +* If omitted, information on all networking interfaces will be +* gathered. +* +* LEFT +* TOP +* These parameters are optional; you can specify the position of +* the window to open. Default is to open it in the top left corner +* of the screen. +* +* WIDTH +* HEIGHT +* These parameters are optional; you can specify the size of the +* window to open. Default is to open a window that can display a +* 300 by 50 pixel area. Note that width and height actually refer +* to the size of the display area and not the total size of the +* window. +* +* SCREEN +* You can specify the name of a public screen to open the window +* on. If omitted, the window will open on the default public +* screen, which is usually the Workbench screen. +* +* NOTES +* To stop the command, either click on the window close gadget in the +* top left corner or send a break signal to it in the shell. +* +****************************************************************************** +*/ + +int +main(int argc,char **argv) +{ + if(setup()) + { + ULONG time_mask; + ULONG window_mask; + ULONG signal_mask; + ULONG signals; + BOOL done; + + time_mask = PORT_SIG_MASK(TimePort); + window_mask = PORT_SIG_MASK(Window->UserPort); + + signal_mask = SIGBREAKF_CTRL_C | time_mask | window_mask; + signals = 0; + + done = FALSE; + + TimeRequest->tr_node.io_Command = TR_ADDREQUEST; + TimeRequest->tr_time.tv_secs = 1; + TimeRequest->tr_time.tv_micro = 0; + SendIO((struct IORequest *)TimeRequest); + + do + { + if(signals == 0) + signals = Wait(signal_mask); + else + signals |= SetSignal(0,signal_mask) & signal_mask; + + if(signals & time_mask) + { + if(GetMsg(TimePort) != NULL) + { + if(AttemptLockLayerRom(Window->WLayer)) + { + update_display(REDRAW_DISPLAY); + + UnlockLayerRom(Window->WLayer); + } + else + { + update_display(PRETEND_TO_REDRAW_DISPLAY); + } + + TimeRequest->tr_node.io_Command = TR_ADDREQUEST; + TimeRequest->tr_time.tv_secs = 1; + TimeRequest->tr_time.tv_micro = 0; + + SendIO((struct IORequest *)TimeRequest); + } + else + { + signals &= ~time_mask; + } + } + + if(signals & window_mask) + { + struct IntuiMessage * imsg; + + imsg = (struct IntuiMessage *)GetMsg(Window->UserPort); + if(imsg != NULL) + { + ULONG class = imsg->Class; + UWORD code = imsg->Code; + + ReplyMsg((struct Message *)imsg); + + if(class == IDCMP_CLOSEWINDOW) + { + done = TRUE; + } + else if (class == IDCMP_NEWSIZE) + { + LockLayerRom(Window->WLayer); + + if(HistorySize > 0) + { + redraw_display(); + } + else + { + clear_display(); + + update_display(REDRAW_DISPLAY); + } + + UnlockLayerRom(Window->WLayer); + + if(CheckIO((struct IORequest *)TimeRequest) == BUSY) + AbortIO((struct IORequest *)TimeRequest); + + WaitIO((struct IORequest *)TimeRequest); + + TimeRequest->tr_node.io_Command = TR_ADDREQUEST; + TimeRequest->tr_time.tv_secs = 1; + TimeRequest->tr_time.tv_micro = 0; + + SendIO((struct IORequest *)TimeRequest); + } + else if (class == IDCMP_VANILLAKEY) + { + if(code == '\033' || code == '\034' || code == '\003') + done = TRUE; + } + } + else + { + signals &= ~window_mask; + } + } + + if(signals & SIGBREAKF_CTRL_C) + { + done = TRUE; + + signals &= ~SIGBREAKF_CTRL_C; + } + } + while(NOT done); + + if(CheckIO((struct IORequest *)TimeRequest) == BUSY) + AbortIO((struct IORequest *)TimeRequest); + + WaitIO((struct IORequest *)TimeRequest); + + cleanup(); + } + + return(0); +} diff --git a/examples/SampleNetSpeed_rev.h b/examples/SampleNetSpeed_rev.h new file mode 100644 index 0000000..6f9b2d4 --- /dev/null +++ b/examples/SampleNetSpeed_rev.h @@ -0,0 +1,6 @@ +#define VERSION 4 +#define REVISION 5 +#define DATE "10.11.2016" +#define VERS "SampleNetSpeed 4.5" +#define VSTRING "SampleNetSpeed 4.5 (10.11.2016)\r\n" +#define VERSTAG "\0$VER: SampleNetSpeed 4.5 (10.11.2016)" diff --git a/examples/ShowNetStatus.c b/examples/ShowNetStatus.c new file mode 100644 index 0000000..9675fa4 --- /dev/null +++ b/examples/ShowNetStatus.c @@ -0,0 +1,2962 @@ +/* + * $Id: ShowNetStatus.c,v 1.16 2007-08-26 12:30:16 obarthel Exp $ + * + * :ts=4 + * + * Copyright © 2001-2007 by Olaf Barthel. All Rights Reserved. + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +/****************************************************************************/ + +#if defined(__amigaos4__) +#include +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +#if !defined(__amigaos4__) +#define NO_INLINE_STDARG +#endif /* __amigaos4__ */ + +#define __NOLIBBASE__ +#define __NOGLOBALIFACE__ +#define __USE_INLINE__ + +/****************************************************************************/ + +#include +#include +#include +#include +#include + +/****************************************************************************/ + +#include +#include + +/****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +/****************************************************************************/ + +#include "macros.h" + +/****************************************************************************/ + +#include "ShowNetStatus_rev.h" + +/****************************************************************************/ + +#ifndef AbsExecBase +#define AbsExecBase (*(struct ExecBase **)4) +#endif /* AbsExecBase */ + +/****************************************************************************/ + +#ifndef FORMAT_DEF +#define FORMAT_DEF 4 +#endif /* FORMAT_DEF */ + +/****************************************************************************/ + +typedef LONG * NUMBER; +typedef LONG SWITCH; +typedef STRPTR KEY; + +/****************************************************************************/ + +struct CommandContext +{ + struct Library * cc_SysBase; + struct Library * cc_DOSBase; + struct Library * cc_UtilityBase; + struct Library * cc_SocketBase; + struct Library * cc_LocaleBase; + + #if defined(__amigaos4__) + + /************************************************************************/ + + struct ExecIFace * cc_IExec; + struct DOSIFace * cc_IDOS; + struct UtilityIFace * cc_IUtility; + struct SocketIFace * cc_ISocket; + struct LocaleIFace * cc_ILocale; + + /************************************************************************/ + + #endif /* __amigaos4__ */ + + struct Catalog * cc_Catalog; + struct Locale * cc_Locale; + UBYTE cc_ProgramName[256]; + UBYTE * cc_QueryBuffer; + LONG cc_QueryBufferSize; + BOOL cc_Stopped; + BOOL cc_HaveDomain; + STRPTR cc_Domain; + STRPTR cc_Line1; + STRPTR cc_Line2; + BOOL cc_NoNames; + BOOL cc_Something; + BOOL cc_Quiet; +}; + +/****************************************************************************/ + +#if defined(__amigaos4__) + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct ExecIFace * IExec = cc->cc_IExec; \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct DOSIFace * IDOS = cc->cc_IDOS; \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_UTILITYBASE(cc) \ + struct UtilityIFace * IUtility = cc->cc_IUtility; \ + struct Library * UtilityBase = cc->cc_UtilityBase + +#define DECLARE_LOCALEBASE(cc) \ + struct LocaleIFace * ILocale = cc->cc_ILocale; \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct SocketIFace * ISocket = cc->cc_ISocket; \ + struct Library * SocketBase = cc->cc_SocketBase + +/****************************************************************************/ + +#else + +/****************************************************************************/ + +#define DECLARE_SYSBASE(cc) \ + struct Library * SysBase = cc->cc_SysBase + +#define DECLARE_DOSBASE(cc) \ + struct Library * DOSBase = cc->cc_DOSBase + +#define DECLARE_UTILITYBASE(cc) \ + struct Library * UtilityBase = cc->cc_UtilityBase + +#define DECLARE_LOCALEBASE(cc) \ + struct Library * LocaleBase = cc->cc_LocaleBase + +#define DECLARE_SOCKETBASE(cc) \ + struct Library * SocketBase = cc->cc_SocketBase + +/****************************************************************************/ + +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +LONG _start(VOID); + +/****************************************************************************/ + +STATIC VOID close_libs(struct CommandContext *cc); +STATIC LONG open_libs(struct CommandContext *cc, struct Library *SysBase); +LONG cmd(struct CommandContext *cc); +STATIC STRPTR begin_underline(struct CommandContext *cc); +STATIC STRPTR end_underline(struct CommandContext *cc); +STATIC ULONG divide_64_by_32(SBQUAD_T *dividend, ULONG divisor, SBQUAD_T *quotient); +STATIC VOID insert_grouping_characters(struct Locale *loc, STRPTR buffer); +STATIC STRPTR convert_quad_to_string(struct Locale *loc, const SBQUAD_T *const number, STRPTR string, LONG max_string_len); +STATIC LONG fill_query_buffer(struct CommandContext *cc, LONG type); +STATIC VARARGS68K VOID lprintf(struct CommandContext *cc, STRPTR format, ...); +STATIC VARARGS68K VOID lsprintf(struct CommandContext *cc, STRPTR buffer, STRPTR formatString, ...); +STATIC BOOL is_blank_space(UBYTE c); +STATIC VOID strip_extra_blank_spaces(STRPTR s); +STATIC STRPTR routename(struct CommandContext *cc, ULONG in, STRPTR line, LONG line_size); +STATIC ULONG forgemask(ULONG a); +STATIC STRPTR netname(struct CommandContext *cc, ULONG in, STRPTR line, LONG line_size); +STATIC STRPTR get_sockaddr(struct CommandContext *cc, struct sockaddr *sa, int flags, STRPTR line, LONG line_size); +STATIC VOID print_arp_table(struct CommandContext *cc, struct rt_msghdr *rtm); +STATIC VOID print_route_table(struct CommandContext *cc, struct rt_msghdr *rtm); +STATIC VOID print_dns_list(struct CommandContext *cc, struct List *dns_list); +STATIC VOID print_interface_list(struct CommandContext *cc, struct List *interface_list); +STATIC BOOL print_interface_info(struct CommandContext *cc, STRPTR name); +STATIC VOID print_icmp_status(struct CommandContext *cc, struct icmpstat *icps); +STATIC VOID print_igmp_status(struct CommandContext *cc, struct igmpstat *igps); +STATIC VOID print_ip_status(struct CommandContext *cc, struct ipstat *ips); +STATIC VOID print_mb_status(struct CommandContext *cc, struct mbstat *m); +STATIC VOID print_mrt_status(struct CommandContext *cc, struct mrtstat *mrts); +STATIC VOID print_rt_status(struct CommandContext *cc, struct rtstat *rts); +STATIC VOID print_tcp_status(struct CommandContext *cc, struct tcpstat *tcps); +STATIC VOID print_udp_status(struct CommandContext *cc, struct udpstat *udps); +STATIC VOID print_tcp_socket_status(struct CommandContext *cc, BOOL all_sockets, struct protocol_connection_data *pcd, LONG size); +STATIC VOID print_udp_socket_status(struct CommandContext *cc, BOOL all_sockets, struct protocol_connection_data *pcd, LONG size); +STATIC VOID print_net_status_summary(struct CommandContext *cc); +STATIC LONG VARARGS68K Local_ErrorPrintf(struct CommandContext *cc, STRPTR format, ...); +STATIC STRPTR get_builtin_str(LONG id); +STRPTR get_str(struct CommandContext *cc, LONG id); +STATIC VARARGS68K LONG Local_QueryInterfaceTags(struct CommandContext *cc, STRPTR interface_name, ...); +STATIC VARARGS68K LONG Local_SocketBaseTags(struct CommandContext *cc, ...); + +/****************************************************************************/ + +/****** ROADSHOW/SHOWNETSTATUS ************************************************** +* +* NAME +* ShowNetStatus - Display various information about the status of the +* network configuration. +* +* FORMAT +* ShowNetStatus [INTERFACE=[,...]] [INTERFACES] [ARPCACHE=ARP] +* [ROUTES] [DNS=DOMAINNAMESERVERS] [ICMP] [IGMP] [IP] [MB=MEMORY] +* [MR=MULTICASTROUTING] [RT=ROUTING] [TCP] [UDP] [TCPSOCKETS] +* [UDPSOCKETS] [NAMES] [ALL] [REPEAT] [QUIET] +* +* TEMPLATE +* INTERFACE/M,INTERFACES/S,ARPCACHE=ARP/S,ROUTES/S, +* DNS=DOMAINNAMESERVERS/S,ICMP/S,IGMP/S,IP/S,MB=MEMORY/S, +* MR=MULTICASTROUTING/S,RT=ROUTING/S,TCP/S,UDP/S,TCPSOCKETS/S, +* UDPSOCKETS/S,NAMES/S,ALL/S,REPEAT/S,QUIET/S +* +* PATH +* C:SHOWNETSTATUS +* +* FUNCTION +* This command can display a lot of informations about the active +* interfaces, either for one interface or for all them. It can be used +* to display the current settings or to give details on the quality of +* the network: transfer speed, number of errors, etc. +* +* You can request which details should be displayed. If you provide +* no options to this command, it will print a general summary of the +* current network status. +* +* OPTIONS +* INTERFACE/M +* For each interface provided in this list, show detailed +* configuration information and statistics. +* +* INTERFACES/S +* Show the list of all interfaces known to the TCP/IP stack. +* +* ARP/S +* Show the contents of the address resolution protocol (ARP) cache. +* +* ROUTES/S +* Show information on the routes that are configured. The +* default route is indicated by having a gateway address +* of 'default'. +* +* DNS=DOMAINNAMESERVERS/S +* Show a list of domain name servers known to the TCP/IP +* stack. Servers are either dynamically configured or +* statically (through the 'DEVS:Interfaces/name_resolution' file). +* +* ICMP/S +* Display Internet Control Message Protocol statistics. +* +* IGMP/S +* Display Internet Group Management Protocol statistics. +* +* IP/S +* Display Internet Protocol statistics. +* +* MB=MEMORY/S +* Display memory buffer statistics. +* +* MR=MULTICASTROUTING/S +* Display multicast routing statistics. +* +* RT=ROUTING/S +* Display routing statistics. +* +* TCP/S +* Display Transmission Control Protocol statistics. +* +* UDP/S +* Display User Datagram Protocol statistics. +* +* TCPSOCKETS/S +* Display information about the TCP sockets currently +* in use. Note that unless you use the 'ALL' option, +* sockets bound to local addresses will not be shown. +* +* UDPSOCKETS/S +* Display information about the UDP sockets currently +* in use. Note that unless you use the 'ALL' option, +* sockets bound to local addresses will not be shown. +* +* NAMES/S +* Attempt to figure out which symbolic names are associated +* with the IP addresses to be printed, and also attempt to +* associate port numbers with service names. +* +* ALL/S +* This option works in conjunction with the TCPSOCKETS and +* UDPSOCKETS parameters. It tells the respective display +* routines to show all currently active sockets, including +* those bound to local addresses. +* +* REPEAT/S +* Repeat the query and display process each second; the +* screen will be cleared before the new information is +* printed. To stop printing the data, press [Ctrl]+C. +* +* QUIET/S +* Do not show any error messages. +* +* EXAMPLES +* Show details on interface "itf". +* +* 1> SHOWNETSTATUS INTERFACE itf +* +* Show details on the Internet Group Management Protocol and routing +* statistics +* +* 1> SHOWNETSTATUS ROUTING IGMP +* +* NOTES +* This command works like a combination of the Unix "route", "ifconfig" +* and "netstat" commands. +* +* Most of the information printed is rather cryptic and not of much +* use to the casual user. It can help in debugging, though. +* +****************************************************************************** +*/ +LONG +_start(VOID) +{ + struct Library *SysBase = (struct Library *)AbsExecBase; + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + struct CommandContext _cc,*cc = &_cc; + LONG result = RETURN_FAIL; + struct Process * pr; + LONG error; + + memset(cc,0,sizeof(*cc)); + + pr = (struct Process *)FindTask(NULL); + if(pr->pr_CLI == ZERO) + { + struct MsgPort * mp = &pr->pr_MsgPort; + struct Message * mn; + + WaitPort(mp); + mn = GetMsg(mp); + + Forbid(); + ReplyMsg(mn); + goto out; + } + + error = open_libs(cc,SysBase); + if(error == OK) + { + DECLARE_LOCALEBASE(cc); + + if(cc->cc_LocaleBase != NULL) + { + cc->cc_Catalog = OpenCatalogA(NULL,"roadshow.catalog",NULL); + cc->cc_Locale = OpenLocale(NULL); + } + + result = cmd(cc); + + if(cc->cc_QueryBuffer != NULL) + FreeVec(cc->cc_QueryBuffer); + + if(cc->cc_Catalog != NULL) + CloseCatalog(cc->cc_Catalog); + + if(cc->cc_Locale != NULL) + CloseLocale(cc->cc_Locale); + } + else + { + pr->pr_Result2 = error; + } + + close_libs(cc); + + out: + + return(result); +} + +/****************************************************************************/ + +STATIC VOID +close_libs(struct CommandContext * cc) +{ + DECLARE_SYSBASE(cc); + + #if defined(__amigaos4__) + { + if(cc->cc_IDOS != NULL) + DropInterface((struct Interface *)cc->cc_IDOS); + + if(cc->cc_ILocale != NULL) + DropInterface((struct Interface *)cc->cc_ILocale); + + if(cc->cc_ISocket != NULL) + DropInterface((struct Interface *)cc->cc_ISocket); + + if(cc->cc_IUtility != NULL) + DropInterface((struct Interface *)cc->cc_IUtility); + } + #endif /* __amigaos4__ */ + + if(cc->cc_UtilityBase != NULL) + CloseLibrary(cc->cc_UtilityBase); + + if(cc->cc_SocketBase != NULL) + CloseLibrary(cc->cc_SocketBase); + + if(cc->cc_LocaleBase != NULL) + CloseLibrary(cc->cc_LocaleBase); + + if(cc->cc_DOSBase != NULL) + CloseLibrary(cc->cc_DOSBase); +} + +/****************************************************************************/ + +STATIC LONG +open_libs(struct CommandContext * cc,struct Library *SysBase) +{ + #if defined(__amigaos4__) + struct ExecIFace * IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + #endif /* __amigaos4__ */ + + LONG error; + + cc->cc_SysBase = SysBase; + + #if defined(__amigaos4__) + { + cc->cc_IExec = IExec; + } + #endif /* __amigaos4__ */ + + cc->cc_DOSBase = OpenLibrary("dos.library",36); + + #if defined(__amigaos4__) + { + if(cc->cc_DOSBase != NULL) + { + cc->cc_IDOS = (struct DOSIFace *)GetInterface(cc->cc_DOSBase, "main", 1, 0); + if(cc->cc_IDOS == NULL) + { + CloseLibrary(cc->cc_DOSBase); + cc->cc_DOSBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + if(cc->cc_DOSBase == NULL) + { + error = ERROR_INVALID_RESIDENT_LIBRARY; + goto out; + } + + cc->cc_LocaleBase = OpenLibrary("locale.library",38); + + #if defined(__amigaos4__) + { + if(cc->cc_LocaleBase != NULL) + { + cc->cc_ILocale = (struct LocaleIFace *)GetInterface(cc->cc_LocaleBase, "main", 1, 0); + if(cc->cc_ILocale == NULL) + { + CloseLibrary(cc->cc_LocaleBase); + cc->cc_LocaleBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + cc->cc_UtilityBase = OpenLibrary("utility.library",37); + + #if defined(__amigaos4__) + { + if(cc->cc_UtilityBase != NULL) + { + cc->cc_IUtility = (struct UtilityIFace *)GetInterface(cc->cc_UtilityBase, "main", 1, 0); + if(cc->cc_IUtility == NULL) + { + CloseLibrary(cc->cc_UtilityBase); + cc->cc_UtilityBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + /* The following may be necessary to flush out an inoperable + bsdsocket.library which reached the end of the shutdown + process. */ + #if 1 + { + struct ExecBase * ex = (struct ExecBase *)SysBase; + struct Library * lib; + + Forbid(); + + lib = (struct Library *)FindName(&ex->LibList,"bsdsocket.library"); + if(lib != NULL) + RemLibrary(lib); + + Permit(); + } + #endif + + cc->cc_SocketBase = OpenLibrary("bsdsocket.library",4); + + #if defined(__amigaos4__) + { + if(cc->cc_SocketBase != NULL) + { + cc->cc_ISocket = (struct SocketIFace *)GetInterface(cc->cc_SocketBase, "main", 1, 0); + if(cc->cc_ISocket == NULL) + { + CloseLibrary(cc->cc_SocketBase); + cc->cc_SocketBase = NULL; + } + } + } + #endif /* __amigaos4__ */ + + error = OK; + + out: + + return(error); +} + +/****************************************************************************/ + +#define CATCOMP_ARRAY +#define SHOWNETSTATUS_CATALOG_STRINGS +#include "roadshow.h" + +/****************************************************************************/ + +LONG +cmd(struct CommandContext * cc) +{ + struct + { + KEY * Interface; + SWITCH Interfaces; + SWITCH ARP; + SWITCH Routes; + SWITCH DNS; + SWITCH ICMP; + SWITCH IGMP; + SWITCH IP; + SWITCH Memory; + SWITCH MulticastRouting; + SWITCH Routing; + SWITCH TCP; + SWITCH UDP; + SWITCH TCP_Sockets; + SWITCH UDP_Sockets; + SWITCH Names; + SWITCH All; + SWITCH Repeat; + SWITCH Quiet; + } args; + + STRPTR args_template = + "INTERFACE/M," + "INTERFACES/S," + "ARPCACHE=ARP/S," + "ROUTES/S," + "DNS=DOMAINNAMESERVERS/S," + "ICMP/S," + "IGMP/S," + "IP/S," + "MB=MEMORY/S," + "MR=MULTICASTROUTING/S," + "RT=ROUTING/S," + "TCP/S," + "UDP/S," + "TCPSOCKETS/S," + "UDPSOCKETS/S," + "NAMES/S," + "ALL/S," + "REPEAT/S," + "QUIET/S" + VERSTAG; + + DECLARE_SYSBASE(cc); + DECLARE_DOSBASE(cc); + DECLARE_UTILITYBASE(cc); + DECLARE_SOCKETBASE(cc); + + struct List * interface_list = NULL; + struct List * dns_list = NULL; + struct rt_msghdr * route_table = NULL; + LONG result = RETURN_FAIL; + LONG have_status_api = FALSE; + LONG have_routing_api = FALSE; + LONG have_interface_api = FALSE; + LONG have_dns_api = FALSE; + BOOL show_net_status_summary = FALSE; + struct RDArgs * rda; + + GetProgramName(cc->cc_ProgramName,sizeof(cc->cc_ProgramName)); + + memset(&args,0,sizeof(args)); + + rda = ReadArgs(args_template,(LONG *)&args,NULL); + if(rda == NULL) + { + PrintFault(IoErr(),cc->cc_ProgramName); + goto out; + } + + if(args.Interface == NULL && + args.Interfaces == FALSE && + args.ARP == FALSE && + args.Routes == FALSE && + args.DNS == FALSE && + args.ICMP == FALSE && + args.IGMP == FALSE && + args.IP == FALSE && + args.Memory == FALSE && + args.MulticastRouting == FALSE && + args.Routing == FALSE && + args.TCP == FALSE && + args.UDP == FALSE && + args.TCP_Sockets == FALSE && + args.UDP_Sockets == FALSE) + { + show_net_status_summary = TRUE; + } + + cc->cc_Quiet = args.Quiet; + + if(UtilityBase == NULL) + { + if(NOT cc->cc_Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_SHOWNETSTATUS_NO_UTILITY_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + if(SocketBase == NULL) + { + if(NOT cc->cc_Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_SHOWNETSTATUS_CANNOT_OPEN_BSDSOCKET_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_HAVE_STATUS_API),&have_status_api, + TAG_END) != 0) + { + have_status_api = FALSE; + } + + if(NOT have_status_api) + { + if(NOT cc->cc_Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_STATUS_API_TXT), + cc->cc_ProgramName, SocketBase->lib_Node.ln_Name, SocketBase->lib_Version, SocketBase->lib_Revision); + } + + goto out; + } + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_HAVE_ROUTING_API),&have_routing_api, + TAG_END) != 0) + { + have_routing_api = FALSE; + } + + if(NOT have_routing_api) + { + if(NOT cc->cc_Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_ROUTE_API_TXT), + cc->cc_ProgramName, SocketBase->lib_Node.ln_Name, SocketBase->lib_Version, SocketBase->lib_Revision); + } + + goto out; + } + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_HAVE_INTERFACE_API),&have_interface_api, + TAG_END) != 0) + { + have_interface_api = FALSE; + } + + if(NOT have_interface_api) + { + if(NOT cc->cc_Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_INTERFACE_API_TXT), + cc->cc_ProgramName, SocketBase->lib_Node.ln_Name, SocketBase->lib_Version, SocketBase->lib_Revision); + } + + goto out; + } + + if(Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_HAVE_DNS_API),&have_dns_api, + TAG_END) != 0) + { + have_dns_api = FALSE; + } + + if(NOT have_dns_api) + { + if(NOT cc->cc_Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_DNS_API_TXT), + cc->cc_ProgramName, SocketBase->lib_Node.ln_Name, SocketBase->lib_Version, SocketBase->lib_Revision); + } + + goto out; + } + + cc->cc_Domain = AllocVec(3 * (MAXHOSTNAMELEN + 1),MEMF_ANY|MEMF_PUBLIC); + if(cc->cc_Domain == NULL) + { + PrintFault(ERROR_NO_FREE_STORE,cc->cc_ProgramName); + goto out; + } + + cc->cc_Line1 = cc->cc_Domain + MAXHOSTNAMELEN + 1; + cc->cc_Line2 = cc->cc_Line1 + MAXHOSTNAMELEN + 1; + + if(args.Names) + cc->cc_NoNames = FALSE; + else + cc->cc_NoNames = TRUE; + + while(TRUE) + { + if(show_net_status_summary) + print_net_status_summary(cc); + + if(args.Interface != NULL) + { + STRPTR * key = args.Interface; + STRPTR name; + BOOL failed; + + failed = FALSE; + + while((name = (*key++)) != NULL) + { + if(CANNOT print_interface_info(cc,name)) + { + if(NOT cc->cc_Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_SHOWNETSTATUS_CANNOT_GET_INFO_ON_INTERFACE_TXT), + cc->cc_ProgramName,name); + } + + failed = TRUE; + } + } + + if(failed) + goto out; + } + + if(args.Interfaces) + { + if(interface_list != NULL) + ReleaseInterfaceList(interface_list); + + interface_list = ObtainInterfaceList(); + if(interface_list == NULL) + { + if(NOT cc->cc_Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_SHOWNETSTATUS_CANNOT_GET_INTERFACE_LIST_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + print_interface_list(cc,interface_list); + } + + if(args.DNS) + { + if(dns_list != NULL) + ReleaseDomainNameServerList(dns_list); + + dns_list = ObtainDomainNameServerList(); + if(dns_list == NULL) + { + if(NOT cc->cc_Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_SHOWNETSTATUS_CANNOT_GET_DNS_LIST_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + print_dns_list(cc,dns_list); + } + + if(args.Routes) + { + if(route_table != NULL) + FreeRouteInfo(route_table); + + route_table = GetRouteInfo(AF_UNSPEC,0); + if(route_table == NULL) + { + if(NOT cc->cc_Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_SHOWNETSTATUS_CANNOT_GET_ROUTE_TABLE_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + print_route_table(cc,route_table); + } + + if(args.ARP) + { + if(route_table != NULL) + FreeRouteInfo(route_table); + + route_table = GetRouteInfo(AF_INET,RTF_LLINFO); + if(route_table == NULL) + { + if(NOT cc->cc_Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_SHOWNETSTATUS_NO_ARP_INFORMATION_TXT), + cc->cc_ProgramName); + } + + goto out; + } + + print_arp_table(cc,route_table); + } + + if(args.ICMP) + { + if(fill_query_buffer(cc,NETSTATUS_icmp) < 0) + goto out; + + print_icmp_status(cc,(struct icmpstat *)cc->cc_QueryBuffer); + if(cc->cc_Stopped) + { + result = RETURN_WARN; + goto out; + } + } + + if(args.IGMP) + { + if(fill_query_buffer(cc,NETSTATUS_igmp) < 0) + goto out; + + print_igmp_status(cc,(struct igmpstat *)cc->cc_QueryBuffer); + + if(cc->cc_Stopped) + { + result = RETURN_WARN; + goto out; + } + } + + if(args.IP) + { + if(fill_query_buffer(cc,NETSTATUS_ip) < 0) + goto out; + + print_ip_status(cc,(struct ipstat *)cc->cc_QueryBuffer); + + if(cc->cc_Stopped) + { + result = RETURN_WARN; + goto out; + } + } + + if(args.Memory) + { + if(fill_query_buffer(cc,NETSTATUS_mb) < 0) + goto out; + + print_mb_status(cc,(struct mbstat *)cc->cc_QueryBuffer); + + if(cc->cc_Stopped) + { + result = RETURN_WARN; + goto out; + } + } + + if(args.MulticastRouting) + { + if(fill_query_buffer(cc,NETSTATUS_mrt) < 0) + goto out; + + print_mrt_status(cc,(struct mrtstat *)cc->cc_QueryBuffer); + + if(cc->cc_Stopped) + { + result = RETURN_WARN; + goto out; + } + } + + if(args.Routing) + { + if(fill_query_buffer(cc,NETSTATUS_rt) < 0) + goto out; + + print_rt_status(cc,(struct rtstat *)cc->cc_QueryBuffer); + + if(cc->cc_Stopped) + { + result = RETURN_WARN; + goto out; + } + } + + if(args.TCP) + { + if(fill_query_buffer(cc,NETSTATUS_tcp) < 0) + goto out; + + print_tcp_status(cc,(struct tcpstat *)cc->cc_QueryBuffer); + + if(cc->cc_Stopped) + { + result = RETURN_WARN; + goto out; + } + } + + if(args.UDP) + { + if(fill_query_buffer(cc,NETSTATUS_udp) < 0) + goto out; + + print_udp_status(cc,(struct udpstat *)cc->cc_QueryBuffer); + + if(cc->cc_Stopped) + { + result = RETURN_WARN; + goto out; + } + } + + if(args.TCP_Sockets) + { + LONG size; + + size = fill_query_buffer(cc,NETSTATUS_tcp_sockets); + if(size < 0) + goto out; + + print_tcp_socket_status(cc,args.All,(struct protocol_connection_data *)cc->cc_QueryBuffer,size); + + if(cc->cc_Stopped) + { + result = RETURN_WARN; + goto out; + } + } + + if(args.UDP_Sockets) + { + LONG size; + + size = fill_query_buffer(cc,NETSTATUS_udp_sockets); + if(size < 0) + goto out; + + print_udp_socket_status(cc,args.All,(struct protocol_connection_data *)cc->cc_QueryBuffer,size); + + if(cc->cc_Stopped) + { + result = RETURN_WARN; + goto out; + } + } + + if(args.Repeat) + { + LONG i; + + for(i = 0 ; i < 10 ; i++) + { + Delay(TICKS_PER_SECOND / 10); + + if(CheckSignal(SIGBREAKF_CTRL_C)) + { + cc->cc_Stopped = TRUE; + + PrintFault(ERROR_BREAK,cc->cc_ProgramName); + + result = RETURN_WARN; + + break; + } + } + + if(cc->cc_Stopped) + { + result = RETURN_WARN; + goto out; + } + + cc->cc_Something = FALSE; + lprintf(cc,"\f"); + } + else + { + break; + } + } + + result = RETURN_OK; + + out: + + FreeVec(cc->cc_Domain); + + if(interface_list != NULL) + ReleaseInterfaceList(interface_list); + + if(dns_list != NULL) + ReleaseDomainNameServerList(dns_list); + + if(route_table != NULL) + FreeRouteInfo(route_table); + + if(rda != NULL) + FreeArgs(rda); + + return(result); +} + +STATIC STRPTR +begin_underline(struct CommandContext * cc) +{ + DECLARE_DOSBASE(cc); + + STRPTR result; + + if(IsInteractive(Output())) + result = "\33[4m"; + else + result = ""; + + return(result); +} + +STATIC STRPTR +end_underline(struct CommandContext * cc) +{ + DECLARE_DOSBASE(cc); + + STRPTR result; + + if(IsInteractive(Output())) + result = "\33[0m"; + else + result = ""; + + return(result); +} + +/****************************************************************************/ + +/* Divide a 64 bit integer by a 32 bit integer, filling in a 64 bit quotient + and returning a 32 bit remainder. */ +STATIC ULONG +divide_64_by_32(SBQUAD_T * dividend,ULONG divisor,SBQUAD_T * quotient) +{ + SBQUAD_T dividend_cdef = (*dividend); + ULONG dividend_ab = 0; + LONG i; + + quotient->sbq_High = quotient->sbq_Low = 0; + + for(i = 0 ; i < 64 ; i++) + { + /* Shift the quotient left by one bit. */ + quotient->sbq_High = (quotient->sbq_High << 1); + + if((quotient->sbq_Low & 0x80000000UL) != 0) + quotient->sbq_High |= 1; + + quotient->sbq_Low = (quotient->sbq_Low << 1); + + /* Shift the dividend left by one bit. We start + with the most significant 32 bit portion. */ + dividend_ab = (dividend_ab << 1); + + if((dividend_cdef.sbq_High & 0x80000000UL) != 0) + dividend_ab |= 1; + + /* Now for the middle 32 bit portion. */ + dividend_cdef.sbq_High = (dividend_cdef.sbq_High << 1); + + if((dividend_cdef.sbq_Low & 0x80000000UL) != 0) + dividend_cdef.sbq_High |= 1; + + /* Finally, the least significant portion. */ + dividend_cdef.sbq_Low = (dividend_cdef.sbq_Low << 1); + + /* Does the divisor actually divide the dividend? */ + if(dividend_ab >= divisor) + { + dividend_ab -= divisor; + + /* We could divide the divisor. Keep track of + this and take care of an overflow condition. */ + quotient->sbq_Low++; + if(quotient->sbq_Low == 0) + quotient->sbq_High++; + } + } + + return(dividend_ab); +} + +/****************************************************************************/ + +STATIC VOID +insert_grouping_characters(struct Locale * loc,STRPTR buffer) +{ + if(loc != NULL && loc->loc_Grouping != NULL && loc->loc_GroupSeparator != NULL) + { + UBYTE * grouping = loc->loc_Grouping; + UBYTE * group_separator = loc->loc_GroupSeparator; + UBYTE local_buffer[80]; + LONG num_group_digits; + UBYTE * s; + LONG i,len; + + /* Check which kind of grouping should be performed + for the first group. */ + switch(*grouping) + { + /* Repeat current grouping scheme; there is nothing + to repeat in the first place since we don't even + know yet what we are going to repeat. */ + case 0: + + return; + + /* Perform no further grouping. That means our job is + done! */ + case 255: + + return; + + /* Use this initial group size. */ + default: + + num_group_digits = (*grouping++); + break; + } + + /* Run down the number string, inserting grouping + characters where necessary. */ + s = local_buffer; + len = strlen(buffer); + for(i = len-1 ; i >= 0 ; i--) + { + (*s++) = buffer[i]; + + /* Is this not the last character to be stored? + If so, check if we should insert a grouping + character right now. */ + if(i != 0 && num_group_digits > 0) + { + if(--num_group_digits == 0) + { + int j; + + /* Insert the group separator in reverse order. */ + for(j = strlen(group_separator)-1 ; j >= 0 ; j--) + (*s++) = group_separator[j]; + + /* Now check which kind of grouping we should + perform next. */ + switch(*grouping) + { + /* Repeat current grouping scheme. */ + case 0: + + num_group_digits = grouping[-1]; + break; + + /* Perform no further grouping. */ + case 255: + + break; + + /* Use new grouping scheme. */ + default: + + num_group_digits = (*grouping++); + break; + } + } + } + } + + len = (int)(((ULONG)s) - ((ULONG)local_buffer)); + + for(i = len-1 ; i >= 0 ; i--) + (*buffer++) = local_buffer[i]; + + (*buffer) = '\0'; + } +} + +/****************************************************************************/ + +/* Convert a 64 bit number into a textual representation, using base=10, + just like sprintf(...,"%lD",...) would do if it could handle multiprecision + numbers... */ +STATIC STRPTR +convert_quad_to_string(struct Locale * loc,const SBQUAD_T * const number,STRPTR string,LONG max_string_len) +{ + SBQUAD_T q; + STRPTR s; + UBYTE c; + ULONG r; + LONG i,len; + + /* Make a local copy of the number. */ + q = (*number); + + s = string; + + len = 0; + + /* Build the number string in reverse order, calculating + the single digits: */ + while(len < max_string_len) + { + /* Divide by ten and remember the remainder. */ + r = divide_64_by_32(&q,10,&q); + + (*s++) = '0' + r; + len++; + + /* Stop when we hit zero. */ + if(q.sbq_High == 0 && q.sbq_Low == 0) + break; + } + + /* Don't forget to terminate the string. */ + (*s) = '\0'; + + /* Reverse the string in place. */ + for(i = 0 ; i < len/2 ; i++) + { + c = string[len-1-i]; + string[len-1-i] = string[i]; + string[i] = c; + } + + insert_grouping_characters(loc,string); + + return(string); +} + +/****************************************************************************/ + +STATIC LONG +fill_query_buffer(struct CommandContext * cc,LONG type) +{ + DECLARE_SYSBASE(cc); + DECLARE_SOCKETBASE(cc); + + LONG size; + + size = GetNetworkStatistics(type,NETWORKSTATUS_VERSION,NULL,0); + if(size > 0) + { + if(size > cc->cc_QueryBufferSize) + { + FreeVec(cc->cc_QueryBuffer); + + cc->cc_QueryBuffer = AllocVec(size,MEMF_ANY|MEMF_CLEAR); + if(cc->cc_QueryBuffer != NULL) + { + cc->cc_QueryBufferSize = size; + } + else + { + if(NOT cc->cc_Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_SHOWNETSTATUS_NOT_ENOUGH_MEMORY_TO_QUERY_STATUS_TXT), + cc->cc_ProgramName,get_str(cc,MSG_SHOWNETSTATUS_STATUS_NAME1_TXT + type - NETSTATUS_icmp)); + } + + size = -1; + goto out; + } + } + + size = GetNetworkStatistics(type,NETWORKSTATUS_VERSION,cc->cc_QueryBuffer,size); + } + + if(size < 0) + { + if(NOT cc->cc_Quiet) + { + Local_ErrorPrintf(cc,get_str(cc,MSG_SHOWNETSTATUS_CANNOT_GET_STATUS_INFORMATION_FOR_TXT), + cc->cc_ProgramName,get_str(cc,MSG_SHOWNETSTATUS_STATUS_NAME1_TXT + type - NETSTATUS_icmp)); + } + } + + out: + + return(size); +} + +/****************************************************************************/ + +STATIC VARARGS68K VOID +lprintf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + + if(NOT cc->cc_Stopped) + { + if(CheckSignal(SIGBREAKF_CTRL_C)) + { + PrintFault(ERROR_BREAK,cc->cc_ProgramName); + cc->cc_Stopped = TRUE; + } + } + + if(NOT cc->cc_Stopped) + { + va_list args; + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + VPrintf(format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + VPrintf(format,(APTR)args); + va_end(args); + } + #endif /* __amigaos4__ */ + } +} + +/****************************************************************************/ + +STATIC VARARGS68K VOID +lsprintf(struct CommandContext * cc,STRPTR buffer,STRPTR formatString,...) +{ + DECLARE_SYSBASE(cc); + + va_list varArgs; + + #if defined(__amigaos4__) + { + va_startlinear(varArgs,formatString); + RawDoFmt(formatString,va_getlinearva(varArgs,APTR),NULL,buffer); + va_end(varArgs); + } + #else + { + va_start(varArgs,formatString); + RawDoFmt(formatString,varArgs,(VOID (*)())"\x16\xC0\x4E\x75",buffer); + va_end(varArgs); + } + #endif /* __amigaos4__ */ +} + +/****************************************************************************/ + +STATIC BOOL +is_blank_space(UBYTE c) +{ + BOOL result; + + result = (BOOL)(c == ' ' || c == '\t' || c == (UBYTE)'\240'); + + return(result); +} + +/****************************************************************************/ + +STATIC VOID +strip_extra_blank_spaces(STRPTR s) +{ + LONG num_leading_spaces; + LONG num_trailing_spaces; + LONG len,i; + + len = strlen(s); + + num_leading_spaces = 0; + + for(i = 0 ; i < len ; i++) + { + if(NOT is_blank_space(s[i])) + break; + + num_leading_spaces++; + } + + num_trailing_spaces = 0; + + for(i = len-1 ; i >= 0 ; i--) + { + if(NOT is_blank_space(s[i])) + break; + + num_trailing_spaces++; + } + + if(num_trailing_spaces > 0) + { + len -= num_trailing_spaces; + s[len] = '\0'; + } + + if(num_leading_spaces > 0) + memmove(s,&s[num_leading_spaces],len+1); +} + +/****************************************************************************/ + +#define C(x) ((x) & 0xff) + +/****************************************************************************/ + +STATIC STRPTR +routename(struct CommandContext * cc,ULONG in,STRPTR line,LONG line_size) +{ + DECLARE_UTILITYBASE(cc); + DECLARE_SOCKETBASE(cc); + + struct hostent *hp; + STRPTR cp; + + cp = NULL; + + if(NOT cc->cc_NoNames) + { + if(NOT cc->cc_HaveDomain) + { + cc->cc_HaveDomain = TRUE; + + if(gethostname(cc->cc_Domain, MAXHOSTNAMELEN) == 0 && (cp = index(cc->cc_Domain, '.')) != NULL) + strcpy(cc->cc_Domain, cp + 1); + else + cc->cc_Domain[0] = '\0'; + } + + hp = gethostbyaddr((char *)&in, sizeof(struct in_addr), AF_INET); + if(hp != NULL) + { + if((cp = index(hp->h_name, '.')) != NULL && Stricmp(cp + 1, cc->cc_Domain) == SAME) + (*cp) = 0; + + cp = hp->h_name; + } + } + + if(cp != NULL) + { + strncpy(line, cp, line_size - 1); + line[line_size - 1] = '\0'; + } + else + { + in = ntohl(in); + lsprintf(cc, line, "%ld.%ld.%ld.%ld", C(in >> 24), C(in >> 16), C(in >> 8), C(in)); + } + + return(line); +} + +STATIC ULONG +forgemask(ULONG a) +{ + ULONG m; + + if(IN_CLASSA(a)) + m = IN_CLASSA_NET; + else if (IN_CLASSB(a)) + m = IN_CLASSB_NET; + else + m = IN_CLASSC_NET; + + return (m); +} + +/* Return the name of the network whose address is given. + The address is assumed to be that of a net or subnet, not a host. */ +STATIC STRPTR +netname(struct CommandContext * cc, ULONG in, STRPTR line, LONG line_size) +{ + DECLARE_SOCKETBASE(cc); + + STRPTR cp = NULL; + ULONG net; + ULONG i; + + i = ntohl(in); + + if(NOT cc->cc_NoNames && i) + { + ULONG mask; + int subnetshift; + + mask = forgemask(i); + switch(mask) + { + case IN_CLASSA_NET: + + subnetshift = 8; + break; + + case IN_CLASSB_NET: + + subnetshift = 8; + break; + + case IN_CLASSC_NET: + + subnetshift = 4; + break; + + default: + + subnetshift = 0; + break; + } + + if(subnetshift > 0) + { + struct netent *np; + + /* If there are more bits than the standard mask + would suggest, subnets must be in use. + Guess at the subnet mask, assuming reasonable + width subnet fields. */ + while(i &~ mask) + mask = (long)mask >> subnetshift; + + net = i & mask; + while((mask & 1) == 0) + mask >>= 1, net >>= 1; + + np = getnetbyaddr(net, AF_INET); + if(np != NULL) + cp = np->n_name; + } + } + + if(cp != NULL) + { + strncpy(line, cp, line_size - 1); + line[line_size - 1] = '\0'; + } + else if ((i & 0xffffff) == 0) + { + lsprintf(cc, line, "%ld", C(i >> 24)); + } + else if ((i & 0xffff) == 0) + { + lsprintf(cc, line, "%ld.%ld", C(i >> 24) , C(i >> 16)); + } + else if ((i & 0xff) == 0) + { + lsprintf(cc, line, "%ld.%ld.%ld", C(i >> 24), C(i >> 16), C(i >> 8)); + } + else + { + lsprintf(cc, line, "%ld.%ld.%ld.%ld", C(i >> 24), C(i >> 16), C(i >> 8), C(i)); + } + + return (line); +} + +STATIC STRPTR +get_sockaddr(struct CommandContext * cc,struct sockaddr * sa,int flags,STRPTR line,LONG line_size) +{ + struct sockaddr_in *sin = (struct sockaddr_in *)sa; + STRPTR result; + + if(sin->sin_addr.s_addr == INADDR_ANY) + result = get_str(cc,MSG_SHOWNETSTATUS_DEFAULT_TXT); + else if (flags & RTF_HOST) + result = routename(cc,sin->sin_addr.s_addr,line,line_size); + else + result = netname(cc,sin->sin_addr.s_addr,line,line_size); + + return(result); +} + +/****************************************************************************/ + +STATIC VOID +print_arp_table(struct CommandContext * cc,struct rt_msghdr *rtm) +{ + DECLARE_SOCKETBASE(cc); + + char *host; + struct sockaddr_inarp *sin; + struct sockaddr_dl *sdl; + struct hostent *hp; + char address[24]; + LONG n,c; + BOOL no_names; + + if(cc->cc_Something) + lprintf(cc,"\n"); + else + cc->cc_Something = TRUE; + + no_names = cc->cc_NoNames; + + for(n = 0 ; + rtm->rtm_msglen > 0 ; + rtm = (struct rt_msghdr *)(((ULONG)rtm) + rtm->rtm_msglen)) + { + sin = (struct sockaddr_inarp *)(rtm + 1); + sdl = (struct sockaddr_dl *)(sin + 1); + + host = get_str(cc,MSG_SHOWNETSTATUS_UNKNOWN_HOST_TXT); + + if(NOT no_names) + { + hp = gethostbyaddr((APTR)&sin->sin_addr, sizeof (sin->sin_addr), AF_INET); + if(hp != NULL) + { + host = hp->h_name; + } + else + { + LONG h_errno; + + Local_SocketBaseTags(cc, + SBTM_GETREF(SBTC_HERRNO),&h_errno, + TAG_END); + + if(h_errno == TRY_AGAIN) + no_names = TRUE; + } + } + + if(n++ == 0) + { + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ARP_HEADER_TXT), + begin_underline(cc), + get_str(cc,MSG_SHOWNETSTATUS_HOST_TXT), + get_str(cc,MSG_SHOWNETSTATUS_IP_ADDRESS_TXT), + get_str(cc,MSG_SHOWNETSTATUS_HARDWARE_ADDRESS_TXT), + get_str(cc,MSG_SHOWNETSTATUS_ATTRIBUTES_TXT), + end_underline(cc)); + + lprintf(cc,"\n"); + } + + if(sdl->sdl_alen > 0) + { + UBYTE * m; + + m = (UBYTE *)LLADDR(sdl); + + lsprintf(cc,address,"%02lx:%02lx:%02lx:%02lx:%02lx:%02lx",m[0],m[1],m[2],m[3],m[4],m[5]); + } + else + { + strcpy(address,get_str(cc,MSG_SHOWNETSTATUS_INCOMPLETE_HARDWARE_ADDRESS_TXT)); + } + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ARP_HEADER_TXT), + "", + host, + Inet_NtoA(sin->sin_addr.s_addr), + address, + "", + ""); + + c = 0; + + if (rtm->rtm_rmx.rmx_expire == 0) + { + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ARP_ENTRY_PERMANENT_TXT)); + c++; + } + + if (sin->sin_other & SIN_PROXY) + { + if(c != 0) + lprintf(cc,", "); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ARP_ENTRY_PUBLISHED_PROXY_TXT)); + c++; + } + + if (rtm->rtm_addrs & RTA_NETMASK) + { + sin = (struct sockaddr_inarp *)(sdl->sdl_len + (char *)sdl); + + if (sin->sin_addr.s_addr == 0xffffffff) + { + if(c != 0) + lprintf(cc,", "); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ARP_ENTRY_PUBLISHED_TXT)); + c++; + } + } + + if(c == 0) + lprintf(cc,"-"); + + lprintf(cc,"\n"); + } + + if(n == 0) + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ARP_CACHE_EMPTY_TXT)); +} + +/****************************************************************************/ + +STATIC VOID +print_route_table(struct CommandContext * cc,struct rt_msghdr * rtm) +{ + struct sockaddr * sa; + STRPTR gateway,destination; + LONG n; + + if(cc->cc_Something) + lprintf(cc,"\n"); + else + cc->cc_Something = TRUE; + + for(n = 0 ; + rtm->rtm_msglen > 0 ; + rtm = (struct rt_msghdr *)(((ULONG)rtm) + rtm->rtm_msglen)) + { + if(rtm->rtm_version != 3 || (rtm->rtm_addrs & RTA_DST) == 0) + continue; + + sa = (struct sockaddr *)(rtm + 1); + if(sa->sa_family != AF_INET) + continue; + + if((rtm->rtm_addrs & RTA_GATEWAY) != 0) + { + LONG len; + + destination = get_sockaddr(cc,sa,rtm->rtm_flags,cc->cc_Line1,MAXHOSTNAMELEN); + + if(sa->sa_len == 0) + len = sizeof(long); + else + len = sa->sa_len; + + sa = (struct sockaddr *)(((ULONG)sa) + len); + if(sa->sa_family != AF_INET) + continue; + + gateway = get_sockaddr(cc,sa,rtm->rtm_flags,cc->cc_Line2,MAXHOSTNAMELEN); + } + else + { + destination = get_sockaddr(cc,sa,rtm->rtm_flags,cc->cc_Line1,MAXHOSTNAMELEN); + + gateway = "-"; + } + + if(n++ == 0) + { + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_DESTINATION_GATEWAY_ATTRIBUTES_TITLE_TXT), + begin_underline(cc), + get_str(cc,MSG_SHOWNETSTATUS_DESTINATION_TXT), + get_str(cc,MSG_SHOWNETSTATUS_GATEWAY_TXT), + get_str(cc,MSG_SHOWNETSTATUS_ATTRIBUTES_TXT), + end_underline(cc)); + } + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_DESTINATION_GATEWAY_LINE_TXT),destination,gateway); + + lprintf(cc," "); + + if(rtm->rtm_flags & RTF_UP) + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_UP_TXT)); + else + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_DOWN_TXT)); + + if(rtm->rtm_flags & RTF_GATEWAY) + { + lprintf(cc," "); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_GATEWAY_TXT)); + } + + if(rtm->rtm_flags & RTF_HOST) + { + lprintf(cc," "); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_HOST_TXT)); + } + + lprintf(cc,"\n"); + } + + if(n == 0) + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_NO_ROUTES_ARE_CONFIGURED_TXT)); +} + +/****************************************************************************/ + +STATIC VOID +print_dns_list(struct CommandContext * cc,struct List * dns_list) +{ + DECLARE_SOCKETBASE(cc); + + struct DomainNameServerNode * dnsn; + UBYTE default_domain_name[MAXHOSTNAMELEN]; + LONG n; + + if(cc->cc_Something) + lprintf(cc,"\n"); + else + cc->cc_Something = TRUE; + + n = 0; + + for(dnsn = (struct DomainNameServerNode *)dns_list->lh_Head ; + dnsn->dnsn_MinNode.mln_Succ != NULL ; + dnsn = (struct DomainNameServerNode *)dnsn->dnsn_MinNode.mln_Succ) + { + if(n++ == 0) + { + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ADDRESS_TYPE_TITLE_TXT), + begin_underline(cc), + get_str(cc,MSG_SHOWNETSTATUS_ADDRESS_TXT), + get_str(cc,MSG_SHOWNETSTATUS_TYPE_TXT), + end_underline(cc)); + } + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ADDRESS_TYPE_LINE_TXT),routename(cc,inet_addr(dnsn->dnsn_Address),cc->cc_Line1,MAXHOSTNAMELEN), + get_str(cc,(dnsn->dnsn_UseCount < 0) ? MSG_SHOWNETSTATUS_STATIC_TXT : MSG_SHOWNETSTATUS_DYNAMIC_TXT)); + } + + if(n == 0) + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_NO_DNS_CONFIGURED_TXT)); + + strcpy(default_domain_name,""); + + GetDefaultDomainName(default_domain_name,sizeof(default_domain_name)); + + lprintf(cc, + get_str(cc,default_domain_name[0] != '\0' ? MSG_SHOWNETSTATUS_DEFAULT_DOMAIN_NAME_TXT : MSG_SHOWNETSTATUS_DEFAULT_DOMAIN_NAME_UNSET_TXT), + default_domain_name); +} + +/****************************************************************************/ + +struct { LONG Number; STRPTR Name;} hardware_types[] = +{ + { S2WireType_Ethernet, "Ethernet" }, + { S2WireType_IEEE802, "IEEE 802" }, + { S2WireType_Arcnet, "Arcnet" }, + { S2WireType_LocalTalk, "LocalTalk" }, + { S2WireType_DyLAN, "DyLAN" }, + { S2WireType_AmokNet, "AmokNet" }, + { S2WireType_Liana, "Liana" }, + { S2WireType_PPP, "PPP" }, + { S2WireType_SLIP, "SLIP" }, + { S2WireType_CSLIP, "CSLIP" }, + { S2WireType_PLIP, "PLIP" } +}; + +/****************************************************************************/ + +STATIC VOID +print_interface_list(struct CommandContext * cc,struct List * interface_list) +{ + UBYTE type_buffer[80]; + STRPTR type; + struct Node * node; + struct sockaddr_in sin; + LONG mtu; + LONG hardware_type; + ULONG sent; + ULONG received; + ULONG bad; + ULONG overrun; + ULONG unknown; + LONG state; + LONG i; + STRPTR addr; + LONG n = 0; + + if(cc->cc_Something) + lprintf(cc,"\n"); + else + cc->cc_Something = TRUE; + + for(node = interface_list->lh_Head ; + node->ln_Succ != NULL ; + node = node->ln_Succ) + { + memset(&sin,0,sizeof(sin)); + mtu = hardware_type = received = sent = bad = overrun = unknown = state = 0; + + if(Local_QueryInterfaceTags(cc,node->ln_Name, + IFQ_MTU, &mtu, + IFQ_HardwareType, &hardware_type, + IFQ_PacketsReceived, &received, + IFQ_PacketsSent, &sent, + IFQ_BadData, &bad, + IFQ_Overruns, &overrun, + IFQ_UnknownTypes, &unknown, + IFQ_Address, &sin, + IFQ_State, &state, + TAG_DONE) != 0) + { + continue; + } + + type = NULL; + for(i = 0 ; i < (LONG)NUM_ENTRIES(hardware_types) ; i++) + { + if(hardware_types[i].Number == hardware_type) + { + type = hardware_types[i].Name; + break; + } + } + + if(type == NULL) + lsprintf(cc,type = type_buffer,get_str(cc,MSG_SHOWNETSTATUS_UNKNOWN_HARDWARE_TYPE_TXT),hardware_type); + + if(sin.sin_addr.s_addr != INADDR_ANY) + addr = routename(cc,sin.sin_addr.s_addr,cc->cc_Line1,MAXHOSTNAMELEN); + else + addr = "-"; + + if(n++ == 0) + { + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_TITLE_TXT), + begin_underline(cc), + get_str(cc,MSG_SHOWNETSTATUS_NAME_TXT), + get_str(cc,MSG_SHOWNETSTATUS_MTU_TXT), + get_str(cc,MSG_SHOWNETSTATUS_TYPE_TXT), + get_str(cc,MSG_SHOWNETSTATUS_ADDRESS_TXT), + get_str(cc,MSG_SHOWNETSTATUS_RECEIVED_TXT), + get_str(cc,MSG_SHOWNETSTATUS_SENT_TXT), + get_str(cc,MSG_SHOWNETSTATUS_DROPPED_TXT), + get_str(cc,MSG_SHOWNETSTATUS_OVERRUNS_TXT), + get_str(cc,MSG_SHOWNETSTATUS_UNKNOWN_TXT), + get_str(cc,MSG_SHOWNETSTATUS_STATUS_TXT), + end_underline(cc)); + } + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_LINE_TXT), + node->ln_Name,mtu,type,addr,received,sent,bad,overrun,unknown,get_str(cc,(state == SM_Up) ? MSG_SHOWNETSTATUS_UP_TXT : MSG_SHOWNETSTATUS_DOWN_TXT)); + } + + if(n == 0) + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_NO_INTERFACES_AVAILABLE_TXT)); +} + +STATIC BOOL +print_interface_info(struct CommandContext * cc,STRPTR name) +{ + DECLARE_DOSBASE(cc); + DECLARE_SOCKETBASE(cc); + + struct SANA2CopyStats s2cs; + UBYTE type_buffer[80]; + STRPTR type; + struct sockaddr_in sin; + struct sockaddr_in sin_peer; + struct sockaddr_in sin_mask; + LONG bps; + UBYTE hardware_address[16]; + LONG hardware_address_size; + STRPTR device_name; + LONG device_unit; + LONG mtu; + LONG hardware_type; + ULONG sent; + ULONG received; + ULONG bad; + ULONG overrun; + ULONG unknown; + LONG bind_type; + struct DateStamp lease_expire; + LONG num_read_requests; + LONG max_read_requests; + LONG num_pending_read_requests; + LONG num_write_requests; + LONG max_write_requests; + LONG num_pending_write_requests; + LONG state; + LONG i; + SBQUAD_T bytes_in; + SBQUAD_T bytes_out; + UBYTE byte_count[80]; + BOOL success; + BOOL have_peer_address; + LONG input_dropped = 0; + LONG output_dropped = 0; + + if(cc->cc_Something) + lprintf(cc,"\n"); + else + cc->cc_Something = TRUE; + + memset(&sin,0,sizeof(sin)); + memset(&sin_peer,0,sizeof(sin_peer)); + memset(&sin_mask,0,sizeof(sin_mask)); + memset(hardware_address,0,sizeof(hardware_address)); + device_name = NULL; + device_unit = 0; + hardware_address_size = mtu = bps = hardware_type = received = sent = bad = overrun = unknown = state = 0; + bind_type = IFABT_Unknown; + memset(&lease_expire,0,sizeof(lease_expire)); + memset(&s2cs,0,sizeof(s2cs)); + + if(Local_QueryInterfaceTags(cc,name, + IFQ_DeviceName, &device_name, + IFQ_DeviceUnit, &device_unit, + IFQ_HardwareAddressSize, &hardware_address_size, + IFQ_HardwareAddress, hardware_address, + IFQ_MTU, &mtu, + IFQ_BPS, &bps, + IFQ_HardwareType, &hardware_type, + IFQ_PacketsReceived, &received, + IFQ_PacketsSent, &sent, + IFQ_BadData, &bad, + IFQ_Overruns, &overrun, + IFQ_UnknownTypes, &unknown, + IFQ_Address, &sin, + IFQ_NetMask, &sin_mask, + IFQ_State, &state, + IFQ_AddressBindType, &bind_type, + IFQ_AddressLeaseExpires, &lease_expire, + IFQ_NumReadRequests, &num_read_requests, + IFQ_MaxReadRequests, &max_read_requests, + IFQ_NumReadRequestsPending, &num_pending_read_requests, + IFQ_NumWriteRequests, &num_write_requests, + IFQ_MaxWriteRequests, &max_write_requests, + IFQ_NumWriteRequestsPending, &num_pending_write_requests, + IFQ_GetBytesIn, &bytes_in, + IFQ_GetBytesOut, &bytes_out, + IFQ_GetSANA2CopyStats, &s2cs, + IFQ_InputDrops, &input_dropped, + IFQ_OutputDrops, &output_dropped, + TAG_DONE) != 0) + { + success = FALSE; + goto out; + } + + if(hardware_address_size > (LONG)sizeof(hardware_address) * 8) + hardware_address_size = sizeof(hardware_address) * 8; + + if(Local_QueryInterfaceTags(cc,name, + IFQ_DestinationAddress,&sin_peer, + TAG_DONE) == 0) + { + have_peer_address = TRUE; + } + else + { + have_peer_address = FALSE; + } + + type = NULL; + for(i = 0 ; i < (LONG)NUM_ENTRIES(hardware_types) ; i++) + { + if(hardware_types[i].Number == hardware_type) + { + type = hardware_types[i].Name; + break; + } + } + + if(type == NULL) + lsprintf(cc,type = type_buffer,get_str(cc,MSG_SHOWNETSTATUS_UNKNOWN_HARDWARE_TYPE_TXT),hardware_type); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_TITLE_TXT), + begin_underline(cc), + name, + end_underline(cc)); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_DEVICE_NAME_TXT),device_name); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_DEVICE_UNIT_TXT),device_unit); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_HARDWARE_ADDRESS_TXT)); + + if(hardware_address_size == 32) + { + lprintf(cc,"%s",Inet_NtoA(sin.sin_addr.s_addr)); + } + else + { + for(i = 0 ; i < hardware_address_size/8 ; i++) + { + if(i != 0) + lprintf(cc,":"); + + lprintf(cc,"%02lx",hardware_address[i]); + } + } + + lprintf(cc,"\n"); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_MTU_TXT),mtu); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_TRANSMISSION_SPEED_TXT),bps); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_HARDWARE_TYPE_TXT),type); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_PACKETS_SENT_TXT),sent); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_PACKETS_RECEIVED_TXT),received); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_PACKETS_DROPPED_TXT),bad,input_dropped,output_dropped); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_BUFFER_OVERRUNS_TXT),overrun); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_UNKNOWN_PACKETS_TXT),unknown); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_ADDRESS_TXT),(sin.sin_addr.s_addr != INADDR_ANY) ? routename(cc,sin.sin_addr.s_addr,cc->cc_Line1,MAXHOSTNAMELEN) : get_str(cc,MSG_SHOWNETSTATUS_NOT_CONFIGURED_TXT)); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_NETWORK_MASK_TXT),(sin_mask.sin_addr.s_addr != INADDR_ANY) ? Inet_NtoA(sin_mask.sin_addr.s_addr) : get_str(cc,MSG_SHOWNETSTATUS_NOT_CONFIGURED_TXT)); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_READ_REQUESTS_TXT),num_read_requests,max_read_requests,num_pending_read_requests); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_WRITE_REQUESTS_TXT),num_write_requests,max_write_requests,num_pending_write_requests); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_BYTES_RECEIVED_TXT),convert_quad_to_string(cc->cc_Locale,&bytes_in,byte_count,sizeof(byte_count))); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_BYTES_SENT_TXT),convert_quad_to_string(cc->cc_Locale,&bytes_out,byte_count,sizeof(byte_count))); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_TRANSFER_STATISTICS_TXT),s2cs.s2cs_DMAIn,s2cs.s2cs_DMAOut,s2cs.s2cs_ByteIn,s2cs.s2cs_ByteOut,s2cs.s2cs_WordOut); + + if(bind_type == IFABT_Static || bind_type == IFABT_Dynamic) + { + LONG id = (bind_type == IFABT_Static) ? MSG_SHOWNETSTATUS_INTERFACE_INFO_BINDING_STATIC_TXT : MSG_SHOWNETSTATUS_INTERFACE_INFO_BINDING_DYNAMIC_TXT; + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_ADDRESS_BINDING_TXT),get_str(cc,id)); + + if(bind_type == IFABT_Dynamic) + { + UBYTE buffer[2*LEN_DATSTRING+3]; + STRPTR str; + + if(lease_expire.ds_Days == 0 && + lease_expire.ds_Minute == 0 && + lease_expire.ds_Tick == 0) + { + str = get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_LEASE_NEVER_EXPIRES_TXT); + } + else + { + struct DateTime dat; + UBYTE date[LEN_DATSTRING+1]; + UBYTE time[LEN_DATSTRING+1]; + + memset(&dat,0,sizeof(dat)); + + dat.dat_Stamp = lease_expire; + dat.dat_Format = FORMAT_DEF; + dat.dat_StrDate = date; + dat.dat_StrTime = time; + + DateToStr(&dat); + + strip_extra_blank_spaces(date); + strip_extra_blank_spaces(time); + + strcpy(buffer,date); + strcat(buffer," "); + strcat(buffer,time); + + str = buffer; + } + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_LEASE_EXPIRES_TXT),str); + } + } + + if(have_peer_address) + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_PEER_ADDRESS_TXT),(sin_peer.sin_addr.s_addr != INADDR_ANY) ? routename(cc,sin_peer.sin_addr.s_addr,cc->cc_Line1,MAXHOSTNAMELEN) : get_str(cc,MSG_SHOWNETSTATUS_NOT_CONFIGURED_TXT)); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_INTERFACE_INFO_STATUS_TXT),get_str(cc,(state == SM_Up) ? MSG_SHOWNETSTATUS_UP_TXT : MSG_SHOWNETSTATUS_DOWN_TXT)); + + success = TRUE; + + out: + + return(success); +} + +/****************************************************************************/ + +STATIC VOID +print_icmp_status(struct CommandContext * cc,struct icmpstat *icps) +{ + if(cc->cc_Something) + lprintf(cc,"\n"); + else + cc->cc_Something = TRUE; + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_TITLE_TXT),begin_underline(cc),end_underline(cc)); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_ERRORS_GENERATED_TXT),icps->icps_error); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_IP_PACKETS_TOO_SHORT_TXT),icps->icps_oldshort); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_PACKETS_NOT_RESPONDED_TO_TXT),icps->icps_oldicmp); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_ECHO_REPLY_PACKETS_SENT_TXT),icps->icps_outhist[ICMP_ECHOREPLY]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_DESTINATION_UNREACHABLE_TXT),icps->icps_outhist[ICMP_UNREACH]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_SOURCE_QUENCH_TXT),icps->icps_outhist[ICMP_SOURCEQUENCH]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_REDIRECT_TXT),icps->icps_outhist[ICMP_REDIRECT]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_ECHO_TXT),icps->icps_outhist[ICMP_ECHO]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_ROUTER_ADVERTIZEMENT_TXT),icps->icps_outhist[ICMP_ROUTERADVERT]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_ROUTER_SOLICITATION_TXT),icps->icps_outhist[ICMP_ROUTERSOLICIT]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_TIME_EXCEEDED_TXT),icps->icps_outhist[ICMP_TIMXCEED]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_BAD_IP_HEADER_TXT),icps->icps_outhist[ICMP_PARAMPROB]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REQUEST_TXT),icps->icps_outhist[ICMP_TSTAMP]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REPLY_TXT),icps->icps_outhist[ICMP_TSTAMPREPLY]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_INFORMATION_REQUEST_TXT),icps->icps_outhist[ICMP_IREQ]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_INFORMATION_REPLY_TXT),icps->icps_outhist[ICMP_IREQREPLY]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REQUEST_TXT),icps->icps_outhist[ICMP_MASKREQ]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REPLY_TXT),icps->icps_outhist[ICMP_MASKREPLY]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_RECEIVED_CODES_OUT_OF_RANGE_TXT),icps->icps_badcode); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_RECEIVED_PACKETS_TOO_SHORT_TXT),icps->icps_tooshort); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_RECEIVED_PACKET_CHECKSUM_ERRORS_TXT),icps->icps_checksum); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_RECEIVED_CODES_BOUND_MISMATCH_TXT),icps->icps_badlen); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_RESPONSES_SENT_TXT),icps->icps_reflect); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_ECHO_REPLIES_RECEIVED_TXT),icps->icps_inhist[ICMP_ECHOREPLY]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_DESTINATION_UNREACHABLE_RECEIVED_TXT),icps->icps_inhist[ICMP_UNREACH]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_SOURCE_QUENCH_RECEIVED_TXT),icps->icps_inhist[ICMP_SOURCEQUENCH]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_REDIRECT_RECEIVED_TXT),icps->icps_inhist[ICMP_REDIRECT]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_ECHO_RECEIVED_TXT),icps->icps_inhist[ICMP_ECHO]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_ROUTER_ADVERTIZEMENT_RECEIVED_TXT),icps->icps_inhist[ICMP_ROUTERADVERT]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_ROUTER_SOLICITATION_RECEIVED_TXT),icps->icps_inhist[ICMP_ROUTERSOLICIT]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_TIME_EXCEEDED_RECEIVED_TXT),icps->icps_inhist[ICMP_TIMXCEED]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_BAD_IP_HEADER_RECEIVED_TXT),icps->icps_inhist[ICMP_PARAMPROB]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REQUEST_RECEIVED_TXT),icps->icps_inhist[ICMP_TSTAMP]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REPLY_RECEIVED_TXT),icps->icps_inhist[ICMP_TSTAMPREPLY]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_INFORMATION_REQUEST_RECEIVED_TXT),icps->icps_inhist[ICMP_IREQ]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_INFORMATION_REPLY_RECEIVED_TXT),icps->icps_inhist[ICMP_IREQREPLY]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REQUEST_RECEIVED_TXT),icps->icps_inhist[ICMP_MASKREQ]); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REPLY_RECEIVED_TXT),icps->icps_inhist[ICMP_MASKREPLY]); +} + +STATIC VOID +print_igmp_status(struct CommandContext * cc,struct igmpstat *igps) +{ + if(cc->cc_Something) + lprintf(cc,"\n"); + else + cc->cc_Something = TRUE; + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IGMP_TITLE_TXT),begin_underline(cc),end_underline(cc)); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IGMP_TOTAL_MESSAGES_RECEIVED_TXT),igps->igps_rcv_total); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IGMP_MESSAGES_RECEIVED_TOO_SHORT_TXT),igps->igps_rcv_tooshort); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IGMP_MESSAGES_RECEIVED_BAD_CHECKSUM_TXT),igps->igps_rcv_badsum); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_QUERIES_RECEIVED_TXT),igps->igps_rcv_queries); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IGMP_INVALID_QUERIES_RECEIVED_TXT),igps->igps_rcv_badqueries); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_REPORTS_RECEIVED_TXT),igps->igps_rcv_reports); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IGMP_INVALID_REPORTS_RECEIVED_TXT),igps->igps_rcv_badreports); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_REPORTS_RECEIVED_FOR_THIS_GROUP_TXT),igps->igps_rcv_ourreports); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_REPORTS_SENT_TXT),igps->igps_snd_reports); +} + +STATIC VOID +print_ip_status(struct CommandContext * cc,struct ipstat *ips) +{ + if(cc->cc_Something) + lprintf(cc,"\n"); + else + cc->cc_Something = TRUE; + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_TITLE_TXT),begin_underline(cc),end_underline(cc)); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_TOTAL_PACKETS_RECEIVED_TXT),ips->ips_total); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_WITH_CHECKSUM_ERRORS_TXT),ips->ips_badsum); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_TOO_SHORT_TXT),ips->ips_tooshort); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_TOO_SMALL_TXT),ips->ips_toosmall); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_WITH_BAD_DATA_SIZE_TXT),ips->ips_badhlen); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_WITH_BAD_HEADER_SIZE_TXT),ips->ips_badlen); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_FRAGMENTS_RECEIVED_TXT),ips->ips_fragments); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_FRAGMENTS_DROPPED_TXT),ips->ips_fragdropped); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_FRAGMENTS_TIMED_OUT_TXT),ips->ips_fragtimeout); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_FORWARDED_TXT),ips->ips_forward); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_CANNOT_FORWARD_TXT),ips->ips_cantforward); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_FORWARDED_ON_SAME_NETWORK_TXT),ips->ips_redirectsent); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_WITH_UNKNOWN_PROTOCOLS_TXT),ips->ips_noproto); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_DATAGRAMS_DELIVERED_TXT),ips->ips_delivered); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_GENERATED_TXT),ips->ips_localout); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_LOST_TXT),ips->ips_odropped); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_REASSEMBLED_TXT),ips->ips_reassembled); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_FRAGMENTED_TXT),ips->ips_fragmented); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_OUTPUT_FRAGMENTS_CREATED_TXT),ips->ips_ofragments); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_CANNOT_FRAGMENT_TXT),ips->ips_cantfrag); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_ERRORS_IN_OPTION_PROCESSING_TXT),ips->ips_badoptions); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_NO_ROUTE_TXT),ips->ips_noroute); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_PACKETS_WITH_BAD_IP_VERSION_TXT),ips->ips_badvers); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_IP_RAW_PACKETS_SENT_TXT),ips->ips_rawout); +} + +STATIC VOID +print_mb_status(struct CommandContext * cc,struct mbstat *m) +{ + if(cc->cc_Something) + lprintf(cc,"\n"); + else + cc->cc_Something = TRUE; + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MBUF_TITLE_TXT),begin_underline(cc),end_underline(cc)); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MBUF_BUFFERS_FROM_PAGE_POOL_TXT),m->m_mbufs); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MBUF_CLUSTERS_FROM_PAGE_POOL_TXT),m->m_clusters); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MBUF_FREE_CLUSTERS_TXT),m->m_clfree); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MBUF_DROPS_TXT),m->m_drops); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MBUF_WAIT_TXT),m->m_wait); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MBUF_DRAIN_TXT),m->m_drain); +} + +STATIC VOID +print_mrt_status(struct CommandContext * cc,struct mrtstat *mrts) +{ + if(cc->cc_Something) + lprintf(cc,"\n"); + else + cc->cc_Something = TRUE; + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MULTICAST_TITLE_TXT),begin_underline(cc),end_underline(cc)); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MULTICAST_ROUTE_LOOKUPS_TXT),mrts->mrts_mrt_lookups); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MULTICAST_ROUTE_CACHE_MISSES_TXT),mrts->mrts_mrt_misses); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MULTICAST_GROUP_ADDRESS_LOOKUPS_TXT),mrts->mrts_grp_lookups); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MULTICAST_GROUP_ADDRESS_CACHE_MISSES_TXT),mrts->mrts_grp_misses); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MULTICAST_NO_ROUTE_TXT),mrts->mrts_no_route); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MULTICAST_BAD_TUNNEL_TXT),mrts->mrts_bad_tunnel); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MULTICAST_CANNOT_TUNNEL_TXT),mrts->mrts_cant_tunnel); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_MULTICAST_CANNOT_WRONG_INTERFACE_TXT),mrts->mrts_wrong_if); +} + +STATIC VOID +print_rt_status(struct CommandContext * cc,struct rtstat *rts) +{ + if(cc->cc_Something) + lprintf(cc,"\n"); + else + cc->cc_Something = TRUE; + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ROUTING_TITLE_TXT),begin_underline(cc),end_underline(cc)); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ROUTING_BAD_REDIRECT_TXT),rts->rts_badredirect); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ROUTING_DYNAMIC_TXT),rts->rts_dynamic); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ROUTING_NEW_GATEWAY_TXT),rts->rts_newgateway); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ROUTING_UNREACH_TXT),rts->rts_unreach); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_ROUTING_WILDCARD_TXT),rts->rts_wildcard); +} + +STATIC VOID +print_tcp_status(struct CommandContext * cc,struct tcpstat *tcps) +{ + if(cc->cc_Something) + lprintf(cc,"\n"); + else + cc->cc_Something = TRUE; + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_TITLE_TXT),begin_underline(cc),end_underline(cc)); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_CONNATTEMPT_TXT),tcps->tcps_connattempt); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_ACCEPTS_TXT),tcps->tcps_accepts); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_CONNECTS_TXT),tcps->tcps_connects); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_DROPS_TXT),tcps->tcps_drops); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_CONNDROPS_TXT),tcps->tcps_conndrops); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_CLOSED_TXT),tcps->tcps_closed); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_SEGSTIMED_TXT),tcps->tcps_segstimed); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RTTUPDATED_TXT),tcps->tcps_rttupdated); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_DELACK_TXT),tcps->tcps_delack); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_TIMEOUTDROP_TXT),tcps->tcps_timeoutdrop); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_PERSISTTIMEO_TXT),tcps->tcps_persisttimeo); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_KEEPTIMEO_TXT),tcps->tcps_keeptimeo); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_KEEPPROBE_TXT),tcps->tcps_keepprobe); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_KEEPDROPS_TXT),tcps->tcps_keepdrops); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_SNDTOTAL_TXT),tcps->tcps_sndtotal); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_SNDPACK_TXT),tcps->tcps_sndpack); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_SNDBYTE_TXT),tcps->tcps_sndbyte); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_SNDREXMITPACK_TXT),tcps->tcps_sndrexmitpack); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_SNDREXMITBYTE_TXT),tcps->tcps_sndrexmitbyte); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_SNDACKS_TXT),tcps->tcps_sndacks); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_SNDPROBE_TXT),tcps->tcps_sndprobe); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_SNDURG_TXT),tcps->tcps_sndurg); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_SNDWINUP_TXT),tcps->tcps_sndwinup); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_SNDCTRL_TXT),tcps->tcps_sndctrl); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVTOTAL_TXT),tcps->tcps_rcvtotal); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVPACK_TXT),tcps->tcps_rcvpack); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVBYTE_TXT),tcps->tcps_rcvbyte); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVBADSUM_TXT),tcps->tcps_rcvbadsum); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVBADOFF_TXT),tcps->tcps_rcvbadoff); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVSHORT_TXT),tcps->tcps_rcvshort); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVDUPPACK_TXT),tcps->tcps_rcvduppack); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVDUPBYTE_TXT),tcps->tcps_rcvdupbyte); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVOOPACK_TXT),tcps->tcps_rcvoopack); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVOOBYTE_TXT),tcps->tcps_rcvoobyte); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVPACKAFTERWIN_TXT),tcps->tcps_rcvpackafterwin); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVBYTEAFTERWIN_TXT),tcps->tcps_rcvbyteafterwin); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVAFTERCLOSE_TXT),tcps->tcps_rcvafterclose); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVWINPROBE_TXT),tcps->tcps_rcvwinprobe); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVDUPACK_TXT),tcps->tcps_rcvdupack); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVACKTOOMUCH_TXT),tcps->tcps_rcvacktoomuch); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVACKPACK_TXT),tcps->tcps_rcvackpack); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVACKBYTE_TXT),tcps->tcps_rcvackbyte); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_RCVWINUPD_TXT),tcps->tcps_rcvwinupd); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_PAWSDROP_TXT),tcps->tcps_pawsdrop); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_PREDACK_TXT),tcps->tcps_predack); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_PREDDAT_TXT),tcps->tcps_preddat); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_PERSISTDROP_TXT),tcps->tcps_persistdrop); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_BADSYN_TXT),tcps->tcps_badsyn); +} + +STATIC VOID +print_udp_status(struct CommandContext * cc,struct udpstat *udps) +{ + if(cc->cc_Something) + lprintf(cc,"\n"); + else + cc->cc_Something = TRUE; + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_UDP_TITLE_TXT),begin_underline(cc),end_underline(cc)); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_UDP_IPACKETS_TXT),udps->udps_ipackets); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_UDP_HDROPS_TXT),udps->udps_hdrops); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_UDP_BADSUM_TXT),udps->udps_badsum); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_UDP_BADLEN_TXT),udps->udps_badlen); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_UDP_NOPORT_TXT),udps->udps_noport); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_UDP_NOPORTBCAST_TXT),udps->udps_noportbcast); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_UDP_FULLSOCK_TXT),udps->udps_fullsock); + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_UDP_OPACKETS_TXT),udps->udps_opackets); +} + +STATIC VOID +print_tcp_socket_status(struct CommandContext * cc,BOOL all_sockets,struct protocol_connection_data *pcd,LONG size) +{ + DECLARE_SOCKETBASE(cc); + + struct servent * s; + STRPTR status; + LONG i,m,n; + + if(cc->cc_Something) + lprintf(cc,"\n"); + else + cc->cc_Something = TRUE; + + if(size >= (int)sizeof(*pcd)) + { + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_SOCKET_TITLE_TXT), + begin_underline(cc), + get_str(cc,MSG_SHOWNETSTATUS_LOCAL_TXT), + get_str(cc,MSG_SHOWNETSTATUS_REMOTE_TXT), + get_str(cc,MSG_SHOWNETSTATUS_RECEIVE_LEN_TXT), + get_str(cc,MSG_SHOWNETSTATUS_SEND_LEN_TXT), + get_str(cc,MSG_SHOWNETSTATUS_STATUS_TXT), + end_underline(cc)); + } + + for(i = m = n = 0 ; i < size / (int)sizeof(*pcd) ; i++, pcd++, n++) + { + if(pcd->pcd_local_address.s_addr == INADDR_ANY && NOT all_sockets) + { + m++; + continue; + } + + if(pcd->pcd_local_address.s_addr != INADDR_ANY || cc->cc_NoNames) + routename(cc,pcd->pcd_local_address.s_addr,cc->cc_Line1,MAXHOSTNAMELEN); + else + strcpy(cc->cc_Line1,get_str(cc,MSG_SHOWNETSTATUS_WILDCARD_TXT)); + + if(cc->cc_NoNames) + s = NULL; + else + s = getservbyport(pcd->pcd_local_port,"tcp"); + + if(s != NULL) + lsprintf(cc,&cc->cc_Line1[strlen(cc->cc_Line1)],":%s",s->s_name); + else + lsprintf(cc,&cc->cc_Line1[strlen(cc->cc_Line1)],":%ld",pcd->pcd_local_port); + + routename(cc,pcd->pcd_foreign_address.s_addr,cc->cc_Line2,MAXHOSTNAMELEN); + + if(pcd->pcd_foreign_address.s_addr != INADDR_ANY) + { + if(cc->cc_NoNames) + s = NULL; + else + s = getservbyport(pcd->pcd_foreign_port,"tcp"); + + if(s != NULL) + lsprintf(cc,&cc->cc_Line2[strlen(cc->cc_Line2)],":%s",s->s_name); + else + lsprintf(cc,&cc->cc_Line2[strlen(cc->cc_Line2)],":%ld",pcd->pcd_foreign_port); + } + else + { + strcpy(cc->cc_Line2,"-"); + } + + if(TCPS_CLOSED <= pcd->pcd_tcp_state && pcd->pcd_tcp_state <= TCPS_TIME_WAIT) + status = get_str(cc,MSG_SHOWNETSTATUS_TCP_FSM_STATE1_TXT + pcd->pcd_tcp_state - TCPS_CLOSED); + else + status = "-"; + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_TCP_SOCKET_LINE_TXT),cc->cc_Line1,cc->cc_Line2,pcd->pcd_receive_queue_size,pcd->pcd_send_queue_size,status); + } + + if(n == 0) + { + if(m == 0) + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_NO_TCP_SOCKETS_IN_USE_TXT)); + else + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_SOME_TCP_SOCKETS_IN_USE_TXT),m); + } +} + +STATIC VOID +print_udp_socket_status(struct CommandContext * cc,BOOL all_sockets,struct protocol_connection_data *pcd,LONG size) +{ + DECLARE_SOCKETBASE(cc); + + struct servent * s; + LONG i,m,n; + + if(cc->cc_Something) + lprintf(cc,"\n"); + else + cc->cc_Something = TRUE; + + if(size >= (int)sizeof(*pcd)) + { + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_UDP_SOCKET_TITLE_TXT), + begin_underline(cc), + get_str(cc,MSG_SHOWNETSTATUS_LOCAL_TXT), + get_str(cc,MSG_SHOWNETSTATUS_REMOTE_TXT), + get_str(cc,MSG_SHOWNETSTATUS_RECEIVE_LEN_TXT), + get_str(cc,MSG_SHOWNETSTATUS_SEND_LEN_TXT), + end_underline(cc)); + } + + for(i = m = n = 0 ; i < size / (int)sizeof(*pcd) ; i++, pcd++, n++) + { + if(pcd->pcd_local_address.s_addr == INADDR_ANY && NOT all_sockets) + { + m++; + continue; + } + + if(pcd->pcd_local_address.s_addr != INADDR_ANY || cc->cc_NoNames) + routename(cc,pcd->pcd_local_address.s_addr,cc->cc_Line1,MAXHOSTNAMELEN); + else + strcpy(cc->cc_Line1,get_str(cc,MSG_SHOWNETSTATUS_WILDCARD_TXT)); + + if(cc->cc_NoNames) + s = NULL; + else + s = getservbyport(pcd->pcd_local_port,"udp"); + + if(s != NULL) + lsprintf(cc,&cc->cc_Line1[strlen(cc->cc_Line1)],":%s",s->s_name); + else + lsprintf(cc,&cc->cc_Line1[strlen(cc->cc_Line1)],":%ld",pcd->pcd_local_port); + + if(pcd->pcd_foreign_address.s_addr != INADDR_ANY) + { + routename(cc,pcd->pcd_foreign_address.s_addr,cc->cc_Line2,MAXHOSTNAMELEN); + + if(cc->cc_NoNames) + s = NULL; + else + s = getservbyport(pcd->pcd_foreign_port,"udp"); + + if(s != NULL) + lsprintf(cc,&cc->cc_Line2[strlen(cc->cc_Line2)],":%s",s->s_name); + else + lsprintf(cc,&cc->cc_Line2[strlen(cc->cc_Line2)],":%ld",pcd->pcd_foreign_port); + } + else + { + strcpy(cc->cc_Line2,"-"); + } + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_UDP_SOCKET_LINE_TXT),cc->cc_Line1,cc->cc_Line2,pcd->pcd_receive_queue_size,pcd->pcd_send_queue_size); + } + + if(n == 0) + { + if(m == 0) + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_NO_UDP_SOCKETS_IN_USE_TXT)); + else + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_SOME_UDP_SOCKETS_IN_USE_TXT),m); + } +} + +/****************************************************************************/ + +STATIC VOID +print_net_status_summary(struct CommandContext * cc) +{ + DECLARE_SOCKETBASE(cc); + + struct List * interface_list; + struct List * dns_list; + struct rt_msghdr * route_table; + struct sockaddr_in * default_route; + char * default_interface_name; + struct sockaddr_in default_interface_address; + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_STATUS_SUMMARY_TXT),begin_underline(cc),end_underline(cc)); + + default_interface_name = NULL; + memset(&default_interface_address,0,sizeof(default_interface_address)); + + interface_list = ObtainInterfaceList(); + if(interface_list != NULL && NOT IsListEmpty(interface_list)) + { + struct Node * node; + ULONG host_id; + + host_id = gethostid(); + + for(node = interface_list->lh_Head ; + node->ln_Succ != NULL ; + node = node->ln_Succ) + { + if(Local_QueryInterfaceTags(cc,node->ln_Name, + IFQ_Address,&default_interface_address, + TAG_DONE) != 0) + { + continue; + } + + if(default_interface_address.sin_addr.s_addr == host_id) + { + default_interface_name = node->ln_Name; + break; + } + } + } + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_LOCAL_HOST_ADDRESS_TXT)); + + if(default_interface_name != NULL) + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_LOCAL_HOST_ADDRESS_ON_INTERFACE_TXT),Inet_NtoA(default_interface_address.sin_addr.s_addr),default_interface_name); + else + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_NOT_CONFIGURED_TXT)); + + lprintf(cc,"\n"); + + default_route = NULL; + + route_table = GetRouteInfo(AF_UNSPEC,0); + if(route_table != NULL) + { + struct sockaddr_in * sin; + struct rt_msghdr * rtm; + struct sockaddr * sa; + LONG len; + + for(rtm = route_table ; + rtm->rtm_msglen > 0 ; + rtm = (struct rt_msghdr *)(((ULONG)rtm) + rtm->rtm_msglen)) + { + /* We need a route with a destination and a gateway address. */ + if(rtm->rtm_version != 3 || (rtm->rtm_addrs & RTA_DST) == 0 || (rtm->rtm_addrs & RTA_GATEWAY) == 0) + continue; + + /* The destination address follows the message header. */ + sa = (struct sockaddr *)(rtm + 1); + + /* The destination should be an Internet address */ + if(sa->sa_family != AF_INET) + continue; + + /* The default route is identified by having a 0.0.0.0 destination + address, which indicates a route that matches any destination + address. */ + sin = (struct sockaddr_in *)sa; + if(sin->sin_addr.s_addr != INADDR_ANY) + continue; + + /* Skip the destination address. */ + if(sa->sa_len == 0) + len = sizeof(long); + else + len = sa->sa_len; + + sa = (struct sockaddr *)(((ULONG)sa) + len); + + /* This should be the IP address of the gateway. It should be + an Internet address. */ + if(sa->sa_family != AF_INET) + continue; + + default_route = (struct sockaddr_in *)sa; + break; + } + } + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_DEFAULT_GATEWAY_ADDRESS_TXT)); + + if(default_route != NULL) + lprintf(cc,"%s",Inet_NtoA(default_route->sin_addr.s_addr)); + else + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_NOT_CONFIGURED_TXT)); + + lprintf(cc,"\n"); + + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_DOMAIN_NAME_SYSTEM_SERVERS_TXT)); + + dns_list = ObtainDomainNameServerList(); + if(dns_list != NULL && NOT IsListEmpty(dns_list)) + { + struct DomainNameServerNode * dnsn; + BOOL is_first = TRUE; + + for(dnsn = (struct DomainNameServerNode *)dns_list->lh_Head ; + dnsn->dnsn_MinNode.mln_Succ != NULL ; + dnsn = (struct DomainNameServerNode *)dnsn->dnsn_MinNode.mln_Succ) + { + if(NOT is_first) + lprintf(cc,", "); + + lprintf(cc,"%s",dnsn->dnsn_Address); + + is_first = FALSE; + } + } + else + { + lprintf(cc,get_str(cc,MSG_SHOWNETSTATUS_NOT_CONFIGURED_TXT)); + } + + lprintf(cc,"\n"); + + if(interface_list != NULL) + ReleaseInterfaceList(interface_list); + + if(dns_list != NULL) + ReleaseDomainNameServerList(dns_list); + + if(route_table != NULL) + FreeRouteInfo(route_table); +} + +/****************************************************************************/ + +STATIC LONG VARARGS68K +Local_ErrorPrintf(struct CommandContext * cc,STRPTR format,...) +{ + DECLARE_DOSBASE(cc); + DECLARE_SYSBASE(cc); + + va_list args; + LONG result; + BPTR fh; + + #if defined(__amigaos4__) + { + fh = ErrorOutput(); + } + #else + { + struct Process * this_process = (struct Process *)FindTask(NULL); + + fh = this_process->pr_CES; + } + #endif /* __amigaos4__ */ + + if(fh == ZERO) + fh = Output(); + + #if defined(__amigaos4__) + { + va_startlinear(args,format); + result = VFPrintf(fh,format,va_getlinearva(args,APTR)); + va_end(args); + } + #else + { + va_start(args,format); + result = VFPrintf(fh,format,args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +/****************************************************************************/ + +/* This looks up a locale string ID in the builtin database; adapted + from CygnusEd because I couldn't find my own implementation for this + application... */ +STATIC STRPTR +get_builtin_str(LONG id) +{ + LONG top,middle,bottom; + STRPTR builtin_string; + + /* The search area is all those message between bottom and top, inclusive. */ + bottom = 0; + top = NUM_ENTRIES(CatCompArray) - 1; + + /* Binary search through the CatCompArray to find the requested string. + Note that this assumes that the strings are sorted. Catcomp defaults + to creating sorted arrays, but it does _not_ force it. If in the .cd + file you specify out of order string numbers this routine will fail. */ + while(bottom != top) + { + middle = (bottom + top) / 2; + + if(CatCompArray[middle].cca_ID >= id) + top = middle; + else + bottom = middle + 1; + } + + /* The only time this error message should occur is if you've passed + a garbage number OR if the CatCompArray is not sorted. */ + if(CatCompArray[bottom].cca_ID == id) + builtin_string = (STRPTR)CatCompArray[bottom].cca_Str; + else + builtin_string = ""; + + return(builtin_string); +} + +STRPTR +get_str(struct CommandContext * cc, LONG id) +{ + STRPTR builtin_string; + STRPTR result; + + builtin_string = get_builtin_str(id); + + if(cc->cc_Catalog != NULL) + { + DECLARE_LOCALEBASE(cc); + + result = (STRPTR)GetCatalogStr(cc->cc_Catalog,id,builtin_string); + } + else + { + result = builtin_string; + } + + return(result); +} + +/****************************************************************************/ + +STATIC VARARGS68K LONG +Local_QueryInterfaceTags(struct CommandContext * cc,STRPTR interface_name,...) +{ + DECLARE_SOCKETBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,interface_name); + result = QueryInterfaceTagList(interface_name,va_getlinearva(args,struct TagItem *)); + va_end(args); + } + #else + { + va_start(args,interface_name); + result = QueryInterfaceTagList(interface_name,(struct TagItem *)args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} + +STATIC VARARGS68K LONG +Local_SocketBaseTags(struct CommandContext * cc,...) +{ + DECLARE_SOCKETBASE(cc); + + va_list args; + LONG result; + + #if defined(__amigaos4__) + { + va_startlinear(args,cc); + result = SocketBaseTagList(va_getlinearva(args,struct TagItem *)); + va_end(args); + } + #else + { + va_start(args,cc); + result = SocketBaseTagList((struct TagItem *)args); + va_end(args); + } + #endif /* __amigaos4__ */ + + return(result); +} diff --git a/examples/ShowNetStatus_rev.h b/examples/ShowNetStatus_rev.h new file mode 100644 index 0000000..95ba218 --- /dev/null +++ b/examples/ShowNetStatus_rev.h @@ -0,0 +1,6 @@ +#define VERSION 4 +#define REVISION 28 +#define DATE "11.3.2009" +#define VERS "ShowNetStatus 4.28" +#define VSTRING "ShowNetStatus 4.28 (11.3.2009)\r\n" +#define VERSTAG "\0$VER: ShowNetStatus 4.28 (11.3.2009)" diff --git a/examples/assert.c b/examples/assert.c new file mode 100644 index 0000000..7f779b6 --- /dev/null +++ b/examples/assert.c @@ -0,0 +1,392 @@ +/* + * $Id: assert.c,v 1.1 2004-03-26 21:08:47 obarthel Exp $ + * + * :ts=8 + * + * Copyright © 2001-2003 by Olaf Barthel. All Rights Reserved. + */ + +/****************************************************************************/ + +#include + +#include +#include + +#include +#include + +#include + +extern struct Library * SysBase; + +extern void kprintf(const char *,...); +extern void __stdargs kputc(char c); + +/****************************************************************************/ + +#include + +/****************************************************************************/ + +#define DEBUGLEVEL_OnlyAsserts 0 +#define DEBUGLEVEL_Reports 1 +#define DEBUGLEVEL_CallTracing 2 + +/****************************************************************************/ + +static int indent_level = 0; +static int debug_level = DEBUGLEVEL_CallTracing; + +static char program_name[40]; +static int program_name_len = 0; + +/****************************************************************************/ + +void +_SETPROGRAMNAME(char *name) +{ + if(name != NULL && name[0] != '\0') + { + program_name_len = strlen(name); + if(program_name_len >= sizeof(program_name)) + program_name_len = sizeof(program_name)-1; + + strncpy(program_name,name,program_name_len); + program_name[program_name_len] = '\0'; + } + else + { + program_name_len = 0; + } +} + +/****************************************************************************/ + +int +_SETDEBUGLEVEL(int level) +{ + int old_level = debug_level; + + debug_level = level; + + return(old_level); +} + +/****************************************************************************/ + +int +_GETDEBUGLEVEL(void) +{ + return(debug_level); +} + +/****************************************************************************/ + +static int previous_debug_level = -1; + +void +_PUSHDEBUGLEVEL(int level) +{ + previous_debug_level = _SETDEBUGLEVEL(level); +} + +void +_POPDEBUGLEVEL(void) +{ + if(previous_debug_level != -1) + { + _SETDEBUGLEVEL(previous_debug_level); + + previous_debug_level = -1; + } +} + +/****************************************************************************/ + +void +_INDENT(void) +{ + if(program_name_len > 0) + kprintf("(%s) ",program_name); + + if(debug_level >= DEBUGLEVEL_CallTracing) + { + int i; + + for(i = 0 ; i < indent_level ; i++) + kprintf(" "); + } +} + +/****************************************************************************/ + +void +_SHOWVALUE( + unsigned long value, + int size, + const char *name, + const char *file, + int line) +{ + if(debug_level >= DEBUGLEVEL_Reports) + { + char *fmt; + + switch(size) + { + case 1: + + fmt = "%s:%ld:%s = %ld, 0x%02lx"; + break; + + case 2: + + fmt = "%s:%ld:%s = %ld, 0x%04lx"; + break; + + default: + + fmt = "%s:%ld:%s = %ld, 0x%08lx"; + break; + } + + _INDENT(); + + kprintf(fmt,file,line,name,value,value); + + if(size == 1 && value < 256) + { + if(value < ' ' || (value >= 127 && value < 160)) + kprintf(", '\\x%02lx'",value); + else + kprintf(", '%lc'",value); + } + + kprintf("\n"); + } +} + +/****************************************************************************/ + +void +_SHOWPOINTER( + void *pointer, + const char *name, + const char *file, + int line) +{ + if(debug_level >= DEBUGLEVEL_Reports) + { + char *fmt; + + _INDENT(); + + if(pointer != NULL) + fmt = "%s:%ld:%s = 0x%08lx\n"; + else + fmt = "%s:%ld:%s = NULL\n"; + + kprintf(fmt,file,line,name,pointer); + } +} + +/****************************************************************************/ + +void +_SHOWSTRING( + const char *string, + const char *name, + const char *file, + int line) +{ + if(debug_level >= DEBUGLEVEL_Reports) + { + _INDENT(); + kprintf("%s:%ld:%s = 0x%08lx \"%s\"\n",file,line,name,string,string); + } +} + +/****************************************************************************/ + +void +_SHOWMSG( + const char *string, + const char *file, + int line) +{ + if(debug_level >= DEBUGLEVEL_Reports) + { + _INDENT(); + kprintf("%s:%ld:%s\n",file,line,string); + } +} + +/****************************************************************************/ + +void +_DPRINTF_HEADER( + const char *file, + int line) +{ + if(debug_level >= DEBUGLEVEL_Reports) + { + _INDENT(); + kprintf("%s:%ld:",file,line); + } +} + +static void __asm +putch(register __d0 c) +{ + if(c != '\0') + kputc(c); +} + +void +_DPRINTF(const char *fmt,...) +{ + if(debug_level >= DEBUGLEVEL_Reports) + { + va_list args; + + va_start(args,fmt); + RawDoFmt((char *)fmt,args,(VOID (*)())putch,NULL); + va_end(args); + + kprintf("\n"); + } +} + +void +_DLOG(const char *fmt,...) +{ + if(debug_level >= DEBUGLEVEL_Reports) + { + va_list args; + + va_start(args,fmt); + RawDoFmt((char *)fmt,args,(VOID (*)())putch,NULL); + va_end(args); + } +} + +/****************************************************************************/ + +void +_ENTER( + const char *file, + int line, + const char *function) +{ + if(debug_level >= DEBUGLEVEL_CallTracing) + { + _INDENT(); + kprintf("%s:%ld:Entering %s\n",file,line,function); + } + + indent_level++; +} + +void +_LEAVE( + const char *file, + int line, + const char *function) +{ + indent_level--; + + if(debug_level >= DEBUGLEVEL_CallTracing) + { + _INDENT(); + kprintf("%s:%ld: Leaving %s\n",file,line,function); + } +} + +void +_RETURN( + const char *file, + int line, + const char *function, + unsigned long result) +{ + indent_level--; + + if(debug_level >= DEBUGLEVEL_CallTracing) + { + _INDENT(); + kprintf("%s:%ld: Leaving %s (result 0x%08lx, %ld)\n",file,line,function,result,result); + } +} + +/****************************************************************************/ + +void +_ASSERT( + int x, + const char *xs, + const char *file, + int line, + const char *function) +{ + #ifdef CONFIRM + { + STATIC BOOL ScrollMode = FALSE; + STATIC BOOL BatchMode = FALSE; + + if(BatchMode == FALSE) + { + if(x == 0) + { + kprintf("%s:%ld:Expression `%s' failed assertion in %s().\n", + file, + line, + xs, + function); + + if(ScrollMode == FALSE) + { + ULONG Signals; + + SetSignal(0,SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D | SIGBREAKF_CTRL_E); + + kprintf(" ^C to continue, ^D to enter scroll mode, ^E to enter batch mode\r"); + + Signals = Wait(SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D | SIGBREAKF_CTRL_E); + + if(Signals & SIGBREAKF_CTRL_D) + { + ScrollMode = TRUE; + + kprintf("Ok, entering scroll mode\033[K\n"); + } + else if (Signals & SIGBREAKF_CTRL_E) + { + BatchMode = TRUE; + + kprintf("Ok, entering batch mode\033[K\n"); + } + else + { + /* Continue */ + + kprintf("\033[K\r"); + } + } + } + } + } + #else + { + if(x == 0) + { + _INDENT(); + kprintf("%s:%ld:Expression `%s' failed assertion in %s().\n", + file, + line, + xs, + function); + } + } + #endif /* CONFIRM */ +} diff --git a/examples/assert.h b/examples/assert.h new file mode 100644 index 0000000..10dc792 --- /dev/null +++ b/examples/assert.h @@ -0,0 +1,95 @@ +/* + * $Id: assert.h,v 1.1 2004-03-26 21:08:47 obarthel Exp $ + * + * :ts=8 + * + * Copyright © 2001 by Olaf Barthel. All Rights Reserved. + */ + +/****************************************************************************/ + +/* IMPORTANT: If DEBUG is redefined, it must happen only here. This + * will cause all modules to depend upon it to be rebuilt + * by the smakefile (that is, provided the smakefile has + * all the necessary dependency lines in place). + */ + +/*#define DEBUG*/ + +/****************************************************************************/ + +#ifdef ASSERT +#undef ASSERT +#endif /* ASSERT */ + +#define PUSH_ASSERTS() PUSHDEBUGLEVEL(0) +#define PUSH_REPORTS() PUSHDEBUGLEVEL(1) +#define PUSH_CALLS() PUSHDEBUGLEVEL(2) +#define PUSH_ALL() PUSHDEBUGLEVEL(2) +#define POP() POPDEBUGLEVEL() + +#if defined(DEBUG) && defined(__SASC) + void _ASSERT(int x,const char *xs,const char *file,int line,const char *function); + void _SHOWVALUE(unsigned long value,int size,const char *name,const char *file,int line); + void _SHOWPOINTER(void *p,const char *name,const char *file,int line); + void _SHOWSTRING(const char *string,const char *name,const char *file,int line); + void _SHOWMSG(const char *msg,const char *file,int line); + void _ENTER(const char *file,int line,const char *function); + void _LEAVE(const char *file,int line,const char *function); + void _RETURN(const char *file,int line,const char *function,unsigned long result); + void _DPRINTF_HEADER(const char *file,int line); + void _DPRINTF(const char *format,...); + void _DLOG(const char *format,...); + int _SETDEBUGLEVEL(int level); + void _PUSHDEBUGLEVEL(int level); + void _POPDEBUGLEVEL(void); + int _GETDEBUGLEVEL(void); + void _SETPROGRAMNAME(char *name); + + #define ASSERT(x) _ASSERT((int)(x),#x,__FILE__,__LINE__,__FUNC__) + #define ENTER() _ENTER(__FILE__,__LINE__,__FUNC__) + #define LEAVE() _LEAVE(__FILE__,__LINE__,__FUNC__) + #define RETURN(r) _RETURN(__FILE__,__LINE__,__FUNC__,(unsigned long)r) + #define SHOWVALUE(v) _SHOWVALUE(v,sizeof(v),#v,__FILE__,__LINE__) + #define SHOWPOINTER(p) _SHOWPOINTER(p,#p,__FILE__,__LINE__) + #define SHOWSTRING(s) _SHOWSTRING(s,#s,__FILE__,__LINE__) + #define SHOWMSG(s) _SHOWMSG(s,__FILE__,__LINE__) + #define D(s) do { _DPRINTF_HEADER(__FILE__,__LINE__); _DPRINTF s; } while(0) + #define PRINTHEADER() _DPRINTF_HEADER(__FILE__,__LINE__) + #define PRINTF(s) _DLOG s + #define LOG(s) do { _DPRINTF_HEADER(__FILE__,__LINE__); _DLOG("<%s()>:",__FUNC__); _DLOG s; } while(0) + #define SETDEBUGLEVEL(l) _SETDEBUGLEVEL(l) + #define PUSHDEBUGLEVEL(l) _PUSHDEBUGLEVEL(l) + #define POPDEBUGLEVEL() _POPDEBUGLEVEL() + #define SETPROGRAMNAME(n) _SETPROGRAMNAME(n) + #define GETDEBUGLEVEL() _GETDEBUGLEVEL() + + #undef DEBUG + #define DEBUG 1 +#else + #define ASSERT(x) ((void)0) + #define ENTER() ((void)0) + #define LEAVE() ((void)0) + #define RETURN(r) ((void)0) + #define SHOWVALUE(v) ((void)0) + #define SHOWPOINTER(p) ((void)0) + #define SHOWSTRING(s) ((void)0) + #define SHOWMSG(s) ((void)0) + #define D(s) ((void)0) + #define PRINTHEADER() ((void)0) + #define PRINTF(s) ((void)0) + #define LOG(s) ((void)0) + #define SETDEBUGLEVEL(l) ((void)0) + #define PUSHDEBUGLEVEL(l) ((void)0) + #define POPDEBUGLEVEL() ((void)0) + #define SETPROGRAMNAME(n) ((void)0) + #define GETDEBUGLEVEL() (0) + + #ifdef DEBUG + #undef DEBUG + #endif /* DEBUG */ + + #define DEBUG 0 +#endif /* DEBUG */ + +/****************************************************************************/ diff --git a/examples/compiler.h b/examples/compiler.h new file mode 100644 index 0000000..1ff346a --- /dev/null +++ b/examples/compiler.h @@ -0,0 +1,56 @@ +/* + * $Id: compiler.h,v 1.3 2007-08-26 12:30:26 obarthel Exp $ + * + * :ts=4 + * + * Copyright © 2001-2007 by Olaf Barthel. All Rights Reserved. + */ + +#ifndef _COMPILER_H +#define _COMPILER_H + +/****************************************************************************/ + +#ifndef EXEC_TYPES_H +#include +#endif /* EXEC_TYPES_H */ + +/****************************************************************************/ + +/* The following definitions are redundant in the V50 AmigaOS header files. */ +#ifndef AMIGA_COMPILER_H + +/****************************************************************************/ + +#if defined(__SASC) +#define ASM __asm +#define REG(r,p) register __##r p +#define INLINE __inline +#define INTERRUPT __interrupt +#define FAR __far +#define STDARGS __stdargs +#elif defined(__GNUC__) +#define ASM +#define REG(r,p) p __asm(#r) +#define INLINE __inline__ +#define INTERRUPT __attribute__((__interrupt__)) +#define FAR +#define STDARGS __attribute__((__stkparm__)) +#else +#define ASM +#define REG(x) +#define INLINE +#define INTERRUPT +#define FAR +#define STDARGS +#endif /* __SASC */ + +#define VARARGS68K + +/****************************************************************************/ + +#endif /* AMIGA_COMPILER_H */ + +/****************************************************************************/ + +#endif /* _COMPILER_H */ diff --git a/examples/macros.h b/examples/macros.h new file mode 100644 index 0000000..25a5f55 --- /dev/null +++ b/examples/macros.h @@ -0,0 +1,61 @@ +/* + * $Id: macros.h,v 1.6 2007-08-26 12:30:26 obarthel Exp $ + * + * :ts=4 + * + * Copyright © 2001-2007 by Olaf Barthel. All Rights Reserved. + */ + +#ifndef _MACROS_H +#define _MACROS_H + +/****************************************************************************/ + +#define OK (0) +#define SAME (0) +#define BUSY ((struct IORequest *)NULL) +#define CANNOT ! +#define NOT ! +#define NO ! + +/****************************************************************************/ + +#ifdef NULL +#undef NULL +#define NULL ((VOID *)0UL) +#endif /* NULL */ + +/****************************************************************************/ + +#ifndef ZERO +#define ZERO ((BPTR)NULL) +#endif /* ZERO */ + +/****************************************************************************/ + +#define UNIX_TIME_OFFSET 252460800UL + +/****************************************************************************/ + +#if !defined(_COMPILER_H) && !defined(AMIGA_COMPILER_H) +#include "compiler.h" +#endif /* !_COMPILER_H && !AMIGA_COMPILER_H */ + +/****************************************************************************/ + +#define FLAG_IS_SET(v,f) (((v) & (f)) == (f)) +#define FLAG_IS_CLEAR(v,f) (((v) & (f)) == 0 ) +#define SET_FLAG(v,f) ((VOID)((v) |= (f))) +#define CLEAR_FLAG(v,f) ((VOID)((v) &= ~((ULONG)(f)))) + +/****************************************************************************/ + +#define NUM_ENTRIES(t) (sizeof(t) / sizeof(t[0])) + +/****************************************************************************/ + +#define MILLION 1000000 + +/****************************************************************************/ + +#endif /* _MACROS_H */ diff --git a/examples/roadshow.h b/examples/roadshow.h new file mode 100644 index 0000000..19255e3 --- /dev/null +++ b/examples/roadshow.h @@ -0,0 +1,1762 @@ +#ifndef ROADSHOW_H +#define ROADSHOW_H + + +/****************************************************************************/ + + +/* This file was created automatically by CatComp. + * Do NOT edit by hand! + */ + + +#ifndef EXEC_TYPES_H +#include +#endif + +#ifdef CATCOMP_ARRAY +#undef CATCOMP_NUMBERS +#undef CATCOMP_STRINGS +#define CATCOMP_NUMBERS +#define CATCOMP_STRINGS +#endif + +#ifdef CATCOMP_BLOCK +#undef CATCOMP_STRINGS +#define CATCOMP_STRINGS +#endif + + +/****************************************************************************/ + + +#ifdef CATCOMP_NUMBERS + + +#ifdef ADDNETINTERFACE_CATALOG_STRINGS +#define MSG_ADDNETINTERFACE_NO_UTILITY_TXT 100 +#define MSG_ADDNETINTERFACE_NO_ICON_TXT 101 +#define MSG_ADDNETINTERFACE_TIMEOUT_TOO_SHORT_TXT 102 +#define MSG_ADDNETINTERFACE_CANNOT_OPEN_FILE_TXT 103 +#define MSG_ADDNETINTERFACE_CANNOT_OPEN_BSDSOCKET_TXT 104 +#define MSG_ADDNETINTERFACE_BSDSOCKET_HAS_NO_INTERFACE_API_TXT 105 +#define MSG_ADDNETINTERFACE_BSDSOCKET_HAS_NO_ROUTE_API_TXT 106 +#define MSG_ADDNETINTERFACE_UNKNOWN_KEYWORD_TXT 107 +#define MSG_ADDNETINTERFACE_PARSE_ERROR_TXT 108 +#define MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT 109 +#define MSG_ADDNETINTERFACE_UNKNOWN_PARAMETER_TXT 110 +#define MSG_ADDNETINTERFACE_UNKNOWN_LEASE_PARAMETER_TXT 111 +#define MSG_ADDNETINTERFACE_INVALID_LEASE_PARAMETER_TXT 112 +#define MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_ADD_INTERFACE_TXT 113 +#define MSG_ADDNETINTERFACE_NO_DEVICE_NAME_PROVIDED_TXT 114 +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_INTERFACE_ERROR_CODE_TXT 115 +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_INTERFACE_TXT 116 +#define MSG_ADDNETINTERFACE_INTERFACE_ADDED_TXT 117 +#define MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_TXT 118 +#define MSG_ADDNETINTERFACE_CANNOT_MARK_INTERFACE_UP_ERROR_CODE_TXT 119 +#define MSG_ADDNETINTERFACE_CANNOT_MARK_INTERFACE_UP_TXT 120 +#define MSG_ADDNETINTERFACE_TRYING_INTERFACE_CONFIGURATION_TXT 121 +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_ABORTED_TXT 122 +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_ATTEMPT_TIMED_OUT_TXT 123 +#define MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_TXT 124 +#define MSG_ADDNETINTERFACE_INTERFACE_WRONG_TYPE_TXT 125 +#define MSG_ADDNETINTERFACE_INTERFACE_ALREADY_CONFIGURED_TXT 126 +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_VERSION_CONFLICT_TXT 127 +#define MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_NO_MEMORY_TXT 128 +#define MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_ADDRESS_IN_USE_TXT 129 +#define MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_ADDRESS_CHANGE_FAILED_TXT 130 +#define MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_MASK_CHANGE_FAILED_TXT 131 +#define MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_UNKNOWN_ERROR_TXT 132 +#define MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_INVALID_ADDRESS_TXT 133 +#define MSG_ADDNETINTERFACE_COULD_NOT_CONFIGURE_INTERFACE_ERROR_CODE_TXT 134 +#define MSG_ADDNETINTERFACE_COULD_NOT_CONFIGURE_INTERFACE_TXT 135 +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_TXT 136 +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_ADDRESS_TXT 137 +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_MASK_TXT 138 +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_BROADCAST_ADDRESS_TXT 139 +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_DESTINATION_ADDRESS_TXT 140 +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_METRIC_TXT 141 +#define MSG_ADDNETINTERFACE_DEFAULT_ROUTE_TXT 142 +#define MSG_ADDNETINTERFACE_ROUTE_TXT 143 +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_ROUTE_ERROR_CODE_TXT 144 +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_ROUTE_TXT 145 +#define MSG_ADDNETINTERFACE_DNS_TXT 146 +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_DNS_ERROR_CODE_TXT 147 +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_DNS_TXT 148 +#define MSG_ADDNETINTERFACE_ADDRESS_TXT 149 +#define MSG_ADDNETINTERFACE_LEASED_PERMANENTLY_TXT 150 +#define MSG_ADDNETINTERFACE_LEASED_UNTIL_TXT 151 +#define MSG_ADDNETINTERFACE_ERROR_MESSAGE_TITLE_TXT 152 +#define MSG_ADDNETINTERFACE_ERROR_MESSAGE_BUTTON_LABEL_TXT 153 +#define MSG_ADDNETINTERFACE_UNKNOWN_STATE_PARAMETER_TXT 154 +#define MSG_ADDNETINTERFACE_INVALID_IP_ADDRESS_AT_TXT 155 +#define MSG_ADDNETINTERFACE_ID_TOO_LONG_TXT 156 +#define MSG_ADDNETINTERFACE_ID_TOO_SHORT_TXT 157 +#define MSG_ADDNETINTERFACE_HAS_NO_ADDRESS_CONVERSION_API_TXT 158 +#define MSG_ADDNETINTERFACE_INVALID_HARDWARE_ADDRESS_TXT 159 +#define MSG_ADDNETINTERFACE_MISSING_HARDWARE_ADDRESS_TXT 160 +#define MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_FOR_HARDWARE_ADDRESS_TXT 161 +#define MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_HARDWARE_ADDRESS_TXT 162 +#define MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_TOO_SHORT_TXT 163 +#define MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_TOO_LONG_TXT 164 +#define MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_IS_BROADCAST_TXT 165 +#define MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_IS_GROUP_TXT 166 +#define MSG_ADDNETINTERFACE_INTERFACE_HARDWARE_ADDRESS_SET_TO_TXT 167 +#define MSG_ADDNETINTERFACE_NO_INTERFACE_NAME_GIVEN_TXT 168 +#define MSG_ADDNETINTERFACE_INVALID_ADDRESS_TXT 169 +#define MSG_ADDNETINTERFACE_DYNAMIC_ADDRESS_SHOULD_NOT_BE_BOUND_TXT 170 +#define MSG_ADDNETINTERFACE_ALIAS_TXT 171 +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_ALIAS_ERROR_CODE_TXT 172 +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_ALIAS_TXT 173 +#define MSG_ADDNETINTERFACE_DEFAULT_DOMAIN_NAME_TXT 174 +#define MSG_ADDNETINTERFACE_INTERFACE_IS_BUSY_TXT 175 +#endif /* ADDNETINTERFACE_CATALOG_STRINGS */ + +#ifdef ADDNETROUTE_CATALOG_STRINGS +#define MSG_ADDNETROUTE_NO_UTILITY_TXT 200 +#define MSG_ADDNETROUTE_CANNOT_OPEN_BSDSOCKET_TXT 201 +#define MSG_ADDNETROUTE_BSDSOCKET_HAS_NO_ROUTE_API_TXT 202 +#define MSG_ADDNETROUTE_NO_MEMORY_FOR_DEFAULT_GATEWAY_TXT 203 +#define MSG_ADDNETROUTE_DESTINATION_IGNORED_TXT 204 +#define MSG_ADDNETROUTE_HOSTDESTINATION_IGNORED_TXT 205 +#define MSG_ADDNETROUTE_NETDESTINATION_IGNORED_TXT 206 +#define MSG_ADDNETROUTE_GATEWAY_IGNORED_TXT 207 +#define MSG_ADDNETROUTE_GATEWAY_NEEDS_DESTINATION_TXT 208 +#define MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_GATEWAY_TXT 209 +#define MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_ROUTE_TXT 210 +#define MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_ROUTE_TO_HOST_TXT 211 +#define MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_ROUTE_TO_NET_TXT 212 +#define MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_TO_ADD_ROUTE_TXT 213 +#define MSG_ADDNETROUTE_COULD_NOT_ADD_ROUTE_TXT 214 +#define MSG_ADDNETROUTE_ROUTE_ADDED_TXT 215 +#define MSG_ADDNETROUTE_DEFAULT_GATEWAY_TXT 216 +#define MSG_ADDNETROUTE_DESTINATION_TXT 217 +#define MSG_ADDNETROUTE_DESTINATION_HOST_TXT 218 +#define MSG_ADDNETROUTE_DESTINATION_NET_TXT 219 +#define MSG_ADDNETROUTE_VIA_GATEWAY_TXT 220 +#endif /* ADDNETROUTE_CATALOG_STRINGS */ + +#ifdef CONFIGURENETINTERFACE_CATALOG_STRINGS +#define MSG_CONFIGURENETINTERFACE_NO_UTILITY_TXT 300 +#define MSG_CONFIGURENETINTERFACE_CANNOT_OPEN_BSDSOCKET_TXT 301 +#define MSG_CONFIGURENETINTERFACE_BSDSOCKET_HAS_NO_INTERFACE_API_TXT 302 +#define MSG_CONFIGURENETINTERFACE_BSDSOCKET_HAS_NO_ROUTE_API_TXT 303 +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_ADDRESS_TXT 304 +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_MASK_TXT 305 +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_DESTINATION_ADDRESS_TXT 306 +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_BROADCAST_ADDRESS_TXT 307 +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_METRIC_TXT 308 +#define MSG_CONFIGURENETINTERFACE_TIMEOUT_TOO_SHORT_TXT 309 +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_ADD_ALIAS_ADDRESS_TXT 310 +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_DELETE_ALIAS_ADDRESS_TXT 311 +#define MSG_CONFIGURENETINTERFACE_UNKNOWN_CONFIGURE_PARAMETER_TXT 312 +#define MSG_CONFIGURENETINTERFACE_PICK_ONLY_ONE_STATE_TXT 313 +#define MSG_CONFIGURENETINTERFACE_UNKNOWN_LEASE_PARAMETER_TXT 314 +#define MSG_CONFIGURENETINTERFACE_INVALID_LEASE_PARAMETER_TXT 315 +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_TXT 316 +#define MSG_CONFIGURENETINTERFACE_COULD_NOT_MARK_INTERFACE_UP_TXT 317 +#define MSG_CONFIGURENETINTERFACE_TRYING_INTERFACE_CONFIGURATION_TXT 318 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ABORTED_TXT 319 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_TIMED_OUT_TXT 320 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NAME_UNKNOWN_TXT 321 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_WRONG_TYPE_TXT 322 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ALREADY_CONFIGURED_TXT 323 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NOT_COMPATIBLE_TXT 324 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NOT_ENOUGH_MEMORY_TXT 325 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ADDRESS_IN_USE_TXT 326 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ADDRESS_NOT_CHANGED_TXT 327 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_MASK_NOT_CHANGED_TXT 328 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_UNKNOWN_ERROR_TXT 329 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_NOT_CONFIGURED_ADDRESS_INVALID_TXT 330 +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_ADDRESS_TXT 331 +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_NETMASK_TXT 332 +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_STATE_TXT 333 +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_TXT 334 +#define MSG_CONFIGURENETINTERFACE_COULD_NOT_CONFIGURE_INTERFACE_TXT 335 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURED_TXT 336 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_ADDRESS_IS_TXT 337 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_MASK_TXT 338 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_DESTINATION_ADDRESS_TXT 339 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_BROADCAST_ADDRESS_TXT 340 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_METRIC_TXT 341 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_ADD_ADDRESS_TXT 342 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_DELETE_ADDRESS_TXT 343 +#define MSG_CONFIGURENETINTERFACE_ADDED_DEFAULT_ROUTE_TXT 344 +#define MSG_CONFIGURENETINTERFACE_ADDED_ROUTE_TXT 345 +#define MSG_CONFIGURENETINTERFACE_COULD_NOT_ADD_ROUTE_TO_TXT 346 +#define MSG_CONFIGURENETINTERFACE_ADDED_DNS_TXT 347 +#define MSG_CONFIGURENETINTERFACE_COULD_NOT_ADD_DNS_TXT 348 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_ADDRESS_TXT 349 +#define MSG_CONFIGURENETINTERFACE_LEASED_PERMANENTLY_TXT 350 +#define MSG_CONFIGURENETINTERFACE_LEASED_UNTIL_TXT 351 +#define MSG_CONFIGURENETINTERFACE_COULD_NOT_SET_STATE_TXT 352 +#define MSG_CONFIGURENETINTERFACE_STATE_CHANGED_TXT 353 +#define MSG_CONFIGURENETINTERFACE_INVALID_IP_ADDRESS_AT_TXT 354 +#define MSG_CONFIGURENETINTERFACE_ID_TOO_LONG_TXT 355 +#define MSG_CONFIGURENETINTERFACE_ID_TOO_SHORT_TXT 356 +#define MSG_CONFIGURENETINTERFACE_HAS_NO_ADDRESS_CONVERSION_API_TXT 357 +#define MSG_CONFIGURENETINTERFACE_COULD_NOT_RELEASE_INTERFACE_ADDRESS_TXT 358 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_ADDRESS_WAS_RELEASED_TXT 359 +#define MSG_CONFIGURENETINTERFACE_UNKNOWN_DEBUG_PARAMETER_TXT 360 +#define MSG_CONFIGURENETINTERFACE_INVALID_ADDRESS_TXT 361 +#define MSG_CONFIGURENETINTERFACE_DYNAMIC_ADDRESS_SHOULD_NOT_BE_BOUND_TXT 362 +#define MSG_CONFIGURENETINTERFACE_UNKNOWN_COMPLETE_PARAMETER_TXT 363 +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_MTU_TXT 364 +#define MSG_CONFIGURENETINTERFACE_DEFAULT_DOMAIN_NAME_TXT 365 +#define MSG_CONFIGURENETINTERFACE_INTERFACE_IS_BUSY_TXT 366 +#define MSG_CONFIGURENETINTERFACE_UNKNOWN_UNICAST_PARAMETER_TXT 367 +#endif /* CONFIGURENETINTERFACE_CATALOG_STRINGS */ + +#ifdef DELETENETROUTE_CATALOG_STRINGS +#define MSG_DELETENETROUTE_NO_UTILITY_TXT 400 +#define MSG_DELETENETROUTE_CANNOT_OPEN_BSDSOCKET_TXT 401 +#define MSG_DELETENETROUTE_BSDSOCKET_HAS_NO_ROUTE_API_TXT 402 +#define MSG_DELETENETROUTE_NEED_EITHER_DESTINATION_OR_DEFAULT_TXT 403 +#define MSG_DELETENETROUTE_DESTINATION_IGNORED_TXT 404 +#define MSG_DELETENETROUTE_ROUTE_TO_DEFAULT_GATEWAY_NOT_DELETED_TXT 405 +#define MSG_DELETENETROUTE_ROUTE_NOT_DELETED_TXT 406 +#define MSG_DELETENETROUTE_ROUTE_TO_DEFAULT_DELETED_TXT 407 +#define MSG_DELETENETROUTE_ROUTE_DELETED_TXT 408 +#endif /* DELETENETROUTE_CATALOG_STRINGS */ + +#ifdef GETNETSTATUS_CATALOG_STRINGS +#define MSG_GETNETSTATUS_NO_UTILITY_TXT 500 +#define MSG_GETNETSTATUS_CANNOT_OPEN_BSDSOCKET_TXT 501 +#define MSG_GETNETSTATUS_BSDSOCKET_HAS_NO_STATUS_API_TXT 502 +#define MSG_GETNETSTATUS_UNKNOWN_CONDITION_TXT 503 +#define MSG_GETNETSTATUS_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT 504 +#define MSG_GETNETSTATUS_NO_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT 505 +#define MSG_GETNETSTATUS_POINT_TO_POINT_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT 506 +#define MSG_GETNETSTATUS_NO_POINT_TO_POINT_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT 507 +#define MSG_GETNETSTATUS_BROADCAST_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT 508 +#define MSG_GETNETSTATUS_NO_BROADCAST_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT 509 +#define MSG_GETNETSTATUS_DNS_CONFIGURED_TXT 510 +#define MSG_GETNETSTATUS_NO_DNS_CONFIGURED_TXT 511 +#define MSG_GETNETSTATUS_ROUTE_CONFIGURED_TXT 512 +#define MSG_GETNETSTATUS_NO_ROUTE_CONFIGURED_TXT 513 +#define MSG_GETNETSTATUS_DEFAULT_ROUTE_CONFIGURED_TXT 514 +#define MSG_GETNETSTATUS_NO_DEFAULT_ROUTE_CONFIGURED_TXT 515 +#endif /* GETNETSTATUS_CATALOG_STRINGS */ + +#ifdef SHOWNETSTATUS_CATALOG_STRINGS +#define MSG_SHOWNETSTATUS_NO_UTILITY_TXT 600 +#define MSG_SHOWNETSTATUS_CANNOT_OPEN_BSDSOCKET_TXT 601 +#define MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_STATUS_API_TXT 602 +#define MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_ROUTE_API_TXT 603 +#define MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_INTERFACE_API_TXT 604 +#define MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_DNS_API_TXT 605 +#define MSG_SHOWNETSTATUS_CANNOT_GET_INFO_ON_INTERFACE_TXT 606 +#define MSG_SHOWNETSTATUS_CANNOT_GET_INTERFACE_LIST_TXT 607 +#define MSG_SHOWNETSTATUS_CANNOT_GET_DNS_LIST_TXT 608 +#define MSG_SHOWNETSTATUS_CANNOT_GET_ROUTE_TABLE_TXT 609 +#define MSG_SHOWNETSTATUS_NOT_ENOUGH_MEMORY_TO_QUERY_STATUS_TXT 610 +#define MSG_SHOWNETSTATUS_CANNOT_GET_STATUS_INFORMATION_FOR_TXT 611 +#define MSG_SHOWNETSTATUS_DEFAULT_TXT 612 +#define MSG_SHOWNETSTATUS_DESTINATION_GATEWAY_ATTRIBUTES_TITLE_TXT 613 +#define MSG_SHOWNETSTATUS_DESTINATION_TXT 614 +#define MSG_SHOWNETSTATUS_GATEWAY_TXT 615 +#define MSG_SHOWNETSTATUS_ATTRIBUTES_TXT 616 +#define MSG_SHOWNETSTATUS_DESTINATION_GATEWAY_LINE_TXT 617 +#define MSG_SHOWNETSTATUS_UP_TXT 618 +#define MSG_SHOWNETSTATUS_DOWN_TXT 619 +#define MSG_SHOWNETSTATUS_HOST_TXT 620 +#define MSG_SHOWNETSTATUS_NO_ROUTES_ARE_CONFIGURED_TXT 621 +#define MSG_SHOWNETSTATUS_ADDRESS_TYPE_TITLE_TXT 622 +#define MSG_SHOWNETSTATUS_ADDRESS_TXT 623 +#define MSG_SHOWNETSTATUS_TYPE_TXT 624 +#define MSG_SHOWNETSTATUS_ADDRESS_TYPE_LINE_TXT 625 +#define MSG_SHOWNETSTATUS_STATIC_TXT 626 +#define MSG_SHOWNETSTATUS_DYNAMIC_TXT 627 +#define MSG_SHOWNETSTATUS_NO_DNS_CONFIGURED_TXT 628 +#define MSG_SHOWNETSTATUS_UNKNOWN_HARDWARE_TYPE_TXT 629 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_TITLE_TXT 630 +#define MSG_SHOWNETSTATUS_NAME_TXT 631 +#define MSG_SHOWNETSTATUS_MTU_TXT 632 +#define MSG_SHOWNETSTATUS_RECEIVED_TXT 633 +#define MSG_SHOWNETSTATUS_SENT_TXT 634 +#define MSG_SHOWNETSTATUS_DROPPED_TXT 635 +#define MSG_SHOWNETSTATUS_OVERRUNS_TXT 636 +#define MSG_SHOWNETSTATUS_UNKNOWN_TXT 637 +#define MSG_SHOWNETSTATUS_STATUS_TXT 638 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_LINE_TXT 639 +#define MSG_SHOWNETSTATUS_NO_INTERFACES_AVAILABLE_TXT 640 +#define MSG_SHOWNETSTATUS_INTERFACE_TITLE_TXT 641 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_DEVICE_NAME_TXT 642 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_DEVICE_UNIT_TXT 643 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_HARDWARE_ADDRESS_TXT 644 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_MTU_TXT 645 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_TRANSMISSION_SPEED_TXT 646 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_HARDWARE_TYPE_TXT 647 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_PACKETS_SENT_TXT 648 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_PACKETS_RECEIVED_TXT 649 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_PACKETS_DROPPED_TXT 650 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_BUFFER_OVERRUNS_TXT 651 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_UNKNOWN_PACKETS_TXT 652 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_ADDRESS_TXT 653 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_NETWORK_MASK_TXT 654 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_PEER_ADDRESS_TXT 655 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_STATUS_TXT 656 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_ADDRESS_BINDING_TXT 657 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_LEASE_EXPIRES_TXT 658 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_BINDING_STATIC_TXT 659 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_BINDING_DYNAMIC_TXT 660 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_LEASE_NEVER_EXPIRES_TXT 661 +#define MSG_SHOWNETSTATUS_ICMP_TITLE_TXT 662 +#define MSG_SHOWNETSTATUS_ICMP_ERRORS_GENERATED_TXT 663 +#define MSG_SHOWNETSTATUS_ICMP_IP_PACKETS_TOO_SHORT_TXT 664 +#define MSG_SHOWNETSTATUS_ICMP_PACKETS_NOT_RESPONDED_TO_TXT 665 +#define MSG_SHOWNETSTATUS_ICMP_ECHO_REPLY_PACKETS_SENT_TXT 666 +#define MSG_SHOWNETSTATUS_ICMP_DESTINATION_UNREACHABLE_TXT 667 +#define MSG_SHOWNETSTATUS_ICMP_SOURCE_QUENCH_TXT 668 +#define MSG_SHOWNETSTATUS_ICMP_REDIRECT_TXT 669 +#define MSG_SHOWNETSTATUS_ICMP_ECHO_TXT 670 +#define MSG_SHOWNETSTATUS_ICMP_ROUTER_ADVERTIZEMENT_TXT 671 +#define MSG_SHOWNETSTATUS_ICMP_ROUTER_SOLICITATION_TXT 672 +#define MSG_SHOWNETSTATUS_ICMP_TIME_EXCEEDED_TXT 673 +#define MSG_SHOWNETSTATUS_ICMP_BAD_IP_HEADER_TXT 674 +#define MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REQUEST_TXT 675 +#define MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REPLY_TXT 676 +#define MSG_SHOWNETSTATUS_ICMP_INFORMATION_REQUEST_TXT 677 +#define MSG_SHOWNETSTATUS_ICMP_INFORMATION_REPLY_TXT 678 +#define MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REQUEST_TXT 679 +#define MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REPLY_TXT 680 +#define MSG_SHOWNETSTATUS_ICMP_RECEIVED_CODES_OUT_OF_RANGE_TXT 681 +#define MSG_SHOWNETSTATUS_ICMP_RECEIVED_PACKETS_TOO_SHORT_TXT 682 +#define MSG_SHOWNETSTATUS_ICMP_RECEIVED_PACKET_CHECKSUM_ERRORS_TXT 683 +#define MSG_SHOWNETSTATUS_ICMP_RECEIVED_CODES_BOUND_MISMATCH_TXT 684 +#define MSG_SHOWNETSTATUS_ICMP_RESPONSES_SENT_TXT 685 +#define MSG_SHOWNETSTATUS_ICMP_ECHO_REPLIES_RECEIVED_TXT 686 +#define MSG_SHOWNETSTATUS_ICMP_DESTINATION_UNREACHABLE_RECEIVED_TXT 687 +#define MSG_SHOWNETSTATUS_ICMP_SOURCE_QUENCH_RECEIVED_TXT 688 +#define MSG_SHOWNETSTATUS_ICMP_REDIRECT_RECEIVED_TXT 689 +#define MSG_SHOWNETSTATUS_ICMP_ECHO_RECEIVED_TXT 690 +#define MSG_SHOWNETSTATUS_ICMP_ROUTER_ADVERTIZEMENT_RECEIVED_TXT 691 +#define MSG_SHOWNETSTATUS_ICMP_ROUTER_SOLICITATION_RECEIVED_TXT 692 +#define MSG_SHOWNETSTATUS_ICMP_TIME_EXCEEDED_RECEIVED_TXT 693 +#define MSG_SHOWNETSTATUS_ICMP_BAD_IP_HEADER_RECEIVED_TXT 694 +#define MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REQUEST_RECEIVED_TXT 695 +#define MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REPLY_RECEIVED_TXT 696 +#define MSG_SHOWNETSTATUS_ICMP_INFORMATION_REQUEST_RECEIVED_TXT 697 +#define MSG_SHOWNETSTATUS_ICMP_INFORMATION_REPLY_RECEIVED_TXT 698 +#define MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REQUEST_RECEIVED_TXT 699 +#define MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REPLY_RECEIVED_TXT 700 +#define MSG_SHOWNETSTATUS_IGMP_TITLE_TXT 701 +#define MSG_SHOWNETSTATUS_IGMP_TOTAL_MESSAGES_RECEIVED_TXT 702 +#define MSG_SHOWNETSTATUS_IGMP_MESSAGES_RECEIVED_TOO_SHORT_TXT 703 +#define MSG_SHOWNETSTATUS_IGMP_MESSAGES_RECEIVED_BAD_CHECKSUM_TXT 704 +#define MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_QUERIES_RECEIVED_TXT 705 +#define MSG_SHOWNETSTATUS_IGMP_INVALID_QUERIES_RECEIVED_TXT 706 +#define MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_REPORTS_RECEIVED_TXT 707 +#define MSG_SHOWNETSTATUS_IGMP_INVALID_REPORTS_RECEIVED_TXT 708 +#define MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_REPORTS_RECEIVED_FOR_THIS_GROUP_TXT 709 +#define MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_REPORTS_SENT_TXT 710 +#define MSG_SHOWNETSTATUS_IP_TITLE_TXT 711 +#define MSG_SHOWNETSTATUS_IP_TOTAL_PACKETS_RECEIVED_TXT 712 +#define MSG_SHOWNETSTATUS_IP_PACKETS_WITH_CHECKSUM_ERRORS_TXT 713 +#define MSG_SHOWNETSTATUS_IP_PACKETS_TOO_SHORT_TXT 714 +#define MSG_SHOWNETSTATUS_IP_PACKETS_TOO_SMALL_TXT 715 +#define MSG_SHOWNETSTATUS_IP_PACKETS_WITH_BAD_DATA_SIZE_TXT 716 +#define MSG_SHOWNETSTATUS_IP_PACKETS_WITH_BAD_HEADER_SIZE_TXT 717 +#define MSG_SHOWNETSTATUS_IP_FRAGMENTS_RECEIVED_TXT 718 +#define MSG_SHOWNETSTATUS_IP_FRAGMENTS_DROPPED_TXT 719 +#define MSG_SHOWNETSTATUS_IP_FRAGMENTS_TIMED_OUT_TXT 720 +#define MSG_SHOWNETSTATUS_IP_PACKETS_FORWARDED_TXT 721 +#define MSG_SHOWNETSTATUS_IP_PACKETS_CANNOT_FORWARD_TXT 722 +#define MSG_SHOWNETSTATUS_IP_PACKETS_FORWARDED_ON_SAME_NETWORK_TXT 723 +#define MSG_SHOWNETSTATUS_IP_PACKETS_WITH_UNKNOWN_PROTOCOLS_TXT 724 +#define MSG_SHOWNETSTATUS_IP_DATAGRAMS_DELIVERED_TXT 725 +#define MSG_SHOWNETSTATUS_IP_PACKETS_GENERATED_TXT 726 +#define MSG_SHOWNETSTATUS_IP_PACKETS_LOST_TXT 727 +#define MSG_SHOWNETSTATUS_IP_PACKETS_REASSEMBLED_TXT 728 +#define MSG_SHOWNETSTATUS_IP_PACKETS_FRAGMENTED_TXT 729 +#define MSG_SHOWNETSTATUS_IP_OUTPUT_FRAGMENTS_CREATED_TXT 730 +#define MSG_SHOWNETSTATUS_IP_PACKETS_CANNOT_FRAGMENT_TXT 731 +#define MSG_SHOWNETSTATUS_IP_ERRORS_IN_OPTION_PROCESSING_TXT 732 +#define MSG_SHOWNETSTATUS_IP_PACKETS_NO_ROUTE_TXT 733 +#define MSG_SHOWNETSTATUS_IP_PACKETS_WITH_BAD_IP_VERSION_TXT 734 +#define MSG_SHOWNETSTATUS_IP_RAW_PACKETS_SENT_TXT 735 +#define MSG_SHOWNETSTATUS_MBUF_TITLE_TXT 736 +#define MSG_SHOWNETSTATUS_MBUF_BUFFERS_FROM_PAGE_POOL_TXT 737 +#define MSG_SHOWNETSTATUS_MBUF_CLUSTERS_FROM_PAGE_POOL_TXT 738 +#define MSG_SHOWNETSTATUS_MBUF_FREE_CLUSTERS_TXT 739 +#define MSG_SHOWNETSTATUS_MBUF_DROPS_TXT 740 +#define MSG_SHOWNETSTATUS_MBUF_WAIT_TXT 741 +#define MSG_SHOWNETSTATUS_MBUF_DRAIN_TXT 742 +#define MSG_SHOWNETSTATUS_MULTICAST_TITLE_TXT 743 +#define MSG_SHOWNETSTATUS_MULTICAST_ROUTE_LOOKUPS_TXT 744 +#define MSG_SHOWNETSTATUS_MULTICAST_ROUTE_CACHE_MISSES_TXT 745 +#define MSG_SHOWNETSTATUS_MULTICAST_GROUP_ADDRESS_LOOKUPS_TXT 746 +#define MSG_SHOWNETSTATUS_MULTICAST_GROUP_ADDRESS_CACHE_MISSES_TXT 747 +#define MSG_SHOWNETSTATUS_MULTICAST_NO_ROUTE_TXT 748 +#define MSG_SHOWNETSTATUS_MULTICAST_BAD_TUNNEL_TXT 749 +#define MSG_SHOWNETSTATUS_MULTICAST_CANNOT_TUNNEL_TXT 750 +#define MSG_SHOWNETSTATUS_MULTICAST_CANNOT_WRONG_INTERFACE_TXT 751 +#define MSG_SHOWNETSTATUS_ROUTING_TITLE_TXT 752 +#define MSG_SHOWNETSTATUS_ROUTING_BAD_REDIRECT_TXT 753 +#define MSG_SHOWNETSTATUS_ROUTING_DYNAMIC_TXT 754 +#define MSG_SHOWNETSTATUS_ROUTING_NEW_GATEWAY_TXT 755 +#define MSG_SHOWNETSTATUS_ROUTING_UNREACH_TXT 756 +#define MSG_SHOWNETSTATUS_ROUTING_WILDCARD_TXT 757 +#define MSG_SHOWNETSTATUS_TCP_TITLE_TXT 758 +#define MSG_SHOWNETSTATUS_TCP_CONNATTEMPT_TXT 759 +#define MSG_SHOWNETSTATUS_TCP_ACCEPTS_TXT 760 +#define MSG_SHOWNETSTATUS_TCP_CONNECTS_TXT 761 +#define MSG_SHOWNETSTATUS_TCP_DROPS_TXT 762 +#define MSG_SHOWNETSTATUS_TCP_CONNDROPS_TXT 763 +#define MSG_SHOWNETSTATUS_TCP_CLOSED_TXT 764 +#define MSG_SHOWNETSTATUS_TCP_SEGSTIMED_TXT 765 +#define MSG_SHOWNETSTATUS_TCP_RTTUPDATED_TXT 766 +#define MSG_SHOWNETSTATUS_TCP_DELACK_TXT 767 +#define MSG_SHOWNETSTATUS_TCP_TIMEOUTDROP_TXT 768 +#define MSG_SHOWNETSTATUS_TCP_PERSISTTIMEO_TXT 769 +#define MSG_SHOWNETSTATUS_TCP_KEEPTIMEO_TXT 770 +#define MSG_SHOWNETSTATUS_TCP_KEEPPROBE_TXT 771 +#define MSG_SHOWNETSTATUS_TCP_KEEPDROPS_TXT 772 +#define MSG_SHOWNETSTATUS_TCP_SNDTOTAL_TXT 773 +#define MSG_SHOWNETSTATUS_TCP_SNDPACK_TXT 774 +#define MSG_SHOWNETSTATUS_TCP_SNDBYTE_TXT 775 +#define MSG_SHOWNETSTATUS_TCP_SNDREXMITPACK_TXT 776 +#define MSG_SHOWNETSTATUS_TCP_SNDREXMITBYTE_TXT 777 +#define MSG_SHOWNETSTATUS_TCP_SNDACKS_TXT 778 +#define MSG_SHOWNETSTATUS_TCP_SNDPROBE_TXT 779 +#define MSG_SHOWNETSTATUS_TCP_SNDURG_TXT 780 +#define MSG_SHOWNETSTATUS_TCP_SNDWINUP_TXT 781 +#define MSG_SHOWNETSTATUS_TCP_SNDCTRL_TXT 782 +#define MSG_SHOWNETSTATUS_TCP_RCVTOTAL_TXT 783 +#define MSG_SHOWNETSTATUS_TCP_RCVPACK_TXT 784 +#define MSG_SHOWNETSTATUS_TCP_RCVBYTE_TXT 785 +#define MSG_SHOWNETSTATUS_TCP_RCVBADSUM_TXT 786 +#define MSG_SHOWNETSTATUS_TCP_RCVBADOFF_TXT 787 +#define MSG_SHOWNETSTATUS_TCP_RCVSHORT_TXT 788 +#define MSG_SHOWNETSTATUS_TCP_RCVDUPPACK_TXT 789 +#define MSG_SHOWNETSTATUS_TCP_RCVDUPBYTE_TXT 790 +#define MSG_SHOWNETSTATUS_TCP_RCVOOPACK_TXT 791 +#define MSG_SHOWNETSTATUS_TCP_RCVOOBYTE_TXT 792 +#define MSG_SHOWNETSTATUS_TCP_RCVPACKAFTERWIN_TXT 793 +#define MSG_SHOWNETSTATUS_TCP_RCVBYTEAFTERWIN_TXT 794 +#define MSG_SHOWNETSTATUS_TCP_RCVAFTERCLOSE_TXT 795 +#define MSG_SHOWNETSTATUS_TCP_RCVWINPROBE_TXT 796 +#define MSG_SHOWNETSTATUS_TCP_RCVDUPACK_TXT 797 +#define MSG_SHOWNETSTATUS_TCP_RCVACKTOOMUCH_TXT 798 +#define MSG_SHOWNETSTATUS_TCP_RCVACKPACK_TXT 799 +#define MSG_SHOWNETSTATUS_TCP_RCVACKBYTE_TXT 800 +#define MSG_SHOWNETSTATUS_TCP_RCVWINUPD_TXT 801 +#define MSG_SHOWNETSTATUS_TCP_PAWSDROP_TXT 802 +#define MSG_SHOWNETSTATUS_TCP_PREDACK_TXT 803 +#define MSG_SHOWNETSTATUS_TCP_PREDDAT_TXT 804 +#define MSG_SHOWNETSTATUS_TCP_PERSISTDROP_TXT 805 +#define MSG_SHOWNETSTATUS_TCP_BADSYN_TXT 806 +#define MSG_SHOWNETSTATUS_UDP_TITLE_TXT 807 +#define MSG_SHOWNETSTATUS_UDP_IPACKETS_TXT 808 +#define MSG_SHOWNETSTATUS_UDP_HDROPS_TXT 809 +#define MSG_SHOWNETSTATUS_UDP_BADSUM_TXT 810 +#define MSG_SHOWNETSTATUS_UDP_BADLEN_TXT 811 +#define MSG_SHOWNETSTATUS_UDP_NOPORT_TXT 812 +#define MSG_SHOWNETSTATUS_UDP_NOPORTBCAST_TXT 813 +#define MSG_SHOWNETSTATUS_UDP_FULLSOCK_TXT 814 +#define MSG_SHOWNETSTATUS_UDP_OPACKETS_TXT 815 +#define MSG_SHOWNETSTATUS_TCP_SOCKET_TITLE_TXT 816 +#define MSG_SHOWNETSTATUS_LOCAL_TXT 817 +#define MSG_SHOWNETSTATUS_REMOTE_TXT 818 +#define MSG_SHOWNETSTATUS_RECEIVE_LEN_TXT 819 +#define MSG_SHOWNETSTATUS_SEND_LEN_TXT 820 +#define MSG_SHOWNETSTATUS_TCP_SOCKET_LINE_TXT 821 +#define MSG_SHOWNETSTATUS_NO_TCP_SOCKETS_IN_USE_TXT 822 +#define MSG_SHOWNETSTATUS_UDP_SOCKET_TITLE_TXT 823 +#define MSG_SHOWNETSTATUS_UDP_SOCKET_LINE_TXT 824 +#define MSG_SHOWNETSTATUS_NO_UDP_SOCKETS_IN_USE_TXT 825 +#define MSG_SHOWNETSTATUS_STATUS_NAME1_TXT 826 +#define MSG_SHOWNETSTATUS_STATUS_NAME2_TXT 827 +#define MSG_SHOWNETSTATUS_STATUS_NAME3_TXT 828 +#define MSG_SHOWNETSTATUS_STATUS_NAME4_TXT 829 +#define MSG_SHOWNETSTATUS_STATUS_NAME5_TXT 830 +#define MSG_SHOWNETSTATUS_STATUS_NAME6_TXT 831 +#define MSG_SHOWNETSTATUS_STATUS_NAME7_TXT 832 +#define MSG_SHOWNETSTATUS_STATUS_NAME8_TXT 833 +#define MSG_SHOWNETSTATUS_STATUS_NAME9_TXT 834 +#define MSG_SHOWNETSTATUS_STATUS_NAME10_TXT 835 +#define MSG_SHOWNETSTATUS_NOT_CONFIGURED_TXT 836 +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE1_TXT 837 +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE2_TXT 838 +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE3_TXT 839 +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE4_TXT 840 +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE5_TXT 841 +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE6_TXT 842 +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE7_TXT 843 +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE8_TXT 844 +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE9_TXT 845 +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE10_TXT 846 +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE11_TXT 847 +#define MSG_SHOWNETSTATUS_WILDCARD_TXT 848 +#define MSG_SHOWNETSTATUS_SOME_TCP_SOCKETS_IN_USE_TXT 849 +#define MSG_SHOWNETSTATUS_SOME_UDP_SOCKETS_IN_USE_TXT 850 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_READ_REQUESTS_TXT 851 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_WRITE_REQUESTS_TXT 852 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_BYTES_RECEIVED_TXT 853 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_BYTES_SENT_TXT 854 +#define MSG_SHOWNETSTATUS_UNKNOWN_HOST_TXT 855 +#define MSG_SHOWNETSTATUS_IP_ADDRESS_TXT 856 +#define MSG_SHOWNETSTATUS_HARDWARE_ADDRESS_TXT 857 +#define MSG_SHOWNETSTATUS_INCOMPLETE_HARDWARE_ADDRESS_TXT 858 +#define MSG_SHOWNETSTATUS_ARP_ENTRY_PERMANENT_TXT 859 +#define MSG_SHOWNETSTATUS_ARP_ENTRY_PUBLISHED_PROXY_TXT 860 +#define MSG_SHOWNETSTATUS_ARP_ENTRY_PUBLISHED_TXT 861 +#define MSG_SHOWNETSTATUS_ARP_CACHE_EMPTY_TXT 862 +#define MSG_SHOWNETSTATUS_ARP_HEADER_TXT 863 +#define MSG_SHOWNETSTATUS_NO_ARP_INFORMATION_TXT 864 +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_TRANSFER_STATISTICS_TXT 865 +#define MSG_SHOWNETSTATUS_STATUS_SUMMARY_TXT 866 +#define MSG_SHOWNETSTATUS_LOCAL_HOST_ADDRESS_TXT 867 +#define MSG_SHOWNETSTATUS_LOCAL_HOST_ADDRESS_ON_INTERFACE_TXT 868 +#define MSG_SHOWNETSTATUS_DEFAULT_GATEWAY_ADDRESS_TXT 869 +#define MSG_SHOWNETSTATUS_DOMAIN_NAME_SYSTEM_SERVERS_TXT 870 +#define MSG_SHOWNETSTATUS_DEFAULT_DOMAIN_NAME_TXT 871 +#define MSG_SHOWNETSTATUS_DEFAULT_DOMAIN_NAME_UNSET_TXT 872 +#endif /* SHOWNETSTATUS_CATALOG_STRINGS */ + +#ifdef LOGVIEWER_CATALOG_STRINGS +#define MSG_LOGVIEWER_PROJECT_MENU 900 +#define MSG_LOGVIEWER_PROJECT_CLEAR_MENU 901 +#define MSG_LOGVIEWER_PROJECT_SAVE_AS_MENU 902 +#define MSG_LOGVIEWER_PROJECT_HIDE_MENU 903 +#define MSG_LOGVIEWER_PROJECT_QUIT_MENU 904 +#define MSG_LOGVIEWER_LOG_LEVEL_0_TXT 905 +#define MSG_LOGVIEWER_LOG_LEVEL_1_TXT 906 +#define MSG_LOGVIEWER_LOG_LEVEL_2_TXT 907 +#define MSG_LOGVIEWER_LOG_LEVEL_3_TXT 908 +#define MSG_LOGVIEWER_LOG_LEVEL_4_TXT 909 +#define MSG_LOGVIEWER_LOG_LEVEL_5_TXT 910 +#define MSG_LOGVIEWER_LOG_LEVEL_6_TXT 911 +#define MSG_LOGVIEWER_LOG_LEVEL_7_TXT 912 +#define MSG_LOGVIEWER_LABEL_0_TXT 913 +#define MSG_LOGVIEWER_LABEL_1_TXT 914 +#define MSG_LOGVIEWER_LABEL_2_TXT 915 +#define MSG_LOGVIEWER_LABEL_3_TXT 916 +#define MSG_LOGVIEWER_OK_TXT 917 +#define MSG_LOGVIEWER_REALLY_CLEAR_MESSAGE_LIST_TXT 918 +#define MSG_LOGVIEWER_YES_NO_TXT 919 +#define MSG_LOGVIEWER_OVERWRITE_APPEND_NEWNAME_CANCEL_TXT 920 +#define MSG_LOGVIEWER_FILE_REQUESTER_TITLE_TXT 921 +#define MSG_LOGVIEWER_FILE_REQUESTER_SAVE_TXT 922 +#define MSG_LOGVIEWER_COMMODITIES_TITLE_TXT 923 +#define MSG_LOGVIEWER_COMMODITIES_DESCRIPTION_TXT 924 +#define MSG_LOGVIEWER_ORIGIN_UNKNOWN_TXT 925 +#define MSG_LOGVIEWER_FILE_ALREADY_EXISTS_TXT 926 +#define MSG_LOGVIEWER_FILE_COULD_NOT_BE_OPENED_TXT 927 +#define MSG_LOGVIEWER_ERROR_WRITING_TO_FILE_TXT 928 +#define MSG_LOGVIEWER_NO_DEFAULT_PUB_SCREEN_TXT 929 +#define MSG_LOGVIEWER_NO_PUBLIC_SCREEN_FONT_TXT 930 +#define MSG_LOGVIEWER_NO_VISUAL_INFO_TXT 931 +#define MSG_LOGVIEWER_NO_MENU_TXT 932 +#define MSG_LOGVIEWER_NO_MENU_LAYOUT_TXT 933 +#define MSG_LOGVIEWER_NO_SCREEN_DRAW_INFO_TXT 934 +#define MSG_LOGVIEWER_NO_SIZING_IMAGE_TXT 935 +#define MSG_LOGVIEWER_NO_VERTICAL_SCROLLER_TXT 936 +#define MSG_LOGVIEWER_NO_HORIZONTAL_SCROLLER_TXT 937 +#define MSG_LOGVIEWER_NO_WINDOW_TXT 938 +#define MSG_LOGVIEWER_NO_USER_CLIP_REGION_TXT 939 +#define MSG_LOGVIEWER_NO_LIBRARY_VERSION_TXT 940 +#define MSG_LOGVIEWER_NO_LIBRARY_TXT 941 +#define MSG_LOGVIEWER_NO_MEMORY_POOL_TXT 942 +#define MSG_LOGVIEWER_NO_SCROLLER_CLASS_TXT 943 +#define MSG_LOGVIEWER_NO_FILE_REQUESTER_TXT 944 +#define MSG_LOGVIEWER_NO_COMMODITIES_PORT_TXT 945 +#define MSG_LOGVIEWER_NO_COMMODITIES_BROKER_TXT 946 +#define MSG_LOGVIEWER_NO_COMMODITIES_HOTKEY_TXT 947 +#define MSG_LOGVIEWER_NO_COMMODITIES_SYSTEM_TXT 948 +#define MSG_LOGVIEWER_NO_HOOK_PORT_TXT 949 +#define MSG_LOGVIEWER_NO_LOG_HOOK_TXT 950 +#endif /* LOGVIEWER_CATALOG_STRINGS */ + +#ifdef NETSHUTDOWN_CATALOG_STRINGS +#define MSG_NETSHUTDOWN_NO_UTILITY_TXT 1000 +#define MSG_NETSHUTDOWN_NO_MEMORY_TXT 1001 +#define MSG_NETSHUTDOWN_NO_MSGPORT_TXT 1002 +#define MSG_NETSHUTDOWN_NO_TIMER_REQUEST_TXT 1003 +#define MSG_NETSHUTDOWN_NO_TIMER_DEVICE_TXT 1004 +#define MSG_NETSHUTDOWN_TRYING_TO_SHUT_DOWN_TXT 1005 +#define MSG_NETSHUTDOWN_SHUTDOWN_FAILED_TXT 1006 +#define MSG_NETSHUTDOWN_SHUTDOWN_DONE_TXT 1007 +#define MSG_NETSHUTDOWN_SHUTDOWN_ABORTED_TXT 1008 +#define MSG_NETSHUTDOWN_SHUTDOWN_TIMEOUT_TXT 1009 +#define MSG_NETSHUTDOWN_NETWORK_NOT_IN_USE_TXT 1010 +#endif /* NETSHUTDOWN_CATALOG_STRINGS */ + +#ifdef ROADSHOWCONTROL_CATALOG_STRINGS +#define MSG_ROADSHOWCONTROL_NO_UTILITY_TXT 1100 +#define MSG_ROADSHOWCONTROL_CANNOT_OPEN_BSDSOCKET_TXT 1101 +#define MSG_ROADSHOWCONTROL_BSDSOCKET_HAS_NO_ROADSHOWDATA_API_TXT 1102 +#define MSG_ROADSHOWCONTROL_NO_ROADSHOW_DATA_TXT 1103 +#define MSG_ROADSHOWCONTROL_COULD_NOT_SET_OPTION_TXT 1104 +#define MSG_ROADSHOWCONTROL_COULD_NOT_SET_ENV_VARIABLE_TXT 1105 +#endif /* ROADSHOWCONTROL_CATALOG_STRINGS */ + +#ifdef REMOVENETINTERFACE_CATALOG_STRINGS +#define MSG_REMOVENETINTERFACE_CANNOT_OPEN_BSDSOCKET_TXT 1200 +#define MSG_REMOVENETINTERFACE_INTERFACE_REMOVED_TXT 1201 +#define MSG_REMOVENETINTERFACE_COULD_NOT_REMOVE_INTERFACE_TXT 1202 +#endif /* REMOVENETINTERFACE_CATALOG_STRINGS */ + +#endif /* CATCOMP_NUMBERS */ + + +/****************************************************************************/ + + +#ifdef CATCOMP_STRINGS + + +#ifdef ADDNETINTERFACE_CATALOG_STRINGS +#define MSG_ADDNETINTERFACE_NO_UTILITY_TXT_STR "Failed to open \"utility.library\" V37." +#define MSG_ADDNETINTERFACE_NO_ICON_TXT_STR "Failed to open \"icon.library\" V37." +#define MSG_ADDNETINTERFACE_TIMEOUT_TOO_SHORT_TXT_STR "Configuration timeout %ld is too short; increased to %ld seconds." +#define MSG_ADDNETINTERFACE_CANNOT_OPEN_FILE_TXT_STR "Failed to open file \"%s\" (%s)." +#define MSG_ADDNETINTERFACE_CANNOT_OPEN_BSDSOCKET_TXT_STR "Failed to open \"bsdsocket.library\" V4." +#define MSG_ADDNETINTERFACE_BSDSOCKET_HAS_NO_INTERFACE_API_TXT_STR "\"%s\" V%ld.%ld does not support the interface configuration method used by this program." +#define MSG_ADDNETINTERFACE_BSDSOCKET_HAS_NO_ROUTE_API_TXT_STR "\"%s\" V%ld.%ld does not support the route configuration method used by this program." +#define MSG_ADDNETINTERFACE_UNKNOWN_KEYWORD_TXT_STR "Unknown keyword \"%s\" in line %ld of \"%s\"." +#define MSG_ADDNETINTERFACE_PARSE_ERROR_TXT_STR "Parse error in line %ld of \"%s\" (%s)." +#define MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT_STR "Not enough memory to parse line %ld of \"%s\"." +#define MSG_ADDNETINTERFACE_UNKNOWN_PARAMETER_TXT_STR "Unknown parameter \"%s\" in line %ld of \"%s\"." +#define MSG_ADDNETINTERFACE_UNKNOWN_LEASE_PARAMETER_TXT_STR "Unknown lease parameter \"%s\" in line %ld of \"%s\"." +#define MSG_ADDNETINTERFACE_INVALID_LEASE_PARAMETER_TXT_STR "Invalid lease parameter \"%s\" in line %ld of \"%s\"." +#define MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_ADD_INTERFACE_TXT_STR "Not enough memory to add interface from file \"%s\"." +#define MSG_ADDNETINTERFACE_NO_DEVICE_NAME_PROVIDED_TXT_STR "No device name provided in file \"%s\"." +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_INTERFACE_ERROR_CODE_TXT_STR "Could not add interface \"%s\" (%s)." +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_INTERFACE_TXT_STR "Could not add interface \"%s\"." +#define MSG_ADDNETINTERFACE_INTERFACE_ADDED_TXT_STR "Interface \"%s\" added.\n" +#define MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_TXT_STR "Not enough memory to configure interface \"%s\"." +#define MSG_ADDNETINTERFACE_CANNOT_MARK_INTERFACE_UP_ERROR_CODE_TXT_STR "Could not mark interface \"%s\" as \"up\" (%s)." +#define MSG_ADDNETINTERFACE_CANNOT_MARK_INTERFACE_UP_TXT_STR "Could not mark interface \"%s\" as \"up\"." +#define MSG_ADDNETINTERFACE_TRYING_INTERFACE_CONFIGURATION_TXT_STR "Trying interface \"%s\" configuration... \0" +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_ABORTED_TXT_STR "Interface \"%s\" configuration aborted." +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_ATTEMPT_TIMED_OUT_TXT_STR "Interface \"%s\" configuration attempt timed out." +#define MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_TXT_STR "Interface \"%s\" not configured; name is unknown." +#define MSG_ADDNETINTERFACE_INTERFACE_WRONG_TYPE_TXT_STR "Interface \"%s\" not configured; broadcast access not supported." +#define MSG_ADDNETINTERFACE_INTERFACE_ALREADY_CONFIGURED_TXT_STR "Interface \"%s\" not configured; address is already configured." +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_VERSION_CONFLICT_TXT_STR "Interface \"%s\" not configured; configuration command not compatible." +#define MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_NO_MEMORY_TXT_STR "Interface \"%s\" not configured; not enough memory." +#define MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_ADDRESS_IN_USE_TXT_STR "Interface \"%s\" not configured; IP address to be assigned is already in use." +#define MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_ADDRESS_CHANGE_FAILED_TXT_STR "Interface \"%s\" not configured; IP address could not be changed." +#define MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_MASK_CHANGE_FAILED_TXT_STR "Interface \"%s\" not configured; network mask could not be changed." +#define MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_UNKNOWN_ERROR_TXT_STR "Interface \"%s\" not configured; unknown error (%ld)." +#define MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_INVALID_ADDRESS_TXT_STR "Interface \"%s\" not configured; no valid IP address received." +#define MSG_ADDNETINTERFACE_COULD_NOT_CONFIGURE_INTERFACE_ERROR_CODE_TXT_STR "Could not configure interface \"%s\" (%s)." +#define MSG_ADDNETINTERFACE_COULD_NOT_CONFIGURE_INTERFACE_TXT_STR "Could not configure interface \"%s\"." +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_TXT_STR "Interface \"%s\" configured" +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_ADDRESS_TXT_STR ", address = %s" +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_MASK_TXT_STR ", network mask = %s" +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_BROADCAST_ADDRESS_TXT_STR ", broadcast address = %s" +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_DESTINATION_ADDRESS_TXT_STR ", destination address = %s" +#define MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_METRIC_TXT_STR ", metric = %ld" +#define MSG_ADDNETINTERFACE_DEFAULT_ROUTE_TXT_STR "Added default route to %s.\n" +#define MSG_ADDNETINTERFACE_ROUTE_TXT_STR "Added route to %s.\n" +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_ROUTE_ERROR_CODE_TXT_STR "Could not add route to %s (%s)." +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_ROUTE_TXT_STR "Could not add route to %s." +#define MSG_ADDNETINTERFACE_DNS_TXT_STR "Added domain name server %s.\n" +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_DNS_ERROR_CODE_TXT_STR "Could not add domain name server %s (%s)." +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_DNS_TXT_STR "Could not add domain name server %s." +#define MSG_ADDNETINTERFACE_ADDRESS_TXT_STR "Interface \"%s\" address %s \0" +#define MSG_ADDNETINTERFACE_LEASED_PERMANENTLY_TXT_STR "has been leased permanently.\n" +#define MSG_ADDNETINTERFACE_LEASED_UNTIL_TXT_STR "has been leased until %s %s and will be renewed before it expires.\n" +#define MSG_ADDNETINTERFACE_ERROR_MESSAGE_TITLE_TXT_STR "AddNetInterface Error" +#define MSG_ADDNETINTERFACE_ERROR_MESSAGE_BUTTON_LABEL_TXT_STR "Understood" +#define MSG_ADDNETINTERFACE_UNKNOWN_STATE_PARAMETER_TXT_STR "Unknown state parameter \"%s\" in line %ld of \"%s\"." +#define MSG_ADDNETINTERFACE_INVALID_IP_ADDRESS_AT_TXT_STR "Invalid IP address in \"%s=%s\", line %ld of \"%s\"." +#define MSG_ADDNETINTERFACE_ID_TOO_LONG_TXT_STR "Client identifier \"%s\" in line %ld of \"%s\" will be truncated." +#define MSG_ADDNETINTERFACE_ID_TOO_SHORT_TXT_STR "Client identifier \"%s\" in line %ld of \"%s\" is too short (2 characters minimum)." +#define MSG_ADDNETINTERFACE_HAS_NO_ADDRESS_CONVERSION_API_TXT_STR "%s: \"%s\" V%ld.%ld does not support the address conversion method used by this program.\n" +#define MSG_ADDNETINTERFACE_INVALID_HARDWARE_ADDRESS_TXT_STR "Invalid hardware address \"%s\" in line %ld of \"%s\"." +#define MSG_ADDNETINTERFACE_MISSING_HARDWARE_ADDRESS_TXT_STR "No hardware address specified in line %ld of \"%s\"." +#define MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_FOR_HARDWARE_ADDRESS_TXT_STR "Not enough memory for hardware address \"%s\"." +#define MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_HARDWARE_ADDRESS_TXT_STR "Not enough memory to configure hardware address of \"%s\"." +#define MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_TOO_SHORT_TXT_STR "The address \"%s\" in line %ld of \"%s\" is too short to be a valid IEEE 802.3 MAC address." +#define MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_TOO_LONG_TXT_STR "The address \"%s\" in line %ld of \"%s\" is too long to be a valid IEEE 802.3 MAC address." +#define MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_IS_BROADCAST_TXT_STR "The address \"%s\" in line %ld of \"%s\" is a broadcast address and should not be used by a single host." +#define MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_IS_GROUP_TXT_STR "The address \"%s\" in line %ld of \"%s\" is a group address and should not be used by a single host." +#define MSG_ADDNETINTERFACE_INTERFACE_HARDWARE_ADDRESS_SET_TO_TXT_STR "The hardware address of \"%s\" was set to %s.\n" +#define MSG_ADDNETINTERFACE_NO_INTERFACE_NAME_GIVEN_TXT_STR "You did not provide the names of the interfaces to be added." +#define MSG_ADDNETINTERFACE_INVALID_ADDRESS_TXT_STR "Invalid address \"%s\" in line %ld of \"%s\"." +#define MSG_ADDNETINTERFACE_DYNAMIC_ADDRESS_SHOULD_NOT_BE_BOUND_TXT_STR "The address \"%s\" in line %ld of \"%s\" is for dynamic allocation only and should not be bound statically." +#define MSG_ADDNETINTERFACE_ALIAS_TXT_STR "Added alias address %s.\n" +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_ALIAS_ERROR_CODE_TXT_STR "Could not add interface \"%s\" alias address %s (%s)." +#define MSG_ADDNETINTERFACE_COULD_NOT_ADD_ALIAS_TXT_STR "Could not add interface \"%s\" alias address %s." +#define MSG_ADDNETINTERFACE_DEFAULT_DOMAIN_NAME_TXT_STR "Default domain name is \"%s\".\n" +#define MSG_ADDNETINTERFACE_INTERFACE_IS_BUSY_TXT_STR "Configuration for interface \"%s\" is still in progress." +#endif /* ADDNETINTERFACE_CATALOG_STRINGS */ + +#ifdef ADDNETROUTE_CATALOG_STRINGS +#define MSG_ADDNETROUTE_NO_UTILITY_TXT_STR "%s: Failed to open \"utility.library\" V37.\n" +#define MSG_ADDNETROUTE_CANNOT_OPEN_BSDSOCKET_TXT_STR "%s: Failed to open \"bsdsocket.library\" V4.\n" +#define MSG_ADDNETROUTE_BSDSOCKET_HAS_NO_ROUTE_API_TXT_STR "%s: \"%s\" V%ld.%ld does not support the route configuration method used by this program.\n" +#define MSG_ADDNETROUTE_NO_MEMORY_FOR_DEFAULT_GATEWAY_TXT_STR "%s: Not enough memory to add route to default gateway \"%s\".\n" +#define MSG_ADDNETROUTE_DESTINATION_IGNORED_TXT_STR "%s: \"DESTINATION=%s\" parameter ignored.\n" +#define MSG_ADDNETROUTE_HOSTDESTINATION_IGNORED_TXT_STR "%s: \"HOSTDESTINATION=%s\" parameter ignored.\n" +#define MSG_ADDNETROUTE_NETDESTINATION_IGNORED_TXT_STR "%s: \"NETDESTINATION=%s\" parameter ignored.\n" +#define MSG_ADDNETROUTE_GATEWAY_IGNORED_TXT_STR "%s: \"GATEWAY=%s\" parameter ignored.\n" +#define MSG_ADDNETROUTE_GATEWAY_NEEDS_DESTINATION_TXT_STR "%s: The \"GATEWAY=%s\" parameter needs a destination address.\n" +#define MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_GATEWAY_TXT_STR "%s: Not enough memory to add route to gateway \"%s\".\n" +#define MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_ROUTE_TXT_STR "%s: Not enough memory to add route to destination \"%s\".\n" +#define MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_ROUTE_TO_HOST_TXT_STR "%s: Not enough memory to add route to destination host \"%s\".\n" +#define MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_ROUTE_TO_NET_TXT_STR "%s: Not enough memory to add route to destination network \"%s\".\n" +#define MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_TO_ADD_ROUTE_TXT_STR "%s: Not enough memory to add route.\n" +#define MSG_ADDNETROUTE_COULD_NOT_ADD_ROUTE_TXT_STR "%s: Could not add route" +#define MSG_ADDNETROUTE_ROUTE_ADDED_TXT_STR "%s: Route added (" +#define MSG_ADDNETROUTE_DEFAULT_GATEWAY_TXT_STR "%sdefault gateway = %s" +#define MSG_ADDNETROUTE_DESTINATION_TXT_STR "%sdestination = %s" +#define MSG_ADDNETROUTE_DESTINATION_HOST_TXT_STR "%sdestination [host] = %s" +#define MSG_ADDNETROUTE_DESTINATION_NET_TXT_STR "%sdestination [network] = %s" +#define MSG_ADDNETROUTE_VIA_GATEWAY_TXT_STR "%svia gateway %s" +#endif /* ADDNETROUTE_CATALOG_STRINGS */ + +#ifdef CONFIGURENETINTERFACE_CATALOG_STRINGS +#define MSG_CONFIGURENETINTERFACE_NO_UTILITY_TXT_STR "%s: Failed to open \"utility.library\" V37.\n" +#define MSG_CONFIGURENETINTERFACE_CANNOT_OPEN_BSDSOCKET_TXT_STR "%s: Failed to open \"bsdsocket.library\" V4.\n" +#define MSG_CONFIGURENETINTERFACE_BSDSOCKET_HAS_NO_INTERFACE_API_TXT_STR "%s: \"%s\" V%ld.%ld does not support the interface configuration method used by this program.\n" +#define MSG_CONFIGURENETINTERFACE_BSDSOCKET_HAS_NO_ROUTE_API_TXT_STR "%s: \"%s\" V%ld.%ld does not support the route configuration method used by this program.\n" +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_ADDRESS_TXT_STR "%s: Not enough memory to configure interface \"%s\" address.\n" +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_MASK_TXT_STR "%s: Not enough memory to configure interface \"%s\" sub network mask.\n" +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_DESTINATION_ADDRESS_TXT_STR "%s: Not enough memory to configure interface \"%s\" destination address \"%s\".\n" +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_BROADCAST_ADDRESS_TXT_STR "%s: Not enough memory to configure interface \"%s\" broadcast address \"%s\".\n" +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_METRIC_TXT_STR "%s: Not enough memory to configure interface \"%s\" metric %ld.\n" +#define MSG_CONFIGURENETINTERFACE_TIMEOUT_TOO_SHORT_TXT_STR "%s: Configuration timeout %ld is too short; increased to %ld seconds.\n" +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_ADD_ALIAS_ADDRESS_TXT_STR "%s: Not enough memory to add interface \"%s\" alias address \"%s\".\n" +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_DELETE_ALIAS_ADDRESS_TXT_STR "%s: Not enough memory to delete interface \"%s\" alias address \"%s\".\n" +#define MSG_CONFIGURENETINTERFACE_UNKNOWN_CONFIGURE_PARAMETER_TXT_STR "%s: Unknown parameter \"CONFIGURE=%s\".\n" +#define MSG_CONFIGURENETINTERFACE_PICK_ONLY_ONE_STATE_TXT_STR "%s: Please specify exactly one interface state and not" +#define MSG_CONFIGURENETINTERFACE_UNKNOWN_LEASE_PARAMETER_TXT_STR "%s: Unknown lease parameter \"%s\".\n" +#define MSG_CONFIGURENETINTERFACE_INVALID_LEASE_PARAMETER_TXT_STR "%s: Invalid lease parameter \"%s\".\n" +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_TXT_STR "%s: Not enough memory to configure interface \"%s\".\n" +#define MSG_CONFIGURENETINTERFACE_COULD_NOT_MARK_INTERFACE_UP_TXT_STR "%s: Could not mark interface \"%s\" as \"UP\"." +#define MSG_CONFIGURENETINTERFACE_TRYING_INTERFACE_CONFIGURATION_TXT_STR "%s: Trying interface \"%s\" configuration... \0" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ABORTED_TXT_STR "%s: Interface \"%s\" configuration aborted.\n" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_TIMED_OUT_TXT_STR "%s: Interface \"%s\" configuration attempt timed out.\n" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NAME_UNKNOWN_TXT_STR "%s: Interface \"%s\" not configured; name is unknown.\n" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_WRONG_TYPE_TXT_STR "%s: Interface \"%s\" not configured; broadcast access not supported.\n" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ALREADY_CONFIGURED_TXT_STR "%s: Interface \"%s\" not configured; address is already configured.\n" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NOT_COMPATIBLE_TXT_STR "%s: Interface \"%s\" not configured; configuration command not compatible.\n" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NOT_ENOUGH_MEMORY_TXT_STR "%s: Interface \"%s\" not configured; not enough memory.\n" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ADDRESS_IN_USE_TXT_STR "%s: Interface \"%s\" not configured; IP address to be assigned is already in use.\n" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ADDRESS_NOT_CHANGED_TXT_STR "%s: Interface \"%s\" not configured; IP address could not be changed.\n" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_MASK_NOT_CHANGED_TXT_STR "%s: Interface \"%s\" not configured; network mask could not be changed.\n" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_UNKNOWN_ERROR_TXT_STR "%s: Interface \"%s\" not configured; unknown error (%ld).\n" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_NOT_CONFIGURED_ADDRESS_INVALID_TXT_STR "%s: Interface \"%s\" not configured; no valid IP address received.\n" +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_ADDRESS_TXT_STR "%s: Not enough memory to configure interface \"%s\" address \"%s\".\n" +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_NETMASK_TXT_STR "%s: Not enough memory to configure interface \"%s\" sub network mask \"%s\".\n" +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_STATE_TXT_STR "%s: Not enough memory to change interface \"%s\" state.\n" +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_TXT_STR "%s: Not enough memory to configure interface \"%s\".\n" +#define MSG_CONFIGURENETINTERFACE_COULD_NOT_CONFIGURE_INTERFACE_TXT_STR "%s: Could not configure interface \"%s\"" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURED_TXT_STR "%s: Interface \"%s\" configured (" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_ADDRESS_IS_TXT_STR "%saddress = %s" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_MASK_TXT_STR "%snetwork mask = %s" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_DESTINATION_ADDRESS_TXT_STR "%sdestination address = %s" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_BROADCAST_ADDRESS_TXT_STR "%sbroadcast address = %s" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_METRIC_TXT_STR "%smetric = %ld" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_ADD_ADDRESS_TXT_STR "%sadded alias address \"%s\"" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_DELETE_ADDRESS_TXT_STR "%sdeleted alias address \"%s\"" +#define MSG_CONFIGURENETINTERFACE_ADDED_DEFAULT_ROUTE_TXT_STR "%s: Added default route to %s.\n" +#define MSG_CONFIGURENETINTERFACE_ADDED_ROUTE_TXT_STR "%s: Added route to %s.\n" +#define MSG_CONFIGURENETINTERFACE_COULD_NOT_ADD_ROUTE_TO_TXT_STR "%s: Could not add route to %s" +#define MSG_CONFIGURENETINTERFACE_ADDED_DNS_TXT_STR "%s: Added domain name server %s.\n" +#define MSG_CONFIGURENETINTERFACE_COULD_NOT_ADD_DNS_TXT_STR "%s: Could not add domain name server %s" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_ADDRESS_TXT_STR "%s: Interface \"%s\" address %s \0" +#define MSG_CONFIGURENETINTERFACE_LEASED_PERMANENTLY_TXT_STR "has been leased permanently.\n" +#define MSG_CONFIGURENETINTERFACE_LEASED_UNTIL_TXT_STR "has been leased until %s %s and will be renewed before it expires.\n" +#define MSG_CONFIGURENETINTERFACE_COULD_NOT_SET_STATE_TXT_STR "%s: Could not set interface \"%s\" state to \"%s\"" +#define MSG_CONFIGURENETINTERFACE_STATE_CHANGED_TXT_STR "%s: Interface \"%s\" state changed to \"%s\".\n" +#define MSG_CONFIGURENETINTERFACE_INVALID_IP_ADDRESS_AT_TXT_STR "%s: Invalid IP address in \"%s=%s\"." +#define MSG_CONFIGURENETINTERFACE_ID_TOO_LONG_TXT_STR "Client identifier \"%s\" will be truncated." +#define MSG_CONFIGURENETINTERFACE_ID_TOO_SHORT_TXT_STR "Client identifier \"%s\" is too short (2 characters minimum)." +#define MSG_CONFIGURENETINTERFACE_HAS_NO_ADDRESS_CONVERSION_API_TXT_STR "%s: \"%s\" V%ld.%ld does not support the address conversion method used by this program.\n" +#define MSG_CONFIGURENETINTERFACE_COULD_NOT_RELEASE_INTERFACE_ADDRESS_TXT_STR "%s: Could not release interface address \"%s\"." +#define MSG_CONFIGURENETINTERFACE_INTERFACE_ADDRESS_WAS_RELEASED_TXT_STR "Interface address \"%s\" was released.\n" +#define MSG_CONFIGURENETINTERFACE_UNKNOWN_DEBUG_PARAMETER_TXT_STR "%s: Unknown parameter \"DEBUG=%s\".\n" +#define MSG_CONFIGURENETINTERFACE_INVALID_ADDRESS_TXT_STR "%s: \"%s\" is not a valid address.\n" +#define MSG_CONFIGURENETINTERFACE_DYNAMIC_ADDRESS_SHOULD_NOT_BE_BOUND_TXT_STR "%s: The address \"%s\" is for dynamic allocation only and should not be statically bound.\n" +#define MSG_CONFIGURENETINTERFACE_UNKNOWN_COMPLETE_PARAMETER_TXT_STR "%s: Unknown parameter \"COMPLETE=%s\".\n" +#define MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_MTU_TXT_STR "%s: Not enough memory to configure interface \"%s\" MTU %ld.\n" +#define MSG_CONFIGURENETINTERFACE_DEFAULT_DOMAIN_NAME_TXT_STR "%s: Default domain name is \"%s\".\n" +#define MSG_CONFIGURENETINTERFACE_INTERFACE_IS_BUSY_TXT_STR "%s: Configuration for interface \"%s\" is still in progress.\n" +#define MSG_CONFIGURENETINTERFACE_UNKNOWN_UNICAST_PARAMETER_TXT_STR "%s: Unknown DHCP unicast parameter \"%s\".\n" +#endif /* CONFIGURENETINTERFACE_CATALOG_STRINGS */ + +#ifdef DELETENETROUTE_CATALOG_STRINGS +#define MSG_DELETENETROUTE_NO_UTILITY_TXT_STR "%s: Failed to open \"utility.library\" V37.\n" +#define MSG_DELETENETROUTE_CANNOT_OPEN_BSDSOCKET_TXT_STR "%s: Failed to open \"bsdsocket.library\" V4.\n" +#define MSG_DELETENETROUTE_BSDSOCKET_HAS_NO_ROUTE_API_TXT_STR "%s: \"%s\" V%ld.%ld does not support the route configuration method used by this program.\n" +#define MSG_DELETENETROUTE_NEED_EITHER_DESTINATION_OR_DEFAULT_TXT_STR "%s: You must provide either a \"DESTINATION\" or \"DEFAULTGATEWAY\" parameter.\n" +#define MSG_DELETENETROUTE_DESTINATION_IGNORED_TXT_STR "%s: \"DESTINATION=%s\" parameter ignored.\n" +#define MSG_DELETENETROUTE_ROUTE_TO_DEFAULT_GATEWAY_NOT_DELETED_TXT_STR "%s: Could not delete route to default gateway \"%s\"" +#define MSG_DELETENETROUTE_ROUTE_NOT_DELETED_TXT_STR "%s: Could not delete route to \"%s\"" +#define MSG_DELETENETROUTE_ROUTE_TO_DEFAULT_DELETED_TXT_STR "%s: Route to default gateway \"%s\" deleted.\n" +#define MSG_DELETENETROUTE_ROUTE_DELETED_TXT_STR "%s: Route to \"%s\" deleted.\n" +#endif /* DELETENETROUTE_CATALOG_STRINGS */ + +#ifdef GETNETSTATUS_CATALOG_STRINGS +#define MSG_GETNETSTATUS_NO_UTILITY_TXT_STR "%s: Failed to open \"utility.library\" V37.\n" +#define MSG_GETNETSTATUS_CANNOT_OPEN_BSDSOCKET_TXT_STR "%s: Failed to open \"bsdsocket.library\" V4.\n" +#define MSG_GETNETSTATUS_BSDSOCKET_HAS_NO_STATUS_API_TXT_STR "%s: \"%s\" V%ld.%ld does not support the status query method used by this program.\n" +#define MSG_GETNETSTATUS_UNKNOWN_CONDITION_TXT_STR "%s: Warning, unknown condition \"%s\".\n" +#define MSG_GETNETSTATUS_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT_STR "Networking interfaces are available and configured.\n" +#define MSG_GETNETSTATUS_NO_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT_STR "%sNo%s networking interfaces are available and configured.\n" +#define MSG_GETNETSTATUS_POINT_TO_POINT_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT_STR "Point-to-point networking interfaces are available and configured.\n" +#define MSG_GETNETSTATUS_NO_POINT_TO_POINT_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT_STR "%sNo%s point-to-point networking interfaces are available and configured.\n" +#define MSG_GETNETSTATUS_BROADCAST_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT_STR "Broadcast networking interfaces are available and configured.\n" +#define MSG_GETNETSTATUS_NO_BROADCAST_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT_STR "%sNo%s broadcast networking interfaces are available and configured.\n" +#define MSG_GETNETSTATUS_DNS_CONFIGURED_TXT_STR "Name resolution servers are configured.\n" +#define MSG_GETNETSTATUS_NO_DNS_CONFIGURED_TXT_STR "%sNo%s name resolution servers are configured.\n" +#define MSG_GETNETSTATUS_ROUTE_CONFIGURED_TXT_STR "Routing information is configured.\n" +#define MSG_GETNETSTATUS_NO_ROUTE_CONFIGURED_TXT_STR "%sNo%s routing information is configured.\n" +#define MSG_GETNETSTATUS_DEFAULT_ROUTE_CONFIGURED_TXT_STR "The default route is configured.\n" +#define MSG_GETNETSTATUS_NO_DEFAULT_ROUTE_CONFIGURED_TXT_STR "The default route is %snot%s configured.\n" +#endif /* GETNETSTATUS_CATALOG_STRINGS */ + +#ifdef SHOWNETSTATUS_CATALOG_STRINGS +#define MSG_SHOWNETSTATUS_NO_UTILITY_TXT_STR "%s: Failed to open \"utility.library\" V37.\n" +#define MSG_SHOWNETSTATUS_CANNOT_OPEN_BSDSOCKET_TXT_STR "%s: Failed to open \"bsdsocket.library\" V4.\n" +#define MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_STATUS_API_TXT_STR "%s: \"%s\" V%ld.%ld does not support the status query method used by this program.\n" +#define MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_ROUTE_API_TXT_STR "%s: \"%s\" V%ld.%ld does not support the route query method used by this program.\n" +#define MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_INTERFACE_API_TXT_STR "%s: \"%s\" V%ld.%ld does not support the interface query method used by this program.\n" +#define MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_DNS_API_TXT_STR "%s: \"%s\" V%ld.%ld does not support the domain name server query method used by this program.\n" +#define MSG_SHOWNETSTATUS_CANNOT_GET_INFO_ON_INTERFACE_TXT_STR "%s: Unable to obtain information on interface \"%s\".\n" +#define MSG_SHOWNETSTATUS_CANNOT_GET_INTERFACE_LIST_TXT_STR "%s: Unable to obtain interface information.\n" +#define MSG_SHOWNETSTATUS_CANNOT_GET_DNS_LIST_TXT_STR "%s: Unable to obtain domain name server information.\n" +#define MSG_SHOWNETSTATUS_CANNOT_GET_ROUTE_TABLE_TXT_STR "%s: Unable to obtain routing information.\n" +#define MSG_SHOWNETSTATUS_NOT_ENOUGH_MEMORY_TO_QUERY_STATUS_TXT_STR "%s: Not enough memory to obtain status information for \"%s\".\n" +#define MSG_SHOWNETSTATUS_CANNOT_GET_STATUS_INFORMATION_FOR_TXT_STR "%s: Status information for \"%s\" could not be obtained.\n" +#define MSG_SHOWNETSTATUS_DEFAULT_TXT_STR "(Default)" +#define MSG_SHOWNETSTATUS_DESTINATION_GATEWAY_ATTRIBUTES_TITLE_TXT_STR "%s%-16s %-16s %s%s\n" +#define MSG_SHOWNETSTATUS_DESTINATION_TXT_STR "Destination" +#define MSG_SHOWNETSTATUS_GATEWAY_TXT_STR "Gateway" +#define MSG_SHOWNETSTATUS_ATTRIBUTES_TXT_STR "Attributes" +#define MSG_SHOWNETSTATUS_DESTINATION_GATEWAY_LINE_TXT_STR "%-16s %-16s" +#define MSG_SHOWNETSTATUS_UP_TXT_STR "Up" +#define MSG_SHOWNETSTATUS_DOWN_TXT_STR "Down" +#define MSG_SHOWNETSTATUS_HOST_TXT_STR "Host" +#define MSG_SHOWNETSTATUS_NO_ROUTES_ARE_CONFIGURED_TXT_STR "No routes are currently configured.\n" +#define MSG_SHOWNETSTATUS_ADDRESS_TYPE_TITLE_TXT_STR "%s%-20s %-10s%s\n" +#define MSG_SHOWNETSTATUS_ADDRESS_TXT_STR "Address" +#define MSG_SHOWNETSTATUS_TYPE_TXT_STR "Type" +#define MSG_SHOWNETSTATUS_ADDRESS_TYPE_LINE_TXT_STR "%-20s %s\n" +#define MSG_SHOWNETSTATUS_STATIC_TXT_STR "Static" +#define MSG_SHOWNETSTATUS_DYNAMIC_TXT_STR "Dynamic" +#define MSG_SHOWNETSTATUS_NO_DNS_CONFIGURED_TXT_STR "No domain name servers are configured.\n" +#define MSG_SHOWNETSTATUS_UNKNOWN_HARDWARE_TYPE_TXT_STR "Unknown (%ld)" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_TITLE_TXT_STR "%s%-20s %4s %-20s %-20s %8s %8s %8s %8s %8s %s%s\n" +#define MSG_SHOWNETSTATUS_NAME_TXT_STR "Name" +#define MSG_SHOWNETSTATUS_MTU_TXT_STR "MTU" +#define MSG_SHOWNETSTATUS_RECEIVED_TXT_STR "Received" +#define MSG_SHOWNETSTATUS_SENT_TXT_STR "Sent" +#define MSG_SHOWNETSTATUS_DROPPED_TXT_STR "Dropped" +#define MSG_SHOWNETSTATUS_OVERRUNS_TXT_STR "Overruns" +#define MSG_SHOWNETSTATUS_UNKNOWN_TXT_STR "Unknown" +#define MSG_SHOWNETSTATUS_STATUS_TXT_STR "Status" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_LINE_TXT_STR "%-20s %4ld %-20s %-20s %8ld %8ld %8ld %8ld %8ld %s\n" +#define MSG_SHOWNETSTATUS_NO_INTERFACES_AVAILABLE_TXT_STR "No interfaces are currently available.\n" +#define MSG_SHOWNETSTATUS_INTERFACE_TITLE_TXT_STR "%sInterface \"%s\"%s\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_DEVICE_NAME_TXT_STR "Device name = %s\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_DEVICE_UNIT_TXT_STR "Device unit number = %ld\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_HARDWARE_ADDRESS_TXT_STR "Hardware address = \0" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_MTU_TXT_STR "Maximum transmission unit = %ld Bytes\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_TRANSMISSION_SPEED_TXT_STR "Transmission speed = %ld Bits/Second\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_HARDWARE_TYPE_TXT_STR "Hardware type = %s\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_PACKETS_SENT_TXT_STR "Packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_PACKETS_RECEIVED_TXT_STR "Packets received = %ld\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_PACKETS_DROPPED_TXT_STR "Packets dropped = %ld (in = %ld, out = %ld)\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_BUFFER_OVERRUNS_TXT_STR "Buffer overruns = %ld\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_UNKNOWN_PACKETS_TXT_STR "Unknown packets = %ld\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_ADDRESS_TXT_STR "Address = %s\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_NETWORK_MASK_TXT_STR "Network mask = %s\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_PEER_ADDRESS_TXT_STR "Peer address = %s\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_STATUS_TXT_STR "Link status = %s\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_ADDRESS_BINDING_TXT_STR "Address binding = %s\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_LEASE_EXPIRES_TXT_STR "Address lease expires = %s\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_BINDING_STATIC_TXT_STR "Static" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_BINDING_DYNAMIC_TXT_STR "Dynamic" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_LEASE_NEVER_EXPIRES_TXT_STR "Never" +#define MSG_SHOWNETSTATUS_ICMP_TITLE_TXT_STR "%sInternet Control Message Protocol statistics%s\n" +#define MSG_SHOWNETSTATUS_ICMP_ERRORS_GENERATED_TXT_STR "Errors generated = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_IP_PACKETS_TOO_SHORT_TXT_STR "IP packets too short = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_PACKETS_NOT_RESPONDED_TO_TXT_STR "Packets not responded to = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_ECHO_REPLY_PACKETS_SENT_TXT_STR "'Echo reply' packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_DESTINATION_UNREACHABLE_TXT_STR "'Destination unreachable' packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_SOURCE_QUENCH_TXT_STR "'Source quench' packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_REDIRECT_TXT_STR "'Redirect' packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_ECHO_TXT_STR "'Echo' packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_ROUTER_ADVERTIZEMENT_TXT_STR "'Router advertizement' packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_ROUTER_SOLICITATION_TXT_STR "'Router solicitation' packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_TIME_EXCEEDED_TXT_STR "'Time exceeded' packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_BAD_IP_HEADER_TXT_STR "'Bad IP header' packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REQUEST_TXT_STR "'Timestamp request' packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REPLY_TXT_STR "'Timestamp reply' packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_INFORMATION_REQUEST_TXT_STR "'Information request' packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_INFORMATION_REPLY_TXT_STR "'Information reply' packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REQUEST_TXT_STR "'Address mask request' packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REPLY_TXT_STR "'Address mask reply' packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_RECEIVED_CODES_OUT_OF_RANGE_TXT_STR "Received codes out of range = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_RECEIVED_PACKETS_TOO_SHORT_TXT_STR "Received packets too short = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_RECEIVED_PACKET_CHECKSUM_ERRORS_TXT_STR "Received packet checksum errors = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_RECEIVED_CODES_BOUND_MISMATCH_TXT_STR "Received codes bound mismatch = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_RESPONSES_SENT_TXT_STR "Responses sent = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_ECHO_REPLIES_RECEIVED_TXT_STR "'Echo reply' packets received = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_DESTINATION_UNREACHABLE_RECEIVED_TXT_STR "'Destination unreachable' packets received = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_SOURCE_QUENCH_RECEIVED_TXT_STR "'Source quench' packets received = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_REDIRECT_RECEIVED_TXT_STR "'Redirect' packets received = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_ECHO_RECEIVED_TXT_STR "'Echo' packets received = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_ROUTER_ADVERTIZEMENT_RECEIVED_TXT_STR "'Router advertizement' packets received = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_ROUTER_SOLICITATION_RECEIVED_TXT_STR "'Router solicitation' packets received = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_TIME_EXCEEDED_RECEIVED_TXT_STR "'Time exceeded' packets received = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_BAD_IP_HEADER_RECEIVED_TXT_STR "'Bad IP header' packets received = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REQUEST_RECEIVED_TXT_STR "'Timestamp request' packets received = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REPLY_RECEIVED_TXT_STR "'Timestamp reply' packets received = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_INFORMATION_REQUEST_RECEIVED_TXT_STR "'Information request' packets received = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_INFORMATION_REPLY_RECEIVED_TXT_STR "'Information reply' packets received = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REQUEST_RECEIVED_TXT_STR "'Address mask request' packets received = %ld\n" +#define MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REPLY_RECEIVED_TXT_STR "'Address mask reply' packets received = %ld\n" +#define MSG_SHOWNETSTATUS_IGMP_TITLE_TXT_STR "%sInternet Group Management Protocol statistics%s\n" +#define MSG_SHOWNETSTATUS_IGMP_TOTAL_MESSAGES_RECEIVED_TXT_STR "Total messages received = %ld\n" +#define MSG_SHOWNETSTATUS_IGMP_MESSAGES_RECEIVED_TOO_SHORT_TXT_STR "Messages received with too few bytes = %ld\n" +#define MSG_SHOWNETSTATUS_IGMP_MESSAGES_RECEIVED_BAD_CHECKSUM_TXT_STR "Messages received with bad checksums = %ld\n" +#define MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_QUERIES_RECEIVED_TXT_STR "Membership queries received = %ld\n" +#define MSG_SHOWNETSTATUS_IGMP_INVALID_QUERIES_RECEIVED_TXT_STR "Messages received with invalid queries = %ld\n" +#define MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_REPORTS_RECEIVED_TXT_STR "Membership reports received = %ld\n" +#define MSG_SHOWNETSTATUS_IGMP_INVALID_REPORTS_RECEIVED_TXT_STR "Messages received with invalid reports = %ld\n" +#define MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_REPORTS_RECEIVED_FOR_THIS_GROUP_TXT_STR "Membership reports received for our group = %ld\n" +#define MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_REPORTS_SENT_TXT_STR "Membership reports sent = %ld\n" +#define MSG_SHOWNETSTATUS_IP_TITLE_TXT_STR "%sInternet Protocol statistics%s\n" +#define MSG_SHOWNETSTATUS_IP_TOTAL_PACKETS_RECEIVED_TXT_STR "Total packets received = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_WITH_CHECKSUM_ERRORS_TXT_STR "Packets with checksum errors = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_TOO_SHORT_TXT_STR "Packets shorter than expected = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_TOO_SMALL_TXT_STR "Packets with not enough data = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_WITH_BAD_DATA_SIZE_TXT_STR "Packets with bad data size = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_WITH_BAD_HEADER_SIZE_TXT_STR "Packets with bad header size = %ld\n" +#define MSG_SHOWNETSTATUS_IP_FRAGMENTS_RECEIVED_TXT_STR "Fragments received = %ld\n" +#define MSG_SHOWNETSTATUS_IP_FRAGMENTS_DROPPED_TXT_STR "Fragments dropped = %ld\n" +#define MSG_SHOWNETSTATUS_IP_FRAGMENTS_TIMED_OUT_TXT_STR "Fragments timed out = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_FORWARDED_TXT_STR "Packets forwarded = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_CANNOT_FORWARD_TXT_STR "Packets received for unreachable destination = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_FORWARDED_ON_SAME_NETWORK_TXT_STR "Packets forwarded on same network = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_WITH_UNKNOWN_PROTOCOLS_TXT_STR "Packets with unknown protocols = %ld\n" +#define MSG_SHOWNETSTATUS_IP_DATAGRAMS_DELIVERED_TXT_STR "Datagrams delivered = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_GENERATED_TXT_STR "Packets generated = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_LOST_TXT_STR "Packets lost = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_REASSEMBLED_TXT_STR "Packets reassembled = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_FRAGMENTED_TXT_STR "Packets fragmented = %ld\n" +#define MSG_SHOWNETSTATUS_IP_OUTPUT_FRAGMENTS_CREATED_TXT_STR "Output fragments created = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_CANNOT_FRAGMENT_TXT_STR "Packets that could not be fragmented = %ld\n" +#define MSG_SHOWNETSTATUS_IP_ERRORS_IN_OPTION_PROCESSING_TXT_STR "Errors in option processing = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_NO_ROUTE_TXT_STR "Packets discarded due to no route = %ld\n" +#define MSG_SHOWNETSTATUS_IP_PACKETS_WITH_BAD_IP_VERSION_TXT_STR "Packets with IP version other than 4 = %ld\n" +#define MSG_SHOWNETSTATUS_IP_RAW_PACKETS_SENT_TXT_STR "Raw IP packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_MBUF_TITLE_TXT_STR "%sMemory buffer statistics%s\n" +#define MSG_SHOWNETSTATUS_MBUF_BUFFERS_FROM_PAGE_POOL_TXT_STR "Buffers obtained from page pool = %ld\n" +#define MSG_SHOWNETSTATUS_MBUF_CLUSTERS_FROM_PAGE_POOL_TXT_STR "Clusters obtained from page pool = %ld\n" +#define MSG_SHOWNETSTATUS_MBUF_FREE_CLUSTERS_TXT_STR "Free clusters = %ld\n" +#define MSG_SHOWNETSTATUS_MBUF_DROPS_TXT_STR "Number of times no free space was available = %ld\n" +#define MSG_SHOWNETSTATUS_MBUF_WAIT_TXT_STR "Number of times had to wait for free space = %ld\n" +#define MSG_SHOWNETSTATUS_MBUF_DRAIN_TXT_STR "Number of times had to drain protocols for free space = %ld\n" +#define MSG_SHOWNETSTATUS_MULTICAST_TITLE_TXT_STR "%sMulticast routing statistics%s\n" +#define MSG_SHOWNETSTATUS_MULTICAST_ROUTE_LOOKUPS_TXT_STR "Multicast route lookups = %ld\n" +#define MSG_SHOWNETSTATUS_MULTICAST_ROUTE_CACHE_MISSES_TXT_STR "Multicast route cache misses = %ld\n" +#define MSG_SHOWNETSTATUS_MULTICAST_GROUP_ADDRESS_LOOKUPS_TXT_STR "Group address lookups = %ld\n" +#define MSG_SHOWNETSTATUS_MULTICAST_GROUP_ADDRESS_CACHE_MISSES_TXT_STR "Group address cache misses = %ld\n" +#define MSG_SHOWNETSTATUS_MULTICAST_NO_ROUTE_TXT_STR "Packets with no routes to their origins = %ld\n" +#define MSG_SHOWNETSTATUS_MULTICAST_BAD_TUNNEL_TXT_STR "Packets with malformed tunnel options = %ld\n" +#define MSG_SHOWNETSTATUS_MULTICAST_CANNOT_TUNNEL_TXT_STR "Packets with no room for tunnel options = %ld\n" +#define MSG_SHOWNETSTATUS_MULTICAST_CANNOT_WRONG_INTERFACE_TXT_STR "Packets arrived on the wrong interface = %ld\n" +#define MSG_SHOWNETSTATUS_ROUTING_TITLE_TXT_STR "%sRouting statistics%s\n" +#define MSG_SHOWNETSTATUS_ROUTING_BAD_REDIRECT_TXT_STR "Bogus redirect calls = %ld\n" +#define MSG_SHOWNETSTATUS_ROUTING_DYNAMIC_TXT_STR "Routes created by redirect calls = %ld\n" +#define MSG_SHOWNETSTATUS_ROUTING_NEW_GATEWAY_TXT_STR "Routes modified by redirect calls = %ld\n" +#define MSG_SHOWNETSTATUS_ROUTING_UNREACH_TXT_STR "Lookups which failed = %ld\n" +#define MSG_SHOWNETSTATUS_ROUTING_WILDCARD_TXT_STR "Lookups satisfied by a wildcard = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_TITLE_TXT_STR "%sTransmission Control Protocol statistics%s\n" +#define MSG_SHOWNETSTATUS_TCP_CONNATTEMPT_TXT_STR "Connections initiated = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_ACCEPTS_TXT_STR "Connections accepted = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_CONNECTS_TXT_STR "Connections established = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_DROPS_TXT_STR "Connections dropped = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_CONNDROPS_TXT_STR "Embryonic connections dropped = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_CLOSED_TXT_STR "Connections closed = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_SEGSTIMED_TXT_STR "Segments timed = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RTTUPDATED_TXT_STR "Round trip times updated = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_DELACK_TXT_STR "Delayed acknowledgments sent = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_TIMEOUTDROP_TXT_STR "Connections dropped in timeout state = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_PERSISTTIMEO_TXT_STR "Persist timeouts = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_KEEPTIMEO_TXT_STR "Keep-alive timeouts = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_KEEPPROBE_TXT_STR "Keep-alive probes sent = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_KEEPDROPS_TXT_STR "Connections dropped due to keep-alive timeouts = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_SNDTOTAL_TXT_STR "Total packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_SNDPACK_TXT_STR "Data packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_SNDBYTE_TXT_STR "Data bytes sent = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_SNDREXMITPACK_TXT_STR "Data packets retransmitted = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_SNDREXMITBYTE_TXT_STR "Data bytes retransmitted = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_SNDACKS_TXT_STR "Acknowledge-only packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_SNDPROBE_TXT_STR "Window probes sent = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_SNDURG_TXT_STR "Packets sent with 'urgent' attribute = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_SNDWINUP_TXT_STR "Window-update-only packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_SNDCTRL_TXT_STR "Packets sent with control attributes = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVTOTAL_TXT_STR "Total packets received = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVPACK_TXT_STR "Packets received in sequence = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVBYTE_TXT_STR "Bytes received in sequence = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVBADSUM_TXT_STR "Packets received with checksum errors = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVBADOFF_TXT_STR "Packets received with bad offset = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVSHORT_TXT_STR "Packets received that were too short = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVDUPPACK_TXT_STR "Duplicate packets received = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVDUPBYTE_TXT_STR "Duplicate bytes received = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVOOPACK_TXT_STR "Out-of-order packets received = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVOOBYTE_TXT_STR "Out-of-order bytes received = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVPACKAFTERWIN_TXT_STR "Packets received with data after window = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVBYTEAFTERWIN_TXT_STR "Bytes received after window = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVAFTERCLOSE_TXT_STR "Packets received after 'close' = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVWINPROBE_TXT_STR "Window probe packets received = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVDUPACK_TXT_STR "Duplicate acknowledgements received = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVACKTOOMUCH_TXT_STR "Acknowledgements received for unsent data = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVACKPACK_TXT_STR "Acknowledgement packets received = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVACKBYTE_TXT_STR "Bytes acknowledged = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_RCVWINUPD_TXT_STR "Window update packets received = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_PAWSDROP_TXT_STR "Segments dropped due to PAWS = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_PREDACK_TXT_STR "Correct header predictions for acknowledgements = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_PREDDAT_TXT_STR "Correct header predictions for data packets = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_PERSISTDROP_TXT_STR "Timeouts in persist state = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_BADSYN_TXT_STR "Packets with bogus 'SYN' attribute received = %ld\n" +#define MSG_SHOWNETSTATUS_UDP_TITLE_TXT_STR "%sUser Datagram Protocol statistics%s\n" +#define MSG_SHOWNETSTATUS_UDP_IPACKETS_TXT_STR "Total packets received = %ld\n" +#define MSG_SHOWNETSTATUS_UDP_HDROPS_TXT_STR "Packets received shorter than header = %ld\n" +#define MSG_SHOWNETSTATUS_UDP_BADSUM_TXT_STR "Packets received with checksum errors = %ld\n" +#define MSG_SHOWNETSTATUS_UDP_BADLEN_TXT_STR "Packets received larger than expected = %ld\n" +#define MSG_SHOWNETSTATUS_UDP_NOPORT_TXT_STR "Packets received for unbound ports = %ld\n" +#define MSG_SHOWNETSTATUS_UDP_NOPORTBCAST_TXT_STR "Broadcast packets received for unbound ports = %ld\n" +#define MSG_SHOWNETSTATUS_UDP_FULLSOCK_TXT_STR "Packets dropped = %ld\n" +#define MSG_SHOWNETSTATUS_UDP_OPACKETS_TXT_STR "Total packets sent = %ld\n" +#define MSG_SHOWNETSTATUS_TCP_SOCKET_TITLE_TXT_STR "%s%-30s %-30s %10s %10s %-30s%s\n" +#define MSG_SHOWNETSTATUS_LOCAL_TXT_STR "Local" +#define MSG_SHOWNETSTATUS_REMOTE_TXT_STR "Remote" +#define MSG_SHOWNETSTATUS_RECEIVE_LEN_TXT_STR "Rcv.len" +#define MSG_SHOWNETSTATUS_SEND_LEN_TXT_STR "Snd.len" +#define MSG_SHOWNETSTATUS_TCP_SOCKET_LINE_TXT_STR "%-30s %-30s %10ld %10ld %s\n" +#define MSG_SHOWNETSTATUS_NO_TCP_SOCKETS_IN_USE_TXT_STR "No TCP sockets are currently in use.\n" +#define MSG_SHOWNETSTATUS_UDP_SOCKET_TITLE_TXT_STR "%s%-30s %-30s %10s %10s%s\n" +#define MSG_SHOWNETSTATUS_UDP_SOCKET_LINE_TXT_STR "%-30s %-30s %10ld %10ld\n" +#define MSG_SHOWNETSTATUS_NO_UDP_SOCKETS_IN_USE_TXT_STR "No UDP sockets are currently in use.\n" +#define MSG_SHOWNETSTATUS_STATUS_NAME1_TXT_STR "Internet Control Message Protocol" +#define MSG_SHOWNETSTATUS_STATUS_NAME2_TXT_STR "Internet Group Management Protocol" +#define MSG_SHOWNETSTATUS_STATUS_NAME3_TXT_STR "Internet Protocol" +#define MSG_SHOWNETSTATUS_STATUS_NAME4_TXT_STR "memory buffer" +#define MSG_SHOWNETSTATUS_STATUS_NAME5_TXT_STR "multicast routing" +#define MSG_SHOWNETSTATUS_STATUS_NAME6_TXT_STR "routing" +#define MSG_SHOWNETSTATUS_STATUS_NAME7_TXT_STR "Transmission Control Protocol" +#define MSG_SHOWNETSTATUS_STATUS_NAME8_TXT_STR "User Datagram Protocol" +#define MSG_SHOWNETSTATUS_STATUS_NAME9_TXT_STR "Transmission Control Protocol sockets" +#define MSG_SHOWNETSTATUS_STATUS_NAME10_TXT_STR "User Datagram Protocol sockets" +#define MSG_SHOWNETSTATUS_NOT_CONFIGURED_TXT_STR "(Not configured)" +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE1_TXT_STR "Closed" +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE2_TXT_STR "Listening for connection" +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE3_TXT_STR "Active; 'SYN' sent" +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE4_TXT_STR "Sent and received 'SYN'" +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE5_TXT_STR "Established" +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE6_TXT_STR "Received 'FIN', waiting for close" +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE7_TXT_STR "Closed; 'FIN' sent" +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE8_TXT_STR "Closed, 'FIN' exchanged, waiting for 'FIN ACK'" +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE9_TXT_STR "Closed; waiting for last 'FIN ACK'" +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE10_TXT_STR "Closed, 'FIN' acknowledged" +#define MSG_SHOWNETSTATUS_TCP_FSM_STATE11_TXT_STR "Closed; waiting..." +#define MSG_SHOWNETSTATUS_WILDCARD_TXT_STR "(Any)" +#define MSG_SHOWNETSTATUS_SOME_TCP_SOCKETS_IN_USE_TXT_STR "Currently, %ld local TCP sockets are in use, but not displayed (use the \"ALL\" option to show them).\n" +#define MSG_SHOWNETSTATUS_SOME_UDP_SOCKETS_IN_USE_TXT_STR "Currently, %ld local UDP sockets are in use, but not displayed (use the \"ALL\" option to show them).\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_READ_REQUESTS_TXT_STR "Number of read I/O requests = %ld (maximum of %ld used at a time, %ld are still pending)\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_WRITE_REQUESTS_TXT_STR "Number of write I/O requests = %ld (maximum of %ld used at a time, %ld are still pending)\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_BYTES_RECEIVED_TXT_STR "Number of bytes received = %s\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_BYTES_SENT_TXT_STR "Number of bytes sent = %s\n" +#define MSG_SHOWNETSTATUS_UNKNOWN_HOST_TXT_STR "(Unknown)" +#define MSG_SHOWNETSTATUS_IP_ADDRESS_TXT_STR "IP address" +#define MSG_SHOWNETSTATUS_HARDWARE_ADDRESS_TXT_STR "Hardware address" +#define MSG_SHOWNETSTATUS_INCOMPLETE_HARDWARE_ADDRESS_TXT_STR "(Incomplete)" +#define MSG_SHOWNETSTATUS_ARP_ENTRY_PERMANENT_TXT_STR "permanent" +#define MSG_SHOWNETSTATUS_ARP_ENTRY_PUBLISHED_PROXY_TXT_STR "published (proxy only)" +#define MSG_SHOWNETSTATUS_ARP_ENTRY_PUBLISHED_TXT_STR "published" +#define MSG_SHOWNETSTATUS_ARP_CACHE_EMPTY_TXT_STR "The address resolution protocol cache is currently empty.\n" +#define MSG_SHOWNETSTATUS_ARP_HEADER_TXT_STR "%s%-16s %-16s %-20s %s%s" +#define MSG_SHOWNETSTATUS_NO_ARP_INFORMATION_TXT_STR "%s: Unable to obtain address resolution protocol information.\n" +#define MSG_SHOWNETSTATUS_INTERFACE_INFO_TRANSFER_STATISTICS_TXT_STR "Transfer statistics (in/out) = DMA:%lu/%lu Byte:%lu/%lu Word:-/%lu\n" +#define MSG_SHOWNETSTATUS_STATUS_SUMMARY_TXT_STR "%sNetwork status summary%s\n" +#define MSG_SHOWNETSTATUS_LOCAL_HOST_ADDRESS_TXT_STR "Local host address = \0" +#define MSG_SHOWNETSTATUS_LOCAL_HOST_ADDRESS_ON_INTERFACE_TXT_STR "%s (on interface '%s')" +#define MSG_SHOWNETSTATUS_DEFAULT_GATEWAY_ADDRESS_TXT_STR "Default gateway address = \0" +#define MSG_SHOWNETSTATUS_DOMAIN_NAME_SYSTEM_SERVERS_TXT_STR "Domain name system servers = \0" +#define MSG_SHOWNETSTATUS_DEFAULT_DOMAIN_NAME_TXT_STR "\nThe default domain name is set to \"%s\".\n" +#define MSG_SHOWNETSTATUS_DEFAULT_DOMAIN_NAME_UNSET_TXT_STR "\nThe default domain name is not set.\n" +#endif /* SHOWNETSTATUS_CATALOG_STRINGS */ + +#ifdef LOGVIEWER_CATALOG_STRINGS +#define MSG_LOGVIEWER_PROJECT_MENU_STR " \0Project" +#define MSG_LOGVIEWER_PROJECT_CLEAR_MENU_STR "C\0Clear" +#define MSG_LOGVIEWER_PROJECT_SAVE_AS_MENU_STR "A\0Save message list as..." +#define MSG_LOGVIEWER_PROJECT_HIDE_MENU_STR "H\0Hide" +#define MSG_LOGVIEWER_PROJECT_QUIT_MENU_STR "Q\0Quit" +#define MSG_LOGVIEWER_LOG_LEVEL_0_TXT_STR "Emergency" +#define MSG_LOGVIEWER_LOG_LEVEL_1_TXT_STR "Alert" +#define MSG_LOGVIEWER_LOG_LEVEL_2_TXT_STR "Critical" +#define MSG_LOGVIEWER_LOG_LEVEL_3_TXT_STR "Error" +#define MSG_LOGVIEWER_LOG_LEVEL_4_TXT_STR "Warning" +#define MSG_LOGVIEWER_LOG_LEVEL_5_TXT_STR "Note" +#define MSG_LOGVIEWER_LOG_LEVEL_6_TXT_STR "Information" +#define MSG_LOGVIEWER_LOG_LEVEL_7_TXT_STR "Debug" +#define MSG_LOGVIEWER_LABEL_0_TXT_STR "Time" +#define MSG_LOGVIEWER_LABEL_1_TXT_STR "Origin" +#define MSG_LOGVIEWER_LABEL_2_TXT_STR "Severity" +#define MSG_LOGVIEWER_LABEL_3_TXT_STR "Message" +#define MSG_LOGVIEWER_OK_TXT_STR "OK" +#define MSG_LOGVIEWER_REALLY_CLEAR_MESSAGE_LIST_TXT_STR "Do you really want to clear\nthe message list?" +#define MSG_LOGVIEWER_YES_NO_TXT_STR "Yes|No" +#define MSG_LOGVIEWER_OVERWRITE_APPEND_NEWNAME_CANCEL_TXT_STR "Overwrite|Append|Choose new name...|Cancel" +#define MSG_LOGVIEWER_FILE_REQUESTER_TITLE_TXT_STR "Save log messages" +#define MSG_LOGVIEWER_FILE_REQUESTER_SAVE_TXT_STR "Save" +#define MSG_LOGVIEWER_COMMODITIES_TITLE_TXT_STR "Network log viewer" +#define MSG_LOGVIEWER_COMMODITIES_DESCRIPTION_TXT_STR "Shows log messages" +#define MSG_LOGVIEWER_ORIGIN_UNKNOWN_TXT_STR "Unknown" +#define MSG_LOGVIEWER_FILE_ALREADY_EXISTS_TXT_STR "The file\n%s\nalready exists." +#define MSG_LOGVIEWER_FILE_COULD_NOT_BE_OPENED_TXT_STR "The file\n%s\ncould not be opened\n(%s)." +#define MSG_LOGVIEWER_ERROR_WRITING_TO_FILE_TXT_STR "Error writing to file\n%s\n(%s)." +#define MSG_LOGVIEWER_NO_DEFAULT_PUB_SCREEN_TXT_STR "Could not lock default public screen." +#define MSG_LOGVIEWER_NO_PUBLIC_SCREEN_FONT_TXT_STR "Could not open public screen font." +#define MSG_LOGVIEWER_NO_VISUAL_INFO_TXT_STR "Could not obtain visual information of public screen." +#define MSG_LOGVIEWER_NO_MENU_TXT_STR "Could not create menu." +#define MSG_LOGVIEWER_NO_MENU_LAYOUT_TXT_STR "Could not perform menu layout." +#define MSG_LOGVIEWER_NO_SCREEN_DRAW_INFO_TXT_STR "Could not obtain screen draw info." +#define MSG_LOGVIEWER_NO_SIZING_IMAGE_TXT_STR "Could not obtain sizing image." +#define MSG_LOGVIEWER_NO_VERTICAL_SCROLLER_TXT_STR "Could not create vertical scroller." +#define MSG_LOGVIEWER_NO_HORIZONTAL_SCROLLER_TXT_STR "Could not create horizontal scroller." +#define MSG_LOGVIEWER_NO_WINDOW_TXT_STR "Could not open window." +#define MSG_LOGVIEWER_NO_USER_CLIP_REGION_TXT_STR "Not enough memory for user clip region." +#define MSG_LOGVIEWER_NO_LIBRARY_VERSION_TXT_STR "Could not open \"%s\" V%ld." +#define MSG_LOGVIEWER_NO_LIBRARY_TXT_STR "Could not open \"%s\"." +#define MSG_LOGVIEWER_NO_MEMORY_POOL_TXT_STR "Could not create memory pool." +#define MSG_LOGVIEWER_NO_SCROLLER_CLASS_TXT_STR "Could not set up scroller class." +#define MSG_LOGVIEWER_NO_FILE_REQUESTER_TXT_STR "Could not allocate file requester." +#define MSG_LOGVIEWER_NO_COMMODITIES_PORT_TXT_STR "Could not create commodities message port." +#define MSG_LOGVIEWER_NO_COMMODITIES_BROKER_TXT_STR "Could not create commodities broker." +#define MSG_LOGVIEWER_NO_COMMODITIES_HOTKEY_TXT_STR "Could not create commodities hotkey filter." +#define MSG_LOGVIEWER_NO_COMMODITIES_SYSTEM_TXT_STR "Could not configure commodities system." +#define MSG_LOGVIEWER_NO_HOOK_PORT_TXT_STR "Could not create internal message port." +#define MSG_LOGVIEWER_NO_LOG_HOOK_TXT_STR "Could not register log message hook interface (Roadshow required)." +#endif /* LOGVIEWER_CATALOG_STRINGS */ + +#ifdef NETSHUTDOWN_CATALOG_STRINGS +#define MSG_NETSHUTDOWN_NO_UTILITY_TXT_STR "%s: Failed to open \"utility.library\" V37.\n" +#define MSG_NETSHUTDOWN_NO_MEMORY_TXT_STR "%s: Could not allocate memory.\n" +#define MSG_NETSHUTDOWN_NO_MSGPORT_TXT_STR "%s: Could not create a message port.\n" +#define MSG_NETSHUTDOWN_NO_TIMER_REQUEST_TXT_STR "%s: Could not create timer request.\n" +#define MSG_NETSHUTDOWN_NO_TIMER_DEVICE_TXT_STR "%s: Could not open \"%s\".\n" +#define MSG_NETSHUTDOWN_TRYING_TO_SHUT_DOWN_TXT_STR "Waiting for network to shut down... \0" +#define MSG_NETSHUTDOWN_SHUTDOWN_FAILED_TXT_STR "shutdown failed.\a\n" +#define MSG_NETSHUTDOWN_SHUTDOWN_DONE_TXT_STR "shutdown finished.\n" +#define MSG_NETSHUTDOWN_SHUTDOWN_ABORTED_TXT_STR "stopped waiting; network may shut down later.\n" +#define MSG_NETSHUTDOWN_SHUTDOWN_TIMEOUT_TXT_STR "timeout; network may shut down later.\n" +#define MSG_NETSHUTDOWN_NETWORK_NOT_IN_USE_TXT_STR "%s: The network is not currently in use.\n" +#endif /* NETSHUTDOWN_CATALOG_STRINGS */ + +#ifdef ROADSHOWCONTROL_CATALOG_STRINGS +#define MSG_ROADSHOWCONTROL_NO_UTILITY_TXT_STR "%s: Failed to open \"utility.library\" V37.\n" +#define MSG_ROADSHOWCONTROL_CANNOT_OPEN_BSDSOCKET_TXT_STR "%s: Failed to open \"bsdsocket.library\" V4.\n" +#define MSG_ROADSHOWCONTROL_BSDSOCKET_HAS_NO_ROADSHOWDATA_API_TXT_STR "%s: \"%s\" V%ld.%ld does not support the data set/get method used by this program.\n" +#define MSG_ROADSHOWCONTROL_NO_ROADSHOW_DATA_TXT_STR "%s: List of internal options is not available (%ld, %s).\n" +#define MSG_ROADSHOWCONTROL_COULD_NOT_SET_OPTION_TXT_STR "%s: Could not set option \"%s\" to %ld (%ld, %s).\n" +#define MSG_ROADSHOWCONTROL_COULD_NOT_SET_ENV_VARIABLE_TXT_STR "%s: Could not set environment variable \"%s\" (%ld, %s).\n" +#endif /* ROADSHOWCONTROL_CATALOG_STRINGS */ + +#ifdef REMOVENETINTERFACE_CATALOG_STRINGS +#define MSG_REMOVENETINTERFACE_CANNOT_OPEN_BSDSOCKET_TXT_STR "%s: Failed to open \"bsdsocket.library\" V4.\n" +#define MSG_REMOVENETINTERFACE_INTERFACE_REMOVED_TXT_STR "%s: Interface \"%s\" removed.\n" +#define MSG_REMOVENETINTERFACE_COULD_NOT_REMOVE_INTERFACE_TXT_STR "%s: Could not remove interface \"%s\" (%ld, %s).\n" +#endif /* REMOVENETINTERFACE_CATALOG_STRINGS */ + +#endif /* CATCOMP_STRINGS */ + + +/****************************************************************************/ + + +#ifdef CATCOMP_ARRAY + +struct CatCompArrayType +{ + LONG cca_ID; + STRPTR cca_Str; +}; + +static const struct CatCompArrayType CatCompArray[] = +{ + +#ifdef ADDNETINTERFACE_CATALOG_STRINGS + {MSG_ADDNETINTERFACE_NO_UTILITY_TXT,(STRPTR)MSG_ADDNETINTERFACE_NO_UTILITY_TXT_STR}, + {MSG_ADDNETINTERFACE_NO_ICON_TXT,(STRPTR)MSG_ADDNETINTERFACE_NO_ICON_TXT_STR}, + {MSG_ADDNETINTERFACE_TIMEOUT_TOO_SHORT_TXT,(STRPTR)MSG_ADDNETINTERFACE_TIMEOUT_TOO_SHORT_TXT_STR}, + {MSG_ADDNETINTERFACE_CANNOT_OPEN_FILE_TXT,(STRPTR)MSG_ADDNETINTERFACE_CANNOT_OPEN_FILE_TXT_STR}, + {MSG_ADDNETINTERFACE_CANNOT_OPEN_BSDSOCKET_TXT,(STRPTR)MSG_ADDNETINTERFACE_CANNOT_OPEN_BSDSOCKET_TXT_STR}, + {MSG_ADDNETINTERFACE_BSDSOCKET_HAS_NO_INTERFACE_API_TXT,(STRPTR)MSG_ADDNETINTERFACE_BSDSOCKET_HAS_NO_INTERFACE_API_TXT_STR}, + {MSG_ADDNETINTERFACE_BSDSOCKET_HAS_NO_ROUTE_API_TXT,(STRPTR)MSG_ADDNETINTERFACE_BSDSOCKET_HAS_NO_ROUTE_API_TXT_STR}, + {MSG_ADDNETINTERFACE_UNKNOWN_KEYWORD_TXT,(STRPTR)MSG_ADDNETINTERFACE_UNKNOWN_KEYWORD_TXT_STR}, + {MSG_ADDNETINTERFACE_PARSE_ERROR_TXT,(STRPTR)MSG_ADDNETINTERFACE_PARSE_ERROR_TXT_STR}, + {MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT,(STRPTR)MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_PARSE_TXT_STR}, + {MSG_ADDNETINTERFACE_UNKNOWN_PARAMETER_TXT,(STRPTR)MSG_ADDNETINTERFACE_UNKNOWN_PARAMETER_TXT_STR}, + {MSG_ADDNETINTERFACE_UNKNOWN_LEASE_PARAMETER_TXT,(STRPTR)MSG_ADDNETINTERFACE_UNKNOWN_LEASE_PARAMETER_TXT_STR}, + {MSG_ADDNETINTERFACE_INVALID_LEASE_PARAMETER_TXT,(STRPTR)MSG_ADDNETINTERFACE_INVALID_LEASE_PARAMETER_TXT_STR}, + {MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_ADD_INTERFACE_TXT,(STRPTR)MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_ADD_INTERFACE_TXT_STR}, + {MSG_ADDNETINTERFACE_NO_DEVICE_NAME_PROVIDED_TXT,(STRPTR)MSG_ADDNETINTERFACE_NO_DEVICE_NAME_PROVIDED_TXT_STR}, + {MSG_ADDNETINTERFACE_COULD_NOT_ADD_INTERFACE_ERROR_CODE_TXT,(STRPTR)MSG_ADDNETINTERFACE_COULD_NOT_ADD_INTERFACE_ERROR_CODE_TXT_STR}, + {MSG_ADDNETINTERFACE_COULD_NOT_ADD_INTERFACE_TXT,(STRPTR)MSG_ADDNETINTERFACE_COULD_NOT_ADD_INTERFACE_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_ADDED_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_ADDED_TXT_STR}, + {MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_TXT,(STRPTR)MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_TXT_STR}, + {MSG_ADDNETINTERFACE_CANNOT_MARK_INTERFACE_UP_ERROR_CODE_TXT,(STRPTR)MSG_ADDNETINTERFACE_CANNOT_MARK_INTERFACE_UP_ERROR_CODE_TXT_STR}, + {MSG_ADDNETINTERFACE_CANNOT_MARK_INTERFACE_UP_TXT,(STRPTR)MSG_ADDNETINTERFACE_CANNOT_MARK_INTERFACE_UP_TXT_STR}, + {MSG_ADDNETINTERFACE_TRYING_INTERFACE_CONFIGURATION_TXT,(STRPTR)MSG_ADDNETINTERFACE_TRYING_INTERFACE_CONFIGURATION_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_ABORTED_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_ABORTED_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_ATTEMPT_TIMED_OUT_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_ATTEMPT_TIMED_OUT_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_WRONG_TYPE_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_WRONG_TYPE_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_ALREADY_CONFIGURED_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_ALREADY_CONFIGURED_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_VERSION_CONFLICT_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_CONFIGURATION_VERSION_CONFLICT_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_NO_MEMORY_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_NO_MEMORY_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_ADDRESS_IN_USE_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_ADDRESS_IN_USE_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_ADDRESS_CHANGE_FAILED_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_ADDRESS_CHANGE_FAILED_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_MASK_CHANGE_FAILED_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_MASK_CHANGE_FAILED_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_UNKNOWN_ERROR_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_UNKNOWN_ERROR_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_INVALID_ADDRESS_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_NOT_CONFIGURED_INVALID_ADDRESS_TXT_STR}, + {MSG_ADDNETINTERFACE_COULD_NOT_CONFIGURE_INTERFACE_ERROR_CODE_TXT,(STRPTR)MSG_ADDNETINTERFACE_COULD_NOT_CONFIGURE_INTERFACE_ERROR_CODE_TXT_STR}, + {MSG_ADDNETINTERFACE_COULD_NOT_CONFIGURE_INTERFACE_TXT,(STRPTR)MSG_ADDNETINTERFACE_COULD_NOT_CONFIGURE_INTERFACE_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_ADDRESS_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_ADDRESS_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_MASK_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_MASK_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_BROADCAST_ADDRESS_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_BROADCAST_ADDRESS_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_DESTINATION_ADDRESS_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_DESTINATION_ADDRESS_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_METRIC_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_CONFIGURED_METRIC_TXT_STR}, + {MSG_ADDNETINTERFACE_DEFAULT_ROUTE_TXT,(STRPTR)MSG_ADDNETINTERFACE_DEFAULT_ROUTE_TXT_STR}, + {MSG_ADDNETINTERFACE_ROUTE_TXT,(STRPTR)MSG_ADDNETINTERFACE_ROUTE_TXT_STR}, + {MSG_ADDNETINTERFACE_COULD_NOT_ADD_ROUTE_ERROR_CODE_TXT,(STRPTR)MSG_ADDNETINTERFACE_COULD_NOT_ADD_ROUTE_ERROR_CODE_TXT_STR}, + {MSG_ADDNETINTERFACE_COULD_NOT_ADD_ROUTE_TXT,(STRPTR)MSG_ADDNETINTERFACE_COULD_NOT_ADD_ROUTE_TXT_STR}, + {MSG_ADDNETINTERFACE_DNS_TXT,(STRPTR)MSG_ADDNETINTERFACE_DNS_TXT_STR}, + {MSG_ADDNETINTERFACE_COULD_NOT_ADD_DNS_ERROR_CODE_TXT,(STRPTR)MSG_ADDNETINTERFACE_COULD_NOT_ADD_DNS_ERROR_CODE_TXT_STR}, + {MSG_ADDNETINTERFACE_COULD_NOT_ADD_DNS_TXT,(STRPTR)MSG_ADDNETINTERFACE_COULD_NOT_ADD_DNS_TXT_STR}, + {MSG_ADDNETINTERFACE_ADDRESS_TXT,(STRPTR)MSG_ADDNETINTERFACE_ADDRESS_TXT_STR}, + {MSG_ADDNETINTERFACE_LEASED_PERMANENTLY_TXT,(STRPTR)MSG_ADDNETINTERFACE_LEASED_PERMANENTLY_TXT_STR}, + {MSG_ADDNETINTERFACE_LEASED_UNTIL_TXT,(STRPTR)MSG_ADDNETINTERFACE_LEASED_UNTIL_TXT_STR}, + {MSG_ADDNETINTERFACE_ERROR_MESSAGE_TITLE_TXT,(STRPTR)MSG_ADDNETINTERFACE_ERROR_MESSAGE_TITLE_TXT_STR}, + {MSG_ADDNETINTERFACE_ERROR_MESSAGE_BUTTON_LABEL_TXT,(STRPTR)MSG_ADDNETINTERFACE_ERROR_MESSAGE_BUTTON_LABEL_TXT_STR}, + {MSG_ADDNETINTERFACE_UNKNOWN_STATE_PARAMETER_TXT,(STRPTR)MSG_ADDNETINTERFACE_UNKNOWN_STATE_PARAMETER_TXT_STR}, + {MSG_ADDNETINTERFACE_INVALID_IP_ADDRESS_AT_TXT,(STRPTR)MSG_ADDNETINTERFACE_INVALID_IP_ADDRESS_AT_TXT_STR}, + {MSG_ADDNETINTERFACE_ID_TOO_LONG_TXT,(STRPTR)MSG_ADDNETINTERFACE_ID_TOO_LONG_TXT_STR}, + {MSG_ADDNETINTERFACE_ID_TOO_SHORT_TXT,(STRPTR)MSG_ADDNETINTERFACE_ID_TOO_SHORT_TXT_STR}, + {MSG_ADDNETINTERFACE_HAS_NO_ADDRESS_CONVERSION_API_TXT,(STRPTR)MSG_ADDNETINTERFACE_HAS_NO_ADDRESS_CONVERSION_API_TXT_STR}, + {MSG_ADDNETINTERFACE_INVALID_HARDWARE_ADDRESS_TXT,(STRPTR)MSG_ADDNETINTERFACE_INVALID_HARDWARE_ADDRESS_TXT_STR}, + {MSG_ADDNETINTERFACE_MISSING_HARDWARE_ADDRESS_TXT,(STRPTR)MSG_ADDNETINTERFACE_MISSING_HARDWARE_ADDRESS_TXT_STR}, + {MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_FOR_HARDWARE_ADDRESS_TXT,(STRPTR)MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_FOR_HARDWARE_ADDRESS_TXT_STR}, + {MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_HARDWARE_ADDRESS_TXT,(STRPTR)MSG_ADDNETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_HARDWARE_ADDRESS_TXT_STR}, + {MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_TOO_SHORT_TXT,(STRPTR)MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_TOO_SHORT_TXT_STR}, + {MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_TOO_LONG_TXT,(STRPTR)MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_TOO_LONG_TXT_STR}, + {MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_IS_BROADCAST_TXT,(STRPTR)MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_IS_BROADCAST_TXT_STR}, + {MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_IS_GROUP_TXT,(STRPTR)MSG_ADDNETINTERFACE_HARDWARE_ADDRESS_IS_GROUP_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_HARDWARE_ADDRESS_SET_TO_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_HARDWARE_ADDRESS_SET_TO_TXT_STR}, + {MSG_ADDNETINTERFACE_NO_INTERFACE_NAME_GIVEN_TXT,(STRPTR)MSG_ADDNETINTERFACE_NO_INTERFACE_NAME_GIVEN_TXT_STR}, + {MSG_ADDNETINTERFACE_INVALID_ADDRESS_TXT,(STRPTR)MSG_ADDNETINTERFACE_INVALID_ADDRESS_TXT_STR}, + {MSG_ADDNETINTERFACE_DYNAMIC_ADDRESS_SHOULD_NOT_BE_BOUND_TXT,(STRPTR)MSG_ADDNETINTERFACE_DYNAMIC_ADDRESS_SHOULD_NOT_BE_BOUND_TXT_STR}, + {MSG_ADDNETINTERFACE_ALIAS_TXT,(STRPTR)MSG_ADDNETINTERFACE_ALIAS_TXT_STR}, + {MSG_ADDNETINTERFACE_COULD_NOT_ADD_ALIAS_ERROR_CODE_TXT,(STRPTR)MSG_ADDNETINTERFACE_COULD_NOT_ADD_ALIAS_ERROR_CODE_TXT_STR}, + {MSG_ADDNETINTERFACE_COULD_NOT_ADD_ALIAS_TXT,(STRPTR)MSG_ADDNETINTERFACE_COULD_NOT_ADD_ALIAS_TXT_STR}, + {MSG_ADDNETINTERFACE_DEFAULT_DOMAIN_NAME_TXT,(STRPTR)MSG_ADDNETINTERFACE_DEFAULT_DOMAIN_NAME_TXT_STR}, + {MSG_ADDNETINTERFACE_INTERFACE_IS_BUSY_TXT,(STRPTR)MSG_ADDNETINTERFACE_INTERFACE_IS_BUSY_TXT_STR}, +#endif /* ADDNETINTERFACE_CATALOG_STRINGS */ + +#ifdef ADDNETROUTE_CATALOG_STRINGS + {MSG_ADDNETROUTE_NO_UTILITY_TXT,(STRPTR)MSG_ADDNETROUTE_NO_UTILITY_TXT_STR}, + {MSG_ADDNETROUTE_CANNOT_OPEN_BSDSOCKET_TXT,(STRPTR)MSG_ADDNETROUTE_CANNOT_OPEN_BSDSOCKET_TXT_STR}, + {MSG_ADDNETROUTE_BSDSOCKET_HAS_NO_ROUTE_API_TXT,(STRPTR)MSG_ADDNETROUTE_BSDSOCKET_HAS_NO_ROUTE_API_TXT_STR}, + {MSG_ADDNETROUTE_NO_MEMORY_FOR_DEFAULT_GATEWAY_TXT,(STRPTR)MSG_ADDNETROUTE_NO_MEMORY_FOR_DEFAULT_GATEWAY_TXT_STR}, + {MSG_ADDNETROUTE_DESTINATION_IGNORED_TXT,(STRPTR)MSG_ADDNETROUTE_DESTINATION_IGNORED_TXT_STR}, + {MSG_ADDNETROUTE_HOSTDESTINATION_IGNORED_TXT,(STRPTR)MSG_ADDNETROUTE_HOSTDESTINATION_IGNORED_TXT_STR}, + {MSG_ADDNETROUTE_NETDESTINATION_IGNORED_TXT,(STRPTR)MSG_ADDNETROUTE_NETDESTINATION_IGNORED_TXT_STR}, + {MSG_ADDNETROUTE_GATEWAY_IGNORED_TXT,(STRPTR)MSG_ADDNETROUTE_GATEWAY_IGNORED_TXT_STR}, + {MSG_ADDNETROUTE_GATEWAY_NEEDS_DESTINATION_TXT,(STRPTR)MSG_ADDNETROUTE_GATEWAY_NEEDS_DESTINATION_TXT_STR}, + {MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_GATEWAY_TXT,(STRPTR)MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_GATEWAY_TXT_STR}, + {MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_ROUTE_TXT,(STRPTR)MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_ROUTE_TXT_STR}, + {MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_ROUTE_TO_HOST_TXT,(STRPTR)MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_ROUTE_TO_HOST_TXT_STR}, + {MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_ROUTE_TO_NET_TXT,(STRPTR)MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_FOR_ROUTE_TO_NET_TXT_STR}, + {MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_TO_ADD_ROUTE_TXT,(STRPTR)MSG_ADDNETROUTE_NOT_ENOUGH_MEMORY_TO_ADD_ROUTE_TXT_STR}, + {MSG_ADDNETROUTE_COULD_NOT_ADD_ROUTE_TXT,(STRPTR)MSG_ADDNETROUTE_COULD_NOT_ADD_ROUTE_TXT_STR}, + {MSG_ADDNETROUTE_ROUTE_ADDED_TXT,(STRPTR)MSG_ADDNETROUTE_ROUTE_ADDED_TXT_STR}, + {MSG_ADDNETROUTE_DEFAULT_GATEWAY_TXT,(STRPTR)MSG_ADDNETROUTE_DEFAULT_GATEWAY_TXT_STR}, + {MSG_ADDNETROUTE_DESTINATION_TXT,(STRPTR)MSG_ADDNETROUTE_DESTINATION_TXT_STR}, + {MSG_ADDNETROUTE_DESTINATION_HOST_TXT,(STRPTR)MSG_ADDNETROUTE_DESTINATION_HOST_TXT_STR}, + {MSG_ADDNETROUTE_DESTINATION_NET_TXT,(STRPTR)MSG_ADDNETROUTE_DESTINATION_NET_TXT_STR}, + {MSG_ADDNETROUTE_VIA_GATEWAY_TXT,(STRPTR)MSG_ADDNETROUTE_VIA_GATEWAY_TXT_STR}, +#endif /* ADDNETROUTE_CATALOG_STRINGS */ + +#ifdef CONFIGURENETINTERFACE_CATALOG_STRINGS + {MSG_CONFIGURENETINTERFACE_NO_UTILITY_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_NO_UTILITY_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_CANNOT_OPEN_BSDSOCKET_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_CANNOT_OPEN_BSDSOCKET_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_BSDSOCKET_HAS_NO_INTERFACE_API_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_BSDSOCKET_HAS_NO_INTERFACE_API_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_BSDSOCKET_HAS_NO_ROUTE_API_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_BSDSOCKET_HAS_NO_ROUTE_API_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_ADDRESS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_ADDRESS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_MASK_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_MASK_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_DESTINATION_ADDRESS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_DESTINATION_ADDRESS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_BROADCAST_ADDRESS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_BROADCAST_ADDRESS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_METRIC_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_METRIC_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_TIMEOUT_TOO_SHORT_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_TIMEOUT_TOO_SHORT_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_ADD_ALIAS_ADDRESS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_ADD_ALIAS_ADDRESS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_DELETE_ALIAS_ADDRESS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_DELETE_ALIAS_ADDRESS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_UNKNOWN_CONFIGURE_PARAMETER_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_UNKNOWN_CONFIGURE_PARAMETER_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_PICK_ONLY_ONE_STATE_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_PICK_ONLY_ONE_STATE_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_UNKNOWN_LEASE_PARAMETER_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_UNKNOWN_LEASE_PARAMETER_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INVALID_LEASE_PARAMETER_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INVALID_LEASE_PARAMETER_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_COULD_NOT_MARK_INTERFACE_UP_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_COULD_NOT_MARK_INTERFACE_UP_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_TRYING_INTERFACE_CONFIGURATION_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_TRYING_INTERFACE_CONFIGURATION_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ABORTED_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ABORTED_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_TIMED_OUT_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_TIMED_OUT_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NAME_UNKNOWN_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NAME_UNKNOWN_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_WRONG_TYPE_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_WRONG_TYPE_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ALREADY_CONFIGURED_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ALREADY_CONFIGURED_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NOT_COMPATIBLE_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NOT_COMPATIBLE_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NOT_ENOUGH_MEMORY_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_NOT_ENOUGH_MEMORY_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ADDRESS_IN_USE_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ADDRESS_IN_USE_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ADDRESS_NOT_CHANGED_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_ADDRESS_NOT_CHANGED_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_MASK_NOT_CHANGED_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_MASK_NOT_CHANGED_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_UNKNOWN_ERROR_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURATION_UNKNOWN_ERROR_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_NOT_CONFIGURED_ADDRESS_INVALID_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_NOT_CONFIGURED_ADDRESS_INVALID_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_ADDRESS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_ADDRESS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_NETMASK_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_NETMASK_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_STATE_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_STATE_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_COULD_NOT_CONFIGURE_INTERFACE_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_COULD_NOT_CONFIGURE_INTERFACE_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURED_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_CONFIGURED_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_ADDRESS_IS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_ADDRESS_IS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_MASK_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_MASK_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_DESTINATION_ADDRESS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_DESTINATION_ADDRESS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_BROADCAST_ADDRESS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_BROADCAST_ADDRESS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_METRIC_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_METRIC_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_ADD_ADDRESS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_ADD_ADDRESS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_DELETE_ADDRESS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_DELETE_ADDRESS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_ADDED_DEFAULT_ROUTE_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_ADDED_DEFAULT_ROUTE_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_ADDED_ROUTE_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_ADDED_ROUTE_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_COULD_NOT_ADD_ROUTE_TO_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_COULD_NOT_ADD_ROUTE_TO_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_ADDED_DNS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_ADDED_DNS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_COULD_NOT_ADD_DNS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_COULD_NOT_ADD_DNS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_ADDRESS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_ADDRESS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_LEASED_PERMANENTLY_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_LEASED_PERMANENTLY_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_LEASED_UNTIL_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_LEASED_UNTIL_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_COULD_NOT_SET_STATE_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_COULD_NOT_SET_STATE_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_STATE_CHANGED_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_STATE_CHANGED_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INVALID_IP_ADDRESS_AT_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INVALID_IP_ADDRESS_AT_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_ID_TOO_LONG_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_ID_TOO_LONG_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_ID_TOO_SHORT_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_ID_TOO_SHORT_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_HAS_NO_ADDRESS_CONVERSION_API_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_HAS_NO_ADDRESS_CONVERSION_API_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_COULD_NOT_RELEASE_INTERFACE_ADDRESS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_COULD_NOT_RELEASE_INTERFACE_ADDRESS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_ADDRESS_WAS_RELEASED_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_ADDRESS_WAS_RELEASED_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_UNKNOWN_DEBUG_PARAMETER_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_UNKNOWN_DEBUG_PARAMETER_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INVALID_ADDRESS_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INVALID_ADDRESS_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_DYNAMIC_ADDRESS_SHOULD_NOT_BE_BOUND_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_DYNAMIC_ADDRESS_SHOULD_NOT_BE_BOUND_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_UNKNOWN_COMPLETE_PARAMETER_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_UNKNOWN_COMPLETE_PARAMETER_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_MTU_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_NOT_ENOUGH_MEMORY_TO_CONFIGURE_INTERFACE_MTU_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_DEFAULT_DOMAIN_NAME_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_DEFAULT_DOMAIN_NAME_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_INTERFACE_IS_BUSY_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_INTERFACE_IS_BUSY_TXT_STR}, + {MSG_CONFIGURENETINTERFACE_UNKNOWN_UNICAST_PARAMETER_TXT,(STRPTR)MSG_CONFIGURENETINTERFACE_UNKNOWN_UNICAST_PARAMETER_TXT_STR}, +#endif /* CONFIGURENETINTERFACE_CATALOG_STRINGS */ + +#ifdef DELETENETROUTE_CATALOG_STRINGS + {MSG_DELETENETROUTE_NO_UTILITY_TXT,(STRPTR)MSG_DELETENETROUTE_NO_UTILITY_TXT_STR}, + {MSG_DELETENETROUTE_CANNOT_OPEN_BSDSOCKET_TXT,(STRPTR)MSG_DELETENETROUTE_CANNOT_OPEN_BSDSOCKET_TXT_STR}, + {MSG_DELETENETROUTE_BSDSOCKET_HAS_NO_ROUTE_API_TXT,(STRPTR)MSG_DELETENETROUTE_BSDSOCKET_HAS_NO_ROUTE_API_TXT_STR}, + {MSG_DELETENETROUTE_NEED_EITHER_DESTINATION_OR_DEFAULT_TXT,(STRPTR)MSG_DELETENETROUTE_NEED_EITHER_DESTINATION_OR_DEFAULT_TXT_STR}, + {MSG_DELETENETROUTE_DESTINATION_IGNORED_TXT,(STRPTR)MSG_DELETENETROUTE_DESTINATION_IGNORED_TXT_STR}, + {MSG_DELETENETROUTE_ROUTE_TO_DEFAULT_GATEWAY_NOT_DELETED_TXT,(STRPTR)MSG_DELETENETROUTE_ROUTE_TO_DEFAULT_GATEWAY_NOT_DELETED_TXT_STR}, + {MSG_DELETENETROUTE_ROUTE_NOT_DELETED_TXT,(STRPTR)MSG_DELETENETROUTE_ROUTE_NOT_DELETED_TXT_STR}, + {MSG_DELETENETROUTE_ROUTE_TO_DEFAULT_DELETED_TXT,(STRPTR)MSG_DELETENETROUTE_ROUTE_TO_DEFAULT_DELETED_TXT_STR}, + {MSG_DELETENETROUTE_ROUTE_DELETED_TXT,(STRPTR)MSG_DELETENETROUTE_ROUTE_DELETED_TXT_STR}, +#endif /* DELETENETROUTE_CATALOG_STRINGS */ + +#ifdef GETNETSTATUS_CATALOG_STRINGS + {MSG_GETNETSTATUS_NO_UTILITY_TXT,(STRPTR)MSG_GETNETSTATUS_NO_UTILITY_TXT_STR}, + {MSG_GETNETSTATUS_CANNOT_OPEN_BSDSOCKET_TXT,(STRPTR)MSG_GETNETSTATUS_CANNOT_OPEN_BSDSOCKET_TXT_STR}, + {MSG_GETNETSTATUS_BSDSOCKET_HAS_NO_STATUS_API_TXT,(STRPTR)MSG_GETNETSTATUS_BSDSOCKET_HAS_NO_STATUS_API_TXT_STR}, + {MSG_GETNETSTATUS_UNKNOWN_CONDITION_TXT,(STRPTR)MSG_GETNETSTATUS_UNKNOWN_CONDITION_TXT_STR}, + {MSG_GETNETSTATUS_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT,(STRPTR)MSG_GETNETSTATUS_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT_STR}, + {MSG_GETNETSTATUS_NO_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT,(STRPTR)MSG_GETNETSTATUS_NO_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT_STR}, + {MSG_GETNETSTATUS_POINT_TO_POINT_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT,(STRPTR)MSG_GETNETSTATUS_POINT_TO_POINT_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT_STR}, + {MSG_GETNETSTATUS_NO_POINT_TO_POINT_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT,(STRPTR)MSG_GETNETSTATUS_NO_POINT_TO_POINT_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT_STR}, + {MSG_GETNETSTATUS_BROADCAST_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT,(STRPTR)MSG_GETNETSTATUS_BROADCAST_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT_STR}, + {MSG_GETNETSTATUS_NO_BROADCAST_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT,(STRPTR)MSG_GETNETSTATUS_NO_BROADCAST_INTERFACES_AVAILABLE_AND_CONFIGURED_TXT_STR}, + {MSG_GETNETSTATUS_DNS_CONFIGURED_TXT,(STRPTR)MSG_GETNETSTATUS_DNS_CONFIGURED_TXT_STR}, + {MSG_GETNETSTATUS_NO_DNS_CONFIGURED_TXT,(STRPTR)MSG_GETNETSTATUS_NO_DNS_CONFIGURED_TXT_STR}, + {MSG_GETNETSTATUS_ROUTE_CONFIGURED_TXT,(STRPTR)MSG_GETNETSTATUS_ROUTE_CONFIGURED_TXT_STR}, + {MSG_GETNETSTATUS_NO_ROUTE_CONFIGURED_TXT,(STRPTR)MSG_GETNETSTATUS_NO_ROUTE_CONFIGURED_TXT_STR}, + {MSG_GETNETSTATUS_DEFAULT_ROUTE_CONFIGURED_TXT,(STRPTR)MSG_GETNETSTATUS_DEFAULT_ROUTE_CONFIGURED_TXT_STR}, + {MSG_GETNETSTATUS_NO_DEFAULT_ROUTE_CONFIGURED_TXT,(STRPTR)MSG_GETNETSTATUS_NO_DEFAULT_ROUTE_CONFIGURED_TXT_STR}, +#endif /* GETNETSTATUS_CATALOG_STRINGS */ + +#ifdef SHOWNETSTATUS_CATALOG_STRINGS + {MSG_SHOWNETSTATUS_NO_UTILITY_TXT,(STRPTR)MSG_SHOWNETSTATUS_NO_UTILITY_TXT_STR}, + {MSG_SHOWNETSTATUS_CANNOT_OPEN_BSDSOCKET_TXT,(STRPTR)MSG_SHOWNETSTATUS_CANNOT_OPEN_BSDSOCKET_TXT_STR}, + {MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_STATUS_API_TXT,(STRPTR)MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_STATUS_API_TXT_STR}, + {MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_ROUTE_API_TXT,(STRPTR)MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_ROUTE_API_TXT_STR}, + {MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_INTERFACE_API_TXT,(STRPTR)MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_INTERFACE_API_TXT_STR}, + {MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_DNS_API_TXT,(STRPTR)MSG_SHOWNETSTATUS_BSDSOCKET_HAS_NO_DNS_API_TXT_STR}, + {MSG_SHOWNETSTATUS_CANNOT_GET_INFO_ON_INTERFACE_TXT,(STRPTR)MSG_SHOWNETSTATUS_CANNOT_GET_INFO_ON_INTERFACE_TXT_STR}, + {MSG_SHOWNETSTATUS_CANNOT_GET_INTERFACE_LIST_TXT,(STRPTR)MSG_SHOWNETSTATUS_CANNOT_GET_INTERFACE_LIST_TXT_STR}, + {MSG_SHOWNETSTATUS_CANNOT_GET_DNS_LIST_TXT,(STRPTR)MSG_SHOWNETSTATUS_CANNOT_GET_DNS_LIST_TXT_STR}, + {MSG_SHOWNETSTATUS_CANNOT_GET_ROUTE_TABLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_CANNOT_GET_ROUTE_TABLE_TXT_STR}, + {MSG_SHOWNETSTATUS_NOT_ENOUGH_MEMORY_TO_QUERY_STATUS_TXT,(STRPTR)MSG_SHOWNETSTATUS_NOT_ENOUGH_MEMORY_TO_QUERY_STATUS_TXT_STR}, + {MSG_SHOWNETSTATUS_CANNOT_GET_STATUS_INFORMATION_FOR_TXT,(STRPTR)MSG_SHOWNETSTATUS_CANNOT_GET_STATUS_INFORMATION_FOR_TXT_STR}, + {MSG_SHOWNETSTATUS_DEFAULT_TXT,(STRPTR)MSG_SHOWNETSTATUS_DEFAULT_TXT_STR}, + {MSG_SHOWNETSTATUS_DESTINATION_GATEWAY_ATTRIBUTES_TITLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_DESTINATION_GATEWAY_ATTRIBUTES_TITLE_TXT_STR}, + {MSG_SHOWNETSTATUS_DESTINATION_TXT,(STRPTR)MSG_SHOWNETSTATUS_DESTINATION_TXT_STR}, + {MSG_SHOWNETSTATUS_GATEWAY_TXT,(STRPTR)MSG_SHOWNETSTATUS_GATEWAY_TXT_STR}, + {MSG_SHOWNETSTATUS_ATTRIBUTES_TXT,(STRPTR)MSG_SHOWNETSTATUS_ATTRIBUTES_TXT_STR}, + {MSG_SHOWNETSTATUS_DESTINATION_GATEWAY_LINE_TXT,(STRPTR)MSG_SHOWNETSTATUS_DESTINATION_GATEWAY_LINE_TXT_STR}, + {MSG_SHOWNETSTATUS_UP_TXT,(STRPTR)MSG_SHOWNETSTATUS_UP_TXT_STR}, + {MSG_SHOWNETSTATUS_DOWN_TXT,(STRPTR)MSG_SHOWNETSTATUS_DOWN_TXT_STR}, + {MSG_SHOWNETSTATUS_HOST_TXT,(STRPTR)MSG_SHOWNETSTATUS_HOST_TXT_STR}, + {MSG_SHOWNETSTATUS_NO_ROUTES_ARE_CONFIGURED_TXT,(STRPTR)MSG_SHOWNETSTATUS_NO_ROUTES_ARE_CONFIGURED_TXT_STR}, + {MSG_SHOWNETSTATUS_ADDRESS_TYPE_TITLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_ADDRESS_TYPE_TITLE_TXT_STR}, + {MSG_SHOWNETSTATUS_ADDRESS_TXT,(STRPTR)MSG_SHOWNETSTATUS_ADDRESS_TXT_STR}, + {MSG_SHOWNETSTATUS_TYPE_TXT,(STRPTR)MSG_SHOWNETSTATUS_TYPE_TXT_STR}, + {MSG_SHOWNETSTATUS_ADDRESS_TYPE_LINE_TXT,(STRPTR)MSG_SHOWNETSTATUS_ADDRESS_TYPE_LINE_TXT_STR}, + {MSG_SHOWNETSTATUS_STATIC_TXT,(STRPTR)MSG_SHOWNETSTATUS_STATIC_TXT_STR}, + {MSG_SHOWNETSTATUS_DYNAMIC_TXT,(STRPTR)MSG_SHOWNETSTATUS_DYNAMIC_TXT_STR}, + {MSG_SHOWNETSTATUS_NO_DNS_CONFIGURED_TXT,(STRPTR)MSG_SHOWNETSTATUS_NO_DNS_CONFIGURED_TXT_STR}, + {MSG_SHOWNETSTATUS_UNKNOWN_HARDWARE_TYPE_TXT,(STRPTR)MSG_SHOWNETSTATUS_UNKNOWN_HARDWARE_TYPE_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_TITLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_TITLE_TXT_STR}, + {MSG_SHOWNETSTATUS_NAME_TXT,(STRPTR)MSG_SHOWNETSTATUS_NAME_TXT_STR}, + {MSG_SHOWNETSTATUS_MTU_TXT,(STRPTR)MSG_SHOWNETSTATUS_MTU_TXT_STR}, + {MSG_SHOWNETSTATUS_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_SENT_TXT,(STRPTR)MSG_SHOWNETSTATUS_SENT_TXT_STR}, + {MSG_SHOWNETSTATUS_DROPPED_TXT,(STRPTR)MSG_SHOWNETSTATUS_DROPPED_TXT_STR}, + {MSG_SHOWNETSTATUS_OVERRUNS_TXT,(STRPTR)MSG_SHOWNETSTATUS_OVERRUNS_TXT_STR}, + {MSG_SHOWNETSTATUS_UNKNOWN_TXT,(STRPTR)MSG_SHOWNETSTATUS_UNKNOWN_TXT_STR}, + {MSG_SHOWNETSTATUS_STATUS_TXT,(STRPTR)MSG_SHOWNETSTATUS_STATUS_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_LINE_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_LINE_TXT_STR}, + {MSG_SHOWNETSTATUS_NO_INTERFACES_AVAILABLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_NO_INTERFACES_AVAILABLE_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_TITLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_TITLE_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_DEVICE_NAME_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_DEVICE_NAME_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_DEVICE_UNIT_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_DEVICE_UNIT_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_HARDWARE_ADDRESS_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_HARDWARE_ADDRESS_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_MTU_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_MTU_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_TRANSMISSION_SPEED_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_TRANSMISSION_SPEED_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_HARDWARE_TYPE_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_HARDWARE_TYPE_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_PACKETS_SENT_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_PACKETS_SENT_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_PACKETS_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_PACKETS_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_PACKETS_DROPPED_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_PACKETS_DROPPED_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_BUFFER_OVERRUNS_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_BUFFER_OVERRUNS_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_UNKNOWN_PACKETS_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_UNKNOWN_PACKETS_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_ADDRESS_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_ADDRESS_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_NETWORK_MASK_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_NETWORK_MASK_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_PEER_ADDRESS_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_PEER_ADDRESS_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_STATUS_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_STATUS_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_ADDRESS_BINDING_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_ADDRESS_BINDING_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_LEASE_EXPIRES_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_LEASE_EXPIRES_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_BINDING_STATIC_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_BINDING_STATIC_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_BINDING_DYNAMIC_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_BINDING_DYNAMIC_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_LEASE_NEVER_EXPIRES_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_LEASE_NEVER_EXPIRES_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_TITLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_TITLE_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_ERRORS_GENERATED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_ERRORS_GENERATED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_IP_PACKETS_TOO_SHORT_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_IP_PACKETS_TOO_SHORT_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_PACKETS_NOT_RESPONDED_TO_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_PACKETS_NOT_RESPONDED_TO_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_ECHO_REPLY_PACKETS_SENT_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_ECHO_REPLY_PACKETS_SENT_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_DESTINATION_UNREACHABLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_DESTINATION_UNREACHABLE_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_SOURCE_QUENCH_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_SOURCE_QUENCH_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_REDIRECT_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_REDIRECT_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_ECHO_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_ECHO_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_ROUTER_ADVERTIZEMENT_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_ROUTER_ADVERTIZEMENT_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_ROUTER_SOLICITATION_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_ROUTER_SOLICITATION_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_TIME_EXCEEDED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_TIME_EXCEEDED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_BAD_IP_HEADER_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_BAD_IP_HEADER_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REQUEST_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REQUEST_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REPLY_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REPLY_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_INFORMATION_REQUEST_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_INFORMATION_REQUEST_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_INFORMATION_REPLY_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_INFORMATION_REPLY_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REQUEST_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REQUEST_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REPLY_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REPLY_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_RECEIVED_CODES_OUT_OF_RANGE_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_RECEIVED_CODES_OUT_OF_RANGE_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_RECEIVED_PACKETS_TOO_SHORT_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_RECEIVED_PACKETS_TOO_SHORT_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_RECEIVED_PACKET_CHECKSUM_ERRORS_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_RECEIVED_PACKET_CHECKSUM_ERRORS_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_RECEIVED_CODES_BOUND_MISMATCH_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_RECEIVED_CODES_BOUND_MISMATCH_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_RESPONSES_SENT_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_RESPONSES_SENT_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_ECHO_REPLIES_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_ECHO_REPLIES_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_DESTINATION_UNREACHABLE_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_DESTINATION_UNREACHABLE_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_SOURCE_QUENCH_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_SOURCE_QUENCH_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_REDIRECT_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_REDIRECT_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_ECHO_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_ECHO_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_ROUTER_ADVERTIZEMENT_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_ROUTER_ADVERTIZEMENT_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_ROUTER_SOLICITATION_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_ROUTER_SOLICITATION_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_TIME_EXCEEDED_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_TIME_EXCEEDED_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_BAD_IP_HEADER_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_BAD_IP_HEADER_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REQUEST_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REQUEST_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REPLY_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_TIMESTAMP_REPLY_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_INFORMATION_REQUEST_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_INFORMATION_REQUEST_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_INFORMATION_REPLY_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_INFORMATION_REPLY_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REQUEST_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REQUEST_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REPLY_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ICMP_ADDRESS_MASK_REPLY_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_IGMP_TITLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_IGMP_TITLE_TXT_STR}, + {MSG_SHOWNETSTATUS_IGMP_TOTAL_MESSAGES_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_IGMP_TOTAL_MESSAGES_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_IGMP_MESSAGES_RECEIVED_TOO_SHORT_TXT,(STRPTR)MSG_SHOWNETSTATUS_IGMP_MESSAGES_RECEIVED_TOO_SHORT_TXT_STR}, + {MSG_SHOWNETSTATUS_IGMP_MESSAGES_RECEIVED_BAD_CHECKSUM_TXT,(STRPTR)MSG_SHOWNETSTATUS_IGMP_MESSAGES_RECEIVED_BAD_CHECKSUM_TXT_STR}, + {MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_QUERIES_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_QUERIES_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_IGMP_INVALID_QUERIES_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_IGMP_INVALID_QUERIES_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_REPORTS_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_REPORTS_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_IGMP_INVALID_REPORTS_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_IGMP_INVALID_REPORTS_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_REPORTS_RECEIVED_FOR_THIS_GROUP_TXT,(STRPTR)MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_REPORTS_RECEIVED_FOR_THIS_GROUP_TXT_STR}, + {MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_REPORTS_SENT_TXT,(STRPTR)MSG_SHOWNETSTATUS_IGMP_MEMBERSHIP_REPORTS_SENT_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_TITLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_TITLE_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_TOTAL_PACKETS_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_TOTAL_PACKETS_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_WITH_CHECKSUM_ERRORS_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_WITH_CHECKSUM_ERRORS_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_TOO_SHORT_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_TOO_SHORT_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_TOO_SMALL_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_TOO_SMALL_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_WITH_BAD_DATA_SIZE_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_WITH_BAD_DATA_SIZE_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_WITH_BAD_HEADER_SIZE_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_WITH_BAD_HEADER_SIZE_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_FRAGMENTS_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_FRAGMENTS_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_FRAGMENTS_DROPPED_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_FRAGMENTS_DROPPED_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_FRAGMENTS_TIMED_OUT_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_FRAGMENTS_TIMED_OUT_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_FORWARDED_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_FORWARDED_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_CANNOT_FORWARD_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_CANNOT_FORWARD_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_FORWARDED_ON_SAME_NETWORK_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_FORWARDED_ON_SAME_NETWORK_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_WITH_UNKNOWN_PROTOCOLS_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_WITH_UNKNOWN_PROTOCOLS_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_DATAGRAMS_DELIVERED_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_DATAGRAMS_DELIVERED_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_GENERATED_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_GENERATED_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_LOST_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_LOST_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_REASSEMBLED_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_REASSEMBLED_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_FRAGMENTED_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_FRAGMENTED_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_OUTPUT_FRAGMENTS_CREATED_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_OUTPUT_FRAGMENTS_CREATED_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_CANNOT_FRAGMENT_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_CANNOT_FRAGMENT_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_ERRORS_IN_OPTION_PROCESSING_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_ERRORS_IN_OPTION_PROCESSING_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_NO_ROUTE_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_NO_ROUTE_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_PACKETS_WITH_BAD_IP_VERSION_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_PACKETS_WITH_BAD_IP_VERSION_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_RAW_PACKETS_SENT_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_RAW_PACKETS_SENT_TXT_STR}, + {MSG_SHOWNETSTATUS_MBUF_TITLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_MBUF_TITLE_TXT_STR}, + {MSG_SHOWNETSTATUS_MBUF_BUFFERS_FROM_PAGE_POOL_TXT,(STRPTR)MSG_SHOWNETSTATUS_MBUF_BUFFERS_FROM_PAGE_POOL_TXT_STR}, + {MSG_SHOWNETSTATUS_MBUF_CLUSTERS_FROM_PAGE_POOL_TXT,(STRPTR)MSG_SHOWNETSTATUS_MBUF_CLUSTERS_FROM_PAGE_POOL_TXT_STR}, + {MSG_SHOWNETSTATUS_MBUF_FREE_CLUSTERS_TXT,(STRPTR)MSG_SHOWNETSTATUS_MBUF_FREE_CLUSTERS_TXT_STR}, + {MSG_SHOWNETSTATUS_MBUF_DROPS_TXT,(STRPTR)MSG_SHOWNETSTATUS_MBUF_DROPS_TXT_STR}, + {MSG_SHOWNETSTATUS_MBUF_WAIT_TXT,(STRPTR)MSG_SHOWNETSTATUS_MBUF_WAIT_TXT_STR}, + {MSG_SHOWNETSTATUS_MBUF_DRAIN_TXT,(STRPTR)MSG_SHOWNETSTATUS_MBUF_DRAIN_TXT_STR}, + {MSG_SHOWNETSTATUS_MULTICAST_TITLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_MULTICAST_TITLE_TXT_STR}, + {MSG_SHOWNETSTATUS_MULTICAST_ROUTE_LOOKUPS_TXT,(STRPTR)MSG_SHOWNETSTATUS_MULTICAST_ROUTE_LOOKUPS_TXT_STR}, + {MSG_SHOWNETSTATUS_MULTICAST_ROUTE_CACHE_MISSES_TXT,(STRPTR)MSG_SHOWNETSTATUS_MULTICAST_ROUTE_CACHE_MISSES_TXT_STR}, + {MSG_SHOWNETSTATUS_MULTICAST_GROUP_ADDRESS_LOOKUPS_TXT,(STRPTR)MSG_SHOWNETSTATUS_MULTICAST_GROUP_ADDRESS_LOOKUPS_TXT_STR}, + {MSG_SHOWNETSTATUS_MULTICAST_GROUP_ADDRESS_CACHE_MISSES_TXT,(STRPTR)MSG_SHOWNETSTATUS_MULTICAST_GROUP_ADDRESS_CACHE_MISSES_TXT_STR}, + {MSG_SHOWNETSTATUS_MULTICAST_NO_ROUTE_TXT,(STRPTR)MSG_SHOWNETSTATUS_MULTICAST_NO_ROUTE_TXT_STR}, + {MSG_SHOWNETSTATUS_MULTICAST_BAD_TUNNEL_TXT,(STRPTR)MSG_SHOWNETSTATUS_MULTICAST_BAD_TUNNEL_TXT_STR}, + {MSG_SHOWNETSTATUS_MULTICAST_CANNOT_TUNNEL_TXT,(STRPTR)MSG_SHOWNETSTATUS_MULTICAST_CANNOT_TUNNEL_TXT_STR}, + {MSG_SHOWNETSTATUS_MULTICAST_CANNOT_WRONG_INTERFACE_TXT,(STRPTR)MSG_SHOWNETSTATUS_MULTICAST_CANNOT_WRONG_INTERFACE_TXT_STR}, + {MSG_SHOWNETSTATUS_ROUTING_TITLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_ROUTING_TITLE_TXT_STR}, + {MSG_SHOWNETSTATUS_ROUTING_BAD_REDIRECT_TXT,(STRPTR)MSG_SHOWNETSTATUS_ROUTING_BAD_REDIRECT_TXT_STR}, + {MSG_SHOWNETSTATUS_ROUTING_DYNAMIC_TXT,(STRPTR)MSG_SHOWNETSTATUS_ROUTING_DYNAMIC_TXT_STR}, + {MSG_SHOWNETSTATUS_ROUTING_NEW_GATEWAY_TXT,(STRPTR)MSG_SHOWNETSTATUS_ROUTING_NEW_GATEWAY_TXT_STR}, + {MSG_SHOWNETSTATUS_ROUTING_UNREACH_TXT,(STRPTR)MSG_SHOWNETSTATUS_ROUTING_UNREACH_TXT_STR}, + {MSG_SHOWNETSTATUS_ROUTING_WILDCARD_TXT,(STRPTR)MSG_SHOWNETSTATUS_ROUTING_WILDCARD_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_TITLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_TITLE_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_CONNATTEMPT_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_CONNATTEMPT_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_ACCEPTS_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_ACCEPTS_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_CONNECTS_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_CONNECTS_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_DROPS_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_DROPS_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_CONNDROPS_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_CONNDROPS_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_CLOSED_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_CLOSED_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_SEGSTIMED_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_SEGSTIMED_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RTTUPDATED_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RTTUPDATED_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_DELACK_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_DELACK_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_TIMEOUTDROP_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_TIMEOUTDROP_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_PERSISTTIMEO_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_PERSISTTIMEO_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_KEEPTIMEO_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_KEEPTIMEO_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_KEEPPROBE_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_KEEPPROBE_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_KEEPDROPS_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_KEEPDROPS_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_SNDTOTAL_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_SNDTOTAL_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_SNDPACK_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_SNDPACK_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_SNDBYTE_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_SNDBYTE_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_SNDREXMITPACK_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_SNDREXMITPACK_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_SNDREXMITBYTE_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_SNDREXMITBYTE_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_SNDACKS_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_SNDACKS_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_SNDPROBE_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_SNDPROBE_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_SNDURG_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_SNDURG_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_SNDWINUP_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_SNDWINUP_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_SNDCTRL_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_SNDCTRL_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVTOTAL_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVTOTAL_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVPACK_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVPACK_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVBYTE_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVBYTE_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVBADSUM_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVBADSUM_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVBADOFF_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVBADOFF_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVSHORT_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVSHORT_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVDUPPACK_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVDUPPACK_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVDUPBYTE_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVDUPBYTE_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVOOPACK_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVOOPACK_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVOOBYTE_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVOOBYTE_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVPACKAFTERWIN_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVPACKAFTERWIN_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVBYTEAFTERWIN_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVBYTEAFTERWIN_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVAFTERCLOSE_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVAFTERCLOSE_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVWINPROBE_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVWINPROBE_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVDUPACK_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVDUPACK_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVACKTOOMUCH_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVACKTOOMUCH_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVACKPACK_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVACKPACK_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVACKBYTE_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVACKBYTE_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_RCVWINUPD_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_RCVWINUPD_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_PAWSDROP_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_PAWSDROP_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_PREDACK_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_PREDACK_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_PREDDAT_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_PREDDAT_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_PERSISTDROP_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_PERSISTDROP_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_BADSYN_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_BADSYN_TXT_STR}, + {MSG_SHOWNETSTATUS_UDP_TITLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_UDP_TITLE_TXT_STR}, + {MSG_SHOWNETSTATUS_UDP_IPACKETS_TXT,(STRPTR)MSG_SHOWNETSTATUS_UDP_IPACKETS_TXT_STR}, + {MSG_SHOWNETSTATUS_UDP_HDROPS_TXT,(STRPTR)MSG_SHOWNETSTATUS_UDP_HDROPS_TXT_STR}, + {MSG_SHOWNETSTATUS_UDP_BADSUM_TXT,(STRPTR)MSG_SHOWNETSTATUS_UDP_BADSUM_TXT_STR}, + {MSG_SHOWNETSTATUS_UDP_BADLEN_TXT,(STRPTR)MSG_SHOWNETSTATUS_UDP_BADLEN_TXT_STR}, + {MSG_SHOWNETSTATUS_UDP_NOPORT_TXT,(STRPTR)MSG_SHOWNETSTATUS_UDP_NOPORT_TXT_STR}, + {MSG_SHOWNETSTATUS_UDP_NOPORTBCAST_TXT,(STRPTR)MSG_SHOWNETSTATUS_UDP_NOPORTBCAST_TXT_STR}, + {MSG_SHOWNETSTATUS_UDP_FULLSOCK_TXT,(STRPTR)MSG_SHOWNETSTATUS_UDP_FULLSOCK_TXT_STR}, + {MSG_SHOWNETSTATUS_UDP_OPACKETS_TXT,(STRPTR)MSG_SHOWNETSTATUS_UDP_OPACKETS_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_SOCKET_TITLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_SOCKET_TITLE_TXT_STR}, + {MSG_SHOWNETSTATUS_LOCAL_TXT,(STRPTR)MSG_SHOWNETSTATUS_LOCAL_TXT_STR}, + {MSG_SHOWNETSTATUS_REMOTE_TXT,(STRPTR)MSG_SHOWNETSTATUS_REMOTE_TXT_STR}, + {MSG_SHOWNETSTATUS_RECEIVE_LEN_TXT,(STRPTR)MSG_SHOWNETSTATUS_RECEIVE_LEN_TXT_STR}, + {MSG_SHOWNETSTATUS_SEND_LEN_TXT,(STRPTR)MSG_SHOWNETSTATUS_SEND_LEN_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_SOCKET_LINE_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_SOCKET_LINE_TXT_STR}, + {MSG_SHOWNETSTATUS_NO_TCP_SOCKETS_IN_USE_TXT,(STRPTR)MSG_SHOWNETSTATUS_NO_TCP_SOCKETS_IN_USE_TXT_STR}, + {MSG_SHOWNETSTATUS_UDP_SOCKET_TITLE_TXT,(STRPTR)MSG_SHOWNETSTATUS_UDP_SOCKET_TITLE_TXT_STR}, + {MSG_SHOWNETSTATUS_UDP_SOCKET_LINE_TXT,(STRPTR)MSG_SHOWNETSTATUS_UDP_SOCKET_LINE_TXT_STR}, + {MSG_SHOWNETSTATUS_NO_UDP_SOCKETS_IN_USE_TXT,(STRPTR)MSG_SHOWNETSTATUS_NO_UDP_SOCKETS_IN_USE_TXT_STR}, + {MSG_SHOWNETSTATUS_STATUS_NAME1_TXT,(STRPTR)MSG_SHOWNETSTATUS_STATUS_NAME1_TXT_STR}, + {MSG_SHOWNETSTATUS_STATUS_NAME2_TXT,(STRPTR)MSG_SHOWNETSTATUS_STATUS_NAME2_TXT_STR}, + {MSG_SHOWNETSTATUS_STATUS_NAME3_TXT,(STRPTR)MSG_SHOWNETSTATUS_STATUS_NAME3_TXT_STR}, + {MSG_SHOWNETSTATUS_STATUS_NAME4_TXT,(STRPTR)MSG_SHOWNETSTATUS_STATUS_NAME4_TXT_STR}, + {MSG_SHOWNETSTATUS_STATUS_NAME5_TXT,(STRPTR)MSG_SHOWNETSTATUS_STATUS_NAME5_TXT_STR}, + {MSG_SHOWNETSTATUS_STATUS_NAME6_TXT,(STRPTR)MSG_SHOWNETSTATUS_STATUS_NAME6_TXT_STR}, + {MSG_SHOWNETSTATUS_STATUS_NAME7_TXT,(STRPTR)MSG_SHOWNETSTATUS_STATUS_NAME7_TXT_STR}, + {MSG_SHOWNETSTATUS_STATUS_NAME8_TXT,(STRPTR)MSG_SHOWNETSTATUS_STATUS_NAME8_TXT_STR}, + {MSG_SHOWNETSTATUS_STATUS_NAME9_TXT,(STRPTR)MSG_SHOWNETSTATUS_STATUS_NAME9_TXT_STR}, + {MSG_SHOWNETSTATUS_STATUS_NAME10_TXT,(STRPTR)MSG_SHOWNETSTATUS_STATUS_NAME10_TXT_STR}, + {MSG_SHOWNETSTATUS_NOT_CONFIGURED_TXT,(STRPTR)MSG_SHOWNETSTATUS_NOT_CONFIGURED_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_FSM_STATE1_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_FSM_STATE1_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_FSM_STATE2_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_FSM_STATE2_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_FSM_STATE3_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_FSM_STATE3_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_FSM_STATE4_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_FSM_STATE4_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_FSM_STATE5_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_FSM_STATE5_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_FSM_STATE6_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_FSM_STATE6_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_FSM_STATE7_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_FSM_STATE7_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_FSM_STATE8_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_FSM_STATE8_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_FSM_STATE9_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_FSM_STATE9_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_FSM_STATE10_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_FSM_STATE10_TXT_STR}, + {MSG_SHOWNETSTATUS_TCP_FSM_STATE11_TXT,(STRPTR)MSG_SHOWNETSTATUS_TCP_FSM_STATE11_TXT_STR}, + {MSG_SHOWNETSTATUS_WILDCARD_TXT,(STRPTR)MSG_SHOWNETSTATUS_WILDCARD_TXT_STR}, + {MSG_SHOWNETSTATUS_SOME_TCP_SOCKETS_IN_USE_TXT,(STRPTR)MSG_SHOWNETSTATUS_SOME_TCP_SOCKETS_IN_USE_TXT_STR}, + {MSG_SHOWNETSTATUS_SOME_UDP_SOCKETS_IN_USE_TXT,(STRPTR)MSG_SHOWNETSTATUS_SOME_UDP_SOCKETS_IN_USE_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_READ_REQUESTS_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_READ_REQUESTS_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_WRITE_REQUESTS_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_WRITE_REQUESTS_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_BYTES_RECEIVED_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_BYTES_RECEIVED_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_BYTES_SENT_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_NUM_BYTES_SENT_TXT_STR}, + {MSG_SHOWNETSTATUS_UNKNOWN_HOST_TXT,(STRPTR)MSG_SHOWNETSTATUS_UNKNOWN_HOST_TXT_STR}, + {MSG_SHOWNETSTATUS_IP_ADDRESS_TXT,(STRPTR)MSG_SHOWNETSTATUS_IP_ADDRESS_TXT_STR}, + {MSG_SHOWNETSTATUS_HARDWARE_ADDRESS_TXT,(STRPTR)MSG_SHOWNETSTATUS_HARDWARE_ADDRESS_TXT_STR}, + {MSG_SHOWNETSTATUS_INCOMPLETE_HARDWARE_ADDRESS_TXT,(STRPTR)MSG_SHOWNETSTATUS_INCOMPLETE_HARDWARE_ADDRESS_TXT_STR}, + {MSG_SHOWNETSTATUS_ARP_ENTRY_PERMANENT_TXT,(STRPTR)MSG_SHOWNETSTATUS_ARP_ENTRY_PERMANENT_TXT_STR}, + {MSG_SHOWNETSTATUS_ARP_ENTRY_PUBLISHED_PROXY_TXT,(STRPTR)MSG_SHOWNETSTATUS_ARP_ENTRY_PUBLISHED_PROXY_TXT_STR}, + {MSG_SHOWNETSTATUS_ARP_ENTRY_PUBLISHED_TXT,(STRPTR)MSG_SHOWNETSTATUS_ARP_ENTRY_PUBLISHED_TXT_STR}, + {MSG_SHOWNETSTATUS_ARP_CACHE_EMPTY_TXT,(STRPTR)MSG_SHOWNETSTATUS_ARP_CACHE_EMPTY_TXT_STR}, + {MSG_SHOWNETSTATUS_ARP_HEADER_TXT,(STRPTR)MSG_SHOWNETSTATUS_ARP_HEADER_TXT_STR}, + {MSG_SHOWNETSTATUS_NO_ARP_INFORMATION_TXT,(STRPTR)MSG_SHOWNETSTATUS_NO_ARP_INFORMATION_TXT_STR}, + {MSG_SHOWNETSTATUS_INTERFACE_INFO_TRANSFER_STATISTICS_TXT,(STRPTR)MSG_SHOWNETSTATUS_INTERFACE_INFO_TRANSFER_STATISTICS_TXT_STR}, + {MSG_SHOWNETSTATUS_STATUS_SUMMARY_TXT,(STRPTR)MSG_SHOWNETSTATUS_STATUS_SUMMARY_TXT_STR}, + {MSG_SHOWNETSTATUS_LOCAL_HOST_ADDRESS_TXT,(STRPTR)MSG_SHOWNETSTATUS_LOCAL_HOST_ADDRESS_TXT_STR}, + {MSG_SHOWNETSTATUS_LOCAL_HOST_ADDRESS_ON_INTERFACE_TXT,(STRPTR)MSG_SHOWNETSTATUS_LOCAL_HOST_ADDRESS_ON_INTERFACE_TXT_STR}, + {MSG_SHOWNETSTATUS_DEFAULT_GATEWAY_ADDRESS_TXT,(STRPTR)MSG_SHOWNETSTATUS_DEFAULT_GATEWAY_ADDRESS_TXT_STR}, + {MSG_SHOWNETSTATUS_DOMAIN_NAME_SYSTEM_SERVERS_TXT,(STRPTR)MSG_SHOWNETSTATUS_DOMAIN_NAME_SYSTEM_SERVERS_TXT_STR}, + {MSG_SHOWNETSTATUS_DEFAULT_DOMAIN_NAME_TXT,(STRPTR)MSG_SHOWNETSTATUS_DEFAULT_DOMAIN_NAME_TXT_STR}, + {MSG_SHOWNETSTATUS_DEFAULT_DOMAIN_NAME_UNSET_TXT,(STRPTR)MSG_SHOWNETSTATUS_DEFAULT_DOMAIN_NAME_UNSET_TXT_STR}, +#endif /* SHOWNETSTATUS_CATALOG_STRINGS */ + +#ifdef LOGVIEWER_CATALOG_STRINGS + {MSG_LOGVIEWER_PROJECT_MENU,(STRPTR)MSG_LOGVIEWER_PROJECT_MENU_STR}, + {MSG_LOGVIEWER_PROJECT_CLEAR_MENU,(STRPTR)MSG_LOGVIEWER_PROJECT_CLEAR_MENU_STR}, + {MSG_LOGVIEWER_PROJECT_SAVE_AS_MENU,(STRPTR)MSG_LOGVIEWER_PROJECT_SAVE_AS_MENU_STR}, + {MSG_LOGVIEWER_PROJECT_HIDE_MENU,(STRPTR)MSG_LOGVIEWER_PROJECT_HIDE_MENU_STR}, + {MSG_LOGVIEWER_PROJECT_QUIT_MENU,(STRPTR)MSG_LOGVIEWER_PROJECT_QUIT_MENU_STR}, + {MSG_LOGVIEWER_LOG_LEVEL_0_TXT,(STRPTR)MSG_LOGVIEWER_LOG_LEVEL_0_TXT_STR}, + {MSG_LOGVIEWER_LOG_LEVEL_1_TXT,(STRPTR)MSG_LOGVIEWER_LOG_LEVEL_1_TXT_STR}, + {MSG_LOGVIEWER_LOG_LEVEL_2_TXT,(STRPTR)MSG_LOGVIEWER_LOG_LEVEL_2_TXT_STR}, + {MSG_LOGVIEWER_LOG_LEVEL_3_TXT,(STRPTR)MSG_LOGVIEWER_LOG_LEVEL_3_TXT_STR}, + {MSG_LOGVIEWER_LOG_LEVEL_4_TXT,(STRPTR)MSG_LOGVIEWER_LOG_LEVEL_4_TXT_STR}, + {MSG_LOGVIEWER_LOG_LEVEL_5_TXT,(STRPTR)MSG_LOGVIEWER_LOG_LEVEL_5_TXT_STR}, + {MSG_LOGVIEWER_LOG_LEVEL_6_TXT,(STRPTR)MSG_LOGVIEWER_LOG_LEVEL_6_TXT_STR}, + {MSG_LOGVIEWER_LOG_LEVEL_7_TXT,(STRPTR)MSG_LOGVIEWER_LOG_LEVEL_7_TXT_STR}, + {MSG_LOGVIEWER_LABEL_0_TXT,(STRPTR)MSG_LOGVIEWER_LABEL_0_TXT_STR}, + {MSG_LOGVIEWER_LABEL_1_TXT,(STRPTR)MSG_LOGVIEWER_LABEL_1_TXT_STR}, + {MSG_LOGVIEWER_LABEL_2_TXT,(STRPTR)MSG_LOGVIEWER_LABEL_2_TXT_STR}, + {MSG_LOGVIEWER_LABEL_3_TXT,(STRPTR)MSG_LOGVIEWER_LABEL_3_TXT_STR}, + {MSG_LOGVIEWER_OK_TXT,(STRPTR)MSG_LOGVIEWER_OK_TXT_STR}, + {MSG_LOGVIEWER_REALLY_CLEAR_MESSAGE_LIST_TXT,(STRPTR)MSG_LOGVIEWER_REALLY_CLEAR_MESSAGE_LIST_TXT_STR}, + {MSG_LOGVIEWER_YES_NO_TXT,(STRPTR)MSG_LOGVIEWER_YES_NO_TXT_STR}, + {MSG_LOGVIEWER_OVERWRITE_APPEND_NEWNAME_CANCEL_TXT,(STRPTR)MSG_LOGVIEWER_OVERWRITE_APPEND_NEWNAME_CANCEL_TXT_STR}, + {MSG_LOGVIEWER_FILE_REQUESTER_TITLE_TXT,(STRPTR)MSG_LOGVIEWER_FILE_REQUESTER_TITLE_TXT_STR}, + {MSG_LOGVIEWER_FILE_REQUESTER_SAVE_TXT,(STRPTR)MSG_LOGVIEWER_FILE_REQUESTER_SAVE_TXT_STR}, + {MSG_LOGVIEWER_COMMODITIES_TITLE_TXT,(STRPTR)MSG_LOGVIEWER_COMMODITIES_TITLE_TXT_STR}, + {MSG_LOGVIEWER_COMMODITIES_DESCRIPTION_TXT,(STRPTR)MSG_LOGVIEWER_COMMODITIES_DESCRIPTION_TXT_STR}, + {MSG_LOGVIEWER_ORIGIN_UNKNOWN_TXT,(STRPTR)MSG_LOGVIEWER_ORIGIN_UNKNOWN_TXT_STR}, + {MSG_LOGVIEWER_FILE_ALREADY_EXISTS_TXT,(STRPTR)MSG_LOGVIEWER_FILE_ALREADY_EXISTS_TXT_STR}, + {MSG_LOGVIEWER_FILE_COULD_NOT_BE_OPENED_TXT,(STRPTR)MSG_LOGVIEWER_FILE_COULD_NOT_BE_OPENED_TXT_STR}, + {MSG_LOGVIEWER_ERROR_WRITING_TO_FILE_TXT,(STRPTR)MSG_LOGVIEWER_ERROR_WRITING_TO_FILE_TXT_STR}, + {MSG_LOGVIEWER_NO_DEFAULT_PUB_SCREEN_TXT,(STRPTR)MSG_LOGVIEWER_NO_DEFAULT_PUB_SCREEN_TXT_STR}, + {MSG_LOGVIEWER_NO_PUBLIC_SCREEN_FONT_TXT,(STRPTR)MSG_LOGVIEWER_NO_PUBLIC_SCREEN_FONT_TXT_STR}, + {MSG_LOGVIEWER_NO_VISUAL_INFO_TXT,(STRPTR)MSG_LOGVIEWER_NO_VISUAL_INFO_TXT_STR}, + {MSG_LOGVIEWER_NO_MENU_TXT,(STRPTR)MSG_LOGVIEWER_NO_MENU_TXT_STR}, + {MSG_LOGVIEWER_NO_MENU_LAYOUT_TXT,(STRPTR)MSG_LOGVIEWER_NO_MENU_LAYOUT_TXT_STR}, + {MSG_LOGVIEWER_NO_SCREEN_DRAW_INFO_TXT,(STRPTR)MSG_LOGVIEWER_NO_SCREEN_DRAW_INFO_TXT_STR}, + {MSG_LOGVIEWER_NO_SIZING_IMAGE_TXT,(STRPTR)MSG_LOGVIEWER_NO_SIZING_IMAGE_TXT_STR}, + {MSG_LOGVIEWER_NO_VERTICAL_SCROLLER_TXT,(STRPTR)MSG_LOGVIEWER_NO_VERTICAL_SCROLLER_TXT_STR}, + {MSG_LOGVIEWER_NO_HORIZONTAL_SCROLLER_TXT,(STRPTR)MSG_LOGVIEWER_NO_HORIZONTAL_SCROLLER_TXT_STR}, + {MSG_LOGVIEWER_NO_WINDOW_TXT,(STRPTR)MSG_LOGVIEWER_NO_WINDOW_TXT_STR}, + {MSG_LOGVIEWER_NO_USER_CLIP_REGION_TXT,(STRPTR)MSG_LOGVIEWER_NO_USER_CLIP_REGION_TXT_STR}, + {MSG_LOGVIEWER_NO_LIBRARY_VERSION_TXT,(STRPTR)MSG_LOGVIEWER_NO_LIBRARY_VERSION_TXT_STR}, + {MSG_LOGVIEWER_NO_LIBRARY_TXT,(STRPTR)MSG_LOGVIEWER_NO_LIBRARY_TXT_STR}, + {MSG_LOGVIEWER_NO_MEMORY_POOL_TXT,(STRPTR)MSG_LOGVIEWER_NO_MEMORY_POOL_TXT_STR}, + {MSG_LOGVIEWER_NO_SCROLLER_CLASS_TXT,(STRPTR)MSG_LOGVIEWER_NO_SCROLLER_CLASS_TXT_STR}, + {MSG_LOGVIEWER_NO_FILE_REQUESTER_TXT,(STRPTR)MSG_LOGVIEWER_NO_FILE_REQUESTER_TXT_STR}, + {MSG_LOGVIEWER_NO_COMMODITIES_PORT_TXT,(STRPTR)MSG_LOGVIEWER_NO_COMMODITIES_PORT_TXT_STR}, + {MSG_LOGVIEWER_NO_COMMODITIES_BROKER_TXT,(STRPTR)MSG_LOGVIEWER_NO_COMMODITIES_BROKER_TXT_STR}, + {MSG_LOGVIEWER_NO_COMMODITIES_HOTKEY_TXT,(STRPTR)MSG_LOGVIEWER_NO_COMMODITIES_HOTKEY_TXT_STR}, + {MSG_LOGVIEWER_NO_COMMODITIES_SYSTEM_TXT,(STRPTR)MSG_LOGVIEWER_NO_COMMODITIES_SYSTEM_TXT_STR}, + {MSG_LOGVIEWER_NO_HOOK_PORT_TXT,(STRPTR)MSG_LOGVIEWER_NO_HOOK_PORT_TXT_STR}, + {MSG_LOGVIEWER_NO_LOG_HOOK_TXT,(STRPTR)MSG_LOGVIEWER_NO_LOG_HOOK_TXT_STR}, +#endif /* LOGVIEWER_CATALOG_STRINGS */ + +#ifdef NETSHUTDOWN_CATALOG_STRINGS + {MSG_NETSHUTDOWN_NO_UTILITY_TXT,(STRPTR)MSG_NETSHUTDOWN_NO_UTILITY_TXT_STR}, + {MSG_NETSHUTDOWN_NO_MEMORY_TXT,(STRPTR)MSG_NETSHUTDOWN_NO_MEMORY_TXT_STR}, + {MSG_NETSHUTDOWN_NO_MSGPORT_TXT,(STRPTR)MSG_NETSHUTDOWN_NO_MSGPORT_TXT_STR}, + {MSG_NETSHUTDOWN_NO_TIMER_REQUEST_TXT,(STRPTR)MSG_NETSHUTDOWN_NO_TIMER_REQUEST_TXT_STR}, + {MSG_NETSHUTDOWN_NO_TIMER_DEVICE_TXT,(STRPTR)MSG_NETSHUTDOWN_NO_TIMER_DEVICE_TXT_STR}, + {MSG_NETSHUTDOWN_TRYING_TO_SHUT_DOWN_TXT,(STRPTR)MSG_NETSHUTDOWN_TRYING_TO_SHUT_DOWN_TXT_STR}, + {MSG_NETSHUTDOWN_SHUTDOWN_FAILED_TXT,(STRPTR)MSG_NETSHUTDOWN_SHUTDOWN_FAILED_TXT_STR}, + {MSG_NETSHUTDOWN_SHUTDOWN_DONE_TXT,(STRPTR)MSG_NETSHUTDOWN_SHUTDOWN_DONE_TXT_STR}, + {MSG_NETSHUTDOWN_SHUTDOWN_ABORTED_TXT,(STRPTR)MSG_NETSHUTDOWN_SHUTDOWN_ABORTED_TXT_STR}, + {MSG_NETSHUTDOWN_SHUTDOWN_TIMEOUT_TXT,(STRPTR)MSG_NETSHUTDOWN_SHUTDOWN_TIMEOUT_TXT_STR}, + {MSG_NETSHUTDOWN_NETWORK_NOT_IN_USE_TXT,(STRPTR)MSG_NETSHUTDOWN_NETWORK_NOT_IN_USE_TXT_STR}, +#endif /* NETSHUTDOWN_CATALOG_STRINGS */ + +#ifdef ROADSHOWCONTROL_CATALOG_STRINGS + {MSG_ROADSHOWCONTROL_NO_UTILITY_TXT,(STRPTR)MSG_ROADSHOWCONTROL_NO_UTILITY_TXT_STR}, + {MSG_ROADSHOWCONTROL_CANNOT_OPEN_BSDSOCKET_TXT,(STRPTR)MSG_ROADSHOWCONTROL_CANNOT_OPEN_BSDSOCKET_TXT_STR}, + {MSG_ROADSHOWCONTROL_BSDSOCKET_HAS_NO_ROADSHOWDATA_API_TXT,(STRPTR)MSG_ROADSHOWCONTROL_BSDSOCKET_HAS_NO_ROADSHOWDATA_API_TXT_STR}, + {MSG_ROADSHOWCONTROL_NO_ROADSHOW_DATA_TXT,(STRPTR)MSG_ROADSHOWCONTROL_NO_ROADSHOW_DATA_TXT_STR}, + {MSG_ROADSHOWCONTROL_COULD_NOT_SET_OPTION_TXT,(STRPTR)MSG_ROADSHOWCONTROL_COULD_NOT_SET_OPTION_TXT_STR}, + {MSG_ROADSHOWCONTROL_COULD_NOT_SET_ENV_VARIABLE_TXT,(STRPTR)MSG_ROADSHOWCONTROL_COULD_NOT_SET_ENV_VARIABLE_TXT_STR}, +#endif /* ROADSHOWCONTROL_CATALOG_STRINGS */ + +#ifdef REMOVENETINTERFACE_CATALOG_STRINGS + {MSG_REMOVENETINTERFACE_CANNOT_OPEN_BSDSOCKET_TXT,(STRPTR)MSG_REMOVENETINTERFACE_CANNOT_OPEN_BSDSOCKET_TXT_STR}, + {MSG_REMOVENETINTERFACE_INTERFACE_REMOVED_TXT,(STRPTR)MSG_REMOVENETINTERFACE_INTERFACE_REMOVED_TXT_STR}, + {MSG_REMOVENETINTERFACE_COULD_NOT_REMOVE_INTERFACE_TXT,(STRPTR)MSG_REMOVENETINTERFACE_COULD_NOT_REMOVE_INTERFACE_TXT_STR}, +#endif /* REMOVENETINTERFACE_CATALOG_STRINGS */ +}; + +#endif /* CATCOMP_ARRAY */ + + +/****************************************************************************/ + + + +#endif /* ROADSHOW_H */ diff --git a/interfaces/bsdsocket.xml b/interfaces/bsdsocket.xml new file mode 100644 index 0000000..2b1cc8a --- /dev/null +++ b/interfaces/bsdsocket.xml @@ -0,0 +1,525 @@ + + + + exec/lists.h + devices/timer.h + utility/tagitem.h + utility/hooks.h + netinet/in.h + sys/socket.h + sys/mbuf.h + net/route.h + netdb.h + libraries/bsdsocket.h + dos/dosextens.h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/interfaces/usergroup.xml b/interfaces/usergroup.xml new file mode 100644 index 0000000..d7babb5 --- /dev/null +++ b/interfaces/usergroup.xml @@ -0,0 +1,127 @@ + + + + libraries/usergroup.h + pwd.h + grp.h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/netinclude.readme b/netinclude.readme new file mode 100644 index 0000000..7c1b998 --- /dev/null +++ b/netinclude.readme @@ -0,0 +1,13 @@ +Traditionally, the networking header files are completely separate from the +operating system header files. This is because AmiTCP shipped an SDK which +mimicked the layout of the SAS/C runtime library header files, and even +had special support libraries which made porting Unix code to AmiTCP easier. +If you copied the bunch on top of your existing header files, you actually +damaged your standard 'C' compiler installation, and it would no longer work +with AmiTCP either. Some of the files in the AmiTCP SDK replaced those in the +'C' compiler installation, and some of them actually required that the +original 'C' compiler installation would remain untouched. + +Keep the "netinclude" directory separate. To access the header files, add +"-Inetinclude" (for GCC) or "idir=netinclude" (for SAS/C) to the compiler +command line. diff --git a/netinclude/arpa/ftp.h b/netinclude/arpa/ftp.h new file mode 100755 index 0000000..bbe8b85 --- /dev/null +++ b/netinclude/arpa/ftp.h @@ -0,0 +1,113 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1983, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ftp.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _ARPA_FTP_H +#define _ARPA_FTP_H + +/****************************************************************************/ + +/* Definitions for FTP; see RFC-765. */ + +/* + * Reply codes. + */ +#define PRELIM 1 /* positive preliminary */ +#define COMPLETE 2 /* positive completion */ +#define CONTINUE 3 /* positive intermediate */ +#define TRANSIENT 4 /* transient negative completion */ +#ifndef _ARPA_TFTP_H +#define ERROR 5 /* permanent negative completion */ +#endif /* _ARPA_TFTP_H */ + +/* + * Type codes + */ +#define TYPE_A 1 /* ASCII */ +#define TYPE_E 2 /* EBCDIC */ +#define TYPE_I 3 /* image */ +#define TYPE_L 4 /* local byte size */ + +/* + * Form codes + */ +#define FORM_N 1 /* non-print */ +#define FORM_T 2 /* telnet format effectors */ +#define FORM_C 3 /* carriage control (ASA) */ + +/* + * Structure codes + */ +#define STRU_F 1 /* file (no record structure) */ +#define STRU_R 2 /* record structure */ +#define STRU_P 3 /* page structure */ + +/* + * Mode types + */ +#define MODE_S 1 /* stream */ +#define MODE_B 2 /* block */ +#define MODE_C 3 /* compressed */ + +/* + * Record Tokens + */ +#define REC_ESC '\377' /* Record-mode Escape */ +#define REC_EOR '\001' /* Record-mode End-of-Record */ +#define REC_EOF '\002' /* Record-mode End-of-File */ + +/* + * Block Header + */ +#define BLK_EOR 0x80 /* Block is End-of-Record */ +#define BLK_EOF 0x40 /* Block is End-of-File */ +#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ +#define BLK_RESTART 0x10 /* Block is Restart Marker */ + +#define BLK_BYTECOUNT 2 /* Bytes in this block */ + +/****************************************************************************/ + +#endif /* _ARPA_FTP_H */ diff --git a/netinclude/arpa/inet.h b/netinclude/arpa/inet.h new file mode 100755 index 0000000..5b418eb --- /dev/null +++ b/netinclude/arpa/inet.h @@ -0,0 +1,49 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)inet.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _ARPA_INET_H +#define _ARPA_INET_H +#endif /* _ARPA_INET_H */ diff --git a/netinclude/arpa/nameser.h b/netinclude/arpa/nameser.h new file mode 100755 index 0000000..ec7199d --- /dev/null +++ b/netinclude/arpa/nameser.h @@ -0,0 +1,175 @@ +/* + * $Id$ + * + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1983, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)nameser.h 8.2 (Berkeley) 2/16/94 + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +#ifndef _ARPA_NAMESER_H +#define _ARPA_NAMESER_H + +/****************************************************************************/ + +/* + * Define constants based on rfc883 + */ +#define PACKETSZ 512 /* maximum packet size */ +#define MAXDNAME 256 /* maximum domain name */ +#define MAXCDNAME 255 /* maximum compressed domain name */ +#define MAXLABEL 63 /* maximum length of domain label */ + /* Number of bytes of fixed size data in query structure */ +#define QFIXEDSZ 4 + /* number of bytes of fixed size data in resource record */ +#define RRFIXEDSZ 10 + +/* + * Internet nameserver port number + */ +#define NAMESERVER_PORT 53 + +/* + * Currently defined opcodes + */ +#define QUERY 0x0 /* standard query */ +#define IQUERY 0x1 /* inverse query */ +#define STATUS 0x2 /* nameserver status query */ +/*#define xxx 0x3*/ /* 0x3 reserved */ + /* non standard - supports ALLOW_UPDATES stuff from Mike Schwartz */ +#define UPDATEA 0x9 /* add resource record */ +#define UPDATED 0xa /* delete a specific resource record */ +#define UPDATEDA 0xb /* delete all named resource record */ +#define UPDATEM 0xc /* modify a specific resource record */ +#define UPDATEMA 0xd /* modify all named resource record */ + +#define ZONEINIT 0xe /* initial zone transfer */ +#define ZONEREF 0xf /* incremental zone referesh */ + +/* + * Currently defined response codes + */ +#define NOERROR 0 /* no error */ +#define FORMERR 1 /* format error */ +#define SERVFAIL 2 /* server failure */ +#define NXDOMAIN 3 /* non existent domain */ +#define NOTIMP 4 /* not implemented */ +#define REFUSED 5 /* query refused */ + /* non standard */ +#define NOCHANGE 0xf /* update failed to change db */ + +/* + * Type values for resources and queries + */ +#define T_A 1 /* host address */ +#define T_NS 2 /* authoritative server */ +#define T_MD 3 /* mail destination */ +#define T_MF 4 /* mail forwarder */ +#define T_CNAME 5 /* connonical name */ +#define T_SOA 6 /* start of authority zone */ +#define T_MB 7 /* mailbox domain name */ +#define T_MG 8 /* mail group member */ +#define T_MR 9 /* mail rename name */ +#define T_NULL 10 /* null resource record */ +#define T_WKS 11 /* well known service */ +#define T_PTR 12 /* domain name pointer */ +#define T_HINFO 13 /* host information */ +#define T_MINFO 14 /* mailbox information */ +#define T_MX 15 /* mail routing information */ +#define T_TXT 16 /* text strings */ +#define T_RP 17 /* responsible person */ +#define T_AFSDB 18 /* AFS cell database */ +#define T_NSAP 22 /* NSAP address */ +#define T_NSAP_PTR 23 /* reverse lookup for NSAP */ + /* non standard */ +#define T_UINFO 100 /* user (finger) information */ +#define T_UID 101 /* user ID */ +#define T_GID 102 /* group ID */ +#define T_UNSPEC 103 /* Unspecified format (binary data) */ + /* Query type values which do not appear in resource records */ +#define T_AXFR 252 /* transfer zone of authority */ +#define T_MAILB 253 /* transfer mailbox records */ +#define T_MAILA 254 /* transfer mail agent records */ +#define T_ANY 255 /* wildcard match */ + +/* + * Values for class field + */ + +#define C_IN 1 /* the arpa internet */ +#define C_CHAOS 3 /* for chaos net (MIT) */ +#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */ + /* Query class values which do not appear in resource records */ +#define C_ANY 255 /* wildcard match */ + +/* + * Status return codes for T_UNSPEC conversion routines + */ +#define CONV_SUCCESS 0 +#define CONV_OVERFLOW -1 +#define CONV_BADFMT -2 +#define CONV_BADCKSUM -3 +#define CONV_BADBUFLEN -4 + +/****************************************************************************/ + +#endif /* _ARPA_NAMESER_H */ diff --git a/netinclude/arpa/telnet.h b/netinclude/arpa/telnet.h new file mode 100755 index 0000000..fdc9991 --- /dev/null +++ b/netinclude/arpa/telnet.h @@ -0,0 +1,335 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)telnet.h 8.2 (Berkeley) 12/15/93 + */ + +#ifndef _ARPA_TELNET_H +#define _ARPA_TELNET_H + +/****************************************************************************/ + +/* + * Definitions for the TELNET protocol. + */ +#define IAC 255 /* interpret as command: */ +#define DONT 254 /* you are not to use option */ +#define DO 253 /* please, you use option */ +#define WONT 252 /* I won't use option */ +#define WILL 251 /* I will use option */ +#define SB 250 /* interpret as subnegotiation */ +#define GA 249 /* you may reverse the line */ +#define EL 248 /* erase the current line */ +#define EC 247 /* erase the current character */ +#define AYT 246 /* are you there */ +#define AO 245 /* abort output--but let prog finish */ +#define IP 244 /* interrupt process--permanently */ +#define BREAK 243 /* break */ +#define DM 242 /* data mark--for connect. cleaning */ +#define NOP 241 /* nop */ +#define SE 240 /* end sub negotiation */ +#define EOR 239 /* end of record (transparent mode) */ +#define ABORT 238 /* Abort process */ +#define SUSP 237 /* Suspend process */ +#define xEOF 236 /* End of file: EOF is already used... */ + +#define SYNCH 242 /* for telfunc calls */ + +#ifdef TELCMDS +char *telcmds[] = { + "EOF", "SUSP", "ABORT", "EOR", + "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", + "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0, +}; +#else +extern char *telcmds[]; +#endif + +#define TELCMD_FIRST xEOF +#define TELCMD_LAST IAC +#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ + (unsigned int)(x) >= TELCMD_FIRST) +#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] + +/* telnet options */ +#define TELOPT_BINARY 0 /* 8-bit data path */ +#define TELOPT_ECHO 1 /* echo */ +#define TELOPT_RCP 2 /* prepare to reconnect */ +#define TELOPT_SGA 3 /* suppress go ahead */ +#define TELOPT_NAMS 4 /* approximate message size */ +#define TELOPT_STATUS 5 /* give status */ +#define TELOPT_TM 6 /* timing mark */ +#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ +#define TELOPT_NAOL 8 /* negotiate about output line width */ +#define TELOPT_NAOP 9 /* negotiate about output page size */ +#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ +#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ +#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ +#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ +#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ +#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ +#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ +#define TELOPT_XASCII 17 /* extended ascic character set */ +#define TELOPT_LOGOUT 18 /* force logout */ +#define TELOPT_BM 19 /* byte macro */ +#define TELOPT_DET 20 /* data entry terminal */ +#define TELOPT_SUPDUP 21 /* supdup protocol */ +#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ +#define TELOPT_SNDLOC 23 /* send location */ +#define TELOPT_TTYPE 24 /* terminal type */ +#define TELOPT_EOR 25 /* end or record */ +#define TELOPT_TUID 26 /* TACACS user identification */ +#define TELOPT_OUTMRK 27 /* output marking */ +#define TELOPT_TTYLOC 28 /* terminal location number */ +#define TELOPT_3270REGIME 29 /* 3270 regime */ +#define TELOPT_X3PAD 30 /* X.3 PAD */ +#define TELOPT_NAWS 31 /* window size */ +#define TELOPT_TSPEED 32 /* terminal speed */ +#define TELOPT_LFLOW 33 /* remote flow control */ +#define TELOPT_LINEMODE 34 /* Linemode option */ +#define TELOPT_XDISPLOC 35 /* X Display Location */ +#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ +#define TELOPT_AUTHENTICATION 37/* Authenticate */ +#define TELOPT_ENCRYPT 38 /* Encryption option */ +#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ +#define TELOPT_EXOPL 255 /* extended-options-list */ + + +#define NTELOPTS (1+TELOPT_NEW_ENVIRON) +#ifdef TELOPTS +char *telopts[NTELOPTS+1] = { + "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", + "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", + "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", + "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", + "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", + "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", + "TACACS UID", "OUTPUT MARKING", "TTYLOC", + "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", + "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", + "ENCRYPT", "NEW-ENVIRON", + 0, +}; +#define TELOPT_FIRST TELOPT_BINARY +#define TELOPT_LAST TELOPT_NEW_ENVIRON +#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) +#define TELOPT(x) telopts[(x)-TELOPT_FIRST] +#endif + +/* sub-option qualifiers */ +#define TELQUAL_IS 0 /* option is... */ +#define TELQUAL_SEND 1 /* send option */ +#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ +#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ +#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ + +#define LFLOW_OFF 0 /* Disable remote flow control */ +#define LFLOW_ON 1 /* Enable remote flow control */ +#define LFLOW_RESTART_ANY 2 /* Restart output on any char */ +#define LFLOW_RESTART_XON 3 /* Restart output only on XON */ + +/* + * LINEMODE suboptions + */ + +#define LM_MODE 1 +#define LM_FORWARDMASK 2 +#define LM_SLC 3 + +#define MODE_EDIT 0x01 +#define MODE_TRAPSIG 0x02 +#define MODE_ACK 0x04 +#define MODE_SOFT_TAB 0x08 +#define MODE_LIT_ECHO 0x10 + +#define MODE_MASK 0x1f + +/* Not part of protocol, but needed to simplify things... */ +#define MODE_FLOW 0x0100 +#define MODE_ECHO 0x0200 +#define MODE_INBIN 0x0400 +#define MODE_OUTBIN 0x0800 +#define MODE_FORCE 0x1000 + +#define SLC_SYNCH 1 +#define SLC_BRK 2 +#define SLC_IP 3 +#define SLC_AO 4 +#define SLC_AYT 5 +#define SLC_EOR 6 +#define SLC_ABORT 7 +#define SLC_EOF 8 +#define SLC_SUSP 9 +#define SLC_EC 10 +#define SLC_EL 11 +#define SLC_EW 12 +#define SLC_RP 13 +#define SLC_LNEXT 14 +#define SLC_XON 15 +#define SLC_XOFF 16 +#define SLC_FORW1 17 +#define SLC_FORW2 18 + +#define NSLC 18 + +/* + * For backwards compatability, we define SLC_NAMES to be the + * list of names if SLC_NAMES is not defined. + */ +#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ + "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ + "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, +#ifdef SLC_NAMES +char *slc_names[] = { + SLC_NAMELIST +}; +#else +extern char *slc_names[]; +#define SLC_NAMES SLC_NAMELIST +#endif + +#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) +#define SLC_NAME(x) slc_names[x] + +#define SLC_NOSUPPORT 0 +#define SLC_CANTCHANGE 1 +#define SLC_VARIABLE 2 +#define SLC_DEFAULT 3 +#define SLC_LEVELBITS 0x03 + +#define SLC_FUNC 0 +#define SLC_FLAGS 1 +#define SLC_VALUE 2 + +#define SLC_ACK 0x80 +#define SLC_FLUSHIN 0x40 +#define SLC_FLUSHOUT 0x20 + +#define OLD_ENV_VAR 1 +#define OLD_ENV_VALUE 0 +#define NEW_ENV_VAR 0 +#define NEW_ENV_VALUE 1 +#define ENV_ESC 2 +#define ENV_USERVAR 3 + +/* + * AUTHENTICATION suboptions + */ + +/* + * Who is authenticating who ... + */ +#define AUTH_WHO_CLIENT 0 /* Client authenticating server */ +#define AUTH_WHO_SERVER 1 /* Server authenticating client */ +#define AUTH_WHO_MASK 1 + +/* + * amount of authentication done + */ +#define AUTH_HOW_ONE_WAY 0 +#define AUTH_HOW_MUTUAL 2 +#define AUTH_HOW_MASK 2 + +#define AUTHTYPE_NULL 0 +#define AUTHTYPE_KERBEROS_V4 1 +#define AUTHTYPE_KERBEROS_V5 2 +#define AUTHTYPE_SPX 3 +#define AUTHTYPE_MINK 4 +#define AUTHTYPE_CNT 5 + +#define AUTHTYPE_TEST 99 + +#ifdef AUTH_NAMES +char *authtype_names[] = { + "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, +}; +#else +extern char *authtype_names[]; +#endif + +#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) +#define AUTHTYPE_NAME(x) authtype_names[x] + +/* + * ENCRYPTion suboptions + */ +#define ENCRYPT_IS 0 /* I pick encryption type ... */ +#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ +#define ENCRYPT_REPLY 2 /* Initial setup response */ +#define ENCRYPT_START 3 /* Am starting to send encrypted */ +#define ENCRYPT_END 4 /* Am ending encrypted */ +#define ENCRYPT_REQSTART 5 /* Request you start encrypting */ +#define ENCRYPT_REQEND 6 /* Request you send encrypting */ +#define ENCRYPT_ENC_KEYID 7 +#define ENCRYPT_DEC_KEYID 8 +#define ENCRYPT_CNT 9 + +#define ENCTYPE_ANY 0 +#define ENCTYPE_DES_CFB64 1 +#define ENCTYPE_DES_OFB64 2 +#define ENCTYPE_CNT 3 + +#ifdef ENCRYPT_NAMES +char *encrypt_names[] = { + "IS", "SUPPORT", "REPLY", "START", "END", + "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", + 0, +}; +char *enctype_names[] = { + "ANY", "DES_CFB64", "DES_OFB64", 0, +}; +#else +extern char *encrypt_names[]; +extern char *enctype_names[]; +#endif + + +#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) +#define ENCRYPT_NAME(x) encrypt_names[x] + +#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) +#define ENCTYPE_NAME(x) enctype_names[x] + +/****************************************************************************/ + +#endif /* _ARPA_TELNET_H */ diff --git a/netinclude/arpa/tftp.h b/netinclude/arpa/tftp.h new file mode 100755 index 0000000..3c7f129 --- /dev/null +++ b/netinclude/arpa/tftp.h @@ -0,0 +1,135 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tftp.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _ARPA_TFTP_H +#define _ARPA_TFTP_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Trivial File Transfer Protocol (IEN-133) + */ +#define SEGSIZE 512 /* data segment size */ + +/* + * Packet types. + */ +#define RRQ 01 /* read request */ +#define WRQ 02 /* write request */ +#define DATA 03 /* data packet */ +#define ACK 04 /* acknowledgement */ +#ifndef _ARPA_FTP_H +#define ERROR 05 /* error code */ +#endif /* _ARPA_FTP_H */ + +struct tftphdr { + __WORD th_opcode; /* packet type */ + union { + __WORD tu_block; /* block # */ + __WORD tu_code; /* error code */ + __BYTE tu_stuff[1]; /* request packet stuff */ + } th_u; + __BYTE th_data[1]; /* data or error string */ +}; + +#define th_block th_u.tu_block +#define th_code th_u.tu_code +#define th_stuff th_u.tu_stuff +#define th_msg th_data + +/* + * Error codes. + */ +#define EUNDEF 0 /* not defined */ +#define ENOTFOUND 1 /* file not found */ +#define EACCESS 2 /* access violation */ +#define ENOSPACE 3 /* disk full or allocation exceeded */ +#define EBADOP 4 /* illegal TFTP operation */ +#define EBADID 5 /* unknown transfer ID */ +#define EEXISTS 6 /* file already exists */ +#define ENOUSER 7 /* no such user */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _ARPA_TFTP_H */ diff --git a/netinclude/bsdsocket/socketbasetags.h b/netinclude/bsdsocket/socketbasetags.h new file mode 100755 index 0000000..a1e2d78 --- /dev/null +++ b/netinclude/bsdsocket/socketbasetags.h @@ -0,0 +1,25 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * "Miami" compatibility header file + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +#ifndef BSDSOCKET_SOCKETBASETAGS_H +#define BSDSOCKET_SOCKETBASETAGS_H + +/****************************************************************************/ + +#ifndef _LIBRARIES_BSDSOCKET_H +#include +#endif /* _LIBRARIES_BSDSOCKET_H */ + +/****************************************************************************/ + +#endif /* BSDSOCKET_SOCKETBASETAGS_H */ diff --git a/netinclude/clib/bsdsocket_protos.h b/netinclude/clib/bsdsocket_protos.h new file mode 100755 index 0000000..4406639 --- /dev/null +++ b/netinclude/clib/bsdsocket_protos.h @@ -0,0 +1,208 @@ +/* + * $Id$ + * + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +#ifndef CLIB_BSDSOCKET_PROTOS_H +#define CLIB_BSDSOCKET_PROTOS_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifndef EXEC_LISTS_H +#include +#endif +#ifndef DEVICES_TIMER_H +#include +#endif +#ifndef UTILITY_TAGITEM_H +#include +#endif +#ifndef UTILITY_HOOKS_H +#include +#endif +#ifndef NETINET_IN_H +#include +#endif +#ifndef SYS_SOCKET_H +#include +#endif +#ifndef SYS_MBUF_H +#include +#endif +#ifndef NET_ROUTE_H +#include +#endif +#ifndef NETDB_H +#include +#endif +#ifndef LIBRARIES_BSDSOCKET_H +#include +#endif +#ifndef DOS_DOSEXTENS_H +#include +#endif + +#ifdef __NEW_TIMEVAL_DEFINITION_USED__ +#define __timeval TimeVal +#else +#define __timeval timeval +#endif + +LONG socket( LONG domain, LONG type, LONG protocol ); +LONG bind( LONG sock, struct sockaddr *name, socklen_t namelen ); +LONG listen( LONG sock, LONG backlog ); +LONG accept( LONG sock, struct sockaddr *addr, socklen_t *addrlen ); +LONG connect( LONG sock, struct sockaddr *name, socklen_t namelen ); +LONG sendto( LONG sock, APTR buf, LONG len, LONG flags, struct sockaddr *to, socklen_t tolen ); +LONG send( LONG sock, APTR buf, LONG len, LONG flags ); +LONG recvfrom( LONG sock, APTR buf, LONG len, LONG flags, struct sockaddr *addr, socklen_t *addrlen ); +LONG recv( LONG sock, APTR buf, LONG len, LONG flags ); +LONG shutdown( LONG sock, LONG how ); +LONG setsockopt( LONG sock, LONG level, LONG optname, APTR optval, socklen_t optlen ); +LONG getsockopt( LONG sock, LONG level, LONG optname, APTR optval, socklen_t *optlen ); +LONG getsockname( LONG sock, struct sockaddr *name, socklen_t *namelen ); +LONG getpeername( LONG sock, struct sockaddr *name, socklen_t *namelen ); +LONG IoctlSocket( LONG sock, ULONG req, APTR argp ); +LONG CloseSocket( LONG sock ); +LONG WaitSelect( LONG nfds, APTR read_fds, APTR write_fds, APTR except_fds, struct __timeval *_timeout, ULONG *signals ); +VOID SetSocketSignals( ULONG int_mask, ULONG io_mask, ULONG urgent_mask ); +LONG getdtablesize( VOID ); +LONG ObtainSocket( LONG id, LONG domain, LONG type, LONG protocol ); +LONG ReleaseSocket( LONG sock, LONG id ); +LONG ReleaseCopyOfSocket( LONG sock, LONG id ); +LONG Errno( VOID ); +VOID SetErrnoPtr( APTR errno_ptr, LONG size ); +STRPTR Inet_NtoA( in_addr_t ip ); +in_addr_t inet_addr( STRPTR cp ); +in_addr_t Inet_LnaOf( in_addr_t in ); +in_addr_t Inet_NetOf( in_addr_t in ); +in_addr_t Inet_MakeAddr( in_addr_t net, in_addr_t host ); +in_addr_t inet_network( STRPTR cp ); +struct hostent *gethostbyname( STRPTR name ); +struct hostent *gethostbyaddr( STRPTR addr, LONG len, LONG type ); +struct netent *getnetbyname( STRPTR name ); +struct netent *getnetbyaddr( in_addr_t net, LONG type ); +struct servent *getservbyname( STRPTR name, STRPTR proto ); +struct servent *getservbyport( LONG port, STRPTR proto ); +struct protoent *getprotobyname( STRPTR name ); +struct protoent *getprotobynumber( LONG proto ); +VOID vsyslog( LONG pri, STRPTR msg, APTR args ); +VOID syslog( LONG pri, STRPTR msg, LONG first_parameter, ... ); +LONG Dup2Socket( LONG old_socket, LONG new_socket ); +LONG sendmsg( LONG sock, struct msghdr *msg, LONG flags ); +LONG recvmsg( LONG sock, struct msghdr *msg, LONG flags ); +LONG gethostname( STRPTR name, LONG namelen ); +in_addr_t gethostid( VOID ); +LONG SocketBaseTagList( struct TagItem *tags ); +LONG SocketBaseTags( Tag first_tag, ... ); +LONG GetSocketEvents( ULONG *event_ptr ); +/* Ten reserved slots for future expansion */ +/* Berkeley Packet Filter (Roadshow extensions start here) */ +LONG bpf_open( LONG channel ); +LONG bpf_close( LONG channel ); +LONG bpf_read( LONG channel, APTR buffer, LONG len ); +LONG bpf_write( LONG channel, APTR buffer, LONG len ); +LONG bpf_set_notify_mask( LONG channel, ULONG signal_mask ); +LONG bpf_set_interrupt_mask( LONG channel, ULONG signal_mask ); +LONG bpf_ioctl( LONG channel, ULONG command, APTR buffer ); +LONG bpf_data_waiting( LONG channel ); +/* Route management */ +LONG AddRouteTagList( struct TagItem *tags ); +LONG AddRouteTags( Tag first_tag, ... ); +LONG DeleteRouteTagList( struct TagItem *tags ); +LONG DeleteRouteTags( Tag first_tag, ... ); +VOID FreeRouteInfo( struct rt_msghdr *buf ); +struct rt_msghdr *GetRouteInfo( LONG address_family, LONG flags ); +/* Interface management */ +LONG AddInterfaceTagList( STRPTR interface_name, STRPTR device_name, LONG unit, struct TagItem *tags ); +LONG AddInterfaceTags( STRPTR interface_name, STRPTR device_name, LONG unit, Tag first_tag, ... ); +LONG ConfigureInterfaceTagList( STRPTR interface_name, struct TagItem *tags ); +LONG ConfigureInterfaceTags( STRPTR interface_name, Tag first_tag, ... ); +VOID ReleaseInterfaceList( struct List *list ); +struct List *ObtainInterfaceList( VOID ); +LONG QueryInterfaceTagList( STRPTR interface_name, struct TagItem *tags ); +LONG QueryInterfaceTags( STRPTR interface_name, Tag first_tag, ... ); +LONG CreateAddrAllocMessageA( LONG version, LONG protocol, STRPTR interface_name, struct AddressAllocationMessage **result_ptr, struct TagItem *tags ); +LONG CreateAddrAllocMessage( LONG version, LONG protocol, STRPTR interface_name, struct AddressAllocationMessage **result_ptr, Tag first_tag, ... ); +VOID DeleteAddrAllocMessage( struct AddressAllocationMessage *aam ); +VOID BeginInterfaceConfig( struct AddressAllocationMessage *message ); +VOID AbortInterfaceConfig( struct AddressAllocationMessage *message ); +/* Monitor management */ +LONG AddNetMonitorHookTagList( LONG type, struct Hook *hook, struct TagItem *tags ); +LONG AddNetMonitorHookTags( LONG type, struct Hook *hook, Tag first_tag, ... ); +VOID RemoveNetMonitorHook( struct Hook *hook ); +/* Status query */ +LONG GetNetworkStatistics( LONG type, LONG version, APTR destination, LONG size ); +/* Domain name server management */ +LONG AddDomainNameServer( STRPTR address ); +LONG RemoveDomainNameServer( STRPTR address ); +VOID ReleaseDomainNameServerList( struct List *list ); +struct List *ObtainDomainNameServerList( VOID ); +/* Local database access */ +VOID setnetent( LONG stay_open ); +VOID endnetent( VOID ); +struct netent *getnetent( VOID ); +VOID setprotoent( LONG stay_open ); +VOID endprotoent( VOID ); +struct protoent *getprotoent( VOID ); +VOID setservent( LONG stay_open ); +VOID endservent( VOID ); +struct servent *getservent( VOID ); +/* Address conversion */ +LONG inet_aton( STRPTR cp, struct in_addr *addr ); +STRPTR inet_ntop( LONG af, APTR src, STRPTR dst, LONG size ); +LONG inet_pton( LONG af, STRPTR src, APTR dst ); +LONG In_LocalAddr( in_addr_t address ); +LONG In_CanForward( in_addr_t address ); +/* Kernel memory management */ +struct mbuf *mbuf_copym( struct mbuf *m, LONG off, LONG len ); +LONG mbuf_copyback( struct mbuf *m, LONG off, LONG len, APTR cp ); +LONG mbuf_copydata( struct mbuf *m, LONG off, LONG len, APTR cp ); +struct mbuf *mbuf_free( struct mbuf *m ); +VOID mbuf_freem( struct mbuf *m ); +struct mbuf *mbuf_get( VOID ); +struct mbuf *mbuf_gethdr( VOID ); +struct mbuf *mbuf_prepend( struct mbuf *m, LONG len ); +LONG mbuf_cat( struct mbuf *m, struct mbuf *n ); +LONG mbuf_adj( struct mbuf *mp, LONG req_len ); +struct mbuf *mbuf_pullup( struct mbuf *m, LONG len ); +/* Internet servers */ +BOOL ProcessIsServer( struct Process *pr ); +LONG ObtainServerSocket( VOID ); +/* Default domain name */ +BOOL GetDefaultDomainName( STRPTR buffer, LONG buffer_size ); +VOID SetDefaultDomainName( STRPTR buffer ); +/* Global data access */ +struct List *ObtainRoadshowData( LONG access ); +VOID ReleaseRoadshowData( struct List *list ); +BOOL ChangeRoadshowData( struct List *list, STRPTR name, ULONG length, APTR data ); +/* The counterpart to AddInterfaceTagList */ +LONG RemoveInterface( STRPTR interface_name, LONG force ); +/* Reentrant versions of the gethostbyname/gethostbyaddr functions, BSD-style */ +struct hostent *gethostbyname_r( STRPTR name, struct hostent *hp, APTR buf, ULONG buflen, LONG *he ); +struct hostent *gethostbyaddr_r( STRPTR addr, LONG len, LONG type, struct hostent *hp, APTR buf, ULONG buflen, LONG *he ); +/* Two reserved slots for future expansion */ +/* Node and service name translation (rfc3493) */ +VOID freeaddrinfo( struct addrinfo *ai ); +LONG getaddrinfo( STRPTR hostname, STRPTR servname, struct addrinfo *hints, struct addrinfo **res ); +STRPTR gai_strerror( LONG errnum ); +LONG getnameinfo( struct sockaddr *sa, ULONG salen, STRPTR host, ULONG hostlen, STRPTR serv, ULONG servlen, ULONG flags ); +/* Six reserved slots for future expansion */ + +#undef __timeval + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* CLIB_BSDSOCKET_PROTOS_H */ diff --git a/netinclude/clib/socket_protos.h b/netinclude/clib/socket_protos.h new file mode 100755 index 0000000..f4a6661 --- /dev/null +++ b/netinclude/clib/socket_protos.h @@ -0,0 +1,29 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * "Miami" compatibility header file + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +#ifndef CLIB_SOCKET_PROTOS_H +#define CLIB_SOCKET_PROTOS_H 1 + +/****************************************************************************/ + +#ifndef CLIB_BSDSOCKET_PROTOS_H +#include +#endif /* CLIB_BSDSOCKET_PROTOS_H */ + +/****************************************************************************/ + +#define SOCKETNAME "bsdsocket.library" + +/****************************************************************************/ + +#endif /* !CLIB_SOCKET_PROTOS_H */ diff --git a/netinclude/clib/usergroup_protos.h b/netinclude/clib/usergroup_protos.h new file mode 100755 index 0000000..13a43b5 --- /dev/null +++ b/netinclude/clib/usergroup_protos.h @@ -0,0 +1,78 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack; "usergroup.library" API + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + * + * WARNING: The "usergroup.library" API must be considered obsolete and + * should not be used in new software. It is provided solely + * for backwards compatibility and legacy application software. + */ + +#ifndef CLIB_USERGROUP_PROTOS_H +#define CLIB_USERGROUP_PROTOS_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifndef LIBRARIES_USERGROUP_H +#include +#endif +#ifndef PWD_H +#include +#endif +#ifndef GRP_H +#include +#endif + +LONG ug_SetupContextTagList( STRPTR name, struct TagItem *tags ); +LONG ug_SetupContextTags( STRPTR name, ... ); +LONG ug_GetErr( VOID ); +STRPTR ug_StrError( LONG err ); +LONG getuid( VOID ); +LONG geteuid( VOID ); +LONG setreuid( LONG real, LONG effective ); +LONG setuid( LONG uid ); +LONG getgid( VOID ); +LONG getegid( VOID ); +LONG setregid( LONG real, LONG effective ); +LONG setgid( LONG gid ); +LONG getgroups( LONG gidsetlen, LONG *gidset ); +LONG setgroups( LONG gidsetlen, LONG *gidset ); +LONG initgroups( STRPTR name, LONG basegid ); +struct passwd *getpwnam( STRPTR login ); +struct passwd *getpwuid( LONG uid ); +VOID setpwent( VOID ); +struct passwd *getpwent( VOID ); +VOID endpwent( VOID ); +struct group *getgrnam( STRPTR name ); +struct group *getgrgid( LONG gid ); +VOID setgrent( VOID ); +struct group *getgrent( VOID ); +VOID endgrent( VOID ); +UBYTE *crypt( UBYTE *key, UBYTE *set ); +UBYTE *ug_GetSalt( struct passwd *user, UBYTE *buf, ULONG size ); +STRPTR getpass( STRPTR prompt ); +ULONG umask( ULONG mask ); +ULONG getumask( VOID ); +LONG setsid( VOID ); +LONG getpgrp( VOID ); +STRPTR getlogin( VOID ); +LONG setlogin( STRPTR name ); +VOID setutent( VOID ); +struct utmp *getutent( VOID ); +VOID endutent( VOID ); +struct lastlog *getlastlog( LONG uid ); +LONG setlastlog( LONG uid, STRPTR name, STRPTR host ); +struct UserGroupCredentials *getcredentials( struct Task *task ); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* CLIB_USERGROUP_PROTOS_H */ diff --git a/netinclude/errno.h b/netinclude/errno.h new file mode 100755 index 0000000..6b511da --- /dev/null +++ b/netinclude/errno.h @@ -0,0 +1,14 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +#ifndef _SYS_ERRNO_H +#include +#endif /* !_SYS_ERRNO_H */ diff --git a/netinclude/grp.h b/netinclude/grp.h new file mode 100755 index 0000000..6aa164a --- /dev/null +++ b/netinclude/grp.h @@ -0,0 +1,109 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack; "usergroup.library" API + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + * + * WARNING: The "usergroup.library" API must be considered obsolete and + * should not be used in new software. It is provided solely + * for backwards compatibility and legacy application software. + */ + +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)grp.h 8.2 (Berkeley) 1/21/94 + */ + +#ifndef _GRP_H +#define _GRP_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +struct group +{ + __STRPTR gr_name; /* group name */ + __STRPTR gr_passwd; /* group password */ + __LONG gr_gid; /* group id */ + __STRPTR * gr_mem; /* group members */ +}; + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* !_GRP_H */ diff --git a/netinclude/inline/bsdsocket.h b/netinclude/inline/bsdsocket.h new file mode 100755 index 0000000..396f9ec --- /dev/null +++ b/netinclude/inline/bsdsocket.h @@ -0,0 +1,2104 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2017 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * This file was created with fd2pragma V2.164 using the following options: + * + * fd2pragma bsdsocket_lib.sfd to RAM:inline-46 special 46 + * + * The 'struct timeval' was replaced by 'struct __timeval'. + */ + +#ifndef _INLINE_BSDSOCKET_H +#define _INLINE_BSDSOCKET_H + +#ifndef CLIB_BSDSOCKET_PROTOS_H +#define CLIB_BSDSOCKET_PROTOS_H +#endif + +#ifndef EXEC_LISTS_H +#include +#endif +#ifndef DEVICES_TIMER_H +#include +#endif +#ifndef UTILITY_TAGITEM_H +#include +#endif +#ifndef UTILITY_HOOKS_H +#include +#endif +#ifndef NETINET_IN_H +#include +#endif +#ifndef SYS_SOCKET_H +#include +#endif +#ifndef SYS_MBUF_H +#include +#endif +#ifndef NET_ROUTE_H +#include +#endif +#ifndef NETDB_H +#include +#endif +#ifndef LIBRARIES_BSDSOCKET_H +#include +#endif +#ifndef DOS_DOSEXTENS_H +#include +#endif + +#ifndef BSDSOCKET_BASE_NAME +#define BSDSOCKET_BASE_NAME SocketBase +#endif + +#define socket(domain, type, protocol) ({ \ + LONG _socket_domain = (domain); \ + LONG _socket_type = (type); \ + LONG _socket_protocol = (protocol); \ + LONG _socket__re = \ + ({ \ + register struct Library * const __socket__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __socket__re __asm("d0"); \ + register LONG __socket_domain __asm("d0") = (_socket_domain); \ + register LONG __socket_type __asm("d1") = (_socket_type); \ + register LONG __socket_protocol __asm("d2") = (_socket_protocol); \ + __asm volatile ("jsr a6@(-30:W)" \ + : "=r"(__socket__re) \ + : "r"(__socket__bn), "r"(__socket_domain), "r"(__socket_type), "r"(__socket_protocol) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __socket__re; \ + }); \ + _socket__re; \ +}) + +#define bind(sock, name, namelen) ({ \ + LONG _bind_sock = (sock); \ + struct sockaddr * _bind_name = (name); \ + LONG _bind_namelen = (namelen); \ + LONG _bind__re = \ + ({ \ + register struct Library * const __bind__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __bind__re __asm("d0"); \ + register LONG __bind_sock __asm("d0") = (_bind_sock); \ + register struct sockaddr * __bind_name __asm("a0") = (_bind_name); \ + register LONG __bind_namelen __asm("d1") = (_bind_namelen); \ + __asm volatile ("jsr a6@(-36:W)" \ + : "=r"(__bind__re) \ + : "r"(__bind__bn), "r"(__bind_sock), "r"(__bind_name), "r"(__bind_namelen) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __bind__re; \ + }); \ + _bind__re; \ +}) + +#define listen(sock, backlog) ({ \ + LONG _listen_sock = (sock); \ + LONG _listen_backlog = (backlog); \ + LONG _listen__re = \ + ({ \ + register struct Library * const __listen__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __listen__re __asm("d0"); \ + register LONG __listen_sock __asm("d0") = (_listen_sock); \ + register LONG __listen_backlog __asm("d1") = (_listen_backlog); \ + __asm volatile ("jsr a6@(-42:W)" \ + : "=r"(__listen__re) \ + : "r"(__listen__bn), "r"(__listen_sock), "r"(__listen_backlog) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __listen__re; \ + }); \ + _listen__re; \ +}) + +#define accept(sock, addr, addrlen) ({ \ + LONG _accept_sock = (sock); \ + struct sockaddr * _accept_addr = (addr); \ + socklen_t * _accept_addrlen = (addrlen); \ + LONG _accept__re = \ + ({ \ + register struct Library * const __accept__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __accept__re __asm("d0"); \ + register LONG __accept_sock __asm("d0") = (_accept_sock); \ + register struct sockaddr * __accept_addr __asm("a0") = (_accept_addr); \ + register socklen_t * __accept_addrlen __asm("a1") = (_accept_addrlen); \ + __asm volatile ("jsr a6@(-48:W)" \ + : "=r"(__accept__re) \ + : "r"(__accept__bn), "r"(__accept_sock), "r"(__accept_addr), "r"(__accept_addrlen) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __accept__re; \ + }); \ + _accept__re; \ +}) + +#define connect(sock, name, namelen) ({ \ + LONG _connect_sock = (sock); \ + struct sockaddr * _connect_name = (name); \ + LONG _connect_namelen = (namelen); \ + LONG _connect__re = \ + ({ \ + register struct Library * const __connect__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __connect__re __asm("d0"); \ + register LONG __connect_sock __asm("d0") = (_connect_sock); \ + register struct sockaddr * __connect_name __asm("a0") = (_connect_name); \ + register LONG __connect_namelen __asm("d1") = (_connect_namelen); \ + __asm volatile ("jsr a6@(-54:W)" \ + : "=r"(__connect__re) \ + : "r"(__connect__bn), "r"(__connect_sock), "r"(__connect_name), "r"(__connect_namelen) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __connect__re; \ + }); \ + _connect__re; \ +}) + +#define sendto(sock, buf, len, flags, to, tolen) ({ \ + LONG _sendto_sock = (sock); \ + APTR _sendto_buf = (buf); \ + LONG _sendto_len = (len); \ + LONG _sendto_flags = (flags); \ + struct sockaddr * _sendto_to = (to); \ + LONG _sendto_tolen = (tolen); \ + LONG _sendto__re = \ + ({ \ + register struct Library * const __sendto__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __sendto__re __asm("d0"); \ + register LONG __sendto_sock __asm("d0") = (_sendto_sock); \ + register APTR __sendto_buf __asm("a0") = (_sendto_buf); \ + register LONG __sendto_len __asm("d1") = (_sendto_len); \ + register LONG __sendto_flags __asm("d2") = (_sendto_flags); \ + register struct sockaddr * __sendto_to __asm("a1") = (_sendto_to); \ + register LONG __sendto_tolen __asm("d3") = (_sendto_tolen); \ + __asm volatile ("jsr a6@(-60:W)" \ + : "=r"(__sendto__re) \ + : "r"(__sendto__bn), "r"(__sendto_sock), "r"(__sendto_buf), "r"(__sendto_len), "r"(__sendto_flags), "r"(__sendto_to), "r"(__sendto_tolen) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __sendto__re; \ + }); \ + _sendto__re; \ +}) + +#define send(sock, buf, len, flags) ({ \ + LONG _send_sock = (sock); \ + APTR _send_buf = (buf); \ + LONG _send_len = (len); \ + LONG _send_flags = (flags); \ + LONG _send__re = \ + ({ \ + register struct Library * const __send__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __send__re __asm("d0"); \ + register LONG __send_sock __asm("d0") = (_send_sock); \ + register APTR __send_buf __asm("a0") = (_send_buf); \ + register LONG __send_len __asm("d1") = (_send_len); \ + register LONG __send_flags __asm("d2") = (_send_flags); \ + __asm volatile ("jsr a6@(-66:W)" \ + : "=r"(__send__re) \ + : "r"(__send__bn), "r"(__send_sock), "r"(__send_buf), "r"(__send_len), "r"(__send_flags) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __send__re; \ + }); \ + _send__re; \ +}) + +#define recvfrom(sock, buf, len, flags, addr, addrlen) ({ \ + LONG _recvfrom_sock = (sock); \ + APTR _recvfrom_buf = (buf); \ + LONG _recvfrom_len = (len); \ + LONG _recvfrom_flags = (flags); \ + struct sockaddr * _recvfrom_addr = (addr); \ + socklen_t * _recvfrom_addrlen = (addrlen); \ + LONG _recvfrom__re = \ + ({ \ + register struct Library * const __recvfrom__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __recvfrom__re __asm("d0"); \ + register LONG __recvfrom_sock __asm("d0") = (_recvfrom_sock); \ + register APTR __recvfrom_buf __asm("a0") = (_recvfrom_buf); \ + register LONG __recvfrom_len __asm("d1") = (_recvfrom_len); \ + register LONG __recvfrom_flags __asm("d2") = (_recvfrom_flags); \ + register struct sockaddr * __recvfrom_addr __asm("a1") = (_recvfrom_addr); \ + register socklen_t * __recvfrom_addrlen __asm("a2") = (_recvfrom_addrlen); \ + __asm volatile ("jsr a6@(-72:W)" \ + : "=r"(__recvfrom__re) \ + : "r"(__recvfrom__bn), "r"(__recvfrom_sock), "r"(__recvfrom_buf), "r"(__recvfrom_len), "r"(__recvfrom_flags), "r"(__recvfrom_addr), "r"(__recvfrom_addrlen) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __recvfrom__re; \ + }); \ + _recvfrom__re; \ +}) + +#define recv(sock, buf, len, flags) ({ \ + LONG _recv_sock = (sock); \ + APTR _recv_buf = (buf); \ + LONG _recv_len = (len); \ + LONG _recv_flags = (flags); \ + LONG _recv__re = \ + ({ \ + register struct Library * const __recv__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __recv__re __asm("d0"); \ + register LONG __recv_sock __asm("d0") = (_recv_sock); \ + register APTR __recv_buf __asm("a0") = (_recv_buf); \ + register LONG __recv_len __asm("d1") = (_recv_len); \ + register LONG __recv_flags __asm("d2") = (_recv_flags); \ + __asm volatile ("jsr a6@(-78:W)" \ + : "=r"(__recv__re) \ + : "r"(__recv__bn), "r"(__recv_sock), "r"(__recv_buf), "r"(__recv_len), "r"(__recv_flags) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __recv__re; \ + }); \ + _recv__re; \ +}) + +#define shutdown(sock, how) ({ \ + LONG _shutdown_sock = (sock); \ + LONG _shutdown_how = (how); \ + LONG _shutdown__re = \ + ({ \ + register struct Library * const __shutdown__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __shutdown__re __asm("d0"); \ + register LONG __shutdown_sock __asm("d0") = (_shutdown_sock); \ + register LONG __shutdown_how __asm("d1") = (_shutdown_how); \ + __asm volatile ("jsr a6@(-84:W)" \ + : "=r"(__shutdown__re) \ + : "r"(__shutdown__bn), "r"(__shutdown_sock), "r"(__shutdown_how) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __shutdown__re; \ + }); \ + _shutdown__re; \ +}) + +#define setsockopt(sock, level, optname, optval, optlen) ({ \ + LONG _setsockopt_sock = (sock); \ + LONG _setsockopt_level = (level); \ + LONG _setsockopt_optname = (optname); \ + APTR _setsockopt_optval = (optval); \ + LONG _setsockopt_optlen = (optlen); \ + LONG _setsockopt__re = \ + ({ \ + register struct Library * const __setsockopt__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __setsockopt__re __asm("d0"); \ + register LONG __setsockopt_sock __asm("d0") = (_setsockopt_sock); \ + register LONG __setsockopt_level __asm("d1") = (_setsockopt_level); \ + register LONG __setsockopt_optname __asm("d2") = (_setsockopt_optname); \ + register APTR __setsockopt_optval __asm("a0") = (_setsockopt_optval); \ + register LONG __setsockopt_optlen __asm("d3") = (_setsockopt_optlen); \ + __asm volatile ("jsr a6@(-90:W)" \ + : "=r"(__setsockopt__re) \ + : "r"(__setsockopt__bn), "r"(__setsockopt_sock), "r"(__setsockopt_level), "r"(__setsockopt_optname), "r"(__setsockopt_optval), "r"(__setsockopt_optlen) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __setsockopt__re; \ + }); \ + _setsockopt__re; \ +}) + +#define getsockopt(sock, level, optname, optval, optlen) ({ \ + LONG _getsockopt_sock = (sock); \ + LONG _getsockopt_level = (level); \ + LONG _getsockopt_optname = (optname); \ + APTR _getsockopt_optval = (optval); \ + socklen_t * _getsockopt_optlen = (optlen); \ + LONG _getsockopt__re = \ + ({ \ + register struct Library * const __getsockopt__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __getsockopt__re __asm("d0"); \ + register LONG __getsockopt_sock __asm("d0") = (_getsockopt_sock); \ + register LONG __getsockopt_level __asm("d1") = (_getsockopt_level); \ + register LONG __getsockopt_optname __asm("d2") = (_getsockopt_optname); \ + register APTR __getsockopt_optval __asm("a0") = (_getsockopt_optval); \ + register socklen_t * __getsockopt_optlen __asm("a1") = (_getsockopt_optlen); \ + __asm volatile ("jsr a6@(-96:W)" \ + : "=r"(__getsockopt__re) \ + : "r"(__getsockopt__bn), "r"(__getsockopt_sock), "r"(__getsockopt_level), "r"(__getsockopt_optname), "r"(__getsockopt_optval), "r"(__getsockopt_optlen) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getsockopt__re; \ + }); \ + _getsockopt__re; \ +}) + +#define getsockname(sock, name, namelen) ({ \ + LONG _getsockname_sock = (sock); \ + struct sockaddr * _getsockname_name = (name); \ + socklen_t * _getsockname_namelen = (namelen); \ + LONG _getsockname__re = \ + ({ \ + register struct Library * const __getsockname__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __getsockname__re __asm("d0"); \ + register LONG __getsockname_sock __asm("d0") = (_getsockname_sock); \ + register struct sockaddr * __getsockname_name __asm("a0") = (_getsockname_name); \ + register socklen_t * __getsockname_namelen __asm("a1") = (_getsockname_namelen); \ + __asm volatile ("jsr a6@(-102:W)" \ + : "=r"(__getsockname__re) \ + : "r"(__getsockname__bn), "r"(__getsockname_sock), "r"(__getsockname_name), "r"(__getsockname_namelen) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getsockname__re; \ + }); \ + _getsockname__re; \ +}) + +#define getpeername(sock, name, namelen) ({ \ + LONG _getpeername_sock = (sock); \ + struct sockaddr * _getpeername_name = (name); \ + socklen_t * _getpeername_namelen = (namelen); \ + LONG _getpeername__re = \ + ({ \ + register struct Library * const __getpeername__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __getpeername__re __asm("d0"); \ + register LONG __getpeername_sock __asm("d0") = (_getpeername_sock); \ + register struct sockaddr * __getpeername_name __asm("a0") = (_getpeername_name); \ + register socklen_t * __getpeername_namelen __asm("a1") = (_getpeername_namelen); \ + __asm volatile ("jsr a6@(-108:W)" \ + : "=r"(__getpeername__re) \ + : "r"(__getpeername__bn), "r"(__getpeername_sock), "r"(__getpeername_name), "r"(__getpeername_namelen) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getpeername__re; \ + }); \ + _getpeername__re; \ +}) + +#define IoctlSocket(sock, req, argp) ({ \ + LONG _IoctlSocket_sock = (sock); \ + ULONG _IoctlSocket_req = (req); \ + APTR _IoctlSocket_argp = (argp); \ + LONG _IoctlSocket__re = \ + ({ \ + register struct Library * const __IoctlSocket__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __IoctlSocket__re __asm("d0"); \ + register LONG __IoctlSocket_sock __asm("d0") = (_IoctlSocket_sock); \ + register ULONG __IoctlSocket_req __asm("d1") = (_IoctlSocket_req); \ + register APTR __IoctlSocket_argp __asm("a0") = (_IoctlSocket_argp); \ + __asm volatile ("jsr a6@(-114:W)" \ + : "=r"(__IoctlSocket__re) \ + : "r"(__IoctlSocket__bn), "r"(__IoctlSocket_sock), "r"(__IoctlSocket_req), "r"(__IoctlSocket_argp) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __IoctlSocket__re; \ + }); \ + _IoctlSocket__re; \ +}) + +#define CloseSocket(sock) ({ \ + LONG _CloseSocket_sock = (sock); \ + LONG _CloseSocket__re = \ + ({ \ + register struct Library * const __CloseSocket__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __CloseSocket__re __asm("d0"); \ + register LONG __CloseSocket_sock __asm("d0") = (_CloseSocket_sock); \ + __asm volatile ("jsr a6@(-120:W)" \ + : "=r"(__CloseSocket__re) \ + : "r"(__CloseSocket__bn), "r"(__CloseSocket_sock) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __CloseSocket__re; \ + }); \ + _CloseSocket__re; \ +}) + +#define WaitSelect(nfds, read_fds, write_fds, except_fds, _timeout, signals) ({ \ + LONG _WaitSelect_nfds = (nfds); \ + APTR _WaitSelect_read_fds = (read_fds); \ + APTR _WaitSelect_write_fds = (write_fds); \ + APTR _WaitSelect_except_fds = (except_fds); \ + struct __timeval * _WaitSelect__timeout = (_timeout); \ + ULONG * _WaitSelect_signals = (signals); \ + LONG _WaitSelect__re = \ + ({ \ + register struct Library * const __WaitSelect__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __WaitSelect__re __asm("d0"); \ + register LONG __WaitSelect_nfds __asm("d0") = (_WaitSelect_nfds); \ + register APTR __WaitSelect_read_fds __asm("a0") = (_WaitSelect_read_fds); \ + register APTR __WaitSelect_write_fds __asm("a1") = (_WaitSelect_write_fds); \ + register APTR __WaitSelect_except_fds __asm("a2") = (_WaitSelect_except_fds); \ + register struct __timeval * __WaitSelect__timeout __asm("a3") = (_WaitSelect__timeout); \ + register ULONG * __WaitSelect_signals __asm("d1") = (_WaitSelect_signals); \ + __asm volatile ("jsr a6@(-126:W)" \ + : "=r"(__WaitSelect__re) \ + : "r"(__WaitSelect__bn), "r"(__WaitSelect_nfds), "r"(__WaitSelect_read_fds), "r"(__WaitSelect_write_fds), "r"(__WaitSelect_except_fds), "r"(__WaitSelect__timeout), "r"(__WaitSelect_signals) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __WaitSelect__re; \ + }); \ + _WaitSelect__re; \ +}) + +#define SetSocketSignals(int_mask, io_mask, urgent_mask) ({ \ + ULONG _SetSocketSignals_int_mask = (int_mask); \ + ULONG _SetSocketSignals_io_mask = (io_mask); \ + ULONG _SetSocketSignals_urgent_mask = (urgent_mask); \ + { \ + register struct Library * const __SetSocketSignals__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register ULONG __SetSocketSignals_int_mask __asm("d0") = (_SetSocketSignals_int_mask); \ + register ULONG __SetSocketSignals_io_mask __asm("d1") = (_SetSocketSignals_io_mask); \ + register ULONG __SetSocketSignals_urgent_mask __asm("d2") = (_SetSocketSignals_urgent_mask); \ + __asm volatile ("jsr a6@(-132:W)" \ + : \ + : "r"(__SetSocketSignals__bn), "r"(__SetSocketSignals_int_mask), "r"(__SetSocketSignals_io_mask), "r"(__SetSocketSignals_urgent_mask) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define getdtablesize() ({ \ + LONG _getdtablesize__re = \ + ({ \ + register struct Library * const __getdtablesize__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __getdtablesize__re __asm("d0"); \ + __asm volatile ("jsr a6@(-138:W)" \ + : "=r"(__getdtablesize__re) \ + : "r"(__getdtablesize__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getdtablesize__re; \ + }); \ + _getdtablesize__re; \ +}) + +#define ObtainSocket(id, domain, type, protocol) ({ \ + LONG _ObtainSocket_id = (id); \ + LONG _ObtainSocket_domain = (domain); \ + LONG _ObtainSocket_type = (type); \ + LONG _ObtainSocket_protocol = (protocol); \ + LONG _ObtainSocket__re = \ + ({ \ + register struct Library * const __ObtainSocket__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __ObtainSocket__re __asm("d0"); \ + register LONG __ObtainSocket_id __asm("d0") = (_ObtainSocket_id); \ + register LONG __ObtainSocket_domain __asm("d1") = (_ObtainSocket_domain); \ + register LONG __ObtainSocket_type __asm("d2") = (_ObtainSocket_type); \ + register LONG __ObtainSocket_protocol __asm("d3") = (_ObtainSocket_protocol); \ + __asm volatile ("jsr a6@(-144:W)" \ + : "=r"(__ObtainSocket__re) \ + : "r"(__ObtainSocket__bn), "r"(__ObtainSocket_id), "r"(__ObtainSocket_domain), "r"(__ObtainSocket_type), "r"(__ObtainSocket_protocol) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __ObtainSocket__re; \ + }); \ + _ObtainSocket__re; \ +}) + +#define ReleaseSocket(sock, id) ({ \ + LONG _ReleaseSocket_sock = (sock); \ + LONG _ReleaseSocket_id = (id); \ + LONG _ReleaseSocket__re = \ + ({ \ + register struct Library * const __ReleaseSocket__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __ReleaseSocket__re __asm("d0"); \ + register LONG __ReleaseSocket_sock __asm("d0") = (_ReleaseSocket_sock); \ + register LONG __ReleaseSocket_id __asm("d1") = (_ReleaseSocket_id); \ + __asm volatile ("jsr a6@(-150:W)" \ + : "=r"(__ReleaseSocket__re) \ + : "r"(__ReleaseSocket__bn), "r"(__ReleaseSocket_sock), "r"(__ReleaseSocket_id) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __ReleaseSocket__re; \ + }); \ + _ReleaseSocket__re; \ +}) + +#define ReleaseCopyOfSocket(sock, id) ({ \ + LONG _ReleaseCopyOfSocket_sock = (sock); \ + LONG _ReleaseCopyOfSocket_id = (id); \ + LONG _ReleaseCopyOfSocket__re = \ + ({ \ + register struct Library * const __ReleaseCopyOfSocket__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __ReleaseCopyOfSocket__re __asm("d0"); \ + register LONG __ReleaseCopyOfSocket_sock __asm("d0") = (_ReleaseCopyOfSocket_sock); \ + register LONG __ReleaseCopyOfSocket_id __asm("d1") = (_ReleaseCopyOfSocket_id); \ + __asm volatile ("jsr a6@(-156:W)" \ + : "=r"(__ReleaseCopyOfSocket__re) \ + : "r"(__ReleaseCopyOfSocket__bn), "r"(__ReleaseCopyOfSocket_sock), "r"(__ReleaseCopyOfSocket_id) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __ReleaseCopyOfSocket__re; \ + }); \ + _ReleaseCopyOfSocket__re; \ +}) + +#define Errno() ({ \ + LONG _Errno__re = \ + ({ \ + register struct Library * const __Errno__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __Errno__re __asm("d0"); \ + __asm volatile ("jsr a6@(-162:W)" \ + : "=r"(__Errno__re) \ + : "r"(__Errno__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __Errno__re; \ + }); \ + _Errno__re; \ +}) + +#define SetErrnoPtr(errno_ptr, size) ({ \ + APTR _SetErrnoPtr_errno_ptr = (errno_ptr); \ + LONG _SetErrnoPtr_size = (size); \ + { \ + register struct Library * const __SetErrnoPtr__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register APTR __SetErrnoPtr_errno_ptr __asm("a0") = (_SetErrnoPtr_errno_ptr); \ + register LONG __SetErrnoPtr_size __asm("d0") = (_SetErrnoPtr_size); \ + __asm volatile ("jsr a6@(-168:W)" \ + : \ + : "r"(__SetErrnoPtr__bn), "r"(__SetErrnoPtr_errno_ptr), "r"(__SetErrnoPtr_size) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define Inet_NtoA(ip) ({ \ + LONG _Inet_NtoA_ip = (ip); \ + STRPTR _Inet_NtoA__re = \ + ({ \ + register struct Library * const __Inet_NtoA__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register STRPTR __Inet_NtoA__re __asm("d0"); \ + register LONG __Inet_NtoA_ip __asm("d0") = (_Inet_NtoA_ip); \ + __asm volatile ("jsr a6@(-174:W)" \ + : "=r"(__Inet_NtoA__re) \ + : "r"(__Inet_NtoA__bn), "r"(__Inet_NtoA_ip) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __Inet_NtoA__re; \ + }); \ + _Inet_NtoA__re; \ +}) + +#define inet_addr(cp) ({ \ + STRPTR _inet_addr_cp = (cp); \ + in_addr_t _inet_addr__re = \ + ({ \ + register struct Library * const __inet_addr__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register in_addr_t __inet_addr__re __asm("d0"); \ + register STRPTR __inet_addr_cp __asm("a0") = (_inet_addr_cp); \ + __asm volatile ("jsr a6@(-180:W)" \ + : "=r"(__inet_addr__re) \ + : "r"(__inet_addr__bn), "r"(__inet_addr_cp) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __inet_addr__re; \ + }); \ + _inet_addr__re; \ +}) + +#define Inet_LnaOf(in) ({ \ + LONG _Inet_LnaOf_in = (in); \ + in_addr_t _Inet_LnaOf__re = \ + ({ \ + register struct Library * const __Inet_LnaOf__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register in_addr_t __Inet_LnaOf__re __asm("d0"); \ + register LONG __Inet_LnaOf_in __asm("d0") = (_Inet_LnaOf_in); \ + __asm volatile ("jsr a6@(-186:W)" \ + : "=r"(__Inet_LnaOf__re) \ + : "r"(__Inet_LnaOf__bn), "r"(__Inet_LnaOf_in) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __Inet_LnaOf__re; \ + }); \ + _Inet_LnaOf__re; \ +}) + +#define Inet_NetOf(in) ({ \ + LONG _Inet_NetOf_in = (in); \ + in_addr_t _Inet_NetOf__re = \ + ({ \ + register struct Library * const __Inet_NetOf__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register in_addr_t __Inet_NetOf__re __asm("d0"); \ + register LONG __Inet_NetOf_in __asm("d0") = (_Inet_NetOf_in); \ + __asm volatile ("jsr a6@(-192:W)" \ + : "=r"(__Inet_NetOf__re) \ + : "r"(__Inet_NetOf__bn), "r"(__Inet_NetOf_in) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __Inet_NetOf__re; \ + }); \ + _Inet_NetOf__re; \ +}) + +#define Inet_MakeAddr(net, host) ({ \ + LONG _Inet_MakeAddr_net = (net); \ + LONG _Inet_MakeAddr_host = (host); \ + in_addr_t _Inet_MakeAddr__re = \ + ({ \ + register struct Library * const __Inet_MakeAddr__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register in_addr_t __Inet_MakeAddr__re __asm("d0"); \ + register LONG __Inet_MakeAddr_net __asm("d0") = (_Inet_MakeAddr_net); \ + register LONG __Inet_MakeAddr_host __asm("d1") = (_Inet_MakeAddr_host); \ + __asm volatile ("jsr a6@(-198:W)" \ + : "=r"(__Inet_MakeAddr__re) \ + : "r"(__Inet_MakeAddr__bn), "r"(__Inet_MakeAddr_net), "r"(__Inet_MakeAddr_host) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __Inet_MakeAddr__re; \ + }); \ + _Inet_MakeAddr__re; \ +}) + +#define inet_network(cp) ({ \ + STRPTR _inet_network_cp = (cp); \ + in_addr_t _inet_network__re = \ + ({ \ + register struct Library * const __inet_network__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register in_addr_t __inet_network__re __asm("d0"); \ + register STRPTR __inet_network_cp __asm("a0") = (_inet_network_cp); \ + __asm volatile ("jsr a6@(-204:W)" \ + : "=r"(__inet_network__re) \ + : "r"(__inet_network__bn), "r"(__inet_network_cp) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __inet_network__re; \ + }); \ + _inet_network__re; \ +}) + +#define gethostbyname(name) ({ \ + STRPTR _gethostbyname_name = (name); \ + struct hostent * _gethostbyname__re = \ + ({ \ + register struct Library * const __gethostbyname__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct hostent * __gethostbyname__re __asm("d0"); \ + register STRPTR __gethostbyname_name __asm("a0") = (_gethostbyname_name); \ + __asm volatile ("jsr a6@(-210:W)" \ + : "=r"(__gethostbyname__re) \ + : "r"(__gethostbyname__bn), "r"(__gethostbyname_name) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __gethostbyname__re; \ + }); \ + _gethostbyname__re; \ +}) + +#define gethostbyaddr(addr, len, type) ({ \ + STRPTR _gethostbyaddr_addr = (addr); \ + LONG _gethostbyaddr_len = (len); \ + LONG _gethostbyaddr_type = (type); \ + struct hostent * _gethostbyaddr__re = \ + ({ \ + register struct Library * const __gethostbyaddr__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct hostent * __gethostbyaddr__re __asm("d0"); \ + register STRPTR __gethostbyaddr_addr __asm("a0") = (_gethostbyaddr_addr); \ + register LONG __gethostbyaddr_len __asm("d0") = (_gethostbyaddr_len); \ + register LONG __gethostbyaddr_type __asm("d1") = (_gethostbyaddr_type); \ + __asm volatile ("jsr a6@(-216:W)" \ + : "=r"(__gethostbyaddr__re) \ + : "r"(__gethostbyaddr__bn), "r"(__gethostbyaddr_addr), "r"(__gethostbyaddr_len), "r"(__gethostbyaddr_type) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __gethostbyaddr__re; \ + }); \ + _gethostbyaddr__re; \ +}) + +#define getnetbyname(name) ({ \ + STRPTR _getnetbyname_name = (name); \ + struct netent * _getnetbyname__re = \ + ({ \ + register struct Library * const __getnetbyname__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct netent * __getnetbyname__re __asm("d0"); \ + register STRPTR __getnetbyname_name __asm("a0") = (_getnetbyname_name); \ + __asm volatile ("jsr a6@(-222:W)" \ + : "=r"(__getnetbyname__re) \ + : "r"(__getnetbyname__bn), "r"(__getnetbyname_name) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getnetbyname__re; \ + }); \ + _getnetbyname__re; \ +}) + +#define getnetbyaddr(net, type) ({ \ + LONG _getnetbyaddr_net = (net); \ + LONG _getnetbyaddr_type = (type); \ + struct netent * _getnetbyaddr__re = \ + ({ \ + register struct Library * const __getnetbyaddr__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct netent * __getnetbyaddr__re __asm("d0"); \ + register LONG __getnetbyaddr_net __asm("d0") = (_getnetbyaddr_net); \ + register LONG __getnetbyaddr_type __asm("d1") = (_getnetbyaddr_type); \ + __asm volatile ("jsr a6@(-228:W)" \ + : "=r"(__getnetbyaddr__re) \ + : "r"(__getnetbyaddr__bn), "r"(__getnetbyaddr_net), "r"(__getnetbyaddr_type) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getnetbyaddr__re; \ + }); \ + _getnetbyaddr__re; \ +}) + +#define getservbyname(name, proto) ({ \ + STRPTR _getservbyname_name = (name); \ + STRPTR _getservbyname_proto = (proto); \ + struct servent * _getservbyname__re = \ + ({ \ + register struct Library * const __getservbyname__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct servent * __getservbyname__re __asm("d0"); \ + register STRPTR __getservbyname_name __asm("a0") = (_getservbyname_name); \ + register STRPTR __getservbyname_proto __asm("a1") = (_getservbyname_proto); \ + __asm volatile ("jsr a6@(-234:W)" \ + : "=r"(__getservbyname__re) \ + : "r"(__getservbyname__bn), "r"(__getservbyname_name), "r"(__getservbyname_proto) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getservbyname__re; \ + }); \ + _getservbyname__re; \ +}) + +#define getservbyport(port, proto) ({ \ + LONG _getservbyport_port = (port); \ + STRPTR _getservbyport_proto = (proto); \ + struct servent * _getservbyport__re = \ + ({ \ + register struct Library * const __getservbyport__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct servent * __getservbyport__re __asm("d0"); \ + register LONG __getservbyport_port __asm("d0") = (_getservbyport_port); \ + register STRPTR __getservbyport_proto __asm("a0") = (_getservbyport_proto); \ + __asm volatile ("jsr a6@(-240:W)" \ + : "=r"(__getservbyport__re) \ + : "r"(__getservbyport__bn), "r"(__getservbyport_port), "r"(__getservbyport_proto) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getservbyport__re; \ + }); \ + _getservbyport__re; \ +}) + +#define getprotobyname(name) ({ \ + STRPTR _getprotobyname_name = (name); \ + struct protoent * _getprotobyname__re = \ + ({ \ + register struct Library * const __getprotobyname__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct protoent * __getprotobyname__re __asm("d0"); \ + register STRPTR __getprotobyname_name __asm("a0") = (_getprotobyname_name); \ + __asm volatile ("jsr a6@(-246:W)" \ + : "=r"(__getprotobyname__re) \ + : "r"(__getprotobyname__bn), "r"(__getprotobyname_name) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getprotobyname__re; \ + }); \ + _getprotobyname__re; \ +}) + +#define getprotobynumber(proto) ({ \ + LONG _getprotobynumber_proto = (proto); \ + struct protoent * _getprotobynumber__re = \ + ({ \ + register struct Library * const __getprotobynumber__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct protoent * __getprotobynumber__re __asm("d0"); \ + register LONG __getprotobynumber_proto __asm("d0") = (_getprotobynumber_proto); \ + __asm volatile ("jsr a6@(-252:W)" \ + : "=r"(__getprotobynumber__re) \ + : "r"(__getprotobynumber__bn), "r"(__getprotobynumber_proto) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getprotobynumber__re; \ + }); \ + _getprotobynumber__re; \ +}) + +#define vsyslog(pri, msg, args) ({ \ + LONG _vsyslog_pri = (pri); \ + STRPTR _vsyslog_msg = (msg); \ + APTR _vsyslog_args = (args); \ + { \ + register struct Library * const __vsyslog__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __vsyslog_pri __asm("d0") = (_vsyslog_pri); \ + register STRPTR __vsyslog_msg __asm("a0") = (_vsyslog_msg); \ + register APTR __vsyslog_args __asm("a1") = (_vsyslog_args); \ + __asm volatile ("jsr a6@(-258:W)" \ + : \ + : "r"(__vsyslog__bn), "r"(__vsyslog_pri), "r"(__vsyslog_msg), "r"(__vsyslog_args) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#ifndef NO_INLINE_STDARG +static __inline__ VOID ___syslog(struct Library * SocketBase, LONG pri, STRPTR msg, LONG args, ...) +{ + vsyslog(pri, msg, (APTR) &args); +} + +#define syslog(pri, msg...) ___syslog(BSDSOCKET_BASE_NAME, pri, msg) +#endif + +#define Dup2Socket(old_socket, new_socket) ({ \ + LONG _Dup2Socket_old_socket = (old_socket); \ + LONG _Dup2Socket_new_socket = (new_socket); \ + LONG _Dup2Socket__re = \ + ({ \ + register struct Library * const __Dup2Socket__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __Dup2Socket__re __asm("d0"); \ + register LONG __Dup2Socket_old_socket __asm("d0") = (_Dup2Socket_old_socket); \ + register LONG __Dup2Socket_new_socket __asm("d1") = (_Dup2Socket_new_socket); \ + __asm volatile ("jsr a6@(-264:W)" \ + : "=r"(__Dup2Socket__re) \ + : "r"(__Dup2Socket__bn), "r"(__Dup2Socket_old_socket), "r"(__Dup2Socket_new_socket) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __Dup2Socket__re; \ + }); \ + _Dup2Socket__re; \ +}) + +#define sendmsg(sock, msg, flags) ({ \ + LONG _sendmsg_sock = (sock); \ + struct msghdr * _sendmsg_msg = (msg); \ + LONG _sendmsg_flags = (flags); \ + LONG _sendmsg__re = \ + ({ \ + register struct Library * const __sendmsg__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __sendmsg__re __asm("d0"); \ + register LONG __sendmsg_sock __asm("d0") = (_sendmsg_sock); \ + register struct msghdr * __sendmsg_msg __asm("a0") = (_sendmsg_msg); \ + register LONG __sendmsg_flags __asm("d1") = (_sendmsg_flags); \ + __asm volatile ("jsr a6@(-270:W)" \ + : "=r"(__sendmsg__re) \ + : "r"(__sendmsg__bn), "r"(__sendmsg_sock), "r"(__sendmsg_msg), "r"(__sendmsg_flags) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __sendmsg__re; \ + }); \ + _sendmsg__re; \ +}) + +#define recvmsg(sock, msg, flags) ({ \ + LONG _recvmsg_sock = (sock); \ + struct msghdr * _recvmsg_msg = (msg); \ + LONG _recvmsg_flags = (flags); \ + LONG _recvmsg__re = \ + ({ \ + register struct Library * const __recvmsg__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __recvmsg__re __asm("d0"); \ + register LONG __recvmsg_sock __asm("d0") = (_recvmsg_sock); \ + register struct msghdr * __recvmsg_msg __asm("a0") = (_recvmsg_msg); \ + register LONG __recvmsg_flags __asm("d1") = (_recvmsg_flags); \ + __asm volatile ("jsr a6@(-276:W)" \ + : "=r"(__recvmsg__re) \ + : "r"(__recvmsg__bn), "r"(__recvmsg_sock), "r"(__recvmsg_msg), "r"(__recvmsg_flags) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __recvmsg__re; \ + }); \ + _recvmsg__re; \ +}) + +#define gethostname(name, namelen) ({ \ + STRPTR _gethostname_name = (name); \ + LONG _gethostname_namelen = (namelen); \ + LONG _gethostname__re = \ + ({ \ + register struct Library * const __gethostname__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __gethostname__re __asm("d0"); \ + register STRPTR __gethostname_name __asm("a0") = (_gethostname_name); \ + register LONG __gethostname_namelen __asm("d0") = (_gethostname_namelen); \ + __asm volatile ("jsr a6@(-282:W)" \ + : "=r"(__gethostname__re) \ + : "r"(__gethostname__bn), "r"(__gethostname_name), "r"(__gethostname_namelen) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __gethostname__re; \ + }); \ + _gethostname__re; \ +}) + +#define gethostid() ({ \ + in_addr_t _gethostid__re = \ + ({ \ + register struct Library * const __gethostid__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register in_addr_t __gethostid__re __asm("d0"); \ + __asm volatile ("jsr a6@(-288:W)" \ + : "=r"(__gethostid__re) \ + : "r"(__gethostid__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __gethostid__re; \ + }); \ + _gethostid__re; \ +}) + +#define SocketBaseTagList(tags) ({ \ + struct TagItem * _SocketBaseTagList_tags = (tags); \ + LONG _SocketBaseTagList__re = \ + ({ \ + register struct Library * const __SocketBaseTagList__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __SocketBaseTagList__re __asm("d0"); \ + register struct TagItem * __SocketBaseTagList_tags __asm("a0") = (_SocketBaseTagList_tags); \ + __asm volatile ("jsr a6@(-294:W)" \ + : "=r"(__SocketBaseTagList__re) \ + : "r"(__SocketBaseTagList__bn), "r"(__SocketBaseTagList_tags) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __SocketBaseTagList__re; \ + }); \ + _SocketBaseTagList__re; \ +}) + +#ifndef NO_INLINE_STDARG +static __inline__ LONG ___SocketBaseTags(struct Library * SocketBase, Tag tags, ...) +{ + return SocketBaseTagList((struct TagItem *) &tags); +} + +#define SocketBaseTags(tags...) ___SocketBaseTags(BSDSOCKET_BASE_NAME, tags) +#endif + +#define GetSocketEvents(event_ptr) ({ \ + ULONG * _GetSocketEvents_event_ptr = (event_ptr); \ + LONG _GetSocketEvents__re = \ + ({ \ + register struct Library * const __GetSocketEvents__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __GetSocketEvents__re __asm("d0"); \ + register ULONG * __GetSocketEvents_event_ptr __asm("a0") = (_GetSocketEvents_event_ptr); \ + __asm volatile ("jsr a6@(-300:W)" \ + : "=r"(__GetSocketEvents__re) \ + : "r"(__GetSocketEvents__bn), "r"(__GetSocketEvents_event_ptr) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __GetSocketEvents__re; \ + }); \ + _GetSocketEvents__re; \ +}) + +#define bpf_open(channel) ({ \ + LONG _bpf_open_channel = (channel); \ + LONG _bpf_open__re = \ + ({ \ + register struct Library * const __bpf_open__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __bpf_open__re __asm("d0"); \ + register LONG __bpf_open_channel __asm("d0") = (_bpf_open_channel); \ + __asm volatile ("jsr a6@(-366:W)" \ + : "=r"(__bpf_open__re) \ + : "r"(__bpf_open__bn), "r"(__bpf_open_channel) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __bpf_open__re; \ + }); \ + _bpf_open__re; \ +}) + +#define bpf_close(channel) ({ \ + LONG _bpf_close_channel = (channel); \ + LONG _bpf_close__re = \ + ({ \ + register struct Library * const __bpf_close__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __bpf_close__re __asm("d0"); \ + register LONG __bpf_close_channel __asm("d0") = (_bpf_close_channel); \ + __asm volatile ("jsr a6@(-372:W)" \ + : "=r"(__bpf_close__re) \ + : "r"(__bpf_close__bn), "r"(__bpf_close_channel) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __bpf_close__re; \ + }); \ + _bpf_close__re; \ +}) + +#define bpf_read(channel, buffer, len) ({ \ + LONG _bpf_read_channel = (channel); \ + APTR _bpf_read_buffer = (buffer); \ + LONG _bpf_read_len = (len); \ + LONG _bpf_read__re = \ + ({ \ + register struct Library * const __bpf_read__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __bpf_read__re __asm("d0"); \ + register LONG __bpf_read_channel __asm("d0") = (_bpf_read_channel); \ + register APTR __bpf_read_buffer __asm("a0") = (_bpf_read_buffer); \ + register LONG __bpf_read_len __asm("d1") = (_bpf_read_len); \ + __asm volatile ("jsr a6@(-378:W)" \ + : "=r"(__bpf_read__re) \ + : "r"(__bpf_read__bn), "r"(__bpf_read_channel), "r"(__bpf_read_buffer), "r"(__bpf_read_len) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __bpf_read__re; \ + }); \ + _bpf_read__re; \ +}) + +#define bpf_write(channel, buffer, len) ({ \ + LONG _bpf_write_channel = (channel); \ + APTR _bpf_write_buffer = (buffer); \ + LONG _bpf_write_len = (len); \ + LONG _bpf_write__re = \ + ({ \ + register struct Library * const __bpf_write__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __bpf_write__re __asm("d0"); \ + register LONG __bpf_write_channel __asm("d0") = (_bpf_write_channel); \ + register APTR __bpf_write_buffer __asm("a0") = (_bpf_write_buffer); \ + register LONG __bpf_write_len __asm("d1") = (_bpf_write_len); \ + __asm volatile ("jsr a6@(-384:W)" \ + : "=r"(__bpf_write__re) \ + : "r"(__bpf_write__bn), "r"(__bpf_write_channel), "r"(__bpf_write_buffer), "r"(__bpf_write_len) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __bpf_write__re; \ + }); \ + _bpf_write__re; \ +}) + +#define bpf_set_notify_mask(channel, signal_mask) ({ \ + LONG _bpf_set_notify_mask_channel = (channel); \ + ULONG _bpf_set_notify_mask_signal_mask = (signal_mask); \ + LONG _bpf_set_notify_mask__re = \ + ({ \ + register struct Library * const __bpf_set_notify_mask__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __bpf_set_notify_mask__re __asm("d0"); \ + register LONG __bpf_set_notify_mask_channel __asm("d1") = (_bpf_set_notify_mask_channel); \ + register ULONG __bpf_set_notify_mask_signal_mask __asm("d0") = (_bpf_set_notify_mask_signal_mask); \ + __asm volatile ("jsr a6@(-390:W)" \ + : "=r"(__bpf_set_notify_mask__re) \ + : "r"(__bpf_set_notify_mask__bn), "r"(__bpf_set_notify_mask_channel), "r"(__bpf_set_notify_mask_signal_mask) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __bpf_set_notify_mask__re; \ + }); \ + _bpf_set_notify_mask__re; \ +}) + +#define bpf_set_interrupt_mask(channel, signal_mask) ({ \ + LONG _bpf_set_interrupt_mask_channel = (channel); \ + ULONG _bpf_set_interrupt_mask_signal_mask = (signal_mask); \ + LONG _bpf_set_interrupt_mask__re = \ + ({ \ + register struct Library * const __bpf_set_interrupt_mask__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __bpf_set_interrupt_mask__re __asm("d0"); \ + register LONG __bpf_set_interrupt_mask_channel __asm("d0") = (_bpf_set_interrupt_mask_channel); \ + register ULONG __bpf_set_interrupt_mask_signal_mask __asm("d1") = (_bpf_set_interrupt_mask_signal_mask); \ + __asm volatile ("jsr a6@(-396:W)" \ + : "=r"(__bpf_set_interrupt_mask__re) \ + : "r"(__bpf_set_interrupt_mask__bn), "r"(__bpf_set_interrupt_mask_channel), "r"(__bpf_set_interrupt_mask_signal_mask) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __bpf_set_interrupt_mask__re; \ + }); \ + _bpf_set_interrupt_mask__re; \ +}) + +#define bpf_ioctl(channel, command, buffer) ({ \ + LONG _bpf_ioctl_channel = (channel); \ + ULONG _bpf_ioctl_command = (command); \ + APTR _bpf_ioctl_buffer = (buffer); \ + LONG _bpf_ioctl__re = \ + ({ \ + register struct Library * const __bpf_ioctl__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __bpf_ioctl__re __asm("d0"); \ + register LONG __bpf_ioctl_channel __asm("d0") = (_bpf_ioctl_channel); \ + register ULONG __bpf_ioctl_command __asm("d1") = (_bpf_ioctl_command); \ + register APTR __bpf_ioctl_buffer __asm("a0") = (_bpf_ioctl_buffer); \ + __asm volatile ("jsr a6@(-402:W)" \ + : "=r"(__bpf_ioctl__re) \ + : "r"(__bpf_ioctl__bn), "r"(__bpf_ioctl_channel), "r"(__bpf_ioctl_command), "r"(__bpf_ioctl_buffer) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __bpf_ioctl__re; \ + }); \ + _bpf_ioctl__re; \ +}) + +#define bpf_data_waiting(channel) ({ \ + LONG _bpf_data_waiting_channel = (channel); \ + LONG _bpf_data_waiting__re = \ + ({ \ + register struct Library * const __bpf_data_waiting__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __bpf_data_waiting__re __asm("d0"); \ + register LONG __bpf_data_waiting_channel __asm("d0") = (_bpf_data_waiting_channel); \ + __asm volatile ("jsr a6@(-408:W)" \ + : "=r"(__bpf_data_waiting__re) \ + : "r"(__bpf_data_waiting__bn), "r"(__bpf_data_waiting_channel) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __bpf_data_waiting__re; \ + }); \ + _bpf_data_waiting__re; \ +}) + +#define AddRouteTagList(tags) ({ \ + struct TagItem * _AddRouteTagList_tags = (tags); \ + LONG _AddRouteTagList__re = \ + ({ \ + register struct Library * const __AddRouteTagList__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __AddRouteTagList__re __asm("d0"); \ + register struct TagItem * __AddRouteTagList_tags __asm("a0") = (_AddRouteTagList_tags); \ + __asm volatile ("jsr a6@(-414:W)" \ + : "=r"(__AddRouteTagList__re) \ + : "r"(__AddRouteTagList__bn), "r"(__AddRouteTagList_tags) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __AddRouteTagList__re; \ + }); \ + _AddRouteTagList__re; \ +}) + +#ifndef NO_INLINE_STDARG +static __inline__ LONG ___AddRouteTags(struct Library * SocketBase, Tag tags, ...) +{ + return AddRouteTagList((struct TagItem *) &tags); +} + +#define AddRouteTags(tags...) ___AddRouteTags(BSDSOCKET_BASE_NAME, tags) +#endif + +#define DeleteRouteTagList(tags) ({ \ + struct TagItem * _DeleteRouteTagList_tags = (tags); \ + LONG _DeleteRouteTagList__re = \ + ({ \ + register struct Library * const __DeleteRouteTagList__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __DeleteRouteTagList__re __asm("d0"); \ + register struct TagItem * __DeleteRouteTagList_tags __asm("a0") = (_DeleteRouteTagList_tags); \ + __asm volatile ("jsr a6@(-420:W)" \ + : "=r"(__DeleteRouteTagList__re) \ + : "r"(__DeleteRouteTagList__bn), "r"(__DeleteRouteTagList_tags) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __DeleteRouteTagList__re; \ + }); \ + _DeleteRouteTagList__re; \ +}) + +#ifndef NO_INLINE_STDARG +static __inline__ LONG ___DeleteRouteTags(struct Library * SocketBase, Tag tags, ...) +{ + return DeleteRouteTagList((struct TagItem *) &tags); +} + +#define DeleteRouteTags(tags...) ___DeleteRouteTags(BSDSOCKET_BASE_NAME, tags) +#endif + +#define FreeRouteInfo(buf) ({ \ + struct rt_msghdr * _FreeRouteInfo_buf = (buf); \ + { \ + register struct Library * const __FreeRouteInfo__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct rt_msghdr * __FreeRouteInfo_buf __asm("a0") = (_FreeRouteInfo_buf); \ + __asm volatile ("jsr a6@(-432:W)" \ + : \ + : "r"(__FreeRouteInfo__bn), "r"(__FreeRouteInfo_buf) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define GetRouteInfo(address_family, flags) ({ \ + LONG _GetRouteInfo_address_family = (address_family); \ + LONG _GetRouteInfo_flags = (flags); \ + struct rt_msghdr * _GetRouteInfo__re = \ + ({ \ + register struct Library * const __GetRouteInfo__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct rt_msghdr * __GetRouteInfo__re __asm("d0"); \ + register LONG __GetRouteInfo_address_family __asm("d0") = (_GetRouteInfo_address_family); \ + register LONG __GetRouteInfo_flags __asm("d1") = (_GetRouteInfo_flags); \ + __asm volatile ("jsr a6@(-438:W)" \ + : "=r"(__GetRouteInfo__re) \ + : "r"(__GetRouteInfo__bn), "r"(__GetRouteInfo_address_family), "r"(__GetRouteInfo_flags) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __GetRouteInfo__re; \ + }); \ + _GetRouteInfo__re; \ +}) + +#define AddInterfaceTagList(interface_name, device_name, unit, tags) ({ \ + STRPTR _AddInterfaceTagList_interface_name = (interface_name); \ + STRPTR _AddInterfaceTagList_device_name = (device_name); \ + LONG _AddInterfaceTagList_unit = (unit); \ + struct TagItem * _AddInterfaceTagList_tags = (tags); \ + LONG _AddInterfaceTagList__re = \ + ({ \ + register struct Library * const __AddInterfaceTagList__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __AddInterfaceTagList__re __asm("d0"); \ + register STRPTR __AddInterfaceTagList_interface_name __asm("a0") = (_AddInterfaceTagList_interface_name); \ + register STRPTR __AddInterfaceTagList_device_name __asm("a1") = (_AddInterfaceTagList_device_name); \ + register LONG __AddInterfaceTagList_unit __asm("d0") = (_AddInterfaceTagList_unit); \ + register struct TagItem * __AddInterfaceTagList_tags __asm("a2") = (_AddInterfaceTagList_tags); \ + __asm volatile ("jsr a6@(-444:W)" \ + : "=r"(__AddInterfaceTagList__re) \ + : "r"(__AddInterfaceTagList__bn), "r"(__AddInterfaceTagList_interface_name), "r"(__AddInterfaceTagList_device_name), "r"(__AddInterfaceTagList_unit), "r"(__AddInterfaceTagList_tags) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __AddInterfaceTagList__re; \ + }); \ + _AddInterfaceTagList__re; \ +}) + +#ifndef NO_INLINE_STDARG +static __inline__ LONG ___AddInterfaceTags(struct Library * SocketBase, STRPTR interface_name, STRPTR device_name, LONG unit, Tag tags, ...) +{ + return AddInterfaceTagList(interface_name, device_name, unit, (struct TagItem *) &tags); +} + +#define AddInterfaceTags(interface_name, device_name, unit...) ___AddInterfaceTags(BSDSOCKET_BASE_NAME, interface_name, device_name, unit) +#endif + +#define ConfigureInterfaceTagList(interface_name, tags) ({ \ + STRPTR _ConfigureInterfaceTagList_interface_name = (interface_name); \ + struct TagItem * _ConfigureInterfaceTagList_tags = (tags); \ + LONG _ConfigureInterfaceTagList__re = \ + ({ \ + register struct Library * const __ConfigureInterfaceTagList__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __ConfigureInterfaceTagList__re __asm("d0"); \ + register STRPTR __ConfigureInterfaceTagList_interface_name __asm("a0") = (_ConfigureInterfaceTagList_interface_name); \ + register struct TagItem * __ConfigureInterfaceTagList_tags __asm("a1") = (_ConfigureInterfaceTagList_tags); \ + __asm volatile ("jsr a6@(-450:W)" \ + : "=r"(__ConfigureInterfaceTagList__re) \ + : "r"(__ConfigureInterfaceTagList__bn), "r"(__ConfigureInterfaceTagList_interface_name), "r"(__ConfigureInterfaceTagList_tags) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __ConfigureInterfaceTagList__re; \ + }); \ + _ConfigureInterfaceTagList__re; \ +}) + +#ifndef NO_INLINE_STDARG +static __inline__ LONG ___ConfigureInterfaceTags(struct Library * SocketBase, STRPTR interface_name, Tag tags, ...) +{ + return ConfigureInterfaceTagList(interface_name, (struct TagItem *) &tags); +} + +#define ConfigureInterfaceTags(interface_name...) ___ConfigureInterfaceTags(BSDSOCKET_BASE_NAME, interface_name) +#endif + +#define ReleaseInterfaceList(list) ({ \ + struct List * _ReleaseInterfaceList_list = (list); \ + { \ + register struct Library * const __ReleaseInterfaceList__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct List * __ReleaseInterfaceList_list __asm("a0") = (_ReleaseInterfaceList_list); \ + __asm volatile ("jsr a6@(-456:W)" \ + : \ + : "r"(__ReleaseInterfaceList__bn), "r"(__ReleaseInterfaceList_list) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define ObtainInterfaceList() ({ \ + struct List * _ObtainInterfaceList__re = \ + ({ \ + register struct Library * const __ObtainInterfaceList__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct List * __ObtainInterfaceList__re __asm("d0"); \ + __asm volatile ("jsr a6@(-462:W)" \ + : "=r"(__ObtainInterfaceList__re) \ + : "r"(__ObtainInterfaceList__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __ObtainInterfaceList__re; \ + }); \ + _ObtainInterfaceList__re; \ +}) + +#define QueryInterfaceTagList(interface_name, tags) ({ \ + STRPTR _QueryInterfaceTagList_interface_name = (interface_name); \ + struct TagItem * _QueryInterfaceTagList_tags = (tags); \ + LONG _QueryInterfaceTagList__re = \ + ({ \ + register struct Library * const __QueryInterfaceTagList__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __QueryInterfaceTagList__re __asm("d0"); \ + register STRPTR __QueryInterfaceTagList_interface_name __asm("a0") = (_QueryInterfaceTagList_interface_name); \ + register struct TagItem * __QueryInterfaceTagList_tags __asm("a1") = (_QueryInterfaceTagList_tags); \ + __asm volatile ("jsr a6@(-468:W)" \ + : "=r"(__QueryInterfaceTagList__re) \ + : "r"(__QueryInterfaceTagList__bn), "r"(__QueryInterfaceTagList_interface_name), "r"(__QueryInterfaceTagList_tags) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __QueryInterfaceTagList__re; \ + }); \ + _QueryInterfaceTagList__re; \ +}) + +#ifndef NO_INLINE_STDARG +static __inline__ LONG ___QueryInterfaceTags(struct Library * SocketBase, STRPTR interface_name, Tag tags, ...) +{ + return QueryInterfaceTagList(interface_name, (struct TagItem *) &tags); +} + +#define QueryInterfaceTags(interface_name...) ___QueryInterfaceTags(BSDSOCKET_BASE_NAME, interface_name) +#endif + +#define CreateAddrAllocMessageA(version, protocol, interface_name, result_ptr, tags) ({ \ + LONG _CreateAddrAllocMessageA_version = (version); \ + LONG _CreateAddrAllocMessageA_protocol = (protocol); \ + STRPTR _CreateAddrAllocMessageA_interface_name = (interface_name); \ + struct AddressAllocationMessage ** _CreateAddrAllocMessageA_result_ptr = (result_ptr); \ + struct TagItem * _CreateAddrAllocMessageA_tags = (tags); \ + LONG _CreateAddrAllocMessageA__re = \ + ({ \ + register struct Library * const __CreateAddrAllocMessageA__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __CreateAddrAllocMessageA__re __asm("d0"); \ + register LONG __CreateAddrAllocMessageA_version __asm("d0") = (_CreateAddrAllocMessageA_version); \ + register LONG __CreateAddrAllocMessageA_protocol __asm("d1") = (_CreateAddrAllocMessageA_protocol); \ + register STRPTR __CreateAddrAllocMessageA_interface_name __asm("a0") = (_CreateAddrAllocMessageA_interface_name); \ + register struct AddressAllocationMessage ** __CreateAddrAllocMessageA_result_ptr __asm("a1") = (_CreateAddrAllocMessageA_result_ptr); \ + register struct TagItem * __CreateAddrAllocMessageA_tags __asm("a2") = (_CreateAddrAllocMessageA_tags); \ + __asm volatile ("jsr a6@(-474:W)" \ + : "=r"(__CreateAddrAllocMessageA__re) \ + : "r"(__CreateAddrAllocMessageA__bn), "r"(__CreateAddrAllocMessageA_version), "r"(__CreateAddrAllocMessageA_protocol), "r"(__CreateAddrAllocMessageA_interface_name), "r"(__CreateAddrAllocMessageA_result_ptr), "r"(__CreateAddrAllocMessageA_tags) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __CreateAddrAllocMessageA__re; \ + }); \ + _CreateAddrAllocMessageA__re; \ +}) + +#ifndef NO_INLINE_STDARG +static __inline__ LONG ___CreateAddrAllocMessage(struct Library * SocketBase, LONG version, LONG protocol, STRPTR interface_name, struct AddressAllocationMessage ** result_ptr, Tag tags, ...) +{ + return CreateAddrAllocMessageA(version, protocol, interface_name, result_ptr, (struct TagItem *) &tags); +} + +#define CreateAddrAllocMessage(version, protocol, interface_name, result_ptr...) ___CreateAddrAllocMessage(BSDSOCKET_BASE_NAME, version, protocol, interface_name, result_ptr) +#endif + +#define DeleteAddrAllocMessage(aam) ({ \ + struct AddressAllocationMessage * _DeleteAddrAllocMessage_aam = (aam); \ + { \ + register struct Library * const __DeleteAddrAllocMessage__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct AddressAllocationMessage * __DeleteAddrAllocMessage_aam __asm("a0") = (_DeleteAddrAllocMessage_aam); \ + __asm volatile ("jsr a6@(-480:W)" \ + : \ + : "r"(__DeleteAddrAllocMessage__bn), "r"(__DeleteAddrAllocMessage_aam) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define BeginInterfaceConfig(message) ({ \ + struct AddressAllocationMessage * _BeginInterfaceConfig_message = (message); \ + { \ + register struct Library * const __BeginInterfaceConfig__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct AddressAllocationMessage * __BeginInterfaceConfig_message __asm("a0") = (_BeginInterfaceConfig_message); \ + __asm volatile ("jsr a6@(-486:W)" \ + : \ + : "r"(__BeginInterfaceConfig__bn), "r"(__BeginInterfaceConfig_message) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define AbortInterfaceConfig(message) ({ \ + struct AddressAllocationMessage * _AbortInterfaceConfig_message = (message); \ + { \ + register struct Library * const __AbortInterfaceConfig__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct AddressAllocationMessage * __AbortInterfaceConfig_message __asm("a0") = (_AbortInterfaceConfig_message); \ + __asm volatile ("jsr a6@(-492:W)" \ + : \ + : "r"(__AbortInterfaceConfig__bn), "r"(__AbortInterfaceConfig_message) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define AddNetMonitorHookTagList(type, hook, tags) ({ \ + LONG _AddNetMonitorHookTagList_type = (type); \ + struct Hook * _AddNetMonitorHookTagList_hook = (hook); \ + struct TagItem * _AddNetMonitorHookTagList_tags = (tags); \ + LONG _AddNetMonitorHookTagList__re = \ + ({ \ + register struct Library * const __AddNetMonitorHookTagList__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __AddNetMonitorHookTagList__re __asm("d0"); \ + register LONG __AddNetMonitorHookTagList_type __asm("d0") = (_AddNetMonitorHookTagList_type); \ + register struct Hook * __AddNetMonitorHookTagList_hook __asm("a0") = (_AddNetMonitorHookTagList_hook); \ + register struct TagItem * __AddNetMonitorHookTagList_tags __asm("a1") = (_AddNetMonitorHookTagList_tags); \ + __asm volatile ("jsr a6@(-498:W)" \ + : "=r"(__AddNetMonitorHookTagList__re) \ + : "r"(__AddNetMonitorHookTagList__bn), "r"(__AddNetMonitorHookTagList_type), "r"(__AddNetMonitorHookTagList_hook), "r"(__AddNetMonitorHookTagList_tags) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __AddNetMonitorHookTagList__re; \ + }); \ + _AddNetMonitorHookTagList__re; \ +}) + +#ifndef NO_INLINE_STDARG +static __inline__ LONG ___AddNetMonitorHookTags(struct Library * SocketBase, LONG type, struct Hook * hook, Tag tags, ...) +{ + return AddNetMonitorHookTagList(type, hook, (struct TagItem *) &tags); +} + +#define AddNetMonitorHookTags(type, hook...) ___AddNetMonitorHookTags(BSDSOCKET_BASE_NAME, type, hook) +#endif + +#define RemoveNetMonitorHook(hook) ({ \ + struct Hook * _RemoveNetMonitorHook_hook = (hook); \ + { \ + register struct Library * const __RemoveNetMonitorHook__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct Hook * __RemoveNetMonitorHook_hook __asm("a0") = (_RemoveNetMonitorHook_hook); \ + __asm volatile ("jsr a6@(-504:W)" \ + : \ + : "r"(__RemoveNetMonitorHook__bn), "r"(__RemoveNetMonitorHook_hook) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define GetNetworkStatistics(type, version, destination, size) ({ \ + LONG _GetNetworkStatistics_type = (type); \ + LONG _GetNetworkStatistics_version = (version); \ + APTR _GetNetworkStatistics_destination = (destination); \ + LONG _GetNetworkStatistics_size = (size); \ + LONG _GetNetworkStatistics__re = \ + ({ \ + register struct Library * const __GetNetworkStatistics__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __GetNetworkStatistics__re __asm("d0"); \ + register LONG __GetNetworkStatistics_type __asm("d0") = (_GetNetworkStatistics_type); \ + register LONG __GetNetworkStatistics_version __asm("d1") = (_GetNetworkStatistics_version); \ + register APTR __GetNetworkStatistics_destination __asm("a0") = (_GetNetworkStatistics_destination); \ + register LONG __GetNetworkStatistics_size __asm("d2") = (_GetNetworkStatistics_size); \ + __asm volatile ("jsr a6@(-510:W)" \ + : "=r"(__GetNetworkStatistics__re) \ + : "r"(__GetNetworkStatistics__bn), "r"(__GetNetworkStatistics_type), "r"(__GetNetworkStatistics_version), "r"(__GetNetworkStatistics_destination), "r"(__GetNetworkStatistics_size) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __GetNetworkStatistics__re; \ + }); \ + _GetNetworkStatistics__re; \ +}) + +#define AddDomainNameServer(address) ({ \ + STRPTR _AddDomainNameServer_address = (address); \ + LONG _AddDomainNameServer__re = \ + ({ \ + register struct Library * const __AddDomainNameServer__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __AddDomainNameServer__re __asm("d0"); \ + register STRPTR __AddDomainNameServer_address __asm("a0") = (_AddDomainNameServer_address); \ + __asm volatile ("jsr a6@(-516:W)" \ + : "=r"(__AddDomainNameServer__re) \ + : "r"(__AddDomainNameServer__bn), "r"(__AddDomainNameServer_address) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __AddDomainNameServer__re; \ + }); \ + _AddDomainNameServer__re; \ +}) + +#define RemoveDomainNameServer(address) ({ \ + STRPTR _RemoveDomainNameServer_address = (address); \ + LONG _RemoveDomainNameServer__re = \ + ({ \ + register struct Library * const __RemoveDomainNameServer__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __RemoveDomainNameServer__re __asm("d0"); \ + register STRPTR __RemoveDomainNameServer_address __asm("a0") = (_RemoveDomainNameServer_address); \ + __asm volatile ("jsr a6@(-522:W)" \ + : "=r"(__RemoveDomainNameServer__re) \ + : "r"(__RemoveDomainNameServer__bn), "r"(__RemoveDomainNameServer_address) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __RemoveDomainNameServer__re; \ + }); \ + _RemoveDomainNameServer__re; \ +}) + +#define ReleaseDomainNameServerList(list) ({ \ + struct List * _ReleaseDomainNameServerList_list = (list); \ + { \ + register struct Library * const __ReleaseDomainNameServerList__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct List * __ReleaseDomainNameServerList_list __asm("a0") = (_ReleaseDomainNameServerList_list); \ + __asm volatile ("jsr a6@(-528:W)" \ + : \ + : "r"(__ReleaseDomainNameServerList__bn), "r"(__ReleaseDomainNameServerList_list) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define ObtainDomainNameServerList() ({ \ + struct List * _ObtainDomainNameServerList__re = \ + ({ \ + register struct Library * const __ObtainDomainNameServerList__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct List * __ObtainDomainNameServerList__re __asm("d0"); \ + __asm volatile ("jsr a6@(-534:W)" \ + : "=r"(__ObtainDomainNameServerList__re) \ + : "r"(__ObtainDomainNameServerList__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __ObtainDomainNameServerList__re; \ + }); \ + _ObtainDomainNameServerList__re; \ +}) + +#define setnetent(stay_open) ({ \ + LONG _setnetent_stay_open = (stay_open); \ + { \ + register struct Library * const __setnetent__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __setnetent_stay_open __asm("d0") = (_setnetent_stay_open); \ + __asm volatile ("jsr a6@(-540:W)" \ + : \ + : "r"(__setnetent__bn), "r"(__setnetent_stay_open) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define endnetent() ({ \ + register struct Library * const __endnetent__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + __asm volatile ("jsr a6@(-546:W)" \ + : \ + : "r"(__endnetent__bn) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ +}) + +#define getnetent() ({ \ + struct netent * _getnetent__re = \ + ({ \ + register struct Library * const __getnetent__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct netent * __getnetent__re __asm("d0"); \ + __asm volatile ("jsr a6@(-552:W)" \ + : "=r"(__getnetent__re) \ + : "r"(__getnetent__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getnetent__re; \ + }); \ + _getnetent__re; \ +}) + +#define setprotoent(stay_open) ({ \ + LONG _setprotoent_stay_open = (stay_open); \ + { \ + register struct Library * const __setprotoent__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __setprotoent_stay_open __asm("d0") = (_setprotoent_stay_open); \ + __asm volatile ("jsr a6@(-558:W)" \ + : \ + : "r"(__setprotoent__bn), "r"(__setprotoent_stay_open) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define endprotoent() ({ \ + register struct Library * const __endprotoent__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + __asm volatile ("jsr a6@(-564:W)" \ + : \ + : "r"(__endprotoent__bn) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ +}) + +#define getprotoent() ({ \ + struct protoent * _getprotoent__re = \ + ({ \ + register struct Library * const __getprotoent__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct protoent * __getprotoent__re __asm("d0"); \ + __asm volatile ("jsr a6@(-570:W)" \ + : "=r"(__getprotoent__re) \ + : "r"(__getprotoent__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getprotoent__re; \ + }); \ + _getprotoent__re; \ +}) + +#define setservent(stay_open) ({ \ + LONG _setservent_stay_open = (stay_open); \ + { \ + register struct Library * const __setservent__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __setservent_stay_open __asm("d0") = (_setservent_stay_open); \ + __asm volatile ("jsr a6@(-576:W)" \ + : \ + : "r"(__setservent__bn), "r"(__setservent_stay_open) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define endservent() ({ \ + register struct Library * const __endservent__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + __asm volatile ("jsr a6@(-582:W)" \ + : \ + : "r"(__endservent__bn) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ +}) + +#define getservent() ({ \ + struct servent * _getservent__re = \ + ({ \ + register struct Library * const __getservent__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct servent * __getservent__re __asm("d0"); \ + __asm volatile ("jsr a6@(-588:W)" \ + : "=r"(__getservent__re) \ + : "r"(__getservent__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getservent__re; \ + }); \ + _getservent__re; \ +}) + +#define inet_aton(cp, addr) ({ \ + STRPTR _inet_aton_cp = (cp); \ + struct in_addr * _inet_aton_addr = (addr); \ + LONG _inet_aton__re = \ + ({ \ + register struct Library * const __inet_aton__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __inet_aton__re __asm("d0"); \ + register STRPTR __inet_aton_cp __asm("a0") = (_inet_aton_cp); \ + register struct in_addr * __inet_aton_addr __asm("a1") = (_inet_aton_addr); \ + __asm volatile ("jsr a6@(-594:W)" \ + : "=r"(__inet_aton__re) \ + : "r"(__inet_aton__bn), "r"(__inet_aton_cp), "r"(__inet_aton_addr) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __inet_aton__re; \ + }); \ + _inet_aton__re; \ +}) + +#define inet_ntop(af, src, dst, size) ({ \ + LONG _inet_ntop_af = (af); \ + APTR _inet_ntop_src = (src); \ + STRPTR _inet_ntop_dst = (dst); \ + LONG _inet_ntop_size = (size); \ + STRPTR _inet_ntop__re = \ + ({ \ + register struct Library * const __inet_ntop__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register STRPTR __inet_ntop__re __asm("d0"); \ + register LONG __inet_ntop_af __asm("d0") = (_inet_ntop_af); \ + register APTR __inet_ntop_src __asm("a0") = (_inet_ntop_src); \ + register STRPTR __inet_ntop_dst __asm("a1") = (_inet_ntop_dst); \ + register LONG __inet_ntop_size __asm("d1") = (_inet_ntop_size); \ + __asm volatile ("jsr a6@(-600:W)" \ + : "=r"(__inet_ntop__re) \ + : "r"(__inet_ntop__bn), "r"(__inet_ntop_af), "r"(__inet_ntop_src), "r"(__inet_ntop_dst), "r"(__inet_ntop_size) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __inet_ntop__re; \ + }); \ + _inet_ntop__re; \ +}) + +#define inet_pton(af, src, dst) ({ \ + LONG _inet_pton_af = (af); \ + STRPTR _inet_pton_src = (src); \ + APTR _inet_pton_dst = (dst); \ + LONG _inet_pton__re = \ + ({ \ + register struct Library * const __inet_pton__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __inet_pton__re __asm("d0"); \ + register LONG __inet_pton_af __asm("d0") = (_inet_pton_af); \ + register STRPTR __inet_pton_src __asm("a0") = (_inet_pton_src); \ + register APTR __inet_pton_dst __asm("a1") = (_inet_pton_dst); \ + __asm volatile ("jsr a6@(-606:W)" \ + : "=r"(__inet_pton__re) \ + : "r"(__inet_pton__bn), "r"(__inet_pton_af), "r"(__inet_pton_src), "r"(__inet_pton_dst) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __inet_pton__re; \ + }); \ + _inet_pton__re; \ +}) + +#define In_LocalAddr(address) ({ \ + LONG _In_LocalAddr_address = (address); \ + LONG _In_LocalAddr__re = \ + ({ \ + register struct Library * const __In_LocalAddr__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __In_LocalAddr__re __asm("d0"); \ + register LONG __In_LocalAddr_address __asm("d0") = (_In_LocalAddr_address); \ + __asm volatile ("jsr a6@(-612:W)" \ + : "=r"(__In_LocalAddr__re) \ + : "r"(__In_LocalAddr__bn), "r"(__In_LocalAddr_address) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __In_LocalAddr__re; \ + }); \ + _In_LocalAddr__re; \ +}) + +#define In_CanForward(address) ({ \ + LONG _In_CanForward_address = (address); \ + LONG _In_CanForward__re = \ + ({ \ + register struct Library * const __In_CanForward__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __In_CanForward__re __asm("d0"); \ + register LONG __In_CanForward_address __asm("d0") = (_In_CanForward_address); \ + __asm volatile ("jsr a6@(-618:W)" \ + : "=r"(__In_CanForward__re) \ + : "r"(__In_CanForward__bn), "r"(__In_CanForward_address) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __In_CanForward__re; \ + }); \ + _In_CanForward__re; \ +}) + +#define mbuf_copym(m, off, len) ({ \ + struct mbuf * _mbuf_copym_m = (m); \ + LONG _mbuf_copym_off = (off); \ + LONG _mbuf_copym_len = (len); \ + struct mbuf * _mbuf_copym__re = \ + ({ \ + register struct Library * const __mbuf_copym__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct mbuf * __mbuf_copym__re __asm("d0"); \ + register struct mbuf * __mbuf_copym_m __asm("a0") = (_mbuf_copym_m); \ + register LONG __mbuf_copym_off __asm("d0") = (_mbuf_copym_off); \ + register LONG __mbuf_copym_len __asm("d1") = (_mbuf_copym_len); \ + __asm volatile ("jsr a6@(-624:W)" \ + : "=r"(__mbuf_copym__re) \ + : "r"(__mbuf_copym__bn), "r"(__mbuf_copym_m), "r"(__mbuf_copym_off), "r"(__mbuf_copym_len) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __mbuf_copym__re; \ + }); \ + _mbuf_copym__re; \ +}) + +#define mbuf_copyback(m, off, len, cp) ({ \ + struct mbuf * _mbuf_copyback_m = (m); \ + LONG _mbuf_copyback_off = (off); \ + LONG _mbuf_copyback_len = (len); \ + APTR _mbuf_copyback_cp = (cp); \ + LONG _mbuf_copyback__re = \ + ({ \ + register struct Library * const __mbuf_copyback__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __mbuf_copyback__re __asm("d0"); \ + register struct mbuf * __mbuf_copyback_m __asm("a0") = (_mbuf_copyback_m); \ + register LONG __mbuf_copyback_off __asm("d0") = (_mbuf_copyback_off); \ + register LONG __mbuf_copyback_len __asm("d1") = (_mbuf_copyback_len); \ + register APTR __mbuf_copyback_cp __asm("a1") = (_mbuf_copyback_cp); \ + __asm volatile ("jsr a6@(-630:W)" \ + : "=r"(__mbuf_copyback__re) \ + : "r"(__mbuf_copyback__bn), "r"(__mbuf_copyback_m), "r"(__mbuf_copyback_off), "r"(__mbuf_copyback_len), "r"(__mbuf_copyback_cp) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __mbuf_copyback__re; \ + }); \ + _mbuf_copyback__re; \ +}) + +#define mbuf_copydata(m, off, len, cp) ({ \ + struct mbuf * _mbuf_copydata_m = (m); \ + LONG _mbuf_copydata_off = (off); \ + LONG _mbuf_copydata_len = (len); \ + APTR _mbuf_copydata_cp = (cp); \ + LONG _mbuf_copydata__re = \ + ({ \ + register struct Library * const __mbuf_copydata__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __mbuf_copydata__re __asm("d0"); \ + register struct mbuf * __mbuf_copydata_m __asm("a0") = (_mbuf_copydata_m); \ + register LONG __mbuf_copydata_off __asm("d0") = (_mbuf_copydata_off); \ + register LONG __mbuf_copydata_len __asm("d1") = (_mbuf_copydata_len); \ + register APTR __mbuf_copydata_cp __asm("a1") = (_mbuf_copydata_cp); \ + __asm volatile ("jsr a6@(-636:W)" \ + : "=r"(__mbuf_copydata__re) \ + : "r"(__mbuf_copydata__bn), "r"(__mbuf_copydata_m), "r"(__mbuf_copydata_off), "r"(__mbuf_copydata_len), "r"(__mbuf_copydata_cp) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __mbuf_copydata__re; \ + }); \ + _mbuf_copydata__re; \ +}) + +#define mbuf_free(m) ({ \ + struct mbuf * _mbuf_free_m = (m); \ + struct mbuf * _mbuf_free__re = \ + ({ \ + register struct Library * const __mbuf_free__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct mbuf * __mbuf_free__re __asm("d0"); \ + register struct mbuf * __mbuf_free_m __asm("a0") = (_mbuf_free_m); \ + __asm volatile ("jsr a6@(-642:W)" \ + : "=r"(__mbuf_free__re) \ + : "r"(__mbuf_free__bn), "r"(__mbuf_free_m) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __mbuf_free__re; \ + }); \ + _mbuf_free__re; \ +}) + +#define mbuf_freem(m) ({ \ + struct mbuf * _mbuf_freem_m = (m); \ + { \ + register struct Library * const __mbuf_freem__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct mbuf * __mbuf_freem_m __asm("a0") = (_mbuf_freem_m); \ + __asm volatile ("jsr a6@(-648:W)" \ + : \ + : "r"(__mbuf_freem__bn), "r"(__mbuf_freem_m) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define mbuf_get() ({ \ + struct mbuf * _mbuf_get__re = \ + ({ \ + register struct Library * const __mbuf_get__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct mbuf * __mbuf_get__re __asm("d0"); \ + __asm volatile ("jsr a6@(-654:W)" \ + : "=r"(__mbuf_get__re) \ + : "r"(__mbuf_get__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __mbuf_get__re; \ + }); \ + _mbuf_get__re; \ +}) + +#define mbuf_gethdr() ({ \ + struct mbuf * _mbuf_gethdr__re = \ + ({ \ + register struct Library * const __mbuf_gethdr__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct mbuf * __mbuf_gethdr__re __asm("d0"); \ + __asm volatile ("jsr a6@(-660:W)" \ + : "=r"(__mbuf_gethdr__re) \ + : "r"(__mbuf_gethdr__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __mbuf_gethdr__re; \ + }); \ + _mbuf_gethdr__re; \ +}) + +#define mbuf_prepend(m, len) ({ \ + struct mbuf * _mbuf_prepend_m = (m); \ + LONG _mbuf_prepend_len = (len); \ + struct mbuf * _mbuf_prepend__re = \ + ({ \ + register struct Library * const __mbuf_prepend__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct mbuf * __mbuf_prepend__re __asm("d0"); \ + register struct mbuf * __mbuf_prepend_m __asm("a0") = (_mbuf_prepend_m); \ + register LONG __mbuf_prepend_len __asm("d0") = (_mbuf_prepend_len); \ + __asm volatile ("jsr a6@(-666:W)" \ + : "=r"(__mbuf_prepend__re) \ + : "r"(__mbuf_prepend__bn), "r"(__mbuf_prepend_m), "r"(__mbuf_prepend_len) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __mbuf_prepend__re; \ + }); \ + _mbuf_prepend__re; \ +}) + +#define mbuf_cat(m, n) ({ \ + struct mbuf * _mbuf_cat_m = (m); \ + struct mbuf * _mbuf_cat_n = (n); \ + LONG _mbuf_cat__re = \ + ({ \ + register struct Library * const __mbuf_cat__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __mbuf_cat__re __asm("d0"); \ + register struct mbuf * __mbuf_cat_m __asm("a0") = (_mbuf_cat_m); \ + register struct mbuf * __mbuf_cat_n __asm("a1") = (_mbuf_cat_n); \ + __asm volatile ("jsr a6@(-672:W)" \ + : "=r"(__mbuf_cat__re) \ + : "r"(__mbuf_cat__bn), "r"(__mbuf_cat_m), "r"(__mbuf_cat_n) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __mbuf_cat__re; \ + }); \ + _mbuf_cat__re; \ +}) + +#define mbuf_adj(mp, req_len) ({ \ + struct mbuf * _mbuf_adj_mp = (mp); \ + LONG _mbuf_adj_req_len = (req_len); \ + LONG _mbuf_adj__re = \ + ({ \ + register struct Library * const __mbuf_adj__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __mbuf_adj__re __asm("d0"); \ + register struct mbuf * __mbuf_adj_mp __asm("a0") = (_mbuf_adj_mp); \ + register LONG __mbuf_adj_req_len __asm("d0") = (_mbuf_adj_req_len); \ + __asm volatile ("jsr a6@(-678:W)" \ + : "=r"(__mbuf_adj__re) \ + : "r"(__mbuf_adj__bn), "r"(__mbuf_adj_mp), "r"(__mbuf_adj_req_len) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __mbuf_adj__re; \ + }); \ + _mbuf_adj__re; \ +}) + +#define mbuf_pullup(m, len) ({ \ + struct mbuf * _mbuf_pullup_m = (m); \ + LONG _mbuf_pullup_len = (len); \ + struct mbuf * _mbuf_pullup__re = \ + ({ \ + register struct Library * const __mbuf_pullup__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct mbuf * __mbuf_pullup__re __asm("d0"); \ + register struct mbuf * __mbuf_pullup_m __asm("a0") = (_mbuf_pullup_m); \ + register LONG __mbuf_pullup_len __asm("d0") = (_mbuf_pullup_len); \ + __asm volatile ("jsr a6@(-684:W)" \ + : "=r"(__mbuf_pullup__re) \ + : "r"(__mbuf_pullup__bn), "r"(__mbuf_pullup_m), "r"(__mbuf_pullup_len) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __mbuf_pullup__re; \ + }); \ + _mbuf_pullup__re; \ +}) + +#define ProcessIsServer(pr) ({ \ + struct Process * _ProcessIsServer_pr = (pr); \ + BOOL _ProcessIsServer__re = \ + ({ \ + register struct Library * const __ProcessIsServer__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register BOOL __ProcessIsServer__re __asm("d0"); \ + register struct Process * __ProcessIsServer_pr __asm("a0") = (_ProcessIsServer_pr); \ + __asm volatile ("jsr a6@(-690:W)" \ + : "=r"(__ProcessIsServer__re) \ + : "r"(__ProcessIsServer__bn), "r"(__ProcessIsServer_pr) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __ProcessIsServer__re; \ + }); \ + _ProcessIsServer__re; \ +}) + +#define ObtainServerSocket() ({ \ + LONG _ObtainServerSocket__re = \ + ({ \ + register struct Library * const __ObtainServerSocket__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __ObtainServerSocket__re __asm("d0"); \ + __asm volatile ("jsr a6@(-696:W)" \ + : "=r"(__ObtainServerSocket__re) \ + : "r"(__ObtainServerSocket__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __ObtainServerSocket__re; \ + }); \ + _ObtainServerSocket__re; \ +}) + +#define GetDefaultDomainName(buffer, buffer_size) ({ \ + STRPTR _GetDefaultDomainName_buffer = (buffer); \ + LONG _GetDefaultDomainName_buffer_size = (buffer_size); \ + BOOL _GetDefaultDomainName__re = \ + ({ \ + register struct Library * const __GetDefaultDomainName__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register BOOL __GetDefaultDomainName__re __asm("d0"); \ + register STRPTR __GetDefaultDomainName_buffer __asm("a0") = (_GetDefaultDomainName_buffer); \ + register LONG __GetDefaultDomainName_buffer_size __asm("d0") = (_GetDefaultDomainName_buffer_size); \ + __asm volatile ("jsr a6@(-702:W)" \ + : "=r"(__GetDefaultDomainName__re) \ + : "r"(__GetDefaultDomainName__bn), "r"(__GetDefaultDomainName_buffer), "r"(__GetDefaultDomainName_buffer_size) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __GetDefaultDomainName__re; \ + }); \ + _GetDefaultDomainName__re; \ +}) + +#define SetDefaultDomainName(buffer) ({ \ + STRPTR _SetDefaultDomainName_buffer = (buffer); \ + { \ + register struct Library * const __SetDefaultDomainName__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register STRPTR __SetDefaultDomainName_buffer __asm("a0") = (_SetDefaultDomainName_buffer); \ + __asm volatile ("jsr a6@(-708:W)" \ + : \ + : "r"(__SetDefaultDomainName__bn), "r"(__SetDefaultDomainName_buffer) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define ObtainRoadshowData(access) ({ \ + LONG _ObtainRoadshowData_access = (access); \ + struct List * _ObtainRoadshowData__re = \ + ({ \ + register struct Library * const __ObtainRoadshowData__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct List * __ObtainRoadshowData__re __asm("d0"); \ + register LONG __ObtainRoadshowData_access __asm("d0") = (_ObtainRoadshowData_access); \ + __asm volatile ("jsr a6@(-714:W)" \ + : "=r"(__ObtainRoadshowData__re) \ + : "r"(__ObtainRoadshowData__bn), "r"(__ObtainRoadshowData_access) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __ObtainRoadshowData__re; \ + }); \ + _ObtainRoadshowData__re; \ +}) + +#define ReleaseRoadshowData(list) ({ \ + struct List * _ReleaseRoadshowData_list = (list); \ + { \ + register struct Library * const __ReleaseRoadshowData__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct List * __ReleaseRoadshowData_list __asm("a0") = (_ReleaseRoadshowData_list); \ + __asm volatile ("jsr a6@(-720:W)" \ + : \ + : "r"(__ReleaseRoadshowData__bn), "r"(__ReleaseRoadshowData_list) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define ChangeRoadshowData(list, name, length, data) ({ \ + struct List * _ChangeRoadshowData_list = (list); \ + STRPTR _ChangeRoadshowData_name = (name); \ + ULONG _ChangeRoadshowData_length = (length); \ + APTR _ChangeRoadshowData_data = (data); \ + BOOL _ChangeRoadshowData__re = \ + ({ \ + register struct Library * const __ChangeRoadshowData__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register BOOL __ChangeRoadshowData__re __asm("d0"); \ + register struct List * __ChangeRoadshowData_list __asm("a0") = (_ChangeRoadshowData_list); \ + register STRPTR __ChangeRoadshowData_name __asm("a1") = (_ChangeRoadshowData_name); \ + register ULONG __ChangeRoadshowData_length __asm("d0") = (_ChangeRoadshowData_length); \ + register APTR __ChangeRoadshowData_data __asm("a2") = (_ChangeRoadshowData_data); \ + __asm volatile ("jsr a6@(-726:W)" \ + : "=r"(__ChangeRoadshowData__re) \ + : "r"(__ChangeRoadshowData__bn), "r"(__ChangeRoadshowData_list), "r"(__ChangeRoadshowData_name), "r"(__ChangeRoadshowData_length), "r"(__ChangeRoadshowData_data) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __ChangeRoadshowData__re; \ + }); \ + _ChangeRoadshowData__re; \ +}) + +#define RemoveInterface(interface_name, force) ({ \ + STRPTR _RemoveInterface_interface_name = (interface_name); \ + LONG _RemoveInterface_force = (force); \ + LONG _RemoveInterface__re = \ + ({ \ + register struct Library * const __RemoveInterface__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __RemoveInterface__re __asm("d0"); \ + register STRPTR __RemoveInterface_interface_name __asm("a0") = (_RemoveInterface_interface_name); \ + register LONG __RemoveInterface_force __asm("d0") = (_RemoveInterface_force); \ + __asm volatile ("jsr a6@(-732:W)" \ + : "=r"(__RemoveInterface__re) \ + : "r"(__RemoveInterface__bn), "r"(__RemoveInterface_interface_name), "r"(__RemoveInterface_force) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __RemoveInterface__re; \ + }); \ + _RemoveInterface__re; \ +}) + +#define gethostbyname_r(name, hp, buf, buflen, he) ({ \ + STRPTR _gethostbyname_r_name = (name); \ + struct hostent * _gethostbyname_r_hp = (hp); \ + APTR _gethostbyname_r_buf = (buf); \ + ULONG _gethostbyname_r_buflen = (buflen); \ + LONG * _gethostbyname_r_he = (he); \ + struct hostent * _gethostbyname_r__re = \ + ({ \ + register struct Library * const __gethostbyname_r__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct hostent * __gethostbyname_r__re __asm("d0"); \ + register STRPTR __gethostbyname_r_name __asm("a0") = (_gethostbyname_r_name); \ + register struct hostent * __gethostbyname_r_hp __asm("a1") = (_gethostbyname_r_hp); \ + register APTR __gethostbyname_r_buf __asm("a2") = (_gethostbyname_r_buf); \ + register ULONG __gethostbyname_r_buflen __asm("d0") = (_gethostbyname_r_buflen); \ + register LONG * __gethostbyname_r_he __asm("a3") = (_gethostbyname_r_he); \ + __asm volatile ("jsr a6@(-738:W)" \ + : "=r"(__gethostbyname_r__re) \ + : "r"(__gethostbyname_r__bn), "r"(__gethostbyname_r_name), "r"(__gethostbyname_r_hp), "r"(__gethostbyname_r_buf), "r"(__gethostbyname_r_buflen), "r"(__gethostbyname_r_he) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __gethostbyname_r__re; \ + }); \ + _gethostbyname_r__re; \ +}) + +#define gethostbyaddr_r(addr, len, type, hp, buf, buflen, he) ({ \ + STRPTR _gethostbyaddr_r_addr = (addr); \ + LONG _gethostbyaddr_r_len = (len); \ + LONG _gethostbyaddr_r_type = (type); \ + struct hostent * _gethostbyaddr_r_hp = (hp); \ + APTR _gethostbyaddr_r_buf = (buf); \ + ULONG _gethostbyaddr_r_buflen = (buflen); \ + LONG * _gethostbyaddr_r_he = (he); \ + struct hostent * _gethostbyaddr_r__re = \ + ({ \ + register struct Library * const __gethostbyaddr_r__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct hostent * __gethostbyaddr_r__re __asm("d0"); \ + register STRPTR __gethostbyaddr_r_addr __asm("a0") = (_gethostbyaddr_r_addr); \ + register LONG __gethostbyaddr_r_len __asm("d0") = (_gethostbyaddr_r_len); \ + register LONG __gethostbyaddr_r_type __asm("d1") = (_gethostbyaddr_r_type); \ + register struct hostent * __gethostbyaddr_r_hp __asm("a1") = (_gethostbyaddr_r_hp); \ + register APTR __gethostbyaddr_r_buf __asm("a2") = (_gethostbyaddr_r_buf); \ + register ULONG __gethostbyaddr_r_buflen __asm("d2") = (_gethostbyaddr_r_buflen); \ + register LONG * __gethostbyaddr_r_he __asm("a3") = (_gethostbyaddr_r_he); \ + __asm volatile ("jsr a6@(-744:W)" \ + : "=r"(__gethostbyaddr_r__re) \ + : "r"(__gethostbyaddr_r__bn), "r"(__gethostbyaddr_r_addr), "r"(__gethostbyaddr_r_len), "r"(__gethostbyaddr_r_type), "r"(__gethostbyaddr_r_hp), "r"(__gethostbyaddr_r_buf), "r"(__gethostbyaddr_r_buflen), "r"(__gethostbyaddr_r_he) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __gethostbyaddr_r__re; \ + }); \ + _gethostbyaddr_r__re; \ +}) + +#define freeaddrinfo(ai) ({ \ + struct addrinfo * _freeaddrinfo_ai = (ai); \ + { \ + register struct Library * const __freeaddrinfo__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register struct addrinfo * __freeaddrinfo_ai __asm("a0") = (_freeaddrinfo_ai); \ + __asm volatile ("jsr a6@(-804:W)" \ + : \ + : "r"(__freeaddrinfo__bn), "r"(__freeaddrinfo_ai) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + } \ +}) + +#define getaddrinfo(hostname, servname, hints, res) ({ \ + STRPTR _getaddrinfo_hostname = (hostname); \ + STRPTR _getaddrinfo_servname = (servname); \ + struct addrinfo * _getaddrinfo_hints = (hints); \ + struct addrinfo ** _getaddrinfo_res = (res); \ + LONG _getaddrinfo__re = \ + ({ \ + register struct Library * const __getaddrinfo__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __getaddrinfo__re __asm("d0"); \ + register STRPTR __getaddrinfo_hostname __asm("a0") = (_getaddrinfo_hostname); \ + register STRPTR __getaddrinfo_servname __asm("a1") = (_getaddrinfo_servname); \ + register struct addrinfo * __getaddrinfo_hints __asm("a2") = (_getaddrinfo_hints); \ + register struct addrinfo ** __getaddrinfo_res __asm("a3") = (_getaddrinfo_res); \ + __asm volatile ("jsr a6@(-810:W)" \ + : "=r"(__getaddrinfo__re) \ + : "r"(__getaddrinfo__bn), "r"(__getaddrinfo_hostname), "r"(__getaddrinfo_servname), "r"(__getaddrinfo_hints), "r"(__getaddrinfo_res) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getaddrinfo__re; \ + }); \ + _getaddrinfo__re; \ +}) + +#define gai_strerror(errnum) ({ \ + LONG _gai_strerror_errnum = (errnum); \ + STRPTR _gai_strerror__re = \ + ({ \ + register struct Library * const __gai_strerror__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register STRPTR __gai_strerror__re __asm("d0"); \ + register LONG __gai_strerror_errnum __asm("a0") = (_gai_strerror_errnum); \ + __asm volatile ("jsr a6@(-816:W)" \ + : "=r"(__gai_strerror__re) \ + : "r"(__gai_strerror__bn), "r"(__gai_strerror_errnum) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __gai_strerror__re; \ + }); \ + _gai_strerror__re; \ +}) + +#define getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) ({ \ + struct sockaddr * _getnameinfo_sa = (sa); \ + ULONG _getnameinfo_salen = (salen); \ + STRPTR _getnameinfo_host = (host); \ + ULONG _getnameinfo_hostlen = (hostlen); \ + STRPTR _getnameinfo_serv = (serv); \ + ULONG _getnameinfo_servlen = (servlen); \ + ULONG _getnameinfo_flags = (flags); \ + LONG _getnameinfo__re = \ + ({ \ + register struct Library * const __getnameinfo__bn __asm("a6") = (struct Library *) (BSDSOCKET_BASE_NAME);\ + register LONG __getnameinfo__re __asm("d0"); \ + register struct sockaddr * __getnameinfo_sa __asm("a0") = (_getnameinfo_sa); \ + register ULONG __getnameinfo_salen __asm("d0") = (_getnameinfo_salen); \ + register STRPTR __getnameinfo_host __asm("a1") = (_getnameinfo_host); \ + register ULONG __getnameinfo_hostlen __asm("d1") = (_getnameinfo_hostlen); \ + register STRPTR __getnameinfo_serv __asm("a2") = (_getnameinfo_serv); \ + register ULONG __getnameinfo_servlen __asm("d2") = (_getnameinfo_servlen); \ + register ULONG __getnameinfo_flags __asm("d3") = (_getnameinfo_flags); \ + __asm volatile ("jsr a6@(-822:W)" \ + : "=r"(__getnameinfo__re) \ + : "r"(__getnameinfo__bn), "r"(__getnameinfo_sa), "r"(__getnameinfo_salen), "r"(__getnameinfo_host), "r"(__getnameinfo_hostlen), "r"(__getnameinfo_serv), "r"(__getnameinfo_servlen), "r"(__getnameinfo_flags) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getnameinfo__re; \ + }); \ + _getnameinfo__re; \ +}) + +#endif /* _INLINE_BSDSOCKET_H */ diff --git a/netinclude/inline/usergroup.h b/netinclude/inline/usergroup.h new file mode 100755 index 0000000..1be6248 --- /dev/null +++ b/netinclude/inline/usergroup.h @@ -0,0 +1,626 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack; "usergroup.library" API + * Copyright © 2001-2017 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + * + * WARNING: The "usergroup.library" API must be considered obsolete and + * should not be used in new software. It is provided solely + * for backwards compatibility and legacy application software. + */ + +/* + * This file was created with fd2pragma V2.164 using the following options: + * + * fd2pragma usergroup_lib.sfd to RAM:inline-46 special 46 + */ + +#ifndef _INLINE_USERGROUP_H +#define _INLINE_USERGROUP_H + +#ifndef CLIB_USERGROUP_PROTOS_H +#define CLIB_USERGROUP_PROTOS_H +#endif + +#ifndef LIBRARIES_USERGROUP_H +#include +#endif +#ifndef PWD_H +#include +#endif +#ifndef GRP_H +#include +#endif + +#ifndef USERGROUP_BASE_NAME +#define USERGROUP_BASE_NAME UserGroupBase +#endif + +#define ug_SetupContextTagList(name, tags) ({ \ + STRPTR _ug_SetupContextTagList_name = (name); \ + struct TagItem * _ug_SetupContextTagList_tags = (tags); \ + LONG _ug_SetupContextTagList__re = \ + ({ \ + register struct Library * const __ug_SetupContextTagList__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __ug_SetupContextTagList__re __asm("d0"); \ + register STRPTR __ug_SetupContextTagList_name __asm("a0") = (_ug_SetupContextTagList_name); \ + register struct TagItem * __ug_SetupContextTagList_tags __asm("a1") = (_ug_SetupContextTagList_tags); \ + __asm volatile ("jsr a6@(-30:W)" \ + : "=r"(__ug_SetupContextTagList__re) \ + : "r"(__ug_SetupContextTagList__bn), "r"(__ug_SetupContextTagList_name), "r"(__ug_SetupContextTagList_tags) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __ug_SetupContextTagList__re; \ + }); \ + _ug_SetupContextTagList__re; \ +}) + +#ifndef NO_INLINE_STDARG +static __inline__ LONG ___ug_SetupContextTags(struct Library * UserGroupBase, STRPTR name, ...) +{ + return ug_SetupContextTagList(name, (struct TagItem *) ((ULONG) &name + sizeof(STRPTR))); +} + +#define ug_SetupContextTags(name...) ___ug_SetupContextTags(USERGROUP_BASE_NAME, name) +#endif + +#define ug_GetErr() ({ \ + LONG _ug_GetErr__re = \ + ({ \ + register struct Library * const __ug_GetErr__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __ug_GetErr__re __asm("d0"); \ + __asm volatile ("jsr a6@(-36:W)" \ + : "=r"(__ug_GetErr__re) \ + : "r"(__ug_GetErr__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __ug_GetErr__re; \ + }); \ + _ug_GetErr__re; \ +}) + +#define ug_StrError(err) ({ \ + LONG _ug_StrError_err = (err); \ + STRPTR _ug_StrError__re = \ + ({ \ + register struct Library * const __ug_StrError__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register STRPTR __ug_StrError__re __asm("d0"); \ + register LONG __ug_StrError_err __asm("d1") = (_ug_StrError_err); \ + __asm volatile ("jsr a6@(-42:W)" \ + : "=r"(__ug_StrError__re) \ + : "r"(__ug_StrError__bn), "r"(__ug_StrError_err) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __ug_StrError__re; \ + }); \ + _ug_StrError__re; \ +}) + +#define getuid() ({ \ + LONG _getuid__re = \ + ({ \ + register struct Library * const __getuid__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __getuid__re __asm("d0"); \ + __asm volatile ("jsr a6@(-48:W)" \ + : "=r"(__getuid__re) \ + : "r"(__getuid__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getuid__re; \ + }); \ + _getuid__re; \ +}) + +#define geteuid() ({ \ + LONG _geteuid__re = \ + ({ \ + register struct Library * const __geteuid__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __geteuid__re __asm("d0"); \ + __asm volatile ("jsr a6@(-54:W)" \ + : "=r"(__geteuid__re) \ + : "r"(__geteuid__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __geteuid__re; \ + }); \ + _geteuid__re; \ +}) + +#define setreuid(real, effective) ({ \ + LONG _setreuid_real = (real); \ + LONG _setreuid_effective = (effective); \ + LONG _setreuid__re = \ + ({ \ + register struct Library * const __setreuid__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __setreuid__re __asm("d0"); \ + register LONG __setreuid_real __asm("d0") = (_setreuid_real); \ + register LONG __setreuid_effective __asm("d1") = (_setreuid_effective); \ + __asm volatile ("jsr a6@(-60:W)" \ + : "=r"(__setreuid__re) \ + : "r"(__setreuid__bn), "r"(__setreuid_real), "r"(__setreuid_effective) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __setreuid__re; \ + }); \ + _setreuid__re; \ +}) + +#define setuid(uid) ({ \ + LONG _setuid_uid = (uid); \ + LONG _setuid__re = \ + ({ \ + register struct Library * const __setuid__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __setuid__re __asm("d0"); \ + register LONG __setuid_uid __asm("d0") = (_setuid_uid); \ + __asm volatile ("jsr a6@(-66:W)" \ + : "=r"(__setuid__re) \ + : "r"(__setuid__bn), "r"(__setuid_uid) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __setuid__re; \ + }); \ + _setuid__re; \ +}) + +#define getgid() ({ \ + LONG _getgid__re = \ + ({ \ + register struct Library * const __getgid__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __getgid__re __asm("d0"); \ + __asm volatile ("jsr a6@(-72:W)" \ + : "=r"(__getgid__re) \ + : "r"(__getgid__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getgid__re; \ + }); \ + _getgid__re; \ +}) + +#define getegid() ({ \ + LONG _getegid__re = \ + ({ \ + register struct Library * const __getegid__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __getegid__re __asm("d0"); \ + __asm volatile ("jsr a6@(-78:W)" \ + : "=r"(__getegid__re) \ + : "r"(__getegid__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getegid__re; \ + }); \ + _getegid__re; \ +}) + +#define setregid(real, effective) ({ \ + LONG _setregid_real = (real); \ + LONG _setregid_effective = (effective); \ + LONG _setregid__re = \ + ({ \ + register struct Library * const __setregid__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __setregid__re __asm("d0"); \ + register LONG __setregid_real __asm("d0") = (_setregid_real); \ + register LONG __setregid_effective __asm("d1") = (_setregid_effective); \ + __asm volatile ("jsr a6@(-84:W)" \ + : "=r"(__setregid__re) \ + : "r"(__setregid__bn), "r"(__setregid_real), "r"(__setregid_effective) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __setregid__re; \ + }); \ + _setregid__re; \ +}) + +#define setgid(gid) ({ \ + LONG _setgid_gid = (gid); \ + LONG _setgid__re = \ + ({ \ + register struct Library * const __setgid__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __setgid__re __asm("d0"); \ + register LONG __setgid_gid __asm("d0") = (_setgid_gid); \ + __asm volatile ("jsr a6@(-90:W)" \ + : "=r"(__setgid__re) \ + : "r"(__setgid__bn), "r"(__setgid_gid) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __setgid__re; \ + }); \ + _setgid__re; \ +}) + +#define getgroups(gidsetlen, gidset) ({ \ + LONG _getgroups_gidsetlen = (gidsetlen); \ + LONG * _getgroups_gidset = (gidset); \ + LONG _getgroups__re = \ + ({ \ + register struct Library * const __getgroups__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __getgroups__re __asm("d0"); \ + register LONG __getgroups_gidsetlen __asm("d0") = (_getgroups_gidsetlen); \ + register LONG * __getgroups_gidset __asm("a1") = (_getgroups_gidset); \ + __asm volatile ("jsr a6@(-96:W)" \ + : "=r"(__getgroups__re) \ + : "r"(__getgroups__bn), "r"(__getgroups_gidsetlen), "r"(__getgroups_gidset) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getgroups__re; \ + }); \ + _getgroups__re; \ +}) + +#define setgroups(gidsetlen, gidset) ({ \ + LONG _setgroups_gidsetlen = (gidsetlen); \ + LONG * _setgroups_gidset = (gidset); \ + LONG _setgroups__re = \ + ({ \ + register struct Library * const __setgroups__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __setgroups__re __asm("d0"); \ + register LONG __setgroups_gidsetlen __asm("d0") = (_setgroups_gidsetlen); \ + register LONG * __setgroups_gidset __asm("a1") = (_setgroups_gidset); \ + __asm volatile ("jsr a6@(-102:W)" \ + : "=r"(__setgroups__re) \ + : "r"(__setgroups__bn), "r"(__setgroups_gidsetlen), "r"(__setgroups_gidset) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __setgroups__re; \ + }); \ + _setgroups__re; \ +}) + +#define initgroups(name, basegid) ({ \ + STRPTR _initgroups_name = (name); \ + LONG _initgroups_basegid = (basegid); \ + LONG _initgroups__re = \ + ({ \ + register struct Library * const __initgroups__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __initgroups__re __asm("d0"); \ + register STRPTR __initgroups_name __asm("a1") = (_initgroups_name); \ + register LONG __initgroups_basegid __asm("d0") = (_initgroups_basegid); \ + __asm volatile ("jsr a6@(-108:W)" \ + : "=r"(__initgroups__re) \ + : "r"(__initgroups__bn), "r"(__initgroups_name), "r"(__initgroups_basegid) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __initgroups__re; \ + }); \ + _initgroups__re; \ +}) + +#define getpwnam(login) ({ \ + STRPTR _getpwnam_login = (login); \ + struct passwd * _getpwnam__re = \ + ({ \ + register struct Library * const __getpwnam__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register struct passwd * __getpwnam__re __asm("d0"); \ + register STRPTR __getpwnam_login __asm("a1") = (_getpwnam_login); \ + __asm volatile ("jsr a6@(-114:W)" \ + : "=r"(__getpwnam__re) \ + : "r"(__getpwnam__bn), "r"(__getpwnam_login) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getpwnam__re; \ + }); \ + _getpwnam__re; \ +}) + +#define getpwuid(uid) ({ \ + LONG _getpwuid_uid = (uid); \ + struct passwd * _getpwuid__re = \ + ({ \ + register struct Library * const __getpwuid__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register struct passwd * __getpwuid__re __asm("d0"); \ + register LONG __getpwuid_uid __asm("d0") = (_getpwuid_uid); \ + __asm volatile ("jsr a6@(-120:W)" \ + : "=r"(__getpwuid__re) \ + : "r"(__getpwuid__bn), "r"(__getpwuid_uid) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getpwuid__re; \ + }); \ + _getpwuid__re; \ +}) + +#define setpwent() ({ \ + register struct Library * const __setpwent__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + __asm volatile ("jsr a6@(-126:W)" \ + : \ + : "r"(__setpwent__bn) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ +}) + +#define getpwent() ({ \ + struct passwd * _getpwent__re = \ + ({ \ + register struct Library * const __getpwent__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register struct passwd * __getpwent__re __asm("d0"); \ + __asm volatile ("jsr a6@(-132:W)" \ + : "=r"(__getpwent__re) \ + : "r"(__getpwent__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getpwent__re; \ + }); \ + _getpwent__re; \ +}) + +#define endpwent() ({ \ + register struct Library * const __endpwent__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + __asm volatile ("jsr a6@(-138:W)" \ + : \ + : "r"(__endpwent__bn) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ +}) + +#define getgrnam(name) ({ \ + STRPTR _getgrnam_name = (name); \ + struct group * _getgrnam__re = \ + ({ \ + register struct Library * const __getgrnam__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register struct group * __getgrnam__re __asm("d0"); \ + register STRPTR __getgrnam_name __asm("a1") = (_getgrnam_name); \ + __asm volatile ("jsr a6@(-144:W)" \ + : "=r"(__getgrnam__re) \ + : "r"(__getgrnam__bn), "r"(__getgrnam_name) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getgrnam__re; \ + }); \ + _getgrnam__re; \ +}) + +#define getgrgid(gid) ({ \ + LONG _getgrgid_gid = (gid); \ + struct group * _getgrgid__re = \ + ({ \ + register struct Library * const __getgrgid__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register struct group * __getgrgid__re __asm("d0"); \ + register LONG __getgrgid_gid __asm("d0") = (_getgrgid_gid); \ + __asm volatile ("jsr a6@(-150:W)" \ + : "=r"(__getgrgid__re) \ + : "r"(__getgrgid__bn), "r"(__getgrgid_gid) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getgrgid__re; \ + }); \ + _getgrgid__re; \ +}) + +#define setgrent() ({ \ + register struct Library * const __setgrent__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + __asm volatile ("jsr a6@(-156:W)" \ + : \ + : "r"(__setgrent__bn) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ +}) + +#define getgrent() ({ \ + struct group * _getgrent__re = \ + ({ \ + register struct Library * const __getgrent__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register struct group * __getgrent__re __asm("d0"); \ + __asm volatile ("jsr a6@(-162:W)" \ + : "=r"(__getgrent__re) \ + : "r"(__getgrent__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getgrent__re; \ + }); \ + _getgrent__re; \ +}) + +#define endgrent() ({ \ + register struct Library * const __endgrent__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + __asm volatile ("jsr a6@(-168:W)" \ + : \ + : "r"(__endgrent__bn) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ +}) + +#define crypt(key, set) ({ \ + UBYTE * _crypt_key = (key); \ + UBYTE * _crypt_set = (set); \ + UBYTE * _crypt__re = \ + ({ \ + register struct Library * const __crypt__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register UBYTE * __crypt__re __asm("d0"); \ + register UBYTE * __crypt_key __asm("a0") = (_crypt_key); \ + register UBYTE * __crypt_set __asm("a1") = (_crypt_set); \ + __asm volatile ("jsr a6@(-174:W)" \ + : "=r"(__crypt__re) \ + : "r"(__crypt__bn), "r"(__crypt_key), "r"(__crypt_set) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __crypt__re; \ + }); \ + _crypt__re; \ +}) + +#define ug_GetSalt(user, buf, size) ({ \ + struct passwd * _ug_GetSalt_user = (user); \ + UBYTE * _ug_GetSalt_buf = (buf); \ + ULONG _ug_GetSalt_size = (size); \ + UBYTE * _ug_GetSalt__re = \ + ({ \ + register struct Library * const __ug_GetSalt__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register UBYTE * __ug_GetSalt__re __asm("d0"); \ + register struct passwd * __ug_GetSalt_user __asm("a0") = (_ug_GetSalt_user); \ + register UBYTE * __ug_GetSalt_buf __asm("a1") = (_ug_GetSalt_buf); \ + register ULONG __ug_GetSalt_size __asm("d0") = (_ug_GetSalt_size); \ + __asm volatile ("jsr a6@(-180:W)" \ + : "=r"(__ug_GetSalt__re) \ + : "r"(__ug_GetSalt__bn), "r"(__ug_GetSalt_user), "r"(__ug_GetSalt_buf), "r"(__ug_GetSalt_size) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __ug_GetSalt__re; \ + }); \ + _ug_GetSalt__re; \ +}) + +#define getpass(prompt) ({ \ + STRPTR _getpass_prompt = (prompt); \ + STRPTR _getpass__re = \ + ({ \ + register struct Library * const __getpass__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register STRPTR __getpass__re __asm("d0"); \ + register STRPTR __getpass_prompt __asm("a1") = (_getpass_prompt); \ + __asm volatile ("jsr a6@(-186:W)" \ + : "=r"(__getpass__re) \ + : "r"(__getpass__bn), "r"(__getpass_prompt) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getpass__re; \ + }); \ + _getpass__re; \ +}) + +#define umask(mask) ({ \ + ULONG _umask_mask = (mask); \ + ULONG _umask__re = \ + ({ \ + register struct Library * const __umask__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register ULONG __umask__re __asm("d0"); \ + register ULONG __umask_mask __asm("d0") = (_umask_mask); \ + __asm volatile ("jsr a6@(-192:W)" \ + : "=r"(__umask__re) \ + : "r"(__umask__bn), "r"(__umask_mask) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __umask__re; \ + }); \ + _umask__re; \ +}) + +#define getumask() ({ \ + ULONG _getumask__re = \ + ({ \ + register struct Library * const __getumask__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register ULONG __getumask__re __asm("d0"); \ + __asm volatile ("jsr a6@(-198:W)" \ + : "=r"(__getumask__re) \ + : "r"(__getumask__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getumask__re; \ + }); \ + _getumask__re; \ +}) + +#define setsid() ({ \ + LONG _setsid__re = \ + ({ \ + register struct Library * const __setsid__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __setsid__re __asm("d0"); \ + __asm volatile ("jsr a6@(-204:W)" \ + : "=r"(__setsid__re) \ + : "r"(__setsid__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __setsid__re; \ + }); \ + _setsid__re; \ +}) + +#define getpgrp() ({ \ + LONG _getpgrp__re = \ + ({ \ + register struct Library * const __getpgrp__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __getpgrp__re __asm("d0"); \ + __asm volatile ("jsr a6@(-210:W)" \ + : "=r"(__getpgrp__re) \ + : "r"(__getpgrp__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getpgrp__re; \ + }); \ + _getpgrp__re; \ +}) + +#define getlogin() ({ \ + STRPTR _getlogin__re = \ + ({ \ + register struct Library * const __getlogin__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register STRPTR __getlogin__re __asm("d0"); \ + __asm volatile ("jsr a6@(-216:W)" \ + : "=r"(__getlogin__re) \ + : "r"(__getlogin__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getlogin__re; \ + }); \ + _getlogin__re; \ +}) + +#define setlogin(name) ({ \ + STRPTR _setlogin_name = (name); \ + LONG _setlogin__re = \ + ({ \ + register struct Library * const __setlogin__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __setlogin__re __asm("d0"); \ + register STRPTR __setlogin_name __asm("a1") = (_setlogin_name); \ + __asm volatile ("jsr a6@(-222:W)" \ + : "=r"(__setlogin__re) \ + : "r"(__setlogin__bn), "r"(__setlogin_name) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __setlogin__re; \ + }); \ + _setlogin__re; \ +}) + +#define setutent() ({ \ + register struct Library * const __setutent__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + __asm volatile ("jsr a6@(-228:W)" \ + : \ + : "r"(__setutent__bn) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ +}) + +#define getutent() ({ \ + struct utmp * _getutent__re = \ + ({ \ + register struct Library * const __getutent__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register struct utmp * __getutent__re __asm("d0"); \ + __asm volatile ("jsr a6@(-234:W)" \ + : "=r"(__getutent__re) \ + : "r"(__getutent__bn) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getutent__re; \ + }); \ + _getutent__re; \ +}) + +#define endutent() ({ \ + register struct Library * const __endutent__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + __asm volatile ("jsr a6@(-240:W)" \ + : \ + : "r"(__endutent__bn) \ + : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ +}) + +#define getlastlog(uid) ({ \ + LONG _getlastlog_uid = (uid); \ + struct lastlog * _getlastlog__re = \ + ({ \ + register struct Library * const __getlastlog__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register struct lastlog * __getlastlog__re __asm("d0"); \ + register LONG __getlastlog_uid __asm("d0") = (_getlastlog_uid); \ + __asm volatile ("jsr a6@(-246:W)" \ + : "=r"(__getlastlog__re) \ + : "r"(__getlastlog__bn), "r"(__getlastlog_uid) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getlastlog__re; \ + }); \ + _getlastlog__re; \ +}) + +#define setlastlog(uid, name, host) ({ \ + LONG _setlastlog_uid = (uid); \ + STRPTR _setlastlog_name = (name); \ + STRPTR _setlastlog_host = (host); \ + LONG _setlastlog__re = \ + ({ \ + register struct Library * const __setlastlog__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register LONG __setlastlog__re __asm("d0"); \ + register LONG __setlastlog_uid __asm("d0") = (_setlastlog_uid); \ + register STRPTR __setlastlog_name __asm("a0") = (_setlastlog_name); \ + register STRPTR __setlastlog_host __asm("a1") = (_setlastlog_host); \ + __asm volatile ("jsr a6@(-252:W)" \ + : "=r"(__setlastlog__re) \ + : "r"(__setlastlog__bn), "r"(__setlastlog_uid), "r"(__setlastlog_name), "r"(__setlastlog_host) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __setlastlog__re; \ + }); \ + _setlastlog__re; \ +}) + +#define getcredentials(task) ({ \ + struct Task * _getcredentials_task = (task); \ + struct UserGroupCredentials * _getcredentials__re = \ + ({ \ + register struct Library * const __getcredentials__bn __asm("a6") = (struct Library *) (USERGROUP_BASE_NAME);\ + register struct UserGroupCredentials * __getcredentials__re __asm("d0"); \ + register struct Task * __getcredentials_task __asm("a0") = (_getcredentials_task); \ + __asm volatile ("jsr a6@(-258:W)" \ + : "=r"(__getcredentials__re) \ + : "r"(__getcredentials__bn), "r"(__getcredentials_task) \ + : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ + __getcredentials__re; \ + }); \ + _getcredentials__re; \ +}) + +#endif /* _INLINE_USERGROUP_H */ diff --git a/netinclude/inline4/bsdsocket.h b/netinclude/inline4/bsdsocket.h new file mode 100755 index 0000000..c01f440 --- /dev/null +++ b/netinclude/inline4/bsdsocket.h @@ -0,0 +1,231 @@ +#ifndef INLINE4_BSDSOCKET_H +#define INLINE4_BSDSOCKET_H + +/* +** This file was auto generated by idltool 53.6. +** +** It provides compatibility to OS3 style library +** calls by substituting functions. +** +** Do not edit manually. +*/ + +#ifndef EXEC_TYPES_H +#include +#endif +#ifndef EXEC_EXEC_H +#include +#endif +#ifndef EXEC_INTERFACES_H +#include +#endif + +#ifndef EXEC_LISTS_H +#include +#endif +#ifndef DEVICES_TIMER_H +#include +#endif +#ifndef UTILITY_TAGITEM_H +#include +#endif +#ifndef UTILITY_HOOKS_H +#include +#endif +#ifndef NETINET_IN_H +#include +#endif +#ifndef SYS_SOCKET_H +#include +#endif +#ifndef SYS_MBUF_H +#include +#endif +#ifndef NET_ROUTE_H +#include +#endif +#ifndef NETDB_H +#include +#endif +#ifndef LIBRARIES_BSDSOCKET_H +#include +#endif +#ifndef DOS_DOSEXTENS_H +#include +#endif +#include + +/* Inline macros for Interface "main" */ +#define socket(domain, type, protocol) ISocket->socket((domain), (type), (protocol)) +#define bind(sock, name, namelen) ISocket->bind((sock), (name), (namelen)) +#define listen(sock, backlog) ISocket->listen((sock), (backlog)) +#define accept(sock, addr, addrlen) ISocket->accept((sock), (addr), (addrlen)) +#define connect(sock, name, namelen) ISocket->connect((sock), (name), (namelen)) +#define sendto(sock, buf, len, flags, to, tolen) ISocket->sendto((sock), (buf), (len), (flags), (to), (tolen)) +#define send(sock, buf, len, flags) ISocket->send((sock), (buf), (len), (flags)) +#define recvfrom(sock, buf, len, flags, addr, addrlen) ISocket->recvfrom((sock), (buf), (len), (flags), (addr), (addrlen)) +#define recv(sock, buf, len, flags) ISocket->recv((sock), (buf), (len), (flags)) +#define shutdown(sock, how) ISocket->shutdown((sock), (how)) +#define setsockopt(sock, level, optname, optval, optlen) ISocket->setsockopt((sock), (level), (optname), (optval), (optlen)) +#define getsockopt(sock, level, optname, optval, optlen) ISocket->getsockopt((sock), (level), (optname), (optval), (optlen)) +#define getsockname(sock, name, namelen) ISocket->getsockname((sock), (name), (namelen)) +#define getpeername(sock, name, namelen) ISocket->getpeername((sock), (name), (namelen)) +#define IoctlSocket(sock, req, argp) ISocket->IoctlSocket((sock), (req), (argp)) +#define CloseSocket(sock) ISocket->CloseSocket((sock)) +#define WaitSelect(nfds, read_fds, write_fds, except_fds, _timeout, signals) ISocket->WaitSelect((nfds), (read_fds), (write_fds), (except_fds), (_timeout), (signals)) +#define SetSocketSignals(int_mask, io_mask, urgent_mask) ISocket->SetSocketSignals((int_mask), (io_mask), (urgent_mask)) +#define getdtablesize() ISocket->getdtablesize() +#define ObtainSocket(id, domain, type, protocol) ISocket->ObtainSocket((id), (domain), (type), (protocol)) +#define ReleaseSocket(sock, id) ISocket->ReleaseSocket((sock), (id)) +#define ReleaseCopyOfSocket(sock, id) ISocket->ReleaseCopyOfSocket((sock), (id)) +#define Errno() ISocket->Errno() +#define SetErrnoPtr(errno_ptr, size) ISocket->SetErrnoPtr((errno_ptr), (size)) +#define Inet_NtoA(ip) ISocket->Inet_NtoA((ip)) +#define inet_addr(cp) ISocket->inet_addr((cp)) +#define Inet_LnaOf(in) ISocket->Inet_LnaOf((in)) +#define Inet_NetOf(in) ISocket->Inet_NetOf((in)) +#define Inet_MakeAddr(net, host) ISocket->Inet_MakeAddr((net), (host)) +#define inet_network(cp) ISocket->inet_network((cp)) +#define gethostbyname(name) ISocket->gethostbyname((name)) +#define gethostbyaddr(addr, len, type) ISocket->gethostbyaddr((addr), (len), (type)) +#define getnetbyname(name) ISocket->getnetbyname((name)) +#define getnetbyaddr(net, type) ISocket->getnetbyaddr((net), (type)) +#define getservbyname(name, proto) ISocket->getservbyname((name), (proto)) +#define getservbyport(port, proto) ISocket->getservbyport((port), (proto)) +#define getprotobyname(name) ISocket->getprotobyname((name)) +#define getprotobynumber(proto) ISocket->getprotobynumber((proto)) +#define vsyslog(pri, msg, args) ISocket->vsyslog((pri), (msg), (args)) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (__GNUC__ >= 3) +#define syslog(pri, ...) ISocket->syslog((pri), __VA_ARGS__) +#elif (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define syslog(pri, vargs...) ISocket->syslog(pri, ## vargs) +#endif +#define Dup2Socket(old_socket, new_socket) ISocket->Dup2Socket((old_socket), (new_socket)) +#define sendmsg(sock, msg, flags) ISocket->sendmsg((sock), (msg), (flags)) +#define recvmsg(sock, msg, flags) ISocket->recvmsg((sock), (msg), (flags)) +#define gethostname(name, namelen) ISocket->gethostname((name), (namelen)) +#define gethostid() ISocket->gethostid() +#define SocketBaseTagList(tags) ISocket->SocketBaseTagList((tags)) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (__GNUC__ >= 3) +#define SocketBaseTags(...) ISocket->SocketBaseTags(__VA_ARGS__) +#elif (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define SocketBaseTags(...) ISocket->SocketBaseTags(## vargs) +#endif +#define GetSocketEvents(event_ptr) ISocket->GetSocketEvents((event_ptr)) +#define bpf_open(channel) ISocket->bpf_open((channel)) +#define bpf_close(channel) ISocket->bpf_close((channel)) +#define bpf_read(channel, buffer, len) ISocket->bpf_read((channel), (buffer), (len)) +#define bpf_write(channel, buffer, len) ISocket->bpf_write((channel), (buffer), (len)) +#define bpf_set_notify_mask(channel, signal_mask) ISocket->bpf_set_notify_mask((channel), (signal_mask)) +#define bpf_set_interrupt_mask(channel, signal_mask) ISocket->bpf_set_interrupt_mask((channel), (signal_mask)) +#define bpf_ioctl(channel, command, buffer) ISocket->bpf_ioctl((channel), (command), (buffer)) +#define bpf_data_waiting(channel) ISocket->bpf_data_waiting((channel)) +#define AddRouteTagList(tags) ISocket->AddRouteTagList((tags)) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (__GNUC__ >= 3) +#define AddRouteTags(...) ISocket->AddRouteTags(__VA_ARGS__) +#elif (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define AddRouteTags(...) ISocket->AddRouteTags(## vargs) +#endif +#define DeleteRouteTagList(tags) ISocket->DeleteRouteTagList((tags)) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (__GNUC__ >= 3) +#define DeleteRouteTags(...) ISocket->DeleteRouteTags(__VA_ARGS__) +#elif (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define DeleteRouteTags(...) ISocket->DeleteRouteTags(## vargs) +#endif +#define ChangeRouteTagList(tags) ISocket->ChangeRouteTagList((tags)) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (__GNUC__ >= 3) +#define ChangeRouteTags(...) ISocket->ChangeRouteTags(__VA_ARGS__) +#elif (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define ChangeRouteTags(...) ISocket->ChangeRouteTags(## vargs) +#endif +#define FreeRouteInfo(buf) ISocket->FreeRouteInfo((buf)) +#define GetRouteInfo(address_family, flags) ISocket->GetRouteInfo((address_family), (flags)) +#define AddInterfaceTagList(interface_name, device_name, unit, tags) ISocket->AddInterfaceTagList((interface_name), (device_name), (unit), (tags)) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (__GNUC__ >= 3) +#define AddInterfaceTags(interface_name, device_name, ...) ISocket->AddInterfaceTags((interface_name), (device_name), __VA_ARGS__) +#elif (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define AddInterfaceTags(interface_name, device_name, vargs...) ISocket->AddInterfaceTags(interface_name, device_name, ## vargs) +#endif +#define ConfigureInterfaceTagList(interface_name, tags) ISocket->ConfigureInterfaceTagList((interface_name), (tags)) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (__GNUC__ >= 3) +#define ConfigureInterfaceTags(...) ISocket->ConfigureInterfaceTags(__VA_ARGS__) +#elif (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define ConfigureInterfaceTags(vargs...) ISocket->ConfigureInterfaceTags(## vargs) +#endif +#define ReleaseInterfaceList(list) ISocket->ReleaseInterfaceList((list)) +#define ObtainInterfaceList() ISocket->ObtainInterfaceList() +#define QueryInterfaceTagList(interface_name, tags) ISocket->QueryInterfaceTagList((interface_name), (tags)) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (__GNUC__ >= 3) +#define QueryInterfaceTags(...) ISocket->QueryInterfaceTags(__VA_ARGS__) +#elif (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define QueryInterfaceTags(vargs...) ISocket->QueryInterfaceTags(## vargs) +#endif +#define CreateAddrAllocMessageA(version, protocol, interface_name, result_ptr, tags) ISocket->CreateAddrAllocMessageA((version), (protocol), (interface_name), (result_ptr), (tags)) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (__GNUC__ >= 3) +#define CreateAddrAllocMessage(version, protocol, interface_name, ...) ISocket->CreateAddrAllocMessage((version), (protocol), (interface_name), __VA_ARGS__) +#elif (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define CreateAddrAllocMessage(version, protocol, interface_name, vargs...) ISocket->CreateAddrAllocMessage(version, protocol, interface_name, ## vargs) +#endif +#define DeleteAddrAllocMessage(aam) ISocket->DeleteAddrAllocMessage((aam)) +#define BeginInterfaceConfig(message) ISocket->BeginInterfaceConfig((message)) +#define AbortInterfaceConfig(message) ISocket->AbortInterfaceConfig((message)) +#define AddNetMonitorHookTagList(type, hook, tags) ISocket->AddNetMonitorHookTagList((type), (hook), (tags)) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (__GNUC__ >= 3) +#define AddNetMonitorHookTags(type, ...) ISocket->AddNetMonitorHookTags((type), __VA_ARGS__) +#elif (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define AddNetMonitorHookTags(type, vargs...) ISocket->AddNetMonitorHookTags(type, ## vargs) +#endif +#define RemoveNetMonitorHook(hook) ISocket->RemoveNetMonitorHook((hook)) +#define GetNetworkStatistics(type, version, destination, size) ISocket->GetNetworkStatistics((type), (version), (destination), (size)) +#define AddDomainNameServer(address) ISocket->AddDomainNameServer((address)) +#define RemoveDomainNameServer(address) ISocket->RemoveDomainNameServer((address)) +#define ReleaseDomainNameServerList(list) ISocket->ReleaseDomainNameServerList((list)) +#define ObtainDomainNameServerList() ISocket->ObtainDomainNameServerList() +#define setnetent(stay_open) ISocket->setnetent((stay_open)) +#define endnetent() ISocket->endnetent() +#define getnetent() ISocket->getnetent() +#define setprotoent(stay_open) ISocket->setprotoent((stay_open)) +#define endprotoent() ISocket->endprotoent() +#define getprotoent() ISocket->getprotoent() +#define setservent(stay_open) ISocket->setservent((stay_open)) +#define endservent() ISocket->endservent() +#define getservent() ISocket->getservent() +#define inet_aton(cp, addr) ISocket->inet_aton((cp), (addr)) +#define inet_ntop(af, src, dst, size) ISocket->inet_ntop((af), (src), (dst), (size)) +#define inet_pton(af, src, dst) ISocket->inet_pton((af), (src), (dst)) +#define In_LocalAddr(address) ISocket->In_LocalAddr((address)) +#define In_CanForward(address) ISocket->In_CanForward((address)) +#define mbuf_copym(m, off, len) ISocket->mbuf_copym((m), (off), (len)) +#define mbuf_copyback(m, off, len, cp) ISocket->mbuf_copyback((m), (off), (len), (cp)) +#define mbuf_copydata(m, off, len, cp) ISocket->mbuf_copydata((m), (off), (len), (cp)) +#define mbuf_free(m) ISocket->mbuf_free((m)) +#define mbuf_freem(m) ISocket->mbuf_freem((m)) +#define mbuf_get() ISocket->mbuf_get() +#define mbuf_gethdr() ISocket->mbuf_gethdr() +#define mbuf_prepend(m, len) ISocket->mbuf_prepend((m), (len)) +#define mbuf_cat(m, n) ISocket->mbuf_cat((m), (n)) +#define mbuf_adj(mp, req_len) ISocket->mbuf_adj((mp), (req_len)) +#define mbuf_pullup(m, len) ISocket->mbuf_pullup((m), (len)) +#define ProcessIsServer(pr) ISocket->ProcessIsServer((pr)) +#define ObtainServerSocket() ISocket->ObtainServerSocket() +#define GetDefaultDomainName(buffer, buffer_size) ISocket->GetDefaultDomainName((buffer), (buffer_size)) +#define SetDefaultDomainName(buffer) ISocket->SetDefaultDomainName((buffer)) +#define ObtainRoadshowData(access) ISocket->ObtainRoadshowData((access)) +#define ReleaseRoadshowData(list) ISocket->ReleaseRoadshowData((list)) +#define ChangeRoadshowData(list, name, length, data) ISocket->ChangeRoadshowData((list), (name), (length), (data)) +#define RemoveInterface(interface_name, force) ISocket->RemoveInterface((interface_name), (force)) +#define gethostbyname_r(name, hp, buf, buflen, he) ISocket->gethostbyname_r((name), (hp), (buf), (buflen), (he)) +#define gethostbyaddr_r(addr, len, type, hp, buf, buflen, he) ISocket->gethostbyaddr_r((addr), (len), (type), (hp), (buf), (buflen), (he)) +#define ipf_open(channel) ISocket->ipf_open((channel)) +#define ipf_close(channel) ISocket->ipf_close((channel)) +#define ipf_ioctl(channel, command, buffer) ISocket->ipf_ioctl((channel), (command), (buffer)) +#define ipf_log_read(channel, buffer, len) ISocket->ipf_log_read((channel), (buffer), (len)) +#define ipf_log_data_waiting(channel) ISocket->ipf_log_data_waiting((channel)) +#define ipf_set_notify_mask(channel, mask) ISocket->ipf_set_notify_mask((channel), (mask)) +#define ipf_set_interrupt_mask(channel, mask) ISocket->ipf_set_interrupt_mask((channel), (mask)) +#define freeaddrinfo(ai) ISocket->freeaddrinfo((ai)) +#define getaddrinfo(hostname, servname, hints, res) ISocket->getaddrinfo((hostname), (servname), (hints), (res)) +#define gai_strerror(errnum) ISocket->gai_strerror((errnum)) +#define getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) ISocket->getnameinfo((sa), (salen), (host), (hostlen), (serv), (servlen), (flags)) + +#endif /* INLINE4_BSDSOCKET_H */ diff --git a/netinclude/inline4/usergroup.h b/netinclude/inline4/usergroup.h new file mode 100755 index 0000000..e7ae57a --- /dev/null +++ b/netinclude/inline4/usergroup.h @@ -0,0 +1,85 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack; "usergroup.library" API + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + * + * WARNING: The "usergroup.library" API must be considered obsolete and + * should not be used in new software. It is provided solely + * for backwards compatibility and legacy application software. + */ + +#ifndef INLINE4_USERGROUP_H +#define INLINE4_USERGROUP_H + +#ifndef EXEC_TYPES_H +#include +#endif +#ifndef EXEC_EXEC_H +#include +#endif +#ifndef EXEC_INTERFACES_H +#include +#endif + +#ifndef LIBRARIES_USERGROUP_H +#include +#endif +#ifndef _PWD_H +#include +#endif +#ifndef _GRP_H +#include +#endif + +/* Inline macros for Interface "main" */ +#define ug_SetupContextTagList(name, tags) IUserGroup->ug_SetupContextTagList(name, tags) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (__GNUC__ >= 3) +#define ug_SetupContextTags(...) IUserGroup->ug_SetupContextTags(__VA_ARGS__) +#elif (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define ug_SetupContextTags(vargs...) IUserGroup->ug_SetupContextTags(## vargs) +#endif +#define ug_GetErr() IUserGroup->ug_GetErr() +#define ug_StrError(err) IUserGroup->ug_StrError(err) +#define getuid() IUserGroup->getuid() +#define geteuid() IUserGroup->geteuid() +#define setreuid(real, effective) IUserGroup->setreuid(real, effective) +#define setuid(uid) IUserGroup->setuid(uid) +#define getgid() IUserGroup->getgid() +#define getegid() IUserGroup->getegid() +#define setregid(real, effective) IUserGroup->setregid(real, effective) +#define setgid(gid) IUserGroup->setgid(gid) +#define getgroups(gidsetlen, gidset) IUserGroup->getgroups(gidsetlen, gidset) +#define setgroups(gidsetlen, gidset) IUserGroup->setgroups(gidsetlen, gidset) +#define initgroups(name, basegid) IUserGroup->initgroups(name, basegid) +#define getpwnam(login) IUserGroup->getpwnam(login) +#define getpwuid(uid) IUserGroup->getpwuid(uid) +#define setpwent() IUserGroup->setpwent() +#define getpwent() IUserGroup->getpwent() +#define endpwent() IUserGroup->endpwent() +#define getgrnam(name) IUserGroup->getgrnam(name) +#define getgrgid(gid) IUserGroup->getgrgid(gid) +#define setgrent() IUserGroup->setgrent() +#define getgrent() IUserGroup->getgrent() +#define endgrent() IUserGroup->endgrent() +#define crypt(key, set) IUserGroup->crypt(key, set) +#define ug_GetSalt(user, buf, size) IUserGroup->ug_GetSalt(user, buf, size) +#define getpass(prompt) IUserGroup->getpass(prompt) +#define umask(mask) IUserGroup->umask(mask) +#define getumask() IUserGroup->getumask() +#define setsid() IUserGroup->setsid() +#define getpgrp() IUserGroup->getpgrp() +#define getlogin() IUserGroup->getlogin() +#define setlogin(name) IUserGroup->setlogin(name) +#define setutent() IUserGroup->setutent() +#define getutent() IUserGroup->getutent() +#define endutent() IUserGroup->endutent() +#define getlastlog(uid) IUserGroup->getlastlog(uid) +#define setlastlog(uid, name, host) IUserGroup->setlastlog(uid, name, host) +#define getcredentials(task) IUserGroup->getcredentials(task) + +#endif /* INLINE4_USERGROUP_H */ diff --git a/netinclude/interfaces/bsdsocket.h b/netinclude/interfaces/bsdsocket.h new file mode 100755 index 0000000..43fa3d6 --- /dev/null +++ b/netinclude/interfaces/bsdsocket.h @@ -0,0 +1,233 @@ +/* + * $Id$ + * + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack; "usergroup.library" API + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +#ifndef BSDSOCKET_INTERFACE_DEF_H +#define BSDSOCKET_INTERFACE_DEF_H + +/* +** This file was machine generated by idltool 53.6. +** Do not edit +*/ + +#ifndef EXEC_TYPES_H +#include +#endif +#ifndef EXEC_EXEC_H +#include +#endif +#ifndef EXEC_INTERFACES_H +#include +#endif + +#ifndef EXEC_LISTS_H +#include +#endif +#ifndef DEVICES_TIMER_H +#include +#endif +#ifndef UTILITY_TAGITEM_H +#include +#endif +#ifndef UTILITY_HOOKS_H +#include +#endif +#ifndef NETINET_IN_H +#include +#endif +#ifndef SYS_SOCKET_H +#include +#endif +#ifndef SYS_MBUF_H +#include +#endif +#ifndef NET_ROUTE_H +#include +#endif +#ifndef NETDB_H +#include +#endif +#ifndef LIBRARIES_BSDSOCKET_H +#include +#endif +#ifndef DOS_DOSEXTENS_H +#include +#endif + +#ifdef __cplusplus +#ifdef __USE_AMIGAOS_NAMESPACE__ +namespace AmigaOS { +#endif +extern "C" { +#endif + +struct SocketIFace +{ + struct InterfaceData Data; + + uint32 APICALL (*Obtain)(struct SocketIFace *Self); + uint32 APICALL (*Release)(struct SocketIFace *Self); + void APICALL (*Expunge)(struct SocketIFace *Self); + struct Interface * APICALL (*Clone)(struct SocketIFace *Self); + LONG APICALL (*socket)(struct SocketIFace *Self, LONG domain, LONG type, LONG protocol); + LONG APICALL (*bind)(struct SocketIFace *Self, LONG sock, struct sockaddr * name, socklen_t namelen); + LONG APICALL (*listen)(struct SocketIFace *Self, LONG sock, LONG backlog); + LONG APICALL (*accept)(struct SocketIFace *Self, LONG sock, struct sockaddr * addr, socklen_t * addrlen); + LONG APICALL (*connect)(struct SocketIFace *Self, LONG sock, struct sockaddr * name, socklen_t namelen); + LONG APICALL (*sendto)(struct SocketIFace *Self, LONG sock, APTR buf, LONG len, LONG flags, struct sockaddr * to, socklen_t tolen); + LONG APICALL (*send)(struct SocketIFace *Self, LONG sock, APTR buf, LONG len, LONG flags); + LONG APICALL (*recvfrom)(struct SocketIFace *Self, LONG sock, APTR buf, LONG len, LONG flags, struct sockaddr * addr, socklen_t * addrlen); + LONG APICALL (*recv)(struct SocketIFace *Self, LONG sock, APTR buf, LONG len, LONG flags); + LONG APICALL (*shutdown)(struct SocketIFace *Self, LONG sock, LONG how); + LONG APICALL (*setsockopt)(struct SocketIFace *Self, LONG sock, LONG level, LONG optname, APTR optval, socklen_t optlen); + LONG APICALL (*getsockopt)(struct SocketIFace *Self, LONG sock, LONG level, LONG optname, APTR optval, socklen_t * optlen); + LONG APICALL (*getsockname)(struct SocketIFace *Self, LONG sock, struct sockaddr * name, socklen_t * namelen); + LONG APICALL (*getpeername)(struct SocketIFace *Self, LONG sock, struct sockaddr * name, socklen_t * namelen); + LONG APICALL (*IoctlSocket)(struct SocketIFace *Self, LONG sock, ULONG req, APTR argp); + LONG APICALL (*CloseSocket)(struct SocketIFace *Self, LONG sock); + LONG APICALL (*WaitSelect)(struct SocketIFace *Self, LONG nfds, APTR read_fds, APTR write_fds, APTR except_fds, struct timeval * _timeout, ULONG * signals); + VOID APICALL (*SetSocketSignals)(struct SocketIFace *Self, ULONG int_mask, ULONG io_mask, ULONG urgent_mask); + LONG APICALL (*getdtablesize)(struct SocketIFace *Self); + LONG APICALL (*ObtainSocket)(struct SocketIFace *Self, LONG id, LONG domain, LONG type, LONG protocol); + LONG APICALL (*ReleaseSocket)(struct SocketIFace *Self, LONG sock, LONG id); + LONG APICALL (*ReleaseCopyOfSocket)(struct SocketIFace *Self, LONG sock, LONG id); + LONG APICALL (*Errno)(struct SocketIFace *Self); + VOID APICALL (*SetErrnoPtr)(struct SocketIFace *Self, APTR errno_ptr, LONG size); + STRPTR APICALL (*Inet_NtoA)(struct SocketIFace *Self, in_addr_t ip); + in_addr_t APICALL (*inet_addr)(struct SocketIFace *Self, STRPTR cp); + in_addr_t APICALL (*Inet_LnaOf)(struct SocketIFace *Self, in_addr_t in); + in_addr_t APICALL (*Inet_NetOf)(struct SocketIFace *Self, in_addr_t in); + in_addr_t APICALL (*Inet_MakeAddr)(struct SocketIFace *Self, in_addr_t net, in_addr_t host); + in_addr_t APICALL (*inet_network)(struct SocketIFace *Self, STRPTR cp); + struct hostent * APICALL (*gethostbyname)(struct SocketIFace *Self, STRPTR name); + struct hostent * APICALL (*gethostbyaddr)(struct SocketIFace *Self, STRPTR addr, LONG len, LONG type); + struct netent * APICALL (*getnetbyname)(struct SocketIFace *Self, STRPTR name); + struct netent * APICALL (*getnetbyaddr)(struct SocketIFace *Self, in_addr_t net, LONG type); + struct servent * APICALL (*getservbyname)(struct SocketIFace *Self, STRPTR name, STRPTR proto); + struct servent * APICALL (*getservbyport)(struct SocketIFace *Self, LONG port, STRPTR proto); + struct protoent * APICALL (*getprotobyname)(struct SocketIFace *Self, STRPTR name); + struct protoent * APICALL (*getprotobynumber)(struct SocketIFace *Self, LONG proto); + VOID APICALL (*vsyslog)(struct SocketIFace *Self, LONG pri, STRPTR msg, APTR args); + VOID APICALL (*syslog)(struct SocketIFace *Self, LONG pri, STRPTR msg, ...); + LONG APICALL (*Dup2Socket)(struct SocketIFace *Self, LONG old_socket, LONG new_socket); + LONG APICALL (*sendmsg)(struct SocketIFace *Self, LONG sock, struct msghdr * msg, LONG flags); + LONG APICALL (*recvmsg)(struct SocketIFace *Self, LONG sock, struct msghdr * msg, LONG flags); + LONG APICALL (*gethostname)(struct SocketIFace *Self, STRPTR name, LONG namelen); + in_addr_t APICALL (*gethostid)(struct SocketIFace *Self); + LONG APICALL (*SocketBaseTagList)(struct SocketIFace *Self, struct TagItem * tags); + LONG APICALL (*SocketBaseTags)(struct SocketIFace *Self, ...); + LONG APICALL (*GetSocketEvents)(struct SocketIFace *Self, ULONG * event_ptr); + void APICALL (*Reserved1)(struct SocketIFace *Self); + void APICALL (*Reserved2)(struct SocketIFace *Self); + void APICALL (*Reserved3)(struct SocketIFace *Self); + void APICALL (*Reserved4)(struct SocketIFace *Self); + void APICALL (*Reserved5)(struct SocketIFace *Self); + void APICALL (*Reserved6)(struct SocketIFace *Self); + void APICALL (*Reserved7)(struct SocketIFace *Self); + void APICALL (*Reserved8)(struct SocketIFace *Self); + void APICALL (*Reserved9)(struct SocketIFace *Self); + void APICALL (*Reserved10)(struct SocketIFace *Self); + LONG APICALL (*bpf_open)(struct SocketIFace *Self, LONG channel); + LONG APICALL (*bpf_close)(struct SocketIFace *Self, LONG channel); + LONG APICALL (*bpf_read)(struct SocketIFace *Self, LONG channel, APTR buffer, LONG len); + LONG APICALL (*bpf_write)(struct SocketIFace *Self, LONG channel, APTR buffer, LONG len); + LONG APICALL (*bpf_set_notify_mask)(struct SocketIFace *Self, LONG channel, ULONG signal_mask); + LONG APICALL (*bpf_set_interrupt_mask)(struct SocketIFace *Self, LONG channel, ULONG signal_mask); + LONG APICALL (*bpf_ioctl)(struct SocketIFace *Self, LONG channel, ULONG command, APTR buffer); + LONG APICALL (*bpf_data_waiting)(struct SocketIFace *Self, LONG channel); + LONG APICALL (*AddRouteTagList)(struct SocketIFace *Self, struct TagItem * tags); + LONG APICALL (*AddRouteTags)(struct SocketIFace *Self, ...); + LONG APICALL (*DeleteRouteTagList)(struct SocketIFace *Self, struct TagItem * tags); + LONG APICALL (*DeleteRouteTags)(struct SocketIFace *Self, ...); + LONG APICALL (*ChangeRouteTagList)(struct SocketIFace *Self, struct TagItem * tags); + LONG APICALL (*ChangeRouteTags)(struct SocketIFace *Self, ...); + VOID APICALL (*FreeRouteInfo)(struct SocketIFace *Self, struct rt_msghdr * buf); + struct rt_msghdr * APICALL (*GetRouteInfo)(struct SocketIFace *Self, LONG address_family, LONG flags); + LONG APICALL (*AddInterfaceTagList)(struct SocketIFace *Self, STRPTR interface_name, STRPTR device_name, LONG unit, struct TagItem * tags); + LONG APICALL (*AddInterfaceTags)(struct SocketIFace *Self, STRPTR interface_name, STRPTR device_name, LONG unit, ...); + LONG APICALL (*ConfigureInterfaceTagList)(struct SocketIFace *Self, STRPTR interface_name, struct TagItem * tags); + LONG APICALL (*ConfigureInterfaceTags)(struct SocketIFace *Self, STRPTR interface_name, ...); + VOID APICALL (*ReleaseInterfaceList)(struct SocketIFace *Self, struct List * list); + struct List * APICALL (*ObtainInterfaceList)(struct SocketIFace *Self); + LONG APICALL (*QueryInterfaceTagList)(struct SocketIFace *Self, STRPTR interface_name, struct TagItem * tags); + LONG APICALL (*QueryInterfaceTags)(struct SocketIFace *Self, STRPTR interface_name, ...); + LONG APICALL (*CreateAddrAllocMessageA)(struct SocketIFace *Self, LONG version, LONG protocol, STRPTR interface_name, struct AddressAllocationMessage ** result_ptr, struct TagItem * tags); + LONG APICALL (*CreateAddrAllocMessage)(struct SocketIFace *Self, LONG version, LONG protocol, STRPTR interface_name, struct AddressAllocationMessage ** result_ptr, ...); + VOID APICALL (*DeleteAddrAllocMessage)(struct SocketIFace *Self, struct AddressAllocationMessage * aam); + VOID APICALL (*BeginInterfaceConfig)(struct SocketIFace *Self, struct AddressAllocationMessage * message); + VOID APICALL (*AbortInterfaceConfig)(struct SocketIFace *Self, struct AddressAllocationMessage * message); + LONG APICALL (*AddNetMonitorHookTagList)(struct SocketIFace *Self, LONG type, struct Hook * hook, struct TagItem * tags); + LONG APICALL (*AddNetMonitorHookTags)(struct SocketIFace *Self, LONG type, struct Hook * hook, ...); + VOID APICALL (*RemoveNetMonitorHook)(struct SocketIFace *Self, struct Hook * hook); + LONG APICALL (*GetNetworkStatistics)(struct SocketIFace *Self, LONG type, LONG version, APTR destination, LONG size); + LONG APICALL (*AddDomainNameServer)(struct SocketIFace *Self, STRPTR address); + LONG APICALL (*RemoveDomainNameServer)(struct SocketIFace *Self, STRPTR address); + VOID APICALL (*ReleaseDomainNameServerList)(struct SocketIFace *Self, struct List * list); + struct List * APICALL (*ObtainDomainNameServerList)(struct SocketIFace *Self); + VOID APICALL (*setnetent)(struct SocketIFace *Self, LONG stay_open); + VOID APICALL (*endnetent)(struct SocketIFace *Self); + struct netent * APICALL (*getnetent)(struct SocketIFace *Self); + VOID APICALL (*setprotoent)(struct SocketIFace *Self, LONG stay_open); + VOID APICALL (*endprotoent)(struct SocketIFace *Self); + struct protoent * APICALL (*getprotoent)(struct SocketIFace *Self); + VOID APICALL (*setservent)(struct SocketIFace *Self, LONG stay_open); + VOID APICALL (*endservent)(struct SocketIFace *Self); + struct servent * APICALL (*getservent)(struct SocketIFace *Self); + LONG APICALL (*inet_aton)(struct SocketIFace *Self, STRPTR cp, struct in_addr * addr); + STRPTR APICALL (*inet_ntop)(struct SocketIFace *Self, LONG af, APTR src, STRPTR dst, LONG size); + LONG APICALL (*inet_pton)(struct SocketIFace *Self, LONG af, STRPTR src, APTR dst); + LONG APICALL (*In_LocalAddr)(struct SocketIFace *Self, in_addr_t address); + LONG APICALL (*In_CanForward)(struct SocketIFace *Self, in_addr_t address); + struct mbuf * APICALL (*mbuf_copym)(struct SocketIFace *Self, struct mbuf * m, LONG off, LONG len); + LONG APICALL (*mbuf_copyback)(struct SocketIFace *Self, struct mbuf * m, LONG off, LONG len, APTR cp); + LONG APICALL (*mbuf_copydata)(struct SocketIFace *Self, struct mbuf * m, LONG off, LONG len, APTR cp); + struct mbuf * APICALL (*mbuf_free)(struct SocketIFace *Self, struct mbuf * m); + VOID APICALL (*mbuf_freem)(struct SocketIFace *Self, struct mbuf * m); + struct mbuf * APICALL (*mbuf_get)(struct SocketIFace *Self); + struct mbuf * APICALL (*mbuf_gethdr)(struct SocketIFace *Self); + struct mbuf * APICALL (*mbuf_prepend)(struct SocketIFace *Self, struct mbuf * m, LONG len); + LONG APICALL (*mbuf_cat)(struct SocketIFace *Self, struct mbuf * m, struct mbuf * n); + LONG APICALL (*mbuf_adj)(struct SocketIFace *Self, struct mbuf * mp, LONG req_len); + struct mbuf * APICALL (*mbuf_pullup)(struct SocketIFace *Self, struct mbuf * m, LONG len); + BOOL APICALL (*ProcessIsServer)(struct SocketIFace *Self, struct Process * pr); + LONG APICALL (*ObtainServerSocket)(struct SocketIFace *Self); + BOOL APICALL (*GetDefaultDomainName)(struct SocketIFace *Self, STRPTR buffer, LONG buffer_size); + VOID APICALL (*SetDefaultDomainName)(struct SocketIFace *Self, STRPTR buffer); + struct List * APICALL (*ObtainRoadshowData)(struct SocketIFace *Self, LONG access); + VOID APICALL (*ReleaseRoadshowData)(struct SocketIFace *Self, struct List * list); + BOOL APICALL (*ChangeRoadshowData)(struct SocketIFace *Self, struct List * list, STRPTR name, ULONG length, APTR data); + LONG APICALL (*RemoveInterface)(struct SocketIFace *Self, STRPTR interface_name, LONG force); + struct hostent * APICALL (*gethostbyname_r)(struct SocketIFace *Self, STRPTR name, struct hostent * hp, APTR buf, ULONG buflen, LONG * he); + struct hostent * APICALL (*gethostbyaddr_r)(struct SocketIFace *Self, STRPTR addr, LONG len, LONG type, struct hostent * hp, APTR buf, ULONG buflen, LONG * he); + void APICALL (*Reserved11)(struct SocketIFace *Self); + void APICALL (*Reserved12)(struct SocketIFace *Self); + LONG APICALL (*ipf_open)(struct SocketIFace *Self, LONG channel); + LONG APICALL (*ipf_close)(struct SocketIFace *Self, LONG channel); + LONG APICALL (*ipf_ioctl)(struct SocketIFace *Self, LONG channel, ULONG command, APTR buffer); + LONG APICALL (*ipf_log_read)(struct SocketIFace *Self, LONG channel, APTR buffer, LONG len); + LONG APICALL (*ipf_log_data_waiting)(struct SocketIFace *Self, LONG channel); + LONG APICALL (*ipf_set_notify_mask)(struct SocketIFace *Self, LONG channel, ULONG mask); + LONG APICALL (*ipf_set_interrupt_mask)(struct SocketIFace *Self, LONG channel, ULONG mask); + VOID APICALL (*freeaddrinfo)(struct SocketIFace *Self, struct addrinfo * ai); + LONG APICALL (*getaddrinfo)(struct SocketIFace *Self, STRPTR hostname, STRPTR servname, struct addrinfo * hints, struct addrinfo ** res); + STRPTR APICALL (*gai_strerror)(struct SocketIFace *Self, LONG errnum); + LONG APICALL (*getnameinfo)(struct SocketIFace *Self, struct sockaddr * sa, ULONG salen, STRPTR host, ULONG hostlen, STRPTR serv, ULONG servlen, ULONG flags); +}; + +#ifdef __cplusplus +} +#ifdef __USE_AMIGAOS_NAMESPACE__ +} +#endif +#endif + +#endif /* BSDSOCKET_INTERFACE_DEF_H */ diff --git a/netinclude/interfaces/bsdsocket.i b/netinclude/interfaces/bsdsocket.i new file mode 100755 index 0000000..018375e --- /dev/null +++ b/netinclude/interfaces/bsdsocket.i @@ -0,0 +1,175 @@ +/* + * $Id$ + * + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack; "usergroup.library" API + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +#ifndef BSDSOCKET_INTERFACE_DEF_H +#define BSDSOCKET_INTERFACE_DEF_H +/* +** This file is machine generated from idltool +** Do not edit +*/ + +#include +#include +#include + +STRUCTURE SocketIFace, InterfaceData_SIZE + FPTR ISocket_Obtain + FPTR ISocket_Release + FPTR ISocket_Expunge + FPTR ISocket_Clone + FPTR ISocket_socket + FPTR ISocket_bind + FPTR ISocket_listen + FPTR ISocket_accept + FPTR ISocket_connect + FPTR ISocket_sendto + FPTR ISocket_send + FPTR ISocket_recvfrom + FPTR ISocket_recv + FPTR ISocket_shutdown + FPTR ISocket_setsockopt + FPTR ISocket_getsockopt + FPTR ISocket_getsockname + FPTR ISocket_getpeername + FPTR ISocket_IoctlSocket + FPTR ISocket_CloseSocket + FPTR ISocket_WaitSelect + FPTR ISocket_SetSocketSignals + FPTR ISocket_getdtablesize + FPTR ISocket_ObtainSocket + FPTR ISocket_ReleaseSocket + FPTR ISocket_ReleaseCopyOfSocket + FPTR ISocket_Errno + FPTR ISocket_SetErrnoPtr + FPTR ISocket_Inet_NtoA + FPTR ISocket_inet_addr + FPTR ISocket_Inet_LnaOf + FPTR ISocket_Inet_NetOf + FPTR ISocket_Inet_MakeAddr + FPTR ISocket_inet_network + FPTR ISocket_gethostbyname + FPTR ISocket_gethostbyaddr + FPTR ISocket_getnetbyname + FPTR ISocket_getnetbyaddr + FPTR ISocket_getservbyname + FPTR ISocket_getservbyport + FPTR ISocket_getprotobyname + FPTR ISocket_getprotobynumber + FPTR ISocket_vsyslog + FPTR ISocket_syslog + FPTR ISocket_Dup2Socket + FPTR ISocket_sendmsg + FPTR ISocket_recvmsg + FPTR ISocket_gethostname + FPTR ISocket_gethostid + FPTR ISocket_SocketBaseTagList + FPTR ISocket_SocketBaseTags + FPTR ISocket_GetSocketEvents + FPTR ISocket_Reserved1 + FPTR ISocket_Reserved2 + FPTR ISocket_Reserved3 + FPTR ISocket_Reserved4 + FPTR ISocket_Reserved5 + FPTR ISocket_Reserved6 + FPTR ISocket_Reserved7 + FPTR ISocket_Reserved8 + FPTR ISocket_Reserved9 + FPTR ISocket_Reserved10 + FPTR ISocket_bpf_open + FPTR ISocket_bpf_close + FPTR ISocket_bpf_read + FPTR ISocket_bpf_write + FPTR ISocket_bpf_set_notify_mask + FPTR ISocket_bpf_set_interrupt_mask + FPTR ISocket_bpf_ioctl + FPTR ISocket_bpf_data_waiting + FPTR ISocket_AddRouteTagList + FPTR ISocket_AddRouteTags + FPTR ISocket_DeleteRouteTagList + FPTR ISocket_DeleteRouteTags + FPTR ISocket_ChangeRouteTagList + FPTR ISocket_ChangeRouteTags + FPTR ISocket_FreeRouteInfo + FPTR ISocket_GetRouteInfo + FPTR ISocket_AddInterfaceTagList + FPTR ISocket_AddInterfaceTags + FPTR ISocket_ConfigureInterfaceTagList + FPTR ISocket_ConfigureInterfaceTags + FPTR ISocket_ReleaseInterfaceList + FPTR ISocket_ObtainInterfaceList + FPTR ISocket_QueryInterfaceTagList + FPTR ISocket_QueryInterfaceTags + FPTR ISocket_CreateAddrAllocMessageA + FPTR ISocket_CreateAddrAllocMessage + FPTR ISocket_DeleteAddrAllocMessage + FPTR ISocket_BeginInterfaceConfig + FPTR ISocket_AbortInterfaceConfig + FPTR ISocket_AddNetMonitorHookTagList + FPTR ISocket_AddNetMonitorHookTags + FPTR ISocket_RemoveNetMonitorHook + FPTR ISocket_GetNetworkStatistics + FPTR ISocket_AddDomainNameServer + FPTR ISocket_RemoveDomainNameServer + FPTR ISocket_ReleaseDomainNameServerList + FPTR ISocket_ObtainDomainNameServerList + FPTR ISocket_setnetent + FPTR ISocket_endnetent + FPTR ISocket_getnetent + FPTR ISocket_setprotoent + FPTR ISocket_endprotoent + FPTR ISocket_getprotoent + FPTR ISocket_setservent + FPTR ISocket_endservent + FPTR ISocket_getservent + FPTR ISocket_inet_aton + FPTR ISocket_inet_ntop + FPTR ISocket_inet_pton + FPTR ISocket_In_LocalAddr + FPTR ISocket_In_CanForward + FPTR ISocket_mbuf_copym + FPTR ISocket_mbuf_copyback + FPTR ISocket_mbuf_copydata + FPTR ISocket_mbuf_free + FPTR ISocket_mbuf_freem + FPTR ISocket_mbuf_get + FPTR ISocket_mbuf_gethdr + FPTR ISocket_mbuf_prepend + FPTR ISocket_mbuf_cat + FPTR ISocket_mbuf_adj + FPTR ISocket_mbuf_pullup + FPTR ISocket_ProcessIsServer + FPTR ISocket_ObtainServerSocket + FPTR ISocket_GetDefaultDomainName + FPTR ISocket_SetDefaultDomainName + FPTR ISocket_ObtainRoadshowData + FPTR ISocket_ReleaseRoadshowData + FPTR ISocket_ChangeRoadshowData + FPTR ISocket_RemoveInterface + FPTR ISocket_gethostbyname_r + FPTR ISocket_gethostbyaddr_r + FPTR ISocket_Reserved11 + FPTR ISocket_Reserved12 + FPTR ISocket_ipf_open + FPTR ISocket_ipf_close + FPTR ISocket_ipf_ioctl + FPTR ISocket_ipf_log_read + FPTR ISocket_ipf_log_data_waiting + FPTR ISocket_ipf_set_notify_mask + FPTR ISocket_ipf_set_interrupt_mask + FPTR ISocket_freeaddrinfo + FPTR ISocket_getaddrinfo + FPTR ISocket_gai_strerror + FPTR ISocket_getnameinfo + LABEL SocketIFace_SIZE + +#endif diff --git a/netinclude/interfaces/usergroup.h b/netinclude/interfaces/usergroup.h new file mode 100755 index 0000000..fd36b2f --- /dev/null +++ b/netinclude/interfaces/usergroup.h @@ -0,0 +1,89 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack; "usergroup.library" API + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + * + * WARNING: The "usergroup.library" API must be considered obsolete and + * should not be used in new software. It is provided solely + * for backwards compatibility and legacy application software. + */ + +#ifndef USERGROUP_INTERFACE_DEF_H +#define USERGROUP_INTERFACE_DEF_H + +#ifndef EXEC_TYPES_H +#include +#endif +#ifndef EXEC_EXEC_H +#include +#endif +#ifndef EXEC_INTERFACES_H +#include +#endif + +#ifndef LIBRARIES_USERGROUP_H +#include +#endif +#ifndef _PWD_H +#include +#endif +#ifndef _GRP_H +#include +#endif + +struct UserGroupIFace +{ + struct InterfaceData Data; + + ULONG APICALL (*Obtain)(struct UserGroupIFace *Self); + ULONG APICALL (*Release)(struct UserGroupIFace *Self); + void APICALL (*Expunge)(struct UserGroupIFace *Self); + struct Interface * APICALL (*Clone)(struct UserGroupIFace *Self); + LONG APICALL (*ug_SetupContextTagList)(struct UserGroupIFace *Self, STRPTR name, struct TagItem * tags); + LONG APICALL (*ug_SetupContextTags)(struct UserGroupIFace *Self, STRPTR name, ...); + LONG APICALL (*ug_GetErr)(struct UserGroupIFace *Self); + STRPTR APICALL (*ug_StrError)(struct UserGroupIFace *Self, LONG err); + LONG APICALL (*getuid)(struct UserGroupIFace *Self); + LONG APICALL (*geteuid)(struct UserGroupIFace *Self); + LONG APICALL (*setreuid)(struct UserGroupIFace *Self, LONG real, LONG effective); + LONG APICALL (*setuid)(struct UserGroupIFace *Self, LONG uid); + LONG APICALL (*getgid)(struct UserGroupIFace *Self); + LONG APICALL (*getegid)(struct UserGroupIFace *Self); + LONG APICALL (*setregid)(struct UserGroupIFace *Self, LONG real, LONG effective); + LONG APICALL (*setgid)(struct UserGroupIFace *Self, LONG gid); + LONG APICALL (*getgroups)(struct UserGroupIFace *Self, LONG gidsetlen, LONG * gidset); + LONG APICALL (*setgroups)(struct UserGroupIFace *Self, LONG gidsetlen, LONG * gidset); + LONG APICALL (*initgroups)(struct UserGroupIFace *Self, STRPTR name, LONG basegid); + struct passwd * APICALL (*getpwnam)(struct UserGroupIFace *Self, STRPTR login); + struct passwd * APICALL (*getpwuid)(struct UserGroupIFace *Self, LONG uid); + VOID APICALL (*setpwent)(struct UserGroupIFace *Self); + struct passwd * APICALL (*getpwent)(struct UserGroupIFace *Self); + VOID APICALL (*endpwent)(struct UserGroupIFace *Self); + struct group * APICALL (*getgrnam)(struct UserGroupIFace *Self, STRPTR name); + struct group * APICALL (*getgrgid)(struct UserGroupIFace *Self, LONG gid); + VOID APICALL (*setgrent)(struct UserGroupIFace *Self); + struct group * APICALL (*getgrent)(struct UserGroupIFace *Self); + VOID APICALL (*endgrent)(struct UserGroupIFace *Self); + UBYTE * APICALL (*crypt)(struct UserGroupIFace *Self, UBYTE * key, UBYTE * set); + UBYTE * APICALL (*ug_GetSalt)(struct UserGroupIFace *Self, struct passwd * user, UBYTE * buf, ULONG size); + STRPTR APICALL (*getpass)(struct UserGroupIFace *Self, STRPTR prompt); + ULONG APICALL (*umask)(struct UserGroupIFace *Self, UWORD mask); + ULONG APICALL (*getumask)(struct UserGroupIFace *Self); + LONG APICALL (*setsid)(struct UserGroupIFace *Self); + LONG APICALL (*getpgrp)(struct UserGroupIFace *Self); + STRPTR APICALL (*getlogin)(struct UserGroupIFace *Self); + LONG APICALL (*setlogin)(struct UserGroupIFace *Self, STRPTR name); + VOID APICALL (*setutent)(struct UserGroupIFace *Self); + struct utmp * APICALL (*getutent)(struct UserGroupIFace *Self); + VOID APICALL (*endutent)(struct UserGroupIFace *Self); + struct lastlog * APICALL (*getlastlog)(struct UserGroupIFace *Self, LONG uid); + LONG APICALL (*setlastlog)(struct UserGroupIFace *Self, LONG uid, STRPTR name, STRPTR host); + struct UserGroupCredentials * APICALL (*getcredentials)(struct UserGroupIFace *Self, struct Task * task); +}; + +#endif /* USERGROUP_INTERFACE_DEF_H */ diff --git a/netinclude/interfaces/usergroup.i b/netinclude/interfaces/usergroup.i new file mode 100755 index 0000000..37b020c --- /dev/null +++ b/netinclude/interfaces/usergroup.i @@ -0,0 +1,70 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack; "usergroup.library" API + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + * + * WARNING: The "usergroup.library" API must be considered obsolete and + * should not be used in new software. It is provided solely + * for backwards compatibility and legacy application software. + */ + +#ifndef USERGROUP_INTERFACE_DEF_H +#define USERGROUP_INTERFACE_DEF_H + +#include +#include +#include + +STRUCTURE UserGroupIFace, InterfaceData_SIZE + FPTR IUserGroup_Obtain + FPTR IUserGroup_Release + FPTR IUserGroup_Expunge + FPTR IUserGroup_Clone + FPTR IUserGroup_ug_SetupContextTagList + FPTR IUserGroup_ug_SetupContextTags + FPTR IUserGroup_ug_GetErr + FPTR IUserGroup_ug_StrError + FPTR IUserGroup_getuid + FPTR IUserGroup_geteuid + FPTR IUserGroup_setreuid + FPTR IUserGroup_setuid + FPTR IUserGroup_getgid + FPTR IUserGroup_getegid + FPTR IUserGroup_setregid + FPTR IUserGroup_setgid + FPTR IUserGroup_getgroups + FPTR IUserGroup_setgroups + FPTR IUserGroup_initgroups + FPTR IUserGroup_getpwnam + FPTR IUserGroup_getpwuid + FPTR IUserGroup_setpwent + FPTR IUserGroup_getpwent + FPTR IUserGroup_endpwent + FPTR IUserGroup_getgrnam + FPTR IUserGroup_getgrgid + FPTR IUserGroup_setgrent + FPTR IUserGroup_getgrent + FPTR IUserGroup_endgrent + FPTR IUserGroup_crypt + FPTR IUserGroup_ug_GetSalt + FPTR IUserGroup_getpass + FPTR IUserGroup_umask + FPTR IUserGroup_getumask + FPTR IUserGroup_setsid + FPTR IUserGroup_getpgrp + FPTR IUserGroup_getlogin + FPTR IUserGroup_setlogin + FPTR IUserGroup_setutent + FPTR IUserGroup_getutent + FPTR IUserGroup_endutent + FPTR IUserGroup_getlastlog + FPTR IUserGroup_setlastlog + FPTR IUserGroup_getcredentials + LABEL UserGroupIFace_SIZE + +#endif diff --git a/netinclude/libraries/bsdsocket.h b/netinclude/libraries/bsdsocket.h new file mode 100755 index 0000000..ec7bbef --- /dev/null +++ b/netinclude/libraries/bsdsocket.h @@ -0,0 +1,1337 @@ +/* + * $Id$ + * + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/****************************************************************************/ + +#ifndef _LIBRARIES_BSDSOCKET_H +#define _LIBRARIES_BSDSOCKET_H + +/****************************************************************************/ + +#ifndef EXEC_PORTS_H +#include +#endif /* EXEC_PORTS_H */ + +#ifndef UTILITY_TAGITEM_H +#include +#endif /* UTILITY_TAGITEM_H */ + +#ifndef DOS_H +#include +#endif /* DOS_H */ + +/****************************************************************************/ + +#ifndef _SYS_SOCKET_H_ +#include +#endif /* _SYS_SOCKET_H_ */ + +#ifndef _NETINET_IN_H_ +#include +#endif /* _NETINET_IN_H_ */ + +#ifndef _NET_IF_H_ +#include +#endif /* _NET_IF_H_ */ + +#ifndef _SYS_MBUF_H_ +#include +#endif /* _SYS_MBUF_H_ */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Parameter passing macros for use with SocketBaseTagList() + */ + +/* Argument passing: either by value or by reference. */ +#define SBTF_VAL 0x0000 /* Tag->ti_Data contains the value */ +#define SBTF_REF 0x8000 /* Tag->ti_Data contains a pointer to the value */ + +/* Code value: this is one of the SBTC_.. values from the table below */ +#define SBTB_CODE 1 +#define SBTS_CODE 0x3FFF + +#define SBTM_CODE(td) (((td) >> SBTB_CODE) & SBTS_CODE) + +/* Read or write access control. */ +#define SBTF_GET 0 /* Modify either Tag->ti_Data (SBTF_VAL) or the value + pointed to by Tag->ti_Data (SBTF_REF) */ +#define SBTF_SET 1 /* Use either Tag->ti_Data (SBTF_VAL) or the value + pointed to by Tag->ti_Data (SBTF_REF) */ + +/* Macros for passing the individual tag item parameters. */ +#define SBTM_GETREF(code) \ + (TAG_USER | SBTF_REF | (((code) & SBTS_CODE) << SBTB_CODE) | SBTF_GET) +#define SBTM_GETVAL(code) \ + (TAG_USER | SBTF_VAL | (((code) & SBTS_CODE) << SBTB_CODE) | SBTF_GET) +#define SBTM_SETREF(code) \ + (TAG_USER | SBTF_REF | (((code) & SBTS_CODE) << SBTB_CODE) | SBTF_SET) +#define SBTM_SETVAL(code) \ + (TAG_USER | SBTF_VAL | (((code) & SBTS_CODE) << SBTB_CODE) | SBTF_SET) + +/****************************************************************************/ + +/* + * Parameters for SocketBaseTagList(); these must be wrapped into the + * SBTM_GETREF/SBTM_GETVAL/SBTM_SETREF/SBTM_SETVAL macros defined + * above. + */ + +/* Masks defining the signals for Task notification */ +#define SBTC_BREAKMASK 1 +#define SBTC_SIGIOMASK 2 +#define SBTC_SIGURGMASK 3 +#define SBTC_SIGEVENTMASK 4 + +/* Current value of the errno and h_errno variables */ +#define SBTC_ERRNO 6 +#define SBTC_HERRNO 7 + +/* Current size of the socket descriptor table */ +#define SBTC_DTABLESIZE 8 + +/* Link library fd allocation callback; don't use this in + new code! */ +#define SBTC_FDCALLBACK 9 + +/* Callback actions; don't use these in new code! */ +#define FDCB_FREE 0 +#define FDCB_ALLOC 1 +#define FDCB_CHECK 2 + +/* syslog variables */ +#define SBTC_LOGSTAT 10 +#define SBTC_LOGTAGPTR 11 +#define SBTC_LOGFACILITY 12 +#define SBTC_LOGMASK 13 + +/* Error strings */ +#define SBTC_ERRNOSTRPTR 14 +#define SBTC_HERRNOSTRPTR 15 +#define SBTC_IOERRNOSTRPTR 16 +#define SBTC_S2ERRNOSTRPTR 17 +#define SBTC_S2WERRNOSTRPTR 18 + +/* 'errno' pointer & size */ +#define SBTC_ERRNOBYTEPTR 21 +#define SBTC_ERRNOWORDPTR 22 +#define SBTC_ERRNOLONGPTR 24 +#define SBTC_ERRNOPTR(size) \ + ((size == sizeof(long)) ? SBTC_ERRNOLONGPTR : \ + ((size == sizeof(short)) ? SBTC_ERRNOWORDPTR : \ + ((size == sizeof(char)) ? SBTC_ERRNOBYTEPTR : \ + 0))) + +/* 'h_errno' pointer (with sizeof(h_errno) == sizeof(long)) */ +#define SBTC_HERRNOLONGPTR 25 + +/* Release string pointer */ +#define SBTC_RELEASESTRPTR 29 + +/* + * Extensions to the original AmiTCP API + */ + +/* Number of Berkeley packet filter channels available. */ +#define SBTC_NUM_PACKET_FILTER_CHANNELS 40 + +/* Whether or not the routing API is supported. */ +#define SBTC_HAVE_ROUTING_API 41 + +/* Enable/Disable UDP checksums? */ +#define SBTC_UDP_CHECKSUM 42 + +/* Enable/Disable IP packet forwarding? */ +#define SBTC_IP_FORWARDING 43 + +/* Get/set the default IP packet TTL value. */ +#define SBTC_IP_DEFAULT_TTL 44 + +/* Respond to ICMP mask requests? */ +#define SBTC_ICMP_MASK_REPLY 45 + +/* Enable/Disable sending of redirection messages? */ +#define SBTC_ICMP_SEND_REDIRECTS 46 + +/* Whether or not the interface API is supported. */ +#define SBTC_HAVE_INTERFACE_API 47 + +/* How ICMP echo messages should be processed. */ +#define SBTC_ICMP_PROCESS_ECHO 48 + +/* How ICMP time stamp messages should be processed. */ +#define SBTC_ICMP_PROCESS_TSTAMP 49 + +/* Whether or not the monitoring API is supported. */ +#define SBTC_HAVE_MONITORING_API 50 + +/* Whether or not library bases can be shared by different + callers. */ +#define SBTC_CAN_SHARE_LIBRARY_BASES 51 + +/* Set the name of the log output file or get a pointer + to the current file name. */ +#define SBTC_LOG_FILE_NAME 52 + +/* Whether or not the status API is supported. */ +#define SBTC_HAVE_STATUS_API 53 + +/* Whether or not the DNS API is supported. */ +#define SBTC_HAVE_DNS_API 54 + +/* Set or get a pointer to the currently installed log hook. */ +#define SBTC_LOG_HOOK 55 + +/* Get the system status, with regard to whether the TCP/IP stack + has access to network interfaces and name resolution servers. */ +#define SBTC_SYSTEM_STATUS 56 + +/* Get or set the signal mask used to send a notification when + the address of an interface has changed. */ +#define SBTC_SIG_ADDRESS_CHANGE_MASK 57 + +/* If the IP filter API is supported, which version of that API + would it be? */ +#define SBTC_IPF_API_VERSION 58 + +/* Whether or not the local database access API is supported. */ +#define SBTC_HAVE_LOCAL_DATABASE_API 59 + +/* Whether or not the address conversion API is supported. */ +#define SBTC_HAVE_ADDRESS_CONVERSION_API 60 + +/* Whether or not the kernel memory API is supported. */ +#define SBTC_HAVE_KERNEL_MEMORY_API 61 + +/* Get or set the IP filter hook which is invoked whenever a + datagram has arrived or is about to be sent. */ +#define SBTC_IP_FILTER_HOOK 62 + +/* Whether or not the server API is supported. */ +#define SBTC_HAVE_SERVER_API 63 + +/* Query the number of bytes received so far. */ +#define SBTC_GET_BYTES_RECEIVED 64 + +/* Query the number of bytes sent so far. */ +#define SBTC_GET_BYTES_SENT 65 + +/* International Domain Name support: which character set should be assumed + when performing translations between the name provided to the resolver + and the encoded form sent to the Domain Name System server? See below + for a list of choices. */ +#define SBTC_IDN_DEFAULT_CHARACTER_SET 66 + +/* Whether or not the RoadshowData API is supported. */ +#define SBTC_HAVE_ROADSHOWDATA_API 67 + +/* Install or remove the error code hook. */ +#define SBTC_ERROR_HOOK 68 + +/* Whether or not the gethostbyname_r() and gethostbyaddr_r() functions + are supported. */ +#define SBTC_HAVE_GETHOSTADDR_R_API 69 + +/****************************************************************************/ + +/* + * International Domain Name support: character sets that can be used + * with SocketBaseTagList() and the SBTC_IDN_DEFAULT_CHARACTER_SET + * feature. + */ + +#define IDNCS_ASCII 0 /* Plain ASCII encoding; this will + disable the transparent domain + name translation feature. */ +#define IDNCS_ISO_8859_LATIN_1 1 /* The native Amiga character set. */ + +/****************************************************************************/ + +/* + * Flags returned by a SocketBaseTagList() 'SBTC_SYSTEM_STATUS' query. + */ + +#define SBSYSSTAT_Interfaces (1L<<0) /* Interfaces are available, + configured and + operational. */ +#define SBSYSSTAT_PTP_Interfaces (1L<<1) /* Point-to-point interfaces + are available, configured + and operational. */ +#define SBSYSSTAT_BCast_Interfaces (1L<<2) /* Broadcast interfaces are + available, configured and + operational. */ +#define SBSYSSTAT_Resolver (1L<<3) /* Domain name servers are + known and available */ +#define SBSYSSTAT_Routes (1L<<4) /* Routing information is + configured */ +#define SBSYSSTAT_DefaultRoute (1L<<5) /* A default route is + configured */ + +/****************************************************************************/ + +/* + * Data structures for use with the log hook. + */ + +struct LogHookMessage +{ + LONG lhm_Size; /* Size of this data structure in bytes. */ + LONG lhm_Priority; /* Log entry priority (LOG_EMERG..LOG_DEBUG) */ + struct DateStamp + lhm_Date; /* Time and date when this log entry was + added. */ + STRPTR lhm_Tag; /* Name of the facility which added this entry; + this can be NULL. */ + ULONG lhm_ID; /* ID of the facility which added this entry; + this can be zero. */ + STRPTR lhm_Message; /* NUL-terminated string which contains the + log message to be displayed. */ +}; + +/****************************************************************************/ + +/* + * Options for configuring how ICMP echo and time stamp + * requests should be processed. + */ +#define IR_Process 0 /* Process the request and respond to it */ +#define IR_Ignore 1 /* Ignore the request, but feed it into the + raw IP packet processing framework */ +#define IR_Drop 2 /* Ignore the request and treat it as if + it had a checksum error */ + +/****************************************************************************/ + +/* + * For use with ReleaseSocket() and ReleaseCopyOfSocket(). + */ + +#define UNIQUE_ID (-1) + +/****************************************************************************/ + +/* + * Event masks returned by GetSocketEvents(). + */ + +#define FD_ACCEPT 0x01 /* there is a connection to accept() */ +#define FD_CONNECT 0x02 /* connect() completed */ +#define FD_OOB 0x04 /* socket has out-of-band data */ +#define FD_READ 0x08 /* socket is readable */ +#define FD_WRITE 0x10 /* socket is writeable */ +#define FD_ERROR 0x20 /* asynchronous error on socket */ +#define FD_CLOSE 0x40 /* connection closed (graceful or not) */ + +/****************************************************************************/ + +/* + * Tags for use with the routing API. + */ + +#define RTA_BASE (TAG_USER+1600) + +#define RTA_Destination (RTA_BASE+1) /* Route destination + address */ +#define RTA_Gateway (RTA_BASE+2) /* Gateway address */ +#define RTA_DefaultGateway (RTA_BASE+3) /* Default gateway address */ +#define RTA_DestinationHost (RTA_BASE+4) /* Route destination + address; destination is + assumed to be a host and + not a network */ +#define RTA_DestinationNet (RTA_BASE+5) /* Route destination + address; destination is + assumed to be a network + and not a host */ + +/****************************************************************************/ + +/* + * Tags for use with the interface management API, + * specifically the AddInterfaceTagList() call. + */ +#define IFA_BASE (TAG_USER+1700) + +#define IFA_IPType (IFA_BASE+1) /* IP packet type */ +#define IFA_ARPType (IFA_BASE+2) /* ARP packet type */ +#define IFA_NumReadRequests (IFA_BASE+3) /* Number of read requests + to queue */ +#define IFA_NumWriteRequests (IFA_BASE+4) /* Number of write requests + to queue */ +#define IFA_NumARPRequests (IFA_BASE+5) /* Number of ARP requests + to queue */ +#define IFA_PacketFilterMode (IFA_BASE+6) /* Operating mode of the + Berkeley packet filter */ +#define IFA_PointToPoint (IFA_BASE+7) /* Whether or not this + interface is of the + point-to-point type */ +#define IFA_Reserved0 (IFA_BASE+8) /* This tag is reserved for + future use */ +#define IFA_Multicast (IFA_BASE+9) /* Whether or not this + interface is allowed to + send multicast packets */ +#define IFA_DownGoesOffline (IFA_BASE+10) /* Whether or not this + interface will go offline + when it is taken down */ +#define IFA_ReportOffline (IFA_BASE+11) /* Whether or not this + interface will cause a + notification message to + be logged when it goes + offline */ +#define IFA_RequiresInitDelay (IFA_BASE+12) /* Whether or not this + interface requires a short + delay to precede the + device initialization */ +#define IFA_CopyMode (IFA_BASE+13) /* Special data copy options + for this interface */ +#define IFA_HardwareAddress (IFA_BASE+14) /* Set the interface hardware + address to a certain + value. */ +#define IFA_SetDebugMode (IFA_BASE+15) /* Enable or disable debugging + mode for this interface. */ +#define IFA_LimitMTU (IFA_BASE+16) /* Set the maximum hardware + transmission unit. */ + +/****************************************************************************/ + +/* This is used with the 'IFA_HardwareAddress' tag above. */ +struct InterfaceHardwareAddress +{ + LONG iha_Length; /* Number of bits in address */ + UBYTE * iha_Address; /* Points to first address byte */ +}; + +/****************************************************************************/ + +/* + * Options available for use with the IFA_PacketFilterMode tag. + */ +#define PFM_Nothing 0 /* Filter is disabled for this interface. */ +#define PFM_Local 1 /* Filter is enabled; only packets intended + for this interface are filtered */ +#define PFM_IPandARP 2 /* Filter is enabled; all IP and ARP packets + are filtered, even if they are not intended + for this interface */ +#define PFM_Everything 3 /* Filter is enabled; all packets are filtered + that pass by, regardless of their type and + contents */ + +/****************************************************************************/ + +/* + * Options available for use with the IFA_CopyMode tag. + */ +#define CM_SlowWordCopy 0 /* Disables the S2_CopyFromBuff16 SANA-II + buffer management option (default). */ +#define CM_FastWordCopy 1 /* Enables the S2_CopyFromBuff16 SANA-II + buffer management option. */ + +/****************************************************************************/ + +/* + * Tags for use with the interface management API, + * specifically the ConfigureInterfaceTagList() call. + */ +#define IFC_BASE (TAG_USER+1800) + +#define IFC_Address (IFC_BASE+1) /* The address to assign to + the interface itself */ +#define IFC_NetMask (IFC_BASE+2) /* The interface's address + net mask */ +#define IFC_DestinationAddress (IFC_BASE+3) /* The address of the other + end of a point-to-point + link */ +#define IFC_BroadcastAddress (IFC_BASE+4) /* The broadcast address to + be used by the interface */ +#define IFC_Metric (IFC_BASE+5) /* The routing metric value */ + +#define IFC_AddAliasAddress (IFC_BASE+6) /* Add another alias address + for this interface */ +#define IFC_DeleteAliasAddress (IFC_BASE+7) /* Remove an alias address + for this interface */ +#define IFC_State (IFC_BASE+8) /* Mark an interface up, down, + online or offline */ +#define IFC_GetPeerAddress (IFC_BASE+9) /* If available, obtain the + interface's local address + and the address of its + point to point partner */ +#define IFC_GetDNS (IFC_BASE+10) /* If available, obtain the + domain name servers known + to this interface */ +#define IFC_AssociatedRoute (IFC_BASE+12) /* That interface is associated + with a route. */ +#define IFC_AssociatedDNS (IFC_BASE+13) /* That interface is associated + with a DNS. */ +#define IFC_ReleaseAddress (IFC_BASE+14) /* Release the address allocated + for this interface (via the + DHCP protocol). */ +#define IFC_SetDebugMode (IFC_BASE+15) /* Enable or disable debugging + mode for this interface. */ +#define IFC_Complete (IFC_BASE+16) /* Indicate that the configuration + for this interface is complete */ +#define IFC_LimitMTU (IFC_BASE+17) /* Set the maximum hardware + transmission unit */ + +/****************************************************************************/ + +/* + * Tags for use with the interface management API, + * specifically the QueryInterfaceTagList() call. + */ +#define IFQ_BASE (TAG_USER+1900) + +#define IFQ_DeviceName (IFQ_BASE+1) /* Query the associated + SANA-II device name */ +#define IFQ_DeviceUnit (IFQ_BASE+2) /* Query the associated + SANA-II unit number */ +#define IFQ_HardwareAddressSize (IFQ_BASE+3) /* Query the hardware address + size (in bytes) */ +#define IFQ_HardwareAddress (IFQ_BASE+4) /* Query the hardware + address */ +#define IFQ_MTU (IFQ_BASE+5) /* Query the maximum + transmission unit currently + in use */ +#define IFQ_BPS (IFQ_BASE+6) /* Query the transmission + speed */ +#define IFQ_HardwareType (IFQ_BASE+7) /* Query the SANA-II hardware + type */ +#define IFQ_PacketsReceived (IFQ_BASE+8) /* Query the number of + packets received by this + interface */ +#define IFQ_PacketsSent (IFQ_BASE+9) /* Query the number of + packets sent by this + interface */ +#define IFQ_BadData (IFQ_BASE+10) /* Query the number of bad + packets dropped by this + interface */ +#define IFQ_Overruns (IFQ_BASE+11) /* Query the number of buffer + overruns */ +#define IFQ_UnknownTypes (IFQ_BASE+12) /* Query the number of unknown + packet types dropped by this + interface */ +#define IFQ_LastStart (IFQ_BASE+13) /* Query the last time the + interface went online */ +#define IFQ_Address (IFQ_BASE+14) /* Query the IP address + associated with this + interface */ +#define IFQ_DestinationAddress (IFQ_BASE+15) /* Query the interface's + destination address */ +#define IFQ_BroadcastAddress (IFQ_BASE+16) /* Query the interface's + broadcast address */ +#define IFQ_NetMask (IFQ_BASE+17) /* Query the interface's + subnet mask */ +#define IFQ_Metric (IFQ_BASE+18) /* Query the interface's + metric value */ +#define IFQ_State (IFQ_BASE+19) /* Query the interface's + status */ +#define IFQ_AddressBindType (IFQ_BASE+20) /* Query whether the address + bound to this interface + is statically, manually + or dynamically bound. */ +#define IFQ_AddressLeaseExpires (IFQ_BASE+21) /* Find out whether and when + the address bound to this + interface expires. */ +#define IFQ_PrimaryDNSAddress (IFQ_BASE+22) /* Query the primary domain + name server address known + to this interface */ +#define IFQ_SecondaryDNSAddress (IFQ_BASE+23) /* Query the secondary domain + name server address known + to this interface */ +#define IFQ_NumReadRequests (IFQ_BASE+24) /* Number of read I/O requests + allocated for this + interface */ +#define IFQ_MaxReadRequests (IFQ_BASE+25) /* Maximum number of read I/O + requests in use at a time + on this interface */ +#define IFQ_NumWriteRequests (IFQ_BASE+26) /* Number of write I/O requests + allocated for this + interface */ +#define IFQ_MaxWriteRequests (IFQ_BASE+27) /* Maximum number of write I/O + requests in use at a time + on this interface */ +#define IFQ_GetBytesIn (IFQ_BASE+28) /* Query the number of bytes + received */ +#define IFQ_GetBytesOut (IFQ_BASE+29) /* Query the number of bytes + sent */ +#define IFQ_GetDebugMode (IFQ_BASE+30) /* Check if this interface has + the debug mode enabled */ +#define IFQ_GetSANA2CopyStats (IFQ_BASE+31) /* Obtain the SANA-II data + copy statistics */ +#define IFQ_NumReadRequestsPending (IFQ_BASE+32) + /* Number of read I/O requests + still pending to be + satisfied on this + interface */ +#define IFQ_NumWriteRequestsPending (IFQ_BASE+33) + /* Number of write I/O requests + still pending to be + satisfied on this + interface */ +#define IFQ_HardwareMTU (IFQ_BASE+34) /* Query the maximum hardware + transmission unit */ + +#define IFQ_OutputDrops (IFQ_BASE+35) /* Query the number of packets + dropped during transmission */ + +#define IFQ_InputDrops (IFQ_BASE+36) /* Query the number of packets + dropped during reception */ + +#define IFQ_OutputErrors (IFQ_BASE+37) /* Query the number errors + encountered during data + transmission */ + +#define IFQ_InputErrors (IFQ_BASE+38) /* Query the number errors + encountered during data + reception */ + +#define IFQ_OutputMulticasts (IFQ_BASE+39) /* Query the number of + multicast packets sent */ + +#define IFQ_InputMulticasts (IFQ_BASE+40) /* Query the number of + multicast packets + received */ + +#define IFQ_IPDrops (IFQ_BASE+41) /* Query the total number + of all IP packets dropped */ + +#define IFQ_ARPDrops (IFQ_BASE+42) /* Query the total number + of all ARP packets dropped */ + +/****************************************************************************/ + +/* This is used with the 'IFQ_GetSANA2CopyStats' tag above. */ +struct SANA2CopyStats +{ + ULONG s2cs_DMAIn; /* How many times data was received via the + DMA transfer function */ + ULONG s2cs_DMAOut; /* How many times data was sent via the + DMA transfer function */ + + ULONG s2cs_ByteIn; /* How many times data was received via the + byte wide copy function */ + ULONG s2cs_ByteOut; /* How many times data was sent via the + byte wide copy function */ + + ULONG s2cs_WordOut; /* How many times data was sent via the + word wide copy function */ +}; + +/****************************************************************************/ + +/* The different types of interface address binding. */ +#define IFABT_Unknown 0 /* The interface address has not been bound + or is in transitional state; check later + for more information. */ +#define IFABT_Static 1 /* The address was assigned manually, or + by an automated configuration process + and is not expected to change. */ +#define IFABT_Dynamic 2 /* The address was assigned by an automated + configuration process and may change in the + future. */ + +/****************************************************************************/ + +/* + * The 64 bit integer value used by the IFQ_GetBytesIn..IFQ_GetResetBytesOut + * query tags. + */ +typedef struct +{ + ULONG sbq_High; + ULONG sbq_Low; +} SBQUAD_T; + +/****************************************************************************/ + +/* + * Options available for use with the IFC_State and IFQ_State tags. + */ +#define SM_Offline 0 /* Interface is offline and not ready to + receive and transmit data */ +#define SM_Online 1 /* Interface is online and ready to receive + and transmit data */ +#define SM_Down 2 /* Interface is not ready to receive and + transmit data, but might still be + online. */ +#define SM_Up 3 /* Interface is ready to receive and transmit + data, but not necessarily online. */ + +/****************************************************************************/ + +/* + * Types of monitoring hooks that can be installed. + */ +#define MHT_ICMP 0 /* ICMP message monitoring */ +#define MHT_UDP 1 /* UDP datagram monitoring */ +#define MHT_TCP_Connect 2 /* TCP connection monitoring */ +#define MHT_Connect 3 /* connect() call monitoring */ +#define MHT_Send 4 /* sendto() and sendmsg() monitoring */ +#define MHT_Packet 5 /* Low level packet monitoring */ +#define MHT_Bind 6 /* bind() call monitoring */ + +/****************************************************************************/ + +/* + * Parameters passed to the different monitoring hooks. + */ + +/* This type of message parameter is passed to 'MHT_Connect' + type monitoring hooks. */ +struct ConnectMonitorMsg +{ + LONG cmm_Size; /* Size of this data + structure */ + STRPTR cmm_Caller; /* The name of the calling + program, if it chose to be + identified */ + LONG cmm_Socket; /* The socket to connect to + the address */ + struct sockaddr * + cmm_Name; /* The address to connect + to */ + LONG cmm_NameLen; /* The size of the address */ +}; + +/* This type of message parameter is passed to 'MHT_Bind' + type monitoring hooks. */ +struct BindMonitorMsg +{ + LONG bmm_Size; /* Size of this data + structure */ + STRPTR bmm_Caller; /* The name of the calling + program, if it chose to be + identified */ + LONG bmm_Socket; /* The socket to bind to the + address */ + struct sockaddr * + bmm_Name; /* The address to bind */ + LONG bmm_NameLen; /* The size of the address */ +}; + +/* This type of message is passed to 'MHT_Send' type monitoring hooks. */ +struct SendMonitorMessage +{ + LONG smm_Size; /* Size of this data structure */ + STRPTR smm_Caller; /* The name of the calling + program, if it chose to be + identified */ + LONG smm_Socket; /* The socket to connect to the + address */ + APTR smm_Buffer; /* Data to be sent */ + LONG smm_Len; /* Amount of data to be sent */ + LONG smm_Flags; /* Control flags, including + MSG_OOB or MSG_DONTROUTE */ + struct sockaddr * + smm_To; /* The address to send the + data to; this may be NULL */ + LONG smm_ToLen; /* The size of the address to send + this data to; this may be + NULL */ + struct msghdr * smm_Msg; /* The message to send; this may + be NULL. */ +}; + +/* This type of message is passed to 'MHT_TCP_Connect' type + monitoring hooks. */ +struct TCPConnectMonitorMessage +{ + LONG tcmm_Size; /* Size of this data structure */ + struct in_addr * + tcmm_Src; /* Source internet address */ + struct in_addr * + tcmm_Dst; /* Destination internet address */ + struct tcphdr * tcmm_TCP; /* TCP header */ +}; + +/* This type of message is passed to 'MHT_UDP' type monitoring hooks. */ +struct UDPMonitorMessage +{ + LONG umm_Size; /* Size of this data structure */ + struct in_addr * + umm_Src; /* Source internet address */ + struct in_addr * + umm_Dst; /* Destination internet address */ + struct udphdr * umm_UDP; /* UDP header */ +}; + +/* This type of message is passed to 'MHT_ICMP' type monitoring hooks. */ +struct ICMPMonitorMessage +{ + LONG imm_Size; /* Size of this data structure */ + struct in_addr * + imm_Src; /* Source internet address */ + struct in_addr * + imm_Dst; /* Destination internet address */ + struct icmp * imm_ICMP; /* ICMP header */ +}; + +/* This type of message is passed to 'MHT_Packet' type monitoring hooks. */ +struct PacketMonitorMessage +{ + LONG pmm_Size; /* Size of this data structure */ + LONG pmm_Direction; /* Whether the packet was received + or is about to be sent */ + APTR pmm_LinkLayerData; + /* Points to the link layer part + of the packet, typically an + Ethernet header per RFC 894. + This may be NULL. */ + LONG pmm_LinkLayerSize; + /* Size of the link layer data part + of the packet; this may be 0. */ + APTR pmm_PacketData; /* Points to the packet 'payload'. */ + LONG pmm_PacketSize; /* Size of the packet 'payload'. */ +}; + +/* Possible values for 'pmm_Direction'. */ +#define PMMD_Receive 0 /* Packet was received and is waiting to be + processed */ +#define PMMD_Send 1 /* Packet is about to be sent */ + +/****************************************************************************/ + +/* + * Possible actions to be taken after a monitoring hook has + * examined the data it was passed. Any positive return value + * will cause the data to be dropped and the corresponding + * errno value to be set to the result. + */ +#define MA_Continue 0 /* Proceed as if no filtering had + taken place */ +#define MA_Ignore -1 /* Ignore the data and skip the + normal route processing would + take */ +#define MA_Drop -2 /* Drop the data */ +#define MA_DropWithReset -3 /* Drop the data and also reset the + connection */ + +/****************************************************************************/ + +/* + * Parameters for use with the GetNetworkStatus() function. + */ + +/* What version of the statistics data should be returned; so far + there is only version #1. */ +#define NETWORKSTATUS_VERSION 1 + +/* What statistics should be provided */ + +#define NETSTATUS_icmp 0 /* Internet control message + protocol statistics */ +#define NETSTATUS_igmp 1 /* Internet group management + protocol statistics */ +#define NETSTATUS_ip 2 /* Internet protocol statistics */ +#define NETSTATUS_mb 3 /* Memory buffer statistics */ +#define NETSTATUS_mrt 4 /* Multicast routing statistics */ +#define NETSTATUS_rt 5 /* Routing statistics */ +#define NETSTATUS_tcp 6 /* Transmission control protocol + statistics */ +#define NETSTATUS_udp 7 /* User datagram protocol + statistics */ +#define NETSTATUS_tcp_sockets 9 /* TCP socket statistics */ +#define NETSTATUS_udp_sockets 10 /* UDP socket statistics */ + +/* Protocol connection data returned for each TCP/UDP socket. */ +struct protocol_connection_data +{ + struct in_addr + pcd_foreign_address; /* Foreign host address */ + UWORD pcd_foreign_port; /* Foreign port number */ + struct in_addr + pcd_local_address; /* Local host address */ + UWORD pcd_local_port; /* Local port number */ + ULONG pcd_receive_queue_size; /* Socket receive queue size */ + ULONG pcd_send_queue_size; /* Socket send queue size */ + LONG pcd_tcp_state; /* Socket TCP state */ +}; + +/****************************************************************************/ + +/* + * Interface address allocation (BOOTP and DHCP). + */ + +/* The message to send to the interface configuration process + to start looking for an IP address. */ +struct AddressAllocationMessage +{ + struct Message + aam_Message; + LONG aam_Reserved; + LONG aam_Result; /* What kind of result this + request produced. */ + LONG aam_Version; /* Version number associated with + this data structure. */ + LONG aam_Protocol; /* What kind of configuration + protocol should be used. */ + char aam_InterfaceName[16]; /* Name of interface an + address is to be + assigned to. */ + LONG aam_Timeout; /* Number of seconds to + wait before a result + materializes. */ + ULONG aam_LeaseTime; /* Requested lease time in + seconds; 0 to accept the + default. */ + ULONG aam_RequestedAddress; /* Interface address that should + be assigned, if possible; 0 + to accept the server's choice. */ + STRPTR aam_ClientIdentifier; /* Unique identifier for this + host */ + ULONG aam_Address; /* Interface address + returned upon + success. */ + ULONG aam_ServerAddress; /* Address of BOOTP server. */ + ULONG aam_SubnetMask; /* Interface subnet + mask; ignore if zero. */ + + STRPTR aam_NAKMessage; /* In case of failure, + put the explanation + text here. */ + LONG aam_NAKMessageSize; /* Maximum length of the + negative ack message. */ + + ULONG * aam_RouterTable; /* A list of router addresses + will be put here. */ + LONG aam_RouterTableSize; /* Maximum number of valid + router addresses. */ + + ULONG * aam_DNSTable; /* A list of domain name servers + will be put here. */ + LONG aam_DNSTableSize; /* Maximum number of valid + domain name server + addresses. */ + + ULONG * aam_StaticRouteTable; /* A list of static routes + will be put here. */ + LONG aam_StaticRouteTableSize; + /* Maximum number of valid + static routes. */ + + STRPTR aam_HostName; /* If available, the name + assigned to this host will + be put here. */ + LONG aam_HostNameSize; /* Maximum size of the host + name. */ + + STRPTR aam_DomainName; /* If available, the name + of the domain assigned to + this host will be put here. */ + LONG aam_DomainNameSize; /* Maximum size of the domain + name. */ + UBYTE * aam_BOOTPMessage; /* Points to buffer to place + the BOOTP message in. */ + LONG aam_BOOTPMessageSize; /* Size of the buffer to place + the BOOTP message in. */ + struct DateStamp * + aam_LeaseExpires; /* Points to buffer to place the + lease expire date and time in. + in. This will be 0 if no data + is provided or if the lease + never expires. */ + BOOL aam_Unicast; /* Request that the DHCP server + sends messages using unicast, + rather than using broadcast. + This requires aam_Version 2 + or higher. */ +}; + +/* This data structure version. */ +#define AAM_VERSION 2 + +/* Minimum supported data structure version. */ +#define AAM_VERSION_MINIMUM 1 + +/* Available result codes. */ +#define AAMR_Success 0 /* Allocation has succeeded */ +#define AAMR_Aborted 1 /* The allocation was aborted */ +#define AAMR_InterfaceNotKnown 2 /* The interface name is not + known */ +#define AAMR_InterfaceWrongType 3 /* The interface must support + broadcast access. */ +#define AAMR_AddressKnown 4 /* The interface address is already + known. */ +#define AAMR_VersionUnknown 5 /* The data structure version is + not supported. */ +#define AAMR_NoMemory 6 /* Not enough memory to process + the request. */ +#define AAMR_Timeout 7 /* The allocation request did not + succeed in the requested time + span. */ +#define AAMR_AddressInUse 8 /* The address to be allocated is + already in use. */ +#define AAMR_AddrChangeFailed 9 /* The interface address could + not be changed. */ +#define AAMR_MaskChangeFailed 10 /* The interface subnet mask could + not be changed. */ +#define AAMR_Busy 11 /* Address allocation is already in + progress for this interface. */ +#define AAMR_Ignored -1 /* The message type was not + understood */ + +/* The minimum timeout value supported for an allocation to succeed. */ +#define AAM_TIMEOUT_MIN 10 + +/* The special DHCP lease times. */ +#define DHCP_DEFAULT_LEASE_TIME 0 +#define DHCP_INFINITE_LEASE_TIME 0xFFFFFFFF + +/* The configuration protocols to use. */ +#define AAMP_BOOTP 0 /* Bootstrap Protocol (RFC 951) */ +#define AAMP_DHCP 1 /* Dynamic Host Configuration Protocol + (RFC 2131) */ +#define AAMP_SLOWAUTO 2 /* Automatic address allocation; slower + version for Ethernet networks with + switches which use the IEEE Spanning + Tree Protocol (802.1d) */ +#define AAMP_FASTAUTO 3 /* Automatic address allocation; faster + version for wireless devices */ + +/* Tags for use with CreateAddressAllocationMessage(). */ +#define CAAMTA_BASE (TAG_USER+2000) + +/* This corresponds to the 'aam_Timeout' member of the + AddressAllocationMessage. */ +#define CAAMTA_Timeout (CAAMTA_BASE+1) + +/* This corresponds to the 'aam_LeaseTime' member of the + AddressAllocationMessage. */ +#define CAAMTA_LeaseTime (CAAMTA_BASE+2) + +/* This corresponds to the 'aam_RequestedAddress' member of the + AddressAllocationMessage. */ +#define CAAMTA_RequestedAddress (CAAMTA_BASE+3) + +/* Pointer to the client identifier string to be used; this + string must be at least 2 characters long. The string will + be duplicated and stored in the 'aam_ClientIdentifier' member + of the AddressAllocationMessage. */ +#define CAAMTA_ClientIdentifier (CAAMTA_BASE+4) + +/* Size of the buffer to allocate for the NAK message, as + stored in the 'aam_NAKMessage' member of the AddressAllocationMessage. */ +#define CAAMTA_NAKMessageSize (CAAMTA_BASE+5) + +/* Size of the buffer to allocate for the router address table, as + stored in the 'aam_RouterTable' member of the AddressAllocationMessage. */ +#define CAAMTA_RouterTableSize (CAAMTA_BASE+6) + +/* Size of the buffer to allocate for the DNS address table, as + stored in the 'aam_DNSTable' member of the AddressAllocationMessage. */ +#define CAAMTA_DNSTableSize (CAAMTA_BASE+7) + +/* Size of the buffer to allocate for the static route address table, as + stored in the 'aam_StaticRouteTable' member of the + AddressAllocationMessage. */ +#define CAAMTA_StaticRouteTableSize (CAAMTA_BASE+8) + +/* Size of the buffer to allocate for the host name, as stored in + the 'aam_HostName' member of the AddressAllocationMessage. */ +#define CAAMTA_HostNameSize (CAAMTA_BASE+9) + +/* Size of the buffer to allocate for the domain name, as stored in + the 'aam_DomainName' member of the AddressAllocationMessage. */ +#define CAAMTA_DomainNameSize (CAAMTA_BASE+10) + +/* Size of the buffer to allocate for the BOOTP message, as stored in + the 'aam_BOOTPMessage' member of the AddressAllocationMessage. */ +#define CAAMTA_BOOTPMessageSize (CAAMTA_BASE+11) + +/* Either FALSE or TRUE; if TRUE, will allocate a buffer for a + DateStamp and put its address into the 'aam_LeaseExpires' + member of the AddressAllocationMessage. */ +#define CAAMTA_RecordLeaseExpiration (CAAMTA_BASE+12) + +/* The MsgPort to send the AddressAllocationMessage to after + the configuration has finished. */ +#define CAAMTA_ReplyPort (CAAMTA_BASE+13) + +/* Either FALSE or TRUE; if TRUE, ask the DHCP server + responding to send replies using unicast instead of + broadcast (the default). Note that the DHCP server + is free to ignore this request and may send replies + using broadcast even if requested to use unicast. */ +#define CAAMTA_RequestUnicast (CAAMTA_BASE+14) + +/* Codes returned by CreateAddressAllocationMessage(). */ +#define CAAME_Success 0 /* It worked */ +#define CAAME_Invalid_result_ptr 1 /* No proper result pointer + provided */ +#define CAAME_Not_enough_memory 2 /* No enough memory available */ +#define CAAME_Invalid_version 3 /* The version number is not + in order */ +#define CAAME_Invalid_protocol 4 /* The protocol is neither BOOTP + nor DHCP */ +#define CAAME_Invalid_interface_name 5 /* The interface name is + not OK */ +#define CAAME_Interface_not_found 6 /* The name of the interface + is not known */ +#define CAAME_Invalid_client_identifier 7 /* The client identifier is not + OK */ +#define CAAME_Client_identifier_too_short 8 /* The client identifier is too + short */ +#define CAAME_Client_identifier_too_long 9 /* The client identifier is too + long */ + +/****************************************************************************/ + +/* + * The DNS management data structures. + */ + +/* These nodes are returned by the DNS API. */ +struct DomainNameServerNode +{ + struct MinNode + dnsn_MinNode; + LONG dnsn_Size; /* Size of this data structure */ + STRPTR dnsn_Address; /* Points to NUL-terminated string + which holds the IP address in + dotted-decimal notation */ + LONG dnsn_UseCount; /* Usage count of this address; + negative values indicate + statically-configured servers. */ +}; + +/****************************************************************************/ + +/* + * Filtering for incoming and outgoing IP packets. + */ + +/* This identifies whether a packet was received or is about + to be sent. Check the IPFilterMsg->ifm_Direction field to + find out. */ +#define IFMD_Incoming 0 /* Packet was received */ +#define IFMD_Outgoing 1 /* Packet is about to be sent */ + +/* The packet filter hook is invoked with a message of + this type: */ +struct IPFilterMsg +{ + LONG ifm_Size; /* Size of this data structure */ + struct ip * ifm_IP; /* Points to IP packet header */ + LONG ifm_IPLength; /* Size of the IP packet header */ + struct ifnet * ifm_Interface; /* Interface this packet either + came in from or is to be + sent to */ + LONG ifm_Direction; /* Whether this packet came in + or is about to go out */ + struct mbuf * ifm_Packet; /* The entire packet, as stored + in a memory buffer */ +}; + +/****************************************************************************/ + +/* + * Network shutdown + */ + +/* To shut down the network, send a message of the following form to the + network controller message port. */ +struct NetShutdownMessage +{ + struct Message nsm_Message; /* Standard Message header */ + + ULONG nsm_Command; /* The action to be performed */ + + APTR nsm_Data; /* Payload */ + ULONG nsm_Length; /* Payload size */ + + LONG nsm_Error; /* Whether or not the command + suceeded */ + ULONG nsm_Actual; /* How much data was transferred */ +}; + +/* The command to be sent to the network controller message port must + be one of the following: */ + +#define NSMC_Shutdown 1 /* Shut down the network; a pointer to an + ULONG may be placed in nsm_Data (if the + shutdown does not succeed, this is where + the number of active clients will be + placed). */ + +#define NSMC_Cancel 2 /* Cancel a shutdown request; this recalls + a shutdown message, to which a pointer must + be placed in nsm_Data. */ + +/* Error codes that may be set when a message returns: */ + +#define NSME_Success 0 /* Command was processed successfully */ + +#define NSME_Aborted 1 /* Command was aborted */ + +#define NSME_InUse 2 /* Network is still running, since clients are + still using it */ + +#define NSME_Ignored 3 /* Command was ignored (network may be shutting + down right now) */ + +#define NSME_NotFound 4 /* Shutdown command to be cancelled could not + be recalled */ + +/* The name of the public network controller message port: */ +#define NETWORK_CONTROLLER_PORT_NAME "TCP/IP Control" + +/* The network controller message port data structure; you must check the + magic cookie before you post a message to it. If the cookie value is + missing, don't send your message: the controller may not be listening + to it. To be on the safe side, look for the port under Forbid(), + check the cookie, then post the message. */ +struct NetControlPort +{ + struct MsgPort ncp_Port; + ULONG ncp_Magic; +}; + +/* The magic cookie stored in ncp_Magic: */ +#define NCPM_Cookie 0x20040306 + +/****************************************************************************/ + +/* + * System data access + */ + +/* ObtainRoadshowData() returns a pointer to a list of data items which + may be viewed or modified. Here is how the list items look like. */ +struct RoadshowDataNode +{ + struct MinNode rdn_MinNode; + + STRPTR rdn_Name; /* Name assigned to this item */ + UWORD rdn_Flags; /* Properties of this data (see + below) */ + WORD rdn_Type; /* What kind of data this + is (see below) */ + ULONG rdn_Length; /* Size of this data */ + APTR rdn_Data; /* Points to the data */ +}; + +/* What kind of data is represented by a RoadshowDataNode. */ +#define RDNT_Integer 0 /* Signed 32 bit integer */ + +/* What properties the data associated with a RoadshowDataNode has */ +#define RDNF_ReadOnly (1<<0) /* This option cannot be modified */ + +/* Parameter to pass to ObtainRoadshowData(); you can either request read + or write access. */ +#define ORD_ReadAccess 0 +#define ORD_WriteAccess 1 + +/****************************************************************************/ + +/* + * Call-back hook for use with SBTC_ERROR_HOOK + */ +struct ErrorHookMsg +{ + ULONG ehm_Size; /* Size of this data structure; this + must be >= 12 */ + ULONG ehm_Action; /* See below for a list of definitions */ + + LONG ehm_Code; /* The error code to use */ +}; + +/* Which action the hook is to perform */ +#define EHMA_Set_errno 1 /* Set the local 'errno' to what is + found in ehm_Code */ +#define EHMA_Set_h_errno 2 /* Set the local 'h_errno' to what is + found in ehm_Code */ + +/****************************************************************************/ + +/* + * A pointer to the following data structure can be found in a Process + * pr_ExitData field if the associated program was launched as a server + * by the Internet super-server (inetd). You should check it only if your + * program is known to act as a server because otherwise the contents of + * the pr_ExitData field are unreliable. + * + * The purpose of this data structure is to let your application access the + * socket allocated for it by the Internet super-server, which can be + * accomplished as follows: + * + * extern struct Library * DOSBase; + * + * struct Process * this_process = (struct Process *)FindTask(NULL); + * LONG have_server_api = FALSE; + * struct DaemonMessage * dm; + * LONG socket = -1; + * + * if(SocketBaseTags( + * SBTM_GETREF(SBTC_HAVE_SERVER_API),&have_server_api, + * TAG_END) == 0) + * { + * if(have_server_api && ProcessIsServer(this_process)) + * { + * if(DOSBase->lib_Version < 50) + * dm = (struct DaemonMessage *)this_process->pr_ExitData; + * else + * dm = (struct DaemonMessage *)GetExitData(); + * + * socket = ObtainSocket(dm->dm_ID,dm->dm_Family,dm->dm_Type,0); + * } + * } + */ + +struct DaemonMessage +{ + struct Message dm_Message; /* Used by super-server; don't touch! */ + ULONG dm_Pad1; /* Used by super-server; don't touch! */ + ULONG dm_Pad2; /* Used by super-server; don't touch! */ + LONG dm_ID; /* Public socket identifier; this must + be passed to ObtainSocket() to + access the socket allocated for you */ + ULONG dm_Pad3; /* Used by super-server; don't touch! */ + UBYTE dm_Family; /* Socket family type */ + UBYTE dm_Type; /* Socket type */ +}; + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _LIBRARIES_BSDSOCKET_H */ diff --git a/netinclude/libraries/usergroup.h b/netinclude/libraries/usergroup.h new file mode 100755 index 0000000..18b2e17 --- /dev/null +++ b/netinclude/libraries/usergroup.h @@ -0,0 +1,163 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack; "usergroup.library" API + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + * + * WARNING: The "usergroup.library" API must be considered obsolete and + * should not be used in new software. It is provided solely + * for backwards compatibility and legacy application software. + */ + +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ucred.h 8.4 (Berkeley) 1/9/95 + */ + +#ifndef LIBRARIES_USERGROUP_H +#define LIBRARIES_USERGROUP_H + +/****************************************************************************/ + +#ifndef EXEC_TYPES_H +#include +#endif /* EXEC_TYPES_H */ + +#ifndef _PWD_H +#include +#endif /* _PWD_H */ + +#ifndef _GRP_H +#include +#endif /* _GRP_H */ + +#ifndef _UTMP_H +#include +#endif /* _UTMP_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +#define USERGROUPNAME "usergroup.library" + +/****************************************************************************/ + +#define _PASSWORD_EFMT1 '_' /* extended encryption format */ +#define _PASSWORD_LEN 128 /* max length, not counting NULL */ + +/****************************************************************************/ + +#define NGROUPS 32 /* max number groups */ + +/****************************************************************************/ + +#define MAXLOGNAME 32 /* max length of login name */ + +/****************************************************************************/ + +/* + * Credentials. + */ +struct UserGroupCredentials +{ + LONG cr_ruid; + LONG cr_rgid; + UWORD cr_umask; + LONG cr_euid; + WORD cr_ngroups; + LONG cr_groups[NGROUPS]; + LONG cr_session; + TEXT cr_login[MAXLOGNAME]; +}; + +/****************************************************************************/ + +/* + * ID conversion + */ +#define UG2MU(id) ((id) == 0 ? 65535 : (id) == -2 ? 0 : (id)) +#define MU2UG(id) ((id) == 65535 ? 0L : (id) == 0 ? -2 : (id)) + +/****************************************************************************/ + +/* + * Context tags + */ +#define UGT_ERRNOBPTR 0x80000001 +#define UGT_ERRNOWPTR 0x80000002 +#define UGT_ERRNOLPTR 0x80000004 +#define UGT_ERRNOPTR(size) \ + ((size == sizeof(long)) ? UGT_ERRNOLPTR : \ + (size == sizeof(short)) ? UGT_ERRNOWPTR : \ + (size == sizeof(char)) ? UGT_ERRNOBPTR : 1) +#define UGT_OWNER 0x80000011 +#define UGT_INTRMASK 0x80000010 + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* LIBRARIES_USERGROUP_H */ diff --git a/netinclude/net/bpf.h b/netinclude/net/bpf.h new file mode 100755 index 0000000..3e69f38 --- /dev/null +++ b/netinclude/net/bpf.h @@ -0,0 +1,302 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1990, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bpf.h 8.2 (Berkeley) 1/9/95 + * + */ + +#ifndef _NET_BPF_H +#define _NET_BPF_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _SYS_IOCCOM_H +#include +#endif /* _SYS_IOCCOM_H */ + +#ifndef _SYS_SOCKET_H +#include +#endif /* _SYS_SOCKET_H */ + +/****************************************************************************/ + +#ifndef __timeval +#ifdef __NEW_TIMEVAL_DEFINITION_USED__ +#define __timeval TimeVal +#else +#define __timeval timeval +#endif /* __NEW_TIMEVAL_DEFINITION_USED__ */ +#endif /* __timeval */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Alignment macros. BPF_WORDALIGN rounds up to the next + * even multiple of BPF_ALIGNMENT. + */ +#define BPF_ALIGNMENT sizeof(__LONG) +#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) + +#define BPF_MAXINSNS 512 +#define BPF_MAXBUFSIZE 0x8000 +#define BPF_MINBUFSIZE 32 + +/* + * Structure for BIOCSETF. + */ +struct bpf_program { + __ULONG bf_len; + struct bpf_insn *bf_insns; +}; + +/* + * Struct returned by BIOCGSTATS. + */ +struct bpf_stat { + __ULONG bs_recv; /* number of packets received */ + __ULONG bs_drop; /* number of packets dropped */ +}; + +/* + * Struct return by BIOCVERSION. This represents the version number of + * the filter language described by the instruction encodings below. + * bpf understands a program iff kernel_major == filter_major && + * kernel_minor >= filter_minor, that is, if the value returned by the + * running kernel has the same major number and a minor number equal + * equal to or less than the filter being downloaded. Otherwise, the + * results are undefined, meaning an error may be returned or packets + * may be accepted haphazardly. + * It has nothing to do with the source code version. + */ +struct bpf_version { + __UWORD bv_major; + __UWORD bv_minor; +}; +/* Current version number. */ +#define BPF_MAJOR_VERSION 1 +#define BPF_MINOR_VERSION 1 + +/* + * BPF ioctls + * + * The first set is for compatibility with Sun's pcc style + * header files. If your using gcc, we assume that you + * have run fixincludes so the latter set should work. + */ +#if (defined(sun) || defined(ibm032)) && !defined(__GNUC__) +#define BIOCGBLEN _IOR(B,102, __ULONG) +#define BIOCSBLEN _IOWR(B,102, __ULONG) +#define BIOCSETF _IOW(B,103, struct bpf_program) +#define BIOCFLUSH _IO(B,104) +#define BIOCPROMISC _IO(B,105) +#define BIOCGDLT _IOR(B,106, __ULONG) +#define BIOCGETIF _IOR(B,107, struct ifreq) +#define BIOCSETIF _IOW(B,108, struct ifreq) +#define BIOCSRTIMEOUT _IOW(B,109, struct __timeval) +#define BIOCGRTIMEOUT _IOR(B,110, struct __timeval) +#define BIOCGSTATS _IOR(B,111, struct bpf_stat) +#define BIOCIMMEDIATE _IOW(B,112, __ULONG) +#define BIOCVERSION _IOR(B,113, struct bpf_version) +#else +#define BIOCGBLEN _IOR('B',102, __ULONG) +#define BIOCSBLEN _IOWR('B',102, __ULONG) +#define BIOCSETF _IOW('B',103, struct bpf_program) +#define BIOCFLUSH _IO('B',104) +#define BIOCPROMISC _IO('B',105) +#define BIOCGDLT _IOR('B',106, __ULONG) +#define BIOCGETIF _IOR('B',107, struct ifreq) +#define BIOCSETIF _IOW('B',108, struct ifreq) +#define BIOCSRTIMEOUT _IOW('B',109, struct __timeval) +#define BIOCGRTIMEOUT _IOR('B',110, struct __timeval) +#define BIOCGSTATS _IOR('B',111, struct bpf_stat) +#define BIOCIMMEDIATE _IOW('B',112, __ULONG) +#define BIOCVERSION _IOR('B',113, struct bpf_version) +#endif + +/* + * Structure prepended to each packet. + */ +struct bpf_hdr { + struct __timeval bh_tstamp; /* time stamp */ + __ULONG bh_caplen; /* length of captured portion */ + __ULONG bh_datalen; /* original length of packet */ + __UWORD bh_hdrlen; /* length of bpf header (this struct + plus alignment padding) */ +}; +/* + * Data-link level type codes. + * Currently, only DLT_EN10MB and DLT_SLIP are supported. + */ +#define DLT_NULL 0 /* no link-layer encapsulation */ +#define DLT_EN10MB 1 /* Ethernet (10Mb) */ +#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ +#define DLT_AX25 3 /* Amateur Radio AX.25 */ +#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ +#define DLT_CHAOS 5 /* Chaos */ +#define DLT_IEEE802 6 /* IEEE 802 Networks */ +#define DLT_ARCNET 7 /* ARCNET */ +#define DLT_SLIP 8 /* Serial Line IP */ +#define DLT_PPP 9 /* Point-to-point Protocol */ +#define DLT_FDDI 10 /* FDDI */ + +/* + * The instruction encondings. + */ +/* instruction classes */ +#define BPF_CLASS(code) ((code) & 0x07) +#define BPF_LD 0x00 +#define BPF_LDX 0x01 +#define BPF_ST 0x02 +#define BPF_STX 0x03 +#define BPF_ALU 0x04 +#define BPF_JMP 0x05 +#define BPF_RET 0x06 +#define BPF_MISC 0x07 + +/* ld/ldx fields */ +#define BPF_SIZE(code) ((code) & 0x18) +#define BPF_W 0x00 +#define BPF_H 0x08 +#define BPF_B 0x10 +#define BPF_MODE(code) ((code) & 0xe0) +#define BPF_IMM 0x00 +#define BPF_ABS 0x20 +#define BPF_IND 0x40 +#define BPF_MEM 0x60 +#define BPF_LEN 0x80 +#define BPF_MSH 0xa0 + +/* alu/jmp fields */ +#define BPF_OP(code) ((code) & 0xf0) +#define BPF_ADD 0x00 +#define BPF_SUB 0x10 +#define BPF_MUL 0x20 +#define BPF_DIV 0x30 +#define BPF_OR 0x40 +#define BPF_AND 0x50 +#define BPF_LSH 0x60 +#define BPF_RSH 0x70 +#define BPF_NEG 0x80 +#define BPF_JA 0x00 +#define BPF_JEQ 0x10 +#define BPF_JGT 0x20 +#define BPF_JGE 0x30 +#define BPF_JSET 0x40 +#define BPF_SRC(code) ((code) & 0x08) +#define BPF_K 0x00 +#define BPF_X 0x08 + +/* ret - BPF_K and BPF_X also apply */ +#define BPF_RVAL(code) ((code) & 0x18) +#define BPF_A 0x10 + +/* misc */ +#define BPF_MISCOP(code) ((code) & 0xf8) +#define BPF_TAX 0x00 +#define BPF_TXA 0x80 + +/* + * The instruction data structure. + */ +struct bpf_insn { + __UWORD code; + __UBYTE jt; + __UBYTE jf; + __LONG k; +}; + +/* + * Macros for insn array initializers. + */ +#define BPF_STMT(code, k) { (__UWORD)(code), 0, 0, k } +#define BPF_JUMP(code, k, jt, jf) { (__UWORD)(code), jt, jf, k } + +/* + * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). + */ +#define BPF_MEMWORDS 16 + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NET_BPF_H */ diff --git a/netinclude/net/if.h b/netinclude/net/if.h new file mode 100755 index 0000000..f6a1988 --- /dev/null +++ b/netinclude/net/if.h @@ -0,0 +1,341 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if.h 8.3 (Berkeley) 2/9/95 + */ + +#ifndef _NET_IF_H +#define _NET_IF_H + +/****************************************************************************/ + +/* + * Structures defining a network interface, providing a packet + * transport mechanism (ala level 0 of the PUP protocols). + * + * Each interface accepts output datagrams of a specified maximum + * length, and provides higher level routines with input datagrams + * received from its medium. + * + * Output occurs when the routine if_output is called, with three parameters: + * (*ifp->if_output)(ifp, m, dst, rt) + * Here m is the mbuf chain to be sent and dst is the destination address. + * The output routine encapsulates the supplied datagram if necessary, + * and then transmits it on its medium. + * + * On input, each interface unwraps the data received by it, and either + * places it on the input queue of a internetwork datagram routine + * and posts the associated software interrupt, or passes the datagram to a raw + * packet input routine. + * + * Routines exist for locating interfaces by their addresses + * or for locating a interface on a certain network, as well as more general + * routing and gateway routines maintaining information used to locate + * interfaces. These routines live in the files if.c and route.c + */ + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _SYS_SOCKET_H +#include +#endif /* _SYS_SOCKET_H */ + +/****************************************************************************/ + +#ifndef __timeval +#ifdef __NEW_TIMEVAL_DEFINITION_USED__ +#define __timeval TimeVal +#else +#define __timeval timeval +#endif /* __NEW_TIMEVAL_DEFINITION_USED__ */ +#endif /* __timeval */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Structure describing information about an interface + * which may be of interest to management entities. + */ +/* + * Structure defining a queue for a network interface. + * + * (Would like to call this struct ``if'', but C isn't PL/1.) + */ + +/* 'struct if_data' and 'struct ifqueue' used to be defined within + * 'struct ifnet', which is problematic for use with C++. + */ +struct if_data { + /* generic interface information */ + __UBYTE ifi_type; /* ethernet, tokenring, etc */ + __UBYTE ifi_addrlen; /* media address length */ + __UBYTE ifi_hdrlen; /* media header length */ + __ULONG ifi_mtu; /* maximum transmission unit */ + __ULONG ifi_metric; /* routing metric (external only) */ + __ULONG ifi_baudrate; /* linespeed */ + /* volatile statistics */ + __ULONG ifi_ipackets; /* packets received on interface */ + __ULONG ifi_ierrors; /* input errors on interface */ + __ULONG ifi_opackets; /* packets sent on interface */ + __ULONG ifi_oerrors; /* output errors on interface */ + __ULONG ifi_collisions; /* collisions on csma interfaces */ + __ULONG ifi_ibytes; /* total number of octets received */ + __ULONG ifi_obytes; /* total number of octets sent */ + __ULONG ifi_imcasts; /* packets received via multicast */ + __ULONG ifi_omcasts; /* packets sent via multicast */ + __ULONG ifi_iqdrops; /* dropped on input, this interface */ + __ULONG ifi_noproto; /* destined for unsupported protocol */ + struct __timeval ifi_lastchange;/* last updated */ +}; + +struct ifqueue { + __APTR ifq_head; + __APTR ifq_tail; + __LONG ifq_len; + __LONG ifq_maxlen; + __LONG ifq_drops; +}; + +struct ifnet { + __STRPTR if_name; /* name, e.g. ``en'' or ``lo'' */ + struct ifnet * if_next; /* all struct ifnets are chained */ + struct ifaddr * if_addrlist; /* linked list of addresses per if */ + __LONG if_pcount; /* number of promiscuous listeners */ + __APTR if_bpf; /* packet filter structure */ + __UWORD if_index; /* numeric abbreviation for this if */ + __WORD if_unit; /* sub-unit for lower level driver */ + __WORD if_timer; /* time 'til if_watchdog called */ + __UWORD if_flags; /* up/down, broadcast, etc. */ + struct if_data if_data; /* generic interface information */ +/* procedure handles */ + __APTR if_init; /* init routine */ + __APTR if_output; /* output routine (enqueue) */ + __APTR if_start; /* initiate output routine */ + __APTR if_done; /* output complete routine */ + __APTR if_ioctl; /* ioctl routine */ + __APTR if_reset; + __APTR if_watchdog; /* timer routine */ + struct ifqueue if_snd; /* output queue */ +}; +#define if_mtu if_data.ifi_mtu +#define if_type if_data.ifi_type +#define if_addrlen if_data.ifi_addrlen +#define if_hdrlen if_data.ifi_hdrlen +#define if_metric if_data.ifi_metric +#define if_baudrate if_data.ifi_baudrate +#define if_ipackets if_data.ifi_ipackets +#define if_ierrors if_data.ifi_ierrors +#define if_opackets if_data.ifi_opackets +#define if_oerrors if_data.ifi_oerrors +#define if_collisions if_data.ifi_collisions +#define if_ibytes if_data.ifi_ibytes +#define if_obytes if_data.ifi_obytes +#define if_imcasts if_data.ifi_imcasts +#define if_omcasts if_data.ifi_omcasts +#define if_iqdrops if_data.ifi_iqdrops +#define if_noproto if_data.ifi_noproto +#define if_lastchange if_data.ifi_lastchange + +#define IFF_UP 0x1 /* interface is up */ +#define IFF_BROADCAST 0x2 /* broadcast address valid */ +#define IFF_DEBUG 0x4 /* turn on debugging */ +#define IFF_LOOPBACK 0x8 /* is a loopback net */ +#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ +#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ +#define IFF_RUNNING 0x40 /* resources allocated */ +#define IFF_NOARP 0x80 /* no address resolution protocol */ +#define IFF_PROMISC 0x100 /* receive all packets */ +#define IFF_ALLMULTI 0x200 /* receive all multicast packets */ +#define IFF_OACTIVE 0x400 /* transmission in progress */ +#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ +#define IFF_LINK0 0x1000 /* per link layer defined bit */ +#define IFF_LINK1 0x2000 /* per link layer defined bit */ +#define IFF_LINK2 0x4000 /* per link layer defined bit */ +#define IFF_MULTICAST 0x8000 /* supports multicast */ + +/* flags set internally only: */ +#define IFF_CANTCHANGE \ + (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\ + IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI) + +/* + * The ifaddr structure contains information about one address + * of an interface. They are maintained by the different address families, + * are allocated and attached when an address is set, and are linked + * together so all addresses for an interface can be located. + */ +struct ifaddr { + struct sockaddr *ifa_addr; /* address of interface */ + struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ +#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ + struct sockaddr *ifa_netmask; /* used to determine subnet */ + struct ifnet *ifa_ifp; /* back-pointer to interface */ + struct ifaddr *ifa_next; /* next address for interface */ + __APTR ifa_rtrequest; /* check or clean routes (+ or -)'d */ + __UWORD ifa_flags; /* mostly rt_flags for cloning */ + __WORD ifa_refcnt; /* extra to malloc for link info */ + __LONG ifa_metric; /* cost of going out this interface */ +}; +#define IFA_ROUTE RTF_UP /* route installed */ + +/* + * Message format for use in obtaining information about interfaces + * from getkerninfo and the routing socket + */ +struct if_msghdr { + __UWORD ifm_msglen; /* to skip over non-understood messages */ + __UBYTE ifm_version; /* future binary compatability */ + __UBYTE ifm_type; /* message type */ + __LONG ifm_addrs; /* like rtm_addrs */ + __LONG ifm_flags; /* value of if_flags */ + __UWORD ifm_index; /* index for associated ifp */ + struct if_data ifm_data;/* statistics and other data about if */ +}; + +/* + * Message format for use in obtaining information about interface addresses + * from getkerninfo and the routing socket + */ +struct ifa_msghdr { + __UWORD ifam_msglen; /* to skip over non-understood messages */ + __UBYTE ifam_version; /* future binary compatability */ + __UBYTE ifam_type; /* message type */ + __LONG ifam_addrs; /* like rtm_addrs */ + __LONG ifam_flags; /* value of ifa_flags */ + __UWORD ifam_index; /* index for associated ifp */ + __LONG ifam_metric; /* value of ifa_metric */ +}; + +/* + * Interface request structure used for socket + * ioctl's. All interface ioctl's must have parameter + * definitions which begin with ifr_name. The + * remainder may be interface specific. + */ +struct ifreq { +#define IFNAMSIZ 16 + __TEXT ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + __WORD ifru_flags; + __LONG ifru_metric; + __APTR ifru_data; + } ifr_ifru; +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_flags ifr_ifru.ifru_flags /* flags */ +#define ifr_metric ifr_ifru.ifru_metric /* metric */ +#define ifr_data ifr_ifru.ifru_data /* for use by interface */ +}; + +struct ifaliasreq { + __TEXT ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct sockaddr ifra_addr; + struct sockaddr ifra_broadaddr; + struct sockaddr ifra_mask; +}; + +/* + * Structure used in SIOCGIFCONF request. + * Used to retrieve interface configuration + * for machine (useful for programs which + * must know all networks accessible). + */ +struct ifconf { + __LONG ifc_len; /* size of associated buffer */ + union { + __APTR ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; +#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ +#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ +}; + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifndef _NET_IF_ARP_H +#include +#endif /* _NET_IF_ARP_H */ + +/****************************************************************************/ + +#endif /* _NET_IF_H */ diff --git a/netinclude/net/if_arp.h b/netinclude/net/if_arp.h new file mode 100755 index 0000000..fcf7e05 --- /dev/null +++ b/netinclude/net/if_arp.h @@ -0,0 +1,147 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_arp.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NET_IF_ARP_H +#define _NET_IF_ARP_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _SYS_SOCKET_H +#include +#endif /* _SYS_SOCKET_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Address Resolution Protocol. + * + * See RFC 826 for protocol description. ARP packets are variable + * in size; the arphdr structure defines the fixed-length portion. + * Protocol type values are the same as those for 10 Mb/s Ethernet. + * It is followed by the variable-sized fields ar_sha, arp_spa, + * arp_tha and arp_tpa in that order, according to the lengths + * specified. Field names used correspond to RFC 826. + */ +struct arphdr { + __UWORD ar_hrd; /* format of hardware address */ +#define ARPHRD_ETHER 1 /* ethernet hardware format */ +#define ARPHRD_FRELAY 15 /* frame relay hardware format */ + __UWORD ar_pro; /* format of protocol address */ + __UBYTE ar_hln; /* length of hardware address */ + __UBYTE ar_pln; /* length of protocol address */ + __UWORD ar_op; /* one of: */ +#define ARPOP_REQUEST 1 /* request to resolve address */ +#define ARPOP_REPLY 2 /* response to previous request */ +#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */ +#define ARPOP_REVREPLY 4 /* response giving protocol address */ +#define ARPOP_INVREQUEST 8 /* request to identify peer */ +#define ARPOP_INVREPLY 9 /* response identifying peer */ +/* + * The remaining fields are variable in size, + * according to the sizes above. + */ +#ifdef COMMENT_ONLY + __UBYTE ar_sha[]; /* sender hardware address */ + __UBYTE ar_spa[]; /* sender protocol address */ + __UBYTE ar_tha[]; /* target hardware address */ + __UBYTE ar_tpa[]; /* target protocol address */ +#endif +}; + +/* + * ARP ioctl request + */ +struct arpreq { + struct sockaddr arp_pa; /* protocol address */ + struct sockaddr arp_ha; /* hardware address */ + __LONG arp_flags; /* flags */ +}; +/* arp_flags and at_flags field values */ +#define ATF_INUSE 0x01 /* entry in use */ +#define ATF_COM 0x02 /* completed entry (enaddr valid) */ +#define ATF_PERM 0x04 /* permanent entry */ +#define ATF_PUBL 0x08 /* publish entry (respond for other host) */ +#define ATF_USETRAILERS 0x10 /* has requested trailers */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NET_IF_ARP_H */ diff --git a/netinclude/net/if_dl.h b/netinclude/net/if_dl.h new file mode 100755 index 0000000..f3581c9 --- /dev/null +++ b/netinclude/net/if_dl.h @@ -0,0 +1,127 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_dl.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NET_IF_DL_H +#define _NET_IF_DL_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * A Link-Level Sockaddr may specify the interface in one of two + * ways: either by means of a system-provided index number (computed + * anew and possibly differently on every reboot), or by a human-readable + * string such as "il0" (for managerial convenience). + * + * Census taking actions, such as something akin to SIOCGCONF would return + * both the index and the human name. + * + * High volume transactions (such as giving a link-level ``from'' address + * in a recvfrom or recvmsg call) may be likely only to provide the indexed + * form, (which requires fewer copy operations and less space). + * + * The form and interpretation of the link-level address is purely a matter + * of convention between the device driver and its consumers; however, it is + * expected that all drivers for an interface of a given if_type will agree. + */ + +/* + * Structure of a Link-Level sockaddr: + */ +struct sockaddr_dl { + __UBYTE sdl_len; /* Total length of sockaddr */ + __UBYTE sdl_family; /* AF_DLI */ + __UWORD sdl_index; /* if != 0, system given index for interface */ + __UBYTE sdl_type; /* interface type */ + __UBYTE sdl_nlen; /* interface name length, no trailing 0 reqd. */ + __UBYTE sdl_alen; /* link level address length */ + __UBYTE sdl_slen; /* link layer selector length */ + __BYTE sdl_data[12]; /* minimum work area, can be larger; + contains both if name and ll address */ +}; + +#define LLADDR(s) ((__APTR)((s)->sdl_data + (s)->sdl_nlen)) + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NET_IF_DL_H */ diff --git a/netinclude/net/if_types.h b/netinclude/net/if_types.h new file mode 100755 index 0000000..cb6b4a6 --- /dev/null +++ b/netinclude/net/if_types.h @@ -0,0 +1,115 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1989, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_types.h 8.3 (Berkeley) 4/28/95 + */ + +#ifndef _NET_IF_TYPES_H +#define _NET_IF_TYPES_H + +/****************************************************************************/ + +/* + * Interface types for benefit of parsing media address headers. + * This list is derived from the SNMP list of ifTypes, currently + * documented in RFC1573. + */ + +#define IFT_OTHER 0x1 /* none of the following */ +#define IFT_1822 0x2 /* old-style arpanet imp */ +#define IFT_HDH1822 0x3 /* HDH arpanet imp */ +#define IFT_X25DDN 0x4 /* x25 to imp */ +#define IFT_X25 0x5 /* PDN X25 interface (RFC877) */ +#define IFT_ETHER 0x6 /* Ethernet CSMACD */ +#define IFT_ISO88023 0x7 /* CMSA CD */ +#define IFT_ISO88024 0x8 /* Token Bus */ +#define IFT_ISO88025 0x9 /* Token Ring */ +#define IFT_ISO88026 0xa /* MAN */ +#define IFT_STARLAN 0xb +#define IFT_P10 0xc /* Proteon 10MBit ring */ +#define IFT_P80 0xd /* Proteon 80MBit ring */ +#define IFT_HY 0xe /* Hyperchannel */ +#define IFT_FDDI 0xf +#define IFT_LAPB 0x10 +#define IFT_SDLC 0x11 +#define IFT_T1 0x12 +#define IFT_CEPT 0x13 /* E1 - european T1 */ +#define IFT_ISDNBASIC 0x14 +#define IFT_ISDNPRIMARY 0x15 +#define IFT_PTPSERIAL 0x16 /* Proprietary PTP serial */ +#define IFT_PPP 0x17 /* RFC 1331 */ +#define IFT_LOOP 0x18 /* loopback */ +#define IFT_EON 0x19 /* ISO over IP */ +#define IFT_XETHER 0x1a /* obsolete 3MB experimental ethernet */ +#define IFT_NSIP 0x1b /* XNS over IP */ +#define IFT_SLIP 0x1c /* IP over generic TTY */ +#define IFT_ULTRA 0x1d /* Ultra Technologies */ +#define IFT_DS3 0x1e /* Generic T3 */ +#define IFT_SIP 0x1f /* SMDS */ +#define IFT_FRELAY 0x20 /* Frame Relay DTE only */ +#define IFT_RS232 0x21 +#define IFT_PARA 0x22 /* parallel-port */ +#define IFT_ARCNET 0x23 +#define IFT_ARCNETPLUS 0x24 +#define IFT_ATM 0x25 /* ATM cells */ +#define IFT_MIOX25 0x26 +#define IFT_SONET 0x27 /* SONET or SDH */ +#define IFT_X25PLE 0x28 +#define IFT_ISO88022LLC 0x29 +#define IFT_LOCALTALK 0x2a +#define IFT_SMDSDXI 0x2b +#define IFT_FRELAYDCE 0x2c /* Frame Relay DCE */ +#define IFT_V35 0x2d +#define IFT_HSSI 0x2e +#define IFT_HIPPI 0x2f +#define IFT_MODEM 0x30 /* Generic Modem */ +#define IFT_AAL5 0x31 /* AAL5 over ATM */ +#define IFT_SONETPATH 0x32 +#define IFT_SONETVT 0x33 +#define IFT_SMDSICIP 0x34 /* SMDS InterCarrier Interface */ +#define IFT_PROPVIRTUAL 0x35 /* Proprietary Virtual/internal */ +#define IFT_PROPMUX 0x36 /* Proprietary Multiplexing */ + +/****************************************************************************/ + +#endif /* _NET_IF_TYPES_H */ diff --git a/netinclude/net/radix.h b/netinclude/net/radix.h new file mode 100755 index 0000000..ac36444 --- /dev/null +++ b/netinclude/net/radix.h @@ -0,0 +1,160 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1988, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)radix.h 8.2 (Berkeley) 10/31/94 + */ + +#ifndef _NET_RADIX_H +#define _NET_RADIX_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Radix search tree node layout. + */ + +struct radix_node { + struct radix_mask *rn_mklist; /* list of masks contained in subtree */ + struct radix_node *rn_p; /* parent */ + __WORD rn_b; /* bit offset; -1-index(netmask) */ + __UBYTE rn_bmask; /* node: mask for bit test*/ + __UBYTE rn_flags; /* enumerated next */ +#define RNF_NORMAL 1 /* leaf contains normal route */ +#define RNF_ROOT 2 /* leaf is root leaf for tree */ +#define RNF_ACTIVE 4 /* This node is alive (for rtfree) */ + union { + struct { /* leaf only data: */ + __APTR rn_Key; /* object of search */ + __APTR rn_Mask; /* netmask, if present */ + struct radix_node *rn_Dupedkey; + } rn_leaf; + struct { /* node only data: */ + __LONG rn_Off; /* where to start compare */ + struct radix_node *rn_L;/* progeny */ + struct radix_node *rn_R;/* progeny */ + } rn_node; + } rn_u; +}; + +#define rn_dupedkey rn_u.rn_leaf.rn_Dupedkey +#define rn_key rn_u.rn_leaf.rn_Key +#define rn_mask rn_u.rn_leaf.rn_Mask +#define rn_off rn_u.rn_node.rn_Off +#define rn_l rn_u.rn_node.rn_L +#define rn_r rn_u.rn_node.rn_R + +/* + * Annotations to tree concerning potential routes applying to subtrees. + */ + +struct radix_mask { + __WORD rm_b; /* bit offset; -1-index(netmask) */ + __UBYTE rm_unused; /* cf. rn_bmask */ + __UBYTE rm_flags; /* cf. rn_flags */ + struct radix_mask *rm_mklist; /* more masks to try */ + union { + __APTR rmu_mask; /* the mask */ + struct radix_node *rmu_leaf; /* for normal routes */ + } rm_rmu; + __LONG rm_refs; /* # of references to this struct */ +}; + +#define rm_mask rm_rmu.rmu_mask +#define rm_leaf rm_rmu.rmu_leaf /* extra field would make 32 bytes */ + +struct radix_node_head { + struct radix_node *rnh_treetop; + __LONG rnh_addrsize; /* permit, but not require fixed keys */ + __LONG rnh_pktsize; /* permit, but not require fixed keys */ + __APTR rnh_addaddr; /* add based on sockaddr */ + __APTR rnh_addpkt; /* add based on packet hdr */ + __APTR rnh_deladdr; /* remove based on sockaddr */ + __APTR rnh_delpkt; /* remove based on packet hdr */ + __APTR rnh_matchaddr; /* locate based on sockaddr */ + __APTR rnh_lookup; /* locate based on sockaddr */ + __APTR rnh_matchpkt; /* locate based on packet hdr */ + __APTR rnh_walktree; /* traverse tree */ + struct radix_node rnh_nodes[3]; /* empty tree for common case */ +}; + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NET_RADIX_H */ diff --git a/netinclude/net/route.h b/netinclude/net/route.h new file mode 100755 index 0000000..303dfa4 --- /dev/null +++ b/netinclude/net/route.h @@ -0,0 +1,297 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1980, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)route.h 8.5 (Berkeley) 2/8/95 + */ + +#ifndef _NET_ROUTE_H +#define _NET_ROUTE_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _SYS_SOCKET_H +#include +#endif /* _SYS_SOCKET_H */ + +#ifndef _NETINET_TCP_TIMER_H +#include +#endif /* _NETINET_TCP_TIMER_H */ + +#ifndef _NET_IF_H +#include +#endif /* _NET_IF_H */ + +#ifndef _NET_RADIX_H +#include +#endif /* _NET_RADIX_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Kernel resident routing tables. + * + * The routing tables are initialized when interface addresses + * are set by making entries for all directly connected interfaces. + */ + +/* + * A route consists of a destination address and a reference + * to a routing entry. These are often held by protocols + * in their control blocks, e.g. inpcb. + */ +struct route { + struct rtentry *ro_rt; + struct sockaddr ro_dst; +}; + +/* + * These numbers are used by reliable protocols for determining + * retransmission behavior and are included in the routing structure. + */ +struct rt_metrics { + __ULONG rmx_locks; /* Kernel must leave these values alone */ + __ULONG rmx_mtu; /* MTU for this path */ + __ULONG rmx_hopcount; /* max hops expected */ + __ULONG rmx_expire; /* lifetime for route, e.g. redirect */ + __ULONG rmx_recvpipe; /* inbound delay-bandwith product */ + __ULONG rmx_sendpipe; /* outbound delay-bandwith product */ + __ULONG rmx_ssthresh; /* outbound gateway buffer limit */ + __ULONG rmx_rtt; /* estimated round trip time */ + __ULONG rmx_rttvar; /* estimated rtt variance */ + __ULONG rmx_pksent; /* packets sent using this route */ +}; + +/* + * rmx_rtt and rmx_rttvar are stored as microseconds; + * RTTTOPRHZ(rtt) converts to a value suitable for use + * by a protocol slowtimo counter. + */ +#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */ +#define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ)) + +/* + * We distinguish between routes to hosts and routes to networks, + * preferring the former if available. For each route we infer + * the interface to use from the gateway address supplied when + * the route was entered. Routes that forward packets through + * gateways are marked so that the output routines know to address the + * gateway rather than the ultimate destination. + */ + +struct rtentry { + struct radix_node rt_nodes[2]; /* tree glue, and other values */ +#define rt_key(r) ((struct sockaddr *)((r)->rt_nodes->rn_key)) +#define rt_mask(r) ((struct sockaddr *)((r)->rt_nodes->rn_mask)) + struct sockaddr *rt_gateway; /* value */ + __WORD rt_flags; /* up/down?, host/net */ + __WORD rt_refcnt; /* # held references */ + __ULONG rt_use; /* raw # packets forwarded */ + struct ifnet *rt_ifp; /* the answer: interface to use */ + struct ifaddr *rt_ifa; /* the answer: interface to use */ + struct sockaddr *rt_genmask; /* for generation of cloned routes */ + __APTR rt_llinfo; /* pointer to link level info cache */ + struct rt_metrics rt_rmx; /* metrics used by rx'ing protocols */ + struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */ +}; + +/* + * Following structure necessary for 4.3 compatibility; + * We should eventually move it to a compat file. + */ +struct ortentry { + __ULONG rt_hash; /* to speed lookups */ + struct sockaddr rt_dst; /* key */ + struct sockaddr rt_gateway; /* value */ + __WORD rt_flags; /* up/down?, host/net */ + __WORD rt_refcnt; /* # held references */ + __ULONG rt_use; /* raw # packets forwarded */ + struct ifnet *rt_ifp; /* the answer: interface to use */ +}; + +#define RTF_UP 0x1 /* route usable */ +#define RTF_GATEWAY 0x2 /* destination is a gateway */ +#define RTF_HOST 0x4 /* host entry (net otherwise) */ +#define RTF_REJECT 0x8 /* host or net unreachable */ +#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */ +#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */ +#define RTF_DONE 0x40 /* message confirmed */ +#define RTF_MASK 0x80 /* subnet mask present */ +#define RTF_CLONING 0x100 /* generate new routes on use */ +#define RTF_XRESOLVE 0x200 /* external daemon resolves name */ +#define RTF_LLINFO 0x400 /* generated by ARP or ESIS */ +#define RTF_STATIC 0x800 /* manually added */ +#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ +#define RTF_PROTO2 0x4000 /* protocol specific routing flag */ +#define RTF_PROTO1 0x8000 /* protocol specific routing flag */ + + +/* + * Routing statistics. + */ +struct rtstat { + __WORD rts_badredirect; /* bogus redirect calls */ + __WORD rts_dynamic; /* routes created by redirects */ + __WORD rts_newgateway; /* routes modified by redirects */ + __WORD rts_unreach; /* lookups which failed */ + __WORD rts_wildcard; /* lookups satisfied by a wildcard */ +}; +/* + * Structures for routing messages. + */ +struct rt_msghdr { + __UWORD rtm_msglen; /* to skip over non-understood messages */ + __UBYTE rtm_version; /* future binary compatibility */ + __UBYTE rtm_type; /* message type */ + __UWORD rtm_index; /* index for associated ifp */ + __LONG rtm_flags; /* flags, incl. kern & message, e.g. DONE */ + __LONG rtm_addrs; /* bitmask identifying sockaddrs in msg */ + __LONG rtm_pid; /* identify sender */ + __LONG rtm_seq; /* for sender to identify action */ + __LONG rtm_errno; /* why failed */ + __LONG rtm_use; /* from rtentry */ + __ULONG rtm_inits; /* which metrics we are initializing */ + struct rt_metrics rtm_rmx; /* metrics themselves */ +}; + +#define RTM_VERSION 3 /* Up the ante and ignore older versions */ + +#define RTM_ADD 0x1 /* Add Route */ +#define RTM_DELETE 0x2 /* Delete Route */ +#define RTM_CHANGE 0x3 /* Change Metrics or flags */ +#define RTM_GET 0x4 /* Report Metrics */ +#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */ +#define RTM_REDIRECT 0x6 /* Told to use different route */ +#define RTM_MISS 0x7 /* Lookup failed on this address */ +#define RTM_LOCK 0x8 /* fix specified metrics */ +#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */ +#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */ +#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */ +#define RTM_NEWADDR 0xc /* address being added to iface */ +#define RTM_DELADDR 0xd /* address being removed from iface */ +#define RTM_IFINFO 0xe /* iface going up/down etc. */ + +#define RTV_MTU 0x1 /* init or lock _mtu */ +#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */ +#define RTV_EXPIRE 0x4 /* init or lock _hopcount */ +#define RTV_RPIPE 0x8 /* init or lock _recvpipe */ +#define RTV_SPIPE 0x10 /* init or lock _sendpipe */ +#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */ +#define RTV_RTT 0x40 /* init or lock _rtt */ +#define RTV_RTTVAR 0x80 /* init or lock _rttvar */ + +/* + * Bitmask values for rtm_addr. + */ +#define RTA_DST 0x1 /* destination sockaddr present */ +#define RTA_GATEWAY 0x2 /* gateway sockaddr present */ +#define RTA_NETMASK 0x4 /* netmask sockaddr present */ +#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */ +#define RTA_IFP 0x10 /* interface name sockaddr present */ +#define RTA_IFA 0x20 /* interface addr sockaddr present */ +#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ +#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */ + +/* + * Index offsets for sockaddr array for alternate internal encoding. + */ +#define RTAX_DST 0 /* destination sockaddr present */ +#define RTAX_GATEWAY 1 /* gateway sockaddr present */ +#define RTAX_NETMASK 2 /* netmask sockaddr present */ +#define RTAX_GENMASK 3 /* cloning mask sockaddr present */ +#define RTAX_IFP 4 /* interface name sockaddr present */ +#define RTAX_IFA 5 /* interface addr sockaddr present */ +#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */ +#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */ +#define RTAX_MAX 8 /* size of array to allocate */ + +struct rt_addrinfo { + __LONG rti_addrs; + struct sockaddr *rti_info[RTAX_MAX]; +}; + +struct route_cb { + __LONG ip_count; + __LONG ns_count; + __LONG iso_count; + __LONG any_count; +}; + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NET_ROUTE_H */ diff --git a/netinclude/netdb.h b/netinclude/netdb.h new file mode 100755 index 0000000..5968d9a --- /dev/null +++ b/netinclude/netdb.h @@ -0,0 +1,231 @@ +/* + * $Id$ + * + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * ++Copyright++ 1980, 1983, 1988, 1993 + * - + * Copyright (c) 1980, 1983, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +/* + * @(#)netdb.h 8.1 (Berkeley) 6/2/93 + * $NetBSD: netdb.h,v 1.8 1997/10/13 09:26:06 lukem Exp $ + */ + +#ifndef _NETDB_H +#define _NETDB_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _SYS_ERRNO_H +#include +#endif /* _SYS_ERRNO_H */ + +#ifndef _NETINET_IN_H +#include +#endif /* _NETINET_IN_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* This used to be in */ +#define MAXHOSTNAMELEN 256 /* max hostname size */ + +/* + * Structures returned by network data base library. All addresses are + * supplied in host order, and returned in network order (suitable for + * use in system calls). + */ +struct hostent +{ + __STRPTR h_name; /* official name of host */ + __STRPTR * h_aliases; /* alias list */ + __LONG h_addrtype; /* host address type */ + __LONG h_length; /* length of address */ + __BYTE ** h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; + +/* + * Assumption here is that a network number + * fits in an unsigned long -- probably a poor one. + */ +struct netent +{ + __STRPTR n_name; /* official name of net */ + __STRPTR * n_aliases; /* alias list */ + __LONG n_addrtype; /* net address type */ + in_addr_t n_net; /* network # */ +}; + +struct servent +{ + __STRPTR s_name; /* official service name */ + __STRPTR * s_aliases; /* alias list */ + __LONG s_port; /* port # */ + __STRPTR s_proto; /* protocol to use */ +}; + +struct protoent +{ + __STRPTR p_name; /* official protocol name */ + __STRPTR * p_aliases; /* alias list */ + __LONG p_proto; /* protocol # */ +}; + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (left in extern int h_errno). + */ + +#define NETDB_INTERNAL -1 /* see errno */ +#define NETDB_SUCCESS 0 /* no problem */ +#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + +/****************************************************************************/ + +/* Values for getaddrinfo() and getnameinfo() */ +#define AI_PASSIVE 1 /* socket address is intended for bind() */ +#define AI_CANONNAME 2 /* request for canonical name */ +#define AI_NUMERICHOST 4 /* don't ever try hostname lookup */ +#define AI_EXT 8 /* enable non-portable extensions */ +#define AI_NUMERICSERV 16 /* don't ever try servname lookup */ +/* valid flags for addrinfo */ +#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV) + +#define NI_NUMERICHOST 1 /* return the host address, not the name */ +#define NI_NUMERICSERV 2 /* return the service address, not the name */ +#define NI_NOFQDN 4 /* return a short name if in the local domain */ +#define NI_NAMEREQD 8 /* fail if either host or service name is unknown */ +#define NI_DGRAM 16 /* look up datagram service instead of stream */ +#define NI_WITHSCOPEID 32 /* KAME hack: attach scopeid to host portion */ + +#define NI_MAXHOST MAXHOSTNAMELEN /* max host name returned by getnameinfo */ +#define NI_MAXSERV 32 /* max serv. name length returned by getnameinfo */ + +#define EAI_BADFLAGS -1 /* invalid value for ai_flags */ +#define EAI_NONAME -2 /* name or service is not known */ +#define EAI_AGAIN -3 /* temporary failure in name resolution */ +#define EAI_FAIL -4 /* non-recoverable failure in name resolution */ +#define EAI_NODATA -5 /* no address associated with name */ +#define EAI_FAMILY -6 /* ai_family not supported */ +#define EAI_SOCKTYPE -7 /* ai_socktype not supported */ +#define EAI_SERVICE -8 /* service not supported for ai_socktype */ +#define EAI_ADDRFAMILY -9 /* address family for name not supported */ +#define EAI_MEMORY -10 /* memory allocation failure */ +#define EAI_SYSTEM -11 /* system error (code indicated in errno) */ +#define EAI_BADHINTS -12 /* invalid value for hints */ +#define EAI_PROTOCOL -13 /* resolved protocol is unknown */ + +struct addrinfo { + int ai_flags; /* input flags */ + int ai_family; /* protocol family for socket */ + int ai_socktype; /* socket type */ + int ai_protocol; /* protocol for socket */ + socklen_t ai_addrlen; /* length of socket-address */ + struct sockaddr *ai_addr; /* socket-address for socket */ + char *ai_canonname; /* canonical name for service location (iff req) */ + struct addrinfo *ai_next; /* pointer to next in list */ +}; + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* !_NETDB_H */ diff --git a/netinclude/netinet/icmp_var.h b/netinclude/netinet/icmp_var.h new file mode 100755 index 0000000..48468e4 --- /dev/null +++ b/netinclude/netinet/icmp_var.h @@ -0,0 +1,125 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)icmp_var.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_ICMP_VAR_H +#define _NETINET_ICMP_VAR_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _NETINET_IN_H +#include +#endif /* _NETINET_IN_H */ + +#ifndef _NETINET_IP_ICMP_H +#include +#endif /* _NETINET_IP_ICMP_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Variables related to this implementation + * of the internet control message protocol. + */ +struct icmpstat { +/* statistics related to icmp packets generated */ + __ULONG icps_error; /* # of calls to icmp_error */ + __ULONG icps_oldshort; /* no error 'cuz old ip too short */ + __ULONG icps_oldicmp; /* no error 'cuz old was icmp */ + __ULONG icps_outhist[ICMP_MAXTYPE + 1]; +/* statistics related to input messages processed */ + __ULONG icps_badcode; /* icmp_code out of range */ + __ULONG icps_tooshort; /* packet < ICMP_MINLEN */ + __ULONG icps_checksum; /* bad checksum */ + __ULONG icps_badlen; /* calculated bound mismatch */ + __ULONG icps_reflect; /* number of responses */ + __ULONG icps_inhist[ICMP_MAXTYPE + 1]; +}; + +/* + * Names for ICMP sysctl objects + */ +#define ICMPCTL_MASKREPL 1 /* allow replies to netmask requests */ +#define ICMPCTL_MAXID 2 + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_ICMP_VAR_H */ diff --git a/netinclude/netinet/if_ether.h b/netinclude/netinet/if_ether.h new file mode 100755 index 0000000..d41b4de --- /dev/null +++ b/netinclude/netinet/if_ether.h @@ -0,0 +1,164 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_ether.h 8.3 (Berkeley) 5/2/95 + */ + +#ifndef _NETINET_IF_ETHER_H +#define _NETINET_IF_ETHER_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _NET_IF_ARP_H +#include +#endif /* _NET_IF_ARP_H */ + +#ifndef _NETINET_IN_H +#include +#endif /* _NETINET_IN_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Structure of a 10Mb/s Ethernet header. + */ +struct ether_header { + __UBYTE ether_dhost[6]; + __UBYTE ether_shost[6]; + __UWORD ether_type; +}; + +#define ETHERTYPE_PUP 0x0200 /* PUP protocol */ +#define ETHERTYPE_IP 0x0800 /* IP protocol */ +#define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ +#define ETHERTYPE_REVARP 0x8035 /* reverse Addr. resolution protocol */ + +/* + * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have + * (type-ETHERTYPE_TRAIL)*512 bytes of data followed + * by an ETHER type (as given above) and then the (variable-length) header. + */ +#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ +#define ETHERTYPE_NTRAILER 16 + +#define ETHERMTU 1500 +#define ETHERMIN (60-14) + +/* + * Ethernet Address Resolution Protocol. + * + * See RFC 826 for protocol description. Structure below is adapted + * to resolving internet addresses. Field names used correspond to + * RFC 826. + */ +struct ether_arp { + struct arphdr ea_hdr; /* fixed-size header */ + __UBYTE arp_sha[6]; /* sender hardware address */ + __UBYTE arp_spa[4]; /* sender protocol address */ + __UBYTE arp_tha[6]; /* target hardware address */ + __UBYTE arp_tpa[4]; /* target protocol address */ +}; + +#define arp_hrd ea_hdr.ar_hrd +#define arp_pro ea_hdr.ar_pro +#define arp_hln ea_hdr.ar_hln +#define arp_pln ea_hdr.ar_pln +#define arp_op ea_hdr.ar_op + +struct sockaddr_inarp { + __UBYTE sin_len; + __UBYTE sin_family; + __UWORD sin_port; + struct in_addr sin_addr; + struct in_addr sin_srcaddr; + __UWORD sin_tos; + __UWORD sin_other; +}; + +#define SIN_PROXY 1 + +/* + * IP and ethernet specific routing flags + */ +#define RTF_USETRAILERS RTF_PROTO1 /* use trailers */ +#define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_IF_ETHER_H */ diff --git a/netinclude/netinet/igmp.h b/netinclude/netinet/igmp.h new file mode 100755 index 0000000..df4aacf --- /dev/null +++ b/netinclude/netinet/igmp.h @@ -0,0 +1,121 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1988 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)igmp.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_IGMP_H +#define _NETINET_IGMP_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _NETINET_IP_H +#include +#endif /* _NETINET_IP_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* Internet Group Management Protocol (IGMP) definitions. */ + +/* + * IGMP packet format. + */ +struct igmp { + __UBYTE igmp_type; /* version & type of IGMP message */ + __UBYTE igmp_code; /* unused, should be zero */ + __UWORD igmp_cksum; /* IP-style checksum */ + struct in_addr igmp_group; /* group address being reported */ +}; /* (zero for queries) */ + +#define IGMP_MINLEN 8 + +#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* message types, incl. version */ +#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 +#define IGMP_DVMRP 0x13 /* for experimental multicast */ + /* routing protocol */ + +#define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_IGMP_H */ diff --git a/netinclude/netinet/igmp_var.h b/netinclude/netinet/igmp_var.h new file mode 100755 index 0000000..dc3d220 --- /dev/null +++ b/netinclude/netinet/igmp_var.h @@ -0,0 +1,117 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1988 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)igmp_var.h 8.1 (Berkeley) 7/19/93 + */ + +#ifndef _NETINET_IGMP_VAR_H +#define _NETINET_IGMP_VAR_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Internet Group Management Protocol (IGMP), + * implementation-specific definitions. + * + * Written by Steve Deering, Stanford, May 1988. + * + * MULTICAST 1.1 + */ + +struct igmpstat { + __ULONG igps_rcv_total; /* total IGMP messages received */ + __ULONG igps_rcv_tooshort; /* received with too few bytes */ + __ULONG igps_rcv_badsum; /* received with bad checksum */ + __ULONG igps_rcv_queries; /* received membership queries */ + __ULONG igps_rcv_badqueries; /* received invalid queries */ + __ULONG igps_rcv_reports; /* received membership reports */ + __ULONG igps_rcv_badreports; /* received invalid reports */ + __ULONG igps_rcv_ourreports; /* received reports for our groups */ + __ULONG igps_snd_reports; /* sent membership reports */ +}; + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_IGMP_VAR_H */ diff --git a/netinclude/netinet/in.h b/netinclude/netinet/in.h new file mode 100755 index 0000000..a17334f --- /dev/null +++ b/netinclude/netinet/in.h @@ -0,0 +1,275 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in.h 8.3 (Berkeley) 1/3/94 + */ + +#ifndef _NETINET_IN_H +#define _NETINET_IN_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _SYS_SOCKET_H +#include +#endif /* _SYS_SOCKET_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Constants and structures defined by the internet system, + * Per RFC 790, September 1981, and numerous additions. + */ + +/* + * Data types. + */ +typedef unsigned long in_addr_t; +typedef unsigned short in_port_t; + +/* + * Protocols + */ +#define IPPROTO_IP 0 /* dummy for IP */ +#define IPPROTO_ICMP 1 /* control message protocol */ +#define IPPROTO_IGMP 2 /* group mgmt protocol */ +#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ +#define IPPROTO_TCP 6 /* tcp */ +#define IPPROTO_EGP 8 /* exterior gateway protocol */ +#define IPPROTO_PUP 12 /* pup */ +#define IPPROTO_UDP 17 /* user datagram protocol */ +#define IPPROTO_IDP 22 /* xns idp */ +#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */ +#define IPPROTO_EON 80 /* ISO cnlp */ +#define IPPROTO_ENCAP 98 /* encapsulation header */ + +#define IPPROTO_RAW 255 /* raw IP packet */ +#define IPPROTO_MAX 256 + + +/* + * Local port number conventions: + * Ports < IPPORT_RESERVED are reserved for + * privileged processes (e.g. root). + * Ports > IPPORT_USERRESERVED are reserved + * for servers, not necessarily privileged. + */ +#define IPPORT_RESERVED 1024 +#define IPPORT_USERRESERVED 5000 + +/* + * Internet address (a structure for historical reasons) + */ +struct in_addr { + in_addr_t s_addr; +}; + +/* + * Definitions of bits in internet address integers. + * On subnets, the decomposition of addresses to host and net parts + * is done according to subnet mask, not the masks here. + */ +#define IN_CLASSA(i) (((__ULONG)(i) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(i) (((__ULONG)(i) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(i) (((__ULONG)(i) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff + +#define IN_CLASSD(i) (((__ULONG)(i) & 0xf0000000) == 0xe0000000) +#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ +#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ +#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ +#define IN_MULTICAST(i) IN_CLASSD(i) + +#define IN_EXPERIMENTAL(i) (((__ULONG)(i) & 0xf0000000) == 0xf0000000) +#define IN_BADCLASS(i) (((__ULONG)(i) & 0xf0000000) == 0xf0000000) + +#define INADDR_ANY 0x00000000UL +#define INADDR_BROADCAST 0xffffffffUL /* must be masked */ +#define INADDR_NONE 0xffffffff /* -1 return */ + +#define INADDR_UNSPEC_GROUP 0xe0000000UL /* 224.0.0.0 */ +#define INADDR_ALLHOSTS_GROUP 0xe0000001UL /* 224.0.0.1 */ +#define INADDR_MAX_LOCAL_GROUP 0xe00000ffUL /* 224.0.0.255 */ + +#define IN_LOOPBACKNET 127 /* official! */ + +/* + * Socket address, internet style. + */ +struct sockaddr_in { + __UBYTE sin_len; + sa_family_t sin_family; + in_port_t sin_port; + struct in_addr sin_addr; + __UBYTE sin_zero[8]; +}; + +/* + * Structure used to describe IP options. + * Used to store options internally, to pass them to a process, + * or to restore options retrieved earlier. + * The ip_dst is used for the first-hop gateway when using a source route + * (this gets put into the header proper). + */ +struct ip_opts { + struct in_addr ip_dst; /* first hop, 0 w/o src rt */ + __UBYTE ip_options[40]; /* actually variable in size */ +}; + +/* + * Options for use with [gs]etsockopt at the IP level. + * First word of comment is data type; bool is stored in int. + */ +#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */ +#define IP_HDRINCL 2 /* __LONG; header is included with data */ +#define IP_TOS 3 /* __LONG; IP type of service and preced. */ +#define IP_TTL 4 /* __LONG; IP time to live */ +#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */ +#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */ +#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */ +#define IP_RETOPTS 8 /* ip_opts; set/get IP options */ +#define IP_MULTICAST_IF 9 /* __UBYTE; set/get IP multicast i/f */ +#define IP_MULTICAST_TTL 10 /* __UBYTE; set/get IP multicast ttl */ +#define IP_MULTICAST_LOOP 11 /* __UBYTE; set/get IP multicast loopback */ +#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */ +#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */ + +/* + * Defaults and limits for options + */ +#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ +#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ +#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf */ + +/* + * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. + */ +struct ip_mreq { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ +}; + +/* + * Definitions for inet sysctl operations. + * + * Third level is protocol number. + * Fourth level is desired variable within that protocol. + */ +#define IPPROTO_MAXID (IPPROTO_IDP + 1) /* don't list to IPPROTO_MAX */ + +/* + * Names for IP sysctl objects + */ +#define IPCTL_FORWARDING 1 /* act as router */ +#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */ +#define IPCTL_DEFTTL 3 /* default TTL */ +#ifdef notyet +#define IPCTL_DEFMTU 4 /* default MTU */ +#endif +#define IPCTL_MAXID 5 + +/****************************************************************************/ + +/* + * Macros for network/external number representation conversion. + */ +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + +#define NTOHL(x) (x) +#define NTOHS(x) (x) +#define HTONL(x) (x) +#define HTONS(x) (x) + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_IN_H */ diff --git a/netinclude/netinet/in_systm.h b/netinclude/netinet/in_systm.h new file mode 100755 index 0000000..909e11d --- /dev/null +++ b/netinclude/netinet/in_systm.h @@ -0,0 +1,49 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_systm.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _IN_SYSTM_H +#define _IN_SYSTM_H +#endif /* _IN_SYSTM_H */ diff --git a/netinclude/netinet/in_var.h b/netinclude/netinet/in_var.h new file mode 100755 index 0000000..d4ddb31 --- /dev/null +++ b/netinclude/netinet/in_var.h @@ -0,0 +1,156 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1985, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_var.h 8.2 (Berkeley) 1/9/95 + */ + +#ifndef _NETINET_IN_VAR_H +#define _NETINET_IN_VAR_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _NETINET_IN_H +#include +#endif /* _NETINET_IN_H */ + +#ifndef _NET_IF_H +#include +#endif /* _NET_IF_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Interface address, Internet version. One of these structures + * is allocated for each interface with an Internet address. + * The ifaddr structure contains the protocol-independent part + * of the structure and is assumed to be first. + */ +struct in_ifaddr { + struct ifaddr ia_ifa; /* protocol-independent info */ +#define ia_ifp ia_ifa.ifa_ifp +#define ia_flags ia_ifa.ifa_flags + /* ia_{,sub}net{,mask} in host order */ + __ULONG ia_net; /* network number of interface */ + __ULONG ia_netmask; /* mask of net part */ + __ULONG ia_subnet; /* subnet number, including net */ + __ULONG ia_subnetmask; /* mask of subnet part */ + struct in_addr ia_netbroadcast; /* to recognize net broadcasts */ + struct in_ifaddr *ia_next; /* next in list of internet addresses */ + struct sockaddr_in ia_addr; /* reserve space for interface name */ + struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */ +#define ia_broadaddr ia_dstaddr + struct sockaddr_in ia_sockmask; /* reserve space for general netmask */ + struct in_multi *ia_multiaddrs; /* list of multicast addresses */ +}; + +struct in_aliasreq { + __TEXT ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct sockaddr_in ifra_addr; + struct sockaddr_in ifra_broadaddr; +#define ifra_dstaddr ifra_broadaddr + struct sockaddr_in ifra_mask; +}; +/* + * Given a pointer to an in_ifaddr (ifaddr), + * return a pointer to the addr as a sockaddr_in. + */ +#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr)) + +#define IN_LNAOF(in, ifa) \ + ((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask)) + + +/* + * Internet multicast address structure. There is one of these for each IP + * multicast group to which this host belongs on a given network interface. + * They are kept in a linked list, rooted in the interface's in_ifaddr + * structure. + */ +struct in_multi { + struct in_addr inm_addr; /* IP multicast address */ + struct ifnet *inm_ifp; /* back pointer to ifnet */ + struct in_ifaddr *inm_ia; /* back pointer to in_ifaddr */ + __ULONG inm_refcount; /* no. membership claims by sockets */ + __ULONG inm_timer; /* IGMP membership report timer */ + struct in_multi *inm_next; /* ptr to next multicast address */ +}; + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_IN_VAR_H */ diff --git a/netinclude/netinet/ip.h b/netinclude/netinet/ip.h new file mode 100755 index 0000000..34bede7 --- /dev/null +++ b/netinclude/netinet/ip.h @@ -0,0 +1,220 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip.h 8.2 (Berkeley) 6/1/94 + */ + +#ifndef _NETINET_IP_H +#define _NETINET_IP_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _NETINET_IN_H +#include +#endif /* _NETINET_IN_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Definitions for internet protocol version 4. + * Per RFC 791, September 1981. + */ +#define IPVERSION 4 + +/* + * Structure of an internet header, naked of options. + * + * We declare ip_len and ip_off to be __WORD, rather than __UWORD + * pragmatically since otherwise unsigned comparisons can result + * against negative integers quite easily, and fail in subtle ways. + */ +struct ip { + unsigned int + ip_v:4, /* version */ + ip_hl:4; /* header length */ + __UBYTE ip_tos; /* type of service */ + __WORD ip_len; /* total length */ + __UWORD ip_id; /* identification */ + __WORD ip_off; /* fragment offset field */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ + __UBYTE ip_ttl; /* time to live */ + __UBYTE ip_p; /* protocol */ + __UWORD ip_sum; /* checksum */ + struct in_addr ip_src,ip_dst; /* source and dest address */ +}; + +#define IP_MAXPACKET 65535 /* maximum packet size */ + +/* + * Definitions for IP type of service (ip_tos) + */ +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 + +/* + * Definitions for IP precedence (also in ip_tos) (hopefully unused) + */ +#define IPTOS_PREC_NETCONTROL 0xe0 +#define IPTOS_PREC_INTERNETCONTROL 0xc0 +#define IPTOS_PREC_CRITIC_ECP 0xa0 +#define IPTOS_PREC_FLASHOVERRIDE 0x80 +#define IPTOS_PREC_FLASH 0x60 +#define IPTOS_PREC_IMMEDIATE 0x40 +#define IPTOS_PREC_PRIORITY 0x20 +#define IPTOS_PREC_ROUTINE 0x00 + +/* + * Definitions for options. + */ +#define IPOPT_COPIED(o) ((o)&0x80) +#define IPOPT_CLASS(o) ((o)&0x60) +#define IPOPT_NUMBER(o) ((o)&0x1f) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_DEBMEAS 0x40 +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_EOL 0 /* end of option list */ +#define IPOPT_NOP 1 /* no operation */ + +#define IPOPT_RR 7 /* record packet route */ +#define IPOPT_TS 68 /* timestamp */ +#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ +#define IPOPT_LSRR 131 /* loose source route */ +#define IPOPT_SATID 136 /* satnet id */ +#define IPOPT_SSRR 137 /* strict source route */ + +/* + * Offsets to fields in options other than EOL and NOP. + */ +#define IPOPT_OPTVAL 0 /* option ID */ +#define IPOPT_OLEN 1 /* option length */ +#define IPOPT_OFFSET 2 /* offset within option */ +#define IPOPT_MINOFF 4 /* min value of above */ + +/* + * Time stamp option structure. + */ +struct ip_timestamp { + __UBYTE ipt_code; /* IPOPT_TS */ + __UBYTE ipt_len; /* size of structure (variable) */ + __UBYTE ipt_ptr; /* index of current entry */ + unsigned int + ipt_oflw:4, /* overflow counter */ + ipt_flg:4; /* flags, see below */ + union ipt_timestamp { + __ULONG ipt_time[1]; + struct ipt_ta { + struct in_addr ipt_addr; + __ULONG ipt_time; + } ipt_ta[1]; + } ipt_timestamp; +}; + +/* flag bits for ipt_flg */ +#define IPOPT_TS_TSONLY 0 /* timestamps only */ +#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ +#define IPOPT_TS_PRESPEC 3 /* specified modules only */ + +/* bits for security (not byte swapped) */ +#define IPOPT_SECUR_UNCLASS 0x0000 +#define IPOPT_SECUR_CONFID 0xf135 +#define IPOPT_SECUR_EFTO 0x789a +#define IPOPT_SECUR_MMMM 0xbc4d +#define IPOPT_SECUR_RESTR 0xaf13 +#define IPOPT_SECUR_SECRET 0xd788 +#define IPOPT_SECUR_TOPSECRET 0x6bc5 + +/* + * Internet implementation parameters. + */ +#define MAXTTL 255 /* maximum time to live (seconds) */ +#define IPDEFTTL 64 /* default ttl, from RFC 1340 */ +#define IPFRAGTTL 60 /* time to live for frags, slowhz */ +#define IPTTLDEC 1 /* subtracted when forwarding */ + +#define IP_MSS 576 /* default maximum segment size */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_IP_H */ diff --git a/netinclude/netinet/ip_fil.h b/netinclude/netinet/ip_fil.h new file mode 100755 index 0000000..ddf3fca --- /dev/null +++ b/netinclude/netinet/ip_fil.h @@ -0,0 +1,457 @@ +/* + * Copyright (C) 1993-2001 by Darren Reed. + * + * The author accepts no responsibility for the use of this software and + * provides it on an ``as is'' basis without express or implied warranty. + * + * Redistribution and use, with or without modification, in source and binary + * forms, are permitted provided that this notice is preserved in its entirety + * and due credit is given to the original author and the contributors. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied, in part or in whole, and put under another distribution licence + * [including the GNU Public Licence.] + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NETINET_IP_FIL_H +#define _NETINET_IP_FIL_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _SYS_IOCCOM_H +#include +#endif /* _SYS_IOCCOM_H */ + +#ifndef _NET_IF_H +#include +#endif /* _NET_IF_H */ + +#ifndef _NETINET_IN_H +#include +#endif /* _NETINET_IN_H */ + +/****************************************************************************/ + +#include + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +#define SIOCADAFR _IOW('r', 60, struct frentry *) +#define SIOCRMAFR _IOW('r', 61, struct frentry *) +#define SIOCSETFF _IOW('r', 62, __ULONG) +#define SIOCGETFF _IOR('r', 63, __ULONG) +#define SIOCGETFS _IOWR('r', 64, struct friostat *) +#define SIOCIPFFL _IOWR('r', 65, __LONG) +#define SIOCIPFFB _IOR('r', 66, __LONG) +#define SIOCADIFR _IOW('r', 67, struct frentry *) +#define SIOCRMIFR _IOW('r', 68, struct frentry *) +#define SIOCSWAPA _IOR('r', 69, __ULONG) +#define SIOCINAFR _IOW('r', 70, struct frentry *) +#define SIOCINIFR _IOW('r', 71, struct frentry *) +#define SIOCFRENB _IOW('r', 72, __ULONG) +#define SIOCFRSYN _IOW('r', 73, __ULONG) +#define SIOCFRZST _IOWR('r', 74, struct friostat *) +#define SIOCZRLST _IOWR('r', 75, struct frentry *) +#define SIOCAUTHW _IOWR('r', 76, struct frauth_t *) +#define SIOCAUTHR _IOWR('r', 77, struct frauth_t *) +#define SIOCATHST _IOWR('r', 78, struct fr_authstat *) +#define SIOCSTLCK _IOWR('r', 79, __ULONG) +#define SIOCSTPUT _IOWR('r', 80, struct ipstate_save *) +#define SIOCSTGET _IOWR('r', 81, struct ipstate_save *) +#define SIOCSTGSZ _IOWR('r', 82, struct natget) +#define SIOCGFRST _IOWR('r', 83, struct ipfrstat *) + +#define SIOCADDFR SIOCADAFR +#define SIOCDELFR SIOCRMAFR +#define SIOCINSFR SIOCINAFR + +union i6addr { + __ULONG i6[4]; + struct in_addr in4; +}; + +typedef struct fr_ip { + unsigned int + fi_v:4; /* IP version */ + unsigned int + fi_fl:4; /* packet flags */ + unsigned int + fi_tos:8; /* IP packet TOS */ + unsigned int + fi_ttl:8; /* IP packet TTL */ + unsigned int + fi_p:8; /* IP packet protocol */ + union i6addr fi_src; /* source address from packet */ + union i6addr fi_dst; /* destination address from packet */ + __ULONG fi_optmsk; /* bitmask composed from IP options */ + __UWORD fi_secmsk; /* bitmask composed from IP security options */ + __UWORD fi_auth; /* authentication code from IP sec. options */ +} fr_ip_t; + +#define FI_OPTIONS (FF_OPTIONS >> 24) +#define FI_TCPUDP (FF_TCPUDP >> 24) /* TCP/UCP implied comparison*/ +#define FI_FRAG (FF_FRAG >> 24) +#define FI_SHORT (FF_SHORT >> 24) +#define FI_CMP (FI_OPTIONS|FI_TCPUDP|FI_SHORT) + +#define fi_saddr fi_src.in4.s_addr +#define fi_daddr fi_dst.in4.s_addr + +/* + * These are both used by the state and NAT code to indicate that one port or + * the other should be treated as a wildcard. + */ +#define FI_W_SPORT 0x00000100 +#define FI_W_DPORT 0x00000200 +#define FI_WILDP (FI_W_SPORT|FI_W_DPORT) +#define FI_W_SADDR 0x00000400 +#define FI_W_DADDR 0x00000800 +#define FI_WILDA (FI_W_SADDR|FI_W_DADDR) +#define FI_NEWFR 0x00001000 + +typedef struct fr_info { + __APTR fin_ifp; /* interface packet is `on' */ + struct fr_ip fin_fi; /* IP Packet summary */ + __UWORD fin_data[2]; /* TCP/UDP ports, ICMP code/type */ + __UBYTE fin_out; /* in or out ? 1 == out, 0 == in */ + __UBYTE fin_rev; /* state only: 1 = reverse */ + __UWORD fin_hlen; /* length of IP header in bytes */ + __UBYTE fin_tcpf; /* TCP header flags (SYN, ACK, etc) */ + /* From here on is packet specific */ + __UBYTE fin_icode; /* ICMP error to return */ + __UWORD fin_rule; /* rule # last matched */ + __ULONG fin_group; /* group number, -1 for none */ + struct frentry *fin_fr; /* last matching rule */ + __STRPTR fin_dp; /* start of data past IP header */ + __UWORD fin_dlen; /* length of data portion of packet */ + __UWORD fin_id; /* IP packet id field */ + __APTR fin_mp; /* pointer to pointer to mbuf */ + __UWORD fin_plen; + __UWORD fin_off; +} fr_info_t; + +#define fin_v fin_fi.fi_v +#define fin_saddr fin_fi.fi_saddr +#define fin_daddr fin_fi.fi_daddr +#define fin_fl fin_fi.fi_fl + +/* + * Size for compares on fr_info structures + */ +#define FI_CSIZE offsetof(fr_info_t, fin_icode) + +/* + * Size for copying cache fr_info structure + */ +#define FI_COPYSIZE offsetof(fr_info_t, fin_dp) + +typedef struct frdest { + __APTR fd_ifp; + struct in_addr fd_ip; + __TEXT fd_ifname[IFNAMSIZ]; +} frdest_t; + +typedef struct frpcmp { + __LONG frp_cmp; /* data for port comparisons */ + __UWORD frp_port; /* top port for <> and >< */ + __UWORD frp_top; /* top port for <> and >< */ +} frpcmp_t; + +typedef struct frtuc { + __UBYTE ftu_tcpfm; /* tcp flags mask */ + __UBYTE ftu_tcpf; /* tcp flags */ + frpcmp_t ftu_src; + frpcmp_t ftu_dst; +} frtuc_t; + +#define ftu_scmp ftu_src.frp_cmp +#define ftu_dcmp ftu_dst.frp_cmp +#define ftu_sport ftu_src.frp_port +#define ftu_dport ftu_dst.frp_port +#define ftu_stop ftu_src.frp_top +#define ftu_dtop ftu_dst.frp_top + +typedef struct frentry { + struct frentry *fr_next; + struct frentry *fr_grp; + __LONG fr_ref; /* reference count - for grouping */ + __APTR fr_ifa; + __APTR fr_oifa; + /* + * These are only incremented when a packet matches this rule and + * it is the last match + */ + __ULONG fr_hits; + __ULONG fr_bytes; + /* + * Fields after this may not change whilst in the kernel. + */ + struct fr_ip fr_ip; + struct fr_ip fr_mip; /* mask structure */ + + + __UWORD fr_icmpm; /* data for ICMP packets (mask) */ + __UWORD fr_icmp; + + frtuc_t fr_tuc; + __ULONG fr_group; /* group to which this rule belongs */ + __ULONG fr_grhead; /* group # which this rule starts */ + __ULONG fr_flags; /* per-rule flags && options (see below) */ + __ULONG fr_skip; /* # of rules to skip */ + __ULONG fr_loglevel; /* syslog log facility + priority */ + __APTR fr_func; /* call this function */ + __LONG fr_sap; + __UBYTE fr_icode; /* return ICMP code */ + __TEXT fr_ifname[IFNAMSIZ]; + __TEXT fr_oifname[IFNAMSIZ]; + struct frdest fr_tif; /* "to" interface */ + struct frdest fr_dif; /* duplicate packet interfaces */ + __ULONG fr_cksum; /* checksum on filter rules for performance */ +} frentry_t; + +#define fr_v fr_ip.fi_v +#define fr_proto fr_ip.fi_p +#define fr_ttl fr_ip.fi_ttl +#define fr_tos fr_ip.fi_tos +#define fr_tcpfm fr_tuc.ftu_tcpfm +#define fr_tcpf fr_tuc.ftu_tcpf +#define fr_scmp fr_tuc.ftu_scmp +#define fr_dcmp fr_tuc.ftu_dcmp +#define fr_dport fr_tuc.ftu_dport +#define fr_sport fr_tuc.ftu_sport +#define fr_stop fr_tuc.ftu_stop +#define fr_dtop fr_tuc.ftu_dtop +#define fr_dst fr_ip.fi_dst.in4 +#define fr_src fr_ip.fi_src.in4 +#define fr_dmsk fr_mip.fi_dst.in4 +#define fr_smsk fr_mip.fi_src.in4 + +#ifndef offsetof +#define offsetof(t,m) (__LONG)((&((t *)0L)->m)) +#endif + +#define FR_CMPSIZ (sizeof(struct frentry) - offsetof(frentry_t, fr_ip)) + +/* + * fr_flags + */ +#define FR_BLOCK 0x00001 /* do not allow packet to pass */ +#define FR_PASS 0x00002 /* allow packet to pass */ +#define FR_OUTQUE 0x00004 /* outgoing packets */ +#define FR_INQUE 0x00008 /* ingoing packets */ +#define FR_LOG 0x00010 /* Log */ +#define FR_LOGB 0x00011 /* Log-fail */ +#define FR_LOGP 0x00012 /* Log-pass */ +#define FR_LOGBODY 0x00020 /* Log the body */ +#define FR_LOGFIRST 0x00040 /* Log the first byte if state held */ +#define FR_RETRST 0x00080 /* Return TCP RST packet - reset connection */ +#define FR_RETICMP 0x00100 /* Return ICMP unreachable packet */ +#define FR_FAKEICMP 0x00180 /* Return ICMP unreachable with fake source */ +#define FR_NOMATCH 0x00200 /* no match occured */ +#define FR_ACCOUNT 0x00400 /* count packet bytes */ +#define FR_KEEPFRAG 0x00800 /* keep fragment information */ +#define FR_KEEPSTATE 0x01000 /* keep `connection' state information */ +#define FR_INACTIVE 0x02000 +#define FR_QUICK 0x04000 /* match & stop processing list */ +#define FR_FASTROUTE 0x08000 /* bypass normal routing */ +#define FR_CALLNOW 0x10000 /* call another function (fr_func) if matches */ +#define FR_DUP 0x20000 /* duplicate packet */ +#define FR_LOGORBLOCK 0x40000 /* block the packet if it can't be logged */ +#define FR_NOTSRCIP 0x80000 /* not the src IP# */ +#define FR_NOTDSTIP 0x100000 /* not the dst IP# */ +#define FR_AUTH 0x200000 /* use authentication */ +#define FR_PREAUTH 0x400000 /* require preauthentication */ +#define FR_DONTCACHE 0x800000 /* don't cache the result */ + +#define FR_LOGMASK (FR_LOG|FR_LOGP|FR_LOGB) +#define FR_RETMASK (FR_RETICMP|FR_RETRST|FR_FAKEICMP) + +/* + * These correspond to #define's for FI_* and are stored in fr_flags + */ +#define FF_OPTIONS 0x01000000 +#define FF_TCPUDP 0x02000000 +#define FF_FRAG 0x04000000 +#define FF_SHORT 0x08000000 +/* + * recognized flags for SIOCGETFF and SIOCSETFF, and get put in fr_flags + */ +#define FF_LOGPASS 0x10000000 +#define FF_LOGBLOCK 0x20000000 +#define FF_LOGNOMATCH 0x40000000 +#define FF_LOGGING (FF_LOGPASS|FF_LOGBLOCK|FF_LOGNOMATCH) + +#define FR_NONE 0 +#define FR_EQUAL 1 +#define FR_NEQUAL 2 +#define FR_LESST 3 +#define FR_GREATERT 4 +#define FR_LESSTE 5 +#define FR_GREATERTE 6 +#define FR_OUTRANGE 7 +#define FR_INRANGE 8 + +typedef struct filterstats { + __ULONG fr_pass; /* packets allowed */ + __ULONG fr_block; /* packets denied */ + __ULONG fr_nom; /* packets which don't match any rule */ + __ULONG fr_short; /* packets which are short */ + __ULONG fr_ppkl; /* packets allowed and logged */ + __ULONG fr_bpkl; /* packets denied and logged */ + __ULONG fr_npkl; /* packets unmatched and logged */ + __ULONG fr_pkl; /* packets logged */ + __ULONG fr_skip; /* packets to be logged but buffer full */ + __ULONG fr_ret; /* packets for which a return is sent */ + __ULONG fr_acct; /* packets for which counting was performed */ + __ULONG fr_bnfr; /* bad attempts to allocate fragment state */ + __ULONG fr_nfr; /* new fragment state kept */ + __ULONG fr_cfr; /* add new fragment state but complete pkt */ + __ULONG fr_bads; /* bad attempts to allocate packet state */ + __ULONG fr_ads; /* new packet state kept */ + __ULONG fr_chit; /* cached hit */ + __ULONG fr_tcpbad; /* TCP checksum check failures */ + __ULONG fr_pull[2]; /* good and bad pullup attempts */ + __ULONG fr_badsrc; /* source received doesn't match route */ + __ULONG fr_badttl; /* TTL in packet doesn't reach minimum */ + __ULONG fr_ipv6[2]; /* IPv6 packets in/out */ +} filterstats_t; + +/* + * For SIOCGETFS + */ +typedef struct friostat { + struct filterstats f_st[2]; + struct frentry *f_fin[2]; + struct frentry *f_fout[2]; + struct frentry *f_acctin[2]; + struct frentry *f_acctout[2]; + struct frentry *f_fin6[2]; + struct frentry *f_fout6[2]; + struct frentry *f_acctin6[2]; + struct frentry *f_acctout6[2]; + struct frentry *f_auth; + struct frgroup *f_groups[3][2]; + __ULONG f_froute[2]; + __LONG f_defpass; /* default pass - from fr_pass */ + __BYTE f_active; /* 1 or 0 - active rule set */ + __BYTE f_running; /* 1 if running, else 0 */ + __BYTE f_logging; /* 1 if enabled, else 0 */ + __UBYTE f_version[32]; /* version string */ + __LONG f_locks[4]; +} friostat_t; + +typedef struct optlist { + __UWORD ol_val; + __LONG ol_bit; +} optlist_t; + + +/* + * Group list structure. + */ +typedef struct frgroup { + __ULONG fg_num; + struct frgroup *fg_next; + struct frentry *fg_head; + struct frentry **fg_start; +} frgroup_t; + + +/* + * Log structure. Each packet header logged is prepended by one of these. + * Following this in the log records read from the device will be an ipflog + * structure which is then followed by any packet data. + */ +typedef struct iplog { + __ULONG ipl_magic; + __ULONG ipl_count; + __ULONG ipl_sec; + __ULONG ipl_usec; + size_t ipl_dsize; + struct iplog *ipl_next; +} iplog_t; + +#define IPL_MAGIC 0x49504c4d /* 'IPLM' */ + +typedef struct ipflog { + __TEXT fl_ifname[IFNAMSIZ]; + __UBYTE fl_plen; /* extra data after hlen */ + __UBYTE fl_hlen; /* length of IP headers saved */ + __UWORD fl_loglevel; /* syslog log level */ + __ULONG fl_rule; + __ULONG fl_group; + __ULONG fl_flags; + __ULONG fl_lflags; +} ipflog_t; + +#ifndef ICMP_UNREACH_FILTER +# define ICMP_UNREACH_FILTER 13 +#endif + +#ifndef IPF_DEFAULT_PASS +# define IPF_DEFAULT_PASS FR_PASS +#endif + +#define IPMINLEN(i, h) ((i)->ip_len >= ((i)->ip_hl * 4 + sizeof(struct h))) +#define IPLLOGSIZE 8192 + +#define IPF_OPTCOPY 0x07ff00 /* bit mask of copied options */ + +#define IPL_LOGIPF 0 /* Minor device #'s for accessing logs */ +#define IPL_LOGNAT 1 +#define IPL_LOGSTATE 2 +#define IPL_LOGAUTH 3 +#define IPL_LOGMAX 3 + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_IP_FIL_H */ diff --git a/netinclude/netinet/ip_icmp.h b/netinclude/netinet/ip_icmp.h new file mode 100755 index 0000000..c24a088 --- /dev/null +++ b/netinclude/netinet/ip_icmp.h @@ -0,0 +1,214 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_IP_ICMP_H +#define _NETINET_IP_ICMP_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _NETINET_IP_H +#include +#endif /* _NETINET_IP_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Interface Control Message Protocol Definitions. + * Per RFC 792, September 1981. + */ + +/* + * Structure of an icmp header. + */ +struct icmp { + __UBYTE icmp_type; /* type of message, see below */ + __UBYTE icmp_code; /* type sub code */ + __UWORD icmp_cksum; /* ones complement cksum of struct */ + union { + __UBYTE ih_pptr; /* ICMP_PARAMPROB */ + struct in_addr ih_gwaddr; /* ICMP_REDIRECT */ + struct ih_idseq { + __UWORD icd_id; + __UWORD icd_seq; + } ih_idseq; + __LONG ih_void; + + /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ + struct ih_pmtu { + __UWORD ipm_void; + __UWORD ipm_nextmtu; + } ih_pmtu; + } icmp_hun; +#define icmp_pptr icmp_hun.ih_pptr +#define icmp_gwaddr icmp_hun.ih_gwaddr +#define icmp_id icmp_hun.ih_idseq.icd_id +#define icmp_seq icmp_hun.ih_idseq.icd_seq +#define icmp_void icmp_hun.ih_void +#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void +#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu + union { + struct id_ts { + __ULONG its_otime; + __ULONG its_rtime; + __ULONG its_ttime; + } id_ts; + struct id_ip { + struct ip idi_ip; + /* options and then 64 bits of data */ + } id_ip; + __ULONG id_mask; + __UBYTE id_data[1]; + } icmp_dun; +#define icmp_otime icmp_dun.id_ts.its_otime +#define icmp_rtime icmp_dun.id_ts.its_rtime +#define icmp_ttime icmp_dun.id_ts.its_ttime +#define icmp_ip icmp_dun.id_ip.idi_ip +#define icmp_mask icmp_dun.id_mask +#define icmp_data icmp_dun.id_data +}; + +/* + * Lower bounds on packet lengths for various types. + * For the error advice packets must first insure that the + * packet is large enought to contain the returned ip header. + * Only then can we do the check to see if 64 bits of packet + * data have been returned, since we need to check the returned + * ip header length. + */ +#define ICMP_MINLEN 8 /* abs minimum */ +#define ICMP_TSLEN (8 + 3 * sizeof (__ULONG)) /* timestamp */ +#define ICMP_MASKLEN 12 /* address mask */ +#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */ +#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) + /* N.B.: must separately check that ip_hl >= 5 */ + +/* + * Definition of type and code field values. + */ +#define ICMP_ECHOREPLY 0 /* echo reply */ +#define ICMP_UNREACH 3 /* dest unreachable, codes: */ +#define ICMP_UNREACH_NET 0 /* bad net */ +#define ICMP_UNREACH_HOST 1 /* bad host */ +#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ +#define ICMP_UNREACH_PORT 3 /* bad port */ +#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ +#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ +#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */ +#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */ +#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */ +#define ICMP_UNREACH_NET_PROHIB 9 /* prohibited access */ +#define ICMP_UNREACH_HOST_PROHIB 10 /* ditto */ +#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */ +#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */ +#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ +#define ICMP_REDIRECT 5 /* shorter route, codes: */ +#define ICMP_REDIRECT_NET 0 /* for network */ +#define ICMP_REDIRECT_HOST 1 /* for host */ +#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ +#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ +#define ICMP_ECHO 8 /* echo service */ +#define ICMP_ROUTERADVERT 9 /* router advertisement */ +#define ICMP_ROUTERSOLICIT 10 /* router solicitation */ +#define ICMP_TIMXCEED 11 /* time exceeded, code: */ +#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ +#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ +#define ICMP_PARAMPROB 12 /* ip header bad */ +#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */ +#define ICMP_TSTAMP 13 /* timestamp request */ +#define ICMP_TSTAMPREPLY 14 /* timestamp reply */ +#define ICMP_IREQ 15 /* information request */ +#define ICMP_IREQREPLY 16 /* information reply */ +#define ICMP_MASKREQ 17 /* address mask request */ +#define ICMP_MASKREPLY 18 /* address mask reply */ + +#define ICMP_MAXTYPE 18 + +#define ICMP_INFOTYPE(type) \ + ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \ + (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \ + (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \ + (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \ + (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_IP_ICMP_H */ diff --git a/netinclude/netinet/ip_mroute.h b/netinclude/netinet/ip_mroute.h new file mode 100755 index 0000000..a3d2316 --- /dev/null +++ b/netinclude/netinet/ip_mroute.h @@ -0,0 +1,190 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1989 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_mroute.h 8.2 (Berkeley) 4/28/95 + */ + +#ifndef _NETINET_IP_MROUTE_H +#define _NETINET_IP_MROUTE_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _NETINET_IN_H +#include +#endif /* _NETINET_IN_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Definitions for the kernel part of DVMRP, + * a Distance-Vector Multicast Routing Protocol. + * (See RFC-1075.) + * + * Written by David Waitzman, BBN Labs, August 1988. + * Modified by Steve Deering, Stanford, February 1989. + * + * MROUTING 1.0 + */ + + +/* + * DVMRP-specific setsockopt commands. + */ +#define DVMRP_INIT 100 +#define DVMRP_DONE 101 +#define DVMRP_ADD_VIF 102 +#define DVMRP_DEL_VIF 103 +#define DVMRP_ADD_LGRP 104 +#define DVMRP_DEL_LGRP 105 +#define DVMRP_ADD_MRT 106 +#define DVMRP_DEL_MRT 107 + + +/* + * Types and macros for handling bitmaps with one bit per virtual interface. + */ +#define MAXVIFS 32 +typedef __ULONG vifbitmap_t; +typedef __UWORD vifi_t; /* type of a vif index */ + +#define VIFM_SET(n, m) ((m) |= (1 << (n))) +#define VIFM_CLR(n, m) ((m) &= ~(1 << (n))) +#define VIFM_ISSET(n, m) ((m) & (1 << (n))) +#define VIFM_CLRALL(m) ((m) = 0x00000000) +#define VIFM_COPY(mfrom, mto) ((mto) = (mfrom)) +#define VIFM_SAME(m1, m2) ((m1) == (m2)) + + +/* + * Agument structure for DVMRP_ADD_VIF. + * (DVMRP_DEL_VIF takes a single vifi_t argument.) + */ +struct vifctl { + vifi_t vifc_vifi; /* the index of the vif to be added */ + __UBYTE vifc_flags; /* VIFF_ flags defined below */ + __UBYTE vifc_threshold; /* min ttl required to forward on vif */ + struct in_addr vifc_lcl_addr; /* local interface address */ + struct in_addr vifc_rmt_addr; /* remote address (tunnels only) */ +}; + +#define VIFF_TUNNEL 0x1 /* vif represents a tunnel end-point */ + + +/* + * Argument structure for DVMRP_ADD_LGRP and DVMRP_DEL_LGRP. + */ +struct lgrplctl { + vifi_t lgc_vifi; + struct in_addr lgc_gaddr; +}; + + +/* + * Argument structure for DVMRP_ADD_MRT. + * (DVMRP_DEL_MRT takes a single struct in_addr argument, containing origin.) + */ +struct mrtctl { + struct in_addr mrtc_origin; /* subnet origin of multicasts */ + struct in_addr mrtc_originmask; /* subnet mask for origin */ + vifi_t mrtc_parent; /* incoming vif */ + vifbitmap_t mrtc_children; /* outgoing children vifs */ + vifbitmap_t mrtc_leaves; /* subset of outgoing children vifs */ +}; + +/* + * The kernel's multicast routing statistics. + */ +struct mrtstat { + __ULONG mrts_mrt_lookups; /* # multicast route lookups */ + __ULONG mrts_mrt_misses; /* # multicast route cache misses */ + __ULONG mrts_grp_lookups; /* # group address lookups */ + __ULONG mrts_grp_misses; /* # group address cache misses */ + __ULONG mrts_no_route; /* no route for packet's origin */ + __ULONG mrts_bad_tunnel; /* malformed tunnel options */ + __ULONG mrts_cant_tunnel; /* no room for tunnel options */ + __ULONG mrts_wrong_if; /* arrived on the wrong interface */ +}; + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_IP_MROUTE_H */ diff --git a/netinclude/netinet/ip_nat.h b/netinclude/netinet/ip_nat.h new file mode 100755 index 0000000..a50dd08 --- /dev/null +++ b/netinclude/netinet/ip_nat.h @@ -0,0 +1,279 @@ +/* + * Copyright (C) 1993-2001 by Darren Reed. + * + * The author accepts no responsibility for the use of this software and + * provides it on an ``as is'' basis without express or implied warranty. + * + * Redistribution and use, with or without modification, in source and binary + * forms, are permitted provided that this notice is preserved in its entirety + * and due credit is given to the original author and the contributors. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied, in part or in whole, and put under another distribution licence + * [including the GNU Public Licence.] + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NETINET_IP_NAT_H +#define _NETINET_IP_NAT_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _NETINET_IP_FIL_H +#include +#endif /* _NETINET_IP_FIL_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +#define SIOCADNAT _IOW('r', 60, struct ipnat *) +#define SIOCRMNAT _IOW('r', 61, struct ipnat *) +#define SIOCGNATS _IOWR('r', 62, struct natstat *) +#define SIOCGNATL _IOWR('r', 63, struct natlookup *) + +#define APR_LABELLEN 16 + +struct ap_session; + +typedef struct nat { + __ULONG nat_age; + __LONG nat_flags; + __ULONG nat_sumd[2]; + __ULONG nat_ipsumd; + __APTR nat_data; + struct ap_session *nat_aps; /* proxy session */ + struct frentry *nat_fr; /* filter rule ptr if appropriate */ + struct in_addr nat_inip; + struct in_addr nat_outip; + struct in_addr nat_oip; /* other ip */ + __ULONG nat_pkts; + __ULONG nat_bytes; + __UWORD nat_oport; /* other port */ + __UWORD nat_inport; + __UWORD nat_outport; + __UWORD nat_use; + __UBYTE nat_tcpstate[2]; + __UBYTE nat_p; /* protocol for NAT */ + struct ipnat *nat_ptr; /* pointer back to the rule */ + struct hostmap *nat_hm; + struct nat *nat_next; + struct nat *nat_hnext[2]; + struct nat **nat_phnext[2]; + __APTR nat_ifp; + __LONG nat_dir; + __TEXT nat_ifname[IFNAMSIZ]; +} nat_t; + +typedef struct ipnat { + struct ipnat *in_next; + struct ipnat *in_rnext; + struct ipnat **in_prnext; + struct ipnat *in_mnext; + struct ipnat **in_pmnext; + __APTR in_ifp; + __APTR in_apr; + __ULONG in_space; + __ULONG in_use; + __ULONG in_hits; + struct in_addr in_nextip; + __UWORD in_pnext; + __UWORD in_ippip; /* IP #'s per IP# */ + __ULONG in_flags; /* From here to in_dport must be reflected */ + __UWORD in_spare; + __UWORD in_ppip; /* ports per IP */ + __UWORD in_port[2]; /* correctly in IPN_CMPSIZ */ + struct in_addr in_in[2]; + struct in_addr in_out[2]; + struct in_addr in_src[2]; + struct frtuc in_tuc; + __LONG in_redir; /* 0 if it's a mapping, 1 if it's a hard redir */ + __TEXT in_ifname[IFNAMSIZ]; + __TEXT in_plabel[APR_LABELLEN]; /* proxy label */ + __UBYTE in_p; /* protocol */ +} ipnat_t; + +#define in_pmin in_port[0] /* Also holds static redir port */ +#define in_pmax in_port[1] +#define in_nip in_nextip.s_addr +#define in_inip in_in[0].s_addr +#define in_inmsk in_in[1].s_addr +#define in_outip in_out[0].s_addr +#define in_outmsk in_out[1].s_addr +#define in_srcip in_src[0].s_addr +#define in_srcmsk in_src[1].s_addr +#define in_scmp in_tuc.ftu_scmp +#define in_dcmp in_tuc.ftu_dcmp +#define in_stop in_tuc.ftu_stop +#define in_dtop in_tuc.ftu_dtop +#define in_sport in_tuc.ftu_sport +#define in_dport in_tuc.ftu_dport + +#define NAT_OUTBOUND 0 +#define NAT_INBOUND 1 + +#define NAT_MAP 0x01 +#define NAT_REDIRECT 0x02 +#define NAT_BIMAP (NAT_MAP|NAT_REDIRECT) +#define NAT_MAPBLK 0x04 +/* 0x100 reserved for FI_W_SPORT */ +/* 0x200 reserved for FI_W_DPORT */ +/* 0x400 reserved for FI_W_SADDR */ +/* 0x800 reserved for FI_W_DADDR */ +/* 0x1000 reserved for FI_W_NEWFR */ + +#define MAPBLK_MINPORT 1024 /* don't use reserved ports for src port */ +#define USABLE_PORTS (65536 - MAPBLK_MINPORT) + +#define IPN_CMPSIZ (sizeof(ipnat_t) - offsetof(ipnat_t, in_flags)) + +typedef struct natlookup { + struct in_addr nl_inip; + struct in_addr nl_outip; + struct in_addr nl_realip; + __LONG nl_flags; + __UWORD nl_inport; + __UWORD nl_outport; + __UWORD nl_realport; +} natlookup_t; + + +typedef struct nat_save { + __APTR ipn_next; + struct nat ipn_nat; + struct ipnat ipn_ipnat; + struct frentry ipn_fr; + __LONG ipn_dsize; + __UBYTE ipn_data[4]; +} nat_save_t; + +#define ipn_rule ipn_nat.nat_fr + +typedef struct natget { + __APTR ng_ptr; + __LONG ng_sz; +} natget_t; + + +typedef struct hostmap { + struct hostmap *hm_next; + struct hostmap **hm_pnext; + struct ipnat *hm_ipnat; + struct in_addr hm_realip; + struct in_addr hm_mapip; + __LONG hm_ref; +} hostmap_t; + + +typedef struct natstat { + __ULONG ns_mapped[2]; + __ULONG ns_rules; + __ULONG ns_added; + __ULONG ns_expire; + __ULONG ns_inuse; + __ULONG ns_logged; + __ULONG ns_logfail; + __ULONG ns_memfail; + __ULONG ns_badnat; + nat_t **ns_table[2]; + hostmap_t **ns_maptable; + ipnat_t *ns_list; + __APTR ns_apslist; + __ULONG ns_nattab_sz; + __ULONG ns_rultab_sz; + __ULONG ns_rdrtab_sz; + __ULONG ns_hostmap_sz; + nat_t *ns_instances; + __ULONG ns_wilds; +} natstat_t; + +#define IPN_ANY 0x000 +#define IPN_TCP 0x001 +#define IPN_UDP 0x002 +#define IPN_TCPUDP (IPN_TCP|IPN_UDP) +#define IPN_DELETE 0x004 +#define IPN_ICMPERR 0x008 +#define IPN_RF (IPN_TCPUDP|IPN_DELETE|IPN_ICMPERR) +#define IPN_AUTOPORTMAP 0x010 +#define IPN_IPRANGE 0x020 +#define IPN_USERFLAGS (IPN_TCPUDP|IPN_AUTOPORTMAP|IPN_IPRANGE|IPN_SPLIT|\ + IPN_ROUNDR|IPN_FILTER|IPN_NOTSRC|IPN_NOTDST|IPN_FRAG) +#define IPN_FILTER 0x040 +#define IPN_SPLIT 0x080 +#define IPN_ROUNDR 0x100 +#define IPN_NOTSRC 0x080000 +#define IPN_NOTDST 0x100000 +#define IPN_FRAG 0x200000 + + +typedef struct natlog { + struct in_addr nl_origip; + struct in_addr nl_outip; + struct in_addr nl_inip; + __UWORD nl_origport; + __UWORD nl_outport; + __UWORD nl_inport; + __UWORD nl_type; + __LONG nl_rule; + __ULONG nl_pkts; + __ULONG nl_bytes; + __UBYTE nl_p; +} natlog_t; + + +#define NL_NEWMAP NAT_MAP +#define NL_NEWRDR NAT_REDIRECT +#define NL_NEWBIMAP NAT_BIMAP +#define NL_NEWBLOCK NAT_MAPBLK +#define NL_FLUSH 0xfffe +#define NL_EXPIRE 0xffff + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_IP_NAT_H */ diff --git a/netinclude/netinet/ip_var.h b/netinclude/netinet/ip_var.h new file mode 100755 index 0000000..7f65370 --- /dev/null +++ b/netinclude/netinet/ip_var.h @@ -0,0 +1,152 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_var.h 8.2 (Berkeley) 1/9/95 + */ + +#ifndef _NETINET_IP_VAR_H +#define _NETINET_IP_VAR_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _NETINET_IN_H +#include +#endif /* _NETINET_IN_H */ + +#ifndef _NETINET_IN_VAR_H +#include +#endif /* _NETINET_IN_VAR_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Overlay for ip header used by other protocols (tcp, udp). + */ +struct ipovly { + __APTR ih_next, ih_prev; /* for protocol sequence q's */ + __UBYTE ih_x1; /* (unused) */ + __UBYTE ih_pr; /* protocol */ + __WORD ih_len; /* protocol length */ + struct in_addr ih_src; /* source internet address */ + struct in_addr ih_dst; /* destination internet address */ +}; + +/* + * Structure stored in mbuf in inpcb.ip_options + * and passed to ip_output when ip options are in use. + * The actual length of the options (including ipopt_dst) + * is in m_len. + */ +#define MAX_IPOPTLEN 40 + +struct ipoption { + struct in_addr ipopt_dst; /* first-hop dst if source routed */ + __BYTE ipopt_list[MAX_IPOPTLEN]; /* options proper */ +}; + +struct ipstat { + __ULONG ips_total; /* total packets received */ + __ULONG ips_badsum; /* checksum bad */ + __ULONG ips_tooshort; /* packet too short */ + __ULONG ips_toosmall; /* not enough data */ + __ULONG ips_badhlen; /* ip header length < data size */ + __ULONG ips_badlen; /* ip length < ip header length */ + __ULONG ips_fragments; /* fragments received */ + __ULONG ips_fragdropped; /* frags dropped (dups, out of space) */ + __ULONG ips_fragtimeout; /* fragments timed out */ + __ULONG ips_forward; /* packets forwarded */ + __ULONG ips_cantforward; /* packets rcvd for unreachable dest */ + __ULONG ips_redirectsent; /* packets forwarded on same net */ + __ULONG ips_noproto; /* unknown or unsupported protocol */ + __ULONG ips_delivered; /* datagrams delivered to upper level*/ + __ULONG ips_localout; /* total ip packets generated here */ + __ULONG ips_odropped; /* lost packets due to nobufs, etc. */ + __ULONG ips_reassembled; /* total packets reassembled ok */ + __ULONG ips_fragmented; /* datagrams sucessfully fragmented */ + __ULONG ips_ofragments; /* output fragments created */ + __ULONG ips_cantfrag; /* don't fragment flag was set, etc. */ + __ULONG ips_badoptions; /* error in option processing */ + __ULONG ips_noroute; /* packets discarded due to no route */ + __ULONG ips_badvers; /* ip version != 4 */ + __ULONG ips_rawout; /* total raw ip packets generated */ +}; + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_IP_VAR_H */ diff --git a/netinclude/netinet/tcp.h b/netinclude/netinet/tcp.h new file mode 100755 index 0000000..f36c90c --- /dev/null +++ b/netinclude/netinet/tcp.h @@ -0,0 +1,152 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_TCP_H +#define _NETINET_TCP_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +typedef unsigned long tcp_seq; + +/* + * TCP header. + * Per RFC 793, September, 1981. + */ +struct tcphdr { + __UWORD th_sport; /* source port */ + __UWORD th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ + unsigned int + th_off:4, /* data offset */ + th_x2:4; /* (unused) */ + __UBYTE th_flags; +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 + __UWORD th_win; /* window */ + __UWORD th_sum; /* checksum */ + __UWORD th_urp; /* urgent pointer */ +}; + +#define TCPOPT_EOL 0 +#define TCPOPT_NOP 1 +#define TCPOPT_MAXSEG 2 +#define TCPOLEN_MAXSEG 4 +#define TCPOPT_WINDOW 3 +#define TCPOLEN_WINDOW 3 +#define TCPOPT_SACK_PERMITTED 4 /* Experimental */ +#define TCPOLEN_SACK_PERMITTED 2 +#define TCPOPT_SACK 5 /* Experimental */ +#define TCPOPT_TIMESTAMP 8 +#define TCPOLEN_TIMESTAMP 10 +#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */ + +#define TCPOPT_TSTAMP_HDR \ + (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP) + +/* + * Default maximum segment size for TCP. + * With an IP MSS of 576, this is 536, + * but 512 is probably more convenient. + * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)). + */ +#define TCP_MSS 512 + +#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */ + +#define TCP_MAX_WINSHIFT 14 /* maximum window shift */ + +/* + * User-settable options (used with setsockopt). + */ +#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ +#define TCP_MAXSEG 0x02 /* set maximum segment size */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_TCP_H */ diff --git a/netinclude/netinet/tcp_fsm.h b/netinclude/netinet/tcp_fsm.h new file mode 100755 index 0000000..525920a --- /dev/null +++ b/netinclude/netinet/tcp_fsm.h @@ -0,0 +1,76 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_fsm.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_TCP_FSM_H +#define _NETINET_TCP_FSM_H + +/****************************************************************************/ + +/* + * TCP FSM state definitions. + * Per RFC793, September, 1981. + */ + +#define TCP_NSTATES 11 + +#define TCPS_CLOSED 0 /* closed */ +#define TCPS_LISTEN 1 /* listening for connection */ +#define TCPS_SYN_SENT 2 /* active, have sent syn */ +#define TCPS_SYN_RECEIVED 3 /* have send and received syn */ +/* states < TCPS_ESTABLISHED are those where connections not established */ +#define TCPS_ESTABLISHED 4 /* established */ +#define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */ +/* states > TCPS_CLOSE_WAIT are those where user has closed */ +#define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */ +#define TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK */ +#define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */ +/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */ +#define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */ +#define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */ + +/****************************************************************************/ + +#endif /* _NETINET_TCP_FSM_H */ diff --git a/netinclude/netinet/tcp_timer.h b/netinclude/netinet/tcp_timer.h new file mode 100755 index 0000000..380c3d9 --- /dev/null +++ b/netinclude/netinet/tcp_timer.h @@ -0,0 +1,137 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_timer.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_TCP_TIMER_H +#define _NETINET_TCP_TIMER_H + +/****************************************************************************/ + +/* + * Definitions of the TCP timers. These timers are counted + * down PR_SLOWHZ times a second. + */ +#define TCPT_NTIMERS 4 + +#define TCPT_REXMT 0 /* retransmit */ +#define TCPT_PERSIST 1 /* retransmit persistance */ +#define TCPT_KEEP 2 /* keep alive */ +#define TCPT_2MSL 3 /* 2*msl quiet time timer */ + +/* + * The TCPT_REXMT timer is used to force retransmissions. + * The TCP has the TCPT_REXMT timer set whenever segments + * have been sent for which ACKs are expected but not yet + * received. If an ACK is received which advances tp->snd_una, + * then the retransmit timer is cleared (if there are no more + * outstanding segments) or reset to the base value (if there + * are more ACKs expected). Whenever the retransmit timer goes off, + * we retransmit one unacknowledged segment, and do a backoff + * on the retransmit timer. + * + * The TCPT_PERSIST timer is used to keep window size information + * flowing even if the window goes shut. If all previous transmissions + * have been acknowledged (so that there are no retransmissions in progress), + * and the window is too small to bother sending anything, then we start + * the TCPT_PERSIST timer. When it expires, if the window is nonzero, + * we go to transmit state. Otherwise, at intervals send a single byte + * into the peer's window to force him to update our window information. + * We do this at most as often as TCPT_PERSMIN time intervals, + * but no more frequently than the current estimate of round-trip + * packet time. The TCPT_PERSIST timer is cleared whenever we receive + * a window update from the peer. + * + * The TCPT_KEEP timer is used to keep connections alive. If an + * connection is idle (no segments received) for TCPTV_KEEP_INIT amount of time, + * but not yet established, then we drop the connection. Once the connection + * is established, if the connection is idle for TCPTV_KEEP_IDLE time + * (and keepalives have been enabled on the socket), we begin to probe + * the connection. We force the peer to send us a segment by sending: + * + * This segment is (deliberately) outside the window, and should elicit + * an ack segment in response from the peer. If, despite the TCPT_KEEP + * initiated segments we cannot elicit a response from a peer in TCPT_MAXIDLE + * amount of time probing, then we drop the connection. + */ + +/* + * Time constants. + */ +#define PR_SLOWHZ 2 + +#define TCPTV_MSL ( 30*PR_SLOWHZ) /* max seg lifetime (hah!) */ +#define TCPTV_SRTTBASE 0 /* base roundtrip time; + if 0, no idea yet */ +#define TCPTV_SRTTDFLT ( 3*PR_SLOWHZ) /* assumed RTT if no info */ + +#define TCPTV_PERSMIN ( 5*PR_SLOWHZ) /* retransmit persistance */ +#define TCPTV_PERSMAX ( 60*PR_SLOWHZ) /* maximum persist interval */ + +#define TCPTV_KEEP_INIT ( 75*PR_SLOWHZ) /* initial connect keep alive */ +#define TCPTV_KEEP_IDLE (120*60*PR_SLOWHZ) /* dflt time before probing */ +#define TCPTV_KEEPINTVL ( 75*PR_SLOWHZ) /* default probe interval */ +#define TCPTV_KEEPCNT 8 /* max probes before drop */ + +#define TCPTV_MIN ( 1*PR_SLOWHZ) /* minimum allowable value */ +#define TCPTV_REXMTMAX ( 64*PR_SLOWHZ) /* max allowable REXMT value */ + +#define TCP_LINGERTIME 120 /* linger at most 2 minutes */ + +#define TCP_MAXRXTSHIFT 12 /* maximum retransmits */ + +/* + * Force a time value to be in a certain range. + */ +#define TCPT_RANGESET(tv, value, tvmin, tvmax) { \ + (tv) = (value); \ + if ((tv) < (tvmin)) \ + (tv) = (tvmin); \ + else if ((tv) > (tvmax)) \ + (tv) = (tvmax); \ +} + +/****************************************************************************/ + +#endif /* _NETINET_TCP_TIMER_H */ diff --git a/netinclude/netinet/tcp_var.h b/netinclude/netinet/tcp_var.h new file mode 100755 index 0000000..f5227d5 --- /dev/null +++ b/netinclude/netinet/tcp_var.h @@ -0,0 +1,162 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1993, 1994, 1995 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_var.h 8.4 (Berkeley) 5/24/95 + */ + +#ifndef _NETINET_TCP_VAR_H +#define _NETINET_TCP_VAR_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _NETINET_TCP_TIMER_H +#include +#endif /* _NETINET_TCP_TIMER_H */ + +#ifndef _NETINET_TCP_H +#include +#endif /* _NETINET_TCP_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * TCP statistics. + * Many of these should be kept per connection, + * but that's inconvenient at the moment. + */ +struct tcpstat { + __ULONG tcps_connattempt; /* connections initiated */ + __ULONG tcps_accepts; /* connections accepted */ + __ULONG tcps_connects; /* connections established */ + __ULONG tcps_drops; /* connections dropped */ + __ULONG tcps_conndrops; /* embryonic connections dropped */ + __ULONG tcps_closed; /* conn. closed (includes drops) */ + __ULONG tcps_segstimed; /* segs where we tried to get rtt */ + __ULONG tcps_rttupdated; /* times we succeeded */ + __ULONG tcps_delack; /* delayed acks sent */ + __ULONG tcps_timeoutdrop; /* conn. dropped in rxmt timeout */ + __ULONG tcps_rexmttimeo; /* retransmit timeouts */ + __ULONG tcps_persisttimeo; /* persist timeouts */ + __ULONG tcps_keeptimeo; /* keepalive timeouts */ + __ULONG tcps_keepprobe; /* keepalive probes sent */ + __ULONG tcps_keepdrops; /* connections dropped in keepalive */ + + __ULONG tcps_sndtotal; /* total packets sent */ + __ULONG tcps_sndpack; /* data packets sent */ + __ULONG tcps_sndbyte; /* data bytes sent */ + __ULONG tcps_sndrexmitpack; /* data packets retransmitted */ + __ULONG tcps_sndrexmitbyte; /* data bytes retransmitted */ + __ULONG tcps_sndacks; /* ack-only packets sent */ + __ULONG tcps_sndprobe; /* window probes sent */ + __ULONG tcps_sndurg; /* packets sent with URG only */ + __ULONG tcps_sndwinup; /* window update-only packets sent */ + __ULONG tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */ + + __ULONG tcps_rcvtotal; /* total packets received */ + __ULONG tcps_rcvpack; /* packets received in sequence */ + __ULONG tcps_rcvbyte; /* bytes received in sequence */ + __ULONG tcps_rcvbadsum; /* packets received with ccksum errs */ + __ULONG tcps_rcvbadoff; /* packets received with bad offset */ + __ULONG tcps_rcvshort; /* packets received too short */ + __ULONG tcps_rcvduppack; /* duplicate-only packets received */ + __ULONG tcps_rcvdupbyte; /* duplicate-only bytes received */ + __ULONG tcps_rcvpartduppack; /* packets with some duplicate data */ + __ULONG tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */ + __ULONG tcps_rcvoopack; /* out-of-order packets received */ + __ULONG tcps_rcvoobyte; /* out-of-order bytes received */ + __ULONG tcps_rcvpackafterwin; /* packets with data after window */ + __ULONG tcps_rcvbyteafterwin; /* bytes rcvd after window */ + __ULONG tcps_rcvafterclose; /* packets rcvd after "close" */ + __ULONG tcps_rcvwinprobe; /* rcvd window probe packets */ + __ULONG tcps_rcvdupack; /* rcvd duplicate acks */ + __ULONG tcps_rcvacktoomuch; /* rcvd acks for unsent data */ + __ULONG tcps_rcvackpack; /* rcvd ack packets */ + __ULONG tcps_rcvackbyte; /* bytes acked by rcvd acks */ + __ULONG tcps_rcvwinupd; /* rcvd window update packets */ + __ULONG tcps_pawsdrop; /* segments dropped due to PAWS */ + __ULONG tcps_predack; /* times hdr predict ok for acks */ + __ULONG tcps_preddat; /* times hdr predict ok for data pkts */ + __ULONG tcps_pcbcachemiss; + __ULONG tcps_persistdrop; /* timeout in persist state */ + __ULONG tcps_badsyn; /* bogus SYN, e.g. premature ACK */ +}; + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_TCP_VAR_H */ diff --git a/netinclude/netinet/udp.h b/netinclude/netinet/udp.h new file mode 100755 index 0000000..e3dea9e --- /dev/null +++ b/netinclude/netinet/udp.h @@ -0,0 +1,103 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)udp.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_UDP_H +#define _NETINET_UDP_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Udp protocol header. + * Per RFC 768, September, 1981. + */ +struct udphdr { + __UWORD uh_sport; /* source port */ + __UWORD uh_dport; /* destination port */ + __WORD uh_ulen; /* udp length */ + __UWORD uh_sum; /* udp checksum */ +}; + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_UDP_H */ diff --git a/netinclude/netinet/udp_var.h b/netinclude/netinet/udp_var.h new file mode 100755 index 0000000..05441cc --- /dev/null +++ b/netinclude/netinet/udp_var.h @@ -0,0 +1,139 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_UDP_VAR_H +#define _NETINET_UDP_VAR_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _NETINET_UDP_H +#include +#endif /* _NETINET_UDP_H */ + +#ifndef _NETINET_IP_VAR_H +#include +#endif /* _NETINET_IP_VAR_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * UDP kernel structures and variables. + */ +struct udpiphdr { + struct ipovly ui_i; /* overlaid ip structure */ + struct udphdr ui_u; /* udp header */ +}; +#define ui_next ui_i.ih_next +#define ui_prev ui_i.ih_prev +#define ui_x1 ui_i.ih_x1 +#define ui_pr ui_i.ih_pr +#define ui_len ui_i.ih_len +#define ui_src ui_i.ih_src +#define ui_dst ui_i.ih_dst +#define ui_sport ui_u.uh_sport +#define ui_dport ui_u.uh_dport +#define ui_ulen ui_u.uh_ulen +#define ui_sum ui_u.uh_sum + +struct udpstat { + /* input statistics: */ + __ULONG udps_ipackets; /* total input packets */ + __ULONG udps_hdrops; /* packet shorter than header */ + __ULONG udps_badsum; /* checksum error */ + __ULONG udps_badlen; /* data length larger than packet */ + __ULONG udps_noport; /* no socket on port */ + __ULONG udps_noportbcast; /* of above, arrived as broadcast */ + __ULONG udps_fullsock; /* not delivered, input socket full */ + __ULONG udpps_pcbcachemiss; /* input packets missing pcb cache */ + /* output statistics: */ + __ULONG udps_opackets; /* total output packets */ +}; + +/* + * Names for UDP sysctl objects + */ +#define UDPCTL_CHECKSUM 1 /* checksum UDP packets */ +#define UDPCTL_MAXID 2 + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _NETINET_UDP_VAR_H */ diff --git a/netinclude/pragmas/bsdsocket_pragmas.h b/netinclude/pragmas/bsdsocket_pragmas.h new file mode 100755 index 0000000..34e730c --- /dev/null +++ b/netinclude/pragmas/bsdsocket_pragmas.h @@ -0,0 +1,292 @@ +/* + * $Id$ + * + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +#ifndef PRAGMAS_BSDSOCKET_PRAGMAS_H +#define PRAGMAS_BSDSOCKET_PRAGMAS_H + +#ifndef CLIB_BSDSOCKET_PROTOS_H +#include +#endif + +#if defined(AZTEC_C) || defined(__MAXON__) || defined(__STORM__) +#pragma amicall(SocketBase,0x01e,socket(d0,d1,d2)) +#pragma amicall(SocketBase,0x024,bind(d0,a0,d1)) +#pragma amicall(SocketBase,0x02a,listen(d0,d1)) +#pragma amicall(SocketBase,0x030,accept(d0,a0,a1)) +#pragma amicall(SocketBase,0x036,connect(d0,a0,d1)) +#pragma amicall(SocketBase,0x03c,sendto(d0,a0,d1,d2,a1,d3)) +#pragma amicall(SocketBase,0x042,send(d0,a0,d1,d2)) +#pragma amicall(SocketBase,0x048,recvfrom(d0,a0,d1,d2,a1,a2)) +#pragma amicall(SocketBase,0x04e,recv(d0,a0,d1,d2)) +#pragma amicall(SocketBase,0x054,shutdown(d0,d1)) +#pragma amicall(SocketBase,0x05a,setsockopt(d0,d1,d2,a0,d3)) +#pragma amicall(SocketBase,0x060,getsockopt(d0,d1,d2,a0,a1)) +#pragma amicall(SocketBase,0x066,getsockname(d0,a0,a1)) +#pragma amicall(SocketBase,0x06c,getpeername(d0,a0,a1)) +#pragma amicall(SocketBase,0x072,IoctlSocket(d0,d1,a0)) +#pragma amicall(SocketBase,0x078,CloseSocket(d0)) +#pragma amicall(SocketBase,0x07e,WaitSelect(d0,a0,a1,a2,a3,d1)) +#pragma amicall(SocketBase,0x084,SetSocketSignals(d0,d1,d2)) +#pragma amicall(SocketBase,0x08a,getdtablesize()) +#pragma amicall(SocketBase,0x090,ObtainSocket(d0,d1,d2,d3)) +#pragma amicall(SocketBase,0x096,ReleaseSocket(d0,d1)) +#pragma amicall(SocketBase,0x09c,ReleaseCopyOfSocket(d0,d1)) +#pragma amicall(SocketBase,0x0a2,Errno()) +#pragma amicall(SocketBase,0x0a8,SetErrnoPtr(a0,d0)) +#pragma amicall(SocketBase,0x0ae,Inet_NtoA(d0)) +#pragma amicall(SocketBase,0x0b4,inet_addr(a0)) +#pragma amicall(SocketBase,0x0ba,Inet_LnaOf(d0)) +#pragma amicall(SocketBase,0x0c0,Inet_NetOf(d0)) +#pragma amicall(SocketBase,0x0c6,Inet_MakeAddr(d0,d1)) +#pragma amicall(SocketBase,0x0cc,inet_network(a0)) +#pragma amicall(SocketBase,0x0d2,gethostbyname(a0)) +#pragma amicall(SocketBase,0x0d8,gethostbyaddr(a0,d0,d1)) +#pragma amicall(SocketBase,0x0de,getnetbyname(a0)) +#pragma amicall(SocketBase,0x0e4,getnetbyaddr(d0,d1)) +#pragma amicall(SocketBase,0x0ea,getservbyname(a0,a1)) +#pragma amicall(SocketBase,0x0f0,getservbyport(d0,a0)) +#pragma amicall(SocketBase,0x0f6,getprotobyname(a0)) +#pragma amicall(SocketBase,0x0fc,getprotobynumber(d0)) +#pragma amicall(SocketBase,0x102,vsyslog(d0,a0,a1)) +#pragma amicall(SocketBase,0x108,Dup2Socket(d0,d1)) +#pragma amicall(SocketBase,0x10e,sendmsg(d0,a0,d1)) +#pragma amicall(SocketBase,0x114,recvmsg(d0,a0,d1)) +#pragma amicall(SocketBase,0x11a,gethostname(a0,d0)) +#pragma amicall(SocketBase,0x120,gethostid()) +#pragma amicall(SocketBase,0x126,SocketBaseTagList(a0)) +#pragma amicall(SocketBase,0x12c,GetSocketEvents(a0)) +#pragma amicall(SocketBase,0x16e,bpf_open(d0)) +#pragma amicall(SocketBase,0x174,bpf_close(d0)) +#pragma amicall(SocketBase,0x17a,bpf_read(d0,a0,d1)) +#pragma amicall(SocketBase,0x180,bpf_write(d0,a0,d1)) +#pragma amicall(SocketBase,0x186,bpf_set_notify_mask(d1,d0)) +#pragma amicall(SocketBase,0x18c,bpf_set_interrupt_mask(d0,d1)) +#pragma amicall(SocketBase,0x192,bpf_ioctl(d0,d1,a0)) +#pragma amicall(SocketBase,0x198,bpf_data_waiting(d0)) +#pragma amicall(SocketBase,0x19e,AddRouteTagList(a0)) +#pragma amicall(SocketBase,0x1a4,DeleteRouteTagList(a0)) +#pragma amicall(SocketBase,0x1aa,ChangeRouteTagList(a0)) +#pragma amicall(SocketBase,0x1b0,FreeRouteInfo(a0)) +#pragma amicall(SocketBase,0x1b6,GetRouteInfo(d0,d1)) +#pragma amicall(SocketBase,0x1bc,AddInterfaceTagList(a0,a1,d0,a2)) +#pragma amicall(SocketBase,0x1c2,ConfigureInterfaceTagList(a0,a1)) +#pragma amicall(SocketBase,0x1c8,ReleaseInterfaceList(a0)) +#pragma amicall(SocketBase,0x1ce,ObtainInterfaceList()) +#pragma amicall(SocketBase,0x1d4,QueryInterfaceTagList(a0,a1)) +#pragma amicall(SocketBase,0x1da,CreateAddrAllocMessageA(d0,d1,a0,a1,a2)) +#pragma amicall(SocketBase,0x1e0,DeleteAddrAllocMessage(a0)) +#pragma amicall(SocketBase,0x1e6,BeginInterfaceConfig(a0)) +#pragma amicall(SocketBase,0x1ec,AbortInterfaceConfig(a0)) +#pragma amicall(SocketBase,0x1f2,AddNetMonitorHookTagList(d0,a0,a1)) +#pragma amicall(SocketBase,0x1f8,RemoveNetMonitorHook(a0)) +#pragma amicall(SocketBase,0x1fe,GetNetworkStatistics(d0,d1,a0,d2)) +#pragma amicall(SocketBase,0x204,AddDomainNameServer(a0)) +#pragma amicall(SocketBase,0x20a,RemoveDomainNameServer(a0)) +#pragma amicall(SocketBase,0x210,ReleaseDomainNameServerList(a0)) +#pragma amicall(SocketBase,0x216,ObtainDomainNameServerList()) +#pragma amicall(SocketBase,0x21c,setnetent(d0)) +#pragma amicall(SocketBase,0x222,endnetent()) +#pragma amicall(SocketBase,0x228,getnetent()) +#pragma amicall(SocketBase,0x22e,setprotoent(d0)) +#pragma amicall(SocketBase,0x234,endprotoent()) +#pragma amicall(SocketBase,0x23a,getprotoent()) +#pragma amicall(SocketBase,0x240,setservent(d0)) +#pragma amicall(SocketBase,0x246,endservent()) +#pragma amicall(SocketBase,0x24c,getservent()) +#pragma amicall(SocketBase,0x252,inet_aton(a0,a1)) +#pragma amicall(SocketBase,0x258,inet_ntop(d0,a0,a1,d1)) +#pragma amicall(SocketBase,0x25e,inet_pton(d0,a0,a1)) +#pragma amicall(SocketBase,0x264,In_LocalAddr(d0)) +#pragma amicall(SocketBase,0x26a,In_CanForward(d0)) +#pragma amicall(SocketBase,0x270,mbuf_copym(a0,d0,d1)) +#pragma amicall(SocketBase,0x276,mbuf_copyback(a0,d0,d1,a1)) +#pragma amicall(SocketBase,0x27c,mbuf_copydata(a0,d0,d1,a1)) +#pragma amicall(SocketBase,0x282,mbuf_free(a0)) +#pragma amicall(SocketBase,0x288,mbuf_freem(a0)) +#pragma amicall(SocketBase,0x28e,mbuf_get()) +#pragma amicall(SocketBase,0x294,mbuf_gethdr()) +#pragma amicall(SocketBase,0x29a,mbuf_prepend(a0,d0)) +#pragma amicall(SocketBase,0x2a0,mbuf_cat(a0,a1)) +#pragma amicall(SocketBase,0x2a6,mbuf_adj(a0,d0)) +#pragma amicall(SocketBase,0x2ac,mbuf_pullup(a0,d0)) +#pragma amicall(SocketBase,0x2b2,ProcessIsServer(a0)) +#pragma amicall(SocketBase,0x2b8,ObtainServerSocket()) +#pragma amicall(SocketBase,0x2be,GetDefaultDomainName(a0,d0)) +#pragma amicall(SocketBase,0x2c4,SetDefaultDomainName(a0)) +#pragma amicall(SocketBase,0x2ca,ObtainRoadshowData(d0)) +#pragma amicall(SocketBase,0x2d0,ReleaseRoadshowData(a0)) +#pragma amicall(SocketBase,0x2d6,ChangeRoadshowData(a0,a1,d0,a2)) +#pragma amicall(SocketBase,0x2dc,RemoveInterface(a0,d0)) +#pragma amicall(SocketBase,0x2e2,gethostbyname_r(a0,a1,a2,d0,a3)) +#pragma amicall(SocketBase,0x2e8,gethostbyaddr_r(a0,d0,d1,a1,a2,d2,a3)) +#pragma amicall(SocketBase,0x2fa,ipf_open(d0)) +#pragma amicall(SocketBase,0x300,ipf_close(d0)) +#pragma amicall(SocketBase,0x306,ipf_ioctl(d0,d1,a0)) +#pragma amicall(SocketBase,0x30c,ipf_log_read(d0,a0,d1)) +#pragma amicall(SocketBase,0x312,ipf_log_data_waiting(d0)) +#pragma amicall(SocketBase,0x318,ipf_set_notify_mask(d0,d1)) +#pragma amicall(SocketBase,0x31e,ipf_set_interrupt_mask(d0,d1)) +#pragma amicall(SocketBase,0x324,freeaddrinfo(a0)) +#pragma amicall(SocketBase,0x32a,getaddrinfo(a0,a1,a2,a3)) +#pragma amicall(SocketBase,0x330,gai_strerror(a0)) +#pragma amicall(SocketBase,0x336,getnameinfo(a0,d0,a1,d1,a2,d2,d3)) +#endif +#if defined(_DCC) || defined(__SASC) +#pragma libcall SocketBase socket 01e 21003 +#pragma libcall SocketBase bind 024 18003 +#pragma libcall SocketBase listen 02a 1002 +#pragma libcall SocketBase accept 030 98003 +#pragma libcall SocketBase connect 036 18003 +#pragma libcall SocketBase sendto 03c 39218006 +#pragma libcall SocketBase send 042 218004 +#pragma libcall SocketBase recvfrom 048 a9218006 +#pragma libcall SocketBase recv 04e 218004 +#pragma libcall SocketBase shutdown 054 1002 +#pragma libcall SocketBase setsockopt 05a 3821005 +#pragma libcall SocketBase getsockopt 060 9821005 +#pragma libcall SocketBase getsockname 066 98003 +#pragma libcall SocketBase getpeername 06c 98003 +#pragma libcall SocketBase IoctlSocket 072 81003 +#pragma libcall SocketBase CloseSocket 078 001 +#pragma libcall SocketBase WaitSelect 07e 1ba98006 +#pragma libcall SocketBase SetSocketSignals 084 21003 +#pragma libcall SocketBase getdtablesize 08a 00 +#pragma libcall SocketBase ObtainSocket 090 321004 +#pragma libcall SocketBase ReleaseSocket 096 1002 +#pragma libcall SocketBase ReleaseCopyOfSocket 09c 1002 +#pragma libcall SocketBase Errno 0a2 00 +#pragma libcall SocketBase SetErrnoPtr 0a8 0802 +#pragma libcall SocketBase Inet_NtoA 0ae 001 +#pragma libcall SocketBase inet_addr 0b4 801 +#pragma libcall SocketBase Inet_LnaOf 0ba 001 +#pragma libcall SocketBase Inet_NetOf 0c0 001 +#pragma libcall SocketBase Inet_MakeAddr 0c6 1002 +#pragma libcall SocketBase inet_network 0cc 801 +#pragma libcall SocketBase gethostbyname 0d2 801 +#pragma libcall SocketBase gethostbyaddr 0d8 10803 +#pragma libcall SocketBase getnetbyname 0de 801 +#pragma libcall SocketBase getnetbyaddr 0e4 1002 +#pragma libcall SocketBase getservbyname 0ea 9802 +#pragma libcall SocketBase getservbyport 0f0 8002 +#pragma libcall SocketBase getprotobyname 0f6 801 +#pragma libcall SocketBase getprotobynumber 0fc 001 +#pragma libcall SocketBase vsyslog 102 98003 +#pragma libcall SocketBase Dup2Socket 108 1002 +#pragma libcall SocketBase sendmsg 10e 18003 +#pragma libcall SocketBase recvmsg 114 18003 +#pragma libcall SocketBase gethostname 11a 0802 +#pragma libcall SocketBase gethostid 120 00 +#pragma libcall SocketBase SocketBaseTagList 126 801 +#pragma libcall SocketBase GetSocketEvents 12c 801 +#pragma libcall SocketBase bpf_open 16e 001 +#pragma libcall SocketBase bpf_close 174 001 +#pragma libcall SocketBase bpf_read 17a 18003 +#pragma libcall SocketBase bpf_write 180 18003 +#pragma libcall SocketBase bpf_set_notify_mask 186 0102 +#pragma libcall SocketBase bpf_set_interrupt_mask 18c 1002 +#pragma libcall SocketBase bpf_ioctl 192 81003 +#pragma libcall SocketBase bpf_data_waiting 198 001 +#pragma libcall SocketBase AddRouteTagList 19e 801 +#pragma libcall SocketBase DeleteRouteTagList 1a4 801 +#pragma libcall SocketBase ChangeRouteTagList 1aa 801 +#pragma libcall SocketBase FreeRouteInfo 1b0 801 +#pragma libcall SocketBase GetRouteInfo 1b6 1002 +#pragma libcall SocketBase AddInterfaceTagList 1bc a09804 +#pragma libcall SocketBase ConfigureInterfaceTagList 1c2 9802 +#pragma libcall SocketBase ReleaseInterfaceList 1c8 801 +#pragma libcall SocketBase ObtainInterfaceList 1ce 00 +#pragma libcall SocketBase QueryInterfaceTagList 1d4 9802 +#pragma libcall SocketBase CreateAddrAllocMessageA 1da a981005 +#pragma libcall SocketBase DeleteAddrAllocMessage 1e0 801 +#pragma libcall SocketBase BeginInterfaceConfig 1e6 801 +#pragma libcall SocketBase AbortInterfaceConfig 1ec 801 +#pragma libcall SocketBase AddNetMonitorHookTagList 1f2 98003 +#pragma libcall SocketBase RemoveNetMonitorHook 1f8 801 +#pragma libcall SocketBase GetNetworkStatistics 1fe 281004 +#pragma libcall SocketBase AddDomainNameServer 204 801 +#pragma libcall SocketBase RemoveDomainNameServer 20a 801 +#pragma libcall SocketBase ReleaseDomainNameServerList 210 801 +#pragma libcall SocketBase ObtainDomainNameServerList 216 00 +#pragma libcall SocketBase setnetent 21c 001 +#pragma libcall SocketBase endnetent 222 00 +#pragma libcall SocketBase getnetent 228 00 +#pragma libcall SocketBase setprotoent 22e 001 +#pragma libcall SocketBase endprotoent 234 00 +#pragma libcall SocketBase getprotoent 23a 00 +#pragma libcall SocketBase setservent 240 001 +#pragma libcall SocketBase endservent 246 00 +#pragma libcall SocketBase getservent 24c 00 +#pragma libcall SocketBase inet_aton 252 9802 +#pragma libcall SocketBase inet_ntop 258 198004 +#pragma libcall SocketBase inet_pton 25e 98003 +#pragma libcall SocketBase In_LocalAddr 264 001 +#pragma libcall SocketBase In_CanForward 26a 001 +#pragma libcall SocketBase mbuf_copym 270 10803 +#pragma libcall SocketBase mbuf_copyback 276 910804 +#pragma libcall SocketBase mbuf_copydata 27c 910804 +#pragma libcall SocketBase mbuf_free 282 801 +#pragma libcall SocketBase mbuf_freem 288 801 +#pragma libcall SocketBase mbuf_get 28e 00 +#pragma libcall SocketBase mbuf_gethdr 294 00 +#pragma libcall SocketBase mbuf_prepend 29a 0802 +#pragma libcall SocketBase mbuf_cat 2a0 9802 +#pragma libcall SocketBase mbuf_adj 2a6 0802 +#pragma libcall SocketBase mbuf_pullup 2ac 0802 +#pragma libcall SocketBase ProcessIsServer 2b2 801 +#pragma libcall SocketBase ObtainServerSocket 2b8 00 +#pragma libcall SocketBase GetDefaultDomainName 2be 0802 +#pragma libcall SocketBase SetDefaultDomainName 2c4 801 +#pragma libcall SocketBase ObtainRoadshowData 2ca 001 +#pragma libcall SocketBase ReleaseRoadshowData 2d0 801 +#pragma libcall SocketBase ChangeRoadshowData 2d6 a09804 +#pragma libcall SocketBase RemoveInterface 2dc 0802 +#pragma libcall SocketBase gethostbyname_r 2e2 b0a9805 +#pragma libcall SocketBase gethostbyaddr_r 2e8 b2a910807 +#pragma libcall SocketBase ipf_open 2fa 001 +#pragma libcall SocketBase ipf_close 300 001 +#pragma libcall SocketBase ipf_ioctl 306 81003 +#pragma libcall SocketBase ipf_log_read 30c 18003 +#pragma libcall SocketBase ipf_log_data_waiting 312 001 +#pragma libcall SocketBase ipf_set_notify_mask 318 1002 +#pragma libcall SocketBase ipf_set_interrupt_mask 31e 1002 +#pragma libcall SocketBase freeaddrinfo 324 801 +#pragma libcall SocketBase getaddrinfo 32a ba9804 +#pragma libcall SocketBase gai_strerror 330 801 +#pragma libcall SocketBase getnameinfo 336 32a190807 +#endif +#ifdef __STORM__ +#pragma tagcall(SocketBase,0x102,syslog(d0,a0,a1)) +#pragma tagcall(SocketBase,0x126,SocketBaseTags(a0)) +#pragma tagcall(SocketBase,0x19e,AddRouteTags(a0)) +#pragma tagcall(SocketBase,0x1a4,DeleteRouteTags(a0)) +#pragma tagcall(SocketBase,0x1aa,ChangeRouteTags(a0)) +#pragma tagcall(SocketBase,0x1bc,AddInterfaceTags(a0,a1,d0,a2)) +#pragma tagcall(SocketBase,0x1c2,ConfigureInterfaceTags(a0,a1)) +#pragma tagcall(SocketBase,0x1d4,QueryInterfaceTags(a0,a1)) +#pragma tagcall(SocketBase,0x1da,CreateAddrAllocMessage(d0,d1,a0,a1,a2)) +#pragma tagcall(SocketBase,0x1f2,AddNetMonitorHookTags(d0,a0,a1)) +#endif +#ifdef __SASC_60 +#pragma tagcall SocketBase syslog 102 98003 +#pragma tagcall SocketBase SocketBaseTags 126 801 +#pragma tagcall SocketBase AddRouteTags 19e 801 +#pragma tagcall SocketBase DeleteRouteTags 1a4 801 +#pragma tagcall SocketBase ChangeRouteTags 1aa 801 +#pragma tagcall SocketBase AddInterfaceTags 1bc a09804 +#pragma tagcall SocketBase ConfigureInterfaceTags 1c2 9802 +#pragma tagcall SocketBase QueryInterfaceTags 1d4 9802 +#pragma tagcall SocketBase CreateAddrAllocMessage 1da a981005 +#pragma tagcall SocketBase AddNetMonitorHookTags 1f2 98003 +#endif + +#endif /* PRAGMAS_BSDSOCKET_PRAGMAS_H */ diff --git a/netinclude/pragmas/socket_pragmas.h b/netinclude/pragmas/socket_pragmas.h new file mode 100755 index 0000000..7ef88cb --- /dev/null +++ b/netinclude/pragmas/socket_pragmas.h @@ -0,0 +1,21 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * "Miami" compatibility header file + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +#ifndef PRAGMAS_SOCKET_PRAGMAS_H +#define PRAGMAS_SOCKET_PRAGMAS_H 1 + +#ifndef PRAGMAS_BSDSOCKET_PRAGMAS_H +#include +#endif /* PRAGMAS_BSDSOCKET_PRAGMAS_H */ + +#endif /* !PRAGMAS_SOCKET_PRAGMAS_H */ diff --git a/netinclude/pragmas/usergroup_pragmas.h b/netinclude/pragmas/usergroup_pragmas.h new file mode 100755 index 0000000..f764033 --- /dev/null +++ b/netinclude/pragmas/usergroup_pragmas.h @@ -0,0 +1,112 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack; "usergroup.library" API + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + * + * WARNING: The "usergroup.library" API must be considered obsolete and + * should not be used in new software. It is provided solely + * for backwards compatibility and legacy application software. + */ + +#ifndef PRAGMAS_USERGROUP_H +#define PRAGMAS_USERGROUP_H + +#ifndef CLIB_USERGROUP_PROTOS_H +#include +#endif + +#if defined(AZTEC_C) || defined(__MAXON__) || defined(__STORM__) +#pragma amicall(UserGroupBase,0x01e,ug_SetupContextTagList(a0,a1)) +#pragma amicall(UserGroupBase,0x024,ug_GetErr()) +#pragma amicall(UserGroupBase,0x02a,ug_StrError(d1)) +#pragma amicall(UserGroupBase,0x030,getuid()) +#pragma amicall(UserGroupBase,0x036,geteuid()) +#pragma amicall(UserGroupBase,0x03c,setreuid(d0,d1)) +#pragma amicall(UserGroupBase,0x042,setuid(d0)) +#pragma amicall(UserGroupBase,0x048,getgid()) +#pragma amicall(UserGroupBase,0x04e,getegid()) +#pragma amicall(UserGroupBase,0x054,setregid(d0,d1)) +#pragma amicall(UserGroupBase,0x05a,setgid(d0)) +#pragma amicall(UserGroupBase,0x060,getgroups(d0,a1)) +#pragma amicall(UserGroupBase,0x066,setgroups(d0,a1)) +#pragma amicall(UserGroupBase,0x06c,initgroups(a1,d0)) +#pragma amicall(UserGroupBase,0x072,getpwnam(a1)) +#pragma amicall(UserGroupBase,0x078,getpwuid(d0)) +#pragma amicall(UserGroupBase,0x07e,setpwent()) +#pragma amicall(UserGroupBase,0x084,getpwent()) +#pragma amicall(UserGroupBase,0x08a,endpwent()) +#pragma amicall(UserGroupBase,0x090,getgrnam(a1)) +#pragma amicall(UserGroupBase,0x096,getgrgid(d0)) +#pragma amicall(UserGroupBase,0x09c,setgrent()) +#pragma amicall(UserGroupBase,0x0a2,getgrent()) +#pragma amicall(UserGroupBase,0x0a8,endgrent()) +#pragma amicall(UserGroupBase,0x0ae,crypt(a0,a1)) +#pragma amicall(UserGroupBase,0x0b4,ug_GetSalt(a0,a1,d0)) +#pragma amicall(UserGroupBase,0x0ba,getpass(a1)) +#pragma amicall(UserGroupBase,0x0c0,umask(d0)) +#pragma amicall(UserGroupBase,0x0c6,getumask()) +#pragma amicall(UserGroupBase,0x0cc,setsid()) +#pragma amicall(UserGroupBase,0x0d2,getpgrp()) +#pragma amicall(UserGroupBase,0x0d8,getlogin()) +#pragma amicall(UserGroupBase,0x0de,setlogin(a1)) +#pragma amicall(UserGroupBase,0x0e4,setutent()) +#pragma amicall(UserGroupBase,0x0ea,getutent()) +#pragma amicall(UserGroupBase,0x0f0,endutent()) +#pragma amicall(UserGroupBase,0x0f6,getlastlog(d0)) +#pragma amicall(UserGroupBase,0x0fc,setlastlog(d0,a0,a1)) +#pragma amicall(UserGroupBase,0x102,getcredentials(a0)) +#endif +#if defined(_DCC) || defined(__SASC) +#pragma libcall UserGroupBase ug_SetupContextTagList 01e 9802 +#pragma libcall UserGroupBase ug_GetErr 024 00 +#pragma libcall UserGroupBase ug_StrError 02a 101 +#pragma libcall UserGroupBase getuid 030 00 +#pragma libcall UserGroupBase geteuid 036 00 +#pragma libcall UserGroupBase setreuid 03c 1002 +#pragma libcall UserGroupBase setuid 042 001 +#pragma libcall UserGroupBase getgid 048 00 +#pragma libcall UserGroupBase getegid 04e 00 +#pragma libcall UserGroupBase setregid 054 1002 +#pragma libcall UserGroupBase setgid 05a 001 +#pragma libcall UserGroupBase getgroups 060 9002 +#pragma libcall UserGroupBase setgroups 066 9002 +#pragma libcall UserGroupBase initgroups 06c 0902 +#pragma libcall UserGroupBase getpwnam 072 901 +#pragma libcall UserGroupBase getpwuid 078 001 +#pragma libcall UserGroupBase setpwent 07e 00 +#pragma libcall UserGroupBase getpwent 084 00 +#pragma libcall UserGroupBase endpwent 08a 00 +#pragma libcall UserGroupBase getgrnam 090 901 +#pragma libcall UserGroupBase getgrgid 096 001 +#pragma libcall UserGroupBase setgrent 09c 00 +#pragma libcall UserGroupBase getgrent 0a2 00 +#pragma libcall UserGroupBase endgrent 0a8 00 +#pragma libcall UserGroupBase crypt 0ae 9802 +#pragma libcall UserGroupBase ug_GetSalt 0b4 09803 +#pragma libcall UserGroupBase getpass 0ba 901 +#pragma libcall UserGroupBase umask 0c0 001 +#pragma libcall UserGroupBase getumask 0c6 00 +#pragma libcall UserGroupBase setsid 0cc 00 +#pragma libcall UserGroupBase getpgrp 0d2 00 +#pragma libcall UserGroupBase getlogin 0d8 00 +#pragma libcall UserGroupBase setlogin 0de 901 +#pragma libcall UserGroupBase setutent 0e4 00 +#pragma libcall UserGroupBase getutent 0ea 00 +#pragma libcall UserGroupBase endutent 0f0 00 +#pragma libcall UserGroupBase getlastlog 0f6 001 +#pragma libcall UserGroupBase setlastlog 0fc 98003 +#pragma libcall UserGroupBase getcredentials 102 801 +#endif +#ifdef __STORM__ +#pragma tagcall(UserGroupBase,0x01e,ug_SetupContextTags(a0,a1)) +#endif +#ifdef __SASC_60 +#pragma tagcall UserGroupBase ug_SetupContextTags 01e 9802 +#endif + +#endif /* PRAGMAS_USERGROUP_H */ diff --git a/netinclude/proto/bsdsocket.h b/netinclude/proto/bsdsocket.h new file mode 100755 index 0000000..2f5d54e --- /dev/null +++ b/netinclude/proto/bsdsocket.h @@ -0,0 +1,89 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Generic prototype and direct ROM interface definitions + * Freely Distributable + */ + +#ifndef PROTO_BSDSOCKET_H +#define PROTO_BSDSOCKET_H + +#ifndef EXEC_LISTS_H +#include +#endif +#ifndef DEVICES_TIMER_H +#include +#endif +#ifndef UTILITY_TAGITEM_H +#include +#endif +#ifndef UTILITY_HOOKS_H +#include +#endif +#ifndef NETINET_IN_H +#include +#endif +#ifndef SYS_SOCKET_H +#include +#endif +#ifndef SYS_MBUF_H +#include +#endif +#ifndef NET_ROUTE_H +#include +#endif +#ifndef NETDB_H +#include +#endif +#ifndef LIBRARIES_BSDSOCKET_H +#include +#endif +#ifndef DOS_DOSEXTENS_H +#include +#endif + +/****************************************************************************/ + +#ifndef __NOLIBBASE__ +extern struct Library * SocketBase; +#endif /* __NOLIBBASE__ */ + +/****************************************************************************/ + +#ifdef __amigaos4__ + #include + #ifdef __USE_INLINE__ + #include + #endif /* __USE_INLINE__ */ + #ifndef CLIB_BSDSOCKET_PROTOS_H + #define CLIB_BSDSOCKET_PROTOS_H 1 + #endif /* CLIB_BSDSOCKET_PROTOS_H */ + #ifndef __NOGLOBALIFACE__ + extern struct SocketIFace *ISocket; + #endif /* __NOGLOBALIFACE__ */ +#else /* __amigaos4__ */ + #ifndef CLIB_BSDSOCKET_PROTOS_H + #include + #endif /* CLIB_BSDSOCKET_PROTOS_H */ + #if defined(__GNUC__) + #ifndef __PPC__ + #include + #else + #include + #endif /* __PPC__ */ + #elif defined(__VBCC__) + #ifndef __PPC__ + #include + #endif /* __PPC__ */ + #else + #include + #endif /* __GNUC__ */ +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +#endif /* PROTO_BSDSOCKET_H */ diff --git a/netinclude/proto/socket.h b/netinclude/proto/socket.h new file mode 100755 index 0000000..8ad6a8f --- /dev/null +++ b/netinclude/proto/socket.h @@ -0,0 +1,21 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * "Miami" compatibility header file + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +#ifndef PROTO_SOCKET_H +#define PROTO_SOCKET_H 1 + +#ifndef PROTO_BSDSOCKET_H +#include +#endif /* PROTO_BSDSOCKET_H */ + +#endif /* PROTO_SOCKET_H */ diff --git a/netinclude/proto/usergroup.h b/netinclude/proto/usergroup.h new file mode 100755 index 0000000..31cb662 --- /dev/null +++ b/netinclude/proto/usergroup.h @@ -0,0 +1,69 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack; "usergroup.library" API + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + * + * WARNING: The "usergroup.library" API must be considered obsolete and + * should not be used in new software. It is provided solely + * for backwards compatibility and legacy application software. + */ + +#ifndef PROTO_USERGROUP_H +#define PROTO_USERGROUP_H + +#ifndef LIBRARIES_USERGROUP_H +#include +#endif +#ifndef PWD_H +#include +#endif +#ifndef GRP_H +#include +#endif + +/****************************************************************************/ + +#ifndef __NOLIBBASE__ +extern struct Library * UserGroupBase; +#endif /* __NOLIBBASE__ */ + +/****************************************************************************/ + +#ifdef __amigaos4__ + #include + #ifdef __USE_INLINE__ + #include + #endif /* __USE_INLINE__ */ + #ifndef CLIB_USERGROUP_PROTOS_H + #define CLIB_USERGROUP_PROTOS_H 1 + #endif /* CLIB_USERGROUP_PROTOS_H */ + #ifndef __NOGLOBALIFACE__ + extern struct UserGroupIFace *IUserGroup; + #endif /* __NOGLOBALIFACE__ */ +#else /* __amigaos4__ */ + #ifndef CLIB_USERGROUP_PROTOS_H + #include + #endif /* CLIB_USERGROUP_PROTOS_H */ + #if defined(__GNUC__) + #ifndef __PPC__ + #include + #else + #include + #endif /* __PPC__ */ + #elif defined(__VBCC__) + #ifndef __PPC__ + #include + #endif /* __PPC__ */ + #else + #include + #endif /* __GNUC__ */ +#endif /* __amigaos4__ */ + +/****************************************************************************/ + +#endif /* PROTO_USERGROUP_H */ diff --git a/netinclude/pwd.h b/netinclude/pwd.h new file mode 100755 index 0000000..0c45dcd --- /dev/null +++ b/netinclude/pwd.h @@ -0,0 +1,112 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack; "usergroup.library" API + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + * + * WARNING: The "usergroup.library" API must be considered obsolete and + * should not be used in new software. It is provided solely + * for backwards compatibility and legacy application software. + */ + +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)pwd.h 8.2 (Berkeley) 1/21/94 + */ + +#ifndef _PWD_H +#define _PWD_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +struct passwd +{ + __STRPTR pw_name; /* user name */ + __STRPTR pw_passwd; /* encrypted password */ + __LONG pw_uid; /* user uid */ + __LONG pw_gid; /* user gid */ + __STRPTR pw_gecos; /* Honeywell login info */ + __STRPTR pw_dir; /* home directory */ + __STRPTR pw_shell; /* default shell */ +}; + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* !_PWD_H */ diff --git a/netinclude/resolv.h b/netinclude/resolv.h new file mode 100755 index 0000000..e44b2b0 --- /dev/null +++ b/netinclude/resolv.h @@ -0,0 +1,74 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * ++Copyright++ 1983, 1987, 1989, 1993 + * - + * Copyright (c) 1983, 1987, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +/* + * @(#)resolv.h 8.1 (Berkeley) 6/2/93 + * $NetBSD: resolv.h,v 1.11 1997/10/13 09:26:07 lukem Exp $ + */ + +#ifndef _RESOLV_H +#define _RESOLV_H +#endif /* !_RESOLV_H */ diff --git a/netinclude/sys/errno.h b/netinclude/sys/errno.h new file mode 100755 index 0000000..2200674 --- /dev/null +++ b/netinclude/sys/errno.h @@ -0,0 +1,189 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)errno.h 8.5 (Berkeley) 1/21/94 + */ + +#ifndef _SYS_ERRNO_H +#define _SYS_ERRNO_H + +/****************************************************************************/ + +/* NOTE: the global 'extern int errno;' declaration below may conflict with + what your 'C' runtime library uses for its own 'errno' declaration. + While you should not need to #include this header file, and use + your 'C' runtime library version instead, it is sometimes not + possible to do without the error codes defined in this file. If + this is the case, define the preprocessor symbol __NO_NETINCLUDE_ERRNO + before you include this header file. */ + +/****************************************************************************/ + +#ifndef __NO_NETINCLUDE_ERRNO +extern int errno; /* global error number */ +#endif /* __NO_NETINCLUDE_ERRNO */ + +/****************************************************************************/ + +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* Input/output error */ +#define ENXIO 6 /* Device not configured */ +#define E2BIG 7 /* Argument list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file descriptor */ +#define ECHILD 10 /* No child processes */ +#define EDEADLK 11 /* Resource deadlock avoided */ + /* 11 was EAGAIN */ +#define ENOMEM 12 /* Cannot allocate memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#ifndef _POSIX_SOURCE +#define ENOTBLK 15 /* Block device required */ +#endif +#define EBUSY 16 /* Device busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* Operation not supported by device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* Too many open files in system */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Inappropriate ioctl for device */ +#ifndef _POSIX_SOURCE +#define ETXTBSY 26 /* Text file busy */ +#endif +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ + +/* math software */ +#define EDOM 33 /* Numerical argument out of domain */ +#define ERANGE 34 /* Result too large */ + +/* non-blocking and interrupt i/o */ +#define EAGAIN 35 /* Resource temporarily unavailable */ +#ifndef _POSIX_SOURCE +#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define EINPROGRESS 36 /* Operation now in progress */ +#define EALREADY 37 /* Operation already in progress */ + +/* ipc/network software -- argument errors */ +#define ENOTSOCK 38 /* Socket operation on non-socket */ +#define EDESTADDRREQ 39 /* Destination address required */ +#define EMSGSIZE 40 /* Message too long */ +#define EPROTOTYPE 41 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 42 /* Protocol not available */ +#define EPROTONOSUPPORT 43 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ +#define EOPNOTSUPP 45 /* Operation not supported */ +#define EPFNOSUPPORT 46 /* Protocol family not supported */ +#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ +#define EADDRINUSE 48 /* Address already in use */ +#define EADDRNOTAVAIL 49 /* Can't assign requested address */ + +/* ipc/network software -- operational errors */ +#define ENETDOWN 50 /* Network is down */ +#define ENETUNREACH 51 /* Network is unreachable */ +#define ENETRESET 52 /* Network dropped connection on reset */ +#define ECONNABORTED 53 /* Software caused connection abort */ +#define ECONNRESET 54 /* Connection reset by peer */ +#define ENOBUFS 55 /* No buffer space available */ +#define EISCONN 56 /* Socket is already connected */ +#define ENOTCONN 57 /* Socket is not connected */ +#define ESHUTDOWN 58 /* Can't send after socket shutdown */ +#define ETOOMANYREFS 59 /* Too many references: can't splice */ +#define ETIMEDOUT 60 /* Operation timed out */ +#define ECONNREFUSED 61 /* Connection refused */ + +#define ELOOP 62 /* Too many levels of symbolic links */ +#endif /* _POSIX_SOURCE */ +#define ENAMETOOLONG 63 /* File name too long */ + +/* should be rearranged */ +#ifndef _POSIX_SOURCE +#define EHOSTDOWN 64 /* Host is down */ +#define EHOSTUNREACH 65 /* No route to host */ +#endif /* _POSIX_SOURCE */ +#define ENOTEMPTY 66 /* Directory not empty */ + +/* quotas & mush */ +#ifndef _POSIX_SOURCE +#define EPROCLIM 67 /* Too many processes */ +#define EUSERS 68 /* Too many users */ +#define EDQUOT 69 /* Disc quota exceeded */ + +/* Network File System */ +#define ESTALE 70 /* Stale NFS file handle */ +#define EREMOTE 71 /* Too many levels of remote in path */ +#define EBADRPC 72 /* RPC struct is bad */ +#define ERPCMISMATCH 73 /* RPC version wrong */ +#define EPROGUNAVAIL 74 /* RPC prog. not avail */ +#define EPROGMISMATCH 75 /* Program version wrong */ +#define EPROCUNAVAIL 76 /* Bad procedure for program */ +#endif /* _POSIX_SOURCE */ + +#define ENOLCK 77 /* No locks available */ +#define ENOSYS 78 /* Function not implemented */ + +#ifndef _POSIX_SOURCE +#define EFTYPE 79 /* Inappropriate file type or format */ +#define EAUTH 80 /* Authentication error */ +#define ENEEDAUTH 81 /* Need authenticator */ +#define ELAST 81 /* Must be equal largest errno */ +#endif /* _POSIX_SOURCE */ + +/****************************************************************************/ + +#endif /* _SYS_ERRNO_H */ diff --git a/netinclude/sys/filio.h b/netinclude/sys/filio.h new file mode 100755 index 0000000..05879c1 --- /dev/null +++ b/netinclude/sys/filio.h @@ -0,0 +1,110 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/*- + * Copyright (c) 1982, 1986, 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)filio.h 8.1 (Berkeley) 3/28/94 + */ + +#ifndef _SYS_FILIO_H +#define _SYS_FILIO_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _SYS_IOCCOM_H +#include +#endif /* !_SYS_IOCCOM_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* Generic file-descriptor ioctl's. */ +#define FIOCLEX _IO('f', 1) /* set close on exec on fd */ +#define FIONCLEX _IO('f', 2) /* remove close on exec */ +#define FIONREAD _IOR('f', 127, __LONG) /* get # bytes to read */ +#define FIONBIO _IOW('f', 126, __LONG) /* set/clear non-blocking i/o */ +#define FIOASYNC _IOW('f', 125, __LONG) /* set/clear async i/o */ +#define FIOSETOWN _IOW('f', 124, __LONG) /* set owner */ +#define FIOGETOWN _IOR('f', 123, __LONG) /* get owner */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* !_SYS_FILIO_H */ diff --git a/netinclude/sys/ioccom.h b/netinclude/sys/ioccom.h new file mode 100755 index 0000000..1935336 --- /dev/null +++ b/netinclude/sys/ioccom.h @@ -0,0 +1,116 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/*- + * Copyright (c) 1982, 1986, 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ioccom.h 8.3 (Berkeley) 1/9/95 + */ + +#ifndef _SYS_IOCCOM_H +#define _SYS_IOCCOM_H + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Ioctl's have the command encoded in the lower word, and the size of + * any in or out parameters in the upper word. The high 3 bits of the + * upper word are used to encode the in/out status of the parameter. + */ +#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */ +#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) +#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) +#define IOCGROUP(x) (((x) >> 8) & 0xff) + +#define IOCPARM_MAX NBPG /* max size of ioctl args, mult. of NBPG */ + /* no parameters */ +#define IOC_VOID (0x20000000UL) + /* copy parameters out */ +#define IOC_OUT (0x40000000UL) + /* copy parameters in */ +#define IOC_IN (0x80000000UL) + /* copy paramters in and out */ +#define IOC_INOUT (IOC_IN|IOC_OUT) + /* mask for IN/OUT/VOID */ +#define IOC_DIRMASK (0xe0000000UL) + +#define _IOC(inout,group,num,len) \ + (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) +#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0) +#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) +#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) +/* this should be _IORW, but stdio got there first */ +#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* !_SYS_IOCCOM_H */ diff --git a/netinclude/sys/ioctl.h b/netinclude/sys/ioctl.h new file mode 100755 index 0000000..a19751f --- /dev/null +++ b/netinclude/sys/ioctl.h @@ -0,0 +1,67 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/*- + * Copyright (c) 1982, 1986, 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ioctl.h 8.6 (Berkeley) 3/28/94 + */ + +#ifndef _SYS_IOCTL_H +#define _SYS_IOCTL_H + +/****************************************************************************/ + +#ifndef _SYS_FILIO_H +#include +#endif /* !_SYS_FILIO_H */ + +#ifndef _SYS_SOCKIO_H +#include +#endif /* !_SYS_SOCKIO_H */ + +/****************************************************************************/ + +#endif /* !_SYS_IOCTL_H */ diff --git a/netinclude/sys/mbuf.h b/netinclude/sys/mbuf.h new file mode 100755 index 0000000..c7caca8 --- /dev/null +++ b/netinclude/sys/mbuf.h @@ -0,0 +1,206 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)mbuf.h 8.5 (Berkeley) 2/19/95 + */ + +#ifndef _SYS_MBUF_H +#define _SYS_MBUF_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _NET_IF_H +#include +#endif /* _NET_IF_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Constants related to network buffer management. + * MCLBYTES must be no larger than CLBYTES (the software page size), and, + * on machines that exchange pages of input or output buffers with mbuf + * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple + * of the hardware page size. + */ +#define MSIZE 128 /* size of an mbuf */ +#define MCLBYTES 2048 /* large enough for ether MTU */ +#define MCLSHIFT 11 +#define MCLOFSET (MCLBYTES - 1) + +/* + * Mbufs are of a single size, MSIZE (machine/machparam.h), which + * includes overhead. An mbuf may add a single "mbuf cluster" of size + * MCLBYTES (also in machine/machparam.h), which has no additional overhead + * and is used instead of the internal data area; this is done when + * at least MINCLSIZE of data must be stored. + */ + +#define MLEN (MSIZE - sizeof(struct m_hdr)) /* normal data len */ +#define MHLEN (MLEN - sizeof(struct pkthdr)) /* data len w/pkthdr */ + +#define MINCLSIZE (MHLEN + 1) /* smallest amount to put in cluster */ +#define M_MAXCOMPRESS (MHLEN / 2) /* max amount to copy for compression */ + +/* + * Macros for type conversion + * mtod(m,t) - convert mbuf pointer to data pointer of correct type + * dtom(x) - convert data pointer within mbuf to mbuf pointer (XXX) + */ +#define mtod(m,t) ((t)((m)->m_data)) +#define dtom(x) ((struct mbuf *)((__ULONG)(x) & ~(MSIZE-1))) + +/* header at beginning of each mbuf: */ +struct m_hdr { + struct mbuf *mh_next; /* next buffer in chain */ + struct mbuf *mh_nextpkt; /* next chain in queue/record */ + __APTR mh_data; /* location of data */ + __LONG mh_len; /* amount of data in this mbuf */ + __WORD mh_type; /* type of data in this mbuf */ + __WORD mh_flags; /* flags; see below */ +}; + +/* record/packet header in first mbuf of chain; valid if M_PKTHDR set */ +struct pkthdr { + struct ifnet *rcvif; /* rcv interface */ + __LONG len; /* total packet length */ +}; + +/* description of external storage mapped into mbuf, valid if M_EXT set */ +struct m_ext { + __APTR ext_buf; /* start of buffer */ + __APTR ext_free; /* free routine if not the usual */ + __ULONG ext_size; /* size of buffer, for ext_free */ +}; + +struct mbuf { + struct m_hdr m_hdr; + union { + struct { + struct pkthdr MH_pkthdr; /* M_PKTHDR set */ + union { + struct m_ext MH_ext; /* M_EXT set */ + __UBYTE MH_databuf[MHLEN]; + } MH_dat; + } MH; + __UBYTE M_databuf[MLEN]; /* !M_PKTHDR, !M_EXT */ + } M_dat; +}; +#define m_next m_hdr.mh_next +#define m_len m_hdr.mh_len +#define m_data m_hdr.mh_data +#define m_type m_hdr.mh_type +#define m_flags m_hdr.mh_flags +#define m_nextpkt m_hdr.mh_nextpkt +#define m_act m_nextpkt +#define m_pkthdr M_dat.MH.MH_pkthdr +#define m_ext M_dat.MH.MH_dat.MH_ext +#define m_pktdat M_dat.MH.MH_dat.MH_databuf +#define m_dat M_dat.M_databuf + +/* mbuf flags */ +#define M_EXT 0x0001 /* has associated external storage */ +#define M_PKTHDR 0x0002 /* start of record */ +#define M_EOR 0x0004 /* end of record */ + +/* mbuf pkthdr flags, also in m_flags */ +#define M_BCAST 0x0100 /* send/received as link-level broadcast */ +#define M_MCAST 0x0200 /* send/received as link-level multicast */ + +/* flags copied when copying m_pkthdr */ +#define M_COPYFLAGS (M_PKTHDR|M_EOR|M_BCAST|M_MCAST) + +/* length to m_copy to copy all */ +#define M_COPYALL 1000000000 + +/* + * Mbuf statistics. + */ +struct mbstat { + __ULONG m_mbufs; /* mbufs obtained from page pool */ + __ULONG m_clusters; /* clusters obtained from page pool */ + __ULONG m_spare; /* spare field */ + __ULONG m_clfree; /* free clusters */ + __ULONG m_drops; /* times failed to find space */ + __ULONG m_wait; /* times waited for space */ + __ULONG m_drain; /* times drained protocols for space */ +}; + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* _SYS_MBUF_H */ diff --git a/netinclude/sys/netinclude_types.h b/netinclude/sys/netinclude_types.h new file mode 100755 index 0000000..b184a8a --- /dev/null +++ b/netinclude/sys/netinclude_types.h @@ -0,0 +1,64 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#define _SYS_NETINCLUDE_TYPES_H + +/****************************************************************************/ + +/* The type definitions below mirror those in , which may + clash with local type definitions. Hence, replacements are used which + are rather unlikely to cause similar conflicts. Note that the definition + of the __TEXT and __STRPTR types currently support only SAS/C and the + GNU 'C' compiler. */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/****************************************************************************/ + +typedef long __LONG; /* signed 32-bit quantity */ +typedef unsigned long __ULONG; /* unsigned 32-bit quantity */ +typedef short __WORD; /* signed 16-bit quantity */ +typedef unsigned short __UWORD; /* unsigned 16-bit quantity */ +typedef signed char __BYTE; /* signed 8-bit quantity */ +typedef unsigned char __UBYTE; /* unsigned 8-bit quantity */ + +/****************************************************************************/ + +typedef void * __APTR; /* 32-bit untyped pointer */ + +/****************************************************************************/ + +#if (defined(__GNUC__) && defined(__CHAR_UNSIGNED__)) || (defined(__SASC) && defined(_UNSCHAR)) +typedef char * __STRPTR; /* string pointer (NULL terminated) */ +#else +typedef unsigned char * __STRPTR; /* string pointer (NULL terminated) */ +#endif + +#if (defined(__GNUC__) && defined(__CHAR_UNSIGNED__)) || (defined(__SASC) && defined(_UNSCHAR)) +typedef char __TEXT; /* Non-negative character */ +#else +typedef unsigned char __TEXT; /* Non-negative character */ +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif + +/****************************************************************************/ + +#endif /* !_SYS_NETINCLUDE_TYPES_H */ diff --git a/netinclude/sys/socket.h b/netinclude/sys/socket.h new file mode 100755 index 0000000..40f3762 --- /dev/null +++ b/netinclude/sys/socket.h @@ -0,0 +1,421 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)socket.h 8.6 (Berkeley) 5/3/95 + */ + +#ifndef _SYS_SOCKET_H +#define _SYS_SOCKET_H + +/****************************************************************************/ + +/* NOTE: the 'struct timeval' structure definition differs slightly between + the AmigaOS usage (as defined in ) and the POSIX + usage (as defined in . By default, this header file + will include under the assumption that there + will be no problem as a result of that. However, if there are + compilation issues, you might want to define the 'struct timeval' + separately and disable the inclusion of , + which can be achieved by defining the preprocessor symbol + __NO_NETINCLUDE_TIMEVAL before you include this header file. */ + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +/****************************************************************************/ + +/* + * We might reference memmove() and memset() below, which is why + * we need to make sure that both are declared somewhere. + */ +#include +#include +#include + +/****************************************************************************/ + +/* 'struct iovec', as used in a 'struct msghdr' is defined in . */ +#ifndef _SYS_UIO_H +#include +#endif /* _SYS_UIO_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* + * Definitions related to sockets: types, address families, options. + */ + +/* + * Data types. + */ +typedef unsigned char sa_family_t; +typedef unsigned long socklen_t; + +/* + * Types + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ +#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ + +/* This is a private option which is used exclusively + * by this Amiga TCP/IP stack implementation and should not + * be used by user code. + */ +#define SO_EVENTMASK 0x2001 + +/* + * Structure used for manipulating linger option. + */ +struct linger { + __LONG l_onoff; /* option on/off */ + __LONG l_linger; /* linger time in seconds */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_LOCAL 1 /* local to host (pipes, portals) */ +#define AF_UNIX AF_LOCAL /* backward compatibility */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_ISO 7 /* ISO protocols */ +#define AF_OSI AF_ISO +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* DEC Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_ROUTE 17 /* Internal Routing Protocol */ +#define AF_LINK 18 /* Link layer interface */ +#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ +#define AF_COIP 20 /* connection-oriented IP, aka ST II */ +#define AF_CNT 21 /* Computer Network Technology */ +#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ +#define AF_IPX 23 /* Novell Internet Protocol */ +#define AF_SIP 24 /* Simple Internet Protocol */ +#define pseudo_AF_PIP 25 /* Help Identify PIP packets */ + +#define AF_MAX 26 + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + __UBYTE sa_len; /* total length */ + sa_family_t sa_family; /* address family */ + __UBYTE sa_data[14]; /* actually longer; address value */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + __UWORD sp_family; /* address family */ + __UWORD sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_LOCAL AF_LOCAL +#define PF_UNIX PF_LOCAL /* backward compatibility */ +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_ISO AF_ISO +#define PF_OSI AF_ISO +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_ROUTE AF_ROUTE +#define PF_LINK AF_LINK +#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ +#define PF_COIP AF_COIP +#define PF_CNT AF_CNT +#define PF_SIP AF_SIP +#define PF_IPX AF_IPX /* same format as AF_NS */ +#define PF_RTIP pseudo_AF_FTIP /* same format as AF_INET */ +#define PF_PIP pseudo_AF_PIP + +#define PF_MAX AF_MAX + +/* + * Definitions for network related sysctl, CTL_NET. + * + * Second level is protocol family. + * Third level is protocol number. + * + * Further levels are defined by the individual families below. + */ +#define NET_MAXID AF_MAX + +/* + * PF_ROUTE - Routing table + * + * Three additional levels are defined: + * Fourth: address family, 0 is wildcard + * Fifth: type of info, defined below + * Sixth: flag(s) to mask with for NET_RT_FLAGS + */ +#define NET_RT_DUMP 1 /* dump; may limit to a.f. */ +#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */ +#define NET_RT_IFLIST 3 /* survey interface list */ +#define NET_RT_MAXID 4 + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + * Used value-result for recvmsg, value only for sendmsg. + */ +struct msghdr { + __APTR msg_name; /* optional address */ + socklen_t msg_namelen; /* size of address */ + struct iovec * msg_iov; /* scatter/gather array */ + __ULONG msg_iovlen; /* # elements in msg_iov */ + __APTR msg_control; /* ancillary data, see below */ + socklen_t msg_controllen; /* ancillary data buffer len */ + __LONG msg_flags; /* flags on received message */ +}; + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ +#define MSG_EOR 0x8 /* data completes record */ +#define MSG_TRUNC 0x10 /* data discarded before delivery */ +#define MSG_CTRUNC 0x20 /* control data lost before delivery */ +#define MSG_WAITALL 0x40 /* wait for full request or error */ +#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */ + +/* + * Header for ancillary data objects in msg_control buffer. + * Used for additional information with/about a datagram + * not expressible by flags. The format is a sequence + * of message elements headed by cmsghdr structures. + */ +struct cmsghdr { + socklen_t cmsg_len; /* data byte count, including hdr */ + __LONG cmsg_level; /* originating protocol */ + __LONG cmsg_type; /* protocol-specific type */ +/* followed by __UBYTE cmsg_data[]; */ +}; + +/* given pointer to struct cmsghdr, return pointer to data */ +#define CMSG_DATA(cmsg) ((__UBYTE *)((cmsg) + 1)) + +/* given pointer to struct cmsghdr, return pointer to next cmsghdr */ +#define CMSG_NXTHDR(mhdr, cmsg) \ + (((__APTR)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \ + (mhdr)->msg_control + (mhdr)->msg_controllen) ? \ + (struct cmsghdr *)NULL : \ + (struct cmsghdr *)((__APTR)(cmsg) + ALIGN((cmsg)->cmsg_len))) + +#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control) + +/* "Socket"-level control message types: */ +#define SCM_RIGHTS 0x01 /* access rights (array of __LONG) */ + +/* + * The following comes from the original header file, + * which has been retired in favour of the + * type definitions. What remains are the macros in support of the + * "select()" call and those for endian-neutral operations. + */ + +/****************************************************************************/ + +/* + * In case the select() data structures and macros are already + * defined by somebody else... + */ + +#ifndef FD_SET + +#define NBBY 8 /* number of bits in a byte */ + +/* + * Select uses bit masks of file descriptors in longs. These macros + * manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here should + * be enough for most uses. + */ +#ifndef FD_SETSIZE +#define FD_SETSIZE 256 +#endif + +typedef unsigned long fd_mask; +#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ + +#ifndef howmany +#define howmany(x, y) (((x) + ((y) - 1)) / (y)) +#endif + +typedef struct fd_set { + fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; +} fd_set; + +#define FD_SET(n, p) ((void)(((unsigned long)n) < FD_SETSIZE ? (p)->fds_bits[((unsigned long)n)/NFDBITS] |= (1 << (((unsigned long)n) % NFDBITS)) : 0)) +#define FD_CLR(n, p) ((void)(((unsigned long)n) < FD_SETSIZE ? (p)->fds_bits[((unsigned long)n)/NFDBITS] &= ~(1 << (((unsigned long)n) % NFDBITS)) : 0)) +#define FD_ISSET(n, p) (((unsigned long)n) < FD_SETSIZE && ((p)->fds_bits[((unsigned long)n)/NFDBITS] & (1 << (((unsigned long)n) % NFDBITS)))) +#define FD_COPY(f, t) ((void)memmove((t), (f), sizeof(*(f)))) +#define FD_ZERO(p) ((void)memset((p), 0, sizeof(*(p)))) + +#endif /* FD_SET */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifndef __NO_NETINCLUDE_TIMEVAL + +/* + * This is for compatibility with POSIX-like 'timeval' structures + * which are remarkably similar to the Amiga 'timeval' except for + * the structure member names... + */ +#ifndef DEVICES_TIMER_H +#include +#endif /* DEVICES_TIMER_H */ + +#ifndef tv_sec +#define tv_sec tv_secs +#endif /* tv_sec */ + +#ifndef tv_usec +#define tv_usec tv_micro +#endif /* tv_usec */ + +#endif /* __NO_NETINCLUDE_TIMEVAL */ + +/****************************************************************************/ + +#endif /* !_SYS_SOCKET_H_ */ diff --git a/netinclude/sys/sockio.h b/netinclude/sys/sockio.h new file mode 100755 index 0000000..dfa7ff7 --- /dev/null +++ b/netinclude/sys/sockio.h @@ -0,0 +1,140 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/*- + * Copyright (c) 1982, 1986, 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sockio.h 8.1 (Berkeley) 3/28/94 + */ + +#ifndef _SYS_SOCKIO_H +#define _SYS_SOCKIO_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +#ifndef _SYS_IOCCOM_H +#include +#endif /* !_SYS_IOCCOM_H */ + +#ifndef _NET_IF_H +#include +#endif /* _NET_IF_H */ + +#ifndef _NET_ROUTE_H +#include +#endif /* _NET_ROUTE_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +/* Socket ioctl's. */ +#define SIOCSHIWAT _IOW('s', 0, __LONG) /* set high watermark */ +#define SIOCGHIWAT _IOR('s', 1, __LONG) /* get high watermark */ +#define SIOCSLOWAT _IOW('s', 2, __LONG) /* set low watermark */ +#define SIOCGLOWAT _IOR('s', 3, __LONG) /* get low watermark */ +#define SIOCATMARK _IOR('s', 7, __LONG) /* at oob mark? */ +#define SIOCSPGRP _IOW('s', 8, __LONG) /* set process group */ +#define SIOCGPGRP _IOR('s', 9, __LONG) /* get process group */ + +#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */ +#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */ + +#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ +#define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* get ifnet address */ +#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */ +#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ +#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* get p-p address */ +#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */ +#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ +#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */ +#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* get broadcast addr */ +#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */ +#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ +#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */ +#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ +#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */ +#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ +#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */ +#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */ +#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */ +#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */ +#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */ + +#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */ +#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* !_SYS_SOCKIO_H_ */ diff --git a/netinclude/sys/syslog.h b/netinclude/sys/syslog.h new file mode 100755 index 0000000..bb21435 --- /dev/null +++ b/netinclude/sys/syslog.h @@ -0,0 +1,72 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)syslog.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _SYS_SYSLOG_H +#define _SYS_SYSLOG_H + +/****************************************************************************/ + +/* + * priorities/facilities are encoded into a single 32-bit quantity, where the + * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility + * (0-big number). Both the priorities and the facilities map roughly + * one-to-one to strings in the syslogd(8) source code. This mapping is + * included in this file. + * + * priorities (these are ordered) + */ +#define LOG_EMERG 0 /* system is unusable */ +#define LOG_ALERT 1 /* action must be taken immediately */ +#define LOG_CRIT 2 /* critical conditions */ +#define LOG_ERR 3 /* error conditions */ +#define LOG_WARNING 4 /* warning conditions */ +#define LOG_NOTICE 5 /* normal but significant condition */ +#define LOG_INFO 6 /* informational */ +#define LOG_DEBUG 7 /* debug-level messages */ + +/****************************************************************************/ + +#endif /* !_SYS_SYSLOG_H */ diff --git a/netinclude/sys/uio.h b/netinclude/sys/uio.h new file mode 100755 index 0000000..4eb52c5 --- /dev/null +++ b/netinclude/sys/uio.h @@ -0,0 +1,102 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +/* + * Copyright (c) 1982, 1986, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)uio.h 8.5 (Berkeley) 2/22/94 + */ + +#ifndef _SYS_UIO_H +#define _SYS_UIO_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +/****************************************************************************/ + +#include + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +struct iovec +{ + __APTR iov_base; /* Base address. */ + size_t iov_len; /* Length. */ +}; + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* !_SYS_UIO_H */ diff --git a/netinclude/syslog.h b/netinclude/syslog.h new file mode 100755 index 0000000..085829e --- /dev/null +++ b/netinclude/syslog.h @@ -0,0 +1,14 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + */ + +#ifndef _SYS_SYSLOG_H +#include +#endif /* !_SYS_SYSLOG_H */ diff --git a/netinclude/utmp.h b/netinclude/utmp.h new file mode 100755 index 0000000..c39e8ae --- /dev/null +++ b/netinclude/utmp.h @@ -0,0 +1,129 @@ +/* + * :ts=8 + * + * 'Roadshow' -- Amiga TCP/IP stack; "usergroup.library" API + * Copyright © 2001-2016 by Olaf Barthel. + * All Rights Reserved. + * + * Amiga specific TCP/IP 'C' header files; + * Freely Distributable + * + * WARNING: The "usergroup.library" API must be considered obsolete and + * should not be used in new software. It is provided solely + * for backwards compatibility and legacy application software. + */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)utmp.h 8.2 (Berkeley) 1/21/94 + */ + +#ifndef _UTMP_H +#define _UTMP_H + +/****************************************************************************/ + +#ifndef _SYS_NETINCLUDE_TYPES_H +#include +#endif /* _SYS_NETINCLUDE_TYPES_H */ + +/****************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack(2) + #endif +#elif defined(__VBCC__) + #pragma amiga-align +#endif + +/****************************************************************************/ + +#define UT_NAMESIZE 32 +#define UT_LINESIZE 32 +#define UT_HOSTSIZE 64 + +/****************************************************************************/ + +struct lastlog +{ + __LONG ll_time; + __LONG ll_uid; + __TEXT ll_name[UT_NAMESIZE]; + __TEXT ll_host[UT_HOSTSIZE]; +}; + +#define ll_line ll_host + +/****************************************************************************/ + +struct utmp +{ + __LONG ut_time; + __LONG ut_sid; + __TEXT ut_name[UT_NAMESIZE]; + __TEXT ut_host[UT_HOSTSIZE]; +}; + +#define ut_line ut_host + +/****************************************************************************/ + +#ifdef __GNUC__ + #ifdef __PPC__ + #pragma pack() + #endif +#elif defined(__VBCC__) + #pragma default-align +#endif + +/****************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + +#endif /* !_UTMP_H */ diff --git a/sfd/bsdsocket_lib.sfd b/sfd/bsdsocket_lib.sfd new file mode 100644 index 0000000..bae9e3e --- /dev/null +++ b/sfd/bsdsocket_lib.sfd @@ -0,0 +1,187 @@ +==id $Id: bsdsocket_lib.sfd,v 1.12 2006-02-18 11:04:35 obarthel Exp $ +* "bsdsocket.library" +==base _SocketBase +==bias 30 +==public +==include +==include +==include +==include +==include +==include +==include +==include +==include +==include +==include +* +LONG socket(LONG domain,LONG type,LONG protocol) (d0,d1,d2) +LONG bind(LONG sock,struct sockaddr *name,socklen_t namelen) (d0,a0,d1) +LONG listen(LONG sock,LONG backlog) (d0,d1) +LONG accept(LONG sock,struct sockaddr *addr,socklen_t *addrlen) (d0,a0,a1) +LONG connect(LONG sock,struct sockaddr *name,socklen_t namelen) (d0,a0,d1) +LONG sendto(LONG sock,APTR buf,LONG len,LONG flags,struct sockaddr *to,socklen_t tolen) (d0,a0,d1,d2,a1,d3) +LONG send(LONG sock,APTR buf,LONG len,LONG flags) (d0,a0,d1,d2) +LONG recvfrom(LONG sock,APTR buf,LONG len,LONG flags,struct sockaddr *addr,socklen_t *addrlen) (d0,a0,d1,d2,a1,a2) +LONG recv(LONG sock,APTR buf,LONG len,LONG flags) (d0,a0,d1,d2) +LONG shutdown(LONG sock,LONG how) (d0,d1) +LONG setsockopt(LONG sock,LONG level,LONG optname,APTR optval,socklen_t optlen) (d0,d1,d2,a0,d3) +LONG getsockopt(LONG sock,LONG level,LONG optname,APTR optval,socklen_t *optlen) (d0,d1,d2,a0,a1) +LONG getsockname(LONG sock,struct sockaddr *name,socklen_t *namelen) (d0,a0,a1) +LONG getpeername(LONG sock,struct sockaddr *name,socklen_t *namelen) (d0,a0,a1) +LONG IoctlSocket(LONG sock,ULONG req,APTR argp) (d0,d1,a0) +LONG CloseSocket(LONG sock) (d0) +LONG WaitSelect(LONG nfds,APTR read_fds,APTR write_fds,APTR except_fds,struct timeval *_timeout,ULONG *signals) (d0,a0,a1,a2,a3,d1) +VOID SetSocketSignals(ULONG int_mask,ULONG io_mask,ULONG urgent_mask) (d0,d1,d2) +LONG getdtablesize() () +LONG ObtainSocket(LONG id,LONG domain,LONG type,LONG protocol) (d0,d1,d2,d3) +LONG ReleaseSocket(LONG sock,LONG id) (d0,d1) +LONG ReleaseCopyOfSocket(LONG sock,LONG id) (d0,d1) +LONG Errno() () +VOID SetErrnoPtr(APTR errno_ptr,LONG size) (a0,d0) +STRPTR Inet_NtoA(in_addr_t ip) (d0) +in_addr_t inet_addr(STRPTR cp) (a0) +in_addr_t Inet_LnaOf(in_addr_t in) (d0) +in_addr_t Inet_NetOf(in_addr_t in) (d0) +in_addr_t Inet_MakeAddr(in_addr_t net,in_addr_t host) (d0,d1) +in_addr_t inet_network(STRPTR cp) (a0) +struct hostent *gethostbyname(STRPTR name) (a0) +struct hostent *gethostbyaddr(STRPTR addr,LONG len,LONG type) (a0,d0,d1) +struct netent *getnetbyname(STRPTR name) (a0) +struct netent *getnetbyaddr(in_addr_t net,LONG type) (d0,d1) +struct servent *getservbyname(STRPTR name,STRPTR proto) (a0,a1) +struct servent *getservbyport(LONG port,STRPTR proto) (d0,a0) +struct protoent *getprotobyname(STRPTR name) (a0) +struct protoent *getprotobynumber(LONG proto) (d0) +VOID vsyslog(LONG pri,STRPTR msg,APTR args) (d0,a0,a1) +==varargs +VOID syslog(LONG pri,STRPTR msg,LONG first_parameter,...) (d0,a0,a1) +LONG Dup2Socket(LONG old_socket,LONG new_socket) (d0,d1) +LONG sendmsg(LONG sock,struct msghdr *msg,LONG flags) (d0,a0,d1) +LONG recvmsg(LONG sock,struct msghdr *msg,LONG flags) (d0,a0,d1) +LONG gethostname(STRPTR name,LONG namelen) (a0,d0) +in_addr_t gethostid() () +LONG SocketBaseTagList(struct TagItem *tags) (a0) +==varargs +LONG SocketBaseTags(Tag first_tag,...) (a0) +LONG GetSocketEvents(ULONG *event_ptr) (a0) +* Ten reserved slots for future expansion +==reserve 10 +* Berkeley Packet Filter (Roadshow extensions start here) +LONG bpf_open(LONG channel) (d0) +LONG bpf_close(LONG channel) (d0) +LONG bpf_read(LONG channel, APTR buffer, LONG len) (d0,a0,d1) +LONG bpf_write(LONG channel, APTR buffer, LONG len) (d0,a0,d1) +LONG bpf_set_notify_mask(LONG channel, ULONG signal_mask) (d1,d0) +LONG bpf_set_interrupt_mask(LONG channel, ULONG signal_mask) (d0,d1) +LONG bpf_ioctl(LONG channel, ULONG command, APTR buffer) (d0,d1,a0) +LONG bpf_data_waiting(LONG channel) (d0) +* Route management +LONG AddRouteTagList(struct TagItem *tags) (a0) +==varargs +LONG AddRouteTags(Tag first_tag,...) (a0) +LONG DeleteRouteTagList(struct TagItem *tags) (a0) +==varargs +LONG DeleteRouteTags(Tag first_tag,...) (a0) +==private +* This is still unimplemented... +LONG ChangeRouteTagList(struct TagItem *tags) (a0) +==varargs +LONG ChangeRouteTags(Tag first_tag,...) (a0) +==public +VOID FreeRouteInfo(struct rt_msghdr *buf) (a0) +struct rt_msghdr * GetRouteInfo(LONG address_family, LONG flags) (d0,d1) +* Interface management +LONG AddInterfaceTagList(STRPTR interface_name,STRPTR device_name,LONG unit,struct TagItem *tags) (a0,a1,d0,a2) +==varargs +LONG AddInterfaceTags(STRPTR interface_name,STRPTR device_name,LONG unit,Tag first_tag,...) (a0,a1,d0,a2) +LONG ConfigureInterfaceTagList(STRPTR interface_name,struct TagItem *tags) (a0,a1) +==varargs +LONG ConfigureInterfaceTags(STRPTR interface_name,Tag first_tag,...) (a0,a1) +VOID ReleaseInterfaceList(struct List *list) (a0) +struct List *ObtainInterfaceList() () +LONG QueryInterfaceTagList(STRPTR interface_name,struct TagItem *tags) (a0,a1) +==varargs +LONG QueryInterfaceTags(STRPTR interface_name,Tag first_tag,...) (a0,a1) +LONG CreateAddrAllocMessageA(LONG version,LONG protocol,STRPTR interface_name,struct AddressAllocationMessage **result_ptr,struct TagItem *tags) (d0,d1,a0,a1,a2) +==varargs +LONG CreateAddrAllocMessage(LONG version,LONG protocol,STRPTR interface_name,struct AddressAllocationMessage **result_ptr,Tag first_tag,...) (d0,d1,a0,a1,a2) +VOID DeleteAddrAllocMessage(struct AddressAllocationMessage *aam) (a0) +VOID BeginInterfaceConfig(struct AddressAllocationMessage * message) (a0) +VOID AbortInterfaceConfig(struct AddressAllocationMessage * message) (a0) +* Monitor management +LONG AddNetMonitorHookTagList(LONG type,struct Hook *hook,struct TagItem *tags) (d0,a0,a1) +==varargs +LONG AddNetMonitorHookTags(LONG type,struct Hook *hook,Tag first_tag,...) (d0,a0,a1) +VOID RemoveNetMonitorHook(struct Hook *hook) (a0) +* Status query +LONG GetNetworkStatistics(LONG type,LONG version,APTR destination,LONG size) (d0,d1,a0,d2) +* Domain name server management +LONG AddDomainNameServer(STRPTR address) (a0) +LONG RemoveDomainNameServer(STRPTR address) (a0) +VOID ReleaseDomainNameServerList(struct List *list) (a0) +struct List *ObtainDomainNameServerList() () +* Local database access +VOID setnetent(LONG stay_open) (d0) +VOID endnetent() () +struct netent * getnetent() () +VOID setprotoent(LONG stay_open) (d0) +VOID endprotoent() () +struct protoent * getprotoent() () +VOID setservent(LONG stay_open) (d0) +VOID endservent() () +struct servent * getservent() () +* Address conversion +LONG inet_aton(STRPTR cp,struct in_addr *addr) (a0,a1) +STRPTR inet_ntop(LONG af,APTR src,STRPTR dst,LONG size) (d0,a0,a1,d1) +LONG inet_pton(LONG af,STRPTR src,APTR dst) (d0,a0,a1) +LONG In_LocalAddr(in_addr_t address) (d0) +LONG In_CanForward(in_addr_t address) (d0) +* Kernel memory management +struct mbuf *mbuf_copym(struct mbuf *m, LONG off, LONG len) (a0,d0,d1) +LONG mbuf_copyback(struct mbuf *m, LONG off, LONG len, APTR cp) (a0,d0,d1,a1) +LONG mbuf_copydata(struct mbuf *m, LONG off, LONG len, APTR cp) (a0,d0,d1,a1) +struct mbuf *mbuf_free(struct mbuf *m) (a0) +VOID mbuf_freem(struct mbuf *m) (a0) +struct mbuf *mbuf_get() () +struct mbuf *mbuf_gethdr() () +struct mbuf *mbuf_prepend(struct mbuf *m, LONG len) (a0,d0) +LONG mbuf_cat(struct mbuf *m, struct mbuf *n) (a0,a1) +LONG mbuf_adj(struct mbuf *mp, LONG req_len) (a0,d0) +struct mbuf *mbuf_pullup(struct mbuf *m, LONG len) (a0,d0) +* Internet servers +BOOL ProcessIsServer(struct Process * pr) (a0) +LONG ObtainServerSocket() () +* Default domain name +BOOL GetDefaultDomainName(STRPTR buffer,LONG buffer_size) (a0,d0) +VOID SetDefaultDomainName(STRPTR buffer) (a0) +* Global data access +struct List *ObtainRoadshowData(LONG access) (d0) +VOID ReleaseRoadshowData(struct List *list) (a0) +BOOL ChangeRoadshowData(struct List *list,STRPTR name,ULONG length,APTR data) (a0,a1,d0,a2) +* The counterpart to AddInterfaceTagList +LONG RemoveInterface(STRPTR interface_name, LONG force) (a0, d0) +* Reentrant versions of the gethostbyname/gethostbyaddr functions, BSD-style +struct hostent * gethostbyname_r(STRPTR name, struct hostent * hp, APTR buf, ULONG buflen, LONG * he) (a0,a1,a2,d0,a3) +struct hostent * gethostbyaddr_r(STRPTR addr, LONG len, LONG type, struct hostent * hp, APTR buf, ULONG buflen, LONG * he) (a0,d0,d1,a1,a2,d2,a3) +* Two reserved slots for future expansion +==reserve 2 +==private +* The IP filtering interface is subject to change! +* IP filter management and logging +LONG ipf_open(LONG channel) (d0) +LONG ipf_close(LONG channel) (d0) +LONG ipf_ioctl(LONG channel,ULONG command,APTR buffer) (d0,d1,a0) +LONG ipf_log_read(LONG channel,APTR buffer,LONG len) (d0,a0,d1) +LONG ipf_log_data_waiting(LONG channel) (d0) +LONG ipf_set_notify_mask(LONG channel,ULONG mask) (d0,d1) +LONG ipf_set_interrupt_mask(LONG channel,ULONG mask) (d0,d1) +==public +* Node and service name translation (rfc3493) +VOID freeaddrinfo(struct addrinfo *ai) (a0) +LONG getaddrinfo(STRPTR hostname, STRPTR servname, struct addrinfo *hints, struct addrinfo **res) (a0,a1,a2,a3) +STRPTR gai_strerror(LONG errnum) (a0) +LONG getnameinfo(struct sockaddr *sa, ULONG salen, STRPTR host, ULONG hostlen, STRPTR serv, ULONG servlen, ULONG flags) (a0,d0,a1,d1,a2,d2,d3) +* Six reserved slots for future expansion +==reserve 6 +==end diff --git a/sfd/usergroup_lib.sfd b/sfd/usergroup_lib.sfd new file mode 100644 index 0000000..cf601bc --- /dev/null +++ b/sfd/usergroup_lib.sfd @@ -0,0 +1,51 @@ +==id $Id: usergroup_lib.sfd,v 1.4 2004-09-16 08:11:56 obarthel Exp $ +* "usergroup.library" +==base _UserGroupBase +==bias 30 +==public +==include +==include +==include +* +LONG ug_SetupContextTagList(STRPTR name,struct TagItem *tags) (a0,a1) +==varargs +LONG ug_SetupContextTags(STRPTR name,...) (a0,a1) +LONG ug_GetErr() () +STRPTR ug_StrError(LONG err) (d1) +LONG getuid() () +LONG geteuid() () +LONG setreuid(LONG real,LONG effective) (d0,d1) +LONG setuid(LONG uid) (d0) +LONG getgid() () +LONG getegid() () +LONG setregid(LONG real,LONG effective) (d0,d1) +LONG setgid(LONG gid) (d0) +LONG getgroups(LONG gidsetlen,LONG *gidset) (d0,a1) +LONG setgroups(LONG gidsetlen,LONG *gidset) (d0,a1) +LONG initgroups(STRPTR name,LONG basegid) (a1,d0) +struct passwd * getpwnam(STRPTR login) (a1) +struct passwd * getpwuid(LONG uid) (d0) +VOID setpwent() () +struct passwd * getpwent() () +VOID endpwent() () +struct group * getgrnam(STRPTR name) (a1) +struct group * getgrgid(LONG gid) (d0) +VOID setgrent() () +struct group * getgrent() () +VOID endgrent() () +UBYTE * crypt(UBYTE *key,UBYTE *set) (a0,a1) +UBYTE * ug_GetSalt(struct passwd *user,UBYTE *buf,ULONG size) (a0,a1,d0) +STRPTR getpass(STRPTR prompt) (a1) +ULONG umask(UWORD mask) (d0) +ULONG getumask() () +LONG setsid() () +LONG getpgrp() () +STRPTR getlogin() () +LONG setlogin(STRPTR name) (a1) +VOID setutent() () +struct utmp * getutent() () +VOID endutent() () +struct lastlog * getlastlog(LONG uid) (d0) +LONG setlastlog(LONG uid,STRPTR name,STRPTR host) (d0,a0,a1) +struct UserGroupCredentials *getcredentials(struct Task *task) (a0) +==end