Line data Source code
1 : /**
2 : * @file resolve_interface.cpp Resolver test utility
3 : *
4 : * This is a simple test utility that gets the IP for a given interface
5 : *
6 : * This is part of the DUNE DAQ Application Framework, copyright 2020.
7 : * Licensing/copyright details are in the COPYING file that you should have
8 : * received with this code.
9 : */
10 :
11 : #include "utilities/get_ips.hpp"
12 :
13 : int
14 0 : main(int argc, char* argv[])
15 : {
16 :
17 0 : if (argc != 2) {
18 0 : std::cout << "Invalid number of arguments:\nresolve_interface ifname\n"; // NOLINT
19 0 : exit(1);
20 : }
21 :
22 0 : try {
23 0 : auto result = dunedaq::utilities::get_interface_ip(argv[1]); // NOLINT
24 0 : std::cout << result << std::endl;
25 0 : if (result.size() > 0)
26 0 : return 0;
27 0 : } catch (ers::Issue& expt) {
28 0 : std::cout << "Encountered ERS issue while resolving interface IP: " << expt.what();
29 0 : }
30 : return 1;
31 : }
|