;; -*- coding: utf-8 -*-
;; 20070118 Edited for intergruas.com
;; 20070116 Extracted from informatimago.lisp

(FORMAT *TRACE-OUTPUT* "~&Loading intergruas.lisp~%")
(EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE)
  (DEFVAR PRIVATE NIL)
  (DEFPARAMETER *WILL-CHANGE* NIL)

  (SETF *ZONE-DIR*
        (MERGE-PATHNAMES
         (MAKE-PATHNAME :DIRECTORY '(:ABSOLUTE "var" "lib" "named")) (EXT:CD)))
  #+TEST
  (SETF *ZONE-DIR*
        (MERGE-PATHNAMES
         (MAKE-PATHNAME :DIRECTORY '(:ABSOLUTE "home""pjb""src""domains"))
         (EXT:CD)))

  (SETF *CONF-DIR* *ZONE-DIR*)

  (DEFPARAMETER *SERIAL-DATA-FILE*
    (MERGE-PATHNAMES (MAKE-PATHNAME :NAME "serial" :TYPE "data") *ZONE-DIR*))
  (DEFPARAMETER SERIAL (NEXT-SERIAL *SERIAL-DATA-FILE*))


  (IF *WILL-CHANGE*
      (PROGN (DEFPARAMETER REFRESH     "1200")
             (DEFPARAMETER RETRY        "300")
             (DEFPARAMETER EXPIRE      "1800")
             (DEFPARAMETER DEFAULT-TTL   "60"))
      (PROGN (DEFPARAMETER REFRESH        "2D")
             (DEFPARAMETER RETRY          "1H")
             (DEFPARAMETER EXPIRE         "6W")
             (DEFPARAMETER DEFAULT-TTL  "300")))


  (DEFPARAMETER private-ADDR  '192.168.167.2)
  (DEFPARAMETER PUBLIC-ADDR   '62.93.173.252)
  (DEFPARAMETER PUBLIC-NAME   'correo.intergruas.com)
  (DEFPARAMETER HOSTMASTER    'HOSTMASTER.intergruas.com)

  (DEFPARAMETER *BASE-DOMAIN*  'intergruas.COM)
  (DEFPARAMETER *BASE-INTRA*   (NAME-APPEND 'LAN *BASE-DOMAIN*))
  (DEFPARAMETER *BASE* (IF PRIVATE *BASE-INTRA* *BASE-DOMAIN*))
  );; eval-when


(DEFMACRO DEFINE-SOA (DOMAIN)
  `(DEFINE-ZONE ,DOMAIN (PUBLIC-NAME
                         HOSTMASTER SERIAL
                         REFRESH RETRY EXPIRE DEFAULT-TTL)
     ;; Name servers:
     ',(name-append 'correo *base*)
     ,@(when private '('LARISSA.INFORMATIMAGO.COM))))


(RESET)

;;;------------------------------------------------------------------------
;;; intergruas.com
;;;------------------------------------------------------------------------

;; Don't use REGISTER-REVERSE;
;; it's for the arpa -> CNAME -> byte.domain -> PTR name trick.
;; (REGISTER-REVERSE '(167 168 192)  'LAN.intergruas.COM)


(DEFINE-SOA 'INTERGRUAS.COM)
(define-soa '167.168.192.IN-ADDR.ARPA)

(ADD-RECORD 'INTERGRUAS.COM `(MX 1   ,public-name)               :INFERIORS)
(ADD-RECORD 'INTERGRUAS.COM '(MX 100 LARISSA.INFORMATIMAGO.COM)  :INFERIORS)
(ADD-RECORD 'INTERGRUAS.COM '(LOC   37 37 30 N   0 46 30 W  30M) :INFERIORS)

(ADD-NAME 'LARISSA.INFORMATIMAGO.COM '62.93.174.78) ; used only to generate

(ADD-name 'ROUTER.INTERGRUAS.COM (if private '192.168.167.1 public-addr))
(add-name 'CORREO.INTERGRUAS.COM (if private  private-addr  public-addr))

(ADD-RECORD  'LOCALHOST.INTERGRUAS.COM '(A 127.0.0.1))
(ADD-RECORD            'INTERGRUAS.COM `(CNAME ,public-name))
(ADD-RECORD        'ftp.INTERGRUAS.COM `(CNAME ,public-name))
(ADD-RECORD        'pop.INTERGRUAS.COM `(CNAME ,public-name))
(ADD-RECORD        'www.INTERGRUAS.COM `(CNAME ,public-name))
(ADD-RECORD       'imap.INTERGRUAS.COM `(CNAME ,public-name))
(ADD-RECORD       'mail.INTERGRUAS.COM `(CNAME ,public-name))
(ADD-RECORD       'smtp.INTERGRUAS.COM `(CNAME ,public-name))
(ADD-RECORD 'CORREO.LAN.INTERGRUAS.COM '(A 192.168.167.2))

(ADD-NAME  'ROUTER.LAN.INTERGRUAS.COM '192.168.167.1)
(ADD-NAME 'printer.LAN.INTERGRUAS.COM '192.168.167.38)

;; charming      PowerBook 12"
;; boletus       iMac  LCD 17"
;; mare-azul     iBook blue
;; blanche-neige iBook 15"
;; plantus       G5 17"

(add-name       'boletus.lan.intergruas.com '192.168.167.65)
(add-name      'charming.lan.intergruas.com '192.168.167.66)
(add-name     'mare-azul.lan.intergruas.com '192.168.167.67)
(add-name 'blanche-neige.lan.intergruas.com '192.168.167.68)
(add-name       'plantus.lan.intergruas.com '192.168.167.69)

(ADD-NAME        'triton.LAN.INTERGRUAS.COM '192.168.167.75)
(ADD-NAME        'kuiper.LAN.INTERGRUAS.COM '192.168.167.76)

(loop
   :for i :from 129 :to 254
   :do  (add-name (name-append (format nil "ORDENADOR-~2,'0X" i)
                               'lan.intergruas.com)
                  (name-append '192.168.167 i)))



;; ----------------------------------------------------------------------
;; Generation
;; ----------------------------------------------------------------------

(DEFUN GENERATE ()
  (FORMAT *TRACE-OUTPUT* "~&Generating ~:[public~;private~] zones.~%" PRIVATE)
  (IF PRIVATE
      (GENERATE-FILES "intra"  "intergruas" (LIST private-ADDR))
      (GENERATE-FILES "public" "intergruas" (LIST PUBLIC-ADDR)))
  (FORMAT *TRACE-OUTPUT* "Complete.~%"))
ViewGit