public void Start() { try { logger.Debug("SSHServerDaemon starting..."); NSshServiceConfiguration configuration = NSshServiceConfiguration.LoadFromFile(m_nsshConfigurationFilePath); SetupDependencies(configuration); m_sshService = Dependency.Resolve <ISshService>(); ((NSshService)m_sshService).Start(); } catch (Exception excp) { logger.Error("Exception SSHServerDaemon Start. " + excp.Message); } }
private void SetupDependencies(NSshServiceConfiguration configuration) { Dependency.RegisterInstance <NSshServiceConfiguration>("NSshServiceConfiguration", configuration); Dependency.RegisterSingleton <ISshService, NSshService>("NSshService"); Dependency.RegisterTransient <ISshSession, SshSession>("SshSession"); Dependency.RegisterTransient <ITransportLayerManager, TransportLayerManager>("TransportLayerManager"); Dependency.RegisterTransient <AbstractTransportState, ConnectedState>(TransportLayerState.Connected.ToString()); Dependency.RegisterTransient <AbstractTransportState, VersionsExchangedState>(TransportLayerState.VersionsExchanged.ToString()); Dependency.RegisterTransient <AbstractTransportState, KeysExchangedState>(TransportLayerState.KeysExchanged.ToString()); Dependency.RegisterTransient <AbstractTransportState, AuthenticatedState>(TransportLayerState.Authenticated.ToString()); Dependency.RegisterSingleton <IKeySetupService, KeySetupService>("KeySetupService"); Dependency.RegisterSingleton <ISecureRandom, SecureRandom>("SecureRandom"); Dependency.RegisterSingleton <ICipherFactory, CipherFactory>("CipherFactory"); Dependency.RegisterSingleton <IMacFactory, MacFactory>("MacFactory"); Dependency.RegisterSingleton <IPasswordAuthenticationService, SIPSorcerySSHAuthenticationService>("PasswordAuthenticationService"); Dependency.RegisterTransient <IChannel, Channel>("Channel"); Dependency.RegisterTransient <IChannelConsumer, SIPSorceryChannelConsumer>(ChannelRequestType.PseudoTerminal.ToString()); Dependency.RegisterTransient <IChannelConsumer, SIPSorceryChannelConsumer>(ChannelRequestType.Shell.ToString()); Dependency.RegisterSingleton <IPacketFactory, PacketFactory>("PacketFactory"); // SIPSorcery specific registrations. Dependency.RegisterInstance <CustomerSessionManager>("CustomerSessionManager", m_customerSessionManager); Dependency.RegisterInstance <ISIPMonitorPublisher>("ISIPMonitorPublisher", m_monitorPublisher); }
private void SetupDependencies(NSshServiceConfiguration configuration) { Dependency.RegisterInstance<NSshServiceConfiguration>("NSshServiceConfiguration", configuration); Dependency.RegisterSingleton<ISshService, NSshService>("NSshService"); Dependency.RegisterTransient<ISshSession, SshSession>("SshSession"); Dependency.RegisterTransient<ITransportLayerManager, TransportLayerManager>("TransportLayerManager"); Dependency.RegisterTransient<AbstractTransportState, ConnectedState>(TransportLayerState.Connected.ToString()); Dependency.RegisterTransient<AbstractTransportState, VersionsExchangedState>(TransportLayerState.VersionsExchanged.ToString()); Dependency.RegisterTransient<AbstractTransportState, KeysExchangedState>(TransportLayerState.KeysExchanged.ToString()); Dependency.RegisterTransient<AbstractTransportState, AuthenticatedState>(TransportLayerState.Authenticated.ToString()); Dependency.RegisterSingleton<IKeySetupService, KeySetupService>("KeySetupService"); Dependency.RegisterSingleton<ISecureRandom, SecureRandom>("SecureRandom"); Dependency.RegisterSingleton<ICipherFactory, CipherFactory>("CipherFactory"); Dependency.RegisterSingleton<IMacFactory, MacFactory>("MacFactory"); Dependency.RegisterSingleton<IPasswordAuthenticationService, SIPSorcerySSHAuthenticationService>("PasswordAuthenticationService"); Dependency.RegisterTransient<IChannel, Channel>("Channel"); Dependency.RegisterTransient<IChannelConsumer, SIPSorceryChannelConsumer>(ChannelRequestType.PseudoTerminal.ToString()); Dependency.RegisterTransient<IChannelConsumer, SIPSorceryChannelConsumer>(ChannelRequestType.Shell.ToString()); Dependency.RegisterSingleton<IPacketFactory, PacketFactory>("PacketFactory"); // SIPSorcery specific registrations. Dependency.RegisterInstance<CustomerSessionManager>("CustomerSessionManager", m_customerSessionManager); Dependency.RegisterInstance<ISIPMonitorPublisher>("ISIPMonitorPublisher", m_monitorPublisher); }