Il 06/02/2011 09:25 AM, Dave Shield ha scritto:
> ...snip....
> 
> A possible alternative approach would be to use a simple text string,
> and apply your own internal parsing of the value.
> 
> For example, you could represent a sequence of integer values
> using a string such as
> 
>     "1,1,2,3,5,8,13,21"
> 
> As far as SNMP is concerned, this is a single string value.
> Splitting it up into the separate values would be up to the
> client application.
>    But it has the advantage over an OPAQUE encoding,
> of being meaningful to the human operator looking at the
> raw data.   Never underestimate the utility of this!
> 
> Dave
Hi,
At a first glance I had discarded your suggestion, as you may remember.
But the last sentence was nagging at me. If I could find a generic way
to encode values as string, having the data human-readable would be a
big premium. However, I still wanted a _standard_ way, i.e. something
that would allow _also_ automatic handling.

Then I discovered GSER (rfc 3641), which means Generic String Encoding
Rules and that is _exactly_ what I needed to implement your suggestion:
a _generic_ and _standard_ way to encode any ASN.1 type as a string. It
is a little more cumbersome of the one you suggested, as the integer
sequence you use as example would need two characters more, being
represented as

     {1,1,2,3,5,8,13,21}

but this is not so important (also because the Opaque encoding of this
same sequence would take 28 bytes instead of 19 :D) as it is the fact
that a value of the following ASN.1 type (see the example in clause 8.9
of X.690)

SEQUENCE {name IASString, ok BOOLEAN}

can be encoded as

{name "John Doe", ok TRUE}

(which, with its 26 bytes is longer than the Opaque encoded version 19
bytes, but again this is less important than human readability).

The final argument for using this encoding is, obviously, the fact that
the powers that be liked this proposal a lot better than they did the
use of Opaque :)

Thanks again for the help.



-- 
Leo Cacciari
Aliae nationes servitutem pati possunt populi romani est propria libertas

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to