Rearange compression classes into seperate namespace

This commit is contained in:
olegkap_cp
2010-09-15 20:22:07 +00:00
parent 31e8e2f429
commit e436a98242
6 changed files with 23 additions and 21 deletions
@@ -1,11 +1,12 @@
using System.Collections.Generic;
namespace Renci.SshClient.Security
using Renci.SshClient.Security;
namespace Renci.SshClient.Compression
{
internal abstract class Compression : Algorithm
internal abstract class Compressor : Algorithm
{
protected Session Session { get; private set; }
public Compression(Session session)
public Compressor(Session session)
{
this.Session = session;
}
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
namespace Renci.SshClient.Security
namespace Renci.SshClient.Compression
{
internal class CompressionZlib : Compression
internal class Zlib : Compressor
{
private bool _active;
@@ -12,7 +12,7 @@ namespace Renci.SshClient.Security
get { return "zlib"; }
}
public CompressionZlib(Session session)
public Zlib(Session session)
: base(session)
{
session.MessageReceived += Session_MessageReceived;
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
namespace Renci.SshClient.Security
namespace Renci.SshClient.Compression
{
internal class CompressionZlibOpenSsh : Compression
internal class ZlibOpenSsh : Compressor
{
private bool _active;
@@ -12,7 +12,7 @@ namespace Renci.SshClient.Security
get { return "zlib@openssh.org"; }
}
public CompressionZlibOpenSsh(Session session)
public ZlibOpenSsh(Session session)
: base(session)
{
session.MessageReceived += Session_MessageReceived;
@@ -33,7 +33,6 @@ namespace Renci.SshClient.Security
{
return data;
}
throw new NotImplementedException();
//using (var output = new MemoryStream())
@@ -69,7 +69,7 @@
<Compile Include="Security\Cipher.cs" />
<Compile Include="Security\CipherAES.cs" />
<Compile Include="Security\CipherTripleDES.cs" />
<Compile Include="Security\Compression.cs" />
<Compile Include="Compression\Compressor.cs" />
<Compile Include="Channels\ChannelSftp.cs" />
<Compile Include="Common\DataReceivedEventArgs.cs" />
<Compile Include="Common\FtpFileInfo.cs" />
@@ -110,8 +110,8 @@
<Compile Include="Messages\Sftp\StatusMessage.cs" />
<Compile Include="Messages\Sftp\VersionMessage.cs" />
<Compile Include="Messages\Sftp\WriteMessage.cs" />
<Compile Include="Security\CompressionZlib.cs" />
<Compile Include="Security\CompressionZlibOpenSsh.cs" />
<Compile Include="Compression\Zlib.cs" />
<Compile Include="Compression\ZlibOpenSsh.cs" />
<Compile Include="Security\CryptoKey.cs" />
<Compile Include="Security\CryptoPrivateKey.cs" />
<Compile Include="Security\CryptoPrivateKeyDss.cs" />
@@ -5,6 +5,7 @@ using System.Numerics;
using System.Security.Cryptography;
using System.Threading;
using Renci.SshClient.Common;
using Renci.SshClient.Compression;
using Renci.SshClient.Messages;
using Renci.SshClient.Messages.Transport;
@@ -34,9 +35,9 @@ namespace Renci.SshClient.Security
/// </summary>
private Func<IEnumerable<byte>, HMAC> _serverHmacAlgorithm;
private Func<Session, Compression> _compression;
private Func<Session, Compressor> _compression;
private Func<Session, Compression> _decompression;
private Func<Session, Compressor> _decompression;
/// <summary>
/// Gets the key exchange algorithm name.
@@ -97,9 +98,9 @@ namespace Renci.SshClient.Security
/// <value>The server cipher.</value>
public Cipher ServerCipher { get; private set; }
public Compression ServerDecompression { get; private set; }
public Compressor ServerDecompression { get; private set; }
public Compression ClientCompression { get; private set; }
public Compressor ClientCompression { get; private set; }
/// <summary>
/// Gets or sets a value indicating whether key exchange is in progress.
+5 -4
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using Renci.SshClient.Compression;
using Renci.SshClient.Security;
namespace Renci.SshClient
@@ -14,7 +15,7 @@ namespace Renci.SshClient
public static IDictionary<string, Func<IEnumerable<byte>, HMAC>> HmacAlgorithms { get; private set; }
public static IDictionary<string, Func<Session, Compression>> CompressionAlgorithms { get; private set; }
public static IDictionary<string, Func<Session, Compressor>> CompressionAlgorithms { get; private set; }
public static IDictionary<string, Func<CryptoPublicKey>> HostKeyAlgorithms { get; private set; }
@@ -56,11 +57,11 @@ namespace Renci.SshClient
{"password", (session)=> {return new UserAuthenticationPassword(session);}},
};
Settings.CompressionAlgorithms = new Dictionary<string, Func<Session, Compression>>()
Settings.CompressionAlgorithms = new Dictionary<string, Func<Session, Compressor>>()
{
{"none", (session) => { return null;}},
{"zlib", (session) => { return new CompressionZlib(session);}},
{"zlib@openssh.com", (session) => { return new CompressionZlibOpenSsh(session);}},
{"zlib", (session) => { return new Zlib(session);}},
{"zlib@openssh.com", (session) => { return new ZlibOpenSsh(session);}},
};
}