]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Make lib/dns/dnstap.pb-c.h private header
authorOndřej Surý <ondrej@sury.org>
Fri, 22 Mar 2019 09:36:25 +0000 (10:36 +0100)
committerOndřej Surý <ondrej@sury.org>
Fri, 22 Mar 2019 11:08:16 +0000 (12:08 +0100)
This changes dns_dtdata struct to not expose data types from dnstap.pb-c.h to
prevent the need for including this header where not really needed.

(cherry picked from commit 8ccce7e24b6aff6e02745b64d66ef50842763543)

bin/tools/dnstap-read.c
configure
configure.ac
lib/dns/Makefile.in
lib/dns/dnstap.c
lib/dns/include/dns/Makefile.in
lib/dns/include/dns/dnstap.h
lib/dns/tests/dnstap_test.c

index 4cafdb4bb20d886613618328ff2bdea2ef77d6d9..49dbb9b5c0b0f2e23196859922ec8bfe4f6d8766 100644 (file)
@@ -47,6 +47,9 @@
 #include <dns/name.h>
 #include <dns/result.h>
 
+#include <protobuf-c/protobuf-c.h>
+#include "lib/dns/dnstap.pb-c.h"
+
 isc_mem_t *mctx = NULL;
 bool memrecord = false;
 bool printmessage = false;
index e309363bf556c5398f4a498e43ece0dcfcb33d40..8715961d77ddbfd6c3cf3ac1a76f8257f56f4830 100755 (executable)
--- a/configure
+++ b/configure
@@ -705,7 +705,6 @@ W3M
 DBLATEX
 PDFLATEX
 LATEX
-DNSTAP_PB_C_H
 DNSTAPTARGETS
 DNSTAPOBJS
 DNSTAPSRCS
@@ -21771,7 +21770,6 @@ DNSTAP=
 DNSTAPSRCS=
 DNSTAPOBJS=
 DNSTAPTARGETS=
-DNSTAP_PB_C_H=
 if test "x$use_dnstap" != "xno"; then
        if ! $use_threads; then
                as_fn_error $? "Dnstap requires threads." "$LINENO" 5
@@ -22107,14 +22105,12 @@ $as_echo "#define HAVE_DNSTAP 1" >>confdefs.h
        DNSTAPSRCS='${DNSTAPSRCS}'
        DNSTAPOBJS='${DNSTAPOBJS}'
        DNSTAPTARGETS='${DNSTAPTARGETS}'
-       DNSTAP_PB_C_H="dnstap.pb-c.h"
 fi
 
 
 
 
 
-
 #
 #  The following sets up how non-blocking i/o is established.
 #  Sunos, cygwin and solaris 2.x (x<5) require special handling.
index dd478760fbeb1d0bcb6fb9f0f37551907f9097ef..ce2b0ab1094b80ad629f19c87657b82024558962 100644 (file)
@@ -4443,7 +4443,6 @@ DNSTAP=
 DNSTAPSRCS=
 DNSTAPOBJS=
 DNSTAPTARGETS=
-DNSTAP_PB_C_H=
 if test "x$use_dnstap" != "xno"; then
        if ! $use_threads; then
                AC_MSG_ERROR([Dnstap requires threads.])
@@ -4500,13 +4499,11 @@ if test "x$use_dnstap" != "xno"; then
        DNSTAPSRCS='${DNSTAPSRCS}'
        DNSTAPOBJS='${DNSTAPOBJS}'
        DNSTAPTARGETS='${DNSTAPTARGETS}'
-       DNSTAP_PB_C_H="dnstap.pb-c.h"
 fi
 AC_SUBST(DNSTAP)
 AC_SUBST(DNSTAPSRCS)
 AC_SUBST(DNSTAPOBJS)
 AC_SUBST(DNSTAPTARGETS)
-AC_SUBST(DNSTAP_PB_C_H)
 
 #
 #  The following sets up how non-blocking i/o is established.
index 068bbac6debb25cb766acdf7687ff62410f14e71..56dd259e19b15e7f4866cb53126b1a2df49ac6b1 100644 (file)
@@ -201,7 +201,7 @@ clean distclean::
        rm -f libdns.@A@ timestamp
        rm -f gen code.h include/dns/enumtype.h include/dns/enumclass.h
        rm -f include/dns/rdatastruct.h
