1 #ifndef _NODE_MONITOR_HANDLER_H 2 #define _NODE_MONITOR_HANDLER_H 3 4 #include <Entry.h> 5 #include <Handler.h> 6 #include <Message.h> 7 #include <NodeMonitor.h> 8 9 namespace BPrivate { 10 namespace Storage { 11 12 class NodeMonitorHandler : public BHandler { 13 private: 14 typedef BHandler inherited; 15 public: 16 NodeMonitorHandler(const char * name = "NodeMonitorHandler"); 17 virtual ~NodeMonitorHandler(); 18 19 virtual void MessageReceived(BMessage * msg); 20 21 // useful utility functions 22 static status_t make_entry_ref(dev_t device, ino_t directory, 23 const char * name, 24 entry_ref * ref); 25 static void make_node_ref(dev_t device, ino_t node, node_ref * ref); 26 27 protected: 28 // hooks for subclass 29 virtual void EntryCreated(const char *name, ino_t directory, 30 dev_t device, ino_t node); 31 virtual void EntryRemoved(ino_t directory, dev_t device, ino_t node); 32 virtual void EntryMoved(const char *name, ino_t from_directory, 33 ino_t to_directory, dev_t device, ino_t node); 34 virtual void StatChanged(ino_t node, dev_t device); 35 virtual void AttrChanged(ino_t node, dev_t device); 36 virtual void DeviceMounted(dev_t new_device, dev_t device, 37 ino_t directory); 38 virtual void DeviceUnmounted(dev_t new_device); 39 40 private: 41 status_t HandleEntryCreated(BMessage * msg); 42 status_t HandleEntryRemoved(BMessage * msg); 43 status_t HandleEntryMoved(BMessage * msg); 44 status_t HandleStatChanged(BMessage * msg); 45 status_t HandleAttrChanged(BMessage * msg); 46 status_t HandleDeviceMounted(BMessage * msg); 47 status_t HandleDeviceUnmounted(BMessage * msg); 48 }; 49 50 }; // namespace Storage 51 }; // namespace BPrivate 52 53 using namespace BPrivate::Storage; 54 55 #endif // _NODE_MONITOR_HANDLER_H 56