package org.snmp4j.agent.mo.snmp;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
import org.snmp4j.agent.DuplicateRegistrationException;
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.MOAccessImpl;
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.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.SnmpTargetMIB;
import org.snmp4j.agent.mo.snmp.tc.SnmpEngineIDTC;
import org.snmp4j.agent.mo.util.RowIndexComparator;
import org.snmp4j.log.LogAdapter;
import org.snmp4j.log.LogFactory;
import org.snmp4j.mp.SnmpConstants;
import org.snmp4j.smi.Address;
import org.snmp4j.smi.Integer32;
import org.snmp4j.smi.OID;
import org.snmp4j.smi.OctetString;
import org.snmp4j.smi.Variable;

/* JADX INFO: loaded from: classes.dex */
public class SnmpCommunityMIB implements MOGroup, CoexistenceInfoProvider {
    public static final int colSnmpCommunityContextEngineID = 4;
    public static final int colSnmpCommunityContextName = 5;
    public static final int colSnmpCommunityName = 2;
    public static final int colSnmpCommunitySecurityName = 3;
    public static final int colSnmpCommunityStatus = 8;
    public static final int colSnmpCommunityStorageType = 7;
    public static final int colSnmpCommunityTransportTag = 6;
    public static final int colSnmpTargetAddrMMS = 2;
    public static final int colSnmpTargetAddrTMask = 1;
    public static final int idxSnmpCommunityContextEngineID = 2;
    public static final int idxSnmpCommunityContextName = 3;
    public static final int idxSnmpCommunityName = 0;
    public static final int idxSnmpCommunitySecurityName = 1;
    public static final int idxSnmpCommunityStatus = 6;
    public static final int idxSnmpCommunityStorageType = 5;
    public static final int idxSnmpCommunityTransportTag = 4;
    public static final int idxSnmpTargetAddrMMS = 1;
    public static final int idxSnmpTargetAddrTMask = 0;
    private static final LogAdapter logger;
    private static MOFactory moFactory = DefaultMOFactory.getInstance();
    public static final OID oidSnmpCommunityEntry = new OID(new int[]{1, 3, 6, 1, 6, 3, 18, 1, 1, 1});
    public static final OID oidSnmpTargetAddrExtEntry;
    private static MOTableIndex snmpCommunityEntryIndex;
    private static MOTableSubIndex[] snmpCommunityEntryIndexes;
    private static MOTableIndex snmpTargetAddrExtEntryIndex;
    private static MOTableSubIndex[] snmpTargetAddrExtEntryIndexes;
    private Map<Variable, SortedSet<SnmpCommunityEntryRow>> coexistenceInfo;
    private Map<Variable, List<SnmpCommunityEntryRow>> communityInfo;
    private MOTable<SnmpCommunityEntryRow, MOColumn, MOMutableTableModel<SnmpCommunityEntryRow>> snmpCommunityEntry;
    private MOMutableTableModel<SnmpCommunityEntryRow> snmpCommunityEntryModel;
    private SnmpEngineIDTC snmpEngineIDTC;
    private MOTableRelation<SnmpTargetMIB.SnmpTargetAddrEntryRow, SnmpTargetAddrExtEntryRow> snmpTargetAddrEntryRelation;
    private MOTable<SnmpTargetAddrExtEntryRow, MOColumn, MOMutableTableModel<SnmpTargetAddrExtEntryRow>> snmpTargetAddrExtEntry;
    private MOMutableTableModel<SnmpTargetAddrExtEntryRow> snmpTargetAddrExtEntryModel;
    private boolean sourceAddressFiltering;
    private SnmpTargetMIB targetMIB;

    static class SnmpCommunityContextEngineIDValidator implements MOValueValidationListener {
        SnmpCommunityContextEngineIDValidator() {
        }

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

    static class SnmpCommunityContextNameValidator implements MOValueValidationListener {
        SnmpCommunityContextNameValidator() {
        }

