diff --git a/Protocols/dns.md b/Protocols/dns.md new file mode 100644 index 0000000..c134be4 --- /dev/null +++ b/Protocols/dns.md @@ -0,0 +1,41 @@ +# DNS + +## Quick Information + +| Information | | +| ----------- | -------------------------------------------------------------- | +| Version | 1.0.0 | +| Type | Protocol | + +## Technical Details + +DNS defines a method of looking up hostnames in the context of protocols. + +Any computer can broadcast a `lookup` for a hostname/protocol pair and will receive a `lookup response` from computers who identify themselves with the corresponding hostname/protocol pair. + +Because it's not just hostnames but hostname/protocol pairs, there can be several computers using the same hostname for serving different protocols. + +A computer can identify himself with every hostname/protocol pair he wants and with as many hostname/protocol pairs as he wants, as long as there are no duplicated hostname/protocol pairs in the world. The computer HAS TO lookup a hostname/protocol pair before identifying with it, if it is taken, the computer is NOT ALLOWED to identify with it. + +Packets are composed of 3 strings: +* the package type +* the hostname +* the protocol + +These strings are combined in a table: + +``` + { + sType = "" + sHostname = "" + sProtocol = "" + } +``` + +### Looking up a hostname/protocol pair + +* The uplooking computer broadcasts a package of type `lookup`, where the hostname and protocol string are the hostname/protocol pair to look up. +* If a computer identifies himself with that hostname/protocol pair, it responds directly to the uplooking computer with a package of type `lookup response`, where the hostname and protocol strings are the hostname/protocol pair, the responding computer identifies himself with. + +## Aviable APIs +* [Rednet API](http://www.computercraft.info/wiki/Rednet_(API)) from CC 1.6 onward