-       rm -f dnstap.pb-c.c dnstap.pb-c.h include/dns/dnstap.pb-c.h
+       rm -f dnstap.pb-c.c dnstap.pb-c.h
 
 newrr::
        rm -f code.h include/dns/enumtype.h include/dns/enumclass.h
@@ -218,9 +218,8 @@ ${OBJS}: include
 # dnstap
 dnstap.@O@: dnstap.c dnstap.pb-c.c
 
-dnstap.pb-c.c dnstap.pb-c.h include/dns/dnstap.pb-c.h: dnstap.proto
+dnstap.pb-c.c dnstap.pb-c.h: dnstap.proto
        $(PROTOC_C) --c_out=. --proto_path ${srcdir} dnstap.proto
-       cp -f dnstap.pb-c.h include/dns
 
 dnstap.pb-c.@O@: dnstap.pb-c.c
 
index 0c29d0ba78509fa6f0e7e90a08c5e7e993cdc3e5..219652479c6fd418e10ffa1f5112c3f7b88cbdf1 100644 (file)
@@ -74,8 +74,8 @@
 #include <dns/types.h>
 #include <dns/view.h>
 
-#include <dns/dnstap.pb-c.h>
 #include <protobuf-c/protobuf-c.h>
+#include "dnstap.pb-c.h"
 
 #define DTENV_MAGIC                    ISC_MAGIC('D', 't', 'n', 'v')
 #define VALID_DTENV(env)               ISC_MAGIC_VALID(env, DTENV_MAGIC)
@@ -950,6 +950,7 @@ dns_dt_close(dns_dthandle_t **handlep) {
 isc_result_t
 dns_dt_parse(isc_mem_t *mctx, isc_region_t *src, dns_dtdata_t **destp) {
        isc_result_t result;
+       Dnstap__Dnstap *frame;
        Dnstap__Message *m;
        dns_dtdata_t *d = NULL;
        isc_buffer_t b;
@@ -968,10 +969,12 @@ dns_dt_parse(isc_mem_t *mctx, isc_region_t *src, dns_dtdata_t **destp) {
        if (d->frame == NULL)
                CHECK(ISC_R_NOMEMORY);
 
-       if (d->frame->type != DNSTAP__DNSTAP__TYPE__MESSAGE)
+       frame = (Dnstap__Dnstap *)d->frame;
+
+       if (frame->type != DNSTAP__DNSTAP__TYPE__MESSAGE)
                CHECK(DNS_R_BADDNSTAP);
 
-       m = d->frame->message;
+       m = frame->message;
 
        /* Message type */
        switch (m->type) {
index 59897feb64fb231199ea1dec4b402b11ad6e3f1b..29cec4611530df15ec79d72c756bcabb6cbe4da9 100644 (file)
@@ -33,7 +33,7 @@ HEADERS =     acache.h acl.h adb.h badcache.h bit.h byaddr.h \
                update.h validator.h version.h view.h xfrin.h \
                zone.h zonekey.h zt.h
 
-GENHEADERS =   @DNSTAP_PB_C_H@ enumclass.h enumtype.h rdatastruct.h
+GENHEADERS =   enumclass.h enumtype.h rdatastruct.h
 
 SUBDIRS =
 TARGETS =
index 279f7fd0a1cbf7cc48e5e3822695c1ba0a4bfe22..d8835564798d1afecbd25983a9bceecdd0abac47 100644 (file)
@@ -29,7 +29,6 @@
 #ifdef HAVE_DNSTAP
 #include <fstrm.h>
 #include <protobuf-c/protobuf-c.h>
-#include <dns/dnstap.pb-c.h>
 #else
 struct fstrm_iothr_options;
 #endif /* HAVE_DNSTAP */
@@ -93,7 +92,7 @@ typedef struct dns_dthandle dns_dthandle_t;
 struct dns_dtdata {
        isc_mem_t *mctx;
 
-       Dnstap__Dnstap *frame;
+       void *frame;
 
        bool query;
        bool tcp;
index 5a60b12bbc5b7cfe2d994313dba0d3e24c45ea2d..b470b7b40008fd6e24a8e457db05f91e3781f2e4 100644 (file)
@@ -38,7 +38,7 @@
 #include "dnstest.h"
 
 #ifdef HAVE_DNSTAP
-#include <dns/dnstap.pb-c.h>
+
 #include <protobuf-c/protobuf-c.h>
 
 #define TAPFILE "testdata/dnstap/dnstap.file"