package org.snmp4j.agent.mo.snmp;

import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.List;
import org.snmp4j.SNMP4JSettings;
import org.snmp4j.agent.DuplicateRegistrationException;
import org.snmp4j.agent.MOAccess;
import org.snmp4j.agent.MOGroup;
import org.snmp4j.agent.MOServer;
import org.snmp4j.agent.mo.DefaultMOFactory;
import org.snmp4j.agent.mo.DefaultMOMutableRow2PC;
import org.snmp4j.agent.mo.DefaultMOMutableTableModel;
import org.snmp4j.agent.mo.DefaultMOTable;
import org.snmp4j.agent.mo.MOColumn;
import org.snmp4j.agent.mo.MOFactory;
import org.snmp4j.agent.mo.MOMutableColumn;
import org.snmp4j.agent.mo.MOMutableTableModel;
import org.snmp4j.agent.mo.MOScalar;
import org.snmp4j.agent.mo.MOTable;
import org.snmp4j.agent.mo.MOTableIndex;
import org.snmp4j.agent.mo.MOTableModel;
import org.snmp4j.agent.mo.MOTableRelation;
import org.snmp4j.agent.mo.MOTableRowFactory;
import org.snmp4j.agent.mo.MOTableSubIndex;
import org.snmp4j.agent.mo.MOValueValidationEvent;
import org.snmp4j.agent.mo.MOValueValidationListener;
import org.snmp4j.agent.mo.snmp.smi.Constraint;
import org.snmp4j.agent.mo.snmp.smi.ConstraintsImpl;
import org.snmp4j.agent.mo.snmp.smi.EnumerationConstraint;
import org.snmp4j.agent.mo.snmp.smi.ValueConstraintValidator;
import org.snmp4j.agent.mo.snmp.tc.TextualConvention;
import org.snmp4j.agent.request.Request;
import org.snmp4j.agent.request.SubRequest;
import org.snmp4j.agent.security.VACM;
import org.snmp4j.log.LogAdapter;
import org.snmp4j.log.LogFactory;
import org.snmp4j.smi.Address;
import org.snmp4j.smi.AssignableFromLong;
import org.snmp4j.smi.Counter32;
import org.snmp4j.smi.Counter64;
import org.snmp4j.smi.Integer32;
import org.snmp4j.smi.IpAddress;
import org.snmp4j.smi.OID;
import org.snmp4j.smi.OctetString;
import org.snmp4j.smi.Opaque;
import org.snmp4j.smi.TimeTicks;
import org.snmp4j.smi.UnsignedInteger32;
import org.snmp4j.smi.Variable;
import org.snmp4j.smi.VariableBinding;

/* JADX INFO: loaded from: classes.dex */
public class NotificationLogMib implements MOGroup, NotificationLogListener, RowStatusListener {
    private static final String TC_DATEANDTIME = "DateAndTime";
    private static final String TC_MODULE_SNMPV2_TC = "SNMPv2-TC";
    private static final String TC_MODULE_SNMP_FRAMEWORK_MIB = "SNMP-FRAMEWORK-MIB";
    private static final String TC_ROWSTATUS = "RowStatus";
    private static final String TC_SNMPADMINSTRING = "SnmpAdminString";
    private static final String TC_SNMPENGINEID = "SnmpEngineID";
    private static final String TC_STORAGETYPE = "StorageType";
    private static final String TC_TADDRESS = "TAddress";
    private static final String TC_TDOMAIN = "TDomain";
    private static final String TC_TIMESTAMP = "TimeStamp";
    public static final int colNlmConfigLogAdminStatus = 4;
    public static final int colNlmConfigLogEntryLimit = 3;
    public static final int colNlmConfigLogEntryStatus = 7;
    public static final int colNlmConfigLogFilterName = 2;
    public static final int colNlmConfigLogOperStatus = 5;
    public static final int colNlmConfigLogStorageType = 6;
    public static final int colNlmLogContextEngineID = 7;
    public static final int colNlmLogContextName = 8;
    public static final int colNlmLogDateAndTime = 3;
    public static final int colNlmLogEngineID = 4;
    public static final int colNlmLogEngineTAddress = 5;
    public static final int colNlmLogEngineTDomain = 6;
    public static final int colNlmLogNotificationID = 9;
    public static final int colNlmLogTime = 2;
    public static final int colNlmLogVariableCounter32Val = 4;
    public static final int colNlmLogVariableCounter64Val = 11;
    public static final int colNlmLogVariableID = 2;
    public static final int colNlmLogVariableInteger32Val = 7;
    public static final int colNlmLogVariableIpAddressVal = 9;
    public static final int colNlmLogVariableOctetStringVal = 8;
    public static final int colNlmLogVariableOidVal = 10;
    public static final int colNlmLogVariableOpaqueVal = 12;
    public static final int colNlmLogVariableTimeTicksVal = 6;
    public static final int colNlmLogVariableUnsigned32Val = 5;
    public static final int colNlmLogVariableValueType = 3;
    public static final int colNlmStatsLogNotificationsBumped = 2;
    public static final int colNlmStatsLogNotificationsLogged = 1;
    public static final int idxNlmConfigLogAdminStatus = 2;
    public static final int idxNlmConfigLogEntryLimit = 1;
    public static final int idxNlmConfigLogEntryStatus = 5;
    public static final int idxNlmConfigLogFilterName = 0;
    public static final int idxNlmConfigLogOperStatus = 3;
    public static final int idxNlmConfigLogStorageType = 4;
    private static final int idxNlmConfigLogViewName = 6;
    public static final int idxNlmLogContextEngineID = 5;
    public static final int idxNlmLogContextName = 6;
    public static final int idxNlmLogDateAndTime = 1;
    public static final int idxNlmLogEngineID = 2;
    public static final int idxNlmLogEngineTAddress = 3;
    public static final int idxNlmLogEngineTDomain = 4;
    public static final int idxNlmLogNotificationID = 7;
    public static final int idxNlmLogTime = 0;
    public static final int idxNlmLogVariableCounter32Val = 2;
    public static final int idxNlmLogVariableCounter64Val = 9;
    public static final int idxNlmLogVariableID = 0;
    public static final int idxNlmLogVariableInteger32Val = 5;
    public static final int idxNlmLogVariableIpAddressVal = 7;
    public static final int idxNlmLogVariableOctetStringVal = 6;
    public static final int idxNlmLogVariableOidVal = 8;
    public static final int idxNlmLogVariableOpaqueVal = 10;
    public static final int idxNlmLogVariableTimeTicksVal = 4;
    public static final int idxNlmLogVariableUnsigned32Val = 3;
    public static final int idxNlmLogVariableValueType = 1;
    public static final int idxNlmStatsLogNotificationsBumped = 1;
    public static final int idxNlmStatsLogNotificationsLogged = 0;
    public static final String tcDefDateAndTime = "DateAndTime";
    public static final String tcDefRowStatus = "RowStatus";
    public static final String tcDefSnmpAdminString = "SnmpAdminString";
    public static final String tcDefSnmpEngineID = "SnmpEngineID";
    public static final String tcDefStorageType = "StorageType";
    public static final String tcDefTAddress = "TAddress";
    public static final String tcDefTDomain = "TDomain";
    public static final String tcDefTimeStamp = "TimeStamp";
    public static final String tcModuleSNMPv2Tc = "SNMPv2-TC";
    public static final String tcModuleSnmpFrameworkMib = "SNMP-FRAMEWORK-MIB";
    private TDomainAddressFactory addressFactory;
    private MOFactory moFactory;
    private long nextLogIndex;
    private MOScalar<UnsignedInteger32> nlmConfigGlobalAgeOut;
    private MOScalar<UnsignedInteger32> nlmConfigGlobalEntryLimit;
    private MOTable<NlmConfigLogEntryRow, MOColumn, MOTableModel<NlmConfigLogEntryRow>> nlmConfigLogEntry;
    private MOTableIndex nlmConfigLogEntryIndex;
    private MOTableSubIndex[] nlmConfigLogEntryIndexes;
    private MOTableModel<NlmConfigLogEntryRow> nlmConfigLogEntryModel;
    private List<OID> nlmLogEntries;
    private MOTable<NlmLogEntryRow, MOColumn, MOTableModel<NlmLogEntryRow>> nlmLogEntry;
    private MOTableIndex nlmLogEntryIndex;
    private MOTableSubIndex[] nlmLogEntryIndexes;
    private MOTableModel<NlmLogEntryRow> nlmLogEntryModel;
    private MOTable<NlmLogVariableEntryRow, MOColumn, MOTableModel<NlmLogVariableEntryRow>> nlmLogVariableEntry;
    private MOTableIndex nlmLogVariableEntryIndex;
    private MOTableSubIndex[] nlmLogVariableEntryIndexes;
    private MOTableModel<NlmLogVariableEntryRow> nlmLogVariableEntryModel;
    private MOScalar<Counter32> nlmStatsGlobalNotificationsBumped;
    private MOScalar<Counter32> nlmStatsGlobalNotificationsLogged;
    private MOTable<NlmStatsLogEntryRow, MOColumn, MOTableModel<NlmStatsLogEntryRow>> nlmStatsLogEntry;
    private MOTableRelation<NlmConfigLogEntryRow, NlmStatsLogEntryRow> nlmStatsLogEntryAugmentation;
    private MOTableIndex nlmStatsLogEntryIndex;
    private MOTableSubIndex[] nlmStatsLogEntryIndexes;
    private MOTableModel<NlmStatsLogEntryRow> nlmStatsLogEntryModel;
    private MOScalar<Integer32> snmp4jNotificationLogMode;
    private SnmpNotificationMIB snmpNotificationMIB;
    private VACM vacm;
    private static final LogAdapter LOGGER = LogFactory.getLogger(NotificationLogMib.class);
    public static final OID oidNotificationLogMib = new OID(new int[]{1, 3, 6, 1, 2, 1, 92});
    public static final OID oidNlmConfigGlobalEntryLimit = new OID(new int[]{1, 3, 6, 1, 2, 1, 92, 1, 1, 1, 0});
    public static final OID oidNlmConfigGlobalAgeOut = new OID(new int[]{1, 3, 6, 1, 2, 1, 92, 1, 1, 2, 0});
    public static final OID oidNlmStatsGlobalNotificationsLogged = new OID(new int[]{1, 3, 6, 1, 2, 1, 92, 1, 2, 1, 0});
    public static final OID oidNlmStatsGlobalNotificationsBumped = new OID(new int[]{1, 3, 6, 1, 2, 1, 92, 1, 2, 2, 0});
    public static final OID oidNlmConfigLogEntry = new OID(new int[]{1, 3, 6, 1, 2, 1, 92, 1, 1, 3, 1});
    public static final OID oidNlmLogName = new OID(new int[]{1, 3, 6, 1, 2, 1, 92, 1, 1, 3, 1, 1});
    public static final OID oidNlmStatsLogEntry = new OID(new int[]{1, 3, 6, 1, 2, 1, 92, 1, 2, 3, 1});
    public static final OID oidNlmLogEntry = new OID(new int[]{1, 3, 6, 1, 2, 1, 92, 1, 3, 1, 1});
    public static final OID oidNlmLogIndex = new OID(new int[]{1, 3, 6, 1, 2, 1, 92, 1, 3, 1, 1, 1});
    public static final OID oidNlmLogVariableEntry = new OID(new int[]{1, 3, 6, 1, 2, 1, 92, 1, 3, 2, 1});
    public static final OID oidNlmLogVariableIndex = new OID(new int[]{1, 3, 6, 1, 2, 1, 92, 1, 3, 2, 1, 1});
    public static final OID oidSnmp4jNotificationLogMode = new OID(new int[]{1, 3, 6, 1, 4, 1, SNMP4JSettings.AGENTPP_ENTERPRISE_ID, 10, 1, 1, 1, 1, 3, 0});
    private static final int[] VAR_SYNTAX_LIST = {65, 66, 67, 2, 4, 64, 6, 70, 68};

