Commit Graph

193 Commits

Author SHA1 Message Date
Andrew Bettison
1af238a4f9 Rhizome extract commands handle missing pathnames properly 2012-05-25 11:52:49 +09:30
Jeremy Lakeman
26f3966002 Ignore node info results from incorrect sid's 2012-05-25 09:55:56 +09:30
Andrew Bettison
0ec3feaa29 Expunge setReason()
Replace with WHY() or WHYF() everywhere

Improve logMessage() to handle file/line/function printing internally

Mainly so that log messages from manifest alloc/free in rhizome_bundle.c
can make it into the Android log
2012-05-24 17:11:55 +09:30
Andrew Bettison
59e58da2f4 More fixes for varargs stuff
But still no luck on Android
2012-05-23 16:07:52 +09:30
Andrew Bettison
1af9125392 All rhizome database keys are uppercase hex
FILES.id, MANIFESTS.id, FILEMANIFESTS.fileid, FILEMANIFESTS.manifestid
Named constants for hex and binary ID sizes
2012-05-23 16:04:00 +09:30
Andrew Bettison
29502d8c81 Varargs and strbuf fixes
Add missing va_end() for all va_copy()
strbuf_sprintf() adds precautionary nul to end of string after vsnprintf()
2012-05-22 14:58:05 +09:30
gardners
740a64ed51 "servald stop" now checks monitor interface, and can kill the PID
even if there is no PID file, and the server process is stuck.
Now to find out how the process gets stuck to begin with ...
2012-05-21 20:57:31 +09:30
gardners
165ac03c7a added use of server_probe() to "servald start" command.
Tries to kill existing server if present, and will abort if
there is an existing instance.
Old pid code not cleaned out.
2012-05-21 20:54:17 +09:30
gardners
e44294ea66 implemented server_probe(int *pid) that used monitor interface
to probe server status.  Also returns PID if running (Linux only).
2012-05-21 20:45:07 +09:30
Andrew Bettison
f4293e8ab3 Add "rhizome hash file" command
Also fixed a file descriptor leak in rhizome_hash_file() -- missing fclose()
2012-05-21 14:42:53 +09:30
Daniel O'Connor
990a8f3057 Add support for srtuct ucred on BSD.
This requires building with _GNU_SOURCE to get access to struct ucred on Linux. Previously the test failed on every platform except glibc <2.8 or so.

Building with _GNU_SOURCE causes TRUE to be defined so we can't use this as a variable anymore, and MIN/MAX so don't define our own.
2012-05-21 12:22:50 +09:30
Andrew Bettison
ddd17db1c4 Make "rhizome add file" work for MeshMS 2012-05-21 00:09:14 +09:30
Andrew Bettison
e6575cb369 Introduce macro constants for Rhizome service names
Use "MeshMS1" instead of "MeshMS"... version 2 won't be far away
2012-05-20 16:07:22 +09:30
Andrew Bettison
41583c1011 Fix bug in "rhizome add file" command
Was not opening keyring file properly
2012-05-20 15:25:19 +09:30
Andrew Bettison
345b2c1c4c Fix SEGV bug using new strbuf operations 2012-05-20 13:02:41 +09:30
Andrew Bettison
4b5e179841 Start support for MeshMS manifests 2012-05-19 14:09:50 +09:30
Andrew Bettison
0f65028a0b Clean up keyring_open_with_pins() error reporting 2012-05-19 10:38:29 +09:30
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
gardners
80e013739d improved error message reporting. 2012-05-18 17:08:45 +09:30
gardners
c9a58937ca other bug fixes and cleanups for "dna lookup" 2012-05-18 12:55:56 +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
Andrew Bettison
2434d51bee Remove "rhizome add authored file" command
Now "rhizome add file" takes SID and PIN args, and if SID is empty, an
unauthored bundle (no BK field) is created

