Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/src/cmd/snmpfs/a1.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


enum {
	Aseq = 0x30,
	Aint = 0x02,
	Aoctstr = 0x04,
	Anull = 0x05,
	Aobjid = 0x06,
	Aipaddr = 0x40,
	Acounter = 0x41,
	Agauge = 0x42,
	Atimeticks = 0x43,

	Pget = 0xa0,
	Pgetn,
	Presp,
	Pset,
	Ptrap,

	Maxoids = 128,			// from the spec
	Mpdu = 4,
};

typedef struct Oid Oid;
struct Oid {
	uchar *buf;
	int len;
};

typedef struct SnmpPdu SnmpPdu;
struct SnmpPdu {
	char *objid;		/* "1.3.6.1.4.1.429.1.1.3.5.0" */
	int type;
	int len;
	union {
		int i;
		char *s;
	};
};

typedef struct Snmp Snmp;
struct Snmp {
	int vers;
	int private;
	int type;
	int reqid;
	int estat, eindex;
	int npdu;
	int mpdu;
	SnmpPdu pdu[Mpdu];
};

extern int a1readint(uchar*, int);
extern int a1readlen(uchar*, int*);
extern void Sfree(Snmp*);
extern Snmp* Salloc(void);
extern Snmp* Schkpdu(Snmp*, int);
extern int Sparse(void *buf, int nbuf, Snmp *dst);
extern int Sunparse(Snmp *s, void *va, int na);
extern int oidfmt(Fmt *);
extern int Sfmt(Fmt *);
extern int Sscan(SnmpPdu *, char *);
extern void Sdump(Snmp *);
extern int dosnmp(int, Snmp*, Snmp*);

extern int chatty;

#pragma	varargck	type	"A"	Snmp*
#pragma	varargck	type	"O"	Oid


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.