// Home | Go Back //

/*
 * Copyright (c) 2002-2003 iReasoning Inc. All Rights Reserved.
 * 
 * This SOURCE CODE FILE, which has been provided by iReasoning Inc. as part
 * of an iReasoning Software product for use ONLY by licensed users of the product,
 * includes CONFIDENTIAL and PROPRIETARY information of iReasoning Inc.  
 *
 * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS 
 * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
 * THE PRODUCT.
 *
 * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD IREASONING SOFTWARE, ITS
 * RELATED COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY
 * CLAIMS OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR
 * DISTRIBUTION OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES
 * ARISING OUT OF OR RESULTING FROM THE USE, MODIFICATION, OR
 * DISTRIBUTION OF PROGRAMS OR FILES CREATED FROM, BASED ON, AND/OR
 * DERIVED FROM THIS SOURCE CODE FILE.
 */

package agent.ifmib;
import java.io.*;
import java.util.*;
import com.ireasoning.util.*;
import com.ireasoning.protocol.snmp.*;
import javax.management.*;

/**
 * Class represents ifXTable MIB object in IF_MIB
 */
public class IfXTable extends SnmpTable implements IfXTableMBean
{
    /**
     * Constructor
     * @param root SnmpOID tree root
     * @param oid the SnmpOID of this table. For example, ".1.3.6.1.2.1.2.2" for IfTable in RFC1213  
     * @param args the objects passed from caller for Initialization purpose
     */
    public IfXTable (OIDTreeNode root, String oid, Object[] args)
    {
        super(root, oid);
        // TODO: Add your implementation
        //New code
        addIfxEntries();
    }
    
    //New code
    //For illustration purpose, add some fake ifxentries
    private void addIfxEntries()
    {
        IfTable ifTable = AgentMib.getIfTable();
        ArrayList netifs = ifTable.getNetInterfaces();
        int size = netifs.size();
        for (int i = 0; i < size ; i++) 
        {
            NetInterface netif = (NetInterface) netifs.get(i);
            new IfXEntry(this, netif.descr).addRow();
        }
    }
    
    /**
     * Creates a new instance of table entry object
     */
    public SnmpTableEntry newEntryInstance()
    {
        return new IfXEntry (this);
    }
    
