FairMQ  1.4.14
C++ Message Queuing Library and Framework
Network.h
1 /********************************************************************************
2  * Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 
9 #ifndef FAIR_MQ_TOOLS_NETWORK_H
10 #define FAIR_MQ_TOOLS_NETWORK_H
11 
12 #include <map>
13 #include <string>
14 #include <stdexcept>
15 
16 // forward declarations
17 namespace boost
18 {
19 namespace asio
20 {
21 
22 class io_context;
23 using io_service = class io_context;
24 
25 } // namespace asio
26 } // namespace boost
27 
28 namespace fair
29 {
30 namespace mq
31 {
32 namespace tools
33 {
34 
35 struct DefaultRouteDetectionError : std::runtime_error { using std::runtime_error::runtime_error; };
36 
37 // returns a map with network interface names as keys and their IP addresses as values
38 std::map<std::string, std::string> getHostIPs();
39 
40 // get IP address of a given interface name
41 std::string getInterfaceIP(const std::string& interface);
42 
43 // get name of the default route interface
44 std::string getDefaultRouteNetworkInterface();
45 
46 std::string getIpFromHostname(const std::string& hostname);
47 
48 std::string getIpFromHostname(const std::string& hostname, boost::asio::io_service& ios);
49 
50 } /* namespace tools */
51 } /* namespace mq */
52 } /* namespace fair */
53 
54 #endif /* FAIR_MQ_TOOLS_NETWORK_H */
Definition: ControlMessages.h:20
Tools for interfacing containers to the transport via polymorphic allocators.
Definition: DeviceRunner.h:23
Definition: Traits.h:16

privacy