mirror of
https://github.com/outbackdingo/parodus.git
synced 2026-01-27 18:20:04 +00:00
Compare commits
6 Commits
webcfg_bin
...
5.2_p1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36775ba36a | ||
|
|
0fd3b76f27 | ||
|
|
48722ffa7c | ||
|
|
bf5d555d96 | ||
|
|
9f40b7efe5 | ||
|
|
5562d7ec48 |
@@ -43,6 +43,13 @@ include_directories(${INCLUDE_DIR}
|
||||
${INCLUDE_DIR}/cjwt
|
||||
)
|
||||
|
||||
if (ENABLE_WEBCFGBIN)
|
||||
include_directories(${INCLUDE_DIR}/rbus
|
||||
${INCLUDE_DIR}/rbus-core
|
||||
${INCLUDE_DIR}/rtmessage
|
||||
)
|
||||
endif (ENABLE_WEBCFGBIN)
|
||||
|
||||
# Get git commit hash
|
||||
#-------------------------------------------------------------------------------
|
||||
execute_process(
|
||||
@@ -229,6 +236,51 @@ include_directories(${INCLUDE_DIR}
|
||||
|
||||
endif (FEATURE_DNS_QUERY)
|
||||
|
||||
if (ENABLE_WEBCFGBIN)
|
||||
# rtMessage external dependency
|
||||
#-------------------------------------------------------------------------------
|
||||
ExternalProject_Add(rtMessage
|
||||
#DEPENDS cJSON
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/_prefix/rtMessage
|
||||
GIT_REPOSITORY https://github.com/rdkcmf/rdk-rtmessage.git
|
||||
GIT_TAG rdk-next
|
||||
CMAKE_ARGS += -DBUILD_RTMESSAGE_LIB=ON
|
||||
-DBUILD_RTMESSAGE_SAMPLE_APP=ON
|
||||
-DBUILD_FOR_DESKTOP=OFF
|
||||
-DCJSON_BUILD=OFF
|
||||
-DBUILD_DATAPROVIDER_LIB=ON
|
||||
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DBUILD_TESTING=OFF
|
||||
)
|
||||
add_library(librtMessage STATIC SHARED IMPORTED)
|
||||
add_dependencies(librtMessage rtMessage)
|
||||
|
||||
# rbus-core external dependency
|
||||
#-------------------------------------------------------------------------------
|
||||
ExternalProject_Add(rbus-core
|
||||
DEPENDS rtMessage
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/_prefix/rbus-core
|
||||
GIT_REPOSITORY https://github.com/rdkcmf/rbuscore.git
|
||||
GIT_TAG rdk-next
|
||||
CMAKE_ARGS += -DBUILD_FOR_DESKTOP=ON -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}
|
||||
-DBUILD_TESTING=OFF
|
||||
)
|
||||
add_library(librbus-core STATIC SHARED IMPORTED)
|
||||
add_dependencies(librbus-core rbus-core)
|
||||
|
||||
# rbus external dependency
|
||||
#-------------------------------------------------------------------------------
|
||||
ExternalProject_Add(rbus
|
||||
DEPENDS rtMessage rbus-core
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/_prefix/rbus
|
||||
GIT_REPOSITORY https://github.com/rdkcmf/rbus.git
|
||||
GIT_TAG rdk-next
|
||||
CMAKE_ARGS += -DBUILD_FOR_DESKTOP=ON -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DBUILD_TESTING=OFF
|
||||
)
|
||||
|
||||
add_library(librbus STATIC SHARED IMPORTED)
|
||||
add_dependencies(librbus rbus)
|
||||
endif (ENABLE_WEBCFGBIN)
|
||||
|
||||
if (BUILD_TESTING)
|
||||
# cmocka external dependency
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
@@ -56,5 +56,7 @@ if (ENABLE_SESHAT)
|
||||
target_link_libraries (parodus -llibseshat)
|
||||
endif (ENABLE_SESHAT)
|
||||
|
||||
|
||||
if (ENABLE_WEBCFGBIN)
|
||||
target_link_libraries (parodus -lrbus -lrbus-core)
|
||||
endif (ENABLE_WEBCFGBIN)
|
||||
install (TARGETS parodus DESTINATION bin)
|
||||
|
||||
@@ -161,7 +161,9 @@ int readFromFile(const char *file_name, char **data);
|
||||
void timespec_diff(struct timespec *start, struct timespec *stop,
|
||||
struct timespec *result);
|
||||
|
||||
|
||||
#ifdef ENABLE_WEBCFGBIN
|
||||
void subscribeRBUSevent();
|
||||
#endif
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* For interface_down_event Flag */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
36
src/config.c
36
src/config.c
@@ -163,6 +163,38 @@ int parse_mac_address (char *target, const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int parse_serial_num(char *target, const char *arg)
|
||||
{
|
||||
char ch;
|
||||
if(arg != NULL)
|
||||
{
|
||||
if(strlen(arg) == 0)
|
||||
{
|
||||
ParodusError("Empty serial number, setting to default unknown\n");
|
||||
strcpy(target,"unknown");
|
||||
}
|
||||
for(int i=0; (ch = arg[i]) != '\0'; i++)
|
||||
{
|
||||
// check if character is ascii, a-z --> 97 to 122, A-Z --> 65 to 90, digits(0 to 9) --> 48 to 57
|
||||
if((ch >= 97 && ch <= 122) || (ch >= 65 && ch <= 90) || (ch >=48 && ch <= 57))
|
||||
{
|
||||
target[i] = ch;
|
||||
}
|
||||
else
|
||||
{
|
||||
ParodusError("Invalid serial number, setting to default unknown\n");
|
||||
strcpy(target,"unknown");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ParodusError("serial number argument is NULL\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int server_is_http (const char *full_url,
|
||||
const char **server_ptr)
|
||||
{
|
||||
@@ -417,8 +449,8 @@ int parseCommandLine(int argc,char **argv,ParodusCfg * cfg)
|
||||
break;
|
||||
|
||||
case 's':
|
||||
parStrncpy(cfg->hw_serial_number,optarg,sizeof(cfg->hw_serial_number));
|
||||
ParodusInfo("hw_serial_number is %s\n",cfg->hw_serial_number);
|
||||
if(parse_serial_num(cfg->hw_serial_number, optarg) == 0)
|
||||
ParodusInfo ("hw_serial-number is %s\n",cfg->hw_serial_number);
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
|
||||
@@ -77,6 +77,7 @@ void createSocketConnection(void (* initKeypress)())
|
||||
server_list_t server_list;
|
||||
bool seshat_registered = false;
|
||||
int create_conn_rtn = 0;
|
||||
int nopoll_returnvalue = 0;
|
||||
unsigned int webpa_ping_timeout_ms = 1000 * get_parodus_cfg()->webpa_ping_timeout;
|
||||
unsigned int heartBeatTimer = 0;
|
||||
struct timespec start_svc_alive_timer;
|
||||
@@ -134,14 +135,17 @@ void createSocketConnection(void (* initKeypress)())
|
||||
struct timespec start, stop, diff;
|
||||
int time_taken_ms;
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &start);
|
||||
nopoll_loop_wait(ctx, 5000000);
|
||||
clock_gettime(CLOCK_REALTIME, &stop);
|
||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||
nopoll_returnvalue = nopoll_loop_wait(ctx, 5000000);
|
||||
clock_gettime(CLOCK_MONOTONIC, &stop);
|
||||
|
||||
timespec_diff(&start, &stop, &diff);
|
||||
time_taken_ms = diff.tv_sec * 1000 + (diff.tv_nsec / 1000000);
|
||||
|
||||
// ParodusInfo("nopoll_loop_wait() time %d msec\n", time_taken_ms);
|
||||
if(time_taken_ms/1000 != 5)
|
||||
{
|
||||
ParodusInfo("nopoll_loop_wait value %d,nopoll_loop_wait() time %d msec\n",nopoll_returnvalue, time_taken_ms);
|
||||
}
|
||||
ParodusPrint("webpa_ping_timeout_ms %d msec\n", webpa_ping_timeout_ms);
|
||||
heartBeatTimer = get_heartBeatTimer();
|
||||
if(heartBeatTimer >= webpa_ping_timeout_ms)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ uint64_t getCurrentTimeInMicroSeconds(struct timespec *timer)
|
||||
ParodusPrint("timer->tv_sec : %lu\n",timer->tv_sec);
|
||||
ParodusPrint("timer->tv_nsec : %lu\n",timer->tv_nsec);
|
||||
systime = (uint64_t)timer->tv_sec * 1000000L + timer->tv_nsec/ 1000;
|
||||
return systime;
|
||||
return systime;
|
||||
}
|
||||
|
||||
long timeValDiff(struct timespec *starttime, struct timespec *finishtime)
|
||||
|
||||
@@ -40,7 +40,6 @@ void subscribeRBUSevent()
|
||||
rbusError_t err;
|
||||
int rc = RBUS_ERROR_SUCCESS;
|
||||
rbusHandle_t rbus_Handle;
|
||||
|
||||
err = rbus_open(&rbus_Handle, "parodus");
|
||||
if (err)
|
||||
{
|
||||
@@ -62,12 +61,14 @@ void processWebconfigUpstreamEvent(rbusHandle_t handle, rbusEvent_t const* event
|
||||
int rv=-1;
|
||||
wrp_msg_t *event_msg;
|
||||
void *bytes;
|
||||
const uint8_t* bytesVal = NULL;
|
||||
int len;
|
||||
rbusValue_t value = NULL;
|
||||
|
||||
value = rbusObject_GetValue(event->data, "value");
|
||||
bytes = rbusValue_GetBytes(value, &len);
|
||||
bytesVal = rbusValue_GetBytes(value, &len);
|
||||
|
||||
bytes = (void*) bytesVal;
|
||||
rv = wrp_to_struct( bytes, len, WRP_BYTES, &event_msg );
|
||||
if(rv > 0)
|
||||
{
|
||||
@@ -119,5 +120,6 @@ void processWebconfigUpstreamEvent(rbusHandle_t handle, rbusEvent_t const* event
|
||||
|
||||
void subscribeAsyncHandler( rbusHandle_t handle, rbusEventSubscription_t* subscription, rbusError_t error)
|
||||
{
|
||||
(void)handle;
|
||||
ParodusInfo("subscribeAsyncHandler event %s, error %d - %s\n",subscription->eventName, error, rbusError_ToString(error));
|
||||
}
|
||||
|
||||
@@ -32,6 +32,10 @@ if (FEATURE_DNS_QUERY)
|
||||
set (PARODUS_COMMON_LIBS ${PARODUS_COMMON_LIBS} -lucresolv -lresolv)
|
||||
endif (FEATURE_DNS_QUERY)
|
||||
|
||||
if (ENABLE_WEBCFGBIN)
|
||||
set (PARODUS_COMMON_LIBS ${PARODUS_COMMON_LIBS} -lrbus -lrbus-core)
|
||||
endif (ENABLE_WEBCFGBIN)
|
||||
|
||||
if(NOT DISABLE_VALGRIND)
|
||||
set (MEMORY_CHECK valgrind --leak-check=full --show-reachable=yes -v)
|
||||
endif ()
|
||||
@@ -154,7 +158,11 @@ set(CLIST_SRC ${CLIST_SRC} ../src/seshat_interface.c)
|
||||
else()
|
||||
set(CLIST_SRC ${CLIST_SRC} ../src/seshat_interface_stub.c)
|
||||
endif (ENABLE_SESHAT)
|
||||
|
||||
|
||||
if (ENABLE_WEBCFGBIN)
|
||||
set(CLIST_SRC ${CLIST_SRC} ../src/upstream_rbus.c)
|
||||
endif (ENABLE_WEBCFGBIN)
|
||||
|
||||
add_executable(test_client_list ${CLIST_SRC})
|
||||
#target_link_libraries (test_client_list ${PARODUS_CONN_LIBS} ${PARODUS_COMMON_LIBS})
|
||||
target_link_libraries (test_client_list ${PARODUS_COMMON_LIBS} -lcurl -luuid)
|
||||
@@ -172,6 +180,10 @@ else()
|
||||
set(SVA_SRC ${SVA_SRC} ../src/seshat_interface_stub.c)
|
||||
endif (ENABLE_SESHAT)
|
||||
|
||||
if (ENABLE_WEBCFGBIN)
|
||||
set(SVA_SRC ${SVA_SRC} ../src/upstream_rbus.c)
|
||||
endif (ENABLE_WEBCFGBIN)
|
||||
|
||||
add_executable(test_service_alive ${SVA_SRC})
|
||||
#target_link_libraries (test_service_alive ${PARODUS_CONN_LIBS} ${PARODUS_COMMON_LIBS})
|
||||
target_link_libraries (test_service_alive ${PARODUS_COMMON_LIBS} -lcurl -luuid)
|
||||
@@ -294,6 +306,9 @@ set(CONIFC_SRC ${CONIFC_SRC} ../src/seshat_interface.c)
|
||||
else()
|
||||
set(CONIFC_SRC ${CONIFC_SRC} ../src/seshat_interface_stub.c)
|
||||
endif (ENABLE_SESHAT)
|
||||
if (ENABLE_WEBCFGBIN)
|
||||
set(CONIFC_SRC ${CONIFC_SRC} ../src/upstream_rbus.c)
|
||||
endif (ENABLE_WEBCFGBIN)
|
||||
add_executable(test_conn_interface ${CONIFC_SRC})
|
||||
target_link_libraries (test_conn_interface -lcmocka ${PARODUS_COMMON_LIBS} -lcurl -luuid )
|
||||
|
||||
@@ -340,6 +355,10 @@ else()
|
||||
set(TOKEN_SRC test_token_stub.c ${TOKEN_SRC})
|
||||
endif (FEATURE_DNS_QUERY)
|
||||
|
||||
if (ENABLE_WEBCFGBIN)
|
||||
set(TOKEN_SRC ${TOKEN_SRC} ../src/upstream_rbus.c)
|
||||
endif (ENABLE_WEBCFGBIN)
|
||||
|
||||
add_executable(test_token ${TOKEN_SRC} )
|
||||
#target_link_libraries (test_token ${PARODUS_COMMON_LIBS} ${PARODUS_JWT_LIBS} -lcmocka )
|
||||
target_link_libraries (test_token ${PARODUS_COMMON_LIBS} -lcmocka -lcurl -luuid)
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "../src/ParodusInternal.h"
|
||||
|
||||
extern int parse_mac_address (char *target, const char *arg);
|
||||
extern int parse_serial_num(char *target, const char *arg);
|
||||
extern int server_is_http (const char *full_url,
|
||||
const char **server_ptr);
|
||||
extern int parse_webpa_url__(const char *full_url,
|
||||
@@ -469,6 +470,14 @@ void test_parse_mac_address ()
|
||||
assert_int_equal (parse_mac_address (result, ""), -1);
|
||||
}
|
||||
|
||||
void test_parse_serial_num()
|
||||
{
|
||||
char result[14];
|
||||
assert_int_equal (parse_serial_num (result, "1234ABC00ab"), 0);
|
||||
assert_int_equal (parse_serial_num (result, "$@@"), 0);
|
||||
assert_int_equal (parse_serial_num (result, ""), 0);
|
||||
}
|
||||
|
||||
void test_server_is_http ()
|
||||
{
|
||||
const char *server_ptr;
|
||||
@@ -589,6 +598,7 @@ int main(void)
|
||||
cmocka_unit_test(err_loadParodusCfg),
|
||||
cmocka_unit_test(test_parse_num_arg),
|
||||
cmocka_unit_test(test_parse_mac_address),
|
||||
cmocka_unit_test(test_parse_serial_num),
|
||||
cmocka_unit_test(test_get_algo_mask),
|
||||
cmocka_unit_test(test_server_is_http),
|
||||
cmocka_unit_test(test_parse_webpa_url__),
|
||||
|
||||
@@ -172,6 +172,18 @@ int serviceAliveTask()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int validate_partner_id(wrp_msg_t *msg, partners_t **partnerIds)
|
||||
{
|
||||
UNUSED(msg); UNUSED(partnerIds);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sendUpstreamMsgToServer(void **resp_bytes, size_t resp_size)
|
||||
{
|
||||
UNUSED(resp_bytes); UNUSED(resp_size);
|
||||
return;
|
||||
}
|
||||
|
||||
int nopoll_loop_wait(noPollCtx * ctx,long timeout)
|
||||
{
|
||||
UNUSED(ctx); UNUSED(timeout);
|
||||
|
||||
Reference in New Issue
Block a user