llarp::dns::PacketSource_Wrapper

a packet source which will override the sendto function of an wrapped packet source to construct a raw ip packet as a reply

#include <server.hpp>

Inherits from llarp::dns::PacketSource_Base

Public Functions

Name
PacketSource_Wrapper(std::weak_ptr< PacketSource_Base > wrapped, std::function< void(net::IPPacket)> write_packet)
virtual bool WouldLoop(const SockAddr & to, const SockAddr & from) const override
return true if traffic with source and dest addresses would cause a loop in resolution and thus should not be sent to query handlers
virtual void SendTo(const SockAddr & to, const SockAddr & from, OwnedBuffer buf) const override
send packet with src and dst address containing buf on this packet source
virtual void Stop() override
stop reading packets and end operation
virtual std::optional< SockAddr > BoundOn() const override
returns the sockaddr we are bound on if applicable

Additional inherited members

Public Functions inherited from llarp::dns::PacketSource_Base

Name
virtual ~PacketSource_Base() =default

Public Functions Documentation

function PacketSource_Wrapper

inline explicit PacketSource_Wrapper(
    std::weak_ptr< PacketSource_Base > wrapped,
    std::function< void(net::IPPacket)> write_packet
)

function WouldLoop

inline virtual bool WouldLoop(
    const SockAddr & to,
    const SockAddr & from
) const override

return true if traffic with source and dest addresses would cause a loop in resolution and thus should not be sent to query handlers

Reimplements: llarp::dns::PacketSource_Base::WouldLoop

function SendTo

inline virtual void SendTo(
    const SockAddr & to,
    const SockAddr & from,
    OwnedBuffer buf
) const override

send packet with src and dst address containing buf on this packet source

Reimplements: llarp::dns::PacketSource_Base::SendTo

function Stop

inline virtual void Stop() override

stop reading packets and end operation

Reimplements: llarp::dns::PacketSource_Base::Stop

function BoundOn

inline virtual std::optional< SockAddr > BoundOn() const override

returns the sockaddr we are bound on if applicable

Reimplements: llarp::dns::PacketSource_Base::BoundOn


Updated on 2026-01-10 at 22:49:45 +0000