---
title: tooling::HiveContext
summary: HiveContext is a subclass of llarp::Context which allows RouterHive to perform custom behavior which might be undesirable in production code. 

---

# tooling::HiveContext



[HiveContext]() is a subclass of [llarp::Context]() which allows [RouterHive]() to perform custom behavior which might be undesirable in production code. 


`#include <hive_context.hpp>`

Inherits from [llarp::Context](Classes/structllarp_1_1Context.md)

## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[HiveContext](Classes/structtooling_1_1HiveContext.md#function-hivecontext)**([RouterHive](Classes/structtooling_1_1RouterHive.md) * hive) |
| std::shared_ptr< [llarp::AbstractRouter](Classes/structllarp_1_1AbstractRouter.md) > | **[makeRouter](Classes/structtooling_1_1HiveContext.md#function-makerouter)**(const llarp::EventLoop_ptr & loop) override |
| [HiveRouter](Classes/structtooling_1_1HiveRouter.md) * | **[getRouterAsHiveRouter](Classes/structtooling_1_1HiveContext.md#function-getrouterashiverouter)**()<br>Get this context's router as a [HiveRouter]().  |

## Protected Attributes

|                | Name           |
| -------------- | -------------- |
| [RouterHive](Classes/structtooling_1_1RouterHive.md) * | **[m_hive](Classes/structtooling_1_1HiveContext.md#variable-m-hive)**  |

## Additional inherited members

**Public Functions inherited from [llarp::Context](Classes/structllarp_1_1Context.md)**

|                | Name           |
| -------------- | -------------- |
| | **[Context](Classes/structllarp_1_1Context.md#function-context)**() |
| virtual | **[~Context](Classes/structllarp_1_1Context.md#function-~context)**() =default |
| void | **[Setup](Classes/structllarp_1_1Context.md#function-setup)**(const [RuntimeOptions](Classes/structllarp_1_1RuntimeOptions.md) & opts) |
| int | **[Run](Classes/structllarp_1_1Context.md#function-run)**(const [RuntimeOptions](Classes/structllarp_1_1RuntimeOptions.md) & opts) |
| void | **[HandleSignal](Classes/structllarp_1_1Context.md#function-handlesignal)**(int sig) |
| void | **[Configure](Classes/structllarp_1_1Context.md#function-configure)**(std::shared_ptr< [Config](Classes/structllarp_1_1Config.md) > conf)<br>Configure given the specified config.  |
| void | **[Reload](Classes/structllarp_1_1Context.md#function-reload)**()<br>handle SIGHUP  |
| bool | **[IsUp](Classes/structllarp_1_1Context.md#function-isup)**() const |
| bool | **[LooksAlive](Classes/structllarp_1_1Context.md#function-looksalive)**() const |
| bool | **[IsStopping](Classes/structllarp_1_1Context.md#function-isstopping)**() const |
| void | **[CloseAsync](Classes/structllarp_1_1Context.md#function-closeasync)**()<br>close async  |
| void | **[Wait](Classes/structllarp_1_1Context.md#function-wait)**()<br>wait until closed and done  |
| bool | **[CallSafe](Classes/structllarp_1_1Context.md#function-callsafe)**(std::function< void(void)> f)<br>call a function in logic thread return true if queued for calling return false if not queued for calling  |
| virtual std::shared_ptr< [NodeDB](Classes/classllarp_1_1NodeDB.md) > | **[makeNodeDB](Classes/structllarp_1_1Context.md#function-makenodedb)**()<br>create the nodedb given our current configs  |
| virtual std::shared_ptr< [llarp::vpn::Platform](Classes/classllarp_1_1vpn_1_1Platform.md) > | **[makeVPNPlatform](Classes/structllarp_1_1Context.md#function-makevpnplatform)**()<br>create the vpn platform for use in creating network interfaces  |

**Public Attributes inherited from [llarp::Context](Classes/structllarp_1_1Context.md)**

|                | Name           |
| -------------- | -------------- |
| std::shared_ptr< [Crypto](Classes/structllarp_1_1Crypto.md) > | **[crypto](Classes/structllarp_1_1Context.md#variable-crypto)**  |
| std::shared_ptr< [CryptoManager](Classes/structllarp_1_1CryptoManager.md) > | **[cryptoManager](Classes/structllarp_1_1Context.md#variable-cryptomanager)**  |
| std::shared_ptr< [AbstractRouter](Classes/structllarp_1_1AbstractRouter.md) > | **[router](Classes/structllarp_1_1Context.md#variable-router)**  |
| std::shared_ptr< [EventLoop](Classes/classllarp_1_1EventLoop.md) > | **[loop](Classes/structllarp_1_1Context.md#variable-loop)**  |
| std::shared_ptr< [NodeDB](Classes/classllarp_1_1NodeDB.md) > | **[nodedb](Classes/structllarp_1_1Context.md#variable-nodedb)**  |
| int | **[androidFD](Classes/structllarp_1_1Context.md#variable-androidfd)**  |

**Protected Attributes inherited from [llarp::Context](Classes/structllarp_1_1Context.md)**

|                | Name           |
| -------------- | -------------- |
| std::shared_ptr< [Config](Classes/structllarp_1_1Config.md) > | **[config](Classes/structllarp_1_1Context.md#variable-config)**  |


## Public Functions Documentation

### function HiveContext

```cpp
HiveContext(
    RouterHive * hive
)
```


### function makeRouter

```cpp
std::shared_ptr< llarp::AbstractRouter > makeRouter(
    const llarp::EventLoop_ptr & loop
) override
```


### function getRouterAsHiveRouter

```cpp
HiveRouter * getRouterAsHiveRouter()
```

Get this context's router as a [HiveRouter](). 

Returns nullptr if there is no router or throws an exception if the router is somehow not an instance of [HiveRouter](Classes/structtooling_1_1HiveRouter.md). 


## Protected Attributes Documentation

### variable m_hive

```cpp
RouterHive * m_hive = nullptr;
```


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

Updated on 2023-04-27 at 04:17:16 +0000