]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1924] Move the common_defs to the cc directory
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 11 Feb 2013 08:56:42 +0000 (09:56 +0100)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 11 Feb 2013 08:58:20 +0000 (09:58 +0100)
Currently, it contains only the definitions related to CC. If we have
other definitions for other purposes, we may create further definition
files.

Also, rename it to proto_defs, since all is protocol constants.

Move the generator scripts to better place.

There should be no difference in functionality.

src/lib/cc/Makefile.am
src/lib/cc/proto_defs.cc [moved from src/lib/util/common_defs.cc with 89% similarity]
src/lib/cc/session.cc
src/lib/cc/session.h
src/lib/python/isc/cc/Makefile.am
src/lib/python/isc/cc/session.py
src/lib/python/isc/util/Makefile.am
src/lib/util/Makefile.am
src/lib/util/python/Makefile.am
src/lib/util/python/const2hdr.py [moved from src/lib/util/const2hdr.py with 100% similarity]
src/lib/util/python/pythonize_constants.py [moved from src/lib/python/isc/util/pythonize_constants.py with 100% similarity]

index ec478de0020f25d79dac932e3b620cdccb653d7d..b3475d8ca7dea65c6d760e86417df297f3424240 100644 (file)
@@ -25,6 +25,7 @@ libb10_cc_la_SOURCES = data.cc data.h session.cc session.h
 libb10_cc_la_SOURCES += logger.cc logger.h
 nodist_libb10_cc_la_SOURCES = cc_messages.cc cc_messages.h
 libb10_cc_la_LIBADD = $(top_builddir)/src/lib/log/libb10-log.la
+nodist_libb10_cc_la_SOURCES += proto_defs.cc proto_defs.h
 
 CLEANFILES = *.gcno *.gcda session_config.h cc_messages.cc cc_messages.h
 
@@ -34,6 +35,9 @@ session_config.h: session_config.h.pre
 cc_messages.cc cc_messages.h: cc_messages.mes
        $(top_builddir)/src/lib/log/compiler/message $(top_srcdir)/src/lib/cc/cc_messages.mes
 
-BUILT_SOURCES = session_config.h cc_messages.cc cc_messages.h
+BUILT_SOURCES = session_config.h cc_messages.cc cc_messages.h proto_defs.h
+
+proto_defs.h: $(top_srcdir)/src/lib/util/python/const2hdr.py proto_defs.cc
+       $(PYTHON) $(top_srcdir)/src/lib/util/python/const2hdr.py $(srcdir)/proto_defs.cc $@
 
 EXTRA_DIST = cc_messages.mes
