2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
2019-04-02 15:46:44 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2019-04-02 19:54:38 +02:00
|
|
|
#include <Kernel/Net/NetworkAdapter.h>
|
2020-11-29 16:05:27 -07:00
|
|
|
#include <Kernel/Thread.h>
|
2019-04-02 15:46:44 +02:00
|
|
|
|
2020-02-16 01:27:42 +01:00
|
|
|
namespace Kernel {
|
|
|
|
|
|
2020-03-22 13:12:45 +13:00
|
|
|
struct RoutingDecision {
|
2020-02-08 00:19:46 +01:00
|
|
|
RefPtr<NetworkAdapter> adapter;
|
2019-08-29 11:18:32 +10:00
|
|
|
MACAddress next_hop;
|
2019-08-29 11:18:38 +10:00
|
|
|
|
|
|
|
|
bool is_zero() const;
|
2019-08-28 21:58:01 +10:00
|
|
|
};
|
|
|
|
|
|
2020-11-29 16:05:27 -07:00
|
|
|
void update_arp_table(const IPv4Address&, const MACAddress&);
|
2020-04-05 01:16:45 +04:30
|
|
|
RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, const RefPtr<NetworkAdapter> through = nullptr);
|
2019-08-28 21:58:01 +10:00
|
|
|
|
|
|
|
|
Lockable<HashMap<IPv4Address, MACAddress>>& arp_table();
|
2020-02-16 01:27:42 +01:00
|
|
|
|
|
|
|
|
}
|