INetworkManager.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using MediaBrowser.Model.IO;
  2. using MediaBrowser.Model.Net;
  3. using System.Collections.Generic;
  4. using System.Net;
  5. using System.Threading.Tasks;
  6. namespace MediaBrowser.Common.Net
  7. {
  8. public interface INetworkManager
  9. {
  10. /// <summary>
  11. /// Gets a random port number that is currently available
  12. /// </summary>
  13. /// <returns>System.Int32.</returns>
  14. int GetRandomUnusedTcpPort();
  15. int GetRandomUnusedUdpPort();
  16. /// <summary>
  17. /// Returns MAC Address from first Network Card in Computer
  18. /// </summary>
  19. /// <returns>[string] MAC Address</returns>
  20. string GetMacAddress();
  21. /// <summary>
  22. /// Determines whether [is in private address space] [the specified endpoint].
  23. /// </summary>
  24. /// <param name="endpoint">The endpoint.</param>
  25. /// <returns><c>true</c> if [is in private address space] [the specified endpoint]; otherwise, <c>false</c>.</returns>
  26. bool IsInPrivateAddressSpace(string endpoint);
  27. /// <summary>
  28. /// Gets the network shares.
  29. /// </summary>
  30. /// <param name="path">The path.</param>
  31. /// <returns>IEnumerable{NetworkShare}.</returns>
  32. IEnumerable<NetworkShare> GetNetworkShares(string path);
  33. /// <summary>
  34. /// Gets available devices within the domain
  35. /// </summary>
  36. /// <returns>PC's in the Domain</returns>
  37. IEnumerable<FileSystemEntryInfo> GetNetworkDevices();
  38. /// <summary>
  39. /// Determines whether [is in local network] [the specified endpoint].
  40. /// </summary>
  41. /// <param name="endpoint">The endpoint.</param>
  42. /// <returns><c>true</c> if [is in local network] [the specified endpoint]; otherwise, <c>false</c>.</returns>
  43. bool IsInLocalNetwork(string endpoint);
  44. List<IpAddressInfo> GetLocalIpAddresses();
  45. IpAddressInfo ParseIpAddress(string ipAddress);
  46. bool TryParseIpAddress(string ipAddress, out IpAddressInfo ipAddressInfo);
  47. Task<IpAddressInfo[]> GetHostAddressesAsync(string host);
  48. }
  49. }