Hi,

I am using Net-SNMP version 5.0.9. I need a clarification on code
generated for 'snmpTrapOID' object. 

Following the part of the code generated for the coldStart trap. I have
attached full code with the mail (coldStart.c).

static oid snmptrap_oid[] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};

According to SNMPv2-MIB, snmpTrapOID is snmpTrap.1, in that case I think
an extra '0' getting appended at the end. 

Please clarify.

Thanks
Sridhar
/*
 * Note: this file originally auto-generated by mib2c using
 *        : mib2c.notify.conf,v 5.2.2.1 2004/04/15 12:29:06 dts12 Exp $
 */

#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "coldStart.h"

static oid snmptrap_oid[] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};

int
send_coldStart_trap( void )
{
    netsnmp_variable_list  *var_list = NULL;
    oid coldStart_oid[] = { 1,3,6,1,6,3,1,1,5,1 };

    /*
     * Set the snmpTrapOid.0 value
     */
    snmp_varlist_add_variable(&var_list,
        snmptrap_oid, OID_LENGTH(snmptrap_oid),
        ASN_OBJECT_ID,
        coldStart_oid, sizeof(coldStart_oid));
    

    /*
     * Add any extra (optional) objects here
     */

    /*
     * Send the trap to the list of configured destinations
     *  and clean up
     */
    send_v2trap( var_list );
    snmp_free_varbind( var_list );

    return SNMP_ERR_NOERROR;
}

Reply via email to