Object Identifier (OID)



Function summary


#include <rssnmp/snmp.h>
Function Description
rssnmp_oid_v2a Convert OID from vector to string form.
rssnmp_oid_a2v Convert OID from string to vector form.
rssnmp_oid_cmp Compare two OIDs in vector form.
rssnmp_oid_copy Create an OID copy.


Convert functions

Synopsis

char *rssnmp_oid_v2a(rssnmp_oid_t *v, int v_size, char *buff, int buff_size);

rssnmp_oid_t *rssnmp_oid_a2v(char *a, int *v_size);

Description

An OID in RSSNMP is represented by a vector of integers. These functions will help you convert these vectors in string and vice-versa. The rssnmp_oid_v2a function converts the vector v, with size v_size into a string and writes it in buff, with it's size given by buff_size.

The rssnmp_oid_a2v, on the other hand, does the opposite: it converts the string a into a vector, writing its size in the memmory area pointed by v_size.

Return value

Both functions will return NULL on error.



Copy function

Synopsis

rssnmp_oid_t *rssnmp_oid_copy(rssnmp_oid_t *oid, int size);

Description

This function will instance a new OID and copy the first size elements of the vector oid.

Return value

Will return NULL on error.



Comparison function

Synopsis

int rssnmp_oid_cmp(rssnmp_oid_t *a, rssnmp_oid_t *b, int size);

Description

The rssnmp_oid_cmp function compares the first size elements of the vector a and b and returns the difference.

Return value

Returns an integer less than, equal to, or greater than zero if the first size bytes of a is found, respectively, to be less than, to match, or be greater than the first size bytes of b.