~ubuntu-branches/ubuntu/gutsy/net-snmp/gutsy-security

« back to all changes in this revision

Viewing changes to include/net-snmp/agent/cache_handler.h

  • 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
#ifndef NETSNMP_CACHE_HANDLER_H
 
2
#define NETSNMP_CACHE_HANDLER_H
 
3
 
 
4
/*
 
5
 * This caching helper provides a generalised (SNMP-manageable) caching
 
6
 * mechanism.  Individual SNMP table and scalar/scalar group MIB
 
7
 * implementations can use data caching in a consistent manner, without
 
8
 * needing to handle the generic caching details themselves.
 
9
 */
 
10
 
 
11
#include <net-snmp/library/tools.h>
 
12
 
 
13
#ifdef __cplusplus
 
14
extern          "C" {
 
15
#endif
 
16
 
 
17
#define CACHE_NAME "cache_info"
 
18
 
 
19
    typedef struct netsnmp_cache_s netsnmp_cache;
 
20
 
 
21
    typedef int  (NetsnmpCacheLoad)(netsnmp_cache *, void*);
 
22
    typedef void (NetsnmpCacheFree)(netsnmp_cache *, void*);
 
23
 
 
24
    struct netsnmp_cache_s {
 
25
        /*
 
26
         * For operation of the data caches
 
27
         */
 
28
        int      enabled;
 
29
        int      valid;
 
30
        int      timeout;       /* Length of time the cache is valid (in s) */
 
31
        marker_t timestamp;     /* When the cache was last loaded */
 
32
 
 
33
        NetsnmpCacheLoad *load_cache;
 
34
        NetsnmpCacheFree *free_cache;
 
35
        void             *magic;        /* You never know when it might
 
36
                                                     not come in useful .... */
 
37
 
 
38
        /*
 
39
         * For SNMP-management of the data caches
 
40
         */
 
41
        netsnmp_cache *next, *prev;
 
42
        oid *rootoid;
 
43
        int  rootoid_len;
 
44
    };
 
45
 
 
46
 
 
47
    netsnmp_cache* netsnmp_extract_cache_info(netsnmp_agent_request_info *);
 
48
    int            netsnmp_is_cache_valid(    netsnmp_agent_request_info *);
 
49
    netsnmp_mib_handler *netsnmp_get_cache_handler(int, NetsnmpCacheLoad *,
 
50
                                                        NetsnmpCacheFree *,
 
51
                                                        oid*, int);
 
52
    int   netsnmp_register_cache_handler(netsnmp_handler_registration *reginfo,
 
53
                                         int, NetsnmpCacheLoad *,
 
54
                                              NetsnmpCacheFree *);
 
55
 
 
56
    Netsnmp_Node_Handler netsnmp_cache_helper_handler;
 
57
 
 
58
#ifdef __cplusplus
 
59
};
 
60
#endif
 
61
#endif /* NETSNMP_CACHE_HANDLER_H */