---
title: llarp::dns::PacketHandler

---

# llarp::dns::PacketHandler





Inherits from std::enable_shared_from_this< PacketHandler >

Inherited by [llarp::dns::Proxy](Classes/classllarp_1_1dns_1_1Proxy.md)

## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[PacketHandler](Classes/classllarp_1_1dns_1_1PacketHandler.md#function-packethandler)**(EventLoop_ptr loop, [IQueryHandler](Classes/classllarp_1_1dns_1_1IQueryHandler.md) * handler) |
| virtual | **[~PacketHandler](Classes/classllarp_1_1dns_1_1PacketHandler.md#function-~packethandler)**() =default |
| virtual bool | **[Start](Classes/classllarp_1_1dns_1_1PacketHandler.md#function-start)**([SockAddr](Classes/structllarp_1_1SockAddr.md) localaddr, std::vector< [SockAddr](Classes/structllarp_1_1SockAddr.md) > upstreamResolvers, std::vector< fs::path > hostfiles) |
| void | **[Stop](Classes/classllarp_1_1dns_1_1PacketHandler.md#function-stop)**() |
| void | **[Restart](Classes/classllarp_1_1dns_1_1PacketHandler.md#function-restart)**() |
| void | **[HandlePacket](Classes/classllarp_1_1dns_1_1PacketHandler.md#function-handlepacket)**(const [SockAddr](Classes/structllarp_1_1SockAddr.md) & resolver, const [SockAddr](Classes/structllarp_1_1SockAddr.md) & from, [llarp_buffer_t](Classes/structllarp__buffer__t.md) buf) |
| bool | **[ShouldHandlePacket](Classes/classllarp_1_1dns_1_1PacketHandler.md#function-shouldhandlepacket)**(const [SockAddr](Classes/structllarp_1_1SockAddr.md) & to, const [SockAddr](Classes/structllarp_1_1SockAddr.md) & from, [llarp_buffer_t](Classes/structllarp__buffer__t.md) buf) const |

## Protected Functions

|                | Name           |
| -------------- | -------------- |
| virtual void | **[SendServerMessageBufferTo](Classes/classllarp_1_1dns_1_1PacketHandler.md#function-sendservermessagebufferto)**(const [SockAddr](Classes/structllarp_1_1SockAddr.md) & to, const [SockAddr](Classes/structllarp_1_1SockAddr.md) & from, [llarp_buffer_t](Classes/structllarp__buffer__t.md) buf) =0 |
| virtual bool | **[IsUpstreamResolver](Classes/classllarp_1_1dns_1_1PacketHandler.md#function-isupstreamresolver)**(const [SockAddr](Classes/structllarp_1_1SockAddr.md) & to, const [SockAddr](Classes/structllarp_1_1SockAddr.md) & from) const |

## Public Functions Documentation

### function PacketHandler

```cpp
explicit PacketHandler(
    EventLoop_ptr loop,
    IQueryHandler * handler
)
```


### function ~PacketHandler

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


### function Start

```cpp
virtual bool Start(
    SockAddr localaddr,
    std::vector< SockAddr > upstreamResolvers,
    std::vector< fs::path > hostfiles
)
```


**Reimplemented by**: [llarp::dns::Proxy::Start](Classes/classllarp_1_1dns_1_1Proxy.md#function-start)


### function Stop

```cpp
void Stop()
```


### function Restart

```cpp
void Restart()
```


### function HandlePacket

```cpp
void HandlePacket(
    const SockAddr & resolver,
    const SockAddr & from,
    llarp_buffer_t buf
)
```


### function ShouldHandlePacket

```cpp
bool ShouldHandlePacket(
    const SockAddr & to,
    const SockAddr & from,
    llarp_buffer_t buf
) const
```


## Protected Functions Documentation

### function SendServerMessageBufferTo

```cpp
virtual void SendServerMessageBufferTo(
    const SockAddr & to,
    const SockAddr & from,
    llarp_buffer_t buf
) =0
```


**Reimplemented by**: [llarp::dns::Proxy::SendServerMessageBufferTo](Classes/classllarp_1_1dns_1_1Proxy.md#function-sendservermessagebufferto)


### function IsUpstreamResolver

```cpp
virtual bool IsUpstreamResolver(
    const SockAddr & to,
    const SockAddr & from
) const
```


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

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