Last change
on this file since e8f2d4c was
f24fc8d,
checked in by Ted Faber <faber@…>, 12 years ago
|
Routing under here, too
|
-
Property mode set to
100644
|
File size:
598 bytes
|
Line | |
---|
1 | #include <cstdlib> |
---|
2 | #include <iostream> |
---|
3 | #include <fstream> |
---|
4 | #include <string> |
---|
5 | #include <iomanip> |
---|
6 | |
---|
7 | #include <algorithm> |
---|
8 | #include <vector> |
---|
9 | #include <set> |
---|
10 | #include <map> |
---|
11 | |
---|
12 | #include "net.h" |
---|
13 | #include "route_table.h" |
---|
14 | |
---|
15 | using namespace std; |
---|
16 | |
---|
17 | int main(int argc, char **argv) { |
---|
18 | string line; |
---|
19 | route_table rt; |
---|
20 | |
---|
21 | if (argc < 2) { |
---|
22 | cerr << "Usage: collapse_route file" << endl; |
---|
23 | exit(20); |
---|
24 | } |
---|
25 | |
---|
26 | ifstream inp(argv[1]); |
---|
27 | while ( getline(inp, line, '\n')) { |
---|
28 | Net dest_net(line); |
---|
29 | Host next_hop(line.substr(line.find(' '))); |
---|
30 | |
---|
31 | rt.insert(dest_net, next_hop); |
---|
32 | } |
---|
33 | |
---|
34 | rt.collapse(); |
---|
35 | cout << rt; |
---|
36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.