and added files
[bcm963xx.git] / userapps / opensource / net-snmp / include / net-snmp / agent / object_monitor.h
1 /**************************************************************************
2  * object_monitor.h
3  *
4  * Contributed by: Robert Story <rstory@freesnmp.com>
5  *
6  * $Id: object_monitor.h,v 1.2 2002/07/18 17:56:17 rstory Exp $
7  *
8  * functions and data structures for cooperating code to monitor objects.
9  *
10  * WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
11  * WARNING!                                                       WARNING!
12  * WARNING!                                                       WARNING!
13  * WARNING!         This code is under active development         WARNING!
14  * WARNING!         and is subject to change at any time.         WARNING!
15  * WARNING!                                                       WARNING!
16  * WARNING!                                                       WARNING!
17  * WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
18  */
19 #ifndef OBJECT_MONITOR_H
20 #define OBJECT_MONITOR_H
21
22 #ifdef __cplusplus
23 extern          "C" {
24 #endif
25
26     /*
27      * notification types
28      */
29     enum {
30         /*
31          * cooperative notification from the object being watched
32          */
33         NOTIFICATION_COOPERATIVE = 1,
34         /*
35          * notification that an object has been set vi SNMP-SET
36          */
37         NOTIFICATION_SET_REQUEST,
38         /*
39          * end of current notification types
40          */
41         NOTIFICATION_END
42     };
43
44     /*
45      * COOPERATIVE event types
46      */
47     enum {
48         EVENT_ROW_ADD = 1,
49         EVENT_ROW_MOD,
50         EVENT_ROW_DEL,
51         EVENT_COL_MOD,
52         EVENT_OBJ_MOD,
53         EVENT_END
54     };
55
56     /*
57      * data structures
58      */
59
60
61     /*
62      * callback header
63      */
64     typedef struct netsnmp_monitor_callback_header_s {
65
66    /** callback type */
67         unsigned int    event;
68
69    /** registered oid */
70         netsnmp_index   monitored_object;
71
72    /** priority */
73         int             priority;
74
75    /** pointer given by watcher at registration */
76         void           *watcher_data;
77
78    /** pointer passed from the monitored object */
79         void           *object_info;
80
81    /** DO NOT USE, INTERNAL USE ONLY */
82         struct netsnmp_monitor_callback_header_s *private;
83         int             refs;
84
85
86     } netsnmp_monitor_callback_header;
87
88     /*
89      *
90      */
91     typedef struct netsnmp_monitor_callback_set_request_s {
92
93     /** header */
94         netsnmp_monitor_callback_header hdr;
95
96     /** handler that registered to handle this object */
97         netsnmp_mib_handler *handler;
98
99     /** pdu containing the set request */
100         netsnmp_pdu    *pdu;
101
102     /** the set request */
103         netsnmp_request_info *request;
104
105     } netsnmp_monitor_set_request_data;
106
107     /*
108      *
109      */
110     typedef struct netsnmp_monitor_callback_cooperative_s {
111
112    /** header */
113         netsnmp_monitor_callback_header hdr;
114
115     } netsnmp_monitor_callback_cooperative;
116
117
118
119     typedef void   
120         (netsnmp_object_monitor_callback) (netsnmp_monitor_callback_header
121                                            *);
122
123
124
125
126     /**********************************************************************
127      * Registration function prototypes
128      */
129
130     /*
131      * Register a callback for the specified object.
132      */
133     int             netsnmp_monitor_register(oid * object, size_t oid_len,
134                                              int priority,
135                                              unsigned int events,
136                                              void *watcher_data,
137                                              netsnmp_object_monitor_callback
138                                              * cb);
139
140     /*
141      * Unregister a callback for the specified object.
142      */
143     int             netsnmp_monitor_unregister(oid * object,
144                                                size_t oid_len,
145                                                int priority,
146                                                void *watcher_data,
147                                                netsnmp_object_monitor_callback
148                                                * cb);
149
150     /*
151      * check to see if a registration exists for an object/event combination
152      */
153     int             netsnmp_monitor_check_registered(int event, oid * oid,
154                                                      int oid_len);
155
156
157     /**********************************************************************
158      * function prototypes
159      */
160
161     /*
162      * Notifies the object monitor of an event.
163      */
164     void            netsnmp_notify_monitor(netsnmp_monitor_callback_header
165                                            * cbh);
166
167
168
169
170     /**********************************************************************
171      * function prototypes
172      */
173
174     /*
175      * Notifies the object monitor of a cooperative event.
176      */
177     void            netsnmp_notify_cooperative(int event, oid * object,
178                                                size_t len, char oid_steal,
179                                                void *object_info);
180
181
182
183 #ifdef __cplusplus
184 }
185 #endif
186 #endif /** OBJECT_MONITOR_H */