Transparent -> prefab, for unify.rkt to work

This commit is contained in:
Tony Garnock-Jones 2012-05-03 15:10:32 -04:00
parent f8676fcca5
commit d85237674a
6 changed files with 29 additions and 23 deletions

32
api.rkt
View File

@ -54,6 +54,12 @@
#:transparent
#:property prop:equal+hash (list domain=? domain-hash-1/2 domain-hash-1/2))
(require "../racket-matrix/struct-map.rkt")
(install-struct-mapper! struct:domain
(lambda (f seed x)
(let-values (((labels seed) (f (domain-labels x) seed)))
(values (make-domain labels) seed))))
;; A ShortString is a String with length 255 or shorter.
;; An IPv4 is a (vector Byte Byte Byte Byte), representing an IPv4
@ -70,7 +76,7 @@
;; for the given name, type and class?" as well as a possible parent
;; question that the answer to this question is to contribute to the
;; answer to.
(struct question (name type class context) #:transparent)
(struct question (name type class context) #:prefab)
;; A QuestionContext is one of
;; -- (cname-subq Question), resulting from the expansion of a CNAME
@ -83,20 +89,20 @@
;; excessively-glueless subquestion not represented here, and should
;; *not* in turn be considered for gluelessness-restarting: this is
;; needed to avoid a different kind of infinite loop.
(struct subquestion (parent) #:transparent)
(struct cname-subq subquestion () #:transparent)
(struct ns-subq subquestion () #:transparent)
(struct subquestion (parent) #:prefab)
(struct cname-subq subquestion () #:prefab)
(struct ns-subq subquestion () #:prefab)
;; An AnsweredQuestion is an (answered-question Question
;; Maybe<CompleteAnswer>).
(struct answered-question (q a) #:transparent)
(struct answered-question (q a) #:prefab)
;; A CompleteAnswer is a (complete-answer Set<RR> Set<RR> Set<RR>)
(struct complete-answer (rrs authorities additional) #:transparent)
(struct complete-answer (rrs authorities additional) #:prefab)
;; An RR is a (rr DomainName RRType RRClass Uint32 RData),
;; representing a resource record.
(struct rr (name type class ttl rdata) #:transparent)
(struct rr (name type class ttl rdata) #:prefab)
;; An RData is one of
;; - a DomainName, for CNAME, MB, MD, MF, MG, MR, NS and PTR records
@ -116,12 +122,12 @@
;;
;; Many of these variants are obsolete in today's DNS database (marked
;; [O] above).
(struct hinfo (cpu os) #:transparent)
(struct minfo (rmailbx emailbx) #:transparent)
(struct mx (preference exchange) #:transparent)
(struct soa (mname rname serial refresh retry expire minimum) #:transparent)
(struct wks (address protocol bitmap) #:transparent)
(struct srv (priority weight port target) #:transparent)
(struct hinfo (cpu os) #:prefab)
(struct minfo (rmailbx emailbx) #:prefab)
(struct mx (preference exchange) #:prefab)
(struct soa (mname rname serial refresh retry expire minimum) #:prefab)
(struct wks (address protocol bitmap) #:prefab)
(struct srv (priority weight port target) #:prefab)
;; An RRType is a Symbol or a Number, one of the possibilities given
;; in the following define-mapping. It represents the type of an

View File

@ -60,7 +60,7 @@
answers
authorities
additional)
#:transparent)
#:prefab)
;; Bit-syntax type for counted repeats of a value.
;; Example: Length-prefixed list of 32-bit unsigned words:

View File

@ -117,11 +117,11 @@
zone-origin
server-names
unique-id)
#:transparent)
#:prefab)
;; A NetworkReply is a (network-reply UniqueID Maybe<CompleteAnswer>)
;; representing the final result of a network query.
(struct network-reply (unique-id answer) #:transparent)
(struct network-reply (unique-id answer) #:prefab)
;; A NetworkQueryState is a (network-query-state NetworkRequest
;; Integer Map<DomainName,ListOf<UdpAddress>> ListOf<UdpAddress>
@ -133,7 +133,7 @@
remaining-addresses
current-name
remaining-names)
#:transparent)
#:prefab)
;; seconds -> Maybe<seconds>
(define (next-timeout timeout)

View File

@ -23,7 +23,7 @@
;; searches from. Performs recursive queries.
;; For discarding retransmitted requests that we're still working on.
(struct active-request (source id) #:transparent)
(struct active-request (source id) #:prefab)
;; start-proxy : UInt16 CompiledZone CompiledZone -> Void
(define (start-proxy port-number zone roots-only)
@ -215,8 +215,8 @@
[(timer-expired (list 'check-dns-expiry name) now-msec)
(zone-expire-name zone name (/ now-msec 1000.0))])))))
(struct question-state (zone q client-sock nameservers-tried retry-count) #:transparent)
(struct expanding-cnames (q accumulator remaining-count) #:transparent)
(struct question-state (zone q client-sock nameservers-tried retry-count) #:prefab)
(struct expanding-cnames (q accumulator remaining-count) #:prefab)
(define (question-handler zone q client-sock)
(os-big-bang/transition

View File

@ -49,10 +49,10 @@
;; A PartialAnswer is a (partial-answer CompleteAnswer ListOf<DomainName>)
;; A collection of relevant RRs together with some CNAMEs that need expanding.
(struct partial-answer (base cnames) #:transparent)
(struct partial-answer (base cnames) #:prefab)
;; A Referral is a (referral DomainName Set<RR> Set<RR>)
(struct referral (zone-origin nameserver-rrs additional) #:transparent)
(struct referral (zone-origin nameserver-rrs additional) #:prefab)
;; An answer of #f here does NOT indicate a missing domain-name
;; (name-error/NXDOMAIN), but instead indicates that there are no

View File

@ -28,7 +28,7 @@
;; An InfiniteLifetime is an (infinite-lifetime RelativeSeconds), a
;; specification of the TTL to use when sending a non-expiring RR to a
;; peer.
(struct infinite-lifetime (ttl) #:transparent)
(struct infinite-lifetime (ttl) #:prefab)
;; A CompiledZone is a Hash<DomainName,Hash<RR,(or AbsoluteSeconds
;; InfiniteLifetime)>>, representing a collection of DNS RRSets