# sneha3821/rdk-wifi-hal architecture

> Architecture diagram of the GitHub repository sneha3821/rdk-wifi-hal, 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/sneha3821/rdk-wifi-hal
- Repository: https://github.com/sneha3821/rdk-wifi-hal

## Overview

#### Purpose and Build Surface
`rdk-wifi-hal` is a native C/C++ Wi-Fi Hardware Abstraction Layer implementing Wi-Fi control state machines and packet processing, including EasyConnect/DPP and Passpoint/ANQP. Autotools is the primary build integration, rooted at `configure.ac`, `Makefile.am`, and `src/Makefile.am`.

#### HAL Core and Public/Private Boundary
The central HAL implementation exposes RDK-oriented Wi-Fi operations while maintaining internal state and framework contracts. `src/wifi_hal.c` is the core implementation; `src/wifi_hal_rdk.h` and `src/wifi_hal_rdk_framework.h` define HAL/framework-facing interfaces; `src/wifi_hal_priv.h` holds internal shared definitions. Platform code is expected to supply hardware-specific behavior beneath this layer.

#### Platform Adaptation Layer
Per-target platform implementations isolate chipset, OS, and driver differences from the common HAL. Representative targets are `platform/broadcom/platform.c`, `platform/intel/platform.c`, and `platform/qualcomm/platform_xer5.c`; other targets include Banana Pi, Raspberry Pi, an emulator, and XLE. Banana Pi additionally carries OpenWrt kernel patches under `platform/banana-pi/kernel-patches_6.6/openwrt/`, indicating a kernel/driver dependency for some wireless features.

#### Linux Wi-Fi Driver and Event Integration
The common HAL communicates with Linux wireless infrastructure through nl80211 and processes asynchronous driver events. `src/wifi_hal_nl80211.c` handles nl80211 interaction, `src/wifi_hal_nl80211_events.c` maps received events into HAL behavior, and `src/wifi_hal_nl80211_utils.c` supplies shared protocol/driver utilities. This is the principal boundary to kernel Wi-Fi drivers and netlink.

#### Access-Point and Management-Frame Processing
Hostapd integration and management/data receive paths process 802.11 traffic and route it into feature-specific logic. `src/wifi_hal_hostapd.c` bridges AP daemon behavior, `src/wifi_hal_mgmt_rx.c` handles management-frame reception, and `src/wifi_hal_data_rx.c` handles data frames. `src/ieee80211.h` provides IEEE 802.11 protocol definitions used across these paths.

#### Wi-Fi Feature State Machines
Specialized modules implement higher-level Wi-Fi protocols on top of received frames, hostapd, and driver state. DPP/EasyConnect is implemented by `src/wifi_hal_dpp.c` with a separately buildable feature component in `feature_dpp/dpp.c`. Passpoint-related ANQP processing is in `src/wifi_hal_anqp.c`; WNM/RRM functionality is in `src/wifi_hal_wnm_rrm.c`. These modules form protocol-specific control and packet-processing stages rather than platform implementations.

#### IPC Server Boundary
A HAL IPC server exposes Wi-Fi HAL operations to external local consumers, separating request handling from direct hardware access. `hal_ipc/server/server_hal_ipc.c` implements server orchestration, `hal_ipc/server/hal_ipc_processors.c` dispatches/processes requests, and `hal_ipc/server/hal_ipc_wifi_wrappers.c` adapts IPC operations to Wi-Fi HAL calls. Control flow is client request → IPC processor/wrapper → common HAL → platform/driver layer.

#### Shared Data and Cryptography
Collection utilities support common in-memory data organization in `src/collection.c` and `util/collection.c`. TLV encoding/decoding is centralized in `src/wifi_tlv.c`, likely supporting protocol or IPC payloads. `util_crypto/aes_siv.c` provides AES-SIV cryptography, a dependency relevant to secure Wi-Fi protocol processing such as DPP.

