summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2014-09-13 23:46:34 +0100
committersin <sin@2f30.org>2014-09-13 23:46:34 +0100
commit9c28246716a1ab4d73e312b7f009cc0cd96a3268 (patch)
treec26334151712525562285c449e26b8c03b9b5f43
parent43513cf6c68a4cb73117b2a2ff71f7499f5feb89 (diff)
Add Makefile + config.mk + config.def.h
-rw-r--r--Makefile47
-rw-r--r--config.def.h68
-rw-r--r--config.mk12
-rw-r--r--ratatox.c69
4 files changed, 130 insertions, 66 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..46cc224
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,47 @@
+include config.mk
+
+.POSIX:
+.SUFFIXES: .c .o
+
+SRC = ratatox.c
+
+OBJ = $(SRC:.c=.o)
+BIN = $(SRC:.c=)
+
+all: options bin
+
+options:
+ @echo ratatox build options:
+ @echo "CFLAGS = $(CFLAGS)"
+ @echo "LDFLAGS = $(LDFLAGS)"
+ @echo "CC = $(CC)"
+
+bin: $(BIN)
+
+$(OBJ): config.h config.mk
+
+config.h:
+ @echo creating $@ from config.def.h
+ @cp config.def.h $@
+
+.o:
+ @echo LD $@
+ @$(LD) -o $@ $< $(LDFLAGS)
+
+.c.o:
+ @echo CC $<
+ @$(CC) -c -o $@ $< $(CFLAGS)
+
+install: all
+ @echo installing executable to $(DESTDIR)$(PREFIX)/bin
+ @mkdir -p $(DESTDIR)$(PREFIX)/bin
+ @cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
+ @chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
+
+uninstall:
+ @echo removing executable from $(DESTDIR)$(PREFIX)/bin
+ @cd $(DESTDIR)$(PREFIX)/bin && rm -f $(BIN)
+
+clean:
+ @echo cleaning
+ @rm -f $(BIN) $(OBJ)
diff --git a/config.def.h b/config.def.h
new file mode 100644
index 0000000..c2e9dcc
--- /dev/null
+++ b/config.def.h
@@ -0,0 +1,68 @@
+/* See LICENSE file for copyright and license details. */
+
+static struct bootstrapnode bootstrapnodes[] = {
+ {
+ "95.85.13.245",
+ 33445,
+ {
+ 0x71, 0x87, 0x96, 0x9B, 0xB1, 0x0B, 0x54, 0xC9, 0x85, 0x38, 0xBA, 0xE9, 0x4C, 0x06, 0x9C, 0xE5,
+ 0xC8, 0x4E, 0x65, 0x0D, 0x54, 0xF7, 0xE5, 0x96, 0x54, 0x3D, 0x8F, 0xB1, 0xEC, 0xF4, 0xCF, 0x23
+ }
+ },
+ {
+ "37.187.46.132",
+ 33445,
+ {
+ 0xA9, 0xD9, 0x82, 0x12, 0xB3, 0xF9, 0x72, 0xBD, 0x11, 0xDA, 0x52, 0xBE, 0xB0, 0x65, 0x8C, 0x32,
+ 0x6F, 0xCC, 0xC1, 0xBF, 0xD4, 0x9F, 0x34, 0x7F, 0x9C, 0x2D, 0x3D, 0x8B, 0x61, 0xE1, 0xB9, 0x27
+ }
+ },
+ {
+ "144.76.60.215",
+ 33445,
+ {
+ 0x04, 0x11, 0x9E, 0x83, 0x5D, 0xF3, 0xE7, 0x8B, 0xAC, 0xF0, 0xF8, 0x42, 0x35, 0xB3, 0x00, 0x54,
+ 0x6A, 0xF8, 0xB9, 0x36, 0xF0, 0x35, 0x18, 0x5E, 0x2A, 0x8E, 0x9E, 0x0A, 0x67, 0xC8, 0x92, 0x4F
+ }
+ },
+ {
+ "23.226.230.47",
+ 33445,
+ {
+ 0xA0, 0x91, 0x62, 0xD6, 0x86, 0x18, 0xE7, 0x42, 0xFF, 0xBC, 0xA1, 0xC2, 0xC7, 0x03, 0x85, 0xE6,
+ 0x67, 0x96, 0x04, 0xB2, 0xD8, 0x0E, 0xA6, 0xE8, 0x4A, 0xD0, 0x99, 0x6A, 0x1A, 0xC8, 0xA0, 0x74
+ }
+ },
+ {
+ "54.199.139.199",
+ 33445,
+ {
+ 0x7F, 0x9C, 0x31, 0xFE, 0x85, 0x0E, 0x97, 0xCE, 0xFD, 0x4C, 0x45, 0x91, 0xDF, 0x93, 0xFC, 0x75,
+ 0x7C, 0x7C, 0x12, 0x54, 0x9D, 0xDD, 0x55, 0xF8, 0xEE, 0xAE, 0xCC, 0x34, 0xFE, 0x76, 0xC0, 0x29
+ }
+ },
+ {
+ "109.169.46.133",
+ 33445,
+ {
+ 0x7F, 0x31, 0xBF, 0xC9, 0x3B, 0x8E, 0x40, 0x16, 0xA9, 0x02, 0x14, 0x4D, 0x0B, 0x11, 0x0C, 0x3E,
+ 0xA9, 0x7C, 0xB7, 0xD4, 0x3F, 0x1C, 0x4D, 0x21, 0xBC, 0xAE, 0x99, 0x8A, 0x7C, 0x83, 0x88, 0x21
+ }
+ },
+ {
+ "192.210.149.121",
+ 33445,
+ {
+ 0xF4, 0x04, 0xAB, 0xAA, 0x1C, 0x99, 0xA9, 0xD3, 0x7D, 0x61, 0xAB, 0x54, 0x89, 0x8F, 0x56, 0x79,
+ 0x3E, 0x1D, 0xEF, 0x8B, 0xD4, 0x6B, 0x10, 0x38, 0xB9, 0xD8, 0x22, 0xE8, 0x46, 0x0F, 0xAB, 0x67
+ }
+ },
+ {
+ "76.191.23.96",
+ 33445,
+ {
+ 0x4B, 0xA5, 0x76, 0x60, 0xDE, 0x3E, 0x85, 0x4C, 0x53, 0x0E, 0xED, 0x60, 0x1B, 0xF8, 0xD5, 0x4B,
+ 0x7E, 0xFA, 0xE9, 0x60, 0x52, 0x3B, 0x6C, 0xFC, 0x10, 0x21, 0x0C, 0xC0, 0x8E, 0x2C, 0xB8, 0x08
+ }
+ },
+};
diff --git a/config.mk b/config.mk
new file mode 100644
index 0000000..050dade
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,12 @@
+# ratatox version
+VERSION = 0.0
+
+# paths
+PREFIX = /usr/local
+MANPREFIX = $(PREFIX)/share/man
+
+CC = cc
+LD = $(CC)
+CPPFLAGS =
+CFLAGS = -I/usr/local/include $(CPPFLAGS)
+LDFLAGS = -L/usr/local/lib -ltoxcore
diff --git a/ratatox.c b/ratatox.c
index 5850eb3..5e945df 100644
--- a/ratatox.c
+++ b/ratatox.c
@@ -19,77 +19,14 @@
#define LEN(x) (sizeof (x) / sizeof *(x))
-static struct bootstrapnode {
+struct bootstrapnode {
char *addr;
uint16_t port;
uint8_t key[TOX_CLIENT_ID_SIZE];
-} bootstrapnodes[] = {
- {
- "95.85.13.245",
- 33445,
- {
- 0x71, 0x87, 0x96, 0x9B, 0xB1, 0x0B, 0x54, 0xC9, 0x85, 0x38, 0xBA, 0xE9, 0x4C, 0x06, 0x9C, 0xE5,
- 0xC8, 0x4E, 0x65, 0x0D, 0x54, 0xF7, 0xE5, 0x96, 0x54, 0x3D, 0x8F, 0xB1, 0xEC, 0xF4, 0xCF, 0x23
- }
- },
- {
- "37.187.46.132",
- 33445,
- {
- 0xA9, 0xD9, 0x82, 0x12, 0xB3, 0xF9, 0x72, 0xBD, 0x11, 0xDA, 0x52, 0xBE, 0xB0, 0x65, 0x8C, 0x32,
- 0x6F, 0xCC, 0xC1, 0xBF, 0xD4, 0x9F, 0x34, 0x7F, 0x9C, 0x2D, 0x3D, 0x8B, 0x61, 0xE1, 0xB9, 0x27
- }
- },
- {
- "144.76.60.215",
- 33445,
- {
- 0x04, 0x11, 0x9E, 0x83, 0x5D, 0xF3, 0xE7, 0x8B, 0xAC, 0xF0, 0xF8, 0x42, 0x35, 0xB3, 0x00, 0x54,
- 0x6A, 0xF8, 0xB9, 0x36, 0xF0, 0x35, 0x18, 0x5E, 0x2A, 0x8E, 0x9E, 0x0A, 0x67, 0xC8, 0x92, 0x4F
- }
- },
- {
- "23.226.230.47",
- 33445,
- {
- 0xA0, 0x91, 0x62, 0xD6, 0x86, 0x18, 0xE7, 0x42, 0xFF, 0xBC, 0xA1, 0xC2, 0xC7, 0x03, 0x85, 0xE6,
- 0x67, 0x96, 0x04, 0xB2, 0xD8, 0x0E, 0xA6, 0xE8, 0x4A, 0xD0, 0x99, 0x6A, 0x1A, 0xC8, 0xA0, 0x74
- }
- },
- {
- "54.199.139.199",
- 33445,
- {
- 0x7F, 0x9C, 0x31, 0xFE, 0x85, 0x0E, 0x97, 0xCE, 0xFD, 0x4C, 0x45, 0x91, 0xDF, 0x93, 0xFC, 0x75,
- 0x7C, 0x7C, 0x12, 0x54, 0x9D, 0xDD, 0x55, 0xF8, 0xEE, 0xAE, 0xCC, 0x34, 0xFE, 0x76, 0xC0, 0x29
- }
- },
- {
- "109.169.46.133",
- 33445,
- {
- 0x7F, 0x31, 0xBF, 0xC9, 0x3B, 0x8E, 0x40, 0x16, 0xA9, 0x02, 0x14, 0x4D, 0x0B, 0x11, 0x0C, 0x3E,
- 0xA9, 0x7C, 0xB7, 0xD4, 0x3F, 0x1C, 0x4D, 0x21, 0xBC, 0xAE, 0x99, 0x8A, 0x7C, 0x83, 0x88, 0x21
- }
- },
- {
- "192.210.149.121",
- 33445,
- {
- 0xF4, 0x04, 0xAB, 0xAA, 0x1C, 0x99, 0xA9, 0xD3, 0x7D, 0x61, 0xAB, 0x54, 0x89, 0x8F, 0x56, 0x79,
- 0x3E, 0x1D, 0xEF, 0x8B, 0xD4, 0x6B, 0x10, 0x38, 0xB9, 0xD8, 0x22, 0xE8, 0x46, 0x0F, 0xAB, 0x67
- }
- },
- {
- "76.191.23.96",
- 33445,
- {
- 0x4B, 0xA5, 0x76, 0x60, 0xDE, 0x3E, 0x85, 0x4C, 0x53, 0x0E, 0xED, 0x60, 0x1B, 0xF8, 0xD5, 0x4B,
- 0x7E, 0xFA, 0xE9, 0x60, 0x52, 0x3B, 0x6C, 0xFC, 0x10, 0x21, 0x0C, 0xC0, 0x8E, 0x2C, 0xB8, 0x08
- }
- },
};
+#include "config.h"
+
enum {
TEXT_IN_FIFO,
NR_FIFOS