##//#########################################################  -*- c -*-
##//generic include for XXX. Do not use directly.
##
##//$Id: mfd-data-access.m2c,v 1.12 2004/10/08 23:39:17 rstory Exp $
##//####################################################################
##//####################################################################
##
## lower conf files get confused with multiple processing types, so
## set single options
@eval $mfd_data_access_processing_type = "$m2c_processing_type"@
@eval $m2c_processing_type = 'h'@
@open ${name}_data_access.h@
@eval $hack = "Id"@
/*
 * Note: this file originally auto-generated by mib2c using
 *       version $Revision: 1.12 $ of $RCSfile: mfd-data-access.m2c,v $
 *
 * $$hack:$
 */
@if $m2c_mark_boundary == 1@
/** START code generated by $RCSfile: mfd-data-access.m2c,v $ $Revision: 1.12 $ */
@end@
@eval $m2c_save = "$name"@
@eval $name = "${name}_DATA_ACCESS"@
@include generic-header-top.m2i@
@eval $name = "$m2c_save"@

/* *********************************************************************
 * function declarations
 */

/* *********************************************************************
 * Table declarations
 */
@foreach $table table@
@    include m2c_setup_table.m2i@
@    include details-table.m2i@

@    eval $m2c_tmp=""@
@    foreach $node index@
@      include m2c_setup_node.m2i@
@      eval $m2c_tmp="$m2c_tmp, $m2c_node_param_val"@
@    end@ // for each index

    int ${context}_init_data(${context}_registration_ptr ${context}_reg);

@    include mfd-access-${m2c_table_access}-defines.m2i@
    int ${context}_row_prep( ${context}_rowreq_ctx *rowreq_ctx);
@end@

@eval $m2c_save = "$name"@
@eval $name = "${name}_DATA_ACCESS"@
@include generic-header-bottom.m2i@
@eval $name = "$m2c_save"@
##//##################################################################
##//Do the .c file
##//##################################################################
@eval $m2c_processing_type = 'c'@
@open ${name}_data_access.c@
/*
 * Note: this file originally auto-generated by mib2c using
 *       version $Revision: 1.12 $ of $RCSfile: mfd-data-access.m2c,v $ 
 *
 * $$hack:$
 */
@include generic-source-includes.m2i@

#include "${name}_data_access.h"

/** @defgroup data_access data_access: Routines to access data
 *
 * These routines are used to locate the data used to satisfy
 * requests.
 * 
 * @{
 */
@foreach $table table@
@    include m2c_setup_table.m2i@
@    include details-table.m2i@

/**
 * initialization for ${context} data access
 *
 * This function is called during startup to allow you to
 * allocate any resources you need for the data table.
 *
 * @param ${context}_reg
 *        Pointer to ${context}_registration
 *
 * @retval MFD_SUCCESS : success.
 * @retval MFD_ERROR   : unrecoverable error.
 */
int
${context}_init_data(${context}_registration_ptr ${context}_reg)
{
    DEBUGMSGTL(("verbose:${context}:${context}_init_data","called\n"));

    /*
     * TODO:303:o: Initialize $context data.
     */
@ifconf ${table}_init_data.m2i@
@   include ${table}_init_data.m2i@
@else@
@   if $m2c_include_examples == 1@
$example_start
    /*
     * if you are the sole writer for the file, you could
     * open it here. However, as stated earlier, we are assuming
     * the worst case, which in this case means that the file is
     * written to by someone else, and might not even exist when
     * we start up. So we can't do anything here.
     */
$example_end
@   end@

    return MFD_SUCCESS;
@end@ #ifconf
} /* ${context}_init_data */

@    include mfd-access-${m2c_table_access}-defines.m2i@
/**
 * prepare row for processing.
 *
 *  When the agent has located the row for a request, this function is
 *  called to prepare the row for processing. If you fully populated
 *  the data context during the index setup phase, you may not need to
 *  do anything.
 *
 * @param rowreq_ctx pointer to a context.
 *
 * @retval MFD_SUCCESS     : success.
 * @retval MFD_ERROR       : other error.
 */
int
${context}_row_prep( ${context}_rowreq_ctx *rowreq_ctx)
{
    DEBUGMSGTL(("verbose:${context}:${context}_row_prep","called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

    /*
     * TODO:390:o: Prepare row for request.
     * If populating row data was delayed, this is the place to
     * fill in the row for this request.
     */

    return MFD_SUCCESS;
} /* ${context}_row_prep */

@end@
##
/** @} */
##//####################################################################
@if $m2c_mark_boundary == 1@
/** END code generated by $RCSfile: mfd-data-access.m2c,v $ $Revision: 1.12 $ */
@end@
@eval $m2c_processing_type = "$mfd_data_access_processing_type"@
