Esempio n. 1
0
 public EndpointContext(FrontEndConnection connection, PacketTransmitter packetTransmitter)
 {
     _connection = connection;
     connection.Disconnected += HandleConnectionDisconnected;
     _packetTransmitter = packetTransmitter;
     _packetTransmitter.RequestPacketReceived += OnRequestPacketReceived;
 }
Esempio n. 2
0
        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 ();
        }
Esempio n. 3
0
 /// <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());
 }
Esempio n. 5
0
        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 ();
        }
Esempio n. 6
0
 private void RaiseClientConnectedEvent(FrontEndConnection connection)
 {
     if(ClientConnected != null)
         ClientConnected(connection);
 }
Esempio n. 7
0
 /// <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();
 }
Esempio n. 8
0
 /// <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;
 }
Esempio n. 9
0
 /// <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;
 }
Esempio n. 10
0
 private void OnConnectionEstablished(FrontEndConnection connection)
 {
     _receiveThreadWaitEvent.Set();
 }
Esempio n. 11
0
 public PacketTransmitter(FrontEndConnection connection)
 {
     _connection = connection;
     _connection.ConnectionEstablished += OnConnectionEstablished;
 }