7#ifndef _NB_SNMP_TABLE_H
8#define _NB_SNMP_TABLE_H
11typedef int *snmp_typeObjID;
12typedef const char *snmp_typeString;
13typedef int snmp_typeEnumVal;
14typedef int snmp_typeINTEGER;
16typedef unsigned int snmp_typeCounter;
17typedef int snmp_typeGauge;
18typedef unsigned long snmp_typeTimeTic;
19typedef unsigned long long snmp_typeCounter64;
20typedef unsigned int snmp_typeUnsigned;
21typedef unsigned int snmp_typeUInteger;
22typedef int snmp_typeInteger32;
25typedef unsigned long snmp_typeTimeTicks;
27void GetOid(
const char *tOid,
int *oid );
29#define SNMP_SET_WRONG_TYPE (-2)
30#define SNMP_SET_FAIL (-1)
31#define SNMP_SET_OK (0)
36#define MAX_COMMUNITY_SIZE (80)
40 uint8_t community_buffer[MAX_COMMUNITY_SIZE];
49 puint8_t pError_Index;
50 puint8_t pError_Value;
56#define ASN_typeObjID ASN_OBJECT_ID
57#define ASN_typeString ASN_OCTET_STR
58#define ASN_typeEnumVal ASN_INTEGER
59#define ASN_typeINTEGER ASN_INTEGER
60#define ASN_typeNetAddr ASN_OCTET_STR
61#define ASN_typeCounter SMI_COUNTER32
62#define ASN_typeGauge SMI_GAUGE32
63#define ASN_typeTimeTic SMI_UNSIGNED32
64#define ASN_typeCounter64 SMI_COUNTER64
65#define ASN_typeUnsigned SMI_UNSIGNED32
66#define ASN_typeUInteger SMI_UNSIGNED32
67#define ASN_typeInteger32 SMI_INTEGER
68#define ASN_typeIpAddr SMI_IPADDRESS
69#define ASN_typeTimeTicks SMI_TIMETICKS
73typedef int*( GetpIFunc )();
74typedef const char*( GetCCFunc )();
75typedef void (GetOTFunc )(uint8_t * &pData,
int & len);
76typedef int ( GetIFunc )();
77typedef unsigned int ( GetuIFunc )();
78typedef unsigned long ( GetulFunc )();
79typedef unsigned long long ( GetullFunc )();
80typedef MACADR ( GetMadrFunc )();
82typedef int ( PutpIFunc ) (
int *, int );
83typedef int ( PutCCFunc ) (
const char *, int );
84typedef int ( PutOTFunc ) (
const unsigned char *, int,int );
85typedef int ( PutIFunc ) ( int, int );
86typedef int ( PutuIFunc ) (
unsigned int, int );
87typedef int ( PutulFunc ) (
unsigned long, int );
88typedef int ( PutullFunc ) (
unsigned long long, int );
89typedef int ( PutMadrFunc )(
MACADR, int );
94typedef int ( PutpIFuncTab ) (
int *, int,
void * );
95typedef int ( PutCCFuncTab ) (
const char *, int,
void * );
96typedef int ( PutOTFuncTab ) (
const unsigned char *,int,int,
void * );
97typedef int ( PutIFuncTab ) ( int, int,
void * );
98typedef int ( PutuIFuncTab ) (
unsigned int, int,
void * );
99typedef int ( PutulFuncTab ) (
unsigned long, int,
void * );
100typedef int ( PutullFuncTab ) (
unsigned long long, int,
void * );
101typedef int ( PutMadrFuncTab )(
MACADR, int,
void * );
107typedef void ( GetOIDFunction ) ( SNMP_Request &req,
void *data_el,
int subid );
110struct ReadLookUpObject
117 ReadLookUpObject *pNext;
118 ReadLookUpObject *pPrev;
122typedef int ( PutOIDFunction )( SNMP_Request &req,
127struct WriteLookUpObject
135 WriteLookUpObject *pNext;
136 WriteLookUpObject *pPrev;
145 ReadLookUpObject luo;
147 void PopulatelookUpObj(
const char *oid,
154 static void GetpIFunction( SNMP_Request &req,
void *data_el,
int subid );
155 static void GetuIFunction( SNMP_Request &req,
void *data_el,
int subid );
156 static void GetCCFunction( SNMP_Request &req,
void *data_el,
int subid );
157 static void GetOTFunction( SNMP_Request &req,
void *data_el,
int subid );
158 static void GetIFunction( SNMP_Request &req,
void *data_el,
int subid );
159 static void GetulFunction( SNMP_Request &req,
void *data_el,
int subid );
160 static void GetullFunction( SNMP_Request &req,
void *data_el,
int subid );
161 static void GetMadrFunction( SNMP_Request &req,
void *data_el,
int subid );
165 SNMPReadObject(
const char *oid,
int typ, GetpIFunc *pf, uint32_t commmask )
167 PopulatelookUpObj( oid, typ, (
void * ) pf, GetpIFunction, commmask );
169 SNMPReadObject(
const char *oid,
int typ, GetuIFunc *pf, uint32_t commmask )
171 PopulatelookUpObj( oid, typ, (
void * ) pf, GetuIFunction, commmask );
175 SNMPReadObject(
const char *oid,
int typ, GetCCFunc *pf, uint32_t commmask )
177 PopulatelookUpObj( oid, typ, (
void * ) pf, GetCCFunction, commmask );
180 SNMPReadObject(
const char *oid,
int typ, GetOTFunc *pf, uint32_t commmask )
182 PopulatelookUpObj( oid, typ, (
void * ) pf, GetOTFunction, commmask );
186 SNMPReadObject(
const char *oid,
int typ, GetIFunc *pf, uint32_t commmask )
188 PopulatelookUpObj( oid, typ, (
void * ) pf, GetIFunction, commmask );
190 SNMPReadObject(
const char *oid,
int typ, GetulFunc *pf, uint32_t commmask )
192 PopulatelookUpObj( oid, typ, (
void * ) pf, GetulFunction, commmask );
194 SNMPReadObject(
const char *oid,
int typ, GetullFunc *pf, uint32_t commmask )
196 PopulatelookUpObj( oid, typ, (
void * ) pf, GetullFunction, commmask );
198 SNMPReadObject(
const char *oid,
int typ, GetMadrFunc *pf, uint32_t commmask )
200 PopulatelookUpObj( oid, typ, (
void * ) pf, GetMadrFunction, commmask );
208 WriteLookUpObject luo;
210 static int PutpIFunction( SNMP_Request &req,
214 static int PutuIFunction( SNMP_Request &req,
218 static int PutCCFunction( SNMP_Request &req,BOOL second_pass,
void *pdata,
int subid );
220 static int PutOTFunction( SNMP_Request &req,BOOL second_pass,
void *pdata,
int subid );
222 static int PutIFunction( SNMP_Request &req, BOOL second_pass,
void *pdata,
int subid );
224 static int PutulFunction( SNMP_Request &req,BOOL second_pass,
void *pdata,
int subid );
226 static int PutullFunction( SNMP_Request &req,BOOL second_pass,
void *pdata,
int subid );
228 static int PutMadrFunction( SNMP_Request &req,BOOL second_pass,
void *pdata,
int subid );
230 void PopulatelookUpObj(
const char *oid,
int typ,
void *pData,PutOIDFunction *pf,uint32_t commmask );
234 SNMPWriteObject(
const char *oid,
int typ, PutpIFunc *pf, uint32_t commmask )
236 PopulatelookUpObj( oid, typ, (
void * ) pf, PutpIFunction, commmask );
238 SNMPWriteObject(
const char *oid,
int typ, PutuIFunc *pf, uint32_t commmask )
240 PopulatelookUpObj( oid, typ, (
void * ) pf, PutuIFunction, commmask );
242 SNMPWriteObject(
const char *oid,
int typ, PutCCFunc *pf, uint32_t commmask )
244 PopulatelookUpObj( oid, typ, (
void * ) pf, PutCCFunction, commmask );
247 SNMPWriteObject(
const char *oid,
int typ, PutOTFunc *pf, uint32_t commmask )
249 PopulatelookUpObj( oid, typ, (
void * ) pf, PutOTFunction, commmask );
253 SNMPWriteObject(
const char *oid,
int typ, PutIFunc *pf, uint32_t commmask )
255 PopulatelookUpObj( oid, typ, (
void * ) pf, PutIFunction, commmask );
257 SNMPWriteObject(
const char *oid,
int typ, PutulFunc *pf, uint32_t commmask )
259 PopulatelookUpObj( oid, typ, (
void * ) pf, PutulFunction, commmask );
261 SNMPWriteObject(
const char *oid,
int typ, PutullFunc *pf, uint32_t commmask )
263 PopulatelookUpObj( oid, typ, (
void * ) pf, PutullFunction, commmask );
265 SNMPWriteObject(
const char *oid,
int typ, PutMadrFunc *pf, uint32_t commmask )
267 PopulatelookUpObj( oid, typ, (
void * ) pf, PutMadrFunction, commmask );
272void InitializeMibs();
275#define SNMPREADFUNC(w,x,y,z,q) static SNMPReadObject W##w(x,y,z,q);
276#define SNMPWRITEFUNC(w,x,y,z,q) static SNMPWriteObject R##w(x,y,z,q);
278void AddToIndex(
int asn_type, snmp_typeObjID val,
int &len,
int *oidadd );
279void AddToIndex(
int asn_type, snmp_typeString val,
int &len,
int *oidadd );
280void AddToIndex(
int asn_type, snmp_typeEnumVal val,
int &len,
int *oidadd );
281void AddToIndex(
int asn_type, snmp_typeINTEGER val,
int &len,
int *oidadd );
282void AddToIndex(
int asn_type,
snmp_typeNetAddr val,
int &len,
int *oidadd );
283void AddToIndex(
int asn_type, snmp_typeCounter val,
int &len,
int *oidadd );
284void AddToIndex(
int asn_type, snmp_typeGauge val,
int &len,
int *oidadd );
285void AddToIndex(
int asn_type, snmp_typeTimeTic val,
int &len,
int *oidadd );
286void AddToIndex(
int asn_type, snmp_typeCounter64 val,
int &len,
int *oidadd );
287void AddToIndex(
int asn_type, snmp_typeUnsigned val,
int &len,
int *oidadd );
288void AddToIndex(
int asn_type, snmp_typeUInteger val,
int &len,
int *oidadd );
289void AddToIndex(
int asn_type, snmp_typeInteger32 val,
int &len,
int *oidadd );
290void AddToIndex(
int asn_type,
snmp_typeIpAddr val,
int &len,
int *oidadd );
291void AddToIndex(
int asn_type, snmp_typeTimeTicks val,
int &len,
int *oidadd );
296typedef void ( TableElementFunc )( SNMP_Request &req,
void *data_el,
int subid );
298void AddSnmpEntry(
int subid,
302 TableElementFunc *pf,
304 uint32_t comm_mask );
306void AddSnmpWriteEntry(
int asn_type,
312 uint32_t comm_mask );
313void AddSnmpWriteEntry(
int asn_type,
319 uint32_t comm_mask );
321void AddSnmpWriteEntry(
int asn_type,
327 uint32_t comm_mask );
331void AddSnmpWriteEntry(
int asn_type,
337 uint32_t comm_mask );
338void AddSnmpWriteEntry(
int asn_type,
344 uint32_t comm_mask );
345void AddSnmpWriteEntry(
int asn_type,
351 uint32_t comm_mask );
352void AddSnmpWriteEntry(
int asn_type,
358 uint32_t comm_mask );
359void AddSnmpWriteEntry(
int asn_type,
365 uint32_t comm_mask );
367void SnmpRemoveTableElement(
const char *root,
void *data_el );
Used to store and manipulate IPv4 addresses in dual stack mode.
Definition nettypes.h:225
Used to hold and manipulate IPv4 and IPv6 addresses in dual stack mode.
Definition ipv6_addr.h:41
Used to store and manipulate MAC addresses.
Definition nettypes.h:69
class MACADR MACADR
Used to store and manipulate MAC addresses.