# rdkcentral/wan-manager architecture

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

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

## Overview

RdkWanManager configures WAN links and maintains Internet connectivity. Interface Managers report physical-link status and configuration; WAN Manager builds virtual link/IP stacks, runs per-group selection policies and a failover policy, and configures link and IP layers through RDK components or Linux utilities. The graph includes documented configuration and protocol branches. Some connections are based on README descriptions or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`source/WanManager/wanmgr_interface_sm.c`](https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_interface_sm.c) (Interface State Machine), [`source/WanManager/wanmgr_data.h`](https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_data.h) (Runtime State), [`source/WanManager/wanmgr_policy_autowan_impl.c`](https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_policy_autowan_impl.c) (AutoWAN Selection), [`source/TR-181/middle_layer_src/wanmgr_rbus_handler_apis.c`](https://github.com/rdkcentral/wan-manager/blob/main/source/TR-181/middle_layer_src/wanmgr_rbus_handler_apis.c) (RBUS Handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_config["Data Model and Configuration"]
  node_dml_model["WAN Data Model<br/>[wanmgr_dml.h]"]
  node_dml_iface["Interface DML"]
  node_dml_dhcp["DHCP DML"]
  node_rbus["RBUS Handler"]
  node_webconfig["WebConfig<br/>[wanmgr_webconfig.c]"]
end

subgraph group_runtime["WAN Runtime"]
  node_runtime_data[("Runtime State<br/>[wanmgr_data.h]")]
  node_controller["WAN Controller"]
  node_iface_sm["Interface State Machine"]
end

subgraph group_protocols["Link and IP Configuration"]
  node_dhcp_events["DHCP Event Handling"]
  node_dhcpv4["DHCPv4 Client"]
  node_dhcpv6["DHCPv6 Client"]
  node_net_utils["Network Utilities<br/>[wanmgr_net_utils.h]"]
end

subgraph group_policy["Selection and Connectivity"]
  node_autowan["AutoWAN Selection"]
  node_failover["WAN Failover"]
  node_mape["MAP-E Support<br/>[wanmgr_mape.c]"]
  node_dslite["DS-Lite Support<br/>[wanmgr_dslite.c]"]
end

node_iface_managers(("Interface Managers"))
node_operators(("Remote Config Clients"))
node_rdk_services["RDK Network Services"]
node_linux["Linux Network Tools"]

node_iface_managers -->|"report link status"| node_controller
node_operators -->|"configure remotely"| node_rbus
node_operators -->|"configure remotely"| node_webconfig
node_dml_iface -->|"accesses state"| node_runtime_data
node_dml_dhcp -->|"uses client APIs"| node_dhcpv4
node_rbus -->|"accesses state"| node_runtime_data
node_rbus -->|"uses interface APIs"| node_iface_sm
node_controller -->|"uses state"| node_runtime_data
node_autowan -->|"uses controller"| node_controller
node_autowan -->|"coordinates interfaces"| node_iface_sm
node_autowan -->|"uses state"| node_runtime_data
node_iface_sm -->|"uses state"| node_runtime_data
node_iface_sm -->|"uses network utilities"| node_net_utils
node_iface_sm -->|"uses DHCPv4 APIs"| node_dhcpv4
node_iface_sm -->|"uses DHCPv6 APIs"| node_dhcpv6
node_iface_sm -->|"uses MAP-E support"| node_mape
node_iface_sm -->|"uses DS-Lite support"| node_dslite
node_dhcp_events -->|"uses interface APIs"| node_iface_sm
node_dhcp_events -->|"uses DHCPv6 APIs"| node_dhcpv6
node_iface_sm -.->|"configures IP layers"| node_rdk_services
node_iface_sm -.->|"configures network"| node_linux
node_failover -.->|"uses WAN state"| node_runtime_data
node_rdk_services -.->|"provides integrations"| node_iface_managers

click node_dml_model "https://github.com/rdkcentral/wan-manager/blob/main/source/TR-181/include/wanmgr_dml.h"
click node_dml_iface "https://github.com/rdkcentral/wan-manager/blob/main/source/TR-181/middle_layer_src/wanmgr_dml_iface_apis.c"
click node_dml_dhcp "https://github.com/rdkcentral/wan-manager/blob/main/source/TR-181/middle_layer_src/wanmgr_dml_dhcpv4.c"
click node_rbus "https://github.com/rdkcentral/wan-manager/blob/main/source/TR-181/middle_layer_src/wanmgr_rbus_handler_apis.c"
click node_webconfig "https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_webconfig.c"
click node_runtime_data "https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_data.h"
click node_controller "https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_controller.c"
click node_iface_sm "https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_interface_sm.c"
click node_dhcp_events "https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_dhcp_event_handler.c"
click node_dhcpv4 "https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_dhcpv4_internal.c"
click node_dhcpv6 "https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_dhcpv6_apis.c"
click node_net_utils "https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_net_utils.h"
click node_autowan "https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_policy_autowan_impl.c"
click node_failover "https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_wan_failover.c"
click node_mape "https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_mape.c"
click node_dslite "https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_dslite.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_dml_model,node_dml_iface,node_dml_dhcp,node_rbus,node_webconfig,node_operators toneBlue
class node_runtime_data,node_controller,node_iface_sm toneAmber
class node_dhcp_events,node_dhcpv4,node_dhcpv6,node_net_utils toneMint
class node_autowan,node_failover,node_mape,node_dslite toneRose
class node_iface_managers,node_rdk_services,node_linux toneIndigo
```

## Components

### Data Model and Configuration

- [WAN Data Model](https://github.com/rdkcentral/wan-manager/blob/main/source/TR-181/include/wanmgr_dml.h): `source/TR-181/include/wanmgr_dml.h`
- [Interface DML](https://github.com/rdkcentral/wan-manager/blob/main/source/TR-181/middle_layer_src/wanmgr_dml_iface_apis.c): `source/TR-181/middle_layer_src/wanmgr_dml_iface_apis.c`
- [DHCP DML](https://github.com/rdkcentral/wan-manager/blob/main/source/TR-181/middle_layer_src/wanmgr_dml_dhcpv4.c): `source/TR-181/middle_layer_src/wanmgr_dml_dhcpv4.c`
- [RBUS Handler](https://github.com/rdkcentral/wan-manager/blob/main/source/TR-181/middle_layer_src/wanmgr_rbus_handler_apis.c): `source/TR-181/middle_layer_src/wanmgr_rbus_handler_apis.c`
- [WebConfig](https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_webconfig.c): `source/WanManager/wanmgr_webconfig.c`

### WAN Runtime

- [Runtime State](https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_data.h): `source/WanManager/wanmgr_data.h`
- [WAN Controller](https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_controller.c): `source/WanManager/wanmgr_controller.c`
- [Interface State Machine](https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_interface_sm.c): `source/WanManager/wanmgr_interface_sm.c`

### Link and IP Configuration

- [DHCP Event Handling](https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_dhcp_event_handler.c): `source/WanManager/wanmgr_dhcp_event_handler.c`
- [DHCPv4 Client](https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_dhcpv4_internal.c): `source/WanManager/wanmgr_dhcpv4_internal.c`
- [DHCPv6 Client](https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_dhcpv6_apis.c): `source/WanManager/wanmgr_dhcpv6_apis.c`
- [Network Utilities](https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_net_utils.h): `source/WanManager/wanmgr_net_utils.h`

### Selection and Connectivity

- [AutoWAN Selection](https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_policy_autowan_impl.c): `source/WanManager/wanmgr_policy_autowan_impl.c`
- [WAN Failover](https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_wan_failover.c): `source/WanManager/wanmgr_wan_failover.c`
- [MAP-E Support](https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_mape.c): `source/WanManager/wanmgr_mape.c`
- [DS-Lite Support](https://github.com/rdkcentral/wan-manager/blob/main/source/WanManager/wanmgr_dslite.c): `source/WanManager/wanmgr_dslite.c`

### Other components

- **Interface Managers**
- **Remote Config Clients**
- **RDK Network Services**
- **Linux Network Tools**

## Connections

- Interface Managers → WAN Controller: report link status
- Remote Config Clients → RBUS Handler: configure remotely
- Remote Config Clients → WebConfig: configure remotely
- Interface DML → Runtime State: accesses state (evidence: `source/TR-181/middle_layer_src/wanmgr_dml_iface_apis.c`)
- DHCP DML → DHCPv4 Client: uses client APIs (evidence: `source/TR-181/middle_layer_src/wanmgr_dml_dhcpv4.c`)
- RBUS Handler → Runtime State: accesses state (evidence: `source/TR-181/middle_layer_src/wanmgr_rbus_handler_apis.c`)
- RBUS Handler → Interface State Machine: uses interface APIs
- WAN Controller → Runtime State: uses state (evidence: `source/WanManager/wanmgr_controller.c`)
- AutoWAN Selection → WAN Controller: uses controller (evidence: `source/WanManager/wanmgr_policy_autowan_impl.c`)
- AutoWAN Selection → Interface State Machine: coordinates interfaces (evidence: `source/WanManager/wanmgr_policy_autowan_impl.c`)
- AutoWAN Selection → Runtime State: uses state (evidence: `source/WanManager/wanmgr_policy_autowan_impl.c`)
- Interface State Machine → Runtime State: uses state (evidence: `source/WanManager/wanmgr_interface_sm.c`)
- Interface State Machine → Network Utilities: uses network utilities (evidence: `source/WanManager/wanmgr_interface_sm.c`)
- Interface State Machine → DHCPv4 Client: uses DHCPv4 APIs (evidence: `source/WanManager/wanmgr_interface_sm.c`)
- Interface State Machine → DHCPv6 Client: uses DHCPv6 APIs (evidence: `source/WanManager/wanmgr_interface_sm.c`)
- Interface State Machine → MAP-E Support: uses MAP-E support (evidence: `source/WanManager/wanmgr_interface_sm.c`)
- Interface State Machine → DS-Lite Support: uses DS-Lite support (evidence: `source/WanManager/wanmgr_interface_sm.c`)
- DHCP Event Handling → Interface State Machine: uses interface APIs (evidence: `source/WanManager/wanmgr_dhcp_event_handler.c`)
- DHCP Event Handling → DHCPv6 Client: uses DHCPv6 APIs (evidence: `source/WanManager/wanmgr_dhcp_event_handler.c`)
- Interface State Machine → RDK Network Services: configures IP layers
- Interface State Machine → Linux Network Tools: configures network
- WAN Failover → Runtime State: uses WAN state
- RDK Network Services → Interface Managers: provides integrations
