ssh.h
00001 /* vi: ts=8 sts=4 sw=4 00002 * 00003 * $Id: ssh.h 433124 2005-07-09 19:01:03Z adridg $ 00004 * 00005 * This file is part of the KDE project, module kdesu. 00006 * Copyright (C) 2000 Geert Jansen <jansen@kde.org> 00007 * 00008 * This is free software; you can use this library under the GNU Library 00009 * General Public License, version 2. See the file "COPYING.LIB" for the 00010 * exact licensing terms. 00011 */ 00012 00013 #ifndef __SSH_h_Included__ 00014 #define __SSH_h_Included__ 00015 00016 #include <qcstring.h> 00017 00018 #include "stub.h" 00019 00020 #include <kdelibs_export.h> 00021 00026 class KDESU_EXPORT SshProcess: public StubProcess 00027 { 00028 public: 00029 SshProcess(const QCString &host=0, const QCString &user=0, const QCString &command=0); 00030 ~SshProcess(); 00031 00032 enum Errors { SshNotFound=1, SshNeedsPassword, SshIncorrectPassword }; 00033 00037 void setHost(const QCString &host) { m_Host = host; } 00038 00042 void setStub(const QCString &stub); 00043 00051 int checkNeedPassword(); 00052 00057 int checkInstall(const char *password); 00058 00062 int exec(const char *password, int check=0); 00063 00064 QCString prompt() { return m_Prompt; } 00065 QCString error() { return m_Error; } 00066 00067 protected: 00068 virtual QCString display(); 00069 virtual QCString displayAuth(); 00070 virtual QCString dcopServer(); 00071 00072 private: 00073 QCString dcopForward(); 00074 int ConverseSsh(const char *password, int check); 00075 00076 int m_dcopPort; 00077 int m_dcopSrv; 00078 QCString m_Prompt; 00079 QCString m_Host; 00080 QCString m_Error; 00081 QCString m_Stub; 00082 00083 protected: 00084 virtual void virtual_hook( int id, void* data ); 00085 private: 00086 class SshProcessPrivate; 00087 SshProcessPrivate *d; 00088 }; 00089 00090 #endif