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