Skip to content

Commit

Permalink
Tarantool binary protocol support
Browse files Browse the repository at this point in the history
Added Tarantool binary protocol parsing (IPROTO).

Protocol info From IANA database:
Service Name: tarantool
Port Number: 3301
Transport Protocol: tcp/udp
Description: Tarantool in-memory computing platform
  • Loading branch information
0x501D committed Aug 30, 2023
1 parent a028658 commit 9561bd7
Show file tree
Hide file tree
Showing 17 changed files with 7,255 additions and 0 deletions.
14 changes: 14 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,18 @@ if(WITH_SMI)
endif(SMI_FOUND)
endif(WITH_SMI)

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

#
# OpenSSL/libressl libcrypto.
#
Expand Down Expand Up @@ -1209,6 +1222,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_decode_uint,
[
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

0 comments on commit 9561bd7

Please sign in to comment.