/*
 * Note: this file originally auto-generated by mib2c using
 *       version $ of $ 
 *
 * $Id:$
 */
/* 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 "dot1qVlanCurrentTable.h"


/** @defgroup data_get data_get: Routines to get data
 *
 * TODO:230:M: Implement dot1qVlanCurrentTable get routines.
 * TODO:240:M: Implement dot1qVlanCurrentTable mapping routines (if any).
 *
 * These routine are used to get the value for individual objects. The
 * row context is passed, along with a pointer to the memory where the
 * value should be copied.
 *
 * @{
 */
/**********************************************************************
 **********************************************************************
 ***
 *** Table dot1qVlanCurrentTable
 ***
 **********************************************************************
 **********************************************************************/
/*
 * Q-BRIDGE-MIB::dot1qVlanCurrentTable is subid 2 of dot1qVlan.
 * Its status is Current.
 * OID: .1.3.6.1.2.1.17.7.1.4.2, length: 11
*/

/* ---------------------------------------------------------------------
 * TODO:200:r: Implement dot1qVlanCurrentTable data context functions.
 */


/**
 * set mib index(es)
 *
 * @param tbl_idx mib index structure
 * @param dot1qVlanTimeMark_val
 * @param dot1qVlanIndex_val
 *
 * @retval MFD_SUCCESS     : success.
 * @retval MFD_ERROR       : other error.
 *
 * @remark
 *  This convenience function is useful for setting all the MIB index
 *  components with a single function call. It is assume that the C values
 *  have already been mapped from their native/rawformat to the MIB format.
 */
int
dot1qVlanCurrentTable_indexes_set_tbl_idx(dot1qVlanCurrentTable_mib_index *tbl_idx, u_long dot1qVlanTimeMark_val, u_long dot1qVlanIndex_val)
{
    DEBUGMSGTL(("verbose:dot1qVlanCurrentTable:dot1qVlanCurrentTable_indexes_set_tbl_idx","called\n"));

    /* dot1qVlanTimeMark(1)/TimeFilter/ASN_TIMETICKS/u_long(u_long)//l/a/w/e/r/d/h */
    tbl_idx->dot1qVlanTimeMark = dot1qVlanTimeMark_val;
    
    /* dot1qVlanIndex(2)/VlanIndex/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/r/d/H */
    tbl_idx->dot1qVlanIndex = dot1qVlanIndex_val;
    

    return MFD_SUCCESS;
} /* dot1qVlanCurrentTable_indexes_set_tbl_idx */

/**
 * @internal
 * set row context indexes
 *
 * @param reqreq_ctx the row context that needs updated indexes
 *
 * @retval MFD_SUCCESS     : success.
 * @retval MFD_ERROR       : other error.
 *
 * @remark
 *  This function sets the mib indexs, then updates the oid indexs
 *  from the mib index.
 */
int
dot1qVlanCurrentTable_indexes_set(dot1qVlanCurrentTable_rowreq_ctx *rowreq_ctx, u_long dot1qVlanTimeMark_val, u_long dot1qVlanIndex_val)
{
    DEBUGMSGTL(("verbose:dot1qVlanCurrentTable:dot1qVlanCurrentTable_indexes_set","called\n"));

    if(MFD_SUCCESS != dot1qVlanCurrentTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx
                                   , dot1qVlanTimeMark_val
                                   , dot1qVlanIndex_val
           ))
        return MFD_ERROR;

    /*
     * convert mib index to oid index
     */
    rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
    if(0 != dot1qVlanCurrentTable_index_to_oid(&rowreq_ctx->oid_idx,
                                    &rowreq_ctx->tbl_idx)) {
        return MFD_ERROR;
    }

    return MFD_SUCCESS;
} /* dot1qVlanCurrentTable_indexes_set */


