From 441c00c027df1ee0fc2f7395ff4135de72b41ae2 Mon Sep 17 00:00:00 2001 From: Zofia Abramowska Date: Tue, 26 Aug 2014 11:33:31 +0200 Subject: [PATCH] Move error codes to different files Change-Id: Ice6a05d3ef76efed19780e3ce785ff7491519a36 --- packaging/cynara.spec | 2 ++ src/admin/api/admin-api.cpp | 1 + src/admin/logic/Logic.cpp | 1 + src/client/api/client-api.cpp | 1 + src/client/cache/CapacityCache.cpp | 1 + src/client/cache/NaiveInterpreter.h | 1 + src/client/cache/PolicyGetter.cpp | 1 + src/include/CMakeLists.txt | 2 ++ src/include/cynara-admin-error.h | 56 +++++++++++++++++++++++++++++++++++++ src/include/cynara-admin.h | 30 -------------------- src/include/cynara-client-error.h | 50 +++++++++++++++++++++++++++++++++ src/include/cynara-client.h | 24 ---------------- 12 files changed, 116 insertions(+), 54 deletions(-) create mode 100644 src/include/cynara-admin-error.h create mode 100644 src/include/cynara-client-error.h diff --git a/packaging/cynara.spec b/packaging/cynara.spec index 5524b9d..a06f5cc 100644 --- a/packaging/cynara.spec +++ b/packaging/cynara.spec @@ -197,6 +197,7 @@ fi %files -n libcynara-client-devel %defattr(-,root,root,-) %{_includedir}/cynara/cynara-client.h +%{_includedir}/cynara/cynara-client-error.h %{_libdir}/pkgconfig/cynara-client.pc %{_libdir}/libcynara-client.so @@ -209,6 +210,7 @@ fi %files -n libcynara-admin-devel %defattr(-,root,root,-) %{_includedir}/cynara/cynara-admin.h +%{_includedir}/cynara/cynara-admin-error.h %{_libdir}/libcynara-admin.so %{_libdir}/pkgconfig/cynara-admin.pc diff --git a/src/admin/api/admin-api.cpp b/src/admin/api/admin-api.cpp index d6e6a12..417baa3 100644 --- a/src/admin/api/admin-api.cpp +++ b/src/admin/api/admin-api.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include diff --git a/src/admin/logic/Logic.cpp b/src/admin/logic/Logic.cpp index 641929d..0934729 100644 --- a/src/admin/logic/Logic.cpp +++ b/src/admin/logic/Logic.cpp @@ -22,6 +22,7 @@ #include +#include #include #include #include diff --git a/src/client/api/client-api.cpp b/src/client/api/client-api.cpp index b6f139f..0371853 100644 --- a/src/client/api/client-api.cpp +++ b/src/client/api/client-api.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include diff --git a/src/client/cache/CapacityCache.cpp b/src/client/cache/CapacityCache.cpp index f5a3df5..a0025b2 100644 --- a/src/client/cache/CapacityCache.cpp +++ b/src/client/cache/CapacityCache.cpp @@ -22,6 +22,7 @@ #include +#include #include #include diff --git a/src/client/cache/NaiveInterpreter.h b/src/client/cache/NaiveInterpreter.h index 9ae333f..9574f2c 100644 --- a/src/client/cache/NaiveInterpreter.h +++ b/src/client/cache/NaiveInterpreter.h @@ -24,6 +24,7 @@ #include #include +#include namespace Cynara { diff --git a/src/client/cache/PolicyGetter.cpp b/src/client/cache/PolicyGetter.cpp index 8bf1a39..f1f2e49 100644 --- a/src/client/cache/PolicyGetter.cpp +++ b/src/client/cache/PolicyGetter.cpp @@ -22,6 +22,7 @@ #include +#include #include #include #include diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt index 5d8ed5a..486f657 100644 --- a/src/include/CMakeLists.txt +++ b/src/include/CMakeLists.txt @@ -18,10 +18,12 @@ INSTALL(FILES ${CYNARA_PATH}/include/cynara-client.h + ${CYNARA_PATH}/include/cynara-client-error.h DESTINATION ${INCLUDE_INSTALL_DIR}/cynara ) INSTALL(FILES ${CYNARA_PATH}/include/cynara-admin.h + ${CYNARA_PATH}/include/cynara-admin-error.h DESTINATION ${INCLUDE_INSTALL_DIR}/cynara ) diff --git a/src/include/cynara-admin-error.h b/src/include/cynara-admin-error.h new file mode 100644 index 0000000..0f5c4d1 --- /dev/null +++ b/src/include/cynara-admin-error.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ +/** + * @file cynara-admin-error.h + * @author Lukasz Wojciechowski + * @author Zofia Abramowska + * @version 1.0 + * @brief This file contains error codes of administration APIs of Cynara. + */ + +#ifndef CYNARA_ADMIN_ERROR_H +#define CYNARA_ADMIN_ERROR_H + +/** + * \name Return Codes + * exported by the foundation API. + * result codes begin with the start error code and extend into negative direction. + * @{ +*/ + +/*! \brief indicating the result of the one specific API is successful or access is allowed */ +#define CYNARA_ADMIN_API_SUCCESS 0 + +/*! \brief indicating client process is running out of memory */ +#define CYNARA_ADMIN_API_OUT_OF_MEMORY -1 + +/*! \brief indicating the API's parameter is malformed */ +#define CYNARA_ADMIN_API_INVALID_PARAM -2 + +/*! \brief service not available (cannot connect to cynara service) */ +#define CYNARA_ADMIN_API_SERVICE_NOT_AVAILABLE -3 + +/*! \brief unexpected error in client library */ +#define CYNARA_ADMIN_API_UNEXPECTED_CLIENT_ERROR -4 + +/*! \brief cynara service does not allow to perform requested operation */ +#define CYNARA_ADMIN_API_OPERATION_NOT_ALLOWED -5 + +/*! \brief cynara service hasn't found requested bucket */ +#define CYNARA_ADMIN_API_BUCKET_NOT_FOUND -6 +/** @}*/ + +#endif // CYNARA_ADMIN_ERROR_H diff --git a/src/include/cynara-admin.h b/src/include/cynara-admin.h index d998eb6..2224140 100644 --- a/src/include/cynara-admin.h +++ b/src/include/cynara-admin.h @@ -20,39 +20,9 @@ * \brief This file contains administration APIs of cynara available with libcynara-admin. */ - #ifndef CYNARA_ADMIN_H #define CYNARA_ADMIN_H -/** - * \name Return Codes - * exported by the foundation API. - * result codes begin with the start error code and extend into negative direction. - * @{ -*/ - -/*! \brief indicating the result of the one specific API is successful or access is allowed */ -#define CYNARA_ADMIN_API_SUCCESS 0 - -/*! \brief indicating client process is running out of memory */ -#define CYNARA_ADMIN_API_OUT_OF_MEMORY -1 - -/*! \brief indicating the API's parameter is malformed */ -#define CYNARA_ADMIN_API_INVALID_PARAM -2 - -/*! \brief service not available (cannot connect to cynara service) */ -#define CYNARA_ADMIN_API_SERVICE_NOT_AVAILABLE -3 - -/*! \brief unexpected error in client library */ -#define CYNARA_ADMIN_API_UNEXPECTED_CLIENT_ERROR -4 - -/*! \brief cynara service does not allow to perform requested operation */ -#define CYNARA_ADMIN_API_OPERATION_NOT_ALLOWED -5 - -/*! \brief cynara service hasn't found requested bucket */ -#define CYNARA_ADMIN_API_BUCKET_NOT_FOUND -6 -/** @}*/ - #ifdef __cplusplus extern "C" { #endif diff --git a/src/include/cynara-client-error.h b/src/include/cynara-client-error.h new file mode 100644 index 0000000..b4746b8 --- /dev/null +++ b/src/include/cynara-client-error.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ +/* + * @file cynara-error.h + * @author Lukasz Wojciechowski + * @author Zofia Abramowska + * @version 1.0 + * @brief This file contains error codes returned by client APIs of Cynara. + */ + +#ifndef CYNARA_ERROR_H +#define CYNARA_ERROR_H + +/** + * \name Return Codes + * exported by the foundation API. + * result codes begin with the start error code and extend into negative direction. + * @{ +*/ + +/*! \brief indicating the result of the one specific API is successful or access is allowed */ +#define CYNARA_API_SUCCESS 0 + +/*! \brief indicating that access that was checked is denied */ +#define CYNARA_API_ACCESS_DENIED -1 + +/*! \brief indicating system is running out of memory state */ +#define CYNARA_API_OUT_OF_MEMORY -2 + +/*! \brief indicating the API's parameter is malformed */ +#define CYNARA_API_INVALID_PARAM -3 + +/*! \brief service not available */ +#define CYNARA_API_SERVICE_NOT_AVAILABLE -4 +/** @}*/ + +#endif // CYNARA_ERROR_H diff --git a/src/include/cynara-client.h b/src/include/cynara-client.h index f984966..2827ff2 100644 --- a/src/include/cynara-client.h +++ b/src/include/cynara-client.h @@ -20,33 +20,9 @@ * @brief This file contains client APIs of Cynara available with libcynara-client. */ - #ifndef CYNARA_CLIENT_H #define CYNARA_CLIENT_H -/** - * \name Return Codes - * exported by the foundation API. - * result codes begin with the start error code and extend into negative direction. - * @{ -*/ - -/*! \brief indicating the result of the one specific API is successful or access is allowed */ -#define CYNARA_API_SUCCESS 0 - -/*! \brief indicating that access that was checked is denied */ -#define CYNARA_API_ACCESS_DENIED -1 - -/*! \brief indicating system is running out of memory state */ -#define CYNARA_API_OUT_OF_MEMORY -2 - -/*! \brief indicating the API's parameter is malformed */ -#define CYNARA_API_INVALID_PARAM -3 - -/*! \brief service not available */ -#define CYNARA_API_SERVICE_NOT_AVAILABLE -4 -/** @}*/ - #ifdef __cplusplus extern "C" { #endif -- 2.7.4