Change client API error codes 17/28517/1
authorZofia Abramowska <z.abramowska@samsung.com>
Wed, 8 Oct 2014 15:14:01 +0000 (17:14 +0200)
committerZofia Abramowska <z.abramowska@samsung.com>
Wed, 8 Oct 2014 15:22:03 +0000 (17:22 +0200)
Add CYNARA_API_ACCESS_ALLOWED to be returned instead of CYNARA_API_SUCCESS
from cynara check call.
Renumber client API error codes - now CYNARA_API_ACCESS_DENIED is treated
as answer, not as error.

Change-Id: I3d64afdc3cc241de8515be507858304efd729da6

src/client-common/plugins/NaiveInterpreter.h
src/include/cynara-client-error.h
src/include/cynara-client.h

index e16f463..a541e19 100644 (file)
@@ -37,7 +37,7 @@ class NaiveInterpreter : public InterpreterInterface {
     }
     int toResult(const PolicyResult &result) noexcept {
         if (result.policyType() == PredefinedPolicyType::ALLOW)
-            return CYNARA_API_SUCCESS;
+            return CYNARA_API_ACCESS_ALLOWED;
         else
             return CYNARA_API_ACCESS_DENIED;
     }
index 36d20f4..9828942 100644 (file)
 /**
  * \name Return Codes
  * exported by the foundation API.
- * result codes begin with the start error code and extend into negative direction.
+ * result codes beginning with negative codes indicate an error.
  * @{
 */
 
-/*! \brief   indicating the result of the one specific API is successful or access is allowed */
-#define CYNARA_API_SUCCESS 0
+/*! \brief   indicating access that was checked is allowed */
+#define CYNARA_API_ACCESS_ALLOWED         2
 
 /*! \brief   indicating that access that was checked is denied */
-#define CYNARA_API_ACCESS_DENIED -1
+#define CYNARA_API_ACCESS_DENIED          1
+
+/*! \brief   indicating the result of the one specific API is successful */
+#define CYNARA_API_SUCCESS                0
 
 /*! \brief   indicating system is running out of memory state */
-#define CYNARA_API_OUT_OF_MEMORY -2
+#define CYNARA_API_OUT_OF_MEMORY         -1
 
 /*! \brief   indicating the API's parameter is malformed */
-#define CYNARA_API_INVALID_PARAM -3
+#define CYNARA_API_INVALID_PARAM         -2
 
 /*! \brief   service not available */
-#define CYNARA_API_SERVICE_NOT_AVAILABLE -4
+#define CYNARA_API_SERVICE_NOT_AVAILABLE -3
 
 /*! \brief   indicating that value is not present in cache */
-#define CYNARA_API_CACHE_MISS -5
+#define CYNARA_API_CACHE_MISS            -4
 
 /*! \brief   indicating that provided method is not supported by library */
-#define CYNARA_API_METHOD_NOT_SUPPORTED -6
+#define CYNARA_API_METHOD_NOT_SUPPORTED  -5
 
 /*! \brief   indicating an unknown error */
-#define CYNARA_API_UNKNOWN_ERROR -7
+#define CYNARA_API_UNKNOWN_ERROR         -6
 /** @}*/
 
 #endif // CYNARA_CLIENT_ERROR_H
index dcdab40..3f4c938 100644 (file)
@@ -133,7 +133,7 @@ int cynara_finish(cynara *p_cynara);
  * \param[in] user User running client.
  * \param[in] privilege Privilege that is a subject of a check..
  *
- * \return CYNARA_API_SUCCESS on success (access granted), CYNARA_API_ACCESS_DENIED on access denial
+ * \return CYNARA_API_ACCESS_ALLOWED on access allowed, CYNARA_API_ACCESS_DENIED on access denial
  * or other error code on error.
  */
 int cynara_check(cynara *p_cynara, const char *client, const char *client_session, const char *user,