# snmp-rs/snmpify architecture

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

- Interactive diagram: https://gitdiagram.com/snmp-rs/snmpify
- Repository: https://github.com/snmp-rs/snmpify

## Overview

snmpify is an SNMP library whose main workflow is a Rust client sending requests to an agent, encoding and securing messages, then decoding responses; it also provides agent, notification, MIB, Python, and C/C++ capabilities. The graph separates protocol primitives from operational features and language APIs. Edges follow shown imports or README descriptions; binding internals and some unsampled subsystem connections are left unlinked where their wiring is not evidenced.

Main entry points: [`src/client.rs`](https://github.com/snmp-rs/snmpify/blob/main/src/client.rs) (Async client), [`src/v3.rs`](https://github.com/snmp-rs/snmpify/blob/main/src/v3.rs) (SNMPv3 messages), [`src/agent.rs`](https://github.com/snmp-rs/snmpify/blob/main/src/agent.rs) (SNMP agent), [`src/ber.rs`](https://github.com/snmp-rs/snmpify/blob/main/src/ber.rs) (BER codec)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_protocol["Protocol core"]
  node_ber["BER codec<br/>[ber.rs]"]
  node_pdu["PDU messages<br/>[pdu.rs]"]
  node_v3["SNMPv3 messages<br/>[v3.rs]"]
  node_usm["USM security<br/>[usm.rs]"]
  node_oid["Object identifiers<br/>[oid.rs]"]
  node_value["SNMP values<br/>[value.rs]"]
  node_errors["Decode errors<br/>[error.rs]"]
end

subgraph group_operations["SNMP operations"]
  node_client["Async client<br/>[client.rs]"]
  node_blocking["Blocking API<br/>[blocking.rs]"]
  node_agent["SNMP agent<br/>[agent.rs]"]
  node_agentx["AgentX subagent<br/>[agentx.rs]"]
  node_notifications["Notifications<br/>[notification.rs]"]
  node_engine["SNMPv3 engine<br/>[engine.rs]"]
end

subgraph group_mibs["MIB support"]
  node_mib["MIB registry<br/>[mod.rs]"]
  node_mib_parser["MIB file parser<br/>[parse.rs]"]
  node_builtins["Built-in MIBs<br/>[builtin.rs]"]
end

subgraph group_bindings["Language APIs"]
  node_c_api["C and C++ API<br/>[lib.rs]"]
  node_c_header["C API header<br/>[snmpify.h]"]
  node_python_api["Python package<br/>[__init__.py]"]
  node_python_native["Python native binding<br/>[lib.rs]"]
end

node_client_user(("SNMP client user"))
node_remote_agent(("Remote agent"))
node_manager(("SNMP manager"))

node_client_user -->|"uses"| node_client
node_client -->|"sends requests"| node_remote_agent
node_manager -->|"creates clients"| node_client
node_client -.->|"supports"| node_blocking
node_client -->|"uses security"| node_usm
node_client -->|"encodes v3"| node_v3
node_client -->|"discovers engine"| node_engine
node_client -->|"sends notifications"| node_notifications
node_agent -->|"verifies v3"| node_engine
node_agent -->|"supports subagent"| node_agentx
node_agent -->|"uses security"| node_usm
node_agent -->|"handles v3"| node_v3
node_agent -->|"decodes messages"| node_ber
node_agentx -->|"uses handlers"| node_agent
node_agentx -->|"references"| node_notifications
node_engine -->|"uses security"| node_usm
node_engine -->|"handles messages"| node_v3
node_engine -->|"shared by receiver"| node_notifications
node_ber -->|"reports decode errors"| node_errors
node_pdu -->|"encodes messages"| node_ber
node_pdu -->|"reports decode errors"| node_errors
node_pdu -->|"uses identifiers"| node_oid
node_pdu -->|"uses values"| node_value
node_v3 -->|"encodes messages"| node_ber
node_v3 -->|"carries PDUs"| node_pdu
node_v3 -->|"uses security parameters"| node_usm
node_v3 -->|"uses identifiers"| node_oid
node_v3 -->|"carries values"| node_value
node_oid -->|"encodes identifiers"| node_ber
node_oid -->|"reports parse errors"| node_errors
node_value -->|"encodes values"| node_ber
node_value -->|"uses identifiers"| node_oid
node_value -->|"reports decode errors"| node_errors
node_mib -->|"includes standard MIBs"| node_builtins
node_mib -->|"loads vendor MIBs"| node_mib_parser
node_c_api -.->|"exposes API"| node_c_header
node_client_user -.->|"uses"| node_c_api
node_client_user -.->|"uses"| node_python_api
node_python_api -.->|"native implementation"| node_python_native

click node_client "https://github.com/snmp-rs/snmpify/blob/main/src/client.rs"
click node_blocking "https://github.com/snmp-rs/snmpify/blob/main/src/blocking.rs"
click node_agent "https://github.com/snmp-rs/snmpify/blob/main/src/agent.rs"
click node_agentx "https://github.com/snmp-rs/snmpify/blob/main/src/agentx.rs"
click node_notifications "https://github.com/snmp-rs/snmpify/blob/main/src/notification.rs"
click node_engine "https://github.com/snmp-rs/snmpify/blob/main/src/engine.rs"
click node_ber "https://github.com/snmp-rs/snmpify/blob/main/src/ber.rs"
click node_pdu "https://github.com/snmp-rs/snmpify/blob/main/src/pdu.rs"
click node_v3 "https://github.com/snmp-rs/snmpify/blob/main/src/v3.rs"
click node_usm "https://github.com/snmp-rs/snmpify/blob/main/src/usm.rs"
click node_oid "https://github.com/snmp-rs/snmpify/blob/main/src/oid.rs"
click node_value "https://github.com/snmp-rs/snmpify/blob/main/src/value.rs"
click node_errors "https://github.com/snmp-rs/snmpify/blob/main/src/error.rs"
click node_mib "https://github.com/snmp-rs/snmpify/blob/main/src/mib/mod.rs"
click node_mib_parser "https://github.com/snmp-rs/snmpify/blob/main/src/mib/parse.rs"
click node_builtins "https://github.com/snmp-rs/snmpify/blob/main/src/mib/builtin.rs"
click node_c_api "https://github.com/snmp-rs/snmpify/blob/main/capi/src/lib.rs"
click node_c_header "https://github.com/snmp-rs/snmpify/blob/main/capi/include/snmpify.h"
click node_python_api "https://github.com/snmp-rs/snmpify/blob/main/python/python/snmpify/__init__.py"
click node_python_native "https://github.com/snmp-rs/snmpify/blob/main/python/src/lib.rs"

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_ber,node_pdu,node_v3,node_usm,node_oid,node_value,node_errors,node_client_user toneBlue
class node_client,node_blocking,node_agent,node_agentx,node_notifications,node_engine toneAmber
class node_mib,node_mib_parser,node_builtins toneMint
class node_c_api,node_c_header,node_python_api,node_python_native toneRose
class node_remote_agent,node_manager toneIndigo
```

## Components

### Protocol core

- [BER codec](https://github.com/snmp-rs/snmpify/blob/main/src/ber.rs): `src/ber.rs`
- [PDU messages](https://github.com/snmp-rs/snmpify/blob/main/src/pdu.rs): `src/pdu.rs`
- [SNMPv3 messages](https://github.com/snmp-rs/snmpify/blob/main/src/v3.rs): `src/v3.rs`
- [USM security](https://github.com/snmp-rs/snmpify/blob/main/src/usm.rs): `src/usm.rs`
- [Object identifiers](https://github.com/snmp-rs/snmpify/blob/main/src/oid.rs): `src/oid.rs`
- [SNMP values](https://github.com/snmp-rs/snmpify/blob/main/src/value.rs): `src/value.rs`
- [Decode errors](https://github.com/snmp-rs/snmpify/blob/main/src/error.rs): `src/error.rs`

### SNMP operations

- [Async client](https://github.com/snmp-rs/snmpify/blob/main/src/client.rs): `src/client.rs`
- [Blocking API](https://github.com/snmp-rs/snmpify/blob/main/src/blocking.rs): `src/blocking.rs`
- [SNMP agent](https://github.com/snmp-rs/snmpify/blob/main/src/agent.rs): `src/agent.rs`
- [AgentX subagent](https://github.com/snmp-rs/snmpify/blob/main/src/agentx.rs): `src/agentx.rs`
- [Notifications](https://github.com/snmp-rs/snmpify/blob/main/src/notification.rs): `src/notification.rs`
- [SNMPv3 engine](https://github.com/snmp-rs/snmpify/blob/main/src/engine.rs): `src/engine.rs`

### MIB support

- [MIB registry](https://github.com/snmp-rs/snmpify/blob/main/src/mib/mod.rs): `src/mib/mod.rs`
- [MIB file parser](https://github.com/snmp-rs/snmpify/blob/main/src/mib/parse.rs): `src/mib/parse.rs`
- [Built-in MIBs](https://github.com/snmp-rs/snmpify/blob/main/src/mib/builtin.rs): `src/mib/builtin.rs`

### Language APIs

- [C and C++ API](https://github.com/snmp-rs/snmpify/blob/main/capi/src/lib.rs): `capi/src/lib.rs`
- [C API header](https://github.com/snmp-rs/snmpify/blob/main/capi/include/snmpify.h): `capi/include/snmpify.h`
- [Python package](https://github.com/snmp-rs/snmpify/blob/main/python/python/snmpify/__init__.py): `python/python/snmpify/__init__.py`
- [Python native binding](https://github.com/snmp-rs/snmpify/blob/main/python/src/lib.rs): `python/src/lib.rs`

### Other components

- **SNMP client user**
- **Remote agent**
- **SNMP manager**

## Connections

- SNMP client user → Async client: uses (evidence: `README.md`)
- Async client → Remote agent: sends requests (evidence: `README.md`)
- SNMP manager → Async client: creates clients (evidence: `src/client.rs`)
- Async client → Blocking API: supports (evidence: `src/blocking.rs`)
- Async client → USM security: uses security (evidence: `src/client.rs`)
- Async client → SNMPv3 messages: encodes v3 (evidence: `src/client.rs`)
- Async client → SNMPv3 engine: discovers engine (evidence: `src/client.rs`)
- Async client → Notifications: sends notifications (evidence: `src/client.rs`)
- SNMP agent → SNMPv3 engine: verifies v3 (evidence: `src/agent.rs`)
- SNMP agent → AgentX subagent: supports subagent (evidence: `src/agent.rs`)
- SNMP agent → USM security: uses security (evidence: `src/agent.rs`)
- SNMP agent → SNMPv3 messages: handles v3 (evidence: `src/agent.rs`)
- SNMP agent → BER codec: decodes messages (evidence: `src/agent.rs`)
- AgentX subagent → SNMP agent: uses handlers (evidence: `src/agentx.rs`)
- AgentX subagent → Notifications: references (evidence: `src/agentx.rs`)
- SNMPv3 engine → USM security: uses security (evidence: `src/engine.rs`)
- SNMPv3 engine → SNMPv3 messages: handles messages (evidence: `src/engine.rs`)
- SNMPv3 engine → Notifications: shared by receiver (evidence: `src/engine.rs`)
- BER codec → Decode errors: reports decode errors (evidence: `src/ber.rs`)
- PDU messages → BER codec: encodes messages (evidence: `src/pdu.rs`)
- PDU messages → Decode errors: reports decode errors (evidence: `src/pdu.rs`)
- PDU messages → Object identifiers: uses identifiers (evidence: `src/pdu.rs`)
- PDU messages → SNMP values: uses values (evidence: `src/pdu.rs`)
- SNMPv3 messages → BER codec: encodes messages (evidence: `src/v3.rs`)
- SNMPv3 messages → PDU messages: carries PDUs (evidence: `src/v3.rs`)
- SNMPv3 messages → USM security: uses security parameters (evidence: `src/v3.rs`)
- SNMPv3 messages → Object identifiers: uses identifiers (evidence: `src/v3.rs`)
- SNMPv3 messages → SNMP values: carries values (evidence: `src/v3.rs`)
- Object identifiers → BER codec: encodes identifiers (evidence: `src/oid.rs`)
- Object identifiers → Decode errors: reports parse errors (evidence: `src/oid.rs`)
- SNMP values → BER codec: encodes values (evidence: `src/value.rs`)
- SNMP values → Object identifiers: uses identifiers (evidence: `src/value.rs`)
- SNMP values → Decode errors: reports decode errors (evidence: `src/value.rs`)
- MIB registry → Built-in MIBs: includes standard MIBs (evidence: `src/mib/mod.rs`)
- MIB registry → MIB file parser: loads vendor MIBs (evidence: `src/mib/mod.rs`)
- C and C++ API → C API header: exposes API
- SNMP client user → C and C++ API: uses
- SNMP client user → Python package: uses
- Python package → Python native binding: native implementation
