// 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 ifStackTable MIB object in IF_MIB
 */
public class IfStackTable extends SnmpTable implements IfStackTableMBean
{
    /**
     * 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 IfStackTable (OIDTreeNode root, String oid, Object[] args)
    {
        super(root, oid);
        // TODO: Add your implementation
        addEntries();
    }
    
    private void addEntries()
    {//for testing purpose, only add one dummy row
        //    public IfStackEntry( SnmpTable table, int ifStackHigherLayer, int ifStackLowerLayer, int ifStackStatus)

        IfStackEntry entry = new IfStackEntry(this, 1, 1, SnmpRowStatus.ACTIVE);
        addRow(entry);
    }
    
    /**
     * Creates a new instance of table entry object
     */
    public SnmpTableEntry newEntryInstance()
    {
        return new IfStackEntry (this);
    }
    
    /**
     * Gets ifStackHigherLayer value
     * @param ifStackEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public int getIfStackHigherLayer(SnmpTableEntry ifStackEntry, SnmpPdu pdu)
    {
        // This MIB node is not readable, so IfStackTableMBean does not have this method
        synchronized (ifStackEntry)
        {
            IfStackEntry entry = (IfStackEntry) ifStackEntry;
            // TODO: Add your implementation
            return entry._ifStackHigherLayer;
        }
    }
    
    /**
     * Sets new ifStackHigherLayer value
     * @param ifStackEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfStackHigherLayerValue(SnmpTableEntry ifStackEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfStackTableMBean does not have this method
        synchronized (ifStackEntry)
        {
            IfStackEntry entry = (IfStackEntry) ifStackEntry;
            entry._ifStackHigherLayer = ( (Integer) newValue).intValue() ;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifStackLowerLayer value
     * @param ifStackEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public int getIfStackLowerLayer(SnmpTableEntry ifStackEntry, SnmpPdu pdu)
    {
        // This MIB node is not readable, so IfStackTableMBean does not have this method
        synchronized (ifStackEntry)
        {
            IfStackEntry entry = (IfStackEntry) ifStackEntry;
            // TODO: Add your implementation
            return entry._ifStackLowerLayer;
        }
    }
    
    /**
     * Sets new ifStackLowerLayer value
     * @param ifStackEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfStackLowerLayerValue(SnmpTableEntry ifStackEntry, Object newValue, SnmpPdu pdu)
    {
        // This MIB node is not writeable, so IfStackTableMBean does not have this method
        synchronized (ifStackEntry)
        {
            IfStackEntry entry = (IfStackEntry) ifStackEntry;
            entry._ifStackLowerLayer = ( (Integer) newValue).intValue() ;
            // TODO: Add your implementation
        }
    }
    
    /**
     * Gets ifStackStatus value
     * @param ifStackEntry table entry object
     * @param pdu the received SnmpPdu object
     */
    public int getIfStackStatus(SnmpTableEntry ifStackEntry, SnmpPdu pdu)
    {
        synchronized (ifStackEntry)
        {
            IfStackEntry entry = (IfStackEntry) ifStackEntry;
            // TODO: Add your implementation
            return entry._ifStackStatus;
        }
    }
    
    /**
     * Sets new ifStackStatus value
     * @param ifStackEntry table entry object
     * @param newValue new value to be set
     * @param pdu the received SnmpPdu object
     */
    public void setIfStackStatusValue(SnmpTableEntry ifStackEntry, Object newValue, SnmpPdu pdu)
    {
        synchronized (ifStackEntry)
        {
            IfStackEntry entry = (IfStackEntry) ifStackEntry;
            entry._ifStackStatus = ( (Integer) newValue).intValue() ;
            // TODO: Add your implementation
        }
    }
    
}