    public class NlmConfigGlobalAgeOut extends MOScalar<UnsignedInteger32> {
        NlmConfigGlobalAgeOut(OID oid, MOAccess mOAccess) {
            super(oid, mOAccess, new UnsignedInteger32());
        }

        @Override // org.snmp4j.agent.mo.MOScalar
        public int isValueOK(SubRequest subRequest) {
            subRequest.getVariableBinding().getVariable();
            int iIsValueOK = super.isValueOK(subRequest);
            if (iIsValueOK != 0) {
            }
            return iIsValueOK;
        }

        @Override // org.snmp4j.agent.mo.MOScalar
        public UnsignedInteger32 getValue() {
            return (UnsignedInteger32) super.getValue();
        }

        @Override // org.snmp4j.agent.mo.MOScalar
        public int setValue(UnsignedInteger32 unsignedInteger32) {
            return super.setValue(unsignedInteger32);
        }
    }

    public class NlmConfigGlobalEntryLimit extends MOScalar<UnsignedInteger32> {
        NlmConfigGlobalEntryLimit(OID oid, MOAccess mOAccess) {
            super(oid, mOAccess, new UnsignedInteger32());
        }

        @Override // org.snmp4j.agent.mo.MOScalar, org.snmp4j.agent.ManagedObject
        public void commit(SubRequest subRequest) {
            super.commit(subRequest);
            if (subRequest.getStatus().getErrorStatus() == 0) {
                OID oid = subRequest.getVariableBinding().getOid();
                OID oid2 = new OID(oid.getValue(), NotificationLogMib.oidNlmConfigLogEntry.size() + 1, (oid.size() - NotificationLogMib.oidNlmConfigLogEntry.size()) + 1);
                OctetString octetString = new OctetString();
                octetString.fromSubIndex(oid2, false);
                NotificationLogMib.this.checkLimits(octetString);
            }
        }

        @Override // org.snmp4j.agent.mo.MOScalar
        public int isValueOK(SubRequest subRequest) {
            subRequest.getVariableBinding().getVariable();
            int iIsValueOK = super.isValueOK(subRequest);
            if (iIsValueOK != 0) {
            }
            return iIsValueOK;
        }

        @Override // org.snmp4j.agent.mo.MOScalar
        public UnsignedInteger32 getValue() {
            return (UnsignedInteger32) super.getValue();
        }

        @Override // org.snmp4j.agent.mo.MOScalar
        public int setValue(UnsignedInteger32 unsignedInteger32) {
            return super.setValue(unsignedInteger32);
        }
    }

    public static final class NlmConfigLogAdminStatusEnum {
        public static final int disabled = 2;
        public static final int enabled = 1;
    }

    public class NlmConfigLogEntryRow extends DefaultMOMutableRow2PC {
        public NlmConfigLogEntryRow(OID oid, Variable[] variableArr) {
            super(oid, variableArr);
        }

        public Integer32 getNlmConfigLogAdminStatus() {
            return (Integer32) super.getValue(2);
        }

        public UnsignedInteger32 getNlmConfigLogEntryLimit() {
            return (UnsignedInteger32) super.getValue(1);
        }

        public Integer32 getNlmConfigLogEntryStatus() {
            return (Integer32) super.getValue(5);
        }

        public OctetString getNlmConfigLogFilterName() {
            return (OctetString) super.getValue(0);
        }

        public Integer32 getNlmConfigLogOperStatus() {
            if (1 == getNlmConfigLogAdminStatus().getValue()) {
                OctetString nlmConfigLogFilterName = getNlmConfigLogFilterName();
                if (nlmConfigLogFilterName == null || nlmConfigLogFilterName.length() <= 0 || !NotificationLogMib.this.snmpNotificationMIB.hasFilter(getNlmConfigLogFilterName())) {
                    this.values[3] = new Integer32(3);
                } else {
                    this.values[3] = new Integer32(2);
                }
            } else {
                this.values[3] = new Integer32(1);
            }
            return (Integer32) super.getValue(3);
        }

