---
title: Response
summary: API reference for Response.
status: draft
owner: <owner>
last_reviewed: 2026-07-23
library: SAIF.Framework.DNS
reference_type: package
---

# Response

`Response` is the logical representation of the byte data returned from a DNS query. It is constructed internally (by `Resolver.Lookup`) from a raw UDP reply byte array and exposes the parsed header flags and resource-record arrays.

## Purpose
- Parse a raw DNS reply byte array into strongly-typed header flags and resource-record collections.
- Expose the parsed `ReturnCode`, questions, and answer/name-server/additional-record arrays to the caller.

## Context
- Namespace: `SAIF.Framework.DNS`
- Assembly/package: `SAIF.BOF.Framework.DNS`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| ReturnCode | `public ReturnCode ReturnCode { get; }` | The DNS response code from the reply header. |
| AuthoritativeAnswer | `public bool AuthoritativeAnswer { get; }` | Whether the responding server is authoritative for the queried domain. |
| RecursionAvailable | `public bool RecursionAvailable { get; }` | Whether the responding server supports recursive queries. |
| MessageTruncated | `public bool MessageTruncated { get; }` | Whether the reply message was truncated. |
| Questions | `public Question[] Questions { get; }` | The questions echoed back in the reply. |
| Answers | `public Answer[] Answers { get; }` | The answer-section resource records. |
| NameServers | `public NameServer[] NameServers { get; }` | The authority-section (name server) resource records. |
| AdditionalRecords | `public AdditionalRecord[] AdditionalRecords { get; }` | The additional-section resource records. |

## Behavioral notes
- `Response` has no public constructor; instances are created internally (`internal Response(byte[] message)`) by `Resolver.Lookup`.
- All properties are read-only and populated entirely during construction from the supplied byte array.
- Enforces [BR-007](../../business-rules.md#br-007-malformed-embedded-questions-abort-response-construction): if an embedded `Question` cannot be parsed, construction aborts and `InvalidResponseException` is thrown instead of yielding a partially-parsed `Response`.
- Question/Answer/NameServer/AdditionalRecord arrays are sized directly from the corresponding count fields in the reply header (bytes 4-11) before being populated.

## Sources
- SAIF.Framework.DNS\Response.cs
