package org.snmp4j.agent.mo.snmp;

import org.snmp4j.agent.MOAccess;
import org.snmp4j.agent.mo.MOMutableColumn;
import org.snmp4j.agent.mo.MOTable;
import org.snmp4j.agent.mo.MOTableCellInfo;
import org.snmp4j.agent.mo.MOTableRow;
import org.snmp4j.agent.request.SubRequest;
import org.snmp4j.smi.OID;

/* JADX INFO: loaded from: classes.dex */
public class RowPointer extends MOMutableColumn<OID> {
    private MOTable targetTable;

    public RowPointer(int i2, MOAccess mOAccess, OID oid, boolean z, MOTable mOTable) {
        super(i2, 6, mOAccess, oid, z);
        this.targetTable = mOTable;
    }

    public MOTable getTargetTable() {
        return this.targetTable;
    }

    protected void illegalRowPointer(SubRequest subRequest) {
        subRequest.getStatus().setErrorStatus(18);
    }

    @Override // org.snmp4j.agent.mo.MOMutableColumn
    public void prepare(SubRequest subRequest, MOTableRow mOTableRow, MOTableRow mOTableRow2, int i2) {
        super.prepare(subRequest, mOTableRow, null, i2);
        if (subRequest.hasError()) {
            return;
        }
        MOTableCellInfo cellInfo = this.targetTable.getCellInfo((OID) subRequest.getVariableBinding().getVariable());
        if (cellInfo == null || cellInfo.getIndex() == null || cellInfo.getColumn() < 0) {
            illegalRowPointer(subRequest);
        }
    }

    public void setTargetTable(MOTable mOTable) {
        this.targetTable = mOTable;
    }

    public RowPointer(int i2, MOAccess mOAccess, OID oid, boolean z) {
        super(i2, 6, mOAccess, oid, z);
    }
}
