HI,

Let me be stronger in response than Dave Shield.
See inline below.

On Tue, 20 Jun 2006, Dave Shield wrote:
> [EMAIL PROTECTED] wrote:
 
> >                                     But are _all_ OIDs that end in
> >0 scalars?  Is that just a convention or is it a contraint imposed by
> >SNMP or an unavoidable outcome of how OIDs are generated and handled? 
> >  
> >
> It's a convention.
The statement "It's a convention" is not correct.
The rules are the following for OIDs used to identify objects:
1) An Object type (an object class) that is a columnar or leaf
   object is identified by an OID value (called it's name).
   The last sub-identifier cannot be zero. (See RFC 2578,
   last paragraph of section 7.10).
2) The SNMP protocol does not provide access to classes of
   objects, but to instances of objects. An OID value
   identifies (names) an instance of an object type.
   Such an OID value is called an SNMP variable.
   If the object type is a scalar, then the SNMP
   variable is the OID value that is the OID value
   for the object type with an additional sub-idenfier
   of zero. For object types that are columnar,
   RFC 2578 specifies in section 7.7 how to create
   a sequence of sub-identifiers that are added
   to the end of the OID value that identifies
   the object type.

The result is that the variable (an OID value) that
identifies any instance of a scalar always ends with
a sub-identifier with a value of zero. However,
the OID value that identify an instance of a
columnar object type MAY have zero as the last
sub-identifier value.

Index values that are used to create the sequence
of sub-identifiers may be integers, strings, or
OID values.  Dave Shield quotes below the
recommendation for use of integer values...

> There's nothing to say that you *can't* have a table index value of 0,
> though it's not recommended.  From RFC 2578:
> 
> 7.7.  Mapping of the INDEX clause
> 
>    Instances identified by use of integer-valued objects should be
>    numbered starting from one (i.e., not from zero).  The use of zero as
>    a value for an integer-valued index object should be avoided, except
>    in special cases.
>
This recommendation is present because it was found that
in many cases a MIB designer needed an index value that
was used, for example in a reference, to mean that an
instance didn't exist. A value of, say, -1 would not
work. On the other hand, a value of zero ncould be used
to indicate a nonexisting item in a reference, just
like "NULL" is used for pointers in programming
languaged. However, the above says "should" and not
"must", so it is legal.
 
> >The reason I ask if that I need to create a MIB for something that looks
> >a lot like memory and it would be natural -- for my code and for the
> >user -- to start my table indices at 0 but I'm not sure I can.
> >  
> >
> 
> This is not forbidden, although it is discouraged.
> Only you can tell whether your situation is a legitimate "special case".
> The SNMP specifications don't try to dictate what this means.
> 
> Dave

Regards,
/david t. perkins




_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to