// 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.master;
import java.io.*;
import java.util.*;
import com.ireasoning.util.*;
import com.ireasoning.protocol.snmp.*;
import javax.management.*;

public class IfEntry extends SnmpTableEntry
{
    // SnmpOID: .1.3.6.1.2.1.2.2.1.1
    protected int _ifIndex = 0;
    // SnmpOID: .1.3.6.1.2.1.2.2.1.2
    protected String _ifDescr = "";
    // SnmpOID: .1.3.6.1.2.1.2.2.1.3
    protected int _ifType = 0;
    // SnmpOID: .1.3.6.1.2.1.2.2.1.4
    protected int _ifMtu = 0;
    // SnmpOID: .1.3.6.1.2.1.2.2.1.5
    protected SnmpGauge32 _ifSpeed = new SnmpGauge32();
    // SnmpOID: .1.3.6.1.2.1.2.2.1.6
    protected String _ifPhysAddress = "";
    // SnmpOID: .1.3.6.1.2.1.2.2.1.7
    protected int _ifAdminStatus = 0;
    // SnmpOID: .1.3.6.1.2.1.2.2.1.8
    protected int _ifOperStatus = 0;
    // SnmpOID: .1.3.6.1.2.1.2.2.1.9
    protected SnmpTimeTicks _ifLastChange = new SnmpTimeTicks();
    // SnmpOID: .1.3.6.1.2.1.2.2.1.10
    protected SnmpCounter32 _ifInOctets = new SnmpCounter32();
    // SnmpOID: .1.3.6.1.2.1.2.2.1.11
    protected SnmpCounter32 _ifInUcastPkts = new SnmpCounter32();
    // SnmpOID: .1.3.6.1.2.1.2.2.1.12
    protected SnmpCounter32 _ifInNUcastPkts = new SnmpCounter32();
    // SnmpOID: .1.3.6.1.2.1.2.2.1.13
    protected SnmpCounter32 _ifInDiscards = new SnmpCounter32();
    // SnmpOID: .1.3.6.1.2.1.2.2.1.14
    protected SnmpCounter32 _ifInErrors = new SnmpCounter32();
    // SnmpOID: .1.3.6.1.2.1.2.2.1.15
    protected SnmpCounter32 _ifInUnknownProtos = new SnmpCounter32();
    // SnmpOID: .1.3.6.1.2.1.2.2.1.16
    protected SnmpCounter32 _ifOutOctets = new SnmpCounter32();
    // SnmpOID: .1.3.6.1.2.1.2.2.1.17
    protected SnmpCounter32 _ifOutUcastPkts = new SnmpCounter32();
    // SnmpOID: .1.3.6.1.2.1.2.2.1.18
    protected SnmpCounter32 _ifOutNUcastPkts = new SnmpCounter32();
    // SnmpOID: .1.3.6.1.2.1.2.2.1.19
    protected SnmpCounter32 _ifOutDiscards = new SnmpCounter32();
    // SnmpOID: .1.3.6.1.2.1.2.2.1.20
    protected SnmpCounter32 _ifOutErrors = new SnmpCounter32();
    // SnmpOID: .1.3.6.1.2.1.2.2.1.21
    protected SnmpGauge32 _ifOutQLen = new SnmpGauge32();
    // SnmpOID: .1.3.6.1.2.1.2.2.1.22
    protected SnmpOID _ifSpecific = new SnmpOID();
    
    public IfEntry(SnmpTable table)
    {
        super(table);
    }
  
    //New code
    public IfEntry(SnmpTable table, int ifIndex, String ifDescr, String ifPhysAddress)
    {
        super(table);
        this._ifIndex = ifIndex;
        this._ifDescr = ifDescr;
        this._ifPhysAddress = ifPhysAddress;        
    }
    
