Commit Graph

2850 Commits

Author SHA1 Message Date
Jeremy Lakeman
64fe96ebfa Only drop BAR's from the sync if they are no longer interesting 2014-01-09 15:01:37 +10:30
Jeremy Lakeman
1d88df594b Fix unsigned warning 2014-01-09 15:01:37 +10:30
Jeremy Lakeman
3a87656032 Add explicit list of test framework dependencies 2014-01-06 13:11:54 +10:30
Jeremy Lakeman
cc51edd39d Fix compiler warnings 2014-01-06 12:36:00 +10:30
Andrew Bettison
d4320f20da Merge branch 'naf4' into 'development'
New HTTP RESTful Rhizome API, plus tests, and lots of Rhizome
improvements and refactoring
2013-12-30 18:14:34 +10:30
Andrew Bettison
669080edc8 Add 'rhizomehttp' to 'all' tests
Disable unused 'rhizomehttp' tests
2013-12-30 18:10:39 +10:30
Andrew Bettison
ee9c96bb8c Implement HTTP POST /restful/rhizome/insert
Change HTTP request buffer pointers from (const char*) to (char*)
because some Rhizome operations can modify received data in-place, eg,
when decrypting it.
2013-12-30 18:09:56 +10:30
Andrew Bettison
42e6168998 Improve Rhizome manifest setter functions
Remove interactions between rhizome_manifest_set_filesize()
and rhizome_manifest_set_filehash(), since any inconsistency
is caught by rhizome_manifest_validate() in any case
2013-12-30 16:30:43 +10:30
Andrew Bettison
aa3497df4f Refactor rhizome_crypt_xor_block() and add debug 2013-12-30 16:30:43 +10:30
Andrew Bettison
dd5048bd43 rhizome_manifest_set_name_from_path()
Refactor rhizome_fill_manifest() to use it
2013-12-30 16:30:43 +10:30
Andrew Bettison
464f0858f1 Refactor rhizome_write_file() to use fd not FILE* 2013-12-30 16:30:43 +10:30
Andrew Bettison
f81883758a Support streaming directly into Rhizome store
The rhizome_open_write() function now accepts RHIZOME_SIZE_UNSET as the
payload size, and streams into an external blob until finished, then
copies the external blob into the FILEBLOBS table if it is small enough.

Needed so that HTTP GET /restful/rhizome/insert can stream the payload
directly into the DB even if the supplied manifest does not specify
'filesize'.
2013-12-30 16:30:43 +10:30
Andrew Bettison
7cecdf7a3a Add Rhizome db blob primitive functions
sqlite_blob_open_retry()
sqlite_blob_write_retry()
sqlite_blob_close()
2013-12-30 16:30:43 +10:30
Andrew Bettison
34188fa489 Replace config 'rhizome.external_blobs' with 'rhizome.max_blob_size' 2013-12-30 16:30:43 +10:30
Andrew Bettison
0c88f8bf89 Replace str_to_uint() with str_to_uint32()
Also str_to_int() with str_to_int32()
2013-12-30 16:30:43 +10:30
Andrew Bettison
72040517e1 New enum rhizome_payload_status
Refactor a lot of Rhizome bundle storage code to use the new "enum
rhizome_payload_status" instead of mysterious int values to represent
the outcome of the operation.
2013-12-30 16:30:35 +10:30
Andrew Bettison
b37e27f5da Improve HTTP server multipart body parsing
Every handler function can return an HTTP response status code
to terminate request parsing and start the response.
2013-12-27 19:07:00 +10:30
Andrew Bettison
9ebef81a49 Formalise "rhizome add file" exit status
Formalise add-bundle result in "enum rhizome_bundle_status"

Rewrite rhizome_manifest_finalise(), rhizome_find_duplicate() and
rhizome_add_manifest() to return enum rhizome_bundle_status

New function rhizome_manifest_check_stored() that compares a manifest
with its stored counterpart and returns enum rhizome_bundle_status

Remove redundant rhizome_manifest_check_sanity(), consolidating all
manifest validation rules in rhizome_manifest_validate(), which now
checks the 'id' field is present, and that 'sender' and 'recipient' are
both present for MeshMS

Correct manifest finalisation logic: set the 'finalised' flag in
rhizome_manifest_validate(), not in rhizome_manifest_verify() (which
sets 'selfSigned'), and consistently clear 'finalised' flag in all
attribute setter functions

Remove manifest 'ttl' field and all references thereof (leaving unused
space in Rhizome BAR)

Rename some payload functions for clarity
2013-12-21 14:37:18 +10:30
Andrew Bettison
273c5f2689 Make rhizome_manifest_pack_variables() static 2013-12-20 11:29:26 +10:30
Andrew Bettison
8a1ce7f373 Use manifest 'has_id' consistently 2013-12-20 11:29:26 +10:30
Andrew Bettison
d7b926c39c HTTP server response codes 408, 409 2013-12-20 11:29:26 +10:30
Andrew Bettison
d52ba4c871 Remove rhizome_read_manifest_file()
Replace with memcpy() followed by rhizome_manifest_parse()
for memory buffers