        @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 class SnmpCommunityEntryRow extends DefaultMOMutableRow2PC {
        public SnmpCommunityEntryRow(OID oid, Variable[] variableArr) {
            super(oid, variableArr);
        }

        public OctetString getSnmpCommunityContextEngineID() {
            return (OctetString) getValue(2);
        }

        public OctetString getSnmpCommunityContextName() {
            return (OctetString) getValue(3);
        }

        public OctetString getSnmpCommunityName() {
            return (OctetString) getValue(0);
        }

        public OctetString getSnmpCommunitySecurityName() {
            return (OctetString) getValue(1);
        }

        public Integer32 getSnmpCommunityStatus() {
            return (Integer32) getValue(6);
        }

        public Integer32 getSnmpCommunityStorageType() {
            return (Integer32) getValue(5);
        }

        public OctetString getSnmpCommunityTransportTag() {
            return (OctetString) getValue(4);
        }

        public void setSnmpCommunityContextEngineID(OctetString octetString) {
            setValue(2, octetString);
        }

        public void setSnmpCommunityContextName(OctetString octetString) {
            setValue(3, octetString);
        }

        public void setSnmpCommunityName(OctetString octetString) {
            setValue(0, octetString);
        }

        public void setSnmpCommunitySecurityName(OctetString octetString) {
            setValue(1, octetString);
        }

        public void setSnmpCommunityStatus(Integer32 integer32) {
            setValue(6, integer32);
        }

        public void setSnmpCommunityStorageType(Integer32 integer32) {
            setValue(5, integer32);
        }

        public void setSnmpCommunityTransportTag(OctetString octetString) {
            setValue(4, octetString);
        }

        @Override // org.snmp4j.agent.mo.DefaultMOMutableRow2PC, org.snmp4j.agent.mo.MOMutableTableRow
        public void setValue(int i2, Variable variable) {
            SortedSet sortedSet;
            if (i2 == 0 && (sortedSet = (SortedSet) SnmpCommunityMIB.this.coexistenceInfo.get(getSnmpCommunityName())) != null) {
                Iterator it = sortedSet.iterator();
                while (true) {
                    if (!it.hasNext()) {
                        break;
                    }
                    SnmpCommunityEntryRow snmpCommunityEntryRow = (SnmpCommunityEntryRow) it.next();
                    if (snmpCommunityEntryRow.getIndex().equals(getIndex())) {
                        sortedSet.remove(snmpCommunityEntryRow);
                        break;
                    }
                }
            }
            super.setValue(i2, variable);
            if (i2 == 0) {
                SortedSet treeSet = (SortedSet) SnmpCommunityMIB.this.coexistenceInfo.get(variable);
                if (treeSet == null) {
                    treeSet = new TreeSet();
                    SnmpCommunityMIB.this.coexistenceInfo.put(this.values[0], treeSet);
                }
                treeSet.add(this);
            }
        }
    }

    class SnmpCommunityEntryRowFactory implements MOTableRowFactory<SnmpCommunityEntryRow> {
        SnmpCommunityEntryRowFactory() {
        }

        @Override // org.snmp4j.agent.mo.MOTableRowFactory
        public synchronized SnmpCommunityEntryRow createRow(OID oid, Variable[] variableArr) throws UnsupportedOperationException {
            SnmpCommunityEntryRow snmpCommunityEntryRow;
            snmpCommunityEntryRow = SnmpCommunityMIB.this.new SnmpCommunityEntryRow(oid, variableArr);
            if (SnmpCommunityMIB.this.coexistenceInfo == null) {
                SnmpCommunityMIB.this.coexistenceInfo = Collections.synchronizedMap(new HashMap());
            }
            SortedSet treeSet = (SortedSet) SnmpCommunityMIB.this.coexistenceInfo.get(variableArr[0]);
            if (treeSet == null) {
                treeSet = new TreeSet(new RowIndexComparator());
                SnmpCommunityMIB.this.coexistenceInfo.put(variableArr[0], treeSet);
            }
            treeSet.add(snmpCommunityEntryRow);
            if (SnmpCommunityMIB.this.communityInfo == null) {
                SnmpCommunityMIB.this.communityInfo = Collections.synchronizedMap(new HashMap());
            }
            List linkedList = (List) SnmpCommunityMIB.this.communityInfo.get(variableArr[1]);
            if (linkedList == null) {
                linkedList = new LinkedList();
                SnmpCommunityMIB.this.communityInfo.put(variableArr[1], linkedList);
            }
            linkedList.add(snmpCommunityEntryRow);
            return snmpCommunityEntryRow;
        }