    public IfEntry( SnmpTable table, int ifIndex, String ifDescr, int ifType, int ifMtu, SnmpGauge32 ifSpeed, String ifPhysAddress, int ifAdminStatus, int ifOperStatus, SnmpTimeTicks ifLastChange, SnmpCounter32 ifInOctets, SnmpCounter32 ifInUcastPkts, SnmpCounter32 ifInNUcastPkts, SnmpCounter32 ifInDiscards, SnmpCounter32 ifInErrors, SnmpCounter32 ifInUnknownProtos, SnmpCounter32 ifOutOctets, SnmpCounter32 ifOutUcastPkts, SnmpCounter32 ifOutNUcastPkts, SnmpCounter32 ifOutDiscards, SnmpCounter32 ifOutErrors, SnmpGauge32 ifOutQLen, SnmpOID ifSpecific)
    {
        super(table);
        
        this._ifIndex = ifIndex;
        this._ifDescr = ifDescr;
        this._ifType = ifType;
        this._ifMtu = ifMtu;
        this._ifSpeed = ifSpeed;
        this._ifPhysAddress = ifPhysAddress;
        this._ifAdminStatus = ifAdminStatus;
        this._ifOperStatus = ifOperStatus;
        this._ifLastChange = ifLastChange;
        this._ifInOctets = ifInOctets;
        this._ifInUcastPkts = ifInUcastPkts;
        this._ifInNUcastPkts = ifInNUcastPkts;
        this._ifInDiscards = ifInDiscards;
        this._ifInErrors = ifInErrors;
        this._ifInUnknownProtos = ifInUnknownProtos;
        this._ifOutOctets = ifOutOctets;
        this._ifOutUcastPkts = ifOutUcastPkts;
        this._ifOutNUcastPkts = ifOutNUcastPkts;
        this._ifOutDiscards = ifOutDiscards;
        this._ifOutErrors = ifOutErrors;
        this._ifOutQLen = ifOutQLen;
        this._ifSpecific = ifSpecific;
        
    }
    
    /**
     * Returns the index string for this row
     * @return the index string for this row. Return null to indicate that this row will not be added
     */
    public String getIndexSuffix()
    {
        if(_suffix.length() == 0)
        {
            _suffix = "." + SnmpTableEntry.getIndexString("" + _ifIndex, false);
        }
        return _suffix;
    }
    
    /**
     * Sets column value at specified index
     * @param index the index of column to be set new value
     * @param value new value of the column
     */
    public void set(int index, SnmpDataType value)
    {
        switch(index)
        {
            case 0 :
            _ifIndex = ((SnmpInt) value).getValue();
            break;
            case 1 :
            _ifDescr = value.toString();
            break;
            case 2 :
            _ifType = ((SnmpInt) value).getValue();
            break;
            case 3 :
            _ifMtu = ((SnmpInt) value).getValue();
            break;
            case 4 :
            _ifSpeed = (SnmpGauge32) value;
            break;
            case 5 :
            _ifPhysAddress = value.toString();
            break;
            case 6 :
            _ifAdminStatus = ((SnmpInt) value).getValue();
            break;
            case 7 :
            _ifOperStatus = ((SnmpInt) value).getValue();
            break;
            case 8 :
            _ifLastChange = (SnmpTimeTicks) value;
            break;
            case 9 :
            _ifInOctets = (SnmpCounter32) value;
            break;
            case 10 :
            _ifInUcastPkts = (SnmpCounter32) value;
            break;
            case 11 :
            _ifInNUcastPkts = (SnmpCounter32) value;
            break;
            case 12 :
            _ifInDiscards = (SnmpCounter32) value;
            break;
            case 13 :
            _ifInErrors = (SnmpCounter32) value;
            break;
            case 14 :
            _ifInUnknownProtos = (SnmpCounter32) value;
            break;
            case 15 :
            _ifOutOctets = (SnmpCounter32) value;
            break;
            case 16 :
            _ifOutUcastPkts = (SnmpCounter32) value;
            break;
            case 17 :
            _ifOutNUcastPkts = (SnmpCounter32) value;
            break;
            case 18 :
            _ifOutDiscards = (SnmpCounter32) value;
            break;
            case 19 :
            _ifOutErrors = (SnmpCounter32) value;
            break;
            case 20 :
            _ifOutQLen = (SnmpGauge32) value;
            break;
            case 21 :
            _ifSpecific = (SnmpOID) value;
            break;
        }
    }
    
}