00001 #ifndef _MYSSH_HPP_ 00002 #define _MYSSH_HPP_ 00003 00010 #include <QStringList> 00011 00012 #include <stdio.h> 00013 #include <unistd.h> 00014 #include <stdlib.h> 00015 #include <string.h> 00016 #include <termios.h> 00017 00018 #include <sys/select.h> 00019 #include <sys/time.h> 00020 #include <sys/ioctl.h> 00021 #include <signal.h> 00022 #include <errno.h> 00023 00024 #include <libssh/config.h> 00025 #include <libssh/libssh.h> 00026 00027 #include <fcntl.h> 00028 00029 #ifndef MYSSH_BUFFER_SIZE 00030 #define MYSSH_BUFFER_SIZE 32768 00031 #endif 00032 00036 class Myssh 00037 { 00038 private : 00039 bool connected; 00040 SSH_SESSION *session; 00041 SSH_OPTIONS *options; 00042 00043 bool _isLocked; 00044 void _lock(); 00045 void _unlock(); 00046 QString _getStdOut(); 00047 QString _getStdErr(); 00048 QString _errmsg; 00049 public : 00050 Myssh() {_isLocked = false; connected=false;} 00051 CHANNEL *channel; 00052 00053 int connect_ssh(char *,char *,char *); 00054 void disconnect_ssh(); 00055 void shell(); 00056 int auth_kbdint(); 00057 QString getErrMsg() {return QString(_errmsg);} 00058 QStringList send_cmd(QString); 00059 bool isConnected(){return connected;} 00060 }; 00061 00062 #endif