fact: Definition DnsSpec : ADT DnsSig := Def ADT { rep := QueryStructure DnsSchema, Def Constructor "Init" : rep := empty,, Def Method1 "AddData" (this : rep) (t : resourceRecord) : rep * bool := Insert t into this!sRRecords, Def Method1 "Process" (this : rep) (b : ByteString) : rep * (option ByteString) := p' <- Pick_Decoder_For DNS_Packet_OK encode_packet_Spec b list_CacheEncode_empty; Ifopt p' as p Then p' <- Repeat recurseDepth initializing n with p!"question"!"qname" defaulting rec with (ret (buildempty true ``"ServFail" p)) {{ results <- MaxElements (fun r r' : resourceRecord => prefix r!sNAME r'!sNAME) (For (r in this!sRRecords) Where (prefix r!sNAME n) Return r); If (is_empty results) Then ret (buildempty true ``"NXDomain" p) Else (IfDec (List.Forall (fun r : resourceRecord => r!sNAME = n) results) Then b <- SingletonSet (fun b : CNAME_Record => List.In (A := resourceRecord) b results /\ p!"question"!"qtype" <> QType_inj CNAME); Ifopt b as b' Then p' <- rec b'!sRDATA; ret (add_answer p' b') Else (results <- ⟦ element in results | QType_match (RDataTypeToRRecordType element!sRDATA) (p!"question"!"qtype") ⟧; ret (add_answers results (buildempty true ``"NoError" p))) Else (ns_results <- { ns_results | forall x : NS_Record, List.In x ns_results <-> List.In (A := resourceRecord) x results }; glue_results <- (foldComp (fun glue_records (ns_result : NS_Record) => glue_records' <- (For (rRec in this!sRRecords) Where (rRec!sNAME = ns_result!sRDATA) Return rRec); ret (glue_records' ++ glue_records)) [ ] ns_results); ret (add_additionals glue_results (add_nses (map VariantResourceRecord2RRecord ns_results) (buildempty true ``"NoError" p))))) }}; b' <- encode_packet_Spec p' list_CacheEncode_empty; ret (this, Some (fst b')) Else ret (this, None) }.
imports: Coq.Vectors.Vector Coq.Strings.Ascii Coq.Bool.Bool Coq.Lists.List Fiat.Common.Tactics.CacheStringConstant Fiat.Computation.Decidable Fiat.Computation.IfDec Fiat.Computation.FoldComp Fiat.Computation.FueledFix Fiat.Computation.ListComputations Fiat.QueryStructure.Automation.Common Fiat.QueryStructure.Automation.MasterPlan Fiat.QueryStructure.Implementation.DataStructures.BagADT.BagADT Fiat.QueryStructure.Automation.IndexSelection Fiat.QueryStructure.Specification.SearchTerms.ListPrefix Fiat.QueryStructure.Automation.SearchTerms.FindStringPrefixSearchTerms Fiat.QueryStructure.Automation.QSImplementation Bedrock.Word Fiat.Narcissus.Common.Specs Fiat.Narcissus.BinLib.Core Fiat.Narcissus.Examples.DnsOpt Fiat.Narcissus.Lib2.DomainNameOpt Fiat.Examples.DnsServer.Packet Fiat.Examples.DnsServer.DecomposeSumField Fiat.Examples.DnsServer.DnsLemmas Fiat.Examples.DnsServer.DnsAutomation Fiat.Examples.DnsServer.AuthoritativeDNSSchema