11#ifndef IOMANAGER_INCLUDE_IOMANAGER_SCHEMAUTILS_HPP_
12#define IOMANAGER_INCLUDE_IOMANAGER_SCHEMAUTILS_HPP_
30 std::string
uid{
"" };
32 std::string
tag{
"" };
55 if (l.session == r.session || l.session ==
"" || r.session ==
"") {
56 if (l.data_type == r.data_type) {
62 return l.data_type < r.data_type;
64 return l.session < r.session;
69 return (l.session ==
"" || r.session ==
"" || l.session == r.session) && l.uid == r.uid && l.tag == r.tag &&
70 l.data_type == r.data_type;
82 std::regex search_ex(search.
uid);
83 return std::regex_match(
check.uid, search_ex);
90 return conn_id.
session +
"/" + conn_id.
uid + (conn_id.
tag !=
"" ?
"+" + conn_id.
tag :
"") +
"@@" +
93 return conn_id.
uid + (conn_id.
tag !=
"" ?
"+" + conn_id.
tag :
"") +
"@@" + conn_id.
data_type;
99 std::string ipaddr =
"0.0.0.0";
100 char hostname[NI_MAXHOST];
101 if (gethostname(&hostname[0], NI_MAXHOST) == 0) {
102 ipaddr = std::string(hostname);
104 if (eth_device_name !=
"") {
106 struct ifaddrs* ifaddr =
nullptr;
109 for (
auto ifa = ifaddr; ifa !=
nullptr; ifa = ifa->ifa_next) {
110 if (ifa->ifa_addr ==
nullptr || std::string(ifa->ifa_name) != eth_device_name) {
115 int status = getnameinfo(ifa->ifa_addr,
sizeof(
struct sockaddr_in), ip, NI_MAXHOST,
nullptr, 0, NI_NUMERICHOST);
119 ipaddr = std::string(ip);
130 std::string
uri =
"";
132 TLOG_DEBUG(45) <<
"Getting URI for network connection " << netCon->
UID();
134 auto protocol = service->get_protocol();
135 if (protocol ==
"tcp") {
137 std::string port =
"*";
138 if (service->get_port() && service->get_port() != 0) {
139 port = std::to_string(service->get_port());
141 auto iface = service->get_eth_device_name();
142 uri = std::string(service->get_protocol() +
"://" +
get_host_ip(iface) +
":" + port);
143 }
else if (protocol ==
"inproc") {
144 uri = std::string(service->get_protocol() +
"://" + service->get_path());
static void check(std::vector< conffwk::ConfigurationChange * > &changes, const InheritanceData &inheritance, const std::set< std::string > &class_names, const OksConfiguration::SMap &objects, const std::string &obj_class, const std::string &obj_id, const char action)
const std::string & UID() const noexcept
const dunedaq::confmodel::Service * get_associated_service() const
Get "associated_service" relationship value. Service provided by this connection.
#define TLOG_DEBUG(lvl,...)
bool is_match(ConnectionId const &search, ConnectionId const &check)
std::string to_string(const ConnectionId &conn_id)
std::string get_host_ip(std::string eth_device_name)
bool operator<(ConnectionRegistration const &l, ConnectionRegistration const &r)
std::string get_uri_for_connection(const confmodel::NetworkConnection *netCon)
bool operator==(ConnectionId const &l, ConnectionId const &r)
Unsupported std::string uri Execution of command std::string error Failed to create CommandFacility uri
ConnectionId(std::string uid, std::string data_type, std::string tag="", std::string session="")
ConnectionId(const confmodel::Connection *cfg)
std::size_t operator()(const dunedaq::iomanager::ConnectionId &conn_id) const