Main entry points: [`src/wifi_hal.c`](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal.c) (Wi-Fi HAL core), [`src/wifi_hal_nl80211_events.c`](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_nl80211_events.c) (Driver event mapper), [`src/wifi_hal_mgmt_rx.c`](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_mgmt_rx.c) (Management RX), [`src/wifi_hal_nl80211.c`](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_nl80211.c) (nl80211 adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Build"]
  node_autotools["Autotools build<br/>build system<br/>[configure.ac]"]
end

subgraph group_hal["Common HAL"]
  node_hal_api["HAL framework API<br/>C headers<br/>[wifi_hal_rdk.h]"]
  node_hal_core["Wi-Fi HAL core<br/>C implementation<br/>[wifi_hal.c]"]
  node_tlv["TLV codec<br/>serialization<br/>[wifi_tlv.c]"]
end

subgraph group_wireless["Linux Wi-Fi Integration"]
  node_nl80211["nl80211 adapter<br/>netlink integration<br/>[wifi_hal_nl80211.c]"]
  node_nl_events["Driver event mapper<br/>event handler"]
  node_hostapd["hostapd bridge<br/>AP daemon integration<br/>[wifi_hal_hostapd.c]"]
  node_mgmt_rx["Management RX<br/>frame processor<br/>[wifi_hal_mgmt_rx.c]"]
  node_data_rx["Data RX<br/>frame processor<br/>[wifi_hal_data_rx.c]"]
  node_linux_drivers{{"Linux Wi-Fi drivers<br/>kernel boundary"}}
end

subgraph group_features["Protocol Features"]
  node_dpp_hal["DPP / EasyConnect<br/>protocol state machine<br/>[wifi_hal_dpp.c]"]
  node_dpp_component["DPP feature component<br/>feature library<br/>[dpp.c]"]
  node_anqp["Passpoint ANQP<br/>protocol processor<br/>[wifi_hal_anqp.c]"]
  node_wnm_rrm["WNM / RRM<br/>protocol processor<br/>[wifi_hal_wnm_rrm.c]"]
  node_aes_siv["AES-SIV crypto<br/>cryptography<br/>[aes_siv.c]"]
end

subgraph group_ipc["Local IPC Server"]
  node_ipc_server["IPC server<br/>server orchestration<br/>[server_hal_ipc.c]"]
  node_ipc_processors["IPC processors<br/>request dispatcher"]
  node_ipc_wrappers["HAL IPC wrappers<br/>HAL adapter"]
end

subgraph group_platforms["Platform Adaptations"]
  node_broadcom["Broadcom platform<br/>platform implementation<br/>[platform.c]"]
  node_intel["Intel platform<br/>platform implementation<br/>[platform.c]"]
  node_qualcomm["Qualcomm XER5 platform<br/>platform implementation<br/>[platform_xer5.c]"]
  node_openwrt_patches["Banana Pi kernel patches"]
end

node_autotools -->|"builds"| node_hal_core
node_autotools -->|"builds"| node_dpp_component
node_hal_api -->|"defines contract for"| node_hal_core
node_hal_core -->|"uses"| node_nl80211
node_nl80211 -->|"receives events through"| node_nl_events
node_nl80211 -->|"netlink"| node_linux_drivers
node_nl_events -->|"updates HAL behavior"| node_hal_core
node_hostapd -->|"bridges AP control"| node_hal_core
node_nl_events -->|"routes management frames"| node_mgmt_rx
node_nl_events -->|"routes data frames"| node_data_rx
node_mgmt_rx -->|"feeds protocol frames"| node_dpp_hal
node_mgmt_rx -->|"feeds queries"| node_anqp
node_mgmt_rx -->|"feeds management frames"| node_wnm_rrm
node_dpp_hal -->|"uses"| node_dpp_component
node_dpp_hal -->|"uses"| node_aes_siv
node_hal_core -->|"encodes payloads"| node_tlv
node_ipc_server -->|"forwards requests"| node_ipc_processors
node_ipc_processors -->|"dispatches"| node_ipc_wrappers
node_ipc_wrappers -->|"invokes HAL"| node_hal_core
node_hal_core -->|"delegates platform behavior"| node_broadcom
node_hal_core -->|"delegates platform behavior"| node_intel
node_hal_core -->|"delegates platform behavior"| node_qualcomm
node_broadcom -->|"accesses"| node_linux_drivers
node_intel -->|"accesses"| node_linux_drivers
node_qualcomm -->|"accesses"| node_linux_drivers
node_openwrt_patches -.->|"patches"| node_linux_drivers

click node_autotools "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/configure.ac"
click node_hal_api "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_rdk.h"
click node_hal_core "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal.c"
click node_nl80211 "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_nl80211.c"
click node_nl_events "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_nl80211_events.c"
click node_hostapd "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_hostapd.c"
click node_mgmt_rx "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_mgmt_rx.c"
click node_data_rx "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_data_rx.c"
click node_dpp_hal "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_dpp.c"
click node_dpp_component "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/feature_dpp/dpp.c"
click node_anqp "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_anqp.c"
click node_wnm_rrm "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_wnm_rrm.c"
click node_tlv "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_tlv.c"
click node_aes_siv "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/util_crypto/aes_siv.c"
click node_ipc_server "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/hal_ipc/server/server_hal_ipc.c"
click node_ipc_processors "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/hal_ipc/server/hal_ipc_processors.c"
click node_ipc_wrappers "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/hal_ipc/server/hal_ipc_wifi_wrappers.c"
click node_broadcom "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/platform/broadcom/platform.c"
click node_intel "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/platform/intel/platform.c"
click node_qualcomm "https://github.com/sneha3821/rdk-wifi-hal/blob/develop/platform/qualcomm/platform_xer5.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_autotools toneBlue
class node_hal_api,node_hal_core,node_tlv toneAmber
class node_nl80211,node_nl_events,node_hostapd,node_mgmt_rx,node_data_rx,node_linux_drivers toneMint
class node_dpp_hal,node_dpp_component,node_anqp,node_wnm_rrm,node_aes_siv toneRose
class node_ipc_server,node_ipc_processors,node_ipc_wrappers toneIndigo
class node_broadcom,node_intel,node_qualcomm,node_openwrt_patches toneTeal
```

## Components

### Build

- [Autotools build](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/configure.ac): build system · Build surface rooted in configure.ac and Makefile.am files. · `configure.ac`

### Common HAL

- [HAL framework API](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_rdk.h): C headers · Public HAL and RDK framework contracts. · `src/wifi_hal_rdk.h`
- [Wi-Fi HAL core](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal.c): C implementation · Central RDK Wi-Fi control state and operations. · `src/wifi_hal.c`
- [TLV codec](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_tlv.c): serialization · `src/wifi_tlv.c`

### Linux Wi-Fi Integration

- [nl80211 adapter](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_nl80211.c): netlink integration · `src/wifi_hal_nl80211.c`
- [Driver event mapper](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_nl80211_events.c): event handler · `src/wifi_hal_nl80211_events.c`
- [hostapd bridge](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_hostapd.c): AP daemon integration · `src/wifi_hal_hostapd.c`
- [Management RX](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_mgmt_rx.c): frame processor · `src/wifi_hal_mgmt_rx.c`
- [Data RX](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_data_rx.c): frame processor · `src/wifi_hal_data_rx.c`
- **Linux Wi-Fi drivers**: kernel boundary · Kernel wireless stack reached through netlink and platform code.

### Protocol Features

- [DPP / EasyConnect](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_dpp.c): protocol state machine · `src/wifi_hal_dpp.c`
- [DPP feature component](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/feature_dpp/dpp.c): feature library · Separately buildable DPP implementation. · `feature_dpp/dpp.c`
- [Passpoint ANQP](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_anqp.c): protocol processor · `src/wifi_hal_anqp.c`
- [WNM / RRM](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/src/wifi_hal_wnm_rrm.c): protocol processor · `src/wifi_hal_wnm_rrm.c`
- [AES-SIV crypto](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/util_crypto/aes_siv.c): cryptography · `util_crypto/aes_siv.c`

### Local IPC Server

- [IPC server](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/hal_ipc/server/server_hal_ipc.c): server orchestration · `hal_ipc/server/server_hal_ipc.c`
- [IPC processors](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/hal_ipc/server/hal_ipc_processors.c): request dispatcher · `hal_ipc/server/hal_ipc_processors.c`
- [HAL IPC wrappers](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/hal_ipc/server/hal_ipc_wifi_wrappers.c): HAL adapter · `hal_ipc/server/hal_ipc_wifi_wrappers.c`

### Platform Adaptations

- [Broadcom platform](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/platform/broadcom/platform.c): platform implementation · `platform/broadcom/platform.c`
- [Intel platform](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/platform/intel/platform.c): platform implementation · `platform/intel/platform.c`
- [Qualcomm XER5 platform](https://github.com/sneha3821/rdk-wifi-hal/blob/develop/platform/qualcomm/platform_xer5.c): platform implementation · `platform/qualcomm/platform_xer5.c`
- **Banana Pi kernel patches**: kernel patches · OpenWrt kernel/driver dependency for some wireless features.

## Connections

- Autotools build → Wi-Fi HAL core: builds
- Autotools build → DPP feature component: builds
- HAL framework API → Wi-Fi HAL core: defines contract for
- Wi-Fi HAL core → nl80211 adapter: uses
- nl80211 adapter → Driver event mapper: receives events through
- nl80211 adapter → Linux Wi-Fi drivers: netlink
- Driver event mapper → Wi-Fi HAL core: updates HAL behavior
- hostapd bridge → Wi-Fi HAL core: bridges AP control
- Driver event mapper → Management RX: routes management frames
- Driver event mapper → Data RX: routes data frames
- Management RX → DPP / EasyConnect: feeds protocol frames
- Management RX → Passpoint ANQP: feeds queries
- Management RX → WNM / RRM: feeds management frames
- DPP / EasyConnect → DPP feature component: uses
- DPP / EasyConnect → AES-SIV crypto: uses
- Wi-Fi HAL core → TLV codec: encodes payloads
- IPC server → IPC processors: forwards requests
- IPC processors → HAL IPC wrappers: dispatches
- HAL IPC wrappers → Wi-Fi HAL core: invokes HAL
- Wi-Fi HAL core → Broadcom platform: delegates platform behavior
- Wi-Fi HAL core → Intel platform: delegates platform behavior
- Wi-Fi HAL core → Qualcomm XER5 platform: delegates platform behavior
- Broadcom platform → Linux Wi-Fi drivers: accesses
- Intel platform → Linux Wi-Fi drivers: accesses
- Qualcomm XER5 platform → Linux Wi-Fi drivers: accesses
- Banana Pi kernel patches → Linux Wi-Fi drivers: patches
