Hi MK,
We use something like this ..
public String printEnumNames(MibNode node)
{
StringBuffer buf = new StringBuffer();
MibValueSymbol symb = node.getSymbol();
SnmpObjectType snmpOT = node.getSnmpObjectType();
MibType syntax = snmpOT.getSyntax();
if (syntax != null)
{
if (syntax instanceof IntegerType)
{
IntegerType t = (IntegerType)syntax;
if (t.hasSymbols())
{
MibValueSymbol[] symbs = t.getAllSymbols();
int nr = symbs.length;
for (int i=0; i<nr; i++)
{
MibValueSymbol iSymb = symbs[i];
MibValue value = iSymb.getValue();
Object obj = value.toObject();
buf.append(obj.toString()); // value
buf.append(",");
buf.append(iSymb.getName()); // name
}
buf.append("\n");
}
}
}
return buf.toString();
}
Hope this helps.
Cheers, Birgit
On Mon, Mar 20, 2006 at 02:01:07PM +0530, Srinivasan, Muralikrishna (Murali
Krishna) wrote:
Hi,
I am currently using the 2.6 version of mibble with a --debug option to
produce a fully RESOLVED text.
When enumerated values are resolved
e.g
abcAction OBJECT-TYPE
SYNTAX INTEGER { none(0),
restart(1),
shutdown(2)
}
MIBBLE PRODUCES:
VALUE abcAction OBJECT-TYPE (
Syntax: [UNIVERSAL 2] INTEGER (0 | 1 | 2 )
I WANT the name of the Enums to be produced as well such as
VALUE abcAction OBJECT-TYPE (
Syntax: [UNIVERSAL 2] INTEGER (none,0 | restart,1 | shutdown,2 )
I want none, restart and shutdown to be printed as well.
How can this be done?
I tried changing ValueConstraint.java as
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append(value.getName());
buf.append(",");
buf.append(value.toString());
return buf.toString();
//return value.toString();
}
but found that the values are all NumberValue and so do not have a "name".
Pls Help me out on this.
Thanks
MK.