Merge branch 'cmake-missing-bits'

This patchset adds next missing things (in compare to autotools):
- pkgconfig
- event_pthreads/event_openssl
- compile shared/static libraries always

And some fixes, because it will not build after fixing other things:
- export missing symbols for cmake (-fvisibility=hidden)

* cmake-missing-bits:
  cmake: support visibility for AppleClang too
  cmake: fix export absolute path and relative path and cleanup a bit
  cmake: generate and install pkgconfig files
  cmake: build SHARED and STATIC libraries (like autoconf does)
  cmake: add missing event_openssl/event_pthreads libraries
  Export symbols for -fvisibility=hidden (under cmake)

Refs: #246
This commit is contained in:
Azat Khuzhin 2017-03-13 21:05:32 +03:00
commit 489991a2b2
24 changed files with 502 additions and 338 deletions

View File

@ -21,7 +21,7 @@
if (WIN32 OR APPLE)
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
else()
cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
endif()
if(NOT CMAKE_BUILD_TYPE)
@ -102,9 +102,6 @@ endif()
set(EVENT_VERSION
"${EVENT_VERSION_MAJOR}.${EVENT_VERSION_MINOR}.${EVENT_VERSION_PATCH}-${EVENT_STAGE_NAME}")
option(EVENT__BUILD_SHARED_LIBRARIES
"Define if libevent should be built with shared libraries instead of archives" OFF)
option(EVENT__DISABLE_DEBUG_MODE
"Define if libevent should build without support for a debug mode" OFF)
@ -699,7 +696,7 @@ if (NOT EVENT__DISABLE_OPENSSL)
include_directories(${OPENSSL_INCLUDE_DIR})
list(APPEND SRC_CORE bufferevent_openssl.c)
list(APPEND SRC_OPENSSL bufferevent_openssl.c)
list(APPEND HDR_PUBLIC include/event2/bufferevent_ssl.h)
list(APPEND LIB_APPS ${OPENSSL_LIBRARIES})
endif()
@ -711,11 +708,10 @@ if (NOT EVENT__DISABLE_THREAD_SUPPORT)
find_package(Threads REQUIRED)
if (NOT CMAKE_USE_PTHREADS_INIT)
message(FATAL_ERROR
"Failed to find Pthreads, set EVENT__DISABLE_THREAD_SUPPORT to disable")
"Failed to find Pthreads, set EVENT__DISABLE_THREAD_SUPPORT to disable")
endif()
set(EVENT__HAVE_PTHREADS 1)
list(APPEND SRC_CORE evthread_pthread.c)
list(APPEND LIB_APPS ${CMAKE_THREAD_LIBS_INIT})
endif()
endif()
@ -764,10 +760,6 @@ if(WIN32)
include_directories(./WIN32-Code)
endif()
if (UNIX)
list(APPEND LIB_PLATFORM m)
endif()
if (SOLARIS)
list(APPEND LIB_PLATFORM socket nsl)
endif()
@ -782,19 +774,13 @@ source_group("Source Extra" FILES ${SRC_EXTRA})
# (Place them in the build dir so we don't polute the source tree with generated files).
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include)
if (EVENT__BUILD_SHARED_LIBRARIES)
set(EVENT__LIBRARY_TYPE SHARED)
if ((CMAKE_COMPILER_IS_GNUCC) OR (${CMAKE_C_COMPILER_ID} STREQUAL "Clang"))
add_compiler_flags(-fvisibility=hidden)
elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro")
add_compiler_flags(-xldscope=hidden)
endif()
set(EVENT__NEED_DLLIMPORT 1)
else (EVENT__BUILD_SHARED_LIBRARIES)
set(EVENT__LIBRARY_TYPE STATIC)
endif (EVENT__BUILD_SHARED_LIBRARIES)
if ((CMAKE_COMPILER_IS_GNUCC) OR
(${CMAKE_C_COMPILER_ID} STREQUAL "Clang") OR
(${CMAKE_C_COMPILER_ID} STREQUAL "AppleClang"))
set(EVENT_SHARED_FLAGS -fvisibility=hidden)
elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro")
set(EVENT_SHARED_FLAGS -xldscope=hidden)
endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/event-config.h.cmake
@ -808,74 +794,50 @@ configure_file(
#
# Create the libraries.
#
include(AddEventLibrary)
add_event_library(event_core SOURCES ${SRC_CORE})
add_event_library(event_extra
LIBRARIES event_core_shared
SOURCES ${SRC_EXTRA})
# TODO: Add dynamic versions of the libraries as well.
add_library(event_core ${EVENT__LIBRARY_TYPE}
${HDR_PRIVATE}
${HDR_COMPAT}
${HDR_PUBLIC}
${SRC_CORE})
if (NOT EVENT__DISABLE_OPENSSL)
add_event_library(event_openssl
LIBRARIES event_core_shared ${OPENSSL_LIBRARIES}
SOURCES ${SRC_OPENSSL})
endif()
add_library(event_extra ${EVENT__LIBRARY_TYPE}
${HDR_PRIVATE}
${HDR_COMPAT}
${HDR_PUBLIC}
${SRC_CORE}
${SRC_EXTRA})
if (CMAKE_USE_PTHREADS_INIT)
set(SRC_PTHREADS evthread_pthread.c)
add_event_library(event_pthreads
LIBRARIES event_core_shared
SOURCES ${SRC_PTHREADS})
endif()
# library exists for historical reasons; it contains the contents of
# both libevent_core and libevent_extra. You shouldnt use it; it may
# go away in a future version of Libevent.
add_library(event ${EVENT__LIBRARY_TYPE}
${HDR_PRIVATE}
${HDR_COMPAT}
${HDR_PUBLIC}
${SRC_CORE}
${SRC_EXTRA})
if (EVENT__BUILD_SHARED_LIBRARIES)
# Prepare static library to be linked to tests that need hidden symbols
add_library(event_extra_static STATIC
${HDR_PRIVATE}
${HDR_COMPAT}
${HDR_PUBLIC}
${SRC_CORE}
${SRC_EXTRA})
set(EVENT_EXTRA_FOR_TEST event_extra_static)
target_link_libraries(event_core ${OPENSSL_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${LIB_PLATFORM})
target_link_libraries(event ${OPENSSL_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${LIB_PLATFORM})
target_link_libraries(event_extra ${OPENSSL_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${LIB_PLATFORM})
set_target_properties(event
PROPERTIES SOVERSION
${EVENT_ABI_LIBVERSION})
set_target_properties(event_core
PROPERTIES SOVERSION
${EVENT_ABI_LIBVERSION})
set_target_properties(event_extra
PROPERTIES SOVERSION
${EVENT_ABI_LIBVERSION})
else (EVENT__BUILD_SHARED_LIBRARIES)
set(EVENT_EXTRA_FOR_TEST event_extra)
endif (EVENT__BUILD_SHARED_LIBRARIES)
add_event_library(event SOURCES ${SRC_CORE} ${SRC_EXTRA})
#
# Samples.
#
macro(add_sample_prog ssl name)
add_executable(${name} ${ARGN})
target_link_libraries(${name}
event_extra_static
event_core_static
${LIB_APPS}
${LIB_PLATFORM})
add_dependencies(${name}
event_core_static
event_extra_static)
if (${ssl})
target_link_libraries(${name} event_openssl_static)
add_dependencies(${name} event_openssl_static)
endif()
endmacro()
if (NOT EVENT__DISABLE_SAMPLES)
set(SAMPLES
dns-example
@ -886,69 +848,72 @@ if (NOT EVENT__DISABLE_SAMPLES)
http-connect
time-test)
if (NOT EVENT__DISABLE_OPENSSL AND OPENSSL_LIBRARIES)
# Special sample with more than one file.
add_executable(https-client
sample/https-client.c
sample/openssl_hostname_validation.c
sample/hostcheck.c)
target_link_libraries(https-client
event_extra
${LIB_APPS}
${LIB_PLATFORM})
add_dependencies(https-client event_extra)
# Requires OpenSSL.
list(APPEND SAMPLES le-proxy)
endif()
foreach(SAMPLE ${SAMPLES})
add_executable(${SAMPLE}
sample/${SAMPLE}.c)
target_link_libraries(${SAMPLE}
event_extra
${LIB_APPS}
${LIB_PLATFORM})
add_dependencies(${SAMPLE} event_extra)
add_sample_prog(OFF ${SAMPLE} sample/${SAMPLE}.c)
endforeach()
if (NOT EVENT__DISABLE_OPENSSL)
add_sample_prog(ON https-client
sample/https-client.c
sample/openssl_hostname_validation.c
sample/hostcheck.c)
add_sample_prog(ON le-proxy
sample/le-proxy.c)
endif()
if (WIN32)
# requires cmake 3.1
target_sources(dns-example PUBLIC
WIN32-Code/getopt.c
WIN32-Code/getopt_long.c)
endif()
endif()
#
# Benchmarks
#
macro(add_bench_prog prog)
add_executable(${prog} test/${prog}.c)
if (WIN32)
list(APPEND BENCH_SRC
WIN32-Code/getopt.c
WIN32-Code/getopt_long.c)
endif()
target_link_libraries(${BENCHMARK}
event_extra_static
event_core_static
${LIB_APPS}
${LIB_PLATFORM})
add_dependencies(${BENCHMARK}
event_extra_static
event_core_static)
endmacro()
if (NOT EVENT__DISABLE_BENCHMARK)
foreach (BENCHMARK bench bench_cascade bench_http bench_httpclient)
set(BENCH_SRC test/${BENCHMARK}.c)
if (WIN32)
list(APPEND BENCH_SRC
WIN32-Code/getopt.c
WIN32-Code/getopt_long.c)
endif()
add_executable(${BENCHMARK} ${BENCH_SRC})
target_link_libraries(${BENCHMARK}
event_extra
${LIB_PLATFORM})
add_dependencies(${BENCHMARK} event_extra)
add_bench_prog(${BENCHMARK})
endforeach()
endif()
#
# Tests
#
macro(add_test_prog prog)
add_executable(${prog} test/${prog}.c)
target_link_libraries(${prog}
${LIB_APPS}
${LIB_PLATFORM}
event_core_shared
event_extra_shared
${ARGN})
add_dependencies(${prog}
event_core_shared
event_extra_shared)
endmacro()
if (NOT EVENT__DISABLE_TESTS)
#
# Generate Regress tests.
#
if (NOT EVENT__DISABLE_REGRESS)
# (We require python2 to generate the regress tests)
foreach (PY python2.6 python2.7 python2)
unset(FIND_PYTHON2 CACHE)
@ -980,34 +945,30 @@ if (NOT EVENT__DISABLE_TESTS)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
list(APPEND SRC_REGRESS
test/regress.c
test/regress.gen.c
test/regress.gen.h
test/regress_buffer.c
test/regress_bufferevent.c
test/regress_dns.c
test/regress_et.c
test/regress_finalize.c
test/regress_http.c
test/regress_listener.c
test/regress_main.c
test/regress_minheap.c
test/regress_rpc.c
test/regress_testutils.c
test/regress_testutils.h
test/regress_util.c
test/tinytest.c
${SRC_CORE}
${SRC_EXTRA})
test/regress.c
test/regress.gen.c
test/regress.gen.h
test/regress_buffer.c
test/regress_bufferevent.c
test/regress_dns.c
test/regress_et.c
test/regress_finalize.c
test/regress_http.c
test/regress_listener.c
test/regress_main.c
test/regress_minheap.c
test/regress_rpc.c
test/regress_testutils.c
test/regress_testutils.h
test/regress_util.c
test/tinytest.c)
if (WIN32)
list(APPEND SRC_REGRESS test/regress_iocp.c)
if (NOT EVENT__DISABLE_THREAD_SUPPORT)
list(APPEND SRC_REGRESS test/regress_thread.c)
endif()
endif()
if (CMAKE_USE_PTHREADS_INIT)
elseif (CMAKE_USE_PTHREADS_INIT)
list(APPEND SRC_REGRESS test/regress_thread.c)
endif()
@ -1015,7 +976,7 @@ if (NOT EVENT__DISABLE_TESTS)
list(APPEND SRC_REGRESS test/regress_zlib.c)
endif()
if (OPENSSL_LIBRARIES)
if (NOT EVENT__DISABLE_OPENSSL)
list(APPEND SRC_REGRESS test/regress_ssl.c)
endif()
@ -1025,13 +986,21 @@ if (NOT EVENT__DISABLE_TESTS)
# header trying to "dllimport" the symbols on windows (it
# generates a ton of warnings due to different link
# attributes for all of the symbols)
SET_TARGET_PROPERTIES(regress
PROPERTIES COMPILE_DEFINITIONS
"EVENT_BUILDING_REGRESS_TEST=1")
set_target_properties(regress
PROPERTIES COMPILE_DEFINITIONS
"EVENT_BUILDING_REGRESS_TEST=1")
target_link_libraries(regress
${LIB_APPS}
${LIB_PLATFORM})
${LIB_APPS}
${LIB_PLATFORM}
event_core_shared
event_extra_static)
if (NOT EVENT__DISABLE_OPENSSL)
target_link_libraries(regress event_openssl_shared)
endif()
if (CMAKE_USE_PTHREADS_INIT)
target_link_libraries(regress event_pthreads_shared)
endif()
else()
message(WARNING "No suitable Python interpreter found, cannot generate regress tests!")
endif()
@ -1040,44 +1009,41 @@ if (NOT EVENT__DISABLE_TESTS)
#
# Test programs.
#
# all of these, including the cmakelists.txt should be moved
# into the dirctory 'tests' first.
#
# doing this, we can remove all the DISABLE_TESTS stuff, and simply
# do something like:
#
# add_custom_targets(tests)
# add_executable(... EXCLUDE_FROM_ALL ...c)
# add_dependencis(tests testa testb testc)
# add_test(....)
#
# then you can just run 'make tests' instead of them all
# auto-compile|running
# - ellzey
set(TESTPROGS test-changelist
test-eof
test-fdleak
test-init
test-time
test-weof)
# all of these, including the cmakelists.txt should be moved
# into the dirctory 'tests' first.
#
# doing this, we can remove all the DISABLE_TESTS stuff, and simply
# do something like:
#
# add_custom_targets(tests)
# add_executable(... EXCLUDE_FROM_ALL ...c)
# add_dependencis(tests testa testb testc)
# add_test(....)
#
# then you can just run 'make tests' instead of them all
# auto-compile|running
# - ellzey
set(TESTPROGS test-changelist
test-eof
test-fdleak
test-init
test-time
test-weof)
foreach (TESTPROG ${TESTPROGS} test-dumpevents)
add_test_prog(${TESTPROG})
endforeach()
if (UNIX)
add_test_prog(test-ratelim m)
else()
add_test_prog(test-ratelim)
endif()
set(ALL_TESTPROGS
${TESTPROGS}
test-dumpevents
test-ratelim)
# Create test program executables.
foreach (TESTPROG ${ALL_TESTPROGS})
add_executable(${TESTPROG}
test/${TESTPROG}.c)
target_link_libraries(${TESTPROG}
${EVENT_EXTRA_FOR_TEST}
${LIB_PLATFORM})
add_dependencies(${TESTPROG}
${EVENT_EXTRA_FOR_TEST})
endforeach()
${TESTPROGS}
test-dumpevents
test-ratelim
)
#
# We run all tests with the different backends turned on one at a time.
@ -1131,12 +1097,12 @@ if (NOT EVENT__DISABLE_TESTS)
set(TEST_NAME ${TESTPROG}__${BACKEND_TEST_NAME})
add_test(${TEST_NAME}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTPROG})
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTPROG})
list(APPEND TEST_NAMES ${TEST_NAME})
set_tests_properties(${TEST_NAME}
PROPERTIES ENVIRONMENT "${ENV_VARS}")
PROPERTIES ENVIRONMENT "${ENV_VARS}")
endforeach()
# Dump events test.
@ -1144,21 +1110,21 @@ if (NOT EVENT__DISABLE_TESTS)
set(TEST_NAME test-dumpevents__${BACKEND_TEST_NAME})
add_test(${TEST_NAME}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-dumpevents |
${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/test/check-dumpevents.py)
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-dumpevents |
${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/test/check-dumpevents.py)
set_tests_properties(${TEST_NAME}
PROPERTIES ENVIRONMENT "${ENV_VARS}")
PROPERTIES ENVIRONMENT "${ENV_VARS}")
else()
message(WARNING "test-dumpevents will be run without output check since python was not found!")
set(TEST_NAME test-dumpevents__${BACKEND_TEST_NAME}_no_check)
add_test(${TEST_NAME}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-dumpevents)
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-dumpevents)
set_tests_properties(${TEST_NAME}
PROPERTIES ENVIRONMENT "${ENV_VARS}")
PROPERTIES ENVIRONMENT "${ENV_VARS}")
endif()
# Regress tests.
@ -1166,16 +1132,16 @@ if (NOT EVENT__DISABLE_TESTS)
set(TEST_NAME regress__${BACKEND_TEST_NAME})
add_test(${TEST_NAME}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/regress)
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/regress)
set_tests_properties(${TEST_NAME}
PROPERTIES ENVIRONMENT "${ENV_VARS}")
PROPERTIES ENVIRONMENT "${ENV_VARS}")
add_test(${TEST_NAME}_debug
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/regress)
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/regress)
set_tests_properties(${TEST_NAME}_debug
PROPERTIES ENVIRONMENT "${ENV_VARS};EVENT_DEBUG_MODE=1")
PROPERTIES ENVIRONMENT "${ENV_VARS};EVENT_DEBUG_MODE=1")
endif()
endmacro()
@ -1205,47 +1171,47 @@ if (NOT EVENT__DISABLE_TESTS)
#
# Group limits, no connection limit.
set(RL_BIN ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-ratelim)
set(RL_BIN ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-ratelim)
add_test(test-ratelim__group_lim
${RL_BIN}
-g 30000
-n 30
-t 100
--check-grouplimit 1000
--check-stddev 100)
${RL_BIN}
-g 30000
-n 30
-t 100
--check-grouplimit 1000
--check-stddev 100)
# Connection limit, no group limit.
add_test(test-ratelim__con_lim
${RL_BIN}
-c 1000
-n 30
-t 100
--check-connlimit 50
--check-stddev 50)
${RL_BIN}
-c 1000
-n 30
-t 100
--check-connlimit 50
--check-stddev 50)
# Connection limit and group limit.
add_test(test-ratelim__group_con_lim
${RL_BIN}
-c 1000
-g 30000
-n 30
-t 100
--check-grouplimit 1000
--check-connlimit 50
--check-stddev 50)
${RL_BIN}
-c 1000
-g 30000
-n 30
-t 100
--check-grouplimit 1000
--check-connlimit 50
--check-stddev 50)
# Connection limit and group limit with independent drain.
add_test(test-ratelim__group_con_lim_drain
${RL_BIN}
-c 1000
-g 35000
-n 30
-t 100
-G 500
--check-grouplimit 1000
--check-connlimit 50
--check-stddev 50)
${RL_BIN}
-c 1000
-g 35000
-n 30
-t 100
-G 500
--check-grouplimit 1000
--check-connlimit 50
--check-stddev 50)
# Add a "make verify" target, same as for autoconf.
# (Important! This will unset all EVENT_NO* environment variables.
@ -1265,21 +1231,20 @@ if (NOT EVENT__DISABLE_TESTS)
message(STATUS "${WINDOWS_CTEST_COMMAND}")
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/tmp/verify_tests.bat
DESTINATION
${CMAKE_CURRENT_BINARY_DIR}
FILE_PERMISSIONS
OWNER_READ
OWNER_WRITE
OWNER_EXECUTE
GROUP_READ
GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
FILE_PERMISSIONS
OWNER_READ
OWNER_WRITE
OWNER_EXECUTE
GROUP_READ
GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
file(TO_NATIVE_PATH
"${CMAKE_CURRENT_BINARY_DIR}/verify_tests.bat" VERIFY_PATH)
add_custom_target(verify COMMAND "${VERIFY_PATH}"
DEPENDS event ${ALL_TESTPROGS})
DEPENDS event ${ALL_TESTPROGS})
else()
# On some platforms doing exec(unset) as CMake does won't work, so make sure
# we run the unset command in a shell instead.
@ -1293,23 +1258,20 @@ if (NOT EVENT__DISABLE_TESTS)
# Then we copy the file (this allows us to set execute permission on it)
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/tmp/verify_tests.sh
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
FILE_PERMISSIONS
OWNER_READ
OWNER_WRITE
OWNER_EXECUTE
GROUP_READ
GROUP_EXECUTE
WORLD_READ
WORLD_EXECUTE)
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
FILE_PERMISSIONS
OWNER_READ
OWNER_WRITE
OWNER_EXECUTE
GROUP_READ
GROUP_EXECUTE
WORLD_READ
WORLD_EXECUTE)
# Create the target that runs the script.
add_custom_target(verify
COMMAND
${CMAKE_CURRENT_BINARY_DIR}/verify_tests.sh
DEPENDS
event
${ALL_TESTPROGS})
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/verify_tests.sh
DEPENDS event ${ALL_TESTPROGS})
endif()
if (NOT EVENT__DISABLE_REGRESS AND __FOUND_USABLE_PYTHON)
@ -1335,30 +1297,16 @@ endif()
# Installation preparation.
#
# Allow the user to override installation directories.
set(EVENT_INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
set(EVENT_INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
set(EVENT_INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
if(WIN32 AND NOT CYGWIN)
set(DEF_INSTALL_CMAKE_DIR cmake)
else()
set(DEF_INSTALL_CMAKE_DIR lib/cmake/libevent)
endif()
set(EVENT_INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files")
set(EVENT_INSTALL_CMAKE_DIR
"${CMAKE_INSTALL_PREFIX}/${DEF_INSTALL_CMAKE_DIR}"
CACHE PATH "Installation directory for CMake files")
# Make sure the paths are absolute.
foreach(p LIB BIN INCLUDE CMAKE)
set(var EVENT_INSTALL_${p}_DIR)
if(NOT IS_ABSOLUTE "${${var}}")
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
endforeach()
# Export targets (This is used for other CMake projects to easily find the libraries and include files).
export(TARGETS event event_extra event_core
FILE "${PROJECT_BINARY_DIR}/LibeventTargets.cmake")
export(PACKAGE libevent)
# Generate the config file for the build-tree.
@ -1371,70 +1319,47 @@ set(LIBEVENT_INCLUDE_DIRS
CACHE PATH "Libevent include directories")
configure_file(${PROJECT_SOURCE_DIR}/cmake/LibeventConfigBuildTree.cmake.in
${PROJECT_BINARY_DIR}/LibeventConfig.cmake
@ONLY)
${PROJECT_BINARY_DIR}/LibeventConfig.cmake
@ONLY)
# Generate the config file for the installation tree.
# Calculate the relative directory from the Cmake dir.
file(RELATIVE_PATH
REL_INCLUDE_DIR
"${EVENT_INSTALL_CMAKE_DIR}"
"${EVENT_INSTALL_INCLUDE_DIR}") # Calculate the relative directory from the Cmake dir.
REL_INCLUDE_DIR
"${EVENT_INSTALL_CMAKE_DIR}"
"${CMAKE_INSTALL_PREFIX}/include")
# Note the EVENT_CMAKE_DIR is defined in LibeventConfig.cmake.in,
# we escape it here so it's evaluated when it is included instead
# so that the include dirs are givenrelative to where the
# config file is located.
set(EVENT__INCLUDE_DIRS
"\${EVENT_CMAKE_DIR}/${REL_INCLUDE_DIR}")
set(EVENT__INCLUDE_DIRS "\${EVENT_CMAKE_DIR}/${REL_INCLUDE_DIR}")
configure_file(${PROJECT_SOURCE_DIR}/cmake/LibeventConfig.cmake.in
${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/LibeventConfig.cmake
@ONLY)
${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/LibeventConfig.cmake
@ONLY)
# Generate version info for both build-tree and install-tree.
configure_file(${PROJECT_SOURCE_DIR}/cmake/LibeventConfigVersion.cmake.in
${PROJECT_BINARY_DIR}/LibeventConfigVersion.cmake
@ONLY)
# Define the public headers.
set_target_properties(event event_core event_extra
PROPERTIES PUBLIC_HEADER "${HDR_PUBLIC}")
#
# Install targets.
#
install(TARGETS event event_core event_extra
EXPORT LibeventTargets
RUNTIME DESTINATION "${EVENT_INSTALL_BIN_DIR}" COMPONENT bin
LIBRARY DESTINATION "${EVENT_INSTALL_LIB_DIR}" COMPONENT lib
ARCHIVE DESTINATION "${EVENT_INSTALL_LIB_DIR}" COMPONENT lib
PUBLIC_HEADER DESTINATION "${EVENT_INSTALL_INCLUDE_DIR}/event2" COMPONENT dev)
${PROJECT_BINARY_DIR}/LibeventConfigVersion.cmake
@ONLY)
# Install compat headers
install(FILES ${HDR_COMPAT}
DESTINATION
"${EVENT_INSTALL_INCLUDE_DIR}"
COMPONENT dev)
DESTINATION "include"
COMPONENT dev)
# Install the configs.
install(FILES
${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/LibeventConfig.cmake
${PROJECT_BINARY_DIR}/LibeventConfigVersion.cmake
DESTINATION
"${EVENT_INSTALL_CMAKE_DIR}"
${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/LibeventConfig.cmake
${PROJECT_BINARY_DIR}/LibeventConfigVersion.cmake
DESTINATION "${EVENT_INSTALL_CMAKE_DIR}"
COMPONENT dev)
# Install exports for the install-tree.
install(EXPORT LibeventTargets
DESTINATION
"${EVENT_INSTALL_CMAKE_DIR}"
COMPONENT dev)
set(LIBEVENT_LIBRARIES
event
event_core
event_extra
CACHE STRING "Libevent libraries")
DESTINATION "${DEF_INSTALL_CMAKE_DIR}"
COMPONENT dev)
message(STATUS "")
message(STATUS " ---( Libevent " ${EVENT_VERSION} " )---")

View File

@ -26,21 +26,9 @@ The following Libevent specific Cmake variables are as follows (the values being
the default).
```
# Installation directory for executables
EVENT_INSTALL_BIN_DIR:PATH=bin
# Installation directory for CMake files
EVENT_INSTALL_CMAKE_DIR:PATH=lib/cmake/libevent
## Installation directory for header files
EVENT_INSTALL_INCLUDE_DIR:PATH=include
## Installation directory for libraries
EVENT_INSTALL_LIB_DIR:PATH=lib
## Define if libevent should be built with shared libraries instead of archives
EVENT__BUILD_SHARED_LIBRARIES:BOOL=OFF
# Enable running gcov to get a test coverage report (only works with
# GCC/CLang). Make sure to enable -DCMAKE_BUILD_TYPE=Debug as well.
EVENT__COVERAGE:BOOL=OFF

View File

@ -314,13 +314,16 @@ extern const struct bufferevent_ops bufferevent_ops_async;
#endif
/** Initialize the shared parts of a bufferevent. */
EVENT2_EXPORT_SYMBOL
int bufferevent_init_common_(struct bufferevent_private *, struct event_base *, const struct bufferevent_ops *, enum bufferevent_options options);
/** For internal use: temporarily stop all reads on bufev, until the conditions
* in 'what' are over. */
EVENT2_EXPORT_SYMBOL
void bufferevent_suspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags what);
/** For internal use: clear the conditions 'what' on bufev, and re-enable
* reading if there are no conditions left. */
EVENT2_EXPORT_SYMBOL
void bufferevent_unsuspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags what);
/** For internal use: temporarily stop all writes on bufev, until the conditions
@ -347,16 +350,19 @@ void bufferevent_unsuspend_write_(struct bufferevent *bufev, bufferevent_suspend
@return 0 if successful, or -1 if an error occurred
@see bufferevent_disable()
*/
EVENT2_EXPORT_SYMBOL
int bufferevent_disable_hard_(struct bufferevent *bufev, short event);
/** Internal: Set up locking on a bufferevent. If lock is set, use it.
* Otherwise, use a new lock. */
EVENT2_EXPORT_SYMBOL
int bufferevent_enable_locking_(struct bufferevent *bufev, void *lock);
/** Internal: backwards compat macro for the now public function
* Increment the reference count on bufev. */
#define bufferevent_incref_(bufev) bufferevent_incref(bufev)
/** Internal: Lock bufev and increase its reference count.
* unlocking it otherwise. */
EVENT2_EXPORT_SYMBOL
void bufferevent_incref_and_lock_(struct bufferevent *bufev);
/** Internal: backwards compat macro for the now public function
* Decrement the reference count on bufev. Returns 1 if it freed
@ -365,17 +371,21 @@ void bufferevent_incref_and_lock_(struct bufferevent *bufev);
/** Internal: Drop the reference count on bufev, freeing as necessary, and
* unlocking it otherwise. Returns 1 if it freed the bufferevent. */
EVENT2_EXPORT_SYMBOL
int bufferevent_decref_and_unlock_(struct bufferevent *bufev);
/** Internal: If callbacks are deferred and we have a read callback, schedule
* a readcb. Otherwise just run the readcb. Ignores watermarks. */
EVENT2_EXPORT_SYMBOL
void bufferevent_run_readcb_(struct bufferevent *bufev, int options);
/** Internal: If callbacks are deferred and we have a write callback, schedule
* a writecb. Otherwise just run the writecb. Ignores watermarks. */
EVENT2_EXPORT_SYMBOL
void bufferevent_run_writecb_(struct bufferevent *bufev, int options);
/** Internal: If callbacks are deferred and we have an eventcb, schedule
* it to run with events "what". Otherwise just run the eventcb.
* See bufferevent_trigger_event for meaning of "options". */
EVENT2_EXPORT_SYMBOL
void bufferevent_run_eventcb_(struct bufferevent *bufev, short what, int options);
/** Internal: Run or schedule (if deferred or options contain
@ -399,6 +409,7 @@ bufferevent_trigger_nolock_(struct bufferevent *bufev, short iotype, int options
/** Internal: Add the event 'ev' with timeout tv, unless tv is set to 0, in
* which case add ev with no timeout. */
EVENT2_EXPORT_SYMBOL
int bufferevent_add_event_(struct event *ev, const struct timeval *tv);
/* =========
@ -408,16 +419,21 @@ int bufferevent_add_event_(struct event *ev, const struct timeval *tv);
/** Internal use: Set up the ev_read and ev_write callbacks so that
* the other "generic_timeout" functions will work on it. Call this from
* the constructor function. */
EVENT2_EXPORT_SYMBOL
void bufferevent_init_generic_timeout_cbs_(struct bufferevent *bev);
/** Internal use: Add or delete the generic timeout events as appropriate.
* (If an event is enabled and a timeout is set, we add the event. Otherwise
* we delete it.) Call this from anything that changes the timeout values,
* that enabled EV_READ or EV_WRITE, or that disables EV_READ or EV_WRITE. */
EVENT2_EXPORT_SYMBOL
int bufferevent_generic_adj_timeouts_(struct bufferevent *bev);
EVENT2_EXPORT_SYMBOL
int bufferevent_generic_adj_existing_timeouts_(struct bufferevent *bev);
EVENT2_EXPORT_SYMBOL
enum bufferevent_options bufferevent_get_options_(struct bufferevent *bev);
EVENT2_EXPORT_SYMBOL
const struct sockaddr*
bufferevent_socket_get_conn_address_(struct bufferevent *bev);
@ -465,11 +481,15 @@ bufferevent_socket_get_conn_address_(struct bufferevent *bev);
/* ==== For rate-limiting. */
EVENT2_EXPORT_SYMBOL
int bufferevent_decrement_write_buckets_(struct bufferevent_private *bev,
ev_ssize_t bytes);
EVENT2_EXPORT_SYMBOL
int bufferevent_decrement_read_buckets_(struct bufferevent_private *bev,
ev_ssize_t bytes);
EVENT2_EXPORT_SYMBOL
ev_ssize_t bufferevent_get_read_max_(struct bufferevent_private *bev);
EVENT2_EXPORT_SYMBOL
ev_ssize_t bufferevent_get_write_max_(struct bufferevent_private *bev);
int bufferevent_ratelim_init_(struct bufferevent_private *bev);

108
cmake/AddEventLibrary.cmake Normal file
View File

@ -0,0 +1,108 @@
include(CMakeParseArguments)
set(LIBEVENT_SHARED_LIBRARIES "")
set(LIBEVENT_STATIC_LIBRARIES "")
macro(set_event_lib_properties LIB_NAME)
set_target_properties("${LIB_NAME}_static" PROPERTIES ${ARGN})
set_target_properties("${LIB_NAME}_shared" PROPERTIES ${ARGN})
endmacro()
macro(set_event_shared_lib_flags LIB_NAME)
set_target_properties("${LIB_NAME}_shared" PROPERTIES
COMPILE_FLAGS ${ARGN})
set_target_properties("${LIB_NAME}_shared" PROPERTIES
LINK_FLAGS ${ARGN})
endmacro()
macro(generate_pkgconfig LIB_NAME)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
set(VERSION ${EVENT_ABI_LIBVERSION})
set(LIBS "")
foreach (LIB ${LIB_PLATFORM})
set(OPENSSL_LIBS "${LIBS} -L${LIB}")
endforeach()
set(OPENSSL_LIBS "")
foreach(LIB ${OPENSSL_LIBRARIES})
set(OPENSSL_LIBS "${LIBS} -L${LIB}")
endforeach()
configure_file("lib${LIB_NAME}.pc.in" "lib${LIB_NAME}.pc" @ONLY)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/lib${LIB_NAME}.pc"
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig"
)
endmacro()
# Global variables that it uses:
# - EVENT_ABI_LIBVERSION
# - CMAKE_THREAD_LIBS_INIT LIB_PLATFORM
# - OPENSSL_LIBRARIES
# - HDR_PUBLIC
# - EVENT_INSTALL_INCLUDE_DIR
# - EVENT_SHARED_FLAGS
#
# Exported variables:
# - LIBEVENT_SHARED_LIBRARIES
# - LIBEVENT_STATIC_LIBRARIES
macro(add_event_library LIB_NAME)
cmake_parse_arguments(LIB
"" # Options
"VERSION" # One val
"SOURCES;LIBRARIES" # Multi val
${ARGN}
)
add_library("${LIB_NAME}_static" STATIC ${LIB_SOURCES})
add_library("${LIB_NAME}_shared" SHARED ${LIB_SOURCES})
target_link_libraries("${LIB_NAME}_shared"
${CMAKE_THREAD_LIBS_INIT}
${LIB_PLATFORM}
${LIB_LIBRARIES})
if (EVENT_SHARED_FLAGS)
set_event_shared_lib_flags("${LIB_NAME}" "${EVENT_SHARED_FLAGS}")
endif()
set_event_lib_properties("${LIB_NAME}"
OUTPUT_NAME "${LIB_NAME}"
CLEAN_DIRECT_OUTPUT 1
)
set_target_properties(
"${LIB_NAME}_shared" PROPERTIES
PUBLIC_HEADER "${HDR_PUBLIC}")
set_target_properties(
"${LIB_NAME}_static" PROPERTIES
PUBLIC_HEADER "${HDR_PUBLIC}")
set_target_properties(
"${LIB_NAME}_shared" PROPERTIES
SOVERSION ${EVENT_ABI_LIBVERSION}
)
export(TARGETS "${LIB_NAME}_static" "${LIB_NAME}_shared"
FILE "${PROJECT_BINARY_DIR}/LibeventTargets.cmake"
)
install(TARGETS "${LIB_NAME}_static" "${LIB_NAME}_shared"
EXPORT LibeventTargets
LIBRARY DESTINATION "lib" COMPONENT lib
ARCHIVE DESTINATION "lib" COMPONENT lib
PUBLIC_HEADER DESTINATION "include/event2"
COMPONENT dev
)
list(APPEND LIBEVENT_SHARED_LIBRARIES "${LIB_NAME}_shared")
list(APPEND LIBEVENT_STATIC_LIBRARIES "${LIB_NAME}_static")
generate_pkgconfig("${LIB_NAME}")
endmacro()

View File

@ -1,7 +1,8 @@
# - Config file for the Libevent package
# It defines the following variables
# LIBEVENT_INCLUDE_DIRS - include directories for FooBar
# LIBEVENT_LIBRARIES - libraries to link against
# LIBEVENT_INCLUDE_DIRS - include directories
# LIBEVENT_STATIC_LIBRARIES - libraries to link against (archive/static)
# LIBEVENT_SHARED_LIBRARIES - libraries to link against (shared)
# Get the path of the current file.
get_filename_component(LIBEVENT_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
@ -13,5 +14,5 @@ set(LIBEVENT_INCLUDE_DIRS "@EVENT_INSTALL_INCLUDE_DIR@")
include(${LIBEVENT_CMAKE_DIR}/LibeventTargets.cmake)
# IMPORTED targets from LibeventTargets.cmake
set(LIBEVENT_LIBRARIES event event_core event_extra)
set(LIBEVENT_STATIC_LIBRARIES "@LIBEVENT_STATIC_LIBRARIES@")
set(LIBEVENT_SHARED_LIBRARIES "@LIBEVENT_SHARED_LIBRARIES@")

View File

@ -46,6 +46,7 @@ typedef void (*deferred_cb_fn)(struct event_callback *, void *);
@param cb The function to run when the struct event_callback executes.
@param arg The function's second argument.
*/
EVENT2_EXPORT_SYMBOL
void event_deferred_cb_init_(struct event_callback *, ev_uint8_t, deferred_cb_fn, void *);
/**
Change the priority of a non-pending event_callback.
@ -54,12 +55,14 @@ void event_deferred_cb_set_priority_(struct event_callback *, ev_uint8_t);
/**
Cancel a struct event_callback if it is currently scheduled in an event_base.
*/
EVENT2_EXPORT_SYMBOL
void event_deferred_cb_cancel_(struct event_base *, struct event_callback *);
/**
Activate a struct event_callback if it is not currently scheduled in an event_base.
Return true if it was not previously scheduled.
*/
EVENT2_EXPORT_SYMBOL
int event_deferred_cb_schedule_(struct event_base *, struct event_callback *);
#ifdef __cplusplus

View File

@ -524,6 +524,4 @@
/* Define to `int' if <sys/types.h> does not define. */
#define EVENT__ssize_t @EVENT__ssize_t@
#cmakedefine EVENT__NEED_DLLIMPORT 1
#endif /* \EVENT2_EVENT_CONFIG_H_INCLUDED_ */

View File

@ -421,16 +421,19 @@ int event_del_nolock_(struct event *ev, int blocking);
int event_remove_timer_nolock_(struct event *ev);
void event_active_nolock_(struct event *ev, int res, short count);
EVENT2_EXPORT_SYMBOL
int event_callback_activate_(struct event_base *, struct event_callback *);
int event_callback_activate_nolock_(struct event_base *, struct event_callback *);
int event_callback_cancel_(struct event_base *base,
struct event_callback *evcb);
void event_callback_finalize_nolock_(struct event_base *base, unsigned flags, struct event_callback *evcb, void (*cb)(struct event_callback *, void *));
EVENT2_EXPORT_SYMBOL
void event_callback_finalize_(struct event_base *base, unsigned flags, struct event_callback *evcb, void (*cb)(struct event_callback *, void *));
int event_callback_finalize_many_(struct event_base *base, int n_cbs, struct event_callback **evcb, void (*cb)(struct event_callback *, void *));
EVENT2_EXPORT_SYMBOL
void event_active_later_(struct event *ev, int res);
void event_active_later_nolock_(struct event *ev, int res);
int event_callback_activate_later_nolock_(struct event_base *base,
@ -441,6 +444,7 @@ void event_callback_init_(struct event_base *base,
struct event_callback *cb);
/* FIXME document. */
EVENT2_EXPORT_SYMBOL
void event_base_add_virtual_(struct event_base *base);
void event_base_del_virtual_(struct event_base *base);
@ -450,6 +454,7 @@ void event_base_del_virtual_(struct event_base *base);
Returns on success; aborts on failure.
*/
EVENT2_EXPORT_SYMBOL
void event_base_assert_ok_(struct event_base *base);
void event_base_assert_ok_nolock_(struct event_base *base);

View File

@ -123,6 +123,7 @@ static const struct eventop *eventops[] = {
};
/* Global state; deprecated */
EVENT2_EXPORT_SYMBOL
struct event_base *event_global_current_base_ = NULL;
#define current_base event_global_current_base_

View File

@ -93,9 +93,13 @@
a final padding nibble with value 0 is appended.
*/
EVENT2_EXPORT_SYMBOL
int evtag_decode_int(ev_uint32_t *pnumber, struct evbuffer *evbuf);
EVENT2_EXPORT_SYMBOL
int evtag_decode_int64(ev_uint64_t *pnumber, struct evbuffer *evbuf);
EVENT2_EXPORT_SYMBOL
int evtag_encode_tag(struct evbuffer *evbuf, ev_uint32_t tag);
EVENT2_EXPORT_SYMBOL
int evtag_decode_tag(ev_uint32_t *ptag, struct evbuffer *evbuf);
void

View File

@ -49,9 +49,12 @@ struct event_base;
#if ! defined(EVENT__DISABLE_THREAD_SUPPORT) && defined(EVTHREAD_EXPOSE_STRUCTS)
/* Global function pointers to lock-related functions. NULL if locking isn't
enabled. */
EVENT2_EXPORT_SYMBOL
extern struct evthread_lock_callbacks evthread_lock_fns_;
EVENT2_EXPORT_SYMBOL
extern struct evthread_condition_callbacks evthread_cond_fns_;
extern unsigned long (*evthread_id_fn_)(void);
EVENT2_EXPORT_SYMBOL
extern int evthread_lock_debugging_enabled_;
/** Return the ID of the current thread, or 1 if threading isn't enabled. */
@ -355,6 +358,7 @@ EVLOCK_TRY_LOCK_(void *lock)
EVLOCK_UNLOCK(lock1_tmplock_,mode1); \
} while (0)
EVENT2_EXPORT_SYMBOL
int evthread_is_debug_lock_held_(void *lock);
void *evthread_debug_get_real_lock_(void *lock);
@ -377,6 +381,7 @@ int evutil_global_setup_locks_(const int enable_locks);
int evutil_secure_rng_global_setup_locks_(const int enable_locks);
/** Return current evthread_lock_callbacks */
EVENT2_EXPORT_SYMBOL
struct evthread_lock_callbacks *evthread_get_lock_callbacks(void);
/** Return current evthread_condition_callbacks */
struct evthread_condition_callbacks *evthread_get_condition_callbacks(void);

View File

@ -46,7 +46,7 @@
#endif
#ifndef EVENT__DISABLE_DEBUG_MODE
extern int event_debug_created_threadable_ctx_;
extern int event_debug_created_threadable_ctx_;
extern int event_debug_mode_on_;
#endif

View File

@ -184,12 +184,15 @@ int evhttp_connection_connect_(struct evhttp_connection *);
enum evhttp_request_error;
/* notifies the current request that it failed; resets connection */
EVENT2_EXPORT_SYMBOL
void evhttp_connection_fail_(struct evhttp_connection *,
enum evhttp_request_error error);
enum message_read_status;
EVENT2_EXPORT_SYMBOL
enum message_read_status evhttp_parse_firstline_(struct evhttp_request *, struct evbuffer*);
EVENT2_EXPORT_SYMBOL
enum message_read_status evhttp_parse_headers_(struct evhttp_request *, struct evbuffer*);
void evhttp_start_read_(struct evhttp_connection *);
@ -199,6 +202,7 @@ void evhttp_start_write_(struct evhttp_connection *);
void evhttp_response_code_(struct evhttp_request *, int, const char *);
void evhttp_send_page_(struct evhttp_request *, struct evbuffer *);
EVENT2_EXPORT_SYMBOL
int evhttp_decode_uri_internal(const char *uri, size_t length,
char *ret, int decode_plus);

View File

@ -28,6 +28,8 @@
#ifndef EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
#define EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
#include <event2/visibility.h>
#define evbuffercb bufferevent_data_cb
#define everrorcb bufferevent_event_cb
@ -72,6 +74,7 @@
error occurred
@see bufferevent_base_set(), bufferevent_free()
*/
EVENT2_EXPORT_SYMBOL
struct bufferevent *bufferevent_new(evutil_socket_t fd,
evbuffercb readcb, evbuffercb writecb, everrorcb errorcb, void *cbarg);
@ -83,6 +86,7 @@ struct bufferevent *bufferevent_new(evutil_socket_t fd,
@param timeout_read the read timeout
@param timeout_write the write timeout
*/
EVENT2_EXPORT_SYMBOL
void bufferevent_settimeout(struct bufferevent *bufev,
int timeout_read, int timeout_write);

View File

@ -49,6 +49,7 @@ extern "C" {
/* For int types. */
#include <event2/util.h>
#include <event2/visibility.h>
/**
Initialize the asynchronous DNS library.
@ -66,6 +67,7 @@ extern "C" {
@return 0 if successful, or -1 if an error occurred
@see evdns_shutdown()
*/
EVENT2_EXPORT_SYMBOL
int evdns_init(void);
struct evdns_base;
@ -76,6 +78,7 @@ struct evdns_base;
@deprecated This function is deprecated because use of the global
evdns_base is error-prone.
*/
EVENT2_EXPORT_SYMBOL
struct evdns_base *evdns_get_global_base(void);
/**
@ -93,6 +96,7 @@ struct evdns_base *evdns_get_global_base(void);
active requests will return DNS_ERR_SHUTDOWN.
@see evdns_init()
*/
EVENT2_EXPORT_SYMBOL
void evdns_shutdown(int fail_requests);
/**
@ -109,6 +113,7 @@ void evdns_shutdown(int fail_requests);
@return 0 if successful, or -1 if an error occurred
@see evdns_nameserver_ip_add()
*/
EVENT2_EXPORT_SYMBOL
int evdns_nameserver_add(unsigned long int address);
/**
@ -126,6 +131,7 @@ int evdns_nameserver_add(unsigned long int address);
@return the number of configured nameservers
@see evdns_nameserver_add()
*/
EVENT2_EXPORT_SYMBOL
int evdns_count_nameservers(void);
/**
@ -140,6 +146,7 @@ int evdns_count_nameservers(void);
@return 0 if successful, or -1 if an error occurred
@see evdns_resume()
*/
EVENT2_EXPORT_SYMBOL
int evdns_clear_nameservers_and_suspend(void);
/**
@ -155,6 +162,7 @@ int evdns_clear_nameservers_and_suspend(void);
@return 0 if successful, or -1 if an error occurred
@see evdns_clear_nameservers_and_suspend()
*/
EVENT2_EXPORT_SYMBOL
int evdns_resume(void);
/**
@ -170,6 +178,7 @@ int evdns_resume(void);
@return 0 if successful, or -1 if an error occurred
@see evdns_nameserver_add()
*/
EVENT2_EXPORT_SYMBOL
int evdns_nameserver_ip_add(const char *ip_as_string);
/**
@ -186,6 +195,7 @@ int evdns_nameserver_ip_add(const char *ip_as_string);
@return 0 if successful, or -1 if an error occurred
@see evdns_resolve_ipv6(), evdns_resolve_reverse(), evdns_resolve_reverse_ipv6()
*/
EVENT2_EXPORT_SYMBOL
int evdns_resolve_ipv4(const char *name, int flags, evdns_callback_type callback, void *ptr);
/**
@ -198,6 +208,7 @@ int evdns_resolve_ipv4(const char *name, int flags, evdns_callback_type callback
@return 0 if successful, or -1 if an error occurred
@see evdns_resolve_ipv4(), evdns_resolve_reverse(), evdns_resolve_reverse_ipv6()
*/
EVENT2_EXPORT_SYMBOL
int evdns_resolve_ipv6(const char *name, int flags, evdns_callback_type callback, void *ptr);
struct in_addr;
@ -217,6 +228,7 @@ struct in6_addr;
@return 0 if successful, or -1 if an error occurred
@see evdns_resolve_reverse_ipv6()
*/
EVENT2_EXPORT_SYMBOL
int evdns_resolve_reverse(const struct in_addr *in, int flags, evdns_callback_type callback, void *ptr);
/**
@ -233,6 +245,7 @@ int evdns_resolve_reverse(const struct in_addr *in, int flags, evdns_callback_ty
@return 0 if successful, or -1 if an error occurred
@see evdns_resolve_reverse_ipv6()
*/
EVENT2_EXPORT_SYMBOL
int evdns_resolve_reverse_ipv6(const struct in6_addr *in, int flags, evdns_callback_type callback, void *ptr);
/**
@ -251,6 +264,7 @@ int evdns_resolve_reverse_ipv6(const struct in6_addr *in, int flags, evdns_callb
@param flags Ignored.
@return 0 if successful, or -1 if an error occurred
*/
EVENT2_EXPORT_SYMBOL
int evdns_set_option(const char *option, const char *val, int flags);
/**
@ -278,6 +292,7 @@ int evdns_set_option(const char *option, const char *val, int flags);
occurred (see above)
@see resolv.conf(3), evdns_config_windows_nameservers()
*/
EVENT2_EXPORT_SYMBOL
int evdns_resolv_conf_parse(int flags, const char *const filename);
/**
@ -287,6 +302,7 @@ int evdns_resolv_conf_parse(int flags, const char *const filename);
caller to specify which evdns_base it applies to. The recommended
function is evdns_base_search_clear().
*/
EVENT2_EXPORT_SYMBOL
void evdns_search_clear(void);
/**
@ -298,6 +314,7 @@ void evdns_search_clear(void);
@param domain the domain to be added to the search list
*/
EVENT2_EXPORT_SYMBOL
void evdns_search_add(const char *domain);
/**
@ -312,6 +329,7 @@ void evdns_search_add(const char *domain);
@param ndots the new ndots parameter
*/
EVENT2_EXPORT_SYMBOL
void evdns_search_ndots_set(const int ndots);
/**
@ -322,9 +340,13 @@ void evdns_search_ndots_set(const int ndots);
function is evdns_add_server_port_with_base().
*/
struct evdns_server_port *evdns_add_server_port(evutil_socket_t socket, int flags, evdns_request_callback_fn_type callback, void *user_data);
EVENT2_EXPORT_SYMBOL
struct evdns_server_port *
evdns_add_server_port(evutil_socket_t socket, int flags,
evdns_request_callback_fn_type callback, void *user_data);
#ifdef _WIN32
EVENT2_EXPORT_SYMBOL
int evdns_config_windows_nameservers(void);
#define EVDNS_CONFIG_WINDOWS_NAMESERVERS_IMPLEMENTED
#endif

View File

@ -58,6 +58,7 @@ extern "C" {
* @param port the port number on which the HTTP server should listen
* @return an struct evhttp object
*/
EVENT2_EXPORT_SYMBOL
struct evhttp *evhttp_start(const char *address, ev_uint16_t port);
/**
@ -67,6 +68,7 @@ struct evhttp *evhttp_start(const char *address, ev_uint16_t port);
*
* @deprecated It does not allow an event base to be specified
*/
EVENT2_EXPORT_SYMBOL
struct evhttp_connection *evhttp_connection_new(
const char *address, ev_uint16_t port);
@ -76,6 +78,7 @@ struct evhttp_connection *evhttp_connection_new(
*
* @deprecated XXXX Why?
*/
EVENT2_EXPORT_SYMBOL
void evhttp_connection_set_base(struct evhttp_connection *evcon,
struct event_base *base);

View File

@ -27,6 +27,8 @@
#ifndef EVENT2_RPC_H_INCLUDED_
#define EVENT2_RPC_H_INCLUDED_
#include <event2/visibility.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -178,6 +180,7 @@ EVRPC_STRUCT(rpcname) { \
struct evhttp_request* http_req; \
struct evbuffer* rpc_data; \
}; \
EVENT2_EXPORT_SYMBOL \
int evrpc_send_request_##rpcname(struct evrpc_pool *, \
struct reqstruct *, struct rplystruct *, \
void (*)(struct evrpc_status *, \
@ -187,6 +190,7 @@ int evrpc_send_request_##rpcname(struct evrpc_pool *, \
struct evrpc_pool;
/** use EVRPC_GENERATE instead */
EVENT2_EXPORT_SYMBOL
struct evrpc_request_wrapper *evrpc_make_request_ctx(
struct evrpc_pool *pool, void *request, void *reply,
const char *rpcname,
@ -257,10 +261,13 @@ struct evrpc_request_wrapper *evrpc_make_request_ctx(
#define EVRPC_REQUEST_HTTP(rpc_req) (rpc_req)->http_req
/** completes the server response to an rpc request */
EVENT2_EXPORT_SYMBOL
void evrpc_request_done(struct evrpc_req_generic *req);
/** accessors for request and reply */
EVENT2_EXPORT_SYMBOL
void *evrpc_get_request(struct evrpc_req_generic *req);
EVENT2_EXPORT_SYMBOL
void *evrpc_get_reply(struct evrpc_req_generic *req);
/** Creates the reply to an RPC request
@ -288,6 +295,7 @@ struct evhttp;
* @return a newly allocated evrpc_base struct
* @see evrpc_free()
*/
EVENT2_EXPORT_SYMBOL
struct evrpc_base *evrpc_init(struct evhttp *server);
/**
@ -298,6 +306,7 @@ struct evrpc_base *evrpc_init(struct evhttp *server);
* @param base the evrpc_base object to be freed
* @see evrpc_init
*/
EVENT2_EXPORT_SYMBOL
void evrpc_free(struct evrpc_base *base);
/** register RPCs with the HTTP Server
@ -334,6 +343,7 @@ void evrpc_free(struct evrpc_base *base);
@see EVRPC_REGISTER()
*/
EVENT2_EXPORT_SYMBOL
int evrpc_register_rpc(struct evrpc_base *, struct evrpc *,
void (*)(struct evrpc_req_generic*, void *), void *);
@ -347,6 +357,7 @@ int evrpc_register_rpc(struct evrpc_base *, struct evrpc *,
*/
#define EVRPC_UNREGISTER(base, name) evrpc_unregister_rpc((base), #name)
EVENT2_EXPORT_SYMBOL
int evrpc_unregister_rpc(struct evrpc_base *base, const char *name);
/*
@ -385,6 +396,7 @@ struct evrpc_status;
@returns 0 on success, -1 otherwise.
@see EVRPC_MAKE_REQUEST(), EVRPC_MAKE_CTX()
*/
EVENT2_EXPORT_SYMBOL
int evrpc_make_request(struct evrpc_request_wrapper *ctx);
/** creates an rpc connection pool
@ -397,12 +409,14 @@ int evrpc_make_request(struct evrpc_request_wrapper *ctx);
* @return a newly allocated struct evrpc_pool object
* @see evrpc_pool_free()
*/
EVENT2_EXPORT_SYMBOL
struct evrpc_pool *evrpc_pool_new(struct event_base *base);
/** frees an rpc connection pool
*
* @param pool a pointer to an evrpc_pool allocated via evrpc_pool_new()
* @see evrpc_pool_new()
*/
EVENT2_EXPORT_SYMBOL
void evrpc_pool_free(struct evrpc_pool *pool);
/**
@ -413,6 +427,7 @@ void evrpc_pool_free(struct evrpc_pool *pool);
* @param pool the pool to which to add the connection
* @param evcon the connection to add to the pool.
*/
EVENT2_EXPORT_SYMBOL
void evrpc_pool_add_connection(struct evrpc_pool *pool,
struct evhttp_connection *evcon);
@ -424,6 +439,7 @@ void evrpc_pool_add_connection(struct evrpc_pool *pool,
* @param pool the pool from which to remove the connection
* @param evcon the connection to remove from the pool.
*/
EVENT2_EXPORT_SYMBOL
void evrpc_pool_remove_connection(struct evrpc_pool *pool,
struct evhttp_connection *evcon);
@ -442,6 +458,7 @@ void evrpc_pool_remove_connection(struct evrpc_pool *pool,
* @param timeout_in_secs the number of seconds after which a request should
* timeout and a failure be returned to the callback.
*/
EVENT2_EXPORT_SYMBOL
void evrpc_pool_set_timeout(struct evrpc_pool *pool, int timeout_in_secs);
/**
@ -489,6 +506,7 @@ enum EVRPC_HOOK_RESULT {
* @return a handle to the hook so it can be removed later
* @see evrpc_remove_hook()
*/
EVENT2_EXPORT_SYMBOL
void *evrpc_add_hook(void *vbase,
enum EVRPC_HOOK_TYPE hook_type,
int (*cb)(void *, struct evhttp_request *, struct evbuffer *, void *),
@ -502,6 +520,7 @@ void *evrpc_add_hook(void *vbase,
* @return 1 on success or 0 on failure
* @see evrpc_add_hook()
*/
EVENT2_EXPORT_SYMBOL
int evrpc_remove_hook(void *vbase,
enum EVRPC_HOOK_TYPE hook_type,
void *handle);
@ -511,8 +530,8 @@ int evrpc_remove_hook(void *vbase,
* @param vbase a pointer to either struct evrpc_base or struct evrpc_pool
* @param ctx the context pointer provided to the original hook call
*/
int
evrpc_resume_request(void *vbase, void *ctx, enum EVRPC_HOOK_RESULT res);
EVENT2_EXPORT_SYMBOL
int evrpc_resume_request(void *vbase, void *ctx, enum EVRPC_HOOK_RESULT res);
/** adds meta data to request
*
@ -525,6 +544,7 @@ evrpc_resume_request(void *vbase, void *ctx, enum EVRPC_HOOK_RESULT res);
* @param data the data to be associated with the key
* @param data_size the size of the data
*/
EVENT2_EXPORT_SYMBOL
void evrpc_hook_add_meta(void *ctx, const char *key,
const void *data, size_t data_size);
@ -538,6 +558,7 @@ void evrpc_hook_add_meta(void *ctx, const char *key,
* @param data_size pointer to the size of the data
* @return 0 on success or -1 on failure
*/
EVENT2_EXPORT_SYMBOL
int evrpc_hook_find_meta(void *ctx, const char *key,
void **data, size_t *data_size);
@ -547,6 +568,7 @@ int evrpc_hook_find_meta(void *ctx, const char *key,
* @param ctx the context provided to the hook call
* @return a pointer to the evhttp_connection object
*/
EVENT2_EXPORT_SYMBOL
struct evhttp_connection *evrpc_hook_get_connection(void *ctx);
/**
@ -556,6 +578,7 @@ struct evhttp_connection *evrpc_hook_get_connection(void *ctx);
@see EVRPC_MAKE_REQUEST()
*/
EVENT2_EXPORT_SYMBOL
int evrpc_send_request_generic(struct evrpc_pool *pool,
void *request, void *reply,
void (*cb)(struct evrpc_status *, void *, void *, void *),
@ -572,8 +595,8 @@ int evrpc_send_request_generic(struct evrpc_pool *pool,
@see EVRPC_REGISTER()
*/
int
evrpc_register_generic(struct evrpc_base *base, const char *name,
EVENT2_EXPORT_SYMBOL
int evrpc_register_generic(struct evrpc_base *base, const char *name,
void (*callback)(struct evrpc_req_generic *, void *), void *cbarg,
void *(*req_new)(void *), void *req_new_arg, void (*req_free)(void *),
int (*req_unmarshal)(void *, struct evbuffer *),
@ -582,9 +605,12 @@ evrpc_register_generic(struct evrpc_base *base, const char *name,
void (*rpl_marshal)(struct evbuffer *, void *));
/** accessors for obscure and undocumented functionality */
EVENT2_EXPORT_SYMBOL
struct evrpc_pool* evrpc_request_get_pool(struct evrpc_request_wrapper *ctx);
EVENT2_EXPORT_SYMBOL
void evrpc_request_set_pool(struct evrpc_request_wrapper *ctx,
struct evrpc_pool *pool);
EVENT2_EXPORT_SYMBOL
void evrpc_request_set_cb(struct evrpc_request_wrapper *ctx,
void (*cb)(struct evrpc_status*, void *request, void *reply, void *arg),
void *cb_arg);

View File

@ -29,7 +29,11 @@
#include <event2/event-config.h>
#if defined(event_EXPORTS) || defined(event_extra_EXPORTS) || defined(event_core_EXPORTS)
#if defined(event_shared_EXPORTS) || \
defined(event_extra_shared_EXPORTS) || \
defined(event_core_shared_EXPORTS) || \
defined(event_pthreads_shared_EXPORTS) || \
defined(event_openssl_shared_EXPORTS)
# if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
# define EVENT2_EXPORT_SYMBOL __global
# elif defined __GNUC__
@ -40,7 +44,7 @@
# define EVENT2_EXPORT_SYMBOL /* unknown compiler */
# endif
#else
# if defined(EVENT__NEED_DLLIMPORT) && defined(_MSC_VER) && !defined(EVENT_BUILDING_REGRESS_TEST)
# if defined(_MSC_VER) && !defined(EVENT_BUILDING_REGRESS_TEST)
# define EVENT2_EXPORT_SYMBOL extern __declspec(dllimport)
# else
# define EVENT2_EXPORT_SYMBOL

View File

@ -181,6 +181,7 @@ struct event_base;
struct event_iocp_port *event_base_get_iocp_(struct event_base *base);
/* FIXME document. */
EVENT2_EXPORT_SYMBOL
int event_base_start_iocp_(struct event_base *base, int n_cpus);
void event_base_stop_iocp_(struct event_base *base);

View File

@ -47,6 +47,7 @@
#ifdef EVENT_DEBUG_LOGGING_ENABLED
#ifdef USE_GLOBAL_FOR_DEBUG_LOGGING
EVENT2_EXPORT_SYMBOL
extern ev_uint32_t event_debug_logging_mask_;
#define event_debug_get_logging_mask_() (event_debug_logging_mask_)
#else
@ -56,15 +57,24 @@ ev_uint32_t event_debug_get_logging_mask_(void);
#define event_debug_get_logging_mask_() (0)
#endif
EVENT2_EXPORT_SYMBOL
void event_err(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3) EV_NORETURN;
EVENT2_EXPORT_SYMBOL
void event_warn(const char *fmt, ...) EV_CHECK_FMT(1,2);
EVENT2_EXPORT_SYMBOL
void event_sock_err(int eval, evutil_socket_t sock, const char *fmt, ...) EV_CHECK_FMT(3,4) EV_NORETURN;
EVENT2_EXPORT_SYMBOL
void event_sock_warn(evutil_socket_t sock, const char *fmt, ...) EV_CHECK_FMT(2,3);
EVENT2_EXPORT_SYMBOL
void event_errx(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3) EV_NORETURN;
EVENT2_EXPORT_SYMBOL
void event_warnx(const char *fmt, ...) EV_CHECK_FMT(1,2);
EVENT2_EXPORT_SYMBOL
void event_msgx(const char *fmt, ...) EV_CHECK_FMT(1,2);
EVENT2_EXPORT_SYMBOL
void event_debugx_(const char *fmt, ...) EV_CHECK_FMT(1,2);
EVENT2_EXPORT_SYMBOL
void event_logv_(int severity, const char *errstr, const char *fmt, va_list ap)
EV_CHECK_FMT(3,0);

View File

@ -43,6 +43,7 @@ extern "C" {
* On failure, set errno to ENOMEM and return NULL.
* If the argument sz is 0, simply return NULL.
*/
EVENT2_EXPORT_SYMBOL
void *event_mm_malloc_(size_t sz);
/** Allocate memory initialized to zero.
@ -53,6 +54,7 @@ void *event_mm_malloc_(size_t sz);
* set errno to ENOMEM and return NULL.
* If either arguments are 0, simply return NULL.
*/
EVENT2_EXPORT_SYMBOL
void *event_mm_calloc_(size_t count, size_t size);
/** Duplicate a string.
@ -63,9 +65,12 @@ void *event_mm_calloc_(size_t count, size_t size);
* occurs (or would occur) in the process.
* If the argument str is NULL, set errno to EINVAL and return NULL.
*/
EVENT2_EXPORT_SYMBOL
char *event_mm_strdup_(const char *str);
EVENT2_EXPORT_SYMBOL
void *event_mm_realloc_(void *p, size_t sz);
EVENT2_EXPORT_SYMBOL
void event_mm_free_(void *p);
#define mm_malloc(sz) event_mm_malloc_(sz)
#define mm_calloc(count, size) event_mm_calloc_((count), (size))

View File

@ -6,10 +6,12 @@ extern "C" {
#endif
#include "event2/event-config.h"
#include "event2/visibility.h"
#include "evconfig-private.h"
#ifndef EVENT__HAVE_STRLCPY
#include <string.h>
EVENT2_EXPORT_SYMBOL
size_t event_strlcpy_(char *dst, const char *src, size_t siz);
#define strlcpy event_strlcpy_
#endif

View File

@ -54,6 +54,7 @@ extern "C" {
#endif
long evutil_tv_to_msec_(const struct timeval *tv);
EVENT2_EXPORT_SYMBOL
void evutil_usleep_(const struct timeval *tv);
#ifdef _WIN32
@ -86,8 +87,10 @@ struct evutil_monotonic_timer {
struct timeval last_time;
};
EVENT2_EXPORT_SYMBOL
int evutil_configure_monotonic_time_(struct evutil_monotonic_timer *mt,
int flags);
EVENT2_EXPORT_SYMBOL
int evutil_gettime_monotonic_(struct evutil_monotonic_timer *mt, struct timeval *tv);

View File

@ -233,19 +233,26 @@ extern "C" {
* when you care about ASCII's notion of character types, because you are about
* to send those types onto the wire.
*/
EVENT2_EXPORT_SYMBOL
int EVUTIL_ISALPHA_(char c);
EVENT2_EXPORT_SYMBOL
int EVUTIL_ISALNUM_(char c);
int EVUTIL_ISSPACE_(char c);
EVENT2_EXPORT_SYMBOL
int EVUTIL_ISDIGIT_(char c);
EVENT2_EXPORT_SYMBOL
int EVUTIL_ISXDIGIT_(char c);
int EVUTIL_ISPRINT_(char c);
int EVUTIL_ISLOWER_(char c);
int EVUTIL_ISUPPER_(char c);
EVENT2_EXPORT_SYMBOL
char EVUTIL_TOUPPER_(char c);
EVENT2_EXPORT_SYMBOL
char EVUTIL_TOLOWER_(char c);
/** Remove all trailing horizontal whitespace (space or tab) from the end of a
* string */
EVENT2_EXPORT_SYMBOL
void evutil_rtrim_lws_(char *);
@ -272,13 +279,16 @@ void evutil_rtrim_lws_(char *);
*/
int evutil_open_closeonexec_(const char *pathname, int flags, unsigned mode);
EVENT2_EXPORT_SYMBOL
int evutil_read_file_(const char *filename, char **content_out, size_t *len_out,
int is_binary);
EVENT2_EXPORT_SYMBOL
int evutil_socket_connect_(evutil_socket_t *fd_ptr, const struct sockaddr *sa, int socklen);
int evutil_socket_finished_connecting_(evutil_socket_t fd);
EVENT2_EXPORT_SYMBOL
int evutil_ersatz_socketpair_(int, int , int, evutil_socket_t[]);
int evutil_resolve_(int family, const char *hostname, struct sockaddr *sa,
@ -303,15 +313,18 @@ struct evutil_weakrand_state {
* attacker can't predict, or which passes strong statistical tests, use the
* evutil_secure_rng* functions instead.
*/
EVENT2_EXPORT_SYMBOL
ev_uint32_t evutil_weakrand_seed_(struct evutil_weakrand_state *state, ev_uint32_t seed);
/* Return a pseudorandom value between 0 and EVUTIL_WEAKRAND_MAX inclusive.
* Updates the state in 'seed' as needed -- this value must be protected by a
* lock.
*/
EVENT2_EXPORT_SYMBOL
ev_int32_t evutil_weakrand_(struct evutil_weakrand_state *seed);
/* Return a pseudorandom value x such that 0 <= x < top. top must be no more
* than EVUTIL_WEAKRAND_MAX. Updates the state in 'seed' as needed -- this
* value must be proteced by a lock */
EVENT2_EXPORT_SYMBOL
ev_int32_t evutil_weakrand_range_(struct evutil_weakrand_state *seed, ev_int32_t top);
/* Evaluates to the same boolean value as 'p', and hints to the compiler that
@ -377,16 +390,22 @@ typedef struct evdns_getaddrinfo_request* (*evdns_getaddrinfo_fn)(
const char *nodename, const char *servname,
const struct evutil_addrinfo *hints_in,
void (*cb)(int, struct evutil_addrinfo *, void *), void *arg);
EVENT2_EXPORT_SYMBOL
void evutil_set_evdns_getaddrinfo_fn_(evdns_getaddrinfo_fn fn);
typedef void (*evdns_getaddrinfo_cancel_fn)(
struct evdns_getaddrinfo_request *req);
EVENT2_EXPORT_SYMBOL
void evutil_set_evdns_getaddrinfo_cancel_fn_(evdns_getaddrinfo_cancel_fn fn);
EVENT2_EXPORT_SYMBOL
struct evutil_addrinfo *evutil_new_addrinfo_(struct sockaddr *sa,
ev_socklen_t socklen, const struct evutil_addrinfo *hints);
EVENT2_EXPORT_SYMBOL
struct evutil_addrinfo *evutil_addrinfo_append_(struct evutil_addrinfo *first,
struct evutil_addrinfo *append);
EVENT2_EXPORT_SYMBOL
void evutil_adjust_hints_for_addrconfig_(struct evutil_addrinfo *hints);
EVENT2_EXPORT_SYMBOL
int evutil_getaddrinfo_common_(const char *nodename, const char *servname,
struct evutil_addrinfo *hints, struct evutil_addrinfo **res, int *portnum);
@ -399,6 +418,7 @@ void evutil_getaddrinfo_cancel_async_(struct evdns_getaddrinfo_request *data);
/** Return true iff sa is a looback address. (That is, it is 127.0.0.1/8, or
* ::1). */
EVENT2_EXPORT_SYMBOL
int evutil_sockaddr_is_loopback_(const struct sockaddr *sa);
@ -407,6 +427,7 @@ int evutil_sockaddr_is_loopback_(const struct sockaddr *sa);
Returns a pointer to out. Always writes something into out, so it's safe
to use the output of this function without checking it for NULL.
*/
EVENT2_EXPORT_SYMBOL
const char *evutil_format_sockaddr_port_(const struct sockaddr *sa, char *out, size_t outlen);
int evutil_hex_char_to_int_(char c);
@ -464,6 +485,7 @@ HMODULE evutil_load_windows_system_library_(const TCHAR *library_name);
#endif
#endif
EVENT2_EXPORT_SYMBOL
evutil_socket_t evutil_socket_(int domain, int type, int protocol);
evutil_socket_t evutil_accept4_(evutil_socket_t sockfd, struct sockaddr *addr,
ev_socklen_t *addrlen, int flags);