~ubuntu-branches/ubuntu/edgy/net-snmp/edgy-updates

« back to all changes in this revision

Viewing changes to agent/helpers/table_iterator.c

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-03-31 04:21:37 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050331042137-z0vw1grslj6cek9k
Tags: 5.1.2-6ubuntu2
Apply safe-but-hackish patch by Henrique de Moraes Holschuh to
fix the libdir in libsnmp5-dev's .la files (Ubuntu bug #8393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
241
241
static void
242
242
netsnmp_free_ti_cache(void *it) {
243
243
    ti_cache_info *beer = it;
 
244
    if (!it) return;
244
245
    if (beer->data_context && beer->free_context) {
245
246
            (beer->free_context)(beer->data_context, beer->iinfo);
246
247
    }
299
300
    return ti_info;
300
301
}    
301
302
 
 
303
#define TABLE_ITERATOR_NOTAGAIN 255
302
304
/** implements the table_iterator helper */
303
305
int
304
306
netsnmp_table_iterator_helper_handler(netsnmp_mib_handler *handler,
384
386
                   and take it, comparing to nothing from the request */
385
387
                table_info->colnum = tbl_info->min_column - 1;
386
388
            } else if (table_info->colnum > tbl_info->max_column) {
387
 
                request->processed = 1;
 
389
                request->processed = TABLE_ITERATOR_NOTAGAIN;
388
390
            }
389
391
 
390
392
            ti_info =
533
535
 
534
536
                    case MODE_GETNEXT:
535
537
                        /* looking for "next" matches */
536
 
                        coloid[reginfo->rootoid_len + 1] = table_info->colnum;
537
538
                        if (netsnmp_check_getnext_reply
538
539
                            (request, coloid, coloid_len, index_search,
539
540
                             &ti_info->results)) {
601
602
                for(request = requests ; request; request = request->next) {
602
603
                    if (request->processed)
603
604
                        continue;
 
605
                    ti_info =
 
606
                        netsnmp_request_get_list_data(request,
 
607
                                                      TI_REQUEST_CACHE);
604
608
                    if (!ti_info->results) {
 
609
                        table_info = netsnmp_extract_table_info(request);
605
610
                        if (table_info->colnum == tbl_info->max_column) {
606
611
                            coloid[reginfo->rootoid_len+1] = table_info->colnum+1;
607
612
                            snmp_set_var_objid(request->requestvb,
608
613
                                               coloid, reginfo->rootoid_len+2);
609
 
                            requests->processed = 1;
 
614
                            request->processed = TABLE_ITERATOR_NOTAGAIN;
610
615
                            break;
611
616
                        } else {
612
617
                            table_info->colnum++;
636
641
            switch(reqinfo->mode) {
637
642
 
638
643
            case MODE_GETNEXT:
639
 
                snmp_set_var_objid(request->requestvb, ti_info->best_match,
640
 
                                   ti_info->best_match_len);
 
644
                if (ti_info->best_match_len)
 
645
                    snmp_set_var_objid(request->requestvb, ti_info->best_match,
 
646
                                       ti_info->best_match_len);
 
647
                else {
 
648
                    coloid[reginfo->rootoid_len+1] = table_info->colnum+1;
 
649
                    snmp_set_var_objid(request->requestvb,
 
650
                                       coloid, reginfo->rootoid_len+2);
 
651
                    request->processed = 1;
 
652
                }
641
653
                snmp_free_varbind(table_info->indexes);
642
654
                table_info->indexes = snmp_clone_varbind(ti_info->results);
643
655
                /* FALL THROUGH */
692
704
                 * get next skipped this value for this column, we
693
705
                 * need to keep searching forward 
694
706
                 */
695
 
                request->requestvb->type = ASN_PRIV_RETRY;
 
707
                if (request->processed != TABLE_ITERATOR_NOTAGAIN)
 
708
                    request->requestvb->type = ASN_PRIV_RETRY;
 
709
                else
 
710
                    request->processed = 1;
696
711
            }
697
712
        }
698
713
        reqinfo->mode = oldmode;