Skip to content
Snippets Groups Projects
Select Git revision
  • fe46a5d72f1a24d88f774c1bb1eb6e417d0e44b9
  • master default protected
  • 9.0
  • marcus/wix3
  • 8.0
  • nt-tools
  • 7.8
  • 7.6
  • 7.4
  • 7.2
  • 7.0
  • 0.6
  • rosuav/latex-markdown-renderer
  • rxnpatch/rxnpatch
  • marcus/gobject-introspection
  • rxnpatch/8.0
  • rosuav/pre-listening-ports
  • rosuav/async-annotations
  • rosuav/pgsql-ssl
  • rxnpatch/rxnpatch-broken/2023-10-06T094250
  • grubba/fdlib
  • v8.0.2020
  • v8.0.2018
  • v8.0.2016
  • v8.0.2014
  • v8.0.2012
  • v8.0.2008
  • v8.0.2006
  • v8.0.2004
  • v8.0.2002
  • v8.0.2000
  • v8.0.1998
  • v8.0.1996
  • v8.0.1994
  • v8.0.1992
  • v8.0.1990
  • v8.0.1988
  • v8.0.1986
  • rxnpatch/clusters/8.0/2025-04-29T124414
  • rxnpatch/2025-04-29T124414
  • v8.0.1984
41 results

export_list

Blame
  • enum.scm 1.94 KiB
    (define-module (dns enum)
      :export (rr-types
               int->rr rr->int
               class-types
               int->class class->int
               rcode-types
               int->rcode rcode->int
               opcode-types
               int->opcode opcode->int))
    
    (define (flip-cons c)
      (cons (cdr c) (car c)))
    
    (define (make-mappings name table)
      (values
       (lambda (i)
         (cond ((assv i (map flip-cons table)) => cdr)
               ((integer? i) (inexact->exact i))
               (else (scm-error 'wrong-type-arg (format #f "int->~a" name)
                                "Unknown value ~s, expected known integer or one of ~a"
                                (list i (map car table)) (list (map car table))))))
    
       (lambda (value)
         (cond ((integer? value) (inexact->exact value))
               ((assv value table) => cdr)
               (else (scm-error 'wrong-type-arg (format #f "~a->int" name)
                                "Unknown value ~s"
                                (list value) #f)))  )))
    
    (define rr-types
      '((A     . 1)
        (NS    . 2)
        (MD    . 3)
        (MF    . 4)
        (CNAME . 5)
        (SOA   . 6)
        (MB    . 7)
        (MG    . 8)
        (MR    . 9)
        (NULL  . 10)
        (WKS   . 11)
        (PTR   . 12)
        (HINFO . 13)
        (MINFO . 14)
        (MX    . 15)
        (TXT   . 16)
        ;; I don't know where this is specified
        (AAAA  . 28)))
    
    (define-values (int->rr rr->int)
      (make-mappings "rr" rr-types))
    
    (define class-types
      '((IN . 1)
        (CS . 2)
        (CH . 3)
        (HS . 4)))
    
    (define-values (int->class class->int)
      (make-mappings "class" class-types))
    
    (define rcode-types
      '((NOERROR . 0)  ; no error condition
        (NXDOMAIN . 1) ; format error - name server can't interpret
        (SERVFAIL . 2) ; server failure
        ;; 3 ; name error
        ))
    
    (define-values (int->rcode rcode->int)
                   (make-mappings "rcode" rcode-types))
    
    
    (define opcode-types
      '((QUERY  . 0)
        (IQUERY . 1)
        (STATUS . 2)))
    
    (define-values (int->opcode opcode->int)
                   (make-mappings "opcode" opcode-types))