You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
125
external/corefx/src/System.Net.Ping/System.Net.Ping.sln
vendored
Normal file
125
external/corefx/src/System.Net.Ping/System.Net.Ping.sln
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Ping.Functional.Tests", "tests\FunctionalTests\System.Net.Ping.Functional.Tests.csproj", "{43CE20B7-389B-41BB-8390-447521DF3BD4}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD} = {85FD05E8-A4B1-4B89-ABED-33AFD200CABD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Ping", "src\System.Net.Ping.csproj", "{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{DFBAB4FC-17E0-4928-9620-2C4692984487}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{FFE41062-5FDA-4A80-AEBF-A9DB61914DC4}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{C693AA4E-6829-490E-8AF7-9A411BB0E266}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Ping", "ref\System.Net.Ping.csproj", "{1B802547-471C-4278-AEA9-5FFC81037F20}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FunctionalTests", "FunctionalTests", "{5447F7A2-7401-44B1-BF7B-5D572ACD0067}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU = DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU
|
||||
ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU = ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU
|
||||
DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU = DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU
|
||||
ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU = ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU
|
||||
DebugNETCoreAppnetcoreapp-Unixnetcoreapp|AnyCPU = DebugNETCoreAppnetcoreapp-Unixnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp|AnyCPU = ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp|AnyCPU
|
||||
DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU = DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU
|
||||
ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU = ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU
|
||||
DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU = DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU
|
||||
ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU = ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU
|
||||
DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp|AnyCPU = DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp|AnyCPU = ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp|AnyCPU
|
||||
DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU = DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU
|
||||
ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU = ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU
|
||||
DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU = DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU
|
||||
ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU = ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU
|
||||
DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU = DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU = ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = net463-Windows_NT-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = net463-Windows_NT-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = net463-Windows_NT-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = net463-Windows_NT-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = net463-Windows_NT-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = net463-Windows_NT-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = net463-Windows_NT-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = net463-Windows_NT-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net463-Windows_NT-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = net463-Windows_NT-Debug|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net463-Windows_NT-Release|Any CPU
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = net463-Windows_NT-Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{43CE20B7-389B-41BB-8390-447521DF3BD4} = {43CE20B7-389B-41BB-8390-447521DF3BD4}
|
||||
{85FD05E8-A4B1-4B89-ABED-33AFD200CABD} = {85FD05E8-A4B1-4B89-ABED-33AFD200CABD}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
8
external/corefx/src/System.Net.Ping/dir.props
vendored
Normal file
8
external/corefx/src/System.Net.Ping/dir.props
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>4.1.0.0</AssemblyVersion>
|
||||
<IsNETCoreApp>true</IsNETCoreApp>
|
||||
</PropertyGroup>
|
||||
</Project>
|
9
external/corefx/src/System.Net.Ping/ref/Configurations.props
vendored
Normal file
9
external/corefx/src/System.Net.Ping/ref/Configurations.props
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netcoreapp;
|
||||
uap;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
98
external/corefx/src/System.Net.Ping/ref/System.Net.Ping.cs
vendored
Normal file
98
external/corefx/src/System.Net.Ping/ref/System.Net.Ping.cs
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
// ------------------------------------------------------------------------------
|
||||
// Changes to this file must follow the http://aka.ms/api-review process.
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace System.Net.NetworkInformation
|
||||
{
|
||||
public enum IPStatus
|
||||
{
|
||||
BadDestination = 11018,
|
||||
BadHeader = 11042,
|
||||
BadOption = 11007,
|
||||
BadRoute = 11012,
|
||||
DestinationHostUnreachable = 11003,
|
||||
DestinationNetworkUnreachable = 11002,
|
||||
DestinationPortUnreachable = 11005,
|
||||
DestinationProhibited = 11004,
|
||||
DestinationProtocolUnreachable = 11004,
|
||||
DestinationScopeMismatch = 11045,
|
||||
DestinationUnreachable = 11040,
|
||||
HardwareError = 11008,
|
||||
IcmpError = 11044,
|
||||
NoResources = 11006,
|
||||
PacketTooBig = 11009,
|
||||
ParameterProblem = 11015,
|
||||
SourceQuench = 11016,
|
||||
Success = 0,
|
||||
TimedOut = 11010,
|
||||
TimeExceeded = 11041,
|
||||
TtlExpired = 11013,
|
||||
TtlReassemblyTimeExceeded = 11014,
|
||||
Unknown = -1,
|
||||
UnrecognizedNextHeader = 11043,
|
||||
}
|
||||
public partial class Ping : System.ComponentModel.Component
|
||||
{
|
||||
public Ping() { }
|
||||
public event System.Net.NetworkInformation.PingCompletedEventHandler PingCompleted { add { } remove { } }
|
||||
protected override void Dispose(bool disposing) { }
|
||||
protected void OnPingCompleted(System.Net.NetworkInformation.PingCompletedEventArgs e) { }
|
||||
public PingReply Send(string hostNameOrAddress) { throw null; }
|
||||
public PingReply Send(string hostNameOrAddress, int timeout) { throw null; }
|
||||
public PingReply Send(System.Net.IPAddress address) { throw null; }
|
||||
public PingReply Send(System.Net.IPAddress address, int timeout) { throw null; }
|
||||
public PingReply Send(string hostNameOrAddress, int timeout, byte[] buffer) { throw null; }
|
||||
public PingReply Send(System.Net.IPAddress address, int timeout, byte[] buffer) { throw null; }
|
||||
public PingReply Send(string hostNameOrAddress, int timeout, byte[] buffer, System.Net.NetworkInformation.PingOptions options) { throw null; }
|
||||
public PingReply Send(System.Net.IPAddress address, int timeout, byte[] buffer, System.Net.NetworkInformation.PingOptions options) { throw null; }
|
||||
public void SendAsync(string hostNameOrAddress, object userToken) { }
|
||||
public void SendAsync(string hostNameOrAddress, int timeout, object userToken) { }
|
||||
public void SendAsync(System.Net.IPAddress address, object userToken) { }
|
||||
public void SendAsync(System.Net.IPAddress address, int timeout, object userToken) { }
|
||||
public void SendAsync(string hostNameOrAddress, int timeout, byte[] buffer, object userToken) { }
|
||||
public void SendAsync(System.Net.IPAddress address, int timeout, byte[] buffer, object userToken) { }
|
||||
public void SendAsync(string hostNameOrAddress, int timeout, byte[] buffer, System.Net.NetworkInformation.PingOptions options, object userToken) { }
|
||||
public void SendAsync(System.Net.IPAddress address, int timeout, byte[] buffer, System.Net.NetworkInformation.PingOptions options, object userToken) { }
|
||||
public void SendAsyncCancel() { }
|
||||
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync(System.Net.IPAddress address) { throw null; }
|
||||
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync(System.Net.IPAddress address, int timeout) { throw null; }
|
||||
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync(System.Net.IPAddress address, int timeout, byte[] buffer) { throw null; }
|
||||
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync(System.Net.IPAddress address, int timeout, byte[] buffer, System.Net.NetworkInformation.PingOptions options) { throw null; }
|
||||
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync(string hostNameOrAddress) { throw null; }
|
||||
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync(string hostNameOrAddress, int timeout) { throw null; }
|
||||
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync(string hostNameOrAddress, int timeout, byte[] buffer) { throw null; }
|
||||
public System.Threading.Tasks.Task<System.Net.NetworkInformation.PingReply> SendPingAsync(string hostNameOrAddress, int timeout, byte[] buffer, System.Net.NetworkInformation.PingOptions options) { throw null; }
|
||||
}
|
||||
public delegate void PingCompletedEventHandler(object sender, PingCompletedEventArgs e);
|
||||
public class PingCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
|
||||
{
|
||||
internal PingCompletedEventArgs() : base(null, false, null) { }
|
||||
public PingReply Reply { get; }
|
||||
}
|
||||
public partial class PingException : System.InvalidOperationException
|
||||
{
|
||||
public PingException(string message) { }
|
||||
public PingException(string message, System.Exception innerException) { }
|
||||
protected PingException(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
|
||||
}
|
||||
public partial class PingOptions
|
||||
{
|
||||
public PingOptions() { }
|
||||
public PingOptions(int ttl, bool dontFragment) { }
|
||||
public bool DontFragment { get { throw null; } set { } }
|
||||
public int Ttl { get { throw null; } set { } }
|
||||
}
|
||||
public partial class PingReply
|
||||
{
|
||||
internal PingReply() { }
|
||||
public System.Net.IPAddress Address { get { throw null; } }
|
||||
public byte[] Buffer { get { throw null; } }
|
||||
public System.Net.NetworkInformation.PingOptions Options { get { throw null; } }
|
||||
public long RoundtripTime { get { throw null; } }
|
||||
public System.Net.NetworkInformation.IPStatus Status { get { throw null; } }
|
||||
}
|
||||
}
|
19
external/corefx/src/System.Net.Ping/ref/System.Net.Ping.csproj
vendored
Normal file
19
external/corefx/src/System.Net.Ping/ref/System.Net.Ping.csproj
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="System.Net.Ping.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\System.ComponentModel.EventBasedAsync\ref\System.ComponentModel.EventBasedAsync.csproj" />
|
||||
<ProjectReference Include="..\..\System.ComponentModel.Primitives\ref\System.ComponentModel.Primitives.csproj" />
|
||||
<ProjectReference Include="..\..\System.Net.Primitives\ref\System.Net.Primitives.csproj" />
|
||||
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
|
||||
<ProjectReference Include="..\..\System.Threading.Tasks\ref\System.Threading.Tasks.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
10
external/corefx/src/System.Net.Ping/src/Configurations.props
vendored
Normal file
10
external/corefx/src/System.Net.Ping/src/Configurations.props
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netcoreapp-Unix;
|
||||
netcoreapp-Windows_NT;
|
||||
net463-Windows_NT;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
150
external/corefx/src/System.Net.Ping/src/Resources/Strings.resx
vendored
Normal file
150
external/corefx/src/System.Net.Ping/src/Resources/Strings.resx
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="net_inasync" xml:space="preserve">
|
||||
<value>An asynchronous call is already in progress. It must be completed or canceled before you can call this method.</value>
|
||||
</data>
|
||||
<data name="net_InvalidAddressFamily" xml:space="preserve">
|
||||
<value>The AddressFamily {0} is not valid for the {1} end point, use {2} instead.</value>
|
||||
</data>
|
||||
<data name="net_InvalidSocketAddressSize" xml:space="preserve">
|
||||
<value>The supplied {0} is an invalid size for the {1} end point.</value>
|
||||
</data>
|
||||
<data name="net_invalidPingBufferSize" xml:space="preserve">
|
||||
<value>The buffer length must not exceed 65500 bytes.</value>
|
||||
</data>
|
||||
<data name="net_invalid_ip_addr" xml:space="preserve">
|
||||
<value>IPv4 address 0.0.0.0 and IPv6 address ::0 are unspecified addresses that cannot be used as a target address.</value>
|
||||
</data>
|
||||
<data name="net_ping" xml:space="preserve">
|
||||
<value>An exception occurred during a Ping request.</value>
|
||||
</data>
|
||||
<data name="net_ping_utility_not_found" xml:space="preserve">
|
||||
<value>The system's ping utility could not be found.</value>
|
||||
</data>
|
||||
<data name="net_ipv4_not_installed" xml:space="preserve">
|
||||
<value>IPv4 is not installed.</value>
|
||||
</data>
|
||||
<data name="net_ipv6_not_installed" xml:space="preserve">
|
||||
<value>IPv6 is not installed.</value>
|
||||
</data>
|
||||
<data name="net_log_exception" xml:space="preserve">
|
||||
<value>Exception in {0}::{1} - {2}.</value>
|
||||
</data>
|
||||
</root>
|
166
external/corefx/src/System.Net.Ping/src/System.Net.Ping.csproj
vendored
Normal file
166
external/corefx/src/System.Net.Ping/src/System.Net.Ping.csproj
vendored
Normal file
@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyName>System.Net.Ping</AssemblyName>
|
||||
<ProjectGuid>{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}</ProjectGuid>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DefineConstants>$(DefineConstants);FEATURE_CORECLR</DefineConstants>
|
||||
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net463'">true</IsPartialFacadeAssembly>
|
||||
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net463'">None</ResourcesSourceOutputDirectory>
|
||||
</PropertyGroup>
|
||||
<!-- Help VS understand available configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Unix-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Unix-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Windows_NT-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net463-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net463-Windows_NT-Release|AnyCPU'" />
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
|
||||
<Compile Include="System\Net\NetworkInformation\IPStatus.cs" />
|
||||
<Compile Include="System\Net\NetworkInformation\NetEventSource.Ping.cs" />
|
||||
<Compile Include="System\Net\NetworkInformation\Ping.cs" />
|
||||
<Compile Include="System\Net\NetworkInformation\PingCompletedEventArgs.cs" />
|
||||
<Compile Include="System\Net\NetworkInformation\PingException.cs" />
|
||||
<Compile Include="System\Net\NetworkInformation\PingOptions.cs" />
|
||||
<Compile Include="System\Net\NetworkInformation\PingReply.cs" />
|
||||
</ItemGroup>
|
||||
<!-- System.Net Common -->
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
|
||||
<Compile Include="$(CommonPath)\System\Net\ByteOrder.cs">
|
||||
<Link>Common\System\Net\ByteOrder.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Net\IntPtrHelper.cs">
|
||||
<Link>Common\System\Net\IntPtrHelper.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Net\IPAddressParserStatics.cs">
|
||||
<Link>Common\System\Net\IPAddressParserStatics.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Net\SocketAddress.cs">
|
||||
<Link>Common\System\Net\SocketAddress.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<!-- Logging -->
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
|
||||
<Compile Include="$(CommonPath)\System\Net\Shims\TraceSource.cs">
|
||||
<Link>Common\System\Net\Shims\TraceSource.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Net\Logging\NetEventSource.Common.cs">
|
||||
<Link>Common\System\Net\Logging\NetEventSource.Common.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Net\InternalException.cs">
|
||||
<Link>Common\System\Net\InternalException.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<!-- System.Net.Internals -->
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
|
||||
<Compile Include="$(CommonPath)\System\Net\Internals\IPAddressExtensions.cs">
|
||||
<Link>Common\System\Net\Internals\IPAddressExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Net\Internals\IPEndPointExtensions.cs">
|
||||
<Link>Common\System\Net\Internals\IPEndPointExtensions.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetsUnix)' == 'true' ">
|
||||
<Compile Include="System\Net\NetworkInformation\IcmpV4MessageConstants.cs" />
|
||||
<Compile Include="System\Net\NetworkInformation\IcmpV6MessageConstants.cs" />
|
||||
<Compile Include="System\Net\NetworkInformation\Ping.Unix.cs" />
|
||||
<!-- System.Net Common -->
|
||||
<Compile Include="$(CommonPath)\System\Net\RawSocketPermissions.cs">
|
||||
<Link>Common\System\Net\RawSocketPermissions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Net\SocketAddressPal.Unix.cs">
|
||||
<Link>Common\System\Net\SocketAddressPal.Unix.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Net\SocketProtocolSupportPal.Unix.cs">
|
||||
<Link>Common\System\Net\SocketProtocolSupportPal.Unix.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Net\NetworkInformation\UnixCommandLinePing.cs">
|
||||
<Link>Common\System\Net\NetworkInformation\UnixCommandLinePing.cs</Link>
|
||||
</Compile>
|
||||
<!-- Interop -->
|
||||
<Compile Include="$(CommonPath)\Interop\Unix\Interop.Errors.cs">
|
||||
<Link>Common\Interop\Unix\Interop.Errors.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Unix\Interop.Libraries.cs">
|
||||
<Link>Common\Interop\Unix\Interop.Libraries.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Unix\System.Native\Interop.Close.cs">
|
||||
<Link>Common\Interop\Unix\System.Native\Interop.Close.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Unix\System.Native\Interop.Socket.cs">
|
||||
<Link>Common\Interop\Unix\System.Native\Interop.Socket.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Unix\System.Native\Interop.SocketAddress.cs">
|
||||
<Link>Common\Interop\Unix\System.Native\Interop.SocketAddress.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(TargetGroup)' == 'netcoreapp' ">
|
||||
<Compile Include="System\Net\NetworkInformation\Ping.Windows.cs" />
|
||||
<!-- System.Net Common -->
|
||||
<Compile Include="$(CommonPath)\System\Net\SocketAddressPal.Windows.cs">
|
||||
<Link>Common\System\Net\SocketAddressPal.Windows.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Net\SocketProtocolSupportPal.Windows.cs">
|
||||
<Link>Common\System\Net\SocketProtocolSupportPal.Windows.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeLocalAllocHandle.cs">
|
||||
<Link>Common\Microsoft\Win32\SafeHandles\SafeLocalAllocHandle.cs</Link>
|
||||
</Compile>
|
||||
<!-- Interop -->
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\Interop.Libraries.cs">
|
||||
<Link>Common\Interop\Windows\Interop.Libraries.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\IpHlpApi\Interop.ErrorCodes.cs">
|
||||
<Link>Common\Interop\Windows\IpHlpApi\Interop.ErrorCodes.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\IpHlpApi\Interop.ICMP.cs">
|
||||
<Link>Common\Interop\Windows\IpHlpApi\Interop.ICMP.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.LocalAlloc.cs">
|
||||
<Link>Common\Interop\Windows\kernel32\Interop.LocalAlloc.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.LocalAlloc.Constants.cs">
|
||||
<Link>Common\Interop\Windows\kernel32\Interop.LocalAlloc.Constants.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.LocalFree.cs">
|
||||
<Link>Common\Interop\Windows\kernel32\Interop.LocalFree.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\Winsock\Interop.closesocket.cs">
|
||||
<Link>Common\Interop\Windows\Winsock\Interop.closesocket.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\Winsock\Interop.WSASocketW.cs">
|
||||
<Link>Common\Interop\Windows\Winsock\Interop.WSASocketW.cs</Link>
|
||||
</Compile>
|
||||
<!-- System.Net.Internals -->
|
||||
<Compile Include="$(CommonPath)\System\Net\Sockets\SocketType.cs">
|
||||
<Link>Common\System\Net\Sockets\SocketType.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'net463'">
|
||||
<TargetingPackReference Include="mscorlib" />
|
||||
<TargetingPackReference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Win32.Primitives" />
|
||||
<Reference Include="System.ComponentModel.EventBasedAsync" />
|
||||
<Reference Include="System.ComponentModel.Primitives" />
|
||||
<Reference Include="System.Diagnostics.Debug" />
|
||||
<Reference Include="System.Diagnostics.Tracing" />
|
||||
<Reference Include="System.Net.NameResolution" />
|
||||
<Reference Include="System.Net.Primitives" />
|
||||
<Reference Include="System.Net.Sockets" />
|
||||
<Reference Include="System.Resources.ResourceManager" />
|
||||
<Reference Include="System.Runtime" />
|
||||
<Reference Include="System.Runtime.Extensions" />
|
||||
<Reference Include="System.Runtime.InteropServices" />
|
||||
<Reference Include="System.Threading" />
|
||||
<Reference Include="System.Threading.Tasks" />
|
||||
<Reference Include="System.Threading.ThreadPool" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetsUnix)' == 'true'">
|
||||
<Reference Include="System.Diagnostics.Process" />
|
||||
<Reference Include="System.IO.FileSystem" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
44
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/IPStatus.cs
vendored
Normal file
44
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/IPStatus.cs
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Net.NetworkInformation
|
||||
{
|
||||
// TODO #3562 - properly name constants below from Win32 SDK (i.e. 11000 + k).
|
||||
|
||||
public enum IPStatus
|
||||
{
|
||||
Success = 0,
|
||||
//BufferTooSmall = 11000 + 1,
|
||||
|
||||
DestinationNetworkUnreachable = 11000 + 2,
|
||||
DestinationHostUnreachable = 11000 + 3,
|
||||
DestinationProtocolUnreachable = 11000 + 4,
|
||||
DestinationPortUnreachable = 11000 + 5,
|
||||
DestinationProhibited = 11000 + 4,
|
||||
|
||||
NoResources = 11000 + 6,
|
||||
BadOption = 11000 + 7,
|
||||
HardwareError = 11000 + 8,
|
||||
PacketTooBig = 11000 + 9,
|
||||
TimedOut = 11000 + 10,
|
||||
// BadRequest = 11000 + 11,
|
||||
BadRoute = 11000 + 12,
|
||||
|
||||
TtlExpired = 11000 + 13,
|
||||
TtlReassemblyTimeExceeded = 11000 + 14,
|
||||
|
||||
ParameterProblem = 11000 + 15,
|
||||
SourceQuench = 11000 + 16,
|
||||
//OptionTooBig = 11000 + 17,
|
||||
BadDestination = 11000 + 18,
|
||||
|
||||
DestinationUnreachable = 11000 + 40,
|
||||
TimeExceeded = 11000 + 41,
|
||||
BadHeader = 11000 + 42,
|
||||
UnrecognizedNextHeader = 11000 + 43,
|
||||
IcmpError = 11000 + 44,
|
||||
DestinationScopeMismatch = 11000 + 45,
|
||||
Unknown = -1,
|
||||
}
|
||||
}
|
91
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/IcmpV4MessageConstants.cs
vendored
Normal file
91
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/IcmpV4MessageConstants.cs
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Net.NetworkInformation
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the "type" field in ICMPv4 headers.
|
||||
/// </summary>
|
||||
internal enum IcmpV4MessageType : byte
|
||||
{
|
||||
EchoReply = 0,
|
||||
DestinationUnreachable = 3,
|
||||
SourceQuench = 4,
|
||||
RedirectMessage = 5,
|
||||
EchoRequest = 8,
|
||||
RouterAdvertisement = 9,
|
||||
RouterSolicitation = 10,
|
||||
TimeExceeded = 11,
|
||||
ParameterProblemBadIPHeader = 12,
|
||||
Timestamp = 13,
|
||||
TimestampReply = 14,
|
||||
InformationRequest = 15,
|
||||
InformationReply = 16,
|
||||
AddressMaskRequest = 17,
|
||||
AddressMaskReply = 18,
|
||||
Traceroute = 30
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the "code" field in ICMPv4 headers whose type is DestinationUnreachable.
|
||||
/// </summary>
|
||||
internal enum IcmpV4DestinationUnreachableCode : byte
|
||||
{
|
||||
DestinationNetworkUnreachable = 0,
|
||||
DestinationHostUnreachable = 1,
|
||||
DestinationProtocolUnreachable = 2,
|
||||
DestinationPortUnreachable = 3,
|
||||
FragmentationRequiredAndDFFlagSet = 4,
|
||||
SourceRouteFailed = 5,
|
||||
DestinationNetworkUnknown = 6,
|
||||
DestinationHostUnknown = 7,
|
||||
SourceHostIsolated = 8,
|
||||
NetworkAdministrativelyProhibited = 9,
|
||||
HostAdministrativelyProhibited = 10,
|
||||
NetworkUnreachableForTos = 11,
|
||||
HostUnreachableForTos = 12,
|
||||
CommunicationAdministrativelyProhibited = 13,
|
||||
HostPrecedenceViolation = 14,
|
||||
PrecedenceCutoffInEffect = 15,
|
||||
}
|
||||
|
||||
internal static class IcmpV4MessageConstants
|
||||
{
|
||||
public static IPStatus MapV4TypeToIPStatus(int type, int code)
|
||||
{
|
||||
switch ((IcmpV4MessageType)type)
|
||||
{
|
||||
case IcmpV4MessageType.EchoReply:
|
||||
return IPStatus.Success;
|
||||
|
||||
case IcmpV4MessageType.DestinationUnreachable:
|
||||
switch ((IcmpV4DestinationUnreachableCode)code)
|
||||
{
|
||||
case IcmpV4DestinationUnreachableCode.DestinationNetworkUnreachable:
|
||||
return IPStatus.DestinationNetworkUnreachable;
|
||||
case IcmpV4DestinationUnreachableCode.DestinationHostUnreachable:
|
||||
return IPStatus.DestinationHostUnreachable;
|
||||
case IcmpV4DestinationUnreachableCode.DestinationProtocolUnreachable:
|
||||
return IPStatus.DestinationProtocolUnreachable;
|
||||
case IcmpV4DestinationUnreachableCode.DestinationPortUnreachable:
|
||||
return IPStatus.DestinationPortUnreachable;
|
||||
default:
|
||||
return IPStatus.DestinationUnreachable;
|
||||
}
|
||||
|
||||
case IcmpV4MessageType.SourceQuench:
|
||||
return IPStatus.SourceQuench;
|
||||
|
||||
case IcmpV4MessageType.TimeExceeded:
|
||||
return IPStatus.TimeExceeded;
|
||||
|
||||
case IcmpV4MessageType.ParameterProblemBadIPHeader:
|
||||
return IPStatus.BadHeader;
|
||||
|
||||
default:
|
||||
return IPStatus.Unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
106
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/IcmpV6MessageConstants.cs
vendored
Normal file
106
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/IcmpV6MessageConstants.cs
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Net.NetworkInformation
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the "type" field in ICMPv6 headers.
|
||||
/// </summary>
|
||||
internal enum IcmpV6MessageType : byte
|
||||
{
|
||||
DestinationUnreachable = 1,
|
||||
PacketTooBig = 2,
|
||||
TimeExceeded = 3,
|
||||
ParameterProblem = 4,
|
||||
EchoRequest = 128,
|
||||
EchoReply = 129
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the "code" field in ICMPv6 headers whose type is DestinationUnreachable.
|
||||
/// </summary>
|
||||
internal enum IcmpV6DestinationUnreachableCode : byte
|
||||
{
|
||||
NoRouteToDestination = 0,
|
||||
CommunicationAdministrativelyProhibited = 1,
|
||||
BeyondScopeOfSourceAddress = 2,
|
||||
AddressUnreachable = 3,
|
||||
PortUnreachable = 4,
|
||||
SourceAddressFailedPolicy = 5,
|
||||
RejectRouteToDesitnation = 6,
|
||||
SourceRoutingHeaderError = 7
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the "code" field in ICMPv6 headers whose type is TimeExceeded.
|
||||
/// </summary>
|
||||
internal enum IcmpV6TimeExceededCode : byte
|
||||
{
|
||||
HopLimitExceeded = 0,
|
||||
FragmentReassemblyTimeExceeded = 1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the "code" field in ICMPv6 headers whose type is ParameterProblem.
|
||||
/// </summary>
|
||||
internal enum IcmpV6ParameterProblemCode : byte
|
||||
{
|
||||
ErroneousHeaderField = 0,
|
||||
UnrecognizedNextHeader = 1,
|
||||
UnrecognizedIpv6Option = 2
|
||||
}
|
||||
|
||||
internal static class IcmpV6MessageConstants
|
||||
{
|
||||
public static IPStatus MapV6TypeToIPStatus(byte type, byte code)
|
||||
{
|
||||
switch ((IcmpV6MessageType)type)
|
||||
{
|
||||
case IcmpV6MessageType.EchoReply:
|
||||
return IPStatus.Success;
|
||||
|
||||
case IcmpV6MessageType.DestinationUnreachable:
|
||||
switch ((IcmpV6DestinationUnreachableCode)code)
|
||||
{
|
||||
case IcmpV6DestinationUnreachableCode.NoRouteToDestination:
|
||||
return IPStatus.BadRoute;
|
||||
case IcmpV6DestinationUnreachableCode.SourceRoutingHeaderError:
|
||||
return IPStatus.BadHeader;
|
||||
default:
|
||||
return IPStatus.DestinationUnreachable;
|
||||
}
|
||||
|
||||
case IcmpV6MessageType.PacketTooBig:
|
||||
return IPStatus.PacketTooBig;
|
||||
|
||||
case IcmpV6MessageType.TimeExceeded:
|
||||
switch ((IcmpV6TimeExceededCode)code)
|
||||
{
|
||||
case IcmpV6TimeExceededCode.HopLimitExceeded:
|
||||
return IPStatus.TimeExceeded;
|
||||
case IcmpV6TimeExceededCode.FragmentReassemblyTimeExceeded:
|
||||
return IPStatus.TtlReassemblyTimeExceeded;
|
||||
default:
|
||||
return IPStatus.TimeExceeded;
|
||||
}
|
||||
|
||||
case IcmpV6MessageType.ParameterProblem:
|
||||
switch ((IcmpV6ParameterProblemCode)code)
|
||||
{
|
||||
case IcmpV6ParameterProblemCode.ErroneousHeaderField:
|
||||
return IPStatus.BadHeader;
|
||||
case IcmpV6ParameterProblemCode.UnrecognizedNextHeader:
|
||||
return IPStatus.UnrecognizedNextHeader;
|
||||
case IcmpV6ParameterProblemCode.UnrecognizedIpv6Option:
|
||||
return IPStatus.BadOption;
|
||||
default:
|
||||
return IPStatus.ParameterProblem;
|
||||
}
|
||||
|
||||
default:
|
||||
return IPStatus.Unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/NetEventSource.Ping.cs
vendored
Normal file
11
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/NetEventSource.Ping.cs
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
[EventSource(Name = "Microsoft-System-Net-Ping")]
|
||||
internal sealed partial class NetEventSource { }
|
||||
}
|
268
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Unix.cs
vendored
Normal file
268
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Unix.cs
vendored
Normal file
@ -0,0 +1,268 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Net.NetworkInformation
|
||||
{
|
||||
public partial class Ping
|
||||
{
|
||||
private const int IcmpHeaderLengthInBytes = 8;
|
||||
private const int IpHeaderLengthInBytes = 20;
|
||||
[ThreadStatic]
|
||||
private static Random t_idGenerator;
|
||||
|
||||
private async Task<PingReply> SendPingAsyncCore(IPAddress address, byte[] buffer, int timeout, PingOptions options)
|
||||
{
|
||||
try
|
||||
{
|
||||
Task<PingReply> t = RawSocketPermissions.CanUseRawSockets(address.AddressFamily) ?
|
||||
SendIcmpEchoRequestOverRawSocket(address, buffer, timeout, options) :
|
||||
SendWithPingUtility(address, buffer, timeout, options);
|
||||
PingReply reply = await t.ConfigureAwait(false);
|
||||
if (_canceled)
|
||||
{
|
||||
throw new OperationCanceledException();
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<PingReply> SendIcmpEchoRequestOverRawSocket(IPAddress address, byte[] buffer, int timeout, PingOptions options)
|
||||
{
|
||||
EndPoint endPoint = new IPEndPoint(address, 0);
|
||||
|
||||
bool isIpv4 = address.AddressFamily == AddressFamily.InterNetwork;
|
||||
ProtocolType protocolType = isIpv4 ? ProtocolType.Icmp : ProtocolType.IcmpV6;
|
||||
|
||||
// Use a random value as the identifier. This doesn't need to be perfectly random
|
||||
// or very unpredictable, rather just good enough to avoid unexpected conflicts.
|
||||
Random rand = t_idGenerator ?? (t_idGenerator = new Random());
|
||||
ushort identifier = (ushort)rand.Next((int)ushort.MaxValue + 1);
|
||||
|
||||
IcmpHeader header = new IcmpHeader()
|
||||
{
|
||||
Type = isIpv4 ? (byte)IcmpV4MessageType.EchoRequest : (byte)IcmpV6MessageType.EchoRequest,
|
||||
Code = 0,
|
||||
HeaderChecksum = 0,
|
||||
Identifier = identifier,
|
||||
SequenceNumber = 0,
|
||||
};
|
||||
|
||||
byte[] sendBuffer = CreateSendMessageBuffer(header, buffer);
|
||||
|
||||
using (Socket socket = new Socket(address.AddressFamily, SocketType.Raw, protocolType))
|
||||
{
|
||||
socket.ReceiveTimeout = timeout;
|
||||
socket.SendTimeout = timeout;
|
||||
// Setting Socket.DontFragment and .Ttl is not supported on Unix, so ignore the PingOptions parameter.
|
||||
|
||||
int ipHeaderLength = isIpv4 ? IpHeaderLengthInBytes : 0;
|
||||
await socket.SendToAsync(new ArraySegment<byte>(sendBuffer), SocketFlags.None, endPoint).ConfigureAwait(false);
|
||||
byte[] receiveBuffer = new byte[ipHeaderLength + IcmpHeaderLengthInBytes + buffer.Length];
|
||||
|
||||
long elapsed;
|
||||
Stopwatch sw = Stopwatch.StartNew();
|
||||
// Read from the socket in a loop. We may receive messages that are not echo replies, or that are not in response
|
||||
// to the echo request we just sent. We need to filter such messages out, and continue reading until our timeout.
|
||||
// For example, when pinging the local host, we need to filter out our own echo requests that the socket reads.
|
||||
while ((elapsed = sw.ElapsedMilliseconds) < timeout)
|
||||
{
|
||||
Task<SocketReceiveFromResult> receiveTask = socket.ReceiveFromAsync(
|
||||
new ArraySegment<byte>(receiveBuffer),
|
||||
SocketFlags.None,
|
||||
endPoint);
|
||||
var cts = new CancellationTokenSource();
|
||||
Task finished = await Task.WhenAny(receiveTask, Task.Delay(timeout - (int)elapsed, cts.Token)).ConfigureAwait(false);
|
||||
cts.Cancel();
|
||||
if (finished != receiveTask)
|
||||
{
|
||||
sw.Stop();
|
||||
return CreateTimedOutPingReply();
|
||||
}
|
||||
|
||||
SocketReceiveFromResult receiveResult = receiveTask.GetAwaiter().GetResult();
|
||||
int bytesReceived = receiveResult.ReceivedBytes;
|
||||
if (bytesReceived - ipHeaderLength < IcmpHeaderLengthInBytes)
|
||||
{
|
||||
continue; // Not enough bytes to reconstruct IP header + ICMP header.
|
||||
}
|
||||
|
||||
byte type, code;
|
||||
unsafe
|
||||
{
|
||||
fixed (byte* bytesPtr = receiveBuffer)
|
||||
{
|
||||
int icmpHeaderOffset = ipHeaderLength;
|
||||
IcmpHeader receivedHeader = *((IcmpHeader*)(bytesPtr + icmpHeaderOffset)); // Skip IP header.
|
||||
type = receivedHeader.Type;
|
||||
code = receivedHeader.Code;
|
||||
|
||||
if (identifier != receivedHeader.Identifier
|
||||
|| type == (byte)IcmpV4MessageType.EchoRequest
|
||||
|| type == (byte)IcmpV6MessageType.EchoRequest) // Echo Request, ignore
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sw.Stop();
|
||||
long roundTripTime = sw.ElapsedMilliseconds;
|
||||
int dataOffset = ipHeaderLength + IcmpHeaderLengthInBytes;
|
||||
// We want to return a buffer with the actual data we sent out, not including the header data.
|
||||
byte[] dataBuffer = new byte[bytesReceived - dataOffset];
|
||||
Buffer.BlockCopy(receiveBuffer, dataOffset, dataBuffer, 0, dataBuffer.Length);
|
||||
|
||||
IPStatus status = isIpv4
|
||||
? IcmpV4MessageConstants.MapV4TypeToIPStatus(type, code)
|
||||
: IcmpV6MessageConstants.MapV6TypeToIPStatus(type, code);
|
||||
|
||||
return new PingReply(address, options, status, roundTripTime, dataBuffer);
|
||||
}
|
||||
|
||||
// We have exceeded our timeout duration, and no reply has been received.
|
||||
sw.Stop();
|
||||
return CreateTimedOutPingReply();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<PingReply> SendWithPingUtility(IPAddress address, byte[] buffer, int timeout, PingOptions options)
|
||||
{
|
||||
bool isIpv4 = address.AddressFamily == AddressFamily.InterNetwork;
|
||||
string pingExecutable = isIpv4 ? UnixCommandLinePing.Ping4UtilityPath : UnixCommandLinePing.Ping6UtilityPath;
|
||||
if (pingExecutable == null)
|
||||
{
|
||||
throw new PlatformNotSupportedException(SR.net_ping_utility_not_found);
|
||||
}
|
||||
|
||||
string processArgs = UnixCommandLinePing.ConstructCommandLine(buffer.Length, address.ToString(), isIpv4);
|
||||
ProcessStartInfo psi = new ProcessStartInfo(pingExecutable, processArgs);
|
||||
psi.RedirectStandardOutput = true;
|
||||
psi.RedirectStandardError = true;
|
||||
Process p = new Process() { StartInfo = psi };
|
||||
|
||||
var processCompletion = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
p.EnableRaisingEvents = true;
|
||||
p.Exited += (s, e) => processCompletion.SetResult(true);
|
||||
p.Start();
|
||||
var cts = new CancellationTokenSource();
|
||||
Task timeoutTask = Task.Delay(timeout, cts.Token);
|
||||
|
||||
Task finished = await Task.WhenAny(processCompletion.Task, timeoutTask).ConfigureAwait(false);
|
||||
if (finished == timeoutTask && !p.HasExited)
|
||||
{
|
||||
// Try to kill the ping process if it didn't return. If it is already in the process of exiting, a Win32Exception will be thrown.
|
||||
try
|
||||
{
|
||||
p.Kill();
|
||||
}
|
||||
catch (Win32Exception) { }
|
||||
return CreateTimedOutPingReply();
|
||||
}
|
||||
else
|
||||
{
|
||||
cts.Cancel();
|
||||
if (p.ExitCode != 0)
|
||||
{
|
||||
// This means no reply was received, although transmission may have been successful.
|
||||
return CreateTimedOutPingReply();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string output = await p.StandardOutput.ReadToEndAsync().ConfigureAwait(false);
|
||||
long rtt = UnixCommandLinePing.ParseRoundTripTime(output);
|
||||
return new PingReply(
|
||||
address,
|
||||
null, // Ping utility cannot accommodate these, return null to indicate they were ignored.
|
||||
IPStatus.Success,
|
||||
rtt,
|
||||
Array.Empty<byte>()); // Ping utility doesn't deliver this info.
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// If the standard output cannot be successfully parsed, throw a generic PingException.
|
||||
throw new PingException(SR.net_ping);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private PingReply CreateTimedOutPingReply()
|
||||
{
|
||||
// Documentation indicates that you should only pay attention to the IPStatus value when
|
||||
// its value is not "Success", but the rest of these values match that of the Windows implementation.
|
||||
return new PingReply(new IPAddress(0), null, IPStatus.TimedOut, 0, Array.Empty<byte>());
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
static Ping()
|
||||
{
|
||||
Debug.Assert(Marshal.SizeOf<IcmpHeader>() == 8, "The size of an ICMP Header must be 8 bytes.");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Must be 8 bytes total.
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct IcmpHeader
|
||||
{
|
||||
public byte Type;
|
||||
public byte Code;
|
||||
public ushort HeaderChecksum;
|
||||
public ushort Identifier;
|
||||
public ushort SequenceNumber;
|
||||
}
|
||||
|
||||
private static unsafe byte[] CreateSendMessageBuffer(IcmpHeader header, byte[] payload)
|
||||
{
|
||||
int headerSize = sizeof(IcmpHeader);
|
||||
byte[] result = new byte[headerSize + payload.Length];
|
||||
Marshal.Copy(new IntPtr(&header), result, 0, headerSize);
|
||||
payload.CopyTo(result, headerSize);
|
||||
ushort checksum = ComputeBufferChecksum(result);
|
||||
// Jam the checksum into the buffer.
|
||||
result[2] = (byte)(checksum >> 8);
|
||||
result[3] = (byte)(checksum & (0xFF));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static ushort ComputeBufferChecksum(byte[] buffer)
|
||||
{
|
||||
// This is using the "deferred carries" approach outlined in RFC 1071.
|
||||
uint sum = 0;
|
||||
for (int i = 0; i < buffer.Length; i += 2)
|
||||
{
|
||||
// Combine each pair of bytes into a 16-bit number and add it to the sum
|
||||
ushort element0 = (ushort)((buffer[i] << 8) & 0xFF00);
|
||||
ushort element1 = (i + 1 < buffer.Length)
|
||||
? (ushort)(buffer[i + 1] & 0x00FF)
|
||||
: (ushort)0; // If there's an odd number of bytes, pad by one octet of zeros.
|
||||
ushort combined = (ushort)(element0 | element1);
|
||||
sum += (uint)combined;
|
||||
}
|
||||
|
||||
// Add back the "carry bits" which have risen to the upper 16 bits of the sum.
|
||||
while ((sum >> 16) != 0)
|
||||
{
|
||||
var partialSum = sum & 0xFFFF;
|
||||
var carries = sum >> 16;
|
||||
sum = partialSum + carries;
|
||||
}
|
||||
|
||||
return (ushort)~sum;
|
||||
}
|
||||
}
|
||||
}
|
343
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Windows.cs
vendored
Normal file
343
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Windows.cs
vendored
Normal file
@ -0,0 +1,343 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Net.NetworkInformation
|
||||
{
|
||||
public partial class Ping
|
||||
{
|
||||
private static readonly object s_socketInitializationLock = new object();
|
||||
private static bool s_socketInitialized;
|
||||
|
||||
private int _sendSize = 0; // Needed to determine what the reply size is for ipv6 in callback.
|
||||
private bool _ipv6 = false;
|
||||
private ManualResetEvent _pingEvent;
|
||||
private RegisteredWaitHandle _registeredWait;
|
||||
private SafeLocalAllocHandle _requestBuffer;
|
||||
private SafeLocalAllocHandle _replyBuffer;
|
||||
private Interop.IpHlpApi.SafeCloseIcmpHandle _handlePingV4;
|
||||
private Interop.IpHlpApi.SafeCloseIcmpHandle _handlePingV6;
|
||||
private TaskCompletionSource<PingReply> _taskCompletionSource;
|
||||
|
||||
// Any exceptions that escape synchronously will be caught by the caller and wrapped in a PingException.
|
||||
// We do not need to or want to capture such exceptions into the returned task.
|
||||
private Task<PingReply> SendPingAsyncCore(IPAddress address, byte[] buffer, int timeout, PingOptions options)
|
||||
{
|
||||
var tcs = new TaskCompletionSource<PingReply>();
|
||||
_taskCompletionSource = tcs;
|
||||
|
||||
_ipv6 = (address.AddressFamily == AddressFamily.InterNetworkV6);
|
||||
_sendSize = buffer.Length;
|
||||
|
||||
// Get and cache correct handle.
|
||||
if (!_ipv6 && _handlePingV4 == null)
|
||||
{
|
||||
_handlePingV4 = Interop.IpHlpApi.IcmpCreateFile();
|
||||
if (_handlePingV4.IsInvalid)
|
||||
{
|
||||
_handlePingV4 = null;
|
||||
throw new Win32Exception(); // Gets last error.
|
||||
}
|
||||
}
|
||||
else if (_ipv6 && _handlePingV6 == null)
|
||||
{
|
||||
_handlePingV6 = Interop.IpHlpApi.Icmp6CreateFile();
|
||||
if (_handlePingV6.IsInvalid)
|
||||
{
|
||||
_handlePingV6 = null;
|
||||
throw new Win32Exception(); // Gets last error.
|
||||
}
|
||||
}
|
||||
|
||||
var ipOptions = new Interop.IpHlpApi.IPOptions(options);
|
||||
|
||||
if (_replyBuffer == null)
|
||||
{
|
||||
_replyBuffer = SafeLocalAllocHandle.LocalAlloc(MaxUdpPacket);
|
||||
}
|
||||
|
||||
// Queue the event.
|
||||
int error;
|
||||
try
|
||||
{
|
||||
if (_pingEvent == null)
|
||||
{
|
||||
_pingEvent = new ManualResetEvent(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_pingEvent.Reset();
|
||||
}
|
||||
|
||||
_registeredWait = ThreadPool.RegisterWaitForSingleObject(_pingEvent, (state, _) => ((Ping)state).PingCallback(), this, -1, true);
|
||||
|
||||
SetUnmanagedStructures(buffer);
|
||||
|
||||
if (!_ipv6)
|
||||
{
|
||||
SafeWaitHandle pingEventSafeWaitHandle = _pingEvent.GetSafeWaitHandle();
|
||||
error = (int)Interop.IpHlpApi.IcmpSendEcho2(
|
||||
_handlePingV4,
|
||||
pingEventSafeWaitHandle,
|
||||
IntPtr.Zero,
|
||||
IntPtr.Zero,
|
||||
(uint)address.GetAddress(),
|
||||
_requestBuffer,
|
||||
(ushort)buffer.Length,
|
||||
ref ipOptions,
|
||||
_replyBuffer,
|
||||
MaxUdpPacket,
|
||||
(uint)timeout);
|
||||
}
|
||||
else
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint(address, 0);
|
||||
Internals.SocketAddress remoteAddr = IPEndPointExtensions.Serialize(ep);
|
||||
byte[] sourceAddr = new byte[28];
|
||||
|
||||
SafeWaitHandle pingEventSafeWaitHandle = _pingEvent.GetSafeWaitHandle();
|
||||
error = (int)Interop.IpHlpApi.Icmp6SendEcho2(
|
||||
_handlePingV6,
|
||||
pingEventSafeWaitHandle,
|
||||
IntPtr.Zero,
|
||||
IntPtr.Zero,
|
||||
sourceAddr,
|
||||
remoteAddr.Buffer,
|
||||
_requestBuffer,
|
||||
(ushort)buffer.Length,
|
||||
ref ipOptions,
|
||||
_replyBuffer,
|
||||
MaxUdpPacket,
|
||||
(uint)timeout);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
UnregisterWaitHandle();
|
||||
throw;
|
||||
}
|
||||
|
||||
if (error == 0)
|
||||
{
|
||||
error = Marshal.GetLastWin32Error();
|
||||
|
||||
// Only skip Async IO Pending error value.
|
||||
if (error != Interop.IpHlpApi.ERROR_IO_PENDING)
|
||||
{
|
||||
// Cleanup.
|
||||
FreeUnmanagedStructures();
|
||||
UnregisterWaitHandle();
|
||||
|
||||
throw new Win32Exception(error);
|
||||
}
|
||||
}
|
||||
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
/*private*/ partial void InternalDisposeCore()
|
||||
{
|
||||
if (_handlePingV4 != null)
|
||||
{
|
||||
_handlePingV4.Dispose();
|
||||
_handlePingV4 = null;
|
||||
}
|
||||
|
||||
if (_handlePingV6 != null)
|
||||
{
|
||||
_handlePingV6.Dispose();
|
||||
_handlePingV6 = null;
|
||||
}
|
||||
|
||||
UnregisterWaitHandle();
|
||||
|
||||
if (_pingEvent != null)
|
||||
{
|
||||
_pingEvent.Dispose();
|
||||
_pingEvent = null;
|
||||
}
|
||||
|
||||
if (_replyBuffer != null)
|
||||
{
|
||||
_replyBuffer.Dispose();
|
||||
_replyBuffer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void UnregisterWaitHandle()
|
||||
{
|
||||
lock (_lockObject)
|
||||
{
|
||||
if (_registeredWait != null)
|
||||
{
|
||||
// If Unregister returns false, it is sufficient to nullify registeredWait
|
||||
// and let its own finalizer clean up later.
|
||||
_registeredWait.Unregister(null);
|
||||
_registeredWait = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Private callback invoked when icmpsendecho APIs succeed.
|
||||
private void PingCallback()
|
||||
{
|
||||
TaskCompletionSource<PingReply> tcs = _taskCompletionSource;
|
||||
_taskCompletionSource = null;
|
||||
|
||||
PingReply reply = null;
|
||||
Exception error = null;
|
||||
bool canceled = false;
|
||||
|
||||
try
|
||||
{
|
||||
lock (_lockObject)
|
||||
{
|
||||
canceled = _canceled;
|
||||
|
||||
// Parse reply buffer.
|
||||
SafeLocalAllocHandle buffer = _replyBuffer;
|
||||
|
||||
// Marshals and constructs new reply.
|
||||
if (_ipv6)
|
||||
{
|
||||
Interop.IpHlpApi.Icmp6EchoReply icmp6Reply = Marshal.PtrToStructure<Interop.IpHlpApi.Icmp6EchoReply>(buffer.DangerousGetHandle());
|
||||
reply = CreatePingReplyFromIcmp6EchoReply(icmp6Reply, buffer.DangerousGetHandle(), _sendSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
Interop.IpHlpApi.IcmpEchoReply icmpReply = Marshal.PtrToStructure<Interop.IpHlpApi.IcmpEchoReply>(buffer.DangerousGetHandle());
|
||||
reply = CreatePingReplyFromIcmpEchoReply(icmpReply);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// In case of failure, create a failed event arg.
|
||||
error = new PingException(SR.net_ping, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
FreeUnmanagedStructures();
|
||||
UnregisterWaitHandle();
|
||||
Finish();
|
||||
}
|
||||
|
||||
// Once we've called Finish, complete the task
|
||||
if (canceled)
|
||||
{
|
||||
tcs.SetCanceled();
|
||||
}
|
||||
else if (reply != null)
|
||||
{
|
||||
tcs.SetResult(reply);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Assert(error != null);
|
||||
tcs.SetException(error);
|
||||
}
|
||||
}
|
||||
|
||||
// Copies _requestBuffer into unmanaged memory for async icmpsendecho APIs.
|
||||
private unsafe void SetUnmanagedStructures(byte[] buffer)
|
||||
{
|
||||
_requestBuffer = SafeLocalAllocHandle.LocalAlloc(buffer.Length);
|
||||
byte* dst = (byte*)_requestBuffer.DangerousGetHandle();
|
||||
for (int i = 0; i < buffer.Length; ++i)
|
||||
{
|
||||
dst[i] = buffer[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Releases the unmanaged memory after ping completion.
|
||||
private void FreeUnmanagedStructures()
|
||||
{
|
||||
if (_requestBuffer != null)
|
||||
{
|
||||
_requestBuffer.Dispose();
|
||||
_requestBuffer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static PingReply CreatePingReplyFromIcmpEchoReply(Interop.IpHlpApi.IcmpEchoReply reply)
|
||||
{
|
||||
const int DontFragmentFlag = 2;
|
||||
|
||||
IPAddress address = new IPAddress(reply.address);
|
||||
IPStatus ipStatus = (IPStatus)reply.status; // The icmpsendecho IP status codes.
|
||||
|
||||
long rtt;
|
||||
PingOptions options;
|
||||
byte[] buffer;
|
||||
|
||||
if (ipStatus == IPStatus.Success)
|
||||
{
|
||||
// Only copy the data if we succeed w/ the ping operation.
|
||||
rtt = reply.roundTripTime;
|
||||
options = new PingOptions(reply.options.ttl, (reply.options.flags & DontFragmentFlag) > 0);
|
||||
buffer = new byte[reply.dataSize];
|
||||
Marshal.Copy(reply.data, buffer, 0, reply.dataSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
rtt = default(long);
|
||||
options = default(PingOptions);
|
||||
buffer = Array.Empty<byte>();
|
||||
}
|
||||
|
||||
return new PingReply(address, options, ipStatus, rtt, buffer);
|
||||
}
|
||||
|
||||
private static PingReply CreatePingReplyFromIcmp6EchoReply(Interop.IpHlpApi.Icmp6EchoReply reply, IntPtr dataPtr, int sendSize)
|
||||
{
|
||||
IPAddress address = new IPAddress(reply.Address.Address, reply.Address.ScopeID);
|
||||
IPStatus ipStatus = (IPStatus)reply.Status; // The icmpsendecho IP status codes.
|
||||
|
||||
long rtt;
|
||||
byte[] buffer;
|
||||
|
||||
if (ipStatus == IPStatus.Success)
|
||||
{
|
||||
// Only copy the data if we succeed w/ the ping operation.
|
||||
rtt = reply.RoundTripTime;
|
||||
buffer = new byte[sendSize];
|
||||
Marshal.Copy(IntPtrHelper.Add(dataPtr, 36), buffer, 0, sendSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
rtt = default(long);
|
||||
buffer = Array.Empty<byte>();
|
||||
}
|
||||
|
||||
return new PingReply(address, default(PingOptions), ipStatus, rtt, buffer);
|
||||
}
|
||||
|
||||
/*private*/ static partial void InitializeSockets()
|
||||
{
|
||||
if (!Volatile.Read(ref s_socketInitialized))
|
||||
{
|
||||
lock (s_socketInitializationLock)
|
||||
{
|
||||
if (!s_socketInitialized)
|
||||
{
|
||||
// Ensure that WSAStartup has been called once per process.
|
||||
// The System.Net.NameResolution contract is responsible with the initialization.
|
||||
Dns.GetHostName();
|
||||
|
||||
// Cache some settings locally.
|
||||
s_socketInitialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
398
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/Ping.cs
vendored
Normal file
398
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/Ping.cs
vendored
Normal file
@ -0,0 +1,398 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Net.NetworkInformation
|
||||
{
|
||||
public partial class Ping : Component
|
||||
{
|
||||
private const int DefaultSendBufferSize = 32; // Same as ping.exe on Windows.
|
||||
private const int DefaultTimeout = 5000; // 5 seconds: same as ping.exe on Windows.
|
||||
private const int MaxBufferSize = 65500; // Artificial constraint due to win32 api limitations.
|
||||
private const int MaxUdpPacket = 0xFFFF + 256; // Marshal.SizeOf(typeof(Icmp6EchoReply)) * 2 + ip header info;
|
||||
|
||||
private readonly ManualResetEventSlim _lockObject = new ManualResetEventSlim(initialState: true); // doubles as the ability to wait on the current operation
|
||||
private SendOrPostCallback _onPingCompletedDelegate;
|
||||
private bool _disposeRequested = false;
|
||||
private byte[] _defaultSendBuffer = null;
|
||||
private bool _canceled;
|
||||
|
||||
// Thread safety:
|
||||
private const int Free = 0;
|
||||
private const int InProgress = 1;
|
||||
private new const int Disposed = 2;
|
||||
private int _status = Free;
|
||||
|
||||
public Ping()
|
||||
{
|
||||
// This class once inherited a finalizer. For backward compatibility it has one so that
|
||||
// any derived class that depends on it will see the behaviour expected. Since it is
|
||||
// not used by this class itself, suppress it immediately if this is not an instance
|
||||
// of a derived class it doesn't suffer the GC burden of finalization.
|
||||
if (GetType() == typeof(Ping))
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckStart()
|
||||
{
|
||||
if (_disposeRequested)
|
||||
{
|
||||
throw new ObjectDisposedException(GetType().FullName);
|
||||
}
|
||||
|
||||
int currentStatus;
|
||||
lock (_lockObject)
|
||||
{
|
||||
currentStatus = _status;
|
||||
if (currentStatus == Free)
|
||||
{
|
||||
_canceled = false;
|
||||
_status = InProgress;
|
||||
_lockObject.Reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentStatus == InProgress)
|
||||
{
|
||||
throw new InvalidOperationException(SR.net_inasync);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Assert(currentStatus == Disposed, $"Expected currentStatus == Disposed, got {currentStatus}");
|
||||
throw new ObjectDisposedException(GetType().FullName);
|
||||
}
|
||||
}
|
||||
|
||||
private void Finish()
|
||||
{
|
||||
lock (_lockObject)
|
||||
{
|
||||
Debug.Assert(_status == InProgress, $"Invalid status: {_status}");
|
||||
_status = Free;
|
||||
_lockObject.Set();
|
||||
}
|
||||
|
||||
if (_disposeRequested)
|
||||
{
|
||||
InternalDispose();
|
||||
}
|
||||
}
|
||||
|
||||
// Cancels pending async requests, closes the handles.
|
||||
private void InternalDispose()
|
||||
{
|
||||
_disposeRequested = true;
|
||||
|
||||
lock (_lockObject)
|
||||
{
|
||||
if (_status != Free)
|
||||
{
|
||||
// Already disposed, or Finish will call Dispose again once Free.
|
||||
return;
|
||||
}
|
||||
_status = Disposed;
|
||||
}
|
||||
|
||||
InternalDisposeCore();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
// Only on explicit dispose. Otherwise, the GC can cleanup everything else.
|
||||
InternalDispose();
|
||||
}
|
||||
}
|
||||
|
||||
public event PingCompletedEventHandler PingCompleted;
|
||||
|
||||
protected void OnPingCompleted(PingCompletedEventArgs e)
|
||||
{
|
||||
PingCompleted?.Invoke(this, e);
|
||||
}
|
||||
|
||||
public PingReply Send(string hostNameOrAddress)
|
||||
{
|
||||
return Send(hostNameOrAddress, DefaultTimeout, DefaultSendBuffer);
|
||||
}
|
||||
|
||||
public PingReply Send(string hostNameOrAddress, int timeout)
|
||||
{
|
||||
return Send(hostNameOrAddress, timeout, DefaultSendBuffer);
|
||||
}
|
||||
|
||||
public PingReply Send(IPAddress address)
|
||||
{
|
||||
return Send(address, DefaultTimeout, DefaultSendBuffer);
|
||||
}
|
||||
|
||||
public PingReply Send(IPAddress address, int timeout)
|
||||
{
|
||||
return Send(address, timeout, DefaultSendBuffer);
|
||||
}
|
||||
|
||||
public PingReply Send(string hostNameOrAddress, int timeout, byte[] buffer)
|
||||
{
|
||||
return Send(hostNameOrAddress, timeout, buffer, null);
|
||||
}
|
||||
|
||||
public PingReply Send(IPAddress address, int timeout, byte[] buffer)
|
||||
{
|
||||
return Send(address, timeout, buffer, null);
|
||||
}
|
||||
|
||||
public PingReply Send(string hostNameOrAddress, int timeout, byte[] buffer, PingOptions options)
|
||||
{
|
||||
return SendPingAsync(hostNameOrAddress, timeout, buffer, options).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public PingReply Send(IPAddress address, int timeout, byte[] buffer, PingOptions options)
|
||||
{
|
||||
return SendPingAsync(address, timeout, buffer, options).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public void SendAsync(string hostNameOrAddress, object userToken)
|
||||
{
|
||||
SendAsync(hostNameOrAddress, DefaultTimeout, DefaultSendBuffer, userToken);
|
||||
}
|
||||
|
||||
public void SendAsync(string hostNameOrAddress, int timeout, object userToken)
|
||||
{
|
||||
SendAsync(hostNameOrAddress, timeout, DefaultSendBuffer, userToken);
|
||||
}
|
||||
|
||||
public void SendAsync(IPAddress address, object userToken)
|
||||
{
|
||||
SendAsync(address, DefaultTimeout, DefaultSendBuffer, userToken);
|
||||
}
|
||||
|
||||
public void SendAsync(IPAddress address, int timeout, object userToken)
|
||||
{
|
||||
SendAsync(address, timeout, DefaultSendBuffer, userToken);
|
||||
}
|
||||
|
||||
public void SendAsync(string hostNameOrAddress, int timeout, byte[] buffer, object userToken)
|
||||
{
|
||||
SendAsync(hostNameOrAddress, timeout, buffer, null, userToken);
|
||||
}
|
||||
|
||||
public void SendAsync(IPAddress address, int timeout, byte[] buffer, object userToken)
|
||||
{
|
||||
SendAsync(address, timeout, buffer, null, userToken);
|
||||
}
|
||||
|
||||
public void SendAsync(string hostNameOrAddress, int timeout, byte[] buffer, PingOptions options, object userToken)
|
||||
{
|
||||
TranslateTaskToEap(userToken, SendPingAsync(hostNameOrAddress, timeout, buffer, options));
|
||||
}
|
||||
|
||||
public void SendAsync(IPAddress address, int timeout, byte[] buffer, PingOptions options, object userToken)
|
||||
{
|
||||
TranslateTaskToEap(userToken, SendPingAsync(address, timeout, buffer, options));
|
||||
}
|
||||
|
||||
private void TranslateTaskToEap(object userToken, Task<PingReply> pingTask)
|
||||
{
|
||||
pingTask.ContinueWith((t, state) =>
|
||||
{
|
||||
var asyncOp = (AsyncOperation)state;
|
||||
var e = new PingCompletedEventArgs(t.Status == TaskStatus.RanToCompletion ? t.Result : null, t.Exception, t.IsCanceled, asyncOp.UserSuppliedState);
|
||||
SendOrPostCallback callback = _onPingCompletedDelegate ?? (_onPingCompletedDelegate = new SendOrPostCallback(o => { OnPingCompleted((PingCompletedEventArgs)o); }));
|
||||
asyncOp.PostOperationCompleted(callback, e);
|
||||
}, AsyncOperationManager.CreateOperation(userToken), CancellationToken.None, TaskContinuationOptions.DenyChildAttach, TaskScheduler.Default);
|
||||
}
|
||||
|
||||
public Task<PingReply> SendPingAsync(IPAddress address)
|
||||
{
|
||||
return SendPingAsync(address, DefaultTimeout, DefaultSendBuffer, null);
|
||||
}
|
||||
|
||||
public Task<PingReply> SendPingAsync(string hostNameOrAddress)
|
||||
{
|
||||
return SendPingAsync(hostNameOrAddress, DefaultTimeout, DefaultSendBuffer, null);
|
||||
}
|
||||
|
||||
public Task<PingReply> SendPingAsync(IPAddress address, int timeout)
|
||||
{
|
||||
return SendPingAsync(address, timeout, DefaultSendBuffer, null);
|
||||
}
|
||||
|
||||
public Task<PingReply> SendPingAsync(string hostNameOrAddress, int timeout)
|
||||
{
|
||||
return SendPingAsync(hostNameOrAddress, timeout, DefaultSendBuffer, null);
|
||||
}
|
||||
|
||||
public Task<PingReply> SendPingAsync(IPAddress address, int timeout, byte[] buffer)
|
||||
{
|
||||
return SendPingAsync(address, timeout, buffer, null);
|
||||
}
|
||||
|
||||
public Task<PingReply> SendPingAsync(string hostNameOrAddress, int timeout, byte[] buffer)
|
||||
{
|
||||
return SendPingAsync(hostNameOrAddress, timeout, buffer, null);
|
||||
}
|
||||
|
||||
public Task<PingReply> SendPingAsync(IPAddress address, int timeout, byte[] buffer, PingOptions options)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(buffer));
|
||||
}
|
||||
|
||||
if (buffer.Length > MaxBufferSize)
|
||||
{
|
||||
throw new ArgumentException(SR.net_invalidPingBufferSize, nameof(buffer));
|
||||
}
|
||||
|
||||
if (timeout < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(timeout));
|
||||
}
|
||||
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(address));
|
||||
}
|
||||
|
||||
// Check if address family is installed.
|
||||
TestIsIpSupported(address);
|
||||
|
||||
if (address.Equals(IPAddress.Any) || address.Equals(IPAddress.IPv6Any))
|
||||
{
|
||||
throw new ArgumentException(SR.net_invalid_ip_addr, nameof(address));
|
||||
}
|
||||
|
||||
// Need to snapshot the address here, so we're sure that it's not changed between now
|
||||
// and the operation, and to be sure that IPAddress.ToString() is called and not some override.
|
||||
IPAddress addressSnapshot = (address.AddressFamily == AddressFamily.InterNetwork) ?
|
||||
new IPAddress(address.GetAddressBytes()) :
|
||||
new IPAddress(address.GetAddressBytes(), address.ScopeId);
|
||||
|
||||
CheckStart();
|
||||
try
|
||||
{
|
||||
return SendPingAsyncCore(addressSnapshot, buffer, timeout, options);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Finish();
|
||||
return Task.FromException<PingReply>(new PingException(SR.net_ping, e));
|
||||
}
|
||||
}
|
||||
|
||||
public Task<PingReply> SendPingAsync(string hostNameOrAddress, int timeout, byte[] buffer, PingOptions options)
|
||||
{
|
||||
if (string.IsNullOrEmpty(hostNameOrAddress))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(hostNameOrAddress));
|
||||
}
|
||||
|
||||
IPAddress address;
|
||||
if (IPAddress.TryParse(hostNameOrAddress, out address))
|
||||
{
|
||||
return SendPingAsync(address, timeout, buffer, options);
|
||||
}
|
||||
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(buffer));
|
||||
}
|
||||
|
||||
if (buffer.Length > MaxBufferSize)
|
||||
{
|
||||
throw new ArgumentException(SR.net_invalidPingBufferSize, nameof(buffer));
|
||||
}
|
||||
|
||||
if (timeout < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(timeout));
|
||||
}
|
||||
|
||||
CheckStart();
|
||||
return GetAddressAndSendAsync(hostNameOrAddress, timeout, buffer, options);
|
||||
}
|
||||
|
||||
public void SendAsyncCancel()
|
||||
{
|
||||
lock (_lockObject)
|
||||
{
|
||||
if (!_lockObject.IsSet)
|
||||
{
|
||||
// As in the .NET Framework, this doesn't actually cancel an in-progress operation. It just marks it such that
|
||||
// when the operation completes, it's flagged as canceled.
|
||||
_canceled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// As in the .NET Framework, synchronously wait for the in-flight operation to complete.
|
||||
// If there isn't one in flight, this event will already be set.
|
||||
_lockObject.Wait();
|
||||
}
|
||||
|
||||
private async Task<PingReply> GetAddressAndSendAsync(string hostNameOrAddress, int timeout, byte[] buffer, PingOptions options)
|
||||
{
|
||||
bool requiresFinish = true;
|
||||
try
|
||||
{
|
||||
IPAddress[] addresses = await Dns.GetHostAddressesAsync(hostNameOrAddress).ConfigureAwait(false);
|
||||
Task<PingReply> pingReplyTask = SendPingAsyncCore(addresses[0], buffer, timeout, options);
|
||||
requiresFinish = false;
|
||||
return await pingReplyTask.ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// SendPingAsyncCore will call Finish before completing the Task. If SendPingAsyncCore isn't invoked
|
||||
// because an exception is thrown first, or if it throws out an exception synchronously, then
|
||||
// we need to invoke Finish; otherwise, it has the responsibility to invoke Finish.
|
||||
if (requiresFinish)
|
||||
{
|
||||
Finish();
|
||||
}
|
||||
throw new PingException(SR.net_ping, e);
|
||||
}
|
||||
}
|
||||
|
||||
// Tests if the current machine supports the given ip protocol family.
|
||||
private void TestIsIpSupported(IPAddress ip)
|
||||
{
|
||||
InitializeSockets();
|
||||
|
||||
if (ip.AddressFamily == AddressFamily.InterNetwork && !SocketProtocolSupportPal.OSSupportsIPv4)
|
||||
{
|
||||
throw new NotSupportedException(SR.net_ipv4_not_installed);
|
||||
}
|
||||
else if ((ip.AddressFamily == AddressFamily.InterNetworkV6 && !SocketProtocolSupportPal.OSSupportsIPv6))
|
||||
{
|
||||
throw new NotSupportedException(SR.net_ipv6_not_installed);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void InitializeSockets();
|
||||
partial void InternalDisposeCore();
|
||||
|
||||
// Creates a default send buffer if a buffer wasn't specified. This follows the ping.exe model.
|
||||
private byte[] DefaultSendBuffer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_defaultSendBuffer == null)
|
||||
{
|
||||
_defaultSendBuffer = new byte[DefaultSendBufferSize];
|
||||
for (int i = 0; i < DefaultSendBufferSize; i++)
|
||||
_defaultSendBuffer[i] = (byte)((int)'a' + i % 23);
|
||||
}
|
||||
return _defaultSendBuffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
20
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/PingCompletedEventArgs.cs
vendored
Normal file
20
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/PingCompletedEventArgs.cs
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace System.Net.NetworkInformation
|
||||
{
|
||||
public delegate void PingCompletedEventHandler(object sender, PingCompletedEventArgs e);
|
||||
|
||||
public class PingCompletedEventArgs : AsyncCompletedEventArgs
|
||||
{
|
||||
internal PingCompletedEventArgs(PingReply reply, Exception error, bool cancelled, object userToken) : base(error, cancelled, userToken)
|
||||
{
|
||||
Reply = reply;
|
||||
}
|
||||
|
||||
public PingReply Reply { get; }
|
||||
}
|
||||
}
|
27
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/PingException.cs
vendored
Normal file
27
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/PingException.cs
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Net.NetworkInformation
|
||||
{
|
||||
[Serializable]
|
||||
public class PingException : InvalidOperationException
|
||||
{
|
||||
public PingException(string message) :
|
||||
base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public PingException(string message, Exception innerException) :
|
||||
base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
protected PingException(SerializationInfo serializationInfo, StreamingContext streamingContext) :
|
||||
base(serializationInfo, streamingContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
59
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/PingOptions.cs
vendored
Normal file
59
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/PingOptions.cs
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Net.NetworkInformation
|
||||
{
|
||||
public class PingOptions
|
||||
{
|
||||
private int _ttl;
|
||||
private bool _dontFragment;
|
||||
|
||||
public PingOptions()
|
||||
{
|
||||
_ttl = 128;
|
||||
}
|
||||
|
||||
public PingOptions(int ttl, bool dontFragment)
|
||||
{
|
||||
if (ttl <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(ttl));
|
||||
}
|
||||
|
||||
_ttl = ttl;
|
||||
_dontFragment = dontFragment;
|
||||
}
|
||||
|
||||
public int Ttl
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ttl;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(value));
|
||||
}
|
||||
|
||||
// Useful to discover routes.
|
||||
_ttl = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool DontFragment
|
||||
{
|
||||
get
|
||||
{
|
||||
return _dontFragment;
|
||||
}
|
||||
set
|
||||
{
|
||||
// Useful for discovering MTU.
|
||||
_dontFragment = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
39
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/PingReply.cs
vendored
Normal file
39
external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/PingReply.cs
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Net.NetworkInformation
|
||||
{
|
||||
public class PingReply
|
||||
{
|
||||
private readonly IPAddress _address;
|
||||
private readonly PingOptions _options;
|
||||
private readonly IPStatus _ipStatus;
|
||||
private readonly long _rtt;
|
||||
private readonly byte[] _buffer;
|
||||
|
||||
internal PingReply(
|
||||
IPAddress address,
|
||||
PingOptions options,
|
||||
IPStatus ipStatus,
|
||||
long rtt,
|
||||
byte[] buffer)
|
||||
{
|
||||
_address = address;
|
||||
_options = options;
|
||||
_ipStatus = ipStatus;
|
||||
_rtt = rtt;
|
||||
_buffer = buffer;
|
||||
}
|
||||
|
||||
public IPStatus Status { get { return _ipStatus; } }
|
||||
|
||||
public IPAddress Address { get { return _address; } }
|
||||
|
||||
public long RoundtripTime { get { return _rtt; } }
|
||||
|
||||
public PingOptions Options { get { return _options; } }
|
||||
|
||||
public byte[] Buffer { get { return _buffer; } }
|
||||
}
|
||||
}
|
10
external/corefx/src/System.Net.Ping/tests/FunctionalTests/Configurations.props
vendored
Normal file
10
external/corefx/src/System.Net.Ping/tests/FunctionalTests/Configurations.props
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netstandard-Unix;
|
||||
netstandard-Windows_NT;
|
||||
netstandard1.3;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user