le_wdog_interface.h

Go to the documentation of this file.
1 
2 
3 /*
4  * ====================== WARNING ======================
5  *
6  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
7  * DO NOT MODIFY IN ANY WAY.
8  *
9  * ====================== WARNING ======================
10  */
11 
12 /**
13  * @page c_wdog Watchdog Service
14  *
15  * @ref le_wdog_interface.h "Type/Function Reference"
16  *
17  * @section Watchdog Service
18  *
19  * Provides an API for monitoring critical applications and services for deadlocks and other
20  * similar faults. The watchdog for a process is started by calling @c le_wdog_Kick or
21  * @c le_wdog_Timeout. Once started, the watchdog must be kicked periodically by calling
22  * @c le_wdog_Kick. If the watchdog is not kicked (because it is deadlocked, for example),
23  * the watchdog service will attempt to recover the service by killing the process and
24  * executing the action specified in the process' watchdogAction (if specified)
25  * otherwise its faultAction.
26  *
27  * Generally a service which uses the watchdog should set @c watchdogTimeout to give the
28  * default timeout, and @c watchdogAction to give a recovery action.
29  *
30  * Critical services should also set @c maxWatchdogTimeout. In this case the watchdog
31  * will be started on system boot, and cannot be stopped or set
32  * longer than the timeout given in @c maxWatchdogTimeout. This ensures the service is
33  * always running as long as the system is running.
34  *
35  * @note If maxWatchdogTimeout is not set, no more action is taken if performing the process'
36  * @c watchdogAction doesn't recover the process. If @c maxWatchdogTimeout is specified the
37  * system will be rebooted if the process does not recover.
38  *
39  * Copyright (C) Sierra Wireless Inc.
40  */
41 /**
42  * @file le_wdog_interface.h
43  *
44  * Legato @ref c_wdog include file.
45  *
46  * Copyright (C) Sierra Wireless Inc.
47  */
48 /**
49  * Special values that have specific meaning when used as durations in Timeout():
50  * - @ref LE_WDOG_TIMEOUT_NEVER
51  * - @ref LE_WDOG_TIMEOUT_NOW
52  */
53 
54 #ifndef LE_WDOG_INTERFACE_H_INCLUDE_GUARD
55 #define LE_WDOG_INTERFACE_H_INCLUDE_GUARD
56 
57 
58 #include "legato.h"
59 
60 
61 //--------------------------------------------------------------------------------------------------
62 /**
63  * Type for handler called when a server disconnects.
64  */
65 //--------------------------------------------------------------------------------------------------
66 typedef void (*le_wdog_DisconnectHandler_t)(void *);
67 
68 //--------------------------------------------------------------------------------------------------
69 /**
70  *
71  * Connect the current client thread to the service providing this API. Block until the service is
72  * available.
73  *
74  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
75  * called before any other functions in this API. Normally, ConnectService is automatically called
76  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
77  *
78  * This function is created automatically.
79  */
80 //--------------------------------------------------------------------------------------------------
82 (
83  void
84 );
85 
86 //--------------------------------------------------------------------------------------------------
87 /**
88  *
89  * Try to connect the current client thread to the service providing this API. Return with an error
90  * if the service is not available.
91  *
92  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
93  * called before any other functions in this API. Normally, ConnectService is automatically called
94  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
95  *
96  * This function is created automatically.
97  *
98  * @return
99  * - LE_OK if the client connected successfully to the service.
100  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
101  * bound.
102  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
103  * - LE_COMM_ERROR if the Service Directory cannot be reached.
104  */
105 //--------------------------------------------------------------------------------------------------
107 (
108  void
109 );
110 
111 //--------------------------------------------------------------------------------------------------
112 /**
113  * Set handler called when server disconnection is detected.
114  *
115  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
116  * to continue without exiting, it should call longjmp() from inside the handler.
117  */
118 //--------------------------------------------------------------------------------------------------
120 (
121  le_wdog_DisconnectHandler_t disconnectHandler,
122  void *contextPtr
123 );
124 
125 //--------------------------------------------------------------------------------------------------
126 /**
127  *
128  * Disconnect the current client thread from the service providing this API.
129  *
130  * Normally, this function doesn't need to be called. After this function is called, there's no
131  * longer a connection to the service, and the functions in this API can't be used. For details, see
132  * @ref apiFilesC_client.
133  *
134  * This function is created automatically.
135  */
136 //--------------------------------------------------------------------------------------------------
138 (
139  void
140 );
141 
142 
143 //--------------------------------------------------------------------------------------------------
144 /**
145  * Suspend the watchdog so that it never times out.
146  */
147 //--------------------------------------------------------------------------------------------------
148 #define LE_WDOG_TIMEOUT_NEVER -1
149 
150 //--------------------------------------------------------------------------------------------------
151 /**
152  * Timeout immediately
153  */
154 //--------------------------------------------------------------------------------------------------
155 #define LE_WDOG_TIMEOUT_NOW 0
156 
157 //--------------------------------------------------------------------------------------------------
158 /**
159  * External watchdog kick handler
160  */
161 //--------------------------------------------------------------------------------------------------
163 (
164  void* contextPtr
165  ///<
166 );
167 
168 //--------------------------------------------------------------------------------------------------
169 /**
170  * Kicks the watchdog timer.
171  *
172  * Once the watchdog has been kicked it must be kicked again before the expiration of the current
173  * effective timeout else the configured WatchdogAction will be executed.
174  */
175 //--------------------------------------------------------------------------------------------------
176 void le_wdog_Kick
177 (
178  void
179 );
180 
181 //--------------------------------------------------------------------------------------------------
182 /**
183  * Set a time out.
184  *
185  * The watchdog is kicked and a new effective timeout value is set. The new timeout will be
186  * effective until the next kick at which point it will revert to the original value.
187  */
188 //--------------------------------------------------------------------------------------------------
189 void le_wdog_Timeout
190 (
191  int32_t milliseconds
192  ///< [IN] The number of milliseconds until this timer expires
193 );
194 
195 //--------------------------------------------------------------------------------------------------
196 /**
197  * Get the watchdog timeout configured for this process
198  *
199  * @return
200  * - LE_OK The watchdog timeout is configured and returned
201  * - LE_NOT_FOUND The watchdog timeout is not set
202  */
203 //--------------------------------------------------------------------------------------------------
205 (
206  uint64_t* millisecondsPtr
207  ///< [OUT] The watchdog timeout set for this process
208 );
209 
210 //--------------------------------------------------------------------------------------------------
211 /**
212  * Get the max watchdog timeout configured for this process
213  *
214  * @return
215  * - LE_OK The max watchdog timeout is configured and returned
216  * - LE_NOT_FOUND The max watchdog timeout is not set
217  */
218 //--------------------------------------------------------------------------------------------------
220 (
221  uint64_t* millisecondsPtr
222  ///< [OUT] The max watchdog timeout set for this process
223 );
224 
225 #endif // LE_WDOG_INTERFACE_H_INCLUDE_GUARD
le_result_t le_wdog_GetWatchdogTimeout(uint64_t *millisecondsPtr)
le_result_t
Definition: le_basics.h:35
void(* le_wdog_ExternalWatchdogHandlerFunc_t)(void *contextPtr)
Definition: le_wdog_interface.h:163
void(* le_wdog_DisconnectHandler_t)(void *)
Definition: le_wdog_interface.h:66
void le_wdog_Kick(void)
le_result_t le_wdog_TryConnectService(void)
le_result_t le_wdog_GetMaxWatchdogTimeout(uint64_t *millisecondsPtr)
void le_wdog_Timeout(int32_t milliseconds)
void le_wdog_DisconnectService(void)
void le_wdog_ConnectService(void)
void le_wdog_SetServerDisconnectHandler(le_wdog_DisconnectHandler_t disconnectHandler, void *contextPtr)