1 /* 2 * Copyright 2015 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 37 status_t Start(const char* name); 38 status_t Stop(const char* name, bool force = false); 39 40 status_t StartSession(const char* login); 41 42 status_t RegisterEvent(const BMessenger& source, 43 const char* name, uint32 flags); 44 status_t UnregisterEvent(const BMessenger& source, 45 const char* name); 46 status_t NotifyEvent(const BMessenger& source, 47 const char* name); 48 status_t ResetStickyEvent(const BMessenger& source, 49 const char* name); 50 51 status_t GetTargets(BStringList& targets); 52 status_t GetTargetInfo(const char* name, BMessage& info); 53 status_t GetJobs(const char* target, BStringList& jobs); 54 status_t GetJobInfo(const char* name, BMessage& info); 55 56 class Private; 57 58 private: 59 friend class Private; 60 61 void _InitMessenger(); 62 status_t _SendRequest(BMessage& request); 63 status_t _SendRequest(BMessage& request, 64 BMessage& reply); 65 status_t _UpdateEvent(uint32 what, 66 const BMessenger& source, const char* name, 67 uint32 flags = 0); 68 status_t _GetInfo(uint32 what, const char* name, 69 BMessage& info); 70 71 private: 72 BMessenger fMessenger; 73 uint32 _reserved[5]; 74 }; 75 76 77 #endif // _LAUNCH_ROSTER_H 78