Debian Codegraph @

agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable.c

raw
1 /*
2 * Note: this file originally auto-generated by mib2c using
3 * version : 1.48 $ of : mfd-top.m2c,v $
4 *
5 * $Id$
6 */
7 /** \page MFD helper for inetCidrRouteTable
8 *
9 * \section intro Introduction
10 * Introductory text.
11 *
12 */
13 /*
14 * standard Net-SNMP includes
15 */
16 #include <net-snmp/net-snmp-config.h>
17 #include <net-snmp/net-snmp-features.h>
18 #include <net-snmp/net-snmp-includes.h>
19 #include <net-snmp/agent/net-snmp-agent-includes.h>
20
21 /*
22 * include our parent header
23 */
24 #include "inetCidrRouteTable.h"
25
26 #include <net-snmp/agent/mib_modules.h>
27
28 #include "inetCidrRouteTable_interface.h"
29
30 netsnmp_feature_require(inetCidrRouteTable_container_get);
31 netsnmp_feature_require(inetCidrRouteTable_container_size);
32
33 const oid inetCidrRouteTable_oid[] = { INETCIDRROUTETABLE_OID };
34 const int inetCidrRouteTable_oid_size =
35 OID_LENGTH(inetCidrRouteTable_oid);
36
37 inetCidrRouteTable_registration inetCidrRouteTable_user_context;
38 static inetCidrRouteTable_registration *inetCidrRouteTable_user_context_p;
39
40 void initialize_table_inetCidrRouteTable(void);
41 void shutdown_table_inetCidrRouteTable(void);
42
43 int
44 _route_number_handler(netsnmp_mib_handler *handler,
45 netsnmp_handler_registration *reginfo,
46 netsnmp_agent_request_info *reqinfo,
47 netsnmp_request_info *requests);
48
49
50 /**
51 * Initializes the inetCidrRouteTable module
52 */
53 void
54 init_inetCidrRouteTable(void)
55 {
56 DEBUGMSGTL(("verbose:inetCidrRouteTable:init_inetCidrRouteTable",
57 "called\n"));
58
59 /*
60 * TODO:300:o: Perform inetCidrRouteTable one-time module initialization.
61 */
62
63 /*
64 * here we initialize all the tables we're planning on supporting
65 */
66 if (should_init("inetCidrRouteTable"))
67 initialize_table_inetCidrRouteTable();
68
69 } /* init_inetCidrRouteTable */
70
71 /**
72 * Shut-down the inetCidrRouteTable module (agent is exiting)
73 */
74 void
75 shutdown_inetCidrRouteTable(void)
76 {
77 if (should_init("inetCidrRouteTable"))
78 shutdown_table_inetCidrRouteTable();
79
80 }
81
82 /**
83 * Initialize the table inetCidrRouteTable
84 * (Define its contents and how it's structured)
85 */
86 void
87 initialize_table_inetCidrRouteTable(void)
88 {
89 u_long flags;
90
91 DEBUGMSGTL(("verbose:inetCidrRouteTable:initialize_table_inetCidrRouteTable", "called\n"));
92
93 /*
94 * TODO:301:o: Perform inetCidrRouteTable one-time table initialization.
95 */
96
97 /*
98 * TODO:302:o: |->Initialize inetCidrRouteTable user context
99 * if you'd like to pass in a pointer to some data for this
100 * table, allocate or set it up here.
101 */
102 /*
103 * a netsnmp_data_list is a simple way to store void pointers. A simple
104 * string token is used to add, find or remove pointers.
105 */
106 inetCidrRouteTable_user_context_p =
107 netsnmp_create_data_list("inetCidrRouteTable", NULL, NULL);
108
109 /*
110 * No support for any flags yet, but in the future you would
111 * set any flags here.
112 */
113 flags = 0;
114
115 /*
116 * call interface initialization code
117 */
118 _inetCidrRouteTable_initialize_interface
119 (inetCidrRouteTable_user_context_p, flags);
120
121 /*
122 * regester scalar for route number
123 */
124 {
125 oid reg_oid[] =
126 { INETCIDRROUTENUMBER_OID };
127 netsnmp_handler_registration *myreg;
128 netsnmp_mib_handler *handler;
129
130 myreg =
131 netsnmp_create_handler_registration("route number",
132 _route_number_handler,
133 reg_oid,
134 OID_LENGTH(reg_oid),
135 HANDLER_CAN_RONLY);
136 /*
137 * snarf cache to use w/cache handler to make sure the
138 * container is loaded w/up to date data.
139 */
140 netsnmp_assert(NULL != inetCidrRouteTable_get_cache());
141 handler =
142 netsnmp_cache_handler_get(inetCidrRouteTable_get_cache());
143 netsnmp_inject_handler(myreg, handler);
144
145 netsnmp_register_instance(myreg);
146 }
147 } /* initialize_table_inetCidrRouteTable */
148
149 /**
150 * Shutdown the table inetCidrRouteTable
151 */
152 void
153 shutdown_table_inetCidrRouteTable(void)
154 {
155 /*
156 * call interface shutdown code
157 */
158 _inetCidrRouteTable_shutdown_interface
159 (inetCidrRouteTable_user_context_p);
160 netsnmp_free_all_list_data(inetCidrRouteTable_user_context_p);
161 inetCidrRouteTable_user_context_p = NULL;
162 }
163
164 /**
165 * extra context initialization (eg default values)
166 *
167 * @param rowreq_ctx : row request context
168 * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
169 *
170 * @retval MFD_SUCCESS : no errors
171 * @retval MFD_ERROR : error (context allocate will fail)
172 */
173 int
174 inetCidrRouteTable_rowreq_ctx_init(inetCidrRouteTable_rowreq_ctx *
175 rowreq_ctx, void *user_init_ctx)
176 {
177 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_rowreq_ctx_init", "called\n"));
178
179 netsnmp_assert(NULL != rowreq_ctx);
180
181 /*
182 * TODO:210:o: |-> Perform extra inetCidrRouteTable rowreq initialization. (eg DEFVALS)
183 */
184 rowreq_ctx->data->rt_nexthop_type = 0;
185
186 rowreq_ctx->data->rt_metric1 = -1;
187
188 rowreq_ctx->data->rt_metric2 = -1;
189
190 rowreq_ctx->data->rt_metric3 = -1;
191
192 rowreq_ctx->data->rt_metric4 = -1;
193
194 rowreq_ctx->data->rt_metric5 = -1;
195
196
197 return MFD_SUCCESS;
198 } /* inetCidrRouteTable_rowreq_ctx_init */
199
200 /**
201 * extra context cleanup
202 *
203 */
204 void
205 inetCidrRouteTable_rowreq_ctx_cleanup(inetCidrRouteTable_rowreq_ctx *
206 rowreq_ctx)
207 {
208 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_rowreq_ctx_cleanup", "called\n"));
209
210 netsnmp_assert(NULL != rowreq_ctx);
211
212 /*
213 * TODO:211:o: |-> Perform extra inetCidrRouteTable rowreq cleanup.
214 */
215 if (NULL != rowreq_ctx->data) {
216 inetCidrRouteTable_release_data(rowreq_ctx->data);
217 rowreq_ctx->data = NULL;
218 }
219 } /* inetCidrRouteTable_rowreq_ctx_cleanup */
220
221 /**
222 * pre-request callback
223 *
224 *
225 * @retval MFD_SUCCESS : success.
226 * @retval MFD_ERROR : other error
227 */
228 int
229 inetCidrRouteTable_pre_request(inetCidrRouteTable_registration *
230 user_context)
231 {
232 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_pre_request", "called\n"));
233
234 /*
235 * TODO:510:o: Perform inetCidrRouteTable pre-request actions.
236 */
237
238 return MFD_SUCCESS;
239 } /* inetCidrRouteTable_pre_request */
240
241 /**
242 * post-request callback
243 *
244 * Note:
245 * New rows have been inserted into the container, and
246 * deleted rows have been removed from the container and
247 * released.
248 *
249 * @param user_context
250 * @param rc : MFD_SUCCESS if all requests succeeded
251 *
252 * @retval MFD_SUCCESS : success.
253 * @retval MFD_ERROR : other error (ignored)
254 */
255 int
256 inetCidrRouteTable_post_request(inetCidrRouteTable_registration *
257 user_context, int rc)
258 {
259 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_post_request", "called\n"));
260
261 /*
262 * TODO:511:o: Perform inetCidrRouteTable post-request actions.
263 */
264
265 /*
266 * check to set if any rows were changed.
267 */
268 if (inetCidrRouteTable_dirty_get()) {
269 /*
270 * check if request was successful. If so, this would be
271 * a good place to save data to its persistent store.
272 */
273 if (MFD_SUCCESS == rc) {
274 /*
275 * save changed rows, if you haven't already
276 */
277 }
278
279 inetCidrRouteTable_dirty_set(0); /* clear table dirty flag */
280 }
281
282 return MFD_SUCCESS;
283 } /* inetCidrRouteTable_post_request */
284
285
286 /**********************************************************************
287 **********************************************************************
288 ***
289 *** Table inetCidrRouteTable
290 ***
291 **********************************************************************
292 **********************************************************************/
293 /*
294 * IP-FORWARD-MIB::inetCidrRouteTable is subid 7 of ipForward.
295 * Its status is Current.
296 * OID: .1.3.6.1.2.1.4.24.7, length: 9
297 */
298
299 /*
300 * ---------------------------------------------------------------------
301 * * TODO:200:r: Implement inetCidrRouteTable data context functions.
302 */
303 /*
304 * inetCidrRouteTable_allocate_data
305 *
306 * Purpose: create new inetCidrRouteTable_data->
307 */
308 inetCidrRouteTable_data *
309 inetCidrRouteTable_allocate_data(void)
310 {
311 /*
312 * TODO:201:r: |-> allocate memory for the inetCidrRouteTable data context.
313 */
314 inetCidrRouteTable_data *rtn = netsnmp_access_route_entry_create();
315
316 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_allocate_data", "called\n"));
317
318 if (NULL == rtn) {
319 snmp_log(LOG_ERR, "unable to malloc memory for new "
320 "inetCidrRouteTable_data->\n");
321 }
322
323 return rtn;
324 } /* inetCidrRouteTable_allocate_data */
325
326 /*
327 * inetCidrRouteTable_release_data
328 *
329 * Purpose: release inetCidrRouteTable data->
330 */
331 void
332 inetCidrRouteTable_release_data(inetCidrRouteTable_data * data)
333 {
334 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_release_data", "called\n"));
335
336 /*
337 * TODO:202:r: |-> release memory for the inetCidrRouteTable data context.
338 */
339 netsnmp_access_route_entry_free(data);
340 } /* inetCidrRouteTable_release_data */
341
342
343
344 /**
345 * set mib index(es)
346 *
347 * @param tbl_idx mib index structure
348 * @param inetCidrRouteDestType_val
349 * @param inetCidrRouteDest_val_ptr
350 * @param inetCidrRouteDest_val_ptr_len
351 * @param inetCidrRoutePfxLen_val
352 * @param inetCidrRoutePolicy_val_ptr
353 * @param inetCidrRoutePolicy_val_ptr_len
354 * @param inetCidrRouteNextHopType_val
355 * @param inetCidrRouteNextHop_val_ptr
356 * @param inetCidrRouteNextHop_val_ptr_len
357 * @retval MFD_SUCCESS : success.
358 * @retval MFD_ERROR : other error.
359 *
360 * @remark
361 * This convenience function is useful for setting all the MIB index
362 * components with a single function call. It is assume that the C values
363 * have already been mapped from their native/rawformat to the MIB format.
364 */
365 int
366 inetCidrRouteTable_indexes_set_tbl_idx(inetCidrRouteTable_mib_index *
367 tbl_idx,
368 u_long inetCidrRouteDestType_val,
369 char *inetCidrRouteDest_val_ptr,
370 size_t
371 inetCidrRouteDest_val_ptr_len,
372 u_long inetCidrRoutePfxLen_val,
373 oid * inetCidrRoutePolicy_val_ptr,
374 size_t
375 inetCidrRoutePolicy_val_ptr_len,
376 u_long inetCidrRouteNextHopType_val,
377 char *inetCidrRouteNextHop_val_ptr,
378 size_t
379 inetCidrRouteNextHop_val_ptr_len)
380 {
381 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_indexes_set_tbl_idx", "called\n"));
382
383 /*
384 * inetCidrRouteDestType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
385 */
386 /** WARNING: this code might not work for netsnmp_route_entry */
387 tbl_idx->inetCidrRouteDestType = inetCidrRouteDestType_val;
388
389 /*
390 * inetCidrRouteDest(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
391 */
392 tbl_idx->inetCidrRouteDest_len = sizeof(tbl_idx->inetCidrRouteDest) / sizeof(tbl_idx->inetCidrRouteDest[0]); /* max length */
393 /** WARNING: this code might not work for netsnmp_route_entry */
394 /*
395 * make sure there is enough space for inetCidrRouteDest data
396 */
397 if (tbl_idx->inetCidrRouteDest_len < (inetCidrRouteDest_val_ptr_len)) {
398 snmp_log(LOG_ERR, "not enough space for value\n");
399 return MFD_ERROR;
400 }
401 tbl_idx->inetCidrRouteDest_len = inetCidrRouteDest_val_ptr_len;
402 memcpy(tbl_idx->inetCidrRouteDest, inetCidrRouteDest_val_ptr,
403 inetCidrRouteDest_val_ptr_len *
404 sizeof(inetCidrRouteDest_val_ptr[0]));
405
406 /*
407 * inetCidrRoutePfxLen(3)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
408 */
409 /** WARNING: this code might not work for netsnmp_route_entry */
410 tbl_idx->inetCidrRoutePfxLen = inetCidrRoutePfxLen_val;
411
412 /*
413 * inetCidrRoutePolicy(4)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
414 */
415 tbl_idx->inetCidrRoutePolicy_len = sizeof(tbl_idx->inetCidrRoutePolicy) / sizeof(tbl_idx->inetCidrRoutePolicy[0]);
416 /** WARNING: this code might not work for netsnmp_route_entry */
417 /*
418 * make sure there is enough space for inetCidrRoutePolicy data
419 */
420 if (inetCidrRoutePolicy_val_ptr_len > tbl_idx->inetCidrRoutePolicy_len *
421 sizeof(inetCidrRoutePolicy_val_ptr[0])) {
422 snmp_log(LOG_ERR,
423 "inetCidrRoutePolicy: Not enough space for value (%d < %d)\n",
424 (int)tbl_idx->inetCidrRoutePolicy_len,
425 (int)(inetCidrRoutePolicy_val_ptr_len / sizeof(inetCidrRoutePolicy_val_ptr[0])));
426 return MFD_ERROR;
427 }
428 if (0 == inetCidrRoutePolicy_val_ptr_len) {
429 inetCidrRoutePolicy_val_ptr_len = nullOidLen;
430 inetCidrRoutePolicy_val_ptr = nullOid;
431 }
432 tbl_idx->inetCidrRoutePolicy_len = inetCidrRoutePolicy_val_ptr_len / sizeof(oid);
433 memcpy(tbl_idx->inetCidrRoutePolicy, inetCidrRoutePolicy_val_ptr,
434 inetCidrRoutePolicy_val_ptr_len);
435
436 /*
437 * inetCidrRouteNextHopType(5)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
438 */
439 /** WARNING: this code might not work for netsnmp_route_entry */
440 tbl_idx->inetCidrRouteNextHopType = inetCidrRouteNextHopType_val;
441
442 /*
443 * inetCidrRouteNextHop(6)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
444 */
445 tbl_idx->inetCidrRouteNextHop_len = sizeof(tbl_idx->inetCidrRouteNextHop) / sizeof(tbl_idx->inetCidrRouteNextHop[0]); /* max length */
446 /** WARNING: this code might not work for netsnmp_route_entry */
447 /*
448 * make sure there is enough space for inetCidrRouteNextHop data
449 */
450 if (tbl_idx->inetCidrRouteNextHop_len < (inetCidrRouteNextHop_val_ptr_len /
451 sizeof(inetCidrRouteNextHop_val_ptr[0]))) {
452 snmp_log(LOG_ERR,
453 "inetCidrRouteNexthop: Not enough space for value (%d < %d)\n",
454 (int)tbl_idx->inetCidrRouteNextHop_len,
455 (int)(inetCidrRouteNextHop_val_ptr_len / sizeof(inetCidrRouteNextHop_val_ptr[0])));
456 return MFD_ERROR;
457 }
458 tbl_idx->inetCidrRouteNextHop_len = inetCidrRouteNextHop_val_ptr_len / sizeof(inetCidrRouteNextHop_val_ptr[0]);
459 memcpy(tbl_idx->inetCidrRouteNextHop, inetCidrRouteNextHop_val_ptr,
460 inetCidrRouteNextHop_val_ptr_len *
461 sizeof(inetCidrRouteNextHop_val_ptr[0]));
462
463
464 return MFD_SUCCESS;
465 } /* inetCidrRouteTable_indexes_set_tbl_idx */
466
467 /**
468 * @internal
469 * set row context indexes
470 *
471 * @param rowreq_ctx the row context that needs updated indexes
472 * @param inetCidrRouteDestType_val
473 * @param inetCidrRouteDest_val_ptr
474 * @param inetCidrRouteDest_val_ptr_len
475 * @param inetCidrRoutePfxLen_val
476 * @param inetCidrRoutePolicy_val_ptr
477 * @param inetCidrRoutePolicy_val_ptr_len
478 * @param inetCidrRouteNextHopType_val
479 * @param inetCidrRouteNextHop_val_ptr
480 * @param inetCidrRouteNextHop_val_ptr_len
481 *
482 * @retval MFD_SUCCESS : success.
483 * @retval MFD_ERROR : other error.
484 *
485 * @remark
486 * This function sets the mib indexs, then updates the oid indexs
487 * from the mib index.
488 */
489 int
490 inetCidrRouteTable_indexes_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
491 u_long inetCidrRouteDestType_val,
492 char *inetCidrRouteDest_val_ptr,
493 size_t inetCidrRouteDest_val_ptr_len,
494 u_long inetCidrRoutePfxLen_val,
495 oid * inetCidrRoutePolicy_val_ptr,
496 size_t inetCidrRoutePolicy_val_ptr_len,
497 u_long inetCidrRouteNextHopType_val,
498 char *inetCidrRouteNextHop_val_ptr,
499 size_t inetCidrRouteNextHop_val_ptr_len)
500 {
501 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_indexes_set", "called\n"));
502
503 if (MFD_SUCCESS !=
504 inetCidrRouteTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
505 inetCidrRouteDestType_val,
506 inetCidrRouteDest_val_ptr,
507 inetCidrRouteDest_val_ptr_len,
508 inetCidrRoutePfxLen_val,
509 inetCidrRoutePolicy_val_ptr,
510 inetCidrRoutePolicy_val_ptr_len,
511 inetCidrRouteNextHopType_val,
512 inetCidrRouteNextHop_val_ptr,
513 inetCidrRouteNextHop_val_ptr_len))
514 return MFD_ERROR;
515
516 /*
517 * convert mib index to oid index
518 */
519 rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
520 if (0 != inetCidrRouteTable_index_to_oid(&rowreq_ctx->oid_idx,
521 &rowreq_ctx->tbl_idx)) {
522 return MFD_ERROR;
523 }
524
525 return MFD_SUCCESS;
526 } /* inetCidrRouteTable_indexes_set */
527
528
529 /*---------------------------------------------------------------------
530 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteIfIndex
531 * inetCidrRouteIfIndex is subid 7 of inetCidrRouteEntry.
532 * Its status is Current, and its access level is Create.
533 * OID: .1.3.6.1.2.1.4.24.7.1.7
534 * Description:
535 The ifIndex value which identifies the local interface
536 through which the next hop of this route should be
537 reached. A value of 0 is valid and represents the
538 scenario where no interface is specified.
539 *
540 * Attributes:
541 * accessible 1 isscalar 0 enums 0 hasdefval 0
542 * readable 1 iscolumn 1 ranges 1 hashint 1
543 * settable 1
544 * hint: d
545 *
546 * Ranges: 0 - 2147483647;
547 *
548 * Its syntax is InterfaceIndexOrZero (based on perltype INTEGER32)
549 * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
550 */
551 /**
552 * Extract the current value of the inetCidrRouteIfIndex data->
553 *
554 * Set a value using the data context for the row.
555 *
556 * @param rowreq_ctx
557 * Pointer to the row request context.
558 * @param inetCidrRouteIfIndex_val_ptr
559 * Pointer to storage for a long variable
560 *
561 * @retval MFD_SUCCESS : success
562 * @retval MFD_SKIP : skip this node (no value for now)
563 * @retval MFD_ERROR : Any other error
564 */
565 int
566 inetCidrRouteIfIndex_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
567 long *inetCidrRouteIfIndex_val_ptr)
568 {
569 /** we should have a non-NULL pointer */
570 netsnmp_assert(NULL != inetCidrRouteIfIndex_val_ptr);
571
572
573 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteIfIndex_get",
574 "called\n"));
575
576 netsnmp_assert(NULL != rowreq_ctx);
577
578 /*
579 * TODO:231:o: |-> Extract the current value of the inetCidrRouteIfIndex data->
580 * copy (* inetCidrRouteIfIndex_val_ptr ) from rowreq_ctx->data
581 */
582 /*
583 * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteIfIndex data
584 */
585 (*inetCidrRouteIfIndex_val_ptr) = rowreq_ctx->data->if_index;
586
587 return MFD_SUCCESS;
588 } /* inetCidrRouteIfIndex_get */
589
590 /*---------------------------------------------------------------------
591 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteType
592 * inetCidrRouteType is subid 8 of inetCidrRouteEntry.
593 * Its status is Current, and its access level is Create.
594 * OID: .1.3.6.1.2.1.4.24.7.1.8
595 * Description:
596 The type of route. Note that local(3) refers to a
597 route for which the next hop is the final destination;
598 remote(4)refers to a route for which the next hop is
599 not the final destination.
600
601 Routes which do not result in traffic forwarding or
602 rejection should not be displayed even if the
603 implementation keeps them stored internally.
604
605 reject(2) refers to a route which, if matched, discards
606 the message as unreachable and returns a notification
607 (e.g. ICMP error) to the message sender. This is used
608 in some protocols as a means of correctly aggregating
609 routes.
610
611 blackhole(5) refers to a route which, if matched,
612 discards the message silently.
613 *
614 * Attributes:
615 * accessible 1 isscalar 0 enums 1 hasdefval 0
616 * readable 1 iscolumn 1 ranges 0 hashint 0
617 * settable 1
618 *
619 * Enum range: 3/8. Values: other(1), reject(2), local(3), remote(4), blackhole(5)
620 *
621 * Its syntax is INTEGER (based on perltype INTEGER)
622 * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
623 */
624 /**
625 * Extract the current value of the inetCidrRouteType data->
626 *
627 * Set a value using the data context for the row.
628 *
629 * @param rowreq_ctx
630 * Pointer to the row request context.
631 * @param inetCidrRouteType_val_ptr
632 * Pointer to storage for a long variable
633 *
634 * @retval MFD_SUCCESS : success
635 * @retval MFD_SKIP : skip this node (no value for now)
636 * @retval MFD_ERROR : Any other error
637 */
638 int
639 inetCidrRouteType_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
640 u_long * inetCidrRouteType_val_ptr)
641 {
642 /** we should have a non-NULL pointer */
643 netsnmp_assert(NULL != inetCidrRouteType_val_ptr);
644
645
646 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteType_get",
647 "called\n"));
648
649 netsnmp_assert(NULL != rowreq_ctx);
650
651 /*
652 * TODO:231:o: |-> Extract the current value of the inetCidrRouteType data->
653 * copy (* inetCidrRouteType_val_ptr ) from rowreq_ctx->data
654 */
655 /*
656 * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteType data
657 */
658 (*inetCidrRouteType_val_ptr) = rowreq_ctx->data->rt_type;
659
660 return MFD_SUCCESS;
661 } /* inetCidrRouteType_get */
662
663 /*---------------------------------------------------------------------
664 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteProto
665 * inetCidrRouteProto is subid 9 of inetCidrRouteEntry.
666 * Its status is Current, and its access level is ReadOnly.
667 * OID: .1.3.6.1.2.1.4.24.7.1.9
668 * Description:
669 The routing mechanism via which this route was learned.
670 Inclusion of values for gateway routing protocols is
671 not intended to imply that hosts should support those
672 protocols.
673 *
674 * Attributes:
675 * accessible 1 isscalar 0 enums 1 hasdefval 0
676 * readable 1 iscolumn 1 ranges 0 hashint 0
677 * settable 0
678 *
679 * Enum range: 13/32. Values: other(1), local(2), netmgmt(3), icmp(4), egp(5), ggp(6), hello(7), rip(8), isIs(9), esIs(10), ciscoIgrp(11), bbnSpfIgp(12), ospf(13), bgp(14), idpr(15), ciscoEigrp(16), dvmrp(17)
680 *
681 * Its syntax is IANAipRouteProtocol (based on perltype INTEGER)
682 * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
683 */
684 /**
685 * Extract the current value of the inetCidrRouteProto data->
686 *
687 * Set a value using the data context for the row.
688 *
689 * @param rowreq_ctx
690 * Pointer to the row request context.
691 * @param inetCidrRouteProto_val_ptr
692 * Pointer to storage for a long variable
693 *
694 * @retval MFD_SUCCESS : success
695 * @retval MFD_SKIP : skip this node (no value for now)
696 * @retval MFD_ERROR : Any other error
697 */
698 int
699 inetCidrRouteProto_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
700 u_long * inetCidrRouteProto_val_ptr)
701 {
702 /** we should have a non-NULL pointer */
703 netsnmp_assert(NULL != inetCidrRouteProto_val_ptr);
704
705
706 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteProto_get",
707 "called\n"));
708
709 netsnmp_assert(NULL != rowreq_ctx);
710
711 /*
712 * TODO:231:o: |-> Extract the current value of the inetCidrRouteProto data->
713 * copy (* inetCidrRouteProto_val_ptr ) from rowreq_ctx->data
714 */
715 /*
716 * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteProto data
717 */
718 (*inetCidrRouteProto_val_ptr) = rowreq_ctx->data->rt_proto;
719
720 return MFD_SUCCESS;
721 } /* inetCidrRouteProto_get */
722
723 /*---------------------------------------------------------------------
724 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteAge
725 * inetCidrRouteAge is subid 10 of inetCidrRouteEntry.
726 * Its status is Current, and its access level is ReadOnly.
727 * OID: .1.3.6.1.2.1.4.24.7.1.10
728 * Description:
729 The number of seconds since this route was last updated
730 or otherwise determined to be correct. Note that no
731 semantics of 'too old' can be implied except through
732 knowledge of the routing protocol by which the route
733 was learned.
734 *
735 * Attributes:
736 * accessible 1 isscalar 0 enums 0 hasdefval 0
737 * readable 1 iscolumn 1 ranges 0 hashint 0
738 * settable 0
739 *
740 *
741 * Its syntax is GAUGE (based on perltype GAUGE)
742 * The net-snmp type is ASN_GAUGE. The C type decl is u_long (u_long)
743 */
744 /**
745 * Extract the current value of the inetCidrRouteAge data->
746 *
747 * Set a value using the data context for the row.
748 *
749 * @param rowreq_ctx
750 * Pointer to the row request context.
751 * @param inetCidrRouteAge_val_ptr
752 * Pointer to storage for a u_long variable
753 *
754 * @retval MFD_SUCCESS : success
755 * @retval MFD_SKIP : skip this node (no value for now)
756 * @retval MFD_ERROR : Any other error
757 */
758 int
759 inetCidrRouteAge_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
760 u_long * inetCidrRouteAge_val_ptr)
761 {
762 /** we should have a non-NULL pointer */
763 netsnmp_assert(NULL != inetCidrRouteAge_val_ptr);
764
765
766 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteAge_get",
767 "called\n"));
768
769 netsnmp_assert(NULL != rowreq_ctx);
770
771 /*
772 * TODO:231:o: |-> Extract the current value of the inetCidrRouteAge data->
773 * copy (* inetCidrRouteAge_val_ptr ) from rowreq_ctx->data
774 */
775 /*
776 * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteAge data
777 */
778 (*inetCidrRouteAge_val_ptr) = rowreq_ctx->data->rt_age;
779
780 return MFD_SUCCESS;
781 } /* inetCidrRouteAge_get */
782
783 /*---------------------------------------------------------------------
784 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteNextHopAS
785 * inetCidrRouteNextHopAS is subid 11 of inetCidrRouteEntry.
786 * Its status is Current, and its access level is Create.
787 * OID: .1.3.6.1.2.1.4.24.7.1.11
788 * Description:
789 The Autonomous System Number of the Next Hop. The
790 semantics of this object are determined by the routing-
791 protocol specified in the route's inetCidrRouteProto
792 value. When this object is unknown or not relevant its
793 value should be set to zero.
794 *
795 * Attributes:
796 * accessible 1 isscalar 0 enums 0 hasdefval 1
797 * readable 1 iscolumn 1 ranges 0 hashint 1
798 * settable 1
799 * defval: 0
800 * hint: d
801 *
802 *
803 * Its syntax is InetAutonomousSystemNumber (based on perltype UNSIGNED32)
804 * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
805 */
806 /**
807 * Extract the current value of the inetCidrRouteNextHopAS data->
808 *
809 * Set a value using the data context for the row.
810 *
811 * @param rowreq_ctx
812 * Pointer to the row request context.
813 * @param inetCidrRouteNextHopAS_val_ptr
814 * Pointer to storage for a u_long variable
815 *
816 * @retval MFD_SUCCESS : success
817 * @retval MFD_SKIP : skip this node (no value for now)
818 * @retval MFD_ERROR : Any other error
819 */
820 int
821 inetCidrRouteNextHopAS_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
822 u_long * inetCidrRouteNextHopAS_val_ptr)
823 {
824 /** we should have a non-NULL pointer */
825 netsnmp_assert(NULL != inetCidrRouteNextHopAS_val_ptr);
826
827
828 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteNextHopAS_get",
829 "called\n"));
830
831 netsnmp_assert(NULL != rowreq_ctx);
832
833 /*
834 * TODO:231:o: |-> Extract the current value of the inetCidrRouteNextHopAS data->
835 * copy (* inetCidrRouteNextHopAS_val_ptr ) from rowreq_ctx->data
836 */
837 /*
838 * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteNextHopAS data
839 */
840 (*inetCidrRouteNextHopAS_val_ptr) = rowreq_ctx->data->rt_nexthop_as;
841
842 return MFD_SUCCESS;
843 } /* inetCidrRouteNextHopAS_get */
844
845 /*---------------------------------------------------------------------
846 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric1
847 * inetCidrRouteMetric1 is subid 12 of inetCidrRouteEntry.
848 * Its status is Current, and its access level is Create.
849 * OID: .1.3.6.1.2.1.4.24.7.1.12
850 * Description:
851 The primary routing metric for this route. The
852 semantics of this metric are determined by the routing-
853 protocol specified in the route's inetCidrRouteProto
854 value. If this metric is not used, its value should be
855 set to -1.
856 *
857 * Attributes:
858 * accessible 1 isscalar 0 enums 0 hasdefval 1
859 * readable 1 iscolumn 1 ranges 0 hashint 0
860 * settable 1
861 * defval: -1
862 *
863 *
864 * Its syntax is INTEGER32 (based on perltype INTEGER32)
865 * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
866 */
867 /**
868 * Extract the current value of the inetCidrRouteMetric1 data->
869 *
870 * Set a value using the data context for the row.
871 *
872 * @param rowreq_ctx
873 * Pointer to the row request context.
874 * @param inetCidrRouteMetric1_val_ptr
875 * Pointer to storage for a long variable
876 *
877 * @retval MFD_SUCCESS : success
878 * @retval MFD_SKIP : skip this node (no value for now)
879 * @retval MFD_ERROR : Any other error
880 */
881 int
882 inetCidrRouteMetric1_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
883 long *inetCidrRouteMetric1_val_ptr)
884 {
885 /** we should have a non-NULL pointer */
886 netsnmp_assert(NULL != inetCidrRouteMetric1_val_ptr);
887
888
889 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric1_get",
890 "called\n"));
891
892 netsnmp_assert(NULL != rowreq_ctx);
893
894 /*
895 * TODO:231:o: |-> Extract the current value of the inetCidrRouteMetric1 data->
896 * copy (* inetCidrRouteMetric1_val_ptr ) from rowreq_ctx->data
897 */
898 /*
899 * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteMetric1 data
900 */
901 (*inetCidrRouteMetric1_val_ptr) = rowreq_ctx->data->rt_metric1;
902
903 return MFD_SUCCESS;
904 } /* inetCidrRouteMetric1_get */
905
906 /*---------------------------------------------------------------------
907 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric2
908 * inetCidrRouteMetric2 is subid 13 of inetCidrRouteEntry.
909 * Its status is Current, and its access level is Create.
910 * OID: .1.3.6.1.2.1.4.24.7.1.13
911 * Description:
912 An alternate routing metric for this route. The
913 semantics of this metric are determined by the routing-
914 protocol specified in the route's inetCidrRouteProto
915 value. If this metric is not used, its value should be
916 set to -1.
917 *
918 * Attributes:
919 * accessible 1 isscalar 0 enums 0 hasdefval 1
920 * readable 1 iscolumn 1 ranges 0 hashint 0
921 * settable 1
922 * defval: -1
923 *
924 *
925 * Its syntax is INTEGER32 (based on perltype INTEGER32)
926 * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
927 */
928 /**
929 * Extract the current value of the inetCidrRouteMetric2 data->
930 *
931 * Set a value using the data context for the row.
932 *
933 * @param rowreq_ctx
934 * Pointer to the row request context.
935 * @param inetCidrRouteMetric2_val_ptr
936 * Pointer to storage for a long variable
937 *
938 * @retval MFD_SUCCESS : success
939 * @retval MFD_SKIP : skip this node (no value for now)
940 * @retval MFD_ERROR : Any other error
941 */
942 int
943 inetCidrRouteMetric2_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
944 long *inetCidrRouteMetric2_val_ptr)
945 {
946 /** we should have a non-NULL pointer */
947 netsnmp_assert(NULL != inetCidrRouteMetric2_val_ptr);
948
949
950 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric2_get",
951 "called\n"));
952
953 netsnmp_assert(NULL != rowreq_ctx);
954
955 /*
956 * TODO:231:o: |-> Extract the current value of the inetCidrRouteMetric2 data->
957 * copy (* inetCidrRouteMetric2_val_ptr ) from rowreq_ctx->data
958 */
959 /*
960 * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteMetric2 data
961 */
962 (*inetCidrRouteMetric2_val_ptr) = rowreq_ctx->data->rt_metric2;
963
964 return MFD_SUCCESS;
965 } /* inetCidrRouteMetric2_get */
966
967 /*---------------------------------------------------------------------
968 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric3
969 * inetCidrRouteMetric3 is subid 14 of inetCidrRouteEntry.
970 * Its status is Current, and its access level is Create.
971 * OID: .1.3.6.1.2.1.4.24.7.1.14
972 * Description:
973 An alternate routing metric for this route. The
974 semantics of this metric are determined by the routing-
975 protocol specified in the route's inetCidrRouteProto
976 value. If this metric is not used, its value should be
977 set to -1.
978 *
979 * Attributes:
980 * accessible 1 isscalar 0 enums 0 hasdefval 1
981 * readable 1 iscolumn 1 ranges 0 hashint 0
982 * settable 1
983 * defval: -1
984 *
985 *
986 * Its syntax is INTEGER32 (based on perltype INTEGER32)
987 * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
988 */
989 /**
990 * Extract the current value of the inetCidrRouteMetric3 data->
991 *
992 * Set a value using the data context for the row.
993 *
994 * @param rowreq_ctx
995 * Pointer to the row request context.
996 * @param inetCidrRouteMetric3_val_ptr
997 * Pointer to storage for a long variable
998 *
999 * @retval MFD_SUCCESS : success
1000 * @retval MFD_SKIP : skip this node (no value for now)
1001 * @retval MFD_ERROR : Any other error
1002 */
1003 int
1004 inetCidrRouteMetric3_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
1005 long *inetCidrRouteMetric3_val_ptr)
1006 {
1007 /** we should have a non-NULL pointer */
1008 netsnmp_assert(NULL != inetCidrRouteMetric3_val_ptr);
1009
1010
1011 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric3_get",
1012 "called\n"));
1013
1014 netsnmp_assert(NULL != rowreq_ctx);
1015
1016 /*
1017 * TODO:231:o: |-> Extract the current value of the inetCidrRouteMetric3 data->
1018 * copy (* inetCidrRouteMetric3_val_ptr ) from rowreq_ctx->data
1019 */
1020 /*
1021 * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteMetric3 data
1022 */
1023 (*inetCidrRouteMetric3_val_ptr) = rowreq_ctx->data->rt_metric3;
1024
1025 return MFD_SUCCESS;
1026 } /* inetCidrRouteMetric3_get */
1027
1028 /*---------------------------------------------------------------------
1029 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric4
1030 * inetCidrRouteMetric4 is subid 15 of inetCidrRouteEntry.
1031 * Its status is Current, and its access level is Create.
1032 * OID: .1.3.6.1.2.1.4.24.7.1.15
1033 * Description:
1034 An alternate routing metric for this route. The
1035 semantics of this metric are determined by the routing-
1036 protocol specified in the route's inetCidrRouteProto
1037 value. If this metric is not used, its value should be
1038 set to -1.
1039 *
1040 * Attributes:
1041 * accessible 1 isscalar 0 enums 0 hasdefval 1
1042 * readable 1 iscolumn 1 ranges 0 hashint 0
1043 * settable 1
1044 * defval: -1
1045 *
1046 *
1047 * Its syntax is INTEGER32 (based on perltype INTEGER32)
1048 * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
1049 */
1050 /**
1051 * Extract the current value of the inetCidrRouteMetric4 data->
1052 *
1053 * Set a value using the data context for the row.
1054 *
1055 * @param rowreq_ctx
1056 * Pointer to the row request context.
1057 * @param inetCidrRouteMetric4_val_ptr
1058 * Pointer to storage for a long variable
1059 *
1060 * @retval MFD_SUCCESS : success
1061 * @retval MFD_SKIP : skip this node (no value for now)
1062 * @retval MFD_ERROR : Any other error
1063 */
1064 int
1065 inetCidrRouteMetric4_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
1066 long *inetCidrRouteMetric4_val_ptr)
1067 {
1068 /** we should have a non-NULL pointer */
1069 netsnmp_assert(NULL != inetCidrRouteMetric4_val_ptr);
1070
1071
1072 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric4_get",
1073 "called\n"));
1074
1075 netsnmp_assert(NULL != rowreq_ctx);
1076
1077 /*
1078 * TODO:231:o: |-> Extract the current value of the inetCidrRouteMetric4 data->
1079 * copy (* inetCidrRouteMetric4_val_ptr ) from rowreq_ctx->data
1080 */
1081 /*
1082 * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteMetric4 data
1083 */
1084 (*inetCidrRouteMetric4_val_ptr) = rowreq_ctx->data->rt_metric4;
1085
1086 return MFD_SUCCESS;
1087 } /* inetCidrRouteMetric4_get */
1088
1089 /*---------------------------------------------------------------------
1090 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric5
1091 * inetCidrRouteMetric5 is subid 16 of inetCidrRouteEntry.
1092 * Its status is Current, and its access level is Create.
1093 * OID: .1.3.6.1.2.1.4.24.7.1.16
1094 * Description:
1095 An alternate routing metric for this route. The
1096 semantics of this metric are determined by the routing-
1097 protocol specified in the route's inetCidrRouteProto
1098 value. If this metric is not used, its value should be
1099 set to -1.
1100 *
1101 * Attributes:
1102 * accessible 1 isscalar 0 enums 0 hasdefval 1
1103 * readable 1 iscolumn 1 ranges 0 hashint 0
1104 * settable 1
1105 * defval: -1
1106 *
1107 *
1108 * Its syntax is INTEGER32 (based on perltype INTEGER32)
1109 * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
1110 */
1111 /**
1112 * Extract the current value of the inetCidrRouteMetric5 data->
1113 *
1114 * Set a value using the data context for the row.
1115 *
1116 * @param rowreq_ctx
1117 * Pointer to the row request context.
1118 * @param inetCidrRouteMetric5_val_ptr
1119 * Pointer to storage for a long variable
1120 *
1121 * @retval MFD_SUCCESS : success
1122 * @retval MFD_SKIP : skip this node (no value for now)
1123 * @retval MFD_ERROR : Any other error
1124 */
1125 int
1126 inetCidrRouteMetric5_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
1127 long *inetCidrRouteMetric5_val_ptr)
1128 {
1129 /** we should have a non-NULL pointer */
1130 netsnmp_assert(NULL != inetCidrRouteMetric5_val_ptr);
1131
1132
1133 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric5_get",
1134 "called\n"));
1135
1136 netsnmp_assert(NULL != rowreq_ctx);
1137
1138 /*
1139 * TODO:231:o: |-> Extract the current value of the inetCidrRouteMetric5 data->
1140 * copy (* inetCidrRouteMetric5_val_ptr ) from rowreq_ctx->data
1141 */
1142 /*
1143 * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteMetric5 data
1144 */
1145 (*inetCidrRouteMetric5_val_ptr) = rowreq_ctx->data->rt_metric5;
1146
1147 return MFD_SUCCESS;
1148 } /* inetCidrRouteMetric5_get */
1149
1150 /*---------------------------------------------------------------------
1151 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteStatus
1152 * inetCidrRouteStatus is subid 17 of inetCidrRouteEntry.
1153 * Its status is Current, and its access level is Create.
1154 * OID: .1.3.6.1.2.1.4.24.7.1.17
1155 * Description:
1156 The row status variable, used according to row
1157 installation and removal conventions.
1158
1159 A row entry cannot be modified when the status is
1160 marked as active(1).
1161 *
1162 * Attributes:
1163 * accessible 1 isscalar 0 enums 1 hasdefval 0
1164 * readable 1 iscolumn 1 ranges 0 hashint 0
1165 * settable 1
1166 *
1167 * Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
1168 *
1169 * Its syntax is RowStatus (based on perltype INTEGER)
1170 * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
1171 */
1172 /**
1173 * Extract the current value of the inetCidrRouteStatus data->
1174 *
1175 * Set a value using the data context for the row.
1176 *
1177 * @param rowreq_ctx
1178 * Pointer to the row request context.
1179 * @param inetCidrRouteStatus_val_ptr
1180 * Pointer to storage for a long variable
1181 *
1182 * @retval MFD_SUCCESS : success
1183 * @retval MFD_SKIP : skip this node (no value for now)
1184 * @retval MFD_ERROR : Any other error
1185 */
1186 int
1187 inetCidrRouteStatus_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
1188 u_long * inetCidrRouteStatus_val_ptr)
1189 {
1190 /** we should have a non-NULL pointer */
1191 netsnmp_assert(NULL != inetCidrRouteStatus_val_ptr);
1192
1193 /** WARNING: this code might not work for netsnmp_route_entry */
1194 (*inetCidrRouteStatus_val_ptr) = rowreq_ctx->row_status;
1195
1196 return MFD_SUCCESS;
1197 } /* inetCidrRouteStatus_get */
1198
1199
1200
1201 /** @} */
1202 /**********************************************************************
1203 **********************************************************************
1204 ***
1205 *** Table inetCidrRouteTable
1206 ***
1207 **********************************************************************
1208 **********************************************************************/
1209 /*
1210 * IP-FORWARD-MIB::inetCidrRouteTable is subid 7 of ipForward.
1211 * Its status is Current.
1212 * OID: .1.3.6.1.2.1.4.24.7, length: 9
1213 */
1214 /*
1215 * NOTE: if you update this chart, please update the versions in
1216 * local/mib2c-conf.d/parent-set.m2i
1217 * agent/mibgroup/helpers/baby_steps.c
1218 * while you're at it.
1219 */
1220 /*
1221 ***********************************************************************
1222 * Baby Steps Flow Chart (2004.06.05) *
1223 * *
1224 * +--------------+ +================+ U = unconditional path *
1225 * |optional state| ||required state|| S = path for success *
1226 * +--------------+ +================+ E = path for error *
1227 ***********************************************************************
1228 *
1229 * +--------------+
1230 * | pre |
1231 * | request |
1232 * +--------------+
1233 * | U
1234 * +-------------+ +==============+
1235 * | row |f|<-------|| object ||
1236 * | create |1| E || lookup ||
1237 * +-------------+ +==============+
1238 * E | | S | S
1239 * | +------------------>|
1240 * | +==============+
1241 * | E || check ||
1242 * |<---------------|| values ||
1243 * | +==============+
1244 * | | S
1245 * | +==============+
1246 * | +<-------|| undo ||
1247 * | | E || setup ||
1248 * | | +==============+
1249 * | | | S
1250 * | | +==============+
1251 * | | || set ||-------------------------->+
1252 * | | || value || E |
1253 * | | +==============+ |
1254 * | | | S |
1255 * | | +--------------+ |
1256 * | | | check |-------------------------->|
1257 * | | | consistency | E |
1258 * | | +--------------+ |
1259 * | | | S |
1260 * | | +==============+ +==============+ |
1261 * | | || commit ||-------->|| undo || |
1262 * | | || || E || commit || |
1263 * | | +==============+ +==============+ |
1264 * | | | S U |<--------+
1265 * | | +--------------+ +==============+
1266 * | | | irreversible | || undo ||
1267 * | | | commit | || set ||
1268 * | | +--------------+ +==============+
1269 * | | | U U |
1270 * | +-------------->|<------------------------+
1271 * | +==============+
1272 * | || undo ||
1273 * | || cleanup ||
1274 * | +==============+
1275 * +---------------------->| U
1276 * |
1277 * (err && f1)------------------->+
1278 * | |
1279 * +--------------+ +--------------+
1280 * | post |<--------| row |
1281 * | request | U | release |
1282 * +--------------+ +--------------+
1283 *
1284 */
1285
1286 /**
1287 * Setup up context with information needed to undo a set request.
1288 *
1289 * This function will be called before the individual node undo setup
1290 * functions are called. If you need to do any undo setup that is not
1291 * related to a specific column, you can do it here.
1292 *
1293 * Note that the undo context has been allocated with
1294 * inetCidrRouteTable_allocate_data(), but may need extra
1295 * initialization similar to what you may have done in
1296 * inetCidrRouteTable_rowreq_ctx_init().
1297 * Note that an individual node's undo_setup function will only be called
1298 * if that node is being set to a new value.
1299 *
1300 * If there is any setup specific to a particular column (e.g. allocating
1301 * memory for a string), you should do that setup in the node's undo_setup
1302 * function, so it won't be done unless it is necessary.
1303 *
1304 * @param rowreq_ctx
1305 * Pointer to the table context (inetCidrRouteTable_rowreq_ctx)
1306 *
1307 * @retval MFD_SUCCESS : success
1308 * @retval MFD_ERROR : error. set will fail.
1309 */
1310 int
1311 inetCidrRouteTable_undo_setup(inetCidrRouteTable_rowreq_ctx * rowreq_ctx)
1312 {
1313 int rc = MFD_SUCCESS;
1314
1315 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_undo_setup",
1316 "called\n"));
1317
1318 /** we should have a non-NULL pointer */
1319 netsnmp_assert(NULL != rowreq_ctx);
1320
1321 /*
1322 * TODO:451:M: |-> Setup inetCidrRouteTable undo.
1323 * set up inetCidrRouteTable undo information, in preparation for a set.
1324 * Undo storage is in (* inetCidrRouteStatus_val_ptr )*
1325 */
1326 rowreq_ctx->row_status_undo = rowreq_ctx->row_status;
1327
1328 rc = netsnmp_access_route_entry_copy(rowreq_ctx->undo,
1329 rowreq_ctx->data);
1330
1331 return rc;
1332 } /* inetCidrRouteTable_undo_setup */
1333
1334 /**
1335 * Undo a set request.
1336 *
1337 * This function will be called before the individual node undo
1338 * functions are called. If you need to do any undo that is not
1339 * related to a specific column, you can do it here.
1340 *
1341 * Note that an individual node's undo function will only be called
1342 * if that node is being set to a new value.
1343 *
1344 * If there is anything specific to a particular column (e.g. releasing
1345 * memory for a string), you should do that setup in the node's undo
1346 * function, so it won't be done unless it is necessary.
1347 *
1348 * @param rowreq_ctx
1349 * Pointer to the table context (inetCidrRouteTable_rowreq_ctx)
1350 *
1351 * @retval MFD_SUCCESS : success
1352 * @retval MFD_ERROR : error. set will fail.
1353 */
1354 int
1355 inetCidrRouteTable_undo(inetCidrRouteTable_rowreq_ctx * rowreq_ctx)
1356 {
1357 int rc = MFD_SUCCESS;
1358
1359 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_undo",
1360 "called\n"));
1361
1362 /** we should have a non-NULL pointer */
1363 netsnmp_assert(NULL != rowreq_ctx);
1364
1365 /*
1366 * TODO:451:M: |-> inetCidrRouteTable undo.
1367 * inetCidrRouteTable undo information, in response to a failed set.
1368 * Undo storage is in (* inetCidrRouteStatus_val_ptr )*
1369 */
1370 rowreq_ctx->row_status = rowreq_ctx->row_status_undo;
1371
1372 rc = netsnmp_access_route_entry_copy(rowreq_ctx->data,
1373 rowreq_ctx->undo);
1374
1375 return rc;
1376 } /* inetCidrRouteTable_undo_setup */
1377
1378 /**
1379 * Cleanup up context undo information.
1380 *
1381 * This function will be called after set/commit processing. If you
1382 * allocated any resources in undo_setup, this is the place to release
1383 * those resources.
1384 *
1385 * This function is called regardless of the success or failure of the set
1386 * request. If you need to perform different steps for cleanup depending
1387 * on success or failure, you can add a flag to the rowreq_ctx.
1388 *
1389 * @param rowreq_ctx
1390 * Pointer to the table context (inetCidrRouteTable_rowreq_ctx)
1391 *
1392 * @retval MFD_SUCCESS : success
1393 * @retval MFD_ERROR : error
1394 */
1395 int
1396 inetCidrRouteTable_undo_cleanup(inetCidrRouteTable_rowreq_ctx * rowreq_ctx)
1397 {
1398 int rc = MFD_SUCCESS;
1399
1400 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_undo_cleanup", "called\n"));
1401
1402 /** we should have a non-NULL pointer */
1403 netsnmp_assert(NULL != rowreq_ctx);
1404
1405 /*
1406 * TODO:452:M: |-> Cleanup inetCidrRouteTable undo.
1407 * Undo storage is in (* inetCidrRouteStatus_val_ptr )*
1408 */
1409
1410 return rc;
1411 } /* inetCidrRouteTable_undo_cleanup */
1412
1413 /**
1414 * commit new values.
1415 *
1416 * At this point, you should have done everything you can to ensure that
1417 * this commit will not fail.
1418 *
1419 * Should you need different behavior depending on which columns were
1420 * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
1421 * set. The definitions for the COLUMN_*_FLAG bits can be found in
1422 * inetCidrRouteTable.h.
1423 * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
1424 *
1425 * @param rowreq_ctx
1426 * Pointer to the users context.
1427 *
1428 * @retval MFD_SUCCESS : success
1429 * @retval MFD_ERROR : error
1430 */
1431 int
1432 inetCidrRouteTable_commit(inetCidrRouteTable_rowreq_ctx * rowreq_ctx)
1433 {
1434 int rc = MFD_SUCCESS;
1435 int save_flags;
1436
1437 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_commit",
1438 "called\n"));
1439
1440 /** we should have a non-NULL pointer */
1441 netsnmp_assert(NULL != rowreq_ctx);
1442
1443 /*
1444 * save flags, then clear until we actually do something
1445 */
1446 save_flags = rowreq_ctx->column_set_flags;
1447 rowreq_ctx->column_set_flags = 0;
1448
1449 /*
1450 * commit inetCidrRouteTable data
1451 * 1) check the column's flag in save_flags to see if it was set.
1452 * 2) clear the flag when you handle that column
1453 * 3) set the column's flag in column_set_flags if it needs undo
1454 * processing in case of a failure.
1455 */
1456 /*
1457 * did anything change?
1458 */
1459 if (0 == save_flags) {
1460 DEBUGMSGTL(("ipAddressTable:ipAddressTable_commit",
1461 "no change\n"));
1462 return MFD_SUCCESS;
1463 }
1464
1465 /*
1466 * pass everything to data access
1467 */
1468 if (save_flags & COLUMN_INETCIDRROUTESTATUS_FLAG) {
1469 if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
1470 if (ROWSTATUS_DESTROY == rowreq_ctx->row_status) {
1471 rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
1472 return MFD_SUCCESS;
1473 }
1474 netsnmp_assert(ROWSTATUS_ACTIVE == rowreq_ctx->row_status);
1475 rowreq_ctx->data->flags |= NETSNMP_ACCESS_ROUTE_CREATE;
1476 } else if (ROWSTATUS_DESTROY == rowreq_ctx->row_status) {
1477 rowreq_ctx->data->flags |= NETSNMP_ACCESS_ROUTE_DELETE;
1478 } else
1479 rowreq_ctx->data->flags |= NETSNMP_ACCESS_ROUTE_CHANGE;
1480 } else
1481 rowreq_ctx->data->flags |= NETSNMP_ACCESS_ROUTE_CHANGE;
1482
1483 /*
1484 * do it
1485 * let data access know what columns are set
1486 */
1487 rowreq_ctx->data->flags |=
1488 (save_flags & NETSNMP_ACCESS_ROUTE_RESERVED_BITS);
1489 rc = netsnmp_access_route_entry_set(rowreq_ctx->data);
1490 if (rc) {
1491 snmp_log(LOG_ERR,
1492 "inetCidrRouteTable column inetCidrRouteStatus commit failed\n");
1493 rc = MFD_ERROR;
1494 } else {
1495 /*
1496 * set flag, in case we need to undo
1497 */
1498 rowreq_ctx->column_set_flags |= save_flags;
1499 }
1500
1501 /*
1502 * if we successfully committed this row, set the dirty flag.
1503 */
1504 if (MFD_SUCCESS == rc) {
1505 rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;
1506 }
1507
1508 return rc;
1509 } /* inetCidrRouteTable_commit */
1510
1511 /**
1512 * undo commit new values.
1513 *
1514 * Should you need different behavior depending on which columns were
1515 * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
1516 * set. The definitions for the COLUMN_*_FLAG bits can be found in
1517 * inetCidrRouteTable.h.
1518 * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
1519 *
1520 * @param rowreq_ctx
1521 * Pointer to the users context.
1522 *
1523 * @retval MFD_SUCCESS : success
1524 * @retval MFD_ERROR : error
1525 */
1526 int
1527 inetCidrRouteTable_undo_commit(inetCidrRouteTable_rowreq_ctx * rowreq_ctx)
1528 {
1529 int rc = MFD_SUCCESS;
1530
1531 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_undo_commit", "called\n"));
1532
1533 /** we should have a non-NULL pointer */
1534 netsnmp_assert(NULL != rowreq_ctx);
1535
1536 /*
1537 * TODO:485:M: |-> Undo inetCidrRouteTable commit.
1538 * check the column's flag in rowreq_ctx->column_set_flags to see
1539 * if it was set during commit, then undo it.
1540 *
1541 * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
1542 */
1543 if (rowreq_ctx->column_set_flags & COLUMN_INETCIDRROUTESTATUS_FLAG) {
1544 /*
1545 * if we created an addr, delete it. if we deleted it,
1546 * re-create it. If we changed it, change it back.
1547 */
1548 if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
1549 rowreq_ctx->undo->flags |= NETSNMP_ACCESS_ROUTE_DELETE;
1550 } else if (ROWSTATUS_DESTROY == rowreq_ctx->row_status) {
1551 rowreq_ctx->undo->flags |= NETSNMP_ACCESS_ROUTE_CREATE;
1552 } else
1553 rowreq_ctx->undo->flags |= NETSNMP_ACCESS_ROUTE_CHANGE;
1554 } else
1555 rowreq_ctx->undo->flags |= NETSNMP_ACCESS_ROUTE_CHANGE;
1556
1557 /*
1558 * do it
1559 */
1560 rc = netsnmp_access_route_entry_set(rowreq_ctx->undo);
1561 if (rc) {
1562 DEBUGMSGTL(("ipAddressTable",
1563 "bad rc %d from IP address data access\n", rc));
1564 rc = MFD_ERROR;
1565 }
1566
1567 /*
1568 * if we successfully un-committed this row, clear the dirty flag.
1569 */
1570 if (MFD_SUCCESS == rc) {
1571 rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
1572 }
1573
1574 return rc;
1575 } /* inetCidrRouteTable_undo_commit */
1576
1577 /*
1578 * TODO:440:M: Implement inetCidrRouteTable node value checks.
1579 * TODO:450:M: Implement inetCidrRouteTable undo functions.
1580 * TODO:460:M: Implement inetCidrRouteTable set functions.
1581 * TODO:480:M: Implement inetCidrRouteTable commit functions.
1582 */
1583 /*---------------------------------------------------------------------
1584 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteIfIndex
1585 * inetCidrRouteIfIndex is subid 7 of inetCidrRouteEntry.
1586 * Its status is Current, and its access level is Create.
1587 * OID: .1.3.6.1.2.1.4.24.7.1.7
1588 * Description:
1589 The ifIndex value which identifies the local interface
1590 through which the next hop of this route should be
1591 reached. A value of 0 is valid and represents the
1592 scenario where no interface is specified.
1593 *
1594 * Attributes:
1595 * accessible 1 isscalar 0 enums 0 hasdefval 0
1596 * readable 1 iscolumn 1 ranges 1 hashint 1
1597 * settable 1
1598 * hint: d
1599 *
1600 * Ranges: 0 - 2147483647;
1601 *
1602 * Its syntax is InterfaceIndexOrZero (based on perltype INTEGER32)
1603 * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
1604 */
1605 /**
1606 * Check that the proposed new value is potentially valid.
1607 *
1608 * @param rowreq_ctx
1609 * Pointer to the row request context.
1610 * @param inetCidrRouteIfIndex_val
1611 * A long containing the new value.
1612 *
1613 * @retval MFD_SUCCESS : incoming value is legal
1614 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
1615 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
1616 *
1617 * This is the place to check for requirements that are not
1618 * expressed in the mib syntax (for example, a requirement that
1619 * is detailed in the description for an object).
1620 *
1621 * You should check that the requested change between the undo value and the
1622 * new value is legal (ie, the transistion from one value to another
1623 * is legal).
1624 *
1625 *@note
1626 * This check is only to determine if the new value
1627 * is \b potentially valid. This is the first check of many, and
1628 * is one of the simplest ones.
1629 *
1630 *@note
1631 * this is not the place to do any checks for values
1632 * which depend on some other value in the mib. Those
1633 * types of checks should be done in the
1634 * inetCidrRouteTable_check_dependencies() function.
1635 *
1636 * The following checks have already been done for you:
1637 * The syntax is ASN_INTEGER
1638 * The value is in (one of) the range set(s): 0 - 2147483647
1639 *
1640 * If there a no other checks you need to do, simply return MFD_SUCCESS.
1641 *
1642 */
1643 int
1644 inetCidrRouteIfIndex_check_value(inetCidrRouteTable_rowreq_ctx *
1645 rowreq_ctx, long inetCidrRouteIfIndex_val)
1646 {
1647 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteIfIndex_check_value", "called\n"));
1648
1649 /** should never get a NULL pointer */
1650 netsnmp_assert(NULL != rowreq_ctx);
1651
1652 /*
1653 * TODO:441:o: |-> Check for valid inetCidrRouteIfIndex value.
1654 */
1655
1656 return MFD_SUCCESS; /* inetCidrRouteIfIndex value not illegal */
1657 } /* inetCidrRouteIfIndex_check_value */
1658
1659 /**
1660 * Set the new value.
1661 *
1662 * @param rowreq_ctx
1663 * Pointer to the users context. You should know how to
1664 * manipulate the value from this object.
1665 * @param inetCidrRouteIfIndex_val
1666 * A long containing the new value.
1667 */
1668 int
1669 inetCidrRouteIfIndex_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
1670 long inetCidrRouteIfIndex_val)
1671 {
1672
1673 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteIfIndex_set",
1674 "called\n"));
1675
1676 /** should never get a NULL pointer */
1677 netsnmp_assert(NULL != rowreq_ctx);
1678
1679 /*
1680 * TODO:461:M: |-> Set inetCidrRouteIfIndex value.
1681 * set inetCidrRouteIfIndex value in rowreq_ctx->data
1682 */
1683 rowreq_ctx->data->if_index = inetCidrRouteIfIndex_val;
1684
1685 return MFD_SUCCESS;
1686 } /* inetCidrRouteIfIndex_set */
1687
1688 /*---------------------------------------------------------------------
1689 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteType
1690 * inetCidrRouteType is subid 8 of inetCidrRouteEntry.
1691 * Its status is Current, and its access level is Create.
1692 * OID: .1.3.6.1.2.1.4.24.7.1.8
1693 * Description:
1694 The type of route. Note that local(3) refers to a
1695 route for which the next hop is the final destination;
1696 remote(4)refers to a route for which the next hop is
1697 not the final destination.
1698
1699 Routes which do not result in traffic forwarding or
1700 rejection should not be displayed even if the
1701 implementation keeps them stored internally.
1702
1703 reject(2) refers to a route which, if matched, discards
1704 the message as unreachable and returns a notification
1705 (e.g. ICMP error) to the message sender. This is used
1706 in some protocols as a means of correctly aggregating
1707 routes.
1708
1709 blackhole(5) refers to a route which, if matched,
1710 discards the message silently.
1711 *
1712 * Attributes:
1713 * accessible 1 isscalar 0 enums 1 hasdefval 0
1714 * readable 1 iscolumn 1 ranges 0 hashint 0
1715 * settable 1
1716 *
1717 * Enum range: 3/8. Values: other(1), reject(2), local(3), remote(4), blackhole(5)
1718 *
1719 * Its syntax is INTEGER (based on perltype INTEGER)
1720 * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
1721 */
1722 /**
1723 * Check that the proposed new value is potentially valid.
1724 *
1725 * @param rowreq_ctx
1726 * Pointer to the row request context.
1727 * @param inetCidrRouteType_val
1728 * A long containing the new value.
1729 *
1730 * @retval MFD_SUCCESS : incoming value is legal
1731 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
1732 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
1733 *
1734 * This is the place to check for requirements that are not
1735 * expressed in the mib syntax (for example, a requirement that
1736 * is detailed in the description for an object).
1737 *
1738 * You should check that the requested change between the undo value and the
1739 * new value is legal (ie, the transistion from one value to another
1740 * is legal).
1741 *
1742 *@note
1743 * This check is only to determine if the new value
1744 * is \b potentially valid. This is the first check of many, and
1745 * is one of the simplest ones.
1746 *
1747 *@note
1748 * this is not the place to do any checks for values
1749 * which depend on some other value in the mib. Those
1750 * types of checks should be done in the
1751 * inetCidrRouteTable_check_dependencies() function.
1752 *
1753 * The following checks have already been done for you:
1754 * The syntax is ASN_INTEGER
1755 * The value is one of other(1), reject(2), local(3), remote(4), blackhole(5)
1756 *
1757 * If there a no other checks you need to do, simply return MFD_SUCCESS.
1758 *
1759 */
1760 int
1761 inetCidrRouteType_check_value(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
1762 u_long inetCidrRouteType_val)
1763 {
1764 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteType_check_value",
1765 "called\n"));
1766
1767 /** should never get a NULL pointer */
1768 netsnmp_assert(NULL != rowreq_ctx);
1769
1770 /*
1771 * TODO:441:o: |-> Check for valid inetCidrRouteType value.
1772 */
1773
1774 return MFD_SUCCESS; /* inetCidrRouteType value not illegal */
1775 } /* inetCidrRouteType_check_value */
1776
1777 /**
1778 * Set the new value.
1779 *
1780 * @param rowreq_ctx
1781 * Pointer to the users context. You should know how to
1782 * manipulate the value from this object.
1783 * @param inetCidrRouteType_val
1784 * A long containing the new value.
1785 */
1786 int
1787 inetCidrRouteType_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
1788 u_long inetCidrRouteType_val)
1789 {
1790
1791 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteType_set",
1792 "called\n"));
1793
1794 /** should never get a NULL pointer */
1795 netsnmp_assert(NULL != rowreq_ctx);
1796
1797 /*
1798 * TODO:461:M: |-> Set inetCidrRouteType value.
1799 * set inetCidrRouteType value in rowreq_ctx->data
1800 */
1801 rowreq_ctx->data->rt_type = inetCidrRouteType_val;
1802
1803 return MFD_SUCCESS;
1804 } /* inetCidrRouteType_set */
1805
1806 /*---------------------------------------------------------------------
1807 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteNextHopAS
1808 * inetCidrRouteNextHopAS is subid 11 of inetCidrRouteEntry.
1809 * Its status is Current, and its access level is Create.
1810 * OID: .1.3.6.1.2.1.4.24.7.1.11
1811 * Description:
1812 The Autonomous System Number of the Next Hop. The
1813 semantics of this object are determined by the routing-
1814 protocol specified in the route's inetCidrRouteProto
1815 value. When this object is unknown or not relevant its
1816 value should be set to zero.
1817 *
1818 * Attributes:
1819 * accessible 1 isscalar 0 enums 0 hasdefval 1
1820 * readable 1 iscolumn 1 ranges 0 hashint 1
1821 * settable 1
1822 * defval: 0
1823 * hint: d
1824 *
1825 *
1826 * Its syntax is InetAutonomousSystemNumber (based on perltype UNSIGNED32)
1827 * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
1828 */
1829 /**
1830 * Check that the proposed new value is potentially valid.
1831 *
1832 * @param rowreq_ctx
1833 * Pointer to the row request context.
1834 * @param inetCidrRouteNextHopAS_val
1835 * A u_long containing the new value.
1836 *
1837 * @retval MFD_SUCCESS : incoming value is legal
1838 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
1839 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
1840 *
1841 * This is the place to check for requirements that are not
1842 * expressed in the mib syntax (for example, a requirement that
1843 * is detailed in the description for an object).
1844 *
1845 * You should check that the requested change between the undo value and the
1846 * new value is legal (ie, the transistion from one value to another
1847 * is legal).
1848 *
1849 *@note
1850 * This check is only to determine if the new value
1851 * is \b potentially valid. This is the first check of many, and
1852 * is one of the simplest ones.
1853 *
1854 *@note
1855 * this is not the place to do any checks for values
1856 * which depend on some other value in the mib. Those
1857 * types of checks should be done in the
1858 * inetCidrRouteTable_check_dependencies() function.
1859 *
1860 * The following checks have already been done for you:
1861 * The syntax is ASN_UNSIGNED
1862 *
1863 * If there a no other checks you need to do, simply return MFD_SUCCESS.
1864 *
1865 */
1866 int
1867 inetCidrRouteNextHopAS_check_value(inetCidrRouteTable_rowreq_ctx *
1868 rowreq_ctx,
1869 u_long inetCidrRouteNextHopAS_val)
1870 {
1871 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteNextHopAS_check_value", "called\n"));
1872
1873 /** should never get a NULL pointer */
1874 netsnmp_assert(NULL != rowreq_ctx);
1875
1876 /*
1877 * TODO:441:o: |-> Check for valid inetCidrRouteNextHopAS value.
1878 */
1879
1880 return MFD_SUCCESS; /* inetCidrRouteNextHopAS value not illegal */
1881 } /* inetCidrRouteNextHopAS_check_value */
1882
1883 /**
1884 * Set the new value.
1885 *
1886 * @param rowreq_ctx
1887 * Pointer to the users context. You should know how to
1888 * manipulate the value from this object.
1889 * @param inetCidrRouteNextHopAS_val
1890 * A u_long containing the new value.
1891 */
1892 int
1893 inetCidrRouteNextHopAS_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
1894 u_long inetCidrRouteNextHopAS_val)
1895 {
1896
1897 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteNextHopAS_set",
1898 "called\n"));
1899
1900 /** should never get a NULL pointer */
1901 netsnmp_assert(NULL != rowreq_ctx);
1902
1903 /*
1904 * TODO:461:M: |-> Set inetCidrRouteNextHopAS value.
1905 * set inetCidrRouteNextHopAS value in rowreq_ctx->data
1906 */
1907 rowreq_ctx->data->rt_nexthop_type = inetCidrRouteNextHopAS_val;
1908
1909 return MFD_SUCCESS;
1910 } /* inetCidrRouteNextHopAS_set */
1911
1912 /*---------------------------------------------------------------------
1913 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric1
1914 * inetCidrRouteMetric1 is subid 12 of inetCidrRouteEntry.
1915 * Its status is Current, and its access level is Create.
1916 * OID: .1.3.6.1.2.1.4.24.7.1.12
1917 * Description:
1918 The primary routing metric for this route. The
1919 semantics of this metric are determined by the routing-
1920 protocol specified in the route's inetCidrRouteProto
1921 value. If this metric is not used, its value should be
1922 set to -1.
1923 *
1924 * Attributes:
1925 * accessible 1 isscalar 0 enums 0 hasdefval 1
1926 * readable 1 iscolumn 1 ranges 0 hashint 0
1927 * settable 1
1928 * defval: -1
1929 *
1930 *
1931 * Its syntax is INTEGER32 (based on perltype INTEGER32)
1932 * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
1933 */
1934 /**
1935 * Check that the proposed new value is potentially valid.
1936 *
1937 * @param rowreq_ctx
1938 * Pointer to the row request context.
1939 * @param inetCidrRouteMetric1_val
1940 * A long containing the new value.
1941 *
1942 * @retval MFD_SUCCESS : incoming value is legal
1943 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
1944 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
1945 *
1946 * This is the place to check for requirements that are not
1947 * expressed in the mib syntax (for example, a requirement that
1948 * is detailed in the description for an object).
1949 *
1950 * You should check that the requested change between the undo value and the
1951 * new value is legal (ie, the transistion from one value to another
1952 * is legal).
1953 *
1954 *@note
1955 * This check is only to determine if the new value
1956 * is \b potentially valid. This is the first check of many, and
1957 * is one of the simplest ones.
1958 *
1959 *@note
1960 * this is not the place to do any checks for values
1961 * which depend on some other value in the mib. Those
1962 * types of checks should be done in the
1963 * inetCidrRouteTable_check_dependencies() function.
1964 *
1965 * The following checks have already been done for you:
1966 * The syntax is ASN_INTEGER
1967 *
1968 * If there a no other checks you need to do, simply return MFD_SUCCESS.
1969 *
1970 */
1971 int
1972 inetCidrRouteMetric1_check_value(inetCidrRouteTable_rowreq_ctx *
1973 rowreq_ctx, long inetCidrRouteMetric1_val)
1974 {
1975 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric1_check_value", "called\n"));
1976
1977 /** should never get a NULL pointer */
1978 netsnmp_assert(NULL != rowreq_ctx);
1979
1980 /*
1981 * TODO:441:o: |-> Check for valid inetCidrRouteMetric1 value.
1982 */
1983
1984 return MFD_SUCCESS; /* inetCidrRouteMetric1 value not illegal */
1985 } /* inetCidrRouteMetric1_check_value */
1986
1987 /**
1988 * Set the new value.
1989 *
1990 * @param rowreq_ctx
1991 * Pointer to the users context. You should know how to
1992 * manipulate the value from this object.
1993 * @param inetCidrRouteMetric1_val
1994 * A long containing the new value.
1995 */
1996 int
1997 inetCidrRouteMetric1_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
1998 long inetCidrRouteMetric1_val)
1999 {
2000
2001 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric1_set",
2002 "called\n"));
2003
2004 /** should never get a NULL pointer */
2005 netsnmp_assert(NULL != rowreq_ctx);
2006
2007 /*
2008 * TODO:461:M: |-> Set inetCidrRouteMetric1 value.
2009 * set inetCidrRouteMetric1 value in rowreq_ctx->data
2010 */
2011 rowreq_ctx->data->rt_metric1 = inetCidrRouteMetric1_val;
2012
2013 return MFD_SUCCESS;
2014 } /* inetCidrRouteMetric1_set */
2015
2016 /*---------------------------------------------------------------------
2017 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric2
2018 * inetCidrRouteMetric2 is subid 13 of inetCidrRouteEntry.
2019 * Its status is Current, and its access level is Create.
2020 * OID: .1.3.6.1.2.1.4.24.7.1.13
2021 * Description:
2022 An alternate routing metric for this route. The
2023 semantics of this metric are determined by the routing-
2024 protocol specified in the route's inetCidrRouteProto
2025 value. If this metric is not used, its value should be
2026 set to -1.
2027 *
2028 * Attributes:
2029 * accessible 1 isscalar 0 enums 0 hasdefval 1
2030 * readable 1 iscolumn 1 ranges 0 hashint 0
2031 * settable 1
2032 * defval: -1
2033 *
2034 *
2035 * Its syntax is INTEGER32 (based on perltype INTEGER32)
2036 * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
2037 */
2038 /**
2039 * Check that the proposed new value is potentially valid.
2040 *
2041 * @param rowreq_ctx
2042 * Pointer to the row request context.
2043 * @param inetCidrRouteMetric2_val
2044 * A long containing the new value.
2045 *
2046 * @retval MFD_SUCCESS : incoming value is legal
2047 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
2048 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
2049 *
2050 * This is the place to check for requirements that are not
2051 * expressed in the mib syntax (for example, a requirement that
2052 * is detailed in the description for an object).
2053 *
2054 * You should check that the requested change between the undo value and the
2055 * new value is legal (ie, the transistion from one value to another
2056 * is legal).
2057 *
2058 *@note
2059 * This check is only to determine if the new value
2060 * is \b potentially valid. This is the first check of many, and
2061 * is one of the simplest ones.
2062 *
2063 *@note
2064 * this is not the place to do any checks for values
2065 * which depend on some other value in the mib. Those
2066 * types of checks should be done in the
2067 * inetCidrRouteTable_check_dependencies() function.
2068 *
2069 * The following checks have already been done for you:
2070 * The syntax is ASN_INTEGER
2071 *
2072 * If there a no other checks you need to do, simply return MFD_SUCCESS.
2073 *
2074 */
2075 int
2076 inetCidrRouteMetric2_check_value(inetCidrRouteTable_rowreq_ctx *
2077 rowreq_ctx, long inetCidrRouteMetric2_val)
2078 {
2079 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric2_check_value", "called\n"));
2080
2081 /** should never get a NULL pointer */
2082 netsnmp_assert(NULL != rowreq_ctx);
2083
2084 /*
2085 * TODO:441:o: |-> Check for valid inetCidrRouteMetric2 value.
2086 */
2087 /*
2088 * does any os use metrics 2-5? If so, update this to deal with it.
2089 */
2090
2091 return MFD_NOT_VALID_EVER;
2092 } /* inetCidrRouteMetric2_check_value */
2093
2094 /**
2095 * Set the new value.
2096 *
2097 * @param rowreq_ctx
2098 * Pointer to the users context. You should know how to
2099 * manipulate the value from this object.
2100 * @param inetCidrRouteMetric2_val
2101 * A long containing the new value.
2102 */
2103 int
2104 inetCidrRouteMetric2_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
2105 long inetCidrRouteMetric2_val)
2106 {
2107
2108 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric2_set",
2109 "called\n"));
2110
2111 /** should never get a NULL pointer */
2112 netsnmp_assert(NULL != rowreq_ctx);
2113
2114 /*
2115 * TODO:461:M: |-> Set inetCidrRouteMetric2 value.
2116 * set inetCidrRouteMetric2 value in rowreq_ctx->data
2117 */
2118 rowreq_ctx->data->rt_metric2 = inetCidrRouteMetric2_val;
2119
2120 return MFD_SUCCESS;
2121 } /* inetCidrRouteMetric2_set */
2122
2123 /*---------------------------------------------------------------------
2124 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric3
2125 * inetCidrRouteMetric3 is subid 14 of inetCidrRouteEntry.
2126 * Its status is Current, and its access level is Create.
2127 * OID: .1.3.6.1.2.1.4.24.7.1.14
2128 * Description:
2129 An alternate routing metric for this route. The
2130 semantics of this metric are determined by the routing-
2131 protocol specified in the route's inetCidrRouteProto
2132 value. If this metric is not used, its value should be
2133 set to -1.
2134 *
2135 * Attributes:
2136 * accessible 1 isscalar 0 enums 0 hasdefval 1
2137 * readable 1 iscolumn 1 ranges 0 hashint 0
2138 * settable 1
2139 * defval: -1
2140 *
2141 *
2142 * Its syntax is INTEGER32 (based on perltype INTEGER32)
2143 * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
2144 */
2145 /**
2146 * Check that the proposed new value is potentially valid.
2147 *
2148 * @param rowreq_ctx
2149 * Pointer to the row request context.
2150 * @param inetCidrRouteMetric3_val
2151 * A long containing the new value.
2152 *
2153 * @retval MFD_SUCCESS : incoming value is legal
2154 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
2155 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
2156 *
2157 * This is the place to check for requirements that are not
2158 * expressed in the mib syntax (for example, a requirement that
2159 * is detailed in the description for an object).
2160 *
2161 * You should check that the requested change between the undo value and the
2162 * new value is legal (ie, the transistion from one value to another
2163 * is legal).
2164 *
2165 *@note
2166 * This check is only to determine if the new value
2167 * is \b potentially valid. This is the first check of many, and
2168 * is one of the simplest ones.
2169 *
2170 *@note
2171 * this is not the place to do any checks for values
2172 * which depend on some other value in the mib. Those
2173 * types of checks should be done in the
2174 * inetCidrRouteTable_check_dependencies() function.
2175 *
2176 * The following checks have already been done for you:
2177 * The syntax is ASN_INTEGER
2178 *
2179 * If there a no other checks you need to do, simply return MFD_SUCCESS.
2180 *
2181 */
2182 int
2183 inetCidrRouteMetric3_check_value(inetCidrRouteTable_rowreq_ctx *
2184 rowreq_ctx, long inetCidrRouteMetric3_val)
2185 {
2186 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric3_check_value", "called\n"));
2187
2188 /** should never get a NULL pointer */
2189 netsnmp_assert(NULL != rowreq_ctx);
2190
2191 /*
2192 * TODO:441:o: |-> Check for valid inetCidrRouteMetric3 value.
2193 */
2194 /*
2195 * does any os use metrics 2-5? If so, update this to deal with it.
2196 */
2197
2198 return MFD_NOT_VALID_NOW;
2199 } /* inetCidrRouteMetric3_check_value */
2200
2201 /**
2202 * Set the new value.
2203 *
2204 * @param rowreq_ctx
2205 * Pointer to the users context. You should know how to
2206 * manipulate the value from this object.
2207 * @param inetCidrRouteMetric3_val
2208 * A long containing the new value.
2209 */
2210 int
2211 inetCidrRouteMetric3_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
2212 long inetCidrRouteMetric3_val)
2213 {
2214
2215 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric3_set",
2216 "called\n"));
2217
2218 /** should never get a NULL pointer */
2219 netsnmp_assert(NULL != rowreq_ctx);
2220
2221 /*
2222 * TODO:461:M: |-> Set inetCidrRouteMetric3 value.
2223 * set inetCidrRouteMetric3 value in rowreq_ctx->data
2224 */
2225 rowreq_ctx->data->rt_metric3 = inetCidrRouteMetric3_val;
2226
2227 return MFD_SUCCESS;
2228 } /* inetCidrRouteMetric3_set */
2229
2230 /*---------------------------------------------------------------------
2231 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric4
2232 * inetCidrRouteMetric4 is subid 15 of inetCidrRouteEntry.
2233 * Its status is Current, and its access level is Create.
2234 * OID: .1.3.6.1.2.1.4.24.7.1.15
2235 * Description:
2236 An alternate routing metric for this route. The
2237 semantics of this metric are determined by the routing-
2238 protocol specified in the route's inetCidrRouteProto
2239 value. If this metric is not used, its value should be
2240 set to -1.
2241 *
2242 * Attributes:
2243 * accessible 1 isscalar 0 enums 0 hasdefval 1
2244 * readable 1 iscolumn 1 ranges 0 hashint 0
2245 * settable 1
2246 * defval: -1
2247 *
2248 *
2249 * Its syntax is INTEGER32 (based on perltype INTEGER32)
2250 * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
2251 */
2252 /**
2253 * Check that the proposed new value is potentially valid.
2254 *
2255 * @param rowreq_ctx
2256 * Pointer to the row request context.
2257 * @param inetCidrRouteMetric4_val
2258 * A long containing the new value.
2259 *
2260 * @retval MFD_SUCCESS : incoming value is legal
2261 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
2262 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
2263 *
2264 * This is the place to check for requirements that are not
2265 * expressed in the mib syntax (for example, a requirement that
2266 * is detailed in the description for an object).
2267 *
2268 * You should check that the requested change between the undo value and the
2269 * new value is legal (ie, the transistion from one value to another
2270 * is legal).
2271 *
2272 *@note
2273 * This check is only to determine if the new value
2274 * is \b potentially valid. This is the first check of many, and
2275 * is one of the simplest ones.
2276 *
2277 *@note
2278 * this is not the place to do any checks for values
2279 * which depend on some other value in the mib. Those
2280 * types of checks should be done in the
2281 * inetCidrRouteTable_check_dependencies() function.
2282 *
2283 * The following checks have already been done for you:
2284 * The syntax is ASN_INTEGER
2285 *
2286 * If there a no other checks you need to do, simply return MFD_SUCCESS.
2287 *
2288 */
2289 int
2290 inetCidrRouteMetric4_check_value(inetCidrRouteTable_rowreq_ctx *
2291 rowreq_ctx, long inetCidrRouteMetric4_val)
2292 {
2293 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric4_check_value", "called\n"));
2294
2295 /** should never get a NULL pointer */
2296 netsnmp_assert(NULL != rowreq_ctx);
2297
2298 /*
2299 * TODO:441:o: |-> Check for valid inetCidrRouteMetric4 value.
2300 */
2301 /*
2302 * does any os use metrics 2-5? If so, update this to deal with it.
2303 */
2304
2305 return MFD_NOT_VALID_NOW;
2306 } /* inetCidrRouteMetric4_check_value */
2307
2308 /**
2309 * Set the new value.
2310 *
2311 * @param rowreq_ctx
2312 * Pointer to the users context. You should know how to
2313 * manipulate the value from this object.
2314 * @param inetCidrRouteMetric4_val
2315 * A long containing the new value.
2316 */
2317 int
2318 inetCidrRouteMetric4_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
2319 long inetCidrRouteMetric4_val)
2320 {
2321
2322 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric4_set",
2323 "called\n"));
2324
2325 /** should never get a NULL pointer */
2326 netsnmp_assert(NULL != rowreq_ctx);
2327
2328 /*
2329 * TODO:461:M: |-> Set inetCidrRouteMetric4 value.
2330 * set inetCidrRouteMetric4 value in rowreq_ctx->data
2331 */
2332 rowreq_ctx->data->rt_metric4 = inetCidrRouteMetric4_val;
2333
2334 return MFD_SUCCESS;
2335 } /* inetCidrRouteMetric4_set */
2336
2337 /*---------------------------------------------------------------------
2338 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric5
2339 * inetCidrRouteMetric5 is subid 16 of inetCidrRouteEntry.
2340 * Its status is Current, and its access level is Create.
2341 * OID: .1.3.6.1.2.1.4.24.7.1.16
2342 * Description:
2343 An alternate routing metric for this route. The
2344 semantics of this metric are determined by the routing-
2345 protocol specified in the route's inetCidrRouteProto
2346 value. If this metric is not used, its value should be
2347 set to -1.
2348 *
2349 * Attributes:
2350 * accessible 1 isscalar 0 enums 0 hasdefval 1
2351 * readable 1 iscolumn 1 ranges 0 hashint 0
2352 * settable 1
2353 * defval: -1
2354 *
2355 *
2356 * Its syntax is INTEGER32 (based on perltype INTEGER32)
2357 * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
2358 */
2359 /**
2360 * Check that the proposed new value is potentially valid.
2361 *
2362 * @param rowreq_ctx
2363 * Pointer to the row request context.
2364 * @param inetCidrRouteMetric5_val
2365 * A long containing the new value.
2366 *
2367 * @retval MFD_SUCCESS : incoming value is legal
2368 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
2369 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
2370 *
2371 * This is the place to check for requirements that are not
2372 * expressed in the mib syntax (for example, a requirement that
2373 * is detailed in the description for an object).
2374 *
2375 * You should check that the requested change between the undo value and the
2376 * new value is legal (ie, the transistion from one value to another
2377 * is legal).
2378 *
2379 *@note
2380 * This check is only to determine if the new value
2381 * is \b potentially valid. This is the first check of many, and
2382 * is one of the simplest ones.
2383 *
2384 *@note
2385 * this is not the place to do any checks for values
2386 * which depend on some other value in the mib. Those
2387 * types of checks should be done in the
2388 * inetCidrRouteTable_check_dependencies() function.
2389 *
2390 * The following checks have already been done for you:
2391 * The syntax is ASN_INTEGER
2392 *
2393 * If there a no other checks you need to do, simply return MFD_SUCCESS.
2394 *
2395 */
2396 int
2397 inetCidrRouteMetric5_check_value(inetCidrRouteTable_rowreq_ctx *
2398 rowreq_ctx, long inetCidrRouteMetric5_val)
2399 {
2400 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric5_check_value", "called\n"));
2401
2402 /** should never get a NULL pointer */
2403 netsnmp_assert(NULL != rowreq_ctx);
2404
2405 /*
2406 * TODO:441:o: |-> Check for valid inetCidrRouteMetric5 value.
2407 */
2408 /*
2409 * does any os use metrics 2-5? If so, update this to deal with it.
2410 */
2411 return MFD_NOT_VALID_NOW;
2412 } /* inetCidrRouteMetric5_check_value */
2413
2414 /**
2415 * Set the new value.
2416 *
2417 * @param rowreq_ctx
2418 * Pointer to the users context. You should know how to
2419 * manipulate the value from this object.
2420 * @param inetCidrRouteMetric5_val
2421 * A long containing the new value.
2422 */
2423 int
2424 inetCidrRouteMetric5_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
2425 long inetCidrRouteMetric5_val)
2426 {
2427
2428 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric5_set",
2429 "called\n"));
2430
2431 /** should never get a NULL pointer */
2432 netsnmp_assert(NULL != rowreq_ctx);
2433
2434 /*
2435 * TODO:461:M: |-> Set inetCidrRouteMetric5 value.
2436 * set inetCidrRouteMetric5 value in rowreq_ctx->data
2437 */
2438 rowreq_ctx->data->rt_metric5 = inetCidrRouteMetric5_val;
2439
2440 return MFD_SUCCESS;
2441 } /* inetCidrRouteMetric5_set */
2442
2443 /*---------------------------------------------------------------------
2444 * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteStatus
2445 * inetCidrRouteStatus is subid 17 of inetCidrRouteEntry.
2446 * Its status is Current, and its access level is Create.
2447 * OID: .1.3.6.1.2.1.4.24.7.1.17
2448 * Description:
2449 The row status variable, used according to row
2450 installation and removal conventions.
2451
2452 A row entry cannot be modified when the status is
2453 marked as active(1).
2454 *
2455 * Attributes:
2456 * accessible 1 isscalar 0 enums 1 hasdefval 0
2457 * readable 1 iscolumn 1 ranges 0 hashint 0
2458 * settable 1
2459 *
2460 * Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
2461 *
2462 * Its syntax is RowStatus (based on perltype INTEGER)
2463 * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
2464 */
2465 /**
2466 * Check that the proposed new value is potentially valid.
2467 *
2468 * @param rowreq_ctx
2469 * Pointer to the row request context.
2470 * @param inetCidrRouteStatus_val
2471 * A long containing the new value.
2472 *
2473 * @retval MFD_SUCCESS : incoming value is legal
2474 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
2475 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
2476 *
2477 * This is the place to check for requirements that are not
2478 * expressed in the mib syntax (for example, a requirement that
2479 * is detailed in the description for an object).
2480 *
2481 * You should check that the requested change between the undo value and the
2482 * new value is legal (ie, the transistion from one value to another
2483 * is legal).
2484 *
2485 *@note
2486 * This check is only to determine if the new value
2487 * is \b potentially valid. This is the first check of many, and
2488 * is one of the simplest ones.
2489 *
2490 *@note
2491 * this is not the place to do any checks for values
2492 * which depend on some other value in the mib. Those
2493 * types of checks should be done in the
2494 * inetCidrRouteTable_check_dependencies() function.
2495 *
2496 * The following checks have already been done for you:
2497 * The syntax is ASN_INTEGER
2498 * The value is one of active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
2499 *
2500 * If there a no other checks you need to do, simply return MFD_SUCCESS.
2501 *
2502 */
2503 int
2504 inetCidrRouteStatus_check_value(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
2505 u_long inetCidrRouteStatus_val)
2506 {
2507 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteStatus_check_value", "called\n"));
2508
2509 /** should never get a NULL pointer */
2510 netsnmp_assert(NULL != rowreq_ctx);
2511
2512 /*
2513 * TODO:441:o: |-> Check for valid inetCidrRouteStatus value.
2514 */
2515
2516 return MFD_SUCCESS; /* inetCidrRouteStatus value not illegal */
2517 } /* inetCidrRouteStatus_check_value */
2518
2519 /**
2520 * Set the new value.
2521 *
2522 * @param rowreq_ctx
2523 * Pointer to the users context. You should know how to
2524 * manipulate the value from this object.
2525 * @param inetCidrRouteStatus_val
2526 * A long containing the new value.
2527 */
2528 int
2529 inetCidrRouteStatus_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
2530 u_long inetCidrRouteStatus_val)
2531 {
2532
2533 DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteStatus_set",
2534 "called\n"));
2535
2536 /** should never get a NULL pointer */
2537 netsnmp_assert(NULL != rowreq_ctx);
2538
2539 /*
2540 * TODO:461:M: |-> Set inetCidrRouteStatus value.
2541 * set inetCidrRouteStatus value in rowreq_ctx->data
2542 */
2543 rowreq_ctx->row_status = inetCidrRouteStatus_val;
2544
2545 return MFD_SUCCESS;
2546 } /* inetCidrRouteStatus_set */
2547
2548 /**
2549 * check dependencies
2550 *
2551 * This is useful for for tables which have dependencies between columns
2552 * (or rows, or tables). For example, two columns allocating a percentage
2553 * of something add up 100%.
2554 *
2555 * Should you need different behavior depending on which columns were
2556 * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
2557 * set. The definitions for the COLUMN_*_FLAG bits can be found in
2558 * inetCidrRouteTable.h.
2559 * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
2560 *
2561 * @retval MFD_SUCCESS all the changes to the row are legal
2562 * @retval MFD_ERROR one or more changes are not legal
2563 *
2564 * (see README-table-inetCidrRouteTable if you don't have dependencies)
2565 */
2566 int
2567 inetCidrRouteTable_check_dependencies(inetCidrRouteTable_rowreq_ctx *
2568 rowreq_ctx)
2569 {
2570 int rc = MFD_SUCCESS;
2571
2572 DEBUGMSGTL(("internal:inetCidrRouteTable:inetCidrRouteTable_check_dependencies", "called\n"));
2573
2574 netsnmp_assert(NULL != rowreq_ctx);
2575
2576 /*
2577 * TODO:470:o: Check inetCidrRouteTable row dependencies.
2578 * check that all new value are legal and consistent with each other
2579 */
2580 /*
2581 * can't modify an active row
2582 */
2583 if ((ROWSTATUS_ACTIVE == rowreq_ctx->row_status) &&
2584 (ROWSTATUS_ACTIVE == rowreq_ctx->row_status_undo)) {
2585 DEBUGMSGTL(("inetCidrRouteTable",
2586 "can't change active row (yet)\n"));
2587 return MFD_ERROR;
2588 }
2589
2590 /*
2591 * check RowStatus dependencies
2592 */
2593 if (rowreq_ctx->column_set_flags & COLUMN_INETCIDRROUTESTATUS_FLAG) {
2594 /*
2595 * check for valid RowStatus transition (old, new)
2596 * (Note: move transition check to
2597 * to catch errors earlier)
2598 */
2599 rc = check_rowstatus_transition(rowreq_ctx->row_status_undo,
2600 rowreq_ctx->row_status);
2601 if (MFD_SUCCESS != rc)
2602 return rc;
2603
2604 /*
2605 * row creation requirements
2606 */
2607 if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
2608 if (ROWSTATUS_DESTROY == rowreq_ctx->row_status) {
2609 rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
2610 } else if (ROWSTATUS_CREATEANDGO == rowreq_ctx->row_status) {
2611 if ((rowreq_ctx->
2612 column_set_flags & INETCIDRROUTETABLE_REQUIRED_COLS)
2613 != INETCIDRROUTETABLE_REQUIRED_COLS) {
2614 DEBUGMSGTL(("inetCidrRouteTable",
2615 "required columns missing (0x%0x != 0x%0x)\n",
2616 rowreq_ctx->column_set_flags,
2617 INETCIDRROUTETABLE_REQUIRED_COLS));
2618 return MFD_CANNOT_CREATE_NOW;
2619 }
2620 rowreq_ctx->row_status = ROWSTATUS_ACTIVE;
2621 }
2622 } /* row creation */
2623 else {
2624 /*
2625 * row change requirements
2626 */
2627 /*
2628 * don't allow a destroy if any other value was changed, since
2629 * that might call data access routines with bad info.
2630 *
2631 * you may or may not require the row be notInService before it
2632 * can be destroyed.
2633 */
2634 if (ROWSTATUS_DESTROY == rowreq_ctx->row_status) {
2635 if (rowreq_ctx->
2636 column_set_flags & ~COLUMN_INETCIDRROUTESTATUS_FLAG) {
2637 DEBUGMSGTL(("inetCidrRouteTable",
2638 "destroy must be only varbind for row\n"));
2639 return MFD_NOT_VALID_NOW;
2640 }
2641 rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
2642
2643 } /* row destroy */
2644 } /* row change */
2645 } else {
2646 /*
2647 * must have row status to create a row
2648 */
2649 if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
2650 DEBUGMSGTL(("inetCidrRouteTable",
2651 "must use RowStatus to create rows\n"));
2652 return MFD_CANNOT_CREATE_NOW;
2653 }
2654 } /* row status not set */
2655
2656 if (MFD_SUCCESS != rc)
2657 return rc;
2658
2659 return rc;
2660 } /* inetCidrRouteTable_check_dependencies */
2661
2662
2663 int
2664 _route_number_handler(netsnmp_mib_handler *handler,
2665 netsnmp_handler_registration *reginfo,
2666 netsnmp_agent_request_info *reqinfo,
2667 netsnmp_request_info *requests)
2668 {
2669 if (MODE_GET == reqinfo->mode) {
2670 int val = inetCidrRouteTable_container_size();
2671 snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED,
2672 (u_char *) &val, sizeof(val));
2673 } else
2674 netsnmp_assert("bad mode in RO handler");
2675
2676 if (handler->next && handler->next->access_method)
2677 return netsnmp_call_next_handler(handler, reginfo, reqinfo,
2678 requests);
2679
2680 return SNMP_ERR_NOERROR;
2681 }
2682
2683 /** @} */
2684 /** @{ */