GithubHelp home page GithubHelp logo

dvrp-mnc's Introduction

DVRP-MNC

Distance Vector routing protocol implemented using C by reading topology files

CODE DOCUMENTATION

CODE FILE NAME : dvrp.c

TO RUN: gcc dvrp.c -o dvrp ./dvrp

The program first reads the topology file and saves information in a struct known as topo topl_file. It saves no. of servers (1st line of topology file), no. of edges (2nd line), [server ids, ip addresses and port nos]. The program gets it's own id and neighbour ids and costs to them from the topology file. From its own id it Find own IP address and Port-no. from topology file and initialize a socket.

The program maintains three tables

A Neighbor table, cost table and a Routing table.

Neighbor table: struct neigh [LINE NO. - 32 in dvrp.c] neigh_id, neigh_cost, val, rec_count, disabled.

Cost Table: [LINE NO. - 41 in dvrp.c] cost_table[5][5].

Routing Table: struct routab - [LINE NO. - 43 in dvrp.c] dest, nxthop, noh

On reading topology file it stores neighbour details in the neighbour table and fills the cost table and routing table from the file.

UPDATE MESSAGE: [LINE NO. - 50 to 71 in dvrp.c] The message is a struct fmsg which is a combination of two structs : struct m1 and struct m2

struct m1 stores details no of updates, source port and source IP struct m2 stores ip , next port, padding and cost.

Timeout is implemented using select()'s last argument.

calc_table() - applies the Bellman Ford equation by storing the cost from source to neighbour in one array c1 and cost from neighbour to destination in another array c2. Temp array is used to store sum of c1 and c2 . The array temp is then passed into least() function which gives the minimum cost of the sums. Hence the next hop is also determined as neighbour in least cost path.

dvrp-mnc's People

Contributors

ameyapat avatar ameyapipeline avatar

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.