---
title: llarp/dns/serialize.hpp

---

# llarp/dns/serialize.hpp



## Namespaces

| Name           |
| -------------- |
| **[llarp](Namespaces/namespacellarp.md)** <br>[crypto.hpp] |
| **[llarp::dns](Namespaces/namespacellarp_1_1dns.md)**  |

## Classes

|                | Name           |
| -------------- | -------------- |
| struct | **[llarp::dns::Serialize](Classes/structllarp_1_1dns_1_1Serialize.md)** <br>base type for serializable dns entities  |




## Source code

```cpp
#pragma once

#include <llarp/util/buffer.hpp>
#include <llarp/util/status.hpp>
#include <vector>

namespace llarp
{
  namespace dns
  {
    struct Serialize
    {
      virtual ~Serialize() = 0;

      virtual bool
      Encode(llarp_buffer_t* buf) const = 0;

      virtual bool
      Decode(llarp_buffer_t* buf) = 0;

      virtual util::StatusObject
      ToJSON() const = 0;
    };

    bool
    EncodeRData(llarp_buffer_t* buf, const std::vector<byte_t>& rdata);

    bool
    DecodeRData(llarp_buffer_t* buf, std::vector<byte_t>& rdata);

  }  // namespace dns
}  // namespace llarp
```


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

Updated on 2022-11-04 at 14:36:39 +0000
