added interface for dnsd

This commit is contained in:
nofreude 2006-11-12 18:00:10 +00:00
parent c2c01e9f4c
commit d465ef05b7
1 changed files with 378 additions and 19 deletions

View File

@ -7,6 +7,7 @@
;;; Copyright (c) 1996-2002 by Mike Sperber. ;;; Copyright (c) 1996-2002 by Mike Sperber.
;;; Copyright (c) 2000-2002 by Martin Gasbichler. ;;; Copyright (c) 2000-2002 by Martin Gasbichler.
;;; Copyright (c) 1998-2001 by Eric Marsden. ;;; Copyright (c) 1998-2001 by Eric Marsden.
;;; Copyright (c) 2005-2006 by Norbert Freudemann.
;;; For copyright information, see the file COPYING which comes with ;;; For copyright information, see the file COPYING which comes with
;;; the distribution. ;;; the distribution.
@ -147,7 +148,7 @@
dns-inverse-lookup ; obsolete, use dns-lookup-ip dns-inverse-lookup ; obsolete, use dns-lookup-ip
dns-lookup-ip ; simple lookup function dns-lookup-ip ; simple lookup function
dns-lookup-nameserver ; simple lookup function dns-lookup-nameserver ; simple lookup function
dns-lookup-mail-exchanger ; simple lookpu function dns-lookup-mail-exchanger ; simple lookup function
pretty-print-dns-message ; prints a human readable dns-msg pretty-print-dns-message ; prints a human readable dns-msg
force-ip ; reruns a lookup until a ip is resolved force-ip ; reruns a lookup until a ip is resolved
force-ip-list ; reruns a lookup until a list of ips is resolved force-ip-list ; reruns a lookup until a list of ips is resolved
@ -160,7 +161,25 @@
host-fqdn host-fqdn
system-fqdn system-fqdn
dns-get-information address32? ; for dnsd.scm
octet-pair->number ; -"-
number->octet-pair ; -"-
parse ; -"- produces a message-record-type
mc-message->octets ; -"- produces a byte-encoded (compressed) message
make-fqdn-name ; -"- maybe adds an ending dot to a string
fqdn? ; -"- checks for fully quallified domain names
cut-name ; -"- domain name split tool
dn-split? ; -"- domain name split tool
dns-server-error? ; -"- error condition predicate
dns-format-error? ; -"-
dns-server-failure? ; -"-
dns-name-error? ; -"-
dns-not-implemented? ; -"-
dns-refused? ; -"-
dns-error? ; -"-
bad-nameserver? ; -"-
dns-query/cache ; -"-
add-size-tag
(network-protocol :syntax) (network-protocol :syntax)
network-protocol? network-protocol?
@ -171,38 +190,67 @@
pretty-print-dns-message pretty-print-dns-message
message? message-header message-questions message-answers make-message message? message-header message-questions message-answers
message-nameservers message-additionals message-source message-nameservers message-additionals message-source
set-message-source!
make-query-message make-simple-query-message make-query-message make-simple-query-message
header? header-flags header-question-count header-answer-count make-header header? header-id header-flags header-question-count
header-nameserver-count header-additional-count header-answer-count header-nameserver-count header-additional-count
flags? flags-query-type flags-opcode flags-authoritative? make-flags flags? flags-query-type flags-opcode flags-authoritative?
flags-truncated? flags-recursion-desired? flags-recursion-available? flags-truncated? flags-recursion-desired? flags-recursion-available?
flags-zero flags-response-code flags-zero flags-response-code set-flags-response-code!
set-flags-authoritative! set-flags-recursion-available!
set-flags-truncated!
question? question-name question-type question-class make-question question? question-name question-type question-class
(message-class :syntax) (message-class :syntax)
message-class? message-class-name message-class-number message-class? message-class-name message-class-number
the-message-class
message-class-number->type
message-class-symbol->type
(message-type :syntax) (message-type :syntax)
message-type? message-type-name message-type-number message-type? message-type-name message-type-number
the-message-type
message-type-number->type
message-type-symbol->type
make-resource-record
resource-record? resource-record?
resource-record-name resource-record-type resource-record-name
resource-record-class resource-record-ttl resource-record-type
resource-record-class
resource-record-ttl
resource-record-data resource-record-data
resource-record-data-a? resource-record-data-a-ip make-resource-record-data-a
resource-record-data-ns? resource-record-data-ns-name resource-record-data-a?
resource-record-data-cname? resource-record-data-cname-name resource-record-data-a-ip
resource-record-data-mx? resource-record-data-mx-preference
resource-record-data-mx-exchanger resource-record-data-ptr?
resource-record-data-ptr-name
make-resource-record-data-ns
resource-record-data-ns?
resource-record-data-ns-name
make-resource-record-data-cname
resource-record-data-cname?
resource-record-data-cname-name
make-resource-record-data-mx
resource-record-data-mx?
resource-record-data-mx-preference
resource-record-data-mx-exchanger
make-resource-record-data-ptr
resource-record-data-ptr?
resource-record-data-ptr-name
make-resource-record-data-soa
resource-record-data-soa? resource-record-data-soa?
resource-record-data-soa-mname resource-record-data-soa-mname
resource-record-data-soa-rname resource-record-data-soa-rname
@ -212,6 +260,18 @@
resource-record-data-soa-expire resource-record-data-soa-expire
resource-record-data-soa-minimum resource-record-data-soa-minimum
make-resource-record-data-aaaa
resource-record-data-aaaa?
resource-record-data-aaaa-ipv6
make-resource-record-data-hinfo
resource-record-data-hinfo?
resource-record-data-hinfo-data
make-resource-record-data-txt
resource-record-data-txt?
resource-record-data-txt-text
cache? cache-answer cache-ttl cache-time cache? cache-answer cache-ttl cache-time
resolv.conf-parse-error? resolv.conf-parse-error?
@ -224,6 +284,7 @@
ip-string->address32 ip-string->address32
ip-string->in-addr.arpa-string ip-string->in-addr.arpa-string
octet-ip->address32 ;for dns.scm octet-ip->address32 ;for dns.scm
address32->octet-ip ;for dns.scm
ip-string?)) ip-string?))
(define-interface cgi-scripts-interface (define-interface cgi-scripts-interface
@ -266,6 +327,150 @@
(export with-fatal-error-handler* (export with-fatal-error-handler*
(with-fatal-error-handler :syntax))) (with-fatal-error-handler :syntax)))
;; DNS server
(define-interface dnsd-silex-interface
(export lexer
lexer-getc
lexer-ungetc
lexer-init))
(define-interface dnsd-rw-locks-interface
(export make-r/w-lock
obtain-R/w-lock
obtain-r/W-lock
release-R/w-lock
release-r/W-lock
with-R/w-lock
with-r/W-lock))
(define-interface dnsd-semaphores-interface
(export make-semaphore
set-semaphore!
semaphore-post
semaphore-wait))
(define-interface dnsd-mf-parser-interface
(export parse-mf))
(define-interface dnsd-logging-interface
(export display-debug
apply-w/debug
dnsd-log))
(define-interface dnsd-rr-def-interface
(export dns-rr-a
dns-rr-ns
dns-rr-cname
dns-rr-soa
dns-rr-ptr
dns-rr-hinfo
dns-rr-mx
dns-rr-txt
dns-rr-aaaa))
(define-interface dnsd-options-interface
(export make-default-dnsd-options
make-options-from-list
dnsd-options?
dnsd-options-port
dnsd-options-dir
dnsd-options-nameservers
dnsd-options-use-axfr?
dnsd-options-use-cache?
dnsd-options-cleanup-interval
dnsd-options-retry-interval
dnsd-options-use-db?
dnsd-options-use-recursion?
dnsd-options-rec-timeout
dnsd-options-socket-timeout
dnsd-options-socket-max-tries
dnsd-options-max-connections
dnsd-options-blacklist-time
dnsd-options-blacklist-value
dnsd-options-use-pre/post
dnsd-options-debug-mode
with-port
with-dir
with-nameservers
with-axfr
with-cache
with-cleanup-interval
with-retry-interval
with-db
with-recursion
with-rec-timeout
with-socket-timeout
with-socket-max-tries
with-max-connections
with-blacklist-time
with-blacklist-value
with-use-pre/post
with-debug-mode))
(define-interface dnsd-database-interface
(export maybe-get-soa-rr-name
db-clear-database
db-clear-zone
db-update-zone
db-get-zone
db-get-zone-for-axfr
db-get-zone-soa-rr
db-pretty-print
db-lookup-rec))
(define-interface dnsddb-options-interface
(export make-default-dnsddb-options
make-db-options-from-list
dnsddb-options?
dnsddb-options-name
dnsddb-options-class
dnsddb-options-type
dnsddb-options-primary? ;; depreached
dnsddb-options-file
dnsddb-options-filetype
dnsddb-options-master-name
dnsddb-options-master-ip
with-name
with-class
with-type
with-primary?
with-file
with-filetype
with-master-name
with-master-ip))
(define-interface dnsd-cache-interface
(export dnsd-cache-clear!
dnsd-cache-clean!
dnsd-cache-lookup?
dnsd-cache-update!
dnsd-cache-pretty-print))
(define-interface dnsd-slist-interface
(export dnsd-slist-clear!
dnsd-slist-clean!
dnsd-slist-lookup
dnsd-slist-update!
dnsd-slist-pretty-print
dnsd-blacklist-clear!
;deprecated dnsd-blacklist-clean!
dnsd-blacklist!
dnsd-blacklist-unlist!
dnsd-blacklist-print))
(define-interface dnsd-resolver-interface
(export dnsd-ask-resolver-rec
dnsd-ask-resolver-direct
;; Some stuff needed in dnsd.scm:
msg-set-rcode!
make-response))
(define-interface dnsd-interface
(export))
;; FTP server ;; FTP server
(define-interface ftpd-interface (define-interface ftpd-interface
@ -536,21 +741,22 @@
(define-structure dns dns-interface (define-structure dns dns-interface
(open scheme-with-scsh (open scheme-with-scsh
(subset srfi-1 (filter reverse! delete lset-difference lset-union)) (subset srfi-1 (filter reverse! delete lset-difference lset-union
fold fold-right concatenate))
tables tables
ascii ascii
formats formats
signals signals
finite-types finite-types
define-record-types define-record-types
random
queues queues
conditions conditions
handle handle
sort sort
threads threads
locks locks
ips) ips
srfi-27)
(files (lib dns))) (files (lib dns)))
(define-structure ips ips-interface (define-structure ips ips-interface
@ -610,6 +816,159 @@
(open scheme conditions handle) (open scheme conditions handle)
(files (lib handle-fatal-error))) (files (lib handle-fatal-error)))
;; DNS server ******************************************************************
(define-structure dnsd dnsd-interface
(open scheme-with-scsh
(subset srfi-1 (fold-right take drop filter lset-difference lset-union))
srfi-2
(subset srfi-13 (string-downcase))
threads
thread-fluids ;; fork-thread
rendezvous ; Needs SUnterlib
rendezvous-channels ; Needs SUnterlib
tables
ascii
finite-types
define-record-types
handle-fatal-error
ips ;???
dns
dnsd-options
dnsd-logging
dnsddb-options
;; dnsd-rw-locks
dnsd-semaphores
dnsd-rr-def
dnsd-mf-parser
dnsd-database
dnsd-cache
dnsd-slist
dnsd-resolver)
(files (dnsd dnsd)))
(define-structure dnsd-resolver dnsd-resolver-interface
(open scheme-with-scsh
(subset srfi-1 (fold-right delete filter take drop))
srfi-2
srfi-27 ; for shake-list
threads
thread-fluids ;; fork-thread
rendezvous ; Needs SUnterlib
rendezvous-channels ; Needs SUnterlib
define-record-types
handle-fatal-error
dns
dnsd-cache
dnsd-logging
dnsd-slist
dnsd-options)
(files (dnsd resolver)))
(define-structure dnsd-logging dnsd-logging-interface
(open scheme-with-scsh)
(files (dnsd logging)))
(define-structure dnsddb-options dnsddb-options-interface
(open scheme-with-scsh
define-record-types
dns)
(files (dnsd db-options)))
(define-structure dnsd-database dnsd-database-interface
(open scheme-with-scsh
(subset srfi-1 (fold-right))
srfi-2
(subset srfi-13 (string-downcase))
define-record-types
tables
dns
dnsd-rw-locks
dnsd-logging)
(files (dnsd database)))
(define-structure dnsd-cache dnsd-cache-interface
(open scheme-with-scsh
define-record-types
(subset srfi-1 (fold-right))
(subset srfi-13 (string-downcase))
tables
dns
dnsd-rw-locks)
(files (dnsd cache)))
(define-structure dnsd-slist dnsd-slist-interface
(open scheme-with-scsh
define-record-types
(subset srfi-1 (fold-right filter))
srfi-2
(subset srfi-13 (string-downcase))
tables
dns
dnsd-options
dnsd-rw-locks)
(files (dnsd slist)))
(define-structure dnsd-options dnsd-options-interface
(open scheme-with-scsh
define-record-types)
(files (dnsd options)))
(define-structure dnsd-rw-locks dnsd-rw-locks-interface
(open scheme-with-scsh
locks
threads
define-record-types)
(files (dnsd rw-locks)))
(define-structure dnsd-semaphores dnsd-semaphores-interface
(open scheme-with-scsh
define-record-types
locks)
(files (dnsd semaphores)))
(define-structure dnsd-rr-def dnsd-rr-def-interface
(open scheme-with-scsh
ips
dns
srfi-2)
(files (dnsd rr-def)))
(define-structure dnsd-mf-parser dnsd-mf-parser-interface
(open scheme-with-scsh
(subset srfi-1 (fold-right))
srfi-2
(subset srfi-13 (string-downcase))
handle-fatal-error
dns
dnsd-options
dnsd-logging
dnsd-silex
dnsd-rr-def)
(files (dnsd masterfile-parser)))
(define-structure dnsd-silex dnsd-silex-interface
(open scheme-with-scsh)
(files (dnsd masterfile.l)))
;; FTP server ;; FTP server
(define-structure ftpd ftpd-interface (define-structure ftpd ftpd-interface