Commit Graph

39 Commits

Author SHA1 Message Date
Andrew Bettison
5ae14ad7bc Fix bugs in rhizome_opendb()
Was calling exit() instead of returning -1 on error, which was causing
the serval app to exit in the JNI "start" command if rhizome could not
create its db file.

Use DEBUGF() instead of fprintf(stderr) in many places.

confValueGet() was not stripping \r\n off end of returned string.

rhizome_set_datastore_path() was keeping the pointer it was given (from
conValueGet()'s rotor) instead of making a strdup() copy.
2012-05-18 18:55:52 +09:30
Andrew Bettison
5e11067c72 Add 'service' column to "rhizome list" output 2012-05-17 17:00:14 +09:30
Andrew Bettison
9a51c76dfb Insist on 'service' field in all manifests
The "rhizome file add" command assumes service=file if no manifest supplied
or the manifest lacks a service field.

The "rhizome extract manifest" command includes the service in its CLI output.
2012-05-17 17:00:14 +09:30
gardners
76663d1b9e fixed sqlite handle leaks when advertising rhizome manifests. 2012-05-17 11:14:10 +09:30
Andrew Bettison
1f44fd315e Improve rhizome_find_duplicate()
Detected inconsistency does not cause failure with error message, instead a
warning is issued and the inconsistent row is skipped.
2012-05-16 16:29:41 +09:30
Andrew Bettison
6cdd5dc054 Fix and improve rhizome_find_duplicate()
Now matches version number if supplied
Performs more consistency checks, and reports failures as errors
2012-05-16 15:58:06 +09:30
gardners
bc8a028b28 increased bytes_to_hex() rotor count to allow more uses in
a single printf().
2012-05-16 15:41:41 +09:30
Andrew Bettison
33f7ea7103 Add three optional args to "rhizome list" command
service, sender_sid, recipient_sid - not yet implemented
2012-05-16 13:47:58 +09:30
gardners
8020401cf0 removed creation of keypairs table that is being deprecated in favour
of BK fields in manifest.
2012-05-15 17:26:34 +09:30
gardners
525d3c4154 substantial work towards implementing BK field in rhizome manifests. 2012-05-15 17:24:25 +09:30
Andrew Bettison
f90b21ec78 Implement rhizome config options
rhizome.datastore_path - if not set, reverts to serval instance path
rhizome.enable - if not set, defaults to true
2012-05-15 12:56:10 +09:30
Andrew Bettison
d11258cefc Overhaul debug flags
Config debug flags are now represented as individual items, eg:
   servald config set debug.verbose yes
   servald config set debug.rhizome yes
instead of aggregated, eg:
   servald config set debug verbose,rhizome  <-- no longer works

Added a debug flag "debug.all" that can be set and cleared, over which
individual flag sets/clears take priority.

Slimmed down dna.c by moving some globals and functions to the files where they
are used.

Default command line (help message) is now the new style, not the deprecated
style.
2012-05-14 18:37:32 +09:30
Andrew Bettison
b02e9b9ac4 Overhaul rhizome datastore path code
Create datastore directory and all parent dirs if it does not exist
More robust error checking and buffer overflow protection
New mkdirs() and mkdirsn() functions
2012-05-14 18:37:32 +09:30
Andrew Bettison
e746557a08 Fix bug in overlay_gettime_ms()
The sequence start time was only getting set in overlay_interface_init(), which
was not always called, or was called after overlay_gettime_ms() had already
been used.

Added FATALF(), FATAL() and FATAL_perror() macros.

Removed a bunch of debug statements no longer needed in monitor.c and server.c.
2012-05-11 10:38:46 +09:30
Andrew Bettison
881576212c Fix all trivial compiler warnings 2012-05-10 18:08:59 +09:30
Andrew Bettison
836f8332e8 Replace perror() with WHY_perror()
Puts more diagnostics to Android log
2012-05-08 14:53:34 +09:30
Andrew Bettison
4ae3c95992 "rhizome list" command filter by datavalid 2012-05-07 10:25:30 +09:30
Andrew Bettison
97884ba069 Fix bug in output from "rhizome add file"
When a duplicate is detected, the 'manifestid' field must contain the public
key of the existing manifest.
2012-05-04 15:59:58 +09:30
Andrew Bettison
f31c326871 CLI output from "rhizome add file", with tests 2012-05-04 15:31:03 +09:30
Andrew Bettison
e230bbc40b Improve output from "rhizome extract manifest" 2012-05-03 12:17:49 +09:30
Andrew Bettison
7ba15ccdd7 Add "rhizome extract file" command with tests 2012-05-02 17:57:35 +09:30
Andrew Bettison
146eb7cdfd Add "rhizome extract manifest" command 2012-05-02 16:03:09 +09:30
Andrew Bettison
72640ade4c First output field of "rhizome list" is column count 2012-04-26 15:54:40 +09:30
Andrew Bettison
f9d8536d7d JNI-ize the output of "dna rhizome list" 2012-04-24 17:50:27 +09:30
Andrew Bettison
a73916e85a Implement JNI command-line interface (untested)
- argv is (const char *const *) everywhere, to avoid having to strdup() all the
  Java arg strings
- changed (char*) to (const char*) in lots of places to fix cascading compiler
  warnings as a result of argv constness
- fixed a bug in "config get" command when used without 'variable' arg
2012-04-23 17:18:15 +09:30
Andrew Bettison
866ddea189 Get all rhizome add file test cases passing
- new test cases to cover new payload with different versions
 - exit status of 2 when duplicate is detected
 - tighten up other test cases
 - fix bug in sqlite_exec_int64()
2012-04-16 11:46:58 +09:30
Andrew Bettison
de88d3db21 Make "dna rhizome add" work for more test cases
- adding a bundle using an existing manifest with an incorrect payload should
   fail with an error
 - adding a bundle using an existing manifest to update the payload to a new
   version should succeed
 - improve format of "dna rhizome list" output to one bundle per line
2012-04-13 18:03:19 +09:30
Andrew Bettison
7b53fd6782 Rhizome add does not add duplicate files
- If a bundle has the same payload hash and manifest.name as one already in
   the rhizome store, then the "dna rhizome add" command will not add it
 - Now passes fourth test case in tests/dna_rhizome
2012-04-12 18:33:43 +09:30
Andrew Bettison
f52db7f406 Fix bugs revealed by rhizome "add manifest" test case 2012-04-10 18:13:05 +09:30
Andrew Bettison
74986a0c30 Implement "rhizome add file" and "rhizome list" 2012-04-02 17:42:40 +09:30
Andrew Bettison
3befe32711 New command "rhizome add", support optional args 2012-03-29 17:51:59 +10:30
gardners
c9478659db Added hint in startup message to show where rhizome database size limit
is set.
2012-03-15 10:57:37 +10:30
gardners
ec8a81c206 Rhizome now uses serval.conf to get rhizome database size limit. 2012-03-15 10:57:37 +10:30
gardners
1eb4c34015 Renamed mphlr.h to serval.h
(also some temporary debugging has been added in some places)
2012-02-23 12:45:42 +10:30
gardners
edb44fb49d added CREATE TABLE VERIFICATIONS to database schema. 2012-02-17 00:38:03 +10:30
gardners
41daec5c96 Fixed all zeroes manifestid problem.
Removed incorrectly pasted piece of code.
Various debug cleanups along the way.
2012-01-27 15:38:06 +10:30
gardners
cdf1c45da4 Rhizome fetching over http now receives files and imports them.
Still some wrinkles to work out.
2012-01-13 21:13:17 +10:30
gardners
bf9f8559f1 Various debug fiddles and conversion from select() to poll()
(although poll() still doesn't let us monitor ordinary files
which is silly.)
2012-01-12 16:47:24 +10:30
gardners
abb3021986 Added refactored rhizome code in separate files. 2012-01-12 14:08:24 +10:30