Added event loop for file descriptors and tasks

This patch adds an event loop that is based on file-descriptor
I/O, where users add file descriptors to the event loop. The loop
monitors file descriptors using the epoll system-call interface.
When a file descriptor becomes ready, the event loop invokes a
user-supplied call-back function for handling the event.

The event-loop's first user is the task dispatcher. A task is a
pair of function and data that runs as part of the event loop
(i.e. in the same thread). The task dispatcher creates tasks and
sends them to the event loop in a thread-safe manner, using an
I/O pipe.
Added Bluetooth protocol PDU
Added PDU buffers

A PDU buffer is an internal data structure for holding PDUs during
read or write operation. It's not guaranteed that a complete PDU
cane be read or written at once, so the PDU gets stored in a PDU
buffer until it has been transfered completely.
Add service callbacks

There are 3 callbacks for each service, |register|, |unregister| and
|service_handler|. The former two are called by the core service to
register and unregister a service on demand. The latter function is
returned by |register| and handles a command PDU for the service.
Added Core service

The core service allows to register and unregisters Bluetooth
services, with each service providing a Blueooth profile.
Add I/O for Core service

This commit adds I/O handlers for Core service PUDs. The core
service is special as it is always available and doesn't need
to be registered explicitly.
Added CORE protocol and I/O
Added Bluetooth Core API

The Core interface wraps calls to bluedroid and adds some additional
checks for consistency.
Added Bluetooth Core I/O

The I/O code for the Bluetooth Core interface translates request
PDUs to Bluetooth calls, and Bluetooth results to reply PDUs.
Added support for the socket-profile interface
Added socket protocol I/O