Index: /branches/stable/cgi-bin/extras/db2rwhois.pl
===================================================================
--- /branches/stable/cgi-bin/extras/db2rwhois.pl	(revision 324)
+++ /branches/stable/cgi-bin/extras/db2rwhois.pl	(revision 325)
@@ -28,4 +28,5 @@
 
 my @masterblocks;
+my %netnameprefix;
 
 # Fill in data about our master blocks as allocated from ARIN
@@ -33,5 +34,5 @@
 # Note that this ASS-U-MEs that we do not add master IP blocks-
 # there should probably be a separate system for doing that.
-my $sth = $dbh->prepare("select cidr,ctime from masterblocks;");
+my $sth = $dbh->prepare("select cidr,ctime,mtime from masterblocks;");
 $sth->execute;
 my $i=0;
@@ -45,6 +46,6 @@
   $masterblocks[$i] = new NetAddr::IP $data[0];
   my ($ctime,undef) = split /\s/, $data[1];
-
-print "$masterblocks[$i] $data[1]\n";
+  my ($mtime,undef) = split /\s/, $data[2];
+print "$masterblocks[$i] $ctime $mtime\n";
 
   my $date;
@@ -64,10 +65,13 @@
 	"IP-Network: $masterblocks[$i]\n".
 	"IP-Network-Block: ".$masterblocks[$i]->range."\n".
-	"Organization: Friendly ISP\n".
-	"Tech-Contact: noc\@example.com\n".
-	"Admin-Contact: ISP-ARIN-HANDLE\n".
-	"Abuse-Contact: abuse\@example.com\n".
+	"Org-Name: Friendly ISP\n".
+	"Street-Address: 123 4th Street\n".
+	"City: Anytown\n".
+	"StateProv: Ontario\n".
+	"Postal-Code: H0H 0H0\n".
+	"Country-Code: CA\n".
+	"Tech-Contact: ISP-ARIN-HANDLE\n".
 	"Created: $ctime\n".
-	"Updated: $date\n".
+	"Updated: $mtime\n".
 	"Updated-By: noc\@example.com\n";
 
@@ -76,4 +80,11 @@
 }
 
+# prefetch alloctype data
+$sth = $dbh->prepare("select type,def_custid,arin_netname from alloctypes where listorder <500");
+$sth->execute;
+while (my @data = $sth->fetchrow_array) {
+  $netnameprefix{$data[0]} = $data[2];
+}
+
 # Now read out the data in the "main" delegation list, and check it
 # with the master blocks.  We need to do this to decide which rWHOIS
@@ -83,5 +94,5 @@
 # No use or point in broadcasting our use of them.
 # Also remove the details of our "reserved CORE/WAN" blocks;  they're not critical.
