Preliminaries
Set up a bare repository on stu.cs.jmu.edu based on the instructions
in the CS 361 Submission Procedures,
using the name lab5-net.git.
Implementation requirements: Gathering and interpreting network information
Make the following edits in client.c and main.c. This
portion of the lab is focused on providing the basic functionality of the
nslookup utility. After completing this implementation, you should
compare your output with that of nslookup.
- Implementation
addr_string() to convert an
IP address into the correct format (IPv4 dotted decimal vs. IPv6 colon
hexademical). If the server parameter is NULL, return
no address information
. All returned strings must be dynamically
allocated (caller will free() them).
- Use
addr_string() as part of the implementation of
serv_string() to display more information about the passed
server. Where addr_string() only formats the address,
serv_string() also displays information about the transport and
network layer protocols.
- Implementat
get_server_list() to use DNS
to resolve a human-readable hostname. Note that the
proto string can be a name (such as http
) or a
number formatted as a string (such as 80
), but the logic
of your implementation should not need to examine that parameter
explicitly.
- Complete the designated portion of
main() to support
command-line queries of servers. If the protocol is 53 (DNS) or
67 (DHCP), use UDP instead of TCP.