        @Override // org.snmp4j.agent.mo.MOTableRowFactory
        public synchronized void freeRow(SnmpCommunityEntryRow snmpCommunityEntryRow) {
            SortedSet sortedSet = (SortedSet) SnmpCommunityMIB.this.coexistenceInfo.get(snmpCommunityEntryRow.getValue(0));
            if (sortedSet != null) {
                sortedSet.remove(snmpCommunityEntryRow);
                if (sortedSet.isEmpty()) {
                    SnmpCommunityMIB.this.coexistenceInfo.remove(snmpCommunityEntryRow.getValue(0));
                }
            }
            List list = (List) SnmpCommunityMIB.this.communityInfo.get(snmpCommunityEntryRow.getValue(1));
            if (list != null) {
                list.remove(snmpCommunityEntryRow);
                if (list.size() == 0) {
                    SnmpCommunityMIB.this.communityInfo.remove(snmpCommunityEntryRow.getValue(1));
                }
            }
        }
    }

    static class SnmpCommunitySecurityNameValidator implements MOValueValidationListener {
        SnmpCommunitySecurityNameValidator() {
        }

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

    static class SnmpCommunityTransportTagValidator implements MOValueValidationListener {
        SnmpCommunityTransportTagValidator() {
        }

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

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

        public Integer32 getSnmpTargetAddrMMS() {
            return (Integer32) getValue(1);
        }

        public OctetString getSnmpTargetAddrTMask() {
            return (OctetString) getValue(0);
        }

        public void setSnmpTargetAddrMMS(Integer32 integer32) {
            setValue(1, integer32);
        }

        public void setSnmpTargetAddrTMask(OctetString octetString) {
            setValue(0, octetString);
        }
    }

    class SnmpTargetAddrExtEntryRowFactory implements MOTableRowFactory<SnmpTargetAddrExtEntryRow> {
        SnmpTargetAddrExtEntryRowFactory() {
        }

        @Override // org.snmp4j.agent.mo.MOTableRowFactory
        public void freeRow(SnmpTargetAddrExtEntryRow snmpTargetAddrExtEntryRow) {
        }

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

    static class SnmpTargetAddrMMSValidator implements MOValueValidationListener {
        SnmpTargetAddrMMSValidator() {
        }

        @Override // org.snmp4j.agent.mo.MOValueValidationListener
        public void validate(MOValueValidationEvent mOValueValidationEvent) {
            long value = ((Integer32) mOValueValidationEvent.getNewValue()).getValue();
            if ((value < 0 || value > 0) && value < 484) {
                mOValueValidationEvent.setValidationStatus(10);
            }
        }
    }

    static class SnmpTargetAddrTMaskValidator implements MOValueValidationListener {
        SnmpTargetAddrTMaskValidator() {
        }

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

    static {
        MOTableSubIndex[] mOTableSubIndexArr = {moFactory.createSubIndex(null, 4, 1, 32)};
        snmpCommunityEntryIndexes = mOTableSubIndexArr;
        snmpCommunityEntryIndex = moFactory.createIndex(mOTableSubIndexArr, true);
        oidSnmpTargetAddrExtEntry = new OID(new int[]{1, 3, 6, 1, 6, 3, 18, 1, 2, 1});
        MOTableSubIndex[] mOTableSubIndexArr2 = {moFactory.createSubIndex(null, 4, 1, 32)};
        snmpTargetAddrExtEntryIndexes = mOTableSubIndexArr2;
        snmpTargetAddrExtEntryIndex = moFactory.createIndex(mOTableSubIndexArr2, true);
        logger = LogFactory.getLogger(SnmpCommunityMIB.class);
    }

