# radhwanal-hajjaj/netmon architecture

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

- Interactive diagram: https://gitdiagram.com/radhwanal-hajjaj/netmon
- Repository: https://github.com/radhwanal-hajjaj/netmon

## Overview

Netmon is ESP32 firmware for discovering and classifying LAN devices, monitoring nearby Wi-Fi/Bluetooth signals, and serving a local web UI and JSON API. The main workflow is periodic subnet sweeps plus DHCP-derived names and MAC-based classification, surfaced as device and event views. Nearby scans feed radars and a signal-guided Finder; settings manage connectivity and monitoring. The README documents these capabilities, but the application entry point and most HTTP routing code are not in the supplied tree, so those links are documented relationships rather than inspected calls.

Main entry points: [`firmware/netmon/src/hw/pages.h`](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/pages.h) (Web pages and API), [`firmware/netmon/src/core/device_table.h`](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/device_table.h) (Device tracking), [`firmware/netmon/src/core/air_ble.h`](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/air_ble.h) (Bluetooth sightings), [`firmware/netmon/src/hw/air_scan.cpp`](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/air_scan.cpp) (Wi-Fi scanning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["LAN discovery"]
  node_sweep["ARP sweep<br/>[arp_scan.cpp]"]
  node_device_state["Device tracking<br/>[device_table.h]"]
  node_classification["Device classification<br/>[classify.h]"]
  node_vendor_lookup["Vendor lookup<br/>[oui_lookup.h]"]
  node_dhcp["DHCP capture<br/>[dhcp_capture.cpp]"]
  node_hostname[("Hostname cache<br/>[name_cache.h]")]
  node_events["Device events<br/>[event_log.h]"]
end

subgraph group_nearby["Nearby radio"]
  node_wifi_scan["Wi-Fi scanning<br/>[air_scan.cpp]"]
  node_wifi_air["Wi-Fi sightings<br/>[air_wifi.h]"]
  node_ble_scan["Bluetooth scanning<br/>[air_scan.cpp]"]
  node_ble_air["Bluetooth sightings<br/>[air_ble.h]"]
  node_ble_types["Bluetooth identification<br/>[ble_type.h]"]
  node_finder["Finder signals<br/>[air_find.h]"]
  node_radio_plan["Radio scheduling<br/>[air_plan.h]"]
end

subgraph group_service["Board services"]
  node_wifi_manager["Wi-Fi connection<br/>[wifi_manager.cpp]"]
  node_settings[("Settings storage<br/>[config_store.cpp]")]
  node_latency["Gateway latency<br/>[latency.cpp]"]
  node_isp["ISP lookup<br/>[isp_lookup.cpp]"]
end

subgraph group_presentation["User interface"]
  node_pages["Web pages and API<br/>[pages.h]"]
end

node_router(("LAN and router"))
node_browser(("Browser user"))
node_api_client(("API client"))
node_ip_service["IP lookup service"]

node_router -.->|"answers probes"| node_sweep
node_sweep -.->|"records sightings"| node_device_state
node_device_state -.->|"classifies state"| node_classification
node_device_state -.->|"looks up maker"| node_vendor_lookup
node_router -.->|"relays broadcasts"| node_dhcp
node_dhcp -.->|"learns names"| node_hostname
node_hostname -.->|"supplies hostnames"| node_pages
node_device_state -.->|"tracks transitions"| node_events
node_wifi_scan -.->|"records access points"| node_wifi_air
node_ble_scan -->|"queues sightings"| node_ble_air
node_ble_air -->|"classifies ads"| node_ble_types
node_wifi_air -.->|"serves radar"| node_pages
node_ble_air -.->|"serves radar"| node_pages
node_ble_types -.->|"shows device kinds"| node_pages
node_finder -.->|"shows signal guidance"| node_pages
node_radio_plan -.->|"schedules scans"| node_wifi_scan
node_radio_plan -.->|"schedules bursts"| node_ble_scan
node_settings -->|"configures connection"| node_wifi_manager
node_pages -.->|"updates settings"| node_settings
node_pages -.->|"scans networks"| node_wifi_scan
node_router -.->|"probes gateway"| node_latency
node_latency -.->|"reports latency"| node_pages
node_pages -.->|"requests lookup"| node_isp
node_isp -.->|"queries public IP"| node_ip_service
node_browser -.->|"uses pages"| node_pages
node_api_client -.->|"uses JSON API"| node_pages

click node_sweep "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/arp_scan.cpp"
click node_device_state "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/device_table.h"
click node_classification "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/classify.h"
click node_vendor_lookup "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/oui_lookup.h"
click node_dhcp "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/dhcp_capture.cpp"
click node_hostname "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/name_cache.h"
click node_events "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/event_log.h"
click node_wifi_scan "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/air_scan.cpp"
click node_wifi_air "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/air_wifi.h"
click node_ble_scan "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/air_scan.cpp"
click node_ble_air "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/air_ble.h"
click node_ble_types "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/ble_type.h"
click node_finder "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/air_find.h"
click node_radio_plan "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/air_plan.h"
click node_wifi_manager "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/wifi_manager.cpp"
click node_settings "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/config_store.cpp"
click node_latency "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/latency.cpp"
click node_isp "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/isp_lookup.cpp"
click node_pages "https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/pages.h"

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_sweep,node_device_state,node_classification,node_vendor_lookup,node_dhcp,node_hostname,node_events,node_browser,node_api_client toneBlue
class node_wifi_scan,node_wifi_air,node_ble_scan,node_ble_air,node_ble_types,node_finder,node_radio_plan toneAmber
class node_wifi_manager,node_settings,node_latency,node_isp,node_router toneMint
class node_pages toneRose
class node_ip_service toneIndigo
```

## Components

### LAN discovery

- [ARP sweep](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/arp_scan.cpp): `firmware/netmon/src/hw/arp_scan.cpp`
- [Device tracking](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/device_table.h): `firmware/netmon/src/core/device_table.h`
- [Device classification](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/classify.h): `firmware/netmon/src/core/classify.h`
- [Vendor lookup](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/oui_lookup.h): `firmware/netmon/src/core/oui_lookup.h`
- [DHCP capture](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/dhcp_capture.cpp): `firmware/netmon/src/hw/dhcp_capture.cpp`
- [Hostname cache](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/name_cache.h): `firmware/netmon/src/core/name_cache.h`
- [Device events](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/event_log.h): `firmware/netmon/src/core/event_log.h`

### Nearby radio

- [Wi-Fi scanning](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/air_scan.cpp): `firmware/netmon/src/hw/air_scan.cpp`
- [Wi-Fi sightings](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/air_wifi.h): `firmware/netmon/src/core/air_wifi.h`
- [Bluetooth scanning](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/air_scan.cpp): `firmware/netmon/src/hw/air_scan.cpp`
- [Bluetooth sightings](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/air_ble.h): `firmware/netmon/src/core/air_ble.h`
- [Bluetooth identification](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/ble_type.h): `firmware/netmon/src/core/ble_type.h`
- [Finder signals](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/air_find.h): `firmware/netmon/src/core/air_find.h`
- [Radio scheduling](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/core/air_plan.h): `firmware/netmon/src/core/air_plan.h`

### Board services

- [Wi-Fi connection](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/wifi_manager.cpp): `firmware/netmon/src/hw/wifi_manager.cpp`
- [Settings storage](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/config_store.cpp): `firmware/netmon/src/hw/config_store.cpp`
- [Gateway latency](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/latency.cpp): `firmware/netmon/src/hw/latency.cpp`
- [ISP lookup](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/isp_lookup.cpp): `firmware/netmon/src/hw/isp_lookup.cpp`

### User interface

- [Web pages and API](https://github.com/radhwanal-hajjaj/netmon/blob/main/firmware/netmon/src/hw/pages.h): `firmware/netmon/src/hw/pages.h`

### Other components

- **LAN and router**
- **Browser user**
- **API client**
- **IP lookup service**

## Connections

- LAN and router → ARP sweep: answers probes (evidence: `README.md`)
- ARP sweep → Device tracking: records sightings (evidence: `README.md`)
- Device tracking → Device classification: classifies state (evidence: `README.md`)
- Device tracking → Vendor lookup: looks up maker (evidence: `README.md`)
- LAN and router → DHCP capture: relays broadcasts (evidence: `README.md`)
- DHCP capture → Hostname cache: learns names (evidence: `README.md`)
- Hostname cache → Web pages and API: supplies hostnames (evidence: `README.md`)
- Device tracking → Device events: tracks transitions (evidence: `README.md`)
- Wi-Fi scanning → Wi-Fi sightings: records access points
- Bluetooth scanning → Bluetooth sightings: queues sightings
- Bluetooth sightings → Bluetooth identification: classifies ads (evidence: `firmware/netmon/src/core/air_ble.h`)
- Wi-Fi sightings → Web pages and API: serves radar (evidence: `README.md`)
- Bluetooth sightings → Web pages and API: serves radar (evidence: `README.md`)
- Bluetooth identification → Web pages and API: shows device kinds (evidence: `README.md`)
- Finder signals → Web pages and API: shows signal guidance (evidence: `README.md`)
- Radio scheduling → Wi-Fi scanning: schedules scans
- Radio scheduling → Bluetooth scanning: schedules bursts
- Settings storage → Wi-Fi connection: configures connection
- Web pages and API → Settings storage: updates settings (evidence: `README.md`)
- Web pages and API → Wi-Fi scanning: scans networks (evidence: `README.md`)
- LAN and router → Gateway latency: probes gateway (evidence: `README.md`)
- Gateway latency → Web pages and API: reports latency (evidence: `README.md`)
- Web pages and API → ISP lookup: requests lookup (evidence: `README.md`)
- ISP lookup → IP lookup service: queries public IP (evidence: `README.md`)
- Browser user → Web pages and API: uses pages (evidence: `README.md`)
- API client → Web pages and API: uses JSON API (evidence: `README.md`)
