Skip to content

Commit

Permalink
Merge pull request #829 from greenbone/json-pull
Browse files Browse the repository at this point in the history
Add: Incremental JSON "pull" parser utils
  • Loading branch information
jhelmold committed Sep 16, 2024
2 parents 2570973 + 00e7d66 commit 48080ff
Show file tree
Hide file tree
Showing 5 changed files with 2,363 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ if (BUILD_TESTS AND NOT SKIP_SRC)
DEPENDS array-test alivedetection-test boreas_error-test boreas_io-test
cli-test cpeutils-test cvss-test ping-test sniffer-test util-test networking-test
passwordbasedauthentication-test xmlutils-test version-test osp-test
nvti-test hosts-test)
nvti-test hosts-test jsonpull-test)

endif (BUILD_TESTS AND NOT SKIP_SRC)

Expand Down
25 changes: 22 additions & 3 deletions util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ pkg_check_modules (GPGME REQUIRED gpgme>=1.7.0)
# for serverutils we need libgcrypt
pkg_check_modules (GCRYPT REQUIRED libgcrypt)

# for json parsing we need cJSON
pkg_check_modules (CJSON REQUIRED libcjson>=1.7.14)

# for mqtt
find_library(LIBPAHO paho-mqtt3c)
message (STATUS "Looking for paho-mqtt3c ... ${LIBPAHO}")
Expand Down Expand Up @@ -111,11 +114,11 @@ include_directories (${GLIB_INCLUDE_DIRS} ${GPGME_INCLUDE_DIRS} ${GCRYPT_INCLUDE

set (FILES cpeutils.c passwordbasedauthentication.c compressutils.c fileutils.c gpgmeutils.c kb.c ldaputils.c
nvticache.c mqtt.c radiusutils.c serverutils.c sshutils.c uuidutils.c
xmlutils.c)
xmlutils.c jsonpull.c)

set (HEADERS cpeutils.h passwordbasedauthentication.h authutils.h compressutils.h fileutils.h gpgmeutils.h kb.h
ldaputils.h nvticache.h mqtt.h radiusutils.h serverutils.h sshutils.h
uuidutils.h xmlutils.h)
uuidutils.h xmlutils.h jsonpull.h)

if (BUILD_STATIC)
add_library (gvm_util_static STATIC ${FILES})
Expand All @@ -137,13 +140,29 @@ if (BUILD_SHARED)
${RADIUS_LDFLAGS} ${LIBSSH_LDFLAGS} ${GNUTLS_LDFLAGS}
${GCRYPT_LDFLAGS} ${LDAP_LDFLAGS} ${REDIS_LDFLAGS}
${LIBXML2_LDFLAGS} ${UUID_LDFLAGS}
${LINKER_HARDENING_FLAGS} ${CRYPT_LDFLAGS})
${LINKER_HARDENING_FLAGS} ${CRYPT_LDFLAGS}
${CJSON_LDFLAGS})
endif (BUILD_SHARED)


## Tests

if (BUILD_TESTS)
add_executable (jsonpull-test
EXCLUDE_FROM_ALL
jsonpull_tests.c)

add_test (jsonpull-test jsonpull-test)

target_include_directories (jsonpull-test PRIVATE ${CGREEN_INCLUDE_DIRS})

target_link_libraries (jsonpull-test ${CGREEN_LIBRARIES}
${GLIB_LDFLAGS} ${CJSON_LDFLAGS})

add_custom_target (tests-jsonpull
DEPENDS jsonpull-test)


add_executable (passwordbasedauthentication-test
EXCLUDE_FROM_ALL
passwordbasedauthentication_tests.c)
Expand Down
Loading

0 comments on commit 48080ff

Please sign in to comment.