        public Integer32 getNlmConfigLogStorageType() {
            return (Integer32) super.getValue(4);
        }

        @Override // org.snmp4j.agent.mo.DefaultMOMutableRow2PC, org.snmp4j.agent.mo.DefaultMOTableRow, org.snmp4j.agent.mo.MOTableRow
        public Variable getValue(int i2) {
            return i2 != 0 ? i2 != 1 ? i2 != 2 ? i2 != 3 ? i2 != 4 ? i2 != 5 ? super.getValue(i2) : getNlmConfigLogEntryStatus() : getNlmConfigLogStorageType() : getNlmConfigLogOperStatus() : getNlmConfigLogAdminStatus() : getNlmConfigLogEntryLimit() : getNlmConfigLogFilterName();
        }

        public OctetString getViewName() {
            return (OctetString) this.values[6];
        }

        public void setNlmConfigLogAdminStatus(Integer32 integer32) {
            super.setValue(2, integer32);
        }

        public void setNlmConfigLogEntryLimit(UnsignedInteger32 unsignedInteger32) {
            super.setValue(1, unsignedInteger32);
        }

        public void setNlmConfigLogEntryStatus(Integer32 integer32) {
            super.setValue(5, integer32);
        }

        public void setNlmConfigLogFilterName(OctetString octetString) {
            super.setValue(0, octetString);
        }

        public void setNlmConfigLogOperStatus(Integer32 integer32) {
            super.setValue(3, integer32);
        }

        public void setNlmConfigLogStorageType(Integer32 integer32) {
            super.setValue(4, integer32);
        }

        @Override // org.snmp4j.agent.mo.DefaultMOMutableRow2PC, org.snmp4j.agent.mo.MOMutableTableRow
        public void setValue(int i2, Variable variable) {
            if (i2 == 0) {
                setNlmConfigLogFilterName((OctetString) variable);
                return;
            }
            if (i2 == 1) {
                setNlmConfigLogEntryLimit((UnsignedInteger32) variable);
                return;
            }
            if (i2 == 2) {
                setNlmConfigLogAdminStatus((Integer32) variable);
                return;
            }
            if (i2 == 3) {
                setNlmConfigLogOperStatus((Integer32) variable);
                return;
            }
            if (i2 == 4) {
                setNlmConfigLogStorageType((Integer32) variable);
            } else if (i2 != 5) {
                super.setValue(i2, variable);
            } else {
                setNlmConfigLogEntryStatus((Integer32) variable);
            }
        }

        public void setViewName(OctetString octetString) {
            this.values[6] = octetString;
        }
    }

    class NlmConfigLogEntryRowFactory implements MOTableRowFactory<NlmConfigLogEntryRow> {
        NlmConfigLogEntryRowFactory() {
        }

        @Override // org.snmp4j.agent.mo.MOTableRowFactory
        public synchronized NlmConfigLogEntryRow createRow(OID oid, Variable[] variableArr) throws UnsupportedOperationException {
            NlmConfigLogEntryRow nlmConfigLogEntryRow;
            nlmConfigLogEntryRow = NotificationLogMib.this.new NlmConfigLogEntryRow(oid, variableArr);
            if (variableArr.length < NotificationLogMib.this.nlmConfigLogEntry.getColumnCount() + 1) {
                Variable[] variableArr2 = new Variable[NotificationLogMib.this.nlmConfigLogEntry.getColumnCount() + 1];
                System.arraycopy(variableArr, 0, variableArr2, 0, variableArr.length);
                variableArr2[variableArr.length] = new OctetString();
                nlmConfigLogEntryRow = NotificationLogMib.this.new NlmConfigLogEntryRow(oid, variableArr2);
            }
            return nlmConfigLogEntryRow;
        }

        @Override // org.snmp4j.agent.mo.MOTableRowFactory
        public synchronized void freeRow(NlmConfigLogEntryRow nlmConfigLogEntryRow) {
        }
    }

    static class NlmConfigLogFilterNameValidator implements MOValueValidationListener {
        NlmConfigLogFilterNameValidator() {
        }

        @Override // org.snmp4j.agent.mo.MOValueValidationListener
        public void validate(MOValueValidationEvent mOValueValidationEvent) {
            OctetString octetString = (OctetString) mOValueValidationEvent.getNewValue();
            if (octetString.length() < 0 || octetString.length() > 32) {
                mOValueValidationEvent.setValidationStatus(8);
            }
        }
    }

    public static final class NlmConfigLogOperStatusEnum {
        public static final int disabled = 1;
        public static final int noFilter = 3;
        public static final int operational = 2;
    }

    public class NlmLogEntryRow extends DefaultMOMutableRow2PC {
        public NlmLogEntryRow(OID oid, Variable[] variableArr) {
            super(oid, variableArr);
        }

        public OctetString getNlmLogContextEngineID() {
            return (OctetString) super.getValue(5);
        }

        public OctetString getNlmLogContextName() {
            return (OctetString) super.getValue(6);
        }

        public OctetString getNlmLogDateAndTime() {
            return (OctetString) super.getValue(1);
        }

        public OctetString getNlmLogEngineID() {
            return (OctetString) super.getValue(2);
        }

        public OctetString getNlmLogEngineTAddress() {
            return (OctetString) super.getValue(3);
        }

        public OID getNlmLogEngineTDomain() {
            return (OID) super.getValue(4);
        }

        public OID getNlmLogNotificationID() {
            return (OID) super.getValue(7);
        }

        public TimeTicks getNlmLogTime() {
            return (TimeTicks) super.getValue(0);
        }

        @Override // org.snmp4j.agent.mo.DefaultMOMutableRow2PC, org.snmp4j.agent.mo.DefaultMOTableRow, org.snmp4j.agent.mo.MOTableRow
        public Variable getValue(int i2) {
            switch (i2) {
                case 0:
                    return getNlmLogTime();
                case 1:
                    return getNlmLogDateAndTime();
                case 2:
                    return getNlmLogEngineID();
                case 3:
                    return getNlmLogEngineTAddress();
                case 4:
                    return getNlmLogEngineTDomain();
                case 5:
                    return getNlmLogContextEngineID();
                case 6:
                    return getNlmLogContextName();
                case 7:
                    return getNlmLogNotificationID();
                default:
                    return super.getValue(i2);
            }
        }

        public void setNlmLogContextEngineID(OctetString octetString) {
            super.setValue(5, octetString);
        }

        public void setNlmLogContextName(OctetString octetString) {
            super.setValue(6, octetString);
        }

        public void setNlmLogDateAndTime(OctetString octetString) {
            super.setValue(1, octetString);
        }

        public void setNlmLogEngineID(OctetString octetString) {
            super.setValue(2, octetString);
        }

        public void setNlmLogEngineTAddress(OctetString octetString) {
            super.setValue(3, octetString);
        }

        public void setNlmLogEngineTDomain(OID oid) {
            super.setValue(4, oid);
        }

        public void setNlmLogNotificationID(OID oid) {
            super.setValue(7, oid);
        }

        public void setNlmLogTime(TimeTicks timeTicks) {
            super.setValue(0, timeTicks);
        }

        @Override // org.snmp4j.agent.mo.DefaultMOMutableRow2PC, org.snmp4j.agent.mo.MOMutableTableRow
        public void setValue(int i2, Variable variable) {
            switch (i2) {
                case 0:
                    setNlmLogTime((TimeTicks) variable);
                    break;
                case 1:
                    setNlmLogDateAndTime((OctetString) variable);
                    break;
                case 2:
                    setNlmLogEngineID((OctetString) variable);
                    break;
                case 3:
                    setNlmLogEngineTAddress((OctetString) variable);
                    break;
                case 4:
                    setNlmLogEngineTDomain((OID) variable);
                    break;
                case 5:
                    setNlmLogContextEngineID((OctetString) variable);
                    break;
                case 6:
                    setNlmLogContextName((OctetString) variable);
                    break;
                case 7:
                    setNlmLogNotificationID((OID) variable);
                    break;
                default:
                    super.setValue(i2, variable);
                    break;
            }
        }
    }

