Tyro/src/network/SFTP.h

44 lines
790 B
C
Raw Normal View History

2015-04-06 15:42:05 -04:00
/*
* File: SFTP.h
* Author: twarren
*
* Created on April 6, 2015, 2:22 PM
*/
#ifndef SFTP_H
#define SFTP_H
2015-04-06 17:27:09 -04:00
#include "../common.h"
2015-04-06 15:42:05 -04:00
#define LIBSSH_STATIC 1
2015-04-06 15:42:05 -04:00
// libssh2 includes
#include <libssh2.h>
#include <libssh2_sftp.h>
// Socket includes
#include <cstring>
#include <sys/socket.h>
#include <netdb.h>
class SFTP {
public:
SFTP(const char *host, const char *user, const char *pass, const char *port="22");
2015-04-06 15:42:05 -04:00
~SFTP();
string getFile(const char *path);
2015-04-06 15:42:05 -04:00
private:
struct addrinfo host_info;
struct addrinfo *host_info_list;
const char *fingerprint;
int sock;
int status;
int rc;
2015-04-06 15:42:05 -04:00
LIBSSH2_SESSION *session;
LIBSSH2_SFTP *sftp_session;
void ssh_connect(const char *host, const char *user, const char *pass, const char *port);
void sftp_connect();
2015-04-06 15:42:05 -04:00
};
#endif /* SFTP_H */