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