Updated dna_rhizome test cases
2012-05-17 12:01:25 +09:30
gardners
74e0d69cb9 fixed various bugs with rhizome manifest extraction. 2012-05-16 15:55:03 +09:30
gardners
d51545b87a fixed some bugs with BK handling. keyring gets loaded when
adding authored bundle so that we can lookup RS.
BK variable name case harmonised.
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
39be8a0b75 added new command line option for adding rhizome bundle with authorship
so that it includes a BK.
All good, except the BK isn't being added. Yet to find out why.
2012-05-15 22:15:13 +09:30
gardners
0eafc34970 BK encoding and decoding complete, but untested. 2012-05-15 20:04:41 +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
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
0fa40973ec Make 'start' command call setpgrp() when detaching 2012-05-10 12:46:40 +09:30
Andrew Bettison
da9fe6fdca Fix 'start' command bug when invoked via JNI
Child process was using return not exit(), which was unrolling the
JNI call stack in a sub-process and causing havoc.
2012-05-08 16:35:14 +09:30
Andrew Bettison
8dd9a70852 Fix 'stop' command
Do not fail with error if servald.pid is nonexistent/inaccessible
2012-05-08 14:53:34 +09:30
gardners
596b20b5e8 interactive servald monitor cli command implemented. 2012-05-08 14:41:21 +09:30
Andrew Bettison
391e8d7056 Fix broken stopfile logic
'start' command removes stopfile just before starting
'stop' command removes stopfile after stopping
2012-05-08 12:53:59 +09:30
Andrew Bettison
329189ec8c Fix bodgy server start/stop logic
Rename pidfile 'serval.pid' to 'servald.pid'
Rename stopfile 'doshutdown' to 'servald.stop'
Reinstate checking of stopfile on signals and in main loops
Correct delay loops in 'start' and 'stop' commands
Move some code from commandline.c to server.c
2012-05-08 12:19:52 +09:30
Andrew Bettison
6376baf8b8 Follow-up fixes to serval.pid clobber termination 2012-05-08 11:27:07 +09:30
Andrew Bettison
acc5e48f4f Terminate server process if serval.pid clobbered 2012-05-08 11:23:43 +09:30
Andrew Bettison
27f2d00d5e Minor code refactor 2012-05-07 19:14:53 +09:30
Andrew Bettison
09f8434a21 Improve "start" command
Add "start exec <exec path>" variants for background mode
Add background startup wait logic, so that pid can be reported to caller
2012-05-07 19:14:52 +09:30
gardners
171eb75d48 fixed packet size calculation bug. 2012-05-07 16:50:49 +09:30
gardners
98607360f4 attempt at fixing wrong number in peerlist display bug in "node info"
command.
2012-05-07 15:29:31 +09:30
Andrew Bettison
cbc367b1f5 Rewrite server start/status/stop commands
Now correctly probes for server process existence using kill(pid, 0)
Status command does not dump config (use "config get" instead)
Output uses JNI cli output fields
Stop command uses 5 Hz wakeup, not busy wait while server exits
2012-05-07 13:49:38 +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
eab6dafcc7 Make commandline.c error messages appear on Android log 2012-05-03 14:50:14 +09:30
Andrew Bettison
5b85520f75 Fix JNI command-line interface; return 255 instead of -1 2012-05-03 12:17:49 +09:30
gardners
f3d288b10e fixed accidental typo. 2012-05-03 11:36:44 +09:30
gardners
03bfa6e0c7 removed dna resolution poll failure error messages. 2012-05-03 11:25:27 +09:30
Andrew Bettison
7ba15ccdd7 Add "rhizome extract file" command with tests 2012-05-02 17:57:35 +09:30
Andrew Bettison
6e959fd34c More tests for "rhizome extract manifest"
Proper handling of unknown and invalid manifest IDs
2012-05-02 16:24:27 +09:30
Andrew Bettison
146eb7cdfd Add "rhizome extract manifest" command 2012-05-02 16:03:09 +09:30
gardners
6464ae8100 "dna lookup" now displays name 2012-05-01 14:42:15 +09:30
gardners
14e4af6392 DNA replies now include name. "set did" now accepts name.
Keyring now stores name. "node info resolvedid" now returns name.
2012-05-01 14:38:09 +09:30
gardners
4234cb3ed5 changed bcmp to memcmp 2012-05-01 13:41:22 +09:30
gardners
92192654d0 cli_puts()ify "dna lookup". Add duplicate suppression to dna lookup 2012-05-01 13:39:43 +09:30
gardners
44d0feb575 improved "stop" functionality to better realise when a process
is no longer running.
2012-05-01 07:05:02 +09:30
gardners
590b53975c added some more debugging for finding out why numbers wont resolve
from servald in java interface.
2012-04-30 21:06:40 +09:30
gardners
cfe5f303e7 added cleaning up of client socket when ending command line
execution so that multiple calls from java can succeed.
2012-04-30 20:07:22 +09:30
Andrew Bettison
7e7ab30808 Refactor JNI command-line interface
Does not depend on ServalDResult class - appends output fields to a supplied
list instead, and returns the integer status

