The Free Software Media System - Server Backend & API
removed dead code
Luke Pulverentiab61dcaf9075
diff --git a/Mono.Nat/Mono.Nat.csproj b/Mono.Nat/Mono.Nat.csprojindex abf10f5130..426824f0df 100644--- a/Mono.Nat/Mono.Nat.csproj+++ b/Mono.Nat/Mono.Nat.csproj@@ -67,7 +67,6 @@<Compile Include="Upnp\Messages\Responses\CreatePortMappingResponseMessage.cs" /><Compile Include="Upnp\Messages\UpnpMessage.cs" /><Compile Include="Upnp\Searchers\UpnpSearcher.cs" />- <Compile Include="Upnp\Upnp.cs" /><Compile Include="Upnp\UpnpNatDevice.cs" /></ItemGroup><ItemGroup>diff --git a/Mono.Nat/Upnp/Upnp.cs b/Mono.Nat/Upnp/Upnp.csdeleted file mode 100644index e9321f8741..0000000000--- a/Mono.Nat/Upnp/Upnp.cs+++ /dev/null@@ -1,95 +0,0 @@-//-// Authors:-// Alan McGovern [email protected]-// Ben Motmans <[email protected]>-// Nicholas Terry <[email protected]>-//-// Copyright (C) 2006 Alan McGovern-// Copyright (C) 2007 Ben Motmans-// Copyright (C) 2014 Nicholas Terry-//-// Permission is hereby granted, free of charge, to any person obtaining-// a copy of this software and associated documentation files (the-// "Software"), to deal in the Software without restriction, including-// without limitation the rights to use, copy, modify, merge, publish,-// distribute, sublicense, and/or sell copies of the Software, and to-// permit persons to whom the Software is furnished to do so, subject to-// the following conditions:-//-// The above copyright notice and this permission notice shall be-// included in all copies or substantial portions of the Software.-//-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.-//--using System;-using System.Collections.Generic;-using System.Net;-using System.Text;-using System.Threading.Tasks;-using MediaBrowser.Common.Net;-using MediaBrowser.Model.Logging;--namespace Mono.Nat.Upnp-{- internal class Upnp- {- protected readonly ILogger Logger;- protected readonly IHttpClient HttpClient;-- public Upnp(ILogger logger, IHttpClient httpClient)- {- Logger = logger;- HttpClient = httpClient;- }-- public virtual Task<UpnpNatDevice> Handle(IPAddress localAddress, byte[] response, IPEndPoint endpoint)- {- // Convert it to a string for easy parsing- string dataString = null;--- string urn;- dataString = Encoding.UTF8.GetString(response);-- if (NatUtility.Verbose)- NatUtility.Log("UPnP Response: {0}", dataString);-- /* For UPnP Port Mapping we need ot find either WANPPPConnection or WANIPConnection.- Any other device type is no good to us for this purpose. See the IGP overview paper- page 5 for an overview of device types and their hierarchy.- http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v1-Device.pdf */-- /* TODO: Currently we are assuming version 1 of the protocol. We should figure out which- version it is and apply the correct URN. */-- /* Some routers don't correctly implement the version ID on the URN, so we only search for the type- prefix. */-- string log = "UPnP Response: Router advertised a '{0}' service";- StringComparison c = StringComparison.OrdinalIgnoreCase;- if (dataString.IndexOf("urn:schemas-upnp-org:service:WANIPConnection:", c) != -1)- {- urn = "urn:schemas-upnp-org:service:WANIPConnection:1";- NatUtility.Log(log, "urn:schemas-upnp-org:service:WANIPConnection:1");- }- else if (dataString.IndexOf("urn:schemas-upnp-org:service:WANPPPConnection:", c) != -1)- {- urn = "urn:schemas-upnp-org:service:WANPPPConnection:1";- NatUtility.Log(log, "urn:schemas-upnp-org:service:WANPPPConnection:");- }- else- throw new NotSupportedException("Received non-supported device type");-- // We have an internet gateway device now- var device = new UpnpNatDevice(localAddress, dataString, urn, Logger, HttpClient);- return Task.FromResult(device);- }- }-}diff --git a/Mono.Nat/Upnp/UpnpNatDevice.cs b/Mono.Nat/Upnp/UpnpNatDevice.csindex ebb1426d1a..2c0fd11055 100644--- a/Mono.Nat/Upnp/UpnpNatDevice.cs+++ b/Mono.Nat/Upnp/UpnpNatDevice.cs@@ -90,55 +90,6 @@ namespace Mono.Nat.Upnp}}- internal UpnpNatDevice(IPAddress localAddress, string deviceDetails, string serviceType, ILogger logger, IHttpClient httpClient)- {- _logger = logger;- _httpClient = httpClient;- this.LastSeen = DateTime.Now;- this.localAddress = localAddress;-- // Split the string at the "location" section so i can extract the ipaddress and service description url- string locationDetails = deviceDetails.Substring(deviceDetails.IndexOf("Location", StringComparison.OrdinalIgnoreCase) + 9).Split('\r')[0];- this.serviceType = serviceType;-- // Make sure we have no excess whitespace- locationDetails = locationDetails.Trim();-- // FIXME: Is this reliable enough. What if we get a hostname as opposed to a proper http address- // Are we going to get addresses with the "http://" attached?- if (locationDetails.StartsWith("http://", StringComparison.OrdinalIgnoreCase))- {- NatUtility.Log("Found device at: {0}", locationDetails);- // This bit strings out the "http://" from the string- locationDetails = locationDetails.Substring(7);-- // We then split off the end of the string to get something like: 192.168.0.3:241 in our string- string hostAddressAndPort = locationDetails.Remove(locationDetails.IndexOf('/'));-- // From this we parse out the IP address and Port- if (hostAddressAndPort.IndexOf(':') > 0)- {- this.hostEndPoint = new IPEndPoint(IPAddress.Parse(hostAddressAndPort.Remove(hostAddressAndPort.IndexOf(':'))),- Convert.ToUInt16(hostAddressAndPort.Substring(hostAddressAndPort.IndexOf(':') + 1), System.Globalization.CultureInfo.InvariantCulture));- }- else- {- // there is no port specified, use default port (80)- this.hostEndPoint = new IPEndPoint(IPAddress.Parse(hostAddressAndPort), 80);- }-- NatUtility.Log("Parsed device as: {0}", this.hostEndPoint.ToString());-- // The service description URL is the remainder of the "locationDetails" string. The bit that was originally after the ip- // and port information- this.serviceDescriptionUrl = locationDetails.Substring(locationDetails.IndexOf('/'));- }- else- {- logger.Warn("Couldn't decode address: " + deviceDetails);- }- }-/// <summary>/// The EndPoint that the device is at/// </summary>