[SNMP4J] PDU Trap Version

David Ishmael dishmael at opsvision.com
Sat Aug 8 16:43:28 CEST 2015


Hi Frank - thanks for the info.  I saw the Message Processing Model in the javadocs but the MPv2u version and indexing threw me off.  Is it safe to assume…

0 = 1
1 = 2c
3 = 3

- Dave


On Aug 8, 2015, at 10:30 AM, Frank Fock <fock at agentpp.com<mailto:fock at agentpp.com>> wrote:

Hi David,
The messageProcessingModel parameter of the CommandResponderEvent object provides the SNMP version directly.
Best regards
Frank

Am 07.08.2015 um 18:17 schrieb David Ishmael <dishmael at opsvision.com<mailto:dishmael at opsvision.com>>:

Hey all - What is the best way to determine the PDU version in a trap receiver using SNMP4J?  Here’s what I have and I think this works but I’m wondering if there’s a better way...

public synchronized void processPdu(CommandResponderEvent cmdRespEvent) {
  PDU pdu = cmdRespEvent.getPDU();
  switch(pdu.getType()) {
      case PDU.V1TRAP:
          …
          break;

      case -89: // v2c?
          …
          break;

      default:  // v3?
          …
  }
}


Thanks, Dave
_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org<mailto:SNMP4J at agentpp.org>
https://oosnmp.net/mailman/listinfo/snmp4j



More information about the SNMP4J mailing list