Rework DNS resolution

As announced I took on the task to rework the DNS resolution and to make it threaded in background.
Comments are welcome. As soon as  everybody is fine with it I'll rebase the commits before merging.
>> @@ -22,6 +22,7 @@
>>  #include <ec.h>
>>  #include <ec_resolv.h>
>>  #include <ec_hash.h>
>> +#include <ec_threads.h>
>>  
>>  #ifndef OS_WINDOWS
>>     #include <netdb.h>
> 
> @gvanem could you check if netdb.h is also available on Windows.

It's not.