fix -Wconversion warnings for rstream

I'm not sure whether to go for signed or unsigned types for the offsets, but
without a doubt size_t is a better alternative than uint32_t. Added casts
after checking bounds before and after calling external libraries (in this
case libuv).
Remove dead code in clint.py
Allow USERNAME to be specified on the command line.

There are some systems that have usernames of the form DOMAIN\username,
which causes an invalid escape character to be inserted.  I was going to
add some escaping, but decided it would be best to just outright set the
value, since I don't want the DOMAIN portion in there anyways.
Remove proto as an include directory.

The proto directory was removed in 0ef90c13b72b74928bfb3c183c7a5bd7240b51ad.
Remove sizeof(int) < 4 related code
Include khash.h macro library

Included khash.h with `calloc`, `malloc` and `realloc` references replaced by
our own x-* versions.

While the khash.h library already provides an indirection layer to override the
allocation functions, they have been changed directly in the header so the
library can be used without the override boilerplate.
Add teardown function for the event.c module

Also move the `job_teardown` call from os_unix.c to the event module
Fix update of pending_reqs in `write_cb`
Refactor API types

Use specialized String/Array types that map more easily to msgpack
Add channel module

- Add channel module that exposes the API over arbitrary streams
- Add `xmemdup` for duplicating memory chunks
- Make job exit callback optional
Add server module for accepting API connections