osaf/libs/agents/infrastructure/rda/rda.h | 48 +----------
osaf/libs/agents/infrastructure/rda/rda_papi.cc | 61 +++++++++-----
osaf/libs/core/include/rda_papi.h | 10 +-
osaf/services/infrastructure/rde/Makefile.am | 1 +
osaf/services/infrastructure/rde/include/rde_amf.h | 20 +---
osaf/services/infrastructure/rde/include/rde_cb.h | 37 +++-----
osaf/services/infrastructure/rde/include/rde_rda.h | 8 +-
osaf/services/infrastructure/rde/include/rde_rda_common.h | 10 +-
osaf/services/infrastructure/rde/include/role.h | 18 ++--
osaf/services/infrastructure/rde/rde_amf.cc | 31 +++---
osaf/services/infrastructure/rde/rde_main.cc | 46 +++++-----
osaf/services/infrastructure/rde/rde_mds.cc | 24 ++--
osaf/services/infrastructure/rde/rde_rda.cc | 23 ++--
osaf/services/infrastructure/rde/role.cc | 25 +++--
14 files changed, 162 insertions(+), 200 deletions(-)
The following cpplint warnings have been fixed:
osaf/libs/core/include/rda_papi.h:30: #ifndef header guard has wrong style,
please use: OSAF_LIBS_CORE_INCLUDE_RDA_PAPI_H_ [build/header_guard] [5]
osaf/libs/core/include/rda_papi.h:141: #endif line should be "#endif //
OSAF_LIBS_CORE_INCLUDE_RDA_PAPI_H_" [build/header_guard] [5]
osaf/libs/core/include/rda_papi.h:38: Include the directory when naming .h
files [build/include] [4]
Done processing osaf/libs/core/include/rda_papi.h
osaf/libs/agents/infrastructure/rda/rda.h:30: #ifndef header guard has wrong
style, please use: OSAF_LIBS_AGENTS_INFRASTRUCTURE_RDA_RDA_H_
[build/header_guard] [5]
osaf/libs/agents/infrastructure/rda/rda.h:85: #endif line should be "#endif
// OSAF_LIBS_AGENTS_INFRASTRUCTURE_RDA_RDA_H_" [build/header_guard] [5]
osaf/libs/agents/infrastructure/rda/rda.h:37: Found C system header after C++
system header. Should be: rda.h, c system, c++ system, other.
[build/include_order] [4]
osaf/libs/agents/infrastructure/rda/rda.h:39: Found C system header after C++
system header. Should be: rda.h, c system, c++ system, other.
[build/include_order] [4]
osaf/libs/agents/infrastructure/rda/rda.h:40: Found C system header after C++
system header. Should be: rda.h, c system, c++ system, other.
[build/include_order] [4]
osaf/libs/agents/infrastructure/rda/rda.h:41: Found C system header after C++
system header. Should be: rda.h, c system, c++ system, other.
[build/include_order] [4]
osaf/libs/agents/infrastructure/rda/rda.h:42: Found C system header after C++
system header. Should be: rda.h, c system, c++ system, other.
[build/include_order] [4]
osaf/libs/agents/infrastructure/rda/rda.h:43: Found C system header after C++
system header. Should be: rda.h, c system, c++ system, other.
[build/include_order] [4]
osaf/libs/agents/infrastructure/rda/rda.h:45: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:46: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:48: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:49: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:50: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:51: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:52: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:53: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:54: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:55: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:56: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:57: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:58: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:60: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:61: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:61: "ncssysf_lck.h" already included
at osaf/libs/agents/infrastructure/rda/rda.h:50 [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:62: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:67: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda.h:68: Include the directory when
naming .h files [build/include] [4]
Done processing osaf/libs/agents/infrastructure/rda/rda.h
osaf/libs/agents/infrastructure/rda/rda_papi.cc:35: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda_papi.cc:36: Found C++ system header
after other header. Should be: rda_papi.h, c system, c++ system, other.
[build/include_order] [4]
osaf/libs/agents/infrastructure/rda/rda_papi.cc:37: Found C++ system header
after other header. Should be: rda_papi.h, c system, c++ system, other.
[build/include_order] [4]
osaf/libs/agents/infrastructure/rda/rda_papi.cc:38: Found C system header
after other header. Should be: rda_papi.h, c system, c++ system, other.
[build/include_order] [4]
osaf/libs/agents/infrastructure/rda/rda_papi.cc:39: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda_papi.cc:40: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda_papi.cc:41: Include the directory when
naming .h files [build/include] [4]
osaf/libs/agents/infrastructure/rda/rda_papi.cc:197: Use int16/int64/etc,
rather than the C type long [runtime/int] [4]
osaf/libs/agents/infrastructure/rda/rda_papi.cc:248: Extra space before )
[whitespace/parens] [2]
osaf/libs/agents/infrastructure/rda/rda_papi.cc:248: Using C-style cast. Use
const_cast<char * >(...) instead [readability/casting] [4]
osaf/libs/agents/infrastructure/rda/rda_papi.cc:364: Never use sprintf. Use
snprintf instead. [runtime/printf] [5]
osaf/libs/agents/infrastructure/rda/rda_papi.cc:428: Never use sprintf. Use
snprintf instead. [runtime/printf] [5]
osaf/libs/agents/infrastructure/rda/rda_papi.cc:552: Never use sprintf. Use
snprintf instead. [runtime/printf] [5]
osaf/libs/agents/infrastructure/rda/rda_papi.cc:589: Never use sprintf. Use
snprintf instead. [runtime/printf] [5]
osaf/libs/agents/infrastructure/rda/rda_papi.cc:723: Almost always, snprintf
is better than strcpy [runtime/printf] [4]
Done processing osaf/libs/agents/infrastructure/rda/rda_papi.cc
osaf/services/infrastructure/rde/rde_amf.cc:18: Include the directory when
naming .h files [build/include] [4]
osaf/services/infrastructure/rde/rde_amf.cc:23: Include the directory when
naming .h files [build/include] [4]
osaf/services/infrastructure/rde/rde_amf.cc:24: Include the directory when
naming .h files [build/include] [4]
osaf/services/infrastructure/rde/rde_amf.cc:115: Using C-style cast. Use
reinterpret_cast<char*>(...) instead [readability/casting] [4]
osaf/services/infrastructure/rde/rde_amf.cc:115: Almost always, snprintf is
better than strcpy [runtime/printf] [4]
osaf/services/infrastructure/rde/rde_amf.cc:124: Almost always, snprintf is
better than strcpy [runtime/printf] [4]
osaf/services/infrastructure/rde/rde_amf.cc:126: Almost always, snprintf is
better than strcpy [runtime/printf] [4]
osaf/services/infrastructure/rde/rde_amf.cc:128: Using C-style cast. Use
reinterpret_cast<char*>(...) instead [readability/casting] [4]
osaf/services/infrastructure/rde/rde_amf.cc:128: Almost always, snprintf is
better than strcpy [runtime/printf] [4]
osaf/services/infrastructure/rde/rde_amf.cc:129: Using C-style cast. Use
reinterpret_cast<char*>(...) instead [readability/casting] [4]
osaf/services/infrastructure/rde/rde_amf.cc:178: Using C-style cast. Use
reinterpret_cast<char*>(...) instead [readability/casting] [4]
osaf/services/infrastructure/rde/rde_amf.cc:178: Almost always, snprintf is
better than strcpy [runtime/printf] [4]
osaf/services/infrastructure/rde/rde_amf.cc:188: Using C-style cast. Use
reinterpret_cast<SaNameT*>(...) instead [readability/casting] [4]
Done processing osaf/services/infrastructure/rde/rde_amf.cc
osaf/services/infrastructure/rde/rde_rda.cc:40: Include the directory when
naming .h files [build/include] [4]
osaf/services/infrastructure/rde/rde_rda.cc:41: Include the directory when
naming .h files [build/include] [4]
osaf/services/infrastructure/rde/rde_rda.cc:233: Never use sprintf. Use
snprintf instead. [runtime/printf] [5]
osaf/services/infrastructure/rde/rde_rda.cc:263: Never use sprintf. Use
snprintf instead. [runtime/printf] [5]
osaf/services/infrastructure/rde/rde_rda.cc:300: Never use sprintf. Use
snprintf instead. [runtime/printf] [5]
osaf/services/infrastructure/rde/rde_rda.cc:302: Never use sprintf. Use
snprintf instead. [runtime/printf] [5]
osaf/services/infrastructure/rde/rde_rda.cc:343: Never use sprintf. Use
snprintf instead. [runtime/printf] [5]
osaf/services/infrastructure/rde/rde_rda.cc:495: Line contains only semicolon.
If this should be an empty statement, use {} instead. [whitespace/semicolon]
[5]
osaf/services/infrastructure/rde/rde_rda.cc:499: Redundant blank line at the
end of a code block should be deleted. [whitespace/blank_line] [3]
osaf/services/infrastructure/rde/rde_rda.cc:530: Never use sprintf. Use
snprintf instead. [runtime/printf] [5]
Done processing osaf/services/infrastructure/rde/rde_rda.cc
osaf/services/infrastructure/rde/rde_mds.cc:18: <thread> is an unapproved
C++11 header. [build/c++11] [5]
osaf/services/infrastructure/rde/rde_mds.cc:19: <chrono> is an unapproved
C++11 header. [build/c++11] [5]
osaf/services/infrastructure/rde/rde_mds.cc:20: Found C system header after
C++ system header. Should be: rde_mds.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_mds.cc:21: Found C system header after
C++ system header. Should be: rde_mds.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_mds.cc:22: Found C system header after
C++ system header. Should be: rde_mds.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_mds.cc:24: Found C system header after
C++ system header. Should be: rde_mds.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_mds.cc:117: Using C-style cast. Use
reinterpret_cast<NCS_IPC_MSG*>(...) instead [readability/casting] [4]
osaf/services/infrastructure/rde/rde_mds.cc:150: Using C-style cast. Use
reinterpret_cast<NCS_IPC_MSG*>(...) instead [readability/casting] [4]
osaf/services/infrastructure/rde/rde_mds.cc:209: Complex multi-line
/*...*/-style comment found. Lint may give bogus warnings. Consider replacing
these with //-style comments, with #if 0...#endif, or with more clearly
structured multi-line comments. [readability/multiline_comment] [5]
Done processing osaf/services/infrastructure/rde/rde_mds.cc
osaf/services/infrastructure/rde/rde_main.cc:21: Found C system header after
C++ system header. Should be: rde_main.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_main.cc:22: Found C system header after
C++ system header. Should be: rde_main.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_main.cc:25: Found C system header after
C++ system header. Should be: rde_main.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_main.cc:26: Found C system header after
C++ system header. Should be: rde_main.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_main.cc:27: Found C system header after
C++ system header. Should be: rde_main.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_main.cc:28: Found C system header after
C++ system header. Should be: rde_main.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_main.cc:29: Found C system header after
C++ system header. Should be: rde_main.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_main.cc:30: Found C system header after
C++ system header. Should be: rde_main.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_main.cc:32: Found C system header after
C++ system header. Should be: rde_main.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_main.cc:33: Found C system header after
C++ system header. Should be: rde_main.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_main.cc:34: Found C system header after
C++ system header. Should be: rde_main.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_main.cc:35: Found C system header after
C++ system header. Should be: rde_main.h, c system, c++ system, other.
[build/include_order] [4]
osaf/services/infrastructure/rde/rde_main.cc:36: "nid_api.h" already included
at osaf/services/infrastructure/rde/rde_main.cc:34 [build/include] [4]
osaf/services/infrastructure/rde/rde_main.cc:38: Include the directory when
naming .h files [build/include] [4]
osaf/services/infrastructure/rde/rde_main.cc:39: Include the directory when
naming .h files [build/include] [4]
osaf/services/infrastructure/rde/rde_main.cc:40: Include the directory when
naming .h files [build/include] [4]
osaf/services/infrastructure/rde/rde_main.cc:41: Include the directory when
naming .h files [build/include] [4]
Done processing osaf/services/infrastructure/rde/rde_main.cc
osaf/services/infrastructure/rde/role.cc:21: Include the directory when naming
.h files [build/include] [4]
osaf/services/infrastructure/rde/role.cc:23: <chrono> is an unapproved C++11
header. [build/c++11] [5]
osaf/services/infrastructure/rde/role.cc:24: Include the directory when naming
.h files [build/include] [4]
osaf/services/infrastructure/rde/role.cc:25: Include the directory when naming
.h files [build/include] [4]
osaf/services/infrastructure/rde/role.cc:26: Include the directory when naming
.h files [build/include] [4]
osaf/services/infrastructure/rde/role.cc:30: Include the directory when naming
.h files [build/include] [4]
osaf/services/infrastructure/rde/role.cc:102: Else clause should never be on
same line as else (use 2 lines) [whitespace/newline] [4]
Done processing osaf/services/infrastructure/rde/role.cc
osaf/services/infrastructure/rde/include/rde_cb.h:18: #ifndef header guard has
wrong style, please use: OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_CB_H_
[build/header_guard] [5]
osaf/services/infrastructure/rde/include/rde_cb.h:88: #endif line should be
"#endif // OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_CB_H_"
[build/header_guard] [5]
osaf/services/infrastructure/rde/include/rde_cb.h:24: Include the directory
when naming .h files [build/include] [4]
osaf/services/infrastructure/rde/include/rde_cb.h:25: Include the directory
when naming .h files [build/include] [4]
osaf/services/infrastructure/rde/include/rde_cb.h:26: Include the directory
when naming .h files [build/include] [4]
osaf/services/infrastructure/rde/include/rde_cb.h:27: Include the directory
when naming .h files [build/include] [4]
osaf/services/infrastructure/rde/include/rde_cb.h:28: Include the directory
when naming .h files [build/include] [4]
Done processing osaf/services/infrastructure/rde/include/rde_cb.h
osaf/services/infrastructure/rde/include/rde_rda_common.h:30: #ifndef header
guard has wrong style, please use:
OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_RDA_COMMON_H_
[build/header_guard] [5]
osaf/services/infrastructure/rde/include/rde_rda_common.h:69: #endif line
should be "#endif //
OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_RDA_COMMON_H_"
[build/header_guard] [5]
Done processing osaf/services/infrastructure/rde/include/rde_rda_common.h
osaf/services/infrastructure/rde/include/role.h:18: #ifndef header guard has
wrong style, please use: OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_ROLE_H_
[build/header_guard] [5]
osaf/services/infrastructure/rde/include/role.h:59: #endif line should be
"#endif // OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_ROLE_H_"
[build/header_guard] [5]
osaf/services/infrastructure/rde/include/role.h:23: Include the directory when
naming .h files [build/include] [4]
osaf/services/infrastructure/rde/include/role.h:24: Include the directory when
naming .h files [build/include] [4]
osaf/services/infrastructure/rde/include/role.h:33: "public:" should be
preceded by a blank line [whitespace/blank_line] [3]
Done processing osaf/services/infrastructure/rde/include/role.h
osaf/services/infrastructure/rde/include/rde_amf.h:32: #ifndef header guard
has wrong style, please use:
OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_AMF_H_ [build/header_guard] [5]
osaf/services/infrastructure/rde/include/rde_amf.h:71: #endif line should be
"#endif // OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_AMF_H_"
[build/header_guard] [5]
osaf/services/infrastructure/rde/include/rde_amf.h:43: Include the directory
when naming .h files [build/include] [4]
osaf/services/infrastructure/rde/include/rde_amf.h:52: Missing spaces around =
[whitespace/operators] [4]
osaf/services/infrastructure/rde/include/rde_amf.h:53: Missing spaces around =
[whitespace/operators] [4]
Done processing osaf/services/infrastructure/rde/include/rde_amf.h
osaf/services/infrastructure/rde/include/rde_rda.h:34: #ifndef header guard
has wrong style, please use:
OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_RDA_H_ [build/header_guard] [5]
osaf/services/infrastructure/rde/include/rde_rda.h:104: #endif line should be
"#endif // OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_RDA_H_"
[build/header_guard] [5]
osaf/services/infrastructure/rde/include/rde_rda.h:37: Include the directory
when naming .h files [build/include] [4]
Done processing osaf/services/infrastructure/rde/include/rde_rda.h
diff --git a/osaf/libs/agents/infrastructure/rda/rda.h
b/osaf/libs/agents/infrastructure/rda/rda.h
--- a/osaf/libs/agents/infrastructure/rda/rda.h
+++ b/osaf/libs/agents/infrastructure/rda/rda.h
@@ -27,49 +27,15 @@
******************************************************************************
*/
-#ifndef RDA_H
-#define RDA_H
+#ifndef OSAF_LIBS_AGENTS_INFRASTRUCTURE_RDA_RDA_H_
+#define OSAF_LIBS_AGENTS_INFRASTRUCTURE_RDA_RDA_H_
-/*
- ** includes
- */
-#include <cstdio>
-#include <sys/types.h>
-#include <cstring>
-#include <stdint.h>
-#include <unistd.h>
+#include <sys/socket.h>
#include <sys/un.h>
-#include <sys/socket.h>
-#include <sys/time.h>
+#include <cstdint>
+#include "osaf/libs/core/include/ncsgl_defs.h"
+#include "osaf/libs/core/include/rda_papi.h"
-#include "ncsgl_defs.h"
-#include "ncs_osprm.h"
-
-#include "ncs_svd.h"
-#include "ncs_hdl_pub.h"
-#include "ncssysf_lck.h"
-#include "ncsusrbuf.h"
-#include "ncssysf_def.h"
-#include "ncssysfpool.h"
-#include "ncssysf_tmr.h"
-#include "ncssysf_mem.h"
-#include "ncssysf_ipc.h"
-#include "ncssysf_tsk.h"
-#include "ncspatricia.h"
-
-#include "ncs_queue.h"
-#include "ncssysf_lck.h"
-#include "ncs_main_papi.h"
-
-/*
- **
- */
-#include "rda_papi.h"
-#include "rde_rda_common.h"
-
-/*
- ** Structure declarations
- */
struct RDA_CALLBACK_CB {
NCSCONTEXT task_handle;
bool task_terminate;
@@ -82,4 +48,4 @@ struct RDA_CONTROL_BLOCK {
sockaddr_un sock_address;
};
-#endif /* RDA_H */
+#endif // OSAF_LIBS_AGENTS_INFRASTRUCTURE_RDA_RDA_H_
diff --git a/osaf/libs/agents/infrastructure/rda/rda_papi.cc
b/osaf/libs/agents/infrastructure/rda/rda_papi.cc
--- a/osaf/libs/agents/infrastructure/rda/rda_papi.cc
+++ b/osaf/libs/agents/infrastructure/rda/rda_papi.cc
@@ -15,7 +15,6 @@
*
*/
-#include <configmake.h>
/*****************************************************************************
..............................................................................
@@ -32,18 +31,32 @@
/*
** Includes
*/
-#include "rda.h"
+#include "osaf/libs/core/include/rda_papi.h"
+#include <sched.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
#include <cerrno>
+#include <cstdio>
#include <cstdlib>
-#include <sched.h>
-#include "logtrace.h"
-#include "osaf_poll.h"
-#include "osaf_utility.h"
+#include <cstring>
+#include "osaf/libs/agents/infrastructure/rda/rda.h"
+#include "osaf/libs/core/common/include/logtrace.h"
+#include "osaf/libs/core/common/include/osaf_poll.h"
+#include "osaf/libs/core/common/include/osaf_utility.h"
+#include "osaf/libs/core/cplusplus/base/time.h"
+#include "osaf/libs/core/include/ncs_main_papi.h"
+#include "osaf/libs/core/include/ncsgl_defs.h"
+#include "osaf/libs/core/include/ncssysf_def.h"
+#include "osaf/libs/core/include/ncssysf_tsk.h"
+#include "osaf/libs/core/include/ncssysfpool.h"
+#include "osaf/libs/saf/include/saAmf.h"
+#include "osaf/services/infrastructure/rde/include/rde_rda_common.h"
/*
** Global data
*/
-static void *pcs_rda_callback_cb = NULL;
+static void *pcs_rda_callback_cb = nullptr;
/*
** Static functions
@@ -103,7 +116,7 @@ static PCSRDA_RETURN_CODE rda_callback_t
** Retry if connection with server is lost
*/
if (conn_lost == true) {
- m_NCS_TASK_SLEEP(1000);
+ base::Sleep(base::kOneSecond);
retry_count++;
/*
@@ -189,12 +202,12 @@ static PCSRDA_RETURN_CODE pcs_rda_reg_ca
PCSRDA_RETURN_CODE rc = PCSRDA_RC_SUCCESS;
int sockfd = -1;
bool is_task_spawned = false;
- RDA_CALLBACK_CB *rda_callback_cb = NULL;
+ RDA_CALLBACK_CB *rda_callback_cb = nullptr;
- if (*task_cb != NULL)
+ if (*task_cb != nullptr)
return PCSRDA_RC_CALLBACK_ALREADY_REGD;
- *task_cb = (long) 0;
+ *task_cb = nullptr;
/*
** Connect
@@ -226,7 +239,7 @@ static PCSRDA_RETURN_CODE pcs_rda_reg_ca
*/
rda_callback_cb = static_cast<RDA_CALLBACK_CB*>(malloc(
sizeof(RDA_CALLBACK_CB)));
- if (rda_callback_cb == NULL) {
+ if (rda_callback_cb == nullptr) {
rc = PCSRDA_RC_MEM_ALLOC_FAILED;
break;
}
@@ -244,10 +257,10 @@ static PCSRDA_RETURN_CODE pcs_rda_reg_ca
int policy = SCHED_OTHER; /*root defaults */
int prio_val = sched_get_priority_min(policy);
- if (m_NCS_TASK_CREATE((NCS_OS_CB )rda_callback_task, rda_callback_cb,
- (char * )"OSAF_RDA", prio_val, policy,
- NCS_STACKSIZE_HUGE,
- &rda_callback_cb->task_handle) != NCSCC_RC_SUCCESS) {
+ if (m_NCS_TASK_CREATE(reinterpret_cast<NCS_OS_CB>(rda_callback_task),
+ rda_callback_cb, "OSAF_RDA", prio_val, policy,
+ NCS_STACKSIZE_HUGE, &rda_callback_cb->task_handle)
+ != NCSCC_RC_SUCCESS) {
m_NCS_MEM_FREE(rda_callback_cb, 0, 0, 0);
rc = PCSRDA_RC_TASK_SPAWN_FAILED;
break;
@@ -292,7 +305,7 @@ static PCSRDA_RETURN_CODE pcs_rda_reg_ca
*****************************************************************************/
static PCSRDA_RETURN_CODE pcs_rda_unreg_callback(void *task_cb) {
PCSRDA_RETURN_CODE rc = PCSRDA_RC_SUCCESS;
- RDA_CALLBACK_CB *rda_callback_cb = NULL;
+ RDA_CALLBACK_CB *rda_callback_cb = nullptr;
if (!task_cb)
return rc;
@@ -361,7 +374,7 @@ static PCSRDA_RETURN_CODE pcs_rda_set_ro
/*
** Send set-role request messgae
*/
- sprintf(msg, "%d %d", RDE_RDA_SET_ROLE_REQ, role);
+ snprintf(msg, sizeof(msg), "%d %d", RDE_RDA_SET_ROLE_REQ, role);
rc = rda_write_msg(sockfd, msg);
if (rc != PCSRDA_RC_SUCCESS) {
break;
@@ -425,7 +438,7 @@ static PCSRDA_RETURN_CODE pcs_rda_get_ro
/*
** Send get-role request messgae
*/
- sprintf(msg, "%d", RDE_RDA_GET_ROLE_REQ);
+ snprintf(msg, sizeof(msg), "%d", RDE_RDA_GET_ROLE_REQ);
rc = rda_write_msg(sockfd, msg);
if (rc != PCSRDA_RC_SUCCESS) {
break;
@@ -518,7 +531,7 @@ static PCSRDA_RETURN_CODE rda_connect(in
/*
** Connect to the server.
*/
- if (connect(*sockfd, (struct sockaddr *) &rda_cb->sock_address,
+ if (connect(*sockfd, reinterpret_cast<sockaddr*>(&rda_cb->sock_address),
sizeof(rda_cb->sock_address)) < 0) {
close(*sockfd);
return PCSRDA_RC_IPC_CONNECT_FAILED;
@@ -549,7 +562,7 @@ static PCSRDA_RETURN_CODE rda_disconnect
/*
** Format message
*/
- sprintf(msg, "%d", RDE_RDA_DISCONNECT_REQ);
+ snprintf(msg, sizeof(msg), "%d", RDE_RDA_DISCONNECT_REQ);
if (rda_write_msg(sockfd, msg) != PCSRDA_RC_SUCCESS) {
/* Nothing to do here */
@@ -586,7 +599,7 @@ static PCSRDA_RETURN_CODE rda_callback_r
/*
** Send callback reg request messgae
*/
- sprintf(msg, "%d", RDE_RDA_REG_CB_REQ);
+ snprintf(msg, sizeof(msg), "%d", RDE_RDA_REG_CB_REQ);
PCSRDA_RETURN_CODE rc = rda_write_msg(sockfd, msg);
if (rc != PCSRDA_RC_SUCCESS) {
return rc;
@@ -720,7 +733,7 @@ static PCSRDA_RETURN_CODE rda_parse_msg(
char msg[64] = { 0 };
char *ptr;
- strcpy(msg, pmsg);
+ snprintf(msg, sizeof(msg), "%s", pmsg);
*value = -1;
*cmd_type = RDE_RDA_UNKNOWN;
@@ -728,7 +741,7 @@ static PCSRDA_RETURN_CODE rda_parse_msg(
** Parse the message for cmd type and value
*/
ptr = strchr(msg, ' ');
- if (ptr == NULL) {
+ if (ptr == nullptr) {
*cmd_type = static_cast<RDE_RDA_CMD_TYPE>(atoi(msg));
} else {
*ptr = '\0';
diff --git a/osaf/libs/core/include/rda_papi.h
b/osaf/libs/core/include/rda_papi.h
--- a/osaf/libs/core/include/rda_papi.h
+++ b/osaf/libs/core/include/rda_papi.h
@@ -27,15 +27,15 @@
******************************************************************************
*/
-#ifndef PCS_RDA_PAPI_H
-#define PCS_RDA_PAPI_H
+#ifndef OSAF_LIBS_CORE_INCLUDE_RDA_PAPI_H_
+#define OSAF_LIBS_CORE_INCLUDE_RDA_PAPI_H_
/*
** Includes
*/
#include <stdio.h>
-#include <saAmf.h>
-#include "ncsgl_defs.h" /* uint32_t */
+#include "osaf/libs/core/include/ncsgl_defs.h"
+#include "osaf/libs/saf/include/saAmf.h"
#ifdef __cplusplus
extern "C" {
@@ -138,4 +138,4 @@ extern uint32_t rda_register_callback(ui
}
#endif
-#endif /* PCS_RDA_PAPI_H */
+#endif // OSAF_LIBS_CORE_INCLUDE_RDA_PAPI_H_
diff --git a/osaf/services/infrastructure/rde/Makefile.am
b/osaf/services/infrastructure/rde/Makefile.am
--- a/osaf/services/infrastructure/rde/Makefile.am
+++ b/osaf/services/infrastructure/rde/Makefile.am
@@ -24,6 +24,7 @@ osaf_execbindir = $(pkglibdir)
osaf_execbin_PROGRAMS = osafrded
osafrded_CPPFLAGS = \
+ -DSA_EXTENDED_NAME_SOURCE \
$(AM_CPPFLAGS) \
-I$(top_srcdir)/osaf/services/infrastructure/rde/include
diff --git a/osaf/services/infrastructure/rde/include/rde_amf.h
b/osaf/services/infrastructure/rde/include/rde_amf.h
--- a/osaf/services/infrastructure/rde/include/rde_amf.h
+++ b/osaf/services/infrastructure/rde/include/rde_amf.h
@@ -29,28 +29,22 @@
******************************************************************************
*/
-#ifndef RDE_AMF_H
-#define RDE_AMF_H
+#ifndef OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_AMF_H_
+#define OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_AMF_H_
/*
* Includes
*/
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <cstdarg>
-
-#include "ncs_main_papi.h"
-#include "saAis.h"
-#include "saAmf.h"
+#include <cstdint>
+#include "osaf/libs/saf/include/saAmf.h"
class Role;
/*
* Macro used to get the AMF version used
*/
-#define m_RDE_GET_AMF_VER(amf_ver) amf_ver.releaseCode='B'; \
- amf_ver.majorVersion=0x01; amf_ver.minorVersion=0x00;
+#define m_RDE_GET_AMF_VER(amf_ver) amf_ver.releaseCode = 'B'; \
+ amf_ver.majorVersion = 0x01; amf_ver.minorVersion = 0x00;
/*
* RDE AMF control information
@@ -68,4 +62,4 @@ extern uint32_t rde_amf_init(RDE_AMF_CB
extern SaAisErrorT internal_csi_set_callback(SaInvocationT invocation,
SaAmfHAStateT new_haState);
-#endif
+#endif // OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_AMF_H_
diff --git a/osaf/services/infrastructure/rde/include/rde_cb.h
b/osaf/services/infrastructure/rde/include/rde_cb.h
--- a/osaf/services/infrastructure/rde/include/rde_cb.h
+++ b/osaf/services/infrastructure/rde/include/rde_cb.h
@@ -15,22 +15,16 @@
*
*/
-#ifndef RDE_CB_H
-#define RDE_CB_H
+#ifndef OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_CB_H_
+#define OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_CB_H_
-#include <configmake.h>
-#include <mds_papi.h>
-
-#include "rde_rda_common.h"
-#include "rde_amf.h"
-#include "rde_rda.h"
-#include "rda_papi.h"
-#include "osaf_utility.h"
-
-/* The value to put in the PATH environment variable when calling the
- SC active script */
-#define SC_ACTIVE_PATH_ENV "/usr/local/sbin:/usr/local/bin:/usr/sbin:" \
- "/usr/bin:/sbin:/bin"
+#include <cstdint>
+#include "osaf/libs/core/common/include/osaf_utility.h"
+#include "osaf/libs/core/include/mds_papi.h"
+#include "osaf/libs/core/include/rda_papi.h"
+#include "osaf/services/infrastructure/rde/include/rde_amf.h"
+#include "osaf/services/infrastructure/rde/include/rde_rda.h"
+#include "osaf/services/infrastructure/rde/include/rde_rda_common.h"
/*
** RDE_CONTROL_BLOCK
@@ -41,11 +35,8 @@
struct RDE_CONTROL_BLOCK {
SYSF_MBX mbx;
- const char *prog_name;
NCSCONTEXT task_handle;
bool task_terminate;
- bool fabric_interface;
- uint32_t select_timeout;
RDE_RDA_CB rde_rda_cb;
RDE_AMF_CB rde_amf_cb;
};
@@ -54,7 +45,7 @@ enum RDE_MSG_TYPE {
RDE_MSG_PEER_UP = 1,
RDE_MSG_PEER_DOWN = 2,
RDE_MSG_PEER_INFO_REQ = 3,
- RDE_MSG_PEER_INFO_RESP = 4,
+ RDE_MSG_PEER_INFO_RESP = 4
};
struct rde_peer_info {
@@ -62,12 +53,12 @@ struct rde_peer_info {
};
struct rde_msg {
- struct rde_msg *next;
+ rde_msg *next;
RDE_MSG_TYPE type;
MDS_DEST fr_dest;
NODE_ID fr_node_id;
union {
- struct rde_peer_info peer_info;
+ rde_peer_info peer_info;
} info;
};
@@ -82,7 +73,7 @@ extern const char *rde_msg_name[];
extern RDE_CONTROL_BLOCK *rde_get_control_block();
extern uint32_t rde_mds_register();
extern uint32_t rde_mds_unregister();
-extern uint32_t rde_mds_send(struct rde_msg *msg, MDS_DEST to_dest);
+extern uint32_t rde_mds_send(rde_msg *msg, MDS_DEST to_dest);
extern uint32_t rde_set_role(PCS_RDA_ROLE role);
-#endif /* RDE_CB_H */
+#endif // OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_CB_H_
diff --git a/osaf/services/infrastructure/rde/include/rde_rda.h
b/osaf/services/infrastructure/rde/include/rde_rda.h
--- a/osaf/services/infrastructure/rde/include/rde_rda.h
+++ b/osaf/services/infrastructure/rde/include/rde_rda.h
@@ -31,12 +31,12 @@
******************************************************************************
*/
-#ifndef RDE_RDA_H
-#define RDE_RDA_H
+#ifndef OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_RDA_H_
+#define OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_RDA_H_
-#include "rde_cb.h"
#include <sys/socket.h>
#include <sys/un.h>
+#include <cstdint>
class Role;
@@ -101,4 +101,4 @@ uint32_t rde_rda_client_process_msg(RDE_
int *disconnect);
uint32_t rde_rda_send_role(int role);
-#endif /* RDE_RDA_H */
+#endif // OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_RDA_H_
diff --git a/osaf/services/infrastructure/rde/include/rde_rda_common.h
b/osaf/services/infrastructure/rde/include/rde_rda_common.h
--- a/osaf/services/infrastructure/rde/include/rde_rda_common.h
+++ b/osaf/services/infrastructure/rde/include/rde_rda_common.h
@@ -27,13 +27,13 @@
******************************************************************************
*/
-#ifndef RDE_RDA_COMMON_H
-#define RDE_RDA_COMMON_H
+#ifndef OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_RDA_COMMON_H_
+#define OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_RDA_COMMON_H_
/*
** includes
*/
-#include <configmake.h>
+#include "./configmake.h"
/*
** Return/error codes
@@ -59,11 +59,11 @@ enum RDE_RDA_CMD_TYPE {
RDE_RDA_REG_CB_ACK,
RDE_RDA_REG_CB_NACK,
RDE_RDA_DISCONNECT_REQ,
- RDE_RDA_HA_ROLE,
+ RDE_RDA_HA_ROLE
};
/*
** PDU (Protocol Data Units) for the above
*/
-#endif /* RDE_RDA_COMMON_H */
+#endif // OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_RDE_RDA_COMMON_H_
diff --git a/osaf/services/infrastructure/rde/include/role.h
b/osaf/services/infrastructure/rde/include/role.h
--- a/osaf/services/infrastructure/rde/include/role.h
+++ b/osaf/services/infrastructure/rde/include/role.h
@@ -15,21 +15,20 @@
*
*/
-#ifndef OPENSAF_OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_ROLE_H_
-#define OPENSAF_OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_ROLE_H_
+#ifndef OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_ROLE_H_
+#define OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_ROLE_H_
#include <time.h>
-#include <stdint.h>
-#include "rda_papi.h"
-#include "mds_papi.h"
-#include "base/macros.h"
+#include <cstdint>
+#include "osaf/libs/core/cplusplus/base/macros.h"
+#include "osaf/libs/core/include/mds_papi.h"
+#include "osaf/libs/core/include/rda_papi.h"
namespace base {
class Process;
}
class Role {
- DELETE_COPY_AND_MOVE_OPERATORS(Role);
public:
explicit Role(NODE_ID own_node_id);
void SetPeerState(PCS_RDA_ROLE node_role, NODE_ID node_id);
@@ -54,7 +53,8 @@ class Role {
uint64_t pre_active_script_timeout_;
static const char *const role_names_[];
static const char *const pre_active_script_;
+
+ DELETE_COPY_AND_MOVE_OPERATORS(Role);
};
-#endif /* OPENSAF_OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_ROLE_H_ */
-
+#endif // OSAF_SERVICES_INFRASTRUCTURE_RDE_INCLUDE_ROLE_H_
diff --git a/osaf/services/infrastructure/rde/rde_amf.cc
b/osaf/services/infrastructure/rde/rde_amf.cc
--- a/osaf/services/infrastructure/rde/rde_amf.cc
+++ b/osaf/services/infrastructure/rde/rde_amf.cc
@@ -15,13 +15,12 @@
*
*/
-#include "rde_amf.h"
-
-#include <logtrace.h>
-#include <nid_start_util.h>
-
-#include "rde_cb.h"
-#include "role.h"
+#include "osaf/services/infrastructure/rde/include/rde_amf.h"
+#include "osaf/libs/core/common/include/logtrace.h"
+#include "osaf/libs/core/common/include/nid_start_util.h"
+#include "osaf/libs/saf/include/saAis.h"
+#include "osaf/services/infrastructure/rde/include/rde_cb.h"
+#include "osaf/services/infrastructure/rde/include/role.h"
static RDE_AMF_CB *rde_amf_get_cb() {
RDE_CONTROL_BLOCK *rde_cb = rde_get_control_block();
@@ -112,8 +111,7 @@ static uint32_t rde_amf_healthcheck_star
** Start the AMF health check
*/
memset(&SaCompName, 0, sizeof(SaCompName));
- strcpy((char*) SaCompName.value, rde_amf_cb->comp_name);
- SaCompName.length = strlen(rde_amf_cb->comp_name);
+ saAisNameLend(rde_amf_cb->comp_name, &SaCompName);
memset(&Healthy, 0, sizeof(Healthy));
phlth_ptr = getenv("RDE_HA_ENV_HEALTHCHECK_KEY");
@@ -121,12 +119,13 @@ static uint32_t rde_amf_healthcheck_star
/*
** default health check key
*/
- strcpy(hlth_str, "BAD10");
+ snprintf(hlth_str, sizeof(hlth_str), "%s", "BAD10");
} else {
- strcpy(hlth_str, phlth_ptr);
+ snprintf(hlth_str, sizeof(hlth_str), "%s", phlth_ptr);
}
- strcpy((char*) Healthy.key, hlth_str);
- Healthy.keyLen = strlen((char*) Healthy.key);
+ snprintf(reinterpret_cast<char*>(Healthy.key), sizeof(Healthy.key), "%s",
+ hlth_str);
+ Healthy.keyLen = strlen(reinterpret_cast<char*>(Healthy.key));
amf_error = saAmfHealthcheckStart(rde_amf_cb->amf_hdl, &SaCompName, &Healthy,
SA_AMF_HEALTHCHECK_AMF_INVOKED,
@@ -175,7 +174,8 @@ uint32_t rde_amf_init(RDE_AMF_CB *rde_am
return NCSCC_RC_FAILURE;
}
- strcpy((char*) rde_amf_cb->comp_name, (char*) sname.value);
+ snprintf(rde_amf_cb->comp_name, sizeof(rde_amf_cb->comp_name), "%s",
+ saAisNameBorrow(&sname));
amf_error = saAmfSelectionObjectGet(rde_amf_cb->amf_hdl,
&rde_amf_cb->amf_fd);
@@ -184,8 +184,7 @@ uint32_t rde_amf_init(RDE_AMF_CB *rde_am
return NCSCC_RC_FAILURE;
}
- amf_error = saAmfComponentRegister(rde_amf_cb->amf_hdl, &sname,
- (SaNameT*) nullptr);
+ amf_error = saAmfComponentRegister(rde_amf_cb->amf_hdl, &sname, nullptr);
if (amf_error != SA_AIS_OK) {
LOG_ER("saAmfComponentRegister FAILED %u", amf_error);
return NCSCC_RC_FAILURE;
diff --git a/osaf/services/infrastructure/rde/rde_main.cc
b/osaf/services/infrastructure/rde/rde_main.cc
--- a/osaf/services/infrastructure/rde/rde_main.cc
+++ b/osaf/services/infrastructure/rde/rde_main.cc
@@ -16,29 +16,27 @@
*
*/
-#include <configmake.h>
-#include <cstdlib>
-#include <poll.h>
-#include <libgen.h>
-#include <cstring>
-#include <cerrno>
-#include <unistd.h>
#include <limits.h>
+#include <signal.h>
+#include <sys/resource.h>
+#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-
-#include <logtrace.h>
-#include <mds_papi.h>
-#include <nid_api.h>
-#include <daemon.h>
-#include <nid_api.h>
-
-#include "rde_cb.h"
-#include "osaf_time.h"
-#include "osaf_poll.h"
-#include "role.h"
+#include <syslog.h>
+#include <unistd.h>
+#include <cassert>
+#include <cerrno>
+#include <cstdlib>
+#include <cstring>
+#include "osaf/libs/core/common/include/daemon.h"
+#include "osaf/libs/core/common/include/logtrace.h"
+#include "osaf/libs/core/common/include/osaf_poll.h"
+#include "osaf/libs/core/include/mds_papi.h"
+#include "osaf/libs/core/include/ncs_main_papi.h"
+#include "osaf/libs/core/include/nid_api.h"
+#include "osaf/libs/saf/include/saAmf.h"
+#include "osaf/services/infrastructure/rde/include/rde_cb.h"
+#include "osaf/services/infrastructure/rde/include/role.h"
#define RDA_MAX_CLIENTS 32
@@ -99,7 +97,7 @@ static void handle_mbx_event() {
TRACE_ENTER();
- msg = (struct rde_msg*) ncs_ipc_non_blk_recv(&rde_cb->mbx);
+ msg = reinterpret_cast<rde_msg*>(ncs_ipc_non_blk_recv(&rde_cb->mbx));
TRACE("Received %s from node 0x%x with state %s. My state is %s",
rde_msg_name[msg->type], msg->fr_node_id,
Role::to_string(msg->info.peer_info.ha_role),
@@ -145,7 +143,7 @@ static void CheckForSplitBrain(const rde
PCS_RDA_ROLE own_role = role->role();
PCS_RDA_ROLE other_role = msg->info.peer_info.ha_role;
if (own_role == PCS_RDA_ACTIVE && other_role == PCS_RDA_ACTIVE) {
- opensaf_reboot(0, NULL, "Split-brain detected");
+ opensaf_reboot(0, nullptr, "Split-brain detected");
}
}
@@ -219,7 +217,7 @@ static int initialize_rde() {
int main(int argc, char *argv[]) {
nfds_t nfds = FD_CLIENT_START;
- struct pollfd fds[nfds + RDA_MAX_CLIENTS];
+ pollfd fds[FD_CLIENT_START + RDA_MAX_CLIENTS];
int ret;
NCS_SEL_OBJ mbx_sel_obj;
RDE_RDA_CB *rde_rda_cb = &rde_cb->rde_rda_cb;
@@ -318,7 +316,7 @@ int main(int argc, char *argv[]) {
if (fds[FD_RDA_SERVER].revents & POLLIN) {
int newsockfd;
- newsockfd = accept(rde_rda_cb->fd, (struct sockaddr*) nullptr, nullptr);
+ newsockfd = accept(rde_rda_cb->fd, nullptr, nullptr);
if (newsockfd < 0) {
LOG_ER("accept FAILED %s", strerror(errno));
goto done;
diff --git a/osaf/services/infrastructure/rde/rde_mds.cc
b/osaf/services/infrastructure/rde/rde_mds.cc
--- a/osaf/services/infrastructure/rde/rde_mds.cc
+++ b/osaf/services/infrastructure/rde/rde_mds.cc
@@ -15,13 +15,12 @@
*
*/
-#include <thread>
-#include <chrono>
-#include <logtrace.h>
-#include <mds_papi.h>
-#include <ncsencdec_pub.h>
-
-#include <rde_cb.h>
+#include "osaf/libs/core/common/include/logtrace.h"
+#include "osaf/libs/core/cplusplus/base/time.h"
+#include "osaf/libs/core/include/mds_papi.h"
+#include "osaf/libs/core/include/ncs_main_papi.h"
+#include "osaf/libs/core/include/ncsencdec_pub.h"
+#include "osaf/services/infrastructure/rde/include/rde_cb.h"
#define RDE_MDS_PVT_SUBPART_VERSION 1
@@ -114,7 +113,7 @@ static int mbx_send(RDE_MSG_TYPE type, M
msg->fr_dest = fr_dest;
msg->fr_node_id = fr_node_id;
- if (ncs_ipc_send(&cb->mbx, (NCS_IPC_MSG*) msg,
+ if (ncs_ipc_send(&cb->mbx, reinterpret_cast<NCS_IPC_MSG*>(msg),
NCS_IPC_PRIORITY_HIGH) != NCSCC_RC_SUCCESS) {
LOG_ER("ncs_ipc_send FAILED");
free(msg);
@@ -147,7 +146,8 @@ static uint32_t mds_callback(struct ncsm
msg = (struct rde_msg*) info->info.receive.i_msg;
msg->fr_dest = info->info.receive.i_fr_dest;
msg->fr_node_id = info->info.receive.i_node_id;
- if (ncs_ipc_send(&cb->mbx, (NCS_IPC_MSG*) info->info.receive.i_msg,
+ if (ncs_ipc_send(&cb->mbx,
+
reinterpret_cast<NCS_IPC_MSG*>(info->info.receive.i_msg),
NCS_IPC_PRIORITY_NORMAL) != NCSCC_RC_SUCCESS) {
LOG_ER("ncs_ipc_send FAILED");
free(msg);
@@ -206,8 +206,8 @@ uint32_t rde_mds_register() {
svc_info.i_op = MDS_INSTALL;
svc_info.info.svc_install.i_yr_svc_hdl = 0;
- svc_info.info.svc_install.i_install_scope = NCSMDS_SCOPE_NONE; /* node
- specific */
+ // node specific
+ svc_info.info.svc_install.i_install_scope = NCSMDS_SCOPE_NONE;
svc_info.info.svc_install.i_svc_cb = mds_callback; /* callback */
svc_info.info.svc_install.i_mds_q_ownership = false;
svc_info.info.svc_install.i_mds_svc_pvt_ver = RDE_MDS_PVT_SUBPART_VERSION;
@@ -278,7 +278,7 @@ uint32_t rde_mds_send(struct rde_msg *ms
if (NCSCC_RC_FAILURE == rc) {
LOG_ER("Failed to send %s to %" PRIx64, rde_msg_name[msg->type],
to_dest);
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ base::Sleep(base::kOneHundredMilliseconds);
} else {
break;
}
diff --git a/osaf/services/infrastructure/rde/rde_rda.cc
b/osaf/services/infrastructure/rde/rde_rda.cc
--- a/osaf/services/infrastructure/rde/rde_rda.cc
+++ b/osaf/services/infrastructure/rde/rde_rda.cc
@@ -35,10 +35,10 @@ interface.
******************************************************************************/
-#include <logtrace.h>
-
-#include "rde_cb.h"
-#include "role.h"
+#include "osaf/services/infrastructure/rde/include/rde_rda.h"
+#include "osaf/libs/core/common/include/logtrace.h"
+#include "osaf/services/infrastructure/rde/include/rde_cb.h"
+#include "osaf/services/infrastructure/rde/include/role.h"
/*****************************************************************************
@@ -230,7 +230,7 @@ static uint32_t rde_rda_read_msg(int fd,
/*
** Yes! disconnect client
*/
- sprintf(msg, "%d", RDE_RDA_DISCONNECT_REQ);
+ snprintf(msg, size, "%d", RDE_RDA_DISCONNECT_REQ);
LOG_IN("Connection closed by client (orderly shutdown)");
return NCSCC_RC_SUCCESS;
}
@@ -260,7 +260,7 @@ static uint32_t rde_rda_process_get_role
char msg[64] = { 0 };
TRACE_ENTER();
- sprintf(msg, "%d %d", RDE_RDA_GET_ROLE_RES,
+ snprintf(msg, sizeof(msg), "%d %d", RDE_RDA_GET_ROLE_RES,
static_cast<int>(rde_rda_cb->role->role()));
if (rde_rda_write_msg(rde_rda_cb->clients[index].fd, msg)
!= NCSCC_RC_SUCCESS) {
@@ -297,9 +297,9 @@ static uint32_t rde_rda_process_set_role
if (rde_rda_cb->role->SetRole(
static_cast<PCS_RDA_ROLE>(role)) != NCSCC_RC_SUCCESS)
- sprintf(msg, "%d", RDE_RDA_SET_ROLE_NACK);
+ snprintf(msg, sizeof(msg), "%d", RDE_RDA_SET_ROLE_NACK);
else
- sprintf(msg, "%d", RDE_RDA_SET_ROLE_ACK);
+ snprintf(msg, sizeof(msg), "%d", RDE_RDA_SET_ROLE_ACK);
if (rde_rda_write_msg(rde_rda_cb->clients[index].fd, msg)
!= NCSCC_RC_SUCCESS) {
@@ -340,7 +340,7 @@ static uint32_t rde_rda_process_reg_cb(R
/*
** Format ACK
*/
- sprintf(msg, "%d", RDE_RDA_REG_CB_ACK);
+ snprintf(msg, sizeof(msg), "%d", RDE_RDA_REG_CB_ACK);
if (rde_rda_write_msg(rde_rda_cb->clients[index].fd, msg)
!= NCSCC_RC_SUCCESS) {
@@ -492,11 +492,10 @@ uint32_t rde_rda_client_process_msg(RDE_
*disconnect = 1;
break;
default:
- ;
+ break;
}
return rc;
-
}
/*****************************************************************************
@@ -527,7 +526,7 @@ uint32_t rde_rda_send_role(int role) {
/*
** Send role to all async clients
*/
- sprintf(msg, "%d %d", RDE_RDA_HA_ROLE, role);
+ snprintf(msg, sizeof(msg), "%d %d", RDE_RDA_HA_ROLE, role);
for (index = 0; index < rde_rda_cb->client_count; index++) {
if (!rde_rda_cb->clients[index].is_async)
diff --git a/osaf/services/infrastructure/rde/role.cc
b/osaf/services/infrastructure/rde/role.cc
--- a/osaf/services/infrastructure/rde/role.cc
+++ b/osaf/services/infrastructure/rde/role.cc
@@ -18,16 +18,14 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
-#include "role.h"
-#include <stdint.h>
-#include <chrono>
-#include "configmake.h"
-#include "logtrace.h"
-#include "ncs_main_papi.h"
-#include "base/getenv.h"
-#include "base/process.h"
-#include "base/time.h"
-#include "rde_cb.h"
+#include "osaf/services/infrastructure/rde/include/role.h"
+#include <cstdint>
+#include "osaf/libs/core/common/include/logtrace.h"
+#include "osaf/libs/core/cplusplus/base/getenv.h"
+#include "osaf/libs/core/cplusplus/base/process.h"
+#include "osaf/libs/core/cplusplus/base/time.h"
+#include "osaf/libs/core/include/ncs_main_papi.h"
+#include "osaf/services/infrastructure/rde/include/rde_cb.h"
const char *const Role::role_names_[] = {
"Undefined",
@@ -98,8 +96,11 @@ uint32_t Role::SetRole(PCS_RDA_ROLE new_
LOG_NO("RDE role set to %s", to_string(new_role));
if (new_role == PCS_RDA_ACTIVE) ExecutePreActiveScript();
role_ = new_role;
- if (new_role == PCS_RDA_UNDEFINED) ResetElectionTimer();
- else rde_rda_send_role(new_role);
+ if (new_role == PCS_RDA_UNDEFINED) {
+ ResetElectionTimer();
+ } else {
+ rde_rda_send_role(new_role);
+ }
}
return UpdateMdsRegistration(new_role, old_role);
}
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel