Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenwinsnmp.h
Go to the documentation of this file.
00001 /* 00002 winsnmp.h - Header file for the Windows SNMP API 00003 00004 Written by Filip Navara <xnavara@volny.cz> 00005 00006 References (2003-08-25): 00007 Windows SNMP 00008 http://www.winsnmp.com/docs/winsnmp.doc 00009 00010 WinSNMP v2.0 Addendum 00011 http://www.winsnmp.com/docs/winsnmp2.txt 00012 00013 WinSNMP v3.0 API Addendum 00014 http://www.winsnmp.com/docs/winsnmp3.htm 00015 00016 WinSNMP Reference 00017 http://msdn.microsoft.com/library/en-us/snmp/snmp/winsnmp_api_reference.asp 00018 00019 This library is distributed in the hope that it will be useful, 00020 but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00022 */ 00023 00024 #ifndef _WINSNMP_H 00025 #define _WINSNMP_H 00026 00027 #ifndef _WINDOWS_H 00028 #include <windows.h> 00029 #endif 00030 00031 #include <pshpack4.h> 00032 00033 #ifndef WINSNMPAPI 00034 #define WINSNMPAPI WINAPI 00035 #endif 00036 00037 #ifdef __cplusplus 00038 extern "C" { 00039 #endif 00040 00041 #define MAXOBJIDSIZE 128 00042 #define MAXOBJIDSTRSIZE 1408 00043 #define MAXVENDORINFO 32 00044 #ifndef _SNMP_ASN_DEFINED 00045 #define _SNMP_ASN_DEFINED 00046 #define ASN_UNIVERSAL 0x00 00047 #define ASN_PRIMITIVE 0x00 00048 #define ASN_CONSTRUCTOR 0x20 00049 #define ASN_APPLICATION 0x40 00050 #define ASN_CONTEXT 0x80 00051 #define ASN_PRIVATE 0xC0 00052 #define SNMP_PDU_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0) 00053 #define SNMP_PDU_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 1) 00054 #define SNMP_PDU_RESPONSE (ASN_CONTEXT | ASN_CONSTRUCTOR | 2) 00055 #define SNMP_PDU_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 3) 00056 #define SNMP_PDU_GETBULK (ASN_CONTEXT | ASN_CONSTRUCTOR | 4) 00057 #define SNMP_PDU_V1TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 4) 00058 #define SNMP_PDU_INFORM (ASN_CONTEXT | ASN_CONSTRUCTOR | 6) 00059 #define SNMP_PDU_TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 7) 00060 #define SNMP_PDU_REPORT (ASN_CONTEXT | ASN_CONSTRUCTOR | 8) 00061 #endif /* _SNMP_ASN_DEFINED */ 00062 #define SNMP_SYNTAX_SEQUENCE (ASN_UNIVERSAL | ASN_CONSTRUCTOR | 0x10) 00063 #define SNMP_SYNTAX_INT (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x02) 00064 #define SNMP_SYNTAX_BITS (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03) 00065 #define SNMP_SYNTAX_OCTETS (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x04) 00066 #define SNMP_SYNTAX_NULL (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x05) 00067 #define SNMP_SYNTAX_OID (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x06) 00068 #define SNMP_SYNTAX_IPADDR (ASN_APPLICATION | ASN_PRIMITIVE | 0x00) 00069 #define SNMP_SYNTAX_CNTR32 (ASN_APPLICATION | ASN_PRIMITIVE | 0x01) 00070 #define SNMP_SYNTAX_GAUGE32 (ASN_APPLICATION | ASN_PRIMITIVE | 0x02) 00071 #define SNMP_SYNTAX_TIMETICKS (ASN_APPLICATION | ASN_PRIMITIVE | 0x03) 00072 #define SNMP_SYNTAX_OPAQUE (ASN_APPLICATION | ASN_PRIMITIVE | 0x04) 00073 #define SNMP_SYNTAX_NSAPADDR (ASN_APPLICATION | ASN_PRIMITIVE | 0x05) 00074 #define SNMP_SYNTAX_CNTR64 (ASN_APPLICATION | ASN_PRIMITIVE | 0x06) 00075 #define SNMP_SYNTAX_UINT32 (ASN_APPLICATION | ASN_PRIMITIVE | 0x07) 00076 #define SNMP_SYNTAX_NOSUCHOBJECT (ASN_CONTEXT | ASN_PRIMITIVE | 0x00) 00077 #define SNMP_SYNTAX_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x01) 00078 #define SNMP_SYNTAX_ENDOFMIBVIEW (ASN_CONTEXT | ASN_PRIMITIVE | 0x02) 00079 #define SNMP_SYNTAX_INT32 SNMP_SYNTAX_INT 00080 #define SNMP_TRAP_COLDSTART 0 00081 #define SNMP_TRAP_WARMSTART 1 00082 #define SNMP_TRAP_LINKDOWN 2 00083 #define SNMP_TRAP_LINKUP 3 00084 #define SNMP_TRAP_AUTHFAIL 4 00085 #define SNMP_TRAP_EGPNEIGHBORLOSS 5 00086 #define SNMP_TRAP_ENTERPRISESPECIFIC 6 00087 #define SNMP_ERROR_NOERROR 0 00088 #define SNMP_ERROR_TOOBIG 1 00089 #define SNMP_ERROR_NOSUCHNAME 2 00090 #define SNMP_ERROR_BADVALUE 3 00091 #define SNMP_ERROR_READONLY 4 00092 #define SNMP_ERROR_GENERR 5 00093 #define SNMP_ERROR_NOACCESS 6 00094 #define SNMP_ERROR_WRONGTYPE 7 00095 #define SNMP_ERROR_WRONGLENGTH 8 00096 #define SNMP_ERROR_WRONGENCODING 9 00097 #define SNMP_ERROR_WRONGVALUE 10 00098 #define SNMP_ERROR_NOCREATION 11 00099 #define SNMP_ERROR_INCONSISTENTVALUE 12 00100 #define SNMP_ERROR_RESOURCEUNAVAILABLE 13 00101 #define SNMP_ERROR_COMMITFAILED 14 00102 #define SNMP_ERROR_UNDOFAILED 15 00103 #define SNMP_ERROR_AUTHORIZATIONERROR 16 00104 #define SNMP_ERROR_NOTWRITABLE 17 00105 #define SNMP_ERROR_INCONSISTENTNAME 18 00106 #define SNMP_SEC_MODEL_V1 1 00107 #define SNMP_SEC_MODEL_V2 2 00108 #define SNMP_SEC_MODEL_USM 3 00109 #define SNMP_NOAUTH_NOPRIV 0 00110 #define SNMP_AUTH_NOPRIV 1 00111 #define SNMP_AUTH_PRIV 3 00112 #define SNMP_USM_NO_AUTH_PROTOCOL 1 00113 #define SNMP_USM_HMACMD5_AUTH_PROTOCOL 2 00114 #define SNMP_USM_HMACSHA_AUTH_PROTOCOL 3 00115 #define SNMP_USM_NO_PRIV_PROTOCOL 1 00116 #define SNMP_USM_DES_PRIV_PROTOCOL 2 00117 #define SNMPAPI_TRANSLATED 0 00118 #define SNMPAPI_UNTRANSLATED_V1 1 00119 #define SNMPAPI_UNTRANSLATED_V2 2 00120 #define SNMPAPI_UNTRANSLATED_V3 3 00121 #define SNMPAPI_OFF 0 00122 #define SNMPAPI_ON 1 00123 #define SNMPAPI_FAILURE 0 00124 #define SNMPAPI_SUCCESS 1 00125 #define SNMPAPI_NO_SUPPORT 0 00126 #define SNMPAPI_V1_SUPPORT 1 00127 #define SNMPAPI_V2_SUPPORT 2 00128 #define SNMPAPI_M2M_SUPPORT 3 00129 #define SNMPAPI_V3_SUPPORT 3 00130 #define SNMPAPI_ALLOC_ERROR 2 00131 #define SNMPAPI_CONTEXT_INVALID 3 00132 #define SNMPAPI_CONTEXT_UNKNOWN 4 00133 #define SNMPAPI_ENTITY_INVALID 5 00134 #define SNMPAPI_ENTITY_UNKNOWN 6 00135 #define SNMPAPI_INDEX_INVALID 7 00136 #define SNMPAPI_NOOP 8 00137 #define SNMPAPI_OID_INVALID 9 00138 #define SNMPAPI_OPERATION_INVALID 10 00139 #define SNMPAPI_OUTPUT_TRUNCATED 11 00140 #define SNMPAPI_PDU_INVALID 12 00141 #define SNMPAPI_SESSION_INVALID 13 00142 #define SNMPAPI_SYNTAX_INVALID 14 00143 #define SNMPAPI_VBL_INVALID 15 00144 #define SNMPAPI_MODE_INVALID 16 00145 #define SNMPAPI_SIZE_INVALID 17 00146 #define SNMPAPI_NOT_INITIALIZED 18 00147 #define SNMPAPI_MESSAGE_INVALID 19 00148 #define SNMPAPI_HWND_INVALID 20 00149 #define SNMPAPI_ENGINE_INVALID 30 00150 #define SNMPAPI_ENGINE_DISCOVERY_FAILED 31 00151 #define SNMPAPI_OTHER_ERROR 99 00152 #define SNMPAPI_TL_NOT_INITIALIZED 100 00153 #define SNMPAPI_TL_NOT_SUPPORTED 101 00154 #define SNMPAPI_TL_NOT_AVAILABLE 102 00155 #define SNMPAPI_TL_RESOURCE_ERROR 103 00156 #define SNMPAPI_TL_UNDELIVERABLE 104 00157 #define SNMPAPI_TL_SRC_INVALID 105 00158 #define SNMPAPI_TL_INVALID_PARAM 106 00159 #define SNMPAPI_TL_IN_USE 107 00160 #define SNMPAPI_TL_TIMEOUT 108 00161 #define SNMPAPI_TL_PDU_TOO_BIG 109 00162 #define SNMPAPI_TL_OTHER 199 00163 #define SNMPAPI_RPT_INVALIDMSG 200 00164 #define SNMPAPI_RPT_INASNPARSEERR 201 00165 #define SNMPAPI_RPT_UNKNOWNSECMODEL 202 00166 #define SNMPAPI_RPT_UNKNOWNENGINEID 203 00167 #define SNMPAPI_RPT_UNSUPPSECLEVEL 204 00168 #define SNMPAPI_RPT_UNKNOWNUSERNAME 205 00169 #define SNMPAPI_RPT_WRONGDIGEST 206 00170 #define SNMPAPI_RPT_NOTINTIMEWINDOW 207 00171 #define SNMPAPI_RPT_DECRYPTIONERROR 208 00172 #define SNMPAPI_RPT_OTHER 299 00173 00174 #ifndef RC_INVOKED 00175 00176 typedef HANDLE HSNMP_SESSION, *LPHSNMP_SESSION; 00177 typedef HANDLE HSNMP_CONTEXT, *LPHSNMP_CONTEXT; 00178 typedef HANDLE HSNMP_VBL, *LPHSNMP_VBL; 00179 typedef HANDLE HSNMP_PDU, *LPHSNMP_PDU; 00180 typedef HANDLE HSNMP_ENTITY, *LPHSNMP_ENTITY; 00181 typedef unsigned char smiBYTE, *smiLPBYTE; 00182 typedef signed int smiINT, *smiLPINT; 00183 typedef signed int smiINT32, *smiLPINT32; 00184 typedef unsigned int smiUINT32, *smiLPUINT32; 00185 typedef smiUINT32 smiCNTR32, *smiLPCNTR32; 00186 typedef smiUINT32 smiGAUGE32, *smiLPGAUGE32; 00187 typedef smiUINT32 smiTIMETICKS, *smiLPTIMETICKS; 00188 typedef smiUINT32 SNMPAPI_STATUS; 00189 typedef struct { 00190 smiUINT32 len; 00191 smiLPBYTE ptr; 00192 } smiOCTETS, *smiLPOCTETS, smiOPAQUE, *smiLPOPAQUE, smiBITS, *smiLPBITS, smiIPADDR, *smiLPIPADDR, smiNSAPADDR, *smiLPNSAPADDR; 00193 typedef const smiLPOCTETS smiLPCOCTETS; 00194 typedef struct { 00195 smiUINT32 len; 00196 smiLPUINT32 ptr; 00197 } smiOID, *smiLPOID; 00198 typedef const smiLPOID smiLPCOID; 00199 typedef struct { 00200 smiUINT32 hipart; 00201 smiUINT32 lopart; 00202 } smiCNTR64, *smiLPCNTR64; 00203 typedef struct { 00204 smiUINT32 syntax; 00205 union { 00206 smiINT sNumber; 00207 smiUINT32 uNumber; 00208 smiCNTR64 hNumber; 00209 smiOCTETS string; 00210 smiOID oid; 00211 smiBYTE empty; 00212 } value; 00213 } smiVALUE, *smiLPVALUE; 00214 typedef const smiLPVALUE smiLPCVALUE; 00215 typedef struct { 00216 CHAR vendorName[MAXVENDORINFO*2]; 00217 CHAR vendorContact[MAXVENDORINFO*2]; 00218 CHAR vendorVersionId[MAXVENDORINFO]; 00219 CHAR vendorVersionDate[MAXVENDORINFO]; 00220 smiUINT32 vendorEnterprise; 00221 } smiVENDORINFO, FAR *smiLPVENDORINFO; 00222 typedef SNMPAPI_STATUS (CALLBACK *SNMPAPI_CALLBACK)(HSNMP_SESSION,HWND,UINT,WPARAM,LPARAM,LPVOID); 00223 typedef struct 00224 { 00225 HSNMP_ENTITY hEntity; 00226 HSNMP_SESSION hSession; 00227 smiUINT32 nTranslateMode; 00228 smiUINT32 nSnmpVersion; 00229 smiOCTETS dFriendlyName; 00230 smiUINT32 nAddressFamily; 00231 smiOCTETS dAddressString; 00232 smiUINT32 nRequestPort; 00233 smiUINT32 nNotificationPort; 00234 smiUINT32 nMaxMsgSize; 00235 smiOCTETS dEngineID; 00236 smiUINT32 nEngineBoots; 00237 smiUINT32 nEngineTime; 00238 smiUINT32 nEngineSeconds; 00239 smiUINT32 nRetransmitMode; 00240 smiTIMETICKS nPolicyTimeout; 00241 smiUINT32 nPolicyRetry; 00242 smiTIMETICKS nActualTimeout; 00243 smiUINT32 nActualRetry; 00244 } smiENTITYINFO, *smiLPENTITYINFO; 00245 typedef struct 00246 { 00247 HSNMP_CONTEXT hContext; 00248 HSNMP_SESSION hSession; 00249 smiUINT32 nTranslateMode; 00250 smiUINT32 nSnmpVersion; 00251 smiOCTETS dFriendlyName; 00252 smiOCTETS dContextEngineID; 00253 smiOCTETS dContextName; 00254 smiOCTETS dSecurityName; 00255 smiUINT32 nSecurityModel; 00256 smiUINT32 nSecurityLevel; 00257 smiUINT32 nSecurityAuthProtocol; 00258 smiOCTETS dSecurityAuthKey; 00259 smiUINT32 nSecurityPrivProtocol; 00260 smiOCTETS dSecurityPrivKey; 00261 } smiCONTEXTINFO, *smiLPCONTEXTINFO; 00262 00263 SNMPAPI_STATUS WINSNMPAPI SnmpCancelMsg(HSNMP_SESSION,smiINT32); 00264 SNMPAPI_STATUS WINSNMPAPI SnmpCleanup(VOID); 00265 SNMPAPI_STATUS WINSNMPAPI SnmpClose(HSNMP_SESSION); 00266 SNMPAPI_STATUS WINSNMPAPI SnmpContextToStr(HSNMP_CONTEXT,smiLPOCTETS); 00267 SNMPAPI_STATUS WINSNMPAPI SnmpCountVbl(HSNMP_VBL); 00268 HSNMP_PDU WINSNMPAPI SnmpCreatePdu(HSNMP_SESSION,smiINT,smiINT32,smiINT,smiINT,HSNMP_VBL); 00269 HSNMP_SESSION WINSNMPAPI SnmpCreateSession(HWND,UINT,SNMPAPI_CALLBACK,LPVOID); 00270 HSNMP_VBL WINSNMPAPI SnmpCreateVbl(HSNMP_SESSION,smiLPCOID,smiLPCVALUE); 00271 SNMPAPI_STATUS WINSNMPAPI SnmpDecodeMsg(HSNMP_SESSION,LPHSNMP_ENTITY,LPHSNMP_ENTITY,LPHSNMP_CONTEXT,LPHSNMP_PDU,smiLPCOCTETS); 00272 SNMPAPI_STATUS WINSNMPAPI SnmpDeleteVb(HSNMP_VBL,smiUINT32); 00273 HSNMP_PDU WINSNMPAPI SnmpDuplicatePdu(HSNMP_SESSION,HSNMP_PDU); 00274 HSNMP_VBL WINSNMPAPI SnmpDuplicateVbl(HSNMP_SESSION,HSNMP_VBL); 00275 SNMPAPI_STATUS WINSNMPAPI SnmpEncodeMsg(HSNMP_SESSION,HSNMP_ENTITY,HSNMP_ENTITY,HSNMP_CONTEXT,HSNMP_PDU,smiLPOCTETS); 00276 SNMPAPI_STATUS WINSNMPAPI SnmpEntityToStr(HSNMP_ENTITY,smiUINT32,LPSTR); 00277 SNMPAPI_STATUS WINSNMPAPI SnmpFreeContext(HSNMP_CONTEXT); 00278 SNMPAPI_STATUS WINSNMPAPI SnmpFreeDescriptor(smiUINT32,smiLPOPAQUE); 00279 SNMPAPI_STATUS WINSNMPAPI SnmpFreeEntity(HSNMP_ENTITY); 00280 SNMPAPI_STATUS WINSNMPAPI SnmpFreePdu(HSNMP_PDU); 00281 SNMPAPI_STATUS WINSNMPAPI SnmpFreeVbl(HSNMP_VBL); 00282 SNMPAPI_STATUS WINSNMPAPI SnmpGetLastError(HSNMP_SESSION); 00283 SNMPAPI_STATUS WINSNMPAPI SnmpGetPduData(HSNMP_PDU,smiLPINT,smiLPINT32,smiLPINT,smiLPINT,LPHSNMP_VBL); 00284 SNMPAPI_STATUS WINSNMPAPI SnmpGetRetransmitMode(smiLPUINT32); 00285 SNMPAPI_STATUS WINSNMPAPI SnmpGetRetry(HSNMP_ENTITY,smiLPUINT32,smiLPUINT32); 00286 SNMPAPI_STATUS WINSNMPAPI SnmpGetTimeout(HSNMP_ENTITY,smiLPTIMETICKS,smiLPTIMETICKS); 00287 SNMPAPI_STATUS WINSNMPAPI SnmpGetTranslateMode(smiLPUINT32); 00288 SNMPAPI_STATUS WINSNMPAPI SnmpGetVb(HSNMP_VBL,smiUINT32,smiLPOID,smiLPVALUE); 00289 SNMPAPI_STATUS WINSNMPAPI SnmpGetVendorInfo(smiLPVENDORINFO); 00290 SNMPAPI_STATUS WINSNMPAPI SnmpListen(HSNMP_ENTITY,SNMPAPI_STATUS); 00291 SNMPAPI_STATUS WINSNMPAPI SnmpOidCompare(smiLPCOID,smiLPCOID,smiUINT32,smiLPINT); 00292 SNMPAPI_STATUS WINSNMPAPI SnmpOidCopy(smiLPCOID,smiLPOID); 00293 SNMPAPI_STATUS WINSNMPAPI SnmpOidToStr(smiLPCOID,smiUINT32,LPSTR); 00294 HSNMP_SESSION WINSNMPAPI SnmpOpen(HWND,UINT); 00295 SNMPAPI_STATUS WINSNMPAPI SnmpRecvMsg(HSNMP_SESSION,LPHSNMP_ENTITY,LPHSNMP_ENTITY,LPHSNMP_CONTEXT,LPHSNMP_PDU); 00296 SNMPAPI_STATUS WINSNMPAPI SnmpRegister(HSNMP_SESSION,HSNMP_ENTITY,HSNMP_ENTITY,HSNMP_CONTEXT,smiLPCOID,smiUINT32); 00297 SNMPAPI_STATUS WINSNMPAPI SnmpSendMsg(HSNMP_SESSION,HSNMP_ENTITY,HSNMP_ENTITY,HSNMP_CONTEXT,HSNMP_PDU); 00298 SNMPAPI_STATUS WINSNMPAPI SnmpSetPduData(HSNMP_PDU,const smiINT *,const smiINT32 *,const smiINT *,const smiINT *,const HSNMP_VBL *); 00299 SNMPAPI_STATUS WINSNMPAPI SnmpSetPort(HSNMP_ENTITY,UINT); 00300 SNMPAPI_STATUS WINSNMPAPI SnmpSetRetransmitMode(smiUINT32); 00301 SNMPAPI_STATUS WINSNMPAPI SnmpSetRetry(HSNMP_ENTITY,smiUINT32); 00302 SNMPAPI_STATUS WINSNMPAPI SnmpSetTimeout(HSNMP_ENTITY,smiTIMETICKS); 00303 SNMPAPI_STATUS WINSNMPAPI SnmpSetTranslateMode(smiUINT32); 00304 SNMPAPI_STATUS WINSNMPAPI SnmpSetVb(HSNMP_VBL,smiUINT32,smiLPCOID,smiLPCVALUE); 00305 SNMPAPI_STATUS WINSNMPAPI SnmpStartup(smiLPUINT32,smiLPUINT32,smiLPUINT32,smiLPUINT32,smiLPUINT32); 00306 HSNMP_CONTEXT WINSNMPAPI SnmpStrToContext(HSNMP_SESSION,smiLPCOCTETS); 00307 HSNMP_ENTITY WINSNMPAPI SnmpStrToEntity(HSNMP_SESSION,LPCSTR); 00308 SNMPAPI_STATUS WINSNMPAPI SnmpStrToOid(LPCSTR,smiLPOID); 00309 /* Added in WinSNMP v3.0, not present in some (all?) versions of MS wsnmp32.dll */ 00310 HSNMP_ENTITY WINSNMPAPI SnmpCreateEntity(HSNMP_SESSION,smiLPENTITYINFO); 00311 SNMPAPI_STATUS WINSNMPAPI SnmpGetEntityInfo(HSNMP_ENTITY,smiLPENTITYINFO); 00312 SNMPAPI_STATUS WINSNMPAPI SnmpSetEntityInfo(HSNMP_ENTITY,smiLPENTITYINFO); 00313 SNMPAPI_STATUS WINSNMPAPI SnmpFreeEntityInfo(smiLPENTITYINFO); 00314 HSNMP_CONTEXT WINSNMPAPI SnmpCreateContext(HSNMP_SESSION,smiLPCONTEXTINFO); 00315 SNMPAPI_STATUS WINSNMPAPI SnmpGetContextInfo(HSNMP_CONTEXT,smiLPCONTEXTINFO); 00316 SNMPAPI_STATUS WINSNMPAPI SnmpSetContextInfo(HSNMP_CONTEXT,smiLPCONTEXTINFO); 00317 SNMPAPI_STATUS WINSNMPAPI SnmpFreeContextInfo(smiLPCONTEXTINFO); 00318 SNMPAPI_STATUS WINSNMPAPI SnmpPasswordToKey(smiLPOCTETS,smiINT32,smiLPOCTETS); 00319 00320 #endif /* RC_INVOKED */ 00321 00322 #ifdef __cplusplus 00323 } 00324 #endif 00325 #include <poppack.h> 00326 #endif Generated on Sun May 27 2012 04:32:47 for ReactOS by
1.7.6.1
|