summaryrefslogtreecommitdiff
path: root/src/SocketCore.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/SocketCore.h')
-rw-r--r--src/SocketCore.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/SocketCore.h b/src/SocketCore.h
index 35f0f83f..92bc67e3 100644
--- a/src/SocketCore.h
+++ b/src/SocketCore.h
@@ -55,6 +55,10 @@ class TLSContext;
class TLSSession;
#endif // ENABLE_SSL
+#ifdef HAVE_LIBSSH2
+class SSHSession;
+#endif // HAVE_LIBSSH2
+
class SocketCore {
friend bool operator==(const SocketCore& s1, const SocketCore& s2);
friend bool operator!=(const SocketCore& s1, const SocketCore& s2);
@@ -95,6 +99,12 @@ private:
bool tlsHandshake(TLSContext* tlsctx, const std::string& hostname);
#endif // ENABLE_SSL
+#ifdef HAVE_LIBSSH2
+ std::unique_ptr<SSHSession> sshSession_;
+
+ void sshCheckDirection();
+#endif // HAVE_LIBSSH2
+
void init();
void bind(const struct sockaddr* addr, socklen_t addrlen);
@@ -290,6 +300,22 @@ public:
bool tlsConnect(const std::string& hostname);
#endif // ENABLE_SSL
+#ifdef HAVE_LIBSSH2
+ // Performs SSH handshake
+ bool sshHandshake();
+ // Performs SSH authentication using username and password.
+ bool sshAuthPassword(const std::string& user, const std::string& password);
+ // Starts sftp session and open remote file |path|.
+ bool sshSFTPOpen(const std::string& path);
+ // Closes sftp remote file gracefully
+ bool sshSFTPClose();
+ // Gets total length and modified time for remote file currently
+ // opened. |path| is used for logging.
+ bool sshSFTPStat(int64_t& totalLength, time_t& mtime,
+ const std::string& path);
+ bool sshGracefulShutdown();
+#endif // HAVE_LIBSSH2
+
bool operator==(const SocketCore& s) {
return sockfd_ == s.sockfd_;
}