|
CIRCT 24.0.0git
|

Classes | |
| struct | ChannelInfo |
| struct | ClientSession |
Public Member Functions | |
| Impl (Context &ctxt, int port) | |
| ~Impl () | |
| Context & | getContext () |
| void | setManifest (int esiVersion, const std::vector< uint8_t > &compressedManifest) |
| ReadChannelPort & | registerReadPort (const std::string &name, const std::string &type) |
| WriteChannelPort & | registerWritePort (const std::string &name, const std::string &type) |
| void | messageConsumed (ReadChannelPort &port) |
| void | stop (uint32_t timeoutMS) |
| int | getPort () const |
| void | logRefusedFrame (uint64_t channelId, size_t size) |
| Log that a size-byte frame for channel channelId was dropped since the simulator-side consumer refused it. | |
Public Attributes | |
| utils::ReadyIdSet< uint64_t > | readyIds |
Private Types | |
| using | ChannelDirection = backends::cosim::RpcClient::ChannelDirection |
Private Member Functions | |
| std::shared_ptr< ClientSession > | getSession () |
| The active session, if any. | |
| std::shared_ptr< ClientSession > | sessionFor (const ix::WebSocket &ws) |
| The active session if ws is its socket, else null. | |
| void | onClientMessage (const std::weak_ptr< ix::WebSocket > &wsWeak, ix::WebSocket &ws, const ix::WebSocketMessagePtr &msg) |
| void | onOpen (const std::weak_ptr< ix::WebSocket > &wsWeak) |
| void | onClose (ix::WebSocket &ws) |
| void | handleBinaryFrame (uint64_t generation, const std::string &data) |
| void | handleControlFrame (ix::WebSocket &ws, const std::string &text) |
| void | handleEvent (uint64_t generation, const json &frame) |
| void | handleHello (ix::WebSocket &ws, uint64_t requestId, const json ¶ms) |
| void | handleSubscribe (ix::WebSocket &ws, uint64_t requestId, const json ¶ms) |
| void | handleUnsubscribe (ix::WebSocket &ws, uint64_t requestId, const json ¶ms) |
| std::optional< ChannelInfo > | findChannel (ix::WebSocket &ws, uint64_t requestId, uint64_t channelId, ChannelDirection dir) |
| Look up a channel. | |
| void | sendResult (ix::WebSocket &ws, uint64_t requestId, const json &result) |
| void | sendError (ix::WebSocket &ws, uint64_t requestId, const std::string &code, const std::string &message) |
| void | transportLoop () |
| void | sendConsumedEvent (const std::unordered_set< uint64_t > &ids) |
| Send a batched consumed event for any to-server messages the simulation has consumed since the last call. | |
| void | retireSession (uint64_t generation) |
| Forget all per-channel state belonging to client session generation, which has disconnected. | |
Private Attributes | |
| Context & | ctxt |
| std::mutex | manifestMutex |
| std::condition_variable | manifestReadyCV |
| int | esiVersion = -1 |
| std::vector< uint8_t > | compressedManifest |
| bool | manifestReady = false |
| std::mutex | channelsMutex |
| std::map< std::string, std::unique_ptr< RpcServerReadPort > > | readPorts |
| std::map< std::string, std::unique_ptr< RpcServerWritePort > > | writePorts |
| std::unordered_map< uint64_t, ChannelInfo > | channelById |
| std::unordered_map< std::string, uint64_t > | idByName |
| uint64_t | nextChannelId = 0 |
| std::mutex | sessionMutex |
| std::shared_ptr< ClientSession > | session |
| uint64_t | nextSessionGeneration = 1 |
| std::thread | transportThread |
| std::unique_ptr< ix::WebSocketServer > | server |
| int | boundPort = -1 |
| ::esi::cosim::FaultStash | faultStash |
Definition at line 129 of file RpcServer.cpp.
|
private |
Definition at line 162 of file RpcServer.cpp.
| Impl::Impl | ( | Context & | ctxt, |
| int | port ) |
Definition at line 673 of file RpcServer.cpp.
| Impl::~Impl | ( | ) |
Definition at line 727 of file RpcServer.cpp.
|
private |
Look up a channel.
If it doesn't exist or doesn't have direction dir, reply with an error and return nullopt.
Definition at line 1244 of file RpcServer.cpp.
|
inline |
Definition at line 134 of file RpcServer.cpp.
|
inline |
Definition at line 146 of file RpcServer.cpp.
|
inlineprivate |
The active session, if any.
The returned pointer stays valid after the client disconnects; sends on it then just fail.
Definition at line 229 of file RpcServer.cpp.
|
private |
Definition at line 927 of file RpcServer.cpp.
|
private |
Definition at line 973 of file RpcServer.cpp.
|
private |
Definition at line 1066 of file RpcServer.cpp.
|
private |
Definition at line 1095 of file RpcServer.cpp.
|
private |
Definition at line 1152 of file RpcServer.cpp.
|
private |
Definition at line 1202 of file RpcServer.cpp.
| void Impl::logRefusedFrame | ( | uint64_t | channelId, |
| size_t | size ) |
Log that a size-byte frame for channel channelId was dropped since the simulator-side consumer refused it.
Definition at line 966 of file RpcServer.cpp.
| void Impl::messageConsumed | ( | ReadChannelPort & | port | ) |
Definition at line 774 of file RpcServer.cpp.
|
private |
Definition at line 834 of file RpcServer.cpp.
|
private |
Definition at line 902 of file RpcServer.cpp.
|
private |
Definition at line 872 of file RpcServer.cpp.
| ReadChannelPort & Impl::registerReadPort | ( | const std::string & | name, |
| const std::string & | type ) |
Definition at line 759 of file RpcServer.cpp.
| WriteChannelPort & Impl::registerWritePort | ( | const std::string & | name, |
| const std::string & | type ) |
Definition at line 780 of file RpcServer.cpp.
|
private |
Forget all per-channel state belonging to client session generation, which has disconnected.
Definition at line 919 of file RpcServer.cpp.
|
private |
Send a batched consumed event for any to-server messages the simulation has consumed since the last call.
Transport thread only.
Definition at line 1348 of file RpcServer.cpp.
|
private |
Definition at line 1281 of file RpcServer.cpp.
|
private |
Definition at line 1270 of file RpcServer.cpp.
|
inlineprivate |
The active session if ws is its socket, else null.
Requests are handled through this, so one still being handled when its client disconnects can't act on a replacement client's session.
Definition at line 236 of file RpcServer.cpp.
| void Impl::setManifest | ( | int | esiVersion, |
| const std::vector< uint8_t > & | compressedManifest ) |
Definition at line 747 of file RpcServer.cpp.
| void Impl::stop | ( | uint32_t | timeoutMS | ) |
Definition at line 795 of file RpcServer.cpp.
|
private |
Definition at line 1297 of file RpcServer.cpp.
|
private |
Definition at line 248 of file RpcServer.cpp.
|
private |
Definition at line 218 of file RpcServer.cpp.
|
private |
Definition at line 215 of file RpcServer.cpp.
|
private |
Definition at line 210 of file RpcServer.cpp.
|
private |
Definition at line 203 of file RpcServer.cpp.
|
private |
Definition at line 209 of file RpcServer.cpp.
Definition at line 282 of file RpcServer.cpp.
|
private |
Definition at line 219 of file RpcServer.cpp.
|
private |
Definition at line 207 of file RpcServer.cpp.
|
private |
Definition at line 211 of file RpcServer.cpp.
|
private |
Definition at line 208 of file RpcServer.cpp.
|
private |
Definition at line 220 of file RpcServer.cpp.
|
private |
Definition at line 225 of file RpcServer.cpp.
|
private |
Definition at line 216 of file RpcServer.cpp.
Definition at line 152 of file RpcServer.cpp.
|
private |
Definition at line 247 of file RpcServer.cpp.
|
private |
Definition at line 224 of file RpcServer.cpp.
|
private |
Definition at line 223 of file RpcServer.cpp.
|
private |
Definition at line 244 of file RpcServer.cpp.
|
private |
Definition at line 217 of file RpcServer.cpp.