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 an allocated unique string that MUST not be freed.
83 Can return NULL in case of internal error.
86 if TZ_SYS_HOME == "/opt/home" then calling
88 tzplatform_mkstr(TZ_SYS_HOME,"-yes")
90 will return "/opt/home-yes"
93 const char* tzplatform_mkstr(enum tzplatform_variable id, const char *str);
96 Return the string resulting of the path-concatenation of string value of the
97 tizen plaform variable 'id' and the given string 'path'.
99 path-concatenation is the concatenation taking care of / characters.
101 The returned value is an allocated unique string that MUST not be freed.
103 Can return NULL in case of internal error.
106 if TZ_SYS_HOME == "/opt/home" then calling
108 tzplatform_mkpath(TZ_SYS_HOME,"yes")
110 will return "/opt/home/yes"
113 const char* tzplatform_mkpath(enum tzplatform_variable id, const char *path);
116 Return the string resulting of the path-concatenation of string value of the
117 tizen plaform variable 'id' and the given strings 'path' and 'path2'.
119 path-concatenation is the concatenation taking care of / characters.
121 The returned value is an allocated unique string that MUST not be freed.
123 Can return NULL in case of internal error.
126 if TZ_SYS_HOME == "/opt/home" then calling
128 tzplatform_mkpath3(TZ_SYS_HOME,"yes","no")
130 will return "/opt/home/yes/no"
133 const char* tzplatform_mkpath3(enum tzplatform_variable id, const char *path,
137 Return the string resulting of the path-concatenation of string value of the
138 tizen plaform variable 'id' and the given strings 'path', 'path2' and 'path3'.
140 path-concatenation is the concatenation taking care of / characters.
142 The returned value is an allocated unique string that MUST not be freed.
144 Can return NULL in case of internal error.
147 if TZ_SYS_HOME == "/opt/home" then calling
149 tzplatform_mkpath4(TZ_SYS_HOME,"yes","no","/maybe")
151 will return "/opt/home/yes/no/maybe"
154 const char* tzplatform_mkpath4(enum tzplatform_variable id, const char *path,
155 const char *path2, const char *path3);
158 Return the uid for a given user name, stored in variable <id>
159 Retun -1 in case of error.
162 if TZ_USER_NAME=="app" then calling:
164 tzplatform_getuid(TZ_USER_NAME)
166 will return the uid of the user 'app'
169 uid_t tzplatform_getuid(enum tzplatform_variable id);
172 Return the gid for a given group name, stored in variable <id>
173 Retun -1 in case of error.
176 if TZ_USER_GROUP=="app" then calling:
178 tzplatform_getuid(TZ_USER_GROUP)
180 will return the gid of the group 'app'
183 gid_t tzplatform_getgid(enum tzplatform_variable id);
189 #endif // _LIBTIZEN-PLATFORM-WRAPPER