00001
00002
00003
00004 #include <netinet/in.h>
00005
00006 #ifdef IN_UCD_SNMP_SOURCE
00007
00008
00009
00010
00011 #include <config.h>
00012
00013
00014
00015 #include "mibincl.h"
00016 #include "util_funcs.h"
00017
00018
00019 #else
00020
00021
00022 #include <ucd-snmp/ucd-snmp-config.h>
00023 #include <ucd-snmp/ucd-snmp-includes.h>
00024 #include <ucd-snmp/ucd-snmp-agent-includes.h>
00025
00026
00027 #endif
00028
00029
00030 #include "RMLeakyBucketConfig.h"
00031
00032 #include "rmClient.h"
00033 #include "utility.h"
00034
00035 #include <stdlib.h>
00036 #include <string.h>
00037 #include <ucd-snmp/util_funcs.h>
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 oid RMLeakyBucketConfig_variables_oid[] = { 1,3,6,1,4,1,343,2,15,1,2,2,4 };
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 struct variable4 RMLeakyBucketConfig_variables[] = {
00059
00060 #define LEAKYBUCKETCONFIGNEXTINDEX 1
00061 { LEAKYBUCKETCONFIGNEXTINDEX, ASN_UNSIGNED , RONLY , var_RMLeakyBucketConfig, 1, { 1 } },
00062 #define LEAKYBUCKETSIZEVALUELOW 5
00063 { LEAKYBUCKETSIZEVALUELOW, ASN_UNSIGNED , RWRITE, var_LeakyBucketConfigTable, 3, { 2,1,2 } },
00064 #define LEAKYBUCKETSIZEVALUEHIGH 6
00065 { LEAKYBUCKETSIZEVALUEHIGH, ASN_UNSIGNED , RWRITE, var_LeakyBucketConfigTable, 3, { 2,1,3 } },
00066 #define LEAKYBUCKETFILLVALUELOW 7
00067 { LEAKYBUCKETFILLVALUELOW, ASN_UNSIGNED , RWRITE, var_LeakyBucketConfigTable, 3, { 2,1,4 } },
00068 #define LEAKYBUCKETFILLVALUEHIGH 8
00069 { LEAKYBUCKETFILLVALUEHIGH, ASN_UNSIGNED , RWRITE, var_LeakyBucketConfigTable, 3, { 2,1,5 } },
00070 #define LEAKYBUCKETEVENTSEVERITY 9
00071 { LEAKYBUCKETEVENTSEVERITY, ASN_INTEGER , RWRITE, var_LeakyBucketConfigTable, 3, { 2,1,6 } },
00072 #define LEAKYBUCKETCONFIGREFCOUNT 10
00073 { LEAKYBUCKETCONFIGREFCOUNT, ASN_INTEGER , RONLY , var_LeakyBucketConfigTable, 3, { 2,1,7 } },
00074 #define LEAKYBUCKETCONFIGSTATUS 11
00075 { LEAKYBUCKETCONFIGSTATUS, ASN_INTEGER , RWRITE, var_LeakyBucketConfigTable, 3, { 2,1,8 } },
00076
00077 };
00078
00079
00080
00081
00082
00083
00084
00085
00086 void init_RMLeakyBucketConfig(void) {
00087
00088
00089
00090 REGISTER_MIB("RMLeakyBucketConfig", RMLeakyBucketConfig_variables, variable4,
00091 RMLeakyBucketConfig_variables_oid);
00092
00093
00094
00095 }
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 unsigned char *
00111 var_RMLeakyBucketConfig(struct variable *vp,
00112 oid *name,
00113 size_t *length,
00114 int exact,
00115 size_t *var_len,
00116 WriteMethod **write_method)
00117 {
00118
00119
00120
00121 static u_long ulong_ret;
00122
00123 if (header_generic(vp,name,length,exact,var_len,write_method)
00124 == MATCH_FAILED )
00125 return NULL;
00126
00127
00128
00129
00130
00131 switch(vp->magic) {
00132
00133
00134 case LEAKYBUCKETCONFIGNEXTINDEX:
00135
00136 ulong_ret = getNewId(LEAKYBUCKETCONFIG);
00137 return (unsigned char *) &ulong_ret;
00138
00139
00140 default:
00141 ERROR_MSG("");
00142 }
00143 return NULL;
00144 }
00145
00146
00147
00148
00149
00150
00151
00152 unsigned char *
00153 var_LeakyBucketConfigTable(struct variable *vp,
00154 oid *name,
00155 size_t *length,
00156 int exact,
00157 size_t *var_len,
00158 WriteMethod **write_method)
00159 {
00160
00161
00162
00163 static long long_ret;
00164 static u_long ulong_ret;
00165
00166 static u_int64_t v64;
00167 unsigned long id;
00168
00169 id = header_MyGeneric(vp,name,length,exact,var_len,write_method, LEAKYBUCKETCONFIG);
00170 if(id == 0) {
00171 switch(vp->magic) {
00172
00173 case LEAKYBUCKETSIZEVALUELOW:
00174 *write_method = write_leakyBucketSizeValueLow;
00175 break;
00176
00177 case LEAKYBUCKETSIZEVALUEHIGH:
00178 *write_method = write_leakyBucketSizeValueHigh;
00179 break;
00180
00181 case LEAKYBUCKETFILLVALUELOW:
00182 *write_method = write_leakyBucketFillValueLow;
00183 break;
00184
00185 case LEAKYBUCKETFILLVALUEHIGH:
00186 *write_method = write_leakyBucketFillValueHigh;
00187 break;
00188
00189 case LEAKYBUCKETEVENTSEVERITY:
00190 *write_method = write_leakyBucketEventSeverity;
00191 break;
00192
00193 case LEAKYBUCKETCONFIGSTATUS:
00194 *write_method = write_leakyBucketConfigStatus;
00195 break;
00196
00197 default:
00198 ERROR_MSG("");
00199 }
00200 return NULL;
00201 }
00202
00203
00204
00205
00206
00207 switch(vp->magic) {
00208
00209
00210 case LEAKYBUCKETSIZEVALUELOW:
00211 *write_method = write_leakyBucketSizeValueLow;
00212 ulong_ret = 0;
00213 getUnsigned(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_BUCKETSIZE32, id, &ulong_ret);
00214 return (unsigned char *) &ulong_ret;
00215
00216 case LEAKYBUCKETSIZEVALUEHIGH:
00217 *write_method = write_leakyBucketSizeValueHigh;
00218 v64 = 0;
00219 getUnsigned64(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_BUCKETSIZE64, id, &v64);
00220 ulong_ret = getHigh32(v64);
00221 return (unsigned char *) &ulong_ret;
00222
00223 case LEAKYBUCKETFILLVALUELOW:
00224 *write_method = write_leakyBucketFillValueLow;
00225 ulong_ret = 0;
00226 getUnsigned(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_FILLVALUE32, id, &ulong_ret);
00227 return (unsigned char *) &ulong_ret;
00228
00229 case LEAKYBUCKETFILLVALUEHIGH:
00230 *write_method = write_leakyBucketFillValueHigh;
00231 v64 = 0;
00232 getUnsigned64(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_FILLVALUE64, id, &v64);
00233 ulong_ret = getHigh32(v64);
00234 return (unsigned char *) &ulong_ret;
00235
00236 case LEAKYBUCKETEVENTSEVERITY:
00237 *write_method = write_leakyBucketEventSeverity;
00238 long_ret = 0;
00239 getInteger32(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_EVENTSEVERITY, id, &long_ret);
00240 return (unsigned char *) &long_ret;
00241
00242 case LEAKYBUCKETCONFIGREFCOUNT:
00243
00244 long_ret = 0;
00245 getInteger32(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_REFCOUNT, id, &long_ret);
00246 return (unsigned char *) &long_ret;
00247
00248 case LEAKYBUCKETCONFIGSTATUS:
00249 *write_method = write_leakyBucketConfigStatus;
00250 long_ret = 0;
00251 getInteger32(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_STATUS, id, &long_ret);
00252 return (unsigned char *) &long_ret;
00253
00254
00255 default:
00256 ERROR_MSG("");
00257 }
00258 return NULL;
00259 }
00260
00261
00262
00263
00264 int
00265 write_leakyBucketSizeValueLow(int action,
00266 u_char *var_val,
00267 u_char var_val_type,
00268 size_t var_val_len,
00269 u_char *statP,
00270 oid *name,
00271 size_t name_len)
00272 {
00273 static unsigned long *ulong_ret;
00274 int size;
00275
00276 int createNew, ret;
00277 unsigned long id;
00278 size_t prefix_len;
00279
00280 static unsigned long oldVal;
00281
00282 oid suffix[] = { 2, 1, 2 };
00283 createNew = 0;
00284 prefix_len = sizeof(RMLeakyBucketConfig_variables_oid)/sizeof(oid);
00285
00286 id = header_writeGeneric(name, name_len, RMLeakyBucketConfig_variables_oid, prefix_len, suffix, 3, LEAKYBUCKETCONFIG, &createNew);
00287
00288 if(id == 0 || (createNew && action == ACTION))
00289 return SNMP_ERR_NOSUCHNAME;
00290
00291
00292 switch ( action ) {
00293 case RESERVE1:
00294 if (var_val_type != ASN_UNSIGNED){
00295 fprintf(stderr, "write to leakyBucketSizeValueLow not ASN_UNSIGNED\n");
00296 return SNMP_ERR_WRONGTYPE;
00297 }
00298 if (var_val_len > sizeof(ulong_ret)){
00299 fprintf(stderr,"write to leakyBucketSizeValueLow: bad length\n");
00300 return SNMP_ERR_WRONGLENGTH;
00301 }
00302 break;
00303
00304
00305 case RESERVE2:
00306 size = var_val_len;
00307 ulong_ret = (unsigned long *) var_val;
00308
00309 if(!createNew) {
00310 ret = getUnsigned(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_BUCKETSIZE32, id, &oldVal);
00311 if(ret)
00312 return SNMP_ERR_INCONSISTENTVALUE;
00313 }
00314
00315
00316 break;
00317
00318
00319 case FREE:
00320
00321 break;
00322
00323
00324 case ACTION:
00325
00326
00327
00328 ret = setUnsigned(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_BUCKETSIZE32, id, *ulong_ret);
00329 if(ret)
00330 return SNMP_ERR_INCONSISTENTVALUE;
00331
00332 break;
00333
00334
00335 case UNDO:
00336
00337 setUnsigned(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_BUCKETSIZE32, id, oldVal);
00338
00339 break;
00340
00341
00342 case COMMIT:
00343
00344
00345 break;
00346 }
00347 return SNMP_ERR_NOERROR;
00348 }
00349
00350
00351
00352
00353 int
00354 write_leakyBucketSizeValueHigh(int action,
00355 u_char *var_val,
00356 u_char var_val_type,
00357 size_t var_val_len,
00358 u_char *statP,
00359 oid *name,
00360 size_t name_len)
00361 {
00362 static unsigned long *ulong_ret;
00363 int size;
00364
00365 int createNew, ret;
00366 unsigned long id;
00367 size_t prefix_len;
00368
00369 static u_int64_t oldVal;
00370 u_int64_t v64;
00371
00372 oid suffix[] = { 2, 1, 3 };
00373 createNew = 0;
00374 prefix_len = sizeof(RMLeakyBucketConfig_variables_oid)/sizeof(oid);
00375
00376 id = header_writeGeneric(name, name_len, RMLeakyBucketConfig_variables_oid, prefix_len, suffix, 3, LEAKYBUCKETCONFIG, &createNew);
00377
00378 if(id == 0 || (createNew && action == ACTION))
00379 return SNMP_ERR_NOSUCHNAME;
00380
00381
00382 switch ( action ) {
00383 case RESERVE1:
00384 if (var_val_type != ASN_UNSIGNED){
00385 fprintf(stderr, "write to leakyBucketSizeValueHigh not ASN_UNSIGNED\n");
00386 return SNMP_ERR_WRONGTYPE;
00387 }
00388 if (var_val_len > sizeof(ulong_ret)){
00389 fprintf(stderr,"write to leakyBucketSizeValueHigh: bad length\n");
00390 return SNMP_ERR_WRONGLENGTH;
00391 }
00392 break;
00393
00394
00395 case RESERVE2:
00396 size = var_val_len;
00397 ulong_ret = (unsigned long *) var_val;
00398
00399 v64 = 0;
00400
00401
00402 break;
00403
00404
00405 case FREE:
00406
00407 break;
00408
00409
00410 case ACTION:
00411
00412
00413
00414 ret = getUnsigned64(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_BUCKETSIZE64, id, &oldVal);
00415 if(ret)
00416 return SNMP_ERR_INCONSISTENTVALUE;
00417
00418 v64 = setHigh32(oldVal, *ulong_ret);
00419
00420 ret = setUnsigned64(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_BUCKETSIZE64, id, v64);
00421 if(ret)
00422 return SNMP_ERR_INCONSISTENTVALUE;
00423
00424 break;
00425
00426
00427 case UNDO:
00428
00429 setUnsigned64(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_BUCKETSIZE64, id, oldVal);
00430
00431 break;
00432
00433
00434 case COMMIT:
00435
00436
00437 break;
00438 }
00439 return SNMP_ERR_NOERROR;
00440 }
00441
00442
00443
00444
00445 int
00446 write_leakyBucketFillValueLow(int action,
00447 u_char *var_val,
00448 u_char var_val_type,
00449 size_t var_val_len,
00450 u_char *statP,
00451 oid *name,
00452 size_t name_len)
00453 {
00454 static unsigned long *ulong_ret;
00455 int size;
00456
00457 int createNew, ret;
00458 unsigned long id;
00459 size_t prefix_len;
00460
00461 static unsigned long oldVal;
00462
00463 oid suffix[] = { 2, 1, 4 };
00464 createNew = 0;
00465 prefix_len = sizeof(RMLeakyBucketConfig_variables_oid)/sizeof(oid);
00466
00467 id = header_writeGeneric(name, name_len, RMLeakyBucketConfig_variables_oid, prefix_len, suffix, 3, LEAKYBUCKETCONFIG, &createNew);
00468
00469 if(id == 0 || (createNew && action == ACTION))
00470 return SNMP_ERR_NOSUCHNAME;
00471
00472
00473 switch ( action ) {
00474 case RESERVE1:
00475 if (var_val_type != ASN_UNSIGNED){
00476 fprintf(stderr, "write to leakyBucketFillValueLow not ASN_UNSIGNED\n");
00477 return SNMP_ERR_WRONGTYPE;
00478 }
00479 if (var_val_len > sizeof(ulong_ret)){
00480 fprintf(stderr,"write to leakyBucketFillValueLow: bad length\n");
00481 return SNMP_ERR_WRONGLENGTH;
00482 }
00483 break;
00484
00485
00486 case RESERVE2:
00487 size = var_val_len;
00488 ulong_ret = (unsigned long *) var_val;
00489
00490 if(!createNew) {
00491 ret = getUnsigned(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_FILLVALUE32, id, &oldVal);
00492 if(ret)
00493 return SNMP_ERR_INCONSISTENTVALUE;
00494 }
00495
00496
00497 break;
00498
00499
00500 case FREE:
00501
00502 break;
00503
00504
00505 case ACTION:
00506
00507
00508
00509 ret = setUnsigned(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_FILLVALUE32, id, *ulong_ret);
00510 if(ret)
00511 return SNMP_ERR_INCONSISTENTVALUE;
00512
00513 break;
00514
00515
00516 case UNDO:
00517
00518 setUnsigned(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_FILLVALUE32, id, oldVal);
00519
00520 break;
00521
00522
00523 case COMMIT:
00524
00525
00526 break;
00527 }
00528 return SNMP_ERR_NOERROR;
00529 }
00530
00531
00532
00533
00534 int
00535 write_leakyBucketFillValueHigh(int action,
00536 u_char *var_val,
00537 u_char var_val_type,
00538 size_t var_val_len,
00539 u_char *statP,
00540 oid *name,
00541 size_t name_len)
00542 {
00543 static unsigned long *ulong_ret;
00544 int size;
00545
00546 int createNew, ret;
00547 unsigned long id;
00548 size_t prefix_len;
00549
00550 static u_int64_t oldVal;
00551 u_int64_t v64;
00552
00553 oid suffix[] = { 2, 1, 5 };
00554 createNew = 0;
00555 prefix_len = sizeof(RMLeakyBucketConfig_variables_oid)/sizeof(oid);
00556
00557 id = header_writeGeneric(name, name_len, RMLeakyBucketConfig_variables_oid, prefix_len, suffix, 3, LEAKYBUCKETCONFIG, &createNew);
00558
00559 if(id == 0 || (createNew && action == ACTION))
00560 return SNMP_ERR_NOSUCHNAME;
00561
00562
00563 switch ( action ) {
00564 case RESERVE1:
00565 if (var_val_type != ASN_UNSIGNED){
00566 fprintf(stderr, "write to leakyBucketFillValueHigh not ASN_UNSIGNED\n");
00567 return SNMP_ERR_WRONGTYPE;
00568 }
00569 if (var_val_len > sizeof(ulong_ret)){
00570 fprintf(stderr,"write to leakyBucketFillValueHigh: bad length\n");
00571 return SNMP_ERR_WRONGLENGTH;
00572 }
00573 break;
00574
00575
00576 case RESERVE2:
00577 size = var_val_len;
00578 ulong_ret = (unsigned long *) var_val;
00579
00580 v64 = 0;
00581
00582
00583 break;
00584
00585
00586 case FREE:
00587
00588 break;
00589
00590
00591 case ACTION:
00592
00593
00594
00595 if(!createNew) {
00596 ret = getUnsigned64(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_FILLVALUE64, id, &oldVal);
00597 if(ret)
00598 return SNMP_ERR_INCONSISTENTVALUE;
00599 }
00600
00601 v64 = setHigh32(oldVal, *ulong_ret);
00602 ret = setUnsigned64(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_FILLVALUE64, id, v64);
00603 if(ret)
00604 return SNMP_ERR_INCONSISTENTVALUE;
00605
00606 break;
00607
00608
00609 case UNDO:
00610
00611 setUnsigned64(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_FILLVALUE64, id, oldVal);
00612
00613 break;
00614
00615
00616 case COMMIT:
00617
00618
00619 break;
00620 }
00621 return SNMP_ERR_NOERROR;
00622 }
00623
00624
00625
00626
00627 int
00628 write_leakyBucketEventSeverity(int action,
00629 u_char *var_val,
00630 u_char var_val_type,
00631 size_t var_val_len,
00632 u_char *statP,
00633 oid *name,
00634 size_t name_len)
00635 {
00636 static long *long_ret;
00637 int size;
00638
00639 int createNew, ret;
00640 unsigned long id;
00641 size_t prefix_len;
00642
00643 static long oldVal;
00644
00645 oid suffix[] = { 2, 1, 6 };
00646 createNew = 0;
00647 prefix_len = sizeof(RMLeakyBucketConfig_variables_oid)/sizeof(oid);
00648
00649 id = header_writeGeneric(name, name_len, RMLeakyBucketConfig_variables_oid, prefix_len, suffix, 3, LEAKYBUCKETCONFIG, &createNew);
00650
00651 if(id == 0 || (createNew && action == ACTION))
00652 return SNMP_ERR_NOSUCHNAME;
00653
00654
00655 switch ( action ) {
00656 case RESERVE1:
00657 if (var_val_type != ASN_INTEGER){
00658 fprintf(stderr, "write to leakyBucketEventSeverity not ASN_INTEGER\n");
00659 return SNMP_ERR_WRONGTYPE;
00660 }
00661 if (var_val_len > sizeof(long_ret)){
00662 fprintf(stderr,"write to leakyBucketEventSeverity: bad length\n");
00663 return SNMP_ERR_WRONGLENGTH;
00664 }
00665 break;
00666
00667
00668 case RESERVE2:
00669 size = var_val_len;
00670 long_ret = (long *) var_val;
00671
00672 if(!createNew) {
00673 ret = getInteger32(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_EVENTSEVERITY, id, &oldVal);
00674 if(ret)
00675 return SNMP_ERR_INCONSISTENTVALUE;
00676 }
00677
00678
00679 break;
00680
00681
00682 case FREE:
00683
00684 break;
00685
00686
00687 case ACTION:
00688
00689
00690
00691 ret = setInteger32(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_EVENTSEVERITY, id, *long_ret);
00692 if(ret)
00693 return SNMP_ERR_INCONSISTENTVALUE;
00694
00695 break;
00696
00697
00698 case UNDO:
00699
00700 setInteger32(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_EVENTSEVERITY, id, oldVal);
00701
00702 break;
00703
00704
00705 case COMMIT:
00706
00707
00708 break;
00709 }
00710 return SNMP_ERR_NOERROR;
00711 }
00712
00713
00714
00715
00716 int
00717 write_leakyBucketConfigStatus(int action,
00718 u_char *var_val,
00719 u_char var_val_type,
00720 size_t var_val_len,
00721 u_char *statP,
00722 oid *name,
00723 size_t name_len)
00724 {
00725 static long *long_ret;
00726 int size;
00727
00728 int createNew, ret;
00729 unsigned long id;
00730 size_t prefix_len;
00731
00732 static long oldStatus;
00733 static int rowCreated;
00734
00735 oid suffix[] = { 2, 1, 8 };
00736 createNew = 0;
00737 prefix_len = sizeof(RMLeakyBucketConfig_variables_oid)/sizeof(oid);
00738
00739 id = header_writeGeneric(name, name_len, RMLeakyBucketConfig_variables_oid, prefix_len, suffix, 3, LEAKYBUCKETCONFIG, &createNew);
00740
00741 if(action == COMMIT && *long_ret == DESTROY && id == 0)
00742 return SNMP_ERR_NOERROR;
00743
00744 if(id == 0)
00745 return SNMP_ERR_NOSUCHNAME;
00746
00747
00748 switch ( action ) {
00749 case RESERVE1:
00750 if (var_val_type != ASN_INTEGER){
00751 fprintf(stderr, "write to leakyBucketConfigStatus not ASN_INTEGER\n");
00752 return SNMP_ERR_WRONGTYPE;
00753 }
00754 if (var_val_len > sizeof(long_ret)){
00755 fprintf(stderr,"write to leakyBucketConfigStatus: bad length\n");
00756 return SNMP_ERR_WRONGLENGTH;
00757 }
00758 break;
00759
00760
00761 case RESERVE2:
00762 size = var_val_len;
00763 long_ret = (long *) var_val;
00764
00765 rowCreated = 0;
00766 oldStatus = 0;
00767 if (*long_ret < ACTIVE || *long_ret > DESTROY ||
00768 *long_ret == NOTREADY)
00769 return SNMP_ERR_INCONSISTENTVALUE;
00770
00771 if(createNew &&
00772 (*long_ret != CREATEANDWAIT && *long_ret != CREATEANDGO))
00773 return SNMP_ERR_INCONSISTENTVALUE;
00774
00775 if (*long_ret == NOTINSERVICE || *long_ret == ACTIVE) {
00776 ret = getInteger32(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_STATUS, id, &oldStatus);
00777 if(ret)
00778 return SNMP_ERR_INCONSISTENTVALUE;
00779 }
00780
00781
00782 break;
00783
00784
00785 case FREE:
00786
00787 break;
00788
00789
00790 case ACTION:
00791
00792
00793
00794 if(*long_ret == CREATEANDWAIT || *long_ret == CREATEANDGO) {
00795 ret = newEntry(LEAKYBUCKETCONFIG, id);
00796 if(ret)
00797 return SNMP_ERR_INCONSISTENTVALUE;
00798
00799 rowCreated = 1;
00800 }
00801 else if (*long_ret == NOTINSERVICE || *long_ret == ACTIVE) {
00802 ret = setInteger32(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_STATUS, id, *long_ret);
00803 if(ret)
00804 return SNMP_ERR_INCONSISTENTVALUE;
00805 }
00806 else if(*long_ret == DESTROY) {
00807 ret = deleteEntry(LEAKYBUCKETCONFIG, id);
00808 if(ret)
00809 return SNMP_ERR_INCONSISTENTVALUE;
00810 }
00811
00812
00813 break;
00814
00815
00816 case UNDO:
00817
00818 if(rowCreated) {
00819 deleteEntry(LEAKYBUCKETCONFIG, id);
00820 }
00821 else if(*long_ret == NOTINSERVICE || *long_ret == ACTIVE) {
00822 if(oldStatus != 0)
00823 setInteger32(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_STATUS, id, oldStatus);
00824 }
00825 else if((*long_ret == DESTROY)) {
00826
00827
00828
00829 }
00830
00831 break;
00832
00833
00834 case COMMIT:
00835
00836
00837 if(*long_ret == CREATEANDGO) {
00838 ret = setInteger32(LEAKYBUCKETCONFIG, LEAKYBUCKETCONFIG_STATUS, id, ACTIVE);
00839 if(ret) {
00840 deleteEntry(LEAKYBUCKETCONFIG, id);
00841 return SNMP_ERR_COMMITFAILED;
00842 }
00843 }
00844
00845 break;
00846 }
00847 return SNMP_ERR_NOERROR;
00848 }
00849
00850
00851
00852
00853
00854