Complete implementation of CFEngine protocol over TLS

Client now correctly establishes a TLS session with server. During the
handshake they exchange both-ways in-memory certificates, self-signed
with their private key, the same key used in the previous protocol SAUTH
command. So the trust model has not changed, i.e. if the client is
bootstrapped to that server, the public key each peer is stored in the
other peer's ppkeys directory, and will be checked if it matches to the
one sent via the TLS handshake.

Various refactoring took place:

* Separated tls functions in different files depending on their usage:
  client, server, generic.

* Union in conn_info is removed since we always need the socket file
  descriptor.

* Struct fields no longer needed were thrown away.

* SSL context and other structures are initialised only once to avoid
  avoid allocating on every connection.

* Compatibility of server with old clients implemented and tested.

* CAUTH, SAUTH were deprecated from the new protocol. All other S*
  commands (SGET, SOPENDIR, SSYNCH, SMD5, SVAR, SCONTEXT, SQUERY were
  removed as well from the new server protocol loop, and client always
  uses the non-encrypted versions (which are always encrypted due to the
  TLS session encapsulating them).

* Deprecated very old protocol commands AUTH and CLASSES.

* Added a line oriented pre-session dialog to exchange VERSION and
  IDENTITY.

* Changed the testall script to run either from OBJDIR or
  OBJDIR/tests/acceptance

* Added two file transfer digest verify acceptance tests, one for
  encrypt=true and one for encrypt=false.

* Removed STARTTLS command: The server can now distinguish old from new
  protocol by peeking into the TCP stream using recv(MSG_PEEK).

* Renamed policy_hub for non-bootstrapped client from 'undefined' to
  'policy_hub_undefined' so that user gets a clue when this does not
  resolve...

* Removed shortcut for connections to localhost, it was error-prone
  since connections are not only used for file transfers but also for
  query reporting etc. Check for localhost should be done on a higher
  level (it is already done for file transfers in
  ScheduleCopyOperation().

* Simplified TLSSend, TLSRecv by removing code for non-blocking
  sockets. Code was audited, couldn't find any use of non-blocking
  sockets. This was done primarily to sanitize error messages, since
  retrying is useless in a blocking connection and error stack was being
  messed up. @cduclos if we need non-blocking functionality in the
  future we can introduce it in separate functions.

* configure.ac: -lssl requires -lcrypto and -lcrypto requires -ldl.

* Catch error when searching address in lastseen.

* Naming conventions and code style were changed to match CFEngine's.

* Lots of logging changes.
Fix remaining binary compatibility issues in enterprise plugin.
Add forgotten include (error on MinGW). Fix a wrong typecast.
Merge pull request #869 from jimis/master

Add forgotten include (error on MinGW). Fix a wrong typecast.
Avahi test needs new dependencies.
Merge pull request #870 from jimis/master

Avahi test needs new dependencies.
new sys variables: inputdir, masterdir, libdir, bindir, failsafe, update, local_libdir
basic replace_patterns acceptance tests
replace_patterns match.1/match.0 acceptance tests
Merge pull request #871 from tzz/tzz/feature-sys-variables2

new sys variables: inputdir, masterdir, libdir, bindir, failsafe, update, local_libdir
Merge pull request #867 from kacfengine/mac_compile_fix

Fix compilation on Mac.
Close down acceptable ciphers in server.
Added forgotten Copyright - License preamble.
fix sys.libdir to include inputs
fix sys.update and sys.failsafe to include inputs
Add acceptance tests for new sys variables
Added "allowciphers" option in body server control.
Rename sys.update and sys.failsafe: add _policy_path
Merge pull request #856 from tzz/tzz/zendesk-1083-replace-patterns-acceptance-test

basic replace_patterns and match.1/match.0 acceptance tests
Remove global PROMISETIME, use GenericAgentConfig::policy_last_read_attempt