Have a clear distinction between public and private/internal API (#2137)
1) Public API/headers in `src/include/` [as it has always been] 2) Private API/headers in `src/lib/` Try to keep the "ndpi_" prefix only for the public functions
This commit is contained in:
+4
-4
@@ -65,7 +65,7 @@ fuzz_ndpi_reader_payload_analyzer_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTO
|
||||
$(fuzz_ndpi_reader_payload_analyzer_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@
|
||||
|
||||
fuzz_quic_get_crypto_data_SOURCES = fuzz_quic_get_crypto_data.c fuzz_common_code.c
|
||||
fuzz_quic_get_crypto_data_CFLAGS = @NDPI_CFLAGS@ $(CXXFLAGS)
|
||||
fuzz_quic_get_crypto_data_CFLAGS = -I../src/lib/ @NDPI_CFLAGS@ $(CXXFLAGS) -DNDPI_LIB_COMPILATION
|
||||
fuzz_quic_get_crypto_data_LDADD = ../src/lib/libndpi.a $(ADDITIONAL_LIBS)
|
||||
fuzz_quic_get_crypto_data_LDFLAGS = $(LIBS)
|
||||
if HAS_FUZZLDFLAGS
|
||||
@@ -387,7 +387,7 @@ fuzz_binaryfusefilter_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(fuzz_binaryfusefilter_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@
|
||||
|
||||
fuzz_tls_certificate_SOURCES = fuzz_tls_certificate.c fuzz_common_code.c
|
||||
fuzz_tls_certificate_CFLAGS = @NDPI_CFLAGS@ $(CXXFLAGS)
|
||||
fuzz_tls_certificate_CFLAGS = -I../src/lib/ @NDPI_CFLAGS@ $(CXXFLAGS) -DNDPI_LIB_COMPILATION
|
||||
fuzz_tls_certificate_LDADD = ../src/lib/libndpi.a $(ADDITIONAL_LIBS)
|
||||
fuzz_tls_certificate_LDFLAGS = $(LIBS)
|
||||
if HAS_FUZZLDFLAGS
|
||||
@@ -413,7 +413,7 @@ fuzz_dga_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(fuzz_dga_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@
|
||||
|
||||
fuzz_is_stun_udp_SOURCES = fuzz_is_stun.c fuzz_common_code.c
|
||||
fuzz_is_stun_udp_CFLAGS = @NDPI_CFLAGS@ $(CXXFLAGS)
|
||||
fuzz_is_stun_udp_CFLAGS = -I../src/lib/ @NDPI_CFLAGS@ $(CXXFLAGS) -DNDPI_LIB_COMPILATION
|
||||
fuzz_is_stun_udp_LDADD = ../src/lib/libndpi.a $(ADDITIONAL_LIBS)
|
||||
fuzz_is_stun_udp_LDFLAGS = $(LIBS)
|
||||
if HAS_FUZZLDFLAGS
|
||||
@@ -426,7 +426,7 @@ fuzz_is_stun_udp_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(fuzz_is_stun_udp_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@
|
||||
|
||||
fuzz_is_stun_tcp_SOURCES = fuzz_is_stun.c fuzz_common_code.c
|
||||
fuzz_is_stun_tcp_CFLAGS = @NDPI_CFLAGS@ $(CXXFLAGS) -DSTUN_TCP
|
||||
fuzz_is_stun_tcp_CFLAGS = -I../src/lib/ @NDPI_CFLAGS@ $(CXXFLAGS) -DNDPI_LIB_COMPILATION -DSTUN_TCP
|
||||
fuzz_is_stun_tcp_LDADD = ../src/lib/libndpi.a $(ADDITIONAL_LIBS)
|
||||
fuzz_is_stun_tcp_LDFLAGS = $(LIBS)
|
||||
if HAS_FUZZLDFLAGS
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
#define NDPI_LIB_COMPILATION
|
||||
|
||||
#include "ndpi_api.h"
|
||||
#include "ndpi_private.h"
|
||||
#include "fuzz_common_code.h"
|
||||
|
||||
static struct ndpi_detection_module_struct *ndpi_struct = NULL;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "ndpi_api.h"
|
||||
#include "ndpi_private.h"
|
||||
#include "fuzz_common_code.h"
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -7,20 +8,6 @@
|
||||
struct ndpi_detection_module_struct *ndpi_info_mod = NULL;
|
||||
struct ndpi_flow_struct *flow = NULL;
|
||||
|
||||
extern const uint8_t *get_crypto_data(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int8_t *clear_payload, uint32_t clear_payload_len,
|
||||
uint64_t *crypto_data_len);
|
||||
extern void process_tls(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
const u_int8_t *crypto_data, uint32_t crypto_data_len,
|
||||
uint32_t version);
|
||||
extern void process_chlo(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
const u_int8_t *crypto_data, uint32_t crypto_data_len);
|
||||
extern int is_version_with_tls(uint32_t version);
|
||||
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
const u_int8_t *crypto_data;
|
||||
uint64_t crypto_data_len;
|
||||
@@ -56,7 +43,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
if(!is_version_with_tls(version)) {
|
||||
process_chlo(ndpi_info_mod, flow, crypto_data, crypto_data_len);
|
||||
} else {
|
||||
process_tls(ndpi_info_mod, flow, crypto_data, crypto_data_len, version);
|
||||
process_tls(ndpi_info_mod, flow, crypto_data, crypto_data_len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
#define NDPI_LIB_COMPILATION
|
||||
|
||||
#include "ndpi_api.h"
|
||||
#include "ndpi_private.h"
|
||||
#include "fuzz_common_code.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
extern void processCertificateElements(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int16_t p_offset, u_int16_t certificate_len);
|
||||
struct ndpi_tcphdr tcph;
|
||||
struct ndpi_iphdr iph;
|
||||
struct ndpi_ipv6hdr iphv6;
|
||||
|
||||
Reference in New Issue
Block a user