# openipc/devourer architecture

> Architecture diagram of the GitHub repository openipc/devourer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openipc/devourer
- Repository: https://github.com/openipc/devourer

## Overview

Devourer is a userspace Realtek Wi-Fi driver: an application configures and opens an adapter, then exchanges raw monitor-mode packets and radio-control operations through a common API, USB transport, and chip-specific backends. The driver also supports sensing, time coordination, hopping, and evidence-based channel migration. The README documents those capabilities; sampled sources confirm selected firmware, EFUSE, descriptor, sensing, and migration responsibilities. Many runtime call paths and unsampled backends are not shown, so their links are omitted rather than inferred.

Main entry points: [`src/jaguar1/RtlJaguarDevice.cpp`](https://github.com/openipc/devourer/blob/master/src/jaguar1/RtlJaguarDevice.cpp) (Chip backends), [`src/RtlAdapter.cpp`](https://github.com/openipc/devourer/blob/master/src/RtlAdapter.cpp) (Adapter core), [`tools/precoder/controller.py`](https://github.com/openipc/devourer/blob/master/tools/precoder/controller.py) (Adaptive controller), [`src/IRadio.h`](https://github.com/openipc/devourer/blob/master/src/IRadio.h) (Radio API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Driver API and transport"]
  node_config["Device configuration<br/>[DeviceConfig.h]"]
  node_radio_api["Radio API<br/>[IRadio.h]"]
  node_usb["USB transport<br/>[UsbTransport.cpp]"]
  node_adapter["Adapter core<br/>[RtlAdapter.cpp]"]
end

subgraph group_radio["Radio backends and setup"]
  node_backends["Chip backends"]
  node_firmware["Firmware loading"]
  node_efuse["EFUSE and power data<br/>[EepromManager.cpp]"]
  node_phy_tables["PHY tables<br/>[PhyTableLoader.cpp]"]
  node_descriptors["Chip descriptors"]
end

subgraph group_link["Link operation"]
  node_radiotap["Radiotap framing"]
  node_tx["Packet injection<br/>[TxMode.cpp]"]
  node_rx["Receive parsing<br/>[RxPacket.h]"]
  node_txpower["TX power control<br/>[TxPower.cpp]"]
  node_health["Link health<br/>[LinkHealth.cpp]"]
end

subgraph group_coord["Coordination and sensing"]
  node_hop["Adaptive hopset<br/>[HopsetAuthority.h]"]
  node_migration["Channel migration<br/>[MigResponder.h]"]
  node_survey["Channel survey<br/>[DwellExecutor.h]"]
  node_timing["Radio timing<br/>[TsfSync.h]"]
  node_sound["Sounding and reports<br/>[Sounding.h]"]
end

subgraph group_model["Link modeling"]
  node_energy["Energy model<br/>[energy_model.py]"]
  node_linkmodel["Link model<br/>[link_model.py]"]
  node_controller["Adaptive controller<br/>[controller.py]"]
end

node_application(("Host application"))

node_application -->|"configures"| node_config
node_application -->|"controls"| node_radio_api
node_radio_api -.->|"operates"| node_adapter
node_adapter -.->|"transfers over"| node_usb
node_adapter -.->|"selects"| node_backends
node_backends -.->|"loads firmware"| node_firmware
node_backends -.->|"reads calibration"| node_efuse
node_backends -.->|"configures PHY"| node_phy_tables
node_backends -.->|"uses descriptors"| node_descriptors
node_application -->|"injects frames"| node_tx
node_application -->|"receives frames"| node_rx
node_radiotap -->|"sets per-frame controls"| node_tx
node_application -->|"sets power"| node_txpower
node_application -->|"diagnoses link"| node_health
node_application -->|"adapts hopset"| node_hop
node_hop -->|"agrees with peer"| node_application
node_application -->|"coordinates channel move"| node_migration
node_application -->|"surveys channels"| node_survey
node_application -->|"synchronizes radios"| node_timing
node_application -->|"captures sounding"| node_sound
node_controller -->|"uses"| node_energy
node_controller -->|"builds link rows"| node_linkmodel

click node_config "https://github.com/openipc/devourer/blob/master/src/DeviceConfig.h"
click node_radio_api "https://github.com/openipc/devourer/blob/master/src/IRadio.h"
click node_usb "https://github.com/openipc/devourer/blob/master/src/UsbTransport.cpp"
click node_adapter "https://github.com/openipc/devourer/blob/master/src/RtlAdapter.cpp"
click node_backends "https://github.com/openipc/devourer/blob/master/src/jaguar1/RtlJaguarDevice.cpp"
click node_firmware "https://github.com/openipc/devourer/blob/master/src/jaguar1/FirmwareManager.cpp"
click node_efuse "https://github.com/openipc/devourer/blob/master/src/jaguar1/EepromManager.cpp"
click node_phy_tables "https://github.com/openipc/devourer/blob/master/src/PhyTableLoader.cpp"
click node_descriptors "https://github.com/openipc/devourer/blob/master/src/jaguar3/FrameParserJaguar3.h"
click node_radiotap "https://github.com/openipc/devourer/blob/master/src/RadiotapBuilder.cpp"
click node_tx "https://github.com/openipc/devourer/blob/master/src/TxMode.cpp"
click node_rx "https://github.com/openipc/devourer/blob/master/src/RxPacket.h"
click node_txpower "https://github.com/openipc/devourer/blob/master/src/TxPower.cpp"
click node_health "https://github.com/openipc/devourer/blob/master/src/LinkHealth.cpp"
click node_hop "https://github.com/openipc/devourer/blob/master/src/hopset/HopsetAuthority.h"
click node_migration "https://github.com/openipc/devourer/blob/master/src/chanmig/MigResponder.h"
click node_survey "https://github.com/openipc/devourer/blob/master/src/sensing/DwellExecutor.h"
click node_timing "https://github.com/openipc/devourer/blob/master/src/TsfSync.h"
click node_sound "https://github.com/openipc/devourer/blob/master/src/Sounding.h"
click node_energy "https://github.com/openipc/devourer/blob/master/tools/precoder/energy_model.py"
click node_linkmodel "https://github.com/openipc/devourer/blob/master/tools/precoder/link_model.py"
click node_controller "https://github.com/openipc/devourer/blob/master/tools/precoder/controller.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_config,node_radio_api,node_usb,node_adapter toneBlue
class node_backends,node_firmware,node_efuse,node_phy_tables,node_descriptors toneAmber
class node_radiotap,node_tx,node_rx,node_txpower,node_health toneMint
class node_hop,node_migration,node_survey,node_timing,node_sound toneRose
class node_energy,node_linkmodel,node_controller,node_application toneIndigo
```

## Components

### Driver API and transport

- [Device configuration](https://github.com/openipc/devourer/blob/master/src/DeviceConfig.h): `src/DeviceConfig.h`
- [Radio API](https://github.com/openipc/devourer/blob/master/src/IRadio.h): `src/IRadio.h`
- [USB transport](https://github.com/openipc/devourer/blob/master/src/UsbTransport.cpp): `src/UsbTransport.cpp`
- [Adapter core](https://github.com/openipc/devourer/blob/master/src/RtlAdapter.cpp): `src/RtlAdapter.cpp`

### Radio backends and setup

- [Chip backends](https://github.com/openipc/devourer/blob/master/src/jaguar1/RtlJaguarDevice.cpp): `src/jaguar1/RtlJaguarDevice.cpp`
- [Firmware loading](https://github.com/openipc/devourer/blob/master/src/jaguar1/FirmwareManager.cpp): `src/jaguar1/FirmwareManager.cpp`
- [EFUSE and power data](https://github.com/openipc/devourer/blob/master/src/jaguar1/EepromManager.cpp): `src/jaguar1/EepromManager.cpp`
- [PHY tables](https://github.com/openipc/devourer/blob/master/src/PhyTableLoader.cpp): `src/PhyTableLoader.cpp`
- [Chip descriptors](https://github.com/openipc/devourer/blob/master/src/jaguar3/FrameParserJaguar3.h): `src/jaguar3/FrameParserJaguar3.h`

### Link operation

- [Radiotap framing](https://github.com/openipc/devourer/blob/master/src/RadiotapBuilder.cpp): `src/RadiotapBuilder.cpp`
- [Packet injection](https://github.com/openipc/devourer/blob/master/src/TxMode.cpp): `src/TxMode.cpp`
- [Receive parsing](https://github.com/openipc/devourer/blob/master/src/RxPacket.h): `src/RxPacket.h`
- [TX power control](https://github.com/openipc/devourer/blob/master/src/TxPower.cpp): `src/TxPower.cpp`
- [Link health](https://github.com/openipc/devourer/blob/master/src/LinkHealth.cpp): `src/LinkHealth.cpp`

### Coordination and sensing

- [Adaptive hopset](https://github.com/openipc/devourer/blob/master/src/hopset/HopsetAuthority.h): `src/hopset/HopsetAuthority.h`
- [Channel migration](https://github.com/openipc/devourer/blob/master/src/chanmig/MigResponder.h): `src/chanmig/MigResponder.h`
- [Channel survey](https://github.com/openipc/devourer/blob/master/src/sensing/DwellExecutor.h): `src/sensing/DwellExecutor.h`
- [Radio timing](https://github.com/openipc/devourer/blob/master/src/TsfSync.h): `src/TsfSync.h`
- [Sounding and reports](https://github.com/openipc/devourer/blob/master/src/Sounding.h): `src/Sounding.h`

### Link modeling

- [Energy model](https://github.com/openipc/devourer/blob/master/tools/precoder/energy_model.py): `tools/precoder/energy_model.py`
- [Link model](https://github.com/openipc/devourer/blob/master/tools/precoder/link_model.py): `tools/precoder/link_model.py`
- [Adaptive controller](https://github.com/openipc/devourer/blob/master/tools/precoder/controller.py): `tools/precoder/controller.py`

### Other components

- **Host application**

## Connections

- Host application → Device configuration: configures
- Host application → Radio API: controls
- Radio API → Adapter core: operates
- Adapter core → USB transport: transfers over
- Adapter core → Chip backends: selects
- Chip backends → Firmware loading: loads firmware
- Chip backends → EFUSE and power data: reads calibration
- Chip backends → PHY tables: configures PHY
- Chip backends → Chip descriptors: uses descriptors
- Host application → Packet injection: injects frames
- Host application → Receive parsing: receives frames
- Radiotap framing → Packet injection: sets per-frame controls
- Host application → TX power control: sets power
- Host application → Link health: diagnoses link
- Host application → Adaptive hopset: adapts hopset
- Adaptive hopset → Host application: agrees with peer
- Host application → Channel migration: coordinates channel move
- Host application → Channel survey: surveys channels
- Host application → Radio timing: synchronizes radios
- Host application → Sounding and reports: captures sounding
- Adaptive controller → Energy model: uses (evidence: `tools/precoder/controller.py`)
- Adaptive controller → Link model: builds link rows (evidence: `tools/precoder/controller.py`)