/*---------------------------------------------------------------------
 * Q-BRIDGE-MIB::dot1qVlanCurrentEntry.dot1qVlanFdbId
 * dot1qVlanFdbId is subid 3 of dot1qVlanCurrentEntry.
 * Its status is Current, and its access level is ReadOnly.
 * OID: .1.3.6.1.2.1.17.7.1.4.2.1.3
 * Description:
The Filtering Database used by this VLAN.  This is one
        of the dot1qFdbId values in the dot1qFdbTable.  This
        value is allocated automatically by the device whenever

        the VLAN is created: either dynamically by GVRP, or by
        management, in dot1qVlanStaticTable.  Allocation of this
        value follows the learning constraints defined for this
        VLAN in dot1qLearningConstraintsTable.
 *
 * Attributes:
 *   accessible 1     isscalar 0     enums  0      hasdefval 0
 *   readable   1     iscolumn 1     ranges 0      hashint   0
 *   settable   0
 *
 *
 * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32)
 * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
 */
/**
 * Extract the current value of the dot1qVlanFdbId data.
 *
 * Set a value using the data context for the row.
 *
 * @param rowreq_ctx
 *        Pointer to the row request context.
 * @param dot1qVlanFdbId_val_ptr
 *        Pointer to storage for a u_long variable
 *
 * @retval MFD_SUCCESS         : success
 * @retval MFD_SKIP            : skip this node (no value for now)
 * @retval MFD_ERROR           : Any other error
 */
