Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

rmConfig.cpp

Go to the documentation of this file.
00001 #include "rmConfig.h"
00002 
00003 #include "rmClientError.h"
00004 #include "rmSysInfo.h"
00005 
00006 
00020 int
00021 rmGenericMonitorConfig::removeElement(unsigned long aID)
00022 {
00023   int ret;
00024 
00025   ret = findId(aID);
00026   if(ret)
00027     return ret;
00028 
00029   int tid = mElementArray[aID].thresholdConfigId;
00030   int wid = mElementArray[aID].watermarkConfigId;
00031   int lid = mElementArray[aID].leakyBucketConfigId;
00032 
00033   ret = rmRefArray<GenericConfig>::removeElement(aID);
00034   if(ret)
00035     return ret;
00036 
00037   if(tid > 0) {
00038     mThresholdConfig->release(tid);
00039   } 
00040   if(wid > 0) {
00041     mWatermarkConfig->release(wid);
00042   }
00043   if(lid > 0) {
00044     mLeakyBucketConfig->release(lid);
00045   }
00046   return RMCLIENT_SUCCESS;
00047 }
00048 
00059 bool
00060 rmGenericMonitorConfig::elementIsReady(const GenericConfig & aElement) const
00061 {
00062   if(aElement.config.monitorType < rmThresholding || 
00063       aElement.config.monitorType > rmLeakyBucket)
00064     return false;
00065 
00066   if(aElement.subsystemId < 1)
00067     return false;
00068 
00069   /*
00070   if(aElement.config.statId.ResourceId < 1)
00071     return false;
00072 
00073   if(aElement.config.statId.StatisticId < 1)
00074     return false;
00075   */
00076 
00077   if(aElement.config.monitorType == rmThresholding && aElement.thresholdConfigId == 0)
00078     return false;
00079 
00080   if(aElement.config.monitorType == rmWatermarking && aElement.watermarkConfigId== 0)
00081     return false;
00082 
00083   if(aElement.config.monitorType == rmLeakyBucket && aElement.leakyBucketConfigId == 0)
00084     return false;
00085 
00086   if(aElement.config.statisticTransform < rmNone || aElement.config.statisticTransform > rmPercentChange)
00087     return false;
00088 
00089 return true;
00090 }
00091 
00104 int
00105 rmGenericMonitorConfig::getInteger32(RMAttribute aName, unsigned long aID, long & aValue)
00106 {
00107   aValue = -1;
00108   const GenericConfig * config = getConstElement(aID);
00109   if(!config)
00110     return RMCLIENT_ERROR_GENERIC_CONFIG;
00111 
00112   switch(aName) {
00113 
00114     case GENERICCONFIG_MONITORTYPE:
00115       aValue = config->config.monitorType;
00116       break;
00117 
00118     case GENERICCONFIG_STATISTICTRANSFORM:
00119       aValue = config->config.statisticTransform;
00120       break;
00121 
00122     case GENERICCONFIG_REFCOUNT:
00123       aValue = config->refCnt;
00124       break;
00125 
00126     case GENERICCONFIG_STATUS:
00127       aValue = config->status;
00128       break;
00129 
00130     default:
00131       return RMCLIENT_ERROR_NOSUCHNAME;
00132   }
00133   return RMCLIENT_SUCCESS;
00134 }
00135 
00136 int
00137 rmGenericMonitorConfig::setInteger32(RMAttribute aName, unsigned long aID, long aValue)
00138 {
00139   GenericConfig * config = getElement(aID);
00140   if(!config)
00141     return RMCLIENT_ERROR_GENERIC_CONFIG;
00142 
00143   if(config->refCnt > 0)
00144     return RMCLIENT_ERROR_CC_REFCNT;
00145 
00146   switch(aName) {
00147 
00148     case GENERICCONFIG_MONITORTYPE:
00149       if(aValue < rmThresholding || aValue > rmLeakyBucket)
00150         return RMCLIENT_ERROR_NOSUCHVALUE;
00151 
00152       config->config.monitorType = (enum rmMonitorType)aValue;
00153       break;
00154 
00155     case GENERICCONFIG_STATISTICTRANSFORM:
00156       if(aValue < rmNone || aValue > rmPercentChange)
00157         return RMCLIENT_ERROR_NOSUCHVALUE;
00158 
00159       config->config.statisticTransform = (enum rmStatisticTransform) aValue;
00160       break;
00161 
00162     case GENERICCONFIG_STATUS:
00163       return setStatus(*config, aID, aValue);
00164 
00165     default:
00166       return RMCLIENT_ERROR_NOSUCHNAME;
00167   }
00168   updateStatus(*config);
00169   return RMCLIENT_SUCCESS;
00170 }
00171 
00172 int
00173 rmGenericMonitorConfig::getUnsigned(RMAttribute aName, unsigned long aID, unsigned long & aValue)
00174 {
00175   aValue = 0;
00176   const GenericConfig * config = getConstElement(aID);
00177   if(!config)
00178     return RMCLIENT_ERROR_GENERIC_CONFIG;
00179 
00180   switch(aName) {
00181 
00182     case GENERICCONFIG_SUBSYSTEMID:
00183       aValue = config->subsystemId;
00184       break;
00185 
00186     case GENERICCONFIG_STATISTICID:
00187       aValue = config->config.statisticKey.StatisticId;
00188       break;
00189 
00190     case GENERICCONFIG_RESOURCEID:
00191       aValue = config->config.statisticKey.ResourceId;
00192       break;
00193 
00194     case GENERICCONFIG_THRESHOLDID:
00195       aValue = config->thresholdConfigId;
00196       break;
00197 
00198     case GENERICCONFIG_WATERMARKID:
00199       aValue = config->watermarkConfigId;
00200       break;
00201 
00202     case GENERICCONFIG_LEAKYBUCKETID:
00203       aValue = config->leakyBucketConfigId;
00204       break;
00205 
00206     default:
00207       return RMCLIENT_ERROR_NOSUCHNAME;
00208   }
00209   return RMCLIENT_SUCCESS;
00210 }
00211 
00212 int
00213 rmGenericMonitorConfig::setUnsigned(RMAttribute aName, unsigned long aID, unsigned long aValue)
00214 {
00215   int ret;
00216   unsigned long oldid;
00217   int status = 0;
00218   ThresholdConfig * tconfig;
00219   WatermarkConfig * wconfig;
00220   LeakyBucketConfig * lconfig;
00221 
00222   GenericConfig * config = getElement(aID);
00223   if(!config)
00224     return RMCLIENT_ERROR_GENERIC_CONFIG;
00225 
00226   if(config->refCnt > 0)
00227     return RMCLIENT_ERROR_CC_REFCNT;
00228 
00229   switch(aName) {
00230 
00231     case GENERICCONFIG_SUBSYSTEMID:
00232 
00233       uuid_t uid;
00234       ret = mSubsystemInfo->getUUID(SUBSYSTEMINFO_UUID, aValue, uid);
00235       if(ret)
00236         return ret;
00237 
00238       config->config.statisticKey.SubsystemId = uid;
00239       config->subsystemId = aValue;
00240       break;
00241 
00242     case GENERICCONFIG_STATISTICID:
00243       config->config.statisticKey.StatisticId = aValue;
00244       break;
00245 
00246     case GENERICCONFIG_RESOURCEID:
00247       config->config.statisticKey.ResourceId = aValue;
00248       break;
00249 
00250     case GENERICCONFIG_THRESHOLDID:
00251 
00252       // release the old id
00253       mThresholdConfig->release(config->thresholdConfigId);
00254 
00255       if(aValue > 0) {
00256 
00257         // validate the new
00258         tconfig = mThresholdConfig->getElement(aValue);
00259         if(!tconfig || tconfig->status != ACTIVE)
00260           return RMCLIENT_ERROR_NOSUCHVALUE;
00261 
00262         config->config.typeConfiguration.threshold = tconfig->config;
00263 
00264         // addref the new
00265         ret = mThresholdConfig->addRef(aValue);
00266         if(ret < 0)
00267           return RMCLIENT_ERROR_CC_REFCNT;
00268       } 
00269       else {
00270 
00271         memset(&(config->config.typeConfiguration.threshold), 0,
00272                            sizeof(rmThresholdConfiguration));
00273       }
00274       config->thresholdConfigId = aValue;
00275       break;
00276 
00277     case GENERICCONFIG_WATERMARKID:
00278 
00279       // release the old id
00280       mWatermarkConfig->release(config->watermarkConfigId);
00281 
00282       if(aValue > 0) {
00283 
00284         // validate the new
00285         wconfig = mWatermarkConfig->getElement(aValue);
00286         if(!wconfig || wconfig->status != ACTIVE)
00287           return RMCLIENT_ERROR_NOSUCHVALUE;
00288 
00289         config->config.typeConfiguration.watermark = wconfig->config;
00290 
00291         // addref the new
00292         ret = mWatermarkConfig->addRef(aValue);
00293         if(ret < 0)
00294           return RMCLIENT_ERROR_CC_REFCNT;
00295       } 
00296       else {
00297 
00298         memset(&(config->config.typeConfiguration.watermark), 0,
00299                            sizeof(rmWatermarkConfiguration));
00300       }
00301       config->watermarkConfigId = aValue;
00302       break;
00303 
00304     case GENERICCONFIG_LEAKYBUCKETID:
00305 
00306       // release the old id
00307       mLeakyBucketConfig->release(config->leakyBucketConfigId);
00308 
00309       if(aValue > 0) {
00310 
00311         // validate the new
00312         lconfig = mLeakyBucketConfig->getElement(aValue);
00313         if(!lconfig || lconfig->status != ACTIVE)
00314           return RMCLIENT_ERROR_NOSUCHVALUE;
00315 
00316         config->config.typeConfiguration.leakyBucket = lconfig->config;
00317 
00318         // addref the new
00319         ret = mLeakyBucketConfig->addRef(aValue);
00320         if(ret < 0)
00321           return RMCLIENT_ERROR_CC_REFCNT;
00322       } 
00323       else {
00324 
00325         memset(&(config->config.typeConfiguration.leakyBucket), 0,
00326                            sizeof(rmLeakyBucketConfiguration));
00327       }
00328       config->leakyBucketConfigId = aValue;
00329       break;
00330 
00331     default:
00332       return RMCLIENT_ERROR_NOSUCHNAME;
00333   }
00334   updateStatus(*config);
00335   return RMCLIENT_SUCCESS;
00336 }
00337 
00338 
00339 bool
00340 rmThresholdMonitorConfig::elementIsReady(const ThresholdConfig & aElement) const
00341 {
00342   if(aElement.config.type < rmThreshold || aElement.config.type > rmBiDirectionalThreshold) 
00343     return false;
00344 
00345   /*
00346   if(aElement.config.thresholdValue.rmValue32 == 0)
00347     return false;
00348   */
00349 
00350   if(aElement.config.condition < rmValueIsAbove || aElement.config.condition > rmValueIsNotAt)
00351     return false;
00352 
00353   if(aElement.config.precondition < rmNoPrecondition || aElement.config.precondition > rmObserveGoodValue)
00354     return false;
00355 
00356   if(aElement.config.eventSeverity < LOG_EMERG || aElement.config.eventSeverity > LOG_DEBUG)
00357     return false;
00358 
00359   if(aElement.config.cancelEventSeverity < LOG_EMERG || aElement.config.cancelEventSeverity > LOG_DEBUG)
00360     return false;
00361 
00362   return true;
00363 }
00364 
00365 int
00366 rmThresholdMonitorConfig::getInteger32(RMAttribute aName, unsigned long aID, long & aValue)
00367 {
00368   aValue = -1;
00369   const ThresholdConfig * config = getConstElement(aID);
00370   if(!config)
00371     return RMCLIENT_ERROR_THRESHOLD_CONFIG;
00372 
00373   switch(aName) {
00374 
00375     case THRESHOLDCONFIG_TYPE:
00376       aValue = config->config.type;
00377       break;
00378 
00379     case THRESHOLDCONFIG_TESTCONDITION:
00380       aValue = config->config.condition;
00381       break;
00382 
00383     case THRESHOLDCONFIG_PRECONDITION:
00384       aValue = config->config.precondition;
00385       break;
00386 
00387     case THRESHOLDCONFIG_EVENTSEVERITY:
00388       aValue = config->config.eventSeverity;
00389       break;
00390 
00391     case THRESHOLDCONFIG_CANCELEVENTSEVERITY:
00392       aValue = config->config.cancelEventSeverity;
00393       break;
00394 
00395     case THRESHOLDCONFIG_REFCOUNT:
00396       aValue = config->refCnt;
00397       break;
00398 
00399     case THRESHOLDCONFIG_STATUS:
00400       aValue = config->status;
00401       break;
00402 
00403     default:
00404       return RMCLIENT_ERROR_NOSUCHNAME;
00405   }
00406   return RMCLIENT_SUCCESS;
00407 }
00408 
00409 int
00410 rmThresholdMonitorConfig::setInteger32(RMAttribute aName, unsigned long aID, long aValue)
00411 {
00412   ThresholdConfig * config = getElement(aID);
00413   if(!config)
00414     return RMCLIENT_ERROR_THRESHOLD_CONFIG;
00415 
00416   if(config->refCnt > 0)
00417     return RMCLIENT_ERROR_CC_REFCNT;
00418 
00419   switch(aName) {
00420 
00421     case THRESHOLDCONFIG_TYPE:
00422       if(aValue < rmThreshold || aValue > rmBiDirectionalThreshold)
00423         return RMCLIENT_ERROR_NOSUCHVALUE;
00424 
00425       config->config.type = (enum rmThresholdType) aValue;
00426       break;
00427 
00428     case THRESHOLDCONFIG_TESTCONDITION:
00429       if(aValue < rmValueIsAbove || aValue > rmValueIsNotAt)
00430         return RMCLIENT_ERROR_NOSUCHVALUE;
00431 
00432       config->config.condition = (enum rmThresholdTestCondition) aValue;
00433       break;
00434 
00435     case THRESHOLDCONFIG_PRECONDITION:
00436       if(aValue < rmNoPrecondition || aValue > rmObserveGoodValue)
00437         return RMCLIENT_ERROR_NOSUCHVALUE;
00438 
00439       config->config.precondition = (enum rmThresholdPrecondition) aValue;
00440       break;
00441 
00442     case THRESHOLDCONFIG_EVENTSEVERITY:
00443       if(aValue < LOG_EMERG || aValue > LOG_DEBUG)
00444         return RMCLIENT_ERROR_NOSUCHVALUE;
00445 
00446       config->config.eventSeverity = aValue;
00447       break;
00448 
00449     case THRESHOLDCONFIG_CANCELEVENTSEVERITY:
00450       if(aValue < LOG_EMERG || aValue > LOG_DEBUG)
00451         return RMCLIENT_ERROR_NOSUCHVALUE;
00452 
00453       config->config.cancelEventSeverity = aValue;
00454       break;
00455 
00456     case THRESHOLDCONFIG_STATUS:
00457       return setStatus(*config, aID, aValue);
00458 
00459     default:
00460       return RMCLIENT_ERROR_NOSUCHNAME;
00461   }
00462   updateStatus(*config);
00463   return RMCLIENT_SUCCESS;
00464 }
00465 
00466 int
00467 rmThresholdMonitorConfig::getUnsigned(RMAttribute aName, unsigned long aID, unsigned long & aValue)
00468 {
00469   aValue = 0;
00470   const ThresholdConfig * config = getConstElement(aID);
00471   if(!config)
00472     return RMCLIENT_ERROR_THRESHOLD_CONFIG;
00473 
00474   switch(aName) {
00475 
00476     case THRESHOLDCONFIG_VALUE32:
00477       aValue = config->config.thresholdValue.rmValueU32;
00478       break;
00479 
00480     default:
00481       return RMCLIENT_ERROR_NOSUCHNAME;
00482   }
00483   return RMCLIENT_SUCCESS;
00484 }
00485 
00486 int
00487 rmThresholdMonitorConfig::setUnsigned(RMAttribute aName, unsigned long aID, unsigned long aValue)
00488 {
00489   ThresholdConfig * config = getElement(aID);
00490   if(!config)
00491     return RMCLIENT_ERROR_THRESHOLD_CONFIG;
00492 
00493   if(config->refCnt > 0)
00494     return RMCLIENT_ERROR_CC_REFCNT;
00495 
00496   switch(aName) {
00497 
00498     case THRESHOLDCONFIG_VALUE32:
00499       config->config.thresholdValue.rmValueU32 = aValue;
00500       break;
00501 
00502     default:
00503       return RMCLIENT_ERROR_NOSUCHNAME;
00504   }
00505 
00506   updateStatus(*config);
00507   return RMCLIENT_SUCCESS;
00508 }
00509 
00510 int
00511 rmThresholdMonitorConfig::getUnsigned64(RMAttribute aName, unsigned long aID, u_int64_t & aValue)
00512 {
00513   aValue = 0;
00514   const ThresholdConfig * config = getConstElement(aID);
00515   if(!config)
00516     return RMCLIENT_ERROR_THRESHOLD_CONFIG;
00517 
00518   switch(aName) {
00519 
00520     case THRESHOLDCONFIG_VALUE64:
00521       aValue = config->config.thresholdValue.rmValueU64;
00522       break;
00523 
00524     default:
00525       return RMCLIENT_ERROR_NOSUCHNAME;
00526   }
00527   return RMCLIENT_SUCCESS;
00528 }
00529 
00530 int
00531 rmThresholdMonitorConfig::setUnsigned64(RMAttribute aName, unsigned long aID, u_int64_t aValue)
00532 {
00533   ThresholdConfig * config = getElement(aID);
00534   if(!config)
00535     return RMCLIENT_ERROR_THRESHOLD_CONFIG;
00536 
00537   if(config->refCnt > 0)
00538     return RMCLIENT_ERROR_CC_REFCNT;
00539 
00540   switch(aName) {
00541 
00542     case THRESHOLDCONFIG_VALUE64:
00543       config->config.thresholdValue.rmValueU64 = aValue;
00544       break;
00545 
00546     default:
00547       return RMCLIENT_ERROR_NOSUCHNAME;
00548   }
00549 
00550   updateStatus(*config);
00551   return RMCLIENT_SUCCESS;
00552 }
00553 
00554 bool
00555 rmWatermarkMonitorConfig::elementIsReady(const WatermarkConfig & aElement) const
00556 {
00557   if(aElement.config.type < rmHighWatermark || aElement.config.type > rmDualWatermark)
00558     return false;
00559 
00560   return true;
00561 }
00562 
00563 int
00564 rmWatermarkMonitorConfig::getInteger32(RMAttribute aName, unsigned long aID, long & aValue)
00565 {
00566   aValue = -1;
00567   const WatermarkConfig * config = getConstElement(aID);
00568   if(!config)
00569     return RMCLIENT_ERROR_WATERMARK_CONFIG;
00570 
00571   switch(aName) {
00572 
00573     case WATERMARKCONFIG_TYPE:
00574       aValue = config->config.type;
00575       break;
00576 
00577     case WATERMARKCONFIG_REFCOUNT:
00578       aValue = config->refCnt;
00579       break;
00580 
00581     case WATERMARKCONFIG_STATUS:
00582       aValue = config->status;
00583       break;
00584 
00585     default:
00586       return RMCLIENT_ERROR_NOSUCHNAME;
00587   }
00588 
00589   return RMCLIENT_SUCCESS;
00590 }
00591 
00592 int
00593 rmWatermarkMonitorConfig::setInteger32(RMAttribute aName, unsigned long aID, long aValue)
00594 {
00595   WatermarkConfig * config = getElement(aID);
00596   if(!config)
00597     return RMCLIENT_ERROR_WATERMARK_CONFIG;
00598 
00599   if(config->refCnt > 0)
00600     return RMCLIENT_ERROR_CC_REFCNT;
00601 
00602   switch(aName) {
00603 
00604     case WATERMARKCONFIG_TYPE:
00605       if(aValue < rmHighWatermark || aValue > rmDualWatermark)
00606         return RMCLIENT_ERROR_NOSUCHVALUE;
00607 
00608       config->config.type = (enum rmWatermarkType) aValue;
00609       break;
00610 
00611     case WATERMARKCONFIG_STATUS:
00612       return setStatus(*config, aID, aValue);
00613 
00614     default:
00615       return RMCLIENT_ERROR_NOSUCHNAME;
00616   }
00617 
00618   updateStatus(*config);
00619   return RMCLIENT_SUCCESS;
00620 }
00621 
00622 bool
00623 rmLeakyBucketMonitorConfig::elementIsReady(const LeakyBucketConfig & aElement) const
00624 {
00625   if(aElement.config.eventSeverity < LOG_EMERG || aElement.config.eventSeverity > LOG_DEBUG)
00626     return false;
00627 
00628   if(aElement.config.bucketSize.rmValueU64 <= 0)
00629     return false;
00630 
00631   return true;
00632 }
00633 
00634 int
00635 rmLeakyBucketMonitorConfig::getInteger32(RMAttribute aName, unsigned long aID, long & aValue)
00636 {
00637   aValue = -1;
00638   const LeakyBucketConfig * config = getConstElement(aID);
00639   if(!config)
00640     return RMCLIENT_ERROR_THRESHOLD_CONFIG;
00641 
00642   switch(aName) {
00643 
00644     case LEAKYBUCKETCONFIG_EVENTSEVERITY:
00645       aValue = config->config.eventSeverity;
00646       break;
00647 
00648     case LEAKYBUCKETCONFIG_REFCOUNT:
00649       aValue = config->refCnt;
00650       break;
00651 
00652     case LEAKYBUCKETCONFIG_STATUS:
00653       aValue = config->status;
00654       break;
00655 
00656     default:
00657       return RMCLIENT_ERROR_NOSUCHNAME;
00658   }
00659   return RMCLIENT_SUCCESS;
00660 }
00661 
00662 int
00663 rmLeakyBucketMonitorConfig::setInteger32(RMAttribute aName, unsigned long aID, long aValue)
00664 {
00665   LeakyBucketConfig * config = getElement(aID);
00666   if(!config)
00667     return RMCLIENT_ERROR_THRESHOLD_CONFIG;
00668 
00669   if(config->refCnt > 0) 
00670     return RMCLIENT_ERROR_CC_REFCNT;
00671 
00672   switch(aName) {
00673 
00674     case LEAKYBUCKETCONFIG_EVENTSEVERITY:
00675       if(aValue < LOG_EMERG || aValue > LOG_DEBUG)
00676         return RMCLIENT_ERROR_NOSUCHVALUE;
00677 
00678       config->config.eventSeverity = aValue;
00679       break;
00680 
00681     case LEAKYBUCKETCONFIG_STATUS:
00682       return setStatus(*config, aID, aValue);
00683 
00684     default:
00685       return RMCLIENT_ERROR_NOSUCHNAME;
00686   }
00687   updateStatus(*config);
00688   return RMCLIENT_SUCCESS;
00689 }
00690 
00691 int
00692 rmLeakyBucketMonitorConfig::getUnsigned(RMAttribute aName, unsigned long aID, unsigned long & aValue)
00693 {
00694   aValue = 0;
00695   const LeakyBucketConfig * config = getConstElement(aID);
00696   if(!config)
00697     return RMCLIENT_ERROR_THRESHOLD_CONFIG;
00698 
00699   switch(aName) {
00700 
00701     case LEAKYBUCKETCONFIG_BUCKETSIZE32:
00702       aValue = config->config.bucketSize.rmValueU32;
00703       break;
00704 
00705     case LEAKYBUCKETCONFIG_FILLVALUE32:
00706       aValue = config->config.fillValue.rmValueU32;
00707       break;
00708 
00709     default:
00710       return RMCLIENT_ERROR_NOSUCHNAME;
00711   }
00712   return RMCLIENT_SUCCESS;
00713 }
00714 
00715 
00716 int
00717 rmLeakyBucketMonitorConfig::setUnsigned(RMAttribute aName, unsigned long aID, unsigned long aValue)
00718 {
00719   LeakyBucketConfig * config = getElement(aID);
00720   if(!config)
00721     return RMCLIENT_ERROR_THRESHOLD_CONFIG;
00722 
00723   if(config->refCnt > 0) 
00724     return RMCLIENT_ERROR_CC_REFCNT;
00725 
00726   switch(aName) {
00727 
00728     case LEAKYBUCKETCONFIG_BUCKETSIZE32:
00729       config->config.bucketSize.rmValueU32 = aValue;
00730       break;
00731 
00732     case LEAKYBUCKETCONFIG_FILLVALUE32:
00733       config->config.fillValue.rmValueU32 = aValue;
00734       break;
00735 
00736     default:
00737       return RMCLIENT_ERROR_NOSUCHNAME;
00738   }
00739   updateStatus(*config);
00740   return RMCLIENT_SUCCESS;
00741 }
00742 
00743 int
00744 rmLeakyBucketMonitorConfig::getUnsigned64(RMAttribute aName, unsigned long aID, u_int64_t & aValue)
00745 {
00746   aValue = 0;
00747   const LeakyBucketConfig * config = getConstElement(aID);
00748   if(!config)
00749     return RMCLIENT_ERROR_THRESHOLD_CONFIG;
00750 
00751   switch(aName) {
00752 
00753     case LEAKYBUCKETCONFIG_BUCKETSIZE64:
00754       aValue = config->config.bucketSize.rmValueU64;
00755       break;
00756 
00757     case LEAKYBUCKETCONFIG_FILLVALUE64:
00758       aValue = config->config.fillValue.rmValueU64;
00759       break;
00760 
00761     default:
00762       return RMCLIENT_ERROR_NOSUCHNAME;
00763   }
00764   return RMCLIENT_SUCCESS;
00765 }
00766 
00767 int
00768 rmLeakyBucketMonitorConfig::setUnsigned64(RMAttribute aName, unsigned long aID, u_int64_t aValue)
00769 {
00770   LeakyBucketConfig * config = getElement(aID);
00771   if(!config)
00772     return RMCLIENT_ERROR_THRESHOLD_CONFIG;
00773 
00774   if(config->refCnt > 0) 
00775     return RMCLIENT_ERROR_CC_REFCNT;
00776 
00777   switch(aName) {
00778 
00779     case LEAKYBUCKETCONFIG_BUCKETSIZE64:
00780       config->config.bucketSize.rmValueU64 = aValue;
00781       break;
00782 
00783     case LEAKYBUCKETCONFIG_FILLVALUE64:
00784       config->config.fillValue.rmValueU64 = aValue;
00785       break;
00786 
00787     default:
00788       return RMCLIENT_ERROR_NOSUCHNAME;
00789   }
00790   updateStatus(*config);
00791   return RMCLIENT_SUCCESS;
00792 }
00793 
00794 
00795 
00796 

Generated on Tue Sep 10 16:46:32 2002 for ResourceMonitorSNMPSubagent by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002