---
title: tooling::RouterHive

---

# tooling::RouterHive





## Public Types

|                | Name           |
| -------------- | -------------- |
| using std::shared_ptr< [HiveContext](Classes/structtooling_1_1HiveContext.md) > | **[Context_ptr](Classes/structtooling_1_1RouterHive.md#using-context-ptr)**  |

## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[RouterHive](Classes/structtooling_1_1RouterHive.md#function-routerhive)**() =default |
| void | **[AddRelay](Classes/structtooling_1_1RouterHive.md#function-addrelay)**(const std::shared_ptr< [llarp::Config](Classes/structllarp_1_1Config.md) > & conf) |
| void | **[AddClient](Classes/structtooling_1_1RouterHive.md#function-addclient)**(const std::shared_ptr< [llarp::Config](Classes/structllarp_1_1Config.md) > & conf) |
| void | **[StartRelays](Classes/structtooling_1_1RouterHive.md#function-startrelays)**() |
| void | **[StartClients](Classes/structtooling_1_1RouterHive.md#function-startclients)**() |
| void | **[StopRouters](Classes/structtooling_1_1RouterHive.md#function-stoprouters)**() |
| void | **[NotifyEvent](Classes/structtooling_1_1RouterHive.md#function-notifyevent)**(RouterEventPtr event) |
| RouterEventPtr | **[GetNextEvent](Classes/structtooling_1_1RouterHive.md#function-getnextevent)**() |
| std::deque< RouterEventPtr > | **[GetAllEvents](Classes/structtooling_1_1RouterHive.md#function-getallevents)**() |
| void | **[ForEachRelay](Classes/structtooling_1_1RouterHive.md#function-foreachrelay)**(std::function< void(Context_ptr)> visit) |
| void | **[ForEachClient](Classes/structtooling_1_1RouterHive.md#function-foreachclient)**(std::function< void(Context_ptr)> visit) |
| void | **[ForEachRouter](Classes/structtooling_1_1RouterHive.md#function-foreachrouter)**(std::function< void(Context_ptr)> visit) |
| [HiveRouter](Classes/structtooling_1_1HiveRouter.md) * | **[GetRelay](Classes/structtooling_1_1RouterHive.md#function-getrelay)**(const [llarp::RouterID](Classes/structllarp_1_1RouterID.md) & id, bool needMutexLock =true) |
| std::vector< size_t > | **[RelayConnectedRelays](Classes/structtooling_1_1RouterHive.md#function-relayconnectedrelays)**() |
| std::vector< [llarp::RouterContact](Classes/structllarp_1_1RouterContact.md) > | **[GetRelayRCs](Classes/structtooling_1_1RouterHive.md#function-getrelayrcs)**() |

## Public Attributes

|                | Name           |
| -------------- | -------------- |
| std::mutex | **[routerMutex](Classes/structtooling_1_1RouterHive.md#variable-routermutex)**  |
| std::unordered_map< [llarp::RouterID](Classes/structllarp_1_1RouterID.md), Context_ptr > | **[relays](Classes/structtooling_1_1RouterHive.md#variable-relays)**  |
| std::unordered_map< [llarp::RouterID](Classes/structllarp_1_1RouterID.md), Context_ptr > | **[clients](Classes/structtooling_1_1RouterHive.md#variable-clients)**  |
| std::vector< std::thread > | **[routerMainThreads](Classes/structtooling_1_1RouterHive.md#variable-routermainthreads)**  |
| std::mutex | **[eventQueueMutex](Classes/structtooling_1_1RouterHive.md#variable-eventqueuemutex)**  |
| std::deque< RouterEventPtr > | **[eventQueue](Classes/structtooling_1_1RouterHive.md#variable-eventqueue)**  |

## Public Types Documentation

### using Context_ptr

```cpp
using tooling::RouterHive::Context_ptr =  std::shared_ptr<HiveContext>;
```


## Public Functions Documentation

### function RouterHive

```cpp
RouterHive() =default
```


### function AddRelay

```cpp
void AddRelay(
    const std::shared_ptr< llarp::Config > & conf
)
```


### function AddClient

```cpp
void AddClient(
    const std::shared_ptr< llarp::Config > & conf
)
```


### function StartRelays

```cpp
void StartRelays()
```


### function StartClients

```cpp
void StartClients()
```


### function StopRouters

```cpp
void StopRouters()
```


### function NotifyEvent

```cpp
void NotifyEvent(
    RouterEventPtr event
)
```


### function GetNextEvent

```cpp
RouterEventPtr GetNextEvent()
```


### function GetAllEvents

```cpp
std::deque< RouterEventPtr > GetAllEvents()
```


### function ForEachRelay

```cpp
void ForEachRelay(
    std::function< void(Context_ptr)> visit
)
```


### function ForEachClient

```cpp
void ForEachClient(
    std::function< void(Context_ptr)> visit
)
```


### function ForEachRouter

```cpp
void ForEachRouter(
    std::function< void(Context_ptr)> visit
)
```


### function GetRelay

```cpp
HiveRouter * GetRelay(
    const llarp::RouterID & id,
    bool needMutexLock =true
)
```


### function RelayConnectedRelays

```cpp
std::vector< size_t > RelayConnectedRelays()
```


### function GetRelayRCs

```cpp
std::vector< llarp::RouterContact > GetRelayRCs()
```


## Public Attributes Documentation

### variable routerMutex

```cpp
std::mutex routerMutex;
```


### variable relays

```cpp
std::unordered_map< llarp::RouterID, Context_ptr > relays;
```


### variable clients

```cpp
std::unordered_map< llarp::RouterID, Context_ptr > clients;
```


### variable routerMainThreads

```cpp
std::vector< std::thread > routerMainThreads;
```


### variable eventQueueMutex

```cpp
std::mutex eventQueueMutex;
```


### variable eventQueue

```cpp
std::deque< RouterEventPtr > eventQueue;
```


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

Updated on 2023-01-26 at 19:35:17 +0000