Project - User Interface
From Comp519
Contents |
Overview
In this project you will expand your software router to add additional features and a user interface.
Getting Started
The user interface of your router will be accessed remotely over the network. This means that your router must have an integrated network stack to deal with a transport protocol (in this case TCP) that runs over IP. Your user interface needs to be written as a network program that runs on top of this network stack.
Network Programming
Your user interface will run as a networked application. As discussed in COMP 320, Unix I/O on sockets has its own sets of constraints and challenges. While not required, we recommend that you use the Robust I/O (RIO) abstraction presented in COMP 320 to simplify dealing with sockets. The RIO abstraction is implemented by the functions with an "rio_" prefix in csapp.c and csapp.h.
Requirements
Your software router must support the following functions in addition to those required in the first project.
- Your code must compile and run under Linux on the 64-bit comp519 class server.
- Note that when you integrate your code with the hardware it will need to run on your 32-bit netfpgaXX machine, so it would be a good idea to verify that it works there, as well.
- ARP
- Add an ARP timeout thread
- This thread should drop packets waiting for an ARP reply after a configurable number of seconds (set via the user interface - default 30) and send an appropriate ICMP message
- This thread should remove ARP entries from the ARP table after a configurable number of seconds (set via the user interface - default 300)
- Enable the addition and deletion of static ARP entries through the user interface
- Static entries should never be removed by the timeout thread
- Add an ARP timeout thread
- IP
- Enable the addition and deletion of static routes through the user interface
- TCP
- Forward TCP packets destined for any of the router's interfaces to the TCP stack
- Call sr_transport_input(...) in sr_lwtcp_glue.c to send a packet to the TCP layer
- Send packets from the TCP stack by implementing the following functions:
- sr_integ_findsrcip(...)
- Given a destination IP, return the correct source address based on the current routing table
- If none exists return 0
- sr_integ_ip_output(...)
- Called by the TCP stack whenever it needs to send out an IP packet
- The router must add the IP headers and forward the packets
- sr_integ_findsrcip(...)
- Create a thread that runs an echo server on TCP port 7
- Create a user interface thread that does one of the following:
- Runs a web server on TCP port 80 that presents a self explanatory web user interface
- Runs a command line server on TCP port 1234 that presents a command line interface with a self explanatory help command
- Forward TCP packets destined for any of the router's interfaces to the TCP stack
- ICMP
- ICMP destination unreachable (unreachable protocol) should be returned if the transport layer is not TCP
- ICMP destination unreachable (host or network unreachable) should be returned if there is no ARP response within the timeout period
- Your User Interface must allow the user to accomplish the following tasks
- View VNS info (user, server, vhost, lhost, topology id)
- View IP info (interfaces, routing table, ARP cache)
- You must be able to modify the router state in the following ways:
- Add a static ARP entry (given an IP address and a MAC address)
- Delete any ARP entry (given an IP address)
- Add a routing table entry (given a destination IP address, mask, gateway IP address, and interface name)
- Delete a routing table entry (given a destination IP address and mask)
- Enable or disable an interface (given an interface name)
- No packets should be sent or received over a disabled interface
- Modify an interface (given an interface name, IP address, subnet mask, and MAC address)
- Modify the ARP timouts
- Provide the ability to generate a ping packet (ICMP echo request) to a given IP address and display the response
Echo Server
Your echo server must accept connections on TCP port 7 on all router interfaces. The server does not need to be concurrent - you only need to process one connection at a time. All the echo server needs to do is receive text over the network and echo it back to the sender a line at a time.
We strongly recommend that you implement the echo server before trying to implement your user interface. This will allow you to easily debug the interface between your router and the TCP/IP stack.
You may use any code from COMP 320 (that you wrote or was provided to you) to implement the echo server. You can find the echo server code here. Note that you do not need to implement an echo client in order to access the echo server. You can simply use:
telnet <router ip address> 7
You will then have an open connection to the echo server. You should be able to type arbitrary text, hit enter, and receive the exact text back from the server.
User Interface
Your user interface must accept TCP connections on the appropriate port on all interfaces. You may choose to either implement a web interface or a command line interface (you do not need to do both). Regardless, your interface does not need to be concurrent - you only need to process one connection at a time.
If you choose to implement the user interface as a web server, you should integrate the web server directly into the user interface thread. It does not need to be a general purpose web server. You can simply accept simple HTTP requests and perform different functions based on the URL. The tiny web server (tar file), or your own web proxy from COMP 320 is a good starting point. The web pages you return should be intuitively obvious to use, but do not have to be elaborate or fancy.
If you choose to implement the user interface as a command line utility, it should also be directly integrated into the user interface thread. Your command line interface must support the command "help", which should provide sufficient information to perform all of the functions of the user interface. Do not assume that we will read your code in order to figure out your command line interface. You do not need to implement a client to access your command line interface - it can be accessed via telnet:
telnet <router ip address> 1234
You must fully document your user interface in the project report. We should be able to read your documentation as if it were a user manual. Therefore, it should explicitly tell us how to perform all of the functions required of the user interface.
Style
Coding style is very important for a large scale project of this type. Good style simplifies coding, debugging, maintenance, and extension of your code. You should refer to the following Software Style Guide for some pointers. You should also not forget the style practices you learned in COMP 320.
Deliverables
Project meetings
Each Friday, we will have project meetings. Over the course of this project, you group will be asked to informally discuss your design and implementation during these meetings.
Source code
You will submit your source code for the software router, which we will then build, run, and test on comp519.cs.rice.edu. Submission details will be provided later.
Project Report
Your should extend your project report from the first software project to include a clear and concise description of the overall design of your software router. You should update the document to address issues that were identified after the first project and you should add at least the following:
- A clear, concise description of how your router handles ARP timeouts
- A clear, concise description of how the TCP/IP stack is integrated into your router
- A clear, concise description of the design of your echo server
- A clear, concise description of the design of your user interface
- A user manual for your user interface
- An updated and expanded description of your testing methodology
We strongly encourage you to develop this document over the course of the project. It should serve as a design document for you in the beginning of the project, and should evolve to clearly describe the decisions you made and why you made them. This document serves to describe what you feel to be the correct functionality of your router. If it does not match your implementation, you will be penalized.
Grading
This project will be graded out of 100 points.
- Implementation / correctness: 60 points
- Usability of the user interface: 10 points
- Written report: 30 points
This guideline is not binding; we reserve the right to assign whatever grade we believe is fair.
