00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "reGlobalsExtern.h"
00010 #include "rsGlobalExtern.h"
00011 #include "dataObjCreate.h"
00012 #include "objMetaOpr.h"
00013 #include "regDataObj.h"
00014
00015 #include "miscServerFunct.h"
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 int
00062 msiAdmChangeCoreIRB(msParam_t *newFileNameParam, ruleExecInfo_t *rei)
00063 {
00064
00065
00066
00067 char sysString[1000];
00068 int i;
00069
00070 RE_TEST_MACRO ("Loopback on admChangeCoreIRB");
00071
00072 if (strcmp (newFileNameParam->type,STR_MS_T) != 0)
00073 return(USER_PARAM_TYPE_ERR);
00074
00075 if ((i = isUserPrivileged(rei->rsComm)) != 0)
00076 return (i);
00077
00078 snprintf(sysString, 999, "cp %s/reConfigs/%s %s/reConfigs/core.irb",
00079 (char *) getConfigDir (), (char *) newFileNameParam->inOutStruct,
00080 (char *) getConfigDir ());
00081 system(sysString);
00082
00083
00084 return(0);
00085 }
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126 int msiAdmAppendToTopOfCoreIRB(msParam_t *newFileNameParam, ruleExecInfo_t *rei)
00127 {
00128
00129
00130
00131 char sysString[1000];
00132 int i;
00133 char *conDir;
00134
00135 RE_TEST_MACRO ("Loopback on admAppendToTopOfCoreIRB");
00136
00137 if (strcmp (newFileNameParam->type,STR_MS_T) != 0)
00138 return(USER_PARAM_TYPE_ERR);
00139
00140 if ((i = isUserPrivileged(rei->rsComm)) != 0)
00141 return (i);
00142 conDir = getConfigDir ();
00143 snprintf(sysString, 999, "cat %s/reConfigs/%s %s/reConfigs/core.irb > %s/reConfigs/admtmpcore.irb",
00144 conDir, (char *) newFileNameParam->inOutStruct,
00145 conDir, conDir);
00146 system(sysString);
00147 snprintf(sysString, 999, "mv %s/reConfigs/admtmpcore.irb %s/reConfigs/core.irb",
00148 conDir,conDir);
00149 system(sysString);
00150 return(0);
00151
00152
00153 }
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192 int msiAdmShowDVM(msParam_t *bufParam, ruleExecInfo_t *rei)
00193 {
00194 int i;
00195
00196 _writeString("stdout","----------------------------- DVM -----------------------------\n",rei);
00197
00198 i = _admShowDVM(bufParam, rei, &appRuleVarDef,0);
00199 if (i != 0)
00200 return(i);
00201 i = _admShowDVM(bufParam, rei, &coreRuleVarDef,1000);
00202 _writeString("stdout","----------------------------- DVM -----------------------------\n",rei);
00203 return(i);
00204 }
00205
00206 int _admShowDVM(msParam_t *bufParam, ruleExecInfo_t *rei, rulevardef_t *inRuleVarDef, int inx)
00207 {
00208 int j;
00209 char outStr[MAX_RULE_LENGTH];
00210
00211 _writeString("stdout","---------------------------------------------------------------\n",rei);
00212 for( j = 0 ; j < inRuleVarDef->MaxNumOfDVars ; j++) {
00213 sprintf(outStr," %-5i %-15.15s %s ===> %s\n",j+inx,inRuleVarDef->action[j],
00214 inRuleVarDef->varName[j], inRuleVarDef->var2CMap[j]);
00215 _writeString("stdout",outStr,rei);
00216 }
00217 _writeString("stdout","---------------------------------------------------------------\n",rei);
00218 return(0);
00219 }
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258 int msiAdmShowFNM(msParam_t *bufParam, ruleExecInfo_t *rei)
00259 {
00260 int i;
00261
00262 _writeString("stdout","----------------------------- FNM -----------------------------\n",rei);
00263 i = _admShowFNM(bufParam, rei, &appRuleFuncMapDef,0);
00264 if (i != 0)
00265 return(i);
00266 i = _admShowFNM(bufParam, rei, &coreRuleFuncMapDef,1000);
00267 _writeString("stdout","----------------------------- FNM -----------------------------\n",rei);
00268 return(i);
00269 }
00270
00271 int _admShowFNM(msParam_t *bufParam, ruleExecInfo_t *rei, rulefmapdef_t *inRuleFuncMapDef, int inx)
00272 {
00273
00274 int j;
00275 char outStr[MAX_RULE_LENGTH];
00276
00277 _writeString("stdout","---------------------------------------------------------------\n",rei);
00278 for( j = 0 ; j < inRuleFuncMapDef->MaxNumOfFMaps ; j++) {
00279 sprintf(outStr," %-5i %s ===> %s\n",j+inx, inRuleFuncMapDef->funcName[j], inRuleFuncMapDef->func2CMap[j]);
00280 _writeString("stdout",outStr,rei);
00281 }
00282 _writeString("stdout","---------------------------------------------------------------\n",rei);
00283 return(0);
00284
00285 }
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321 int msiAdmShowIRB(msParam_t *bufParam, ruleExecInfo_t *rei)
00322 {
00323 int i;
00324
00325
00326 i = _admShowIRB(bufParam, rei, &appRuleStrct, 0);
00327 if (i != 0)
00328 return(i);
00329 i = _admShowIRB(bufParam, rei, &coreRuleStrct, 1000);
00330 return(i);
00331 }
00332
00333 int _admShowIRB(msParam_t *bufParam, ruleExecInfo_t *rei, ruleStruct_t *inRuleStrct, int inx)
00334 {
00335 int n, i,j;
00336 char outStr[MAX_RULE_LENGTH];
00337 char ruleCondition[MAX_RULE_LENGTH];
00338 char ruleAction[MAX_RULE_LENGTH];
00339 char ruleRecovery[MAX_RULE_LENGTH];
00340 char ruleHead[MAX_ACTION_SIZE];
00341 char ruleBase[MAX_ACTION_SIZE];
00342 char *actionArray[MAX_ACTION_IN_RULE];
00343 char *recoveryArray[MAX_ACTION_IN_RULE];
00344
00345 char ruleSet[RULE_SET_DEF_LENGTH];
00346 char oldRuleBase[MAX_ACTION_SIZE];
00347
00348 strcpy(ruleSet,"");
00349 strcpy(oldRuleBase,"");
00350
00351 for( j = inx ; (j-inx) < inRuleStrct->MaxNumOfRules ; j++) {
00352 getRule(j, ruleBase, ruleHead, ruleCondition,ruleAction,ruleRecovery, MAX_RULE_LENGTH);
00353 if (strcmp(oldRuleBase,ruleBase)) {
00354 if (strlen(oldRuleBase) > 0)
00355 _writeString("stdout","---------------------------------------------------------------\n",rei);
00356 strcpy(oldRuleBase,ruleBase);
00357 }
00358 n = getActionRecoveryList(ruleAction,ruleRecovery,actionArray,recoveryArray);
00359 sprintf(outStr," %-5i%s.%s\n",j,ruleBase, ruleHead);
00360 _writeString("stdout",outStr,rei);
00361 if (strlen(ruleCondition) != 0)
00362 sprintf(outStr," IF (%s) {\n",ruleCondition);
00363 else
00364 sprintf(outStr," {\n");
00365 _writeString("stdout",outStr,rei);
00366 for (i = 0; i < n; i++) {
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381 if (strlen(actionArray[i]) < 20) {
00382 if (recoveryArray[i] == NULL ||
00383 strlen(recoveryArray[i]) == 0 ||
00384 !strcmp(recoveryArray[i],"nop") ||
00385 !strcmp(recoveryArray[i],"null"))
00386 sprintf(outStr," %-20.20s\n",actionArray[i]);
00387 else
00388 sprintf(outStr," %-20.20s[%s]\n",actionArray[i],recoveryArray[i]);
00389 }
00390 else {
00391 if (recoveryArray[i] == NULL ||
00392 strlen(recoveryArray[i]) == 0 ||
00393 !strcmp(recoveryArray[i],"nop") ||
00394 !strcmp(recoveryArray[i],"null"))
00395 sprintf(outStr," %s\n",actionArray[i]);
00396 else
00397 sprintf(outStr," %s [%s]\n",actionArray[i],recoveryArray[i]);
00398 }
00399 _writeString("stdout",outStr,rei);
00400 }
00401 _writeString("stdout"," }\n",rei);
00402 }
00403 _writeString("stdout","---------------------------------------------------------------\n",rei);
00404 return(0);
00405 }
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444 int msiAdmClearAppRuleStruct(ruleExecInfo_t *rei)
00445 {
00446
00447 int i;
00448
00449 if ((i = isUserPrivileged(rei->rsComm)) != 0)
00450 return (i);
00451 i = clearRuleStruct(&appRuleStrct);
00452 if (i < 0)
00453 return(i);
00454 i = clearDVarStruct(&appRuleVarDef);
00455 if (i < 0)
00456 return(i);
00457 i = clearFuncMapStruct(&appRuleFuncMapDef);
00458 return(i);
00459
00460 }
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500 int msiAdmInsertRulesFromStructIntoDB(msParam_t *inIrbBaseNameParam, msParam_t *inCoreRuleStruct, ruleExecInfo_t *rei)
00501 {
00502
00503 ruleStruct_t *coreRuleStruct;
00504 int i;
00505
00506 if ((i = isUserPrivileged(rei->rsComm)) != 0)
00507 return (i);
00508
00509 RE_TEST_MACRO ("Loopback on msiAdmInsertRulesFromStructIntoDB");
00510
00511 if (inIrbBaseNameParam == NULL || inCoreRuleStruct == NULL ||
00512 strcmp (inIrbBaseNameParam->type,STR_MS_T) != 0 ||
00513 strcmp (inCoreRuleStruct->type,RuleStruct_MS_T) != 0 ||
00514 inIrbBaseNameParam->inOutStruct == NULL ||
00515 inCoreRuleStruct->inOutStruct == NULL ||
00516 strlen((char *) inIrbBaseNameParam->inOutStruct) == 0 )
00517 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
00518
00519 coreRuleStruct = (ruleStruct_t *) inCoreRuleStruct->inOutStruct;
00520 i = insertRulesIntoDB((char *) inIrbBaseNameParam->inOutStruct, coreRuleStruct, rei);
00521 return(i);
00522
00523 }
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566 int
00567 msiGetRulesFromDBIntoStruct(msParam_t *inIrbBaseNameParam, msParam_t *inVersionParam,
00568 msParam_t *outCoreRuleStruct, ruleExecInfo_t *rei)
00569 {
00570
00571 int i;
00572 ruleStruct_t *coreRuleStrct;
00573
00574 RE_TEST_MACRO ("Loopback on msiGetRulesFromDBIntoStruct");
00575
00576 if (inIrbBaseNameParam == NULL ||
00577 strcmp (inIrbBaseNameParam->type,STR_MS_T) != 0 ||
00578 inIrbBaseNameParam->inOutStruct == NULL ||
00579 strlen((char *) inIrbBaseNameParam->inOutStruct) == 0 )
00580 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
00581 if (inVersionParam == NULL ||
00582 strcmp (inVersionParam->type,STR_MS_T) != 0 ||
00583 inVersionParam->inOutStruct == NULL ||
00584 strlen((char *) inVersionParam->inOutStruct) == 0 )
00585 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
00586 if (outCoreRuleStruct->type != NULL &&
00587 strcmp (outCoreRuleStruct->type,RuleStruct_MS_T) == 0 &&
00588 outCoreRuleStruct->inOutStruct != NULL) {
00589 coreRuleStrct = (ruleStruct_t *) outCoreRuleStruct->inOutStruct;
00590 }
00591 else {
00592 coreRuleStrct = (ruleStruct_t *) malloc (sizeof(ruleStruct_t));
00593 coreRuleStrct->MaxNumOfRules = 0;
00594 }
00595 i = readRuleStructFromDB((char*) inIrbBaseNameParam->inOutStruct, (char*) inVersionParam->inOutStruct, coreRuleStrct, rei);
00596 if (i != 0) {
00597 if (strcmp (outCoreRuleStruct->type,RuleStruct_MS_T) != 0 )
00598 free(coreRuleStrct);
00599 return(i);
00600 }
00601
00602 outCoreRuleStruct->inOutStruct = (void *) coreRuleStrct;
00603 if (outCoreRuleStruct->type == NULL ||
00604 strcmp (outCoreRuleStruct->type,RuleStruct_MS_T) != 0)
00605 outCoreRuleStruct->type = (char *) strdup(RuleStruct_MS_T);
00606 return(0);
00607 }
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650 int
00651 msiAdmWriteRulesFromStructIntoFile(msParam_t *inIrbFileNameParam, msParam_t *inCoreRuleStruct, ruleExecInfo_t *rei)
00652 {
00653 int i;
00654 ruleStruct_t *myRuleStruct;
00655
00656 if ((i = isUserPrivileged(rei->rsComm)) != 0)
00657 return (i);
00658
00659 RE_TEST_MACRO ("Loopback on msiAdmWriteRulesFromStructIntoFile");
00660
00661 if (inIrbFileNameParam == NULL || inCoreRuleStruct == NULL ||
00662 strcmp (inIrbFileNameParam->type,STR_MS_T) != 0 ||
00663 strcmp (inCoreRuleStruct->type,RuleStruct_MS_T) != 0 ||
00664 inIrbFileNameParam->inOutStruct == NULL ||
00665 strlen((char *) inIrbFileNameParam->inOutStruct) == 0 )
00666 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
00667
00668 myRuleStruct = (ruleStruct_t *) inCoreRuleStruct->inOutStruct;
00669 i = writeRulesIntoFile((char *) inIrbFileNameParam->inOutStruct, myRuleStruct, rei);
00670 return(i);
00671
00672 }
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713 int msiAdmReadDVMapsFromFileIntoStruct(msParam_t *inDvmFileNameParam, msParam_t *outCoreDVMapStruct, ruleExecInfo_t *rei)
00714 {
00715
00716 int i;
00717 dvmStruct_t *coreDVMapStrct;
00718
00719 if ((i = isUserPrivileged(rei->rsComm)) != 0)
00720 return (i);
00721
00722 RE_TEST_MACRO ("Loopback on msiAdmReadDVMapsFromFileIntoStruct");
00723
00724
00725 if (inDvmFileNameParam == NULL ||
00726 strcmp (inDvmFileNameParam->type,STR_MS_T) != 0 ||
00727 inDvmFileNameParam->inOutStruct == NULL ||
00728 strlen((char *) inDvmFileNameParam->inOutStruct) == 0 )
00729 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
00730 if (outCoreDVMapStruct->type != NULL &&
00731 strcmp (outCoreDVMapStruct->type,DVMapStruct_MS_T) == 0 &&
00732 outCoreDVMapStruct->inOutStruct != NULL) {
00733 coreDVMapStrct = (dvmStruct_t *) outCoreDVMapStruct->inOutStruct;
00734 }
00735 else {
00736 coreDVMapStrct = (dvmStruct_t *) malloc (sizeof(dvmStruct_t));
00737 coreDVMapStrct->MaxNumOfDVars = 0;
00738 }
00739 i = readDVarStructFromFile((char*) inDvmFileNameParam->inOutStruct, coreDVMapStrct);
00740 if (i != 0) {
00741 if (strcmp (outCoreDVMapStruct->type,DVMapStruct_MS_T) != 0 )
00742 free(coreDVMapStrct);
00743 return(i);
00744 }
00745
00746 outCoreDVMapStruct->inOutStruct = (void *) coreDVMapStrct;
00747 if (outCoreDVMapStruct->type == NULL ||
00748 strcmp (outCoreDVMapStruct->type,DVMapStruct_MS_T) != 0)
00749 outCoreDVMapStruct->type = (char *) strdup(DVMapStruct_MS_T);
00750 return(0);
00751 }
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790 int msiAdmInsertDVMapsFromStructIntoDB(msParam_t *inDvmBaseNameParam, msParam_t *inCoreDVMapStruct, ruleExecInfo_t *rei)
00791 {
00792
00793 dvmStruct_t *coreDVMapStruct;
00794 int i;
00795
00796 if ((i = isUserPrivileged(rei->rsComm)) != 0)
00797 return (i);
00798
00799 RE_TEST_MACRO ("Loopback on msiAdmInsertDVMapsFromStructIntoDB");
00800
00801 if (inDvmBaseNameParam == NULL || inCoreDVMapStruct == NULL ||
00802 strcmp (inDvmBaseNameParam->type,STR_MS_T) != 0 ||
00803 strcmp (inCoreDVMapStruct->type,DVMapStruct_MS_T) != 0 ||
00804 inDvmBaseNameParam->inOutStruct == NULL ||
00805 inCoreDVMapStruct->inOutStruct == NULL ||
00806 strlen((char *) inDvmBaseNameParam->inOutStruct) == 0 )
00807 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
00808
00809 coreDVMapStruct = (dvmStruct_t *) inCoreDVMapStruct->inOutStruct;
00810 i = insertDVMapsIntoDB((char *) inDvmBaseNameParam->inOutStruct, coreDVMapStruct, rei);
00811 return(i);
00812
00813 }
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853 int
00854 msiGetDVMapsFromDBIntoStruct(msParam_t *inDvmBaseNameParam, msParam_t *inVersionParam, msParam_t *outCoreDVMapStruct, ruleExecInfo_t *rei)
00855 {
00856
00857 int i;
00858 dvmStruct_t *coreDVMapStrct;
00859
00860 RE_TEST_MACRO ("Loopback on msiGetDVMapsFromDBIntoStruct");
00861
00862 if (inDvmBaseNameParam == NULL ||
00863 strcmp (inDvmBaseNameParam->type,STR_MS_T) != 0 ||
00864 inDvmBaseNameParam->inOutStruct == NULL ||
00865 strlen((char *) inDvmBaseNameParam->inOutStruct) == 0 )
00866 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
00867 if (inVersionParam == NULL ||
00868 strcmp (inVersionParam->type,STR_MS_T) != 0 ||
00869 inVersionParam->inOutStruct == NULL ||
00870 strlen((char *) inVersionParam->inOutStruct) == 0 )
00871 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
00872 if (outCoreDVMapStruct->type != NULL &&
00873 strcmp (outCoreDVMapStruct->type,DVMapStruct_MS_T) == 0 &&
00874 outCoreDVMapStruct->inOutStruct != NULL) {
00875 coreDVMapStrct = (dvmStruct_t *) outCoreDVMapStruct->inOutStruct;
00876 }
00877 else {
00878 coreDVMapStrct = (dvmStruct_t *) malloc (sizeof(dvmStruct_t));
00879 coreDVMapStrct->MaxNumOfDVars = 0;
00880 }
00881 i = readDVMapStructFromDB((char*) inDvmBaseNameParam->inOutStruct, (char*) inVersionParam->inOutStruct, coreDVMapStrct, rei);
00882 if (i != 0) {
00883 if (strcmp (outCoreDVMapStruct->type,DVMapStruct_MS_T) != 0 )
00884 free(coreDVMapStrct);
00885 return(i);
00886 }
00887
00888 outCoreDVMapStruct->inOutStruct = (void *) coreDVMapStrct;
00889 if (outCoreDVMapStruct->type == NULL ||
00890 strcmp (outCoreDVMapStruct->type,DVMapStruct_MS_T) != 0)
00891 outCoreDVMapStruct->type = (char *) strdup(DVMapStruct_MS_T);
00892 return(0);
00893 }
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932 int
00933 msiAdmWriteDVMapsFromStructIntoFile(msParam_t *inDvmFileNameParam, msParam_t *inCoreDVMapStruct, ruleExecInfo_t *rei)
00934 {
00935 int i;
00936 dvmStruct_t *myDVMapStruct;
00937
00938 if ((i = isUserPrivileged(rei->rsComm)) != 0)
00939 return (i);
00940
00941 RE_TEST_MACRO ("Loopback on msiAdmWriteDVMapsFromStructIntoFile");
00942
00943 if (inDvmFileNameParam == NULL || inCoreDVMapStruct == NULL ||
00944 strcmp (inDvmFileNameParam->type,STR_MS_T) != 0 ||
00945 strcmp (inCoreDVMapStruct->type,DVMapStruct_MS_T) != 0 ||
00946 inDvmFileNameParam->inOutStruct == NULL ||
00947 strlen((char *) inDvmFileNameParam->inOutStruct) == 0 )
00948 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
00949
00950 myDVMapStruct = (dvmStruct_t *) inCoreDVMapStruct->inOutStruct;
00951 i = writeDVMapsIntoFile((char *) inDvmFileNameParam->inOutStruct, myDVMapStruct, rei);
00952 return(i);
00953
00954 }
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995 int msiAdmReadFNMapsFromFileIntoStruct(msParam_t *inFnmFileNameParam, msParam_t *outCoreFNMapStruct, ruleExecInfo_t *rei)
00996 {
00997
00998 int i;
00999 fnmapStruct_t *coreFNMapStrct;
01000
01001 if ((i = isUserPrivileged(rei->rsComm)) != 0)
01002 return (i);
01003
01004 RE_TEST_MACRO ("Loopback on msiAdmReadFNMapsFromFileIntoStruct");
01005
01006
01007 if (inFnmFileNameParam == NULL ||
01008 strcmp (inFnmFileNameParam->type,STR_MS_T) != 0 ||
01009 inFnmFileNameParam->inOutStruct == NULL ||
01010 strlen((char *) inFnmFileNameParam->inOutStruct) == 0 )
01011 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
01012 if (outCoreFNMapStruct->type != NULL &&
01013 strcmp (outCoreFNMapStruct->type,FNMapStruct_MS_T) == 0 &&
01014 outCoreFNMapStruct->inOutStruct != NULL) {
01015 coreFNMapStrct = (fnmapStruct_t *) outCoreFNMapStruct->inOutStruct;
01016 }
01017 else {
01018 coreFNMapStrct = (fnmapStruct_t *) malloc (sizeof(fnmapStruct_t));
01019 coreFNMapStrct->MaxNumOfFMaps = 0;
01020 }
01021 i = readFuncMapStructFromFile((char*) inFnmFileNameParam->inOutStruct, coreFNMapStrct);
01022 if (i != 0) {
01023 if (strcmp (outCoreFNMapStruct->type,FNMapStruct_MS_T) != 0 )
01024 free(coreFNMapStrct);
01025 return(i);
01026 }
01027
01028 outCoreFNMapStruct->inOutStruct = (void *) coreFNMapStrct;
01029 if (outCoreFNMapStruct->type == NULL ||
01030 strcmp (outCoreFNMapStruct->type,FNMapStruct_MS_T) != 0)
01031 outCoreFNMapStruct->type = (char *) strdup(FNMapStruct_MS_T);
01032 return(0);
01033 }
01034
01035
01036
01037
01038
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073 int msiAdmInsertFNMapsFromStructIntoDB(msParam_t *inFnmBaseNameParam, msParam_t *inCoreFNMapStruct, ruleExecInfo_t *rei)
01074 {
01075
01076 fnmapStruct_t *coreFNMapStruct;
01077 int i;
01078
01079 if ((i = isUserPrivileged(rei->rsComm)) != 0)
01080 return (i);
01081
01082 RE_TEST_MACRO ("Loopback on msiAdmInsertFNMapsFromStructIntoDB");
01083
01084 if (inFnmBaseNameParam == NULL || inCoreFNMapStruct == NULL ||
01085 strcmp (inFnmBaseNameParam->type,STR_MS_T) != 0 ||
01086 strcmp (inCoreFNMapStruct->type,FNMapStruct_MS_T) != 0 ||
01087 inFnmBaseNameParam->inOutStruct == NULL ||
01088 inCoreFNMapStruct->inOutStruct == NULL ||
01089 strlen((char *) inFnmBaseNameParam->inOutStruct) == 0 )
01090 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
01091
01092 coreFNMapStruct = (fnmapStruct_t *) inCoreFNMapStruct->inOutStruct;
01093 i = insertFNMapsIntoDB((char *) inFnmBaseNameParam->inOutStruct, coreFNMapStruct, rei);
01094 return(i);
01095
01096 }
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136 int
01137 msiGetFNMapsFromDBIntoStruct(msParam_t *inFnmBaseNameParam, msParam_t *inVersionParam, msParam_t *outCoreFNMapStruct, ruleExecInfo_t *rei)
01138 {
01139
01140 int i;
01141 fnmapStruct_t *coreFNMapStrct;
01142
01143 RE_TEST_MACRO ("Loopback on msiGetFNMapsFromDBIntoStruct");
01144
01145 if (inFnmBaseNameParam == NULL ||
01146 strcmp (inFnmBaseNameParam->type,STR_MS_T) != 0 ||
01147 inFnmBaseNameParam->inOutStruct == NULL ||
01148 strlen((char *) inFnmBaseNameParam->inOutStruct) == 0 )
01149 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
01150 if (inVersionParam == NULL ||
01151 strcmp (inVersionParam->type,STR_MS_T) != 0 ||
01152 inVersionParam->inOutStruct == NULL ||
01153 strlen((char *) inVersionParam->inOutStruct) == 0 )
01154 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
01155 if (outCoreFNMapStruct->type != NULL &&
01156 strcmp (outCoreFNMapStruct->type,FNMapStruct_MS_T) == 0 &&
01157 outCoreFNMapStruct->inOutStruct != NULL) {
01158 coreFNMapStrct = (fnmapStruct_t *) outCoreFNMapStruct->inOutStruct;
01159 }
01160 else {
01161 coreFNMapStrct = (fnmapStruct_t *) malloc (sizeof(fnmapStruct_t));
01162 coreFNMapStrct->MaxNumOfFMaps = 0;
01163 }
01164 i = readFNMapStructFromDB((char*) inFnmBaseNameParam->inOutStruct, (char*) inVersionParam->inOutStruct, coreFNMapStrct, rei);
01165 if (i != 0) {
01166 if (strcmp (outCoreFNMapStruct->type,FNMapStruct_MS_T) != 0 )
01167 free(coreFNMapStrct);
01168 return(i);
01169 }
01170
01171 outCoreFNMapStruct->inOutStruct = (void *) coreFNMapStrct;
01172 if (outCoreFNMapStruct->type == NULL ||
01173 strcmp (outCoreFNMapStruct->type,FNMapStruct_MS_T) != 0)
01174 outCoreFNMapStruct->type = (char *) strdup(FNMapStruct_MS_T);
01175 return(0);
01176 }
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191
01192
01193
01194
01195
01196
01197
01198
01199
01200
01201
01202
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216 int
01217 msiAdmWriteFNMapsFromStructIntoFile(msParam_t *inFnmFileNameParam, msParam_t *inCoreFNMapStruct, ruleExecInfo_t *rei)
01218 {
01219 int i;
01220 fnmapStruct_t *myFNMapStruct;
01221
01222 if ((i = isUserPrivileged(rei->rsComm)) != 0)
01223 return (i);
01224
01225 RE_TEST_MACRO ("Loopback on msiAdmWriteFNMapsFromStructIntoFile");
01226
01227 if (inFnmFileNameParam == NULL || inCoreFNMapStruct == NULL ||
01228 strcmp (inFnmFileNameParam->type,STR_MS_T) != 0 ||
01229 strcmp (inCoreFNMapStruct->type,FNMapStruct_MS_T) != 0 ||
01230 inFnmFileNameParam->inOutStruct == NULL ||
01231 strlen((char *) inFnmFileNameParam->inOutStruct) == 0 )
01232 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
01233
01234 myFNMapStruct = (fnmapStruct_t *) inCoreFNMapStruct->inOutStruct;
01235 i = writeFNMapsIntoFile((char *) inFnmFileNameParam->inOutStruct, myFNMapStruct, rei);
01236 return(i);
01237
01238 }
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279 int msiAdmReadMSrvcsFromFileIntoStruct(msParam_t *inMsrvcFileNameParam, msParam_t *outCoreMsrvcStruct, ruleExecInfo_t *rei)
01280 {
01281
01282 int i;
01283 msrvcStruct_t *coreMsrvcStrct;
01284
01285 if ((i = isUserPrivileged(rei->rsComm)) != 0)
01286 return (i);
01287
01288 RE_TEST_MACRO ("Loopback on msiAdmReadMSrvcsFromFileIntoStruct");
01289
01290
01291 if (inMsrvcFileNameParam == NULL ||
01292 strcmp (inMsrvcFileNameParam->type,STR_MS_T) != 0 ||
01293 inMsrvcFileNameParam->inOutStruct == NULL ||
01294 strlen((char *) inMsrvcFileNameParam->inOutStruct) == 0 )
01295 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
01296 if (outCoreMsrvcStruct->type != NULL &&
01297 strcmp (outCoreMsrvcStruct->type,MsrvcStruct_MS_T) == 0 &&
01298 outCoreMsrvcStruct->inOutStruct != NULL) {
01299 coreMsrvcStrct = (msrvcStruct_t *) outCoreMsrvcStruct->inOutStruct;
01300 }
01301 else {
01302 coreMsrvcStrct = (msrvcStruct_t *) malloc (sizeof(msrvcStruct_t));
01303 coreMsrvcStrct->MaxNumOfMsrvcs = 0;
01304 }
01305 i = readMsrvcStructFromFile((char*) inMsrvcFileNameParam->inOutStruct, coreMsrvcStrct);
01306 if (i != 0) {
01307 if (strcmp (outCoreMsrvcStruct->type,MsrvcStruct_MS_T) != 0 )
01308 free(coreMsrvcStrct);
01309 return(i);
01310 }
01311
01312 outCoreMsrvcStruct->inOutStruct = (void *) coreMsrvcStrct;
01313 if (outCoreMsrvcStruct->type == NULL ||
01314 strcmp (outCoreMsrvcStruct->type,MsrvcStruct_MS_T) != 0)
01315 outCoreMsrvcStruct->type = (char *) strdup(MsrvcStruct_MS_T);
01316 return(0);
01317 }
01318
01319
01320
01321
01322
01323
01324
01325
01326
01327
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337
01338
01339
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357 int msiAdmInsertMSrvcsFromStructIntoDB(msParam_t *inMsrvcBaseNameParam, msParam_t *inCoreMsrvcStruct, ruleExecInfo_t *rei)
01358
01359 {
01360
01361 msrvcStruct_t *coreMsrvcStruct;
01362 int i;
01363
01364 if ((i = isUserPrivileged(rei->rsComm)) != 0)
01365 return (i);
01366
01367 RE_TEST_MACRO ("Loopback on msiAdmInsertMSrvcsFromStructIntoDB");
01368
01369 if ( inCoreMsrvcStruct == NULL ||
01370 strcmp (inCoreMsrvcStruct->type,MsrvcStruct_MS_T) != 0 ||
01371 inCoreMsrvcStruct->inOutStruct == NULL)
01372 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
01373
01374 coreMsrvcStruct = (msrvcStruct_t *) inCoreMsrvcStruct->inOutStruct;
01375 i = insertMSrvcsIntoDB( coreMsrvcStruct, rei);
01376 return(i);
01377
01378 }
01379
01380
01381
01382
01383
01384
01385
01386
01387
01388
01389
01390
01391
01392
01393
01394
01395
01396
01397
01398
01399
01400
01401
01402
01403
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417 int
01418 msiGetMSrvcsFromDBIntoStruct(msParam_t *inStatus, msParam_t *outCoreMsrvcStruct, ruleExecInfo_t *rei)
01419 {
01420
01421 int i, stat;
01422 msrvcStruct_t *coreMsrvcStrct;
01423
01424 RE_TEST_MACRO ("Loopback on msiGetMSrvcsFromDBIntoStruct");
01425
01426 if (outCoreMsrvcStruct->type != NULL &&
01427 strcmp (outCoreMsrvcStruct->type,MsrvcStruct_MS_T) == 0 &&
01428 outCoreMsrvcStruct->inOutStruct != NULL) {
01429 coreMsrvcStrct = (msrvcStruct_t *) outCoreMsrvcStruct->inOutStruct;
01430 }
01431 else {
01432 coreMsrvcStrct = (msrvcStruct_t *) malloc (sizeof(msrvcStruct_t));
01433 coreMsrvcStrct->MaxNumOfMsrvcs = 0;
01434 }
01435 if (inStatus != NULL && inStatus->type != NULL && inStatus->inOutStruct != NULL) {
01436 if (strcmp (inStatus->type, INT_MS_T) == 0) {
01437 stat = *(int *)inStatus->inOutStruct;
01438 }
01439 else if (strcmp (inStatus->type, STR_MS_T) == 0) {
01440 stat = atoi((char *) inStatus->inOutStruct);
01441 }
01442 else {
01443 free( coreMsrvcStrct );
01444 return(USER_PARAM_TYPE_ERR);
01445 }
01446 }
01447 else {
01448 free( coreMsrvcStrct );
01449 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
01450 }
01451 i = readMsrvcStructFromDB( stat, coreMsrvcStrct, rei);
01452 if (i != 0) {
01453 if (strcmp (outCoreMsrvcStruct->type,MsrvcStruct_MS_T) != 0 )
01454 free(coreMsrvcStrct);
01455 return(i);
01456 }
01457
01458 outCoreMsrvcStruct->inOutStruct = (void *) coreMsrvcStrct;
01459 if (outCoreMsrvcStruct->type == NULL ||
01460 strcmp (outCoreMsrvcStruct->type,MsrvcStruct_MS_T) != 0)
01461 outCoreMsrvcStruct->type = (char *) strdup(MsrvcStruct_MS_T);
01462 return(0);
01463 }
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502 int
01503 msiAdmWriteMSrvcsFromStructIntoFile(msParam_t *inMsrvcFileNameParam, msParam_t *inCoreMsrvcStruct, ruleExecInfo_t *rei)
01504 {
01505 int i;
01506 msrvcStruct_t *myMsrvcStruct;
01507
01508 if ((i = isUserPrivileged(rei->rsComm)) != 0)
01509 return (i);
01510
01511 RE_TEST_MACRO ("Loopback on msiAdmWriteMSrvcsFromStructIntoFile");
01512
01513 if (inMsrvcFileNameParam == NULL || inCoreMsrvcStruct == NULL ||
01514 strcmp (inMsrvcFileNameParam->type,STR_MS_T) != 0 ||
01515 strcmp (inCoreMsrvcStruct->type,MsrvcStruct_MS_T) != 0 ||
01516 inMsrvcFileNameParam->inOutStruct == NULL ||
01517 strlen((char *) inMsrvcFileNameParam->inOutStruct) == 0 )
01518 return(PARAOPR_EMPTY_IN_STRUCT_ERR);
01519
01520 myMsrvcStruct = (msrvcStruct_t *) inCoreMsrvcStruct->inOutStruct;
01521 i = writeMSrvcsIntoFile((char *) inMsrvcFileNameParam->inOutStruct, myMsrvcStruct, rei);
01522 return(i);
01523
01524 }
01525