package f1;

import h1.C0506a;
import h1.C0507b;

/* JADX INFO: renamed from: f1.g, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC0470g extends h1.d implements InterfaceC0466c {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    protected int f3926b = -1;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    protected int f3927c = 0;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    protected int f3928d = 0;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    protected int f3929e = 0;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    protected int f3930f = 0;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    protected int f3931g = 0;

    @Override // h1.d
    public void a(C0506a c0506a) throws C0507b {
        c(c0506a);
        int i2 = this.f3926b;
        if (i2 != 12 && i2 != 2 && i2 != 3 && i2 != 13) {
            throw new C0507b("Unexpected ptype: " + this.f3926b);
        }
        if (i2 == 2 || i2 == 3) {
            this.f3930f = c0506a.c();
            c0506a.d();
            c0506a.d();
        }
        int i3 = this.f3926b;
        if (i3 == 3 || i3 == 13) {
            this.f3931g = c0506a.c();
        } else {
            d(c0506a);
        }
    }

    @Override // h1.d
    public void b(C0506a c0506a) {
        int iN = c0506a.n();
        c0506a.a(16);
        int i2 = 0;
        if (this.f3926b == 0) {
            int iN2 = c0506a.n();
            c0506a.h(0);
            c0506a.j(0);
            c0506a.j(g());
            i2 = iN2;
        }
        f(c0506a);
        this.f3928d = c0506a.n() - iN;
        if (this.f3926b == 0) {
            c0506a.q(i2);
            int i3 = this.f3928d - i2;
            this.f3930f = i3;
            c0506a.h(i3);
        }
        c0506a.q(iN);
        e(c0506a);
        c0506a.q(iN + this.f3928d);
    }

    void c(C0506a c0506a) throws C0507b {
        if (c0506a.e() != 5 || c0506a.e() != 0) {
            throw new C0507b("DCERPC version not supported");
        }
        this.f3926b = c0506a.e();
        this.f3927c = c0506a.e();
        if (c0506a.c() != 16) {
            throw new C0507b("Data representation not supported");
        }
        this.f3928d = c0506a.d();
        if (c0506a.d() != 0) {
            throw new C0507b("DCERPC authentication not supported");
        }
        this.f3929e = c0506a.c();
    }

    public abstract void d(C0506a c0506a);

    void e(C0506a c0506a) {
        c0506a.k(5);
        c0506a.k(0);
        c0506a.k(this.f3926b);
        c0506a.k(this.f3927c);
        c0506a.h(16);
        c0506a.j(this.f3928d);
        c0506a.j(0);
        c0506a.h(this.f3929e);
    }

    public abstract void f(C0506a c0506a);

    public abstract int g();

    public C0468e h() {
        if (this.f3931g != 0) {
            return new C0468e(this.f3931g);
        }
        return null;
    }

    public boolean i(int i2) {
        return (this.f3927c & i2) == i2;
    }
}
