2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Make lib/dns/dnstap.pb-c.h private header

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.
This commit is contained in:
Ondřej Surý 2019-03-22 10:36:25 +01:00
parent d0cda3dc83
commit 8ccce7e24b
8 changed files with 14 additions and 17 deletions

View File

@ -46,6 +46,9 @@
#include <dns/name.h> #include <dns/name.h>
#include <dns/result.h> #include <dns/result.h>
#include <protobuf-c/protobuf-c.h>
#include "lib/dns/dnstap.pb-c.h"
isc_mem_t *mctx = NULL; isc_mem_t *mctx = NULL;
bool memrecord = false; bool memrecord = false;
bool printmessage = false; bool printmessage = false;

4
configure vendored
View File

@ -697,7 +697,6 @@ W3M
DBLATEX DBLATEX
PDFLATEX PDFLATEX
LATEX LATEX
DNSTAP_PB_C_H
DNSTAPTARGETS DNSTAPTARGETS
DNSTAPOBJS DNSTAPOBJS
DNSTAPSRCS DNSTAPSRCS
@ -18516,7 +18515,6 @@ DNSTAP=
DNSTAPSRCS= DNSTAPSRCS=
DNSTAPOBJS= DNSTAPOBJS=
DNSTAPTARGETS= DNSTAPTARGETS=
DNSTAP_PB_C_H=
if test "x$use_dnstap" != "xno"; then if test "x$use_dnstap" != "xno"; then
# Check whether --with-protobuf-c was given. # Check whether --with-protobuf-c was given.
@ -18849,14 +18847,12 @@ $as_echo "#define HAVE_DNSTAP 1" >>confdefs.h
DNSTAPSRCS='${DNSTAPSRCS}' DNSTAPSRCS='${DNSTAPSRCS}'
DNSTAPOBJS='${DNSTAPOBJS}' DNSTAPOBJS='${DNSTAPOBJS}'
DNSTAPTARGETS='${DNSTAPTARGETS}' DNSTAPTARGETS='${DNSTAPTARGETS}'
DNSTAP_PB_C_H="dnstap.pb-c.h"
fi fi
# #
# The following sets up how non-blocking i/o is established. # The following sets up how non-blocking i/o is established.
# cygwin and solaris 2.x (x<5) require special handling. # cygwin and solaris 2.x (x<5) require special handling.

View File

@ -2070,7 +2070,6 @@ DNSTAP=
DNSTAPSRCS= DNSTAPSRCS=
DNSTAPOBJS= DNSTAPOBJS=
DNSTAPTARGETS= DNSTAPTARGETS=
DNSTAP_PB_C_H=
if test "x$use_dnstap" != "xno"; then if test "x$use_dnstap" != "xno"; then
AC_ARG_WITH([protobuf-c], AC_ARG_WITH([protobuf-c],
AS_HELP_STRING([--with-protobuf-c=path], AS_HELP_STRING([--with-protobuf-c=path],
@ -2123,13 +2122,11 @@ if test "x$use_dnstap" != "xno"; then
DNSTAPSRCS='${DNSTAPSRCS}' DNSTAPSRCS='${DNSTAPSRCS}'
DNSTAPOBJS='${DNSTAPOBJS}' DNSTAPOBJS='${DNSTAPOBJS}'
DNSTAPTARGETS='${DNSTAPTARGETS}' DNSTAPTARGETS='${DNSTAPTARGETS}'
DNSTAP_PB_C_H="dnstap.pb-c.h"
fi fi
AC_SUBST(DNSTAP) AC_SUBST(DNSTAP)
AC_SUBST(DNSTAPSRCS) AC_SUBST(DNSTAPSRCS)
AC_SUBST(DNSTAPOBJS) AC_SUBST(DNSTAPOBJS)
AC_SUBST(DNSTAPTARGETS) AC_SUBST(DNSTAPTARGETS)
AC_SUBST(DNSTAP_PB_C_H)
# #
# The following sets up how non-blocking i/o is established. # The following sets up how non-blocking i/o is established.

View File

@ -189,7 +189,7 @@ clean distclean::
rm -f libdns.@A@ timestamp rm -f libdns.@A@ timestamp
rm -f gen code.h include/dns/enumtype.h include/dns/enumclass.h rm -f gen code.h include/dns/enumtype.h include/dns/enumclass.h
rm -f include/dns/rdatastruct.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:: newrr::
rm -f code.h include/dns/enumtype.h include/dns/enumclass.h rm -f code.h include/dns/enumtype.h include/dns/enumclass.h
@ -204,9 +204,8 @@ ${OBJS}: include
# dnstap # dnstap
dnstap.@O@: dnstap.c dnstap.pb-c.c 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 $(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 dnstap.pb-c.@O@: dnstap.pb-c.c

View File

@ -76,8 +76,8 @@
#include <dns/types.h> #include <dns/types.h>
#include <dns/view.h> #include <dns/view.h>
#include <dns/dnstap.pb-c.h>
#include <protobuf-c/protobuf-c.h> #include <protobuf-c/protobuf-c.h>
#include "dnstap.pb-c.h"
#define DTENV_MAGIC ISC_MAGIC('D', 't', 'n', 'v') #define DTENV_MAGIC ISC_MAGIC('D', 't', 'n', 'v')
#define VALID_DTENV(env) ISC_MAGIC_VALID(env, DTENV_MAGIC) #define VALID_DTENV(env) ISC_MAGIC_VALID(env, DTENV_MAGIC)
@ -1099,6 +1099,7 @@ dns_dt_close(dns_dthandle_t **handlep) {
isc_result_t isc_result_t
dns_dt_parse(isc_mem_t *mctx, isc_region_t *src, dns_dtdata_t **destp) { dns_dt_parse(isc_mem_t *mctx, isc_region_t *src, dns_dtdata_t **destp) {
isc_result_t result; isc_result_t result;
Dnstap__Dnstap *frame;
Dnstap__Message *m; Dnstap__Message *m;
dns_dtdata_t *d = NULL; dns_dtdata_t *d = NULL;
isc_buffer_t b; isc_buffer_t b;
@ -1117,10 +1118,12 @@ dns_dt_parse(isc_mem_t *mctx, isc_region_t *src, dns_dtdata_t **destp) {
if (d->frame == NULL) if (d->frame == NULL)
CHECK(ISC_R_NOMEMORY); 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); CHECK(DNS_R_BADDNSTAP);
m = d->frame->message; m = frame->message;
/* Message type */ /* Message type */
switch (m->type) { switch (m->type) {

View File

@ -33,7 +33,7 @@ HEADERS = acl.h adb.h badcache.h bit.h byaddr.h \
update.h validator.h version.h view.h xfrin.h \ update.h validator.h version.h view.h xfrin.h \
zone.h zonekey.h zoneverify.h zt.h zone.h zonekey.h zoneverify.h zt.h
GENHEADERS = @DNSTAP_PB_C_H@ enumclass.h enumtype.h rdatastruct.h GENHEADERS = enumclass.h enumtype.h rdatastruct.h
SUBDIRS = SUBDIRS =
TARGETS = TARGETS =

View File

@ -29,7 +29,6 @@
#ifdef HAVE_DNSTAP #ifdef HAVE_DNSTAP
#include <fstrm.h> #include <fstrm.h>
#include <protobuf-c/protobuf-c.h> #include <protobuf-c/protobuf-c.h>
#include <dns/dnstap.pb-c.h>
#else #else
struct fstrm_iothr_options; struct fstrm_iothr_options;
#endif /* HAVE_DNSTAP */ #endif /* HAVE_DNSTAP */
@ -99,7 +98,7 @@ typedef struct dns_dthandle dns_dthandle_t;
struct dns_dtdata { struct dns_dtdata {
isc_mem_t *mctx; isc_mem_t *mctx;
Dnstap__Dnstap *frame; void *frame;
bool query; bool query;
bool tcp; bool tcp;

View File

@ -36,7 +36,7 @@
#include "dnstest.h" #include "dnstest.h"
#ifdef HAVE_DNSTAP #ifdef HAVE_DNSTAP
#include <dns/dnstap.pb-c.h>
#include <protobuf-c/protobuf-c.h> #include <protobuf-c/protobuf-c.h>
#define TAPFILE "testdata/dnstap/dnstap.file" #define TAPFILE "testdata/dnstap/dnstap.file"