forked from irods/irods_capability_storage_tiering
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxy_connection.hpp
42 lines (31 loc) · 1.04 KB
/
proxy_connection.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef MAKE_CONNECTION_HPP
#define MAKE_CONNECTION_HPP
#include <irods/rcConnect.h>
namespace irods {
struct proxy_connection {
rErrMsg_t err_msg;
rcComm_t* conn;
auto make(const std::string clientUser = "", const std::string clientZone = "") -> rcComm_t*
{
rodsEnv env{};
_getRodsEnv(env);
conn = _rcConnect(
env.rodsHost,
env.rodsPort,
env.rodsUserName,
env.rodsZone,
!clientUser.empty() ?
clientUser.c_str() :
env.rodsUserName,
!clientZone.empty() ?
clientZone.c_str() :
env.rodsZone,
&err_msg,
0, 0);
clientLogin(conn);
return conn;
} // make
~proxy_connection() { rcDisconnect(conn); }
}; // proxy_connection
}
#endif // MAKE_CONNECTION_HPP