[prev in list] [next in list] [prev in thread] [next in thread] 

List:       net-snmp-coders
Subject:    Re: ASN.1 and Request ID field
From:       Magnus Fromreide <magfr () lysator ! liu ! se>
Date:       2014-06-03 23:19:33
Message-ID: 20140603231933.GA18512 () sara ! home
[Download RAW message or body]

On Tue, Jun 03, 2014 at 12:50:28PM -0700, Juges, Didier wrote:
> Snmp newbie here, so bear WITH ME PLEASE...
> 
> I am confused and I hope someone can help.
> 
> I am writing an SNMP agent for a Cortex M4 application.
> The SNMP books I have bought and what I have read on the net indicate that all data \
> fields should be ASN.1 encoded However, looking at snmp commands sent by net-snmp, \
> it appears that the Request ID field is a simple (4 byte) 32 bit integer. Here is a \
> screen shot showing an snmpget transaction monitored through Wireshark: 
> http://www.ko4bb.com/net-snmp/RequestID.png
> 
> It shows the RequestID to be 1750020546 (decimal) and 0x684F31C2 in hex. The data \
> field in Wireshark also shows it to be "68 4f 31 c2" This is not ASN.1 encoded, \
> otherwise the first 3 bytes would have their bit 7 set to 1 and the last byte would \
> have bit 7 set to 0, meaning the  first 3 values would be >0x7F and the last value \
> should be < 0x80 
> So is ASN.1 not used for the RequestID field?
> 
> I know OIDs *are* ASN.1 encoded, but how about the other fields?
> How about the data field in a varbind?

You have misunderstood BER encoding.

The rules you quote above describe how the length part is encoded but the data
is encoded as a signed integer value just like you have observed.

/MF

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic