---
title: llarp::service::Context
summary: holds all the hidden service endpoints we own this should be refactored (removed entirely...?) now that lokinet only supports one endpoint per instance 

---

# llarp::service::Context



holds all the hidden service endpoints we own this should be refactored (removed entirely...?) now that lokinet only supports one endpoint per instance 


`#include <context.hpp>`

## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[Context](Classes/structllarp_1_1service_1_1Context.md#function-context)**([AbstractRouter](Classes/structllarp_1_1AbstractRouter.md) * r) |
| | **[~Context](Classes/structllarp_1_1service_1_1Context.md#function-~context)**() |
| void | **[Tick](Classes/structllarp_1_1service_1_1Context.md#function-tick)**(llarp_time_t now) |
| bool | **[StopAll](Classes/structllarp_1_1service_1_1Context.md#function-stopall)**()<br>stop all held services  |
| util::StatusObject | **[ExtractStatus](Classes/structllarp_1_1service_1_1Context.md#function-extractstatus)**() const |
| bool | **[hasEndpoints](Classes/structllarp_1_1service_1_1Context.md#function-hasendpoints)**() |
| void | **[ForEachService](Classes/structllarp_1_1service_1_1Context.md#function-foreachservice)**(std::function< bool(const std::string &, const Endpoint_ptr &)> visit) const<br>function visitor returns false to prematurely break iteration  |
| void | **[Pump](Classes/structllarp_1_1service_1_1Context.md#function-pump)**()<br>Pumps the hidden service endpoints, called during Router::PumpLL.  |
| void | **[AddEndpoint](Classes/structllarp_1_1service_1_1Context.md#function-addendpoint)**(const [Config](Classes/structllarp_1_1Config.md) & conf, bool autostart =false)<br>add endpoint via config  |
| void | **[InjectEndpoint](Classes/structllarp_1_1service_1_1Context.md#function-injectendpoint)**(std::string name, std::shared_ptr< [Endpoint](Classes/structllarp_1_1service_1_1Endpoint.md) > ep)<br>inject endpoint instance  |
| bool | **[RemoveEndpoint](Classes/structllarp_1_1service_1_1Context.md#function-removeendpoint)**(const std::string & name)<br>stop and remove an endpoint by name return false if we don't have the hidden service with that name  |
| Endpoint_ptr | **[GetEndpointByName](Classes/structllarp_1_1service_1_1Context.md#function-getendpointbyname)**(const std::string & name) const |
| Endpoint_ptr | **[GetDefault](Classes/structllarp_1_1service_1_1Context.md#function-getdefault)**() const |
| bool | **[StartAll](Classes/structllarp_1_1service_1_1Context.md#function-startall)**() |

## Public Functions Documentation

### function Context

```cpp
explicit Context(
    AbstractRouter * r
)
```


### function ~Context

```cpp
~Context()
```


### function Tick

```cpp
void Tick(
    llarp_time_t now
)
```


### function StopAll

```cpp
bool StopAll()
```

stop all held services 

### function ExtractStatus

```cpp
util::StatusObject ExtractStatus() const
```


### function hasEndpoints

```cpp
bool hasEndpoints()
```


### function ForEachService

```cpp
void ForEachService(
    std::function< bool(const std::string &, const Endpoint_ptr &)> visit
) const
```

function visitor returns false to prematurely break iteration 

### function Pump

```cpp
void Pump()
```

Pumps the hidden service endpoints, called during Router::PumpLL. 

### function AddEndpoint

```cpp
void AddEndpoint(
    const Config & conf,
    bool autostart =false
)
```

add endpoint via config 

### function InjectEndpoint

```cpp
void InjectEndpoint(
    std::string name,
    std::shared_ptr< Endpoint > ep
)
```

inject endpoint instance 

### function RemoveEndpoint

```cpp
bool RemoveEndpoint(
    const std::string & name
)
```

stop and remove an endpoint by name return false if we don't have the hidden service with that name 

### function GetEndpointByName

```cpp
Endpoint_ptr GetEndpointByName(
    const std::string & name
) const
```


### function GetDefault

```cpp
inline Endpoint_ptr GetDefault() const
```


### function StartAll

```cpp
bool StartAll()
```


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

Updated on 2025-03-02 at 05:10:06 +0000