-$sth = $dbh->prepare("select cidr,custid,type,city,description,createstamp,modifystamp ".
+$sth = $dbh->prepare("select cidr,custid,type,city,description,createstamp,modifystamp,swip ".
 	"from allocations where ".
 	"not (cidr <<= '192.168.0.0/16') and ".
@@ -93,6 +104,8 @@
 $sth->execute;
 
+my $custsth = $dbh->prepare("select name,street,city,province,country,pocode,phone,tech_handle,special from customers where custid=?");
+
 $i=0;
-while (my ($cidr, $custid, $type, $city, $desc, $ctime, $mtime) = $sth->fetchrow_array) {
+while (my ($cidr, $custid, $type, $city, $desc, $ctime, $mtime, $swip) = $sth->fetchrow_array) {
 
 # We get master block info from @masterblocks.
@@ -134,18 +147,67 @@
       ($mtime) = ($mtime =~ /^(\d+-\d+-\d+)\s+/);
 
-      print MASTERFILE "---\nID: NETBLK-ISP.$master\n".
-  	"Auth-Area: $master\n".
-	"Network-Name: ISP-".$net->network."\n".
-	"IP-Network: $net\n".
-	"IP-Network-Block: ".$net->range."\n".
-	"Organization: $desc\n".
-#	"Tech-Contact: $data[9]\n".
-	"Tech-Contact: abuse\@example.com\n".
-	"Admin-Contact: ISP-ARIN-HANDLE\n".
-	"Created: $ctime\n".
-	"Updated: $mtime\n".
-	"Updated-By: noc\@example.com\n";
-    }
-  }
+# Notes:
+# Network-name should contain some component of "description"
+# Cust address/contact data should be included;  NB, no phone for ARIN!
+#  network:ID: NET-WIDGET
+#  network:Network-Name: WIDGET			[IPDB description, sort of]
+#  network:IP-Network: 10.1.1.0/24
+#  network:Org-Name: Widget Corp		[Cust name;  from billing?]
+#  network:Street-Address: 211 Oak Drive	[May need more than one line, OR...]
+#  network:City: Pineville			[...this line...]
+#  network:StateProv: WI			[...and this line...]
+#  network:Postal-Code: 48888			[...and this line]
+#  network:Country-Code: US
+#  network:Tech-Contact: BZ142-MYRWHOIS		[ARIN handle?]
+#  network:Updated: 19991221			[timestamp from db]
+#  network:Updated-By: jo@myrwhois.net		[noc@example, since that's our POC for IP netspace issues]
+#  network:Class-Name:network			[Provided by rWHOIS protocol]
+
+      my $netname = $netnameprefix{$type};
+
+      if ($swip eq 'n') {
+        print MASTERFILE "---\nID: NETBLK-ISP.$master\n".
+  		"Auth-Area: $master\n".
+		"Network-Name: $netname-".$net->network."\n".
+		"IP-Network: $net\n".
+		"IP-Network-Block: ".$net->range."\n".
+		"Org-Name: Friendly ISP\n".
+		"Street-Address: 123 4th Street\n".
+		"City: Anytown\n".
+		"StateProv: Ontario\n".
+		"Postal-Code: H0H 0H0\n".
+		"Country-Code: CA\n".
+		"Tech-Contact: ISP-ARIN-HANDLE\n".
+		"Created: $ctime\n".
+		"Updated: $mtime\n".
+		"Updated-By: noc\@example.com\n";
+      } else {
+        $custsth->execute($custid);
+        my ($name, $street, $city, $prov, $country, $pocode, $phone, $tech, $special) = $custsth->fetchrow_array;
+        $custsth->finish;
+	if ($special && $special =~ /NetName/ && $special =~ /$cidr/) {
+	  ($netname) = ($special =~ /NetName$cidr: ([A-Z0-9_-]+)/);
+	} else {
+	  $netname .= "-".$net->network;
+	}
+	print MASTERFILE "---\nID: NETBLK-ISP.$master\n".
+	  	"Auth-Area: $master\n".
+		"Network-Name: $netname\n".
+		"IP-Network: $net\n".
+		"IP-Network-Block: ".$net->range."\n".
+		"Org-Name: $name\n".
+		"Street-Address: $street\n".
+		"City: $city\n".
+		"StateProv: $prov\n".
+		"Postal-Code: $pocode\n".
+		"Country-Code: $country\n".
+		"Tech-Contact: $tech\n".
+		"Created: $ctime\n".
+		"Updated: $mtime\n".
+		"Updated-By: noc\@example.com\n";
+      } # swip
+
+    } # net in master
+  } # foreach master
 
 
Index: /branches/stable/cgi-bin/extras/network.tmpl
===================================================================
--- /branches/stable/cgi-bin/extras/network.tmpl	(revision 325)
+++ /branches/stable/cgi-bin/extras/network.tmpl	(revision 325)
@@ -0,0 +1,306 @@
+attribute:       Network-Name
+attribute-alias: NN
+description:     Network name
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           EXACT
+type:            TEXT
+---
+attribute:       IP-Network
+attribute-alias: IPN
+description:     IP network in CIDR notation
+is-primary-key:  TRUE
+is-required:     TRUE
+is-repeatable:   TRUE
+is-multi-line:   FALSE
+is-hierarchical: TRUE
+index:           CIDR
+type:            TEXT
+---
+attribute:       IP-Network-Block
+attribute-alias: IPNB
+description:     IP address range
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       Org-Name
+attribute-alias: ORG
+description:     Organization
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       Street-Address
+attribute-alias: SA
+description:     Street address
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       City
+attribute-alias: CITY
+description:     City
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       StateProv
+attribute-alias: SP
+description:     State or province
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       Postal-Code
+attribute-alias: ZIP
+description:     ZIP or postal code
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       Country-Code
+attribute-alias: CC
+description:     Two-letter country code
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       Admin-Contact
+attribute-alias: AC
+description:     Administrative contact
+is-primary-key:  FALSE
+is-required:     FALSE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            ID
+---
+attribute:       Tech-Contact
+attribute-alias: TC
+description:     Technical contact
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            ID
+---
+attribute:       Abuse-Contact
+attribute-alias: NA
+description:     Network Abuse contact
+is-primary-key:  FALSE
+is-required:     FALSE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            ID
+---
+attribute:       Created
+attribute-alias: CR
+description:     Creation date
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       Updated-By
+attribute-alias: UB
+description:     Updated by
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+attribute:       Network-Name
+attribute-alias: NN
+description:     Network name
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           EXACT
+type:            TEXT
+---
+attribute:       IP-Network
+attribute-alias: IPN
+description:     IP network in CIDR notation
+is-primary-key:  TRUE
+is-required:     TRUE
+is-repeatable:   TRUE
+is-multi-line:   FALSE
+is-hierarchical: TRUE
+index:           CIDR
+type:            TEXT
+---
+attribute:       IP-Network-Block
+attribute-alias: IPNB
+description:     IP address range
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       Org-Name
+attribute-alias: ORG
+description:     Organization
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       Street-Address
+attribute-alias: SA
+description:     Street address
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       City
+attribute-alias: CITY
+description:     City
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       StateProv
+attribute-alias: SP
+description:     State or province
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       Postal-Code
+attribute-alias: ZIP
+description:     ZIP or postal code
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       Country-Code
+attribute-alias: CC
+description:     Two-letter country code
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       Admin-Contact
+attribute-alias: AC
+description:     Administrative contact
+is-primary-key:  FALSE
+is-required:     FALSE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            ID
+---
+attribute:       Tech-Contact
+attribute-alias: TC
+description:     Technical contact
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            ID
+---
+attribute:       Abuse-Contact
+attribute-alias: NA
+description:     Network Abuse contact
+is-primary-key:  FALSE
+is-required:     FALSE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            ID
+---
+attribute:       Created
+attribute-alias: CR
+description:     Creation date
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
+---
+attribute:       Updated-By
+attribute-alias: UB
+description:     Updated by
+is-primary-key:  FALSE
+is-required:     TRUE
+is-repeatable:   FALSE
+is-multi-line:   FALSE
+is-hierarchical: FALSE
+index:           NONE
+type:            TEXT
Index: /branches/stable/cgi-bin/extras/rwhois-config
===================================================================
--- /branches/stable/cgi-bin/extras/rwhois-config	(revision 325)
+++ /branches/stable/cgi-bin/extras/rwhois-config	(revision 325)
@@ -0,0 +1,40 @@
+Notes on requirements for "proper" rWHOIS configuration
+
+###
+# SVN revision info
+# $Date$
+# SVN revision $Rev$
+# Last update by $Author$
+###
+
+- Each "master" block has its own auth area
+- Only the network records are used;  referral records may be useful
+  someday but not yet.
+- "Org" data is stored in the network records directly.  Doing
+  otherwise more or less works, but it's tedious and headache-ful
+  to retrieve it.  This according to an ARIN staffer who gets
+  paid to check rWHOIS servers for "correctness".
+- Suitable templates and scripts for adding a fresh new master
+  (manually) are included in this directory.  Note that adding a
+  master automagically is unlikely to happen soon.  (As of 2006-04-06)
+- The "register" directive should be disabled;  we're not using it.
+Notes on requirements for "proper" rWHOIS configuration
+
+###
+# SVN revision info
+# $Date$
+# SVN revision $Rev$
+# Last update by $Author$
+###
+
+- Each "master" block has its own auth area
+- Only the network records are used;  referral records may be useful
+  someday but not yet.
+- "Org" data is stored in the network records directly.  Doing
+  otherwise more or less works, but it's tedious and headache-ful
+  to retrieve it.  This according to an ARIN staffer who gets
+  paid to check rWHOIS servers for "correctness".
+- Suitable templates and scripts for adding a fresh new master
+  (manually) are included in this directory.  Note that adding a
+  master automagically is unlikely to happen soon.  (As of 2006-04-06)
+- The "register" directive should be disabled;  we're not using it.
Index: /branches/stable/cgi-bin/ipdb.psql
===================================================================
--- /branches/stable/cgi-bin/ipdb.psql	(revision 324)
+++ /branches/stable/cgi-bin/ipdb.psql	(revision 325)
@@ -10,22 +10,25 @@
 	"city" character varying(30),
 	"province" character(2),
+	"country" character(2),
 	"pocode" character varying(7),
 	"phone" character varying(15),
-	"abuse" character varying(50),
+	"tech_handle" character varying(50),
+	"abuse_handle" character varying(50),
+	"admin_handle" character varying(50),
 	"def_rdns" character varying(40),
-	"description" text,
+	"special" text,
 	Constraint "customers_pkey" Primary Key ("custid")
 );
 
 REVOKE ALL on "customers" from PUBLIC;
-GRANT ALL on "customers" to "kdeugau";
 GRANT ALL on "customers" to "ipdb";
 
 CREATE TABLE "masterblocks" (
-	"cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY
+	"cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY,
+	"ctime" timestamp DEFAULT now(),
+	"mtime" timestamp DEFAULT now()
 );
 
 REVOKE ALL on "masterblocks" from PUBLIC;
-GRANT ALL on "masterblocks" to "kdeugau";
 GRANT ALL on "masterblocks" to "ipdb";
 
@@ -33,10 +36,11 @@
 	"cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY,
 	"maskbits" integer DEFAULT 128,
-	"city" character varying(30) DEFAULT ''
+	"city" character varying(30) DEFAULT '',
+	"ctime" timestamp DEFAULT now()
 );
 
 REVOKE ALL on "routed" from PUBLIC;
