jellyfin-server/RSSDP/ISsdpCommunicationsServer.cs

53 lines
2.3 KiB
C#
Raw Normal View History

using System;
using System.Net;
2017-02-05 20:44:08 +00:00
using System.Threading;
2016-10-29 22:22:20 +00:00
using System.Threading.Tasks;
namespace Rssdp.Infrastructure
{
/// <summary>
/// Interface for a component that manages network communication (sending and receiving HTTPU messages) for the SSDP protocol.
/// </summary>
public interface ISsdpCommunicationsServer : IDisposable
{
/// <summary>
/// Raised when a HTTPU request message is received by a socket (unicast or multicast).
/// </summary>
event EventHandler<RequestReceivedEventArgs> RequestReceived;
/// <summary>
/// Raised when an HTTPU response message is received by a socket (unicast or multicast).
/// </summary>
event EventHandler<ResponseReceivedEventArgs> ResponseReceived;
/// <summary>
/// Causes the server to begin listening for multicast messages, being SSDP search requests and notifications.
/// </summary>
void BeginListeningForMulticast();
2016-10-29 22:22:20 +00:00
/// <summary>
/// Causes the server to stop listening for multicast messages, being SSDP search requests and notifications.
/// </summary>
void StopListeningForMulticast();
2016-10-29 22:22:20 +00:00
/// <summary>
/// Sends a message to a particular address (uni or multicast) and port.
/// </summary>
2023-02-17 18:27:36 +00:00
Task SendMessage(byte[] messageData, IPEndPoint destination, IPAddress fromLocalIPAddress, CancellationToken cancellationToken);
2016-10-29 22:22:20 +00:00
/// <summary>
/// Sends a message to the SSDP multicast address and port.
/// </summary>
2023-02-17 18:27:36 +00:00
Task SendMulticastMessage(string message, IPAddress fromLocalIPAddress, CancellationToken cancellationToken);
Task SendMulticastMessage(string message, int sendCount, IPAddress fromLocalIPAddress, CancellationToken cancellationToken);
2016-10-29 22:22:20 +00:00
/// <summary>
2022-02-06 21:21:17 +00:00
/// Gets or sets a boolean value indicating whether or not this instance is shared amongst multiple <see cref="SsdpDeviceLocator"/> and/or <see cref="ISsdpDevicePublisher"/> instances.
2016-10-29 22:22:20 +00:00
/// </summary>
/// <remarks>
2022-02-06 21:21:17 +00:00
/// <para>If true, disposing an instance of a <see cref="SsdpDeviceLocator"/>or a <see cref="ISsdpDevicePublisher"/> will not dispose this comms server instance. The calling code is responsible for managing the lifetime of the server.</para>
2016-10-29 22:22:20 +00:00
/// </remarks>
bool IsShared { get; set; }
}
}