Blame local/mib2c.check_values_local.conf

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