    /**
     * Gets ifName value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public String getIfName(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifName;
        }
    }
    
    /**
     * Sets new ifName value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfNameValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfXTableMBean does not have this method
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifName = (String) newValue;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifInMulticastPkts value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public SnmpCounter32 getIfInMulticastPkts(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifInMulticastPkts;
        }
    }
    
    /**
     * Sets new ifInMulticastPkts value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfInMulticastPktsValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfXTableMBean does not have this method
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifInMulticastPkts = (SnmpCounter32) newValue;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifInBroadcastPkts value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public SnmpCounter32 getIfInBroadcastPkts(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifInBroadcastPkts;
        }
    }
    
    /**
     * Sets new ifInBroadcastPkts value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfInBroadcastPktsValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfXTableMBean does not have this method
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifInBroadcastPkts = (SnmpCounter32) newValue;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifOutMulticastPkts value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public SnmpCounter32 getIfOutMulticastPkts(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifOutMulticastPkts;
        }
    }
    
    /**
     * Sets new ifOutMulticastPkts value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfOutMulticastPktsValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfXTableMBean does not have this method
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifOutMulticastPkts = (SnmpCounter32) newValue;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifOutBroadcastPkts value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public SnmpCounter32 getIfOutBroadcastPkts(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifOutBroadcastPkts;
        }
    }
    
    /**
     * Sets new ifOutBroadcastPkts value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfOutBroadcastPktsValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfXTableMBean does not have this method
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifOutBroadcastPkts = (SnmpCounter32) newValue;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifHCInOctets value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public SnmpCounter64 getIfHCInOctets(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifHCInOctets;
        }
    }
    
    /**
     * Sets new ifHCInOctets value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfHCInOctetsValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfXTableMBean does not have this method
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifHCInOctets = (SnmpCounter64) newValue;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifHCInUcastPkts value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public SnmpCounter64 getIfHCInUcastPkts(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifHCInUcastPkts;
        }
    }
    
    /**
     * Sets new ifHCInUcastPkts value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfHCInUcastPktsValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfXTableMBean does not have this method
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifHCInUcastPkts = (SnmpCounter64) newValue;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifHCInMulticastPkts value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public SnmpCounter64 getIfHCInMulticastPkts(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifHCInMulticastPkts;
        }
    }
    
    /**
     * Sets new ifHCInMulticastPkts value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfHCInMulticastPktsValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfXTableMBean does not have this method
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifHCInMulticastPkts = (SnmpCounter64) newValue;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifHCInBroadcastPkts value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public SnmpCounter64 getIfHCInBroadcastPkts(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifHCInBroadcastPkts;
        }
    }
    
    /**
     * Sets new ifHCInBroadcastPkts value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfHCInBroadcastPktsValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfXTableMBean does not have this method
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifHCInBroadcastPkts = (SnmpCounter64) newValue;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifHCOutOctets value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public SnmpCounter64 getIfHCOutOctets(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifHCOutOctets;
        }
    }
    
    /**
     * Sets new ifHCOutOctets value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfHCOutOctetsValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfXTableMBean does not have this method
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifHCOutOctets = (SnmpCounter64) newValue;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifHCOutUcastPkts value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public SnmpCounter64 getIfHCOutUcastPkts(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifHCOutUcastPkts;
        }
    }
    
    /**
     * Sets new ifHCOutUcastPkts value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfHCOutUcastPktsValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfXTableMBean does not have this method
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifHCOutUcastPkts = (SnmpCounter64) newValue;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifHCOutMulticastPkts value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public SnmpCounter64 getIfHCOutMulticastPkts(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifHCOutMulticastPkts;
        }
    }
    
    /**
     * Sets new ifHCOutMulticastPkts value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfHCOutMulticastPktsValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfXTableMBean does not have this method
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifHCOutMulticastPkts = (SnmpCounter64) newValue;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifHCOutBroadcastPkts value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public SnmpCounter64 getIfHCOutBroadcastPkts(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifHCOutBroadcastPkts;
        }
    }
    
    /**
     * Sets new ifHCOutBroadcastPkts value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfHCOutBroadcastPktsValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfXTableMBean does not have this method
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifHCOutBroadcastPkts = (SnmpCounter64) newValue;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifLinkUpDownTrapEnable value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public int getIfLinkUpDownTrapEnable(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifLinkUpDownTrapEnable;
        }
    }
    
    /**
     * Sets new ifLinkUpDownTrapEnable value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfLinkUpDownTrapEnableValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifLinkUpDownTrapEnable = ( (Integer) newValue).intValue() ;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifHighSpeed value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public SnmpGauge32 getIfHighSpeed(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifHighSpeed;
        }
    }
    
    /**
     * Sets new ifHighSpeed value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfHighSpeedValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfXTableMBean does not have this method
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifHighSpeed = (SnmpGauge32) newValue;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifPromiscuousMode value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public int getIfPromiscuousMode(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifPromiscuousMode;
        }
    }
    
    /**
     * Sets new ifPromiscuousMode value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfPromiscuousModeValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifPromiscuousMode = ( (Integer) newValue).intValue() ;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifConnectorPresent value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public int getIfConnectorPresent(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifConnectorPresent;
        }
    }
    
    /**
     * Sets new ifConnectorPresent value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfConnectorPresentValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfXTableMBean does not have this method
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifConnectorPresent = ( (Integer) newValue).intValue() ;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifAlias value
     * @param ifXEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public String getIfAlias(SnmpTableEntry ifXEntry, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            // TODO: Add your implementation
            return entry._ifAlias;
        }
    }
    
    /**
     * Sets new ifAlias value
     * @param ifXEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfAliasValue(SnmpTableEntry ifXEntry, Object newValue, SnmpPdu pdu)
    {
        synchronized (ifXEntry)
        {
            IfXEntry entry = (IfXEntry) ifXEntry;
            entry._ifAlias = (String) newValue;
            // TODO: Add your implementation
        }
    }
    
}