void send_loop(NameServer& ns);
-void add_routes(RouteTable& rt, std::istream& is, Dev& dev);
-
int main(int argc, char* argv[])
{
uint16_t port = DEVTCP_DEFAULT_PORT;
}
}
-void add_routes(RouteTable& rt, std::istream& is, Dev& dev)
-{
- std::string line;
- while (std::getline(is, line))
- {
- std::istringstream iss(line);
- std::string net;
- std::string gw;
- unsigned mtu;
- unsigned metric;
- iss >> net >> gw >> mtu >> metric;
- if (net == "0") net = "0.0.0.0";
- if (gw == "0") gw = "0.0.0.0";
- rt.add(net, gw, metric, mtu, dev);
- }
-}
-
// vim: set et sw=4 sts=4 :
void send_loop(IPOut& ipout, unsigned proto);
-void add_routes(RouteTable& rt, std::istream& is, Dev& dev);
-
int main(int argc, char* argv[])
{
bool router = false;
}
}
-void add_routes(RouteTable& rt, std::istream& is, Dev& dev)
-{
- std::string line;
- while (std::getline(is, line))
- {
- std::istringstream iss(line);
- std::string net;
- std::string gw;
- unsigned mtu;
- unsigned metric;
- iss >> net >> gw >> mtu >> metric;
- if (net == "0") net = "0.0.0.0";
- if (gw == "0") gw = "0.0.0.0";
- rt.add(net, gw, metric, mtu, dev);
- }
-}
-
// vim: set et sw=4 sts=4 :
#include "routetable.h"
+#include <string>
+#include <sstream>
#ifdef DEBUG
#include <iostream>
#endif
return &table[dst];
}
+void add_routes(RouteTable& rt, std::istream& is, Dev& dev)
+{
+ std::string line;
+ while (std::getline(is, line))
+ {
+ std::istringstream iss(line);
+ std::string net;
+ std::string gw;
+ unsigned mtu;
+ unsigned metric;
+ iss >> net >> gw >> mtu >> metric;
+ if (net == "0") net = "0.0.0.0";
+ if (gw == "0") gw = "0.0.0.0";
+ rt.add(net, gw, metric, mtu, dev);
+ }
+}
+
// vim: set et sw=4 sts=4 :
#include "dev.h"
#include "ipaddr.h"
#include <map>
+#include <istream>
/// Tabla de ruteo
struct RouteTable
};
+/// Agrega rutas desde un stream de datos con un cierto dispositivo
+void add_routes(RouteTable& rt, std::istream& is, Dev& dev);
+
#endif // _ROUTETABLE_H_
// vim: set et sw=4 sts=4 :