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 2002 Sun Microsystems, Inc. All rights reserved.
24*0Sstevel@tonic-gate * Use is subject to license terms.
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 <sys/types.h>
30*0Sstevel@tonic-gate #include <netinet/in.h>
31*0Sstevel@tonic-gate
32*0Sstevel@tonic-gate #include "impl.h"
33*0Sstevel@tonic-gate #include "asn1.h"
34*0Sstevel@tonic-gate #include "error.h"
35*0Sstevel@tonic-gate #include "snmp.h"
36*0Sstevel@tonic-gate #include "trap.h"
37*0Sstevel@tonic-gate #include "pdu.h"
38*0Sstevel@tonic-gate #include "node.h"
39*0Sstevel@tonic-gate
40*0Sstevel@tonic-gate #include "snmpdx_stub.h"
41*0Sstevel@tonic-gate
42*0Sstevel@tonic-gate
43*0Sstevel@tonic-gate
get_relayProcessIDFile(String * relayProcessIDFile)44*0Sstevel@tonic-gate int get_relayProcessIDFile(String *relayProcessIDFile)
45*0Sstevel@tonic-gate {
46*0Sstevel@tonic-gate u_char *str;
47*0Sstevel@tonic-gate int len;
48*0Sstevel@tonic-gate
49*0Sstevel@tonic-gate /* It is required to allocate memory to the pointers */
50*0Sstevel@tonic-gate /* inside the input argument */
51*0Sstevel@tonic-gate /* Here, we assume that "hello" is the value of the mib variable */
52*0Sstevel@tonic-gate /* please change it to the real one */
53*0Sstevel@tonic-gate
54*0Sstevel@tonic-gate len = strlen("hello");
55*0Sstevel@tonic-gate str = (u_char*)calloc(len,sizeof(char));
56*0Sstevel@tonic-gate if(str==NULL){
57*0Sstevel@tonic-gate return SNMP_ERR_GENERR;
58*0Sstevel@tonic-gate }
59*0Sstevel@tonic-gate memcpy(str,"hello",len);
60*0Sstevel@tonic-gate
61*0Sstevel@tonic-gate /*fill in the contents of the argument */
62*0Sstevel@tonic-gate
63*0Sstevel@tonic-gate relayProcessIDFile->chars = str;
64*0Sstevel@tonic-gate relayProcessIDFile->len = len;
65*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
66*0Sstevel@tonic-gate }
67*0Sstevel@tonic-gate
set_relayProcessIDFile(int pass,String * relayProcessIDFile)68*0Sstevel@tonic-gate int set_relayProcessIDFile(int pass, String *relayProcessIDFile)
69*0Sstevel@tonic-gate {
70*0Sstevel@tonic-gate switch(pass)
71*0Sstevel@tonic-gate {
72*0Sstevel@tonic-gate case FIRST_PASS:
73*0Sstevel@tonic-gate
74*0Sstevel@tonic-gate /* check the validity of the input argument */
75*0Sstevel@tonic-gate /* if not valid, return SNMP_GEN_ERROR */
76*0Sstevel@tonic-gate
77*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
78*0Sstevel@tonic-gate
79*0Sstevel@tonic-gate case SECOND_PASS:
80*0Sstevel@tonic-gate /* change the following coding, such that */
81*0Sstevel@tonic-gate /* the input value will be stored in the */
82*0Sstevel@tonic-gate /* corresponding mib variable */
83*0Sstevel@tonic-gate
84*0Sstevel@tonic-gate printf("The new value is %.*s\n",
85*0Sstevel@tonic-gate relayProcessIDFile->len, relayProcessIDFile->chars);
86*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
87*0Sstevel@tonic-gate }
88*0Sstevel@tonic-gate }
89*0Sstevel@tonic-gate
90*0Sstevel@tonic-gate
free_relayProcessIDFile(String * relayProcessIDFile)91*0Sstevel@tonic-gate void free_relayProcessIDFile(String *relayProcessIDFile)
92*0Sstevel@tonic-gate {
93*0Sstevel@tonic-gate if(relayProcessIDFile->chars!=NULL && relayProcessIDFile->len !=0)
94*0Sstevel@tonic-gate {
95*0Sstevel@tonic-gate free(relayProcessIDFile->chars);
96*0Sstevel@tonic-gate relayProcessIDFile->len = 0;
97*0Sstevel@tonic-gate }
98*0Sstevel@tonic-gate }
99*0Sstevel@tonic-gate
get_relayResourceFile(String * relayResourceFile)100*0Sstevel@tonic-gate int get_relayResourceFile(String *relayResourceFile)
101*0Sstevel@tonic-gate {
102*0Sstevel@tonic-gate u_char *str;
103*0Sstevel@tonic-gate int len;
104*0Sstevel@tonic-gate
105*0Sstevel@tonic-gate /* It is required to allocate memory to the pointers */
106*0Sstevel@tonic-gate /* inside the input argument */
107*0Sstevel@tonic-gate /* Here, we assume that "hello" is the value of the mib variable */
108*0Sstevel@tonic-gate /* please change it to the real one */
109*0Sstevel@tonic-gate
110*0Sstevel@tonic-gate len = strlen("hello");
111*0Sstevel@tonic-gate str = (u_char*)calloc(len,sizeof(char));
112*0Sstevel@tonic-gate if(str==NULL){
113*0Sstevel@tonic-gate return SNMP_ERR_GENERR;
114*0Sstevel@tonic-gate }
115*0Sstevel@tonic-gate memcpy(str,"hello",len);
116*0Sstevel@tonic-gate
117*0Sstevel@tonic-gate /*fill in the contents of the argument */
118*0Sstevel@tonic-gate
119*0Sstevel@tonic-gate relayResourceFile->chars = str;
120*0Sstevel@tonic-gate relayResourceFile->len = len;
121*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
122*0Sstevel@tonic-gate }
123*0Sstevel@tonic-gate
set_relayResourceFile(int pass,String * relayResourceFile)124*0Sstevel@tonic-gate int set_relayResourceFile(int pass, String *relayResourceFile)
125*0Sstevel@tonic-gate {
126*0Sstevel@tonic-gate switch(pass)
127*0Sstevel@tonic-gate {
128*0Sstevel@tonic-gate case FIRST_PASS:
129*0Sstevel@tonic-gate
130*0Sstevel@tonic-gate /* check the validity of the input argument */
131*0Sstevel@tonic-gate /* if not valid, return SNMP_GEN_ERROR */
132*0Sstevel@tonic-gate
133*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
134*0Sstevel@tonic-gate
135*0Sstevel@tonic-gate case SECOND_PASS:
136*0Sstevel@tonic-gate /* change the following coding, such that */
137*0Sstevel@tonic-gate /* the input value will be stored in the */
138*0Sstevel@tonic-gate /* corresponding mib variable */
139*0Sstevel@tonic-gate
140*0Sstevel@tonic-gate printf("The new value is %.*s\n",
141*0Sstevel@tonic-gate relayResourceFile->len, relayResourceFile->chars);
142*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
143*0Sstevel@tonic-gate }
144*0Sstevel@tonic-gate }
145*0Sstevel@tonic-gate
146*0Sstevel@tonic-gate
free_relayResourceFile(String * relayResourceFile)147*0Sstevel@tonic-gate void free_relayResourceFile(String *relayResourceFile)
148*0Sstevel@tonic-gate {
149*0Sstevel@tonic-gate if(relayResourceFile->chars!=NULL && relayResourceFile->len !=0)
150*0Sstevel@tonic-gate {
151*0Sstevel@tonic-gate free(relayResourceFile->chars);
152*0Sstevel@tonic-gate relayResourceFile->len = 0;
153*0Sstevel@tonic-gate }
154*0Sstevel@tonic-gate }
155*0Sstevel@tonic-gate
get_relayPersonalFileDir(String * relayPersonalFileDir)156*0Sstevel@tonic-gate int get_relayPersonalFileDir(String *relayPersonalFileDir)
157*0Sstevel@tonic-gate {
158*0Sstevel@tonic-gate u_char *str;
159*0Sstevel@tonic-gate int len;
160*0Sstevel@tonic-gate
161*0Sstevel@tonic-gate /* It is required to allocate memory to the pointers */
162*0Sstevel@tonic-gate /* inside the input argument */
163*0Sstevel@tonic-gate /* Here, we assume that "hello" is the value of the mib variable */
164*0Sstevel@tonic-gate /* please change it to the real one */
165*0Sstevel@tonic-gate
166*0Sstevel@tonic-gate len = strlen("hello");
167*0Sstevel@tonic-gate str = (u_char*)calloc(len,sizeof(char));
168*0Sstevel@tonic-gate if(str==NULL){
169*0Sstevel@tonic-gate return SNMP_ERR_GENERR;
170*0Sstevel@tonic-gate }
171*0Sstevel@tonic-gate memcpy(str,"hello",len);
172*0Sstevel@tonic-gate
173*0Sstevel@tonic-gate /*fill in the contents of the argument */
174*0Sstevel@tonic-gate
175*0Sstevel@tonic-gate relayPersonalFileDir->chars = str;
176*0Sstevel@tonic-gate relayPersonalFileDir->len = len;
177*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
178*0Sstevel@tonic-gate }
179*0Sstevel@tonic-gate
set_relayPersonalFileDir(int pass,String * relayPersonalFileDir)180*0Sstevel@tonic-gate int set_relayPersonalFileDir(int pass, String *relayPersonalFileDir)
181*0Sstevel@tonic-gate {
182*0Sstevel@tonic-gate switch(pass)
183*0Sstevel@tonic-gate {
184*0Sstevel@tonic-gate case FIRST_PASS:
185*0Sstevel@tonic-gate
186*0Sstevel@tonic-gate /* check the validity of the input argument */
187*0Sstevel@tonic-gate /* if not valid, return SNMP_GEN_ERROR */
188*0Sstevel@tonic-gate
189*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
190*0Sstevel@tonic-gate
191*0Sstevel@tonic-gate case SECOND_PASS:
192*0Sstevel@tonic-gate /* change the following coding, such that */
193*0Sstevel@tonic-gate /* the input value will be stored in the */
194*0Sstevel@tonic-gate /* corresponding mib variable */
195*0Sstevel@tonic-gate
196*0Sstevel@tonic-gate printf("The new value is %.*s\n",
197*0Sstevel@tonic-gate relayPersonalFileDir->len, relayPersonalFileDir->chars);
198*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
199*0Sstevel@tonic-gate }
200*0Sstevel@tonic-gate }
201*0Sstevel@tonic-gate
202*0Sstevel@tonic-gate
free_relayPersonalFileDir(String * relayPersonalFileDir)203*0Sstevel@tonic-gate void free_relayPersonalFileDir(String *relayPersonalFileDir)
204*0Sstevel@tonic-gate {
205*0Sstevel@tonic-gate if(relayPersonalFileDir->chars!=NULL && relayPersonalFileDir->len !=0)
206*0Sstevel@tonic-gate {
207*0Sstevel@tonic-gate free(relayPersonalFileDir->chars);
208*0Sstevel@tonic-gate relayPersonalFileDir->len = 0;
209*0Sstevel@tonic-gate }
210*0Sstevel@tonic-gate }
211*0Sstevel@tonic-gate
get_relayTrapPort(Integer * relayTrapPort)212*0Sstevel@tonic-gate int get_relayTrapPort(Integer *relayTrapPort)
213*0Sstevel@tonic-gate {
214*0Sstevel@tonic-gate /* assume that the mib variable has a value of 1 */
215*0Sstevel@tonic-gate
216*0Sstevel@tonic-gate *relayTrapPort = 1;
217*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
218*0Sstevel@tonic-gate }
219*0Sstevel@tonic-gate
get_relayCheckPoint(String * relayCheckPoint)220*0Sstevel@tonic-gate int get_relayCheckPoint(String *relayCheckPoint)
221*0Sstevel@tonic-gate {
222*0Sstevel@tonic-gate u_char *str;
223*0Sstevel@tonic-gate int len;
224*0Sstevel@tonic-gate
225*0Sstevel@tonic-gate /* It is required to allocate memory to the pointers */
226*0Sstevel@tonic-gate /* inside the input argument */
227*0Sstevel@tonic-gate /* Here, we assume that "hello" is the value of the mib variable */
228*0Sstevel@tonic-gate /* please change it to the real one */
229*0Sstevel@tonic-gate
230*0Sstevel@tonic-gate len = strlen("hello");
231*0Sstevel@tonic-gate str = (u_char*)calloc(len,sizeof(char));
232*0Sstevel@tonic-gate if(str==NULL){
233*0Sstevel@tonic-gate return SNMP_ERR_GENERR;
234*0Sstevel@tonic-gate }
235*0Sstevel@tonic-gate memcpy(str,"hello",len);
236*0Sstevel@tonic-gate
237*0Sstevel@tonic-gate /*fill in the contents of the argument */
238*0Sstevel@tonic-gate
239*0Sstevel@tonic-gate relayCheckPoint->chars = str;
240*0Sstevel@tonic-gate relayCheckPoint->len = len;
241*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
242*0Sstevel@tonic-gate }
243*0Sstevel@tonic-gate
set_relayCheckPoint(int pass,String * relayCheckPoint)244*0Sstevel@tonic-gate int set_relayCheckPoint(int pass, String *relayCheckPoint)
245*0Sstevel@tonic-gate {
246*0Sstevel@tonic-gate switch(pass)
247*0Sstevel@tonic-gate {
248*0Sstevel@tonic-gate case FIRST_PASS:
249*0Sstevel@tonic-gate
250*0Sstevel@tonic-gate /* check the validity of the input argument */
251*0Sstevel@tonic-gate /* if not valid, return SNMP_GEN_ERROR */
252*0Sstevel@tonic-gate
253*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
254*0Sstevel@tonic-gate
255*0Sstevel@tonic-gate case SECOND_PASS:
256*0Sstevel@tonic-gate /* change the following coding, such that */
257*0Sstevel@tonic-gate /* the input value will be stored in the */
258*0Sstevel@tonic-gate /* corresponding mib variable */
259*0Sstevel@tonic-gate
260*0Sstevel@tonic-gate printf("The new value is %.*s\n", relayCheckPoint->len,
261*0Sstevel@tonic-gate relayCheckPoint->chars);
262*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
263*0Sstevel@tonic-gate }
264*0Sstevel@tonic-gate }
265*0Sstevel@tonic-gate
266*0Sstevel@tonic-gate
free_relayCheckPoint(String * relayCheckPoint)267*0Sstevel@tonic-gate void free_relayCheckPoint(String *relayCheckPoint)
268*0Sstevel@tonic-gate {
269*0Sstevel@tonic-gate if(relayCheckPoint->chars!=NULL && relayCheckPoint->len !=0)
270*0Sstevel@tonic-gate {
271*0Sstevel@tonic-gate free(relayCheckPoint->chars);
272*0Sstevel@tonic-gate relayCheckPoint->len = 0;
273*0Sstevel@tonic-gate }
274*0Sstevel@tonic-gate }
275*0Sstevel@tonic-gate
get_relayPollInterval(Integer * relayPollInterval)276*0Sstevel@tonic-gate int get_relayPollInterval(Integer *relayPollInterval)
277*0Sstevel@tonic-gate {
278*0Sstevel@tonic-gate /* assume that the mib variable has a value of 1 */
279*0Sstevel@tonic-gate
280*0Sstevel@tonic-gate *relayPollInterval = 1;
281*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
282*0Sstevel@tonic-gate }
283*0Sstevel@tonic-gate
get_relayMaxAgentTimeOut(Integer * relayMaxAgentTimeOut)284*0Sstevel@tonic-gate int get_relayMaxAgentTimeOut(Integer *relayMaxAgentTimeOut)
285*0Sstevel@tonic-gate {
286*0Sstevel@tonic-gate /* assume that the mib variable has a value of 1 */
287*0Sstevel@tonic-gate
288*0Sstevel@tonic-gate *relayMaxAgentTimeOut = 1;
289*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
290*0Sstevel@tonic-gate }
291*0Sstevel@tonic-gate
get_agentTableIndex(Integer * agentTableIndex)292*0Sstevel@tonic-gate int get_agentTableIndex(Integer *agentTableIndex)
293*0Sstevel@tonic-gate {
294*0Sstevel@tonic-gate /* assume that the mib variable has a value of 1 */
295*0Sstevel@tonic-gate
296*0Sstevel@tonic-gate *agentTableIndex = 1;
297*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
298*0Sstevel@tonic-gate }
299*0Sstevel@tonic-gate
set_agentTableIndex(int pass,Integer * agentTableIndex)300*0Sstevel@tonic-gate int set_agentTableIndex(int pass, Integer *agentTableIndex)
301*0Sstevel@tonic-gate {
302*0Sstevel@tonic-gate switch(pass)
303*0Sstevel@tonic-gate {
304*0Sstevel@tonic-gate case FIRST_PASS:
305*0Sstevel@tonic-gate
306*0Sstevel@tonic-gate /* check the validity of the input argument */
307*0Sstevel@tonic-gate /* if not valid, return SNMP_GEN_ERROR */
308*0Sstevel@tonic-gate
309*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
310*0Sstevel@tonic-gate
311*0Sstevel@tonic-gate case SECOND_PASS:
312*0Sstevel@tonic-gate /* change the following coding, such that */
313*0Sstevel@tonic-gate /* the input value will be stored in the */
314*0Sstevel@tonic-gate /* corresponding mib variable */
315*0Sstevel@tonic-gate
316*0Sstevel@tonic-gate printf("The new value is %d\n",agentTableIndex);
317*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
318*0Sstevel@tonic-gate }
319*0Sstevel@tonic-gate }
320*0Sstevel@tonic-gate
321*0Sstevel@tonic-gate
get_regTblTableIndex(Integer * regTblTableIndex)322*0Sstevel@tonic-gate int get_regTblTableIndex(Integer *regTblTableIndex)
323*0Sstevel@tonic-gate {
324*0Sstevel@tonic-gate /* assume that the mib variable has a value of 1 */
325*0Sstevel@tonic-gate
326*0Sstevel@tonic-gate *regTblTableIndex = 1;
327*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
328*0Sstevel@tonic-gate }
329*0Sstevel@tonic-gate
get_regTreeTableIndex(Integer * regTreeTableIndex)330*0Sstevel@tonic-gate int get_regTreeTableIndex(Integer *regTreeTableIndex)
331*0Sstevel@tonic-gate {
332*0Sstevel@tonic-gate /* assume that the mib variable has a value of 1 */
333*0Sstevel@tonic-gate
334*0Sstevel@tonic-gate *regTreeTableIndex = 1;
335*0Sstevel@tonic-gate return SNMP_ERR_NOERROR;
336*0Sstevel@tonic-gate }
337