Debian Codegraph @

agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_set.c

raw
1 /*
2 * Note: this file originally auto-generated by mib2c using
3 * version : 12077 $ of $
4 *
5 * $Id:$
6 *
7 */
8 /*
9 * standard Net-SNMP includes
10 */
11 #include <net-snmp/net-snmp-config.h>
12 #include <net-snmp/net-snmp-includes.h>
13 #include <net-snmp/agent/net-snmp-agent-includes.h>
14
15 /*
16 * include our parent header
17 */
18 #include "etherStatsTable.h"
19
20
21 /** @defgroup data_set data_set: Routines to set data
22 *
23 * These routines are used to set the value for individual objects. The
24 * row context is passed, along with the new value.
25 *
26 * @{
27 */
28 /**********************************************************************
29 **********************************************************************
30 ***
31 *** Table etherStatsTable
32 ***
33 **********************************************************************
34 **********************************************************************/
35 /*
36 * RMON-MIB::etherStatsTable is subid 1 of statistics.
37 * Its status is Current.
38 * OID: .1.3.6.1.2.1.16.1.1, length: 9
39 */
40 /*
41 * NOTE: if you update this chart, please update the versions in
42 * local/mib2c-conf.d/parent-set.m2i
43 * agent/mibgroup/helpers/baby_steps.c
44 * while you're at it.
45 */
46 /*
47 ***********************************************************************
48 * Baby Steps Flow Chart (2004.06.05) *
49 * *
50 * +--------------+ +================+ U = unconditional path *
51 * |optional state| ||required state|| S = path for success *
52 * +--------------+ +================+ E = path for error *
53 ***********************************************************************
54 *
55 * +--------------+
56 * | pre |
57 * | request |
58 * +--------------+
59 * | U
60 * +-------------+ +==============+
61 * | row |f|<-------|| object ||
62 * | create |1| E || lookup ||
63 * +-------------+ +==============+
64 * E | | S | S
65 * | +------------------>|
66 * | +==============+
67 * | E || check ||
68 * |<---------------|| values ||
69 * | +==============+
70 * | | S
71 * | +==============+
72 * | +<-------|| undo ||
73 * | | E || setup ||
74 * | | +==============+
75 * | | | S
76 * | | +==============+
77 * | | || set ||-------------------------->+
78 * | | || value || E |
79 * | | +==============+ |
80 * | | | S |
81 * | | +--------------+ |
82 * | | | check |-------------------------->|
83 * | | | consistency | E |
84 * | | +--------------+ |
85 * | | | S |
86 * | | +==============+ +==============+ |
87 * | | || commit ||-------->|| undo || |
88 * | | || || E || commit || |
89 * | | +==============+ +==============+ |
90 * | | | S U |<--------+
91 * | | +--------------+ +==============+
92 * | | | irreversible | || undo ||
93 * | | | commit | || set ||
94 * | | +--------------+ +==============+
95 * | | | U U |
96 * | +-------------->|<------------------------+
97 * | +==============+
98 * | || undo ||
99 * | || cleanup ||
100 * | +==============+
101 * +---------------------->| U
102 * |
103 * (err && f1)------------------->+
104 * | |
105 * +--------------+ +--------------+
106 * | post |<--------| row |
107 * | request | U | release |
108 * +--------------+ +--------------+
109 *
110 */
111
112 /**
113 * Setup up context with information needed to undo a set request.
114 *
115 * This function will be called before the individual node undo setup
116 * functions are called. If you need to do any undo setup that is not
117 * related to a specific column, you can do it here.
118 *
119 * Note that the undo context has been allocated with
120 * etherStatsTable_allocate_data(), but may need extra
121 * initialization similar to what you may have done in
122 * etherStatsTable_rowreq_ctx_init().
123 * Note that an individual node's undo_setup function will only be called
124 * if that node is being set to a new value.
125 *
126 * If there is any setup specific to a particular column (e.g. allocating
127 * memory for a string), you should do that setup in the node's undo_setup
128 * function, so it won't be done unless it is necessary.
129 *
130 * @param rowreq_ctx
131 * Pointer to the table context (etherStatsTable_rowreq_ctx)
132 *
133 * @retval MFD_SUCCESS : success
134 * @retval MFD_ERROR : error. set will fail.
135 */
136 int
137 etherStatsTable_undo_setup(etherStatsTable_rowreq_ctx * rowreq_ctx)
138 {
139 int rc = MFD_SUCCESS;
140
141 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_undo_setup",
142 "called\n"));
143
144 /** we should have a non-NULL pointer */
145 netsnmp_assert(NULL != rowreq_ctx);
146
147 /*
148 * TODO:451:M: |-> Setup etherStatsTable undo.
149 * set up etherStatsTable undo information, in preparation for a set.
150 * Undo storage is in (* etherStatsStatus_val_ptr )*
151 */
152
153 return rc;
154 } /* etherStatsTable_undo_setup */
155
156 /**
157 * Undo a set request.
158 *
159 * This function will be called before the individual node undo
160 * functions are called. If you need to do any undo that is not
161 * related to a specific column, you can do it here.
162 *
163 * Note that an individual node's undo function will only be called
164 * if that node is being set to a new value.
165 *
166 * If there is anything specific to a particular column (e.g. releasing
167 * memory for a string), you should do that setup in the node's undo
168 * function, so it won't be done unless it is necessary.
169 *
170 * @param rowreq_ctx
171 * Pointer to the table context (etherStatsTable_rowreq_ctx)
172 *
173 * @retval MFD_SUCCESS : success
174 * @retval MFD_ERROR : error. set will fail.
175 */
176 int
177 etherStatsTable_undo(etherStatsTable_rowreq_ctx * rowreq_ctx)
178 {
179 int rc = MFD_SUCCESS;
180
181 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_undo",
182 "called\n"));
183
184 /** we should have a non-NULL pointer */
185 netsnmp_assert(NULL != rowreq_ctx);
186
187 /*
188 * TODO:451:M: |-> etherStatsTable undo.
189 * etherStatsTable undo information, in response to a failed set.
190 * Undo storage is in (* etherStatsStatus_val_ptr )*
191 */
192
193 return rc;
194 } /* etherStatsTable_undo_setup */
195
196 /**
197 * Cleanup up context undo information.
198 *
199 * This function will be called after set/commit processing. If you
200 * allocated any resources in undo_setup, this is the place to release
201 * those resources.
202 *
203 * This function is called regardless of the success or failure of the set
204 * request. If you need to perform different steps for cleanup depending
205 * on success or failure, you can add a flag to the rowreq_ctx.
206 *
207 * @param rowreq_ctx
208 * Pointer to the table context (etherStatsTable_rowreq_ctx)
209 *
210 * @retval MFD_SUCCESS : success
211 * @retval MFD_ERROR : error
212 */
213 int
214 etherStatsTable_undo_cleanup(etherStatsTable_rowreq_ctx * rowreq_ctx)
215 {
216 int rc = MFD_SUCCESS;
217
218 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_undo_cleanup",
219 "called\n"));
220
221 /** we should have a non-NULL pointer */
222 netsnmp_assert(NULL != rowreq_ctx);
223
224 /*
225 * TODO:452:M: |-> Cleanup etherStatsTable undo.
226 * Undo storage is in (* etherStatsStatus_val_ptr )*
227 */
228
229 return rc;
230 } /* etherStatsTable_undo_cleanup */
231
232 /**
233 * commit new values.
234 *
235 * At this point, you should have done everything you can to ensure that
236 * this commit will not fail.
237 *
238 * Should you need different behavior depending on which columns were
239 * set, rowreq_ctx->column_set_flags will indicate which writable columns were
240 * set. The definitions for the COLUMN_*_FLAG bits can be found in
241 * etherStatsTable_oids.h.
242 * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
243 *
244 * @param etherStatsTable_rowreq_ctx
245 * Pointer to the users context.
246 *
247 * @retval MFD_SUCCESS : success
248 * @retval MFD_ERROR : error
249 */
250 int
251 etherStatsTable_commit(etherStatsTable_rowreq_ctx * rowreq_ctx)
252 {
253 int rc = MFD_SUCCESS;
254 int save_flags;
255
256 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_commit",
257 "called\n"));
258
259 /** we should have a non-NULL pointer */
260 netsnmp_assert(NULL != rowreq_ctx);
261
262 /*
263 * save flags, then clear until we actually do something
264 */
265 save_flags = rowreq_ctx->column_set_flags;
266 rowreq_ctx->column_set_flags = 0;
267
268 /*
269 * commit etherStatsTable data
270 * 1) check the column's flag in save_flags to see if it was set.
271 * 2) clear the flag when you handle that column
272 * 3) set the column's flag in column_set_flags if it needs undo
273 * processing in case of a failure.
274 */
275 if (save_flags & COLUMN_ETHERSTATSDATASOURCE_FLAG) {
276 save_flags &= ~COLUMN_ETHERSTATSDATASOURCE_FLAG; /* clear etherStatsDataSource */
277 /*
278 * TODO:482:o: |-> commit column etherStatsDataSource.
279 */
280 rc = -1;
281 if (-1 == rc) {
282 snmp_log(LOG_ERR,
283 "etherStatsTable column etherStatsDataSource commit failed\n");
284 } else {
285 /*
286 * set flag, in case we need to undo etherStatsDataSource
287 */
288 rowreq_ctx->column_set_flags |=
289 COLUMN_ETHERSTATSDATASOURCE_FLAG;
290 }
291 }
292
293 if (save_flags & COLUMN_ETHERSTATSOWNER_FLAG) {
294 save_flags &= ~COLUMN_ETHERSTATSOWNER_FLAG; /* clear etherStatsOwner */
295 /*
296 * TODO:482:o: |-> commit column etherStatsOwner.
297 */
298 rc = -1;
299 if (-1 == rc) {
300 snmp_log(LOG_ERR,
301 "etherStatsTable column etherStatsOwner commit failed\n");
302 } else {
303 /*
304 * set flag, in case we need to undo etherStatsOwner
305 */
306 rowreq_ctx->column_set_flags |= COLUMN_ETHERSTATSOWNER_FLAG;
307 }
308 }
309
310 if (save_flags & COLUMN_ETHERSTATSSTATUS_FLAG) {
311 save_flags &= ~COLUMN_ETHERSTATSSTATUS_FLAG; /* clear etherStatsStatus */
312 /*
313 * TODO:482:o: |-> commit column etherStatsStatus.
314 */
315 rc = -1;
316 if (-1 == rc) {
317 snmp_log(LOG_ERR,
318 "etherStatsTable column etherStatsStatus commit failed\n");
319 } else {
320 /*
321 * set flag, in case we need to undo etherStatsStatus
322 */
323 rowreq_ctx->column_set_flags |= COLUMN_ETHERSTATSSTATUS_FLAG;
324 }
325 }
326
327 /*
328 * if we successfully committed this row, set the dirty flag.
329 */
330 if (MFD_SUCCESS == rc) {
331 rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;
332 }
333
334 if (save_flags) {
335 snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n",
336 save_flags);
337 return MFD_ERROR;
338 }
339
340 return rc;
341 } /* etherStatsTable_commit */
342
343 /**
344 * undo commit new values.
345 *
346 * Should you need different behavior depending on which columns were
347 * set, rowreq_ctx->column_set_flags will indicate which writable columns were
348 * set. The definitions for the COLUMN_*_FLAG bits can be found in
349 * etherStatsTable_oids.h.
350 * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
351 *
352 * @param etherStatsTable_rowreq_ctx
353 * Pointer to the users context.
354 *
355 * @retval MFD_SUCCESS : success
356 * @retval MFD_ERROR : error
357 */
358 int
359 etherStatsTable_undo_commit(etherStatsTable_rowreq_ctx * rowreq_ctx)
360 {
361 int rc = MFD_SUCCESS;
362
363 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_undo_commit",
364 "called\n"));
365
366 /** we should have a non-NULL pointer */
367 netsnmp_assert(NULL != rowreq_ctx);
368
369 /*
370 * TODO:485:M: |-> Undo etherStatsTable commit.
371 * check the column's flag in rowreq_ctx->column_set_flags to see
372 * if it was set during commit, then undo it.
373 *
374 * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
375 */
376
377
378 /*
379 * if we successfully un-committed this row, clear the dirty flag.
380 */
381 if (MFD_SUCCESS == rc) {
382 rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
383 }
384
385 return rc;
386 } /* etherStatsTable_undo_commit */
387
388 /*
389 * TODO:440:M: Implement etherStatsTable node value checks.
390 * TODO:450:M: Implement etherStatsTable undo functions.
391 * TODO:460:M: Implement etherStatsTable set functions.
392 * TODO:480:M: Implement etherStatsTable commit functions.
393 */
394 /*---------------------------------------------------------------------
395 * RMON-MIB::etherStatsEntry.etherStatsDataSource
396 * etherStatsDataSource is subid 2 of etherStatsEntry.
397 * Its status is Current, and its access level is Create.
398 * OID: .1.3.6.1.2.1.16.1.1.1.2
399 * Description:
400 This object identifies the source of the data that
401 this etherStats entry is configured to analyze. This
402 source can be any Ethernet interface on this device.
403 In order to identify a particular interface, this object
404 shall identify the instance of the ifIndex object,
405 defined in RFC 2233 [17], for the desired interface.
406 For example, if an entry were to receive data from
407 interface #1, this object would be set to ifIndex.1.
408
409 The statistics in this group reflect all packets
410 on the local network segment attached to the identified
411 interface.
412
413 An agent may or may not be able to tell if fundamental
414 changes to the media of the interface have occurred and
415 necessitate an invalidation of this entry. For example, a
416 hot-pluggable Ethernet card could be pulled out and replaced
417 by a token-ring card. In such a case, if the agent has such
418 knowledge of the change, it is recommended that it
419 invalidate this entry.
420
421 This object may not be modified if the associated
422 etherStatsStatus object is equal to valid(1).
423 *
424 * Attributes:
425 * accessible 1 isscalar 0 enums 0 hasdefval 0
426 * readable 1 iscolumn 1 ranges 0 hashint 0
427 * settable 1
428 *
429 *
430 * Its syntax is OBJECTID (based on perltype OBJECTID)
431 * The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid)
432 * This data type requires a length.
433 */
434 /**
435 * Check that the proposed new value is potentially valid.
436 *
437 * @param rowreq_ctx
438 * Pointer to the row request context.
439 * @param etherStatsDataSource_val_ptr
440 * A oid containing the new value.
441 * @param etherStatsDataSource_val_ptr_len
442 * The size (in bytes) of the data pointed to by etherStatsDataSource_val_ptr
443 *
444 * @retval MFD_SUCCESS : incoming value is legal
445 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
446 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
447 *
448 * This is the place to check for requirements that are not
449 * expressed in the mib syntax (for example, a requirement that
450 * is detailed in the description for an object).
451 *
452 * You should check that the requested change between the undo value and the
453 * new value is legal (ie, the transition from one value to another
454 * is legal).
455 *
456 *@note
457 * This check is only to determine if the new value
458 * is \b potentially valid. This is the first check of many, and
459 * is one of the simplest ones.
460 *
461 *@note
462 * this is not the place to do any checks for values
463 * which depend on some other value in the mib. Those
464 * types of checks should be done in the
465 * etherStatsTable_check_dependencies() function.
466 *
467 * The following checks have already been done for you:
468 * The syntax is ASN_OBJECT_ID
469 * The length is < sizeof(rowreq_ctx->data.etherStatsDataSource).
470 *
471 * If there a no other checks you need to do, simply return MFD_SUCCESS.
472 *
473 */
474 int
475 etherStatsDataSource_check_value(etherStatsTable_rowreq_ctx * rowreq_ctx,
476 oid * etherStatsDataSource_val_ptr,
477 size_t etherStatsDataSource_val_ptr_len)
478 {
479 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsDataSource_check_value",
480 "called\n"));
481
482 /** should never get a NULL pointer */
483 netsnmp_assert(NULL != rowreq_ctx);
484 netsnmp_assert(NULL != etherStatsDataSource_val_ptr);
485
486 /*
487 * TODO:441:o: |-> Check for valid etherStatsDataSource value.
488 */
489
490 return MFD_SUCCESS; /* etherStatsDataSource value not illegal */
491 } /* etherStatsDataSource_check_value */
492
493 /**
494 * Save old value information
495 *
496 * @param rowreq_ctx
497 * Pointer to the table context (etherStatsTable_rowreq_ctx)
498 *
499 * @retval MFD_SUCCESS : success
500 * @retval MFD_ERROR : error. set will fail.
501 *
502 * This function will be called after the table level undo setup function
503 * etherStatsTable_undo_setup has been called.
504 *
505 *@note
506 * this function will only be called if a new value is set for this column.
507 *
508 * If there is any setup specific to a particular column (e.g. allocating
509 * memory for a string), you should do that setup in this function, so it
510 * won't be done unless it is necessary.
511 */
512 int
513 etherStatsDataSource_undo_setup(etherStatsTable_rowreq_ctx * rowreq_ctx)
514 {
515 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsDataSource_undo_setup",
516 "called\n"));
517
518 /** should never get a NULL pointer */
519 netsnmp_assert(NULL != rowreq_ctx);
520
521 /*
522 * TODO:455:o: |-> Setup etherStatsDataSource undo.
523 */
524 /*
525 * copy etherStatsDataSource and etherStatsDataSource_len data
526 * set rowreq_ctx->undo->etherStatsDataSource from rowreq_ctx->data.etherStatsDataSource
527 */
528 memcpy(rowreq_ctx->undo->etherStatsDataSource,
529 rowreq_ctx->data.etherStatsDataSource,
530 (rowreq_ctx->data.etherStatsDataSource_len *
531 sizeof(rowreq_ctx->undo->etherStatsDataSource[0])));
532 rowreq_ctx->undo->etherStatsDataSource_len =
533 rowreq_ctx->data.etherStatsDataSource_len;
534
535
536 return MFD_SUCCESS;
537 } /* etherStatsDataSource_undo_setup */
538
539 /**
540 * Set the new value.
541 *
542 * @param rowreq_ctx
543 * Pointer to the users context. You should know how to
544 * manipulate the value from this object.
545 * @param etherStatsDataSource_val_ptr
546 * A oid containing the new value.
547 * @param etherStatsDataSource_val_ptr_len
548 * The size (in bytes) of the data pointed to by etherStatsDataSource_val_ptr
549 */
550 int
551 etherStatsDataSource_set(etherStatsTable_rowreq_ctx * rowreq_ctx,
552 oid * etherStatsDataSource_val_ptr,
553 size_t etherStatsDataSource_val_ptr_len)
554 {
555
556 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsDataSource_set",
557 "called\n"));
558
559 /** should never get a NULL pointer */
560 netsnmp_assert(NULL != rowreq_ctx);
561 netsnmp_assert(NULL != etherStatsDataSource_val_ptr);
562
563 /*
564 * TODO:461:M: |-> Set etherStatsDataSource value.
565 * set etherStatsDataSource value in rowreq_ctx->data
566 */
567 memcpy(rowreq_ctx->data.etherStatsDataSource,
568 etherStatsDataSource_val_ptr, etherStatsDataSource_val_ptr_len);
569 /** convert bytes to number of oid */
570 rowreq_ctx->data.etherStatsDataSource_len =
571 etherStatsDataSource_val_ptr_len /
572 sizeof(etherStatsDataSource_val_ptr[0]);
573
574 return MFD_SUCCESS;
575 } /* etherStatsDataSource_set */
576
577 /**
578 * undo the previous set.
579 *
580 * @param rowreq_ctx
581 * Pointer to the users context.
582 */
583 int
584 etherStatsDataSource_undo(etherStatsTable_rowreq_ctx * rowreq_ctx)
585 {
586
587 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsDataSource_undo",
588 "called\n"));
589
590 netsnmp_assert(NULL != rowreq_ctx);
591
592 /*
593 * TODO:456:o: |-> Clean up etherStatsDataSource undo.
594 */
595 /*
596 * copy etherStatsDataSource and etherStatsDataSource_len data
597 * set rowreq_ctx->data.etherStatsDataSource from rowreq_ctx->undo->etherStatsDataSource
598 */
599 memcpy(rowreq_ctx->data.etherStatsDataSource,
600 rowreq_ctx->undo->etherStatsDataSource,
601 (rowreq_ctx->undo->etherStatsDataSource_len *
602 sizeof(rowreq_ctx->data.etherStatsDataSource[0])));
603 rowreq_ctx->data.etherStatsDataSource_len =
604 rowreq_ctx->undo->etherStatsDataSource_len;
605
606
607 return MFD_SUCCESS;
608 } /* etherStatsDataSource_undo */
609
610 /*---------------------------------------------------------------------
611 * RMON-MIB::etherStatsEntry.etherStatsOwner
612 * etherStatsOwner is subid 20 of etherStatsEntry.
613 * Its status is Current, and its access level is Create.
614 * OID: .1.3.6.1.2.1.16.1.1.1.20
615 * Description:
616 The entity that configured this entry and is therefore
617 using the resources assigned to it.
618 *
619 * Attributes:
620 * accessible 1 isscalar 0 enums 0 hasdefval 0
621 * readable 1 iscolumn 1 ranges 1 hashint 0
622 * settable 1
623 *
624 * Ranges: 0 - 127;
625 *
626 * Its syntax is OwnerString (based on perltype OCTETSTR)
627 * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
628 * This data type requires a length. (Max 127)
629 */
630 /**
631 * Check that the proposed new value is potentially valid.
632 *
633 * @param rowreq_ctx
634 * Pointer to the row request context.
635 * @param etherStatsOwner_val_ptr
636 * A char containing the new value.
637 * @param etherStatsOwner_val_ptr_len
638 * The size (in bytes) of the data pointed to by etherStatsOwner_val_ptr
639 *
640 * @retval MFD_SUCCESS : incoming value is legal
641 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
642 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
643 *
644 * This is the place to check for requirements that are not
645 * expressed in the mib syntax (for example, a requirement that
646 * is detailed in the description for an object).
647 *
648 * You should check that the requested change between the undo value and the
649 * new value is legal (ie, the transition from one value to another
650 * is legal).
651 *
652 *@note
653 * This check is only to determine if the new value
654 * is \b potentially valid. This is the first check of many, and
655 * is one of the simplest ones.
656 *
657 *@note
658 * this is not the place to do any checks for values
659 * which depend on some other value in the mib. Those
660 * types of checks should be done in the
661 * etherStatsTable_check_dependencies() function.
662 *
663 * The following checks have already been done for you:
664 * The syntax is ASN_OCTET_STR
665 * The length is < sizeof(rowreq_ctx->data.etherStatsOwner).
666 * The length is in (one of) the range set(s): 0 - 127
667 *
668 * If there a no other checks you need to do, simply return MFD_SUCCESS.
669 *
670 */
671 int
672 etherStatsOwner_check_value(etherStatsTable_rowreq_ctx * rowreq_ctx,
673 char *etherStatsOwner_val_ptr,
674 size_t etherStatsOwner_val_ptr_len)
675 {
676 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsOwner_check_value",
677 "called\n"));
678
679 /** should never get a NULL pointer */
680 netsnmp_assert(NULL != rowreq_ctx);
681 netsnmp_assert(NULL != etherStatsOwner_val_ptr);
682
683 /*
684 * TODO:441:o: |-> Check for valid etherStatsOwner value.
685 */
686
687 return MFD_SUCCESS; /* etherStatsOwner value not illegal */
688 } /* etherStatsOwner_check_value */
689
690 /**
691 * Save old value information
692 *
693 * @param rowreq_ctx
694 * Pointer to the table context (etherStatsTable_rowreq_ctx)
695 *
696 * @retval MFD_SUCCESS : success
697 * @retval MFD_ERROR : error. set will fail.
698 *
699 * This function will be called after the table level undo setup function
700 * etherStatsTable_undo_setup has been called.
701 *
702 *@note
703 * this function will only be called if a new value is set for this column.
704 *
705 * If there is any setup specific to a particular column (e.g. allocating
706 * memory for a string), you should do that setup in this function, so it
707 * won't be done unless it is necessary.
708 */
709 int
710 etherStatsOwner_undo_setup(etherStatsTable_rowreq_ctx * rowreq_ctx)
711 {
712 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsOwner_undo_setup",
713 "called\n"));
714
715 /** should never get a NULL pointer */
716 netsnmp_assert(NULL != rowreq_ctx);
717
718 /*
719 * TODO:455:o: |-> Setup etherStatsOwner undo.
720 */
721 /*
722 * copy etherStatsOwner and etherStatsOwner_len data
723 * set rowreq_ctx->undo->etherStatsOwner from rowreq_ctx->data.etherStatsOwner
724 */
725 memcpy(rowreq_ctx->undo->etherStatsOwner,
726 rowreq_ctx->data.etherStatsOwner,
727 (rowreq_ctx->data.etherStatsOwner_len *
728 sizeof(rowreq_ctx->undo->etherStatsOwner[0])));
729 rowreq_ctx->undo->etherStatsOwner_len =
730 rowreq_ctx->data.etherStatsOwner_len;
731
732
733 return MFD_SUCCESS;
734 } /* etherStatsOwner_undo_setup */
735
736 /**
737 * Set the new value.
738 *
739 * @param rowreq_ctx
740 * Pointer to the users context. You should know how to
741 * manipulate the value from this object.
742 * @param etherStatsOwner_val_ptr
743 * A char containing the new value.
744 * @param etherStatsOwner_val_ptr_len
745 * The size (in bytes) of the data pointed to by etherStatsOwner_val_ptr
746 */
747 int
748 etherStatsOwner_set(etherStatsTable_rowreq_ctx * rowreq_ctx,
749 char *etherStatsOwner_val_ptr,
750 size_t etherStatsOwner_val_ptr_len)
751 {
752
753 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsOwner_set",
754 "called\n"));
755
756 /** should never get a NULL pointer */
757 netsnmp_assert(NULL != rowreq_ctx);
758 netsnmp_assert(NULL != etherStatsOwner_val_ptr);
759
760 /*
761 * TODO:461:M: |-> Set etherStatsOwner value.
762 * set etherStatsOwner value in rowreq_ctx->data
763 */
764 memcpy(rowreq_ctx->data.etherStatsOwner, etherStatsOwner_val_ptr,
765 etherStatsOwner_val_ptr_len);
766 /** convert bytes to number of char */
767 rowreq_ctx->data.etherStatsOwner_len =
768 etherStatsOwner_val_ptr_len / sizeof(etherStatsOwner_val_ptr[0]);
769
770 return MFD_SUCCESS;
771 } /* etherStatsOwner_set */
772
773 /**
774 * undo the previous set.
775 *
776 * @param rowreq_ctx
777 * Pointer to the users context.
778 */
779 int
780 etherStatsOwner_undo(etherStatsTable_rowreq_ctx * rowreq_ctx)
781 {
782
783 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsOwner_undo",
784 "called\n"));
785
786 netsnmp_assert(NULL != rowreq_ctx);
787
788 /*
789 * TODO:456:o: |-> Clean up etherStatsOwner undo.
790 */
791 /*
792 * copy etherStatsOwner and etherStatsOwner_len data
793 * set rowreq_ctx->data.etherStatsOwner from rowreq_ctx->undo->etherStatsOwner
794 */
795 memcpy(rowreq_ctx->data.etherStatsOwner,
796 rowreq_ctx->undo->etherStatsOwner,
797 (rowreq_ctx->undo->etherStatsOwner_len *
798 sizeof(rowreq_ctx->data.etherStatsOwner[0])));
799 rowreq_ctx->data.etherStatsOwner_len =
800 rowreq_ctx->undo->etherStatsOwner_len;
801
802
803 return MFD_SUCCESS;
804 } /* etherStatsOwner_undo */
805
806 /*---------------------------------------------------------------------
807 * RMON-MIB::etherStatsEntry.etherStatsStatus
808 * etherStatsStatus is subid 21 of etherStatsEntry.
809 * Its status is Current, and its access level is Create.
810 * OID: .1.3.6.1.2.1.16.1.1.1.21
811 * Description:
812 The status of this etherStats entry.
813 *
814 * Attributes:
815 * accessible 1 isscalar 0 enums 1 hasdefval 0
816 * readable 1 iscolumn 1 ranges 0 hashint 0
817 * settable 1
818 *
819 * Enum range: 2/8. Values: valid(1), createRequest(2), underCreation(3), invalid(4)
820 *
821 * Its syntax is EntryStatus (based on perltype INTEGER)
822 * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
823 */
824 /**
825 * Check that the proposed new value is potentially valid.
826 *
827 * @param rowreq_ctx
828 * Pointer to the row request context.
829 * @param etherStatsStatus_val
830 * A long containing the new value.
831 *
832 * @retval MFD_SUCCESS : incoming value is legal
833 * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
834 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
835 *
836 * This is the place to check for requirements that are not
837 * expressed in the mib syntax (for example, a requirement that
838 * is detailed in the description for an object).
839 *
840 * You should check that the requested change between the undo value and the
841 * new value is legal (ie, the transition from one value to another
842 * is legal).
843 *
844 *@note
845 * This check is only to determine if the new value
846 * is \b potentially valid. This is the first check of many, and
847 * is one of the simplest ones.
848 *
849 *@note
850 * this is not the place to do any checks for values
851 * which depend on some other value in the mib. Those
852 * types of checks should be done in the
853 * etherStatsTable_check_dependencies() function.
854 *
855 * The following checks have already been done for you:
856 * The syntax is ASN_INTEGER
857 * The value is one of valid(1), createRequest(2), underCreation(3), invalid(4)
858 *
859 * If there a no other checks you need to do, simply return MFD_SUCCESS.
860 *
861 */
862 int
863 etherStatsStatus_check_value(etherStatsTable_rowreq_ctx * rowreq_ctx,
864 u_long etherStatsStatus_val)
865 {
866 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsStatus_check_value",
867 "called\n"));
868
869 /** should never get a NULL pointer */
870 netsnmp_assert(NULL != rowreq_ctx);
871
872 /*
873 * TODO:441:o: |-> Check for valid etherStatsStatus value.
874 */
875
876 return MFD_SUCCESS; /* etherStatsStatus value not illegal */
877 } /* etherStatsStatus_check_value */
878
879 /**
880 * Save old value information
881 *
882 * @param rowreq_ctx
883 * Pointer to the table context (etherStatsTable_rowreq_ctx)
884 *
885 * @retval MFD_SUCCESS : success
886 * @retval MFD_ERROR : error. set will fail.
887 *
888 * This function will be called after the table level undo setup function
889 * etherStatsTable_undo_setup has been called.
890 *
891 *@note
892 * this function will only be called if a new value is set for this column.
893 *
894 * If there is any setup specific to a particular column (e.g. allocating
895 * memory for a string), you should do that setup in this function, so it
896 * won't be done unless it is necessary.
897 */
898 int
899 etherStatsStatus_undo_setup(etherStatsTable_rowreq_ctx * rowreq_ctx)
900 {
901 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsStatus_undo_setup",
902 "called\n"));
903
904 /** should never get a NULL pointer */
905 netsnmp_assert(NULL != rowreq_ctx);
906
907 /*
908 * TODO:455:o: |-> Setup etherStatsStatus undo.
909 */
910 /*
911 * copy etherStatsStatus data
912 * set rowreq_ctx->undo->etherStatsStatus from rowreq_ctx->data.etherStatsStatus
913 */
914 rowreq_ctx->undo->etherStatsStatus = rowreq_ctx->data.etherStatsStatus;
915
916
917 return MFD_SUCCESS;
918 } /* etherStatsStatus_undo_setup */
919
920 /**
921 * Set the new value.
922 *
923 * @param rowreq_ctx
924 * Pointer to the users context. You should know how to
925 * manipulate the value from this object.
926 * @param etherStatsStatus_val
927 * A long containing the new value.
928 */
929 int
930 etherStatsStatus_set(etherStatsTable_rowreq_ctx * rowreq_ctx,
931 u_long etherStatsStatus_val)
932 {
933
934 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsStatus_set",
935 "called\n"));
936
937 /** should never get a NULL pointer */
938 netsnmp_assert(NULL != rowreq_ctx);
939
940 /*
941 * TODO:461:M: |-> Set etherStatsStatus value.
942 * set etherStatsStatus value in rowreq_ctx->data
943 */
944 rowreq_ctx->data.etherStatsStatus = etherStatsStatus_val;
945
946 return MFD_SUCCESS;
947 } /* etherStatsStatus_set */
948
949 /**
950 * undo the previous set.
951 *
952 * @param rowreq_ctx
953 * Pointer to the users context.
954 */
955 int
956 etherStatsStatus_undo(etherStatsTable_rowreq_ctx * rowreq_ctx)
957 {
958
959 DEBUGMSGTL(("verbose:etherStatsTable:etherStatsStatus_undo",
960 "called\n"));
961
962 netsnmp_assert(NULL != rowreq_ctx);
963
964 /*
965 * TODO:456:o: |-> Clean up etherStatsStatus undo.
966 */
967 /*
968 * copy etherStatsStatus data
969 * set rowreq_ctx->data.etherStatsStatus from rowreq_ctx->undo->etherStatsStatus
970 */
971 rowreq_ctx->data.etherStatsStatus = rowreq_ctx->undo->etherStatsStatus;
972
973
974 return MFD_SUCCESS;
975 } /* etherStatsStatus_undo */
976
977 /** @} */