public ClientConnection newClientConnection(ClientCoordinator ccm, int port, int sessionId, long connectionId, int requestPipeIdx, int responsePipeIdx, int hostId, long timeoutNS, int structureId) throws IOException { SSLEngine engine = ccm.isTLS ? ccm.engineFactory.createSSLEngine(ClientCoordinator.registeredDomain(hostId), port) :null; return new ClientConnection(engine, hostId, port, sessionId, requestPipeIdx, responsePipeIdx, connectionId, timeoutNS, structureId); } }
@Override public ServerCoordinator buildServerCoordinator() { finalizeDeclareConnections(); return new ServerCoordinator( getCertificates(), bindHost(), bindPort(), connectionStruct(), requireClientAuth(), serviceName(), defaultHostPath(), buildServerConfig()); }
public static void buildOrderingSupers(GraphManager graphManager, ServerCoordinator coordinator, Pipe<ServerResponseSchema>[][] fromModule, Pipe<HTTPLogResponseSchema>[] log, Pipe<NetPayloadSchema>[][] perTrackFromSuper) { int track = fromModule.length; while (--track>=0) { OrderSupervisorStage wrapSuper = new OrderSupervisorStage(graphManager, fromModule[track], log[track], perTrackFromSuper[track], coordinator);//ensure order coordinator.processNota(graphManager, wrapSuper); } }
private ServerCoordinator coordinator(GraphManager gm) { HTTPServerConfig serverConfig = NetGraphBuilder.serverConfig(9999, gm); serverConfig.setHost("127.0.0.1"); serverConfig.setConcurrentChannelsPerDecryptUnit(4); serverConfig.setConcurrentChannelsPerEncryptUnit(4); ((HTTPServerConfigImpl)serverConfig).finalizeDeclareConnections(); return serverConfig.buildServerCoordinator(); } }
SSLEngine createSSLEngine() { return getService().createSSLEngineServer(); }
private boolean processSelection(SelectionKey selection) { assert isRead(selection) : "only expected read"; final SocketChannel socketChannel = (SocketChannel)selection.channel(); //get the context object so we know what the channel identifier is ConnectionContext connectionContext = (ConnectionContext)selection.attachment(); long channelId = connectionContext.getChannelId(); assert(channelId>=0); //logger.info("\nnew key selection in reader for connection {}",channelId); return processConnection(selection, socketChannel, channelId, coordinator.lookupConnectionById(channelId)); }
@Override public void buildServer(GraphManager gm, ServerCoordinator coordinator, Pipe<ReleaseSchema>[] releaseAfterParse, Pipe<NetPayloadSchema>[] receivedFromNet, Pipe<NetPayloadSchema>[] sendingToNet) { NetGraphBuilder.buildHTTPStages(gm, coordinator, modules, releaseAfterParse, receivedFromNet, sendingToNet); } };
@Override public HTTPServerConfig logTraffic() { logFile = new LogFileConfig(LogFileConfig.defaultPath(), LogFileConfig.DEFAULT_COUNT, LogFileConfig.DEFAULT_SIZE, false); //logging the full response often picks up binary and large data //this should only be turned on with an explicit true return this; }
public SSLEngine createSSLEngine(String host, int port) { return getService().createSSLEngineClient(host, port); }
private boolean writeAll(boolean didWork, int i, Pipe<NetPayloadSchema> pipe, int msgIdx) { //For the close test we must be sending a plain then a disconnect NOT two plains!! //Any sequential Plain or Encrypted values will be rolled together at times on the same connection. if (NetPayloadSchema.MSG_PLAIN_210 == msgIdx) { didWork = writePlain(didWork, i, pipe); } else { didWork = writeAllLessCommon(didWork, i, pipe, msgIdx); } return didWork; }
@Override public HTTPServerConfig useInsecureServer() { configStage.throwIfNot(BridgeConfigStage.DeclareConnections); this.serverTLS = null; return this; }
public void shutdown() { if (null!=ccm) { ccm.shutdown(); } //can be overridden by specific hardware impl if shutdown is supported. }
public static OrderSupervisorStage newInstance(GraphManager graphManager, Pipe<ServerResponseSchema>[] inputPipes, Pipe<HTTPLogResponseSchema> log, //Pipe<AlertNoticeSchema> alerts, //can be null...new pipe schema for alerts Pipe<NetPayloadSchema>[] outgoingPipes, ServerCoordinator coordinator, boolean isTLS) { return new OrderSupervisorStage(graphManager, inputPipes, log, outgoingPipes, coordinator); }
public static DummyRestStage newInstance(GraphManager graphManager, Pipe<HTTPRequestSchema>[] inputPipes, Pipe<ServerResponseSchema>[] outputs, HTTPSpecification<?,?,?,?> httpSpec) { return new DummyRestStage(graphManager, inputPipes, outputs, httpSpec); }
@Override public void buildServer(GraphManager gm, ServerCoordinator coordinator, Pipe<ReleaseSchema>[] releaseAfterParse, Pipe<NetPayloadSchema>[] receivedFromNet, Pipe<NetPayloadSchema>[] sendingToNet) { NetGraphBuilder.buildHTTPStages(gm, coordinator, buildModules(output), releaseAfterParse, receivedFromNet, sendingToNet); } });
@Override public HTTPServerConfig logTraffic(boolean logResponse) { logFile = new LogFileConfig(LogFileConfig.defaultPath(), LogFileConfig.DEFAULT_COUNT, LogFileConfig.DEFAULT_SIZE, logResponse); return this; }
@Override public HTTPServerConfig setEncryptionUnitsPerTrack(int value) { configStage.throwIfNot(BridgeConfigStage.DeclareConnections); this.encryptionUnitsPerTrack = value; return this; }
@Override public HTTPServerConfig setTLS(TLSCertificates certificates) { configStage.throwIfNot(BridgeConfigStage.DeclareConnections); assert(null != certificates); this.serverTLS = certificates; return this; }
@Override public HTTPServerConfig setConcurrentChannelsPerEncryptUnit(int value) { configStage.throwIfNot(BridgeConfigStage.DeclareConnections); this.concurrentChannelsPerEncryptUnit = value; return this; }
@Override public HTTPServerConfig setConcurrentChannelsPerDecryptUnit(int value) { configStage.throwIfNot(BridgeConfigStage.DeclareConnections); this.concurrentChannelsPerDecryptUnit = value; return this; }