DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

smux_util(SLIB-osr5)


smux_util -- SMUX library routines

Syntax

cc ... -lsmux

#include <snmp/snmp.h>
#include <snmp/objects.h>

void dump_object(ot, i) OT ot; int i;

void dump_object_by_tree(ot, i) OT ot; int i;

void dump_objects_by_tree()

OID inaddr2oid(addr) u_long addr;

int mediaddr2oid(ip, addr, len, islen) u_int *ip; u_char *addr; int len, islen;

OI name2inst(oid) OID oid;

OT name2obj(oid) OID oid;

OI next2inst(oid) OID oid;

int o_integer(oi, v, number) OI oi; struct type_SNMP_VarBind *v; int number;

int o_ipaddr(oi, v, value) OI oi; struct type_SNMP_VarBind *v; caddr_t value;

int o_longword(oi, v, number) OI oi; struct type_SNMP_VarBind *v; int number;

int o_number(oi, v, number) OI oi; struct type_SNMP_VarBind *v; caddr_t number;

int o_specific(oi, v, value) OI oi; struct type_SNMP_VarBind *v; caddr_t value;

int o_string(oi, v, base, len) OI oi; struct type_SNMP_VarBind *v; char *base; int len;

char *oid2ode(oid) OID oid;

OI text2inst(text) char *text;

OT text2obj(text) char *text;

OID text2oid(name) char *name;

OS text2syn(name) char *name;

cc ... -lsnmp

#include <snmp/snmp.h>
#include <snmp/objects.h>

char * octet2str(os) OctetString *os;

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

OID oid_cpy(q) OID q;

OID oid_extend(q, howmuch) OID q; int howmuch;

OID
oid_normalize(q, howmuch, bigvalue)
OID q;
int howmuch, bigvalue;

OctetString * os_cpy(orig) OctetString *orig;

char * sprintoid(oid) OID oid;

cc ... -lsnmp

#include <snmp/snmp.h>

struct smuxEntry * getsmuxEntrybyidentity(identity) OID identity;

struct smuxEntry * getsmuxEntrybyname(name) char *name;

cc ... -lsnmpio

#include <sys/types.h>
#include <sys/time.h>
#include <poll.h>

int xselect(nfds, rfds, wfds, efds, secs) int nfds; fd_set *rfds, *wfds, *efds; int secs;

Description

The dump_object routine prints out all of the relevant information pertaining to an object. The following is a partial list of this information (examples in parentheses): the symbolic name (sysDescr), relation to its parent (system.1), numeric representation (1.3.6.1.2.1.1.1), associated syntax (DisplayString), access rights for the object (read-only(1)), and status of the object (obsolete(0)).

The arguments supplied to dump_object are the object type and the level of the object in the tree.

The dump_object_by_tree routine dumps the relevant information pertaining to all objects in a subtree by recursively calling itself and dump_object. This routine is invoked with two arguments: the object type of the subtree and the level of the subtree.

The dump_objects_by_tree routine dumps the relevant information of all the compiled objects in the trees rooted at ccitt (0) and iso (1).

The inaddr2oid routine takes an Internet address (struct in_addr) as an argument and returns an OID representation of the address.

The mediaddr2oid routine stores the length of an address (optionally) and its contents in an OID. The ip argument is the oid_elements field of an OIDentifier structure. addr and len are pointers to the address and its length, respectively. islen specifies whether the length of the address needs to be stored in the oid_elements. mediaddr2oid returns the number of elements stored.

The name2inst routine takes an OID as an argument and returns an OI with oi_name set to oid and oi_type set to oid's object type.

The name2ob routine takes an OID as an argument and returns the object type associated with either the exact name or the prefix of the name.

The next2inst routine takes an OID and finds the closest object type before the variable name and returns an OI corresponding to that object type.

The o_integer routine associates the value (ObjectSyntax) of an INTEGER, Gauge, or Counter type object with its name.

The o_ipaddr routine associates the value (ObjectSyntax) of an IpAddress type object with its name.

The o_longword routine associates the value (ObjectSyntax) of a Gauge, INTEGER, or Counter type object with its name.

The o_number routine associates the value (ObjectSyntax) of a TimeTicks type object with its name.

The o_specific routine associates the value of an OBJECT IDENTIFIER type object with its name.

The o_string routine associates the value of a DisplayString, OctetString, or ClnpAddress type object with its name.

The oid2ode routine takes an OID as an argument and returns a printable string in symbolic form (sysObjectID) or a combination of symbolic and numeric forms (system.2).

The text2inst routine takes a string as an argument and returns an OI. This string can be in numeric form (``1.3.6.1''), symbolic form (``internet''), or a combination of numeric and symbolic forms (``iso.3.6.1''). text2inst calls text2oid to get the OID corresponding to text, and then calls name2obj to get the type associated with the OID.

The text2obj routine takes a string as an argument and returns the object type associated with the exact name. This string can be in numeric form (``1.3.6.1''), symbolic form (``internet''), or a combination of numeric and symbolic forms (``iso.3.6.1'').

The text2oid routine takes a string as an argument and returns the OID associated with the corresponding object. This string can be in numeric form (``1.3.6.1''), symbolic form (``internet''), or a combination of numeric and symbolic forms (``iso.3.6.1'').

The text2syn routine takes a syntax name and returns the structure associated with it.

The octet2str routine takes an OctetString as an argument and returns a null-terminated string suitable for printing. This is used primarily as a debugging aid. It returns a NULL on failure.

The oid_cmp routine compares two OIDs. oid_cmp returns -1 if (p < q), 1 if (p > q), and 0 otherwise.

The oid_cpy routine allocates and returns a copy of the OID supplied as its argument.

The oid_extend routine allocates a larger OID. The length of the new OID is equal to the length of the OID q plus howmuch.The elements in the q OID are copied into the new OID.

The oid_normalize routine invokes oid_extend with q and howmuch and then initializes the extra elements in the new OID to the value specified in bigvalue.

The os_cpy routine allocates and returns a copy of the orig OctetString supplied as an argument.

The sprintoid routine takes an OID as an argument and returns a printable string in numeric form (1.3.6.1.2.1.1.2). This is used primarily as a debugging aid.

The routines getsmuxEntrybyidentity and getsmuxEntrybyname search for an entry of a specific peer in the SNMP database /etc/snmpd.peers. The name argument passed to getsmuxEntrybyname is the name of the peer, and the identity passed to getsmuxEntrybyidentity is the OID of the peer.

The xselect routine simulates the system call select.

See also

octetstring(SLIB-osr5), oid(SLIB-osr5), select(S-osr5), smux_api(SLIB-osr5), snmpd.peers(SFF)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005