File indexing completed on 2024-04-21 05:51:27

0001 /*
0002     SPDX-FileCopyrightText: 2007-2008 Robert Knight <robertknight@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef SSHPROCESSINFO_H
0008 #define SSHPROCESSINFO_H
0009 
0010 #include "ProcessInfo.h"
0011 
0012 namespace Konsole
0013 {
0014 /**
0015  * Lightweight class which provides additional information about SSH processes.
0016  */
0017 class KONSOLEPRIVATE_EXPORT SSHProcessInfo
0018 {
0019 public:
0020     /**
0021      * Constructs a new SSHProcessInfo instance which provides additional
0022      * information about the specified SSH process.
0023      *
0024      * @param process A ProcessInfo instance for a SSH process.
0025      */
0026     explicit SSHProcessInfo(const ProcessInfo &process);
0027 
0028     /**
0029      * Returns the user name which the user initially logged into on
0030      * the remote computer.
0031      */
0032     QString userName() const;
0033 
0034     /**
0035      * Returns the host which the user has connected to.
0036      */
0037     QString host() const;
0038 
0039     /**
0040      * Returns the port on host which the user has connected to.
0041      */
0042     QString port() const;
0043 
0044     /**
0045      * Returns the command which the user specified to execute on the
0046      * remote computer when starting the SSH process.
0047      */
0048     QString command() const;
0049 
0050     /**
0051      * Operates in the same way as ProcessInfo::format(), except
0052      * that the set of markers understood is different:
0053      *
0054      * %u - Replaced with user name which the user initially logged
0055      *      into on the remote computer.
0056      * %h - Replaced with the first part of the host name which
0057      *      is connected to.
0058      * %H - Replaced with the full host name of the computer which
0059      *      is connected to.
0060      * %c - Replaced with the command which the user specified
0061      *      to execute when starting the SSH process.
0062      */
0063     QString format(const QString &input) const;
0064 
0065 private:
0066     const ProcessInfo &_process;
0067     QString _user;
0068     QString _host;
0069     QString _port;
0070     QString _command;
0071 };
0072 
0073 }
0074 
0075 #endif