~ubuntu-branches/ubuntu/trusty/net-snmp/trusty

« back to all changes in this revision

Viewing changes to agent/mibgroup/Rmon/statistics.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2004-09-13 12:06:21 UTC
  • Revision ID: james.westby@ubuntu.com-20040913120621-g952ntonlleihcvm
Tags: upstream-5.1.1
ImportĀ upstreamĀ versionĀ 5.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**************************************************************
 
2
 * Copyright (C) 2001 Tali Rozin, Optical Access
 
3
 *
 
4
 *                     All Rights Reserved
 
5
 *
 
6
 * Permission to use, copy, modify and distribute this software and its
 
7
 * documentation for any purpose and without fee is hereby granted,
 
8
 * provided that the above copyright notice appear in all copies and that
 
9
 * both that copyright notice and this permission notice appear in
 
10
 * supporting documentation.
 
11
 *
 
12
 * TALI ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 
13
 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
 
14
 * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
 
15
 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 
16
 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 
17
 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 
18
 * SOFTWARE.
 
19
 ******************************************************************/
 
20
 
 
21
#include <net-snmp/net-snmp-config.h>
 
22
 
 
23
#if HAVE_STDLIB
 
24
#include <stdlib.h>
 
25
#endif
 
26
#if TIME_WITH_SYS_TIME
 
27
# ifdef WIN32
 
28
#  include <sys/timeb.h>
 
29
# else
 
30
#  include <sys/time.h>
 
31
# endif
 
32
# include <time.h>
 
33
#else
 
34
# if HAVE_SYS_TIME_H
 
35
#  include <sys/time.h>
 
36
# else
 
37
#  include <time.h>
 
38
# endif
 
39
#endif
 
40
#if HAVE_UNISTD_H
 
41
#include <unistd.h>
 
42
#endif
 
43
 
 
44
#include <net-snmp/net-snmp-includes.h>
 
45
#include <net-snmp/agent/net-snmp-agent-includes.h>
 
46
#include "util_funcs.h"
 
47
#include "statistics.h"
 
48
        /*
 
49
         * Implementation headers 
 
50
         */
 
51
#include "agutil_api.h"
 
52
#include "row_api.h"
 
53
        /*
 
54
         * File scope definitions section 
 
55
         */
 
56
        /*
 
57
         * from MIB compilation 
 
58
         */
 
59
#define MIB_DESCR       "EthStat"
 
60
#define etherStatsEntryFirstIndexBegin  11
 
61
#define IDetherStatsDroppedFrames        1
 
62
#define IDetherStatsCreateTime           2
 
63
#define IDetherStatsIndex                3
 
64
#define IDetherStatsDataSource           4
 
65
#define IDetherStatsDropEvents           5
 
66
#define IDetherStatsOctets               6
 
67
#define IDetherStatsPkts                 7
 
68
#define IDetherStatsBroadcastPkts        8
 
69
#define IDetherStatsMulticastPkts        9
 
70
#define IDetherStatsCRCAlignErrors       10
 
71
#define IDetherStatsUndersizePkts        11
 
72
#define IDetherStatsOversizePkts         12
 
73
#define IDetherStatsFragments            13
 
74
#define IDetherStatsJabbers              14
 
75
#define IDetherStatsCollisions           15
 
76
#define IDetherStatsPkts64Octets         16
 
77
#define IDetherStatsPkts65to127Octets    17
 
78
#define IDetherStatsPkts128to255Octets   18
 
79
#define IDetherStatsPkts256to511Octets   19
 
80
#define IDetherStatsPkts512to1023Octets  20
 
81
#define IDetherStatsPkts1024to1518Octets 21
 
82
#define IDetherStatsOwner                22
 
83
#define IDetherStatsStatus               23
 
84
#define Leaf_etherStatsDataSource        2
 
85
#define Leaf_etherStatsOwner             20
 
86
#define Leaf_etherStatsStatus            21
 
87
#define MIN_etherStatsIndex   1
 
88
#define MAX_etherStatsIndex   65535
 
