1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright (c) 1998 by Sun Microsystems, Inc.
24 * All rights reserved.
25 */
26
27 #pragma ident "%Z%%M% %I% %E% SMI"
28
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <unistd.h>
32 #include <string.h>
33 #include <sys/types.h>
34 #include <sys/socket.h>
35 #include <netinet/in.h>
36 #include "snmp_msg.h"
37 #include "madman_api.h"
38
39 /***** GLOBAL VARIABLES *****/
40
41 /* SMTP */
42
43 static Subid smtp_subids[] = { 1, 3, 6, 1, 2, 1, 27, 4, 25 };
44 Oid smtp_name = { smtp_subids, 9 };
45 char smtp_string[] = "1.3.6.1.2.1.27.4.25";
46
47 /* P1 */
48
49 static Subid id_ac_mts_transfer_subids[] = { 2, 6, 0, 1, 6 };
50 Oid id_ac_mts_transfer_name = { id_ac_mts_transfer_subids, 5 };
51 char id_ac_mts_transfer_string[] = "2.6.0.1.6";
52
53
54 /* P3 */
55
56 static Subid id_ac_mts_access_subids[] = { 2, 6, 0, 1, 0 };
57 Oid id_ac_mts_access_name = { id_ac_mts_access_subids, 5 };
58
59 static Subid id_ac_mts_forced_access_subids[] = { 2, 6, 0, 1, 1 };
60 Oid id_ac_mts_forced_access_name = { id_ac_mts_forced_access_subids, 5 };
61
62 static Subid id_ac_mts_reliable_access_subids[] = { 2, 6, 0, 1, 2 };
63 Oid id_ac_mts_reliable_access_name = { id_ac_mts_reliable_access_subids, 5 };
64
65 static Subid id_ac_mts_forced_reliable_access_subids[] = { 2, 6, 0, 1, 3 };
66 Oid id_ac_mts_forced_reliable_access_name = { id_ac_mts_forced_reliable_access_subids, 5 };
67
68
69 /* P7 */
70
71 static Subid id_ac_ms_access_subids[] = { 2, 6, 0, 1, 4 };
72 Oid id_ac_ms_access_name = { id_ac_ms_access_subids, 5 };
73
74 static Subid id_ac_ms_reliable_access_subids[] = { 2, 6, 0, 1, 5 };
75 Oid id_ac_ms_reliable_access_name = { id_ac_ms_reliable_access_subids, 5 };
76
77
78 /***** LOCAL CONSTANTS *****/
79
80 #define MAX_LABEL_LEN 50
81 #define MAX_COLUMNS 30
82
83 #define TO_INTEGER 1
84 #define TO_STRING 2
85 #define TO_ASCII 3
86 #define TO_OID 4
87
88
89 /***** LOCAL TYPES *****/
90
91 typedef struct _SNMP_object {
92 char label[MAX_LABEL_LEN + 1];
93 Oid *name;
94 u_char type;
95 int translator;
96 } SNMP_object;
97
98 typedef struct _SNMP_column {
99 char label[MAX_LABEL_LEN + 1];
100 Oid *name;
101 u_char type;
102 int translator;
103 } SNMP_column;
104
105 typedef struct _SNMP_table {
106 int column_num;
107 SNMP_column *columns[MAX_COLUMNS];
108 } SNMP_table;
109
110
111 /***** LOCAL VARIABLES *****/
112
113
114 /**********/
115 /* MIB II */
116 /**********/
117
118 static Subid sysUpTime_subids[] = { 1, 3, 6, 1, 2, 1, 1, 3, 0 };
119 static Oid sysUpTime_name = { sysUpTime_subids, 9 };
120
121 static SNMP_object sysUpTime_object
122 = { "syUpTime", &sysUpTime_name, TIMETICKS, TO_INTEGER };
123
124
125 /************/
126 /* RFC 1565 */
127 /************/
128
129 static Subid applName_subids[] = { 1, 3, 6, 1, 2, 1, 27, 1, 1, 2 };
130 static Oid applName_name = { applName_subids, 10 };
131
132 static Subid applDirectoryName_subids[] = { 1, 3, 6, 1, 2, 1, 27, 1, 1, 3 };
133 static Oid applDirectoryName_name = { applDirectoryName_subids, 10 };
134
135 static Subid applVersion_subids[] = { 1, 3, 6, 1, 2, 1, 27, 1, 1, 4 };
136 static Oid applVersion_name = { applVersion_subids, 10 };
137
138 static Subid applUptime_subids[] = { 1, 3, 6, 1, 2, 1, 27, 1, 1, 5 };
139 static Oid applUptime_name = { applUptime_subids, 10 };
140
141 static Subid applOperStatus_subids[] = { 1, 3, 6, 1, 2, 1, 27, 1, 1, 6 };
142 static Oid applOperStatus_name = { applOperStatus_subids, 10 };
143
144 static Subid applLastChange_subids[] = { 1, 3, 6, 1, 2, 1, 27, 1, 1, 7 };
145 static Oid applLastChange_name = { applLastChange_subids, 10 };
146
147 static Subid applInboundAssociations_subids[] = { 1, 3, 6, 1, 2, 1, 27, 1, 1, 8 };
148 static Oid applInboundAssociations_name = { applInboundAssociations_subids, 10 };
149
150 static Subid applOutboundAssociations_subids[] = { 1, 3, 6, 1, 2, 1, 27, 1, 1, 9 };
151 static Oid applOutboundAssociations_name = { applOutboundAssociations_subids, 10 };
152
153 static Subid applAccumulatedInboundAssociations_subids[] = { 1, 3, 6, 1, 2, 1, 27, 1, 1, 10 };
154 static Oid applAccumulatedInboundAssociations_name = { applAccumulatedInboundAssociations_subids, 10 };
155
156 static Subid applAccumulatedOutboundAssociations_subids[] = { 1, 3, 6, 1, 2, 1, 27, 1, 1, 11 };
157 static Oid applAccumulatedOutboundAssociations_name = { applAccumulatedOutboundAssociations_subids, 10 };
158
159 static Subid applLastInboundActivity_subids[] = { 1, 3, 6, 1, 2, 1, 27, 1, 1, 12 };
160 static Oid applLastInboundActivity_name = { applLastInboundActivity_subids, 10 };
161
162 static Subid applLastOutboundActivity_subids[] = { 1, 3, 6, 1, 2, 1, 27, 1, 1, 13 };
163 static Oid applLastOutboundActivity_name = { applLastOutboundActivity_subids, 10 };
164
165 static Subid applRejectedInboundAssociations_subids[] = { 1, 3, 6, 1, 2, 1, 27, 1, 1, 14 };
166 static Oid applRejectedInboundAssociations_name = { applRejectedInboundAssociations_subids, 10 };
167
168 static Subid applFailedOutboundAssociations_subids[] = { 1, 3, 6, 1, 2, 1, 27, 1, 1, 15 };
169 static Oid applFailedOutboundAssociations_name = { applFailedOutboundAssociations_subids, 10 };
170
171
172 static SNMP_column applName_column
173 = { "applName", &applName_name, STRING, TO_ASCII };
174 static SNMP_column applDirectoryName_column
175 = { "applDirecoryName", &applDirectoryName_name, STRING, TO_ASCII };
176 static SNMP_column applVersion_column
177 = { "applVersion", &applVersion_name, STRING, TO_ASCII };
178 static SNMP_column applUptime_column
179 = { "applUptime", &applUptime_name, TIMETICKS, TO_INTEGER };
180 static SNMP_column applOperStatus_column
181 = { "applOperStatus", &applOperStatus_name, INTEGER, TO_INTEGER };
182 static SNMP_column applLastChange_column
183 = { "applLastChange", &applLastChange_name, TIMETICKS, TO_INTEGER };
184 static SNMP_column applInboundAssociations_column
185 = { "applInboundAssociations", &applInboundAssociations_name, GAUGE, TO_INTEGER };
186 static SNMP_column applOutboundAssociations_column
187 = { "applOutboundAssociations", &applOutboundAssociations_name, GAUGE, TO_INTEGER };
188 static SNMP_column applAccumulatedInboundAssociations_column
189 = { "applAccumulatedInboundAssociations", &applAccumulatedInboundAssociations_name, COUNTER, TO_INTEGER };
190 static SNMP_column applAccumulatedOutboundAssociations_column
191 = { "applAccumulatedOutboundAssociations", &applAccumulatedOutboundAssociations_name, COUNTER, TO_INTEGER };
192 static SNMP_column applLastInboundActivity_column
193 = { "applLastInboundActivity", &applLastInboundActivity_name, TIMETICKS, TO_INTEGER };
194 static SNMP_column applLastOutboundActivity_column
195 = { "applLastOutboundActivity", &applLastOutboundActivity_name, TIMETICKS, TO_INTEGER };
196 static SNMP_column applRejectedInboundAssociations_column
197 = { "applRejectedInboundAssociations", &applRejectedInboundAssociations_name, COUNTER, TO_INTEGER };
198 static SNMP_column applFailedOutboundAssociations_column
199 = { "applFailedOutboundAssociations", &applFailedOutboundAssociations_name, COUNTER, TO_INTEGER };
200
201 static SNMP_table applTable = {
202 14,
203 {
204 &applName_column,
205 &applDirectoryName_column,
206 &applVersion_column,
207 &applUptime_column,
208 &applOperStatus_column,
209 &applLastChange_column,
210 &applInboundAssociations_column,
211 &applOutboundAssociations_column,
212 &applAccumulatedInboundAssociations_column,
213 &applAccumulatedOutboundAssociations_column,
214 &applLastInboundActivity_column,
215 &applLastOutboundActivity_column,
216 &applRejectedInboundAssociations_column,
217 &applFailedOutboundAssociations_column
218 }
219 };
220
221
222 static Subid assocRemoteApplication_subids[] = { 1, 3, 6, 1, 2, 1, 27, 2, 1, 2 };
223 static Oid assocRemoteApplication_name = { assocRemoteApplication_subids, 10 };
224
225 static Subid assocApplicationProtocol_subids[] = { 1, 3, 6, 1, 2, 1, 27, 2, 1, 3 };
226 static Oid assocApplicationProtocol_name = { assocApplicationProtocol_subids, 10 };
227
228 static Subid assocApplicationType_subids[] = { 1, 3, 6, 1, 2, 1, 27, 2, 1, 4 };
229 static Oid assocApplicationType_name = { assocApplicationType_subids, 10 };
230
231 static Subid assocDuration_subids[] = { 1, 3, 6, 1, 2, 1, 27, 2, 1, 5 };
232 static Oid assocDuration_name = { assocDuration_subids, 10 };
233
234 static SNMP_column assocRemoteApplication_column
235 = { "assocRemoteApplication", &assocRemoteApplication_name, STRING, TO_ASCII };
236 static SNMP_column assocApplicationProtocol_column
237 = { "assocApplicationProtocol", &assocApplicationProtocol_name, OBJID, TO_OID };
238 static SNMP_column assocApplicationType_column
239 = { "assocApplicationType", &assocApplicationType_name, INTEGER, TO_INTEGER };
240 static SNMP_column assocDuration_column
241 = { "assocDuration", &assocDuration_name, TIMETICKS, TO_INTEGER };
242
243 static SNMP_table assocTable = {
244 4,
245 {
246 &assocRemoteApplication_column,
247 &assocApplicationProtocol_column,
248 &assocApplicationType_column,
249 &assocDuration_column,
250 }
251 };
252
253
254 /************/
255 /* RFC 1566 */
256 /************/
257
258 static Subid mtaReceivedMessages_subids[] = { 1, 3, 6, 1, 2, 1, 28, 1, 1, 1 };
259 static Oid mtaReceivedMessages_name = { mtaReceivedMessages_subids, 10 };
260
261 static Subid mtaStoredMessages_subids[] = { 1, 3, 6, 1, 2, 1, 28, 1, 1, 2 };
262 static Oid mtaStoredMessages_name = { mtaStoredMessages_subids, 10 };
263
264 static Subid mtaTransmittedMessages_subids[] = { 1, 3, 6, 1, 2, 1, 28, 1, 1, 3 };
265 static Oid mtaTransmittedMessages_name = { mtaTransmittedMessages_subids, 10 };
266
267 static Subid mtaReceivedVolume_subids[] = { 1, 3, 6, 1, 2, 1, 28, 1, 1, 4 };
268 static Oid mtaReceivedVolume_name = { mtaReceivedVolume_subids, 10 };
269
270 static Subid mtaStoredVolume_subids[] = { 1, 3, 6, 1, 2, 1, 28, 1, 1, 5 };
271 static Oid mtaStoredVolume_name = { mtaStoredVolume_subids, 10 };
272
273 static Subid mtaTransmittedVolume_subids[] = { 1, 3, 6, 1, 2, 1, 28, 1, 1, 6 };
274 static Oid mtaTransmittedVolume_name = { mtaTransmittedVolume_subids, 10 };
275
276 static Subid mtaReceivedRecipients_subids[] = { 1, 3, 6, 1, 2, 1, 28, 1, 1, 7 };
277 static Oid mtaReceivedRecipients_name = { mtaReceivedRecipients_subids, 10 };
278
279 static Subid mtaStoredRecipients_subids[] = { 1, 3, 6, 1, 2, 1, 28, 1, 1, 8 };
280 static Oid mtaStoredRecipients_name = { mtaStoredRecipients_subids, 10 };
281
282 static Subid mtaTransmittedRecipients_subids[] = { 1, 3, 6, 1, 2, 1, 28, 1, 1, 9 };
283 static Oid mtaTransmittedRecipients_name = { mtaTransmittedRecipients_subids, 10 };
284
285 static SNMP_column mtaReceivedMessages_column
286 = { "mtaReceivedMessages", &mtaReceivedMessages_name, COUNTER, TO_INTEGER };
287 static SNMP_column mtaStoredMessages_column
288 = { "mtaStoredMessages", &mtaStoredMessages_name, GAUGE, TO_INTEGER };
289 static SNMP_column mtaTransmittedMessages_column
290 = { "mtaTransmittedMessages", &mtaTransmittedMessages_name, COUNTER, TO_INTEGER };
291 static SNMP_column mtaReceivedVolume_column
292 = { "mtaReceivedVolume", &mtaReceivedVolume_name, COUNTER, TO_INTEGER };
293 static SNMP_column mtaStoredVolume_column
294 = { "mtaStoredVolume", &mtaStoredVolume_name, GAUGE, TO_INTEGER };
295 static SNMP_column mtaTransmittedVolume_column
296 = { "mtaTransmittedVolume", &mtaTransmittedVolume_name, COUNTER, TO_INTEGER };
297 static SNMP_column mtaReceivedRecipients_column
298 = { "mtaReceivedRecipients", &mtaReceivedRecipients_name, COUNTER, TO_INTEGER };
299 static SNMP_column mtaStoredRecipients_column
300 = { "mtaStoredRecipients", &mtaStoredRecipients_name, GAUGE, TO_INTEGER };
301 static SNMP_column mtaTransmittedRecipients_column
302 = { "mtaTransmittedRecipients", &mtaTransmittedRecipients_name, COUNTER, TO_INTEGER };
303
304 static SNMP_table mtaTable = {
305 9,
306 {
307 &mtaReceivedMessages_column,
308 &mtaStoredMessages_column,
309 &mtaTransmittedMessages_column,
310 &mtaReceivedVolume_column,
311 &mtaStoredVolume_column,
312 &mtaTransmittedVolume_column,
313 &mtaReceivedRecipients_column,
314 &mtaStoredRecipients_column,
315 &mtaTransmittedRecipients_column
316 }
317 };
318
319
320 static Subid mtaGroupReceivedMessages_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 2 };
321 static Oid mtaGroupReceivedMessages_name = { mtaGroupReceivedMessages_subids, 10 };
322
323 static Subid mtaGroupRejectedMessages_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 3 };
324 static Oid mtaGroupRejectedMessages_name = { mtaGroupRejectedMessages_subids, 10 };
325
326 static Subid mtaGroupStoredMessages_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 4 };
327 static Oid mtaGroupStoredMessages_name = { mtaGroupStoredMessages_subids, 10 };
328
329 static Subid mtaGroupTransmittedMessages_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 5 };
330 static Oid mtaGroupTransmittedMessages_name = { mtaGroupTransmittedMessages_subids, 10 };
331
332 static Subid mtaGroupReceivedVolume_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 6 };
333 static Oid mtaGroupReceivedVolume_name = { mtaGroupReceivedVolume_subids, 10 };
334
335 static Subid mtaGroupStoredVolume_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 7 };
336 static Oid mtaGroupStoredVolume_name = { mtaGroupStoredVolume_subids, 10 };
337
338 static Subid mtaGroupTransmittedVolume_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 8 };
339 static Oid mtaGroupTransmittedVolume_name = { mtaGroupTransmittedVolume_subids, 10 };
340
341 static Subid mtaGroupReceivedRecipients_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 9 };
342 static Oid mtaGroupReceivedRecipients_name = { mtaGroupReceivedRecipients_subids, 10 };
343
344 static Subid mtaGroupStoredRecipients_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 10 };
345 static Oid mtaGroupStoredRecipients_name = { mtaGroupStoredRecipients_subids, 10 };
346
347 static Subid mtaGroupTransmittedRecipients_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 11 };
348 static Oid mtaGroupTransmittedRecipients_name = { mtaGroupTransmittedRecipients_subids, 10 };
349
350 static Subid mtaGroupOldestMessageStored_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 12 };
351 static Oid mtaGroupOldestMessageStored_name = { mtaGroupOldestMessageStored_subids, 10 };
352
353 static Subid mtaGroupInboundAssociations_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 13 };
354 static Oid mtaGroupInboundAssociations_name = { mtaGroupInboundAssociations_subids, 10 };
355
356 static Subid mtaGroupOutboundAssociations_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 14 };
357 static Oid mtaGroupOutboundAssociations_name = { mtaGroupOutboundAssociations_subids, 10 };
358
359 static Subid mtaGroupAccumulatedInboundAssociations_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 15 };
360 static Oid mtaGroupAccumulatedInboundAssociations_name = { mtaGroupAccumulatedInboundAssociations_subids, 10 };
361
362 static Subid mtaGroupAccumulatedOutboundAssociations_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 16 };
363 static Oid mtaGroupAccumulatedOutboundAssociations_name = { mtaGroupAccumulatedOutboundAssociations_subids, 10 };
364
365 static Subid mtaGroupLastInboundActivity_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 17 };
366 static Oid mtaGroupLastInboundActivity_name = { mtaGroupLastInboundActivity_subids, 10 };
367
368 static Subid mtaGroupLastOutboundActivity_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 18 };
369 static Oid mtaGroupLastOutboundActivity_name = { mtaGroupLastOutboundActivity_subids, 10 };
370
371 static Subid mtaGroupRejectedInboundAssociations_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 19 };
372 static Oid mtaGroupRejectedInboundAssociations_name = { mtaGroupRejectedInboundAssociations_subids, 10 };
373
374 static Subid mtaGroupFailedOutboundAssociations_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 20 };
375 static Oid mtaGroupFailedOutboundAssociations_name = { mtaGroupFailedOutboundAssociations_subids, 10 };
376
377 static Subid mtaGroupInboundRejectionReason_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 21 };
378 static Oid mtaGroupInboundRejectionReason_name = { mtaGroupInboundRejectionReason_subids, 10 };
379
380 static Subid mtaGroupOutboundConnectFailureReason_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 22 };
381 static Oid mtaGroupOutboundConnectFailureReason_name = { mtaGroupOutboundConnectFailureReason_subids, 10 };
382
383 static Subid mtaGroupScheduledRetry_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 23 };
384 static Oid mtaGroupScheduledRetry_name = { mtaGroupScheduledRetry_subids, 10 };
385
386 static Subid mtaGroupMailProtocol_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 24 };
387 static Oid mtaGroupMailProtocol_name = { mtaGroupMailProtocol_subids, 10 };
388
389 static Subid mtaGroupName_subids[] = { 1, 3, 6, 1, 2, 1, 28, 2, 1, 25 };
390 static Oid mtaGroupName_name = { mtaGroupName_subids, 10 };
391
392 static SNMP_column mtaGroupReceivedMessages_column
393 = { "mtaGroupReceivedMessages", &mtaGroupReceivedMessages_name, COUNTER, TO_INTEGER };
394 static SNMP_column mtaGroupRejectedMessages_column
395 = { "mtaGroupRejectedMessages", &mtaGroupRejectedMessages_name, COUNTER, TO_INTEGER };
396 static SNMP_column mtaGroupStoredMessages_column
397 = { "mtaGroupStoredMessages", &mtaGroupStoredMessages_name, GAUGE, TO_INTEGER };
398 static SNMP_column mtaGroupTransmittedMessages_column
399 = { "mtaGroupTransmittedMessages", &mtaGroupTransmittedMessages_name, COUNTER, TO_INTEGER };
400 static SNMP_column mtaGroupReceivedVolume_column
401 = { "mtaGroupReceivedVolume", &mtaGroupReceivedVolume_name, COUNTER, TO_INTEGER };
402 static SNMP_column mtaGroupStoredVolume_column
403 = { "mtaGroupStoredVolume", &mtaGroupStoredVolume_name, GAUGE, TO_INTEGER };
404 static SNMP_column mtaGroupTransmittedVolume_column
405 = { "mtaGroupTransmittedVolume", &mtaGroupTransmittedVolume_name, COUNTER, TO_INTEGER };
406 static SNMP_column mtaGroupReceivedRecipients_column
407 = { "mtaGroupReceivedRecipients", &mtaGroupReceivedRecipients_name, COUNTER, TO_INTEGER };
408 static SNMP_column mtaGroupStoredRecipients_column
409 = { "mtaGroupStoredRecipients", &mtaGroupStoredRecipients_name, GAUGE, TO_INTEGER };
410 static SNMP_column mtaGroupTransmittedRecipients_column
411 = { "mtaGroupTransmittedRecipients", &mtaGroupTransmittedRecipients_name, COUNTER, TO_INTEGER };
412 static SNMP_column mtaGroupOldestMessageStored_column
413 = { "mtaGroupOldestMessageStored", &mtaGroupOldestMessageStored_name, INTEGER, TO_INTEGER };
414 static SNMP_column mtaGroupInboundAssociations_column
415 = { "mtaGroupInboundAssociations", &mtaGroupInboundAssociations_name, GAUGE, TO_INTEGER };
416 static SNMP_column mtaGroupOutboundAssociations_column
417 = { "mtaGroupOutboundAssociations", &mtaGroupOutboundAssociations_name, GAUGE, TO_INTEGER };
418 static SNMP_column mtaGroupAccumulatedInboundAssociations_column
419 = { "mtaGroupAccumulatedInboundAssociations", &mtaGroupAccumulatedInboundAssociations_name, COUNTER, TO_INTEGER };
420 static SNMP_column mtaGroupAccumulatedOutboundAssociations_column
421 = { "mtaGroupAccumulatedOutboundAssociations", &mtaGroupAccumulatedOutboundAssociations_name, COUNTER, TO_INTEGER };
422 static SNMP_column mtaGroupLastInboundActivity_column
423 = { "mtaGroupLastInboundActivity", &mtaGroupLastInboundActivity_name, INTEGER, TO_INTEGER };
424 static SNMP_column mtaGroupLastOutboundActivity_column
425 = { "mtaGroupLastOutboundActivity", &mtaGroupLastOutboundActivity_name, INTEGER, TO_INTEGER };
426 static SNMP_column mtaGroupRejectedInboundAssociations_column
427 = { "mtaGroupRejectedInboundAssociations", &mtaGroupRejectedInboundAssociations_name, COUNTER, TO_INTEGER };
428 static SNMP_column mtaGroupFailedOutboundAssociations_column
429 = { "mtaGroupFailedOutboundAssociations", &mtaGroupFailedOutboundAssociations_name, COUNTER, TO_INTEGER };
430 static SNMP_column mtaGroupInboundRejectionReason_column
431 = { "mtaGroupInboundRejectionReason", &mtaGroupInboundRejectionReason_name, STRING, TO_ASCII };
432 static SNMP_column mtaGroupOutboundConnectFailureReason_column
433 = { "mtaGroupOutboundConnectFailureReason", &mtaGroupOutboundConnectFailureReason_name, STRING, TO_ASCII };
434 static SNMP_column mtaGroupScheduledRetry_column
435 = { "mtaGroupScheduledRetry", &mtaGroupScheduledRetry_name, INTEGER, TO_INTEGER };
436 static SNMP_column mtaGroupMailProtocol_column
437 = { "mtaGroupMailProtocol", &mtaGroupMailProtocol_name, OBJID, TO_OID };
438 static SNMP_column mtaGroupName_column
439 = { "mtaGroupName", &mtaGroupName_name, STRING, TO_ASCII };
440
441
442 static SNMP_table mtaGroupTable = {
443 24,
444 {
445 &mtaGroupReceivedMessages_column,
446 &mtaGroupRejectedMessages_column,
447 &mtaGroupStoredMessages_column,
448 &mtaGroupTransmittedMessages_column,
449 &mtaGroupReceivedVolume_column,
450 &mtaGroupStoredVolume_column,
451 &mtaGroupTransmittedVolume_column,
452 &mtaGroupReceivedRecipients_column,
453 &mtaGroupStoredRecipients_column,
454 &mtaGroupTransmittedRecipients_column,
455 &mtaGroupOldestMessageStored_column,
456 &mtaGroupInboundAssociations_column,
457 &mtaGroupOutboundAssociations_column,
458 &mtaGroupAccumulatedInboundAssociations_column,
459 &mtaGroupAccumulatedOutboundAssociations_column,
460 &mtaGroupLastInboundActivity_column,
461 &mtaGroupLastOutboundActivity_column,
462 &mtaGroupRejectedInboundAssociations_column,
463 &mtaGroupFailedOutboundAssociations_column,
464 &mtaGroupInboundRejectionReason_column,
465 &mtaGroupOutboundConnectFailureReason_column,
466 &mtaGroupScheduledRetry_column,
467 &mtaGroupMailProtocol_column,
468 &mtaGroupName_column
469 }
470 };
471
472
473 static Subid mtaGroupAssociationIndex_subids[] = { 1, 3, 6, 1, 2, 1, 28, 3, 1, 1 };
474 static Oid mtaGroupAssociationIndex_name = { mtaGroupAssociationIndex_subids, 10 };
475
476 static SNMP_column mtaGroupAssociationIndex_column
477 = { "mtaGroupAssociationIndex", &mtaGroupAssociationIndex_name, INTEGER, TO_INTEGER };
478
479 static SNMP_table mtaGroupAssociationTable = {
480 1,
481 {
482 &mtaGroupAssociationIndex_column
483 }
484 };
485
486
487 /************/
488 /* RFC 1567 */
489 /************/
490
491 static Subid dsaAnonymousBinds_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 1 };
492 static Oid dsaAnonymousBinds_name = { dsaAnonymousBinds_subids, 10 };
493 static Subid dsaUnauthBinds_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 2 };
494 static Oid dsaUnauthBinds_name = { dsaUnauthBinds_subids, 10 };
495 static Subid dsaSimpleAuthBinds_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 3 };
496 static Oid dsaSimpleAuthBinds_name = { dsaSimpleAuthBinds_subids, 10 };
497 static Subid dsaStrongAuthBinds_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 4 };
498 static Oid dsaStrongAuthBinds_name = { dsaStrongAuthBinds_subids, 10 };
499 static Subid dsaBindSecurityErrors_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 5 };
500 static Oid dsaBindSecurityErrors_name = { dsaBindSecurityErrors_subids, 10 };
501 static Subid dsaInOps_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 6 };
502 static Oid dsaInOps_name = { dsaInOps_subids, 10 };
503 static Subid dsaReadOps_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 7 };
504 static Oid dsaReadOps_name = { dsaReadOps_subids, 10 };
505 static Subid dsaCompareOps_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 8 };
506 static Oid dsaCompareOps_name = { dsaCompareOps_subids, 10 };
507 static Subid dsaAddEntryOps_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 9 };
508 static Oid dsaAddEntryOps_name = { dsaAddEntryOps_subids, 10 };
509 static Subid dsaRemoveEntryOps_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 10 };
510 static Oid dsaRemoveEntryOps_name = { dsaRemoveEntryOps_subids, 10 };
511 static Subid dsaModifyEntryOps_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 11 };
512 static Oid dsaModifyEntryOps_name = { dsaModifyEntryOps_subids, 10 };
513 static Subid dsaModifyRDNOps_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 12 };
514 static Oid dsaModifyRDNOps_name = { dsaModifyRDNOps_subids, 10 };
515 static Subid dsaListOps_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 13 };
516 static Oid dsaListOps_name = { dsaListOps_subids, 10 };
517 static Subid dsaSearchOps_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 14 };
518 static Oid dsaSearchOps_name = { dsaSearchOps_subids, 10 };
519 static Subid dsaOneLevelSearchOps_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 15 };
520 static Oid dsaOneLevelSearchOps_name = { dsaOneLevelSearchOps_subids, 10 };
521 static Subid dsaWholeTreeSearchOps_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 16 };
522 static Oid dsaWholeTreeSearchOps_name = { dsaWholeTreeSearchOps_subids, 10 };
523 static Subid dsaReferrals_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 17 };
524 static Oid dsaReferrals_name = { dsaReferrals_subids, 10 };
525 static Subid dsaChainings_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 18 };
526 static Oid dsaChainings_name = { dsaChainings_subids, 10 };
527 static Subid dsaSecurityErrors_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 19 };
528 static Oid dsaSecurityErrors_name = { dsaSecurityErrors_subids, 10 };
529 static Subid dsaErrors_subids[] = { 1, 3, 6, 1, 2, 1, 29, 1, 1, 20 };
530 static Oid dsaErrors_name = { dsaErrors_subids, 10 };
531
532 static SNMP_column dsaAnonymousBinds_column
533 = { "dsaAnonymousBinds", &dsaAnonymousBinds_name, COUNTER, TO_INTEGER };
534 static SNMP_column dsaUnauthBinds_column
535 = { "dsaUnauthBinds", &dsaUnauthBinds_name, COUNTER, TO_INTEGER };
536 static SNMP_column dsaSimpleAuthBinds_column
537 = { "dsaSimpleAuthBinds", &dsaSimpleAuthBinds_name, COUNTER, TO_INTEGER };
538 static SNMP_column dsaStrongAuthBinds_column
539 = { "dsaStrongAuthBinds", &dsaStrongAuthBinds_name, COUNTER, TO_INTEGER };
540 static SNMP_column dsaBindSecurityErrors_column
541 = { "dsaBindSecurityErrors", &dsaBindSecurityErrors_name, COUNTER, TO_INTEGER };
542 static SNMP_column dsaInOps_column
543 = { "dsaInOps", &dsaInOps_name, COUNTER, TO_INTEGER };
544 static SNMP_column dsaReadOps_column
545 = { "dsaReadOps", &dsaReadOps_name, COUNTER, TO_INTEGER };
546 static SNMP_column dsaCompareOps_column
547 = { "dsaCompareOps", &dsaCompareOps_name, COUNTER, TO_INTEGER };
548 static SNMP_column dsaAddEntryOps_column
549 = { "dsaAddEntryOps", &dsaAddEntryOps_name, COUNTER, TO_INTEGER };
550 static SNMP_column dsaRemoveEntryOps_column
551 = { "dsaRemoveEntryOps", &dsaRemoveEntryOps_name, COUNTER, TO_INTEGER };
552 static SNMP_column dsaModifyEntryOps_column
553 = { "dsaModifyEntryOps", &dsaModifyEntryOps_name, COUNTER, TO_INTEGER };
554 static SNMP_column dsaModifyRDNOps_column
555 = { "dsaModifyRDNOps", &dsaModifyRDNOps_name, COUNTER, TO_INTEGER };
556 static SNMP_column dsaListOps_column
557 = { "dsaListOps", &dsaListOps_name, COUNTER, TO_INTEGER };
558 static SNMP_column dsaSearchOps_column
559 = { "dsaSearchOps", &dsaSearchOps_name, COUNTER, TO_INTEGER };
560 static SNMP_column dsaOneLevelSearchOps_column
561 = { "dsaOneLevelSearchOps", &dsaOneLevelSearchOps_name, COUNTER, TO_INTEGER };
562 static SNMP_column dsaWholeTreeSearchOps_column
563 = { "dsaWholeTreeSearchOps", &dsaWholeTreeSearchOps_name, COUNTER, TO_INTEGER };
564 static SNMP_column dsaReferrals_column
565 = { "dsaReferrals", &dsaReferrals_name, COUNTER, TO_INTEGER };
566 static SNMP_column dsaChainings_column
567 = { "dsaChainings", &dsaChainings_name, COUNTER, TO_INTEGER };
568 static SNMP_column dsaSecurityErrors_column
569 = { "dsaSecurityErrors", &dsaSecurityErrors_name, COUNTER, TO_INTEGER };
570 static SNMP_column dsaErrors_column
571 = { "dsaErrors", &dsaErrors_name, COUNTER, TO_INTEGER };
572
573 static SNMP_table dsaOpsTable = {
574 20,
575 {
576 &dsaAnonymousBinds_column,
577 &dsaUnauthBinds_column,
578 &dsaSimpleAuthBinds_column,
579 &dsaStrongAuthBinds_column,
580 &dsaBindSecurityErrors_column,
581 &dsaInOps_column,
582 &dsaReadOps_column,
583 &dsaCompareOps_column,
584 &dsaAddEntryOps_column,
585 &dsaRemoveEntryOps_column,
586 &dsaModifyEntryOps_column,
587 &dsaModifyRDNOps_column,
588 &dsaListOps_column,
589 &dsaSearchOps_column,
590 &dsaOneLevelSearchOps_column,
591 &dsaWholeTreeSearchOps_column,
592 &dsaReferrals_column,
593 &dsaChainings_column,
594 &dsaSecurityErrors_column,
595 &dsaErrors_column
596 }
597 };
598
599
600 static Subid dsaMasterEntries_subids[] = { 1, 3, 6, 1, 2, 1, 29, 2, 1, 1 };
601 static Oid dsaMasterEntries_name = { dsaMasterEntries_subids, 10 };
602 static Subid dsaCopyEntries_subids[] = { 1, 3, 6, 1, 2, 1, 29, 2, 1, 2 };
603 static Oid dsaCopyEntries_name = { dsaCopyEntries_subids, 10 };
604 static Subid dsaCacheEntries_subids[] = { 1, 3, 6, 1, 2, 1, 29, 2, 1, 3 };
605 static Oid dsaCacheEntries_name = { dsaCacheEntries_subids, 10 };
606 static Subid dsaCacheHits_subids[] = { 1, 3, 6, 1, 2, 1, 29, 2, 1, 4 };
607 static Oid dsaCacheHits_name = { dsaCacheHits_subids, 10 };
608 static Subid dsaSlaveHits_subids[] = { 1, 3, 6, 1, 2, 1, 29, 2, 1, 5 };
609 static Oid dsaSlaveHits_name = { dsaSlaveHits_subids, 10 };
610
611 static SNMP_column dsaMasterEntries_column
612 = { "dsaMasterEntries", &dsaMasterEntries_name, GAUGE, TO_INTEGER };
613 static SNMP_column dsaCopyEntries_column
614 = { "dsaCopyEntries", &dsaCopyEntries_name, GAUGE, TO_INTEGER };
615 static SNMP_column dsaCacheEntries_column
616 = { "dsaCacheEntries", &dsaCacheEntries_name, GAUGE, TO_INTEGER };
617 static SNMP_column dsaCacheHits_column
618 = { "dsaCacheHits", &dsaCacheHits_name, COUNTER, TO_INTEGER };
619 static SNMP_column dsaSlaveHits_column
620 = { "dsaSlaveHits", &dsaSlaveHits_name, COUNTER, TO_INTEGER };
621
622 static SNMP_table dsaEntriesTable = {
623 5,
624 {
625 &dsaMasterEntries_column,
626 &dsaCopyEntries_column,
627 &dsaCacheEntries_column,
628 &dsaCacheHits_column,
629 &dsaSlaveHits_column
630 }
631 };
632
633
634 static Subid dsaName_subids[] = { 1, 3, 6, 1, 2, 1, 29, 3, 1, 2 };
635 static Oid dsaName_name = { dsaName_subids, 10 };
636 static Subid dsaTimeOfCreation_subids[] = { 1, 3, 6, 1, 2, 1, 29, 3, 1, 3 };
637 static Oid dsaTimeOfCreation_name = { dsaTimeOfCreation_subids, 10 };
638 static Subid dsaTimeOfLastAttempt_subids[] = { 1, 3, 6, 1, 2, 1, 29, 3, 1, 4 };
639 static Oid dsaTimeOfLastAttempt_name = { dsaTimeOfLastAttempt_subids, 10 };
640 static Subid dsaTimeOfLastSuccess_subids[] = { 1, 3, 6, 1, 2, 1, 29, 3, 1, 5 };
641 static Oid dsaTimeOfLastSuccess_name = { dsaTimeOfLastSuccess_subids, 10 };
642 static Subid dsaFailuresSinceLastSuccess_subids[] = { 1, 3, 6, 1, 2, 1, 29, 3, 1, 6 };
643 static Oid dsaFailuresSinceLastSuccess_name = { dsaFailuresSinceLastSuccess_subids, 10 };
644 static Subid dsaFailures_subids[] = { 1, 3, 6, 1, 2, 1, 29, 3, 1, 7 };
645 static Oid dsaFailures_name = { dsaFailures_subids, 10 };
646 static Subid dsaSuccesses_subids[] = { 1, 3, 6, 1, 2, 1, 29, 3, 1, 8 };
647 static Oid dsaSuccesses_name = { dsaSuccesses_subids, 10 };
648
649 static SNMP_column dsaName_column
650 = { "dsaName", &dsaName_name, STRING, TO_ASCII };
651 static SNMP_column dsaTimeOfCreation_column
652 = { "dsaTimeOfCreation", &dsaTimeOfCreation_name, TIMETICKS, TO_INTEGER };
653 static SNMP_column dsaTimeOfLastAttempt_column
654 = { "dsaTimeOfLastAttempt", &dsaTimeOfLastAttempt_name, TIMETICKS, TO_INTEGER };
655 static SNMP_column dsaTimeOfLastSuccess_column
656 = { "dsaTimeOfLastSuccess", &dsaTimeOfLastSuccess_name, TIMETICKS, TO_INTEGER };
657 static SNMP_column dsaFailuresSinceLastSuccess_column
658 = { "dsaFailuresSinceLastSuccess", &dsaFailuresSinceLastSuccess_name, COUNTER, TO_INTEGER };
659 static SNMP_column dsaFailures_column
660 = { "dsaFailures", &dsaFailures_name, COUNTER, TO_INTEGER };
661 static SNMP_column dsaSuccesses_column
662 = { "dsaSuccesses", &dsaSuccesses_name, COUNTER, TO_INTEGER };
663
664 static SNMP_table dsaIntTable = {
665 7,
666 {
667 &dsaName_column,
668 &dsaTimeOfCreation_column,
669 &dsaTimeOfLastAttempt_column,
670 &dsaTimeOfLastSuccess_column,
671 &dsaFailuresSinceLastSuccess_column,
672 &dsaFailures_column,
673 &dsaSuccesses_column
674 }
675 };
676
677
678 /************/
679 /* X4MS MIB */
680 /************/
681
682 static Subid x4msMtaName_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 1, 1, 2 };
683 static Oid x4msMtaName_name = { x4msMtaName_subids, 14 };
684
685 static SNMP_column x4msMtaName_column
686 = { "x4msMtaName", &x4msMtaName_name, STRING, TO_ASCII };
687
688 static SNMP_table x4msMtaTable = {
689 1,
690 {
691 &x4msMtaName_column
692 }
693 };
694
695
696 static Subid x4msUserTotalMessages_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 2, 1, 2 };
697 static Oid x4msUserTotalMessages_name = { x4msUserTotalMessages_subids, 14 };
698
699 static Subid x4msUserTotalVolume_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 2, 1, 3 };
700 static Oid x4msUserTotalVolume_name = { x4msUserTotalVolume_subids, 14 };
701
702 static Subid x4msUserP3Associations_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 2, 1, 4 };
703 static Oid x4msUserP3Associations_name = { x4msUserP3Associations_subids, 14 };
704
705 static Subid x4msUserP7Associations_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 2, 1, 5 };
706 static Oid x4msUserP7Associations_name = { x4msUserP7Associations_subids, 14 };
707
708 static Subid x4msUserLastP7Association_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 2, 1, 6 };
709 static Oid x4msUserLastP7Association_name = { x4msUserLastP7Association_subids, 14 };
710
711 static Subid x4msUserAuthentificationFailures_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 2, 1, 7 };
712 static Oid x4msUserAuthentificationFailures_name = { x4msUserAuthentificationFailures_subids, 14 };
713
714 static Subid x4msUserAuthentificationFailureReason_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 2, 1, 8 };
715 static Oid x4msUserAuthentificationFailureReason_name = { x4msUserAuthentificationFailureReason_subids, 14 };
716
717 static Subid x4msUserName_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 2, 1, 9 };
718 static Oid x4msUserName_name = { x4msUserName_subids, 14 };
719
720 static SNMP_column x4msUserTotalMessages_column
721 = { "x4msUserTotalMessages", &x4msUserTotalMessages_name, GAUGE, TO_INTEGER };
722 static SNMP_column x4msUserTotalVolume_column
723 = { "x4msUserTotalVolume", &x4msUserTotalVolume_name, GAUGE, TO_INTEGER };
724 static SNMP_column x4msUserP3Associations_column
725 = { "x4msUserP3Associations", &x4msUserP3Associations_name, GAUGE, TO_INTEGER };
726 static SNMP_column x4msUserP7Associations_column
727 = { "x4msUserP7Associations", &x4msUserP7Associations_name, GAUGE, TO_INTEGER };
728 static SNMP_column x4msUserLastP7Association_column
729 = { "x4msUserLastP7Association", &x4msUserLastP7Association_name, INTEGER, TO_INTEGER };
730 static SNMP_column x4msUserAuthentificationFailures_column
731 = { "x4msUserAuthentificationFailures", &x4msUserAuthentificationFailures_name, COUNTER, TO_INTEGER };
732 static SNMP_column x4msUserAuthentificationFailureReason_column
733 = { "x4msUserAuthentificationFailureReason", &x4msUserAuthentificationFailureReason_name, STRING, TO_ASCII };
734 static SNMP_column x4msUserName_column
735 = { "x4msUserName", &x4msUserName_name, STRING, TO_ASCII };
736
737 static SNMP_table x4msUserTablePart1 = {
738 8,
739 {
740 &x4msUserTotalMessages_column,
741 &x4msUserTotalVolume_column,
742 &x4msUserP3Associations_column,
743 &x4msUserP7Associations_column,
744 &x4msUserLastP7Association_column,
745 &x4msUserAuthentificationFailures_column,
746 &x4msUserAuthentificationFailureReason_column,
747 &x4msUserName_column
748 }
749 };
750
751
752 static Subid x4msUserNewMessages_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 1 };
753 static Oid x4msUserNewMessages_name = { x4msUserNewMessages_subids, 14 };
754
755 static Subid x4msUserNewVolume_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 2 };
756 static Oid x4msUserNewVolume_name = { x4msUserNewVolume_subids, 14 };
757
758 static Subid x4msUserListedMessages_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 3 };
759 static Oid x4msUserListedMessages_name = { x4msUserListedMessages_subids, 14 };
760
761 static Subid x4msUserListedVolume_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 4 };
762 static Oid x4msUserListedVolume_name = { x4msUserListedVolume_subids, 14 };
763
764 static Subid x4msUserProcessedMessages_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 5 };
765 static Oid x4msUserProcessedMessages_name = { x4msUserProcessedMessages_subids, 14 };
766
767 static Subid x4msUserProcessedVolume_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 6 };
768 static Oid x4msUserProcessedVolume_name = { x4msUserProcessedVolume_subids, 14 };
769
770 static Subid x4msUserMessagesOlderThanWeek_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 7 };
771 static Oid x4msUserMessagesOlderThanWeek_name = { x4msUserMessagesOlderThanWeek_subids, 14 };
772
773 static Subid x4msUserVolumeOlderThanWeek_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 8 };
774 static Oid x4msUserVolumeOlderThanWeek_name = { x4msUserVolumeOlderThanWeek_subids, 14 };
775
776 static Subid x4msUserMessagesOlderThanMonth_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 9 };
777 static Oid x4msUserMessagesOlderThanMonth_name = { x4msUserMessagesOlderThanMonth_subids, 14 };
778
779 static Subid x4msUserVolumeOlderThanMonth_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 10 };
780 static Oid x4msUserVolumeOlderThanMonth_name = { x4msUserVolumeOlderThanMonth_subids, 14 };
781
782 static Subid x4msUserMessagesOlderThanYear_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 11 };
783 static Oid x4msUserMessagesOlderThanYear_name = { x4msUserMessagesOlderThanYear_subids, 14 };
784
785 static Subid x4msUserVolumeOlderThanYear_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 12 };
786 static Oid x4msUserVolumeOlderThanYear_name = { x4msUserVolumeOlderThanYear_subids, 14 };
787
788 static Subid x4msUserP3InboundAssociations_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 13 };
789 static Oid x4msUserP3InboundAssociations_name = { x4msUserP3InboundAssociations_subids, 14 };
790
791 static Subid x4msUserP7InboundAssociations_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 14 };
792 static Oid x4msUserP7InboundAssociations_name = { x4msUserP7InboundAssociations_subids, 14 };
793
794 static Subid x4msUserP3OutboundAssociations_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 15 };
795 static Oid x4msUserP3OutboundAssociations_name = { x4msUserP3OutboundAssociations_subids, 14 };
796
797 static Subid x4msUserAccumulatedP3InboundAssociations_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 16 };
798 static Oid x4msUserAccumulatedP3InboundAssociations_name = { x4msUserAccumulatedP3InboundAssociations_subids, 14 };
799
800 static Subid x4msUserAccumulatedP7InboundAssociations_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 17 };
801 static Oid x4msUserAccumulatedP7InboundAssociations_name = { x4msUserAccumulatedP7InboundAssociations_subids, 14 };
802
803 static Subid x4msUserAccumulatedP3OutboundAssociations_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 18 };
804 static Oid x4msUserAccumulatedP3OutboundAssociations_name = { x4msUserAccumulatedP3OutboundAssociations_subids, 14 };
805
806 static Subid x4msUserLastP3InboundActivity_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 19 };
807 static Oid x4msUserLastP3InboundActivity_name = { x4msUserLastP3InboundActivity_subids, 14 };
808
809 static Subid x4msUserLastP7InboundActivity_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 20 };
810 static Oid x4msUserLastP7InboundActivity_name = { x4msUserLastP7InboundActivity_subids, 14 };
811
812 static Subid x4msUserLastP3OutboundActivity_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 21 };
813 static Oid x4msUserLastP3OutboundActivity_name = { x4msUserLastP3OutboundActivity_subids, 14 };
814
815 static Subid x4msUserRejectedP3InboundAssociations_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 22 };
816 static Oid x4msUserRejectedP3InboundAssociations_name = { x4msUserRejectedP3InboundAssociations_subids, 14 };
817
818 static Subid x4msUserRejectedP7InboundAssociations_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 23 };
819 static Oid x4msUserRejectedP7InboundAssociations_name = { x4msUserRejectedP7InboundAssociations_subids, 14 };
820
821 static Subid x4msUserFailedP3OutboundAssociations_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 24 };
822 static Oid x4msUserFailedP3OutboundAssociations_name = { x4msUserFailedP3OutboundAssociations_subids, 14 };
823
824 static Subid x4msUserP3InboundRejectionReason_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 25 };
825 static Oid x4msUserP3InboundRejectionReason_name = { x4msUserP3InboundRejectionReason_subids, 14 };
826
827 static Subid x4msUserP7InboundRejectionReason_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 26 };
828 static Oid x4msUserP7InboundRejectionReason_name = { x4msUserP7InboundRejectionReason_subids, 14 };
829
830 static Subid x4msUserP3OutboundConnectFailureReason_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 27 };
831 static Oid x4msUserP3OutboundConnectFailureReason_name = { x4msUserP3OutboundConnectFailureReason_subids, 14 };
832
833 static Subid x4msUserMtaIndex_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 28 };
834 static Oid x4msUserMtaIndex_name = { x4msUserMtaIndex_subids, 14 };
835
836 static Subid x4msUserORName_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 3, 1, 29 };
837 static Oid x4msUserORName_name = { x4msUserORName_subids, 14 };
838
839 static SNMP_column x4msUserNewMessages_column
840 = { "x4msUserNewMessages", &x4msUserNewMessages_name, GAUGE, TO_INTEGER };
841 static SNMP_column x4msUserNewVolume_column
842 = { "x4msUserNewVolume", &x4msUserNewVolume_name, GAUGE, TO_INTEGER };
843 static SNMP_column x4msUserListedMessages_column
844 = { "x4msUserListedMessages", &x4msUserListedMessages_name, GAUGE, TO_INTEGER };
845 static SNMP_column x4msUserListedVolume_column
846 = { "x4msUserListedVolume", &x4msUserListedVolume_name, GAUGE, TO_INTEGER };
847 static SNMP_column x4msUserProcessedMessages_column
848 = { "x4msUserProcessedMessages", &x4msUserProcessedMessages_name, GAUGE, TO_INTEGER };
849 static SNMP_column x4msUserProcessedVolume_column
850 = { "x4msUserProcessedVolume", &x4msUserProcessedVolume_name, GAUGE, TO_INTEGER };
851 static SNMP_column x4msUserMessagesOlderThanWeek_column
852 = { "x4msUserMessagesOlderThanWeek", &x4msUserMessagesOlderThanWeek_name, GAUGE, TO_INTEGER };
853 static SNMP_column x4msUserVolumeOlderThanWeek_column
854 = { "x4msUserVolumeOlderThanWeek", &x4msUserVolumeOlderThanWeek_name, GAUGE, TO_INTEGER };
855 static SNMP_column x4msUserMessagesOlderThanMonth_column
856 = { "x4msUserMessagesOlderThanMonth", &x4msUserMessagesOlderThanMonth_name, GAUGE, TO_INTEGER };
857 static SNMP_column x4msUserVolumeOlderThanMonth_column
858 = { "x4msUserVolumeOlderThanMonth", &x4msUserVolumeOlderThanMonth_name, GAUGE, TO_INTEGER };
859 static SNMP_column x4msUserMessagesOlderThanYear_column
860 = { "x4msUserMessagesOlderThanYear", &x4msUserMessagesOlderThanYear_name, GAUGE, TO_INTEGER };
861 static SNMP_column x4msUserVolumeOlderThanYear_column
862 = { "x4msUserVolumeOlderThanYear", &x4msUserVolumeOlderThanYear_name, GAUGE, TO_INTEGER };
863 static SNMP_column x4msUserP3InboundAssociations_column
864 = { "x4msUserP3InboundAssociations", &x4msUserP3InboundAssociations_name, GAUGE, TO_INTEGER };
865 static SNMP_column x4msUserP7InboundAssociations_column
866 = { "x4msUserP7InboundAssociations", &x4msUserP7InboundAssociations_name, GAUGE, TO_INTEGER };
867 static SNMP_column x4msUserP3OutboundAssociations_column
868 = { "x4msUserP3OutboundAssociations", &x4msUserP3OutboundAssociations_name, GAUGE, TO_INTEGER };
869 static SNMP_column x4msUserAccumulatedP3InboundAssociations_column
870 = { "x4msUserAccumulatedP3InboundAssociations", &x4msUserAccumulatedP3InboundAssociations_name, COUNTER, TO_INTEGER };
871 static SNMP_column x4msUserAccumulatedP7InboundAssociations_column
872 = { "x4msUserAccumulatedP7InboundAssociations", &x4msUserAccumulatedP7InboundAssociations_name, COUNTER, TO_INTEGER };
873 static SNMP_column x4msUserAccumulatedP3OutboundAssociations_column
874 = { "x4msUserAccumulatedP3OutboundAssociations", &x4msUserAccumulatedP3OutboundAssociations_name, COUNTER, TO_INTEGER };
875 static SNMP_column x4msUserLastP3InboundActivity_column
876 = { "x4msUserLastP3InboundActivity", &x4msUserLastP3InboundActivity_name, INTEGER, TO_INTEGER };
877 static SNMP_column x4msUserLastP7InboundActivity_column
878 = { "x4msUserLastP7InboundActivity", &x4msUserLastP7InboundActivity_name, INTEGER, TO_INTEGER };
879 static SNMP_column x4msUserLastP3OutboundActivity_column
880 = { "x4msUserLastP3OutboundActivity", &x4msUserLastP3OutboundActivity_name, INTEGER, TO_INTEGER };
881 static SNMP_column x4msUserRejectedP3InboundAssociations_column
882 = { "x4msUserRejectedP3InboundAssociations", &x4msUserRejectedP3InboundAssociations_name, COUNTER, TO_INTEGER };
883 static SNMP_column x4msUserRejectedP7InboundAssociations_column
884 = { "x4msUserRejectedP7InboundAssociations", &x4msUserRejectedP7InboundAssociations_name, COUNTER, TO_INTEGER };
885 static SNMP_column x4msUserFailedP3OutboundAssociations_column
886 = { "x4msUserFailedP3OutboundAssociations", &x4msUserFailedP3OutboundAssociations_name, COUNTER, TO_INTEGER };
887 static SNMP_column x4msUserP3InboundRejectionReason_column
888 = { "x4msUserP3InboundRejectionReason", &x4msUserP3InboundRejectionReason_name, STRING, TO_ASCII };
889 static SNMP_column x4msUserP7InboundRejectionReason_column
890 = { "x4msUserP7InboundRejectionReason", &x4msUserP7InboundRejectionReason_name, STRING, TO_ASCII };
891 static SNMP_column x4msUserP3OutboundConnectFailureReason_column
892 = { "x4msUserP3OutboundConnectFailureReason", &x4msUserP3OutboundConnectFailureReason_name, STRING, TO_ASCII };
893 static SNMP_column x4msUserMtaIndex_column
894 = { "x4msUserMtaIndex", &x4msUserMtaIndex_name, INTEGER, TO_INTEGER };
895 static SNMP_column x4msUserORName_column
896 = { "x4msUserORName", &x4msUserORName_name, STRING, TO_ASCII };
897
898 static SNMP_table x4msUserTablePart2 = {
899 29,
900 {
901 &x4msUserNewMessages_column,
902 &x4msUserNewVolume_column,
903 &x4msUserListedMessages_column,
904 &x4msUserListedVolume_column,
905 &x4msUserProcessedMessages_column,
906 &x4msUserProcessedVolume_column,
907 &x4msUserMessagesOlderThanWeek_column,
908 &x4msUserVolumeOlderThanWeek_column,
909 &x4msUserMessagesOlderThanMonth_column,
910 &x4msUserVolumeOlderThanMonth_column,
911 &x4msUserMessagesOlderThanYear_column,
912 &x4msUserVolumeOlderThanYear_column,
913 &x4msUserP3InboundAssociations_column,
914 &x4msUserP7InboundAssociations_column,
915 &x4msUserP3OutboundAssociations_column,
916 &x4msUserAccumulatedP3InboundAssociations_column,
917 &x4msUserAccumulatedP7InboundAssociations_column,
918 &x4msUserAccumulatedP3OutboundAssociations_column,
919 &x4msUserLastP3InboundActivity_column,
920 &x4msUserLastP7InboundActivity_column,
921 &x4msUserLastP3OutboundActivity_column,
922 &x4msUserRejectedP3InboundAssociations_column,
923 &x4msUserRejectedP7InboundAssociations_column,
924 &x4msUserFailedP3OutboundAssociations_column,
925 &x4msUserP3InboundRejectionReason_column,
926 &x4msUserP7InboundRejectionReason_column,
927 &x4msUserP3OutboundConnectFailureReason_column,
928 &x4msUserMtaIndex_column,
929 &x4msUserORName_column
930 }
931 };
932
933
934 static Subid x4msUserAssociationIndex_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 1, 4, 1, 1 };
935 static Oid x4msUserAssociationIndex_name = { x4msUserAssociationIndex_subids, 14 };
936
937 static SNMP_column x4msUserAssociationIndex_column
938 = { "x4msUserAssociationIndex", &x4msUserAssociationIndex_name, INTEGER, TO_INTEGER };
939
940 static SNMP_table x4msUserAssociationTable = {
941 1,
942 {
943 &x4msUserAssociationIndex_column
944 }
945 };
946
947
948 /*************/
949 /* X4GRP MIB */
950 /*************/
951
952 static Subid x4grpName_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 2, 1, 1, 2 };
953 static Oid x4grpName_name = { x4grpName_subids, 14 };
954
955 static SNMP_column x4grpName_column
956 = { "x4grpName", &x4grpName_name, STRING, TO_ASCII };
957
958 static SNMP_table x4grpTable = {
959 1,
960 {
961 &x4grpName_column
962 }
963 };
964
965
966 static Subid x4grpMappingMSIndex_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 2, 2, 1, 1 };
967 static Oid x4grpMappingMSIndex_name = { x4grpMappingMSIndex_subids, 14 };
968
969 static Subid x4grpMappingMTAIndex_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 2, 2, 1, 2 };
970 static Oid x4grpMappingMTAIndex_name = { x4grpMappingMTAIndex_subids, 14 };
971
972 static SNMP_column x4grpMappingMSIndex_column
973 = { "x4grpMappingMSIndex", &x4grpMappingMSIndex_name, INTEGER, TO_INTEGER };
974 static SNMP_column x4grpMappingMTAIndex_column
975 = { "x4grpMappingMTAIndex", &x4grpMappingMTAIndex_name, INTEGER, TO_INTEGER };
976
977 static SNMP_table x4grpMappingTable = {
978 2,
979 {
980 &x4grpMappingMSIndex_column,
981 &x4grpMappingMTAIndex_column
982 }
983 };
984
985
986 /*************/
987 /* X5DSA MIB */
988 /*************/
989
990 static Subid x5dsaReferenceType_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 4, 1, 1, 2 };
991 static Oid x5dsaReferenceType_name = { x5dsaReferenceType_subids, 14 };
992 static Subid x5dsaReferenceNamingContext_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 4, 1, 1, 3 };
993 static Oid x5dsaReferenceNamingContext_name = { x5dsaReferenceNamingContext_subids, 14 };
994 static Subid x5dsaReferenceSubordinate_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 4, 1, 1, 4 };
995 static Oid x5dsaReferenceSubordinate_name = { x5dsaReferenceSubordinate_subids, 14 };
996 static Subid x5dsaReferenceName_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 2, 4, 1, 1, 5 };
997 static Oid x5dsaReferenceName_name = { x5dsaReferenceName_subids, 14 };
998
999 static SNMP_column x5dsaReferenceType_column
1000 = { "x5dsaReferenceType", &x5dsaReferenceType_name, INTEGER, TO_INTEGER };
1001 static SNMP_column x5dsaReferenceNamingContext_column
1002 = { "x5dsaReferenceNamingContext", &x5dsaReferenceNamingContext_name, STRING, TO_ASCII };
1003 static SNMP_column x5dsaReferenceSubordinate_column
1004 = { "x5dsaReferenceSubordinate", &x5dsaReferenceSubordinate_name, STRING, TO_ASCII };
1005 static SNMP_column x5dsaReferenceName_column
1006 = { "x5dsaReferenceName", &x5dsaReferenceName_name, STRING, TO_ASCII };
1007
1008 static SNMP_table x5dsaReferenceTable = {
1009 4,
1010 {
1011 &x5dsaReferenceType_column,
1012 &x5dsaReferenceNamingContext_column,
1013 &x5dsaReferenceSubordinate_column,
1014 &x5dsaReferenceName_column
1015 }
1016 };
1017
1018
1019
1020 /***** LOCAL FUNCTIONS *****/
1021
1022 static int translate_variable(SNMP_variable *variable, int translator,
1023 uintptr_t pointer, char *error_label);
1024 static int extract_one_index_from_column(Oid *instance, Oid *object, int32_t * index);
1025 static int extract_two_indexes_from_column(Oid *instance, Oid *object,
1026 int32_t *index1, int32_t *index2);
1027 static int extract_three_indexes_from_column(Oid *instance, Oid *object,
1028 int32_t *index1, int32_t *index2, int32_t *index3);
1029
1030 /***************************************************************/
1031
sysUpTime_send_request(SNMP_session * session,char * error_label)1032 int sysUpTime_send_request(SNMP_session *session, char *error_label)
1033 {
1034 SNMP_pdu *request;
1035 SNMP_object *object = &sysUpTime_object;
1036
1037
1038 error_label[0] = '\0';
1039
1040
1041 request = snmp_pdu_new(error_label);
1042 if(request == NULL)
1043 {
1044 return -1;
1045 }
1046 request->type = GET_REQ_MSG;
1047
1048 if(snmp_pdu_append_null_variable(request, object->name, error_label) == NULL)
1049 {
1050 snmp_pdu_free(request);
1051 return -1;
1052 }
1053
1054 if(snmp_session_send(session, SYSUPTIME_REQ, request, error_label))
1055 {
1056 /* we have to free the request */
1057
1058 snmp_pdu_free(request);
1059 return -1;
1060 }
1061
1062
1063 return 0;
1064 }
1065
1066
1067 /***************************************************************/
1068
1069 /* ARGSUSED */
sysUpTime_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)1070 SysUpTime *sysUpTime_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
1071 {
1072 SysUpTime *sysUpTime;
1073 SNMP_variable *variable;
1074 SNMP_object *object = &sysUpTime_object;
1075 uintptr_t pointer;
1076
1077 snmp_errno = SNMP_ERR_NOERROR;
1078 error_label[0] = '\0';
1079
1080 if(response == NULL)
1081 {
1082 sprintf(error_label, "BUG: sysUpTime_process_response(): response is NULL");
1083 return NULL;
1084 }
1085
1086 if(response->error_status != SNMP_ERR_NOERROR)
1087 {
1088 sprintf(error_label, ERR_MSG_ERROR_STATUS,
1089 error_status_string(response->error_status),
1090 response->error_index);
1091 snmp_errno = response->error_status;
1092 return NULL;
1093 }
1094
1095 sysUpTime = (SysUpTime *) malloc(sizeof(SysUpTime));
1096 if(sysUpTime == NULL)
1097 {
1098 sprintf(error_label, ERR_MSG_ALLOC);
1099 return NULL;
1100 }
1101 memset(sysUpTime, 0, sizeof(SysUpTime));
1102
1103 pointer = (uintptr_t)sysUpTime;
1104 variable = response->first_variable;
1105
1106 if(variable == NULL)
1107 {
1108 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
1109 sysUpTime_free(sysUpTime);
1110 return NULL;
1111 }
1112
1113 /* check oid */
1114 if(SSAOidCmp(&(variable->name), object->name))
1115 {
1116 snmp_errno = SNMP_ERR_NOSUCHNAME;
1117 sysUpTime_free(sysUpTime);
1118 return NULL;
1119 }
1120
1121 /* check type */
1122 if(variable->type != object->type)
1123 {
1124 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
1125 variable->type, object->label);
1126 sysUpTime_free(sysUpTime);
1127 return NULL;
1128 }
1129
1130 if(translate_variable(variable, object->translator, pointer, error_label))
1131 {
1132 sysUpTime_free(sysUpTime);
1133 return NULL;
1134 }
1135
1136
1137 return sysUpTime;
1138 }
1139
1140
1141 /***************************************************************/
1142
sysUpTime_free(SysUpTime * sysUpTime)1143 void sysUpTime_free(SysUpTime *sysUpTime)
1144 {
1145 if(sysUpTime == NULL)
1146 {
1147 return;
1148 }
1149
1150 free(sysUpTime);
1151 }
1152
1153
1154 /***************************************************************/
1155
sysUpTime_print(SysUpTime * sysUpTime)1156 void sysUpTime_print(SysUpTime *sysUpTime)
1157 {
1158 printf("sysUpTime: %ld\n",
1159 sysUpTime);
1160 printf("\n");
1161 }
1162
1163
1164 /***************************************************************/
1165 /***************************************************************/
1166 /***************************************************************/
1167
applEntry_send_request(SNMP_session * session,u_char type,int32_t applIndex,char * error_label)1168 int applEntry_send_request(SNMP_session *session, u_char type, int32_t applIndex, char *error_label)
1169 {
1170 SNMP_pdu *request;
1171 int i;
1172 SNMP_column *column;
1173 Subid subids[100] = { 0 };
1174 Oid oid;
1175 Oid *oidp;
1176
1177
1178 error_label[0] = '\0';
1179
1180 if( (type != GET_REQ_MSG) && (type != GETNEXT_REQ_MSG) )
1181 {
1182 sprintf(error_label, "BUG: applEntry_send_request(): bad type (0x%x)", type);
1183 return -1;
1184 }
1185
1186 request = snmp_pdu_new(error_label);
1187 if(request == NULL)
1188 {
1189 return -1;
1190 }
1191 request->type = type;
1192
1193 for(i = 0; i < applTable.column_num; i++)
1194 {
1195 column = applTable.columns[i];
1196
1197 if(applIndex >= 0)
1198 {
1199 memcpy(subids, column->name->subids, column->name->len*sizeof(Subid));
1200 subids[column->name->len] = applIndex;
1201 oid.len = column->name->len + 1;
1202 oid.subids = subids;
1203 oidp = &oid;
1204 }
1205 else
1206 {
1207 oidp = column->name;
1208 }
1209
1210 if(snmp_pdu_append_null_variable(request, oidp, error_label) == NULL)
1211 {
1212 snmp_pdu_free(request);
1213 return -1;
1214 }
1215 }
1216
1217 if(snmp_session_send(session, APPL_ENTRY_REQ, request, error_label))
1218 {
1219 /* we have to free the request */
1220
1221 snmp_pdu_free(request);
1222 return -1;
1223 }
1224
1225
1226 return 0;
1227 }
1228
1229
1230 /***************************************************************/
1231
1232 /* ARGSUSED */
applEntry_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)1233 ApplEntry *applEntry_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
1234 {
1235 ApplEntry *applEntry;
1236 int32_t applIndex;
1237 SNMP_variable *variable;
1238 uintptr_t pointer;
1239 int i;
1240 SNMP_column *column;
1241
1242
1243 snmp_errno = SNMP_ERR_NOERROR;
1244 error_label[0] = '\0';
1245
1246 if(response == NULL)
1247 {
1248 sprintf(error_label, "BUG: applEntry_process_response(): response is NULL");
1249 return NULL;
1250 }
1251
1252 if(response->error_status != SNMP_ERR_NOERROR)
1253 {
1254 sprintf(error_label, ERR_MSG_ERROR_STATUS,
1255 error_status_string(response->error_status),
1256 response->error_index);
1257 snmp_errno = response->error_status;
1258 return NULL;
1259 }
1260
1261 applEntry = (ApplEntry *) malloc(sizeof(ApplEntry));
1262 if(applEntry == NULL)
1263 {
1264 sprintf(error_label, ERR_MSG_ALLOC);
1265 return NULL;
1266 }
1267 memset(applEntry, 0, sizeof(ApplEntry));
1268
1269 pointer = (uintptr_t)&(applEntry->applName);
1270 variable = response->first_variable;
1271 for(i = 0; i < applTable.column_num; i++)
1272 {
1273 column = applTable.columns[i];
1274
1275 if(variable == NULL)
1276 {
1277 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
1278 applEntry_free(applEntry);
1279 return NULL;
1280 }
1281
1282 /* check oid and extract applIndex */
1283 if(extract_one_index_from_column(&(variable->name), column->name, &applIndex))
1284 {
1285 snmp_errno = SNMP_ERR_NOSUCHNAME;
1286 applEntry_free(applEntry);
1287 return NULL;
1288 }
1289
1290 /* check if all applIndex are equal ??? */
1291 applEntry->applIndex = applIndex;
1292
1293 /* check type */
1294 if(variable->type != column->type)
1295 {
1296 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
1297 variable->type, column->label);
1298 applEntry_free(applEntry);
1299 return NULL;
1300 }
1301
1302 if(translate_variable(variable, column->translator, pointer, error_label))
1303 {
1304 applEntry_free(applEntry);
1305 return NULL;
1306 }
1307
1308 variable = variable->next_variable;
1309 pointer++;
1310 }
1311
1312
1313 return applEntry;
1314 }
1315
1316
1317 /***************************************************************/
1318
applEntry_free(ApplEntry * applEntry)1319 void applEntry_free(ApplEntry *applEntry)
1320 {
1321 if(applEntry == NULL)
1322 {
1323 return;
1324 }
1325
1326 if(applEntry->applName)
1327 {
1328 free(applEntry->applName);
1329 }
1330 if(applEntry->applDirectoryName)
1331 {
1332 free(applEntry->applDirectoryName);
1333 }
1334 if(applEntry->applVersion)
1335 {
1336 free(applEntry->applVersion);
1337 }
1338 free(applEntry);
1339 }
1340
1341
1342 /***************************************************************/
1343
applEntry_print(ApplEntry * applEntry)1344 void applEntry_print(ApplEntry *applEntry)
1345 {
1346 printf("applIndex: %ld\n",
1347 applEntry->applIndex);
1348 printf("applName: %s\n",
1349 applEntry->applName);
1350 printf("applDirectoryName: %s\n",
1351 applEntry->applDirectoryName);
1352 printf("applVersion: %s\n",
1353 applEntry->applVersion);
1354 printf("applUptime: %ld\n",
1355 applEntry->applUptime);
1356 printf("applOperStatus: %s\n",
1357 applOperStatus_string(applEntry->applOperStatus));
1358 printf("applLastChange: %ld\n",
1359 applEntry->applLastChange);
1360 printf("applInboundAssociations: %ld\n",
1361 applEntry->applInboundAssociations);
1362 printf("applOutboundAssociations: %ld\n",
1363 applEntry->applOutboundAssociations);
1364 printf("applAccumulatedInboundAssociations: %ld\n",
1365 applEntry->applAccumulatedInboundAssociations);
1366 printf("applAccumulatedOutboundAssociations: %ld\n",
1367 applEntry->applAccumulatedOutboundAssociations);
1368 printf("applLastInboundActivity: %ld\n",
1369 applEntry->applLastInboundActivity);
1370 printf("applLastOutboundActivity: %ld\n",
1371 applEntry->applLastOutboundActivity);
1372 printf("applRejectedInboundAssociations: %ld\n",
1373 applEntry->applRejectedInboundAssociations);
1374 printf("applFailedOutboundAssociations: %ld\n",
1375 applEntry->applFailedOutboundAssociations);
1376 printf("\n");
1377 }
1378
1379
1380 /***************************************************************/
1381 /***************************************************************/
1382 /***************************************************************/
1383
1384 int
assocEntry_send_request(SNMP_session * session,u_char type,int32_t applIndex,int32_t assocIndex,char * error_label)1385 assocEntry_send_request(SNMP_session *session, u_char type, int32_t applIndex, int32_t assocIndex, char *error_label)
1386 {
1387 SNMP_pdu *request;
1388 int i;
1389 SNMP_column *column;
1390 Subid subids[100] = { 0 };
1391 Oid oid;
1392 Oid *oidp;
1393
1394
1395 error_label[0] = '\0';
1396
1397 if( (type != GET_REQ_MSG) && (type != GETNEXT_REQ_MSG) )
1398 {
1399 sprintf(error_label, "BUG: assocEntry_send_request(): bad type (0x%x)", type);
1400 return -1;
1401 }
1402
1403 request = snmp_pdu_new(error_label);
1404 if(request == NULL)
1405 {
1406 return -1;
1407 }
1408 request->type = type;
1409
1410 for(i = 0; i < assocTable.column_num; i++)
1411 {
1412 column = assocTable.columns[i];
1413
1414 if(applIndex >= 0)
1415 {
1416 memcpy(subids, column->name->subids, column->name->len*sizeof(Subid));
1417 subids[column->name->len] = applIndex;
1418 oid.len = column->name->len + 1;
1419
1420 if(assocIndex >= 0)
1421 {
1422 subids[column->name->len + 1] = assocIndex;
1423 oid.len = column->name->len + 2;
1424 }
1425
1426 oid.subids = subids;
1427 oidp = &oid;
1428 }
1429 else
1430 {
1431 oidp = column->name;
1432 }
1433
1434 if(snmp_pdu_append_null_variable(request, oidp, error_label) == NULL)
1435 {
1436 snmp_pdu_free(request);
1437 return -1;
1438 }
1439 }
1440
1441 if(snmp_session_send(session, ASSOC_ENTRY_REQ, request, error_label))
1442 {
1443 /* we have to free the request */
1444
1445 snmp_pdu_free(request);
1446 return -1;
1447 }
1448
1449
1450 return 0;
1451 }
1452
1453
1454 /***************************************************************/
1455
1456 /* ARGSUSED */
assocEntry_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)1457 AssocEntry *assocEntry_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
1458 {
1459 AssocEntry *assocEntry;
1460 int32_t applIndex;
1461 int32_t assocIndex;
1462 SNMP_variable *variable;
1463 uintptr_t pointer;
1464 int i;
1465 SNMP_column *column;
1466
1467
1468 snmp_errno = SNMP_ERR_NOERROR;
1469 error_label[0] = '\0';
1470
1471 if(response == NULL)
1472 {
1473 sprintf(error_label, "BUG: assocEntry_process_response(): response is NULL");
1474 return NULL;
1475 }
1476
1477 if(response->error_status != SNMP_ERR_NOERROR)
1478 {
1479 sprintf(error_label, ERR_MSG_ERROR_STATUS,
1480 error_status_string(response->error_status),
1481 response->error_index);
1482 snmp_errno = response->error_status;
1483 return NULL;
1484 }
1485
1486 assocEntry = (AssocEntry *) malloc(sizeof(AssocEntry));
1487 if(assocEntry == NULL)
1488 {
1489 sprintf(error_label, ERR_MSG_ALLOC);
1490 return NULL;
1491 }
1492 memset(assocEntry, 0, sizeof(AssocEntry));
1493
1494 pointer = (uintptr_t)&(assocEntry->assocRemoteApplication);
1495 variable = response->first_variable;
1496 for(i = 0; i < assocTable.column_num; i++)
1497 {
1498 column = assocTable.columns[i];
1499
1500 if(variable == NULL)
1501 {
1502 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
1503 assocEntry_free(assocEntry);
1504 return NULL;
1505 }
1506
1507 /* check oid and extract applIndex */
1508 if(extract_two_indexes_from_column(&(variable->name), column->name, &applIndex, &assocIndex))
1509 {
1510 snmp_errno = SNMP_ERR_NOSUCHNAME;
1511 assocEntry_free(assocEntry);
1512 return NULL;
1513 }
1514
1515 /* check if all applIndex + assocIndex are equal ??? */
1516 assocEntry->applIndex = applIndex;
1517 assocEntry->assocIndex = assocIndex;
1518
1519 /* check type */
1520 if(variable->type != column->type)
1521 {
1522 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
1523 variable->type, column->label);
1524 assocEntry_free(assocEntry);
1525 return NULL;
1526 }
1527
1528 if(translate_variable(variable, column->translator, pointer, error_label))
1529 {
1530 assocEntry_free(assocEntry);
1531 return NULL;
1532 }
1533
1534 variable = variable->next_variable;
1535 pointer++;
1536 }
1537
1538
1539 return assocEntry;
1540 }
1541
1542
1543 /***************************************************************/
1544
assocEntry_free(AssocEntry * assocEntry)1545 void assocEntry_free(AssocEntry *assocEntry)
1546 {
1547 if(assocEntry == NULL)
1548 {
1549 return;
1550 }
1551
1552 if(assocEntry->assocRemoteApplication)
1553 {
1554 free(assocEntry->assocRemoteApplication);
1555 }
1556 if(assocEntry->assocApplicationProtocol)
1557 {
1558 SSAOidFree(assocEntry->assocApplicationProtocol);
1559 }
1560 free(assocEntry);
1561 }
1562
1563
1564 /***************************************************************/
1565
assocEntry_print(AssocEntry * assocEntry)1566 void assocEntry_print(AssocEntry *assocEntry)
1567 {
1568 printf("applIndex: %ld\n",
1569 assocEntry->applIndex);
1570 printf("assocIndex: %ld\n",
1571 assocEntry->assocIndex);
1572 printf("assocRemoteApplication: %s\n",
1573 assocEntry->assocRemoteApplication);
1574 printf("assocApplicationProtocol: %s\n",
1575 SSAOidString(assocEntry->assocApplicationProtocol));
1576 printf("assocApplicationType: %s\n",
1577 assocApplicationType_string(assocEntry->assocApplicationType));
1578 printf("assocDuration: %ld\n",
1579 assocEntry->assocDuration);
1580 printf("\n");
1581 }
1582
1583
1584 /***************************************************************/
1585 /***************************************************************/
1586 /***************************************************************/
1587
1588 int
mtaEntry_send_request(SNMP_session * session,u_char type,int32_t applIndex,char * error_label)1589 mtaEntry_send_request(SNMP_session *session, u_char type, int32_t applIndex, char *error_label)
1590 {
1591 SNMP_pdu *request;
1592 int i;
1593 SNMP_column *column;
1594 Subid subids[100] = { 0 };
1595 Oid oid;
1596 Oid *oidp;
1597
1598
1599 error_label[0] = '\0';
1600
1601 if( (type != GET_REQ_MSG) && (type != GETNEXT_REQ_MSG) )
1602 {
1603 sprintf(error_label, "BUG: mtaEntry_send_request(): bad type (0x%x)", type);
1604 return -1;
1605 }
1606
1607 request = snmp_pdu_new(error_label);
1608 if(request == NULL)
1609 {
1610 return -1;
1611 }
1612 request->type = type;
1613
1614 for(i = 0; i < mtaTable.column_num; i++)
1615 {
1616 column = mtaTable.columns[i];
1617
1618 if(applIndex >= 0)
1619 {
1620 memcpy(subids, column->name->subids, column->name->len*sizeof(Subid));
1621 subids[column->name->len] = applIndex;
1622 oid.len = column->name->len + 1;
1623 oid.subids = subids;
1624 oidp = &oid;
1625 }
1626 else
1627 {
1628 oidp = column->name;
1629 }
1630
1631 if(snmp_pdu_append_null_variable(request, oidp, error_label) == NULL)
1632 {
1633 snmp_pdu_free(request);
1634 return -1;
1635 }
1636 }
1637
1638 if(snmp_session_send(session, MTA_ENTRY_REQ, request, error_label))
1639 {
1640 /* we have to free the request */
1641
1642 snmp_pdu_free(request);
1643 return -1;
1644 }
1645
1646
1647 return 0;
1648 }
1649
1650
1651 /***************************************************************/
1652
1653 /* ARGSUSED */
mtaEntry_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)1654 MtaEntry *mtaEntry_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
1655 {
1656 MtaEntry *mtaEntry;
1657 int32_t applIndex;
1658 SNMP_variable *variable;
1659 uintptr_t pointer;
1660 int i;
1661 SNMP_column *column;
1662
1663
1664 snmp_errno = SNMP_ERR_NOERROR;
1665 error_label[0] = '\0';
1666
1667 if(response == NULL)
1668 {
1669 sprintf(error_label, "BUG: mtaEntry_process_response(): response is NULL");
1670 return NULL;
1671 }
1672
1673 if(response->error_status != SNMP_ERR_NOERROR)
1674 {
1675 sprintf(error_label, ERR_MSG_ERROR_STATUS,
1676 error_status_string(response->error_status),
1677 response->error_index);
1678 snmp_errno = response->error_status;
1679 return NULL;
1680 }
1681
1682 mtaEntry = (MtaEntry *) malloc(sizeof(MtaEntry));
1683 if(mtaEntry == NULL)
1684 {
1685 sprintf(error_label, ERR_MSG_ALLOC);
1686 return NULL;
1687 }
1688 memset(mtaEntry, 0, sizeof(MtaEntry));
1689
1690 pointer = (uintptr_t)&(mtaEntry->mtaReceivedMessages);
1691 variable = response->first_variable;
1692 for(i = 0; i < mtaTable.column_num; i++)
1693 {
1694 column = mtaTable.columns[i];
1695
1696 if(variable == NULL)
1697 {
1698 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
1699 mtaEntry_free(mtaEntry);
1700 return NULL;
1701 }
1702
1703 /* check oid and extract applIndex */
1704 if(extract_one_index_from_column(&(variable->name), column->name, &applIndex))
1705 {
1706 snmp_errno = SNMP_ERR_NOSUCHNAME;
1707 mtaEntry_free(mtaEntry);
1708 return NULL;
1709 }
1710
1711 /* check if all applIndex are equal ??? */
1712 mtaEntry->applIndex = applIndex;
1713
1714 /* check type */
1715 if(variable->type != column->type)
1716 {
1717 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
1718 variable->type, column->label);
1719 mtaEntry_free(mtaEntry);
1720 return NULL;
1721 }
1722
1723 if(translate_variable(variable, column->translator, pointer, error_label))
1724 {
1725 mtaEntry_free(mtaEntry);
1726 return NULL;
1727 }
1728
1729 variable = variable->next_variable;
1730 pointer++;
1731 }
1732
1733
1734 return mtaEntry;
1735 }
1736
1737
1738 /***************************************************************/
1739
mtaEntry_free(MtaEntry * mtaEntry)1740 void mtaEntry_free(MtaEntry *mtaEntry)
1741 {
1742 if(mtaEntry == NULL)
1743 {
1744 return;
1745 }
1746 free(mtaEntry);
1747 }
1748
1749
1750 /***************************************************************/
1751
mtaEntry_print(MtaEntry * mtaEntry)1752 void mtaEntry_print(MtaEntry *mtaEntry)
1753 {
1754 printf("applIndex: %ld\n",
1755 mtaEntry->applIndex);
1756 printf("mtaReceivedMessages: %ld\n",
1757 mtaEntry->mtaReceivedMessages);
1758 printf("mtaStoredMessages: %ld\n",
1759 mtaEntry->mtaStoredMessages);
1760 printf("mtaTransmittedMessages: %ld\n",
1761 mtaEntry->mtaTransmittedMessages);
1762 printf("mtaReceivedVolume: %ld\n",
1763 mtaEntry->mtaReceivedVolume);
1764 printf("mtaStoredVolume: %ld\n",
1765 mtaEntry->mtaStoredVolume);
1766 printf("mtaTransmittedVolume: %ld\n",
1767 mtaEntry->mtaTransmittedVolume);
1768 printf("mtaReceivedRecipients: %ld\n",
1769 mtaEntry->mtaReceivedRecipients);
1770 printf("mtaStoredRecipients: %ld\n",
1771 mtaEntry->mtaStoredRecipients);
1772 printf("mtaTransmittedRecipients: %ld\n",
1773 mtaEntry->mtaTransmittedRecipients);
1774 printf("\n");
1775 }
1776
1777
1778 /***************************************************************/
1779 /***************************************************************/
1780 /***************************************************************/
1781
mtaGroupEntry_send_request(SNMP_session * session,u_char type,int32_t applIndex,int32_t mtaGroupIndex,char * error_label)1782 int mtaGroupEntry_send_request(SNMP_session *session, u_char type, int32_t applIndex, int32_t mtaGroupIndex, char *error_label)
1783 {
1784 SNMP_pdu *request;
1785 int i;
1786 SNMP_column *column;
1787 Subid subids[100] = { 0 };
1788 Oid oid;
1789 Oid *oidp;
1790
1791
1792 error_label[0] = '\0';
1793
1794 if( (type != GET_REQ_MSG) && (type != GETNEXT_REQ_MSG) )
1795 {
1796 sprintf(error_label, "BUG: mtaGroupEntry_send_request(): bad type (0x%x)", type);
1797 return -1;
1798 }
1799
1800 request = snmp_pdu_new(error_label);
1801 if(request == NULL)
1802 {
1803 return -1;
1804 }
1805 request->type = type;
1806
1807 for(i = 0; i < mtaGroupTable.column_num; i++)
1808 {
1809 column = mtaGroupTable.columns[i];
1810
1811 if(applIndex >= 0)
1812 {
1813 memcpy(subids, column->name->subids, column->name->len*sizeof(Subid));
1814 subids[column->name->len] = applIndex;
1815 oid.len = column->name->len + 1;
1816
1817 if(mtaGroupIndex >= 0)
1818 {
1819 subids[column->name->len + 1] = mtaGroupIndex;
1820 oid.len = column->name->len + 2;
1821 }
1822
1823 oid.subids = subids;
1824 oidp = &oid;
1825 }
1826 else
1827 {
1828 oidp = column->name;
1829 }
1830
1831 if(snmp_pdu_append_null_variable(request, oidp, error_label) == NULL)
1832 {
1833 snmp_pdu_free(request);
1834 return -1;
1835 }
1836 }
1837
1838 if(snmp_session_send(session, MTA_GROUP_ENTRY_REQ, request, error_label))
1839 {
1840 /* we have to free the request */
1841
1842 snmp_pdu_free(request);
1843 return -1;
1844 }
1845
1846
1847 return 0;
1848 }
1849
1850
1851 /***************************************************************/
1852
1853 /* ARGSUSED */
mtaGroupEntry_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)1854 MtaGroupEntry *mtaGroupEntry_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
1855 {
1856 MtaGroupEntry *mtaGroupEntry;
1857 int32_t applIndex;
1858 int32_t mtaGroupIndex;
1859 SNMP_variable *variable;
1860 uintptr_t pointer;
1861 int i;
1862 SNMP_column *column;
1863
1864
1865 snmp_errno = SNMP_ERR_NOERROR;
1866 error_label[0] = '\0';
1867
1868 if(response == NULL)
1869 {
1870 sprintf(error_label, "BUG: mtaGroupEntry_process_response(): response is NULL");
1871 return NULL;
1872 }
1873
1874 if(response->error_status != SNMP_ERR_NOERROR)
1875 {
1876 sprintf(error_label, ERR_MSG_ERROR_STATUS,
1877 error_status_string(response->error_status),
1878 response->error_index);
1879 snmp_errno = response->error_status;
1880 return NULL;
1881 }
1882
1883 mtaGroupEntry = (MtaGroupEntry *) malloc(sizeof(MtaGroupEntry));
1884 if(mtaGroupEntry == NULL)
1885 {
1886 sprintf(error_label, ERR_MSG_ALLOC);
1887 return NULL;
1888 }
1889 memset(mtaGroupEntry, 0, sizeof(MtaGroupEntry));
1890
1891 pointer = (uintptr_t)&(mtaGroupEntry->mtaGroupReceivedMessages);
1892 variable = response->first_variable;
1893 for(i = 0; i < mtaGroupTable.column_num; i++)
1894 {
1895 column = mtaGroupTable.columns[i];
1896
1897 if(variable == NULL)
1898 {
1899 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
1900 mtaGroupEntry_free(mtaGroupEntry);
1901 return NULL;
1902 }
1903
1904 /* check oid and extract applIndex and mtaGroupIndex */
1905 if(extract_two_indexes_from_column(&(variable->name), column->name, &applIndex, &mtaGroupIndex))
1906 {
1907 snmp_errno = SNMP_ERR_NOSUCHNAME;
1908 mtaGroupEntry_free(mtaGroupEntry);
1909 return NULL;
1910 }
1911
1912 /* check if all applIndex + mtaGroupIndex are equal ??? */
1913 mtaGroupEntry->applIndex = applIndex;
1914 mtaGroupEntry->mtaGroupIndex = mtaGroupIndex;
1915
1916 /* check type */
1917 if(variable->type != column->type)
1918 {
1919 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
1920 variable->type, column->label);
1921 mtaGroupEntry_free(mtaGroupEntry);
1922 return NULL;
1923 }
1924
1925 if(translate_variable(variable, column->translator, pointer, error_label))
1926 {
1927 mtaGroupEntry_free(mtaGroupEntry);
1928 return NULL;
1929 }
1930
1931 variable = variable->next_variable;
1932 pointer++;
1933 }
1934
1935
1936 return mtaGroupEntry;
1937 }
1938
1939
1940 /***************************************************************/
1941
mtaGroupEntry_free(MtaGroupEntry * mtaGroupEntry)1942 void mtaGroupEntry_free(MtaGroupEntry *mtaGroupEntry)
1943 {
1944 if(mtaGroupEntry == NULL)
1945 {
1946 return;
1947 }
1948
1949 if(mtaGroupEntry->mtaGroupInboundRejectionReason)
1950 {
1951 free(mtaGroupEntry->mtaGroupInboundRejectionReason);
1952 }
1953 if(mtaGroupEntry->mtaGroupOutboundConnectFailureReason)
1954 {
1955 free(mtaGroupEntry->mtaGroupOutboundConnectFailureReason);
1956 }
1957 if(mtaGroupEntry->mtaGroupMailProtocol)
1958 {
1959 SSAOidFree(mtaGroupEntry->mtaGroupMailProtocol);
1960 }
1961 if(mtaGroupEntry->mtaGroupName)
1962 {
1963 free(mtaGroupEntry->mtaGroupName);
1964 }
1965 free(mtaGroupEntry);
1966 }
1967
1968
1969 /***************************************************************/
1970
mtaGroupEntry_print(MtaGroupEntry * mtaGroupEntry)1971 void mtaGroupEntry_print(MtaGroupEntry *mtaGroupEntry)
1972 {
1973 printf("applIndex: %ld\n",
1974 mtaGroupEntry->applIndex);
1975 printf("mtaGroupIndex: %ld\n",
1976 mtaGroupEntry->mtaGroupIndex);
1977 printf("mtaGroupReceivedMessages: %ld\n",
1978 mtaGroupEntry->mtaGroupReceivedMessages);
1979 printf("mtaGroupRejectedMessages: %ld\n",
1980 mtaGroupEntry->mtaGroupRejectedMessages);
1981 printf("mtaGroupStoredMessages: %ld\n",
1982 mtaGroupEntry->mtaGroupStoredMessages);
1983 printf("mtaGroupTransmittedMessages: %ld\n",
1984 mtaGroupEntry->mtaGroupTransmittedMessages);
1985 printf("mtaGroupReceivedVolume: %ld\n",
1986 mtaGroupEntry->mtaGroupReceivedVolume);
1987 printf("mtaGroupStoredVolume: %ld\n",
1988 mtaGroupEntry->mtaGroupStoredVolume);
1989 printf("mtaGroupTransmittedVolume: %ld\n",
1990 mtaGroupEntry->mtaGroupTransmittedVolume);
1991 printf("mtaGroupOldestMessageStored: %ld\n",
1992 mtaGroupEntry->mtaGroupOldestMessageStored);
1993 printf("mtaGroupInboundAssociations: %ld\n",
1994 mtaGroupEntry->mtaGroupInboundAssociations);
1995 printf("mtaGroupOutboundAssociations: %ld\n",
1996 mtaGroupEntry->mtaGroupOutboundAssociations);
1997 printf("mtaGroupAccumulatedInboundAssoc.: %ld\n",
1998 mtaGroupEntry->mtaGroupAccumulatedInboundAssociations);
1999 printf("mtaGroupAccumulatedOutboundAssoc.: %ld\n",
2000 mtaGroupEntry->mtaGroupAccumulatedOutboundAssociations);
2001 printf("mtaGroupLastInboundActivity: %ld\n",
2002 mtaGroupEntry->mtaGroupLastInboundActivity);
2003 printf("mtaGroupLastOutboundActivity: %ld\n",
2004 mtaGroupEntry->mtaGroupLastOutboundActivity);
2005 printf("mtaGroupRejectedInboundAssociations: %ld\n",
2006 mtaGroupEntry->mtaGroupRejectedInboundAssociations);
2007 printf("mtaGroupFailedOutboundAssociations: %ld\n",
2008 mtaGroupEntry->mtaGroupFailedOutboundAssociations);
2009 printf("mtaGroupInboundRejectionReason: %s\n",
2010 mtaGroupEntry->mtaGroupInboundRejectionReason);
2011 printf("mtaGroupOutboundConnectFailureReason: %s\n",
2012 mtaGroupEntry->mtaGroupOutboundConnectFailureReason);
2013 printf("mtaGroupScheduledRetry: %ld\n",
2014 mtaGroupEntry->mtaGroupScheduledRetry);
2015 printf("mtaGroupMailProtocol: %s\n",
2016 SSAOidString(mtaGroupEntry->mtaGroupMailProtocol));
2017 printf("mtaGroupName: %s\n",
2018 mtaGroupEntry->mtaGroupName);
2019 printf("\n");
2020 }
2021
2022
2023 /***************************************************************/
2024 /***************************************************************/
2025 /***************************************************************/
2026
mtaGroupAssociationEntry_send_request(SNMP_session * session,u_char type,int32_t applIndex,int32_t mtaGroupIndex,int32_t mtaGroupAssociationIndex,char * error_label)2027 int mtaGroupAssociationEntry_send_request(SNMP_session *session, u_char type, int32_t applIndex, int32_t mtaGroupIndex, int32_t mtaGroupAssociationIndex, char *error_label)
2028 {
2029 SNMP_pdu *request;
2030 int i;
2031 SNMP_column *column;
2032 Subid subids[100] = { 0 };
2033 Oid oid;
2034 Oid *oidp;
2035
2036
2037 error_label[0] = '\0';
2038
2039 if( (type != GET_REQ_MSG) && (type != GETNEXT_REQ_MSG) )
2040 {
2041 sprintf(error_label, "BUG: mtaGroupAssociationEntry_send_request(): bad type (0x%x)", type);
2042 return -1;
2043 }
2044
2045 request = snmp_pdu_new(error_label);
2046 if(request == NULL)
2047 {
2048 return -1;
2049 }
2050 request->type = type;
2051
2052 for(i = 0; i < mtaGroupAssociationTable.column_num; i++)
2053 {
2054 column = mtaGroupAssociationTable.columns[i];
2055
2056 if(applIndex >= 0)
2057 {
2058 memcpy(subids, column->name->subids, column->name->len*sizeof(Subid));
2059 subids[column->name->len] = applIndex;
2060 oid.len = column->name->len + 1;
2061
2062 if(mtaGroupIndex >= 0)
2063 {
2064 subids[column->name->len + 1] = mtaGroupIndex;
2065 oid.len = column->name->len + 2;
2066
2067 if(mtaGroupAssociationIndex >= 0)
2068 {
2069 subids[column->name->len + 2] = mtaGroupAssociationIndex;
2070 oid.len = column->name->len + 3;
2071 }
2072 }
2073
2074 oid.subids = subids;
2075 oidp = &oid;
2076 }
2077 else
2078 {
2079 oidp = column->name;
2080 }
2081
2082 if(snmp_pdu_append_null_variable(request, oidp, error_label) == NULL)
2083 {
2084 snmp_pdu_free(request);
2085 return -1;
2086 }
2087 }
2088
2089 if(snmp_session_send(session, MTA_GROUP_ASSOCIATION_ENTRY_REQ, request, error_label))
2090 {
2091 /* we have to free the request */
2092
2093 snmp_pdu_free(request);
2094 return -1;
2095 }
2096
2097
2098 return 0;
2099 }
2100
2101
2102 /***************************************************************/
2103
2104 /* ARGSUSED */
mtaGroupAssociationEntry_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)2105 MtaGroupAssociationEntry *mtaGroupAssociationEntry_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
2106 {
2107 MtaGroupAssociationEntry *mtaGroupAssociationEntry;
2108 int32_t applIndex;
2109 int32_t mtaGroupIndex;
2110 int32_t mtaGroupAssociationIndex;
2111 SNMP_variable *variable;
2112 uintptr_t pointer;
2113 int i;
2114 SNMP_column *column;
2115
2116
2117 snmp_errno = SNMP_ERR_NOERROR;
2118 error_label[0] = '\0';
2119
2120 if(response == NULL)
2121 {
2122 sprintf(error_label, "BUG: mtaGroupAssociationEntry_process_response(): response is NULL");
2123 return NULL;
2124 }
2125
2126 if(response->error_status != SNMP_ERR_NOERROR)
2127 {
2128 sprintf(error_label, ERR_MSG_ERROR_STATUS,
2129 error_status_string(response->error_status),
2130 response->error_index);
2131 snmp_errno = response->error_status;
2132 return NULL;
2133 }
2134
2135 mtaGroupAssociationEntry = (MtaGroupAssociationEntry *) malloc(sizeof(MtaGroupAssociationEntry));
2136 if(mtaGroupAssociationEntry == NULL)
2137 {
2138 sprintf(error_label, ERR_MSG_ALLOC);
2139 return NULL;
2140 }
2141 memset(mtaGroupAssociationEntry, 0, sizeof(MtaGroupAssociationEntry));
2142
2143 pointer = (uintptr_t)&(mtaGroupAssociationEntry->mtaGroupAssociationIndex);
2144 variable = response->first_variable;
2145 for(i = 0; i < mtaGroupAssociationTable.column_num; i++)
2146 {
2147 column = mtaGroupAssociationTable.columns[i];
2148
2149 if(variable == NULL)
2150 {
2151 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
2152 mtaGroupAssociationEntry_free(mtaGroupAssociationEntry);
2153 return NULL;
2154 }
2155
2156 /* check oid and extract applIndex and mtaGroupIndex */
2157 if(extract_three_indexes_from_column(&(variable->name), column->name, &applIndex, &mtaGroupIndex, &mtaGroupAssociationIndex))
2158 {
2159 snmp_errno = SNMP_ERR_NOSUCHNAME;
2160 mtaGroupAssociationEntry_free(mtaGroupAssociationEntry);
2161 return NULL;
2162 }
2163
2164 /* check if all applIndex + mtaGroupIndex + mtaGroupAssociationIndex are equal ??? */
2165 mtaGroupAssociationEntry->applIndex = applIndex;
2166 mtaGroupAssociationEntry->mtaGroupIndex = mtaGroupIndex;
2167
2168 /* check type */
2169 if(variable->type != column->type)
2170 {
2171 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
2172 variable->type, column->label);
2173 mtaGroupAssociationEntry_free(mtaGroupAssociationEntry);
2174 return NULL;
2175 }
2176
2177 if(translate_variable(variable, column->translator, pointer, error_label))
2178 {
2179 mtaGroupAssociationEntry_free(mtaGroupAssociationEntry);
2180 return NULL;
2181 }
2182
2183 variable = variable->next_variable;
2184 pointer++;
2185 }
2186
2187
2188 return mtaGroupAssociationEntry;
2189 }
2190
2191
2192 /***************************************************************/
2193
mtaGroupAssociationEntry_free(MtaGroupAssociationEntry * mtaGroupAssociationEntry)2194 void mtaGroupAssociationEntry_free(MtaGroupAssociationEntry *mtaGroupAssociationEntry)
2195 {
2196 if(mtaGroupAssociationEntry == NULL)
2197 {
2198 return;
2199 }
2200
2201 free(mtaGroupAssociationEntry);
2202 }
2203
2204
2205 /***************************************************************/
2206
mtaGroupAssociationEntry_print(MtaGroupAssociationEntry * mtaGroupAssociationEntry)2207 void mtaGroupAssociationEntry_print(MtaGroupAssociationEntry *mtaGroupAssociationEntry)
2208 {
2209 printf("applIndex: %ld\n",
2210 mtaGroupAssociationEntry->applIndex);
2211 printf("mtaGroupIndex: %ld\n",
2212 mtaGroupAssociationEntry->mtaGroupIndex);
2213 printf("mtaGroupAssociationIndex: %ld\n",
2214 mtaGroupAssociationEntry->mtaGroupAssociationIndex);
2215 printf("\n");
2216 }
2217
2218
2219 /***************************************************************/
2220 /***************************************************************/
2221 /***************************************************************/
2222
dsaOpsEntry_send_request(SNMP_session * session,u_char type,int32_t applIndex,char * error_label)2223 int dsaOpsEntry_send_request(SNMP_session *session, u_char type, int32_t applIndex, char *error_label)
2224 {
2225 SNMP_pdu *request;
2226 int i;
2227 SNMP_column *column;
2228 Subid subids[100] = { 0 };
2229 Oid oid;
2230 Oid *oidp;
2231
2232
2233 error_label[0] = '\0';
2234
2235 if( (type != GET_REQ_MSG) && (type != GETNEXT_REQ_MSG) )
2236 {
2237 sprintf(error_label, "BUG: dsaOpsEntry_send_request(): bad type (0x%x)", type);
2238 return -1;
2239 }
2240
2241 request = snmp_pdu_new(error_label);
2242 if(request == NULL)
2243 {
2244 return -1;
2245 }
2246 request->type = type;
2247
2248 for(i = 0; i < dsaOpsTable.column_num; i++)
2249 {
2250 column = dsaOpsTable.columns[i];
2251
2252 if(applIndex >= 0)
2253 {
2254 memcpy(subids, column->name->subids, column->name->len*sizeof(Subid));
2255 subids[column->name->len] = applIndex;
2256 oid.len = column->name->len + 1;
2257 oid.subids = subids;
2258 oidp = &oid;
2259 }
2260 else
2261 {
2262 oidp = column->name;
2263 }
2264
2265 if(snmp_pdu_append_null_variable(request, oidp, error_label) == NULL)
2266 {
2267 snmp_pdu_free(request);
2268 return -1;
2269 }
2270 }
2271
2272 if(snmp_session_send(session, DSA_OPS_ENTRY_REQ, request, error_label))
2273 {
2274 /* we have to free the request */
2275
2276 snmp_pdu_free(request);
2277 return -1;
2278 }
2279
2280
2281 return 0;
2282 }
2283
2284
2285 /***************************************************************/
2286
2287 /* ARGSUSED */
dsaOpsEntry_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)2288 DsaOpsEntry *dsaOpsEntry_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
2289 {
2290 DsaOpsEntry *dsaOpsEntry;
2291 int32_t applIndex;
2292 SNMP_variable *variable;
2293 uintptr_t pointer;
2294 int i;
2295 SNMP_column *column;
2296
2297
2298 snmp_errno = SNMP_ERR_NOERROR;
2299 error_label[0] = '\0';
2300
2301 if(response == NULL)
2302 {
2303 sprintf(error_label, "BUG: dsaOpsEntry_process_response(): response is NULL");
2304 return NULL;
2305 }
2306
2307 if(response->error_status != SNMP_ERR_NOERROR)
2308 {
2309 sprintf(error_label, ERR_MSG_ERROR_STATUS,
2310 error_status_string(response->error_status),
2311 response->error_index);
2312 snmp_errno = response->error_status;
2313 return NULL;
2314 }
2315
2316 dsaOpsEntry = (DsaOpsEntry *) malloc(sizeof(DsaOpsEntry));
2317 if(dsaOpsEntry == NULL)
2318 {
2319 sprintf(error_label, ERR_MSG_ALLOC);
2320 return NULL;
2321 }
2322 memset(dsaOpsEntry, 0, sizeof(dsaOpsEntry));
2323
2324 pointer = (uintptr_t)&(dsaOpsEntry->dsaAnonymousBinds);
2325 variable = response->first_variable;
2326 for(i = 0; i < dsaOpsTable.column_num; i++)
2327 {
2328 column = dsaOpsTable.columns[i];
2329
2330 if(variable == NULL)
2331 {
2332 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
2333 dsaOpsEntry_free(dsaOpsEntry);
2334 return NULL;
2335 }
2336
2337 /* check oid and extract applIndex */
2338 if(extract_one_index_from_column(&(variable->name), column->name, &applIndex))
2339 {
2340 snmp_errno = SNMP_ERR_NOSUCHNAME;
2341 dsaOpsEntry_free(dsaOpsEntry);
2342 return NULL;
2343 }
2344
2345 /* check if all applIndex are equal ??? */
2346 dsaOpsEntry->applIndex = applIndex;
2347
2348 /* check type */
2349 if(variable->type != column->type)
2350 {
2351 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
2352 variable->type, column->label);
2353 dsaOpsEntry_free(dsaOpsEntry);
2354 return NULL;
2355 }
2356
2357 if(translate_variable(variable, column->translator, pointer, error_label))
2358 {
2359 dsaOpsEntry_free(dsaOpsEntry);
2360 return NULL;
2361 }
2362
2363 variable = variable->next_variable;
2364 pointer++;
2365 }
2366
2367
2368 return dsaOpsEntry;
2369 }
2370
2371
2372 /***************************************************************/
2373
dsaOpsEntry_free(DsaOpsEntry * dsaOpsEntry)2374 void dsaOpsEntry_free(DsaOpsEntry *dsaOpsEntry)
2375 {
2376 if(dsaOpsEntry == NULL)
2377 {
2378 return;
2379 }
2380
2381 free(dsaOpsEntry);
2382 }
2383
2384
2385 /***************************************************************/
2386
dsaOpsEntry_print(DsaOpsEntry * dsaOpsEntry)2387 void dsaOpsEntry_print(DsaOpsEntry *dsaOpsEntry)
2388 {
2389 printf("applIndex: %ld\n",
2390 dsaOpsEntry->applIndex);
2391 printf("dsaAnonymousBinds: %ld\n",
2392 dsaOpsEntry->dsaAnonymousBinds);
2393 printf("dsaUnauthBinds: %ld\n",
2394 dsaOpsEntry->dsaUnauthBinds);
2395 printf("dsaSimpleAuthBinds: %ld\n",
2396 dsaOpsEntry->dsaSimpleAuthBinds);
2397 printf("dsaStrongAuthBinds: %ld\n",
2398 dsaOpsEntry->dsaStrongAuthBinds);
2399 printf("dsaBindSecurityErrors: %ld\n",
2400 dsaOpsEntry->dsaBindSecurityErrors);
2401 printf("dsaInOps: %ld\n",
2402 dsaOpsEntry->dsaInOps);
2403 printf("dsaReadOps: %ld\n",
2404 dsaOpsEntry->dsaReadOps);
2405 printf("dsaCompareOps: %ld\n",
2406 dsaOpsEntry->dsaCompareOps);
2407 printf("dsaAddEntryOps: %ld\n",
2408 dsaOpsEntry->dsaAddEntryOps);
2409 printf("dsaRemoveEntryOps: %ld\n",
2410 dsaOpsEntry->dsaRemoveEntryOps);
2411 printf("dsaModifyEntryOps: %ld\n",
2412 dsaOpsEntry->dsaModifyEntryOps);
2413 printf("dsaModifyRDNOps: %ld\n",
2414 dsaOpsEntry->dsaModifyRDNOps);
2415 printf("dsaListOps: %ld\n",
2416 dsaOpsEntry->dsaListOps);
2417 printf("dsaSearchOps: %ld\n",
2418 dsaOpsEntry->dsaSearchOps);
2419 printf("dsaOneLevelSearchOps: %ld\n",
2420 dsaOpsEntry->dsaOneLevelSearchOps);
2421 printf("dsaWholeTreeSearchOps: %ld\n",
2422 dsaOpsEntry->dsaWholeTreeSearchOps);
2423 printf("dsaReferrals: %ld\n",
2424 dsaOpsEntry->dsaReferrals);
2425 printf("dsaChainings: %ld\n",
2426 dsaOpsEntry->dsaChainings);
2427 printf("dsaSecurityErrors: %ld\n",
2428 dsaOpsEntry->dsaSecurityErrors);
2429 printf("dsaErrors: %ld\n",
2430 dsaOpsEntry->dsaErrors);
2431 printf("\n");
2432 }
2433
2434
2435 /***************************************************************/
2436 /***************************************************************/
2437 /***************************************************************/
2438
dsaEntriesEntry_send_request(SNMP_session * session,u_char type,int32_t applIndex,char * error_label)2439 int dsaEntriesEntry_send_request(SNMP_session *session, u_char type, int32_t applIndex, char *error_label)
2440 {
2441 SNMP_pdu *request;
2442 int i;
2443 SNMP_column *column;
2444 Subid subids[100] = { 0 };
2445 Oid oid;
2446 Oid *oidp;
2447
2448
2449 error_label[0] = '\0';
2450
2451 if( (type != GET_REQ_MSG) && (type != GETNEXT_REQ_MSG) )
2452 {
2453 sprintf(error_label, "BUG: dsaEntriesEntry_send_request(): bad type (0x%x)", type);
2454 return -1;
2455 }
2456
2457 request = snmp_pdu_new(error_label);
2458 if(request == NULL)
2459 {
2460 return -1;
2461 }
2462 request->type = type;
2463
2464 for(i = 0; i < dsaEntriesTable.column_num; i++)
2465 {
2466 column = dsaEntriesTable.columns[i];
2467
2468 if(applIndex >= 0)
2469 {
2470 memcpy(subids, column->name->subids, column->name->len*sizeof(Subid));
2471 subids[column->name->len] = applIndex;
2472 oid.len = column->name->len + 1;
2473 oid.subids = subids;
2474 oidp = &oid;
2475 }
2476 else
2477 {
2478 oidp = column->name;
2479 }
2480
2481 if(snmp_pdu_append_null_variable(request, oidp, error_label) == NULL)
2482 {
2483 snmp_pdu_free(request);
2484 return -1;
2485 }
2486 }
2487
2488 if(snmp_session_send(session, DSA_ENTRIES_ENTRY_REQ, request, error_label))
2489 {
2490 /* we have to free the request */
2491
2492 snmp_pdu_free(request);
2493 return -1;
2494 }
2495
2496
2497 return 0;
2498 }
2499
2500
2501 /***************************************************************/
2502
2503 /* ARGSUSED */
dsaEntriesEntry_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)2504 DsaEntriesEntry *dsaEntriesEntry_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
2505 {
2506 DsaEntriesEntry *dsaEntriesEntry;
2507 int32_t applIndex;
2508 SNMP_variable *variable;
2509 uintptr_t pointer;
2510 int i;
2511 SNMP_column *column;
2512
2513
2514 snmp_errno = SNMP_ERR_NOERROR;
2515 error_label[0] = '\0';
2516
2517 if(response == NULL)
2518 {
2519 sprintf(error_label, "BUG: dsaEntriesEntry_process_response(): response is NULL");
2520 return NULL;
2521 }
2522
2523 if(response->error_status != SNMP_ERR_NOERROR)
2524 {
2525 sprintf(error_label, ERR_MSG_ERROR_STATUS,
2526 error_status_string(response->error_status),
2527 response->error_index);
2528 snmp_errno = response->error_status;
2529 return NULL;
2530 }
2531
2532 dsaEntriesEntry = (DsaEntriesEntry *) malloc(sizeof(DsaEntriesEntry));
2533 if(dsaEntriesEntry == NULL)
2534 {
2535 sprintf(error_label, ERR_MSG_ALLOC);
2536 return NULL;
2537 }
2538 memset(dsaEntriesEntry, 0, sizeof(dsaEntriesEntry));
2539
2540 pointer = (uintptr_t)&(dsaEntriesEntry->dsaMasterEntries);
2541 variable = response->first_variable;
2542 for(i = 0; i < dsaEntriesTable.column_num; i++)
2543 {
2544 column = dsaEntriesTable.columns[i];
2545
2546 if(variable == NULL)
2547 {
2548 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
2549 dsaEntriesEntry_free(dsaEntriesEntry);
2550 return NULL;
2551 }
2552
2553 /* check oid and extract applIndex */
2554 if(extract_one_index_from_column(&(variable->name), column->name, &applIndex))
2555 {
2556 snmp_errno = SNMP_ERR_NOSUCHNAME;
2557 dsaEntriesEntry_free(dsaEntriesEntry);
2558 return NULL;
2559 }
2560
2561 /* check if all applIndex are equal ??? */
2562 dsaEntriesEntry->applIndex = applIndex;
2563
2564 /* check type */
2565 if(variable->type != column->type)
2566 {
2567 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
2568 variable->type, column->label);
2569 dsaEntriesEntry_free(dsaEntriesEntry);
2570 return NULL;
2571 }
2572
2573 if(translate_variable(variable, column->translator, pointer, error_label))
2574 {
2575 dsaEntriesEntry_free(dsaEntriesEntry);
2576 return NULL;
2577 }
2578
2579 variable = variable->next_variable;
2580 pointer++;
2581 }
2582
2583
2584 return dsaEntriesEntry;
2585 }
2586
2587
2588 /***************************************************************/
2589
dsaEntriesEntry_free(DsaEntriesEntry * dsaEntriesEntry)2590 void dsaEntriesEntry_free(DsaEntriesEntry *dsaEntriesEntry)
2591 {
2592 if(dsaEntriesEntry == NULL)
2593 {
2594 return;
2595 }
2596
2597 free(dsaEntriesEntry);
2598 }
2599
2600
2601 /***************************************************************/
2602
dsaEntriesEntry_print(DsaEntriesEntry * dsaEntriesEntry)2603 void dsaEntriesEntry_print(DsaEntriesEntry *dsaEntriesEntry)
2604 {
2605 printf("applIndex: %ld\n",
2606 dsaEntriesEntry->applIndex);
2607 printf("dsaMasterEntries: %ld\n",
2608 dsaEntriesEntry->dsaMasterEntries);
2609 printf("dsaCopyEntries: %ld\n",
2610 dsaEntriesEntry->dsaCopyEntries);
2611 printf("dsaCacheEntries: %ld\n",
2612 dsaEntriesEntry->dsaCacheEntries);
2613 printf("dsaCacheHits: %ld\n",
2614 dsaEntriesEntry->dsaCacheHits);
2615 printf("dsaSlaveHits: %ld\n",
2616 dsaEntriesEntry->dsaSlaveHits);
2617 printf("\n");
2618 }
2619
2620
2621 /***************************************************************/
2622 /***************************************************************/
2623 /***************************************************************/
2624
dsaIntEntry_send_request(SNMP_session * session,u_char type,int32_t applIndex,int32_t dsaIntIndex,char * error_label)2625 int dsaIntEntry_send_request(SNMP_session *session, u_char type, int32_t applIndex, int32_t dsaIntIndex, char *error_label)
2626 {
2627 SNMP_pdu *request;
2628 int i;
2629 SNMP_column *column;
2630 Subid subids[100] = { 0 };
2631 Oid oid;
2632 Oid *oidp;
2633
2634
2635 error_label[0] = '\0';
2636
2637 if( (type != GET_REQ_MSG) && (type != GETNEXT_REQ_MSG) )
2638 {
2639 sprintf(error_label, "BUG: dsaIntEntry_send_request(): bad type (0x%x)", type);
2640 return -1;
2641 }
2642
2643 request = snmp_pdu_new(error_label);
2644 if(request == NULL)
2645 {
2646 return -1;
2647 }
2648 request->type = type;
2649
2650 for(i = 0; i < dsaIntTable.column_num; i++)
2651 {
2652 column = dsaIntTable.columns[i];
2653
2654 if(applIndex >= 0)
2655 {
2656 memcpy(subids, column->name->subids, column->name->len*sizeof(Subid));
2657 subids[column->name->len] = applIndex;
2658 oid.len = column->name->len + 1;
2659
2660 if(dsaIntIndex >= 0)
2661 {
2662 subids[column->name->len + 1] = dsaIntIndex;
2663 oid.len = column->name->len + 2;
2664 }
2665
2666 oid.subids = subids;
2667 oidp = &oid;
2668 }
2669 else
2670 {
2671 oidp = column->name;
2672 }
2673
2674 if(snmp_pdu_append_null_variable(request, oidp, error_label) == NULL)
2675 {
2676 snmp_pdu_free(request);
2677 return -1;
2678 }
2679 }
2680
2681 if(snmp_session_send(session, DSA_INT_ENTRY_REQ, request, error_label))
2682 {
2683 /* we have to free the request */
2684
2685 snmp_pdu_free(request);
2686 return -1;
2687 }
2688
2689
2690 return 0;
2691 }
2692
2693
2694 /***************************************************************/
2695
2696 /* ARGSUSED */
dsaIntEntry_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)2697 DsaIntEntry *dsaIntEntry_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
2698 {
2699 DsaIntEntry *dsaIntEntry;
2700 int32_t applIndex;
2701 int32_t dsaIntIndex;
2702 SNMP_variable *variable;
2703 uintptr_t pointer;
2704 int i;
2705 SNMP_column *column;
2706
2707
2708 snmp_errno = SNMP_ERR_NOERROR;
2709 error_label[0] = '\0';
2710
2711 if(response == NULL)
2712 {
2713 sprintf(error_label, "BUG: dsaIntEntry_process_response(): response is NULL");
2714 return NULL;
2715 }
2716
2717 if(response->error_status != SNMP_ERR_NOERROR)
2718 {
2719 sprintf(error_label, ERR_MSG_ERROR_STATUS,
2720 error_status_string(response->error_status),
2721 response->error_index);
2722 snmp_errno = response->error_status;
2723 return NULL;
2724 }
2725
2726 dsaIntEntry = (DsaIntEntry *) malloc(sizeof(DsaIntEntry));
2727 if(dsaIntEntry == NULL)
2728 {
2729 sprintf(error_label, ERR_MSG_ALLOC);
2730 return NULL;
2731 }
2732 memset(dsaIntEntry, 0, sizeof(DsaIntEntry));
2733
2734 pointer = (uintptr_t)&(dsaIntEntry->dsaName);
2735 variable = response->first_variable;
2736 for(i = 0; i < dsaIntTable.column_num; i++)
2737 {
2738 column = dsaIntTable.columns[i];
2739
2740 if(variable == NULL)
2741 {
2742 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
2743 dsaIntEntry_free(dsaIntEntry);
2744 return NULL;
2745 }
2746
2747 /* check oid and extract applIndex and mtaGroupIndex */
2748 if(extract_two_indexes_from_column(&(variable->name), column->name, &applIndex, &dsaIntIndex))
2749 {
2750 snmp_errno = SNMP_ERR_NOSUCHNAME;
2751 dsaIntEntry_free(dsaIntEntry);
2752 return NULL;
2753 }
2754
2755 /* check if all applIndex + dsaIntIndex are equal ??? */
2756 dsaIntEntry->applIndex = applIndex;
2757 dsaIntEntry->dsaIntIndex = dsaIntIndex;
2758
2759 /* check type */
2760 if(variable->type != column->type)
2761 {
2762 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
2763 variable->type, column->label);
2764 dsaIntEntry_free(dsaIntEntry);
2765 return NULL;
2766 }
2767
2768 if(translate_variable(variable, column->translator, pointer, error_label))
2769 {
2770 dsaIntEntry_free(dsaIntEntry);
2771 return NULL;
2772 }
2773
2774 variable = variable->next_variable;
2775 pointer++;
2776 }
2777
2778
2779 return dsaIntEntry;
2780 }
2781
2782
2783 /***************************************************************/
2784
dsaIntEntry_free(DsaIntEntry * dsaIntEntry)2785 void dsaIntEntry_free(DsaIntEntry *dsaIntEntry)
2786 {
2787 if(dsaIntEntry == NULL)
2788 {
2789 return;
2790 }
2791
2792 if(dsaIntEntry->dsaName)
2793 {
2794 free(dsaIntEntry->dsaName);
2795 }
2796 free(dsaIntEntry);
2797 }
2798
2799
2800 /***************************************************************/
2801
dsaIntEntry_print(DsaIntEntry * dsaIntEntry)2802 void dsaIntEntry_print(DsaIntEntry *dsaIntEntry)
2803 {
2804 printf("applIndex: %ld\n",
2805 dsaIntEntry->applIndex);
2806 printf("dsaIntIndex: %ld\n",
2807 dsaIntEntry->dsaIntIndex);
2808 printf("dsaName: %s\n",
2809 dsaIntEntry->dsaName);
2810 printf("dsaTimeOfCreation: %s\n",
2811 dsaIntEntry->dsaTimeOfCreation);
2812 printf("dsaTimeOfLastAttempt: %ld\n",
2813 dsaIntEntry->dsaTimeOfLastAttempt);
2814 printf("dsaTimeOfLastSuccess: %ld\n",
2815 dsaIntEntry->dsaTimeOfLastSuccess);
2816 printf("dsaFailuresSinceLastSuccess: %ld\n",
2817 dsaIntEntry->dsaFailuresSinceLastSuccess);
2818 printf("dsaFailures: %ld\n",
2819 dsaIntEntry->dsaFailures);
2820 printf("dsaSuccesses: %ld\n",
2821 dsaIntEntry->dsaSuccesses);
2822 printf("\n");
2823 }
2824
2825
2826 /***************************************************************/
2827 /***************************************************************/
2828 /***************************************************************/
2829
x4msMtaEntry_send_request(SNMP_session * session,u_char type,int32_t x4msMtaIndex,char * error_label)2830 int x4msMtaEntry_send_request(SNMP_session *session, u_char type, int32_t x4msMtaIndex, char *error_label)
2831 {
2832 SNMP_pdu *request;
2833 int i;
2834 SNMP_column *column;
2835 Subid subids[100] = { 0 };
2836 Oid oid;
2837 Oid *oidp;
2838
2839
2840 error_label[0] = '\0';
2841
2842 if( (type != GET_REQ_MSG) && (type != GETNEXT_REQ_MSG) )
2843 {
2844 sprintf(error_label, "BUG: x4msMtaEntry_send_request(): bad type (0x%x)", type);
2845 return -1;
2846 }
2847
2848 request = snmp_pdu_new(error_label);
2849 if(request == NULL)
2850 {
2851 return -1;
2852 }
2853 request->type = type;
2854
2855 for(i = 0; i < x4msMtaTable.column_num; i++)
2856 {
2857 column = x4msMtaTable.columns[i];
2858
2859 if(x4msMtaIndex >= 0)
2860 {
2861 memcpy(subids, column->name->subids, column->name->len*sizeof(Subid));
2862 subids[column->name->len] = x4msMtaIndex;
2863 oid.len = column->name->len + 1;
2864 oid.subids = subids;
2865 oidp = &oid;
2866 }
2867 else
2868 {
2869 oidp = column->name;
2870 }
2871
2872 if(snmp_pdu_append_null_variable(request, oidp, error_label) == NULL)
2873 {
2874 snmp_pdu_free(request);
2875 return -1;
2876 }
2877 }
2878
2879 if(snmp_session_send(session, X4MS_MTA_ENTRY_REQ, request, error_label))
2880 {
2881 /* we have to free the request */
2882
2883 snmp_pdu_free(request);
2884 return -1;
2885 }
2886
2887
2888 return 0;
2889 }
2890
2891
2892 /***************************************************************/
2893
2894 /* ARGSUSED */
x4msMtaEntry_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)2895 X4msMtaEntry *x4msMtaEntry_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
2896 {
2897 X4msMtaEntry *x4msMtaEntry;
2898 int32_t x4msMtaIndex;
2899 SNMP_variable *variable;
2900 uintptr_t pointer;
2901 int i;
2902 SNMP_column *column;
2903
2904
2905 snmp_errno = SNMP_ERR_NOERROR;
2906 error_label[0] = '\0';
2907
2908 if(response == NULL)
2909 {
2910 sprintf(error_label, "BUG: x4msMtaEntry_process_response(): response is NULL");
2911 return NULL;
2912 }
2913
2914 if(response->error_status != SNMP_ERR_NOERROR)
2915 {
2916 sprintf(error_label, ERR_MSG_ERROR_STATUS,
2917 error_status_string(response->error_status),
2918 response->error_index);
2919 snmp_errno = response->error_status;
2920 return NULL;
2921 }
2922
2923 x4msMtaEntry = (X4msMtaEntry *) malloc(sizeof(X4msMtaEntry));
2924 if(x4msMtaEntry == NULL)
2925 {
2926 sprintf(error_label, ERR_MSG_ALLOC);
2927 return NULL;
2928 }
2929 memset(x4msMtaEntry, 0, sizeof(X4msMtaEntry));
2930
2931 pointer = (uintptr_t)&(x4msMtaEntry->x4msMtaName);
2932 variable = response->first_variable;
2933 for(i = 0; i < x4msMtaTable.column_num; i++)
2934 {
2935 column = x4msMtaTable.columns[i];
2936
2937 if(variable == NULL)
2938 {
2939 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
2940 x4msMtaEntry_free(x4msMtaEntry);
2941 return NULL;
2942 }
2943
2944 /* check oid and extract x4msMtaIndex */
2945 if(extract_one_index_from_column(&(variable->name), column->name, &x4msMtaIndex))
2946 {
2947 snmp_errno = SNMP_ERR_NOSUCHNAME;
2948 x4msMtaEntry_free(x4msMtaEntry);
2949 return NULL;
2950 }
2951
2952 /* check if all x4msMtaIndex are equal ??? */
2953 x4msMtaEntry->x4msMtaIndex = x4msMtaIndex;
2954
2955 /* check type */
2956 if(variable->type != column->type)
2957 {
2958 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
2959 variable->type, column->label);
2960 x4msMtaEntry_free(x4msMtaEntry);
2961 return NULL;
2962 }
2963
2964 if(translate_variable(variable, column->translator, pointer, error_label))
2965 {
2966 x4msMtaEntry_free(x4msMtaEntry);
2967 return NULL;
2968 }
2969
2970 variable = variable->next_variable;
2971 pointer++;
2972 }
2973
2974
2975 return x4msMtaEntry;
2976 }
2977
2978
2979 /***************************************************************/
2980
x4msMtaEntry_free(X4msMtaEntry * x4msMtaEntry)2981 void x4msMtaEntry_free(X4msMtaEntry *x4msMtaEntry)
2982 {
2983 if(x4msMtaEntry == NULL)
2984 {
2985 return;
2986 }
2987
2988 if(x4msMtaEntry->x4msMtaName)
2989 {
2990 free(x4msMtaEntry->x4msMtaName);
2991 }
2992 free(x4msMtaEntry);
2993 }
2994
2995
2996 /***************************************************************/
2997
x4msMtaEntry_print(X4msMtaEntry * x4msMtaEntry)2998 void x4msMtaEntry_print(X4msMtaEntry *x4msMtaEntry)
2999 {
3000 printf("x4msMtaIndex: %ld\n",
3001 x4msMtaEntry->x4msMtaIndex);
3002 printf("x4msMtaName %s\n",
3003 x4msMtaEntry->x4msMtaName);
3004 printf("\n");
3005 }
3006
3007
3008 /***************************************************************/
3009 /***************************************************************/
3010
x4msUserEntryPart1_send_request(SNMP_session * session,u_char type,int32_t x4msUserIndex,char * error_label)3011 int x4msUserEntryPart1_send_request(SNMP_session *session, u_char type, int32_t x4msUserIndex, char *error_label)
3012 {
3013 SNMP_pdu *request;
3014 int i;
3015 SNMP_column *column;
3016 Subid subids[100] = { 0 };
3017 Oid oid;
3018 Oid *oidp;
3019
3020
3021 error_label[0] = '\0';
3022
3023 if( (type != GET_REQ_MSG) && (type != GETNEXT_REQ_MSG) )
3024 {
3025 sprintf(error_label, "BUG: x4msUserEntryPart1_send_request(): bad type (0x%x)", type);
3026 return -1;
3027 }
3028
3029 request = snmp_pdu_new(error_label);
3030 if(request == NULL)
3031 {
3032 return -1;
3033 }
3034 request->type = type;
3035
3036 for(i = 0; i < x4msUserTablePart1.column_num; i++)
3037 {
3038 column = x4msUserTablePart1.columns[i];
3039
3040 if(x4msUserIndex >= 0)
3041 {
3042 memcpy(subids, column->name->subids, column->name->len*sizeof(Subid));
3043 subids[column->name->len] = x4msUserIndex;
3044 oid.len = column->name->len + 1;
3045 oid.subids = subids;
3046 oidp = &oid;
3047 }
3048 else
3049 {
3050 oidp = column->name;
3051 }
3052
3053 if(snmp_pdu_append_null_variable(request, oidp, error_label) == NULL)
3054 {
3055 snmp_pdu_free(request);
3056 return -1;
3057 }
3058 }
3059
3060 if(snmp_session_send(session, X4MS_USER_ENTRY_PART1_REQ, request, error_label))
3061 {
3062 /* we have to free the request */
3063
3064 snmp_pdu_free(request);
3065 return -1;
3066 }
3067
3068
3069 return 0;
3070 }
3071
3072
3073 /***************************************************************/
3074
3075 /* ARGSUSED */
x4msUserEntryPart1_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)3076 X4msUserEntryPart1 *x4msUserEntryPart1_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
3077 {
3078 X4msUserEntryPart1 *x4msUserEntryPart1;
3079 int32_t x4msUserIndex;
3080 SNMP_variable *variable;
3081 uintptr_t pointer;
3082 int i;
3083 SNMP_column *column;
3084
3085
3086 snmp_errno = SNMP_ERR_NOERROR;
3087 error_label[0] = '\0';
3088
3089 if(response == NULL)
3090 {
3091 sprintf(error_label, "BUG: x4msUserEntryPart1_process_response(): response is NULL");
3092 return NULL;
3093 }
3094
3095 if(response->error_status != SNMP_ERR_NOERROR)
3096 {
3097 sprintf(error_label, ERR_MSG_ERROR_STATUS,
3098 error_status_string(response->error_status),
3099 response->error_index);
3100 snmp_errno = response->error_status;
3101 return NULL;
3102 }
3103
3104 x4msUserEntryPart1 = (X4msUserEntryPart1 *) malloc(sizeof(X4msUserEntryPart1));
3105 if(x4msUserEntryPart1 == NULL)
3106 {
3107 sprintf(error_label, ERR_MSG_ALLOC);
3108 return NULL;
3109 }
3110 memset(x4msUserEntryPart1, 0, sizeof(X4msUserEntryPart1));
3111
3112 pointer = (uintptr_t) &(x4msUserEntryPart1->x4msUserTotalMessages);
3113 variable = response->first_variable;
3114 for(i = 0; i < x4msUserTablePart1.column_num; i++)
3115 {
3116 column = x4msUserTablePart1.columns[i];
3117
3118 if(variable == NULL)
3119 {
3120 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
3121 x4msUserEntryPart1_free(x4msUserEntryPart1);
3122 return NULL;
3123 }
3124
3125 /* check oid and extract x4msMtaIndex */
3126 if(extract_one_index_from_column(&(variable->name), column->name, &x4msUserIndex))
3127 {
3128 snmp_errno = SNMP_ERR_NOSUCHNAME;
3129 x4msUserEntryPart1_free(x4msUserEntryPart1);
3130 return NULL;
3131 }
3132
3133 /* check if all x4msUserIndex are equal ??? */
3134 x4msUserEntryPart1->x4msUserIndex = x4msUserIndex;
3135
3136 /* check type */
3137 if(variable->type != column->type)
3138 {
3139 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
3140 variable->type, column->label);
3141 x4msUserEntryPart1_free(x4msUserEntryPart1);
3142 return NULL;
3143 }
3144
3145 if(translate_variable(variable, column->translator, pointer, error_label))
3146 {
3147 x4msUserEntryPart1_free(x4msUserEntryPart1);
3148 return NULL;
3149 }
3150
3151 variable = variable->next_variable;
3152 pointer++;
3153 }
3154
3155
3156 return x4msUserEntryPart1;
3157 }
3158
3159
3160 /***************************************************************/
3161
x4msUserEntryPart1_free(X4msUserEntryPart1 * x4msUserEntryPart1)3162 void x4msUserEntryPart1_free(X4msUserEntryPart1 *x4msUserEntryPart1)
3163 {
3164 if(x4msUserEntryPart1 == NULL)
3165 {
3166 return;
3167 }
3168
3169 if(x4msUserEntryPart1->x4msUserAuthentificationFailureReason)
3170 {
3171 free(x4msUserEntryPart1->x4msUserAuthentificationFailureReason);
3172 }
3173 if(x4msUserEntryPart1->x4msUserName)
3174 {
3175 free(x4msUserEntryPart1->x4msUserName);
3176 }
3177 free(x4msUserEntryPart1);
3178 }
3179
3180
3181 /***************************************************************/
3182
x4msUserEntryPart1_print(X4msUserEntryPart1 * x4msUserEntryPart1)3183 void x4msUserEntryPart1_print(X4msUserEntryPart1 *x4msUserEntryPart1)
3184 {
3185 printf("x4msUserIndex: %ld\n",
3186 x4msUserEntryPart1->x4msUserIndex);
3187 printf("x4msUserTotalMessages: %ld\n",
3188 x4msUserEntryPart1->x4msUserTotalMessages);
3189 printf("x4msUserTotalVolume: %ld\n",
3190 x4msUserEntryPart1->x4msUserTotalVolume);
3191 printf("x4msUserP3Associations: %ld\n",
3192 x4msUserEntryPart1->x4msUserP3Associations);
3193 printf("x4msUserP7Associations: %ld\n",
3194 x4msUserEntryPart1->x4msUserP7Associations);
3195 printf("x4msUserLastP7Association: %ld\n",
3196 x4msUserEntryPart1->x4msUserLastP7Association);
3197 printf("x4msUserAuthentificationFailures: %ld\n",
3198 x4msUserEntryPart1->x4msUserAuthentificationFailures);
3199 printf("x4msUserAuthentificationFailureReason:%s\n",
3200 x4msUserEntryPart1->x4msUserAuthentificationFailureReason);
3201 printf("x4msUserName: %s\n",
3202 x4msUserEntryPart1->x4msUserName);
3203 printf("\n");
3204 }
3205
3206
3207 /***************************************************************/
3208 /***************************************************************/
3209
x4msUserEntryPart2_send_request(SNMP_session * session,u_char type,int32_t x4msUserIndex,char * error_label)3210 int x4msUserEntryPart2_send_request(SNMP_session *session, u_char type, int32_t x4msUserIndex, char *error_label)
3211 {
3212 SNMP_pdu *request;
3213 int i;
3214 SNMP_column *column;
3215 Subid subids[100] = { 0 };
3216 Oid oid;
3217 Oid *oidp;
3218
3219
3220 error_label[0] = '\0';
3221
3222 if( (type != GET_REQ_MSG) && (type != GETNEXT_REQ_MSG) )
3223 {
3224 sprintf(error_label, "BUG: x4msUserEntryPart2_send_request(): bad type (0x%x)", type);
3225 return -1;
3226 }
3227
3228 request = snmp_pdu_new(error_label);
3229 if(request == NULL)
3230 {
3231 return -1;
3232 }
3233 request->type = type;
3234
3235 for(i = 0; i < x4msUserTablePart2.column_num; i++)
3236 {
3237 column = x4msUserTablePart2.columns[i];
3238
3239 if(x4msUserIndex >= 0)
3240 {
3241 memcpy(subids, column->name->subids, column->name->len*sizeof(Subid));
3242 subids[column->name->len] = x4msUserIndex;
3243 oid.len = column->name->len + 1;
3244 oid.subids = subids;
3245 oidp = &oid;
3246 }
3247 else
3248 {
3249 oidp = column->name;
3250 }
3251
3252 if(snmp_pdu_append_null_variable(request, oidp, error_label) == NULL)
3253 {
3254 snmp_pdu_free(request);
3255 return -1;
3256 }
3257 }
3258
3259 if(snmp_session_send(session, X4MS_USER_ENTRY_PART2_REQ, request, error_label))
3260 {
3261 /* we have to free the request */
3262
3263 snmp_pdu_free(request);
3264 return -1;
3265 }
3266
3267
3268 return 0;
3269 }
3270
3271 /* ARGSUSED */
x4msUserEntryPart2_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)3272 X4msUserEntryPart2 *x4msUserEntryPart2_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
3273 {
3274 X4msUserEntryPart2 *x4msUserEntryPart2;
3275 int32_t x4msUserIndex;
3276 SNMP_variable *variable;
3277 uintptr_t pointer;
3278 int i;
3279 SNMP_column *column;
3280
3281
3282 snmp_errno = SNMP_ERR_NOERROR;
3283 error_label[0] = '\0';
3284
3285 if(response == NULL)
3286 {
3287 sprintf(error_label, "BUG: x4msUserEntryPart2_process_response(): response is NULL");
3288 return NULL;
3289 }
3290
3291 if(response->error_status != SNMP_ERR_NOERROR)
3292 {
3293 sprintf(error_label, ERR_MSG_ERROR_STATUS,
3294 error_status_string(response->error_status),
3295 response->error_index);
3296 snmp_errno = response->error_status;
3297 return NULL;
3298 }
3299
3300 x4msUserEntryPart2 = (X4msUserEntryPart2 *) malloc(sizeof(X4msUserEntryPart2));
3301 if(x4msUserEntryPart2 == NULL)
3302 {
3303 sprintf(error_label, ERR_MSG_ALLOC);
3304 return NULL;
3305 }
3306 memset(x4msUserEntryPart2, 0, sizeof(X4msUserEntryPart2));
3307
3308 pointer = (uintptr_t) &(x4msUserEntryPart2->x4msUserNewMessages);
3309 variable = response->first_variable;
3310 for(i = 0; i < x4msUserTablePart2.column_num; i++)
3311 {
3312 column = x4msUserTablePart2.columns[i];
3313
3314 if(variable == NULL)
3315 {
3316 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
3317 x4msUserEntryPart2_free(x4msUserEntryPart2);
3318 return NULL;
3319 }
3320
3321 /* check oid and extract x4msUserIndex */
3322 if(extract_one_index_from_column(&(variable->name), column->name, &x4msUserIndex))
3323 {
3324 snmp_errno = SNMP_ERR_NOSUCHNAME;
3325 x4msUserEntryPart2_free(x4msUserEntryPart2);
3326 return NULL;
3327 }
3328
3329 /* check if all x4msUserIndex are equal ??? */
3330 x4msUserEntryPart2->x4msUserIndex = x4msUserIndex;
3331
3332 /* check type */
3333 if(variable->type != column->type)
3334 {
3335 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
3336 variable->type, column->label);
3337 x4msUserEntryPart2_free(x4msUserEntryPart2);
3338 return NULL;
3339 }
3340
3341 if(translate_variable(variable, column->translator, pointer, error_label))
3342 {
3343 x4msUserEntryPart2_free(x4msUserEntryPart2);
3344 return NULL;
3345 }
3346
3347 variable = variable->next_variable;
3348 pointer++;
3349 }
3350
3351
3352 return x4msUserEntryPart2;
3353 }
3354
3355
3356 /***************************************************************/
3357
x4msUserEntryPart2_free(X4msUserEntryPart2 * x4msUserEntryPart2)3358 void x4msUserEntryPart2_free(X4msUserEntryPart2 *x4msUserEntryPart2)
3359 {
3360 if(x4msUserEntryPart2 == NULL)
3361 {
3362 return;
3363 }
3364
3365 if(x4msUserEntryPart2->x4msUserP3InboundRejectionReason)
3366 {
3367 free(x4msUserEntryPart2->x4msUserP3InboundRejectionReason);
3368 }
3369 if(x4msUserEntryPart2->x4msUserP7InboundRejectionReason)
3370 {
3371 free(x4msUserEntryPart2->x4msUserP7InboundRejectionReason);
3372 }
3373 if(x4msUserEntryPart2->x4msUserP3OutboundConnectFailureReason)
3374 {
3375 free(x4msUserEntryPart2->x4msUserP3OutboundConnectFailureReason);
3376 }
3377 if(x4msUserEntryPart2->x4msUserORName)
3378 {
3379 free(x4msUserEntryPart2->x4msUserORName);
3380 }
3381 free(x4msUserEntryPart2);
3382 }
3383
3384
3385 /***************************************************************/
3386
x4msUserEntryPart2_print(X4msUserEntryPart2 * x4msUserEntryPart2)3387 void x4msUserEntryPart2_print(X4msUserEntryPart2 *x4msUserEntryPart2)
3388 {
3389 printf("x4msUserIndex: %ld\n",
3390 x4msUserEntryPart2->x4msUserIndex);
3391 printf("x4msUserNewMessages: %ld\n",
3392 x4msUserEntryPart2->x4msUserNewMessages);
3393 printf("x4msUserNewVolume: %ld\n",
3394 x4msUserEntryPart2->x4msUserNewVolume);
3395 printf("x4msUserListedMessages: %ld\n",
3396 x4msUserEntryPart2->x4msUserListedMessages);
3397 printf("x4msUserListedVolume: %ld\n",
3398 x4msUserEntryPart2->x4msUserListedVolume);
3399 printf("x4msUserProcessedMessages: %ld\n",
3400 x4msUserEntryPart2->x4msUserProcessedMessages);
3401 printf("x4msUserProcessedVolume: %ld\n",
3402 x4msUserEntryPart2->x4msUserProcessedVolume);
3403 printf("x4msUserMessagesOlderThanWeek: %ld\n",
3404 x4msUserEntryPart2->x4msUserMessagesOlderThanWeek);
3405 printf("x4msUserVolumeOlderThanWeek: %ld\n",
3406 x4msUserEntryPart2->x4msUserVolumeOlderThanWeek);
3407 printf("x4msUserMessagesOlderThanMonth: %ld\n",
3408 x4msUserEntryPart2->x4msUserMessagesOlderThanMonth);
3409 printf("x4msUserVolumeOlderThanMonth: %ld\n",
3410 x4msUserEntryPart2->x4msUserVolumeOlderThanMonth);
3411 printf("x4msUserMessagesOlderThanYear: %ld\n",
3412 x4msUserEntryPart2->x4msUserMessagesOlderThanYear);
3413 printf("x4msUserP3InboundAssociations: %ld\n",
3414 x4msUserEntryPart2->x4msUserP3InboundAssociations);
3415 printf("x4msUserP7InboundAssociations: %ld\n",
3416 x4msUserEntryPart2->x4msUserP7InboundAssociations);
3417 printf("x4msUserP3OutboundAssociations: %ld\n",
3418 x4msUserEntryPart2->x4msUserP3OutboundAssociations);
3419 printf("x4msUserAccumulatedP3InboundAssoc.: %ld\n",
3420 x4msUserEntryPart2->x4msUserAccumulatedP3InboundAssociations);
3421 printf("x4msUserAccumulatedP7InboundAssoc.: %ld\n",
3422 x4msUserEntryPart2->x4msUserAccumulatedP7InboundAssociations);
3423 printf("x4msUserAccumulatedP3OutboundAssoc.: %ld\n",
3424 x4msUserEntryPart2->x4msUserAccumulatedP3OutboundAssociations);
3425 printf("x4msUserLastP3InboundActivity: %ld\n",
3426 x4msUserEntryPart2->x4msUserLastP3InboundActivity);
3427 printf("x4msUserLastP7InboundActivity: %ld\n",
3428 x4msUserEntryPart2->x4msUserLastP7InboundActivity);
3429 printf("x4msUserLastP3OutboundActivity: %ld\n",
3430 x4msUserEntryPart2->x4msUserLastP3OutboundActivity);
3431 printf("x4msUserRejectedP3InboundAssoc.: %ld\n",
3432 x4msUserEntryPart2->x4msUserRejectedP3InboundAssociations);
3433 printf("x4msUserRejectedP7InboundAssoc.: %ld\n",
3434 x4msUserEntryPart2->x4msUserRejectedP7InboundAssociations);
3435 printf("x4msUserFailedP3OutboundAssociations: %ld\n",
3436 x4msUserEntryPart2->x4msUserFailedP3OutboundAssociations);
3437 printf("x4msUserP3InboundRejectionReason: %s\n",
3438 x4msUserEntryPart2->x4msUserP3InboundRejectionReason);
3439 printf("x4msUserP7InboundRejectionReason: %s\n",
3440 x4msUserEntryPart2->x4msUserP7InboundRejectionReason);
3441 printf("x4msUserP3OutboundConnectFailureRea.: %s\n",
3442 x4msUserEntryPart2->x4msUserP3OutboundConnectFailureReason);
3443 printf("x4msUserMtaIndex: %ld\n",
3444 x4msUserEntryPart2->x4msUserMtaIndex);
3445 printf("x4msUserORName: %s\n",
3446 x4msUserEntryPart2->x4msUserORName);
3447 printf("\n");
3448 }
3449
3450
3451 /***************************************************************/
3452 /***************************************************************/
3453
x4msUserAssociationEntry_send_request(SNMP_session * session,u_char type,int32_t x4msUserIndex,int32_t x4msUserAssociationIndex,char * error_label)3454 int x4msUserAssociationEntry_send_request(SNMP_session *session, u_char type, int32_t x4msUserIndex, int32_t x4msUserAssociationIndex, char *error_label)
3455 {
3456 SNMP_pdu *request;
3457 int i;
3458 SNMP_column *column;
3459 Subid subids[100] = { 0 };
3460 Oid oid;
3461 Oid *oidp;
3462
3463
3464 error_label[0] = '\0';
3465
3466 if( (type != GET_REQ_MSG) && (type != GETNEXT_REQ_MSG) )
3467 {
3468 sprintf(error_label, "BUG: x4msUserAssociationEntry_send_request(): bad type (0x%x)", type);
3469 return -1;
3470 }
3471
3472 request = snmp_pdu_new(error_label);
3473 if(request == NULL)
3474 {
3475 return -1;
3476 }
3477 request->type = type;
3478
3479 for(i = 0; i < x4msUserAssociationTable.column_num; i++)
3480 {
3481 column = x4msUserAssociationTable.columns[i];
3482
3483 if(x4msUserIndex >= 0)
3484 {
3485 memcpy(subids, column->name->subids, column->name->len*sizeof(Subid));
3486 subids[column->name->len] = x4msUserIndex;
3487 oid.len = column->name->len + 1;
3488
3489 if(x4msUserAssociationIndex >= 0)
3490 {
3491 subids[column->name->len + 1] = x4msUserAssociationIndex;
3492 oid.len = column->name->len + 2;
3493 }
3494
3495 oid.subids = subids;
3496 oidp = &oid;
3497 }
3498 else
3499 {
3500 oidp = column->name;
3501 }
3502
3503 if(snmp_pdu_append_null_variable(request, oidp, error_label) == NULL)
3504 {
3505 snmp_pdu_free(request);
3506 return -1;
3507 }
3508 }
3509
3510 if(snmp_session_send(session, X4MS_USER_ASSOCIATION_ENTRY_REQ, request, error_label))
3511 {
3512 /* we have to free the request */
3513
3514 snmp_pdu_free(request);
3515 return -1;
3516 }
3517
3518
3519 return 0;
3520 }
3521
3522 /* ARGSUSED */
x4msUserAssociationEntry_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)3523 X4msUserAssociationEntry *x4msUserAssociationEntry_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
3524 {
3525 X4msUserAssociationEntry *x4msUserAssociationEntry;
3526 int32_t x4msUserIndex;
3527 int32_t x4msUserAssociationIndex;
3528 SNMP_variable *variable;
3529 uintptr_t pointer;
3530 int i;
3531 SNMP_column *column;
3532
3533
3534 snmp_errno = SNMP_ERR_NOERROR;
3535 error_label[0] = '\0';
3536
3537 if(response == NULL)
3538 {
3539 sprintf(error_label, "BUG: x4msUserAssociationEntry_process_response(): response is NULL");
3540 return NULL;
3541 }
3542
3543 if(response->error_status != SNMP_ERR_NOERROR)
3544 {
3545 sprintf(error_label, ERR_MSG_ERROR_STATUS,
3546 error_status_string(response->error_status),
3547 response->error_index);
3548 snmp_errno = response->error_status;
3549 return NULL;
3550 }
3551
3552 x4msUserAssociationEntry = (X4msUserAssociationEntry *) malloc(sizeof(X4msUserAssociationEntry));
3553 if(x4msUserAssociationEntry == NULL)
3554 {
3555 sprintf(error_label, ERR_MSG_ALLOC);
3556 return NULL;
3557 }
3558 memset(x4msUserAssociationEntry, 0, sizeof(X4msUserAssociationEntry));
3559
3560 pointer = (uintptr_t) &(x4msUserAssociationEntry->x4msUserAssociationIndex);
3561 variable = response->first_variable;
3562 for(i = 0; i < x4msUserAssociationTable.column_num; i++)
3563 {
3564 column = x4msUserAssociationTable.columns[i];
3565
3566 if(variable == NULL)
3567 {
3568 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
3569 x4msUserAssociationEntry_free(x4msUserAssociationEntry);
3570 return NULL;
3571 }
3572
3573 /* check oid and extract x4msUserIndex and x4msUserAssociationIndex */
3574 if(extract_two_indexes_from_column(&(variable->name), column->name, &x4msUserIndex, &x4msUserAssociationIndex))
3575 {
3576 snmp_errno = SNMP_ERR_NOSUCHNAME;
3577 x4msUserAssociationEntry_free(x4msUserAssociationEntry);
3578 return NULL;
3579 }
3580
3581 /* check if all x4msUserIndex are equal ??? */
3582 x4msUserAssociationEntry->x4msUserIndex = x4msUserIndex;
3583
3584 /* check type */
3585 if(variable->type != column->type)
3586 {
3587 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
3588 variable->type, column->label);
3589 x4msUserAssociationEntry_free(x4msUserAssociationEntry);
3590 return NULL;
3591 }
3592
3593 if(translate_variable(variable, column->translator, pointer, error_label))
3594 {
3595 x4msUserAssociationEntry_free(x4msUserAssociationEntry);
3596 return NULL;
3597 }
3598
3599 variable = variable->next_variable;
3600 pointer++;
3601 }
3602
3603
3604 return x4msUserAssociationEntry;
3605 }
3606
3607
3608 /***************************************************************/
3609
x4msUserAssociationEntry_free(X4msUserAssociationEntry * x4msUserAssociationEntry)3610 void x4msUserAssociationEntry_free(X4msUserAssociationEntry *x4msUserAssociationEntry)
3611 {
3612 if(x4msUserAssociationEntry == NULL)
3613 {
3614 return;
3615 }
3616
3617 free(x4msUserAssociationEntry);
3618 }
3619
3620
3621 /***************************************************************/
3622
x4msUserAssociationEntry_print(X4msUserAssociationEntry * x4msUserAssociationEntry)3623 void x4msUserAssociationEntry_print(X4msUserAssociationEntry *x4msUserAssociationEntry)
3624 {
3625 printf("x4msUserIndex: %ld\n",
3626 x4msUserAssociationEntry->x4msUserIndex);
3627 printf("x4msUserAssociationIndex: %ld\n",
3628 x4msUserAssociationEntry->x4msUserAssociationIndex);
3629 printf("\n");
3630 }
3631
3632
3633 /***************************************************************/
3634 /***************************************************************/
3635 /***************************************************************/
3636
x4grpEntry_send_request(SNMP_session * session,u_char type,int32_t x4grpIndex,char * error_label)3637 int x4grpEntry_send_request(SNMP_session *session, u_char type, int32_t x4grpIndex, char *error_label)
3638 {
3639 SNMP_pdu *request;
3640 int i;
3641 SNMP_column *column;
3642 Subid subids[100] = { 0 };
3643 Oid oid;
3644 Oid *oidp;
3645
3646
3647 error_label[0] = '\0';
3648
3649 if( (type != GET_REQ_MSG) && (type != GETNEXT_REQ_MSG) )
3650 {
3651 sprintf(error_label, "BUG: x4grpEntry_send_request(): bad type (0x%x)", type);
3652 return -1;
3653 }
3654
3655 request = snmp_pdu_new(error_label);
3656 if(request == NULL)
3657 {
3658 return -1;
3659 }
3660 request->type = type;
3661
3662 for(i = 0; i < x4grpTable.column_num; i++)
3663 {
3664 column = x4grpTable.columns[i];
3665
3666 if(x4grpIndex >= 0)
3667 {
3668 memcpy(subids, column->name->subids, column->name->len*sizeof(Subid));
3669 subids[column->name->len] = x4grpIndex;
3670 oid.len = column->name->len + 1;
3671 oid.subids = subids;
3672 oidp = &oid;
3673 }
3674 else
3675 {
3676 oidp = column->name;
3677 }
3678
3679 if(snmp_pdu_append_null_variable(request, oidp, error_label) == NULL)
3680 {
3681 snmp_pdu_free(request);
3682 return -1;
3683 }
3684 }
3685
3686 if(snmp_session_send(session, X4GRP_ENTRY_REQ, request, error_label))
3687 {
3688 /* we have to free the request */
3689
3690 snmp_pdu_free(request);
3691 return -1;
3692 }
3693
3694
3695 return 0;
3696 }
3697
3698 /* ARGSUSED */
x4grpEntry_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)3699 X4grpEntry *x4grpEntry_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
3700 {
3701 X4grpEntry *x4grpEntry;
3702 int32_t x4grpIndex;
3703 SNMP_variable *variable;
3704 uintptr_t pointer;
3705 int i;
3706 SNMP_column *column;
3707
3708
3709 snmp_errno = SNMP_ERR_NOERROR;
3710 error_label[0] = '\0';
3711
3712 if(response == NULL)
3713 {
3714 sprintf(error_label, "BUG: x4grpEntry_process_response(): response is NULL");
3715 return NULL;
3716 }
3717
3718 if(response->error_status != SNMP_ERR_NOERROR)
3719 {
3720 sprintf(error_label, ERR_MSG_ERROR_STATUS,
3721 error_status_string(response->error_status),
3722 response->error_index);
3723 snmp_errno = response->error_status;
3724 return NULL;
3725 }
3726
3727 x4grpEntry = (X4grpEntry *) malloc(sizeof(X4grpEntry));
3728 if(x4grpEntry == NULL)
3729 {
3730 sprintf(error_label, ERR_MSG_ALLOC);
3731 return NULL;
3732 }
3733 memset(x4grpEntry, 0, sizeof(X4grpEntry));
3734
3735 pointer = (uintptr_t) &(x4grpEntry->x4grpName);
3736 variable = response->first_variable;
3737 for(i = 0; i < x4grpTable.column_num; i++)
3738 {
3739 column = x4grpTable.columns[i];
3740
3741 if(variable == NULL)
3742 {
3743 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
3744 x4grpEntry_free(x4grpEntry);
3745 return NULL;
3746 }
3747
3748 /* check oid and extract x4grpIndex */
3749 if(extract_one_index_from_column(&(variable->name), column->name, &x4grpIndex))
3750 {
3751 snmp_errno = SNMP_ERR_NOSUCHNAME;
3752 x4grpEntry_free(x4grpEntry);
3753 return NULL;
3754 }
3755
3756 /* check if all x4grpIndex are equal ??? */
3757 x4grpEntry->x4grpIndex = x4grpIndex;
3758
3759 /* check type */
3760 if(variable->type != column->type)
3761 {
3762 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
3763 variable->type, column->label);
3764 x4grpEntry_free(x4grpEntry);
3765 return NULL;
3766 }
3767
3768 if(translate_variable(variable, column->translator, pointer, error_label))
3769 {
3770 x4grpEntry_free(x4grpEntry);
3771 return NULL;
3772 }
3773
3774 variable = variable->next_variable;
3775 pointer++;
3776 }
3777
3778
3779 return x4grpEntry;
3780 }
3781
3782
3783 /***************************************************************/
3784
x4grpEntry_free(X4grpEntry * x4grpEntry)3785 void x4grpEntry_free(X4grpEntry *x4grpEntry)
3786 {
3787 if(x4grpEntry == NULL)
3788 {
3789 return;
3790 }
3791
3792 if(x4grpEntry->x4grpName)
3793 {
3794 free(x4grpEntry->x4grpName);
3795 }
3796 free(x4grpEntry);
3797 }
3798
3799
3800 /***************************************************************/
3801
x4grpEntry_print(X4grpEntry * x4grpEntry)3802 void x4grpEntry_print(X4grpEntry *x4grpEntry)
3803 {
3804 printf("x4grpIndex: %ld\n",
3805 x4grpEntry->x4grpIndex);
3806 printf("x4grpName: %s\n",
3807 x4grpEntry->x4grpName);
3808 printf("\n");
3809 }
3810
3811
3812 /***************************************************************/
3813 /***************************************************************/
3814 /***************************************************************/
3815
x4grpMappingEntry_send_request(SNMP_session * session,u_char type,int32_t x4grpIndex,int32_t x4grpMappingMSIndex,int32_t x4grpMappingMTAIndex,char * error_label)3816 int x4grpMappingEntry_send_request(SNMP_session *session, u_char type, int32_t x4grpIndex, int32_t x4grpMappingMSIndex, int32_t x4grpMappingMTAIndex, char *error_label)
3817 {
3818 SNMP_pdu *request;
3819 int i;
3820 SNMP_column *column;
3821 Subid subids[100] = { 0 };
3822 Oid oid;
3823 Oid *oidp;
3824
3825
3826 error_label[0] = '\0';
3827
3828 if( (type != GET_REQ_MSG) && (type != GETNEXT_REQ_MSG) )
3829 {
3830 sprintf(error_label, "BUG: x4grpMappingEntry_send_request(): bad type (0x%x)", type);
3831 return -1;
3832 }
3833
3834 request = snmp_pdu_new(error_label);
3835 if(request == NULL)
3836 {
3837 return -1;
3838 }
3839 request->type = type;
3840
3841 for(i = 0; i < x4grpMappingTable.column_num; i++)
3842 {
3843 column = x4grpMappingTable.columns[i];
3844
3845 if(x4grpIndex >= 0)
3846 {
3847 memcpy(subids, column->name->subids, column->name->len*sizeof(Subid));
3848 subids[column->name->len] = x4grpIndex;
3849 oid.len = column->name->len + 1;
3850
3851 if(x4grpMappingMSIndex >= 0)
3852 {
3853 subids[column->name->len + 1] = x4grpMappingMSIndex;
3854 oid.len = column->name->len + 2;
3855
3856 if(x4grpMappingMTAIndex >= 0)
3857 {
3858 subids[column->name->len + 2] = x4grpMappingMTAIndex;
3859 oid.len = column->name->len + 3;
3860 }
3861 }
3862
3863 oid.subids = subids;
3864 oidp = &oid;
3865 }
3866 else
3867 {
3868 oidp = column->name;
3869 }
3870
3871 if(snmp_pdu_append_null_variable(request, oidp, error_label) == NULL)
3872 {
3873 snmp_pdu_free(request);
3874 return -1;
3875 }
3876 }
3877
3878 if(snmp_session_send(session, X4GRP_MAPPING_ENTRY_REQ, request, error_label))
3879 {
3880 /* we have to free the request */
3881
3882 snmp_pdu_free(request);
3883 return -1;
3884 }
3885
3886
3887 return 0;
3888 }
3889
3890 /* ARGSUSED */
x4grpMappingEntry_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)3891 X4grpMappingEntry *x4grpMappingEntry_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
3892 {
3893 X4grpMappingEntry *x4grpMappingEntry;
3894 int32_t x4grpIndex;
3895 int32_t x4grpMappingMSIndex;
3896 int32_t x4grpMappingMTAIndex;
3897 SNMP_variable *variable;
3898 uintptr_t pointer;
3899 int i;
3900 SNMP_column *column;
3901
3902
3903 snmp_errno = SNMP_ERR_NOERROR;
3904 error_label[0] = '\0';
3905
3906 if(response == NULL)
3907 {
3908 sprintf(error_label, "BUG: x4grpMappingEntry_process_response(): response is NULL");
3909 return NULL;
3910 }
3911
3912 if(response->error_status != SNMP_ERR_NOERROR)
3913 {
3914 sprintf(error_label, ERR_MSG_ERROR_STATUS,
3915 error_status_string(response->error_status),
3916 response->error_index);
3917 snmp_errno = response->error_status;
3918 return NULL;
3919 }
3920
3921 x4grpMappingEntry = (X4grpMappingEntry *) malloc(sizeof(X4grpMappingEntry));
3922 if(x4grpMappingEntry == NULL)
3923 {
3924 sprintf(error_label, ERR_MSG_ALLOC);
3925 return NULL;
3926 }
3927 memset(x4grpMappingEntry, 0, sizeof(X4grpMappingEntry));
3928
3929 pointer = (uintptr_t) &(x4grpMappingEntry->x4grpMappingMSIndex);
3930 variable = response->first_variable;
3931 for(i = 0; i < x4grpMappingTable.column_num; i++)
3932 {
3933 column = x4grpMappingTable.columns[i];
3934
3935 if(variable == NULL)
3936 {
3937 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
3938 x4grpMappingEntry_free(x4grpMappingEntry);
3939 return NULL;
3940 }
3941
3942 /* check oid and extract x4grpIndex, x4grpMappingMSIndex and x4grpMappingMTAIndex */
3943 if(extract_three_indexes_from_column(&(variable->name), column->name, &x4grpIndex, &x4grpMappingMSIndex, &x4grpMappingMTAIndex))
3944 {
3945 snmp_errno = SNMP_ERR_NOSUCHNAME;
3946 x4grpMappingEntry_free(x4grpMappingEntry);
3947 return NULL;
3948 }
3949
3950 /* check if all x4grpIndex are equal ??? */
3951 x4grpMappingEntry->x4grpIndex = x4grpIndex;
3952
3953 /* check type */
3954 if(variable->type != column->type)
3955 {
3956 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
3957 variable->type, column->label);
3958 x4grpMappingEntry_free(x4grpMappingEntry);
3959 return NULL;
3960 }
3961
3962 if(translate_variable(variable, column->translator, pointer, error_label))
3963 {
3964 x4grpMappingEntry_free(x4grpMappingEntry);
3965 return NULL;
3966 }
3967
3968 variable = variable->next_variable;
3969 pointer++;
3970 }
3971
3972
3973 return x4grpMappingEntry;
3974 }
3975
3976
3977 /***************************************************************/
3978
x4grpMappingEntry_free(X4grpMappingEntry * x4grpMappingEntry)3979 void x4grpMappingEntry_free(X4grpMappingEntry *x4grpMappingEntry)
3980 {
3981 if(x4grpMappingEntry == NULL)
3982 {
3983 return;
3984 }
3985
3986 free(x4grpMappingEntry);
3987 }
3988
3989
3990 /***************************************************************/
3991
x4grpMappingEntry_print(X4grpMappingEntry * x4grpMappingEntry)3992 void x4grpMappingEntry_print(X4grpMappingEntry *x4grpMappingEntry)
3993 {
3994 printf("x4grpIndex: %ld\n",
3995 x4grpMappingEntry->x4grpIndex);
3996 printf("x4grpMappingMSIndex: %ld\n",
3997 x4grpMappingEntry->x4grpMappingMSIndex);
3998 printf("x4grpMappingMTAIndex: %ld\n",
3999 x4grpMappingEntry->x4grpMappingMTAIndex);
4000 printf("\n");
4001 }
4002
4003
4004 /***************************************************************/
4005 /***************************************************************/
4006 /***************************************************************/
4007
x5dsaReferenceEntry_send_request(SNMP_session * session,u_char type,int32_t x5dsaReferenceIndex,char * error_label)4008 int x5dsaReferenceEntry_send_request(SNMP_session *session, u_char type, int32_t x5dsaReferenceIndex, char *error_label)
4009 {
4010 SNMP_pdu *request;
4011 int i;
4012 SNMP_column *column;
4013 Subid subids[100] = { 0 };
4014 Oid oid;
4015 Oid *oidp;
4016
4017
4018 error_label[0] = '\0';
4019
4020 if( (type != GET_REQ_MSG) && (type != GETNEXT_REQ_MSG) )
4021 {
4022 sprintf(error_label, "BUG: x5dsaReferenceEntry_send_request(): bad type (0x%x)", type);
4023 return -1;
4024 }
4025
4026 request = snmp_pdu_new(error_label);
4027 if(request == NULL)
4028 {
4029 return -1;
4030 }
4031 request->type = type;
4032
4033 for(i = 0; i < x5dsaReferenceTable.column_num; i++)
4034 {
4035 column = x5dsaReferenceTable.columns[i];
4036
4037 if(x5dsaReferenceIndex >= 0)
4038 {
4039 memcpy(subids, column->name->subids, column->name->len*sizeof(Subid));
4040 subids[column->name->len] = x5dsaReferenceIndex;
4041 oid.len = column->name->len + 1;
4042 oid.subids = subids;
4043 oidp = &oid;
4044 }
4045 else
4046 {
4047 oidp = column->name;
4048 }
4049
4050 if(snmp_pdu_append_null_variable(request, oidp, error_label) == NULL)
4051 {
4052 snmp_pdu_free(request);
4053 return -1;
4054 }
4055 }
4056
4057 if(snmp_session_send(session, X5DSA_REFERENCE_ENTRY_REQ, request, error_label))
4058 {
4059 /* we have to free the request */
4060
4061 snmp_pdu_free(request);
4062 return -1;
4063 }
4064
4065
4066 return 0;
4067 }
4068
4069 /* ARGSUSED */
x5dsaReferenceEntry_process_response(SNMP_session * session,SNMP_pdu * response,char * error_label)4070 X5dsaReferenceEntry *x5dsaReferenceEntry_process_response(SNMP_session *session, SNMP_pdu *response, char *error_label)
4071 {
4072 X5dsaReferenceEntry *x5dsaReferenceEntry;
4073 int32_t x5dsaReferenceIndex;
4074 SNMP_variable *variable;
4075 uintptr_t pointer;
4076 int i;
4077 SNMP_column *column;
4078
4079
4080 snmp_errno = SNMP_ERR_NOERROR;
4081 error_label[0] = '\0';
4082
4083 if(response == NULL)
4084 {
4085 sprintf(error_label, "BUG: x5dsaReferenceEntry_process_response(): response is NULL");
4086 return NULL;
4087 }
4088
4089 if(response->error_status != SNMP_ERR_NOERROR)
4090 {
4091 sprintf(error_label, ERR_MSG_ERROR_STATUS,
4092 error_status_string(response->error_status),
4093 response->error_index);
4094 snmp_errno = response->error_status;
4095 return NULL;
4096 }
4097
4098 x5dsaReferenceEntry = (X5dsaReferenceEntry *) malloc(sizeof(X5dsaReferenceEntry));
4099 if(x5dsaReferenceEntry == NULL)
4100 {
4101 sprintf(error_label, ERR_MSG_ALLOC);
4102 return NULL;
4103 }
4104 memset(x5dsaReferenceEntry, 0, sizeof(X5dsaReferenceEntry));
4105
4106 pointer = (uintptr_t) &(x5dsaReferenceEntry->x5dsaReferenceType);
4107 variable = response->first_variable;
4108 for(i = 0; i < x5dsaReferenceTable.column_num; i++)
4109 {
4110 column = x5dsaReferenceTable.columns[i];
4111
4112 if(variable == NULL)
4113 {
4114 sprintf(error_label, ERR_MSG_MISSING_VARIABLES);
4115 x5dsaReferenceEntry_free(x5dsaReferenceEntry);
4116 return NULL;
4117 }
4118
4119 /* check oid and extract x5dsaReferenceIndex */
4120 if(extract_one_index_from_column(&(variable->name), column->name, &x5dsaReferenceIndex))
4121 {
4122 snmp_errno = SNMP_ERR_NOSUCHNAME;
4123 x5dsaReferenceEntry_free(x5dsaReferenceEntry);
4124 return NULL;
4125 }
4126
4127 /* check if all x5dsaReferenceIndex are equal ??? */
4128 x5dsaReferenceEntry->x5dsaReferenceIndex = x5dsaReferenceIndex;
4129
4130 /* check type */
4131 if(variable->type != column->type)
4132 {
4133 sprintf(error_label, ERR_MSG_BAD_VARIABLE_TYPE,
4134 variable->type, column->label);
4135 x5dsaReferenceEntry_free(x5dsaReferenceEntry);
4136 return NULL;
4137 }
4138
4139 if(translate_variable(variable, column->translator, pointer, error_label))
4140 {
4141 x5dsaReferenceEntry_free(x5dsaReferenceEntry);
4142 return NULL;
4143 }
4144
4145 variable = variable->next_variable;
4146 pointer++;
4147 }
4148
4149
4150 return x5dsaReferenceEntry;
4151 }
4152
4153
4154 /***************************************************************/
4155
x5dsaReferenceEntry_free(X5dsaReferenceEntry * x5dsaReferenceEntry)4156 void x5dsaReferenceEntry_free(X5dsaReferenceEntry *x5dsaReferenceEntry)
4157 {
4158 if(x5dsaReferenceEntry == NULL)
4159 {
4160 return;
4161 }
4162
4163 if(x5dsaReferenceEntry->x5dsaReferenceNamingContext)
4164 {
4165 free(x5dsaReferenceEntry->x5dsaReferenceNamingContext);
4166 }
4167 if(x5dsaReferenceEntry->x5dsaReferenceSubordinate)
4168 {
4169 free(x5dsaReferenceEntry->x5dsaReferenceSubordinate);
4170 }
4171 if(x5dsaReferenceEntry->x5dsaReferenceName)
4172 {
4173 free(x5dsaReferenceEntry->x5dsaReferenceName);
4174 }
4175 free(x5dsaReferenceEntry);
4176 }
4177
4178
4179 /***************************************************************/
4180
x5dsaReferenceEntry_print(X5dsaReferenceEntry * x5dsaReferenceEntry)4181 void x5dsaReferenceEntry_print(X5dsaReferenceEntry *x5dsaReferenceEntry)
4182 {
4183 printf("x5dsaReferenceIndex: %ld\n",
4184 x5dsaReferenceEntry->x5dsaReferenceIndex);
4185 printf("x5dsaReferenceType: %s\n",
4186 x5dsaReferenceType_string(x5dsaReferenceEntry->x5dsaReferenceType));
4187 printf("x5dsaReferenceNamingContext: %s\n",
4188 x5dsaReferenceEntry->x5dsaReferenceNamingContext);
4189 printf("x5dsaReferenceSubordinate: %s\n",
4190 x5dsaReferenceEntry->x5dsaReferenceSubordinate);
4191 printf("x5dsaReferenceName: %s\n",
4192 x5dsaReferenceEntry->x5dsaReferenceName);
4193 printf("\n");
4194 }
4195
4196
4197 /***************************************************************/
4198 /***************************************************************/
4199 /***************************************************************/
4200
4201 char *
applOperStatus_string(int32_t applOperStatus)4202 applOperStatus_string(int32_t applOperStatus)
4203 {
4204 static char buffer[20];
4205
4206 switch(applOperStatus)
4207 {
4208 case APPL_UP:
4209 sprintf(buffer, "up");
4210 break;
4211 case APPL_DOWN:
4212 sprintf(buffer, "down");
4213 break;
4214 case APPL_HALTED:
4215 sprintf(buffer, "halted");
4216 break;
4217 case APPL_CONGESTED:
4218 sprintf(buffer, "congested");
4219 break;
4220 case APPL_RESTARTING:
4221 sprintf(buffer, "restarting");
4222 break;
4223 default:
4224 sprintf(buffer, "unknown(%ld)", applOperStatus);
4225 break;
4226 }
4227
4228 return buffer;
4229 }
4230
4231
4232 /***************************************************************/
4233
4234 char *
assocApplicationType_string(int32_t assocApplicationType)4235 assocApplicationType_string(int32_t assocApplicationType)
4236 {
4237 static char buffer[20];
4238
4239 switch(assocApplicationType)
4240 {
4241 case ASSOC_UA_INITIATOR:
4242 sprintf(buffer, "ua-initiator");
4243 break;
4244 case ASSOC_UA_RESPONDER:
4245 sprintf(buffer, "ua-responder");
4246 break;
4247 case ASSOC_PEER_INITIATOR:
4248 sprintf(buffer, "peer-initiator");
4249 break;
4250 case ASSOC_PEER_RESPONDER:
4251 sprintf(buffer, "peer-responder");
4252 break;
4253 default:
4254 sprintf(buffer, "unknown(%ld)", assocApplicationType);
4255 break;
4256 }
4257
4258 return buffer;
4259 }
4260
4261
4262 /***************************************************************/
4263
x5dsaReferenceType_string(int32_t x5dsaReferenceType)4264 char *x5dsaReferenceType_string(int32_t x5dsaReferenceType)
4265 {
4266 static char buffer[30];
4267
4268 switch(x5dsaReferenceType)
4269 {
4270 case REFERENCE_SUPERIOR:
4271 sprintf(buffer, "superior");
4272 break;
4273 case REFERENCE_CROSS:
4274 sprintf(buffer, "cross");
4275 break;
4276 case REFERENCE_SUBORDINATE:
4277 sprintf(buffer, "subordinate");
4278 break;
4279 case REFERENCE_NON_SPECIFIC_SUBORDINATE:
4280 sprintf(buffer, "non-specific-subordinate");
4281 break;
4282 default:
4283 sprintf(buffer, "unknown(%ld)", x5dsaReferenceType);
4284 break;
4285 }
4286
4287 return buffer;
4288 }
4289
4290
4291 /***************************************************************/
4292 /***************************************************************/
4293 /***************************************************************/
4294
predefined_request_string(int predefined_id)4295 char *predefined_request_string(int predefined_id)
4296 {
4297 static char buffer[50];
4298
4299 switch(predefined_id)
4300 {
4301 case SYSUPTIME_REQ:
4302 sprintf(buffer, "sysUpTime");
4303 break;
4304 case APPL_ENTRY_REQ:
4305 sprintf(buffer, "applEntry");
4306 break;
4307 case ASSOC_ENTRY_REQ:
4308 sprintf(buffer, "assocEntry");
4309 break;
4310 case MTA_ENTRY_REQ:
4311 sprintf(buffer, "mtaEntry");
4312 break;
4313 case MTA_GROUP_ENTRY_REQ:
4314 sprintf(buffer, "mtaGroupEntry");
4315 break;
4316 case MTA_GROUP_ASSOCIATION_ENTRY_REQ:
4317 sprintf(buffer, "mtaGroupAssociationEntry");
4318 break;
4319 case DSA_OPS_ENTRY_REQ:
4320 sprintf(buffer, "dsaOpsEntry");
4321 break;
4322 case DSA_ENTRIES_ENTRY_REQ:
4323 sprintf(buffer, "dsaEntriesEntry");
4324 break;
4325 case DSA_INT_ENTRY_REQ:
4326 sprintf(buffer, "dsaIntEntry");
4327 break;
4328 case X4MS_MTA_ENTRY_REQ:
4329 sprintf(buffer, "x4msMtaEntry");
4330 break;
4331 case X4MS_USER_ENTRY_PART1_REQ:
4332 sprintf(buffer, "x4msUserEntryPart1");
4333 break;
4334 case X4MS_USER_ENTRY_PART2_REQ:
4335 sprintf(buffer, "x4msUserEntryPart2");
4336 break;
4337 case X4MS_USER_ASSOCIATION_ENTRY_REQ:
4338 sprintf(buffer, "x4msUserAssociationEntry");
4339 break;
4340 case X4GRP_ENTRY_REQ:
4341 sprintf(buffer, "x4grpEntry");
4342 break;
4343 case X4GRP_MAPPING_ENTRY_REQ:
4344 sprintf(buffer, "x4grpMappingEntry");
4345 break;
4346 case X5DSA_REFERENCE_ENTRY_REQ:
4347 sprintf(buffer, "x5dsaReferenceEntry");
4348 break;
4349 default:
4350 sprintf(buffer, "error(%d)", predefined_id);
4351 break;
4352 }
4353
4354 return buffer;
4355 }
4356
4357 static int
translate_variable(SNMP_variable * variable,int translator,uintptr_t pointer,char * error_label)4358 translate_variable(SNMP_variable *variable, int translator, uintptr_t pointer, char *error_label)
4359 {
4360 error_label[0] = '\0';
4361
4362 switch(translator)
4363 {
4364 case TO_INTEGER:
4365 *(long *)pointer = (long) *(variable->val.integer);
4366 break;
4367
4368 case TO_ASCII: {
4369 char ** ptr = ((char **)pointer);
4370
4371 *ptr = malloc(variable->val_len + 1);
4372 if(*ptr == NULL) {
4373 sprintf(error_label, ERR_MSG_ALLOC);
4374 return -1;
4375 }
4376 memcpy(*ptr, variable->val.string, variable->val_len);
4377 ((char *) (*ptr))[variable->val_len] = '\0';
4378 if(variable->val.string)
4379 {
4380 free(variable->val.string);
4381 variable->val.string = NULL;
4382 }
4383 variable->val_len = NULL;
4384 }
4385
4386 break;
4387
4388 case TO_STRING: {
4389 char ** ptr = ((char **)pointer);
4390
4391 *ptr = malloc(sizeof(String));
4392 if(*ptr == NULL)
4393 {
4394 sprintf(error_label, ERR_MSG_ALLOC);
4395 return -1;
4396 }
4397 ((String *) *ptr)->len = variable->val_len;
4398 ((String *) *ptr)->chars = variable->val.string;
4399 variable->val_len = 0;
4400 variable->val.string = NULL;
4401 }
4402
4403 break;
4404
4405 case TO_OID: {
4406 Oid ** ptr = (Oid **)pointer;
4407 *ptr = (Oid *)malloc(sizeof(Oid));
4408 if(*ptr == NULL)
4409 {
4410 sprintf(error_label, ERR_MSG_ALLOC);
4411 return -1;
4412 }
4413 ((Oid *) *ptr)->len = (variable->val_len) /
4414 (int32_t)sizeof(Subid);
4415 ((Oid *) *ptr)->subids = variable->val.objid;
4416 variable->val_len = 0;
4417 variable->val.string = NULL;
4418 }
4419
4420 break;
4421 }
4422
4423 return 0;
4424 }
4425
4426
4427 /***************************************************************/
4428
4429 static int
extract_one_index_from_column(Oid * instance,Oid * object,int32_t * index)4430 extract_one_index_from_column(Oid *instance, Oid *object, int32_t * index)
4431 {
4432 if(instance->len != object->len + 1)
4433 return -1;
4434
4435 if(memcmp(instance->subids, object->subids, object->len * (int32_t)sizeof(Subid)))
4436 return -1;
4437
4438 *index = instance->subids[object->len];
4439
4440 return 0;
4441 }
4442
4443
4444 /***************************************************************/
4445
4446 static int
extract_two_indexes_from_column(Oid * instance,Oid * object,int32_t * index1,int32_t * index2)4447 extract_two_indexes_from_column(Oid *instance, Oid *object, int32_t *index1, int32_t *index2)
4448 {
4449 if(instance->len != object->len + 2)
4450 return -1;
4451
4452 if(memcmp(instance->subids, object->subids, object->len * sizeof(Subid)))
4453 return -1;
4454
4455 *index1 = instance->subids[object->len];
4456 *index2 = instance->subids[object->len + 1];
4457
4458 return 0;
4459 }
4460
4461
4462 /***************************************************************/
4463
4464 static int
extract_three_indexes_from_column(Oid * instance,Oid * object,int32_t * index1,int32_t * index2,int32_t * index3)4465 extract_three_indexes_from_column(Oid *instance, Oid *object, int32_t *index1, int32_t *index2, int32_t *index3)
4466 {
4467 if(instance->len != object->len + 3)
4468 return -1;
4469
4470 if(memcmp(instance->subids, object->subids, object->len * sizeof(Subid)))
4471 return -1;
4472
4473 *index1 = instance->subids[object->len];
4474 *index2 = instance->subids[object->len + 1];
4475 *index3 = instance->subids[object->len + 2];
4476
4477 return 0;
4478 }
4479
4480