chiark / gitweb /
Continuing.
authorijackson <ijackson>
Fri, 18 Jun 1999 16:14:15 +0000 (16:14 +0000)
committerijackson <ijackson>
Fri, 18 Jun 1999 16:14:15 +0000 (16:14 +0000)
bcp5-registry.pl [new file with mode: 0755]
config.pl [new file with mode: 0644]
template.html [new file with mode: 0644]

diff --git a/bcp5-registry.pl b/bcp5-registry.pl
new file mode 100755 (executable)
index 0000000..887b553
--- /dev/null
@@ -0,0 +1,61 @@
+#!/usr/bin/perl
+
+require "$ARGV[0]/config.pl";
+require 'database.pl';
+
+if ("$ARGV[1]" eq '--cgi') {
+    require 'cgi-lib.pl';
+    &ReadParse;
+} else {
+    foreach $x (@ARGV) {
+       $x =~ s/^(\w+)\=//;
+       $in{$1}= $x;
+    }
+}
+
+if ($in{'dbid'}) {
+    database();
+    $id= $in{$dbid};
+    if (!exists $db{$id}) {
+       $notfound= 1;
+    } else {
+       $details= 1;
+       getinfo();
+    }
+} else {
+    $intro= 1;
+}
+
+open X, "template.html" or die $!;
+@x= <X>;
+close X or die $!;
+
+$x[$#x] eq "\@\@\@eof:\@\@\@\n" or die $!;
+$#x--;
+
+$cl= 0;
+process(1);
+
+sub process ($) {
+    my ($doing) = @_;
+    for (;;) {
+       return if $cl > $#x;
+       $_= $x[$cl++];
+       s/\n$//; s/\s*$//;
+       return if m/^\@\@\@end\w+\:\@\@\@$/;
+
+       if (m/^\@\@\@(if|ifnot):(\w+)\@\@\@$/) {
+           $v= $$2;
+           $do= $1 eq 'if' ? !!$v : !$v;
+           process($doing && $do);
+       } elsif (m/^\@\@\@foreach\:
+           } else {
+               
+           $do= $1 eq 'if' ? ${$2} : $$
+           $ifnot= $1;
+           $v= eval $2;
+           
+    while ($i < $e) {
+       
+
+$i= process(0,$#x);
diff --git a/config.pl b/config.pl
new file mode 100644 (file)
index 0000000..6fae0d1
--- /dev/null
+++ b/config.pl
@@ -0,0 +1,2 @@
+$whose= "Cambridge Geeks'";
+$adminemail= ;ijackson+cam-bcp5@chiark.greenend.org.uk';
diff --git a/template.html b/template.html
new file mode 100644 (file)
index 0000000..dfa7e0a
--- /dev/null
@@ -0,0 +1,362 @@
+<html><head>
+
+@@@if:intro@@@
+<title>@@@whose@@@ BCP5 (RFC1918) Registry</title>
+@@@endif:@@@
+
+@@@ifnot:intro@@@
+<title>@@@whose@@@ BCP5 Registry -
+
+@@@if:picked@@@
+@@@net@@@ picked
+@@@endif
+
+@@@if:details@@@
+details of @@@name@@@
+@@@endif:@@@
+
+@@@if:created@@@
+registered @@@name@@@
+@@@endif:@@@
+
+@@@if:updated@@@
+updated @@@name@@@
+@@@endif:@@@
+
+@@@if:viewingall@@@
+entire database
+@@@endif:@@@
+
+@@@if:viewingarea@@@
+subset for @@@viewarea@@@
+@@@endif:@@@
+
+@@@if:viewingoverlap@@@
+overlapping with @@@viewoverlap@@@
+@@@endif:@@@
+
+@@@if:notfound@@@
+entry not found
+@@@endif:@@@
+
+</title>
+@@@endif:@@@
+
+<link rev="made" href="mailto:@@@adminemail@@@">
+</head>
+<body>
+
+<h1>@@@whose@@@ BCP5 (RFC1918) network numbers registry
+
+@@@ifnot:intro@@@
+<br>
+@@@endif:@@@
+
+@@@if:picked@@@
+Random network picked: @@@net@@@
+@@@endif:@@@
+
+@@@if:details@@@
+Database entry details: @@@name@@@
+@@@endif:@@@
+
+@@@if:created@@@
+@@@name@@@ registered in database
+@@@endif:@@@
+
+@@@if:updated@@@
+Database entry updated: @@@name@@@
+@@@endif:@@@
+
+@@@if:viewingall@@@
+Entire database listing
+@@@endif:@@@
+
+@@@if:viewingarea@@@
+Database subset listing for @@@viewarea@@@
+@@@endif:@@@
+
+@@@if:viewingoverlap@@@
+Database search, entries overlapping with @@@viewoverlap@@@
+@@@endif:@@@
+
+@@@if:notfound@@@
+Database entry not found
+@@@endif:@@@
+
+</h1>
+
+
+@@@if:intro@@@
+
+<h2>Introduction</h2>
+
+<A href="http://src.doc.ic.ac.uk/rfc/bcp/bcp5.txt">BCP5</a> (currently
+RFC1918, `Address Allocation for Private Internets') describes
+circumstances where it can be useful to have non-globally-unique IP
+addresses, and specifies three address IPv4 address ranges which can
+be used for this purpose.
+
+<p>
+
+<A href="http://src.doc.ic.ac.uk/rfc/rfc1918.txt">RFC1918</A>
+recommends that, to minimise the risk of clashes when private
+internets need to be merged, address ranges should be chosen at
+random.
+
+<p>
+
+This web page and database exists to help people choose ranges at
+random, and to help them choose ranges which are not currently in use
+by anyone else.
+
+@@@endif:@@@
+
+
+@@@if:registernew@@@
+<h2>Register a network range you are using</h2>
+You may register an existing network range you are using in our
+database.
+@@@endif:@@@
+
+@@@if:picked@@@
+<h2>Random network range chosen</h2>
+I have picked the random network numbering range
+<strong>@@@net@@@</strong> for you.  You can see its relationship
+to other entries in the database of networks people are using -
+it is shown <A href="#picked">below</A>, in amongst the
+registered database entries.
+<p>
+If you are happy with it, you are of course free to use it straight
+away without telling anyone.  However, it may be to your advantage to
+register it in our database.
+@@@endif:@@@
+
+@@@if:registernew|picked@@@
+<p>
+You must enter an email address to `own' the database entry.  This
+email address will be mailed a reminder asking you to confirm/renew
+your entry periodically, and will also be used to authorise changes to
+the entry.
+@@@endif:@@@
+
+@@@if:details|fulldetails@@@
+<h2>Entry details</h2>
+@@@endif
+
+@@@if:created@@@
+<h2>Entry created</h2>
+The database entry has been created, but will only persist for a short
+time unless you confirm it.  You have beeen sent an email requesting
+confirmation.  You may use `confirm/update', below, to do the
+confirmation, or return at a later date when you have received the
+email.
+@@@endif:@@@
+
+@@@if:updated@@@
+<h2>Entry updated/confirmed</h2>
+The database entry below has been updated/confirmed/renewed.
+@@@endif:@@@
+
+
+@@@if:registernew|details|fulldetails|created|updated|picked@@@
+
+<p>
+<form method="POST" action="@@@cgi@@@">
+
+<input type=hidden name="id" value="@@@id@@@">
+
+Network range:
+@@@if:picked@@@
+<input type=hidden name="net" value="@@@net@@@">@@@net@@@
+@@@endif:@@@
+@@@ifnot:picked@@@
+<input type=text name="net" size=20>
+@@@endif:@@@
+<br>
+
+Network name:
+<input type=text name="name" size=70 value="@@@name@@@"><br>
+
+@@@if:showemail@@@
+Contact email address:
+@@@endif:@@@
+@@@ifnot:showemail@@@
+Contact email address hidden.
+New address:
+@@@endif:@@@
+<input type=text name="email" size="70" value="@@@email@@@">
+<br>
+
+<input type=checkbox name="hide" value="yes" @@@emailhidechecked@@@>
+Hide email address from public database.
+
+<p>
+
+@@@if:registernew|picked@@@
+<input type=submit name="register" value="Register">
+@@@endif:@@@
+
+@@@if:details|fulldetails|created|updated@@@
+Entry created: @@@datecreated@@@<br>
+Last update: @@@datechanged@@@<br>
+Confirmed/renewed: @@@dateconfirmed@@@
+@@@endif:@@@
+
+@@@if:details@@@
+Use this to obtain your password.  Passwords expire after a while; if
+you do not have a recent notification of your password, you should
+request a current password: <br>
+<input type=submit name="mailpasswd" value="Mail password">
+<p>
+@@@endif:@@@
+
+@@@if:details|created@@@
+Using your password, you can update the details above (if you have
+changed them), confirm or renew your entry (to stop it expiring), and
+view the full details, including any hidden email address: <br>
+Password: <input type=text name="password" size="30">
+@@@endif:@@@
+
+@@@if:fulldetails|updated@@@
+<input type=hidden name="password" value="@@@password@@@">
+Password: supplied.
+@@@endif:@@@
+
+@@@if:details|created|updated@@@
+<input type=submit name="view" value="View full details."><br>
+@@@endif:@@@
+
+@@@if:details|fulldetails|created|updated@@@
+<input type=submit name="update" value="Update/confirm/renew">
+<input type=submit name="delete" value="Delete">
+@@@endif:@@@
+
+</form>
+
+@@@endif:@@@
+
+
+@@@if:pick@@@
+
+<h2>Pick a random network range</h2>
+
+<form method="POST" action="@@@cgi@@@">
+with 24-bit prefix (ie, 254 hosts)
+
+from
+<br>
+
+@@@foreach:area@@@
+
+<input type=radio name=from value="@@@area_string@@@" @@@area_pickchecked@@@>
+@@@area_string@@@
+@@@if:area_recommended@@@
+<em>recommended</em>
+@@@endif
+<br>
+
+@@@endforeach@@@
+
+@@@ifnot:picked@@@
+<input type=submit name="pick" value="Pick network">
+@@@endif:@@@
+@@@if:picked@@@
+<input type=submit name="pick" value="Pick another network">
+@@@endif:@@@
+
+</form>
+
+@@@endif@@@
+
+
+@@@if:notfound@@@
+Sorry, the database entry cannot be found.  Perhaps the entry has been
+deleted or expired.
+<p>
+
+If you believe that this has happened to you in error, contact the
+registry administrator, @@@adminemail@@@, quoting identifier @@@id@@@.
+
+@@@endif:@@@
+
+
+@@@ifnot:notfound@@@
+
+<h2>View database</h2>
+
+<form>
+
+@@@ifnot:viewingall@@@
+
+<input type=submit name="viewall" value="Entire database">
+<p>
+
+@@@endif:@@@
+
+<h3>Entries allocated from</h3>
+
+@@@foreach:area@@@
+
+@@@ifnot:area_viewing@@@
+<input type=submit name="viewarea" value="@@@area_string@@@">
+@@@endif:@@@
+@@@if:area_viewing@@@
+@@@area_string@@@
+@@@endif:@@@
+<p>
+
+@@@endforeach:@@@
+
+@@@endif:@@@
+
+
+<h3>Entries overlapping with</h3>
+
+<input type=text name="with" value="@@@viewoverlap@@@" size="30">
+<input type=submit name="viewoverlap" value="Search">
+
+</form>
+
+@@@if:viewingall|viewingoverlap|viewingarea@@@
+
+<h2>Database</h2>
+
+<h3>
+@@@if:viewingall@@@
+Entire database
+@@@endif:@@@
+@@@if:viewingoverlap@@@
+Entries which overlap with @@@viewoverlap@@@
+@@@endif:@@@
+@@@if:viewingarea@@@
+Database for entries allocated from @@@viewarea@@@
+@@@
+</h3>
+
+@@@if:picked@@@
+The range picked for you has been <em>emphasized</em> below.
+@@@endif:@@@
+<p>
+
+You can get details about an existing entry by clicking on its address
+range; this can also be used to modify it.
+
+@@@endif:@@@
+
+<table>
+<tr><td>Range <td>Name <td>Contact email
+</tr><br>
+@@@foreach:db@@@
+<tr><td><A href="@@@cgi@@@?dbid=@@@db_id@@@">@@@db_net@@@</A>
+<td>@@@db_name@@@
+<td>@@@db_email@@@
+</tr><br>
+@@@endforeach:@@@
+</table>
+
+@@@endif:@@@
+
+</body>
+</html>
+@@@eof:@@@