DDS  ver. 1.6
SSHTunnel.h
Go to the documentation of this file.
1 //
2 // SSHTunnel.h
3 // PoD
4 //
5 // Created by Anar Manafov on 16.02.11.
6 // Copyright 2011 GSI. All rights reserved.
7 //
8 #ifndef SSHTUNNEL_H
9 #define SSHTUNNEL_H
10 //=============================================================================
11 // API
12 #include <unistd.h>
13 // STD
14 #include <string>
15 //=============================================================================
17 {
18  public:
20  : m_pid(0)
21  , m_needToKill(true)
22  {
23  }
24  ~CSSHTunnel();
25 
26  public:
27  void setPidFile(const std::string& _filename);
28  void create(const std::string& _connectionStr,
29  size_t _localPort,
30  size_t _remotePort,
31  const std::string& _openDomain = "");
32  pid_t pid();
33  // the tunnel will be not closed when object is deleted
34  void deattach()
35  {
36  m_needToKill = false;
37  }
38  void attach()
39  {
40  m_needToKill = true;
41  }
42  void useIdentityFile(const std::string& _filename)
43  {
44  m_IdentityFile = _filename;
45  }
46 
47  private:
48  void killTunnel();
49 
50  private:
51  std::string m_pidFile;
52  pid_t m_pid;
53  bool m_needToKill;
54  std::string m_IdentityFile;
55 };
56 //=============================================================================
57 #endif
void setPidFile(const std::string &_filename)
Definition: SSHTunnel.cpp:28
void create(const std::string &_connectionStr, size_t _localPort, size_t _remotePort, const std::string &_openDomain="")
Definition: SSHTunnel.cpp:69
void useIdentityFile(const std::string &_filename)
Definition: SSHTunnel.h:42
Definition: SSHTunnel.h:16
~CSSHTunnel()
Definition: SSHTunnel.cpp:22
pid_t pid()
Definition: SSHTunnel.cpp:33
void deattach()
Definition: SSHTunnel.h:34
CSSHTunnel()
Definition: SSHTunnel.h:19
void attach()
Definition: SSHTunnel.h:38