Replace with rhizome_read_manifest_from_file() for files
2013-12-20 11:29:17 +10:30
Andrew Bettison
135df30b1b Improve test framework: assertGrep --ignore-case 2013-12-19 19:14:52 +10:30
Andrew Bettison
21328e2888 Improve read_whole_file()
Move into os.c, declare and document in os.h
2013-12-19 19:14:52 +10:30
Andrew Bettison
39b2f3a6f5 Improve 'rhizomehttp' test descriptions 2013-12-19 11:29:28 +10:30
Andrew Bettison
b5f7a088b2 Fix rhizome_fill_manifest() 'name' semantics
Only set 'name' field if the given pathname is valid

Do not set 'name' field if no pathname supplied
2013-12-18 18:02:46 +10:30
Andrew Bettison
3b5c0d2092 More Rhizome external blob debug 2013-12-18 17:44:16 +10:30
Andrew Bettison
9b1ad664e9 Log error in "rhizome extract" if payload fails 2013-12-18 17:44:16 +10:30
Andrew Bettison
f5b757c022 Remove some unconditional debug from HTTP server 2013-12-18 17:44:16 +10:30
Andrew Bettison
250309f4d8 Fix strn_to_sid_t(), add strn_to_rhizome_bk_t()
Improve strn_to_rhizome_bid_t() and strn_to_rhizome_filehash_t() to
accept a NULL first arg -- useful for data validation
2013-12-18 17:44:16 +10:30
Jeremy Lakeman
8d80cf55f2 Fix printf formats 2013-12-16 15:19:15 +10:30
Andrew Bettison
6798e943ec Implement HTTP GET /restful/rhizome/<BID>/decrypted.bin 2013-12-16 15:09:46 +10:30
Andrew Bettison
f3c88def41 Refactor HTTP server result code handling
Rhizome dispatch functions now simply return the HTTP result code, or 1
if they have initiated the response themselves.
2013-12-16 15:09:46 +10:30
Andrew Bettison
8c9ac6c1a5 Improve test case for /restful/rhizome/<BID>/raw.bin
Include some encrypted payloads in the test
2013-12-13 17:41:26 +10:30
Andrew Bettison
b53cabaae5 Unify output manifest fields from CLI rhizome commands 2013-12-13 17:24:59 +10:30
Andrew Bettison
6361bfd757 Implement HTTP GET /restful/rhizome/<BID>/raw.bin 2013-12-13 16:36:37 +10:30
Andrew Bettison
183cb46000 Add Rhizome HTTP response headers to /restful/rhizome/<BID>.rhm 2013-12-13 14:49:55 +10:30
Andrew Bettison
98a6fc55d9 HTTP server support for extra response headers 2013-12-13 14:49:40 +10:30
Andrew Bettison
dd1e9f2ffb Improve HTTP server string reservation
So that reserved strings can be released, reclaiming buffer space for
responses and for response header strings
2013-12-12 17:49:19 +10:30
Andrew Bettison
1e96a8745d Merge branch 'development' into 'naf4' 2013-12-11 15:15:31 +10:30
Andrew Bettison
4cf97b7d41 Do not generate COPYRIGHT.txt in normal build
Only when making the "copyright" target.  Otherwise Makefile is broken
for developers without serval-tools and Python.
2013-12-11 15:10:01 +10:30
Andrew Bettison
e921404686 Merge branch 'warnings' into 'development'
Enables more GCC warnings and modifies much code to fix them

Initial work by Petter Reinholdtsen, remaining by Andrew Bettison
2013-12-11 14:39:44 +10:30
Andrew Bettison
6e99a3be47 Fix printf format warning on Android 2013-12-11 14:35:14 +10:30
Andrew Bettison
81f641b1fe Include <limits.h> for SIZE_MAX on Android 2013-12-11 14:34:34 +10:30
Andrew Bettison
54bebb1ebd Fix -Wsign-compare warnings in tfw_createfile 2013-12-11 14:00:41 +10:30
Andrew Bettison
f087e4ddee Fix -Wsign-compare warnings in fakeradio code
Replace int with unsigned or size_t for byte counts
2013-12-11 13:59:41 +10:30
Andrew Bettison
7582f24e9c Fix -Wsign-compare warnings in NaCl code
Make loop counters unsigned
2013-12-11 13:58:51 +10:30
Andrew Bettison
075f9c7c27 Use uint64_t for Rhizome manifest version
Instead of int64_t.  Fixes some -Wsign-compare warnings.

Replace sqlite_exec_int64() with sqlite_exec_uint64().

Also store rowid as uint64_t, and use 0 not -1 to indicate
unset.
2013-12-11 11:11:34 +10:30
Andrew Bettison
608a705403 Better size arithmetic in Rhizome database cleanup code
Fixes -Wsize-compare warnings
2013-12-10 17:24:14 +10:30
Andrew Bettison
8effa869a3 Used unsigned for byte count fields in Radio Link code
Fixes -Wsign-compare warnings
2013-12-10 17:23:38 +10:30