    class NlmLogEntryRowFactory implements MOTableRowFactory<NlmLogEntryRow> {
        NlmLogEntryRowFactory() {
        }

        @Override // org.snmp4j.agent.mo.MOTableRowFactory
        public synchronized NlmLogEntryRow createRow(OID oid, Variable[] variableArr) throws UnsupportedOperationException {
            return NotificationLogMib.this.new NlmLogEntryRow(oid, variableArr);
        }

        @Override // org.snmp4j.agent.mo.MOTableRowFactory
        public synchronized void freeRow(NlmLogEntryRow nlmLogEntryRow) {
        }
    }

    public class NlmLogVariableEntryRow extends DefaultMOMutableRow2PC {
        public NlmLogVariableEntryRow(OID oid, Variable[] variableArr) {
            super(oid, variableArr);
        }

        public Counter32 getNlmLogVariableCounter32Val() {
            return (Counter32) super.getValue(2);
        }

        public Counter64 getNlmLogVariableCounter64Val() {
            return (Counter64) super.getValue(9);
        }

        public OID getNlmLogVariableID() {
            return (OID) super.getValue(0);
        }

        public Integer32 getNlmLogVariableInteger32Val() {
            return (Integer32) super.getValue(5);
        }

        public IpAddress getNlmLogVariableIpAddressVal() {
            return (IpAddress) super.getValue(7);
        }

        public OctetString getNlmLogVariableOctetStringVal() {
            return (OctetString) super.getValue(6);
        }

        public OID getNlmLogVariableOidVal() {
            return (OID) super.getValue(8);
        }

        public Opaque getNlmLogVariableOpaqueVal() {
            return (Opaque) super.getValue(10);
        }

        public TimeTicks getNlmLogVariableTimeTicksVal() {
            return (TimeTicks) super.getValue(4);
        }

        public UnsignedInteger32 getNlmLogVariableUnsigned32Val() {
            return (UnsignedInteger32) super.getValue(3);
        }

        public Integer32 getNlmLogVariableValueType() {
            return (Integer32) super.getValue(1);
        }

        @Override // org.snmp4j.agent.mo.DefaultMOMutableRow2PC, org.snmp4j.agent.mo.DefaultMOTableRow, org.snmp4j.agent.mo.MOTableRow
        public Variable getValue(int i2) {
            switch (i2) {
                case 0:
                    return getNlmLogVariableID();
                case 1:
                    return getNlmLogVariableValueType();
                case 2:
                    return getNlmLogVariableCounter32Val();
                case 3:
                    return getNlmLogVariableUnsigned32Val();
                case 4:
                    return getNlmLogVariableTimeTicksVal();
                case 5:
                    return getNlmLogVariableInteger32Val();
                case 6:
                    return getNlmLogVariableOctetStringVal();
                case 7:
                    return getNlmLogVariableIpAddressVal();
                case 8:
                    return getNlmLogVariableOidVal();
                case 9:
                    return getNlmLogVariableCounter64Val();
                case 10:
                    return getNlmLogVariableOpaqueVal();
                default:
                    return super.getValue(i2);
            }
        }

        public void setNlmLogVariableCounter32Val(Counter32 counter32) {
            super.setValue(2, counter32);
        }

        public void setNlmLogVariableCounter64Val(Counter64 counter64) {
            super.setValue(9, counter64);
        }

        public void setNlmLogVariableID(OID oid) {
            super.setValue(0, oid);
        }

        public void setNlmLogVariableInteger32Val(Integer32 integer32) {
            super.setValue(5, integer32);
        }

        public void setNlmLogVariableIpAddressVal(IpAddress ipAddress) {
            super.setValue(7, ipAddress);
        }

        public void setNlmLogVariableOctetStringVal(OctetString octetString) {
            super.setValue(6, octetString);
        }

        public void setNlmLogVariableOidVal(OID oid) {
            super.setValue(8, oid);
        }

        public void setNlmLogVariableOpaqueVal(Opaque opaque) {
            super.setValue(10, opaque);
        }

        public void setNlmLogVariableTimeTicksVal(TimeTicks timeTicks) {
            super.setValue(4, timeTicks);
        }

        public void setNlmLogVariableUnsigned32Val(UnsignedInteger32 unsignedInteger32) {
            super.setValue(3, unsignedInteger32);
        }

        public void setNlmLogVariableValueType(Integer32 integer32) {
            super.setValue(1, integer32);
        }

        @Override // org.snmp4j.agent.mo.DefaultMOMutableRow2PC, org.snmp4j.agent.mo.MOMutableTableRow
        public void setValue(int i2, Variable variable) {
            switch (i2) {
                case 0:
                    setNlmLogVariableID((OID) variable);
                    break;
                case 1:
                    setNlmLogVariableValueType((Integer32) variable);
                    break;
                case 2:
                    setNlmLogVariableCounter32Val((Counter32) variable);
                    break;
                case 3:
                    setNlmLogVariableUnsigned32Val((UnsignedInteger32) variable);
                    break;
                case 4:
                    setNlmLogVariableTimeTicksVal((TimeTicks) variable);
                    break;
                case 5:
                    setNlmLogVariableInteger32Val((Integer32) variable);
                    break;
                case 6:
                    setNlmLogVariableOctetStringVal((OctetString) variable);
                    break;
                case 7:
                    setNlmLogVariableIpAddressVal((IpAddress) variable);
                    break;
                case 8:
                    setNlmLogVariableOidVal((OID) variable);
                    break;
                case 9:
                    setNlmLogVariableCounter64Val((Counter64) variable);
                    break;
                case 10:
                    setNlmLogVariableOpaqueVal((Opaque) variable);
                    break;
                default:
                    super.setValue(i2, variable);
                    break;
            }
        }
    }

    class NlmLogVariableEntryRowFactory implements MOTableRowFactory<NlmLogVariableEntryRow> {
        NlmLogVariableEntryRowFactory() {
        }

        @Override // org.snmp4j.agent.mo.MOTableRowFactory
        public synchronized NlmLogVariableEntryRow createRow(OID oid, Variable[] variableArr) throws UnsupportedOperationException {
            return NotificationLogMib.this.new NlmLogVariableEntryRow(oid, variableArr);
        }

        @Override // org.snmp4j.agent.mo.MOTableRowFactory
        public synchronized void freeRow(NlmLogVariableEntryRow nlmLogVariableEntryRow) {
        }
    }

    public static final class NlmLogVariableValueTypeEnum {
        public static final int counter32 = 1;
        public static final int counter64 = 8;
        public static final int integer32 = 4;
        public static final int ipAddress = 5;
        public static final int objectId = 7;
        public static final int octetString = 6;
        public static final int opaque = 9;
        public static final int timeTicks = 3;
        public static final int unsigned32 = 2;
    }

    public class NlmStatsLogEntryRow extends DefaultMOMutableRow2PC {
        public NlmStatsLogEntryRow(OID oid, Variable[] variableArr) {
            super(oid, variableArr);
        }

        public Counter32 getNlmStatsLogNotificationsBumped() {
            return (Counter32) super.getValue(1);
        }

        public Counter32 getNlmStatsLogNotificationsLogged() {
            return (Counter32) super.getValue(0);
        }

        @Override // org.snmp4j.agent.mo.DefaultMOMutableRow2PC, org.snmp4j.agent.mo.DefaultMOTableRow, org.snmp4j.agent.mo.MOTableRow
        public Variable getValue(int i2) {
            return i2 != 0 ? i2 != 1 ? super.getValue(i2) : getNlmStatsLogNotificationsBumped() : getNlmStatsLogNotificationsLogged();
        }

        public void setNlmStatsLogNotificationsBumped(Counter32 counter32) {
            super.setValue(1, counter32);
        }

