SnmpKit.SnmpSim.Core.Server (snmpkit v2.0.1)
High-performance UDP server for SNMP request handling. Supports concurrent packet processing with minimal latency.
Summary
Functions
Returns a specification to start this module under a supervisor.
The UDP port the server's socket is bound to (the real port when started on 0).
Get server statistics.
Update the device handler function.
Start an SNMP UDP server on the specified port.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec get_port(pid()) :: :inet.port_number()
The UDP port the server's socket is bound to (the real port when started on 0).
Get server statistics.
Update the device handler function.
Start an SNMP UDP server on the specified port.
Options
:community- accepted community: a string (default: "public"), a list of strings, or a one-argument function returningtruefor accepted names:device_handler- Module or function to handle device requests. A function handler returns{:ok, response_pdu},{:error, error_status}, or:dropto send no response at all (counted in:auth_failures):socket_opts- Additional socket options:max_concurrent_requests- Handlers allowed in flight at once (default: 256); excess datagrams are dropped and counted in:dropped_overload:max_packet_size- Largest datagram accepted in bytes (default: 16384); larger ones are dropped and counted in:oversized_packets
Examples
{:ok, server} = SnmpKit.SnmpSim.Core.Server.start_link(9001,
community: "public",
device_handler: &MyDevice.handle_request/2
)