Module domain::bits::compose
[−]
[src]
Assembling wire-format DNS data.
This module provides helper types for assembling the wire format of a DNS message, a process termed composing to distinguish it from other procedures that turn DNS data into some output such as formatting into human-readable data.
There are two main types here. Composer
owns a bytes vector and
provides a number of methods allowing to append data to it meanwhile
making sure that certain conditions such as the maximum message size are
being fulfilled. These conditions are defined through the ComposeMode
.
The Composer
has a companion type ComposeSnapshot
that wraps the
original composer but allows it to roll back to an earlier state. The
intention here is to reuse a partly assembled message a second attempt
with slightly different data.
As a convenience, there is a trait Composable
that can be implemented
for types that know how to add themselves to a message-to-be.
Todo
Snapshots currently clone the compression map. As this is costly, we should have a way to either only clone on write or allow turn off compressing before cloning. This isn’t all that important, though, since we can create requests (which contain exactly one domain name in their only question) with compression turned off entirely.
Structs
ComposeSnapshot |
A snapshot of a composer’s state. |
Composer |
A type for assembling a wire-format DNS message. |
Enums
ComposeError |
An error happening when composing wire-format DNS data. |
ComposeMode |
An enum determining the construction mode of a composition. |
Traits
Composable |
A trait allowing types to compose themselves. |
Type Definitions
ComposeResult |
The result type for a |