|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T u
Length: 3698 (0xe72)
Types: TextFile
Names: »unix.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z«
└─⟦de7628f85⟧
└─⟦this⟧ »isode-6.0/snmp/unix.c«
/* unix.c - MIB realization of the UNIX-specific enterprise objects */
#ifndef lint
static char *rcsid = "$Header: /f/osi/snmp/RCS/unix.c,v 7.0 89/11/23 22:23:39 mrose Rel $";
#endif
/*
* $Header: /f/osi/snmp/RCS/unix.c,v 7.0 89/11/23 22:23:39 mrose Rel $
*
* Contributed by NYSERNet Inc. This work was partially supported by the
* U.S. Defense Advanced Research Projects Agency and the Rome Air Development
* Center of the U.S. Air Force Systems Command under contract number
* F30602-88-C-0016.
*
*
* $Log: unix.c,v $
* Revision 7.0 89/11/23 22:23:39 mrose
* Release 6.0
*
*/
/*
* NOTICE
*
* Acquisition, use, and distribution of this module and related
* materials are subject to the restrictions of a license agreement.
* Consult the Preface in the User's Manual for the full terms of
* this agreement.
*
*/
#include <stdio.h>
#include "mib.h"
#ifdef BSD44
#include <sys/param.h>
#include <machine/endian.h>
#include <machine/machparam.h>
#endif
#include <sys/mbuf.h>
/* \f
*/
static struct mbstat mbstat;
/* \f
*/
#define mbufS 0
#define mbufClusters 1
#define mbufFreeClusters 2
#define mbufDrops 3
#ifdef BSD44
#define mbufWaits 4
#define mbufDrains 5
#endif
static int o_mbuf (oi, v, offset)
OI oi;
register struct type_SNMP_VarBind *v;
int offset;
{
int ifvar;
register struct mbstat *m = &mbstat;
register OID oid = oi -> oi_name;
register OT ot = oi -> oi_type;
static int lastq = -1;
ifvar = (int) ot -> ot_info;
switch (offset) {
case type_SNMP_PDUs_get__request:
if (oid -> oid_nelem != ot -> ot_name -> oid_nelem + 1
|| oid -> oid_elements[oid -> oid_nelem - 1] != 0)
return int_SNMP_error__status_noSuchName;
break;
case type_SNMP_PDUs_get__next__request:
if (oid -> oid_nelem > ot -> ot_name -> oid_nelem + 1)
return int_SNMP_error__status_noSuchName;
if (oid -> oid_nelem == ot -> ot_name -> oid_nelem) {
OID new;
if ((new = oid_extend (oid, 1)) == NULLOID)
return int_SNMP_error__status_genErr;
new -> oid_elements[new -> oid_nelem - 1] = 0;
if (v -> name)
free_SNMP_ObjectName (v -> name);
v -> name = new;
}
else
return NOTOK;
break;
default:
return int_SNMP_error__status_genErr;
}
if (quantum != lastq) {
lastq = quantum;
if (getkmem (nl + N_MBSTAT, (caddr_t) m, sizeof *m) == NOTOK)
return int_SNMP_error__status_genErr;
}
switch (ifvar) {
case mbufS:
return o_integer (oi, v, m -> m_mbufs);
case mbufClusters:
return o_integer (oi, v, m -> m_clusters);
case mbufFreeClusters:
return o_integer (oi, v, m -> m_clfree);
case mbufDrops:
return o_integer (oi, v, m -> m_drops);
#ifdef mbufWaits
case mbufWaits:
return o_integer (oi, v, m -> m_wait);
#endif
#ifdef mbufDrains
case mbufDrains:
return o_integer (oi, v, m -> m_drain);
#endif
default:
return int_SNMP_error__status_noSuchName;
}
}
/* \f
*/
init_unix () {
register OT ot;
if (ot = text2obj ("mbufS"))
ot -> ot_getfnx = o_mbuf,
ot -> ot_info = (caddr_t) mbufS;
if (ot = text2obj ("mbufClusters"))
ot -> ot_getfnx = o_mbuf,
ot -> ot_info = (caddr_t) mbufClusters;
if (ot = text2obj ("mbufFreeClusters"))
ot -> ot_getfnx = o_mbuf,
ot -> ot_info = (caddr_t) mbufFreeClusters;
if (ot = text2obj ("mbufDrops"))
ot -> ot_getfnx = o_mbuf,
ot -> ot_info = (caddr_t) mbufDrops;
#ifdef mbufWaits
if (ot = text2obj ("mbufWaits"))
ot -> ot_getfnx = o_mbuf,
ot -> ot_info = (caddr_t) mbufWaits;
#endif
#ifdef mbufDrains
if (ot = text2obj ("mbufDrains"))
ot -> ot_getfnx = o_mbuf,
ot -> ot_info = (caddr_t) mbufDrains;
#endif
}