le_kernelModule_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_kernelModule Linux Kernel Module API
14  *
15  * @ref le_kernelModule_interface.h "API Reference"
16  *
17  * This API provides a way for applications to manually load and unload modules that were bundled
18  * with their system.
19  *
20  * Module dependencies and running module load scripts are handled automatically. Only the name of
21  * the module in question is required.
22  *
23  * To load a module, call @c le_kernelModule_Load. Unloading is similarly handled by
24  * @c le_kernelModule_Unload
25  *
26  * An example for loading a module:
27  *
28  * @code
29  * le_result_t result = le_kernelModule_Load(moduleName);
30  *
31  * LE_FATAL_IF(result != LE_OK, "Could not load the required module, %s.", moduleName);
32  *
33  * LE_INFO("Module, %s has been loaded.", moduleName);
34  * @endcode
35  *
36  * Copyright (C) Sierra Wireless Inc.
37  */
38 
39 #ifndef LE_KERNELMODULE_INTERFACE_H_INCLUDE_GUARD
40 #define LE_KERNELMODULE_INTERFACE_H_INCLUDE_GUARD
41 
42 
43 #include "legato.h"
44 
45 
46 //--------------------------------------------------------------------------------------------------
47 /**
48  * Type for handler called when a server disconnects.
49  */
50 //--------------------------------------------------------------------------------------------------
51 typedef void (*le_kernelModule_DisconnectHandler_t)(void *);
52 
53 //--------------------------------------------------------------------------------------------------
54 /**
55  *
56  * Connect the current client thread to the service providing this API. Block until the service is
57  * available.
58  *
59  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
60  * called before any other functions in this API. Normally, ConnectService is automatically called
61  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
62  *
63  * This function is created automatically.
64  */
65 //--------------------------------------------------------------------------------------------------
67 (
68  void
69 );
70 
71 //--------------------------------------------------------------------------------------------------
72 /**
73  *
74  * Try to connect the current client thread to the service providing this API. Return with an error
75  * if the service is not available.
76  *
77  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
78  * called before any other functions in this API. Normally, ConnectService is automatically called
79  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
80  *
81  * This function is created automatically.
82  *
83  * @return
84  * - LE_OK if the client connected successfully to the service.
85  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
86  * bound.
87  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
88  * - LE_COMM_ERROR if the Service Directory cannot be reached.
89  */
90 //--------------------------------------------------------------------------------------------------
92 (
93  void
94 );
95 
96 //--------------------------------------------------------------------------------------------------
97 /**
98  * Set handler called when server disconnection is detected.
99  *
100  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
101  * to continue without exiting, it should call longjmp() from inside the handler.
102  */
103 //--------------------------------------------------------------------------------------------------
105 (
106  le_kernelModule_DisconnectHandler_t disconnectHandler,
107  void *contextPtr
108 );
109 
110 //--------------------------------------------------------------------------------------------------
111 /**
112  *
113  * Disconnect the current client thread from the service providing this API.
114  *
115  * Normally, this function doesn't need to be called. After this function is called, there's no
116  * longer a connection to the service, and the functions in this API can't be used. For details, see
117  * @ref apiFilesC_client.
118  *
119  * This function is created automatically.
120  */
121 //--------------------------------------------------------------------------------------------------
123 (
124  void
125 );
126 
127 
128 //--------------------------------------------------------------------------------------------------
129 /**
130  * @file le_kernelModule_interface.h
131  *
132  * Legato @ref c_kernelModule include file.
133  *
134  * Copyright (C) Sierra Wireless Inc.
135  */
136 //--------------------------------------------------------------------------------------------------
137 #define LE_KERNELMODULE_NAME_LEN 60
138 
139 //--------------------------------------------------------------------------------------------------
140 /**
141  */
142 //--------------------------------------------------------------------------------------------------
143 #define LE_KERNELMODULE_NAME_LEN_BYTES 61
144 
145 //--------------------------------------------------------------------------------------------------
146 /**
147  * Load the specified kernel module that was bundled with a Legato system.
148  *
149  * @return
150  * - LE_OK if the module has been successfully loaded into the kernel.
151  * - LE_NOT_FOUND if the named module was not found in the system.
152  * - LE_FAULT if errors were encountered when loading the module, or one of the module's
153  * dependencies.
154  */
155 //--------------------------------------------------------------------------------------------------
157 (
158  const char* LE_NONNULL moduleName
159  ///< [IN] Name of the module to load.
160 );
161 
162 //--------------------------------------------------------------------------------------------------
163 /**
164  * Unload the specified module. The module to be unloaded must be one that was bundled with the
165  * system.
166  *
167  * @return
168  * - LE_OK if the module has been successfully unloaded from the kernel.
169  * - LE_NOT_FOUND if the named module was not found in the system.
170  * - LE_FAULT if errors were encountered during the module, or one of the module's dependencies
171  * unloading.
172  */
173 //--------------------------------------------------------------------------------------------------
175 (
176  const char* LE_NONNULL moduleName
177  ///< [IN] Name of the module to unload.
178 );
179 
180 #endif // LE_KERNELMODULE_INTERFACE_H_INCLUDE_GUARD
le_result_t
Definition: le_basics.h:35
le_result_t le_kernelModule_TryConnectService(void)
le_result_t le_kernelModule_Load(const char *LE_NONNULL moduleName)
void(* le_kernelModule_DisconnectHandler_t)(void *)
Definition: le_kernelModule_interface.h:51
void le_kernelModule_SetServerDisconnectHandler(le_kernelModule_DisconnectHandler_t disconnectHandler, void *contextPtr)
void le_kernelModule_ConnectService(void)
le_result_t le_kernelModule_Unload(const char *LE_NONNULL moduleName)
void le_kernelModule_DisconnectService(void)