-GRANT ALL on "routed" to "kdeugau";
 GRANT ALL on "routed" to "ipdb";
+GRANT SELECT on "routed" to "ipdb";
 
 CREATE TABLE "temp" (
@@ -45,5 +49,4 @@
 
 REVOKE ALL on "temp" from PUBLIC;
-GRANT ALL on "temp" to "kdeugau";
 GRANT ALL on "temp" to "ipdb";
 
@@ -56,5 +59,4 @@
 
 REVOKE ALL on "freeblocks" from PUBLIC;
-GRANT ALL on "freeblocks" to "kdeugau";
 GRANT ALL on "freeblocks" to "ipdb";
 
@@ -70,10 +72,11 @@
 	"circuitid" character varying(128) DEFAULT '' NOT NULL,
 	"privdata" text DEFAULT '' NOT NULL,
-	"newcustid" integer,
+	"newcustid" character varying(16) DEFAULT '',
+	"createstamp" timestamp DEFAULT now(),
+	"modifystamp" timestamp DEFAULT now(),
 	CHECK (((available = 'y'::bpchar) OR (available = 'n'::bpchar)))
 );
 
 REVOKE ALL on "poolips" from PUBLIC;
-GRANT ALL on "poolips" to "kdeugau";
 GRANT ALL on "poolips" to "ipdb";
 
@@ -87,16 +90,17 @@
 	"maskbits" integer DEFAULT 128,
 	"circuitid" character varying(128) DEFAULT '',
+	"createstamp" timestamp DEFAULT now(),
+	"modifystamp" timestamp DEFAULT now(),
 	"privdata" text DEFAULT '' NOT NULL,
-	"newcustid" integer
+	"newcustid" character varying(16) DEFAULT '',
+	swip character(1) DEFAULT 'n'
 );
 
 REVOKE ALL on "allocations" from PUBLIC;
-GRANT ALL on "allocations" to "kdeugau";
 GRANT ALL on "allocations" to "ipdb";
 
