Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[System.Net] Introduce CIDR IPNetwork #82779

Merged
merged 14 commits into from
Mar 27, 2023
26 changes: 26 additions & 0 deletions src/libraries/System.Net.Primitives/ref/System.Net.Primitives.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,32 @@ public IPEndPoint(System.Net.IPAddress address, int port) { }
public static bool TryParse(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Net.IPEndPoint? result) { throw null; }
public static bool TryParse(string s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Net.IPEndPoint? result) { throw null; }
}
public readonly partial struct IPNetwork : System.IEquatable<System.Net.IPNetwork>, System.IFormattable, System.IParsable<System.Net.IPNetwork>, System.ISpanFormattable, System.ISpanParsable<System.Net.IPNetwork>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public IPNetwork(System.Net.IPAddress baseAddress, int prefixLength) { throw null; }
public System.Net.IPAddress BaseAddress { get { throw null; } }
public int PrefixLength { get { throw null; } }
public bool Contains(System.Net.IPAddress address) { throw null; }
public bool Equals(System.Net.IPNetwork other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Net.IPNetwork left, System.Net.IPNetwork right) { throw null; }
public static bool operator !=(System.Net.IPNetwork left, System.Net.IPNetwork right) { throw null; }
public static System.Net.IPNetwork Parse(System.ReadOnlySpan<char> s) { throw null; }
public static System.Net.IPNetwork Parse(string s) { throw null; }
string System.IFormattable.ToString(string? format, System.IFormatProvider? provider) { throw null; }
static System.Net.IPNetwork System.IParsable<System.Net.IPNetwork>.Parse([System.Diagnostics.CodeAnalysis.NotNullAttribute] string s, System.IFormatProvider? provider) { throw null; }
static bool System.IParsable<System.Net.IPNetwork>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.Net.IPNetwork result) { throw null; }
bool System.ISpanFormattable.TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format, System.IFormatProvider? provider) { throw null; }
static System.Net.IPNetwork System.ISpanParsable<System.Net.IPNetwork>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
static bool System.ISpanParsable<System.Net.IPNetwork>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out System.Net.IPNetwork result) { throw null; }
public override string ToString() { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Net.IPNetwork result) { throw null; }
public static bool TryParse(string? s, out System.Net.IPNetwork result) { throw null; }
}
public partial interface IWebProxy
{
System.Net.ICredentials? Credentials { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@
<data name="dns_bad_ip_address" xml:space="preserve">
<value>An invalid IP address was specified.</value>
</data>
<data name="net_bad_ip_network" xml:space="preserve">
<value>An invalid IP network was specified.</value>
</data>
<data name="net_bad_ip_network_invalid_baseaddress" xml:space="preserve">
<value>The specified baseAddress has non-zero bits after the network prefix.</value>
</data>
<data name="net_uninitialized_ip_network_instance" xml:space="preserve">
<value>Uninitialized IPNetwork instance.</value>
</data>
<data name="net_container_add_cookie" xml:space="preserve">
<value>An error occurred when adding a cookie to the container.</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<Compile Include="System\Net\ICredentials.cs" />
<Compile Include="System\Net\ICredentialsByHost.cs" />
<Compile Include="System\Net\IPAddress.cs" />
<Compile Include="System\Net\IPNetwork.cs" />
<Compile Include="System\Net\IPAddressParser.cs" />
<Compile Include="System\Net\IPEndPoint.cs" />
<Compile Include="$(CommonPath)System\Net\IPv4AddressHelper.Common.cs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ private bool IsIPv6
get { return _numbers != null; }
}

private uint PrivateAddress
internal uint PrivateAddress
{
get
{
Debug.Assert(IsIPv4);
return _addressOrScopeId;
}
set
private set
{
Debug.Assert(IsIPv4);
_toString = null;
Expand Down
Loading