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

/**
 * Table entry class
 */
public class IpRouteEntry extends SnmpTableEntry
{
    // SnmpOID: .1.3.6.1.2.1.4.21.1.1
    protected SnmpIpAddress _ipRouteDest = new SnmpIpAddress();
    // SnmpOID: .1.3.6.1.2.1.4.21.1.2
    protected int _ipRouteIfIndex = 0;
    // SnmpOID: .1.3.6.1.2.1.4.21.1.3
    protected int _ipRouteMetric1 = 0;
    // SnmpOID: .1.3.6.1.2.1.4.21.1.4
    protected int _ipRouteMetric2 = 0;
    // SnmpOID: .1.3.6.1.2.1.4.21.1.5
    protected int _ipRouteMetric3 = 0;
    // SnmpOID: .1.3.6.1.2.1.4.21.1.6
    protected int _ipRouteMetric4 = 0;
    // SnmpOID: .1.3.6.1.2.1.4.21.1.7
    protected SnmpIpAddress _ipRouteNextHop = new SnmpIpAddress();
    // SnmpOID: .1.3.6.1.2.1.4.21.1.8
    protected int _ipRouteType = 0;
    // SnmpOID: .1.3.6.1.2.1.4.21.1.9
    protected int _ipRouteProto = 0;
    // SnmpOID: .1.3.6.1.2.1.4.21.1.10
    protected int _ipRouteAge = 0;
    // SnmpOID: .1.3.6.1.2.1.4.21.1.11
    protected SnmpIpAddress _ipRouteMask = new SnmpIpAddress();
    // SnmpOID: .1.3.6.1.2.1.4.21.1.12
    protected int _ipRouteMetric5 = 0;
    // SnmpOID: .1.3.6.1.2.1.4.21.1.13
    protected SnmpOID _ipRouteInfo = new SnmpOID();
    
    /**
     * Constructor
     * @param table the Table which contains this table entry class
     */
    public IpRouteEntry(SnmpTable table)
    {
        super(table);
    }
    
    /**
     * Constructor. Initializes member variables
     * @param table the Table which contains this table entry class
     */
    public IpRouteEntry( SnmpTable table, SnmpIpAddress ipRouteDest, int ipRouteIfIndex, int ipRouteMetric1, int ipRouteMetric2, int ipRouteMetric3, int ipRouteMetric4, SnmpIpAddress ipRouteNextHop, int ipRouteType, int ipRouteProto, int ipRouteAge, SnmpIpAddress ipRouteMask, int ipRouteMetric5, SnmpOID ipRouteInfo)
    {
        super(table);
        
        this._ipRouteDest = ipRouteDest;
        this._ipRouteIfIndex = ipRouteIfIndex;
        this._ipRouteMetric1 = ipRouteMetric1;
        this._ipRouteMetric2 = ipRouteMetric2;
        this._ipRouteMetric3 = ipRouteMetric3;
        this._ipRouteMetric4 = ipRouteMetric4;
        this._ipRouteNextHop = ipRouteNextHop;
        this._ipRouteType = ipRouteType;
        this._ipRouteProto = ipRouteProto;
        this._ipRouteAge = ipRouteAge;
        this._ipRouteMask = ipRouteMask;
        this._ipRouteMetric5 = ipRouteMetric5;
        this._ipRouteInfo = ipRouteInfo;
        
    }
    
    /**
     * 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("" + _ipRouteDest, false);
        }
        return _suffix;
    }
    
    /**
     * Sets column value at specified index
     * @param index the index of column to be set new value, ordered by their corresponding OID values
     * @param value new value of the column
     */
    public void set(int index, SnmpDataType value)
    {
        switch(index)
        {
            case 0 :
                _ipRouteDest = (SnmpIpAddress) value;
                break;
            case 1 :
                _ipRouteIfIndex = ((SnmpInt) value).getValue();
                break;
            case 2 :
                _ipRouteMetric1 = ((SnmpInt) value).getValue();
                break;
            case 3 :
                _ipRouteMetric2 = ((SnmpInt) value).getValue();
                break;
            case 4 :
                _ipRouteMetric3 = ((SnmpInt) value).getValue();
                break;
            case 5 :
                _ipRouteMetric4 = ((SnmpInt) value).getValue();
                break;
            case 6 :
                _ipRouteNextHop = (SnmpIpAddress) value;
                break;
            case 7 :
                _ipRouteType = ((SnmpInt) value).getValue();
                break;
            case 8 :
                _ipRouteProto = ((SnmpInt) value).getValue();
                break;
            case 9 :
                _ipRouteAge = ((SnmpInt) value).getValue();
                break;
            case 10 :
                _ipRouteMask = (SnmpIpAddress) value;
                break;
            case 11 :
                _ipRouteMetric5 = ((SnmpInt) value).getValue();
                break;
            case 12 :
                _ipRouteInfo = (SnmpOID) value;
                break;
        }
    }
    
}