Skip to content
Nick Andrews edited this page Mar 5, 2026 · 5 revisions

AROSTCP -- Miami Compatibility Library (miami.library)

This document covers the Miami compatibility layer that allows applications written for the Miami TCP/IP stack to run on AROSTCP. The Miami library acts as a wrapper, opening bsdsocket.library internally and delegating most calls to the core stack.

For AmiTCP core stack and protocols, see aros-wiki-arostcp.md. For Roadshow bsdsocket.library extensions (slots 51-138), see aros-wiki-arostcp-roadshow.md.

Last updated against codebase: March 2026.

Primary source files:

  • api/miami_api.c (~2000 lines) -- All Miami AROS_LH function implementations
  • api/miami_functable.c -- Function dispatch table (60 user slots + 4 library management)
  • api/miami_api.h -- MiamiBase structure definition

Architecture: Miami library opens are handled by Miami_Open() which creates a MiamiBase containing a pointer to the underlying SocketBase. All Miami functions receive struct MiamiBase * as the library base, and internally use #define SocketBase MiamiBase->_SocketBase to delegate to bsdsocket.library.


Complete Function Table

Library Management (ELL Table)

Slot Function Status Description
1 Open REAL Creates MiamiBase, opens bsdsocket.library
2 Close REAL Closes bsdsocket connection, frees MiamiBase
3 Expunge NOOP Standard library expunge (never called at runtime)

User Function Table (60 Slots)

Network Configuration & System Control (Slots 5-7)

Slot Function Status Description
5 MiamiSysCtl() STUB System control -- returns ENOSYS
6 SetSysLogPort() REAL Locates and sets SysLog port via FindPort()
7 QueryInterfaceTagList() REAL Query interface configuration via taglist (delegates to __QueryInterfaceTagList)

Dynamic DNS & Domain Management (Slots 9-12, 19-24)

Slot Function Status Description
9 ClearDynNameServ() REAL Clear dynamic nameserver list
10 gethostent() REAL Get next hostent from dynamic DB
11 MiamiDisallowDNS() REAL Enable/disable DNS resolution via res_state.options
12 endhostent() REAL End hostent iteration, release semaphore
19 EndDynDomain() REAL End domain iteration, unlock semaphore
20 EndDynNameServ() REAL End nameserver iteration, unlock semaphore
21 AddDynNameServ() REAL Add nameserver to dynamic list (sockaddr_in)
22 AddDynDomain() REAL Add domain to dynamic list (string)
23 sethostname() REAL Set system hostname
24 ClearDynDomain() REAL Clear dynamic domain list

Protocol & Service Enumeration (Slots 14-15)

Slot Function Status Description
14 getprotoent() REAL Get next protocol entry from NDB
15 endprotoent() REAL End protocol enumeration

Packet Filter Hooks (Slots 16-17)

Slot Function Status Description
16 MiamiPFAddHook() REAL Register packet filter hook on interface (requires ENABLE_PACKET_FILTER)
17 MiamiPFRemoveHook() REAL Unregister packet filter hook, free resources

Hardware & Network Status (Slots 13, 18, 35-36)

Slot Function Status Description
13 MiamiGetPid() REAL Returns current task pointer (FindTask)
18 MiamiGetHardwareLen() STUB Get hardware address length -- returns 0
35 MiamiIsOnline() REAL Check if interface/any interface is online (IFF_UP)
36 MiamiOnOffline() REAL Bring interface up/down via ifupdown()

SSL/TLS & SOCKS Proxy (Slots 25-26, 33)

Slot Function Status Description
25 MiamiOpenSSL() STUB SSL support -- returns NULL (no SSL; intentional)
26 MiamiCloseSSL() STUB SSL cleanup -- no-op (intentional)
33 MiamiSetSocksConn() STUB SOCKS connection setup -- returns FALSE

Address Conversion (Slots 38-40)