        public void setNlmStatsLogNotificationsLogged(Counter32 counter32) {
            super.setValue(0, counter32);
        }

        @Override // org.snmp4j.agent.mo.DefaultMOMutableRow2PC, org.snmp4j.agent.mo.MOMutableTableRow
        public void setValue(int i2, Variable variable) {
            if (i2 == 0) {
                setNlmStatsLogNotificationsLogged((Counter32) variable);
            } else if (i2 != 1) {
                super.setValue(i2, variable);
            } else {
                setNlmStatsLogNotificationsBumped((Counter32) variable);
            }
        }
    }

    class NlmStatsLogEntryRowFactory implements MOTableRowFactory<NlmStatsLogEntryRow> {
        NlmStatsLogEntryRowFactory() {
        }

        @Override // org.snmp4j.agent.mo.MOTableRowFactory
        public synchronized NlmStatsLogEntryRow createRow(OID oid, Variable[] variableArr) throws UnsupportedOperationException {
            NlmStatsLogEntryRow nlmStatsLogEntryRow;
            nlmStatsLogEntryRow = NotificationLogMib.this.new NlmStatsLogEntryRow(oid, variableArr);
            variableArr[0] = new Counter32(0L);
            variableArr[1] = new Counter32(0L);
            return nlmStatsLogEntryRow;
        }

        @Override // org.snmp4j.agent.mo.MOTableRowFactory
        public synchronized void freeRow(NlmStatsLogEntryRow nlmStatsLogEntryRow) {
        }
    }

    public static final class Snmp4jNotificationLogModeEnum {
        public static final int fired = 1;
        public static final int sent = 2;
    }

    static class Snmp4jNotificationLogModeValidator implements MOValueValidationListener {
        Snmp4jNotificationLogModeValidator() {
        }

        @Override // org.snmp4j.agent.mo.MOValueValidationListener
        public void validate(MOValueValidationEvent mOValueValidationEvent) {
            mOValueValidationEvent.getNewValue();
        }
    }