-CREATE VIEW "searchme" as SELECT allocations.cidr, allocations.custid, allocations."type", allocations.city, allocations.description, allocations.notes, allocations.oldcustid FROM allocations UNION SELECT poolips.ip, poolips.custid, poolips.type, poolips.city, poolips.description, poolips.notes, poolips.oldcustid FROM poolips;
+CREATE VIEW "searchme" as SELECT allocations.cidr, allocations.custid, allocations."type", allocations.city, allocations.description, allocations.notes FROM allocations UNION SELECT poolips.ip, poolips.custid, poolips.type, poolips.city, poolips.description, poolips.notes FROM poolips;
 
 REVOKE ALL on "searchme" from PUBLIC;
-GRANT ALL on "searchme" to "kdeugau";
 GRANT ALL on "searchme" to "ipdb";
 
@@ -106,85 +110,70 @@
 	"dispname" character varying(40) DEFAULT '',
 	"listorder" integer DEFAULT 0,
-	"def_custid" character varying(16) DEFAULT ''
+	"def_custid" character varying(16) DEFAULT '',
+	"arin_netname" character varying(20) DEFAILT 'ISP'
 );
 
+--
+-- Name: alloctypes; Type: TABLE DATA; Schema: public; Owner: ipdb
+--
+
+COPY "alloctypes" FROM stdin;
+cn	Customer netblock	Customer netblock	0		ISPCUST
+si	Static IP - Server pool	Server pool IP	20	6750400	ISP
+ci	Static IP - Cable	Static cable IP	21		ISP
+di	Static IP - DSL	Static DSL IP	22		ISP
+mi	Static IP - Dialup	Static dialup IP	23		ISP
+wi	Static IP - Wireless	Static wireless IP	24		ISP
+sd	Static Pool - Servers	Server pool	40	6750400	ISP
+cd	Static Pool - Cable	Cable pool	41	CBL-BUS	ISP-STATIC-CABLE
+dp	Static Pool - DSL	DSL pool	42	DSL-BUS	ISP-STATIC-DSL
+mp	Static Pool - Dialup	Static dialup pool	43	DIAL-BUS	ISP-STATIC-DIAL
+wp	Static Pool - Wireless	Static wireless pool	44	WL-BUS	ISP-STATIC-WIFI
+en	End-use netblock	End-use netblock	100	6750400	ISP
+me	Dialup netblock	Dialup netblock	101	DIAL-RES	ISP-DIAL
+de	Dynamic DSL block	Dynamic DSL block	102	DSL-RES	ISP-DSL
+ce	Dynamic cable block	Dynamic cable block	103	CBL-RES	ISP-CABLE
+we	Dynamic WiFi block	Dynamic WiFi block	104	WL-RES	ISP-WIFI
+ve	Dynamic VoIP block	Dynamic VoIP block	105	DYN-VOIP	ISP
+li	Static IP - LAN/POP	Static LAN/POP IP	190	6750400	ISP
+ld	Static Pool - LAN/POP	LAN pool	191	6750400	ISP
+wc	Reserve for CORE/WAN blocks	CORE/WAN blocks	200	6750400	ISP
+pc	Reserve for dynamic-route DSL netblocks	Dynamic-route netblocks	201	6750400	ISP-STATIC-DSL
+ac	Reserve for ATM	ATM blocks	202	6750400	ISP
+wr	CORE/WAN block	CORE/WAN block	220	6750400	ISP
+pr	Dynamic-route DSL netblock	Dynamic-route DSL	221		ISP
+ar	ATM block	ATM block	222		ISP
+rm	Routing	Routed netblock	500	6750400	ISP
+in	Internal netblock	Internal netblock	990	6750400	ISP
+mm	Master block	Master block	999	6750400	ISP
+\.
+
 REVOKE ALL on "alloctypes" from PUBLIC;
-GRANT ALL on "alloctypes" to "kdeugau";
 GRANT ALL on "alloctypes" to "ipdb";
 
 CREATE TABLE "cities" (
-	"city" character varying(30) DEFAULT '' NOT NULL PRIMARY KEY,
+	"id" serial NOT NULL PRIMARY KEY,
+	"city" character varying(30) DEFAULT '' NOT NULL,
 	"routing" character(1) DEFAULT 'n' NOT NULL
 );
 
 REVOKE ALL on "cities" from PUBLIC;
