Expose public error-code interface

Publicly define the error codes returned from the various public API
functions. The error codes are defined in the amqp_status_enum and are
all negative in value to work with functions that return positive
values.

OS and SSL specific codes are no longer munged into the error code, as
it is unlikely for that information to be useful to library users.
Report out of buf space error in amqp_table_encode

amqp_encode_8 and amqp_encode_bytes return 1 on success, 0 otherwise.
Correct the checking of the return value of these functions to match the
style used in amqp_table.c

Report AMQP_STATUS_INVALID_PARAMETER in the event an invalid field kind
is input (instead of abort()).

Report AMQP_STATUS_TABLE_TOO_BIG if the table is too large to be encoded
in the buffer provided.
Don't abort() on invalid param in amqp_send_frame()

Return AMQP_STATUS_INVALID_PARAMETER instead of calling abort() on an
invalid frame type.
Don't abort() in amqp_simple_wait_frame()

amqp_simple_wait_method() should not call abort(), instead close the
underlying socket, then return AMQP_STATUS_WRONG_METHOD. This is still
rather heavy-handed for a public API, however, its a lot better than
killing the entire application
Return error on socket lib init failure

Winsock2 requires calling a function to initialize the socket library.
This call can fail. Return an error code to the user if it does.
Correctly handle 0 ret val from SSL_read/write

A 0 return value from SSL_read/SSL_write means the (SSL) connection has
been terminated.
Add more specific SSL connection error codes

Add the following error codes:
- hostname verify failure: e.g., provided hostname doesn't match peer
  certificate
- peer verification failed
- connection handshake failed
Improve error handling in socket functions
Move amqp_os_socket* funcs to amqp_socket.h/c

Doing this for code clarity, as its easier to see what the issues are
when you have all implementations in one file
Change amqp_error_string() to ret static strings

This is an API/ABI break.
Preserve API/ABI of amqp_error_string()

Preserve API/ABI of amqp_error_string() by having it return a string
allocated on the heap. Deprecate this function in favor of
amqp_error_string2() which returns a statically allocated string
Correct usage of amqp_error_string in test code
ABI compat fix for +-ve vals in amqp_error_string

To preserve ABI, map positive error codes into the negative error-code
domain in the amqp_error_string() function. This will preserve compat
with older code-bases that do amqp_error_string(-returnval)

Note: the function is marked as deprecated so the user will still get a
warning when compiling code that uses this function.
Set state->socket to NULL after amqp_socket_close

amqp_socket_close has the side-effect of destroying the socket object.
Use after this will cause undefined behavior
Fix latent bugs with return error-codes
Add amqp_get_monotonic_timestamp() function
Add amqp_simple_wait_frame_noblock() function

Add non-blocking variant of amqp_simple_wait_frame() to assist clients
in writing programs that want non-blocking behavior when consuming
messages from the broker.
FIX: redecl of int i in amqp_tcp_socket_writev
FIX: incorrect bit-shift in amqp_error_string2

CID 1035140
FIX: handle amqp_get_sockfd failure in wait_frame

CID 1035138
CID 1035137