appSmack_interface.h

Go to the documentation of this file.
1 /*
2  * ====================== WARNING ======================
3  *
4  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
5  * DO NOT MODIFY IN ANY WAY.
6  *
7  * ====================== WARNING ======================
8  */
9 
10 /**
11  * @page c_appSmack Application SMACK API
12  *
13  * @ref appSmack_interface.h "API Reference"
14  *
15  * This API provides SMACK (Simplified Mandatory Access Control Kernel) related information about
16  * applications. This API should only be used by the Legato framework.
17  *
18  * <HR>
19  *
20  * Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.
21  */
22 /**
23  * @file appSmack_interface.h
24  *
25  * Legato @ref c_appSmack include file.
26  *
27  * Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.
28  */
29 
30 #ifndef APPSMACK_INTERFACE_H_INCLUDE_GUARD
31 #define APPSMACK_INTERFACE_H_INCLUDE_GUARD
32 
33 
34 #include "legato.h"
35 
36 // Interface specific includes
37 #include "le_limit_interface.h"
38 
39 
40 //--------------------------------------------------------------------------------------------------
41 /**
42  *
43  * Connect the current client thread to the service providing this API. Block until the service is
44  * available.
45  *
46  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
47  * called before any other functions in this API. Normally, ConnectService is automatically called
48  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
49  *
50  * This function is created automatically.
51  */
52 //--------------------------------------------------------------------------------------------------
54 (
55  void
56 );
57 
58 //--------------------------------------------------------------------------------------------------
59 /**
60  *
61  * Try to connect the current client thread to the service providing this API. Return with an error
62  * if the service is not available.
63  *
64  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
65  * called before any other functions in this API. Normally, ConnectService is automatically called
66  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
67  *
68  * This function is created automatically.
69  *
70  * @return
71  * - LE_OK if the client connected successfully to the service.
72  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is bound.
73  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
74  * - LE_COMM_ERROR if the Service Directory cannot be reached.
75  */
76 //--------------------------------------------------------------------------------------------------
78 (
79  void
80 );
81 
82 //--------------------------------------------------------------------------------------------------
83 /**
84  *
85  * Disconnect the current client thread from the service providing this API.
86  *
87  * Normally, this function doesn't need to be called. After this function is called, there's no
88  * longer a connection to the service, and the functions in this API can't be used. For details, see
89  * @ref apiFilesC_client.
90  *
91  * This function is created automatically.
92  */
93 //--------------------------------------------------------------------------------------------------
95 (
96  void
97 );
98 
99 
100 //--------------------------------------------------------------------------------------------------
101 /**
102  * Maximum length of SMACK labels.
103  */
104 //--------------------------------------------------------------------------------------------------
105 #define APPSMACK_MAX_LABEL_LEN 255
106 
107 
108 //--------------------------------------------------------------------------------------------------
109 /**
110  * Access flags.
111  */
112 //--------------------------------------------------------------------------------------------------
113 typedef enum
114 {
115  APPSMACK_ACCESS_FLAG_READ = 0x1,
116  APPSMACK_ACCESS_FLAG_WRITE = 0x2,
117  APPSMACK_ACCESS_FLAG_EXECUTE = 0x4
118 }
120 
121 //--------------------------------------------------------------------------------------------------
122 /**
123  * Gets the application's SMACK label.
124  *
125  * @note
126  * The app doesn't need to be installed for this function to succeed.
127  *
128  * @warning
129  * This function will kill the client if there is an error.
130  */
131 //--------------------------------------------------------------------------------------------------
133 (
134  const char* appName,
135  ///< [IN] Application name
136 
137  char* label,
138  ///< [OUT] SMACK label for the application
139 
140  size_t labelNumElements
141  ///< [IN]
142 );
143 
144 //--------------------------------------------------------------------------------------------------
145 /**
146  * Get's the application's SMACK label with the access mode appended to it as a string. For
147  * example, if the accessMode is ACCESS_FLAG_READ | ACCESS_FLAG_WRITE then "rw" will be appended to
148  * the application's SMACK label. If the accessMode is 0 (empty) then "-" will be appended to the
149  * app's SMACK label.
150  *
151  * @note
152  * The application need not be installed for this function to succeed.
153  *
154  * @warning
155  * This function will kill the client if there is an error.
156  */
157 //--------------------------------------------------------------------------------------------------
159 (
160  const char* appName,
161  ///< [IN] Application name
162 
163  appSmack_AccessFlags_t accessMode,
164  ///< [IN] Access mode flags
165 
166  char* label,
167  ///< [OUT] SMACK label for the application
168 
169  size_t labelNumElements
170  ///< [IN]
171 );
172 
173 
174 #endif // APPSMACK_INTERFACE_H_INCLUDE_GUARD
175 
le_result_t
Definition: le_basics.h:35
le_result_t appSmack_TryConnectService(void)
void appSmack_GetLabel(const char *appName, char *label, size_t labelNumElements)
appSmack_AccessFlags_t
Definition: appSmack_interface.h:113
void appSmack_GetAccessLabel(const char *appName, appSmack_AccessFlags_t accessMode, char *label, size_t labelNumElements)
void appSmack_DisconnectService(void)
void appSmack_ConnectService(void)