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