Revert "Revert "and added files""
[bcm963xx.git] / userapps / opensource / net-snmp / include / net-snmp / library / oid_stash.h
1 #ifndef OID_STASH_H
2 #define OID_STASH_H
3
4 /*
5  * designed to store/retrieve information associated with a given oid.
6  * * Storage is done in an efficient manner for fast lookups.
7  */
8
9 #define OID_STASH_CHILDREN_SIZE 31
10
11 #ifdef __cplusplus
12 extern          "C" {
13 #endif
14
15     struct netsnmp_oid_stash_node_s;
16
17     /* args: buffer, sizeof(buffer), yourdata, stashnode */
18     typedef int     (NetSNMPStashDump) (char *, size_t,
19                                         void *,
20                                         struct netsnmp_oid_stash_node_s *);
21
22     typedef struct netsnmp_oid_stash_node_s {
23         oid             value;
24         struct netsnmp_oid_stash_node_s **children;     /* array of children */
25         size_t          children_size;
26         struct netsnmp_oid_stash_node_s *next_sibling;  /* cache too small links */
27         struct netsnmp_oid_stash_node_s *prev_sibling;
28         /*
29          * struct netsnmp_oid_stash_node_s *parent; 
30          *
31          * XXX? 
32          */
33
34         void           *thedata;
35     } netsnmp_oid_stash_node;
36
37     typedef struct netsnmp_oid_stash_save_info_s {
38        const char *token;
39        netsnmp_oid_stash_node **root;
40        NetSNMPStashDump *dumpfn;
41     } netsnmp_oid_stash_save_info;
42
43     int             netsnmp_oid_stash_add_data(netsnmp_oid_stash_node
44                                                **root, oid * lookup,
45                                                size_t lookup_len,
46                                                void *mydata);
47     SNMPCallback netsnmp_oid_stash_store_all;
48
49
50     netsnmp_oid_stash_node
51         *netsnmp_oid_stash_get_node(netsnmp_oid_stash_node *root,
52                                     oid * lookup, size_t lookup_len);
53     void           *netsnmp_oid_stash_get_data(netsnmp_oid_stash_node
54                                                *root, oid * lookup,
55                                                size_t lookup_len);
56
57     netsnmp_oid_stash_node *netsnmp_oid_stash_create_sized_node(size_t
58                                                                 mysize);
59     netsnmp_oid_stash_node *netsnmp_oid_stash_create_node(void);        /* returns a malloced node */
60
61     void netsnmp_oid_stash_store(netsnmp_oid_stash_node *root,
62                                  const char *tokenname, NetSNMPStashDump *dumpfn,
63                                  oid *curoid, size_t curoid_len);
64
65 #ifdef __cplusplus
66 }
67 #endif
68 #endif                          /* OID_STASH_H */