2022-08-28 19:02:06 +00:00
/***
Copyright ( C ) 2022 J Reece Wilson ( a / k / a " Reece " ) . All rights reserved .
File : INetSrvSockets . hpp
Date : 2022 - 8 - 15
Author : Reece
* * */
# pragma once
namespace Aurora : : IO : : Net
{
struct ISocketServer ;
2023-01-26 21:43:19 +00:00
struct NetSocketConnectByHost
{
AuOptionalEx < NetHostname > netHostname ;
AuOptionalEx < AuUInt16 > uPort ;
AuOptionalEx < ETransportProtocol > protocol ;
} ;
2022-08-28 19:02:06 +00:00
struct NetSocketConnect
{
2023-01-26 21:43:19 +00:00
// connect by protocol, address:port
AuOptionalEx < NetEndpoint > endpoint ;
// or connect by [string/ip family, ip address], port
NetSocketConnectByHost byHost ;
//
2022-08-28 19:02:06 +00:00
AuSPtr < ISocketDriver > pDriver ;
2022-09-02 19:53:25 +00:00
AuUInt32 uMaxConnectTimeMs { } ;
2022-08-28 19:02:06 +00:00
} ;
struct NetSocketConnectMany
{
2022-09-27 16:30:26 +00:00
ETransportProtocol protocol { } ;
2022-08-28 19:02:06 +00:00
AuList < IPAddress > ips ;
AuUInt16 uPort { } ;
AuSPtr < ISocketDriver > pDriver ;
AuUInt32 uMaxConnectTimeMs { } ;
} ;
struct NetSocketBind
{
2022-09-27 16:30:26 +00:00
ETransportProtocol protocol { } ;
2022-08-28 19:02:06 +00:00
IPAddress ip ;
AuUInt16 uPort { } ;
AuSPtr < ISocketDriverFactory > pFactory ;
AuSPtr < ISocketServerDriver > pDriver ;
2022-12-16 17:18:12 +00:00
AuUInt32 uMaxConnections { } ;
AuUInt32 uMaxAcceptBacklog { } ;
AuUInt32 uDefaultInputStreamSize /* also: abs max datagram size of datagrams over sockets. note that each sessions buffer could be raised if tick/fragement future-buffering rejection. */ { } ;
2022-12-12 23:50:05 +00:00
bool bMultiThreaded { } ;
2022-08-28 19:02:06 +00:00
} ;
struct NetSocketBindEx : NetSocketBind
{
AuUInt32 uUDPTimeoutMs { } ;
} ;
struct INetSrvSockets
{
virtual AuSPtr < ISocket > Connect ( const NetSocketConnect & netConnect ) = 0 ;
virtual AuSPtr < ISocket > ConnectMany ( const NetSocketConnectMany & netConnectMany ) = 0 ;
virtual AuSPtr < ISocketServer > NewServer ( const NetSocketBind & netBind ) = 0 ;
virtual AuSPtr < ISocketServer > NewServerEx ( const NetSocketBindEx & netBindEx ) = 0 ;
} ;
} ;