diff --git a/src/plugins/coreplugin/ssh/sshconnection.cpp b/src/plugins/coreplugin/ssh/sshconnection.cpp index 51f3f20665dc75df556b63e69bd2fa8f20a5da87..97f315db71d5c94ca51b5153cfa7a4087c50d8d7 100644 --- a/src/plugins/coreplugin/ssh/sshconnection.cpp +++ b/src/plugins/coreplugin/ssh/sshconnection.cpp @@ -65,6 +65,31 @@ namespace { staticInitMutex.unlock(); } } +} // anonymous namespace + + +SshConnectionParameters::SshConnectionParameters() : + timeout(0), authType(AuthByKey), port(0) +{ +} + +static inline bool equals(const SshConnectionParameters &p1, const SshConnectionParameters &p2) +{ + return p1.host == p2.host && p1.uname == p2.uname + && p1.authType == p2.authType + && (p1.authType == SshConnectionParameters::AuthByPwd ? + p1.pwd == p2.pwd : p1.privateKeyFile == p2.privateKeyFile) + && p1.timeout == p2.timeout && p1.port == p2.port; +} + +CORE_EXPORT bool operator==(const SshConnectionParameters &p1, const SshConnectionParameters &p2) +{ + return equals(p1, p2); +} + +CORE_EXPORT bool operator!=(const SshConnectionParameters &p1, const SshConnectionParameters &p2) +{ + return !equals(p1, p2); } // TODO: Mechanism for checking the host key. First connection to host: save, later: compare diff --git a/src/plugins/coreplugin/ssh/sshconnection.h b/src/plugins/coreplugin/ssh/sshconnection.h index d863fd50b470e36c5d1d0f22e6ce0899d63b88cf..f57458ea538d0b78610a8b98d1570916effa8215 100644 --- a/src/plugins/coreplugin/ssh/sshconnection.h +++ b/src/plugins/coreplugin/ssh/sshconnection.h @@ -49,6 +49,8 @@ class SshConnectionPrivate; struct CORE_EXPORT SshConnectionParameters { + SshConnectionParameters(); + QString host; QString uname; QString pwd; @@ -57,16 +59,9 @@ struct CORE_EXPORT SshConnectionParameters enum AuthType { AuthByPwd, AuthByKey } authType; quint16 port; }; -CORE_EXPORT inline bool operator==(const SshConnectionParameters &p1, - const SshConnectionParameters &p2) -{ - return p1.host == p2.host && p1.uname == p2.uname - && p1.authType == p2.authType - && (p1.authType == SshConnectionParameters::AuthByPwd ? - p1.pwd == p2.pwd : p1.privateKeyFile == p2.privateKeyFile) - && p1.timeout == p2.timeout && p1.port == p2.port; -} +CORE_EXPORT bool operator==(const SshConnectionParameters &p1, const SshConnectionParameters &p2); +CORE_EXPORT bool operator!=(const SshConnectionParameters &p1, const SshConnectionParameters &p2); /* * This class provides an SSH connection, implementing protocol version 2.0