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; } }
//attach to an existing channel public SSH2Channel(SSH2Connection con, ChannelType type, int local_id, int remote_id, int maxpacketsize) : base(con, type, local_id) { _connection = con; _windowSize = _leftWindowSize = con.Param.WindowSize; Debug.Assert(type == ChannelType.ForwardedRemoteToLocal || type == ChannelType.AgentForward); _remoteID = remote_id; _serverMaxPacketSize = maxpacketsize; _negotiationStatus = NegotiationStatus.Ready; }
public KeyExchanger(SSH2Connection con, byte[] sessionID) { _connection = con; _param = con.Param; _cInfo = (SSH2ConnectionInfo)con.ConnectionInfo; _sessionID = sessionID; _status = Status.INITIAL; _packet = new SSH2TransmissionPacket(); }
public SSH2Channel(SSH2Connection con, ChannelType type, int local_id, string command) : base(con, type, local_id) { _command = command; if (type == ChannelType.ExecCommand || type == ChannelType.Subsystem) Debug.Assert(command != null); //'command' is required for ChannelType.ExecCommand _connection = con; _windowSize = _leftWindowSize = con.Param.WindowSize; _negotiationStatus = NegotiationStatus.WaitingChannelConfirmation; }
internal CallbackSSH2PacketHandler(SSH2Connection con) { _connection = con; }