/*
** SellaNMS
** $Id: ssh.h,v 1.3 2005/11/13 23:34:56 sella Exp $
** Copyright (c) 2001-2005 Digital Genesis Software, LLC. All Rights Reserved.
** Released under the GPL Version 2 License.
** http://www.digitalgenesis.com
*/

#ifndef __DGS_COMMON_SSH_H
#define __DGS_COMMON_SSH_H

#ifdef HAVE_CONFIG_H
	#include "config.h"
#endif

#include "defaults.h"
#include <regex.h>
#include <stl/list>
#include <stl/slist>
#include <stl/string>

using namespace std;

class SSH {
	public:
		SSH();
		~SSH();

		bool connect(string hostname, string username, string password, string prompt);	
		bool disconnect();

		bool sendCommand(string const &command);
		bool sendCommand(string const &command, list<string> &result);

	protected:
		bool getReply(string &reply);
		bool getReply(list<string> &reply);

		bool recieve(string &value);
		bool transmit(string &value);

	private:
		int	ptty;

		regex_t	authRegex;
		regex_t	passwordRegex;
		regex_t	yesnoRegex;
		regex_t	shellRegex;
};

#endif

/*
** Local Variables:
** c-basic-offset: 3
** tab-width: 3
** End:
** vim600: fdm=marker
** vim: noet ts=3 sw=3
*/
