
I'm having some issues with the SmiType handling. Specifically, when is the name parameter NULL, and when isn't it?
If I load rfc1907, and get the node for sysDescr then get the type for that node, the name field is NULL. If I then get the parent type, there I see that the name field has "DisplayString" in it.
However, if I load a test mib I wrote, which imports DisplayString, and has a variable of syntax DisplayString, the type structure for that variable has DisplayString in the name (without having to look at the parent).
I don't see what distinguishes these two cases? Why in one case do I have to go the parent type to find the DisplayString "name" while in the other case I don't? Both import DisplayString from SNMPv2-TC.
Also, rfc1907 imports TimeStamp from SNMPv2-TC, but sysORLastChange has TimeStamp directly in the name field of it's type. Again, why is DisplayString part of the parent type, while TimeStamp is not?
Can someone explain this seeming inconsistency?
Thanks, Pete Flugstad

Hi Pete!
On Tue, Mar 11, 2003 at 04:33:52PM -0600, Pete Flugstad wrote:
I'm having some issues with the SmiType handling. Specifically, when is the name parameter NULL, and when isn't it?
The name parameter is NULL for all implicit types. Types that are derived from another type but implicitly define a range restriction are considered to be implicit types.
If I load rfc1907, and get the node for sysDescr then get the type for that node, the name field is NULL. If I then get the parent type, there I see that the name field has "DisplayString" in it.
The key is in the SYNTAX line of sysDesc: [snip] ... sysDescr OBJECT-TYPE SYNTAX DisplayString (SIZE(0..255)) ... [snip]
We have an implicit type here because the type DisplayString is not used "as is" but another range restriction has been specified. The type used here is an implicit type derived from DisplayString (although the new range restriction does not differ from the range restriction of the parent type).
However, if I load a test mib I wrote, which imports DisplayString, and has a variable of syntax DisplayString, the type structure for that variable has DisplayString in the name (without having to look at the parent).
In this case, you probably have used the DisplayString without redefining the range restriction.
Also, rfc1907 imports TimeStamp from SNMPv2-TC, but sysORLastChange has TimeStamp directly in the name field of it's type. Again, why is DisplayString part of the parent type, while TimeStamp is not?
Here, the type TimeStamp is used directly. It is not a new (implicit) type derived from TimeStamp.
You can see whether a type is implicit or not by looking at 'decl' of the struct SmiType. If it is equal to SMI_DECL_IMPLICIT_TYPE you are dealing with an implicit type.
Regards, Torsten

Excellant. Thank you very much - I don't know how I missed that.
Pete Flugstad Icon Labs
participants (2)
-
Pete Flugstad
-
Torsten Klie