/*
 * This Java file has been generated by smidump 0.4.5. Do not edit!
 * It is intended to be used within a Java AgentX sub-agent environment.
 *
 * $Id: IfXTable.java 4432 2006-05-29 16:21:11Z strauss $
 */

/**
    This class represents a Java AgentX (JAX) implementation of
    the table ifXTable defined in IF-MIB.

    @version 1
    @author  smidump 0.4.5
    @see     AgentXTable
 */

import java.util.Vector;

import jax.AgentXOID;
import jax.AgentXVarBind;
import jax.AgentXResponsePDU;
import jax.AgentXSetPhase;
import jax.AgentXTable;
import jax.AgentXEntry;

public class IfXTable extends AgentXTable
{

    // entry OID
    private final static long[] OID = {1, 3, 6, 1, 2, 1, 31, 1, 1, 1};

    // constructors
    public IfXTable()
    {
        oid = new AgentXOID(OID);

        // register implemented columns
        columns.addElement(new Long(1));
        columns.addElement(new Long(2));
        columns.addElement(new Long(3));
        columns.addElement(new Long(4));
        columns.addElement(new Long(5));
        columns.addElement(new Long(6));
        columns.addElement(new Long(7));
        columns.addElement(new Long(8));
        columns.addElement(new Long(9));
        columns.addElement(new Long(10));
        columns.addElement(new Long(11));
        columns.addElement(new Long(12));
        columns.addElement(new Long(13));
        columns.addElement(new Long(14));
        columns.addElement(new Long(15));
        columns.addElement(new Long(16));
        columns.addElement(new Long(17));
        columns.addElement(new Long(18));
        columns.addElement(new Long(19));
    }

    public IfXTable(boolean shared)
    {
        super(shared);

        oid = new AgentXOID(OID);

        // register implemented columns
        columns.addElement(new Long(1));
        columns.addElement(new Long(2));
        columns.addElement(new Long(3));
        columns.addElement(new Long(4));
        columns.addElement(new Long(5));
        columns.addElement(new Long(6));
        columns.addElement(new Long(7));
        columns.addElement(new Long(8));
        columns.addElement(new Long(9));
        columns.addElement(new Long(10));
        columns.addElement(new Long(11));
        columns.addElement(new Long(12));
        columns.addElement(new Long(13));
        columns.addElement(new Long(14));
        columns.addElement(new Long(15));
        columns.addElement(new Long(16));
        columns.addElement(new Long(17));
        columns.addElement(new Long(18));
        columns.addElement(new Long(19));
    }

