From: Michal 'vorner' Vaner Date: Mon, 4 Feb 2013 15:10:28 +0000 (+0100) Subject: [1924] Create a file for common protocol constants X-Git-Tag: bind10-1.1.0beta1-release~104^2~22^2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ea6b0f1c24282a98d7134d8f6e2eb0c181f9ffb;p=thirdparty%2Fkea.git [1924] Create a file for common protocol constants This should be included and used from whatever libraries and programs that talk to other bind10 programs. It allows defining constants shared across the protocol. --- diff --git a/src/lib/util/Makefile.am b/src/lib/util/Makefile.am index 13f8f7b595..aaa4157fa6 100644 --- a/src/lib/util/Makefile.am +++ b/src/lib/util/Makefile.am @@ -19,6 +19,7 @@ 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 diff --git a/src/lib/util/common_defs.cc b/src/lib/util/common_defs.cc new file mode 100644 index 0000000000..81416d454a --- /dev/null +++ b/src/lib/util/common_defs.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#include + +namespace isc { +namespace util { + +// Aside from defining the values for the C++ util 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. + +const char* CC_HEADER_TYPE = "type"; +const char* CC_HEADER_FROM = "from"; +const char* CC_HEADER_TO = "to"; +const char* CC_HEADER_GROUP = "group"; +const char* CC_HEADER_INSTANCE = "instance"; +const char* CC_HEADER_SEQ = "seq"; +const char* CC_HEADER_WANT_ANSWER = "want_answer"; + +} +} diff --git a/src/lib/util/common_defs.h b/src/lib/util/common_defs.h new file mode 100644 index 0000000000..c9dca089e2 --- /dev/null +++ b/src/lib/util/common_defs.h @@ -0,0 +1,42 @@ +// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#ifndef BIND10_COMMON_DEFS_H +#define BIND10_COMMON_DEFS_H + +namespace isc { +namespace util { + +// \file common_defs.h +// \brief Common constant definitions. +// +// This file contains common definitions of constasts used across the sources. +// It includes, but is not limited to the definitions of messages sent from +// one process to another. Since the names should be self-explanatory and +// the variables here are used mostly to synchronize the same values across +// multiple programs, separate documentation for each variable is not provided. + +// Constants used in the CC protocol (sent through MSGQ) +extern const char* CC_HEADER_TYPE; +extern const char* CC_HEADER_FROM; +extern const char* CC_HEADER_TO; +extern const char* CC_HEADER_GROUP; +extern const char* CC_HEADER_INSTANCE; +extern const char* CC_HEADER_SEQ; +extern const char* CC_HEADER_WANT_ANSWER; + +} +} + +#endif