| 1 |
/* |
| 2 |
* This file was generated by mib2c and is intended for use as |
| 3 |
* a mib module for the ucd-snmp snmpd agent. |
| 4 |
*/ |
| 5 |
|
| 6 |
|
| 7 |
/* |
| 8 |
* This should always be included first before anything else |
| 9 |
*/ |
| 10 |
#include <net-snmp/net-snmp-config.h> |
| 11 |
#ifdef HAVE_STDLIB_H |
| 12 |
#include <stdlib.h> |
| 13 |
#endif |
| 14 |
#ifdef HAVE_STRING_H |
| 15 |
#include <string.h> |
| 16 |
#else |
| 17 |
#include <strings.h> |
| 18 |
#endif |
| 19 |
|
| 20 |
|
| 21 |
/* |
| 22 |
* minimal include directives |
| 23 |
*/ |
| 24 |
#include <net-snmp/net-snmp-includes.h> |
| 25 |
#include <net-snmp/agent/net-snmp-agent-includes.h> |
| 26 |
|
| 27 |
#include "header_complex.h" |
| 28 |
#include "mteTriggerExistenceTable.h" |
| 29 |
#include "mteTriggerTable.h" |
| 30 |
|
| 31 |
|
| 32 |
/* |
| 33 |
* mteTriggerExistenceTable_variables_oid: |
| 34 |
* this is the top level oid that we want to register under. This |
| 35 |
* is essentially a prefix, with the suffix appearing in the |
| 36 |
* variable below. |
| 37 |
*/ |
| 38 |
|
| 39 |
|
| 40 |
oid mteTriggerExistenceTable_variables_oid[] = |
| 41 |
{ 1, 3, 6, 1, 2, 1, 88, 1, 2, 4 }; |
| 42 |
|
| 43 |
|
| 44 |
/* |
| 45 |
* variable2 mteTriggerExistenceTable_variables: |
| 46 |
* this variable defines function callbacks and type return information |
| 47 |
* for the mteTriggerExistenceTable mib section |
| 48 |
*/ |
| 49 |
|
| 50 |
|
| 51 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 52 |
struct variable2 mteTriggerExistenceTable_variables[] = { |
| 53 |
/* |
| 54 |
* magic number , variable type , ro/rw , callback fn , L, oidsuffix |
| 55 |
*/ |
| 56 |
#define MTETRIGGEREXISTENCETEST 3 |
| 57 |
{MTETRIGGEREXISTENCETEST, ASN_BIT_STR, NETSNMP_OLDAPI_RWRITE, |
| 58 |
var_mteTriggerExistenceTable, 2, {1, 1}}, |
| 59 |
#define MTETRIGGEREXISTENCESTARTUP 4 |
| 60 |
{MTETRIGGEREXISTENCESTARTUP, ASN_BIT_STR, NETSNMP_OLDAPI_RWRITE, |
| 61 |
var_mteTriggerExistenceTable, 2, {1, 2}}, |
| 62 |
#define MTETRIGGEREXISTENCEOBJECTSOWNER 5 |
| 63 |
{MTETRIGGEREXISTENCEOBJECTSOWNER, ASN_OCTET_STR, NETSNMP_OLDAPI_RWRITE, |
| 64 |
var_mteTriggerExistenceTable, 2, {1, 3}}, |
| 65 |
#define MTETRIGGEREXISTENCEOBJECTS 6 |
| 66 |
{MTETRIGGEREXISTENCEOBJECTS, ASN_OCTET_STR, NETSNMP_OLDAPI_RWRITE, |
| 67 |
var_mteTriggerExistenceTable, 2, {1, 4}}, |
| 68 |
#define MTETRIGGEREXISTENCEEVENTOWNER 7 |
| 69 |
{MTETRIGGEREXISTENCEEVENTOWNER, ASN_OCTET_STR, NETSNMP_OLDAPI_RWRITE, |
| 70 |
var_mteTriggerExistenceTable, 2, {1, 5}}, |
| 71 |
#define MTETRIGGEREXISTENCEEVENT 8 |
| 72 |
{MTETRIGGEREXISTENCEEVENT, ASN_OCTET_STR, NETSNMP_OLDAPI_RWRITE, |
| 73 |
var_mteTriggerExistenceTable, 2, {1, 6}}, |
| 74 |
}; |
| 75 |
#else /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 76 |
struct variable2 mteTriggerExistenceTable_variables[] = { |
| 77 |
/* |
| 78 |
* magic number , variable type , ro/rw , callback fn , L, oidsuffix |
| 79 |
*/ |
| 80 |
#define MTETRIGGEREXISTENCETEST 3 |
| 81 |
{MTETRIGGEREXISTENCETEST, ASN_BIT_STR, NETSNMP_OLDAPI_RONLY, |
| 82 |
var_mteTriggerExistenceTable, 2, {1, 1}}, |
| 83 |
#define MTETRIGGEREXISTENCESTARTUP 4 |
| 84 |
{MTETRIGGEREXISTENCESTARTUP, ASN_BIT_STR, NETSNMP_OLDAPI_RONLY, |
| 85 |
var_mteTriggerExistenceTable, 2, {1, 2}}, |
| 86 |
#define MTETRIGGEREXISTENCEOBJECTSOWNER 5 |
| 87 |
{MTETRIGGEREXISTENCEOBJECTSOWNER, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, |
| 88 |
var_mteTriggerExistenceTable, 2, {1, 3}}, |
| 89 |
#define MTETRIGGEREXISTENCEOBJECTS 6 |
| 90 |
{MTETRIGGEREXISTENCEOBJECTS, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, |
| 91 |
var_mteTriggerExistenceTable, 2, {1, 4}}, |
| 92 |
#define MTETRIGGEREXISTENCEEVENTOWNER 7 |
| 93 |
{MTETRIGGEREXISTENCEEVENTOWNER, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, |
| 94 |
var_mteTriggerExistenceTable, 2, {1, 5}}, |
| 95 |
#define MTETRIGGEREXISTENCEEVENT 8 |
| 96 |
{MTETRIGGEREXISTENCEEVENT, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, |
| 97 |
var_mteTriggerExistenceTable, 2, {1, 6}}, |
| 98 |
}; |
| 99 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 100 |
|
| 101 |
/* |
| 102 |
* (L = length of the oidsuffix) |
| 103 |
*/ |
| 104 |
|
| 105 |
|
| 106 |
/* |
| 107 |
* init_mteTriggerExistenceTable(): |
| 108 |
* Initialization routine. This is called when the agent starts up. |
| 109 |
* At a minimum, registration of your variables should take place here. |
| 110 |
*/ |
| 111 |
void |
| 112 |
init_mteTriggerExistenceTable(void) |
| 113 |
{ |
| 114 |
DEBUGMSGTL(("mteTriggerExistenceTable", "initializing... ")); |
| 115 |
|
| 116 |
|
| 117 |
/* |
| 118 |
* register ourselves with the agent to handle our mib tree |
| 119 |
*/ |
| 120 |
REGISTER_MIB("mteTriggerExistenceTable", |
| 121 |
mteTriggerExistenceTable_variables, variable2, |
| 122 |
mteTriggerExistenceTable_variables_oid); |
| 123 |
|
| 124 |
|
| 125 |
/* |
| 126 |
* place any other initialization junk you need here |
| 127 |
*/ |
| 128 |
|
| 129 |
|
| 130 |
DEBUGMSGTL(("mteTriggerExistenceTable", "done.\n")); |
| 131 |
} |
| 132 |
|
| 133 |
/* |
| 134 |
* var_mteTriggerExistenceTable(): |
| 135 |
* Handle this table separately from the scalar value case. |
| 136 |
* The workings of this are basically the same as for var_mteTriggerExistenceTable above. |
| 137 |
*/ |
| 138 |
unsigned char * |
| 139 |
var_mteTriggerExistenceTable(struct variable *vp, |
| 140 |
oid * name, |
| 141 |
size_t * length, |
| 142 |
int exact, |
| 143 |
size_t * var_len, WriteMethod ** write_method) |
| 144 |
{ |
| 145 |
|
| 146 |
|
| 147 |
struct mteTriggerTable_data *StorageTmp = NULL; |
| 148 |
|
| 149 |
|
| 150 |
DEBUGMSGTL(("mteTriggerExistenceTable", |
| 151 |
"var_mteTriggerExistenceTable: Entering... \n")); |
| 152 |
|
| 153 |
/* set default value */ |
| 154 |
*write_method = NULL; |
| 155 |
|
| 156 |
/* |
| 157 |
* this assumes you have registered all your data properly |
| 158 |
*/ |
| 159 |
if ((StorageTmp = |
| 160 |
header_complex(mteTriggerTableStorage, vp, name, length, exact, |
| 161 |
var_len, write_method)) == NULL) |
| 162 |
return NULL; |
| 163 |
|
| 164 |
if (!(StorageTmp->mteTriggerTest[0] & MTETRIGGERTEST_EXISTENCE)) |
| 165 |
return NULL; |
| 166 |
|
| 167 |
/* |
| 168 |
* this is where we do the value assignments for the mib results. |
| 169 |
*/ |
| 170 |
switch (vp->magic) { |
| 171 |
|
| 172 |
|
| 173 |
case MTETRIGGEREXISTENCETEST: |
| 174 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 175 |
*write_method = write_mteTriggerExistenceTest; |
| 176 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 177 |
*var_len = StorageTmp->mteTriggerExistenceTestLen; |
| 178 |
return (u_char *) StorageTmp->mteTriggerExistenceTest; |
| 179 |
|
| 180 |
case MTETRIGGEREXISTENCESTARTUP: |
| 181 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 182 |
*write_method = write_mteTriggerExistenceStartup; |
| 183 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 184 |
*var_len = StorageTmp->mteTriggerExistenceStartupLen; |
| 185 |
return (u_char *) StorageTmp->mteTriggerExistenceStartup; |
| 186 |
|
| 187 |
case MTETRIGGEREXISTENCEOBJECTSOWNER: |
| 188 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 189 |
*write_method = write_mteTriggerExistenceObjectsOwner; |
| 190 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 191 |
*var_len = StorageTmp->mteTriggerExistenceObjectsOwnerLen; |
| 192 |
return (u_char *) StorageTmp->mteTriggerExistenceObjectsOwner; |
| 193 |
|
| 194 |
case MTETRIGGEREXISTENCEOBJECTS: |
| 195 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 196 |
*write_method = write_mteTriggerExistenceObjects; |
| 197 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 198 |
*var_len = StorageTmp->mteTriggerExistenceObjectsLen; |
| 199 |
return (u_char *) StorageTmp->mteTriggerExistenceObjects; |
| 200 |
|
| 201 |
case MTETRIGGEREXISTENCEEVENTOWNER: |
| 202 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 203 |
*write_method = write_mteTriggerExistenceEventOwner; |
| 204 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 205 |
*var_len = StorageTmp->mteTriggerExistenceEventOwnerLen; |
| 206 |
return (u_char *) StorageTmp->mteTriggerExistenceEventOwner; |
| 207 |
|
| 208 |
case MTETRIGGEREXISTENCEEVENT: |
| 209 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 210 |
*write_method = write_mteTriggerExistenceEvent; |
| 211 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 212 |
*var_len = StorageTmp->mteTriggerExistenceEventLen; |
| 213 |
return (u_char *) StorageTmp->mteTriggerExistenceEvent; |
| 214 |
|
| 215 |
|
| 216 |
default: |
| 217 |
ERROR_MSG(""); |
| 218 |
} |
| 219 |
return NULL; |
| 220 |
} |
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 225 |
|
| 226 |
int |
| 227 |
write_mteTriggerExistenceTest(int action, |
| 228 |
u_char * var_val, |
| 229 |
u_char var_val_type, |
| 230 |
size_t var_val_len, |
| 231 |
u_char * statP, oid * name, size_t name_len) |
| 232 |
{ |
| 233 |
static char *tmpvar; |
| 234 |
struct mteTriggerTable_data *StorageTmp = NULL; |
| 235 |
static size_t tmplen; |
| 236 |
size_t newlen = |
| 237 |
name_len - |
| 238 |
(sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 - |
| 239 |
1); |
| 240 |
|
| 241 |
|
| 242 |
DEBUGMSGTL(("mteTriggerExistenceTable", |
| 243 |
"write_mteTriggerExistenceTest entering action=%d... \n", |
| 244 |
action)); |
| 245 |
if ((StorageTmp = |
| 246 |
header_complex(mteTriggerTableStorage, NULL, |
| 247 |
&name[sizeof |
| 248 |
(mteTriggerExistenceTable_variables_oid) / |
| 249 |
sizeof(oid) + 3 - 1], &newlen, 1, NULL, |
| 250 |
NULL)) == NULL) |
| 251 |
return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */ |
| 252 |
|
| 253 |
|
| 254 |
switch (action) { |
| 255 |
case RESERVE1: |
| 256 |
if (var_val_type != ASN_OCTET_STR) { |
| 257 |
fprintf(stderr, |
| 258 |
"write to mteTriggerExistenceTest not ASN_OCTET_STR\n"); |
| 259 |
return SNMP_ERR_WRONGTYPE; |
| 260 |
} |
| 261 |
if (StorageTmp->storageType != ST_NONVOLATILE) |
| 262 |
return SNMP_ERR_NOTWRITABLE; |
| 263 |
break; |
| 264 |
|
| 265 |
|
| 266 |
case RESERVE2: |
| 267 |
/* |
| 268 |
* memory reseveration, final preparation... |
| 269 |
*/ |
| 270 |
break; |
| 271 |
|
| 272 |
|
| 273 |
case FREE: |
| 274 |
/* |
| 275 |
* Release any resources that have been allocated |
| 276 |
*/ |
| 277 |
break; |
| 278 |
|
| 279 |
|
| 280 |
case ACTION: |
| 281 |
/* |
| 282 |
* The variable has been stored in string for |
| 283 |
* you to use, and you have just been asked to do something with |
| 284 |
* it. Note that anything done here must be reversable in the UNDO case |
| 285 |
*/ |
| 286 |
tmpvar = StorageTmp->mteTriggerExistenceTest; |
| 287 |
tmplen = StorageTmp->mteTriggerExistenceTestLen; |
| 288 |
StorageTmp->mteTriggerExistenceTest = |
| 289 |
netsnmp_memdup(var_val, var_val_len); |
| 290 |
StorageTmp->mteTriggerExistenceTestLen = var_val_len; |
| 291 |
break; |
| 292 |
|
| 293 |
|
| 294 |
case UNDO: |
| 295 |
/* |
| 296 |
* Back out any changes made in the ACTION case |
| 297 |
*/ |
| 298 |
SNMP_FREE(StorageTmp->mteTriggerExistenceTest); |
| 299 |
StorageTmp->mteTriggerExistenceTest = tmpvar; |
| 300 |
StorageTmp->mteTriggerExistenceTestLen = tmplen; |
| 301 |
break; |
| 302 |
|
| 303 |
|
| 304 |
case COMMIT: |
| 305 |
/* |
| 306 |
* Things are working well, so it's now safe to make the change |
| 307 |
* permanently. Make sure that anything done here can't fail! |
| 308 |
*/ |
| 309 |
SNMP_FREE(tmpvar); |
| 310 |
break; |
| 311 |
} |
| 312 |
return SNMP_ERR_NOERROR; |
| 313 |
} |
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
int |
| 318 |
write_mteTriggerExistenceStartup(int action, |
| 319 |
u_char * var_val, |
| 320 |
u_char var_val_type, |
| 321 |
size_t var_val_len, |
| 322 |
u_char * statP, |
| 323 |
oid * name, size_t name_len) |
| 324 |
{ |
| 325 |
static char *tmpvar; |
| 326 |
struct mteTriggerTable_data *StorageTmp = NULL; |
| 327 |
static size_t tmplen; |
| 328 |
size_t newlen = |
| 329 |
name_len - |
| 330 |
(sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 - |
| 331 |
1); |
| 332 |
|
| 333 |
|
| 334 |
DEBUGMSGTL(("mteTriggerExistenceTable", |
| 335 |
"write_mteTriggerExistenceStartup entering action=%d... \n", |
| 336 |
action)); |
| 337 |
if ((StorageTmp = |
| 338 |
header_complex(mteTriggerTableStorage, NULL, |
| 339 |
&name[sizeof |
| 340 |
(mteTriggerExistenceTable_variables_oid) / |
| 341 |
sizeof(oid) + 3 - 1], &newlen, 1, NULL, |
| 342 |
NULL)) == NULL) |
| 343 |
return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */ |
| 344 |
|
| 345 |
|
| 346 |
switch (action) { |
| 347 |
case RESERVE1: |
| 348 |
if (var_val_type != ASN_OCTET_STR) { |
| 349 |
fprintf(stderr, |
| 350 |
"write to mteTriggerExistenceStartup not ASN_OCTET_STR\n"); |
| 351 |
return SNMP_ERR_WRONGTYPE; |
| 352 |
} |
| 353 |
if (StorageTmp->storageType != ST_NONVOLATILE) |
| 354 |
return SNMP_ERR_NOTWRITABLE; |
| 355 |
break; |
| 356 |
|
| 357 |
|
| 358 |
case RESERVE2: |
| 359 |
/* |
| 360 |
* memory reseveration, final preparation... |
| 361 |
*/ |
| 362 |
break; |
| 363 |
|
| 364 |
|
| 365 |
case FREE: |
| 366 |
/* |
| 367 |
* Release any resources that have been allocated |
| 368 |
*/ |
| 369 |
break; |
| 370 |
|
| 371 |
|
| 372 |
case ACTION: |
| 373 |
/* |
| 374 |
* The variable has been stored in string for |
| 375 |
* you to use, and you have just been asked to do something with |
| 376 |
* it. Note that anything done here must be reversable in the UNDO case |
| 377 |
*/ |
| 378 |
tmpvar = StorageTmp->mteTriggerExistenceStartup; |
| 379 |
tmplen = StorageTmp->mteTriggerExistenceStartupLen; |
| 380 |
StorageTmp->mteTriggerExistenceStartup = |
| 381 |
netsnmp_memdup(var_val, var_val_len); |
| 382 |
StorageTmp->mteTriggerExistenceStartupLen = var_val_len; |
| 383 |
break; |
| 384 |
|
| 385 |
|
| 386 |
case UNDO: |
| 387 |
/* |
| 388 |
* Back out any changes made in the ACTION case |
| 389 |
*/ |
| 390 |
SNMP_FREE(StorageTmp->mteTriggerExistenceStartup); |
| 391 |
StorageTmp->mteTriggerExistenceStartup = tmpvar; |
| 392 |
StorageTmp->mteTriggerExistenceStartupLen = tmplen; |
| 393 |
break; |
| 394 |
|
| 395 |
|
| 396 |
case COMMIT: |
| 397 |
/* |
| 398 |
* Things are working well, so it's now safe to make the change |
| 399 |
* permanently. Make sure that anything done here can't fail! |
| 400 |
*/ |
| 401 |
SNMP_FREE(tmpvar); |
| 402 |
break; |
| 403 |
} |
| 404 |
return SNMP_ERR_NOERROR; |
| 405 |
} |
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
int |
| 410 |
write_mteTriggerExistenceObjectsOwner(int action, |
| 411 |
u_char * var_val, |
| 412 |
u_char var_val_type, |
| 413 |
size_t var_val_len, |
| 414 |
u_char * statP, |
| 415 |
oid * name, size_t name_len) |
| 416 |
{ |
| 417 |
static char *tmpvar; |
| 418 |
struct mteTriggerTable_data *StorageTmp = NULL; |
| 419 |
static size_t tmplen; |
| 420 |
size_t newlen = |
| 421 |
name_len - |
| 422 |
(sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 - |
| 423 |
1); |
| 424 |
|
| 425 |
|
| 426 |
DEBUGMSGTL(("mteTriggerExistenceTable", |
| 427 |
"write_mteTriggerExistenceObjectsOwner entering action=%d... \n", |
| 428 |
action)); |
| 429 |
if ((StorageTmp = |
| 430 |
header_complex(mteTriggerTableStorage, NULL, |
| 431 |
&name[sizeof |
| 432 |
(mteTriggerExistenceTable_variables_oid) / |
| 433 |
sizeof(oid) + 3 - 1], &newlen, 1, NULL, |
| 434 |
NULL)) == NULL) |
| 435 |
return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */ |
| 436 |
|
| 437 |
|
| 438 |
switch (action) { |
| 439 |
case RESERVE1: |
| 440 |
if (var_val_type != ASN_OCTET_STR) { |
| 441 |
fprintf(stderr, |
| 442 |
"write to mteTriggerExistenceObjectsOwner not ASN_OCTET_STR\n"); |
| 443 |
return SNMP_ERR_WRONGTYPE; |
| 444 |
} |
| 445 |
if (StorageTmp->storageType != ST_NONVOLATILE) |
| 446 |
return SNMP_ERR_NOTWRITABLE; |
| 447 |
break; |
| 448 |
|
| 449 |
|
| 450 |
case RESERVE2: |
| 451 |
/* |
| 452 |
* memory reseveration, final preparation... |
| 453 |
*/ |
| 454 |
break; |
| 455 |
|
| 456 |
|
| 457 |
case FREE: |
| 458 |
/* |
| 459 |
* Release any resources that have been allocated |
| 460 |
*/ |
| 461 |
break; |
| 462 |
|
| 463 |
|
| 464 |
case ACTION: |
| 465 |
/* |
| 466 |
* The variable has been stored in string for |
| 467 |
* you to use, and you have just been asked to do something with |
| 468 |
* it. Note that anything done here must be reversable in the UNDO case |
| 469 |
*/ |
| 470 |
tmpvar = StorageTmp->mteTriggerExistenceObjectsOwner; |
| 471 |
tmplen = StorageTmp->mteTriggerExistenceObjectsOwnerLen; |
| 472 |
StorageTmp->mteTriggerExistenceObjectsOwner = |
| 473 |
netsnmp_memdup(var_val, var_val_len); |
| 474 |
StorageTmp->mteTriggerExistenceObjectsOwnerLen = var_val_len; |
| 475 |
break; |
| 476 |
|
| 477 |
|
| 478 |
case UNDO: |
| 479 |
/* |
| 480 |
* Back out any changes made in the ACTION case |
| 481 |
*/ |
| 482 |
SNMP_FREE(StorageTmp->mteTriggerExistenceObjectsOwner); |
| 483 |
StorageTmp->mteTriggerExistenceObjectsOwner = tmpvar; |
| 484 |
StorageTmp->mteTriggerExistenceObjectsOwnerLen = tmplen; |
| 485 |
break; |
| 486 |
|
| 487 |
|
| 488 |
case COMMIT: |
| 489 |
/* |
| 490 |
* Things are working well, so it's now safe to make the change |
| 491 |
* permanently. Make sure that anything done here can't fail! |
| 492 |
*/ |
| 493 |
SNMP_FREE(tmpvar); |
| 494 |
break; |
| 495 |
} |
| 496 |
return SNMP_ERR_NOERROR; |
| 497 |
} |
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
int |
| 502 |
write_mteTriggerExistenceObjects(int action, |
| 503 |
u_char * var_val, |
| 504 |
u_char var_val_type, |
| 505 |
size_t var_val_len, |
| 506 |
u_char * statP, |
| 507 |
oid * name, size_t name_len) |
| 508 |
{ |
| 509 |
static char *tmpvar; |
| 510 |
struct mteTriggerTable_data *StorageTmp = NULL; |
| 511 |
static size_t tmplen; |
| 512 |
size_t newlen = |
| 513 |
name_len - |
| 514 |
(sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 - |
| 515 |
1); |
| 516 |
|
| 517 |
|
| 518 |
DEBUGMSGTL(("mteTriggerExistenceTable", |
| 519 |
"write_mteTriggerExistenceObjects entering action=%d... \n", |
| 520 |
action)); |
| 521 |
if ((StorageTmp = |
| 522 |
header_complex(mteTriggerTableStorage, NULL, |
| 523 |
&name[sizeof |
| 524 |
(mteTriggerExistenceTable_variables_oid) / |
| 525 |
sizeof(oid) + 3 - 1], &newlen, 1, NULL, |
| 526 |
NULL)) == NULL) |
| 527 |
return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */ |
| 528 |
|
| 529 |
|
| 530 |
switch (action) { |
| 531 |
case RESERVE1: |
| 532 |
if (var_val_type != ASN_OCTET_STR) { |
| 533 |
fprintf(stderr, |
| 534 |
"write to mteTriggerExistenceObjects not ASN_OCTET_STR\n"); |
| 535 |
return SNMP_ERR_WRONGTYPE; |
| 536 |
} |
| 537 |
if (StorageTmp->storageType != ST_NONVOLATILE) |
| 538 |
return SNMP_ERR_NOTWRITABLE; |
| 539 |
break; |
| 540 |
|
| 541 |
|
| 542 |
case RESERVE2: |
| 543 |
/* |
| 544 |
* memory reseveration, final preparation... |
| 545 |
*/ |
| 546 |
break; |
| 547 |
|
| 548 |
|
| 549 |
case FREE: |
| 550 |
/* |
| 551 |
* Release any resources that have been allocated |
| 552 |
*/ |
| 553 |
break; |
| 554 |
|
| 555 |
|
| 556 |
case ACTION: |
| 557 |
/* |
| 558 |
* The variable has been stored in string for |
| 559 |
* you to use, and you have just been asked to do something with |
| 560 |
* it. Note that anything done here must be reversable in the UNDO case |
| 561 |
*/ |
| 562 |
tmpvar = StorageTmp->mteTriggerExistenceObjects; |
| 563 |
tmplen = StorageTmp->mteTriggerExistenceObjectsLen; |
| 564 |
StorageTmp->mteTriggerExistenceObjects = |
| 565 |
netsnmp_memdup(var_val, var_val_len); |
| 566 |
StorageTmp->mteTriggerExistenceObjectsLen = var_val_len; |
| 567 |
break; |
| 568 |
|
| 569 |
|
| 570 |
case UNDO: |
| 571 |
/* |
| 572 |
* Back out any changes made in the ACTION case |
| 573 |
*/ |
| 574 |
SNMP_FREE(StorageTmp->mteTriggerExistenceObjects); |
| 575 |
StorageTmp->mteTriggerExistenceObjects = tmpvar; |
| 576 |
StorageTmp->mteTriggerExistenceObjectsLen = tmplen; |
| 577 |
break; |
| 578 |
|
| 579 |
|
| 580 |
case COMMIT: |
| 581 |
/* |
| 582 |
* Things are working well, so it's now safe to make the change |
| 583 |
* permanently. Make sure that anything done here can't fail! |
| 584 |
*/ |
| 585 |
SNMP_FREE(tmpvar); |
| 586 |
break; |
| 587 |
} |
| 588 |
return SNMP_ERR_NOERROR; |
| 589 |
} |
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
int |
| 594 |
write_mteTriggerExistenceEventOwner(int action, |
| 595 |
u_char * var_val, |
| 596 |
u_char var_val_type, |
| 597 |
size_t var_val_len, |
| 598 |
u_char * statP, |
| 599 |
oid * name, size_t name_len) |
| 600 |
{ |
| 601 |
static char *tmpvar; |
| 602 |
struct mteTriggerTable_data *StorageTmp = NULL; |
| 603 |
static size_t tmplen; |
| 604 |
size_t newlen = |
| 605 |
name_len - |
| 606 |
(sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 - |
| 607 |
1); |
| 608 |
|
| 609 |
|
| 610 |
DEBUGMSGTL(("mteTriggerExistenceTable", |
| 611 |
"write_mteTriggerExistenceEventOwner entering action=%d... \n", |
| 612 |
action)); |
| 613 |
if ((StorageTmp = |
| 614 |
header_complex(mteTriggerTableStorage, NULL, |
| 615 |
&name[sizeof |
| 616 |
(mteTriggerExistenceTable_variables_oid) / |
| 617 |
sizeof(oid) + 3 - 1], &newlen, 1, NULL, |
| 618 |
NULL)) == NULL) |
| 619 |
return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */ |
| 620 |
|
| 621 |
|
| 622 |
switch (action) { |
| 623 |
case RESERVE1: |
| 624 |
if (var_val_type != ASN_OCTET_STR) { |
| 625 |
fprintf(stderr, |
| 626 |
"write to mteTriggerExistenceEventOwner not ASN_OCTET_STR\n"); |
| 627 |
return SNMP_ERR_WRONGTYPE; |
| 628 |
} |
| 629 |
if (StorageTmp->storageType != ST_NONVOLATILE) |
| 630 |
return SNMP_ERR_NOTWRITABLE; |
| 631 |
break; |
| 632 |
|
| 633 |
|
| 634 |
case RESERVE2: |
| 635 |
/* |
| 636 |
* memory reseveration, final preparation... |
| 637 |
*/ |
| 638 |
break; |
| 639 |
|
| 640 |
|
| 641 |
case FREE: |
| 642 |
/* |
| 643 |
* Release any resources that have been allocated |
| 644 |
*/ |
| 645 |
break; |
| 646 |
|
| 647 |
|
| 648 |
case ACTION: |
| 649 |
/* |
| 650 |
* The variable has been stored in string for |
| 651 |
* you to use, and you have just been asked to do something with |
| 652 |
* it. Note that anything done here must be reversable in the UNDO case |
| 653 |
*/ |
| 654 |
tmpvar = StorageTmp->mteTriggerExistenceEventOwner; |
| 655 |
tmplen = StorageTmp->mteTriggerExistenceEventOwnerLen; |
| 656 |
StorageTmp->mteTriggerExistenceEventOwner = |
| 657 |
netsnmp_memdup(var_val, var_val_len); |
| 658 |
StorageTmp->mteTriggerExistenceEventOwnerLen = var_val_len; |
| 659 |
break; |
| 660 |
|
| 661 |
|
| 662 |
case UNDO: |
| 663 |
/* |
| 664 |
* Back out any changes made in the ACTION case |
| 665 |
*/ |
| 666 |
SNMP_FREE(StorageTmp->mteTriggerExistenceEventOwner); |
| 667 |
StorageTmp->mteTriggerExistenceEventOwner = tmpvar; |
| 668 |
StorageTmp->mteTriggerExistenceEventOwnerLen = tmplen; |
| 669 |
break; |
| 670 |
|
| 671 |
|
| 672 |
case COMMIT: |
| 673 |
/* |
| 674 |
* Things are working well, so it's now safe to make the change |
| 675 |
* permanently. Make sure that anything done here can't fail! |
| 676 |
*/ |
| 677 |
SNMP_FREE(tmpvar); |
| 678 |
break; |
| 679 |
} |
| 680 |
return SNMP_ERR_NOERROR; |
| 681 |
} |
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
int |
| 686 |
write_mteTriggerExistenceEvent(int action, |
| 687 |
u_char * var_val, |
| 688 |
u_char var_val_type, |
| 689 |
size_t var_val_len, |
| 690 |
u_char * statP, oid * name, size_t name_len) |
| 691 |
{ |
| 692 |
static char *tmpvar; |
| 693 |
struct mteTriggerTable_data *StorageTmp = NULL; |
| 694 |
static size_t tmplen; |
| 695 |
size_t newlen = |
| 696 |
name_len - |
| 697 |
(sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 - |
| 698 |
1); |
| 699 |
|
| 700 |
|
| 701 |
DEBUGMSGTL(("mteTriggerExistenceTable", |
| 702 |
"write_mteTriggerExistenceEvent entering action=%d... \n", |
| 703 |
action)); |
| 704 |
if ((StorageTmp = |
| 705 |
header_complex(mteTriggerTableStorage, NULL, |
| 706 |
&name[sizeof |
| 707 |
(mteTriggerExistenceTable_variables_oid) / |
| 708 |
sizeof(oid) + 3 - 1], &newlen, 1, NULL, |
| 709 |
NULL)) == NULL) |
| 710 |
return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */ |
| 711 |
|
| 712 |
|
| 713 |
switch (action) { |
| 714 |
case RESERVE1: |
| 715 |
if (var_val_type != ASN_OCTET_STR) { |
| 716 |
fprintf(stderr, |
| 717 |
"write to mteTriggerExistenceEvent not ASN_OCTET_STR\n"); |
| 718 |
return SNMP_ERR_WRONGTYPE; |
| 719 |
} |
| 720 |
if (StorageTmp->storageType != ST_NONVOLATILE) |
| 721 |
return SNMP_ERR_NOTWRITABLE; |
| 722 |
break; |
| 723 |
|
| 724 |
|
| 725 |
case RESERVE2: |
| 726 |
/* |
| 727 |
* memory reseveration, final preparation... |
| 728 |
*/ |
| 729 |
break; |
| 730 |
|
| 731 |
|
| 732 |
case FREE: |
| 733 |
/* |
| 734 |
* Release any resources that have been allocated |
| 735 |
*/ |
| 736 |
break; |
| 737 |
|
| 738 |
|
| 739 |
case ACTION: |
| 740 |
/* |
| 741 |
* The variable has been stored in string for |
| 742 |
* you to use, and you have just been asked to do something with |
| 743 |
* it. Note that anything done here must be reversable in the UNDO case |
| 744 |
*/ |
| 745 |
tmpvar = StorageTmp->mteTriggerExistenceEvent; |
| 746 |
tmplen = StorageTmp->mteTriggerExistenceEventLen; |
| 747 |
StorageTmp->mteTriggerExistenceEvent = |
| 748 |
netsnmp_memdup(var_val, var_val_len); |
| 749 |
StorageTmp->mteTriggerExistenceEventLen = var_val_len; |
| 750 |
break; |
| 751 |
|
| 752 |
|
| 753 |
case UNDO: |
| 754 |
/* |
| 755 |
* Back out any changes made in the ACTION case |
| 756 |
*/ |
| 757 |
SNMP_FREE(StorageTmp->mteTriggerExistenceEvent); |
| 758 |
StorageTmp->mteTriggerExistenceEvent = tmpvar; |
| 759 |
StorageTmp->mteTriggerExistenceEventLen = tmplen; |
| 760 |
break; |
| 761 |
|
| 762 |
|
| 763 |
case COMMIT: |
| 764 |
/* |
| 765 |
* Things are working well, so it's now safe to make the change |
| 766 |
* permanently. Make sure that anything done here can't fail! |
| 767 |
*/ |
| 768 |
SNMP_FREE(tmpvar); |
| 769 |
break; |
| 770 |
} |
| 771 |
return SNMP_ERR_NOERROR; |
| 772 |
} |
| 773 |
|
| 774 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |