This repository has been archived on 2024-05-23. You can view files and clone it, but cannot push or open issues or pull requests.
dns-toy/lib/response.ml

10 lines
337 B
OCaml
Raw Normal View History

2023-06-13 02:36:32 +02:00
open Types
open Utils
let parse_header reader =
match List.init 6 (fun offset -> unpack_short_be reader (offset * 2)) with
| [ id; flags; num_questions; num_answers; num_authorities; num_additionals ] ->
{ id; flags; num_questions; num_answers; num_authorities; num_additionals }
| _ -> failwith "Invalid number of fields"
;;