# latelee/hostapd architecture

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

- Interactive diagram: https://gitdiagram.com/latelee/hostapd
- Repository: https://github.com/latelee/hostapd

## Overview

This repository provides two related Wi-Fi products: wpa_supplicant, which manages client connections, and hostapd, which operates access points. The principal client workflow runs from daemon startup and network configuration through scanning, association, and WPA/EAP authentication; the AP side starts from hostapd configuration and handles wireless access and authentication. Shared protocol, driver, crypto, and event-loop layers support both. Optional capabilities include P2P, FST, WPS, and Hotspot 2.0. Some runtime links are dashed because their implementation was not sampled; the map does not infer calls from directory names.

Main entry points: [`wpa_supplicant/main.c`](https://github.com/latelee/hostapd/blob/master/wpa_supplicant/main.c) (Client daemon), [`src/ap/hostapd.c`](https://github.com/latelee/hostapd/blob/master/src/ap/hostapd.c) (AP management), [`src/drivers/driver.h`](https://github.com/latelee/hostapd/blob/master/src/drivers/driver.h) (Driver interface), [`wpa_supplicant/scan.c`](https://github.com/latelee/hostapd/blob/master/wpa_supplicant/scan.c) (Scan management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client connectivity"]
  node_supp_main["Client daemon<br/>[main.c]"]
  node_supp_config["Network configuration<br/>[config.c]"]
  node_scan["Scan management<br/>[scan.c]"]
  node_bss[("BSS records<br/>[bss.c]")]
  node_events["Connection events<br/>[events.c]"]
  node_sme["Station management<br/>[sme.c]"]
  node_client_wpa["Client WPA<br/>[wpa.c]"]
  node_eap_peer["EAP peer<br/>[eap.c]"]
  node_eapol_supp["Client EAPOL<br/>[eapol_supp_sm.c]"]
  node_ctrl["Control interfaces<br/>[ctrl_iface.c]"]
end

subgraph group_ap["Access point"]
  node_hostapd_main["AP daemon<br/>[main.c]"]
  node_ap_config["AP configuration<br/>[config_file.c]"]
  node_ap_runtime["AP management<br/>[hostapd.c]"]
  node_ap80211["802.11 access<br/>[ieee802_11.c]"]
  node_ap_wpa["AP WPA<br/>[wpa_auth.c]"]
  node_eap_auth["EAP server<br/>[eap_server.c]"]
  node_eapol_auth["AP EAPOL<br/>[eapol_auth_sm.c]"]
  node_radius["RADIUS client<br/>[radius_client.c]"]
end

subgraph group_shared["Shared runtime"]
  node_driver["Driver interface<br/>[driver.h]"]
  node_protocol["802.11 definitions<br/>[ieee802_11_defs.h]"]
  node_common["Common definitions<br/>[defs.h]"]
  node_event_loop["Event loop<br/>[eloop.h]"]
  node_crypto["Crypto API<br/>[crypto.h]"]
  node_tls["TLS API<br/>[tls.h]"]
  node_supp_state["Client state<br/>[wpa_supplicant_i.h]"]
  node_ap_state["AP state<br/>[ap_config.h]"]
end

subgraph group_extensions["Optional capabilities"]
  node_p2p["P2P support<br/>[p2p.c]"]
  node_fst["Fast transition<br/>[fst_session.c]"]
  node_wps["WPS<br/>[wps.c]"]
  node_osu["OSU provisioning<br/>[osu_client.c]"]
  node_gas["GAS queries<br/>[gas_query.c]"]
end

node_user(("Network operator"))

node_user -.->|"starts"| node_supp_main
node_supp_main -->|"uses state"| node_supp_state
node_supp_main -->|"uses interface"| node_driver
node_supp_main -->|"initializes"| node_p2p
node_supp_main -.->|"loads networks"| node_supp_config
node_supp_config -.->|"supplies profiles"| node_scan
node_scan -.->|"requests scans"| node_driver
node_scan -.->|"updates results"| node_bss
node_events -.->|"handles connection"| node_sme
node_sme -.->|"controls station"| node_driver
node_sme -.->|"starts security"| node_client_wpa
node_client_wpa -.->|"uses EAPOL"| node_eapol_supp
node_eapol_supp -.->|"runs EAP"| node_eap_peer
node_user -.->|"starts"| node_hostapd_main
node_hostapd_main -->|"loads configuration"| node_ap_config
node_hostapd_main -->|"starts AP"| node_ap_runtime
node_ap_runtime -.->|"uses configuration"| node_ap_state
node_ap80211 -.->|"handles security"| node_ap_wpa
node_ap_wpa -->|"uses EAPOL"| node_eapol_auth
node_eapol_auth -->|"runs EAP"| node_eap_auth
node_ap_runtime -.->|"uses RADIUS"| node_radius
node_ap_runtime -.->|"controls AP"| node_driver
node_fst -.->|"uses scheduling"| node_event_loop
node_gas -.->|"schedules queries"| node_event_loop
node_osu -.->|"configures client"| node_supp_main
node_wps -.->|"supports provisioning"| node_ap_runtime

click node_supp_main "https://github.com/latelee/hostapd/blob/master/wpa_supplicant/main.c"
click node_supp_config "https://github.com/latelee/hostapd/blob/master/wpa_supplicant/config.c"
click node_scan "https://github.com/latelee/hostapd/blob/master/wpa_supplicant/scan.c"
click node_bss "https://github.com/latelee/hostapd/blob/master/wpa_supplicant/bss.c"
click node_events "https://github.com/latelee/hostapd/blob/master/wpa_supplicant/events.c"
click node_sme "https://github.com/latelee/hostapd/blob/master/wpa_supplicant/sme.c"
click node_client_wpa "https://github.com/latelee/hostapd/blob/master/src/rsn_supp/wpa.c"
click node_eap_peer "https://github.com/latelee/hostapd/blob/master/src/eap_peer/eap.c"
click node_eapol_supp "https://github.com/latelee/hostapd/blob/master/src/eapol_supp/eapol_supp_sm.c"
click node_ctrl "https://github.com/latelee/hostapd/blob/master/wpa_supplicant/ctrl_iface.c"
click node_hostapd_main "https://github.com/latelee/hostapd/blob/master/hostapd/main.c"
click node_ap_config "https://github.com/latelee/hostapd/blob/master/hostapd/config_file.c"
click node_ap_runtime "https://github.com/latelee/hostapd/blob/master/src/ap/hostapd.c"
click node_ap80211 "https://github.com/latelee/hostapd/blob/master/src/ap/ieee802_11.c"
click node_ap_wpa "https://github.com/latelee/hostapd/blob/master/src/ap/wpa_auth.c"
click node_eap_auth "https://github.com/latelee/hostapd/blob/master/src/eap_server/eap_server.c"
click node_eapol_auth "https://github.com/latelee/hostapd/blob/master/src/eapol_auth/eapol_auth_sm.c"
click node_radius "https://github.com/latelee/hostapd/blob/master/src/radius/radius_client.c"
click node_driver "https://github.com/latelee/hostapd/blob/master/src/drivers/driver.h"
click node_protocol "https://github.com/latelee/hostapd/blob/master/src/common/ieee802_11_defs.h"
click node_common "https://github.com/latelee/hostapd/blob/master/src/common/defs.h"
click node_event_loop "https://github.com/latelee/hostapd/blob/master/src/utils/eloop.h"
click node_crypto "https://github.com/latelee/hostapd/blob/master/src/crypto/crypto.h"
click node_tls "https://github.com/latelee/hostapd/blob/master/src/crypto/tls.h"
click node_supp_state "https://github.com/latelee/hostapd/blob/master/wpa_supplicant/wpa_supplicant_i.h"
click node_ap_state "https://github.com/latelee/hostapd/blob/master/src/ap/ap_config.h"
click node_p2p "https://github.com/latelee/hostapd/blob/master/src/p2p/p2p.c"
click node_fst "https://github.com/latelee/hostapd/blob/master/src/fst/fst_session.c"
click node_wps "https://github.com/latelee/hostapd/blob/master/src/wps/wps.c"
click node_osu "https://github.com/latelee/hostapd/blob/master/hs20/client/osu_client.c"
click node_gas "https://github.com/latelee/hostapd/blob/master/wpa_supplicant/gas_query.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_supp_main,node_supp_config,node_scan,node_bss,node_events,node_sme,node_client_wpa,node_eap_peer,node_eapol_supp,node_ctrl toneBlue
class node_hostapd_main,node_ap_config,node_ap_runtime,node_ap80211,node_ap_wpa,node_eap_auth,node_eapol_auth,node_radius toneAmber
class node_driver,node_protocol,node_common,node_event_loop,node_crypto,node_tls,node_supp_state,node_ap_state toneMint
class node_p2p,node_fst,node_wps,node_osu,node_gas toneRose
class node_user toneIndigo
```

## Components

### Client connectivity

- [Client daemon](https://github.com/latelee/hostapd/blob/master/wpa_supplicant/main.c): `wpa_supplicant/main.c`
- [Network configuration](https://github.com/latelee/hostapd/blob/master/wpa_supplicant/config.c): `wpa_supplicant/config.c`
- [Scan management](https://github.com/latelee/hostapd/blob/master/wpa_supplicant/scan.c): `wpa_supplicant/scan.c`
- [BSS records](https://github.com/latelee/hostapd/blob/master/wpa_supplicant/bss.c): `wpa_supplicant/bss.c`
- [Connection events](https://github.com/latelee/hostapd/blob/master/wpa_supplicant/events.c): `wpa_supplicant/events.c`
- [Station management](https://github.com/latelee/hostapd/blob/master/wpa_supplicant/sme.c): `wpa_supplicant/sme.c`
- [Client WPA](https://github.com/latelee/hostapd/blob/master/src/rsn_supp/wpa.c): `src/rsn_supp/wpa.c`
- [EAP peer](https://github.com/latelee/hostapd/blob/master/src/eap_peer/eap.c): `src/eap_peer/eap.c`
- [Client EAPOL](https://github.com/latelee/hostapd/blob/master/src/eapol_supp/eapol_supp_sm.c): `src/eapol_supp/eapol_supp_sm.c`
- [Control interfaces](https://github.com/latelee/hostapd/blob/master/wpa_supplicant/ctrl_iface.c): `wpa_supplicant/ctrl_iface.c`

### Access point

- [AP daemon](https://github.com/latelee/hostapd/blob/master/hostapd/main.c): `hostapd/main.c`
- [AP configuration](https://github.com/latelee/hostapd/blob/master/hostapd/config_file.c): `hostapd/config_file.c`
- [AP management](https://github.com/latelee/hostapd/blob/master/src/ap/hostapd.c): `src/ap/hostapd.c`
- [802.11 access](https://github.com/latelee/hostapd/blob/master/src/ap/ieee802_11.c): `src/ap/ieee802_11.c`
- [AP WPA](https://github.com/latelee/hostapd/blob/master/src/ap/wpa_auth.c): `src/ap/wpa_auth.c`
- [EAP server](https://github.com/latelee/hostapd/blob/master/src/eap_server/eap_server.c): `src/eap_server/eap_server.c`
- [AP EAPOL](https://github.com/latelee/hostapd/blob/master/src/eapol_auth/eapol_auth_sm.c): `src/eapol_auth/eapol_auth_sm.c`
- [RADIUS client](https://github.com/latelee/hostapd/blob/master/src/radius/radius_client.c): `src/radius/radius_client.c`

### Shared runtime

- [Driver interface](https://github.com/latelee/hostapd/blob/master/src/drivers/driver.h): `src/drivers/driver.h`
- [802.11 definitions](https://github.com/latelee/hostapd/blob/master/src/common/ieee802_11_defs.h): `src/common/ieee802_11_defs.h`
- [Common definitions](https://github.com/latelee/hostapd/blob/master/src/common/defs.h): `src/common/defs.h`
- [Event loop](https://github.com/latelee/hostapd/blob/master/src/utils/eloop.h): `src/utils/eloop.h`
- [Crypto API](https://github.com/latelee/hostapd/blob/master/src/crypto/crypto.h): `src/crypto/crypto.h`
- [TLS API](https://github.com/latelee/hostapd/blob/master/src/crypto/tls.h): `src/crypto/tls.h`
- [Client state](https://github.com/latelee/hostapd/blob/master/wpa_supplicant/wpa_supplicant_i.h): `wpa_supplicant/wpa_supplicant_i.h`
- [AP state](https://github.com/latelee/hostapd/blob/master/src/ap/ap_config.h): `src/ap/ap_config.h`

### Optional capabilities

- [P2P support](https://github.com/latelee/hostapd/blob/master/src/p2p/p2p.c): `src/p2p/p2p.c`
- [Fast transition](https://github.com/latelee/hostapd/blob/master/src/fst/fst_session.c): `src/fst/fst_session.c`
- [WPS](https://github.com/latelee/hostapd/blob/master/src/wps/wps.c): `src/wps/wps.c`
- [OSU provisioning](https://github.com/latelee/hostapd/blob/master/hs20/client/osu_client.c): `hs20/client/osu_client.c`
- [GAS queries](https://github.com/latelee/hostapd/blob/master/wpa_supplicant/gas_query.c): `wpa_supplicant/gas_query.c`

### Other components

- **Network operator**

## Connections

- Network operator → Client daemon: starts
- Client daemon → Client state: uses state (evidence: `wpa_supplicant/main.c`)
- Client daemon → Driver interface: uses interface (evidence: `wpa_supplicant/main.c`)
- Client daemon → P2P support: initializes (evidence: `wpa_supplicant/main.c`)
- Client daemon → Network configuration: loads networks
- Network configuration → Scan management: supplies profiles
- Scan management → Driver interface: requests scans
- Scan management → BSS records: updates results
- Connection events → Station management: handles connection
- Station management → Driver interface: controls station
- Station management → Client WPA: starts security
- Client WPA → Client EAPOL: uses EAPOL
- Client EAPOL → EAP peer: runs EAP
- Network operator → AP daemon: starts
- AP daemon → AP configuration: loads configuration (evidence: `hostapd/main.c`)
- AP daemon → AP management: starts AP (evidence: `hostapd/main.c`)
- AP management → AP state: uses configuration
- 802.11 access → AP WPA: handles security
- AP WPA → AP EAPOL: uses EAPOL (evidence: `src/ap/wpa_auth.c`)
- AP EAPOL → EAP server: runs EAP (evidence: `src/eapol_auth/eapol_auth_sm.c`)
- AP management → RADIUS client: uses RADIUS
- AP management → Driver interface: controls AP
- Fast transition → Event loop: uses scheduling (evidence: `src/fst/fst_session.c`)
- GAS queries → Event loop: schedules queries (evidence: `wpa_supplicant/gas_query.c`)
- OSU provisioning → Client daemon: configures client
- WPS → AP management: supports provisioning