89
     typedef struct {
 
90
         VAR_OID_T
 
91
             data_source;
 
92
         u_long
 
93
             etherStatsCreateTime;
 
94
         ETH_STATS_T
 
95
             eth;
 
96
     } CRTL_ENTRY_T;
 
97
 
 
98
/*
 
99
 * Main section 
 
100
 */
 
101
 
 
102
     static TABLE_DEFINTION_T
 
103
         StatCtrlTable;
 
104
     static TABLE_DEFINTION_T *
 
105
         table_ptr = &
 
106
         StatCtrlTable;
 
107
 
 
108
/*
 
109
 * Control Table RowApi Callbacks 
 
110
 */
 
111
 
 
112
     int
 
113
     stat_Create(RMON_ENTRY_T * eptr)
 
114
{                               /* create the body: alloc it and set defaults */
 
115
    CRTL_ENTRY_T   *body;
 
116
    static VAR_OID_T data_src_if_index_1 =
 
117
        { 11, {1, 3, 6, 1, 2, 1, 2, 2, 1, 1, 1} };
 
118
 
 
119
    eptr->body = AGMALLOC(sizeof(CRTL_ENTRY_T));
 
120
    if (!eptr->body)
 
121
        return -3;
 
122
    body = (CRTL_ENTRY_T *) eptr->body;
 
123
 
 
124
    /*
 
125
     * set defaults 
 
126
     */
 
127
    memcpy(&body->data_source, &data_src_if_index_1, sizeof(VAR_OID_T));
 
128
    body->data_source.objid[body->data_source.length - 1] =
 
129
        eptr->ctrl_index;
 
130
    eptr->owner = AGSTRDUP("Startup Mgmt");
 
131
    memset(&body->eth, 0, sizeof(ETH_STATS_T));
 
132
 
 
133
    return 0;
 
134
}
 
135
 
 
136
int
 
137
stat_Validate(RMON_ENTRY_T * eptr)
 
138
{
 
139
    /*
 
140
     * T.B.D. (system dependent) check valid inteface in body->data_source; 
 
141
     */
 
142
 
 
143
    return 0;
 
144
}
 
145
 
 
146
int
 
147
stat_Activate(RMON_ENTRY_T * eptr)
 
148
{
 
149
    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
 
150
 
 
151
    body->etherStatsCreateTime = AGUTIL_sys_up_time();
 
152
 
 
153
    return 0;
 
154
}
 
155
 
 
156
int
 
157
stat_Copy(RMON_ENTRY_T * eptr)
 
158
{
 
159
    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
 
160
    CRTL_ENTRY_T   *clone = (CRTL_ENTRY_T *) eptr->tmp;
 
161
 
 
162
    if (snmp_oid_compare
 
163
        (clone->data_source.objid, clone->data_source.length,
 
164
         body->data_source.objid, body->data_source.length)) {
 
165
        memcpy(&body->data_source, &clone->data_source, sizeof(VAR_OID_T));
 
166
    }
 
167
 
 
168
    return 0;
 
169
}
 
170
 
 
171
int
 
172
stat_Deactivate(RMON_ENTRY_T * eptr)
 
173
{
 
174
    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
 
175
    memset(&body->eth, 0, sizeof(ETH_STATS_T));
 
176
    return 0;
 
177
}
 
178
 
 
179
 
 
180
/***************************************************
 
181
 * Function:var_etherStats2Entry 
 
182
 * Purpose: Handles the request for etherStats2Entry variable instances
 
183
 ***************************************************/
 
184
u_char         *
 
185
var_etherStats2Entry(struct variable * vp, oid * name, size_t * length,
 
186
                     int exact, size_t * var_len,
 
187
                     WriteMethod ** write_method)
 
