using System;
using System.Net;
namespace KcpSharp
{
///
/// Multiplex many channels or conversations over the same transport.
///
public interface IKcpMultiplexConnection : IKcpMultiplexConnection
{
///
/// Create a raw channel with the specified conversation ID.
///
/// The conversation ID.
/// The user state of this channel.
/// 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, T state, KcpRawChannelOptions? options = null);
///
/// Create a conversation with the specified conversation ID.
///
/// The conversation ID.
/// The user state of this conversation.
/// 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, T state, 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.
/// The user state
/// 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, T? state);
///
/// Unregister a conversation or channel with the specified conversation ID.
///
/// The conversation ID.
/// The user state.
/// The conversation unregistered with the user state. Returns default when the conversation with the specified ID is not found.
IKcpConversation? UnregisterConversation(int id, out T? state);
}
}