Fix build issue when uid_t type is not use
[platform/core/system/tizen-platform-wrapper.git] / src / tzplatform_config.h
1 /*
2  * Copyright (C) 2013 Intel Corporation.
3  * 
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17  *
18  * Authors:
19  *   José Bollo <jose.bollo@open.eurogiciel.org>
20  *   Stéphane Desneux <stephane.desneux@open.eurogiciel.org>
21  *   Jean-Benoit Martin <jean-benoit.martin@open.eurogiciel.org>
22  *
23  */
24 #ifndef LIBTIZEN_PLATFORM_WRAPPER
25 #define LIBTIZEN_PLATFORM_WRAPPER
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #include <sys/types.h>
32 #include <tzplatform_variables.h>
33
34 /*
35  Enforces the removal of the previously evaluated tizen platform variables.
36
37  Call this function in case of changing of user inside the application.
38 */
39 extern
40 void tzplatform_reset();
41
42 /*
43  Return the count of variables.
44 */
45 extern
46 int tzplatform_getcount();
47
48 /*
49  Return the name of the variable 'id' as a string.
50  Return NULL if 'id' is invalid.
51 */
52 extern
53 const char* tzplatform_getname(enum tzplatform_variable id);
54
55 /*
56  Return the id of the variable of 'name'.
57  Return _TZPLATFORM_VARIABLES_INVALID_ if 'name' doesn't match a 
58  valid variable name.
59 */
60 extern
61 enum tzplatform_variable tzplatform_getid(const char *name);
62
63 /*
64  Return the read-only string value of the tizen plaform variable 'id'.
65  The tizen global values are globals to the application.
66  Can return NULL in case of internal error or when 'id' isn't defined.
67 */
68 extern
69 const char* tzplatform_getenv(enum tzplatform_variable id);
70
71 /*
72  Return the integer value of the tizen plaform variable 'id'.
73 */
74 extern
75 int tzplatform_getenv_int(enum tzplatform_variable id);
76
77 /*
78  Return the string resulting of the concatenation of string value of the 
79  tizen plaform variable 'id' and the given string 'str'.
80
81  The returned value is a scratch buffer (unique for the thread) that is
82  available until the next call to 'tzplatform_mkstr', 'tzplatform_mkpath', 
83  'tzplatform_mkpath3' or 'tzplatform_mkpath4'.
84
85  Can return NULL in case of internal error.
86
87  Example:
88     if TZ_SYS_HOME == "/opt/home" then calling
89
90        tzplatform_mkstr(TZ_SYS_HOME,"-yes") 
91
92     will return "/opt/home-yes"
93 */
94 extern
95 const char* tzplatform_mkstr(enum tzplatform_variable id, const char *str);
96
97 /*
98  Return the string resulting of the path-concatenation of string value of the 
99  tizen plaform variable 'id' and the given string 'path'.
100
101  path-concatenation is the concatenation taking care of / characters.
102
103  The returned value is a scratch buffer (unique for the thread) that is
104  available until the next call to 'tzplatform_mkstr', 'tzplatform_mkpath', 
105  'tzplatform_mkpath3' or 'tzplatform_mkpath4'.
106
107  Can return NULL in case of internal error.
108
109  Example:
110     if TZ_SYS_HOME == "/opt/home" then calling
111
112        tzplatform_mkpath(TZ_SYS_HOME,"yes") 
113
114     will return "/opt/home/yes"
115 */
116 extern
117 const char* tzplatform_mkpath(enum tzplatform_variable id, const char *path);
118
119 /*
120  Return the string resulting of the path-concatenation of string value of the 
121  tizen plaform variable 'id' and the given strings 'path' and 'path2'.
122
123  path-concatenation is the concatenation taking care of / characters.
124
125  The returned value is a scratch buffer (unique for the thread) that is
126  available until the next call to 'tzplatform_mkstr', 'tzplatform_mkpath', 
127  'tzplatform_mkpath3' or 'tzplatform_mkpath4'.
128
129  Can return NULL in case of internal error.
130
131  Example:
132     if TZ_SYS_HOME == "/opt/home" then calling
133
134        tzplatform_mkpath3(TZ_SYS_HOME,"yes","no")
135
136     will return "/opt/home/yes/no"
137 */
138 extern
139 const char* tzplatform_mkpath3(enum tzplatform_variable id, const char *path, 
140                                                             const char *path2);
141
142 /*
143  Return the string resulting of the path-concatenation of string value of the 
144  tizen plaform variable 'id' and the given strings 'path', 'path2' and 'path3'.
145
146  path-concatenation is the concatenation taking care of / characters.
147
148  The returned value is a scratch buffer (unique for the thread) that is
149  available until the next call to 'tzplatform_mkstr', 'tzplatform_mkpath', 
150  'tzplatform_mkpath3' or 'tzplatform_mkpath4'.
151
152  Can return NULL in case of internal error.
153
154  Example:
155     if TZ_SYS_HOME == "/opt/home" then calling
156
157        tzplatform_mkpath4(TZ_SYS_HOME,"yes","no","/maybe")
158
159     will return "/opt/home/yes/no/maybe"
160 */
161 extern
162 const char* tzplatform_mkpath4(enum tzplatform_variable id, const char *path, 
163                                         const char *path2, const char *path3);
164
165 /*
166  Return the uid for a given user name, stored in variable <id>
167  Retun -1 in case of error.
168
169  Example:
170         if TZ_USER_NAME=="app" then calling:
171            
172            tzplatform_getuid(TZ_USER_NAME)
173         
174         will return the uid of the user 'app'
175 */
176 extern
177 uid_t tzplatform_getuid(enum tzplatform_variable id);
178
179 /*
180  Return the gid for a given group name, stored in variable <id>
181  Retun -1 in case of error.
182
183  Example:
184         if TZ_USER_GROUP=="app" then calling:
185            
186            tzplatform_getuid(TZ_USER_GROUP)
187         
188         will return the gid of the group 'app'
189 */
190 extern
191 gid_t tzplatform_getgid(enum tzplatform_variable id);
192
193 #ifdef __cplusplus
194 }
195 #endif
196
197 #endif // _LIBTIZEN-PLATFORM-WRAPPER