Commit Graph

99 Commits

Author SHA1 Message Date
Andrew Bettison
c8bf8a7733 Refactor JNI out of CLI and server main loop
The CLI and server main loop now have no conditional JNI code.  All JNI
code has been moved into separate source files, which #include the new
"jni_common.h" instead of <jni.h>.  The "cli.h" header no longer
includes <jni.h>, so the rest of the Serval source code is now
unaffected by JNI definitions.

The 'cf_limbo' global variable is now thread-local, so that each thread
has its own independent copy of the loaded configuration.  The JNI
server entry point now calls cf_init() once.  The new 'cf_initialised'
flag prevents clobbering the config state by redundant calls to
cf_init().

The CLI "stop" command now sends SIGHUP to the specific thread in which
the server is running.  This is achieved by writing the PID and TID
(Linux Thread ID) into the pidfile, separated by a space, on systems
that support the Linux gettid() and tgkill() system calls.  The server's
signal handler has been overhauled, and its logging improved.
2016-10-13 16:23:18 +10:30
Jeremy Lakeman
30b2c1ea3f Add helper class for formatting multipart mime 2016-10-10 15:55:27 +10:30
Jeremy Lakeman
b6256ea89a Add identity_t type & rename signing key api to identity. 2016-08-16 12:22:13 +09:30
Jeremy Lakeman
8ee7245881 Add Subscriber constructor 2016-08-08 15:24:01 +09:30
Jeremy Lakeman
30167ce4ed Add meshms newsince support for starting with an empty conversation 2016-08-02 13:29:31 +09:30
Jeremy Lakeman
c3ca00fe56 Add signing key (not populated yet) to meshms java api 2016-08-02 10:23:53 +09:30
Jeremy Lakeman
2bbccf728f Generate a hashcode to detect when the number of unread messages has changed 2016-08-02 10:23:53 +09:30
Jeremy Lakeman
c9c2a65a0a Return unique id for each message 2016-08-01 11:41:09 +09:30
Jeremy Lakeman
9e1b996232 Allow json readers to be closed from another thread 2016-08-01 11:41:09 +09:30
Jeremy Lakeman
3b7e8abb99 Support compiling with Java version 5 2016-07-25 16:59:01 +09:30
Jeremy Lakeman
baa50aaadb Get byte values from abstract id 2016-07-25 16:54:11 +09:30
Jeremy Lakeman
51947dc6cb Allow for bundles with no name in java api 2016-07-25 16:54:11 +09:30
Jeremy Lakeman
a854105598 Support rhizome newsince request on an empty store 2016-07-25 16:54:11 +09:30
Jeremy Lakeman
df6688c496 Add signing key to restful keyring API 2016-07-25 16:54:11 +09:30
Jeremy Lakeman
a71c7ce698 Add signing key to routing messages 2016-07-25 15:50:52 +09:30
Jeremy Lakeman
82ad628c50 Add test api to return dummy identities 2016-07-25 15:42:09 +09:30
Jeremy Lakeman
9f4f56b663 Add Java api to add identity with name and number 2016-06-07 12:30:42 +09:30
Jeremy Lakeman
7e497d01d6 Allow java nio channels to throw IOException 2016-06-07 11:31:04 +09:30
Jeremy Lakeman
6f388cec63 Add java classes for receiving routing table updates 2016-05-11 14:18:31 +09:30
Jeremy Lakeman
5636edfe20 Append manifest into zip file comment 2016-03-30 16:25:43 +10:30
Jeremy Lakeman
2da3f12cfa Expose more rhizome add command line arguments to the Java API 2016-02-15 15:34:29 +10:30
Jeremy Lakeman
54b845f7e3 Split java test classes into a separate folder 2016-01-19 10:41:52 +10:30
Jeremy Lakeman
b5c62a19d5 Add Java API for setting the instance path 2016-01-18 13:22:36 +10:30
Jeremy Lakeman
10ac5733a1 Revert some recent tweaks that were causing test failures 2016-01-11 16:23:32 +10:30
Jeremy Lakeman
84d133438a Clean up jni server test 2015-12-14 11:22:02 +10:30
Andrew Bettison
419364b5a9 Improve REST HTTP response status codes
List all the HTTP status codes in the REST API tech doc.

