forked from rainmeter/rainmeter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMeasureNet.h
64 lines (49 loc) · 1.55 KB
/
MeasureNet.h
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
/* Copyright (C) 2001 Rainmeter Project Developers
*
* This Source Code Form is subject to the terms of the GNU General Public
* License; either version 2 of the License, or (at your option) any later
* version. If a copy of the GPL was not distributed with this file, You can
* obtain one at <https://www.gnu.org/licenses/gpl-2.0.html>. */
#ifndef __MEASURENET_H__
#define __MEASURENET_H__
#include <winsock2.h>
#include <ws2tcpip.h>
#include <Iphlpapi.h>
#include "Measure.h"
class MeasureNet : public Measure
{
public:
virtual UINT GetTypeID() { return TypeID<MeasureNet>(); }
static void UpdateIFTable();
static void UpdateStats();
static void ResetStats();
static void ReadStats(const std::wstring& iniFile, std::wstring& statsDate);
static void WriteStats(const WCHAR* iniFile, const std::wstring& statsDate);
static void InitializeStatic();
static void FinalizeStatic();
protected:
enum NET
{
NET_IN,
NET_OUT,
NET_TOTAL
};
MeasureNet(Skin* skin, const WCHAR* name, NET type);
virtual ~MeasureNet();
MeasureNet(const MeasureNet& other) = delete;
MeasureNet& operator=(MeasureNet other) = delete;
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
virtual void UpdateValue();
private:
ULONG64 GetNetOctets(NET net);
ULONG64 GetNetStatsValue(NET net);
NET m_Net;
ULONG m_Interface;
ULONG64 m_Octets;
bool m_FirstTime;
bool m_Cumulative;
bool m_UseBits;
static std::vector<ULONG64> c_OldStatValues;
static std::vector<ULONG64> c_StatValues;
};
#endif