188
{
 
189
    static long     long_return;
 
190
    static CRTL_ENTRY_T theEntry;
 
191
    RMON_ENTRY_T   *hdr;
 
192
 
 
193
    *write_method = NULL;
 
194
 
 
195
    hdr = ROWAPI_header_ControlEntry(vp, name, length, exact, var_len,
 
196
                                     table_ptr,
 
197
                                     &theEntry, sizeof(CRTL_ENTRY_T));
 
198
    if (!hdr)
 
199
        return NULL;
 
200
 
 
201
    *var_len = sizeof(long);    /* default */
 
202
 
 
203
    switch (vp->magic) {
 
204
    case IDetherStatsDroppedFrames:
 
205
        long_return = 0;
 
206
        return (u_char *) & long_return;
 
207
    case IDetherStatsCreateTime:
 
208
        long_return = theEntry.etherStatsCreateTime;
 
209
        return (u_char *) & long_return;
 
210
    default:
 
211
        ag_trace("%s: unknown vp->magic=%d", table_ptr->name,
 
212
                 (int) vp->magic);
 
213
        ERROR_MSG("");
 
214
    };                          /* of switch by 'vp->magic'  */
 
215
 
 
216
    return NULL;
 
217
}
 
218
 
 
219
 
 
220
/***************************************************
 
221
 * Function:write_etherStatsEntry 
 
222
 ***************************************************/
 
223
static int
 
224
write_etherStatsEntry(int action, u_char * var_val, u_char var_val_type,
 
225
                      size_t var_val_len, u_char * statP,
 
226
                      oid * name, size_t name_len)
 
227
{
 
228
    long            long_temp;
 
229
    int             leaf_id, snmp_status;
 
230
    static int      prev_action = COMMIT;
 
231
    RMON_ENTRY_T   *hdr;
 
232
    CRTL_ENTRY_T   *cloned_body;
 
233
    CRTL_ENTRY_T   *body;
 
234
 
 
235
    switch (action) {
 
236
    case RESERVE1:
 
237
    case FREE:
 
238
    case UNDO:
 
239
    case ACTION:
 
240
    case COMMIT:
 
241
    default:
 
242
        snmp_status =
 
243
            ROWAPI_do_another_action(name, etherStatsEntryFirstIndexBegin,
 
244
                                     action, &prev_action, table_ptr,
 
245
                                     sizeof(CRTL_ENTRY_T));
 
246
        if (SNMP_ERR_NOERROR != snmp_status) {
 
247
            ag_trace("failed action %d with %d", action, snmp_status);
 
248
        }
 
249
        break;
 
250
 
 
251
    case RESERVE2:
 
252
        /*
 
253
         * get values from PDU, check them and save them in the cloned entry 
 
254
         */
 
255
        long_temp = name[etherStatsEntryFirstIndexBegin];
 
256
        leaf_id = (int) name[etherStatsEntryFirstIndexBegin - 1];
 
257
        hdr = ROWAPI_find(table_ptr, long_temp);        /* it MUST be OK */
 
258
        cloned_body = (CRTL_ENTRY_T *) hdr->tmp;
 
259
        body = (CRTL_ENTRY_T *) hdr->body;
 
260
        switch (leaf_id) {
 
261
        case Leaf_etherStatsDataSource:
 
262
            snmp_status = AGUTIL_get_oid_value(var_val, var_val_type,
 
263
                                               var_val_len,
 
264
                                               &cloned_body->data_source);
 
265
            if (SNMP_ERR_NOERROR != snmp_status) {
 
266
                return snmp_status;
 
267
            }
 
268
            if (RMON1_ENTRY_UNDER_CREATION != hdr->status &&
 
269
                snmp_oid_compare(cloned_body->data_source.objid,
 
270
                                 cloned_body->data_source.length,
 
271
                                 body->data_source.objid,
 
272
                                 body->data_source.length))
 
273
                return SNMP_ERR_BADVALUE;
 
274
            break;
 
275
 
 
276
            break;
 
277
        case Leaf_etherStatsOwner:
 
278
            if (hdr->new_owner)
 
279
                AGFREE(hdr->new_owner);
 
280
            hdr->new_owner = AGMALLOC(MAX_OWNERSTRING);;
 
281
            if (!hdr->new_owner)
 
282
                return SNMP_ERR_TOOBIG;
 
283
            snmp_status = AGUTIL_get_string_value(var_val, var_val_type,
 
284
                                                  var_val_len,
 
285
                                                  MAX_OWNERSTRING,
 
286
                                                  1, NULL, hdr->new_owner);
 
287
            if (SNMP_ERR_NOERROR != snmp_status) {
 
288
                return snmp_status;
 
289
            }
 
290
            break;
 
291
        case Leaf_etherStatsStatus:
 
292
            snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
 
293
                                               var_val_len,
 
294
                                               RMON1_ENTRY_VALID,
 
295
                                               RMON1_ENTRY_INVALID,
 
296
                                               &long_temp);
 
297
            if (SNMP_ERR_NOERROR != snmp_status) {
 
298
                ag_trace("cannot browse etherStatsStatus");
 
299
                return snmp_status;
 
300
            }
 
301
            hdr->new_status = long_temp;
 
302
            break;
 
303
            break;
 
304
        default:
 
305
            ag_trace("%s:unknown leaf_id=%d\n", table_ptr->name,
 
306
                     (int) leaf_id);
 
307
            return SNMP_ERR_NOSUCHNAME;
 
308
        }                       /* of switch by 'leaf_id' */
 
309
        break;
 
310
    }                           /* of switch by 'action' */
 
