d24ceb2f0873353919dc6e1fb04578a23041ab3f
[reactos.git] / reactos / lib / snmpapi / snmpapi.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Windows Sockets 2 Simple Network Management Protocol API DLL
4 * FILE: include/snmpapi.h
5 * PURPOSE: Simple Network Management Protocol API DLL
6 */
7 #ifndef __SNMPAPI_H
8 #define __SNMPAPI_H
9
10 #ifdef __GNUC__
11 #include <wsahelp.h>
12 #else
13 #include <winsock2.h>
14 #endif
15 #include <windows.h>
16 #include <debug.h>
17
18
19 #ifdef __GNUC__
20 #define EXPORT STDCALL
21 #define SNMP_FUNC_TYPE STDCALL
22 #else
23 #define EXPORT CALLBACK
24 #define SNMP_FUNC_TYPE CALLBACK
25 #endif
26
27 #ifndef SNMP_FUNC_TYPE
28 #define SNMP_FUNC_TYPE WINAPI
29 #endif
30
31 #define SNMPAPI INT
32 #define SNMPAPI_NOERROR TRUE
33 #define SNMPAPI_ERROR FALSE
34
35 #define OBJ_NAME_PATH_SEPARATOR ((WCHAR)L'\\')
36
37 ////////////////////////////////////////////////////////////////////////////////
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; // ASN_INTEGER
68 // ASN_INTEGER32
69 AsnUnsigned32 unsigned32; // ASN_UNSIGNED32
70 AsnCounter64 counter64; // ASN_COUNTER64
71 AsnOctetString string; // ASN_OCTETSTRING
72 AsnBits bits; // ASN_BITS
73 AsnObjectIdentifier object; // ASN_OBJECTIDENTIFIER
74 AsnSequence sequence; // ASN_SEQUENCE
75 AsnIPAddress address; // ASN_IPADDRESS
76 AsnCounter32 counter; // ASN_COUNTER32
77 AsnGauge32 gauge; // ASN_GAUGE32
78 AsnTimeticks ticks; // ASN_TIMETICKS
79 AsnOpaque arbitrary; // ASN_OPAQUE
80 } asnValue;
81 } AsnAny;
82
83 typedef AsnObjectIdentifier AsnObjectName;
84 typedef AsnAny AsnObjectSyntax;
85
86 typedef struct {
87 AsnObjectName name;
88 AsnObjectSyntax value;
89 } SnmpVarBind;
90
91 typedef struct {
92 SnmpVarBind * list;
93 UINT len;
94 } SnmpVarBindList;
95
96
97 LPVOID SNMP_FUNC_TYPE SnmpUtilMemAlloc(
98 UINT nBytes // bytes to allocate for object
99 );
100
101 VOID SNMP_FUNC_TYPE SnmpUtilMemFree(
102 LPVOID pMem // pointer to memory object to release
103 );
104
105 LPVOID SNMP_FUNC_TYPE SnmpUtilMemReAlloc(
106 LPVOID pMem, // pointer to memory object
107 UINT nBytes // bytes to allocate
108 );
109
110 VOID SNMP_FUNC_TYPE SnmpSvcInitUptime();
111
112 DWORD SNMP_FUNC_TYPE SnmpSvcGetUptime();
113
114 VOID SNMP_FUNC_TYPE SnmpSvcSetLogLevel(
115 INT nLogLevel // level of severity of the event
116 );
117
118 VOID SNMP_FUNC_TYPE SnmpSvcSetLogType(
119 INT nLogType // destination for debug output
120 );
121
122 SNMPAPI SNMP_FUNC_TYPE SnmpUtilAsnAnyCpy(
123 AsnAny *pAnyDst, // destination structure
124 AsnAny *pAnySrc // source structure
125 );
126
127 VOID SNMP_FUNC_TYPE SnmpUtilAsnAnyFree(
128 AsnAny *pAny // pointer to structure to free
129 );
130
131 //VOID SNMP_FUNC_TYPE SnmpUtilDbgPrint(
132 // INT nLogLevel, // level of severity of event
133 // LPSTR szFormat // pointer to a format string
134 //);
135
136 LPSTR SNMP_FUNC_TYPE SnmpUtilIdsToA(
137 UINT *Ids, // object identifier to convert
138 UINT IdLength // number of elements
139 );
140
141 SNMPAPI SNMP_FUNC_TYPE SnmpUtilOctetsCmp(
142 AsnOctetString *pOctets1, // first octet string
143 AsnOctetString *pOctets2 // second octet string
144 );
145
146 SNMPAPI SNMP_FUNC_TYPE SnmpUtilOctetsCpy(
147 AsnOctetString *pOctetsDst, // destination octet string
148 AsnOctetString *pOctetsSrc // source octet string
149 );
150
151 VOID SNMP_FUNC_TYPE SnmpUtilOctetsFree(
152 AsnOctetString *pOctets // octet string to free
153 );
154
155 SNMPAPI SNMP_FUNC_TYPE SnmpUtilOctetsNCmp(
156 AsnOctetString *pOctets1, // first octet string
157 AsnOctetString *pOctets2, // second octet string
158 UINT nChars // maximum length to compare
159 );
160
161 SNMPAPI SNMP_FUNC_TYPE SnmpUtilOidAppend(
162 AsnObjectIdentifier *pOidDst, // destination object identifier
163 AsnObjectIdentifier *pOidSrc // source object identifier
164 );
165
166 SNMPAPI SNMP_FUNC_TYPE SnmpUtilOidCmp(
167 AsnObjectIdentifier *pOid1, // first object identifier
168 AsnObjectIdentifier *pOid2 // second object identifier
169 );
170
171 SNMPAPI SNMP_FUNC_TYPE SnmpUtilOidCpy(
172 AsnObjectIdentifier *pOidDst, // destination object identifier
173 AsnObjectIdentifier *pOidSrc // source object identifier
174 );
175
176 VOID SNMP_FUNC_TYPE SnmpUtilOidFree(
177 AsnObjectIdentifier *pOid // object identifier to free
178 );
179
180 SNMPAPI SNMP_FUNC_TYPE SnmpUtilOidNCmp(
181 AsnObjectIdentifier *pOid1, // first object identifier
182 AsnObjectIdentifier *pOid2, // second object identifier
183 UINT nSubIds // maximum length to compare
184 );
185
186 LPSTR SNMP_FUNC_TYPE SnmpUtilOidToA(
187 AsnObjectIdentifier *Oid // object identifier to convert
188 );
189
190 VOID SNMP_FUNC_TYPE SnmpUtilPrintAsnAny(
191 AsnAny *pAny // pointer to value to print
192 );
193
194 VOID SNMP_FUNC_TYPE SnmpUtilPrintOid(
195 AsnObjectIdentifier *Oid // object identifier to print
196 );
197
198 SNMPAPI SNMP_FUNC_TYPE SnmpUtilVarBindCpy(
199 SnmpVarBind *pVbDst, // destination variable bindings
200 SnmpVarBind *pVbSrc // source variable bindings
201 );
202
203 VOID SNMP_FUNC_TYPE SnmpUtilVarBindFree(
204 SnmpVarBind *pVb // variable binding to free
205 );
206
207 SNMPAPI SNMP_FUNC_TYPE SnmpUtilVarBindListCpy(
208 SnmpVarBindList *pVblDst, // destination variable bindings list
209 SnmpVarBindList *pVblSrc // source variable bindings list
210 );
211
212 VOID SNMP_FUNC_TYPE SnmpUtilVarBindListFree(
213 SnmpVarBindList *pVbl // variable bindings list to free
214 );
215
216
217
218 ////////////////////////////////////////////////////////////////////////////////
219 // SNMP Debugging Definitions
220 //
221
222 #define SNMP_LOG_SILENT 0x0
223 #define SNMP_LOG_FATAL 0x1
224 #define SNMP_LOG_ERROR 0x2
225 #define SNMP_LOG_WARNING 0x3
226 #define SNMP_LOG_TRACE 0x4
227 #define SNMP_LOG_VERBOSE 0x5
228
229 #define SNMP_OUTPUT_TO_CONSOLE 0x1
230 #define SNMP_OUTPUT_TO_LOGFILE 0x2
231 //#define SNMP_OUTPUT_TO_EVENTLOG 0x4 // no longer supported
232 #define SNMP_OUTPUT_TO_DEBUGGER 0x8
233
234 ////////////////////////////////////////////////////////////////////////////////
235 // SNMP Debugging Prototypes
236 //
237
238 VOID
239 SNMP_FUNC_TYPE
240 SnmpUtilDbgPrint(
241 IN INT nLogLevel, // see log levels above...
242 IN LPSTR szFormat,
243 IN ...
244 );
245
246 #if DBG
247 #define SNMPDBG(_x_) SnmpUtilDbgPrint _x_
248 #else
249 #define SNMPDBG(_x_)
250 #endif
251
252
253 ////////////////////////////////////////////////////////////////////////////////
254
255 #endif /* __SNMPAPI_H */
256
257 /* EOF */