INetworkManager.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 GetRandomUnusedPort();
  15. /// <summary>
  16. /// Returns MAC Address from first Network Card in Computer
  17. /// </summary>
  18. /// <returns>[string] MAC Address</returns>
  19. string GetMacAddress();
  20. /// <summary>
  21. /// Determines whether [is in private address space] [the specified endpoint].
  22. /// </summary>
  23. /// <param name="endpoint">The endpoint.</param>
  24. /// <returns><c>true</c> if [is in private address space] [the specified endpoint]; otherwise, <c>false</c>.</returns>
  25. bool IsInPrivateAddressSpace(string endpoint);
  26. /// <summary>
  27. /// Gets the network shares.
  28. /// </summary>
  29. /// <param name="path">The path.</param>
  30. /// <returns>IEnumerable{NetworkShare}.</returns>
  31. IEnumerable<NetworkShare> GetNetworkShares(string path);
  32. /// <summary>
  33. /// Gets available devices within the domain
  34. /// </summary>
  35. /// <returns>PC's in the Domain</returns>
  36. IEnumerable<FileSystemEntryInfo> GetNetworkDevices();
  37. /// <summary>
  38. /// Determines whether [is in local network] [the specified endpoint].
  39. /// </summary>
  40. /// <param name="endpoint">The endpoint.</param>
  41. /// <returns><c>true</c> if [is in local network] [the specified endpoint]; otherwise, <c>false</c>.</returns>
  42. bool IsInLocalNetwork(string endpoint);
  43. IEnumerable<IpAddressInfo> GetLocalIpAddresses();
  44. IpAddressInfo ParseIpAddress(string ipAddress);
  45. bool TryParseIpAddress(string ipAddress, out IpAddressInfo ipAddressInfo);
  46. Task<IpAddressInfo[]> GetHostAddressesAsync(string host);
  47. /// <summary>
  48. /// Generates a self signed certificate at the locatation specified by <paramref name="certificatePath"/>.
  49. /// </summary>
  50. /// <param name="certificatePath">The path to generate the certificate.</param>
  51. /// <param name="hostname">The common name for the certificate.</param>
  52. void GenerateSelfSignedSslCertificate(string certificatePath, string hostname);
  53. }
  54. }