Add a method to check for available bytes on a socket

The available bytes function shouldn't normally be required (and
if it is, the code design is probably bad and should be rethought) but
is introduced as a stop-gap until we can redesign the BTA code that
expects a priori knowledge of the number of bytes that can be read from
the socket.

This change also relaxes the requirement that on socket_register that
at least one of read_cb or write_cb must be specified.
2 files changed