## -*- c -*-
######################################################################
## Do the .h file
######################################################################
@open ${name}.h@
/*
 * Note: this file originally auto-generated by mib2c using
 *        $Id: mib2c.tie.conf
 */
#ifndef $name.uc_H
#define $name.uc_H

/* function declarations */
void init_$name(void);

#endif /* $name.uc_H */
######################################################################
## Do the .c file
######################################################################
@open ${name}.c@
/*
 * Note: this file originally auto-generated by mib2c using
 *        $Id: mib2c.tie.conf
 */

#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "${name}.h"

@foreach $i scalar@
    @if ("$i.type" eq "ASN_OCTET_STR")@
extern char ${i}[255];
    @elsif ("$i.type" eq "ASN_INTEGER")@
extern int ${i};
    @end@
@end@

@foreach $i scalar@
    @if ("$i.type" eq "ASN_OCTET_STR")@
netsnmp_ntstr_t ${i}_nt = {
   .val=${i},
   .max_size=sizeof(${i})
};
    @end@
@end@

/** Initializes the $name module */
void
init_$name(void)
{
  @foreach $i scalar@
    static oid ${i}_oid[] = { $i.commaoid };
  @end@

  DEBUGMSGTL(("$name", "Initializing\n"));

  @foreach $i scalar@
    @if ("$i.type" eq "ASN_OCTET_STR")@
    netsnmp_register_str_instance("$i",
                                  ${i}_oid,
                                  OID_LENGTH(${i}_oid),
                                  &${i}_nt, NULL);
    @elsif ("$i.type" eq "ASN_INTEGER")@
    netsnmp_register_int_instance("$i",
                                  ${i}_oid,
                                  OID_LENGTH(${i}_oid),
                                  &${i}, NULL);
    @end@
  @end@
}
