[SNMP4J] Create PDU from ByteBuffer

Norman Elton normelton at gmail.com
Fri May 30 16:24:19 CEST 2008


I dug through the code some more. It looks like I'll have to handle
the header information myself. I whipped up some code that reads the
header, figures out whether it's a v1/v2 packet, creates a PDU object,
and calls decodeBER. Things seem to be working fine.

Thanks again!

Norman

On Fri, May 30, 2008 at 9:29 AM, Norman Elton <normelton at gmail.com> wrote:
> Frank,
>
> Thanks for the tip. It appears that this method requires that I
> process and strip off the SNMP version and community string, as well
> as the wrapper surrounding the entire SNMP message. Is there a method
> someplace that can take care of this for me?
>
> Thanks!
>
> Norman
>
> On Thu, May 29, 2008 at 6:56 PM, Frank Fock <fock at agentpp.com> wrote:
>> Hi Norman,
>>
>> it is as simple as
>>
>> BERInputStream berInputStream =
>>        new BERInputStream(myByteBuffer);
>> PDU pdu = new PDU();
>> pdu.decodeBER(berInputStream);
>>
>> Best regards,
>> Frank
>>
>> Norman Elton wrote:
>>>
>>> I've got a server that listens for both SNMP PDUs and Radius requests
>>> (long story). Right now, I've got one thread that extends
>>> CommandResponder and is listening for incoming PDUs, and another
>>> thread running a DatagramChannel listening for Radius UDP packets.
>>>
>>> I'd like to streamline this and have one thread, calling a select() on
>>> two DatagramChannels. When I get a SNMP PDU; however, I don't see a
>>> way to instantiate a PDU object to "decode" the packet.
>>>
>>> Is there a way to create a PDU from a given ByteBuffer that's already
>>> been read off the wire, rather than having SNMP run it's own
>>> "listener"?
>>>
>>> Hope this makes sense, thanks for your help!
>>>
>>> Norman Elton
>>>
>>> =======
>>> Network Engineering
>>> College of William & Mary
>>> _______________________________________________
>>> SNMP4J mailing list
>>> SNMP4J at agentpp.org
>>> http://lists.agentpp.org/mailman/listinfo/snmp4j
>>
>> --
>> AGENT++
>> http://www.agentpp.com
>> http://www.mibexplorer.com
>> http://www.mibdesigner.com
>>
>



More information about the SNMP4J mailing list