SNMP Manager Programmer's Guide

Constructing and Interpreting Packets
SNMP Manager Programmer’s Guide–134249
5-26
SNMP_Bind_Object_ID()
instance-count
is the number of components in the instance identifier whose value you supply in
instance-components. For example, an instance identifier of 1.2.3.4 has a
component count of 4.
instance-components
is a pointer to a structure of type OIDC_T that contains the instance identifier of the
variable binding.
value-count
is the number of components in the OID whose value you supply in value-
components.
value-components
is a pointer to a structure of type OIDC_T that contains the OID value.
The following example, taken from SNMPSET, binds an OID value to a request packet.
Related declarations include a global define and two OID structure declarations, one for
the instance identifier and one for the OID value. The Manager Services define
MAX_OID_COUNT is used to set the number of elements in the OID component arrays
and the component count variables to 32.
#define MAXOIDS 16
OIDC_T base_component_list[MAX_OID_COUNT];
OBJ_ID_T base_oid = { MAX_OID_COUNT, base_component_list };
OIDC_T val_component_list[MAX_OID_COUNT];
OBJ_ID_T val_oid = { MAX_OID_COUNT, val_component_list };
Other related variables are declared in the main block. The variable named longform
indicates that the invocation line specifies MIB objects that are not defined in MIB-II.
Manager Services has an internal table it can use to find the data type of MIB-II objects:
int longform = 0;
int mibtype = 0;
int oidcnt;
char *oidstr[MAXOIDS];
struct namerec *p;
SNMP_PKT_T *send_pkt;
char *typestr[MAXOIDS];
char *valstr[MAXOIDS];