Giter Club home page Giter Club logo

link-state-routing's Introduction

CS 4410 Operating Systems Fall 2016


10-P3: Full Stack Networking

Due: Wednesday, November 2 @ 11:59 PM

Overview

In this project, I built a full networking stack using the C socket interface, and implemented the socket level calls in order to form point to point connections. Flooding (gossip) mechanism was implemented to flood messages to all other nodes in the network. A link-state routing protocol was applied to broadcast whatever data it received to all of its neighbors. A message sending interface that will allow nodes to send messages using the shortest path based on dijkstra's algorithm.

The Details

There are several distinct components to this project:

  1. In connect.c main() method,

    • Create a non-blocking TCP socket using the socket() and fcntl() system calls.

    • Set the SO_REUSEADDR option on the socket using the setsockopt()

    • Use bind() to bind the socket to bind_port

    • make a non-blocking socket in try_connect and server_handler where indicated. After this part, you should be able to compile and run your code. At the prompt, you should be able to connect two machines together using the connect command, which has the form:

      C192.168.2.248:54292

    Achieved gossip messages to each other. Gossip messages have the form:

    G<src_addr:port>/<counter>/<payload>\n

  2. Implemented a flooding mechanism that will broadcast active connections every time connection state changes. Used the gossip mechanism mentioned in part 1. A gossip message has the form:

    G<src_addr:port>/<counter>/<payload>\n

    where the payload is

    ";<addr1:port1>;<addr2:port2>;<addr3:port3>...\n"

    Essentially, the payload is a list of hosts to which you are connected.

    There are two optimizations.

    1. Don't tell the person who sent you the message.
    2. Don't spread around messages you have seen already.
  3. Implemented a link-state routing algorithm and a new 'send' message. The send message has a similar format as the gossip format. The main difference is that the address belongs to the destination, not the source, and the TTL is the maximum number of hops for this packet (TTL >= 0).

    S<dst_addr:port>/<TTL>/<payload>\n

    Remember, the link-state algorithm recomputes the shortest path every time it receives a new routing update, so the message will be sent through the current shortest path. When operating on a send message,

    1. If the send message belongs to you, then print out the payload.
    2. If the send message belongs to someone else, then decrement the TTL by 1. If TTL <= 0 then drop the message. Otherwise, forward it according to the shortest path.

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.