Swapper.NET Logo

Source Code Interfaces ~ IConnection.cs


using System;
using System.Net;
using RevolutionaryStuff.JBT;

namespace RevolutionaryStuff.P2P.Basics
{
	public enum ConnectionState
	{
		NoInit=1,
		Connecting,
		Negotiating,
		Active,
		Active_Wait,
		Closed
	}

	public enum ConnectionOrigin
	{
		Incoming,
		Outgoing
	}

	public interface ITransferStatus
	{
		double DataRate
		{ get; }
		long BytesProcessed
		{ get; }
		long BytesDesired
		{ get; }
	}

	public interface IConnection : IFieldApplicator
	{
		DateTime CreationTime
		{ get; }
		ConnectionState State
		{ get; }
		ConnectionOrigin Origin
		{ get; }
		ITransferStatus InboundStatus
		{ get; }
		ITransferStatus OutboundStatus
		{ get; }
		EndPoint RemoteEndPoint
		{ get; }
		IUserAgent UserAgent
		{ get; }
		void Close(string reason);
	}

	public interface IConnectionGetter
	{
		IConnection[] GetConnections();
	}
}