145 lines
5.1 KiB
Java
145 lines
5.1 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* javax.baja.io.net.IClientSocketFactory
|
|
* javax.baja.naming.BHost
|
|
* javax.baja.naming.BIpHost
|
|
* javax.baja.security.crypto.BTlsEnum
|
|
* javax.baja.security.crypto.CertManagerFactory
|
|
* javax.baja.sys.BajaRuntimeException
|
|
* javax.baja.sys.Clock
|
|
* javax.baja.sys.Sys
|
|
* javax.baja.sys.Type
|
|
*/
|
|
package com.tridium.fox.sys;
|
|
|
|
import com.tridium.fox.message.FoxMessage;
|
|
import com.tridium.fox.session.Fox;
|
|
import com.tridium.fox.session.FoxCircuit;
|
|
import com.tridium.fox.session.FoxRequest;
|
|
import com.tridium.fox.session.FoxResponse;
|
|
import com.tridium.fox.session.FoxSession;
|
|
import com.tridium.fox.sys.Acceptor;
|
|
import com.tridium.fox.sys.BFoxConnection;
|
|
import com.tridium.fox.sys.BFoxScheme;
|
|
import com.tridium.fox.sys.BFoxService;
|
|
import com.tridium.fox.sys.BFoxsScheme;
|
|
import com.tridium.fox.sys.NiagaraNetwork;
|
|
import com.tridium.fox.sys.NiagaraStation;
|
|
import java.net.Socket;
|
|
import javax.baja.io.net.IClientSocketFactory;
|
|
import javax.baja.naming.BHost;
|
|
import javax.baja.naming.BIpHost;
|
|
import javax.baja.security.crypto.BTlsEnum;
|
|
import javax.baja.security.crypto.CertManagerFactory;
|
|
import javax.baja.sys.BajaRuntimeException;
|
|
import javax.baja.sys.Clock;
|
|
import javax.baja.sys.Sys;
|
|
import javax.baja.sys.Type;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public class BFoxTunnelServerConnection
|
|
extends BFoxConnection {
|
|
public static final Type TYPE;
|
|
static /* synthetic */ Class class$com$tridium$fox$sys$BFoxTunnelServerConnection;
|
|
|
|
public Type getType() {
|
|
return TYPE;
|
|
}
|
|
|
|
public void initHello(FoxMessage foxMessage) throws Exception {
|
|
}
|
|
|
|
public final void sessionOpened(FoxSession foxSession) {
|
|
Acceptor.acceptTunnel(this);
|
|
this.log.opened(foxSession);
|
|
this.setState("Connected Tunnel [" + foxSession.getId() + ']');
|
|
this.setLastConnectTime(Clock.time());
|
|
}
|
|
|
|
public FoxResponse process(FoxRequest foxRequest) throws Throwable {
|
|
return null;
|
|
}
|
|
|
|
public void circuitOpened(FoxCircuit foxCircuit) throws Throwable {
|
|
}
|
|
|
|
public void sessionClosed(FoxSession foxSession, Throwable throwable) {
|
|
this.log.closed(foxSession, throwable);
|
|
this.setState("Not connected");
|
|
this.setLastDisconnectTime(Clock.time());
|
|
this.setLastDisconnectCause(throwable == null ? "" : throwable.toString());
|
|
}
|
|
|
|
public final boolean isTunnelServerConnection() {
|
|
return true;
|
|
}
|
|
|
|
/*
|
|
* Enabled force condition propagation
|
|
* Lifted jumps to return sites
|
|
*/
|
|
public Socket createTunnelSocket(String string, boolean bl) throws Exception {
|
|
NiagaraStation niagaraStation;
|
|
NiagaraNetwork niagaraNetwork;
|
|
boolean bl2 = bl;
|
|
String string2 = BFoxScheme.parseHost(string);
|
|
int n = bl2 ? BFoxsScheme.parsePort(string) : BFoxScheme.parsePort(string);
|
|
BHost bHost = null;
|
|
if (Fox.onlyTunnelKnownStations || this.fwConnectionType != -1) {
|
|
niagaraNetwork = BFoxService.getNiagaraNetwork();
|
|
if (niagaraNetwork == null) {
|
|
throw new BajaRuntimeException("NiagaraNetwork not found. Cannot create tunnel socket to " + string);
|
|
}
|
|
niagaraStation = niagaraNetwork.getStation(string2);
|
|
if (niagaraStation == null) {
|
|
if (this.fwConnectionType == -1) throw new BajaRuntimeException("NiagaraStation '" + string2 + "' not found. Cannot create tunnel socket to " + string);
|
|
bHost = BHost.getHost((String)string2);
|
|
if (bHost == null) {
|
|
bHost = new BIpHost(string2);
|
|
}
|
|
} else {
|
|
bHost = niagaraStation.getRemoteHost();
|
|
n = niagaraStation.getFoxPort();
|
|
String string3 = niagaraStation.getScheme();
|
|
bl2 = string3.equalsIgnoreCase("foxs");
|
|
}
|
|
} else {
|
|
bHost = BHost.getHost((String)string2);
|
|
if (bHost == null) {
|
|
bHost = new BIpHost(string2);
|
|
BHost.mount((BHost)bHost);
|
|
}
|
|
}
|
|
if (!bl2) return bHost.openSocket(n);
|
|
niagaraNetwork = CertManagerFactory.getInstanceEx();
|
|
niagaraStation = niagaraNetwork.getClientSocketFactory(BTlsEnum.DEFAULT.getTag());
|
|
return bHost.openSocket(n, (IClientSocketFactory)niagaraStation);
|
|
}
|
|
|
|
static /* synthetic */ Class class(String string, boolean bl) {
|
|
try {
|
|
Class<?> clazz = Class.forName(string);
|
|
if (!bl) {
|
|
clazz = clazz.getComponentType();
|
|
}
|
|
return clazz;
|
|
}
|
|
catch (ClassNotFoundException classNotFoundException) {
|
|
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
|
}
|
|
}
|
|
|
|
static {
|
|
Class clazz = class$com$tridium$fox$sys$BFoxTunnelServerConnection;
|
|
if (clazz == null) {
|
|
clazz = class$com$tridium$fox$sys$BFoxTunnelServerConnection = BFoxTunnelServerConnection.class("[Lcom.tridium.fox.sys.BFoxTunnelServerConnection;", false);
|
|
}
|
|
TYPE = Sys.loadType((Class)clazz);
|
|
}
|
|
}
|
|
|