---
title: llarp::vpn::PacketRouter

---

# llarp::vpn::PacketRouter





## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[PacketRouter](Classes/classllarp_1_1vpn_1_1PacketRouter.md#function-packetrouter)**(PacketHandlerFunc baseHandler)<br>baseHandler will be called if no other handlers matches a packet  |
| void | **[HandleIPPacket](Classes/classllarp_1_1vpn_1_1PacketRouter.md#function-handleippacket)**([llarp::net::IPPacket](Classes/structllarp_1_1net_1_1IPPacket.md) pkt)<br>feed in an ip packet for handling  |
| void | **[AddIProtoHandler](Classes/classllarp_1_1vpn_1_1PacketRouter.md#function-addiprotohandler)**(uint8_t proto, PacketHandlerFunc func)<br>add a non udp packet handler using ip protocol proto  |
| void | **[AddUDPHandler](Classes/classllarp_1_1vpn_1_1PacketRouter.md#function-addudphandler)**([huint16_t](Classes/structllarp_1_1huint__t.md) localport, PacketHandlerFunc func)<br>helper that adds a udp packet handler for UDP destinted for localport  |
| void | **[RemoveUDPHandler](Classes/classllarp_1_1vpn_1_1PacketRouter.md#function-removeudphandler)**([huint16_t](Classes/structllarp_1_1huint__t.md) localport)<br>remove a udp handler that is already set up by bound port  |

## Public Functions Documentation

### function PacketRouter

```cpp
explicit PacketRouter(
    PacketHandlerFunc baseHandler
)
```

baseHandler will be called if no other handlers matches a packet 

### function HandleIPPacket

```cpp
void HandleIPPacket(
    llarp::net::IPPacket pkt
)
```

feed in an ip packet for handling 

### function AddIProtoHandler

```cpp
void AddIProtoHandler(
    uint8_t proto,
    PacketHandlerFunc func
)
```

add a non udp packet handler using ip protocol proto 

### function AddUDPHandler

```cpp
void AddUDPHandler(
    huint16_t localport,
    PacketHandlerFunc func
)
```

helper that adds a udp packet handler for UDP destinted for localport 

### function RemoveUDPHandler

```cpp
void RemoveUDPHandler(
    huint16_t localport
)
```

remove a udp handler that is already set up by bound port 

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

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