The assignment:
Develop and submit an original implementation of a MAC address lookup program. The
user will be presented with a screen and will be prompted to enter a MAC address (with
spaces between each of the 6 hexadecimal numbers) to be searched for. After data entry,
the program will open a MAC database file ([login to view URL]), and search for the MAC address.
If the address is found, the program will respond with a message indicating that the MAC
is white-listed and that the device can be connected to the network.
If the MAC address is not in the file, the program must display a message indicating that
an unauthorized connection was refused.
If the [login to view URL] file is missing, an appropriate error is displayed.
• This assignment must be written in C and must compile and run on BA computer
lab PCs using Quincy 2005 v1.3. Build options must include Strict ANSI/ISO
compliance, C99 support and must compile with no warnings when the All
Warnings option is selected.
• Your code must have appropriate comments including your name and student
number, the name of the .c file, the purpose of the program, brief explanations of
variables and explanations of any code which is not obvious to another
programmer.
• All code may be placed in the main function.
Hints:
• Use a do…while loop to input the MAC and to check the length of the inputted string. If it is
in an acceptable format (6 hex numbers separated by spaces), accept the MAC.
• Use fscanf as part of a while loop to read the MAC addresses from the file. Detect the end
on the file using the return value from fscanf.
• Within the loop use an if test to compare each of the 6 parts of the typed MAC address
with the 6 parts of each MAC address read from the file. Set a variable and exit the loop
(break) if the MAC is found.
• Use an If test to see if the MAC was found in the file. Provide appropriate messages to the
user.
• Before calling scanf(), call fflush(stdin); to empty the keyboard buffer (Windows only)
<stdio.h> conversion specifiers for hexadecimal numbers (for use in printf, scanf, fscanf)
%X a hexadecimal number of any length
%2X 2-character hexadecimal number
See the makeIPV6 function (assignment 1) for code which prints unsigned int
numbers as hex numbers.