[svn] commit: r209 - in /branches/f2f200910/src/bin/parkinglot: main.cc zoneset.h
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Oct 30 00:26:24 UTC 2009
Author: each
Date: Fri Oct 30 00:26:24 2009
New Revision: 209
Log:
better zoneset type
Added:
branches/f2f200910/src/bin/parkinglot/zoneset.h
Modified:
branches/f2f200910/src/bin/parkinglot/main.cc
Modified: branches/f2f200910/src/bin/parkinglot/main.cc
==============================================================================
--- branches/f2f200910/src/bin/parkinglot/main.cc (original)
+++ branches/f2f200910/src/bin/parkinglot/main.cc Fri Oct 30 00:26:24 2009
@@ -28,6 +28,7 @@
#include <dns/message.h>
#include "common.h"
+#include "zoneset.h"
using namespace std;
@@ -38,28 +39,15 @@
const string PROGRAM = "parkinglot";
const int DNSPORT = 53;
-static void
-usage() {
- cerr << "Usage: parkinglot [-p port]" << endl;
- exit(1);
-}
-
-typedef pair<string, void*> Record;
-typedef set<string> ZoneSet;
ZoneSet zones;
static void
-serve(string zone) {
- zones.insert(zone);
-}
-
-static void
init_db() {
- serve("jinmei.org");
- serve("nuthaven.org");
- serve("isc.org");
- serve("sisotowbell.org");
- serve("flame.org");
+ zones.serve("jinmei.org");
+ zones.serve("nuthaven.org");
+ zones.serve("isc.org");
+ zones.serve("sisotowbell.org");
+ zones.serve("flame.org");
}
static int
@@ -113,7 +101,8 @@
RRsetPtr query = msg.getSection(SECTION_QUESTION)[0];
- if (zones.find(query->getName().toText(true)) != zones.end()) {
+ string name = query->getName().toText(true);
+ if (zones.contains(name)) {
msg.setRcode(Message::RCODE_NOERROR);
RRset* nsset = new RRset(query->getName(), query->getClass(),
RRType::NS, TTL(3600));
@@ -172,8 +161,10 @@
}
}
- if (err || (argc - optind) > 0)
- usage();
+ if (err || (argc - optind) > 0) {
+ cerr << "Usage: parkinglot [-p port]" << endl;
+ exit(1);
+ }
// initialize DNS database
init_db();
More information about the bind10-changes
mailing list