    public AgentXVarBind getVarBind(AgentXEntry entry, long column)
    {
        AgentXOID oid = new AgentXOID(getOID(), column, entry.getInstance());

        switch ((int)column) {
        case 1: // ifName
        {
            byte[] value = ((IfXEntry)entry).get_ifName();
            return new AgentXVarBind(oid, AgentXVarBind.OCTETSTRING, value);
        }
        case 2: // ifInMulticastPkts
        {
            long value = ((IfXEntry)entry).get_ifInMulticastPkts();
            return new AgentXVarBind(oid, AgentXVarBind.COUNTER32, value);
        }
        case 3: // ifInBroadcastPkts
        {
            long value = ((IfXEntry)entry).get_ifInBroadcastPkts();
            return new AgentXVarBind(oid, AgentXVarBind.COUNTER32, value);
        }
        case 4: // ifOutMulticastPkts
        {
            long value = ((IfXEntry)entry).get_ifOutMulticastPkts();
            return new AgentXVarBind(oid, AgentXVarBind.COUNTER32, value);
        }
        case 5: // ifOutBroadcastPkts
        {
            long value = ((IfXEntry)entry).get_ifOutBroadcastPkts();
            return new AgentXVarBind(oid, AgentXVarBind.COUNTER32, value);
        }
        case 6: // ifHCInOctets
        {
            long value = ((IfXEntry)entry).get_ifHCInOctets();
            return new AgentXVarBind(oid, AgentXVarBind.COUNTER64, value);
        }
        case 7: // ifHCInUcastPkts
        {
            long value = ((IfXEntry)entry).get_ifHCInUcastPkts();
            return new AgentXVarBind(oid, AgentXVarBind.COUNTER64, value);
        }
        case 8: // ifHCInMulticastPkts
        {
            long value = ((IfXEntry)entry).get_ifHCInMulticastPkts();
            return new AgentXVarBind(oid, AgentXVarBind.COUNTER64, value);
        }
        case 9: // ifHCInBroadcastPkts
        {
            long value = ((IfXEntry)entry).get_ifHCInBroadcastPkts();
            return new AgentXVarBind(oid, AgentXVarBind.COUNTER64, value);
        }
        case 10: // ifHCOutOctets
        {
            long value = ((IfXEntry)entry).get_ifHCOutOctets();
            return new AgentXVarBind(oid, AgentXVarBind.COUNTER64, value);
        }
        case 11: // ifHCOutUcastPkts
        {
            long value = ((IfXEntry)entry).get_ifHCOutUcastPkts();
            return new AgentXVarBind(oid, AgentXVarBind.COUNTER64, value);
        }
        case 12: // ifHCOutMulticastPkts
        {
            long value = ((IfXEntry)entry).get_ifHCOutMulticastPkts();
            return new AgentXVarBind(oid, AgentXVarBind.COUNTER64, value);
        }
        case 13: // ifHCOutBroadcastPkts
        {
            long value = ((IfXEntry)entry).get_ifHCOutBroadcastPkts();
            return new AgentXVarBind(oid, AgentXVarBind.COUNTER64, value);
        }
        case 14: // ifLinkUpDownTrapEnable
        {
            int value = ((IfXEntry)entry).get_ifLinkUpDownTrapEnable();
            return new AgentXVarBind(oid, AgentXVarBind.INTEGER, value);
        }
        case 15: // ifHighSpeed
        {
            long value = ((IfXEntry)entry).get_ifHighSpeed();
            return new AgentXVarBind(oid, AgentXVarBind.GAUGE32, value);
        }
        case 16: // ifPromiscuousMode
        {
            int value = ((IfXEntry)entry).get_ifPromiscuousMode();
            return new AgentXVarBind(oid, AgentXVarBind.INTEGER, value);
        }
        case 17: // ifConnectorPresent
        {
            int value = ((IfXEntry)entry).get_ifConnectorPresent();
            return new AgentXVarBind(oid, AgentXVarBind.INTEGER, value);
        }
        case 18: // ifAlias
        {
            byte[] value = ((IfXEntry)entry).get_ifAlias();
            return new AgentXVarBind(oid, AgentXVarBind.OCTETSTRING, value);
        }
        case 19: // ifCounterDiscontinuityTime
        {
            long value = ((IfXEntry)entry).get_ifCounterDiscontinuityTime();
            return new AgentXVarBind(oid, AgentXVarBind.TIMETICKS, value);
        }
        }

        return null;
    }

    public int setEntry(AgentXSetPhase phase,
                        AgentXEntry entry,
                        long column,
                        AgentXVarBind vb)
    {

        switch ((int)column) {
        case 14: // ifLinkUpDownTrapEnable
        {
            if (vb.getType() != AgentXVarBind.INTEGER)
                return AgentXResponsePDU.WRONG_TYPE;
            else
                return ((IfXEntry)entry).set_ifLinkUpDownTrapEnable(phase, vb.intValue());
        }
        case 16: // ifPromiscuousMode
        {
            if (vb.getType() != AgentXVarBind.INTEGER)
                return AgentXResponsePDU.WRONG_TYPE;
            else
                return ((IfXEntry)entry).set_ifPromiscuousMode(phase, vb.intValue());
        }
        case 18: // ifAlias
        {
            if (vb.getType() != AgentXVarBind.OCTETSTRING)
                return AgentXResponsePDU.WRONG_TYPE;
            else
                return ((IfXEntry)entry).set_ifAlias(phase, vb.bytesValue());
        }
        }

        return AgentXResponsePDU.NOT_WRITABLE;
    }

}

