2 * Copyright (C) 2013 Intel Corporation.
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.
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.
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
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>
24 #ifndef LIBTIZEN_PLATFORM_WRAPPER
25 #define LIBTIZEN_PLATFORM_WRAPPER
31 #include <sys/types.h>
32 #include <tzplatform_variables.h>
35 Enforces the removal of the previously evaluated tizen platform variables.
37 Call this function in case of changing of user inside the application.
40 void tzplatform_reset();
43 Return the count of variables.
46 int tzplatform_getcount();
49 Return the name of the variable 'id' as a string.
50 Return NULL if 'id' is invalid.
53 const char* tzplatform_getname(enum tzplatform_variable id);
56 Return the id of the variable of 'name'.
57 Return _TZPLATFORM_VARIABLES_INVALID_ if 'name' doesn't match a
61 enum tzplatform_variable tzplatform_getid(const char *name);
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.
69 const char* tzplatform_getenv(enum tzplatform_variable id);
72 Return the integer value of the tizen plaform variable 'id'.
75 int tzplatform_getenv_int(enum tzplatform_variable id);
78 Return the string resulting of the concatenation of string value of the
79 tizen plaform variable 'id' and the given string 'str'.
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'.
85 Can return NULL in case of internal error.
88 if TZ_SYS_HOME == "/opt/home" then calling
90 tzplatform_mkstr(TZ_SYS_HOME,"-yes")
92 will return "/opt/home-yes"
95 const char* tzplatform_mkstr(enum tzplatform_variable id, const char *str);
98 Return the string resulting of the path-concatenation of string value of the
99 tizen plaform variable 'id' and the given string 'path'.
101 path-concatenation is the concatenation taking care of / characters.
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'.
107 Can return NULL in case of internal error.
110 if TZ_SYS_HOME == "/opt/home" then calling
112 tzplatform_mkpath(TZ_SYS_HOME,"yes")
114 will return "/opt/home/yes"
117 const char* tzplatform_mkpath(enum tzplatform_variable id, const char *path);
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'.
123 path-concatenation is the concatenation taking care of / characters.
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'.
129 Can return NULL in case of internal error.
132 if TZ_SYS_HOME == "/opt/home" then calling
134 tzplatform_mkpath3(TZ_SYS_HOME,"yes","no")
136 will return "/opt/home/yes/no"
139 const char* tzplatform_mkpath3(enum tzplatform_variable id, const char *path,
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'.
146 path-concatenation is the concatenation taking care of / characters.
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'.
152 Can return NULL in case of internal error.
155 if TZ_SYS_HOME == "/opt/home" then calling
157 tzplatform_mkpath4(TZ_SYS_HOME,"yes","no","/maybe")
159 will return "/opt/home/yes/no/maybe"
162 const char* tzplatform_mkpath4(enum tzplatform_variable id, const char *path,
163 const char *path2, const char *path3);
166 Return the uid for a given user name, stored in variable <id>
167 Retun -1 in case of error.
170 if TZ_USER_NAME=="app" then calling:
172 tzplatform_getuid(TZ_USER_NAME)
174 will return the uid of the user 'app'
177 uid_t tzplatform_getuid(enum tzplatform_variable id);
180 Return the gid for a given group name, stored in variable <id>
181 Retun -1 in case of error.
184 if TZ_USER_GROUP=="app" then calling:
186 tzplatform_getuid(TZ_USER_GROUP)
188 will return the gid of the group 'app'
191 gid_t tzplatform_getgid(enum tzplatform_variable id);
197 #endif // _LIBTIZEN-PLATFORM-WRAPPER