mibble-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mibble-devel] Fix for set operations on counter and gauge.


From: Paul Faid
Subject: [Mibble-devel] Fix for set operations on counter and gauge.
Date: Tue, 24 Oct 2006 15:14:16 +1300

Hi,

I'm considering using Mibble in an application I need to put together,
and while playing around I found a bug in the interface between Mibble
and the Westhawk SNMP stack.  In the Mibble MIB browser, if you
attempt a Set operation on a counter or gauge, you get a 'Bad value
error'. This is because the type of the unsigned integer not being
set, and it defaults to TimeTicks.

I've modified the code as below and it now works ok for me.

In SNMPManager.java the method

public AsnObject createAsnValue(SnmpRequest request) throws SnmpException {
       ...
       ...
     } else if (type.hasTag(MibTypeTag.APPLICATION_CATEGORY, 1)) {
           // Counter
           //return new AsnUnsInteger(parseInteger(value));   <- original call
           return new AsnUnsInteger(parseInteger(value),
SnmpConstants.COUNTER);
       } else if (type.hasTag(MibTypeTag.APPLICATION_CATEGORY, 2)) {
           // Gauge
           //return new AsnUnsInteger(parseInteger(value));    <-
original call
           return new AsnUnsInteger(parseInteger(value), SnmpConstants.GAUGE);
       } else if (type.hasTag(MibTypeTag.APPLICATION_CATEGORY, 3)) {
           // TimeTicks
           // return new AsnUnsInteger(parseInteger(value));   <-
original call
           return new AsnUnsInteger(parseInteger(value),
SnmpConstants.TIMETICKS);
       ...
       ...
}

Cheers
Paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]