// 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.*;

/**
 * Class represents snmp mib object in RFC1213_MIB
 */
public class SnmpGroup extends SnmpBaseGroup implements SnmpGroupMBean
{
    /**
     * Constructor
     * @param root SnmpOID tree root
     * @param oid the SnmpOID of this group
     * @param args the objects passed from caller for Initialization purpose
     */
    public SnmpGroup(OIDTreeNode root, String oid, Object [] args)
    {
        super(root, oid);
    }
    
    private AgentStats getAgentStats()
    {
        return Agent.getAgent().getAgentStats();
    }

    /**
     * Gets new snmpInPkts value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInPkts()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInPkts());
    }
    
    /**
     * Sets new snmpInPkts value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInPkts(SnmpCounter32 newValue)
    {
        long l = ((SnmpCounter32) newValue).getValue();
        getAgentStats().setSnmpInPkts(l);
    }
    
    /**
     * Gets new snmpOutPkts value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpOutPkts()
    {
        return new SnmpCounter32(getAgentStats().getSnmpOutPkts());
    }
    
    /**
     * Sets new snmpOutPkts value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpOutPkts(SnmpCounter32 newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpOutPkts(l);
    }
    
    /**
     * Gets new snmpInBadVersions value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInBadVersions()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInBadVersions());
    }
    
    /**
     * Sets new snmpInBadVersions value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInBadVersions(SnmpCounter32 newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInBadVersions(l);
    }
    
    /**
     * Gets new snmpInBadCommunityNames value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInBadCommunityNames()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInBadCommunityNames());
    }
    
    /**
     * Sets new snmpInBadCommunityNames value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInBadCommunityNames(SnmpCounter32 newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInBadCommunityNames(l);
    }
    
    /**
     * Gets new snmpInBadCommunityUses value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInBadCommunityUses()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInBadCommunityUses());
    }
    
    /**
     * Sets new snmpInBadCommunityUses value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInBadCommunityUses(SnmpCounter32 newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInBadCommunityUses(l);
    }
    
    /**
     * Gets new snmpInASNParseErrs value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInASNParseErrs()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInASNParseErrs ());
    }
    
    /**
     * Sets new snmpInASNParseErrs value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInASNParseErrs(SnmpCounter32 newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInASNParseErrs(l);
    }
    
    /**
     * Gets new snmpInTooBigs value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInTooBigs()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInTooBigs ());
    }
    
    /**
     * Sets new snmpInTooBigs value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInTooBigs(SnmpCounter32 newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInTooBigs(l);
    }
    
    /**
     * Gets new snmpInNoSuchNames value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInNoSuchNames()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInNoSuchNames ());
    }
    
    /**
     * Sets new snmpInNoSuchNames value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInNoSuchNames(SnmpCounter32 newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInNoSuchNames(l);
    }
    
    /**
     * Gets new snmpInBadValues value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInBadValues()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInBadValues ());
    }
    
    /**
     * Sets new snmpInBadValues value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInBadValues(SnmpCounter32 newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInBadValues(l);
    }
    
    /**
     * Gets new snmpInReadOnlys value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInReadOnlys()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInReadOnlys ());
    }
    
    /**
     * Sets new snmpInReadOnlys value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInReadOnlys(SnmpCounter32 newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInReadOnlys(l);
    }
    
    /**
     * Gets new snmpInGenErrs value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInGenErrs()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInGenErrs ());
    }
    
    /**
     * Sets new snmpInGenErrs value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInGenErrs(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInGenErrs(l);
    }
    
    /**
     * Gets new snmpInTotalReqVars value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInTotalReqVars()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInTotalReqVars ());
    }
    
    /**
     * Sets new snmpInTotalReqVars value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInTotalReqVars(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInTotalReqVars(l);
    }
    
    /**
     * Gets new snmpInTotalSetVars value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInTotalSetVars()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInTotalSetVars ());
    }
    
    /**
     * Sets new snmpInTotalSetVars value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInTotalSetVars(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInTotalSetVars(l);
    }
    
    /**
     * Gets new snmpInGetRequests value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInGetRequests()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInGetRequests ());
    }
    
    /**
     * Sets new snmpInGetRequests value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInGetRequests(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInGetRequests(l);
    }
    
    /**
     * Gets new snmpInGetNexts value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInGetNexts()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInGetNexts ());
    }
    
    /**
     * Sets new snmpInGetNexts value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInGetNexts(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInGetNexts(l);
    }
    
    /**
     * Gets new snmpInSetRequests value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInSetRequests()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInSetRequests ());
    }
    
    /**
     * Sets new snmpInSetRequests value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInSetRequests(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInSetRequests(l);
    }
    
    /**
     * Gets new snmpInGetResponses value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInGetResponses()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInGetResponses ());
    }
    
    /**
     * Sets new snmpInGetResponses value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInGetResponses(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInGetResponses(l);
    }
    
    /**
     * Gets new snmpInTraps value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpInTraps()
    {
        return new SnmpCounter32(getAgentStats().getSnmpInTraps ());
    }
    
    /**
     * Sets new snmpInTraps value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpInTraps(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpInTraps(l);
    }
    
    /**
     * Gets new snmpOutTooBigs value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpOutTooBigs()
    {
        return new SnmpCounter32(getAgentStats().getSnmpOutTooBigs ());
    }
    
    /**
     * Sets new snmpOutTooBigs value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpOutTooBigs(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpOutTooBigs(l);
    }
    
    /**
     * Gets new snmpOutNoSuchNames value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpOutNoSuchNames()
    {
        return new SnmpCounter32(getAgentStats().getSnmpOutNoSuchNames ());
    }
    
    /**
     * Sets new snmpOutNoSuchNames value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpOutNoSuchNames(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpOutNoSuchNames(l);
    }
    
    /**
     * Gets new snmpOutBadValues value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpOutBadValues()
    {
        return new SnmpCounter32(getAgentStats().getSnmpOutBadValues ());
    }
    
    /**
     * Sets new snmpOutBadValues value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpOutBadValues(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpOutBadValues(l);
    }
    
    /**
     * Gets new snmpOutGenErrs value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpOutGenErrs()
    {
        return new SnmpCounter32(getAgentStats().getSnmpOutGenErrs ());
    }
    
    /**
     * Sets new snmpOutGenErrs value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpOutGenErrs(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpOutGenErrs(l);
    }
    
    /**
     * Gets new snmpOutGetRequests value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpOutGetRequests()
    {
        return new SnmpCounter32(getAgentStats().getSnmpOutGetRequests ());
    }
    
    /**
     * Sets new snmpOutGetRequests value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpOutGetRequests(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpOutGetRequests(l);
    }
    
    /**
     * Gets new snmpOutGetNexts value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpOutGetNexts()
    {
        return new SnmpCounter32(getAgentStats().getSnmpOutGetNexts ());
    }
    
    /**
     * Sets new snmpOutGetNexts value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpOutGetNexts(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpOutGetNexts(l);
    }
    
    /**
     * Gets new snmpOutSetRequests value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpOutSetRequests()
    {
        return new SnmpCounter32(getAgentStats().getSnmpOutSetRequests ());
    }
    
    /**
     * Sets new snmpOutSetRequests value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpOutSetRequests(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpOutSetRequests(l);
    }
    
    /**
     * Gets new snmpOutGetResponses value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpOutGetResponses()
    {
        return new SnmpCounter32(getAgentStats().getSnmpOutGetResponses ());
    }
    
    /**
     * Sets new snmpOutGetResponses value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpOutGetResponses(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpOutGetResponses(l);
    }
    
    /**
     * Gets new snmpOutTraps value
     * @param pdu the received SnmpPdu object
     */
    public synchronized SnmpCounter32 getSnmpOutTraps()
    {
        return new SnmpCounter32(getAgentStats().getSnmpOutTraps ());
    }
    
    /**
     * Sets new snmpOutTraps value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpOutTraps(SnmpCounter32  newValue)
    {
        long l = ((SnmpCounter32)newValue).getValue();
        getAgentStats().setSnmpOutTraps(l);
    }
    
    /**
     * Gets new snmpEnableAuthenTraps value
     * @param pdu the received SnmpPdu object
     */
    public synchronized int getSnmpEnableAuthenTraps()
    {
        boolean b = getAgentStats().isSnmpEnableAuthenTraps (); 
        if(b) return 1;
        else return 2;
    }
    
    /**
     * Sets new snmpEnableAuthenTraps value
     * @param value the new value
     * @param pdu the received SnmpPdu object
     */
    public synchronized void setSnmpEnableAuthenTraps(int newValue)
    {
        if(newValue == 1)
        {
            getAgentStats().setSnmpEnableAuthenTraps(true);
        }
        else 
        {
            getAgentStats().setSnmpEnableAuthenTraps(false);
        }
    }
    
}