MyWebUniversity.com Home Page
 



Darwin Mac OS X man pages main menu
The Net-SNMP library(3)                                The Net-SNMP library(3)



NAME
       netsnmplibrary - The Net-SNMP library

   odules
       groupasn1 parsing and datatype manipulation routines.
       groupA generic callback mechanism
       groupgeneric linked-list data handling with a string as a key.
       groupstorage space for defaults
           The purpose of the default storage is three-fold:.


       groupmib parsing and datatype manipulation routines.
       groupStore and retrieve data referenced by an OID.
           This is essentially a way of storing data associated with a given
           OID.


       groupparsing various configuration files at run time
           The readconfig related functions are a fairly extensible system of
           parsing various configuration files at the run time.


       groupgeneric library based alarm timers for various parts of an
           application
       groupvarious PDU processing routines
       groupgeneric logging for net-snmp
       groupemory Utility Routines

   Data Structures
       struct snmpinternalsession
       struct sessionlist

   Defines
       #define MIN(a, b)   (((a) < (b)) ? (a) : (b))
       #define MIBCLIENTSAREVIL   1
       #define initagentcallbacktransport()
       #define SNMPNEDREQUESTLIST
       #define timercmp(tvp, uvp, cmp)
       #define timerclear(tvp)   (tvp)->tvsec = (tvp)->tvusec = 0
       #define MAXPACKETLENGTH   (0x7fffffff)
       #define NETSNMPSTREAMQUEUELEN   5
       #define BSD42
       #define NFDBITS   (sizeof(fdmask) * NBY)        /* bits per mask */
       #define FDSET(n, p)   ((p)->fdsbits[(n)/NFDBITS] = (1 << ((n) %
           NFDBITS)))
       #define FDCLR(n, p)   ((p)->fdsbits[(n)/NFDBITS] &= ~(1 << ((n) %
           NFDBITS)))
       #define FDISET(n, p)   ((p)->fdsbits[(n)/NFDBITS] & (1 << ((n) %
           NFDBITS)))
       #define FDZERO(p)   memset((p), 0, sizeof(*(p)))
       #define DEFAULTCOMUNITY   'public'
       #define DEFAULTRETRIES   5
       #define DEFAULTIMEOUT   1000000L
       #define DEFAULTREMPORT   SNMPORT
       #define DEFAULTENTERPRISE   defaultenterprise
       #define DEFAULTIME   0
       #define MAXIMUMPACKETSIZE   0x7fffffff
       #define DEBUGPRINTPDUTYPE(token, type)
       #define ERORSTATLENGTH   11

   Typedefs
       typedef long fdmask

   Functions
       int initagent (const char *app)
           Initialize the agent.
       void shutdownagent (void)
       int snmpbuild (uchar **pkt, sizet *pktlen, sizet *offset,
           netsnmpsession *pss, netsnmppdu *pdu)
       int snmpgeterrno (void)
       void snmpsynchreset (netsnmpsession *notused)
       void snmpsynchsetup (netsnmpsession *notused)
       const char * strerror (int err)
       long snmpgetnextreqid (void)
       long snmpgetnextmsgid (void)
       long snmpgetnextsessid (void)
       long snmpgetnexttransid (void)
       void snmpperror (const char *progstring)
       void snmpsetdetail (const char *detailstring)
       const char * snmpapierrstring (int snmperrnumber)
       void snmperror (netsnmpsession *psess, int *perrno, int
           *psnmperrno, char **pstr)
       void snmpsesserror (void *sessp, int *perrno, int *psnmperrno,
           char **pstr)
       void netsnmpsesslogerror (int priority, const char *progstring,
           netsnmpsession *ss)
       void snmpsessperror (const char *progstring, netsnmpsession *ss)
       void snmpsessinit (netsnmpsession *session)
       void initsnmpenums (void)
       void initsnmp (const char *type)
           Calls the functions to do config file loading and mib module
           parsing in the correct order.
       void snmpstore (const char *type)
       void snmpshutdown (const char *type)
           Shuts down the application, saving any needed persistent storage,
           and appropriate clean up.
       netsnmpsession * snmpopen (netsnmpsession *session)
       netsnmpsession * snmpopenex (netsnmpsession *session,
           int(*fpreparse)(netsnmpsession *, netsnmptransport *, void *,
           int), int(*fparse)(netsnmpsession *, netsnmppdu *, uchar *,
           sizet), int(*fpostparse)(netsnmpsession *, netsnmppdu *, int),
           int(*fbuild)(netsnmpsession *, netsnmppdu *, uchar *, sizet *),
           int(*frbuild)(netsnmpsession *, netsnmppdu *, uchar **, sizet
           *, sizet *), int(*fcheck)(uchar *, sizet))
       int snmpv3engineIDprobe (struct sessionlist *slp, netsnmpsession
           *insession)
       netsnmpsession * snmpadd (netsnmpsession *insession,
           netsnmptransport *transport, int(*fpreparse)(netsnmpsession *,
           netsnmptransport *, void *, int),
           int(*fpostparse)(netsnmpsession *, netsnmppdu *, int))
       netsnmpsession * snmpaddfull (netsnmpsession *insession,
           netsnmptransport *transport, int(*fpreparse)(netsnmpsession *,
           netsnmptransport *, void *, int), int(*fparse)(netsnmpsession *,
           netsnmppdu *, uchar *, sizet), int(*fpostparse)(netsnmpsession
           *, netsnmppdu *, int), int(*fbuild)(netsnmpsession *, netsnmppdu
           *, uchar *, sizet *), int(*frbuild)(netsnmpsession *,
           netsnmppdu *, uchar **, sizet *, sizet *), int(*fcheck)(uchar
           *, sizet), netsnmppdu *(*fcreatepdu)(netsnmptransport *, void
           *, sizet))
       void * snmpsessaddex (netsnmpsession *insession, netsnmptransport
           *transport, int(*fpreparse)(netsnmpsession *, netsnmptransport
           *, void *, int), int(*fparse)(netsnmpsession *, netsnmppdu *,
           uchar *, sizet), int(*fpostparse)(netsnmpsession *, netsnmppdu
           *, int), int(*fbuild)(netsnmpsession *, netsnmppdu *, uchar *,
           sizet *), int(*frbuild)(netsnmpsession *, netsnmppdu *, uchar
           **, sizet *, sizet *), int(*fcheck)(uchar *, sizet),
           netsnmppdu *(*fcreatepdu)(netsnmptransport *, void *, sizet))
       void * snmpsessadd (netsnmpsession *insession, netsnmptransport
           *transport, int(*fpreparse)(netsnmpsession *, netsnmptransport
           *, void *, int), int(*fpostparse)(netsnmpsession *, netsnmppdu
           *, int))
       void * snmpsessopen (netsnmpsession *pss)
       int createuserfromsession (netsnmpsession *session)
       int snmpsessclose (void *sessp)
       int snmpclose (netsnmpsession *session)
       int snmpclosesessions (void)
       int snmpv3packetbuild (netsnmpsession *session, netsnmppdu *pdu,
           uchar *packet, sizet *outlength, uchar *pdudata, sizet
           pdudatalen)
       uchar * snmppdubuild (netsnmppdu *pdu, uchar *cp, sizet
           *outlength)
       int snmpv3parse (netsnmppdu *pdu, uchar *data, sizet *length,
           uchar **afterheader, netsnmpsession *sess)
       int snmpv3makereport (netsnmppdu *pdu, int error)
       int snmpv3getreporttype (netsnmppdu *pdu)
       int snmppduparse (netsnmppdu *pdu, uchar *data, sizet *length)
       uchar * snmpv3scopedPDUparse (netsnmppdu *pdu, uchar *cp, sizet
           *length)
       int snmpsend (netsnmpsession *session, netsnmppdu *pdu)
       int snmpsesssend (void *sessp, netsnmppdu *pdu)
       int snmpasyncsend (netsnmpsession *session, netsnmppdu *pdu,
           snmpcallback callback, void *cbdata)
       int snmpsessasyncsend (void *sessp, netsnmppdu *pdu, snmpcallback
           callback, void *cbdata)
       void snmpfreevar (netsnmpvariablelist *var)
       void snmpfreevarbind (netsnmpvariablelist *var)
       void snmpfreepdu (netsnmppdu *pdu)
       netsnmppdu * snmpcreatesesspdu (netsnmptransport *transport, void
           *opaque, sizet olength)
       void snmpread (fdset *fdset)
       int sessread (void *sessp, fdset *fdset)
       int snmpsessread (void *sessp, fdset *fdset)
       int snmpselectinfo (int *numfds, fdset *fdset, struct timeval
           *timeout, int *block)
       int snmpsessselectinfo (void *sessp, int *numfds, fdset *fdset,
           struct timeval *timeout, int *block)
       void snmptimeout (void)
       void snmpsesstimeout (void *sessp)
       int snmpoidncompare (const oid *inname1, sizet len1, const oid
           *inname2, sizet len2, sizet maxlen)
       int snmpoidcompare (const oid *inname1, sizet len1, const oid
           *inname2, sizet len2)
           lexicographical compare two object identifiers.
       int snmpoidtreecompare (const oid *inname1, sizet len1, const oid
           *inname2, sizet len2)
           Compares 2 OIDs to determine if they are equal up until the
           shortest length.
       int netsnmpoidequals (const oid *inname1, sizet len1, const oid
           *inname2, sizet len2)
           Compares 2 OIDs to determine if they are exactly equal.
       int netsnmpoidissubtree (const oid *inname1, sizet len1, const oid
           *inname2, sizet len2)
           Identical to netsnmpoidequals, except only the length up to len1
           is compared.
       int netsnmpoidfindprefix (const oid *inname1, sizet len1, const
           oid *inname2, sizet len2)
           Given two OIDs, determine the common prefix to them both.
       netsnmpvariablelist * snmppduaddvariable (netsnmppdu *pdu, const
           oid *name, sizet namelength, uchar type, const uchar *value,
           sizet len)
       netsnmpvariablelist * snmpvarlistaddvariable
           (netsnmpvariablelist **varlist, const oid *name, sizet
           namelength, uchar type, const uchar *value, sizet len)
       int snmpaddvar (netsnmppdu *pdu, const oid *name, sizet
           namelength, char type, const char *value)
       void * snmpsesspointer (netsnmpsession *session)
       netsnmpsession * snmpsesssession (void *sessp)
       netsnmptransport * snmpsesstransport (void *sessp)
       void snmpsesstransportset (void *sp, netsnmptransport *t)
       oid * snmpduplicateobjid (const oid *objToCopy, sizet objToCopyLen)
       uint snmpincrementstatistic (int which)
       uint snmpincrementstatisticby (int which, int count)
       uint snmpgetstatistic (int which)
       void snmpinitstatistics (void)

   Variables
       netsnmpsubtree * subtrees
       long longreturn
       uchar returnbuf [258]
       timeval starttime
       int callbackmasternum = -1
       oid nullOid [] = { 0, 0 }
       int nullOidLen = sizeof(nullOid)
       sessionlist * Sessions = NUL
       int snmperrno = 0
       long longreturn
       uchar returnbuf []
       oid nullOid []
       int nullOidLen

