Netsnmp_raw.SessionSession handling including sending and receiving PDUs from remote peers. See the snmp_sess_open(3) manual page for details
val session_id : t -> intmodule Snmp_version : sig ... endSupported SNMP versions
module Snmp_sec_auth_proto : sig ... endSupported SNMP authentication protocols for V3
module Snmp_security_level : sig ... endSupported SNMP security levels for V3
val snmp_sess_open :
version:Snmp_version.t ->
retries:int ->
timeout:int ->
peername:string ->
localname:string ->
local_port:int ->
community:string ->
securityName:string ->
securityLevel:Snmp_security_level.t ->
securityAuthProto:Snmp_sec_auth_proto.t ->
securityAuthPassword:string ->
unit ->
tsnmp_sess_open creates a session between the client and host and returns a handle. Raises Failure if the C API fails. The parameters are as follows:
version - snmp versionretries - Number of retries before timeout.timeout - Number of uS until first timeout, then exponential backoffpeername - name or address of default peer (may include transport specifier and/or port number)localname - My Domain name or dotted IP address, "" for defaultlocal_port - My UDP port number, 0 for default, picked randomlycommunity - V1/V2c community for outgoing requests - ignored by v3.securityName - V3 user namesecurityLevel - V3 security levelsecurityAuthProto - V3 auth protocol, this will be converted to the correct oidsecurityAuthPassword - V3 password, will be converted to securityAuthKeyval snmp_sess_close : t -> unitsnmp_sess_close shuts down the connection and frees resources.
val snmp_sess_synch_response : t -> Pdu.t -> (Oid.t * ASN1_value.t) listsnmp_sess_synch_response t pdu sends a pdu and returns the response. Note that this is completely synchronous. Raises the following exceptions
Netsnmp_exceptions.Response_error (err, msg) for general connection issues, err is the error (Netsnmp_pdu_error.t) and msg the associated error stringNetsnmp_exceptions.Request_timeoutNetsnmp_exceptions.General_error (syserr, snmperr, errmsg) for general errors. syserr is the system error, snmperr is the SNMP error (Netsnmp_error.t) and errmsg is the error message based on the error codes. Note that the PDU will be freed in all cases