Routing.h 701 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <Kernel/Locking/MutexProtected.h>
  8. #include <Kernel/Net/NetworkAdapter.h>
  9. #include <Kernel/Thread.h>
  10. namespace Kernel {
  11. struct RoutingDecision {
  12. RefPtr<NetworkAdapter> adapter;
  13. MACAddress next_hop;
  14. bool is_zero() const;
  15. };
  16. enum class UpdateArp {
  17. Set,
  18. Delete,
  19. };
  20. void update_arp_table(IPv4Address const&, MACAddress const&, UpdateArp update);
  21. RoutingDecision route_to(IPv4Address const& target, IPv4Address const& source, RefPtr<NetworkAdapter> const through = nullptr);
  22. MutexProtected<HashMap<IPv4Address, MACAddress>>& arp_table();
  23. }