| 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 "mteTriggerDeltaTable.h" |
| 29 |
#include "mteTriggerTable.h" |
| 30 |
|
| 31 |
|
| 32 |
/* |
| 33 |
* mteTriggerDeltaTable_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 mteTriggerDeltaTable_variables_oid[] = |
| 41 |
{ 1, 3, 6, 1, 2, 1, 88, 1, 2, 3 }; |
| 42 |
|
| 43 |
|
| 44 |
/* |
| 45 |
* variable2 mteTriggerDeltaTable_variables: |
| 46 |
* this variable defines function callbacks and type return information |
| 47 |
* for the mteTriggerDeltaTable mib section |
| 48 |
*/ |
| 49 |
|
| 50 |
|
| 51 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 52 |
struct variable2 mteTriggerDeltaTable_variables[] = { |
| 53 |
/* |
| 54 |
* magic number , variable type , ro/rw , callback fn , L, oidsuffix |
| 55 |
*/ |
| 56 |
#define MTETRIGGERDELTADISCONTINUITYID 3 |
| 57 |
{MTETRIGGERDELTADISCONTINUITYID, ASN_OBJECT_ID, NETSNMP_OLDAPI_RWRITE, |
| 58 |
var_mteTriggerDeltaTable, 2, {1, 1}}, |
| 59 |
#define MTETRIGGERDELTADISCONTINUITYIDWILDCARD 4 |
| 60 |
{MTETRIGGERDELTADISCONTINUITYIDWILDCARD, ASN_INTEGER, NETSNMP_OLDAPI_RWRITE, |
| 61 |
var_mteTriggerDeltaTable, 2, {1, 2}}, |
| 62 |
#define MTETRIGGERDELTADISCONTINUITYIDTYPE 5 |
| 63 |
{MTETRIGGERDELTADISCONTINUITYIDTYPE, ASN_INTEGER, NETSNMP_OLDAPI_RWRITE, |
| 64 |
var_mteTriggerDeltaTable, 2, {1, 3}}, |
| 65 |
}; |
| 66 |
#else /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 67 |
struct variable2 mteTriggerDeltaTable_variables[] = { |
| 68 |
/* |
| 69 |
* magic number , variable type , ro/rw , callback fn , L, oidsuffix |
| 70 |
*/ |
| 71 |
#define MTETRIGGERDELTADISCONTINUITYID 3 |
| 72 |
{MTETRIGGERDELTADISCONTINUITYID, ASN_OBJECT_ID, NETSNMP_OLDAPI_RONLY, |
| 73 |
var_mteTriggerDeltaTable, 2, {1, 1}}, |
| 74 |
#define MTETRIGGERDELTADISCONTINUITYIDWILDCARD 4 |
| 75 |
{MTETRIGGERDELTADISCONTINUITYIDWILDCARD, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, |
| 76 |
var_mteTriggerDeltaTable, 2, {1, 2}}, |
| 77 |
#define MTETRIGGERDELTADISCONTINUITYIDTYPE 5 |
| 78 |
{MTETRIGGERDELTADISCONTINUITYIDTYPE, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, |
| 79 |
var_mteTriggerDeltaTable, 2, {1, 3}}, |
| 80 |
}; |
| 81 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 82 |
|
| 83 |
/* |
| 84 |
* (L = length of the oidsuffix) |
| 85 |
*/ |
| 86 |
|
| 87 |
|
| 88 |
/* |
| 89 |
* init_mteTriggerDeltaTable(): |
| 90 |
* Initialization routine. This is called when the agent starts up. |
| 91 |
* At a minimum, registration of your variables should take place here. |
| 92 |
*/ |
| 93 |
void |
| 94 |
init_mteTriggerDeltaTable(void) |
| 95 |
{ |
| 96 |
DEBUGMSGTL(("mteTriggerDeltaTable", "initializing... ")); |
| 97 |
|
| 98 |
|
| 99 |
/* |
| 100 |
* register ourselves with the agent to handle our mib tree |
| 101 |
*/ |
| 102 |
REGISTER_MIB("mteTriggerDeltaTable", mteTriggerDeltaTable_variables, |
| 103 |
variable2, mteTriggerDeltaTable_variables_oid); |
| 104 |
|
| 105 |
DEBUGMSGTL(("mteTriggerDeltaTable", "done.\n")); |
| 106 |
} |
| 107 |
|
| 108 |
/* |
| 109 |
* var_mteTriggerDeltaTable(): |
| 110 |
* Handle this table separately from the scalar value case. |
| 111 |
* The workings of this are basically the same as for var_mteTriggerDeltaTable above. |
| 112 |
*/ |
| 113 |
unsigned char * |
| 114 |
var_mteTriggerDeltaTable(struct variable *vp, |
| 115 |
oid * name, |
| 116 |
size_t * length, |
| 117 |
int exact, |
| 118 |
size_t * var_len, WriteMethod ** write_method) |
| 119 |
{ |
| 120 |
|
| 121 |
|
| 122 |
struct mteTriggerTable_data *StorageTmp = NULL; |
| 123 |
|
| 124 |
|
| 125 |
DEBUGMSGTL(("mteTriggerDeltaTable", |
| 126 |
"var_mteTriggerDeltaTable: Entering... \n")); |
| 127 |
|
| 128 |
/* set default value */ |
| 129 |
*write_method = NULL; |
| 130 |
|
| 131 |
/* |
| 132 |
* this assumes you have registered all your data properly |
| 133 |
*/ |
| 134 |
if ((StorageTmp = |
| 135 |
header_complex(mteTriggerTableStorage, vp, name, length, exact, |
| 136 |
var_len, write_method)) == NULL) |
| 137 |
return NULL; |
| 138 |
|
| 139 |
/* |
| 140 |
* this is where we do the value assignments for the mib results. |
| 141 |
*/ |
| 142 |
switch (vp->magic) { |
| 143 |
|
| 144 |
|
| 145 |
case MTETRIGGERDELTADISCONTINUITYID: |
| 146 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 147 |
*write_method = write_mteTriggerDeltaDiscontinuityID; |
| 148 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 149 |
*var_len = |
| 150 |
StorageTmp->mteTriggerDeltaDiscontinuityIDLen * sizeof(oid); |
| 151 |
return (u_char *) StorageTmp->mteTriggerDeltaDiscontinuityID; |
| 152 |
|
| 153 |
case MTETRIGGERDELTADISCONTINUITYIDWILDCARD: |
| 154 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 155 |
*write_method = write_mteTriggerDeltaDiscontinuityIDWildcard; |
| 156 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 157 |
*var_len = |
| 158 |
sizeof(StorageTmp->mteTriggerDeltaDiscontinuityIDWildcard); |
| 159 |
return (u_char *) & StorageTmp-> |
| 160 |
mteTriggerDeltaDiscontinuityIDWildcard; |
| 161 |
|
| 162 |
case MTETRIGGERDELTADISCONTINUITYIDTYPE: |
| 163 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 164 |
*write_method = write_mteTriggerDeltaDiscontinuityIDType; |
| 165 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 166 |
*var_len = sizeof(StorageTmp->mteTriggerDeltaDiscontinuityIDType); |
| 167 |
return (u_char *) & StorageTmp->mteTriggerDeltaDiscontinuityIDType; |
| 168 |
|
| 169 |
default: |
| 170 |
ERROR_MSG(""); |
| 171 |
} |
| 172 |
return NULL; |
| 173 |
} |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 178 |
int |
| 179 |
write_mteTriggerDeltaDiscontinuityID(int action, |
| 180 |
u_char * var_val, |
| 181 |
u_char var_val_type, |
| 182 |
size_t var_val_len, |
| 183 |
u_char * statP, |
| 184 |
oid * name, size_t name_len) |
| 185 |
{ |
| 186 |
static oid *tmpvar; |
| 187 |
struct mteTriggerTable_data *StorageTmp = NULL; |
| 188 |
static size_t tmplen; |
| 189 |
size_t newlen = |
| 190 |
name_len - |
| 191 |
(sizeof(mteTriggerDeltaTable_variables_oid) / sizeof(oid) + 3 - 1); |
| 192 |
|
| 193 |
|
| 194 |
DEBUGMSGTL(("mteTriggerDeltaTable", |
| 195 |
"write_mteTriggerDeltaDiscontinuityID entering action=%d... \n", |
| 196 |
action)); |
| 197 |
if ((StorageTmp = |
| 198 |
header_complex(mteTriggerTableStorage, NULL, |
| 199 |
&name[sizeof(mteTriggerDeltaTable_variables_oid) / |
| 200 |
sizeof(oid) + 3 - 1], &newlen, 1, NULL, |
| 201 |
NULL)) == NULL) |
| 202 |
return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */ |
| 203 |
|
| 204 |
|
| 205 |
switch (action) { |
| 206 |
case RESERVE1: |
| 207 |
if (var_val_type != ASN_OBJECT_ID) { |
| 208 |
fprintf(stderr, |
| 209 |
"write to mteTriggerDeltaDiscontinuityID not ASN_OBJECT_ID\n"); |
| 210 |
return SNMP_ERR_WRONGTYPE; |
| 211 |
} |
| 212 |
if (StorageTmp->storageType != ST_NONVOLATILE) |
| 213 |
return SNMP_ERR_NOTWRITABLE; |
| 214 |
break; |
| 215 |
|
| 216 |
|
| 217 |
case RESERVE2: |
| 218 |
/* |
| 219 |
* memory reseveration, final preparation... |
| 220 |
*/ |
| 221 |
break; |
| 222 |
|
| 223 |
|
| 224 |
case FREE: |
| 225 |
/* |
| 226 |
* Release any resources that have been allocated |
| 227 |
*/ |
| 228 |
break; |
| 229 |
|
| 230 |
|
| 231 |
case ACTION: |
| 232 |
/* |
| 233 |
* The variable has been stored in objid for |
| 234 |
* you to use, and you have just been asked to do something with |
| 235 |
* it. Note that anything done here must be reversable in the UNDO case |
| 236 |
*/ |
| 237 |
tmpvar = StorageTmp->mteTriggerDeltaDiscontinuityID; |
| 238 |
tmplen = StorageTmp->mteTriggerDeltaDiscontinuityIDLen; |
| 239 |
StorageTmp->mteTriggerDeltaDiscontinuityID = |
| 240 |
netsnmp_memdup(var_val, var_val_len); |
| 241 |
StorageTmp->mteTriggerDeltaDiscontinuityIDLen = |
| 242 |
var_val_len / sizeof(oid); |
| 243 |
break; |
| 244 |
|
| 245 |
|
| 246 |
case UNDO: |
| 247 |
/* |
| 248 |
* Back out any changes made in the ACTION case |
| 249 |
*/ |
| 250 |
SNMP_FREE(StorageTmp->mteTriggerDeltaDiscontinuityID); |
| 251 |
StorageTmp->mteTriggerDeltaDiscontinuityID = tmpvar; |
| 252 |
StorageTmp->mteTriggerDeltaDiscontinuityIDLen = tmplen; |
| 253 |
break; |
| 254 |
|
| 255 |
|
| 256 |
case COMMIT: |
| 257 |
/* |
| 258 |
* Things are working well, so it's now safe to make the change |
| 259 |
* permanently. Make sure that anything done here can't fail! |
| 260 |
*/ |
| 261 |
SNMP_FREE(tmpvar); |
| 262 |
break; |
| 263 |
} |
| 264 |
return SNMP_ERR_NOERROR; |
| 265 |
} |
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
int |
| 270 |
write_mteTriggerDeltaDiscontinuityIDWildcard(int action, |
| 271 |
u_char * var_val, |
| 272 |
u_char var_val_type, |
| 273 |
size_t var_val_len, |
| 274 |
u_char * statP, |
| 275 |
oid * name, size_t name_len) |
| 276 |
{ |
| 277 |
static int tmpvar; |
| 278 |
struct mteTriggerTable_data *StorageTmp = NULL; |
| 279 |
size_t newlen = |
| 280 |
name_len - |
| 281 |
(sizeof(mteTriggerDeltaTable_variables_oid) / sizeof(oid) + 3 - 1); |
| 282 |
|
| 283 |
|
| 284 |
DEBUGMSGTL(("mteTriggerDeltaTable", |
| 285 |
"write_mteTriggerDeltaDiscontinuityIDWildcard entering action=%d... \n", |
| 286 |
action)); |
| 287 |
if ((StorageTmp = |
| 288 |
header_complex(mteTriggerTableStorage, NULL, |
| 289 |
&name[sizeof(mteTriggerDeltaTable_variables_oid) / |
| 290 |
sizeof(oid) + 3 - 1], &newlen, 1, NULL, |
| 291 |
NULL)) == NULL) |
| 292 |
return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */ |
| 293 |
|
| 294 |
|
| 295 |
switch (action) { |
| 296 |
case RESERVE1: |
| 297 |
if (var_val_type != ASN_INTEGER) { |
| 298 |
fprintf(stderr, |
| 299 |
"write to mteTriggerDeltaDiscontinuityIDWildcard not ASN_INTEGER\n"); |
| 300 |
return SNMP_ERR_WRONGTYPE; |
| 301 |
} |
| 302 |
if (StorageTmp->storageType != ST_NONVOLATILE) |
| 303 |
return SNMP_ERR_NOTWRITABLE; |
| 304 |
break; |
| 305 |
|
| 306 |
|
| 307 |
case RESERVE2: |
| 308 |
/* |
| 309 |
* memory reseveration, final preparation... |
| 310 |
*/ |
| 311 |
break; |
| 312 |
|
| 313 |
|
| 314 |
case FREE: |
| 315 |
/* |
| 316 |
* Release any resources that have been allocated |
| 317 |
*/ |
| 318 |
break; |
| 319 |
|
| 320 |
|
| 321 |
case ACTION: |
| 322 |
/* |
| 323 |
* The variable has been stored in long_ret for |
| 324 |
* you to use, and you have just been asked to do something with |
| 325 |
* it. Note that anything done here must be reversable in the UNDO case |
| 326 |
*/ |
| 327 |
tmpvar = StorageTmp->mteTriggerDeltaDiscontinuityIDWildcard; |
| 328 |
StorageTmp->mteTriggerDeltaDiscontinuityIDWildcard = |
| 329 |
*((long *) var_val); |
| 330 |
break; |
| 331 |
|
| 332 |
|
| 333 |
case UNDO: |
| 334 |
/* |
| 335 |
* Back out any changes made in the ACTION case |
| 336 |
*/ |
| 337 |
StorageTmp->mteTriggerDeltaDiscontinuityIDWildcard = tmpvar; |
| 338 |
break; |
| 339 |
|
| 340 |
|
| 341 |
case COMMIT: |
| 342 |
/* |
| 343 |
* Things are working well, so it's now safe to make the change |
| 344 |
* permanently. Make sure that anything done here can't fail! |
| 345 |
*/ |
| 346 |
|
| 347 |
break; |
| 348 |
} |
| 349 |
return SNMP_ERR_NOERROR; |
| 350 |
} |
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
int |
| 355 |
write_mteTriggerDeltaDiscontinuityIDType(int action, |
| 356 |
u_char * var_val, |
| 357 |
u_char var_val_type, |
| 358 |
size_t var_val_len, |
| 359 |
u_char * statP, |
| 360 |
oid * name, size_t name_len) |
| 361 |
{ |
| 362 |
static int tmpvar; |
| 363 |
struct mteTriggerTable_data *StorageTmp = NULL; |
| 364 |
size_t newlen = |
| 365 |
name_len - |
| 366 |
(sizeof(mteTriggerDeltaTable_variables_oid) / sizeof(oid) + 3 - 1); |
| 367 |
|
| 368 |
|
| 369 |
DEBUGMSGTL(("mteTriggerDeltaTable", |
| 370 |
"write_mteTriggerDeltaDiscontinuityIDType entering action=%d... \n", |
| 371 |
action)); |
| 372 |
if ((StorageTmp = |
| 373 |
header_complex(mteTriggerTableStorage, NULL, |
| 374 |
&name[sizeof(mteTriggerDeltaTable_variables_oid) / |
| 375 |
sizeof(oid) + 3 - 1], &newlen, 1, NULL, |
| 376 |
NULL)) == NULL) |
| 377 |
return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */ |
| 378 |
|
| 379 |
|
| 380 |
switch (action) { |
| 381 |
case RESERVE1: |
| 382 |
if (var_val_type != ASN_INTEGER) { |
| 383 |
fprintf(stderr, |
| 384 |
"write to mteTriggerDeltaDiscontinuityIDType not ASN_INTEGER\n"); |
| 385 |
return SNMP_ERR_WRONGTYPE; |
| 386 |
} |
| 387 |
if (StorageTmp->storageType != ST_NONVOLATILE) |
| 388 |
return SNMP_ERR_NOTWRITABLE; |
| 389 |
break; |
| 390 |
|
| 391 |
|
| 392 |
case RESERVE2: |
| 393 |
/* |
| 394 |
* memory reseveration, final preparation... |
| 395 |
*/ |
| 396 |
break; |
| 397 |
|
| 398 |
|
| 399 |
case FREE: |
| 400 |
/* |
| 401 |
* Release any resources that have been allocated |
| 402 |
*/ |
| 403 |
break; |
| 404 |
|
| 405 |
|
| 406 |
case ACTION: |
| 407 |
/* |
| 408 |
* The variable has been stored in long_ret for |
| 409 |
* you to use, and you have just been asked to do something with |
| 410 |
* it. Note that anything done here must be reversable in the UNDO case |
| 411 |
*/ |
| 412 |
tmpvar = StorageTmp->mteTriggerDeltaDiscontinuityIDType; |
| 413 |
StorageTmp->mteTriggerDeltaDiscontinuityIDType = |
| 414 |
*((long *) var_val); |
| 415 |
break; |
| 416 |
|
| 417 |
|
| 418 |
case UNDO: |
| 419 |
/* |
| 420 |
* Back out any changes made in the ACTION case |
| 421 |
*/ |
| 422 |
StorageTmp->mteTriggerDeltaDiscontinuityIDType = tmpvar; |
| 423 |
break; |
| 424 |
|
| 425 |
|
| 426 |
case COMMIT: |
| 427 |
/* |
| 428 |
* Things are working well, so it's now safe to make the change |
| 429 |
* permanently. Make sure that anything done here can't fail! |
| 430 |
*/ |
| 431 |
|
| 432 |
break; |
| 433 |
} |
| 434 |
return SNMP_ERR_NOERROR; |
| 435 |
} |
| 436 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |