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 <tzplatform_variables.h>
34 Enforces the removal of the previously evaluated tizen platform variables.
36 Call this function in case of changing of user inside the application.
39 void tzplatform_reset();
42 Return the count of variables.
45 int tzplatform_getcount();
48 Return the name of the variable 'id' as a string.
49 Return NULL if 'id' is invalid.
52 const char* tzplatform_getname(enum tzplatform_variable id);
55 Return the id of the variable of 'name'.
56 Return _TZPLATFORM_VARIABLES_INVALID_ if 'name' doesn't match a
60 enum tzplatform_variable tzplatform_getid(const char *name);
63 Return the read-only string value of the tizen plaform variable 'id'.
64 The tizen global values are globals to the application.
65 Can return NULL in case of internal error or when 'id' isn't defined.
68 const char* tzplatform_getenv(enum tzplatform_variable id);
71 Return the integer value of the tizen plaform variable 'id'.
74 int tzplatform_getenv_int(enum tzplatform_variable id);
77 Return the string resulting of the concatenation of string value of the
78 tizen plaform variable 'id' and the given string 'str'.
80 The returned value is a scratch buffer (unique for the thread) that is
81 available until the next call to 'tzplatform_mkstr', 'tzplatform_mkpath', or,
84 Can return NULL in case of internal error.
87 if TZ_SYS_HOME == "/opt/home" then calling
89 tzplatform_mkstr(TZ_SYS_HOME,"-yes")
91 will return "/opt/home-yes"
94 const char* tzplatform_mkstr(enum tzplatform_variable id, const char * str);
97 Return the string resulting of the path-concatenation of string value of the
98 tizen plaform variable 'id' and the given string 'path'.
100 path-concatenation is the concatenation taking care of / characters.
102 The returned value is a scratch buffer (unique for the thread) that is
103 available until the next call to 'tzplatform_mkstr', 'tzplatform_mkpath', or,
104 'tzplatform_mkpath3'.
106 Can return NULL in case of internal error.
109 if TZ_SYS_HOME == "/opt/home" then calling
111 tzplatform_mkpath(TZ_SYS_HOME,"yes")
113 will return "/opt/home/yes"
116 const char* tzplatform_mkpath(enum tzplatform_variable id, const char * path);
119 Return the string resulting of the path-concatenation of string value of the
120 tizen plaform variable 'id' and the given strings 'path' and 'path2'.
122 path-concatenation is the concatenation taking care of / characters.
124 The returned value is a scratch buffer (unique for the thread) that is
125 available until the next call to 'tzplatform_mkstr', 'tzplatform_mkpath', or,
126 'tzplatform_mkpath3'.
128 Can return NULL in case of internal error.
131 if TZ_SYS_HOME == "/opt/home" then calling
133 tzplatform_mkpath3(TZ_SYS_HOME,"yes","no")
135 will return "/opt/home/yes/no"
138 const char* tzplatform_mkpath3(enum tzplatform_variable id, const char * path,
142 Return the uid for a given user name, stored in variable <id>
143 Retun -1 in case of error.
146 if TZ_USER_NAME=="app" then calling:
148 tzplatform_getuid(TZ_USER_NAME)
150 will return the uid of the user 'app'
153 uid_t tzplatform_getuid(enum tzplatform_variable id);
156 Return the gid for a given group name, stored in variable <id>
157 Retun -1 in case of error.
160 if TZ_USER_GROUP=="app" then calling:
162 tzplatform_getuid(TZ_USER_GROUP)
164 will return the gid of the group 'app'
167 gid_t tzplatform_getgid(enum tzplatform_variable id);
173 #endif // _LIBTIZEN-PLATFORM-WRAPPER