From dca78b13411db96366dddfa0d68bb6d36d28ad14 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 29 Oct 2016 18:22:20 -0400 Subject: rework dlna project --- RSSDP/ISsdpCommunicationsServer.cs | 71 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 RSSDP/ISsdpCommunicationsServer.cs (limited to 'RSSDP/ISsdpCommunicationsServer.cs') diff --git a/RSSDP/ISsdpCommunicationsServer.cs b/RSSDP/ISsdpCommunicationsServer.cs new file mode 100644 index 0000000000..990b21d05e --- /dev/null +++ b/RSSDP/ISsdpCommunicationsServer.cs @@ -0,0 +1,71 @@ +using System; +using System.Threading.Tasks; + +namespace Rssdp.Infrastructure +{ + /// + /// Interface for a component that manages network communication (sending and receiving HTTPU messages) for the SSDP protocol. + /// + public interface ISsdpCommunicationsServer : IDisposable + { + + #region Events + + /// + /// Raised when a HTTPU request message is received by a socket (unicast or multicast). + /// + event EventHandler RequestReceived; + + /// + /// Raised when an HTTPU response message is received by a socket (unicast or multicast). + /// + event EventHandler ResponseReceived; + + #endregion + + #region Methods + + /// + /// Causes the server to begin listening for multicast messages, being SSDP search requests and notifications. + /// + void BeginListeningForBroadcasts(); + + /// + /// Causes the server to stop listening for multicast messages, being SSDP search requests and notifications. + /// + void StopListeningForBroadcasts(); + + /// + /// Stops listening for search responses on the local, unicast socket. + /// + void StopListeningForResponses(); + + /// + /// Sends a message to a particular address (uni or multicast) and port. + /// + /// A byte array containing the data to send. + /// A representing the destination address for the data. Can be either a multicast or unicast destination. + Task SendMessage(byte[] messageData, UdpEndPoint destination); + + /// + /// Sends a message to the SSDP multicast address and port. + /// + /// A byte array containing the data to send. + Task SendMulticastMessage(byte[] messageData); + + #endregion + + #region Properties + + /// + /// Gets or sets a boolean value indicating whether or not this instance is shared amongst multiple and/or instances. + /// + /// + /// If true, disposing an instance of a or a will not dispose this comms server instance. The calling code is responsible for managing the lifetime of the server. + /// + bool IsShared { get; set; } + + #endregion + + } +} \ No newline at end of file -- cgit v1.2.3