irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

rcConnect.h
Go to the documentation of this file.
1 
4 /* rcConnect.h - common header file for client connect
5  */
6 
7 
8 
9 #ifndef RC_CONNECT_H__
10 #define RC_CONNECT_H__
11 
12 #include "rodsDef.h"
13 #include "rodsError.h"
14 #include "rodsLog.h"
15 #include "stringOpr.h"
16 #include "rodsType.h"
17 #include "rodsUser.h"
18 #include "getRodsEnv.h"
19 #include "objInfo.h"
20 #include "dataObjInpOut.h"
21 #include "guiProgressCallback.h"
22 
23 // =-=-=-=-=-=-=-
24 // forard del of thread context
25 struct thread_context;
26 
27 // =-=-=-=-=-=-=-
28 // ssl includes
29 #include <openssl/ssl.h>
30 #include <openssl/x509v3.h>
31 #include <openssl/err.h>
32 
33 /* definition for the reconnFlag */
34 #define NO_RECONN 0 /* no reconnection */
35 #define RECONN_NOTUSED 1 /* this has been deprecated */
36 #define RECONN_TIMEOUT 200
37 
38 #define RECONN_TIMEOUT_TIME 600 /* re-connection timeout time in sec */
39 
40 
41 typedef enum {
42  PROCESSING_STATE, /* the process is not sending nor receiving */
46 }
48 
49 typedef struct reconnMsg {
50  int status;
51  int cookie;
53  int flag;
55 
56 /* one seq per thread */
57 typedef struct dataSeg {
61 
62 typedef enum {
66 
67 typedef enum {
71 
72 typedef struct {
73  char fileName[MAX_NAME_LEN]; /* the local file name to restart */
74  char objPath[MAX_NAME_LEN]; /* the irodsPath */
75  int numSeg; /* number of segments. should equal to num threads */
76  fileRestartStatus_t status; /* restart status */
80 
81 typedef struct {
83  rodsLong_t writtenSinceUpdated; /* bytes trans since last update */
84  char infoFile[MAX_NAME_LEN]; /* file containing restart info */
85  fileRestartInfo_t info; /* must be the last item because of PI */
87 
88 typedef enum {
89  PROC_LOG_NOT_DONE, /* the proc logging in log/proc not done yet */
90  PROC_LOG_DONE /* the proc logging in log/proc is done */
92 
93 /* The client connection handle */
94 
95 typedef struct {
97  char host[NAME_LEN];
98  int sock;
99  int portNum;
100  int loggedIn; /* already logged in ? */
101  struct sockaddr_in localAddr; /* local address */
102  struct sockaddr_in remoteAddr; /* remote address */
105  version_t* svrVersion; /* the server's version */
107  int flag;
109  int apiInx;
110  int status;
113  time_t reconnTime;
114  volatile int exit_flg;
120 
121  int key_size;
124  char encryption_algorithm[ NAME_LEN ];
125  char negotiation_results[ MAX_NAME_LEN ];
126  unsigned char shared_secret[ NAME_LEN ];
127 
128  int ssl_on;
129  SSL_CTX* ssl_ctx;
130  SSL* ssl;
131 
132  // =-=-=-=-=-=-=-
133  // this struct needs to stay at the bottom of
134  // rcComm_t
136 
137 } rcComm_t;
138 
139 typedef struct {
142 } perfStat_t;
143 
144 /* the server connection handle. probably should go somewhere else */
145 typedef struct {
147  int sock;
148  int connectCnt;
149  struct sockaddr_in localAddr; /* local address */
150  struct sockaddr_in remoteAddr; /* remote address */
151  char clientAddr[NAME_LEN]; /* str version of remoteAddr */
154  rodsEnv myEnv; /* the local user */
155  version_t cliVersion; /* the client's version */
156  char option[LONG_NAME_LEN];
160  int apiInx;
161  int status;
168  char *reconnAddr;
169  int cookie;
170 
172 
177  char* auth_scheme;
178 
179  int ssl_on;
180  SSL_CTX *ssl_ctx;
181  SSL *ssl;
184 
185  char negotiation_results[ MAX_NAME_LEN ];
186  unsigned char shared_secret[ NAME_LEN ];
187 
188  int key_size;
191  char encryption_algorithm[ NAME_LEN ];
192 
193 } rsComm_t;
194 
195 #ifdef __cplusplus
196 extern "C" {
197 #endif
198 
199 rcComm_t *
200 rcConnect( const char *rodsHost, int rodsPort, const char *userName, const char *rodsZone,
201  int reconnFlag, rErrMsg_t *errMsg );
202 
203 rcComm_t *
204 _rcConnect( const char *rodsHost, int rodsPort,
205  const char *proxyUserName, const char *proxyRodsZone,
206  const char *clientUserName, const char *clientRodsZone, rErrMsg_t *errMsg, int connectCnt,
207  int reconnFlag );
208 
209 int
211  const char *proxyUserName, const char *proxyRodsZone,
212  const char *clientUserName, const char *clientRodsZone,
213  userInfo_t *clientUser, userInfo_t *proxyUser );
214 
215 int
216 setRhostInfo( rcComm_t *conn, const char *rodsHost, int rodsPort );
217 int
218 setSockAddr( struct sockaddr_in *remoteAddr, const char *rodsHost, int rodsPort );
219 
220 int setAuthInfo( char *rodsAuthScheme,
221  char *authStr, char *rodsServerDn,
222  userInfo_t *clientUser, userInfo_t *proxyUser, int flag );
223 
224 int
225 rcDisconnect( rcComm_t *conn );
226 int
227 freeRcComm( rcComm_t *conn );
228 int
229 cleanRcComm( rcComm_t *conn );
230 /* XXXX putting clientLogin here for now. Should be in clientLogin.h */
231 #ifdef __cplusplus
232 int
233 clientLogin( rcComm_t *conn, const char* _context = 0, const char* _scheme_override = 0 );
234 #else
235 int
236 clientLogin( rcComm_t *conn, const char* _context, const char* _scheme_override );
237 #endif
238 int
239 clientLoginPam( rcComm_t *conn, char *password, int ttl );
240 int
241 clientLoginTTL( rcComm_t *conn, int ttl );
242 
243 char *
245 
246 int
247 clientLoginWithPassword( rcComm_t *conn, char* password );
248 rcComm_t *
249 rcConnectXmsg( rodsEnv *myRodsEnv, rErrMsg_t *errMsg );
250 void
251 cliReconnManager( rcComm_t *conn );
252 int
254 int
256 int
258 int
260 int
261 isLoopbackAddress( const char* ip_address );
262 
263 #ifdef __cplusplus
264 }
265 #endif
266 #endif // RC_CONNECT_H__
procState_t
procState_t
Definition: rcConnect.h:41
rcComm_t
Definition: rcConnect.h:95
fileRestart_t::info
fileRestartInfo_t info
Definition: rcConnect.h:85
rsComm_t
Definition: rcConnect.h:145
transferStat_t
Definition: objInfo.h:291
rcComm_t::reconnTime
time_t reconnTime
Definition: rcConnect.h:113
rcComm_t::agentState
procState_t agentState
Definition: rcConnect.h:116
rErrMsg_t
Definition: rodsError.h:19
freeRcComm
int freeRcComm(rcComm_t *conn)
Definition: rcConnect.cpp:323
rsComm_t::ssl_do_shutdown
int ssl_do_shutdown
Definition: rcConnect.h:183
perfStat_t
Definition: rcConnect.h:139
reconnMsg
Definition: rcConnect.h:49
FILE_RESTART_OFF
@ FILE_RESTART_OFF
Definition: rcConnect.h:63
rsComm_t::irodsProt
irodsProt_t irodsProt
Definition: rcConnect.h:146
userInfo_t
Definition: rodsUser.h:65
SENDING_STATE
@ SENDING_STATE
Definition: rcConnect.h:44
getSessionSignatureClientside
char * getSessionSignatureClientside()
Definition: clientLogin.cpp:44
rcComm_t::exit_flg
volatile int exit_flg
Definition: rcConnect.h:114
rcComm_t::proxyUser
userInfo_t proxyUser
Definition: rcConnect.h:103
rodsUser.h
rsComm_t::auth_scheme
char * auth_scheme
Definition: rcConnect.h:177
rcComm_t::num_hash_rounds
int num_hash_rounds
Definition: rcConnect.h:123
rsComm_t::gsiRequest
int gsiRequest
Definition: rcConnect.h:176
cliChkReconnAtSendStart
int cliChkReconnAtSendStart(rcComm_t *conn)
Definition: rcConnect.cpp:512
fileRestartInfo_t::numSeg
int numSeg
Definition: rcConnect.h:75
rcComm_t::rError
rError_t * rError
Definition: rcConnect.h:106
rcComm_t::ssl_on
int ssl_on
Definition: rcConnect.h:128
rsComm_t::salt_size
int salt_size
Definition: rcConnect.h:189
rsComm_t::windowSize
int windowSize
Definition: rcConnect.h:163
PROC_LOG_DONE
@ PROC_LOG_DONE
Definition: rcConnect.h:90
LONG_NAME_LEN
#define LONG_NAME_LEN
Definition: rodsDef.h:57
guiProgressCallback.h
rsComm_t::num_hash_rounds
int num_hash_rounds
Definition: rcConnect.h:190
rsComm_t::thread_ctx
struct thread_context * thread_ctx
Definition: rcConnect.h:171
cliChkReconnAtSendEnd
int cliChkReconnAtSendEnd(rcComm_t *conn)
Definition: rcConnect.cpp:545
fileRestart_t
Definition: rcConnect.h:81
MAX_NUM_CONFIG_TRAN_THR
#define MAX_NUM_CONFIG_TRAN_THR
Definition: rodsDef.h:96
rsComm_t::reconnectedSock
int reconnectedSock
Definition: rcConnect.h:167
setRhostInfo
int setRhostInfo(rcComm_t *conn, const char *rodsHost, int rodsPort)
Definition: rcConnect.cpp:217
rsComm_t::clientState
procState_t clientState
Definition: rcConnect.h:174
rsComm_t::cookie
int cookie
Definition: rcConnect.h:169
rsComm_t::status
int status
Definition: rcConnect.h:161
dataSeg::len
rodsLong_t len
Definition: rcConnect.h:58
FILE_RESTART_ON
@ FILE_RESTART_ON
Definition: rcConnect.h:64
fileRestartFlag_t
fileRestartFlag_t
Definition: rcConnect.h:62
rcComm_t::reconnThrState
procState_t reconnThrState
Definition: rcConnect.h:118
cleanRcComm
int cleanRcComm(rcComm_t *conn)
Definition: rcConnect.cpp:337
rcComm_t::apiInx
int apiInx
Definition: rcConnect.h:109
rodsError.h
rsComm_t::myEnv
rodsEnv myEnv
Definition: rcConnect.h:154
dataObjInpOut.h
irodsProt_t
irodsProt_t
Definition: rodsDef.h:147
PROCESSING_STATE
@ PROCESSING_STATE
Definition: rcConnect.h:42
clientLoginPam
int clientLoginPam(rcComm_t *conn, char *password, int ttl)
Definition: clientLogin.cpp:97
PROC_LOG_NOT_DONE
@ PROC_LOG_NOT_DONE
Definition: rcConnect.h:89
rsComm_t::reconnSock
int reconnSock
Definition: rcConnect.h:165
rsComm_t::rError
rError_t rError
Definition: rcConnect.h:158
rError_t
Definition: rodsError.h:24
PortalOpr
Definition: dataObjInpOut.h:197
rsComm_t::apiInx
int apiInx
Definition: rcConnect.h:160
RECEIVING_STATE
@ RECEIVING_STATE
Definition: rcConnect.h:43
cliChkReconnAtReadStart
int cliChkReconnAtReadStart(rcComm_t *conn)
Definition: rcConnect.cpp:567
cliChkReconnAtReadEnd
int cliChkReconnAtReadEnd(rcComm_t *conn)
Definition: rcConnect.cpp:585
rsComm_t::proxyUser
userInfo_t proxyUser
Definition: rcConnect.h:152
rodsType.h
rcComm_t::status
int status
Definition: rcConnect.h:110
rcConnect
rcComm_t * rcConnect(const char *rodsHost, int rodsPort, const char *userName, const char *rodsZone, int reconnFlag, rErrMsg_t *errMsg)
Definition: rcConnect.cpp:30
clientLoginTTL
int clientLoginTTL(rcComm_t *conn, int ttl)
Definition: clientLogin.cpp:174
setUserInfo
int setUserInfo(const char *proxyUserName, const char *proxyRodsZone, const char *clientUserName, const char *clientRodsZone, userInfo_t *clientUser, userInfo_t *proxyUser)
Definition: rcConnect.cpp:186
reconnMsg::status
int status
Definition: rcConnect.h:50
reconnMsg_t
struct reconnMsg reconnMsg_t
cliReconnManager
void cliReconnManager(rcComm_t *conn)
Definition: rcConnect.cpp:378
rodsDef.h
rcComm_t::flag
int flag
Definition: rcConnect.h:107
fileRestartInfo_t::fileSize
rodsLong_t fileSize
Definition: rcConnect.h:77
rcComm_t::clientUser
userInfo_t clientUser
Definition: rcConnect.h:104
rsComm_t::reconnFlag
int reconnFlag
Definition: rcConnect.h:164
fileRestartInfo_t::status
fileRestartStatus_t status
Definition: rcConnect.h:76
rsComm_t::ssl
SSL * ssl
Definition: rcConnect.h:181
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: rodsDef.h:61
rsComm_t::ssl_ctx
SSL_CTX * ssl_ctx
Definition: rcConnect.h:180
dataSeg
Definition: rcConnect.h:57
rsComm_t::reconnPort
int reconnPort
Definition: rcConnect.h:166
setAuthInfo
int setAuthInfo(char *rodsAuthScheme, char *authStr, char *rodsServerDn, userInfo_t *clientUser, userInfo_t *proxyUser, int flag)
rsComm_t::reconnAddr
char * reconnAddr
Definition: rcConnect.h:168
CONN_WAIT_STATE
@ CONN_WAIT_STATE
Definition: rcConnect.h:45
dataSeg_t
struct dataSeg dataSeg_t
rcComm_t::ssl
SSL * ssl
Definition: rcConnect.h:130
rsComm_t::reconnThrState
procState_t reconnThrState
Definition: rcConnect.h:175
rsComm_t::perfStat
perfStat_t perfStat
Definition: rcConnect.h:162
rcComm_t::operProgress
operProgress_t operProgress
Definition: rcConnect.h:119
rsComm_t::key_size
int key_size
Definition: rcConnect.h:188
rcComm_t::clientState
procState_t clientState
Definition: rcConnect.h:117
rodsLog.h
perfStat_t::nonOrphanCnt
int nonOrphanCnt
Definition: rcConnect.h:141
OperProgress
Definition: guiProgressCallback.h:7
rcComm_t::ssl_ctx
SSL_CTX * ssl_ctx
Definition: rcConnect.h:129
FILE_NOT_RESTART
@ FILE_NOT_RESTART
Definition: rcConnect.h:68
reconnMsg::cookie
int cookie
Definition: rcConnect.h:51
isLoopbackAddress
int isLoopbackAddress(const char *ip_address)
Definition: rcConnect.cpp:620
rsComm_t::clientUser
userInfo_t clientUser
Definition: rcConnect.h:153
rcComm_t::thread_ctx
struct thread_context * thread_ctx
Definition: rcConnect.h:115
fileRestartInfo_t
Definition: rcConnect.h:72
setSockAddr
int setSockAddr(struct sockaddr_in *remoteAddr, const char *rodsHost, int rodsPort)
Definition: rcConnect.cpp:233
rcComm_t::fileRestart
fileRestart_t fileRestart
Definition: rcConnect.h:135
rsComm_t::portalOpr
portalOpr_t * portalOpr
Definition: rcConnect.h:159
rsComm_t::agentState
procState_t agentState
Definition: rcConnect.h:173
fileRestartStatus_t
fileRestartStatus_t
Definition: rcConnect.h:67
perfStat_t::orphanCnt
int orphanCnt
Definition: rcConnect.h:140
rsComm_t::ssl_on
int ssl_on
Definition: rcConnect.h:179
fileRestart_t::flags
fileRestartFlag_t flags
Definition: rcConnect.h:82
objInfo.h
clientLoginWithPassword
int clientLoginWithPassword(rcComm_t *conn, char *password)
Definition: clientLogin.cpp:348
reconnMsg::procState
procState_t procState
Definition: rcConnect.h:52
procLogFlag_t
procLogFlag_t
Definition: rcConnect.h:88
stringOpr.h
rcComm_t::portNum
int portNum
Definition: rcConnect.h:99
dataSeg::offset
rodsLong_t offset
Definition: rcConnect.h:59
rcDisconnect
int rcDisconnect(rcComm_t *conn)
Definition: rcConnect.cpp:246
rcComm_t::svrVersion
version_t * svrVersion
Definition: rcConnect.h:105
generate_iadmin_commands_for_41_to_42_upgrade.host
host
Definition: generate_iadmin_commands_for_41_to_42_upgrade.py:23
rcComm_t::transStat
transferStat_t transStat
Definition: rcConnect.h:108
rcComm_t::reconnectedSock
int reconnectedSock
Definition: rcConnect.h:112
thread_context
Definition: irods_threads.hpp:10
rcConnectXmsg
rcComm_t * rcConnectXmsg(rodsEnv *myRodsEnv, rErrMsg_t *errMsg)
Definition: rcConnect.cpp:362
_rcConnect
rcComm_t * _rcConnect(const char *rodsHost, int rodsPort, const char *proxyUserName, const char *proxyRodsZone, const char *clientUserName, const char *clientRodsZone, rErrMsg_t *errMsg, int connectCnt, int reconnFlag)
Definition: rcConnect.cpp:54
version_t
Definition: rodsDef.h:286
rcComm_t::irodsProt
irodsProt_t irodsProt
Definition: rcConnect.h:96
rcComm_t::windowSize
int windowSize
Definition: rcConnect.h:111
rsComm_t::cliVersion
version_t cliVersion
Definition: rcConnect.h:155
clientLogin
int clientLogin(rcComm_t *conn, const char *_context, const char *_scheme_override)
Definition: clientLogin.cpp:222
FILE_RESTARTED
@ FILE_RESTARTED
Definition: rcConnect.h:69
rodsEnv
Definition: getRodsEnv.h:8
NAME_LEN
#define NAME_LEN
Definition: rodsDef.h:55
rcComm_t::key_size
int key_size
Definition: rcConnect.h:121
rsComm_t::ssl_do_accept
int ssl_do_accept
Definition: rcConnect.h:182
rsComm_t::sock
int sock
Definition: rcConnect.h:147
rsComm_t::procLogFlag
procLogFlag_t procLogFlag
Definition: rcConnect.h:157
rcComm_t::salt_size
int salt_size
Definition: rcConnect.h:122
reconnMsg::flag
int flag
Definition: rcConnect.h:53
rodsLong_t
long long rodsLong_t
Definition: rodsType.h:32
getRodsEnv.h
rcComm_t::sock
int sock
Definition: rcConnect.h:98
fileRestart_t::writtenSinceUpdated
rodsLong_t writtenSinceUpdated
Definition: rcConnect.h:83