/*
 * White Rabbit SNMP
 * Copyright (C) 2010, CERN.
 *
 * Version:     wrsw_snmpd v1.0
 *
 * Authors:     Miguel Baizán (miguel.baizan@integrasys-sa.com)
 *
 * Description: Definition of the basic structures (indexes, rows,
 *              container) used to serve the SNMP requests. Init and clean up
 *              functions for the structures holding the container.
 *              Note: this file originally auto-generated by mib2c using
 *              mib2c.mfd.conf 17337
 *
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef IEEE8021BRIDGEBASEPORTTABLE_H
#define IEEE8021BRIDGEBASEPORTTABLE_H

#ifdef __cplusplus
extern "C" {
#endif


/** @addtogroup misc misc: Miscellaneous routines
 *
 * @{
 */
#include <net-snmp/library/asn1.h>

/* other required module components */
    /* *INDENT-OFF*  */
config_add_mib(IEEE8021-BRIDGE-MIB)
config_require(IEEE8021-BRIDGE-MIB/ieee8021BridgeBasePortTable/ieee8021BridgeBasePortTable_interface)
config_require(IEEE8021-BRIDGE-MIB/ieee8021BridgeBasePortTable/ieee8021BridgeBasePortTable_data_access)
config_require(IEEE8021-BRIDGE-MIB/ieee8021BridgeBasePortTable/ieee8021BridgeBasePortTable_data_get)
config_require(IEEE8021-BRIDGE-MIB/ieee8021BridgeBasePortTable/ieee8021BridgeBasePortTable_data_set)
    /* *INDENT-ON*  */

/* OID and column number definitions for ieee8021BridgeBasePortTable */
#include "ieee8021BridgeBasePortTable_oids.h"

/* enum definions */
#include "ieee8021BridgeBasePortTable_enums.h"


#define DEFAULT_COMPONENTID 1

/* Custom IOCTLs */
#define PRIV_IOCGGETRFCR (SIOCDEVPRIVATE+3)
#define PRIV_IOCGGETECR (SIOCDEVPRIVATE+5)
#define WRN_RFCR_GET_QMODE 4
#define WRN_ECR_GET_PORTID 4

#define RFCR_QMODE_UNQUALIFIED 0x03

/* For custom ioctl operations on endpoint registers */
struct wrn_register_req {
    int         cmd;
    uint32_t    val;
};

/* *********************************************************************
 * function declarations
 */
void init_ieee8021BridgeBasePortTable(void);
void shutdown_ieee8021BridgeBasePortTable(void);

/* *********************************************************************
 * Table declarations
 */
/**********************************************************************
 **********************************************************************
 ***
 *** Table ieee8021BridgeBasePortTable
 ***
 **********************************************************************
 **********************************************************************/
/*
 * IEEE8021-BRIDGE-MIB::ieee8021BridgeBasePortTable is subid 4 of ieee8021BridgeBase.
 * Its status is Current.
 * OID: .1.3.111.2.802.1.1.2.1.1.4, length: 11
*/
/* *********************************************************************
 * When you register your mib, you get to provide a generic
 * pointer that will be passed back to you for most of the
 * functions calls.
 *
 * TODO:100:r: Review all context structures
 */
    /*
     * TODO:101:o: |-> Review ieee8021BridgeBasePortTable registration context.
     */
typedef netsnmp_data_list ieee8021BridgeBasePortTable_registration;

/**********************************************************************/
/*
 * TODO:110:r: |-> Review ieee8021BridgeBasePortTable data context structure.
 * This structure is used to represent the data for ieee8021BridgeBasePortTable.
 */
/*
 * This structure contains storage for all the columns defined in the
 * ieee8021BridgeBasePortTable.
 */
typedef struct ieee8021BridgeBasePortTable_data_s {

        /*
         * ieee8021BridgeBasePortIfIndex(3)/InterfaceIndexOrZero/ASN_INTEGER/long(long)//l/A/W/e/R/d/H
         */
   long   ieee8021BridgeBasePortIfIndex;

        /*
         * ieee8021BridgeBasePortDelayExceededDiscards(4)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
         */
   U64   ieee8021BridgeBasePortDelayExceededDiscards;

        /*
         * ieee8021BridgeBasePortMtuExceededDiscards(5)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
         */
   U64   ieee8021BridgeBasePortMtuExceededDiscards;

        /*
         * ieee8021BridgeBasePortCapabilities(6)/BITS/ASN_OCTET_STR/char(u_long)//L/A/w/E/r/d/h
         */
   u_long   ieee8021BridgeBasePortCapabilities;

        /*
         * ieee8021BridgeBasePortTypeCapabilities(7)/BITS/ASN_OCTET_STR/char(u_long)//L/A/w/E/r/d/h
         */
   u_long   ieee8021BridgeBasePortTypeCapabilities;

        /*
         * ieee8021BridgeBasePortType(8)/IEEE8021BridgePortType/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
         */
   u_long   ieee8021BridgeBasePortType;

        /*
         * ieee8021BridgeBasePortExternal(9)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
         */
   u_long   ieee8021BridgeBasePortExternal;

        /*
         * ieee8021BridgeBasePortAdminPointToPoint(10)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
         */
   u_long   ieee8021BridgeBasePortAdminPointToPoint;

        /*
         * ieee8021BridgeBasePortOperPointToPoint(11)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
         */
   u_long   ieee8021BridgeBasePortOperPointToPoint;

        /*
         * ieee8021BridgeBasePortName(12)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
         */
   char   ieee8021BridgeBasePortName[255];
size_t      ieee8021BridgeBasePortName_len; /* # of char elements, not bytes */

} ieee8021BridgeBasePortTable_data;


