101 TLOG_DEBUG(45) <<
"Getting URI for network connection " << netCon->
UID();
103 if (service->get_protocol() ==
"tcp") {
105 std::string port =
"*";
106 if (service->get_port() && service->get_port() != 0) {
107 port = std::to_string(service->get_port());
109 std::string ipaddr =
"0.0.0.0";
111 if (gethostname(&hostname[0], 256) == 0) {
112 ipaddr = std::string(hostname);
114 auto iface = service->get_eth_device_name();
117 struct ifaddrs* ifaddr;
119 for (
auto ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
120 if (ifa->ifa_addr == NULL) {
123 if (std::string(ifa->ifa_name) == iface) {
126 getnameinfo(ifa->ifa_addr,
sizeof(
struct sockaddr_in), ip, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
130 ipaddr = std::string(ip);
136 uri = std::string(service->get_protocol() +
"://" + ipaddr +
":" + port);
137 }
else if (service->get_protocol() ==
"inproc") {
138 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)