00001
00002
00003
00004 #include "debug.h"
00005 #include "stdio.h"
00006 #include "time.h"
00007 #include "parser.h"
00008
00009 #ifdef DEBUG
00010 #include "re.h"
00011 int GlobalAllRuleExecFlag=0;
00012
00013 int GlobalREDebugFlag = 0;
00014 int GlobalREAuditFlag = 0;
00015
00016 ruleStruct_t appRuleStrct, coreRuleStrct;
00017 rulefmapdef_t appRuleFuncMapDef, coreRuleFuncMapDef;
00018
00019 int NumOfAction = 2;
00020
00021 microsdef_t MicrosTable[] = {
00022 {"print_hello_arg", 1, (funcPtr)(void *)print},
00023 {"writeLineMS", 2, (funcPtr)(void *)writeLine}
00024 };
00025
00026 int print(msParam_t *str, ruleExecInfo_t *rei) {
00027 printf("%s", (char *)str->inOutStruct);
00028 return 0;
00029 }
00030 int writeLine(msParam_t* out, msParam_t *str, ruleExecInfo_t *rei) {
00031
00032 printf("%s\n", (char *)str->inOutStruct);
00033 return 0;
00034 }
00035
00036 char * getConfigDir () { return "."; }
00037
00038 int msiMakeGenQuery(msParam_t* selectListStr, msParam_t* condStr, msParam_t* genQueryInpParam, ruleExecInfo_t *rei) {
00039 genQueryInp_t *genQueryInp;
00040
00041
00042 if (parseMspForStr(selectListStr) == NULL)
00043 {
00044 rodsLog (LOG_ERROR, "msiMakeGenQuery: input selectListStr is NULL.");
00045 return (USER__NULL_INPUT_ERR);
00046 }
00047
00048
00049
00050 if (parseMspForStr(condStr) == NULL)
00051 {
00052 rodsLog (LOG_ERROR, "msiMakeGenQuery: input condStr is NULL.");
00053 return (USER__NULL_INPUT_ERR);
00054 }
00055
00056
00057
00058
00059
00060 rei->status = 0;
00061
00062
00063 genQueryInp = (genQueryInp_t*)malloc(sizeof(genQueryInp_t));
00064 memset (genQueryInp, 0, sizeof (genQueryInp_t));
00065
00066
00067 genQueryInp->maxRows = 0;
00068 genQueryInp->continueInx = 0;
00069
00070
00071
00072 genQueryInpParam->type = strdup(GenQueryInp_MS_T);
00073 genQueryInpParam->inOutStruct = genQueryInp;
00074
00075
00076
00077 return(rei->status);
00078
00079 }
00080
00081
00082 void
00083 getNowStr(char *timeStr)
00084 {
00085 time_t myTime;
00086
00087 myTime = time(NULL);
00088 snprintf(timeStr, 15, "%011d", (uint) myTime);
00089 }
00090 int rsGeneralRowInsert(rsComm_t *rsComm, generalRowInsertInp_t *generalRowInsertInp) {
00091 if(strcmp(generalRowInsertInp->tableName, "versionRuleBase") == 0) {
00092 printf("inserting into %s row (%s, %s)\n", generalRowInsertInp->tableName, generalRowInsertInp->arg1, generalRowInsertInp->arg2);
00093 } else {
00094 printf("inserting into %s row (%s, %s, %s, %s, %s, %s, %s, %s, %s)\n", generalRowInsertInp->tableName, generalRowInsertInp->arg1, generalRowInsertInp->arg2
00095 , generalRowInsertInp->arg3, generalRowInsertInp->arg4
00096 , generalRowInsertInp->arg5, generalRowInsertInp->arg6
00097 , generalRowInsertInp->arg7, generalRowInsertInp->arg8
00098 , generalRowInsertInp->arg9);
00099
00100 }
00101 return 0;
00102 }
00103 int
00104 insertRulesIntoDBNew(char * baseName, RuleSet *ruleSet,
00105 ruleExecInfo_t *rei)
00106 {
00107 generalRowInsertInp_t generalRowInsertInp;
00108 char *ruleIdStr;
00109 int rc1, i;
00110 int mapPriorityInt = 1;
00111 char mapPriorityStr[50];
00112 char myTime[50];
00113
00114 getNowStr(myTime);
00115
00116
00117 generalRowInsertInp.tableName = "versionRuleBase";
00118 generalRowInsertInp.arg1 = baseName;
00119 generalRowInsertInp.arg2 = myTime;
00120
00121 rc1 = rsGeneralRowInsert(rei->rsComm, &generalRowInsertInp);
00122
00123 for (i = 0; i < ruleSet->len; i++) {
00124 RuleDesc *rd = ruleSet->rules[i];
00125 char *ruleType;
00126 switch(rd->ruleType) {
00127 case RK_FUNC:
00128 ruleType = "@FUNC";
00129 break;
00130 case RK_REL:
00131 ruleType = "@REL";
00132 break;
00133 case RK_DATA:
00134 ruleType = "@DATA";
00135 break;
00136 case RK_CONSTRUCTOR:
00137 ruleType = "@CONSTR";
00138 break;
00139 case RK_EXTERN:
00140 ruleType = "@EXTERN";
00141 break;
00142 }
00143 Node *ruleNode = rd->node;
00144 char ruleNameStr[MAX_RULE_LEN];
00145 char ruleCondStr[MAX_RULE_LEN];
00146 char ruleActionRecoveryStr[MAX_RULE_LEN];
00147 int s;
00148 char *p;
00149 p = ruleNameStr;
00150 s = MAX_RULE_LEN;
00151 ruleNameToString(&p, &s, 0, ruleNode->subtrees[0]);
00152 p = ruleCondStr;
00153 s = MAX_RULE_LEN;
00154 termToString(&p, &s, 0, MIN_PREC, ruleNode->subtrees[1], 0);
00155 p = ruleActionRecoveryStr;
00156 s = MAX_RULE_LEN;
00157 actionsToString(&p, &s, 0, ruleNode->subtrees[2], ruleNode->subtrees[3]);
00158 Node *avu = lookupAVUFromMetadata(ruleNode->subtrees[4], "id");
00159 if(avu!=NULL) {
00160 ruleIdStr = avu->subtrees[1]->text;
00161 } else {
00162 ruleIdStr = "";
00163 }
00164 generalRowInsertInp.tableName = "ruleTable";
00165 generalRowInsertInp.arg1 = baseName;
00166 sprintf(mapPriorityStr, "%i", mapPriorityInt);
00167 mapPriorityInt++;
00168 generalRowInsertInp.arg2 = mapPriorityStr;
00169 generalRowInsertInp.arg3 = ruleNode->subtrees[0]->text;
00170 generalRowInsertInp.arg4 = ruleNameStr;
00171 generalRowInsertInp.arg5 = ruleCondStr;
00172 generalRowInsertInp.arg6 = ruleActionRecoveryStr;
00173 generalRowInsertInp.arg7= ruleType;
00174 generalRowInsertInp.arg8 = ruleIdStr;
00175 generalRowInsertInp.arg9 = myTime;
00176
00177 rc1 = rsGeneralRowInsert(rei->rsComm, &generalRowInsertInp);
00178 }
00179
00180 return(rc1);
00181 }
00182 int
00183 readRuleSetFromDB(char *ruleBaseName, char *versionStr, RuleSet *ruleSet, ruleExecInfo_t *rei, rError_t *errmsg, Region *r)
00184 {
00185
00186 Env *env = newEnv(newHashTable2(100, r), NULL, NULL, r);
00187 char ruleStr[MAX_RULE_LEN * 4];
00188
00189
00190 char *ruleHead = "testrule(*A, *B)";
00191 char *ruleCondition = "(true())";
00192 char *ruleAction = "{writeLine(\"stdout\", \"*A, *B\");}";
00193 char *ruleRecovery = "";
00194 if(strlen(ruleRecovery) == 0) {
00195
00196 if(ruleAction[0] == '{') {
00197 snprintf(ruleStr, MAX_RULE_LEN * 4, "%s { on(%s) %s }", ruleHead, ruleCondition, ruleAction);
00198 } else {
00199 snprintf(ruleStr, MAX_RULE_LEN * 4, "%s = %s", ruleHead, ruleAction);
00200 }
00201 } else {
00202 snprintf(ruleStr, MAX_RULE_LEN * 4, "%s|%s|%s|%s", ruleHead, ruleCondition, ruleAction, ruleRecovery);
00203 }
00204 Pointer *p = newPointer2(ruleStr);
00205 int errloc;
00206 int errcode = parseRuleSet(p, ruleSet, env, &errloc, errmsg, r);
00207 deletePointer(p);
00208 if(errcode<0) {
00209
00210 return errcode;
00211 }
00212
00213 return(0);
00214 }
00215
00216 char *
00217 getValByKey (keyValPair_t *condInput, char *keyWord)
00218 {
00219 int i;
00220
00221 if (condInput == NULL) {
00222 return (NULL);
00223 }
00224
00225 for (i = 0; i < condInput->len; i++) {
00226 if (strcmp (condInput->keyWord[i], keyWord) == 0) {
00227 return (condInput->value[i]);
00228 }
00229 }
00230
00231 return (NULL);
00232 }
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249 int
00250 parseMspForDataObjInp (msParam_t *inpParam, dataObjInp_t *dataObjInpCache,
00251 dataObjInp_t **outDataObjInp, int outputToCache)
00252 {
00253 *outDataObjInp = NULL;
00254
00255 if (inpParam == NULL) {
00256 rodsLog (LOG_ERROR,
00257 "parseMspForDataObjInp: input inpParam is NULL");
00258 return (SYS_INTERNAL_NULL_INPUT_ERR);
00259 }
00260
00261 if (strcmp (inpParam->type, STR_MS_T) == 0) {
00262
00263 if (dataObjInpCache == NULL) {
00264 dataObjInpCache = (dataObjInp_t *)malloc (sizeof (dataObjInp_t));
00265 }
00266 memset (dataObjInpCache, 0, sizeof (dataObjInp_t));
00267 *outDataObjInp = dataObjInpCache;
00268 if (strcmp ((char *) inpParam->inOutStruct, "null") != 0) {
00269 rstrcpy (dataObjInpCache->objPath, (char*)inpParam->inOutStruct,
00270 MAX_NAME_LEN);
00271 }
00272 return (0);
00273 } else if (strcmp (inpParam->type, DataObjInp_MS_T) == 0) {
00274 if (outputToCache == 1) {
00275 dataObjInp_t *tmpDataObjInp;
00276 tmpDataObjInp = (dataObjInp_t *)inpParam->inOutStruct;
00277 if (dataObjInpCache == NULL) {
00278 dataObjInpCache = (dataObjInp_t *)malloc (sizeof (dataObjInp_t));
00279 }
00280 *dataObjInpCache = *tmpDataObjInp;
00281
00282
00283 memset (&tmpDataObjInp->condInput, 0, sizeof (keyValPair_t));
00284 *outDataObjInp = dataObjInpCache;
00285 } else {
00286 *outDataObjInp = (dataObjInp_t *) inpParam->inOutStruct;
00287 }
00288 return (0);
00289 } else if (strcmp (inpParam->type, KeyValPair_MS_T) == 0) {
00290
00291 char *dVal, *cVal;
00292 keyValPair_t *kW;
00293 kW = (keyValPair_t *)inpParam->inOutStruct;
00294 if ((dVal = getValByKey (kW,"DATA_NAME")) == NULL)
00295 return(USER_PARAM_TYPE_ERR);
00296 if ((cVal = getValByKey (kW,"COLL_NAME")) == NULL)
00297 return(USER_PARAM_TYPE_ERR);
00298
00299 if (dataObjInpCache == NULL) {
00300 dataObjInpCache = (dataObjInp_t *)malloc (sizeof (dataObjInp_t));
00301 }
00302
00303 memset (dataObjInpCache, 0, sizeof (dataObjInp_t));
00304 snprintf (dataObjInpCache->objPath, MAX_NAME_LEN, "%s/%s", cVal,dVal);
00305 *outDataObjInp = dataObjInpCache;
00306 return(0);
00307 } else {
00308 rodsLog (LOG_ERROR,
00309 "parseMspForDataObjInp: Unsupported input Param1 type %s",
00310 inpParam->type);
00311 return (USER_PARAM_TYPE_ERR);
00312 }
00313 }
00314
00315
00316
00317
00318 int
00319 parseMspForCollInp (msParam_t *inpParam, collInp_t *collInpCache,
00320 collInp_t **outCollInp, int outputToCache)
00321 {
00322 *outCollInp = NULL;
00323
00324 if (inpParam == NULL) {
00325 rodsLog (LOG_ERROR,
00326 "parseMspForCollInp: input inpParam is NULL");
00327 return (SYS_INTERNAL_NULL_INPUT_ERR);
00328 }
00329
00330 if (strcmp (inpParam->type, STR_MS_T) == 0) {
00331
00332 if (collInpCache == NULL) {
00333 collInpCache = (collInp_t *)malloc (sizeof (collInp_t));
00334 }
00335 memset (collInpCache, 0, sizeof (collInp_t));
00336 *outCollInp = collInpCache;
00337 if (strcmp ((char *) inpParam->inOutStruct, "null") != 0) {
00338 rstrcpy (collInpCache->collName, (char*)inpParam->inOutStruct,
00339 MAX_NAME_LEN);
00340 }
00341 return (0);
00342 } else if (strcmp (inpParam->type, CollInp_MS_T) == 0) {
00343 if (outputToCache == 1) {
00344 collInp_t *tmpCollInp;
00345 tmpCollInp = (collInp_t *)inpParam->inOutStruct;
00346 if (collInpCache == NULL) {
00347 collInpCache = (collInp_t *)malloc (sizeof (collInp_t));
00348 }
00349 *collInpCache = *tmpCollInp;
00350
00351
00352 memset (&tmpCollInp->condInput, 0, sizeof (keyValPair_t));
00353 *outCollInp = collInpCache;
00354 } else {
00355 *outCollInp = (collInp_t *) inpParam->inOutStruct;
00356 }
00357 return (0);
00358 } else {
00359 rodsLog (LOG_ERROR,
00360 "parseMspForCollInp: Unsupported input Param1 type %s",
00361 inpParam->type);
00362 return (USER_PARAM_TYPE_ERR);
00363 }
00364 }
00365
00366 int
00367 parseMspForDataObjCopyInp (msParam_t *inpParam,
00368 dataObjCopyInp_t *dataObjCopyInpCache, dataObjCopyInp_t **outDataObjCopyInp)
00369 {
00370 *outDataObjCopyInp = NULL;
00371 if (inpParam == NULL) {
00372 rodsLog (LOG_ERROR,
00373 "parseMspForDataObjCopyInp: input inpParam is NULL");
00374 return (SYS_INTERNAL_NULL_INPUT_ERR);
00375 }
00376
00377 if (strcmp (inpParam->type, STR_MS_T) == 0) {
00378
00379 memset (dataObjCopyInpCache, 0, sizeof (dataObjCopyInp_t));
00380 rstrcpy (dataObjCopyInpCache->srcDataObjInp.objPath,
00381 (char *) inpParam->inOutStruct, MAX_NAME_LEN);
00382 *outDataObjCopyInp = dataObjCopyInpCache;
00383 } else if (strcmp (inpParam->type, DataObjCopyInp_MS_T) == 0) {
00384 *outDataObjCopyInp = (dataObjCopyInp_t*)inpParam->inOutStruct;
00385 } else if (strcmp (inpParam->type, DataObjInp_MS_T) == 0) {
00386 memset (dataObjCopyInpCache, 0, sizeof (dataObjCopyInp_t));
00387 dataObjCopyInpCache->srcDataObjInp =
00388 *(dataObjInp_t *)inpParam->inOutStruct;
00389 *outDataObjCopyInp = dataObjCopyInpCache;
00390 } else if (strcmp (inpParam->type, KeyValPair_MS_T) == 0) {
00391
00392 char *dVal, *cVal;
00393 keyValPair_t *kW;
00394 kW = (keyValPair_t *)inpParam->inOutStruct;
00395 if ((dVal = getValByKey (kW,"DATA_NAME")) == NULL)
00396 return(USER_PARAM_TYPE_ERR);
00397 if ((cVal = getValByKey (kW,"COLL_NAME")) == NULL)
00398 return(USER_PARAM_TYPE_ERR);
00399 memset (dataObjCopyInpCache, 0, sizeof (dataObjCopyInp_t));
00400 snprintf (dataObjCopyInpCache->srcDataObjInp.objPath, MAX_NAME_LEN, "%s/%s", cVal,dVal);
00401 *outDataObjCopyInp = dataObjCopyInpCache;
00402 return(0);
00403 } else {
00404 rodsLog (LOG_ERROR,
00405 "parseMspForDataObjCopyInp: Unsupported input Param1 type %s",
00406 inpParam->type);
00407 return (USER_PARAM_TYPE_ERR);
00408 }
00409 return (0);
00410 }
00411
00412
00413
00414
00415
00416 int
00417 parseMspForCondInp (msParam_t *inpParam, keyValPair_t *condInput,
00418 char *condKw)
00419 {
00420 if (inpParam != NULL) {
00421 if (strcmp (inpParam->type, STR_MS_T) == 0) {
00422
00423 if (strcmp ((char *) inpParam->inOutStruct, "null") != 0) {
00424 addKeyVal (condInput, condKw,
00425 (char *) inpParam->inOutStruct);
00426 }
00427 } else {
00428 rodsLog (LOG_ERROR,
00429 "parseMspForCondInp: Unsupported input Param type %s",
00430 inpParam->type);
00431 return (USER_PARAM_TYPE_ERR);
00432 }
00433 }
00434 return (0);
00435 }
00436
00437
00438
00439
00440
00441 int
00442 parseMspForCondKw (msParam_t *inpParam, keyValPair_t *condInput)
00443 {
00444 if (inpParam != NULL) {
00445 if (strcmp (inpParam->type, STR_MS_T) == 0) {
00446
00447 if (strcmp ((char *) inpParam->inOutStruct, "null") != 0 &&
00448 strlen ((const char*)inpParam->inOutStruct) > 0) {
00449 addKeyVal (condInput, (char *) inpParam->inOutStruct, "");
00450 }
00451 } else {
00452 rodsLog (LOG_ERROR,
00453 "parseMspForCondKw: Unsupported input Param type %s",
00454 inpParam->type);
00455 return (USER_PARAM_TYPE_ERR);
00456 }
00457 }
00458 return (0);
00459 }
00460
00461 int
00462 parseMspForPhyPathReg (msParam_t *inpParam, keyValPair_t *condInput)
00463 {
00464 char *tmpStr;
00465
00466 if (inpParam != NULL) {
00467 if (strcmp (inpParam->type, STR_MS_T) == 0) {
00468 tmpStr = (char *) inpParam->inOutStruct;
00469
00470 if (tmpStr != NULL && strlen (tmpStr) > 0 &&
00471 strcmp (tmpStr, "null") != 0) {
00472 if (strcmp (tmpStr, COLLECTION_KW) == 0) {
00473 addKeyVal (condInput, COLLECTION_KW, "");
00474 } else if (strcmp (tmpStr, MOUNT_POINT_STR) == 0) {
00475 addKeyVal (condInput, COLLECTION_TYPE_KW, MOUNT_POINT_STR);
00476 } else if (strcmp (tmpStr, LINK_POINT_STR) == 0) {
00477 addKeyVal (condInput, COLLECTION_TYPE_KW, LINK_POINT_STR);
00478 } else if (strcmp (tmpStr, UNMOUNT_STR) == 0) {
00479 addKeyVal (condInput, COLLECTION_TYPE_KW, UNMOUNT_STR);
00480 }
00481 }
00482 } else {
00483 rodsLog (LOG_ERROR,
00484 "parseMspForCondKw: Unsupported input Param type %s",
00485 inpParam->type);
00486 return (USER_PARAM_TYPE_ERR);
00487 }
00488 }
00489 return (0);
00490 }
00491
00492 int
00493 parseMspForPosInt (msParam_t *inpParam)
00494 {
00495 int myInt;
00496
00497 if (strcmp (inpParam->type, STR_MS_T) == 0) {
00498
00499 if (strcmp ((char *) inpParam->inOutStruct, "null") == 0) {
00500 return (SYS_NULL_INPUT);
00501 }
00502 myInt = atoi ((const char*)inpParam->inOutStruct);
00503 } else if (strcmp (inpParam->type, INT_MS_T) == 0 ||
00504 strcmp (inpParam->type, BUF_LEN_MS_T) == 0) {
00505 myInt = *(int *)inpParam->inOutStruct;
00506 } else {
00507 rodsLog (LOG_ERROR,
00508 "parseMspForPosInt: Unsupported input Param type %s",
00509 inpParam->type);
00510 return (USER_PARAM_TYPE_ERR);
00511 }
00512 if (myInt < 0) {
00513 rodsLog (LOG_DEBUG,
00514 "parseMspForPosInt: parsed int %d is negative", myInt);
00515 }
00516 return (myInt);
00517 }
00518
00519 char *
00520 parseMspForStr (msParam_t *inpParam)
00521 {
00522 if (inpParam == NULL || inpParam->inOutStruct == NULL) {
00523 return (NULL);
00524 }
00525
00526 if (strcmp (inpParam->type, STR_MS_T) != 0) {
00527 rodsLog (LOG_ERROR,
00528 "parseMspForStr: inpParam type %s is not STR_MS_T",
00529 inpParam->type);
00530 }
00531
00532 if (strcmp ((char *) inpParam->inOutStruct, "null") == 0) {
00533 return (NULL);
00534 }
00535
00536 return (char *)(inpParam->inOutStruct);
00537 }
00538
00539 int
00540 parseMspForExecCmdInp (msParam_t *inpParam,
00541 execCmd_t *execCmdInpCache, execCmd_t **ouExecCmdInp)
00542 {
00543 *ouExecCmdInp = NULL;
00544 if (inpParam == NULL) {
00545 rodsLog (LOG_ERROR,
00546 "parseMspForExecCmdInp: input inpParam is NULL");
00547 return (SYS_INTERNAL_NULL_INPUT_ERR);
00548 }
00549
00550 if (strcmp (inpParam->type, STR_MS_T) == 0) {
00551
00552 memset (execCmdInpCache, 0, sizeof (execCmd_t));
00553 rstrcpy (execCmdInpCache->cmd,
00554 (char *) inpParam->inOutStruct, LONG_NAME_LEN);
00555 *ouExecCmdInp = execCmdInpCache;
00556 } else if (strcmp (inpParam->type, ExecCmd_MS_T) == 0) {
00557 *ouExecCmdInp = (execCmd_t*)inpParam->inOutStruct;
00558 } else {
00559 rodsLog (LOG_ERROR,
00560 "parseMspForExecCmdInp: Unsupported input Param1 type %s",
00561 inpParam->type);
00562 return (USER_PARAM_TYPE_ERR);
00563 }
00564 return(0);
00565 }
00566
00567 int addRErrorMsg (rError_t *myError, int status, char *msg) {
00568 rErrMsg_t **newErrMsg;
00569 int newLen;
00570 int i;
00571
00572 if (myError == NULL) {
00573 return (SYS_INTERNAL_NULL_INPUT_ERR);
00574 }
00575
00576 if ((myError->len % PTR_ARRAY_MALLOC_LEN) == 0) {
00577 newLen = myError->len + PTR_ARRAY_MALLOC_LEN;
00578 newErrMsg = (rErrMsg_t **) malloc (newLen * sizeof (newErrMsg));
00579 memset (newErrMsg, 0, newLen * sizeof (newErrMsg));
00580 for (i = 0; i < myError->len; i++) {
00581 newErrMsg[i] = myError->errMsg[i];
00582 }
00583 if (myError->errMsg != NULL)
00584 free (myError->errMsg);
00585 myError->errMsg = newErrMsg;
00586 }
00587
00588 myError->errMsg[myError->len] = (rErrMsg_t*)malloc (sizeof (rErrMsg_t));
00589 strncpy (myError->errMsg[myError->len]->msg, msg, ERR_MSG_LEN-1);
00590 myError->errMsg[myError->len]->status = status;
00591 myError->len++;
00592
00593 return (0);
00594 }
00595
00596 int
00597 freeRErrorContent (rError_t *myError)
00598 {
00599 int i;
00600
00601 if (myError == NULL) {
00602 return (0);
00603 }
00604
00605 if (myError->len > 0) {
00606 for (i = 0; i < myError->len; i++) {
00607 free (myError->errMsg[i]);
00608 }
00609 free (myError->errMsg);
00610 }
00611
00612 memset (myError, 0, sizeof (rError_t));
00613
00614 return (0);
00615 }
00616
00617 int
00618 clearMsParam (msParam_t *msParam, int freeStruct)
00619 {
00620 if (msParam == NULL)
00621 return (0);
00622
00623 if (msParam->label != NULL)
00624 free (msParam->label);
00625
00626
00627 if (msParam->inOutStruct != NULL && (freeStruct > 0 ||
00628 (msParam->type != NULL && strcmp (msParam->type, STR_MS_T) == 0))) {
00629 free (msParam->inOutStruct);
00630 }
00631 if (msParam->type != NULL)
00632 free (msParam->type);
00633
00634 memset (msParam, 0, sizeof (msParam_t));
00635 return (0);
00636 }
00637 int
00638 clearMsParamArray (msParamArray_t *msParamArray, int freeStruct) {
00639 int i;
00640
00641 if (msParamArray == NULL) {
00642 return 0;
00643 }
00644
00645 for (i = 0; i < msParamArray->len; i++) {
00646 clearMsParam (msParamArray->msParam[i], freeStruct);
00647 free (msParamArray->msParam[i]);
00648 }
00649
00650 if (msParamArray->len > 0 && msParamArray->msParam != NULL) {
00651 free (msParamArray->msParam);
00652 memset (msParamArray, 0, sizeof (msParamArray_t));
00653 }
00654
00655 return (0);
00656 }
00657 char* rstrcpy(char *dest, char *src, int n) {
00658 strncpy(dest, src, n);
00659 return dest;
00660 }
00661 int rSplitStr(char *all, char *head, int headLen, char *tail, int tailLen, char sep) {
00662 char *i = strchr(all, sep);
00663 if(i==NULL) {
00664 tail[0] = '\0';
00665 strcpy(head, all);
00666 } else {
00667 strcpy(tail, i+1);
00668 strncpy(head, all, i-all);
00669 head[i-all] = '\0';
00670 }
00671 return 0;
00672 }
00673
00674
00675 int reDebug(RuleEngineEvent label, int flag, RuleEngineEventParam *param, Node *node, Env *env, ruleExecInfo_t *rei) { return 0; }
00676
00677 int copyRuleExecInfo(ruleExecInfo_t *a, ruleExecInfo_t *b) {return 0;}
00678 void *mallocAndZero(int size) { return NULL; }
00679 int freeRuleExecInfoStruct(ruleExecInfo_t *rei, int i) { return 0; }
00680
00681 int addKeyVal(keyValPair_t *k, char * key, char *val) { return 0;}
00682 int clearKeyVal(keyValPair_t *k) { return 0; }
00683 char * getAttrNameFromAttrId(int id) {return NULL;}
00684 int msiExecGenQuery(msParam_t* genQueryInParam, msParam_t* genQueryOutParam, ruleExecInfo_t *rei) {
00685 return 0;
00686 }
00687 int _delayExec(char *inActionCall, char *recoveryActionCall,
00688 char *delayCondition, ruleExecInfo_t *rei) {
00689 return 0;
00690 }
00691
00692 int chlSetAVUMetadata(rsComm_t *rsComm, char *type, char *ame, char *attr, char *value, char *unit) {
00693 return 0;
00694 }
00695
00696 int msiGetMoreRows(msParam_t* genQueryInpParam, msParam_t* genQueryOutParam, msParam_t *contInxParam, ruleExecInfo_t *rei) {
00697 return 0;
00698 }
00699 int msiCloseGenQuery(msParam_t* genQueryInpParam, msParam_t* genQueryOutParam, ruleExecInfo_t *rei) {
00700 return 0;
00701 }
00702
00703
00704 int rsOpenCollection (rsComm_t *rsComm, collInp_t *openCollInp) {
00705 return 0;
00706 }
00707 int rsCloseCollection (rsComm_t *rsComm, int *handleInxInp) {
00708 return 0;
00709 }
00710 int rsReadCollection (rsComm_t *rsComm, int *handleInxInp, collEnt_t **collEnt) {
00711 return 0;
00712 }
00713
00714 int
00715 rsExecMyRule (rsComm_t *rsComm, execMyRuleInp_t *execMyRuleInp,
00716 msParamArray_t **outParamArray) {
00717 return 0;
00718 }
00719 int
00720 parseHostAddrStr (char *hostAddr, rodsHostAddr_t *addr) {
00721 return 0;
00722 }
00723
00724 int
00725 checkStringForSystem( char *inString) {
00726 return 0;
00727 }
00728
00729 int
00730 addInxIval (inxIvalPair_t *inxIvalPair, int inx, int value) {
00731 return 0;
00732 }
00733 int
00734 addInxVal (inxValPair_t *inxValPair, int inx, char *value) {
00735 return 0;
00736 }
00737
00738 int
00739 rsGenQuery (rsComm_t *rsComm, genQueryInp_t *genQueryInp,
00740 genQueryOut_t **genQueryOut) {
00741 return 0;
00742 }
00743
00744 sqlResult_t *
00745 getSqlResultByInx (genQueryOut_t *genQueryOut, int attriInx) {
00746 return NULL;
00747 }
00748
00749 int
00750 freeGenQueryOut (genQueryOut_t **genQueryOut) {
00751 return 0;
00752 }
00753
00754 int
00755 clearGenQueryInp(genQueryInp_t *gqinp) {
00756 return 0;
00757 }
00758
00759 int getDataObjInfoIncSpecColl(rsComm_t *rsComm, dataObjInp_t *doinp, dataObjInfo_t **doi) {
00760 return 0;
00761 }
00762
00763 int trimWS (char *s) {
00764 return 0;
00765 }
00766
00767 rulevardef_t coreRuleVarDef;
00768 rulevardef_t appRuleVarDef;
00769
00770 int
00771 replErrorStack (rError_t *srcRError, rError_t *destRError)
00772 {
00773 int i, len;
00774 rErrMsg_t *errMsg;
00775
00776 if (srcRError == NULL || destRError == NULL) {
00777 return USER__NULL_INPUT_ERR;
00778 }
00779
00780 len = srcRError->len;
00781
00782 for (i = 0;i < len; i++) {
00783 errMsg = srcRError->errMsg[i];
00784 addRErrorMsg (destRError, errMsg->status, errMsg->msg);
00785 }
00786 return 0;
00787 }
00788
00789 int freeAllDataObjInfo(dataObjInfo_t *dataObjInfoHead) {
00790 return 0;
00791 }
00792
00793
00794
00795 #endif
00796