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

---

# llarp::dns::Question





## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[Question](Classes/structllarp_1_1dns_1_1Question.md#function-question)**() =default |
| | **[Question](Classes/structllarp_1_1dns_1_1Question.md#function-question)**(const [Question](Classes/structllarp_1_1dns_1_1Question.md) & ) =default |
| | **[Question](Classes/structllarp_1_1dns_1_1Question.md#function-question)**([Question](Classes/structllarp_1_1dns_1_1Question.md) && ) =default |
| [Question](Classes/structllarp_1_1dns_1_1Question.md) & | **[operator=](Classes/structllarp_1_1dns_1_1Question.md#function-operator=)**(const [Question](Classes/structllarp_1_1dns_1_1Question.md) & ) =default |
| [Question](Classes/structllarp_1_1dns_1_1Question.md) & | **[operator=](Classes/structllarp_1_1dns_1_1Question.md#function-operator=)**([Question](Classes/structllarp_1_1dns_1_1Question.md) && ) =default |
| | **[Question](Classes/structllarp_1_1dns_1_1Question.md#function-question)**([byte_view_t](Namespaces/namespacellarp.md#typedef-byte-view-t) & raw) |
| | **[Question](Classes/structllarp_1_1dns_1_1Question.md#function-question)**(std::string name, RRType type) |
| | **[Question](Classes/structllarp_1_1dns_1_1Question.md#function-question)**(std::vector< std::string_view > labels, RRType type) |
| [bstring_t](Namespaces/namespacellarp.md#using-bstring-t) | **[encode_dns](Classes/structllarp_1_1dns_1_1Question.md#function-encode-dns)**() const<br>encode to dns wire proto.  |
| std::string | **[ToString](Classes/structllarp_1_1dns_1_1Question.md#function-tostring)**() const |
| std::string | **[qname](Classes/structllarp_1_1dns_1_1Question.md#function-qname)**() const<br>construct the full domain name including trailing dot.  |
| 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 | **[Domain](Classes/structllarp_1_1dns_1_1Question.md#function-domain)**() const<br>get the dns label before the gtld, including the gtld and no trailing full stop.  |
| std::string_view | **[tld](Classes/structllarp_1_1dns_1_1Question.md#function-tld)**() const<br>get the tld for the question's qname.  |
| bool | **[HasTLD](Classes/structllarp_1_1dns_1_1Question.md#function-hastld)**(std::string_view _tld) const |
| util::StatusObject | **[to_json](Classes/structllarp_1_1dns_1_1Question.md#function-to-json)**() const |
| bool | **[valid](Classes/structllarp_1_1dns_1_1Question.md#function-valid)**() const<br>return true of this question has sane data.  |
| std::vector< std::string_view > | **[view_dns_labels](Classes/structllarp_1_1dns_1_1Question.md#function-view-dns-labels)**() const<br>get a view over all the dns labels for this question.  |

## Public Attributes

|                | Name           |
| -------------- | -------------- |
| uint16_t | **[qtype](Classes/structllarp_1_1dns_1_1Question.md#variable-qtype)**  |
| uint16_t | **[qclass](Classes/structllarp_1_1dns_1_1Question.md#variable-qclass)**  |

## Public Functions Documentation

### function Question

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


### function Question

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


### function Question

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


### function operator=

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


### function operator=

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


### function Question

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


### function Question

```cpp
inline Question(
    std::string name,
    RRType type
)
```


### function Question

```cpp
Question(
    std::vector< std::string_view > labels,
    RRType type
)
```


### function encode_dns

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

encode to dns wire proto. 

### function ToString

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


### function qname

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

construct the full domain name including trailing dot. 

### 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 Domain

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

get the dns label before the gtld, including the gtld and no trailing full stop. 

### function tld

```cpp
std::string_view tld() const
```

get the tld for the question's qname. 

### function HasTLD

```cpp
inline bool HasTLD(
    std::string_view _tld
) const
```


### function to_json

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


### function valid

```cpp
bool valid() const
```

return true of this question has sane data. 

### function view_dns_labels

```cpp
std::vector< std::string_view > view_dns_labels() const
```

get a view over all the dns labels for this question. 

## Public Attributes Documentation

### variable qtype

```cpp
uint16_t qtype;
```


### variable qclass

```cpp
uint16_t qclass;
```


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

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