From e7afd5d165354c803497af3a2d4ff7e1ce50c9ff Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Sun, 13 Oct 2013 10:09:17 +0200 Subject: [PATCH 01/19] Make sure './configure && make all install' work. --- Makefile.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile.in b/Makefile.in index 87fb9452..151c104f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,3 +1,7 @@ +DESTDIR= +prefix=@prefix@ +bindir=@sbindir@ + NACL_BASE= nacl/src include $(NACL_BASE)/nacl.mk SERVAL_BASE= @@ -125,6 +129,9 @@ libmonitorclient.a: $(MONITORCLIENTOBJS) version.o @echo AR $@ @$(AR) -cr $@ $(MONITORCLIENTOBJS) version.o +install: servald + $(INSTALL) -D servald $(DESTDIR)$(sbindir) + clean: @rm -f $(OBJS) \ tfw_createfile.o version.o \ From 92253ca97dd309687ccb4ff7ad2a03e660581dd0 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Thu, 21 Nov 2013 12:12:46 +1030 Subject: [PATCH 02/19] 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 03/19] 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 04/19] 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 05/19] 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 From 2bb0d2047a661a85d27569e46aa9aca347d878a3 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Mon, 2 Dec 2013 11:12:31 +1030 Subject: [PATCH 06/19] Enforce valid Rhizome 'service' and 'name' strings --- dataformats.c | 13 +++++++++++++ dataformats.h | 1 + rhizome_bundle.c | 2 ++ 3 files changed, 16 insertions(+) diff --git a/dataformats.c b/dataformats.c index ed841ca2..1518ab80 100644 --- a/dataformats.c +++ b/dataformats.c @@ -171,6 +171,19 @@ int rhizome_str_is_manifest_service(const char *text) return *text == '\0'; } +/* A name cannot contain a LF because that is the Rhizome text manifest field terminator. For the + * time being, CR is not allowed either, because the Rhizome field terminator includes an optional + * CR. See rhizome_manifest_parse(). + * + * @author Andrew Bettison + */ +int rhizome_str_is_manifest_name(const char *text) +{ + while (*text && *text != '\n' && *text != '\r') + ++text; + return *text == '\0'; +} + int str_is_did(const char *did) { size_t len = 0; diff --git a/dataformats.h b/dataformats.h index 67afb746..a9abc661 100644 --- a/dataformats.h +++ b/dataformats.h @@ -15,6 +15,7 @@ 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 rhizome_str_is_manifest_name(const char *text); void write_uint64(unsigned char *o,uint64_t v); void write_uint16(unsigned char *o,uint16_t v); diff --git a/rhizome_bundle.c b/rhizome_bundle.c index 77754411..e513f855 100644 --- a/rhizome_bundle.c +++ b/rhizome_bundle.c @@ -204,6 +204,7 @@ void _rhizome_manifest_del_bundle_key(struct __sourceloc __whence, rhizome_manif void _rhizome_manifest_set_service(struct __sourceloc __whence, rhizome_manifest *m, const char *service) { if (service) { + assert(rhizome_str_is_manifest_service(service)); const char *v = rhizome_manifest_set(m, "service", service); assert(v); // TODO: remove known manifest fields from vars[] m->service = v; @@ -223,6 +224,7 @@ void _rhizome_manifest_del_service(struct __sourceloc __whence, rhizome_manifest void _rhizome_manifest_set_name(struct __sourceloc __whence, rhizome_manifest *m, const char *name) { if (name) { + assert(rhizome_str_is_manifest_name(name)); const char *v = rhizome_manifest_set(m, "name", name); assert(v); // TODO: remove known manifest fields from vars[] m->name = v; From 9953949c6e792c5032373d103db6272072d59d97 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Mon, 2 Dec 2013 15:56:32 +1030 Subject: [PATCH 07/19] Improve test framework: forked commands inherit stdin Remove the subshell parentheses around the command invoked using fork(), so that the forked command inherits the file descriptors. This allows it to be used like "fork some command < input". --- testframework.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testframework.sh b/testframework.sh index 903a7cc1..4e4035da 100644 --- a/testframework.sh +++ b/testframework.sh @@ -1651,7 +1651,7 @@ fork() { local _tfw_process_tmp="$_tfw_tmp/fork-$forkid" mkdir "$_tfw_process_tmp" || _tfw_fatalexit $_tfw_assert_noise && tfw_log "# fork[$forkid] START" $(shellarg "$@") - ( "$@" ) 6>"$_tfw_process_tmp/log.stdout" 1>&6 2>"$_tfw_process_tmp/log.stderr" 7>"$_tfw_process_tmp/log.xtrace" & + "$@" 6>"$_tfw_process_tmp/log.stdout" 1>&6 2>"$_tfw_process_tmp/log.stderr" 7>"$_tfw_process_tmp/log.xtrace" & _tfw_forked_pids[$forkid]=$! [ -n "$_tfw_forklabel" ] && eval _tfw_fork_label_$_tfw_forklabel=$forkid $_tfw_assert_noise && tfw_log "# fork[$forkid] ${_tfw_forklabel:+%$_tfw_forklabel }pid=$! STARTED" From 4f0aa3a41ca3ae976a118c4446b2653c96325200 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Mon, 2 Dec 2013 16:07:37 +1030 Subject: [PATCH 08/19] Improve test framework: include %label in fork log --- testframework.sh | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/testframework.sh b/testframework.sh index 4e4035da..7a26bbf5 100644 --- a/testframework.sh +++ b/testframework.sh @@ -127,6 +127,7 @@ declare -a _tfw_test_names=() declare -a _tfw_test_sourcefiles=() declare -a _tfw_job_pgids=() declare -a _tfw_forked_pids=() +declare -a _tfw_forked_labels=() # The rest of this file is parsed for extended glob patterns. _tfw_shopt _tfw_orig_shopt -s extglob @@ -1648,13 +1649,15 @@ fork() { shift [ -n "$_tfw_forkid" ] && error "fork label '%$_tfw_forklabel' already in use" fi + local desc="fork[$forkid]${_tfw_forklabel:+ %$_tfw_forklabel}" local _tfw_process_tmp="$_tfw_tmp/fork-$forkid" mkdir "$_tfw_process_tmp" || _tfw_fatalexit - $_tfw_assert_noise && tfw_log "# fork[$forkid] START" $(shellarg "$@") + $_tfw_assert_noise && tfw_log "# $desc START" $(shellarg "$@") "$@" 6>"$_tfw_process_tmp/log.stdout" 1>&6 2>"$_tfw_process_tmp/log.stderr" 7>"$_tfw_process_tmp/log.xtrace" & _tfw_forked_pids[$forkid]=$! + _tfw_forked_labels[$forkid]="$_tfw_forklabel" [ -n "$_tfw_forklabel" ] && eval _tfw_fork_label_$_tfw_forklabel=$forkid - $_tfw_assert_noise && tfw_log "# fork[$forkid] ${_tfw_forklabel:+%$_tfw_forklabel }pid=$! STARTED" + $_tfw_assert_noise && tfw_log "# $desc pid=$! STARTED" } fork_terminate() { @@ -1664,7 +1667,7 @@ fork_terminate() { for arg; do _tfw_set_forklabel "$arg" || error "not a fork label '$arg'" [ -n "$_tfw_forkid" ] || error "no such fork: %$_tfw_forklabel" - _tfw_terminate $_tfw_forkid + _tfw_forkterminate $_tfw_forkid done } @@ -1692,7 +1695,7 @@ fork_terminate_all() { $_tfw_assert_noise && tfw_log "# fork_terminate_all" local forkid for ((forkid=0; forkid < ${#_tfw_forked_pids[*]}; ++forkid)); do - _tfw_terminate $forkid + _tfw_forkterminate $forkid done } @@ -1728,12 +1731,14 @@ _tfw_set_forklabel() { return 1 } -_tfw_terminate() { +_tfw_forkterminate() { local forkid="$1" [ -z "$forkid" ] && return 1 local pid=${_tfw_forked_pids[$forkid]} + local label=${_tfw_forked_labels[$forkid]} + local desc="fork[$forkid]${label:+ %$label}" [ -z "$pid" ] && return 1 - $_tfw_assert_noise && tfw_log "# fork[$forkid] kill -TERM $pid" + $_tfw_assert_noise && tfw_log "# $desc kill -TERM $pid" kill -TERM $pid 2>/dev/null } @@ -1741,30 +1746,32 @@ _tfw_forkwait() { local forkid="$1" [ -z "$forkid" ] && return 0 local pid=${_tfw_forked_pids[$forkid]} + local label=${_tfw_forked_labels[$forkid]} [ -z "$pid" ] && return 0 kill -0 $pid 2>/dev/null && return 1 # still running _tfw_forked_pids[$forkid]= wait $pid # should not block because process has exited local status=$? - $_tfw_assert_noise && tfw_log "# fork[$forkid] pid=$pid EXIT status=$status" - echo "++++++++++ fork[$forkid] log.stdout ++++++++++" + local desc="fork[$forkid]${label:+ %$label}" + $_tfw_assert_noise && tfw_log "# $desc pid=$pid EXIT status=$status" + echo "++++++++++ $desc log.stdout ++++++++++" cat $_tfw_tmp/fork-$forkid/log.stdout echo "++++++++++" - echo "++++++++++ fork[$forkid] log.stderr ++++++++++" + echo "++++++++++ $desc log.stderr ++++++++++" cat $_tfw_tmp/fork-$forkid/log.stderr echo "++++++++++" if $_tfw_trace; then - echo "++++++++++ fork[$forkid] log.xtrace ++++++++++" + echo "++++++++++ $desc log.xtrace ++++++++++" cat $_tfw_tmp/fork-$forkid/log.xtrace echo "++++++++++" fi case $status in 0) ;; 143) ;; # terminated with SIGTERM (probably from fork_terminate) - 1) _tfw_fail "fork[$forkid] process exited with FAIL status";; - 254) _tfw_error "fork[$forkid] process exited with ERROR status";; - 255) _tfw_fatal "fork[$forkid] process exited with FATAL status";; - *) _tfw_error "fork[$forkid] process exited with status=$status";; + 1) _tfw_fail "$desc process exited with FAIL status";; + 254) _tfw_error "$desc process exited with ERROR status";; + 255) _tfw_fatal "$desc process exited with FATAL status";; + *) _tfw_error "$desc process exited with status=$status";; esac return 0 } From bf84c5815fb6ce1c78b6f028ceb35ff1035d7afa Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Tue, 3 Dec 2013 14:29:13 +1030 Subject: [PATCH 09/19] Fix 'make install' target, add 'make uninstall' Define $(sbindir) and $(exec_prefix) Define $(INSTALL), $(INSTALL_PROGRAM) and $(INSTALL_DATA) Use $(RM) instead of rm -f --- Makefile.in | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index 151c104f..444d1a58 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,6 +1,7 @@ -DESTDIR= prefix=@prefix@ -bindir=@sbindir@ +exec_prefix=@exec_prefix@ +bindir=@bindir@ +sbindir=@sbindir@ NACL_BASE= nacl/src include $(NACL_BASE)/nacl.mk @@ -72,6 +73,11 @@ CFLAGS+=-Wall -Wno-unused-value CFLAGS+=-DSHA2_USE_INTTYPES_H -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__=1 # OSX magic to compensate for the Solaris magic CFLAGS+=-D_DARWIN_C_SOURCE + +INSTALL= install +INSTALL_PROGRAM=$(INSTALL) +INSTALL_DATA= $(INSTALL) -m 644 + -include Makefile.dbg DEFS= @DEFS@ @@ -130,10 +136,13 @@ libmonitorclient.a: $(MONITORCLIENTOBJS) version.o @$(AR) -cr $@ $(MONITORCLIENTOBJS) version.o install: servald - $(INSTALL) -D servald $(DESTDIR)$(sbindir) + $(INSTALL_PROGRAM) -D servald $(DESTDIR)$(sbindir)/servald + +uninstall: + $(RM) $(DESTDIR)$(sbindir)/servald clean: - @rm -f $(OBJS) \ + @$(RM) $(OBJS) \ tfw_createfile.o version.o \ fakeradio.o fakeradio \ tfw_createfile servald \ From 41dcafb4f529981a125505ec82ac59ee1385a49d Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Tue, 3 Dec 2013 15:05:05 +1030 Subject: [PATCH 10/19] Add CONTRIBUTORS.md file, fix alternative links in README.md --- CONTRIBUTORS.md | 24 ++++++++++++++++++++++++ README.md | 17 ++++++++++------- 2 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 CONTRIBUTORS.md diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 00000000..d6c7b857 --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,24 @@ +Serval DNA Contributors +======================= +[Serval Project][], December 2013 + +The following individuals have contributed to the [Serval DNA][] software. We +apologise for any omissions. If you know of a name that is missing, please +contact us. + +Serval Project team +------------------- + * Dr Paul Gardner-Stephen, Co-founder and Project Lead + * Jeremy Lakeman, Senior Software Engineer + * Andrew Bettison, Senior Software Engineer + * Daniel O'Connor, Senior Software Engineer + +Other contributors +------------------ + * Romain Vimont (®om) + * Dan Staples, Open Technology Institute + * Petter Reinholdtsen + + +[Serval Project]: http://www.servalproject.org/ +[Serval DNA]: https://github.com/servalproject/serval-dna diff --git a/README.md b/README.md index 3adc90bc..d95fb675 100644 --- a/README.md +++ b/README.md @@ -88,15 +88,14 @@ Download, build and test ------------------------ Instructions for downloading, building and testing Serval DNA are in -[INSTALL.md](./INSTALL.md). (If that link is does not work, try -[INSTALL.md](/servalproject/serval-dna/blob/master/INSTALL.md).) +[INSTALL.md](./INSTALL.md). +([alternative link](/servalproject/serval-dna/blob/development/INSTALL.md)) Configure --------- -See [doc/Servald-Configuration](./doc/Servald-Configuration.md) (alternative -link [doc/Servald-Configuration] -(/servalproject/serval-dna/blob/master/doc/Servald-Configuration.md)). +See [doc/Servald-Configuration](./doc/Servald-Configuration.md) +([alternative link](/servalproject/serval-dna/blob/development/doc/Servald-Configuration.md)). More information ---------------- @@ -115,10 +114,14 @@ via a two-way [pipe][] called the *monitor interface*. For more documentation, see: * the [doc/](./doc/) directory - (alternative link [doc/](/servalproject/serval-dna/tree/master/doc/)) + ([alternative link](/servalproject/serval-dna/tree/development/doc/)) * the [Serval DNA][] page in the [Serval Project Wiki][] +* [CONTRIBUTORS.md](./CONTRIBUTORS.md) + ([alternative link](/servalproject/serval-dna/blob/development/CONTRIBUTORS.md)) + All individuals who have contributed to the software. + [Serval Project]: http://www.servalproject.org/ [Serval Project Wiki]: http://developer.servalproject.org/ [Serval DNA]: http://developer.servalproject.org/dokuwiki/doku.php?id=content:servaldna: @@ -129,7 +132,7 @@ For more documentation, see: [GNU C]: http://gcc.gnu.org/ [daemon]: http://en.wikipedia.org/wiki/Daemon_(computing) [free software]: http://www.gnu.org/philosophy/free-sw.html -[contributors]: /servalproject/serval-dna/blob/master/CONTRIBUTORS.md +[contributors]: /servalproject/serval-dna/blob/development/CONTRIBUTORS.md [GitHub]: https://github.com/servalproject [GPL2]: http://www.gnu.org/licenses/gpl-2.0.html [individ]: http://developer.servalproject.org/files/serval_project_inc-individual.pdf From a0392878d8f22927e3d2deceb09789deaec193a6 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Tue, 3 Dec 2013 15:18:48 +1030 Subject: [PATCH 11/19] Remove alternative links from README.md GitHub have fixed the README Markdown rendering on the repository home page, so alternative links are no longer needed --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d95fb675..85a48843 100644 --- a/README.md +++ b/README.md @@ -89,13 +89,11 @@ Download, build and test Instructions for downloading, building and testing Serval DNA are in [INSTALL.md](./INSTALL.md). -([alternative link](/servalproject/serval-dna/blob/development/INSTALL.md)) Configure --------- -See [doc/Servald-Configuration](./doc/Servald-Configuration.md) -([alternative link](/servalproject/serval-dna/blob/development/doc/Servald-Configuration.md)). +See [doc/Servald-Configuration](./doc/Servald-Configuration.md). More information ---------------- @@ -114,13 +112,11 @@ via a two-way [pipe][] called the *monitor interface*. For more documentation, see: * the [doc/](./doc/) directory - ([alternative link](/servalproject/serval-dna/tree/development/doc/)) * the [Serval DNA][] page in the [Serval Project Wiki][] -* [CONTRIBUTORS.md](./CONTRIBUTORS.md) - ([alternative link](/servalproject/serval-dna/blob/development/CONTRIBUTORS.md)) - All individuals who have contributed to the software. + * [CONTRIBUTORS.md](./CONTRIBUTORS.md) All individuals who have contributed + to the software. [Serval Project]: http://www.servalproject.org/ [Serval Project Wiki]: http://developer.servalproject.org/ From 67b79d03905755bd2e6f5026064c7bdd9400b14f Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Wed, 4 Dec 2013 02:52:31 +1030 Subject: [PATCH 12/19] Add full text of GPL version 2.0 --- GPL-2.0.txt | 339 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 340 insertions(+), 1 deletion(-) create mode 100644 GPL-2.0.txt diff --git a/GPL-2.0.txt b/GPL-2.0.txt new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/GPL-2.0.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/README.md b/README.md index 85a48843..2cd475bc 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ For more documentation, see: [free software]: http://www.gnu.org/philosophy/free-sw.html [contributors]: /servalproject/serval-dna/blob/development/CONTRIBUTORS.md [GitHub]: https://github.com/servalproject -[GPL2]: http://www.gnu.org/licenses/gpl-2.0.html +[GPL2]: ./GPL-2.0.txt [individ]: http://developer.servalproject.org/files/serval_project_inc-individual.pdf [entity]: http://developer.servalproject.org/files/serval_project_inc-entity.pdf [DNA]: http://developer.servalproject.org/dokuwiki/doku.php?id=content:tech:dna From 9b64bb87e0566d401654fd075543610568d83dc4 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Wed, 4 Dec 2013 16:56:55 +1030 Subject: [PATCH 13/19] Uniform copyright notices Added some missing copyright/license block comments --- check-in-out-return.c | 2 +- cli.c | 2 +- cli.h | 2 +- commandline.c | 2 +- config_test.c | 2 +- crypto.c | 2 +- crypto.h | 2 +- dataformats.c | 4 ++-- dataformats.h | 18 ++++++++++++++++++ directory_client.c | 2 +- directory_service.c | 2 +- fakeradio.c | 2 +- fdqueue.h | 2 +- fifo.c | 2 +- fifo.h | 2 +- golay.c | 2 +- golay.h | 2 +- http_server.c | 2 +- http_server.h | 2 +- keyring.c | 2 +- keyring.h | 2 +- main.c | 4 ++-- mdp_client.c | 3 ++- mdp_client.h | 2 +- mdp_net.c | 2 +- meshms.c | 2 +- monitor-client.c | 3 ++- monitor-client.h | 5 +++-- monitor.c | 3 ++- nonce.c | 3 ++- overlay_address.c | 5 +++-- overlay_address.h | 32 ++++++++++++++++---------------- overlay_link.c | 2 +- overlay_mdp.c | 2 +- overlay_mdp_services.c | 3 ++- overlay_olsr.c | 2 +- overlay_packet.h | 2 +- overlay_packetradio.c | 2 +- overlay_queue.c | 2 +- pa_phone.c | 2 +- performance_timing.c | 2 +- radio_link.h | 18 ++++++++++++++++++ rhizome.c | 2 +- rhizome_database.c | 2 +- rhizome_fetch.c | 2 +- rhizome_http.c | 2 +- rhizome_store.c | 2 +- rhizome_sync.c | 2 +- route_link.c | 2 +- serval.h | 2 +- socket.h | 19 +++++++++++++++++++ tfw_createfile.c | 2 +- version_servald.c | 2 +- vomp_console.c | 2 +- 54 files changed, 132 insertions(+), 70 deletions(-) diff --git a/check-in-out-return.c b/check-in-out-return.c index 6d61373a..eaf57376 100644 --- a/check-in-out-return.c +++ b/check-in-out-return.c @@ -1,6 +1,6 @@ /* Serval DNA source code checker -Copyright 2013 Serval Project, Inc. +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 diff --git a/cli.c b/cli.c index 36bdead5..87b0551d 100644 --- a/cli.c +++ b/cli.c @@ -1,6 +1,6 @@ /* Serval DNA command-line functions -Copyright (C) 2010-2013 Serval Project, Inc. +Copyright (C) 2010-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 diff --git a/cli.h b/cli.h index 4a340f22..0c39371b 100644 --- a/cli.h +++ b/cli.h @@ -1,6 +1,6 @@ /* Serval command line parsing and processing. - Copyright (C) 2012,2013 Serval Project, Inc. + Copyright (C) 2012,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 diff --git a/commandline.c b/commandline.c index 7e0fd4f9..38fdfd44 100644 --- a/commandline.c +++ b/commandline.c @@ -1,6 +1,6 @@ /* Serval DNA command-line functions -Copyright (C) 2010-2013 Serval Project, Inc. +Copyright (C) 2010-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 diff --git a/config_test.c b/config_test.c index 42b1c159..87f8ec66 100644 --- a/config_test.c +++ b/config_test.c @@ -1,6 +1,6 @@ /* Serval DNA configuration stand-alone configuration check utility -Copyright 2013 Serval Project, Inc. +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 diff --git a/crypto.c b/crypto.c index 9072d041..e2e9fe7b 100644 --- a/crypto.c +++ b/crypto.c @@ -1,6 +1,6 @@ /* Serval DNA internal cryptographic operations -Copyright 2013 Serval Project, Inc. +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 diff --git a/crypto.h b/crypto.h index 38f51494..06d7c817 100644 --- a/crypto.h +++ b/crypto.h @@ -1,6 +1,6 @@ /* Serval DNA internal cryptographic operations -Copyright 2013 Serval Project, Inc. +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 diff --git a/dataformats.c b/dataformats.c index 5324506d..28238ef7 100644 --- a/dataformats.c +++ b/dataformats.c @@ -1,6 +1,6 @@ /* -Serval Distributed Numbering Architecture (DNA) -Copyright (C) 2010 Paul Gardner-Stephen +Serval DNA data interchange formats +Copyright (C) 2010-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 diff --git a/dataformats.h b/dataformats.h index a9abc661..ee7b4d73 100644 --- a/dataformats.h +++ b/dataformats.h @@ -1,3 +1,21 @@ +/* +Serval DNA data interchange formats +Copyright (C) 2012-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_DATA_FORMATS_H #define __SERVALD_DATA_FORMATS_H diff --git a/directory_client.c b/directory_client.c index d296b433..5ac3ac19 100644 --- a/directory_client.c +++ b/directory_client.c @@ -1,6 +1,6 @@ /* Serval DNA directory service client -Copyright (C) 2013 Serval Project, Inc. +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 diff --git a/directory_service.c b/directory_service.c index b8f1608c..d89638a4 100644 --- a/directory_service.c +++ b/directory_service.c @@ -1,6 +1,6 @@ /* Serval DNA directory service -Copyright (C) 2013 Serval Project, Inc. +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 diff --git a/fakeradio.c b/fakeradio.c index b0b14994..c0cb6a81 100644 --- a/fakeradio.c +++ b/fakeradio.c @@ -1,6 +1,6 @@ /* Serval DNA radio serial modem simulator -Copyright (C) 2013 Serval Project, Inc. +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 diff --git a/fdqueue.h b/fdqueue.h index 39d1b37d..6c0ed1a9 100644 --- a/fdqueue.h +++ b/fdqueue.h @@ -1,6 +1,6 @@ /* Serval DNA file descriptor queue -Copyright (C) 2012-2013 Serval Project, Inc. +Copyright (C) 2012-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 diff --git a/fifo.c b/fifo.c index 2bbc4a57..8a8684c8 100644 --- a/fifo.c +++ b/fifo.c @@ -1,6 +1,6 @@ /* Serval DNA FIFO primitives -Copyright (C) 2012 Serval Project, Inc. +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 diff --git a/fifo.h b/fifo.h index 36b81142..40d63e88 100644 --- a/fifo.h +++ b/fifo.h @@ -1,6 +1,6 @@ /* Serval DNA FIFO primitives -Copyright (C) 2012 Serval Project, Inc. +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 diff --git a/golay.c b/golay.c index b0547a93..9599a497 100644 --- a/golay.c +++ b/golay.c @@ -1,6 +1,6 @@ /* Serval DNA Golay coding -Copyright (C) 2013 Serval Project, Inc. +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 diff --git a/golay.h b/golay.h index e1d0c3e2..d0219940 100644 --- a/golay.h +++ b/golay.h @@ -1,6 +1,6 @@ /* Serval DNA Golay coding -Copyright (C) 2013 Serval Project, Inc. +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 diff --git a/http_server.c b/http_server.c index 814f0919..1a2193a2 100644 --- a/http_server.c +++ b/http_server.c @@ -1,6 +1,6 @@ /* Serval DNA - HTTP Server -Copyright (C) 2013 Serval Project, Inc. +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 diff --git a/http_server.h b/http_server.h index baab6e75..cb012e54 100644 --- a/http_server.h +++ b/http_server.h @@ -1,6 +1,6 @@ /* Serval DNA - HTTP Server API -Copyright (C) 2013 Serval Project, Inc. +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 diff --git a/keyring.c b/keyring.c index 05e2b58f..1593d315 100644 --- a/keyring.c +++ b/keyring.c @@ -1,6 +1,6 @@ /* Serval DNA keyring -Copyright (C) 2013 Serval Project, Inc. +Copyright (C) 2013 Serval Project Inc. Copyright (C) 2010-2012 Paul Gardner-Stephen This program is free software; you can redistribute it and/or diff --git a/keyring.h b/keyring.h index 905cd1dd..78e2d8de 100644 --- a/keyring.h +++ b/keyring.h @@ -1,6 +1,6 @@ /* Serval DNA keyring -Copyright (C) 2013 Serval Project, Inc. +Copyright (C) 2013 Serval Project Inc. Copyright (C) 2010-2012 Paul Gardner-Stephen This program is free software; you can redistribute it and/or diff --git a/main.c b/main.c index 38279a38..c0437063 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,6 @@ /* -Serval daemon -Copyright (C) 2012 The Serval Project +Serval DNA daemon +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 diff --git a/mdp_client.c b/mdp_client.c index 0c4b6975..2cb7e0e1 100644 --- a/mdp_client.c +++ b/mdp_client.c @@ -1,5 +1,6 @@ /* - Copyright (C) 2010-2012 Paul Gardner-Stephen, Serval Project. + Copyright (C) 2010-2012 Paul Gardner-Stephen + Copyright (C) 2010-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 diff --git a/mdp_client.h b/mdp_client.h index 47fbd33c..bf45c41a 100644 --- a/mdp_client.h +++ b/mdp_client.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Serval Project. + Copyright (C) 2012-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 diff --git a/mdp_net.c b/mdp_net.c index 8d572716..fa3e5131 100644 --- a/mdp_net.c +++ b/mdp_net.c @@ -1,5 +1,5 @@ /* -Copyright (C) 2013 Serval Project, Inc. +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 diff --git a/meshms.c b/meshms.c index 9621caee..9c43f8b4 100644 --- a/meshms.c +++ b/meshms.c @@ -1,6 +1,6 @@ /* Serval DNA MeshMS -Copyright (C) 2013 Serval Project, Inc. +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 diff --git a/monitor-client.c b/monitor-client.c index 35ef276e..ad3afcb4 100644 --- a/monitor-client.c +++ b/monitor-client.c @@ -1,5 +1,6 @@ /* -Copyright (C) 2012 Paul Gardner-Stephen, Serval Project. +Copyright (C) 2012 Paul Gardner-Stephen +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 diff --git a/monitor-client.h b/monitor-client.h index 810058a1..235ea5af 100644 --- a/monitor-client.h +++ b/monitor-client.h @@ -1,5 +1,6 @@ /* -Copyright (C) 2012 Paul Gardner-Stephen, Serval Project. +Copyright (C) 2012 Paul Gardner-Stephen +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 @@ -34,4 +35,4 @@ int monitor_client_read(int fd, struct monitor_state *res, struct monitor_comman int monitor_client_close(int fd, struct monitor_state *res); int monitor_socket_name(struct sockaddr_un *name); -#endif \ No newline at end of file +#endif diff --git a/monitor.c b/monitor.c index e28016d9..af2f2bf7 100644 --- a/monitor.c +++ b/monitor.c @@ -1,5 +1,6 @@ /* -Copyright (C) 2010-2012 Paul Gardner-Stephen, Serval Project. +Copyright (C) 2010-2012 Paul Gardner-Stephen +Copyright (C) 2010-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 diff --git a/nonce.c b/nonce.c index 06ab7bb2..00d2bab8 100644 --- a/nonce.c +++ b/nonce.c @@ -1,5 +1,6 @@ /* -Copyright (C) 2013 Paul Gardner-Stephen, Serval Project. +Copyright (C) 2013 Paul Gardner-Stephen +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 diff --git a/overlay_address.c b/overlay_address.c index 399e147f..c8463764 100644 --- a/overlay_address.c +++ b/overlay_address.c @@ -1,6 +1,7 @@ /* -Serval Distributed Numbering Architecture (DNA) -Copyright (C) 2010 Paul Gardner-Stephen +Serval DNA MDP addressing +Copyright (C) 2012-2013 Serval Project Inc. +Copyright (C) 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_address.h b/overlay_address.h index 1de7801b..0cff35b6 100644 --- a/overlay_address.h +++ b/overlay_address.h @@ -1,20 +1,20 @@ /* - Serval Daemon - 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. +Serval DNA MDP addressing +Copyright (C) 2012-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_OVERLAY_ADDRESS_H diff --git a/overlay_link.c b/overlay_link.c index f6b46b74..a622a03c 100644 --- a/overlay_link.c +++ b/overlay_link.c @@ -1,6 +1,6 @@ /* Serval DNA MDP overlay network link tracking -Copyright (C) 2012-2013 Serval Project, Inc. +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 diff --git a/overlay_mdp.c b/overlay_mdp.c index 228a315c..95b9987b 100644 --- a/overlay_mdp.c +++ b/overlay_mdp.c @@ -1,6 +1,6 @@ /* Serval DNA MDP overlay network -Copyright (C) 2012-2013 Serval Project, Inc. +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 diff --git a/overlay_mdp_services.c b/overlay_mdp_services.c index 2abc30d4..a9088619 100644 --- a/overlay_mdp_services.c +++ b/overlay_mdp_services.c @@ -1,5 +1,6 @@ /* -Copyright (C) 2010-2012 Paul Gardner-Stephen, Serval Project. +Copyright (C) 2010-2012 Paul Gardner-Stephen +Copyright (C) 2010-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 diff --git a/overlay_olsr.c b/overlay_olsr.c index 9eb2d0d1..a3cbfab9 100644 --- a/overlay_olsr.c +++ b/overlay_olsr.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Serval Project. + 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 diff --git a/overlay_packet.h b/overlay_packet.h index aa105b25..5ac91fb9 100644 --- a/overlay_packet.h +++ b/overlay_packet.h @@ -1,5 +1,5 @@ /* - Serval Daemon + Serval DNA MDP overlay frame Copyright (C) 2012 Serval Project Inc. This program is free software; you can redistribute it and/or diff --git a/overlay_packetradio.c b/overlay_packetradio.c index a95f9988..c8a967a3 100644 --- a/overlay_packetradio.c +++ b/overlay_packetradio.c @@ -1,6 +1,6 @@ /* Serval DNA packet radio interface -Copyright (C) 2013 Serval Project, Inc. +Copyright (C) 2013 Serval Project Inc. Copyright (C) 2013 Paul Gardner-Stephen This program is free software; you can redistribute it and/or diff --git a/overlay_queue.c b/overlay_queue.c index b239b79a..d05e52b9 100644 --- a/overlay_queue.c +++ b/overlay_queue.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Serval Project Inc + Copyright (C) 2012-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 diff --git a/pa_phone.c b/pa_phone.c index ed18ee7b..6aae93c8 100644 --- a/pa_phone.c +++ b/pa_phone.c @@ -1,6 +1,6 @@ /* Serval DNA Portaudio phone interface -Copyright (C) 2012 Serval Project, Inc. +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 diff --git a/performance_timing.c b/performance_timing.c index 2d91fd3a..5a2d13a9 100644 --- a/performance_timing.c +++ b/performance_timing.c @@ -1,6 +1,6 @@ /* Serval Distributed Numbering Architecture (DNA) - Copyright (C) 2012 Serval Project, Inc. + 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 diff --git a/radio_link.h b/radio_link.h index 1dd92ccf..34de8290 100644 --- a/radio_link.h +++ b/radio_link.h @@ -1,3 +1,21 @@ +/* +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. +*/ + #ifndef __SERVALD_RADIO_LINK_H #define __SERVALD_RADIO_LINK_H diff --git a/rhizome.c b/rhizome.c index 52fb912a..4b3b29f4 100644 --- a/rhizome.c +++ b/rhizome.c @@ -1,6 +1,6 @@ /* Serval DNA Rhizome file distribution -Copyright (C) 2012-2013 Serval Project, Inc. +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 diff --git a/rhizome_database.c b/rhizome_database.c index d7a269e1..a012d88c 100644 --- a/rhizome_database.c +++ b/rhizome_database.c @@ -1,6 +1,6 @@ /* Serval Rhizome file sharing -Copyright (C) 2012 The Serval Project, Inc. +Copyright (C) 2012-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 diff --git a/rhizome_fetch.c b/rhizome_fetch.c index efd0b51f..349961c7 100644 --- a/rhizome_fetch.c +++ b/rhizome_fetch.c @@ -1,6 +1,6 @@ /* Serval Distributed Numbering Architecture (DNA) -Copyright (C) 2012 Serval Project, Inc. +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 diff --git a/rhizome_http.c b/rhizome_http.c index 4b5f201f..468c1917 100644 --- a/rhizome_http.c +++ b/rhizome_http.c @@ -1,6 +1,6 @@ /* Serval DNA Rhizome HTTP external interface -Copyright (C) 2013 Serval Project, Inc. +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 diff --git a/rhizome_store.c b/rhizome_store.c index ced48712..78e0c0f6 100644 --- a/rhizome_store.c +++ b/rhizome_store.c @@ -1,6 +1,6 @@ /* Serval DNA Rhizome storage -Copyright (C) 2013 Serval Project, Inc. +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 diff --git a/rhizome_sync.c b/rhizome_sync.c index be5c7fcb..412294f8 100644 --- a/rhizome_sync.c +++ b/rhizome_sync.c @@ -1,5 +1,5 @@ /* -Copyright (C) 2010-2012 Serval Project. +Copyright (C) 2010-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 diff --git a/route_link.c b/route_link.c index 8669d77e..51102f3d 100644 --- a/route_link.c +++ b/route_link.c @@ -1,6 +1,6 @@ /* Serval DNA link state routing -Copyright (C) 2013 Serval Project, Inc. +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 diff --git a/serval.h b/serval.h index 629f000e..f929b245 100644 --- a/serval.h +++ b/serval.h @@ -1,7 +1,7 @@ /* Serval DNA header file Copyright (C) 2010-2012 Paul Gardner-Stephen -Copyright (C) 2012-2013 Serval Project, Inc. +Copyright (C) 2012-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 diff --git a/socket.h b/socket.h index 056dedc0..558e28c1 100644 --- a/socket.h +++ b/socket.h @@ -1,3 +1,22 @@ +/* +Serval DNA header file for socket operations +Copyright (C) 2012-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_SOCKET_H #define __SERVALD_SOCKET_H diff --git a/tfw_createfile.c b/tfw_createfile.c index 3ca1b75d..d8863e5e 100644 --- a/tfw_createfile.c +++ b/tfw_createfile.c @@ -1,6 +1,6 @@ /* Serval Project testing framework utility - create fixture file -Copyright (C) 2012 Serval Project, Inc. +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 diff --git a/version_servald.c b/version_servald.c index 131497e5..dd99a472 100644 --- a/version_servald.c +++ b/version_servald.c @@ -1,6 +1,6 @@ /* Serval DNA version string -Copyright (C) 2013 Serval Project, Inc. +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 diff --git a/vomp_console.c b/vomp_console.c index 4db2ea06..b907121c 100644 --- a/vomp_console.c +++ b/vomp_console.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Serval Project + Copyright (C) 2012-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 From 5226e47ef62b3257b1e1c416e9ca9518cb7f09c2 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Wed, 4 Dec 2013 17:14:14 +1030 Subject: [PATCH 14/19] Uniform #ifdef __SERVAL_DNA__... for headers --- cli.h | 6 ++--- conf.h | 6 ++--- constants.h | 6 ++--- crypto.h | 4 ++-- dataformats.h | 6 ++--- fdqueue.h | 6 ++--- golay.h | 4 ++-- http_server.h | 6 ++--- keyring.h | 6 ++--- log.h | 6 ++--- mdp_client.h | 4 ++-- mem.h | 6 ++--- monitor-client.h | 4 ++-- net.h | 6 ++--- os.c | 2 +- os.h | 18 +++++++-------- overlay_address.h | 6 ++--- overlay_buffer.h | 6 ++--- overlay_packet.h | 6 ++--- radio_link.h | 6 ++--- rhizome.h | 6 ++--- serval.h | 6 ++--- socket.h | 6 ++--- str.c | 2 +- str.h | 58 +++++++++++++++++++++++------------------------ uuid.c | 2 +- uuid.h | 16 ++++++------- xprintf.h | 6 ++--- 28 files changed, 111 insertions(+), 111 deletions(-) diff --git a/cli.h b/cli.h index 0c39371b..1c139278 100644 --- a/cli.h +++ b/cli.h @@ -17,8 +17,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SERVALD_CLI_H -#define __SERVALD_CLI_H +#ifndef __SERVAL_DNA__CLI_H +#define __SERVAL_DNA__CLI_H #include "xprintf.h" #include "log.h" @@ -102,4 +102,4 @@ void cli_put_long(struct cli_context *context, int64_t value, const char *delim) void cli_put_string(struct cli_context *context, const char *value, const char *delim); void cli_put_hexvalue(struct cli_context *context, const unsigned char *value, int length, const char *delim); -#endif // __SERVALD_CLI_H +#endif // __SERVAL_DNA__CLI_H diff --git a/conf.h b/conf.h index 116d44bc..15310a07 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_CONF_H -#define __SERVALDNA_CONF_H +#ifndef __SERVAL_DNA__CONF_H +#define __SERVAL_DNA__CONF_H #include #include @@ -701,4 +701,4 @@ int cf_reload(); int cf_reload_strict(); int cf_reload_permissive(); -#endif //__SERVALDNA_CONF_H +#endif //__SERVAL_DNA__CONF_H diff --git a/constants.h b/constants.h index cc8b4ffb..7af118b0 100644 --- a/constants.h +++ b/constants.h @@ -16,8 +16,8 @@ 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_CONSTANTS_H -#define __SERVALD_CONSTANTS_H +#ifndef __SERVAL_DNA__CONSTANTS_H +#define __SERVAL_DNA__CONSTANTS_H #define NELS(a) (sizeof (a) / sizeof *(a)) @@ -224,4 +224,4 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. typedef char bool_t; -#endif // __SERVALD_CONSTANTS_H +#endif // __SERVAL_DNA__CONSTANTS_H diff --git a/crypto.h b/crypto.h index 06d7c817..74190a7f 100644 --- a/crypto.h +++ b/crypto.h @@ -17,8 +17,8 @@ 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 +#ifndef __SERVAL_DNA__CRYPTO_H +#define __SERVAL_DNA__CRYPTO_H #include "nacl.h" #define SIGNATURE_BYTES crypto_sign_edwards25519sha512batch_BYTES diff --git a/dataformats.h b/dataformats.h index ee7b4d73..26c9fb7c 100644 --- a/dataformats.h +++ b/dataformats.h @@ -16,8 +16,8 @@ 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_DATA_FORMATS_H -#define __SERVALD_DATA_FORMATS_H +#ifndef __SERVAL_DNA___DATA_FORMATS_H +#define __SERVAL_DNA___DATA_FORMATS_H int str_is_subscriber_id(const char *sid); int strn_is_subscriber_id(const char *sid, size_t *lenp); @@ -42,4 +42,4 @@ uint64_t read_uint64(const unsigned char *o); uint32_t read_uint32(const unsigned char *o); uint16_t read_uint16(const unsigned char *o); -#endif +#endif //__SERVAL_DNA___DATA_FORMATS_H diff --git a/fdqueue.h b/fdqueue.h index 6c0ed1a9..080b6cbc 100644 --- a/fdqueue.h +++ b/fdqueue.h @@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SERVALDNA__FDQUEUE_H -#define __SERVALDNA__FDQUEUE_H +#ifndef __SERVAL_DNA__FDQUEUE_H +#define __SERVAL_DNA__FDQUEUE_H #ifdef HAVE_POLL_H #include @@ -91,4 +91,4 @@ unsigned fd_depth(); #define RETURNNULL(X) do { X; OUT(); return (NULL); } while (0) #define RETURNVOID do { OUT(); return; } while (0) -#endif // __SERVALDNA__FDQUEUE_H +#endif // __SERVAL_DNA__FDQUEUE_H diff --git a/golay.h b/golay.h index d0219940..4d3641a9 100644 --- a/golay.h +++ b/golay.h @@ -17,8 +17,8 @@ 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_GOLAY_H -#define __SERVALD_GOLAY_H +#ifndef __SERVAL_DNA__GOLAY_H +#define __SERVAL_DNA__GOLAY_H int golay_encode(uint8_t *data); int golay_decode(int *errs, uint8_t *data); diff --git a/http_server.h b/http_server.h index cb012e54..86c88c32 100644 --- a/http_server.h +++ b/http_server.h @@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SERVALDNA__HTTP_SERVER_H -#define __SERVALDNA__HTTP_SERVER_H +#ifndef __SERVAL_DNA__HTTP_SERVER_H +#define __SERVAL_DNA__HTTP_SERVER_H #include #include "constants.h" @@ -207,4 +207,4 @@ struct http_request { char buffer[8 * 1024]; }; -#endif // __SERVALDNA__HTTP_SERVER_H +#endif // __SERVAL_DNA__HTTP_SERVER_H diff --git a/keyring.h b/keyring.h index 78e2d8de..f1368d91 100644 --- a/keyring.h +++ b/keyring.h @@ -18,8 +18,8 @@ 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 +#ifndef __SERVAL_DNA__KEYRING_H +#define __SERVAL_DNA__KEYRING_H typedef struct keypair { int type; @@ -126,4 +126,4 @@ int keyring_find_public_tag_value(const keyring_file *k, int *cn, int *in, int * int keyring_unpack_tag(const unsigned char *packed, size_t packed_len, const char **name, const unsigned char **value, size_t *length); int keyring_pack_tag(unsigned char *packed, size_t *packed_len, const char *name, const unsigned char *value, size_t length); -#endif // __SERVALD_KEYRING_H +#endif // __SERVAL_DNA__KEYRING_H diff --git a/log.h b/log.h index 1d1b743f..bb27d124 100644 --- a/log.h +++ b/log.h @@ -16,8 +16,8 @@ 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_LOG_H -#define __SERVALD_LOG_H +#ifndef __SERVAL_DNA__LOG_H +#define __SERVAL_DNA__LOG_H #include #include @@ -161,4 +161,4 @@ struct strbuf; #define BACKTRACE log_backtrace(LOG_LEVEL_FATAL, __WHENCE__) -#endif // __SERVALD_LOG_H +#endif // __SERVAL_DNA__LOG_H diff --git a/mdp_client.h b/mdp_client.h index bf45c41a..a93e0a3c 100644 --- a/mdp_client.h +++ b/mdp_client.h @@ -16,8 +16,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SERVALD_MDP_CLIENT_H -#define __SERVALD_MDP_CLIENT_H +#ifndef __SERVAL_DNA__MDP_CLIENT_H +#define __SERVAL_DNA__MDP_CLIENT_H #include "serval.h" diff --git a/mem.h b/mem.h index e6f3cda9..498df4c4 100644 --- a/mem.h +++ b/mem.h @@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SERVALDNA__MEM_H -#define __SERVALDNA__MEM_H +#ifndef __SERVAL_DNA__MEM_H +#define __SERVAL_DNA__MEM_H #include #include "log.h" @@ -69,4 +69,4 @@ char *_strn_edup(struct __sourceloc, const char *str, size_t len); #define str_edup(str) _str_edup(__HERE__, (str)) #define strn_edup(str, len) _strn_edup(__HERE__, (str), (len)) -#endif // __SERVALDNA__MEM_H +#endif // __SERVAL_DNA__MEM_H diff --git a/monitor-client.h b/monitor-client.h index 235ea5af..c40231c3 100644 --- a/monitor-client.h +++ b/monitor-client.h @@ -17,8 +17,8 @@ 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_MONITOR_CLIENT_H -#define __SERVALD_MONITOR_CLIENT_H +#ifndef __SERVAL_DNA__MONITOR_CLIENT_H +#define __SERVAL_DNA__MONITOR_CLIENT_H struct monitor_state; diff --git a/net.h b/net.h index 757c2828..baeadf31 100644 --- a/net.h +++ b/net.h @@ -16,8 +16,8 @@ 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_NET_H -#define __SERVALD_NET_H +#ifndef __SERVAL_DNA__NET_H +#define __SERVAL_DNA__NET_H #include // for size_t, ssize_t #include // for struct sockaddr, socklen_t @@ -53,4 +53,4 @@ ssize_t _writev_all(int fd, const struct iovec *iov, int iovcnt, struct __source 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); -#endif // __SERVALD_NET_H +#endif // __SERVAL_DNA__NET_H diff --git a/os.c b/os.c index 84e49cb6..35d2e3de 100644 --- a/os.c +++ b/os.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#define __SERVALDNA_OS_INLINE +#define __SERVAL_DNA__OS_INLINE #include "os.h" #include "str.h" #include "log.h" diff --git a/os.h b/os.h index f098518e..9de08d6e 100644 --- a/os.h +++ b/os.h @@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SERVALDNA_OS_H -#define __SERVALDNA_OS_H +#ifndef __SERVAL_DNA__OS_H +#define __SERVAL_DNA__OS_H #include #include @@ -26,11 +26,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include #include -#ifndef __SERVALDNA_OS_INLINE +#ifndef __SERVAL_DNA__OS_INLINE # if __GNUC__ && !__GNUC_STDC_INLINE__ -# define __SERVALDNA_OS_INLINE extern inline +# define __SERVAL_DNA__OS_INLINE extern inline # else -# define __SERVALDNA_OS_INLINE inline +# define __SERVAL_DNA__OS_INLINE inline # endif #endif @@ -60,19 +60,19 @@ time_ms_t gettime_ms(); time_ms_t sleep_ms(time_ms_t milliseconds); #ifndef HAVE_BZERO -__SERVALDNA_OS_INLINE void bzero(void *buf, size_t len) { +__SERVAL_DNA__OS_INLINE void bzero(void *buf, size_t len) { memset(buf, 0, len); } #endif #ifndef HAVE_BCOPY -__SERVALDNA_OS_INLINE void bcopy(const void *src, void *dst, size_t len) { +__SERVAL_DNA__OS_INLINE void bcopy(const void *src, void *dst, size_t len) { memcpy(dst, src, len); } #endif #ifndef HAVE_BCMP -__SERVALDNA_OS_INLINE int bcmp(const void *s1, const void *s2, size_t n) { +__SERVAL_DNA__OS_INLINE int bcmp(const void *s1, const void *s2, size_t n) { // bcmp() is only an equality test, not an order test, so its return value // is not specified as negative or positive, only non-zero. Hoewver // memcmp() is an order test. We deliberately discard negative return @@ -123,4 +123,4 @@ int urandombytes(unsigned char *buf, size_t len); */ ssize_t read_symlink(const char *path, char *buf, size_t len); -#endif //__SERVALDNA_OS_H +#endif //__SERVAL_DNA__OS_H diff --git a/overlay_address.h b/overlay_address.h index 0cff35b6..82a9b3fa 100644 --- a/overlay_address.h +++ b/overlay_address.h @@ -17,8 +17,8 @@ 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_OVERLAY_ADDRESS_H -#define _SERVALD_OVERLAY_ADDRESS_H +#ifndef __SERVAL_DNA__OVERLAY_ADDRESS_H +#define __SERVAL_DNA__OVERLAY_ADDRESS_H #include "constants.h" @@ -130,4 +130,4 @@ int send_please_explain(struct decode_context *context, struct subscriber *sourc void free_subscribers(); -#endif +#endif //__SERVAL_DNA__OVERLAY_ADDRESS_H diff --git a/overlay_buffer.h b/overlay_buffer.h index cf69a4b9..7aa3c5e4 100644 --- a/overlay_buffer.h +++ b/overlay_buffer.h @@ -17,8 +17,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SERVALD__OVERLAY_BUFFER_H -#define __SERVALD__OVERLAY_BUFFER_H +#ifndef __SERVAL_DNA___OVERLAY_BUFFER_H +#define __SERVAL_DNA___OVERLAY_BUFFER_H struct overlay_buffer { unsigned char *bytes; @@ -118,4 +118,4 @@ unsigned char* ob_ptr(struct overlay_buffer *b); #define ob_overrun(b) _ob_overrun(__WHENCE__, b) -#endif //__SERVALD__OVERLAY_BUFFER_H +#endif //__SERVAL_DNA___OVERLAY_BUFFER_H diff --git a/overlay_packet.h b/overlay_packet.h index 5ac91fb9..3c70a724 100644 --- a/overlay_packet.h +++ b/overlay_packet.h @@ -17,8 +17,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef _SERVALD_OVERLAY_PACKET_H -#define _SERVALD_OVERLAY_PACKET_H +#ifndef __SERVAL_DNA__OVERLAY_PACKET_H +#define __SERVAL_DNA__OVERLAY_PACKET_H #include "overlay_address.h" #include "serval.h" @@ -102,4 +102,4 @@ struct overlay_frame { int op_free(struct overlay_frame *p); struct overlay_frame *op_dup(struct overlay_frame *f); -#endif +#endif //__SERVAL_DNA__OVERLAY_PACKET_H diff --git a/radio_link.h b/radio_link.h index 34de8290..f1da9bf9 100644 --- a/radio_link.h +++ b/radio_link.h @@ -16,8 +16,8 @@ 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_RADIO_LINK_H -#define __SERVALD_RADIO_LINK_H +#ifndef __SERVAL_DNA___RADIO_LINK_H +#define __SERVAL_DNA___RADIO_LINK_H #define HEARTBEAT_SIZE (8+9) #define LINK_MTU 255 @@ -30,4 +30,4 @@ void radio_link_state_html(struct strbuf *b, struct overlay_interface *interface int radio_link_is_busy(struct overlay_interface *interface); int radio_link_queue_packet(struct overlay_interface *interface, struct overlay_buffer *buffer); -#endif \ No newline at end of file +#endif //__SERVAL_DNA___RADIO_LINK_H diff --git a/rhizome.h b/rhizome.h index 12ffc1a6..9726b20d 100644 --- a/rhizome.h +++ b/rhizome.h @@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SERVALDNA__RHIZOME_H -#define __SERVALDNA__RHIZOME_H +#ifndef __SERVAL_DNA__RHIZOME_H +#define __SERVAL_DNA__RHIZOME_H #include #include @@ -954,4 +954,4 @@ int overlay_mdp_service_rhizome_sync(struct overlay_frame *frame, overlay_mdp_fr int rhizome_sync_announce(); int rhizome_sync_bundle_inserted(const unsigned char *bar); -#endif //__SERVALDNA__RHIZOME_H +#endif //__SERVAL_DNA__RHIZOME_H diff --git a/serval.h b/serval.h index f929b245..62a9b2bd 100644 --- a/serval.h +++ b/serval.h @@ -18,8 +18,8 @@ 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_SERVALD_H -#define __SERVALD_SERVALD_H +#ifndef __SERVAL_DNA__SERVAL_H +#define __SERVAL_DNA__SERVAL_H #include #include @@ -700,4 +700,4 @@ int link_stop_routing(struct subscriber *subscriber); int generate_nonce(unsigned char *nonce,int bytes); -#endif // __SERVALD_SERVALD_H +#endif // __SERVAL_DNA__SERVAL_H diff --git a/socket.h b/socket.h index 558e28c1..ce8743be 100644 --- a/socket.h +++ b/socket.h @@ -17,8 +17,8 @@ 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_SOCKET_H -#define __SERVALD_SOCKET_H +#ifndef __SERVAL_DNA___SOCKET_H +#define __SERVAL_DNA___SOCKET_H #ifdef WIN32 # include "win32/win32.h" @@ -85,4 +85,4 @@ ssize_t _recv_message(struct __sourceloc, int fd, struct socket_address *address ssize_t recvwithttl(int sock, unsigned char *buffer, size_t bufferlen, int *ttl, struct socket_address *recvaddr); -#endif +#endif // __SERVAL_DNA___SOCKET_H diff --git a/str.c b/str.c index 4849f8a0..b1ac6a79 100644 --- a/str.c +++ b/str.c @@ -17,7 +17,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#define __SERVAL_DNA_STR_INLINE +#define __SERVAL_DNA__STR_INLINE #include "str.h" #include "strbuf_helpers.h" #include "constants.h" diff --git a/str.h b/str.h index 86f81644..5b6fb2d2 100644 --- a/str.h +++ b/str.h @@ -17,8 +17,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SERVAL_DNA_STR_H__ -#define __SERVAL_DNA_STR_H__ +#ifndef __SERVAL_DNA__STR_H__ +#define __SERVAL_DNA__STR_H__ #include #include @@ -26,11 +26,11 @@ #include #include -#ifndef __SERVAL_DNA_STR_INLINE +#ifndef __SERVAL_DNA__STR_INLINE # if __GNUC__ && !__GNUC_STDC_INLINE__ -# define __SERVAL_DNA_STR_INLINE extern inline +# define __SERVAL_DNA__STR_INLINE extern inline # else -# define __SERVAL_DNA_STR_INLINE inline +# define __SERVAL_DNA__STR_INLINE inline # endif #endif @@ -53,7 +53,7 @@ extern const char hexdigit_lower[16]; * * @author Andrew Bettison */ -__SERVAL_DNA_STR_INLINE int is_xsubstring(const char *text, int len) +__SERVAL_DNA__STR_INLINE int is_xsubstring(const char *text, int len) { while (len--) if (!isxdigit(*text++)) @@ -66,7 +66,7 @@ __SERVAL_DNA_STR_INLINE int is_xsubstring(const char *text, int len) * * @author Andrew Bettison */ -__SERVAL_DNA_STR_INLINE int is_xstring(const char *text, int len) +__SERVAL_DNA__STR_INLINE int is_xstring(const char *text, int len) { while (len--) if (!isxdigit(*text++)) @@ -209,43 +209,43 @@ extern uint8_t _serval_ctype_0[UINT8_MAX]; extern uint8_t _serval_ctype_1[UINT8_MAX]; extern uint8_t _serval_ctype_2[UINT8_MAX]; -__SERVAL_DNA_STR_INLINE int is_http_char(char c) { +__SERVAL_DNA__STR_INLINE int is_http_char(char c) { return isascii(c); } -__SERVAL_DNA_STR_INLINE int is_http_ctl(char c) { +__SERVAL_DNA__STR_INLINE int is_http_ctl(char c) { return iscntrl(c); } -__SERVAL_DNA_STR_INLINE int is_base64_digit(char c) { +__SERVAL_DNA__STR_INLINE int is_base64_digit(char c) { return (_serval_ctype_0[(unsigned char) c] & _SERVAL_CTYPE_0_BASE64) != 0; } -__SERVAL_DNA_STR_INLINE int is_base64url_digit(char c) { +__SERVAL_DNA__STR_INLINE int is_base64url_digit(char c) { return (_serval_ctype_0[(unsigned char) c] & _SERVAL_CTYPE_0_BASE64URL) != 0; } -__SERVAL_DNA_STR_INLINE int is_base64_pad(char c) { +__SERVAL_DNA__STR_INLINE int is_base64_pad(char c) { return c == '='; } -__SERVAL_DNA_STR_INLINE int is_base64url_pad(char c) { +__SERVAL_DNA__STR_INLINE int is_base64url_pad(char c) { return c == '='; } -__SERVAL_DNA_STR_INLINE uint8_t base64_digit(char c) { +__SERVAL_DNA__STR_INLINE uint8_t base64_digit(char c) { return _serval_ctype_0[(unsigned char) c] & _SERVAL_CTYPE_0_BASE64_MASK; } -__SERVAL_DNA_STR_INLINE uint8_t base64url_digit(char c) { +__SERVAL_DNA__STR_INLINE uint8_t base64url_digit(char c) { return _serval_ctype_0[(unsigned char) c] & _SERVAL_CTYPE_0_BASE64_MASK; } -__SERVAL_DNA_STR_INLINE int is_multipart_boundary(char c) { +__SERVAL_DNA__STR_INLINE int is_multipart_boundary(char c) { return (_serval_ctype_2[(unsigned char) c] & _SERVAL_CTYPE_2_MULTIPART_BOUNDARY) != 0; } -__SERVAL_DNA_STR_INLINE int is_valid_multipart_boundary_string(const char *s) +__SERVAL_DNA__STR_INLINE int is_valid_multipart_boundary_string(const char *s) { if (s[0] == '\0') return 0; @@ -255,11 +255,11 @@ __SERVAL_DNA_STR_INLINE int is_valid_multipart_boundary_string(const char *s) return s[-1] != ' '; } -__SERVAL_DNA_STR_INLINE int is_http_separator(char c) { +__SERVAL_DNA__STR_INLINE int is_http_separator(char c) { return (_serval_ctype_1[(unsigned char) c] & _SERVAL_CTYPE_1_HTTP_SEPARATOR) != 0; } -__SERVAL_DNA_STR_INLINE int is_http_token(char c) { +__SERVAL_DNA__STR_INLINE int is_http_token(char c) { return is_http_char(c) && !is_http_ctl(c) && !is_http_separator(c); } @@ -268,7 +268,7 @@ __SERVAL_DNA_STR_INLINE int is_http_token(char c) { * * @author Andrew Bettison */ -__SERVAL_DNA_STR_INLINE int hexvalue(char c) { +__SERVAL_DNA__STR_INLINE int hexvalue(char c) { return isxdigit(c) ? _serval_ctype_1[(unsigned char) c] & _SERVAL_CTYPE_1_HEX_MASK : -1; } @@ -302,24 +302,24 @@ const char *strnchr(const char *s, size_t n, char c); * @author Andrew Bettison */ -__SERVAL_DNA_STR_INLINE ssize_t str_index_dfl(const char *s, char c, ssize_t dfl) +__SERVAL_DNA__STR_INLINE ssize_t str_index_dfl(const char *s, char c, ssize_t dfl) { const char *r = strchr(s, c); return r ? r - s : dfl; } -__SERVAL_DNA_STR_INLINE ssize_t str_rindex_dfl(const char *s, char c, ssize_t dfl) +__SERVAL_DNA__STR_INLINE ssize_t str_rindex_dfl(const char *s, char c, ssize_t dfl) { const char *r = strrchr(s, c); return r ? r - s : dfl; } -__SERVAL_DNA_STR_INLINE ssize_t str_index(const char *s, char c) +__SERVAL_DNA__STR_INLINE ssize_t str_index(const char *s, char c) { return str_index_dfl(s, c, -1); } -__SERVAL_DNA_STR_INLINE ssize_t str_rindex(const char *s, char c) +__SERVAL_DNA__STR_INLINE ssize_t str_rindex(const char *s, char c) { return str_rindex_dfl(s, c, -1); } @@ -447,15 +447,15 @@ int str_to_uint64_interval_ms(const char *str, int64_t *result, const char **aft */ int str_is_uri(const char *uri); -__SERVAL_DNA_STR_INLINE int is_uri_char_scheme(char c) { +__SERVAL_DNA__STR_INLINE int is_uri_char_scheme(char c) { return (_serval_ctype_1[(unsigned char) c] & _SERVAL_CTYPE_1_URI_SCHEME) != 0; } -__SERVAL_DNA_STR_INLINE int is_uri_char_unreserved(char c) { +__SERVAL_DNA__STR_INLINE int is_uri_char_unreserved(char c) { return (_serval_ctype_1[(unsigned char) c] & _SERVAL_CTYPE_1_URI_UNRESERVED) != 0; } -__SERVAL_DNA_STR_INLINE int is_uri_char_reserved(char c) { +__SERVAL_DNA__STR_INLINE int is_uri_char_reserved(char c) { return (_serval_ctype_1[(unsigned char) c] & _SERVAL_CTYPE_1_URI_RESERVED) != 0; } @@ -464,7 +464,7 @@ __SERVAL_DNA_STR_INLINE int is_uri_char_reserved(char c) { * * @author Andrew Bettison */ -__SERVAL_DNA_STR_INLINE int str_is_uri_scheme(const char *scheme) +__SERVAL_DNA__STR_INLINE int str_is_uri_scheme(const char *scheme) { if (!isalpha(*scheme++)) return 0; @@ -530,4 +530,4 @@ int str_uri_authority_port(const char *auth, uint16_t *portp); int parse_argv(char *cmdline, char delim, char **argv, int max_argv); -#endif // __SERVAL_DNA_STR_H__ +#endif // __SERVAL_DNA__STR_H__ diff --git a/uuid.c b/uuid.c index d77f369b..a0209a7e 100644 --- a/uuid.c +++ b/uuid.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#define __SERVALDNA_UUID_H_INLINE +#define __SERVAL_DNA__UUID_H_INLINE #include "uuid.h" #include "os.h" #include "str.h" diff --git a/uuid.h b/uuid.h index fea11631..1675b663 100644 --- a/uuid.h +++ b/uuid.h @@ -17,19 +17,19 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SERVALDNA_UUID_H -#define __SERVALDNA_UUID_H +#ifndef __SERVAL_DNA__UUID_H +#define __SERVAL_DNA__UUID_H #include #include #include #include "strbuf.h" -#ifndef __SERVALDNA_UUID_H_INLINE +#ifndef __SERVAL_DNA__UUID_H_INLINE # if __GNUC__ && !__GNUC_STDC_INLINE__ -# define __SERVALDNA_UUID_H_INLINE extern inline +# define __SERVAL_DNA__UUID_H_INLINE extern inline # else -# define __SERVALDNA_UUID_H_INLINE inline +# define __SERVAL_DNA__UUID_H_INLINE inline # endif #endif @@ -74,11 +74,11 @@ enum uuid_version { UUID_VERSION_NAME_SHA1 = 5 }; -__SERVALDNA_UUID_H_INLINE int cmp_uuid_t(const uuid_t *a, const uuid_t *b) { +__SERVAL_DNA__UUID_H_INLINE int cmp_uuid_t(const uuid_t *a, const uuid_t *b) { return memcmp(a->u.binary, b->u.binary, sizeof a->u.binary); } -__SERVALDNA_UUID_H_INLINE int uuid_is_valid(const uuid_t *any_uuid) { +__SERVAL_DNA__UUID_H_INLINE int uuid_is_valid(const uuid_t *any_uuid) { return (any_uuid->u.record.clock_seq_hi_and_reserved & 0xc0) == 0x80; } @@ -125,4 +125,4 @@ strbuf strbuf_uuid(strbuf, const uuid_t *valid_uuid); */ int str_to_uuid(const char *str, uuid_t *result, const char **afterp); -#endif //__SERVALDNA_OS_H +#endif //__SERVAL_DNA__OS_H diff --git a/xprintf.h b/xprintf.h index 91d81b9a..25757ceb 100644 --- a/xprintf.h +++ b/xprintf.h @@ -17,8 +17,8 @@ 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_XPRINTF_H -#define __SERVALD_XPRINTF_H +#ifndef __SERVAL_DNA__XPRINTF_H +#define __SERVAL_DNA__XPRINTF_H /* Generalised (extensible) printf framework. * @@ -107,4 +107,4 @@ CONTEXT_VPRINTF _cx_vprintf_mallocbuf; #define XPRINTF_STRBUF(SB) _XPRINTF(_cx_vprintf_strbuf,(SB)) CONTEXT_VPRINTF _cx_vprintf_strbuf; -#endif // __SERVALD_XPRINTF_H +#endif // __SERVAL_DNA__XPRINTF_H From 9c124c8ba86cbca2ee22f9db97315024c6ce1a55 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Thu, 5 Dec 2013 13:21:58 +1030 Subject: [PATCH 15/19] Add "servald version" command and "make copyright" New COPYRIGHT.txt is regenerated manually using "make copyright" which invokes the sp-copyright-tool utility from the serval-tools repo. --- COPYRIGHT.txt | 7 +++++++ Makefile.in | 13 +++++++++++-- commandline.c | 13 +++++++++++++ serval.h | 1 + version_servald.c | 7 ++++++- 5 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 COPYRIGHT.txt diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt new file mode 100644 index 00000000..e8f65e12 --- /dev/null +++ b/COPYRIGHT.txt @@ -0,0 +1,7 @@ +Portions Copyright (C) 2010-2013 Serval Project Inc. +Portions Copyright (C) 2010-2013 Paul Gardner-Stephen +Portions Copyright (C) 2000-2001 Aaron D. Gifford +Portions Copyright (C) 2010-2012 Serval Project Pty Limited +Portions Copyright (C) 2006-2008 Linpro AS +Portions Copyright (C) 2012 Andrew Tridgell, All Rights Reserved +Portions Copyright (C) 2006 Verdens Gang AS diff --git a/Makefile.in b/Makefile.in index 9ffc7524..028829e8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -95,10 +95,11 @@ sqlite-amalgamation-3070900/sqlite3.o: sqlite-amalgamation-3070900/sqlite3.c @echo CC $< @$(CC) $(CFLAGS) $(DEFS) -c $< -o sqlite-amalgamation-3070900/sqlite3.o -version.o: *.h *.c version_string.sh +version.o: *.h *.c version_string.sh COPYRIGHT.txt Makefile @echo CC version_servald.c @V=`./version_string.sh --ignore-untracked` \ - && $(CC) -c version_servald.c -o $@ -DSERVALD_VERSION="\"$$V\"" + && C="`sed -e :a -e N -e '$$!ba' -e 's/[\\\\"]/\\\\&/g' -e 's/\\n/\\\\n/g' COPYRIGHT.txt`" \ + && $(CC) -c version_servald.c -o $@ -DSERVALD_VERSION="\"$$V\"" -DSERVALD_COPYRIGHT="\"$$C\"" %.o: %.c @echo CC $< @@ -128,6 +129,14 @@ config_test: config_test.o conf_om.o conf_schema.o conf_parse.o str.o strbuf.o s @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 +copyright: COPYRIGHT.txt + +findPATH = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH))))) +COPYRIGHT_TOOL := $(call findPATH,sp-copyright-tool) + +COPYRIGHT.txt: *.c *.h $(COPYRIGHT_TOOL) + $(COPYRIGHT_TOOL) -o $@ condense *.c *.h + # 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/commandline.c b/commandline.c index 38fdfd44..d4960d05 100644 --- a/commandline.c +++ b/commandline.c @@ -56,6 +56,17 @@ int commandline_usage(const struct cli_parsed *parsed, struct cli_context *conte return cli_usage_parsed(parsed, XPRINTF_STDIO(stdout)); } +int version_message(const struct cli_parsed *parsed, struct cli_context *context) +{ + printf("Serval DNA version %s\n%s\n", version_servald, copyright_servald); + printf("\ +License GPLv2+: GNU GPL version 2 or later .\n\ +This is free software: you are free to change and redistribute it.\n\ +There is NO WARRANTY, to the extent permitted by law.\n\ +"); + return 0; +} + /* Data structures for accumulating output of a single JNI call. */ @@ -2871,6 +2882,8 @@ int app_network_scan(const struct cli_parsed *parsed, struct cli_context *contex struct cli_schema command_line_options[]={ {commandline_usage,{"help|-h|--help","...",NULL},CLIFLAG_PERMISSIVE_CONFIG, "Display command usage."}, + {version_message,{"version|copyright"},CLIFLAG_PERMISSIVE_CONFIG, + "Display copyright information."}, {app_echo,{"echo","[-e]","[--]","...",NULL},CLIFLAG_PERMISSIVE_CONFIG, "Output the supplied string."}, {app_log,{"log","error|warn|hint|info|debug","",NULL},CLIFLAG_PERMISSIVE_CONFIG, diff --git a/serval.h b/serval.h index 62a9b2bd..799c7786 100644 --- a/serval.h +++ b/serval.h @@ -139,6 +139,7 @@ struct in_addr { extern const char version_servald[]; +extern const char copyright_servald[]; /* Fundamental types. */ diff --git a/version_servald.c b/version_servald.c index dd99a472..1bf11a42 100644 --- a/version_servald.c +++ b/version_servald.c @@ -1,5 +1,5 @@ /* -Serval DNA version string +Serval DNA version and copyright strings Copyright (C) 2013 Serval Project Inc. This program is free software; you can redistribute it and/or @@ -21,4 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #error "SERVALD_VERSION is not defined" #endif +#ifndef SERVALD_COPYRIGHT +#error "SERVALD_COPYRIGHT is not defined" +#endif + const char version_servald[] = SERVALD_VERSION; +const char copyright_servald[] = SERVALD_COPYRIGHT; From 44b27bce5753a6d17354a23d44a46b356410f826 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Thu, 5 Dec 2013 15:10:58 +1030 Subject: [PATCH 16/19] Update README Licensing and copyright, MeshMS, Rhizome --- README.md | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 2cd475bc..145651a1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Serval DNA ========== -[Serval Project][], May 2013 +[Serval Project][], December 2013 This repository contains the source code for the “core” Serval components implemented in [GNU C][]: @@ -48,13 +48,12 @@ implemented in [GNU C][]: has two parts: a *manifest* that describes the content, and the *payload*, which is the content itself. Each bundle has its own unique cryptographic identifier that allows any recipient to verify that it has not been tampered - with. + with. A bundle's payload may be encrypted by the author so that only the + designated recipient can read it. - * The **[MeshMS][]** messaging service is implemented using Rhizome as its - transport, with each thread represented as a pair of bundles, one for each - direction. At present, the MeshMS logic is implemented in Java within the - [Serval Mesh][batphone] Android app, but is planned to be re-implemented in - C as part of Serval DNA (see [issue #28][]). + * The **[MeshMS][]** messaging service sends short text messages using Rhizome + as its transport. Each message thread is stored and carried in a pair of + journal bundles, one for each direction (ply). * **[Serval Infrastructure][]** services may optionally be deployed on any devices in the mesh to expose external services to mesh subscribers and vice versa @@ -77,12 +76,20 @@ Project's [serval-dna][] Git repository on [GitHub][]. The copyright in most of the source code in Serval DNA is held by [Serval Project Inc.][SPI], a not-for-profit association incorporated in the state of South Australia in the Commonwealth of Australia for the purpose of developing -the Serval mesh software. +the Serval mesh software. The [COPYRIGHT][] file contains a full list of all +those who hold copyright in portions of the Serval DNA source code. -The [Serval Project][] will accept contributions from individual developers who -have agreed to the [Serval Project Developer Agreement - Individual][individ], -and from organisations that have agreed to the [Serval Project Developer -Agreement - Entity][entity]. +The [Serval Project][] will accept contributions for which copyright has been +assigned to [Serval Project Inc.][SPI], or which are licensed to either [Serval +Project Inc.][SPI] or to the public on terms that allow the Serval Project to +freely redistribute and re-license the code under non-restrictive terms, for +example, to release Serval DNA as part of a product distributed through the +[Apple app store][]. + +Individual developers may assign copyright in their contributions by signing +the [Serval Project Developer Agreement - Individual][individ], and +organisations by signing the [Serval Project Developer Agreement - +Entity][entity]. Download, build and test ------------------------ @@ -130,7 +137,9 @@ For more documentation, see: [free software]: http://www.gnu.org/philosophy/free-sw.html [contributors]: /servalproject/serval-dna/blob/development/CONTRIBUTORS.md [GitHub]: https://github.com/servalproject +[COPYRIGHT]: ./COPYRIGHT.txt [GPL2]: ./GPL-2.0.txt +[Apple app store]: http://www.fsf.org/blogs/licensing/more-about-the-app-store-gpl-enforcement [individ]: http://developer.servalproject.org/files/serval_project_inc-individual.pdf [entity]: http://developer.servalproject.org/files/serval_project_inc-entity.pdf [DNA]: http://developer.servalproject.org/dokuwiki/doku.php?id=content:tech:dna From b63f1f0114754a3d468900ca0cd9b887e05ce12b Mon Sep 17 00:00:00 2001 From: Jeremy Lakeman Date: Fri, 6 Dec 2013 12:10:08 +1030 Subject: [PATCH 17/19] Fix formatting issues --- monitor.c | 2 +- rhizome_bundle.c | 2 +- rhizome_crypto.c | 2 +- rhizome_direct_http.c | 2 +- rhizome_fetch.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/monitor.c b/monitor.c index af2f2bf7..37bef524 100644 --- a/monitor.c +++ b/monitor.c @@ -576,7 +576,7 @@ static int monitor_help(const struct cli_parsed *parsed, struct cli_context *con int monitor_announce_bundle(rhizome_manifest *m) { char msg[1024]; - int len = snprintf(msg,1024,"\n*%d:BUNDLE:%s\n", + int len = snprintf(msg,1024,"\n*%zd:BUNDLE:%s\n", m->manifest_all_bytes, alloca_tohex_rhizome_bid_t(m->cryptoSignPublic)); bcopy(m->manifestdata, &msg[len], m->manifest_all_bytes); diff --git a/rhizome_bundle.c b/rhizome_bundle.c index e513f855..64341e0c 100644 --- a/rhizome_bundle.c +++ b/rhizome_bundle.c @@ -1023,7 +1023,7 @@ int rhizome_manifest_selfsign(rhizome_manifest *m) int rhizome_write_manifest_file(rhizome_manifest *m, const char *path, char append) { if (config.debug.rhizome) - DEBUGF("write manifest (%d bytes) to %s", m->manifest_all_bytes, path); + DEBUGF("write manifest (%zd bytes) to %s", m->manifest_all_bytes, path); if (!m) return WHY("Manifest is null."); if (!m->finalised) diff --git a/rhizome_crypto.c b/rhizome_crypto.c index db3c990e..e219bda4 100644 --- a/rhizome_crypto.c +++ b/rhizome_crypto.c @@ -542,7 +542,7 @@ int rhizome_manifest_extract_signature(rhizome_manifest *m, unsigned *ofs) RETURN(0); } } - WARNF("Unsupported signature at ofs=%u: type=%#02x", sig - m->manifestdata, sigType); + WARNF("Unsupported signature at ofs=%u: type=%#02x", (unsigned)(sig - m->manifestdata), sigType); RETURN(3); } diff --git a/rhizome_direct_http.c b/rhizome_direct_http.c index b84a5430..431adc17 100644 --- a/rhizome_direct_http.c +++ b/rhizome_direct_http.c @@ -658,7 +658,7 @@ void rhizome_direct_http_dispatch(rhizome_direct_sync_request *r) "\r\n"; /* Work out what the content length should be */ if (config.debug.rhizome_tx) - DEBUGF("manifest_all_bytes=%u, manifest_body_bytes=%u", m->manifest_all_bytes, m->manifest_body_bytes); + DEBUGF("manifest_all_bytes=%zu, manifest_body_bytes=%zu", m->manifest_all_bytes, m->manifest_body_bytes); assert(m->filesize != RHIZOME_SIZE_UNSET); size_t content_length = strlen(template2) - 2 /* minus 2 for the "%s" that gets replaced */ diff --git a/rhizome_fetch.c b/rhizome_fetch.c index 349961c7..b69e6b2f 100644 --- a/rhizome_fetch.c +++ b/rhizome_fetch.c @@ -476,7 +476,7 @@ static int rhizome_import_received_bundle(struct rhizome_manifest *m) { m->finalised = 1; if (config.debug.rhizome_rx) { - DEBUGF("manifest len=%u has %u signatories. Associated filesize=%"PRIu64" bytes", + DEBUGF("manifest len=%zu has %u signatories. Associated filesize=%"PRIu64" bytes", m->manifest_all_bytes, m->sig_count, m->filesize); dump("manifest", m->manifestdata, m->manifest_all_bytes); } From bc34c642ee91f53e42b09342bf21a7a0877c7443 Mon Sep 17 00:00:00 2001 From: Jeremy Lakeman Date: Fri, 6 Dec 2013 12:50:08 +1030 Subject: [PATCH 18/19] Add link arguments so the linker can find math functions --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 028829e8..d23f66c0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -127,7 +127,7 @@ fakeradio: 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 + @$(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 $(LDFLAGS) copyright: COPYRIGHT.txt From 1ed03e5bf33cfb6a28e6d5e086cb665882e46795 Mon Sep 17 00:00:00 2001 From: Jeremy Lakeman Date: Fri, 6 Dec 2013 15:08:40 +1030 Subject: [PATCH 19/19] Add compiler flags for android ndk build --- Android.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Android.mk b/Android.mk index fb3fdd2a..92dfa9ad 100644 --- a/Android.mk +++ b/Android.mk @@ -6,7 +6,7 @@ SERVALD_SRC_FILES = $(SERVAL_SOURCES) $(ANDROIDONLY_SOURCES) SERVALD_LOCAL_CFLAGS = \ -g \ - -DSERVALD_VERSION="\"Android\"" \ + -DSERVALD_VERSION="\"Android\"" -DSERVALD_COPYRIGHT="\"Android\"" \ -DSHELL -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" \ -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" \ -DHAVE_LIBC=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 \ @@ -17,7 +17,7 @@ SERVALD_LOCAL_CFLAGS = \ -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_POLL_H=1 -DHAVE_NETDB_H=1 \ -DHAVE_JNI_H=1 -DHAVE_STRUCT_UCRED=1 -DHAVE_CRYPTO_SIGN_NACL_GE25519_H=1 \ -DBYTE_ORDER=_BYTE_ORDER -DHAVE_LINUX_STRUCT_UCRED -DUSE_ABSTRACT_NAMESPACE \ - -DHAVE_BCOPY -DHAVE_BZERO \ + -DHAVE_BCOPY -DHAVE_BZERO -DHAVE_NETINET_IN_H \ -I$(NACL_INC) \ -I$(SQLITE3_INC)