Skip to content

Commit

Permalink
Merge pull request #19 from hstern/jsonio
Browse files Browse the repository at this point in the history
Add json input and output support
  • Loading branch information
cmikk committed Oct 2, 2015
2 parents c09d44f + d45b181 commit ba4220b
Show file tree
Hide file tree
Showing 26 changed files with 1,884 additions and 69 deletions.
2 changes: 1 addition & 1 deletion COPYRIGHT
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Most nmsg code is under the following copyright and license:

Copyright (c) 2008-2014 by Farsight Security, Inc.
Copyright (c) 2008-2015 by Farsight Security, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
13 changes: 11 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ AM_CFLAGS = \
$(libpcap_CFLAGS) \
$(libprotobuf_c_CFLAGS) \
$(libwdns_CFLAGS) \
$(libxs_CFLAGS)
$(libxs_CFLAGS) \
$(yajl_CFLAGS)
AM_LDFLAGS =

EXTRA_DIST += ChangeLog
Expand Down Expand Up @@ -74,13 +75,18 @@ nmsg_libnmsg_la_LDFLAGS = \
nmsg_libnmsg_la_LIBADD = \
$(libpcap_LIBS) \
$(libprotobuf_c_LIBS) \
$(libxs_LIBS)
$(libxs_LIBS) \
$(yajl_LIBS)
nmsg_libnmsg_la_SOURCES = \
libmy/crc32c.c libmy/crc32c.h libmy/crc32c-slicing.c libmy/crc32c-sse42.c \
libmy/list.h \
libmy/my_time.h \
libmy/my_rate.c libmy/my_rate.h \
libmy/tree.h \
libmy/b64_decode.c \
libmy/b64_decode.h \
libmy/b64_encode.c \
libmy/b64_encode.h \
nmsg/alias.c \
nmsg/asprintf.c \
nmsg/brate.c \
Expand All @@ -91,6 +97,7 @@ nmsg_libnmsg_la_SOURCES = \
nmsg/input.c \
nmsg/input_callback.c \
nmsg/input_frag.c \
nmsg/input_json.c \
nmsg/input_nmsg.c \
nmsg/input_nullnmsg.c \
nmsg/input_pcap.c \
Expand All @@ -105,6 +112,7 @@ nmsg_libnmsg_la_SOURCES = \
nmsg/nmsg_port_net.h \
nmsg/output.c \
nmsg/output_frag.c \
nmsg/output_json.c \
nmsg/output_nmsg.c \
nmsg/output_pres.c \
nmsg/payload.c \
Expand All @@ -123,6 +131,7 @@ nmsg_libnmsg_la_SOURCES = \
nmsg/msgmod/msgmod.c \
nmsg/msgmod/transparent.c \
nmsg/msgmod/transparent.h \
nmsg/msgmod/transparent_json.c \
nmsg/msgmod/transparent_message.c \
nmsg/msgmod/transparent_module.c \
nmsg/msgmod/transparent_payload.c \
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ nmsg has the following external dependencies:

* [wdns](https://github.com/farsightsec/wdns)

* [yajl](http://lloyd.github.io/yajl/)

* [libxs](http://www.crossroads.io/)

* [zlib](http://www.zlib.net/)

On Debian systems, the following packages should be installed, if available:

pkg-config libpcap0.8-dev libprotobuf-c-dev protobuf-c-compiler libxs-dev zlib1g-dev
pkg-config libpcap0.8-dev libprotobuf-c-dev protobuf-c-compiler libxs-dev libyajl-dev zlib1g-dev

Note that on Debian systems, binary packages of nmsg and its dependencies are
available from
Expand All @@ -43,6 +45,7 @@ Debian-based systems.
On FreeBSD systems, the following ports should be installed, if available:

devel/libxs
devel/yajl
devel/pkgconf
devel/protobuf
devel/protobuf-c
Expand All @@ -57,6 +60,9 @@ compile and install `libnmsg` and `nmsgtool` to `/usr/local`. If building from a
git checkout, run the `./autogen.sh` command first to generate the `configure`
script.

Support for `yajl` can be disabled by passing the `--without-yajl`
parameter to the `configure` script.

Support for `libxs` can be disabled by passing the `--without-libxs` parameter
to the `configure` script.

Expand Down
13 changes: 11 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ AC_CHECK_MEMBER(
)

###
### External library dependencies: libpcap, libprotobuf-c, libwdns, libxs, libz
### External library dependencies: libpcap, libprotobuf-c, libwdns, libxs, yajl, libz
###

MY_CHECK_LIBPCAP
Expand All @@ -91,7 +91,15 @@ AC_PATH_PROG([PROTOC_C], [protoc-c])
AS_IF([test -z "$PROTOC_C"],
[AC_MSG_ERROR([The protoc-c program was not found. Please install the protobuf-c compiler!])])

PKG_CHECK_MODULES([libwdns], [libwdns])
PKG_CHECK_MODULES([libwdns], [libwdns >= 0.8.0])
AC_ARG_WITH([yajl], AS_HELP_STRING([--without-yajl], [Disable yajl support]))
if test "x$with_yajl" != "xno"; then
PKG_CHECK_MODULES([yajl], [yajl >= 2])
AC_DEFINE([HAVE_YAJL], [1], [Define to 1 if yajl support is enabled.])
use_yajl="true"
else
use_yajl="false"
fi

AC_ARG_WITH([libxs], AS_HELP_STRING([--without-libxs], [Disable libxs support]))
if test "x$with_libxs" != "xno"; then
Expand Down Expand Up @@ -165,6 +173,7 @@ AC_MSG_RESULT([
bigendian: ${ac_cv_c_bigendian}
libxs support: ${use_libxs}
yajl support: ${use_yajl}
building html docs: ${DOC_HTML_MSG}
building manpage docs: ${DOC_MAN_MSG}
Expand Down
Loading

0 comments on commit ba4220b

Please sign in to comment.