/* * Copyright (c) 2010, Psiphon Inc. * All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #pragma once #include "libssh2.h" #include using namespace std; struct ssh_credentials { string server_host; int server_port; string username; string password; string ssh_server_fingerprint; }; class SSHSession { public: SSHSession(const ssh_credentials& credentials); virtual ~SSHSession(void); bool Connect(void); bool IsConnected(void); LIBSSH2_SESSION* GetSession(void); void TearDown(void); private: string m_server_host; int m_server_port; string m_username; string m_password; string m_ssh_server_fingerprint; int m_socket; LIBSSH2_SESSION *m_session; bool m_connected; };