diff options
Diffstat (limited to 'curvetun')
-rw-r--r-- | curvetun/.gitignore | 7 | ||||
-rw-r--r-- | curvetun/Makefile | 17 | ||||
-rw-r--r-- | curvetun/abiname.c | 46 | ||||
-rwxr-xr-x | curvetun/build_nacl.sh | 46 | ||||
-rwxr-xr-x | curvetun/nacl_path.sh | 18 |
5 files changed, 134 insertions, 0 deletions
diff --git a/curvetun/.gitignore b/curvetun/.gitignore new file mode 100644 index 0000000..d834aa2 --- /dev/null +++ b/curvetun/.gitignore @@ -0,0 +1,7 @@ +*.* + +!.gitignore +!Makefile +!abiname.c +!build_nacl.sh +!nacl_path.sh diff --git a/curvetun/Makefile b/curvetun/Makefile new file mode 100644 index 0000000..954a865 --- /dev/null +++ b/curvetun/Makefile @@ -0,0 +1,17 @@ +curvetun-libs = -lnacl \ + -lpthread + +curvetun-objs = xmalloc.o \ + xio.o \ + xutils.o \ + stun.o \ + patricia.o \ + trie.o \ + hash.o \ + curve.o \ + cpusched.o \ + ct_usermgmt.o \ + ct_servmgmt.o \ + ct_server.o \ + ct_client.o \ + curvetun.o diff --git a/curvetun/abiname.c b/curvetun/abiname.c new file mode 100644 index 0000000..976db15 --- /dev/null +++ b/curvetun/abiname.c @@ -0,0 +1,46 @@ +#include <stdio.h> + +const char *abi(void) +{ +#if defined(__amd64__) || defined(__x86_64__) || defined(__AMD64__) || defined(_M_X64) || defined(__amd64) + return "amd64"; +#elif defined(__i386__) || defined(__x86__) || defined(__X86__) || defined(_M_IX86) || defined(__i386) + return "x86"; +#elif defined(__ia64__) || defined(__IA64__) || defined(__M_IA64) + return "ia64"; +#elif defined(__SPU__) + return "cellspu"; +#elif defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) || defined(_ARCH_PPC64) + return "ppc64"; +#elif defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) || defined(_ARCH_PPC) + return "ppc32"; +#elif defined(__sparcv9__) || defined(__sparcv9) + return "sparcv9"; +#elif defined(__sparc_v8__) + return "sparcv8"; +#elif defined(__sparc__) || defined(__sparc) + if (sizeof(long) == 4) + return "sparcv8"; + return "sparcv9"; +#elif defined(__ARM_EABI__) + return "armeabi"; +#elif defined(__arm__) + return "arm"; +#elif defined(__mips__) || defined(__mips) || defined(__MIPS__) +# if defined(_ABIO32) + return "mipso32"; +# elif defined(_ABIN32) + return "mips32"; +# else + return "mips64"; +# endif +#else + return "default"; +#endif +} + +int main(void) +{ + printf("%s\n", abi()); + return 0; +} diff --git a/curvetun/build_nacl.sh b/curvetun/build_nacl.sh new file mode 100755 index 0000000..7a97302 --- /dev/null +++ b/curvetun/build_nacl.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# netsniff-ng - the packet sniffing beast +# By Emmanuel Roullit <emmanuel@netsniff-ng.org> +# Copyright 2009, 2011 Emmanuel Roullit. +# Subject to the GPL, version 2. + +cc="gcc" +nacl_dir="/tmp" +nacl_version="nacl-20110221" +nacl_suffix="tar.bz2" +nacl_base_url="http://hyperelliptic.org/nacl" +nacl_path="$nacl_dir/$nacl_version.$nacl_suffix" +nacl_build_dir="$1" + +if test -z "$nacl_build_dir"; then + echo "Please input the path where NaCl should be build" + exit 1 +fi + +if ! test -d "$nacl_build_dir"; then + mkdir "$nacl_build_dir" +fi + +wget -O "$nacl_path" "$nacl_base_url/$nacl_version.$nacl_suffix" +tar xjf "$nacl_path" -C "$nacl_build_dir" + +$cc -Wall -O2 ./abiname.c -o ./abiname +arch="`./abiname`" +shorthostname=$(hostname | sed 's/\..*//' | tr -cd '[a-z][A-Z][0-9]') + +echo "Building NaCl for arch $arch on host $shorthostname (grab a coffee, this takes a while) ..." + +cd "$nacl_build_dir"/"$nacl_version" +./do +cd - > /dev/null + +nacl_lib_path="$nacl_build_dir/$nacl_version/build/$shorthostname/lib/$arch" +nacl_include_path="$nacl_build_dir/$nacl_version/build/$shorthostname/include/$arch" + +echo "NaCl lib path $nacl_lib_path" +echo "NaCl include path $nacl_include_path" + +./nacl_path.sh "$nacl_include_path" "$nacl_lib_path" + +echo "Done!" diff --git a/curvetun/nacl_path.sh b/curvetun/nacl_path.sh new file mode 100755 index 0000000..1afc6d2 --- /dev/null +++ b/curvetun/nacl_path.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# netsniff-ng - the packet sniffing beast +# By Emmanuel Roullit <emmanuel@netsniff-ng.org> +# Copyright 2009, 2011 Emmanuel Roullit. +# Subject to the GPL, version 2. + +nacl_include_path="$1" +nacl_lib_path="$2" + +if test -z $nacl_include_path || test -z $nacl_lib_path; then + echo "Please input the path where NaCl is like the following:" + echo "./$0.sh <include_path> <lib_path>" + exit 1 +fi + +echo "export NACL_INC_DIR=$nacl_include_path" >> ~/.bashrc +echo "export NACL_LIB_DIR=$nacl_lib_path" >> ~/.bashrc |