---
title: llarp::dht::IMessage

---

# llarp::dht::IMessage





Inherited by [llarp::dht::FindIntroMessage](Classes/structllarp_1_1dht_1_1FindIntroMessage.md), [llarp::dht::FindNameMessage](Classes/structllarp_1_1dht_1_1FindNameMessage.md), [llarp::dht::FindRouterMessage](Classes/structllarp_1_1dht_1_1FindRouterMessage.md), [llarp::dht::GotIntroMessage](Classes/structllarp_1_1dht_1_1GotIntroMessage.md), [llarp::dht::GotNameMessage](Classes/structllarp_1_1dht_1_1GotNameMessage.md), [llarp::dht::GotRouterMessage](Classes/structllarp_1_1dht_1_1GotRouterMessage.md), [llarp::dht::PublishIntroMessage](Classes/structllarp_1_1dht_1_1PublishIntroMessage.md)

## Public Types

|                | Name           |
| -------------- | -------------- |
| using std::unique_ptr< [IMessage](Classes/structllarp_1_1dht_1_1IMessage.md) > | **[Ptr_t](Classes/structllarp_1_1dht_1_1IMessage.md#using-ptr-t)**  |

## Public Functions

|                | Name           |
| -------------- | -------------- |
| virtual | **[~IMessage](Classes/structllarp_1_1dht_1_1IMessage.md#function-~imessage)**() =default |
| | **[IMessage](Classes/structllarp_1_1dht_1_1IMessage.md#function-imessage)**(const [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) & from)<br>construct  |
| virtual bool | **[HandleMessage](Classes/structllarp_1_1dht_1_1IMessage.md#function-handlemessage)**(struct [llarp_dht_context](Classes/structllarp__dht__context.md) * dht, std::vector< Ptr_t > & replies) const =0 |
| virtual bool | **[BEncode](Classes/structllarp_1_1dht_1_1IMessage.md#function-bencode)**([llarp_buffer_t](Classes/structllarp__buffer__t.md) * buf) const =0 |
| virtual bool | **[DecodeKey](Classes/structllarp_1_1dht_1_1IMessage.md#function-decodekey)**(const [llarp_buffer_t](Classes/structllarp__buffer__t.md) & key, [llarp_buffer_t](Classes/structllarp__buffer__t.md) * val) =0 |

## Public Attributes

|                | Name           |
| -------------- | -------------- |
| [Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) | **[From](Classes/structllarp_1_1dht_1_1IMessage.md#variable-from)**  |
| [PathID_t](Classes/structllarp_1_1PathID__t.md) | **[pathID](Classes/structllarp_1_1dht_1_1IMessage.md#variable-pathid)**  |
| uint64_t | **[version](Classes/structllarp_1_1dht_1_1IMessage.md#variable-version)**  |

## Public Types Documentation

### using Ptr_t

```cpp
using llarp::dht::IMessage::Ptr_t =  std::unique_ptr<IMessage>;
```


## Public Functions Documentation

### function ~IMessage

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


### function IMessage

```cpp
inline IMessage(
    const Key_t & from
)
```

construct 

### function HandleMessage

```cpp
virtual bool HandleMessage(
    struct llarp_dht_context * dht,
    std::vector< Ptr_t > & replies
) const =0
```


**Reimplemented by**: [llarp::dht::FindIntroMessage::HandleMessage](Classes/structllarp_1_1dht_1_1FindIntroMessage.md#function-handlemessage), [llarp::dht::RelayedFindRouterMessage::HandleMessage](Classes/structllarp_1_1dht_1_1RelayedFindRouterMessage.md#function-handlemessage), [llarp::dht::GotIntroMessage::HandleMessage](Classes/structllarp_1_1dht_1_1GotIntroMessage.md#function-handlemessage), [llarp::dht::RelayedGotIntroMessage::HandleMessage](Classes/structllarp_1_1dht_1_1RelayedGotIntroMessage.md#function-handlemessage), [llarp::dht::FindNameMessage::HandleMessage](Classes/structllarp_1_1dht_1_1FindNameMessage.md#function-handlemessage), [llarp::dht::GotNameMessage::HandleMessage](Classes/structllarp_1_1dht_1_1GotNameMessage.md#function-handlemessage)


### function BEncode

```cpp
virtual bool BEncode(
    llarp_buffer_t * buf
) const =0
```


**Reimplemented by**: [llarp::dht::FindIntroMessage::BEncode](Classes/structllarp_1_1dht_1_1FindIntroMessage.md#function-bencode), [llarp::dht::FindNameMessage::BEncode](Classes/structllarp_1_1dht_1_1FindNameMessage.md#function-bencode), [llarp::dht::FindRouterMessage::BEncode](Classes/structllarp_1_1dht_1_1FindRouterMessage.md#function-bencode), [llarp::dht::GotIntroMessage::BEncode](Classes/structllarp_1_1dht_1_1GotIntroMessage.md#function-bencode), [llarp::dht::GotNameMessage::BEncode](Classes/structllarp_1_1dht_1_1GotNameMessage.md#function-bencode), [llarp::dht::GotRouterMessage::BEncode](Classes/structllarp_1_1dht_1_1GotRouterMessage.md#function-bencode), [llarp::dht::PublishIntroMessage::BEncode](Classes/structllarp_1_1dht_1_1PublishIntroMessage.md#function-bencode)


### function DecodeKey

```cpp
virtual bool DecodeKey(
    const llarp_buffer_t & key,
    llarp_buffer_t * val
) =0
```


**Reimplemented by**: [llarp::dht::FindIntroMessage::DecodeKey](Classes/structllarp_1_1dht_1_1FindIntroMessage.md#function-decodekey), [llarp::dht::FindNameMessage::DecodeKey](Classes/structllarp_1_1dht_1_1FindNameMessage.md#function-decodekey), [llarp::dht::FindRouterMessage::DecodeKey](Classes/structllarp_1_1dht_1_1FindRouterMessage.md#function-decodekey), [llarp::dht::GotIntroMessage::DecodeKey](Classes/structllarp_1_1dht_1_1GotIntroMessage.md#function-decodekey), [llarp::dht::GotNameMessage::DecodeKey](Classes/structllarp_1_1dht_1_1GotNameMessage.md#function-decodekey), [llarp::dht::GotRouterMessage::DecodeKey](Classes/structllarp_1_1dht_1_1GotRouterMessage.md#function-decodekey), [llarp::dht::PublishIntroMessage::DecodeKey](Classes/structllarp_1_1dht_1_1PublishIntroMessage.md#function-decodekey)


## Public Attributes Documentation

### variable From

```cpp
Key_t From;
```


### variable pathID

```cpp
PathID_t pathID;
```


### variable version

```cpp
uint64_t version = llarp::constants::proto_version;
```


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

Updated on 2023-01-09 at 18:23:48 +0000