Skip to content

Commit 6702047

Browse files
Merge pull request #25 from sadhyama/aker_blob
Webconfig Aker Blob Support
2 parents 8e0af6c + a4899db commit 6702047

File tree

14 files changed

+1149
-30
lines changed

14 files changed

+1149
-30
lines changed

CMakeLists.txt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,18 @@ include_directories(${INCLUDE_DIR}
4343
${INCLUDE_DIR}/trower-base64
4444
${INCLUDE_DIR}/wdmp-c
4545
${INCLUDE_DIR}/cimplog
46+
${INCLUDE_DIR}/wrp-c
47+
${INCLUDE_DIR}/nanomsg
48+
${INCLUDE_DIR}/libparodus
4649
# ${INCLUDE_DIR}/curl
4750
)
4851

4952
if (NOT BUILD_YOCTO)
5053

54+
if (MULTIPART_UTILITY)
55+
add_definitions(-DMULTIPART_UTILITY)
56+
endif (MULTIPART_UTILITY)
57+
5158
# msgpack-c external dependency
5259
#-------------------------------------------------------------------------------
5360
ExternalProject_Add(msgpack
@@ -120,6 +127,52 @@ add_dependencies(libcurl curl)
120127
#find_library( LIB_CURL,
121128
# NAMES curl
122129
# PATHS /usr/lib64 )
130+
131+
# nanoMsg external dependency
132+
#-------------------------------------------------------------------------------
133+
ExternalProject_Add(nanomsg
134+
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/_prefix/nanomsg
135+
GIT_REPOSITORY https://github.com/nanomsg/nanomsg.git
136+
GIT_TAG "1.1.4"
137+
CMAKE_ARGS += -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}
138+
)
139+
add_library(libnanomsg STATIC SHARED IMPORTED)
140+
add_dependencies(libnanomsg nanomsg)
141+
142+
# wrp-c external dependency
143+
#-------------------------------------------------------------------------------
144+
ExternalProject_Add(wrp-c
145+
DEPENDS trower-base64 msgpack cimplog
146+
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/_prefix/wrp-c
147+
GIT_REPOSITORY https://github.com/Comcast/wrp-c.git
148+
GIT_TAG "1.0.1"
149+
CMAKE_ARGS += -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}
150+
-DMSGPACK_ENABLE_CXX=OFF
151+
-DMSGPACK_BUILD_EXAMPLES=OFF
152+
-DBUILD_TESTING=OFF
153+
-DMAIN_PROJ_BUILD=ON
154+
-DMAIN_PROJ_LIB_PATH=${LIBRARY_DIR}
155+
-DMAIN_PROJ_INCLUDE_PATH=${INCLUDE_DIR}
156+
)
157+
add_library(libwrp-c STATIC SHARED IMPORTED)
158+
add_dependencies(libwrp-c wrp-c)
159+
160+
# libparodus external dependency
161+
#-------------------------------------------------------------------------------
162+
ExternalProject_Add(libparodus
163+
DEPENDS trower-base64 msgpack nanomsg wrp-c
164+
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/_prefix/libparodus
165+
GIT_REPOSITORY https://github.com/Comcast/libparodus.git
166+
GIT_TAG "1.0.2"
167+
CMAKE_ARGS += -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DBUILD_TESTING=OFF
168+
-DMAIN_PROJ_BUILD=ON
169+
-DMAIN_PROJ_LIB_PATH=${LIBRARY_DIR}
170+
-DMAIN_PROJ_LIB64_PATH=${LIBRARY_DIR64}
171+
-DMAIN_PROJ_COMMON_PATH=${COMMON_LIBRARY_DIR}
172+
-DMAIN_PROJ_INCLUDE_PATH=${INCLUDE_DIR}
173+
)
174+
add_library(liblibparodus STATIC SHARED IMPORTED)
175+
add_dependencies(liblibparodus libparodus)
123176
endif ()
124177
link_directories ( ${LIBRARY_DIR} ${COMMON_LIBRARY_DIR} ${LIBRARY_DIR64} )
125178

