2
* This file was generated by mib2c and is intended for use as
3
* a mib module for the ucd-snmp snmpd agent.
8
* This should always be included first before anything else
10
#include <net-snmp/net-snmp-config.h>
12
#include <sys/types.h>
26
* minimal include directives
28
#include <net-snmp/net-snmp-includes.h>
29
#include <net-snmp/agent/net-snmp-agent-includes.h>
31
#include "header_complex.h"
32
#include "snmpNotifyTable.h"
33
#include "target/snmpTargetParamsEntry.h"
34
#include "target/snmpTargetAddrEntry.h"
35
#include "target/target.h"
36
#include <net-snmp/agent/agent_callbacks.h>
37
#include <net-snmp/agent/agent_trap.h>
39
SNMPCallback store_snmpNotifyTable;
42
* snmpNotifyTable_variables_oid:
43
* this is the top level oid that we want to register under. This
44
* is essentially a prefix, with the suffix appearing in the
49
oid snmpNotifyTable_variables_oid[] =
50
{ 1, 3, 6, 1, 6, 3, 13, 1, 1 };
54
* variable2 snmpNotifyTable_variables:
55
* this variable defines function callbacks and type return information
56
* for the snmpNotifyTable mib section
60
struct variable2 snmpNotifyTable_variables[] = {
62
* magic number , variable type , ro/rw , callback fn , L, oidsuffix
64
#define SNMPNOTIFYTAG 4
65
{SNMPNOTIFYTAG, ASN_OCTET_STR, RWRITE, var_snmpNotifyTable, 2, {1, 2}},
66
#define SNMPNOTIFYTYPE 5
67
{SNMPNOTIFYTYPE, ASN_INTEGER, RWRITE, var_snmpNotifyTable, 2, {1, 3}},
68
#define SNMPNOTIFYSTORAGETYPE 6
69
{SNMPNOTIFYSTORAGETYPE, ASN_INTEGER, RWRITE, var_snmpNotifyTable, 2,
71
#define SNMPNOTIFYROWSTATUS 7
72
{SNMPNOTIFYROWSTATUS, ASN_INTEGER, RWRITE, var_snmpNotifyTable, 2,
77
* (L = length of the oidsuffix)
82
* global storage of our data, saved in and configured by header_complex()
84
static struct header_complex_index *snmpNotifyTableStorage = NULL;
87
send_notifications(int major, int minor, void *serverarg, void *clientarg)
89
struct header_complex_index *hptr;
90
struct snmpNotifyTable_data *nptr;
91
netsnmp_session *sess, *sptr;
92
netsnmp_pdu *template_pdu = (netsnmp_pdu *) serverarg;
94
DEBUGMSGTL(("send_notifications", "starting: pdu=%x, vars=%x\n",
95
template_pdu, template_pdu->variables));
97
for (hptr = snmpNotifyTableStorage; hptr; hptr = hptr->next) {
98
nptr = (struct snmpNotifyTable_data *) hptr->data;
99
if (nptr->snmpNotifyRowStatus != RS_ACTIVE)
101
if (!nptr->snmpNotifyTag)
104
sess = get_target_sessions(nptr->snmpNotifyTag, NULL, NULL);
107
* XXX: filter appropriately
110
for (sptr = sess; sptr; sptr = sptr->next) {
111
if (sptr->version == SNMP_VERSION_1 &&
112
minor == SNMPD_CALLBACK_SEND_TRAP1) {
113
send_trap_to_sess(sptr, template_pdu);
114
} else if (sptr->version != SNMP_VERSION_1 &&
115
minor == SNMPD_CALLBACK_SEND_TRAP2) {
116
if (nptr->snmpNotifyType == SNMPNOTIFYTYPE_INFORM) {
117
template_pdu->command = SNMP_MSG_INFORM;
119
template_pdu->command = SNMP_MSG_TRAP2;
121
send_trap_to_sess(sptr, template_pdu);
128
#define MAX_ENTRIES 1024
131
notifyTable_register_notifications(int major, int minor,
132
void *serverarg, void *clientarg)
134
struct targetAddrTable_struct *ptr;
135
struct targetParamTable_struct *pptr;
136
struct snmpNotifyTable_data *nptr;
138
char buf[SNMP_MAXBUF_SMALL];
139
netsnmp_transport *t = NULL;
140
struct agent_add_trap_args *args =
141
(struct agent_add_trap_args *) serverarg;
144
if (!args || !(args->ss)) {
147
confirm = args->confirm;
151
* XXX: START move target creation to target code
153
for (i = 0; i < MAX_ENTRIES; i++) {
154
sprintf(buf, "internal%d", i);
155
if (get_addrForName(buf) == NULL && get_paramEntry(buf) == NULL)
158
if (i == MAX_ENTRIES) {
160
"Can't register new trap destination: max limit reached: %d",
169
ptr = snmpTargetAddrTable_create();
170
ptr->name = strdup(buf);
171
t = snmp_sess_transport(snmp_sess_pointer(ss));
172
memcpy(ptr->tDomain, t->domain, t->domain_length * sizeof(oid));
173
ptr->tDomainLen = t->domain_length;
174
ptr->tAddressLen = t->remote_length;
175
ptr->tAddress = t->remote;
177
ptr->timeout = ss->timeout / 1000;
178
ptr->retryCount = ss->retries;
179
SNMP_FREE(ptr->tagList);
180
ptr->tagList = strdup(ptr->name);
181
ptr->params = strdup(ptr->name);
182
ptr->storageType = ST_READONLY;
183
ptr->rowStatus = RS_ACTIVE;
185
DEBUGMSGTL(("trapsess", "adding to trap table\n"));
186
snmpTargetAddrTable_add(ptr);
191
pptr = snmpTargetParamTable_create();
192
pptr->paramName = strdup(buf);
193
pptr->mpModel = ss->version;
194
if (ss->version == SNMP_VERSION_3) {
195
pptr->secModel = ss->securityModel;
196
pptr->secLevel = ss->securityLevel;
197
pptr->secName = (char *) malloc(ss->securityNameLen + 1);
198
memcpy((void *) pptr->secName, (void *) ss->securityName,
199
ss->securityNameLen);
200
pptr->secName[ss->securityNameLen] = 0;
202
pptr->secModel = ss->version == SNMP_VERSION_1 ?
203
SNMP_SEC_MODEL_SNMPv1 : SNMP_SEC_MODEL_SNMPv2c;
204
pptr->secLevel = SNMP_SEC_LEVEL_NOAUTH;
205
pptr->secName = NULL;
206
if (ss->community && (ss->community_len > 0)) {
207
pptr->secName = (char *) malloc(ss->community_len + 1);
208
memcpy((void *) pptr->secName, (void *) ss->community,
210
pptr->secName[ss->community_len] = 0;
213
pptr->storageType = ST_READONLY;
214
pptr->rowStatus = RS_ACTIVE;
215
snmpTargetParamTable_add(pptr);
217
* XXX: END move target creation to target code
223
nptr = SNMP_MALLOC_STRUCT(snmpNotifyTable_data);
224
nptr->snmpNotifyName = strdup(buf);
225
nptr->snmpNotifyNameLen = strlen(buf);
226
nptr->snmpNotifyTag = strdup(buf);
227
nptr->snmpNotifyTagLen = strlen(buf);
228
nptr->snmpNotifyType = confirm ?
229
SNMPNOTIFYTYPE_INFORM : SNMPNOTIFYTYPE_TRAP;
230
nptr->snmpNotifyStorageType = ST_READONLY;
231
nptr->snmpNotifyRowStatus = RS_ACTIVE;
233
snmpNotifyTable_add(nptr);
239
* XXX: this really needs to be done for the target mib entries too.
240
* But we can only trust that we've added stuff here and we don't want
241
* to destroy other valid entries in the target tables, so... Don't
242
* do too many kill -HUPs to your agent as re reading the config file
243
* will be a slow memory leak in the target mib.
246
notifyTable_unregister_notifications(int major, int minor,
247
void *serverarg, void *clientarg)
249
struct header_complex_index *hptr, *nhptr;
250
struct snmpNotifyTable_data *nptr;
252
for (hptr = snmpNotifyTableStorage; hptr; hptr = nhptr) {
253
nptr = (struct snmpNotifyTable_data *) hptr->data;
255
if (nptr->snmpNotifyStorageType == ST_READONLY) {
256
header_complex_extract_entry(&snmpNotifyTableStorage, hptr);
257
SNMP_FREE(nptr->snmpNotifyName);
258
SNMP_FREE(nptr->snmpNotifyTag);
266
* init_snmpNotifyTable():
267
* Initialization routine. This is called when the agent starts up.
268
* At a minimum, registration of your variables should take place here.
271
init_snmpNotifyTable(void)
273
DEBUGMSGTL(("snmpNotifyTable", "initializing... "));
277
* register ourselves with the agent to handle our mib tree
279
REGISTER_MIB("snmpNotifyTable", snmpNotifyTable_variables, variable2,
280
snmpNotifyTable_variables_oid);
284
* register our config handler(s) to deal with registrations
286
snmpd_register_config_handler("snmpNotifyTable", parse_snmpNotifyTable,
291
* we need to be called back later to store our data
293
snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
294
store_snmpNotifyTable, NULL);
296
snmp_register_callback(SNMP_CALLBACK_APPLICATION,
297
SNMPD_CALLBACK_SEND_TRAP1, send_notifications,
299
snmp_register_callback(SNMP_CALLBACK_APPLICATION,
300
SNMPD_CALLBACK_SEND_TRAP2, send_notifications,
302
snmp_register_callback(SNMP_CALLBACK_APPLICATION,
303
SNMPD_CALLBACK_REGISTER_NOTIFICATIONS,
304
notifyTable_register_notifications, NULL);
305
snmp_register_callback(SNMP_CALLBACK_APPLICATION,
306
SNMPD_CALLBACK_PRE_UPDATE_CONFIG,
307
notifyTable_unregister_notifications, NULL);
310
* place any other initialization junk you need here
314
DEBUGMSGTL(("snmpNotifyTable", "done.\n"));
319
* snmpNotifyTable_add(): adds a structure node to our data set
322
snmpNotifyTable_add(struct snmpNotifyTable_data *thedata)
324
netsnmp_variable_list *vars = NULL;
327
DEBUGMSGTL(("snmpNotifyTable", "adding data... "));
329
* add the index variables to the varbind list, which is
330
* used by header_complex to index the data
334
snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR, (u_char *) thedata->snmpNotifyName, thedata->snmpNotifyNameLen); /* snmpNotifyName */
338
header_complex_add_data(&snmpNotifyTableStorage, vars, thedata);
339
DEBUGMSGTL(("snmpNotifyTable", "registered an entry\n"));
342
DEBUGMSGTL(("snmpNotifyTable", "done.\n"));
343
return SNMPERR_SUCCESS;
348
* parse_snmpNotifyTable():
349
* parses .conf file entries needed to configure the mib.
352
parse_snmpNotifyTable(const char *token, char *line)
355
struct snmpNotifyTable_data *StorageTmp =
356
SNMP_MALLOC_STRUCT(snmpNotifyTable_data);
359
DEBUGMSGTL(("snmpNotifyTable", "parsing config... "));
362
if (StorageTmp == NULL) {
363
config_perror("malloc failure");
368
read_config_read_data(ASN_OCTET_STR, line,
369
&StorageTmp->snmpNotifyName,
370
&StorageTmp->snmpNotifyNameLen);
371
if (StorageTmp->snmpNotifyName == NULL) {
372
config_perror("invalid specification for snmpNotifyName");
377
read_config_read_data(ASN_OCTET_STR, line,
378
&StorageTmp->snmpNotifyTag,
379
&StorageTmp->snmpNotifyTagLen);
380
if (StorageTmp->snmpNotifyTag == NULL) {
381
config_perror("invalid specification for snmpNotifyTag");
386
read_config_read_data(ASN_INTEGER, line,
387
&StorageTmp->snmpNotifyType, &tmpint);
390
read_config_read_data(ASN_INTEGER, line,
391
&StorageTmp->snmpNotifyStorageType, &tmpint);
394
read_config_read_data(ASN_INTEGER, line,
395
&StorageTmp->snmpNotifyRowStatus, &tmpint);
400
snmpNotifyTable_add(StorageTmp);
403
DEBUGMSGTL(("snmpNotifyTable", "done.\n"));
410
* store_snmpNotifyTable():
411
* stores .conf file entries needed to configure the mib.
414
store_snmpNotifyTable(int majorID, int minorID, void *serverarg,
417
char line[SNMP_MAXBUF];
420
struct snmpNotifyTable_data *StorageTmp;
421
struct header_complex_index *hcindex;
424
DEBUGMSGTL(("snmpNotifyTable", "storing data... "));
427
for (hcindex = snmpNotifyTableStorage; hcindex != NULL;
428
hcindex = hcindex->next) {
429
StorageTmp = (struct snmpNotifyTable_data *) hcindex->data;
431
if (StorageTmp->snmpNotifyStorageType == ST_NONVOLATILE) {
433
memset(line, 0, sizeof(line));
434
strcat(line, "snmpNotifyTable ");
435
cptr = line + strlen(line);
438
read_config_store_data(ASN_OCTET_STR, cptr,
439
&StorageTmp->snmpNotifyName,
440
&StorageTmp->snmpNotifyNameLen);
442
read_config_store_data(ASN_OCTET_STR, cptr,
443
&StorageTmp->snmpNotifyTag,
444
&StorageTmp->snmpNotifyTagLen);
446
read_config_store_data(ASN_INTEGER, cptr,
447
&StorageTmp->snmpNotifyType,
450
read_config_store_data(ASN_INTEGER, cptr,
451
&StorageTmp->snmpNotifyStorageType,
454
read_config_store_data(ASN_INTEGER, cptr,
455
&StorageTmp->snmpNotifyRowStatus,
458
snmpd_store_config(line);
461
DEBUGMSGTL(("snmpNotifyTable", "done.\n"));
469
* var_snmpNotifyTable():
470
* Handle this table separately from the scalar value case.
471
* The workings of this are basically the same as for var_snmpNotifyTable above.
474
var_snmpNotifyTable(struct variable *vp,
478
size_t * var_len, WriteMethod ** write_method)
480
struct snmpNotifyTable_data *StorageTmp = NULL;
483
DEBUGMSGTL(("snmpNotifyTable",
484
"var_snmpNotifyTable: Entering... \n"));
486
* this assumes you have registered all your data properly
488
if ((StorageTmp = (struct snmpNotifyTable_data *)
489
header_complex((struct header_complex_index *)
490
snmpNotifyTableStorage, vp, name, length, exact,
491
var_len, write_method)) == NULL) {
497
*write_method = write_snmpNotifyTag;
500
*write_method = write_snmpNotifyType;
502
case SNMPNOTIFYSTORAGETYPE:
503
*write_method = write_snmpNotifyStorageType;
505
case SNMPNOTIFYROWSTATUS:
506
*write_method = write_snmpNotifyRowStatus;
509
*write_method = NULL;
518
*var_len = StorageTmp->snmpNotifyTagLen;
519
return (u_char *) StorageTmp->snmpNotifyTag;
522
*var_len = sizeof(StorageTmp->snmpNotifyType);
523
return (u_char *) & StorageTmp->snmpNotifyType;
525
case SNMPNOTIFYSTORAGETYPE:
526
*var_len = sizeof(StorageTmp->snmpNotifyStorageType);
527
return (u_char *) & StorageTmp->snmpNotifyStorageType;
529
case SNMPNOTIFYROWSTATUS:
530
*var_len = sizeof(StorageTmp->snmpNotifyRowStatus);
531
return (u_char *) & StorageTmp->snmpNotifyRowStatus;
540
is_delim(const char c)
542
return (c == 0x020 || c == 0x09 || c == 0x0d || c == 0x0b);
546
snmpTagValid(const char *tag, const size_t tagLen)
551
for (i = 0; i < tagLen; i++) {
552
if (is_delim(tag[i])) {
554
* Delimeters aren't allowed.
562
static struct snmpNotifyTable_data *StorageNew;
565
write_snmpNotifyTag(int action,
569
u_char * statP, oid * name, size_t name_len)
572
struct snmpNotifyTable_data *StorageTmp = NULL;
573
static size_t tmplen;
575
name_len - (sizeof(snmpNotifyTable_variables_oid) / sizeof(oid) +
579
DEBUGMSGTL(("snmpNotifyTable",
580
"write_snmpNotifyTag entering action=%d... \n", action));
581
if (action != RESERVE1 &&
582
(StorageTmp = (struct snmpNotifyTable_data *)
583
header_complex((struct header_complex_index *)
584
snmpNotifyTableStorage, NULL,
585
&name[sizeof(snmpNotifyTable_variables_oid) /
586
sizeof(oid) + 3 - 1], &newlen, 1, NULL,
588
if ((StorageTmp = StorageNew) == NULL)
589
return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
595
if (var_val_type != ASN_OCTET_STR) {
596
return SNMP_ERR_WRONGTYPE;
598
if (var_val_len < 0 || var_val_len > 255) {
599
return SNMP_ERR_WRONGLENGTH;
601
if (!snmpTagValid(var_val, var_val_len)) {
602
return SNMP_ERR_WRONGVALUE;
609
* memory reseveration, final preparation...
616
* Release any resources that have been allocated
622
tmpvar = StorageTmp->snmpNotifyTag;
623
tmplen = StorageTmp->snmpNotifyTagLen;
624
memdup((u_char **) & StorageTmp->snmpNotifyTag, var_val,
626
StorageTmp->snmpNotifyTagLen = var_val_len;
632
* Back out any changes made in the ACTION case
634
SNMP_FREE(StorageTmp->snmpNotifyTag);
635
StorageTmp->snmpNotifyTag = tmpvar;
636
StorageTmp->snmpNotifyTagLen = tmplen;
643
* Things are working well, so it's now safe to make the change
644
* permanently. Make sure that anything done here can't fail!
650
return SNMP_ERR_NOERROR;
656
write_snmpNotifyType(int action,
660
u_char * statP, oid * name, size_t name_len)
663
struct snmpNotifyTable_data *StorageTmp = NULL;
664
long value = *((long *) var_val);
666
name_len - (sizeof(snmpNotifyTable_variables_oid) / sizeof(oid) +
670
DEBUGMSGTL(("snmpNotifyTable",
671
"write_snmpNotifyType entering action=%d... \n", action));
672
if (action != RESERVE1 &&
673
(StorageTmp = (struct snmpNotifyTable_data *)
674
header_complex((struct header_complex_index *)
675
snmpNotifyTableStorage, NULL,
676
&name[sizeof(snmpNotifyTable_variables_oid) /
677
sizeof(oid) + 3 - 1], &newlen, 1, NULL,
679
if ((StorageTmp = StorageNew) == NULL)
680
return SNMP_ERR_NOSUCHNAME;
685
if (var_val_type != ASN_INTEGER) {
686
return SNMP_ERR_WRONGTYPE;
688
if (var_val_len != sizeof(long)) {
689
return SNMP_ERR_WRONGLENGTH;
691
if (value < 1 || value > 2) {
692
return SNMP_ERR_WRONGVALUE;
697
tmpvar = StorageTmp->snmpNotifyType;
698
StorageTmp->snmpNotifyType = value;
703
* Back out any changes made in the ACTION case
705
StorageTmp->snmpNotifyType = tmpvar;
709
return SNMP_ERR_NOERROR;
715
write_snmpNotifyStorageType(int action,
719
u_char * statP, oid * name, size_t name_len)
722
long value = *((long *) var_val);
723
struct snmpNotifyTable_data *StorageTmp = NULL;
725
name_len - (sizeof(snmpNotifyTable_variables_oid) / sizeof(oid) +
729
DEBUGMSGTL(("snmpNotifyTable",
730
"write_snmpNotifyStorageType entering action=%d... \n",
732
if (action != RESERVE1 &&
733
(StorageTmp = (struct snmpNotifyTable_data *)
734
header_complex((struct header_complex_index *)
735
snmpNotifyTableStorage, NULL,
736
&name[sizeof(snmpNotifyTable_variables_oid) /
737
sizeof(oid) + 3 - 1], &newlen, 1, NULL,
739
if ((StorageTmp = StorageNew) == NULL)
740
return SNMP_ERR_NOSUCHNAME;
746
if (var_val_type != ASN_INTEGER) {
747
return SNMP_ERR_WRONGTYPE;
749
if (var_val_len != sizeof(long)) {
750
return SNMP_ERR_WRONGLENGTH;
752
if (value != SNMP_STORAGE_OTHER && value != SNMP_STORAGE_VOLATILE
753
&& value != SNMP_STORAGE_NONVOLATILE) {
754
return SNMP_ERR_WRONGVALUE;
759
tmpvar = StorageTmp->snmpNotifyStorageType;
760
StorageTmp->snmpNotifyStorageType = value;
764
StorageTmp->snmpNotifyStorageType = tmpvar;
767
return SNMP_ERR_NOERROR;
773
write_snmpNotifyRowStatus(int action,
777
u_char * statP, oid * name, size_t name_len)
779
struct snmpNotifyTable_data *StorageTmp = NULL;
780
static struct snmpNotifyTable_data *StorageDel;
782
name_len - (sizeof(snmpNotifyTable_variables_oid) / sizeof(oid) +
784
static int old_value;
785
int set_value = *((long *) var_val);
786
static netsnmp_variable_list *vars, *vp;
787
struct header_complex_index *hciptr;
790
DEBUGMSGTL(("snmpNotifyTable",
791
"write_snmpNotifyRowStatus entering action=%d... \n",
793
StorageTmp = (struct snmpNotifyTable_data *)
794
header_complex((struct header_complex_index *)
795
snmpNotifyTableStorage, NULL,
796
&name[sizeof(snmpNotifyTable_variables_oid) /
797
sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
801
if (var_val_type != ASN_INTEGER || var_val == NULL) {
802
return SNMP_ERR_WRONGTYPE;
804
if (var_val_len != sizeof(long)) {
805
return SNMP_ERR_WRONGLENGTH;
807
if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY) {
808
return SNMP_ERR_WRONGVALUE;
810
if (StorageTmp == NULL) {
812
* create the row now?
815
* ditch illegal values now
817
if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
818
return SNMP_ERR_INCONSISTENTVALUE;
822
* row exists. Check for a valid state change
824
if (set_value == RS_CREATEANDGO
825
|| set_value == RS_CREATEANDWAIT) {
827
* can't create a row that exists
829
return SNMP_ERR_INCONSISTENTVALUE;
832
* XXX: interaction with row storage type needed
837
* memory reseveration, final preparation...
839
if (StorageTmp == NULL &&
840
(set_value == RS_CREATEANDGO
841
|| set_value == RS_CREATEANDWAIT)) {
847
snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR, NULL, 0); /* snmpNotifyName */
849
if (header_complex_parse_oid
852
[sizeof(snmpNotifyTable_variables_oid) / sizeof(oid) +
853
2]), newlen, vars) != SNMPERR_SUCCESS) {
855
* XXX: free, zero vars
858
return SNMP_ERR_INCONSISTENTNAME;
863
StorageNew = SNMP_MALLOC_STRUCT(snmpNotifyTable_data);
864
if (StorageNew == NULL) {
865
return SNMP_ERR_RESOURCEUNAVAILABLE;
867
memdup((u_char **) & (StorageNew->snmpNotifyName),
868
vp->val.string, vp->val_len);
869
if (StorageNew->snmpNotifyName == NULL) {
870
return SNMP_ERR_RESOURCEUNAVAILABLE;
872
StorageNew->snmpNotifyNameLen = vp->val_len;
873
vp = vp->next_variable;
878
StorageNew->snmpNotifyStorageType = ST_NONVOLATILE;
879
StorageNew->snmpNotifyType = SNMPNOTIFYTYPE_TRAP;
880
StorageNew->snmpNotifyTagLen = 0;
881
StorageNew->snmpNotifyTag = (char *) calloc(sizeof(char), 1);
882
if (StorageNew->snmpNotifyTag == NULL) {
883
return SNMP_ERR_RESOURCEUNAVAILABLE;
886
StorageNew->snmpNotifyRowStatus = set_value;
895
if (StorageNew != NULL) {
896
SNMP_FREE(StorageNew->snmpNotifyTag);
897
SNMP_FREE(StorageNew->snmpNotifyName);
904
if (StorageTmp == NULL && (set_value == RS_CREATEANDGO ||
905
set_value == RS_CREATEANDWAIT)) {
907
* row creation, so add it
909
if (StorageNew != NULL) {
910
snmpNotifyTable_add(StorageNew);
912
} else if (set_value != RS_DESTROY) {
916
old_value = StorageTmp->snmpNotifyRowStatus;
917
StorageTmp->snmpNotifyRowStatus = *((long *) var_val);
920
* destroy... extract it for now
923
hciptr = header_complex_find_entry(snmpNotifyTableStorage,
925
StorageDel = (struct snmpNotifyTable_data *)
926
header_complex_extract_entry((struct
927
header_complex_index **)
928
&snmpNotifyTableStorage,
936
* Back out any changes made in the ACTION case
938
if (StorageTmp == NULL && (set_value == RS_CREATEANDGO ||
939
set_value == RS_CREATEANDWAIT)) {
941
* row creation, so remove it again
943
hciptr = header_complex_find_entry(snmpNotifyTableStorage,
945
StorageDel = (struct snmpNotifyTable_data *)
946
header_complex_extract_entry((struct header_complex_index
947
**) &snmpNotifyTableStorage,
952
} else if (StorageDel != NULL) {
954
* row deletion, so add it again
956
snmpNotifyTable_add(StorageDel);
957
} else if (set_value != RS_DESTROY) {
958
StorageTmp->snmpNotifyRowStatus = old_value;
963
if (StorageDel != NULL) {
964
SNMP_FREE(StorageDel->snmpNotifyTag);
965
SNMP_FREE(StorageDel->snmpNotifyName);
970
&& StorageTmp->snmpNotifyRowStatus == RS_CREATEANDGO) {
971
StorageTmp->snmpNotifyRowStatus = RS_ACTIVE;
973
} else if (StorageTmp &&
974
StorageTmp->snmpNotifyRowStatus == RS_CREATEANDWAIT) {
975
StorageTmp->snmpNotifyRowStatus = RS_NOTINSERVICE;
980
return SNMP_ERR_NOERROR;