1 #ifndef _ADD_ON_MONITOR_HANDLER_H 2 #define _ADD_ON_MONITOR_HANDLER_H 3 4 #include <list> 5 #include "NodeMonitorHandler.h" 6 7 namespace BPrivate { 8 namespace Storage { 9 10 struct add_on_entry_info { 11 char name[B_FILE_NAME_LENGTH]; 12 node_ref nref; 13 node_ref dir_nref; 14 }; 15 16 struct add_on_directory_info { 17 node_ref nref; 18 std::list<add_on_entry_info> entries; 19 }; 20 21 class AddOnMonitorHandler : public NodeMonitorHandler { 22 private: 23 typedef NodeMonitorHandler inherited; 24 public: 25 AddOnMonitorHandler(const char * name = "AddOnMonitorHandler"); 26 virtual ~AddOnMonitorHandler(); 27 28 virtual void MessageReceived(BMessage * msg); 29 30 // supply the add on directories here, in the order you want them checked 31 virtual status_t AddDirectory(const node_ref * nref); 32 33 protected: 34 // hooks for subclass 35 virtual void AddOnCreated(const add_on_entry_info * entry_info); 36 virtual void AddOnEnabled(const add_on_entry_info * entry_info); 37 virtual void AddOnDisabled(const add_on_entry_info * entry_info); 38 virtual void AddOnRemoved(const add_on_entry_info * entry_info); 39 40 protected: 41 virtual void EntryCreated(const char *name, ino_t directory, 42 dev_t device, ino_t node); 43 virtual void EntryRemoved(ino_t directory, dev_t device, ino_t node); 44 virtual void EntryMoved(const char *name, ino_t from_directory, 45 ino_t to_directory, dev_t device, ino_t node); 46 47 private: 48 void HandlePulse(); 49 50 std::list<add_on_directory_info> directories; 51 std::list<add_on_entry_info> pending_entries; 52 std::list<add_on_entry_info> former_entries; 53 }; 54 55 56 }; // namespace Storage 57 }; // namespace BPrivate 58 59 using namespace BPrivate::Storage; 60 61 #endif // _ADD_ON_MONITOR_HANDLER_H 62