Rust

domain

Module

Domain names in DNS wire format (RFC 1035 §3.1, §4.1.4).

Contents

use utopia_dns::message::domain::decode;
Rust
pub fn decode(data: &[u8], offset: usize) -> Result<(Vec<u8>, usize), Error>

Decodes the name at offset in a whole packet, following compression pointers (which must point backwards, and never to the same place twice). Returns the dotted name and the offset after it in the packet.

use utopia_dns::message::domain::encode;
Rust
pub fn encode(name: &[u8]) -> Result<Vec<u8>, Error>

Encodes a name as length-prefixed labels ending with the root. An empty name, . or a name ending in one . is absolute; @ and empty labels are refused.

use utopia_dns::message::domain::encode_into;
Rust
pub fn encode_into(name: &[u8], out: &mut Vec<u8>) -> Result<(), Error>

encode appended to out.

Rust
pub const MAX_DOMAIN_NAME_LEN: usize = 255

The longest encoded name, length octets and the root included.

Rust
pub const MAX_LABEL_LEN: usize = 63

The longest label.

Rust
pub const MAX_LABELS: usize = 127

The most labels a name has.