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

AROSTCP -- Miami Compatibility Library (miami.library)

This document covers the Miami compatibility library 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 AROSTCP core stack.

Related pages: Core network stack · Roadshow extensions

Last updated against codebase: July 2026.

Primary source files:

  • api/miami_api.c (~1170 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 Implemented Creates MiamiBase, opens bsdsocket.library
2 Close Implemented Closes bsdsocket connection, frees MiamiBase
3 Expunge No-op 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() Implemented Locates and sets SysLog port via FindPort()
7 QueryInterfaceTagList() Implemented Query interface configuration via taglist (delegates to __QueryInterfaceTagList)

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

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

Protocol & Service Enumeration (Slots 14-15)

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

Packet Filter Hooks (Slots 16-17)

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

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

Slot Function Status Description
13 MiamiGetPid() Implemented Returns current task pointer (FindTask)
18 MiamiGetHardwareLen() Stub Get hardware address length -- returns 0
35 MiamiIsOnline() Implemented Check if interface/any interface is online (IFF_UP)
36 MiamiOnOffline() Implemented 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() Implemented Convert network address to presentation format (IPv4/IPv6)
39 inet_aton() Implemented Parse IPv4 address string to binary
40 inet_pton() Implemented Parse IPv4/IPv6 address string to binary

Host Lookup (Slot 41)

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

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

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

Interface Name Mapping (Slots 46-49)

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

IPv6 & Resolver Options (Slots 50-53)

Slot Function Status Description
50 MiamiSupportsIPV6() Implemented Returns TRUE if INET6 enabled, else FALSE
51 MiamiGetResOptions() Implemented Get DNS resolver options (res_state.options)
52 MiamiSetResOptions() Implemented 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() Implemented Report supported architectures (M68K APIs/callbacks, PPC kernel)
55 MiamiGetFdCallback() Implemented Get file descriptor change callback, return CPU type
56 MiamiSetFdCallback() Implemented Set file descriptor change callback (M68KREG only)
58 MiamiGetCredentials() Implemented Get user credentials (opens usergroup.library)

Kernel Variable Access (Slot 59)

Slot Function Status Description
59 FindKernelVar() Implemented 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
Implemented 42 Full working code
Stubs 5 MiamiSysCtl, MiamiGetHardwareLen, MiamiOpenSSL, MiamiSetSocksConn, sockatmark
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