aboutsummaryrefslogtreecommitdiff
path: root/RSSDP
diff options
context:
space:
mode:
Diffstat (limited to 'RSSDP')
-rw-r--r--RSSDP/DeviceAvailableEventArgs.cs1
-rw-r--r--RSSDP/DeviceEventArgs.cs1
-rw-r--r--RSSDP/DiscoveredSsdpDevice.cs3
-rw-r--r--RSSDP/HttpParserBase.cs21
-rw-r--r--RSSDP/HttpRequestParser.cs1
-rw-r--r--RSSDP/ISsdpCommunicationsServer.cs1
-rw-r--r--RSSDP/SsdpCommunicationsServer.cs9
-rw-r--r--RSSDP/SsdpConstants.cs1
-rw-r--r--RSSDP/SsdpDevice.cs5
-rw-r--r--RSSDP/SsdpDeviceLocator.cs5
-rw-r--r--RSSDP/SsdpDevicePublisher.cs50
-rw-r--r--RSSDP/SsdpEmbeddedDevice.cs1
12 files changed, 50 insertions, 49 deletions
diff --git a/RSSDP/DeviceAvailableEventArgs.cs b/RSSDP/DeviceAvailableEventArgs.cs
index 21ac7c631..439cee467 100644
--- a/RSSDP/DeviceAvailableEventArgs.cs
+++ b/RSSDP/DeviceAvailableEventArgs.cs
@@ -54,6 +54,5 @@ namespace Rssdp
}
#endregion
-
}
}
diff --git a/RSSDP/DeviceEventArgs.cs b/RSSDP/DeviceEventArgs.cs
index 05eb4a256..faeff8347 100644
--- a/RSSDP/DeviceEventArgs.cs
+++ b/RSSDP/DeviceEventArgs.cs
@@ -41,6 +41,5 @@ namespace Rssdp
}
#endregion
-
}
}
diff --git a/RSSDP/DiscoveredSsdpDevice.cs b/RSSDP/DiscoveredSsdpDevice.cs
index 1244ce523..fb323c1fb 100644
--- a/RSSDP/DiscoveredSsdpDevice.cs
+++ b/RSSDP/DiscoveredSsdpDevice.cs
@@ -45,6 +45,7 @@ namespace Rssdp
public DateTimeOffset AsAt
{
get { return _AsAt; }
+
set
{
if (_AsAt != value)
@@ -55,7 +56,7 @@ namespace Rssdp
}
/// <summary>
- /// Returns the headers from the SSDP device response message
+ /// Returns the headers from the SSDP device response message.
/// </summary>
public HttpHeaders ResponseHeaders { get; set; }
diff --git a/RSSDP/HttpParserBase.cs b/RSSDP/HttpParserBase.cs
index 773a06cdb..e7172cb1c 100644
--- a/RSSDP/HttpParserBase.cs
+++ b/RSSDP/HttpParserBase.cs
@@ -46,7 +46,7 @@ namespace Rssdp.Infrastructure
{
var lines = data.Split(LineTerminators, StringSplitOptions.None);
- //First line is the 'request' line containing http protocol details like method, uri, http version etc.
+ // First line is the 'request' line containing http protocol details like method, uri, http version etc.
ParseStatusLine(lines[0], message);
ParseHeaders(headers, retVal.Headers, lines);
@@ -93,16 +93,16 @@ namespace Rssdp.Infrastructure
/// <param name="contentHeaders">A reference to a <see cref="System.Net.Http.Headers.HttpHeaders"/> collection for the message content, to which the parsed header will be added.</param>
private void ParseHeader(string line, System.Net.Http.Headers.HttpHeaders headers, System.Net.Http.Headers.HttpHeaders contentHeaders)
{
- //Header format is
- //name: value
+ // Header format is
+ // name: value
var headerKeySeparatorIndex = line.IndexOf(":", StringComparison.OrdinalIgnoreCase);
var headerName = line.Substring(0, headerKeySeparatorIndex).Trim();
var headerValue = line.Substring(headerKeySeparatorIndex + 1).Trim();
- //Not sure how to determine where request headers and and content headers begin,
- //at least not without a known set of headers (general headers first the content headers)
- //which seems like a bad way of doing it. So we'll assume if it's a known content header put it there
- //else use request headers.
+ // Not sure how to determine where request headers and and content headers begin,
+ // at least not without a known set of headers (general headers first the content headers)
+ // which seems like a bad way of doing it. So we'll assume if it's a known content header put it there
+ // else use request headers.
var values = ParseValues(headerValue);
var headersToAddTo = IsContentHeader(headerName) ? contentHeaders : headers;
@@ -115,13 +115,13 @@ namespace Rssdp.Infrastructure
private int ParseHeaders(System.Net.Http.Headers.HttpHeaders headers, System.Net.Http.Headers.HttpHeaders contentHeaders, string[] lines)
{
- //Blank line separates headers from content, so read headers until we find blank line.
+ // Blank line separates headers from content, so read headers until we find blank line.
int lineIndex = 1;
string line = null, nextLine = null;
while (lineIndex + 1 < lines.Length && !String.IsNullOrEmpty((line = lines[lineIndex++])))
{
- //If the following line starts with space or tab (or any whitespace), it is really part of this header but split for human readability.
- //Combine these lines into a single comma separated style header for easier parsing.
+ // If the following line starts with space or tab (or any whitespace), it is really part of this header but split for human readability.
+ // Combine these lines into a single comma separated style header for easier parsing.
while (lineIndex < lines.Length && !String.IsNullOrEmpty((nextLine = lines[lineIndex])))
{
if (nextLine.Length > 0 && Char.IsWhiteSpace(nextLine[0]))
@@ -135,6 +135,7 @@ namespace Rssdp.Infrastructure
ParseHeader(line, headers, contentHeaders);
}
+
return lineIndex;
}
diff --git a/RSSDP/HttpRequestParser.cs b/RSSDP/HttpRequestParser.cs
index 279ef883c..3fc328b8c 100644
--- a/RSSDP/HttpRequestParser.cs
+++ b/RSSDP/HttpRequestParser.cs
@@ -85,6 +85,5 @@ namespace Rssdp.Infrastructure
}
#endregion
-
}
}
diff --git a/RSSDP/ISsdpCommunicationsServer.cs b/RSSDP/ISsdpCommunicationsServer.cs
index 8cf65df11..02c3af0e5 100644
--- a/RSSDP/ISsdpCommunicationsServer.cs
+++ b/RSSDP/ISsdpCommunicationsServer.cs
@@ -61,6 +61,5 @@ namespace Rssdp.Infrastructure
bool IsShared { get; set; }
#endregion
-
}
}
diff --git a/RSSDP/SsdpCommunicationsServer.cs b/RSSDP/SsdpCommunicationsServer.cs
index 18097ef24..fe49fb7d3 100644
--- a/RSSDP/SsdpCommunicationsServer.cs
+++ b/RSSDP/SsdpCommunicationsServer.cs
@@ -195,11 +195,9 @@ namespace Rssdp.Infrastructure
}
catch (ObjectDisposedException)
{
-
}
catch (OperationCanceledException)
{
-
}
catch (Exception ex)
{
@@ -313,6 +311,7 @@ namespace Rssdp.Infrastructure
public bool IsShared
{
get { return _IsShared; }
+
set { _IsShared = value; }
}
@@ -485,9 +484,9 @@ namespace Rssdp.Infrastructure
private void OnRequestReceived(HttpRequestMessage data, IPEndPoint remoteEndPoint, IPAddress receivedOnLocalIpAddress)
{
- //SSDP specification says only * is currently used but other uri's might
- //be implemented in the future and should be ignored unless understood.
- //Section 4.2 - http://tools.ietf.org/html/draft-cai-ssdp-v1-03#page-11
+ // SSDP specification says only * is currently used but other uri's might
+ // be implemented in the future and should be ignored unless understood.
+ // Section 4.2 - http://tools.ietf.org/html/draft-cai-ssdp-v1-03#page-11
if (data.RequestUri.ToString() != "*")
{
return;
diff --git a/RSSDP/SsdpConstants.cs b/RSSDP/SsdpConstants.cs
index 28a014fce..798f050e1 100644
--- a/RSSDP/SsdpConstants.cs
+++ b/RSSDP/SsdpConstants.cs
@@ -57,6 +57,5 @@ namespace Rssdp.Infrastructure
internal const string SsdpByeByeNotification = "ssdp:byebye";
internal const int UdpResendCount = 3;
-
}
}
diff --git a/RSSDP/SsdpDevice.cs b/RSSDP/SsdpDevice.cs
index 09f729e83..f89bafb19 100644
--- a/RSSDP/SsdpDevice.cs
+++ b/RSSDP/SsdpDevice.cs
@@ -90,6 +90,7 @@ namespace Rssdp
{
return _DeviceType;
}
+
set
{
_DeviceType = value;
@@ -111,6 +112,7 @@ namespace Rssdp
{
return _DeviceTypeNamespace;
}
+
set
{
_DeviceTypeNamespace = value;
@@ -130,6 +132,7 @@ namespace Rssdp
{
return _DeviceVersion;
}
+
set
{
_DeviceVersion = value;
@@ -181,6 +184,7 @@ namespace Rssdp
else
return _Udn;
}
+
set
{
_Udn = value;
@@ -349,6 +353,5 @@ namespace Rssdp
}
#endregion
-
}
}
diff --git a/RSSDP/SsdpDeviceLocator.cs b/RSSDP/SsdpDeviceLocator.cs
index 59a2710d5..9b48cf31c 100644
--- a/RSSDP/SsdpDeviceLocator.cs
+++ b/RSSDP/SsdpDeviceLocator.cs
@@ -120,7 +120,6 @@ namespace Rssdp.Infrastructure
}
catch (Exception)
{
-
}
}
@@ -337,7 +336,7 @@ namespace Rssdp.Infrastructure
values["HOST"] = "239.255.255.250:1900";
values["USER-AGENT"] = "UPnP/1.0 DLNADOC/1.50 Platinum/1.0.4.2";
- //values["X-EMBY-SERVERID"] = _appHost.SystemId;
+ // values["X-EMBY-SERVERID"] = _appHost.SystemId;
values["MAN"] = "\"ssdp:discover\"";
@@ -580,6 +579,7 @@ namespace Rssdp.Infrastructure
return d;
}
}
+
return null;
}
@@ -613,6 +613,5 @@ namespace Rssdp.Infrastructure
}
#endregion
-
}
}
diff --git a/RSSDP/SsdpDevicePublisher.cs b/RSSDP/SsdpDevicePublisher.cs
index 53b740052..b4cf2fb48 100644
--- a/RSSDP/SsdpDevicePublisher.cs
+++ b/RSSDP/SsdpDevicePublisher.cs
@@ -156,6 +156,7 @@ namespace Rssdp.Infrastructure
public bool SupportPnpRootDevice
{
get { return _SupportPnpRootDevice; }
+
set
{
_SupportPnpRootDevice = value;
@@ -205,25 +206,25 @@ namespace Rssdp.Infrastructure
return;
}
- //WriteTrace(String.Format("Search Request Received From {0}, Target = {1}", remoteEndPoint.ToString(), searchTarget));
+ // WriteTrace(String.Format("Search Request Received From {0}, Target = {1}", remoteEndPoint.ToString(), searchTarget));
if (IsDuplicateSearchRequest(searchTarget, remoteEndPoint))
{
- //WriteTrace("Search Request is Duplicate, ignoring.");
+ // WriteTrace("Search Request is Duplicate, ignoring.");
return;
}
- //Wait on random interval up to MX, as per SSDP spec.
- //Also, as per UPnP 1.1/SSDP spec ignore missing/bank MX header. If over 120, assume random value between 0 and 120.
- //Using 16 as minimum as that's often the minimum system clock frequency anyway.
+ // Wait on random interval up to MX, as per SSDP spec.
+ // Also, as per UPnP 1.1/SSDP spec ignore missing/bank MX header. If over 120, assume random value between 0 and 120.
+ // Using 16 as minimum as that's often the minimum system clock frequency anyway.
int maxWaitInterval = 0;
if (String.IsNullOrEmpty(mx))
{
- //Windows Explorer is poorly behaved and doesn't supply an MX header value.
- //if (this.SupportPnpRootDevice)
+ // Windows Explorer is poorly behaved and doesn't supply an MX header value.
+ // if (this.SupportPnpRootDevice)
mx = "1";
- //else
- //return;
+ // else
+ // return;
}
if (!Int32.TryParse(mx, out maxWaitInterval) || maxWaitInterval <= 0) return;
@@ -231,10 +232,10 @@ namespace Rssdp.Infrastructure
if (maxWaitInterval > 120)
maxWaitInterval = _Random.Next(0, 120);
- //Do not block synchronously as that may tie up a threadpool thread for several seconds.
+ // Do not block synchronously as that may tie up a threadpool thread for several seconds.
Task.Delay(_Random.Next(16, (maxWaitInterval * 1000))).ContinueWith((parentTask) =>
{
- //Copying devices to local array here to avoid threading issues/enumerator exceptions.
+ // Copying devices to local array here to avoid threading issues/enumerator exceptions.
IEnumerable<SsdpDevice> devices = null;
lock (_Devices)
{
@@ -251,7 +252,7 @@ namespace Rssdp.Infrastructure
if (devices != null)
{
var deviceList = devices.ToList();
- //WriteTrace(String.Format("Sending {0} search responses", deviceList.Count));
+ // WriteTrace(String.Format("Sending {0} search responses", deviceList.Count));
foreach (var device in deviceList)
{
@@ -264,7 +265,7 @@ namespace Rssdp.Infrastructure
}
else
{
- //WriteTrace(String.Format("Sending 0 search responses."));
+ // WriteTrace(String.Format("Sending 0 search responses."));
}
});
}
@@ -308,7 +309,7 @@ namespace Rssdp.Infrastructure
{
var rootDevice = device.ToRootDevice();
- //var additionalheaders = FormatCustomHeadersForResponse(device);
+ // var additionalheaders = FormatCustomHeadersForResponse(device);
const string header = "HTTP/1.1 200 OK";
@@ -335,10 +336,9 @@ namespace Rssdp.Infrastructure
}
catch (Exception)
{
-
}
- //WriteTrace(String.Format("Sent search response to " + endPoint.ToString()), device);
+ // WriteTrace(String.Format("Sent search response to " + endPoint.ToString()), device);
}
private bool IsDuplicateSearchRequest(string searchTarget, IPEndPoint endPoint)
@@ -384,7 +384,7 @@ namespace Rssdp.Infrastructure
{
if (IsDisposed) return;
- //WriteTrace("Begin Sending Alive Notifications For All Devices");
+ // WriteTrace("Begin Sending Alive Notifications For All Devices");
SsdpRootDevice[] devices;
lock (_Devices)
@@ -399,7 +399,7 @@ namespace Rssdp.Infrastructure
SendAliveNotifications(device, true, CancellationToken.None);
}
- //WriteTrace("Completed Sending Alive Notifications For All Devices");
+ // WriteTrace("Completed Sending Alive Notifications For All Devices");
}
catch (ObjectDisposedException ex)
{
@@ -448,7 +448,7 @@ namespace Rssdp.Infrastructure
_CommsServer.SendMulticastMessage(message, _sendOnlyMatchedHost ? rootDevice.Address : null, cancellationToken);
- //WriteTrace(String.Format("Sent alive notification"), device);
+ // WriteTrace(String.Format("Sent alive notification"), device);
}
private Task SendByeByeNotifications(SsdpDevice device, bool isRoot, CancellationToken cancellationToken)
@@ -533,7 +533,7 @@ namespace Rssdp.Infrastructure
{
LogFunction(text);
}
- //System.Diagnostics.Debug.WriteLine(text, "SSDP Publisher");
+ // System.Diagnostics.Debug.WriteLine(text, "SSDP Publisher");
}
private void WriteTrace(string text, SsdpDevice device)
@@ -551,13 +551,13 @@ namespace Rssdp.Infrastructure
if (string.Equals(e.Message.Method.Method, SsdpConstants.MSearchMethod, StringComparison.OrdinalIgnoreCase))
{
- //According to SSDP/UPnP spec, ignore message if missing these headers.
+ // According to SSDP/UPnP spec, ignore message if missing these headers.
// Edit: But some devices do it anyway
- //if (!e.Message.Headers.Contains("MX"))
+ // if (!e.Message.Headers.Contains("MX"))
// WriteTrace("Ignoring search request - missing MX header.");
- //else if (!e.Message.Headers.Contains("MAN"))
+ // else if (!e.Message.Headers.Contains("MAN"))
// WriteTrace("Ignoring search request - missing MAN header.");
- //else
+ // else
ProcessSearchRequest(GetFirstHeaderValue(e.Message.Headers, "MX"), GetFirstHeaderValue(e.Message.Headers, "ST"), e.ReceivedFrom, e.LocalIpAddress, CancellationToken.None);
}
}
@@ -565,7 +565,9 @@ namespace Rssdp.Infrastructure
private class SearchRequest
{
public IPEndPoint EndPoint { get; set; }
+
public DateTime Received { get; set; }
+
public string SearchTarget { get; set; }
public string Key
diff --git a/RSSDP/SsdpEmbeddedDevice.cs b/RSSDP/SsdpEmbeddedDevice.cs
index 4810703d7..ff644993b 100644
--- a/RSSDP/SsdpEmbeddedDevice.cs
+++ b/RSSDP/SsdpEmbeddedDevice.cs
@@ -33,6 +33,7 @@ namespace Rssdp
{
return _RootDevice;
}
+
internal set
{
_RootDevice = value;