From cf6e1740e98b767997f90806d4c6b28a221261a2 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Fri, 4 Nov 2011 11:09:44 +0100 Subject: [PATCH] Renamed files, updated header comments --- INSTALL | 12 +-- src/compiler.h | 7 +- src/definitions.mk | 2 +- src/die.h | 7 +- src/gen_build_info.pl | 26 +++++++ src/netyack.c | 156 ------------------------------------- src/signals.h | 7 +- src/strlcpy.c | 7 +- src/strlcpy.h | 7 +- src/stun.c | 7 +- src/stun.h | 7 +- src/transsip.c | 63 +++++++++++++++ src/{netyack => transsip}/Makefile | 26 +++---- src/v4l-player.c | 21 ++--- src/xmalloc.c | 7 +- src/xmalloc.h | 7 +- 16 files changed, 149 insertions(+), 220 deletions(-) create mode 100755 src/gen_build_info.pl delete mode 100644 src/netyack.c create mode 100644 src/transsip.c rename src/{netyack => transsip}/Makefile (68%) diff --git a/INSTALL b/INSTALL index 1135170..fb0c8a6 100644 --- a/INSTALL +++ b/INSTALL @@ -4,20 +4,16 @@ What libraries are required? To run netyack, you need: * libcelt * libspeexdsp - * libjackd2 + * libasound Under Debian simply type: -# apt-get install libcelt0-0 libcelt-dev libspeexdsp1 libspeexdsp-dev jackd2 \ - libjack-jackd2-dev libjack-jackd2-0 +# apt-get install libcelt0-0 libcelt-dev \ + libspeexdsp1 libspeexdsp-dev \ + libasound2-dev libasound2 If the compiler somehow complains about not finding libspeexdsp1, try: # ln -s /usr/lib/libspeexdsp.so.1 /usr/lib/libspeexdsp.so -Then run the JACK2 daemon if not already running, e.g. with: -# jackd -d alsa - -Now you're ready to go yacking! - Installation ============ diff --git a/src/compiler.h b/src/compiler.h index b4a2769..daecb8e 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -1,7 +1,8 @@ /* - * netyack - * By Daniel Borkmann - * Copyright 2009, 2010 Daniel Borkmann. + * transsip - the telephony network + * By Daniel Borkmann + * Copyright 2011 Daniel Borkmann , + * Swiss federal institute of technology (ETH Zurich) * Subject to the GPL, version 2. */ diff --git a/src/definitions.mk b/src/definitions.mk index 6bae247..bce814d 100644 --- a/src/definitions.mk +++ b/src/definitions.mk @@ -36,7 +36,7 @@ ifneq ($(or $(call eq,$(MAKECMDGOALS),"all"), $(call eq,$(MAKECMDGOALS),"")),) -fno-delete-null-pointer-checks -std=gnu99 \ -fstack-protector -D_FORTIFY_SOURCE=2 -fPIE \ -fno-strict-overflow -D_REENTRANT -pedantic - CFLAGS += -Wall -Werror -Wundef -Wstrict-prototypes -Wno-trigraphs \ + CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -Werror-implicit-function-declaration -Wno-format-security \ -Wcomments -Wendif-labels -Wno-long-long -Wuninitialized \ -Wstrict-overflow diff --git a/src/die.h b/src/die.h index 46fb57e..bb5ac01 100644 --- a/src/die.h +++ b/src/die.h @@ -1,7 +1,8 @@ /* - * netyack - * By Daniel Borkmann - * Copyright 2009, 2010 Daniel Borkmann. + * transsip - the telephony network + * By Daniel Borkmann + * Copyright 2011 Daniel Borkmann , + * Swiss federal institute of technology (ETH Zurich) * Subject to the GPL, version 2. */ diff --git a/src/gen_build_info.pl b/src/gen_build_info.pl new file mode 100755 index 0000000..6feab1d --- /dev/null +++ b/src/gen_build_info.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +use Config; +use POSIX qw(strftime); + +die "No version string supplied!\n" if($#ARGV == -1); + +my $build = strftime "%x,%I:%M%p", gmtime; +my $version = $ARGV[0]; + +open(FP, "> version.h") or die "Cannot create version.h! $!\n"; +print FP < - * Copyright 2011 Daniel Borkmann. - * Subject to the GPL, version 2. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "die.h" -#include "compiler.h" -#include "xmalloc.h" - -static jack_port_t *input, *output; -static jack_client_t *client; - -static int jack_process_phys_frames(jack_nframes_t nframes, void *arg) -{ - jack_default_audio_sample_t *in, *out; - in = jack_port_get_buffer(input, nframes); - out = jack_port_get_buffer(output, nframes); - memcpy(out, in, sizeof(*in) * nframes); - return 0; -} - -static int jack_process_new_net_frames(jack_nframes_t nframes, void *arg) -{ -} - -static void jack_shutdown(void *arg) -{ - die(); -} - -static void jack_setup(const char *name) -{ - int ret; - const char **ports; - jack_options_t options = JackNoStartServer; - jack_status_t status; - - client = jack_client_open(name, options, &status, NULL); - if (!client) { - whine("Opening JACK client failed (0x%2.0x)\n", status); - if (status & JackServerFailed) - whine("JACK server not running?\n"); - die(); - } - - jack_set_process_callback(client, jack_process_phys_frames, 0); - jack_on_shutdown(client, jack_shutdown, 0); - - input = jack_port_register(client, "input", - JACK_DEFAULT_AUDIO_TYPE, - JackPortIsInput, 0); - output = jack_port_register(client, "output", - JACK_DEFAULT_AUDIO_TYPE, - JackPortIsOutput, 0); - if (!input || !output) - panic("No more JACK ports available!\n"); - - ret = jack_activate(client); - if (ret) - panic("Cannot activate JACK client!\n"); - - ports = jack_get_ports(client, NULL, NULL, - JackPortIsPhysical | JackPortIsOutput); - if (!ports) - panic("No physical capture ports available!\n"); - - ret = jack_connect(client, ports[0], jack_port_name(input)); - free(ports); - if (ret) - panic("Cannot connect input ports!\n"); - - ports = jack_get_ports(client, NULL, NULL, - JackPortIsPhysical | JackPortIsInput); - if (!ports) - panic("No physical playback ports available!\n"); - - ret = jack_connect(client, jack_port_name(output), ports[0]); - free(ports); - if (ret) - panic("Cannot connect output ports!\n"); - - info("plugged to jack\n"); -} - -static void help(void) -{ - printf("\npeerspeak %s, lightweight curve25519-based VoIP phone\n", - VERSION_STRING); - printf("http://www.transsip.org\n\n"); - printf("Usage: peerspeak [options]\n"); - printf("Options:\n"); - printf(" -p|--port Port number for daemon (mandatory)\n"); - printf(" -c|--call Call alias from config\n"); - printf(" -t|--stun Show public IP/Port mapping via STUN\n"); - printf(" -k|--keygen Generate public/private keypair\n"); - printf(" -x|--export Export your public data for remote servers\n"); - printf(" -C|--dumpc Dump parsed clients\n"); - printf(" -S|--dumps Dump parsed servers\n"); - printf(" -v|--version Print version\n"); - printf(" -h|--help Print this help\n"); - printf("\n"); - printf("Example:\n"); - printf(" curvetun --keygen\n"); - printf(" curvetun --export\n"); - printf(" curvetun --port 3244 &\n"); - printf(" curvetun --call john\n"); - printf("\n"); - printf("Note:\n"); - printf(" There is no default port specified, so that you are forced\n"); - printf(" to select your own! For client/server status messages see syslog!\n"); - printf("\n"); - printf("Secret ingredient: 7647-14-5\n"); - printf("\n"); - printf("Please report bugs to \n"); - printf("Copyright (C) 2011 Daniel Borkmann ,\n"); - printf("License: GNU GPL version 2\n"); - printf("This is free software: you are free to change and redistribute it.\n"); - printf("There is NO WARRANTY, to the extent permitted by law.\n\n"); - die(); -} - -static void version(void) -{ - printf("\npeerspeak %s, lightweight curve25519-based VoIP phone\n", - VERSION_STRING); - printf("Build: %s\n", BUILD_STRING); - printf("http://www.transsip.org\n\n"); - printf("Please report bugs to \n"); - printf("Copyright (C) 2011 Daniel Borkmann ,\n"); - printf("License: GNU GPL version 2\n"); - printf("This is free software: you are free to change and redistribute it.\n"); - printf("There is NO WARRANTY, to the extent permitted by law.\n\n"); - die(); -} - -int main(int argc, char **argv) -{ - jack_setup(argv[0]); - - sleep(-1); - - jack_client_close(client); - return 0; -} diff --git a/src/signals.h b/src/signals.h index e67b8bf..283ed4a 100644 --- a/src/signals.h +++ b/src/signals.h @@ -1,7 +1,8 @@ /* - * netyack - * By Daniel Borkmann - * Copyright 2009, 2010 Daniel Borkmann. + * transsip - the telephony network + * By Daniel Borkmann + * Copyright 2011 Daniel Borkmann , + * Swiss federal institute of technology (ETH Zurich) * Subject to the GPL, version 2. */ diff --git a/src/strlcpy.c b/src/strlcpy.c index ab1c594..6ca8f67 100644 --- a/src/strlcpy.c +++ b/src/strlcpy.c @@ -1,7 +1,8 @@ /* - * netyack - * By Daniel Borkmann - * Copyright 2009, 2010 Daniel Borkmann. + * transsip - the telephony network + * By Daniel Borkmann + * Copyright 2011 Daniel Borkmann , + * Swiss federal institute of technology (ETH Zurich) * Subject to the GPL, version 2. */ diff --git a/src/strlcpy.h b/src/strlcpy.h index 1d17912..3634b39 100644 --- a/src/strlcpy.h +++ b/src/strlcpy.h @@ -1,7 +1,8 @@ /* - * netyack - * By Daniel Borkmann - * Copyright 2009, 2010 Daniel Borkmann. + * transsip - the telephony network + * By Daniel Borkmann + * Copyright 2011 Daniel Borkmann , + * Swiss federal institute of technology (ETH Zurich) * Subject to the GPL, version 2. */ diff --git a/src/stun.c b/src/stun.c index d9e57fd..06f97f0 100644 --- a/src/stun.c +++ b/src/stun.c @@ -1,7 +1,8 @@ /* - * netsniff-ng - the packet sniffing beast - * By Daniel Borkmann - * Copyright 2011 Daniel Borkmann. + * transsip - the telephony network + * By Daniel Borkmann + * Copyright 2011 Daniel Borkmann , + * Swiss federal institute of technology (ETH Zurich) * Subject to the GPL, version 2. */ diff --git a/src/stun.h b/src/stun.h index c051e20..8240ddf 100644 --- a/src/stun.h +++ b/src/stun.h @@ -1,7 +1,8 @@ /* - * netsniff-ng - the packet sniffing beast - * By Daniel Borkmann - * Copyright 2011 Daniel Borkmann. + * transsip - the telephony network + * By Daniel Borkmann + * Copyright 2011 Daniel Borkmann , + * Swiss federal institute of technology (ETH Zurich) * Subject to the GPL, version 2. */ diff --git a/src/transsip.c b/src/transsip.c new file mode 100644 index 0000000..fb64d5e --- /dev/null +++ b/src/transsip.c @@ -0,0 +1,63 @@ +/* + * transsip - the telephony network + * By Daniel Borkmann + * Copyright 2011 Daniel Borkmann , + * Swiss federal institute of technology (ETH Zurich) + * Subject to the GPL, version 2. + */ + +#include +#include +#include +#include +#include + +#include "die.h" +#include "compiler.h" +#include "xmalloc.h" +#include "version.h" + +static void help(void) +{ + printf("\ntranssip %s, elliptic-curve-crypto-based p2p telephony network\n", + VERSION_STRING); + printf("http://www.transsip.org\n\n"); + printf("Usage: transsip [options]\n"); + printf("Options:\n"); + printf(" -v|--version Print version\n"); + printf(" -h|--help Print this help\n"); + printf("\n"); + printf("Example:\n"); + printf("\n"); + printf("Note:\n"); + printf(" There is no default port specified, so that you are forced\n"); + printf(" to select your own! For client/server status messages see syslog!\n"); + printf("\n"); + printf("Secret ingredient: 7647-14-5\n"); + printf("\n"); + printf("Please report bugs to \n"); + printf("Copyright (C) 2011 Daniel Borkmann ,\n"); + printf("License: GNU GPL version 2\n"); + printf("This is free software: you are free to change and redistribute it.\n"); + printf("There is NO WARRANTY, to the extent permitted by law.\n\n"); + die(); +} + +static void version(void) +{ + printf("\ntranssip %s, elliptic-curve-crypto-based p2p telephony network\n", + VERSION_STRING); + printf("Build: %s\n", BUILD_STRING); + printf("http://www.transsip.org\n\n"); + printf("Please report bugs to \n"); + printf("Copyright (C) 2011 Daniel Borkmann ,\n"); + printf("License: GNU GPL version 2\n"); + printf("This is free software: you are free to change and redistribute it.\n"); + printf("There is NO WARRANTY, to the extent permitted by law.\n\n"); + die(); +} + +int main(int argc, char **argv) +{ + return 0; +} diff --git a/src/netyack/Makefile b/src/transsip/Makefile similarity index 68% rename from src/netyack/Makefile rename to src/transsip/Makefile index 71cb058..980fa0c 100644 --- a/src/netyack/Makefile +++ b/src/transsip/Makefile @@ -1,25 +1,25 @@ # -# Makefile for netyack +# Makefile for transsip # Author: Daniel Borkmann # include ../definitions.mk -INCLUDE = -I.. -LIBS = -ljack -lpthread -ldl -lrt -lspeexdsp -lcelt0 -lm +INCLUDE = -I.. -I. +LIBS = -lspeexdsp -lasound -lcelt0 -lm -core-objs = netyack.o +core-objs = transsip.o lib-objs = xmalloc.o \ strlcpy.o -target = netyack +target = transsip -all: clean build doc +all: clean gen-version build doc debug: all develop: all -#gen-version: -# @cd .. && cat ../VERSION | xargs ./gen_build_info.pl +gen-version: + @cd .. && cat ../VERSION | xargs ./gen_build_info.pl build: $(lib-objs) $(core-objs) @$(LD) $(target) $(core-objs) $(all-objs) $(LIBS) @@ -27,7 +27,7 @@ build: $(lib-objs) $(core-objs) doc: # @cd ../../Documentation && make clean -# @cd ../../Documentation && make netyack +# @cd ../../Documentation && make transsip # @cp ../../Documentation/man/* . # @cp ../../Documentation/pdf/* . # @cp ../../Documentation/html/* . @@ -52,11 +52,11 @@ help: @echo 'Cleaning targets:' @echo ' clean - Remove generated files' @echo 'Building targets:' - @echo ' all - Build netyack (default)' - @echo ' debug - Build netyack for debugging _only_' + @echo ' all - Build transsip (default)' + @echo ' debug - Build transsip for debugging _only_' @echo 'Setup targets:' - @echo ' install - Install netyack' - @echo ' uninstall - Uninstall netyack' + @echo ' install - Install transsip' + @echo ' uninstall - Uninstall transsip' @echo 'Other targets:' @echo ' help - Print this help' diff --git a/src/v4l-player.c b/src/v4l-player.c index c7675b2..2bdbc30 100644 --- a/src/v4l-player.c +++ b/src/v4l-player.c @@ -1,20 +1,11 @@ /* - * Copyright (C) 2010 Daniel Borkmann - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA + * transsip - the telephony network + * By Daniel Borkmann + * Copyright 2011 Daniel Borkmann , + * Swiss federal institute of technology (ETH Zurich) + * Subject to the GPL, version 2. */ + /* libgtk2.0-dev */ /* Compile with: gcc v4ltest.c `pkg-config --libs --cflags gtk+-2.0` */ diff --git a/src/xmalloc.c b/src/xmalloc.c index ed17eda..92eca4e 100644 --- a/src/xmalloc.c +++ b/src/xmalloc.c @@ -1,7 +1,8 @@ /* - * netyack - * By Daniel Borkmann - * Copyright 2009, 2010 Daniel Borkmann. + * transsip - the telephony network + * By Daniel Borkmann + * Copyright 2011 Daniel Borkmann , + * Swiss federal institute of technology (ETH Zurich) * Subject to the GPL, version 2. */ diff --git a/src/xmalloc.h b/src/xmalloc.h index 63ccc14..981f2c8 100644 --- a/src/xmalloc.h +++ b/src/xmalloc.h @@ -1,7 +1,8 @@ /* - * netyack - * By Daniel Borkmann - * Copyright 2009, 2010 Daniel Borkmann. + * transsip - the telephony network + * By Daniel Borkmann + * Copyright 2011 Daniel Borkmann , + * Swiss federal institute of technology (ETH Zurich) * Subject to the GPL, version 2. */ -- 2.11.4.GIT