~ubuntu-branches/debian/lenny/net-snmp/lenny

« back to all changes in this revision

Viewing changes to agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-05-10 22:20:23 UTC
  • Revision ID: james.westby@ubuntu.com-20070510222023-3fr07xb9i17xvq32
Tags: upstream-5.3.1
ImportĀ upstreamĀ versionĀ 5.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Note: this file originally auto-generated by mib2c using
 
3
 *       version : 1.48 $ of : mfd-top.m2c,v $ 
 
4
 *
 
5
 * $Id: ipv4InterfaceTable.c,v 1.3.2.1 2006/01/25 16:26:39 dts12 Exp $
 
6
 */
 
7
/** \page MFD helper for ipv4InterfaceTable
 
8
 *
 
9
 * \section intro Introduction
 
10
 * Introductory text.
 
11
 *
 
12
 */
 
13
/*
 
14
 * standard Net-SNMP includes 
 
15
 */
 
16
#include <net-snmp/net-snmp-config.h>
 
17
#include <net-snmp/net-snmp-includes.h>
 
18
#include <net-snmp/agent/net-snmp-agent-includes.h>
 
19
 
 
20
/*
 
21
 * include our parent header 
 
22
 */
 
23
#include "ipv4InterfaceTable.h"
 
24
 
 
25
#include <net-snmp/agent/mib_modules.h>
 
26
 
 
27
#include "ipv4InterfaceTable_interface.h"
 
28
 
 
29
oid             ipv4InterfaceTable_oid[] = { IPV4INTERFACETABLE_OID };
 
30
int             ipv4InterfaceTable_oid_size =
 
31
OID_LENGTH(ipv4InterfaceTable_oid);
 
32
 
 
33
ipv4InterfaceTable_registration ipv4InterfaceTable_user_context;
 
34
 
 
35
void            initialize_table_ipv4InterfaceTable(void);
 
36
void            shutdown_table_ipv4InterfaceTable(void);
 
37
 
 
38
 
 
39
/**
 
40
 * Initializes the ipv4InterfaceTable module
 
41
 */
 
42
void
 
43
init_ipv4InterfaceTable(void)
 
44
{
 
45
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:init_ipv4InterfaceTable",
 
46
                "called\n"));
 
47
 
 
48
    /*
 
49
     * TODO:300:o: Perform ipv4InterfaceTable one-time module initialization.
 
50
     */
 
51
 
 
52
    /*
 
53
     * we depend on the ifTable, so we put our init in with it
 
54
     * to guarantee order of execution.
 
55
     */
 
56
    init_ifTable();
 
57
 
 
58
    /*
 
59
     * last changed should be 0 at startup
 
60
     */
 
61
    ipv4InterfaceTable_lastChange_set(0);
 
62
 
 
63
}                               /* init_ipv4InterfaceTable */
 
64
 
 
65
/**
 
66
 * Shut-down the ipv4InterfaceTable module (agent is exiting)
 
67
 */
 
68
void
 
69
shutdown_ipv4InterfaceTable(void)
 
70
{
 
71
    if (should_init("ipv4InterfaceTable"))
 
72
        shutdown_table_ipv4InterfaceTable();
 
73
 
 
74
}
 
75
 
 
76
/**
 
77
 * Initialize the table ipv4InterfaceTable 
 
78
 *    (Define its contents and how it's structured)
 
79
 */
 
80
void
 
81
initialize_table_ipv4InterfaceTable(void)
 
82
{
 
83
    ipv4InterfaceTable_registration *user_context;
 
84
    u_long          flags;
 
85
 
 
86
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:initialize_table_ipv4InterfaceTable", "called\n"));
 
87
 
 
88
    /*
 
89
     * TODO:301:o: Perform ipv4InterfaceTable one-time table initialization.
 
90
     */
 
91
 
 
92
    /*
 
93
     * TODO:302:o: |->Initialize ipv4InterfaceTable user context
 
94
     * if you'd like to pass in a pointer to some data for this
 
95
     * table, allocate or set it up here.
 
96
     */
 
97
    /*
 
98
     * a netsnmp_data_list is a simple way to store void pointers. A simple
 
99
     * string token is used to add, find or remove pointers.
 
100
     */
 
101
    user_context =
 
102
        netsnmp_create_data_list("ipv4InterfaceTable", NULL, NULL);
 
103
 
 
104
    /*
 
105
     * No support for any flags yet, but in the future you would
 
106
     * set any flags here.
 
107
     */
 
108
    flags = 0;
 
109
 
 
110
    /*
 
111
     * call interface initialization code
 
112
     */
 
113
    _ipv4InterfaceTable_initialize_interface(user_context, flags);
 
114
}                               /* initialize_table_ipv4InterfaceTable */
 
115
 
 
116
/**
 
117
 * Shutdown the table ipv4InterfaceTable 
 
118
 */
 
119
void
 
120
shutdown_table_ipv4InterfaceTable(void)
 
121
{
 
122
    /*
 
123
     * call interface shutdown code
 
124
     */
 
125
    _ipv4InterfaceTable_shutdown_interface
 
126
        (&ipv4InterfaceTable_user_context);
 
127
}
 
