coral
A C++ library for distributed co-simulation
ip.hpp
Go to the documentation of this file.
1 
10 #ifndef CORAL_NET_IP_HPP
11 #define CORAL_NET_IP_HPP
12 
13 #ifdef _WIN32
14 # include <winsock2.h>
15 #else
16 # include <netinet/in.h>
17 #endif
18 
19 #include <string>
20 #include <vector>
21 
22 
23 namespace coral
24 {
25 namespace net
26 {
27 namespace ip
28 {
29 
30 
33 {
36 
38  in_addr address;
39 
41  in_addr netmask;
42 
45 };
46 
57 
58 
61 
62 
64 in_addr StringToIPAddress(const std::string& address);
65 
66 
67 }}} // namespace
68 #endif // header guard
std::vector< NetworkInterfaceInfo > GetNetworkInterfaces()
Returns information about available network interfaces.
in_addr netmask
Subnet mask.
Definition: ip.hpp:41
std::string IPAddressToString(in_addr address)
Converts an IP address to a string in dotted-decimal format.
Information about a network interface.
Definition: ip.hpp:32
std::string name
Interface name.
Definition: ip.hpp:35
STL class.
in_addr address
IP address.
Definition: ip.hpp:38
Definition: variable_io.hpp:28
STL class.
in_addr broadcastAddress
Broadcast address.
Definition: ip.hpp:44
in_addr StringToIPAddress(const std::string &address)
Converts an IP address in dotted-decimal string format to an in_addr.