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

Tarantool binary protocol support #1023

Open
wants to merge 1 commit 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
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ option(WITH_CRYPTO "Build with OpenSSL/libressl libcrypto, if available" ON)
option(WITH_CAPSICUM "Build with Capsicum security functions, if available" ON)
option(WITH_CAP_NG "Use libcap-ng, if available" ON)
option(ENABLE_SMB "Build with the SMB dissector" OFF)
option(WITH_MSGPUCK "Build with msgpuck, if available" ON)

#
# String parameters. Neither of them are set, initially; only if the
Expand Down Expand Up @@ -815,6 +816,22 @@ if(WITH_SMI)
endif(SMI_FOUND)
endif(WITH_SMI)

#
# msgpuck.
#
if(WITH_MSGPUCK)
find_package(MSGPUCK)
if(MSGPUCK_FOUND)
check_library_exists(${MSGPUCK_LIBRARY} mp_check_ext_data ""
MSGPUCK_HAVE_CHECK_EXT_DATA)
if (MSGPUCK_HAVE_CHECK_EXT_DATA)
include_directories(SYSTEM ${MSGPUCK_INCLUDE_DIRS})
set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} ${MSGPUCK_LIBRARIES})
set(HAVE_MSGPUCK ON)
endif()
endif(MSGPUCK_FOUND)
endif(WITH_MSGPUCK)

#
# OpenSSL/libressl libcrypto.
#
Expand Down Expand Up @@ -1209,6 +1226,7 @@ set(NETDISSECT_SOURCE_LIST_C
print-sunrpc.c
print-symantec.c
print-syslog.c
print-tarantool.c
print-tcp.c
print-telnet.c
print-tftp.c
Expand Down
1 change: 1 addition & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ LIBNETDISSECT_SRC=\
print-sunrpc.c \
print-symantec.c \
print-syslog.c \
print-tarantool.c \
print-tcp.c \
print-telnet.c \
print-tftp.c \
Expand Down
24 changes: 24 additions & 0 deletions cmake/Modules/FindMSGPUCK.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# try to find msgpuck.
#

# Try to find the header
find_path(MSGPUCK_INCLUDE_DIR msgpuck.h)

# Try to find the library
find_library(MSGPUCK_LIBRARY msgpuck)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MSGPUCK
DEFAULT_MSG
MSGPUCK_INCLUDE_DIR
MSGPUCK_LIBRARY
)

mark_as_advanced(
MSGPUCK_INCLUDE_DIR
MSGPUCK_LIBRARY
)

set(MSGPUCK_INCLUDE_DIRS ${MSGPUCK_INCLUDE_DIR})
set(MSGPUCK_LIBRARIES ${MSGPUCK_LIBRARY})
3 changes: 3 additions & 0 deletions cmakeconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
/* Define to 1 if you have the <memory.h> header file. */
#cmakedefine HAVE_MEMORY_H 1

/* Define to 1 if you have the `msgpuck` library (-lmsgpuck) */
#cmakedefine HAVE_MSGPUCK 1

/* Define to 1 if you have the <net/if.h> header file. */
#cmakedefine HAVE_NET_IF_H 1

Expand Down
17 changes: 17 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,23 @@ int main()
])
fi

AC_ARG_WITH([tarantool],
[AS_HELP_STRING([--with-tarantool],
[link with msgpuck (Tarantool binary protocol support) [default=yes, if available]])],
[],
[with_tarantool=yes])

if test "x$with_tarantool" != "xno" ; then
AC_CHECK_HEADER(msgpuck.h,
[
AC_CHECK_LIB(msgpuck, mp_check_ext_data,
[
LIBS="$LIBS -lmsgpuck"
AC_DEFINE(HAVE_MSGPUCK, 1, [Define to 1 if you have the `msgpuck` library (-lmsgpuck)])
])
])
fi

AC_MSG_CHECKING([whether to enable the instrument functions code])
AC_ARG_ENABLE([instrument-functions],
[AS_HELP_STRING([--enable-instrument-functions],
Expand Down
2 changes: 2 additions & 0 deletions netdissect.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ NORETURN void nd_trunc_longjmp(netdissect_options *ndo);
#define PT_SOMEIP 19 /* Autosar SOME/IP Protocol */
#define PT_DOMAIN 20 /* Domain Name System (DNS) */
#define PT_QUIC 21 /* QUIC */
#define PT_IPROTO 22 /* Tarantool binary protocol */

#define ND_MIN(a,b) ((a)>(b)?(b):(a))
#define ND_MAX(a,b) ((b)>(a)?(b):(a))
Expand Down Expand Up @@ -748,6 +749,7 @@ extern void ssh_print(netdissect_options *, const u_char *, u_int);
extern void stp_print(netdissect_options *, const u_char *, u_int);
extern void sunrpc_print(netdissect_options *, const u_char *, u_int, const u_char *);
extern void syslog_print(netdissect_options *, const u_char *, u_int);
extern void tarantool_print(netdissect_options *, const u_char *, u_int);
extern void tcp_print(netdissect_options *, const u_char *, u_int, const u_char *, int);
extern void telnet_print(netdissect_options *, const u_char *, u_int);
extern void tftp_print(netdissect_options *, const u_char *, u_int);
Expand Down
Loading