Slot Function Status Description
38 inet_ntop() REAL Convert network address to presentation format (IPv4/IPv6)
39 inet_aton() REAL Parse IPv4 address string to binary
40 inet_pton() REAL Parse IPv4/IPv6 address string to binary

Host Lookup (Slot 41)

Slot Function Status Description
41 gethostbyname2() REAL Lookup hostname by address family (IPv4/IPv6)

Name Resolution -- getaddrinfo Family (Slots 42-45)

Slot Function Status Description
42 gai_strerror() REAL Convert EAI_* error code to string
43 freeaddrinfo() REAL Free addrinfo chain
44 getaddrinfo() REAL Full DNS/address resolution with IPv4/IPv6, hints parsing
45 getnameinfo() REAL Reverse DNS & port-to-service lookup, NI_* flags

Interface Name Mapping (Slots 46-49)

Slot Function Status Description
46 if_nametoindex() REAL Convert interface name to index
47 if_indextoname() REAL Convert interface index to name
48 if_nameindex() REAL Get all interfaces as name/index array
49 if_freenameindex() REAL Free if_nameindex array

IPv6 & Resolver Options (Slots 50-53)

Slot Function Status Description
50 MiamiSupportsIPV6() REAL Returns TRUE if INET6 enabled, else FALSE
51 MiamiGetResOptions() REAL Get DNS resolver options (res_state.options)
52 MiamiSetResOptions() REAL Set DNS resolver options
53 sockatmark() STUB Check socket at out-of-band mark -- returns 0

CPU & Callback Support (Slots 54-56, 58)

Slot Function Status Description
54 MiamiSupportedCPUs() REAL Report supported architectures (M68K APIs/callbacks, PPC kernel)
55 MiamiGetFdCallback() REAL Get file descriptor change callback, return CPU type
56 MiamiSetFdCallback() REAL Set file descriptor change callback (M68KREG only)
58 MiamiGetCredentials() REAL Get user credentials (opens usergroup.library)

Kernel Variable Access (Slot 59)

Slot Function Status Description
59 FindKernelVar() REAL Look up kernel variable by name (mbstat, ipstat, tcb, routing tables, etc.)

Reserved / Unused Slots

Slots 4, 8, 27-32, 34, 37, 57 are Null entries (reserved or unused gaps).


Implementation Summary

Category Count Details
REAL implementations 42 Full working code
STUBS 5 MiamiSysCtl, MiamiGetHardwareLen, MiamiOpenSSL, MiamiSetSocksConn, sockatmark
Intentional NO-OPs 1 MiamiCloseSSL (no SSL to close; not a bug)
Reserved/Null slots 12 Unused gaps in function table
Total user slots 60 Slots 0-59 in Miami_UserFuncTable

Differences from Roadshow Equivalents

Several Miami functions have Roadshow counterparts in bsdsocket.library slots 100-138. These are independent implementations because of a key architectural difference:

  • Miami functions receive struct MiamiBase * and use #define SocketBase MiamiBase->_SocketBase
  • Roadshow functions receive struct SocketBase * directly

Functions with parallel implementations:

Miami Slot Roadshow Slot Function
38 100 inet_ntop
40 101 inet_pton
42 137 gai_strerror
43 135 freeaddrinfo
44 136 getaddrinfo
45 138 getnameinfo

Both implementations use the same internal functions (__inet_ntop, __inet_pton, __gethostbyname, etc.) but are compiled separately with different library base types.


Miami Remaining Backlog

  1. Implement MiamiSysCtl() (system control interface)
  2. Implement MiamiGetHardwareLen() (return interface hardware address length)
  3. Implement sockatmark() (check socket at out-of-band mark)
  4. Consider MiamiSetSocksConn() (SOCKS proxy -- low priority, rarely used)
  5. Consider SSL shim library for MiamiOpenSSL() / MiamiCloseSSL() (would need external SSL implementation)

Clone this wiki locally