Artifact 7e83f2fa4278c27c4a8734e1f2ddc46223a32315:
0000: 2f 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a /***************
0010: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0020: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0030: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0040: 2a 2a 2a 2a 2a 2a 2a 2a 5c 0a 2a 20 20 20 20 20 ********\.*
0050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0060: 20 20 20 20 20 20 20 20 20 20 20 6d 67 6d 74 61 mgmta
0070: 70 69 2e 64 20 20 20 20 20 20 20 20 20 20 20 20 pi.d
0080: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0090: 20 20 2a 0a 2a 20 20 20 20 20 20 20 20 20 20 20 *.*
00a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
00d0: 20 20 20 20 20 20 20 20 20 20 20 20 2a 0a 2a 20 *.*
00e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
00f0: 20 20 20 20 20 20 57 69 6e 64 6f 77 73 20 41 50 Windows AP
0100: 49 20 68 65 61 64 65 72 20 6d 6f 64 75 6c 65 20 I header module
0110: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0120: 20 20 20 20 20 20 2a 0a 2a 20 20 20 20 20 20 20 *.*
0130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0140: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0150: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0160: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0170: 2a 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 *.*
0180: 20 20 20 20 54 72 61 6e 73 6c 61 74 65 64 20 66 Translated f
0190: 72 6f 6d 20 4d 69 6e 47 57 20 57 69 6e 64 6f 77 rom MinGW Window
01a0: 73 20 68 65 61 64 65 72 73 20 20 20 20 20 20 20 s headers
01b0: 20 20 20 20 20 20 20 20 20 20 2a 0a 2a 20 20 20 *.*
01c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
01d0: 20 20 20 20 20 20 20 20 62 79 20 53 74 65 77 61 by Stewa
01e0: 72 74 20 47 6f 72 64 6f 6e 20 20 20 20 20 20 20 rt Gordon
01f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0200: 20 20 20 20 2a 0a 2a 20 20 20 20 20 20 20 20 20 *.*
0210: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0220: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0230: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 0a *.
0250: 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 *
0260: 20 20 20 20 20 20 20 20 50 6c 61 63 65 64 20 69 Placed i
0270: 6e 74 6f 20 70 75 62 6c 69 63 20 64 6f 6d 61 69 nto public domai
0280: 6e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 n
0290: 20 20 20 20 20 20 20 20 2a 0a 5c 2a 2a 2a 2a 2a *.\*****
02a0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
02b0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
02c0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
02d0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
02e0: 2a 2a 2f 0a 6d 6f 64 75 6c 65 20 77 69 6e 33 32 **/.module win32
02f0: 2e 6d 67 6d 74 61 70 69 3b 0a 0a 69 6d 70 6f 72 .mgmtapi;..impor
0300: 74 20 77 69 6e 33 32 2e 73 6e 6d 70 3b 0a 70 72 t win32.snmp;.pr
0310: 69 76 61 74 65 20 69 6d 70 6f 72 74 20 77 69 6e ivate import win
0320: 33 32 2e 77 69 6e 64 65 66 3b 0a 0a 65 6e 75 6d 32.windef;..enum
0330: 20 7b 0a 09 53 4e 4d 50 5f 4d 47 4d 54 41 50 49 {..SNMP_MGMTAPI
0340: 5f 54 49 4d 45 4f 55 54 20 3d 20 34 30 2c 0a 09 _TIMEOUT = 40,..
0350: 53 4e 4d 50 5f 4d 47 4d 54 41 50 49 5f 53 45 4c SNMP_MGMTAPI_SEL
0360: 45 43 54 5f 46 44 45 52 52 4f 52 53 2c 0a 09 53 ECT_FDERRORS,..S
0370: 4e 4d 50 5f 4d 47 4d 54 41 50 49 5f 54 52 41 50 NMP_MGMTAPI_TRAP
0380: 5f 45 52 52 4f 52 53 2c 0a 09 53 4e 4d 50 5f 4d _ERRORS,..SNMP_M
0390: 47 4d 54 41 50 49 5f 54 52 41 50 5f 44 55 50 49 GMTAPI_TRAP_DUPI
03a0: 4e 49 54 2c 0a 09 53 4e 4d 50 5f 4d 47 4d 54 41 NIT,..SNMP_MGMTA
03b0: 50 49 5f 4e 4f 54 52 41 50 53 2c 0a 09 53 4e 4d PI_NOTRAPS,..SNM
03c0: 50 5f 4d 47 4d 54 41 50 49 5f 41 47 41 49 4e 2c P_MGMTAPI_AGAIN,
03d0: 0a 09 53 4e 4d 50 5f 4d 47 4d 54 41 50 49 5f 49 ..SNMP_MGMTAPI_I
03e0: 4e 56 41 4c 49 44 5f 43 54 4c 2c 0a 09 53 4e 4d NVALID_CTL,..SNM
03f0: 50 5f 4d 47 4d 54 41 50 49 5f 49 4e 56 41 4c 49 P_MGMTAPI_INVALI
0400: 44 5f 53 45 53 53 49 4f 4e 2c 0a 09 53 4e 4d 50 D_SESSION,..SNMP
0410: 5f 4d 47 4d 54 41 50 49 5f 49 4e 56 41 4c 49 44 _MGMTAPI_INVALID
0420: 5f 42 55 46 46 45 52 20 2f 2f 20 3d 20 34 38 0a _BUFFER // = 48.
0430: 7d 0a 0a 63 6f 6e 73 74 20 4d 47 4d 43 54 4c 5f }..const MGMCTL_
0440: 53 45 54 41 47 45 4e 54 50 4f 52 54 20 3d 20 31 SETAGENTPORT = 1
0450: 3b 0a 0a 61 6c 69 61 73 20 50 56 4f 49 44 20 4c ;..alias PVOID L
0460: 50 53 4e 4d 50 5f 4d 47 52 5f 53 45 53 53 49 4f PSNMP_MGR_SESSIO
0470: 4e 3b 0a 0a 65 78 74 65 72 6e 20 28 57 69 6e 64 N;..extern (Wind
0480: 6f 77 73 29 20 7b 0a 09 42 4f 4f 4c 20 53 6e 6d ows) {..BOOL Snm
0490: 70 4d 67 72 43 6c 6f 73 65 28 4c 50 53 4e 4d 50 pMgrClose(LPSNMP
04a0: 5f 4d 47 52 5f 53 45 53 53 49 4f 4e 29 3b 0a 09 _MGR_SESSION);..
04b0: 42 4f 4f 4c 20 53 6e 6d 70 4d 67 72 43 74 6c 28 BOOL SnmpMgrCtl(
04c0: 4c 50 53 4e 4d 50 5f 4d 47 52 5f 53 45 53 53 49 LPSNMP_MGR_SESSI
04d0: 4f 4e 2c 20 44 57 4f 52 44 2c 20 4c 50 56 4f 49 ON, DWORD, LPVOI
04e0: 44 2c 20 44 57 4f 52 44 2c 20 4c 50 56 4f 49 44 D, DWORD, LPVOID
04f0: 2c 20 44 57 4f 52 44 2c 0a 09 20 20 4c 50 44 57 , DWORD,.. LPDW
0500: 4f 52 44 29 3b 0a 09 42 4f 4f 4c 20 53 6e 6d 70 ORD);..BOOL Snmp
0510: 4d 67 72 47 65 74 54 72 61 70 28 41 73 6e 4f 62 MgrGetTrap(AsnOb
0520: 6a 65 63 74 49 64 65 6e 74 69 66 69 65 72 2a 2c jectIdentifier*,
0530: 20 41 73 6e 4e 65 74 77 6f 72 6b 41 64 64 72 65 AsnNetworkAddre
0540: 73 73 2a 2c 0a 09 20 20 41 73 6e 49 6e 74 65 67 ss*,.. AsnInteg
0550: 65 72 2a 2c 20 41 73 6e 49 6e 74 65 67 65 72 2a er*, AsnInteger*
0560: 2c 20 41 73 6e 54 69 6d 65 74 69 63 6b 73 2a 2c , AsnTimeticks*,
0570: 20 53 6e 6d 70 56 61 72 42 69 6e 64 4c 69 73 74 SnmpVarBindList
0580: 2a 29 3b 0a 09 42 4f 4f 4c 20 53 6e 6d 70 4d 67 *);..BOOL SnmpMg
0590: 72 47 65 74 54 72 61 70 45 78 28 41 73 6e 4f 62 rGetTrapEx(AsnOb
05a0: 6a 65 63 74 49 64 65 6e 74 69 66 69 65 72 2a 2c jectIdentifier*,
05b0: 20 41 73 6e 4e 65 74 77 6f 72 6b 41 64 64 72 65 AsnNetworkAddre
05c0: 73 73 2a 2c 0a 09 20 20 41 73 6e 4e 65 74 77 6f ss*,.. AsnNetwo
05d0: 72 6b 41 64 64 72 65 73 73 2a 2c 20 41 73 6e 49 rkAddress*, AsnI
05e0: 6e 74 65 67 65 72 2a 2c 20 41 73 6e 49 6e 74 65 nteger*, AsnInte
05f0: 67 65 72 2a 2c 20 41 73 6e 4f 63 74 65 74 53 74 ger*, AsnOctetSt
0600: 72 69 6e 67 2a 2c 0a 09 20 20 41 73 6e 54 69 6d ring*,.. AsnTim
0610: 65 74 69 63 6b 73 2a 2c 20 53 6e 6d 70 56 61 72 eticks*, SnmpVar
0620: 42 69 6e 64 4c 69 73 74 2a 29 3b 0a 09 42 4f 4f BindList*);..BOO
0630: 4c 20 53 6e 6d 70 4d 67 72 4f 69 64 54 6f 53 74 L SnmpMgrOidToSt
0640: 72 28 41 73 6e 4f 62 6a 65 63 74 49 64 65 6e 74 r(AsnObjectIdent
0650: 69 66 69 65 72 2a 2c 20 4c 50 53 54 52 2a 29 3b ifier*, LPSTR*);
0660: 0a 09 4c 50 53 4e 4d 50 5f 4d 47 52 5f 53 45 53 ..LPSNMP_MGR_SES
0670: 53 49 4f 4e 20 53 6e 6d 70 4d 67 72 4f 70 65 6e SION SnmpMgrOpen
0680: 28 4c 50 53 54 52 2c 20 4c 50 53 54 52 2c 20 49 (LPSTR, LPSTR, I
0690: 4e 54 2c 20 49 4e 54 29 3b 0a 09 49 4e 54 20 53 NT, INT);..INT S
06a0: 6e 6d 70 4d 67 72 52 65 71 75 65 73 74 28 4c 50 nmpMgrRequest(LP
06b0: 53 4e 4d 50 5f 4d 47 52 5f 53 45 53 53 49 4f 4e SNMP_MGR_SESSION
06c0: 2c 20 42 59 54 45 2c 20 53 6e 6d 70 56 61 72 42 , BYTE, SnmpVarB
06d0: 69 6e 64 4c 69 73 74 2a 2c 0a 09 20 20 41 73 6e indList*,.. Asn
06e0: 49 6e 74 65 67 65 72 2a 2c 20 41 73 6e 49 6e 74 Integer*, AsnInt
06f0: 65 67 65 72 2a 29 3b 0a 09 42 4f 4f 4c 20 53 6e eger*);..BOOL Sn
0700: 6d 70 4d 67 72 53 74 72 54 6f 4f 69 64 28 4c 50 mpMgrStrToOid(LP
0710: 53 54 52 2c 20 41 73 6e 4f 62 6a 65 63 74 49 64 STR, AsnObjectId
0720: 65 6e 74 69 66 69 65 72 2a 29 3b 0a 09 42 4f 4f entifier*);..BOO
0730: 4c 20 53 6e 6d 70 4d 67 72 54 72 61 70 4c 69 73 L SnmpMgrTrapLis
0740: 74 65 6e 28 48 41 4e 44 4c 45 2a 29 3b 0a 7d 0a ten(HANDLE*);.}.