[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2

oid_cmp, oid_cpy, oid_free, sprintoid, str2oid, ode2oid, oid2ode, oid2ode_aux, prim2oid, or oid2prim Subroutine


Manipulates the object identifier data structure.


ISODE Library (libisode.a)


#include <isode/psap.h>

int oid_cmp (p, q)
OID p, q;

OID oid_cpy (oid)
OID oid;

void oid_free (oid)
OID oid;

char *sprintoid (oid)
OID oid;

OID str2oid (s)
char * s;

OID ode2oid (descriptor)
char * descriptor;

char *oid2ode (oid)
OID oid;

OID *oid2ode_aux (descriptor, quote)
char *descriptor;
int quote;

OID prim2oid (pe)
PE pe;

PE oid2prim (oid)
OID oid;


These subroutines are used to manipulate and translate object identifiers. The object identifier data (OID) structure and these subroutines are defined in the /usr/include/isode/psap.h file.

The oid_cmp subroutine compares two OID structures. The oid_cpy subroutine copies the object identifier, specified by the oid parameter, into a new structure. The oid_free procedure frees the object identifier and does not have any return parameters.

The sprintoid subroutine takes an object identifier and returns the dot-notation description as a string. The string is in static storage and must be copied to other user storage if it is to be maintained. The sprintoid subroutine takes the object data and converts it without checking for the existence of the oid parameter.

The str2oid subroutine takes a character string specifying an object identifier in dot notation (for example, and converts it into an OID structure. The space is static. To get a permanent copy of the OID structure, use the oid_cpy subroutine.

The oid2ode subroutine is identical to the sprintoid subroutine except that the oid2ode subroutine checks whether the oid parameter is in the isobjects database. The oid2ode subroutine is implemented as a macro call to the oid2ode_aux subroutine. The oid2ode_aux subroutine is similar to the oid2ode subroutine except for an additional integer parameter that specifies whether the string should be enclosed by quotes. The oid2ode subroutine always encloses the string in quotes.

The ode2oid subroutine retrieves an object identifier from the isobjects database.


p Specifies an OID structure.
q Specifies an OID structure.
descriptor Contains the object identifier descriptor data.
oid Contains the object identifier data.
s Contains a character string that defines an object identifier in dot notation.
descriptor Contains the object identifier descriptor data.
quote Specifies an integer that indicates whether a string should be enclosed in quotes. A value of 1 adds quotes; a value of 0 does not add quotes.
pe Contains a presentation element in which the OID structure is encoded (as with the oid2prim subroutine) or decoded (as with the prim2oid subroutine).

Return Values

The oid_cmp subroutine returns a 0 if the structures are identical, -1 if the first object is less than the second, and a 1 if any other conditions are found. The oid_cpy subroutine returns a pointer to the designated object identifier when the subroutine is successful.

The oid2ode subroutine returns the dot-notation description as a string in quotes. The sprintoid subroutine returns the dot-notation description as a string without quotes.

The ode2oid subroutine returns a static pointer to the object identifier. If the ode2oid and oid_cpy subroutines are not successful, the NULLOID value is returned.

Implementation Specifics

These subroutines are part of the SNMP Application Programming Interface in the TCP/IP facility.

Related Information

The oid_extend subroutine, oid_normalize subroutine.

List of Network Manager Programming References.

SNMP Overview for Programmers in AIX 5L Version 5.1 Communications Programming Concepts.

[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]