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)  

reStruct.cpp
Go to the documentation of this file.
1 
4 #include "irods_re_structs.hpp"
5 #include "rcMisc.h"
6 #include "objMetaOpr.hpp"
7 #include "resource.hpp"
8 
9 // =-=-=-=-=-=-=-
11 
12 
13 void *mallocAndZero( int s ) {
14  void *t;
15  t = malloc( s );
16  memset( t, 0, s );
17  return t;
18 }
19 
20 int
22 
23  ( *to ) = ( *from );
24 
25 
37  if ( strlen( from->pluginInstanceName ) != 0 ) {
39  }
40 
41  if ( from->doi != NULL ) {
42  to->doi = ( dataObjInfo_t * ) mallocAndZero( sizeof( dataObjInfo_t ) );
43  copyDataObjInfo( from->doi, to->doi );
44  }
45  else {
46  to->doi = NULL;
47  }
48 
49  if ( from->uoic != NULL ) {
50  to->uoic = ( userInfo_t* )mallocAndZero( sizeof( userInfo_t ) );
51  copyUserInfo( from->uoic, to->uoic );
52  }
53  else {
54  to->uoic = NULL;
55  }
56 
57  if ( from->uoip != NULL ) {
58  to->uoip = ( userInfo_t* )mallocAndZero( sizeof( userInfo_t ) );
59  copyUserInfo( from->uoip, to->uoip );
60  }
61  else {
62  to->uoip = NULL;
63  }
64 
65  if ( from->coi != NULL ) {
66  to->coi = ( collInfo_t* )mallocAndZero( sizeof( collInfo_t ) );
67  copyCollInfo( from->coi, to->coi );
68  }
69  else {
70  to->coi = NULL;
71  }
72 
73  if ( from->uoio != NULL ) {
74  to->uoio = ( userInfo_t* )mallocAndZero( sizeof( userInfo_t ) );
75  copyUserInfo( from->uoio, to->uoio );
76  }
77  else {
78  to->uoio = NULL;
79  }
80 
81  if ( from->condInputData != NULL ) {
84  }
85  else {
86  to->condInputData = NULL;
87  }
88 
89  if ( from->next != NULL ) {
90  to->next = ( ruleExecInfo_t* )mallocAndZero( sizeof( ruleExecInfo_t ) );
91  copyRuleExecInfo( from->next, to->next );
92  }
93  else {
94  to->next = NULL;
95  }
96  return 0;
97 }
98 
99 int
100 freeRuleExecInfoStruct( ruleExecInfo_t *rs, int freeSpecialStructFlag ) {
101  freeRuleExecInfoInternals( rs, freeSpecialStructFlag );
102  free( rs );
103  return 0;
104 }
105 int
106 freeRuleExecInfoInternals( ruleExecInfo_t *rs, int freeSpecialStructFlag ) {
107  if ( rs->msParamArray != NULL && ( freeSpecialStructFlag & FREE_MS_PARAM ) > 0 ) {
109  free( rs->msParamArray );
110  }
111 
112  if ( rs->doinp != NULL && ( freeSpecialStructFlag & FREE_DOINP ) > 0 ) {
113  clearDataObjInp( rs->doinp );
114  free( rs->doinp );
115  }
116 
117  if ( rs->doi != NULL ) {
118  freeAllDataObjInfo( rs->doi );
119  }
120  if ( rs->uoic != NULL ) {
121  freeUserInfo( rs->uoic );
122  }
123  if ( rs->uoip != NULL ) {
124  freeUserInfo( rs->uoip );
125  }
126  if ( rs->coi != NULL ) {
127  freeCollInfo( rs->coi );
128  }
129  if ( rs->uoio != NULL ) {
130  freeUserInfo( rs->uoio );
131  }
132  if ( rs->condInputData != NULL ) {
134  }
135  if ( rs->next != NULL ) {
136  freeRuleExecInfoStruct( rs->next, freeSpecialStructFlag );
137  }
138  return 0;
139 }
140 
141 int
143  *to = *from;
144  if ( from->next != NULL ) {
145  to->next = ( dataObjInfo_t* )mallocAndZero( sizeof( dataObjInfo_t ) );
146  copyDataObjInfo( from->next, to->next );
147  }
148  else {
149  to->next = NULL;
150  }
151  return 0;
152 }
153 
154 
155 int
157  *to = *from;
158  if ( from->next != NULL ) {
159  to->next = ( collInfo_t* )mallocAndZero( sizeof( collInfo_t ) );
160  copyCollInfo( from->next, to->next );
161  }
162  else {
163  to->next = NULL;
164  }
165  return 0;
166 }
167 
168 
169 #if 0 // #1472
170 int
171 copyRescGrpInfo( rescGrpInfo_t *from, rescGrpInfo_t *to ) {
172  *to = *from;
173  if ( from->next != NULL ) {
174  to->next = ( rescGrpInfo_t* )mallocAndZero( sizeof( rescGrpInfo_t ) );
175  copyRescGrpInfo( from->next, to->next );
176  }
177  else {
178  to->next = NULL;
179  }
180  return 0;
181 }
182 
183 int
184 freeRescGrpInfo( rescGrpInfo_t *rs ) {
185  if ( rs->next != NULL ) {
186  freeRescGrpInfo( rs->next );
187  }
188  if ( rs->rescInfo ) {
189  delete rs->rescInfo;
190  }
191  free( rs );
192  return 0;
193 }
194 #endif
195 
196 
197 int
199  if ( rs->next != NULL ) {
200  freeCollInfo( rs->next );
201  }
202  free( rs );
203  return 0;
204 }
205 
206 
207 int
209  *to = *from;
210  to->authInfo = from->authInfo;
211  to->userOtherInfo = from->userOtherInfo;
212  return 0;
213 }
214 
215 
216 int
218  free( rs );
219  return 0;
220 }
221 
222 
223 #if 0 // #1472
224 int
225 copyRescInfo( rescInfo_t *from, rescInfo_t *to ) {
226  *to = *from;
227  return 0;
228 }
229 
230 
231 int
232 freeRescInfo( rescInfo_t *rs ) {
233  free( rs );
234  return 0;
235 }
236 #endif
237 
238 
239 int
241  *to = *from;
242  return 0;
243 }
244 
245 int
247  free( rs );
248  return 0;
249 }
250 
251 
252 
253 int
255 
256  memset( rei, 0, sizeof( ruleExecInfo_t ) );
257  return 0;
258 }
259 
260 int
262  bytesBuf_t **packedReiBBuf ) {
263  int status;
264 
265  if ( packedReiBBuf == NULL ) {
267  }
268 
269  /* pack the rei */
270 
271  status = packStruct( ( void * ) rei, packedReiBBuf,
272  "Rei_PI", RodsPackTable, 0, NATIVE_PROT );
273 
274  if ( status < 0 ) {
276  "packRei: packStruct error. status = %d", status );
277  return status;
278  }
279 
280  return status;
281 }
282 
283 int
284 pushStack( strArray_t *strArray, char *value ) {
285 
286  return addStrArray( strArray, value );
287 
288 }
289 
290 int
291 popStack( strArray_t *strArray, char *value ) {
292 
293  if ( strArray->len <= 0 || strArray->size == 0 ) {
295  "popStack: Stack is empty: invalid size %d, len %d",
296  strArray->size, strArray->len );
298  }
299  rstrcpy( value, &strArray->value[( strArray->len - 1 ) * strArray->size], strArray->size );
300  strArray->len--;
301  return 0;
302 
303 }
304 
305 int
307  if ( rei == NULL || rei->msParamArray == NULL ) {
308  return 0;
309  }
310  /* need to use 0 on delStruct flag or core dump in when called by
311  * finalizeMsParamNew */
312  clearMsParamArray( rei->msParamArray, 0 );
313  free( rei->msParamArray );
314 
315  rei->msParamArray = NULL;
316 
317  return 0;
318 }
319 
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
NULL
#define NULL
Definition: rodsDef.h:70
SYS_INTERNAL_NULL_INPUT_ERR
@ SYS_INTERNAL_NULL_INPUT_ERR
Definition: rodsErrorTable.h:92
packRei
int packRei(ruleExecInfo_t *rei, bytesBuf_t **packedReiBBuf)
Definition: reStruct.cpp:261
pushStack
int pushStack(strArray_t *strArray, char *value)
Definition: reStruct.cpp:284
userInfo_t
Definition: rodsUser.h:65
freeCollInfo
int freeCollInfo(collInfo_t *rs)
Definition: reStruct.cpp:198
RuleExecInfo::coi
collInfo_t * coi
Definition: irods_re_structs.hpp:32
rcMisc.h
RuleExecInfo::doi
dataObjInfo_t * doi
Definition: irods_re_structs.hpp:28
irods_resource_backport.hpp
RuleExecInfo::doinp
dataObjInp_t * doinp
Definition: irods_re_structs.hpp:27
copyRuleExecInfo
int copyRuleExecInfo(ruleExecInfo_t *from, ruleExecInfo_t *to)
Definition: reStruct.cpp:21
freeRuleExecInfoStruct
int freeRuleExecInfoStruct(ruleExecInfo_t *rs, int freeSpecialStructFlag)
Definition: reStruct.cpp:100
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
FREE_MS_PARAM
#define FREE_MS_PARAM
Definition: irods_re_structs.hpp:15
freeKeyValPairStruct
int freeKeyValPairStruct(keyValPair_t *rs)
Definition: reStruct.cpp:246
CollInfo
Definition: objInfo.h:177
DataObjInfo::next
struct DataObjInfo * next
Definition: objInfo.h:163
clearDataObjInp
void clearDataObjInp(void *)
Definition: rcMisc.cpp:1475
StrArray::len
int len
Definition: objInfo.h:221
clearMsparamInRei
int clearMsparamInRei(ruleExecInfo_t *rei)
Definition: reStruct.cpp:306
RuleExecInfo::condInputData
keyValPair_t * condInputData
Definition: irods_re_structs.hpp:34
clearMsParamArray
int clearMsParamArray(msParamArray_t *msParamArray, int freeStruct)
Definition: msParam.cpp:447
CollInfo::next
struct CollInfo * next
Definition: objInfo.h:196
RuleExecInfo::uoip
userInfo_t * uoip
Definition: irods_re_structs.hpp:31
mallocAndZero
void * mallocAndZero(int s)
Definition: reStruct.cpp:13
popStack
int popStack(strArray_t *strArray, char *value)
Definition: reStruct.cpp:291
freeAllDataObjInfo
int freeAllDataObjInfo(dataObjInfo_t *dataObjInfoHead)
Definition: rcMisc.cpp:561
copyCollInfo
int copyCollInfo(collInfo_t *from, collInfo_t *to)
Definition: reStruct.cpp:156
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: rodsDef.h:61
freeUserInfo
int freeUserInfo(userInfo_t *rs)
Definition: reStruct.cpp:217
addStrArray
int addStrArray(strArray_t *strArray, char *value)
Definition: rcMisc.cpp:959
userInfo_t::userOtherInfo
userOtherInfo_t userOtherInfo
Definition: rodsUser.h:71
get_irods_version.value
dictionary value
Definition: get_irods_version.py:27
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
FREE_DOINP
#define FREE_DOINP
Definition: irods_re_structs.hpp:16
RuleExecInfo::uoio
userInfo_t * uoio
Definition: irods_re_structs.hpp:33
copyKeyValPairStruct
int copyKeyValPairStruct(keyValPair_t *from, keyValPair_t *to)
Definition: reStruct.cpp:240
zeroRuleExecInfoStruct
int zeroRuleExecInfoStruct(ruleExecInfo_t *rei)
Definition: reStruct.cpp:254
RodsPackTable
const packInstruct_t RodsPackTable[]
Definition: rodsPackTable.h:61
BytesBuf
Definition: rodsDef.h:197
RuleExecInfo::pluginInstanceName
char pluginInstanceName[(1024+64)]
Definition: irods_re_structs.hpp:23
RuleExecInfo::uoic
userInfo_t * uoic
Definition: irods_re_structs.hpp:30
StrArray::size
int size
Definition: objInfo.h:222
RuleExecInfo::msParamArray
msParamArray_t * msParamArray
Definition: irods_re_structs.hpp:24
RuleExecInfo
Definition: irods_re_structs.hpp:18
irods_re_structs.hpp
packStruct
int packStruct(const void *inStruct, bytesBuf_t **packedResult, const char *packInstName, const packInstruct_t *myPackTable, int packFlag, irodsProt_t irodsProt)
Definition: packStruct.cpp:21
resource.hpp
StrArray::value
char * value
Definition: objInfo.h:223
copyDataObjInfo
int copyDataObjInfo(dataObjInfo_t *from, dataObjInfo_t *to)
Definition: reStruct.cpp:142
NATIVE_PROT
@ NATIVE_PROT
Definition: rodsDef.h:148
userInfo_t::authInfo
authInfo_t authInfo
Definition: rodsUser.h:70
rstrcpy
char * rstrcpy(char *dest, const char *src, int maxLen)
Definition: stringOpr.cpp:51
KeyValPair
Definition: objInfo.h:120
DataObjInfo
Definition: objInfo.h:129
RuleExecInfo::next
struct RuleExecInfo * next
Definition: irods_re_structs.hpp:38
copyUserInfo
int copyUserInfo(userInfo_t *from, userInfo_t *to)
Definition: reStruct.cpp:208
StrArray
Definition: objInfo.h:220
objMetaOpr.hpp
freeRuleExecInfoInternals
int freeRuleExecInfoInternals(ruleExecInfo_t *rs, int freeSpecialStructFlag)
Definition: reStruct.cpp:106