Fix a missing space in a log message
store: Reindent the callback prototypes

The callback prototypes in the rest of the code start a new line for
the typedef name so this changes ntb-store.h to match.
crypto: Fix the unitialised cookie->create_key.key

If the cookie was cancelled before the key was created then this would
be an invalid pointer.
Fix resetting to the defaults when loading the keys

After loading a key it needs to reset the data back to the defaults so
that any undefined fields in subsequent keys don't copy the values
from previous keys.
Minor indentation fix in ntb-store.c
store: Move the common code to rename a temporary file into a function

The code to rename a file ending in .tmp was repeated in a few places.
This moves to a common helper function.
crypto: Fix union reference for deleting a create_pubkey task
Add a struct to represent a decoded address

There is now a struct ntb_address which contains an address version,
stream and ripe. The address decode and encode functions now use this
instead of taking those properties as arguments. Anywhere that was
storing these properties separately now combines them into the new
struct.
Add ntb_address_from_network_keys

This creates an address from the keys, stream and version as sent in a
message (ie, without the 0x04 prefix). Mainly this is a convenience to
calculate the ripe.
Add ntb_address_equal

This just compares two addresses
main-context: Use an idle handler for fds that don't support epoll

If a file descriptor is added which doesn't support epoll then it will
now install an idle handler which will report that the fd is always
ready for reading and writing. This is the same behaviour that you
would get with regular poll. This is intended to simplify supporting
regular files sent via the IPC mechanism as they don't support the
poll interface.
Add the framework for an IPC mechanism

Notbit now listens on an abstract Unix domain socket for external
commands. It uses a custom protocol which is described in
doc/ipc-protocol.txt. There are currently no commands but eventually
it will be used to pass emails into the daemon from an external
process.
store: Add a function to iterate all of the stored pubkey blobs

The keyring will eventually need to iterate all of the stored pubkey
objects in order to maintain a hash table indexed by the ripe or tag.
This will be used to determine if a pubkey that we need is in the
network. The function is similar to ntb_store_for_each_blob except
that it loads the entire contents of the blob instead of just the
meta-data.
proto: Add a function to extract fields from a pubkey message

This reinstates the code removed from ntb_connection in
d5f263ce6a20ebdfa to parse a pubkey message but places it in ntb_proto
instead of trying to do it as part of the connection.
keyring: Maintain a hash table of pubkey objects indexed by ripe/tag

When the keyring sends a message to a new key it will need to check
key is already in the network before requesting it. In order to do
this the keyring now keeps track of a hash table of pubkey objects
indexed by either the ripe or the tag depending on the pubkey version.
Only the hash of the object is stored so that the keyring will have to
ask the network or the store for the actual keys when it needs them.
Add code for parsing an email message

This parses the an RFC822-format message in chunks and provides
callbacks to report the important information such as the to and from
addresses, the subject and the contents. The content type and transfer
encoding are checked to ensure that the content format is compatible
with UTF-8, ie it is either UTF-8 or ASCII and the encoding is either
7bit or 8bit. It doesn't yet try to convert the format.
Store other people's public keys in the keyring too

The keyring can now contain ntb_keys without a private part too. There
is a function called ntb_key_has_private to detect these keys. These
are also stored in the store but the public keys are stored instead of
the private keys and some of the fields aren't stored.
crypto: Add a function to create an ntb_key from public keys

This just constructs an ntb_key given the public keys from a command.
It's probably a bit overkill to do this in a separate thread but the
thread safety of OpenSSL isn't clear so this is probably safer.
keyring: Add public keys from msgs to the keyring

When a msg is successfully decoded the public key of the sender is now
automatically added to the keyring.
crypto: Add a function to generate acknowledgement data

This generates 32 bytes of random data for use as the acknowledgement
message. This needs to be in the same threads as the rest of the
crypto work because OpenSSL is not thread safe.