[SNMP4J] Creating index for adding row to table entry

Frank Fock fock at agentpp.com
Fri Oct 9 09:00:12 CEST 2009


Hi Pradip,

The toSubIndex(..) methods of the SMI types
are used to form an index OID from SNMP values.
It does *not* hash the values. It simply
transforms them. For OctetStrings, it uses each
characters decimal value as OID sub-identifier.

To generate a integer index, you can use:

IndexGenerator ig = new IndexGenerator(new Integer32(0));
OID nextIndex = ig.nextSubIndex();

Regards,
Frank

pradip de wrote:
> Hi,
> What is the typical technique for generating an index to add a row in a
> table ? What does the OctetString.toSubIndex(boolean) actually do? Does it
> generate a OID index by using some kind of hashing mechanism over the
> OCtetString? Should I use an OctetString that I can assume to be unique for
> each row I add and use it to create an index? I have no problem with this
> but sometimes it generates a really long OID for that field. How do I get
> index values of single integers incremented each time I add a row?
> thanks,
> Pradip
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list