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)  

rodsDef.h
Go to the documentation of this file.
1 
6 
9 /* rodsdef.h - common header file for rods
10  */
11 
12 
13 
14 #ifndef RODS_DEF_H__
15 #define RODS_DEF_H__
16 
17 #include <stdio.h>
18 #include <errno.h>
19 #if defined(solaris_platform)
20 #include <fcntl.h>
21 #endif
22 #include <ctype.h>
23 #include <sys/stat.h>
24 #include <string.h>
25 #include <ctype.h>
26 #include <signal.h>
27 #include <sys/types.h>
28 #include <sys/stat.h>
29 #include <sys/types.h>
30 
31 
32 
33 #if defined(solaris_platform)
34 #include <arpa/inet.h>
35 #endif
36 
37 #ifndef _WIN32
38 #include <sys/socket.h>
39 #include <netinet/in.h>
40 #include <sys/file.h>
41 #include <unistd.h>
42 #include <dirent.h>
43 #include <time.h>
44 #include <sys/param.h>
45 #include <pwd.h>
46 #include <grp.h>
47 #include <netdb.h>
48 #include <netinet/in.h>
49 #include <netinet/tcp.h>
50 #endif
51 
52 
53 #define HEADER_TYPE_LEN 128 /* changed by Raja to 128 from 16 */
54 #define TIME_LEN 32
55 #define NAME_LEN 64
56 #define CHKSUM_LEN 64 /* keep chksum_len the same as the old size */
57 #define LONG_NAME_LEN 256
58 #define MAX_PATH_ALLOWED 1024
59 /* MAX_NAME_LEN actually has space for a few extra characters to match
60  the way it is often used in the code. */
61 #define MAX_NAME_LEN (MAX_PATH_ALLOWED+64)
62 #define HUGE_NAME_LEN 100000
63 
64 /* increase to 20K because the French Lib rules are very long */
65 #define META_STR_LEN (1024*20)
66 
67 #define SHORT_STR_LEN 32 /* for dataMode, perhaps others */
68 
69 #ifndef NULL
70 #define NULL 0
71 #endif
72 
73 #define PTR_ARRAY_MALLOC_LEN 10 /* the len to allocate each time */
74 
75 /* definition for the global variable int ProcessType */
76 
77 #define CLIENT_PT 0 /* client process type */
78 #define SERVER_PT 1 /* server process type */
79 #define AGENT_PT 2 /* agent process type */
80 #define RE_SERVER_PT 3 /* reServer type */
81 #define XMSG_SERVER_PT 4 /* xmsgServer type */
82 
83 /* definition for rcat type */
84 
85 #define MASTER_RCAT 0
86 #define SLAVE_RCAT 1
87 #define INIT_SZ_FOR_EXECMD_BUF (16*1024)
88 #define MAX_SZ_FOR_EXECMD_BUF (1*1024*1024)
89 #define MIN_SZ_FOR_PARA_TRAN (1*1024*1024)
90 #define TRANS_SZ (40*1024*1024)
91 #define LARGE_SPACE 1000000000
92 #define UNKNOWN_FILE_SZ -99 /* value to indicate the file sz is unknown */
93 #define MIN_RESTART_SIZE (64*1024*1024)
94 #define RESTART_FILE_UPDATE_SIZE (32*1024*1024)
95 
96 #define MAX_NUM_CONFIG_TRAN_THR 64
97 
98 /* definition for numThreads input */
99 
100 #define NO_THREADING -1
101 #define AUTO_THREADING 0 /* default */
102 
103 #define NO_SAVE_REI 0
104 #define SAVE_REI 1
105 
106 #define SELECT_TIMEOUT_FOR_CONN 60 /* 60 sec wait for connection */
107 /* this is the return value for the rcExecMyRule call indicating the
108  * server is requesting the client to client to perform certain task */
109 #define SYS_SVR_TO_CLI_MSI_REQUEST 99999995
110 #define SYS_SVR_TO_CLI_COLL_STAT 99999996
111 #define SYS_CLI_TO_SVR_COLL_STAT_REPLY 99999997
112 #define SYS_SVR_TO_CLI_PUT_ACTION 99999990
113 #define SYS_SVR_TO_CLI_GET_ACTION 99999991
114 #define SYS_RSYNC_TARGET_MODIFIED 99999992 /* target modified */
115 
116 /* definition for iRODS server to client action request from a microservice.
117  * these definitions are put in the "label" field of MsParam */
118 
119 #define CL_PUT_ACTION "CL_PUT_ACTION"
120 #define CL_GET_ACTION "CL_GET_ACTION"
121 #define CL_ZONE_OPR_INX "CL_ZONE_OPR_INX"
122 
123 /* the following defines the RSYNC_MODE_KW */
124 #define LOCAL_TO_IRODS "LOCAL_TO_IRODS"
125 #define IRODS_TO_LOCAL "IRODS_TO_LOCAL"
126 #define IRODS_TO_IRODS "IRODS_TO_IRODS"
127 #define IRODS_TO_COLLECTION "IRODS_TO_COLLECTION"
128 
129 /* definition for public user */
130 #define PUBLIC_USER_NAME "public"
131 
132 /* definition for anonymous user */
133 #define ANONYMOUS_USER "anonymous"
134 
135 /* definition for bulk operation */
136 #define MAX_NUM_BULK_OPR_FILES 50
137 #define MAX_BULK_OPR_FILE_SIZE (4*1024*1024)
138 #define BULK_OPR_BUF_SIZE (8*MAX_BULK_OPR_FILE_SIZE)
139 #define TAR_OVERHEAD (MAX_NUM_BULK_OPR_FILES * MAX_NAME_LEN * 2)
140 
141 
142 /* generic return value for policy rules */
143 #define POLICY_OFF 0
144 #define POLICY_ON 1
145 
146 /* protocol */
147 typedef enum {
149  XML_PROT
151 
152 /* myRead/myWrite type */
153 
154 typedef enum {
158 
159 /* position for queuing */
160 typedef enum {
162  TOP_POS
164 
165 typedef enum {
168  ON_STATE
170 
171 typedef enum {
176 
177 #define DEF_IRODS_PROT NATIVE_PROT
178 
197 typedef struct BytesBuf { /* have to add BytesBuf to get Doxygen working */
198  int len; /* len in bytes in buf */
199  void *buf;
201 
202 typedef struct { /* have to add BytesBuf to get Doxygen working */
203  int type;
204  int len; /* len of array in buf */
205  void *buf;
206 } dataArray_t;
207 
208 /* The msg header for all communication between client and server */
209 
210 typedef struct msgHeader {
212  int msgLen; /* Length of the main msg */
213  int errorLen; /* Length of the error struct */
214  int bsLen; /* Length of optional byte stream */
215  int intInfo; /* an additional integer info, for API, it is the
216  * apiReqNum */
218 
219 /* header length XML tag */
220 #define MSG_HEADER_LEN_TAG "MsgHeaderLen"
221 
222 /* msg type */
223 #define RODS_CONNECT_T "RODS_CONNECT"
224 #define RODS_HEARTBEAT_T "HEARTBEAT"
225 #define RODS_VERSION_T "RODS_VERSION"
226 #define RODS_API_REQ_T "RODS_API_REQ"
227 #define RODS_DISCONNECT_T "RODS_DISCONNECT"
228 #define RODS_RECONNECT_T "RODS_RECONNECT"
229 #define RODS_REAUTH_T "RODS_REAUTH"
230 #define RODS_API_REPLY_T "RODS_API_REPLY"
231 #define RODS_CS_NEG_T "RODS_CS_NEG_T"
232 
233 /* The strct sent with RODS_CONNECT type by client */
234 typedef struct startupPack {
246 
247 /* env variable for the client protocol */
248 #define IRODS_PROT "irodsProt"
249 
250 /* env variable for the startup pack */
251 
252 #define SP_NEW_SOCK "spNewSock"
253 #define SP_CLIENT_ADDR "spClientAddr"
254 #define SP_CONNECT_CNT "spConnectCnt"
255 #define SP_PROTOCOL "spProtocol"
256 #define SP_RECONN_FLAG "spReconnFlag"
257 #define SP_PROXY_USER "spProxyUser"
258 #define SP_PROXY_RODS_ZONE "spProxyRodsZone"
259 #define SP_CLIENT_USER "spClientUser"
260 #define SP_CLIENT_RODS_ZONE "spClientRodsZone"
261 #define SP_REL_VERSION "spRelVersion"
262 #define SP_API_VERSION "spApiVersion"
263 #define SP_OPTION "spOption"
264 #define SP_LOG_SQL "spLogSql"
265 #define SP_LOG_LEVEL "spLogLevel"
266 #define SP_RE_CACHE_SALT "reCacheSalt"
267 #define SERVER_BOOT_TIME "serverBootTime"
268 
269 // =-=-=-=-=-=-=-
270 // magic token to assign to startup pack option variable
271 // in order to request a client-server negotiation
272 #define REQ_SVR_NEG "request_server_negotiation"
273 
274 /* Definition for resource status. If it is empty (strlen == 0), it is
275  * assumed to be up */
276 #define RESC_DOWN "down"
277 #define RESC_UP "up"
278 #define RESC_AUTO_UP "auto-up"
279 #define RESC_AUTO_DOWN "auto-down"
280 
281 #define INT_RESC_STATUS_UP 0
282 #define INT_RESC_STATUS_DOWN 1
283 
284 /* The strct sent with RODS_VERSION type by server */
285 
286 typedef struct {
287  int status; /* if > 0, contains the reconnection port */
288  char relVersion[NAME_LEN];
289  char apiVersion[NAME_LEN];
291  char reconnAddr[LONG_NAME_LEN];
292  int cookie;
293 } version_t;
294 /* struct that defines a Host Addr */
295 
296 typedef struct {
297  char hostAddr[LONG_NAME_LEN];
298  char zoneName[NAME_LEN];
299  int portNum;
300  int dummyInt; /* make it to 64 bit boundary */
302 
303 /* definition for restartState */
304 
305 #define PATH_MATCHING 0x1
306 #define LAST_PATH_MATCHED 0x2
307 #define MATCHED_RESTART_COLL 0x4
308 #define OPR_RESUMED 0x8
309 
310 /* definition for DNN WOS connection env */
311 
312 #define WOS_HOST_ENV "wosHost"
313 #define WOS_POLICY_ENV "wosPolicy"
314 
315 /* struct that defines restart operation */
316 
317 typedef struct {
318  char restartFile[MAX_NAME_LEN];
319  int fd; /* df of the opened restartFile */
320  int doneCnt; /* a count of number of files done in the coll/dir */
321  char collection[MAX_NAME_LEN]; /* the coll/dir being restarted */
322  char lastDonePath[MAX_NAME_LEN]; /* the last path that is done */
323  char oprType[NAME_LEN]; /* BULK_OPR_KW or NON_BULK_OPR_KW */
324  int curCnt;
326 } rodsRestart_t;
327 
328 /* definition for handler function */
329 #ifdef __cplusplus
330 typedef int( ( *funcPtr )( ... ) );
331 #else
332 typedef int( ( *funcPtr )( ) );
333 #endif
334 
335 /* some platform does not support vfork */
336 #if defined(sgi_platform) || defined(aix_platform)
337 #define RODS_FORK() fork()
338 #else
339 #define RODS_FORK() vfork()
340 #endif
341 
342 #define VAULT_PATH_POLICY "VAULT_PATH_POLICY" /* msParam lable */
343 /* definition for vault filePath scheme */
344 typedef enum {
346  RANDOM_S
348 
349 #define DEF_VAULT_PATH_SCHEME GRAFT_PATH_S
350 #define DEF_ADD_USER_FLAG 1
351 #define DEF_TRIM_DIR_CNT 1
352 
353 typedef struct {
356  int trimDirCnt; /* for GRAFT_PATH_S only. Number of directories to
357  * trim */
359 
360 /* struct for proc (agent) logging */
361 typedef struct {
362  int pid;
363  unsigned int startTime;
364  char clientName[NAME_LEN];
365  char clientZone[NAME_LEN];
366  char proxyName[NAME_LEN];
367  char proxyZone[NAME_LEN];
368  char remoteAddr[NAME_LEN];
369  char serverAddr[NAME_LEN];
370  char progName[NAME_LEN];
371 } procLog_t;
372 
373 #endif // RODS_DEF_H__
msgHeader::errorLen
int errorLen
Definition: rodsDef.h:213
msgHeader::bsLen
int bsLen
Definition: rodsDef.h:214
vaultPathPolicy_t
Definition: rodsDef.h:353
msgHeader
Definition: rodsDef.h:210
is_ORPHAN_HOME
@ is_ORPHAN_HOME
Definition: rodsDef.h:174
vaultPathScheme_t
vaultPathScheme_t
Definition: rodsDef.h:344
rodsRestart_t::doneCnt
int doneCnt
Definition: rodsDef.h:320
BytesBuf::buf
void * buf
Definition: rodsDef.h:199
rodsRestart_t::restartState
int restartState
Definition: rodsDef.h:325
startupPack::clientRodsZone
char clientRodsZone[64]
Definition: rodsDef.h:241
irodsStateFlag_t
irodsStateFlag_t
Definition: rodsDef.h:165
HEADER_TYPE_LEN
#define HEADER_TYPE_LEN
Definition: rodsDef.h:53
msgHeader::type
char type[128]
Definition: rodsDef.h:211
startupPack::relVersion
char relVersion[64]
Definition: rodsDef.h:242
procLog_t::pid
int pid
Definition: rodsDef.h:362
NOT_ORPHAN_PATH
@ NOT_ORPHAN_PATH
Definition: rodsDef.h:172
XML_PROT
@ XML_PROT
Definition: rodsDef.h:149
bytesBuf_t
struct BytesBuf bytesBuf_t
LONG_NAME_LEN
#define LONG_NAME_LEN
Definition: rodsDef.h:57
BytesBuf::len
int len
Definition: rodsDef.h:198
dataArray_t
Definition: rodsDef.h:202
msgHeader::msgLen
int msgLen
Definition: rodsDef.h:212
FILE_DESC_TYPE
@ FILE_DESC_TYPE
Definition: rodsDef.h:156
startupPack::clientUser
char clientUser[64]
Definition: rodsDef.h:240
irodsProt_t
irodsProt_t
Definition: rodsDef.h:147
GRAFT_PATH_S
@ GRAFT_PATH_S
Definition: rodsDef.h:345
startupPack::proxyRodsZone
char proxyRodsZone[64]
Definition: rodsDef.h:239
vaultPathPolicy_t::addUserName
int addUserName
Definition: rodsDef.h:355
dataArray_t::len
int len
Definition: rodsDef.h:204
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: rodsDef.h:61
dataArray_t::buf
void * buf
Definition: rodsDef.h:205
startupPack::reconnFlag
int reconnFlag
Definition: rodsDef.h:236
version_t::cookie
int cookie
Definition: rodsDef.h:292
irodsDescType_t
irodsDescType_t
Definition: rodsDef.h:154
startupPack::proxyUser
char proxyUser[64]
Definition: rodsDef.h:238
ON_STATE
@ ON_STATE
Definition: rodsDef.h:168
procLog_t::startTime
unsigned int startTime
Definition: rodsDef.h:363
startupPack::apiVersion
char apiVersion[64]
Definition: rodsDef.h:243
startupPack_t
struct startupPack startupPack_t
rodsRestart_t
Definition: rodsDef.h:317
BytesBuf
Definition: rodsDef.h:197
startupPack::irodsProt
irodsProt_t irodsProt
Definition: rodsDef.h:235
int
typedef int((*funcPtr)())
dataArray_t::type
int type
Definition: rodsDef.h:203
rodsRestart_t::fd
int fd
Definition: rodsDef.h:319
startupPack::option
char option[256]
Definition: rodsDef.h:244
startupPack::connectCnt
int connectCnt
Definition: rodsDef.h:237
msgHeader::intInfo
int intInfo
Definition: rodsDef.h:215
version_t::status
int status
Definition: rodsDef.h:287
vaultPathPolicy_t::scheme
vaultPathScheme_t scheme
Definition: rodsDef.h:354
startupPack
Definition: rodsDef.h:234
rodsHostAddr_t::dummyInt
int dummyInt
Definition: rodsDef.h:300
procLog_t
Definition: rodsDef.h:361
msgHeader_t
struct msgHeader msgHeader_t
NATIVE_PROT
@ NATIVE_PROT
Definition: rodsDef.h:148
OFF_STATE
@ OFF_STATE
Definition: rodsDef.h:167
version_t
Definition: rodsDef.h:286
rodsRestart_t::curCnt
int curCnt
Definition: rodsDef.h:324
vaultPathPolicy_t::trimDirCnt
int trimDirCnt
Definition: rodsDef.h:356
rodsHostAddr_t::portNum
int portNum
Definition: rodsDef.h:299
SOCK_TYPE
@ SOCK_TYPE
Definition: rodsDef.h:155
version_t::reconnPort
int reconnPort
Definition: rodsDef.h:290
NAME_LEN
#define NAME_LEN
Definition: rodsDef.h:55
RANDOM_S
@ RANDOM_S
Definition: rodsDef.h:346
irodsPosition_t
irodsPosition_t
Definition: rodsDef.h:160
orphanPathType_t
orphanPathType_t
Definition: rodsDef.h:171
BOTTOM_POS
@ BOTTOM_POS
Definition: rodsDef.h:161
TOP_POS
@ TOP_POS
Definition: rodsDef.h:162
UNINIT_STATE
@ UNINIT_STATE
Definition: rodsDef.h:166
rodsHostAddr_t
Definition: rodsDef.h:296
IS_ORPHAN_PATH
@ IS_ORPHAN_PATH
Definition: rodsDef.h:173