311
 
 
312
    prev_action = action;
 
313
    return SNMP_ERR_NOERROR;
 
314
}
 
315
 
 
316
/***************************************************
 
317
 * Function:var_etherStatsEntry 
 
318
 * Purpose: Handles the request for etherStatsEntry variable instances
 
319
 ***************************************************/
 
320
u_char         *
 
321
var_etherStatsEntry(struct variable * vp, oid * name, size_t * length,
 
322
                    int exact, size_t * var_len,
 
323
                    WriteMethod ** write_method)
 
324
{
 
325
    static long     long_return;
 
326
    static CRTL_ENTRY_T theEntry;
 
327
    RMON_ENTRY_T   *hdr;
 
328
 
 
329
    *write_method = write_etherStatsEntry;
 
330
    hdr = ROWAPI_header_ControlEntry(vp, name, length, exact, var_len,
 
331
                                     table_ptr,
 
332
                                     &theEntry, sizeof(CRTL_ENTRY_T));
 
333
    if (!hdr)
 
334
        return NULL;
 
335
 
 
336
    if (RMON1_ENTRY_VALID == hdr->status)
 
337
        SYSTEM_get_eth_statistics(&theEntry.data_source, &theEntry.eth);
 
338
 
 
339
    *var_len = sizeof(long);
 
340
 
 
341
    switch (vp->magic) {
 
342
    case IDetherStatsIndex:
 
343
        long_return = hdr->ctrl_index;
 
344
        return (u_char *) & long_return;
 
345
    case IDetherStatsDataSource:
 
346
        *var_len = sizeof(oid) * theEntry.data_source.length;
 
347
        return (unsigned char *) theEntry.data_source.objid;
 
348
    case IDetherStatsDropEvents:
 
349
        long_return = 0;        /* theEntry.eth.etherStatsDropEvents; */
 
350
        return (u_char *) & long_return;
 
351
    case IDetherStatsOctets:
 
352
        long_return = theEntry.eth.octets;
 
353
        return (u_char *) & long_return;
 
354
    case IDetherStatsPkts:
 
355
        long_return = theEntry.eth.packets;
 
356
        return (u_char *) & long_return;
 
357
    case IDetherStatsBroadcastPkts:
 
358
        long_return = theEntry.eth.bcast_pkts;
 
359
        return (u_char *) & long_return;
 
360
    case IDetherStatsMulticastPkts:
 
361
        long_return = theEntry.eth.mcast_pkts;
 
362
        return (u_char *) & long_return;
 
363
    case IDetherStatsCRCAlignErrors:
 
364
        long_return = theEntry.eth.crc_align;
 
365
        return (u_char *) & long_return;
 
366
    case IDetherStatsUndersizePkts:
 
367
        long_return = theEntry.eth.undersize;
 
368
        return (u_char *) & long_return;
 
369
    case IDetherStatsOversizePkts:
 
370
        long_return = theEntry.eth.oversize;
 
371
        return (u_char *) & long_return;
 
372
    case IDetherStatsFragments:
 
373
        long_return = theEntry.eth.fragments;
 
374
        return (u_char *) & long_return;
 
375
    case IDetherStatsJabbers:
 
376
        long_return = theEntry.eth.jabbers;
 
377
        return (u_char *) & long_return;
 
378
    case IDetherStatsCollisions:
 
379
        long_return = theEntry.eth.collisions;
 
380
        return (u_char *) & long_return;
 
381
    case IDetherStatsPkts64Octets:
 
382
        long_return = theEntry.eth.pkts_64;
 
383
        return (u_char *) & long_return;
 
384
    case IDetherStatsPkts65to127Octets:
 
385
        long_return = theEntry.eth.pkts_65_127;
 
386
        return (u_char *) & long_return;
 
387
    case IDetherStatsPkts128to255Octets:
 
388
        long_return = theEntry.eth.pkts_128_255;
 
389
        return (u_char *) & long_return;
 
390
    case IDetherStatsPkts256to511Octets:
 
391
        long_return = theEntry.eth.pkts_256_511;
 
392
        return (u_char *) & long_return;
 
393
    case IDetherStatsPkts512to1023Octets:
 
394
        long_return = theEntry.eth.pkts_512_1023;
 
395
        return (u_char *) & long_return;
 
396
    case IDetherStatsPkts1024to1518Octets:
 
397
        long_return = theEntry.eth.pkts_1024_1518;
 
398
        return (u_char *) & long_return;
 
399
    case IDetherStatsOwner:
 
400
        if (hdr->owner) {
 
401
            *var_len = strlen(hdr->owner);
 
402
            return (unsigned char *) hdr->owner;
 
403
        } else {
 
404
            *var_len = 0;
 
405
            return (unsigned char *) "";
 
406
        }
 
407
    case IDetherStatsStatus:
 
408
        long_return = hdr->status;
 
409
        return (u_char *) & long_return;
 
410
    default:
 
411
        ERROR_MSG("");
 
412
    };                          /* of switch by 'vp->magic'  */
 
413
 
 
414
    return NULL;
 
415
}
 
