internal void SendMsgChannelExtendedData(SshChannel channel, SshExtendedDataType dataType, byte[] data) { if (_isDisposed) { throw new ObjectDisposedException(this.GetType().FullName); } // Check if data is too large to send. if (data.Length > Math.Min(channel.MaxPacketSize, channel.WindowSize)) { throw new InvalidOperationException("Data is too large to send in one packet."); } // Create message to send. using (var msgStream = new MemoryStream()) using (var msgWriter = new SshStreamWriter(msgStream)) { msgWriter.Write((byte)SshConnectionMessage.ChannelExtendedData); msgWriter.Write(channel.ClientChannel); msgWriter.Write((uint)dataType); msgWriter.WriteByteString(data); _client.SendPacket <SshConnectionMessage>(msgStream.ToArray()); } }
internal void SendMsgChannelFailure(SshChannel channel) { if (_isDisposed) { throw new ObjectDisposedException(this.GetType().FullName); } // Create message to send. using (var msgStream = new MemoryStream()) using (var msgWriter = new SshStreamWriter(msgStream)) { msgWriter.Write((byte)SshConnectionMessage.ChannelFailure); msgWriter.Write(channel.ClientChannel); _client.SendPacket <SshConnectionMessage>(msgStream.ToArray()); } }
internal void SendMsgChannelRequest(SshChannel channel, string requestType, bool wantReply, byte[] requestData) { if (_isDisposed) { throw new ObjectDisposedException(this.GetType().FullName); } // Create message to send. using (var msgStream = new MemoryStream()) using (var msgWriter = new SshStreamWriter(msgStream)) { msgWriter.Write((byte)SshConnectionMessage.ChannelRequest); msgWriter.Write(channel.ClientChannel); msgWriter.Write(requestType); msgWriter.Write(wantReply); msgWriter.Write(requestData); _client.SendPacket <SshConnectionMessage>(msgStream.ToArray()); } }
internal void SendMsgChannelOpenFailure(SshChannel channel, SshChannelOpenFailureReason reason, string description, string language) { if (_isDisposed) { throw new ObjectDisposedException(this.GetType().FullName); } // Create message to send. using (var msgStream = new MemoryStream()) using (var msgWriter = new SshStreamWriter(msgStream)) { msgWriter.Write((byte)SshConnectionMessage.ChannelOpenFailure); msgWriter.Write(channel.ClientChannel); msgWriter.Write((uint)reason); msgWriter.WriteByteString(Encoding.UTF8.GetBytes(description)); msgWriter.Write(language); _client.SendPacket <SshConnectionMessage>(msgStream.ToArray()); } }
internal void SendMsgChannelOpenConfirmation(SshChannel channel) { if (_isDisposed) { throw new ObjectDisposedException(this.GetType().FullName); } // Create message to send. using (var msgStream = new MemoryStream()) using (var msgWriter = new SshStreamWriter(msgStream)) { msgWriter.Write((byte)SshConnectionMessage.ChannelOpenConfirmation); msgWriter.Write(channel.ClientChannel); msgWriter.Write(channel.ServerChannel); msgWriter.Write(channel.WindowSize); msgWriter.Write(channel.MaxPacketSize); // Write channel-specific data. channel.WriteChannelOpenConfirmationData(); _client.SendPacket <SshConnectionMessage>(msgStream.ToArray()); } }
public ChannelEventArgs(SshChannel channel) : base() { this.Channel = channel; }
public ChannelListChangedEventArgs(SshChannel channel, ChannelListAction action) : base(channel) { this.Action = action; }
internal void SendMsgChannelWindowAdjust(SshChannel channel, uint bytesToAdd) { if (_isDisposed) throw new ObjectDisposedException(this.GetType().FullName); // Create message to send. using (var msgStream = new MemoryStream()) using (var msgWriter = new SshStreamWriter(msgStream)) { msgWriter.Write((byte)SshConnectionMessage.ChannelWindowAdjust); msgWriter.Write(channel.ClientChannel); msgWriter.Write(bytesToAdd); _client.SendPacket<SshConnectionMessage>(msgStream.ToArray()); } }
internal void SendMsgChannelRequest(SshChannel channel, string requestType, bool wantReply, byte[] requestData) { if (_isDisposed) throw new ObjectDisposedException(this.GetType().FullName); // Create message to send. using (var msgStream = new MemoryStream()) using (var msgWriter = new SshStreamWriter(msgStream)) { msgWriter.Write((byte)SshConnectionMessage.ChannelRequest); msgWriter.Write(channel.ClientChannel); msgWriter.Write(requestType); msgWriter.Write(wantReply); msgWriter.Write(requestData); _client.SendPacket<SshConnectionMessage>(msgStream.ToArray()); } }
internal void SendMsgChannelOpenFailure(SshChannel channel, SshChannelOpenFailureReason reason, string description, string language) { if (_isDisposed) throw new ObjectDisposedException(this.GetType().FullName); // Create message to send. using (var msgStream = new MemoryStream()) using (var msgWriter = new SshStreamWriter(msgStream)) { msgWriter.Write((byte)SshConnectionMessage.ChannelOpenFailure); msgWriter.Write(channel.ClientChannel); msgWriter.Write((uint)reason); msgWriter.WriteByteString(Encoding.UTF8.GetBytes(description)); msgWriter.Write(language); _client.SendPacket<SshConnectionMessage>(msgStream.ToArray()); } }
internal void SendMsgChannelOpenConfirmation(SshChannel channel) { if (_isDisposed) throw new ObjectDisposedException(this.GetType().FullName); // Create message to send. using (var msgStream = new MemoryStream()) using (var msgWriter = new SshStreamWriter(msgStream)) { msgWriter.Write((byte)SshConnectionMessage.ChannelOpenConfirmation); msgWriter.Write(channel.ClientChannel); msgWriter.Write(channel.ServerChannel); msgWriter.Write(channel.WindowSize); msgWriter.Write(channel.MaxPacketSize); // Write channel-specific data. channel.WriteChannelOpenConfirmationData(); _client.SendPacket<SshConnectionMessage>(msgStream.ToArray()); } }
internal void SendMsgChannelExtendedData(SshChannel channel, SshExtendedDataType dataType, byte[] data) { if (_isDisposed) throw new ObjectDisposedException(this.GetType().FullName); // Check if data is too large to send. if (data.Length > Math.Min(channel.MaxPacketSize, channel.WindowSize)) throw new InvalidOperationException("Data is too large to send in one packet."); // Create message to send. using (var msgStream = new MemoryStream()) using (var msgWriter = new SshStreamWriter(msgStream)) { msgWriter.Write((byte)SshConnectionMessage.ChannelExtendedData); msgWriter.Write(channel.ClientChannel); msgWriter.Write((uint)dataType); msgWriter.WriteByteString(data); _client.SendPacket<SshConnectionMessage>(msgStream.ToArray()); } }