128
 
 
129
/**
 
130
 * extra context initialization (eg default values)
 
131
 *
 
132
 * @param rowreq_ctx    : row request context
 
133
 * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
 
134
 *
 
135
 * @retval MFD_SUCCESS  : no errors
 
136
 * @retval MFD_ERROR    : error (context allocate will fail)
 
137
 */
 
138
int
 
139
ipv4InterfaceTable_rowreq_ctx_init(ipv4InterfaceTable_rowreq_ctx *
 
140
                                   rowreq_ctx, void *user_init_ctx)
 
141
{
 
142
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_rowreq_ctx_init", "called\n"));
 
143
 
 
144
    netsnmp_assert(NULL != rowreq_ctx);
 
145
 
 
146
    /*
 
147
     * TODO:210:o: |-> Perform extra ipv4InterfaceTable rowreq initialization. (eg DEFVALS)
 
148
     */
 
149
    rowreq_ctx->data.ipv4InterfaceRetransmitTime = 1000;
 
150
 
 
151
 
 
152
    return MFD_SUCCESS;
 
153
}                               /* ipv4InterfaceTable_rowreq_ctx_init */
 
154
 
 
155
/**
 
156
 * extra context cleanup
 
157
 * @param rowreq_ctx
 
158
 *
 
159
 */
 
160
void
 
161
ipv4InterfaceTable_rowreq_ctx_cleanup(ipv4InterfaceTable_rowreq_ctx *
 
162
                                      rowreq_ctx)
 
163
{
 
164
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_rowreq_ctx_cleanup", "called\n"));
 
165
 
 
166
    netsnmp_assert(NULL != rowreq_ctx);
 
167
 
 
168
    /*
 
169
     * TODO:211:o: |-> Perform extra ipv4InterfaceTable rowreq cleanup.
 
170
     */
 
171
}                               /* ipv4InterfaceTable_rowreq_ctx_cleanup */
 
172
 
 
173
/**
 
174
 * pre-request callback
 
175
 *
 
176
 * @param user_context
 
177
 *
 
178
 * @retval MFD_SUCCESS              : success.
 
179
 * @retval MFD_ERROR                : other error
 
180
 */
 
181
int
 
182
ipv4InterfaceTable_pre_request(ipv4InterfaceTable_registration *
 
183
                               user_context)
 
184
{
 
185
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_pre_request", "called\n"));
 
186
 
 
187
    /*
 
188
     * TODO:510:o: Perform ipv4InterfaceTable pre-request actions.
 
189
     */
 
190
 
 
191
    return MFD_SUCCESS;
 
192
}                               /* ipv4InterfaceTable_pre_request */
 
193
 
 
194
/**
 
195
 * post-request callback
 
196
 *
 
197
 * Note:
 
198
 *   New rows have been inserted into the container, and
 
199
 *   deleted rows have been removed from the container and
 
200
 *   released.
 
201
 *
 
202
 * @param user_context
 
203
 * @param rc : MFD_SUCCESS if all requests succeeded
 
204
 *
 
205
 * @retval MFD_SUCCESS : success.
 
206
 * @retval MFD_ERROR   : other error (ignored)
 
207
 */
 
208
int
 
209
ipv4InterfaceTable_post_request(ipv4InterfaceTable_registration *
 
210
                                user_context, int rc)
 
211
{
 
212
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_post_request", "called\n"));
 
213
 
 
214
    /*
 
215
     * TODO:511:o: Perform ipv4InterfaceTable post-request actions.
 
216
     */
 
217
 
 
218
    /*
 
219
     * check to set if any rows were changed.
 
220
     */
 
221
    if (ipv4InterfaceTable_dirty_get()) {
 
222
        /*
 
223
         * check if request was successful. If so, this would be
 
224
         * a good place to save data to its persistent store.
 
225
         */
 
226
        if (MFD_SUCCESS == rc) {
 
227
            /*
 
228
             * save changed rows, if you haven't already
 
229
             */
 
230
        }
 
231
 
 
232
        ipv4InterfaceTable_dirty_set(0);        /* clear table dirty flag */
 
233
    }
 
234
 
 
235
    return MFD_SUCCESS;
 
236
}                               /* ipv4InterfaceTable_post_request */
 
237
 
 
238
 
 
239
/**********************************************************************
 
240
 **********************************************************************
 
241
 ***
 
242
 *** Table ipv4InterfaceTable
 
243
 ***
 
244
 **********************************************************************
 
245
 **********************************************************************/
 
246
/*
 
247
 * IP-MIB::ipv4InterfaceTable is subid 28 of ip.
 
248
 * Its status is Current.
 
249
 * OID: .1.3.6.1.2.1.4.28, length: 8
 
250
 */
 
251
 
 
252
/*
 
253
 * ---------------------------------------------------------------------
 
254
 * * TODO:200:r: Implement ipv4InterfaceTable data context functions.
 
255
 */
 
