#pragma warning disable CS1591 using System; using System.Collections.Generic; using System.Net; using System.Net.NetworkInformation; namespace MediaBrowser.Common.Net { public interface INetworkManager { event EventHandler NetworkChanged; /// /// Contains a function to return the list of user defined LAN addresses /// Func LocalSubnetsFn { get; set; } /// /// Gets a random port TCP number that is currently available. /// /// System.Int32. int GetRandomUnusedTcpPort(); /// /// Gets a random port UDP number that is currently available. /// /// System.Int32. int GetRandomUnusedUdpPort(); /// /// Returns the MAC Address from first Network Card in Computer. /// /// The MAC Address. List GetMacAddresses(); /// /// Determines whether [is in private address space] [the specified endpoint]. /// /// The endpoint. /// true if [is in private address space] [the specified endpoint]; otherwise, false. bool IsInPrivateAddressSpace(string endpoint); /// /// Determines whether [is in private address space 10.x.x.x] [the specified endpoint] and exists in the subnets returned by GetSubnets(). /// /// The endpoint. /// true if [is in private address space 10.x.x.x] [the specified endpoint]; otherwise, false. bool IsInPrivateAddressSpaceAndLocalSubnet(string endpoint); /// /// Determines whether [is in local network] [the specified endpoint]. /// /// The endpoint. /// true if [is in local network] [the specified endpoint]; otherwise, false. bool IsInLocalNetwork(string endpoint); /// /// Investigates an caches a list of interface addresses, excluding local link and LAN excluded addresses /// /// The list of ipaddresses IPAddress[] GetLocalIpAddresses(); /// /// Checks if the given address falls within the ranges given in [subnets]. The addresses in subnets can be hosts or subnets in the CIDR format. /// /// The address to check /// If true, check against addresses in the LAN settings surrounded by brackets ([]) /// trueif the address is in at least one of the given subnets, false otherwise. bool IsAddressInSubnets(string addressString, string[] subnets); /// /// Returns true if address is in the LAN list in the config file /// /// The address to check /// If true, check against addresses in the LAN settings which have [] arroud and return true if it matches the address give in address /// If true, returns false if address is in the 127.x.x.x or 169.128.x.x range /// falseif the address isn't in the LAN list, true if the address has been defined as a LAN address bool IsAddressInSubnets(IPAddress address, bool excludeInterfaces, bool excludeRFC); /// /// Checks if address is in the LAN list in the config file /// /// Source address to check /// Destination address to check against /// Destination subnet to check against /// true/falsedepending on whether address1 is in the same subnet as IPAddress2 with subnetMas bool IsInSameSubnet(IPAddress address1, IPAddress address2, IPAddress subnetMask); /// /// Returns the subnet mask of an interface with the given address /// /// The address to check /// Returns the subnet mask of an interface with the given address, or null if an interface match cannot be found IPAddress GetLocalIpSubnetMask(IPAddress address); } }