Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

headers: cleanup paths for external header inclusion #10054

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions cmake/cares.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ if (FLB_SYSTEM_MACOS)
FLB_DEFINITION(CARES_HAVE_ARPA_NAMESER_H)
endif()

include_directories(
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_CARES}/include
${CMAKE_CURRENT_BINARY_DIR}/${FLB_PATH_LIB_CARES}
)

add_subdirectory(${FLB_PATH_LIB_CARES})# EXCLUDE_FROM_ALL)

set(LIBCARES_LIBRARIES "c-ares")
27 changes: 20 additions & 7 deletions cmake/headers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ if(NOT FLB_PATH_ROOT_SOURCE)
set(FLB_PATH_ROOT_SOURCE ${FLB_ROOT})
endif()

if(NOT DEFINED FLB_PATH_ROOT_BINARY_DIR)
set(FLB_PATH_ROOT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
endif()

include_directories(
${FLB_PATH_ROOT_SOURCE}/include/
${FLB_PATH_ROOT_SOURCE}/lib/
Expand All @@ -20,7 +24,7 @@ include_directories(

# Chunk I/O generate headers also in the binary path
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_CHUNKIO}/include
${CMAKE_CURRENT_BINARY_DIR}/lib/chunkio/include
${FLB_PATH_ROOT_BINARY_DIR}/lib/chunkio/include

${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_MONKEY}/include
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_MONKEY}/include/monkey
Expand All @@ -36,13 +40,22 @@ include_directories(
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_RING_BUFFER}/lwrb/src/include
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_ZSTD}/lib

${CMAKE_CURRENT_BINARY_DIR}/${FLB_PATH_LIB_JANSSON}/include
${CMAKE_CURRENT_BINARY_DIR}/lib/cmetrics
${CMAKE_CURRENT_BINARY_DIR}/lib/cprofiles/include
${CMAKE_CURRENT_BINARY_DIR}/include
# c-ares
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_CARES}/include
${FLB_PATH_ROOT_BINARY_DIR}/${FLB_PATH_LIB_CARES}

# nghttp2
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_NGHTTP2}/lib/includes/
${FLB_PATH_ROOT_BINARY_DIR}/lib/nghttp2
${FLB_PATH_ROOT_BINARY_DIR}/lib/nghttp2/lib/includes/

${FLB_PATH_ROOT_BINARY_DIR}/${FLB_PATH_LIB_JANSSON}/include
${FLB_PATH_ROOT_BINARY_DIR}/lib/cmetrics
${FLB_PATH_ROOT_BINARY_DIR}/lib/cprofiles/include
${FLB_PATH_ROOT_BINARY_DIR}/include

${CMAKE_CURRENT_BINARY_DIR}/lib/monkey/include/
${CMAKE_CURRENT_BINARY_DIR}/lib/monkey/include/monkey/
${FLB_PATH_ROOT_BINARY_DIR}/lib/monkey/include/
${FLB_PATH_ROOT_BINARY_DIR}/lib/monkey/include/monkey/
)

if(FLB_UTF8_ENCODER)
Expand Down
6 changes: 1 addition & 5 deletions cmake/nghttp2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ FLB_OPTION(ENABLE_LIB_ONLY ON)
FLB_OPTION(ENABLE_STATIC_LIB ON)
FLB_OPTION(ENABLE_SHARED_LIB OFF)
FLB_DEFINITION(NGHTTP2_STATICLIB)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/lib/nghttp2
${CMAKE_CURRENT_BINARY_DIR}/lib/nghttp2/lib/includes/
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_NGHTTP2}/lib/includes/
)

add_subdirectory(${FLB_PATH_LIB_NGHTTP2} EXCLUDE_FROM_ALL)
set(NGHTTP2_LIBRARIES "nghttp2_static")
3 changes: 3 additions & 0 deletions include/fluent-bit.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ extern "C" {
#include <fluent-bit/flb_engine.h>
#include <fluent-bit/flb_lib.h>

/* External plugins */
#define FLB_PUBLIC __attribute__((visibility("default")))

#ifdef __cplusplus
}
#endif
Expand Down
26 changes: 0 additions & 26 deletions include/fluent-bit/flb_network.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <fluent-bit/flb_uri.h>
#include <fluent-bit/flb_upstream_conn.h>
#include <fluent-bit/flb_net_dns.h>
#include <ares.h>

#define FLB_NETWORK_DEFAULT_BACKLOG_SIZE 128
#define FLB_NETWORK_UNIX_SOCKET_PEER_ADDRESS_TEMPLATE "pid_%s"
Expand Down Expand Up @@ -109,31 +108,6 @@ struct flb_net_host {
struct flb_uri *uri; /* Extra URI parameters */
};

/* Defines an async DNS lookup context */
struct flb_dns_lookup_context {
struct mk_event response_event; /* c-ares socket event */
int ares_socket_registered;
struct ares_socket_functions ares_socket_functions;
int *udp_timeout_detected;
int ares_socket_created;
int ares_socket_type;
void *ares_channel;
int *result_code;
struct mk_event_loop *event_loop;
struct flb_coro *coroutine;
struct flb_sched_timer *udp_timer;
int finished;
int dropped;
struct flb_net_dns *dns_ctx;
struct addrinfo **result;
/* result is a synthetized result, don't call freeaddrinfo on it */
struct mk_list _head;
};

#define FLB_DNS_LOOKUP_CONTEXT_FOR_EVENT(event) \
((struct flb_dns_lookup_context *) \
&((uint8_t *) event)[-offsetof(struct flb_dns_lookup_context, response_event)])

#define FLB_DNS_LEGACY 'L'
#define FLB_DNS_ASYNC 'A'

Expand Down
28 changes: 27 additions & 1 deletion src/flb_network.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,32 @@
static pthread_once_t local_thread_net_dns_ctx_init = PTHREAD_ONCE_INIT;
FLB_TLS_DEFINE(struct flb_net_dns, flb_net_dns_ctx);

/* Defines an async DNS lookup context */
struct flb_dns_lookup_context {
struct mk_event response_event; /* c-ares socket event */
int ares_socket_registered;
struct ares_socket_functions ares_socket_functions;
int *udp_timeout_detected;
int ares_socket_created;
int ares_socket_type;
void *ares_channel;
int *result_code;
struct mk_event_loop *event_loop;
struct flb_coro *coroutine;
struct flb_sched_timer *udp_timer;
int finished;
int dropped;
struct flb_net_dns *dns_ctx;
struct addrinfo **result;
/* result is a synthetized result, don't call freeaddrinfo on it */
struct mk_list _head;
};

#define FLB_DNS_LOOKUP_CONTEXT_FOR_EVENT(event) \
((struct flb_dns_lookup_context *) \
&((uint8_t *) event)[-offsetof(struct flb_dns_lookup_context, response_event)])


/*
* Initialize thread-local-storage, every worker thread has it owns
* dns context with relevant info populated inside the thread.
Expand Down Expand Up @@ -1810,7 +1836,7 @@ flb_sockfd_t flb_net_accept(flb_sockfd_t server_fd)
struct sockaddr_storage sock_addr = { 0 };
socklen_t socket_size = sizeof(sock_addr);

/*
/*
* sock_addr used to be a sockaddr struct, but this was too
* small of a structure to handle IPV6 addresses (#9053).
* This would cause accept() to not accept the connection (with no error),
Expand Down
Loading