-
Notifications
You must be signed in to change notification settings - Fork 390
/
flow_export_info.cc
49 lines (43 loc) · 1.71 KB
/
flow_export_info.cc
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
#include <vrouter/flow_stats/flow_stats_collector.h>
#include <pkt/flow_table.h>
FlowExportInfo::FlowExportInfo() :
flow_(), setup_time_(0), teardown_time_(0), last_modified_time_(0),
bytes_(0), packets_(0), underlay_source_port_(0), changed_(false),
tcp_flags_(0), delete_enqueue_time_(0), evict_enqueue_time_(0),
exported_atleast_once_(false) {
}
FlowExportInfo::FlowExportInfo(const FlowEntryPtr &fe) :
flow_(fe), setup_time_(0), teardown_time_(0), last_modified_time_(0),
bytes_(0), packets_(0), underlay_source_port_(0), changed_(true),
tcp_flags_(0), delete_enqueue_time_(0), evict_enqueue_time_(0),
exported_atleast_once_(false) {
}
FlowExportInfo::FlowExportInfo(const FlowEntryPtr &fe, uint64_t setup_time) :
flow_(fe), setup_time_(setup_time),
teardown_time_(0), last_modified_time_(setup_time),
bytes_(0), packets_(0), underlay_source_port_(0), changed_(true),
tcp_flags_(0), delete_enqueue_time_(0), evict_enqueue_time_(0),
exported_atleast_once_(false) {
}
FlowEntry* FlowExportInfo::reverse_flow() const {
FlowEntry *rflow = NULL;
if (flow_.get()) {
rflow = flow_->reverse_flow_entry();
}
return rflow;
}
bool FlowExportInfo::IsActionLog() const {
uint32_t fe_action = flow_->data().match_p.action_info.action;
if (fe_action & (1 << TrafficAction::LOG)) {
return true;
}
return false;
}
///////////////////////////////////////////////////////////////////
// APIs used only by UT
//////////////////////////////////////////////////////////////////
void FlowExportInfo::SetActionLog() {
FlowEntry *fe = flow();
fe->data().match_p.action_info.action =
fe->data().match_p.action_info.action | (1 << TrafficAction::LOG);
}