Introduce find_charn()

It finds the first occurence of a character in a string up to a nul
character or a given number of characters, whichever comes first.

Also introduce a generic preprocessor template to avoid too much code
duplication with the find_* functions.

Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au>
Introduce binary protocol tests

This is just a stub testing find_sync.

refs: #792

Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au>
Find sync only once

* lib/shared/binary.c:bin_find_sync() now uses
  lib/shared/marshal.c:find_sync() under the hood.
* find_sync() takes this chance to change its prototype from
  manipulating char* to uint32_t, and is a bit more const-correct.
* bin_find_sync is no longer static, so it can be more widely used.
* add test for bin_find_sync to make sure it works.
* improve formatting and doxumentation for these functions.

refs: #372

Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au>
Make CHECK test verbosity configurable, and verbose by default

Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au>
TAP output for system tests

Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au>
oml2-server now understand Protocol V4

Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au>
Test Protocol V4 understanding

Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au>
msggen: test v3 and v4, output TAP

* Adapt msggen.rb so it tests several versions of the protocol (knowing
  that msgloop only outputs its interpretation in the latest)
* Fix msggen.rb and msgloop so they output test results following the
  TAP protocol [0,1]

[0] http://szabgab.com/tap--test-anything-protocol.html
[1] https://www.gnu.org/software/automake/manual/automake.html#Using-the-TAP-test-protocol

Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au>
Bump protocol version to 4

Update doc:
* Document Protocol V4 in user doc
* Add Protocol V4 example in manpage
* Update user manual to Protocol V4

This is not sufficient to implement real protocol V4: header flexibility
is still missing.

refs: #791
Improved testing of text mode

Test more things.

Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au>
Test for proper resync after erroneous or incomplete data.

Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au>
Resync after erroneous message in binary mode

Rather than disconnecting the client on invalid messages (bad schema, or
garbage), discard the current message with a warning and resync to the
next 0xAAAA, hoping for the best.

An extension would be to count the number of subsequent failures, or the
amount of invalid data, and eventually disconnect the client if it sends
too much garbage.

refs: #792
Doxumentation woes

Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au>
Nicer mbuf-dumping macro in server test

Use to_octets (:

Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au>
Add text writer support files.

Conflicts:
	test/lib/Makefile.am
	test/lib/check_liboml2_suites.h
Change base64_encode_blob signature to return encoded size.

Conflicts:
	lib/client/text_writer.c
Update test for string_utils.
Add debugging code.
Finally sending blobs correctly.
Fixing up unit test.