Generic DNS lookup¶
This operation is the library's shared request/response pipeline, and every lookup — MX or otherwise — ultimately runs through it. It accepts a caller-prepared Request, converts it to DNS wire format, sends it to the selected DNS server over UDP, and builds a parsed Response object from the raw reply bytes.
| Field | Value |
|---|---|
| Operation ID | OP-DNS-002 |
| Trigger | Caller requests resolution of a prepared DNS Request |
| Inputs | request, dnsServer |
| Outputs | Parsed Response; may throw ArgumentNullException, NoResponseException, or InvalidResponseException |
| Primary components | Resolver.Lookup, Request.GetMessage, Resolver.UdpTransfer, Response.Response |
| Entry point | SAIF.Framework.DNS\Resolver.cs |
Steps¶
- Confirm that
requestanddnsServerare not null before any network activity begins. - The
dnsServercheck enforces BR-001. - On failure: throw
ArgumentNullExceptionand stop; nothing is sent. - Build an
IPEndPointthat targets the supplied DNS server on UDP port 53. - Serialize the request by delegating to DNS request serialization (
request.GetMessage()). - If serialization raises an exception, let it propagate to the caller unchanged.
- Transmit the serialized bytes by delegating to UDP DNS transfer with retry with the target endpoint.
- If no matching reply arrives after all retries, let
NoResponseExceptionpropagate. - Parse the raw reply bytes into a
Responseby delegating to DNS response parsing. - If the reply's question section cannot be parsed, let
InvalidResponseExceptionpropagate. - Return the fully populated
Responseto the caller.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Caller invokes Lookup]) --> V[Validate request and dnsServer]
V --> E[Build UDP endpoint on port 53]
E --> S[Serialize request to wire format]
S --> T[Transfer request over UDP with retry]
T --> P[Parse reply bytes into Response]
P --> EndOk([Return parsed Response])
Failure and edge-case behavior¶
- Null
requestordnsServerarguments fail before the UDP endpoint is even created. - This operation does not catch transport or parsing exceptions of its own; every exception raised by the delegated serialization, transfer, or parsing stages reaches the caller directly and unmodified.
- The target port is always UDP 53; the API gives callers no way to override it.
Related documentation¶
Sources¶
- SAIF.Framework.DNS\Resolver.cs
- SAIF.Framework.DNS\Request.cs
- SAIF.Framework.DNS\Response.cs