#pragma once #include #include namespace roro::net { // IPv4 addresses as 32-bit numbers, most significant byte first: 10.39.39.12 is 0x0A27270C. bool parseIpv4(const std::string& text, uint32_t& out); // strict: four decimal numbers, 0 to 255 std::string formatIpv4(uint32_t address); uint32_t maskOf(int prefix); // 24 -> 255.255.255.0 // A Saved Network's Fixed setting (S1, Q105 to Q107). gateway 0: none. struct FixedIp { uint32_t address = 0; uint8_t prefix = 24; uint32_t gateway = 0; }; // "" when a device can use it, otherwise why not, for a human (Q111). std::string checkFixed(const FixedIp& f); // "address/prefix [gateway]", as typed on the console and kept in flash. parseFixed() also checks. std::string parseFixed(const std::string& text, FixedIp& out); std::string formatFixed(const FixedIp& f); // An IPv4 address or a host name, as an NTP server may be (Q110). bool validHost(const std::string& text); } // namespace roro::net