2018-04-07 07:03:14 -04:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
project(sngrep
|
|
|
|
VERSION 2.0.0
|
|
|
|
LANGUAGES C)
|
|
|
|
|
|
|
|
set(PROJECT_NAME sngrep)
|
2020-03-10 06:41:09 -04:00
|
|
|
set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb -Werror -Wall -Wextra -pedantic")
|
2018-04-07 07:03:14 -04:00
|
|
|
|
2019-01-22 07:40:08 -05:00
|
|
|
if (CMAKE_VERSION VERSION_LESS "3.1")
|
|
|
|
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
|
|
|
set(CMAKE_C_FLAGS "-std=gnu11 ${CMAKE_C_FLAGS}")
|
|
|
|
endif ()
|
|
|
|
else ()
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
|
|
endif ()
|
|
|
|
|
2019-01-21 11:59:45 -05:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2018-04-07 07:03:14 -04:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/src)
|
|
|
|
|
|
|
|
set(SOURCES
|
2019-10-14 12:33:31 -04:00
|
|
|
src/codecs/codec.c
|
2019-10-03 12:30:24 -04:00
|
|
|
src/codecs/codec_g711a.c
|
2020-03-25 10:09:20 -04:00
|
|
|
src/codecs/codec_g711u.c
|
2018-04-15 13:51:35 -04:00
|
|
|
src/capture/capture.c
|
|
|
|
src/capture/capture_pcap.c
|
2018-04-21 06:40:39 -04:00
|
|
|
src/capture/capture_txt.c
|
2020-03-09 06:25:25 -04:00
|
|
|
src/glib-extra/gasyncqueuesource.c
|
2020-03-11 06:28:03 -04:00
|
|
|
src/glib-extra/gbytes.c
|
2020-03-09 06:25:25 -04:00
|
|
|
src/glib-extra/gdatetime.c
|
|
|
|
src/glib-extra/glist.c
|
|
|
|
src/glib-extra/gptrarray.c
|
|
|
|
src/glib-extra/glib.c
|
2020-03-23 09:56:08 -04:00
|
|
|
src/glib-extra/gvalue.c
|
2020-03-20 12:11:56 -04:00
|
|
|
src/glib-extra/glib_enum_types.c
|
2020-03-23 10:21:04 -04:00
|
|
|
src/tui/tui.c
|
|
|
|
src/tui/windows/call_flow_win.c
|
|
|
|
src/tui/windows/call_list_win.c
|
|
|
|
src/tui/windows/call_raw_win.c
|
|
|
|
src/tui/windows/column_select_win.c
|
|
|
|
src/tui/windows/filter_win.c
|
|
|
|
src/tui/windows/msg_diff_win.c
|
|
|
|
src/tui/windows/save_win.c
|
|
|
|
src/tui/windows/settings_win.c
|
|
|
|
src/tui/windows/stats_win.c
|
|
|
|
src/tui/windows/auth_validate_win.c
|
|
|
|
src/tui/windows/protocol_select_win.c
|
|
|
|
src/tui/window.c
|
|
|
|
src/tui/dialog.c
|
|
|
|
src/tui/keybinding.c
|
|
|
|
src/tui/scrollbar.c
|
2019-11-19 11:52:33 -05:00
|
|
|
src/storage/address.c
|
2020-03-23 10:28:40 -04:00
|
|
|
src/packet/dissector.c
|
|
|
|
src/packet/dissector.h
|
|
|
|
src/packet/packet.c
|
|
|
|
src/packet/packet_link.c
|
|
|
|
src/packet/packet_ip.c
|
|
|
|
src/packet/packet_tcp.c
|
2021-03-23 04:29:03 -04:00
|
|
|
src/packet/packet_mrcp.c
|
2020-03-23 10:28:40 -04:00
|
|
|
src/packet/packet_udp.c
|
|
|
|
src/packet/packet_sip.c
|
|
|
|
src/packet/packet_sdp.c
|
|
|
|
src/packet/packet_rtp.c
|
|
|
|
src/packet/packet_rtcp.c
|
2021-03-30 06:01:09 -04:00
|
|
|
src/packet/packet_televt.c
|
2019-06-24 05:56:19 -04:00
|
|
|
src/storage/filter.c
|
|
|
|
src/storage/group.c
|
|
|
|
src/storage/stream.c
|
|
|
|
src/storage/attribute.c
|
|
|
|
src/storage/storage.c
|
|
|
|
src/storage/call.c
|
|
|
|
src/storage/message.c
|
2019-09-23 23:53:38 -04:00
|
|
|
src/storage/datetime.c
|
2018-04-15 13:51:35 -04:00
|
|
|
src/setting.c
|
2019-06-24 05:56:19 -04:00
|
|
|
src/main.c
|
2019-10-21 09:34:54 -04:00
|
|
|
src/capture/capture_input.c
|
|
|
|
src/capture/capture_output.c
|
2019-10-03 12:30:24 -04:00
|
|
|
)
|
2018-04-07 07:03:14 -04:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# HEP Support
|
2019-06-26 05:34:31 -04:00
|
|
|
option(USE_HEP "Enable HEP/EEP Support" OFF)
|
2018-04-13 16:12:52 -04:00
|
|
|
if (USE_HEP)
|
|
|
|
set(SOURCES ${SOURCES} src/capture/capture_hep.c)
|
2020-03-23 10:28:40 -04:00
|
|
|
set(SOURCES ${SOURCES} src/packet/packet_hep.c)
|
2018-04-13 16:12:52 -04:00
|
|
|
endif (USE_HEP)
|
2018-04-07 07:03:14 -04:00
|
|
|
|
|
|
|
# IPv6 Support
|
2019-06-26 05:34:31 -04:00
|
|
|
option(USE_IPV6 "Enable IPv6 Support" OFF)
|
2018-04-07 07:03:14 -04:00
|
|
|
|
|
|
|
# GnuTLS Support
|
2019-06-26 05:34:31 -04:00
|
|
|
option(WITH_SSL "Enable SSL Support (TLS SIP Transport)" OFF)
|
2018-04-16 17:43:33 -04:00
|
|
|
if (WITH_SSL)
|
2020-03-23 10:28:40 -04:00
|
|
|
set(SOURCES ${SOURCES} src/packet/packet_tls.c)
|
2019-01-14 10:06:39 -05:00
|
|
|
endif (WITH_SSL)
|
2018-04-07 07:03:14 -04:00
|
|
|
|
2019-01-18 07:13:33 -05:00
|
|
|
# libsnd Support
|
2019-06-26 05:34:31 -04:00
|
|
|
option(WITH_SND "Enable libsnd files (for saving into WAV files)" OFF)
|
2019-01-18 13:43:04 -05:00
|
|
|
|
|
|
|
# Pulseaudio Support
|
2019-06-26 05:34:31 -04:00
|
|
|
option(WITH_PULSE "Enable pulseaudio support (for playing RTP streams)" OFF)
|
2019-01-22 06:25:59 -05:00
|
|
|
if (WITH_PULSE)
|
2020-03-23 10:21:04 -04:00
|
|
|
set(SOURCES ${SOURCES} src/tui/windows/rtp_player_win.c)
|
2019-01-22 07:40:08 -05:00
|
|
|
endif (WITH_PULSE)
|
2019-01-18 11:25:21 -05:00
|
|
|
|
2019-01-18 13:43:04 -05:00
|
|
|
# G.729 decoding support
|
2019-06-26 05:34:31 -04:00
|
|
|
option(WITH_G729 "Enable g729 RTP decoding" OFF)
|
2019-01-18 11:25:21 -05:00
|
|
|
if (WITH_G729)
|
2019-10-03 12:30:24 -04:00
|
|
|
set(SOURCES ${SOURCES} src/codecs/codec_g729.c)
|
2019-01-18 11:25:21 -05:00
|
|
|
endif (WITH_G729)
|
2019-01-18 07:13:33 -05:00
|
|
|
|
2018-04-07 07:03:14 -04:00
|
|
|
######################################################################
|
|
|
|
add_executable(sngrep ${SOURCES})
|
2019-01-21 11:59:45 -05:00
|
|
|
install(
|
2019-01-22 07:40:08 -05:00
|
|
|
TARGETS sngrep
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
2019-01-21 11:59:45 -05:00
|
|
|
)
|
2018-04-07 07:03:14 -04:00
|
|
|
|
|
|
|
find_package(PkgConfig REQUIRED)
|
2018-07-29 04:57:34 -04:00
|
|
|
pkg_check_modules(CURSES REQUIRED ncursesw menuw panelw formw)
|
2019-01-03 10:02:12 -05:00
|
|
|
include_directories(${CURSES_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(sngrep ${CURSES_LIBRARIES})
|
2018-04-07 07:03:14 -04:00
|
|
|
|
2019-04-06 07:49:52 -04:00
|
|
|
pkg_check_modules(GLIB REQUIRED glib-2.0>=2.44 gobject-2.0>=2.44)
|
2018-04-07 07:03:14 -04:00
|
|
|
include_directories(${GLIB_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(sngrep ${GLIB_LIBRARIES})
|
2020-03-20 12:11:56 -04:00
|
|
|
find_program(GLIB_MKENUMS glib-mkenums HINTS ${glib_mkenums})
|
|
|
|
set(GLIB_MKENUMS_CMD)
|
|
|
|
if(NOT GLIB_MKENUMS)
|
|
|
|
message(FATAL_ERROR "Cannot find glib-mkenums, which is required to build ${PROJECT_NAME}")
|
|
|
|
endif(NOT GLIB_MKENUMS)
|
2018-04-07 07:03:14 -04:00
|
|
|
|
2019-01-14 10:06:39 -05:00
|
|
|
find_program(PCAP_CONFIG_EXECUTABLE NAMES pcap-config)
|
|
|
|
if (PCAP_CONFIG_EXECUTABLE)
|
2019-01-18 11:25:21 -05:00
|
|
|
exec_program(${PCAP_CONFIG_EXECUTABLE} ARGS --cflags OUTPUT_VARIABLE PCAP_CFLAGS)
|
|
|
|
exec_program(${PCAP_CONFIG_EXECUTABLE} ARGS --libs OUTPUT_VARIABLE PCAP_LIBRARIES)
|
2019-01-14 10:06:39 -05:00
|
|
|
else (PCAP_CONFIG_EXECUTABLE)
|
|
|
|
pkg_check_modules(PCAP REQUIRED libpcap)
|
|
|
|
endif (PCAP_CONFIG_EXECUTABLE)
|
2019-01-04 17:30:39 -05:00
|
|
|
include_directories(${PCAP_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(sngrep ${PCAP_LIBRARIES})
|
|
|
|
|
2018-04-16 17:43:33 -04:00
|
|
|
if (WITH_SSL)
|
2018-04-07 07:03:14 -04:00
|
|
|
pkg_check_modules(GNUTLS REQUIRED gnutls)
|
|
|
|
include_directories(${GNUTLS_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(sngrep ${GNUTLS_LIBRARIES} gcrypt)
|
2019-04-10 07:16:47 -04:00
|
|
|
|
|
|
|
# Use libgcrypt-config to get configure flags
|
|
|
|
find_program(GCRYPT_CONFIG_EXECUTABLE NAMES libgcrypt-config)
|
|
|
|
if (GCRYPT_CONFIG_EXECUTABLE)
|
|
|
|
exec_program(${GCRYPT_CONFIG_EXECUTABLE} ARGS --cflags OUTPUT_VARIABLE GCRYPT_CFLAGS)
|
|
|
|
exec_program(${GCRYPT_CONFIG_EXECUTABLE} ARGS --libs OUTPUT_VARIABLE GCRYPT_LIBRARIES)
|
|
|
|
endif (GCRYPT_CONFIG_EXECUTABLE)
|
|
|
|
include_directories(${GCRYPT_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(sngrep ${GCRYPT_LIBRARIES})
|
2019-01-14 10:06:39 -05:00
|
|
|
endif (WITH_SSL)
|
2018-04-07 07:03:14 -04:00
|
|
|
|
2019-01-18 07:13:33 -05:00
|
|
|
if (WITH_SND)
|
2019-04-10 07:16:47 -04:00
|
|
|
pkg_check_modules(SND REQUIRED sndfile)
|
2019-01-18 07:13:33 -05:00
|
|
|
include_directories(${SND_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(sngrep ${SND_LIBRARIES})
|
|
|
|
endif (WITH_SND)
|
|
|
|
|
2019-01-22 06:25:59 -05:00
|
|
|
if (WITH_PULSE)
|
2019-11-21 11:05:40 -05:00
|
|
|
pkg_check_modules(PULSE REQUIRED libpulse libpulse-mainloop-glib)
|
2019-01-18 11:25:21 -05:00
|
|
|
include_directories(${PULSE_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(sngrep ${PULSE_LIBRARIES})
|
2019-01-22 06:25:59 -05:00
|
|
|
endif (WITH_PULSE)
|
2019-01-18 11:25:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
if (WITH_G729)
|
2019-01-21 11:59:45 -05:00
|
|
|
pkg_check_modules(BCG729 REQUIRED libbcg729>=1.0.4)
|
2019-01-18 11:25:21 -05:00
|
|
|
include_directories(${BCG729_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(sngrep ${BCG729_LIBRARIES})
|
|
|
|
endif (WITH_G729)
|
|
|
|
|
2018-12-09 08:11:37 -05:00
|
|
|
configure_file(
|
|
|
|
${PROJECT_SOURCE_DIR}/src/config.h.cmake
|
|
|
|
${PROJECT_SOURCE_DIR}/src/config.h
|
|
|
|
)
|
2018-04-07 07:03:14 -04:00
|
|
|
|
2020-03-20 12:11:56 -04:00
|
|
|
######################################################################
|
|
|
|
set(ENUM_HEADERS
|
2020-03-23 10:21:04 -04:00
|
|
|
src/tui/tui.h
|
|
|
|
src/tui/windows/call_flow_win.h
|
2020-03-23 08:01:51 -04:00
|
|
|
src/storage/storage.h
|
2020-03-23 10:28:40 -04:00
|
|
|
src/packet/packet.h
|
2020-03-20 12:11:56 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${PROJECT_SOURCE_DIR}/src/glib-extra/glib_enum_types.h
|
|
|
|
COMMAND ${GLIB_MKENUMS}
|
|
|
|
ARGS
|
|
|
|
--template ${PROJECT_SOURCE_DIR}/src/glib-extra/glib_enum_types.h.tmpl
|
2020-03-23 05:46:39 -04:00
|
|
|
${ENUM_HEADERS} > ${PROJECT_SOURCE_DIR}/src/glib-extra/glib_enum_types.h
|
2020-03-20 12:11:56 -04:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
DEPENDS
|
|
|
|
${ENUM_HEADERS}
|
|
|
|
${PROJECT_SOURCE_DIR}/src/glib-extra/glib_enum_types.h.tmpl
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${PROJECT_SOURCE_DIR}/src/glib-extra/glib_enum_types.c
|
|
|
|
COMMAND ${GLIB_MKENUMS}
|
|
|
|
ARGS
|
2020-03-23 09:56:08 -04:00
|
|
|
--template ${PROJECT_SOURCE_DIR}/src/glib-extra/glib_enum_types.c.tmpl
|
|
|
|
${ENUM_HEADERS} > ${PROJECT_SOURCE_DIR}/src/glib-extra/glib_enum_types.c
|
2020-03-20 12:11:56 -04:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
DEPENDS
|
2020-03-23 09:56:08 -04:00
|
|
|
${ENUM_HEADERS} ${PROJECT_SOURCE_DIR}/src/glib-extra/glib_enum_types.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/glib-extra/glib_enum_types.c.tmpl
|
2020-03-20 12:11:56 -04:00
|
|
|
)
|
|
|
|
|
2018-04-07 07:03:14 -04:00
|
|
|
######################################################################
|
|
|
|
add_definitions(-D_GNU_SOURCE)
|
2018-07-29 04:57:34 -04:00
|
|
|
add_definitions(-D_XOPEN_SOURCE_EXTENDED)
|
|
|
|
|
2019-01-21 11:59:45 -05:00
|
|
|
######################################################################
|
|
|
|
install(TARGETS sngrep RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
|
|
|
2019-11-06 05:11:37 -05:00
|
|
|
######################################################################
|
|
|
|
# Tests support
|
|
|
|
enable_testing()
|
|
|
|
add_subdirectory(tests)
|
|
|
|
|
2018-04-07 07:03:14 -04:00
|
|
|
######################################################################
|
|
|
|
# Print Logo
|
|
|
|
option(DISPLAY_LOGO "Disable Irontec Logo from Summary menu" ON)
|
|
|
|
|
|
|
|
if (DISPLAY_LOGO)
|
|
|
|
message(" ")
|
|
|
|
message(" ██╗██████╗ ██████╗ ███╗ ██╗████████╗███████╗ ██████╗ ")
|
|
|
|
message(" ██║██╔══██╗██╔═══██╗████╗ ██║╚══██╔══╝██╔════╝██╔════╝ ")
|
|
|
|
message(" ██║██████╔╝██║ ██║██╔██╗ ██║ ██║ █████╗ ██║ ")
|
|
|
|
message(" ██║██╔══██╗██║ ██║██║╚██╗██║ ██║ ██╔══╝ ██║ ")
|
|
|
|
message(" ██║██║ ██║╚██████╔╝██║ ╚████║ ██║ ███████╗╚██████╗ ")
|
|
|
|
message(" ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝ ╚═════╝ ")
|
|
|
|
message(" ")
|
|
|
|
endif (DISPLAY_LOGO)
|
|
|
|
|
|
|
|
message(" ")
|
2018-04-16 17:43:33 -04:00
|
|
|
message(" sngrep configure finished ")
|
|
|
|
message(" ====================================================== ")
|
2019-04-08 15:44:34 -04:00
|
|
|
message(" SND Support (WITH_SND) : ${WITH_SND} ")
|
|
|
|
message(" SSL Support (WITH_SSL) : ${WITH_SSL} ")
|
|
|
|
message(" Pulseaudio Support (WITH_PULSE) : ${WITH_PULSE} ")
|
|
|
|
message(" g729 Support (WITH_G729) : ${WITH_G729} ")
|
|
|
|
message(" HEP Support (USE_HEP) : ${USE_HEP} ")
|
|
|
|
message(" IPv6 Support (USE_IPV6) : ${USE_IPV6} ")
|
2018-04-16 17:43:33 -04:00
|
|
|
message(" ====================================================== ")
|
2018-04-07 07:03:14 -04:00
|
|
|
message(" ")
|