416
 
 
417
#if 1                           /* debug, but may be used for init. TBD: may be token snmpd.conf ? */
 
418
int
 
419
add_statistics_entry(int ctrl_index, int ifIndex)
 
420
{
 
421
    int             ierr;
 
422
 
 
423
    ierr = ROWAPI_new(table_ptr, ctrl_index);
 
424
    switch (ierr) {
 
425
    case -1:
 
426
        ag_trace("max. number exedes\n");
 
427
        break;
 
428
    case -2:
 
429
        ag_trace("malloc failed");
 
430
        break;
 
431
    case -3:
 
432
        ag_trace("ClbkCreate failed");
 
433
        break;
 
434
    case 0:
 
435
        break;
 
436
    default:
 
437
        ag_trace("Unknown code %d", ierr);
 
438
        break;
 
439
    }
 
440
 
 
441
    if (!ierr) {
 
442
        register RMON_ENTRY_T *eptr = ROWAPI_find(table_ptr, ctrl_index);
 
443
        if (!eptr) {
 
444
            ag_trace("cannot find it");
 
445
            ierr = -4;
 
446
        } else {
 
447
            CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
 
448
 
 
449
            body->data_source.objid[body->data_source.length - 1] =
 
450
                ifIndex;
 
451
 
 
452
            eptr->new_status = RMON1_ENTRY_VALID;
 
453
            ierr = ROWAPI_commit(table_ptr, ctrl_index);
 
454
            if (ierr) {
 
455
                ag_trace("ROWAPI_commit returned %d", ierr);
 
456
            }
 
457
        }
 
458
    }
 
459
 
 
460
    return ierr;
 
461
}
 
462
#endif
 
463
 
 
464
/***************************************************
 
465
 * define Variables callbacks 
 
466
 ***************************************************/
 
467
oid             oidstatisticsVariablesOid[] = { 1, 3, 6, 1, 2, 1, 16, 1 };
 