-GRANT ALL on "cities" to "kdeugau";
 GRANT ALL on "cities" to "ipdb";
 
 --
--- Selected TOC Entries:
+-- Trigger and matching function to update modifystamp on allocations, poolips
 --
-\connect - ipdb
+CREATE FUNCTION up_modtime () RETURNS OPAQUE AS '
+    BEGIN
+	NEW.modifystamp := ''now'';
+	RETURN NEW;
+    END;
+' LANGUAGE 'plpgsql';
 
---
--- TOC Entry ID 2 (OID 92809)
---
--- Name: alloctypes Type: TABLE Owner: ipdb
---
+CREATE TRIGGER up_modtime BEFORE UPDATE ON allocations
+    FOR EACH ROW EXECUTE PROCEDURE up_modtime();
 
-CREATE TABLE "alloctypes" (
-	"type" character(2) DEFAULT '' NOT NULL,
-	"listname" character varying(40) DEFAULT '',
-	"dispname" character varying(40) DEFAULT '',
-	"listorder" integer DEFAULT 0,
-	"def_custid" character varying(16) DEFAULT '',
-	Constraint "alloctypes_pkey" Primary Key ("type")
-);
-
---
--- TOC Entry ID 3 (OID 92809)
---
--- Name: alloctypes Type: ACL Owner: 
---
-
-REVOKE ALL on "alloctypes" from PUBLIC;
-GRANT ALL on "alloctypes" to "kdeugau";
-GRANT ALL on "alloctypes" to "ipdb";
-
---
--- Data for TOC Entry ID 4 (OID 92809)
---
--- Name: alloctypes Type: TABLE DATA Owner: ipdb
---
-
-
-COPY "alloctypes" FROM stdin;
-cd	Static Pool - Cable	Cable pool	41	CBL-BUS
-dp	Static Pool - DSL	DSL pool	42	DSL-BUS
-mp	Static Pool - Dialup	Static dialup pool	43	DIAL-BUS
-wp	Static Pool - Wireless	Static wireless pool	44	WL-BUS
-mm	Master block	Master block	999	6750400
-in	Internal netblock	Internal netblock	990	6750400
-sd	Static Pool - Servers	Server pool	40	6750400
-cn	Customer netblock	Customer netblock	0	
-ci	Static IP - Cable	Static cable IP	21	
-di	Static IP - DSL	Static DSL IP	22	
-mi	Static IP - Dialup	Static dialup IP	23	
-wi	Static IP - Wireless	Static wireless IP	24	
-si	Static IP - Server pool	Server pool IP	20	6750400
-wc	Reserve for WAN blocks	WAN IP blocks	200	6750400
-wr	Internal WAN block	Internal WAN block	201	6750400
-pc	Reserve for dynamic-route DSL netblocks	Dynamic-route netblocks	202	6750400
-en	End-use netblock	End-use netblock	100	6750400
-me	Dialup netblock	Dialup netblock	101	DIAL-RES
-de	Dynamic DSL block	Dynamic DSL block	102	DSL-RES
-ce	Dynamic cable block	Dynamic cable block	103	CBL-RES
-we	Dynamic WiFi block	Dynamic WiFi block	104	WL-RES
-rm	Routing	Routed netblock	500	6750400
-pr	Dynamic-route DSL netblock	Dynamic-route DSL	203	
-li	Static IP - LAN/POP	Static LAN/POP IP	190	6750400
-ld	Static Pool - LAN/POP	LAN pool	191	6750400
-\.
-
+CREATE TRIGGER up_modtime BEFORE UPDATE ON poolips
+    FOR EACH ROW EXECUTE PROCEDURE up_modtime();
 
 --
@@ -197,2 +186,8 @@
 	"acl" varchar(16) DEFAULT 'b'
 );
+
+CREATE TABLE "dns" (
+	"ip" inet NOT NULL PRIMARY KEY,
+	"hostname" character varying(128),
+	"auto" character(1) DEFAULT 'y'
+);
