Skip to content

net

Namespace for package net Namespace for package net Namespace for package net

consumer :

Types

Name Description
AmqpBroker
AmqpClient @brief Class that exposes an AMQP client It will create a unique queue and consume from it exclusively and with automatic acknowledgment.
AmqpConnection AmqpConnection @brief Wraps the AMQP::TcpConnection and the single threaded io context where all calls to the amqp library must run
AmqpHashClient @brief Class that wraps around AmqpClient to provide a message interface with Hash header and body Deserialisation of incoming messages is done via a karabo::net::Strand, i.e. a running karabo::net::EventLoop is needed.
Broker
Channel @brief Represents a communication channel used for p2p messaging on a connection to a remote instance.
Connection @brief This class serves as the interface for all connections.
ConnectionHandler @brief Declare our custom ConnectionHandler to implement their callbacks.
EventLoop @brief Karabo's central event loop.
HttpClient
InfluxDbClient This class uses HTTP protocol for communications with InfluxDB server.
LosslessQueue @brief The LosslessQueue implements a queue that guarantees to preserve messages.
Message @brief This class represents a message in the distributed Karabo system
NetworkInterface
OneTimeTokenAuthorizeResult @brief The results of a one-time token validation / authorization.
Queue @brief This class defines the interface for message queues in the Karabo distributed system
RejectNewestQueue @brief The RejectNewestQueue implements a queue that will reject new entries when it has reached its maximum capacity
RemoveOldestQueue @brief The RemoveOldestQueue implements a queue that removes the oldest element in the queue when it has reached is maximum capacity and a new element is pushed to it
RemoveThreadException An exception that is thrown if a thread cannot be removed from the EventLoop
Strand A poor man's substitute for boost::asio::strand because that does not guarantee that handlers posted on different strands can run in parallel ("strand collision"). Compared to boost::asio::strand, this - lacks dispatch: we usually do not want that in Karabo since it allows the handler to be called now in this scope - lacks running_in_this_thread: probably not too important - has a more restrictive wrap: would be useful to support more, but a proper implementation would also need dispatch Every handler posted will be put into a FIFO queue and the FIFO will be emptied in the background by posting the handlers to the given boost::asio::io_context (either from net::EventLoop, passed in constructor, or defined by setContext(..)). NOTE: Do not create a Strand on the stack, but do it on the heap using the Configurator: auto stack = karabo::data::Configurator::create(Hash(...)); Otherwise 'enable_shared_from_this' does not work which is needed to guarantee (via usage of karab::util::bind_weak) that an internal Strand method is executed on the event loop when the Strand is already destructed.
TcpChannel
TcpConnection @brief a class for handling tcp connections This class serves as the interface for all connections.
UserAuthClient

Functions

Name Description
bareHostName Return the bare host name after stripping domain (exflxxx12345.desy.de => exflxxx12345) Return :
buildInfluxReadClient @brief Instantiates an InfluxDbClient that connects to an InfluxDb reading node.
getIpFromCIDRNotation Returns an IP string from a Classless Inter-Domain Routing specification e.g. the string 192.168.0.0/24 represents the IP range between 192.168.0.0 and 192.168.0.255. The function will ignore loopback interface and interfaces that are down. Only IP4 specifications are implemented. Return : an IP address matching the input range or the input string if the input string does not specify a network range or if it does not match any external active interface
parseGenericUrl Parses a URL and returns a tuple.
parseUrl Parses a HTTP-like URL and returns a tuple.
runProtected Wrapper around boost::asio::io_service::run that catches exceptions, logs them as errors and continues after some delay. service : shared pointer to the io_service category : the category used for logging errorMessage : will be part of the logged error delayInMilliSec : is the delay after each catch

Function Details

bareHostName

std::string bareHostName()

Return the bare host name after stripping domain (exflxxx12345.desy.de => exflxxx12345)

Return :

buildInfluxReadClient

InfluxDbClient::Pointer buildInfluxReadClient()

@brief Instantiates an InfluxDbClient that connects to an InfluxDb reading node.

The connection parameters for the InfluxDb reading node are obtained via the following environment variables:

KARABO_INFLUXDB_QUERY_URL KARABO_INFLUXDB_DBNAME (with fallback to the Broker domain) KARABO_INFLUXDB_QUERY_USER KARABO_INFLUXDB_QUERY_PASSWORD

Return : A std::shared_ptr to the built InfluxDbClient instance.

getIpFromCIDRNotation

std::string getIpFromCIDRNotation(const std::string& addressRange)

Returns an IP string from a Classless Inter-Domain Routing specification

e.g. the string 192.168.0.0/24 represents the IP range between 192.168.0.0 and 192.168.0.255.

The function will ignore loopback interface and interfaces that are down. Only IP4 specifications are implemented.

Return : an IP address matching the input range or the input string if the input string does not specify a network range or if it does not match any external active interface

parseGenericUrl

std::tuple<std::string, std::string> parseGenericUrl(const std::string& url)

Parses a URL and returns a tuple.

The URL must of format: :

url : A well formed URL

Return : tuple containing scheme and scheme dependent part

parseUrl

std::tuple<std::string, std::string, std::string, std::string, std::string> parseUrl(const std::string& url)

Parses a HTTP-like URL and returns a tuple.

The URL must of format: ://:/?

url : A well formed URL

Return : tuple containing scheme, domain, port, path and query

runProtected

void runProtected(std::shared_ptr<boost::asio::io_service> service, const std::string& category, const std::string& errorMessage, unsigned int delayInMilliSec = 100)

Wrapper around boost::asio::io_service::run that catches exceptions, logs them as errors and continues after some delay.

service : shared pointer to the io_service

category : the category used for logging

errorMessage : will be part of the logged error

delayInMilliSec : is the delay after each catch