    public class SnmpAdminString implements TextualConvention {
        public SnmpAdminString() {
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public MOColumn createColumn(int i2, int i3, MOAccess mOAccess, Variable variable, boolean z) {
            MOColumn mOColumnCreateColumn = NotificationLogMib.this.moFactory.createColumn(i2, i3, mOAccess, variable, z);
            if (mOColumnCreateColumn instanceof MOMutableColumn) {
                ConstraintsImpl constraintsImpl = new ConstraintsImpl();
                constraintsImpl.add(new Constraint(0L, 255L));
                ((MOMutableColumn) mOColumnCreateColumn).addMOValueValidationListener(new ValueConstraintValidator(constraintsImpl));
            }
            return mOColumnCreateColumn;
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public Variable createInitialValue() {
            Variable octetString = new OctetString();
            if (octetString instanceof AssignableFromLong) {
                ((AssignableFromLong) octetString).setValue(0L);
            }
            return octetString;
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public MOScalar createScalar(OID oid, MOAccess mOAccess, Variable variable) {
            MOScalar mOScalarCreateScalar = NotificationLogMib.this.moFactory.createScalar(oid, mOAccess, variable);
            ConstraintsImpl constraintsImpl = new ConstraintsImpl();
            constraintsImpl.add(new Constraint(0L, 255L));
            mOScalarCreateScalar.addMOValueValidationListener(new ValueConstraintValidator(constraintsImpl));
            return mOScalarCreateScalar;
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public String getModuleName() {
            return "SNMP-FRAMEWORK-MIB";
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public String getName() {
            return "SnmpAdminString";
        }
    }

    public class SnmpEngineID implements TextualConvention {
        public SnmpEngineID() {
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public MOColumn createColumn(int i2, int i3, MOAccess mOAccess, Variable variable, boolean z) {
            MOColumn mOColumnCreateColumn = NotificationLogMib.this.moFactory.createColumn(i2, i3, mOAccess, variable, z);
            if (mOColumnCreateColumn instanceof MOMutableColumn) {
                ConstraintsImpl constraintsImpl = new ConstraintsImpl();
                constraintsImpl.add(new Constraint(5L, 32L));
                ((MOMutableColumn) mOColumnCreateColumn).addMOValueValidationListener(new ValueConstraintValidator(constraintsImpl));
            }
            return mOColumnCreateColumn;
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public Variable createInitialValue() {
            Variable octetString = new OctetString();
            if (octetString instanceof AssignableFromLong) {
                ((AssignableFromLong) octetString).setValue(5L);
            }
            return octetString;
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public MOScalar createScalar(OID oid, MOAccess mOAccess, Variable variable) {
            MOScalar mOScalarCreateScalar = NotificationLogMib.this.moFactory.createScalar(oid, mOAccess, variable);
            ConstraintsImpl constraintsImpl = new ConstraintsImpl();
            constraintsImpl.add(new Constraint(5L, 32L));
            mOScalarCreateScalar.addMOValueValidationListener(new ValueConstraintValidator(constraintsImpl));
            return mOScalarCreateScalar;
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public String getModuleName() {
            return "SNMP-FRAMEWORK-MIB";
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public String getName() {
            return "SnmpEngineID";
        }
    }

    public class TAddress implements TextualConvention {
        public TAddress() {
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public MOColumn createColumn(int i2, int i3, MOAccess mOAccess, Variable variable, boolean z) {
            MOColumn mOColumnCreateColumn = NotificationLogMib.this.moFactory.createColumn(i2, i3, mOAccess, variable, z);
            if (mOColumnCreateColumn instanceof MOMutableColumn) {
                ConstraintsImpl constraintsImpl = new ConstraintsImpl();
                constraintsImpl.add(new Constraint(1L, 255L));
                ((MOMutableColumn) mOColumnCreateColumn).addMOValueValidationListener(new ValueConstraintValidator(constraintsImpl));
            }
            return mOColumnCreateColumn;
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public Variable createInitialValue() {
            Variable octetString = new OctetString();
            if (octetString instanceof AssignableFromLong) {
                ((AssignableFromLong) octetString).setValue(1L);
            }
            return octetString;
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public MOScalar createScalar(OID oid, MOAccess mOAccess, Variable variable) {
            MOScalar mOScalarCreateScalar = NotificationLogMib.this.moFactory.createScalar(oid, mOAccess, variable);
            ConstraintsImpl constraintsImpl = new ConstraintsImpl();
            constraintsImpl.add(new Constraint(1L, 255L));
            mOScalarCreateScalar.addMOValueValidationListener(new ValueConstraintValidator(constraintsImpl));
            return mOScalarCreateScalar;
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public String getModuleName() {
            return "SNMPv2-TC";
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public String getName() {
            return "TAddress";
        }
    }

    public class TDomain implements TextualConvention {
        public TDomain() {
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public MOColumn createColumn(int i2, int i3, MOAccess mOAccess, Variable variable, boolean z) {
            return NotificationLogMib.this.moFactory.createColumn(i2, i3, mOAccess, variable, z);
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public Variable createInitialValue() {
            return new OID();
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public MOScalar createScalar(OID oid, MOAccess mOAccess, Variable variable) {
            return NotificationLogMib.this.moFactory.createScalar(oid, mOAccess, variable);
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public String getModuleName() {
            return "SNMPv2-TC";
        }

        @Override // org.snmp4j.agent.mo.snmp.tc.TextualConvention
        public String getName() {
            return "TDomain";
        }
    }

    protected NotificationLogMib() {
        this.moFactory = DefaultMOFactory.getInstance();
        this.nextLogIndex = 0L;
        this.addressFactory = new TDomainAddressFactoryImpl();
        this.nlmLogEntries = new ArrayList();
    }

    private boolean addVariable(OID oid, int i2, VariableBinding variableBinding) {
        OID oid2 = new OID(oid);
        oid2.append(i2);
        int i3 = 0;
        Variable[] variableArr = {variableBinding.getOid(), null, null, null, null, null, null, null, null, null, null};
        while (true) {
            int[] iArr = VAR_SYNTAX_LIST;
            if (i3 >= iArr.length) {
                return this.nlmLogVariableEntry.addRow((NlmLogVariableEntryRow) this.nlmLogVariableEntry.createRow(oid2, variableArr));
            }
            if (iArr[i3] == variableBinding.getSyntax()) {
                int i4 = i3 + 1;
                if (i4 == 5) {
                    variableArr[1] = new Integer32(6);
                } else if (i4 != 6) {
                    variableArr[1] = new Integer32(i4);
                } else {
                    variableArr[1] = new Integer32(5);
                }
                variableArr[i3 + 2] = variableBinding.getVariable();
            }
            i3++;
        }
    }

    private boolean checkAccess(OID oid, VariableBinding[] variableBindingArr, NlmConfigLogEntryRow nlmConfigLogEntryRow) {
        if (nlmConfigLogEntryRow.getViewName().length() == 0) {
            return true;
        }
        boolean z = this.vacm.isAccessAllowed(nlmConfigLogEntryRow.getViewName(), oid) == 0;
        for (int i2 = 0; z && i2 < variableBindingArr.length; i2++) {
            if (this.vacm.isAccessAllowed(nlmConfigLogEntryRow.getViewName(), variableBindingArr[i2].getOid()) != 0) {
                z = false;
            }
        }
        if (!z) {
            LOGGER.info("Notification not logged because view '" + nlmConfigLogEntryRow.getViewName() + "' of log entry '" + nlmConfigLogEntryRow.getIndex() + "' has not access");
        }
        return z;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void checkLimits(OctetString octetString) {
        NlmConfigLogEntryRow nlmConfigLogEntryRow;
        UnsignedInteger32 nlmConfigLogEntryLimit;
        NlmStatsLogEntryRow nlmStatsLogEntryRow;
        long value = ((UnsignedInteger32) this.nlmConfigGlobalEntryLimit.getValue()).getValue();
        if (value > 0) {
            deleteLogRows(value, null);
        }
        long value2 = ((UnsignedInteger32) this.nlmConfigGlobalAgeOut.getValue()).getValue();
        if (value2 > 0) {
            ArrayList<OID> arrayList = new ArrayList();
            synchronized (this.nlmLogEntryModel) {
                TimeTicks timeTicks = SNMPv2MIB.getSysUpTime(null).get();
                for (NlmLogEntryRow nlmLogEntryRow : this.nlmLogEntryModel) {
                    if (timeTicks.getValue() - nlmLogEntryRow.getNlmLogTime().getValue() > 6000 * value2 && (nlmStatsLogEntryRow = (NlmStatsLogEntryRow) this.nlmStatsLogEntryModel.getRow(nlmLogEntryRow.getIndex().trim())) != null) {
                        nlmStatsLogEntryRow.getNlmStatsLogNotificationsBumped().increment();
                        arrayList.add(nlmStatsLogEntryRow.getIndex());
                    }
                }
            }
            for (OID oid : arrayList) {
                this.nlmLogEntries.remove(oid);
                this.nlmLogEntry.removeRow(oid);
                ((DefaultMOMutableTableModel) this.nlmLogVariableEntryModel).removeRows(oid, oid.nextPeer());
                ((Counter32) this.nlmStatsGlobalNotificationsBumped.getValue()).increment();
            }
        }
        if (octetString == null || (nlmConfigLogEntryRow = (NlmConfigLogEntryRow) this.nlmConfigLogEntry.getModel().getRow(octetString.toSubIndex(false))) == null || (nlmConfigLogEntryLimit = nlmConfigLogEntryRow.getNlmConfigLogEntryLimit()) == null) {
            return;
        }
        long value3 = nlmConfigLogEntryLimit.getValue();
        if (value3 > 0) {
            deleteLogRows(value3, octetString);
        }
    }

    private void createNlmConfigLogEntry(MOFactory mOFactory) {
        MOTableSubIndex[] mOTableSubIndexArr = {mOFactory.createSubIndex(oidNlmLogName, 4, 0, 32)};
        this.nlmConfigLogEntryIndexes = mOTableSubIndexArr;
        this.nlmConfigLogEntryIndex = mOFactory.createIndex(mOTableSubIndexArr, false);
        ConstraintsImpl constraintsImpl = new ConstraintsImpl();
        constraintsImpl.add(new Constraint(0L, 32L));
        ((MOMutableColumn) mOColumnArr[0]).addMOValueValidationListener(new ValueConstraintValidator(constraintsImpl));
        ((MOMutableColumn) mOColumnArr[0]).addMOValueValidationListener(new NlmConfigLogFilterNameValidator());
        ((MOMutableColumn) mOColumnArr[2]).addMOValueValidationListener(new ValueConstraintValidator(new EnumerationConstraint(new int[]{1, 2})));
        ((MOMutableColumn) mOColumnArr[4]).addMOValueValidationListener(new ValueConstraintValidator(new EnumerationConstraint(new int[]{1, 2, 3, 4, 5})));
        MOColumn[] mOColumnArr = {new MOMutableColumn(2, 4, mOFactory.createAccess(15), new OctetString(new byte[0])), new MOMutableColumn(3, 66, mOFactory.createAccess(15), new UnsignedInteger32(0)), new Enumerated(4, 2, mOFactory.createAccess(15), new Integer32(1)), mOFactory.createColumn(5, 2, mOFactory.createAccess(9)), new StorageType(6, mOFactory.createAccess(15), null), new RowStatus(7)};
        ((MOMutableColumn) mOColumnArr[5]).addMOValueValidationListener(new ValueConstraintValidator(new EnumerationConstraint(new int[]{1, 2, 3, 4, 5, 6})));
        MOTableModel<NlmConfigLogEntryRow> mOTableModelCreateTableModel = mOFactory.createTableModel(oidNlmConfigLogEntry, this.nlmConfigLogEntryIndex, mOColumnArr);
        this.nlmConfigLogEntryModel = mOTableModelCreateTableModel;
        ((MOMutableTableModel) mOTableModelCreateTableModel).setRowFactory(new NlmConfigLogEntryRowFactory());
        this.nlmConfigLogEntry = mOFactory.createTable(oidNlmConfigLogEntry, this.nlmConfigLogEntryIndex, mOColumnArr, this.nlmConfigLogEntryModel);
    }

    private void createNlmLogEntry(MOFactory mOFactory) {
        MOTableSubIndex[] mOTableSubIndexArr = {mOFactory.createSubIndex(oidNlmLogName, 4, 0, 32), mOFactory.createSubIndex(oidNlmLogIndex, 2, 1, 1)};
        this.nlmLogEntryIndexes = mOTableSubIndexArr;
        this.nlmLogEntryIndex = mOFactory.createIndex(mOTableSubIndexArr, false);
        MOColumn[] mOColumnArr = {mOFactory.createColumn(2, 67, mOFactory.createAccess(9), "SNMPv2-TC", "TimeStamp"), mOFactory.createColumn(3, 4, mOFactory.createAccess(9), "SNMPv2-TC", "DateAndTime"), mOFactory.createColumn(4, 4, mOFactory.createAccess(9), "SNMP-FRAMEWORK-MIB", "SnmpEngineID"), mOFactory.createColumn(5, 4, mOFactory.createAccess(9), "SNMPv2-TC", "TAddress"), mOFactory.createColumn(6, 6, mOFactory.createAccess(9), "SNMPv2-TC", "TDomain"), mOFactory.createColumn(7, 4, mOFactory.createAccess(9), "SNMP-FRAMEWORK-MIB", "SnmpEngineID"), mOFactory.createColumn(8, 4, mOFactory.createAccess(9), "SNMP-FRAMEWORK-MIB", "SnmpAdminString"), mOFactory.createColumn(9, 6, mOFactory.createAccess(9))};
        MOTableModel<NlmLogEntryRow> mOTableModelCreateTableModel = mOFactory.createTableModel(oidNlmLogEntry, this.nlmLogEntryIndex, mOColumnArr);
        this.nlmLogEntryModel = mOTableModelCreateTableModel;
        ((MOMutableTableModel) mOTableModelCreateTableModel).setRowFactory(new NlmLogEntryRowFactory());
        this.nlmLogEntry = mOFactory.createTable(oidNlmLogEntry, this.nlmLogEntryIndex, mOColumnArr, this.nlmLogEntryModel);
    }

    private void createNlmLogVariableEntry(MOFactory mOFactory) {
        MOTableSubIndex[] mOTableSubIndexArr = {mOFactory.createSubIndex(oidNlmLogName, 4, 0, 32), mOFactory.createSubIndex(oidNlmLogIndex, 2, 1, 1), mOFactory.createSubIndex(oidNlmLogVariableIndex, 2, 1, 1)};
        this.nlmLogVariableEntryIndexes = mOTableSubIndexArr;
        this.nlmLogVariableEntryIndex = mOFactory.createIndex(mOTableSubIndexArr, false);
        MOColumn[] mOColumnArr = {mOFactory.createColumn(2, 6, mOFactory.createAccess(9)), mOFactory.createColumn(3, 2, mOFactory.createAccess(9)), mOFactory.createColumn(4, 65, mOFactory.createAccess(9)), mOFactory.createColumn(5, 66, mOFactory.createAccess(9)), mOFactory.createColumn(6, 67, mOFactory.createAccess(9)), mOFactory.createColumn(7, 2, mOFactory.createAccess(9)), mOFactory.createColumn(8, 4, mOFactory.createAccess(9)), mOFactory.createColumn(9, 64, mOFactory.createAccess(9)), mOFactory.createColumn(10, 6, mOFactory.createAccess(9)), mOFactory.createColumn(11, 70, mOFactory.createAccess(9)), mOFactory.createColumn(12, 68, mOFactory.createAccess(9))};
        MOTableModel<NlmLogVariableEntryRow> mOTableModelCreateTableModel = mOFactory.createTableModel(oidNlmLogVariableEntry, this.nlmLogVariableEntryIndex, mOColumnArr);
        this.nlmLogVariableEntryModel = mOTableModelCreateTableModel;
        ((MOMutableTableModel) mOTableModelCreateTableModel).setRowFactory(new NlmLogVariableEntryRowFactory());
        this.nlmLogVariableEntry = mOFactory.createTable(oidNlmLogVariableEntry, this.nlmLogVariableEntryIndex, mOColumnArr, this.nlmLogVariableEntryModel);
    }

    private void createNlmStatsLogEntry(MOFactory mOFactory) {
        MOTableSubIndex[] mOTableSubIndexArr = {mOFactory.createSubIndex(oidNlmLogName, 4, 0, 32)};
        this.nlmStatsLogEntryIndexes = mOTableSubIndexArr;
        this.nlmStatsLogEntryIndex = mOFactory.createIndex(mOTableSubIndexArr, false);
        MOColumn[] mOColumnArr = {mOFactory.createColumn(1, 65, mOFactory.createAccess(9)), mOFactory.createColumn(2, 65, mOFactory.createAccess(9))};
        MOTableModel<NlmStatsLogEntryRow> mOTableModelCreateTableModel = mOFactory.createTableModel(oidNlmStatsLogEntry, this.nlmStatsLogEntryIndex, mOColumnArr);
        this.nlmStatsLogEntryModel = mOTableModelCreateTableModel;
        ((MOMutableTableModel) mOTableModelCreateTableModel).setRowFactory(new NlmStatsLogEntryRowFactory());
        this.nlmStatsLogEntry = mOFactory.createTable(oidNlmStatsLogEntry, this.nlmStatsLogEntryIndex, mOColumnArr, this.nlmStatsLogEntryModel);
    }

    private void deleteLogRows(long j2, OctetString octetString) {
        NlmStatsLogEntryRow nlmStatsLogEntryRow;
        long rowCount = ((long) this.nlmLogEntry.getModel().getRowCount()) - j2;
        if (rowCount > 0) {
            synchronized (this.nlmLogEntries) {
                for (int i2 = 0; i2 < rowCount; i2++) {
                    if (this.nlmLogEntries.size() <= 0) {
                        break;
                    }
                    OID oidRemove = this.nlmLogEntries.remove(0);
                    if (oidRemove != null) {
                        this.nlmLogEntry.removeRow(oidRemove);
                        ((DefaultMOMutableTableModel) this.nlmLogVariableEntryModel).removeRows(oidRemove, oidRemove.nextPeer());
                        NlmStatsLogEntryRow nlmStatsLogEntryRow2 = (NlmStatsLogEntryRow) this.nlmStatsLogEntryModel.getRow(oidRemove.trim());
                        if (nlmStatsLogEntryRow2 != null) {
                            nlmStatsLogEntryRow2.getNlmStatsLogNotificationsBumped().increment();
                        }
                        ((Counter32) this.nlmStatsGlobalNotificationsBumped.getValue()).increment();
                        if (octetString != null && (nlmStatsLogEntryRow = (NlmStatsLogEntryRow) this.nlmStatsLogEntry.getModel().getRow(octetString.toSubIndex(false))) != null) {
                            nlmStatsLogEntryRow.getNlmStatsLogNotificationsBumped().increment();
                        }
                    }
                }
            }
        }
    }

    public void addImportedTCsToFactory(MOFactory mOFactory) {
        mOFactory.addTextualConvention(new SnmpAdminString());
        mOFactory.addTextualConvention(new TAddress());
        mOFactory.addTextualConvention(new TDomain());
        mOFactory.addTextualConvention(new SnmpEngineID());
    }

    protected void addTCsToFactory(MOFactory mOFactory) {
    }

    protected void createMO(MOFactory mOFactory) {
        addTCsToFactory(mOFactory);
        this.nlmConfigGlobalEntryLimit = new NlmConfigGlobalEntryLimit(oidNlmConfigGlobalEntryLimit, mOFactory.createAccess(11));
        this.nlmConfigGlobalAgeOut = new NlmConfigGlobalAgeOut(oidNlmConfigGlobalAgeOut, mOFactory.createAccess(11));
        this.nlmStatsGlobalNotificationsLogged = mOFactory.createScalar(oidNlmStatsGlobalNotificationsLogged, mOFactory.createAccess(9), new Counter32());
        this.nlmStatsGlobalNotificationsBumped = mOFactory.createScalar(oidNlmStatsGlobalNotificationsBumped, mOFactory.createAccess(9), new Counter32());
        MOScalar<Integer32> mOScalarCreateScalar = mOFactory.createScalar(oidSnmp4jNotificationLogMode, mOFactory.createAccess(11), new Integer32(1));
        this.snmp4jNotificationLogMode = mOScalarCreateScalar;
        mOScalarCreateScalar.addMOValueValidationListener(new ValueConstraintValidator(new EnumerationConstraint(new int[]{1, 2})));
        createNlmConfigLogEntry(mOFactory);
        createNlmStatsLogEntry(mOFactory);
        createNlmLogEntry(mOFactory);
        createNlmLogVariableEntry(mOFactory);
    }

    public int getLogMode() {
        return ((Integer32) this.snmp4jNotificationLogMode.getValue()).toInt();
    }

    public MOScalar<UnsignedInteger32> getNlmConfigGlobalAgeOut() {
        return this.nlmConfigGlobalAgeOut;
    }

    public MOScalar<UnsignedInteger32> getNlmConfigGlobalEntryLimit() {
        return this.nlmConfigGlobalEntryLimit;
    }

    public MOTable<NlmConfigLogEntryRow, MOColumn, MOTableModel<NlmConfigLogEntryRow>> getNlmConfigLogEntry() {
        return this.nlmConfigLogEntry;
    }

    public MOTable getNlmLogEntry() {
        return this.nlmLogEntry;
    }

    public MOTable getNlmLogVariableEntry() {
        return this.nlmLogVariableEntry;
    }

    public MOScalar<Counter32> getNlmStatsGlobalNotificationsBumped() {
        return this.nlmStatsGlobalNotificationsBumped;
    }

    public MOScalar<Counter32> getNlmStatsGlobalNotificationsLogged() {
        return this.nlmStatsGlobalNotificationsLogged;
    }

    public MOTable getNlmStatsLogEntry() {
        return this.nlmStatsLogEntry;
    }

    @Override // org.snmp4j.agent.mo.snmp.NotificationLogListener
    public void notificationLogEvent(NotificationLogEvent notificationLogEvent) {
        if (notificationLogEvent.isSubEvent() == (getLogMode() == 2)) {
            Integer32 integer32 = new Integer32(1);
            synchronized (this.nlmConfigLogEntryModel) {
                for (NlmConfigLogEntryRow nlmConfigLogEntryRow : this.nlmConfigLogEntryModel) {
                    if (integer32.equals(nlmConfigLogEntryRow.getNlmConfigLogAdminStatus())) {
                        OctetString octetString = new OctetString();
                        octetString.fromSubIndex(nlmConfigLogEntryRow.getIndex(), false);
                        OctetString nlmConfigLogFilterName = nlmConfigLogEntryRow.getNlmConfigLogFilterName();
                        if (nlmConfigLogFilterName != null && (octetString.length() == 0 || checkAccess(notificationLogEvent.getNotificationID(), notificationLogEvent.getVariables(), nlmConfigLogEntryRow))) {
                            if (this.snmpNotificationMIB.passesFilter(nlmConfigLogFilterName, notificationLogEvent.getNotificationID(), notificationLogEvent.getVariables())) {
                                if (this.nextLogIndex > Counter32.MAX_COUNTER32_VALUE) {
                                    this.nextLogIndex = 1L;
                                } else {
                                    this.nextLogIndex++;
                                }
                                while (!this.nlmLogEntryModel.isEmpty() && this.nlmLogEntryModel.lastIndex().last() >= this.nextLogIndex) {
                                    this.nextLogIndex++;
                                }
                                OID subIndex = octetString.toSubIndex(false);
                                subIndex.append((int) this.nextLogIndex);
                                OctetString octetString2 = new OctetString();
                                OID oid = new OID();
                                if (notificationLogEvent.getOriginatorTarget() != null) {
                                    Address address = notificationLogEvent.getOriginatorTarget().getAddress();
                                    OctetString address2 = this.addressFactory.getAddress(address);
                                    oid = this.addressFactory.getTransportDomain(address)[0];
                                    octetString2 = address2;
                                }
                                NlmLogEntryRow nlmLogEntryRow = (NlmLogEntryRow) this.nlmLogEntry.createRow(subIndex, new Variable[]{SNMPv2MIB.getSysUpTime(null).get(), DateAndTime.makeDateAndTime(new GregorianCalendar()), notificationLogEvent.getOriginatorEngineID(), octetString2, oid, notificationLogEvent.getContextEngineID(), notificationLogEvent.getContext(), notificationLogEvent.getNotificationID()});
                                if (this.nlmLogEntry.addRow(nlmLogEntryRow)) {
                                    this.nlmLogEntries.add(nlmLogEntryRow.getIndex());
                                }
                                int i2 = 0;
                                while (i2 < notificationLogEvent.getVariables().length) {
                                    int i3 = i2 + 1;
                                    addVariable(subIndex, i3, notificationLogEvent.getVariables()[i2]);
                                    i2 = i3;
                                }
                                synchronized (this.nlmStatsLogEntryModel) {
                                    NlmStatsLogEntryRow nlmStatsLogEntryRow = (NlmStatsLogEntryRow) this.nlmStatsLogEntryModel.getRow(octetString.toSubIndex(false));
                                    if (nlmStatsLogEntryRow != null) {
                                        nlmStatsLogEntryRow.getNlmStatsLogNotificationsLogged().increment();
                                    }
                                }
                                ((Counter32) this.nlmStatsGlobalNotificationsLogged.getValue()).increment();
                                checkLimits(octetString);
                            } else {
                                continue;
                            }
                        }
                    }
                }
            }
        }
    }

    @Override // org.snmp4j.agent.MOGroup
    public void registerMOs(MOServer mOServer, OctetString octetString) throws DuplicateRegistrationException {
        mOServer.register(this.nlmConfigGlobalEntryLimit, octetString);
        mOServer.register(this.nlmConfigGlobalAgeOut, octetString);
        mOServer.register(this.nlmStatsGlobalNotificationsLogged, octetString);
        mOServer.register(this.nlmStatsGlobalNotificationsBumped, octetString);
        mOServer.register(this.nlmConfigLogEntry, octetString);
        mOServer.register(this.nlmStatsLogEntry, octetString);
        mOServer.register(this.nlmLogEntry, octetString);
        mOServer.register(this.nlmLogVariableEntry, octetString);
        mOServer.register(this.snmp4jNotificationLogMode, octetString);
    }

    @Override // org.snmp4j.agent.mo.snmp.RowStatusListener
    public void rowStatusChanged(RowStatusEvent rowStatusEvent) {
        Request request = rowStatusEvent.getRequest().getRequest();
        if (!rowStatusEvent.isRowActivated() || !rowStatusEvent.isDeniable()) {
            if (rowStatusEvent.isRowActivated()) {
                ((NlmConfigLogEntryRow) rowStatusEvent.getRow()).setViewName((OctetString) rowStatusEvent.getRequest().getUserObject());
            }
        } else {
            OctetString viewName = this.vacm.getViewName(request.getContext(), request.getSecurityName(), request.getSecurityModel(), request.getSecurityLevel(), 0);
            if (viewName == null) {
                rowStatusEvent.setDenyReason(16);
            } else {
                rowStatusEvent.getRequest().setUserObject(viewName);
            }
        }
    }

    public void setLogMode(int i2) {
        this.snmp4jNotificationLogMode.setValue(new Integer32(i2));
    }

    @Override // org.snmp4j.agent.MOGroup
    public void unregisterMOs(MOServer mOServer, OctetString octetString) {
        mOServer.unregister(this.nlmConfigGlobalEntryLimit, octetString);
        mOServer.unregister(this.nlmConfigGlobalAgeOut, octetString);
        mOServer.unregister(this.nlmStatsGlobalNotificationsLogged, octetString);
        mOServer.unregister(this.nlmStatsGlobalNotificationsBumped, octetString);
        mOServer.unregister(this.nlmConfigLogEntry, octetString);
        mOServer.unregister(this.nlmStatsLogEntry, octetString);
        mOServer.unregister(this.nlmLogEntry, octetString);
        mOServer.unregister(this.nlmLogVariableEntry, octetString);
        mOServer.unregister(this.snmp4jNotificationLogMode, octetString);
    }

    public NotificationLogMib(MOFactory mOFactory) {
        this.moFactory = DefaultMOFactory.getInstance();
        this.nextLogIndex = 0L;
        this.addressFactory = new TDomainAddressFactoryImpl();
        this.nlmLogEntries = new ArrayList();
        createMO(mOFactory);
        ((DefaultMOTable) this.nlmLogEntry).setVolatile(true);
        ((DefaultMOTable) this.nlmLogVariableEntry).setVolatile(true);
        ((DefaultMOTable) this.nlmStatsLogEntry).setVolatile(true);
    }

    public NotificationLogMib(MOFactory mOFactory, VACM vacm, SnmpNotificationMIB snmpNotificationMIB) {
        this(mOFactory);
        this.vacm = vacm;
        this.snmpNotificationMIB = snmpNotificationMIB;
        MOTableRelation<NlmConfigLogEntryRow, NlmStatsLogEntryRow> mOTableRelation = new MOTableRelation<>(this.nlmConfigLogEntry, this.nlmStatsLogEntry);
        this.nlmStatsLogEntryAugmentation = mOTableRelation;
        mOTableRelation.createRelationShip();
    }
}
