appendix to course project description (1) the state machine tcp local memory console a set of...
TRANSCRIPT
Appendix to Course Project Description (1)
The State Machine
TCP
Local MemoryConsole
A Set of Commands:
L NeighborID cost(neighborID link cost info)
D NeighborID diff-cost(change of link to neighborID - d)
N NeigbhorID Dest Dist(new min Distance vector info from the neighbor ID to dist- newval)
P (no parameter)(print out the distance Vector table)
U (no parameter)(print out all updated Distance vector info toIts neighbors)
F (no parameter)(finish initialization)
Q (no parameter)(quit)
stdin
stdout
(interface)(running the DV algorithm)
Node 1
Appendix to Course Project Description (2)
1 352
7->2
2
Examples of the Commends:
L NeighborID cost(neighborID link cost info)Examples:L 2 2L 3 7
D NeighborID diff-cost(change of link to neighborID - d)D 3 -5
N NeigbhorID Dest Dist(new min Distance vector info from the neighbor ID to dest - newval)
N 3 2 4
4
2
Test Instance (at node 1):
Prompt> L 2 2Prompt> L 3 7Prompt> L 4 infPrompt> P Dest Neighbors 2 32 2 Inf3 Inf 74 Inf InfPrompt> UDest Neighbors 2 32 2 3 7 4 Inf Prompt > F
Prompt>N 3 4 2Prompt N 3 2 5Prompt>PDest Neighbors 2 32 2 123 Inf 74 Inf 9Prompt>D 3 -5Prompt>PDest Neighbors 2 32 2 73 Inf 24 Inf 4
Appendix to Course Project Description (3)1 Initialization: 2 for all adjacent nodes v: 3 D (*,v) = infty /* the * operator means "for all rows" */ 4 D (v,v) = c(X,v) 5 for all destinations, y 6 send min D (y,w) to each neighbor /* w over all X's neighbors */78 loop 9 wait (until I see a link cost change to neighbor V 10 or until I receive update from neighbor V) 11 12 if (c(X,V) changes by d) 13 /* change cost to all dest's via neighbor v by d */ 14 /* note: d could be positive or negative */ 15 for all destinations y: D (y,V) = D (y,V) + d 16 17 else if (update received from V wrt destination Y) 18 /* shortest path from V to some Y has changed */ 19 /* V has sent a new value for its min DV(Y,w) */ 20 /* call this received new value is "newval" */ 21 for the single destination y: D (Y,V) = c(X,V) + newval 22 23 if we have a new min D (Y,w)for any destination Y 24 send new value of min D (Y,w) to all nighbors 25 26 forever
1 Initialization: While(1){ read commands (started by “L” , “P”, “U”,
“F”) to mem from stdin (or TCP read) if (“F” command) break; if (“P” or “U”) write to stdout (or TCP write) ……}78. While(1){ read commands (started by “D”,”N”, “P”,
“U”, “Q”) to mem from stdin (or TCP read)
if (“Q” command) break; if (“P” or “U”) write to stdout (or TCP write)
……
}