468
 
 
469
struct variable7 oidstatisticsVariables[] = {
 
470
    {IDetherStatsIndex, ASN_INTEGER, RONLY, var_etherStatsEntry, 3,
 
471
     {1, 1, 1}},
 
472
    {IDetherStatsDataSource, ASN_OBJECT_ID, RWRITE, var_etherStatsEntry, 3,
 
473
     {1, 1, 2}},
 
474
    {IDetherStatsDropEvents, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
 
475
     {1, 1, 3}},
 
476
    {IDetherStatsOctets, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
 
477
     {1, 1, 4}},
 
478
    {IDetherStatsPkts, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
 
479
     {1, 1, 5}},
 
480
    {IDetherStatsBroadcastPkts, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
 
481
     {1, 1, 6}},
 
482
    {IDetherStatsMulticastPkts, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
 
483
     {1, 1, 7}},
 
484
    {IDetherStatsCRCAlignErrors, ASN_COUNTER, RONLY, var_etherStatsEntry,
 
485
     3, {1, 1, 8}},
 
486
    {IDetherStatsUndersizePkts, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
 
487
     {1, 1, 9}},
 
488
    {IDetherStatsOversizePkts, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
 
489
     {1, 1, 10}},
 
490
    {IDetherStatsFragments, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
 
491
     {1, 1, 11}},
 
492
    {IDetherStatsJabbers, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
 
493
     {1, 1, 12}},
 
494
    {IDetherStatsCollisions, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
 
495
     {1, 1, 13}},
 
496
    {IDetherStatsPkts64Octets, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
 
497
     {1, 1, 14}},
 
498
    {IDetherStatsPkts65to127Octets, ASN_COUNTER, RONLY,
 
499
     var_etherStatsEntry, 3, {1, 1, 15}},
 
500
    {IDetherStatsPkts128to255Octets, ASN_COUNTER, RONLY,
 
501
     var_etherStatsEntry, 3, {1, 1, 16}},
 
502
    {IDetherStatsPkts256to511Octets, ASN_COUNTER, RONLY,
 
503
     var_etherStatsEntry, 3, {1, 1, 17}},
 
504
    {IDetherStatsPkts512to1023Octets, ASN_COUNTER, RONLY,
 
505
     var_etherStatsEntry, 3, {1, 1, 18}},
 
506
    {IDetherStatsPkts1024to1518Octets, ASN_COUNTER, RONLY,
 
507
     var_etherStatsEntry, 3, {1, 1, 19}},
 
508
    {IDetherStatsOwner, ASN_OCTET_STR, RWRITE, var_etherStatsEntry, 3,
 
509
     {1, 1, 20}},
 
510
    {IDetherStatsStatus, ASN_INTEGER, RWRITE, var_etherStatsEntry, 3,
 
511
     {1, 1, 21}},
 
512
    {IDetherStatsDroppedFrames, ASN_COUNTER, RONLY, var_etherStats2Entry,
 
513
     3, {4, 1, 1}},
 
514
    {IDetherStatsCreateTime, ASN_TIMETICKS, RONLY, var_etherStats2Entry, 3,
 
515
     {4, 1, 2}},
 
516
};
 
517
 
 
518
/***************************************************
 
519
 * Function:init_statistics 
 
520
 * Purpose: register statistics objects in the agent 
 
521
 ***************************************************/
 
522
void
 
523
init_statistics(void)
 
524
{
 
525
    REGISTER_MIB(MIB_DESCR, oidstatisticsVariables, variable7,
 
526
                 oidstatisticsVariablesOid);
 
527
 
 
528
    ROWAPI_init_table(&StatCtrlTable, MIB_DESCR, 0, &stat_Create, NULL, /* &stat_Clone, */
 
529
                      NULL,     /* &stat_Delete, */
 
530
                      &stat_Validate,
 
531
                      &stat_Activate, &stat_Deactivate, &stat_Copy);
 
532
 
 
533
#if 0                           /* debug */
 
534
    {
 
535
        int             iii;
 
536
        for (iii = 1; iii < 6; iii++) {
 
537
            add_statistics_entry(iii, iii);
 
538
        }
 
539
 
 
540
        add_statistics_entry(10, 16);
 
541
        add_statistics_entry(12, 11);
 
542
    }
 
543
#endif
 
544
}
 
545
 
 
546
/*
 
547
 * end of file statistics.c 
 
548
 */