/* *********************************************************************
 * TODO:115:o: |-> Review ieee8021BridgeBasePortTable undo context.
 * We're just going to use the same data structure for our
 * undo_context. If you want to do something more efficent,
 * define your typedef here.
 */
typedef ieee8021BridgeBasePortTable_data ieee8021BridgeBasePortTable_undo_data;

/*
 * TODO:120:r: |-> Review ieee8021BridgeBasePortTable mib index.
 * This structure is used to represent the index for ieee8021BridgeBasePortTable.
 */
typedef struct ieee8021BridgeBasePortTable_mib_index_s {

        /*
         * ieee8021BridgeBasePortComponentId(1)/IEEE8021PbbComponentIdentifier/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
         */
   u_long   ieee8021BridgeBasePortComponentId;

        /*
         * ieee8021BridgeBasePort(2)/IEEE8021BridgePortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
         */
   u_long   ieee8021BridgeBasePort;


} ieee8021BridgeBasePortTable_mib_index;

    /*
     * TODO:121:r: |   |-> Review ieee8021BridgeBasePortTable max index length.
     * If you KNOW that your indexes will never exceed a certain
     * length, update this macro to that length.
*/
#define MAX_ieee8021BridgeBasePortTable_IDX_LEN     2


/* *********************************************************************
 * TODO:130:o: |-> Review ieee8021BridgeBasePortTable Row request (rowreq) context.
 * When your functions are called, you will be passed a
 * ieee8021BridgeBasePortTable_rowreq_ctx pointer.
 */
typedef struct ieee8021BridgeBasePortTable_rowreq_ctx_s {

    /** this must be first for container compare to work */
    netsnmp_index        oid_idx;
    oid                  oid_tmp[MAX_ieee8021BridgeBasePortTable_IDX_LEN];

    ieee8021BridgeBasePortTable_mib_index        tbl_idx;

    ieee8021BridgeBasePortTable_data              data;
    unsigned int                column_exists_flags; /* flags for existence */
    ieee8021BridgeBasePortTable_undo_data       * undo;
    unsigned int                column_set_flags; /* flags for set columns */


    /*
     * flags per row. Currently, the first (lower) 8 bits are reserved
     * for the user. See mfd.h for other flags.
     */
    u_int                       rowreq_flags;

    /*
     * TODO:131:o: |   |-> Add useful data to ieee8021BridgeBasePortTable rowreq context.
     */

    /*
     * storage for future expansion
     */
    netsnmp_data_list             *ieee8021BridgeBasePortTable_data_list;

} ieee8021BridgeBasePortTable_rowreq_ctx;

typedef struct ieee8021BridgeBasePortTable_ref_rowreq_ctx_s {
    ieee8021BridgeBasePortTable_rowreq_ctx *rowreq_ctx;
} ieee8021BridgeBasePortTable_ref_rowreq_ctx;

/* *********************************************************************
 * function prototypes
 */
    int ieee8021BridgeBasePortTable_pre_request(ieee8021BridgeBasePortTable_registration * user_context);
    int ieee8021BridgeBasePortTable_post_request(ieee8021BridgeBasePortTable_registration * user_context,
        int rc);

    int ieee8021BridgeBasePortTable_rowreq_ctx_init(ieee8021BridgeBasePortTable_rowreq_ctx *rowreq_ctx,
                                   void *user_init_ctx);
    void ieee8021BridgeBasePortTable_rowreq_ctx_cleanup(ieee8021BridgeBasePortTable_rowreq_ctx *rowreq_ctx);

    int ieee8021BridgeBasePortTable_check_dependencies(ieee8021BridgeBasePortTable_rowreq_ctx * rowreq_ctx);
    int ieee8021BridgeBasePortTable_commit(ieee8021BridgeBasePortTable_rowreq_ctx * rowreq_ctx);

    ieee8021BridgeBasePortTable_rowreq_ctx *
                  ieee8021BridgeBasePortTable_row_find_by_mib_index(ieee8021BridgeBasePortTable_mib_index *mib_idx);

extern const oid ieee8021BridgeBasePortTable_oid[];
extern const int ieee8021BridgeBasePortTable_oid_size;


#include "ieee8021BridgeBasePortTable_interface.h"
#include "ieee8021BridgeBasePortTable_data_access.h"
#include "ieee8021BridgeBasePortTable_data_get.h"
#include "ieee8021BridgeBasePortTable_data_set.h"

/*
 * DUMMY markers, ignore
 *
 * TODO:099:x: *************************************************************
 * TODO:199:x: *************************************************************
 * TODO:299:x: *************************************************************
 * TODO:399:x: *************************************************************
 * TODO:499:x: *************************************************************
 */

#ifdef __cplusplus
}
#endif

#endif /* IEEE8021BRIDGEBASEPORTTABLE_H */
/** @} */
