Clearly separate the functions by their types.

We have three clear separate components that we can glue together:
- Raw socket functions
- OpenSSL functions
- IMAP specific functions

Signed-off-by: Thiago Farina <tfarina@chromium.org>