1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #ifndef SSHREMOTECOMMAND_H
34 #define SSHREMOTECOMMAND_H
36 #include <utils/utils_global.h>
38 #include <QtCore/QObject>
39 #include <QtCore/QSharedPointer>
47 class SshChannelManager;
48 class SshRemoteProcessPrivate;
49 class SshSendFacility;
50 } // namespace Internal
52 class QTCREATOR_UTILS_EXPORT SshRemoteProcess : public QObject
55 Q_DISABLE_COPY(SshRemoteProcess)
57 friend class Internal::SshChannelManager;
58 friend class Internal::SshRemoteProcessPrivate;
61 typedef QSharedPointer<SshRemoteProcess> Ptr;
62 enum ExitStatus { FailedToStart, KilledBySignal, ExitedNormally };
64 static const QByteArray AbrtSignal;
65 static const QByteArray AlrmSignal;
66 static const QByteArray FpeSignal;
67 static const QByteArray HupSignal;
68 static const QByteArray IllSignal;
69 static const QByteArray IntSignal;
70 static const QByteArray KillSignal;
71 static const QByteArray PipeSignal;
72 static const QByteArray QuitSignal;
73 static const QByteArray SegvSignal;
74 static const QByteArray TermSignal;
75 static const QByteArray Usr1Signal;
76 static const QByteArray Usr2Signal;
81 * Note that this is of limited value in practice, because servers are
82 * usually configured to ignore such requests for security reasons.
84 void addToEnvironment(const QByteArray &var, const QByteArray &value);
89 bool isRunning() const;
90 QString errorString() const;
92 QByteArray exitSignal() const;
94 // Note: This is ignored by the OpenSSH server.
95 void sendSignal(const QByteArray &signal);
96 void kill() { sendSignal(KillSignal); }
98 void sendInput(const QByteArray &data); // Should usually have a trailing newline.
102 void outputAvailable(const QByteArray &output);
103 void errorOutputAvailable(const QByteArray &output);
106 * Parameter is of type ExitStatus, but we use int because of
107 * signal/slot awkwardness (full namespace required).
109 void closed(int exitStatus);
112 SshRemoteProcess(const QByteArray &command, quint32 channelId,
113 Internal::SshSendFacility &sendFacility);
115 Internal::SshRemoteProcessPrivate *d;
120 #endif // SSHREMOTECOMMAND_H