---
title: llarp::dns::MessageHeader

---

# llarp::dns::MessageHeader





## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[MessageHeader](Classes/structllarp_1_1dns_1_1MessageHeader.md#function-messageheader)**() =default |
| | **[MessageHeader](Classes/structllarp_1_1dns_1_1MessageHeader.md#function-messageheader)**(const [MessageHeader](Classes/structllarp_1_1dns_1_1MessageHeader.md) & ) =default |
| | **[MessageHeader](Classes/structllarp_1_1dns_1_1MessageHeader.md#function-messageheader)**([MessageHeader](Classes/structllarp_1_1dns_1_1MessageHeader.md) && ) =default |
| [MessageHeader](Classes/structllarp_1_1dns_1_1MessageHeader.md) & | **[operator=](Classes/structllarp_1_1dns_1_1MessageHeader.md#function-operator=)**(const [MessageHeader](Classes/structllarp_1_1dns_1_1MessageHeader.md) & ) =default |
| [MessageHeader](Classes/structllarp_1_1dns_1_1MessageHeader.md) & | **[operator=](Classes/structllarp_1_1dns_1_1MessageHeader.md#function-operator=)**([MessageHeader](Classes/structllarp_1_1dns_1_1MessageHeader.md) && ) =default |
| | **[MessageHeader](Classes/structllarp_1_1dns_1_1MessageHeader.md#function-messageheader)**([byte_view_t](Namespaces/namespacellarp.md#typedef-byte-view-t) & raw)<br>construct from binary view.  |
| [bstring_t](Namespaces/namespacellarp.md#using-bstring-t) | **[encode_dns](Classes/structllarp_1_1dns_1_1MessageHeader.md#function-encode-dns)**() const |
| util::StatusObject | **[to_json](Classes/structllarp_1_1dns_1_1MessageHeader.md#function-to-json)**() const |
| [MessageHeader](Classes/structllarp_1_1dns_1_1MessageHeader.md) & | **[rcode](Classes/structllarp_1_1dns_1_1MessageHeader.md#function-rcode)**(uint16_t i)<br>set rcode.  |
| std::string | **[ToString](Classes/structllarp_1_1dns_1_1MessageHeader.md#function-tostring)**() const |
| bool | **[operator==](Classes/structllarp_1_1dns_1_1MessageHeader.md#function-operator==)**(const [MessageHeader](Classes/structllarp_1_1dns_1_1MessageHeader.md) & other) const |

## Public Attributes

|                | Name           |
| -------------- | -------------- |
| constexpr size_t | **[Size](Classes/structllarp_1_1dns_1_1MessageHeader.md#variable-size)**  |
| uint16_t | **[id](Classes/structllarp_1_1dns_1_1MessageHeader.md#variable-id)**  |
| uint16_t | **[fields](Classes/structllarp_1_1dns_1_1MessageHeader.md#variable-fields)**  |
| uint16_t | **[qd_count](Classes/structllarp_1_1dns_1_1MessageHeader.md#variable-qd-count)**  |
| uint16_t | **[an_count](Classes/structllarp_1_1dns_1_1MessageHeader.md#variable-an-count)**  |
| uint16_t | **[ns_count](Classes/structllarp_1_1dns_1_1MessageHeader.md#variable-ns-count)**  |
| uint16_t | **[ar_count](Classes/structllarp_1_1dns_1_1MessageHeader.md#variable-ar-count)**  |

## Public Functions Documentation

### function MessageHeader

```cpp
MessageHeader() =default
```


### function MessageHeader

```cpp
MessageHeader(
    const MessageHeader & 
) =default
```


### function MessageHeader

```cpp
MessageHeader(
    MessageHeader && 
) =default
```


### function operator=

```cpp
MessageHeader & operator=(
    const MessageHeader & 
) =default
```


### function operator=

```cpp
MessageHeader & operator=(
    MessageHeader && 
) =default
```


### function MessageHeader

```cpp
explicit MessageHeader(
    byte_view_t & raw
)
```

construct from binary view. 

raw is modified to contain any remaining data. 


### function encode_dns

```cpp
bstring_t encode_dns() const
```


### function to_json

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


### function rcode

```cpp
MessageHeader & rcode(
    uint16_t i
)
```

set rcode. 

### function ToString

```cpp
std::string ToString() const
```


### function operator==

```cpp
inline bool operator==(
    const MessageHeader & other
) const
```


## Public Attributes Documentation

### variable Size

```cpp
static constexpr size_t Size = 12;
```


### variable id

```cpp
uint16_t id;
```


### variable fields

```cpp
uint16_t fields;
```


### variable qd_count

```cpp
uint16_t qd_count;
```


### variable an_count

```cpp
uint16_t an_count;
```


### variable ns_count

```cpp
uint16_t ns_count;
```


### variable ar_count

```cpp
uint16_t ar_count;
```


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

Updated on 2023-04-27 at 04:17:17 +0000