---
title: llarp::apple::VPNInterface

---

# llarp::apple::VPNInterface





Inherits from [llarp::vpn::NetworkInterface](Classes/classllarp_1_1vpn_1_1NetworkInterface.md), std::enable_shared_from_this< VPNInterface >, [llarp::vpn::I_Packet_IO](Classes/classllarp_1_1vpn_1_1I__Packet__IO.md)

## Public Types

|                | Name           |
| -------------- | -------------- |
| using std::function< bool(int af_family, void *data, int size)> | **[packet_write_callback](Classes/classllarp_1_1apple_1_1VPNInterface.md#using-packet-write-callback)**  |
| using std::function< void([VPNInterface](Classes/classllarp_1_1apple_1_1VPNInterface.md) &)> | **[on_readable_callback](Classes/classllarp_1_1apple_1_1VPNInterface.md#using-on-readable-callback)**  |

## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[VPNInterface](Classes/classllarp_1_1apple_1_1VPNInterface.md#function-vpninterface)**([Context](Classes/structllarp_1_1apple_1_1Context.md) & ctx, packet_write_callback packet_writer, on_readable_callback on_readable, [AbstractRouter](Classes/structllarp_1_1AbstractRouter.md) * router) |
| bool | **[OfferReadPacket](Classes/classllarp_1_1apple_1_1VPNInterface.md#function-offerreadpacket)**(const [llarp_buffer_t](Classes/structllarp__buffer__t.md) & buf) |
| virtual int | **[PollFD](Classes/classllarp_1_1apple_1_1VPNInterface.md#function-pollfd)**() const override<br>get pollable fd for reading  |
| virtual [net::IPPacket](Classes/structllarp_1_1net_1_1IPPacket.md) | **[ReadNextPacket](Classes/classllarp_1_1apple_1_1VPNInterface.md#function-readnextpacket)**() override<br>read next ip packet, return an empty packet if there are none ready.  |
| virtual bool | **[WritePacket](Classes/classllarp_1_1apple_1_1VPNInterface.md#function-writepacket)**([net::IPPacket](Classes/structllarp_1_1net_1_1IPPacket.md) pkt) override<br>write a packet to the interface returns false if we dropped it  |
| virtual void | **[MaybeWakeUpperLayers](Classes/classllarp_1_1apple_1_1VPNInterface.md#function-maybewakeupperlayers)**() const override<br>idempotently wake up the upper layers as needed (platform dependant)  |

## Additional inherited members

**Public Functions inherited from [llarp::vpn::NetworkInterface](Classes/classllarp_1_1vpn_1_1NetworkInterface.md)**

|                | Name           |
| -------------- | -------------- |
| | **[NetworkInterface](Classes/classllarp_1_1vpn_1_1NetworkInterface.md#function-networkinterface)**([InterfaceInfo](Classes/structllarp_1_1vpn_1_1InterfaceInfo.md) info) |
| | **[NetworkInterface](Classes/classllarp_1_1vpn_1_1NetworkInterface.md#function-networkinterface)**(const [NetworkInterface](Classes/classllarp_1_1vpn_1_1NetworkInterface.md) & ) =delete |
| | **[NetworkInterface](Classes/classllarp_1_1vpn_1_1NetworkInterface.md#function-networkinterface)**([NetworkInterface](Classes/classllarp_1_1vpn_1_1NetworkInterface.md) && ) =delete |
| virtual | **[~NetworkInterface](Classes/classllarp_1_1vpn_1_1NetworkInterface.md#function-~networkinterface)**() =default |
| const [InterfaceInfo](Classes/structllarp_1_1vpn_1_1InterfaceInfo.md) & | **[Info](Classes/classllarp_1_1vpn_1_1NetworkInterface.md#function-info)**() const |

**Protected Attributes inherited from [llarp::vpn::NetworkInterface](Classes/classllarp_1_1vpn_1_1NetworkInterface.md)**

|                | Name           |
| -------------- | -------------- |
| [InterfaceInfo](Classes/structllarp_1_1vpn_1_1InterfaceInfo.md) | **[m_Info](Classes/classllarp_1_1vpn_1_1NetworkInterface.md#variable-m-info)**  |

**Public Functions inherited from [llarp::vpn::I_Packet_IO](Classes/classllarp_1_1vpn_1_1I__Packet__IO.md)**

|                | Name           |
| -------------- | -------------- |
| virtual | **[~I_Packet_IO](Classes/classllarp_1_1vpn_1_1I__Packet__IO.md#function-~i-packet-io)**() =default |
| virtual void | **[Start](Classes/classllarp_1_1vpn_1_1I__Packet__IO.md#function-start)**()<br>start any platform specific operations before running  |
| virtual void | **[Stop](Classes/classllarp_1_1vpn_1_1I__Packet__IO.md#function-stop)**()<br>stop operation and tear down anything that [Start()](Classes/classllarp_1_1vpn_1_1I__Packet__IO.md#function-start) set up.  |


## Public Types Documentation

### using packet_write_callback

```cpp
using llarp::apple::VPNInterface::packet_write_callback =  std::function<bool(int af_family, void* data, int size)>;
```


### using on_readable_callback

```cpp
using llarp::apple::VPNInterface::on_readable_callback =  std::function<void(VPNInterface&)>;
```


## Public Functions Documentation

### function VPNInterface

```cpp
explicit VPNInterface(
    Context & ctx,
    packet_write_callback packet_writer,
    on_readable_callback on_readable,
    AbstractRouter * router
)
```


### function OfferReadPacket

```cpp
bool OfferReadPacket(
    const llarp_buffer_t & buf
)
```


### function PollFD

```cpp
virtual int PollFD() const override
```

get pollable fd for reading 

**Reimplements**: [llarp::vpn::I_Packet_IO::PollFD](Classes/classllarp_1_1vpn_1_1I__Packet__IO.md#function-pollfd)


### function ReadNextPacket

```cpp
virtual net::IPPacket ReadNextPacket() override
```

read next ip packet, return an empty packet if there are none ready. 

**Reimplements**: [llarp::vpn::I_Packet_IO::ReadNextPacket](Classes/classllarp_1_1vpn_1_1I__Packet__IO.md#function-readnextpacket)


### function WritePacket

```cpp
virtual bool WritePacket(
    net::IPPacket pkt
) override
```

write a packet to the interface returns false if we dropped it 

**Reimplements**: [llarp::vpn::I_Packet_IO::WritePacket](Classes/classllarp_1_1vpn_1_1I__Packet__IO.md#function-writepacket)


### function MaybeWakeUpperLayers

```cpp
virtual void MaybeWakeUpperLayers() const override
```

idempotently wake up the upper layers as needed (platform dependant) 

**Reimplements**: [llarp::vpn::NetworkInterface::MaybeWakeUpperLayers](Classes/classllarp_1_1vpn_1_1NetworkInterface.md#function-maybewakeupperlayers)


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

Updated on 2022-10-25 at 00:38:15 +0000