How do I get the size of an OBJECT STRING?

Hi, I'm in a "quest" to rewrite Wireshark's snmp dissector with the goals of improving "filterability" of snmp packets (at the same time we'll get rid of the net-snmp dependecy that depends on open-ssl whose license isn't GPL compatible).
I believe being able to filter on indexes of conceptual tables is far more interesting that to filter on any given value of an object's instance.
I already implemented extracting the integer based indexes and (to some degree) those based on implicit octet strings but I got stuck on fixed-length strings.
I haven't been able to figure out how to obtain the fixed length of a non-implied object string index element given:
elNode = smiGetElementNode(smiElementPtr) && elType = smiGetNodeType(elNode) && elType->basetype == SMI_BASETYPE_OCTETSTRING
Any help would be welcome. BR Luis

Hi Luis!
Luis EG Ontanon wrote:
I haven't been able to figure out how to obtain the fixed length of a non-implied object string index element given:
elNode = smiGetElementNode(smiElementPtr) && elType = smiGetNodeType(elNode) && elType->basetype == SMI_BASETYPE_OCTETSTRING
Length restrictions for strings are stored in smiRanges. Use smiGetFirstRange( smiTypePtr ) / smiGetNextRange( smiRangePtr ) to retrieve this information. In case of a fixed-length string there should be only one smiRange, and within this smiRange struct, minvalue and maxvalue should be equal. When dealing with non-implied types, also have a look at the ranges of the parent type (smiGetParentType( smiTypePtr )).
Best regards, Torsten

On Fri, Aug 24, 2007 at 10:42:34AM +0200, Torsten Klie wrote:
Hi Luis!
Luis EG Ontanon wrote:
I haven't been able to figure out how to obtain the fixed length of a non-implied object string index element given:
elNode = smiGetElementNode(smiElementPtr) && elType = smiGetNodeType(elNode) && elType->basetype == SMI_BASETYPE_OCTETSTRING
Length restrictions for strings are stored in smiRanges. Use smiGetFirstRange( smiTypePtr ) / smiGetNextRange( smiRangePtr ) to retrieve this information. In case of a fixed-length string there should be only one smiRange, and within this smiRange struct, minvalue and maxvalue should be equal. When dealing with non-implied types, also have a look at the ranges of the parent type (smiGetParentType( smiTypePtr )).
A slightly simpler check is possible using the utility functions smiGetMinSize() and smiGetMaxSize() since they automatically do the recursion:
isFixedLength = (smiGetMinSize(elType) == smiGetMaxSize(elType))
/js

On 8/24/07, Juergen Schoenwaelder j.schoenwaelder@jacobs-university.de wrote:
On Fri, Aug 24, 2007 at 10:42:34AM +0200, Torsten Klie wrote:
Hi Luis!
Luis EG Ontanon wrote:
I haven't been able to figure out how to obtain the fixed length of a non-implied object string index element given:
elNode = smiGetElementNode(smiElementPtr) && elType = smiGetNodeType(elNode) && elType->basetype == SMI_BASETYPE_OCTETSTRING
Length restrictions for strings are stored in smiRanges. Use smiGetFirstRange( smiTypePtr ) / smiGetNextRange( smiRangePtr ) to retrieve this information. In case of a fixed-length string there should be only one smiRange, and within this smiRange struct, minvalue and maxvalue should be equal. When dealing with non-implied types, also have a look at the ranges of the parent type (smiGetParentType( smiTypePtr )).
A slightly simpler check is possible using the utility functions smiGetMinSize() and smiGetMaxSize() since they automatically do the recursion:
isFixedLength = (smiGetMinSize(elType) == smiGetMaxSize(elType))
I think this is the way, I'm surprised I did not find them myself!

I reply to myself....
On 8/24/07, Luis EG Ontanon luis.ontanon@gmail.com wrote:
On 8/24/07, Juergen Schoenwaelder j.schoenwaelder@jacobs-university.de wrote:
A slightly simpler check is possible using the utility functions smiGetMinSize() and smiGetMaxSize() since they automatically do the recursion:
I think this is the way, I'm surprised I did not find them myself!
Now I know why I did not find them myself: when I looked for them I was in my office where I have built stock 0.4.5. When I found them after your hint I was at home instead and they are there because I'm working on svn's HEAD.
Unfortunatelly I got to use a stock release because that's probably what autoconf will find for.
So I'll have to do that myself.
Luis
participants (3)
-
Juergen Schoenwaelder
-
Luis EG Ontanon
-
Torsten Klie