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