256
 
 
257
 
 
258
/*---------------------------------------------------------------------
 
259
 * IP-MIB::ipv4InterfaceEntry.ipv4InterfaceReasmMaxSize
 
260
 * ipv4InterfaceReasmMaxSize is subid 2 of ipv4InterfaceEntry.
 
261
 * Its status is Current, and its access level is ReadOnly.
 
262
 * OID: .1.3.6.1.2.1.4.28.1.2
 
263
 * Description:
 
264
The size of the largest IPv4 datagram which this entity can
 
265
            re-assemble from incoming IPv4 fragmented datagrams received
 
266
            on this interface.
 
267
 *
 
268
 * Attributes:
 
269
 *   accessible 1     isscalar 0     enums  0      hasdefval 0
 
270
 *   readable   1     iscolumn 1     ranges 1      hashint   0
 
271
 *   settable   0
 
272
 *
 
273
 * Ranges:  0 - 65535;
 
274
 *
 
275
 * Its syntax is INTEGER32 (based on perltype INTEGER32)
 
276
 * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
 
277
 */
 
278
/**
 
279
 * Extract the current value of the ipv4InterfaceReasmMaxSize data.
 
280
 *
 
281
 * Set a value using the data context for the row.
 
282
 *
 
283
 * @param rowreq_ctx
 
284
 *        Pointer to the row request context.
 
285
 * @param ipv4InterfaceReasmMaxSize_val_ptr
 
286
 *        Pointer to storage for a long variable
 
287
 *
 
288
 * @retval MFD_SUCCESS         : success
 
289
 * @retval MFD_SKIP            : skip this node (no value for now)
 
290
 * @retval MFD_ERROR           : Any other error
 
291
 */
 
292
int
 
293
ipv4InterfaceReasmMaxSize_get(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
 
294
                              long *ipv4InterfaceReasmMaxSize_val_ptr)
 
295
{
 
296
   /** we should have a non-NULL pointer */
 
297
    netsnmp_assert(NULL != ipv4InterfaceReasmMaxSize_val_ptr);
 
298
 
 
299
 
 
300
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceReasmMaxSize_get",
 
301
                "called\n"));
 
302
 
 
303
    netsnmp_assert(NULL != rowreq_ctx);
 
304
 
 
305
    if (!
 
306
        (rowreq_ctx->data.ifentry->
 
307
         ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V4_REASMMAX))
 
308
        return MFD_SKIP;
 
309
 
 
310
    /*
 
311
     * TODO:231:o: |-> Extract the current value of the ipv4InterfaceReasmMaxSize data.
 
312
     * copy (* ipv4InterfaceReasmMaxSize_val_ptr ) from rowreq_ctx->data
 
313
     */
 
314
    (*ipv4InterfaceReasmMaxSize_val_ptr) =
 
315
        rowreq_ctx->data.ipv4InterfaceReasmMaxSize;
 
316
 
 
317
    return MFD_SUCCESS;
 
318
}                               /* ipv4InterfaceReasmMaxSize_get */
 
319
 
 
320
/*---------------------------------------------------------------------
 
321
 * IP-MIB::ipv4InterfaceEntry.ipv4InterfaceEnableStatus
 
322
 * ipv4InterfaceEnableStatus is subid 3 of ipv4InterfaceEntry.
 
323
 * Its status is Current, and its access level is ReadWrite.
 
324
 * OID: .1.3.6.1.2.1.4.28.1.3
 
325
 * Description:
 
326
The indication of whether IPv4 is enabled (up) or disabled
 
327
            (down) on this interface.  This object does not affect the
 
328
            state of the interface itself, only its connection to an
 
329
            IPv4 stack.  The IF-MIB should be used to control the state
 
330
            of the interface.
 
331
 *
 
332
 * Attributes:
 
333
 *   accessible 1     isscalar 0     enums  1      hasdefval 0
 
334
 *   readable   1     iscolumn 1     ranges 0      hashint   0
 
335
 *   settable   1
 
336
 *
 
337
 * Enum range: 1/8. Values:  up(1), down(2)
 
338
 *
 
339
 * Its syntax is INTEGER (based on perltype INTEGER)
 
340
 * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
 
341
 */
 
342
/**
 
343
 * Extract the current value of the ipv4InterfaceEnableStatus data.
 
344
 *
 
345
 * Set a value using the data context for the row.
 
346
 *
 
347
 * @param rowreq_ctx
 
348
 *        Pointer to the row request context.
 
349
 * @param ipv4InterfaceEnableStatus_val_ptr
 
350
 *        Pointer to storage for a long variable
 
351
 *
 
352
 * @retval MFD_SUCCESS         : success
 
353
 * @retval MFD_SKIP            : skip this node (no value for now)
 
354
 * @retval MFD_ERROR           : Any other error
 
355
 */
 
356
int
 
357
ipv4InterfaceEnableStatus_get(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
 
358
                              u_long * ipv4InterfaceEnableStatus_val_ptr)
 
359
{
 
360
   /** we should have a non-NULL pointer */
 
361
    netsnmp_assert(NULL != ipv4InterfaceEnableStatus_val_ptr);
 
362
 
 
363
 
 
364
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceEnableStatus_get",
 
365
                "called\n"));
 
366
 
 
367
    netsnmp_assert(NULL != rowreq_ctx);
 
