How mw0mwz/amitcp_ng works
Purpose and deliverables
AmiTCP_NG is a 68k AmigaOS TCP/IP stack descended from AmiTCP/IP, packaged primarily as a self-starting, Roadshow-ABI-compatible LIBS:bsdsocket.library. It also produces Roadshow-compatible network commands, an independent usergroup.library, installer assets, and optional standalone stack tooling. Core build definitions are in src/GNUmakefile, src/Smakefile, and src/amitcp_ng_glue.c.
Startup, OS integration, and library ABI
Opening bsdsocket.library is the principal runtime entry point; it initializes and hosts the stack within the Amiga shared-library lifecycle. Amiga-specific startup, configuration, logging, control, ARexx, timing, synchronization, and memory integration form the OS boundary in src/kern/amiga_main.c, src/kern/amiga_config.c, and src/lib/bsdsocket_lib.c. The public compatible ABI and library-vector dispatch are implemented under src/api/amiga_libcalls.c, src/api/amiga_libtables.c, and src/api/amiga_libcallentry.h.
Socket API and name services
Application socket calls cross from the Amiga library ABI into BSD-style socket/domain machinery. API adapters cover socket operations, send/receive, syscall-style argument handling, compatibility behavior, and resolver APIs in src/api/amiga_socket.c, src/api/amiga_sendrecv.c, and src/api/amiga_roadshow_compat.c. DNS query construction, transport, parsing, cache, and host lookup are concentrated in src/api/res_query.c, src/api/res_send.c, and src/api/dns_cache.c; local/network database integration is in src/kern/amiga_netdb.c.
Kernel networking substrate
The stack’s internal boundary uses BSD domains, protocol-switch registration, sockets, socket buffers, mbufs, and routing. Key ownership and buffering structures live in src/kern/uipc_domain.c, src/kern/uipc_socket.c, and src/kern/uipc_mbuf.c. Interface-independent network dispatch and route lookup use src/net/netisr.c, src/net/route.c, and src/net/radix.c. This is the principal control path between socket requests and protocol implementations.
IPv4, transport, and packet flow
Inbound frames enter interface code, are dispatched through network ISR handling, processed by IPv4, then delivered to ICMP/TCP/UDP/raw protocol handlers. Outbound application data moves through TCP/UDP/IP output, route selection, ARP resolution, then interface transmission. IPv4 and ICMP are in src/netinet/ip_input.c, src/netinet/ip_output.c, and src/netinet/ip_icmp.c; TCP state, input, output, timers, and SACK behavior are in src/netinet/tcp_input.c, src/netinet/tcp_output.c, and src/netinet/tcp_sack.c; UDP is in src/netinet/udp_usrreq.c.
Network-device and capture boundary
Physical networking is abstracted through Amiga SANA-II devices. Interface lifecycle/configuration and SANA request handling are in src/net/if_sana.c, src/net/sana2config.c, and src/net/sana2request.h; loopback is always available through src/net/if_loop.c. ARP bridges IPv4 routing to link-layer delivery in src/net/sana2arp.c. BPF permits filtering, capture, and injection at the frame boundary via src/net/bpf.c and src/net/bpf_filter.c.
Operations, installation, and runtime environment
Roadshow-compatible commands configure interfaces, inspect/control the stack, and provide diagnostics; representative entry points are src/tools/AddNetInterface.c, src/tools/AmiTCPControl.c, and src/tools/PacketCapture.c. Installation deploys the library, commands, startup script, database, and example SANA-II configurations through install/Install-AmiTCP_NG, install/S/Network-Startup, and install/Storage/NetInterfaces/. Docker is the material build/test infrastructure, including cross-compilation and FS-UAE/Amiberry emulator-network validation: docker/build-lib.sh, docker/run-fsuae.sh, and docker/run-amiberry.sh. Emulator runs require externally supplied licensed Amiga ROM/OS assets; DHCP, DNS servers, SANA-II drivers, and host networking are external runtime dependencies.
Main entry points: netisr.c Network dispatch & routing · bsdsocket_lib.c bsdsocket.library · ip_input.c IPv4 & ICMP · if_sana.c SANA-II interfaces
Components 19
Shared Library
Roadshow-compatible stack hosted by bsdsocket.library.
- bsdsocket.library · Primary self-starting TCP/IP stack deliverable.
src/lib/bsdsocket_lib.c - Amiga startup & OS integration · Configuration, logging, control, timing, and memory boundary.
src/kern/amiga_main.c - Roadshow ABI dispatch · Public calls and vector-table dispatch.
src/api/amiga_libcalls.c - Socket API adapters · Socket, send/receive, syscall arguments, and compatibility calls.
- DNS & netdb · Resolver transport, cache, host lookup, and network databases.
src/api/res_query.c
Network Stack
BSD socket, IPv4, transport, and device layers.
- BSD socket core · Domains, protocol registration, sockets, buffers, and mbufs.
src/kern/uipc_socket.c - Network dispatch & routing · Network ISR dispatch and route lookup.
src/net/netisr.c - IPv4 & ICMP · IPv4 input/output and ICMP processing.
src/netinet/ip_input.c - TCP / UDP / raw · TCP state/output/timers and UDP protocol handling.
src/netinet/tcp_input.c - ARP · Resolves IPv4 routes for SANA-II delivery.
src/net/sana2arp.c - SANA-II interfaces · Interface lifecycle and asynchronous device requests.
src/net/if_sana.c - Loopback interface · Always-available local network interface.
src/net/if_loop.c - BPF capture & injection · Frame filtering, capture, and injection.
src/net/bpf.c
Operations & Delivery
Commands, installation, and emulator validation.
- Roadshow-compatible commands · Configure, control, diagnose, and capture packets.
src/tools/AmiTCPControl.c - Installer & startup assets · Deploys library, commands, databases, and interface configurations.
install/Install-AmiTCP_NG - Docker build & validation · Cross-compilation and emulator-network test runners.
docker/build-lib.sh - FS-UAE / Amiberry · Requires externally supplied licensed Amiga ROM/OS assets.
docker/run-fsuae.sh
Other components
- Amiga applications · Consumers of the Roadshow socket ABI.
- SANA-II drivers & network · External drivers, DHCP/DNS services, and host networking.
Connections 24
- Amiga applications → bsdsocket.library: opens
- bsdsocket.library → Amiga startup & OS integration: initializes
- bsdsocket.library → Roadshow ABI dispatch: exports
- Roadshow ABI dispatch → Socket API adapters: dispatches calls to
- Socket API adapters → BSD socket core: uses
- Socket API adapters → DNS & netdb: exposes
- DNS & netdb → BSD socket core: uses sockets for DNS
- BSD socket core → Network dispatch & routing: sends network requests
- Network dispatch & routing → IPv4 & ICMP: dispatches packets
- IPv4 & ICMP → TCP / UDP / raw: delivers inbound traffic
- TCP / UDP / raw → IPv4 & ICMP: emits outbound packets
- IPv4 & ICMP → Network dispatch & routing: uses route lookup
- Network dispatch & routing → ARP: selects next hop
- ARP → SANA-II interfaces: resolves for transmission
- SANA-II interfaces → SANA-II drivers & network: uses
- SANA-II interfaces → Network dispatch & routing: inbound frames
- Loopback interface → Network dispatch & routing: local packet path
- BPF capture & injection → SANA-II interfaces: captures and injects frames
- Roadshow-compatible commands → bsdsocket.library: configures and controls
- Roadshow-compatible commands → BPF capture & injection: packet capture
- Installer & startup assets → bsdsocket.library: installs
- Installer & startup assets → Roadshow-compatible commands: installs
- Docker build & validation → FS-UAE / Amiberry: runs validation
- FS-UAE / Amiberry → SANA-II drivers & network: tests against