---
title: llarp::path::PathContext

---

# llarp::path::PathContext





## Public Classes

|                | Name           |
| -------------- | -------------- |
| struct | **[SyncOwnedPathsMap_t](Classes/structllarp_1_1path_1_1PathContext_1_1SyncOwnedPathsMap__t.md)**  |
| struct | **[SyncTransitMap_t](Classes/structllarp_1_1path_1_1PathContext_1_1SyncTransitMap__t.md)**  |

## Public Types

|                | Name           |
| -------------- | -------------- |
| using std::set< Path_ptr, [ComparePtr](Classes/structllarp_1_1ComparePtr.md)< Path_ptr > > | **[EndpointPathPtrSet](Classes/structllarp_1_1path_1_1PathContext.md#using-endpointpathptrset)**  |
| using std::unordered_multimap< [PathID_t](Classes/structllarp_1_1PathID__t.md), TransitHop_ptr > | **[TransitHopsMap_t](Classes/structllarp_1_1path_1_1PathContext.md#using-transithopsmap-t)**  |
| using std::unordered_map< [PathID_t](Classes/structllarp_1_1PathID__t.md), Path_ptr > | **[OwnedPathsMap_t](Classes/structllarp_1_1path_1_1PathContext.md#using-ownedpathsmap-t)**  |

## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[PathContext](Classes/structllarp_1_1path_1_1PathContext.md#function-pathcontext)**([AbstractRouter](Classes/structllarp_1_1AbstractRouter.md) * router) |
| void | **[ExpirePaths](Classes/structllarp_1_1path_1_1PathContext.md#function-expirepaths)**(llarp_time_t now)<br>called from router tick function  |
| void | **[PumpUpstream](Classes/structllarp_1_1path_1_1PathContext.md#function-pumpupstream)**() |
| void | **[PumpDownstream](Classes/structllarp_1_1path_1_1PathContext.md#function-pumpdownstream)**() |
| void | **[AllowTransit](Classes/structllarp_1_1path_1_1PathContext.md#function-allowtransit)**() |
| void | **[RejectTransit](Classes/structllarp_1_1path_1_1PathContext.md#function-rejecttransit)**() |
| bool | **[CheckPathLimitHitByIP](Classes/structllarp_1_1path_1_1PathContext.md#function-checkpathlimithitbyip)**(const [IpAddress](Classes/structllarp_1_1IpAddress.md) & ip) |
| bool | **[AllowingTransit](Classes/structllarp_1_1path_1_1PathContext.md#function-allowingtransit)**() const |
| bool | **[HasTransitHop](Classes/structllarp_1_1path_1_1PathContext.md#function-hastransithop)**(const [TransitHopInfo](Classes/structllarp_1_1path_1_1TransitHopInfo.md) & info) |
| bool | **[HandleRelayCommit](Classes/structllarp_1_1path_1_1PathContext.md#function-handlerelaycommit)**(const [LR_CommitMessage](Classes/structllarp_1_1LR__CommitMessage.md) & msg) |
| void | **[PutTransitHop](Classes/structllarp_1_1path_1_1PathContext.md#function-puttransithop)**(std::shared_ptr< [TransitHop](Classes/structllarp_1_1path_1_1TransitHop.md) > hop) |
| HopHandler_ptr | **[GetByUpstream](Classes/structllarp_1_1path_1_1PathContext.md#function-getbyupstream)**(const [RouterID](Classes/structllarp_1_1RouterID.md) & id, const [PathID_t](Classes/structllarp_1_1PathID__t.md) & path) |
| bool | **[TransitHopPreviousIsRouter](Classes/structllarp_1_1path_1_1PathContext.md#function-transithoppreviousisrouter)**(const [PathID_t](Classes/structllarp_1_1PathID__t.md) & path, const [RouterID](Classes/structllarp_1_1RouterID.md) & r) |
| TransitHop_ptr | **[GetPathForTransfer](Classes/structllarp_1_1path_1_1PathContext.md#function-getpathfortransfer)**(const [PathID_t](Classes/structllarp_1_1PathID__t.md) & topath) |
| HopHandler_ptr | **[GetByDownstream](Classes/structllarp_1_1path_1_1PathContext.md#function-getbydownstream)**(const [RouterID](Classes/structllarp_1_1RouterID.md) & id, const [PathID_t](Classes/structllarp_1_1PathID__t.md) & path) |
| std::optional< std::weak_ptr< [TransitHop](Classes/structllarp_1_1path_1_1TransitHop.md) > > | **[TransitHopByInfo](Classes/structllarp_1_1path_1_1PathContext.md#function-transithopbyinfo)**(const [TransitHopInfo](Classes/structllarp_1_1path_1_1TransitHopInfo.md) & ) |
| std::optional< std::weak_ptr< [TransitHop](Classes/structllarp_1_1path_1_1TransitHop.md) > > | **[TransitHopByUpstream](Classes/structllarp_1_1path_1_1PathContext.md#function-transithopbyupstream)**(const [RouterID](Classes/structllarp_1_1RouterID.md) & , const [PathID_t](Classes/structllarp_1_1PathID__t.md) & ) |
| PathSet_ptr | **[GetLocalPathSet](Classes/structllarp_1_1path_1_1PathContext.md#function-getlocalpathset)**(const [PathID_t](Classes/structllarp_1_1PathID__t.md) & id) |
| routing::MessageHandler_ptr | **[GetHandler](Classes/structllarp_1_1path_1_1PathContext.md#function-gethandler)**(const [PathID_t](Classes/structllarp_1_1PathID__t.md) & id) |
| EndpointPathPtrSet | **[FindOwnedPathsWithEndpoint](Classes/structllarp_1_1path_1_1PathContext.md#function-findownedpathswithendpoint)**(const [RouterID](Classes/structllarp_1_1RouterID.md) & r)<br>get a set of all paths that we own who's endpoint is r  |
| bool | **[ForwardLRCM](Classes/structllarp_1_1path_1_1PathContext.md#function-forwardlrcm)**(const [RouterID](Classes/structllarp_1_1RouterID.md) & nextHop, const std::array< [EncryptedFrame](Classes/structllarp_1_1EncryptedFrame.md), 8 > & frames, SendStatusHandler handler) |
| bool | **[HopIsUs](Classes/structllarp_1_1path_1_1PathContext.md#function-hopisus)**(const [RouterID](Classes/structllarp_1_1RouterID.md) & k) const |
| bool | **[HandleLRUM](Classes/structllarp_1_1path_1_1PathContext.md#function-handlelrum)**(const [RelayUpstreamMessage](Classes/structllarp_1_1RelayUpstreamMessage.md) & msg) |
| bool | **[HandleLRDM](Classes/structllarp_1_1path_1_1PathContext.md#function-handlelrdm)**(const [RelayDownstreamMessage](Classes/structllarp_1_1RelayDownstreamMessage.md) & msg) |
| void | **[AddOwnPath](Classes/structllarp_1_1path_1_1PathContext.md#function-addownpath)**(PathSet_ptr set, Path_ptr p) |
| void | **[RemovePathSet](Classes/structllarp_1_1path_1_1PathContext.md#function-removepathset)**(PathSet_ptr set) |
| const EventLoop_ptr & | **[loop](Classes/structllarp_1_1path_1_1PathContext.md#function-loop)**() |
| [AbstractRouter](Classes/structllarp_1_1AbstractRouter.md) * | **[Router](Classes/structllarp_1_1path_1_1PathContext.md#function-router)**() |
| const [SecretKey](Classes/structllarp_1_1SecretKey.md) & | **[EncryptionSecretKey](Classes/structllarp_1_1path_1_1PathContext.md#function-encryptionsecretkey)**() |
| const byte_t * | **[OurRouterID](Classes/structllarp_1_1path_1_1PathContext.md#function-ourrouterid)**() const |
| uint64_t | **[CurrentTransitPaths](Classes/structllarp_1_1path_1_1PathContext.md#function-currenttransitpaths)**()<br>current number of transit paths we have  |
| uint64_t | **[CurrentOwnedPaths](Classes/structllarp_1_1path_1_1PathContext.md#function-currentownedpaths)**(path::PathStatus status =path::PathStatus::ePathEstablished)<br>current number of paths we created in status  |

## Public Types Documentation

### using EndpointPathPtrSet

```cpp
using llarp::path::PathContext::EndpointPathPtrSet =  std::set<Path_ptr, ComparePtr<Path_ptr> >;
```


### using TransitHopsMap_t

```cpp
using llarp::path::PathContext::TransitHopsMap_t =  std::unordered_multimap<PathID_t, TransitHop_ptr>;
```


### using OwnedPathsMap_t

```cpp
using llarp::path::PathContext::OwnedPathsMap_t =  std::unordered_map<PathID_t, Path_ptr>;
```


## Public Functions Documentation

### function PathContext

```cpp
explicit PathContext(
    AbstractRouter * router
)
```


### function ExpirePaths

```cpp
void ExpirePaths(
    llarp_time_t now
)
```

called from router tick function 

### function PumpUpstream

```cpp
void PumpUpstream()
```


### function PumpDownstream

```cpp
void PumpDownstream()
```


### function AllowTransit

```cpp
void AllowTransit()
```


### function RejectTransit

```cpp
void RejectTransit()
```


### function CheckPathLimitHitByIP

```cpp
bool CheckPathLimitHitByIP(
    const IpAddress & ip
)
```


### function AllowingTransit

```cpp
bool AllowingTransit() const
```


### function HasTransitHop

```cpp
bool HasTransitHop(
    const TransitHopInfo & info
)
```


### function HandleRelayCommit

```cpp
bool HandleRelayCommit(
    const LR_CommitMessage & msg
)
```


### function PutTransitHop

```cpp
void PutTransitHop(
    std::shared_ptr< TransitHop > hop
)
```


### function GetByUpstream

```cpp
HopHandler_ptr GetByUpstream(
    const RouterID & id,
    const PathID_t & path
)
```


### function TransitHopPreviousIsRouter

```cpp
bool TransitHopPreviousIsRouter(
    const PathID_t & path,
    const RouterID & r
)
```


### function GetPathForTransfer

```cpp
TransitHop_ptr GetPathForTransfer(
    const PathID_t & topath
)
```


### function GetByDownstream

```cpp
HopHandler_ptr GetByDownstream(
    const RouterID & id,
    const PathID_t & path
)
```


### function TransitHopByInfo

```cpp
std::optional< std::weak_ptr< TransitHop > > TransitHopByInfo(
    const TransitHopInfo & 
)
```


### function TransitHopByUpstream

```cpp
std::optional< std::weak_ptr< TransitHop > > TransitHopByUpstream(
    const RouterID & ,
    const PathID_t & 
)
```


### function GetLocalPathSet

```cpp
PathSet_ptr GetLocalPathSet(
    const PathID_t & id
)
```


### function GetHandler

```cpp
routing::MessageHandler_ptr GetHandler(
    const PathID_t & id
)
```


### function FindOwnedPathsWithEndpoint

```cpp
EndpointPathPtrSet FindOwnedPathsWithEndpoint(
    const RouterID & r
)
```

get a set of all paths that we own who's endpoint is r 

### function ForwardLRCM

```cpp
bool ForwardLRCM(
    const RouterID & nextHop,
    const std::array< EncryptedFrame, 8 > & frames,
    SendStatusHandler handler
)
```


### function HopIsUs

```cpp
bool HopIsUs(
    const RouterID & k
) const
```


### function HandleLRUM

```cpp
bool HandleLRUM(
    const RelayUpstreamMessage & msg
)
```


### function HandleLRDM

```cpp
bool HandleLRDM(
    const RelayDownstreamMessage & msg
)
```


### function AddOwnPath

```cpp
void AddOwnPath(
    PathSet_ptr set,
    Path_ptr p
)
```


### function RemovePathSet

```cpp
void RemovePathSet(
    PathSet_ptr set
)
```


### function loop

```cpp
const EventLoop_ptr & loop()
```


### function Router

```cpp
AbstractRouter * Router()
```


### function EncryptionSecretKey

```cpp
const SecretKey & EncryptionSecretKey()
```


### function OurRouterID

```cpp
const byte_t * OurRouterID() const
```


### function CurrentTransitPaths

```cpp
uint64_t CurrentTransitPaths()
```

current number of transit paths we have 

### function CurrentOwnedPaths

```cpp
uint64_t CurrentOwnedPaths(
    path::PathStatus status =path::PathStatus::ePathEstablished
)
```

current number of paths we created in status 

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

Updated on 2023-01-20 at 18:12:19 +0000