Exiv2
ssh.hpp
1 // ***************************************************************** -*- C++ -*-
2 /*
3  * Copyright (C) 2004-2018 Exiv2 authors
4  * This program is part of the Exiv2 distribution.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
19  */
20 #ifndef SSH_HPP_
21 #define SSH_HPP_
22 
23 // included header files
24 #include "config.h"
25 
26 #ifdef EXV_USE_SSH
27 #include <libssh/libssh.h>
28 #include <libssh/sftp.h>
29 #include <sys/stat.h>
30 #include <string>
31 
32 #include "error.hpp"
33 #include "types.hpp"
34 #include "futils.hpp"
35 
36 namespace Exiv2 {
42  class EXIV2LIB_DEPRECATED_EXPORT SSH {
43  public:
45 
46 
54  SSH (const std::string& host, const std::string& user, const std::string& pass, const std::string port = "");
56  ~SSH();
58 
60 
61 
67  int runCommand(const std::string& cmd, std::string* output);
76  int scp(const std::string& filePath, const byte* data, size_t size);
85  void getFileSftp(const std::string& filePath, sftp_file& handle);
87  private:
91  void openSftp();
92  // DATA
94  long timeout_;
96  std::string host_;
98  std::string user_;
100  std::string pass_;
102  ssh_session session_;
104  sftp_session sftp_;
105  }; // class SSH
106 } // namespace Exiv2
107 #endif
108 
109 #endif // #ifdef EXIV2_HPP_
Basic file utility functions required by Exiv2.
uint8_t byte
1 byte unsigned integer type.
Definition: types.hpp:105
Type definitions for Exiv2 and related functionality.
IPTC string type.
Definition: types.hpp:147
Error class for exceptions, log message class.
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36