PERFORCE change 86145 for review
Victor Cruceru
soc-victor at FreeBSD.org
Mon Oct 31 14:08:57 PST 2005
http://perforce.freebsd.org/chv.cgi?CH=86145
Change 86145 by soc-victor at soc-victor_Pentium4 on 2005/10/31 22:07:59
Added the BSNMP module stuff for MTA-MIB.
Affected files ...
.. //depot/projects/soc2005/mta_bsnmp/usr.sbin/bsnmpd/modules/snmp_mta/mta_snmp.c#2 edit
.. //depot/projects/soc2005/mta_bsnmp/usr.sbin/bsnmpd/modules/snmp_mta/mta_snmp.h#1 add
Differences ...
==== //depot/projects/soc2005/mta_bsnmp/usr.sbin/bsnmpd/modules/snmp_mta/mta_snmp.c#2 (text+ko) ====
@@ -28,5 +28,173 @@
*
* MTA-MIB for SNMPd: BSNMP's module related stuff
*/
+#include "mta_snmp.h"
+#include "mta_oid.h"
+#include "mta_tree.h"
+#include <syslog.h>
+#include <stdarg.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <stdlib.h>
+
+/*internal id got after we'll register the MTA-MIB with the agent */
+static
+u_int mta_registration_id = 0;
+
+
+
+/* this our MTA module */
+static
+struct lmodule *mta_module;
+
+static
+const struct asn_oid oid_mta = OIDX_mta;
+/*see the generated file mta_oid.h*/
+
+
+
+struct mta_state mta_state_g;
+
+/*
+ * MTA mib module initialization hook.
+ * Returns 0 on success, < 0 on error
+ */
+static
+int mta_init(struct lmodule * mod,
+ int argc __unused,
+ char *argv[] __unused) {
+
+ mta_module = mod;
+
+ memset(&mta_state_g, 0, sizeof(struct mta_state));
+
+ MTA_DPRINTF((stderr, "[%s] done.\n", __func__));
+ return (0);
+}
+
+/*
+ * MTA mib module finalization hook.
+ * Returns 0 on success, < 0 on error
+ */
+static
+int mta_fini(void) {
+
+ if (mta_registration_id > 0) {
+ or_unregister(mta_registration_id);
+ }
+
+ MTA_DPRINTF((stderr, "[%s] done.\n", __func__));
+ return (0);
+
+}
+
+/*
+ * MTA mib module dump function
+ * returns nothing
+ */
+static
+void mta_dump_v(void) {
+ /*nothing iteresting here for the time being*/
+ MTA_DPRINTF((stderr, "[%s] done.\n ", __func__));
+}
+
+/*
+ * MTA mib module reconfiguration function
+ * returns nothing
+*/
+static
+void mta_config_v(void) {
+ /*nothing iteresting here for the time being*/
+ MTA_DPRINTF((stderr, "[%s] done.\n ", __func__));
+}
+
+
+
+static
+void mta_loading_v(const struct lmodule *mod __unused, int loaded)
+{
+ /*nothing iteresting here for the time being*/
+ if ( loaded == 1 ) {
+ goto LABEL_RETURN;
+ }
+LABEL_RETURN:;
+ MTA_DPRINTF((stderr,"[%s] done.\n ", __func__));
+
+}
+
+/*
+ * MTA mib module start operation
+ * returns nothing
+ */
+static
+void mta_start_v(void) {
+ mta_registration_id = or_register(&oid_mta,
+ "The MIB module for MTA MIB (rfc 2789).",
+ mta_module);
+ if (mta_registration_id == 0) {
+ syslog(LOG_ERR, "Failed to register the TCP-MIB.");
+ return;
+ }
+
+ MTA_DPRINTF((stderr, "[%s] done.\n ", __func__));
+}
+
+/*
+ * This identifies the MTA mib module
+ * inside the agent
+ */
+const struct snmp_module config = {
+ "This module implements the MTA-MIB (rfc 2789)",
+ mta_init,
+ mta_fini,
+ NULL, /*idle function, do not use it*/
+ mta_dump_v,
+ mta_config_v,
+ mta_start_v,
+ NULL, /* proxy a PDU */
+ mta_ctree, /* see the generated mta_tree.h */
+ mta_CTREE_SIZE, /* see the generated mta_tree.h */
+ mta_loading_v
+};
+
+
+
+int
+op_mtaTable(struct snmp_context __unused *ctx,
+ struct snmp_value __unused *val,
+ u_int __unused sub, u_int __unused vindex,
+ enum snmp_op __unused op)
+{
+ return (SNMP_ERR_NOSUCHNAME);
+}
+
+
+int
+op_mtaGroupTable(struct snmp_context __unused *ctx,
+ struct snmp_value __unused *val,
+ u_int __unused sub, u_int __unused vindex,
+ enum snmp_op __unused op)
+{
+ return (SNMP_ERR_NOSUCHNAME);
+}
+
+int
+op_mtaGroupAssociationTable(struct snmp_context __unused *ctx,
+ struct snmp_value __unused *val,
+ u_int __unused sub, u_int __unused vindex,
+ enum snmp_op __unused op)
+{
+ return (SNMP_ERR_NOSUCHNAME);
+}
+
+int
+op_mtaGroupErrorTable(struct snmp_context __unused *ctx,
+ struct snmp_value __unused *val,
+ u_int __unused sub, u_int __unused vindex,
+ enum snmp_op __unused op)
+{
+ return (SNMP_ERR_NOSUCHNAME);
+}
More information about the p4-projects
mailing list