summaryrefslogtreecommitdiff
path: root/agent/mibgroup/disman/expression/expErrorTable.c
blob: 1feb3eeeef35bea80be2590412473d9baa0f51b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
 *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
 *
 *All right reserved
 *
 *File Name: expErrorTable.c
 *File Description: expErrorTable MIB operation.
 *
 *Current Version:1.0
 *Author:JianShun Tong
 *Date:2004.8.20
 */


/*
 * This file was generated by mib2c and is intended for use as
 * a mib module for the ucd-snmp snmpd agent. 
 */


/*
 * This should always be included first before anything else 
 */
#include <net-snmp/net-snmp-config.h>
#if HAVE_STDLIB_H
#include <stdlib.h>
#endif
#if HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif


/*
 * minimal include directives 
 */
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>

#include "header_complex.h"
#include "expErrorTable.h"
#include "expExpressionTable.h"



/*
 * expErrorTable_variables_oid:
 *   this is the top level oid that we want to register under.  This
 *   is essentially a prefix, with the suffix appearing in the
 *   variable below.
 */

oid             expErrorTable_variables_oid[] =
    { 1, 3, 6, 1, 2, 1, 90, 1, 2, 2 };

/*
 * variable2 expErrorTable_variables:
 */

struct variable2 expErrorTable_variables[] = {
    /*
     * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix 
     */
#define	EXPERRORTIME  1
    {EXPERRORTIME,  ASN_UNSIGNED, NETSNMP_OLDAPI_RONLY,
     var_expErrorTable, 2, {1, 1}},
#define	EXPERRORINDEX 2
    {EXPERRORINDEX, ASN_INTEGER,  NETSNMP_OLDAPI_RONLY,
     var_expErrorTable, 2, {1, 2}},
#define	EXPERRORCODE 3
    {EXPERRORCODE,  ASN_INTEGER,  NETSNMP_OLDAPI_RONLY,
     var_expErrorTable, 2, {1, 3}},
#define	EXPERRORINSTANCE 4
    {EXPERRORINSTANCE, ASN_OBJECT_ID, NETSNMP_OLDAPI_RONLY,
     var_expErrorTable, 2, {1, 4}}
};

extern struct header_complex_index *expExpressionTableStorage;


void
init_expErrorTable(void)
{
    DEBUGMSGTL(("expErrorTable", "initializing...  "));



    /*
     * register ourselves with the agent to handle our mib tree 
     */
    REGISTER_MIB("expErrorTable",
                 expErrorTable_variables, variable2,
                 expErrorTable_variables_oid);

    DEBUGMSGTL(("expErrorTable", "done.\n"));
}



unsigned char  *
var_expErrorTable(struct variable *vp,
                  oid * name,
                  size_t *length,
                  int exact, size_t *var_len, WriteMethod ** write_method)
{
    struct expExpressionTable_data *StorageTmp = NULL;

    DEBUGMSGTL(("expErrorTable", "var_expErrorTable: Entering...  \n"));
    /*
     * this assumes you have registered all your data properly
     */
    if ((StorageTmp =
         header_complex(expExpressionTableStorage, vp, name, length, exact,
                        var_len, write_method)) == NULL)
        return NULL;

    /*
     * this is where we do the value assignments for the mib results.
     */
    switch (vp->magic) {

    case EXPERRORTIME:
        *var_len = sizeof(StorageTmp->expErrorTime);
        return (u_char *) & StorageTmp->expErrorTime;

    case EXPERRORINDEX:
        *var_len = sizeof(StorageTmp->expErrorIndex);
        return (u_char *) & StorageTmp->expErrorIndex;

    case EXPERRORCODE:
        *var_len = sizeof(StorageTmp->expErrorCode);
        return (u_char *) & StorageTmp->expErrorCode;

    case EXPERRORINSTANCE:
        *var_len = StorageTmp->expErrorInstanceLen * sizeof(oid);
        return (u_char *) StorageTmp->expErrorInstance;
    }

    return NULL;
}