OpenSDN source code
uve.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  * Copyright Contributors to the OpenSDN project
4  */
5 
6 #include <base/misc_utils.h>
7 #include <cmn/dns.h>
8 #include <uve/uve.h>
9 #include <string>
10 #include <vector>
11 
12 using namespace std;
14 
16  DnsState state;
17  boost::system::error_code ec;
18  static bool first = true, build_info_set = false;
19  bool changed = false;
20 
21  state.set_name(Dns::GetHostName());
22  if (first) {
23  state.set_start_time(start_time);
24  state.set_collector(Dns::GetCollector());
25 
26  vector<string> ip_list;
27  ip_list.push_back(Dns::GetSelfIp());
28  state.set_self_ip_list(ip_list);
29  first = false;
30  changed = true;
31  }
32 
33  if (!build_info_set) {
34  string build_info_str;
35  build_info_set = Dns::GetVersion(build_info_str);
36  state.set_build_info(build_info_str);
37  }
38  if (changed) {
39  assert(!state.get_name().empty());
40  UveDnsInfo::Send(state);
41  }
42 }
43 
static void SendDnsUve(uint64_t start_time)
Definition: uve.cc:15
static DnsState prev_state_
Definition: uve.h:12
static std::string GetSelfIp()
Definition: dns.h:66
static const std::string & GetHostName()
Definition: dns.h:56
static bool GetVersion(std::string &build_info_str)
Definition: dns.cc:33
static const std::string & GetCollector()
Definition: dns.h:60
uint64_t start_time