1 /* 2 * Copyright 2015-2018 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _LAUNCH_ROSTER_H 6 #define _LAUNCH_ROSTER_H 7 8 9 #include <Messenger.h> 10 11 12 // Flags for RegisterEvent() 13 enum { 14 B_STICKY_EVENT = 0x01 15 }; 16 17 18 class BLaunchRoster { 19 public: 20 BLaunchRoster(); 21 ~BLaunchRoster(); 22 23 status_t InitCheck() const; 24 25 status_t GetData(BMessage& data); 26 status_t GetData(const char* signature, BMessage& data); 27 port_id GetPort(const char* name = NULL); 28 port_id GetPort(const char* signature, 29 const char* name); 30 31 status_t Target(const char* name, const BMessage& data, 32 const char* baseName = NULL); 33 status_t Target(const char* name, 34 const BMessage* data = NULL, 35 const char* baseName = NULL); 36 status_t StopTarget(const char* name, 37 bool force = false); 38 39 status_t Start(const char* name); 40 status_t Stop(const char* name, bool force = false); 41 status_t SetEnabled(const char* name, bool enabled); 42 43 status_t StartSession(const char* login); 44 45 status_t RegisterEvent(const BMessenger& source, 46 const char* name, uint32 flags); 47 status_t UnregisterEvent(const BMessenger& source, 48 const char* name); 49 status_t NotifyEvent(const BMessenger& source, 50 const char* name); 51 status_t ResetStickyEvent(const BMessenger& source, 52 const char* name); 53 54 status_t GetTargets(BStringList& targets); 55 status_t GetTargetInfo(const char* name, BMessage& info); 56 status_t GetJobs(const char* target, BStringList& jobs); 57 status_t GetJobInfo(const char* name, BMessage& info); 58 59 status_t GetLog(BMessage& info); 60 status_t GetLog(const BMessage& filter, BMessage& info); 61 62 class Private; 63 64 private: 65 friend class Private; 66 67 void _InitMessenger(); 68 status_t _SendRequest(BMessage& request); 69 status_t _SendRequest(BMessage& request, 70 BMessage& reply); 71 status_t _UpdateEvent(uint32 what, 72 const BMessenger& source, const char* name, 73 uint32 flags = 0); 74 status_t _GetInfo(uint32 what, const char* name, 75 BMessage& info); 76 status_t _GetLog(const BMessage* filter, BMessage& info); 77 78 private: 79 BMessenger fMessenger; 80 uint32 _reserved[5]; 81 }; 82 83 84 #endif // _LAUNCH_ROSTER_H 85