le_appCtrl_common.h

Go to the documentation of this file.
1 
2 /*
3  * ====================== WARNING ======================
4  *
5  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
6  * DO NOT MODIFY IN ANY WAY.
7  *
8  * ====================== WARNING ======================
9  */
10 /**
11  * @file le_appCtrl_common.h
12  *
13  * Type definitions for le_appCtrl.
14  *
15  */
16 #ifndef LE_APPCTRL_COMMON_H_INCLUDE_GUARD
17 #define LE_APPCTRL_COMMON_H_INCLUDE_GUARD
18 
19 
20 #include "legato.h"
21 
22 // Interface specific includes
23 #include "le_limit_common.h"
24 
25 #define IFGEN_LE_APPCTRL_PROTOCOL_ID "4d849724ee91cb561bc0059af7eead96"
26 #define IFGEN_LE_APPCTRL_MSG_SIZE 533
27 /** @addtogroup le_appCtrl
28  * @{ **/
29 
30 
31 //--------------------------------------------------------------------------------------------------
32 /**
33  */
34 //--------------------------------------------------------------------------------------------------
35 typedef struct le_appCtrl_App* le_appCtrl_AppRef_t;
36 
37 
38 //--------------------------------------------------------------------------------------------------
39 /**
40  * Reference type used by Add/Remove functions for EVENT 'le_appCtrl_TraceAttach'
41  */
42 //--------------------------------------------------------------------------------------------------
43 typedef struct le_appCtrl_TraceAttachHandler* le_appCtrl_TraceAttachHandlerRef_t;
44 
45 
46 //--------------------------------------------------------------------------------------------------
47 /**
48  * Handler for attaching to a process that is to be traced. The process is blocked allowing the
49  * tracer to attach to it. The tracer must call TraceUnblock() to unblock the traced process.
50  */
51 //--------------------------------------------------------------------------------------------------
53 (
54  le_appCtrl_AppRef_t appRef,
55  ///< Ref to the app.
56  int32_t pid,
57  ///< PID of a process that can be attached to.
58  const char* LE_NONNULL procName,
59  ///< Name of the process name.
60  void* contextPtr
61  ///<
62 );
63 
64 
65 //--------------------------------------------------------------------------------------------------
66 /**
67  * Get if this client bound locally.
68  */
69 //--------------------------------------------------------------------------------------------------
70 LE_SHARED bool ifgen_le_appCtrl_HasLocalBinding
71 (
72  void
73 );
74 
75 
76 //--------------------------------------------------------------------------------------------------
77 /**
78  * Init data that is common across all threads
79  */
80 //--------------------------------------------------------------------------------------------------
81 LE_SHARED void ifgen_le_appCtrl_InitCommonData
82 (
83  void
84 );
85 
86 
87 //--------------------------------------------------------------------------------------------------
88 /**
89  * Perform common initialization and open a session
90  */
91 //--------------------------------------------------------------------------------------------------
92 LE_SHARED le_result_t ifgen_le_appCtrl_OpenSession
93 (
94  le_msg_SessionRef_t _ifgen_sessionRef,
95  bool isBlocking
96 );
97 
98 //--------------------------------------------------------------------------------------------------
99 /**
100  * Gets a reference to an app.
101  *
102  * @return
103  * Reference to the named app.
104  * NULL on error (check logs for errors).
105  */
106 //--------------------------------------------------------------------------------------------------
107 LE_SHARED le_appCtrl_AppRef_t ifgen_le_appCtrl_GetRef
108 (
109  le_msg_SessionRef_t _ifgen_sessionRef,
110  const char* LE_NONNULL appName
111  ///< [IN] Name of the app to get the ref for.
112 );
113 
114 //--------------------------------------------------------------------------------------------------
115 /**
116  * Release the reference to an app, resetting all overrides set for this app using other
117  * functions, like SetRun(), SetDevicePerm(), etc.
118  */
119 //--------------------------------------------------------------------------------------------------
120 LE_SHARED void ifgen_le_appCtrl_ReleaseRef
121 (
122  le_msg_SessionRef_t _ifgen_sessionRef,
123  le_appCtrl_AppRef_t appRef
124  ///< [IN] Ref to the app.
125 );
126 
127 //--------------------------------------------------------------------------------------------------
128 /**
129  * Sets the run flag for a process in an app.
130  *
131  * If there is an error this function will kill the calling client.
132  */
133 //--------------------------------------------------------------------------------------------------
134 LE_SHARED void ifgen_le_appCtrl_SetRun
135 (
136  le_msg_SessionRef_t _ifgen_sessionRef,
137  le_appCtrl_AppRef_t appRef,
138  ///< [IN] Ref to the app.
139  const char* LE_NONNULL procName,
140  ///< [IN] Process name to set the run flag for.
141  bool run
142  ///< [IN] Flag to run the process or not.
143 );
144 
145 //--------------------------------------------------------------------------------------------------
146 /**
147  * Sets the debug flag for a process in an app.
148  *
149  * If there is an error this function will kill the calling client.
150  */
151 //--------------------------------------------------------------------------------------------------
152 LE_SHARED void ifgen_le_appCtrl_SetDebug
153 (
154  le_msg_SessionRef_t _ifgen_sessionRef,
155  le_appCtrl_AppRef_t appRef,
156  ///< [IN] Ref to the app.
157  const char* LE_NONNULL procName,
158  ///< [IN] Process name to set the run flag for.
159  bool debug
160  ///< [IN] Flag to debug the process or not.
161 );
162 
163 //--------------------------------------------------------------------------------------------------
164 /**
165  * Imports a file into the app's working directory.
166  *
167  * @return
168  * LE_OK if successfully imported the file.
169  * LE_DUPLICATE if the path conflicts with items already in the app's working directory.
170  * LE_NOT_FOUND if the path does not point to a valid file.
171  * LE_BAD_PARAMETER if the path is formatted incorrectly.
172  * LE_FAULT if there was some other error.
173  *
174  * @note If the caller is passing an invalid reference to the app, it is a fatal error,
175  * the function will not return.
176  */
177 //--------------------------------------------------------------------------------------------------
178 LE_SHARED le_result_t ifgen_le_appCtrl_Import
179 (
180  le_msg_SessionRef_t _ifgen_sessionRef,
181  le_appCtrl_AppRef_t appRef,
182  ///< [IN] Ref to the app.
183  const char* LE_NONNULL path
184  ///< [IN] Absolute path to the file to import.
185 );
186 
187 //--------------------------------------------------------------------------------------------------
188 /**
189  * Sets a device file's permissions.
190  *
191  * @return
192  * LE_OK if successfully set the device's permissions.
193  * LE_NOT_FOUND if the path does not point to a valid device.
194  * LE_BAD_PARAMETER if the path is formatted incorrectly.
195  * LE_FAULT if there was some other error.
196  *
197  * @note If the caller is passing an invalid reference to the app, it is a fatal error,
198  * the function will not return.
199  */
200 //--------------------------------------------------------------------------------------------------
201 LE_SHARED le_result_t ifgen_le_appCtrl_SetDevicePerm
202 (
203  le_msg_SessionRef_t _ifgen_sessionRef,
204  le_appCtrl_AppRef_t appRef,
205  ///< [IN] Ref to the app.
206  const char* LE_NONNULL path,
207  ///< [IN] Absolute path to the device.
208  const char* LE_NONNULL permissions
209  ///< [IN] Permission string, "r", "w", "rw".
210 );
211 
212 //--------------------------------------------------------------------------------------------------
213 /**
214  * Add handler function for EVENT 'le_appCtrl_TraceAttach'
215  *
216  * Event that indicates the process is blocked and can be attached to.
217  */
218 //--------------------------------------------------------------------------------------------------
219 LE_SHARED le_appCtrl_TraceAttachHandlerRef_t ifgen_le_appCtrl_AddTraceAttachHandler
220 (
221  le_msg_SessionRef_t _ifgen_sessionRef,
222  le_appCtrl_AppRef_t appRef,
223  ///< [IN] Ref to the app.
225  ///< [IN] Attach handler to register.
226  void* contextPtr
227  ///< [IN]
228 );
229 
230 //--------------------------------------------------------------------------------------------------
231 /**
232  * Remove handler function for EVENT 'le_appCtrl_TraceAttach'
233  */
234 //--------------------------------------------------------------------------------------------------
235 LE_SHARED void ifgen_le_appCtrl_RemoveTraceAttachHandler
236 (
237  le_msg_SessionRef_t _ifgen_sessionRef,
239  ///< [IN]
240 );
241 
242 //--------------------------------------------------------------------------------------------------
243 /**
244  * Unblocks the traced process. This should normally be done once the tracer has successfully
245  * attached to the process.
246  *
247  * @note If the caller is passing an invalid reference to the app, it is a fatal error,
248  * the function will not return.
249  */
250 //--------------------------------------------------------------------------------------------------
251 LE_SHARED void ifgen_le_appCtrl_TraceUnblock
252 (
253  le_msg_SessionRef_t _ifgen_sessionRef,
254  le_appCtrl_AppRef_t appRef,
255  ///< [IN] Ref to the app.
256  int32_t pid
257  ///< [IN] PID of the process to unblock.
258 );
259 
260 //--------------------------------------------------------------------------------------------------
261 /**
262  * Starts an app.
263  *
264  * @return
265  * LE_OK if the app is successfully started.
266  * LE_DUPLICATE if the app is already running.
267  * LE_NOT_FOUND if the app isn't installed.
268  * LE_FAULT if there was an error and the app could not be launched.
269  */
270 //--------------------------------------------------------------------------------------------------
271 LE_SHARED le_result_t ifgen_le_appCtrl_Start
272 (
273  le_msg_SessionRef_t _ifgen_sessionRef,
274  const char* LE_NONNULL appName
275  ///< [IN] Name of the app to start.
276 );
277 
278 //--------------------------------------------------------------------------------------------------
279 /**
280  * Stops an app.
281  *
282  * @return
283  * LE_OK if successful.
284  * LE_NOT_FOUND if the app could not be found.
285  */
286 //--------------------------------------------------------------------------------------------------
287 LE_SHARED le_result_t ifgen_le_appCtrl_Stop
288 (
289  le_msg_SessionRef_t _ifgen_sessionRef,
290  const char* LE_NONNULL appName
291  ///< [IN] Name of the app to stop.
292 );
293 /** @} **/
294 #endif // LE_APPCTRL_COMMON_H_INCLUDE_GUARD
#define LE_SHARED
Definition: le_basics.h:287
le_result_t
Definition: le_basics.h:46
void(* le_appCtrl_TraceAttachHandlerFunc_t)(le_appCtrl_AppRef_t appRef, int32_t pid, const char *LE_NONNULL procName, void *contextPtr)
Definition: le_appCtrl_common.h:53
struct le_msg_Session * le_msg_SessionRef_t
Definition: le_messaging.h:860
struct le_appCtrl_TraceAttachHandler * le_appCtrl_TraceAttachHandlerRef_t
Definition: le_appCtrl_common.h:43