# rdkcentral/onewifi architecture

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

- Interactive diagram: https://gitdiagram.com/rdkcentral/onewifi
- Repository: https://github.com/rdkcentral/onewifi
- Video tour (about a minute): https://gitdiagram.com/rdkcentral/onewifi/video

## Overview

#### Purpose and runtime entry
OneWifi is an RDK-B C/C++ component that centrally manages WiFi radios, VAPs, clients, security, statistics, telemetry, and optional mesh/optimization features. It runs as a system service, with SSP lifecycle/bootstrap code starting the WiFi manager and platform bus integration.
- `source/dml/wifi_ssp/ssp_main.c`
- `source/dml/wifi_ssp/ssp_loop.c`
- `scripts/onewifi.service`

#### Core orchestration and control
`wifi_mgr` owns global WiFi state, hardware capabilities, and subsystem handles. The control engine is the asynchronous boundary: northbound changes, HAL indications, timers, and app requests are queued and processed before hardware/state updates. This separates request handlers from potentially slow apply operations.
- `source/core/wifi_mgr.c`
- `source/core/wifi_ctrl.c`
- `source/core/wifi_ctrl_queue_handlers.c`

#### Northbound management interfaces
TR-181/DML exposes `Device.WiFi.*` through RBus/CCSP-facing callbacks. Cloud configuration enters through WebConfig JSON decoding, schema-specific handlers, validation, and encoding. Both paths converge on manager/database/control flows rather than directly manipulating the HAL.
- `source/dml/tr_181/ml/cosa_wifi_dml.c`
- `source/dml/dml_webconfig/dml_onewifi_api.c`
- `source/webconfig/wifi_decoder.c`

#### Configuration, persistence, and schema boundary
The database layer mediates WiFi configuration and operational state, backed by OVSDB support and cached structures. WebConfig supports distinct subdocuments for radio, private/home SSIDs, mesh, steering, telemetry-related data, and other features. Schemas are a compatibility contract with configuration producers.
- `source/db/wifi_db.c`
- `lib/ovsdb/ovsdb.c`
- `config/rdkb-wifi.ovsschema`

#### Southbound WiFi and service application
Core data-plane/control code translates normalized state into WiFi HAL operations and reacts to hardware events. VAP services encode service-specific behavior—private, public, and mesh gateway/pod/extender—rather than scattering VAP policy across the controller. The platform layer abstracts Linux, OpenWrt, RDK-B, DBus, and bus differences.
- `source/core/wifi_data_plane.c`
- `source/core/services/vap_svc.c`
- `source/platform/rdkb/bus.c`

#### Applications, measurement, and telemetry
An application manager hosts independently enabled modules such as EasyMesh, statistics monitoring, active Blaster tests, CAC, CSI/motion sensing, station management, analytics, and client steering. Statistics collection is a major outbound flow: radio/VAP/client measurements are gathered, transformed, and can use Avro/OpenSync datapipeline artifacts for telemetry.
- `source/apps/wifi_apps_mgr.c`
- `source/stats/wifi_monitor.c`
- `lib/datapipeline/dppline.c`

#### Infrastructure and dependencies
The component targets Linux-based RDK-B and OpenWrt builds, with platform-specific makefiles and deployment configuration. Material runtime integrations are WiFi HAL/hostapd-wpa_supplicant beneath the component; RBus/CCSP PSM/PandM alongside it; OVSDB for local persistence; and WebConfig, WebPA/Parodus, and telemetry services for cloud interaction. Feature flags select mesh, WiFi 7/MLO, CSI, CAC, and other app modules.
- `build/linux/makefile.common`
- `build/openwrt/Makefile_package`
- `configure.ac`

