# Maximum size of a value of a Variable Binding - SNMP

This is a discussion on Maximum size of a value of a Variable Binding - SNMP ; Hello, I would like to knwon what is the maximum size of a value of a Variable Binding. I get a value of an Oid and convert it in a String to print it. So i would like the maximum ...

# Thread: Maximum size of a value of a Variable Binding

1. ## Maximum size of a value of a Variable Binding

Hello,

I would like to knwon what is the maximum size of a value of a
Variable Binding.
I get a value of an Oid and convert it in a String to print it. So i
would like the maximum of the lenght of this string?

I use winsnmp and i know tha there is a smi Structure but i just
search for the max size.

Thanks a lot!!

2. ## Re: Maximum size of a value of a Variable Binding

jeff wrote:

> I would like to knwon what is the maximum size of a value of a
> Variable Binding.

Depends on the data type. OCTET STRINGs are limited to 64 K and OIDs
are limited to 128 subidentifier where each subidentifier (except the
first two) can hold a number up to 2^31. Note that there are cases
where the 128 subidentifier limit is really reached and there are
some folks very unhappy with this.

> I get a value of an Oid and convert it in a String to print it. So i
> would like the maximum of the lenght of this string?

2^31 = 2147483648 which requires 10 characters. If you add a seperator
('.'), then 128 * (10 + 1) = 1408 characters should be a rough
estimation (a bit too much). But since the 128 subidentifier limit
is somewhat under debate and since long OIDs show up rather
infrequently, you might want to consider to write smart code that
uses less memory in the typical case but might even handle OIDs
longer than 128 subidentifiers (even though they currently should
not appear on the net - but the Postel principle applies anyway).

/js

--
Juergen Schoenwaelder International University Bremen
P.O. Box 750 561, 28725 Bremen, Germany

3. ## Re: Maximum size of a value of a Variable Binding

Juergen Schoenwaelder wrote:
> jeff wrote:
>
>
>>I would like to knwon what is the maximum size of a value of a
>>Variable Binding.

>
>
> Depends on the data type. OCTET STRINGs are limited to 64 K and OIDs
> are limited to 128 subidentifier where each subidentifier (except the
> first two) can hold a number up to 2^31. Note that there are cases
> where the 128 subidentifier limit is really reached and there are
> some folks very unhappy with this.

There's also a practical size limit in a UDP (and hence SNMP) packet,
right? So is it reallistic to have OCTET STRINGs which actually
exceed 1 or 2 K ?

-- daniel

4. ## Re: Maximum size of a value of a Variable Binding

Daniel FUCHS wrote:

> There's also a practical size limit in a UDP (and hence SNMP) packet,
> right? So is it reallistic to have OCTET STRINGs which actually
> exceed 1 or 2 K ?

The standards say that 464 bytes must be supported by every
implementation. So this is the number which you can really count
on. Sure, it is a small number.

Most implementations these days support message sizes that are close
the "Internet MTU" around 1500 bytes. You can in many cases also send
larger messages, but they might get fragmented which increases the
likelihood that the packet gets lost (of course, this is a function
of the bit rate and load of the network).

Note also that SNMP engines usually have fixed buffers to handle
messages. SNMPv3 communicates the max. message size an engine is
going to accept while SNMPv1/SNMPv2c does not.

Note: If you run SNMP over TCP (RFC 3430), then messages up to a size
of 8192 bytes must be supported and larger sizes are encouraged:

When an SNMP entity uses the TCP transport mapping, it MUST be
capable of accepting and generating messages that are at least 8192
octets in size. Implementation of larger values is encouraged
whenever possible.

So if you want to send large chunks of data around, you may want to
look at other transports that can help.

/js

--
Juergen Schoenwaelder International University Bremen
P.O. Box 750 561, 28725 Bremen, Germany