Define Documentation
   ##define DEBUGPRINTPDUTYPE(token,, type)
       Value::.nf switch(type) {       case SNMPMSGET:
       DEBUGDUMPSECTION(token, 'PDU-GET');         break;       case
       SNMPMSGETNEXT:         DEBUGDUMPSECTION(token, 'PDU-GETNEXT');
       break;       case SNMPMSGRESPONSE:         DEBUGDUMPSECTION(token,
       'PDU-RESPONSE');         break;       case SNMPMSGSET:
       DEBUGDUMPSECTION(token, 'PDU-SET');         break;       case
       SNMPMSGETBULK:         DEBUGDUMPSECTION(token, 'PDU-GETBULK');
       break;       case SNMPMSGINFORM:         DEBUGDUMPSECTION(token,
       'PDU-INFORM');         break;       case SNMPMSGTRAP2:
       DEBUGDUMPSECTION(token, 'PDU-TRAP2');         break;       case
       SNMPMSGREPORT:         DEBUGDUMPSECTION(token, 'PDU-REPORT');
       break;       default:         DEBUGDUMPSECTION(token, 'PDU-UNKNOWN');
       break;     }

       Definition at line 375 of file snmpapi.c.

   ##define timercmp(tvp,, uvp,, cmp)
       Value::.nf /* CSTYLED */         ((tvp)->tvsec cmp (uvp)->tvsec 
       ((tvp)->tvsec == (uvp)->tvsec &&         /* CSTYLED */
       (tvp)->tvusec cmp (uvp)->tvusec))

       Definition at line 145 of file snmpapi.c.