Main entry points: [`source/core/wifi_mgr.c`](https://github.com/rdkcentral/onewifi/blob/develop/source/core/wifi_mgr.c) (WiFi manager), [`source/dml/wifi_ssp/ssp_main.c`](https://github.com/rdkcentral/onewifi/blob/develop/source/dml/wifi_ssp/ssp_main.c) (SSP lifecycle), [`source/core/wifi_ctrl_queue_handlers.c`](https://github.com/rdkcentral/onewifi/blob/develop/source/core/wifi_ctrl_queue_handlers.c) (Control queue handlers), [`source/core/wifi_ctrl.c`](https://github.com/rdkcentral/onewifi/blob/develop/source/core/wifi_ctrl.c) (Async control engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Service runtime"]
  node_service["OneWifi service<br/>systemd unit<br/>[onewifi.service]"]
  node_ssp["SSP lifecycle<br/>bootstrap<br/>[ssp_main.c]"]
end

subgraph group_control["Core control"]
  node_manager{{"WiFi manager<br/>state owner<br/>[wifi_mgr.c]"}}
  node_controller["Async control engine<br/>event processor<br/>[wifi_ctrl.c]"]
  node_control_handlers["Control queue handlers<br/>apply handlers"]
  node_database[("WiFi database<br/>config and state store<br/>[wifi_db.c]")]
  node_ovsdb[("OVSDB support<br/>persistence adapter<br/>[ovsdb.c]")]
end

subgraph group_northbound["Management &amp; config"]
  node_tr181["TR-181 DML<br/>northbound API<br/>[cosa_wifi_dml.c]"]
  node_webconfig_api["WebConfig API<br/>cloud config API<br/>[dml_onewifi_api.c]"]
  node_decoder["WebConfig decoder<br/>JSON schema handlers<br/>[wifi_decoder.c]"]
  node_schema["OVSDB schema<br/>compatibility schema"]
  node_cloud["Cloud services<br/>external integration"]
end

subgraph group_southbound["Platform &amp; WiFi"]
  node_data_plane["WiFi data plane<br/>HAL translation<br/>[wifi_data_plane.c]"]
  node_vap_services["VAP services<br/>VAP policy<br/>[vap_svc.c]"]
  node_platform_bus["RDK-B platform bus<br/>platform adapter<br/>[bus.c]"]
  node_wifi_hal["WiFi HAL &amp; hostapd<br/>runtime integration"]
end

subgraph group_apps["Apps &amp; telemetry"]
  node_apps_manager{{"WiFi apps manager<br/>module host<br/>[wifi_apps_mgr.c]"}}
  node_stats["Statistics monitor<br/>measurement collector<br/>[wifi_monitor.c]"]
  node_datapipeline["Telemetry datapipeline<br/>telemetry transform<br/>[dppline.c]"]
end

node_service -->|"starts"| node_ssp
node_ssp -->|"initializes"| node_manager
node_ssp -->|"integrates"| node_platform_bus
node_tr181 -->|"management changes"| node_manager
node_webconfig_api -->|"configuration JSON"| node_decoder
node_cloud -->|"cloud configuration"| node_webconfig_api
node_decoder -->|"validated subdocuments"| node_manager
node_manager -->|"reads and writes state"| node_database
node_database -->|"persists through"| node_ovsdb
node_schema -.->|"defines data model"| node_ovsdb
node_manager -->|"dispatches control work"| node_controller
node_controller -->|"processes queued events"| node_control_handlers
node_control_handlers -->|"applies normalized state"| node_data_plane
node_data_plane -->|"HAL operations and events"| node_wifi_hal
node_control_handlers -->|"VAP service actions"| node_vap_services
node_vap_services -->|"service policy"| node_data_plane
node_apps_manager -->|"app requests"| node_controller
node_stats -->|"hosted module"| node_apps_manager
node_stats -->|"measurements"| node_datapipeline
node_datapipeline -->|"telemetry output"| node_cloud

click node_service "https://github.com/rdkcentral/onewifi/blob/develop/scripts/onewifi.service"
click node_ssp "https://github.com/rdkcentral/onewifi/blob/develop/source/dml/wifi_ssp/ssp_main.c"
click node_manager "https://github.com/rdkcentral/onewifi/blob/develop/source/core/wifi_mgr.c"
click node_controller "https://github.com/rdkcentral/onewifi/blob/develop/source/core/wifi_ctrl.c"
click node_control_handlers "https://github.com/rdkcentral/onewifi/blob/develop/source/core/wifi_ctrl_queue_handlers.c"
click node_tr181 "https://github.com/rdkcentral/onewifi/blob/develop/source/dml/tr_181/ml/cosa_wifi_dml.c"
click node_webconfig_api "https://github.com/rdkcentral/onewifi/blob/develop/source/dml/dml_webconfig/dml_onewifi_api.c"
click node_decoder "https://github.com/rdkcentral/onewifi/blob/develop/source/webconfig/wifi_decoder.c"
click node_database "https://github.com/rdkcentral/onewifi/blob/develop/source/db/wifi_db.c"
click node_ovsdb "https://github.com/rdkcentral/onewifi/blob/develop/lib/ovsdb/ovsdb.c"
click node_schema "https://github.com/rdkcentral/onewifi/blob/develop/config/rdkb-wifi.ovsschema"
click node_data_plane "https://github.com/rdkcentral/onewifi/blob/develop/source/core/wifi_data_plane.c"
click node_vap_services "https://github.com/rdkcentral/onewifi/blob/develop/source/core/services/vap_svc.c"
click node_platform_bus "https://github.com/rdkcentral/onewifi/blob/develop/source/platform/rdkb/bus.c"
click node_apps_manager "https://github.com/rdkcentral/onewifi/blob/develop/source/apps/wifi_apps_mgr.c"
click node_stats "https://github.com/rdkcentral/onewifi/blob/develop/source/stats/wifi_monitor.c"
click node_datapipeline "https://github.com/rdkcentral/onewifi/blob/develop/lib/datapipeline/dppline.c"

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_service,node_ssp toneBlue
class node_manager,node_controller,node_control_handlers,node_database,node_ovsdb toneAmber
class node_tr181,node_webconfig_api,node_decoder,node_schema,node_cloud toneMint
class node_data_plane,node_vap_services,node_platform_bus,node_wifi_hal toneRose
class node_apps_manager,node_stats,node_datapipeline toneIndigo
```

## Components

### Service runtime

- [OneWifi service](https://github.com/rdkcentral/onewifi/blob/develop/scripts/onewifi.service): systemd unit · Starts the SSP-managed WiFi component. · `scripts/onewifi.service`
- [SSP lifecycle](https://github.com/rdkcentral/onewifi/blob/develop/source/dml/wifi_ssp/ssp_main.c): bootstrap · Initializes lifecycle and platform bus integration. · `source/dml/wifi_ssp/ssp_main.c`

### Core control

- [WiFi manager](https://github.com/rdkcentral/onewifi/blob/develop/source/core/wifi_mgr.c): state owner · Owns global WiFi state, capabilities, and subsystem handles. · `source/core/wifi_mgr.c`
- [Async control engine](https://github.com/rdkcentral/onewifi/blob/develop/source/core/wifi_ctrl.c): event processor · Queues requests, indications, timers, and app actions before apply. · `source/core/wifi_ctrl.c`
- [Control queue handlers](https://github.com/rdkcentral/onewifi/blob/develop/source/core/wifi_ctrl_queue_handlers.c): apply handlers · `source/core/wifi_ctrl_queue_handlers.c`
- [WiFi database](https://github.com/rdkcentral/onewifi/blob/develop/source/db/wifi_db.c): config and state store · Mediates cached configuration and operational state. · `source/db/wifi_db.c`
- [OVSDB support](https://github.com/rdkcentral/onewifi/blob/develop/lib/ovsdb/ovsdb.c): persistence adapter · `lib/ovsdb/ovsdb.c`

### Management & config

- [TR-181 DML](https://github.com/rdkcentral/onewifi/blob/develop/source/dml/tr_181/ml/cosa_wifi_dml.c): northbound API · Exposes Device.WiFi callbacks over RBus/CCSP. · `source/dml/tr_181/ml/cosa_wifi_dml.c`
- [WebConfig API](https://github.com/rdkcentral/onewifi/blob/develop/source/dml/dml_webconfig/dml_onewifi_api.c): cloud config API · `source/dml/dml_webconfig/dml_onewifi_api.c`
- [WebConfig decoder](https://github.com/rdkcentral/onewifi/blob/develop/source/webconfig/wifi_decoder.c): JSON schema handlers · Decodes, validates, and encodes feature subdocuments. · `source/webconfig/wifi_decoder.c`
- [OVSDB schema](https://github.com/rdkcentral/onewifi/blob/develop/config/rdkb-wifi.ovsschema): compatibility schema · Defines the persisted WiFi configuration contract. · `config/rdkb-wifi.ovsschema`
- **Cloud services**: external integration · WebConfig, WebPA/Parodus, and telemetry services.

### Platform & WiFi

- [WiFi data plane](https://github.com/rdkcentral/onewifi/blob/develop/source/core/wifi_data_plane.c): HAL translation · Applies normalized state and handles hardware events. · `source/core/wifi_data_plane.c`
- [VAP services](https://github.com/rdkcentral/onewifi/blob/develop/source/core/services/vap_svc.c): VAP policy · Implements private, public, and mesh VAP behavior. · `source/core/services/vap_svc.c`
- [RDK-B platform bus](https://github.com/rdkcentral/onewifi/blob/develop/source/platform/rdkb/bus.c): platform adapter · Abstracts platform bus differences. · `source/platform/rdkb/bus.c`
- **WiFi HAL & hostapd**: runtime integration

### Apps & telemetry

- [WiFi apps manager](https://github.com/rdkcentral/onewifi/blob/develop/source/apps/wifi_apps_mgr.c): module host · Hosts optional mesh, steering, sensing, CAC, and test modules. · `source/apps/wifi_apps_mgr.c`
- [Statistics monitor](https://github.com/rdkcentral/onewifi/blob/develop/source/stats/wifi_monitor.c): measurement collector · Collects radio, VAP, and client measurements. · `source/stats/wifi_monitor.c`
- [Telemetry datapipeline](https://github.com/rdkcentral/onewifi/blob/develop/lib/datapipeline/dppline.c): telemetry transform · Transforms measurements for outbound telemetry artifacts. · `lib/datapipeline/dppline.c`

## Connections

- OneWifi service → SSP lifecycle: starts
- SSP lifecycle → WiFi manager: initializes
- SSP lifecycle → RDK-B platform bus: integrates
- TR-181 DML → WiFi manager: management changes
- WebConfig API → WebConfig decoder: configuration JSON
- Cloud services → WebConfig API: cloud configuration
- WebConfig decoder → WiFi manager: validated subdocuments
- WiFi manager → WiFi database: reads and writes state
- WiFi database → OVSDB support: persists through
- OVSDB schema → OVSDB support: defines data model
- WiFi manager → Async control engine: dispatches control work
- Async control engine → Control queue handlers: processes queued events
- Control queue handlers → WiFi data plane: applies normalized state
- WiFi data plane → WiFi HAL & hostapd: HAL operations and events
- Control queue handlers → VAP services: VAP service actions
- VAP services → WiFi data plane: service policy
- WiFi apps manager → Async control engine: app requests
- Statistics monitor → WiFi apps manager: hosted module
- Statistics monitor → Telemetry datapipeline: measurements
- Telemetry datapipeline → Cloud services: telemetry output
