---
title: llarp::dns::Question

---

# llarp::dns::Question





Inherits from [llarp::dns::Serialize](Classes/structllarp_1_1dns_1_1Serialize.md)

## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[Question](Classes/structllarp_1_1dns_1_1Question.md#function-question)**() =default |
| | **[Question](Classes/structllarp_1_1dns_1_1Question.md#function-question)**(std::string name, QType_t type) |
| | **[Question](Classes/structllarp_1_1dns_1_1Question.md#function-question)**([Question](Classes/structllarp_1_1dns_1_1Question.md) && other) |
| | **[Question](Classes/structllarp_1_1dns_1_1Question.md#function-question)**(const [Question](Classes/structllarp_1_1dns_1_1Question.md) & other) |
| virtual bool | **[Encode](Classes/structllarp_1_1dns_1_1Question.md#function-encode)**([llarp_buffer_t](Classes/structllarp__buffer__t.md) * buf) const override<br>encode entity to buffer  |
| virtual bool | **[Decode](Classes/structllarp_1_1dns_1_1Question.md#function-decode)**([llarp_buffer_t](Classes/structllarp__buffer__t.md) * buf) override<br>decode entity from buffer  |
| std::string | **[ToString](Classes/structllarp_1_1dns_1_1Question.md#function-tostring)**() const |
| bool | **[operator==](Classes/structllarp_1_1dns_1_1Question.md#function-operator==)**(const [Question](Classes/structllarp_1_1dns_1_1Question.md) & other) const |
| bool | **[IsName](Classes/structllarp_1_1dns_1_1Question.md#function-isname)**(const std::string & other) const<br>determine if we match a name  |
| bool | **[IsLocalhost](Classes/structllarp_1_1dns_1_1Question.md#function-islocalhost)**() const<br>is the name [something.]localhost.loki. ?  |
| bool | **[HasSubdomains](Classes/structllarp_1_1dns_1_1Question.md#function-hassubdomains)**() const<br>return true if we have subdomains in ths question  |
| std::string | **[Subdomains](Classes/structllarp_1_1dns_1_1Question.md#function-subdomains)**() const<br>get subdomain(s), if any, from qname  |
| std::string | **[Name](Classes/structllarp_1_1dns_1_1Question.md#function-name)**() const<br>return qname with no trailing .  |
| bool | **[HasTLD](Classes/structllarp_1_1dns_1_1Question.md#function-hastld)**(const std::string & tld) const<br>determine if we are using this TLD  |
| virtual util::StatusObject | **[ToJSON](Classes/structllarp_1_1dns_1_1Question.md#function-tojson)**() const override<br>convert this whatever into json  |

## Public Attributes

|                | Name           |
| -------------- | -------------- |
| std::string | **[qname](Classes/structllarp_1_1dns_1_1Question.md#variable-qname)**  |
| QType_t | **[qtype](Classes/structllarp_1_1dns_1_1Question.md#variable-qtype)**  |
| QClass_t | **[qclass](Classes/structllarp_1_1dns_1_1Question.md#variable-qclass)**  |

## Additional inherited members

**Public Functions inherited from [llarp::dns::Serialize](Classes/structllarp_1_1dns_1_1Serialize.md)**

|                | Name           |
| -------------- | -------------- |
| virtual | **[~Serialize](Classes/structllarp_1_1dns_1_1Serialize.md#function-~serialize)**() =0 |


## Public Functions Documentation

### function Question

```cpp
Question() =default
```


### function Question

```cpp
explicit Question(
    std::string name,
    QType_t type
)
```


### function Question

```cpp
Question(
    Question && other
)
```


### function Question

```cpp
Question(
    const Question & other
)
```


### function Encode

```cpp
virtual bool Encode(
    llarp_buffer_t * buf
) const override
```

encode entity to buffer 

**Reimplements**: [llarp::dns::Serialize::Encode](Classes/structllarp_1_1dns_1_1Serialize.md#function-encode)


### function Decode

```cpp
virtual bool Decode(
    llarp_buffer_t * buf
) override
```

decode entity from buffer 

**Reimplements**: [llarp::dns::Serialize::Decode](Classes/structllarp_1_1dns_1_1Serialize.md#function-decode)


### function ToString

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


### function operator==

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


### function IsName

```cpp
bool IsName(
    const std::string & other
) const
```

determine if we match a name 

### function IsLocalhost

```cpp
bool IsLocalhost() const
```

is the name [something.]localhost.loki. ? 

### function HasSubdomains

```cpp
bool HasSubdomains() const
```

return true if we have subdomains in ths question 

### function Subdomains

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

get subdomain(s), if any, from qname 

### function Name

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

return qname with no trailing . 

### function HasTLD

```cpp
bool HasTLD(
    const std::string & tld
) const
```

determine if we are using this TLD 

### function ToJSON

```cpp
virtual util::StatusObject ToJSON() const override
```

convert this whatever into json 

**Reimplements**: [llarp::dns::Serialize::ToJSON](Classes/structllarp_1_1dns_1_1Serialize.md#function-tojson)


## Public Attributes Documentation

### variable qname

```cpp
std::string qname;
```


### variable qtype

```cpp
QType_t qtype;
```


### variable qclass

```cpp
QClass_t qclass;
```


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

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