Skip to content

Duck Types

Muhammad Nuzaihan edited this page Aug 22, 2026 · 2 revisions

Duck Types

CDP defines four node roles (DuckType in src/Ducks/DuckTypes.h): PAPA, MAMA, LINK, DETECTOR.

MamaDuck — core mesh relay node

src/Ducks/MamaDuck.h

The workhorse of the mesh. Relays and routes packets like a PapaDuck, but doesn't require WiFi/MQTT by default, so it can run on battery-only hardware.

  • onReceiveDuckData(rxDoneCallback cb) — register a callback invoked when a packet needs to be relayed/delivered to the sketch.
  • goPublic() — skip the RREQ network-discovery phase and go operational immediately.
  • Handles decrypting encrypted_cmd/encrypted_data/sealed_uplink/group_broadcast traffic addressed to it, blindly relaying anything addressed elsewhere.
  • Maintains a small repliedIdentityTo_ set so that if a peer sends it a directed identity_announce, it replies with its own announceIdentity() once, closing the TOFU key-exchange loop within one round trip.
  • Tracks consecutiveEncryptedCmdFailures_; after 3 consecutive decrypt failures on encrypted_cmd, it re-announces its identity (in case MeshBeacon Ops has a stale key for it).

PapaDuck — gateway / sink node

src/Ducks/PapaDuck.h

The mesh's backhaul. Adds WiFi/MQTT integration on top of Mama-like relay/routing behavior, so incoming packet data can reach a broker (e.g. for MeshBeacon Ops, InfluxDB, or a custom cloud backend).

  • onReceiveDuckData(rxDoneCallback cb) — register a callback for packets received off the mesh.
  • isWifiConnected() — check current WiFi status.
  • Defaults to WiFi enabled (DuckWifi capability); can be constructed with DuckWifiNone if only local storage is needed.
  • Answers RREQ broadcasts with RREP so other Ducks can learn a route toward it.

There's also an SX1302-concentrator gateway path (a separate daemon, clusterduckd, in the meshbeacon-uplink repository) that bridges a LoRa concentrator directly to MQTT instead of running PapaDuck firmware on a single-radio board. See Radio and Regions for the uplink channel-spreading mechanism that benefits this gateway architecture.

DuckLink — leaf sensor node

src/Ducks/DuckLink.h

A pure edge/sensor node: no relay capability, minimal routing table interaction. Meant to sit at the edge of the mesh, sending data toward the backhaul (Mama/PapaDuck) without forwarding other nodes' traffic. You can build a mesh purely from Mama/PapaDucks, or add DuckLinks for a hybrid mesh with cheaper/simpler edge devices.

DetectorDuck — RSSI survey tool

src/Ducks/DetectorDuck.h

Not a data-relay node at all — a field tool for surveying signal coverage before committing to a deployment layout.

  • onReceiveRssi(rssiCallback rssiCb) — register a callback (void (*)(const int)) that receives RSSI values as they're read off the radio.
  • Only responds to ping/pong; bypasses the network-join/discovery phase entirely (run() sets it straight to NetworkState::PUBLIC).

Choosing a topology

  • Pure mesh: MamaDucks + one or more PapaDucks. Every node can relay.
  • Hybrid mesh: add DuckLinks at the edges where only origination (not relaying) is needed — cheaper/lower-power nodes.
  • Site survey: run a DetectorDuck before finalizing node placement to check RSSI coverage.

Clone this wiki locally