blob: 76869faed775858fc8357f12098da23e3e4de596 (
plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*
* Module: lbdecision.hh
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#ifndef __LBDECISION_HH__
#define __LBDECISION_HH__
#include <map>
#include <string>
#include "lbdata.hh"
using namespace std;
class LBDecision
{
public:
typedef map<string,int> InterfaceMarkColl;
typedef map<string,int>::iterator InterfaceMarkIter;
public:
LBDecision(bool debug);
~LBDecision();
void
init(LBData &lbdata);
void
run(LBData &lbdata);
void
shutdown();
private:
int
execute(string cmd, string &stdout, bool read = false);
void
insert_default(string cmd, int table);
map<int,float>
get_new_weights(LBData &data, LBRule &rule);
string
get_application_cmd(LBRule &rule);
string
fetch_iface_addr(const string &iface);
private:
bool _debug;
InterfaceMarkColl _iface_mark_coll;
};
#endif //__LBDECISION_HH__
|