[AGENT++] Fwd: snmp++ crash issue

N Sarath chandra babu nscbabu at gmail.com
Tue Oct 10 11:13:00 CEST 2006


---------- Forwarded message ----------
From: "N Sarath chandra babu" <nscbabu at gmail.com>
To: agentpp at agentpp.org
Date: Tue, 10 Oct 2006 14:40:07 +0530
Subject: snmp++ crash issue
Hi,
The following code crashes, I run it on windows, I see this happens only
when I set an integer value for a vb.
Any help in this direction is highly appreciated.

Thanks in advance,
--sarath.

#include "../include/snmp_pp/snmp_pp.h"
#include <stdlib.h>
#include <stdio.h>

#ifdef WIN32
#define strcasecmp stricmp
#endif

#ifdef SNMP_PP_NAMESPACE
using namespace Snmp_pp;
#endif

#if (__GNUC__ > 2)
#include <iostream>
using std::cerr;
using std::cout;
using std::cin;
using std::endl;
using std::flush;
#else
#include <iostream.h>
#endif

main ()
{
    Snmp::socket_startup();
    Vb vb;

    UdpAddress address("16.150.10.55");
    address.set_port(161);

    int status;

    Snmp snmp(status, 0, (address.get_ip_version() ==
Address::version_ipv6));

    CTarget ctarget( address);

    ctarget.set_version(version1);         // set the SNMP version SNMPV1 or
V2
    ctarget.set_retry(10);           // set the number of auto retries
    ctarget.set_timeout (5 * 100);         // set timeout
    ctarget.set_readcommunity("public");
    ctarget.set_writecommunity("internal");

    unsigned long i;
    i = 2;
    vb.set_oid("1.3.6.1.4.1.11.2.14.11.1.3.1.1.10.1 "); //Set download
status
    //vb.set_syntax(sNMP_SYNTAX_UINT32);
    vb.set_value(4); //create and go


    /*Oid oid("1.3.6.1.6.1.1");
    vb.set_oid("1.3.6.1.4.1.11.2.14.11.1.3.1.1.5.1 ");
    vb.set_value(oid);*/

    Pdu pdu;
    pdu += vb;
    if ((status = snmp.set(pdu, ctarget)) == SNMP_CLASS_SUCCESS)
    {
        cout <<"hello";
    }
    Snmp::socket_cleanup();
}



More information about the AGENTPP mailing list