Only use 403 Forbidden for requests originating from a disallowed
origin (ie, not localhost).

- Return 400 for missing, unknown, duplicate and out-of-order form
  parts in POST requests.
- Return 415 Unsupported Media Type for unsupported form part
  Content-Disposition and Content-Type (including unsupported
  charset).
- Return 414 Request-URI Too Long for any buffer exhaustion while
  parsing request.
- Return 419 Authentication Timeout for missing crypto secret.
2015-11-02 12:26:40 +10:30
Jeremy Lakeman
41d416977f Deprecate java command line api to keyring commands 2015-09-28 12:03:39 +09:30
Andrew Bettison
6123503c15 Improve Rhizome HTTP status codes
Also improve some reason phrases and test them
2015-09-21 18:43:24 +09:30
Andrew Bettison
7635e6b71b Add Keyring Java API (incomplete) with tests
keyringListIdentities()
keyringSetDidName()
2015-08-31 19:16:30 +09:30
Jeremy Lakeman
298849b25b Add buffer space for MDP MTU & headers for MDP_INTERFACE 2015-07-20 16:48:17 +09:30
Andrew Bettison
8ac156376d Fix MeshMS Java API when MeshMS disabled
If the MeshMS REST API is disabled, then the JSON response omits the
MeshMS status code, so the Java client API now handles this case.
2015-06-29 15:39:19 +09:30
Jeremy Lakeman
4891348684 Ensure unicode strings are correctly handled 2015-06-29 15:12:05 +09:30
Jeremy Lakeman
9c5cac6565 Add missing file 2015-05-25 16:44:51 +09:30
Jeremy Lakeman
51ed6162dd Add support for running and stopping servald from a JVM thread
fdpoll will now run a callback when about to sleep / woke up.
A new Java interface to indicate server started / sleeping / waking up.
An android implementation may allow the CPU to sleep.
If there's a java exception the server will try to shutdown.
Calling servald stop is currently undefined.
2015-05-25 11:46:37 +09:30
Andrew Bettison
30f4a398ea Merge RESTful Rhizome journal append into development
Support for appending to Rhizome journals using the RESTful API
2015-04-13 16:59:06 +09:30
Andrew Bettison
16355df04b Fix failing 'rhizomejava' test
Handle missing payload-status headers in Java test client
2015-03-23 23:26:09 +10:30
Jeremy Lakeman
b048e8874f Reschedule alarm when tick_ms config changed 2015-03-23 13:35:22 +10:30
Jeremy Lakeman
a9b9f51a9f Add support for mdp clients to provide a link layer packet transport 2015-03-02 15:44:34 +10:30
Jeremy Lakeman
3ae0e95e0b Treat null strings as empty 2015-03-02 15:44:34 +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
8667060ae0 Add Java API rebind for mdp sockets 2014-09-16 14:41:59 +09:30
Jeremy Lakeman
68bd515241 Content type might be null if the connection is terminated 2014-09-16 11:23:31 +09:30
Jeremy Lakeman
7474e8afea Fix mdp support and Java API for binding to all keys in the keyring 2014-09-16 11:22:26 +09:30
Jeremy Lakeman
ff6b15748d Add keyring list command that also outputs tags 2014-09-15 15:59:01 +09:30
Jeremy Lakeman
12c02255a1 Allow Java mdp protocols to specify the port to listen on 2014-09-15 14:39:26 +09:30
Jeremy Lakeman
5a38d2eb0c Add message timestamp to Java API 2014-07-21 16:13:17 +09:30
Jeremy Lakeman
6c08c8d4a4 Fix cast from Object to primitive types 2014-07-18 14:21:34 +09:30
Andrew Bettison
89623015fc MeshMS Java API: list messages new since token 2014-07-14 06:06:21 +09:30
Andrew Bettison
4c6612a61e Rhizome Java API: list bundles new since token 2014-07-12 22:49:00 +09:30
Andrew Bettison
606f087dd5 Merge latest Rhizome Java API into development 2014-07-11 12:29:24 +09:30