aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Net
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Common/Net')
-rw-r--r--MediaBrowser.Common/Net/CacheMode.cs11
-rw-r--r--MediaBrowser.Common/Net/CompressionMethods.cs15
-rw-r--r--MediaBrowser.Common/Net/HttpRequestOptions.cs14
-rw-r--r--MediaBrowser.Common/Net/INetworkManager.cs49
4 files changed, 73 insertions, 16 deletions
diff --git a/MediaBrowser.Common/Net/CacheMode.cs b/MediaBrowser.Common/Net/CacheMode.cs
new file mode 100644
index 000000000..78fa3bf9b
--- /dev/null
+++ b/MediaBrowser.Common/Net/CacheMode.cs
@@ -0,0 +1,11 @@
+#pragma warning disable CS1591
+#pragma warning disable SA1602
+
+namespace MediaBrowser.Common.Net
+{
+ public enum CacheMode
+ {
+ None = 0,
+ Unconditional = 1
+ }
+}
diff --git a/MediaBrowser.Common/Net/CompressionMethods.cs b/MediaBrowser.Common/Net/CompressionMethods.cs
new file mode 100644
index 000000000..39b72609f
--- /dev/null
+++ b/MediaBrowser.Common/Net/CompressionMethods.cs
@@ -0,0 +1,15 @@
+#pragma warning disable CS1591
+#pragma warning disable SA1602
+
+using System;
+
+namespace MediaBrowser.Common.Net
+{
+ [Flags]
+ public enum CompressionMethods
+ {
+ None = 0b00000001,
+ Deflate = 0b00000010,
+ Gzip = 0b00000100
+ }
+}
diff --git a/MediaBrowser.Common/Net/HttpRequestOptions.cs b/MediaBrowser.Common/Net/HttpRequestOptions.cs
index 38274a80e..347fc9833 100644
--- a/MediaBrowser.Common/Net/HttpRequestOptions.cs
+++ b/MediaBrowser.Common/Net/HttpRequestOptions.cs
@@ -102,18 +102,4 @@ namespace MediaBrowser.Common.Net
return value;
}
}
-
- public enum CacheMode
- {
- None = 0,
- Unconditional = 1
- }
-
- [Flags]
- public enum CompressionMethods
- {
- None = 0b00000001,
- Deflate = 0b00000010,
- Gzip = 0b00000100
- }
}
diff --git a/MediaBrowser.Common/Net/INetworkManager.cs b/MediaBrowser.Common/Net/INetworkManager.cs
index 3ba75abd8..a0330afef 100644
--- a/MediaBrowser.Common/Net/INetworkManager.cs
+++ b/MediaBrowser.Common/Net/INetworkManager.cs
@@ -11,14 +11,21 @@ namespace MediaBrowser.Common.Net
{
event EventHandler NetworkChanged;
+ /// <summary>
+ /// Gets or sets a function to return the list of user defined LAN addresses.
+ /// </summary>
Func<string[]> LocalSubnetsFn { get; set; }
/// <summary>
- /// Gets a random port number that is currently available.
+ /// Gets a random port TCP number that is currently available.
/// </summary>
/// <returns>System.Int32.</returns>
int GetRandomUnusedTcpPort();
+ /// <summary>
+ /// Gets a random port UDP number that is currently available.
+ /// </summary>
+ /// <returns>System.Int32.</returns>
int GetRandomUnusedUdpPort();
/// <summary>
@@ -35,18 +42,56 @@ namespace MediaBrowser.Common.Net
bool IsInPrivateAddressSpace(string endpoint);
/// <summary>
+ /// Determines whether [is in private address space 10.x.x.x] [the specified endpoint] and exists in the subnets returned by GetSubnets().
+ /// </summary>
+ /// <param name="endpoint">The endpoint.</param>
+ /// <returns><c>true</c> if [is in private address space 10.x.x.x] [the specified endpoint]; otherwise, <c>false</c>.</returns>
+ bool IsInPrivateAddressSpaceAndLocalSubnet(string endpoint);
+
+ /// <summary>
/// Determines whether [is in local network] [the specified endpoint].
/// </summary>
/// <param name="endpoint">The endpoint.</param>
/// <returns><c>true</c> if [is in local network] [the specified endpoint]; otherwise, <c>false</c>.</returns>
bool IsInLocalNetwork(string endpoint);
- IPAddress[] GetLocalIpAddresses(bool ignoreVirtualInterface);
+ /// <summary>
+ /// Investigates an caches a list of interface addresses, excluding local link and LAN excluded addresses.
+ /// </summary>
+ /// <returns>The list of ipaddresses.</returns>
+ IPAddress[] GetLocalIpAddresses();
+ /// <summary>
+ /// Checks if the given address falls within the ranges given in [subnets]. The addresses in subnets can be hosts or subnets in the CIDR format.
+ /// </summary>
+ /// <param name="addressString">The address to check.</param>
+ /// <param name="subnets">If true, check against addresses in the LAN settings surrounded by brackets ([]).</param>
+ /// <returns><c>true</c>if the address is in at least one of the given subnets, <c>false</c> otherwise.</returns>
bool IsAddressInSubnets(string addressString, string[] subnets);
+ /// <summary>
+ /// Returns true if address is in the LAN list in the config file.
+ /// </summary>
+ /// <param name="address">The address to check.</param>
+ /// <param name="excludeInterfaces">If true, check against addresses in the LAN settings which have [] arroud and return true if it matches the address give in address.</param>
+ /// <param name="excludeRFC">If true, returns false if address is in the 127.x.x.x or 169.128.x.x range.</param>
+ /// <returns><c>false</c>if the address isn't in the LAN list, <c>true</c> if the address has been defined as a LAN address.</returns>
+ bool IsAddressInSubnets(IPAddress address, bool excludeInterfaces, bool excludeRFC);
+
+ /// <summary>
+ /// Checks if address is in the LAN list in the config file.
+ /// </summary>
+ /// <param name="address1">Source address to check.</param>
+ /// <param name="address2">Destination address to check against.</param>
+ /// <param name="subnetMask">Destination subnet to check against.</param>
+ /// <returns><c>true/false</c>depending on whether address1 is in the same subnet as IPAddress2 with subnetMask.</returns>
bool IsInSameSubnet(IPAddress address1, IPAddress address2, IPAddress subnetMask);
+ /// <summary>
+ /// Returns the subnet mask of an interface with the given address.
+ /// </summary>
+ /// <param name="address">The address to check.</param>
+ /// <returns>Returns the subnet mask of an interface with the given address, or null if an interface match cannot be found.</returns>
IPAddress GetLocalIpSubnetMask(IPAddress address);
}
}