similarity index 89%
rename from src/lib/util/common_defs.cc
rename to src/lib/cc/proto_defs.cc
index 5e4d18575d0cce8eb7273806febbd03b9f8313d6..24d965005fc7b2c6fe68006683c9114c21b5ca56 100644 (file)
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
-#include <util/common_defs.h>
+#include <cc/proto_defs.h>
 
 namespace isc {
-namespace util {
+namespace cc {
 
-// Aside from defining the values for the C++ util library, this file is also
+// Aside from defining the values for the C++ library, this file is also
 // used as direct input of the generator of the python counterpart. Please,
 // keep the syntax here simple and check the generated file
-// (lib/python/isc/util/common_defs.py) is correct and sane.
+// (lib/python/isc/cc/proto_defs.py) is correct and sane.
 
 // The constants used in the CC protocol
 // First the header names
index b300aad8b2424e15130d0f613d9911712e2dff46..90f0d60584d439d3ce310d90d9b544466ca5b24f 100644 (file)
@@ -480,14 +480,14 @@ Session::group_sendmsg(ConstElementPtr msg, std::string group,
     ElementPtr env = Element::createMap();
     const long int nseq = ++impl_->sequence_;
 
-    env->set(isc::util::CC_HEADER_TYPE,
-             Element::create(isc::util::CC_COMMAND_SEND));
-    env->set(isc::util::CC_HEADER_FROM, Element::create(impl_->lname_));
-    env->set(isc::util::CC_HEADER_TO, Element::create(to));
-    env->set(isc::util::CC_HEADER_GROUP, Element::create(group));
-    env->set(isc::util::CC_HEADER_INSTANCE, Element::create(instance));
-    env->set(isc::util::CC_HEADER_SEQ, Element::create(nseq));
-    env->set(isc::util::CC_HEADER_WANT_ANSWER, Element::create(want_answer));
+    env->set(CC_HEADER_TYPE,
+             Element::create(CC_COMMAND_SEND));
+    env->set(CC_HEADER_FROM, Element::create(impl_->lname_));
+    env->set(CC_HEADER_TO, Element::create(to));
+    env->set(CC_HEADER_GROUP, Element::create(group));
+    env->set(CC_HEADER_INSTANCE, Element::create(instance));
+    env->set(CC_HEADER_SEQ, Element::create(nseq));
+    env->set(CC_HEADER_WANT_ANSWER, Element::create(want_answer));
 
     sendmsg(env, msg);
     return (nseq);
index b5c29f9bd0699d894403782a305c3b33264f8531..63bb41c556a4cfb3fdfdecee7fe3574854859b76 100644 (file)
@@ -17,8 +17,7 @@
 
 #include <cc/data.h>
 #include <cc/session_config.h>
-
-#include <util/common_defs.h>
+#include <cc/proto_defs.h>
 
 #include <exceptions/exceptions.h>
 
@@ -84,9 +83,8 @@ namespace isc {
             virtual int group_sendmsg(isc::data::ConstElementPtr msg,
                                       std::string group,
                                       std::string instance =
-                                          isc::util::CC_INSTANCE_WILDCARD,
-                                      std::string to =
-                                          isc::util::CC_TO_WILDCARD,
+                                          CC_INSTANCE_WILDCARD,
+                                      std::string to = CC_TO_WILDCARD,
                                       bool want_answer = false) = 0;
             virtual bool group_recvmsg(isc::data::ConstElementPtr& envelope,
                                        isc::data::ConstElementPtr& msg,
index b0ba3b285117db698dac950fb5c23264ab2ac946..aa3d5652a7e8e168442a8abd32bbf803cdfba372 100644 (file)
@@ -1,6 +1,14 @@
 SUBDIRS = . tests
 
 python_PYTHON =        __init__.py data.py session.py message.py
+nodist_python_PYTHON = proto_defs.py
+BUILT_SOURCES = proto_defs.py
+
+proto_defs.py: $(top_srcdir)/src/lib/cc/proto_defs.cc \
+       $(top_srcdir)/src/lib/util/python/pythonize_constants.py
+       $(PYTHON) $(top_srcdir)/src/lib/util/python/pythonize_constants.py \
+               $(top_srcdir)/src/lib/cc/proto_defs.cc $@
+
 
 pythondir = $(pyexecdir)/isc/cc
 
index c13979a121a74f7f325eaa07fc00582d80c2a292..89a5066b5c05cc6372df32d1e77f851d2380f514 100644 (file)
@@ -22,7 +22,7 @@ import threading
 import bind10_config
 
 import isc.cc.message
-from isc.util.common_defs import *
+from isc.cc.proto_defs import *
 
 class ProtocolError(Exception): pass
 class NetworkError(Exception): pass
index e8f737ac3d7ac8ef218005770b1e06ff0a61f691..3eaaa126438b1087de27c7bb30957a24638dfdd1 100644 (file)
@@ -1,12 +1,6 @@
 SUBDIRS = . cio tests
 
-python_PYTHON = __init__.py process.py socketserver_mixin.py file.py \
-               common_defs.py
-BUILT_SOURCES = common_defs.py
-EXTRA_DIST = pythonize_constants.py
-
-common_defs.py: $(top_srcdir)/src/lib/util/common_defs.cc pythonize_constants.py
-       $(PYTHON) $(srcdir)/pythonize_constants.py $(top_srcdir)/src/lib/util/common_defs.cc $@
+python_PYTHON = __init__.py process.py socketserver_mixin.py file.py
 
 pythondir = $(pyexecdir)/isc/util
 
index 40c3afcd8418c2d2963851828fe23214b9fe59d4..3960a8b6e57a014670a86d280a8bd8f486ac9bef 100644 (file)
@@ -19,7 +19,6 @@ libb10_util_la_SOURCES += interprocess_sync_null.h interprocess_sync_null.cc
 libb10_util_la_SOURCES += memory_segment.h
 libb10_util_la_SOURCES += memory_segment_local.h memory_segment_local.cc
 libb10_util_la_SOURCES += range_utilities.h
-libb10_util_la_SOURCES += common_defs.h common_defs.cc
 libb10_util_la_SOURCES += hash/sha1.h hash/sha1.cc
 libb10_util_la_SOURCES += encode/base16_from_binary.h
 libb10_util_la_SOURCES += encode/base32hex.h encode/base64.h
@@ -30,12 +29,7 @@ libb10_util_la_SOURCES += encode/binary_from_base16.h
 libb10_util_la_SOURCES += random/qid_gen.h random/qid_gen.cc
 libb10_util_la_SOURCES += random/random_number_generator.h
 
-EXTRA_DIST = python/pycppwrapper_util.h const2hdr.py
-BUILT_SOURCES = common_defs.h
-
-common_defs.h: const2hdr.py common_defs.cc
-       $(PYTHON) $(srcdir)/const2hdr.py $(srcdir)/common_defs.cc $@
-
+EXTRA_DIST = python/pycppwrapper_util.h
 libb10_util_la_LIBADD = $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
 CLEANFILES = *.gcno *.gcda
 
index 81d528c5c27fbab9c572cef6dae5cd6447da82b2..c92af7e2bd4b2a345f50b80f1175c1c5dc26b3f2 100644 (file)
@@ -1 +1,2 @@
-noinst_SCRIPTS = gen_wiredata.py mkpywrapper.py
+noinst_SCRIPTS = gen_wiredata.py mkpywrapper.py const2hdr.py \
+       pythonize_constants.py