# ramonfontes/wmediumd architecture

> Architecture diagram of the GitHub repository ramonfontes/wmediumd, 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/ramonfontes/wmediumd
- Repository: https://github.com/ramonfontes/wmediumd

## Overview

wmediumd is a Linux wireless-medium simulator for mac80211_hwsim. A user supplies interface and channel-model configuration; the daemon registers with the kernel, then mediates wireless frames with simulated loss and delay. Its documented channel options include per-link probabilities or SNR, path loss, and Nakagami fading; the server also supports live medium updates. The graph preserves these capabilities, but the frame-processing and model-dispatch excerpts are incomplete, so uncertain implementation links are omitted. Source-index references support several module links; README statements support the documented workflow.

Main entry points: [`wmediumd/wmediumd.c`](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wmediumd.c) (Simulator daemon), [`wmediumd/wserver.c`](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver.c) (Update server), [`wmediumd/wserver_messages.c`](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver_messages.c) (Control messages), [`wmediumd/config.c`](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/config.c) (Config parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Simulation runtime"]
  node_daemon["Simulator daemon<br/>[wmediumd.c]"]
  node_state["Stations and links<br/>[wmediumd.h]"]
  node_frames["Frame protocol<br/>[ieee80211.h]"]
  node_queues["Internal lists<br/>[list.h]"]
  node_config["Config parsing<br/>[config.c]"]
  node_configapi["Config interface<br/>[config.h]"]
end

subgraph group_models["Channel modeling"]
  node_per["Error-rate tables<br/>[per.c]"]
  node_snrmodel["SNR and loss<br/>[wmediumd.c]"]
  node_pathmodel["Path loss and fading<br/>[wmediumd.c]"]
end

subgraph group_control["Live control"]
  node_server["Update server<br/>[wserver.c]"]
  node_dynamic["Station lifecycle<br/>[wmediumd_dynamic.c]"]
  node_messages["Control messages<br/>[wserver_messages.c]"]
  node_networkcodec["Network encoding"]
  node_protocol["Message definitions<br/>[wserver_messages.h]"]
  node_codecapi["Codec declarations"]
  node_serverapi["Server interface<br/>[wserver.h]"]
  node_dynamicapi["Dynamic interface<br/>[wmediumd_dynamic.h]"]
  node_serverapi2["Server API types<br/>[wserver.h]"]
end

node_user(("Operator"))
node_configfile["Medium config"]
node_kernel["mac80211_hwsim"]

node_user -->|"provides settings"| node_configfile
node_configfile -->|"parsed by"| node_config
node_user -->|"starts daemon"| node_daemon
node_daemon -->|"uses parser"| node_config
node_daemon -->|"registers with"| node_kernel
node_kernel -->|"forwards frames"| node_daemon
node_daemon -->|"maintains context"| node_state
node_daemon -->|"uses frame definitions"| node_frames
node_daemon -->|"starts update service"| node_server
node_config -->|"implements"| node_configapi
node_daemon -.->|"uses PER model"| node_per
node_daemon -.->|"selects link loss"| node_snrmodel
node_daemon -.->|"computes channel effects"| node_pathmodel
node_user -.->|"sends live updates"| node_server
node_server -->|"changes stations"| node_dynamic
node_server -->|"updates link state"| node_state
node_server -->|"sends responses"| node_messages
node_messages -->|"uses byte conversion"| node_networkcodec
node_messages -->|"uses message types"| node_protocol
node_networkcodec -->|"implements declarations"| node_codecapi
node_server -->|"implements interface"| node_serverapi
node_dynamic -->|"implements interface"| node_dynamicapi
node_daemon -->|"uses list utilities"| node_queues

click node_daemon "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wmediumd.c"
click node_state "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wmediumd.h"
click node_frames "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/ieee80211.h"
click node_queues "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/list.h"
click node_config "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/config.c"
click node_per "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/per.c"
click node_snrmodel "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wmediumd.c"
click node_pathmodel "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wmediumd.c"
click node_server "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver.c"
click node_dynamic "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wmediumd_dynamic.c"
click node_messages "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver_messages.c"
click node_networkcodec "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver_messages_network.c"
click node_protocol "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver_messages.h"
click node_codecapi "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver_messages_network.h"
click node_serverapi "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver.h"
click node_configapi "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/config.h"
click node_dynamicapi "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wmediumd_dynamic.h"
click node_serverapi2 "https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver.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_daemon,node_state,node_frames,node_queues,node_config,node_configapi toneBlue
class node_per,node_snrmodel,node_pathmodel toneAmber
class node_server,node_dynamic,node_messages,node_networkcodec,node_protocol,node_codecapi,node_serverapi,node_dynamicapi,node_serverapi2 toneMint
class node_user,node_configfile,node_kernel toneIndigo
```

## Components

### Simulation runtime

- [Simulator daemon](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wmediumd.c): `wmediumd/wmediumd.c`
- [Stations and links](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wmediumd.h): `wmediumd/wmediumd.h`
- [Frame protocol](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/ieee80211.h): `wmediumd/ieee80211.h`
- [Internal lists](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/list.h): `wmediumd/list.h`
- [Config parsing](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/config.c): `wmediumd/config.c`
- [Config interface](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/config.h): `wmediumd/config.h`

### Channel modeling

- [Error-rate tables](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/per.c): `wmediumd/per.c`
- [SNR and loss](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wmediumd.c): `wmediumd/wmediumd.c`
- [Path loss and fading](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wmediumd.c): `wmediumd/wmediumd.c`

### Live control

- [Update server](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver.c): `wmediumd/wserver.c`
- [Station lifecycle](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wmediumd_dynamic.c): `wmediumd/wmediumd_dynamic.c`
- [Control messages](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver_messages.c): `wmediumd/wserver_messages.c`
- [Network encoding](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver_messages_network.c): `wmediumd/wserver_messages_network.c`
- [Message definitions](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver_messages.h): `wmediumd/wserver_messages.h`
- [Codec declarations](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver_messages_network.h): `wmediumd/wserver_messages_network.h`
- [Server interface](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver.h): `wmediumd/wserver.h`
- [Dynamic interface](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wmediumd_dynamic.h): `wmediumd/wmediumd_dynamic.h`
- [Server API types](https://github.com/ramonfontes/wmediumd/blob/mininet-wifi/wmediumd/wserver.h): `wmediumd/wserver.h`

### Other components

- **Operator**
- **Medium config**
- **mac80211_hwsim**

## Connections

- Operator → Medium config: provides settings (evidence: `README.md`)
- Medium config → Config parsing: parsed by (evidence: `README.md`)
- Operator → Simulator daemon: starts daemon (evidence: `README.md`)
- Simulator daemon → Config parsing: uses parser (evidence: `wmediumd/wmediumd.c`)
- Simulator daemon → mac80211_hwsim: registers with (evidence: `wmediumd/wmediumd.c`)
- mac80211_hwsim → Simulator daemon: forwards frames (evidence: `README.md`)
- Simulator daemon → Stations and links: maintains context (evidence: `wmediumd/wmediumd.c`)
- Simulator daemon → Frame protocol: uses frame definitions (evidence: `wmediumd/wmediumd.c`)
- Simulator daemon → Update server: starts update service (evidence: `wmediumd/wmediumd.c`)
- Config parsing → Config interface: implements (evidence: `wmediumd/config.c`)
- Simulator daemon → Error-rate tables: uses PER model
- Simulator daemon → SNR and loss: selects link loss (evidence: `wmediumd/wmediumd.c`)
- Simulator daemon → Path loss and fading: computes channel effects (evidence: `wmediumd/wmediumd.c`)
- Operator → Update server: sends live updates
- Update server → Station lifecycle: changes stations (evidence: `wmediumd/wserver.c`)
- Update server → Stations and links: updates link state (evidence: `wmediumd/wserver.c`)
- Update server → Control messages: sends responses (evidence: `wmediumd/wserver.c`)
- Control messages → Network encoding: uses byte conversion (evidence: `wmediumd/wserver_messages.c`)
- Control messages → Message definitions: uses message types (evidence: `wmediumd/wserver_messages.c`)
- Network encoding → Codec declarations: implements declarations (evidence: `wmediumd/wserver_messages_network.c`)
- Update server → Server interface: implements interface (evidence: `wmediumd/wserver.c`)
- Station lifecycle → Dynamic interface: implements interface (evidence: `wmediumd/wmediumd_dynamic.c`)
- Simulator daemon → Internal lists: uses list utilities (evidence: `wmediumd/wmediumd.c`)
