using System;
using System.Net;
namespace KcpSharp
{
///
/// Multiplex many channels or conversations over the same transport.
///
public interface IKcpMultiplexConnection : IDisposable
{
///
/// Determine whether the multiplex connection contains a conversation with the specified id.
///
/// The conversation ID.
/// True if the multiplex connection contains the specified conversation. Otherwise false.
bool Contains(int id);
///
/// Create a raw channel with the specified conversation ID.
///
/// The conversation ID.
/// The options of the .
/// The raw channel created.
/// The current instance is disposed.
/// Another channel or conversation with the same ID was already registered.
KcpRawChannel CreateRawChannel(int id, IPEndPoint remoteEndPoint, KcpRawChannelOptions? options = null);
///
/// Create a conversation with the specified conversation ID.
///
/// The conversation ID.
/// The options of the .
/// The KCP conversation created.
/// The current instance is disposed.
/// Another channel or conversation with the same ID was already registered.
KcpConversation CreateConversation(int id, IPEndPoint remoteEndPoint, KcpConversationOptions? options = null);
///
/// Register a conversation or channel with the specified conversation ID and user state.
///
/// The conversation or channel to register.
/// The conversation ID.
/// is not provided.
/// The current instance is disposed.
/// Another channel or conversation with the same ID was already registered.
void RegisterConversation(IKcpConversation conversation, int id);
///
/// Unregister a conversation or channel with the specified conversation ID.
///
/// The conversation ID.
/// The conversation unregistered. Returns null when the conversation with the specified ID is not found.
IKcpConversation? UnregisterConversation(int id);
}
}