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

« back to all changes in this revision

Viewing changes to agent/mibgroup/disman/event/mteEventConf.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-12-08 14:59:50 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20071208145950-u1tykhpw56nyzqik
Tags: 5.4.1~dfsg-4ubuntu1
* Merge from debian unstable.
* Remaining Ubuntu changes:
  - Remove stop links from rc0 and rc6
  - Munge Maintainer field as per spec.
* Ubuntu changes dropped:
  - Symlink common files between the packages, CDBS ought to handle that
    for us automatically.
* The latest Debian changes has dropped history from the changelog. Slot in
  the Ubuntu changes as best I can. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
#include <net-snmp/net-snmp-config.h>
7
7
#include <net-snmp/net-snmp-includes.h>
8
8
#include <net-snmp/agent/net-snmp-agent-includes.h>
 
9
#include <net-snmp/agent/agent_callbacks.h>
9
10
#include "disman/event/mteObjects.h"
10
11
#include "disman/event/mteEvent.h"
11
12
#include "disman/event/mteEventConf.h"
51
52
     */
52
53
    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
53
54
                           store_mteETable, NULL);
 
55
    snmp_register_callback(SNMP_CALLBACK_APPLICATION,
 
56
                           SNMPD_CALLBACK_PRE_UPDATE_CONFIG,
 
57
                           clear_mteETable, NULL);
54
58
}
55
59
 
56
60
 
87
91
    if (!row)
88
92
        return NULL;
89
93
 
 
94
    /* return (struct mteEvent *)netsnmp_tdata_row_entry( row ); */
90
95
    return (struct mteEvent *)row->data;
91
96
}
92
97
 
131
136
    int    wild = 1;
132
137
    int    idx  = 0;
133
138
    char  *cp;
 
139
#ifndef NETSNMP_DISABLE_MIB_LOADING
134
140
    struct tree         *tp;
 
141
#endif
135
142
    struct varbind_list *var;
136
143
 
137
144
    DEBUGMSGTL(("disman:event:conf", "Parsing notificationEvent config\n"));
171
178
     *  ... and the relevant object/instances.
172
179
     */
173
180
    if ( cp && *cp=='-' && *(cp+1)=='m' ) {
 
181
#ifdef NETSNMP_DISABLE_MIB_LOADING
 
182
        config_perror("Can't use -m if MIB loading is disabled");
 
183
        return;
 
184
#else
174
185
        /*
175
186
         * Use the MIB definition to add the standard
176
187
         *   notification payload to the mteObjectsTable.
187
198
                                         var->vblabel, wild );
188
199
            idx    = object->mteOIndex;
189
200
        }
 
201
#endif
190
202
    }
191
203
    while (cp) {
192
204
        if ( *cp == '-' ) {
546
558
    DEBUGMSGTL(("disman:event:conf", "  done.\n"));
547
559
    return SNMPERR_SUCCESS;
548
560
}
 
561
 
 
562
int
 
563
clear_mteETable(int majorID, int minorID, void *serverarg, void *clientarg)
 
564
{
 
565
    netsnmp_tdata_row    *row;
 
566
    netsnmp_variable_list owner_var;
 
567
 
 
568
    /*
 
569
     * We're only interested in entries set up via the config files
 
570
     */
 
571
    memset( &owner_var, 0, sizeof(netsnmp_variable_list));
 
572
    snmp_set_var_typed_value( &owner_var,  ASN_OCTET_STR,
 
573
                             "snmpd.conf", strlen("snmpd.conf"));
 
574
    while (( row = netsnmp_tdata_row_next_byidx( event_table_data,
 
575
                                                &owner_var ))) {
 
576
        /*
 
577
         * XXX - check for owner of "snmpd.conf"
 
578
         *       and break at the end of these
 
579
         */
 
580
        netsnmp_tdata_remove_and_delete_row( event_table_data, row );
 
581
    }
 
582
    return SNMPERR_SUCCESS;
 
583
}