1*ab428535SAxel Dörfler /* 2*ab428535SAxel Dörfler * Copyright 2004-2008, Haiku, Inc. All rights reserved. 3*ab428535SAxel Dörfler * Distributed under the terms of the MIT License. 4*ab428535SAxel Dörfler */ 5afd1e200Sshatty #ifndef _ADD_ON_MONITOR_HANDLER_H 6afd1e200Sshatty #define _ADD_ON_MONITOR_HANDLER_H 7afd1e200Sshatty 8afd1e200Sshatty #include <list> 9*ab428535SAxel Dörfler 10afd1e200Sshatty #include "NodeMonitorHandler.h" 11afd1e200Sshatty 12*ab428535SAxel Dörfler 13afd1e200Sshatty namespace BPrivate { 14afd1e200Sshatty namespace Storage { 15afd1e200Sshatty 16afd1e200Sshatty struct add_on_entry_info { 17afd1e200Sshatty char name[B_FILE_NAME_LENGTH]; 18afd1e200Sshatty node_ref nref; 19afd1e200Sshatty node_ref dir_nref; 20afd1e200Sshatty }; 21afd1e200Sshatty 22afd1e200Sshatty struct add_on_directory_info { 23afd1e200Sshatty node_ref nref; 24afd1e200Sshatty std::list<add_on_entry_info> entries; 25afd1e200Sshatty }; 26afd1e200Sshatty 27afd1e200Sshatty class AddOnMonitorHandler : public NodeMonitorHandler { 28afd1e200Sshatty public: 29*ab428535SAxel Dörfler AddOnMonitorHandler(const char* name = NULL); 30afd1e200Sshatty virtual ~AddOnMonitorHandler(); 31afd1e200Sshatty 32afd1e200Sshatty virtual void MessageReceived(BMessage* msg); 33afd1e200Sshatty 34*ab428535SAxel Dörfler // supply the add-on directories here, in the order you want them checked 35afd1e200Sshatty virtual status_t AddDirectory(const node_ref* nref); 36afd1e200Sshatty 37afd1e200Sshatty protected: 38afd1e200Sshatty // hooks for subclass 39*ab428535SAxel Dörfler virtual void AddOnCreated(const add_on_entry_info* entryInfo); 40*ab428535SAxel Dörfler virtual void AddOnEnabled(const add_on_entry_info* entryInfo); 41*ab428535SAxel Dörfler virtual void AddOnDisabled(const add_on_entry_info* entryInfo); 42*ab428535SAxel Dörfler virtual void AddOnRemoved(const add_on_entry_info* entryInfo); 43afd1e200Sshatty 44afd1e200Sshatty protected: 45afd1e200Sshatty virtual void EntryCreated(const char* name, ino_t directory, 46afd1e200Sshatty dev_t device, ino_t node); 47afd1e200Sshatty virtual void EntryRemoved(ino_t directory, dev_t device, ino_t node); 48*ab428535SAxel Dörfler virtual void EntryMoved(const char* name, ino_t fromDirectory, 49*ab428535SAxel Dörfler ino_t toDirectory, dev_t device, ino_t node); 50afd1e200Sshatty 51afd1e200Sshatty private: 52*ab428535SAxel Dörfler typedef NodeMonitorHandler inherited; 53*ab428535SAxel Dörfler 54ca5e0241SRene Gollent void _HandlePulse(); 55afd1e200Sshatty 56ca5e0241SRene Gollent std::list<add_on_directory_info> fDirectories; 57ca5e0241SRene Gollent std::list<add_on_entry_info> fPendingEntries; 58ca5e0241SRene Gollent std::list<add_on_entry_info> fFormerEntries; 59afd1e200Sshatty }; 60afd1e200Sshatty 61afd1e200Sshatty 62afd1e200Sshatty }; // namespace Storage 63afd1e200Sshatty }; // namespace BPrivate 64afd1e200Sshatty 65afd1e200Sshatty using namespace BPrivate::Storage; 66afd1e200Sshatty 67afd1e200Sshatty #endif // _ADD_ON_MONITOR_HANDLER_H 68