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(const char *name, ino_t directory, 32 dev_t device, ino_t node); 33 virtual void EntryMoved(const char *name, const char *fromName, 34 ino_t fromDirectory, ino_t toDirectory, dev_t device, 35 ino_t node, dev_t nodeDevice); 36 virtual void StatChanged(ino_t node, dev_t device, int32 statFields); 37 virtual void AttrChanged(ino_t node, dev_t device); 38 virtual void DeviceMounted(dev_t new_device, dev_t device, 39 ino_t directory); 40 virtual void DeviceUnmounted(dev_t new_device); 41 42 private: 43 status_t HandleEntryCreated(BMessage * msg); 44 status_t HandleEntryRemoved(BMessage * msg); 45 status_t HandleEntryMoved(BMessage * msg); 46 status_t HandleStatChanged(BMessage * msg); 47 status_t HandleAttrChanged(BMessage * msg); 48 status_t HandleDeviceMounted(BMessage * msg); 49 status_t HandleDeviceUnmounted(BMessage * msg); 50 }; 51 52 }; // namespace Storage 53 }; // namespace BPrivate 54 55 using namespace BPrivate::Storage; 56 57 #endif // _NODE_MONITOR_HANDLER_H 58