package netsnmp

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file session.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
type t
type netsnmp_session

module Snmp_version = struct
  type t = 
    | Version_1
    | Version_2c
    | Version_3
end

module Snmp_sec_auth_proto = struct
 type t = 
   | Ignore
   | UsmHMACMD5AuthProtocol
end

type snmp_session = {
    version : Snmp_version.t
  ; retries : int
  ; timeout : int        
  ; peername : string
  ; localname : string
  ; local_port : int
  ; community : string
  ; securityName : string
  ; securityAuthProto : Snmp_sec_auth_proto.t
  ; securityAuthPassword : string
}

external snmp_sess_init : unit -> netsnmp_session = "caml_snmp_sess_init"
external snmp_sess_open_c : netsnmp_session -> snmp_session -> t = "caml_snmp_sess_open"
external snmp_sess_close : t -> unit = "caml_snmp_sess_close"
external snmp_sess_synch_response_c
  :  t
  -> Pdu.t
  -> ( Oid.t * ASN1_value.t ) list = "caml_snmp_sess_synch_response"

let snmp_sess_open ~netsnmp_session ~version ~retries ~timeout ~peername ~localname
  ~local_port ~community ~securityName ~securityAuthProto ~securityAuthPassword () =
  let snmp_session = {
    version 
  ; retries 
  ; timeout 
  ; peername 
  ; localname 
  ; local_port 
  ; community 
  ; securityName 
  ; securityAuthProto 
  ; securityAuthPassword 
  }
  in
    snmp_sess_open_c netsnmp_session snmp_session

let snmp_sess_synch_response t pdu =
  snmp_sess_synch_response_c t pdu |> List.rev
OCaml

Innovation. Community. Security.