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 |
|
---|
19 | /*
|
---|
20 | * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
21 | * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
|
---|
22 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
23 | * a choice of LGPL license versions is made available with the language indicating
|
---|
24 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
25 | * of the LGPL is applied is otherwise unspecified.
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef _WINE_SNMP_H
|
---|
29 | #define _WINE_SNMP_H
|
---|
30 |
|
---|
31 | #include <windows.h>
|
---|
32 |
|
---|
33 | #include <pshpack4.h>
|
---|
34 |
|
---|
35 | typedef struct {
|
---|
36 | BYTE *stream;
|
---|
37 | UINT length;
|
---|
38 | BOOL dynamic;
|
---|
39 | } AsnOctetString;
|
---|
40 |
|
---|
41 | typedef struct {
|
---|
42 | UINT idLength;
|
---|
43 | UINT *ids;
|
---|
44 | } AsnObjectIdentifier;
|
---|
45 |
|
---|
46 | typedef LONG AsnInteger32;
|
---|
47 | typedef ULONG AsnUnsigned32;
|
---|
48 | typedef ULARGE_INTEGER AsnCounter64;
|
---|
49 | typedef AsnUnsigned32 AsnCounter32;
|
---|
50 | typedef AsnUnsigned32 AsnGauge32;
|
---|
51 | typedef AsnUnsigned32 AsnTimeticks;
|
---|
52 | typedef AsnOctetString AsnBits;
|
---|
53 | typedef AsnOctetString AsnSequence;
|
---|
54 | typedef AsnOctetString AsnImplicitSequence;
|
---|
55 | typedef AsnOctetString AsnIPAddress;
|
---|
56 | typedef AsnOctetString AsnNetworkAddress;
|
---|
57 | typedef AsnOctetString AsnDisplayString;
|
---|
58 | typedef AsnOctetString AsnOpaque;
|
---|
59 |
|
---|
60 | typedef struct {
|
---|
61 | BYTE asnType;
|
---|
62 | union {
|
---|
63 | AsnInteger32 number;
|
---|
64 | AsnUnsigned32 unsigned32;
|
---|
65 | AsnCounter64 counter64;
|
---|
66 | AsnOctetString string;
|
---|
67 | AsnBits bits;
|
---|
68 | AsnObjectIdentifier object;
|
---|
69 | AsnSequence sequence;
|
---|
70 | AsnIPAddress address;
|
---|
71 | AsnCounter32 counter;
|
---|
72 | AsnGauge32 gauge;
|
---|
73 | AsnTimeticks ticks;
|
---|
74 | AsnOpaque arbitrary;
|
---|
75 | } asnValue;
|
---|
76 | } AsnAny;
|
---|
77 |
|
---|
78 | typedef AsnObjectIdentifier AsnObjectName;
|
---|
79 | typedef AsnAny AsnObjectSyntax;
|
---|
80 |
|
---|
81 | typedef struct {
|
---|
82 | AsnObjectName name;
|
---|
83 | AsnObjectSyntax value;
|
---|
84 | } SnmpVarBind;
|
---|
85 |
|
---|
86 | typedef struct {
|
---|
87 | SnmpVarBind *list;
|
---|
88 | UINT len;
|
---|
89 | } SnmpVarBindList;
|
---|
90 |
|
---|
91 | #include <poppack.h>
|
---|
92 |
|
---|
93 | #define ASN_UNIVERSAL 0x00
|
---|
94 | #define ASN_APPLICATION 0x40
|
---|
95 | #define ASN_CONTEXT 0x80
|
---|
96 | #define ASN_PRIVATE 0xc0
|
---|
97 | #define ASN_PRIMITIVE 0x00
|
---|
98 | #define ASN_CONSTRUCTOR 0x20
|
---|
99 |
|
---|
100 | #define SNMP_PDU_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x00)
|
---|
101 | #define SNMP_PDU_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x01)
|
---|
102 | #define SNMP_PDU_RESPONSE (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x02)
|
---|
103 | #define SNMP_PDU_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x03)
|
---|
104 | #define SNMP_PDU_V1TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x04)
|
---|
105 | #define SNMP_PDU_GETBULK (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x05)
|
---|
106 | #define SNMP_PDU_INFORM (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x06)
|
---|
107 | #define SNMP_PDU_TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x07)
|
---|
108 |
|
---|
109 | #define ASN_INTEGER (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x02)
|
---|
110 | #define ASN_BITS (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03)
|
---|
111 | #define ASN_OCTETSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x04)
|
---|
112 | #define ASN_NULL (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x05)
|
---|
113 | #define ASN_OBJECTIDENTIFIER (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x06)
|
---|
114 | #define ASN_INTEGER32 ASN_INTEGER
|
---|
115 |
|
---|
116 | #define ASN_SEQUENCE (ASN_UNIVERSAL | ASN_CONSTRUCTOR | 0x10)
|
---|
117 | #define ASN_SEQUENCEOF ASN_SEQUENCE
|
---|
118 |
|
---|
119 | #define ASN_IPADDRESS (ASN_APPLICATION | ASN_PRIMITIVE | 0x00)
|
---|
120 | #define ASN_COUNTER32 (ASN_APPLICATION | ASN_PRIMITIVE | 0x01)
|
---|
121 | #define ASN_GAUGE32 (ASN_APPLICATION | ASN_PRIMITIVE | 0x02)
|
---|
122 | #define ASN_TIMETICKS (ASN_APPLICATION | ASN_PRIMITIVE | 0x03)
|
---|
123 | #define ASN_OPAQUE (ASN_APPLICATION | ASN_PRIMITIVE | 0x04)
|
---|
124 | #define ASN_COUNTER64 (ASN_APPLICATION | ASN_PRIMITIVE | 0x06)
|
---|
125 | #define ASN_UNSIGNED32 (ASN_APPLICATION | ASN_PRIMITIVE | 0x07)
|
---|
126 |
|
---|
127 | #define SNMP_EXCEPTION_NOSUCHOBJECT (ASN_CONTEXT | ASN_PRIMITIVE | 0x00)
|
---|
128 | #define SNMP_EXCEPTION_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x01)
|
---|
129 | #define SNMP_EXCEPTION_ENDOFMIBVIEW (ASN_CONTEXT | ASN_PRIMITIVE | 0x02)
|
---|
130 |
|
---|
131 | #define SNMP_EXTENSION_GET SNMP_PDU_GET
|
---|
132 | #define SNMP_EXTENSION_GET_NEXT SNMP_PDU_GETNEXT
|
---|
133 | #define SNMP_EXTENSION_GET_BULK SNMP_PDU_GETBULK
|
---|
134 | #define SNMP_EXTENSION_SET_TEST (ASN_PRIVATE | ASN_CONSTRUCTOR | 0x0)
|
---|
135 | #define SNMP_EXTENSION_SET_COMMIT SNMP_PDU_SET
|
---|
136 | #define SNMP_EXTENSION_SET_UNDO (ASN_PRIVATE | ASN_CONSTRUCTOR | 0x1)
|
---|
137 | #define SNMP_EXTENSION_SET_CLEANUP (ASN_PRIVATE | ASN_CONSTRUCTOR | 0x2)
|
---|
138 |
|
---|
139 | #define SNMP_ERRORSTATUS_NOERROR 0
|
---|
140 | #define SNMP_ERRORSTATUS_TOOBIG 1
|
---|
141 | #define SNMP_ERRORSTATUS_NOSUCHNAME 2
|
---|
142 | #define SNMP_ERRORSTATUS_BADVALUE 3
|
---|
143 | #define SNMP_ERRORSTATUS_READONLY 4
|
---|
144 | #define SNMP_ERRORSTATUS_GENERR 5
|
---|
145 | #define SNMP_ERRORSTATUS_NOACCESS 6
|
---|
146 | #define SNMP_ERRORSTATUS_WRONGTYPE 7
|
---|
147 | #define SNMP_ERRORSTATUS_WRONGLENGTH 8
|
---|
148 | #define SNMP_ERRORSTATUS_WRONGENCODING 9
|
---|
149 | #define SNMP_ERRORSTATUS_WRONGVALUE 10
|
---|
150 | #define SNMP_ERRORSTATUS_NOCREATION 11
|
---|
151 | #define SNMP_ERRORSTATUS_INCONSISTENTVALUE 12
|
---|
152 | #define SNMP_ERRORSTATUS_RESOURCEUNAVAILABLE 13
|
---|
153 | #define SNMP_ERRORSTATUS_COMMITFAILED 14
|
---|
154 | #define SNMP_ERRORSTATUS_UNDOFAILED 15
|
---|
155 | #define SNMP_ERRORSTATUS_AUTHORIZATIONERROR 16
|
---|
156 | #define SNMP_ERRORSTATUS_NOTWRITABLE 17
|
---|
157 | #define SNMP_ERRORSTATUS_INCONSISTENTNAME 18
|
---|
158 |
|
---|
159 | #define SNMP_GENERICTRAP_COLDSTART 0
|
---|
160 | #define SNMP_GENERICTRAP_WARMSTART 1
|
---|
161 | #define SNMP_GENERICTRAP_LINKDOWN 2
|
---|
162 | #define SNMP_GENERICTRAP_LINKUP 3
|
---|
163 | #define SNMP_GENERICTRAP_AUTHFAILURE 4
|
---|
164 | #define SNMP_GENERICTRAP_EGPNEIGHLOSS 5
|
---|
165 | #define SNMP_GENERICTRAP_ENTERSPECIFIC 6
|
---|
166 |
|
---|
167 | #define SNMP_ACCESS_NONE 0
|
---|
168 | #define SNMP_ACCESS_NOTIFY 1
|
---|
169 | #define SNMP_ACCESS_READ_ONLY 2
|
---|
170 | #define SNMP_ACCESS_READ_WRITE 3
|
---|
171 | #define SNMP_ACCESS_READ_CREATE 4
|
---|
172 |
|
---|
173 | #define SNMP_LOG_SILENT 0
|
---|
174 | #define SNMP_LOG_FATAL 1
|
---|
175 | #define SNMP_LOG_ERROR 2
|
---|
176 | #define SNMP_LOG_WARNING 3
|
---|
177 | #define SNMP_LOG_TRACE 4
|
---|
178 | #define SNMP_LOG_VERBOSE 5
|
---|
179 |
|
---|
180 | #define SNMP_OUTPUT_TO_CONSOLE 1
|
---|
181 | #define SNMP_OUTPUT_TO_LOGFILE 2
|
---|
182 | #define SNMP_OUTPUT_TO_EVENTLOG 4
|
---|
183 | #define SNMP_OUTPUT_TO_DEBUGGER 8
|
---|
184 |
|
---|
185 | #define DEFINE_SIZEOF(x) (sizeof(x)/sizeof((x)[0]))
|
---|
186 | #define DEFINE_OID(x) { DEFINE_SIZEOF(x),(x) }
|
---|
187 | #define DEFINE_NULLOID() { 0, NULL }
|
---|
188 | #define DEFINE_NULLOCTENTS() { NULL, 0, FALSE }
|
---|
189 |
|
---|
190 | #define DEFAULT_SNMP_PORT_UDP 161
|
---|
191 | #define DEFAULT_SNMP_PORT_IPX 36879
|
---|
192 | #define DEFAULT_SNMPTRAP_PORT_UDP 162
|
---|
193 | #define DEFAULT_SNMPTRAP_PORT_IPX 36880
|
---|
194 |
|
---|
195 | #define SNMP_MAX_OID_LEN 128
|
---|
196 |
|
---|
197 | #define SNMP_MEM_ALLOC_ERROR 0
|
---|
198 | #define SNMP_BERAPI_INVALID_LENGTH 10
|
---|
199 | #define SNMP_BERAPI_INVALID_TAG 11
|
---|
200 | #define SNMP_BERAPI_OVERFLOW 12
|
---|
201 | #define SNMP_BERAPI_SHORT_BUFFER 13
|
---|
202 | #define SNMP_BERAPI_INVALID_OBJELEM 14
|
---|
203 | #define SNMP_PDUAPI_UNRECOGNIZED_PDU 20
|
---|
204 | #define SNMP_PDUAPI_INVALID_ES 21
|
---|
205 | #define SNMP_PDUAPI_INVALID_GT 22
|
---|
206 | #define SNMP_AUTHAPI_INVALID_VERSION 30
|
---|
207 | #define SNMP_AUTHAPI_INVALID_MSG_TYPE 31
|
---|
208 | #define SNMP_AUTHAPI_TRIV_AUTH_FAILED 32
|
---|
209 |
|
---|
210 | #define SNMPAPI_NOERROR TRUE
|
---|
211 | #define SNMPAPI_ERROR FALSE
|
---|
212 |
|
---|
213 | #ifdef __cplusplus
|
---|
214 | extern "C" {
|
---|
215 | #endif
|
---|
216 |
|
---|
217 | BOOL WINAPI SnmpExtensionInit(DWORD dwUptimeReference,
|
---|
218 | HANDLE *phSubagentTrapEvent, AsnObjectIdentifier *pFirstSupportedRegion);
|
---|
219 | BOOL WINAPI SnmpExtensionInitEx(AsnObjectIdentifier *pNextSupportedRegion);
|
---|
220 |
|
---|
221 | BOOL WINAPI SnmpExtensionMonitor(LPVOID pAgentMgmtData);
|
---|
222 |
|
---|
223 | BOOL WINAPI SnmpExtensionQuery(BYTE bPduType, SnmpVarBindList *pVarBindList,
|
---|
224 | AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex);
|
---|
225 | BOOL WINAPI SnmpExtensionQueryEx(UINT nRequestType, UINT nTransactionId,
|
---|
226 | SnmpVarBindList *pVarBindList, AsnOctetString *pContextInfo,
|
---|
227 | AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex);
|
---|
228 |
|
---|
229 | BOOL WINAPI SnmpExtensionTrap(AsnObjectIdentifier *pEnterpriseOid,
|
---|
230 | AsnInteger32 *pGenericTrapId, AsnInteger32 *pSpecificTrapId,
|
---|
231 | AsnTimeticks *pTimeStamp, SnmpVarBindList *pVarBindList);
|
---|
232 |
|
---|
233 | VOID WINAPI SnmpExtensionClose(VOID);
|
---|
234 |
|
---|
235 | typedef BOOL (WINAPI *PFNSNMPEXTENSIONINIT)(DWORD dwUptimeReference,
|
---|
236 | HANDLE *phSubagentTrapEvent, AsnObjectIdentifier *pFirstSupportedRegion);
|
---|
237 | typedef BOOL (WINAPI *PFNSNMPEXTENSIONINITEX)(
|
---|
238 | AsnObjectIdentifier *pNextSupportedRegion);
|
---|
239 |
|
---|
240 | typedef BOOL (WINAPI *PFNSNMPEXTENSIONMONITOR)(LPVOID pAgentMgmtData);
|
---|
241 |
|
---|
242 | typedef BOOL (WINAPI *PFNSNMPEXTENSIONQUERY)(BYTE bPduType,
|
---|
243 | SnmpVarBindList *pVarBindList, AsnInteger32 *pErrorStatus,
|
---|
244 | AsnInteger32 *pErrorIndex);
|
---|
245 | typedef BOOL (WINAPI *PFNSNMPEXTENSIONQUERYEX)(UINT nRequestType,
|
---|
246 | UINT nTransactionId, SnmpVarBindList *pVarBindList,
|
---|
247 | AsnOctetString *pContextInfo, AsnInteger32 *pErrorStatus,
|
---|
248 | AsnInteger32 *pErrorIndex);
|
---|
249 |
|
---|
250 | typedef BOOL (WINAPI *PFNSNMPEXTENSIONTRAP)(AsnObjectIdentifier *pEnterpriseOid,
|
---|
251 | AsnInteger32 *pGenericTrapId, AsnInteger32 *pSpecificTrapId,
|
---|
252 | AsnTimeticks *pTimeStamp, SnmpVarBindList *pVarBindList);
|
---|
253 |
|
---|
254 | typedef VOID (WINAPI *PFNSNMPEXTENSIONCLOSE)(VOID);
|
---|
255 |
|
---|
256 | INT WINAPI SnmpUtilOidCpy(AsnObjectIdentifier *pOidDst,
|
---|
257 | AsnObjectIdentifier *pOidSrc);
|
---|
258 | INT WINAPI SnmpUtilOidAppend(AsnObjectIdentifier *pOidDst,
|
---|
259 | AsnObjectIdentifier *pOidSrc);
|
---|
260 | INT WINAPI SnmpUtilOidCmp(AsnObjectIdentifier *pOid1,
|
---|
261 | AsnObjectIdentifier *pOid2);
|
---|
262 | INT WINAPI SnmpUtilOidNCmp(AsnObjectIdentifier *pOid1,
|
---|
263 | AsnObjectIdentifier *pOid2, UINT nSubIds);
|
---|
264 | VOID WINAPI SnmpUtilOidFree(AsnObjectIdentifier *pOid);
|
---|
265 |
|
---|
266 | INT WINAPI SnmpUtilOctetsCmp(AsnOctetString *pOctets1,
|
---|
267 | AsnOctetString *pOctets2);
|
---|
268 | INT WINAPI SnmpUtilOctetsNCmp(AsnOctetString *pOctets1,
|
---|
269 | AsnOctetString *pOctets2, UINT nChars);
|
---|
270 | INT WINAPI SnmpUtilOctetsCpy(AsnOctetString *pOctetsDst,
|
---|
271 | AsnOctetString *pOctetsSrc);
|
---|
272 | VOID WINAPI SnmpUtilOctetsFree(AsnOctetString *pOctets);
|
---|
273 |
|
---|
274 | INT WINAPI SnmpUtilAsnAnyCpy(AsnAny *pAnyDst, AsnAny *pAnySrc);
|
---|
275 | VOID WINAPI SnmpUtilAsnAnyFree(AsnAny *pAny);
|
---|
276 |
|
---|
277 | INT WINAPI SnmpUtilVarBindCpy(SnmpVarBind *pVbDst, SnmpVarBind *pVbSrc);
|
---|
278 | VOID WINAPI SnmpUtilVarBindFree(SnmpVarBind *pVb);
|
---|
279 |
|
---|
280 | INT WINAPI SnmpUtilVarBindListCpy(SnmpVarBindList *pVblDst,
|
---|
281 | SnmpVarBindList *pVblSrc);
|
---|
282 | VOID WINAPI SnmpUtilVarBindListFree(SnmpVarBindList *pVbl);
|
---|
283 |
|
---|
284 | LPVOID WINAPI SnmpUtilMemAlloc(UINT nBytes) __WINE_ALLOC_SIZE(1);
|
---|
285 | LPVOID WINAPI SnmpUtilMemReAlloc(LPVOID pMem, UINT nBytes) __WINE_ALLOC_SIZE(2);
|
---|
286 | VOID WINAPI SnmpUtilMemFree(LPVOID pMem);
|
---|
287 |
|
---|
288 | LPSTR WINAPI SnmpUtilOidToA(AsnObjectIdentifier *Oid);
|
---|
289 | LPSTR WINAPI SnmpUtilIdsToA(UINT *Ids, UINT IdLength);
|
---|
290 |
|
---|
291 | VOID WINAPI SnmpUtilPrintOid(AsnObjectIdentifier *Oid);
|
---|
292 | VOID WINAPI SnmpUtilPrintAsnAny(AsnAny *pAny);
|
---|
293 |
|
---|
294 | DWORD WINAPI SnmpSvcGetUptime(VOID);
|
---|
295 | VOID WINAPI SnmpSvcSetLogLevel(INT nLogLevel);
|
---|
296 | VOID WINAPI SnmpSvcSetLogType(INT nLogType);
|
---|
297 |
|
---|
298 | VOID WINAPIV SnmpUtilDbgPrint(INT nLogLevel, LPSTR szFormat, ...);
|
---|
299 |
|
---|
300 | #ifdef __cplusplus
|
---|
301 | }
|
---|
302 | #endif
|
---|
303 |
|
---|
304 | #endif /* _WINE_SNMP_H */
|
---|