net-snmp/local/mib2c.check_values_local.conf

73 lines
2.4 KiB
C

## -*- c -*-
######################################################################
## Do the .h file
######################################################################
@open ${name}_checkfns_local.h@
/*
* Note: this file originally auto-generated by mib2c
* using mib2c.check_values_local.conf
*
*/
#ifndef $name.uc_CHECKFNS_LOCAL_H
#define $name.uc_CHECKFNS_LOCAL_H
@foreach $t table@
/* these functions are designed to check incoming values for
columns in the $t table for legality with respect to
datatype and value according to local conventions. You should modify
them as appropriate. They will be called from parent check_value
functions that are auto-generated using mib2c and the parent functions
should NOT be modified.
*/
@foreach $i column@
@if $i.access =~ /(Write|Create)/@
int check_${i}_local(int type, $i.decl *val, size_t val_len, $i.decl *old_val, size_t old_val_len);
@end@
@end@
@end@
#endif /* $name.uc_CHECKFNS_LOCAL_H */
######################################################################
## Do the .c file
######################################################################
@open ${name}_checkfns_local.c@
/*
* Note: this file originally auto-generated by mib2c
* using mib2c.check_values_local.conf
*/
/* standard headers */
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include "${name}_checkfns.h"
#include "${name}_enums.h"
@run mib2c.column_enums.conf@
@foreach $t table@
@foreach $i column@
@if $i.access =~ /(Write|Create)/@
/** Decides if an incoming value for the $i mib node is legal, from a local implementation specific viewpoint.
* @param type The incoming data type.
* @param val The value to be checked.
* @param val_len The length of data stored in val (in bytes).
* @return 0 if the incoming value is legal, an SNMP error code otherwise.
*/
int
check_${i}_local(int type, $i.decl *val, size_t val_len, $i.decl *old_val, size_t old_val_len) {
/** XXX: you may want to check aspects of the new value that
were not covered by the automatic checks by the parent function. */
/** XXX: you make want to check that the requested change from
the old value to the new value is legal (ie, the transistion
from one value to another is legal */
/** if everything looks ok, return SNMP_ERR_NOERROR */
return SNMP_ERR_NOERROR;
}
@end@
@end@
@end@