Function Documentation
   int initagent (const char ** app)
       Initialize the agent. Calls into initagentreadconfig to set tha
       app's configuration file in the appropriate default storage space,
       NETSNMPDSLIBAPTYPE. Need to call initagent before calling
       initsnmp.

       Parameters::
           app the configuration file to be read in, gets stored in default
           storage

       Returns::
           Returns non-zero on failure and zero on success.

       See also::
           initsnmp

       Definition at line 269 of file snmpvars.c.

       References netsnmpdssetboolean(), netsnmpinithelpers(), and
       snmplog().

   void initsnmp (const char ** type)
       Calls the functions to do config file loading and mib module parsing in
       the correct order. Parameters::
           type label for the config file 'type'

       Returns::
           void

       See also::
           initagent

       Definition at line 779 of file snmpapi.c.

       References initmib().

   int netsnmpoidequals (const oid ** inname1,, sizet len1,, const oid **
       inname2,, sizet len2)
       Compares 2 OIDs to determine if they are exactly equal. This should be
       faster than doing a snmpoidcompare for different length OIDs, since
       the length is checked first and if != returns immediately. Might be
       very slighly faster if lengths are ==.

       Parameters::
           inname1 A pointer to the first oid.
           len1 length of the first OID (in segments, not bytes)
           inname2 A pointer to the second oid.
           len2 length of the second OID (in segments, not bytes)

       Returns::
           0 if they are equal, 1 if they are not.

       Definition at line 6213 of file snmpapi.c.

       Referenced by netsnmpcachefindbyoid(), netsnmpoldapihelper(),
       and unregistermibcontext().

   int netsnmpoidfindprefix (const oid ** inname1,, sizet len1,, const oid **
       inname2,, sizet len2)
       Given two OIDs, determine the common prefix to them both. Parameters::
           inname1 A pointer to the first oid.
           len1 Length of the first oid.
           inname2 A pointer to the second oid.
           len2 Length of the second oid.

       Returns::
           length of largest common index of commonality. 1 = first, 0 if none
           * or -1 on error.

       Definition at line 6269 of file snmpapi.c.

       References SNMPMIN.

       Referenced by netsnmpaddvarbindtocache().

   int netsnmpoidissubtree (const oid ** inname1,, sizet len1,, const oid **
       inname2,, sizet len2)
       Identical to netsnmpoidequals, except only the length up to len1 is
       compared. Functionally, this determines if inname2 is equal or a
       subtree of inname1

       Parameters::
           inname1 A pointer to the first oid.
           len1 length of the first OID (in segments, not bytes)
           inname2 A pointer to the second oid.
           len2 length of the second OID (in segments, not bytes)

       Returns::
           0 if one is a common prefix of the other.

       Definition at line 6249 of file snmpapi.c.

   int snmpoidcompare (const oid ** inname1,, sizet len1,, const oid **
       inname2,, sizet len2)
       lexicographical compare two object identifiers. Caution: this method is
       called often by command responder applications (ie, agent).

       Returns::
           -1 if name1 < name2, 0 if name1 = name2, 1 if name1 > name2

       Definition at line 6145 of file snmpapi.c.

       Referenced by checkgetnextresults(), netsnmpcheckgetnextreply(),
       netsnmpinsertiteratorcontext(), netsnmpinserttablerow(),
       netsnmprowmergehelperhandler(), netsnmptabledataaddrow(),
       netsnmptabledatagetfromoid(), netsnmptabledatahelperhandler(),
       netsnmptableiteratorhelperhandler(), snmpoidtreecompare(), and
       tablehelperhandler().

   int snmpoidtreecompare (const oid ** inname1,, sizet len1,, const oid **
       inname2,, sizet len2)
       Compares 2 OIDs to determine if they are equal up until the shortest
       length. Parameters::
           inname1 A pointer to the first oid.
           len1 length of the first OID (in segments, not bytes)
           inname2 A pointer to the second oid.
           len2 length of the second OID (in segments, not bytes)

       Returns::
           0 if they are equal, 1 if inname1 is > inname2, or -1 if <.

       Definition at line 6194 of file snmpapi.c.

       References snmpoidcompare().

   void snmpshutdown (const char ** type)
       Shuts down the application, saving any needed persistent storage, and
       appropriate clean up. Parameters::
           type Label for the config file 'type' used

       Returns::
           void

       Definition at line 847 of file snmpapi.c.

       References shutdownmib(), snmpalarmunregisterall(), and
       snmpcallcallbacks().



net-snmp                          24 Jan 2005          The Net-SNMP library(3)
Darwin Mac OS X man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™