summaryrefslogtreecommitdiff
path: root/src/SocketCore.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-05-12 00:55:12 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-05-12 00:55:12 +0900
commit89c1916fa57d87ea09142cc3588044c691d1928f (patch)
treeea35f4171e9e5b85e7336688b6089786a9c6701d /src/SocketCore.h
parent4654f1974a5faa832518ba3875ecb3e77224e656 (diff)
parent2758fba10c79a76e07f7cfb894f5cfcbaff85ff7 (diff)
Merge branch 'sftp'
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_;
}