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