Commit Graph

94 Commits

Author SHA1 Message Date
Jeremy Lakeman
e158a38137 Clean up a number of memory leaks, as revealed by clang's sanitiser 2017-09-11 14:09:27 +09:30
Jeremy Lakeman
3333d2faa2 Compare MeshMS sender first, so you can talk to yourself (Fixes #124) 2017-09-06 12:38:53 +09:30
Jeremy Lakeman
bfbd2ddccd Abbreviate the bundle id in feed ack's 2017-04-19 14:46:37 +09:30
Jeremy Lakeman
1973df13b3 cli interface for reading threaded feed activity 2017-04-19 14:46:37 +09:30
Jeremy Lakeman
b7b77e81ee Add helpers for parsing ply records 2017-04-19 14:46:36 +09:30
Jeremy Lakeman
940b8c2d4b Ack incoming feeds for threading 2017-04-19 14:46:36 +09:30
Jeremy Lakeman
c05775a320 Generalise deterministic key generation 2016-11-21 11:09:27 +10:30
Andrew Bettison
ccacd19dfa Add global keyring assertions
Many functions require that the global 'keyring' pointer is set,
but there were no assertions to document this precondition.
2016-11-14 11:28:08 +10:30
Jeremy Lakeman
5b75221c91 Fix compiler warnings when building with android ndk 13b 2016-11-07 10:38:23 +10:30
Jeremy Lakeman
f4210e06d8 Make sure all restful newsince responses can be sorted by the front end 2016-10-31 10:56:10 +10:30
Jeremy Lakeman
84caa24d0f Pass identity name as meshmb manifest name 2016-10-26 13:09:35 +10:30
Jeremy Lakeman
b927af79a8 Introduce new typedef for signing keys to expose their internal structure 2016-09-27 10:28:46 +09:30
Andrew Bettison
6e65a2399f Add missing #include "str.h" 2016-09-21 18:47:49 +09:30
Jeremy Lakeman
73b151a3e4 Remove unused variable 2016-09-05 12:31:22 +09:30
Jeremy Lakeman
6a0b7a1da6 Allow for arbitrary extra manifest fields on broadcast messages 2016-08-24 16:33:39 +09:30
Jeremy Lakeman
e13b9c3c94 Reduce redundant reading of message ply's 2016-08-23 14:28:13 +09:30
Jeremy Lakeman
9697b0991b Tweak message ply internals 2016-08-16 12:22:23 +09:30
Jeremy Lakeman
b6256ea89a Add identity_t type & rename signing key api to identity. 2016-08-16 12:22:13 +09:30
Jeremy Lakeman
96b7cfa46f Silently discard conversation list from a future / unknown software version 2016-08-02 10:38:38 +09:30
Jeremy Lakeman
619c17a191 Refactor meshms cli to separate c file 2016-07-25 16:54:11 +09:30
Jeremy Lakeman
dbded493c1 Refactor meshms ply handling into separate source file 2016-07-25 16:54:11 +09:30
Jeremy Lakeman
802310c6f1 Don't append meshms timestamps if the clock is considered unreliable 2016-05-31 13:00:48 +09:30
Jeremy Lakeman
16a14269af Encrypt payloads without needing a sender
- reworked keyring identity handling to reduce memory searching
2016-05-31 12:50:32 +09:30
Jeremy Lakeman
e15e332072 Swap from included nacl to host libsodium 2016-05-09 10:32:04 +09:30
Andrew Bettison
3f8f0f6fc7 Improve Rhizome HTTP API diagnostics
Add RHIZOME_BUNDLE_STATUS_MANIFEST_TOO_BIG enum option to indicate
that the manifest exceeded 8 KiB in size.

Refactor rhizome_add_manifest() and rhizome_manifest_finalise()
to return 'struct rhizome_bundle_result' instead of 'enum
rhizome_bundle_status', so that that their detailed failure messages
can reach the HTTP API layer instead of just being logged.

Fix HTTP response status codes produced Rhizome direct HTTP requests
to be consistent with the Rhizome RESTful API.
2015-12-07 22:35:42 +10:30
Andrew Bettison
aabb1c5547 Call rhizome_bundle_result_free() in meshms.c
Otherwise there may be a memory leak.
2015-12-07 11:25:40 +10:30
Andrew Bettison
98ed0406c5 Refactor Rhizome result handling
- Introduce the new 'struct rhizome_bundle_result' that contains a
  rhizome_bundle_status enum value and an optional, nul-terminated
  string that provides an explanation of the cause of the status; add
  functions to construct, query, and free the struct

- Replace 'enum rhizome_add_result' with 'struct rhizome_bundle_result',
  removing an unnecessary level of enum interpretation

- Make rhizome_fill_manifest() return 'struct rhizome_bundle_result' and
  add logic to check that the supplied author SID is correct (previous
  behaviour was: if an incorrect author SID was supplied but the correct
  author could be found in the keyring, then the incorrect one was
  silently ignored)

- Simplify the response code in rhizome_restful.cc to take advantage of
  the new 'struct rhizome_bundle_result'; in particular, the mapping
  from 'enum rhizome_bundle_status' codes to HTTP status codes is now
  expressed in a single switch statement

- Fix some minor failures in test scripts revealed by the changes
2015-12-01 00:51:15 +10:30
Andrew Bettison
27d98a29fa Reimplement strlcpy() using strncpy_nul() 2015-11-02 10:11:41 +10:30
Andrew Bettison
52106b5026 Move DEBUGF() from "log.h" to "debug.h"
Include "debug.h" in lots of places (not all)
New macro IDEBUGF() for indirect debug flag, used in HTTP server
2015-07-13 18:24:04 +09:30
Andrew Bettison
7d9a5faa4e Move if(config.debug.xxx) tests into DEBUGF()
Original DEBUG() and DEBUGF() macros renamed to _DEBUG() and _DEBUGF()
New DEBUG() and DEBUGF() macros, first argument is flagname
New DEBUGF2(foo, bar, ...) macro does if(config.debug.foo||config.debug.bar) test
Replace almost all config.debug.xxx references to IF_DEBUG(xxx)
2015-07-13 16:00:05 +09:30
Andrew Bettison
abb2a39330 Fix MeshMS REST newsince race condition
During GET /restful/meshms/SID1/SID2/newsince/messagelist.json, if a new
message was received before the request reached the end of its message
iterator and paused, then the new message did not make it into the
output.
2015-06-29 15:39:19 +09:30
Andrew Bettison
4d5cded047 Change return type of rhizome_fill_manifest()
To help improve diagnostic feedback through APIs
2015-03-16 22:40:08 +10:30
Andrew Bettison
b7b2ad845c Refactor meshms seed string generation 2014-11-14 13:11:43 +10:30
Andrew Bettison
a4be1b0b0c Fix RESTful MeshMS newsince ACK logic
/restful/meshms/newsince/SID1/SID2/newsince/TOKEN/messagelist.json now
always lists an ACK as soon as it is received, instead of waiting for a
message to arrive as well.
2014-11-12 23:09:00 +10:30
Jeremy Lakeman
851144ea0a Refactor keyring identity iteration 2014-10-31 15:19:59 +10:30
Jeremy Lakeman
1848493468 New messages bump the conversation to the top 2014-10-27 11:08:02 +10:30
Jeremy Lakeman
2c72875508 Ensure sql lock failures are returned. 2014-09-12 15:24:23 +09:30
Jeremy Lakeman
2ec63b371a Build the array of console commands by using linkage tricks 2014-08-22 10:36:52 +09:30
Jeremy Lakeman
eaf069e1c3 Dont treat database lock errors the same as missing records 2014-07-14 15:26:50 +09:30
Jeremy Lakeman
bc87f8c7c0 Add timestamps to meshms messages and acks 2014-07-14 13:43:37 +09:30
Andrew Bettison
d16be8f42d Improve MeshMS HTTP RESTful interface
Provide "meshms_status_message" in returned JSON status content
2014-07-10 06:30:50 +09:30
Andrew Bettison
7736a4ceb1 New HTTP RESTful requests: MeshMS read message(s) 2014-06-24 12:11:58 +09:30
Jeremy Lakeman
7ff89afcf4 Reinstate rhizome database storage limit
- old / large payloads should be evicted to fit more payloads
- if there isn't enough space, new payloads will not be added
2014-06-19 11:09:09 +09:30
Andrew Bettison
21f51965c1 Overhaul Makefile and header files
Make .o files in separate subdirectories for servald and library
Factor struct __sourceloc and __WHENCE__ from "log.h" into "whence.h"
Factor sid_t etc from "serval.h" into "serval_types.h"
Factor rhizome_bid_t etc from "rhizome.h" into "rhizome_types.h"
Do not include "serval.h" in library sources
Add log_stderr.c and logMessage.c for stand-alone executables
2014-05-26 15:36:26 +09:30
Jeremy Lakeman
9e267ece21 Always set keyring to NULL after use. 2014-05-15 16:32:46 +09:30
Jeremy Lakeman
348fc5f23b Fix meshms conversations parsing when looking for a single SID 2014-02-12 15:08:24 +10:30
Andrew Bettison
5dd9ea7a6b Improve MeshMS failure handling
Introduce "enum meshms_status" to replace int -1,0,1 for return values
from MeshMS internal functions

Add test cases to check that status 2 is returned when attempting to
send a message from an identity that is not known (unlocked)
2014-02-06 18:10:00 +10:30
Andrew Bettison
f1ceffbc4e Remove unused MeshMS record type constant 2014-02-05 14:28:44 +10:30
Andrew Bettison
fd86a3d17f Implement HTTP POST /restful/meshms/<SID>/<SID>/sendmessage
Rename struct meshms_ply fields from "buffer" to "record" for
consistency with comment terminology
2014-02-05 14:28:15 +10:30
Andrew Bettison
f4249707a4 Implement HTTP GET /restful/meshms/<SID>/<SID>/newsince/<token>/messagelist.json
Two new test cases
2014-01-31 14:58:30 +10:30