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

/**
 * Table entry class
 */
public class TcpConnEntry extends SnmpTableEntry
{
    // SnmpOID: .1.3.6.1.2.1.6.13.1.1
    protected int _tcpConnState = 0;
    // SnmpOID: .1.3.6.1.2.1.6.13.1.2
    protected SnmpIpAddress _tcpConnLocalAddress = new SnmpIpAddress();
    // SnmpOID: .1.3.6.1.2.1.6.13.1.3
    protected int _tcpConnLocalPort = 0;
    // SnmpOID: .1.3.6.1.2.1.6.13.1.4
    protected SnmpIpAddress _tcpConnRemAddress = new SnmpIpAddress();
    // SnmpOID: .1.3.6.1.2.1.6.13.1.5
    protected int _tcpConnRemPort = 0;
    
    /**
     * Constructor
     * @param table the Table which contains this table entry class
     */
    public TcpConnEntry(SnmpTable table)
    {
        super(table);
    }
    
    /**
     * Constructor. Initializes member variables
     * @param table the Table which contains this table entry class
     */
    public TcpConnEntry( SnmpTable table, int tcpConnState, SnmpIpAddress tcpConnLocalAddress, int tcpConnLocalPort, SnmpIpAddress tcpConnRemAddress, int tcpConnRemPort)
    {
        super(table);
        
        this._tcpConnState = tcpConnState;
        this._tcpConnLocalAddress = tcpConnLocalAddress;
        this._tcpConnLocalPort = tcpConnLocalPort;
        this._tcpConnRemAddress = tcpConnRemAddress;
        this._tcpConnRemPort = tcpConnRemPort;
        
    }
    
    /**
     * 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("" + _tcpConnLocalAddress, false) + "." + SnmpTableEntry.getIndexString("" + _tcpConnLocalPort, false) + "." + SnmpTableEntry.getIndexString("" + _tcpConnRemAddress, false) + "." + SnmpTableEntry.getIndexString("" + _tcpConnRemPort, 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 :
            _tcpConnState = ((SnmpInt) value).getValue();
            break;
            case 1 :
            _tcpConnLocalAddress = (SnmpIpAddress) value;
            break;
            case 2 :
            _tcpConnLocalPort = ((SnmpInt) value).getValue();
            break;
            case 3 :
            _tcpConnRemAddress = (SnmpIpAddress) value;
            break;
            case 4 :
            _tcpConnRemPort = ((SnmpInt) value).getValue();
            break;
        }
    }
    
}