2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[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.
This commit is contained in:
Michal 'vorner' Vaner
2013-02-11 09:56:42 +01:00
parent 9d5e1f5158
commit beebff23a4
11 changed files with 33 additions and 34 deletions

View 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

View File

@@ -12,15 +12,15 @@
// 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

View 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);

View 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,

View 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

View 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

View 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

View 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

View File

@@ -1 +1,2 @@
noinst_SCRIPTS = gen_wiredata.py mkpywrapper.py
noinst_SCRIPTS = gen_wiredata.py mkpywrapper.py const2hdr.py \
pythonize_constants.py