368
 
 
369
    /*
 
370
     * TODO:231:o: |-> Extract the current value of the ipv4InterfaceEnableStatus data.
 
371
     * copy (* ipv4InterfaceEnableStatus_val_ptr ) from rowreq_ctx->data
 
372
     */
 
373
    (*ipv4InterfaceEnableStatus_val_ptr) =
 
374
        rowreq_ctx->data.ipv4InterfaceEnableStatus;
 
375
 
 
376
    return MFD_SUCCESS;
 
377
}                               /* ipv4InterfaceEnableStatus_get */
 
378
 
 
379
/*---------------------------------------------------------------------
 
380
 * IP-MIB::ipv4InterfaceEntry.ipv4InterfaceRetransmitTime
 
381
 * ipv4InterfaceRetransmitTime is subid 4 of ipv4InterfaceEntry.
 
382
 * Its status is Current, and its access level is ReadOnly.
 
383
 * OID: .1.3.6.1.2.1.4.28.1.4
 
384
 * Description:
 
385
The time between retransmissions of ARP requests to a
 
386
            neighbor when resolving the address or when probing the
 
387
            reachability of a neighbor.
 
388
 *
 
389
 * Attributes:
 
390
 *   accessible 1     isscalar 0     enums  0      hasdefval 1
 
391
 *   readable   1     iscolumn 1     ranges 0      hashint   0
 
392
 *   settable   0
 
393
 *   defval: 1000
 
394
 *
 
395
 *
 
396
 * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32)
 
397
 * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
 
398
 */
 
399
/**
 
400
 * Extract the current value of the ipv4InterfaceRetransmitTime data.
 
401
 *
 
402
 * Set a value using the data context for the row.
 
403
 *
 
404
 * @param rowreq_ctx
 
405
 *        Pointer to the row request context.
 
406
 * @param ipv4InterfaceRetransmitTime_val_ptr
 
407
 *        Pointer to storage for a u_long variable
 
408
 *
 
409
 * @retval MFD_SUCCESS         : success
 
410
 * @retval MFD_SKIP            : skip this node (no value for now)
 
411
 * @retval MFD_ERROR           : Any other error
 
412
 */
 
413
int
 
414
ipv4InterfaceRetransmitTime_get(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
 
415
                                u_long *
 
416
                                ipv4InterfaceRetransmitTime_val_ptr)
 
417
{
 
418
   /** we should have a non-NULL pointer */
 
419
    netsnmp_assert(NULL != ipv4InterfaceRetransmitTime_val_ptr);
 
420
 
 
421
 
 
422
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceRetransmitTime_get", "called\n"));
 
423
 
 
424
    netsnmp_assert(NULL != rowreq_ctx);
 
425
 
 
426
    if (!
 
427
        (rowreq_ctx->data.ifentry->
 
428
         ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V4_RETRANSMIT))
 
429
        return MFD_SKIP;
 
430
 
 
431
    /*
 
432
     * TODO:231:o: |-> Extract the current value of the ipv4InterfaceRetransmitTime data.
 
433
     * copy (* ipv4InterfaceRetransmitTime_val_ptr ) from rowreq_ctx->data
 
434
     */
 
435
    (*ipv4InterfaceRetransmitTime_val_ptr) =
 
436
        rowreq_ctx->data.ipv4InterfaceRetransmitTime;
 
437
 
 
438
    return MFD_SUCCESS;
 
439
}                               /* ipv4InterfaceRetransmitTime_get */
 
440
 
 
441
 
 
442
 
 
443
/** @} */
 
444
/**********************************************************************
 
445
 **********************************************************************
 
446
 ***
 
447
 *** Table ipv4InterfaceTable
 
448
 ***
 
449
 **********************************************************************
 
450
 **********************************************************************/
 
451
/*
 
452
 * IP-MIB::ipv4InterfaceTable is subid 28 of ip.
 
453
 * Its status is Current.
 
454
 * OID: .1.3.6.1.2.1.4.28, length: 8
 
455
 */
 
456
    /*
 
457
     * NOTE: if you update this chart, please update the versions in
 
458
     *       local/mib2c-conf.d/parent-set.m2i
 
459
     *       agent/mibgroup/helpers/baby_steps.c
 
460
     * while you're at it.
 
461
     */
 
