mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-18 20:57:56 +00:00
Merge branch 'development' into warnings-security
This commit is contained in:
commit
4d80c7c5db
1
.gitignore
vendored
1
.gitignore
vendored
@ -21,6 +21,7 @@ serval.c
|
||||
/directory_service
|
||||
/tfw_createfile
|
||||
/fakeradio
|
||||
/config_test
|
||||
*.so
|
||||
test.*.log
|
||||
testlog
|
||||
|
@ -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)
|
||||
|
||||
|
24
CONTRIBUTORS.md
Normal file
24
CONTRIBUTORS.md
Normal file
@ -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
|
7
COPYRIGHT.txt
Normal file
7
COPYRIGHT.txt
Normal file
@ -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
|
339
GPL-2.0.txt
Normal file
339
GPL-2.0.txt
Normal file
@ -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.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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.
|
||||
|
||||
<signature of Ty Coon>, 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.
|
40
Makefile.in
40
Makefile.in
@ -1,3 +1,8 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
bindir=@bindir@
|
||||
sbindir=@sbindir@
|
||||
|
||||
NACL_BASE= nacl/src
|
||||
include $(NACL_BASE)/nacl.mk
|
||||
SERVAL_BASE=
|
||||
@ -23,6 +28,7 @@ MONITORCLIENTSRCS=conf.c \
|
||||
conf_schema.c \
|
||||
dataformats.c \
|
||||
log.c \
|
||||
log_util.c \
|
||||
xprintf.c \
|
||||
os.c \
|
||||
mem.c \
|
||||
@ -43,10 +49,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 \
|
||||
@ -68,6 +76,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
|
||||
|
||||
# More warnings, discover problems that only happen on some archs
|
||||
@ -82,16 +95,17 @@ 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 $<
|
||||
@$(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 $<
|
||||
@ -117,6 +131,18 @@ 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 $(LDFLAGS)
|
||||
|
||||
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
|
||||
@ -131,8 +157,14 @@ libmonitorclient.a: $(MONITORCLIENTOBJS) version.o
|
||||
@echo AR $@
|
||||
@$(AR) -cr $@ $(MONITORCLIENTOBJS) version.o
|
||||
|
||||
install: servald
|
||||
$(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 \
|
||||
|
48
README.md
48
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,26 +76,31 @@ 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
|
||||
------------------------
|
||||
|
||||
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).
|
||||
|
||||
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).
|
||||
|
||||
More information
|
||||
----------------
|
||||
@ -115,10 +119,12 @@ 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/))
|
||||
|
||||
* the [Serval DNA][] page in the [Serval Project Wiki][]
|
||||
|
||||
* [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/
|
||||
[Serval DNA]: http://developer.servalproject.org/dokuwiki/doku.php?id=content:servaldna:
|
||||
@ -129,9 +135,11 @@ 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
|
||||
[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
|
||||
|
@ -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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
8
cli.c
8
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
|
||||
@ -340,17 +340,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)
|
||||
|
8
cli.h
8
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
|
||||
@ -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
|
||||
|
@ -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
|
||||
@ -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 <http://gnu.org/licenses/gpl.html>.\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","<message>",NULL},CLIFLAG_PERMISSIVE_CONFIG,
|
||||
|
6
conf.h
6
conf.h
@ -222,8 +222,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
* @author Andrew Bettison <andrew@servalproject.com>
|
||||
*/
|
||||
|
||||
#ifndef __SERVALDNA_CONFIG_H
|
||||
#define __SERVALDNA_CONFIG_H
|
||||
#ifndef __SERVAL_DNA__CONF_H
|
||||
#define __SERVAL_DNA__CONF_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <arpa/inet.h>
|
||||
@ -701,4 +701,4 @@ int cf_reload();
|
||||
int cf_reload_strict();
|
||||
int cf_reload_permissive();
|
||||
|
||||
#endif //__SERVALDNA_CONFIG_H
|
||||
#endif //__SERVAL_DNA__CONF_H
|
||||
|
@ -633,11 +633,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)
|
||||
|
@ -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 <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
@ -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
|
||||
|
19
crypto.c
19
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"
|
||||
|
22
crypto.h
22
crypto.h
@ -1,6 +1,24 @@
|
||||
/*
|
||||
Serval DNA internal cryptographic operations
|
||||
Copyright 2013 Serval Project Inc.
|
||||
|
||||
#ifndef __SERVALD_CRYPTO_H
|
||||
#define __SERVALD_CRYPTO_H
|
||||
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 __SERVAL_DNA__CRYPTO_H
|
||||
#define __SERVAL_DNA__CRYPTO_H
|
||||
|
||||
#include "nacl.h"
|
||||
#define SIGNATURE_BYTES crypto_sign_edwards25519sha512batch_BYTES
|
||||
|
@ -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
|
||||
@ -28,17 +28,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;
|
||||
}
|
||||
@ -80,7 +83,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)
|
||||
@ -102,7 +105,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)
|
||||
@ -119,27 +122,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)
|
||||
@ -152,16 +135,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')
|
||||
@ -171,6 +144,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 <andrew@servalproject.com>
|
||||
*/
|
||||
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;
|
||||
|
@ -1,5 +1,23 @@
|
||||
#ifndef __SERVALD_DATA_FORMATS_H
|
||||
#define __SERVALD_DATA_FORMATS_H
|
||||
/*
|
||||
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 __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);
|
||||
@ -15,6 +33,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);
|
||||
@ -23,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
|
||||
|
@ -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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
@ -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 <poll.h>
|
||||
|
19
fakeradio.c
19
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 <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.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
|
||||
@ -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 <poll.h>
|
||||
@ -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
|
||||
|
19
fifo.c
19
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.
|
||||
*
|
||||
|
26
fifo.h
26
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);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
18
golay.c
18
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 */
|
||||
#include <inttypes.h>
|
||||
|
24
golay.h
24
golay.h
@ -1,8 +1,26 @@
|
||||
/*
|
||||
Serval DNA Golay coding
|
||||
Copyright (C) 2013 Serval Project Inc.
|
||||
|
||||
#ifndef __SERVALD_GOLAY_H
|
||||
#define __SERVALD_GOLAY_H
|
||||
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 __SERVAL_DNA__GOLAY_H
|
||||
#define __SERVAL_DNA__GOLAY_H
|
||||
|
||||
int golay_encode(uint8_t *data);
|
||||
int golay_decode(int *errs, uint8_t *data);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
@ -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 <limits.h>
|
||||
#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
|
||||
|
@ -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
|
||||
|
26
keyring.h
26
keyring.h
@ -1,5 +1,25 @@
|
||||
#ifndef __SERVALD_KEYRING_H
|
||||
#define __SERVALD_KEYRING_H
|
||||
/*
|
||||
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 __SERVAL_DNA__KEYRING_H
|
||||
#define __SERVAL_DNA__KEYRING_H
|
||||
|
||||
typedef struct keypair {
|
||||
int type;
|
||||
@ -106,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
|
||||
|
54
log.c
54
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;
|
||||
}
|
||||
|
6
log.h
6
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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -161,4 +161,4 @@ struct strbuf;
|
||||
|
||||
#define BACKTRACE log_backtrace(LOG_LEVEL_FATAL, __WHENCE__)
|
||||
|
||||
#endif // __SERVALD_LOG_H
|
||||
#endif // __SERVAL_DNA__LOG_H
|
||||
|
73
log_util.c
Normal file
73
log_util.c
Normal file
@ -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;
|
||||
}
|
4
main.c
4
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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
@ -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"
|
||||
|
||||
|
74
mdp_net.c
Normal file
74
mdp_net.c
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
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 "socket.h"
|
||||
#include "conf.h"
|
||||
#include "log.h"
|
||||
|
||||
ssize_t recvwithttl(int sock,unsigned char *buffer, size_t bufferlen,int *ttl, struct socket_address *recvaddr)
|
||||
{
|
||||
struct msghdr msg;
|
||||
struct iovec iov[1];
|
||||
struct cmsghdr cmsgcmsg[16];
|
||||
iov[0].iov_base=buffer;
|
||||
iov[0].iov_len=bufferlen;
|
||||
bzero(&msg,sizeof(msg));
|
||||
msg.msg_name = &recvaddr->store;
|
||||
msg.msg_namelen = recvaddr->addrlen;
|
||||
msg.msg_iov = &iov[0];
|
||||
msg.msg_iovlen = 1;
|
||||
msg.msg_control = cmsgcmsg;
|
||||
msg.msg_controllen = sizeof cmsgcmsg;
|
||||
msg.msg_flags = 0;
|
||||
|
||||
ssize_t len = recvmsg(sock,&msg,0);
|
||||
if (len == -1 && errno != EAGAIN && errno != EWOULDBLOCK)
|
||||
return WHYF_perror("recvmsg(%d,%p,0)", sock, &msg);
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
}
|
||||
recvaddr->addrlen = msg.msg_namelen;
|
||||
|
||||
return len;
|
||||
}
|
6
mem.h
6
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 <sys/types.h>
|
||||
#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
|
||||
|
26
meshms.c
26
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 <assert.h>
|
||||
#include "serval.h"
|
||||
#include "rhizome.h"
|
||||
@ -385,10 +404,6 @@ static int update_conversation(const sid_t *my_sid, struct conversations *conv){
|
||||
if (config.debug.meshms)
|
||||
DEBUG("Locating their last message");
|
||||
|
||||
// find the offset of their last message
|
||||
if (rhizome_retrieve_manifest(&conv->their_ply.bundle_id, m_theirs))
|
||||
goto end;
|
||||
|
||||
if (ply_read_open(&ply, &conv->their_ply.bundle_id, m_theirs))
|
||||
goto end;
|
||||
|
||||
@ -421,9 +436,6 @@ static int update_conversation(const sid_t *my_sid, struct conversations *conv){
|
||||
m_ours = rhizome_new_manifest();
|
||||
if (!m_ours)
|
||||
goto end;
|
||||
if (rhizome_retrieve_manifest(&conv->my_ply.bundle_id, m_ours))
|
||||
goto end;
|
||||
|
||||
if (ply_read_open(&ply, &conv->my_ply.bundle_id, m_ours))
|
||||
goto end;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
@ -16,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;
|
||||
|
||||
@ -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
|
||||
#endif
|
||||
|
@ -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
|
||||
@ -575,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);
|
||||
|
53
net.c
53
net.c
@ -138,56 +138,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 socket_address *recvaddr)
|
||||
{
|
||||
struct msghdr msg;
|
||||
struct iovec iov[1];
|
||||
struct cmsghdr cmsgcmsg[16];
|
||||
iov[0].iov_base=buffer;
|
||||
iov[0].iov_len=bufferlen;
|
||||
bzero(&msg,sizeof(msg));
|
||||
msg.msg_name = &recvaddr->store;
|
||||
msg.msg_namelen = recvaddr->addrlen;
|
||||
msg.msg_iov = &iov[0];
|
||||
msg.msg_iovlen = 1;
|
||||
msg.msg_control = cmsgcmsg;
|
||||
msg.msg_controllen = sizeof cmsgcmsg;
|
||||
msg.msg_flags = 0;
|
||||
|
||||
ssize_t len = recvmsg(sock,&msg,0);
|
||||
if (len == -1 && errno != EAGAIN && errno != EWOULDBLOCK)
|
||||
return WHYF_perror("recvmsg(%d,%p,0)", sock, &msg);
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
}
|
||||
recvaddr->addrlen = msg.msg_namelen;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
9
net.h
9
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 <sys/types.h> // for size_t, ssize_t
|
||||
#include <sys/socket.h> // for struct sockaddr, socklen_t
|
||||
@ -53,7 +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);
|
||||
|
||||
struct socket_address;
|
||||
ssize_t recvwithttl(int sock, unsigned char *buffer, size_t bufferlen, int *ttl, struct socket_address *);
|
||||
|
||||
#endif // __SERVALD_NET_H
|
||||
#endif // __SERVAL_DNA__NET_H
|
||||
|
3
nonce.c
3
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
|
||||
|
2
os.c
2
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"
|
||||
|
18
os.h
18
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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -26,11 +26,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#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
|
||||
|
@ -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
|
||||
|
@ -1,24 +1,24 @@
|
||||
/*
|
||||
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
|
||||
#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
|
||||
|
@ -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
|
||||
|
@ -1,4 +1,23 @@
|
||||
#include <assert.h>
|
||||
/*
|
||||
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"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
@ -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
|
||||
|
@ -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 <termios.h>
|
||||
|
@ -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
|
||||
|
19
pa_phone.c
19
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 <codec2.h>
|
||||
#include <spandsp.h>
|
||||
#include "fifo.h"
|
||||
|
@ -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
|
||||
|
24
radio_link.h
24
radio_link.h
@ -1,5 +1,23 @@
|
||||
#ifndef __SERVALD_RADIO_LINK_H
|
||||
#define __SERVALD_RADIO_LINK_H
|
||||
/*
|
||||
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 __SERVAL_DNA___RADIO_LINK_H
|
||||
#define __SERVAL_DNA___RADIO_LINK_H
|
||||
|
||||
#define HEARTBEAT_SIZE (8+9)
|
||||
#define LINK_MTU 255
|
||||
@ -12,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
|
||||
#endif //__SERVAL_DNA___RADIO_LINK_H
|
||||
|
@ -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
|
||||
|
20
rhizome.h
20
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 <sqlite3.h>
|
||||
#include <limits.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
|
||||
|
||||
@ -950,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
|
||||
|
@ -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;
|
||||
@ -1021,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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 <assert.h>
|
||||
#include "serval.h"
|
||||
#include "rhizome.h"
|
||||
|
@ -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
|
||||
|
19
route_link.c
19
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"
|
||||
|
11
serval.h
11
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
|
||||
@ -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 <stdio.h>
|
||||
#include <errno.h>
|
||||
@ -139,6 +139,7 @@ struct in_addr {
|
||||
|
||||
|
||||
extern const char version_servald[];
|
||||
extern const char copyright_servald[];
|
||||
|
||||
/* Fundamental types.
|
||||
*/
|
||||
@ -213,6 +214,7 @@ extern char *batman_peerfile;
|
||||
|
||||
struct subscriber;
|
||||
struct decode_context;
|
||||
struct socket_address;
|
||||
|
||||
/* Make sure we have space to put bytes of the packet as we go along */
|
||||
#define CHECK_PACKET_LEN(B) {if (((*packet_len)+(B))>=packet_maxlen) { return WHY("Packet composition ran out of space."); } }
|
||||
@ -522,7 +524,6 @@ typedef struct overlay_mdp_frame {
|
||||
|
||||
/* Server-side MDP functions */
|
||||
int overlay_mdp_swap_src_dst(overlay_mdp_frame *mdp);
|
||||
struct socket_address;
|
||||
int overlay_mdp_dispatch(overlay_mdp_frame *mdp, struct socket_address *client);
|
||||
void overlay_mdp_encode_ports(struct overlay_buffer *plaintext, mdp_port_t dst_port, mdp_port_t src_port);
|
||||
int overlay_mdp_dnalookup_reply(const sockaddr_mdp *dstaddr, const sid_t *resolved_sidp, const char *uri, const char *did, const char *name);
|
||||
@ -700,4 +701,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
|
||||
|
41
socket.h
41
socket.h
@ -1,10 +1,39 @@
|
||||
#ifndef __SERVALD_SOCKET_H
|
||||
#define __SERVALD_SOCKET_H
|
||||
/*
|
||||
Serval DNA header file for socket operations
|
||||
Copyright (C) 2012-2013 Serval Project Inc.
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/un.h>
|
||||
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 __SERVAL_DNA___SOCKET_H
|
||||
#define __SERVAL_DNA___SOCKET_H
|
||||
|
||||
#ifdef WIN32
|
||||
# include "win32/win32.h"
|
||||
#else
|
||||
# include <sys/un.h>
|
||||
# ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
# endif
|
||||
# ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "log.h"
|
||||
|
||||
struct socket_address{
|
||||
socklen_t addrlen;
|
||||
union{
|
||||
@ -54,4 +83,6 @@ ssize_t _recv_message(struct __sourceloc, int fd, struct socket_address *address
|
||||
#define send_message(fd, address, data) _send_message(__WHENCE__, (fd), (address), (data))
|
||||
#define recv_message(fd, address, data) _recv_message(__WHENCE__, (fd), (address), (data))
|
||||
|
||||
#endif
|
||||
ssize_t recvwithttl(int sock, unsigned char *buffer, size_t bufferlen, int *ttl, struct socket_address *recvaddr);
|
||||
|
||||
#endif // __SERVAL_DNA___SOCKET_H
|
||||
|
@ -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)radio_link.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 \
|
||||
|
2
str.c
2
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"
|
||||
|
58
str.h
58
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 <string.h>
|
||||
#include <stdint.h>
|
||||
@ -26,11 +26,11 @@
|
||||
#include <ctype.h>
|
||||
#include <alloca.h>
|
||||
|
||||
#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 <andrew@servalproject.com>
|
||||
*/
|
||||
__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 <andrew@servalproject.com>
|
||||
*/
|
||||
__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 <andrew@servalproject.com>
|
||||
*/
|
||||
__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 <andrew@servalproject.com>
|
||||
*/
|
||||
|
||||
__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 <andrew@servalproject.com>
|
||||
*/
|
||||
__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__
|
||||
|
@ -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 "$@")
|
||||
( "$@" ) 6>"$_tfw_process_tmp/log.stdout" 1>&6 2>"$_tfw_process_tmp/log.stderr" 7>"$_tfw_process_tmp/log.xtrace" &
|
||||
$_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
|
||||
}
|
||||
|
19
testnacl.c
19
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 <stdio.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -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
|
||||
|
2
uuid.c
2
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"
|
||||
|
16
uuid.h
16
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 <stdint.h>
|
||||
#include <alloca.h>
|
||||
#include <string.h>
|
||||
#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
|
||||
|
@ -1,5 +1,29 @@
|
||||
/*
|
||||
Serval DNA version and copyright strings
|
||||
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
|
||||
|
||||
#ifndef SERVALD_COPYRIGHT
|
||||
#error "SERVALD_COPYRIGHT is not defined"
|
||||
#endif
|
||||
|
||||
const char version_servald[] = SERVALD_VERSION;
|
||||
const char copyright_servald[] = SERVALD_COPYRIGHT;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user