w11 - cpp 0.794
Backend server for Rlink and w11
|
FIXME_docs. More...
#include <RlinkServer.hpp>
Classes | |
class | AttnArgs |
FIXME_docs. More... | |
class | AttnDsc |
FIXME_docs. More... | |
class | AttnId |
FIXME_docs. More... | |
Public Types | |
enum | stats { kStatNEloopWait = 0 , kStatNEloopPoll , kStatNWakeupEvt , kStatNRlinkEvt , kStatNAttnHdl , kStatNAttnNoti , kStatNAttnHarv , kStatNAttn00 , kStatNAttn01 , kStatNAttn02 , kStatNAttn03 , kStatNAttn04 , kStatNAttn05 , kStatNAttn06 , kStatNAttn07 , kStatNAttn08 , kStatNAttn09 , kStatNAttn10 , kStatNAttn11 , kStatNAttn12 , kStatNAttn13 , kStatNAttn14 , kStatNAttn15 , kDimStat } |
typedef ReventLoop::pollhdl_t | pollhdl_t |
typedef std::function< int(AttnArgs &)> | attnhdl_t |
typedef std::function< int()> | actnhdl_t |
Public Member Functions | |
RlinkServer () | |
Default constructor. | |
virtual | ~RlinkServer () |
Destructor. | |
RlinkServer (const RlinkServer &)=delete | |
RlinkServer & | operator= (const RlinkServer &)=delete |
void | SetConnect (const std::shared_ptr< RlinkConnect > &spconn) |
FIXME_docs. | |
const std::shared_ptr< RlinkConnect > & | ConnectSPtr () const |
FIXME_docs. | |
RlinkConnect & | Connect () const |
FIXME_docs. | |
RlogFile & | LogFile () const |
FIXME_docs. | |
RlinkContext & | Context () |
FIXME_docs. | |
bool | Exec (RlinkCommandList &clist, RerrMsg &emsg) |
FIXME_docs. | |
void | Exec (RlinkCommandList &clist) |
FIXME_docs. | |
void | AddAttnHandler (attnhdl_t &&attnhdl, uint16_t mask, void *cdata=nullptr) |
FIXME_docs. | |
void | RemoveAttnHandler (uint16_t mask, void *cdata=nullptr) |
FIXME_docs. | |
void | GetAttnInfo (AttnArgs &args, RlinkCommandList &clist) |
FIXME_docs. | |
void | GetAttnInfo (AttnArgs &args) |
FIXME_docs. | |
void | QueueAction (actnhdl_t &&actnhdl) |
FIXME_docs. | |
void | AddPollHandler (pollhdl_t &&pollhdl, int fd, short events=POLLIN) |
FIXME_docs. | |
bool | TestPollHandler (int fd, short events=POLLIN) |
FIXME_docs. | |
void | RemovePollHandler (int fd, short events, bool nothrow=false) |
FIXME_docs. | |
void | RemovePollHandler (int fd) |
FIXME_docs. | |
void | Start () |
FIXME_docs. | |
void | Stop () |
FIXME_docs. | |
void | Resume () |
FIXME_docs. | |
void | Wakeup () |
FIXME_docs. | |
void | SignalAttnNotify (uint16_t apat) |
FIXME_docs. | |
bool | IsActive () const |
Indicates whether server is active. | |
bool | IsActiveInside () const |
Indicates whether server is active and caller is inside server thread. | |
bool | IsActiveOutside () const |
Indicates whether server is active and caller is outside server thread. | |
void | SetTraceLevel (uint32_t level) |
FIXME_docs. | |
uint32_t | TraceLevel () const |
FIXME_docs. | |
Rstats & | Stats () |
FIXME_docs. | |
void | Print (std::ostream &os) const |
FIXME_docs. | |
void | Dump (std::ostream &os, int ind=0, const char *text=0, int detail=0) const |
FIXME_docs. | |
Protected Member Functions | |
void | StartOrResume (bool resume) |
FIXME_docs. | |
bool | AttnPending () const |
FIXME_docs. | |
bool | ActnPending () const |
FIXME_docs. | |
void | CallAttnHandler () |
FIXME_docs. | |
void | CallActnHandler () |
FIXME_docs. | |
int | WakeupHandler (const pollfd &pfd) |
FIXME_docs. | |
int | RlinkHandler (const pollfd &pfd) |
FIXME_docs. | |
Protected Attributes | |
std::shared_ptr< RlinkConnect > | fspConn |
RlinkContext | fContext |
default server context | |
std::vector< AttnDsc > | fAttnDsc |
std::list< actnhdl_t > | fActnList |
ReventFd | fWakeupEvent |
RlinkServerEventLoop | fELoop |
std::thread | fServerThread |
uint16_t | fAttnPatt |
current attn pattern | |
uint16_t | fAttnNotiPatt |
attn notifier pattern | |
uint32_t | fTraceLevel |
trace level | |
Rstats | fStats |
statistics | |
Friends | |
class | RlinkServerEventLoop |
FIXME_docs.
Definition at line 48 of file RlinkServer.hpp.
Definition at line 60 of file RlinkServer.hpp.
typedef std::function<int(AttnArgs&)> Retro::RlinkServer::attnhdl_t |
Definition at line 61 of file RlinkServer.hpp.
typedef std::function<int()> Retro::RlinkServer::actnhdl_t |
Definition at line 62 of file RlinkServer.hpp.
Definition at line 113 of file RlinkServer.hpp.
|
explicit |
Default constructor.
Definition at line 60 of file RlinkServer.cpp.
References Retro::ReventLoop::AddPollHandler(), Retro::Rstats::Define(), fContext, Retro::Rfd::Fd(), fELoop, fStats, fWakeupEvent, Retro::RlinkCommand::kStat_M_RbErr, Retro::RlinkCommand::kStat_M_RbNak, Retro::RlinkCommand::kStat_M_RbTout, kStatNAttn00, kStatNAttn01, kStatNAttn02, kStatNAttn03, kStatNAttn04, kStatNAttn05, kStatNAttn06, kStatNAttn07, kStatNAttn08, kStatNAttn09, kStatNAttn10, kStatNAttn11, kStatNAttn12, kStatNAttn13, kStatNAttn14, kStatNAttn15, kStatNAttnHarv, kStatNAttnHdl, kStatNAttnNoti, kStatNEloopPoll, kStatNEloopWait, kStatNRlinkEvt, kStatNWakeupEvt, Retro::RlinkContext::SetStatus(), and WakeupHandler().
|
virtual |
Destructor.
Definition at line 109 of file RlinkServer.cpp.
References Retro::Rtools::Catch2Cerr(), fspConn, and Stop().
|
delete |
|
delete |
void Retro::RlinkServer::SetConnect | ( | const std::shared_ptr< RlinkConnect > & | spconn | ) |
FIXME_docs.
Definition at line 118 of file RlinkServer.cpp.
References fELoop, fspConn, and Retro::ReventLoop::SetLogFile().
Referenced by Retro::RtclRlinkServer::ClassCmdConfig().
|
inline |
|
inline |
FIXME_docs.
Definition at line 36 of file RlinkServer.ipp.
References fspConn.
Referenced by Exec(), and StartOrResume().
|
inline |
FIXME_docs.
Definition at line 44 of file RlinkServer.ipp.
References fspConn.
Referenced by CallAttnHandler(), SignalAttnNotify(), and StartOrResume().
|
inline |
FIXME_docs.
Definition at line 52 of file RlinkServer.ipp.
References fContext.
Referenced by Retro::RtclRlinkServer::RtclRlinkServer().
|
inline |
FIXME_docs.
Definition at line 60 of file RlinkServer.ipp.
References Connect(), Retro::RlinkConnect::Exec(), and fContext.
Referenced by Retro::Rw11CntlDEUNA::AttnHandler(), Retro::Rw11CntlRHRP::AttnHandler(), Retro::Rw11CntlRK11::AttnHandler(), Retro::Rw11CntlRL11::AttnHandler(), Retro::Rw11CntlTM11::AttnHandler(), Retro::Rw11CntlDEUNA::ExecGetcmd(), Retro::Rw11Cpu::ExecRibr(), Retro::Rw11Cpu::ExecWibr(), GetAttnInfo(), Retro::RtclRw11Cpu::M_show(), Retro::Rw11CntlPC11::PpRcvHandler(), Retro::Rw11Cpu::ProbeCntl(), Retro::Rw11CntlPC11::PrProcessBuf(), Retro::Rw11CntlLP11::RcvHandler(), Retro::Rw11Rdma::RdmaHandler(), Retro::Rw11CntlRHRP::RdmaPostExecCB(), Retro::Rw11CntlRK11::RdmaPostExecCB(), Retro::Rw11CntlRL11::RdmaPostExecCB(), Retro::Rw11CntlTM11::RdmaPostExecCB(), Retro::Rw11CntlDZ11::RxProcess(), Retro::Rw11CntlDL11::RxProcessBuf(), Retro::Rw11CntlDEUNA::RxRingHandler(), StartOrResume(), Retro::Rw11CntlDEUNA::StartRxRing(), Retro::Rw11CntlDEUNA::StartTxRing(), Retro::Rw11CntlDL11::TxRcvHandler(), Retro::Rw11CntlDZ11::TxRcvHandler(), Retro::Rw11CntlDEUNA::TxRingHandler(), Retro::Rw11CntlRL11::UnitSetup(), and Retro::Rw11Cpu::W11AttnHandler().
|
inline |
FIXME_docs.
Definition at line 68 of file RlinkServer.ipp.
References Connect(), Retro::RlinkConnect::Exec(), and fContext.
void Retro::RlinkServer::AddAttnHandler | ( | attnhdl_t && | attnhdl, |
uint16_t | mask, | ||
void * | cdata = nullptr |
||
) |
FIXME_docs.
Definition at line 136 of file RlinkServer.cpp.
References fAttnDsc, and fspConn.
Referenced by Retro::RtclAttnShuttle::Add(), Retro::Rw11CntlDEUNA::Start(), Retro::Rw11CntlDL11::Start(), Retro::Rw11CntlDZ11::Start(), Retro::Rw11CntlLP11::Start(), Retro::Rw11CntlPC11::Start(), Retro::Rw11CntlRHRP::Start(), Retro::Rw11CntlRK11::Start(), Retro::Rw11CntlRL11::Start(), and Retro::Rw11CntlTM11::Start().
void Retro::RlinkServer::RemoveAttnHandler | ( | uint16_t | mask, |
void * | cdata = nullptr |
||
) |
FIXME_docs.
Definition at line 187 of file RlinkServer.cpp.
References fAttnDsc, and fspConn.
Referenced by Retro::RtclAttnShuttle::Remove().
void Retro::RlinkServer::GetAttnInfo | ( | AttnArgs & | args, |
RlinkCommandList & | clist | ||
) |
FIXME_docs.
Definition at line 159 of file RlinkServer.cpp.
References Retro::RlinkCommand::Command(), Retro::RlinkCommand::Data(), Exec(), Retro::RlinkServer::AttnArgs::fAttnHarvest, Retro::RlinkServer::AttnArgs::fHarvestDone, and Retro::RlinkCommand::kCmdAttn.
Referenced by Retro::RtclAttnShuttle::AttnHandler(), Retro::Rw11::AttnHandler(), Retro::Rw11CntlDEUNA::AttnHandler(), Retro::Rw11CntlDL11::AttnHandler(), Retro::Rw11CntlDZ11::AttnHandler(), Retro::Rw11CntlLP11::AttnHandler(), Retro::Rw11CntlPC11::AttnHandler(), Retro::Rw11CntlRHRP::AttnHandler(), Retro::Rw11CntlRK11::AttnHandler(), Retro::Rw11CntlRL11::AttnHandler(), Retro::Rw11CntlTM11::AttnHandler(), CallAttnHandler(), and GetAttnInfo().
void Retro::RlinkServer::GetAttnInfo | ( | AttnArgs & | args | ) |
FIXME_docs.
Definition at line 176 of file RlinkServer.cpp.
References Retro::RlinkCommandList::AddAttn(), and GetAttnInfo().
void Retro::RlinkServer::QueueAction | ( | actnhdl_t && | actnhdl | ) |
FIXME_docs.
Definition at line 206 of file RlinkServer.cpp.
References fActnList, fspConn, IsActiveOutside(), and Wakeup().
Referenced by Retro::Rw11CntlPC11::PpProcessBuf(), Retro::Rw11CntlLP11::ProcessBuf(), Retro::Rw11Rdma::QueueRMem(), Retro::Rw11Rdma::QueueWMem(), Retro::Rw11CntlDEUNA::StartRxRing(), Retro::Rw11CntlDEUNA::StartTxRing(), Retro::Rw11CntlDZ11::TxProcess(), and Retro::Rw11CntlDL11::TxProcessBuf().
void Retro::RlinkServer::AddPollHandler | ( | pollhdl_t && | pollhdl, |
int | fd, | ||
short | events = POLLIN |
||
) |
FIXME_docs.
Definition at line 217 of file RlinkServer.cpp.
References Retro::ReventLoop::AddPollHandler(), fELoop, fspConn, IsActiveOutside(), and Wakeup().
Referenced by Retro::Rw11VirtTermTcp::ListenPollHandler(), Retro::Rw11VirtEthTap::Open(), Retro::Rw11VirtTermPty::Open(), Retro::Rw11VirtTermTcp::Open(), Retro::Rw11VirtTermTcp::RcvPollHandler(), and Retro::Rw11CntlDEUNA::SetRunning().
bool Retro::RlinkServer::TestPollHandler | ( | int | fd, |
short | events = POLLIN |
||
) |
FIXME_docs.
Definition at line 228 of file RlinkServer.cpp.
References fELoop, fspConn, and Retro::ReventLoop::TestPollHandler().
void Retro::RlinkServer::RemovePollHandler | ( | int | fd, |
short | events, | ||
bool | nothrow = false |
||
) |
FIXME_docs.
Definition at line 237 of file RlinkServer.cpp.
References fELoop, fspConn, IsActiveOutside(), Retro::ReventLoop::RemovePollHandler(), and Wakeup().
Referenced by Retro::Rw11VirtTermTcp::ListenPollHandler(), Retro::Rw11VirtEthTap::~Rw11VirtEthTap(), Retro::Rw11VirtTermPty::~Rw11VirtTermPty(), and Retro::Rw11VirtTermTcp::~Rw11VirtTermTcp().
void Retro::RlinkServer::RemovePollHandler | ( | int | fd | ) |
FIXME_docs.
Definition at line 248 of file RlinkServer.cpp.
References fELoop, fspConn, IsActiveOutside(), Retro::ReventLoop::RemovePollHandler(), and Wakeup().
void Retro::RlinkServer::Start | ( | ) |
FIXME_docs.
Definition at line 259 of file RlinkServer.cpp.
References StartOrResume().
Referenced by Retro::RtclRlinkServer::M_server(), and Retro::Rw11::Start().
void Retro::RlinkServer::Stop | ( | ) |
FIXME_docs.
Definition at line 268 of file RlinkServer.cpp.
References fELoop, fServerThread, IsActive(), Retro::ReventLoop::Stop(), and Wakeup().
Referenced by Retro::RlinkConnect::Close(), Retro::RtclRlinkServer::M_server(), and ~RlinkServer().
void Retro::RlinkServer::Resume | ( | ) |
FIXME_docs.
Definition at line 280 of file RlinkServer.cpp.
References StartOrResume().
Referenced by Retro::RtclRlinkServer::M_server().
void Retro::RlinkServer::Wakeup | ( | ) |
FIXME_docs.
Definition at line 289 of file RlinkServer.cpp.
References fWakeupEvent, and Retro::ReventFd::Signal().
Referenced by AddPollHandler(), QueueAction(), RemovePollHandler(), SignalAttnNotify(), and Stop().
void Retro::RlinkServer::SignalAttnNotify | ( | uint16_t | apat | ) |
FIXME_docs.
Definition at line 298 of file RlinkServer.cpp.
References fAttnNotiPatt, LogFile(), and Wakeup().
Referenced by Retro::RlinkConnect::ProcessAttnNotify().
bool Retro::RlinkServer::IsActive | ( | ) | const |
Indicates whether server is active.
true
if server active. Definition at line 318 of file RlinkServer.cpp.
References fServerThread.
Referenced by IsActiveInside(), IsActiveOutside(), Retro::RlinkConnect::ServerActive(), StartOrResume(), and Stop().
bool Retro::RlinkServer::IsActiveInside | ( | ) | const |
Indicates whether server is active and caller is inside server thread.
true
if server active and method is called from server thread. Definition at line 329 of file RlinkServer.cpp.
References fServerThread, and IsActive().
Referenced by Retro::RlinkConnect::ServerActiveInside().
bool Retro::RlinkServer::IsActiveOutside | ( | ) | const |
Indicates whether server is active and caller is outside server thread.
true
if server active and method is called from a thread other than the server thread. Definition at line 341 of file RlinkServer.cpp.
References fServerThread, and IsActive().
Referenced by AddPollHandler(), QueueAction(), RemovePollHandler(), and Retro::RlinkConnect::ServerActiveOutside().
void Retro::RlinkServer::SetTraceLevel | ( | uint32_t | level | ) |
FIXME_docs.
Definition at line 349 of file RlinkServer.cpp.
References fELoop, fTraceLevel, and Retro::ReventLoop::SetTraceLevel().
Referenced by Retro::RtclRlinkServer::RtclRlinkServer().
|
inline |
FIXME_docs.
Definition at line 77 of file RlinkServer.ipp.
References fTraceLevel.
Referenced by Retro::RtclRlinkServer::RtclRlinkServer().
|
inline |
void Retro::RlinkServer::Print | ( | std::ostream & | os | ) | const |
FIXME_docs.
Definition at line 359 of file RlinkServer.cpp.
Referenced by Retro::RtclRlinkServer::M_print().
void Retro::RlinkServer::Dump | ( | std::ostream & | os, |
int | ind = 0 , |
||
const char * | text = 0 , |
||
int | detail = 0 |
||
) | const |
FIXME_docs.
Definition at line 368 of file RlinkServer.cpp.
References Retro::ReventLoop::Dump(), Retro::Rstats::Dump(), fActnList, fAttnDsc, fAttnNotiPatt, fAttnPatt, Retro::Rfd::Fd(), fELoop, fServerThread, fspConn, fStats, fWakeupEvent, and Retro::RosPrintf().
Referenced by Retro::RtclRlinkServer::M_dump().
|
protected |
FIXME_docs.
Definition at line 394 of file RlinkServer.cpp.
References Retro::RlinkCommandList::AddAttn(), Retro::ReventLoop::AddPollHandler(), Retro::RlinkCommandList::AddWreg(), Connect(), Retro::RlinkServerEventLoop::EventLoop(), Exec(), fELoop, fServerThread, fspConn, IsActive(), Retro::RlinkConnect::kRbaddr_RLCNTL, Retro::RlinkConnect::kRLCNTL_M_AnEna, LogFile(), RlinkHandler(), Retro::ReventLoop::TestPollHandler(), and Retro::ReventLoop::UnStop().
|
inlineprotected |
FIXME_docs.
Definition at line 93 of file RlinkServer.ipp.
References fAttnNotiPatt, and fAttnPatt.
Referenced by Retro::RlinkServerEventLoop::EventLoop().
|
inlineprotected |
FIXME_docs.
Definition at line 101 of file RlinkServer.ipp.
References fActnList.
Referenced by CallActnHandler(), and Retro::RlinkServerEventLoop::EventLoop().
|
protected |
FIXME_docs.
Definition at line 434 of file RlinkServer.cpp.
References fAttnDsc, Retro::RlinkServer::AttnArgs::fAttnHarvest, fAttnNotiPatt, fAttnPatt, Retro::RlinkServer::AttnArgs::fHarvestDone, fspConn, fStats, fTraceLevel, GetAttnInfo(), Retro::Rstats::Inc(), kStatNAttn00, kStatNAttnHarv, kStatNAttnHdl, kStatNAttnNoti, and LogFile().
Referenced by Retro::RlinkServerEventLoop::EventLoop().
|
protected |
FIXME_docs.
Definition at line 523 of file RlinkServer.cpp.
References ActnPending(), fActnList, and fspConn.
Referenced by Retro::RlinkServerEventLoop::EventLoop().
|
protected |
FIXME_docs.
Definition at line 545 of file RlinkServer.cpp.
References fStats, fWakeupEvent, Retro::Rstats::Inc(), kStatNWakeupEvt, and Retro::ReventFd::Wait().
Referenced by RlinkServer().
|
protected |
FIXME_docs.
Definition at line 559 of file RlinkServer.cpp.
References fspConn, fStats, Retro::Rstats::Inc(), and kStatNRlinkEvt.
Referenced by StartOrResume().
|
friend |
Definition at line 140 of file RlinkServer.hpp.
|
protected |
Definition at line 167 of file RlinkServer.hpp.
Referenced by AddAttnHandler(), AddPollHandler(), CallActnHandler(), CallAttnHandler(), Connect(), ConnectSPtr(), Dump(), LogFile(), QueueAction(), RemoveAttnHandler(), RemovePollHandler(), RlinkHandler(), SetConnect(), StartOrResume(), TestPollHandler(), and ~RlinkServer().
|
protected |
default server context
Definition at line 168 of file RlinkServer.hpp.
Referenced by Context(), Exec(), and RlinkServer().
|
protected |
Definition at line 169 of file RlinkServer.hpp.
Referenced by AddAttnHandler(), CallAttnHandler(), Dump(), and RemoveAttnHandler().
|
protected |
Definition at line 170 of file RlinkServer.hpp.
Referenced by ActnPending(), CallActnHandler(), Dump(), and QueueAction().
|
protected |
Definition at line 171 of file RlinkServer.hpp.
Referenced by Dump(), RlinkServer(), Wakeup(), and WakeupHandler().
|
protected |
Definition at line 172 of file RlinkServer.hpp.
Referenced by AddPollHandler(), Dump(), RemovePollHandler(), RlinkServer(), SetConnect(), SetTraceLevel(), StartOrResume(), Stop(), and TestPollHandler().
|
protected |
Definition at line 173 of file RlinkServer.hpp.
Referenced by Dump(), IsActive(), IsActiveInside(), IsActiveOutside(), StartOrResume(), and Stop().
|
protected |
current attn pattern
Definition at line 174 of file RlinkServer.hpp.
Referenced by AttnPending(), CallAttnHandler(), and Dump().
|
protected |
attn notifier pattern
Definition at line 175 of file RlinkServer.hpp.
Referenced by AttnPending(), CallAttnHandler(), Dump(), and SignalAttnNotify().
|
protected |
trace level
Definition at line 176 of file RlinkServer.hpp.
Referenced by CallAttnHandler(), SetTraceLevel(), and TraceLevel().
|
protected |
statistics
Definition at line 177 of file RlinkServer.hpp.
Referenced by CallAttnHandler(), Dump(), Retro::RlinkServerEventLoop::EventLoop(), RlinkHandler(), RlinkServer(), Stats(), and WakeupHandler().