- Extract 37 of 45 PDFs under docs/ to docs-extracted/ - Preserve directory structure (apex, cdk, development, platform, etc.) - Add docs-extracted/index.md with navigation table - 8 PDFs were 0-byte/empty and could not be extracted
90 KiB
| title | source | category | pages | extracted |
|---|---|---|---|---|
| Posix Lwip | docs/posix/posix-lwip.pdf | posix | 38 | 2026-07-06T23:05:50.845367 |
Posix Lwip
Extracted from
docs/posix/posix-lwip.pdf(38 pages). Figures, diagrams, and tables may not render accurately in plain text.
TCP/IP for PikeOS POSIX A Port of lwIP, a Lightweight TCP/IP Stack
Am Pfaffenstein 14, D-55270 Klein-Winternheim
Notice: The contents of this document are proprietary to SYSGO AG and shall not be disclosed, disseminated, copied, or used except for purposes expressly authorized in writing by SYSGO AG. TCP/IP for PikeOS POSIX PikeOS D5.0, Document Version D5.0-103
c 2005 – 2019 SYSGO GmbH
SYSGO GmbH Email: office@sysgo.com Am Pfaffenstein 14 55270 Klein-Winternheim, Germany http://www.sysgo.com
All rights reserved. PikeOS is a trademark of SYSGO GmbH. The designations used to identify other software or hardware products in this publication may be trademarks of their manufacturers or sellers. Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2 The lwIP Port to the PikeOS POSIX Personality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.1 The Architecture Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.2 The Ethernet Device Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.3 File System Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.4 Configuration Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.4.1 Changing Configuration Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.4.1.1 lwip_config.c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.4.1.2 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3 POSIX Applications with lwIP TCP/IP Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.1 Selected configuration parameters in <lwipopts.h> . . . . . . . . . . . . . . . . . . . . . . . . 12 3.1.1 IP Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.1.2 IPv6 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.1.3 ARP Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.1.4 ICMP Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.1.5 RAW Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.1.6 UDP Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.1.7 DHCP Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.1.8 DNS Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.1.9 TCP Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.1.10 Checksum Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.1.11 Thread Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.1.12 Memory Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.1.13 Memory Pool Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.1.14 Debugging and Diagnostics Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.2 The Default lwIP Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.3 Building a Customized lwIP Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.4 Application Code Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.5 Application Programs using lwIP Services in the Project Configurator . . . . . . . . . . . . . . . . . 20 3.5.1 Application Project Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.5.2 Integration Project Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4 API Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.1 Reserved Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.2 lwIP Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.2.1 NAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.2.2 SYNOPSIS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.2.3 DESCRIPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.2.4 RETURN VALUES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.2.5 ERRORS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.2.6 DIAGNOSTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.2.7 BUGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
4 CONTENTS
4.3 lwIP Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4.3.1 NAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4.3.2 DESCRIPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4.3.3 FILES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.4 Network Host Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.4.1 NAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.4.2 SYNOPSIS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.4.3 DESCRIPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.4.4 FILES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 4.4.5 EXAMPLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 4.4.6 DIAGNOSTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 4.4.7 CAVEAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.5 Host Name Data Base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.5.1 NAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.5.2 DESCRIPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.5.3 FILES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.5.4 SEE ALSO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.5.5 CAVEAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.6 Host Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.6.1 NAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.6.2 SYNOPSIS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.6.3 DESCRIPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.6.4 FILES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.6.5 RETURN VALUES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.6.6 ERRORS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.6.7 SEE ALSO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5 Release Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.1 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.2 Supported Operation Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.3 Notable Differences to other TCP/IP Implementations . . . . . . . . . . . . . . . . . . . . . . . . . 34 6 Copyright notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
1 Introduction
lwIP is a light-weight implementation of the TCP/IP protocol suite that was originally written by Adam Dunkels1 while at the Swedish Institute of Computer Science2 but now is being actively developed by a team of developers distributed world-wide. For more details on the lwIP TCP/IP stack refer to the project page http://savannah.nongnu.org/ projects/lwip/ on Savannah3 , a WiKi can be found at http://lwip.wikia.com/wiki/LwIP_Wiki. The current implementation for the PikeOS POSIX Personality is based on lwIP release version 2.1.2. This document gives an overview of the lwIP implementation on the PikeOS POSIX Personality and outlines the application build and integration process. A reference of the API calls implemented in addition to the lwIP API functions is included in section 4, page 23.
1 http://www.sics.se/~adam 2 http://www.sics.se/ 3 http://savannah.nongnu.org/
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
2 The lwIP Port to the PikeOS POSIX Personality
The port of lwIP to the PikeOS POSIX Personality is based on the contributed sources for a Unix system using POSIX threads. The link level interfaces supported by the current implementation are Ethernet device drivers with file provider interface and inter-partition links using PikeOS queuing ports. The network stack is part of the application process, so each POSIX application in a PikeOS system may include its own network stack. The supported lwIP API layer in the PikeOS POSIX Personality is the socket API. The socket API services are visible under their standard names, i.e. a socket is created using the socket() function (see also section 4.1, page 23). The lwIP raw API is not supported. The network stack supports IP protocols version 4 and 6. It can be configured to support any combination of the two protocols, refer to section 3.1, page 12 for further details.
2.1 The Architecture Layer
The architecture layer (files pikeos/arch/sys_arch.c and pikeos/include/arch/sys_arch.h) is de- rived from a POSIX thread implementation found in the lwIP contributed sources. The priority of the TCP/IP protocol thread and Ethernet device driver input thread can be configured using the TCPIP_THREAD_PRIO and ETHIF_THREAD_PRIO definitions in <lwipopts.h>, respectively.
2.2 The Ethernet Device Driver
The link layer driver for Ethernet devices (file pikeos/netif/ethernetif.c) can be used to connect to an Ethernet driver with file provider interface or to a pair of PikeOS queuing ports connected to other processes. The difference between the modes is mostly limited to device initialization and the use of one or two file descriptors for I/O. For interfaces with file provider interface a POSIX DDAPI thread is used for input data processing. If the file access mode of the driver allows memory mappings an attempt is made to use shared buffer communication (SBUF) with the driver (refer to PikeOS Device Driver Programming Reference Manual for details).
2.3 File System Integration
The lwIP socket API is integrated with the file system layer of the PikeOS POSIX Personality, i.e. API services creating communication endpoints (socket(), accept()) return file descriptors. A file descriptor associated with a socket is closed using close(). If applicable for the endpoint (e.g. SOCK_STREAM sockets), device I/O functions read() and write() can be used for data transfer. The file system layer of the PikeOS POSIX Personality does not include a generic version of the POSIX function select(), it is only part of the lwIP file system interface layer. The function is currently limited to file descriptors obtained by calls to the socket API (i.e. calls to socket() and accept()). If file descriptors which do not refer to a lwIP socket are included in file descriptor sets passed in the call to select(), the function will fail and set errno to ENOTSOCK to indicate the error.
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
Configuration Parameters 7
The interface between lwIP and the POSIX file system layer is implemented in file pikeos/misc/lwip.c.
2.4 Configuration Parameters
The network stack configuration data (address configuration, device driver assignments, etc.) resides in the application program binary, either a default set of parameters included in the lwIP library or a configuration record included in the application source code (refer to section 4.3, page 25 for details). These parameters can be overridden by PikeOS properties defined for the application process in the integration project.4 The stack supports up to LWIP_NUM_IF interfaces and up to LWIP_NUM_NS manually configurable name server addresses (these non tuneable parameters are respectively set to six and four). The configuration parameters for each interface are5 :
Parameter Property Description
Name type
IFName string Network interface identifier, only the first two characters are used.
Mode string Ethernet interface access mode. "eth" for Ethernet file provider,
"port" for direct PikeOS queuing port connection, "loopback" for
the local loopback interface, or "none" for an unused interface.
Device string Used only for mode="eth" and specifies pathname of the file provider
to use for Ethernet input and output.
The pathname is a POSIX pathname, e.g. /ssw/eth0:0.
MTU integer Specifies the maximum transmit unit (MTU) of the interface.
The MTU is used to limit the size of packets that are transmitted on an
interface. When using values larger than 1500, make sure that the net-
work infrastructure (network driver, switches, communication partners)
supports large frames. When using TCP, parameter TCP_MSS may also
need adjustment to make use of the larger message size.
TX string For mode="port", specifies the pathname of the PikeOS queuing port
used for frame output.
The pathname is a POSIX pathname, e.g. /qport/LWIP-IF2-tx
RX string For mode="port", specifies the POSIX pathname of the PikeOS
queuing port used for frame input.
TX_TO integer Used for mode="port", the queuing port transmit timeout in millisec-
onds. A value of -1 specifies infinite timeout.
TargetMAC binary For mode="port", the MAC address to use for the interface.
4 The configuration using properties is the preferred method, the process component description automatically adds file access permis- sions for configured network drivers and also generates queuing ports definitions, if required. 5 The tables show parameter names, types, an values as they appear in the property file system
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
8 The lwIP Port to the PikeOS POSIX Personality
The IPv4 configuration parameters for each interface are:
Parameter Property Description
Name type
ipv4 bool Enables or disables IPv4 configuration on the interface.
TargetIP binary The IPv4 address to assign to the interface. Not required for the loop-
back interface. If the interface access mode is set to "eth" and this
parameter is set to 0.0.0.0, a DHCP client is started and the interface
IP address is set dynamically, along with GatewayIP and NetMask
(regardless of the manual setting for these parameters). In addition,
up to LWIP_NUM_NS_PER_IF (non tuneable, set to two) name server
IP addresses are dynamically configurable for the interface. Manually
configured name servers are queried, if needed, subsequently to dy-
namically configured servers.
GatewayIP binary The IPv4 address to be used as default router, or 0.0.0.0.
NetMask binary The netmask to assign to the interface.
The IPv6 configuration parameters for each interface are:
Parameter Property Description
Name type
ipv6 bool Enables or disables IPv6 configuration on the interface. Successful
IPv6 configuration requires a multicast-capable interface6 .
TargetIPV6_1 binary First IPv6 interface address.
TargetIPV6_2 binary Second IPv6 interface address.
ipv6_auto- bool If set to true, attempts to automatically configure the interface address
config using SLAAC are made. If disabled, a third IPv6 address can be stati-
cally configured.
TargetIPV6_3 binary Third IPv6 interface address (if SLAAC is disabled).
The configuration parameter for each name server is:
Parameter Property Description
Name type
ServerIP binary The IPv4 address of a name server, or 0.0.0.0.
Note: If an interface with static configuration data is configured with GatewayIP different than 0.0.0.0, then it is set as the default interface. Otherwise, the default is set to a dynamically configured interface.
2.4.1 Changing Configuration Data
There are two ways to modify the network interface configuration that can be used in combination. The default parameters in the lwIP library (structure variable __lwip_config) can be replaced by application-specific def- initions. When the network stack is initialized, it will check for additional configuration values in the property file system and merge the configuration record included in the application binary with data read from properties. 6 This means lwIP interface mode "eth" and the necessary configuration in the Ethernet device driver.
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
Configuration Parameters 9
2.4.1.1 lwip_config.c
lwip_config.c contains the default configuration parameters. Configuration parameter names shown in the tables above are similar to the structure member names used in struct _lwip_config. Variable __lwip_config contains the active set of configuration parameters used by the stack after initialization. The variable and the parameter data structure is made available by including <lwip/lwip_config.h>. The structure contents ac- cessed through __lwip_config must be treated as read-only by the application after network stack initialization. Refer to section 4.3, page 25 for further details on the configuration data structure. A copy of the file included in the library is located in the lwip-build project (refer to section 3.3, page 19 for further details) located in /opt/pikeos-D5.0/demo/posix/lwip-build. You may either modify the file in a clone of the lwip-build project before building the lwIP library, or copy it to your project directory, modify it according to your needs, and include it in the application build. The default structure embedded in the library defining the loopback interface and one Ethernet interface connected to a file provider is defined as follows:
#include "lwip_config.h"
struct _lwip_config __lwip_config = { .version = VERSION_LWIP_CONFIGURABLES, .interfaces = { { .mode = MODE_LOOPBACK, .ifname = "lo" }, { .mode = MODE_ETH, .ifname = "i1", .dev.eth.device = "/ssw/eth0:1", .mtu = 1500,
.enable_ipv4 = 1,
.target_ip = { 192, 168, 0, 2 },
.netmask = { 255, 255, 255, 0 },
.gateway_ip = { 192, 168, 0, 1 }
.enable_ipv6 = 0,
},
{ .mode = MODE_NONE, .ifname = "i2" },
{ .mode = MODE_NONE, .ifname = "i3" },
{ .mode = MODE_NONE, .ifname = "i4" },
{ .mode = MODE_NONE, .ifname = "i5" }
},
.nameservers = {
{ .server_ip = { 0, 0, 0, 0 } },
{ .server_ip = { 0, 0, 0, 0 } },
{ .server_ip = { 0, 0, 0, 0 } },
{ .server_ip = { 0, 0, 0, 0 } }
}
};
Note: Name servers are queried in ascending order along the nameservers array.
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
10 The lwIP Port to the PikeOS POSIX Personality
2.4.1.2 Properties
lwIP configuration parameters can also be set in the application’s property section using path prop:/app///lwIP/. The Project Configurator allows modification of configuration items for each one of the six interface supported by lwIP in an integration project. The default configuration shown above can be represented in the application property configuration as follows:
<prop_dir name="app///lwIP"> <prop_dir name="interfaces"> <prop_dir name="0"> <prop_string name="Mode" data="loopback"/> <prop_string name="IFName" data="lo"/> </prop_dir> <prop_dir name="1"> <prop_string name="IFName" data="i1"/> <prop_string name="Mode" data="eth"/> <prop_string name="Device" data="/ssw/eth0:1"/> <prop_uint32 name="MTU" data="1500" /> <prop_bool name="ipv4" data="true"/> <prop_bin name="TargetIP" data="192.168.0.3"/> <prop_bin name="GatewayIP" data="192.168.0.1"/> <prop_bin name="NetMask" data="255.255.255.0"/> <prop_bool name="ipv6" data="false"/> <prop_bin name="TargetIPV6_1" data="0::0"/> <prop_bin name="TargetIPV6_2" data="0::0"/> <prop_bool name="ipv6_autoconfig" data="false"/> <prop_bin name="TargetIPV6_3" data="0::0"/> </prop_dir> </prop_dir> <prop_dir name="nameservers"> <prop_dir name="0"> <prop_bin name="ServerIP" data="0.0.0.0"/> </prop_dir> <prop_dir name="1"> <prop_bin name="ServerIP" data="0.0.0.0"/> </prop_dir> <prop_dir name="2"> <prop_bin name="ServerIP" data="0.0.0.0"/> </prop_dir> <prop_dir name="3"> <prop_bin name="ServerIP" data="0.0.0.0"/> </prop_dir> </prop_dir> </prop_dir>
Note: If opening the property path containing the interface configuration is successful, lwIP will attempt to set configuration parameters for all (LWIP_NUM_IF) interfaces (prop:/app///lwIP/interfaces/[0..LWIP_NUM_IF-1]. If opening the node for an interface number fails, or the configuration for an interface is inconsistent, the interface will be silently ignored regardless of the configuration of that interface number in lwip_config.c. This procedure is similarly executed for name servers.
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
3 POSIX Applications with lwIP TCP/IP Support
The lwIP stack is configurable in many ways to adapt it to the targeted application. The main configuration file for the lwIP stack, lwipopts.h contains the full set of parameters used to influence the stack’s features and run-time resource usage. Parameters found in this file are used to size statically allocated variables in the lwIP implementation, thus it is not feasible to deliver a library suitable for a broad range of application uses. Configuration parameters are defined in $(PIKEOS_POOL_DIR)/posix/lwip/include/lwip/opt.h and can be overridden by the user in <lwipopts.h>. When modifying values, refer to the comments in both files and the documentation for further information on the respective parameter. Some parameters must be treated as invariants, they appear at the beginning of <lwipopts.h>:
Name Value
NO_SYS 0
LWIP_TIMERS 1
LWIP_TIMERS_CUSTOM 0
LWIP_MPU_COMPATIBLE 0
LWIP_COMPAT_SOCKETS 0
LWIP_POSIX_SOCKETS_IO_NAMES 0
LWIP_TCPIP_CORE_LOCKING 1
LWIP_TCPIP_CORE_LOCKING_INPUT 0
SYS_LIGHTWEIGHT_PROT 1
LWIP_HAVE_LOOPIF 1
LWIP_IPV6_NUM_ADDRESSES 4
LWIP_SINGLE_NETIF 0
ETH_PAD_SIZE 4
If symbol LWIP_DEFAULTS_FAST is set to a non-zero value (the default), some parameter values are set for increased throughput at the cost of a larger memory footprint. The following tables show default values for LWIP_DEFAULTS_FAST=1.
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
12 POSIX Applications with lwIP TCP/IP Support
3.1 Selected configuration parameters in <lwipopts.h>
3.1.1 IP Options
Name Description Default
LWIP_IPV4 Enable IP protocol version 4. 1
IP_FORWARD Enables IP packet forwarding between interfaces. 0
IP_REASSEMBLY Reassemble incoming fragmented IP packets. 1
IP_FRAG Fragment outgoing IP packets if their size exceeds 1
MTU.
IP_OPTIONS_ALLOWED If set to zero, packets with IP options are dropped. 1
If set to non-zero, packets with IP options are ac-
cepted. IP options are currently not parsed.
IP_REASS_MAXAGE IP reassembly default age in seconds. 15
IP_REASS_MAX_PBUFS Total maximum amount of pbufs waiting to be re- 96
assembled.
Reassembly may require more than one PBUF per
fragment, enabling LWIP_REASS_DEBUG may be
helpful in the analysis of problems. The default
value allows a single maximum sized UDP frame
to be reassembled.
IP_DEFAULT_TTL Default value to use in Time-To-Live field by trans- 255
port layers.
LWIP_IGMP Enable IGMP processing and multicast socket op- 1
tions, requires multicast support to be enabled in
Ethernet device driver.
LWIP_IGMP_IPV4_- Enable source-routing in IPv4. When sending data 0
SRC_ROUTE on a socket that has a local address assigned (i.e.
not INADDR_ANY) and for which no multicast inter-
face has been specified (IP_MULTICAST_IF), use
the interface the socket is bound to as outgoing in-
terface. If this option is not set, the packet is sent to
the default interface.
3.1.2 IPv6 Options
Name Description Default
LWIP_IPV6 Enable IP protocol version 6. 1
LWIP_IPV6_SCOPES Enable IPv6 address scopes. 17
LWIP_IPV6_FORWARD Enables IPv6 packet forwarding between inter- 0
faces.
LWIP_IPV6_FRAG Fragment outgoing IPv6 packets that are too big. 1
LWIP_IPV6_REASS Reassemble incoming fragmented IPv6 packets. LWIP_IPV6
IPV6_REASS_MAXAGE IP reassembly default age in seconds. 60
7
Actuallye (LWIP_IPV6 && !LWIP_SINFLE_NETIF)
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
Selected configuration parameters in <lwipopts.h> 13
Name Description Default LWIP_IPV6_SEND_- Send router solicitation messages during network 1 ROUTER_SOLICIT startup. LWIP_IPV6_AUTOCONFIG Enable stateless address auto-configuration as per LWIP_IPV6 RFC 4862. Note that this is additionally controlled by a per- interface configuration parameter. LWIP_IPV6_- Keep valid and preferred lifetimes for each * IPv6 LWIP_IPV6_AUTO- ADDRESS_LIFETIMES address. Required for LWIP_IPV6_AUTOCONFIG. CONFIG LWIP_IPV6_DUP_- Number of duplicate address detection attempts. 1 DETECT_ATTEMPTS LWIP_ICMP6 Enable ICMPv6 (mandatory per RFC). 1 LWIP_ICMP6_DATASIZE Number of bytes from original packet to send back 8 in ICMPv6 error messages. LWIP_ICMP6_H Default hop limit for ICMPv6 messages 255 LWIP_IPV6_MLD Enable multicast listener discovery protocol. LWIP_IPV6 MEMP_NUM_MLD6_GROUP Max number of IPv6 multicast groups that can be 4 joined. LWIP_ND6_QUEUEING Queue outgoing IPv6 packets while MAC address LWIP_IPV6 is being resolved. MEMP_NUM_ND6_QUEUE Max number of IPv6 packets to queue during MAC 20 resolution. LWIP_ND6_NUM_- Number of entries in IPv6 neighbor cache. 10 NEIGHBORS LWIP_ND6_NUM_- Number of entries in IPv6 destination cache. 10 DESTINATIONS LWIP_ND6_NUM_- Number of entries in IPv6 on-link prefix caches. 5 PREFIXES LWIP_ND6_NUM_ROUTERS Number of entries in IPv6 default router cache. 3 LWIP_ND6_ALLOW_- Allow Router Advertisement messages to update 1 RA_UPDATES Reachable time and retransmission timers, and netif MTU. LWIP_IPV6_DHCP Enable DHCPv6 stateful address auto- 0 configuration.
3.1.3 ARP Options
Name Description Default LWIP_ARP Enable ARP functionality. 1 ARP_TABLE_SIZE Number of active MAC-IP address pairs in ARP 10 cache. ARP_MAXAGE The time in seconds an ARP entry stays valid after 300 its last update. ARP_QUEUEING Outgoing packets are queued Number of active 1 MAC-IP address pairs in ARP cache. QRP_QUEUE_LEN Number of outgoing ARP packets queued. 3
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
14 POSIX Applications with lwIP TCP/IP Support
3.1.4 ICMP Options
Name Description Default
ICMP_DEFAULT_TTL Default value to use in Time-To-Live field for ICMP IP_DEFAULT_TTL
packets.
LWIP_BROADCAST_PING Respond to broadcast pings. 0
LWIP_MULTICAST_PING Respond to multicast pings. 0
3.1.5 RAW Options
Name Description Default
LWIP_RAW Enable application to hook into the IP layer (RAW 0
sockets).
RAW_TTL Default value to use in Time-To-Live field for ICMP IP_DEFAULT_TTL
packets.
3.1.6 UDP Options
Name Description Default
LWIP_UDP Enable UDP protocol. 1
LWIP_UDPLITE Enable UDP-Lite (requires LWIP_UDP). 0
UDP_TTL Default value to use in Time-To-Live field for UDP IP_DEFAULT_TTL
packets.
LWIP_NETBUF_RECVINFO Append destination address and port to every net- 0
buf.
3.1.7 DHCP Options
Name Description Default
LWIP_DHCP Enable DHCP module. 1
LWIP_DHCP_MAX_- Request DNS servers with discover/select, servers DNS_MAX_SERVERS
DNS_SERVERS up to the configured limit defined here is passed to
the DNS module.
3.1.8 DNS Options
Name Description Default
LWIP_DNS Enable DNS module. UDP must be available for 1
DNS.
DNS_MAX_SERVERS Not configurable, set to an internal constant. N/A
DNS_LOCAL_HOSTLIST Along with DNS_LOCAL_HOSTLIST_IS_DY- 1
NAMIC and DNS_PATH_HOSTS implements a
local host-to-address conversion list
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
Selected configuration parameters in <lwipopts.h> 15
Name Description Default DNS_LOCAL_HOSTLIST- If set enables a dynamic host-to-address list. 1 _IS_DYNAMIC DNS_PATH_HOSTS Defines path to a host database file in hosts(5) for- "/rfs/etc/hosts" mat. The file is read once during DNS initialization. Requires DNS_LOCAL_HOSTLIST and DNS_LO- CAL_HOSTLIST_IS_DYNAMIC to be enabled. Note that alias names for a host consume ad- ditional entries in the local host list, consider that when dimensioning MEMP_NUM_LOCAL- HOSTLIST MEMP_NUM_LOCAL- The number of host entries in the local host list if 32 HOSTLIST DNS_LOCAL_HOSTLIST_IS_DYNAMIC==1.
3.1.9 TCP Options
Name Description Default LWIP_TCP Enable TCP protocol. 1 TCP_TTL Default value to use in Time-To-Live field for TCP IP_DEFAULT_TTL packets. TCP_WND TCP receive windows size, maximum value is 65000 65535. TCP_MAXRTX Maximum number of retransmissions of data seg- 12 ments. TCP_SYNMAXRTX Maximum number of retransmissions of SYN seg- 6 ments (during connection establishment). TCP_QUEUE_OOSEQ Controls if TCP should queue segments that arrive LWIP_TCP out of order. Set to 1 if enough protocol buffers allocated, otherwise set to 0. TCP_MSS TCP maximum segment size. 1460 When using large MTU values, increase this value to actually make use of the interface capabilities. TCP_CALCU- Setting this to 1 enables code that checks 1 LATE_EFF_SEND_MSS TCP_MSS against the MTU of the network inter- face used for a connection and limits the MSS if it would be too big otherwise. TCP_SND_BUF TCP send buffer space. 65535
3.1.10 Checksum Options
Name Description Default CHECKSUM_GEN_IP Generate checksum for outgoing IP packets. 1 CHECKSUM_GEN_UDP Generate checksum for outgoing UDP packets. 1 CHECKSUM_GEN_TCP Generate checksum for outgoing TCP packets. 1 CHECKSUM_GEN_ICMP Generate checksum for outgoing ICMP packets. 1 CHECKSUM_GEN_ICMP6 Generate checksum for outgoing ICMP6 packets. 1
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
16 POSIX Applications with lwIP TCP/IP Support
Name Description Default
CHECKSUM_CHECK_IP Verify checksum of incoming IP packets. 1
CHECKSUM_CHECK_UDP Verify checksum of incoming UDP packets. 1
CHECKSUM_CHECK_TCP Verify checksum of incoming TCP packets. 1
CHECKSUM_CHEK_ICMP Verify checksum for incoming ICMP packets. 1
CHECKSUM_CHEK_ICMP6 Verify checksum for incoming ICMP6 packets. 1
LWIP_CHECKSUM_- Calculate checksum when copying data from appli- 1
ON_COPY cation buffers to pbufs.
3.1.11 Thread Options
Name Description Default
DEFAULT_THREAD_STACK- Stack size used for internal threads for which no a 128 KiB
SIZE stacksize of zero is specified.
TCPIP_THREAD_PRIO Thread priority for TCP/IP protocol thread. 20
TCPIP_THREAD_NAME Name given to the TCP/IP protocol thread. "tcpip"
TCPIP_THREAD_STACK- Stack size for TCP/IP protocol thread. 0
SIZE
ETHIF_THREAD_PRIO Thread priority for Ethernet interface input thread. 20
ETHIF_THREAD_NAME Name given to Ethernet interface input threads. "netif"
The name will be concatenated with the interface
name defined in the interface configuration (see
section section 2.4, page 7).
ETHIF_THREAD_STACK- Stack size for Ethernet interface input threads. 0
SIZE
3.1.12 Memory Options
Name Description Default
MEM_LIBC_MALLOC Use memory allocator from C library instead of the 1
internal lwIP allocator.
MEM_SIZE Only relevant if MEM_LIBC_MALLOC is set to zero. 12000
Size of lwIP heap memory. Protocol buffers will be
allocated from this pool. If the application will send
a lot of data, this should be set high.
MEMP_MEM_MALLOC Use memory allocator from C library instead of the 0
internal lwIP pool allocator.
3.1.13 Memory Pool Sizes
Name Description Default
MEMP_NUM_PBUF Number of protocol data (PDU) buffers. If the ap- 64
plication will send a lot of data, this should be set
high.
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
Selected configuration parameters in <lwipopts.h> 17
Name Description Default MEMP_NUM_RAW_PCB Number of raw connection protocol control blocks. 16 One per active "raw connection". Only relevant if LWIP_RAW is set. MEMP_NUM_UDP_PCB Number of UDP control blocks. One per active 16 “UDP connection". Only relevant if LWIP_UDP is set. MEMP_NUM_TCP_PCB Number of TCP control blocks. One per active TCP 16 connection. Only relevant if LWIP_TCP is set. MEMP_NUM_TCP_- Number of listening TCP connections. Only rele- 16 PCB_LISTEN vant if LWIP_TCP is set. MEMP_NUM_REASSDATA Number of simultaneously IP packets queued for 5 reassembly. MEMP_NUM_FRAG_PBUF Number of IP fragments simultaneously sent. 15 MEMP_NUM_TCP_SEG Number of simultaneously queued TCP segments. (2PBUF_POOL_SIZE)/3 Only relevant if LWIP_TCP is set. MEMP_NUM_ARP_QUEUE Number of simultaneously queued outgoing pack- 30 ets (pbufs) waiting for an ARP requests. Only rele- vant if ARP_QUEUEING is set. MEMP_NUM_NETBUF Used amongst others by socket API to hand over (2PBUF_POOL_SIZE)/3 data to the protocol layers. Each API call (send(), recv()) uses one of while it is active. MEMP_NUM_NETCONN Allocate one per active TCP or UDP connection. 32 MEMP_NUM_TCPIP_- Used by socket API to communicate with TCP/IP 32 MSG_API stack for bind(), connect(), accept(), listen() and other calls including send() and recv(). MEMP_NUM_TCPIP_- Number of messages used by communication be- (2*PBUF_POOL_SIZE)/3 MSG_INPKT tween Ethernet input thread(s) and TCP/IP thread. MEMP_NUM_IGMP_GROUP Number of multicast groups. Only relevant if 48 LWIP_IGMP is set. PBUF_POOL_SIZE Number of buffers in the protocol buffer pool. For 512 high bandwidth applications set this high.
3.1.14 Debugging and Diagnostics Options
Name Description Default LWIP_NOASSERT If defined, disables all run-time assertion checks. undefined LWIP_DEBUG If defined, enables debugging and trace code. undefined LWIP_DBG_MIN_LEVEL Minimum debug level of enabled debug messages LWIP_DBG_LEVEL_ALL printed. Possible values are LWIP_DBG_LEVEL_ALL, LWIP_DBG_LEVEL_WARNING, LWIP_DBG_LEVEL_SERIOUS, LWIP_DBG_LEVEL_SEVER. LWIP_DBG_TYPES_ON A mask to further subset debug messages. LWIP_DBG_ON ETHARP_DEBUG Enable debugging in ARP handling (etharp.c). LWIP_DBG_OFF
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
18 POSIX Applications with lwIP TCP/IP Support
Name Description Default
NETIF_DEBUG Enable debugging in netif.c. LWIP_DBG_OFF
PBUF_DEBUG Enable debugging in pbuf.c. LWIP_DBG_OFF
API_LIB_DEBUG Enable debugging in api_lib.c. LWIP_DBG_OFF
API_MSG_DEBUG Enable debugging in api_msg.c. LWIP_DBG_OFF
SOCKETS_DEBUG Enable debugging in sockets.c. LWIP_DBG_OFF
ICMP_DEBUG Enable debugging in icmp.c. LWIP_DBG_OFF
IGMP_DEBUG Enable debugging in igmp.c. LWIP_DBG_OFF
INET_DEBUG Enable debugging in inet.c. LWIP_DBG_OFF
IP_DEBUG Enable debugging for IP. LWIP_DBG_OFF
IP_REASS_DEBUG Enable debugging in ip4_frag.c for both fragmenta- LWIP_DBG_OFF
tion and reassembly.
RAW_DEBUG Enable debugging in raw.c. LWIP_DBG_OFF
MEM_DEBUG Enable debugging in mem.c. LWIP_DBG_OFF
MEMP_DEBUG Enable debugging in memp.c. LWIP_DBG_OFF
SYS_DEBUG Enable debugging in sys.c. LWIP_DBG_OFF
TIMERS_DEBUG Enable debugging in timers.c. LWIP_DBG_OFF
TCP_DEBUG Enable debugging for TCP. LWIP_DBG_OFF
TCP_INPUT_DEBUG Enable debugging in tcp_in.c for incoming debug. LWIP_DBG_OFF
TCP_FR_DEBUG Enable debugging in tcp_in.c for fast retransmit. LWIP_DBG_OFF
TCP_RTO_DEBUG Enable debugging in TCP for retransmit LWIP_DBG_OFF
TCP_CWND_DEBUG Enable debugging for TCP congestion window. LWIP_DBG_OFF
TCP_WND_DEBUG Enable debugging in tcp_in.c for window updating. LWIP_DBG_OFF
TCP_OUTPUT_DEBUG Enable debugging in tcp_out.c output functions. LWIP_DBG_OFF
TCP_RST_DEBUG Enable debugging for TCP with the RST message. LWIP_DBG_OFF
TCP_QLEN_DEBUG Enable debugging for TCP queue lengths. LWIP_DBG_OFF
UDP_DEBUG Enable debugging in UDP. LWIP_DBG_OFF
TCPIP_DEBUG Enable debugging in tcpip.c. LWIP_DBG_OFF
DHCP_DEBUG Enable debugging in dhcp.c. LWIP_DBG_OFF
DNS_DEBUG Enable debugging for DNS. LWIP_DBG_OFF
IP6_DEBUG Enable debugging for IPv6. LWIP_DBG_OFF
DHCP6_DEBUG Enable debugging in dhcp6.c. LWIP_DBG_OFF
ARCH_DEBUG Enable debugging for architecture layer. LWIP_DBG_OFF
3.2 The Default lwIP Library
When a POSIX application project is configured to use lwIP, a predefined library is used in the ap- plication link stage by default. The default library located is built using the <lwipopts.h> parame- ters found in $PIKEOS_POOL_DIR/posix/lwip/include/opts/lwipopts.h, the library is located in $PIKEOS_POOL_DIR/posix/lwip/lib/liblwip.a. The project build environment includes the directory of the parameter file in the preprocessor search path, thus application code can include the parameter files using:
#include <lwipopts.h>
Note: Application writers are encouraged to verify that the parameters used for the default library fit their applica- tion requirements, especially with respect to number of protocol control blocks (i.e. sockets).
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
Building a Customized lwIP Library 19
3.3 Building a Customized lwIP Library
For applications which can not use the default library, the application developer first has to configure and build the lwIP library for this particular application. This is achieved by the following steps.
-
Clone the lwip-build project.
$ /opt/pikeos-D5.0/bin/pikeos-cloneproject
--target=_--pool=
/opt/pikeos-D5.0/demo/posix/lwip-build lwip-build -
Configure library
$ cd lwip-build $ $EDITOR lwipopts.h
-
Build library
$ make
The result of the above steps is a lwIP library liblwip.a customized for a specific application controlled by the parameters in lwipopts.h. There are two options to make use of this customized library in application projects:
Use parameter Customized lwIP (POSIX_LWIP_CUSTOM) In the application project configuration set the Customized lwIP parameter (POSIX_LWIP_CUSTOM) in the lwIP section to true. Then either copy the two files liblwip.a and lwipopts.h to the application project directory or set the Path to customized lwIP parameter (POSIX_LWIP_LIB_DIR) in that project to point to the lwip-build project.
Use the custom pool Use
$ make install
in the lwip-build project to install the customized lwIP library, header files, and application project profile
options to the custom pool. Applications configured to use the same custom pool as the lwip-build project
will use the customized lwIP instead of the default library from the PikeOS pool.
3.4 Application Code Example
To access the lwIP socket API from application code use:
/* Include lwIP library configuration. If the project is configured
-
to use the default library, this file gets included from
-
$PIKEOS_POOL_DIR/posix/lwip/include/opts, otherwise it is
-
expected to be located in the current directory. */ #include <lwipopts.h>
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
20 POSIX Applications with lwIP TCP/IP Support
#include <lwip/sockets.h> #include <lwip/inet.h> #include <stdlib.h>
int main(int argc, char **argv) { struct sockaddr_in addr; int s;
/* Initialize the lwIP stack. */
if (_lwip_init() != 0) {
fprintf(stderr, "Initialization of lwIP stack failed.\n");
exit(EXIT_FAILURE);
}
/* Do not use lwip_ prefix to access lwIP API services. */
s = socket(PF_INET, SOCK_STREAM, 0);
addr.sin_addr.s_addr = INADDR_ANY;
addr.sin_port = htons(PORT_NUMBER);
addr.sin_family = AF_INET;
bind(s, (struct sockaddr *)&addr, sizeof(addr));
/* ... */
}
A more complex example program is located in /opt/pikeos-D5.0/demo/posix/inetd-internal, it is an implementation of several internal services usually found in inetd (echo, daytime, discard, chargen).
3.5 Application Programs using lwIP Services in the Project Configurator
POSIX applications using lwIP services can be tailored using several configuration items in the project configurator in both application projects and integration projects.
3.5.1 Application Project Options
POSIX_LWIP, lwIP If enabled, includes with the default lwIP networking library in the application build.
If option lwip is enabled, more options will become available:
POSIX_LWIP_CUSTOM, Customized lwIP If enabled, the lwIP library and the lwipopts.h configura-
tion header file are taken from the application project directory (by default) instead of the standard
locations in $(PIKEOS_POOL_DIR)/posix/lwip. Refer to section 3.3, page 19 for further details
how to create a customized lwIP stack.
POSIX_LWIP_LIB_DIR, Path to customized lwIP If Customized lwIP is enabled, this parameter specifies
the path to the location of the customized lwIP stack, specifically liblwip.a and lwipopts.h. This
parameter defaults to . (dot), i.e. the application project directory.
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
Application Programs using lwIP Services in the Project Configurator 21
3.5.2 Integration Project Options
The project configuration system for integration projects contains a knob for POSIX applications that toggles between interface configuration using the Project Configurator (PikeOS properties) or interface configuration using the defaults provided by the application program. If interface configuration using PikeOS properties is selected (option "Enable lwIP" set to true), the following configuration items can be set using the Project Configurator:
LWIP_MODE_IFn, Access mode This selects the interface type. The following options are supported:
none Configures the interface as unused (MODE_NONE).
loopback Configures the interface as loopback (MODE_LOOPBACK) interface. Only one interface should
be configured to this mode (note that the Project Configurator currently cannot enforce this)
eth Configures a MODE_ETH interface. Selecting this access mode will create a dependency to an Ethernet
device and adds configuration items to reflect the I/O assignment. Furthermore the following option
in the physical interface configuration section is enabled:
LWIP_SBUF_IFn, Enable SBUF If set, enables support for SBUF mode in Ethernet device access.
port Configures a MODE_PORT interface. Selecting this access mode will enable the following options in
the physical interface configuration section:
LWIP_TXPORT_IFn, Transmit Port Path to PikeOS queuing port for Ethernet frame transmission.
This must be a legal path for the POSIX personality.
LWIP_RXPORT_IFn, Receive Port Path to PikeOS queuing port for Ethernet frame reception. This
must be a legal path for the POSIX personality.
LWIP_TX_TO_IFn, Transmit timeout Timeout parameter to use for queuing port transmit opera-
tions, the value is specified in milliseconds. A value of -1 selects infinite timeout, a value of zero
selects non-blocking mode of operation.
LWIP_MAC_IFn, MAC Address Ethernet MAC address to be used for outgoing frames.
The ports are created with message size set to 1536 and maximum number of messages set to 2 by
default.
LWIP_NAME_IFn, Name Interface name (useful to identify problems in diagnostic messages)
LWIP_MTU_IFn, MTU Maximum transmission unit of the interface
LWIP_IPV4_IFn, Enable IPv4 Enables IPv4 configuration on the interface. IPv4 configuration parameter are:
LWIP_TARGETIP_IFn, Interface address IPv4 address for the interface
LWIP_NETMASK_IFn, Netmask IP network mask for the interface.
LWIP_GATEWAY_IFn, Gateway IP Default router IPv4 address if this interface is the default interface, or
0.0.0.0 otherwise.
LWIP_IPV6_IFn, Enable IPv6 Enables IPv6 configuration on the interface. IPv6 configuration parameter are:
LWIP_TARGETIPV6_1_IFn, Interface address 1 First statically assigned interface address, or 0::0.
LWIP_TARGETIPV6_2_IFn, Interface address 2 Second statically assigned interface address, or 0::0.
LWIP_IPV6_SLAAC_IFn, Enable auto-configuration If set to true, enables stateless address auto-
configuration on the interface. If set to false, a third address can be assigned to the interface instead.
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
22 POSIX Applications with lwIP TCP/IP Support
LWIP_TARGETIPV6_3_IFn, Interface address 3 Third statically assigned interface address, or
0::0.
If the application contains a configuration which should not be overridden by properties, set the configuration option "Enable lwIP" to false. In this case, resources (e.g. queuing ports for port based network interfaces) or resource access definitions (e.g. file access permission to Ethernet drivers) have to be provided manually by the integrator. If your application uses a hosts database, you’ll have to add the file to your ROMimage, and give the required file access permissions to your application, for example:
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
4 API Reference
4.1 Reserved Identifiers
In addition to identifiers defined as reserved by “ISO C”, POSIX, the PikeOS Personality Manual: POSIX , and the functions defined in the following reference pages, this implementation defines identifiers beginning with the following prefixes as reserved:
prefix comment
lwip_ reserved for lwIP internal functions
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
24 API Reference
4.2 lwIP Initialization
4.2.1 NAME
_lwip_init – initialize the lwIP TCP/IP stack
4.2.2 SYNOPSIS
#include "lwipopts.h" #include <lwip/sockets.h>
int _lwip_init(void);
4.2.3 DESCRIPTION
Before using any of the lwIP services the stack must be initialized by calling _lwip_init(). The function creates one application thread for TCP/IP protocol operation. Furthermore, for each interface one application thread and, in case of interfaces associated with a PikeOS file provider (MODE_ETH), one device driver thread for link level access is created. _lwip_init() can be called several times, all invocations after the first time do not affect the lwIP stack state. Function _lwip_init() is not thread-safe.
4.2.4 RETURN VALUES
Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.
4.2.5 ERRORS
The following errors may be returned by these calls:
[EINVAL] An incorrect version number in the __lwip_config configuration data has been detected. [ENOSPC] Insufficient resources to allocate a semaphore. [EAGAIN] Insufficient resources to allocate a mutex. [ENOMEM] Memory allocation failed due to insufficient resources.
4.2.6 DIAGNOSTICS
If the initialization fails an error description will be printed to the diagnostics output (stderr ).
4.2.7 BUGS
The function does not signal failures to initialize network interfaces to the caller.
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
lwIP Configuration 25
4.3 lwIP Configuration
4.3.1 NAME
lwip_config.c – lwIP configuration
4.3.2 DESCRIPTION
The configuration data embedded in the library is described using struct _lwip_config defined as follows:
/* Length of an lwIP interface name (includes terminating ’\0’). / #define LWIP_IFNAME_MAX 3 / Length of pathname of network interface ports and Ethernet file providers. / #define LWIP_CONFIG_PATH_MAX 64 / Number of DNS name servers allowed to be configured. / #define LWIP_NUM_NS 4 / Number of interfaces to support. / #define LWIP_NUM_IF 6 / Number of IPv6 addresses per interface. */ #define LWIP_NUM_ADDR_IPV6 3
struct _lwip_config { /* Version identifier of the configuration record. * If an unknown version identifier is found the configuration * structure is ignored. */ unsigned version;
struct _lwip_config_if {
/* Interface types/modes supported:
* MODE_ETH PikeOS (Ethernet) file provider
* MODE_PORT PikeOS ports, set target_mac[] to unique address
* MODE_LOOPBACK Hardwired 127.1 (localhost), no further
* configuration settings required
* MODE_NONE disable/ignore interface
*/
enum i_mode { MODE_NONE, MODE_ETH, MODE_PORT, MODE_LOOPBACK } mode;
/* lwIP interface name. */
char ifname[LWIP_IFNAME_MAX];
/* Hardware address of the Ethernet interface.
* Read from file provider and updated in here for MODE_ETH,
* configure to a unique address for MODE_PORT.
*/
unsigned char target_mac[6];
/* Interface mode-dependent configuration data. */
union {
/* Configuration values for MODE_PORT. */
struct {
/* Name of Ethernet transmit port. */
char tx_port[LWIP_CONFIG_PATH_MAX];
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
26 API Reference
/* Name to Ethernet receive port. */
char rx_port[LWIP_CONFIG_PATH_MAX];
} port;
/* Configuration values for MODE_ETH. */
struct {
/* Path to the Ethernet file provider. */
char device[LWIP_CONFIG_PATH_MAX];
} eth;
} dev;
/* Interface MTU */
unsigned mtu;
/* IPv4 configuration. */
/* Flag, if non-zero attempt IPv4 configuration. */
int enable_ipv4;
/* "Target" IP address. */
unsigned char target_ip[4];
/* Netmask. */
unsigned char netmask[4];
/* Default route (gateway) IP address, or ’0.0.0.0’ if not
* the default interface.
*/
unsigned char gateway_ip[4];
/* IPv6 configuration. */
/* Flag, if non-zero attempt IPv6 configuration. */
int enable_ipv6;
/* "Target" IPv6 addresses, up to three per interface.
* A link-local address is always added, the number of
* addresses used is limited by LWIP_IPV6_NUM_ADDRESSES.
* all-zero address values are ignored.
*/
unsigned char target_ipv6[LWIP_NUM_ADDR_IPV6][16];
/*
* Flag, if non-zero attempt stateless address
* auto-configuration (SLAAC).
* If target_ipv6[] contains LWIP_NUM_ADDR_IPV6 non-zero
* addresses, then auto-configuration will not be started.
*/
int enable_auto_config;
/* Write timeout for queuing port based interfaces in milliseconds.
* A value of zero configures non-blocking operation, a value
* of ((unsigned)-1) configures infinite timeout. If
*/
unsigned int tx_to;
} interfaces[LWIP_NUM_IF];
struct _lwip_config_ns {
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
lwIP Configuration 27
/* DNS name server IP address. */
unsigned char server_ip[4];
} nameservers[LWIP_NUM_NS];
};
The following is an example for the configuration data included in the PikeOS property file system.
<prop_dir name="app/posix/posix/lwIP"> <prop_dir name="interfaces">
<prop_dir name="0">
<prop_string name="Mode" data="loopback"/>
</prop_dir>
<prop_dir name="1">
<prop_string name="IFName" data="i1"/>
<prop_string name="Mode" data="eth"/>
<prop_string name="Device" data="/ssw/eth0:1"/>
<prop_uint32 data="1500" name="MTU"/>
<prop_bool name="ipv4" data="true"/>
<prop_bin name="TargetIP" data="192.168.0.3"/>
<prop_bin name="GatewayIP" data="192.168.0.1"/>
<prop_bin name="NetMask" data="255.255.255.0"/>
<prop_bool name="ipv6" data="true"/>
<prop_bin name="TargetIPV6_1" data="2001:0db8::C0A8:0003"/>
<prop_bin name="TargetIPV6_2" data="0::0"/>
<prop_bool name="ipv6_autoconfig" data="true"/>
<prop_bin name="TargetIPV6_3" data="0::0"/>
</prop_dir>
<prop_dir name="3">
<prop_string name="IFName" data="i3"/>
<prop_string name="Mode" data="port"/>
<prop_string name="TX" data="/qport/LWIP-IF3-tx"/>
<prop_string name="RX" data="/qport/LWIP-IF3-rx"/>
<prop_bin name="TargetMAC" data="00:04:9f:00:0a:f0"/>
<prop_uint32 data="1500" name="MTU"/>
<prop_bool name="ipv4" data="true"/>
<prop_bin name="TargetIP" data="10.0.0..1"/>
<prop_bin name="GatewayIP" data="0.0.0.0"/>
<prop_bin name="NetMask" data="255.0.0.0"/>
<prop_bool name="ipv6" data="false"/>
</prop_dir>
</prop_dir> <prop_dir name="nameservers"> <prop_dir name="1"> <prop_bin name="ServerIP" data="8.8.8.8"/> </prop_dir >
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
28 API Reference
</prop_dir> </prop_dir>
When using multiple interfaces with the lwIP stack, a default interface is identified by the value of the gateway_ip address assigned to that interface. Set a value of 0.0.0.0 for all interfaces except the default interface.
4.3.3 FILES
lwip_config.c located in the demo/posix/lwip-build project.
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
Network Host Entry 29
4.4 Network Host Entry
4.4.1 NAME
gethostbyname, gethostbyaddr, herror, hstrerror – get network host entry
4.4.2 SYNOPSIS
#include <lwip/netdb.h>
extern int h_errno;
struct hostent * gethostbyname(const char *name);
struct hostent * gethostbyaddr(const char *addr, int len, int type);
void herror(const char *string);
const char * hstrerror(int err);
4.4.3 DESCRIPTION
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. The name argument passed to gethostbyname() should point to a NUL-terminated hostname. The addr argument passed to gethostbyaddr() should point to an address which is len bytes long, in binary form (i.e., not an IP address in human readable ASCII form). The type argument specifies the address family (e.g. AF_INET, AF_INET6, etc.) of this address. The structure returned contains the information obtained from broken-out fields from a line in /rfs/etc/hosts (or DNS_PATH_HOSTS, or from an external name server if at least one server IP address is configured. A name server is tried only if a host cannot be resolved through /etc/hosts.
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int 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 */
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
30 API Reference
The members of this structure are:
h_name Official name of the host.
h_aliases A NULL-terminated array of alternate names for the host.
h_addrtype The type of address being returned; usually AF_INET.
h_length The length, in bytes, of the address.
h_addr_list A NULL-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.
The herror() function writes a message to the diagnostic output consisting of the string argument string, the constant string ": ", and a message corresponding to the value of h_errno. The hstrerror() function returns a string which is the message text corresponding to the value of the err argument.
4.4.4 FILES
/rfs/etc/hosts the default value of the DNS_PATH_HOSTS lwIP configuration parameter.
4.4.5 EXAMPLES
Print out the hostname associated with a specific IP address:
const char *ipstr = "127.0.0.1";
struct in_addr ip;
struct hostent *hp;
if (!inet_aton(ipstr, &ip))
errx(1, "can’t parse IP address %s", ipstr);
if ((hp = gethostbyaddr((const char *)&ip,
sizeof ip, AF_INET)) == NULL)
errx(1, "no name associated with %s", ipstr);
printf("name associated with %s is %s\n", ipstr, hp->h_name);
4.4.6 DIAGNOSTICS
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 routine herror() can be used to print an error message describing the failure. If its argument string is non-NULL, it is printed, followed by a colon and a space. The error message is printed with a trailing newline.
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
Network Host Entry 31
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 or that dynamic resources cannot be allocated. 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.
4.4.7 CAVEAT
These functions use a thread-specific data storage; if the data is needed for future use, it should be copied before any subsequent calls overwrite it. Resolution by address through a name server is currently not supported. If an IP address cannot be re- solved through /etc/hosts and a name server is configured, gethostbyaddr() returns a NULL pointer and sets h_errno to HOST_NOT_FOUND.
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
32 API Reference
4.5 Host Name Data Base
4.5.1 NAME
hosts – host name data base
4.5.2 DESCRIPTION
The hosts file contains information regarding the known hosts on the network. For each host a single line should be present with the following information:
• Internet address
• Official host name
• Host name aliases
Items are separated by any number of blanks and/or tab characters. A “#” indicates the beginning of a comment; characters up to the end of the line are not interpreted by routines which search the file. The current implementation does not support an external name server, thus the information found in the host name data base is authoritative. Network addresses are specified in the conventional “.” (dot) notation for IPv4 addresses or “:” (colon) for IPv6 addresses. Host names may contain any printable character other than a field delimiter, newline, or comment character.
4.5.3 FILES
/rfs/etc/hosts the default value of the DNS_PATH_HOSTS lwIP configuration parameter.
4.5.4 SEE ALSO
gethostbyname(), gethostbyaddr()
4.5.5 CAVEAT
Each host alias name consume one entry in the local host list (see also parameter MEMP_NUM_LOCALHOSTLIST in section 3.1.8, page 14).
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
Host Name 33
4.6 Host Name
4.6.1 NAME
gethostname – get name of current host
4.6.2 SYNOPSIS
#include <unistd.h>
int gethostname(char *name, size_t namelen);
4.6.3 DESCRIPTION
The gethostname() function returns the standard host name for the current partition, as previously set by ap- plication configuration. The namelen argument specifies the size of the name array. The returned name is null-terminated unless insufficient space is provided. Host names are limited to {HOST_NAME_MAX} characters, not including the trailing null, currently 255. gethostname() is actually implemented in the POSIX OS. Its description is included here for easier reference.
4.6.4 FILES
posix_config.c, POSIX configuration properties
4.6.5 RETURN VALUES
Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.
4.6.6 ERRORS
The following errors may be returned by these calls:
[ENAMETOOLONG] The current host name is longer than namelen.
4.6.7 SEE ALSO
PikeOS Personality Manual: POSIX
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
5 Release Information
5.1 Thread-safety
The lwIP socket API is not thread-safe. Simultaneous operations on the same socket from multiple threads may lead to undefined behavior. Using multiple threads operating each on a separate socket is supported.
5.2 Supported Operation Modes
This release of the lwIP port to the PikeOS POSIX personality was tested and is limited to:
• IPv6 only, IPv4 only, IPv4 and IPv6 dual-mode
• Officially supported API is the lwIP socket API access through the wrappers implemented in the POSIX file
system layer pikeos/misc/lwip.c.
• Officially supported lwIP features are defined by the configuration settings in <lwipopts.h> included in
the PikeOS product distribution.
5.3 Notable Differences to other TCP/IP Implementations
lwIP uses a non-standard include file hierarchy. Function getaddrinfo() only supports strings with decimal port numbers, named services are not supported. Function shutdown() is a no-op by default. Setting the <lwipopts.h> parameter LWIP_SHUTDOWN_NOOP to zero configures the function to always disable further send and receives operations, despite the type of shutdown specified in a call. Applications should not attempt to execute any operation on a socket that has been locally shut down, except for close. Functions sendto(), send(), recv(), and recvfrom() do not support the full set of values for the flags argument found on other implementations. Depending on configuration values in <lwipopts.h>, the setsockopt() and getsockopt() functions may not support the full set of options found on other implementations. Most notably, setting of socket receive buffers sizes depends on LWIP_SO_RCVBUF and socket timeouts depends on LWIP_SO_RCVTIMEO.
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
6 Copyright notes
This package is based on lwIP, the a light-weight implementation of the TCP/IP protocol suite that was originally written by Adam Dunkels8 of the Swedish Institute of Computer Science9 . It is released under the following copyright.
Copyright (c) 2001, 2002 Swedish Institute of Computer Science. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- 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.
- The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ‘‘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 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.
Parts of this package contain code imported from the FreeBSD10 operating system released under the following copyrights.
Copyright (c) 1985, 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:
-
Redistributions of source code must retain the above copyright 8 http://www.sics.se/~adam 9 http://www.sics.se/ 10 http://www.FreeBSD.org
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
36 Copyright notes
notice, this list of conditions and the following disclaimer.
- 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.
- 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.
- 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 (c) 1994, Garrett Wollman
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved. 37
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.
THIS SOFTWARE IS PROVIDED BY THE 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) 1996 by Internet Software Consortium.
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.
THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE CONSORTIUM 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 (C) 2005 The FreeBSD Project. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- 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.
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 REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.
38 Copyright notes
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.
Parts of this package contain code imported from the NetBSD11 operating system released under the following copyrights.
/*
- Copyright 2001 Wasabi Systems, Inc.
- All rights reserved.
- Written by Simon Burge and Eduardo Horvath for Wasabi Systems, Inc.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 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.
-
- All advertising materials mentioning features or use of this software
- must display the following acknowledgement:
-
This product includes software developed for the NetBSD Project by -
Wasabi Systems, Inc. -
- The name of Wasabi Systems, Inc. may not be used to endorse
- or promote products derived from this software without specific prior
- written permission.
- THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ‘‘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 WASABI SYSTEMS, INC
- 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. */
c Copyright 2005 – 2019 SYSGO GmbH, all rights reserved.