[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

9592.0. "sequence and oid2instance()" by TAEC::RAYBAUD () Wed Apr 23 1997 05:30

Hi,

I am trying to develop a sub-agent with the esnmp APIs and I am in trouble 
with getting back the name of the required instance value.
The instance is defined as a sequence :

ttrEntry OBJECT-TYPE
	SYNTAX TtrEntry
	ACCESS not-accessible
	STATUS mandatory
	DESCRIPTION
		"An entry in the TTRTable"
	INDEX {ttrId,ttrParentId}
	::={ttrTable 1}

ttrId is INTEGER (0..3)
ttrParentId is DisplayString

oid2instance() returns 0 as the instance value.
Moreover, the oid received is ended by 0 and not by the instance value.

Is there a problem with esnmp when we use a sequence as the instance name ?

Regards,

sacha 
T.RTitleUserPersonal
Name
DateLines
9592.1SMURF::DANIELEWed Apr 23 1997 10:0855
>                      <<< Note 9592.0 by TAEC::RAYBAUD >>>
>                        -< sequence and oid2instance() >-

>Hi,

>I am trying to develop a sub-agent with the esnmp APIs and I am in trouble >
>with getting back the name of the required instance value.

The instance portion of the oid in a SNMP request could be anything.
It need not fully qualify the object identifier prefix that it
references.

For instance, if snmpd receives a a GetNext request for the oid 1.2.3.4.5,
and your subagent has registered the subtree 1.2.3, your subagent will be 
dispatched to.

>The instance is defined as a sequence :

>ttrEntry OBJECT-TYPE
>	SYNTAX TtrEntry
>	ACCESS not-accessible
>	STATUS mandatory
>	DESCRIPTION
>		"An entry in the TTRTable"
>	INDEX {ttrId,ttrParentId}
>	::={ttrTable 1}

>ttrId is INTEGER (0..3)
>ttrParentId is DisplayString

>oid2instance() returns 0 as the instance value.
>Moreover, the oid received is ended by 0 and not by the instance value.

Within your subagent, libesnmp.so finds the OBJECT in the
object table you registered that is the longest oid match with the
requested oid.  oid2instance returns the remainder when you "subtract"
the OBJECT's oid (the object identifier prefix) from the requested oid.

It could be anything.  A return value of 0 (the instance length)
means the requested oid is exactly the same as the OBJECT's oid.

>Is there a problem with esnmp when we use a sequence as the instance name ?

No.  I think you're just not understanding the basic operation of a method
routine.  oid2instance tells you what the requested instance was (with
respect to the OBJECT pointed to in the METHOD).  You need to figure out
if you can return something, and if so, what its instance value should be.

Have you read the chapter on eSNMP in Network Programming?

I'm going to move these notes to be replies to 1315.  Please follow up
there.

Regards,
Mike