mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 00:21:11 +02:00
Add tools subdirectory
This commit is contained in:
parent
1ba5fa3dc8
commit
60a4ba90ce
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -6,11 +6,11 @@ configure.ac
|
|||
config.*
|
||||
Makefile
|
||||
autom4te.cache
|
||||
benchmark
|
||||
edge
|
||||
n2n-decode
|
||||
example_edge_embed
|
||||
supernode
|
||||
tools/n2n-benchmark
|
||||
tools/n2n-decode
|
||||
build
|
||||
packages/debian/debian/changelog
|
||||
packages/debian/debian/control
|
||||
|
|
|
@ -16,6 +16,8 @@ if(NOT DEFINED N2N_OPTION_AES)
|
|||
set(N2N_OPTION_AES ON)
|
||||
endif(NOT DEFINED N2N_OPTION_AES)
|
||||
|
||||
add_definitions(-DCMAKE_BUILD)
|
||||
add_definitions(-DGIT_RELEASE="" -DPACKAGE_VERSION="${N2N_VERSION}" -DPACKAGE_OSNAME="${CMAKE_SYSTEM}")
|
||||
add_definitions(-DN2N_VERSION="${N2N_VERSION}" -DN2N_OSNAME="${N2N_OSNAME}")
|
||||
|
||||
if(N2N_OPTION_AES)
|
||||
|
@ -79,8 +81,17 @@ target_link_libraries(edge n2n)
|
|||
add_executable(supernode sn.c)
|
||||
target_link_libraries(supernode n2n)
|
||||
|
||||
add_executable(benchmark benchmark.c)
|
||||
target_link_libraries(benchmark n2n)
|
||||
# Tools
|
||||
include_directories(.)
|
||||
|
||||
add_executable(n2n-benchmark tools/benchmark.c)
|
||||
target_link_libraries(n2n-benchmark n2n)
|
||||
|
||||
find_library(PCAP_LIB pcap)
|
||||
if(PCAP_LIB)
|
||||
add_executable(n2n-decode tools/n2n_decode.c)
|
||||
target_link_libraries(n2n-decode n2n pcap)
|
||||
endif()
|
||||
|
||||
install(TARGETS edge supernode
|
||||
RUNTIME DESTINATION sbin
|
||||
|
|
26
Makefile.in
26
Makefile.in
|
@ -8,7 +8,7 @@ GIT_COMMITS=@GIT_COMMITS@
|
|||
CC?=gcc
|
||||
DEBUG?=-g3
|
||||
#OPTIMIZATION?=-O2
|
||||
WARN?=-Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs
|
||||
WARN?=-Wall
|
||||
|
||||
#Ultrasparc64 users experiencing SIGBUS should try the following gcc options
|
||||
#(thanks to Robert Gibbon)
|
||||
|
@ -63,29 +63,26 @@ endif
|
|||
APPS=edge
|
||||
APPS+=supernode
|
||||
APPS+=example_edge_embed
|
||||
APPS+=benchmark
|
||||
|
||||
DOCS=edge.8.gz supernode.1.gz n2n.7.gz
|
||||
|
||||
all: $(APPS) $(DOCS)
|
||||
.PHONY: steps build push all clean install tools
|
||||
all: $(APPS) $(DOCS) tools
|
||||
|
||||
tools: $(N2N_LIB)
|
||||
$(MAKE) -C $@
|
||||
|
||||
edge: edge.c $(N2N_LIB) n2n_wire.h n2n.h Makefile
|
||||
$(CC) $(CFLAGS) edge.c $(N2N_LIB) $(LIBS_EDGE) -o edge
|
||||
$(CC) $(CFLAGS) $< $(N2N_LIB) $(LIBS_EDGE) -o $@
|
||||
|
||||
supernode: sn.c $(N2N_LIB) n2n.h Makefile
|
||||
$(CC) $(CFLAGS) sn.c $(N2N_LIB) $(LIBS_SN) -o supernode
|
||||
|
||||
benchmark: benchmark.c $(N2N_LIB) n2n_wire.h n2n.h Makefile
|
||||
$(CC) $(CFLAGS) benchmark.c $(N2N_LIB) $(LIBS_EDGE) -o benchmark
|
||||
|
||||
n2n-decode: n2n_decode.c $(N2N_LIB) n2n_wire.h n2n.h Makefile
|
||||
$(CC) $(CFLAGS) n2n_decode.c $(N2N_LIB) $(LIBS_EDGE) -lpcap -o n2n-decode
|
||||
$(CC) $(CFLAGS) $< $(N2N_LIB) $(LIBS_SN) -o $@
|
||||
|
||||
example_edge_embed: example_edge_embed.c $(N2N_LIB) n2n.h
|
||||
$(CC) $(CFLAGS) example_edge_embed.c $(N2N_LIB) $(LIBS_EDGE) -o example_edge_embed
|
||||
$(CC) $(CFLAGS) $< $(N2N_LIB) $(LIBS_EDGE) -o $@
|
||||
|
||||
.c.o: n2n.h n2n_transforms.h n2n_wire.h twofish.h Makefile
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
%.gz : %
|
||||
gzip -c $< > $@
|
||||
|
@ -96,6 +93,7 @@ $(N2N_LIB): $(N2N_OBJS)
|
|||
|
||||
clean:
|
||||
rm -rf $(N2N_OBJS) $(N2N_LIB) $(APPS) $(DOCS) test n2n-decode *.dSYM *~
|
||||
$(MAKE) -C tools clean
|
||||
|
||||
install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz
|
||||
echo "MANDIR=$(MANDIR)"
|
||||
|
@ -105,6 +103,7 @@ install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz
|
|||
$(INSTALL_DOC) edge.8.gz $(MAN8DIR)/
|
||||
$(INSTALL_DOC) supernode.1.gz $(MAN1DIR)/
|
||||
$(INSTALL_DOC) n2n.7.gz $(MAN7DIR)/
|
||||
$(MAKE) -C tools install
|
||||
|
||||
# Docker builder section
|
||||
DOCKER_IMAGE_NAME=ntop/supernode
|
||||
|
@ -140,5 +139,4 @@ push:
|
|||
echo "Please pass TARGET_ARCHITECTURE, see README.md."; \
|
||||
fi
|
||||
|
||||
.PHONY: steps build push
|
||||
# End Docker builder section
|
||||
|
|
|
@ -133,7 +133,7 @@ two edge nodes, but it will now that edge A is talking with edge B.
|
|||
Recently AES encryption support has been implemented, which increases both security and performance,
|
||||
so it is recommended to enable it on all the edge nodes by specifying the `-A` option.
|
||||
|
||||
A benchmark of the encryption methods is available when compiled from source with `./benchmark`.
|
||||
A benchmark of the encryption methods is available when compiled from source with `tools/n2n-benchmark`.
|
||||
|
||||
Contribution
|
||||
------------
|
||||
|
|
|
@ -24,6 +24,13 @@ else
|
|||
N2N_LIBS=-lcrypto
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB([pcap], [pcap_open_live], pcap=true)
|
||||
|
||||
if test x$pcap != x; then
|
||||
AC_DEFINE([N2N_HAVE_PCAP], [], [Have PCAP library])
|
||||
ADDITIONAL_TOOLS="$ADDITIONAL_TOOLS n2n-decode"
|
||||
fi
|
||||
|
||||
MACHINE=`uname -m`
|
||||
SYSTEM=`uname -s`
|
||||
|
||||
|
@ -60,8 +67,10 @@ AC_SUBST(GIT_REVISION)
|
|||
AC_SUBST(GIT_RELEASE)
|
||||
AC_SUBST(N2N_DEFINES)
|
||||
AC_SUBST(N2N_LIBS)
|
||||
AC_SUBST(ADDITIONAL_TOOLS)
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
AC_CONFIG_FILES(Makefile)
|
||||
AC_CONFIG_FILES(tools/Makefile)
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
|
|
2
n2n.h
2
n2n.h
|
@ -42,8 +42,10 @@
|
|||
#undef N2N_HAVE_DAEMON
|
||||
#undef N2N_HAVE_SETUID
|
||||
#else
|
||||
#ifndef CMAKE_BUILD
|
||||
#include "config.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define PACKAGE_BUILDDATE (__DATE__ " " __TIME__)
|
||||
|
||||
|
|
38
tools/Makefile.in
Normal file
38
tools/Makefile.in
Normal file
|
@ -0,0 +1,38 @@
|
|||
CC?=gcc
|
||||
DEBUG?=-g3
|
||||
#OPTIMIZATION?=-O2
|
||||
WARN?=-Wall
|
||||
|
||||
INSTALL=install
|
||||
INSTALL_PROG=$(INSTALL) -m755
|
||||
MKDIR=mkdir -p
|
||||
|
||||
LIBS_EDGE_OPT=@N2N_LIBS@
|
||||
LIBS_EDGE+=$(LIBS_EDGE_OPT)
|
||||
HEADERS=../n2n_wire.h ../n2n.h ../twofish.h ../n2n_transforms.h
|
||||
CFLAGS+=-I..
|
||||
LDFLAGS+=-L..
|
||||
CFLAGS+=$(DEBUG) $(OPTIMIZATION) $(WARN)
|
||||
|
||||
N2N_LIB=../libn2n.a
|
||||
|
||||
TOOLS=n2n-benchmark
|
||||
TOOLS+=@ADDITIONAL_TOOLS@
|
||||
|
||||
.PHONY: all clean install
|
||||
all: $(TOOLS)
|
||||
|
||||
n2n-benchmark: benchmark.c $(N2N_LIB) $(HEADERS)
|
||||
$(CC) $(CFLAGS) $< $(N2N_LIB) $(LIBS_EDGE) -o $@
|
||||
|
||||
n2n-decode: n2n_decode.c $(N2N_LIB) $(HEADERS)
|
||||
$(CC) $(CFLAGS) $< $(N2N_LIB) $(LIBS_EDGE) -lpcap -o $@
|
||||
|
||||
.c.o: $(HEADERS) ../Makefile Makefile
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
rm -rf $(TOOLS) $(N2N_LIB) *.o *.dSYM *~
|
||||
|
||||
install: $(TOOLS)
|
||||
$(INSTALL_PROG) $(TOOLS) $(SBINDIR)/
|
Loading…
Reference in New Issue
Block a user