Project 5, CS270: Systems Programming with Dr.Raphael Finkel, a file server written in C.
Authors: Tanner Palin and Will Shapiro.
Sources and Credits: We were able to create this server by following an outline found here written by Brian Hall.
- Running
makefrom the command line will compile the server as well as the Client methods. - Running
make cleanwill clean up all resulting executables and object files. - Running
make zipwill zip all of our.cfiles andREADME.mdinto aproject5.zipfor submission.
Our actual file server is found within the filed.c file.
Our main() within filed.c is a little verbose and it would be ideal to seperate the different cases into different procedures. However, due to time-constraints for this project, we let decided that this would be alright for the minimally viable solution.
To start the server, you must execute the following bash command line instruction after compilation:
./filed port secretKey- Where
portis the port number that the server will begin listening to. secretKeyis the secret key (unsigned int) that clients must use to authenticate their request.
The server will then listen to the port and display rudimentary information about the requests that it receives.
We have four different files which will make different requests to our server found in filed.c
These three methods can be found in: newKey.c, fileGet.c, fileDigest.c, and fileRun.c
When performing a newKey request, the execution from the command line should like:
./newKey machineName port secretKey newSecretKey- Where
machineNameis the IP Address of DNS Name of the machine that the server is running on. portis the port number that the server will be listening to on the machine.secretKeyis the current secret key (a 32-bit unsigned integer) that the server is using to authenticate requests.newSecretKeyis the new secret key (32-bit unsigned integer) that the server will use upon success of the request.
When performing a fileGet request, the execution from the command line should like:
./fileGet machineName port secretKey fileName- Where
machineNameis the IP Address of DNS Name of the machine that the server is running on. portis the port number that the server will be listening to on the machine.secretKeyis the current secret key (a 32-bit unsigned integer) that the server is using to authenticate requests.fileNameis the name of a file (100 character maximum) stored on the server.
Upon success of this request, the client will receive the first 100 bytes of the file stored on the server.
When performing a fileDigest request, the execution from the command line should like:
./fileDigest machineName port secretKey fileName- Where
machineNameis the IP Address of DNS Name of the machine that the server is running on. portis the port number that the server will be listening to on the machine.secretKeyis the current secret key (a 32-bit unsigned integer) that the server is using to authenticate requests.fileNameis the name of a file (100 character maximum) stored on the server.
Upon success of this request, the client will receive a 100 byte cryptographic digest of the file stored on the server.
When performing a fileRun request, the execution from the command line should like:
./fileRun machineName port secretKey runType- Where
machineNameis the IP Address of DNS Name of the machine that the server is running on. portis the port number that the server will be listening to on the machine.secretKeyis the current secret key (a 32-bit unsigned integer) that the server is using to authenticate requests.runTypeis an abbreviation for the execution type. Either: "inet", "service", "hosts", or "identity".inetruns the following bash command line instruction/bin/ip addressPOSSIBLE BUG ALERTserviceruns the following bash command line instruction/bin/cat /etc/servicesPOSSIBLE BUG ALERThostsruns the following bash command line instruction/bin/cat /etc/hostsPOSSIBLE BUG ALERTidentityruns the following bash command line instruction/bin/hostnamePOSSIBLE BUG ALERT
Upon success of this request, the client will receive 100 bytes of output from the execution of the run type.
A working example of executables can be found in the finkelServer folder. Use localhost or 127.0.0.1 for the machine name in the command line of your client applications if the server and client are running on the same machine.