Sub-Problems

Sub-Problems

  1. parse and check well-formedness of zone file

One needs to define a datatype (ZONE_FILE) to encode a (potentially ill-formed) zone file.  Thus to solve sub-problem 1, one must specify and implement a function of the general form

parse: FILE -> ZONE_FILE
check: ZONE_FILE -> BOOLEAN
  1. open socket

Open a socket on a port of your choice (port 53 is the standard DNS port, but opening such a socket usually requires root privileges).  Thus, to solve this sub-problem, one must specify and implement a function of the general form

open: unit -> SOCKET
  1. receive query

Received UDP packets on said socket and decompose into a query.

receive: SOCKET -> PRE_QUERY
  1. parse query

parse: PRE_QUERY -> QUERY
  1. lookup query

lookup: ZONE_FILE -> QUERY -> RESPONSE
  1. construct response

assemble: RESPONSE -> PACKET
  1. send response

send: SOCKET -> PACKET -> unit

Leave a Comment