libfilezilla
iputils.hpp
Go to the documentation of this file.
1 #ifndef LIBFILEZILLA_IPUTILS_HEADER
2 #define LIBFILEZILLA_IPUTILS_HEADER
3 
4 #include "libfilezilla.hpp"
5 #include <optional>
6 
11 namespace fz {
12 
19 std::string FZ_PUBLIC_SYMBOL get_ipv6_long_form(std::string_view const& short_address);
20 std::wstring FZ_PUBLIC_SYMBOL get_ipv6_long_form(std::wstring_view const& short_address);
21 
38 bool FZ_PUBLIC_SYMBOL is_routable_address(std::string_view const& address);
39 bool FZ_PUBLIC_SYMBOL is_routable_address(std::wstring_view const& address);
40 
41 enum class address_type
42 {
43  unknown,
44  ipv4,
45  ipv6,
46  unix
47 };
48 
50 address_type FZ_PUBLIC_SYMBOL get_address_type(std::string_view const& address);
51 address_type FZ_PUBLIC_SYMBOL get_address_type(std::wstring_view const& address);
52 
53 struct FZ_PUBLIC_SYMBOL network_interface
54 {
55  native_string name;
56  std::string mac;
57  std::vector<std::string> addresses;
58 };
59 
60 std::optional<std::vector<network_interface>> FZ_PUBLIC_SYMBOL get_network_interfaces();
61 }
62 
63 #endif
Sets some global macros and further includes string.hpp.
The namespace used by libfilezilla.
Definition: apply.hpp:17
address_type get_address_type(std::string_view const &address)
Gets the type of the passed IP address.
bool is_routable_address(std::string_view const &address)
Tests whether the passed IP address is routable on the public Internet.
std::string get_ipv6_long_form(std::string_view const &short_address)
Given a shortened IPv6 address, returns the full, unshortened address.
std::wstring native_string
A string in the system's native character type and encoding. Note: This typedef changes depending on...
Definition: string.hpp:34
Definition: iputils.hpp:54