using Capnp.FrameTracing;
using System;
namespace Capnp.Rpc
{
///
/// Models an RPC connection.
///
public interface IConnection
{
///
/// Returns the state of this connection.
///
ConnectionState State { get; }
///
/// TCP port (local end), or null if the connection is not yet established.
///
int? LocalPort { get; }
///
/// TCP port (remote end), or null if the connection is not yet established.
///
int? RemotePort { get; }
///
/// Receive message counter
///
long RecvCount { get; }
///
/// Sent message counter
///
long SendCount { get; }
///
/// Whether the RPC engine is currently computing.
///
bool IsComputing { get; }
///
/// Whether the connection is idle, waiting for data to receive.
///
bool IsWaitingForData { get; }
///
/// Attaches a tracer to this connection. Only allowed in state 'Initializing'.
///
/// Tracer to attach
/// is null
/// Connection is not in state 'Initializing'
void AttachTracer(IFrameTracer tracer);
///
/// Prematurely closes this connection. Note that there is usually no need to close a connection manually. The typical use case
/// of this method is to refuse an incoming connection in the TcpRpcServer.OnConnectionChanged
callback.
///
void Close();
}
}