[svn] commit: r679 - in /branches/parkinglot/src: bin/cmdctl/Makefile.am bin/parkinglot/Makefile.am bin/parkinglot/config.h.in bin/parkinglot/main.cc lib/config/cpp/ccsession.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Sat Jan 30 01:32:56 UTC 2010


Author: jelte
Date: Sat Jan 30 01:32:56 2010
New Revision: 679

Log:
intree/installed specfile treatment for parkinglot
added strerror() to CCSession if the spec file could not be opened

Modified:
    branches/parkinglot/src/bin/cmdctl/Makefile.am
    branches/parkinglot/src/bin/parkinglot/Makefile.am
    branches/parkinglot/src/bin/parkinglot/config.h.in
    branches/parkinglot/src/bin/parkinglot/main.cc
    branches/parkinglot/src/lib/config/cpp/ccsession.cc

Modified: branches/parkinglot/src/bin/cmdctl/Makefile.am
==============================================================================
--- branches/parkinglot/src/bin/cmdctl/Makefile.am (original)
+++ branches/parkinglot/src/bin/cmdctl/Makefile.am Sat Jan 30 01:32:56 2010
@@ -3,7 +3,7 @@
 pkglibexec_SCRIPTS = b10-cmdctl
 
 b10_cmdctldir = $(DESTDIR)$(pkgdatadir)
-b10_cmdctl_DATA = passwd.csv
+b10_cmdctl_DATA = passwd.csv b10-cmdctl.pem
 
 CLEANFILES=	b10-cmdctl.py
 

Modified: branches/parkinglot/src/bin/parkinglot/Makefile.am
==============================================================================
--- branches/parkinglot/src/bin/parkinglot/Makefile.am (original)
+++ branches/parkinglot/src/bin/parkinglot/Makefile.am Sat Jan 30 01:32:56 2010
@@ -13,6 +13,9 @@
 b10_parkinglot_LDADD += $(top_builddir)/src/lib/config/cpp/libclient.a
 b10_parkinglot_LDADD += $(top_builddir)/src/lib/cc/cpp/libcc.a
 
+b10_parkinglotdir = $(DESTDIR)$(pkgsrcdir)
+b10_parkinglot_DATA = parkinglot.spec
+
 # TODO: don't install this here
 bin_PROGRAMS = builtin_bench
 builtin_bench_SOURCES = builtin_bench.cc builtin.h builtin.cc

Modified: branches/parkinglot/src/bin/parkinglot/config.h.in
==============================================================================
--- branches/parkinglot/src/bin/parkinglot/config.h.in (original)
+++ branches/parkinglot/src/bin/parkinglot/config.h.in Sat Jan 30 01:32:56 2010
@@ -1,1 +1,1 @@
-#define PARKINGLOT_SPECFILE_LOCATION "@abs_top_srcdir@/src/bin/parkinglot/parkinglot.spec"
+#define PARKINGLOT_SPECFILE_LOCATION "@prefix@/share/bind/parkinglot.spec"

Modified: branches/parkinglot/src/bin/parkinglot/main.cc
==============================================================================
--- branches/parkinglot/src/bin/parkinglot/main.cc (original)
+++ branches/parkinglot/src/bin/parkinglot/main.cc Sat Jan 30 01:32:56 2010
@@ -45,7 +45,7 @@
 
 using namespace std;
 
-const string PROGRAM = "ParkingLot";
+//const string PROGRAM = "ParkingLot";
 const int DNSPORT = 5300;
 
 /* need global var for config/command handlers.
@@ -70,14 +70,11 @@
 {
     isc::data::ElementPtr answer = isc::data::Element::createFromString("{ \"result\": [0] }");
 
-    cout << "[XX] Parkinglot handle command: " << endl << command->str() << endl;
     if (command->get(0)->stringValue() == "print_message") 
     {
         cout << command->get(1)->get("message") << endl;
         /* let's add that message to our answer as well */
-        cout << "[XX] answer was: " << answer->str() << endl;
         answer->get("result")->add(command->get(1));
-        cout << "[XX] answer now: " << answer->str() << endl;
     }
 
     return answer;
@@ -107,7 +104,13 @@
 
     // initialize command channel
     try {
-        CommandSession cs = CommandSession(PARKINGLOT_SPECFILE_LOCATION, my_config_handler, my_command_handler);
+        std::string specfile;
+        if (getenv("B10_FROM_SOURCE")) {
+            specfile = std::string(getenv("B10_FROM_SOURCE")) + "/src/bin/parkinglot/parkinglot.spec";
+        } else {
+            specfile = std::string(PARKINGLOT_SPECFILE_LOCATION);
+        }
+        CommandSession cs = CommandSession(specfile, my_config_handler, my_command_handler);
     
         // main server loop
         fd_set fds;
@@ -116,7 +119,7 @@
         int nfds = max(ps, ss) + 1;
         int counter = 0;
     
-        cout << "Server started." << endl;
+        cout << "[parkinglot] Server started." << endl;
         while (true) {
             FD_ZERO(&fds);
             FD_SET(ps, &fds);
@@ -124,7 +127,7 @@
     
             int n = select(nfds, &fds, NULL, NULL, NULL);
             if (n < 0)
-                throw FatalError("select error");
+                throw FatalError("[parkinglot] select error");
     
             if (FD_ISSET(ps, &fds)) {
                 ++counter;

Modified: branches/parkinglot/src/lib/config/cpp/ccsession.cc
==============================================================================
--- branches/parkinglot/src/lib/config/cpp/ccsession.cc (original)
+++ branches/parkinglot/src/lib/config/cpp/ccsession.cc Sat Jan 30 01:32:56 2010
@@ -29,6 +29,7 @@
 #include <iostream>
 #include <fstream>
 #include <sstream>
+#include <cerrno>
 
 #include <boost/foreach.hpp>
 
@@ -55,7 +56,7 @@
     // this file should be declared in a @something@ directive
     file.open(filename.c_str());
     if (!file) {
-        cout << "error opening " << filename << endl;
+        cout << "error opening " << filename << ": " << strerror(errno) << endl;
         exit(1);
     }
 




More information about the bind10-changes mailing list