INetworkManager.cs 2.2 KB

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