Git Product home page Git Product logo

tcpreno's Introduction

Project: Build TCP based on UDP

Files' Structure

project prerequisites

  • README.md: This readme file
  • Vagrantfile: Vagrantfile for creating VMs
  • project/: Starter code
  • project/Makefile: Makefile to build your code
  • project/gen_graph.py: code to generate graph of unacked packets vs. time

src part

  • project/src: C files for your transport protocol (FDU TCP) implementation
  • project/src/backend.c: Code for emulating packet buffering and sending
  • project/src/client.c: Code for the client side of FDU TCP
  • project/src/server.c: Code for the server side of FDU TCP
  • project/src/cmu_tcp.c: Code for reading, writing, opening, and closing FDU TCP sockets
  • project/src/cmu_packet.c: Code for creating and parsing FDU TCP packets

inc part

  • project/inc: Header files for FDU TCP imeplementation
  • project/inc/backend.h: Defines API for handing packet buffering and sending
  • project/inc/cmu_tcp.h: Defines API for FDU TCP scockets. DO NOT CHANGE THESE FUNCTION SIGNATURES.
  • project/inc/cmu_packet.h: Defines FDU TCP header format, FDU TCP packet data structure, and API for creating and buffering packets
  • project/inc/global.h: Defines some global variables as well as socket and window data structures
  • project/inc/grading.h: Defines variables the TA's will use to test your implementation

utils part

  • project/utils/: Utilities to help you with testing your code
  • project/utils/capture_packets.sh: A simple program showing how you can start and stop packet captures,as well as analyze packets using tshark.
  • project/utils/tcp.lua: A Lua plugin so Wireshark can dissect FDU TCP packets

test part

  • project/test/: Example testing code
  • project/test/test_cp1.py: Code using pytest to test your FDU TCP implementation
  • project/test/testing_server.c: Code for starting a testing FDU TCP server that listens for data from initiator, and tries to send a file
  • project/test/test.pcap: Example pcap file that starter test code uses
  • project/test/random.input: You can generate this file by running make test to generate this random 1M file that you can use to test file transfers

Environment Prerequisites

Install Vagrant & VirutalBox

If you are having trouble running Vagrant make sure your versions of Vagrant and VirtualBox are up to date.

Run VM

vagrant up

To ssh into the server machine:

vagrant ssh server

To ssh into the client machine:

vagrant ssh client

The starter code will be synced to the VMs in thier vagrant folder:

vagrant@server: cd /vagrant/project

tcconfig

You can view the network settings on a vm by running

vagrant@server: tcshow enp0s8

See the tcconfig documentation for information on how to use tcconfig to modify the characteristics for the network between the two VMs.

gen_graph.py

To run gen_graph.py, use python 3:

python3 gen_graph.py

capture_packets.sh

You can generate submit.pcap by running the following commands:

Start the server and the tcpdump:

vagrant@server:/vagrant/project$ make
vagrant@server:/vagrant/project$ utils/capture_packets.sh start submit.pcap
vagrant@server:/vagrant/project$ server

Start the client:

vagrant@client:/vagrant/project$ client

When the server and client finishes running, stop the packet capture on the server:

vagrant@server:/vagrant/project$ utils/capture_packets.sh stop submit.pcap

You can also use capture_packets.sh to generate a CSV describing packets in PCAP:

vagrant@server:/vagrant/project$: utils/capture_packets.sh analyze submit.pcap

tcp.lua

capture_packets.sh analyze functions shows how you can use this Lua plugin to view FDU packets.

You can use tcp.lua to view packets in the Wireshark GUI by adding it to the Wireshark plugins folder on your computer.

Running pytest tests

Before running pytest you should generate submit.pcap, as the tests are run on the PCAP file.

You can run pytest tests by running:

vagrant@server:/vagrant/project/ make test

All of the tests but the last one should pass on the starter code.

These tests are an example of how you can test your code. Some of the tests do nothing. YOU SHOULD EXPAND THESE TESTS! (Or write tests using your favorite testing tool!) make test must be able to run your test code.

A note about CryptographyDeprecationWarning

When you run vagrant up or ``make test``` you will see this warning. The initial tests you're given use a tool called fabric to run commands on the different VMs and it produces this warning. You can ignore it.

tcpreno's People

Contributors

currycurrycurry avatar ichn-hu avatar lu-yq avatar mryanghui avatar uohzyrahcaz avatar

Watchers

 avatar  avatar

Forkers

zhangjinde

tcpreno's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.