Skip to content

Commit 876db26

Browse files
committed
Tarantool binary protocol support
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
1 parent a028658 commit 876db26

14 files changed

+3752
-0
lines changed

CMakeLists.txt

+14
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ option(WITH_CRYPTO "Build with OpenSSL/libressl libcrypto, if available" ON)
215215
option(WITH_CAPSICUM "Build with Capsicum security functions, if available" ON)
216216
option(WITH_CAP_NG "Use libcap-ng, if available" ON)
217217
option(ENABLE_SMB "Build with the SMB dissector" OFF)
218+
option(WITH_MSGPUCK "Build with msgpuck, if available" ON)
218219

219220
#
220221
# String parameters. Neither of them are set, initially; only if the
@@ -815,6 +816,18 @@ if(WITH_SMI)
815816
endif(SMI_FOUND)
816817
endif(WITH_SMI)
817818

819+
#
820+
# msgpuck.
821+
#
822+
if(WITH_MSGPUCK)
823+
find_package(MSGPUCK)
824+
if(MSGPUCK_FOUND)
825+
include_directories(SYSTEM ${MSGPUCK_INCLUDE_DIRS})
826+
set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} ${MSGPUCK_LIBRARIES})
827+
set(HAVE_MSGPUCK ON)
828+
endif(MSGPUCK_FOUND)
829+
endif(WITH_MSGPUCK)
830+
818831
#
819832
# OpenSSL/libressl libcrypto.
820833
#
@@ -1209,6 +1222,7 @@ set(NETDISSECT_SOURCE_LIST_C
12091222
print-sunrpc.c
12101223
print-symantec.c
12111224
print-syslog.c
1225+
print-tarantool.c
12121226
print-tcp.c
12131227
print-telnet.c
12141228
print-tftp.c

Makefile.in

+1
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ LIBNETDISSECT_SRC=\
231231
print-sunrpc.c \
232232
print-symantec.c \
233233
print-syslog.c \
234+
print-tarantool.c \
234235
print-tcp.c \
235236
print-telnet.c \
236237
print-tftp.c \

cmake/Modules/FindMSGPUCK.cmake

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# try to find msgpuck.
3+
#
4+
5+
# Try to find the header
6+
find_path(MSGPUCK_INCLUDE_DIR msgpuck.h)
7+
8+
# Try to find the library
9+
find_library(MSGPUCK_LIBRARY msgpuck)
10+
11+
include(FindPackageHandleStandardArgs)
12+
find_package_handle_standard_args(MSGPUCK
13+
DEFAULT_MSG
14+
MSGPUCK_INCLUDE_DIR
15+
MSGPUCK_LIBRARY
16+
)
17+
18+
mark_as_advanced(
19+
MSGPUCK_INCLUDE_DIR
20+
MSGPUCK_LIBRARY
21+
)
22+
23+
set(MSGPUCK_INCLUDE_DIRS ${MSGPUCK_INCLUDE_DIR})
24+
set(MSGPUCK_LIBRARIES ${MSGPUCK_LIBRARY})

cmakeconfig.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@
6969
/* Define to 1 if you have the <memory.h> header file. */
7070
#cmakedefine HAVE_MEMORY_H 1
7171

72+
/* Define to 1 if you have the `msgpuck` library (-lmsgpuck) */
73+
#cmakedefine HAVE_MSGPUCK 1
74+
7275
/* Define to 1 if you have the <net/if.h> header file. */
7376
#cmakedefine HAVE_NET_IF_H 1
7477

configure.ac

+17
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,23 @@ int main()
136136
])
137137
fi
138138

139+
AC_ARG_WITH([tarantool],
140+
[AS_HELP_STRING([--with-tarantool],
141+
[link with msgpuck (Tarantool binary protocol support) [default=yes, if available]])],
142+
[],
143+
[with_tarantool=yes])
144+
145+
if test "x$with_tarantool" != "xno" ; then
146+
AC_CHECK_HEADER(msgpuck.h,
147+
[
148+
AC_CHECK_LIB(msgpuck, mp_decode_uint,
149+
[
150+
LIBS="$LIBS -lmsgpuck"
151+
AC_DEFINE(HAVE_MSGPUCK, 1, [Define to 1 if you have the `msgpuck` library (-lmsgpuck)])
152+
])
153+
])
154+
fi
155+
139156
AC_MSG_CHECKING([whether to enable the instrument functions code])
140157
AC_ARG_ENABLE([instrument-functions],
141158
[AS_HELP_STRING([--enable-instrument-functions],

netdissect.h

+2
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ NORETURN void nd_trunc_longjmp(netdissect_options *ndo);
305305
#define PT_SOMEIP 19 /* Autosar SOME/IP Protocol */
306306
#define PT_DOMAIN 20 /* Domain Name System (DNS) */
307307
#define PT_QUIC 21 /* QUIC */
308+
#define PT_IPROTO 22 /* Tarantool binary protocol */
308309

309310
#define ND_MIN(a,b) ((a)>(b)?(b):(a))
310311
#define ND_MAX(a,b) ((b)>(a)?(b):(a))
@@ -748,6 +749,7 @@ extern void ssh_print(netdissect_options *, const u_char *, u_int);
748749
extern void stp_print(netdissect_options *, const u_char *, u_int);
749750
extern void sunrpc_print(netdissect_options *, const u_char *, u_int, const u_char *);
750751
extern void syslog_print(netdissect_options *, const u_char *, u_int);
752+
extern void tarantool_print(netdissect_options *, const u_char *, u_int);
751753
extern void tcp_print(netdissect_options *, const u_char *, u_int, const u_char *, int);
752754
extern void telnet_print(netdissect_options *, const u_char *, u_int);
753755
extern void tftp_print(netdissect_options *, const u_char *, u_int);

0 commit comments

Comments
 (0)