1 #include "routetable.h"
8 RouteTable::RouteTable(Dev& default_iface): default_iface(default_iface)
12 void RouteTable::add(const IPAddr& net, const IPAddr& gw, unsigned mtu,
13 unsigned metric, Dev& iface)
15 table[net] = Route(gw, metric, mtu, iface);
17 std::cout << "Se agregó tabla para " << net << ": gw = " << gw
18 << ", metric = " << metric << "\n";
22 void RouteTable::del(const IPAddr& net)
27 RouteTable::Route* RouteTable::get(const IPAddr& dst)
30 if (table.find(dst) == table.end())
35 void add_routes(RouteTable& rt, std::istream& is, Dev& dev)
38 while (std::getline(is, line))
40 std::istringstream iss(line);
45 iss >> net >> gw >> mtu >> metric;
46 if (net == "0") net = "0.0.0.0";
47 if (gw == "0") gw = "0.0.0.0";
48 rt.add(net, gw, metric, mtu, dev);
52 // vim: set et sw=4 sts=4 :