2
0

INetworkManager.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using MediaBrowser.Model.Net;
  2. using System.Collections.Generic;
  3. namespace MediaBrowser.Common.Net
  4. {
  5. public interface INetworkManager
  6. {
  7. /// <summary>
  8. /// Gets the machine's local ip address
  9. /// </summary>
  10. /// <returns>IPAddress.</returns>
  11. string GetLocalIpAddress();
  12. /// <summary>
  13. /// Gets a random port number that is currently available
  14. /// </summary>
  15. /// <returns>System.Int32.</returns>
  16. int GetRandomUnusedPort();
  17. /// <summary>
  18. /// Creates the netsh URL registration.
  19. /// </summary>
  20. void AuthorizeHttpListening(string url);
  21. /// <summary>
  22. /// Adds the windows firewall rule.
  23. /// </summary>
  24. /// <param name="port">The port.</param>
  25. /// <param name="protocol">The protocol.</param>
  26. void AddSystemFirewallRule(int port, NetworkProtocol protocol);
  27. /// <summary>
  28. /// Removes the windows firewall rule.
  29. /// </summary>
  30. /// <param name="port">The port.</param>
  31. /// <param name="protocol">The protocol.</param>
  32. void RemoveSystemFirewallRule(int port, NetworkProtocol protocol);
  33. /// <summary>
  34. /// Returns MAC Address from first Network Card in Computer
  35. /// </summary>
  36. /// <returns>[string] MAC Address</returns>
  37. string GetMacAddress();
  38. /// <summary>
  39. /// Gets available devices within the domain
  40. /// </summary>
  41. /// <returns>PC's in the Domain</returns>
  42. IEnumerable<string> GetNetworkDevices();
  43. /// <summary>
  44. /// Gets the network shares.
  45. /// </summary>
  46. /// <param name="path">The path.</param>
  47. /// <returns>IEnumerable{NetworkShare}.</returns>
  48. IEnumerable<NetworkShare> GetNetworkShares(string path);
  49. }
  50. /// <summary>
  51. /// Enum NetworkProtocol
  52. /// </summary>
  53. public enum NetworkProtocol
  54. {
  55. /// <summary>
  56. /// The TCP
  57. /// </summary>
  58. Tcp,
  59. /// <summary>
  60. /// The UDP
  61. /// </summary>
  62. Udp
  63. }
  64. }