use different class to handle tcp&udp v4/v6.
This commit is contained in:
parent
4774e2379a
commit
1548ce72c5
|
@ -154,8 +154,10 @@
|
|||
<ClInclude Include="ProcessorInformation.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="System.h" />
|
||||
<ClInclude Include="Tcp.h" />
|
||||
<ClInclude Include="Udp.h" />
|
||||
<ClInclude Include="TCPv4.h" />
|
||||
<ClInclude Include="TCPv6.h" />
|
||||
<ClInclude Include="UDPv4.h" />
|
||||
<ClInclude Include="UDPv6.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Common.cpp" />
|
||||
|
@ -187,8 +189,10 @@
|
|||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="System.cpp" />
|
||||
<ClCompile Include="Tcp.cpp" />
|
||||
<ClCompile Include="Udp.cpp" />
|
||||
<ClCompile Include="TCPv4.cpp" />
|
||||
<ClCompile Include="TCPv6.cpp" />
|
||||
<ClCompile Include="UDPv4.cpp" />
|
||||
<ClCompile Include="UDPv6.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
|
@ -39,12 +39,6 @@
|
|||
<ClInclude Include="NetworkInterface.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Tcp.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Udp.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PhysicalDisk.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
|
@ -57,6 +51,18 @@
|
|||
<ClInclude Include="Process.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TCPv4.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TCPv6.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UDPv4.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UDPv6.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
@ -80,12 +86,6 @@
|
|||
<ClCompile Include="NetworkInterface.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Tcp.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Udp.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PhysicalDisk.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
|
@ -98,5 +98,17 @@
|
|||
<ClCompile Include="Process.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TCPv4.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TCPv6.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UDPv4.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UDPv6.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -200,16 +200,26 @@ public:
|
|||
static list<wstring> GetCounterList();
|
||||
};
|
||||
|
||||
class MONITOR_API Tcp
|
||||
class MONITOR_API TCPv4
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterListForV4();
|
||||
static list<wstring> GetCounterListForV6();
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
||||
|
||||
class MONITOR_API Udp
|
||||
class MONITOR_API TCPv6
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterListForV4();
|
||||
static list<wstring> GetCounterListForV6();
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
||||
|
||||
class MONITOR_API UDPv4
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
||||
|
||||
class MONITOR_API UDPv6
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
|
@ -0,0 +1,19 @@
|
|||
#include "stdafx.h"
|
||||
#include "Monitor.h"
|
||||
#include "Common.h"
|
||||
#include "TCPv4.h"
|
||||
|
||||
list<wstring> TCPv4::GetCounterList()
|
||||
{
|
||||
return Common::GetCounterList(L"TCPv4");
|
||||
}
|
||||
|
||||
// Segments/sec
|
||||
// Connections Established
|
||||
// Connections Active
|
||||
// Connections Passive
|
||||
// Connection Failures
|
||||
// Connections Reset
|
||||
// Segments Received/sec
|
||||
// Segments Sent/sec
|
||||
// Segments Retransmitted/sec
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
#include "Monitor.h"
|
||||
#include <list>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
class MONITOR_API TCPv4
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
|
@ -0,0 +1,19 @@
|
|||
#include "stdafx.h"
|
||||
#include "Monitor.h"
|
||||
#include "Common.h"
|
||||
#include "TCPv6.h"
|
||||
|
||||
list<wstring> TCPv6::GetCounterList()
|
||||
{
|
||||
return Common::GetCounterList(L"TCPv6");
|
||||
}
|
||||
|
||||
// Segments/sec
|
||||
// Connections Established
|
||||
// Connections Active
|
||||
// Connections Passive
|
||||
// Connection Failures
|
||||
// Connections Reset
|
||||
// Segments Received/sec
|
||||
// Segments Sent/sec
|
||||
// Segments Retransmitted/sec
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
#include "Monitor.h"
|
||||
#include <list>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
class MONITOR_API TCPv6
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
|
@ -1,36 +0,0 @@
|
|||
#include "stdafx.h"
|
||||
#include "Monitor.h"
|
||||
#include "Common.h"
|
||||
#include "Tcp.h"
|
||||
|
||||
list<wstring> Tcp::GetCounterListForV4()
|
||||
{
|
||||
return Common::GetCounterList(L"TCPv4");
|
||||
}
|
||||
|
||||
list<wstring> Tcp::GetCounterListForV6()
|
||||
{
|
||||
return Common::GetCounterList(L"TCPv6");
|
||||
}
|
||||
|
||||
// v4
|
||||
// Segments/sec
|
||||
// Connections Established
|
||||
// Connections Active
|
||||
// Connections Passive
|
||||
// Connection Failures
|
||||
// Connections Reset
|
||||
// Segments Received/sec
|
||||
// Segments Sent/sec
|
||||
// Segments Retransmitted/sec
|
||||
|
||||
// v6
|
||||
// Segments/sec
|
||||
// Connections Established
|
||||
// Connections Active
|
||||
// Connections Passive
|
||||
// Connection Failures
|
||||
// Connections Reset
|
||||
// Segments Received/sec
|
||||
// Segments Sent/sec
|
||||
// Segments Retransmitted/sec
|
|
@ -1,12 +0,0 @@
|
|||
#pragma once
|
||||
#include "Monitor.h"
|
||||
#include <list>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
class MONITOR_API Tcp
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterListForV4();
|
||||
static list<wstring> GetCounterListForV6();
|
||||
};
|
|
@ -0,0 +1,15 @@
|
|||
#include "stdafx.h"
|
||||
#include "Monitor.h"
|
||||
#include "Common.h"
|
||||
#include "UDPv4.h"
|
||||
|
||||
list<wstring> UDPv4::GetCounterList()
|
||||
{
|
||||
return Common::GetCounterList(L"UDPv4");
|
||||
}
|
||||
|
||||
// Datagrams/sec
|
||||
// Datagrams Received/sec
|
||||
// Datagrams No Port/sec
|
||||
// Datagrams Received Errors
|
||||
// Datagrams Sent/sec
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
#include "Monitor.h"
|
||||
#include <list>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
class MONITOR_API UDPv4
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
|
@ -0,0 +1,16 @@
|
|||
#include "stdafx.h"
|
||||
#include "Monitor.h"
|
||||
#include "Common.h"
|
||||
#include "UDPv6.h"
|
||||
|
||||
list<wstring> UDPv6::GetCounterList()
|
||||
{
|
||||
return Common::GetCounterList(L"UDPv6");
|
||||
}
|
||||
|
||||
// v6
|
||||
// Datagrams/sec
|
||||
// Datagrams Received/sec
|
||||
// Datagrams No Port/sec
|
||||
// Datagrams Received Errors
|
||||
// Datagrams Sent/sec
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
#include "Monitor.h"
|
||||
#include <list>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
class MONITOR_API UDPv6
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
|
@ -1,28 +0,0 @@
|
|||
#include "stdafx.h"
|
||||
#include "Monitor.h"
|
||||
#include "Common.h"
|
||||
#include "Udp.h"
|
||||
|
||||
list<wstring> Udp::GetCounterListForV4()
|
||||
{
|
||||
return Common::GetCounterList(L"UDPv4");
|
||||
}
|
||||
|
||||
list<wstring> Udp::GetCounterListForV6()
|
||||
{
|
||||
return Common::GetCounterList(L"UDPv6");
|
||||
}
|
||||
|
||||
// v4
|
||||
// Datagrams/sec
|
||||
// Datagrams Received/sec
|
||||
// Datagrams No Port/sec
|
||||
// Datagrams Received Errors
|
||||
// Datagrams Sent/sec
|
||||
|
||||
// v6
|
||||
// Datagrams/sec
|
||||
// Datagrams Received/sec
|
||||
// Datagrams No Port/sec
|
||||
// Datagrams Received Errors
|
||||
// Datagrams Sent/sec
|
|
@ -1,12 +0,0 @@
|
|||
#pragma once
|
||||
#include "Monitor.h"
|
||||
#include <list>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
class MONITOR_API Udp
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterListForV4();
|
||||
static list<wstring> GetCounterListForV6();
|
||||
};
|
|
@ -200,16 +200,26 @@ public:
|
|||
static list<wstring> GetCounterList();
|
||||
};
|
||||
|
||||
class MONITOR_API Tcp
|
||||
class MONITOR_API TCPv4
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterListForV4();
|
||||
static list<wstring> GetCounterListForV6();
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
||||
|
||||
class MONITOR_API Udp
|
||||
class MONITOR_API TCPv6
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterListForV4();
|
||||
static list<wstring> GetCounterListForV6();
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
||||
|
||||
class MONITOR_API UDPv4
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
||||
|
||||
class MONITOR_API UDPv6
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
|
@ -200,16 +200,26 @@ public:
|
|||
static list<wstring> GetCounterList();
|
||||
};
|
||||
|
||||
class MONITOR_API Tcp
|
||||
class MONITOR_API TCPv4
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterListForV4();
|
||||
static list<wstring> GetCounterListForV6();
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
||||
|
||||
class MONITOR_API Udp
|
||||
class MONITOR_API TCPv6
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterListForV4();
|
||||
static list<wstring> GetCounterListForV6();
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
||||
|
||||
class MONITOR_API UDPv4
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
||||
|
||||
class MONITOR_API UDPv6
|
||||
{
|
||||
public:
|
||||
static list<wstring> GetCounterList();
|
||||
};
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
//list<wstring> counterList=NetworkInterface::GetCounterList();
|
||||
//list<wstring> instances=NetworkInterface::GetInstances();
|
||||
//list<wstring>::iterator iter;
|
||||
//std::wcout.imbue(std::locale("chs"));
|
||||
//for(iter=counterList.begin();iter!=counterList.end();iter++)
|
||||
//{
|
||||
// wcout<<(*iter).c_str()<<endl;
|
||||
//}
|
||||
list<wstring> counterList=UDPv6::GetCounterList();
|
||||
list<wstring> instances=NetworkInterface::GetInstances();
|
||||
list<wstring>::iterator iter;
|
||||
std::wcout.imbue(std::locale("chs"));
|
||||
for(iter=counterList.begin();iter!=counterList.end();iter++)
|
||||
{
|
||||
wcout<<(*iter).c_str()<<endl;
|
||||
}
|
||||
//for(iter=instances.begin();iter!=instances.end();iter++)
|
||||
//{
|
||||
// wcout<<(*iter).c_str()<<endl;
|
||||
|
|
Loading…
Reference in New Issue