Add UID-based APIs:
[platform/core/system/tizen-platform-config.git] / src / tzplatform_config.h
index add6c12..96cb1d8 100644 (file)
@@ -31,7 +31,9 @@ extern "C" {
 #include <sys/types.h>
 #include <tzplatform_variables.h>
 
-/*------------------------------ COMMON API (no context) ---------------*/
+//=================================================================================
+//======================== COMMON APIs (No context) ===============================
+//=================================================================================
 
 /*
  Return the count of variables.
@@ -54,7 +56,9 @@ const char* tzplatform_getname(enum tzplatform_variable id);
 extern
 enum tzplatform_variable tzplatform_getid(const char *name);
 
-/*------------------------------ GLOBAL API (default global context) ----*/
+//=================================================================================
+//====================== GLOBAL APIs (default global context) =====================
+//=================================================================================
 
 /*
  Enforces the removal of the previously evaluated tizen platform variables.
@@ -159,7 +163,7 @@ const char* tzplatform_mkpath(enum tzplatform_variable id, const char *path);
 */
 extern
 const char* tzplatform_mkpath3(enum tzplatform_variable id, const char *path,
-                                                                                                                       const char *path2);
+                               const char *path2);
 
 /*
  Return the string resulting of the path-concatenation of string value of the
@@ -180,7 +184,7 @@ const char* tzplatform_mkpath3(enum tzplatform_variable id, const char *path,
 */
 extern
 const char* tzplatform_mkpath4(enum tzplatform_variable id, const char *path,
-                                                                               const char *path2, const char *path3);
+                               const char *path2, const char *path3);
 
 /*
  Return the uid for a given user name, stored in variable <id>
@@ -210,7 +214,35 @@ uid_t tzplatform_getuid(enum tzplatform_variable id);
 extern
 gid_t tzplatform_getgid(enum tzplatform_variable id);
 
-/*------------------------------ CONTEXTUAL API --------------------------*/
+//=================================================================================
+//============================ UID-based APIs =====================================
+//=================================================================================
+
+/*
+ In the following APIs, a 'uid' parameter is added to the form of GLOBAL APIs.
+
+ How-to-use is the same with GLOBAL APIs, but contexts are internally created and set for each uid.
+
+ uid should be one of root(0), owner(5001), and so on.
+*/
+
+extern
+const char* tzplatform_uid_getenv(uid_t uid, enum tzplatform_variable id);
+
+extern
+const char* tzplatform_uid_mkpath(uid_t uid, enum tzplatform_variable id, const char *path);
+
+extern
+const char* tzplatform_uid_mkpath3(uid_t uid, enum tzplatform_variable id, const char *path,
+                               const char *path2);
+
+extern
+const char* tzplatform_uid_mkpath4(uid_t uid, enum tzplatform_variable id, const char *path,
+                               const char *path2, const char *path3);
+
+//=================================================================================
+//============================ CONTEXTUAL APIs ====================================
+//=================================================================================
 
 struct tzplatform_context;
 
@@ -265,13 +297,15 @@ void tzplatform_context_reset_user(struct tzplatform_context *context);
  Can return NULL in case of internal error or when 'id' isn't defined.
 */
 extern
-const char* tzplatform_context_getenv(struct tzplatform_context *context, enum tzplatform_variable id);
+const char* tzplatform_context_getenv(struct tzplatform_context *context,
+                                       enum tzplatform_variable id);
 
 /*
  Return the integer value of the tizen plaform variable 'id'.
 */
 extern
-int tzplatform_context_getenv_int(struct tzplatform_context *context, enum tzplatform_variable id);
+int tzplatform_context_getenv_int(struct tzplatform_context *context,
+                                       enum tzplatform_variable id);
 
 /*
  Return the string resulting of the concatenation of string value of the
@@ -289,7 +323,8 @@ int tzplatform_context_getenv_int(struct tzplatform_context *context, enum tzpla
        will return "/opt/home-yes"
 */
 extern
-const char* tzplatform_context_mkstr(struct tzplatform_context *context, enum tzplatform_variable id, const char *str);
+const char* tzplatform_context_mkstr(struct tzplatform_context *context,
+                                       enum tzplatform_variable id, const char *str);
 
 /*
  Return the string resulting of the path-concatenation of string value of the
@@ -309,7 +344,8 @@ const char* tzplatform_context_mkstr(struct tzplatform_context *context, enum tz
        will return "/opt/home/yes"
 */
 extern
-const char* tzplatform_context_mkpath(struct tzplatform_context *context, enum tzplatform_variable id, const char *path);
+const char* tzplatform_context_mkpath(struct tzplatform_context *context,
+                                       enum tzplatform_variable id, const char *path);
 
 /*
  Return the string resulting of the path-concatenation of string value of the
@@ -329,8 +365,9 @@ const char* tzplatform_context_mkpath(struct tzplatform_context *context, enum t
        will return "/opt/home/yes/no"
 */
 extern
-const char* tzplatform_context_mkpath3(struct tzplatform_context *context, enum tzplatform_variable id, const char *path,
-                                                                                                                       const char *path2);
+const char* tzplatform_context_mkpath3(struct tzplatform_context *context,
+                                       enum tzplatform_variable id, const char *path,
+                                       const char *path2);
 
 /*
  Return the string resulting of the path-concatenation of string value of the
@@ -350,8 +387,9 @@ const char* tzplatform_context_mkpath3(struct tzplatform_context *context, enum
        will return "/opt/home/yes/no/maybe"
 */
 extern
-const char* tzplatform_context_mkpath4(struct tzplatform_context *context, enum tzplatform_variable id, const char *path,
-                                                                               const char *path2, const char *path3);
+const char* tzplatform_context_mkpath4(struct tzplatform_context *context,
+                                       enum tzplatform_variable id, const char *path,
+                                       const char *path2, const char *path3);
 
 /*
  Return the uid for a given user name, stored in variable <id>