Skip to content
Snippets Groups Projects
Commit 32dbd80d authored by Leon Dietrich's avatar Leon Dietrich
Browse files

fix: compiling on FreeBSD and typename info

parent e20c2202
No related branches found
No related tags found
No related merge requests found
Pipeline #7691 failed
......@@ -19,8 +19,10 @@ namespace rmrf::net {
std::string format_network_error(int error) {
switch (error) {
#ifdef __linux__
case EAI_ADDRFAMILY:
return "There was no compatible address for the requested families. (EAI_ADDRFAMILY)";
#endif
case EAI_AGAIN:
return "The consulted DNS server reported a temporary lookup failure. Try again later. (EAI_AGAIN)";
case EAI_BADFLAGS:
......@@ -31,8 +33,10 @@ namespace rmrf::net {
return "The required protocol family is not supported by this host. (EAI_FAMILY)";
case EAI_MEMORY:
return "Out of Memory while performing DNS lookup. (EAI_MEMORY)";
#ifdef __linux__
case EAI_NODATA:
return "The requested DNS entry does not contain an A or AAAA entry. (EAI_NODATA)";
#endif
case EAI_NONAME:
return "There was no matching nodename, service tuple. (EAI_NONAME)";
case EAI_SERVICE:
......@@ -42,6 +46,7 @@ namespace rmrf::net {
default:
return std::to_string(error);
}
// TODO implement EAI_OVERFLOW, EAI_PROTOCOL, EAI_BADHINTS, EAI_SYSTEM (*BSD specific)
}
bool decode_address(std::list<socketaddr> &l, addrinfo* looked_up_addrs, const int port) {
......
......@@ -77,14 +77,19 @@ public:
* device handling the send packet shall report if the path was viable or not. This
* is useful for debugging but may negatively impact performance.
* @brief Enable or disable UDP confirm mode
* @note This is only enabled if MSG_CONFIRM is enabled on your platform.
* @param enabled If set to true the UDP confirm mode will be activated.
*/
void enable_confirm_mode(bool enabled) {
#ifdef MSG_CONFIRM
if (enabled) {
this->send_flags |= MSG_CONFIRM;
} else {
this->send_flags &= ~MSG_CONFIRM;
}
#else
MARK_UNUSED(enabled);
#endif
};
protected:
......
......@@ -71,19 +71,19 @@ public:
return this->arr.data();
}
constexpr std::array<uint8_t, pkg_size>::iterator begin() noexcept {
constexpr typename std::array<uint8_t, pkg_size>::iterator begin() noexcept {
return this->arr.begin();
}
constexpr std::array<uint8_t, pkg_size>::iterator end() noexcept {
constexpr typename std::array<uint8_t, pkg_size>::iterator end() noexcept {
return this->arr.end();
}
constexpr std::array<uint8_t, pkg_size>::const_iterator cbegin() const noexcept {
constexpr typename std::array<uint8_t, pkg_size>::const_iterator cbegin() const noexcept {
return this->arr.cbegin();
}
constexpr std::array<uint8_t, pkg_size>::const_iterator cend() const noexcept {
constexpr typename std::array<uint8_t, pkg_size>::const_iterator cend() const noexcept {
return this->arr.cend();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment