smux_util(3N) smux_util(3N)
NAME
smux_util - SMUX library utilities.
SYNOPSIS
#include <snmp/snmp.h> #include <snmp/objects.h>
int dump_object(ot, i) OT ot; int i;
DESCRIPTION
This 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.
int dump_object_by_tree(ot, i)
OT ot;
int i;
This 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.
int dump_objects_by_tree()
This routine dumps the relevant information of all the
compiled objects in the trees rooted at ccitt (0) and iso (1).
OID inaddr2oid(addr)
unsigned long addr;
This routine takes an Internet address (struct in_addr) as an
argument and returns an OID representation of the address.
int mediaddr2oid(ip, addr, len, islen)
u_int *ip;
u_char *addr;
int len, islen;
Copyright 1994 Novell, Inc. Page 1
smux_util(3N) smux_util(3N)
This 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.
OI name2inst(oid)
OID oid;
This routine takes an OID as an argument and returns an OI
with oi_name set to oid and oi_type set to the oid's object
type.
OT name2obj(oid)
OID oid;
This routine takes an OID as an argument and returns the
object type associated with either the exact name or the
prefix of the name.
OI next2inst(oid)
OID oid;
This routine takes an OID and finds the closest object type
before the variable name and returns an OI corresponding to
that object type.
int o_integer(oi, v, number)
OI oi;
struct type_SNMP_VarBind *v;
int number;
The routine o_integer associates the value (ObjectSyntax) of
an INTEGER , Gauge, or Counter type object with its name.
int o_ipaddr(oi, v, value)
OI oi;
struct type_SNMP_VarBind *v;
caddr_t value;
The routine o_ipaddr associates the value (ObjectSyntax) of an
IpAddress type object with its name.
int o_longword(oi, v, number)
Copyright 1994 Novell, Inc. Page 2
smux_util(3N) smux_util(3N)
OI oi;
struct type_SNMP_VarBind *v;
int number;
This routine associates the value (ObjectSyntax) of a Gauge,
INTEGER, or Counter type object with its name.
int o_number(oi, v, number)
OI oi;
struct type_SNMP_VarBind *v;
caddr_t number;
The o_number routine associates the value (ObjectSyntax) of a
TimeTicks type object with its name.
int o_specific(oi, v, value)
OI oi;
struct type_SNMP_VarBind *v;
caddr_t value;
This routine associates the value of an OBJECT IDENTIFIER type
object with its name.
int o_string(oi, v, base, len)
OI oi;
struct type_SNMP_VarBind *v;
char *base;
int len;
The o_string routine associates the value of a DisplayString,
OctetString or ClnpAddress type object with its name.
char *octet2str(os)
OctetString *os;
The routine octet2str 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.
int oid_cmp(p, q)
OID p, q;
This routine is used to compare two OIDs. oid_cmp returns -1
if (p > q), 1 if (p > q), and 0 otherwise.
Copyright 1994 Novell, Inc. Page 3
smux_util(3N) smux_util(3N)
OID oid_cpy(q)
OID q;
This routine allocates and returns a copy of the OID supplied
as its argument.
OID oid_extend(q, howmuch)
OID q;
int howmuch;
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 .
OID oid_normalize(q, howmuch, bigvalue)
OID q;
int howmuch, bigvalue;
This routine invokes oid_extend with q and howmuch and then
initializes the extra elements in the new OID to the value
specified in bigvalue.
char *oid2ode(oid)
OID oid;
This routine takes an OID as an argument and returns a
printable string in symbolic form (sysObjectID) or symbolic
and numeric combination form (system.2).
OctetString *os_cpy(orig)
OctetString *orig;
The os_cpy routine allocates and returns a copy of the orig
OctetString supplied as its argument.
char *sprintoid(oid)
OID oid;
The routine sprintoid 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.
OI text2inst(text)
char *text;
Copyright 1994 Novell, Inc. Page 4
smux_util(3N) smux_util(3N)
This 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 .
OT text2obj(text)
char *text;
This 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).
OID text2oid(name)
char *name;
This 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).
OS text2syn(name)
char *name;
The routine text2syn takes a syntax name and returns the
structure associated with it.
#include <snmp/snmp.h>
struct smuxEntry *getsmuxEntrybyidentity(identity)
OID identity;
struct smuxEntry *getsmuxEntrybyname(name)
char *name;
The routines getsmuxEntrybyidentity and getsmuxEntrybyname
search for an entry of a specific peer in the SNMP peers
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.
#include <sys/types.h>
#include <sys/time.h>
#include <poll.h>
Copyright 1994 Novell, Inc. Page 5
smux_util(3N) smux_util(3N)
int xselect(nfds, rfds, wfds, efds, secs)
int nfds;
fd_set *rfds, *wfds, *efds;
int secs;
xselect simulates the select(3C) routine.
SEE ALSO
octetstring(3N), oid(3N), smux_api(3N), snmpd.peers(4).
Copyright 1994 Novell, Inc. Page 6