The ovm_snmpoid_t type

The ovm_snmpoid_t type is the OrchIDS type of SNMP object identifiers.

It is defined this way in src/lang.h:

typedef struct ovm_snmpoid_s ovm_snmpoid_t;
struct ovm_snmpoid_s
{
  gc_header_t gc;
  size_t    len;
  oid_t     objoid[STR_PAD_LEN];
};

The length STR_PAD_LEN is a dummy value: the actual number of object identifiers in the array objoid is len.

The type ovm_snmpoid_t is a type of garbage-collectable data. To allocate a new object of type ovm_snmpoid_t, use the function:

ovm_var_t *ovm_snmpoid_new(gc_t *gc_ctx, size_t len);

This creates a new ovm_snmpoid_t object, with the given len. Calling res the result, one always has TYPE(res)==T_SNMPOID. The objoid array is left uninitialized. One can access it using SNMPOID(res), and its length by SNMPOIDLEN(res).

The return type of ovm_snmpoid_new() is the universal type ovm_var_t instead of ovm_vbstr_t, for practical reasons.

The result is created white, and much be gc_touch()ed before storing it into a garbage-collectable object.