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 snmpNotifyFilterTable
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 "snmpNotifyFilterTable.h"
25
26 #include <net-snmp/agent/mib_modules.h>
27
28 #include "snmpNotifyFilterTable_interface.h"
29
30 netsnmp_feature_require(check_storage_transition);
31
32 const oid snmpNotifyFilterTable_oid[] =
33 { SNMPNOTIFYFILTERTABLE_OID };
34 const int snmpNotifyFilterTable_oid_size =
35 OID_LENGTH(snmpNotifyFilterTable_oid);
36
37 snmpNotifyFilterTable_registration snmpNotifyFilterTable_user_context;
38 static snmpNotifyFilterTable_registration *snmpNotifyFilterTable_user_context_p;
39
40 void initialize_table_snmpNotifyFilterTable(void);
41 void shutdown_table_snmpNotifyFilterTable(void);
42
43
44 /**
45 * Initializes the snmpNotifyFilterTable module
46 */
47 void
init_snmpNotifyFilterTable(void)48 init_snmpNotifyFilterTable(void)
49 {
50 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:init_snmpNotifyFilterTable",
51 "called\n"));
52
53 /*
54 * TODO:300:o: Perform snmpNotifyFilterTable one-time module initialization.
55 */
56
57 /*
58 * here we initialize all the tables we're planning on supporting
59 */
60 if (should_init("snmpNotifyFilterTable"))
61 initialize_table_snmpNotifyFilterTable();
62
63 } /* init_snmpNotifyFilterTable */
64
65 /**
66 * Shut-down the snmpNotifyFilterTable module (agent is exiting)
67 */
68 void
shutdown_snmpNotifyFilterTable(void)69 shutdown_snmpNotifyFilterTable(void)
70 {
71 if (should_init("snmpNotifyFilterTable"))
72 shutdown_table_snmpNotifyFilterTable();
73
74 }
75
76 /**
77 * Initialize the table snmpNotifyFilterTable
78 * (Define its contents and how it's structured)
79 */
80 void
initialize_table_snmpNotifyFilterTable(void)81 initialize_table_snmpNotifyFilterTable(void)
82 {
83 u_long flags;
84
85 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:initialize_table_snmpNotifyFilterTable", "called\n"));
86
87 /*
88 * TODO:301:o: Perform snmpNotifyFilterTable one-time table initialization.
89 */
90
91 /*
92 * TODO:302:o: |->Initialize snmpNotifyFilterTable user context
93 * if you'd like to pass in a pointer to some data for this
94 * table, allocate or set it up here.
95 */
96 /*
97 * a netsnmp_data_list is a simple way to store void pointers. A simple
98 * string token is used to add, find or remove pointers.
99 */
100 snmpNotifyFilterTable_user_context_p =
101 netsnmp_create_data_list("snmpNotifyFilterTable", NULL, NULL);
102
103 /*
104 * No support for any flags yet, but in the future you would
105 * set any flags here.
106 */
107 flags = 0;
108
109 /*
110 * call interface initialization code
111 */
112 _snmpNotifyFilterTable_initialize_interface
113 (snmpNotifyFilterTable_user_context_p, flags);
114 } /* initialize_table_snmpNotifyFilterTable */
115
116 /**
117 * Shutdown the table snmpNotifyFilterTable
118 */
119 void
shutdown_table_snmpNotifyFilterTable(void)120 shutdown_table_snmpNotifyFilterTable(void)
121 {
122 /*
123 * call interface shutdown code
124 */
125 _snmpNotifyFilterTable_shutdown_interface
126 (snmpNotifyFilterTable_user_context_p);
127 netsnmp_free_all_list_data(snmpNotifyFilterTable_user_context_p);
128 snmpNotifyFilterTable_user_context_p = NULL;
129 }
130
131 /**
132 * extra context initialization (eg default values)
133 *
134 * @param rowreq_ctx : row request context
135 * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
136 *
137 * @retval MFD_SUCCESS : no errors
138 * @retval MFD_ERROR : error (context allocate will fail)
139 */
140 int
snmpNotifyFilterTable_rowreq_ctx_init(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,void * user_init_ctx)141 snmpNotifyFilterTable_rowreq_ctx_init(snmpNotifyFilterTable_rowreq_ctx *
142 rowreq_ctx, void *user_init_ctx)
143 {
144 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_rowreq_ctx_init", "called\n"));
145
146 netsnmp_assert(NULL != rowreq_ctx);
147
148 /*
149 * TODO:210:o: |-> Perform extra snmpNotifyFilterTable rowreq initialization. (eg DEFVALS)
150 */
151 /*
152 * strings and oids are hard to handle automagically.
153 * so all we've got for you is a hint:
154 *
155 * memcpy(rowreq_ctx->data.snmpNotifyFilterMask, 0,
156 * len(0) * sizeof(snmpNotifyFilterMask[0]);
157 */
158
159 rowreq_ctx->data.snmpNotifyFilterType = SNMPNOTIFYFILTERTYPE_INCLUDED;
160
161 rowreq_ctx->data.snmpNotifyFilterStorageType = STORAGETYPE_NONVOLATILE;
162
163
164 return MFD_SUCCESS;
165 } /* snmpNotifyFilterTable_rowreq_ctx_init */
166
167 /**
168 * extra context cleanup
169 * @param rowreq_ctx
170 */
171 void
snmpNotifyFilterTable_rowreq_ctx_cleanup(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)172 snmpNotifyFilterTable_rowreq_ctx_cleanup(snmpNotifyFilterTable_rowreq_ctx *
173 rowreq_ctx)
174 {
175 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_rowreq_ctx_cleanup", "called\n"));
176
177 netsnmp_assert(NULL != rowreq_ctx);
178
179 /*
180 * TODO:211:o: |-> Perform extra snmpNotifyFilterTable rowreq cleanup.
181 */
182 } /* snmpNotifyFilterTable_rowreq_ctx_cleanup */
183
184 /************************************************************
185 * the *_should_save routine is called to determine if a row
186 * should be stored persistently.
187 *
188 * Note that this is not a 'dirty' check (i.e. if a row has changed),
189 * but a check for volatile rows that should not be saved between
190 * restarts.
191 * @param rowreq_ctx
192 * @retval 1 if the row should be stored
193 * @retval 0 if the row should not be stored
194 */
195 int
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
snmpNotifyFilterTable_container_should_save(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)211 snmpNotifyFilterTable_container_should_save
212 (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx) {
213 if (SNMP_STORAGE_VOLATILE ==
214 rowreq_ctx->data.snmpNotifyFilterStorageType)
215 return 0;
216
217 return 1; /* save the row */
218 }
219
220 /**
221 * pre-request callback
222 *
223 * @param user_context
224 * @retval MFD_SUCCESS : success.
225 * @retval MFD_ERROR : other error
226 */
227 int
snmpNotifyFilterTable_pre_request(snmpNotifyFilterTable_registration * user_context)228 snmpNotifyFilterTable_pre_request(snmpNotifyFilterTable_registration *
229 user_context)
230 {
231 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_pre_request", "called\n"));
232
233 /*
234 * TODO:510:o: Perform snmpNotifyFilterTable pre-request actions.
235 */
236
237 return MFD_SUCCESS;
238 } /* snmpNotifyFilterTable_pre_request */
239
240 /**
241 * post-request callback
242 *
243 * Note:
244 * New rows have been inserted into the container, and
245 * deleted rows have been removed from the container and
246 * released.
247 * @param user_context
248 * @param rc : MFD_SUCCESS if all requests succeeded
249 *
250 * @retval MFD_SUCCESS : success.
251 * @retval MFD_ERROR : other error (ignored)
252 */
253 int
snmpNotifyFilterTable_post_request(snmpNotifyFilterTable_registration * user_context,int rc)254 snmpNotifyFilterTable_post_request(snmpNotifyFilterTable_registration *
255 user_context, int rc)
256 {
257 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_post_request", "called\n"));
258
259 /*
260 * TODO:511:o: Perform snmpNotifyFilterTable post-request actions.
261 */
262
263 /*
264 * check to set if any rows were changed.
265 */
266 if (snmpNotifyFilterTable_dirty_get()) {
267 /*
268 * check if request was successful. If so, this would be
269 * a good place to save data to its persistent store.
270 */
271 if (MFD_SUCCESS == rc) {
272 /*
273 * notify library to save changed rows
274 */
275 snmp_store_needed(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
276 NETSNMP_DS_LIB_APPTYPE));
277 }
278
279 snmpNotifyFilterTable_dirty_set(0); /* clear table dirty flag */
280 }
281
282 return MFD_SUCCESS;
283 } /* snmpNotifyFilterTable_post_request */
284
285
286 /**********************************************************************
287 **********************************************************************
288 ***
289 *** Table snmpNotifyFilterTable
290 ***
291 **********************************************************************
292 **********************************************************************/
293 /*
294 * SNMP-NOTIFICATION-MIB::snmpNotifyFilterTable is subid 3 of snmpNotifyObjects.
295 * Its status is Current.
296 * OID: .1.3.6.1.6.3.13.1.3, length: 9
297 */
298
299 /*
300 * ---------------------------------------------------------------------
301 * * TODO:200:r: Implement snmpNotifyFilterTable data context functions.
302 */
303
304
305 /**
306 * set mib index(es)
307 *
308 * @param tbl_idx mib index structure
309 * @param snmpNotifyFilterProfileName_val_ptr
310 * @param snmpNotifyFilterProfileName_val_ptr_len
311 * @param snmpNotifyFilterSubtree_val_ptr
312 * @param snmpNotifyFilterSubtree_val_ptr_len
313 *
314 * @retval MFD_SUCCESS : success.
315 * @retval MFD_ERROR : other error.
316 *
317 * @remark
318 * This convenience function is useful for setting all the MIB index
319 * components with a single function call. It is assume that the C values
320 * have already been mapped from their native/rawformat to the MIB format.
321 */
322 int
snmpNotifyFilterTable_indexes_set_tbl_idx(snmpNotifyFilterTable_mib_index * tbl_idx,char * snmpNotifyFilterProfileName_val_ptr,size_t snmpNotifyFilterProfileName_val_ptr_len,oid * snmpNotifyFilterSubtree_val_ptr,size_t snmpNotifyFilterSubtree_val_ptr_len)323 snmpNotifyFilterTable_indexes_set_tbl_idx(snmpNotifyFilterTable_mib_index *
324 tbl_idx, char
325 *snmpNotifyFilterProfileName_val_ptr,
326 size_t
327 snmpNotifyFilterProfileName_val_ptr_len,
328 oid *
329 snmpNotifyFilterSubtree_val_ptr,
330 size_t
331 snmpNotifyFilterSubtree_val_ptr_len)
332 {
333 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_indexes_set_tbl_idx", "called\n"));
334
335 /*
336 * snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
337 */
338 tbl_idx->snmpNotifyFilterProfileName_len = sizeof(tbl_idx->snmpNotifyFilterProfileName) / sizeof(tbl_idx->snmpNotifyFilterProfileName[0]); /* max length */
339 /*
340 * make sure there is enough space for snmpNotifyFilterProfileName data
341 */
342 if (tbl_idx->snmpNotifyFilterProfileName_len <
343 snmpNotifyFilterProfileName_val_ptr_len) {
344 snmp_log(LOG_ERR, "not enough space for value\n");
345 return MFD_ERROR;
346 }
347 tbl_idx->snmpNotifyFilterProfileName_len =
348 snmpNotifyFilterProfileName_val_ptr_len;
349 memcpy(tbl_idx->snmpNotifyFilterProfileName,
350 snmpNotifyFilterProfileName_val_ptr,
351 snmpNotifyFilterProfileName_val_ptr_len *
352 sizeof(snmpNotifyFilterProfileName_val_ptr[0]));
353
354 /*
355 * snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
356 */
357 tbl_idx->snmpNotifyFilterSubtree_len = sizeof(tbl_idx->snmpNotifyFilterSubtree) / sizeof(tbl_idx->snmpNotifyFilterSubtree[0]); /* max length */
358 /*
359 * make sure there is enough space for snmpNotifyFilterSubtree data
360 */
361 if (tbl_idx->snmpNotifyFilterSubtree_len <
362 snmpNotifyFilterSubtree_val_ptr_len) {
363 snmp_log(LOG_ERR, "not enough space for value\n");
364 return MFD_ERROR;
365 }
366 tbl_idx->snmpNotifyFilterSubtree_len =
367 snmpNotifyFilterSubtree_val_ptr_len;
368 memcpy(tbl_idx->snmpNotifyFilterSubtree,
369 snmpNotifyFilterSubtree_val_ptr,
370 snmpNotifyFilterSubtree_val_ptr_len *
371 sizeof(snmpNotifyFilterSubtree_val_ptr[0]));
372
373
374 return MFD_SUCCESS;
375 } /* snmpNotifyFilterTable_indexes_set_tbl_idx */
376
377 /**
378 * @internal
379 * set row context indexes
380 *
381 * @param rowreq_ctx the row context that needs updated indexes
382 * @param snmpNotifyFilterProfileName_val_ptr
383 * @param snmpNotifyFilterProfileName_val_ptr_len
384 * @param snmpNotifyFilterSubtree_val_ptr
385 * @param snmpNotifyFilterSubtree_val_ptr_len
386 *
387 * @retval MFD_SUCCESS : success.
388 * @retval MFD_ERROR : other error.
389 *
390 * @remark
391 * This function sets the mib indexs, then updates the oid indexs
392 * from the mib index.
393 */
394 int
snmpNotifyFilterTable_indexes_set(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,char * snmpNotifyFilterProfileName_val_ptr,size_t snmpNotifyFilterProfileName_val_ptr_len,oid * snmpNotifyFilterSubtree_val_ptr,size_t snmpNotifyFilterSubtree_val_ptr_len)395 snmpNotifyFilterTable_indexes_set(snmpNotifyFilterTable_rowreq_ctx *
396 rowreq_ctx, char
397 *snmpNotifyFilterProfileName_val_ptr,
398 size_t
399 snmpNotifyFilterProfileName_val_ptr_len,
400 oid * snmpNotifyFilterSubtree_val_ptr,
401 size_t
402 snmpNotifyFilterSubtree_val_ptr_len)
403 {
404 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_indexes_set", "called\n"));
405
406 if (MFD_SUCCESS !=
407 snmpNotifyFilterTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
408 snmpNotifyFilterProfileName_val_ptr,
409 snmpNotifyFilterProfileName_val_ptr_len,
410 snmpNotifyFilterSubtree_val_ptr,
411 snmpNotifyFilterSubtree_val_ptr_len))
412 return MFD_ERROR;
413
414 /*
415 * convert mib index to oid index
416 */
417 rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
418 if (0 != snmpNotifyFilterTable_index_to_oid(&rowreq_ctx->oid_idx,
419 &rowreq_ctx->tbl_idx)) {
420 return MFD_ERROR;
421 }
422
423 return MFD_SUCCESS;
424 } /* snmpNotifyFilterTable_indexes_set */
425
426
427 /*---------------------------------------------------------------------
428 * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterMask
429 * snmpNotifyFilterMask is subid 2 of snmpNotifyFilterEntry.
430 * Its status is Current, and its access level is Create.
431 * OID: .1.3.6.1.6.3.13.1.3.1.2
432 * Description:
433 The bit mask which, in combination with the corresponding
434 instance of snmpNotifyFilterSubtree, defines a family of
435 subtrees which are included in or excluded from the
436 filter profile.
437
438 Each bit of this bit mask corresponds to a
439 sub-identifier of snmpNotifyFilterSubtree, with the
440 most significant bit of the i-th octet of this octet
441 string value (extended if necessary, see below)
442 corresponding to the (8*i - 7)-th sub-identifier, and
443 the least significant bit of the i-th octet of this
444 octet string corresponding to the (8*i)-th
445 sub-identifier, where i is in the range 1 through 16.
446
447 Each bit of this bit mask specifies whether or not
448 the corresponding sub-identifiers must match when
449 determining if an OBJECT IDENTIFIER matches this
450 family of filter subtrees; a '1' indicates that an
451 exact match must occur; a '0' indicates 'wild card',
452 i.e., any sub-identifier value matches.
453
454 Thus, the OBJECT IDENTIFIER X of an object instance
455 is contained in a family of filter subtrees if, for
456 each sub-identifier of the value of
457 snmpNotifyFilterSubtree, either:
458
459 the i-th bit of snmpNotifyFilterMask is 0, or
460
461 the i-th sub-identifier of X is equal to the i-th
462 sub-identifier of the value of
463 snmpNotifyFilterSubtree.
464
465 If the value of this bit mask is M bits long and
466 there are more than M sub-identifiers in the
467 corresponding instance of snmpNotifyFilterSubtree,
468 then the bit mask is extended with 1's to be the
469 required length.
470
471 Note that when the value of this object is the
472 zero-length string, this extension rule results in
473 a mask of all-1's being used (i.e., no 'wild card'),
474 and the family of filter subtrees is the one
475 subtree uniquely identified by the corresponding
476 instance of snmpNotifyFilterSubtree.
477 *
478 * Attributes:
479 * accessible 1 isscalar 0 enums 0 hasdefval 1
480 * readable 1 iscolumn 1 ranges 1 hashint 0
481 * settable 1
482 * defval: 0
483 *
484 * Ranges: 0 - 16;
485 *
486 * Its syntax is OCTETSTR (based on perltype OCTETSTR)
487 * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
488 * This data type requires a length. (Max 16)
489 */
490 /**
491 * Extract the current value of the snmpNotifyFilterMask data.
492 *
493 * Set a value using the data context for the row.
494 *
495 * @param rowreq_ctx
496 * Pointer to the row request context.
497 * @param snmpNotifyFilterMask_val_ptr_ptr
498 * Pointer to storage for a char variable
499 * @param snmpNotifyFilterMask_val_ptr_len_ptr
500 * Pointer to a size_t. On entry, it will contain the size (in bytes)
501 * pointed to by snmpNotifyFilterMask.
502 * On exit, this value should contain the data size (in bytes).
503 *
504 * @retval MFD_SUCCESS : success
505 * @retval MFD_SKIP : skip this node (no value for now)
506 * @retval MFD_ERROR : Any other error
507 *
508 * @note If you need more than (*snmpNotifyFilterMask_val_ptr_len_ptr) bytes of memory,
509 * allocate it using malloc() and update snmpNotifyFilterMask_val_ptr_ptr.
510 * <b>DO NOT</b> free the previous pointer.
511 * The MFD helper will release the memory you allocate.
512 *
513 * @remark If you call this function yourself, you are responsible
514 * for checking if the pointer changed, and freeing any
515 * previously allocated memory. (Not necessary if you pass
516 * in a pointer to static memory, obviously.)
517 */
518 int
snmpNotifyFilterMask_get(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,char ** snmpNotifyFilterMask_val_ptr_ptr,size_t * snmpNotifyFilterMask_val_ptr_len_ptr)519 snmpNotifyFilterMask_get(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,
520 char **snmpNotifyFilterMask_val_ptr_ptr,
521 size_t * snmpNotifyFilterMask_val_ptr_len_ptr)
522 {
523 /** we should have a non-NULL pointer and enough storage */
524 netsnmp_assert((NULL != snmpNotifyFilterMask_val_ptr_ptr)
525 && (NULL != *snmpNotifyFilterMask_val_ptr_ptr));
526 netsnmp_assert(NULL != snmpNotifyFilterMask_val_ptr_len_ptr);
527
528
529 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterMask_get",
530 "called\n"));
531
532 netsnmp_assert(NULL != rowreq_ctx);
533
534 /*
535 * TODO:231:o: |-> Extract the current value of the snmpNotifyFilterMask data.
536 * copy (* snmpNotifyFilterMask_val_ptr_ptr ) data and (* snmpNotifyFilterMask_val_ptr_len_ptr ) from rowreq_ctx->data
537 */
538 /*
539 * make sure there is enough space for snmpNotifyFilterMask data
540 */
541 if ((NULL == (*snmpNotifyFilterMask_val_ptr_ptr)) ||
542 ((*snmpNotifyFilterMask_val_ptr_len_ptr) <
543 (rowreq_ctx->data.snmpNotifyFilterMask_len *
544 sizeof(rowreq_ctx->data.snmpNotifyFilterMask[0])))) {
545 /*
546 * allocate space for snmpNotifyFilterMask data
547 */
548 (*snmpNotifyFilterMask_val_ptr_ptr) = (char*)
549 malloc(rowreq_ctx->data.snmpNotifyFilterMask_len *
550 sizeof(rowreq_ctx->data.snmpNotifyFilterMask[0]));
551 if (NULL == (*snmpNotifyFilterMask_val_ptr_ptr)) {
552 snmp_log(LOG_ERR, "could not allocate memory\n");
553 return MFD_ERROR;
554 }
555 }
556 (*snmpNotifyFilterMask_val_ptr_len_ptr) =
557 rowreq_ctx->data.snmpNotifyFilterMask_len *
558 sizeof(rowreq_ctx->data.snmpNotifyFilterMask[0]);
559 memcpy((*snmpNotifyFilterMask_val_ptr_ptr),
560 rowreq_ctx->data.snmpNotifyFilterMask,
561 rowreq_ctx->data.snmpNotifyFilterMask_len *
562 sizeof(rowreq_ctx->data.snmpNotifyFilterMask[0]));
563
564 return MFD_SUCCESS;
565 } /* snmpNotifyFilterMask_get */
566
567 /*---------------------------------------------------------------------
568 * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterType
569 * snmpNotifyFilterType is subid 3 of snmpNotifyFilterEntry.
570 * Its status is Current, and its access level is Create.
571 * OID: .1.3.6.1.6.3.13.1.3.1.3
572 * Description:
573 This object indicates whether the family of filter subtrees
574 defined by this entry are included in or excluded from a
575 filter. A more detailed discussion of the use of this
576 object can be found in section 6. of [SNMP-APPL].
577 *
578 * Attributes:
579 * accessible 1 isscalar 0 enums 1 hasdefval 1
580 * readable 1 iscolumn 1 ranges 0 hashint 0
581 * settable 1
582 * defval: included
583 *
584 * Enum range: 2/8. Values: included(1), excluded(2)
585 *
586 * Its syntax is INTEGER (based on perltype INTEGER)
587 * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
588 */
589 /**
590 * Extract the current value of the snmpNotifyFilterType data.
591 *
592 * Set a value using the data context for the row.
593 *
594 * @param rowreq_ctx
595 * Pointer to the row request context.
596 * @param snmpNotifyFilterType_val_ptr
597 * Pointer to storage for a long variable
598 *
599 * @retval MFD_SUCCESS : success
600 * @retval MFD_SKIP : skip this node (no value for now)
601 * @retval MFD_ERROR : Any other error
602 */
603 int
snmpNotifyFilterType_get(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,u_long * snmpNotifyFilterType_val_ptr)604 snmpNotifyFilterType_get(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,
605 u_long * snmpNotifyFilterType_val_ptr)
606 {
607 /** we should have a non-NULL pointer */
608 netsnmp_assert(NULL != snmpNotifyFilterType_val_ptr);
609
610
611 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterType_get",
612 "called\n"));
613
614 netsnmp_assert(NULL != rowreq_ctx);
615
616 /*
617 * TODO:231:o: |-> Extract the current value of the snmpNotifyFilterType data.
618 * copy (* snmpNotifyFilterType_val_ptr ) from rowreq_ctx->data
619 */
620 (*snmpNotifyFilterType_val_ptr) =
621 rowreq_ctx->data.snmpNotifyFilterType;
622
623 return MFD_SUCCESS;
624 } /* snmpNotifyFilterType_get */
625
626 /*---------------------------------------------------------------------
627 * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterStorageType
628 * snmpNotifyFilterStorageType is subid 4 of snmpNotifyFilterEntry.
629 * Its status is Current, and its access level is Create.
630 * OID: .1.3.6.1.6.3.13.1.3.1.4
631 * Description:
632 The storage type for this conceptual row.
633 Conceptual rows having the value 'permanent' need not
634
635 allow write-access to any columnar objects in the row.
636 *
637 * Attributes:
638 * accessible 1 isscalar 0 enums 1 hasdefval 1
639 * readable 1 iscolumn 1 ranges 0 hashint 0
640 * settable 1
641 * defval: nonVolatile
642 *
643 * Enum range: 4/8. Values: other(1), volatile(2), nonVolatile(3), permanent(4), readOnly(5)
644 *
645 * Its syntax is StorageType (based on perltype INTEGER)
646 * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
647 */
648 /**
649 * Extract the current value of the snmpNotifyFilterStorageType data.
650 *
651 * Set a value using the data context for the row.
652 *
653 * @param rowreq_ctx
654 * Pointer to the row request context.
655 * @param snmpNotifyFilterStorageType_val_ptr
656 * Pointer to storage for a long variable
657 *
658 * @retval MFD_SUCCESS : success
659 * @retval MFD_SKIP : skip this node (no value for now)
660 * @retval MFD_ERROR : Any other error
661 */
662 int
snmpNotifyFilterStorageType_get(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,u_long * snmpNotifyFilterStorageType_val_ptr)663 snmpNotifyFilterStorageType_get(snmpNotifyFilterTable_rowreq_ctx *
664 rowreq_ctx,
665 u_long *
666 snmpNotifyFilterStorageType_val_ptr)
667 {
668 /** we should have a non-NULL pointer */
669 netsnmp_assert(NULL != snmpNotifyFilterStorageType_val_ptr);
670
671
672 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterStorageType_get", "called\n"));
673
674 netsnmp_assert(NULL != rowreq_ctx);
675
676 /*
677 * TODO:231:o: |-> Extract the current value of the snmpNotifyFilterStorageType data.
678 * copy (* snmpNotifyFilterStorageType_val_ptr ) from rowreq_ctx->data
679 */
680 (*snmpNotifyFilterStorageType_val_ptr) =
681 rowreq_ctx->data.snmpNotifyFilterStorageType;
682
683 return MFD_SUCCESS;
684 } /* snmpNotifyFilterStorageType_get */
685
686 /*---------------------------------------------------------------------
687 * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterRowStatus
688 * snmpNotifyFilterRowStatus is subid 5 of snmpNotifyFilterEntry.
689 * Its status is Current, and its access level is Create.
690 * OID: .1.3.6.1.6.3.13.1.3.1.5
691 * Description:
692 The status of this conceptual row.
693
694 To create a row in this table, a manager must
695 set this object to either createAndGo(4) or
696 createAndWait(5).
697 *
698 * Attributes:
699 * accessible 1 isscalar 0 enums 1 hasdefval 0
700 * readable 1 iscolumn 1 ranges 0 hashint 0
701 * settable 1
702 *
703 * Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
704 *
705 * Its syntax is RowStatus (based on perltype INTEGER)
706 * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
707 */
708 /**
709 * Extract the current value of the snmpNotifyFilterRowStatus data.
710 *
711 * Set a value using the data context for the row.
712 *
713 * @param rowreq_ctx
714 * Pointer to the row request context.
715 * @param snmpNotifyFilterRowStatus_val_ptr
716 * Pointer to storage for a long variable
717 *
718 * @retval MFD_SUCCESS : success
719 * @retval MFD_SKIP : skip this node (no value for now)
720 * @retval MFD_ERROR : Any other error
721 */
722 int
snmpNotifyFilterRowStatus_get(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,u_long * snmpNotifyFilterRowStatus_val_ptr)723 snmpNotifyFilterRowStatus_get(snmpNotifyFilterTable_rowreq_ctx *
724 rowreq_ctx,
725 u_long * snmpNotifyFilterRowStatus_val_ptr)
726 {
727 /** we should have a non-NULL pointer */
728 netsnmp_assert(NULL != snmpNotifyFilterRowStatus_val_ptr);
729
730 (*snmpNotifyFilterRowStatus_val_ptr) =
731 rowreq_ctx->data.snmpNotifyFilterRowStatus;
732
733 return MFD_SUCCESS;
734 } /* snmpNotifyFilterRowStatus_get */
735
736
737
738 /** @} */
739 /**********************************************************************
740 **********************************************************************
741 ***
742 *** Table snmpNotifyFilterTable
743 ***
744 **********************************************************************
745 **********************************************************************/
746 /*
747 * SNMP-NOTIFICATION-MIB::snmpNotifyFilterTable is subid 3 of snmpNotifyObjects.
748 * Its status is Current.
749 * OID: .1.3.6.1.6.3.13.1.3, length: 9
750 */
751 /*
752 * NOTE: if you update this chart, please update the versions in
753 * local/mib2c-conf.d/parent-set.m2i
754 * agent/mibgroup/helpers/baby_steps.c
755 * while you're at it.
756 */
757 /*
758 ***********************************************************************
759 * Baby Steps Flow Chart (2004.06.05) *
760 * *
761 * +--------------+ +================+ U = unconditional path *
762 * |optional state| ||required state|| S = path for success *
763 * +--------------+ +================+ E = path for error *
764 ***********************************************************************
765 *
766 * +--------------+
767 * | pre |
768 * | request |
769 * +--------------+
770 * | U
771 * +-------------+ +==============+
772 * | row |f|<-------|| object ||
773 * | create |1| E || lookup ||
774 * +-------------+ +==============+
775 * E | | S | S
776 * | +------------------>|
777 * | +==============+
778 * | E || check ||
779 * |<---------------|| values ||
780 * | +==============+
781 * | | S
782 * | +==============+
783 * | +<-------|| undo ||
784 * | | E || setup ||
785 * | | +==============+
786 * | | | S
787 * | | +==============+
788 * | | || set ||-------------------------->+
789 * | | || value || E |
790 * | | +==============+ |
791 * | | | S |
792 * | | +--------------+ |
793 * | | | check |-------------------------->|
794 * | | | consistency | E |
795 * | | +--------------+ |
796 * | | | S |
797 * | | +==============+ +==============+ |
798 * | | || commit ||-------->|| undo || |
799 * | | || || E || commit || |
800 * | | +==============+ +==============+ |
801 * | | | S U |<--------+
802 * | | +--------------+ +==============+
803 * | | | irreversible | || undo ||
804 * | | | commit | || set ||
805 * | | +--------------+ +==============+
806 * | | | U U |
807 * | +-------------->|<------------------------+
808 * | +==============+
809 * | || undo ||
810 * | || cleanup ||
811 * | +==============+
812 * +---------------------->| U
813 * |
814 * (err && f1)------------------->+
815 * | |
816 * +--------------+ +--------------+
817 * | post |<--------| row |
818 * | request | U | release |
819 * +--------------+ +--------------+
820 *
821 */
822
823 /**
824 * Setup up context with information needed to undo a set request.
825 *
826 * This function will be called before the individual node undo setup
827 * functions are called. If you need to do any undo setup that is not
828 * related to a specific column, you can do it here.
829 *
830 * Note that the undo context has been allocated with
831 * snmpNotifyFilterTable_allocate_data(), but may need extra
832 * initialization similar to what you may have done in
833 * snmpNotifyFilterTable_rowreq_ctx_init().
834 * Note that an individual node's undo_setup function will only be called
835 * if that node is being set to a new value.
836 *
837 * If there is any setup specific to a particular column (e.g. allocating
838 * memory for a string), you should do that setup in the node's undo_setup
839 * function, so it won't be done unless it is necessary.
840 *
841 * @param rowreq_ctx
842 * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx)
843 *
844 * @retval MFD_SUCCESS : success
845 * @retval MFD_ERROR : error. set will fail.
846 */
847 int
snmpNotifyFilterTable_undo_setup(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)848 snmpNotifyFilterTable_undo_setup(snmpNotifyFilterTable_rowreq_ctx *
849 rowreq_ctx)
850 {
851 int rc = MFD_SUCCESS;
852
853 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_undo_setup", "called\n"));
854
855 /** we should have a non-NULL pointer */
856 netsnmp_assert(NULL != rowreq_ctx);
857
858 /*
859 * TODO:451:M: |-> Setup snmpNotifyFilterTable undo.
860 * set up snmpNotifyFilterTable undo information, in preparation for a set.
861 * Undo storage is in (* snmpNotifyFilterRowStatus_val_ptr )*
862 */
863
864 return rc;
865 } /* snmpNotifyFilterTable_undo_setup */
866
867 /**
868 * Undo a set request.
869 *
870 * This function will be called before the individual node undo
871 * functions are called. If you need to do any undo that is not
872 * related to a specific column, you can do it here.
873 *
874 * Note that an individual node's undo function will only be called
875 * if that node is being set to a new value.
876 *
877 * If there is anything specific to a particular column (e.g. releasing
878 * memory for a string), you should do that setup in the node's undo
879 * function, so it won't be done unless it is necessary.
880 *
881 * @param rowreq_ctx
882 * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx)
883 *
884 * @retval MFD_SUCCESS : success
885 * @retval MFD_ERROR : error. set will fail.
886 */
887 int
snmpNotifyFilterTable_undo(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)888 snmpNotifyFilterTable_undo(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)
889 {
890 int rc = MFD_SUCCESS;
891
892 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_undo",
893 "called\n"));
894
895 /** we should have a non-NULL pointer */
896 netsnmp_assert(NULL != rowreq_ctx);
897
898 /*
899 * TODO:451:M: |-> snmpNotifyFilterTable undo.
900 * snmpNotifyFilterTable undo information, in response to a failed set.
901 * Undo storage is in (* snmpNotifyFilterRowStatus_val_ptr )*
902 */
903
904 return rc;
905 } /* snmpNotifyFilterTable_undo_setup */
906
907 /**
908 * Cleanup up context undo information.
909 *
910 * This function will be called after set/commit processing. If you
911 * allocated any resources in undo_setup, this is the place to release
912 * those resources.
913 *
914 * This function is called regardless of the success or failure of the set
915 * request. If you need to perform different steps for cleanup depending
916 * on success or failure, you can add a flag to the rowreq_ctx.
917 *
918 * @param rowreq_ctx
919 * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx)
920 *
921 * @retval MFD_SUCCESS : success
922 * @retval MFD_ERROR : error
923 */
924 int
snmpNotifyFilterTable_undo_cleanup(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)925 snmpNotifyFilterTable_undo_cleanup(snmpNotifyFilterTable_rowreq_ctx *
926 rowreq_ctx)
927 {
928 int rc = MFD_SUCCESS;
929
930 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_undo_cleanup", "called\n"));
931
932 /** we should have a non-NULL pointer */
933 netsnmp_assert(NULL != rowreq_ctx);
934
935 /*
936 * TODO:452:M: |-> Cleanup snmpNotifyFilterTable undo.
937 * Undo storage is in (* snmpNotifyFilterRowStatus_val_ptr )*
938 */
939
940 return rc;
941 } /* snmpNotifyFilterTable_undo_cleanup */
942
943 /**
944 * commit new values.
945 *
946 * At this point, you should have done everything you can to ensure that
947 * this commit will not fail.
948 *
949 * Should you need different behavior depending on which columns were
950 * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
951 * set. The definitions for the COLUMN_*_FLAG bits can be found in
952 * snmpNotifyFilterTable.h.
953 * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
954 *
955 * @param rowreq_ctx
956 * Pointer to the users context.
957 *
958 * @retval MFD_SUCCESS : success
959 * @retval MFD_ERROR : error
960 */
961 int
snmpNotifyFilterTable_commit(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)962 snmpNotifyFilterTable_commit(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)
963 {
964 int rc = MFD_SUCCESS;
965 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_commit", "called\n"));
966
967 /** we should have a non-NULL pointer */
968 netsnmp_assert(NULL != rowreq_ctx);
969
970 /*
971 * commit snmpNotifyFilterTable data
972 */
973
974 /*
975 * if we successfully commited this row, set the dirty flag.
976 */
977 rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;
978
979 return rc;
980 } /* snmpNotifyFilterTable_commit */
981
982 /**
983 * undo commit new values.
984 *
985 * Should you need different behavior depending on which columns were
986 * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
987 * set. The definitions for the COLUMN_*_FLAG bits can be found in
988 * snmpNotifyFilterTable.h.
989 * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
990 *
991 * @param rowreq_ctx
992 * Pointer to the users context.
993 *
994 * @retval MFD_SUCCESS : success
995 * @retval MFD_ERROR : error
996 */
997 int
snmpNotifyFilterTable_undo_commit(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)998 snmpNotifyFilterTable_undo_commit(snmpNotifyFilterTable_rowreq_ctx *
999 rowreq_ctx)
1000 {
1001 int rc = MFD_SUCCESS;
1002
1003 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_undo_commit", "called\n"));
1004
1005 /** we should have a non-NULL pointer */
1006 netsnmp_assert(NULL != rowreq_ctx);
1007
1008 /*
1009 * TODO:485:M: |-> Undo snmpNotifyFilterTable commit.
1010 * check the column's flag in rowreq_ctx->column_set_flags to see
1011 * if it was set during commit, then undo it.
1012 *
1013 * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
1014 */
1015
1016
1017 /*
1018 * if we successfully un-commited this row, clear the dirty flag.
1019 */
1020 if (MFD_SUCCESS == rc) {
1021 rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
1022 }
1023
1024 return rc;
1025 } /* snmpNotifyFilterTable_undo_commit */
1026
1027 /*
1028 * TODO:440:M: Implement snmpNotifyFilterTable node value checks.
1029 * TODO:450:M: Implement snmpNotifyFilterTable undo functions.
1030 * TODO:460:M: Implement snmpNotifyFilterTable set functions.
1031 * TODO:480:M: Implement snmpNotifyFilterTable commit functions.
1032 */
1033 /*---------------------------------------------------------------------
1034 * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterMask
1035 * snmpNotifyFilterMask is subid 2 of snmpNotifyFilterEntry.
1036 * Its status is Current, and its access level is Create.
1037 * OID: .1.3.6.1.6.3.13.1.3.1.2
1038 * Description:
1039 The bit mask which, in combination with the corresponding
1040 instance of snmpNotifyFilterSubtree, defines a family of
1041 subtrees which are included in or excluded from the
1042 filter profile.
1043
1044 Each bit of this bit mask corresponds to a
1045 sub-identifier of snmpNotifyFilterSubtree, with the
1046 most significant bit of the i-th octet of this octet
1047 string value (extended if necessary, see below)
1048 corresponding to the (8*i - 7)-th sub-identifier, and
1049 the least significant bit of the i-th octet of this
1050 octet string corresponding to the (8*i)-th
1051 sub-identifier, where i is in the range 1 through 16.
1052
1053 Each bit of this bit mask specifies whether or not
1054 the corresponding sub-identifiers must match when
1055 determining if an OBJECT IDENTIFIER matches this
1056 family of filter subtrees; a '1' indicates that an
1057 exact match must occur; a '0' indicates 'wild card',
1058 i.e., any sub-identifier value matches.
1059
1060 Thus, the OBJECT IDENTIFIER X of an object instance
1061 is contained in a family of filter subtrees if, for
1062 each sub-identifier of the value of
1063 snmpNotifyFilterSubtree, either:
1064
1065 the i-th bit of snmpNotifyFilterMask is 0, or
1066
1067 the i-th sub-identifier of X is equal to the i-th
1068 sub-identifier of the value of
1069 snmpNotifyFilterSubtree.
1070
1071 If the value of this bit mask is M bits long and
1072 there are more than M sub-identifiers in the
1073 corresponding instance of snmpNotifyFilterSubtree,
1074 then the bit mask is extended with 1's to be the
1075 required length.
1076
1077 Note that when the value of this object is the
1078 zero-length string, this extension rule results in
1079 a mask of all-1's being used (i.e., no 'wild card'),
1080 and the family of filter subtrees is the one
1081 subtree uniquely identified by the corresponding
1082 instance of snmpNotifyFilterSubtree.
1083 *
1084 * Attributes:
1085 * accessible 1 isscalar 0 enums 0 hasdefval 1
1086 * readable 1 iscolumn 1 ranges 1 hashint 0
1087 * settable 1
1088 * defval: 0
1089 *
1090 * Ranges: 0 - 16;
1091 *
1092 * Its syntax is OCTETSTR (based on perltype OCTETSTR)
1093 * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
1094 * This data type requires a length. (Max 16)
1095 */
1096 /**
1097 * Check that the proposed new value is potentially valid.
1098 *
1099 * @param rowreq_ctx
1100 * Pointer to the row request context.
1101 * @param snmpNotifyFilterMask_val_ptr
1102 * A char containing the new value.
1103 * @param snmpNotifyFilterMask_val_ptr_len
1104 * The size (in bytes) of the data pointed to by snmpNotifyFilterMask_val_ptr
1105 *
1106 * @retval MFD_SUCCESS : incoming value is legal
1107 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
1108 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
1109 *
1110 * This is the place to check for requirements that are not
1111 * expressed in the mib syntax (for example, a requirement that
1112 * is detailed in the description for an object).
1113 *
1114 * You should check that the requested change between the undo value and the
1115 * new value is legal (ie, the transistion from one value to another
1116 * is legal).
1117 *
1118 *@note
1119 * This check is only to determine if the new value
1120 * is \b potentially valid. This is the first check of many, and
1121 * is one of the simplest ones.
1122 *
1123 *@note
1124 * this is not the place to do any checks for values
1125 * which depend on some other value in the mib. Those
1126 * types of checks should be done in the
1127 * snmpNotifyFilterTable_check_dependencies() function.
1128 *
1129 * The following checks have already been done for you:
1130 * The syntax is ASN_OCTET_STR
1131 * The length is < sizeof(rowreq_ctx->data.snmpNotifyFilterMask).
1132 * The length is in (one of) the range set(s): 0 - 16
1133 *
1134 * If there a no other checks you need to do, simply return MFD_SUCCESS.
1135 *
1136 */
1137 int
snmpNotifyFilterMask_check_value(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,char * snmpNotifyFilterMask_val_ptr,size_t snmpNotifyFilterMask_val_ptr_len)1138 snmpNotifyFilterMask_check_value(snmpNotifyFilterTable_rowreq_ctx *
1139 rowreq_ctx,
1140 char *snmpNotifyFilterMask_val_ptr,
1141 size_t snmpNotifyFilterMask_val_ptr_len)
1142 {
1143 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterMask_check_value", "called\n"));
1144
1145 /** should never get a NULL pointer */
1146 netsnmp_assert(NULL != rowreq_ctx);
1147 netsnmp_assert(NULL != snmpNotifyFilterMask_val_ptr);
1148
1149 /*
1150 * TODO:441:o: |-> Check for valid snmpNotifyFilterMask value.
1151 */
1152
1153 return MFD_SUCCESS; /* snmpNotifyFilterMask value not illegal */
1154 } /* snmpNotifyFilterMask_check_value */
1155
1156 /**
1157 * Save old value information
1158 *
1159 * @param rowreq_ctx
1160 * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx)
1161 *
1162 * @retval MFD_SUCCESS : success
1163 * @retval MFD_ERROR : error. set will fail.
1164 *
1165 * This function will be called after the table level undo setup function
1166 * snmpNotifyFilterTable_undo_setup has been called.
1167 *
1168 *@note
1169 * this function will only be called if a new value is set for this column.
1170 *
1171 * If there is any setup specific to a particular column (e.g. allocating
1172 * memory for a string), you should do that setup in this function, so it
1173 * won't be done unless it is necessary.
1174 */
1175 int
snmpNotifyFilterMask_undo_setup(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)1176 snmpNotifyFilterMask_undo_setup(snmpNotifyFilterTable_rowreq_ctx *
1177 rowreq_ctx)
1178 {
1179 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterMask_undo_setup", "called\n"));
1180
1181 /** should never get a NULL pointer */
1182 netsnmp_assert(NULL != rowreq_ctx);
1183
1184 /*
1185 * TODO:455:o: |-> Setup snmpNotifyFilterMask undo.
1186 */
1187 /*
1188 * copy snmpNotifyFilterMask and snmpNotifyFilterMask_len data
1189 * set rowreq_ctx->undo->snmpNotifyFilterMask from rowreq_ctx->data.snmpNotifyFilterMask
1190 */
1191 memcpy(rowreq_ctx->undo->snmpNotifyFilterMask,
1192 rowreq_ctx->data.snmpNotifyFilterMask,
1193 (rowreq_ctx->data.snmpNotifyFilterMask_len *
1194 sizeof(rowreq_ctx->undo->snmpNotifyFilterMask[0])));
1195 rowreq_ctx->undo->snmpNotifyFilterMask_len =
1196 rowreq_ctx->data.snmpNotifyFilterMask_len;
1197
1198
1199 return MFD_SUCCESS;
1200 } /* snmpNotifyFilterMask_undo_setup */
1201
1202 /**
1203 * Set the new value.
1204 *
1205 * @param rowreq_ctx
1206 * Pointer to the users context. You should know how to
1207 * manipulate the value from this object.
1208 * @param snmpNotifyFilterMask_val_ptr
1209 * A char containing the new value.
1210 * @param snmpNotifyFilterMask_val_ptr_len
1211 * The size (in bytes) of the data pointed to by snmpNotifyFilterMask_val_ptr
1212 */
1213 int
snmpNotifyFilterMask_set(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,char * snmpNotifyFilterMask_val_ptr,size_t snmpNotifyFilterMask_val_ptr_len)1214 snmpNotifyFilterMask_set(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,
1215 char *snmpNotifyFilterMask_val_ptr,
1216 size_t snmpNotifyFilterMask_val_ptr_len)
1217 {
1218
1219 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterMask_set",
1220 "called\n"));
1221
1222 /** should never get a NULL pointer */
1223 netsnmp_assert(NULL != rowreq_ctx);
1224 netsnmp_assert(NULL != snmpNotifyFilterMask_val_ptr);
1225
1226 /*
1227 * TODO:461:M: |-> Set snmpNotifyFilterMask value.
1228 * set snmpNotifyFilterMask value in rowreq_ctx->data
1229 */
1230 memcpy(rowreq_ctx->data.snmpNotifyFilterMask,
1231 snmpNotifyFilterMask_val_ptr, snmpNotifyFilterMask_val_ptr_len);
1232 /** convert bytes to number of char */
1233 rowreq_ctx->data.snmpNotifyFilterMask_len =
1234 snmpNotifyFilterMask_val_ptr_len /
1235 sizeof(snmpNotifyFilterMask_val_ptr[0]);
1236
1237 return MFD_SUCCESS;
1238 } /* snmpNotifyFilterMask_set */
1239
1240 /**
1241 * undo the previous set.
1242 *
1243 * @param rowreq_ctx
1244 * Pointer to the users context.
1245 */
1246 int
snmpNotifyFilterMask_undo(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)1247 snmpNotifyFilterMask_undo(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)
1248 {
1249
1250 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterMask_undo",
1251 "called\n"));
1252
1253 netsnmp_assert(NULL != rowreq_ctx);
1254
1255 /*
1256 * TODO:456:o: |-> Clean up snmpNotifyFilterMask undo.
1257 */
1258 /*
1259 * copy snmpNotifyFilterMask and snmpNotifyFilterMask_len data
1260 * set rowreq_ctx->data.snmpNotifyFilterMask from rowreq_ctx->undo->snmpNotifyFilterMask
1261 */
1262 memcpy(rowreq_ctx->data.snmpNotifyFilterMask,
1263 rowreq_ctx->undo->snmpNotifyFilterMask,
1264 (rowreq_ctx->undo->snmpNotifyFilterMask_len *
1265 sizeof(rowreq_ctx->data.snmpNotifyFilterMask[0])));
1266 rowreq_ctx->data.snmpNotifyFilterMask_len =
1267 rowreq_ctx->undo->snmpNotifyFilterMask_len;
1268
1269
1270 return MFD_SUCCESS;
1271 } /* snmpNotifyFilterMask_undo */
1272
1273 /*---------------------------------------------------------------------
1274 * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterType
1275 * snmpNotifyFilterType is subid 3 of snmpNotifyFilterEntry.
1276 * Its status is Current, and its access level is Create.
1277 * OID: .1.3.6.1.6.3.13.1.3.1.3
1278 * Description:
1279 This object indicates whether the family of filter subtrees
1280 defined by this entry are included in or excluded from a
1281 filter. A more detailed discussion of the use of this
1282 object can be found in section 6. of [SNMP-APPL].
1283 *
1284 * Attributes:
1285 * accessible 1 isscalar 0 enums 1 hasdefval 1
1286 * readable 1 iscolumn 1 ranges 0 hashint 0
1287 * settable 1
1288 * defval: included
1289 *
1290 * Enum range: 2/8. Values: included(1), excluded(2)
1291 *
1292 * Its syntax is INTEGER (based on perltype INTEGER)
1293 * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
1294 */
1295 /**
1296 * Check that the proposed new value is potentially valid.
1297 *
1298 * @param rowreq_ctx
1299 * Pointer to the row request context.
1300 * @param snmpNotifyFilterType_val
1301 * A long containing the new value.
1302 *
1303 * @retval MFD_SUCCESS : incoming value is legal
1304 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
1305 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
1306 *
1307 * This is the place to check for requirements that are not
1308 * expressed in the mib syntax (for example, a requirement that
1309 * is detailed in the description for an object).
1310 *
1311 * You should check that the requested change between the undo value and the
1312 * new value is legal (ie, the transistion from one value to another
1313 * is legal).
1314 *
1315 *@note
1316 * This check is only to determine if the new value
1317 * is \b potentially valid. This is the first check of many, and
1318 * is one of the simplest ones.
1319 *
1320 *@note
1321 * this is not the place to do any checks for values
1322 * which depend on some other value in the mib. Those
1323 * types of checks should be done in the
1324 * snmpNotifyFilterTable_check_dependencies() function.
1325 *
1326 * The following checks have already been done for you:
1327 * The syntax is ASN_INTEGER
1328 * The value is one of included(1), excluded(2)
1329 *
1330 * If there a no other checks you need to do, simply return MFD_SUCCESS.
1331 *
1332 */
1333 int
snmpNotifyFilterType_check_value(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,u_long snmpNotifyFilterType_val)1334 snmpNotifyFilterType_check_value(snmpNotifyFilterTable_rowreq_ctx *
1335 rowreq_ctx,
1336 u_long snmpNotifyFilterType_val)
1337 {
1338 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterType_check_value", "called\n"));
1339
1340 /** should never get a NULL pointer */
1341 netsnmp_assert(NULL != rowreq_ctx);
1342
1343 /*
1344 * TODO:441:o: |-> Check for valid snmpNotifyFilterType value.
1345 */
1346
1347 return MFD_SUCCESS; /* snmpNotifyFilterType value not illegal */
1348 } /* snmpNotifyFilterType_check_value */
1349
1350 /**
1351 * Save old value information
1352 *
1353 * @param rowreq_ctx
1354 * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx)
1355 *
1356 * @retval MFD_SUCCESS : success
1357 * @retval MFD_ERROR : error. set will fail.
1358 *
1359 * This function will be called after the table level undo setup function
1360 * snmpNotifyFilterTable_undo_setup has been called.
1361 *
1362 *@note
1363 * this function will only be called if a new value is set for this column.
1364 *
1365 * If there is any setup specific to a particular column (e.g. allocating
1366 * memory for a string), you should do that setup in this function, so it
1367 * won't be done unless it is necessary.
1368 */
1369 int
snmpNotifyFilterType_undo_setup(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)1370 snmpNotifyFilterType_undo_setup(snmpNotifyFilterTable_rowreq_ctx *
1371 rowreq_ctx)
1372 {
1373 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterType_undo_setup", "called\n"));
1374
1375 /** should never get a NULL pointer */
1376 netsnmp_assert(NULL != rowreq_ctx);
1377
1378 /*
1379 * TODO:455:o: |-> Setup snmpNotifyFilterType undo.
1380 */
1381 /*
1382 * copy snmpNotifyFilterType data
1383 * set rowreq_ctx->undo->snmpNotifyFilterType from rowreq_ctx->data.snmpNotifyFilterType
1384 */
1385 rowreq_ctx->undo->snmpNotifyFilterType =
1386 rowreq_ctx->data.snmpNotifyFilterType;
1387
1388
1389 return MFD_SUCCESS;
1390 } /* snmpNotifyFilterType_undo_setup */
1391
1392 /**
1393 * Set the new value.
1394 *
1395 * @param rowreq_ctx
1396 * Pointer to the users context. You should know how to
1397 * manipulate the value from this object.
1398 * @param snmpNotifyFilterType_val
1399 * A long containing the new value.
1400 */
1401 int
snmpNotifyFilterType_set(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,u_long snmpNotifyFilterType_val)1402 snmpNotifyFilterType_set(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,
1403 u_long snmpNotifyFilterType_val)
1404 {
1405
1406 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterType_set",
1407 "called\n"));
1408
1409 /** should never get a NULL pointer */
1410 netsnmp_assert(NULL != rowreq_ctx);
1411
1412 /*
1413 * TODO:461:M: |-> Set snmpNotifyFilterType value.
1414 * set snmpNotifyFilterType value in rowreq_ctx->data
1415 */
1416 rowreq_ctx->data.snmpNotifyFilterType = snmpNotifyFilterType_val;
1417
1418 return MFD_SUCCESS;
1419 } /* snmpNotifyFilterType_set */
1420
1421 /**
1422 * undo the previous set.
1423 *
1424 * @param rowreq_ctx
1425 * Pointer to the users context.
1426 */
1427 int
snmpNotifyFilterType_undo(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)1428 snmpNotifyFilterType_undo(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)
1429 {
1430
1431 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterType_undo",
1432 "called\n"));
1433
1434 netsnmp_assert(NULL != rowreq_ctx);
1435
1436 /*
1437 * TODO:456:o: |-> Clean up snmpNotifyFilterType undo.
1438 */
1439 /*
1440 * copy snmpNotifyFilterType data
1441 * set rowreq_ctx->data.snmpNotifyFilterType from rowreq_ctx->undo->snmpNotifyFilterType
1442 */
1443 rowreq_ctx->data.snmpNotifyFilterType =
1444 rowreq_ctx->undo->snmpNotifyFilterType;
1445
1446
1447 return MFD_SUCCESS;
1448 } /* snmpNotifyFilterType_undo */
1449
1450 /*---------------------------------------------------------------------
1451 * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterStorageType
1452 * snmpNotifyFilterStorageType is subid 4 of snmpNotifyFilterEntry.
1453 * Its status is Current, and its access level is Create.
1454 * OID: .1.3.6.1.6.3.13.1.3.1.4
1455 * Description:
1456 The storage type for this conceptual row.
1457 Conceptual rows having the value 'permanent' need not
1458
1459 allow write-access to any columnar objects in the row.
1460 *
1461 * Attributes:
1462 * accessible 1 isscalar 0 enums 1 hasdefval 1
1463 * readable 1 iscolumn 1 ranges 0 hashint 0
1464 * settable 1
1465 * defval: nonVolatile
1466 *
1467 * Enum range: 4/8. Values: other(1), volatile(2), nonVolatile(3), permanent(4), readOnly(5)
1468 *
1469 * Its syntax is StorageType (based on perltype INTEGER)
1470 * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
1471 */
1472 /**
1473 * Check that the proposed new value is potentially valid.
1474 *
1475 * @param rowreq_ctx
1476 * Pointer to the row request context.
1477 * @param snmpNotifyFilterStorageType_val
1478 * A long containing the new value.
1479 *
1480 * @retval MFD_SUCCESS : incoming value is legal
1481 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
1482 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
1483 *
1484 * This is the place to check for requirements that are not
1485 * expressed in the mib syntax (for example, a requirement that
1486 * is detailed in the description for an object).
1487 *
1488 * You should check that the requested change between the undo value and the
1489 * new value is legal (ie, the transistion from one value to another
1490 * is legal).
1491 *
1492 *@note
1493 * This check is only to determine if the new value
1494 * is \b potentially valid. This is the first check of many, and
1495 * is one of the simplest ones.
1496 *
1497 *@note
1498 * this is not the place to do any checks for values
1499 * which depend on some other value in the mib. Those
1500 * types of checks should be done in the
1501 * snmpNotifyFilterTable_check_dependencies() function.
1502 *
1503 * The following checks have already been done for you:
1504 * The syntax is ASN_INTEGER
1505 * The value is one of other(1), volatile(2), nonVolatile(3), permanent(4), readOnly(5)
1506 *
1507 * If there a no other checks you need to do, simply return MFD_SUCCESS.
1508 *
1509 */
1510 int
snmpNotifyFilterStorageType_check_value(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,u_long snmpNotifyFilterStorageType_val)1511 snmpNotifyFilterStorageType_check_value(snmpNotifyFilterTable_rowreq_ctx *
1512 rowreq_ctx,
1513 u_long
1514 snmpNotifyFilterStorageType_val)
1515 {
1516 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterStorageType_check_value", "called\n"));
1517
1518 /** should never get a NULL pointer */
1519 netsnmp_assert(NULL != rowreq_ctx);
1520
1521 /*
1522 * TODO:441:o: |-> Check for valid snmpNotifyFilterStorageType value.
1523 */
1524
1525 return MFD_SUCCESS; /* snmpNotifyFilterStorageType value not illegal */
1526 } /* snmpNotifyFilterStorageType_check_value */
1527
1528 /**
1529 * Save old value information
1530 *
1531 * @param rowreq_ctx
1532 * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx)
1533 *
1534 * @retval MFD_SUCCESS : success
1535 * @retval MFD_ERROR : error. set will fail.
1536 *
1537 * This function will be called after the table level undo setup function
1538 * snmpNotifyFilterTable_undo_setup has been called.
1539 *
1540 *@note
1541 * this function will only be called if a new value is set for this column.
1542 *
1543 * If there is any setup specific to a particular column (e.g. allocating
1544 * memory for a string), you should do that setup in this function, so it
1545 * won't be done unless it is necessary.
1546 */
1547 int
snmpNotifyFilterStorageType_undo_setup(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)1548 snmpNotifyFilterStorageType_undo_setup(snmpNotifyFilterTable_rowreq_ctx *
1549 rowreq_ctx)
1550 {
1551 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterStorageType_undo_setup", "called\n"));
1552
1553 /** should never get a NULL pointer */
1554 netsnmp_assert(NULL != rowreq_ctx);
1555
1556 /*
1557 * TODO:455:o: |-> Setup snmpNotifyFilterStorageType undo.
1558 */
1559 /*
1560 * copy snmpNotifyFilterStorageType data
1561 * set rowreq_ctx->undo->snmpNotifyFilterStorageType from rowreq_ctx->data.snmpNotifyFilterStorageType
1562 */
1563 rowreq_ctx->undo->snmpNotifyFilterStorageType =
1564 rowreq_ctx->data.snmpNotifyFilterStorageType;
1565
1566
1567 return MFD_SUCCESS;
1568 } /* snmpNotifyFilterStorageType_undo_setup */
1569
1570 /**
1571 * Set the new value.
1572 *
1573 * @param rowreq_ctx
1574 * Pointer to the users context. You should know how to
1575 * manipulate the value from this object.
1576 * @param snmpNotifyFilterStorageType_val
1577 * A long containing the new value.
1578 */
1579 int
snmpNotifyFilterStorageType_set(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,u_long snmpNotifyFilterStorageType_val)1580 snmpNotifyFilterStorageType_set(snmpNotifyFilterTable_rowreq_ctx *
1581 rowreq_ctx,
1582 u_long snmpNotifyFilterStorageType_val)
1583 {
1584
1585 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterStorageType_set", "called\n"));
1586
1587 /** should never get a NULL pointer */
1588 netsnmp_assert(NULL != rowreq_ctx);
1589
1590 /*
1591 * TODO:461:M: |-> Set snmpNotifyFilterStorageType value.
1592 * set snmpNotifyFilterStorageType value in rowreq_ctx->data
1593 */
1594 rowreq_ctx->data.snmpNotifyFilterStorageType =
1595 snmpNotifyFilterStorageType_val;
1596
1597 return MFD_SUCCESS;
1598 } /* snmpNotifyFilterStorageType_set */
1599
1600 /**
1601 * undo the previous set.
1602 *
1603 * @param rowreq_ctx
1604 * Pointer to the users context.
1605 */
1606 int
snmpNotifyFilterStorageType_undo(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)1607 snmpNotifyFilterStorageType_undo(snmpNotifyFilterTable_rowreq_ctx *
1608 rowreq_ctx)
1609 {
1610
1611 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterStorageType_undo", "called\n"));
1612
1613 netsnmp_assert(NULL != rowreq_ctx);
1614
1615 /*
1616 * TODO:456:o: |-> Clean up snmpNotifyFilterStorageType undo.
1617 */
1618 /*
1619 * copy snmpNotifyFilterStorageType data
1620 * set rowreq_ctx->data.snmpNotifyFilterStorageType from rowreq_ctx->undo->snmpNotifyFilterStorageType
1621 */
1622 rowreq_ctx->data.snmpNotifyFilterStorageType =
1623 rowreq_ctx->undo->snmpNotifyFilterStorageType;
1624
1625
1626 return MFD_SUCCESS;
1627 } /* snmpNotifyFilterStorageType_undo */
1628
1629 /*---------------------------------------------------------------------
1630 * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterRowStatus
1631 * snmpNotifyFilterRowStatus is subid 5 of snmpNotifyFilterEntry.
1632 * Its status is Current, and its access level is Create.
1633 * OID: .1.3.6.1.6.3.13.1.3.1.5
1634 * Description:
1635 The status of this conceptual row.
1636
1637 To create a row in this table, a manager must
1638 set this object to either createAndGo(4) or
1639 createAndWait(5).
1640 *
1641 * Attributes:
1642 * accessible 1 isscalar 0 enums 1 hasdefval 0
1643 * readable 1 iscolumn 1 ranges 0 hashint 0
1644 * settable 1
1645 *
1646 * Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
1647 *
1648 * Its syntax is RowStatus (based on perltype INTEGER)
1649 * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
1650 */
1651 /**
1652 * Check that the proposed new value is potentially valid.
1653 *
1654 * @param rowreq_ctx
1655 * Pointer to the row request context.
1656 * @param snmpNotifyFilterRowStatus_val
1657 * A long containing the new value.
1658 *
1659 * @retval MFD_SUCCESS : incoming value is legal
1660 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
1661 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
1662 *
1663 * This is the place to check for requirements that are not
1664 * expressed in the mib syntax (for example, a requirement that
1665 * is detailed in the description for an object).
1666 *
1667 * You should check that the requested change between the undo value and the
1668 * new value is legal (ie, the transistion from one value to another
1669 * is legal).
1670 *
1671 *@note
1672 * This check is only to determine if the new value
1673 * is \b potentially valid. This is the first check of many, and
1674 * is one of the simplest ones.
1675 *
1676 *@note
1677 * this is not the place to do any checks for values
1678 * which depend on some other value in the mib. Those
1679 * types of checks should be done in the
1680 * snmpNotifyFilterTable_check_dependencies() function.
1681 *
1682 * The following checks have already been done for you:
1683 * The syntax is ASN_INTEGER
1684 * The value is one of active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
1685 *
1686 * If there a no other checks you need to do, simply return MFD_SUCCESS.
1687 *
1688 */
1689 int
snmpNotifyFilterRowStatus_check_value(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,u_long snmpNotifyFilterRowStatus_val)1690 snmpNotifyFilterRowStatus_check_value(snmpNotifyFilterTable_rowreq_ctx *
1691 rowreq_ctx,
1692 u_long snmpNotifyFilterRowStatus_val)
1693 {
1694 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterRowStatus_check_value", "called\n"));
1695
1696 /** should never get a NULL pointer */
1697 netsnmp_assert(NULL != rowreq_ctx);
1698
1699 /*
1700 * TODO:441:o: |-> Check for valid snmpNotifyFilterRowStatus value.
1701 */
1702
1703 return MFD_SUCCESS; /* snmpNotifyFilterRowStatus value not illegal */
1704 } /* snmpNotifyFilterRowStatus_check_value */
1705
1706 /**
1707 * Save old value information
1708 *
1709 * @param rowreq_ctx
1710 * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx)
1711 *
1712 * @retval MFD_SUCCESS : success
1713 * @retval MFD_ERROR : error. set will fail.
1714 *
1715 * This function will be called after the table level undo setup function
1716 * snmpNotifyFilterTable_undo_setup has been called.
1717 *
1718 *@note
1719 * this function will only be called if a new value is set for this column.
1720 *
1721 * If there is any setup specific to a particular column (e.g. allocating
1722 * memory for a string), you should do that setup in this function, so it
1723 * won't be done unless it is necessary.
1724 */
1725 int
snmpNotifyFilterRowStatus_undo_setup(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)1726 snmpNotifyFilterRowStatus_undo_setup(snmpNotifyFilterTable_rowreq_ctx *
1727 rowreq_ctx)
1728 {
1729 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterRowStatus_undo_setup", "called\n"));
1730
1731 /** should never get a NULL pointer */
1732 netsnmp_assert(NULL != rowreq_ctx);
1733
1734 /*
1735 * TODO:455:o: |-> Setup snmpNotifyFilterRowStatus undo.
1736 */
1737 /*
1738 * copy snmpNotifyFilterRowStatus data
1739 * set rowreq_ctx->undo->snmpNotifyFilterRowStatus from rowreq_ctx->data.snmpNotifyFilterRowStatus
1740 */
1741 rowreq_ctx->undo->snmpNotifyFilterRowStatus =
1742 rowreq_ctx->data.snmpNotifyFilterRowStatus;
1743
1744
1745 return MFD_SUCCESS;
1746 } /* snmpNotifyFilterRowStatus_undo_setup */
1747
1748 /**
1749 * Set the new value.
1750 *
1751 * @param rowreq_ctx
1752 * Pointer to the users context. You should know how to
1753 * manipulate the value from this object.
1754 * @param snmpNotifyFilterRowStatus_val
1755 * A long containing the new value.
1756 */
1757 int
snmpNotifyFilterRowStatus_set(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,u_long snmpNotifyFilterRowStatus_val)1758 snmpNotifyFilterRowStatus_set(snmpNotifyFilterTable_rowreq_ctx *
1759 rowreq_ctx,
1760 u_long snmpNotifyFilterRowStatus_val)
1761 {
1762
1763 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterRowStatus_set", "called\n"));
1764
1765 /** should never get a NULL pointer */
1766 netsnmp_assert(NULL != rowreq_ctx);
1767
1768 /*
1769 * TODO:461:M: |-> Set snmpNotifyFilterRowStatus value.
1770 * set snmpNotifyFilterRowStatus value in rowreq_ctx->data
1771 */
1772 rowreq_ctx->data.snmpNotifyFilterRowStatus =
1773 snmpNotifyFilterRowStatus_val;
1774
1775 return MFD_SUCCESS;
1776 } /* snmpNotifyFilterRowStatus_set */
1777
1778 /**
1779 * undo the previous set.
1780 *
1781 * @param rowreq_ctx
1782 * Pointer to the users context.
1783 */
1784 int
snmpNotifyFilterRowStatus_undo(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)1785 snmpNotifyFilterRowStatus_undo(snmpNotifyFilterTable_rowreq_ctx *
1786 rowreq_ctx)
1787 {
1788
1789 DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterRowStatus_undo", "called\n"));
1790
1791 netsnmp_assert(NULL != rowreq_ctx);
1792
1793 /*
1794 * TODO:456:o: |-> Clean up snmpNotifyFilterRowStatus undo.
1795 */
1796 /*
1797 * copy snmpNotifyFilterRowStatus data
1798 * set rowreq_ctx->data.snmpNotifyFilterRowStatus from rowreq_ctx->undo->snmpNotifyFilterRowStatus
1799 */
1800 rowreq_ctx->data.snmpNotifyFilterRowStatus =
1801 rowreq_ctx->undo->snmpNotifyFilterRowStatus;
1802
1803
1804 return MFD_SUCCESS;
1805 } /* snmpNotifyFilterRowStatus_undo */
1806
1807 /**
1808 * check dependencies
1809 *
1810 * This is useful for for tables which have dependencies between columns
1811 * (or rows, or tables). For example, two columns allocating a percentage
1812 * of something add up 100%.
1813 *
1814 * Should you need different behavior depending on which columns were
1815 * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
1816 * set. The definitions for the COLUMN_*_FLAG bits can be found in
1817 * snmpNotifyFilterTable.h.
1818 * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
1819 *
1820 * @retval MFD_SUCCESS all the changes to the row are legal
1821 * @retval MFD_ERROR one or more changes are not legal
1822 *
1823 * (see README-table-snmpNotifyFilterTable if you don't have dependencies)
1824 */
1825 int
snmpNotifyFilterTable_check_dependencies(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)1826 snmpNotifyFilterTable_check_dependencies(snmpNotifyFilterTable_rowreq_ctx *
1827 rowreq_ctx)
1828 {
1829 int rc = MFD_SUCCESS;
1830
1831 DEBUGMSGTL(("internal:snmpNotifyFilterTable:snmpNotifyFilterTable_check_dependencies", "called\n"));
1832
1833 netsnmp_assert(NULL != rowreq_ctx);
1834
1835 /*
1836 * TODO:470:o: Check snmpNotifyFilterTable row dependencies.
1837 * check that all new value are legal and consistent with each other
1838 */
1839 /*
1840 * check for valid StorageType transition (old, new)
1841 */
1842 rc = check_storage_transition(rowreq_ctx->undo->
1843 snmpNotifyFilterStorageType,
1844 rowreq_ctx->data.
1845 snmpNotifyFilterStorageType);
1846 if (MFD_SUCCESS != rc)
1847 return rc;
1848
1849 /*
1850 * check RowStatus dependencies
1851 */
1852 if (rowreq_ctx->
1853 column_set_flags & COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG) {
1854 /*
1855 * check for valid RowStatus transition (old, new)
1856 * (Note: move transition check to
1857 * to catch errors earlier)
1858 */
1859 rc = check_rowstatus_transition(rowreq_ctx->undo->
1860 snmpNotifyFilterRowStatus,
1861 rowreq_ctx->data.
1862 snmpNotifyFilterRowStatus);
1863 if (MFD_SUCCESS != rc)
1864 return rc;
1865
1866 /*
1867 * row creation requirements
1868 */
1869 if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
1870 if (ROWSTATUS_DESTROY ==
1871 rowreq_ctx->data.snmpNotifyFilterRowStatus) {
1872 rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
1873 } else if (ROWSTATUS_CREATEANDGO ==
1874 rowreq_ctx->data.snmpNotifyFilterRowStatus) {
1875 if ((rowreq_ctx->
1876 column_set_flags &
1877 SNMPNOTIFYFILTERTABLE_REQUIRED_COLS)
1878 != SNMPNOTIFYFILTERTABLE_REQUIRED_COLS) {
1879 DEBUGMSGTL(("snmpNotifyFilterTable",
1880 "required columns missing (0x%0x != 0x%0x)\n",
1881 rowreq_ctx->column_set_flags,
1882 SNMPNOTIFYFILTERTABLE_REQUIRED_COLS));
1883 return MFD_CANNOT_CREATE_NOW;
1884 }
1885 rowreq_ctx->data.snmpNotifyFilterRowStatus =
1886 ROWSTATUS_ACTIVE;
1887 }
1888 } /* row creation */
1889 else {
1890 /*
1891 * row change requirements
1892 */
1893 /*
1894 * don't allow a destroy if any other value was changed, since
1895 * that might call data access routines with bad info.
1896 *
1897 * you may or may not require the row be notInService before it
1898 * can be destroyed.
1899 */
1900 if (ROWSTATUS_DESTROY ==
1901 rowreq_ctx->data.snmpNotifyFilterRowStatus) {
1902 if (rowreq_ctx->
1903 column_set_flags &
1904 ~COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG) {
1905 DEBUGMSGTL(("snmpNotifyFilterTable",
1906 "destroy must be only varbind for row\n"));
1907 return MFD_NOT_VALID_NOW;
1908 }
1909 rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
1910
1911 } /* row destroy */
1912 } /* row change */
1913 } else {
1914 /*
1915 * must have row status to create a row
1916 */
1917 if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
1918 DEBUGMSGTL(("snmpNotifyFilterTable",
1919 "must use RowStatus to create rows\n"));
1920 return MFD_CANNOT_CREATE_NOW;
1921 }
1922 } /* row status not set */
1923
1924 if (MFD_SUCCESS != rc)
1925 return rc;
1926
1927 return rc;
1928 } /* snmpNotifyFilterTable_check_dependencies */
1929
1930 /** @} */
1931 /** @{ */
1932