]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1924] Create a file for common protocol constants
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 4 Feb 2013 15:10:28 +0000 (16:10 +0100)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 4 Feb 2013 15:10:28 +0000 (16:10 +0100)
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.

src/lib/util/Makefile.am
src/lib/util/common_defs.cc [new file with mode: 0644]
src/lib/util/common_defs.h [new file with mode: 0644]

index 13f8f7b595bccc0327f605a9d0929b535549d656..aaa4157fa6b90a6b539a9d67fc9a05cdd3d6dac3 100644 (file)
@@ -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 (file)
index 0000000..81416d4
--- /dev/null
@@ -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 <util/common_defs.h>
+
+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 (file)
index 0000000..c9dca08
--- /dev/null
@@ -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