public EndpointContext(FrontEndConnection connection, PacketTransmitter packetTransmitter) { _connection = connection; connection.Disconnected += HandleConnectionDisconnected; _packetTransmitter = packetTransmitter; _packetTransmitter.RequestPacketReceived += OnRequestPacketReceived; }
public ClientContext(FrontEndConnection connection, PacketTransmitter packetTransmitter) : base(connection, packetTransmitter) { _debugClient = new DebugClient (this); _authClient = new AuthenticationClient (this); _tpmClient = new TPMClient (this); RegisterSubsystem (new TPMClientSubsystem (this)); _configured = true; _configuredEvent.Set (); }
/// <summary> /// A new client connected to a listener /// </summary> /// <param name="connection">The connection to the client</param> private void HandleListenerClientConnected(FrontEndConnection connection) { _logger.InfoFormat ("Client {0} connected", connection); ServerContext ctx; lock (_activeContexts) { ctx = EndpointContext.CreateServerEndpointContext (connection, (IConnectionsConfiguration)ConfigurationManager.GetSection("connections"), _accessControlList, _tpmContexts); _activeContexts.Add(ctx); } connection.Disconnected += delegate { lock(_activeContexts) { _logger.InfoFormat("Client {0} disconnected", connection); _activeContexts.Remove(ctx); } }; }
/// <summary> /// Checks if the AuthenticationMechanism is compatible with the specified connection instance /// </summary> /// <param name="connection"></param> /// <returns></returns> public bool IsCompatibleWith(FrontEndConnection connection) { return IsCompatibleWith(connection.GetType()); }
public ServerContext(FrontEndConnection connection, PacketTransmitter packetTransmitter, IConnectionsConfiguration connectionConfig, AccessControlList acl, IDictionary<string, TPMContext> tpmContexts) : base(connection, packetTransmitter) { _accessControlList = acl; _tpmContexts = tpmContexts; RegisterSubsystem (new DebugSubsystem (this, connectionConfig)); RegisterSubsystem (new AuthenticationSubsystem (this, connectionConfig)); RegisterSubsystem (new TPMSubsystem (this, connectionConfig)); _configured = true; _configuredEvent.Set (); }
private void RaiseClientConnectedEvent(FrontEndConnection connection) { if(ClientConnected != null) ClientConnected(connection); }
/// <summary> ///Is called once the client disconnects /// </summary> /// <param name="obj">A <see cref="FrontEndConnection"/></param> protected void HandleConnectionDisconnected(FrontEndConnection obj) { foreach(ISubsystem subsystem in _subsystems.Values) subsystem.Dispose(); _subsystems.Clear(); }
/// <summary> /// Creates a ServerContext for the specified connection /// </summary> public static ServerContext CreateServerEndpointContext(FrontEndConnection connection, IConnectionsConfiguration connectionConfig, AccessControlList acl, IDictionary<string, TPMContext> tpmContexts) { PacketTransmitter packetTransmitter = new PacketTransmitter(connection); ServerContext ctx = new ServerContext(connection, packetTransmitter, connectionConfig, acl, tpmContexts); packetTransmitter.StartTransmitting(); return ctx; }
/// <summary> /// Creates a ClientContext for the specified connection /// </summary> public static ClientContext CreateClientEndpointContext(FrontEndConnection connection) { PacketTransmitter packetTransmitter = new PacketTransmitter(connection); ClientContext ctx = new ClientContext(connection, packetTransmitter); packetTransmitter.StartTransmitting(); return ctx; }
private void OnConnectionEstablished(FrontEndConnection connection) { _receiveThreadWaitEvent.Set(); }
public PacketTransmitter(FrontEndConnection connection) { _connection = connection; _connection.ConnectionEstablished += OnConnectionEstablished; }