3 * This file is part of the KDE project, module kdesu.
4 * Copyright (C) 2000 Geert Jansen <jansen@kde.org>
6 * This is free software; you can use this library under the GNU Library
7 * General Public License, version 2. See the file "COPYING.LIB" for the
8 * exact licensing terms.
11 #ifndef __SSH_h_Included__
12 #define __SSH_h_Included__
16 #include <kdesu/kdesu_export.h>
20 /** \class SshProcess ssh.h kdesu/ssh.h
21 * Executes a remote command, using ssh.
24 class KDESU_EXPORT SshProcess
: public StubProcess
27 explicit SshProcess(const QByteArray
&host
= QByteArray(),
28 const QByteArray
&user
= QByteArray(),
29 const QByteArray
&command
= QByteArray());
32 enum Errors
{ SshNotFound
=1, SshNeedsPassword
, SshIncorrectPassword
};
35 * Sets the target host.
37 void setHost(const QByteArray
&host
);
40 * Sets the localtion of the remote stub.
42 void setStub(const QByteArray
&stub
);
45 * Checks if the current user\@host needs a password.
46 * @return The prompt for the password if a password is required. A null
49 * @todo The return doc is so obviously wrong that the C code needs to be checked.
51 int checkNeedPassword();
54 * Checks if the stub is installed and if the password is correct.
55 * @return Zero if everything is correct, nonzero otherwise.
57 int checkInstall(const char *password
);
60 * Executes the command.
62 int exec(const char *password
, int check
=0);
64 QByteArray
prompt() const;
65 QByteArray
error() const;
68 virtual QByteArray
display();
69 virtual QByteArray
displayAuth();
72 int ConverseSsh(const char *password
, int check
);
75 virtual void virtual_hook( int id
, void* data
);
77 class SshProcessPrivate
;
78 SshProcessPrivate
* const d
;