int
dot1qVlanFdbId_get( dot1qVlanCurrentTable_rowreq_ctx *rowreq_ctx, u_long * dot1qVlanFdbId_val_ptr )
{
   /** we should have a non-NULL pointer */
   netsnmp_assert( NULL != dot1qVlanFdbId_val_ptr );


    DEBUGMSGTL(("verbose:dot1qVlanCurrentTable:dot1qVlanFdbId_get","called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

/*
 * TODO:231:o: |-> Extract the current value of the dot1qVlanFdbId data.
 * copy (* dot1qVlanFdbId_val_ptr ) from rowreq_ctx->data
 */
    (* dot1qVlanFdbId_val_ptr ) = rowreq_ctx->data.dot1qVlanFdbId;

    return MFD_SUCCESS;
} /* dot1qVlanFdbId_get */

/*---------------------------------------------------------------------
 * Q-BRIDGE-MIB::dot1qVlanCurrentEntry.dot1qVlanCurrentEgressPorts
 * dot1qVlanCurrentEgressPorts is subid 4 of dot1qVlanCurrentEntry.
 * Its status is Current, and its access level is ReadOnly.
 * OID: .1.3.6.1.2.1.17.7.1.4.2.1.4
 * Description:
The set of ports that are transmitting traffic for
        this VLAN as either tagged or untagged frames.
 *
 * Attributes:
 *   accessible 1     isscalar 0     enums  0      hasdefval 0
 *   readable   1     iscolumn 1     ranges 0      hashint   0
 *   settable   0
 *
 *
 * Its syntax is PortList (based on perltype OCTETSTR)
 * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
 * This data type requires a length.
 */
/**
 * Extract the current value of the dot1qVlanCurrentEgressPorts data.
 *
 * Set a value using the data context for the row.
 *
 * @param rowreq_ctx
 *        Pointer to the row request context.
 * @param dot1qVlanCurrentEgressPorts_val_ptr_ptr
 *        Pointer to storage for a char variable
 * @param dot1qVlanCurrentEgressPorts_val_ptr_len_ptr
 *        Pointer to a size_t. On entry, it will contain the size (in bytes)
 *        pointed to by dot1qVlanCurrentEgressPorts.
 *        On exit, this value should contain the data size (in bytes).
 *
 * @retval MFD_SUCCESS         : success
 * @retval MFD_SKIP            : skip this node (no value for now)
 * @retval MFD_ERROR           : Any other error
*
 * @note If you need more than (*dot1qVlanCurrentEgressPorts_val_ptr_len_ptr) bytes of memory,
 *       allocate it using malloc() and update dot1qVlanCurrentEgressPorts_val_ptr_ptr.
 *       <b>DO NOT</b> free the previous pointer.
 *       The MFD helper will release the memory you allocate.
 *
 * @remark If you call this function yourself, you are responsible
 *         for checking if the pointer changed, and freeing any
 *         previously allocated memory. (Not necessary if you pass
 *         in a pointer to static memory, obviously.)
 */
int
dot1qVlanCurrentEgressPorts_get( dot1qVlanCurrentTable_rowreq_ctx *rowreq_ctx, char **dot1qVlanCurrentEgressPorts_val_ptr_ptr, size_t *dot1qVlanCurrentEgressPorts_val_ptr_len_ptr )
{
   /** we should have a non-NULL pointer and enough storage */
   netsnmp_assert( (NULL != dot1qVlanCurrentEgressPorts_val_ptr_ptr) && (NULL != *dot1qVlanCurrentEgressPorts_val_ptr_ptr));
   netsnmp_assert( NULL != dot1qVlanCurrentEgressPorts_val_ptr_len_ptr );


    DEBUGMSGTL(("verbose:dot1qVlanCurrentTable:dot1qVlanCurrentEgressPorts_get","called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

/*
 * TODO:231:o: |-> Extract the current value of the dot1qVlanCurrentEgressPorts data.
 * copy (* dot1qVlanCurrentEgressPorts_val_ptr_ptr ) data and (* dot1qVlanCurrentEgressPorts_val_ptr_len_ptr ) from rowreq_ctx->data
 */
    /*
     * make sure there is enough space for dot1qVlanCurrentEgressPorts data
     */
    if ((NULL == (* dot1qVlanCurrentEgressPorts_val_ptr_ptr )) ||
        ((* dot1qVlanCurrentEgressPorts_val_ptr_len_ptr ) <
         (rowreq_ctx->data.dot1qVlanCurrentEgressPorts_len* sizeof(rowreq_ctx->data.dot1qVlanCurrentEgressPorts[0])))) {
        /*
         * allocate space for dot1qVlanCurrentEgressPorts data
         */
        (* dot1qVlanCurrentEgressPorts_val_ptr_ptr ) = malloc(rowreq_ctx->data.dot1qVlanCurrentEgressPorts_len* sizeof(rowreq_ctx->data.dot1qVlanCurrentEgressPorts[0]));
        if(NULL == (* dot1qVlanCurrentEgressPorts_val_ptr_ptr )) {
            snmp_log(LOG_ERR,"could not allocate memory (rowreq_ctx->data.dot1qVlanCurrentEgressPorts)\n");
            return MFD_ERROR;
        }
    }
    (* dot1qVlanCurrentEgressPorts_val_ptr_len_ptr ) = rowreq_ctx->data.dot1qVlanCurrentEgressPorts_len* sizeof(rowreq_ctx->data.dot1qVlanCurrentEgressPorts[0]);
    memcpy( (* dot1qVlanCurrentEgressPorts_val_ptr_ptr ), rowreq_ctx->data.dot1qVlanCurrentEgressPorts, rowreq_ctx->data.dot1qVlanCurrentEgressPorts_len* sizeof(rowreq_ctx->data.dot1qVlanCurrentEgressPorts[0]) );

    return MFD_SUCCESS;
} /* dot1qVlanCurrentEgressPorts_get */

/*---------------------------------------------------------------------
 * Q-BRIDGE-MIB::dot1qVlanCurrentEntry.dot1qVlanCurrentUntaggedPorts
 * dot1qVlanCurrentUntaggedPorts is subid 5 of dot1qVlanCurrentEntry.
 * Its status is Current, and its access level is ReadOnly.
 * OID: .1.3.6.1.2.1.17.7.1.4.2.1.5
 * Description:
The set of ports that are transmitting traffic for
        this VLAN as untagged frames.
 *
 * Attributes:
 *   accessible 1     isscalar 0     enums  0      hasdefval 0
 *   readable   1     iscolumn 1     ranges 0      hashint   0
 *   settable   0
 *
 *
 * Its syntax is PortList (based on perltype OCTETSTR)
 * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
 * This data type requires a length.
 */
/**
 * Extract the current value of the dot1qVlanCurrentUntaggedPorts data.
 *
 * Set a value using the data context for the row.
 *
 * @param rowreq_ctx
 *        Pointer to the row request context.
 * @param dot1qVlanCurrentUntaggedPorts_val_ptr_ptr
 *        Pointer to storage for a char variable
 * @param dot1qVlanCurrentUntaggedPorts_val_ptr_len_ptr
 *        Pointer to a size_t. On entry, it will contain the size (in bytes)
 *        pointed to by dot1qVlanCurrentUntaggedPorts.
 *        On exit, this value should contain the data size (in bytes).
 *
 * @retval MFD_SUCCESS         : success
 * @retval MFD_SKIP            : skip this node (no value for now)
 * @retval MFD_ERROR           : Any other error
*
 * @note If you need more than (*dot1qVlanCurrentUntaggedPorts_val_ptr_len_ptr) bytes of memory,
 *       allocate it using malloc() and update dot1qVlanCurrentUntaggedPorts_val_ptr_ptr.
 *       <b>DO NOT</b> free the previous pointer.
 *       The MFD helper will release the memory you allocate.
 *
 * @remark If you call this function yourself, you are responsible
 *         for checking if the pointer changed, and freeing any
 *         previously allocated memory. (Not necessary if you pass
 *         in a pointer to static memory, obviously.)
 */
int
dot1qVlanCurrentUntaggedPorts_get( dot1qVlanCurrentTable_rowreq_ctx *rowreq_ctx, char **dot1qVlanCurrentUntaggedPorts_val_ptr_ptr, size_t *dot1qVlanCurrentUntaggedPorts_val_ptr_len_ptr )
{
   /** we should have a non-NULL pointer and enough storage */
   netsnmp_assert( (NULL != dot1qVlanCurrentUntaggedPorts_val_ptr_ptr) && (NULL != *dot1qVlanCurrentUntaggedPorts_val_ptr_ptr));
   netsnmp_assert( NULL != dot1qVlanCurrentUntaggedPorts_val_ptr_len_ptr );


    DEBUGMSGTL(("verbose:dot1qVlanCurrentTable:dot1qVlanCurrentUntaggedPorts_get","called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

/*
 * TODO:231:o: |-> Extract the current value of the dot1qVlanCurrentUntaggedPorts data.
 * copy (* dot1qVlanCurrentUntaggedPorts_val_ptr_ptr ) data and (* dot1qVlanCurrentUntaggedPorts_val_ptr_len_ptr ) from rowreq_ctx->data
 */
    /*
     * make sure there is enough space for dot1qVlanCurrentUntaggedPorts data
     */
    if ((NULL == (* dot1qVlanCurrentUntaggedPorts_val_ptr_ptr )) ||
        ((* dot1qVlanCurrentUntaggedPorts_val_ptr_len_ptr ) <
         (rowreq_ctx->data.dot1qVlanCurrentUntaggedPorts_len* sizeof(rowreq_ctx->data.dot1qVlanCurrentUntaggedPorts[0])))) {
        /*
         * allocate space for dot1qVlanCurrentUntaggedPorts data
         */
        (* dot1qVlanCurrentUntaggedPorts_val_ptr_ptr ) = malloc(rowreq_ctx->data.dot1qVlanCurrentUntaggedPorts_len* sizeof(rowreq_ctx->data.dot1qVlanCurrentUntaggedPorts[0]));
        if(NULL == (* dot1qVlanCurrentUntaggedPorts_val_ptr_ptr )) {
            snmp_log(LOG_ERR,"could not allocate memory (rowreq_ctx->data.dot1qVlanCurrentUntaggedPorts)\n");
            return MFD_ERROR;
        }
    }
    (* dot1qVlanCurrentUntaggedPorts_val_ptr_len_ptr ) = rowreq_ctx->data.dot1qVlanCurrentUntaggedPorts_len* sizeof(rowreq_ctx->data.dot1qVlanCurrentUntaggedPorts[0]);
    memcpy( (* dot1qVlanCurrentUntaggedPorts_val_ptr_ptr ), rowreq_ctx->data.dot1qVlanCurrentUntaggedPorts, rowreq_ctx->data.dot1qVlanCurrentUntaggedPorts_len* sizeof(rowreq_ctx->data.dot1qVlanCurrentUntaggedPorts[0]) );

    return MFD_SUCCESS;
} /* dot1qVlanCurrentUntaggedPorts_get */

/**
 * Extract the current value of the dot1qVlanStatus data.
 *
 * Set a value using the data context for the row.
 *
 * @param rowreq_ctx
 *        Pointer to the row request context.
 * @param dot1qVlanStatus_val_ptr
 *        Pointer to storage for a long variable
 *
 * @retval MFD_SUCCESS         : success
 * @retval MFD_SKIP            : skip this node (no value for now)
 * @retval MFD_ERROR           : Any other error
 */
int
dot1qVlanStatus_get( dot1qVlanCurrentTable_rowreq_ctx *rowreq_ctx, u_long * dot1qVlanStatus_val_ptr )
{
   /** we should have a non-NULL pointer */
   netsnmp_assert( NULL != dot1qVlanStatus_val_ptr );


    DEBUGMSGTL(("verbose:dot1qVlanCurrentTable:dot1qVlanStatus_get","called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

/*
 * TODO:231:o: |-> Extract the current value of the dot1qVlanStatus data.
 * copy (* dot1qVlanStatus_val_ptr ) from rowreq_ctx->data
 */
    (* dot1qVlanStatus_val_ptr ) = rowreq_ctx->data.dot1qVlanStatus;

    return MFD_SUCCESS;
} /* dot1qVlanStatus_get */

/*---------------------------------------------------------------------
 * Q-BRIDGE-MIB::dot1qVlanCurrentEntry.dot1qVlanCreationTime
 * dot1qVlanCreationTime is subid 7 of dot1qVlanCurrentEntry.
 * Its status is Current, and its access level is ReadOnly.
 * OID: .1.3.6.1.2.1.17.7.1.4.2.1.7
 * Description:
The value of sysUpTime when this VLAN was created.
 *
 * Attributes:
 *   accessible 1     isscalar 0     enums  0      hasdefval 0
 *   readable   1     iscolumn 1     ranges 0      hashint   0
 *   settable   0
 *
 *
 * Its syntax is TICKS (based on perltype TICKS)
 * The net-snmp type is ASN_TIMETICKS. The C type decl is u_long (u_long)
 */
/**
 * Extract the current value of the dot1qVlanCreationTime data.
 *
 * Set a value using the data context for the row.
 *
 * @param rowreq_ctx
 *        Pointer to the row request context.
 * @param dot1qVlanCreationTime_val_ptr
 *        Pointer to storage for a u_long variable
 *
 * @retval MFD_SUCCESS         : success
 * @retval MFD_SKIP            : skip this node (no value for now)
 * @retval MFD_ERROR           : Any other error
 */
int
dot1qVlanCreationTime_get( dot1qVlanCurrentTable_rowreq_ctx *rowreq_ctx, u_long * dot1qVlanCreationTime_val_ptr )
{
   /** we should have a non-NULL pointer */
   netsnmp_assert( NULL != dot1qVlanCreationTime_val_ptr );


    DEBUGMSGTL(("verbose:dot1qVlanCurrentTable:dot1qVlanCreationTime_get","called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

/*
 * TODO:231:o: |-> Extract the current value of the dot1qVlanCreationTime data.
 * copy (* dot1qVlanCreationTime_val_ptr ) from rowreq_ctx->data
 */
    (* dot1qVlanCreationTime_val_ptr ) = rowreq_ctx->data.dot1qVlanCreationTime;

    return MFD_SUCCESS;
} /* dot1qVlanCreationTime_get */



/** @} */
