ReactOS 0.4.15-dev-8131-g4988de4
snmp.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2005 Juan Lang
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18#ifndef _WINE_SNMP_H
19#define _WINE_SNMP_H
20
21#ifndef __WINESRC__
22# include <windows.h>
23#else
24# include <windef.h>
25#endif
26
27#include <pshpack4.h>
28
29typedef struct {
34
35typedef struct {
39
53
54typedef struct {
56 union {
69 } asnValue;
70} AsnAny;
71
74
75typedef struct {
79
80typedef struct {
84
85#include <poppack.h>
86
87#define ASN_UNIVERSAL 0x00
88#define ASN_APPLICATION 0x40
89#define ASN_CONTEXT 0x80
90#define ASN_PRIVATE 0xc0
91#define ASN_PRIMITIVE 0x00
92#define ASN_CONSTRUCTOR 0x20
93
94#define SNMP_PDU_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x00)
95#define SNMP_PDU_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x01)
96#define SNMP_PDU_RESPONSE (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x02)
97#define SNMP_PDU_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x03)
98#define SNMP_PDU_V1TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x04)
99#define SNMP_PDU_GETBULK (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x05)
100#define SNMP_PDU_INFORM (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x06)
101#define SNMP_PDU_TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x07)
102
103#define ASN_INTEGER (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x02)
104#define ASN_BITS (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03)
105#define ASN_OCTETSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x04)
106#define ASN_NULL (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x05)
107#define ASN_OBJECTIDENTIFIER (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x06)
108#define ASN_INTEGER32 ASN_INTEGER
109
110#define ASN_SEQUENCE (ASN_UNIVERSAL | ASN_CONSTRUCTOR | 0x10)
111#define ASN_SEQUENCEOF ASN_SEQUENCE
112
113#define ASN_IPADDRESS (ASN_APPLICATION | ASN_PRIMITIVE | 0x00)
114#define ASN_COUNTER32 (ASN_APPLICATION | ASN_PRIMITIVE | 0x01)
115#define ASN_GAUGE32 (ASN_APPLICATION | ASN_PRIMITIVE | 0x02)
116#define ASN_TIMETICKS (ASN_APPLICATION | ASN_PRIMITIVE | 0x03)
117#define ASN_OPAQUE (ASN_APPLICATION | ASN_PRIMITIVE | 0x04)
118#define ASN_COUNTER64 (ASN_APPLICATION | ASN_PRIMITIVE | 0x06)
119#define ASN_UNSIGNED32 (ASN_APPLICATION | ASN_PRIMITIVE | 0x07)
120
121#define SNMP_EXCEPTION_NOSUCHOBJECT (ASN_CONTEXT | ASN_PRIMITIVE | 0x00)
122#define SNMP_EXCEPTION_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x01)
123#define SNMP_EXCEPTION_ENDOFMIBVIEW (ASN_CONTEXT | ASN_PRIMITIVE | 0x02)
124
125#define SNMP_EXTENSION_GET SNMP_PDU_GET
126#define SNMP_EXTENSION_GET_NEXT SNMP_PDU_GETNEXT
127#define SNMP_EXTENSION_GET_BULK SNMP_PDU_GETBULK
128#define SNMP_EXTENSION_SET_TEST (ASN_PRIVATE | ASN_CONSTRUCTOR | 0x0)
129#define SNMP_EXTENSION_SET_COMMIT SNMP_PDU_SET
130#define SNMP_EXTENSION_SET_UNDO (ASN_PRIVATE | ASN_CONSTRUCTOR | 0x1)
131#define SNMP_EXTENSION_SET_CLEANUP (ASN_PRIVATE | ASN_CONSTRUCTOR | 0x2)
132
133#define SNMP_ERRORSTATUS_NOERROR 0
134#define SNMP_ERRORSTATUS_TOOBIG 1
135#define SNMP_ERRORSTATUS_NOSUCHNAME 2
136#define SNMP_ERRORSTATUS_BADVALUE 3
137#define SNMP_ERRORSTATUS_READONLY 4
138#define SNMP_ERRORSTATUS_GENERR 5
139#define SNMP_ERRORSTATUS_NOACCESS 6
140#define SNMP_ERRORSTATUS_WRONGTYPE 7
141#define SNMP_ERRORSTATUS_WRONGLENGTH 8
142#define SNMP_ERRORSTATUS_WRONGENCODING 9
143#define SNMP_ERRORSTATUS_WRONGVALUE 10
144#define SNMP_ERRORSTATUS_NOCREATION 11
145#define SNMP_ERRORSTATUS_INCONSISTENTVALUE 12
146#define SNMP_ERRORSTATUS_RESOURCEUNAVAILABLE 13
147#define SNMP_ERRORSTATUS_COMMITFAILED 14
148#define SNMP_ERRORSTATUS_UNDOFAILED 15
149#define SNMP_ERRORSTATUS_AUTHORIZATIONERROR 16
150#define SNMP_ERRORSTATUS_NOTWRITABLE 17
151#define SNMP_ERRORSTATUS_INCONSISTENTNAME 18
152
153#define SNMP_GENERICTRAP_COLDSTART 0
154#define SNMP_GENERICTRAP_WARMSTART 1
155#define SNMP_GENERICTRAP_LINKDOWN 2
156#define SNMP_GENERICTRAP_LINKUP 3
157#define SNMP_GENERICTRAP_AUTHFAILURE 4
158#define SNMP_GENERICTRAP_EGPNEIGHLOSS 5
159#define SNMP_GENERICTRAP_ENTERSPECIFIC 6
160
161#define SNMP_ACCESS_NONE 0
162#define SNMP_ACCESS_NOTIFY 1
163#define SNMP_ACCESS_READ_ONLY 2
164#define SNMP_ACCESS_READ_WRITE 3
165#define SNMP_ACCESS_READ_CREATE 4
166
167#define SNMP_LOG_SILENT 0
168#define SNMP_LOG_FATAL 1
169#define SNMP_LOG_ERROR 2
170#define SNMP_LOG_WARNING 3
171#define SNMP_LOG_TRACE 4
172#define SNMP_LOG_VERBOSE 5
173
174#define SNMP_OUTPUT_TO_CONSOLE 1
175#define SNMP_OUTPUT_TO_LOGFILE 2
176#define SNMP_OUTPUT_TO_EVENTLOG 4
177#define SNMP_OUTPUT_TO_DEBUGGER 8
178
179#define DEFINE_SIZEOF(x) (sizeof(x)/sizeof((x)[0]))
180#define DEFINE_OID(x) { DEFINE_SIZEOF(x),(x) }
181#define DEFINE_NULLOID() { 0, NULL }
182#define DEFINE_NULLOCTENTS() { NULL, 0, FALSE }
183
184#define DEFAULT_SNMP_PORT_UDP 161
185#define DEFAULT_SNMP_PORT_IPX 36879
186#define DEFAULT_SNMPTRAP_PORT_UDP 162
187#define DEFAULT_SNMPTRAP_PORT_IPX 36880
188
189#define SNMP_MAX_OID_LEN 128
190
191#define SNMP_MEM_ALLOC_ERROR 0
192#define SNMP_BERAPI_INVALID_LENGTH 10
193#define SNMP_BERAPI_INVALID_TAG 11
194#define SNMP_BERAPI_OVERFLOW 12
195#define SNMP_BERAPI_SHORT_BUFFER 13
196#define SNMP_BERAPI_INVALID_OBJELEM 14
197#define SNMP_PDUAPI_UNRECOGNIZED_PDU 20
198#define SNMP_PDUAPI_INVALID_ES 21
199#define SNMP_PDUAPI_INVALID_GT 22
200#define SNMP_AUTHAPI_INVALID_VERSION 30
201#define SNMP_AUTHAPI_INVALID_MSG_TYPE 31
202#define SNMP_AUTHAPI_TRIV_AUTH_FAILED 32
203
204#define SNMPAPI_NOERROR TRUE
205#define SNMPAPI_ERROR FALSE
206
207#ifdef __cplusplus
208extern "C" {
209#endif
210
211BOOL WINAPI SnmpExtensionInit(DWORD dwUptimeReference,
212 HANDLE *phSubagentTrapEvent, AsnObjectIdentifier *pFirstSupportedRegion);
214
216
217BOOL WINAPI SnmpExtensionQuery(BYTE bPduType, SnmpVarBindList *pVarBindList,
218 AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex);
219BOOL WINAPI SnmpExtensionQueryEx(UINT nRequestType, UINT nTransactionId,
220 SnmpVarBindList *pVarBindList, AsnOctetString *pContextInfo,
221 AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex);
222
224 AsnInteger32 *pGenericTrapId, AsnInteger32 *pSpecificTrapId,
225 AsnTimeticks *pTimeStamp, SnmpVarBindList *pVarBindList);
226
228
229typedef BOOL (WINAPI *PFNSNMPEXTENSIONINIT)(DWORD dwUptimeReference,
230 HANDLE *phSubagentTrapEvent, AsnObjectIdentifier *pFirstSupportedRegion);
232 AsnObjectIdentifier *pNextSupportedRegion);
233
234typedef BOOL (WINAPI *PFNSNMPEXTENSIONMONITOR)(LPVOID pAgentMgmtData);
235
237 SnmpVarBindList *pVarBindList, AsnInteger32 *pErrorStatus,
238 AsnInteger32 *pErrorIndex);
239typedef BOOL (WINAPI *PFNSNMPEXTENSIONQUERYEX)(UINT nRequestType,
240 UINT nTransactionId, SnmpVarBindList *pVarBindList,
241 AsnOctetString *pContextInfo, AsnInteger32 *pErrorStatus,
242 AsnInteger32 *pErrorIndex);
243
245 AsnInteger32 *pGenericTrapId, AsnInteger32 *pSpecificTrapId,
246 AsnTimeticks *pTimeStamp, SnmpVarBindList *pVarBindList);
247
249
251 AsnObjectIdentifier *pOidSrc);
253 AsnObjectIdentifier *pOidSrc);
255 AsnObjectIdentifier *pOid2);
257 AsnObjectIdentifier *pOid2, UINT nSubIds);
259
261 AsnOctetString *pOctets2);
263 AsnOctetString *pOctets2, UINT nChars);
265 AsnOctetString *pOctetsSrc);
267
268INT WINAPI SnmpUtilAsnAnyCpy(AsnAny *pAnyDst, AsnAny *pAnySrc);
270
273
275 SnmpVarBindList *pVblSrc);
277
281
283LPSTR WINAPI SnmpUtilIdsToA(UINT *Ids, UINT IdLength);
284
287
291
292VOID WINAPIV SnmpUtilDbgPrint(INT nLogLevel, LPSTR szFormat, ...);
293
294#ifdef __cplusplus
295}
296#endif
297
298#endif /* _WINE_SNMP_H */
#define VOID
Definition: acefi.h:82
DWORD WINAPI SnmpSvcGetUptime(void)
Definition: main.c:145
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned int UINT
Definition: ndis.h:50
#define BOOL
Definition: nt_native.h:43
long LONG
Definition: pedump.c:60
DWORD const PULONGLONG pTimeStamp
Definition: register.cpp:76
#define WINAPIV
Definition: sdbpapi.h:64
INT WINAPI SnmpUtilOidNCmp(AsnObjectIdentifier *pOid1, AsnObjectIdentifier *pOid2, UINT nSubIds)
Definition: main.c:358
INT WINAPI SnmpUtilOidCmp(AsnObjectIdentifier *pOid1, AsnObjectIdentifier *pOid2)
Definition: main.c:382
INT WINAPI SnmpUtilOidCpy(AsnObjectIdentifier *pOidDst, AsnObjectIdentifier *pOidSrc)
Definition: main.c:319
AsnUnsigned32 AsnGauge32
Definition: snmp.h:44
VOID(WINAPI * PFNSNMPEXTENSIONCLOSE)(VOID)
Definition: snmp.h:248
VOID WINAPI SnmpUtilMemFree(LPVOID pMem)
Definition: main.c:188
BOOL WINAPI SnmpExtensionMonitor(LPVOID pAgentMgmtData)
ULARGE_INTEGER AsnCounter64
Definition: snmp.h:42
BOOL(WINAPI * PFNSNMPEXTENSIONMONITOR)(LPVOID pAgentMgmtData)
Definition: snmp.h:234
AsnUnsigned32 AsnTimeticks
Definition: snmp.h:45
BOOL(WINAPI * PFNSNMPEXTENSIONINITEX)(AsnObjectIdentifier *pNextSupportedRegion)
Definition: snmp.h:231
AsnOctetString AsnImplicitSequence
Definition: snmp.h:48
VOID WINAPI SnmpSvcSetLogType(INT nLogType)
AsnUnsigned32 AsnCounter32
Definition: snmp.h:43
INT WINAPI SnmpUtilOctetsCpy(AsnOctetString *pOctetsDst, AsnOctetString *pOctetsSrc)
Definition: main.c:215
VOID WINAPI SnmpUtilVarBindListFree(SnmpVarBindList *pVbl)
Definition: main.c:480
VOID WINAPI SnmpUtilPrintOid(AsnObjectIdentifier *Oid)
Definition: main.c:549
VOID WINAPI SnmpExtensionClose(VOID)
LPSTR WINAPI SnmpUtilIdsToA(UINT *Ids, UINT IdLength)
Definition: main.c:497
BOOL WINAPI SnmpExtensionInit(DWORD dwUptimeReference, HANDLE *phSubagentTrapEvent, AsnObjectIdentifier *pFirstSupportedRegion)
Definition: main.c:1313
BOOL WINAPI SnmpExtensionInitEx(AsnObjectIdentifier *pNextSupportedRegion)
VOID WINAPIV SnmpUtilDbgPrint(INT nLogLevel, LPSTR szFormat,...)
Definition: main.c:162
BOOL(WINAPI * PFNSNMPEXTENSIONINIT)(DWORD dwUptimeReference, HANDLE *phSubagentTrapEvent, AsnObjectIdentifier *pFirstSupportedRegion)
Definition: snmp.h:229
VOID WINAPI SnmpUtilAsnAnyFree(AsnAny *pAny)
Definition: main.c:206
AsnOctetString AsnDisplayString
Definition: snmp.h:51
BOOL(WINAPI * PFNSNMPEXTENSIONTRAP)(AsnObjectIdentifier *pEnterpriseOid, AsnInteger32 *pGenericTrapId, AsnInteger32 *pSpecificTrapId, AsnTimeticks *pTimeStamp, SnmpVarBindList *pVarBindList)
Definition: snmp.h:244
BOOL(WINAPI * PFNSNMPEXTENSIONQUERYEX)(UINT nRequestType, UINT nTransactionId, SnmpVarBindList *pVarBindList, AsnOctetString *pContextInfo, AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex)
Definition: snmp.h:239
VOID WINAPI SnmpSvcSetLogLevel(INT nLogLevel)
LONG AsnInteger32
Definition: snmp.h:40
BOOL(WINAPI * PFNSNMPEXTENSIONQUERY)(BYTE bPduType, SnmpVarBindList *pVarBindList, AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex)
Definition: snmp.h:236
INT WINAPI SnmpUtilOidAppend(AsnObjectIdentifier *pOidDst, AsnObjectIdentifier *pOidSrc)
Definition: main.c:289
AsnAny AsnObjectSyntax
Definition: snmp.h:73
AsnOctetString AsnSequence
Definition: snmp.h:47
AsnOctetString AsnIPAddress
Definition: snmp.h:49
ULONG AsnUnsigned32
Definition: snmp.h:41
LPSTR WINAPI SnmpUtilOidToA(AsnObjectIdentifier *Oid)
Definition: main.c:534
AsnOctetString AsnNetworkAddress
Definition: snmp.h:50
BOOL WINAPI SnmpExtensionTrap(AsnObjectIdentifier *pEnterpriseOid, AsnInteger32 *pGenericTrapId, AsnInteger32 *pSpecificTrapId, AsnTimeticks *pTimeStamp, SnmpVarBindList *pVarBindList)
VOID WINAPI SnmpUtilVarBindFree(SnmpVarBind *pVb)
Definition: main.c:425
VOID WINAPI SnmpUtilOidFree(AsnObjectIdentifier *pOid)
Definition: main.c:344
INT WINAPI SnmpUtilVarBindListCpy(SnmpVarBindList *pVblDst, SnmpVarBindList *pVblSrc)
Definition: main.c:440
LPVOID WINAPI SnmpUtilMemAlloc(UINT nBytes) __WINE_ALLOC_SIZE(1)
Definition: main.c:170
VOID WINAPI SnmpUtilPrintAsnAny(AsnAny *pAny)
Definition: main.c:568
INT WINAPI SnmpUtilOctetsNCmp(AsnOctetString *pOctets1, AsnOctetString *pOctets2, UINT nChars)
Definition: main.c:258
BOOL WINAPI SnmpExtensionQuery(BYTE bPduType, SnmpVarBindList *pVarBindList, AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex)
Definition: main.c:1372
BOOL WINAPI SnmpExtensionQueryEx(UINT nRequestType, UINT nTransactionId, SnmpVarBindList *pVarBindList, AsnOctetString *pContextInfo, AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex)
AsnObjectIdentifier AsnObjectName
Definition: snmp.h:72
AsnOctetString AsnOpaque
Definition: snmp.h:52
VOID WINAPI SnmpUtilOctetsFree(AsnOctetString *pOctets)
Definition: main.c:242
AsnOctetString AsnBits
Definition: snmp.h:46
INT WINAPI SnmpUtilOctetsCmp(AsnOctetString *pOctets1, AsnOctetString *pOctets2)
Definition: main.c:276
INT WINAPI SnmpUtilAsnAnyCpy(AsnAny *pAnyDst, AsnAny *pAnySrc)
Definition: main.c:197
INT WINAPI SnmpUtilVarBindCpy(SnmpVarBind *pVbDst, SnmpVarBind *pVbSrc)
Definition: main.c:395
LPVOID WINAPI SnmpUtilMemReAlloc(LPVOID pMem, UINT nBytes) __WINE_ALLOC_SIZE(2)
Definition: main.c:179
Definition: snmp.h:54
AsnCounter64 counter64
Definition: snmp.h:59
AsnSequence sequence
Definition: snmp.h:63
AsnGauge32 gauge
Definition: snmp.h:66
AsnTimeticks ticks
Definition: snmp.h:67
BYTE asnType
Definition: snmp.h:55
AsnCounter32 counter
Definition: snmp.h:65
AsnInteger32 number
Definition: snmp.h:57
AsnObjectIdentifier object
Definition: snmp.h:62
AsnUnsigned32 unsigned32
Definition: snmp.h:58
AsnBits bits
Definition: snmp.h:61
AsnOctetString string
Definition: snmp.h:60
AsnIPAddress address
Definition: snmp.h:64
AsnOpaque arbitrary
Definition: snmp.h:68
UINT * ids
Definition: snmp.h:37
BOOL dynamic
Definition: snmp.h:32
UINT length
Definition: snmp.h:31
BYTE * stream
Definition: snmp.h:30
SnmpVarBind * list
Definition: snmp.h:81
UINT len
Definition: snmp.h:82
AsnObjectName name
Definition: snmp.h:76
AsnObjectSyntax value
Definition: snmp.h:77
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
#define WINAPI
Definition: msvc.h:6
#define __WINE_ALLOC_SIZE(x)
Definition: winnt_old.h:84
char * LPSTR
Definition: xmlstorage.h:182
unsigned char BYTE
Definition: xxhash.c:193