-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnetStat.h
More file actions
66 lines (59 loc) · 1.97 KB
/
Copy pathnetStat.h
File metadata and controls
66 lines (59 loc) · 1.97 KB
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
58
59
60
61
62
63
64
65
66
#pragma once
#include "AfterImage.h"
#include <algorithm>
#include <cmath>
#include <memory>
#include <string>
#include <vector>
/**
* @brief 高效网络统计查询的数据结构
* C++版本的netStat类,基于AfterImage提供统计功能
*/
class netStat {
private:
// Lambda窗口大小列表
std::vector<double> Lambdas;
// 限制参数
size_t HostLimit;
size_t SessionLimit;
size_t MAC_HostLimit;
// 统计数据库
std::unique_ptr<incStatDB> HT_jit; // H-H Jitter统计
std::unique_ptr<incStatDB> HT_MI; // MAC-IP关系
std::unique_ptr<incStatDB> HT_H; // 源主机带宽统计
std::unique_ptr<incStatDB> HT_Hp; // 源主机带宽统计(细粒度)
public:
/**
* @brief 构造函数
* @param Lambdas 窗口大小列表,传入NaN使用默认值[5,3,1,0.1,0.01]
* @param HostLimit 跟踪的最大主机数量
* @param HostSimplexLimit 每个主机跟踪的最大输出通道数
*/
netStat(double Lambdas = NAN, size_t HostLimit = 255,
size_t HostSimplexLimit = 1000);
/**
* @brief 更新统计数据并获取当前统计结果
* @param IPtype IP类型(0=IPv4, 1=IPv6)
* @param srcMAC 源MAC地址
* @param dstMAC 目标MAC地址
* @param srcIP 源IP地址
* @param srcProtocol 源协议
* @param dstIP 目标IP地址
* @param dstProtocol 目标协议
* @param datagramSize 数据包大小
* @param timestamp 时间戳
* @return 包含所有统计信息的向量
*/
std::vector<double> updateGetStats(int IPtype, const std::string &srcMAC,
const std::string &dstMAC,
const std::string &srcIP,
const std::string &srcProtocol,
const std::string &dstIP,
const std::string &dstProtocol,
int datagramSize, double timestamp);
/**
* @brief 获取所有统计标题
* @return 包含所有统计标题的向量
*/
std::vector<std::string> getNetStatHeaders();
};