via application_internal.
OK tb@
-/* $OpenBSD: application.c,v 1.30 2023/11/06 11:02:57 martijn Exp $ */
+/* $OpenBSD: application.c,v 1.31 2023/11/08 19:46:28 martijn Exp $ */
/*
* Copyright (c) 2021 Martijn van Duren <martijn@openbsd.org>
return value;
}
+struct ber_element *
+appl_targetmib(struct ber_oid *oid)
+{
+ struct ber_element *value = NULL;
+
+ if (ober_oid_cmp(oid, &OID(MIB_snmpUnavailableContexts, 0)) == 0)
+ value = ober_add_integer(NULL,
+ snmp_target_mib.snmp_unavailablecontexts);
+ else if (ober_oid_cmp(oid, &OID(MIB_snmpUnknownContexts, 0)) == 0)
+ value = ober_add_integer(NULL,
+ snmp_target_mib.snmp_unknowncontexts);
+
+ if (value != NULL)
+ ober_set_header(value, BER_CLASS_APPLICATION, SNMP_T_COUNTER32);
+ return value;
+}
+
enum appl_error
appl_region(struct appl_context *ctx, uint32_t timeout, uint8_t priority,
struct ber_oid *oid, int instance, int subtree,
-/* $OpenBSD: application.h,v 1.9 2023/11/06 11:02:57 martijn Exp $ */
+/* $OpenBSD: application.h,v 1.10 2023/11/08 19:46:28 martijn Exp $ */
/*
* Copyright (c) 2021 Martijn van Duren <martijn@openbsd.org>
struct ber_element *appl_sysorlastchange(struct ber_oid *);
struct ber_element *appl_sysortable(struct ber_oid *);
struct ber_element *appl_sysortable_getnext(int8_t, struct ber_oid *);
+struct ber_element *appl_targetmib(struct ber_oid *);
enum appl_error appl_register(const char *, uint32_t, uint8_t, struct ber_oid *,
int, int, uint8_t, uint32_t, struct appl_backend *);
enum appl_error appl_unregister(const char *, uint8_t, struct ber_oid *,
-/* $OpenBSD: application_internal.c,v 1.6 2023/11/06 11:02:57 martijn Exp $ */
+/* $OpenBSD: application_internal.c,v 1.7 2023/11/08 19:46:28 martijn Exp $ */
/*
* Copyright (c) 2023 Martijn van Duren <martijn@openbsd.org>
appl_internal_object(&OID(MIB_snmpEngineMaxMsgSize),
appl_internal_engine, NULL);
+ appl_internal_object(&OID(MIB_snmpUnavailableContexts),
+ appl_targetmib, NULL);
+ appl_internal_object(&OID(MIB_snmpUnknownContexts),
+ appl_targetmib, NULL);
+
appl_internal_object(&OID(MIB_usmStatsUnsupportedSecLevels),
appl_internal_usmstats, NULL);
appl_internal_object(&OID(MIB_usmStatsNotInTimeWindow),