Example #1
0
        private readonly object _transmitSync = new object();   // for keeping correct packet order

        internal SSH2Connection(SSHConnectionParameter param, AbstractGranadosSocket strm, ISSHConnectionEventReceiver r, string serverversion, string clientversion)
            : base(param, strm, r) {
            _cInfo = new SSH2ConnectionInfo();
            _cInfo._serverVersionString = serverversion;
            _cInfo._clientVersionString = clientversion;

            _packetReceiver = new SynchronizedPacketReceiver(this);
            _packetBuilder = new SSH2PacketBuilder(_packetReceiver);
        }
Example #2
0
        protected bool _execCmdWaitFlag;  // wait response flag for sending exec command to server

        protected SSHConnection(SSHConnectionParameter param, AbstractGranadosSocket strm, ISSHConnectionEventReceiver receiver) {
            _param = (SSHConnectionParameter)param.Clone();
            _stream = strm;
            _eventReceiver = receiver;
            _channel_collection = new ChannelCollection();
            _autoDisconnect = true;
            _execCmd = null;
            _execCmdWaitFlag = true;
        }
Example #3
0
        private static SSHConnection ConnectMain(SSHConnectionParameter param, ISSHConnectionEventReceiver receiver, VersionExchangeHandler pnh, AbstractGranadosSocket s) {
            DataFragment data = pnh.WaitResponse();
            string sv = pnh.ServerVersion;

            SSHConnection con = null;
            if (param.Protocol == SSHProtocol.SSH1)
                throw new SSHException("SSH1 is not supported");
            else
                con = new SSH2Connection(param, s, receiver, sv, SSHUtil.ClientVersionString(param.Protocol));

            con.TraceReceptionEvent("server version-string", sv.Trim());
            pnh.Close();
            s.SetHandler(con.PacketBuilder);
            con.SendMyVersion(param);

            if (con.Connect() != AuthenticationResult.Failure) {
                return con;
            }
            else {
                s.Close();
                return null;
            }
        }
Example #4
0
 public VersionExchangeHandler(SSHConnectionParameter param, AbstractGranadosSocket socket)
     : base(socket) {
     _param = param;
 }
Example #5
0
 public SynchronizedDataHandler(AbstractGranadosSocket socket) {
     _socket = socket;
     _event = new ManualResetEvent(false);
     _results = new Queue();
 }
Example #6
0
 public VersionExchangeHandler(SSHConnectionParameter param, AbstractGranadosSocket socket)
     : base(socket)
 {
     _param = param;
 }
Example #7
0
 public SynchronizedDataHandler(AbstractGranadosSocket socket)
 {
     _socket  = socket;
     _event   = new ManualResetEvent(false);
     _results = new Queue();
 }