yaomengmiao / cmu-tcp

CMU 15-441/641 Project 2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

15-441/641 Project 2: TCP in the Wild

Welcome to Project 2! Please read the handout and starter code thoroughly before you begin. This README contains a quick summary to get your testing environment set up.

Setting up Vagrant and the virtual machines

First, download and install Vagrant and VirtualBox on your machine. If you're using an M1 Mac, you may need to use an EC2 instance on AWS or other cloud services providers as VirtualBox may not be fully functional.

Once you have Vagrant and VirtualBox installed, navigate inside this repo and run:

vagrant up  # builds the server and client virtual machines, which takes a while
vagrant ssh {client | server}   # connects to either the client or server using SSH

Vagrant keeps all files synchronized between your host machine and the two VMs. In other words, the code will update automatically on the VMs as you edit it on your computer. Similarly, debugging files and other files generated on the VMs will automatically appear on your host machine.

Testing

At this point, you should be able to run tests on the virtual machines. On either the client or server VM, navigate to /vagrant/15-441-project-2/ and run make test.

Note that the test files are incomplete! You are expected to build upon them and write more extensive tests (doing so will help you write better code and save you grief during debugging)!

Files

The following files have been provided for you:

  • Vagrantfile: Defines the structure, IP addresses, and dependencies in the virtual machines. Feel free to modify this file to add any additional testing tools as you see fit. Remember to document your changes in tests.txt!

  • README: A description of your files, as well as your algorithm in CP3.

  • tests.txt: A brief writeup describing your testing strategy, and any tools you used in the process of testing.

  • gen_graph.py: Takes in a PCAP file and generates a graph. Feel free to modify this file to profile Reno and your algorithm in CP2 and CP3.

  • tcp.lua: A Lua plugin that allows Wireshark to decode CMU-TCP headers. Copy the file to the directory described in https://www.wireshark.org/docs/wsug_html_chunked/ChPluginFolders.html to use the plugin.

  • test_cp1.py: Test script for CP1 that is executed with make test. You should add your own tests to this file.

  • test_cp2.py: Test script for CP2 that can be executed with make test. You should add your own tests to this file.

  • grading.h: These are variables that we will use to test your implementation. We will be replacing this file when running tests, and hence you should test your implementation with different values.

  • server.c: An application using the server side of your transport protocol. We will test your code using a different server program, so do not keep any variables or functions here that your protocol uses.

  • client.c: An application using the client side of your transport protocol. We will test your code using a different client application, so do not keep any variables or functions here that your protocol uses.

  • cmu_tcp.c: This contains the main socket functions required of your TCP socket including reading, writing, opening and closing.

  • backend.c: This file contains the code used to emulate the buffering and sending of packets. This is where you should spend most of your time.

  • cmu_packet.h: This file describes the basic packet format and header. You are not allowed to modify this file in Checkpoints 1 and 2! The scripts that we provide to help you graph your packet traces rely on this file being unchanged. All the communication between your server and client will use UDP as the underlying protocol. All packets will begin with the common header described as follows:

    • Course Number [4 bytes]
    • Source Port [2 bytes]
    • Destination Port [2 bytes]
    • Sequence Number [4 bytes]
    • Acknowledgement Number [4 bytes]
    • Header Length [2 bytes]
    • Packet Length [2 bytes]
    • Flags [1 byte]
    • Advertised Window [2 bytes]
    • Extension length [2 bytes]
    • Extension Data [You Decide]

Troubleshooting

If you get the following error while running vagrant up during the "Mounting shared folders..." phase that looks like the one below:

Vagrant was unable to mount VirtualBox shared folders. This is usually because the filesystem "vboxsf" is not available. This filesystem is made available via the VirtualBox Guest Additions and kernel module. Please verify that these guest additions are properly installed in the guest. This is not a bug in Vagrant and is usually caused by a faulty Vagrant box.

Run vagrant plugin install vagrant-vbguest - see @981 on Piazza

About

CMU 15-441/641 Project 2

License:Apache License 2.0


Languages

Language:C 61.9%Language:Python 29.5%Language:Lua 4.7%Language:Shell 2.3%Language:Makefile 1.7%