# hicool-ml/lldp_analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/hicool-ml/lldp_analyzer
- Repository: https://github.com/hicool-ml/lldp_analyzer

## Overview

LLDP/CDP Analyzer supports offline hex-file parsing and live packet capture, with both CLI and tkinter interfaces. The main workflow captures or loads packets, parses protocol TLVs (including vendor-private data), presents neighbor details and semantic port analysis, and can persist captures for history queries. Separate capabilities cover runtime diagnostics and local adapter configuration. Edges reflect shown calls, SOURCE INDEX references, or README-documented behavior; unsampled wiring is omitted where evidence is insufficient.

Main entry points: [`ui/capture_page.py`](https://github.com/hicool-ml/lldp_analyzer/blob/master/ui/capture_page.py) (Capture tab), [`utils/protocol_parser.py`](https://github.com/hicool-ml/lldp_analyzer/blob/master/utils/protocol_parser.py) (Protocol parser), [`ui/network_page.py`](https://github.com/hicool-ml/lldp_analyzer/blob/master/ui/network_page.py) (Network tab), [`lldp_gui.py`](https://github.com/hicool-ml/lldp_analyzer/blob/master/lldp_gui.py) (GUI launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_cli["CLI<br/>[lldp.py]"]
  node_gui["GUI launcher<br/>[lldp_gui.py]"]
  node_capture_ui["Capture tab<br/>[capture_page.py]"]
  node_history_ui["History tab<br/>[history_page.py]"]
  node_network_ui["Network tab<br/>[network_page.py]"]
end

subgraph group_protocol["Capture and decoding"]
  node_parser["Protocol parser<br/>[protocol_parser.py]"]
  node_capture["Packet capture<br/>[packet_capture.py]"]
  node_capture_engine["Capture engine<br/>[capture_engine.py]"]
  node_vendor["Vendor dispatch"]
  node_vendor_decoders["Vendor decoders"]
end

subgraph group_analysis["Analysis and history"]
  node_decision["Port inference<br/>[decision_engine.py]"]
  node_port_profile["Port profiles<br/>[port_profile.py]"]
  node_history_db[("Capture history<br/>[database.py]")]
end

subgraph group_network["Network management"]
  node_adapter_scan["Adapter scanner<br/>[adapter_scanner.py]"]
  node_backend_select["Backend selection<br/>[platform.py]"]
  node_interface_model["Network interface model<br/>[interfaces.py]"]
  node_windows_backend["Windows adapter<br/>[adapter.py]"]
  node_mac_backend["macOS adapter<br/>[adapter.py]"]
  node_posix_backend["POSIX adapter<br/>[adapter.py]"]
end

subgraph group_runtime["Runtime support"]
  node_runtime_check["Capability checks<br/>[checker.py]"]
  node_translations["Translations<br/>[translations.py]"]
end

node_operator(("Operator"))

node_operator -->|"runs"| node_cli
node_operator -->|"opens"| node_gui
node_cli -->|"captures packets"| node_capture
node_cli -->|"parses offline files"| node_parser
node_gui -->|"opens"| node_capture_ui
node_gui -->|"checks capabilities"| node_runtime_check
node_capture_ui -->|"starts capture"| node_capture
node_capture_ui -->|"parses offline files"| node_parser
node_capture_ui -->|"lists adapters"| node_adapter_scan
node_capture_ui -->|"requests analysis"| node_decision
node_capture_ui -->|"saves results"| node_history_db
node_capture_ui -->|"launches capture engine"| node_cli
node_capture -->|"parses packets"| node_parser
node_capture -->|"uses capture backend"| node_capture_engine
node_parser -->|"dispatches vendor TLVs"| node_vendor
node_vendor -->|"selects decoder"| node_vendor_decoders
node_decision -->|"runs inference"| node_port_profile
node_history_ui -->|"queries records"| node_history_db
node_history_ui -->|"formats packet details"| node_parser
node_network_ui -->|"uses backend"| node_backend_select
node_network_ui -->|"configures adapters"| node_windows_backend
node_network_ui -->|"configures adapters"| node_mac_backend
node_network_ui -->|"configures adapters"| node_posix_backend
node_windows_backend -->|"returns interfaces"| node_interface_model
node_mac_backend -->|"returns interfaces"| node_interface_model
node_posix_backend -->|"returns interfaces"| node_interface_model
node_gui -->|"uses language settings"| node_translations
node_capture_ui -->|"localizes interface"| node_translations

click node_cli "https://github.com/hicool-ml/lldp_analyzer/blob/master/lldp.py"
click node_gui "https://github.com/hicool-ml/lldp_analyzer/blob/master/lldp_gui.py"
click node_capture_ui "https://github.com/hicool-ml/lldp_analyzer/blob/master/ui/capture_page.py"
click node_history_ui "https://github.com/hicool-ml/lldp_analyzer/blob/master/ui/history_page.py"
click node_network_ui "https://github.com/hicool-ml/lldp_analyzer/blob/master/ui/network_page.py"
click node_parser "https://github.com/hicool-ml/lldp_analyzer/blob/master/utils/protocol_parser.py"
click node_capture "https://github.com/hicool-ml/lldp_analyzer/blob/master/utils/packet_capture.py"
click node_capture_engine "https://github.com/hicool-ml/lldp_analyzer/blob/master/utils/capture_engine.py"
click node_vendor "https://github.com/hicool-ml/lldp_analyzer/blob/master/vendor_dispatcher.py"
click node_vendor_decoders "https://github.com/hicool-ml/lldp_analyzer/tree/master/decoders"
click node_decision "https://github.com/hicool-ml/lldp_analyzer/blob/master/engine/decision_engine.py"
click node_port_profile "https://github.com/hicool-ml/lldp_analyzer/blob/master/engine/port_profile.py"
click node_history_db "https://github.com/hicool-ml/lldp_analyzer/blob/master/db/database.py"
click node_adapter_scan "https://github.com/hicool-ml/lldp_analyzer/blob/master/utils/adapter_scanner.py"
click node_backend_select "https://github.com/hicool-ml/lldp_analyzer/blob/master/network/backends/platform.py"
click node_interface_model "https://github.com/hicool-ml/lldp_analyzer/blob/master/network/core/interfaces.py"
click node_windows_backend "https://github.com/hicool-ml/lldp_analyzer/blob/master/network/backends/windows/adapter.py"
click node_mac_backend "https://github.com/hicool-ml/lldp_analyzer/blob/master/network/backends/macos/adapter.py"
click node_posix_backend "https://github.com/hicool-ml/lldp_analyzer/blob/master/network/backends/posix/adapter.py"
click node_runtime_check "https://github.com/hicool-ml/lldp_analyzer/blob/master/runtime/checker.py"
click node_translations "https://github.com/hicool-ml/lldp_analyzer/blob/master/i18n/translations.py"

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_cli,node_gui,node_capture_ui,node_history_ui,node_network_ui toneBlue
class node_parser,node_capture,node_capture_engine,node_vendor,node_vendor_decoders toneAmber
class node_decision,node_port_profile,node_history_db toneMint
class node_adapter_scan,node_backend_select,node_interface_model,node_windows_backend,node_mac_backend,node_posix_backend toneRose
class node_runtime_check,node_translations,node_operator toneIndigo
```

## Components

### User interfaces

- [CLI](https://github.com/hicool-ml/lldp_analyzer/blob/master/lldp.py): `lldp.py`
- [GUI launcher](https://github.com/hicool-ml/lldp_analyzer/blob/master/lldp_gui.py): `lldp_gui.py`
- [Capture tab](https://github.com/hicool-ml/lldp_analyzer/blob/master/ui/capture_page.py): `ui/capture_page.py`
- [History tab](https://github.com/hicool-ml/lldp_analyzer/blob/master/ui/history_page.py): `ui/history_page.py`
- [Network tab](https://github.com/hicool-ml/lldp_analyzer/blob/master/ui/network_page.py): `ui/network_page.py`

### Capture and decoding

- [Protocol parser](https://github.com/hicool-ml/lldp_analyzer/blob/master/utils/protocol_parser.py): `utils/protocol_parser.py`
- [Packet capture](https://github.com/hicool-ml/lldp_analyzer/blob/master/utils/packet_capture.py): `utils/packet_capture.py`
- [Capture engine](https://github.com/hicool-ml/lldp_analyzer/blob/master/utils/capture_engine.py): `utils/capture_engine.py`
- [Vendor dispatch](https://github.com/hicool-ml/lldp_analyzer/blob/master/vendor_dispatcher.py): `vendor_dispatcher.py`
- [Vendor decoders](https://github.com/hicool-ml/lldp_analyzer/tree/master/decoders): `decoders`

### Analysis and history

- [Port inference](https://github.com/hicool-ml/lldp_analyzer/blob/master/engine/decision_engine.py): `engine/decision_engine.py`
- [Port profiles](https://github.com/hicool-ml/lldp_analyzer/blob/master/engine/port_profile.py): `engine/port_profile.py`
- [Capture history](https://github.com/hicool-ml/lldp_analyzer/blob/master/db/database.py): `db/database.py`

### Network management

- [Adapter scanner](https://github.com/hicool-ml/lldp_analyzer/blob/master/utils/adapter_scanner.py): `utils/adapter_scanner.py`
- [Backend selection](https://github.com/hicool-ml/lldp_analyzer/blob/master/network/backends/platform.py): `network/backends/platform.py`
- [Network interface model](https://github.com/hicool-ml/lldp_analyzer/blob/master/network/core/interfaces.py): `network/core/interfaces.py`
- [Windows adapter](https://github.com/hicool-ml/lldp_analyzer/blob/master/network/backends/windows/adapter.py): `network/backends/windows/adapter.py`
- [macOS adapter](https://github.com/hicool-ml/lldp_analyzer/blob/master/network/backends/macos/adapter.py): `network/backends/macos/adapter.py`
- [POSIX adapter](https://github.com/hicool-ml/lldp_analyzer/blob/master/network/backends/posix/adapter.py): `network/backends/posix/adapter.py`

### Runtime support

- [Capability checks](https://github.com/hicool-ml/lldp_analyzer/blob/master/runtime/checker.py): `runtime/checker.py`
- [Translations](https://github.com/hicool-ml/lldp_analyzer/blob/master/i18n/translations.py): `i18n/translations.py`

### Other components

- **Operator**

## Connections

- Operator → CLI: runs (evidence: `README.md`)
- Operator → GUI launcher: opens (evidence: `README.md`)
- CLI → Packet capture: captures packets (evidence: `README.md`)
- CLI → Protocol parser: parses offline files (evidence: `README.md`)
- GUI launcher → Capture tab: opens (evidence: `lldp_gui.py`)
- GUI launcher → Capability checks: checks capabilities (evidence: `README.md`)
- Capture tab → Packet capture: starts capture (evidence: `README.md`)
- Capture tab → Protocol parser: parses offline files (evidence: `ui/capture_page.py`)
- Capture tab → Adapter scanner: lists adapters (evidence: `ui/capture_page.py`)
- Capture tab → Port inference: requests analysis (evidence: `ui/capture_page.py`)
- Capture tab → Capture history: saves results (evidence: `ui/capture_page.py`)
- Capture tab → CLI: launches capture engine (evidence: `README.md`)
- Packet capture → Protocol parser: parses packets (evidence: `utils/packet_capture.py`)
- Packet capture → Capture engine: uses capture backend (evidence: `utils/packet_capture.py`)
- Protocol parser → Vendor dispatch: dispatches vendor TLVs (evidence: `utils/protocol_parser.py`)
- Vendor dispatch → Vendor decoders: selects decoder (evidence: `vendor_dispatcher.py`)
- Port inference → Port profiles: runs inference (evidence: `engine/decision_engine.py`)
- History tab → Capture history: queries records (evidence: `ui/history_page.py`)
- History tab → Protocol parser: formats packet details (evidence: `ui/history_page.py`)
- Network tab → Backend selection: uses backend (evidence: `ui/network_page.py`)
- Network tab → Windows adapter: configures adapters (evidence: `ui/network_page.py`)
- Network tab → macOS adapter: configures adapters (evidence: `ui/network_page.py`)
- Network tab → POSIX adapter: configures adapters (evidence: `ui/network_page.py`)
- Windows adapter → Network interface model: returns interfaces (evidence: `network/backends/windows/adapter.py`)
- macOS adapter → Network interface model: returns interfaces (evidence: `network/backends/macos/adapter.py`)
- POSIX adapter → Network interface model: returns interfaces (evidence: `network/backends/posix/adapter.py`)
- GUI launcher → Translations: uses language settings (evidence: `lldp_gui.py`)
- Capture tab → Translations: localizes interface (evidence: `ui/capture_page.py`)
