INetworkManager.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #pragma warning disable CS1591
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Net;
  5. using System.Net.NetworkInformation;
  6. using MediaBrowser.Model.IO;
  7. using MediaBrowser.Model.Net;
  8. namespace MediaBrowser.Common.Net
  9. {
  10. public interface INetworkManager
  11. {
  12. event EventHandler NetworkChanged;
  13. /// <summary>
  14. /// Gets a random port number that is currently available
  15. /// </summary>
  16. /// <returns>System.Int32.</returns>
  17. int GetRandomUnusedTcpPort();
  18. int GetRandomUnusedUdpPort();
  19. Func<string[]> LocalSubnetsFn { get; set; }
  20. /// <summary>
  21. /// Returns MAC Address from first Network Card in Computer
  22. /// </summary>
  23. /// <returns>[string] MAC Address</returns>
  24. List<PhysicalAddress> GetMacAddresses();
  25. /// <summary>
  26. /// Determines whether [is in private address space] [the specified endpoint].
  27. /// </summary>
  28. /// <param name="endpoint">The endpoint.</param>
  29. /// <returns><c>true</c> if [is in private address space] [the specified endpoint]; otherwise, <c>false</c>.</returns>
  30. bool IsInPrivateAddressSpace(string endpoint);
  31. /// <summary>
  32. /// Gets the network shares.
  33. /// </summary>
  34. /// <param name="path">The path.</param>
  35. /// <returns>IEnumerable{NetworkShare}.</returns>
  36. IEnumerable<NetworkShare> GetNetworkShares(string path);
  37. /// <summary>
  38. /// Gets available devices within the domain
  39. /// </summary>
  40. /// <returns>PC's in the Domain</returns>
  41. IEnumerable<FileSystemEntryInfo> GetNetworkDevices();
  42. /// <summary>
  43. /// Determines whether [is in local network] [the specified endpoint].
  44. /// </summary>
  45. /// <param name="endpoint">The endpoint.</param>
  46. /// <returns><c>true</c> if [is in local network] [the specified endpoint]; otherwise, <c>false</c>.</returns>
  47. bool IsInLocalNetwork(string endpoint);
  48. IPAddress[] GetLocalIpAddresses(bool ignoreVirtualInterface);
  49. bool IsAddressInSubnets(string addressString, string[] subnets);
  50. bool IsInSameSubnet(IPAddress address1, IPAddress address2, IPAddress subnetMask);
  51. IPAddress GetLocalIpSubnetMask(IPAddress address);
  52. }
  53. }