CIRCT 24.0.0git
Loading...
Searching...
No Matches
RpcServer Class Reference

TODO: make this a proper backend (as much as possible). More...

#include <RpcServer.h>

Collaboration diagram for RpcServer:

Classes

class  Impl

Public Member Functions

 RpcServer (Context &ctxt)
 ~RpcServer ()
Context & getContext ()
 Get the context.
void setManifest (int esiVersion, const std::vector< uint8_t > &compressedManifest)
 Set the manifest and version.
ReadChannelPort & registerReadPort (const std::string &name, const std::string &type)
 Register a read or write port which communicates over RPC.
WriteChannelPort & registerWritePort (const std::string &name, const std::string &type)
void messageConsumed (ReadChannelPort &port)
 Report that the simulation has consumed one message read from port (which must have been returned by registerReadPort), in the order they were read.
void stop (uint32_t timeoutMS=0)
void run (int port=-1)
int getPort ()

Private Attributes

Context & ctxt
std::unique_ptr< Impl > impl

Detailed Description

TODO: make this a proper backend (as much as possible).

Definition at line 26 of file RpcServer.h.

Constructor & Destructor Documentation

◆ RpcServer()

RpcServer::RpcServer ( Context & ctxt)

Definition at line 1381 of file RpcServer.cpp.

◆ ~RpcServer()

RpcServer::~RpcServer ( )
default

Member Function Documentation

◆ getContext()

Get the context.

Definition at line 32 of file RpcServer.h.

◆ getPort()

int RpcServer::getPort ( )

Definition at line 1423 of file RpcServer.cpp.

◆ messageConsumed()

void RpcServer::messageConsumed ( ReadChannelPort & port)

Report that the simulation has consumed one message read from port (which must have been returned by registerReadPort), in the order they were read.

This returns a credit to the client which sent it (if it's still connected) so it may send another message. Non-blocking.

Definition at line 1405 of file RpcServer.cpp.

◆ registerReadPort()

ReadChannelPort & RpcServer::registerReadPort ( const std::string & name,
const std::string & type )

Register a read or write port which communicates over RPC.

Frames which arrive for a read port before it's connected are held until it is.

Write ports apply backpressure: tryWrite() returns false, and write() blocks, while the channel's in-flight limit (messages queued here plus messages sent but not yet consumed by the client) is reached. write() throws if the port is disconnected meanwhile. The simulation should use tryWrite(): blocking it can deadlock, since the client may need it to make progress before consuming anything.

Definition at line 1391 of file RpcServer.cpp.

◆ registerWritePort()

WriteChannelPort & RpcServer::registerWritePort ( const std::string & name,
const std::string & type )

Definition at line 1398 of file RpcServer.cpp.

◆ run()

void RpcServer::run ( int port = -1)

Definition at line 1411 of file RpcServer.cpp.

◆ setManifest()

void RpcServer::setManifest ( int esiVersion,
const std::vector< uint8_t > & compressedManifest )

Set the manifest and version.

There is a race condition here in that the RPC server can be started and a connection from the client could happen before the manifest is set. TODO: rework the DPI API to require that the manifest gets set first.

Definition at line 1384 of file RpcServer.cpp.

◆ stop()

void RpcServer::stop ( uint32_t timeoutMS = 0)

Definition at line 1417 of file RpcServer.cpp.

Member Data Documentation

◆ ctxt

Definition at line 78 of file RpcServer.h.

◆ impl

std::unique_ptr<Impl> esi::cosim::RpcServer::impl
private

Definition at line 79 of file RpcServer.h.


The documentation for this class was generated from the following files: