1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
/*
* routemanager.cpp
*
* Created on: Sep 5, 2011
* Author: niklas
*/
#include <arpa/inet.h>
//#include "interface.h"
#include "routemanager.h"
routemanager::routemanager() {
// TODO Auto-generated constructor stub
}
routemanager::~routemanager() {
// TODO Auto-generated destructor stub
}
void routemanager::addRoute(QString ifname, QString destination, QString netmask, QString gateway, int metric) {
//struct in_addr destination, netmask, gateway;
//add_route();
}
void routemanager::delRoute(QString ifname, QString destination, QString netmask, QString gateway, int metric) {
struct in_addr ds, nm, gw;
ba = ifname.toAscii();
const char *in = ba.constData();
inet_aton("0.0.0.0", &ds);
inet_aton("0.0.0.0", &nm);
ba = gateway.toAscii();
char * gwaddr = ba.data();
inet_aton(gwaddr,&gw);
del_route(in, ds, nm, gw, metric);
}
|