---
title: llarp::layers::platform::PlatformDriver_Base
summary: base type that is responsible for bridging the os and the flow layer. 

---

# llarp::layers::platform::PlatformDriver_Base



base type that is responsible for bridging the os and the flow layer.  [More...](#detailed-description)


`#include <driver_base.hpp>`

## Public Functions

|                | Name           |
| -------------- | -------------- |
| virtual | **[~PlatformDriver_Base](Classes/classllarp_1_1layers_1_1platform_1_1PlatformDriver__Base.md#function-~platformdriver-base)**() =default |
| virtual std::set< [AddressMapping](Classes/structllarp_1_1layers_1_1platform_1_1AddressMapping.md) > | **[get_address_mappings_for](Classes/classllarp_1_1layers_1_1platform_1_1PlatformDriver__Base.md#function-get-address-mappings-for)**([flow::FlowAddr](Classes/classllarp_1_1layers_1_1flow_1_1FlowAddr.md) remote, std::optional< net::flowlabel_t > flow_label =std::nullopt)<br>get all flows to a remote.  |
| virtual std::unique_ptr< [NameResolverJob_Base](Classes/classllarp_1_1layers_1_1platform_1_1NameResolverJob__Base.md) > | **[make_resolver_job_for](Classes/classllarp_1_1layers_1_1platform_1_1PlatformDriver__Base.md#function-make-resolver-job-for)**(UnresolvedName_t name) const<br>given a name we want to look up, make a one shot job that we will use to look it up from the network.  |
| void | **[process_layer](Classes/classllarp_1_1layers_1_1platform_1_1PlatformDriver__Base.md#function-process-layer)**() |

## Protected Functions

|                | Name           |
| -------------- | -------------- |
| void | **[send_data_to_flow_layer](Classes/classllarp_1_1layers_1_1platform_1_1PlatformDriver__Base.md#function-send-data-to-flow-layer)**(EtherType_t kind, [flow::FlowInfo](Classes/structllarp_1_1layers_1_1flow_1_1FlowInfo.md) to, std::vector< byte_t > data)<br>send datum from the os to the flow layer to be tunneled to where ever it is going.  |
| virtual std::vector< [Traffic](Classes/structllarp_1_1layers_1_1platform_1_1Traffic.md) > | **[read_platform_traffic](Classes/classllarp_1_1layers_1_1platform_1_1PlatformDriver__Base.md#function-read-platform-traffic)**() const<br>read packets from the os.  |
| virtual std::vector< [flow::Traffic](Classes/structllarp_1_1layers_1_1flow_1_1Traffic.md) > | **[read_flow_traffic](Classes/classllarp_1_1layers_1_1platform_1_1PlatformDriver__Base.md#function-read-flow-traffic)**() const<br>read any packets from the flow layer.  |
| virtual void | **[wakeup_os](Classes/classllarp_1_1layers_1_1platform_1_1PlatformDriver__Base.md#function-wakeup-os)**() const<br>wake up other os parts of lokinet  |
| virtual void | **[wakeup_flow_layer](Classes/classllarp_1_1layers_1_1platform_1_1PlatformDriver__Base.md#function-wakeup-flow-layer)**() const<br>wake up the flow layer  |
| virtual std::optional< std::tuple< EtherType_t, [flow::FlowInfo](Classes/structllarp_1_1layers_1_1flow_1_1FlowInfo.md), std::vector< byte_t > > > | **[process_os_traffic](Classes/classllarp_1_1layers_1_1platform_1_1PlatformDriver__Base.md#function-process-os-traffic)**([Traffic](Classes/structllarp_1_1layers_1_1platform_1_1Traffic.md) && )<br>take in os traffic and return what we pass to the flow layer or nullopt if we dont send it to the flow layer.  |

## Protected Attributes

|                | Name           |
| -------------- | -------------- |
| std::unordered_multimap< [flow::FlowAddr](Classes/classllarp_1_1layers_1_1flow_1_1FlowAddr.md), [flow::FlowIdentity](Classes/classllarp_1_1layers_1_1flow_1_1FlowIdentity.md) > | **[m_active_flows](Classes/classllarp_1_1layers_1_1platform_1_1PlatformDriver__Base.md#variable-m-active-flows)** <br>this maps remote flow to local identity used for the remote.  |

## Detailed Description

```cpp
class llarp::layers::platform::PlatformDriver_Base;
```

base type that is responsible for bridging the os and the flow layer. 

all functionality that the rest of the codebase that is not below this layer interacts via this type. 

## Public Functions Documentation

### function ~PlatformDriver_Base

```cpp
virtual ~PlatformDriver_Base() =default
```


### function get_address_mappings_for

```cpp
virtual std::set< AddressMapping > get_address_mappings_for(
    flow::FlowAddr remote,
    std::optional< net::flowlabel_t > flow_label =std::nullopt
)
```

get all flows to a remote. 

if flow_label is provided we will only fetch mappings for that flow label. sorted in order "best" to "worst". 


### function make_resolver_job_for

```cpp
virtual std::unique_ptr< NameResolverJob_Base > make_resolver_job_for(
    UnresolvedName_t name
) const
```

given a name we want to look up, make a one shot job that we will use to look it up from the network. 

### function process_layer

```cpp
inline void process_layer()
```


## Protected Functions Documentation

### function send_data_to_flow_layer

```cpp
void send_data_to_flow_layer(
    EtherType_t kind,
    flow::FlowInfo to,
    std::vector< byte_t > data
)
```

send datum from the os to the flow layer to be tunneled to where ever it is going. 

### function read_platform_traffic

```cpp
virtual std::vector< Traffic > read_platform_traffic() const
```

read packets from the os. 

this MUST NOT have any internal userland buffering from previous calls to read_platform(). 


### function read_flow_traffic

```cpp
virtual std::vector< flow::Traffic > read_flow_traffic() const
```

read any packets from the flow layer. 

does a full read and drains everything from flow layer. 


### function wakeup_os

```cpp
virtual void wakeup_os() const
```

wake up other os parts of lokinet 

### function wakeup_flow_layer

```cpp
virtual void wakeup_flow_layer() const
```

wake up the flow layer 

### function process_os_traffic

```cpp
virtual std::optional< std::tuple< EtherType_t, flow::FlowInfo, std::vector< byte_t > > > process_os_traffic(
    Traffic && 
)
```

take in os traffic and return what we pass to the flow layer or nullopt if we dont send it to the flow layer. 

applies side effects like mapping addresses. 


## Protected Attributes Documentation

### variable m_active_flows

```cpp
std::unordered_multimap< flow::FlowAddr, flow::FlowIdentity > m_active_flows;
```

this maps remote flow to local identity used for the remote. 

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

Updated on 2023-01-23 at 14:22:33 +0000