[svn] commit: r141 - in /branches/f2f200910: Makefile.in src/lib/dns/Makefile.am src/lib/dns/buffer.cc src/lib/dns/exceptions.h src/lib/dns/message.cc src/lib/dns/message.h src/lib/dns/message_unittest.cc src/lib/dns/rrset.cc src/lib/dns/rrset.h
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Oct 28 22:14:19 UTC 2009
Author: jinmei
Date: Wed Oct 28 22:14:18 2009
New Revision: 141
Log:
ported message API from the experimental code and added some test cases.
Added:
branches/f2f200910/src/lib/dns/message.cc
branches/f2f200910/src/lib/dns/message.h
branches/f2f200910/src/lib/dns/message_unittest.cc
Modified:
branches/f2f200910/Makefile.in
branches/f2f200910/src/lib/dns/Makefile.am
branches/f2f200910/src/lib/dns/buffer.cc
branches/f2f200910/src/lib/dns/exceptions.h
branches/f2f200910/src/lib/dns/rrset.cc
branches/f2f200910/src/lib/dns/rrset.h
Modified: branches/f2f200910/Makefile.in
==============================================================================
--- branches/f2f200910/Makefile.in (original)
+++ branches/f2f200910/Makefile.in Wed Oct 28 22:14:18 2009
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.11 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,8 +16,9 @@
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@@ -44,6 +46,7 @@
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = src/bin/bind-cfgd
+CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
@@ -55,6 +58,9 @@
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
@@ -62,9 +68,34 @@
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
- { test ! -d $(distdir) \
- || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
- && rm -fr $(distdir); }; }
+ { test ! -d "$(distdir)" \
+ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr "$(distdir)"; }; }
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
@@ -112,6 +143,7 @@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -159,6 +191,7 @@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = src
@@ -172,15 +205,15 @@
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
- cd $(srcdir) && $(AUTOMAKE) --gnu \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -196,9 +229,10 @@
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
- cd $(srcdir) && $(AUTOCONF)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
- cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
config.h: stamp-h1
@if test ! -f $@; then \
@@ -210,7 +244,7 @@
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
- cd $(top_srcdir) && $(AUTOHEADER)
+ ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
@@ -243,7 +277,7 @@
else \
local_target="$$target"; \
fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
@@ -277,16 +311,16 @@
else \
local_target="$$target"; \
fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -294,14 +328,14 @@
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
+ set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
@@ -313,7 +347,7 @@
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
- tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
@@ -322,36 +356,41 @@
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+ $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
- test -d $(distdir) || mkdir $(distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@@ -367,38 +406,54 @@
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
- list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
- distdir=`$(am__cd) $(distdir) && pwd`; \
- top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
- (cd $$subdir && \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$$top_distdir" \
- distdir="$$distdir/$$subdir" \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
+ am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
- -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ -test -n "$(am__skip_mode_fix)" \
+ || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
- || chmod -R a+r $(distdir)
+ || chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
@@ -409,6 +464,10 @@
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
$(am__remove_distdir)
dist-tarZ: distdir
@@ -439,6 +498,8 @@
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
@@ -450,9 +511,11 @@
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
- && cd $(distdir)/_build \
+ && am__cwd=`pwd` \
+ && $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
@@ -474,13 +537,15 @@
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
- && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
- @cd $(distuninstallcheck_dir) \
+ @$(am__cd) '$(distuninstallcheck_dir)' \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
@@ -522,6 +587,7 @@
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -541,6 +607,8 @@
html: html-recursive
+html-am:
+
info: info-recursive
info-am:
@@ -549,17 +617,27 @@
install-dvi: install-dvi-recursive
+install-dvi-am:
+
install-exec-am:
install-html: install-html-recursive
+install-html-am:
+
install-info: install-info-recursive
+install-info-am:
+
install-man:
install-pdf: install-pdf-recursive
+install-pdf-am:
+
install-ps: install-ps-recursive
+
+install-ps-am:
installcheck-am:
@@ -583,23 +661,24 @@
uninstall-am:
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
- install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
+ ctags-recursive install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
- dist-lzma dist-shar dist-tarZ dist-zip distcheck distclean \
- distclean-generic distclean-hdr distclean-tags distcleancheck \
- distdir distuninstallcheck dvi dvi-am html html-am info \
- info-am install install-am install-data install-data-am \
- install-dvi install-dvi-am install-exec install-exec-am \
- install-html install-html-am install-info install-info-am \
- install-man install-pdf install-pdf-am install-ps \
- install-ps-am install-strip installcheck installcheck-am \
- installdirs installdirs-am maintainer-clean \
+ dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \
+ distclean distclean-generic distclean-hdr distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
Modified: branches/f2f200910/src/lib/dns/Makefile.am
==============================================================================
--- branches/f2f200910/src/lib/dns/Makefile.am (original)
+++ branches/f2f200910/src/lib/dns/Makefile.am Wed Oct 28 22:14:18 2009
@@ -1,12 +1,14 @@
AM_CPPFLAGS = -I$(top_srcdir)/src/lib
lib_LIBRARIES = libdns.a
-libdns_a_SOURCES = name.cc buffer.cc rrset.cc name.h buffer.h rrset.h
+libdns_a_SOURCES = name.cc buffer.cc rrset.cc message.cc \
+ name.h buffer.h rrset.h message.h
TESTS =
if HAVE_GTEST
TESTS += run_unittests
run_unittests_SOURCES = run_unittests.cc name_unittest.cc rrset_unittest.cc
+run_unittests_SOURCES += message_unittest.cc
run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
run_unittests_LDFLAGS = $(GTEST_LDFLAGS)
run_unittests_LDADD = ./libdns.a $(GTEST_LDADD)
Modified: branches/f2f200910/src/lib/dns/buffer.cc
==============================================================================
--- branches/f2f200910/src/lib/dns/buffer.cc (original)
+++ branches/f2f200910/src/lib/dns/buffer.cc Wed Oct 28 22:14:18 2009
@@ -19,7 +19,7 @@
#include <dns/buffer.h>
-using namespace ISC;
+using ISC::SingleBuffer;
// The interface should be revisited.
int
@@ -48,4 +48,3 @@
return (cc);
}
-
Modified: branches/f2f200910/src/lib/dns/exceptions.h
==============================================================================
--- branches/f2f200910/src/lib/dns/exceptions.h (original)
+++ branches/f2f200910/src/lib/dns/exceptions.h Wed Oct 28 22:14:18 2009
@@ -37,14 +37,15 @@
class DNSBadLabelType : public DNSException {};
class DNSInvalidRRClass : public DNSException {};
class DNSInvalidRRType : public DNSException {};
-class DNSRdtypeMismatch : public DNSException {};
+class DNSRRtypeMismatch : public DNSException {};
class DNSInvalidWireRdata : public DNSException {};
-class DNSNoMessageIOBuffer : public DNSException {};
+class DNSNoMessageBuffer : public DNSException {};
class DNSNoNameCompressor : public DNSException {};
class DNSNoNameDecompressor : public DNSException {};
class DNSNoMessageParser : public DNSException {};
class DNSInvalidMessageSection : public DNSException {};
class DNSInvalidRendererPosition : public DNSException {};
+class DNSMessageTooShort : public DNSException {};
}
}
#endif // __EXCEPTIONS_HH
Modified: branches/f2f200910/src/lib/dns/rrset.cc
==============================================================================
--- branches/f2f200910/src/lib/dns/rrset.cc (original)
+++ branches/f2f200910/src/lib/dns/rrset.cc Wed Oct 28 22:14:18 2009
@@ -32,6 +32,7 @@
using ISC::DNS::Rdata::IN::AAAA;
using ISC::DNS::Rdata::Generic::NS;
using ISC::DNS::RRset;
+using ISC::DNS::Rdata::Rdata;
using ISC::DNS::Question;
using ISC::DNS::RR;
@@ -140,6 +141,12 @@
return (std::string(addrbuf));
}
+Rdata*
+A::copy() const
+{
+ return (new A(to_text()));
+}
+
AAAA::AAAA(const std::string& addrstr)
{
if (inet_pton(AF_INET6, addrstr.c_str(), &addr_) != 1)
@@ -168,6 +175,12 @@
throw std::runtime_error("unexpected inet_ntop() failure");
return (std::string(addrbuf));
+}
+
+Rdata*
+AAAA::copy() const
+{
+ return (new AAAA(to_text()));
}
void
@@ -189,6 +202,12 @@
NS::to_text() const
{
return (nsname_.to_text());
+}
+
+Rdata*
+NS::copy() const
+{
+ return (new NS(to_text()));
}
std::string
@@ -203,8 +222,8 @@
if (!s.empty())
s.push_back('\n');
s += name_.to_text() + " ";
- s += ttl_.to_text() + " " + rdclass_.to_text() + " " +
- rdtype_.to_text() + " " + (**it).to_text();
+ s += ttl_.to_text() + " " + rrclass_.to_text() + " " +
+ rrtype_.to_text() + " " + (**it).to_text();
}
return (s);
@@ -213,8 +232,8 @@
void
RRset::add_rdata(Rdata::RDATAPTR rdata)
{
- if (rdata->get_type() != rdtype_)
- throw DNSRdtypeMismatch();
+ if (rdata->get_type() != rrtype_)
+ throw DNSRRtypeMismatch();
rdatalist_.push_back(rdata);
}
@@ -233,8 +252,8 @@
++it, ++num_rrs)
{
name_.to_wire(buffer, compressor);
- rdtype_.to_wire(buffer);
- rdclass_.to_wire(buffer);
+ rrtype_.to_wire(buffer);
+ rrclass_.to_wire(buffer);
ttl_.to_wire(buffer);
(**it).to_wire(buffer, compressor);
@@ -249,16 +268,16 @@
{
// return in dig-style format. note that in the wire format class follows
// type.
- return (name_.to_text() + " " + rdclass_.to_text() + " " +
- rdtype_.to_text());
+ return (name_.to_text() + " " + rrclass_.to_text() + " " +
+ rrtype_.to_text());
}
int
Question::to_wire(Buffer& buffer, NameCompressor& compressor, section_t section)
{
name_.to_wire(buffer, compressor);
- rdtype_.to_wire(buffer);
- rdclass_.to_wire(buffer);
+ rrtype_.to_wire(buffer);
+ rrclass_.to_wire(buffer);
return (1);
}
Modified: branches/f2f200910/src/lib/dns/rrset.h
==============================================================================
--- branches/f2f200910/src/lib/dns/rrset.h (original)
+++ branches/f2f200910/src/lib/dns/rrset.h Wed Oct 28 22:14:18 2009
@@ -54,7 +54,7 @@
bool operator!=(const RRClass& other) const
{ return (classval_ != other.classval_); }
- // (Some) well-known Rdclass constants
+ // (Some) well-known RRclass constants
static const RRClass IN;
static const RRClass CH;
private:
@@ -74,7 +74,7 @@
bool operator!=(const RRType& other) const
{ return (typeval_ != other.typeval_); }
- // (Some) Well-known Rdtype constants
+ // (Some) Well-known RRtype constants
static const RRType A;
static const RRType NS;
static const RRType AAAA;
@@ -96,11 +96,14 @@
{ return (ttlval_ == other.ttlval_); }
bool operator!=(const TTL& other) const
{ return (ttlval_ != other.ttlval_); }
- // define the following using serial number arithmetic:
- bool operator<=(const TTL &other) const;
- bool operator>=(const TTL &other) const;
- bool operator<(const TTL &other) const;
- bool operator>(const TTL &other) const;
+ bool operator<=(const TTL &other) const
+ { return (ttlval_ <= other.ttlval_); }
+ bool operator>=(const TTL &other) const
+ { return (ttlval_ >= other.ttlval_); }
+ bool operator<(const TTL &other) const
+ { return (ttlval_ < other.ttlval_); }
+ bool operator>(const TTL &other) const
+ { return (ttlval_ > other.ttlval_); }
private:
uint32_t ttlval_;
};
@@ -126,6 +129,9 @@
virtual void to_wire(Buffer& b, NameCompressor& c) const = 0;
// need generic method for getting n-th field? c.f. ldns
// e.g. string getField(int n);
+
+ // polymorphic copy constructor (XXX should revisit it)
+ virtual Rdata* copy() const = 0;
};
namespace Generic {
@@ -144,6 +150,7 @@
bool operator==(const NS &other) const
{ return (nsname_ == other.nsname_); }
virtual bool operator!=(const NS &other) const { return !(*this == other); }
+ virtual Rdata* copy() const;
private:
Name nsname_;
};
@@ -167,6 +174,7 @@
{ return (addr_.s_addr == other.addr_.s_addr); }
virtual bool operator!=(const A &other) const
{ return !(*this == other); }
+ virtual Rdata* copy() const;
private:
// XXX: should probably define an "address class" and use it.
struct in_addr addr_;
@@ -188,6 +196,7 @@
{ return (IN6_ARE_ADDR_EQUAL(&addr_, &other.addr_)); }
virtual bool operator!=(const AAAA &other) const
{ return !(*this == other); }
+ virtual Rdata* copy() const;
private:
// XXX: should probably define an "address class" and use it.
struct in6_addr addr_;
@@ -199,6 +208,12 @@
// of) DNS message would consist of a list of RRsets.
// This is a primary class internally used in our major software such as name
// servers.
+//
+// Note about terminology: there has been a discussion at the IETF namedroppers
+// ML about RRset vs RRSet (case of "s"). While RFC2181 uses the latter,
+// many other RFCs use the former, and most of the list members who showed
+// their opinion seem to prefer RRset. We follow that preference in this
+// implementation.
//
// Open Issues:
// - add more set-like operations, e.g, merge?
@@ -217,54 +232,67 @@
virtual std::string to_text() const = 0;
virtual int to_wire(Buffer& buffer, NameCompressor& compressor,
section_t section) = 0;
+ virtual void add_rdata(Rdata::RDATAPTR rdata) = 0;
virtual unsigned int count_rdata() const = 0;
virtual const Name& get_name() const = 0;
virtual const RRClass& get_class() const = 0;
virtual const RRType& get_type() const = 0;
+ virtual const TTL& get_ttl() const = 0;
+ virtual void set_ttl(const TTL& ttl) = 0;
};
class RRset : public AbstractRRset {
public:
RRset() {}
- explicit RRset(const Name &name, const RRClass &rdclass,
- const RRType &rdtype, const TTL &ttl) :
- name_(name), rdclass_(rdclass), rdtype_(rdtype), ttl_(ttl) {}
+ explicit RRset(const Name &name, const RRClass &rrclass,
+ const RRType &rrtype, const TTL &ttl) :
+ name_(name), rrclass_(rrclass), rrtype_(rrtype), ttl_(ttl) {}
unsigned int count_rdata() const { return (rdatalist_.size()); }
void add_rdata(Rdata::RDATAPTR rdata);
void remove_rdata(const Rdata::Rdata& rdata);
std::string to_text() const;
int to_wire(Buffer& buffer, NameCompressor& compressor, section_t section);
const Name& get_name() const { return (name_); }
- const RRClass& get_class() const { return (rdclass_); }
- const RRType& get_type() const { return (rdtype_); }
+ const RRClass& get_class() const { return (rrclass_); }
+ const RRType& get_type() const { return (rrtype_); }
const TTL& get_ttl() const { return (ttl_); }
+ // once constructed, only TTL and rdatalist can be modified.
+ void set_ttl(const TTL& ttl) { ttl_ = ttl; }
+ const std::vector<Rdata::RDATAPTR>& get_rdatalist() const
+ { return (rdatalist_); }
template <typename T> void get_rdatalist(std::vector<T>&) const;
private:
Name name_;
- RRClass rdclass_;
- RRType rdtype_;
+ RRClass rrclass_;
+ RRType rrtype_;
TTL ttl_;
std::vector<Rdata::RDATAPTR> rdatalist_;
};
//
// Generic Question section entry
+// XXX: it seems to be not a good idea to inherit from RRset. We should
+// probably re-define it as a separate class.
//
class Question : public AbstractRRset {
public:
- explicit Question(const Name& name, const RRClass& rdclass,
- const RRType& rdtype) :
- name_(name), rdclass_(rdclass), rdtype_(rdtype) {}
+ explicit Question(const Name& name, const RRClass& rrclass,
+ const RRType& rrtype) :
+ name_(name), rrclass_(rrclass), rrtype_(rrtype), ttl_(0) {}
std::string to_text() const;
int to_wire(Buffer& buffer, NameCompressor& compressor, section_t section);
unsigned int count_rdata() const { return (0); }
- const Name& get_name() const { return (name_); }
- const RRClass& get_class() const { return (rdclass_); }
- const RRType& get_type() const { return (rdtype_); }
+ const Name& get_name() const { return (name_); }
+ const RRClass& get_class() const { return (rrclass_); }
+ const RRType& get_type() const { return (rrtype_); }
+ const TTL& get_ttl() const { return (ttl_); } // XXX
+ void set_ttl(const TTL& ttl) {} // XXX
+ void add_rdata(Rdata::RDATAPTR rdata) {} // XXX
private:
Name name_;
- RRClass rdclass_;
- RRType rdtype_;
+ RRClass rrclass_;
+ RRType rrtype_;
+ TTL ttl_;
};
// TBD: this interface should be revisited.
@@ -276,7 +304,7 @@
for (it = rdatalist_.begin(); it != rdatalist_.end(); ++it) {
const T& concreteRdata = static_cast<const T&>(**it); // XXX
if (T::get_type_static() != (**it).get_type()) {
- throw DNSRdtypeMismatch();
+ throw DNSRRtypeMismatch();
}
v.push_back(concreteRdata);
}
@@ -291,14 +319,17 @@
public:
RR() {}
explicit RR(const std::string& rrstr);
- explicit RR(const Name& name, const RRClass& rdclass,
- const RRType& rdtype, const TTL& ttl,
+ explicit RR(const Name& name, const RRClass& rrclass,
+ const RRType& rrtype, const TTL& ttl,
const Rdata::Rdata& rdata);
std::string to_text() const { return (rrset_.to_text()); }
const Name& get_name() const { return (rrset_.get_name()); }
const RRClass& get_class() const { return (rrset_.get_class()); }
const RRType& get_type() const { return (rrset_.get_type()); }
const TTL& get_ttl() const { return (rrset_.get_ttl()); }
+ const Rdata::RDATAPTR get_rdata() const
+ { return (*rrset_.get_rdatalist().begin()); }
+ void set_ttl(const TTL& ttl) { rrset_.set_ttl(ttl); }
private:
// An RR is (could be) actually implemented as an RRset containing at most
// one RR.
@@ -311,4 +342,3 @@
// Local Variables:
// mode: c++
// End:
-
More information about the bind10-changes
mailing list