/*							-- DO NOT EDIT --
 * This file has been generated by smidump
 * version 0.3.1 for the scli package.
 *
 * Derived from SNMP-MPD-MIB:
 *   The MIB for Message Processing and Dispatching
 *
 * Revision 1999-05-04 16:36:
 *   Updated addresses, published as RFC 2572.
 *
 * Revision 1997-09-30 00:00:
 *   Original version, published as RFC 2272.
 *
 * $Id: snmp-mpd-mib.c,v 1.16 2002/03/27 13:48:22 schoenw Exp $
 */

#include "snmp-mpd-mib.h"

static guint32 const snmpMPDStats_oid[] = {1, 3, 6, 1, 6, 3, 11, 2, 1};

static GSnmpAttribute snmpMPDStats_attr[] = {
    { 1, G_SNMP_COUNTER32,
      SNMP_MPD_MIB_SNMPUNKNOWNSECURITYMODELS, "snmpUnknownSecurityModels",
       NULL,
      G_STRUCT_OFFSET(snmp_mpd_mib_snmpMPDStats_t, snmpUnknownSecurityModels),
      0,
      0 },
    { 2, G_SNMP_COUNTER32,
      SNMP_MPD_MIB_SNMPINVALIDMSGS, "snmpInvalidMsgs",
       NULL,
      G_STRUCT_OFFSET(snmp_mpd_mib_snmpMPDStats_t, snmpInvalidMsgs),
      0,
      0 },
    { 3, G_SNMP_COUNTER32,
      SNMP_MPD_MIB_SNMPUNKNOWNPDUHANDLERS, "snmpUnknownPDUHandlers",
       NULL,
      G_STRUCT_OFFSET(snmp_mpd_mib_snmpMPDStats_t, snmpUnknownPDUHandlers),
      0,
      0 },
    { 0, 0, 0, NULL }
};


snmp_mpd_mib_snmpMPDStats_t *
snmp_mpd_mib_new_snmpMPDStats()
{
    snmp_mpd_mib_snmpMPDStats_t *snmpMPDStats;

    snmpMPDStats = (snmp_mpd_mib_snmpMPDStats_t *) g_malloc0(sizeof(snmp_mpd_mib_snmpMPDStats_t) + sizeof(gpointer));
    return snmpMPDStats;
}

static snmp_mpd_mib_snmpMPDStats_t *
assign_snmpMPDStats(GSList *vbl)
{
    snmp_mpd_mib_snmpMPDStats_t *snmpMPDStats;
    char *p;

    snmpMPDStats = snmp_mpd_mib_new_snmpMPDStats();
    if (! snmpMPDStats) {
        return NULL;
    }

    p = (char *) snmpMPDStats + sizeof(snmp_mpd_mib_snmpMPDStats_t);
    * (GSList **) p = vbl;

    gsnmp_attr_assign(vbl, snmpMPDStats_oid, sizeof(snmpMPDStats_oid)/sizeof(guint32),
                      snmpMPDStats_attr, snmpMPDStats);

    return snmpMPDStats;
}

void
snmp_mpd_mib_get_snmpMPDStats(GSnmpSession *s, snmp_mpd_mib_snmpMPDStats_t **snmpMPDStats, gint mask)
{
    GSList *in = NULL, *out = NULL;
    static guint32 base[] = {1, 3, 6, 1, 6, 3, 11, 2, 1, 0};

    *snmpMPDStats = NULL;

    gsnmp_attr_get(s, &in, base, 10, 9, snmpMPDStats_attr, mask);

    out = g_snmp_session_sync_getnext(s, in);
    g_snmp_vbl_free(in);
    if (out) {
        if (s->error_status != G_SNMP_ERR_NOERROR) {
            g_snmp_vbl_free(out);
            return;
        }
        *snmpMPDStats = assign_snmpMPDStats(out);
    }
}

void
snmp_mpd_mib_free_snmpMPDStats(snmp_mpd_mib_snmpMPDStats_t *snmpMPDStats)
{
    GSList *vbl;
    char *p;

    if (snmpMPDStats) {
        p = (char *) snmpMPDStats + sizeof(snmp_mpd_mib_snmpMPDStats_t);
        vbl = * (GSList **) p;
        g_snmp_vbl_free(vbl);
        g_free(snmpMPDStats);
    }
}


