;; -*- coding: utf-8 -*-
;; 20060425 Added novapolska.afaa.asso.fr
;; 20060425 Added cultures{,-}france.{com,org,eu,fr}
;; 20060425 Removed bresil-bresil.{com,org}
;; 20060425 Removed festivaldes{modes,cultures}francophones.{com,net,org,fr}
;; 20050413 Checked Secondary DNS larissa.informatimago.com
;; 20050206 Added festivaldesculturesfrancophones.{com,net,org,fr}
;; 20050113 Added festivaldesmondesfrancophones.{com,org,fr}

(FORMAT *TRACE-OUTPUT* "~&Loading afaa.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""firms""afaa"
                                     "computers""janus""instalation""etc""named"))
         (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 MASTER-INTRA-ADDR  '10.0.0.145)
  (DEFPARAMETER MASTER-PUBLIC-ADDR '195.114.85.145)
  (DEFPARAMETER MASTER-PUBLIC-NAME 'JANUS-1.JANUS.AFAA.ASSO.FR)
  (DEFPARAMETER HOSTMASTER         'HOSTMASTER.AFAA.ASSO.FR)

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


(DEFMACRO DEFINE-SOA (DOMAIN MASTER-PUBLIC-NAME HOSTMASTER
                   SERIAL REFRESH RETRY EXPIRE DEFAULT-TTL
                   NS-BASE-DOMAIN)
  (LET ((NS-BASE-DOMAIN (EVAL NS-BASE-DOMAIN)))
    ;; TODO: replace this with calls to NAME-APPEND:
    (LET ((J1 (INTERN (FORMAT NIL "JANUS-1.JANUS.~A" NS-BASE-DOMAIN)))
          (J2 (INTERN (FORMAT NIL "JANUS-2.JANUS.~A" NS-BASE-DOMAIN)))
          (J3 (INTERN (FORMAT NIL "JANUS-3.~A" NS-BASE-DOMAIN)))
          (J4 (INTERN (FORMAT NIL "JANUS-4.~A" NS-BASE-DOMAIN))))
      (DECLARE (IGNORE J2 J3 J4))
      `(PROGN
         (DEFINE-ZONE ,DOMAIN (,MASTER-PUBLIC-NAME
                               ,HOSTMASTER ,SERIAL
                               ,REFRESH ,RETRY ,EXPIRE ,DEFAULT-TTL)
           ;; Name servers:
           ',J1 #|',J2 ',J3 ',J4 |# 'LARISSA.INFORMATIMAGO.COM)
         ;; Mail Exchanges:
         (ADD-RECORD ,DOMAIN '(MX  11  ,J1)  :INFERIORS)
         ;; (ADD-RECORD ,DOMAIN '(MX  13  ,J2)  :INFERIORS)
         ;; (ADD-RECORD ,DOMAIN '(MX  12  ,J3)  :INFERIORS)
         ;; (ADD-RECORD ,DOMAIN '(MX  14  ,J4)  :INFERIORS)
         (ADD-RECORD ,DOMAIN '(MX  20  SMTP.AFAA.ASSO.FR)  :INFERIORS)
         (ADD-RECORD ,DOMAIN '(MX  30  MAIL2.EASYNET.FR)   :INFERIORS)
         (ADD-RECORD ,DOMAIN '(LOC  48 52 N 2 19 E 340M)   :INFERIORS) ))))


(RESET)

;; ----------------------------------------------------------------------
;; afaa.asso.fr
;; ----------------------------------------------------------------------

(DEFINE-SOA 'AFAA.ASSO.FR
    MASTER-PUBLIC-NAME HOSTMASTER SERIAL REFRESH RETRY EXPIRE DEFAULT-TTL
    *BASE-DOMAIN*)

;; ========================================
;; Reverse
;; Easynet a des enregistrements:
;;  NNN.85.114.195.in-addr.arpa  IN CNAME NNN.afaa.asso.fr
;; ========================================
(REGISTER-REVERSE '(85 114 195) 'AFAA.ASSO.FR)
;; maps nnn.85.114.195.in-addr.arpa. -> nnn.afaa.asso.fr
(WHEN PRIVATE
  (REGISTER-REVERSE '(0 0 10)  'AFAA.ASSO.FR) )
;; maps nnn.0.0.10.in-addr.arpa. -> nnn.afaa.asso.fr

;;  (REGISTER-REVERSE '(0 10 10) 'AFAA.ASSO.FR)
;;  (REGISTER-REVERSE '(129 10)  'AFAA.ASSO.FR)
;;  (REGISTER-REVERSE '(130 10)  'AFAA.ASSO.FR)

#+(OR)
(REGISTER-REVERSE
 (LAMBDA (BYTES)
   (AND (<= 184 (CAR BYTES) 191)
        (= 0 (COMPARE-NUMBER-LIST (CDR BYTES) '(23  37  84)))))
 (LAMBDA (BYTES)
   (FORMAT NIL "AFAA013680-~D.AFAA.ASSO.FR." (MOD (CAR BYTES) 8))))


;; Easynet est DNS secondaire pour afaa.asso.fr, mais pas pour
;; les autres domaines de l'AFAA qui ne sont pas souscrit via
;; easynet.  Pour cette raison, larissa.informatimago.com est
;; DNS secondaire pour tous les domaines AFAA, et ns.easynet.fr
;; est DNS secondaire seulement pour afaa.asso.fr:
(ADD-RECORD 'AFAA.ASSO.FR '(NS NS.EASYNET.FR))
(ADD-NAME 'NS.EASYNET.FR             '195.114.64.193)
(ADD-NAME 'LARISSA.INFORMATIMAGO.COM '62.93.174.78)



;; ========================================
;; prod.afaa.asso.fr est specialement fait pour dealcom.fr, la societe
;; qui a developpé le site web www.afaa.asso.fr, pour leur permetre
;; de gérer uniformement les sites de tous leurs clients (pour lesquels
;; ils gèrent également le DNS sauf AFAA).

(DEFINE-SOA '0.168.192.IN-ADDR.ARPA
    MASTER-PUBLIC-NAME HOSTMASTER SERIAL  REFRESH RETRY EXPIRE DEFAULT-TTL
    *BASE-DOMAIN*)

(ADD-RECORD            'PROD.AFAA.ASSO.FR  `(A 192.168.0.2))
(ADD-RECORD            'PROD.AFAA.ASSO.FR  '(MX 10 SMTP.DEALCOM.FR))



;; ----------------------------------------------------------------------
;; cultures-france.com
;; cultures-france.org
;; cultures-france.eu
;; cultures-france.fr
;; culturesfrance.com
;; culturesfrance.org
;; culturesfrance.eu
;; culturesfrance.fr
;; ----------------------------------------------------------------------

(DEFMACRO DO-CULTURES-FRANCE (DOMAIN-VAR &BODY BODY)
  `(DOLIST (,DOMAIN-VAR (COMBINE-NAMES '(CULTURESFRANCE CULTURES-FRANCE)
                                       '(.COM .ORG .EU .FR)))
     ,@BODY))


(DO-CULTURES-FRANCE DOMAIN
  (DEFINE-SOA DOMAIN
      MASTER-PUBLIC-NAME HOSTMASTER SERIAL  REFRESH RETRY EXPIRE DEFAULT-TTL
      *BASE-DOMAIN*))

(DEFMACRO DO-AFAA-AND-CULTURES-FRANCE (DOMAIN-VAR &BODY BODY)
  `(PROGN
     (DO-CULTURES-FRANCE ,DOMAIN-VAR ,@BODY)
     (LET ((,DOMAIN-VAR 'AFAA.ASSO.FR))
       ,@BODY)))



;; ----------------------------------------------------------------------
;; armenie-mon-amine.com
;; armenie-mon-amine.org
;; ----------------------------------------------------------------------

(DEFMACRO DO-ARMENIE (DOMAIN-VAR &BODY BODY)
  `(DOLIST (,DOMAIN-VAR (COMBINE-NAMES '(ARMENIE-MON-AMIE) '(.COM .ORG .FR)))
     ,@BODY))


(DO-ARMENIE DOMAIN
  (DEFINE-SOA DOMAIN
      MASTER-PUBLIC-NAME HOSTMASTER SERIAL  REFRESH RETRY EXPIRE DEFAULT-TTL
      *BASE-DOMAIN*))

;; ----------------------------------------------------------------------
;; bresilbresils.org
;; bresil-bresils.com
;; bresil-bresils.org
;; ----------------------------------------------------------------------

(DEFMACRO DO-BRESIL (DOMAIN-VAR &BODY BODY)
  `(DOLIST (,DOMAIN-VAR (CONS 'BRESILBRESILS.ORG
                              (COMBINE-NAMES '(BRESIL-BRESILS) '(.COM .ORG))))
     ,@BODY))


(DO-BRESIL DOMAIN
  (DEFINE-SOA DOMAIN
      MASTER-PUBLIC-NAME HOSTMASTER SERIAL  REFRESH RETRY EXPIRE DEFAULT-TTL
      *BASE-DOMAIN*))


;; ----------------------------------------------------------------------
;; etonnantelettonie.org
;; ----------------------------------------------------------------------

(DEFINE-SOA 'ETONNANTELETTONIE.ORG
    MASTER-PUBLIC-NAME HOSTMASTER SERIAL   REFRESH RETRY EXPIRE DEFAULT-TTL
    *BASE-DOMAIN*)


;;=======================================
;; Mobile IP Addresses
;;=======================================
;; These addresses can be taken over dynamically by the redundant servers.


;;=======================================
;; Serveurs publics de l'AFAA:
;;=======================================

(DEFPARAMETER AFAA
  ;;xxxxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx|
  '(LOCAL    ROUTER   ROUTER-VILLARS.FERRUS HERMES   CERBERE  HOST-133 HOST-134 JANUS
    GATEWAY  HOST-137 DNS0     DNS1     WEB0     WEB1     MAIL     FTP))

(DEFPARAMETER KLEBER
  ;;xxxxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx|
  '(LOCAL    ROUTER   MAINZ    LA-VENDEE FLEURUS EL-ARISH JAFFA    BROADCAST))
(DEFPARAMETER KLEBER-SERVICES
  '(()       ()      (SMTP MAIL) (WWW)  (FTP)    ()       (FIREWALL) ()))

;; FERRUS
(ADD-RECORD      'router-ferrus.ferrus.culturesfrance.com `(A 81.252.47.149))
(add-name       'router-villars.ferrus.culturesfrance.com '195.114.85.130)
(add-name 'router-villars.ferrus.intra.culturesfrance.com '10.0.10.130)
(add-name          'local.ferrus.intra.culturesfrance.com '10.130.0.0)
(add-name  'router-ferrus.ferrus.intra.culturesfrance.com '10.130.0.1)
(add-name      'broadcast.ferrus.intra.culturesfrance.com '10.130.255.255)


(DEFUN ADDRESS-OF-SERVER (NAME &OPTIONAL (PRIVATE PRIVATE))
  (if (eq name 'janus-1)
      (values (if private '10.0.0.145 '195.114.85.145))
      (VALUES
       (NAME-APPEND (IF PRIVATE '10.0.0 '195.114.85)
                    (+ 128 (POSITION NAME AFAA :TEST (FUNCTION STRING-EQUAL)))))))


(LOOP
   :FOR NAME      :IN AFAA
   :FOR PUBL-ADDR :IN (MAKE-ADDRESS-SEQ  "195.114.85.128" (LENGTH AFAA))
   :FOR PRIV-ADDR :IN (MAKE-ADDRESS-SEQ  "10.0.0.128"     (LENGTH AFAA))
   :DO (PROGN
         (ADD-NAME (NAME-APPEND NAME *BASE-DOMAIN*) PUBL-ADDR)
         (ADD-NAME (NAME-APPEND NAME *BASE-INTRA*)  PRIV-ADDR)
         (DO-AFAA-AND-CULTURES-FRANCE DOMAIN
           (ADD-RECORD (NAME-APPEND NAME        DOMAIN)  `(A ,PUBL-ADDR))
           (ADD-RECORD (NAME-APPEND NAME 'INTRA DOMAIN)  `(A ,PRIV-ADDR)))))

(LOOP
   :FOR NAME    :IN KLEBER
   :FOR ADDR    :IN (MAKE-ADDRESS-SEQ  "84.37.23.184" (LENGTH KLEBER))
   :FOR ALIASES :IN KLEBER-SERVICES
   :DO  (PROGN
          (ADD-NAME (NAME-APPEND NAME 'KLEBER *BASE-DOMAIN*) ADDR)
          (LET ((BYTES (ADDRESS-TO-BYTES ADDR)))
            (ADD-RECORD (FORMAT NIL "AFAA013680-~D.AFAA.ASSO.FR."
                                (MOD (CAR BYTES) 8))
                        `(CNAME ,(NAME-APPEND NAME 'KLEBER *BASE-DOMAIN*))))
          (DO-AFAA-AND-CULTURES-FRANCE DOMAIN
            (ADD-RECORD (NAME-APPEND NAME 'KLEBER DOMAIN)  `(A ,ADDR))
            (DOLIST (ALIAS ALIASES)
              (ADD-RECORD (NAME-APPEND ALIAS 'KLEBER DOMAIN)
                          `(CNAME ,(NAME-APPEND NAME 'KLEBER DOMAIN)))))))


(DOLIST (INTERVAL '((176 191) (208 240) (242 254)))
  (MAPCAR (LAMBDA (NAME ADDR)
            (ADD-NAME (NAME-APPEND NAME *BASE-DOMAIN*) ADDR)
            (DO-AFAA-AND-CULTURES-FRANCE DOMAIN
              (ADD-RECORD (NAME-APPEND NAME DOMAIN) ADDR)))
          (MAKE-NAME-SEQ "host-~3,'0D" (FIRST INTERVAL) (SECOND INTERVAL))
          (MAKE-ADDRESS-SEQ (FORMAT NIL "195.114.85.~D" (FIRST INTERVAL))
                            (- (SECOND INTERVAL) (FIRST INTERVAL) -1))))


(ADD-NAME   (NAME-APPEND 'LOCALHOST *BASE*)        "127.0.0.1")
(ADD-RECORD (NAME-APPEND 'LOCALHOST *BASE-DOMAIN*) `(A "127.0.0.1"))
(ADD-RECORD (NAME-APPEND 'LOCALHOST *BASE-INTRA*)  `(A "127.0.0.1"))
(ADD-NAME   (NAME-APPEND 'BROADCAST *BASE-DOMAIN*) "195.114.85.255")
(ADD-NAME   (NAME-APPEND 'BROADCAST *BASE-INTRA*)  "10.255.255.255")
(DO-AFAA-AND-CULTURES-FRANCE DOMAIN
  (ADD-RECORD (NAME-APPEND 'LOCALHOST        DOMAIN) `(A "127.0.0.1"))
  (ADD-RECORD (NAME-APPEND 'LOCALHOST 'INTRA DOMAIN)  `(A "127.0.0.1"))
  (ADD-RECORD (NAME-APPEND 'BROADCAST        DOMAIN) `(A "195.114.85.255"))
  (ADD-RECORD (NAME-APPEND 'BROADCAST 'INTRA DOMAIN) `(A "10.255.255.255")))


;;=======================================
;; Aliases
;;=======================================

(DO-AFAA-AND-CULTURES-FRANCE DOMAIN
  (ADD-RECORD (NAME-APPEND          'AFAA-GW DOMAIN) `(CNAME ,(NAME-APPEND 'ROUTER DOMAIN)))
  (ADD-RECORD (NAME-APPEND          'ROUTEUR DOMAIN) `(CNAME ,(NAME-APPEND 'ROUTER DOMAIN)))
  (ADD-RECORD (NAME-APPEND              'CVS DOMAIN) `(CNAME ,(NAME-APPEND 'JANUS-1.JANUS DOMAIN)))
  (ADD-RECORD (NAME-APPEND       'BLOG.INTRA DOMAIN) `(CNAME ,(NAME-APPEND 'WEB1    DOMAIN)))
  (ADD-RECORD (NAME-APPEND              'NTP DOMAIN) `(CNAME ,(NAME-APPEND 'GATEWAY DOMAIN)))
  (ADD-RECORD (NAME-APPEND            'PROXY DOMAIN) `(CNAME ,(NAME-APPEND 'GATEWAY DOMAIN)))
  (ADD-RECORD (NAME-APPEND              'IRC DOMAIN) `(CNAME ,(NAME-APPEND 'JANUS-4 DOMAIN)))
  (ADD-RECORD (NAME-APPEND        'IRC.INTRA DOMAIN) `(CNAME ,(NAME-APPEND 'JANUS-4.INTRA DOMAIN)))
  (ADD-RECORD (NAME-APPEND   'VACATION.INTRA DOMAIN) `(CNAME ,(NAME-APPEND 'WEB0.INTRA    DOMAIN))))


;; ========================================
;; Aliases sous forme d'adresses
;; ========================================

;; pinaud est un "alias" pour hermes pour accès via ssh
(DO-AFAA-AND-CULTURES-FRANCE DOMAIN
  (ADD-RECORD (NAME-APPEND 'PINAUD DOMAIN) `(A ,(ADDRESS-OF-SERVER 'GATEWAY))))


(LET ((MAIL   (ADDRESS-OF-SERVER 'MAIL))
      (j1     (ADDRESS-OF-SERVER 'janus-1))
      (WEB0   (ADDRESS-OF-SERVER 'WEB0))
      (WEB1   (ADDRESS-OF-SERVER 'WEB1)))
  (DO-AFAA-AND-CULTURES-FRANCE DOMAIN
    ;; Il semble qu'il y ait certaines difficultés à mettre ceux ci en CNAME:
    (ADD-RECORD (NAME-APPEND 'MAIL DOMAIN)  `(A ,MAIL))
    (ADD-RECORD (NAME-APPEND 'SMTP DOMAIN)  `(A ,MAIL))
    (ADD-RECORD (NAME-APPEND 'IMAP DOMAIN)  `(A ,MAIL))
    (ADD-RECORD (NAME-APPEND  'POP DOMAIN)  `(A ,MAIL))
    ;; Le serveur web public culturesfrance.com
    ;; est dirigé vers   www.culturesfrance.com, etc.
    (ADD-RECORD                                     DOMAIN  `(A ,WEB1))
    (ADD-RECORD (NAME-APPEND                   'WWW DOMAIN) `(A ,WEB1))
    (ADD-RECORD (NAME-APPEND                   'PRE DOMAIN) `(A ,WEB1))
    (ADD-RECORD (NAME-APPEND                 'JANUS DOMAIN) `(A ,WEB0))
    (ADD-RECORD (NAME-APPEND              'INTRAWEB DOMAIN) `(A ,j1))
    (ADD-RECORD (NAME-APPEND                 'SWIKI DOMAIN) `(A ,j1))
    (ADD-RECORD (NAME-APPEND           'SWIKI.INTRA DOMAIN) `(A ,j1))
    (ADD-RECORD (NAME-APPEND              'AFRICART DOMAIN) `(A ,WEB0))
    (ADD-RECORD (NAME-APPEND       'ENVERSDESVILLES DOMAIN) `(A ,WEB0))
    (ADD-RECORD (NAME-APPEND   'WWW.ENVERSDESVILLES DOMAIN) `(A ,WEB0))
    (ADD-RECORD (NAME-APPEND   'PRE.ENVERSDESVILLES DOMAIN) `(A ,WEB0))
    (ADD-RECORD (NAME-APPEND         'BOHEMIAMAGICA DOMAIN) `(A ,WEB0))
    (ADD-RECORD (NAME-APPEND     'WWW.BOHEMIAMAGICA DOMAIN) `(A ,WEB0))
    (ADD-RECORD (NAME-APPEND            'NOVAPOLSKA DOMAIN) `(A ,WEB0))
    (ADD-RECORD (NAME-APPEND        'WWW.NOVAPOLSKA DOMAIN) `(A ,WEB0))
    (ADD-RECORD (NAME-APPEND     'etonnantelettonie DOMAIN) `(A ,WEB0))
    (ADD-RECORD (NAME-APPEND 'www.etonnantelettonie DOMAIN) `(A ,WEB0))
    ;; SOA of artiste-residences.org is not us...
    (ADD-RECORD  (NAME-APPEND 'ARTISTE-RESIDENCES DOMAIN)  `(A ,WEB0)))

  (ADD-RECORD            'ETONNANTELETTONIE.ORG  `(A ,WEB0))
  (ADD-RECORD        'WWW.ETONNANTELETTONIE.ORG  `(A ,WEB0))
  (ADD-RECORD        'PRE.ETONNANTELETTONIE.ORG  `(A ,WEB0))

  (ADD-RECORD            'BRESIL-BRESILS.ORG     `(A ,WEB0))
  (ADD-RECORD        'WWW.BRESIL-BRESILS.ORG     `(A 213.186.33.18))
  (ADD-RECORD            'BRESIL-BRESILS.COM     `(A ,WEB0))
  (ADD-RECORD        'WWW.BRESIL-BRESILS.COM     `(A ,WEB0))
  (ADD-RECORD             'BRESILBRESILS.ORG     `(A ,WEB0))
  (ADD-RECORD         'WWW.BRESILBRESILS.ORG     `(A ,WEB0))

  (DO-ARMENIE DOMAIN
    (ADD-RECORD  (NAME-APPEND 'PRE DOMAIN) `(A ,WEB1))
    (ADD-RECORD  (NAME-APPEND 'WWW DOMAIN) `(A ,WEB1))
    (ADD-RECORD  DOMAIN                    `(A ,WEB1))))


;; ----------------------------------------------------------------------
;; Cluster janus:
;; ----------------------------------------------------------------------

(DEFINE-SOA '144.168.192.IN-ADDR.ARPA
    MASTER-PUBLIC-NAME HOSTMASTER SERIAL   REFRESH RETRY EXPIRE DEFAULT-TTL
    (NAME-APPEND 'INFRA *BASE-DOMAIN*))

(ADD-NAME (NAME-APPEND 'JANUS.INFRA *BASE-DOMAIN*) '192.168.144.0)


;; The new names:
(LOOP :FOR I :BELOW 32 :DO
   (LET ((B (+ 144 I))
         (J (1+ (TRUNCATE I 8)))
         (V (IF (ZEROP (MOD I 8))
                ""
                (CODE-CHAR (+ (CHAR-CODE #\A) (1- (MOD I 8))))))
         (A *BASE-DOMAIN*))
     (ADD-NAME (FORMAT NIL "janus-~D~A.~A"       J V A)
               (FORMAT NIL "195.114.85.~D"  B))
     (ADD-NAME (FORMAT NIL "janus-~D~A.intra.~A" J V A)
               (FORMAT NIL "10.0.0.~D"      B))
     (ADD-NAME (FORMAT NIL "janus-~D~A.infra.~A" J V A)
               (FORMAT NIL "192.168.144.~D" B))
     (DO-AFAA-AND-CULTURES-FRANCE DOMAIN
       (ADD-RECORD (FORMAT NIL "janus-~D~A.~A"       J V DOMAIN)
                   `(A ,(FORMAT NIL "195.114.85.~D"  B)))
       (ADD-RECORD (FORMAT NIL "janus-~D~A.intra.~A" J V DOMAIN)
                   `(A ,(FORMAT NIL "10.0.0.~D"      B)))
       (ADD-RECORD (FORMAT NIL "janus-~D~A.infra.~A" J V DOMAIN)
                   `(A ,(FORMAT NIL "192.168.144.~D" B))) )))


;; Temporarily we keep these janus-?.janus names:
(LOOP
   :FOR J :FROM 1 :TO 4
   :FOR B :FROM 144 :BY 8
   :DO
   (DO-AFAA-AND-CULTURES-FRANCE DOMAIN
     (ADD-RECORD (FORMAT NIL "janus-~D~A.~A"       J ".janus" DOMAIN)
                 `(A ,(FORMAT NIL "195.114.85.~D"  B)))
     (ADD-RECORD (FORMAT NIL "janus-~D~A.intra.~A" J ".janus"  DOMAIN)
                 `(A ,(FORMAT NIL "10.0.0.~D"      B)))
     (ADD-RECORD (FORMAT NIL "janus-~D~A.infra.~A" J ".janus"  DOMAIN)
                 `(A ,(FORMAT NIL "192.168.144.~D" B))) ))


;; ----------------------------------------------------------------------
;; Intranet:
;; ----------------------------------------------------------------------

(LOOP :FOR DOMAIN :IN  '( 0.0.10.IN-ADDR.ARPA ; servers
                         1.0.10.IN-ADDR.ARPA  ; fixed pjb
                         10.10.10.IN-ADDR.ARPA ; infra.afaa.asso.fr (HUBS & SWITCHES)

                         0.64.10.IN-ADDR.ARPA ; fixed compta
                         1.64.10.IN-ADDR.ARPA ; fixed mz

                         81.64.10.IN-ADDR.ARPA ; dhcp janus-1
                         82.64.10.IN-ADDR.ARPA ; dhcp janus-2
                         83.64.10.IN-ADDR.ARPA ; dhcp janus-3
                         84.64.10.IN-ADDR.ARPA ; dhcp janus-4

                         128.64.10.IN-ADDR.ARPA ; excl

                         0.127.10.IN-ADDR.ARPA ; old excl

                         0.128.10.IN-ADDR.ARPA ; old dhcp
                         1.128.10.IN-ADDR.ARPA ; old dhcp
                         2.128.10.IN-ADDR.ARPA ; old dhcp
                         3.128.10.IN-ADDR.ARPA ; old dhcp
                         4.128.10.IN-ADDR.ARPA ; old dhcp

                         129.10.IN-ADDR.ARPA ; kleber
                         130.10.IN-ADDR.ARPA ; ferrus

                         )
   :DO (DEFINE-SOA DOMAIN MASTER-PUBLIC-NAME
         HOSTMASTER SERIAL  REFRESH RETRY EXPIRE DEFAULT-TTL
         *BASE-INTRA*))


;; TODO: perhaps it's the other way: we must allow update
;;       of intra.culturesfrance.com from these IPs?
(LOOP
   :FOR DOMAIN :IN  '(81.64.10.IN-ADDR.ARPA
                      82.64.10.IN-ADDR.ARPA
                      83.64.10.IN-ADDR.ARPA
                      84.64.10.IN-ADDR.ARPA)
   :DO (SETF (DOMAIN-ALLOW-UPDATE
              (DOMAIN-SUBDOMAIN-AT-PATH *DOMAINS* (FQDN-TO-PATH DOMAIN)))
             `(,(ADDRESS-OF-SERVER 'DNS0) ,(ADDRESS-OF-SERVER 'DNS1)
                195.114.85.144  195.114.85.152  195.114.85.160   195.114.85.168
                195.114.85.145  195.114.85.153  195.114.85.161   195.114.85.169
                192.168.144.144 192.168.144.152 192.168.144.160  192.168.144.168
                192.168.144.145 192.168.144.153 192.168.144.161  192.168.144.169
                10.0.0.144      10.0.0.152      10.0.0.160       10.0.0.168
                10.0.0.145      10.0.0.153      10.0.0.161       10.0.0.169
                10.64.80/20 )))

(LOOP
   :FOR N :IN '((COMPTA 10 64 0)  (MZ     10 64 1)
                (DHCP-1 10 64 81) (DHCP-2 10 64 82)
                (DHCP-3 10 64 83) (DHCP-4 10 64 84)
                (EXCL   10 64 128))
   :DO (LOOP
          :FOR I :FROM 0 :TO 255
          :DO (ADD-NAME (NAME-APPEND (FORMAT NIL "POSTE-~3,'0D" I)
                                     (FIRST N)
                                     *BASE-INTRA*)
                        (FORMAT NIL "~{~D.~}~D" (REST N) I))))


;; visiteurs:
(ADD-NAME (NAME-APPEND 'JALAL *BASE-INTRA*)  '10.0.1.230)

;; bad-users:
(ADD-NAME (NAME-APPEND  'BDO.EXCL *BASE-DOMAIN*)  '10.64.128.1)

;; Serveurs Intranet:
(ADD-NAME (NAME-APPEND              'HERMES *BASE-INTRA*)  '10.0.0.131)
(ADD-NAME (NAME-APPEND              'THALES *BASE-INTRA*)  '10.0.0.211)
(ADD-NAME (NAME-APPEND             'SOCRATE *BASE-INTRA*)  '10.0.0.212)
(ADD-NAME (NAME-APPEND              'PLATON *BASE-INTRA*)  '10.0.0.213)
(ADD-NAME (NAME-APPEND          'ALEXANDRIE *BASE-INTRA*)  '10.0.0.214)
(ADD-NAME (NAME-APPEND              'SIRIUS *BASE-INTRA*)  '10.0.0.215)
(ADD-NAME (NAME-APPEND           'PYTHAGORE *BASE-INTRA*)  '10.0.0.216)

;; Imprimantes Intranet:
(ADD-NAME (NAME-APPEND      'LJ3500.IMPRIME *BASE-INTRA*)  '10.0.0.251)
(ADD-NAME (NAME-APPEND 'PUBLICATION.IMPRIME *BASE-INTRA*)  '10.0.0.252)
(ADD-NAME (NAME-APPEND   'DOCUCOLOR.IMPRIME *BASE-INTRA*)  '10.0.0.253)


(DO-AFAA-AND-CULTURES-FRANCE DOMAIN
  ;; visiteurs:
  (ADD-RECORD (NAME-APPEND               'JALAL DOMAIN)  `(A 10.0.1.230))

  ;; bad-users:
  (ADD-RECORD (NAME-APPEND            'BDO.EXCL DOMAIN)  `(A 10.64.128.1))

  ;; servers:
  (ADD-RECORD (NAME-APPEND              'HERMES DOMAIN)  `(A 10.0.0.131))
  (ADD-RECORD (NAME-APPEND              'THALES DOMAIN)  `(A 10.0.0.211))
  (ADD-RECORD (NAME-APPEND             'SOCRATE DOMAIN)  `(A 10.0.0.212))
  (ADD-RECORD (NAME-APPEND              'PLATON DOMAIN)  `(A 10.0.0.213))
  (ADD-RECORD (NAME-APPEND          'ALEXANDRIE DOMAIN)  `(A 10.0.0.214))
  (ADD-RECORD (NAME-APPEND              'SIRIUS DOMAIN)  `(A 10.0.0.215))
  (ADD-RECORD (NAME-APPEND           'PYTHAGORE DOMAIN)  `(A 10.0.0.216))

  ;; Printers:
  (ADD-RECORD (NAME-APPEND      'LJ3500.IMPRIME DOMAIN)  '10.0.0.251)
  (ADD-RECORD (NAME-APPEND 'PUBLICATION.IMPRIME DOMAIN)  '10.0.0.252)
  (ADD-RECORD (NAME-APPEND   'DOCUCOLOR.IMPRIME DOMAIN)  '10.0.0.253))


;; noms donnés par MZ:
(MAPCAR (LAMBDA (NAME ADDR) (ADD-NAME (NAME-APPEND NAME *BASE-INTRA*) ADDR))
        (MAKE-NAME-SEQ     "mz-~3,'0D" 0 255)
        (MAKE-ADDRESS-SEQ  "10.64.0.0" 256))


(LET ((MAIL   (ADDRESS-OF-SERVER 'MAIL :INTRA))
      ;; (web0   (address-of-server 'web0 :intra))
      ;; (web1   (address-of-server 'web1 :intra))
      )
  (DO-AFAA-AND-CULTURES-FRANCE DOMAIN
    ;; "aliases"
    (ADD-RECORD (NAME-APPEND 'MAIL.INTRA DOMAIN)  `(A ,MAIL))
    (ADD-RECORD (NAME-APPEND 'SMTP.INTRA DOMAIN)  `(A ,MAIL))
    (ADD-RECORD (NAME-APPEND 'IMAP.INTRA DOMAIN)  `(A ,MAIL))
    (ADD-RECORD (NAME-APPEND  'POP.INTRA DOMAIN)  `(A ,MAIL))
    (ADD-RECORD (NAME-APPEND  'WWW.INTRA DOMAIN)
                `(CNAME  ,(NAME-APPEND 'WEB0.INTRA DOMAIN)))
    (ADD-RECORD (NAME-APPEND  'RESSOURCES.INTRA DOMAIN)
                `(CNAME ,(NAME-APPEND 'ALEXANDRIE.INTRA DOMAIN)))
    (ADD-RECORD (NAME-APPEND  'RESSOURCES DOMAIN)
                `(CNAME ,(NAME-APPEND 'ALEXANDRIE.INTRA DOMAIN)))

    (ADD-RECORD (NAME-APPEND          'LDAP.INTRA DOMAIN)
                `(CNAME ,(NAME-APPEND 'JANUS-1.JANUS.INTRA DOMAIN)))

    (ADD-RECORD (NAME-APPEND   'MYSQL.JANUS.INFRA DOMAIN)
                `(CNAME ,(NAME-APPEND 'JANUS-2.INFRA DOMAIN)))

    (ADD-RECORD (NAME-APPEND 'MYSQL-4.JANUS.INFRA DOMAIN)
                `(CNAME ,(NAME-APPEND 'JANUS-4.INFRA DOMAIN)))))


;; ----------------------------------------------------------------------
;; Comptabilité
;; ----------------------------------------------------------------------
;; ALLOCATION MANUELLE PAR MARC ZORICH


(MAPCAR (LAMBDA (NAME ADDR)  (ADD-NAME (NAME-APPEND NAME 'COMPTA *BASE-INTRA*) ADDR))
        (MAKE-NAME-SEQ     "c-~3,'0D" 0 127)
        (MAKE-ADDRESS-SEQ  "10.64.1.0" 128))

(MAPCAR (LAMBDA (NAME ADDR)  (ADD-NAME (NAME-APPEND NAME 'COMPTA *BASE-INTRA*) ADDR))
        '(AF  CAM  CMP  HK  JPD  LD  MZ  PB  TVP  PL  SA)
        (MAKE-ADDRESS-SEQ  "10.64.1.128" 128))


;; ----------------------------------------------------------------------
;; Informatimago:
;; ----------------------------------------------------------------------

(DO-AFAA-AND-CULTURES-FRANCE DOMAIN
  (ADD-RECORD (NAME-APPEND 'INFORMATIMAGO DOMAIN)  `(A 62.93.174.78))
  (ADD-RECORD (NAME-APPEND 'INTERGRUAS    DOMAIN)  `(A 62.93.173.252)))

(DEFPARAMETER BASE-LAN.INFORMATIMAGO.COM   '195.114.85.192)
(DEFPARAMETER DOMAIN-LAN.INFORMATIMAGO.COM 'LAN.INFORMATIMAGO.COM)
(DEFPARAMETER NAMES-LAN.INFORMATIMAGO.COM
  '(LOCAL
    NAIAD  GALATEA DESPINA NEREIDE   LARISSA    THALASSA PROTEUS
    TRITON KUIPER  LASSELL VOYAGER-2 LE-VERRIER GALLE    HUBBLE
    BROADCAST ))

(LET ((BASE      BASE-LAN.INFORMATIMAGO.COM)
      (NAMES    NAMES-LAN.INFORMATIMAGO.COM)
      (DOMAIN  DOMAIN-LAN.INFORMATIMAGO.COM))
  (MAP NIL (LAMBDA (NAME ADDRESS)
             (ADD-NAME (NAME-APPEND NAME DOMAIN) ADDRESS))
       NAMES
       (MAKE-ADDRESS-SEQ BASE (LENGTH NAMES))))


;; ----------------------------------------------------------------------
;; infrastructure
;; ----------------------------------------------------------------------

(DO-AFAA-AND-CULTURES-FRANCE DOMAIN
  (ADD-NAME (NAME-APPEND 'ZEUS.INFRA DOMAIN) '195.114.85.241)

  (ADD-NAME (NAME-APPEND 'SWITCH-B-0.INFRA DOMAIN) '10.10.10.0) ;; inexistant
  (ADD-NAME (NAME-APPEND 'SWITCH-B-1.INFRA DOMAIN) '10.10.10.1) ;; Switch 9300
  (ADD-NAME (NAME-APPEND 'SWITCH-B-2.INFRA DOMAIN) '10.10.10.2) ;; Switch 3300
  (ADD-NAME (NAME-APPEND 'SWITCH-B-3.INFRA DOMAIN) '10.10.10.3) ;; Switch 3300
  (ADD-NAME (NAME-APPEND 'SWITCH-B-4.INFRA DOMAIN) '10.10.10.4) ;; Switch 3300
  (ADD-NAME (NAME-APPEND 'SWITCH-B-5.INFRA DOMAIN) '10.10.10.5) ;; inexistant
  (ADD-NAME (NAME-APPEND 'SWITCH-B-6.INFRA DOMAIN) '10.10.10.6) ;; PS Hub 40
  (ADD-NAME (NAME-APPEND 'SWITCH-B-7.INFRA DOMAIN) '10.10.10.7) ;; inexistant
  (ADD-NAME (NAME-APPEND 'SWITCH-B-8.INFRA DOMAIN) '10.10.10.8) ;; inexistant
  (ADD-NAME (NAME-APPEND 'SWITCH-B-9.INFRA DOMAIN) '10.10.10.9) ;; inexistant

  (ADD-NAME (NAME-APPEND 'SWITCH-A-0.INFRA DOMAIN) '10.10.10.10) ;; inexistant?
  (ADD-NAME (NAME-APPEND 'SWITCH-A-1.INFRA DOMAIN) '10.10.10.11) ;; Switch 3300
  (ADD-NAME (NAME-APPEND 'SWITCH-A-2.INFRA DOMAIN) '10.10.10.12) ;; Switch 3300
  (ADD-NAME (NAME-APPEND 'SWITCH-A-3.INFRA DOMAIN) '10.10.10.13)
  (ADD-NAME (NAME-APPEND 'SWITCH-A-4.INFRA DOMAIN) '10.10.10.14)
  (ADD-NAME (NAME-APPEND 'SWITCH-A-5.INFRA DOMAIN) '10.10.10.15)
  (ADD-NAME (NAME-APPEND 'SWITCH-A-6.INFRA DOMAIN) '10.10.10.16)
  (ADD-NAME (NAME-APPEND 'SWITCH-A-7.INFRA DOMAIN) '10.10.10.17)
  (ADD-NAME (NAME-APPEND 'SWITCH-A-8.INFRA DOMAIN) '10.10.10.18)
  (ADD-NAME (NAME-APPEND 'SWITCH-A-9.INFRA DOMAIN) '10.10.10.19))




;; ----------------------------------------------------------------------
;; VPN
;; ----------------------------------------------------------------------

;; (dotimes (i 16) (format t "~4D" (* i 16)))
;;   0  16  32  48  64  80  96 112 128 144 160 176 192 208 224 240

;; Addresses des points PPP locaux vers les reseaux indiques.
;; 192.168.0.r <--PPP--> 192.168.r.1 <--eth--> 192.168.r.0/24

;; 192.168.0.x                dealcom
;; 192.168.n.x   1<=n<=32     hyacinte
;; 192.168.127.n              local  vpn point
;; 192.168.n.x   128<=n<=255  remote vpn 128

;; 192.168.144.x              janus.infra.afaa.asso.fr
;; 192.168.164.x              wifi.informatimago.com

;; (ADD-NAME 'AFAA.VPN.AFAA.ASSO.FR '192.168.0.1) ;; --> 192.168.1.0/24
;; (ADD-NAME  'PJB.VPN.AFAA.ASSO.FR '192.168.0.2) ;; --> 192.168.2.0/24
;; (ADD-NAME   'AR.VPN.AFAA.ASSO.FR '192.168.0.3) ;; --> 192.168.3.0/24
;; (ADD-NAME  'GDR.VPN.AFAA.ASSO.FR '192.168.0.4) ;; --> 192.168.4.0/24
;; (ADD-NAME  'ADR.VPN.AFAA.ASSO.FR '192.168.0.5) ;; --> 192.168.5.0/24
;; (ADD-NAME  'FRS.VPN.AFAA.ASSO.FR '192.168.0.6) ;; --> 192.168.6.0/24




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

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


;; ----------------------------------------------------------------------
;; That's all folks.
;; ----------------------------------------------------------------------
;; Local Variables:
;; eval: (mapcar (lambda (s) (put (intern (upcase (symbol-name s))) 'lisp-indent-function 1) (put (intern (downcase (symbol-name s))) 'lisp-indent-function 1)) '(DO-AFAA-AND-CULTURES-FRANCE DO-CULTURES-FRANCE DO-ARMENIE DO-BRESIL))
;; End:
ViewGit