Does not depend on ServalDReentranceError class - uses
java.lang.IllegalStateException instead
2012-04-30 17:45:24 +09:30
gardners
e38854d4c0 improved "stop" command to try several times. 2012-04-30 15:34:41 +09:30
gardners
808ef53d0f "node info" command can now do DNA lookups to get phone # 2012-04-30 15:12:31 +09:30
gardners
1ebe63a470 cleaned up some debug output introduced during previous bug fixes. 2012-04-30 06:25:54 +09:30
gardners
c3fe7ee8e3 "id peers" now returns something! 2012-04-30 06:16:03 +09:30
gardners
6fad530b28 fixed some bugs with node info and set sid 2012-04-27 14:17:41 +09:30
gardners
47f15bf259 converted node info to return each record as a set of strings to
make it easier to parse from Java.
2012-04-27 08:27:55 +09:30
gardners
ef6f2ef3d3 cleaned up id_self() output. 2012-04-27 07:17:50 +09:30
gardners
7f11e25922 added count to id self/list output to help debug calls from JNI
in batphone.
2012-04-27 05:58:31 +09:30
gardners
89c08fa2c3 improved diagnostics for incorrect command line invokations.
Fixed bug in servalwrap (needed to trim arg[0])
2012-04-26 16:59:55 +09:30
Andrew Bettison
18eb83ebf4 JNI-ify "keyring list" output 2012-04-26 15:54:40 +09:30
gardners
38c240be58 using cli_delim() where appropriate. more work on "id self" /
"id list".
2012-04-26 15:47:05 +09:30
gardners
88ba56b68b work towards "node info" command, and renamed stop/start etc to
drop node keyword, that in retrospect is not appropriate.
2012-04-26 07:14:01 +09:30
gardners
d56780852c added "id peers" with maximum reuse of "id self". 2012-04-26 06:06:04 +09:30
gardners
35f231dcb0 preparation for allowing MDP_GETADDRS to return either local IDs,
or SIDs of peers.
2012-04-26 05:58:16 +09:30
gardners
cf2216fecf "id self" now correctly does multi-packet lists for when we have
lots of identities.
2012-04-26 05:54:54 +09:30
gardners
44a416b969 added "id self" command to get all local SIDs (BatPhone needs this) 2012-04-26 05:48:06 +09:30
gardners
98c3b72cf4 mdp based dna lookup works now, but lacks duplicate suppression. 2012-04-25 20:33:25 +09:30
gardners
a2880ada1e closer to dna lookup working via mdp.
Bug to be fixed in sending replies.
2012-04-25 20:14:56 +09:30
gardners
4972da1b58 dna lookup via mdp nearly working. 2012-04-25 15:55:04 +09:30
gardners
f8a1ffc4c9 dna lookup command line utility mostly done. Now to make server
respond.
2012-04-25 15:24:21 +09:30
gardners
dfb8d0d482 getting ready for making dna lookup work via mdp 2012-04-25 14:35:44 +09:30
Andrew Bettison
6746fc4e36 Fix commandline.c when undefined HAVE_JNI_H 2012-04-24 18:03:52 +09:30
Andrew Bettison
f9d8536d7d JNI-ize the output of "dna rhizome list" 2012-04-24 17:50:27 +09:30
Andrew Bettison
a496919e8a First real servald JNI command-line test works! 2012-04-24 17:07:20 +09:30
gardners
03004bcfdc added vomp dtmf command line interface to inject DTMF characters
into a call.  This will be the initial codec/audio xfer app.
2012-04-24 12:06:28 +09:30
Daniel O'Connor
2188c807b2 Hook up dummy phone app to commandline.c 2012-04-23 20:58:28 +09:30
Andrew Bettison
1494172da6 Trival test of dna JNI command line entry point 2012-04-23 18:25:26 +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
551f22092f Make javac and jni.h optional in ./configure 2012-04-23 12:05:00 +09:30
gardners
76a1bec84e Added initial work towards a call status monitoring commandline
option.
2012-04-22 18:47:24 +09:30
gardners
29b8454a94 vomp pickup and hangup commandline apps in place and working. 2012-04-22 12:51:58 +09:30
gardners
f4886d0a0a added conditionality to JNI code in commandline.c 2012-04-20 17:21:03 +09:30
gardners
d843e59bd5 vomp status and vomp dial command line apps added.
now debugging dial operation.
2012-04-20 17:12:44 +09:30
Andrew Bettison
90a1317822 First cut of JNI entry point to command line 2012-04-20 17:02:29 +09:30
Andrew Bettison
2bfa0ee7d2 Tighten up command line parsing
- add optional offset and limit args to rhizome list
- validate argument values
2012-04-19 18:03:04 +09:30
Andrew Bettison
21592a44d0 Rename some command-line functions for consistency 2012-04-19 15:47:23 +09:30
gardners
899cf8fc69 general cleanups and formatting changes to mdp ping 2012-04-19 04:23:39 +09:30
gardners
71f5f9e72c Removed unnecessary code in mdp pin. 2012-04-19 04:23:38 +09:30