summaryrefslogtreecommitdiff
path: root/lib/snmpclient.h
diff options
context:
space:
mode:
authorHartmut Brandt <harti@FreeBSD.org>2018-07-27 19:30:18 +0000
committerHartmut Brandt <harti@FreeBSD.org>2018-07-27 19:30:18 +0000
commitcf7f444550f07e0e64bc037f6454eb721dd3df67 (patch)
tree7f3e298082cdf4691c309bc67c630e492853a652 /lib/snmpclient.h
parentb9d1a85f5eb78a276f3accf6c9f449f1d1ce2039 (diff)
Notes
Diffstat (limited to 'lib/snmpclient.h')
-rw-r--r--lib/snmpclient.h58
1 files changed, 36 insertions, 22 deletions
diff --git a/lib/snmpclient.h b/lib/snmpclient.h
index e137b4c9bf05..e7454b104ef5 100644
--- a/lib/snmpclient.h
+++ b/lib/snmpclient.h
@@ -5,7 +5,7 @@
*
* Author: Harti Brandt <harti@freebsd.org>
* Kendy Kutzner
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -14,7 +14,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -59,7 +59,7 @@ typedef void (*snmp_send_cb_f)(struct snmp_pdu *, struct snmp_pdu *, void *);
typedef void (*snmp_timeout_cb_f)(void * );
/* timeout start function */
-typedef void *(*snmp_timeout_start_f)(struct timeval *timeout,
+typedef void *(*snmp_timeout_start_f)(struct timeval *timeout,
snmp_timeout_cb_f callback, void *);
/* timeout stop function */
@@ -69,36 +69,47 @@ typedef void (*snmp_timeout_stop_f)(void *timeout_id);
* Client context.
*/
struct snmp_client {
- enum snmp_version version;
- int trans; /* which transport to use */
+ enum snmp_version version;
+ int trans; /* which transport to use */
/* these two are read-only for the application */
- char *cport; /* port number as string */
- char *chost; /* host name or IP address as string */
+ char *cport; /* port number as string */
+ char *chost; /* host name or IP address as string */
+
+ char read_community[SNMP_COMMUNITY_MAXLEN + 1];
+ char write_community[SNMP_COMMUNITY_MAXLEN + 1];
- char read_community[SNMP_COMMUNITY_MAXLEN + 1];
- char write_community[SNMP_COMMUNITY_MAXLEN + 1];
+ /* SNMPv3 specific fields */
+ int32_t identifier;
+ int32_t security_model;
+ struct snmp_engine engine;
+ struct snmp_user user;
- struct timeval timeout;
- u_int retries;
+ /* SNMPv3 Access control - VACM*/
+ uint32_t clen;
+ uint8_t cengine[SNMP_ENGINE_ID_SIZ];
+ char cname[SNMP_CONTEXT_NAME_SIZ];
- int dump_pdus;
+ struct timeval timeout;
+ u_int retries;
- size_t txbuflen;
- size_t rxbuflen;
+ int dump_pdus;
- int fd;
+ size_t txbuflen;
+ size_t rxbuflen;
- int32_t next_reqid;
- int32_t max_reqid;
- int32_t min_reqid;
+ int fd;
- char error[SNMP_STRERROR_LEN];
+ int32_t next_reqid;
+ int32_t max_reqid;
+ int32_t min_reqid;
- snmp_timeout_start_f timeout_start;
- snmp_timeout_stop_f timeout_stop;
+ char error[SNMP_STRERROR_LEN];
- char local_path[sizeof(SNMP_LOCAL_PATH)];
+ snmp_timeout_start_f timeout_start;
+ snmp_timeout_stop_f timeout_stop;
+
+ char local_path[sizeof(SNMP_LOCAL_PATH)];
};
/* the global context */
@@ -181,6 +192,9 @@ int snmp_table_fetch_async(const struct snmp_table *, void *,
/* send a request and wait for the response */
int snmp_dialog(struct snmp_pdu *_req, struct snmp_pdu *_resp);
+/* discover an authorative snmpEngineId */
+int snmp_discover_engine(char *);
+
/* parse a server specification */
int snmp_parse_server(struct snmp_client *, const char *);