aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Net/INetworkManager.cs
blob: 3ba75abd8550b6f223d446a002888d7eb1c5b4d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#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;

        Func<string[]> LocalSubnetsFn { get; set; }

        /// <summary>
        /// Gets a random port number that is currently available.
        /// </summary>
        /// <returns>System.Int32.</returns>
        int GetRandomUnusedTcpPort();

        int GetRandomUnusedUdpPort();

        /// <summary>
        /// Returns the MAC Address from first Network Card in Computer.
        /// </summary>
        /// <returns>The MAC Address.</returns>
        List<PhysicalAddress> GetMacAddresses();

        /// <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);

        bool IsAddressInSubnets(string addressString, string[] subnets);

        bool IsInSameSubnet(IPAddress address1, IPAddress address2, IPAddress subnetMask);

        IPAddress GetLocalIpSubnetMask(IPAddress address);
    }
}