---
title: llarp/apple/route_manager.hpp

---

# llarp/apple/route_manager.hpp



## Namespaces

| Name           |
| -------------- |
| **[llarp](Namespaces/namespacellarp.md)** <br>[crypto.hpp] |
| **[llarp::apple](Namespaces/namespacellarp_1_1apple.md)**  |

## Classes

|                | Name           |
| -------------- | -------------- |
| class | **[llarp::apple::RouteManager](Classes/classllarp_1_1apple_1_1RouteManager.md)**  |




## Source code

```cpp
#pragma once

#include <llarp/router/abstractrouter.hpp>
#include <llarp/vpn/platform.hpp>
#include "context_wrapper.h"

namespace llarp::apple
{
  class RouteManager final : public llarp::vpn::IRouteManager
  {
   public:
    RouteManager(llarp::Context& ctx, llarp_route_callbacks rcs, void* callback_context)
        : context{ctx}, callback_context{callback_context}, route_callbacks{std::move(rcs)}
    {}

    void
    AddRoute(net::ipaddr_t /*ip*/, net::ipaddr_t /*gateway*/) override
    {}

    void
    DelRoute(net::ipaddr_t /*ip*/, net::ipaddr_t /*gateway*/) override
    {}

    void
    AddDefaultRouteViaInterface(vpn::NetworkInterface& vpn) override;

    void
    DelDefaultRouteViaInterface(vpn::NetworkInterface& vpn) override;

    void
    AddRouteViaInterface(vpn::NetworkInterface& vpn, IPRange range) override;

    void
    DelRouteViaInterface(vpn::NetworkInterface& vpn, IPRange range) override;

    std::vector<net::ipaddr_t>
    GetGatewaysNotOnInterface(vpn::NetworkInterface& /*vpn*/) override
    {
      // We can't get this on mac from our sandbox, but we don't actually need it because we
      // ignore the gateway for AddRoute/DelRoute anyway, so just return a zero IP.
      std::vector<net::ipaddr_t> ret;
      ret.emplace_back(net::ipv4addr_t{});
      return ret;
    }

   private:
    llarp::Context& context;
    bool trampoline_active = false;
    void
    check_trampoline(bool enable);

    void* callback_context = nullptr;
    llarp_route_callbacks route_callbacks;
  };

}  // namespace llarp::apple
```


-------------------------------

Updated on 2025-01-26 at 05:10:09 +0000
