jellyfin/MediaBrowser.Common/Net/INetworkManager.cs

53 lines
1.7 KiB
C#
Raw Normal View History

#pragma warning disable CS1591
2018-12-27 23:27:57 +00:00
using System;
using System.Collections.Generic;
using System.Net;
2019-08-09 21:16:24 +00:00
using System.Net.NetworkInformation;
2018-12-27 23:27:57 +00:00
namespace MediaBrowser.Common.Net
{
public interface INetworkManager
{
event EventHandler NetworkChanged;
2019-12-10 23:13:57 +00:00
Func<string[]> LocalSubnetsFn { get; set; }
2018-12-27 23:27:57 +00:00
/// <summary>
2019-12-10 23:13:57 +00:00
/// Gets a random port number that is currently available.
2018-12-27 23:27:57 +00:00
/// </summary>
/// <returns>System.Int32.</returns>
int GetRandomUnusedTcpPort();
int GetRandomUnusedUdpPort();
/// <summary>
2019-12-10 23:13:57 +00:00
/// Returns the MAC Address from first Network Card in Computer.
2018-12-27 23:27:57 +00:00
/// </summary>
2019-12-10 23:13:57 +00:00
/// <returns>The MAC Address.</returns>
2019-08-09 21:16:24 +00:00
List<PhysicalAddress> GetMacAddresses();
2018-12-27 23:27:57 +00:00
/// <summary>
/// Determines whether [is in private address space] [the specified endpoint].
/// </summary>
/// <param name="endpoint">The endpoint.</param>
/// <returns><c>true</c> if [is in private address space] [the specified endpoint]; otherwise, <c>false</c>.</returns>
bool IsInPrivateAddressSpace(string endpoint);
/// <summary>
/// Determines whether [is in local network] [the specified endpoint].
/// </summary>
/// <param name="endpoint">The endpoint.</param>
/// <returns><c>true</c> if [is in local network] [the specified endpoint]; otherwise, <c>false</c>.</returns>
bool IsInLocalNetwork(string endpoint);
IPAddress[] GetLocalIpAddresses(bool ignoreVirtualInterface);
2018-12-27 23:27:57 +00:00
bool IsAddressInSubnets(string addressString, string[] subnets);
bool IsInSameSubnet(IPAddress address1, IPAddress address2, IPAddress subnetMask);
IPAddress GetLocalIpSubnetMask(IPAddress address);
2018-12-27 23:27:57 +00:00
}
}