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)  

configuration.hpp
Go to the documentation of this file.
1 /* For copyright information please refer to files in the COPYRIGHT directory
2  */
3 #ifndef _CONFIGURATION_HPP
4 #define _CONFIGURATION_HPP
5 
6 #include "rules.hpp"
7 #include "irods_hashtable.h"
8 #include "parser.hpp"
9 #include "datetime.hpp"
10 #include "checksum.hpp"
11 
12 #define RESC_CORE_RULE_SET 0x1
13 #define RESC_APP_RULE_SET 0x2
14 #define RESC_EXT_RULE_SET 0x4
15 #define RESC_SYS_FUNC_DESC_INDEX 0x10
16 #define RESC_CORE_FUNC_DESC_INDEX 0x20
17 #define RESC_APP_FUNC_DESC_INDEX 0x40
18 #define RESC_EXT_FUNC_DESC_INDEX 0x80
19 #define RESC_REGION_SYS 0x100
20 #define RESC_REGION_CORE 0x200
21 #define RESC_REGION_APP 0x400
22 #define RESC_REGION_EXT 0x800
23 #define RESC_CACHE 0x1000
24 
25 typedef enum ruleEngineStatus {
29  /*SHARED,
30  LOCAL,
31  DISABLED*/
33 
34 struct Cache {
35  Cache();
36  unsigned char *address;
37  unsigned char *pointers;
38  size_t dataSize;
39  size_t cacheSize;
64  int tvarNumber; /* counter for tvar generator */
67  int logging;
70 };
71 
72 #define isComponentInitialized(x) ((x)==INITIALIZED || (x)==COMPRESSED)
73 #define isComponentAllocated(x) ((x)==INITIALIZED)
74 #define clearRegion(u, l) \
75  if((resources & RESC_REGION_##u) && isComponentAllocated(ruleEngineConfig.l##Region##Status)) { \
76  region_free(ruleEngineConfig.l##Region); \
77  ruleEngineConfig.l##Region = NULL; \
78  ruleEngineConfig.l##Region##Status = UNINITIALIZED; \
79  } \
80 
81 #define delayClearRegion(u, l) \
82  if((resources & RESC_REGION_##u) && isComponentAllocated(ruleEngineConfig.l##Region##Status)) { \
83  listAppendNoRegion(&regionsToClear, ruleEngineConfig.l##Region); \
84  ruleEngineConfig.l##Region = NULL; \
85  ruleEngineConfig.l##Region##Status = UNINITIALIZED; \
86  } \
87 
88 #define createRegion(u, l) \
89  if(ruleEngineConfig.l##Region##Status != INITIALIZED) { \
90  ruleEngineConfig.l##Region = make_region(0, NULL); \
91  ruleEngineConfig.l##Region##Status = INITIALIZED; \
92  } \
93 
94 #define clearRuleSet(u, l) \
95  if((resources & RESC_##u##_RULE_SET) && isComponentInitialized(ruleEngineConfig.l##RuleSetStatus)) { \
96  ruleEngineConfig.l##RuleSet = NULL; \
97  ruleEngineConfig.l##RuleSetStatus = UNINITIALIZED; \
98  } \
99 
100 #define delayClearRuleSet(u, l) \
101  if((resources & RESC_##u##_RULE_SET) && isComponentInitialized(ruleEngineConfig.l##RuleSetStatus)) { \
102  ruleEngineConfig.l##RuleSet = NULL; \
103  ruleEngineConfig.l##RuleSetStatus = UNINITIALIZED; \
104  } \
105 
106 #define delayClearFuncDescIndex(u, l) \
107  if((resources & RESC_##u##_FUNC_DESC_INDEX) && isComponentInitialized(ruleEngineConfig.l##FuncDescIndexStatus)) { \
108  listAppendNoRegion(&envToClear, ruleEngineConfig.l##FuncDescIndex); \
109  ruleEngineConfig.l##FuncDescIndex = NULL; \
110  ruleEngineConfig.l##FuncDescIndexStatus = UNINITIALIZED; \
111  } else if((resources & RESC_##u##_FUNC_DESC_INDEX) && ruleEngineConfig.l##FuncDescIndexStatus == COMPRESSED) { \
112  ruleEngineConfig.l##FuncDescIndexStatus = UNINITIALIZED; \
113  } \
114 
115 #define createRuleSet(u, l) \
116  if(!isComponentInitialized(ruleEngineConfig.l##RuleSetStatus)) { \
117  ruleEngineConfig.l##RuleSet = (RuleSet *)region_alloc(ruleEngineConfig.l##Region, sizeof(RuleSet)); \
118  ruleEngineConfig.l##RuleSet->len = 0; \
119  ruleEngineConfig.l##RuleSetStatus = INITIALIZED; \
120  } \
121 
122 #define clearFuncDescIndex(u, l) \
123  if((resources & RESC_##u##_FUNC_DESC_INDEX) && isComponentInitialized(ruleEngineConfig.l##FuncDescIndexStatus)) { \
124  /* deleteEnv(ruleEngineConfig.l##FuncDescIndex, 1); */\
125  ruleEngineConfig.l##FuncDescIndex = NULL; \
126  ruleEngineConfig.l##FuncDescIndexStatus = UNINITIALIZED; \
127  } \
128 
129 #define createFuncDescIndex(u, l) \
130  if(!isComponentInitialized(ruleEngineConfig.l##FuncDescIndexStatus)) { \
131  ruleEngineConfig.l##FuncDescIndex = newEnv(NULL, NULL, NULL, ruleEngineConfig.l##Region); \
132  ruleEngineConfig.l##FuncDescIndex->current = newHashTable2(1000, ruleEngineConfig.l##Region); \
133  ruleEngineConfig.l##FuncDescIndexStatus = INITIALIZED; \
134  } \
135 
137 extern int isServer;
138 extern Cache ruleEngineConfig;
139 
141 int unlinkFuncDescIndex();
142 int clearResources( int resources );
143 int clearCoreRuleIndex( );
144 int clearAppRuleIndex( );
145 int readRuleStructAndRuleSetFromFile( const char *ruleBaseName, const char *rulesFileName );
146 int loadRuleFromCacheOrFile( const char*, const char *irbSet );
147 int createCoreRuleIndex( );
148 int createAppRuleIndex( );
149 int availableRules();
150 void removeRuleFromExtIndex( char *ruleName, int i );
151 void appendRuleIntoExtIndex( RuleDesc *rule, int i, Region *r );
152 void prependRuleIntoAppIndex( RuleDesc *rule, int i, Region *r );
153 int checkPointExtRuleSet( Region *r );
154 void appendAppRule( RuleDesc *rd, Region *r );
155 void prependAppRule( RuleDesc *rd, Region *r );
156 void popExtRuleSet( int checkPoint );
157 void clearDelayed();
159 int readICatUserInfo( char *userName, char *attr, char userInfo[MAX_NAME_LEN], rsComm_t *rsComm );
160 int writeICatUserInfo( char *userName, char *attr, char *userInfo, rsComm_t *rsComm );
161 int readICatUserLogging( char *userName, int *logging, rsComm_t *rsComm );
162 int writeICatUserLogging( char *userName, int logging, rsComm_t *rsComm );
163 
164 #define RE_LOGGING_ATTR "rulelogging"
165 
166 #endif /* _CONFIGURATION_H */
_ruleEngineStatus
RuleEngineStatus _ruleEngineStatus
Cache::appFuncDescIndexStatus
RuleEngineStatus appFuncDescIndexStatus
Definition: configuration.hpp:45
Cache::tvarNumber
int tvarNumber
Definition: configuration.hpp:64
rsComm_t
Definition: rcConnect.h:145
parser.hpp
Cache::clearDelayed
int clearDelayed
Definition: configuration.hpp:65
Cache
Definition: configuration.hpp:34
prependAppRule
void prependAppRule(RuleDesc *rd, Region *r)
Definition: configuration.cpp:139
clearResources
int clearResources(int resources)
Definition: configuration.cpp:169
RuleEngineStatus
enum ruleEngineStatus RuleEngineStatus
env
Definition: restructs.hpp:226
Cache::appRegion
Region * appRegion
Definition: configuration.hpp:62
createCoreRuleIndex
int createCoreRuleIndex()
Definition: configuration.cpp:322
clearDelayed
void clearDelayed()
Definition: configuration.cpp:221
checksum.hpp
Cache::sysFuncDescIndex
Env * sysFuncDescIndex
Definition: configuration.hpp:56
Cache::appFuncDescIndex
Env * appFuncDescIndex
Definition: configuration.hpp:58
readICatUserLogging
int readICatUserLogging(char *userName, int *logging, rsComm_t *rsComm)
Definition: configuration.cpp:650
datetime.hpp
Cache::coreRuleSet
RuleSet * coreRuleSet
Definition: configuration.hpp:53
unlinkFuncDescIndex
int unlinkFuncDescIndex()
Definition: configuration.cpp:298
ruleEngineStatus
ruleEngineStatus
Definition: configuration.hpp:25
Cache::coreRegionStatus
RuleEngineStatus coreRegionStatus
Definition: configuration.hpp:50
UNINITIALIZED
@ UNINITIALIZED
Definition: configuration.hpp:26
Cache::appRuleSet
RuleSet * appRuleSet
Definition: configuration.hpp:54
Cache::sysRegionStatus
RuleEngineStatus sysRegionStatus
Definition: configuration.hpp:49
checkPointExtRuleSet
int checkPointExtRuleSet(Region *r)
Definition: configuration.cpp:130
generate_iadmin_commands_for_41_to_42_upgrade.resources
dictionary resources
Definition: generate_iadmin_commands_for_41_to_42_upgrade.py:18
Cache::extRegion
Region * extRegion
Definition: configuration.hpp:63
appendRuleIntoExtIndex
void appendRuleIntoExtIndex(RuleDesc *rule, int i, Region *r)
Definition: configuration.cpp:93
Cache::cacheSize
size_t cacheSize
Definition: configuration.hpp:39
getRuleEngineStatus
RuleEngineStatus getRuleEngineStatus()
Definition: configuration.cpp:154
popExtRuleSet
void popExtRuleSet(int checkPoint)
Definition: configuration.cpp:144
readICatUserInfo
int readICatUserInfo(char *userName, char *attr, char userInfo[(1024+64)], rsComm_t *rsComm)
Definition: configuration.cpp:608
Cache::coreFuncDescIndex
Env * coreFuncDescIndex
Definition: configuration.hpp:57
Cache::hash
char hash[64]
Definition: configuration.hpp:69
Cache::sysRegion
Region * sysRegion
Definition: configuration.hpp:60
Cache::ruleEngineStatus
RuleEngineStatus ruleEngineStatus
Definition: configuration.hpp:47
rules.hpp
createAppRuleIndex
int createAppRuleIndex()
Definition: configuration.cpp:327
Cache::timestamp
time_type timestamp
Definition: configuration.hpp:66
Cache::Cache
Cache()
Definition: configuration.cpp:33
writeICatUserLogging
int writeICatUserLogging(char *userName, int logging, rsComm_t *rsComm)
Definition: configuration.cpp:667
Cache::coreRegion
Region * coreRegion
Definition: configuration.hpp:61
Cache::logging
int logging
Definition: configuration.hpp:67
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: rodsDef.h:61
Cache::address
unsigned char * address
Definition: configuration.hpp:36
irods_hashtable.h
appendAppRule
void appendAppRule(RuleDesc *rd, Region *r)
Cache::appRegionStatus
RuleEngineStatus appRegionStatus
Definition: configuration.hpp:51
availableRules
int availableRules()
Definition: configuration.cpp:603
COMPRESSED
@ COMPRESSED
Definition: configuration.hpp:28
RULE_SET_DEF_LENGTH
#define RULE_SET_DEF_LENGTH
Definition: reDefines.h:26
Cache::extFuncDescIndexStatus
RuleEngineStatus extFuncDescIndexStatus
Definition: configuration.hpp:46
generateFunctionDescriptionTables
int generateFunctionDescriptionTables()
Definition: configuration.cpp:267
region
Definition: region.h:45
Cache::dataSize
size_t dataSize
Definition: configuration.hpp:38
INITIALIZED
@ INITIALIZED
Definition: configuration.hpp:27
CHKSUM_LEN
#define CHKSUM_LEN
Definition: rodsDef.h:56
Cache::pointers
unsigned char * pointers
Definition: configuration.hpp:37
RuleDesc
Definition: restructs.hpp:272
isServer
int isServer
removeRuleFromExtIndex
void removeRuleFromExtIndex(char *ruleName, int i)
Definition: configuration.cpp:80
Cache::appRuleSetStatus
RuleEngineStatus appRuleSetStatus
Definition: configuration.hpp:41
time_type
time_t time_type
Definition: datetime.hpp:15
Cache::ruleBase
char ruleBase[10 *(1024+64)]
Definition: configuration.hpp:68
Cache::coreFuncDescIndexStatus
RuleEngineStatus coreFuncDescIndexStatus
Definition: configuration.hpp:44
clearCoreRuleIndex
int clearCoreRuleIndex()
Definition: configuration.cpp:312
prependRuleIntoAppIndex
void prependRuleIntoAppIndex(RuleDesc *rule, int i, Region *r)
Definition: configuration.cpp:117
readRuleStructAndRuleSetFromFile
int readRuleStructAndRuleSetFromFile(const char *ruleBaseName, const char *rulesFileName)
Definition: configuration.cpp:583
Cache::extFuncDescIndex
Env * extFuncDescIndex
Definition: configuration.hpp:59
writeICatUserInfo
int writeICatUserInfo(char *userName, char *attr, char *userInfo, rsComm_t *rsComm)
Definition: configuration.cpp:637
Cache::cacheStatus
RuleEngineStatus cacheStatus
Definition: configuration.hpp:48
Cache::sysFuncDescIndexStatus
RuleEngineStatus sysFuncDescIndexStatus
Definition: configuration.hpp:43
Cache::coreRuleSetStatus
RuleEngineStatus coreRuleSetStatus
Definition: configuration.hpp:40
Cache::extRuleSetStatus
RuleEngineStatus extRuleSetStatus
Definition: configuration.hpp:42
Cache::extRegionStatus
RuleEngineStatus extRegionStatus
Definition: configuration.hpp:52
clearAppRuleIndex
int clearAppRuleIndex()
Definition: configuration.cpp:316
ruleEngineConfig
Cache ruleEngineConfig
Definition: configuration.cpp:68
loadRuleFromCacheOrFile
int loadRuleFromCacheOrFile(const char *, const char *irbSet)
Definition: configuration.cpp:477
Cache::extRuleSet
RuleSet * extRuleSet
Definition: configuration.hpp:55
ruleSet
Definition: restructs.hpp:282