using System;
using System.Collections.Generic;
using System.Threading;
using Renci.SshNet.Sftp.Responses;
namespace Renci.SshNet.Sftp
{
    internal interface ISftpSession : ISubsystemSession
    {
        /// 
        /// Gets the SFTP protocol version.
        /// 
        /// 
        /// The SFTP protocol version.
        /// 
        uint ProtocolVersion { get; }
        /// 
        /// Gets the remote working directory.
        /// 
        /// 
        /// The remote working directory.
        /// 
        string WorkingDirectory { get; }
        /// 
        /// Changes the current working directory to the specified path.
        /// 
        /// The new working directory.
        void ChangeDirectory(string path);
        /// 
        /// Resolves a given path into an absolute path on the server.
        /// 
        /// The path to resolve.
        /// 
        /// The absolute path.
        /// 
        string GetCanonicalPath(string path);
        /// 
        /// Performs SSH_FXP_FSTAT request.
        /// 
        /// The handle.
        /// 
        /// File attributes
        /// 
        SftpFileAttributes RequestFStat(byte[] handle);
        /// 
        /// Performs SSH_FXP_LSTAT request.
        /// 
        /// The path.
        /// 
        /// File attributes
        /// 
        SftpFileAttributes RequestLStat(string path);
        /// 
        /// Performs SSH_FXP_MKDIR request.
        /// 
        /// The path.
        void RequestMkDir(string path);
        /// 
        /// Performs SSH_FXP_OPEN request
        /// 
        /// The path.
        /// The flags.
        /// if set to true returns null instead of throwing an exception.
        /// File handle.
        byte[] RequestOpen(string path, Flags flags, bool nullOnError = false);
        /// 
        /// Performs SSH_FXP_OPENDIR request
        /// 
        /// The path.
        /// if set to true returns null instead of throwing an exception.
        /// File handle.
        byte[] RequestOpenDir(string path, bool nullOnError = false);
        /// 
        /// Performs posix-rename@openssh.com extended request.
        /// 
        /// The old path.
        /// The new path.
        void RequestPosixRename(string oldPath, string newPath);
        /// 
        /// Performs SSH_FXP_READ request.
        /// 
        /// The handle.
        /// The offset.
        /// The length.
        /// data array; null if EOF
        byte[] RequestRead(byte[] handle, ulong offset, uint length);
        /// 
        /// Performs SSH_FXP_READDIR request
        /// 
        /// The handle.
        /// 
        KeyValuePair[] RequestReadDir(byte[] handle);
        /// 
        /// Performs SSH_FXP_REMOVE request.
        /// 
        /// The path.
        void RequestRemove(string path);
        /// 
        /// Performs SSH_FXP_RENAME request.
        /// 
        /// The old path.
        /// The new path.
        void RequestRename(string oldPath, string newPath);
        /// 
        /// Performs SSH_FXP_RMDIR request.
        /// 
        /// The path.
        void RequestRmDir(string path);
        /// 
        /// Performs SSH_FXP_SETSTAT request.
        /// 
        /// The path.
        /// The attributes.
        void RequestSetStat(string path, SftpFileAttributes attributes);
        /// 
        /// Performs statvfs@openssh.com extended request.
        /// 
        /// The path.
        /// if set to true [null on error].
        /// 
        SftpFileSytemInformation RequestStatVfs(string path, bool nullOnError = false);
        /// 
        /// Performs SSH_FXP_SYMLINK request.
        /// 
        /// The linkpath.
        /// The targetpath.
        void RequestSymLink(string linkpath, string targetpath);
        /// 
        /// Performs SSH_FXP_FSETSTAT request.
        /// 
        /// The handle.
        /// The attributes.
        void RequestFSetStat(byte[] handle, SftpFileAttributes attributes);
        /// 
        /// Performs SSH_FXP_WRITE request.
        /// 
        /// The handle.
        /// The offset.
        /// The data to send.
#if TUNING
        /// The number of bytes of  to send.
#endif
        /// The wait event handle if needed.
        /// The callback to invoke when the write has completed.
        void RequestWrite(byte[] handle,
                          ulong offset,
                          byte[] data,
#if TUNING
                          int length,
#endif
                          AutoResetEvent wait,
                          Action writeCompleted = null);
        /// 
        /// Performs SSH_FXP_CLOSE request.
        /// 
        /// The handle.
        void RequestClose(byte[] handle);
        /// 
        /// Calculates the optimal size of the buffer to read data from the channel.
        /// 
        /// The buffer size configured on the client.
        /// 
        /// The optimal size of the buffer to read data from the channel.
        /// 
        uint CalculateOptimalReadLength(uint bufferSize);
        /// 
        /// Calculates the optimal size of the buffer to write data on the channel.
        /// 
        /// The buffer size configured on the client.
        /// The file handle.
        /// 
        /// The optimal size of the buffer to write data on the channel.
        /// 
        /// 
        /// Currently, we do not take the remote window size into account.
        /// 
        uint CalculateOptimalWriteLength(uint bufferSize, byte[] handle);
    }
}