---
title: SAIF.Framework.DNS overview
summary: High-level purpose, scope, and responsibilities for this library.
status: draft
owner: <owner>
last_reviewed: 2026-07-23
library: SAIF.Framework.DNS
reference_type: package
---

# SAIF.Framework.DNS overview

> **Documentation context:** Packaged Component (NuGet)

SAIF.Framework.DNS is a small, self-contained DNS client library that builds, sends, and parses DNS query/response messages over raw UDP sockets in accordance with RFC1035. It provides a static `Resolver` facade for issuing generic DNS lookups and a convenience MX-record lookup, with no dependencies on other SAIF framework components.

## Purpose
- Provide a lightweight, dependency-free way for callers to perform DNS lookups (generic and MX-specific) directly over UDP, without relying on OS-level DNS resolution APIs.
- Encapsulate RFC1035 wire-format encoding and decoding (headers, questions, resource records, domain-name compression) behind a small object model (`Request`, `Question`, `Response`, `ResourceRecord` and its typed RDATA subtypes).
- Surface typed failure signals (`NoResponseException`, `InvalidResponseException`) so callers can distinguish transport failures from malformed responses.

## Responsibilities
- Build and serialize DNS query messages from caller-supplied domain, type, and class values.
- Transmit query messages over UDP to a caller-specified DNS server on port 53, with retry and timeout handling.
- Parse raw UDP reply bytes into a structured `Response`, including header flags/counts and Question/Answer/NameServer/AdditionalRecord sections.
- Decode individual resource-record RDATA into typed records (`ANameRecord`, `MXRecord`, `NSRecord`, `SoaRecord`) based on the record's `DnsType`, skipping unrecognized types.
- Provide a convenience MX-lookup operation that filters and sorts MX answers by preference.

## Key components
- `Resolver`: static entry-point facade exposing `Lookup` and `MXLookup`; owns UDP socket transfer and retry logic.
- `Request` / `Question`: caller-facing message builder and query descriptor.
- `Response` / `ResourceRecord` (and `Answer`, `NameServer`, `AdditionalRecord`): reply parser and shared resource-record wire-format parser.
- `ANameRecord`, `MXRecord`, `NSRecord`, `SoaRecord`: typed RDATA payloads.
- `InvalidResponseException`, `NoResponseException`: typed failure signals surfaced to callers.

## Related documentation
- [Index](index.md)
- [Architecture](architecture.md)
- [Dependencies](dependencies.md)
- [Operations and processes](operations-processes.md)
- [Business rules](business-rules.md)
- [Configuration](configuration.md)
- [API reference](api/index.md)

## Sources
- SAIF.Framework.DNS\SAIF.BOF.Framework.DNS.csproj
- SAIF.Framework.DNS\Resolver.cs
- SAIF.Framework.DNS\Request.cs
- SAIF.Framework.DNS\Question.cs
- SAIF.Framework.DNS\Response.cs
- SAIF.Framework.DNS\ResourceRecord.cs
- SAIF.Framework.DNS\RecordBase.cs
