using System.Net;
namespace NahidaImpact.Kcp
{
///
/// 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(long id);
///
/// Create a raw channel with the specified conversation ID.
///
/// The conversation ID.
/// The remote endpoint
/// 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(long id, IPEndPoint remoteEndpoint, KcpRawChannelOptions options = null);
///
/// Create a conversation with the specified conversation ID.
///
/// The conversation ID.
/// The remote endpoint
/// 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(long 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, long 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(long id);
}
}