60 lines
3.7 KiB
C++
60 lines
3.7 KiB
C++
|
/***
|
||
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||
|
|
||
|
File: BaseServer.hpp
|
||
|
Date: 2022-2-1
|
||
|
Author: Reece
|
||
|
***/
|
||
|
#pragma once
|
||
|
|
||
|
namespace Aurora::IO::Net
|
||
|
{
|
||
|
#define IMPLEMENT_BASE_SERVER_PROXY(access) \
|
||
|
Error_t GetLastError() override \
|
||
|
{ \
|
||
|
return access GetLastError(); \
|
||
|
} \
|
||
|
\
|
||
|
void Shutdown() override \
|
||
|
{ \
|
||
|
return access Shutdown(); \
|
||
|
} \
|
||
|
\
|
||
|
AuSPtr<IBasicSocketPrivateContext> SetContext(const AuSPtr<IBasicSocketPrivateContext> &newContext) \
|
||
|
{ \
|
||
|
return access SetContext(newContext); \
|
||
|
} \
|
||
|
\
|
||
|
AuSPtr<IBasicSocketPrivateContext> GetContext() override \
|
||
|
{ \
|
||
|
return access GetContext(); \
|
||
|
} \
|
||
|
\
|
||
|
SocketStat GetStats() override \
|
||
|
{ \
|
||
|
return access GetStats(); \
|
||
|
} \
|
||
|
\
|
||
|
EUnderlyingModel GetThreadModel() override \
|
||
|
{ \
|
||
|
return access GetThreadModel(); \
|
||
|
}
|
||
|
|
||
|
struct BaseServer : public IServer
|
||
|
{
|
||
|
BaseServer(BaseSocket &&socket);
|
||
|
~BaseServer();
|
||
|
|
||
|
bool GetLocalEndpoint(ConnectionEndpoint &out) override;
|
||
|
void GetClients(AuList<AuSPtr<IBasicSocketThreaded>> &clients) override;
|
||
|
bool Listen() override;
|
||
|
void ReconfigureDefaultStream(const StreamConfig &config) override;
|
||
|
|
||
|
BaseSocket &ToPlatformSocket();
|
||
|
|
||
|
IMPLEMENT_BASE_SERVER_PROXY(osSocket_.);
|
||
|
|
||
|
private:
|
||
|
BaseSocket osSocket_;
|
||
|
};
|
||
|
}
|