enum {
Aseq = 0x30,
Aint = 0x02,
Aoctstr = 0x04,
Anull = 0x05,
Aobjid = 0x06,
Aipaddr = 0x40,
Acounter = 0x41,
Agauge = 0x42,
Atimeticks = 0x43,
Objidlen = 64,
Pget = 0xa0,
Pgetn, Presp, Pset, Ptrap,
Mpdu = 4,
};
typedef struct Snmp Snmp;
typedef struct SnmpPdu SnmpPdu;
int a1readint(uchar*, int);
int a1readlen(uchar*, int*);
void Sfree(Snmp*);
Snmp* Salloc(void);
Snmp* Schkpdu(Snmp*, int);
int Sparse(void *buf, int nbuf, Snmp *dst);
void Sprint(Snmp*);
int Sunparse(Snmp *s, void *va, int na);
int dosnmp(int, Snmp*, Snmp*);
struct SnmpPdu {
char objid[Objidlen]; /* "1.3.6.1.4.1.429.1.1.3.5.0" */
int type;
int len;
union {
int i;
char *s;
};
};
struct Snmp {
int vers;
int private;
int type;
int reqid;
int estat, eindex;
int npdu;
int mpdu;
SnmpPdu pdu[Mpdu];
};
int openlisten(char*);
void chat(char*, ...);
extern int chatty;
|