/*
 * Note: this file originally auto-generated by mib2c
 * using mfd-top.m2c
 */
/** \page MFD helper for applTable
 *
 * \section intro Introduction
 * Introductory text.
 *
 */
/*
 * standard Net-SNMP includes 
 */
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-features.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>

/*
 * include our parent header 
 */
#include "applTable.h"

#include <net-snmp/agent/mib_modules.h>

#include "applTable_interface.h"

const oid       applTable_oid[] = { APPLTABLE_OID };

const int       applTable_oid_size = OID_LENGTH(applTable_oid);

applTable_registration applTable_user_context;

void            initialize_table_applTable(void);
void            shutdown_table_applTable(void);


/**
 * Initializes the applTable module
 */
void
init_applTable(void)
{
    DEBUGMSGTL(("verbose:applTable:init_applTable", "called\n"));

    /*
     * TODO:300:o: Perform applTable one-time module initialization.
     */

    /*
     * here we initialize all the tables we're planning on supporting
     */
    if (should_init("applTable"))
        initialize_table_applTable();

}                               /* init_applTable */

/**
 * Shut-down the applTable module (agent is exiting)
 */
void
shutdown_applTable(void)
{
    if (should_init("applTable"))
        shutdown_table_applTable();

}

/**
 * Initialize the table applTable 
 *    (Define its contents and how it's structured)
 */
void
initialize_table_applTable(void)
{
    applTable_registration *user_context;
    u_long          flags;

    DEBUGMSGTL(("verbose:applTable:initialize_table_applTable",
                "called\n"));

    /*
     * TODO:301:o: Perform applTable one-time table initialization.
     */

    /*
     * TODO:302:o: |->Initialize applTable user context
     * if you'd like to pass in a pointer to some data for this
     * table, allocate or set it up here.
     */
    /*
     * a netsnmp_data_list is a simple way to store void pointers. A simple
     * string token is used to add, find or remove pointers.
     */
    user_context = netsnmp_create_data_list("applTable", NULL, NULL);

    /*
     * No support for any flags yet, but in the future you would
     * set any flags here.
     */
    flags = 0;

    /*
     * call interface initialization code
     */
    _applTable_initialize_interface(user_context, flags);
}                               /* initialize_table_applTable */

/**
 * Shutdown the table applTable 
 */
void
shutdown_table_applTable(void)
{
    /*
     * call interface shutdown code
     */
    _applTable_shutdown_interface(&applTable_user_context);
}

/**
 * extra context initialization (eg default values)
 *
 * @param rowreq_ctx    : row request context
 * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
 *
 * @retval MFD_SUCCESS  : no errors
 * @retval MFD_ERROR    : error (context allocate will fail)
 */
int
applTable_rowreq_ctx_init(applTable_rowreq_ctx * rowreq_ctx,
                          void *user_init_ctx)
{
    DEBUGMSGTL(("verbose:applTable:applTable_rowreq_ctx_init",
                "called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

    /*
     * TODO:210:o: |-> Perform extra applTable rowreq initialization. (eg DEFVALS)
     */

    return MFD_SUCCESS;
}                               /* applTable_rowreq_ctx_init */

/**
 * extra context cleanup
 *
 */
void
applTable_rowreq_ctx_cleanup(applTable_rowreq_ctx * rowreq_ctx)
{
    DEBUGMSGTL(("verbose:applTable:applTable_rowreq_ctx_cleanup",
                "called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

    /*
     * TODO:211:o: |-> Perform extra applTable rowreq cleanup.
     */
}                               /* applTable_rowreq_ctx_cleanup */

/**
 * pre-request callback
 *
 *
 * @retval MFD_SUCCESS              : success.
 * @retval MFD_ERROR                : other error
 */
int
applTable_pre_request(applTable_registration * user_context)
{
    DEBUGMSGTL(("verbose:applTable:applTable_pre_request", "called\n"));

    /*
     * TODO:510:o: Perform applTable pre-request actions.
     */

    return MFD_SUCCESS;
}                               /* applTable_pre_request */

/**
 * post-request callback
 *
 * Note:
 *   New rows have been inserted into the container, and
 *   deleted rows have been removed from the container and
 *   released.
 *
 * @param user_context
 * @param rc : MFD_SUCCESS if all requests succeeded
 *
 * @retval MFD_SUCCESS : success.
 * @retval MFD_ERROR   : other error (ignored)
 */
int
applTable_post_request(applTable_registration * user_context, int rc)
{
    DEBUGMSGTL(("verbose:applTable:applTable_post_request", "called\n"));

    /*
     * TODO:511:o: Perform applTable post-request actions.
     */

    return MFD_SUCCESS;
}                               /* applTable_post_request */


/** @{ */
