---
title: llarp::vpn::NetworkInterface
summary: a vpn network interface 

---

# llarp::vpn::NetworkInterface



a vpn network interface 


`#include <vpn.hpp>`

Inherited by [llarp::apple::VPNInterface](Classes/classllarp_1_1apple_1_1VPNInterface.md), [llarp::vpn::AndroidInterface](Classes/classllarp_1_1vpn_1_1AndroidInterface.md), [llarp::vpn::LinuxInterface](Classes/classllarp_1_1vpn_1_1LinuxInterface.md), [llarp::vpn::Win32Interface](Classes/classllarp_1_1vpn_1_1Win32Interface.md)

## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[NetworkInterface](Classes/classllarp_1_1vpn_1_1NetworkInterface.md#function-networkinterface)**() =default |
| | **[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 |
| virtual int | **[PollFD](Classes/classllarp_1_1vpn_1_1NetworkInterface.md#function-pollfd)**() const =0<br>get pollable fd for reading  |
| virtual std::string | **[IfName](Classes/classllarp_1_1vpn_1_1NetworkInterface.md#function-ifname)**() const =0<br>the interface's name  |
| virtual [net::IPPacket](Classes/structllarp_1_1net_1_1IPPacket.md) | **[ReadNextPacket](Classes/classllarp_1_1vpn_1_1NetworkInterface.md#function-readnextpacket)**() =0<br>read next ip packet, return an empty packet if there are none ready.  |
| virtual bool | **[WritePacket](Classes/classllarp_1_1vpn_1_1NetworkInterface.md#function-writepacket)**([net::IPPacket](Classes/structllarp_1_1net_1_1IPPacket.md) pkt) =0<br>write a packet to the interface returns false if we dropped it  |
| virtual void | **[MaybeWakeUpperLayers](Classes/classllarp_1_1vpn_1_1NetworkInterface.md#function-maybewakeupperlayers)**() const<br>idempotently wake up the upper layers as needed (platform dependant)  |

## Public Functions Documentation

### function NetworkInterface

```cpp
NetworkInterface() =default
```


### function NetworkInterface

```cpp
NetworkInterface(
    const NetworkInterface & 
) =delete
```


### function NetworkInterface

```cpp
NetworkInterface(
    NetworkInterface && 
) =delete
```


### function ~NetworkInterface

```cpp
virtual ~NetworkInterface() =default
```


### function PollFD

```cpp
virtual int PollFD() const =0
```

get pollable fd for reading 

**Reimplemented by**: [llarp::apple::VPNInterface::PollFD](Classes/classllarp_1_1apple_1_1VPNInterface.md#function-pollfd), [llarp::vpn::AndroidInterface::PollFD](Classes/classllarp_1_1vpn_1_1AndroidInterface.md#function-pollfd), [llarp::vpn::LinuxInterface::PollFD](Classes/classllarp_1_1vpn_1_1LinuxInterface.md#function-pollfd), [llarp::vpn::Win32Interface::PollFD](Classes/classllarp_1_1vpn_1_1Win32Interface.md#function-pollfd)


### function IfName

```cpp
virtual std::string IfName() const =0
```

the interface's name 

**Reimplemented by**: [llarp::apple::VPNInterface::IfName](Classes/classllarp_1_1apple_1_1VPNInterface.md#function-ifname), [llarp::vpn::AndroidInterface::IfName](Classes/classllarp_1_1vpn_1_1AndroidInterface.md#function-ifname), [llarp::vpn::LinuxInterface::IfName](Classes/classllarp_1_1vpn_1_1LinuxInterface.md#function-ifname), [llarp::vpn::Win32Interface::IfName](Classes/classllarp_1_1vpn_1_1Win32Interface.md#function-ifname)


### function ReadNextPacket

```cpp
virtual net::IPPacket ReadNextPacket() =0
```

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

**Reimplemented by**: [llarp::apple::VPNInterface::ReadNextPacket](Classes/classllarp_1_1apple_1_1VPNInterface.md#function-readnextpacket), [llarp::vpn::AndroidInterface::ReadNextPacket](Classes/classllarp_1_1vpn_1_1AndroidInterface.md#function-readnextpacket), [llarp::vpn::LinuxInterface::ReadNextPacket](Classes/classllarp_1_1vpn_1_1LinuxInterface.md#function-readnextpacket), [llarp::vpn::Win32Interface::ReadNextPacket](Classes/classllarp_1_1vpn_1_1Win32Interface.md#function-readnextpacket)


### function WritePacket

```cpp
virtual bool WritePacket(
    net::IPPacket pkt
) =0
```

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

**Reimplemented by**: [llarp::vpn::Win32Interface::WritePacket](Classes/classllarp_1_1vpn_1_1Win32Interface.md#function-writepacket), [llarp::apple::VPNInterface::WritePacket](Classes/classllarp_1_1apple_1_1VPNInterface.md#function-writepacket), [llarp::vpn::AndroidInterface::WritePacket](Classes/classllarp_1_1vpn_1_1AndroidInterface.md#function-writepacket), [llarp::vpn::LinuxInterface::WritePacket](Classes/classllarp_1_1vpn_1_1LinuxInterface.md#function-writepacket)


### function MaybeWakeUpperLayers

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

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

**Reimplemented by**: [llarp::apple::VPNInterface::MaybeWakeUpperLayers](Classes/classllarp_1_1apple_1_1VPNInterface.md#function-maybewakeupperlayers), [llarp::vpn::Win32Interface::MaybeWakeUpperLayers](Classes/classllarp_1_1vpn_1_1Win32Interface.md#function-maybewakeupperlayers)


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

Updated on 2022-08-30 at 18:09:28 +0000