hmbdc
simplify-high-performance-messaging-programming
|
a singleton that holding mcast resources More...
#include <NetContext.hpp>
Public Types | |
using | Sender = hmbdc::app::mcast::Sender |
Public Member Functions | |
SendTransportEngine * | createSendTransportEngine (Config const &cfgIn, size_t maxMessageSize) |
construct a send transport engine (and remember it within the class) More... | |
SendTransportEngine * | createSendTransportEngineTuply (Config const &cfg, size_t maxMessageSize, std::tuple<> args) |
same as above but provide a unified interface - not preferred More... | |
template<typename Buffer , typename MsgArbitrator = RecvTransport::NoOpArb> | |
auto | createRecvTransportEngine (Config const &cfgIn, Buffer &buffer, MsgArbitrator &&arb=RecvTransport::NoOpArb()) |
construct a send transport and remember it More... | |
template<typename Buffer , typename ArgsTuple > | |
auto | createRecvTransportEngineTuply (Config const &cfg, Buffer &buffer, ArgsTuple &&args) |
same as above but to provide a unified interface - not preferred More... | |
Sender * | getSender (Topic const &t) |
get (or create for the first time) a Sender - whose function is to send messages on its associated Topic More... | |
void | listenTo (Topic const &t) |
This process is interested in a Topic. More... | |
void | stopListenTo (Topic const &t) |
undo the subscription More... | |
Friends | |
struct | hmbdc::pattern::SingletonGuardian< NetContext > |
Additional Inherited Members | |
![]() | |
static NetContext & | instance () |
static bool | initialized () |
|
inline |
construct a send transport and remember it
After this, user is responsible to get it started within a hmbdc Context, if running in Context pool, it needs to pin at a single pool thread, CANNOT span more than one thread otherwise the transport is not functioing/running. Don't create the same thing twice
cfgIn | jason specifing the transport - see hmbdc/app/mcast/DefaultUserConfig.hpp |
buffer | buffer that recv messages go, normally the one returned by app::Context::buffer() |
arb | optonally an arbitrator to decide which messages to keep and drop if arb is an rvalue, it is passed in value, if an lvalue, passed in as reference; it supports either udp packet (BEFORE topic filtering) or hmbdc message (AFTER topic filtering) level arbitration depending on which one of int operator()(void* bytes, size_t len) and int operator()(TransportMessageHeader const* header) presents in the arb passed in trasnport engines, see ctor of RecvTransportEngineImpl for details see in example use in mcast-sniff.cpp auto eng = mcast::NetContext::instance().createRecvTransportEngine(config , ctx.buffer() //the lambda below provides the 'filter' before the packet gets to hmbdc processing , [](void* packet, size_t len) { auto buf = (uint8_t*)(packet); size_t l = 0; cout << "packet size=" << len; while (l != len) { cout << ' ' << boost::format("%02x") % (uint16_t)buf[l++]; } cout << endl; return -1; //-1 - drops the packet //1 - keep //0 - cannot decide, ask me later //we dumped it out - drop it now, no further processing } ); |
|
inline |
same as above but to provide a unified interface - not preferred
use forward_as_tuple to make the tuple passed in
|
inline |
construct a send transport engine (and remember it within the class)
After this, user is responsible to get it started within a hmbdc Context, if running in Context pool, it needs to pin at a single pool thread, CANNOT span more than one thread otherwise the transport is not functioing/running. Don't create the same thing twice
cfgIn | config specifing the transport - hmbdc/app/mcast/DefaultUserConfig.hpp |
maxMessageSize | max messafe size in bytes to be sent trasnport engines, see ctor of SendTransportEngine for details |
|
inline |
same as above but provide a unified interface - not preferred
|
inline |
This process is interested in a Topic.
Normally the receiving transport covering this topic needs to be created - not necessarily running - before calling this
t | Topic interested |
|
inline |
undo the subscription
t | Topic |