    public SnmpCommunityMIB(SnmpTargetMIB snmpTargetMIB) {
        this(new OctetString(snmpTargetMIB.getLocalEngineID()));
        this.targetMIB = snmpTargetMIB;
        setBaseTableSnmpTargetAddrEntry(snmpTargetMIB.getSnmpTargetAddrEntry());
    }

    private void createSnmpCommunityEntry() {
        ((MOMutableColumn) mOColumnArr[1]).addMOValueValidationListener(new SnmpCommunitySecurityNameValidator());
        ((MOMutableColumn) mOColumnArr[2]).addMOValueValidationListener(new SnmpCommunityContextEngineIDValidator());
        ((MOMutableColumn) mOColumnArr[3]).addMOValueValidationListener(new SnmpCommunityContextNameValidator());
        ((MOMutableColumn) mOColumnArr[4]).addMOValueValidationListener(new SnmpCommunityTransportTagValidator());
        MOColumn[] mOColumnArr = {new MOMutableColumn(2, 4, MOAccessImpl.ACCESS_READ_CREATE, null, true), new MOMutableColumn(3, 4, MOAccessImpl.ACCESS_READ_CREATE, null, true), this.snmpEngineIDTC.createColumn(4, 4, MOAccessImpl.ACCESS_READ_CREATE, (OctetString) null, true), new MOMutableColumn(5, 4, MOAccessImpl.ACCESS_READ_CREATE, new OctetString(new byte[0]), true), new MOMutableColumn(6, 4, MOAccessImpl.ACCESS_READ_CREATE, new OctetString(new byte[0]), true), new StorageType(7, MOAccessImpl.ACCESS_READ_CREATE, null, true), new RowStatus(8)};
        DefaultMOMutableTableModel defaultMOMutableTableModel = new DefaultMOMutableTableModel();
        this.snmpCommunityEntryModel = defaultMOMutableTableModel;
        defaultMOMutableTableModel.setRowFactory(new SnmpCommunityEntryRowFactory());
        this.snmpCommunityEntry = moFactory.createTable(oidSnmpCommunityEntry, snmpCommunityEntryIndex, mOColumnArr, this.snmpCommunityEntryModel);
    }

    private void createSnmpTargetAddrExtEntry() {
        ((MOMutableColumn) mOColumnArr[0]).addMOValueValidationListener(new SnmpTargetAddrTMaskValidator());
        MOColumn[] mOColumnArr = {new MOMutableColumn(1, 4, MOAccessImpl.ACCESS_READ_CREATE, new OctetString(new byte[0]), true), new MOMutableColumn(2, 2, MOAccessImpl.ACCESS_READ_CREATE, new Integer32(SnmpConstants.MIN_PDU_LENGTH), true)};
        ((MOMutableColumn) mOColumnArr[1]).addMOValueValidationListener(new SnmpTargetAddrMMSValidator());
        DefaultMOMutableTableModel defaultMOMutableTableModel = new DefaultMOMutableTableModel();
        this.snmpTargetAddrExtEntryModel = defaultMOMutableTableModel;
        defaultMOMutableTableModel.setRowFactory(new SnmpTargetAddrExtEntryRowFactory());
        this.snmpTargetAddrExtEntry = moFactory.createTable(oidSnmpTargetAddrExtEntry, snmpTargetAddrExtEntryIndex, mOColumnArr, this.snmpTargetAddrExtEntryModel);
    }

    public void addSnmpCommunityEntry(OctetString octetString, OctetString octetString2, OctetString octetString3, OctetString octetString4, OctetString octetString5, OctetString octetString6, int i2) {
        if (octetString.length() <= 32) {
            MOTable<SnmpCommunityEntryRow, MOColumn, MOMutableTableModel<SnmpCommunityEntryRow>> mOTable = this.snmpCommunityEntry;
            mOTable.addRow(mOTable.createRow(octetString.toSubIndex(true), new Variable[]{octetString2, octetString3, octetString4, octetString5, octetString6, new Integer32(i2), new Integer32(1)}));
        } else {
            throw new IllegalArgumentException("The length of the snmpCommunityIndex (" + octetString.length() + ") exceeds the maximum of 32 bytes");
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // org.snmp4j.agent.mo.snmp.CoexistenceInfoProvider
    public CoexistenceInfo[] getCoexistenceInfo(OctetString octetString) {
        SortedSet<SnmpCommunityEntryRow> sortedSet;
        if (logger.isDebugEnabled()) {
            logger.debug("Looking up coexistence info for '" + octetString + "'");
        }
        Map<Variable, SortedSet<SnmpCommunityEntryRow>> map = this.coexistenceInfo;
        if (map == null || (sortedSet = map.get(octetString)) == null) {
            return null;
        }
        TreeSet<SnmpCommunityEntryRow> treeSet = new TreeSet((SortedSet) sortedSet);
        ArrayList arrayList = new ArrayList(treeSet.size());
        for (SnmpCommunityEntryRow snmpCommunityEntryRow : treeSet) {
            SnmpCommunityEntryRow snmpCommunityEntryRow2 = (SnmpCommunityEntryRow) ((MOMutableTableModel) getSnmpCommunityEntry().getModel()).getRow(snmpCommunityEntryRow.getIndex());
            if (snmpCommunityEntryRow2 != snmpCommunityEntryRow) {
                sortedSet.remove(snmpCommunityEntryRow);
                if (snmpCommunityEntryRow2 != null) {
                    sortedSet.add(snmpCommunityEntryRow2);
                    snmpCommunityEntryRow = snmpCommunityEntryRow2;
                }
            }
            if (snmpCommunityEntryRow.getSnmpCommunityStatus() != null && snmpCommunityEntryRow.getSnmpCommunityStatus().getValue() == 1) {
                CoexistenceInfo coexistenceInfo = new CoexistenceInfo(snmpCommunityEntryRow.getSnmpCommunitySecurityName(), snmpCommunityEntryRow.getSnmpCommunityContextEngineID(), snmpCommunityEntryRow.getSnmpCommunityContextName(), snmpCommunityEntryRow.getSnmpCommunityTransportTag());
                arrayList.add(coexistenceInfo);
                if (logger.isDebugEnabled()) {
                    logger.debug("Found coexistence info for '" + octetString + "'=" + coexistenceInfo);
                }
            }
        }
        return (CoexistenceInfo[]) arrayList.toArray(new CoexistenceInfo[arrayList.size()]);
    }

    @Override // org.snmp4j.agent.mo.snmp.CoexistenceInfoProvider
    public OctetString getCommunity(OctetString octetString, OctetString octetString2, OctetString octetString3) {
        List<SnmpCommunityEntryRow> list;
        Map<Variable, List<SnmpCommunityEntryRow>> map = this.communityInfo;
        if (map != null && (list = map.get(octetString)) != null) {
            for (SnmpCommunityEntryRow snmpCommunityEntryRow : list) {
                if (snmpCommunityEntryRow.getSnmpCommunityStatus().getValue() == 1 && (octetString2 == null || octetString2.equals(snmpCommunityEntryRow.getSnmpCommunityContextEngineID()))) {
                    if (snmpCommunityEntryRow.getSnmpCommunityContextName().equals(octetString3)) {
                        return snmpCommunityEntryRow.getSnmpCommunityName();
                    }
                }
            }
        }
        return null;
    }

    public MOTable<SnmpCommunityEntryRow, MOColumn, MOMutableTableModel<SnmpCommunityEntryRow>> getSnmpCommunityEntry() {
        return this.snmpCommunityEntry;
    }

    public MOTable getSnmpTargetAddrExtEntry() {
        return this.snmpTargetAddrExtEntry;
    }

    public boolean isSourceAddressFiltering() {
        return this.sourceAddressFiltering;
    }

    @Override // org.snmp4j.agent.mo.snmp.CoexistenceInfoProvider
    public boolean passesFilter(Address address, CoexistenceInfo coexistenceInfo) {
        if (!isSourceAddressFiltering()) {
            if (logger.isDebugEnabled()) {
                logger.debug("Address " + address + " passes filter, because source address filtering is disabled");
            }
            return true;
        }
        if (coexistenceInfo.getTransportTag() == null || coexistenceInfo.getTransportTag().length() == 0) {
            if (logger.isDebugEnabled()) {
                logger.debug("Address " + address + " passes filter, because transportTag is null");
            }
            return true;
        }
        for (SnmpTargetMIB.SnmpTargetAddrEntryRow snmpTargetAddrEntryRow : this.targetMIB.getTargetAddrRowsForTag(coexistenceInfo.getTransportTag())) {
            SnmpTargetAddrExtEntryRow row = this.snmpTargetAddrExtEntryModel.getRow(snmpTargetAddrEntryRow.getIndex());
            OctetString octetString = (OctetString) snmpTargetAddrEntryRow.getValue(1);
            if (row != null) {
                OctetString snmpTargetAddrTMask = row.getSnmpTargetAddrTMask();
                OctetString tAddress = snmpTargetAddrEntryRow.getTAddress(address);
                if (snmpTargetAddrTMask.length() == 0 && tAddress != null && tAddress.equals(octetString)) {
                    coexistenceInfo.setMaxMessageSize(row.getSnmpTargetAddrMMS().getValue());
                    return true;
                }
                if (tAddress != null && snmpTargetAddrTMask.length() == tAddress.length() && tAddress.length() == octetString.length() && octetString.mask(snmpTargetAddrTMask).equals(tAddress.mask(snmpTargetAddrTMask))) {
                    coexistenceInfo.setMaxMessageSize(row.getSnmpTargetAddrMMS().getValue());
                    return true;
                }
            }
        }
        return false;
    }

    @Override // org.snmp4j.agent.MOGroup
    public void registerMOs(MOServer mOServer, OctetString octetString) throws DuplicateRegistrationException {
        mOServer.register(this.snmpCommunityEntry, octetString);
        mOServer.register(this.snmpTargetAddrExtEntry, octetString);
    }

    public boolean removeSnmpCommuntiyEntry(OctetString octetString) {
        SnmpCommunityEntryRow snmpCommunityEntryRow = (SnmpCommunityEntryRow) this.snmpCommunityEntry.removeRow(octetString.toSubIndex(true));
        if (snmpCommunityEntryRow == null) {
            return false;
        }
        ((MOMutableTableModel) this.snmpCommunityEntry.getModel()).getRowFactory().freeRow(snmpCommunityEntryRow);
        return true;
    }

    public void setBaseTableSnmpTargetAddrEntry(MOTable<SnmpTargetMIB.SnmpTargetAddrEntryRow, ? extends MOColumn, ? extends MOTableModel<SnmpTargetMIB.SnmpTargetAddrEntryRow>> mOTable) {
        MOTableRelation<SnmpTargetMIB.SnmpTargetAddrEntryRow, SnmpTargetAddrExtEntryRow> mOTableRelationCreateTableRelation = moFactory.createTableRelation(mOTable, this.snmpTargetAddrExtEntry);
        this.snmpTargetAddrEntryRelation = mOTableRelationCreateTableRelation;
        mOTableRelationCreateTableRelation.createRelationShip();
    }

    public void setSourceAddressFiltering(boolean z) {
        this.sourceAddressFiltering = z;
    }

    @Override // org.snmp4j.agent.MOGroup
    public void unregisterMOs(MOServer mOServer, OctetString octetString) {
        mOServer.unregister(this.snmpCommunityEntry, octetString);
        mOServer.unregister(this.snmpTargetAddrExtEntry, octetString);
    }

    private SnmpCommunityMIB(OctetString octetString) {
        this.snmpEngineIDTC = new SnmpEngineIDTC(octetString);
        createSnmpCommunityEntry();
        createSnmpTargetAddrExtEntry();
    }
}
