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)
|
2018-07-29 12:47:09 -04:00
|
|
|
set(CMAKE_C_STANDARD 11)
|
2019-01-08 12:59:37 -05:00
|
|
|
set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb -p -g")
|
2019-01-03 10:02:12 -05:00
|
|
|
add_compile_options(-Wall -pedantic -Wextra)
|
2018-04-07 07:03:14 -04:00
|
|
|
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/src)
|
2019-01-10 06:33:35 -05:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/src/ncurses)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/src/ncurses/windows)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/src/capture/)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/src/capture/packet)
|
2018-04-07 07:03:14 -04:00
|
|
|
|
|
|
|
set(SOURCES
|
2019-01-10 06:33:35 -05:00
|
|
|
src/capture/address.c
|
|
|
|
src/capture/packet.c
|
|
|
|
src/capture/parser.c
|
2019-01-18 11:25:21 -05:00
|
|
|
src/capture/codecs/codec_g711a.c
|
2019-01-10 06:33:35 -05:00
|
|
|
src/capture/packet/packet_link.c
|
|
|
|
src/capture/packet/packet_ip.c
|
|
|
|
src/capture/packet/packet_tcp.c
|
|
|
|
src/capture/packet/packet_udp.c
|
|
|
|
src/capture/packet/packet_sip.c
|
|
|
|
src/capture/packet/packet_sdp.c
|
|
|
|
src/capture/packet/packet_rtp.c
|
|
|
|
src/capture/packet/packet_rtcp.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
|
2018-11-18 08:26:27 -05:00
|
|
|
src/ncurses/manager.c
|
2018-11-19 11:51:01 -05:00
|
|
|
src/ncurses/windows/call_flow_win.c
|
|
|
|
src/ncurses/windows/call_list_win.c
|
|
|
|
src/ncurses/windows/call_raw_win.c
|
|
|
|
src/ncurses/windows/column_select_win.c
|
|
|
|
src/ncurses/windows/filter_win.c
|
|
|
|
src/ncurses/windows/msg_diff_win.c
|
|
|
|
src/ncurses/windows/save_win.c
|
|
|
|
src/ncurses/windows/settings_win.c
|
|
|
|
src/ncurses/windows/stats_win.c
|
2018-11-26 06:18:52 -05:00
|
|
|
src/ncurses/windows/auth_validate_win.c
|
2018-11-18 08:26:27 -05:00
|
|
|
src/ncurses/window.c
|
2018-12-16 04:20:08 -05:00
|
|
|
src/ncurses/dialog.c
|
2018-11-18 05:21:23 -05:00
|
|
|
src/ncurses/keybinding.c
|
|
|
|
src/ncurses/scrollbar.c
|
2018-04-15 13:51:35 -04:00
|
|
|
src/filter.c
|
|
|
|
src/group.c
|
|
|
|
src/main.c
|
2018-04-20 17:45:14 -04:00
|
|
|
src/stream.c
|
2018-04-15 13:51:35 -04:00
|
|
|
src/setting.c
|
2018-11-18 08:09:57 -05:00
|
|
|
src/attribute.c
|
2018-04-20 14:28:45 -04:00
|
|
|
src/storage.c
|
2018-11-18 08:13:57 -05:00
|
|
|
src/call.c
|
|
|
|
src/message.c
|
2018-04-21 19:28:45 -04:00
|
|
|
src/timeval.c
|
2018-12-06 08:19:09 -05:00
|
|
|
src/glib-extra.c
|
2019-01-14 10:06:39 -05:00
|
|
|
)
|
2018-04-07 07:03:14 -04:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# HEP Support
|
2019-01-18 11:25:21 -05:00
|
|
|
option(USE_HEP "Enable HEP Support" OFF)
|
2018-04-13 16:12:52 -04:00
|
|
|
if (USE_HEP)
|
|
|
|
set(SOURCES ${SOURCES} src/capture/capture_hep.c)
|
2019-01-10 06:33:35 -05:00
|
|
|
set(SOURCES ${SOURCES} src/capture/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-01-14 10:06:39 -05:00
|
|
|
option(USE_IPV6 "Enable IPv6 Support" ON)
|
2018-04-07 07:03:14 -04:00
|
|
|
|
|
|
|
# GnuTLS Support
|
2019-01-14 10:06:39 -05:00
|
|
|
option(WITH_SSL "Enable SSL Support (TLS SIP Transport)" OFF)
|
2018-04-16 17:43:33 -04:00
|
|
|
if (WITH_SSL)
|
2019-01-10 06:33:35 -05:00
|
|
|
set(SOURCES ${SOURCES} src/capture/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
|
|
|
|
option(WITH_SND "Enable libsnd files (for saving into WAV files)" OFF)
|
2019-01-18 11:25:21 -05:00
|
|
|
option(WITH_PULSEAUDIO "Enable pulseaudio support (for playing RTP streams)" OFF)
|
|
|
|
|
|
|
|
option(WITH_G729 "Enable g729 RTP decoding" OFF)
|
|
|
|
if (WITH_G729)
|
|
|
|
set(SOURCES ${SOURCES} src/capture/codecs/codec_g729.c)
|
|
|
|
endif (WITH_G729)
|
2019-01-18 07:13:33 -05:00
|
|
|
|
2018-04-07 07:03:14 -04:00
|
|
|
######################################################################
|
|
|
|
add_executable(sngrep ${SOURCES})
|
|
|
|
target_link_libraries(sngrep pcap)
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
pkg_check_modules(GLIB REQUIRED glib-2.0)
|
|
|
|
include_directories(${GLIB_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(sngrep ${GLIB_LIBRARIES})
|
|
|
|
|
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-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)
|
|
|
|
pkg_check_modules(SND REQUIRED sndfile)
|
|
|
|
include_directories(${SND_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(sngrep ${SND_LIBRARIES})
|
|
|
|
endif (WITH_SND)
|
|
|
|
|
2019-01-18 11:25:21 -05:00
|
|
|
if (WITH_PULSEAUDIO)
|
|
|
|
pkg_check_modules(PULSE REQUIRED libpulse-simple)
|
|
|
|
include_directories(${PULSE_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(sngrep ${PULSE_LIBRARIES})
|
|
|
|
endif (WITH_PULSEAUDIO)
|
|
|
|
|
|
|
|
|
|
|
|
if (WITH_G729)
|
|
|
|
pkg_check_modules(BCG729 REQUIRED libbcg729)
|
|
|
|
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
|
|
|
|
|
|
|
######################################################################
|
|
|
|
add_definitions(-D_GNU_SOURCE)
|
2018-07-29 04:57:34 -04:00
|
|
|
add_definitions(-D_XOPEN_SOURCE_EXTENDED)
|
|
|
|
|
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-01-18 07:13:33 -05:00
|
|
|
message(" SND Support : ${WITH_SND} ")
|
2018-04-16 17:43:33 -04:00
|
|
|
message(" SSL Support : ${WITH_SSL} ")
|
2019-01-18 11:25:21 -05:00
|
|
|
message(" Pulseaudio Support : ${WITH_PULSEAUDIO} ")
|
|
|
|
message(" g729 Support : ${WITH_G729} ")
|
2018-07-29 04:57:34 -04:00
|
|
|
message(" HEP Support : ${USE_HEP} ")
|
2018-04-07 07:03:14 -04:00
|
|
|
message(" IPv6 Support : ${USE_IPV6} ")
|
2018-04-16 17:43:33 -04:00
|
|
|
message(" ====================================================== ")
|
2018-04-07 07:03:14 -04:00
|
|
|
message(" ")
|