Implement DNS protocol, fossa-style

This is the first step for the DNS resolver (#57) and will also be used as a base for MDNS (#51).