1 |
//////////////////////////////////////////////////////
|
2 |
// FILE : MibAccess.h
|
3 |
//
|
4 |
//
|
5 |
|
6 |
#ifndef _SNMP_ACCESS_H_
|
7 |
#define _SNMP_ACCESS_H_
|
8 |
|
9 |
#include <snmp.h>
|
10 |
#ifndef SNMP_FUNC_TYPE
|
11 |
#define SNMP_FUNC_TYPE WINAPI
|
12 |
#endif
|
13 |
|
14 |
//////////////////////////////////////////////////////////////
|
15 |
// Definition of pointers to the four functions in the Mib Dll
|
16 |
//
|
17 |
typedef BOOL (WINAPI *pSnmpExtensionInit)(
|
18 |
IN DWORD dwTimeZeroReference,
|
19 |
OUT HANDLE *hPollForTrapEvent,
|
20 |
OUT AsnObjectIdentifier *supportedView);
|
21 |
|
22 |
typedef BOOL (WINAPI *pSnmpExtensionTrap)(
|
23 |
OUT AsnObjectIdentifier *enterprise,
|
24 |
OUT AsnInteger *genericTrap,
|
25 |
OUT AsnInteger *specificTrap,
|
26 |
OUT AsnTimeticks *timeStamp,
|
27 |
OUT RFC1157VarBindList *variableBindings);
|
28 |
|
29 |
typedef BOOL (WINAPI *pSnmpExtensionQuery)(
|
30 |
IN BYTE requestType,
|
31 |
IN OUT RFC1157VarBindList *variableBindings,
|
32 |
OUT AsnInteger *errorStatus,
|
33 |
OUT AsnInteger *errorIndex);
|
34 |
|
35 |
typedef BOOL (WINAPI *pSnmpExtensionInitEx)(OUT AsnObjectIdentifier *supportedView);
|
36 |
|
37 |
|
38 |
class MibExtLoad
|
39 |
{
|
40 |
public:
|
41 |
MibExtLoad( LPSTR MibDllName, LPSTR SnmpDllName );
|
42 |
~MibExtLoad();
|
43 |
BOOL Init(DWORD dwTimeZeroReference,HANDLE *hPollForTrapEvent,AsnObjectIdentifier *supportedView);
|
44 |
BOOL InitEx(AsnObjectIdentifier *supportedView);
|
45 |
BOOL Query(BYTE requestType,OUT RFC1157VarBindList *variableBindings,
|
46 |
AsnInteger *errorStatus,AsnInteger *errorIndex);
|
47 |
|
48 |
BOOL Trap(AsnObjectIdentifier *enterprise, AsnInteger *genericTrap,
|
49 |
AsnInteger *specificTrap, AsnTimeticks *timeStamp,
|
50 |
RFC1157VarBindList *variableBindings);
|
51 |
|
52 |
public:
|
53 |
HINSTANCE m_hInst;
|
54 |
HINSTANCE m_hInst_snmputil;
|
55 |
|
56 |
private:
|
57 |
pSnmpExtensionInit m_Init;
|
58 |
pSnmpExtensionInitEx m_InitEx;
|
59 |
pSnmpExtensionQuery m_Query;
|
60 |
pSnmpExtensionTrap m_Trap;
|
61 |
|
62 |
public:
|
63 |
VOID (SNMP_FUNC_TYPE *m_SnmpUtilVarBindFree) (SnmpVarBind *);
|
64 |
SNMPAPI (SNMP_FUNC_TYPE *m_SnmpUtilOidNCmp) (AsnObjectIdentifier *, AsnObjectIdentifier *, UINT);
|
65 |
SNMPAPI (SNMP_FUNC_TYPE *m_SnmpUtilOidCpy) (AsnObjectIdentifier *, AsnObjectIdentifier *);
|
66 |
};
|
67 |
|
68 |
|
69 |
class MibII: public MibExtLoad
|
70 |
{
|
71 |
public:
|
72 |
MibII( bool load_winsock );
|
73 |
~MibII();
|
74 |
BOOL Init();
|
75 |
|
76 |
void GetIPAddress(UINT IpArray[],UINT &IpArraySize);
|
77 |
void GetIPMask(UINT IpArray[],UINT &IpArraySize);
|
78 |
|
79 |
protected:
|
80 |
bool m_load_winsock;
|
81 |
};
|
82 |
|
83 |
#endif
|