Commit Graph

28 Commits

Author SHA1 Message Date
Andrew Bettison
d8f26a76ee Accept '#passphrase' for bundle secret arguments
As well as a hex string.  Applies to CLI and also REST API.
Maximum pass phrase length is 80 ASCII chars.
2014-11-14 13:11:44 +10:30
Jeremy Lakeman
23f2401d46 Sort commands when displaying usage 2014-08-25 13:35:27 +09:30
Jeremy Lakeman
2ec63b371a Build the array of console commands by using linkage tricks 2014-08-22 10:36:52 +09:30
Andrew Bettison
d436705e64 Fix conflict on UNUSED() macro from OpenJDK 7
The OpenJDK 7 recently introduced the UNUSED() macro in their jni_md.h
header file, which is included from <jni.h>.  This causes a
compile-error if "constants.h", which defines our own UNUSED() macro, is
included as well as <jni.h>.

The OpenJDK UNUSED() macro is unsuitable for our own use, because it
prefixes the unused identifier with "UNUSED_" whereas we depend on the
parameter name remaining unchanged.

I have reported this as a Request for Enhancement with Oracle Java,
asking them to remove the UNUSED() macro, since it is not used by any
JNI or Java extension header files.  Review ID: JI-9013689.

In the meantime, constants.h now undefines UNUSED before defining it, so
including <jni.h> before "constants.h" will avoid a compile error.
2014-07-23 11:55:55 +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
Andrew Bettison
4af6cf9d6a Fix -Wsign-compare warnings: use size_t or unsigned for byte counts 2013-12-10 16:52:53 +10:30
Andrew Bettison
5d741361ea Fix -Wsign-compare warnings: make loop counters unsigned 2013-12-10 16:21:23 +10:30
Andrew Bettison
9b64bb87e0 Uniform copyright notices
Added some missing copyright/license block comments
2013-12-04 17:15:36 +10:30
Andrew Bettison
42ab9aec4c Merge branch 'development' into 'naf4'
Remove two redundant calls to rhizome_retrieve_manifest() in meshms.c,
revealed by an assert() in the stricter manifest parsing code

Fix header files included by socket.h
2013-12-02 17:17:47 +10:30
Jeremy Lakeman
99d5d9fa1f Refactor dataformats into separate header 2013-11-27 13:11:42 +10:30
Andrew Bettison
562e011847 Consolidate Rhizome string parsing functions
Remove unused rhizome_str[n]_is_...() functions in favour of
str[n]_to_rhizome_..._t() functions

Ensure that all str_to_..._t() functions accept a NULL 'dst' pointer
so they can be used easily to validate strings
2013-11-21 16:05:18 +10:30
Jeremy Lakeman
53f3920b90 Move cli global state into a structure and pass it around 2013-07-03 16:51:27 +09:30
Andrew Bettison
1f10f05302 Add "keyring dump" command 2013-04-30 17:29:06 +09:30
Andrew Bettison
121ae2d609 Improve timeout control in routing tests 2013-04-22 16:01:38 +09:30
Andrew Bettison
81af4460f3 Fix broken "ping" command arg parsing 2013-04-12 17:18:25 +09:30
Andrew Bettison
5bbdef5587 Improve command-line parsing (issue #59)
Emit HINT log message about using "help" command

Support alternatives syntax "word|word|..." in CLI schema

Better return values from cli_parse()
2013-04-09 17:23:20 +09:30
Andrew Bettison
a88234ce9d Add optional filter args to 'help' command 2013-03-25 12:05:26 +10:30
gardners
2252fdcaa7 created tool for automatically finding IN()s without matching
OUT()s or where return() is used instead of RETURN().
Added OUT() to end of all functions using IN() that lacked it to
make it easier to statically analyse this invariant.
Fixed several return instead of RETURNs detected through use of
this tool. #49
2013-02-20 16:18:56 +10:30
Andrew Bettison
ce788eaeec Improve command-line parser: "\word" forces label
This allows the same function to be used with different commands.
Recent improvements to the parser stopped adding labels for bare words
"word" in the CLI schema, to reduce the chance of label conflicts, eg {
"get", "file", "<file>" }.  Now a backslash-prepended word in the schema
"\word" will cause the matched argument to be labelled "word", just like
"[word]" does except "\word" is not optional.
2013-02-18 17:13:30 +10:30
Andrew Bettison
682d1ecfb3 Fix bug in cli_uint() 2013-02-15 19:33:44 +10:30
Andrew Bettison
2d4133315d Improve cli_arg() diagnostic log messages 2013-02-14 16:00:47 +10:30
Andrew Bettison
e86a129d49 Refactor: rename some cli.h structs
Now all symbols defined in cli.h start with or contain "cli_"
2013-02-13 17:43:24 +10:30
Andrew Bettison
7f52ac0ae3 Improve command-line parser
Support prefix<any>, prefix=<any>, prefix <any>, [prefix<any>], [prefix=<any>]
and [prefix <any>] argument syntax forms.

Support [arg]... optional repeated argument syntax.
2013-02-13 15:55:00 +10:30
Andrew Bettison
fcb6600cd6 Rewrite command-line parser
Now supports optional args followed by non-optional.
2013-02-12 18:00:37 +10:30
Jeremy Lakeman
3a93fee8a5 New JNI interface to better support cursor result sets 2013-01-23 14:43:50 +10:30
Jeremy Lakeman
e26522bdc6 Minor improvements to command line time measurements 2013-01-03 14:16:33 +10:30
Andrew Bettison
71ed78e058 Make all 'config' tests pass
Change a test case: configuration options are now case sensitive.

Fix config file load and parse logic in conf.c, always copy 'debug' flags
from config.debug.

The config schema 'interfaces' option is no longer MANDATORY.

Introduce new CLIFLAG_PERMISSIVE_CONFIG to supress bad-config ERROR messages
from the 'config set' and 'config get' commands.

Refactor cli_execute() into cli_parse() and cli_invoke().  Use *const* struct
command_line_option everywhere.
2012-12-04 16:52:49 +10:30
Jeremy Lakeman
ac3864ff20 Reuse command line parsing framework with monitor interface 2012-09-25 13:31:34 +09:30