xref: /haiku/headers/private/app/LaunchRoster.h (revision 7bdeef54a24d3417300f251af891df962b638b9b)
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 			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 	class Private;
60 
61 private:
62 	friend class Private;
63 
64 			void				_InitMessenger();
65 			status_t			_SendRequest(BMessage& request);
66 			status_t			_SendRequest(BMessage& request,
67 									BMessage& reply);
68 			status_t			_UpdateEvent(uint32 what,
69 									const BMessenger& source, const char* name,
70 									uint32 flags = 0);
71 			status_t			_GetInfo(uint32 what, const char* name,
72 									BMessage& info);
73 
74 private:
75 			BMessenger			fMessenger;
76 			uint32				_reserved[5];
77 };
78 
79 
80 #endif	// _LAUNCH_ROSTER_H
81