---
title: llarp::dht::AbstractContext

---

# llarp::dht::AbstractContext





## Public Types

|                | Name           |
| -------------- | -------------- |
| using [TXHolder](Classes/structllarp_1_1dht_1_1TXHolder.md)< [TXOwner](Classes/structllarp_1_1dht_1_1TXOwner.md), [service::EncryptedIntroSet](Classes/structllarp_1_1service_1_1EncryptedIntroSet.md) > | **[PendingIntrosetLookups](Classes/structllarp_1_1dht_1_1AbstractContext.md#using-pendingintrosetlookups)**  |
| using [TXHolder](Classes/structllarp_1_1dht_1_1TXHolder.md)< [RouterID](Classes/structllarp_1_1RouterID.md), [RouterContact](Classes/structllarp_1_1RouterContact.md) > | **[PendingRouterLookups](Classes/structllarp_1_1dht_1_1AbstractContext.md#using-pendingrouterlookups)**  |
| using [TXHolder](Classes/structllarp_1_1dht_1_1TXHolder.md)< [RouterID](Classes/structllarp_1_1RouterID.md), [RouterID](Classes/structllarp_1_1RouterID.md) > | **[PendingExploreLookups](Classes/structllarp_1_1dht_1_1AbstractContext.md#using-pendingexplorelookups)**  |

## Public Functions

|                | Name           |
| -------------- | -------------- |
| virtual | **[~AbstractContext](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-~abstractcontext)**() =0 |
| virtual bool | **[LookupRouter](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-lookuprouter)**(const [RouterID](Classes/structllarp_1_1RouterID.md) & target, RouterLookupHandler result) =0 |
| virtual void | **[LookupRouterRecursive](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-lookuprouterrecursive)**(const [RouterID](Classes/structllarp_1_1RouterID.md) & target, const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & whoasked, uint64_t whoaskedTX, const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & askpeer, RouterLookupHandler result =nullptr) =0 |
| virtual void | **[LookupIntroSetRelayed](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-lookupintrosetrelayed)**(const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & target, const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & whoasked, uint64_t whoaskedTX, const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & askpeer, uint64_t relayOrder, service::EncryptedIntroSetLookupHandler result =service::EncryptedIntroSetLookupHandler()) =0<br>Ask a Service Node to perform an Introset lookup for us.  |
| virtual void | **[LookupIntroSetDirect](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-lookupintrosetdirect)**(const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & target, const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & whoasked, uint64_t whoaskedTX, const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & askpeer, service::EncryptedIntroSetLookupHandler result =service::EncryptedIntroSetLookupHandler()) =0<br>Directly as a Service Node for an Introset.  |
| virtual bool | **[HasRouterLookup](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-hasrouterlookup)**(const [RouterID](Classes/structllarp_1_1RouterID.md) & target) const =0 |
| virtual void | **[LookupRouterForPath](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-lookuprouterforpath)**(const [RouterID](Classes/structllarp_1_1RouterID.md) & target, uint64_t txid, const [PathID_t](Classes/structllarp_1_1PathID__t.md) & path, const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & askpeer) =0<br>issue dht lookup for router via askpeer and send reply to local path  |
| virtual void | **[LookupIntroSetForPath](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-lookupintrosetforpath)**(const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & addr, uint64_t txid, const [PathID_t](Classes/structllarp_1_1PathID__t.md) & path, const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & askpeer, uint64_t relayOrder) =0 |
| virtual void | **[DHTSendTo](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-dhtsendto)**(const [RouterID](Classes/structllarp_1_1RouterID.md) & peer, [IMessage](Classes/structllarp_1_1dht_1_1IMessage.md) * msg, bool keepalive =true) =0 |
| virtual bool | **[HandleExploritoryRouterLookup](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-handleexploritoryrouterlookup)**(const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & requester, uint64_t txid, const [RouterID](Classes/structllarp_1_1RouterID.md) & target, std::vector< std::unique_ptr< [IMessage](Classes/structllarp_1_1dht_1_1IMessage.md) > > & reply) =0<br>get routers closest to target excluding requester  |
| virtual void | **[LookupRouterRelayed](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-lookuprouterrelayed)**(const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & requester, uint64_t txid, const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & target, bool recursive, std::vector< std::unique_ptr< [IMessage](Classes/structllarp_1_1dht_1_1IMessage.md) > > & replies) =0<br>handle rc lookup from requester for target  |
| virtual bool | **[RelayRequestForPath](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-relayrequestforpath)**(const [PathID_t](Classes/structllarp_1_1PathID__t.md) & localPath, const [IMessage](Classes/structllarp_1_1dht_1_1IMessage.md) & msg) =0 |
| virtual void | **[PropagateLocalIntroSet](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-propagatelocalintroset)**(const [PathID_t](Classes/structllarp_1_1PathID__t.md) & path, uint64_t sourceTX, const [service::EncryptedIntroSet](Classes/structllarp_1_1service_1_1EncryptedIntroSet.md) & introset, const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & peer, uint64_t relayOrder) =0<br>send introset to peer from source with S counter and excluding peers  |
| virtual void | **[PropagateIntroSetTo](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-propagateintrosetto)**(const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & source, uint64_t sourceTX, const [service::EncryptedIntroSet](Classes/structllarp_1_1service_1_1EncryptedIntroSet.md) & introset, const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & peer, uint64_t relayOrder) =0<br>send introset to peer from source with S counter and excluding peers  |
| virtual void | **[Init](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-init)**(const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & us, [AbstractRouter](Classes/structllarp_1_1AbstractRouter.md) * router) =0 |
| virtual std::optional< [llarp::service::EncryptedIntroSet](Classes/structllarp_1_1service_1_1EncryptedIntroSet.md) > | **[GetIntroSetByLocation](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-getintrosetbylocation)**(const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & location) const =0 |
| virtual llarp_time_t | **[Now](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-now)**() const =0 |
| virtual void | **[ExploreNetworkVia](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-explorenetworkvia)**(const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & peer) =0 |
| virtual [llarp::AbstractRouter](Classes/structllarp_1_1AbstractRouter.md) * | **[GetRouter](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-getrouter)**() const =0 |
| virtual bool | **[GetRCFromNodeDB](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-getrcfromnodedb)**(const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & k, [llarp::RouterContact](Classes/structllarp_1_1RouterContact.md) & rc) const =0 |
| virtual const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & | **[OurKey](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-ourkey)**() const =0 |
| virtual [PendingIntrosetLookups](Classes/structllarp_1_1dht_1_1TXHolder.md) & | **[pendingIntrosetLookups](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-pendingintrosetlookups)**() =0 |
| virtual const [PendingIntrosetLookups](Classes/structllarp_1_1dht_1_1TXHolder.md) & | **[pendingIntrosetLookups](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-pendingintrosetlookups)**() const =0 |
| virtual [PendingRouterLookups](Classes/structllarp_1_1dht_1_1TXHolder.md) & | **[pendingRouterLookups](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-pendingrouterlookups)**() =0 |
| virtual const [PendingRouterLookups](Classes/structllarp_1_1dht_1_1TXHolder.md) & | **[pendingRouterLookups](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-pendingrouterlookups)**() const =0 |
| virtual [PendingExploreLookups](Classes/structllarp_1_1dht_1_1TXHolder.md) & | **[pendingExploreLookups](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-pendingexplorelookups)**() =0 |
| virtual const [PendingExploreLookups](Classes/structllarp_1_1dht_1_1TXHolder.md) & | **[pendingExploreLookups](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-pendingexplorelookups)**() const =0 |
| virtual [Bucket](Classes/structllarp_1_1dht_1_1Bucket.md)< [ISNode](Classes/structllarp_1_1dht_1_1ISNode.md) > * | **[services](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-services)**() =0 |
| virtual bool & | **[AllowTransit](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-allowtransit)**() =0 |
| virtual const bool & | **[AllowTransit](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-allowtransit)**() const =0 |
| virtual [Bucket](Classes/structllarp_1_1dht_1_1Bucket.md)< [RCNode](Classes/structllarp_1_1dht_1_1RCNode.md) > * | **[Nodes](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-nodes)**() const =0 |
| virtual void | **[PutRCNodeAsync](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-putrcnodeasync)**(const [RCNode](Classes/structllarp_1_1dht_1_1RCNode.md) & val) =0 |
| virtual void | **[DelRCNodeAsync](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-delrcnodeasync)**(const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & val) =0 |
| virtual util::StatusObject | **[ExtractStatus](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-extractstatus)**() const =0 |
| virtual void | **[StoreRC](Classes/structllarp_1_1dht_1_1AbstractContext.md#function-storerc)**(const [RouterContact](Classes/structllarp_1_1RouterContact.md) rc) const =0 |

## Public Types Documentation

### using PendingIntrosetLookups

```cpp
using llarp::dht::AbstractContext::PendingIntrosetLookups =  TXHolder<TXOwner, service::EncryptedIntroSet>;
```


### using PendingRouterLookups

```cpp
using llarp::dht::AbstractContext::PendingRouterLookups =  TXHolder<RouterID, RouterContact>;
```


### using PendingExploreLookups

```cpp
using llarp::dht::AbstractContext::PendingExploreLookups =  TXHolder<RouterID, RouterID>;
```


## Public Functions Documentation

### function ~AbstractContext

```cpp
virtual ~AbstractContext() =0
```


### function LookupRouter

```cpp
virtual bool LookupRouter(
    const RouterID & target,
    RouterLookupHandler result
) =0
```


### function LookupRouterRecursive

```cpp
virtual void LookupRouterRecursive(
    const RouterID & target,
    const Key_t & whoasked,
    uint64_t whoaskedTX,
    const Key_t & askpeer,
    RouterLookupHandler result =nullptr
) =0
```


### function LookupIntroSetRelayed

```cpp
virtual void LookupIntroSetRelayed(
    const Key_t & target,
    const Key_t & whoasked,
    uint64_t whoaskedTX,
    const Key_t & askpeer,
    uint64_t relayOrder,
    service::EncryptedIntroSetLookupHandler result =service::EncryptedIntroSetLookupHandler()
) =0
```

Ask a Service Node to perform an Introset lookup for us. 

### function LookupIntroSetDirect

```cpp
virtual void LookupIntroSetDirect(
    const Key_t & target,
    const Key_t & whoasked,
    uint64_t whoaskedTX,
    const Key_t & askpeer,
    service::EncryptedIntroSetLookupHandler result =service::EncryptedIntroSetLookupHandler()
) =0
```

Directly as a Service Node for an Introset. 

### function HasRouterLookup

```cpp
virtual bool HasRouterLookup(
    const RouterID & target
) const =0
```


### function LookupRouterForPath

```cpp
virtual void LookupRouterForPath(
    const RouterID & target,
    uint64_t txid,
    const PathID_t & path,
    const Key_t & askpeer
) =0
```

issue dht lookup for router via askpeer and send reply to local path 

### function LookupIntroSetForPath

```cpp
virtual void LookupIntroSetForPath(
    const Key_t & addr,
    uint64_t txid,
    const PathID_t & path,
    const Key_t & askpeer,
    uint64_t relayOrder
) =0
```


### function DHTSendTo

```cpp
virtual void DHTSendTo(
    const RouterID & peer,
    IMessage * msg,
    bool keepalive =true
) =0
```


### function HandleExploritoryRouterLookup

```cpp
virtual bool HandleExploritoryRouterLookup(
    const Key_t & requester,
    uint64_t txid,
    const RouterID & target,
    std::vector< std::unique_ptr< IMessage > > & reply
) =0
```

get routers closest to target excluding requester 

### function LookupRouterRelayed

```cpp
virtual void LookupRouterRelayed(
    const Key_t & requester,
    uint64_t txid,
    const Key_t & target,
    bool recursive,
    std::vector< std::unique_ptr< IMessage > > & replies
) =0
```

handle rc lookup from requester for target 

### function RelayRequestForPath

```cpp
virtual bool RelayRequestForPath(
    const PathID_t & localPath,
    const IMessage & msg
) =0
```


### function PropagateLocalIntroSet

```cpp
virtual void PropagateLocalIntroSet(
    const PathID_t & path,
    uint64_t sourceTX,
    const service::EncryptedIntroSet & introset,
    const Key_t & peer,
    uint64_t relayOrder
) =0
```

send introset to peer from source with S counter and excluding peers 

### function PropagateIntroSetTo

```cpp
virtual void PropagateIntroSetTo(
    const Key_t & source,
    uint64_t sourceTX,
    const service::EncryptedIntroSet & introset,
    const Key_t & peer,
    uint64_t relayOrder
) =0
```

send introset to peer from source with S counter and excluding peers 

### function Init

```cpp
virtual void Init(
    const Key_t & us,
    AbstractRouter * router
) =0
```


### function GetIntroSetByLocation

```cpp
virtual std::optional< llarp::service::EncryptedIntroSet > GetIntroSetByLocation(
    const Key_t & location
) const =0
```


### function Now

```cpp
virtual llarp_time_t Now() const =0
```


### function ExploreNetworkVia

```cpp
virtual void ExploreNetworkVia(
    const Key_t & peer
) =0
```


### function GetRouter

```cpp
virtual llarp::AbstractRouter * GetRouter() const =0
```


### function GetRCFromNodeDB

```cpp
virtual bool GetRCFromNodeDB(
    const Key_t & k,
    llarp::RouterContact & rc
) const =0
```


### function OurKey

```cpp
virtual const Key_t & OurKey() const =0
```


### function pendingIntrosetLookups

```cpp
virtual PendingIntrosetLookups & pendingIntrosetLookups() =0
```


### function pendingIntrosetLookups

```cpp
virtual const PendingIntrosetLookups & pendingIntrosetLookups() const =0
```


### function pendingRouterLookups

```cpp
virtual PendingRouterLookups & pendingRouterLookups() =0
```


### function pendingRouterLookups

```cpp
virtual const PendingRouterLookups & pendingRouterLookups() const =0
```


### function pendingExploreLookups

```cpp
virtual PendingExploreLookups & pendingExploreLookups() =0
```


### function pendingExploreLookups

```cpp
virtual const PendingExploreLookups & pendingExploreLookups() const =0
```


### function services

```cpp
virtual Bucket< ISNode > * services() =0
```


### function AllowTransit

```cpp
virtual bool & AllowTransit() =0
```


### function AllowTransit

```cpp
virtual const bool & AllowTransit() const =0
```


### function Nodes

```cpp
virtual Bucket< RCNode > * Nodes() const =0
```


### function PutRCNodeAsync

```cpp
virtual void PutRCNodeAsync(
    const RCNode & val
) =0
```


### function DelRCNodeAsync

```cpp
virtual void DelRCNodeAsync(
    const Key_t & val
) =0
```


### function ExtractStatus

```cpp
virtual util::StatusObject ExtractStatus() const =0
```


### function StoreRC

```cpp
virtual void StoreRC(
    const RouterContact rc
) const =0
```


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

Updated on 2024-11-10 at 05:10:02 +0000