462
    /*
 
463
     ***********************************************************************
 
464
     * Baby Steps Flow Chart (2004.06.05)                                  *
 
465
     *                                                                     *
 
466
     * +--------------+    +================+    U = unconditional path    *
 
467
     * |optional state|    ||required state||    S = path for success      *
 
468
     * +--------------+    +================+    E = path for error        *
 
469
     ***********************************************************************
 
470
     *
 
471
     *                        +--------------+
 
472
     *                        |     pre      |
 
473
     *                        |   request    |
 
474
     *                        +--------------+
 
475
     *                               | U
 
476
     *                        +==============+
 
477
     *       +----------------||  object    ||
 
478
     *       |              E ||  lookup    ||
 
479
     *       |                +==============+
 
480
     *       |                       | S
 
481
     *       |                +==============+
 
482
     *       |              E ||   check    ||
 
483
     *       |<---------------||   values   ||
 
484
     *       |                +==============+
 
485
     *       |                       | S
 
486
     *       |                +==============+
 
487
     *       |       +<-------||   undo     ||
 
488
     *       |       |      E ||   setup    ||
 
489
     *       |       |        +==============+
 
490
     *       |       |               | S
 
491
     *       |       |        +==============+
 
492
     *       |       |        ||    set     ||-------------------------->+
 
493
     *       |       |        ||   value    || E                         |
 
494
     *       |       |        +==============+                           |
 
495
     *       |       |               | S                                 |
 
496
     *       |       |        +--------------+                           |
 
497
     *       |       |        |    check     |-------------------------->|
 
498
     *       |       |        |  consistency | E                         |
 
499
     *       |       |        +--------------+                           |
 
500
     *       |       |               | S                                 |
 
501
     *       |       |        +==============+         +==============+  |
 
502
     *       |       |        ||   commit   ||-------->||     undo   ||  |
 
503
     *       |       |        ||            || E       ||    commit  ||  |
 
504
     *       |       |        +==============+         +==============+  |
 
505
     *       |       |               | S                     U |<--------+
 
506
     *       |       |        +--------------+         +==============+
 
507
     *       |       |        | irreversible |         ||    undo    ||
 
508
     *       |       |        |    commit    |         ||     set    ||
 
509
     *       |       |        +--------------+         +==============+
 
510
     *       |       |               | U                     U |
 
511
     *       |       +-------------->|<------------------------+
 
512
     *       |                +==============+
 
513
     *       |                ||   undo     ||
 
514
     *       |                ||  cleanup   ||
 
515
     *       |                +==============+
 
516
     *       +---------------------->| U
 
517
     *                        +--------------+
 
518
     *                        |    post      |
 
519
     *                        |   request    |
 
520
     *                        +--------------+
 
521
     *
 
522
     */
 
523
 
 
524
/**
 
525
 * Setup up context with information needed to undo a set request.
 
526
 *
 
527
 * This function will be called before the individual node undo setup
 
528
 * functions are called. If you need to do any undo setup that is not
 
529
 * related to a specific column, you can do it here.
 
530
 *
 
531
 * Note that the undo context has been allocated with
 
532
 * ipv4InterfaceTable_allocate_data(), but may need extra
 
533
 * initialization similar to what you may have done in
 
534
 * ipv4InterfaceTable_rowreq_ctx_init().
 
535
 * Note that an individual node's undo_setup function will only be called
 
536
 * if that node is being set to a new value.
 
537
 *
 
538
 * If there is any setup specific to a particular column (e.g. allocating
 
539
 * memory for a string), you should do that setup in the node's undo_setup
 
540
 * function, so it won't be done unless it is necessary.
 
541
 *
 
542
 * @param rowreq_ctx
 
543
 *        Pointer to the table context (ipv4InterfaceTable_rowreq_ctx)
 
544
 *
 
545
 * @retval MFD_SUCCESS : success
 
546
 * @retval MFD_ERROR   : error. set will fail.
 
547
 */
 
548
int
 
549
ipv4InterfaceTable_undo_setup(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx)
 
550
{
 
551
    int             rc = MFD_SUCCESS;
 
552
 
 
553
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_undo_setup",
 
554
                "called\n"));
 
555
 
 
556
    /** we should have a non-NULL pointer */
 
557
    netsnmp_assert(NULL != rowreq_ctx);
 
558
 
 
559
    /*
 
560
     * TODO:451:M: |-> Setup ipv4InterfaceTable undo.
 
561
     * set up ipv4InterfaceTable undo information, in preparation for a set.
 
562
     * Undo storage is in (* ipv4InterfaceRetransmitTime_val_ptr )*
 
563
     */
 
564
 
 
565
    return rc;
 
566
}                               /* ipv4InterfaceTable_undo_setup */
 
567
 
 
568
/**
 
569
 * Undo a set request.
 
570
 *
 
571
 * This function will be called before the individual node undo
 
572
 * functions are called. If you need to do any undo that is not
 
573
 * related to a specific column, you can do it here.
 
574
 *
 
575
 * Note that an individual node's undo function will only be called
 
576
 * if that node is being set to a new value.
 
577
 *
 
578
 * If there is anything  specific to a particular column (e.g. releasing
 
579
 * memory for a string), you should do that setup in the node's undo
 
580
 * function, so it won't be done unless it is necessary.
 
581
 *
 
582
 * @param rowreq_ctx
 
583
 *        Pointer to the table context (ipv4InterfaceTable_rowreq_ctx)
 
584
 *
 
585
 * @retval MFD_SUCCESS : success
 
586
 * @retval MFD_ERROR   : error. set will fail.
 
587
 */
 
588
int
 
589
ipv4InterfaceTable_undo(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx)
 
590
{
 
591
    int             rc = MFD_SUCCESS;
 
592
 
 
593
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_undo",
 
594
                "called\n"));
 
595
 
 
596
    /** we should have a non-NULL pointer */
 
597
    netsnmp_assert(NULL != rowreq_ctx);
 
