Commit Graph

68 Commits

Author SHA1 Message Date
Andrew Bettison
8345d896a6 Add Route REST API (fixes #96)
Consists of a single, one-shot request, GET /restful/route/all.json, for
the time being.  A "newsince" request can be added later.

Add a Markdown tech doc that specifies the new Route REST API and update
the MDP tech doc a little.

Add the 'routerestful' test script, which uses some test utility
fuctions that have been factored out of the 'routing' test script into
the new testdefs_routing.sh.

Add the new 'allrestful' test script.
2018-03-29 15:31:03 +10:30
Andrew Bettison
98ec1c9608 Redesign the Keyring REST API (fixes #132)
The new API follows REST rules by using the proper request verbs:
POST, PUT, PATCH and DELETE, instead of just GET.

The legacy GET-only API is still supported for backward compatibility,
but not longer tested or documented.

Add a new query-single-identity operation.

Implement the lock-single-identity operation, which until now had been
documented but not yet implemented.  Whenever a single identity is
locked (released), any other unlocked identities with the same PIN are
flagged to indicate that the PIN is not "fully" unlocked, so that the
next time the PIN is entered, the slot decryption is re-tried for
non-loaded identities, and the locked identity will be unlocked again.

Update the 'keyring' and 'keyringrestful' test scripts:
- refactored to reduce curl command-line clutter in test cases
- now tests the redesigned request verbs and paths
- added a test for GET /restful/keyring/SID
- added a test for PUT /restful/keyring/SID/lock
2018-03-19 18:06:23 +10:30
Andrew Bettison
ca8e846264 Add iOS Framework Bundle build
The new ios/configure script performs a separate ../configure for each of
the following iOS targets:

    iPhoneOS        on armv7
    iPhoneOS        on arm64
    iPhoneSimulator on i386
    iPhoneSimulator on x86_64

The script then creates ios/Makefile that builds a static iOS Framework
Bundle suitable for inclusion in an Xcode iOS project.

Add the --xcode-sdk=SDK option to configure.ac, to support cross
compiling using Apple Xcode.  It prefixes all compile/link toolchain
commands with the "xcrun --sdk SDK" command, ie, CC, AS, LD, AR, RANLIB,
etc.

Re-structure headerfiles.mk to separate "public" from "private" headers,
because the Framework module only exposes the public ones.  Moves the
SQLITE3_AMALGAMATION definition from Makefile.in into headerfiles.mk.

Update INSTALL.md and add a technical document for Apple iOS.

This enables development of Serval DNA within the context of an Xcode
iOS project using the standard edit-make-test cycle: after modifying a
Serval DNA source file, "cd ios; make" will recompile the changed file
for all the target architectures and update the Framework Bundle.
Rebuilding the Xcode project will then incorporate the changes, which
can be tested immediately.
2018-03-06 15:29:29 +10:30
Andrew Bettison
a79156c4d0 Add Swift daemon API, use in 'servaldswift'
The daemon API is built as a Swift module called ServalDNA.

The new CliContext class allows easy implementation of CLI output using
Swift code.  The new CliContextFile subclass is the obvious first
implementation, equivalent to cli_stdio.c.  The 'servaldswift'
executable now uses CliContextFile to print its CLI output to standard
output.

The new delegated log output support constructs each log line in a
buffer and prints it by calling the delegate's 'print' function at
end-of-line.  The 'servaldswift' executable now provides a log output
delegate in Swift that simply prints to standard error, replacing
log_output_console.o, which is omitted from its link.
2018-03-06 15:29:17 +10:30
Andrew Bettison
3ffa4b10af Add Swift keyring client API with tests
Add a swift-client-api subdirectory containing a Swift source package
and a Makefile.in that compiles it into the "ServalClient" Swift module
using the Swift package manager.  The Swift API contains the following
classes:

- ServalKeyring provides the operations: add, remove, set, list
- AbstractId and its specialisation SubscriberId, already in near-final
  form, are data types for SID and the like
- ServalRestfulClient (internal) uses an HTTP client to access the
  Serval DNA RESTful interface

Improve the REST /keyring/set operation to only alter the DID or Name if
the corresponding query parameter is supplied.  Modify the internal
keyring_set_did() function to only assign the DID or Name if the
corresponding parameter is not a null pointer.

The configure script ensures that the Swift build target version is
10.10 or later when compiling for Mac OS-X, so that the package manager
will succeed.

Add autoconf macros for the Swift package manager.
2018-03-06 15:29:17 +10:30
Andrew Bettison
f2eb2bf9ab Add Swift 3/4 'servaldswift' executable
If the Swift 3 or Swift 4 compiler is present or passed to the configure
script in the SWIFTC variable, then the Makefile will compile a Swift
'servaldswift' executable to ensure that the module map links correctly
into a stand-alone Swift program.

Use the gold linker if supported, to avoid relocation errors on symbols
produced by Swift when linking dynamic libraries.
2018-03-06 15:29:17 +10:30
Andrew Bettison
c3cf86161f Improve validation of keyring DID and Name (fixes #131)
Correct the maximum DID length defined in "serval_types.h" from 32 to
31.  Add a definition of the maximum identity Name length and use it
instead of the bare constant 64, eg, in the MDP_DNALOOKUP request
handling code.

Introduce a dataformats.h function for validating an identity name, and
use it to validate the 'name' parameter in the CLI 'keyring set'
command.

Add 'did' and 'name' parameter validation to the GET /restful/keyring/add
and GET /restful/keyring/SID/set requests (#131).

Rename keyring_set_did() to keyring_set_did_name() and assert that DID
and Name lengths have been validated before storing in the keyring.

Update the Keyring REST API tech document.
2018-03-06 15:14:18 +10:30
Andrew Bettison
7edf1a912e Improve MDP technical documentation
The MDP technical document can now replace the Serval Developer wiki MDP
page.
2017-11-22 17:38:17 +10:30
Andrew Bettison
58573a4345 Spruce up MeshMS REST API tech doc a bit 2017-10-20 17:22:38 +10:30
Andrew Bettison
f53be7c6a6 Improve tech doc of MDP and servald config 2017-10-20 17:22:34 +10:30
Andrew Bettison
34e2e8d4bc Improve and document HTTP REST Rhizome import
The REST Rhizome import request now requires the 'id' and 'version'
query parameters to either both be supplied or neither, and fails if
they do not match the manifest that is supplied in the request body.
Added a test case for this.

Added a test case to ensure that if the 'id' and 'version' query
parameters cause a hit (already in store) then the response is sent
immediately without reading the request body.

Improve the documentation for the REST Rhizome import request.
2017-10-20 15:50:18 +10:30
Andrew Bettison
5eb19f1a16 Improve REST API technical documentation (fixes #118)
Users and contributors have had difficulty working out how to use the
more complex requests in the REST interface, particularly POST
/restful/rhizome/insert.

Improve the Markdown documentation to provide concrete examples of POST
requests and provide much more extensive description of how to use the
"multipart/form-data" Content-Type.
2017-10-20 10:03:18 +10:30
Andrew Bettison
46cfb81967 Configure and build libsodium from subtree
The libsodium source code is now embedded in the Serval DNA sourcecode
as a git subtree, so configure.ac and Makefile.in now recurse into it as
part of the Serval DNA build.

This simplifies the build instructions and eliminates all external
dependencies on libsodium development files and operating system
packages, returning Serval DNA to a self-contained component whose only
external dependencies are standard system libraries.

Remove the build-libsodium.sh script, as it is no longer needed.
2017-09-27 14:49:08 +09:30
Jeremy Lakeman
34b6ab6ec2 Update restful api docs 2017-05-30 09:27:48 +09:30
Andrew Bettison
a8e394d299 Add "keyring remove" command
Adds a CLI and RESTful API operation for "keyring remove", with simple
test cases.  Added the corresponding Java API operation.  Updated the
API documentation.

API change: for consistency with RESTful API design, the GET
/restful/keyring/add operation now returns "201 Created" not "200 OK" if
successful.
2016-11-07 13:07:49 +10:30
Andrew Bettison
192fefd7f2 Update INSTALL.md to describe built artifacts 2016-10-19 09:47:48 +10:30
Andrew Bettison
4b2060554e Rename configure.in to configure.ac 2016-10-13 16:05:58 +10:30
Andrew Bettison
0bf7c5ccea Update copyright messages in documentation 2016-09-21 18:31:31 +09:30
Andrew Bettison
7e39698234 Improve libsodium dev documentation 2016-09-21 18:15:34 +09:30
Andrew Bettison
11b091a33b Update doco for OS-X installation and development 2016-09-12 15:09:46 +09:30
Andrew Bettison
c45e92b731 Fix OS-X build with libsodium
Add a new 'build-libsodium.sh' script and instructions in
doc/Development.md.  Update the configure.in script to check for
libsodium headers and library, and print helpful messages if not
present.
2016-09-12 15:09:41 +09:30
Andrew Bettison
c3a94a7ac3 Formalise dependency on libsodium
./configure now fails if libsodium is not present.
Added libsodium to the list of dependencies in INSTALL.md.
Add a Debian apt-get command to doc/Development.md.
2016-09-05 17:04:22 +09:30
Andrew Bettison
463e27684c Split REST API documentation into several files 2016-02-22 17:41:49 +10:30
Andrew Bettison
0361b99ca7 Fix OSX bugs in test framework
Use GNU grep, sed and awk instead of BSD variants.  Developers will have
to install these using a package manager like homebrew.  Updated the
INSTALL.md and doc/Development.md tech docs with instructions.
2016-01-27 00:24:43 +10:30
Andrew Bettison
bc1203c87c Minor improvements to README 2016-01-11 18:02:26 +10:30
Andrew Bettison
e51189a1c8 Remove aclocal.m4 from version control
Henceforward, aclocal.m4 will be generated by the 'autoreconf' command.

The 'autoreconf -f -i' command may now emit a warning "Unsupported
attribute section, the test may fail" on some systems, but it will still
generate the proper aclocal.m4 and ./configure files.  To suppress this
warning, simply invoke autoreconf with '-I m4' argument:

    autoreconf -f -i -I m4

The INSTALL.md has been updated accordingly, and a new 'Notes for
Developers' technical document added, explaining the use of aclocal and
autoreconf, and documenting that these warning messages are of no
concern.
2016-01-11 18:02:26 +10:30
Andrew Bettison
bd45186a6a Document REST POST /restful/rhizome/insert
Adds definitions for Rhizome concepts such as Bundle ID, Bundle Secret,
payload, etc. and a detailed step-by-step definition of the insertion
logic.
2015-12-07 22:39:19 +10:30
Andrew Bettison
3c993f0273 Add fromhere=2 to Rhizome list output
Need a way for the client to distinguish between authenticated (certain)
and unauthenticated (likely) author SIDs in the context of a bundle list,
since the bundle list does not verify manifest signatures for performance
and battery life reasons.
2015-11-02 12:26:40 +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
Andrew Bettison
e189bcf32a Add REST API technical document
Document some Keyring, Rhizome and MeshMS requests, many are still TBC.

Also fix doc/README.md's link to Cooee.md
2015-11-02 12:26:34 +10:30
Andrew Bettison
f36aac529e Fix broken link 2015-01-07 15:56:56 +01:00
Jeremy Lakeman
e375e17faa Fix coverage test documentation to reflect changes required to support clang 2014-06-16 16:11:11 +09:30
Andrew Bettison
3d537f9645 Improve test framework: test coverage support 2014-06-06 14:47:54 +09:30
Andrew Bettison
d811978220 Document Cooee service discovery protocol 2014-05-30 17:08:22 +09:30
Andrew Bettison
be4f7ad42d Add MDP packet filter rules documentation 2014-05-23 14:51:25 +09:30
Andrew Bettison
24f3d50fd4 Add text of CC BY 4.0 license
Add LICENSE-DOCUMENTATION.md (commons deed) and CC-BY-4.0.md (legal
text)

All docs link to local commons deed instead of CC BY 4.0 web page
2014-05-21 17:37:23 +09:30
Jeremy Lakeman
c0c5412931 Add support for STOPping a connection before shutdown 2014-05-21 17:17:07 +09:30
Andrew Bettison
2681967681 Add doc/README.md 2014-05-20 14:54:24 +09:30
Andrew Bettison
1e6caa0e6c Add Tunnelling document (TCP over MSP) 2014-05-19 17:29:10 +09:30
Andrew Bettison
59b3015ae8 Add CC-BY-4.0 license text 2014-05-19 17:28:42 +09:30
Andrew Bettison
42d4ed0d43 Improve MSP documentation
Rename "Mesh Streaming Protocol" to "Mesh Stream Protocol"
2014-05-19 17:26:54 +09:30
Andrew Bettison
48ae5688bf Start MDP documentation, improve MSP documentation 2014-05-16 12:50:15 +09:30
Andrew Bettison
5463feeff7 Improve MSP API documentation 2014-05-15 16:28:06 +09:30
gardners
1dc09f513c Document MSP API 2014-04-11 11:24:50 +09:30
Andrew Bettison
938d645dbd Create skeleton MSP tech document 2014-04-07 12:12:53 +09:30
Andrew Bettison
53c1b1c04c Filesystem Heirarchy Standard (FHS) paths
If no instance directory specified, then use paths like
/etc/serval/serval.conf
/var/cache/serval
/var/log/serval
/var/run/serval
etc. for files, instead of all in a single directory.

Log all directory creation as INFO messages.

Interpretation of log.file.directory_path has changed slightly.

Updated servald configuration tech doc.
2014-03-26 15:35:43 +10:30
Andrew Bettison
b066aafe62 Fix broken link 2014-03-05 19:54:10 +10:30
Andrew Bettison
d8ba926492 Fix broken links and formatting 2014-03-05 19:51:23 +10:30
Andrew Bettison
734368608e Update README, INSTALL and OpenWRT instructions
Instructions for releasing Serval DNA for OpenWRT
2014-03-05 15:26:28 +10:30
Andrew Bettison
319031b79d OpenWRT build instructions 2014-03-03 15:21:53 +10:30