diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2022-04-01 20:58:27 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-04-01 21:24:45 +0100 |
commit | 086969277e74d8ba065bf8145d3aeb0dec0bfee5 (patch) | |
tree | 02b3699a66735ef806d9b46353491f18f8e4e7b4 /Userland/Services/DHCPClient/DHCPv4Client.cpp | |
parent | 0376c127f6e98e03607700d0b3f5154b7014b2f8 (diff) | |
download | serenity-086969277e74d8ba065bf8145d3aeb0dec0bfee5.zip |
Everywhere: Run clang-format
Diffstat (limited to 'Userland/Services/DHCPClient/DHCPv4Client.cpp')
-rw-r--r-- | Userland/Services/DHCPClient/DHCPv4Client.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Services/DHCPClient/DHCPv4Client.cpp b/Userland/Services/DHCPClient/DHCPv4Client.cpp index b9a4a0a2f8..35b8ea2028 100644 --- a/Userland/Services/DHCPClient/DHCPv4Client.cpp +++ b/Userland/Services/DHCPClient/DHCPv4Client.cpp @@ -15,14 +15,14 @@ #include <LibCore/Timer.h> #include <stdio.h> -static u8 mac_part(const Vector<String>& parts, size_t index) +static u8 mac_part(Vector<String> const& parts, size_t index) { auto result = AK::StringUtils::convert_to_uint_from_hex(parts.at(index)); VERIFY(result.has_value()); return result.value(); } -static MACAddress mac_from_string(const String& str) +static MACAddress mac_from_string(String const& str) { auto chunks = str.split(':'); VERIFY(chunks.size() == 6); // should we...worry about this? @@ -32,7 +32,7 @@ static MACAddress mac_from_string(const String& str) }; } -static bool send(const InterfaceDescriptor& iface, const DHCPv4Packet& packet, Core::Object*) +static bool send(InterfaceDescriptor const& iface, DHCPv4Packet const& packet, Core::Object*) { int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (fd < 0) { @@ -63,7 +63,7 @@ static bool send(const InterfaceDescriptor& iface, const DHCPv4Packet& packet, C return true; } -static void set_params(const InterfaceDescriptor& iface, const IPv4Address& ipv4_addr, const IPv4Address& netmask, const IPv4Address& gateway) +static void set_params(InterfaceDescriptor const& iface, IPv4Address const& ipv4_addr, IPv4Address const& netmask, IPv4Address const& gateway) { int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); if (fd < 0) { @@ -201,7 +201,7 @@ ErrorOr<DHCPv4Client::Interfaces> DHCPv4Client::get_discoverable_interfaces() }; } -void DHCPv4Client::handle_offer(const DHCPv4Packet& packet, const ParsedDHCPv4Options& options) +void DHCPv4Client::handle_offer(DHCPv4Packet const& packet, ParsedDHCPv4Options const& options) { dbgln("We were offered {} for {}", packet.yiaddr().to_string(), options.get<u32>(DHCPOption::IPAddressLeaseTime).value_or(0)); auto* transaction = const_cast<DHCPv4Transaction*>(m_ongoing_transactions.get(packet.xid()).value_or(nullptr)); @@ -221,7 +221,7 @@ void DHCPv4Client::handle_offer(const DHCPv4Packet& packet, const ParsedDHCPv4Op dhcp_request(*transaction, packet); } -void DHCPv4Client::handle_ack(const DHCPv4Packet& packet, const ParsedDHCPv4Options& options) +void DHCPv4Client::handle_ack(DHCPv4Packet const& packet, ParsedDHCPv4Options const& options) { if constexpr (DHCPV4CLIENT_DEBUG) { dbgln("The DHCP server handed us {}", packet.yiaddr().to_string()); @@ -250,7 +250,7 @@ void DHCPv4Client::handle_ack(const DHCPv4Packet& packet, const ParsedDHCPv4Opti set_params(transaction->interface, new_ip, options.get<IPv4Address>(DHCPOption::SubnetMask).value(), options.get_many<IPv4Address>(DHCPOption::Router, 1).first()); } -void DHCPv4Client::handle_nak(const DHCPv4Packet& packet, const ParsedDHCPv4Options& options) +void DHCPv4Client::handle_nak(DHCPv4Packet const& packet, ParsedDHCPv4Options const& options) { dbgln("The DHCP server told us to go chase our own tail about {}", packet.yiaddr().to_string()); dbgln("Here are the options: {}", options.to_string()); @@ -271,7 +271,7 @@ void DHCPv4Client::handle_nak(const DHCPv4Packet& packet, const ParsedDHCPv4Opti this); } -void DHCPv4Client::process_incoming(const DHCPv4Packet& packet) +void DHCPv4Client::process_incoming(DHCPv4Packet const& packet) { auto options = packet.parse_options(); @@ -307,7 +307,7 @@ void DHCPv4Client::process_incoming(const DHCPv4Packet& packet) } } -void DHCPv4Client::dhcp_discover(const InterfaceDescriptor& iface) +void DHCPv4Client::dhcp_discover(InterfaceDescriptor const& iface) { auto transaction_id = get_random<u32>(); @@ -339,7 +339,7 @@ void DHCPv4Client::dhcp_discover(const InterfaceDescriptor& iface) m_ongoing_transactions.set(transaction_id, make<DHCPv4Transaction>(iface)); } -void DHCPv4Client::dhcp_request(DHCPv4Transaction& transaction, const DHCPv4Packet& offer) +void DHCPv4Client::dhcp_request(DHCPv4Transaction& transaction, DHCPv4Packet const& offer) { auto& iface = transaction.interface; dbgln("Leasing the IP {} for adapter {}", offer.yiaddr().to_string(), iface.ifname); |