598
 
 
599
    /*
 
600
     * TODO:451:M: |-> ipv4InterfaceTable undo.
 
601
     * ipv4InterfaceTable undo information, in response to a failed set.
 
602
     * Undo storage is in (* ipv4InterfaceRetransmitTime_val_ptr )*
 
603
     */
 
604
 
 
605
    return rc;
 
606
}                               /* ipv4InterfaceTable_undo_setup */
 
607
 
 
608
/**
 
609
 * Cleanup up context undo information.
 
610
 *
 
611
 * This function will be called after set/commit processing. If you
 
612
 * allocated any resources in undo_setup, this is the place to release
 
613
 * those resources.
 
614
 *
 
615
 * This function is called regardless of the success or failure of the set
 
616
 * request. If you need to perform different steps for cleanup depending
 
617
 * on success or failure, you can add a flag to the rowreq_ctx.
 
618
 *
 
619
 * @param rowreq_ctx
 
620
 *        Pointer to the table context (ipv4InterfaceTable_rowreq_ctx)
 
621
 *
 
622
 * @retval MFD_SUCCESS : success
 
623
 * @retval MFD_ERROR   : error
 
624
 */
 
625
int
 
626
ipv4InterfaceTable_undo_cleanup(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx)
 
627
{
 
628
    int             rc = MFD_SUCCESS;
 
629
 
 
630
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_undo_cleanup", "called\n"));
 
631
 
 
632
    /** we should have a non-NULL pointer */
 
633
    netsnmp_assert(NULL != rowreq_ctx);
 
634
 
 
635
    /*
 
636
     * TODO:452:M: |-> Cleanup ipv4InterfaceTable undo.
 
637
     * Undo storage is in (* ipv4InterfaceRetransmitTime_val_ptr )*
 
638
     */
 
639
 
 
640
    return rc;
 
641
}                               /* ipv4InterfaceTable_undo_cleanup */
 
642
 
 
643
/**
 
644
 * commit new values.
 
645
 *
 
646
 * At this point, you should have done everything you can to ensure that
 
647
 * this commit will not fail.
 
648
 *
 
649
 * Should you need different behavior depending on which columns were
 
650
 * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
 
651
 * set. The definitions for the COLUMN_*_FLAG bits can be found in
 
652
 * ipv4InterfaceTable.h.
 
653
 * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
 
654
 *
 
655
 * @param rowreq_ctx
 
656
 *        Pointer to the users context.
 
657
 *
 
658
 * @retval MFD_SUCCESS : success
 
659
 * @retval MFD_ERROR   : error
 
660
 */
 
661
int
 
662
ipv4InterfaceTable_commit(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx)
 
663
{
 
664
    int             rc = MFD_SUCCESS;
 
665
    int             save_flags;
 
666
 
 
667
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_commit",
 
668
                "called\n"));
 
669
 
 
670
    /** we should have a non-NULL pointer */
 
671
    netsnmp_assert(NULL != rowreq_ctx);
 
672
 
 
673
    /*
 
674
     * save flags, then clear until we actually do something
 
675
     */
 
676
    save_flags = rowreq_ctx->column_set_flags;
 
677
    rowreq_ctx->column_set_flags = 0;
 
678
 
 
679
    /*
 
680
     * commit ipv4InterfaceTable data
 
681
     * 1) check the column's flag in save_flags to see if it was set.
 
682
     * 2) clear the flag when you handle that column
 
683
     * 3) set the column's flag in column_set_flags if it needs undo
 
684
     *    processing in case of a failure.
 
685
     */
 
686
    if (save_flags & COLUMN_IPV4INTERFACEENABLESTATUS_FLAG) {
 
687
        save_flags &= ~COLUMN_IPV4INTERFACEENABLESTATUS_FLAG;   /* clear ipv4InterfaceEnableStatus */
 
688
        /*
 
689
         * TODO:482:o: |-> commit column ipv4InterfaceEnableStatus.
 
690
         */
 
691
        rc = -1;
 
692
        if (-1 == rc) {
 
693
            snmp_log(LOG_ERR,
 
694
                     "ipv4InterfaceTable column ipv4InterfaceEnableStatus commit failed\n");
 
695
        } else {
 
696
            /*
 
697
             * set flag, in case we need to undo ipv4InterfaceEnableStatus
 
698
             */
 
699
            rowreq_ctx->column_set_flags |=
 
700
                COLUMN_IPV4INTERFACEENABLESTATUS_FLAG;
 
701
        }
 
702
    }
 
703
 
 
704
    /*
 
705
     * if we successfully commited this row, set the dirty flag.
 
706
     */
 
707
    if (MFD_SUCCESS == rc) {
 
708
        rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;
 
709
    }
 
710
 
 
711
    if (save_flags) {
 
712
        snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n",
 
713
                 save_flags);
 
714
        return MFD_ERROR;
 
715
    }
 
716
 
 
717
    return rc;
 
718
}                               /* ipv4InterfaceTable_commit */
 
719
 
 
720
/**
 
721
 * undo commit new values.
 
722
 *
 
723
 * Should you need different behavior depending on which columns were
 
724
 * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
 
725
 * set. The definitions for the COLUMN_*_FLAG bits can be found in
 
726
 * ipv4InterfaceTable.h.
 
727
 * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
 
728
 *
 
729
 * @param rowreq_ctx
 
730
 *        Pointer to the users context.
 
731
 *
 
732
 * @retval MFD_SUCCESS : success
 
733
 * @retval MFD_ERROR   : error
 
734
 */
 
735
int
 
736
ipv4InterfaceTable_undo_commit(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx)
 
737
{
 
738
    int             rc = MFD_SUCCESS;
 
739
 
 
740
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_undo_commit", "called\n"));
 
741
 
 
742
    /** we should have a non-NULL pointer */
 
743
    netsnmp_assert(NULL != rowreq_ctx);
 
744
 
 
745
    /*
 
746
     * TODO:485:M: |-> Undo ipv4InterfaceTable commit.
 
747
     * check the column's flag in rowreq_ctx->column_set_flags to see
 
748
     * if it was set during commit, then undo it.
 
749
     *
 
750
     * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
 
751
     */
 
752
 
 
753
 
 
754
    /*
 
755
     * if we successfully un-commited this row, clear the dirty flag.
 
756
     */
 
757
    if (MFD_SUCCESS == rc) {
 
758
        rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
 
759
    }
 
760
 
 
761
    return rc;
 
762
}                               /* ipv4InterfaceTable_undo_commit */
 
763
 
 
764
/*
 
765
 * TODO:440:M: Implement ipv4InterfaceTable node value checks.
 
766
 * TODO:450:M: Implement ipv4InterfaceTable undo functions.
 
767
 * TODO:460:M: Implement ipv4InterfaceTable set functions.
 
768
 * TODO:480:M: Implement ipv4InterfaceTable commit functions.
 
769
 */
 
770
/*---------------------------------------------------------------------
 
771
 * IP-MIB::ipv4InterfaceEntry.ipv4InterfaceEnableStatus
 
772
 * ipv4InterfaceEnableStatus is subid 3 of ipv4InterfaceEntry.
 
773
 * Its status is Current, and its access level is ReadWrite.
 
774
 * OID: .1.3.6.1.2.1.4.28.1.3
 
775
 * Description:
 
776
The indication of whether IPv4 is enabled (up) or disabled
 
777
            (down) on this interface.  This object does not affect the
 
778
            state of the interface itself, only its connection to an
 
779
            IPv4 stack.  The IF-MIB should be used to control the state
 
780
            of the interface.
 
781
 *
 
782
 * Attributes:
 
783
 *   accessible 1     isscalar 0     enums  1      hasdefval 0
 
784
 *   readable   1     iscolumn 1     ranges 0      hashint   0
 
785
 *   settable   1
 
786
 *
 
787
 * Enum range: 1/8. Values:  up(1), down(2)
 
788
 *
 
789
 * Its syntax is INTEGER (based on perltype INTEGER)
 
790
 * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
 
791
 */
 
792
/**
 
793
 * Check that the proposed new value is potentially valid.
 
794
 *
 
795
 * @param rowreq_ctx
 
796
 *        Pointer to the row request context.
 
797
 * @param ipv4InterfaceEnableStatus_val
 
798
 *        A long containing the new value.
 
799
 *
 
800
 * @retval MFD_SUCCESS        : incoming value is legal
 
801
 * @retval MFD_NOT_VALID_NOW  : incoming value is not valid now
 
802
 * @retval MFD_NOT_VALID_EVER : incoming value is never valid
 
803
 *
 
804
 * This is the place to check for requirements that are not
 
805
 * expressed in the mib syntax (for example, a requirement that
 
806
 * is detailed in the description for an object).
 
807
 *
 
808
 * You should check that the requested change between the undo value and the
 
809
 * new value is legal (ie, the transistion from one value to another
 
810
 * is legal).
 
811
 *      
 
812
 *@note
 
813
 * This check is only to determine if the new value
 
814
 * is \b potentially valid. This is the first check of many, and
 
815
 * is one of the simplest ones.
 
816
 * 
 
817
 *@note
 
818
 * this is not the place to do any checks for values
 
819
 * which depend on some other value in the mib. Those
 
820
 * types of checks should be done in the
 
821
 * ipv4InterfaceTable_check_dependencies() function.
 
822
 *
 
823
 * The following checks have already been done for you:
 
824
 *    The syntax is ASN_INTEGER
 
825
 *    The value is one of  up(1), down(2)
 
826
 *
 
827
 * If there a no other checks you need to do, simply return MFD_SUCCESS.
 
828
 *
 
829
 */
 
830
int
 
831
ipv4InterfaceEnableStatus_check_value(ipv4InterfaceTable_rowreq_ctx *
 
832
                                      rowreq_ctx,
 
833
                                      u_long ipv4InterfaceEnableStatus_val)
 
