mirror of
https://github.com/outbackdingo/parodus.git
synced 2026-01-28 02:20:02 +00:00
Compare commits
7 Commits
master
...
6.0_p11xle
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27ba50a2f6 | ||
|
|
c04ed33b20 | ||
|
|
47b0e335ae | ||
|
|
f872fdcc44 | ||
|
|
0da6e73c90 | ||
|
|
7c56dbb3f6 | ||
|
|
6952647ce3 |
@@ -47,7 +47,6 @@ if (ENABLE_WEBCFGBIN)
|
||||
include_directories(${INCLUDE_DIR}/rbus)
|
||||
endif (ENABLE_WEBCFGBIN)
|
||||
|
||||
|
||||
# Get git commit hash
|
||||
#-------------------------------------------------------------------------------
|
||||
execute_process(
|
||||
@@ -64,18 +63,9 @@ add_definitions("-DGIT_COMMIT_TAG=\"${GIT_COMMIT_TAG}\"")
|
||||
add_definitions(-std=c99)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE -DNOPOLL_LOGGER ")
|
||||
|
||||
if (DEVICE_CAMERA)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=all -Wno-missing-field-initializers")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=all")
|
||||
add_definitions(-DDEVICE_CAMERA)
|
||||
else ()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=all -Wno-missing-field-initializers")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=all")
|
||||
endif (DEVICE_CAMERA)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wall -Wno-missing-field-initializers")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall")
|
||||
|
||||
if (INCLUDE_BREAKPAD)
|
||||
add_definitions(-DINCLUDE_BREAKPAD)
|
||||
endif (INCLUDE_BREAKPAD)
|
||||
|
||||
# pthread external dependency
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
@@ -164,7 +164,6 @@ void timespec_diff(struct timespec *start, struct timespec *stop,
|
||||
#ifdef ENABLE_WEBCFGBIN
|
||||
void subscribeRBUSevent();
|
||||
int regXmidtSendDataMethod();
|
||||
void registerRbusLogger();
|
||||
#endif
|
||||
#ifdef WAN_FAILOVER_SUPPORTED
|
||||
void setWebpaInterface(char *value);
|
||||
|
||||
@@ -223,14 +223,8 @@ void getAuthToken(ParodusCfg *cfg)
|
||||
* @param[in] nmemb size of delivered data
|
||||
* @param[out] data curl response data saved.
|
||||
*/
|
||||
#ifndef DEVICE_CAMERA
|
||||
size_t write_callback_fn(void *buffer, size_t size, size_t nmemb, struct token_data *data)
|
||||
{
|
||||
#else
|
||||
size_t write_callback_fn(void *buffer, size_t size, size_t nmemb, void *datain)
|
||||
{
|
||||
struct token_data *data = (struct token_data*) datain;
|
||||
#endif //DEVICE_CAMERA
|
||||
ParodusCfg *cfg;
|
||||
size_t max_data_size = sizeof (cfg->webpa_auth_token);
|
||||
size_t index = data->size;
|
||||
|
||||
@@ -47,11 +47,7 @@ struct token_data {
|
||||
|
||||
int requestNewAuthToken(char *newToken, size_t len, int r_count);
|
||||
void getAuthToken(ParodusCfg *cfg);
|
||||
#ifndef DEVICE_CAMERA
|
||||
size_t write_callback_fn(void *buffer, size_t size, size_t nmemb, struct token_data *data);
|
||||
#else
|
||||
size_t write_callback_fn(void *buffer, size_t size, size_t nmemb, void *data);
|
||||
#endif
|
||||
char* generate_trans_uuid();
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
47
src/config.c
47
src/config.c
@@ -711,53 +711,6 @@ int parseCommandLine(int argc,char **argv,ParodusCfg * cfg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void free_cfg(ParodusCfg *cfg)
|
||||
{
|
||||
if(cfg != NULL)
|
||||
{
|
||||
if (cfg->mtls_client_cert_path != NULL )
|
||||
{
|
||||
free(cfg->mtls_client_cert_path);
|
||||
cfg->mtls_client_cert_path = NULL;
|
||||
}
|
||||
if(cfg->connection_health_file != NULL)
|
||||
{
|
||||
free(cfg->connection_health_file);
|
||||
cfg->connection_health_file = NULL;
|
||||
}
|
||||
if(cfg->token_server_url != NULL)
|
||||
{
|
||||
free(cfg->token_server_url );
|
||||
cfg->token_server_url = NULL;
|
||||
}
|
||||
if(cfg->mtls_client_key_path != NULL)
|
||||
{
|
||||
free(cfg->mtls_client_key_path);
|
||||
cfg->mtls_client_key_path = NULL;
|
||||
}
|
||||
if(cfg->client_cert_path != NULL)
|
||||
{
|
||||
free(cfg->client_cert_path);
|
||||
cfg->client_cert_path = NULL;
|
||||
}
|
||||
if(cfg->crud_config_file != NULL)
|
||||
{
|
||||
free(cfg->crud_config_file);
|
||||
cfg->crud_config_file = NULL;
|
||||
}
|
||||
if(cfg->close_reason_file != NULL)
|
||||
{
|
||||
free(cfg->close_reason_file);
|
||||
cfg->close_reason_file = NULL;
|
||||
}
|
||||
if(cfg->cloud_disconnect != NULL)
|
||||
{
|
||||
free(cfg->cloud_disconnect);
|
||||
cfg->cloud_disconnect = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setDefaultValuesToCfg(ParodusCfg *cfg)
|
||||
{
|
||||
if(cfg == NULL)
|
||||
|
||||
@@ -135,7 +135,7 @@ void loadParodusCfg(ParodusCfg * config,ParodusCfg *cfg);
|
||||
* or -1 if error
|
||||
*/
|
||||
int parseCommandLine(int argc,char **argv,ParodusCfg * cfg);
|
||||
void free_cfg(ParodusCfg *cfg);
|
||||
|
||||
void setDefaultValuesToCfg(ParodusCfg *cfg);
|
||||
// Accessor for the global config structure.
|
||||
ParodusCfg *get_parodus_cfg(void);
|
||||
|
||||
@@ -231,9 +231,6 @@ void createSocketConnection(void (* initKeypress)())
|
||||
nopoll_ctx_unref(ctx);
|
||||
nopoll_cleanup_library();
|
||||
curl_global_cleanup();
|
||||
clear_metadata();
|
||||
rdk_logger_deinit();
|
||||
free_server_list(&server_list);
|
||||
}
|
||||
|
||||
void shutdownSocketConnection(char *reason) {
|
||||
|
||||
16
src/main.c
16
src/main.c
@@ -24,11 +24,7 @@
|
||||
#include "parodus_log.h"
|
||||
#include <curl/curl.h>
|
||||
#ifdef INCLUDE_BREAKPAD
|
||||
#ifndef DEVICE_CAMERA
|
||||
#include "breakpad_wrapper.h"
|
||||
#else
|
||||
#include "breakpadwrap.h"
|
||||
#endif //DEVICE_CAMERA
|
||||
#endif
|
||||
#include "signal.h"
|
||||
#include "privilege.h"
|
||||
@@ -91,17 +87,8 @@ int main( int argc, char **argv)
|
||||
signal(SIGHUP, sig_handler);
|
||||
signal(SIGALRM, sig_handler);
|
||||
#ifdef INCLUDE_BREAKPAD
|
||||
#ifndef DEVICE_CAMERA
|
||||
/* breakpad handles the signals SIGSEGV, SIGBUS, SIGFPE, and SIGILL */
|
||||
breakpad_ExceptionHandler();
|
||||
#else
|
||||
/* breakpad handles the signals SIGSEGV, SIGBUS, SIGFPE, and SIGILL */
|
||||
BreakPadWrapExceptionHandler eh;
|
||||
eh = newBreakPadWrapExceptionHandler();
|
||||
if(NULL != eh) {
|
||||
ParodusInfo("Breakpad Initialized\n");
|
||||
}
|
||||
#endif //DEVICE_CAMERA
|
||||
#else
|
||||
signal(SIGSEGV, sig_handler);
|
||||
signal(SIGBUS, sig_handler);
|
||||
@@ -120,7 +107,6 @@ int main( int argc, char **argv)
|
||||
ParodusInfo("********** Starting component: Parodus **********\n ");
|
||||
drop_root_privilege();
|
||||
#ifdef ENABLE_WEBCFGBIN
|
||||
registerRbusLogger();
|
||||
subscribeRBUSevent();
|
||||
regXmidtSendDataMethod();
|
||||
#endif
|
||||
@@ -131,7 +117,7 @@ int main( int argc, char **argv)
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
createSocketConnection( NULL);
|
||||
free_cfg(cfg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -110,11 +110,6 @@ void packMetaData()
|
||||
ParodusError("Failed to encode metadata\n");
|
||||
}
|
||||
}
|
||||
|
||||
void clear_metadata(){
|
||||
if(metadataPack != NULL)
|
||||
free(metadataPack);
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief To handle UpStream messages which is received from nanomsg server socket
|
||||
@@ -325,10 +320,7 @@ void *processUpstreamMessage()
|
||||
}
|
||||
else if(msgType == WRP_MSG_TYPE__EVENT)
|
||||
{
|
||||
(msg->u.event.headers != NULL && msg->u.event.headers->headers[0] != NULL && msg->u.event.headers->headers[1] != NULL) ? ParodusInfo(" Received upstream event data: dest '%s' traceParent: %s traceState: %s\n", msg->u.event.dest, msg->u.event.headers->headers[0], msg->u.event.headers->headers[1]) : ParodusInfo(" Received upstream event data: dest '%s'\n", msg->u.event.dest);
|
||||
if(msg->u.event.transaction_uuid != NULL) {
|
||||
ParodusInfo("transaction_uuid in event: %s\n", msg->u.event.transaction_uuid);
|
||||
}
|
||||
ParodusInfo(" Received upstream event data: dest '%s'\n", msg->u.event.dest);
|
||||
partners_t *partnersList = NULL;
|
||||
int j = 0;
|
||||
|
||||
@@ -387,7 +379,7 @@ void *processUpstreamMessage()
|
||||
//Sending to server for msgTypes 3, 5, 6, 7, 8.
|
||||
if( WRP_MSG_TYPE__REQ == msgType )
|
||||
{
|
||||
(msg->u.req.headers != NULL && msg->u.req.headers->headers[0] != NULL && msg->u.req.headers->headers[1] != NULL) ? ParodusInfo(" Received upstream data with MsgType: %d dest: '%s' transaction_uuid: %s traceParent: %s traceState: %s\n", msgType, msg->u.req.dest, msg->u.req.transaction_uuid, msg->u.req.headers->headers[0], msg->u.req.headers->headers[1]) : ParodusInfo(" Received upstream data with MsgType: %d dest: '%s' transaction_uuid: %s\n", msgType, msg->u.req.dest, msg->u.req.transaction_uuid);
|
||||
ParodusInfo(" Received upstream data with MsgType: %d dest: '%s' transaction_uuid: %s\n", msgType, msg->u.req.dest, msg->u.req.transaction_uuid );
|
||||
sendUpstreamMsgToServer(&message->msg, message->len);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -59,7 +59,6 @@ int subscribeCurrentActiveInterfaceEvent();
|
||||
UpStreamMsg * get_global_UpStreamMsgQ(void);
|
||||
pthread_cond_t *get_global_nano_con(void);
|
||||
pthread_mutex_t *get_global_nano_mut(void);
|
||||
void clear_metadata();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -47,38 +47,6 @@ rbusHandle_t get_parodus_rbus_Handle(void)
|
||||
{
|
||||
return rbus_Handle;
|
||||
}
|
||||
|
||||
/* Enables rbus ERROR level logs in parodus. Modify RBUS_LOG_ERROR check if more debug logs are needed from rbus. */
|
||||
void rbus_log_handler(
|
||||
rbusLogLevel level,
|
||||
const char* file,
|
||||
int line,
|
||||
int threadId,
|
||||
char* message)
|
||||
{
|
||||
ParodusPrint("threadId %d\n", threadId);
|
||||
const char* slevel = "";
|
||||
|
||||
if(level < RBUS_LOG_ERROR)
|
||||
return;
|
||||
|
||||
switch(level)
|
||||
{
|
||||
case RBUS_LOG_DEBUG: slevel = "DEBUG"; break;
|
||||
case RBUS_LOG_INFO: slevel = "INFO"; break;
|
||||
case RBUS_LOG_WARN: slevel = "WARN"; break;
|
||||
case RBUS_LOG_ERROR: slevel = "ERROR"; break;
|
||||
case RBUS_LOG_FATAL: slevel = "FATAL"; break;
|
||||
}
|
||||
ParodusInfo("%5s %s:%d -- %s\n", slevel, file, line, message);
|
||||
}
|
||||
|
||||
void registerRbusLogger()
|
||||
{
|
||||
rbus_registerLogHandler(rbus_log_handler);
|
||||
ParodusPrint("Registered rbus log handler\n");
|
||||
}
|
||||
|
||||
#ifdef WAN_FAILOVER_SUPPORTED
|
||||
void eventReceiveHandler( rbusHandle_t rbus_Handle, rbusEvent_t const* event, rbusEventSubscription_t* subscription );
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user