Defining Scalar Sequence of Dynamic Length in MIB
I'm trying to figure out a way to define a dynamic length sequence of scalars (in this case IpAddress) in a MIB file. I'm fairly certain that just using SYNTAX SEQUENCE OF IpAddress will not work, and I'm unsure of how/if to define a custom entry without explicitly labelling all of its fields (and thus, having to know the size in advance). Is there any way to do this and have it work with the net-snmp API? If this question is confusing, I can try to elaborate more. Th开发者_JS百科anks in advance!
The right thing to do in the SMI structure is to use a table where the index is composed of two different (at least) variables: one of InetAddressType and one of InetAddress. These two Textual Conventions, and the definitions for what the types contain, can be found in the INET-ADDRESS-MIB. You'll find that the first variable will identify the type of IP address and the second will define the value (and is flexible in length so it accommodates IPv4 and IPv6 both, eg).
精彩评论