PROTOCOL NOTES / 04
Transport & link kinds
Keep link kinds, requests, interfaces, endpoints, and peers separate.
Android and iOS software implemented · Apple Wi-Fi Aware, Bluetooth LE and mixing tested on hosts and emulators only · Physical qualification pending
Two link kinds, one link layer
A neighbor link is a reliable byte stream plus a datagram channel. TLS 1.3, the transport greeting, hello, control framing, authorization, hop keys and the media envelope are identical for every kind. The authenticated greeting names the kind, and a kind that differs from how the local side established the link closes it.
| Kind | Endpoints | Stream | Datagrams |
|---|---|---|---|
aware | Android ↔ Android | TCP over the Wi-Fi Aware data path | UDP over the same data path, between the ports announced in the greeting |
aware | Apple ↔ Apple, Apple ↔ Android with NAN Pairing | Network framework TCP connection to a paired device | UDP flow between the ports announced in the greeting |
ble | Any pair with BLE capability | One LE L2CAP channel, multiplexed ([BLE links](ble.md)) | Datagram frames on the same channel |
The Android Wi-Fi Aware path is implemented. The Apple Wi-Fi Aware path and Bluetooth LE links are implemented software, tested on hosts, emulators and the iOS simulator only; neither has been qualified between physical phones. The Bluetooth LE adapter owns advertising, the GATT server, scanning, L2CAP listeners and channels; one channel belongs to exactly one link.
Apple devices connect to paired devices
Apple devices open Wi-Fi Aware data paths only to devices paired with them: other Apple devices through the system pairing interface, and Android phones that support NAN Pairing. Between an Apple device and an Android phone the Apple device connects. Without a discovered advertisement it has no identity to pin, so it accepts the TLS peer under the ordinary admission rules and requires the first advert to carry the same key.
An Apple device advertises Wi-Fi Aware child capacity while it holds fewer than four Wi-Fi Aware links. It closes within 10 seconds a link it opened that has not become useful, and when two devices connect to each other at once, the link opened by the lower identity is kept and the other closed. Network framework connections, listeners and paths are owned per link, like Android sockets.
A peer is not a network interface
Android may share one Wi-Fi Aware network interface across multiple data paths. Treating the interface as though it belonged to one peer can tear down unrelated links. RWCP separates request ownership, installed bindings, local endpoints, and authenticated peer connections.
| Resource | Lifetime and identity |
|---|---|
| Aware request | Request ID and session generation; can fail or retire independently |
| Network binding | Android Network/interface scope and incarnation; reference-counted use |
| Local endpoint | Listener/UDP resources on an installed binding |
| Peer connection | Remote scoped IPv6 address, negotiated media port and authenticated identity |
Install first, acknowledge, then use
An asynchronous Android callback is not proof that a usable native path exists. Native installation acknowledges the exact request, session, and binding incarnation. Stale callbacks cannot attach a previous path to a new session. Releasing a peer drops only its own references.
Bind sockets before connecting
Sockets bind to the relevant network before listen, connect, or send. IPv6 scope IDs distinguish link-local addresses. UDP delivery is keyed by binding, scoped remote address, and the peer’s negotiated port—not IP address alone. The initiator does not create an extra listener, and the process is not globally bound to one network.
Capacity is an admission and recovery constraint
Supported data paths, pending reservations, and installed requests are distinct counts. The adapter reserves room for upstream recovery instead of evicting children. A genuine no-spare-capacity condition can select break-before-make when the current parent is unhealthy or the replacement leads to a different root; a cost-only improvement is deferred, and a generic request failure must not destroy the still-working parent.
Authority: Transport ownership and link kinds. Public examples are synthetic. This guide is maintained against the private implementation; it does not imply access to its source.