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

« back to all changes in this revision

Viewing changes to agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-05-10 22:20:23 UTC
  • mto: (1.4.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 11.
  • 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.17 $ of : mfd-data-access.m2c,v $ 
 
4
 *
 
5
 * $Id: snmpNotifyFilterTable_data_access.c,v 1.2.2.3 2006/01/25 16:26:39 dts12 Exp $
 
6
 */
 
7
/*
 
8
 * standard Net-SNMP includes 
 
9
 */
 
10
#include <net-snmp/net-snmp-config.h>
 
11
#include <net-snmp/net-snmp-includes.h>
 
12
#include <net-snmp/agent/net-snmp-agent-includes.h>
 
13
#include <net-snmp/library/vacm.h>
 
14
 
 
15
/*
 
16
 * include our parent header 
 
17
 */
 
18
#include "snmpNotifyFilterTable.h"
 
19
 
 
20
 
 
21
#include "snmpNotifyFilterTable_data_access.h"
 
22
 
 
23
/** @ingroup interface 
 
24
 * @addtogroup data_access data_access: Routines to access data
 
25
 *
 
26
 * These routines are used to locate the data used to satisfy
 
27
 * requests.
 
28
 * 
 
29
 * @{
 
30
 */
 
31
/**********************************************************************
 
32
 **********************************************************************
 
33
 ***
 
34
 *** Table snmpNotifyFilterTable
 
35
 ***
 
36
 **********************************************************************
 
37
 **********************************************************************/
 
38
/*
 
39
 * SNMP-NOTIFICATION-MIB::snmpNotifyFilterTable is subid 3 of snmpNotifyObjects.
 
40
 * Its status is Current.
 
41
 * OID: .1.3.6.1.6.3.13.1.3, length: 9
 
42
 */
 
43
 
 
44
/**
 
45
 * initialization for snmpNotifyFilterTable data access
 
46
 *
 
47
 * This function is called during startup to allow you to
 
48
 * allocate any resources you need for the data table.
 
49
 *
 
50
 * @param snmpNotifyFilterTable_reg
 
51
 *        Pointer to snmpNotifyFilterTable_registration
 
52
 *
 
53
 * @retval MFD_SUCCESS : success.
 
54
 * @retval MFD_ERROR   : unrecoverable error.
 
55
 */
 
56
int
 
57
snmpNotifyFilterTable_init_data(snmpNotifyFilterTable_registration *
 
58
                                snmpNotifyFilterTable_reg)
 
59
{
 
60
    DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_init_data", "called\n"));
 
61
 
 
62
    /*
 
63
     * TODO:303:o: Initialize snmpNotifyFilterTable data.
 
64
     */
 
65
 
 
66
    return MFD_SUCCESS;
 
67
}                               /* snmpNotifyFilterTable_init_data */
 
68
 
 
69
/**
 
70
 * container overview
 
71
 *
 
72
 */
 
73
 
 
74
/**
 
75
 * container initialization
 
76
 *
 
77
 * @param container_ptr_ptr A pointer to a container pointer. If you
 
78
 *        create a custom container, use this parameter to return it
 
79
 *        to the MFD helper. If set to NULL, the MFD helper will
 
80
 *        allocate a container for you.
 
81
 *
 
82
 *  This function is called at startup to allow you to customize certain
 
83
 *  aspects of the access method. For the most part, it is for advanced
 
84
 *  users. The default code should suffice for most cases. If no custom
 
85
 *  container is allocated, the MFD code will create one for your.
 
86
 *
 
87
 * @remark
 
88
 *  This would also be a good place to do any initialization needed
 
89
 *  for you data source. For example, opening a connection to another
 
90
 *  process that will supply the data, opening a database, etc.
 
91
 */
 
92
void
 
93
snmpNotifyFilterTable_container_init(netsnmp_container **container_ptr_ptr)
 
94
{
 
95
    DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_container_init", "called\n"));
 
96
 
 
97
    if (NULL == container_ptr_ptr) {
 
98
        snmp_log(LOG_ERR,
 
99
                 "bad container param to snmpNotifyFilterTable_container_init\n");
 
100
        return;
 
101
    }
 
102
 
 
103
    /*
 
104
     * For advanced users, you can use a custom container. If you
 
105
     * do not create one, one will be created for you.
 
106
     */
 
107
    *container_ptr_ptr = NULL;
 
108
 
 
109
}                               /* snmpNotifyFilterTable_container_init */
 
110
 
 
111
/**
 
112
 * container shutdown
 
113
 *
 
114
 * @param container_ptr A pointer to the container.
 
115
 *
 
116
 *  This function is called at shutdown to allow you to customize certain
 
117
 *  aspects of the access method. For the most part, it is for advanced
 
118
 *  users. The default code should suffice for most cases.
 
119
 *
 
120
 *  This function is called before snmpNotifyFilterTable_container_free().
 
121
 *
 
122
 * @remark
 
123
 *  This would also be a good place to do any cleanup needed
 
124
 *  for you data source. For example, closing a connection to another
 
125
 *  process that supplied the data, closing a database, etc.
 
126
 */
 
127
void
 
128
snmpNotifyFilterTable_container_shutdown(netsnmp_container *container_ptr)
 
129
{
 
130
    DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_container_shutdown", "called\n"));
 
131
 
 
132
    if (NULL == container_ptr) {
 
133
        snmp_log(LOG_ERR,
 
134
                 "bad params to snmpNotifyFilterTable_container_shutdown\n");
 
135
        return;
 
136
    }
 
137
 
 
138
}                               /* snmpNotifyFilterTable_container_shutdown */
 
139
 
 
140
/**
 
141
 * load initial data
 
142
 *
 
143
 * TODO:350:M: Implement snmpNotifyFilterTable data load
 
144
 *
 
145
 * @param container container to which items should be inserted
 
146
 *
 
147
 * @retval MFD_SUCCESS              : success.
 
148
 * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
 
149
 * @retval MFD_ERROR                : other error.
 
150
 *
 
151
 *  This function is called to load the index(es) (and data, optionally)
 
152
 *  for the every row in the data set.
 
153
 *
 
154
 * @remark
 
155
 *  While loading the data, the only important thing is the indexes.
 
156
 *  If access to your data is cheap/fast (e.g. you have a pointer to a
 
157
 *  structure in memory), it would make sense to update the data here.
 
158
 *  If, however, the accessing the data invovles more work (e.g. parsing
 
159
 *  some other existing data, or peforming calculations to derive the data),
 
160
 *  then you can limit yourself to setting the indexes and saving any
 
161
 *  information you will need later. Then use the saved information in
 
162
 *  snmpNotifyFilterTable_row_prep() for populating data.
 
163
 *
 
164
 * @note
 
165
 *  If you need consistency between rows (like you want statistics
 
166
 *  for each row to be from the same time frame), you should set all
 
167
 *  data here.
 
168
 *
 
169
 */
 
170
int
 
171
snmpNotifyFilterTable_container_load(netsnmp_container *container)
 
172
{
 
173
    snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx;
 
174
    size_t          count = 0;
 
175
 
 
176
    /*
 
177
     * temporary storage for index values
 
178
     */
 
179
    /*
 
180
     * snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
 
181
     */
 
182
    char            snmpNotifyFilterProfileName[32];
 
183
    size_t          snmpNotifyFilterProfileName_len;
 
184
    /*
 
185
     * snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
 
186
     */
 
187
        /** 128 - 1(entry) - 1(col) - 1(other indexes) = 114 */
 
188
    oid             snmpNotifyFilterSubtree[114];
 
189
    size_t          snmpNotifyFilterSubtree_len;
 
190
 
 
191
 
 
192
    DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_container_load", "called\n"));
 
193
 
 
194
    /*
 
195
     * TODO:351:M: |-> Load/update data in the snmpNotifyFilterTable container.
 
196
     * loop over your snmpNotifyFilterTable data, allocate a rowreq context,
 
197
     * set the index(es) [and data, optionally] and insert into
 
198
     * the container.
 
199
     */
 
200
    while (1) {
 
201
        /*
 
202
         * check for end of data; bail out if there is no more data
 
203
         */
 
204
        if (1)
 
205
            break;
 
206
 
 
207
        /*
 
208
         * TODO:352:M: |   |-> set indexes in new snmpNotifyFilterTable rowreq context.
 
209
         * data context will be set from the param (unless NULL,
 
210
         *      in which case a new data context will be allocated)
 
211
         */
 
212
        rowreq_ctx = snmpNotifyFilterTable_allocate_rowreq_ctx(NULL);
 
213
        if (NULL == rowreq_ctx) {
 
214
            snmp_log(LOG_ERR, "memory allocation failed\n");
 
215
            return MFD_RESOURCE_UNAVAILABLE;
 
216
        }
 
217
        if (MFD_SUCCESS !=
 
218
            snmpNotifyFilterTable_indexes_set(rowreq_ctx,
 
219
                                              snmpNotifyFilterProfileName,
 
220
                                              snmpNotifyFilterProfileName_len,
 
221
                                              snmpNotifyFilterSubtree,
 
222
                                              snmpNotifyFilterSubtree_len))
 
223
        {
 
224
            snmp_log(LOG_ERR,
 
225
                     "error setting index while loading "
 
226
                     "snmpNotifyFilterTable data.\n");
 
227
            snmpNotifyFilterTable_release_rowreq_ctx(rowreq_ctx);
 
228
            continue;
 
229
        }
 
230
 
 
231
        /*
 
232
         * TODO:352:r: |   |-> populate snmpNotifyFilterTable data context.
 
233
         * Populate data context here. (optionally, delay until row prep)
 
234
         */
 
235
        /*
 
236
         * non-TRANSIENT data: no need to copy. set pointer to data 
 
237
         */
 
238
 
 
239
        /*
 
240
         * insert into table container
 
241
         */
 
242
        CONTAINER_INSERT(container, rowreq_ctx);
 
243
        ++count;
 
244
    }
 
245
 
 
246
    DEBUGMSGT(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_container_load", "inserted %d records\n", count));
 
247
 
 
248
    return MFD_SUCCESS;
 
249
}                               /* snmpNotifyFilterTable_container_load */
 
250
 
 
251
/**
 
252
 * container clean up
 
253
 *
 
254
 * @param container container with all current items
 
255
 *
 
256
 *  This optional callback is called prior to all
 
257
 *  item's being removed from the container. If you
 
258
 *  need to do any processing before that, do it here.
 
259
 *
 
260
 * @note
 
261
 *  The MFD helper will take care of releasing all the row contexts.
 
262
 *
 
263
 */
 
264
void
 
265
snmpNotifyFilterTable_container_free(netsnmp_container *container)
 
266
{
 
267
    DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_container_free", "called\n"));
 
268
 
 
269
    /*
 
270
     * TODO:380:M: Free snmpNotifyFilterTable container data.
 
271
     */
 
272
}                               /* snmpNotifyFilterTable_container_free */
 
273
 
 
274
/**
 
275
 * prepare row for processing.
 
276
 *
 
277
 *  When the agent has located the row for a request, this function is
 
278
 *  called to prepare the row for processing. If you fully populated
 
279
 *  the data context during the index setup phase, you may not need to
 
280
 *  do anything.
 
281
 *
 
282
 * @param rowreq_ctx pointer to a context.
 
283
 *
 
284
 * @retval MFD_SUCCESS     : success.
 
285
 * @retval MFD_ERROR       : other error.
 
286
 */
 
287
int
 
288
snmpNotifyFilterTable_row_prep(snmpNotifyFilterTable_rowreq_ctx *
 
289
                               rowreq_ctx)
 
290
{
 
291
    DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_row_prep", "called\n"));
 
292
 
 
293
    netsnmp_assert(NULL != rowreq_ctx);
 
294
 
 
295
    /*
 
296
     * TODO:390:o: Prepare row for request.
 
297
     * If populating row data was delayed, this is the place to
 
298
     * fill in the row for this request.
 
299
     */
 
300
 
 
301
    return MFD_SUCCESS;
 
302
}                               /* snmpNotifyFilterTable_row_prep */
 
303
 
 
304
/*
 
305
 * TODO:420:r: Implement snmpNotifyFilterTable index validation.
 
306
 */
 
307
/*---------------------------------------------------------------------
 
308
 * SNMP-NOTIFICATION-MIB::snmpNotifyFilterProfileEntry.snmpNotifyFilterProfileName
 
309
 * snmpNotifyFilterProfileName is subid 1 of snmpNotifyFilterProfileEntry.
 
310
 * Its status is Current, and its access level is Create.
 
311
 * OID: .1.3.6.1.6.3.13.1.2.1.1
 
312
 * Description:
 
313
The name of the filter profile to be used when generating
 
314
         notifications using the corresponding entry in the
 
315
         snmpTargetAddrTable.
 
316
 *
 
317
 * Attributes:
 
318
 *   accessible 1     isscalar 0     enums  0      hasdefval 0
 
319
 *   readable   1     iscolumn 1     ranges 1      hashint   1
 
320
 *   settable   1
 
321
 *   hint: 255t
 
322
 *
 
323
 * Ranges:  1 - 32;
 
324
 *
 
325
 * Its syntax is SnmpAdminString (based on perltype OCTETSTR)
 
326
 * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
 
327
 * This data type requires a length.  (Max 32)
 
328
 */
 
329
/**
 
330
 * check validity of snmpNotifyFilterProfileName external index portion
 
331
 *
 
332
 * NOTE: this is not the place to do any checks for the sanity
 
333
 *       of multiple indexes. Those types of checks should be done in the
 
334
 *       snmpNotifyFilterTable_validate_index() function.
 
335
 *
 
336
 * @retval MFD_SUCCESS   : the incoming value is legal
 
337
 * @retval MFD_ERROR     : the incoming value is NOT legal
 
338
 */
 
339
int
 
340
 
 
341
    
 
342
    
 
343
    
 
344
    
 
345
    
 
346
    
 
347
    
 
348
    
 
349
    
 
350
    
 
351
    
 
352
    
 
353
    
 
354
    
 
355
    snmpNotifyFilterTable_snmpNotifyFilterProfileName_check_index
 
356
    (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx) {
 
357
    DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_snmpNotifyFilterProfileName_check_index", "called\n"));
 
358
 
 
359
    netsnmp_assert(NULL != rowreq_ctx);
 
360
 
 
361
    /*
 
362
     * TODO:424:M: |-> Check snmpNotifyFilterTable external index snmpNotifyFilterProfileName.
 
363
     * check that index value in the table context (rowreq_ctx)
 
364
     * for the external index snmpNotifyFilterProfileName is legal.
 
365
     */
 
366
 
 
367
    return MFD_SUCCESS;         /*  external index snmpNotifyFilterProfileName ok */
 
368
}                               /* snmpNotifyFilterTable_snmpNotifyFilterProfileName_check_index */
 
369
 
 
370
/*---------------------------------------------------------------------
 
371
 * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterSubtree
 
372
 * snmpNotifyFilterSubtree is subid 1 of snmpNotifyFilterEntry.
 
373
 * Its status is Current, and its access level is NoAccess.
 
374
 * OID: .1.3.6.1.6.3.13.1.3.1.1
 
375
 * Description:
 
376
The MIB subtree which, when combined with the corresponding
 
377
         instance of snmpNotifyFilterMask, defines a family of
 
378
         subtrees which are included in or excluded from the
 
379
         filter profile.
 
380
 *
 
381
 * Attributes:
 
382
 *   accessible 0     isscalar 0     enums  0      hasdefval 0
 
383
 *   readable   0     iscolumn 1     ranges 0      hashint   0
 
384
 *   settable   0
 
385
 *
 
386
 *
 
387
 * Its syntax is OBJECTID (based on perltype OBJECTID)
 
388
 * The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid)
 
389
 * This data type requires a length.
 
390
 *
 
391
 *
 
392
 *
 
393
 * NOTE: NODE snmpNotifyFilterSubtree IS NOT ACCESSIBLE
 
394
 *
 
395
 *
 
396
 */
 
397
/**
 
398
 * check validity of snmpNotifyFilterSubtree index portion
 
399
 *
 
400
 * @retval MFD_SUCCESS   : the incoming value is legal
 
401
 * @retval MFD_ERROR     : the incoming value is NOT legal
 
402
 *
 
403
 * @note this is not the place to do any checks for the sanity
 
404
 *       of multiple indexes. Those types of checks should be done in the
 
405
 *       snmpNotifyFilterTable_validate_index() function.
 
406
 *
 
407
 * @note Also keep in mind that if the index refers to a row in this or
 
408
 *       some other table, you can't check for that row here to make
 
409
 *       decisions, since that row might not be created yet, but may
 
410
 *       be created during the processing this request. If you have
 
411
 *       such checks, they should be done in the check_dependencies
 
412
 *       function, because any new/deleted/changed rows should be
 
413
 *       available then.
 
414
 *
 
415
 * The following checks have already been done for you:
 
416
 *
 
417
 * If there a no other checks you need to do, simply return MFD_SUCCESS.
 
418
 */
 
419
int
 
420
snmpNotifyFilterSubtree_check_index(snmpNotifyFilterTable_rowreq_ctx *
 
421
                                    rowreq_ctx)
 
422
{
 
423
    DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterSubtree_check_index", "called\n"));
 
424
 
 
425
    netsnmp_assert(NULL != rowreq_ctx);
 
426
 
 
427
    /*
 
428
     * TODO:426:M: |-> Check snmpNotifyFilterTable index snmpNotifyFilterSubtree.
 
429
     * check that index value in the table context is legal.
 
430
     * (rowreq_ctx->tbl_index.snmpNotifyFilterSubtree)
 
431
     */
 
432
 
 
433
    return MFD_SUCCESS;         /* snmpNotifyFilterSubtree index ok */
 
434
}                               /* snmpNotifyFilterSubtree_check_index */
 
435
 
 
436
/**
 
437
 * verify specified index is valid.
 
438
 *
 
439
 * This check is independent of whether or not the values specified for
 
440
 * the columns of the new row are valid. Column values and row consistency
 
441
 * will be checked later. At this point, only the index values should be
 
442
 * checked.
 
443
 *
 
444
 * All of the individual index validation functions have been called, so this
 
445
 * is the place to make sure they are valid as a whole when combined. If
 
446
 * you only have one index, then you probably don't need to do anything else
 
447
 * here.
 
448
 * 
 
449
 * @note Keep in mind that if the indexes refer to a row in this or
 
450
 *       some other table, you can't check for that row here to make
 
451
 *       decisions, since that row might not be created yet, but may
 
452
 *       be created during the processing this request. If you have
 
453
 *       such checks, they should be done in the check_dependencies
 
454
 *       function, because any new/deleted/changed rows should be
 
455
 *       available then.
 
456
 *
 
457
 *
 
458
 * @param snmpNotifyFilterTable_reg
 
459
 *        Pointer to the user registration data
 
460
 * @param rowreq_ctx
 
461
 *        Pointer to the users context.
 
462
 * @retval MFD_SUCCESS            : success
 
463
 * @retval MFD_CANNOT_CREATE_NOW  : index not valid right now
 
464
 * @retval MFD_CANNOT_CREATE_EVER : index never valid
 
465
 */
 
466
int
 
467
snmpNotifyFilterTable_validate_index(snmpNotifyFilterTable_registration *
 
468
                                     snmpNotifyFilterTable_reg,
 
469
                                     snmpNotifyFilterTable_rowreq_ctx *
 
470
                                     rowreq_ctx)
 
471
{
 
472
    int             rc = MFD_SUCCESS;
 
473
 
 
474
    DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_validate_index", "called\n"));
 
475
 
 
476
    /** we should have a non-NULL pointer */
 
477
    netsnmp_assert(NULL != rowreq_ctx);
 
478
 
 
479
    /*
 
480
     * TODO:430:M: |-> Validate potential snmpNotifyFilterTable index.
 
481
     */
 
482
 
 
483
    return rc;
 
484
}                               /* snmpNotifyFilterTable_validate_index */
 
485
 
 
486
/** @} */
 
487
 
 
488
/*
 
489
 * ugly, inefficient hack: create a dummy viewEntry list from the filter table
 
490
 * entries matching a profile name. This lets us use the existing vacm
 
491
 * routines for matching oids to views.
 
492
 */
 
493
struct vacm_viewEntry *
 
494
snmpNotifyFilterTable_vacm_view_subtree(const char *profile)
 
495
{
 
496
    oid             tmp_oid[MAX_OID_LEN];
 
497
    netsnmp_index   tmp_idx;
 
498
    int             i, j;
 
499
    netsnmp_void_array *s;
 
500
    struct vacm_viewEntry *tmp;
 
501
    snmpNotifyFilterTable_rowreq_ctx *rowreq;
 
502
    netsnmp_container *c;
 
503
 
 
504
    tmp_idx.len = 0;
 
505
    tmp_idx.oids = tmp_oid;
 
506
 
 
507
    /*
 
508
     * get the container
 
509
     */
 
510
    c = snmpNotifyFilterTable_container_get();
 
511
    if ((NULL == profile) || (NULL == c))
 
512
        return NULL;
 
513
 
 
514
    /*
 
515
     * get the profile subset
 
516
     */
 
517
    tmp_idx.oids[0] = strlen(profile);
 
518
    tmp_idx.len = tmp_idx.oids[0] + 1;
 
519
    for (i = 0; i < tmp_idx.len; ++i)
 
520
        tmp_idx.oids[i + 1] = profile[i];
 
521
    s = c->get_subset(c, &tmp_idx);
 
522
    if (NULL == s)
 
523
        return NULL;
 
524
 
 
525
    /*
 
526
     * allocate temporary storage
 
527
     */
 
528
    tmp = calloc(sizeof(struct vacm_viewEntry), s->size + 1);
 
529
    if (NULL == tmp) {
 
530
        free(s->array);
 
531
        free(s);
 
532
        return NULL;
 
533
    }
 
534
 
 
535
    /*
 
536
     * copy data
 
537
     */
 
538
    for (i = 0, j = 0; i < s->size; ++i) {
 
539
        rowreq = (snmpNotifyFilterTable_rowreq_ctx *) s->array[i];
 
540
 
 
541
        /*
 
542
         * must match profile name exactly, and subset will return
 
543
         * longer matches, if they exist.
 
544
         */
 
545
        if (tmp_idx.oids[0] !=
 
546
            rowreq->tbl_idx.snmpNotifyFilterProfileName_len)
 
547
            continue;
 
548
 
 
549
        /*
 
550
         * exact match, copy data
 
551
         * vacm_viewEntry viewName and viewSubtree are prefixed with length
 
552
         */
 
553
 
 
554
        tmp[j].viewName[0] =
 
555
            rowreq->tbl_idx.snmpNotifyFilterProfileName_len;
 
556
        memcpy(&tmp[j].viewName[1],
 
557
               rowreq->tbl_idx.snmpNotifyFilterProfileName,
 
558
               tmp[j].viewName[0]);
 
559
 
 
560
        tmp[j].viewSubtree[0] =
 
561
            rowreq->tbl_idx.snmpNotifyFilterSubtree_len;
 
562
        memcpy(&tmp[j].viewSubtree[1],
 
563
               rowreq->tbl_idx.snmpNotifyFilterSubtree,
 
564
               tmp[j].viewSubtree[0] * sizeof(oid));
 
565
        tmp[j].viewSubtreeLen = tmp[j].viewSubtree[0] + 1;
 
566
 
 
567
        tmp[j].viewMaskLen = rowreq->data.snmpNotifyFilterMask_len;
 
568
        memcpy(tmp[j].viewMask, rowreq->data.snmpNotifyFilterMask,
 
569
               tmp[j].viewMaskLen * sizeof(oid));
 
570
 
 
571
 
 
572
        tmp[j].viewType = rowreq->data.snmpNotifyFilterType;
 
573
 
 
574
        tmp[j].next = &tmp[j + 1];
 
575
        ++j;
 
576
    }
 
577
    if (j)
 
578
        tmp[j - 1].next = NULL;
 
579
    else {
 
580
        SNMP_FREE(tmp);
 
581
    }
 
582
 
 
583
    free(s->array);
 
584
    free(s);
 
585
 
 
586
    return tmp;
 
587
}