From owner-p4-projects@FreeBSD.ORG Mon Oct 31 22:08:56 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4F49216A424; Mon, 31 Oct 2005 22:08:56 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E7DA716A428 for ; Mon, 31 Oct 2005 22:08:55 +0000 (GMT) (envelope-from soc-victor@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id A33FC43D45 for ; Mon, 31 Oct 2005 22:08:55 +0000 (GMT) (envelope-from soc-victor@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j9VM8tvE089691 for ; Mon, 31 Oct 2005 22:08:55 GMT (envelope-from soc-victor@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j9VM8t92089688 for perforce@freebsd.org; Mon, 31 Oct 2005 22:08:55 GMT (envelope-from soc-victor@freebsd.org) Date: Mon, 31 Oct 2005 22:08:55 GMT Message-Id: <200510312208.j9VM8t92089688@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to soc-victor@freebsd.org using -f From: Victor Cruceru To: Perforce Change Reviews Cc: Subject: PERFORCE change 86145 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2005 22:08:57 -0000 http://perforce.freebsd.org/chv.cgi?CH=86145 Change 86145 by soc-victor@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 +#include +#include +#include +#include +#include + +/*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); +}