blob: 13c1e60cf2d6e41de9bcf691212bd06d18f666fe [file] [log] [blame]
## -*- c -*-
######################################################################
## Do the .h file
######################################################################
@open ${name}_checkfns_local.h@
/*
* Note: this file originally auto-generated by mib2c using
* : $Id$
*
*/
#ifndef $name.uc_CHECKFNS_H
#define $name.uc_CHECKFNS_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_H */
######################################################################
## Do the .c file
######################################################################
@open ${name}_checkfns_local.c@
/*
* Note: this file originally auto-generated by mib2c using
* $Id$
*/
/* 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@