summaryrefslogtreecommitdiff
path: root/agent/mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable.c
blob: 180e317f6a5cdc1bdaa83768af2f6ed8bbba385c (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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
/*
 * Note: this file originally auto-generated by mib2c using
 *       version : 14170 $ of $ 
 *
 * $Id:$
 */
/** \page MFD helper for ipDefaultRouterTable
 *
 * \section intro Introduction
 * Introductory text.
 *
 */
/*
 * standard Net-SNMP includes 
 */
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>

/*
 * include our parent header 
 */
#include "ipDefaultRouterTable.h"

#include <net-snmp/agent/mib_modules.h>

#include "ipDefaultRouterTable_interface.h"

const oid       ipDefaultRouterTable_oid[] = { IPDEFAULTROUTERTABLE_OID };
const int       ipDefaultRouterTable_oid_size =
OID_LENGTH(ipDefaultRouterTable_oid);

ipDefaultRouterTable_registration ipDefaultRouterTable_user_context;
static ipDefaultRouterTable_registration *ipDefaultRouterTable_user_context_p;

void            initialize_table_ipDefaultRouterTable(void);
void            shutdown_table_ipDefaultRouterTable(void);


/**
 * Initializes the ipDefaultRouterTable module
 */
void
init_ipDefaultRouterTable(void)
{
    DEBUGMSGTL(("verbose:ipDefaultRouterTable:init_ipDefaultRouterTable",
                "called\n"));

    /*
     * TODO:300:o: Perform ipDefaultRouterTable one-time module initialization.
     */

    /*
     * here we initialize all the tables we're planning on supporting
     */
    if (should_init("ipDefaultRouterTable"))
        initialize_table_ipDefaultRouterTable();

}                               /* init_ipDefaultRouterTable */

/**
 * Shut-down the ipDefaultRouterTable module (agent is exiting)
 */
void
shutdown_ipDefaultRouterTable(void)
{
    if (should_init("ipDefaultRouterTable"))
        shutdown_table_ipDefaultRouterTable();

}

/**
 * Initialize the table ipDefaultRouterTable 
 *    (Define its contents and how it's structured)
 */
void
initialize_table_ipDefaultRouterTable(void)
{
    u_long          flags;

    DEBUGMSGTL(("verbose:ipDefaultRouterTable:initialize_table_ipDefaultRouterTable", "called\n"));

    /*
     * TODO:301:o: Perform ipDefaultRouterTable one-time table initialization.
     */

    /*
     * TODO:302:o: |->Initialize ipDefaultRouterTable user context
     * if you'd like to pass in a pointer to some data for this
     * table, allocate or set it up here.
     */
    /*
     * a netsnmp_data_list is a simple way to store void pointers. A simple
     * string token is used to add, find or remove pointers.
     */
    ipDefaultRouterTable_user_context_p =
        netsnmp_create_data_list("ipDefaultRouterTable", NULL, NULL);

    /*
     * No support for any flags yet, but in the future you would
     * set any flags here.
     */
    flags = 0;

    /*
     * call interface initialization code
     */
    _ipDefaultRouterTable_initialize_interface
	(ipDefaultRouterTable_user_context_p, flags);
}                               /* initialize_table_ipDefaultRouterTable */

/**
 * Shutdown the table ipDefaultRouterTable 
 */
void
shutdown_table_ipDefaultRouterTable(void)
{
    /*
     * call interface shutdown code
     */
    _ipDefaultRouterTable_shutdown_interface
        (ipDefaultRouterTable_user_context_p);
    netsnmp_free_all_list_data(ipDefaultRouterTable_user_context_p);
    ipDefaultRouterTable_user_context_p = NULL;
}

/**
 * extra context initialization (eg default values)
 *
 * @param rowreq_ctx    : row request context
 * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
 *
 * @retval MFD_SUCCESS  : no errors
 * @retval MFD_ERROR    : error (context allocate will fail)
 */
int
ipDefaultRouterTable_rowreq_ctx_init(ipDefaultRouterTable_rowreq_ctx *
                                     rowreq_ctx, void *user_init_ctx)
{
    DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_rowreq_ctx_init", "called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

    /*
     * TODO:210:o: |-> Perform extra ipDefaultRouterTable rowreq initialization. (eg DEFVALS)
     */

    return MFD_SUCCESS;
}                               /* ipDefaultRouterTable_rowreq_ctx_init */

/**
 * extra context cleanup
 *
 */
void
ipDefaultRouterTable_rowreq_ctx_cleanup(ipDefaultRouterTable_rowreq_ctx *
                                        rowreq_ctx)
{
    DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_rowreq_ctx_cleanup", "called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

    /*
     * TODO:211:o: |-> Perform extra ipDefaultRouterTable rowreq cleanup.
     */
    netsnmp_access_defaultrouter_entry_free(rowreq_ctx->data);
    rowreq_ctx->data = NULL;
}                               /* ipDefaultRouterTable_rowreq_ctx_cleanup */

/**
 * pre-request callback
 *
 *
 * @retval MFD_SUCCESS              : success.
 * @retval MFD_ERROR                : other error
 */
int
ipDefaultRouterTable_pre_request(ipDefaultRouterTable_registration *
                                 user_context)
{
    DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_pre_request", "called\n"));

    /*
     * TODO:510:o: Perform ipDefaultRouterTable pre-request actions.
     */

    return MFD_SUCCESS;
}                               /* ipDefaultRouterTable_pre_request */

/**
 * post-request callback
 *
 * Note:
 *   New rows have been inserted into the container, and
 *   deleted rows have been removed from the container and
 *   released.
 *
 * @param user_context
 * @param rc : MFD_SUCCESS if all requests succeeded
 *
 * @retval MFD_SUCCESS : success.
 * @retval MFD_ERROR   : other error (ignored)
 */
int
ipDefaultRouterTable_post_request(ipDefaultRouterTable_registration *
                                  user_context, int rc)
{
    DEBUGMSGTL(("verbose:ipDefaultRouterTable:ipDefaultRouterTable_post_request", "called\n"));

    /*
     * TODO:511:o: Perform ipDefaultRouterTable post-request actions.
     */

    return MFD_SUCCESS;
}                               /* ipDefaultRouterTable_post_request */


/** @{ */