From: Michal 'vorner' Vaner Date: Mon, 11 Feb 2013 08:56:42 +0000 (+0100) Subject: [1924] Move the common_defs to the cc directory X-Git-Tag: bind10-1.1.0beta1-release~104^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=beebff23a438a65506ea2af860686ed0272da31f;p=thirdparty%2Fkea.git [1924] Move the common_defs to the cc directory 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. --- diff --git a/src/lib/cc/Makefile.am b/src/lib/cc/Makefile.am index ec478de002..b3475d8ca7 100644 --- a/src/lib/cc/Makefile.am +++ b/src/lib/cc/Makefile.am @@ -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 diff --git a/src/lib/util/common_defs.cc b/src/lib/cc/proto_defs.cc similarity index 89% rename from src/lib/util/common_defs.cc rename to src/lib/cc/proto_defs.cc index 5e4d18575d..24d965005f 100644 --- a/src/lib/util/common_defs.cc +++ b/src/lib/cc/proto_defs.cc @@ -12,15 +12,15 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. -#include +#include 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 diff --git a/src/lib/cc/session.cc b/src/lib/cc/session.cc index b300aad8b2..90f0d60584 100644 --- a/src/lib/cc/session.cc +++ b/src/lib/cc/session.cc @@ -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); diff --git a/src/lib/cc/session.h b/src/lib/cc/session.h index b5c29f9bd0..63bb41c556 100644 --- a/src/lib/cc/session.h +++ b/src/lib/cc/session.h @@ -17,8 +17,7 @@ #include #include - -#include +#include #include @@ -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, diff --git a/src/lib/python/isc/cc/Makefile.am b/src/lib/python/isc/cc/Makefile.am index b0ba3b2851..aa3d5652a7 100644 --- a/src/lib/python/isc/cc/Makefile.am +++ b/src/lib/python/isc/cc/Makefile.am @@ -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 diff --git a/src/lib/python/isc/cc/session.py b/src/lib/python/isc/cc/session.py index c13979a121..89a5066b5c 100644 --- a/src/lib/python/isc/cc/session.py +++ b/src/lib/python/isc/cc/session.py @@ -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 diff --git a/src/lib/python/isc/util/Makefile.am b/src/lib/python/isc/util/Makefile.am index e8f737ac3d..3eaaa12643 100644 --- a/src/lib/python/isc/util/Makefile.am +++ b/src/lib/python/isc/util/Makefile.am @@ -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 diff --git a/src/lib/util/Makefile.am b/src/lib/util/Makefile.am index 40c3afcd84..3960a8b6e5 100644 --- a/src/lib/util/Makefile.am +++ b/src/lib/util/Makefile.am @@ -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 diff --git a/src/lib/util/python/Makefile.am b/src/lib/util/python/Makefile.am index 81d528c5c2..c92af7e2bd 100644 --- a/src/lib/util/python/Makefile.am +++ b/src/lib/util/python/Makefile.am @@ -1 +1,2 @@ -noinst_SCRIPTS = gen_wiredata.py mkpywrapper.py +noinst_SCRIPTS = gen_wiredata.py mkpywrapper.py const2hdr.py \ + pythonize_constants.py diff --git a/src/lib/util/const2hdr.py b/src/lib/util/python/const2hdr.py similarity index 100% rename from src/lib/util/const2hdr.py rename to src/lib/util/python/const2hdr.py diff --git a/src/lib/python/isc/util/pythonize_constants.py b/src/lib/util/python/pythonize_constants.py similarity index 100% rename from src/lib/python/isc/util/pythonize_constants.py rename to src/lib/util/python/pythonize_constants.py