2019-10-09 08:10:16 -07:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
using System;
|
2019-01-13 12:25:11 -07:00
|
|
|
using System.Collections.Generic;
|
2019-07-07 12:03:26 -07:00
|
|
|
using System.Net;
|
2019-08-09 14:16:24 -07:00
|
|
|
using System.Net.NetworkInformation;
|
2018-12-27 16:27:57 -07:00
|
|
|
|
|
|
|
namespace MediaBrowser.Common.Net
|
|
|
|
{
|
|
|
|
public interface INetworkManager
|
|
|
|
{
|
|
|
|
event EventHandler NetworkChanged;
|
|
|
|
|
2019-12-10 16:13:57 -07:00
|
|
|
Func<string[]> LocalSubnetsFn { get; set; }
|
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
/// <summary>
|
2019-12-10 16:13:57 -07:00
|
|
|
/// Gets a random port number that is currently available.
|
2018-12-27 16:27:57 -07:00
|
|
|
/// </summary>
|
|
|
|
/// <returns>System.Int32.</returns>
|
|
|
|
int GetRandomUnusedTcpPort();
|
|
|
|
|
|
|
|
int GetRandomUnusedUdpPort();
|
|
|
|
|
|
|
|
/// <summary>
|
2019-12-10 16:13:57 -07:00
|
|
|
/// Returns the MAC Address from first Network Card in Computer.
|
2018-12-27 16:27:57 -07:00
|
|
|
/// </summary>
|
2019-12-10 16:13:57 -07:00
|
|
|
/// <returns>The MAC Address.</returns>
|
2019-08-09 14:16:24 -07:00
|
|
|
List<PhysicalAddress> GetMacAddresses();
|
2018-12-27 16:27:57 -07: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);
|
|
|
|
|
2019-07-07 12:03:26 -07:00
|
|
|
IPAddress[] GetLocalIpAddresses(bool ignoreVirtualInterface);
|
2018-12-27 16:27:57 -07:00
|
|
|
|
|
|
|
bool IsAddressInSubnets(string addressString, string[] subnets);
|
2019-02-21 21:06:49 -07:00
|
|
|
|
2019-07-07 12:03:26 -07:00
|
|
|
bool IsInSameSubnet(IPAddress address1, IPAddress address2, IPAddress subnetMask);
|
|
|
|
|
|
|
|
IPAddress GetLocalIpSubnetMask(IPAddress address);
|
2018-12-27 16:27:57 -07:00
|
|
|
}
|
2019-01-13 12:30:41 -07:00
|
|
|
}
|