834
{
 
835
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceEnableStatus_check_value", "called\n"));
 
836
 
 
837
    /** should never get a NULL pointer */
 
838
    netsnmp_assert(NULL != rowreq_ctx);
 
839
 
 
840
    /*
 
841
     * TODO:441:o: |-> Check for valid ipv4InterfaceEnableStatus value.
 
842
     */
 
843
    /*
 
844
     * did the access code set the flag indicating that we can control
 
845
     * individual protocols on this interface?
 
846
     */
 
847
    if (rowreq_ctx->data.ifentry->ns_flags &
 
848
        NETSNMP_INTERFACE_FLAGS_CAN_DOWN_PROTOCOL);
 
849
    else
 
850
        return MFD_NOT_VALID_EVER;
 
851
 
 
852
    return MFD_SUCCESS;         /* ipv4InterfaceEnableStatus value not illegal */
 
853
}                               /* ipv4InterfaceEnableStatus_check_value */
 
854
 
 
855
/**
 
856
 * Save old value information
 
857
 *
 
858
 * @param rowreq_ctx
 
859
 *        Pointer to the table context (ipv4InterfaceTable_rowreq_ctx)
 
860
 *
 
861
 * @retval MFD_SUCCESS : success
 
862
 * @retval MFD_ERROR   : error. set will fail.
 
863
 *
 
864
 * This function will be called after the table level undo setup function
 
865
 * ipv4InterfaceTable_undo_setup has been called.
 
866
 *
 
867
 *@note
 
868
 * this function will only be called if a new value is set for this column.
 
869
 *
 
870
 * If there is any setup specific to a particular column (e.g. allocating
 
871
 * memory for a string), you should do that setup in this function, so it
 
872
 * won't be done unless it is necessary.
 
873
 */
 
874
int
 
875
ipv4InterfaceEnableStatus_undo_setup(ipv4InterfaceTable_rowreq_ctx *
 
876
                                     rowreq_ctx)
 
877
{
 
878
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceEnableStatus_undo_setup", "called\n"));
 
879
 
 
880
    /** should never get a NULL pointer */
 
881
    netsnmp_assert(NULL != rowreq_ctx);
 
882
 
 
883
    /*
 
884
     * TODO:455:o: |-> Setup ipv4InterfaceEnableStatus undo.
 
885
     */
 
886
    /*
 
887
     * copy ipv4InterfaceEnableStatus data
 
888
     * set rowreq_ctx->undo->ipv4InterfaceEnableStatus from rowreq_ctx->data.ipv4InterfaceEnableStatus
 
889
     */
 
890
    rowreq_ctx->undo->ipv4InterfaceEnableStatus =
 
891
        rowreq_ctx->data.ipv4InterfaceEnableStatus;
 
892
 
 
893
 
 
894
    return MFD_SUCCESS;
 
895
}                               /* ipv4InterfaceEnableStatus_undo_setup */
 
896
 
 
897
/**
 
898
 * Set the new value.
 
899
 *
 
900
 * @param rowreq_ctx
 
901
 *        Pointer to the users context. You should know how to
 
902
 *        manipulate the value from this object.
 
903
 * @param ipv4InterfaceEnableStatus_val
 
904
 *        A long containing the new value.
 
905
 */
 
906
int
 
907
ipv4InterfaceEnableStatus_set(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
 
908
                              u_long ipv4InterfaceEnableStatus_val)
 
909
{
 
910
 
 
911
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceEnableStatus_set",
 
912
                "called\n"));
 
913
 
 
914
    /** should never get a NULL pointer */
 
915
    netsnmp_assert(NULL != rowreq_ctx);
 
916
 
 
917
    /*
 
918
     * TODO:461:M: |-> Set ipv4InterfaceEnableStatus value.
 
919
     * set ipv4InterfaceEnableStatus value in rowreq_ctx->data
 
920
     */
 
921
    rowreq_ctx->data.ipv4InterfaceEnableStatus =
 
922
        ipv4InterfaceEnableStatus_val;
 
923
 
 
924
    return MFD_SUCCESS;
 
925
}                               /* ipv4InterfaceEnableStatus_set */
 
926
 
 
927
/**
 
928
 * undo the previous set.
 
929
 *
 
930
 * @param rowreq_ctx
 
931
 *        Pointer to the users context.
 
932
 */
 
933
int
 
934
ipv4InterfaceEnableStatus_undo(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx)
 
935
{
 
936
 
 
937
    DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceEnableStatus_undo", "called\n"));
 
938
 
 
939
    netsnmp_assert(NULL != rowreq_ctx);
 
940
 
 
941
    /*
 
942
     * TODO:456:o: |-> Clean up ipv4InterfaceEnableStatus undo.
 
943
     */
 
944
    /*
 
945
     * copy ipv4InterfaceEnableStatus data
 
946
     * set rowreq_ctx->data.ipv4InterfaceEnableStatus from rowreq_ctx->undo->ipv4InterfaceEnableStatus
 
947
     */
 
948
    rowreq_ctx->data.ipv4InterfaceEnableStatus =
 
949
        rowreq_ctx->undo->ipv4InterfaceEnableStatus;
 
950
 
 
951
 
 
952
    return MFD_SUCCESS;
 
953
}                               /* ipv4InterfaceEnableStatus_undo */
 
954
 
 
955
/** @} */
 
956
/** @{ */