src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# limitations under the License.
1414

1515
set(PROJ_WEBCFG webcfg)
16-
set(HEADERS webcfg.h webcfg_param.h webcfg_pack.h webcfg_multipart.h webcfg_auth.h webcfg_notify.h webcfg_generic.h webcfg_db.h webcfg_log.h webcfg_blob.h webcfg_event.h)
17-
set(SOURCES webcfg_helpers.c webcfg.c webcfg_param.c webcfg_pack.c webcfg_multipart.c webcfg_auth.c webcfg_notify.c webcfg_db.c webcfg_generic.c webcfg_blob.c webcfg_event.c)
16+
set(HEADERS webcfg.h webcfg_param.h webcfg_pack.h webcfg_multipart.h webcfg_auth.h webcfg_notify.h webcfg_generic.h webcfg_db.h webcfg_log.h webcfg_blob.h webcfg_event.h webcfg_aker.h)
17+
set(SOURCES webcfg_helpers.c webcfg.c webcfg_param.c webcfg_pack.c webcfg_multipart.c webcfg_auth.c webcfg_notify.c webcfg_db.c webcfg_generic.c webcfg_blob.c webcfg_event.c webcfg_client.c webcfg_aker.c)
1818

1919
add_library(${PROJ_WEBCFG} STATIC ${HEADERS} ${SOURCES})
2020
add_library(${PROJ_WEBCFG}.shared SHARED ${HEADERS} ${SOURCES})

src/webcfg.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,18 @@
3030
#include <wdmp-c.h>
3131
#include <base64.h>
3232
#include "webcfg_db.h"
33+
#include "webcfg_aker.h"
3334
/*----------------------------------------------------------------------------*/
3435
/* Macros */
3536
/*----------------------------------------------------------------------------*/
3637

3738

3839
#ifdef MULTIPART_UTILITY
39-
40+
#ifdef BUILD_YOCTO
4041
#define TEST_FILE_LOCATION "/nvram/multipart.bin"
41-
42+
#else
43+
#define TEST_FILE_LOCATION "/tmp/multipart.bin"
44+
#endif
4245
#endif
4346
/*----------------------------------------------------------------------------*/
4447
/* Data Structures */
@@ -92,6 +95,7 @@ void *WebConfigMultipartTask(void *status)
9295

9396
//start webconfig notification thread.
9497
initWebConfigNotifyTask();
98+
initWebConfigClient();
9599
WebcfgInfo("initDB %s\n", WEBCFG_DB_FILE);
96100

97101
initDB(WEBCFG_DB_FILE);

src/webcfg.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,21 @@
1919
#include <stdint.h>
2020
#include <string.h>
2121
#include <stdbool.h>
22+
#include <pthread.h>
23+
#include <time.h>
2224
/*----------------------------------------------------------------------------*/
2325
/* Macros */
2426
/*----------------------------------------------------------------------------*/
2527
#define MAX_BUF_SIZE 256
2628
#define MAX_PARAMETERNAME_LENGTH 512
2729
#define BACKOFF_SLEEP_DELAY_SEC 10
2830

31+
#ifdef BUILD_YOCTO
32+
#define DEVICE_PROPS_FILE "/etc/device.properties"
33+
#else
34+
#define DEVICE_PROPS_FILE "/tmp/device.properties"
35+
#endif
36+
2937
#define WEBCFG_FREE(__x__) if(__x__ != NULL) { free((void*)(__x__)); __x__ = NULL;} else {printf("Trying to free null pointer\n");}
3038
#ifndef TEST
3139
#define FOREVER() 1
@@ -66,5 +74,5 @@ void webcfgStrncpy(char *destStr, const char *srcStr, size_t destSize);
6674
char* get_global_auth_token();
6775
void getCurrent_Time(struct timespec *timer);
6876
long timeVal_Diff(struct timespec *starttime, struct timespec *finishtime);
69-
77+
void initWebConfigClient();
7078
#endif

0 commit comments

Comments
 (0)