From 92253ca97dd309687ccb4ff7ad2a03e660581dd0 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Thu, 21 Nov 2013 12:12:46 +1030 Subject: [PATCH 1/4] Revive config_test.c Move config-dependent code (recvwithttl) from net.c to mdp_net.c (new) Move log-implementation-independent code from log.c to log_util.c (new) Build config_test binary in Makefile --- .gitignore | 1 + Makefile.in | 9 +++++- conf.h | 6 ++-- conf_schema.c | 6 +--- config_test.c | 74 +++++++++++++++++++--------------------------- log.c | 54 +--------------------------------- log_util.c | 73 +++++++++++++++++++++++++++++++++++++++++++++ mdp_net.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++ net.c | 59 ------------------------------------- net.h | 1 - serval.h | 2 ++ sourcefiles.mk | 2 ++ 12 files changed, 202 insertions(+), 165 deletions(-) create mode 100644 log_util.c create mode 100644 mdp_net.c diff --git a/.gitignore b/.gitignore index 5ab0abeb..8b2d31fa 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ serval.c /directory_service /tfw_createfile /fakeradio +/config_test *.so test.*.log testlog diff --git a/Makefile.in b/Makefile.in index 87fb9452..033e45d1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -23,6 +23,7 @@ MONITORCLIENTSRCS=conf.c \ conf_schema.c \ dataformats.c \ log.c \ + log_util.c \ xprintf.c \ os.c \ mem.c \ @@ -43,10 +44,12 @@ MDPCLIENTSRCS=conf.c \ os.c \ mem.c \ log.c \ + log_util.c \ xprintf.c \ mdp_client.c \ instance.c \ net.c \ + mdp_net.c \ socket.c \ str.c \ strbuf.c \ @@ -76,7 +79,7 @@ DEFS= @DEFS@ all: servald libmonitorclient.so libmonitorclient.a test -test: tfw_createfile directory_service fakeradio +test: tfw_createfile directory_service fakeradio config_test sqlite-amalgamation-3070900/sqlite3.o: sqlite-amalgamation-3070900/sqlite3.c @echo CC $< @@ -111,6 +114,10 @@ fakeradio: fakeradio.o @echo LINK $@ @$(CC) $(CFLAGS) -Wall -o $@ fakeradio.o +config_test: config_test.o conf_om.o conf_schema.o conf_parse.o str.o strbuf.o strbuf_helpers.o mem.o dataformats.o net.o log_util.o + @echo LINK $@ + @$(CC) $(CFLAGS) -Wall -o $@ config_test.o conf_om.o conf_schema.o conf_parse.o str.o strbuf.o strbuf_helpers.o mem.o dataformats.o net.o log_util.o + # This does not build on 64 bit elf platforms as NaCL isn't built with -fPIC # DOC 20120615 libservald.so: $(OBJS) version.o diff --git a/conf.h b/conf.h index 2a3fbb7d..116d44bc 100644 --- a/conf.h +++ b/conf.h @@ -222,8 +222,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * @author Andrew Bettison */ -#ifndef __SERVALDNA_CONFIG_H -#define __SERVALDNA_CONFIG_H +#ifndef __SERVALDNA_CONF_H +#define __SERVALDNA_CONF_H #include #include @@ -701,4 +701,4 @@ int cf_reload(); int cf_reload_strict(); int cf_reload_permissive(); -#endif //__SERVALDNA_CONFIG_H +#endif //__SERVALDNA_CONF_H diff --git a/conf_schema.c b/conf_schema.c index 02348b8a..0dc8068f 100644 --- a/conf_schema.c +++ b/conf_schema.c @@ -632,11 +632,7 @@ int cf_cmp_sid(const sid_t *a, const sid_t *b) int cf_opt_rhizome_bk(rhizome_bk_t *bkp, const char *text) { - if (!rhizome_str_is_bundle_key(text)) - return CFINVALID; - size_t n = fromhex(bkp->binary, text, RHIZOME_BUNDLE_KEY_BYTES); - assert(n == RHIZOME_BUNDLE_KEY_BYTES); - return CFOK; + return str_to_rhizome_bk_t(bkp, text) ? CFOK : CFINVALID; } int cf_fmt_rhizome_bk(const char **textp, const rhizome_bk_t *bkp) diff --git a/config_test.c b/config_test.c index 7cff08fc..42b1c159 100644 --- a/config_test.c +++ b/config_test.c @@ -1,8 +1,28 @@ +/* +Serval DNA configuration stand-alone configuration check utility +Copyright 2013 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + #include #include #include #include #include +#include #include #include "str.h" @@ -30,7 +50,7 @@ int main(int argc, char **argv) exit(1); } struct cf_om_node *root = NULL; - int ret = cf_parse_to_om(argv[i], buf, st.st_size, &root); + int ret = cf_om_parse(argv[i], buf, st.st_size, &root); close(fd); DEBUGF("ret = %s", strbuf_str(strbuf_cf_flags(strbuf_alloca(128), ret))); //cf_dump_node(root, 0); @@ -38,17 +58,17 @@ int main(int argc, char **argv) memset(&config, 0, sizeof config); cf_dfl_config_main(&config); int result = root ? cf_opt_config_main(&config, root) : CFEMPTY; - cf_free_node(&root); + cf_om_free_node(&root); free(buf); DEBUGF("result = %s", strbuf_str(strbuf_cf_flags(strbuf_alloca(128), result))); - DEBUGF("config.log.file = %s", alloca_str_toprint(config.log.file)); - DEBUGF("config.log.show_pid = %d", config.log.show_pid); - DEBUGF("config.log.show_time = %d", config.log.show_time); + DEBUGF("config.log.file.path = %s", alloca_str_toprint(config.log.file.path)); + DEBUGF("config.log.file.show_pid = %d", config.log.file.show_pid); + DEBUGF("config.log.file.show_time = %d", config.log.file.show_time); DEBUGF("config.server.chdir = %s", alloca_str_toprint(config.server.chdir)); - DEBUGF("config.debug = %"PRIx64, (uint64_t) config.debug); + DEBUGF("config.debug.verbose = %d", config.debug.verbose); DEBUGF("config.directory.service = %s", alloca_tohex_sid_t(config.directory.service)); DEBUGF("config.rhizome.api.addfile.allow_host = %s", inet_ntoa(config.rhizome.api.addfile.allow_host)); - int j; + unsigned j; for (j = 0; j < config.mdp.iftype.ac; ++j) { DEBUGF("config.mdp.iftype.%u", config.mdp.iftype.av[j].key); DEBUGF(" .tick_ms = %u", config.mdp.iftype.av[j].value.tick_ms); @@ -63,7 +83,7 @@ int main(int argc, char **argv) DEBUGF(" .port = %u", config.rhizome.direct.peer.av[j].value.port); } for (j = 0; j < config.interfaces.ac; ++j) { - DEBUGF("config.interfaces.%s", config.interfaces.av[j].key); + DEBUGF("config.interfaces.%u", config.interfaces.av[j].key); DEBUGF(" .exclude = %d", config.interfaces.av[j].value.exclude); DEBUGF(" .match = ["); int k; @@ -72,7 +92,9 @@ int main(int argc, char **argv) DEBUGF(" ]"); DEBUGF(" .type = %d", config.interfaces.av[j].value.type); DEBUGF(" .port = %u", config.interfaces.av[j].value.port); - DEBUGF(" .speed = %llu", (unsigned long long) config.interfaces.av[j].value.speed); + DEBUGF(" .drop_broadcasts = %llu", (unsigned long long) config.interfaces.av[j].value.drop_broadcasts); + DEBUGF(" .drop_unicasts = %llu", (unsigned long long) config.interfaces.av[j].value.drop_unicasts); + DEBUGF(" .drop_packets = %llu", (unsigned long long) config.interfaces.av[j].value.drop_packets); } for (j = 0; j < config.hosts.ac; ++j) { char sidhex[SID_STRLEN + 1]; @@ -129,37 +151,3 @@ void logMessage(int level, struct __sourceloc whence, const char *fmt, ...) va_end(ap); fputc('\n', stderr); } - -debugflags_t debugFlagMask(const char *flagname) -{ - if (!strcasecmp(flagname,"all")) return ~0; - else if (!strcasecmp(flagname,"interfaces")) return 1 << 0; - else if (!strcasecmp(flagname,"rx")) return 1 << 1; - else if (!strcasecmp(flagname,"tx")) return 1 << 2; - else if (!strcasecmp(flagname,"verbose")) return 1 << 3; - else if (!strcasecmp(flagname,"verbio")) return 1 << 4; - else if (!strcasecmp(flagname,"peers")) return 1 << 5; - else if (!strcasecmp(flagname,"dnaresponses")) return 1 << 6; - else if (!strcasecmp(flagname,"dnahelper")) return 1 << 7; - else if (!strcasecmp(flagname,"vomp")) return 1 << 8; - else if (!strcasecmp(flagname,"packetformats")) return 1 << 9; - else if (!strcasecmp(flagname,"packetconstruction")) return 1 << 10; - else if (!strcasecmp(flagname,"gateway")) return 1 << 11; - else if (!strcasecmp(flagname,"keyring")) return 1 << 12; - else if (!strcasecmp(flagname,"sockio")) return 1 << 13; - else if (!strcasecmp(flagname,"frames")) return 1 << 14; - else if (!strcasecmp(flagname,"abbreviations")) return 1 << 15; - else if (!strcasecmp(flagname,"routing")) return 1 << 16; - else if (!strcasecmp(flagname,"security")) return 1 << 17; - else if (!strcasecmp(flagname,"rhizome")) return 1 << 18; - else if (!strcasecmp(flagname,"rhizometx")) return 1 << 19; - else if (!strcasecmp(flagname,"rhizomerx")) return 1 << 20; - else if (!strcasecmp(flagname,"rhizomeads")) return 1 << 21; - else if (!strcasecmp(flagname,"monitorroutes")) return 1 << 22; - else if (!strcasecmp(flagname,"queues")) return 1 << 23; - else if (!strcasecmp(flagname,"broadcasts")) return 1 << 24; - else if (!strcasecmp(flagname,"manifests")) return 1 << 25; - else if (!strcasecmp(flagname,"mdprequests")) return 1 << 26; - else if (!strcasecmp(flagname,"timing")) return 1 << 27; - return 0; -} diff --git a/log.c b/log.c index 85f7a99a..15a60733 100644 --- a/log.c +++ b/log.c @@ -1,5 +1,5 @@ /* -Serval DNA logging. +Serval DNA logging Copyright 2013 Serval Project Inc. This program is free software; you can redistribute it and/or @@ -717,30 +717,6 @@ void logConfigChanged() logFlush(); } -int logDump(int level, struct __sourceloc whence, char *name, const unsigned char *addr, size_t len) -{ - if (level != LOG_LEVEL_SILENT) { - char buf[100]; - size_t i; - if (name) - logMessage(level, whence, "Dump of %s", name); - for(i = 0; i < len; i += 16) { - strbuf b = strbuf_local(buf, sizeof buf); - strbuf_sprintf(b, " %04zx :", i); - int j; - for (j = 0; j < 16 && i + j < len; j++) - strbuf_sprintf(b, " %02x", addr[i + j]); - for (; j < 16; j++) - strbuf_puts(b, " "); - strbuf_puts(b, " "); - for (j = 0; j < 16 && i + j < len; j++) - strbuf_sprintf(b, "%c", addr[i+j] >= ' ' && addr[i+j] < 0x7f ? addr[i+j] : '.'); - logMessage(level, whence, "%s", strbuf_str(b)); - } - } - return 0; -} - ssize_t get_self_executable_path(char *buf, size_t len) { #if defined(linux) @@ -860,31 +836,3 @@ int log_backtrace(int level, struct __sourceloc whence) #endif return 0; } - -const char *log_level_as_string(int level) -{ - switch (level) { - case LOG_LEVEL_SILENT: return "silent"; - case LOG_LEVEL_DEBUG: return "debug"; - case LOG_LEVEL_INFO: return "info"; - case LOG_LEVEL_HINT: return "hint"; - case LOG_LEVEL_WARN: return "warn"; - case LOG_LEVEL_ERROR: return "error"; - case LOG_LEVEL_FATAL: return "fatal"; - case LOG_LEVEL_NONE: return "none"; - } - return NULL; -} - -int string_to_log_level(const char *text) -{ - if (strcasecmp(text, "none") == 0) return LOG_LEVEL_NONE; - if (strcasecmp(text, "fatal") == 0) return LOG_LEVEL_FATAL; - if (strcasecmp(text, "error") == 0) return LOG_LEVEL_ERROR; - if (strcasecmp(text, "warn") == 0) return LOG_LEVEL_WARN; - if (strcasecmp(text, "hint") == 0) return LOG_LEVEL_HINT; - if (strcasecmp(text, "info") == 0) return LOG_LEVEL_INFO; - if (strcasecmp(text, "debug") == 0) return LOG_LEVEL_DEBUG; - if (strcasecmp(text, "silent") == 0) return LOG_LEVEL_SILENT; - return LOG_LEVEL_INVALID; -} diff --git a/log_util.c b/log_util.c new file mode 100644 index 00000000..4efbaafb --- /dev/null +++ b/log_util.c @@ -0,0 +1,73 @@ +/* +Serval DNA logging utility functions +Copyright 2013 Serval Project Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include "log.h" +#include "strbuf.h" + +int logDump(int level, struct __sourceloc whence, char *name, const unsigned char *addr, size_t len) +{ + if (level != LOG_LEVEL_SILENT) { + char buf[100]; + size_t i; + if (name) + logMessage(level, whence, "Dump of %s", name); + for(i = 0; i < len; i += 16) { + strbuf b = strbuf_local(buf, sizeof buf); + strbuf_sprintf(b, " %04zx :", i); + int j; + for (j = 0; j < 16 && i + j < len; j++) + strbuf_sprintf(b, " %02x", addr[i + j]); + for (; j < 16; j++) + strbuf_puts(b, " "); + strbuf_puts(b, " "); + for (j = 0; j < 16 && i + j < len; j++) + strbuf_sprintf(b, "%c", addr[i+j] >= ' ' && addr[i+j] < 0x7f ? addr[i+j] : '.'); + logMessage(level, whence, "%s", strbuf_str(b)); + } + } + return 0; +} + +const char *log_level_as_string(int level) +{ + switch (level) { + case LOG_LEVEL_SILENT: return "silent"; + case LOG_LEVEL_DEBUG: return "debug"; + case LOG_LEVEL_INFO: return "info"; + case LOG_LEVEL_HINT: return "hint"; + case LOG_LEVEL_WARN: return "warn"; + case LOG_LEVEL_ERROR: return "error"; + case LOG_LEVEL_FATAL: return "fatal"; + case LOG_LEVEL_NONE: return "none"; + } + return NULL; +} + +int string_to_log_level(const char *text) +{ + if (strcasecmp(text, "none") == 0) return LOG_LEVEL_NONE; + if (strcasecmp(text, "fatal") == 0) return LOG_LEVEL_FATAL; + if (strcasecmp(text, "error") == 0) return LOG_LEVEL_ERROR; + if (strcasecmp(text, "warn") == 0) return LOG_LEVEL_WARN; + if (strcasecmp(text, "hint") == 0) return LOG_LEVEL_HINT; + if (strcasecmp(text, "info") == 0) return LOG_LEVEL_INFO; + if (strcasecmp(text, "debug") == 0) return LOG_LEVEL_DEBUG; + if (strcasecmp(text, "silent") == 0) return LOG_LEVEL_SILENT; + return LOG_LEVEL_INVALID; +} diff --git a/mdp_net.c b/mdp_net.c new file mode 100644 index 00000000..3e45c23b --- /dev/null +++ b/mdp_net.c @@ -0,0 +1,80 @@ +/* +Copyright (C) 2013 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include "serval.h" +#include "conf.h" +#include "log.h" + +ssize_t recvwithttl(int sock,unsigned char *buffer, size_t bufferlen,int *ttl, + struct sockaddr *recvaddr, socklen_t *recvaddrlen) +{ + struct msghdr msg; + struct iovec iov[1]; + + iov[0].iov_base=buffer; + iov[0].iov_len=bufferlen; + bzero(&msg,sizeof(msg)); + msg.msg_name = recvaddr; + msg.msg_namelen = *recvaddrlen; + msg.msg_iov = &iov[0]; + msg.msg_iovlen = 1; + // setting the following makes the data end up in the wrong place + // msg.msg_iov->iov_base=iov_buffer; + // msg.msg_iov->iov_len=sizeof(iov_buffer); + + struct cmsghdr cmsgcmsg[16]; + msg.msg_control = &cmsgcmsg[0]; + msg.msg_controllen = sizeof(struct cmsghdr)*16; + msg.msg_flags = 0; + + ssize_t len = recvmsg(sock,&msg,0); + if (len == -1 && errno != EAGAIN && errno != EWOULDBLOCK) + return WHY_perror("recvmsg"); + +#if 0 + if (config.debug.packetrx) { + DEBUGF("recvmsg returned %d (flags=%d, msg_controllen=%d)", (int) len, msg.msg_flags, (int)msg.msg_controllen); + dump("received data", buffer, len); + } +#endif + + if (len > 0) { + struct cmsghdr *cmsg; + for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) { + if ( cmsg->cmsg_level == IPPROTO_IP + && ((cmsg->cmsg_type == IP_RECVTTL) || (cmsg->cmsg_type == IP_TTL)) + && cmsg->cmsg_len + ) { + if (config.debug.packetrx) + DEBUGF(" TTL (%p) data location resolves to %p", ttl,CMSG_DATA(cmsg)); + if (CMSG_DATA(cmsg)) { + *ttl = *(unsigned char *) CMSG_DATA(cmsg); + if (config.debug.packetrx) + DEBUGF(" TTL of packet is %d", *ttl); + } + } else { + if (config.debug.packetrx) + DEBUGF("I didn't expect to see level=%02x, type=%02x", + cmsg->cmsg_level,cmsg->cmsg_type); + } + } + } + *recvaddrlen=msg.msg_namelen; + + return len; +} diff --git a/net.c b/net.c index e5e2da00..107d9528 100644 --- a/net.c +++ b/net.c @@ -137,62 +137,3 @@ ssize_t _write_str_nonblock(int fd, const char *str, struct __sourceloc __whence { return _write_all_nonblock(fd, str, strlen(str), __whence); } - -ssize_t recvwithttl(int sock,unsigned char *buffer, size_t bufferlen,int *ttl, - struct sockaddr *recvaddr, socklen_t *recvaddrlen) -{ - struct msghdr msg; - struct iovec iov[1]; - - iov[0].iov_base=buffer; - iov[0].iov_len=bufferlen; - bzero(&msg,sizeof(msg)); - msg.msg_name = recvaddr; - msg.msg_namelen = *recvaddrlen; - msg.msg_iov = &iov[0]; - msg.msg_iovlen = 1; - // setting the following makes the data end up in the wrong place - // msg.msg_iov->iov_base=iov_buffer; - // msg.msg_iov->iov_len=sizeof(iov_buffer); - - struct cmsghdr cmsgcmsg[16]; - msg.msg_control = &cmsgcmsg[0]; - msg.msg_controllen = sizeof(struct cmsghdr)*16; - msg.msg_flags = 0; - - ssize_t len = recvmsg(sock,&msg,0); - if (len == -1 && errno != EAGAIN && errno != EWOULDBLOCK) - return WHY_perror("recvmsg"); - -#if 0 - if (config.debug.packetrx) { - DEBUGF("recvmsg returned %d (flags=%d, msg_controllen=%d)", (int) len, msg.msg_flags, (int)msg.msg_controllen); - dump("received data", buffer, len); - } -#endif - - if (len > 0) { - struct cmsghdr *cmsg; - for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) { - if ( cmsg->cmsg_level == IPPROTO_IP - && ((cmsg->cmsg_type == IP_RECVTTL) || (cmsg->cmsg_type == IP_TTL)) - && cmsg->cmsg_len - ) { - if (config.debug.packetrx) - DEBUGF(" TTL (%p) data location resolves to %p", ttl,CMSG_DATA(cmsg)); - if (CMSG_DATA(cmsg)) { - *ttl = *(unsigned char *) CMSG_DATA(cmsg); - if (config.debug.packetrx) - DEBUGF(" TTL of packet is %d", *ttl); - } - } else { - if (config.debug.packetrx) - DEBUGF("I didn't expect to see level=%02x, type=%02x", - cmsg->cmsg_level,cmsg->cmsg_type); - } - } - } - *recvaddrlen=msg.msg_namelen; - - return len; -} diff --git a/net.h b/net.h index 108b3f56..757c2828 100644 --- a/net.h +++ b/net.h @@ -52,6 +52,5 @@ ssize_t _write_all_nonblock(int fd, const void *buf, size_t len, struct __source ssize_t _writev_all(int fd, const struct iovec *iov, int iovcnt, struct __sourceloc __whence); ssize_t _write_str(int fd, const char *str, struct __sourceloc __whence); ssize_t _write_str_nonblock(int fd, const char *str, struct __sourceloc __whence); -ssize_t recvwithttl(int sock, unsigned char *buffer, size_t bufferlen, int *ttl, struct sockaddr *recvaddr, socklen_t *recvaddrlen); #endif // __SERVALD_NET_H diff --git a/serval.h b/serval.h index 1c0a6373..4bf8b5ad 100644 --- a/serval.h +++ b/serval.h @@ -217,6 +217,8 @@ int _socket_set_rcvbufsize(struct __sourceloc, int sock, unsigned buffer_size); int real_sockaddr(const struct sockaddr_un *src_addr, socklen_t src_addrlen, struct sockaddr_un *dst_addr, socklen_t *dst_addrlen); int cmp_sockaddr(const struct sockaddr *, socklen_t, const struct sockaddr *, socklen_t); +ssize_t recvwithttl(int sock, unsigned char *buffer, size_t bufferlen, int *ttl, struct sockaddr *recvaddr, socklen_t *recvaddrlen); + #define SERVER_CONFIG_RELOAD_INTERVAL_MS 1000 struct cli_parsed; diff --git a/sourcefiles.mk b/sourcefiles.mk index f4954e22..30a81219 100644 --- a/sourcefiles.mk +++ b/sourcefiles.mk @@ -17,11 +17,13 @@ SERVAL_SOURCES = \ $(SERVAL_BASE)http_server.c \ $(SERVAL_BASE)keyring.c \ $(SERVAL_BASE)log.c \ + $(SERVAL_BASE)log_util.c \ $(SERVAL_BASE)lsif.c \ $(SERVAL_BASE)main.c \ $(SERVAL_BASE)mavlink.c \ $(SERVAL_BASE)meshms.c \ $(SERVAL_BASE)mdp_client.c \ + $(SERVAL_BASE)mdp_net.c \ $(SERVAL_BASE)os.c \ $(SERVAL_BASE)mem.c \ $(SERVAL_BASE)instance.c \ From c2b9f75fccd7310e1bed9e5732556ef33152ab81 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Thu, 21 Nov 2013 12:14:02 +1030 Subject: [PATCH 2/4] Deprecate RHIZOME_MANIFEST_ID_... in favour of RHIZOME_BUNDLE_ID_... --- rhizome.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/rhizome.h b/rhizome.h index 7b171a15..26c5a8d1 100644 --- a/rhizome.h +++ b/rhizome.h @@ -37,17 +37,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # endif #endif -// TODO Rename MANIFEST_ID to BUNDLE_ID -#define RHIZOME_MANIFEST_ID_BYTES crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES -#define RHIZOME_MANIFEST_ID_STRLEN (RHIZOME_MANIFEST_ID_BYTES * 2) -#define RHIZOME_BUNDLE_KEY_BYTES (crypto_sign_edwards25519sha512batch_SECRETKEYBYTES-crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES) -#define RHIZOME_BUNDLE_KEY_STRLEN (RHIZOME_BUNDLE_KEY_BYTES * 2) +#define RHIZOME_BUNDLE_ID_BYTES crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES +#define RHIZOME_BUNDLE_ID_STRLEN (RHIZOME_BUNDLE_ID_BYTES * 2) +#define RHIZOME_BUNDLE_KEY_BYTES (crypto_sign_edwards25519sha512batch_SECRETKEYBYTES - crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES) +#define RHIZOME_BUNDLE_KEY_STRLEN (RHIZOME_BUNDLE_KEY_BYTES * 2) #define RHIZOME_FILEHASH_BYTES SHA512_DIGEST_LENGTH #define RHIZOME_FILEHASH_STRLEN (RHIZOME_FILEHASH_BYTES * 2) #define RHIZOME_CRYPT_KEY_BYTES crypto_stream_xsalsa20_ref_KEYBYTES #define RHIZOME_CRYPT_KEY_STRLEN (RHIZOME_CRYPT_KEY_BYTES * 2) +// TODO Rename MANIFEST_ID to BUNDLE_ID +// The following constants are deprecated, use the BUNDLE_ID forms instead +#define RHIZOME_MANIFEST_ID_BYTES RHIZOME_BUNDLE_ID_BYTES +#define RHIZOME_MANIFEST_ID_STRLEN RHIZOME_BUNDLE_ID_STRLEN + // assumed to always be 2^n #define RHIZOME_CRYPT_PAGE_SIZE 4096 From 562e011847b0b465162cd1a423a97f91ef05c8e3 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Thu, 21 Nov 2013 12:16:26 +1030 Subject: [PATCH 3/4] Consolidate Rhizome string parsing functions Remove unused rhizome_str[n]_is_...() functions in favour of str[n]_to_rhizome_..._t() functions Ensure that all str_to_..._t() functions accept a NULL 'dst' pointer so they can be used easily to validate strings --- cli.c | 6 +++--- dataformats.c | 45 +++++++++------------------------------------ rhizome.h | 6 ------ 3 files changed, 12 insertions(+), 45 deletions(-) diff --git a/cli.c b/cli.c index 9d1ea003..41f60e6d 100644 --- a/cli.c +++ b/cli.c @@ -339,17 +339,17 @@ int cli_optional_sid(const char *arg) int cli_optional_bundle_key(const char *arg) { - return !arg[0] || rhizome_str_is_bundle_key(arg); + return !arg[0] || str_to_rhizome_bk_t(NULL, arg) != -1; } int cli_manifestid(const char *arg) { - return rhizome_str_is_manifest_id(arg); + return str_to_rhizome_bid_t(NULL, arg) != -1; } int cli_fileid(const char *arg) { - return rhizome_str_is_file_hash(arg); + return str_to_rhizome_filehash_t(NULL, arg) != -1; } int cli_optional_bundle_crypt_key(const char *arg) diff --git a/dataformats.c b/dataformats.c index 5180775d..b9760fc9 100644 --- a/dataformats.c +++ b/dataformats.c @@ -27,17 +27,20 @@ int cmp_sid_t(const sid_t *a, const sid_t *b) return memcmp(a, b, sizeof a->binary); } -int str_to_sid_t(sid_t *sid, const char *hex) { +int str_to_sid_t(sid_t *sid, const char *hex) +{ if (strcmp(hex, "broadcast") == 0) { - *sid = SID_BROADCAST; + if (sid) + *sid = SID_BROADCAST; return 0; } - return fromhexstr(sid->binary, hex, sizeof sid->binary); + return sid ? fromhexstr(sid->binary, hex, sizeof sid->binary) : is_xstring(hex, SID_STRLEN) ? 0 : -1; } int strn_to_sid_t(sid_t *sid, const char *hex, const char **endp) { if (str_startswith(hex, "broadcast", endp) == 0) { + if (sid) *sid = SID_BROADCAST; return 0; } @@ -79,7 +82,7 @@ int cmp_rhizome_bid_t(const rhizome_bid_t *a, const rhizome_bid_t *b) int str_to_rhizome_bid_t(rhizome_bid_t *bid, const char *hex) { - return fromhexstr(bid->binary, hex, sizeof bid->binary); + return bid ? fromhexstr(bid->binary, hex, sizeof bid->binary) : is_xstring(hex, RHIZOME_BUNDLE_ID_STRLEN) ? 0 : -1; } int strn_to_rhizome_bid_t(rhizome_bid_t *bid, const char *hex, const char **endp) @@ -101,7 +104,7 @@ int cmp_rhizome_filehash_t(const rhizome_filehash_t *a, const rhizome_filehash_t int str_to_rhizome_filehash_t(rhizome_filehash_t *hashp, const char *hex) { - return fromhexstr(hashp->binary, hex, sizeof hashp->binary); + return hashp ? fromhexstr(hashp->binary, hex, sizeof hashp->binary) : is_xstring(hex, RHIZOME_FILEHASH_STRLEN) ? 0 : -1; } int strn_to_rhizome_filehash_t(rhizome_filehash_t *hashp, const char *hex, const char **endp) @@ -118,27 +121,7 @@ int strn_to_rhizome_filehash_t(rhizome_filehash_t *hashp, const char *hex, const int str_to_rhizome_bk_t(rhizome_bk_t *bkp, const char *hex) { - return fromhexstr(bkp->binary, hex, sizeof bkp->binary); -} - -int rhizome_strn_is_manifest_id(const char *id) -{ - return is_xsubstring(id, RHIZOME_MANIFEST_ID_STRLEN); -} - -int rhizome_str_is_manifest_id(const char *id) -{ - return is_xstring(id, RHIZOME_MANIFEST_ID_STRLEN); -} - -int rhizome_strn_is_bundle_key(const char *key) -{ - return is_xsubstring(key, RHIZOME_BUNDLE_KEY_STRLEN); -} - -int rhizome_str_is_bundle_key(const char *key) -{ - return is_xstring(key, RHIZOME_BUNDLE_KEY_STRLEN); + return bkp ? fromhexstr(bkp->binary, hex, sizeof bkp->binary) : is_xstring(hex, RHIZOME_BUNDLE_KEY_STRLEN) ? 0 : -1; } int rhizome_strn_is_bundle_crypt_key(const char *key) @@ -151,16 +134,6 @@ int rhizome_str_is_bundle_crypt_key(const char *key) return is_xstring(key, RHIZOME_CRYPT_KEY_STRLEN); } -int rhizome_strn_is_file_hash(const char *hash) -{ - return is_xsubstring(hash, RHIZOME_FILEHASH_STRLEN); -} - -int rhizome_str_is_file_hash(const char *hash) -{ - return is_xstring(hash, RHIZOME_FILEHASH_STRLEN); -} - int rhizome_str_is_manifest_service(const char *text) { if (text[0] == '\0') diff --git a/rhizome.h b/rhizome.h index 26c5a8d1..66e191e9 100644 --- a/rhizome.h +++ b/rhizome.h @@ -427,14 +427,8 @@ int rhizome_cleanup(struct rhizome_cleanup_report *report); int rhizome_manifest_createid(rhizome_manifest *m); int rhizome_get_bundle_from_seed(rhizome_manifest *m, const char *seed); -int rhizome_strn_is_manifest_id(const char *text); -int rhizome_str_is_manifest_id(const char *text); -int rhizome_strn_is_bundle_key(const char *text); -int rhizome_str_is_bundle_key(const char *text); int rhizome_strn_is_bundle_crypt_key(const char *text); int rhizome_str_is_bundle_crypt_key(const char *text); -int rhizome_strn_is_file_hash(const char *text); -int rhizome_str_is_file_hash(const char *text); int rhizome_str_is_manifest_service(const char *text); int is_http_header_complete(const char *buf, size_t len, size_t read_since_last_call); From 7564d529a18788ca70e6a7d25f43d896b219eef3 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Thu, 21 Nov 2013 12:42:59 +1030 Subject: [PATCH 4/4] Add missing copyright/license comment blocks Update a few existing copyright notices to reflect recent work --- check-in-out-return.c | 19 +++++++++++++++++++ crypto.c | 19 +++++++++++++++++++ crypto.h | 18 ++++++++++++++++++ directory_client.c | 18 ++++++++++++++++++ directory_service.c | 18 ++++++++++++++++++ fakeradio.c | 19 +++++++++++++++++++ fifo.c | 19 +++++++++++++++++++ fifo.h | 26 +++++++++++++++++++++----- golay.c | 18 ++++++++++++++++++ golay.h | 19 +++++++++++++++++++ keyring.c | 4 +++- keyring.h | 20 ++++++++++++++++++++ meshms.c | 19 +++++++++++++++++++ overlay_link.c | 20 ++++++++++++++++++++ overlay_mdp.c | 4 +++- overlay_packetradio.c | 20 ++++++++++++++++++++ pa_phone.c | 19 +++++++++++++++++++ rhizome.c | 5 +++-- rhizome_store.c | 19 +++++++++++++++++++ route_link.c | 19 +++++++++++++++++++ testnacl.c | 19 +++++++++++++++++++ version_servald.c | 19 +++++++++++++++++++ 22 files changed, 371 insertions(+), 9 deletions(-) diff --git a/check-in-out-return.c b/check-in-out-return.c index 8efee5fc..6d61373a 100644 --- a/check-in-out-return.c +++ b/check-in-out-return.c @@ -1,3 +1,22 @@ +/* +Serval DNA source code checker +Copyright 2013 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + #include #include diff --git a/crypto.c b/crypto.c index 550a7aec..9072d041 100644 --- a/crypto.c +++ b/crypto.c @@ -1,3 +1,22 @@ +/* +Serval DNA internal cryptographic operations +Copyright 2013 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + #include "crypto_sign_edwards25519sha512batch.h" #include "nacl/src/crypto_sign_edwards25519sha512batch_ref/ge.h" #include "serval.h" diff --git a/crypto.h b/crypto.h index ec5c51e0..38f51494 100644 --- a/crypto.h +++ b/crypto.h @@ -1,3 +1,21 @@ +/* +Serval DNA internal cryptographic operations +Copyright 2013 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ #ifndef __SERVALD_CRYPTO_H #define __SERVALD_CRYPTO_H diff --git a/directory_client.c b/directory_client.c index 5f16e565..8771f34a 100644 --- a/directory_client.c +++ b/directory_client.c @@ -1,3 +1,21 @@ +/* +Serval DNA directory service client +Copyright (C) 2013 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ /* diff --git a/directory_service.c b/directory_service.c index 6f09e32e..b8f1608c 100644 --- a/directory_service.c +++ b/directory_service.c @@ -1,3 +1,21 @@ +/* +Serval DNA directory service +Copyright (C) 2013 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ #ifdef HAVE_POLL_H #include diff --git a/fakeradio.c b/fakeradio.c index 5727ad1b..dd8540fe 100644 --- a/fakeradio.c +++ b/fakeradio.c @@ -1,3 +1,22 @@ +/* +Serval DNA radio serial modem simulator +Copyright (C) 2013 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + #include #include #include diff --git a/fifo.c b/fifo.c index 1b1530ce..2bbc4a57 100644 --- a/fifo.c +++ b/fifo.c @@ -1,3 +1,22 @@ +/* +Serval DNA FIFO primitives +Copyright (C) 2012 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + /* * This is a simple FIFO implementation using a circular buffer. * diff --git a/fifo.h b/fifo.h index cb989921..36b81142 100644 --- a/fifo.h +++ b/fifo.h @@ -1,3 +1,24 @@ +/* +Serval DNA FIFO primitives +Copyright (C) 2012 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +struct fifo; + struct fifo *fifo_alloc(unsigned int size); void fifo_free(struct fifo *fifo); void fifo_reset(struct fifo *fifo); @@ -6,8 +27,3 @@ unsigned int fifo_get(struct fifo *fifo, uint8_t *buffer, unsigned int len); unsigned int fifo_unget(struct fifo *fifo, uint8_t *buffer, unsigned int len); unsigned int fifo_avail(struct fifo *fifo); unsigned int fifo_space(struct fifo *fifo); - - - - - diff --git a/golay.c b/golay.c index 1f973814..c663264e 100644 --- a/golay.c +++ b/golay.c @@ -1,3 +1,21 @@ +/* +Serval DNA Golay coding +Copyright (C) 2013 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ #define POLY 0xAE3 /* or use the other polynomial, 0xC75 */ diff --git a/golay.h b/golay.h index 44ecfd88..df89362e 100644 --- a/golay.h +++ b/golay.h @@ -1,2 +1,21 @@ +/* +Serval DNA Golay coding +Copyright (C) 2013 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + int golay_encode(unsigned char *data); int golay_decode(int *errs, unsigned char *data); diff --git a/keyring.c b/keyring.c index ca558a95..874c211c 100644 --- a/keyring.c +++ b/keyring.c @@ -1,5 +1,7 @@ /* -Copyright (C) 2010-2012 Paul Gardner-Stephen, Serval Project. +Serval DNA keyring +Copyright (C) 2013 Serval Project, Inc. +Copyright (C) 2010-2012 Paul Gardner-Stephen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/keyring.h b/keyring.h index 85492447..905cd1dd 100644 --- a/keyring.h +++ b/keyring.h @@ -1,3 +1,23 @@ +/* +Serval DNA keyring +Copyright (C) 2013 Serval Project, Inc. +Copyright (C) 2010-2012 Paul Gardner-Stephen + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + #ifndef __SERVALD_KEYRING_H #define __SERVALD_KEYRING_H diff --git a/meshms.c b/meshms.c index b60c9711..ee8d2cd1 100644 --- a/meshms.c +++ b/meshms.c @@ -1,3 +1,22 @@ +/* +Serval DNA MeshMS +Copyright (C) 2013 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + #include #include "serval.h" #include "rhizome.h" diff --git a/overlay_link.c b/overlay_link.c index e66e992c..38757247 100644 --- a/overlay_link.c +++ b/overlay_link.c @@ -1,3 +1,23 @@ +/* +Serval DNA MDP overlay network link tracking +Copyright (C) 2012-2013 Serval Project, Inc. +Copyright (C) 2010-2012 Paul Gardner-Stephen + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + #include "serval.h" #include "conf.h" #include "str.h" diff --git a/overlay_mdp.c b/overlay_mdp.c index ba13500c..4671c566 100644 --- a/overlay_mdp.c +++ b/overlay_mdp.c @@ -1,5 +1,7 @@ /* -Copyright (C) 2010-2012 Paul Gardner-Stephen, Serval Project. +Serval DNA MDP overlay network +Copyright (C) 2012-2013 Serval Project, Inc. +Copyright (C) 2010-2012 Paul Gardner-Stephen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/overlay_packetradio.c b/overlay_packetradio.c index 587f92e6..a95f9988 100644 --- a/overlay_packetradio.c +++ b/overlay_packetradio.c @@ -1,3 +1,23 @@ +/* +Serval DNA packet radio interface +Copyright (C) 2013 Serval Project, Inc. +Copyright (C) 2013 Paul Gardner-Stephen + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + #include "serval.h" #include "conf.h" #include diff --git a/pa_phone.c b/pa_phone.c index 30b58c30..ed18ee7b 100644 --- a/pa_phone.c +++ b/pa_phone.c @@ -1,3 +1,22 @@ +/* +Serval DNA Portaudio phone interface +Copyright (C) 2012 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + #include #include #include "fifo.h" diff --git a/rhizome.c b/rhizome.c index 3db8cfc5..5f66ca77 100644 --- a/rhizome.c +++ b/rhizome.c @@ -1,6 +1,7 @@ /* -Serval Distributed Numbering Architecture (DNA) -Copyright (C) 2010 Paul Gardner-Stephen +Serval DNA Rhizome file distribution +Copyright (C) 2012-2013 Serval Project, Inc. +Copyright (C) 2011-2012 Paul Gardner-Stephen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/rhizome_store.c b/rhizome_store.c index 53a6907e..493fa416 100644 --- a/rhizome_store.c +++ b/rhizome_store.c @@ -1,3 +1,22 @@ +/* +Serval DNA Rhizome storage +Copyright (C) 2013 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + #include #include "serval.h" #include "rhizome.h" diff --git a/route_link.c b/route_link.c index 17e1310e..9b1a7f11 100644 --- a/route_link.c +++ b/route_link.c @@ -1,3 +1,22 @@ +/* +Serval DNA link state routing +Copyright (C) 2013 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + #include "serval.h" #include "overlay_address.h" #include "overlay_buffer.h" diff --git a/testnacl.c b/testnacl.c index 8bd74edf..3e51c7b3 100644 --- a/testnacl.c +++ b/testnacl.c @@ -1,3 +1,22 @@ +/* +Serval DNA crypto NaCl test utility +Copyright (C) 2011 Paul Gardner-Stephen + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + #include #include #include diff --git a/version_servald.c b/version_servald.c index 32028fd5..131497e5 100644 --- a/version_servald.c +++ b/version_servald.c @@ -1,3 +1,22 @@ +/* +Serval DNA version string +Copyright (C) 2013 Serval Project, Inc. + +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 Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + #ifndef SERVALD_VERSION #error "SERVALD_VERSION is not defined" #endif