Branch data Line data Source code
1 : : // $Id: EventRegistry.h 6829 2009-07-09 09:12:59Z vern $
2 : : //
3 : : // Each event raised/handled by Bro is registered in the EventRegistry.
4 : :
5 : : #ifndef EVENT_REGISTRY
6 : : #define EVENT_REGISTRY
7 : :
8 : : #include "Func.h"
9 : : #include "List.h"
10 : : #include "Dict.h"
11 : : #include "EventHandler.h"
12 : :
13 : : // The registry keeps track of all events that we provide or handle.
14 : : class EventRegistry {
15 : : public:
16 : 3 : EventRegistry() { }
17 : 1 : ~EventRegistry() { }
18 : :
19 : : void Register(EventHandlerPtr handler);
20 : :
21 : : // Return nil if unknown.
22 : : EventHandler* Lookup(const char* name);
23 : :
24 : : // Returns a list of all local handlers that match the given pattern.
25 : : // Passes ownership of list.
26 : : typedef const char constchar; // PList doesn't like "const char"
27 : 74 : declare(PList, constchar);
28 : : typedef PList(constchar) string_list;
29 : : string_list* Match(RE_Matcher* pattern);
30 : :
31 : : // Associates a group with the given event.
32 : : void SetGroup(const char* name, const char* group);
33 : :
34 : : // Enable/disable all members of the group.
35 : : void EnableGroup(const char* group, bool enable);
36 : :
37 : : string_list* UnusedHandlers();
38 : : string_list* UsedHandlers();
39 : : void PrintDebug();
40 : :
41 : : private:
42 [ # # ][ - + ]: 22519 : declare(PDict, EventHandler);
43 : : typedef PDict(EventHandler) handler_map;
44 : : handler_map handlers;
45 : : };
46 : :
47 : : extern EventRegistry* event_registry;
48 : :
49 : : #endif
|