导航菜单

页面标题

页面副标题

050 IP Phone v2.3.0 - c.java 源代码

正在查看: 050 IP Phone v2.3.0 应用的 c.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package i5;

import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.NetworkInterface;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.net.ssl.SSLServerSocketFactory;
import javax.net.ssl.SSLSocketFactory;

public abstract class c implements j {
    private static p7.a h = s5.d.a(c.class);
    private e a;
    private k b;
    private boolean c;
    private String[] d;
    private int e;
    private SSLServerSocketFactory f;
    private SSLSocketFactory g;

    protected c() {
        this(10, 200, -1, 120L);
    }

    public static String v() {
        InetAddress x = x();
        if (x != null) {
            return x.getHostAddress();
        }
        try {
            return InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
            h.f("Failed to get local address", e);
            return "127.0.0.1";
        }
    }

    public static Set<InetAddress> w() {
        HashSet hashSet = new HashSet();
        try {
            try {
                Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
                if (networkInterfaces != null) {
                    while (networkInterfaces.hasMoreElements()) {
                        Enumeration<InetAddress> inetAddresses = networkInterfaces.nextElement().getInetAddresses();
                        while (inetAddresses.hasMoreElements()) {
                            hashSet.add(inetAddresses.nextElement());
                        }
                    }
                }
            } catch (UnknownHostException e) {
                h.f("Failed to get local host address", e);
            }
        } catch (IOException unused) {
            hashSet.add(InetAddress.getLocalHost());
        }
        return hashSet;
    }

    public static InetAddress x() {
        for (InetAddress inetAddress : w()) {
            if (!inetAddress.isLoopbackAddress()) {
                return inetAddress;
            }
        }
        return null;
    }

    public SSLServerSocketFactory A() {
        return this.f;
    }

    public SSLSocketFactory B() {
        return this.g;
    }

    public void C(d dVar) {
        boolean z;
        dVar.close();
        this.a.c(dVar);
        String e = dVar.e();
        int c = dVar.c();
        String a = dVar.a();
        try {
            z = InetAddress.getByName(e).isAnyLocalAddress();
        } catch (UnknownHostException e8) {
            h.f("Failed to get host address, address=\"" + e + "\"", e8);
            z = false;
        }
        for (g gVar : this.b.e()) {
            String hostAddress = gVar.c().getHostAddress();
            int d = gVar.d();
            String a8 = gVar.a();
            if (c == d && a.equals(a8) && (z || (!z && e.equals(hostAddress)))) {
                D(gVar);
            }
        }
    }

    public void D(g gVar) {
        gVar.close();
        this.b.f(gVar);
    }

    public void E(String[] strArr) {
        if (strArr != null) {
            this.d = (String[]) strArr.clone();
        }
    }

    public void F(SSLSocketFactory sSLSocketFactory) {
        this.g = sSLSocketFactory;
    }

    public void G(int i) {
        this.e = i;
    }

    public void d() {
        this.b.i();
    }

    @Override
    public void o(g gVar) {
        if (h.c()) {
            h.a("accepts new connection,transport=[" + gVar.a() + "],local=[" + gVar.c().getHostAddress() + ":" + gVar.d() + "],remote=[" + gVar.i().getHostAddress() + ":" + gVar.h() + "]");
        }
        this.b.c(gVar);
    }

    public d q(String str, int i, String str2) {
        d t;
        if (h.c()) {
            h.a("creating acceptor,address=[" + str + "],port=[" + i + "],transport=[" + str2 + "]");
        }
        if ("UDP".equalsIgnoreCase(str2)) {
            t = x.u(str, i);
        } else if ("TCP".equalsIgnoreCase(str2)) {
            t = s.s(str, i);
        } else {
            if (!"TLS".equalsIgnoreCase(str2)) {
                throw new IllegalArgumentException("Unsupported transport: " + str2);
            }
            SSLServerSocketFactory A = A();
            t = A != null ? u.t(A, str, i) : u.u(this.c, str, i);
        }
        this.a.a(t);
        return t;
    }

    public g r(String str, int i, String str2, int i8, String str3, int i9) {
        g q;
        InetSocketAddress inetSocketAddress = str == null ? new InetSocketAddress(i) : new InetSocketAddress(str, i);
        InetSocketAddress inetSocketAddress2 = str2 == null ? new InetSocketAddress(i8) : new InetSocketAddress(str2, i8);
        if ("UDP".equalsIgnoreCase(str3)) {
            q = y.n(inetSocketAddress, inetSocketAddress2, this.e);
        } else if ("TCP".equalsIgnoreCase(str3)) {
            q = t.r(inetSocketAddress, inetSocketAddress2, i9, this.e);
        } else {
            if (!"TLS".equalsIgnoreCase(str3)) {
                throw new IllegalArgumentException("Unsupported transport: " + str3);
            }
            SSLSocketFactory B = B();
            q = B != null ? v.q(B, this.d, inetSocketAddress, inetSocketAddress2, i9, this.e) : v.r(this.c, this.d, inetSocketAddress, inetSocketAddress2, i9, this.e);
        }
        this.b.c(q);
        return q;
    }

    public List<d> s() {
        return this.a.b();
    }

    public g t(h hVar) {
        return this.b.d(hVar);
    }

    public List<g> u() {
        return this.b.e();
    }

    protected abstract p y();

    public List<Socket> z() {
        return v.p();
    }

    protected c(int i, int i8, int i9, long j) {
        this.c = false;
        this.d = null;
        this.e = -1;
        this.a = new e(this);
        this.b = new k(i, i8, i9, j, y());
    }
}