| 1 |
/* |
| 2 |
*Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches. |
| 3 |
* |
| 4 |
*All right reserved |
| 5 |
* |
| 6 |
*File Name: expErrorTable.c |
| 7 |
*File Description: expErrorTable MIB operation. |
| 8 |
* |
| 9 |
*Current Version:1.0 |
| 10 |
*Author:JianShun Tong |
| 11 |
*Date:2004.8.20 |
| 12 |
*/ |
| 13 |
|
| 14 |
|
| 15 |
/* |
| 16 |
* This file was generated by mib2c and is intended for use as |
| 17 |
* a mib module for the ucd-snmp snmpd agent. |
| 18 |
*/ |
| 19 |
|
| 20 |
|
| 21 |
/* |
| 22 |
* This should always be included first before anything else |
| 23 |
*/ |
| 24 |
#include <net-snmp/net-snmp-config.h> |
| 25 |
#ifdef HAVE_STDLIB_H |
| 26 |
#include <stdlib.h> |
| 27 |
#endif |
| 28 |
#ifdef HAVE_STRING_H |
| 29 |
#include <string.h> |
| 30 |
#else |
| 31 |
#include <strings.h> |
| 32 |
#endif |
| 33 |
#ifdef HAVE_LIMITS_H |
| 34 |
#include <limits.h> |
| 35 |
#endif |
| 36 |
|
| 37 |
|
| 38 |
/* |
| 39 |
* minimal include directives |
| 40 |
*/ |
| 41 |
#include <net-snmp/net-snmp-includes.h> |
| 42 |
#include <net-snmp/agent/net-snmp-agent-includes.h> |
| 43 |
|
| 44 |
#include "header_complex.h" |
| 45 |
#include "expErrorTable.h" |
| 46 |
#include "expExpressionTable.h" |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
/* |
| 51 |
* expErrorTable_variables_oid: |
| 52 |
* this is the top level oid that we want to register under. This |
| 53 |
* is essentially a prefix, with the suffix appearing in the |
| 54 |
* variable below. |
| 55 |
*/ |
| 56 |
|
| 57 |
oid expErrorTable_variables_oid[] = |
| 58 |
{ 1, 3, 6, 1, 2, 1, 90, 1, 2, 2 }; |
| 59 |
|
| 60 |
/* |
| 61 |
* variable2 expErrorTable_variables: |
| 62 |
*/ |
| 63 |
|
| 64 |
struct variable2 expErrorTable_variables[] = { |
| 65 |
/* |
| 66 |
* magic number , variable type , ro/rw , callback fn , L, oidsuffix |
| 67 |
*/ |
| 68 |
#define EXPERRORTIME 1 |
| 69 |
{EXPERRORTIME, ASN_UNSIGNED, NETSNMP_OLDAPI_RONLY, |
| 70 |
var_expErrorTable, 2, {1, 1}}, |
| 71 |
#define EXPERRORINDEX 2 |
| 72 |
{EXPERRORINDEX, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, |
| 73 |
var_expErrorTable, 2, {1, 2}}, |
| 74 |
#define EXPERRORCODE 3 |
| 75 |
{EXPERRORCODE, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, |
| 76 |
var_expErrorTable, 2, {1, 3}}, |
| 77 |
#define EXPERRORINSTANCE 4 |
| 78 |
{EXPERRORINSTANCE, ASN_OBJECT_ID, NETSNMP_OLDAPI_RONLY, |
| 79 |
var_expErrorTable, 2, {1, 4}} |
| 80 |
}; |
| 81 |
|
| 82 |
void |
| 83 |
init_expErrorTable(void) |
| 84 |
{ |
| 85 |
DEBUGMSGTL(("expErrorTable", "initializing... ")); |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
/* |
| 90 |
* register ourselves with the agent to handle our mib tree |
| 91 |
*/ |
| 92 |
REGISTER_MIB("expErrorTable", |
| 93 |
expErrorTable_variables, variable2, |
| 94 |
expErrorTable_variables_oid); |
| 95 |
|
| 96 |
DEBUGMSGTL(("expErrorTable", "done.\n")); |
| 97 |
} |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
unsigned char * |
| 102 |
var_expErrorTable(struct variable *vp, |
| 103 |
oid * name, |
| 104 |
size_t *length, |
| 105 |
int exact, size_t *var_len, WriteMethod ** write_method) |
| 106 |
{ |
| 107 |
struct expExpressionTable_data *StorageTmp = NULL; |
| 108 |
|
| 109 |
DEBUGMSGTL(("expErrorTable", "var_expErrorTable: Entering... \n")); |
| 110 |
/* |
| 111 |
* this assumes you have registered all your data properly |
| 112 |
*/ |
| 113 |
if ((StorageTmp = |
| 114 |
header_complex(expExpressionTableStorage, vp, name, length, exact, |
| 115 |
var_len, write_method)) == NULL) |
| 116 |
return NULL; |
| 117 |
|
| 118 |
/* |
| 119 |
* this is where we do the value assignments for the mib results. |
| 120 |
*/ |
| 121 |
switch (vp->magic) { |
| 122 |
|
| 123 |
case EXPERRORTIME: |
| 124 |
*var_len = sizeof(StorageTmp->expErrorTime); |
| 125 |
return (u_char *) & StorageTmp->expErrorTime; |
| 126 |
|
| 127 |
case EXPERRORINDEX: |
| 128 |
*var_len = sizeof(StorageTmp->expErrorIndex); |
| 129 |
return (u_char *) & StorageTmp->expErrorIndex; |
| 130 |
|
| 131 |
case EXPERRORCODE: |
| 132 |
*var_len = sizeof(StorageTmp->expErrorCode); |
| 133 |
return (u_char *) & StorageTmp->expErrorCode; |
| 134 |
|
| 135 |
case EXPERRORINSTANCE: |
| 136 |
*var_len = StorageTmp->expErrorInstanceLen * sizeof(oid); |
| 137 |
return (u_char *) StorageTmp->expErrorInstance; |
| 138 |
} |
| 139 |
|
| 140 |
return NULL; |
| 141 |
} |