Skip to content

Commit 341d792

Browse files
author
Duncan Crutchley
committed
fixed various Linux related compile errors
1 parent 6a28402 commit 341d792

7 files changed

Lines changed: 879 additions & 874 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ endif()
144144
target_include_directories(CoreLibrary PUBLIC
145145
"${CORELIB_BOOST_ROOT}"
146146
Include
147+
Include/msgpack
147148
)
148149

149150
# --- Generator-expression helpers ---
@@ -157,7 +158,6 @@ set(_CORELIB_NEED_FLATBUFFERS "$<BOOL:${CORELIB_USE_FLATBUFFERS}>")
157158
target_link_libraries(CoreLibrary PUBLIC
158159

159160
# Linux
160-
$<${_CORELIB_LINUX}:${CORELIB_BOOST_LIB}/libboost_system.a>
161161
$<${_CORELIB_LINUX}:${CORELIB_BOOST_LIB}/libboost_thread.a>
162162
$<${_CORELIB_LINUX}:${CORELIB_BOOST_LIB}/libboost_locale.a>
163163
$<$<AND:${_CORELIB_LINUX},${_CORELIB_NEED_BOOST_FS}>:${CORELIB_BOOST_LIB}/libboost_filesystem.a>

Include/Asio/NetworkUtils.h

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -38,155 +38,155 @@
3838

3939
namespace core_lib
4040
{
41-
namespace net_utils
42-
{
43-
using ip_octets_t = std::vector<uint8_t>;
41+
namespace net_utils
42+
{
43+
using ip_octets_t = std::vector<uint8_t>;
4444

4545
// Give an IP address, e.g. 192.168.1.1, get a vector of the octets,
4646
// e.g. {192, 168, 1, 1}.
4747
#if defined(IS_CPP17)
48-
CORE_LIBRARY_DLL_SHARED_API ip_octets_t OctetsFromIpAddress(std::string_view ipAddress);
48+
CORE_LIBRARY_DLL_SHARED_API ip_octets_t OctetsFromIpAddress(std::string_view ipAddress);
4949
#else
50-
CORE_LIBRARY_DLL_SHARED_API ip_octets_t OctetsFromIpAddress(std::string const& ipAddress);
50+
CORE_LIBRARY_DLL_SHARED_API ip_octets_t OctetsFromIpAddress(std::string const &ipAddress);
5151
#endif
5252

5353
// Give an IP address, e.g. 192.168.1.1, get a uint32_t
5454
// representation of the address, u32 from the addresses octets o[4]
5555
// as follows:
5656
// u32 = (o[0] << 24) + (o[1] << 16) + (o[2] << 9) + o[3]
5757
#if defined(IS_CPP17)
58-
CORE_LIBRARY_DLL_SHARED_API uint32_t Uint32FromIpAddress(std::string_view ipAddress);
58+
CORE_LIBRARY_DLL_SHARED_API uint32_t Uint32FromIpAddress(std::string_view ipAddress);
5959
#else
60-
CORE_LIBRARY_DLL_SHARED_API uint32_t Uint32FromIpAddress(std::string const& ipAddress);
60+
CORE_LIBRARY_DLL_SHARED_API uint32_t Uint32FromIpAddress(std::string const &ipAddress);
6161
#endif
6262

63-
// Give a vector of octets, e.g. {192, 168, 1, 1}, get an IP address,
64-
// e.g. 192.168.1.1.
65-
CORE_LIBRARY_DLL_SHARED_API std::string IpAddressFromOctets(ip_octets_t const& octets);
63+
// Give a vector of octets, e.g. {192, 168, 1, 1}, get an IP address,
64+
// e.g. 192.168.1.1.
65+
CORE_LIBRARY_DLL_SHARED_API std::string IpAddressFromOctets(ip_octets_t const &octets);
6666

67-
// Given a uint32_t representing an IP address convert it
68-
// to the corresponding octets then convert to a string.
69-
CORE_LIBRARY_DLL_SHARED_API std::string IpAddressFromUint32(uint32_t ipValue);
67+
// Given a uint32_t representing an IP address convert it
68+
// to the corresponding octets then convert to a string.
69+
CORE_LIBRARY_DLL_SHARED_API std::string IpAddressFromUint32(uint32_t ipValue);
7070

7171
// Check if an IP address is valid. Disallows multicast addresses.
7272
// 1.0.0.0 to 255.255.255.254 but excluding multicast
7373
// range, 224.0.0.0 to 239.255.255.255, an 0.0.0.0 and
7474
// 255.255.255.255.
7575
#if defined(IS_CPP17)
76-
CORE_LIBRARY_DLL_SHARED_API bool IsValidIpAddress(std::string_view address);
76+
CORE_LIBRARY_DLL_SHARED_API bool IsValidIpAddress(std::string_view address);
7777
#else
78-
CORE_LIBRARY_DLL_SHARED_API bool IsValidIpAddress(std::string const& address);
78+
CORE_LIBRARY_DLL_SHARED_API bool IsValidIpAddress(std::string const &address);
7979
#endif
8080

8181
// Check to see if the address is a valid subnet mask.
8282
#if defined(IS_CPP17)
83-
CORE_LIBRARY_DLL_SHARED_API bool IsValidSubnetMask(std::string_view subnetMask);
83+
CORE_LIBRARY_DLL_SHARED_API bool IsValidSubnetMask(std::string_view subnetMask);
8484
#else
85-
bCORE_LIBRARY_DLL_SHARED_API ool IsValidSubnetMask(std::string const& subnetMask);
85+
bCORE_LIBRARY_DLL_SHARED_API ool IsValidSubnetMask(std::string const &subnetMask);
8686
#endif
8787

8888
// Check if a broadcast address is valid. Disallows multicast addresses.
8989
// Can also be used to check if a subnet mask is valid.
9090
#if defined(IS_CPP17)
91-
CORE_LIBRARY_DLL_SHARED_API bool IsValidBroadcastAddress(std::string_view address);
91+
CORE_LIBRARY_DLL_SHARED_API bool IsValidBroadcastAddress(std::string_view address);
9292
#else
93-
CORE_LIBRARY_DLL_SHARED_API bool IsValidBroadcastAddress(std::string const& address);
93+
CORE_LIBRARY_DLL_SHARED_API bool IsValidBroadcastAddress(std::string const &address);
9494
#endif
9595

9696
// Check if address is valid multicast group address.
9797
// 224.0.0.0 to 239.255.255.255.
9898
#if defined(IS_CPP17)
99-
CORE_LIBRARY_DLL_SHARED_API bool IsValidMulticastGroupAddress(std::string_view address);
99+
CORE_LIBRARY_DLL_SHARED_API bool IsValidMulticastGroupAddress(std::string_view address);
100100
#else
101-
CORE_LIBRARY_DLL_SHARED_API bool IsValidMulticastGroupAddress(std::string const& address);
101+
CORE_LIBRARY_DLL_SHARED_API bool IsValidMulticastGroupAddress(std::string const &address);
102102
#endif
103103

104-
// Convert a CIDR prefix value e.g. 16, 24 etc.
105-
// to the subnet mask, e.g. 255.255.0.0, 255.255.255.0 etc.
106-
//
107-
// Returns empty string is there is no valid conversion.
108-
CORE_LIBRARY_DLL_SHARED_API std::string CidrPrefixToSubnetMask(int32_t prefix);
104+
// Convert a CIDR prefix value e.g. 16, 24 etc.
105+
// to the subnet mask, e.g. 255.255.0.0, 255.255.255.0 etc.
106+
//
107+
// Returns empty string is there is no valid conversion.
108+
CORE_LIBRARY_DLL_SHARED_API std::string CidrPrefixToSubnetMask(int32_t prefix);
109109

110110
// Convert a subnet mask, e.g. 255.255.0.0 to
111111
// a CIDR prefix e.g. 16.
112112
//
113113
// Returns -1 if there is no valid conversion.
114114
#if defined(IS_CPP17)
115-
CORE_LIBRARY_DLL_SHARED_API int32_t SubnetMaskToCidrPrefix(std::string_view subnetMask);
115+
CORE_LIBRARY_DLL_SHARED_API int32_t SubnetMaskToCidrPrefix(std::string_view subnetMask);
116116
#else
117-
CORE_LIBRARY_DLL_SHARED_API int32_t SubnetMaskToCidrPrefix(std::string const& subnetMask);
117+
CORE_LIBRARY_DLL_SHARED_API int32_t SubnetMaskToCidrPrefix(std::string const &subnetMask);
118118
#endif
119119

120-
// Convert a CIDR prefix length to a uint32_t subnet mask in network byte order.
121-
CORE_LIBRARY_DLL_SHARED_API uint32_t PrefixToMaskNetworkOrder(uint8_t prefixLength);
120+
// Convert a CIDR prefix length to a uint32_t subnet mask in network byte order.
121+
CORE_LIBRARY_DLL_SHARED_API uint32_t PrefixToMaskNetworkOrder(uint8_t prefixLength);
122122

123123
// Create a CIDR address from an IP and subnet mask.
124124
// e.g. 192.168.10.1/255.255.0.0 becomes
125125
// 192.168.10.1/16
126126
//
127127
// Throws std::invalid_argument upon error.
128128
#if defined(IS_CPP17)
129-
CORE_LIBRARY_DLL_SHARED_API std::string MakeCidrAddress(std::string_view address, std::string_view subnetMask);
129+
CORE_LIBRARY_DLL_SHARED_API std::string MakeCidrAddress(std::string_view address, std::string_view subnetMask);
130130
#else
131-
CORE_LIBRARY_DLL_SHARED_API std::string MakeCidrAddress(std::string const& address, std::string const& subnetMask);
131+
CORE_LIBRARY_DLL_SHARED_API std::string MakeCidrAddress(std::string const &address, std::string const &subnetMask);
132132
#endif
133133

134134
// Given an IP address and subnet mask create the appropriate broadcast address, e.g. 160.50.100.76
135135
// and 255.255.0.0 becomes 160.50.255.255.
136136
//
137137
// Throws if an error occurs, std::invalid_argument
138138
#if defined(IS_CPP17)
139-
CORE_LIBRARY_DLL_SHARED_API std::string BuildBroadcastAddress(std::string_view address, std::string_view subnetMask);
139+
CORE_LIBRARY_DLL_SHARED_API std::string BuildBroadcastAddress(std::string_view address, std::string_view subnetMask);
140140
#else
141-
CORE_LIBRARY_DLL_SHARED_API std::string BuildBroadcastAddress(std::string const& address, std::string const& subnetMask);
141+
CORE_LIBRARY_DLL_SHARED_API std::string BuildBroadcastAddress(std::string const &address, std::string const &subnetMask);
142142
#endif
143143

144144
// Check if 2 addresses (with their subnet masks) are on the same subnet. This is done by checking if the broadcast address
145145
// for the address and subnet mask is the same as the broadcast address for the adapter address and adapter subnet mask.
146146
#if defined(IS_CPP17)
147-
CORE_LIBRARY_DLL_SHARED_API bool IsAddressAndNetmaskOnSameSubnetAsAdapter(std::string_view ipAddress, std::string_view netmask,
148-
std::string_view adapterAddress,
149-
std::string_view adapterNetmask);
147+
CORE_LIBRARY_DLL_SHARED_API bool IsAddressAndNetmaskOnSameSubnetAsAdapter(std::string_view ipAddress, std::string_view netmask,
148+
std::string_view adapterAddress,
149+
std::string_view adapterNetmask);
150150
#else
151-
CORE_LIBRARY_DLL_SHARED_API bool IsAddressAndNetmaskOnSameSubnetAsAdapter(std::string const& ipAddress,
152-
std::string const& netmask,
153-
std::string const& adapterAddress,
154-
std::string const& adapterNetmask);
151+
CORE_LIBRARY_DLL_SHARED_API bool IsAddressAndNetmaskOnSameSubnetAsAdapter(std::string const &ipAddress,
152+
std::string const &netmask,
153+
std::string const &adapterAddress,
154+
std::string const &adapterNetmask);
155155
#endif
156156

157157
// Function to look up the IP address and subnet mask for a given adapter name. The adapter name is the friendly name
158158
// of the adapter, e.g. "Ethernet", "Wi-Fi" etc.
159159
#if defined(IS_CPP17)
160-
CORE_LIBRARY_DLL_SHARED_API std::pair<std::string, std::string> GetIpAddressAndNetmask(std::string_view adapterName);
160+
CORE_LIBRARY_DLL_SHARED_API std::pair<std::string, std::string> GetIpAddressAndNetmask(std::string_view adapterName);
161161
#else
162-
CORE_LIBRARY_DLL_SHARED_API std::pair<std::string, std::string> GetIpAddressAndNetmask(std::string const& adapterName);
162+
CORE_LIBRARY_DLL_SHARED_API std::pair<std::string, std::string> GetIpAddressAndNetmask(std::string const &adapterName);
163163
#endif
164164

165-
CORE_LIBRARY_DLL_SHARED_API struct IPv4Address
166-
{
167-
std::string address;
168-
std::string netmask;
169-
};
170-
171-
CORE_LIBRARY_DLL_SHARED_API struct IPv4Adapter
172-
{
173-
std::string name;
174-
bool supportsBroadcast{false};
175-
bool supportsMulticast{false};
176-
std::vector<IPv4Address> addresses;
177-
};
178-
179-
enum class eInterfaceFilter
180-
{
181-
All,
182-
RealOnly
183-
};
184-
185-
// Get a list of all the IPv4 adapters on the system. If filter is eInterfaceFilter::RealOnly then
186-
// only return real adapters and not loopback, tunnel etc. interfaces.
187-
CORE_LIBRARY_DLL_SHARED_API std::vector<IPv4Adapter> GetIPv4Adapters(eInterfaceFilter filter = eInterfaceFilter::All);
188-
189-
} // namespace net_utils
165+
struct CORE_LIBRARY_DLL_SHARED_API IPv4Address
166+
{
167+
std::string address;
168+
std::string netmask;
169+
};
170+
171+
struct CORE_LIBRARY_DLL_SHARED_API IPv4Adapter
172+
{
173+
std::string name;
174+
bool supportsBroadcast{false};
175+
bool supportsMulticast{false};
176+
std::vector<IPv4Address> addresses;
177+
};
178+
179+
enum class eInterfaceFilter
180+
{
181+
All,
182+
RealOnly
183+
};
184+
185+
// Get a list of all the IPv4 adapters on the system. If filter is eInterfaceFilter::RealOnly then
186+
// only return real adapters and not loopback, tunnel etc. interfaces.
187+
CORE_LIBRARY_DLL_SHARED_API std::vector<IPv4Adapter> GetIPv4Adapters(eInterfaceFilter filter = eInterfaceFilter::All);
188+
189+
} // namespace net_utils
190190
} // namespace core_lib
191191

192192
#endif // HGLQTNETWORKUTILS_H

0 commit comments

Comments
 (0)