Files
EonaCat.Connections/EonaCat.Connections/Contracts/IConnectorServer.cs
T
2026-11-04 07:53:40 +01:00

47 lines
2.1 KiB
C#

using EonaCat.Connections.EventArguments;
using EonaCat.Connections.Models;
using ConnectorErrorEventArgs = EonaCat.Connections.EventArguments.ErrorEventArgs;
namespace EonaCat.Connections.Contracts
{
public interface IConnectorServer : IDisposable
{
event EventHandler<ConnectionEventArgs> OnConnected;
event EventHandler<ConnectionEventArgs> OnConnectedWithNickname;
event EventHandler<DataReceivedEventArgs> OnDataReceived;
event EventHandler<ConnectionEventArgs> OnDisconnected;
event EventHandler<ConnectorErrorEventArgs> OnSslError;
event EventHandler<ConnectorErrorEventArgs> OnEncryptionError;
event EventHandler<ConnectorErrorEventArgs> OnGeneralError;
event EventHandler<ConnectorErrorEventArgs> OnSocketError;
event EventHandler<ClientMissingEventArgs> OnClientMissing;
event EventHandler<PingEventArgs> OnClientPingResponse;
event EventHandler<PingEventArgs> OnPongMissed;
bool IsStarted { get; }
bool IsSecure { get; }
bool IsEncrypted { get; }
ProtocolType Protocol { get; }
string IpAddress { get; }
int Port { get; }
int ActiveConnections { get; }
int MaxConnections { get; }
Stats GetStats();
Dictionary<string, object> GetSecurityMetrics();
Dictionary<string, Connection> GetClients();
List<Connection> GetClient(string clientId);
Task StartAsync();
Task StopAsync();
Task<bool> SendToClientAsync(string clientId, byte[] data);
Task<bool> SendToClientAsync(string clientId, string message);
Task<bool> SendFromClientToClientAsync(string fromClientId, string toClientId, byte[] data);
Task<bool> SendFromClientToClientAsync(string fromClientId, string toClientId, string message);
Task<bool> BroadcastAsync(byte[] data);
Task<bool> BroadcastAsync(string message);
Task DisconnectClientAsync(string clientId, DisconnectReason reason = DisconnectReason.Unknown, Exception? exception = null);
void SetSeparator(string separator);
void SetSeparator(byte[] separator);
}
}