From d188ba7ddbb9445005c841baf96931059591ae5f Mon Sep 17 00:00:00 2001 From: interp Date: Mon, 13 May 2002 13:58:19 +0000 Subject: [PATCH] "pretty printing" modules.scm; in fact, rearranging definitions --- modules.scm | 766 +++++++++++++++++++++++++++++----------------------- 1 file changed, 421 insertions(+), 345 deletions(-) diff --git a/modules.scm b/modules.scm index 92e16c7..f9b1549 100644 --- a/modules.scm +++ b/modules.scm @@ -1,6 +1,12 @@ ;;; Scheme 48 module definitions for TCP/IP protocol suites. ;;; Copyright (c) 1995 by Olin Shivers. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Utilities / nice things +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;; format-net + (define-interface format-net-interface (export format-internet-host-address format-port)) @@ -10,6 +16,8 @@ scheme let-opt) ; :optional (files format-net)) + +;;; sunet utilities (define-interface sunet-utilities-interface (export host-name-or-ip @@ -23,6 +31,67 @@ handle-fatal-error) (files sunet-utilities)) + +;;; rate limit + +(define-interface rate-limit-interface + (export make-rate-limiter + rate-limit-block + rate-limit-open + rate-limit-close + rate-limiter-current-requests)) + +(define-structure rate-limit rate-limit-interface + (open scheme + define-record-types + locks + signals) + (files rate-limit)) + + + +;;; CRLF-IO + +(define-interface crlf-io-interface + (export read-crlf-line + read-crlf-line-timeout + write-crlf)) + +(define-structure crlf-io crlf-io-interface + (open ascii ; ascii->char + scsh ; read-line write-string force-output + receiving ; MV return (RECEIVE and VALUES) + let-opt ; let-optionals + threads ; sleep + scheme) + (files crlf-io)) + + +;;; ecm utilities + +;; some utilities for the ecm-stuff (ftp, pop3, smtp, nettime) +;; hope we can vanish this soon + +(define-interface ecm-utilities-interface + (export system-fqdn + safe-first + safe-second + write-crlf + dump)) + +(define-structure ecm-utilities ecm-utilities-interface + (open scsh + string-lib + scheme) + (files ecm-utilities)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Clients / RFC +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +;; SMTP + (define-interface smtp-interface (export sendmail %sendmail expn vrfy mail-help @@ -58,20 +127,7 @@ (files smtp)) -(define-interface crlf-io-interface - (export read-crlf-line - read-crlf-line-timeout - write-crlf)) - -(define-structure crlf-io crlf-io-interface - (open ascii ; ascii->char - scsh ; read-line write-string force-output - receiving ; MV return (RECEIVE and VALUES) - let-opt ; let-optionals - threads ; sleep - scheme) - (files crlf-io)) - +;;; RFC 822 (define-interface rfc822-interface (export read-rfc822-headers @@ -97,6 +153,8 @@ (files rfc822)) +;;; URI + (define-interface uri-interface (export parse-uri uri-escaped-chars @@ -120,6 +178,7 @@ scheme) (files uri)) +;;; URL (define-interface url-interface (export userhost? ; USERHOST @@ -167,25 +226,247 @@ (files url)) -(define-interface httpd-error-interface - (export http-error? - http-error - fatal-syntax-error? - fatal-syntax-error)) +;;; ftp client -(define-structure httpd-error httpd-error-interface - (open conditions signals handle scheme) - (files httpd-error)) +;; ftp.scm is a module for transfering files between networked +;; machines using the File Transfer Protocol + +(define-interface ftp-interface + (export ftp-connect + ftp-login + ftp-type + ftp-rename + ftp-delete + ftp-cd + ftp-cdup + ftp-pwd + ftp-rmdir + ftp-mkdir + ftp-modification-time + ftp-size + ftp-abort + ftp-quit + ftp-ls + ftp-dir + ftp-get + ftp-put + ftp-append + ftp-quot + ftp-error?)) + +(define-structure ftp ftp-interface + (open netrc + scsh + defrec-package + receiving + handle + conditions + signals + error-package + ecm-utilities + string-lib + let-opt + scheme) + (files ftp)) + +;; obsolete ftp client + +(define-interface ftp-obsolete-interface + (export ftp:connect + ftp:login + ftp:type + ftp:rename + ftp:delete + ftp:cd + ftp:cdup + ftp:pwd + ftp:rmdir + ftp:mkdir + ftp:modification-time + ftp:size + ftp:abort + ftp:quit + ftp:ls + ftp:dir + ftp:get + ftp:put + ftp:append + ftp:quot)) + +(define-structure ftp-obsolete ftp-obsolete-interface + (open scsh + scheme + ftp) + (files ftp-obsolete)) -(define-interface handle-fatal-error-interface - (export with-fatal-error-handler* - (with-fatal-error-handler :syntax))) +;;; netrc parsing -(define-structure handle-fatal-error handle-fatal-error-interface - (open scheme conditions handle) - (files handle-fatal-error)) +;; netrc.scm is a module for parsing ~/.netrc files, to obtain login +;; and password information for different network hosts. +(define-interface netrc-interface + (export user-mail-address + netrc:lookup + netrc:lookup-password + netrc:lookup-login + netrc:parse + netrc:try-parse + netrc-refuse?)) + +(define-structure netrc netrc-interface + (open defrec-package + records + scsh + error-package + ecm-utilities + string-lib + conditions signals handle + let-opt + scheme) + (files netrc)) + + +;;; POP3 client + +;; pop3.scm is a module for accessing email on a maildrop server, +;; using the POP3 protocol. +(define-interface pop3-interface + (export pop3-connect + pop3-login + pop3-stat + pop3-get + pop3-headers + pop3-last + pop3-delete + pop3-reset + pop3-quit)) + +(define-structure pop3 pop3-interface + (open netrc + scsh + defrec-package + handle + conditions + signals + ecm-utilities + string-lib + scheme) + (files pop3)) + +;; obsolete pop3 + +(define-interface pop3-obsolete-interface + (export pop3:connect + pop3:login + pop3:stat + pop3:get + pop3:headers + pop3:last + pop3:delete + pop3:reset + pop3:quit)) + +(define-structure pop3-obsolete pop3-obsolete-interface + (open scsh + scheme + pop3) + (files pop3-obsolete)) + +;;; nettime + +;; nettime.scm is a module for requesting the time on remote machines, +;; using the time or the daytime protocol +(define-interface nettime-interface + (export net-time + net-daytime)) + +(define-structure nettime nettime-interface + (open scsh + scheme) + (files nettime)) + +;; obsolete nettime + +(define-structure nettime-obsolete nettime-obsolete-interface + (open scsh + scheme + nettime) + (files nettime-obsolete)) + +(define-interface nettime-obsolete-interface + (export net:time + net:daytime)) + + +;;; ls +;; clone of unix' ls + +(define-interface ls-interface + (export ls-crlf? + ls + arguments->ls-flags)) + +(define-structure ls ls-interface + (open scheme handle + big-scheme bitwise + fluids + crlf-io + scsh) + (files ls)) + + +;;; DNS + +;; dns.scm is a module to resolve hostnames and ip-addresses. +;; it implements the rfc1035. +(define-interface dns-interface + (export dns-clear-cache + dns-lookup + dns-lookup-name + dns-inverse-lookup + dns-lookup-ip + dns-lookup-nameserver + dns-lookup-mail-exchanger + concurrent-lookup + show-dns-message + dns-find-nameserver + dns-find-nameserver-list)) + +(define-structure dns dns-interface + (open scheme + scsh + big-util + tables + ascii + formats + signals + defrec-package + random + queues + threads + locks) + (files dns)) + +;;; CGI script + +;;; For writing CGI scripts in Scheme. +(define-interface cgi-script-interface (export cgi-form-query)) + +(define-structure cgi-script cgi-script-interface + (open scsh + error-package + parse-html-forms + scheme) + (files cgi-script)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Servers +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;; HTTPD Web-Server + +;;; httpd-core (define-interface httpd-core-interface (export server/version @@ -249,42 +530,6 @@ begin-http-header send-http-error-reply)) -(define-interface httpd-make-options-interface - (export with-port - with-root-directory - with-fqdn - with-reported-port - with-path-handler - with-server-admin - with-simultaneous-requests - with-logfile - with-syslog?)) - -(define-interface httpd-read-options-interface - (export httpd-options-port - httpd-options-root-directory - httpd-options-fqdn - httpd-options-reported-port - httpd-options-path-handler - httpd-options-server-admin - httpd-options-simultaneous-requests - httpd-options-logfile - httpd-options-syslog?)) - -(define-interface rate-limit-interface - (export make-rate-limiter - rate-limit-block - rate-limit-open - rate-limit-close - rate-limiter-current-requests)) - -(define-structure rate-limit rate-limit-interface - (open scheme - define-record-types - locks - signals) - (files rate-limit)) - (define-structure httpd-core httpd-core-interface (open threads locks thread-fluids ; fork-thread @@ -312,6 +557,32 @@ scheme) (files httpd-core)) + +;;; httpd-make-options +;;; httpd-read-options + +(define-interface httpd-make-options-interface + (export with-port + with-root-directory + with-fqdn + with-reported-port + with-path-handler + with-server-admin + with-simultaneous-requests + with-logfile + with-syslog?)) + +(define-interface httpd-read-options-interface + (export httpd-options-port + httpd-options-root-directory + httpd-options-fqdn + httpd-options-reported-port + httpd-options-path-handler + httpd-options-server-admin + httpd-options-simultaneous-requests + httpd-options-logfile + httpd-options-syslog?)) + (define-structures ((httpd-make-options httpd-make-options-interface) (httpd-read-options httpd-read-options-interface)) (open scheme @@ -319,7 +590,50 @@ (files httpd-options)) +;;; httpd-access-control + +(define-interface httpd-access-control-interface + (export access-denier + access-allower + access-controller + access-controlled-handler)) + +(define-structure httpd-access-control httpd-access-control-interface + (open big-scheme + httpd-core + httpd-error + string-lib ; STRING-MAP + scsh + scheme) + (files httpd-access-control)) + + +;;; httpd-error + +(define-interface httpd-error-interface + (export http-error? + http-error + fatal-syntax-error? + fatal-syntax-error)) + +(define-structure httpd-error httpd-error-interface + (open conditions signals handle scheme) + (files (httpd httpd-error))) + +;;; httpd-fatal-error + +(define-interface handle-fatal-error-interface + (export with-fatal-error-handler* + (with-fatal-error-handler :syntax))) + +(define-structure handle-fatal-error handle-fatal-error-interface + (open scheme conditions handle) + (files (httpd handle-fatal-error))) + + +;;; parse-html-forms ;;; For parsing submissions from HTML forms. + (define-interface parse-html-forms-interface (export parse-html-form-query unescape-uri+)) @@ -334,40 +648,7 @@ (files parse-forms)) -;;; For writing CGI scripts in Scheme. -(define-interface cgi-script-interface (export cgi-form-query)) - -(define-structure cgi-script cgi-script-interface - (open scsh - error-package - parse-html-forms - scheme) - (files cgi-script)) - -;;; Provides the server interface to CGI scripts. -(define-interface cgi-server-interface - (export cgi-default-bin-path - cgi-handler)) - -(define-structure cgi-server cgi-server-interface - (open string-lib - rfc822 - crlf-io ; WRITE-CRLF - uri - url ; HTTP-URL record type - httpd-core ; REQUEST record type, HTTP-ERROR & reply codes - ; version stuff - httpd-basic-handlers ; HTTP-HOMEDIR, SERVE-ROOTED-FILE-PATH - httpd-error ; HTTP-ERROR - scsh-utilities ; INDEX - scsh ; syscalls - formats ; format - format-net ; FORMAT-INTERNET-HOST-ADDRESS - sunet-utilities ; host-name-or-empty - let-opt ; let-optionals - scheme) - (files cgi-server)) - +;;; htmlout (define-interface htmlout-interface (export emit-tag @@ -388,6 +669,10 @@ (files htmlout)) +;; path-handlers + +;;; httpd-basic-handlers + (define-interface httpd-basic-handlers-interface (export alist-path-dispatcher home-dir-handler @@ -416,9 +701,11 @@ handle-fatal-error ; WITH-FATAL-ERROR-HANDLER string-lib ; STRING-JOIN scheme) - (files httpd-handlers)) + (files (httpd httpd-handlers))) +;;; seval-handler + (define-interface seval-handler-interface (export seval-handler)) @@ -441,21 +728,8 @@ (files seval)) -(define-interface httpd-access-control-interface - (export access-denier - access-allower - access-controller - access-controlled-handler)) - -(define-structure httpd-access-control httpd-access-control-interface - (open big-scheme - httpd-core - httpd-error - string-lib ; STRING-MAP - scsh - scheme) - (files httpd-access-control)) +;;; info-gateway (define-interface info-gateway-interface (export info-handler @@ -477,6 +751,8 @@ (files info-gateway)) +;;; rman-gateway + (define-interface rman-gateway-interface (export rman-handler man @@ -503,18 +779,34 @@ (files rman-gateway)) -(define-interface ls-interface - (export ls-crlf? - ls - arguments->ls-flags)) +;;; CGI Server -(define-structure ls ls-interface - (open scheme handle - big-scheme bitwise - fluids - crlf-io - scsh) - (files ls)) +;;; Provides the server interface to CGI scripts. +(define-interface cgi-server-interface + (export cgi-default-bin-path + cgi-handler)) + +(define-structure cgi-server cgi-server-interface + (open string-lib + rfc822 + crlf-io ; WRITE-CRLF + uri + url ; HTTP-URL record type + httpd-core ; REQUEST record type, HTTP-ERROR & reply codes + ; version stuff + httpd-basic-handlers ; HTTP-HOMEDIR, SERVE-ROOTED-FILE-PATH + httpd-error ; HTTP-ERROR + scsh-utilities ; INDEX + scsh ; syscalls + formats ; format + format-net ; FORMAT-INTERNET-HOST-ADDRESS + sunet-utilities ; host-name-or-empty + let-opt ; let-optionals + scheme) + (files cgi-server)) + + +;;; FTP server: ftpd (define-interface ftpd-interface (export ftpd @@ -541,198 +833,13 @@ (access big-scheme) (files ftpd)) -;; some utilities for the following stuff -;; hope we can vanish this soon - -(define-interface ecm-utilities-interface - (export system-fqdn - safe-first - safe-second - write-crlf - dump)) - -(define-structure ecm-utilities ecm-utilities-interface - (open scsh - string-lib - scheme) - (files ecm-utilities)) - - -;; netrc.scm is a module for parsing ~/.netrc files, to obtain login -;; and password information for different network hosts. - -(define-interface netrc-interface - (export user-mail-address - netrc:lookup - netrc:lookup-password - netrc:lookup-login - netrc:parse - netrc:try-parse - netrc-refuse?)) - -(define-structure netrc netrc-interface - (open defrec-package - records - scsh - error-package - ecm-utilities - string-lib - conditions signals handle - let-opt - scheme) - (files netrc)) - - -;; ftp.scm is a module for transfering files between networked -;; machines using the File Transfer Protocol -(define-interface ftp-obsolete-interface - (export ftp:connect - ftp:login - ftp:type - ftp:rename - ftp:delete - ftp:cd - ftp:cdup - ftp:pwd - ftp:rmdir - ftp:mkdir - ftp:modification-time - ftp:size - ftp:abort - ftp:quit - ftp:ls - ftp:dir - ftp:get - ftp:put - ftp:append - ftp:quot)) - -(define-structure ftp-obsolete ftp-obsolete-interface - (open netrc - scsh - defrec-package - receiving - handle - conditions - signals - error-package - ecm-utilities - string-lib - let-opt - ftp - scheme) - (files ftp-obsolete)) - -(define-interface ftp-interface - (export ftp-connect - ftp-login - ftp-type - ftp-rename - ftp-delete - ftp-cd - ftp-cdup - ftp-pwd - ftp-rmdir - ftp-mkdir - ftp-modification-time - ftp-size - ftp-abort - ftp-quit - ftp-ls - ftp-dir - ftp-get - ftp-put - ftp-append - ftp-quot - ftp-error?)) - -(define-structure ftp ftp-interface - (open netrc - scsh - defrec-package - receiving - handle - conditions - signals - error-package - ecm-utilities - string-lib - let-opt - scheme) - (files ftp)) - -;; pop3.scm is a module for accessing email on a maildrop server, -;; using the POP3 protocol. -(define-interface pop3-interface - (export pop3-connect - pop3-login - pop3-stat - pop3-get - pop3-headers - pop3-last - pop3-delete - pop3-reset - pop3-quit)) - -(define-interface pop3-obsolete-interface - (export pop3:connect - pop3:login - pop3:stat - pop3:get - pop3:headers - pop3:last - pop3:delete - pop3:reset - pop3:quit)) - -(define-structure pop3 pop3-interface - (open netrc - scsh - defrec-package - handle - conditions - signals - ecm-utilities - string-lib - scheme) - (files pop3)) - -(define-structure pop3-obsolete pop3-obsolete-interface - (open scsh - scheme - pop3) - (files pop3-obsolete)) - - -;; nettime.scm is a module for requesting the time on remote machines, -;; using the time or the daytime protocol -(define-interface nettime-interface - (export net-time - net-daytime)) - -(define-interface nettime-obsolete-interface - (export net:time - net:daytime)) - - -(define-structure nettime nettime-interface - (open scsh - scheme) - (files nettime)) - -(define-structure nettime-obsolete nettime-obsolete-interface - (open scsh - scheme - nettime) - (files nettime-obsolete)) - - -;;; Here is toothless.scm -;;; Shouldn't the definitions be in an extra file? Andreas. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; else: TOOTHLESS +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; -*- Scheme -*- -;;; This file defines a Scheme 48 module that is R4RS without features that -;;; could examine or effect the file system. You can also use it +;;; This file defines a Scheme 48 module that is R4RS without features +;;; that could examine or effect the file system. You can also use it ;;; as a model of how to execute code in other protected environments ;;; in S48. ;;; @@ -796,34 +903,3 @@ (ignore-errors (lambda () (eval exp (new-safe-package))))))) - - -;; dns.scm is a module to resolve hostnames and ip-addresses. -;; it implements the rfc1035. -(define-interface dns-interface - (export dns-clear-cache - dns-lookup - dns-lookup-name - dns-inverse-lookup - dns-lookup-ip - dns-lookup-nameserver - dns-lookup-mail-exchanger - concurrent-lookup - show-dns-message - dns-find-nameserver - dns-find-nameserver-list)) - -(define-structure dns dns-interface - (open scheme - scsh - big-util - tables - ascii - formats - signals - defrec-package - random - queues - threads - locks) - (files dns))