DNSTAP_OBJ=@DNSTAP_OBJ@
WITH_PYTHONMODULE=@WITH_PYTHONMODULE@
WITH_PYUNBOUND=@WITH_PYUNBOUND@
+PY_MAJOR_VERSION=@PY_MAJOR_VERSION@
PYTHON_SITE_PKG=@PYTHON_SITE_PKG@
PYTHONMOD_INSTALL=@PYTHONMOD_INSTALL@
PYTHONMOD_UNINSTALL=@PYTHONMOD_UNINSTALL@
compat/strlcpy.c compat/strptime.c compat/getentropy_linux.c \
compat/getentropy_osx.c compat/getentropy_solaris.c compat/getentropy_win.c \
compat/explicit_bzero.c compat/arc4random.c compat/arc4random_uniform.c \
-compat/arc4_lock.c compat/sha512.c
+compat/arc4_lock.c compat/sha512.c compat/reallocarray.c
COMPAT_OBJ=$(LIBOBJS:.o=.lo)
COMPAT_OBJ_WITHOUT_CTIME=$(LIBOBJ_WITHOUT_CTIME:.o=.lo)
COMPAT_OBJ_WITHOUT_CTIMEARC4=$(LIBOBJ_WITHOUT_CTIMEARC4:.o=.lo)
-SLDNS_SRC=ldns/keyraw.c ldns/sbuffer.c ldns/wire2str.c ldns/parse.c \
-ldns/parseutil.c ldns/rrdef.c ldns/str2wire.c
+SLDNS_SRC=sldns/keyraw.c sldns/sbuffer.c sldns/wire2str.c sldns/parse.c \
+sldns/parseutil.c sldns/rrdef.c sldns/str2wire.c
SLDNS_OBJ=keyraw.lo sbuffer.lo wire2str.lo parse.lo parseutil.lo rrdef.lo \
str2wire.lo
UNITTEST_SRC=testcode/unitanchor.c testcode/unitdname.c \
unbound.h
libunbound/python/libunbound_wrap.c: $(srcdir)/libunbound/python/libunbound.i unbound.h
@-if test ! -d libunbound/python; then $(INSTALL) -d libunbound/python; fi
- $(SWIG) -python -o $@ $(CPPFLAGS) $(srcdir)/libunbound/python/libunbound.i
+ $(SWIG) -python -o $@ $(CPPFLAGS) -DPY_MAJOR_VERSION=$(PY_MAJOR_VERSION) $(srcdir)/libunbound/python/libunbound.i
# Pyunbound python unbound wrapper
_unbound.la: libunbound_wrap.lo libunbound.la
$(srcdir)/validator/val_nsec.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
$(srcdir)/util/locks.h $(srcdir)/services/cache/dns.h $(srcdir)/util/data/msgreply.h \
$(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/data/dname.h \
- $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h \
- $(srcdir)/util/net_help.h $(srcdir)/util/regional.h $(srcdir)/util/config_file.h $(srcdir)/ldns/sbuffer.h
-infra.lo infra.o: $(srcdir)/services/cache/infra.c config.h $(srcdir)/ldns/rrdef.h \
+ $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \
+ $(srcdir)/util/net_help.h $(srcdir)/util/regional.h $(srcdir)/util/config_file.h $(srcdir)/sldns/sbuffer.h
+infra.lo infra.o: $(srcdir)/services/cache/infra.c config.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/str2wire.h \
$(srcdir)/services/cache/infra.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
- $(srcdir)/util/rtt.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lookup3.h \
- $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/iterator/iterator.h \
- $(srcdir)/services/outbound_list.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \
- $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h
+ $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h $(srcdir)/util/storage/slabhash.h \
+ $(srcdir)/util/storage/lookup3.h $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h \
+ $(srcdir)/util/config_file.h $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h \
+ $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/module.h \
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h
rrset.lo rrset.o: $(srcdir)/services/cache/rrset.c config.h $(srcdir)/services/cache/rrset.h \
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/storage/slabhash.h \
- $(srcdir)/util/data/packed_rrset.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/config_file.h \
+ $(srcdir)/util/data/packed_rrset.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/config_file.h \
$(srcdir)/util/data/msgreply.h $(srcdir)/util/regional.h $(srcdir)/util/alloc.h
dname.lo dname.o: $(srcdir)/util/data/dname.c config.h $(srcdir)/util/data/dname.h \
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgparse.h \
- $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/storage/lookup3.h $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/storage/lookup3.h $(srcdir)/sldns/sbuffer.h
msgencode.lo msgencode.o: $(srcdir)/util/data/msgencode.c config.h $(srcdir)/util/data/msgencode.h \
$(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
- $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h \
- $(srcdir)/util/data/dname.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/dname.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h \
+ $(srcdir)/sldns/sbuffer.h
msgparse.lo msgparse.o: $(srcdir)/util/data/msgparse.c config.h $(srcdir)/util/data/msgparse.h \
- $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/ldns/pkthdr.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/util/data/dname.h $(srcdir)/util/data/packed_rrset.h \
- $(srcdir)/util/storage/lookup3.h $(srcdir)/util/regional.h $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/parseutil.h \
- $(srcdir)/ldns/wire2str.h
+ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/dname.h $(srcdir)/util/data/packed_rrset.h \
+ $(srcdir)/util/storage/lookup3.h $(srcdir)/util/regional.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/parseutil.h \
+ $(srcdir)/sldns/wire2str.h
msgreply.lo msgreply.o: $(srcdir)/util/data/msgreply.c config.h $(srcdir)/util/data/msgreply.h \
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/packed_rrset.h \
$(srcdir)/util/storage/lookup3.h $(srcdir)/util/alloc.h $(srcdir)/util/netevent.h $(srcdir)/util/net_help.h \
- $(srcdir)/util/data/dname.h $(srcdir)/util/regional.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/util/data/msgencode.h $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/wire2str.h
+ $(srcdir)/util/data/dname.h $(srcdir)/util/regional.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgencode.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/wire2str.h
packed_rrset.lo packed_rrset.o: $(srcdir)/util/data/packed_rrset.c config.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/util/data/dname.h $(srcdir)/util/storage/lookup3.h $(srcdir)/util/alloc.h $(srcdir)/util/regional.h \
- $(srcdir)/util/net_help.h $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/wire2str.h
+ $(srcdir)/util/net_help.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/wire2str.h
iterator.lo iterator.o: $(srcdir)/iterator/iterator.c config.h $(srcdir)/iterator/iterator.h \
$(srcdir)/services/outbound_list.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h \
$(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/module.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/iterator/iter_utils.h \
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/iterator/iter_utils.h \
$(srcdir)/iterator/iter_resptype.h $(srcdir)/iterator/iter_hints.h $(srcdir)/util/storage/dnstree.h \
$(srcdir)/util/rbtree.h $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_donotq.h \
$(srcdir)/iterator/iter_delegpt.h $(srcdir)/iterator/iter_scrub.h $(srcdir)/iterator/iter_priv.h \
$(srcdir)/validator/val_neg.h $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/infra.h \
$(srcdir)/util/rtt.h $(srcdir)/util/netevent.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h \
$(srcdir)/util/data/dname.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h \
- $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h $(srcdir)/util/config_file.h $(srcdir)/ldns/wire2str.h \
- $(srcdir)/ldns/parseutil.h $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h $(srcdir)/util/config_file.h $(srcdir)/util/random.h \
+ $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/sbuffer.h
iter_delegpt.lo iter_delegpt.o: $(srcdir)/iterator/iter_delegpt.c config.h $(srcdir)/iterator/iter_delegpt.h \
$(srcdir)/util/log.h $(srcdir)/services/cache/dns.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \
$(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/regional.h \
- $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/sbuffer.h
iter_donotq.lo iter_donotq.o: $(srcdir)/iterator/iter_donotq.c config.h $(srcdir)/iterator/iter_donotq.h \
$(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/regional.h $(srcdir)/util/log.h \
$(srcdir)/util/config_file.h $(srcdir)/util/net_help.h
iter_fwd.lo iter_fwd.o: $(srcdir)/iterator/iter_fwd.c config.h $(srcdir)/iterator/iter_fwd.h \
$(srcdir)/util/rbtree.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/util/log.h $(srcdir)/util/config_file.h \
$(srcdir)/util/net_help.h $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/str2wire.h
+ $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/str2wire.h
iter_hints.lo iter_hints.o: $(srcdir)/iterator/iter_hints.c config.h $(srcdir)/iterator/iter_hints.h \
$(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/util/log.h \
$(srcdir)/util/config_file.h $(srcdir)/util/net_help.h $(srcdir)/util/data/dname.h \
- $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/str2wire.h \
- $(srcdir)/ldns/wire2str.h
+ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/str2wire.h \
+ $(srcdir)/sldns/wire2str.h
iter_priv.lo iter_priv.o: $(srcdir)/iterator/iter_priv.c config.h $(srcdir)/iterator/iter_priv.h \
$(srcdir)/util/rbtree.h $(srcdir)/util/regional.h $(srcdir)/util/log.h $(srcdir)/util/config_file.h \
$(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/net_help.h \
- $(srcdir)/util/storage/dnstree.h $(srcdir)/ldns/str2wire.h $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/net_help.h \
+ $(srcdir)/util/storage/dnstree.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/sbuffer.h
iter_resptype.lo iter_resptype.o: $(srcdir)/iterator/iter_resptype.c config.h \
$(srcdir)/iterator/iter_resptype.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/util/log.h \
$(srcdir)/services/cache/dns.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \
$(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/net_help.h \
- $(srcdir)/util/data/dname.h $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/pkthdr.h
+ $(srcdir)/util/data/dname.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/pkthdr.h
iter_scrub.lo iter_scrub.o: $(srcdir)/iterator/iter_scrub.c config.h $(srcdir)/iterator/iter_scrub.h \
$(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/util/data/msgreply.h \
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/packed_rrset.h \
- $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h \
+ $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \
$(srcdir)/iterator/iter_priv.h $(srcdir)/util/rbtree.h $(srcdir)/services/cache/rrset.h \
$(srcdir)/util/storage/slabhash.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h \
- $(srcdir)/util/config_file.h $(srcdir)/util/data/dname.h $(srcdir)/util/alloc.h $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/util/config_file.h $(srcdir)/util/data/dname.h $(srcdir)/util/alloc.h $(srcdir)/sldns/sbuffer.h
iter_utils.lo iter_utils.o: $(srcdir)/iterator/iter_utils.c config.h $(srcdir)/iterator/iter_utils.h \
$(srcdir)/iterator/iter_resptype.h $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h \
$(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h \
- $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/iterator/iter_hints.h $(srcdir)/util/storage/dnstree.h \
- $(srcdir)/util/rbtree.h $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_donotq.h \
- $(srcdir)/iterator/iter_delegpt.h $(srcdir)/iterator/iter_priv.h $(srcdir)/services/cache/infra.h \
- $(srcdir)/util/rtt.h $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/rrset.h \
- $(srcdir)/util/storage/slabhash.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h \
- $(srcdir)/util/regional.h $(srcdir)/util/data/dname.h $(srcdir)/util/random.h $(srcdir)/util/fptr_wlist.h \
- $(srcdir)/util/netevent.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h \
- $(srcdir)/validator/val_anchor.h $(srcdir)/validator/val_kcache.h $(srcdir)/validator/val_kentry.h \
- $(srcdir)/validator/val_utils.h $(srcdir)/validator/val_sigcrypt.h $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/iterator/iter_hints.h \
+ $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/iterator/iter_fwd.h \
+ $(srcdir)/iterator/iter_donotq.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/iterator/iter_priv.h \
+ $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/services/cache/dns.h \
+ $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/net_help.h \
+ $(srcdir)/util/config_file.h $(srcdir)/util/regional.h $(srcdir)/util/data/dname.h $(srcdir)/util/random.h \
+ $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h \
+ $(srcdir)/services/modstack.h $(srcdir)/validator/val_anchor.h $(srcdir)/validator/val_kcache.h \
+ $(srcdir)/validator/val_kentry.h $(srcdir)/validator/val_utils.h $(srcdir)/validator/val_sigcrypt.h \
+ $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/str2wire.h
listen_dnsport.lo listen_dnsport.o: $(srcdir)/services/listen_dnsport.c config.h \
$(srcdir)/services/listen_dnsport.h $(srcdir)/util/netevent.h $(srcdir)/services/outside_network.h \
$(srcdir)/util/rbtree.h $(srcdir)/util/log.h $(srcdir)/util/config_file.h \
- $(srcdir)/util/net_help.h $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/util/net_help.h $(srcdir)/sldns/sbuffer.h
localzone.lo localzone.o: $(srcdir)/services/localzone.c config.h $(srcdir)/services/localzone.h \
- $(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/ldns/str2wire.h $(srcdir)/ldns/rrdef.h \
- $(srcdir)/ldns/sbuffer.h $(srcdir)/util/regional.h $(srcdir)/util/config_file.h $(srcdir)/util/data/dname.h \
+ $(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/rrdef.h \
+ $(srcdir)/sldns/sbuffer.h $(srcdir)/util/regional.h $(srcdir)/util/config_file.h $(srcdir)/util/data/dname.h \
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgencode.h \
$(srcdir)/util/net_help.h $(srcdir)/util/netevent.h $(srcdir)/util/data/msgreply.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h
mesh.lo mesh.o: $(srcdir)/services/mesh.c config.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \
$(srcdir)/util/netevent.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \
- $(srcdir)/util/log.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \
- $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/modstack.h $(srcdir)/services/outbound_list.h \
- $(srcdir)/services/cache/dns.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h \
- $(srcdir)/util/data/msgencode.h $(srcdir)/util/timehist.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h \
- $(srcdir)/util/alloc.h $(srcdir)/util/config_file.h $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/util/log.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h \
+ $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/modstack.h \
+ $(srcdir)/services/outbound_list.h $(srcdir)/services/cache/dns.h $(srcdir)/util/net_help.h \
+ $(srcdir)/util/regional.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/timehist.h $(srcdir)/util/fptr_wlist.h \
+ $(srcdir)/util/tube.h $(srcdir)/util/alloc.h $(srcdir)/util/config_file.h $(srcdir)/sldns/sbuffer.h
modstack.lo modstack.o: $(srcdir)/services/modstack.c config.h $(srcdir)/services/modstack.h \
$(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \
- $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/util/tube.h \
- $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/dns64/dns64.h $(srcdir)/iterator/iterator.h \
- $(srcdir)/services/outbound_list.h $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h
+ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h \
+ $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/dns64/dns64.h \
+ $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/validator/validator.h \
+ $(srcdir)/validator/val_utils.h
outbound_list.lo outbound_list.o: $(srcdir)/services/outbound_list.c config.h \
$(srcdir)/services/outbound_list.h $(srcdir)/services/outside_network.h $(srcdir)/util/rbtree.h \
$(srcdir)/util/netevent.h
outside_network.lo outside_network.o: $(srcdir)/services/outside_network.c config.h \
$(srcdir)/services/outside_network.h $(srcdir)/util/rbtree.h $(srcdir)/util/netevent.h \
$(srcdir)/services/listen_dnsport.h $(srcdir)/services/cache/infra.h \
- $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/rtt.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/data/msgreply.h \
- $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/data/dname.h \
- $(srcdir)/util/net_help.h $(srcdir)/util/random.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/module.h \
- $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h $(srcdir)/ldns/sbuffer.h \
- $(srcdir)/dnstap/dnstap.h \
+ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/storage/dnstree.h \
+ $(srcdir)/util/rtt.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \
+ $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgencode.h \
+ $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/random.h $(srcdir)/util/fptr_wlist.h \
+ $(srcdir)/util/module.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h \
+ $(srcdir)/sldns/sbuffer.h $(srcdir)/dnstap/dnstap.h \
alloc.lo alloc.o: $(srcdir)/util/alloc.c config.h $(srcdir)/util/alloc.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/util/regional.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
$(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/tube.h \
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \
$(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h
config_file.lo config_file.o: $(srcdir)/util/config_file.c config.h $(srcdir)/util/log.h \
$(srcdir)/util/configyyrename.h $(srcdir)/util/config_file.h util/configparser.h \
$(srcdir)/util/net_help.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \
- $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \
+ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/regional.h $(srcdir)/util/fptr_wlist.h \
$(srcdir)/util/netevent.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \
- $(srcdir)/services/modstack.h $(srcdir)/util/data/dname.h $(srcdir)/util/rtt.h $(srcdir)/ldns/wire2str.h \
- $(srcdir)/ldns/parseutil.h $(srcdir)/util/iana_ports.inc
+ $(srcdir)/services/modstack.h $(srcdir)/util/data/dname.h $(srcdir)/util/rtt.h $(srcdir)/services/cache/infra.h \
+ $(srcdir)/util/storage/dnstree.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/parseutil.h \
+ $(srcdir)/util/iana_ports.inc
configlexer.lo configlexer.o: util/configlexer.c config.h $(srcdir)/util/configyyrename.h \
$(srcdir)/util/config_file.h util/configparser.h
configparser.lo configparser.o: util/configparser.c config.h $(srcdir)/util/configyyrename.h \
fptr_wlist.lo fptr_wlist.o: $(srcdir)/util/fptr_wlist.c config.h $(srcdir)/util/fptr_wlist.h \
$(srcdir)/util/netevent.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/tube.h \
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \
$(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/util/mini_event.h \
$(srcdir)/util/rbtree.h $(srcdir)/services/outside_network.h \
- $(srcdir)/services/localzone.h $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h \
- $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/dns64/dns64.h \
+ $(srcdir)/services/localzone.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \
+ $(srcdir)/util/rtt.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/dns64/dns64.h \
$(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_fwd.h \
$(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h $(srcdir)/validator/val_anchor.h \
$(srcdir)/validator/val_nsec3.h $(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/val_kentry.h \
- $(srcdir)/validator/val_neg.h $(srcdir)/validator/autotrust.h $(srcdir)/util/storage/dnstree.h \
- $(srcdir)/libunbound/libworker.h $(srcdir)/libunbound/context.h $(srcdir)/util/alloc.h \
- $(srcdir)/libunbound/unbound.h $(srcdir)/libunbound/worker.h $(srcdir)/ldns/sbuffer.h \
- $(srcdir)/util/config_file.h
+ $(srcdir)/validator/val_neg.h $(srcdir)/validator/autotrust.h $(srcdir)/libunbound/libworker.h \
+ $(srcdir)/libunbound/context.h $(srcdir)/util/alloc.h $(srcdir)/libunbound/unbound.h \
+ $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/config_file.h
locks.lo locks.o: $(srcdir)/util/locks.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h
-log.lo log.o: $(srcdir)/util/log.c config.h $(srcdir)/util/log.h $(srcdir)/util/locks.h $(srcdir)/ldns/sbuffer.h
+log.lo log.o: $(srcdir)/util/log.c config.h $(srcdir)/util/log.h $(srcdir)/util/locks.h $(srcdir)/sldns/sbuffer.h
mini_event.lo mini_event.o: $(srcdir)/util/mini_event.c config.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h \
$(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \
$(srcdir)/util/log.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/tube.h \
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \
$(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h
module.lo module.o: $(srcdir)/util/module.c config.h $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h \
$(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h
netevent.lo netevent.o: $(srcdir)/util/netevent.c config.h $(srcdir)/util/netevent.h $(srcdir)/util/log.h \
$(srcdir)/util/net_help.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \
$(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/tube.h \
- $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/ldns/sbuffer.h \
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \
+ $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/sldns/sbuffer.h \
$(srcdir)/dnstap/dnstap.h \
$(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h
net_help.lo net_help.o: $(srcdir)/util/net_help.c config.h $(srcdir)/util/net_help.h $(srcdir)/util/log.h \
$(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/module.h \
$(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \
- $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/regional.h $(srcdir)/ldns/parseutil.h \
- $(srcdir)/ldns/wire2str.h \
+ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/regional.h $(srcdir)/sldns/parseutil.h \
+ $(srcdir)/sldns/wire2str.h \
random.lo random.o: $(srcdir)/util/random.c config.h $(srcdir)/util/random.h $(srcdir)/util/log.h
rbtree.lo rbtree.o: $(srcdir)/util/rbtree.c config.h $(srcdir)/util/log.h $(srcdir)/util/fptr_wlist.h \
$(srcdir)/util/netevent.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/tube.h \
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \
$(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h
regional.lo regional.o: $(srcdir)/util/regional.c config.h $(srcdir)/util/log.h $(srcdir)/util/regional.h
rtt.lo rtt.o: $(srcdir)/util/rtt.c config.h $(srcdir)/util/rtt.h
lruhash.lo lruhash.o: $(srcdir)/util/storage/lruhash.c config.h $(srcdir)/util/storage/lruhash.h \
$(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/util/module.h \
$(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \
- $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \
+ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \
$(srcdir)/services/modstack.h
slabhash.lo slabhash.o: $(srcdir)/util/storage/slabhash.c config.h $(srcdir)/util/storage/slabhash.h \
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h
tube.lo tube.o: $(srcdir)/util/tube.c config.h $(srcdir)/util/tube.h $(srcdir)/util/log.h $(srcdir)/util/net_help.h \
$(srcdir)/util/netevent.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \
$(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/services/mesh.h \
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/services/mesh.h \
$(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h
winsock_event.lo winsock_event.o: $(srcdir)/util/winsock_event.c config.h
autotrust.lo autotrust.o: $(srcdir)/validator/autotrust.c config.h $(srcdir)/validator/autotrust.h \
$(srcdir)/util/rbtree.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
$(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/validator/val_anchor.h $(srcdir)/validator/val_utils.h \
$(srcdir)/validator/val_sigcrypt.h $(srcdir)/util/data/dname.h $(srcdir)/util/module.h \
- $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h \
+ $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \
$(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/util/regional.h $(srcdir)/util/random.h \
$(srcdir)/services/mesh.h $(srcdir)/util/netevent.h $(srcdir)/services/modstack.h \
$(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/validator/val_kcache.h \
- $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/wire2str.h $(srcdir)/ldns/str2wire.h $(srcdir)/ldns/keyraw.h \
+ $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/keyraw.h \
val_anchor.lo val_anchor.o: $(srcdir)/validator/val_anchor.c config.h $(srcdir)/validator/val_anchor.h \
$(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/validator/val_sigcrypt.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/validator/autotrust.h \
- $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/ldns/sbuffer.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/str2wire.h
+ $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/sldns/sbuffer.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/str2wire.h
validator.lo validator.o: $(srcdir)/validator/validator.c config.h $(srcdir)/validator/validator.h \
$(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \
- $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/validator/val_utils.h $(srcdir)/validator/val_anchor.h \
- $(srcdir)/util/rbtree.h $(srcdir)/validator/val_kcache.h $(srcdir)/util/storage/slabhash.h \
- $(srcdir)/validator/val_kentry.h $(srcdir)/validator/val_nsec.h $(srcdir)/validator/val_nsec3.h \
- $(srcdir)/validator/val_neg.h $(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/autotrust.h \
- $(srcdir)/services/cache/dns.h $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h \
- $(srcdir)/util/config_file.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/util/tube.h \
- $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h $(srcdir)/ldns/wire2str.h
+ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/validator/val_utils.h \
+ $(srcdir)/validator/val_anchor.h $(srcdir)/util/rbtree.h $(srcdir)/validator/val_kcache.h \
+ $(srcdir)/util/storage/slabhash.h $(srcdir)/validator/val_kentry.h $(srcdir)/validator/val_nsec.h \
+ $(srcdir)/validator/val_nsec3.h $(srcdir)/validator/val_neg.h $(srcdir)/validator/val_sigcrypt.h \
+ $(srcdir)/validator/autotrust.h $(srcdir)/services/cache/dns.h $(srcdir)/util/data/dname.h \
+ $(srcdir)/util/net_help.h $(srcdir)/util/regional.h $(srcdir)/util/config_file.h $(srcdir)/util/fptr_wlist.h \
+ $(srcdir)/util/netevent.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h \
+ $(srcdir)/sldns/wire2str.h
val_kcache.lo val_kcache.o: $(srcdir)/validator/val_kcache.c config.h $(srcdir)/validator/val_kcache.h \
$(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/validator/val_kentry.h $(srcdir)/util/config_file.h $(srcdir)/util/data/dname.h \
$(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h
val_kentry.lo val_kentry.o: $(srcdir)/validator/val_kentry.c config.h $(srcdir)/validator/val_kentry.h \
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/packed_rrset.h \
$(srcdir)/util/data/dname.h $(srcdir)/util/storage/lookup3.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/keyraw.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/keyraw.h \
val_neg.lo val_neg.o: $(srcdir)/validator/val_neg.c config.h \
$(srcdir)/validator/val_neg.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/rbtree.h \
$(srcdir)/validator/val_nsec3.h $(srcdir)/validator/val_utils.h $(srcdir)/util/data/dname.h \
$(srcdir)/util/data/msgreply.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h \
$(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/dns.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/sbuffer.h
val_nsec3.lo val_nsec3.o: $(srcdir)/validator/val_nsec3.c config.h \
$(srcdir)/validator/val_nsec3.h $(srcdir)/util/rbtree.h $(srcdir)/util/data/packed_rrset.h \
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/validator/validator.h \
- $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/validator/val_utils.h $(srcdir)/validator/val_kentry.h \
+ $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/validator/val_utils.h $(srcdir)/validator/val_kentry.h \
$(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/regional.h \
- $(srcdir)/util/net_help.h $(srcdir)/util/data/dname.h $(srcdir)/validator/val_nsec.h $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/util/net_help.h $(srcdir)/util/data/dname.h $(srcdir)/validator/val_nsec.h $(srcdir)/sldns/sbuffer.h
val_nsec.lo val_nsec.o: $(srcdir)/validator/val_nsec.c config.h $(srcdir)/validator/val_nsec.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/validator/val_utils.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/dname.h \
- $(srcdir)/util/net_help.h $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h
+ $(srcdir)/util/net_help.h $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h
val_secalgo.lo val_secalgo.o: $(srcdir)/validator/val_secalgo.c config.h $(srcdir)/util/data/packed_rrset.h \
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/validator/val_secalgo.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/keyraw.h \
- $(srcdir)/ldns/sbuffer.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/keyraw.h \
+ $(srcdir)/sldns/sbuffer.h \
val_sigcrypt.lo val_sigcrypt.o: $(srcdir)/validator/val_sigcrypt.c config.h \
$(srcdir)/validator/val_sigcrypt.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
$(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/validator/val_secalgo.h $(srcdir)/validator/validator.h \
- $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/validator/val_utils.h $(srcdir)/util/data/dname.h $(srcdir)/util/rbtree.h \
- $(srcdir)/util/net_help.h $(srcdir)/util/regional.h $(srcdir)/ldns/keyraw.h \
- $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/parseutil.h $(srcdir)/ldns/wire2str.h \
+ $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/validator/val_utils.h $(srcdir)/util/data/dname.h $(srcdir)/util/rbtree.h \
+ $(srcdir)/util/net_help.h $(srcdir)/util/regional.h $(srcdir)/sldns/keyraw.h \
+ $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/wire2str.h \
val_utils.lo val_utils.o: $(srcdir)/validator/val_utils.c config.h $(srcdir)/validator/val_utils.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/validator/validator.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/validator/val_kentry.h \
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/validator/val_kentry.h \
$(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/val_anchor.h $(srcdir)/util/rbtree.h \
$(srcdir)/validator/val_nsec.h $(srcdir)/validator/val_neg.h $(srcdir)/services/cache/rrset.h \
$(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/dns.h $(srcdir)/util/data/dname.h \
$(srcdir)/util/net_help.h $(srcdir)/util/regional.h
dns64.lo dns64.o: $(srcdir)/dns64/dns64.c config.h $(srcdir)/dns64/dns64.h $(srcdir)/util/module.h \
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h \
- $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h \
- $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \
- $(srcdir)/util/config_file.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/util/tube.h \
- $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/util/net_help.h \
- $(srcdir)/util/regional.h
+ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/rrset.h \
+ $(srcdir)/util/storage/slabhash.h $(srcdir)/util/config_file.h $(srcdir)/util/fptr_wlist.h \
+ $(srcdir)/util/netevent.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \
+ $(srcdir)/services/modstack.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h
checklocks.lo checklocks.o: $(srcdir)/testcode/checklocks.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/testcode/checklocks.h
-dnstap.lo dnstap.o: $(srcdir)/dnstap/dnstap.c config.h $(srcdir)/ldns/sbuffer.h \
+dnstap.lo dnstap.o: $(srcdir)/dnstap/dnstap.c config.h $(srcdir)/sldns/sbuffer.h \
$(srcdir)/util/config_file.h $(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/util/netevent.h \
$(srcdir)/dnstap/dnstap.h \
$(srcdir)/dnstap/dnstap.pb-c.h
dnstap.pb-c.lo dnstap.pb-c.o: $(srcdir)/dnstap/dnstap.pb-c.c $(srcdir)/dnstap/dnstap.pb-c.h
unitanchor.lo unitanchor.o: $(srcdir)/testcode/unitanchor.c config.h $(srcdir)/util/log.h $(srcdir)/util/data/dname.h \
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/testcode/unitmain.h \
- $(srcdir)/validator/val_anchor.h $(srcdir)/util/rbtree.h $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/rrdef.h
+ $(srcdir)/validator/val_anchor.h $(srcdir)/util/rbtree.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/rrdef.h
unitdname.lo unitdname.o: $(srcdir)/testcode/unitdname.c config.h $(srcdir)/util/log.h $(srcdir)/testcode/unitmain.h \
- $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/ldns/sbuffer.h \
- $(srcdir)/ldns/str2wire.h $(srcdir)/ldns/rrdef.h
+ $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/sldns/sbuffer.h \
+ $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/rrdef.h
unitlruhash.lo unitlruhash.o: $(srcdir)/testcode/unitlruhash.c config.h $(srcdir)/testcode/unitmain.h \
$(srcdir)/util/log.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/storage/slabhash.h
unitmain.lo unitmain.o: $(srcdir)/testcode/unitmain.c config.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/keyraw.h \
- $(srcdir)/util/log.h \
- $(srcdir)/testcode/unitmain.h $(srcdir)/util/alloc.h $(srcdir)/util/locks.h $(srcdir)/util/net_help.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/keyraw.h \
+ $(srcdir)/util/log.h $(srcdir)/testcode/unitmain.h $(srcdir)/util/alloc.h $(srcdir)/util/locks.h $(srcdir)/util/net_help.h \
$(srcdir)/util/config_file.h $(srcdir)/util/rtt.h $(srcdir)/services/cache/infra.h \
- $(srcdir)/util/storage/lruhash.h $(srcdir)/util/random.h
+ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h \
+ $(srcdir)/util/random.h
unitmsgparse.lo unitmsgparse.o: $(srcdir)/testcode/unitmsgparse.c config.h $(srcdir)/util/log.h \
$(srcdir)/testcode/unitmain.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h \
- $(srcdir)/util/locks.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/data/msgreply.h \
+ $(srcdir)/util/locks.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgreply.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/data/dname.h \
$(srcdir)/util/alloc.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h $(srcdir)/testcode/readhex.h \
- $(srcdir)/testcode/testpkts.h $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/str2wire.h $(srcdir)/ldns/wire2str.h
+ $(srcdir)/testcode/testpkts.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/wire2str.h
unitneg.lo unitneg.o: $(srcdir)/testcode/unitneg.c config.h $(srcdir)/util/log.h $(srcdir)/util/net_help.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \
$(srcdir)/util/data/dname.h $(srcdir)/testcode/unitmain.h $(srcdir)/validator/val_neg.h $(srcdir)/util/rbtree.h \
- $(srcdir)/ldns/rrdef.h
+ $(srcdir)/sldns/rrdef.h
unitregional.lo unitregional.o: $(srcdir)/testcode/unitregional.c config.h $(srcdir)/testcode/unitmain.h \
$(srcdir)/util/log.h $(srcdir)/util/regional.h
unitslabhash.lo unitslabhash.o: $(srcdir)/testcode/unitslabhash.c config.h $(srcdir)/testcode/unitmain.h \
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/validator/val_secalgo.h \
$(srcdir)/validator/val_nsec.h $(srcdir)/validator/val_nsec3.h $(srcdir)/util/rbtree.h \
$(srcdir)/validator/validator.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/validator/val_utils.h \
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/validator/val_utils.h \
$(srcdir)/testcode/testpkts.h $(srcdir)/util/data/dname.h $(srcdir)/util/regional.h $(srcdir)/util/alloc.h \
- $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/keyraw.h \
- $(srcdir)/ldns/str2wire.h $(srcdir)/ldns/wire2str.h
+ $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/keyraw.h \
+ $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/wire2str.h
readhex.lo readhex.o: $(srcdir)/testcode/readhex.c config.h $(srcdir)/testcode/readhex.h $(srcdir)/util/log.h \
- $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/parseutil.h
+ $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/parseutil.h
testpkts.lo testpkts.o: $(srcdir)/testcode/testpkts.c config.h $(srcdir)/testcode/testpkts.h \
- $(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/pkthdr.h \
- $(srcdir)/ldns/str2wire.h $(srcdir)/ldns/wire2str.h
+ $(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/wire2str.h
unitldns.lo unitldns.o: $(srcdir)/testcode/unitldns.c config.h $(srcdir)/util/log.h $(srcdir)/testcode/unitmain.h \
- $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/str2wire.h $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/wire2str.h
+ $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/wire2str.h
acl_list.lo acl_list.o: $(srcdir)/daemon/acl_list.c config.h $(srcdir)/daemon/acl_list.h \
$(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/regional.h $(srcdir)/util/log.h \
$(srcdir)/util/config_file.h $(srcdir)/util/net_help.h
cachedump.lo cachedump.o: $(srcdir)/daemon/cachedump.c config.h \
$(srcdir)/daemon/cachedump.h $(srcdir)/daemon/remote.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h \
- $(srcdir)/ldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
+ $(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
$(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/netevent.h $(srcdir)/util/alloc.h \
- $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h \
+ $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \
$(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \
$(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \
- $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/util/regional.h \
- $(srcdir)/util/net_help.h $(srcdir)/util/data/dname.h $(srcdir)/iterator/iterator.h \
- $(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/iterator/iter_utils.h \
- $(srcdir)/iterator/iter_resptype.h $(srcdir)/iterator/iter_fwd.h $(srcdir)/util/rbtree.h \
- $(srcdir)/iterator/iter_hints.h $(srcdir)/util/storage/dnstree.h $(srcdir)/ldns/wire2str.h \
- $(srcdir)/ldns/str2wire.h
+ $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \
+ $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h \
+ $(srcdir)/util/data/dname.h $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h \
+ $(srcdir)/iterator/iter_delegpt.h $(srcdir)/iterator/iter_utils.h $(srcdir)/iterator/iter_resptype.h \
+ $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h $(srcdir)/sldns/wire2str.h \
+ $(srcdir)/sldns/str2wire.h
daemon.lo daemon.o: $(srcdir)/daemon/daemon.c config.h \
$(srcdir)/daemon/daemon.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \
$(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h \
- $(srcdir)/ldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
- $(srcdir)/util/netevent.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/util/module.h \
+ $(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
+ $(srcdir)/util/netevent.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/util/module.h \
$(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/remote.h \
$(srcdir)/daemon/acl_list.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h \
$(srcdir)/util/config_file.h $(srcdir)/util/storage/lookup3.h $(srcdir)/util/storage/slabhash.h \
$(srcdir)/services/listen_dnsport.h $(srcdir)/services/cache/rrset.h $(srcdir)/services/cache/infra.h \
$(srcdir)/util/rtt.h $(srcdir)/services/localzone.h $(srcdir)/util/random.h $(srcdir)/util/tube.h \
- $(srcdir)/util/net_help.h $(srcdir)/ldns/keyraw.h
+ $(srcdir)/util/net_help.h $(srcdir)/sldns/keyraw.h
remote.lo remote.o: $(srcdir)/daemon/remote.c config.h \
$(srcdir)/daemon/remote.h \
- $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/ldns/sbuffer.h \
+ $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/util/netevent.h $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h \
- $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/util/module.h \
- $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/daemon.h \
+ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \
+ $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/daemon.h \
$(srcdir)/services/modstack.h $(srcdir)/daemon/cachedump.h $(srcdir)/util/config_file.h \
$(srcdir)/util/net_help.h $(srcdir)/services/listen_dnsport.h $(srcdir)/services/cache/rrset.h \
- $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h \
- $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/localzone.h $(srcdir)/util/fptr_wlist.h \
- $(srcdir)/util/tube.h $(srcdir)/util/data/dname.h $(srcdir)/validator/validator.h \
+ $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \
+ $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h $(srcdir)/services/mesh.h $(srcdir)/services/localzone.h \
+ $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h $(srcdir)/util/data/dname.h $(srcdir)/validator/validator.h \
$(srcdir)/validator/val_utils.h $(srcdir)/validator/val_kcache.h $(srcdir)/validator/val_kentry.h \
$(srcdir)/validator/val_anchor.h $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h \
- $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h $(srcdir)/util/storage/dnstree.h \
- $(srcdir)/iterator/iter_delegpt.h $(srcdir)/services/outside_network.h $(srcdir)/ldns/str2wire.h \
- $(srcdir)/ldns/parseutil.h $(srcdir)/ldns/wire2str.h
+ $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h $(srcdir)/iterator/iter_delegpt.h \
+ $(srcdir)/services/outside_network.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/parseutil.h \
+ $(srcdir)/sldns/wire2str.h
stats.lo stats.o: $(srcdir)/daemon/stats.c config.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \
- $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/ldns/sbuffer.h \
+ $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/util/netevent.h $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h \
- $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \
+ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \
$(srcdir)/daemon/daemon.h $(srcdir)/services/modstack.h \
$(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/outside_network.h \
- $(srcdir)/util/config_file.h $(srcdir)/util/tube.h $(srcdir)/util/net_help.h $(srcdir)/validator/validator.h \
- $(srcdir)/validator/val_utils.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \
- $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/validator/val_kcache.h
+ $(srcdir)/services/listen_dnsport.h $(srcdir)/util/config_file.h $(srcdir)/util/tube.h $(srcdir)/util/net_help.h \
+ $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h $(srcdir)/services/cache/rrset.h \
+ $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \
+ $(srcdir)/util/rtt.h $(srcdir)/validator/val_kcache.h
unbound.lo unbound.o: $(srcdir)/daemon/unbound.c config.h $(srcdir)/util/log.h $(srcdir)/daemon/daemon.h \
$(srcdir)/util/locks.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \
$(srcdir)/daemon/remote.h \
$(srcdir)/util/config_file.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lruhash.h \
$(srcdir)/services/listen_dnsport.h $(srcdir)/util/netevent.h $(srcdir)/services/cache/rrset.h \
- $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h \
- $(srcdir)/util/fptr_wlist.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/tube.h \
- $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/util/net_help.h $(srcdir)/util/mini_event.h \
+ $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \
+ $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/module.h \
+ $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \
+ $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/net_help.h $(srcdir)/util/mini_event.h \
$(srcdir)/util/rbtree.h
worker.lo worker.o: $(srcdir)/daemon/worker.c config.h $(srcdir)/util/log.h $(srcdir)/util/net_help.h \
- $(srcdir)/util/random.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/ldns/sbuffer.h \
+ $(srcdir)/util/random.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \
$(srcdir)/util/netevent.h $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h \
- $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/util/module.h \
- $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/daemon.h \
+ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \
+ $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/daemon.h \
$(srcdir)/services/modstack.h $(srcdir)/daemon/remote.h \
$(srcdir)/daemon/acl_list.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h \
$(srcdir)/util/config_file.h $(srcdir)/util/regional.h $(srcdir)/util/storage/slabhash.h \
testbound.lo testbound.o: $(srcdir)/testcode/testbound.c config.h $(srcdir)/testcode/testpkts.h \
$(srcdir)/testcode/replay.h $(srcdir)/util/netevent.h $(srcdir)/util/rbtree.h $(srcdir)/testcode/fake_event.h \
$(srcdir)/daemon/remote.h \
- $(srcdir)/util/config_file.h $(srcdir)/ldns/keyraw.h $(srcdir)/daemon/unbound.c $(srcdir)/util/log.h \
+ $(srcdir)/util/config_file.h $(srcdir)/sldns/keyraw.h $(srcdir)/daemon/unbound.c $(srcdir)/util/log.h \
$(srcdir)/daemon/daemon.h $(srcdir)/util/locks.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \
$(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lruhash.h \
$(srcdir)/services/listen_dnsport.h $(srcdir)/services/cache/rrset.h \
- $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h \
- $(srcdir)/util/fptr_wlist.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/tube.h \
+ $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \
+ $(srcdir)/util/rtt.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \
$(srcdir)/services/mesh.h $(srcdir)/util/net_help.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h
testpkts.lo testpkts.o: $(srcdir)/testcode/testpkts.c config.h $(srcdir)/testcode/testpkts.h \
- $(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/pkthdr.h \
- $(srcdir)/ldns/str2wire.h $(srcdir)/ldns/wire2str.h
+ $(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/wire2str.h
worker.lo worker.o: $(srcdir)/daemon/worker.c config.h $(srcdir)/util/log.h $(srcdir)/util/net_help.h \
- $(srcdir)/util/random.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/ldns/sbuffer.h \
+ $(srcdir)/util/random.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \
$(srcdir)/util/netevent.h $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h \
- $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/util/module.h \
- $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/daemon.h \
+ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \
+ $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/daemon.h \
$(srcdir)/services/modstack.h $(srcdir)/daemon/remote.h \
$(srcdir)/daemon/acl_list.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h \
$(srcdir)/util/config_file.h $(srcdir)/util/regional.h $(srcdir)/util/storage/slabhash.h \
daemon.lo daemon.o: $(srcdir)/daemon/daemon.c config.h \
$(srcdir)/daemon/daemon.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \
$(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h \
- $(srcdir)/ldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
- $(srcdir)/util/netevent.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/util/module.h \
+ $(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
+ $(srcdir)/util/netevent.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/util/module.h \
$(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/remote.h \
$(srcdir)/daemon/acl_list.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h \
$(srcdir)/util/config_file.h $(srcdir)/util/storage/lookup3.h $(srcdir)/util/storage/slabhash.h \
$(srcdir)/services/listen_dnsport.h $(srcdir)/services/cache/rrset.h $(srcdir)/services/cache/infra.h \
$(srcdir)/util/rtt.h $(srcdir)/services/localzone.h $(srcdir)/util/random.h $(srcdir)/util/tube.h \
- $(srcdir)/util/net_help.h $(srcdir)/ldns/keyraw.h
+ $(srcdir)/util/net_help.h $(srcdir)/sldns/keyraw.h
stats.lo stats.o: $(srcdir)/daemon/stats.c config.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \
- $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/ldns/sbuffer.h \
+ $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/util/netevent.h $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h \
- $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \
+ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \
$(srcdir)/daemon/daemon.h $(srcdir)/services/modstack.h \
$(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/outside_network.h \
- $(srcdir)/util/config_file.h $(srcdir)/util/tube.h $(srcdir)/util/net_help.h $(srcdir)/validator/validator.h \
- $(srcdir)/validator/val_utils.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \
- $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/validator/val_kcache.h
+ $(srcdir)/services/listen_dnsport.h $(srcdir)/util/config_file.h $(srcdir)/util/tube.h $(srcdir)/util/net_help.h \
+ $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h $(srcdir)/services/cache/rrset.h \
+ $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \
+ $(srcdir)/util/rtt.h $(srcdir)/validator/val_kcache.h
replay.lo replay.o: $(srcdir)/testcode/replay.c config.h $(srcdir)/util/log.h $(srcdir)/util/net_help.h \
$(srcdir)/util/config_file.h $(srcdir)/testcode/replay.h $(srcdir)/util/netevent.h $(srcdir)/testcode/testpkts.h \
- $(srcdir)/util/rbtree.h $(srcdir)/testcode/fake_event.h $(srcdir)/ldns/str2wire.h $(srcdir)/ldns/rrdef.h
+ $(srcdir)/util/rbtree.h $(srcdir)/testcode/fake_event.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/rrdef.h
fake_event.lo fake_event.o: $(srcdir)/testcode/fake_event.c config.h $(srcdir)/testcode/fake_event.h \
$(srcdir)/util/netevent.h $(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/util/data/msgparse.h \
- $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h \
+ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \
$(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgencode.h \
$(srcdir)/util/data/dname.h $(srcdir)/util/config_file.h $(srcdir)/services/listen_dnsport.h \
$(srcdir)/services/outside_network.h $(srcdir)/util/rbtree.h \
- $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/testcode/replay.h $(srcdir)/testcode/testpkts.h \
- $(srcdir)/util/fptr_wlist.h $(srcdir)/util/module.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h \
- $(srcdir)/services/modstack.h $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/wire2str.h $(srcdir)/ldns/str2wire.h
+ $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rtt.h \
+ $(srcdir)/testcode/replay.h $(srcdir)/testcode/testpkts.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/module.h \
+ $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h $(srcdir)/sldns/sbuffer.h \
+ $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h
lock_verify.lo lock_verify.o: $(srcdir)/testcode/lock_verify.c config.h $(srcdir)/util/log.h $(srcdir)/util/rbtree.h \
$(srcdir)/util/locks.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/util/storage/lruhash.h \
$(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/tube.h \
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \
$(srcdir)/services/mesh.h $(srcdir)/services/modstack.h
pktview.lo pktview.o: $(srcdir)/testcode/pktview.c config.h $(srcdir)/util/log.h $(srcdir)/util/data/dname.h \
- $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/testcode/unitmain.h $(srcdir)/testcode/readhex.h $(srcdir)/ldns/sbuffer.h \
- $(srcdir)/ldns/parseutil.h
+ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/testcode/unitmain.h $(srcdir)/testcode/readhex.h $(srcdir)/sldns/sbuffer.h \
+ $(srcdir)/sldns/parseutil.h
readhex.lo readhex.o: $(srcdir)/testcode/readhex.c config.h $(srcdir)/testcode/readhex.h $(srcdir)/util/log.h \
- $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/parseutil.h
+ $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/parseutil.h
memstats.lo memstats.o: $(srcdir)/testcode/memstats.c config.h $(srcdir)/util/log.h $(srcdir)/util/rbtree.h \
$(srcdir)/util/locks.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/util/storage/lruhash.h \
$(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/tube.h \
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \
$(srcdir)/services/mesh.h $(srcdir)/services/modstack.h
unbound-checkconf.lo unbound-checkconf.o: $(srcdir)/smallapp/unbound-checkconf.c config.h $(srcdir)/util/log.h \
$(srcdir)/util/config_file.h $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \
$(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \
- $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h \
+ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h \
$(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_fwd.h \
$(srcdir)/util/rbtree.h $(srcdir)/iterator/iter_hints.h $(srcdir)/util/storage/dnstree.h \
$(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h $(srcdir)/services/localzone.h \
- $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/sldns/sbuffer.h
worker_cb.lo worker_cb.o: $(srcdir)/smallapp/worker_cb.c config.h $(srcdir)/libunbound/context.h \
$(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \
$(srcdir)/libunbound/unbound.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
- $(srcdir)/libunbound/worker.h $(srcdir)/ldns/sbuffer.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h \
- $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h
+ $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h \
+ $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h
context.lo context.o: $(srcdir)/libunbound/context.c config.h $(srcdir)/libunbound/context.h \
$(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \
$(srcdir)/libunbound/unbound.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
- $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h $(srcdir)/services/localzone.h \
+ $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h $(srcdir)/services/localzone.h \
$(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/infra.h \
- $(srcdir)/util/rtt.h $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rtt.h $(srcdir)/sldns/sbuffer.h
libunbound.lo libunbound.o: $(srcdir)/libunbound/libunbound.c $(srcdir)/libunbound/unbound.h \
$(srcdir)/libunbound/unbound-event.h config.h $(srcdir)/libunbound/context.h $(srcdir)/util/locks.h \
$(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/libunbound/libworker.h \
$(srcdir)/util/config_file.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/regional.h \
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/regional.h \
$(srcdir)/util/random.h $(srcdir)/util/net_help.h $(srcdir)/util/tube.h $(srcdir)/services/localzone.h \
- $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/services/cache/rrset.h \
- $(srcdir)/util/storage/slabhash.h $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rtt.h \
+ $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/sldns/sbuffer.h
libworker.lo libworker.o: $(srcdir)/libunbound/libworker.c config.h \
$(srcdir)/libunbound/libworker.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
$(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/libunbound/context.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h \
$(srcdir)/services/modstack.h $(srcdir)/libunbound/unbound.h $(srcdir)/libunbound/worker.h \
- $(srcdir)/ldns/sbuffer.h $(srcdir)/libunbound/unbound-event.h $(srcdir)/services/outside_network.h \
+ $(srcdir)/sldns/sbuffer.h $(srcdir)/libunbound/unbound-event.h $(srcdir)/services/outside_network.h \
$(srcdir)/util/netevent.h $(srcdir)/services/mesh.h \
- $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/module.h \
+ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h \
$(srcdir)/util/data/msgreply.h $(srcdir)/services/localzone.h $(srcdir)/services/cache/rrset.h \
$(srcdir)/util/storage/slabhash.h $(srcdir)/services/outbound_list.h $(srcdir)/util/fptr_wlist.h \
$(srcdir)/util/tube.h $(srcdir)/util/regional.h $(srcdir)/util/random.h $(srcdir)/util/config_file.h \
$(srcdir)/util/storage/lookup3.h $(srcdir)/util/net_help.h $(srcdir)/util/data/dname.h \
$(srcdir)/util/data/msgencode.h $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h \
- $(srcdir)/util/storage/dnstree.h $(srcdir)/ldns/str2wire.h
+ $(srcdir)/util/storage/dnstree.h $(srcdir)/sldns/str2wire.h
unbound-host.lo unbound-host.o: $(srcdir)/smallapp/unbound-host.c config.h $(srcdir)/libunbound/unbound.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/wire2str.h
+ $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/wire2str.h
asynclook.lo asynclook.o: $(srcdir)/testcode/asynclook.c config.h $(srcdir)/libunbound/unbound.h \
$(srcdir)/libunbound/context.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h \
$(srcdir)/services/modstack.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
- $(srcdir)/ldns/rrdef.h
+ $(srcdir)/sldns/rrdef.h
streamtcp.lo streamtcp.o: $(srcdir)/testcode/streamtcp.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/util/net_help.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/data/msgparse.h \
- $(srcdir)/util/storage/lruhash.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/data/msgreply.h \
- $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/dname.h $(srcdir)/ldns/sbuffer.h \
- $(srcdir)/ldns/str2wire.h $(srcdir)/ldns/wire2str.h \
+ $(srcdir)/util/storage/lruhash.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgreply.h \
+ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/dname.h $(srcdir)/sldns/sbuffer.h \
+ $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/wire2str.h \
perf.lo perf.o: $(srcdir)/testcode/perf.c config.h $(srcdir)/util/log.h $(srcdir)/util/locks.h $(srcdir)/util/net_help.h \
$(srcdir)/util/data/msgencode.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h \
- $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h \
- $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/wire2str.h $(srcdir)/ldns/str2wire.h
+ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h
delayer.lo delayer.o: $(srcdir)/testcode/delayer.c config.h $(srcdir)/util/net_help.h $(srcdir)/util/log.h \
- $(srcdir)/util/config_file.h $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/util/config_file.h $(srcdir)/sldns/sbuffer.h
unbound-control.lo unbound-control.o: $(srcdir)/smallapp/unbound-control.c config.h \
- $(srcdir)/util/log.h \
- $(srcdir)/util/config_file.h $(srcdir)/util/locks.h $(srcdir)/util/net_help.h
+ $(srcdir)/util/log.h $(srcdir)/util/config_file.h $(srcdir)/util/locks.h $(srcdir)/util/net_help.h
unbound-anchor.lo unbound-anchor.o: $(srcdir)/smallapp/unbound-anchor.c config.h $(srcdir)/libunbound/unbound.h \
- $(srcdir)/ldns/rrdef.h \
+ $(srcdir)/sldns/rrdef.h \
petal.lo petal.o: $(srcdir)/testcode/petal.c config.h \
pythonmod_utils.lo pythonmod_utils.o: $(srcdir)/pythonmod/pythonmod_utils.c config.h $(srcdir)/util/module.h \
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h \
- $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h \
- $(srcdir)/util/netevent.h $(srcdir)/util/net_help.h $(srcdir)/services/cache/dns.h \
+ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/util/netevent.h $(srcdir)/util/net_help.h $(srcdir)/services/cache/dns.h \
$(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/regional.h \
- $(srcdir)/iterator/iter_delegpt.h $(srcdir)/ldns/sbuffer.h
+ $(srcdir)/iterator/iter_delegpt.h $(srcdir)/sldns/sbuffer.h
win_svc.lo win_svc.o: $(srcdir)/winrc/win_svc.c config.h $(srcdir)/winrc/win_svc.h $(srcdir)/winrc/w_inst.h \
$(srcdir)/daemon/daemon.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \
$(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h \
- $(srcdir)/ldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
- $(srcdir)/util/netevent.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/ldns/pkthdr.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/util/module.h \
+ $(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \
+ $(srcdir)/util/netevent.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/util/module.h \
$(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/remote.h \
$(srcdir)/util/config_file.h $(srcdir)/util/winsock_event.h
w_inst.lo w_inst.o: $(srcdir)/winrc/w_inst.c config.h $(srcdir)/winrc/w_inst.h $(srcdir)/winrc/win_svc.h
unbound-service-remove.lo unbound-service-remove.o: $(srcdir)/winrc/unbound-service-remove.c config.h \
$(srcdir)/winrc/w_inst.h
anchor-update.lo anchor-update.o: $(srcdir)/winrc/anchor-update.c config.h $(srcdir)/libunbound/unbound.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/wire2str.h
-keyraw.lo keyraw.o: $(srcdir)/ldns/keyraw.c config.h $(srcdir)/ldns/keyraw.h \
- $(srcdir)/ldns/rrdef.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/wire2str.h
+keyraw.lo keyraw.o: $(srcdir)/sldns/keyraw.c config.h $(srcdir)/sldns/keyraw.h \
+ $(srcdir)/sldns/rrdef.h \
-sbuffer.lo sbuffer.o: $(srcdir)/ldns/sbuffer.c config.h $(srcdir)/ldns/sbuffer.h
-wire2str.lo wire2str.o: $(srcdir)/ldns/wire2str.c config.h $(srcdir)/ldns/wire2str.h $(srcdir)/ldns/str2wire.h \
- $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/parseutil.h $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/keyraw.h \
+sbuffer.lo sbuffer.o: $(srcdir)/sldns/sbuffer.c config.h $(srcdir)/sldns/sbuffer.h
+wire2str.lo wire2str.o: $(srcdir)/sldns/wire2str.c config.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h \
+ $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/sbuffer.h \
+ $(srcdir)/sldns/keyraw.h \
-parse.lo parse.o: $(srcdir)/ldns/parse.c config.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/parseutil.h \
- $(srcdir)/ldns/sbuffer.h
-parseutil.lo parseutil.o: $(srcdir)/ldns/parseutil.c config.h $(srcdir)/ldns/parseutil.h
-rrdef.lo rrdef.o: $(srcdir)/ldns/rrdef.c config.h $(srcdir)/ldns/rrdef.h $(srcdir)/ldns/parseutil.h
-str2wire.lo str2wire.o: $(srcdir)/ldns/str2wire.c config.h $(srcdir)/ldns/str2wire.h $(srcdir)/ldns/rrdef.h \
- $(srcdir)/ldns/wire2str.h $(srcdir)/ldns/sbuffer.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/parseutil.h
+parse.lo parse.o: $(srcdir)/sldns/parse.c config.h $(srcdir)/sldns/parse.h $(srcdir)/sldns/parseutil.h \
+ $(srcdir)/sldns/sbuffer.h
+parseutil.lo parseutil.o: $(srcdir)/sldns/parseutil.c config.h $(srcdir)/sldns/parseutil.h
+rrdef.lo rrdef.o: $(srcdir)/sldns/rrdef.c config.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/parseutil.h
+str2wire.lo str2wire.o: $(srcdir)/sldns/str2wire.c config.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/rrdef.h \
+ $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/parse.h $(srcdir)/sldns/parseutil.h
ctime_r.lo ctime_r.o: $(srcdir)/compat/ctime_r.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h
fake-rfc2553.lo fake-rfc2553.o: $(srcdir)/compat/fake-rfc2553.c $(srcdir)/compat/fake-rfc2553.h config.h
gmtime_r.lo gmtime_r.o: $(srcdir)/compat/gmtime_r.c config.h
arc4random_uniform.lo arc4random_uniform.o: $(srcdir)/compat/arc4random_uniform.c config.h
arc4_lock.lo arc4_lock.o: $(srcdir)/compat/arc4_lock.c config.h $(srcdir)/util/locks.h
sha512.lo sha512.o: $(srcdir)/compat/sha512.c config.h
+reallocarray.lo reallocarray.o: $(srcdir)/compat/reallocarray.c config.h
# Copyright 2009, Wouter Wijngaards, NLnet Labs.
# BSD licensed.
#
-# Version 26
+# Version 27
+# 2015-03-17 AHX_CONFIG_REALLOCARRAY added
# 2013-09-19 FLTO help text improved.
# 2013-07-18 Enable ACX_CHECK_COMPILER_FLAG to test for -Wstrict-prototypes
# 2013-06-25 FLTO has --disable-flto option.
#endif
])
+dnl provide reallocarray compat prototype.
+dnl $1: unique name for compat code
+AC_DEFUN([AHX_CONFIG_REALLOCARRAY],
+[
+#ifndef HAVE_REALLOCARRAY
+#define reallocarray reallocarray$1
+void* reallocarray(void *ptr, size_t nmemb, size_t size);
+#endif
+])
+
dnl provide w32 compat definition for sleep
AC_DEFUN([AHX_CONFIG_W32_SLEEP],
[
extern int main(int, char *argv[]);
#endif
static int gotdata(char *buf, size_t len);
+#ifdef SYS_getrandom
+static int getentropy_getrandom(void *buf, size_t len);
+#endif
static int getentropy_urandom(void *buf, size_t len);
#ifdef SYS__sysctl
static int getentropy_sysctl(void *buf, size_t len);
}
#ifdef SYS_getrandom
- /* try to use getrandom syscall introduced with kernel 3.17 */
- ret = syscall(SYS_getrandom, buf, len, 0);
+ /*
+ * Try descriptor-less getrandom()
+ */
+ ret = getentropy_getrandom(buf, len);
if (ret != -1)
return (ret);
-#endif /* SYS_getrandom */
+ if (errno != ENOSYS)
+ return (-1);
+#endif
/*
* Try to get entropy with /dev/urandom
return 0;
}
+#ifdef SYS_getrandom
+static int
+getentropy_getrandom(void *buf, size_t len)
+{
+ int pre_errno = errno;
+ int ret;
+ if (len > 256)
+ return (-1);
+ do {
+ ret = syscall(SYS_getrandom, buf, len, 0);
+ } while (ret == -1 && errno == EINTR);
+
+ if (ret != (int)len)
+ return (-1);
+ errno = pre_errno;
+ return (0);
+}
+#endif
+
static int
getentropy_urandom(void *buf, size_t len)
{
struct __sysctl_args args = {
.name = mib,
.nlen = 3,
- .oldval = buf + i,
+ .oldval = (char *)buf + i,
.oldlenp = &chunk,
};
if (syscall(SYS__sysctl, &args) != 0)
--- /dev/null
+/* $OpenBSD: reallocarray.c,v 1.1 2014/05/08 21:43:49 deraadt Exp $ */
+/*
+ * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
+ *
+ * Permission to use, copy, modify, and 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 THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 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 "config.h"
+#include <sys/types.h>
+#include <errno.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/*
+ * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
+ * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
+ */
+#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
+
+void *
+reallocarray(void *optr, size_t nmemb, size_t size)
+{
+ if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
+ nmemb > 0 && SIZE_MAX / nmemb < size) {
+ errno = ENOMEM;
+ return NULL;
+ }
+ return realloc(optr, size * nmemb);
+}
if you don't. */
#undef HAVE_DECL_NID_X9_62_PRIME256V1
+/* Define to 1 if you have the declaration of `reallocarray', and to 0 if you
+ don't. */
+#undef HAVE_DECL_REALLOCARRAY
+
/* Define to 1 if you have the declaration of `sk_SSL_COMP_pop_free', and to 0
if you don't. */
#undef HAVE_DECL_SK_SSL_COMP_POP_FREE
/* Define to 1 if you have the `random' function. */
#undef HAVE_RANDOM
+/* Define to 1 if you have the `reallocarray' function. */
+#undef HAVE_REALLOCARRAY
+
/* Define to 1 if you have the `recvmsg' function. */
#undef HAVE_RECVMSG
#endif
+#ifndef HAVE_REALLOCARRAY
+#define reallocarray reallocarrayunbound
+void* reallocarray(void *ptr, size_t nmemb, size_t size);
+#endif
+
+
#if !defined(HAVE_SLEEP) || defined(HAVE_WINDOWS_H)
#define sleep(x) Sleep((x)*1000) /* on win32 */
#endif /* HAVE_SLEEP */
# if !HAVE_DECL_ARC4RANDOM_UNIFORM && defined(HAVE_ARC4RANDOM_UNIFORM)
uint32_t arc4random_uniform(uint32_t upper_bound);
# endif
+# if !HAVE_DECL_REALLOCARRAY
+void *reallocarray(void *ptr, size_t nmemb, size_t size);
+# endif
#endif /* HAVE_LIBRESSL */
#ifndef HAVE_ARC4RANDOM
void explicit_bzero(void* buf, size_t len);
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for unbound 1.5.3.
+# Generated by GNU Autoconf 2.69 for unbound 1.5.4.
#
# Report bugs to <unbound-bugs@nlnetlabs.nl>.
#
# Identity of this package.
PACKAGE_NAME='unbound'
PACKAGE_TARNAME='unbound'
-PACKAGE_VERSION='1.5.3'
-PACKAGE_STRING='unbound 1.5.3'
+PACKAGE_VERSION='1.5.4'
+PACKAGE_STRING='unbound 1.5.4'
PACKAGE_BUGREPORT='unbound-bugs@nlnetlabs.nl'
PACKAGE_URL=''
swig
SWIG_LIB
SWIG
+PY_MAJOR_VERSION
PYTHON_SITE_PKG
PYTHON_LDFLAGS
PYTHON_CPPFLAGS
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures unbound 1.5.3 to adapt to many kinds of systems.
+\`configure' configures unbound 1.5.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of unbound 1.5.3:";;
+ short | recursive ) echo "Configuration of unbound 1.5.4:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-unbound configure 1.5.3
+unbound configure 1.5.4
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by unbound $as_me 1.5.3, which was
+It was created by unbound $as_me 1.5.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
UNBOUND_VERSION_MINOR=5
-UNBOUND_VERSION_MICRO=3
+UNBOUND_VERSION_MICRO=4
LIBUNBOUND_CURRENT=5
-LIBUNBOUND_REVISION=6
+LIBUNBOUND_REVISION=7
LIBUNBOUND_AGE=3
# 1.0.0 had 0:12:0
# 1.0.1 had 0:13:0
# 1.5.1 had 5:3:3
# 1.5.2 had 5:5:3
# 1.5.3 had 5:6:3
+# 1.5.4 had 5:7:3
# Current -- the number of the binary API that we're implementing
# Revision -- which iteration of the implementation of the binary
as_fn_error $? "Python version >= 2.4.0 is required" "$LINENO" 5
fi
+ PY_MAJOR_VERSION="`$PYTHON -c "import sys; print(sys.version_info.major)"`"
+
# Have Python
$as_echo "#define HAVE_PYTHON 1" >>confdefs.h
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_ARC4RANDOM_UNIFORM $ac_have_decl
_ACEOF
+ac_fn_c_check_decl "$LINENO" "reallocarray" "ac_cv_have_decl_reallocarray" "$ac_includes_default"
+if test "x$ac_cv_have_decl_reallocarray" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_REALLOCARRAY $ac_have_decl
+_ACEOF
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS"
+ac_fn_c_check_func "$LINENO" "reallocarray" "ac_cv_func_reallocarray"
+if test "x$ac_cv_func_reallocarray" = xyes; then :
+ $as_echo "#define HAVE_REALLOCARRAY 1" >>confdefs.h
+
+else
+ case " $LIBOBJS " in
+ *" reallocarray.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS reallocarray.$ac_objext"
+ ;;
+esac
+
+fi
+
+
if test "$USE_NSS" = "no"; then
ac_fn_c_check_func "$LINENO" "arc4random" "ac_cv_func_arc4random"
if test "x$ac_cv_func_arc4random" = xyes; then :
-version=1.5.3
+version=1.5.4
date=`date +'%b %e, %Y'`
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by unbound $as_me 1.5.3, which was
+This file was extended by unbound $as_me 1.5.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-unbound config.status 1.5.3
+unbound config.status 1.5.4
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
# must be numbers. ac_defun because of later processing
m4_define([VERSION_MAJOR],[1])
m4_define([VERSION_MINOR],[5])
-m4_define([VERSION_MICRO],[3])
+m4_define([VERSION_MICRO],[4])
AC_INIT(unbound, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), unbound-bugs@nlnetlabs.nl, unbound)
AC_SUBST(UNBOUND_VERSION_MAJOR, [VERSION_MAJOR])
AC_SUBST(UNBOUND_VERSION_MINOR, [VERSION_MINOR])
AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO])
LIBUNBOUND_CURRENT=5
-LIBUNBOUND_REVISION=6
+LIBUNBOUND_REVISION=7
LIBUNBOUND_AGE=3
# 1.0.0 had 0:12:0
# 1.0.1 had 0:13:0
# 1.5.1 had 5:3:3
# 1.5.2 had 5:5:3
# 1.5.3 had 5:6:3
+# 1.5.4 had 5:7:3
# Current -- the number of the binary API that we're implementing
# Revision -- which iteration of the implementation of the binary
AC_ERROR([Python version >= 2.4.0 is required])
fi
+ PY_MAJOR_VERSION="`$PYTHON -c "import sys; print(sys.version_info.major)"`"
+ AC_SUBST(PY_MAJOR_VERSION)
# Have Python
AC_DEFINE(HAVE_PYTHON,1,[Define if you have Python libraries and header files.])
LIBS="$PYTHON_LDFLAGS $LIBS"
AC_DEFINE([HAVE_LIBRESSL], [1], [Define if we have LibreSSL])
# libressl provides these compat functions, but they may also be
# declared by the OS in libc. See if they have been declared.
- AC_CHECK_DECLS([strlcpy,strlcat,arc4random,arc4random_uniform])
+ AC_CHECK_DECLS([strlcpy,strlcat,arc4random,arc4random_uniform,reallocarray])
else
AC_MSG_RESULT([no])
fi
AC_REPLACE_FUNCS(strlcpy)
AC_REPLACE_FUNCS(memmove)
AC_REPLACE_FUNCS(gmtime_r)
+dnl without CTIME, ARC4-functions and without reallocarray.
LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS"
AC_SUBST(LIBOBJ_WITHOUT_CTIMEARC4)
+AC_REPLACE_FUNCS(reallocarray)
if test "$USE_NSS" = "no"; then
AC_REPLACE_FUNCS(arc4random)
AC_REPLACE_FUNCS(arc4random_uniform)
AHX_CONFIG_STRLCAT(unbound)
AHX_CONFIG_STRLCPY(unbound)
AHX_CONFIG_GMTIME_R(unbound)
+AHX_CONFIG_REALLOCARRAY(unbound)
AHX_CONFIG_W32_SLEEP
AHX_CONFIG_W32_USLEEP
AHX_CONFIG_W32_RANDOM
# if !HAVE_DECL_ARC4RANDOM_UNIFORM && defined(HAVE_ARC4RANDOM_UNIFORM)
uint32_t arc4random_uniform(uint32_t upper_bound);
# endif
+# if !HAVE_DECL_REALLOCARRAY
+void *reallocarray(void *ptr, size_t nmemb, size_t size);
+# endif
#endif /* HAVE_LIBRESSL */
#ifndef HAVE_ARC4RANDOM
void explicit_bzero(void* buf, size_t len);
a local-zone and local-data include file for unbound.conf.
* unbound-host.nagios.patch: makes unbound-host return status that fits right
in with the nagios monitoring framework. Contributed by Migiel de Vos.
-* unbound_unixsock.diff: Add Unix socket support for unbound-control.
- Contributed by Ilya Bakulin, 2012-08-28.
* patch_rsamd5_enable.diff: this patch enables RSAMD5 validation (otherwise
it is treated as insecure). The RSAMD5 algorithm is deprecated (RFC6725).
* create_unbound_ad_servers.sh: shell script to enter anti-ad server lists.
works like the BIND feature (removes AAAA records unless AAAA-only domain).
Useful for certain 'broken IPv6 default route' scenarios.
Patch from Stephane Lapie for ASAHI Net.
-
+* unbound_smf22.tar.gz: Solaris SMF installation/removal scripts.
+ Contributed by Yuri Voinov.
Source3: unbound.munin
Source4: unbound_munin_
Source5: root.key
-Source6: dlv.isc.org.key
Patch1: unbound-1.2-glob.patch
Group: System Environment/Daemons
%attr(0755,root,root) %dir %{_sysconfdir}/%{name}
%ghost %attr(0755,unbound,unbound) %dir %{_localstatedir}/run/%{name}
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/unbound.conf
-%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/dlv.isc.org.key
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/root.key
%{_sbindir}/*
%{_mandir}/*/*
%post
/sbin/chkconfig --add %{name}
-# dnssec-conf used to contain our DLV key, but now we include it via unbound
-# If unbound had previously been configured with dnssec-configure, we need
-# to migrate the location of the DLV key file (to keep DLV enabled, and because
-# unbound won't start with a bad location for a DLV key file.
-sed -i "s:/etc/pki/dnssec-keys[/]*dlv:/etc/unbound:" %{_sysconfdir}/unbound/unbound.conf
%post libs -p /sbin/ldconfig
+++ /dev/null
-diff --git a/daemon/remote.c b/daemon/remote.c
-index a2b2204..b6990f3 100644
---- a/daemon/remote.c
-+++ b/daemon/remote.c
-@@ -81,6 +81,11 @@
- #ifdef HAVE_NETDB_H
- #include <netdb.h>
- #endif
-+#ifdef HAVE_PWD_H
-+#include <pwd.h>
-+#include <sys/stat.h>
-+#include <fcntl.h>
-+#endif
-
- /* just for portability */
- #ifdef SQ
-@@ -235,7 +240,8 @@ void daemon_remote_delete(struct daemon_remote* rc)
- * @return false on failure.
- */
- static int
--add_open(const char* ip, int nr, struct listen_port** list, int noproto_is_err)
-+add_open(const char* ip, int nr, struct listen_port** list, int noproto_is_err,
-+ struct config_file* cfg)
- {
- struct addrinfo hints;
- struct addrinfo* res;
-@@ -246,29 +252,74 @@ add_open(const char* ip, int nr, struct listen_port** list, int noproto_is_err)
- snprintf(port, sizeof(port), "%d", nr);
- port[sizeof(port)-1]=0;
- memset(&hints, 0, sizeof(hints));
-- hints.ai_socktype = SOCK_STREAM;
-- hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
-- if((r = getaddrinfo(ip, port, &hints, &res)) != 0 || !res) {
--#ifdef USE_WINSOCK
-- if(!noproto_is_err && r == EAI_NONAME) {
-- /* tried to lookup the address as name */
-- return 1; /* return success, but do nothing */
-+
-+ if(ip[0] == '/') {
-+ /* This looks like UNIX socket! */
-+ fd = create_domain_accept_sock(ip);
-+/*
-+ * When unbound starts, it first creates a socket and then
-+ * drops privs, so the socket is created as root user.
-+ * This is fine, but we would like to set _unbound user group
-+ * for this socket, and permissions should be 0660 so only
-+ * root and _unbound group members can invoke unbound-control.
-+ * The username used here is the same as username that unbound
-+ * uses for its worker processes.
-+ */
-+
-+/*
-+ * Note: this code is an exact copy of code from daemon.c
-+ * Normally this should be either wrapped into a function,
-+ * or gui/gid values should be retrieved at config parsing time
-+ * and then stored in configfile structure.
-+ * This requires action from unbound developers!
-+*/
-+#ifdef HAVE_GETPWNAM
-+ struct passwd *pwd = NULL;
-+ uid_t uid;
-+ gid_t gid;
-+ /* initialize, but not to 0 (root) */
-+ memset(&uid, 112, sizeof(uid));
-+ memset(&gid, 112, sizeof(gid));
-+ log_assert(cfg);
-+
-+ if(cfg->username && cfg->username[0]) {
-+ if((pwd = getpwnam(cfg->username)) == NULL)
-+ fatal_exit("user '%s' does not exist.",
-+ cfg->username);
-+ uid = pwd->pw_uid;
-+ gid = pwd->pw_gid;
-+ endpwent();
- }
-+
-+ chown(ip, 0, gid);
-+ chmod(ip, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
-+#endif
-+ } else {
-+ hints.ai_socktype = SOCK_STREAM;
-+ hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
-+ if((r = getaddrinfo(ip, port, &hints, &res)) != 0 || !res) {
-+#ifdef USE_WINSOCK
-+ if(!noproto_is_err && r == EAI_NONAME) {
-+ /* tried to lookup the address as name */
-+ return 1; /* return success, but do nothing */
-+ }
- #endif /* USE_WINSOCK */
-- log_err("control interface %s:%s getaddrinfo: %s %s",
-- ip?ip:"default", port, gai_strerror(r),
-+ log_err("control interface %s:%s getaddrinfo: %s %s",
-+ ip?ip:"default", port, gai_strerror(r),
- #ifdef EAI_SYSTEM
- r==EAI_SYSTEM?(char*)strerror(errno):""
- #else
- ""
- #endif
- );
-- return 0;
-+ return 0;
-+ }
-+
-+ /* open fd */
-+ fd = create_tcp_accept_sock(res, 1, &noproto);
-+ freeaddrinfo(res);
- }
-
-- /* open fd */
-- fd = create_tcp_accept_sock(res, 1, &noproto);
-- freeaddrinfo(res);
- if(fd == -1 && noproto) {
- if(!noproto_is_err)
- return 1; /* return success, but do nothing */
-@@ -305,7 +356,7 @@ struct listen_port* daemon_remote_open_ports(struct config_file* cfg)
- if(cfg->control_ifs) {
- struct config_strlist* p;
- for(p = cfg->control_ifs; p; p = p->next) {
-- if(!add_open(p->str, cfg->control_port, &l, 1)) {
-+ if(!add_open(p->str, cfg->control_port, &l, 1, cfg)) {
- listening_ports_free(l);
- return NULL;
- }
-@@ -313,12 +364,12 @@ struct listen_port* daemon_remote_open_ports(struct config_file* cfg)
- } else {
- /* defaults */
- if(cfg->do_ip6 &&
-- !add_open("::1", cfg->control_port, &l, 0)) {
-+ !add_open("::1", cfg->control_port, &l, 0, cfg)) {
- listening_ports_free(l);
- return NULL;
- }
- if(cfg->do_ip4 &&
-- !add_open("127.0.0.1", cfg->control_port, &l, 1)) {
-+ !add_open("127.0.0.1", cfg->control_port, &l, 1, cfg)) {
- listening_ports_free(l);
- return NULL;
- }
-diff --git a/services/listen_dnsport.c b/services/listen_dnsport.c
-index ea7ec3a..4cb04e2 100644
---- a/services/listen_dnsport.c
-+++ b/services/listen_dnsport.c
-@@ -55,6 +55,10 @@
- #endif
- #include <fcntl.h>
-
-+#ifndef USE_WINSOCK
-+#include <sys/un.h>
-+#endif
-+
- /** number of queued TCP connections for listen() */
- #define TCP_BACKLOG 5
-
-@@ -376,6 +380,53 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
- }
-
- int
-+create_domain_accept_sock(char *path) {
-+ int s;
-+ struct sockaddr_un unixaddr;
-+
-+#ifndef USE_WINSOCK
-+ unixaddr.sun_len = sizeof(unixaddr);
-+ unixaddr.sun_family = AF_UNIX;
-+ strlcpy(unixaddr.sun_path, path, 104);
-+
-+ if((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
-+ log_err("Cannot create UNIX socket %s (%s)",
-+ path, strerror(errno));
-+ return -1;
-+ }
-+
-+ if(unlink(path) && errno != ENOENT) {
-+ /* The socket already exists and cannot be removed */
-+ log_err("Cannot remove old UNIX socket %s (%s)",
-+ path, strerror(errno));
-+ return -1;
-+ }
-+
-+ if(bind(s, (struct sockaddr *) &unixaddr,
-+ sizeof(struct sockaddr_un)) == -1) {
-+ log_err("Cannot bind UNIX socket %s (%s)",
-+ path, strerror(errno));
-+ return -1;
-+ }
-+
-+ if(!fd_set_nonblock(s)) {
-+ log_err("Cannot set non-blocking mode");
-+ return -1;
-+ }
-+
-+ if(listen(s, TCP_BACKLOG) == -1) {
-+ log_err("can't listen: %s", strerror(errno));
-+ return -1;
-+ }
-+
-+ return s;
-+#else
-+ log_err("UNIX sockets are not supported");
-+ return -1;
-+#endif
-+}
-+
-+int
- create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto)
- {
- int s;
-diff --git a/smallapp/unbound-control.c b/smallapp/unbound-control.c
-index a872f92..10631fd 100644
---- a/smallapp/unbound-control.c
-+++ b/smallapp/unbound-control.c
-@@ -59,6 +59,8 @@
- #include "util/locks.h"
- #include "util/net_help.h"
-
-+#include <sys/un.h>
-+
- /** Give unbound-control usage, and exit (1). */
- static void
- usage()
-@@ -158,6 +160,7 @@ contact_server(const char* svr, struct config_file* cfg, int statuscmd)
- {
- struct sockaddr_storage addr;
- socklen_t addrlen;
-+ int addrfamily = 0;
- int fd;
- /* use svr or the first config entry */
- if(!svr) {
-@@ -176,12 +179,21 @@ contact_server(const char* svr, struct config_file* cfg, int statuscmd)
- if(strchr(svr, '@')) {
- if(!extstrtoaddr(svr, &addr, &addrlen))
- fatal_exit("could not parse IP@port: %s", svr);
-+ } else if(svr[0] == '/') {
-+ struct sockaddr_un* unixsock = (struct sockaddr_un *) &addr;
-+ unixsock->sun_family = AF_UNIX;
-+ unixsock->sun_len = sizeof(unixsock);
-+ strlcpy(unixsock->sun_path, svr, 104);
-+ addrlen = sizeof(struct sockaddr_un);
-+ addrfamily = AF_UNIX;
- } else {
- if(!ipstrtoaddr(svr, cfg->control_port, &addr, &addrlen))
- fatal_exit("could not parse IP: %s", svr);
- }
-- fd = socket(addr_is_ip6(&addr, addrlen)?AF_INET6:AF_INET,
-- SOCK_STREAM, 0);
-+
-+ if(addrfamily != AF_UNIX)
-+ addrfamily = addr_is_ip6(&addr, addrlen)?AF_INET6:AF_INET;
-+ fd = socket(addrfamily, SOCK_STREAM, 0);
- if(fd == -1) {
- #ifndef USE_WINSOCK
- fatal_exit("socket: %s", strerror(errno));
-diff --git a/util/net_help.c b/util/net_help.c
-index b3136a3..5b5b4a3 100644
---- a/util/net_help.c
-+++ b/util/net_help.c
-@@ -45,6 +45,7 @@
- #include "util/module.h"
- #include "util/regional.h"
- #include <fcntl.h>
-+#include <sys/un.h>
- #include <openssl/ssl.h>
- #include <openssl/err.h>
-
-@@ -135,7 +136,7 @@ log_addr(enum verbosity_value v, const char* str,
- {
- uint16_t port;
- const char* family = "unknown";
-- char dest[100];
-+ char dest[108];
- int af = (int)((struct sockaddr_in*)addr)->sin_family;
- void* sinaddr = &((struct sockaddr_in*)addr)->sin_addr;
- if(verbosity < v)
-@@ -148,15 +149,23 @@ log_addr(enum verbosity_value v, const char* str,
- case AF_UNIX: family="unix"; break;
- default: break;
- }
-- if(inet_ntop(af, sinaddr, dest, (socklen_t)sizeof(dest)) == 0) {
-- strncpy(dest, "(inet_ntop error)", sizeof(dest));
-+
-+ if(af != AF_UNIX) {
-+ if(inet_ntop(af, sinaddr, dest, (socklen_t)sizeof(dest)) == 0) {
-+ strncpy(dest, "(inet_ntop error)", sizeof(dest));
-+ }
-+ dest[sizeof(dest)-1] = 0;
-+ port = ntohs(((struct sockaddr_in*)addr)->sin_port);
-+ if(verbosity >= 4)
-+ verbose(v, "%s %s %s port %d (len %d)", str, family,
-+ dest, (int)port, (int)addrlen);
-+ else verbose(v, "%s %s port %d", str, dest, (int)port);
-+ } else {
-+ struct sockaddr_un* unixsock;
-+ unixsock = (struct sockaddr_un *) addr;
-+ strlcpy(dest, unixsock->sun_path, sizeof(dest));
-+ verbose(v, "%s %s %s", str, family, dest);
- }
-- dest[sizeof(dest)-1] = 0;
-- port = ntohs(((struct sockaddr_in*)addr)->sin_port);
-- if(verbosity >= 4)
-- verbose(v, "%s %s %s port %d (len %d)", str, family, dest,
-- (int)port, (int)addrlen);
-- else verbose(v, "%s %s port %d", str, dest, (int)port);
- }
-
- int
#include "iterator/iter_utils.h"
#include "iterator/iter_fwd.h"
#include "iterator/iter_hints.h"
-#include "ldns/sbuffer.h"
-#include "ldns/wire2str.h"
-#include "ldns/str2wire.h"
+#include "sldns/sbuffer.h"
+#include "sldns/wire2str.h"
+#include "sldns/str2wire.h"
/** dump one rrset zonefile line */
static int
struct query_info** k, struct reply_info** d)
{
struct reply_info* rep = (struct reply_info*)e->data;
+ if(rep->rrset_count > RR_COUNT_MAX)
+ return 0; /* to protect against integer overflow */
*d = (struct reply_info*)regional_alloc_init(region, e->data,
sizeof(struct reply_info) +
sizeof(struct rrset_ref) * (rep->rrset_count-1) +
log_warn("bad rrset without contents");
return 0;
}
+ if(rr_count > RR_COUNT_MAX || rrsig_count > RR_COUNT_MAX) {
+ log_warn("bad rrset with too many rrs");
+ return 0;
+ }
d->count = (size_t)rr_count;
d->rrsig_count = (size_t)rrsig_count;
d->security = (enum sec_status)security;
rep.ttl = (time_t)ttl;
rep.prefetch_ttl = PREFETCH_TTL_CALC(rep.ttl);
rep.security = (enum sec_status)security;
+ if(an > RR_COUNT_MAX || ns > RR_COUNT_MAX || ar > RR_COUNT_MAX) {
+ log_warn("error too many rrsets");
+ return 0; /* protect against integer overflow in alloc */
+ }
rep.an_numrrsets = (size_t)an;
rep.ns_numrrsets = (size_t)ns;
rep.ar_numrrsets = (size_t)ar;
#include "util/random.h"
#include "util/tube.h"
#include "util/net_help.h"
-#include "ldns/keyraw.h"
+#include "sldns/keyraw.h"
#include <signal.h>
/** How many quit requests happened. */
#include "iterator/iter_delegpt.h"
#include "services/outbound_list.h"
#include "services/outside_network.h"
-#include "ldns/str2wire.h"
-#include "ldns/parseutil.h"
-#include "ldns/wire2str.h"
-#include "ldns/sbuffer.h"
+#include "sldns/str2wire.h"
+#include "sldns/parseutil.h"
+#include "sldns/wire2str.h"
+#include "sldns/sbuffer.h"
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
/*
* The following function was generated using the openssl utility, using
- * the command : "openssl dhparam -dsaparam -C 512"
+ * the command : "openssl dhparam -dsaparam -C 1024"
+ * (some openssl versions reject DH that is 'too small', eg. 512).
*/
#ifndef S_SPLINT_S
-DH *get_dh512()
-{
- static unsigned char dh512_p[]={
- 0xC9,0xD7,0x05,0xDA,0x5F,0xAB,0x14,0xE8,0x11,0x56,0x77,0x85,
- 0xB1,0x24,0x2C,0x95,0x60,0xEA,0xE2,0x10,0x6F,0x0F,0x84,0xEC,
- 0xF4,0x45,0xE8,0x90,0x7A,0xA7,0x03,0xFF,0x5B,0x88,0x53,0xDE,
- 0xC4,0xDE,0xBC,0x42,0x78,0x71,0x23,0x7E,0x24,0xA5,0x5E,0x4E,
- 0xEF,0x6F,0xFF,0x5F,0xAF,0xBE,0x8A,0x77,0x62,0xB4,0x65,0x82,
- 0x7E,0xC9,0xED,0x2F,
- };
- static unsigned char dh512_g[]={
- 0x8D,0x3A,0x52,0xBC,0x8A,0x71,0x94,0x33,0x2F,0xE1,0xE8,0x4C,
- 0x73,0x47,0x03,0x4E,0x7D,0x40,0xE5,0x84,0xA0,0xB5,0x6D,0x10,
- 0x6F,0x90,0x43,0x05,0x1A,0xF9,0x0B,0x6A,0xD1,0x2A,0x9C,0x25,
- 0x0A,0xB9,0xD1,0x14,0xDC,0x35,0x1C,0x48,0x7C,0xC6,0x0C,0x6D,
- 0x32,0x1D,0xD3,0xC8,0x10,0xA8,0x82,0x14,0xA2,0x1C,0xF4,0x53,
- 0x23,0x3B,0x1C,0xB9,
- };
+DH *get_dh1024()
+{
+ static unsigned char dh1024_p[]={
+ 0xB3,0x67,0x2E,0x3B,0x68,0xC5,0xDA,0x58,0x46,0xD6,0x2B,0xD3,
+ 0x41,0x78,0x97,0xE4,0xE1,0x61,0x71,0x68,0xE6,0x0F,0x1D,0x78,
+ 0x05,0xAA,0xF0,0xFF,0x30,0xDF,0xAC,0x49,0x7F,0xE0,0x90,0xFE,
+ 0xB9,0x56,0x4E,0x3F,0xE2,0x98,0x8A,0xED,0xF5,0x28,0x39,0xEF,
+ 0x2E,0xA6,0xB7,0x67,0xB2,0x43,0xE4,0x53,0xF8,0xEB,0x2C,0x1F,
+ 0x06,0x77,0x3A,0x6F,0x62,0x98,0xC1,0x3B,0xF7,0xBA,0x4D,0x93,
+ 0xF7,0xEB,0x5A,0xAD,0xC5,0x5F,0xF0,0xB7,0x24,0x35,0x81,0xF7,
+ 0x7F,0x1F,0x24,0xC0,0xDF,0xD3,0xD8,0x40,0x72,0x7E,0xF3,0x19,
+ 0x2B,0x26,0x27,0xF4,0xB6,0xB3,0xD4,0x7D,0x08,0x23,0xBE,0x68,
+ 0x2B,0xCA,0xB4,0x46,0xA8,0x9E,0xDD,0x6C,0x3D,0x75,0xA6,0x48,
+ 0xF7,0x44,0x43,0xBF,0x91,0xC2,0xB4,0x49,
+ };
+ static unsigned char dh1024_g[]={
+ 0x5F,0x37,0xB5,0x80,0x4D,0xB4,0xC4,0xB2,0x37,0x12,0xD5,0x2F,
+ 0x56,0x81,0xB0,0xDF,0x3D,0x27,0xA2,0x54,0xE7,0x14,0x65,0x2D,
+ 0x72,0xA8,0x97,0xE0,0xA9,0x4A,0x09,0x5E,0x89,0xBE,0x34,0x9A,
+ 0x90,0x98,0xC1,0xE8,0xBB,0x01,0x2B,0xC2,0x74,0x74,0x90,0x59,
+ 0x0B,0x72,0x62,0x5C,0xFD,0x49,0x63,0x4B,0x38,0x91,0xF1,0x7F,
+ 0x13,0x25,0xEB,0x52,0x50,0x47,0xA2,0x8C,0x32,0x28,0x42,0xAC,
+ 0xBD,0x7A,0xCC,0x58,0xBE,0x36,0xDA,0x6A,0x24,0x06,0xC7,0xF1,
+ 0xDA,0x8D,0x8A,0x3B,0x03,0xFA,0x6F,0x25,0xE5,0x20,0xA7,0xD6,
+ 0x6F,0x74,0x61,0x53,0x14,0x81,0x29,0x04,0xB5,0x61,0x12,0x53,
+ 0xA3,0xD6,0x09,0x98,0x0C,0x8F,0x1C,0xBB,0xD7,0x1C,0x2C,0xEE,
+ 0x56,0x4B,0x74,0x8F,0x4A,0xF8,0xA9,0xD5,
+ };
DH *dh;
if ((dh=DH_new()) == NULL) return(NULL);
- dh->p=BN_bin2bn(dh512_p,sizeof(dh512_p),NULL);
- dh->g=BN_bin2bn(dh512_g,sizeof(dh512_g),NULL);
+ dh->p=BN_bin2bn(dh1024_p,sizeof(dh1024_p),NULL);
+ dh->g=BN_bin2bn(dh1024_g,sizeof(dh1024_g),NULL);
if ((dh->p == NULL) || (dh->g == NULL))
- { DH_free(dh); return(NULL); }
+ { DH_free(dh); return(NULL); }
dh->length = 160;
return(dh);
}
/* Since we have no certificates and hence no source of
* DH params, let's generate and set them
*/
- if(!SSL_CTX_set_tmp_dh(rc->ctx,get_dh512())) {
+ if(!SSL_CTX_set_tmp_dh(rc->ctx,get_dh1024())) {
log_crypto_err("Wanted to set DH param, but failed");
return NULL;
}
}
/* open fd */
- fd = create_tcp_accept_sock(res, 1, &noproto, 0);
+ fd = create_tcp_accept_sock(res, 1, &noproto, 0,
+ cfg->ip_transparent);
freeaddrinfo(res);
}
(long long)avg.tv_sec, (int)avg.tv_usec)) return 0;
if(!ssl_printf(ssl, "%s.recursion.time.median"SQ"%g\n", nm,
s->mesh_time_median)) return 0;
+ if(!ssl_printf(ssl, "%s.tcpusage"SQ"%lu\n", nm,
+ (unsigned long)s->svr.tcp_accept_usage)) return 0;
return 1;
}
send_ok(ssl);
}
+static void
+do_insecure_list(SSL* ssl, struct worker* worker)
+{
+ char buf[257];
+ struct trust_anchor* a;
+ if(worker->env.anchors) {
+ RBTREE_FOR(a, struct trust_anchor*, worker->env.anchors->tree) {
+ if(a->numDS == 0 && a->numDNSKEY == 0) {
+ dname_str(a->name, buf);
+ ssl_printf(ssl, "%s\n", buf);
+ }
+ }
+ }
+}
+
/** do the status command */
static void
do_status(SSL* ssl, struct worker* worker)
d->rtt.srtt, d->rtt.rttvar, rtt_notimeout(&d->rtt), d->rtt.rto,
d->timeout_A, d->timeout_AAAA, d->timeout_other,
(int)d->edns_lame_known, (int)d->edns_version,
- (int)(a->now<d->probedelay?d->probedelay-a->now:0),
+ (int)(a->now<d->probedelay?(d->probedelay - a->now):0),
(int)d->isdnsseclame, (int)d->rec_lame, (int)d->lame_type_A,
(int)d->lame_other)) {
a->ssl_failed = 1;
lock_rw_unlock(&zones->lock);
}
+/** struct for user arg ratelimit list */
+struct ratelimit_list_arg {
+ /** the infra cache */
+ struct infra_cache* infra;
+ /** the SSL to print to */
+ SSL* ssl;
+ /** all or only ratelimited */
+ int all;
+ /** current time */
+ time_t now;
+};
+
+/** list items in the ratelimit table */
+static void
+rate_list(struct lruhash_entry* e, void* arg)
+{
+ struct ratelimit_list_arg* a = (struct ratelimit_list_arg*)arg;
+ struct rate_key* k = (struct rate_key*)e->key;
+ struct rate_data* d = (struct rate_data*)e->data;
+ char buf[257];
+ int lim = infra_find_ratelimit(a->infra, k->name, k->namelen);
+ int max = infra_rate_max(d, a->now);
+ if(a->all == 0) {
+ if(max < lim)
+ return;
+ }
+ dname_str(k->name, buf);
+ ssl_printf(a->ssl, "%s %d limit %d\n", buf, max, lim);
+}
+
+/** do the ratelimit_list command */
+static void
+do_ratelimit_list(SSL* ssl, struct worker* worker, char* arg)
+{
+ struct ratelimit_list_arg a;
+ a.all = 0;
+ a.infra = worker->env.infra_cache;
+ a.now = *worker->env.now;
+ a.ssl = ssl;
+ arg = skipwhite(arg);
+ if(strcmp(arg, "+a") == 0)
+ a.all = 1;
+ if(a.infra->domain_rates==NULL ||
+ (a.all == 0 && infra_dp_ratelimit == 0))
+ return;
+ slabhash_traverse(a.infra->domain_rates, 0, rate_list, &a);
+}
+
/** tell other processes to execute the command */
static void
distribute_cmd(struct daemon_remote* rc, SSL* ssl, char* cmd)
} else if(cmdcmp(p, "list_stubs", 10)) {
do_list_stubs(ssl, worker);
return;
+ } else if(cmdcmp(p, "list_insecure", 13)) {
+ do_insecure_list(ssl, worker);
+ return;
} else if(cmdcmp(p, "list_local_zones", 16)) {
do_list_local_zones(ssl, worker);
return;
} else if(cmdcmp(p, "list_local_data", 15)) {
do_list_local_data(ssl, worker);
return;
+ } else if(cmdcmp(p, "ratelimit_list", 14)) {
+ do_ratelimit_list(ssl, worker, p+14);
+ return;
} else if(cmdcmp(p, "stub_add", 8)) {
/* must always distribute this cmd */
if(rc) distribute_cmd(rc, ssl, cmd);
#include "daemon/daemon.h"
#include "services/mesh.h"
#include "services/outside_network.h"
+#include "services/listen_dnsport.h"
#include "util/config_file.h"
#include "util/tube.h"
#include "util/timehist.h"
#include "util/net_help.h"
#include "validator/validator.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
#include "services/cache/rrset.h"
#include "services/cache/infra.h"
#include "validator/val_kcache.h"
server_stats_compile(struct worker* worker, struct stats_info* s, int reset)
{
int i;
+ struct listen_list* lp;
s->svr = worker->stats;
s->mesh_num_states = worker->env.mesh->all.count;
s->svr.key_cache_count = count_slabhash_entries(worker->env.key_cache->slab);
else s->svr.key_cache_count = 0;
+ /* get tcp accept usage */
+ s->svr.tcp_accept_usage = 0;
+ for(lp = worker->front->cps; lp; lp = lp->next) {
+ if(lp->com->type == comm_tcp_accept)
+ s->svr.tcp_accept_usage += lp->com->cur_tcp_count;
+ }
+
if(reset && !worker->env.cfg->stat_cumulative) {
worker_stats_clear(worker);
}
total->svr.rrset_bogus += a->svr.rrset_bogus;
total->svr.unwanted_replies += a->svr.unwanted_replies;
total->svr.unwanted_queries += a->svr.unwanted_queries;
+ total->svr.tcp_accept_usage += a->svr.tcp_accept_usage;
for(i=0; i<STATS_QTYPE_NUM; i++)
total->svr.qtype[i] += a->svr.qtype[i];
for(i=0; i<STATS_QCLASS_NUM; i++)
size_t unwanted_replies;
/** unwanted traffic received on client-facing ports */
size_t unwanted_queries;
+ /** usage of tcp accept list */
+ size_t tcp_accept_usage;
/** histogram data exported to array
* if the array is the same size, no data is lost, and
#include "validator/val_anchor.h"
#include "libunbound/context.h"
#include "libunbound/libworker.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
/** Size of an UDP datagram */
#define NORMAL_UDP_SIZE 512 /* bytes */
+/** ratelimit for error responses */
+#define ERROR_RATELIMIT 100 /* qps */
/**
* seconds to add to prefetch leeway. This is a TTL that expires old rrsets
return 0;
}
+/** ratelimit error replies
+ * @param worker: the worker struct with ratelimit counter
+ * @param err: error code that would be wanted.
+ * @return value of err if okay, or -1 if it should be discarded instead.
+ */
+static int
+worker_err_ratelimit(struct worker* worker, int err)
+{
+ if(worker->err_limit_time == *worker->env.now) {
+ /* see if limit is exceeded for this second */
+ if(worker->err_limit_count++ > ERROR_RATELIMIT)
+ return -1;
+ } else {
+ /* new second, new limits */
+ worker->err_limit_time = *worker->env.now;
+ worker->err_limit_count = 1;
+ }
+ return err;
+}
+
/** check request sanity.
* @param pkt: the wire packet to examine for sanity.
* @param worker: parameters for checking.
if(LDNS_TC_WIRE(sldns_buffer_begin(pkt))) {
LDNS_TC_CLR(sldns_buffer_begin(pkt));
verbose(VERB_QUERY, "request bad, has TC bit on");
- return LDNS_RCODE_FORMERR;
+ return worker_err_ratelimit(worker, LDNS_RCODE_FORMERR);
}
if(LDNS_OPCODE_WIRE(sldns_buffer_begin(pkt)) != LDNS_PACKET_QUERY) {
verbose(VERB_QUERY, "request unknown opcode %d",
LDNS_OPCODE_WIRE(sldns_buffer_begin(pkt)));
- return LDNS_RCODE_NOTIMPL;
+ return worker_err_ratelimit(worker, LDNS_RCODE_NOTIMPL);
}
if(LDNS_QDCOUNT(sldns_buffer_begin(pkt)) != 1) {
verbose(VERB_QUERY, "request wrong nr qd=%d",
LDNS_QDCOUNT(sldns_buffer_begin(pkt)));
- return LDNS_RCODE_FORMERR;
+ return worker_err_ratelimit(worker, LDNS_RCODE_FORMERR);
}
if(LDNS_ANCOUNT(sldns_buffer_begin(pkt)) != 0) {
verbose(VERB_QUERY, "request wrong nr an=%d",
LDNS_ANCOUNT(sldns_buffer_begin(pkt)));
- return LDNS_RCODE_FORMERR;
+ return worker_err_ratelimit(worker, LDNS_RCODE_FORMERR);
}
if(LDNS_NSCOUNT(sldns_buffer_begin(pkt)) != 0) {
verbose(VERB_QUERY, "request wrong nr ns=%d",
LDNS_NSCOUNT(sldns_buffer_begin(pkt)));
- return LDNS_RCODE_FORMERR;
+ return worker_err_ratelimit(worker, LDNS_RCODE_FORMERR);
}
if(LDNS_ARCOUNT(sldns_buffer_begin(pkt)) > 1) {
verbose(VERB_QUERY, "request wrong nr ar=%d",
LDNS_ARCOUNT(sldns_buffer_begin(pkt)));
- return LDNS_RCODE_FORMERR;
+ return worker_err_ratelimit(worker, LDNS_RCODE_FORMERR);
}
return 0;
}
if(rep->an_numrrsets > 0 && (rep->rrsets[0]->rk.type ==
htons(LDNS_RR_TYPE_CNAME) || rep->rrsets[0]->rk.type ==
htons(LDNS_RR_TYPE_DNAME))) {
- if(!reply_check_cname_chain(rep)) {
+ if(!reply_check_cname_chain(qinfo, rep)) {
/* cname chain invalid, redo iterator steps */
verbose(VERB_ALGO, "Cache reply: cname chain broken");
bail_out:
if(!query_info_parse(&qinfo, c->buffer)) {
verbose(VERB_ALGO, "worker parse request: formerror.");
log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen);
+ if(worker_err_ratelimit(worker, LDNS_RCODE_FORMERR) == -1) {
+ comm_point_drop_reply(repinfo);
+ return 0;
+ }
sldns_buffer_rewind(c->buffer);
LDNS_QR_SET(sldns_buffer_begin(c->buffer));
LDNS_RCODE_SET(sldns_buffer_begin(c->buffer),
struct comm_point* cmd_com;
/** timer for statistics */
struct comm_timer* stat_timer;
+ /** ratelimit for errors, time value */
+ time_t err_limit_time;
+ /** ratelimit for errors, packet count */
+ unsigned int err_limit_count;
/** random() table for this worker. */
struct ub_randstate* rndstate;
* for the RRs themselves. Each RR has a length, TTL, pointer to wireformat
* data, 2 bytes of data length, and 16 bytes of IPv6 address.
*/
+ if(fd->count > RR_COUNT_MAX) {
+ *dd_out = NULL;
+ return; /* integer overflow protection in alloc */
+ }
if (!(dd = *dd_out = regional_alloc(region,
sizeof(struct packed_rrset_data)
+ fd->count * (sizeof(size_t) + sizeof(time_t) +
if(i<rep->an_numrrsets && fk->rk.type == htons(LDNS_RR_TYPE_A)) {
/* also sets dk->entry.hash */
dns64_synth_aaaa_data(fk, fd, dk, &dd, super->region, dns64_env);
+ if(!dd)
+ return;
/* Delete negative AAAA record from cache stored by
* the iterator module */
rrset_cache_remove(super->env->rrset_cache, dk->rk.dname,
#include "config.h"
#include <string.h>
#include <sys/time.h>
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
#include "util/config_file.h"
#include "util/net_help.h"
#include "util/netevent.h"
+29 June 2015: Wouter
+ - iana portlist update.
+ - Fix alloc with log for allocation size checks.
+
+26 June 2015: Wouter
+ - Fix #677 Fix DNAME responses from cache that failed internal chain
+ test.
+ - iana portlist update.
+
+22 June 2015: Wouter
+ - Fix #677 Fix CNAME corresponding to a DNAME was checked incorrectly
+ and was therefore always synthesized (thanks to Valentin Dietrich).
+
+4 June 2015: Wouter
+ - RFC 7553 RR type URI support, is now enabled by default.
+
+2 June 2015: Wouter
+ - Fix #674: Do not free pointers given by getenv.
+
+29 May 2015: Wouter
+ - Fix that unparseable error responses are ratelimited.
+ - SOA negative TTL is capped at minimumttl in its rdata section.
+ - cache-max-negative-ttl config option, default 3600.
+
+26 May 2015: Wouter
+ - Document that ratelimit works with unbound-control set_option.
+
+21 May 2015: Wouter
+ - iana portlist update.
+ - documentation proposes ratelimit of 1000 (closer to what upstream
+ servers expect from us).
+
+20 May 2015: Wouter
+ - DLV is going to be decommissioned. Advice to stop using it, and
+ put text in the example configuration and man page to that effect.
+
+10 May 2015: Wouter
+ - Change syntax of particular validator error to be easier for
+ machine parse, swap rrset and ip adres info so it looks like:
+ validation failure <www.example.nl. TXT IN>: signature crypto
+ failed from 2001:DB8:7:bba4::53 for <*.example.nl. NSEC IN>
+
+1 May 2015: Wouter
+ - caps-whitelist in unbound.conf allows whitelist of loadbalancers
+ that cannot work with caps-for-id or its fallback.
+
+30 April 2015: Wouter
+ - Unit test for type ANY synthesis.
+
+22 April 2015: Wouter
+ - Removed contrib/unbound_unixsock.diff, because it has been
+ integrated, use control-interface: /path in unbound.conf.
+ - iana portlist update.
+
+17 April 2015: Wouter
+ - Synthesize ANY responses from cache. Does not search exhaustively,
+ but MX,A,AAAA,SOA,NS also CNAME.
+ - Fix leaked dns64prefix configuration string.
+
+16 April 2015: Wouter
+ - Add local-zone type inform_deny, that logs query and drops answer.
+ - Ratelimit does not apply to prefetched queries, and ratelimit-factor
+ is default 10. Repeated normal queries get resolved and with
+ prefetch stay in the cache.
+ - Fix bug#664: libunbound python3 related fixes (from Tomas Hozza)
+ Use print_function also for Python2.
+ libunbound examples: produce sorted output.
+ libunbound-Python: libldns is not used anymore.
+ Fix issue with Python 3 mapping of FILE* using file_py3.i from ldns.
+
+10 April 2015: Wouter
+ - unbound-control ratelimit_list lists high rate domains.
+ - ratelimit feature, ratelimit: 100, or some sensible qps, can be
+ used to turn it on. It ratelimits recursion effort per zone.
+ For particular names you can configure exceptions in unbound.conf.
+ - Fix that get_option for cache-sizes does not print double newline.
+ - Fix#663: ssl handshake fails when using unix socket because dh size
+ is too small.
+
+8 April 2015: Wouter
+ - Fix crash in dnstap: Do not try to log TCP responses after timeout.
+
+7 April 2015: Wouter
+ - Libunbound skips dos-line-endings from etc/hosts.
+ - Unbound exits with a fatal error when the auto-trust-anchor-file
+ fails to be writable. This is seconds after startup. You can
+ load a readonly auto-trust-anchor-file with trust-anchor-file.
+ The file has to be writable to notice the trust anchor change,
+ without it, a trust anchor change will be unnoticed and the system
+ will then become inoperable.
+ - unbound-control list_insecure command shows the negative trust
+ anchors currently configured, patch from Jelte Jansen.
+
+2 April 2015: Wouter
+ - Fix #660: Fix interface-automatic broken in the presence of
+ asymmetric routing.
+
+26 March 2015: Wouter
+ - remote.c probedelay line is easier to read.
+ - rename ldns subdirectory to sldns to avoid name collision.
+
+25 March 2015: Wouter
+ - Fix #657: libunbound(3) recommends deprecated
+ CRYPTO_set_id_callback.
+ - If unknown trust anchor algorithm, and libressl is used, error
+ message encourages upgrade of the libressl package.
+
23 March 2015: Wouter
- Fix segfault on user not found at startup (from Maciej Soltysiak).
+20 March 2015: Wouter
+ - Fixed to add integer overflow checks on allocation (defense in depth).
+
+19 March 2015: Wouter
+ - Add ip-transparent config option for bind to non-local addresses.
+
+17 March 2015: Wouter
+ - Use reallocarray for integer overflow protection, patch submitted
+ by Loganaden Velvindron.
+
+16 March 2015: Wouter
+ - Fixup compile on cygwin, more portable openssl thread id.
+
+12 March 2015: Wouter
+ - Updated default keylength in unbound-control-setup to 3k.
+
+10 March 2015: Wouter
+ - Fix lintian warning in unbound-checkconf man page (from Andreas
+ Schulze).
+ - print svnroot when building windows dist.
+ - iana portlist update.
+ - Fix warning on sign compare in getentropy_linux.
+
+9 March 2015: Wouter
+ - Fix #644: harden-algo-downgrade option, if turned off, fixes the
+ reported excessive validation failure when multiple algorithms
+ are present. It allows the weakest algorithm to validate the zone.
+ - iana portlist update.
+
+5 March 2015: Wouter
+ - contrib/unbound_smf22.tar.gz: Solaris SMF installation/removal
+ scripts. Contributed by Yuri Voinov.
+ - Document that incoming-num-tcp increase is good for large servers.
+ - stats reports tcp usage, of incoming-num-tcp buffers.
+
+4 March 2015: Wouter
+ - Patch from Brad Smith that syncs compat/getentropy_linux with
+ OpenBSD's version (2015-03-04).
+ - 0x20 fallback improved: servfail responses do not count as missing
+ comparisons (except if all responses are errors),
+ inability to find nameservers does not fail equality comparisons,
+ many nameservers does not try to compare more than max-sent-count,
+ parse failures start 0x20 fallback procedure.
+ - store caps_response with best response in case downgrade response
+ happens to be the last one.
+ - Document windows 8 tests.
+
+3 March 2015: Wouter
+ - tag 1.5.3rc1
+ [ This became 1.5.3 on 10 March, trunk is 1.5.4 in development ]
+
2 March 2015: Wouter
- iana portlist update.
-README for Unbound 1.5.3
+README for Unbound 1.5.4
Copyright 2007 NLnet Labs
http://unbound.net
#
# Example configuration file.
#
-# See unbound.conf(5) man page, version 1.5.3.
+# See unbound.conf(5) man page, version 1.5.4.
#
# this is a comment.
# use SO_REUSEPORT to distribute queries over threads.
# so-reuseport: no
+
+ # use IP_TRANSPARENT so the interface: addresses can be non-local
+ # and you can config non-existing IPs that are going to work later on
+ # ip-transparent: no
# EDNS reassembly buffer to advertise to UDP peers (the actual buffer
# is set with msg-buffer-size). 1480 can solve fragmentation (timeouts).
# cache. Items are not cached for longer. In seconds.
# cache-max-ttl: 86400
+ # the time to live (TTL) value cap for negative responses in the cache
+ # cache-max-negative-ttl: 3600
+
# the time to live (TTL) value for cached roundtrip times, lameness and
# EDNS version information for hosts. In seconds.
# infra-host-ttl: 900
# implementation of draft-wijngaards-dnsext-resolver-side-mitigation.
# harden-referral-path: no
+ # Harden against algorithm downgrade when multiple algorithms are
+ # advertised in the DS record. If no, allows the weakest algorithm
+ # to validate the zone.
+ # harden-algo-downgrade: yes
+
# Use 0x20-encoded random bits in the query to foil spoof attempts.
# This feature is an experimental implementation of draft dns-0x20.
# use-caps-for-id: no
+
+ # Domains (and domains in them) without support for dns-0x20 and
+ # the fallback fails because they keep sending different answers.
+ # caps-whitelist: "licdn.com"
# Enforce privacy of these addresses. Strips them away from answers.
# It may cause DNSSEC validation to additionally mark it as bogus.
# File with DLV trusted keys. Same format as trust-anchor-file.
# There can be only one DLV configured, it is trusted from root down.
- # Download http://ftp.isc.org/www/dlv/dlv.isc.org.key
+ # DLV is going to be decommissioned. Please do not use it any more.
# dlv-anchor-file: "dlv.isc.org.key"
# File with trusted keys for validation. Specify more than one file
# o nodefault can be used to normally resolve AS112 zones.
# o typetransparent resolves normally for other types and other names
# o inform resolves normally, but logs client IP address
+ # o inform_deny drops queries and logs client IP address
#
# defaults are localhost address, reverse for 127.0.0.1 and ::1
# and nxdomain for AS112 zones. If you configure one of these zones
# Enable dns64 in module-config. Used to synthesize IPv6 from IPv4.
# dns64-prefix: 64:ff9b::0/96
+ # ratelimit for uncached, new queries, this limits recursion effort.
+ # ratelimiting is experimental, and may help against randomqueryflood.
+ # if 0(default) it is disabled, otherwise state qps allowed per zone.
+ # ratelimit: 0
+
+ # ratelimits are tracked in a cache, size in bytes of cache (or k,m).
+ # ratelimit-size: 4m
+ # ratelimit cache slabs, reduces lock contention if equal to cpucount.
+ # ratelimit-slabs: 4
+
+ # 0 blocks when ratelimited, otherwise let 1/xth traffic through
+ # ratelimit-factor: 10
+
+ # override the ratelimit for a specific domain name.
+ # give this setting multiple times to have multiple overrides.
+ # ratelimit-for-domain: example.com 1000
+ # override the ratelimits for all domains below a domain name
+ # can give this multiple times, the name closest to the zone is used.
+ # ratelimit-below-domain: example 1000
+
# Python config section. To enable:
# o use --with-pythonmodule to configure before compiling.
# o list python in the module-config string (above) to enable.
-.TH "libunbound" "3" "Mar 10, 2015" "NLnet Labs" "unbound 1.5.3"
+.TH "libunbound" "3" "Jul 9, 2015" "NLnet Labs" "unbound 1.5.4"
.\"
.\" libunbound.3 -- unbound library functions manual
.\"
.B ub_ctx_zone_remove,
.B ub_ctx_data_add,
.B ub_ctx_data_remove
-\- Unbound DNS validating resolver 1.5.3 functions.
+\- Unbound DNS validating resolver 1.5.4 functions.
.SH "SYNOPSIS"
.B #include <unbound.h>
.LP
Before you call this, use the openssl functions CRYPTO_set_id_callback and
CRYPTO_set_locking_callback to set up asyncronous operation if you use
lib openssl (the application calls these functions once for initialisation).
+Openssl 1.0.0 or later uses the CRYPTO_THREADID_set_callback function.
.TP
.B ub_ctx_delete
Delete validation context and free associated resources.
-.TH "unbound-anchor" "8" "Mar 10, 2015" "NLnet Labs" "unbound 1.5.3"
+.TH "unbound-anchor" "8" "Jul 9, 2015" "NLnet Labs" "unbound 1.5.4"
.\"
.\" unbound-anchor.8 -- unbound anchor maintenance utility manual
.\"
-.TH "unbound-checkconf" "8" "Mar 10, 2015" "NLnet Labs" "unbound 1.5.3"
+.TH "unbound-checkconf" "8" "Jul 9, 2015" "NLnet Labs" "unbound 1.5.4"
.\"
.\" unbound-checkconf.8 -- unbound configuration checker manual
.\"
Show the version and commandline option help.
.TP
.B \-f
-Print full pathname, with chroot applied to it. Use with the -o option.
+Print full pathname, with chroot applied to it. Use with the \-o option.
.TP
.B \-o\fI option
If given, after checking the config file the value of this option is
-.TH "unbound-control" "8" "Mar 10, 2015" "NLnet Labs" "unbound 1.5.3"
+.TH "unbound-control" "8" "Jul 9, 2015" "NLnet Labs" "unbound 1.5.4"
.\"
.\" unbound-control.8 -- unbound remote control manual
.\"
harden\-referral\-path, prefetch, prefetch\-key, log\-queries,
hide\-identity, hide\-version, identity, version, val\-log\-level,
val\-log\-squelch, ignore\-cd\-flag, add\-holddown, del\-holddown,
-keep\-missing, tcp\-upstream, ssl\-upstream, max\-udp\-size.
+keep\-missing, tcp\-upstream, ssl\-upstream, max\-udp\-size, ratelimit,
+cache\-max\-ttl, cache\-min\-ttl, cache\-max\-negative\-ttl.
.TP
.B get_option \fIopt
Get the value of the option. Give the option name without a trailing ':'.
.B list_forwards
List the forward zones in use. These are printed zone by zone to the output.
.TP
+.B list_insecure
+List the zones with domain\-insecure.
+.TP
.B list_local_zones
List the local zones in use. These are printed one per line with zone type.
.TP
By default the forwarder information from the config file for the root "." is
used. The config file is not changed, so after a reload these changes are
gone. Other forward zones from the config file are not affected by this command.
+.TP
+.B ratelimit_list \fR[\fI+a\fR]
+List the domains that are ratelimited. Printed one per line with current
+estimated qps and qps limit from config. With +a it prints all domains, not
+just the ratelimited domains, with their estimated qps. The ratelimited
+domains return an error for uncached (new) queries, but cached queries work
+as normal.
.SH "EXIT CODE"
The unbound\-control program exits with status code 1 on error, 0 on success.
.SH "SET UP"
responsive servers), the average can be bigger than the median. This median
has been calculated by interpolation from a histogram.
.TP
+.I threadX.tcpusage
+The currently held tcp buffers for incoming connections. A spot value on
+the time of the request. This helps you spot if the incoming\-num\-tcp
+buffers are full.
+.TP
.I total.num.queries
summed over threads.
.TP
.I total.recursion.time.median
averaged over threads.
.TP
+.I total.tcpusage
+summed over threads.
+.TP
.I time.now
current time in seconds since 1970.
.TP
-.TH "unbound\-host" "1" "Mar 10, 2015" "NLnet Labs" "unbound 1.5.3"
+.TH "unbound\-host" "1" "Jul 9, 2015" "NLnet Labs" "unbound 1.5.4"
.\"
.\" unbound-host.1 -- unbound DNS lookup utility
.\"
-.TH "unbound" "8" "Mar 10, 2015" "NLnet Labs" "unbound 1.5.3"
+.TH "unbound" "8" "Jul 9, 2015" "NLnet Labs" "unbound 1.5.4"
.\"
.\" unbound.8 -- unbound manual
.\"
.\"
.SH "NAME"
.B unbound
-\- Unbound DNS validating resolver 1.5.3.
+\- Unbound DNS validating resolver 1.5.4.
.SH "SYNOPSIS"
.B unbound
.RB [ \-h ]
-.TH "unbound.conf" "5" "Mar 10, 2015" "NLnet Labs" "unbound 1.5.3"
+.TH "unbound.conf" "5" "Jul 9, 2015" "NLnet Labs" "unbound 1.5.4"
.\"
.\" unbound.conf.5 -- unbound.conf manual
.\"
Give a port number or a range of the form "low\-high", without spaces.
.TP
.B outgoing\-num\-tcp: \fI<number>
-Number of outgoing TCP buffers to allocate per thread. Default is 10. If set
-to 0, or if do\-tcp is "no", no TCP queries to authoritative servers are done.
+Number of outgoing TCP buffers to allocate per thread. Default is 10. If
+set to 0, or if do\-tcp is "no", no TCP queries to authoritative servers
+are done. For larger installations increasing this value is a good idea.
.TP
.B incoming\-num\-tcp: \fI<number>
-Number of incoming TCP buffers to allocate per thread. Default is 10. If set
-to 0, or if do\-tcp is "no", no TCP queries from clients are accepted.
+Number of incoming TCP buffers to allocate per thread. Default is
+10. If set to 0, or if do\-tcp is "no", no TCP queries from clients are
+accepted. For larger installations increasing this value is a good idea.
.TP
.B edns\-buffer\-size: \fI<number>
Number of bytes size to advertise as the EDNS reassembly buffer size.
at compile time, if that works it is used, if it fails, it continues
silently (unless verbosity 3) without the option.
.TP
+.B ip\-transparent: \fI<yes or no>
+If yes, then use IP_TRANSPARENT socket option on sockets where unbound
+is listening for incoming traffic. Default no. Allows you to bind to
+non\-local interfaces. For example for non\-existant IP addresses that
+are going to exist later on, with host failover configuration. This is
+a lot like interface\-automatic, but that one services all interfaces
+and with this option you can select which (future) interfaces unbound
+provides service on. This option needs unbound to be started with root
+permissions on some systems.
+.TP
.B rrset\-cache\-size: \fI<number>
Number of bytes size of the RRset cache. Default is 4 megabytes.
A plain number is in bytes, append 'k', 'm' or 'g' for kilobytes, megabytes
higher values, especially more than an hour or so, can lead to trouble as
the data in the cache does not match up with the actual data any more.
.TP
+.B cache\-max\-negative\-ttl: \fI<seconds>
+Time to live maximum for negative responses, these have a SOA in the
+authority section that is limited in time. Default is 3600.
+.TP
.B infra\-host\-ttl: \fI<seconds>
Time to live for entries in the host cache. The host cache contains
roundtrip timing, lameness and EDNS support information. Default is 900.
If you enable it consider adding more numbers after the target\-fetch\-policy
to increase the max depth that is checked to.
.TP
+.B harden\-algo\-downgrade: \fI<yes or no>
+Harden against algorithm downgrade when multiple algorithms are
+advertised in the DS record. If no, allows the weakest algorithm to
+validate the zone. Default is yes. Zone signers must produce zones
+that allow this feature to work, but sometimes they do not, and turning
+this option off avoids that validation failure.
+.TP
.B use\-caps\-for\-id: \fI<yes or no>
Use 0x20\-encoded random bits in the query to foil spoof attempts.
This perturbs the lowercase and uppercase of query names sent to
Disabled by default.
This feature is an experimental implementation of draft dns\-0x20.
.TP
+.B caps\-whitelist: \fI<domain>
+Whitelist the domain so that it does not receive caps\-for\-id perturbed
+queries. For domains that do not support 0x20 and also fail with fallback
+because they keep sending different answers, like some load balancers.
+Can be given multiple times, for different domains.
+.TP
.B private\-address: \fI<IP address or subnet>
Give IPv4 of IPv6 addresses or classless subnets. These are addresses
on your private network, and are not allowed to be returned for public
expanded on start and on reload.
.TP
.B dlv\-anchor\-file: \fI<filename>
+This option was used during early days DNSSEC deployment when no parent-side
+DS record registrations were easily available. Nowadays, it is best to have
+DS records registered with the parent zone (many top level zones are signed).
File with trusted keys for DLV (DNSSEC Lookaside Validation). Both DS and
DNSKEY entries can be used in the file, in the same format as for
\fItrust\-anchor\-file:\fR statements. Only one DLV can be configured, more
would be slow. The DLV configured is used as a root trusted DLV, this
means that it is a lookaside for the root. Default is "", or no dlv anchor file.
+DLV is going to be decommissioned. Please do not use it any more.
.TP
.B dlv\-anchor: \fI<"Resource Record">
Much like trust\-anchor, this is a DLV anchor with the DS or DNSKEY inline.
+DLV is going to be decommissioned. Please do not use it any more.
.TP
.B domain\-insecure: \fI<domain name>
Sets domain name to be insecure, DNSSEC chain of trust is ignored towards
.B local\-zone: \fI<zone> <type>
Configure a local zone. The type determines the answer to give if
there is no match from local\-data. The types are deny, refuse, static,
-transparent, redirect, nodefault, typetransparent, inform, and are explained
-below. After that the default settings are listed. Use local\-data: to
-enter data into the local zone. Answers for local zones are authoritative
-DNS answers. By default the zones are class IN.
+transparent, redirect, nodefault, typetransparent, inform, inform_deny,
+and are explained below. After that the default settings are listed. Use
+local\-data: to enter data into the local zone. Answers for local zones
+are authoritative DNS answers. By default the zones are class IN.
.IP
If you need more complicated authoritative data, with referrals, wildcards,
CNAME/DNAME support, or DNSSEC authoritative service, setup a stub\-zone for
used for normal resolution, but machines looking up infected names are
logged, eg. to run antivirus on them.
.TP 10
+\h'5'\fIinform_deny\fR
+The query is dropped, like 'deny', and logged, like 'inform'. Ie. find
+infected machines without answering the queries.
+.TP 10
\h'5'\fInodefault\fR
Used to turn off default contents for AS112 zones. The other types
also turn off default contents for the zone. The 'nodefault' option
Configure local data shorthand for a PTR record with the reversed IPv4 or
IPv6 address and the host name. For example "192.0.2.4 www.example.com".
TTL can be inserted like this: "2001:DB8::4 7200 www.example.com"
+.TP 5
+.B ratelimit: \fI<number or 0>
+Enable ratelimiting of queries sent to nameserver for performing recursion.
+If 0, the default, it is disabled. This option is experimental at this time.
+The ratelimit is in queries per second that are allowed. More queries are
+turned away with an error (servfail). This stops recursive floods, eg. random
+query names, but not spoofed reflection floods. Cached responses are not
+ratelimited by this setting. The zone of the query is determined by examining
+the nameservers for it, the zone name is used to keep track of the rate.
+For example, 1000 may be a suitable value to stop the server from being
+overloaded with random names, and keeps unbound from sending traffic to the
+nameservers for those zones.
+.TP 5
+.B ratelimit\-size: \fI<memory size>
+Give the size of the data structure in which the current ongoing rates are
+kept track in. Default 4m. In bytes or use m(mega), k(kilo), g(giga).
+The ratelimit structure is small, so this data structure likely does
+not need to be large.
+.TP 5
+.B ratelimit\-slabs: \fI<number>
+Give power of 2 number of slabs, this is used to reduce lock contention
+in the ratelimit tracking data structure. Close to the number of cpus is
+a fairly good setting.
+.TP 5
+.B ratelimit\-factor: \fI<number>
+Set the amount of queries to rate limit when the limit is exceeded.
+If set to 0, all queries are dropped for domains where the limit is
+exceeded. If set to another value, 1 in that number is allowed through
+to complete. Default is 10, allowing 1/10 traffic to flow normally.
+This can make ordinary queries complete (if repeatedly queried for),
+and enter the cache, whilst also mitigiting the traffic flow by the
+factor given.
+.TP 5
+.B ratelimit\-for\-domain: \fI<domain> <number qps>
+Override the global ratelimit for an exact match domain name with the listed
+number. You can give this for any number of names. For example, for
+a top\-level\-domain you may want to have a higher limit than other names.
+.TP 5
+.B ratelimit\-below\-domain: \fI<domain> <number qps>
+Override the global ratelimit for a domain name that ends in this name.
+You can give this multiple times, it then describes different settings
+in different parts of the namespace. The closest matching suffix is used
+to determine the qps limit. The rate for the exact matching domain name
+is not changed, use ratelimit\-for\-domain to set that, you might want
+to use different settings for a top\-level\-domain and subdomains.
.SS "Remote Control Options"
In the
.B remote\-control:
#include "util/data/packed_rrset.h"
#include "util/data/msgreply.h"
#include "util/net_help.h"
-#include "ldns/rrdef.h"
-#include "ldns/sbuffer.h"
+#include "sldns/rrdef.h"
+#include "sldns/sbuffer.h"
struct delegpt*
delegpt_create(struct regional* region)
#include "util/config_file.h"
#include "util/net_help.h"
#include "util/data/dname.h"
-#include "ldns/rrdef.h"
-#include "ldns/str2wire.h"
+#include "sldns/rrdef.h"
+#include "sldns/str2wire.h"
int
fwd_cmp(const void* k1, const void* k2)
#include "util/config_file.h"
#include "util/net_help.h"
#include "util/data/dname.h"
-#include "ldns/rrdef.h"
-#include "ldns/str2wire.h"
-#include "ldns/wire2str.h"
+#include "sldns/rrdef.h"
+#include "sldns/str2wire.h"
+#include "sldns/wire2str.h"
struct iter_hints*
hints_create(void)
#include "util/data/msgparse.h"
#include "util/net_help.h"
#include "util/storage/dnstree.h"
-#include "ldns/str2wire.h"
-#include "ldns/sbuffer.h"
+#include "sldns/str2wire.h"
+#include "sldns/sbuffer.h"
struct iter_priv* priv_create(void)
{
#include "services/cache/dns.h"
#include "util/net_help.h"
#include "util/data/dname.h"
-#include "ldns/rrdef.h"
-#include "ldns/pkthdr.h"
+#include "sldns/rrdef.h"
+#include "sldns/pkthdr.h"
enum response_type
response_type_from_cache(struct dns_msg* msg,
#include "util/data/dname.h"
#include "util/data/msgreply.h"
#include "util/alloc.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
/** RRset flag used during scrubbing. The RRset is OK. */
#define RRSET_SCRUB_OK 0x80
/* check next cname */
uint8_t* t = NULL;
size_t tlen = 0;
- if(!parse_get_cname_target(rrset, &t, &tlen))
+ if(!parse_get_cname_target(nx, &t, &tlen))
return 0;
if(dname_pkt_compare(pkt, alias, t) == 0) {
/* it's OK and better capitalized */
#include "validator/val_kentry.h"
#include "validator/val_utils.h"
#include "validator/val_sigcrypt.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
+#include "sldns/str2wire.h"
/** time when nameserver glue is said to be 'recent' */
#define SUSPICION_RECENT_EXPIRY 86400
return 1;
}
+/** apply config caps whitelist items to name tree */
+static int
+caps_white_apply_cfg(rbtree_t* ntree, struct config_file* cfg)
+{
+ struct config_strlist* p;
+ for(p=cfg->caps_whitelist; p; p=p->next) {
+ struct name_tree_node* n;
+ size_t len;
+ uint8_t* nm = sldns_str2wire_dname(p->str, &len);
+ if(!nm) {
+ log_err("could not parse %s", p->str);
+ return 0;
+ }
+ n = (struct name_tree_node*)calloc(1, sizeof(*n));
+ if(!n) {
+ log_err("out of memory");
+ free(nm);
+ return 0;
+ }
+ n->node.key = n;
+ n->name = nm;
+ n->len = len;
+ n->labs = dname_count_labels(nm);
+ n->dclass = LDNS_RR_CLASS_IN;
+ if(!name_tree_insert(ntree, n, nm, len, n->labs, n->dclass)) {
+ /* duplicate element ignored, idempotent */
+ free(n->name);
+ free(n);
+ }
+ }
+ name_tree_init_parents(ntree);
+ return 1;
+}
+
int
iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg)
{
log_err("Could not set private addresses");
return 0;
}
+ if(cfg->caps_whitelist) {
+ if(!iter_env->caps_white)
+ iter_env->caps_white = rbtree_create(name_tree_compare);
+ if(!iter_env->caps_white || !caps_white_apply_cfg(
+ iter_env->caps_white, cfg)) {
+ log_err("Could not set capsforid whitelist");
+ return 0;
+ }
+
+ }
iter_env->supports_ipv6 = cfg->do_ip6;
iter_env->supports_ipv4 = cfg->do_ip4;
return 1;
}
}
+int caps_failed_rcode(struct reply_info* rep)
+{
+ return !(FLAGS_GET_RCODE(rep->flags) == LDNS_RCODE_NOERROR ||
+ FLAGS_GET_RCODE(rep->flags) == LDNS_RCODE_NXDOMAIN);
+}
+
void
iter_store_parentside_rrset(struct module_env* env,
struct ub_packed_rrset_key* rrset)
*/
void caps_strip_reply(struct reply_info* rep);
+/**
+ * see if reply has a 'useful' rcode for capsforid comparison, so
+ * not SERVFAIL or REFUSED, and thus NOERROR or NXDOMAIN.
+ * @param rep: reply to check.
+ * @return true if the rcode is a bad type of message.
+ */
+int caps_failed_rcode(struct reply_info* rep);
+
/**
* Store parent-side rrset in seperate rrset cache entries for later
* last-resort * lookups in case the child-side versions of this information
#include "util/data/msgencode.h"
#include "util/fptr_wlist.h"
#include "util/config_file.h"
-#include "ldns/rrdef.h"
-#include "ldns/wire2str.h"
-#include "ldns/parseutil.h"
-#include "ldns/sbuffer.h"
+#include "util/random.h"
+#include "sldns/rrdef.h"
+#include "sldns/wire2str.h"
+#include "sldns/parseutil.h"
+#include "sldns/sbuffer.h"
int
iter_init(struct module_env* env, int id)
return 1;
}
+/** delete caps_whitelist element */
+static void
+caps_free(struct rbnode_t* n, void* ATTR_UNUSED(d))
+{
+ if(n) {
+ free(((struct name_tree_node*)n)->name);
+ free(n);
+ }
+}
+
void
iter_deinit(struct module_env* env, int id)
{
free(iter_env->target_fetch_policy);
priv_delete(iter_env->priv);
donotq_delete(iter_env->donotq);
+ if(iter_env->caps_white) {
+ traverse_postorder(iter_env->caps_white, caps_free, NULL);
+ free(iter_env->caps_white);
+ }
free(iter_env);
env->modinfo[id] = NULL;
}
iq->query_restart_count = 0;
iq->referral_count = 0;
iq->sent_count = 0;
+ iq->ratelimit_ok = 0;
iq->target_count = NULL;
iq->wait_priming_stub = 0;
iq->refetch_glue = 0;
if(num_an + num_ns == 0)
return 1;
verbose(VERB_ALGO, "prepending %d rrsets", (int)num_an + (int)num_ns);
+ if(num_an > RR_COUNT_MAX || num_ns > RR_COUNT_MAX ||
+ msg->rep->rrset_count > RR_COUNT_MAX) return 0; /* overflow */
sets = regional_alloc(region, (num_an+num_ns+msg->rep->rrset_count) *
sizeof(struct ub_packed_rrset_key*));
if(!sets)
return 1;
}
+/** see if target name is caps-for-id whitelisted */
+static int
+is_caps_whitelisted(struct iter_env* ie, struct iter_qstate* iq)
+{
+ if(!ie->caps_white) return 0; /* no whitelist, or no capsforid */
+ return name_tree_lookup(ie->caps_white, iq->qchase.qname,
+ iq->qchase.qname_len, dname_count_labels(iq->qchase.qname),
+ iq->qchase.qclass) != NULL;
+}
+
/** create target count structure for this query */
static void
target_count_create(struct iter_qstate* iq)
* results of priming. */
return 0;
}
+ if(!iq->ratelimit_ok && qstate->prefetch_leeway)
+ iq->ratelimit_ok = 1; /* allow prefetches, this keeps
+ otherwise valid data in the cache */
+ if(!iq->ratelimit_ok && infra_ratelimit_exceeded(
+ qstate->env->infra_cache, iq->dp->name,
+ iq->dp->namelen, *qstate->env->now)) {
+ /* and increment the rate, so that the rate for time
+ * now will also exceed the rate, keeping cache fresh */
+ (void)infra_ratelimit_inc(qstate->env->infra_cache,
+ iq->dp->name, iq->dp->namelen,
+ *qstate->env->now);
+ /* see if we are passed through with slip factor */
+ if(qstate->env->cfg->ratelimit_factor != 0 &&
+ ub_random_max(qstate->env->rnd,
+ qstate->env->cfg->ratelimit_factor) == 1) {
+ iq->ratelimit_ok = 1;
+ log_nametypeclass(VERB_ALGO, "ratelimit allowed through for "
+ "delegation point", iq->dp->name,
+ LDNS_RR_TYPE_NS, LDNS_RR_CLASS_IN);
+ } else {
+ log_nametypeclass(VERB_ALGO, "ratelimit exceeded with "
+ "delegation point", iq->dp->name,
+ LDNS_RR_TYPE_NS, LDNS_RR_CLASS_IN);
+ return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
+ }
+ }
/* see if this dp not useless.
* It is useless if:
* the original query is one that matched too, so we have
* caps_server+1 number of matching queries now */
if(iq->caps_server+1 >= naddr*3 ||
- iq->caps_server+1 >= MAX_SENT_COUNT) {
+ iq->caps_server*2+2 >= MAX_SENT_COUNT) {
+ /* *2 on sentcount check because ipv6 may fail */
/* we're done, process the response */
verbose(VERB_ALGO, "0x20 fallback had %d responses "
"match for %d wanted, done.",
(int)iq->caps_server+1, (int)naddr*3);
+ iq->response = iq->caps_response;
iq->caps_fallback = 0;
iter_dec_attempts(iq->dp, 3); /* space for fallback */
iq->num_current_queries++; /* RespState decrements it*/
/* Since a target query might have been made, we
* need to check again. */
if(iq->num_target_queries == 0) {
+ /* if in capsforid fallback, instead of last
+ * resort, we agree with the current reply
+ * we have (if any) (our count of addrs bad)*/
+ if(iq->caps_fallback && iq->caps_reply) {
+ /* we're done, process the response */
+ verbose(VERB_ALGO, "0x20 fallback had %d responses, "
+ "but no more servers except "
+ "last resort, done.",
+ (int)iq->caps_server+1);
+ iq->response = iq->caps_response;
+ iq->caps_fallback = 0;
+ iter_dec_attempts(iq->dp, 3); /* space for fallback */
+ iq->num_current_queries++; /* RespState decrements it*/
+ iq->referral_count++; /* make sure we don't loop */
+ iq->sent_count = 0;
+ iq->state = QUERY_RESP_STATE;
+ return 1;
+ }
return processLastResort(qstate, iq, ie, id);
}
}
return 0;
}
+ /* if not forwarding, check ratelimits per delegationpoint name */
+ if(!(iq->chase_flags & BIT_RD) && !iq->ratelimit_ok) {
+ if(!infra_ratelimit_inc(qstate->env->infra_cache, iq->dp->name,
+ iq->dp->namelen, *qstate->env->now)) {
+ verbose(VERB_ALGO, "query exceeded ratelimits");
+ return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
+ }
+ }
+
/* We have a valid target. */
if(verbosity >= VERB_QUERY) {
log_query_info(VERB_QUERY, "sending query:", &iq->qchase);
iq->qchase.qname, iq->qchase.qname_len,
iq->qchase.qtype, iq->qchase.qclass,
iq->chase_flags | (iq->chase_to_rd?BIT_RD:0), EDNS_DO|BIT_CD,
- iq->dnssec_expected, iq->caps_fallback, &target->addr,
- target->addrlen, iq->dp->name, iq->dp->namelen, qstate);
+ iq->dnssec_expected, iq->caps_fallback || is_caps_whitelisted(
+ ie, iq), &target->addr, target->addrlen, iq->dp->name,
+ iq->dp->namelen, qstate);
if(!outq) {
log_addr(VERB_DETAIL, "error sending query to auth server",
&target->addr, target->addrlen);
+ if(!(iq->chase_flags & BIT_RD) && !iq->ratelimit_ok)
+ infra_ratelimit_dec(qstate->env->infra_cache, iq->dp->name,
+ iq->dp->namelen, *qstate->env->now);
return next_state(iq, QUERYTARGETS_STATE);
}
outbound_list_insert(&iq->outlist, outq);
* delegation point, and back to the QUERYTARGETS_STATE. */
verbose(VERB_DETAIL, "query response was REFERRAL");
+ if(!(iq->chase_flags & BIT_RD) && !iq->ratelimit_ok) {
+ /* we have a referral, no ratelimit, we can send
+ * our queries to the given name */
+ infra_ratelimit_dec(qstate->env->infra_cache,
+ iq->dp->name, iq->dp->namelen,
+ *qstate->env->now);
+ }
+
/* if hardened, only store referral if we asked for it */
if(!qstate->env->cfg->harden_referral_path ||
( qstate->qinfo.qtype == LDNS_RR_TYPE_NS
/* copy appropriate rcode */
to->rep->flags = from->rep->flags;
/* copy rrsets */
+ if(from->rep->rrset_count > RR_COUNT_MAX ||
+ to->rep->rrset_count > RR_COUNT_MAX) {
+ log_err("malloc failed (too many rrsets) in collect ANY");
+ foriq->state = FINISHED_STATE;
+ return; /* integer overflow protection */
+ }
dest = regional_alloc(forq->region, sizeof(dest[0])*n);
if(!dest) {
log_err("malloc failed in collect ANY");
iq->caps_fallback = 1;
iq->caps_server = 0;
iq->caps_reply = NULL;
+ iq->caps_response = NULL;
iq->state = QUERYTARGETS_STATE;
iq->num_current_queries--;
/* need fresh attempts for the 0x20 fallback, if
/* normalize and sanitize: easy to delete items from linked lists */
if(!scrub_message(pkt, prs, &iq->qchase, iq->dp->name,
- qstate->env->scratch, qstate->env, ie))
+ qstate->env->scratch, qstate->env, ie)) {
+ /* if 0x20 enabled, start fallback, but we have no message */
+ if(event == module_event_capsfail && !iq->caps_fallback) {
+ iq->caps_fallback = 1;
+ iq->caps_server = 0;
+ iq->caps_reply = NULL;
+ iq->caps_response = NULL;
+ iq->state = QUERYTARGETS_STATE;
+ iq->num_current_queries--;
+ verbose(VERB_DETAIL, "Capsforid: scrub failed, starting fallback with no response");
+ }
goto handle_it;
+ }
/* allocate response dns_msg in region */
iq->response = dns_alloc_msg(pkt, prs, qstate->region);
iq->caps_fallback = 1;
iq->caps_server = 0;
iq->caps_reply = iq->response->rep;
+ iq->caps_response = iq->response;
iq->state = QUERYTARGETS_STATE;
iq->num_current_queries--;
verbose(VERB_DETAIL, "Capsforid: starting fallback");
/* check if reply is the same, otherwise, fail */
if(!iq->caps_reply) {
iq->caps_reply = iq->response->rep;
+ iq->caps_response = iq->response;
iq->caps_server = -1; /*become zero at ++,
so that we start the full set of trials */
+ } else if(caps_failed_rcode(iq->caps_reply) &&
+ !caps_failed_rcode(iq->response->rep)) {
+ /* prefer to upgrade to non-SERVFAIL */
+ iq->caps_reply = iq->response->rep;
+ iq->caps_response = iq->response;
+ } else if(!caps_failed_rcode(iq->caps_reply) &&
+ caps_failed_rcode(iq->response->rep)) {
+ /* if we have non-SERVFAIL as answer then
+ * we can ignore SERVFAILs for the equality
+ * comparison */
+ /* no instructions here, skip other else */
+ } else if(caps_failed_rcode(iq->caps_reply) &&
+ caps_failed_rcode(iq->response->rep)) {
+ /* failure is same as other failure in fallbk*/
+ /* no instructions here, skip other else */
} else if(!reply_equal(iq->response->rep, iq->caps_reply,
qstate->env->scratch)) {
verbose(VERB_DETAIL, "Capsforid fallback: "
struct iter_donotq;
struct iter_prep_list;
struct iter_priv;
+struct rbtree_t;
/** max number of targets spawned for a query and its subqueries */
#define MAX_TARGET_COUNT 32
/** private address space and private domains */
struct iter_priv* priv;
+ /** whitelist for capsforid names */
+ struct rbtree_t* caps_white;
+
/** The maximum dependency depth that this resolver will pursue. */
int max_dependency_depth;
/** state for capsfail: stored query for comparisons. Can be NULL if
* no response had been seen prior to starting the fallback. */
struct reply_info* caps_reply;
+ struct dns_msg* caps_response;
/** Current delegation message - returned for non-RD queries */
struct dns_msg* deleg_msg;
* subqueries, the malloced-array is shared, [0] refcount. */
int* target_count;
+ /** if true, already tested for ratelimiting and passed the test */
+ int ratelimit_ok;
+
/**
* The query must store NS records from referrals as parentside RRs
* Enabled once it hits resolution problems, to throttle retries.
+++ /dev/null
-/*
- * keyraw.c - raw key operations and conversions
- *
- * (c) NLnet Labs, 2004-2008
- *
- * See the file LICENSE for the license
- */
-/**
- * \file
- * Implementation of raw DNSKEY functions (work on wire rdata).
- */
-
-#include "config.h"
-#include "ldns/keyraw.h"
-#include "ldns/rrdef.h"
-
-#ifdef HAVE_SSL
-#include <openssl/ssl.h>
-#include <openssl/evp.h>
-#include <openssl/rand.h>
-#include <openssl/err.h>
-#include <openssl/md5.h>
-#ifdef HAVE_OPENSSL_ENGINE_H
-# include <openssl/engine.h>
-#endif
-#endif /* HAVE_SSL */
-
-size_t
-sldns_rr_dnskey_key_size_raw(const unsigned char* keydata,
- const size_t len, int alg)
-{
- /* for DSA keys */
- uint8_t t;
-
- /* for RSA keys */
- uint16_t exp;
- uint16_t int16;
-
- switch ((sldns_algorithm)alg) {
- case LDNS_DSA:
- case LDNS_DSA_NSEC3:
- if (len > 0) {
- t = keydata[0];
- return (64 + t*8)*8;
- } else {
- return 0;
- }
- break;
- case LDNS_RSAMD5:
- case LDNS_RSASHA1:
- case LDNS_RSASHA1_NSEC3:
-#ifdef USE_SHA2
- case LDNS_RSASHA256:
- case LDNS_RSASHA512:
-#endif
- if (len > 0) {
- if (keydata[0] == 0) {
- /* big exponent */
- if (len > 3) {
- memmove(&int16, keydata + 1, 2);
- exp = ntohs(int16);
- return (len - exp - 3)*8;
- } else {
- return 0;
- }
- } else {
- exp = keydata[0];
- return (len-exp-1)*8;
- }
- } else {
- return 0;
- }
- break;
-#ifdef USE_GOST
- case LDNS_ECC_GOST:
- return 512;
-#endif
-#ifdef USE_ECDSA
- case LDNS_ECDSAP256SHA256:
- return 256;
- case LDNS_ECDSAP384SHA384:
- return 384;
-#endif
- default:
- return 0;
- }
-}
-
-uint16_t sldns_calc_keytag_raw(uint8_t* key, size_t keysize)
-{
- if(keysize < 4) {
- return 0;
- }
- /* look at the algorithm field, copied from 2535bis */
- if (key[3] == LDNS_RSAMD5) {
- uint16_t ac16 = 0;
- if (keysize > 4) {
- memmove(&ac16, key + keysize - 3, 2);
- }
- ac16 = ntohs(ac16);
- return (uint16_t) ac16;
- } else {
- size_t i;
- uint32_t ac32 = 0;
- for (i = 0; i < keysize; ++i) {
- ac32 += (i & 1) ? key[i] : key[i] << 8;
- }
- ac32 += (ac32 >> 16) & 0xFFFF;
- return (uint16_t) (ac32 & 0xFFFF);
- }
-}
-
-#ifdef HAVE_SSL
-#ifdef USE_GOST
-/** store GOST engine reference loaded into OpenSSL library */
-ENGINE* sldns_gost_engine = NULL;
-
-int
-sldns_key_EVP_load_gost_id(void)
-{
- static int gost_id = 0;
- const EVP_PKEY_ASN1_METHOD* meth;
- ENGINE* e;
-
- if(gost_id) return gost_id;
-
- /* see if configuration loaded gost implementation from other engine*/
- meth = EVP_PKEY_asn1_find_str(NULL, "gost2001", -1);
- if(meth) {
- EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth);
- return gost_id;
- }
-
- /* see if engine can be loaded already */
- e = ENGINE_by_id("gost");
- if(!e) {
- /* load it ourself, in case statically linked */
- ENGINE_load_builtin_engines();
- ENGINE_load_dynamic();
- e = ENGINE_by_id("gost");
- }
- if(!e) {
- /* no gost engine in openssl */
- return 0;
- }
- if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
- ENGINE_finish(e);
- ENGINE_free(e);
- return 0;
- }
-
- meth = EVP_PKEY_asn1_find_str(&e, "gost2001", -1);
- if(!meth) {
- /* algo not found */
- ENGINE_finish(e);
- ENGINE_free(e);
- return 0;
- }
- /* Note: do not ENGINE_finish and ENGINE_free the acquired engine
- * on some platforms this frees up the meth and unloads gost stuff */
- sldns_gost_engine = e;
-
- EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth);
- return gost_id;
-}
-
-void sldns_key_EVP_unload_gost(void)
-{
- if(sldns_gost_engine) {
- ENGINE_finish(sldns_gost_engine);
- ENGINE_free(sldns_gost_engine);
- sldns_gost_engine = NULL;
- }
-}
-#endif /* USE_GOST */
-
-DSA *
-sldns_key_buf2dsa_raw(unsigned char* key, size_t len)
-{
- uint8_t T;
- uint16_t length;
- uint16_t offset;
- DSA *dsa;
- BIGNUM *Q; BIGNUM *P;
- BIGNUM *G; BIGNUM *Y;
-
- if(len == 0)
- return NULL;
- T = (uint8_t)key[0];
- length = (64 + T * 8);
- offset = 1;
-
- if (T > 8) {
- return NULL;
- }
- if(len < (size_t)1 + SHA_DIGEST_LENGTH + 3*length)
- return NULL;
-
- Q = BN_bin2bn(key+offset, SHA_DIGEST_LENGTH, NULL);
- offset += SHA_DIGEST_LENGTH;
-
- P = BN_bin2bn(key+offset, (int)length, NULL);
- offset += length;
-
- G = BN_bin2bn(key+offset, (int)length, NULL);
- offset += length;
-
- Y = BN_bin2bn(key+offset, (int)length, NULL);
- offset += length;
-
- /* create the key and set its properties */
- if(!Q || !P || !G || !Y || !(dsa = DSA_new())) {
- BN_free(Q);
- BN_free(P);
- BN_free(G);
- BN_free(Y);
- return NULL;
- }
-#ifndef S_SPLINT_S
- dsa->p = P;
- dsa->q = Q;
- dsa->g = G;
- dsa->pub_key = Y;
-#endif /* splint */
-
- return dsa;
-}
-
-RSA *
-sldns_key_buf2rsa_raw(unsigned char* key, size_t len)
-{
- uint16_t offset;
- uint16_t exp;
- uint16_t int16;
- RSA *rsa;
- BIGNUM *modulus;
- BIGNUM *exponent;
-
- if (len == 0)
- return NULL;
- if (key[0] == 0) {
- if(len < 3)
- return NULL;
- memmove(&int16, key+1, 2);
- exp = ntohs(int16);
- offset = 3;
- } else {
- exp = key[0];
- offset = 1;
- }
-
- /* key length at least one */
- if(len < (size_t)offset + exp + 1)
- return NULL;
-
- /* Exponent */
- exponent = BN_new();
- if(!exponent) return NULL;
- (void) BN_bin2bn(key+offset, (int)exp, exponent);
- offset += exp;
-
- /* Modulus */
- modulus = BN_new();
- if(!modulus) {
- BN_free(exponent);
- return NULL;
- }
- /* length of the buffer must match the key length! */
- (void) BN_bin2bn(key+offset, (int)(len - offset), modulus);
-
- rsa = RSA_new();
- if(!rsa) {
- BN_free(exponent);
- BN_free(modulus);
- return NULL;
- }
-#ifndef S_SPLINT_S
- rsa->n = modulus;
- rsa->e = exponent;
-#endif /* splint */
-
- return rsa;
-}
-
-#ifdef USE_GOST
-EVP_PKEY*
-sldns_gost2pkey_raw(unsigned char* key, size_t keylen)
-{
- /* prefix header for X509 encoding */
- uint8_t asn[37] = { 0x30, 0x63, 0x30, 0x1c, 0x06, 0x06, 0x2a, 0x85,
- 0x03, 0x02, 0x02, 0x13, 0x30, 0x12, 0x06, 0x07, 0x2a, 0x85,
- 0x03, 0x02, 0x02, 0x23, 0x01, 0x06, 0x07, 0x2a, 0x85, 0x03,
- 0x02, 0x02, 0x1e, 0x01, 0x03, 0x43, 0x00, 0x04, 0x40};
- unsigned char encoded[37+64];
- const unsigned char* pp;
- if(keylen != 64) {
- /* key wrong size */
- return NULL;
- }
-
- /* create evp_key */
- memmove(encoded, asn, 37);
- memmove(encoded+37, key, 64);
- pp = (unsigned char*)&encoded[0];
-
- return d2i_PUBKEY(NULL, &pp, (int)sizeof(encoded));
-}
-#endif /* USE_GOST */
-
-#ifdef USE_ECDSA
-EVP_PKEY*
-sldns_ecdsa2pkey_raw(unsigned char* key, size_t keylen, uint8_t algo)
-{
- unsigned char buf[256+2]; /* sufficient for 2*384/8+1 */
- const unsigned char* pp = buf;
- EVP_PKEY *evp_key;
- EC_KEY *ec;
- /* check length, which uncompressed must be 2 bignums */
- if(algo == LDNS_ECDSAP256SHA256) {
- if(keylen != 2*256/8) return NULL;
- ec = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
- } else if(algo == LDNS_ECDSAP384SHA384) {
- if(keylen != 2*384/8) return NULL;
- ec = EC_KEY_new_by_curve_name(NID_secp384r1);
- } else ec = NULL;
- if(!ec) return NULL;
- if(keylen+1 > sizeof(buf)) { /* sanity check */
- EC_KEY_free(ec);
- return NULL;
- }
- /* prepend the 0x02 (from docs) (or actually 0x04 from implementation
- * of openssl) for uncompressed data */
- buf[0] = POINT_CONVERSION_UNCOMPRESSED;
- memmove(buf+1, key, keylen);
- if(!o2i_ECPublicKey(&ec, &pp, (int)keylen+1)) {
- EC_KEY_free(ec);
- return NULL;
- }
- evp_key = EVP_PKEY_new();
- if(!evp_key) {
- EC_KEY_free(ec);
- return NULL;
- }
- if (!EVP_PKEY_assign_EC_KEY(evp_key, ec)) {
- EVP_PKEY_free(evp_key);
- EC_KEY_free(ec);
- return NULL;
- }
- return evp_key;
-}
-#endif /* USE_ECDSA */
-
-int
-sldns_digest_evp(unsigned char* data, unsigned int len, unsigned char* dest,
- const EVP_MD* md)
-{
- EVP_MD_CTX* ctx;
- ctx = EVP_MD_CTX_create();
- if(!ctx)
- return 0;
- if(!EVP_DigestInit_ex(ctx, md, NULL) ||
- !EVP_DigestUpdate(ctx, data, len) ||
- !EVP_DigestFinal_ex(ctx, dest, NULL)) {
- EVP_MD_CTX_destroy(ctx);
- return 0;
- }
- EVP_MD_CTX_destroy(ctx);
- return 1;
-}
-#endif /* HAVE_SSL */
+++ /dev/null
-/*
- * keyraw.h -- raw key and signature access and conversion
- *
- * Copyright (c) 2005-2008, NLnet Labs. All rights reserved.
- *
- * See LICENSE for the license.
- *
- */
-
-/**
- * \file
- *
- * raw key and signature access and conversion
- *
- * Since those functions heavily rely op cryptographic operations,
- * this module is dependent on openssl.
- *
- */
-
-#ifndef LDNS_KEYRAW_H
-#define LDNS_KEYRAW_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#if LDNS_BUILD_CONFIG_HAVE_SSL
-# include <openssl/ssl.h>
-# include <openssl/evp.h>
-#endif /* LDNS_BUILD_CONFIG_HAVE_SSL */
-
-/**
- * get the length of the keydata in bits
- * \param[in] keydata the raw key data
- * \param[in] len the length of the keydata
- * \param[in] alg the cryptographic algorithm this is a key for
- * \return the keysize in bits, or 0 on error
- */
-size_t sldns_rr_dnskey_key_size_raw(const unsigned char *keydata,
- const size_t len, int alg);
-
-/**
- * Calculates keytag of DNSSEC key, operates on wireformat rdata.
- * \param[in] key the key as uncompressed wireformat rdata.
- * \param[in] keysize length of key data.
- * \return the keytag
- */
-uint16_t sldns_calc_keytag_raw(uint8_t* key, size_t keysize);
-
-#if LDNS_BUILD_CONFIG_HAVE_SSL
-/**
- * Get the PKEY id for GOST, loads GOST into openssl as a side effect.
- * Only available if GOST is compiled into the library and openssl.
- * \return the gost id for EVP_CTX creation.
- */
-int sldns_key_EVP_load_gost_id(void);
-
-/** Release the engine reference held for the GOST engine. */
-void sldns_key_EVP_unload_gost(void);
-
-/**
- * Like sldns_key_buf2dsa, but uses raw buffer.
- * \param[in] key the uncompressed wireformat of the key.
- * \param[in] len length of key data
- * \return a DSA * structure with the key material
- */
-DSA *sldns_key_buf2dsa_raw(unsigned char* key, size_t len);
-
-/**
- * Converts a holding buffer with key material to EVP PKEY in openssl.
- * Only available if ldns was compiled with GOST.
- * \param[in] key data to convert
- * \param[in] keylen length of the key data
- * \return the key or NULL on error.
- */
-EVP_PKEY* sldns_gost2pkey_raw(unsigned char* key, size_t keylen);
-
-/**
- * Converts a holding buffer with key material to EVP PKEY in openssl.
- * Only available if ldns was compiled with ECDSA.
- * \param[in] key data to convert
- * \param[in] keylen length of the key data
- * \param[in] algo precise algorithm to initialize ECC group values.
- * \return the key or NULL on error.
- */
-EVP_PKEY* sldns_ecdsa2pkey_raw(unsigned char* key, size_t keylen, uint8_t algo);
-
-/**
- * Like sldns_key_buf2rsa, but uses raw buffer.
- * \param[in] key the uncompressed wireformat of the key.
- * \param[in] len length of key data
- * \return a RSA * structure with the key material
- */
-RSA *sldns_key_buf2rsa_raw(unsigned char* key, size_t len);
-
-/**
- * Utility function to calculate hash using generic EVP_MD pointer.
- * \param[in] data the data to hash.
- * \param[in] len length of data.
- * \param[out] dest the destination of the hash, must be large enough.
- * \param[in] md the message digest to use.
- * \return true if worked, false on failure.
- */
-int sldns_digest_evp(unsigned char* data, unsigned int len,
- unsigned char* dest, const EVP_MD* md);
-
-#endif /* LDNS_BUILD_CONFIG_HAVE_SSL */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LDNS_KEYRAW_H */
+++ /dev/null
-/*
- * a generic (simple) parser. Use to parse rr's, private key
- * information and /etc/resolv.conf files
- *
- * a Net::DNS like library for C
- * LibDNS Team @ NLnet Labs
- * (c) NLnet Labs, 2005-2006
- * See the file LICENSE for the license
- */
-#include "config.h"
-#include "ldns/parse.h"
-#include "ldns/parseutil.h"
-#include "ldns/sbuffer.h"
-
-#include <limits.h>
-#include <strings.h>
-
-sldns_lookup_table sldns_directive_types[] = {
- { LDNS_DIR_TTL, "$TTL" },
- { LDNS_DIR_ORIGIN, "$ORIGIN" },
- { LDNS_DIR_INCLUDE, "$INCLUDE" },
- { 0, NULL }
-};
-
-/* add max_limit here? */
-ssize_t
-sldns_fget_token(FILE *f, char *token, const char *delim, size_t limit)
-{
- return sldns_fget_token_l(f, token, delim, limit, NULL);
-}
-
-ssize_t
-sldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr)
-{
- int c, prev_c;
- int p; /* 0 -> no parenthese seen, >0 nr of ( seen */
- int com, quoted;
- char *t;
- size_t i;
- const char *d;
- const char *del;
-
- /* standard delimeters */
- if (!delim) {
- /* from isspace(3) */
- del = LDNS_PARSE_NORMAL;
- } else {
- del = delim;
- }
-
- p = 0;
- i = 0;
- com = 0;
- quoted = 0;
- prev_c = 0;
- t = token;
- if (del[0] == '"') {
- quoted = 1;
- }
- while ((c = getc(f)) != EOF) {
- if (c == '\r') /* carriage return */
- c = ' ';
- if (c == '(' && prev_c != '\\' && !quoted) {
- /* this only counts for non-comments */
- if (com == 0) {
- p++;
- }
- prev_c = c;
- continue;
- }
-
- if (c == ')' && prev_c != '\\' && !quoted) {
- /* this only counts for non-comments */
- if (com == 0) {
- p--;
- }
- prev_c = c;
- continue;
- }
-
- if (p < 0) {
- /* more ) then ( - close off the string */
- *t = '\0';
- return 0;
- }
-
- /* do something with comments ; */
- if (c == ';' && quoted == 0) {
- if (prev_c != '\\') {
- com = 1;
- }
- }
- if (c == '\"' && com == 0 && prev_c != '\\') {
- quoted = 1 - quoted;
- }
-
- if (c == '\n' && com != 0) {
- /* comments */
- com = 0;
- *t = ' ';
- if (line_nr) {
- *line_nr = *line_nr + 1;
- }
- if (p == 0 && i > 0) {
- goto tokenread;
- } else {
- prev_c = c;
- continue;
- }
- }
-
- if (com == 1) {
- *t = ' ';
- prev_c = c;
- continue;
- }
-
- if (c == '\n' && p != 0 && t > token) {
- /* in parentheses */
- if (line_nr) {
- *line_nr = *line_nr + 1;
- }
- *t++ = ' ';
- prev_c = c;
- continue;
- }
-
- /* check if we hit the delim */
- for (d = del; *d; d++) {
- if (c == *d && i > 0 && prev_c != '\\' && p == 0) {
- if (c == '\n' && line_nr) {
- *line_nr = *line_nr + 1;
- }
- goto tokenread;
- }
- }
- if (c != '\0' && c != '\n') {
- i++;
- }
- if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) {
- *t = '\0';
- return -1;
- }
- if (c != '\0' && c != '\n') {
- *t++ = c;
- }
- if (c == '\\' && prev_c == '\\')
- prev_c = 0;
- else prev_c = c;
- }
- *t = '\0';
- if (c == EOF) {
- return (ssize_t)i;
- }
-
- if (i == 0) {
- /* nothing read */
- return -1;
- }
- if (p != 0) {
- return -1;
- }
- return (ssize_t)i;
-
-tokenread:
- if(*del == '"')
- /* do not skip over quotes after the string, they are part
- * of the next string. But skip over whitespace (if needed)*/
- sldns_fskipcs_l(f, del+1, line_nr);
- else sldns_fskipcs_l(f, del, line_nr);
- *t = '\0';
- if (p != 0) {
- return -1;
- }
-
- return (ssize_t)i;
-}
-
-ssize_t
-sldns_fget_keyword_data(FILE *f, const char *keyword, const char *k_del, char *data,
- const char *d_del, size_t data_limit)
-{
- return sldns_fget_keyword_data_l(f, keyword, k_del, data, d_del,
- data_limit, NULL);
-}
-
-ssize_t
-sldns_fget_keyword_data_l(FILE *f, const char *keyword, const char *k_del, char *data,
- const char *d_del, size_t data_limit, int *line_nr)
-{
- /* we assume: keyword|sep|data */
- char *fkeyword;
- ssize_t i;
-
- if(strlen(keyword) >= LDNS_MAX_KEYWORDLEN)
- return -1;
- fkeyword = (char*)malloc(LDNS_MAX_KEYWORDLEN);
- if(!fkeyword)
- return -1;
-
- i = sldns_fget_token(f, fkeyword, k_del, LDNS_MAX_KEYWORDLEN);
- if(i==0 || i==-1) {
- free(fkeyword);
- return -1;
- }
-
- /* case??? i instead of strlen? */
- if (strncmp(fkeyword, keyword, LDNS_MAX_KEYWORDLEN - 1) == 0) {
- /* whee! */
- /* printf("%s\n%s\n", "Matching keyword", fkeyword); */
- i = sldns_fget_token_l(f, data, d_del, data_limit, line_nr);
- free(fkeyword);
- return i;
- } else {
- /*printf("no match for %s (read: %s)\n", keyword, fkeyword);*/
- free(fkeyword);
- return -1;
- }
-}
-
-int
-sldns_bgetc(sldns_buffer *buffer)
-{
- if (!sldns_buffer_available_at(buffer, buffer->_position, sizeof(uint8_t))) {
- sldns_buffer_set_position(buffer, sldns_buffer_limit(buffer));
- /* sldns_buffer_rewind(buffer);*/
- return EOF;
- }
- return (int)sldns_buffer_read_u8(buffer);
-}
-
-ssize_t
-sldns_bget_token(sldns_buffer *b, char *token, const char *delim, size_t limit)
-{
- return sldns_bget_token_par(b, token, delim, limit, NULL, NULL);
-}
-
-ssize_t
-sldns_bget_token_par(sldns_buffer *b, char *token, const char *delim,
- size_t limit, int* par, const char* skipw)
-{
- int c, lc;
- int p; /* 0 -> no parenthese seen, >0 nr of ( seen */
- int com, quoted;
- char *t;
- size_t i;
- const char *d;
- const char *del;
-
- /* standard delimiters */
- if (!delim) {
- /* from isspace(3) */
- del = LDNS_PARSE_NORMAL;
- } else {
- del = delim;
- }
-
- p = (par?*par:0);
- i = 0;
- com = 0;
- quoted = 0;
- t = token;
- lc = 0;
- if (del[0] == '"') {
- quoted = 1;
- }
-
- while ((c = sldns_bgetc(b)) != EOF) {
- if (c == '\r') /* carriage return */
- c = ' ';
- if (c == '(' && lc != '\\' && !quoted) {
- /* this only counts for non-comments */
- if (com == 0) {
- if(par) (*par)++;
- p++;
- }
- lc = c;
- continue;
- }
-
- if (c == ')' && lc != '\\' && !quoted) {
- /* this only counts for non-comments */
- if (com == 0) {
- if(par) (*par)--;
- p--;
- }
- lc = c;
- continue;
- }
-
- if (p < 0) {
- /* more ) then ( */
- *t = '\0';
- return 0;
- }
-
- /* do something with comments ; */
- if (c == ';' && quoted == 0) {
- if (lc != '\\') {
- com = 1;
- }
- }
- if (c == '"' && com == 0 && lc != '\\') {
- quoted = 1 - quoted;
- }
-
- if (c == '\n' && com != 0) {
- /* comments */
- com = 0;
- *t = ' ';
- lc = c;
- continue;
- }
-
- if (com == 1) {
- *t = ' ';
- lc = c;
- continue;
- }
-
- if (c == '\n' && p != 0) {
- /* in parentheses */
- /* do not write ' ' if we want to skip spaces */
- if(!(skipw && (strchr(skipw, c)||strchr(skipw, ' '))))
- *t++ = ' ';
- lc = c;
- continue;
- }
-
- /* check to skip whitespace at start, but also after ( */
- if(skipw && i==0 && !com && !quoted && lc != '\\') {
- if(strchr(skipw, c)) {
- lc = c;
- continue;
- }
- }
-
- /* check if we hit the delim */
- for (d = del; *d; d++) {
- /* we can only exit if no parens or user tracks them */
- if (c == *d && lc != '\\' && (p == 0 || par)) {
- goto tokenread;
- }
- }
-
- i++;
- if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) {
- *t = '\0';
- return -1;
- }
- *t++ = c;
-
- if (c == '\\' && lc == '\\') {
- lc = 0;
- } else {
- lc = c;
- }
- }
- *t = '\0';
- if (i == 0) {
- /* nothing read */
- return -1;
- }
- if (!par && p != 0) {
- return -1;
- }
- return (ssize_t)i;
-
-tokenread:
- if(*del == '"')
- /* do not skip over quotes after the string, they are part
- * of the next string. But skip over whitespace (if needed)*/
- sldns_bskipcs(b, del+1);
- else sldns_bskipcs(b, del);
- *t = '\0';
-
- if (!par && p != 0) {
- return -1;
- }
- return (ssize_t)i;
-}
-
-
-void
-sldns_bskipcs(sldns_buffer *buffer, const char *s)
-{
- int found;
- char c;
- const char *d;
-
- while(sldns_buffer_available_at(buffer, buffer->_position, sizeof(char))) {
- c = (char) sldns_buffer_read_u8_at(buffer, buffer->_position);
- found = 0;
- for (d = s; *d; d++) {
- if (*d == c) {
- found = 1;
- }
- }
- if (found && buffer->_limit > buffer->_position) {
- buffer->_position += sizeof(char);
- } else {
- return;
- }
- }
-}
-
-void
-sldns_fskipcs(FILE *fp, const char *s)
-{
- sldns_fskipcs_l(fp, s, NULL);
-}
-
-void
-sldns_fskipcs_l(FILE *fp, const char *s, int *line_nr)
-{
- int found;
- int c;
- const char *d;
-
- while ((c = fgetc(fp)) != EOF) {
- if (line_nr && c == '\n') {
- *line_nr = *line_nr + 1;
- }
- found = 0;
- for (d = s; *d; d++) {
- if (*d == c) {
- found = 1;
- }
- }
- if (!found) {
- /* with getc, we've read too far */
- ungetc(c, fp);
- return;
- }
- }
-}
-
-ssize_t
-sldns_bget_keyword_data(sldns_buffer *b, const char *keyword, const char *k_del, char
-*data, const char *d_del, size_t data_limit)
-{
- /* we assume: keyword|sep|data */
- char *fkeyword;
- ssize_t i;
-
- if(strlen(keyword) >= LDNS_MAX_KEYWORDLEN)
- return -1;
- fkeyword = (char*)malloc(LDNS_MAX_KEYWORDLEN);
- if(!fkeyword)
- return -1; /* out of memory */
-
- i = sldns_bget_token(b, fkeyword, k_del, data_limit);
- if(i==0 || i==-1) {
- free(fkeyword);
- return -1; /* nothing read */
- }
-
- /* case??? */
- if (strncmp(fkeyword, keyword, strlen(keyword)) == 0) {
- free(fkeyword);
- /* whee, the match! */
- /* retrieve it's data */
- i = sldns_bget_token(b, data, d_del, 0);
- return i;
- } else {
- free(fkeyword);
- return -1;
- }
-}
-
+++ /dev/null
-/*
- * parse.h
- *
- * a Net::DNS like library for C
- * LibDNS Team @ NLnet Labs
- * (c) NLnet Labs, 2005-2006
- * See the file LICENSE for the license
- */
-
-#ifndef LDNS_PARSE_H
-#define LDNS_PARSE_H
-
-struct sldns_buffer;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define LDNS_PARSE_SKIP_SPACE "\f\n\r\v"
-#define LDNS_PARSE_NORMAL " \f\n\r\t\v"
-#define LDNS_PARSE_NO_NL " \t"
-#define LDNS_MAX_LINELEN 10230
-#define LDNS_MAX_KEYWORDLEN 32
-
-
-/**
- * \file
- *
- * Contains some low-level parsing functions, mostly used in the _frm_str
- * family of functions.
- */
-
-/**
- * different type of directives in zone files
- * We now deal with $TTL, $ORIGIN and $INCLUDE.
- * The latter is not implemented in ldns (yet)
- */
-enum sldns_enum_directive
-{
- LDNS_DIR_TTL,
- LDNS_DIR_ORIGIN,
- LDNS_DIR_INCLUDE
-};
-typedef enum sldns_enum_directive sldns_directive;
-
-/**
- * returns a token/char from the stream F.
- * This function deals with ( and ) in the stream,
- * and ignores them when encountered
- * \param[in] *f the file to read from
- * \param[out] *token the read token is put here
- * \param[in] *delim chars at which the parsing should stop
- * \param[in] *limit how much to read. If 0 the builtin maximum is used
- * \return 0 on error of EOF of the stream F. Otherwise return the length of what is read
- */
-ssize_t sldns_fget_token(FILE *f, char *token, const char *delim, size_t limit);
-
-/**
- * returns a token/char from the stream F.
- * This function deals with ( and ) in the stream,
- * and ignores when it finds them.
- * \param[in] *f the file to read from
- * \param[out] *token the token is put here
- * \param[in] *delim chars at which the parsing should stop
- * \param[in] *limit how much to read. If 0 use builtin maximum
- * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes)
- * \return 0 on error of EOF of F otherwise return the length of what is read
- */
-ssize_t sldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr);
-
-/**
- * returns a token/char from the buffer b.
- * This function deals with ( and ) in the buffer,
- * and ignores when it finds them.
- * \param[in] *b the buffer to read from
- * \param[out] *token the token is put here
- * \param[in] *delim chars at which the parsing should stop
- * \param[in] *limit how much to read. If 0 the builtin maximum is used
- * \param[in] *par if you pass nonNULL, set to 0 on first call, the parenthesis
- * state is stored in it, for use on next call. User must check it is back
- * to zero after last bget in string (for parse error). If you pass NULL,
- * the entire parenthesized string is read in.
- * \param[in] skipw string with whitespace to skip before the start of the
- * token, like " ", or " \t", or NULL for none.
- * \returns 0 on error of EOF of b. Otherwise return the length of what is read
- */
-ssize_t sldns_bget_token_par(struct sldns_buffer *b, char *token, const char *delim, size_t limit, int* par, const char* skipw);
-
-/**
- * returns a token/char from the buffer b.
- * This function deals with ( and ) in the buffer,
- * and ignores when it finds them.
- * \param[in] *b the buffer to read from
- * \param[out] *token the token is put here
- * \param[in] *delim chars at which the parsing should stop
- * \param[in] *limit how much to read. If 0 the builtin maximum is used
- * \returns 0 on error of EOF of b. Otherwise return the length of what is read
- */
-ssize_t sldns_bget_token(struct sldns_buffer *b, char *token, const char *delim, size_t limit);
-
-/*
- * searches for keyword and delim in a file. Gives everything back
- * after the keyword + k_del until we hit d_del
- * \param[in] f file pointer to read from
- * \param[in] keyword keyword to look for
- * \param[in] k_del keyword delimeter
- * \param[out] data the data found
- * \param[in] d_del the data delimeter
- * \param[in] data_limit maximum size the the data buffer
- * \return the number of character read
- */
-ssize_t sldns_fget_keyword_data(FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit);
-
-/*
- * searches for keyword and delim. Gives everything back
- * after the keyword + k_del until we hit d_del
- * \param[in] f file pointer to read from
- * \param[in] keyword keyword to look for
- * \param[in] k_del keyword delimeter
- * \param[out] data the data found
- * \param[in] d_del the data delimeter
- * \param[in] data_limit maximum size the the data buffer
- * \param[in] line_nr pointer to an integer containing the current line number (for
-debugging purposes)
- * \return the number of character read
- */
-ssize_t sldns_fget_keyword_data_l(FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit, int *line_nr);
-
-/*
- * searches for keyword and delim in a buffer. Gives everything back
- * after the keyword + k_del until we hit d_del
- * \param[in] b buffer pointer to read from
- * \param[in] keyword keyword to look for
- * \param[in] k_del keyword delimeter
- * \param[out] data the data found
- * \param[in] d_del the data delimeter
- * \param[in] data_limit maximum size the the data buffer
- * \return the number of character read
- */
-ssize_t sldns_bget_keyword_data(struct sldns_buffer *b, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit);
-
-/**
- * returns the next character from a buffer. Advances the position pointer with 1.
- * When end of buffer is reached returns EOF. This is the buffer's equivalent
- * for getc().
- * \param[in] *buffer buffer to read from
- * \return EOF on failure otherwise return the character
- */
-int sldns_bgetc(struct sldns_buffer *buffer);
-
-/**
- * skips all of the characters in the given string in the buffer, moving
- * the position to the first character that is not in *s.
- * \param[in] *buffer buffer to use
- * \param[in] *s characters to skip
- * \return void
- */
-void sldns_bskipcs(struct sldns_buffer *buffer, const char *s);
-
-/**
- * skips all of the characters in the given string in the fp, moving
- * the position to the first character that is not in *s.
- * \param[in] *fp file to use
- * \param[in] *s characters to skip
- * \return void
- */
-void sldns_fskipcs(FILE *fp, const char *s);
-
-
-/**
- * skips all of the characters in the given string in the fp, moving
- * the position to the first character that is not in *s.
- * \param[in] *fp file to use
- * \param[in] *s characters to skip
- * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes)
- * \return void
- */
-void sldns_fskipcs_l(FILE *fp, const char *s, int *line_nr);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LDNS_PARSE_H */
+++ /dev/null
-/*
- * parseutil.c - parse utilities for string and wire conversion
- *
- * (c) NLnet Labs, 2004-2006
- *
- * See the file LICENSE for the license
- */
-/**
- * \file
- *
- * Utility functions for parsing, base32(DNS variant) and base64 encoding
- * and decoding, Hex, Time units, Escape codes.
- */
-
-#include "config.h"
-#include "ldns/parseutil.h"
-#include <sys/time.h>
-#include <time.h>
-#include <ctype.h>
-
-sldns_lookup_table *
-sldns_lookup_by_name(sldns_lookup_table *table, const char *name)
-{
- while (table->name != NULL) {
- if (strcasecmp(name, table->name) == 0)
- return table;
- table++;
- }
- return NULL;
-}
-
-sldns_lookup_table *
-sldns_lookup_by_id(sldns_lookup_table *table, int id)
-{
- while (table->name != NULL) {
- if (table->id == id)
- return table;
- table++;
- }
- return NULL;
-}
-
-/* Number of days per month (except for February in leap years). */
-static const int mdays[] = {
- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-
-#define LDNS_MOD(x,y) (((x) % (y) < 0) ? ((x) % (y) + (y)) : ((x) % (y)))
-#define LDNS_DIV(x,y) (((x) % (y) < 0) ? ((x) / (y) - 1 ) : ((x) / (y)))
-
-static int
-is_leap_year(int year)
-{
- return LDNS_MOD(year, 4) == 0 && (LDNS_MOD(year, 100) != 0
- || LDNS_MOD(year, 400) == 0);
-}
-
-static int
-leap_days(int y1, int y2)
-{
- --y1;
- --y2;
- return (LDNS_DIV(y2, 4) - LDNS_DIV(y1, 4)) -
- (LDNS_DIV(y2, 100) - LDNS_DIV(y1, 100)) +
- (LDNS_DIV(y2, 400) - LDNS_DIV(y1, 400));
-}
-
-/*
- * Code adapted from Python 2.4.1 sources (Lib/calendar.py).
- */
-time_t
-sldns_mktime_from_utc(const struct tm *tm)
-{
- int year = 1900 + tm->tm_year;
- time_t days = 365 * ((time_t) year - 1970) + leap_days(1970, year);
- time_t hours;
- time_t minutes;
- time_t seconds;
- int i;
-
- for (i = 0; i < tm->tm_mon; ++i) {
- days += mdays[i];
- }
- if (tm->tm_mon > 1 && is_leap_year(year)) {
- ++days;
- }
- days += tm->tm_mday - 1;
-
- hours = days * 24 + tm->tm_hour;
- minutes = hours * 60 + tm->tm_min;
- seconds = minutes * 60 + tm->tm_sec;
-
- return seconds;
-}
-
-#if SIZEOF_TIME_T <= 4
-
-static void
-sldns_year_and_yday_from_days_since_epoch(int64_t days, struct tm *result)
-{
- int year = 1970;
- int new_year;
-
- while (days < 0 || days >= (int64_t) (is_leap_year(year) ? 366 : 365)) {
- new_year = year + (int) LDNS_DIV(days, 365);
- days -= (new_year - year) * 365;
- days -= leap_days(year, new_year);
- year = new_year;
- }
- result->tm_year = year;
- result->tm_yday = (int) days;
-}
-
-/* Number of days per month in a leap year. */
-static const int leap_year_mdays[] = {
- 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-
-static void
-sldns_mon_and_mday_from_year_and_yday(struct tm *result)
-{
- int idays = result->tm_yday;
- const int *mon_lengths = is_leap_year(result->tm_year) ?
- leap_year_mdays : mdays;
-
- result->tm_mon = 0;
- while (idays >= mon_lengths[result->tm_mon]) {
- idays -= mon_lengths[result->tm_mon++];
- }
- result->tm_mday = idays + 1;
-}
-
-static void
-sldns_wday_from_year_and_yday(struct tm *result)
-{
- result->tm_wday = 4 /* 1-1-1970 was a thursday */
- + LDNS_MOD((result->tm_year - 1970), 7) * LDNS_MOD(365, 7)
- + leap_days(1970, result->tm_year)
- + result->tm_yday;
- result->tm_wday = LDNS_MOD(result->tm_wday, 7);
- if (result->tm_wday < 0) {
- result->tm_wday += 7;
- }
-}
-
-static struct tm *
-sldns_gmtime64_r(int64_t clock, struct tm *result)
-{
- result->tm_isdst = 0;
- result->tm_sec = (int) LDNS_MOD(clock, 60);
- clock = LDNS_DIV(clock, 60);
- result->tm_min = (int) LDNS_MOD(clock, 60);
- clock = LDNS_DIV(clock, 60);
- result->tm_hour = (int) LDNS_MOD(clock, 24);
- clock = LDNS_DIV(clock, 24);
-
- sldns_year_and_yday_from_days_since_epoch(clock, result);
- sldns_mon_and_mday_from_year_and_yday(result);
- sldns_wday_from_year_and_yday(result);
- result->tm_year -= 1900;
-
- return result;
-}
-
-#endif /* SIZEOF_TIME_T <= 4 */
-
-static int64_t
-sldns_serial_arithmitics_time(int32_t time, time_t now)
-{
- int32_t offset = time - (int32_t) now;
- return (int64_t) now + offset;
-}
-
-struct tm *
-sldns_serial_arithmitics_gmtime_r(int32_t time, time_t now, struct tm *result)
-{
-#if SIZEOF_TIME_T <= 4
- int64_t secs_since_epoch = sldns_serial_arithmitics_time(time, now);
- return sldns_gmtime64_r(secs_since_epoch, result);
-#else
- time_t secs_since_epoch = sldns_serial_arithmitics_time(time, now);
- return gmtime_r(&secs_since_epoch, result);
-#endif
-}
-
-int
-sldns_hexdigit_to_int(char ch)
-{
- switch (ch) {
- case '0': return 0;
- case '1': return 1;
- case '2': return 2;
- case '3': return 3;
- case '4': return 4;
- case '5': return 5;
- case '6': return 6;
- case '7': return 7;
- case '8': return 8;
- case '9': return 9;
- case 'a': case 'A': return 10;
- case 'b': case 'B': return 11;
- case 'c': case 'C': return 12;
- case 'd': case 'D': return 13;
- case 'e': case 'E': return 14;
- case 'f': case 'F': return 15;
- default:
- return -1;
- }
-}
-
-uint32_t
-sldns_str2period(const char *nptr, const char **endptr)
-{
- int sign = 0;
- uint32_t i = 0;
- uint32_t seconds = 0;
-
- for(*endptr = nptr; **endptr; (*endptr)++) {
- switch (**endptr) {
- case ' ':
- case '\t':
- break;
- case '-':
- if(sign == 0) {
- sign = -1;
- } else {
- return seconds;
- }
- break;
- case '+':
- if(sign == 0) {
- sign = 1;
- } else {
- return seconds;
- }
- break;
- case 's':
- case 'S':
- seconds += i;
- i = 0;
- break;
- case 'm':
- case 'M':
- seconds += i * 60;
- i = 0;
- break;
- case 'h':
- case 'H':
- seconds += i * 60 * 60;
- i = 0;
- break;
- case 'd':
- case 'D':
- seconds += i * 60 * 60 * 24;
- i = 0;
- break;
- case 'w':
- case 'W':
- seconds += i * 60 * 60 * 24 * 7;
- i = 0;
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- i *= 10;
- i += (**endptr - '0');
- break;
- default:
- seconds += i;
- /* disregard signedness */
- return seconds;
- }
- }
- seconds += i;
- /* disregard signedness */
- return seconds;
-}
-
-int
-sldns_parse_escape(uint8_t *ch_p, const char** str_p)
-{
- uint16_t val;
-
- if ((*str_p)[0] && isdigit((unsigned char)(*str_p)[0]) &&
- (*str_p)[1] && isdigit((unsigned char)(*str_p)[1]) &&
- (*str_p)[2] && isdigit((unsigned char)(*str_p)[2])) {
-
- val = (uint16_t)(((*str_p)[0] - '0') * 100 +
- ((*str_p)[1] - '0') * 10 +
- ((*str_p)[2] - '0'));
-
- if (val > 255) {
- goto error;
- }
- *ch_p = (uint8_t)val;
- *str_p += 3;
- return 1;
-
- } else if ((*str_p)[0] && !isdigit((unsigned char)(*str_p)[0])) {
-
- *ch_p = (uint8_t)*(*str_p)++;
- return 1;
- }
-error:
- *str_p = NULL;
- return 0; /* LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE */
-}
-
-/** parse one character, with escape codes */
-int
-sldns_parse_char(uint8_t *ch_p, const char** str_p)
-{
- switch (**str_p) {
-
- case '\0': return 0;
-
- case '\\': *str_p += 1;
- return sldns_parse_escape(ch_p, str_p);
-
- default: *ch_p = (uint8_t)*(*str_p)++;
- return 1;
- }
-}
-
-size_t sldns_b32_ntop_calculate_size(size_t src_data_length)
-{
- return src_data_length == 0 ? 0 : ((src_data_length - 1) / 5 + 1) * 8;
-}
-
-size_t sldns_b32_ntop_calculate_size_no_padding(size_t src_data_length)
-{
- return ((src_data_length + 3) * 8 / 5) - 4;
-}
-
-static int
-sldns_b32_ntop_base(const uint8_t* src, size_t src_sz, char* dst, size_t dst_sz,
- int extended_hex, int add_padding)
-{
- size_t ret_sz;
- const char* b32 = extended_hex ? "0123456789abcdefghijklmnopqrstuv"
- : "abcdefghijklmnopqrstuvwxyz234567";
-
- size_t c = 0; /* c is used to carry partial base32 character over
- * byte boundaries for sizes with a remainder.
- * (i.e. src_sz % 5 != 0)
- */
-
- ret_sz = add_padding ? sldns_b32_ntop_calculate_size(src_sz)
- : sldns_b32_ntop_calculate_size_no_padding(src_sz);
-
- /* Do we have enough space? */
- if (dst_sz < ret_sz + 1)
- return -1;
-
- /* We know the size; terminate the string */
- dst[ret_sz] = '\0';
-
- /* First process all chunks of five */
- while (src_sz >= 5) {
- /* 00000... ........ ........ ........ ........ */
- dst[0] = b32[(src[0] ) >> 3];
-
- /* .....111 11...... ........ ........ ........ */
- dst[1] = b32[(src[0] & 0x07) << 2 | src[1] >> 6];
-
- /* ........ ..22222. ........ ........ ........ */
- dst[2] = b32[(src[1] & 0x3e) >> 1];
-
- /* ........ .......3 3333.... ........ ........ */
- dst[3] = b32[(src[1] & 0x01) << 4 | src[2] >> 4];
-
- /* ........ ........ ....4444 4....... ........ */
- dst[4] = b32[(src[2] & 0x0f) << 1 | src[3] >> 7];
-
- /* ........ ........ ........ .55555.. ........ */
- dst[5] = b32[(src[3] & 0x7c) >> 2];
-
- /* ........ ........ ........ ......66 666..... */
- dst[6] = b32[(src[3] & 0x03) << 3 | src[4] >> 5];
-
- /* ........ ........ ........ ........ ...77777 */
- dst[7] = b32[(src[4] & 0x1f) ];
-
- src_sz -= 5;
- src += 5;
- dst += 8;
- }
- /* Process what remains */
- switch (src_sz) {
- case 4: /* ........ ........ ........ ......66 666..... */
- dst[6] = b32[(src[3] & 0x03) << 3];
-
- /* ........ ........ ........ .55555.. ........ */
- dst[5] = b32[(src[3] & 0x7c) >> 2];
-
- /* ........ ........ ....4444 4....... ........ */
- c = src[3] >> 7 ;
- case 3: dst[4] = b32[(src[2] & 0x0f) << 1 | c];
-
- /* ........ .......3 3333.... ........ ........ */
- c = src[2] >> 4 ;
- case 2: dst[3] = b32[(src[1] & 0x01) << 4 | c];
-
- /* ........ ..22222. ........ ........ ........ */
- dst[2] = b32[(src[1] & 0x3e) >> 1];
-
- /* .....111 11...... ........ ........ ........ */
- c = src[1] >> 6 ;
- case 1: dst[1] = b32[(src[0] & 0x07) << 2 | c];
-
- /* 00000... ........ ........ ........ ........ */
- dst[0] = b32[ src[0] >> 3];
- }
- /* Add padding */
- if (add_padding) {
- switch (src_sz) {
- case 1: dst[2] = '=';
- dst[3] = '=';
- case 2: dst[4] = '=';
- case 3: dst[5] = '=';
- dst[6] = '=';
- case 4: dst[7] = '=';
- }
- }
- return (int)ret_sz;
-}
-
-int
-sldns_b32_ntop(const uint8_t* src, size_t src_sz, char* dst, size_t dst_sz)
-{
- return sldns_b32_ntop_base(src, src_sz, dst, dst_sz, 0, 1);
-}
-
-int
-sldns_b32_ntop_extended_hex(const uint8_t* src, size_t src_sz,
- char* dst, size_t dst_sz)
-{
- return sldns_b32_ntop_base(src, src_sz, dst, dst_sz, 1, 1);
-}
-
-size_t sldns_b32_pton_calculate_size(size_t src_text_length)
-{
- return src_text_length * 5 / 8;
-}
-
-static int
-sldns_b32_pton_base(const char* src, size_t src_sz, uint8_t* dst, size_t dst_sz,
- int extended_hex, int check_padding)
-{
- size_t i = 0;
- char ch = '\0';
- uint8_t buf[8];
- uint8_t* start = dst;
-
- while (src_sz) {
- /* Collect 8 characters in buf (if possible) */
- for (i = 0; i < 8; i++) {
-
- do {
- ch = *src++;
- --src_sz;
-
- } while (isspace((unsigned char)ch) && src_sz > 0);
-
- if (ch == '=' || ch == '\0')
- break;
-
- else if (extended_hex)
-
- if (ch >= '0' && ch <= '9')
- buf[i] = (uint8_t)ch - '0';
- else if (ch >= 'a' && ch <= 'v')
- buf[i] = (uint8_t)ch - 'a' + 10;
- else if (ch >= 'A' && ch <= 'V')
- buf[i] = (uint8_t)ch - 'A' + 10;
- else
- return -1;
-
- else if (ch >= 'a' && ch <= 'z')
- buf[i] = (uint8_t)ch - 'a';
- else if (ch >= 'A' && ch <= 'Z')
- buf[i] = (uint8_t)ch - 'A';
- else if (ch >= '2' && ch <= '7')
- buf[i] = (uint8_t)ch - '2' + 26;
- else
- return -1;
- }
- /* Less that 8 characters. We're done. */
- if (i < 8)
- break;
-
- /* Enough space available at the destination? */
- if (dst_sz < 5)
- return -1;
-
- /* 00000... ........ ........ ........ ........ */
- /* .....111 11...... ........ ........ ........ */
- dst[0] = buf[0] << 3 | buf[1] >> 2;
-
- /* .....111 11...... ........ ........ ........ */
- /* ........ ..22222. ........ ........ ........ */
- /* ........ .......3 3333.... ........ ........ */
- dst[1] = buf[1] << 6 | buf[2] << 1 | buf[3] >> 4;
-
- /* ........ .......3 3333.... ........ ........ */
- /* ........ ........ ....4444 4....... ........ */
- dst[2] = buf[3] << 4 | buf[4] >> 1;
-
- /* ........ ........ ....4444 4....... ........ */
- /* ........ ........ ........ .55555.. ........ */
- /* ........ ........ ........ ......66 666..... */
- dst[3] = buf[4] << 7 | buf[5] << 2 | buf[6] >> 3;
-
- /* ........ ........ ........ ......66 666..... */
- /* ........ ........ ........ ........ ...77777 */
- dst[4] = buf[6] << 5 | buf[7];
-
- dst += 5;
- dst_sz -= 5;
- }
- /* Not ending on a eight byte boundary? */
- if (i > 0 && i < 8) {
-
- /* Enough space available at the destination? */
- if (dst_sz < (i + 1) / 2)
- return -1;
-
- switch (i) {
- case 7: /* ........ ........ ........ ......66 666..... */
- /* ........ ........ ........ .55555.. ........ */
- /* ........ ........ ....4444 4....... ........ */
- dst[3] = buf[4] << 7 | buf[5] << 2 | buf[6] >> 3;
-
- case 5: /* ........ ........ ....4444 4....... ........ */
- /* ........ .......3 3333.... ........ ........ */
- dst[2] = buf[3] << 4 | buf[4] >> 1;
-
- case 4: /* ........ .......3 3333.... ........ ........ */
- /* ........ ..22222. ........ ........ ........ */
- /* .....111 11...... ........ ........ ........ */
- dst[1] = buf[1] << 6 | buf[2] << 1 | buf[3] >> 4;
-
- case 2: /* .....111 11...... ........ ........ ........ */
- /* 00000... ........ ........ ........ ........ */
- dst[0] = buf[0] << 3 | buf[1] >> 2;
-
- break;
-
- default:
- return -1;
- }
- dst += (i + 1) / 2;
-
- if (check_padding) {
- /* Check remaining padding characters */
- if (ch != '=')
- return -1;
-
- /* One down, 8 - i - 1 more to come... */
- for (i = 8 - i - 1; i > 0; i--) {
-
- do {
- if (src_sz == 0)
- return -1;
- ch = *src++;
- src_sz--;
-
- } while (isspace((unsigned char)ch));
-
- if (ch != '=')
- return -1;
- }
- }
- }
- return dst - start;
-}
-
-int
-sldns_b32_pton(const char* src, size_t src_sz, uint8_t* dst, size_t dst_sz)
-{
- return sldns_b32_pton_base(src, src_sz, dst, dst_sz, 0, 1);
-}
-
-int
-sldns_b32_pton_extended_hex(const char* src, size_t src_sz,
- uint8_t* dst, size_t dst_sz)
-{
- return sldns_b32_pton_base(src, src_sz, dst, dst_sz, 1, 1);
-}
-
-size_t sldns_b64_ntop_calculate_size(size_t srcsize)
-{
- return ((((srcsize + 2) / 3) * 4) + 1);
-}
-
-/* RFC 1521, section 5.2.
- *
- * The encoding process represents 24-bit groups of input bits as output
- * strings of 4 encoded characters. Proceeding from left to right, a
- * 24-bit input group is formed by concatenating 3 8-bit input groups.
- * These 24 bits are then treated as 4 concatenated 6-bit groups, each
- * of which is translated into a single digit in the base64 alphabet.
- *
- * This routine does not insert spaces or linebreaks after 76 characters.
- */
-int sldns_b64_ntop(uint8_t const *src, size_t srclength,
- char *target, size_t targsize)
-{
- const char* b64 =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- const char pad64 = '=';
- size_t i = 0, o = 0;
- if(targsize < sldns_b64_ntop_calculate_size(srclength))
- return -1;
- /* whole chunks: xxxxxxyy yyyyzzzz zzwwwwww */
- while(i+3 <= srclength) {
- if(o+4 > targsize) return -1;
- target[o] = b64[src[i] >> 2];
- target[o+1] = b64[ ((src[i]&0x03)<<4) | (src[i+1]>>4) ];
- target[o+2] = b64[ ((src[i+1]&0x0f)<<2) | (src[i+2]>>6) ];
- target[o+3] = b64[ (src[i+2]&0x3f) ];
- i += 3;
- o += 4;
- }
- /* remainder */
- switch(srclength - i) {
- case 2:
- /* two at end, converted into A B C = */
- target[o] = b64[src[i] >> 2];
- target[o+1] = b64[ ((src[i]&0x03)<<4) | (src[i+1]>>4) ];
- target[o+2] = b64[ ((src[i+1]&0x0f)<<2) ];
- target[o+3] = pad64;
- i += 2;
- o += 4;
- break;
- case 1:
- /* one at end, converted into A B = = */
- target[o] = b64[src[i] >> 2];
- target[o+1] = b64[ ((src[i]&0x03)<<4) ];
- target[o+2] = pad64;
- target[o+3] = pad64;
- i += 1;
- o += 4;
- break;
- case 0:
- default:
- /* nothing */
- break;
- }
- /* assert: i == srclength */
- if(o+1 > targsize) return -1;
- target[o] = 0;
- return (int)o;
-}
-
-size_t sldns_b64_pton_calculate_size(size_t srcsize)
-{
- return (((((srcsize + 3) / 4) * 3)) + 1);
-}
-
-int sldns_b64_pton(char const *src, uint8_t *target, size_t targsize)
-{
- const uint8_t pad64 = 64; /* is 64th in the b64 array */
- const char* s = src;
- uint8_t in[4];
- size_t o = 0, incount = 0;
-
- while(*s) {
- /* skip any character that is not base64 */
- /* conceptually we do:
- const char* b64 = pad'=' is appended to array
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
- const char* d = strchr(b64, *s++);
- and use d-b64;
- */
- char d = *s++;
- if(d <= 'Z' && d >= 'A')
- d -= 'A';
- else if(d <= 'z' && d >= 'a')
- d = d - 'a' + 26;
- else if(d <= '9' && d >= '0')
- d = d - '0' + 52;
- else if(d == '+')
- d = 62;
- else if(d == '/')
- d = 63;
- else if(d == '=')
- d = 64;
- else continue;
- in[incount++] = (uint8_t)d;
- if(incount != 4)
- continue;
- /* process whole block of 4 characters into 3 output bytes */
- if(in[3] == pad64 && in[2] == pad64) { /* A B = = */
- if(o+1 > targsize)
- return -1;
- target[o] = (in[0]<<2) | ((in[1]&0x30)>>4);
- o += 1;
- break; /* we are done */
- } else if(in[3] == pad64) { /* A B C = */
- if(o+2 > targsize)
- return -1;
- target[o] = (in[0]<<2) | ((in[1]&0x30)>>4);
- target[o+1]= ((in[1]&0x0f)<<4) | ((in[2]&0x3c)>>2);
- o += 2;
- break; /* we are done */
- } else {
- if(o+3 > targsize)
- return -1;
- /* write xxxxxxyy yyyyzzzz zzwwwwww */
- target[o] = (in[0]<<2) | ((in[1]&0x30)>>4);
- target[o+1]= ((in[1]&0x0f)<<4) | ((in[2]&0x3c)>>2);
- target[o+2]= ((in[2]&0x03)<<6) | in[3];
- o += 3;
- }
- incount = 0;
- }
- return (int)o;
-}
+++ /dev/null
-/*
- * parseutil.h - parse utilities for string and wire conversion
- *
- * (c) NLnet Labs, 2004
- *
- * See the file LICENSE for the license
- */
-/**
- * \file
- *
- * Utility functions for parsing, base32(DNS variant) and base64 encoding
- * and decoding, Hex, Time units, Escape codes.
- */
-
-#ifndef LDNS_PARSEUTIL_H
-#define LDNS_PARSEUTIL_H
-struct tm;
-
-/**
- * A general purpose lookup table
- *
- * Lookup tables are arrays of (id, name) pairs,
- * So you can for instance lookup the RCODE 3, which is "NXDOMAIN",
- * and vice versa. The lookup tables themselves are defined wherever needed,
- * for instance in host2str.c
- */
-struct sldns_struct_lookup_table {
- int id;
- const char *name;
-};
-typedef struct sldns_struct_lookup_table sldns_lookup_table;
-
-/**
- * Looks up the table entry by name, returns NULL if not found.
- * \param[in] table the lookup table to search in
- * \param[in] name what to search for
- * \return the item found
- */
-sldns_lookup_table *sldns_lookup_by_name(sldns_lookup_table table[],
- const char *name);
-/**
- * Looks up the table entry by id, returns NULL if not found.
- * \param[in] table the lookup table to search in
- * \param[in] id what to search for
- * \return the item found
- */
-sldns_lookup_table *sldns_lookup_by_id(sldns_lookup_table table[], int id);
-
-/**
- * Convert TM to seconds since epoch (midnight, January 1st, 1970).
- * Like timegm(3), which is not always available.
- * \param[in] tm a struct tm* with the date
- * \return the seconds since epoch
- */
-time_t sldns_mktime_from_utc(const struct tm *tm);
-
-/**
- * The function interprets time as the number of seconds since epoch
- * with respect to now using serial arithmitics (rfc1982).
- * That number of seconds is then converted to broken-out time information.
- * This is especially usefull when converting the inception and expiration
- * fields of RRSIG records.
- *
- * \param[in] time number of seconds since epoch (midnight, January 1st, 1970)
- * to be intepreted as a serial arithmitics number relative to now.
- * \param[in] now number of seconds since epoch (midnight, January 1st, 1970)
- * to which the time value is compared to determine the final value.
- * \param[out] result the struct with the broken-out time information
- * \return result on success or NULL on error
- */
-struct tm * sldns_serial_arithmitics_gmtime_r(int32_t time, time_t now, struct tm *result);
-
-/**
- * converts a ttl value (like 5d2h) to a long.
- * \param[in] nptr the start of the string
- * \param[out] endptr points to the last char in case of error
- * \return the convert duration value
- */
-uint32_t sldns_str2period(const char *nptr, const char **endptr);
-
-/**
- * Returns the int value of the given (hex) digit
- * \param[in] ch the hex char to convert
- * \return the converted decimal value
- */
-int sldns_hexdigit_to_int(char ch);
-
-/**
- * calculates the size needed to store the result of b64_ntop
- */
-size_t sldns_b64_ntop_calculate_size(size_t srcsize);
-
-int sldns_b64_ntop(uint8_t const *src, size_t srclength,
- char *target, size_t targsize);
-
-/**
- * calculates the size needed to store the result of sldns_b64_pton
- */
-size_t sldns_b64_pton_calculate_size(size_t srcsize);
-
-int sldns_b64_pton(char const *src, uint8_t *target, size_t targsize);
-
-/**
- * calculates the size needed to store the result of b32_ntop
- */
-size_t sldns_b32_ntop_calculate_size(size_t src_data_length);
-
-size_t sldns_b32_ntop_calculate_size_no_padding(size_t src_data_length);
-
-int sldns_b32_ntop(const uint8_t* src_data, size_t src_data_length,
- char* target_text_buffer, size_t target_text_buffer_size);
-
-int sldns_b32_ntop_extended_hex(const uint8_t* src_data, size_t src_data_length,
- char* target_text_buffer, size_t target_text_buffer_size);
-
-/**
- * calculates the size needed to store the result of b32_pton
- */
-size_t sldns_b32_pton_calculate_size(size_t src_text_length);
-
-int sldns_b32_pton(const char* src_text, size_t src_text_length,
- uint8_t* target_data_buffer, size_t target_data_buffer_size);
-
-int sldns_b32_pton_extended_hex(const char* src_text, size_t src_text_length,
- uint8_t* target_data_buffer, size_t target_data_buffer_size);
-
-/*
- * Checks whether the escaped value at **s is an octal value or
- * a 'normally' escaped character (and not eos)
- *
- * @param ch_p: the parsed character
- * @param str_p: the string. moved along for characters read.
- * The string pointer at *s is increased by either 0 (on error), 1 (on
- * normal escapes), or 3 (on octals)
- *
- * @return 0 on error
- */
-int sldns_parse_escape(uint8_t *ch_p, const char** str_p);
-
-/**
- * Parse one character, with escape codes,
- * @param ch_p: the parsed character
- * @param str_p: the string. moved along for characters read.
- * @return 0 on error
- */
-int sldns_parse_char(uint8_t *ch_p, const char** str_p);
-
-#endif /* LDNS_PARSEUTIL_H */
+++ /dev/null
-/*
- * pkthdr.h - packet header from wire conversion routines
- *
- * a Net::DNS like library for C
- *
- * (c) NLnet Labs, 2005-2006
- *
- * See the file LICENSE for the license
- */
-
-/**
- * \file
- *
- * Contains functions that translate dns data from the wire format (as sent
- * by servers and clients) to the internal structures for the packet header.
- */
-
-#ifndef LDNS_PKTHDR_H
-#define LDNS_PKTHDR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* The length of the header */
-#define LDNS_HEADER_SIZE 12
-
-/* First octet of flags */
-#define LDNS_RD_MASK 0x01U
-#define LDNS_RD_SHIFT 0
-#define LDNS_RD_WIRE(wirebuf) (*(wirebuf+2) & LDNS_RD_MASK)
-#define LDNS_RD_SET(wirebuf) (*(wirebuf+2) |= LDNS_RD_MASK)
-#define LDNS_RD_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_RD_MASK)
-
-#define LDNS_TC_MASK 0x02U
-#define LDNS_TC_SHIFT 1
-#define LDNS_TC_WIRE(wirebuf) (*(wirebuf+2) & LDNS_TC_MASK)
-#define LDNS_TC_SET(wirebuf) (*(wirebuf+2) |= LDNS_TC_MASK)
-#define LDNS_TC_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_TC_MASK)
-
-#define LDNS_AA_MASK 0x04U
-#define LDNS_AA_SHIFT 2
-#define LDNS_AA_WIRE(wirebuf) (*(wirebuf+2) & LDNS_AA_MASK)
-#define LDNS_AA_SET(wirebuf) (*(wirebuf+2) |= LDNS_AA_MASK)
-#define LDNS_AA_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_AA_MASK)
-
-#define LDNS_OPCODE_MASK 0x78U
-#define LDNS_OPCODE_SHIFT 3
-#define LDNS_OPCODE_WIRE(wirebuf) ((*(wirebuf+2) & LDNS_OPCODE_MASK) >> LDNS_OPCODE_SHIFT)
-#define LDNS_OPCODE_SET(wirebuf, opcode) \
- (*(wirebuf+2) = ((*(wirebuf+2)) & ~LDNS_OPCODE_MASK) | ((opcode) << LDNS_OPCODE_SHIFT))
-
-#define LDNS_QR_MASK 0x80U
-#define LDNS_QR_SHIFT 7
-#define LDNS_QR_WIRE(wirebuf) (*(wirebuf+2) & LDNS_QR_MASK)
-#define LDNS_QR_SET(wirebuf) (*(wirebuf+2) |= LDNS_QR_MASK)
-#define LDNS_QR_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_QR_MASK)
-
-/* Second octet of flags */
-#define LDNS_RCODE_MASK 0x0fU
-#define LDNS_RCODE_SHIFT 0
-#define LDNS_RCODE_WIRE(wirebuf) (*(wirebuf+3) & LDNS_RCODE_MASK)
-#define LDNS_RCODE_SET(wirebuf, rcode) \
- (*(wirebuf+3) = ((*(wirebuf+3)) & ~LDNS_RCODE_MASK) | (rcode))
-
-#define LDNS_CD_MASK 0x10U
-#define LDNS_CD_SHIFT 4
-#define LDNS_CD_WIRE(wirebuf) (*(wirebuf+3) & LDNS_CD_MASK)
-#define LDNS_CD_SET(wirebuf) (*(wirebuf+3) |= LDNS_CD_MASK)
-#define LDNS_CD_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_CD_MASK)
-
-#define LDNS_AD_MASK 0x20U
-#define LDNS_AD_SHIFT 5
-#define LDNS_AD_WIRE(wirebuf) (*(wirebuf+3) & LDNS_AD_MASK)
-#define LDNS_AD_SET(wirebuf) (*(wirebuf+3) |= LDNS_AD_MASK)
-#define LDNS_AD_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_AD_MASK)
-
-#define LDNS_Z_MASK 0x40U
-#define LDNS_Z_SHIFT 6
-#define LDNS_Z_WIRE(wirebuf) (*(wirebuf+3) & LDNS_Z_MASK)
-#define LDNS_Z_SET(wirebuf) (*(wirebuf+3) |= LDNS_Z_MASK)
-#define LDNS_Z_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_Z_MASK)
-
-#define LDNS_RA_MASK 0x80U
-#define LDNS_RA_SHIFT 7
-#define LDNS_RA_WIRE(wirebuf) (*(wirebuf+3) & LDNS_RA_MASK)
-#define LDNS_RA_SET(wirebuf) (*(wirebuf+3) |= LDNS_RA_MASK)
-#define LDNS_RA_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_RA_MASK)
-
-/* Query ID */
-#define LDNS_ID_WIRE(wirebuf) (sldns_read_uint16(wirebuf))
-#define LDNS_ID_SET(wirebuf, id) (sldns_write_uint16(wirebuf, id))
-
-/* Counter of the question section */
-#define LDNS_QDCOUNT_OFF 4
-/*
-#define QDCOUNT(wirebuf) (ntohs(*(uint16_t *)(wirebuf+QDCOUNT_OFF)))
-*/
-#define LDNS_QDCOUNT(wirebuf) (sldns_read_uint16(wirebuf+LDNS_QDCOUNT_OFF))
-
-/* Counter of the answer section */
-#define LDNS_ANCOUNT_OFF 6
-#define LDNS_ANCOUNT(wirebuf) (sldns_read_uint16(wirebuf+LDNS_ANCOUNT_OFF))
-
-/* Counter of the authority section */
-#define LDNS_NSCOUNT_OFF 8
-#define LDNS_NSCOUNT(wirebuf) (sldns_read_uint16(wirebuf+LDNS_NSCOUNT_OFF))
-
-/* Counter of the additional section */
-#define LDNS_ARCOUNT_OFF 10
-#define LDNS_ARCOUNT(wirebuf) (sldns_read_uint16(wirebuf+LDNS_ARCOUNT_OFF))
-
-/**
- * The sections of a packet
- */
-enum sldns_enum_pkt_section {
- LDNS_SECTION_QUESTION = 0,
- LDNS_SECTION_ANSWER = 1,
- LDNS_SECTION_AUTHORITY = 2,
- LDNS_SECTION_ADDITIONAL = 3,
- /** bogus section, if not interested */
- LDNS_SECTION_ANY = 4,
- /** used to get all non-question rrs from a packet */
- LDNS_SECTION_ANY_NOQUESTION = 5
-};
-typedef enum sldns_enum_pkt_section sldns_pkt_section;
-
-/* opcodes for pkt's */
-enum sldns_enum_pkt_opcode {
- LDNS_PACKET_QUERY = 0,
- LDNS_PACKET_IQUERY = 1,
- LDNS_PACKET_STATUS = 2, /* there is no 3?? DNS is weird */
- LDNS_PACKET_NOTIFY = 4,
- LDNS_PACKET_UPDATE = 5
-};
-typedef enum sldns_enum_pkt_opcode sldns_pkt_opcode;
-
-/* rcodes for pkts */
-enum sldns_enum_pkt_rcode {
- LDNS_RCODE_NOERROR = 0,
- LDNS_RCODE_FORMERR = 1,
- LDNS_RCODE_SERVFAIL = 2,
- LDNS_RCODE_NXDOMAIN = 3,
- LDNS_RCODE_NOTIMPL = 4,
- LDNS_RCODE_REFUSED = 5,
- LDNS_RCODE_YXDOMAIN = 6,
- LDNS_RCODE_YXRRSET = 7,
- LDNS_RCODE_NXRRSET = 8,
- LDNS_RCODE_NOTAUTH = 9,
- LDNS_RCODE_NOTZONE = 10
-};
-typedef enum sldns_enum_pkt_rcode sldns_pkt_rcode;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LDNS_PKTHDR_H */
+++ /dev/null
-/* rrdef.c
- *
- * access functions to rr definitions list.
- * a Net::DNS like library for C
- * LibDNS Team @ NLnet Labs
- *
- * (c) NLnet Labs, 2004-2006
- * See the file LICENSE for the license
- */
-/**
- * \file
- *
- * Defines resource record types and constants.
- */
-#include "config.h"
-#include "ldns/rrdef.h"
-#include "ldns/parseutil.h"
-
-/* classes */
-static sldns_lookup_table sldns_rr_classes_data[] = {
- { LDNS_RR_CLASS_IN, "IN" },
- { LDNS_RR_CLASS_CH, "CH" },
- { LDNS_RR_CLASS_HS, "HS" },
- { LDNS_RR_CLASS_NONE, "NONE" },
- { LDNS_RR_CLASS_ANY, "ANY" },
- { 0, NULL }
-};
-sldns_lookup_table* sldns_rr_classes = sldns_rr_classes_data;
-
-/* types */
-static const sldns_rdf_type type_0_wireformat[] = { LDNS_RDF_TYPE_UNKNOWN };
-static const sldns_rdf_type type_a_wireformat[] = { LDNS_RDF_TYPE_A };
-static const sldns_rdf_type type_ns_wireformat[] = { LDNS_RDF_TYPE_DNAME };
-static const sldns_rdf_type type_md_wireformat[] = { LDNS_RDF_TYPE_DNAME };
-static const sldns_rdf_type type_mf_wireformat[] = { LDNS_RDF_TYPE_DNAME };
-static const sldns_rdf_type type_cname_wireformat[] = { LDNS_RDF_TYPE_DNAME };
-static const sldns_rdf_type type_soa_wireformat[] = {
- LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_INT32,
- LDNS_RDF_TYPE_PERIOD, LDNS_RDF_TYPE_PERIOD, LDNS_RDF_TYPE_PERIOD,
- LDNS_RDF_TYPE_PERIOD
-};
-static const sldns_rdf_type type_mb_wireformat[] = { LDNS_RDF_TYPE_DNAME };
-static const sldns_rdf_type type_mg_wireformat[] = { LDNS_RDF_TYPE_DNAME };
-static const sldns_rdf_type type_mr_wireformat[] = { LDNS_RDF_TYPE_DNAME };
-static const sldns_rdf_type type_wks_wireformat[] = {
- LDNS_RDF_TYPE_A, LDNS_RDF_TYPE_WKS
-};
-static const sldns_rdf_type type_ptr_wireformat[] = { LDNS_RDF_TYPE_DNAME };
-static const sldns_rdf_type type_hinfo_wireformat[] = {
- LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR
-};
-static const sldns_rdf_type type_minfo_wireformat[] = {
- LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME
-};
-static const sldns_rdf_type type_mx_wireformat[] = {
- LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME
-};
-static const sldns_rdf_type type_rp_wireformat[] = {
- LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME
-};
-static const sldns_rdf_type type_afsdb_wireformat[] = {
- LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME
-};
-static const sldns_rdf_type type_x25_wireformat[] = { LDNS_RDF_TYPE_STR };
-static const sldns_rdf_type type_isdn_wireformat[] = {
- LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR
-};
-static const sldns_rdf_type type_rt_wireformat[] = {
- LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME
-};
-static const sldns_rdf_type type_nsap_wireformat[] = {
- LDNS_RDF_TYPE_NSAP
-};
-static const sldns_rdf_type type_nsap_ptr_wireformat[] = {
- LDNS_RDF_TYPE_STR
-};
-static const sldns_rdf_type type_sig_wireformat[] = {
- LDNS_RDF_TYPE_TYPE, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT32,
- LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_INT16,
- LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_B64
-};
-static const sldns_rdf_type type_key_wireformat[] = {
- LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_B64
-};
-static const sldns_rdf_type type_px_wireformat[] = {
- LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME
-};
-static const sldns_rdf_type type_gpos_wireformat[] = {
- LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR
-};
-static const sldns_rdf_type type_aaaa_wireformat[] = { LDNS_RDF_TYPE_AAAA };
-static const sldns_rdf_type type_loc_wireformat[] = { LDNS_RDF_TYPE_LOC };
-static const sldns_rdf_type type_nxt_wireformat[] = {
- LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_UNKNOWN
-};
-static const sldns_rdf_type type_eid_wireformat[] = {
- LDNS_RDF_TYPE_HEX
-};
-static const sldns_rdf_type type_nimloc_wireformat[] = {
- LDNS_RDF_TYPE_HEX
-};
-static const sldns_rdf_type type_srv_wireformat[] = {
- LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME
-};
-static const sldns_rdf_type type_atma_wireformat[] = {
- LDNS_RDF_TYPE_ATMA
-};
-static const sldns_rdf_type type_naptr_wireformat[] = {
- LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_DNAME
-};
-static const sldns_rdf_type type_kx_wireformat[] = {
- LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME
-};
-static const sldns_rdf_type type_cert_wireformat[] = {
- LDNS_RDF_TYPE_CERT_ALG, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_B64
-};
-static const sldns_rdf_type type_a6_wireformat[] = { LDNS_RDF_TYPE_UNKNOWN };
-static const sldns_rdf_type type_dname_wireformat[] = { LDNS_RDF_TYPE_DNAME };
-static const sldns_rdf_type type_sink_wireformat[] = { LDNS_RDF_TYPE_INT8,
- LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_B64
-};
-static const sldns_rdf_type type_apl_wireformat[] = {
- LDNS_RDF_TYPE_APL
-};
-static const sldns_rdf_type type_ds_wireformat[] = {
- LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_HEX
-};
-static const sldns_rdf_type type_sshfp_wireformat[] = {
- LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_HEX
-};
-static const sldns_rdf_type type_ipseckey_wireformat[] = {
- LDNS_RDF_TYPE_IPSECKEY
-};
-static const sldns_rdf_type type_rrsig_wireformat[] = {
- LDNS_RDF_TYPE_TYPE, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT32,
- LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_B64
-};
-static const sldns_rdf_type type_nsec_wireformat[] = {
- LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_NSEC
-};
-static const sldns_rdf_type type_dhcid_wireformat[] = {
- LDNS_RDF_TYPE_B64
-};
-static const sldns_rdf_type type_talink_wireformat[] = {
- LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME
-};
-/* nsec3 is some vars, followed by same type of data of nsec */
-static const sldns_rdf_type type_nsec3_wireformat[] = {
-/* LDNS_RDF_TYPE_NSEC3_VARS, LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, LDNS_RDF_TYPE_NSEC*/
- LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_NSEC3_SALT, LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, LDNS_RDF_TYPE_NSEC
-};
-
-static const sldns_rdf_type type_nsec3param_wireformat[] = {
-/* LDNS_RDF_TYPE_NSEC3_PARAMS_VARS*/
- LDNS_RDF_TYPE_INT8,
- LDNS_RDF_TYPE_INT8,
- LDNS_RDF_TYPE_INT16,
- LDNS_RDF_TYPE_NSEC3_SALT
-};
-
-static const sldns_rdf_type type_dnskey_wireformat[] = {
- LDNS_RDF_TYPE_INT16,
- LDNS_RDF_TYPE_INT8,
- LDNS_RDF_TYPE_ALG,
- LDNS_RDF_TYPE_B64
-};
-static const sldns_rdf_type type_tkey_wireformat[] = {
- LDNS_RDF_TYPE_DNAME,
- LDNS_RDF_TYPE_TIME,
- LDNS_RDF_TYPE_TIME,
- LDNS_RDF_TYPE_INT16,
- LDNS_RDF_TYPE_INT16,
- LDNS_RDF_TYPE_INT16_DATA,
- LDNS_RDF_TYPE_INT16_DATA,
-};
-static const sldns_rdf_type type_tsig_wireformat[] = {
- LDNS_RDF_TYPE_DNAME,
- LDNS_RDF_TYPE_TSIGTIME,
- LDNS_RDF_TYPE_INT16,
- LDNS_RDF_TYPE_INT16_DATA,
- LDNS_RDF_TYPE_INT16,
- LDNS_RDF_TYPE_INT16,
- LDNS_RDF_TYPE_INT16_DATA
-};
-static const sldns_rdf_type type_tlsa_wireformat[] = {
- LDNS_RDF_TYPE_INT8,
- LDNS_RDF_TYPE_INT8,
- LDNS_RDF_TYPE_INT8,
- LDNS_RDF_TYPE_HEX
-};
-static const sldns_rdf_type type_hip_wireformat[] = {
- LDNS_RDF_TYPE_HIP
-};
-static const sldns_rdf_type type_nid_wireformat[] = {
- LDNS_RDF_TYPE_INT16,
- LDNS_RDF_TYPE_ILNP64
-};
-static const sldns_rdf_type type_l32_wireformat[] = {
- LDNS_RDF_TYPE_INT16,
- LDNS_RDF_TYPE_A
-};
-static const sldns_rdf_type type_l64_wireformat[] = {
- LDNS_RDF_TYPE_INT16,
- LDNS_RDF_TYPE_ILNP64
-};
-static const sldns_rdf_type type_lp_wireformat[] = {
- LDNS_RDF_TYPE_INT16,
- LDNS_RDF_TYPE_DNAME
-};
-static const sldns_rdf_type type_eui48_wireformat[] = {
- LDNS_RDF_TYPE_EUI48
-};
-static const sldns_rdf_type type_eui64_wireformat[] = {
- LDNS_RDF_TYPE_EUI64
-};
-#ifdef DRAFT_RRTYPES
-static const sldns_rdf_type type_uri_wireformat[] = {
- LDNS_RDF_TYPE_INT16,
- LDNS_RDF_TYPE_INT16,
- LDNS_RDF_TYPE_LONG_STR
-};
-#endif
-static const sldns_rdf_type type_caa_wireformat[] = {
- LDNS_RDF_TYPE_INT8,
- LDNS_RDF_TYPE_TAG,
- LDNS_RDF_TYPE_LONG_STR
-};
-
-/* All RR's defined in 1035 are well known and can thus
- * be compressed. See RFC3597. These RR's are:
- * CNAME HINFO MB MD MF MG MINFO MR MX NULL NS PTR SOA TXT
- */
-static sldns_rr_descriptor rdata_field_descriptors[] = {
- /* 0 */
- { 0, NULL, 0, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 1 */
- {LDNS_RR_TYPE_A, "A", 1, 1, type_a_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 2 */
- {LDNS_RR_TYPE_NS, "NS", 1, 1, type_ns_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
- /* 3 */
- {LDNS_RR_TYPE_MD, "MD", 1, 1, type_md_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
- /* 4 */
- {LDNS_RR_TYPE_MF, "MF", 1, 1, type_mf_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
- /* 5 */
- {LDNS_RR_TYPE_CNAME, "CNAME", 1, 1, type_cname_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
- /* 6 */
- {LDNS_RR_TYPE_SOA, "SOA", 7, 7, type_soa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 2 },
- /* 7 */
- {LDNS_RR_TYPE_MB, "MB", 1, 1, type_mb_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
- /* 8 */
- {LDNS_RR_TYPE_MG, "MG", 1, 1, type_mg_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
- /* 9 */
- {LDNS_RR_TYPE_MR, "MR", 1, 1, type_mr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
- /* 10 */
- {LDNS_RR_TYPE_NULL, "NULL", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 11 */
- {LDNS_RR_TYPE_WKS, "WKS", 2, 2, type_wks_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 12 */
- {LDNS_RR_TYPE_PTR, "PTR", 1, 1, type_ptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
- /* 13 */
- {LDNS_RR_TYPE_HINFO, "HINFO", 2, 2, type_hinfo_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 14 */
- {LDNS_RR_TYPE_MINFO, "MINFO", 2, 2, type_minfo_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 2 },
- /* 15 */
- {LDNS_RR_TYPE_MX, "MX", 2, 2, type_mx_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
- /* 16 */
- {LDNS_RR_TYPE_TXT, "TXT", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 },
- /* 17 */
- {LDNS_RR_TYPE_RP, "RP", 2, 2, type_rp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 },
- /* 18 */
- {LDNS_RR_TYPE_AFSDB, "AFSDB", 2, 2, type_afsdb_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
- /* 19 */
- {LDNS_RR_TYPE_X25, "X25", 1, 1, type_x25_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 20 */
- {LDNS_RR_TYPE_ISDN, "ISDN", 1, 2, type_isdn_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 21 */
- {LDNS_RR_TYPE_RT, "RT", 2, 2, type_rt_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
- /* 22 */
- {LDNS_RR_TYPE_NSAP, "NSAP", 1, 1, type_nsap_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 23 */
- {LDNS_RR_TYPE_NSAP_PTR, "NSAP-PTR", 1, 1, type_nsap_ptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 24 */
- {LDNS_RR_TYPE_SIG, "SIG", 9, 9, type_sig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
- /* 25 */
- {LDNS_RR_TYPE_KEY, "KEY", 4, 4, type_key_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 26 */
- {LDNS_RR_TYPE_PX, "PX", 3, 3, type_px_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 },
- /* 27 */
- {LDNS_RR_TYPE_GPOS, "GPOS", 3, 3, type_gpos_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 28 */
- {LDNS_RR_TYPE_AAAA, "AAAA", 1, 1, type_aaaa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 29 */
- {LDNS_RR_TYPE_LOC, "LOC", 1, 1, type_loc_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 30 */
- {LDNS_RR_TYPE_NXT, "NXT", 2, 2, type_nxt_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
- /* 31 */
- {LDNS_RR_TYPE_EID, "EID", 1, 1, type_eid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 32 */
- {LDNS_RR_TYPE_NIMLOC, "NIMLOC", 1, 1, type_nimloc_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 33 */
- {LDNS_RR_TYPE_SRV, "SRV", 4, 4, type_srv_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
- /* 34 */
- {LDNS_RR_TYPE_ATMA, "ATMA", 1, 1, type_atma_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 35 */
- {LDNS_RR_TYPE_NAPTR, "NAPTR", 6, 6, type_naptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
- /* 36 */
- {LDNS_RR_TYPE_KX, "KX", 2, 2, type_kx_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
- /* 37 */
- {LDNS_RR_TYPE_CERT, "CERT", 4, 4, type_cert_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 38 */
- {LDNS_RR_TYPE_A6, "A6", 1, 1, type_a6_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 39 */
- {LDNS_RR_TYPE_DNAME, "DNAME", 1, 1, type_dname_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
- /* 40 */
- {LDNS_RR_TYPE_SINK, "SINK", 1, 1, type_sink_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 41 */
- {LDNS_RR_TYPE_OPT, "OPT", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 42 */
- {LDNS_RR_TYPE_APL, "APL", 0, 0, type_apl_wireformat, LDNS_RDF_TYPE_APL, LDNS_RR_NO_COMPRESS, 0 },
- /* 43 */
- {LDNS_RR_TYPE_DS, "DS", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 44 */
- {LDNS_RR_TYPE_SSHFP, "SSHFP", 3, 3, type_sshfp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 45 */
- {LDNS_RR_TYPE_IPSECKEY, "IPSECKEY", 1, 1, type_ipseckey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 46 */
- {LDNS_RR_TYPE_RRSIG, "RRSIG", 9, 9, type_rrsig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
- /* 47 */
- {LDNS_RR_TYPE_NSEC, "NSEC", 1, 2, type_nsec_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
- /* 48 */
- {LDNS_RR_TYPE_DNSKEY, "DNSKEY", 4, 4, type_dnskey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 49 */
- {LDNS_RR_TYPE_DHCID, "DHCID", 1, 1, type_dhcid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 50 */
- {LDNS_RR_TYPE_NSEC3, "NSEC3", 5, 6, type_nsec3_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 51 */
- {LDNS_RR_TYPE_NSEC3PARAM, "NSEC3PARAM", 4, 4, type_nsec3param_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 52 */
- {LDNS_RR_TYPE_TLSA, "TLSA", 4, 4, type_tlsa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-
-{LDNS_RR_TYPE_NULL, "TYPE53", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE54", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 55
- * Hip ends with 0 or more Rendezvous Servers represented as dname's.
- * Hence the LDNS_RDF_TYPE_DNAME _variable field and the _maximum field
- * set to 0.
- */
- {LDNS_RR_TYPE_HIP, "HIP", 1, 1, type_hip_wireformat, LDNS_RDF_TYPE_DNAME, LDNS_RR_NO_COMPRESS, 0 },
-
-#ifdef DRAFT_RRTYPES
- /* 56 */
- {LDNS_RR_TYPE_NINFO, "NINFO", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 },
- /* 57 */
- {LDNS_RR_TYPE_RKEY, "RKEY", 4, 4, type_key_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-#else
-{LDNS_RR_TYPE_NULL, "TYPE56", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE57", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-#endif
- /* 58 */
- {LDNS_RR_TYPE_TALINK, "TALINK", 2, 2, type_talink_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 },
-
- /* 59 */
- {LDNS_RR_TYPE_CDS, "CDS", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 60 */
- {LDNS_RR_TYPE_CDNSKEY, "CDNSKEY", 4, 4, type_dnskey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE61", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE62", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE63", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE64", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE65", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE66", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE67", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE68", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE69", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE70", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE71", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE72", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE73", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE74", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE75", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE76", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE77", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE78", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE79", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE80", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE81", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE82", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE83", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE84", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE85", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE86", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE87", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE88", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE89", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE90", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE91", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE92", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE93", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE94", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE95", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE96", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE97", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE98", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-
- /* 99 */
- {LDNS_RR_TYPE_SPF, "SPF", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 },
-
- /* UINFO [IANA-Reserved] */
-{LDNS_RR_TYPE_NULL, "TYPE100", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* UID [IANA-Reserved] */
-{LDNS_RR_TYPE_NULL, "TYPE101", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* GID [IANA-Reserved] */
-{LDNS_RR_TYPE_NULL, "TYPE102", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* UNSPEC [IANA-Reserved] */
-{LDNS_RR_TYPE_NULL, "TYPE103", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-
- /* 104 */
- {LDNS_RR_TYPE_NID, "NID", 2, 2, type_nid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 105 */
- {LDNS_RR_TYPE_L32, "L32", 2, 2, type_l32_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 106 */
- {LDNS_RR_TYPE_L64, "L64", 2, 2, type_l64_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 107 */
- {LDNS_RR_TYPE_LP, "LP", 2, 2, type_lp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
-
- /* 108 */
- {LDNS_RR_TYPE_EUI48, "EUI48", 1, 1, type_eui48_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* 109 */
- {LDNS_RR_TYPE_EUI64, "EUI64", 1, 1, type_eui64_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-
-{LDNS_RR_TYPE_NULL, "TYPE110", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE111", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE112", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE113", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE114", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE115", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE116", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE117", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE118", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE119", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE120", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE121", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE122", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE123", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE124", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE125", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE126", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE127", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE128", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE129", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE130", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE131", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE132", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE133", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE134", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE135", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE136", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE137", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE138", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE139", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE140", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE141", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE142", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE143", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE144", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE145", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE146", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE147", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE148", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE149", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE150", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE151", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE152", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE153", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE154", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE155", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE156", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE157", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE158", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE159", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE160", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE161", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE162", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE163", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE164", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE165", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE166", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE167", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE168", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE169", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE170", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE171", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE172", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE173", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE174", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE175", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE176", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE177", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE178", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE179", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE180", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE181", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE182", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE183", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE184", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE185", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE186", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE187", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE188", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE189", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE190", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE191", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE192", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE193", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE194", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE195", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE196", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE197", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE198", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE199", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE200", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE201", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE202", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE203", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE204", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE205", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE206", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE207", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE208", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE209", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE210", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE211", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE212", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE213", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE214", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE215", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE216", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE217", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE218", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE219", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE220", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE221", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE222", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE223", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE224", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE225", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE226", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE227", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE228", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE229", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE230", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE231", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE232", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE233", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE234", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE235", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE236", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE237", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE238", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE239", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE240", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE241", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE242", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE243", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE244", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE245", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE246", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE247", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-{LDNS_RR_TYPE_NULL, "TYPE248", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-
- /* LDNS_RDF_TYPE_INT16_DATA takes two fields (length and data) as one.
- * So, unlike RFC 2930 spec, we have 7 min/max rdf's i.s.o. 8/9.
- */
- /* 249 */
- {LDNS_RR_TYPE_TKEY, "TKEY", 7, 7, type_tkey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
- /* LDNS_RDF_TYPE_INT16_DATA takes two fields (length and data) as one.
- * So, unlike RFC 2930 spec, we have 7 min/max rdf's i.s.o. 8/9.
- */
- /* 250 */
- {LDNS_RR_TYPE_TSIG, "TSIG", 7, 7, type_tsig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
-
- /* IXFR: A request for a transfer of an incremental zone transfer */
-{LDNS_RR_TYPE_IXFR, "IXFR", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* AXFR: A request for a transfer of an entire zone */
-{LDNS_RR_TYPE_AXFR, "AXFR", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* MAILB: A request for mailbox-related records (MB, MG or MR) */
-{LDNS_RR_TYPE_MAILB, "MAILB", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* MAILA: A request for mail agent RRs (Obsolete - see MX) */
-{LDNS_RR_TYPE_MAILA, "MAILA", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
- /* ANY: A request for all (available) records */
-{LDNS_RR_TYPE_ANY, "ANY", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-
-#ifdef DRAFT_RRTYPES
- /* 256 */
- {LDNS_RR_TYPE_URI, "URI", 3, 3, type_uri_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-#else
-{LDNS_RR_TYPE_NULL, "TYPE256", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-#endif
- /* 257 */
- {LDNS_RR_TYPE_CAA, "CAA", 3, 3, type_caa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-
-/* split in array, no longer contiguous */
-
-#ifdef DRAFT_RRTYPES
- /* 32768 */
- {LDNS_RR_TYPE_TA, "TA", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-#else
-{LDNS_RR_TYPE_NULL, "TYPE32768", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
-#endif
- /* 32769 */
- {LDNS_RR_TYPE_DLV, "DLV", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }
-};
-
-/**
- * \def LDNS_RDATA_FIELD_DESCRIPTORS_COUNT
- * computes the number of rdata fields
- */
-#define LDNS_RDATA_FIELD_DESCRIPTORS_COUNT \
- (sizeof(rdata_field_descriptors)/sizeof(rdata_field_descriptors[0]))
-
-const sldns_rr_descriptor *
-sldns_rr_descript(uint16_t type)
-{
- size_t i;
- if (type < LDNS_RDATA_FIELD_DESCRIPTORS_COMMON) {
- return &rdata_field_descriptors[type];
- } else {
- /* because not all array index equals type code */
- for (i = LDNS_RDATA_FIELD_DESCRIPTORS_COMMON;
- i < LDNS_RDATA_FIELD_DESCRIPTORS_COUNT;
- i++) {
- if (rdata_field_descriptors[i]._type == type) {
- return &rdata_field_descriptors[i];
- }
- }
- return &rdata_field_descriptors[0];
- }
-}
-
-size_t
-sldns_rr_descriptor_minimum(const sldns_rr_descriptor *descriptor)
-{
- if (descriptor) {
- return descriptor->_minimum;
- } else {
- return 0;
- }
-}
-
-size_t
-sldns_rr_descriptor_maximum(const sldns_rr_descriptor *descriptor)
-{
- if (descriptor) {
- if (descriptor->_variable != LDNS_RDF_TYPE_NONE) {
- return 65535; /* cannot be more than 64k */
- } else {
- return descriptor->_maximum;
- }
- } else {
- return 0;
- }
-}
-
-sldns_rdf_type
-sldns_rr_descriptor_field_type(const sldns_rr_descriptor *descriptor,
- size_t index)
-{
- assert(descriptor != NULL);
- assert(index < descriptor->_maximum
- || descriptor->_variable != LDNS_RDF_TYPE_NONE);
- if (index < descriptor->_maximum) {
- return descriptor->_wireformat[index];
- } else {
- return descriptor->_variable;
- }
-}
-
-sldns_rr_type
-sldns_get_rr_type_by_name(const char *name)
-{
- unsigned int i;
- const char *desc_name;
- const sldns_rr_descriptor *desc;
-
- /* TYPEXX representation */
- if (strlen(name) > 4 && strncasecmp(name, "TYPE", 4) == 0) {
- return atoi(name + 4);
- }
-
- /* Normal types */
- for (i = 0; i < (unsigned int) LDNS_RDATA_FIELD_DESCRIPTORS_COUNT; i++) {
- desc = &rdata_field_descriptors[i];
- desc_name = desc->_name;
- if(desc_name &&
- strlen(name) == strlen(desc_name) &&
- strncasecmp(name, desc_name, strlen(desc_name)) == 0) {
- /* because not all array index equals type code */
- return desc->_type;
- }
- }
-
- /* special cases for query types */
- if (strlen(name) == 4 && strncasecmp(name, "IXFR", 4) == 0) {
- return 251;
- } else if (strlen(name) == 4 && strncasecmp(name, "AXFR", 4) == 0) {
- return 252;
- } else if (strlen(name) == 5 && strncasecmp(name, "MAILB", 5) == 0) {
- return 253;
- } else if (strlen(name) == 5 && strncasecmp(name, "MAILA", 5) == 0) {
- return 254;
- } else if (strlen(name) == 3 && strncasecmp(name, "ANY", 3) == 0) {
- return 255;
- }
-
- return 0;
-}
-
-sldns_rr_class
-sldns_get_rr_class_by_name(const char *name)
-{
- sldns_lookup_table *lt;
-
- /* CLASSXX representation */
- if (strlen(name) > 5 && strncasecmp(name, "CLASS", 5) == 0) {
- return atoi(name + 5);
- }
-
- /* Normal types */
- lt = sldns_lookup_by_name(sldns_rr_classes, name);
- if (lt) {
- return lt->id;
- }
- return 0;
-}
+++ /dev/null
-/*
- * rrdef.h
- *
- * RR definitions
- *
- * a Net::DNS like library for C
- *
- * (c) NLnet Labs, 2005-2006
- *
- * See the file LICENSE for the license
- */
-
-/**
- * \file
- *
- * Defines resource record types and constants.
- */
-
-#ifndef LDNS_RRDEF_H
-#define LDNS_RRDEF_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Maximum length of a dname label */
-#define LDNS_MAX_LABELLEN 63
-/** Maximum length of a complete dname */
-#define LDNS_MAX_DOMAINLEN 255
-/** Maximum number of pointers in 1 dname */
-#define LDNS_MAX_POINTERS 65535
-/** The bytes TTL, CLASS and length use up in an rr */
-#define LDNS_RR_OVERHEAD 10
-
-#define LDNS_DNSSEC_KEYPROTO 3
-#define LDNS_KEY_ZONE_KEY 0x0100 /* set for ZSK&KSK, rfc 4034 */
-#define LDNS_KEY_SEP_KEY 0x0001 /* set for KSK, rfc 4034 */
-#define LDNS_KEY_REVOKE_KEY 0x0080 /* used to revoke KSK, rfc 5011 */
-
-/* The first fields are contiguous and can be referenced instantly */
-#define LDNS_RDATA_FIELD_DESCRIPTORS_COMMON 258
-
-/** lookuptable for rr classes */
-extern struct sldns_struct_lookup_table* sldns_rr_classes;
-
-/**
- * The different RR classes.
- */
-enum sldns_enum_rr_class
-{
- /** the Internet */
- LDNS_RR_CLASS_IN = 1,
- /** Chaos class */
- LDNS_RR_CLASS_CH = 3,
- /** Hesiod (Dyer 87) */
- LDNS_RR_CLASS_HS = 4,
- /** None class, dynamic update */
- LDNS_RR_CLASS_NONE = 254,
- /** Any class */
- LDNS_RR_CLASS_ANY = 255,
-
- LDNS_RR_CLASS_FIRST = 0,
- LDNS_RR_CLASS_LAST = 65535,
- LDNS_RR_CLASS_COUNT = LDNS_RR_CLASS_LAST - LDNS_RR_CLASS_FIRST + 1
-};
-typedef enum sldns_enum_rr_class sldns_rr_class;
-
-/**
- * Used to specify whether compression is allowed.
- */
-enum sldns_enum_rr_compress
-{
- /** compression is allowed */
- LDNS_RR_COMPRESS,
- LDNS_RR_NO_COMPRESS
-};
-typedef enum sldns_enum_rr_compress sldns_rr_compress;
-
-/**
- * The different RR types.
- */
-enum sldns_enum_rr_type
-{
- /** a host address */
- LDNS_RR_TYPE_A = 1,
- /** an authoritative name server */
- LDNS_RR_TYPE_NS = 2,
- /** a mail destination (Obsolete - use MX) */
- LDNS_RR_TYPE_MD = 3,
- /** a mail forwarder (Obsolete - use MX) */
- LDNS_RR_TYPE_MF = 4,
- /** the canonical name for an alias */
- LDNS_RR_TYPE_CNAME = 5,
- /** marks the start of a zone of authority */
- LDNS_RR_TYPE_SOA = 6,
- /** a mailbox domain name (EXPERIMENTAL) */
- LDNS_RR_TYPE_MB = 7,
- /** a mail group member (EXPERIMENTAL) */
- LDNS_RR_TYPE_MG = 8,
- /** a mail rename domain name (EXPERIMENTAL) */
- LDNS_RR_TYPE_MR = 9,
- /** a null RR (EXPERIMENTAL) */
- LDNS_RR_TYPE_NULL = 10,
- /** a well known service description */
- LDNS_RR_TYPE_WKS = 11,
- /** a domain name pointer */
- LDNS_RR_TYPE_PTR = 12,
- /** host information */
- LDNS_RR_TYPE_HINFO = 13,
- /** mailbox or mail list information */
- LDNS_RR_TYPE_MINFO = 14,
- /** mail exchange */
- LDNS_RR_TYPE_MX = 15,
- /** text strings */
- LDNS_RR_TYPE_TXT = 16,
- /** RFC1183 */
- LDNS_RR_TYPE_RP = 17,
- /** RFC1183 */
- LDNS_RR_TYPE_AFSDB = 18,
- /** RFC1183 */
- LDNS_RR_TYPE_X25 = 19,
- /** RFC1183 */
- LDNS_RR_TYPE_ISDN = 20,
- /** RFC1183 */
- LDNS_RR_TYPE_RT = 21,
- /** RFC1706 */
- LDNS_RR_TYPE_NSAP = 22,
- /** RFC1348 */
- LDNS_RR_TYPE_NSAP_PTR = 23,
- /** 2535typecode */
- LDNS_RR_TYPE_SIG = 24,
- /** 2535typecode */
- LDNS_RR_TYPE_KEY = 25,
- /** RFC2163 */
- LDNS_RR_TYPE_PX = 26,
- /** RFC1712 */
- LDNS_RR_TYPE_GPOS = 27,
- /** ipv6 address */
- LDNS_RR_TYPE_AAAA = 28,
- /** LOC record RFC1876 */
- LDNS_RR_TYPE_LOC = 29,
- /** 2535typecode */
- LDNS_RR_TYPE_NXT = 30,
- /** draft-ietf-nimrod-dns-01.txt */
- LDNS_RR_TYPE_EID = 31,
- /** draft-ietf-nimrod-dns-01.txt */
- LDNS_RR_TYPE_NIMLOC = 32,
- /** SRV record RFC2782 */
- LDNS_RR_TYPE_SRV = 33,
- /** http://www.jhsoft.com/rfc/af-saa-0069.000.rtf */
- LDNS_RR_TYPE_ATMA = 34,
- /** RFC2915 */
- LDNS_RR_TYPE_NAPTR = 35,
- /** RFC2230 */
- LDNS_RR_TYPE_KX = 36,
- /** RFC2538 */
- LDNS_RR_TYPE_CERT = 37,
- /** RFC2874 */
- LDNS_RR_TYPE_A6 = 38,
- /** RFC2672 */
- LDNS_RR_TYPE_DNAME = 39,
- /** dnsind-kitchen-sink-02.txt */
- LDNS_RR_TYPE_SINK = 40,
- /** Pseudo OPT record... */
- LDNS_RR_TYPE_OPT = 41,
- /** RFC3123 */
- LDNS_RR_TYPE_APL = 42,
- /** RFC4034, RFC3658 */
- LDNS_RR_TYPE_DS = 43,
- /** SSH Key Fingerprint */
- LDNS_RR_TYPE_SSHFP = 44, /* RFC 4255 */
- /** IPsec Key */
- LDNS_RR_TYPE_IPSECKEY = 45, /* RFC 4025 */
- /** DNSSEC */
- LDNS_RR_TYPE_RRSIG = 46, /* RFC 4034 */
- LDNS_RR_TYPE_NSEC = 47, /* RFC 4034 */
- LDNS_RR_TYPE_DNSKEY = 48, /* RFC 4034 */
-
- LDNS_RR_TYPE_DHCID = 49, /* RFC 4701 */
- /* NSEC3 */
- LDNS_RR_TYPE_NSEC3 = 50, /* RFC 5155 */
- LDNS_RR_TYPE_NSEC3PARAM = 51, /* RFC 5155 */
- LDNS_RR_TYPE_NSEC3PARAMS = 51,
- LDNS_RR_TYPE_TLSA = 52, /* RFC 6698 */
-
- LDNS_RR_TYPE_HIP = 55, /* RFC 5205 */
-
- /** draft-reid-dnsext-zs */
- LDNS_RR_TYPE_NINFO = 56,
- /** draft-reid-dnsext-rkey */
- LDNS_RR_TYPE_RKEY = 57,
- /** draft-ietf-dnsop-trust-history */
- LDNS_RR_TYPE_TALINK = 58,
- LDNS_RR_TYPE_CDS = 59, /** RFC 7344 */
- LDNS_RR_TYPE_CDNSKEY = 60, /** RFC 7344 */
-
- LDNS_RR_TYPE_SPF = 99, /* RFC 4408 */
-
- LDNS_RR_TYPE_UINFO = 100,
- LDNS_RR_TYPE_UID = 101,
- LDNS_RR_TYPE_GID = 102,
- LDNS_RR_TYPE_UNSPEC = 103,
-
- LDNS_RR_TYPE_NID = 104, /* RFC 6742 */
- LDNS_RR_TYPE_L32 = 105, /* RFC 6742 */
- LDNS_RR_TYPE_L64 = 106, /* RFC 6742 */
- LDNS_RR_TYPE_LP = 107, /* RFC 6742 */
-
- /** draft-jabley-dnsext-eui48-eui64-rrtypes */
- LDNS_RR_TYPE_EUI48 = 108,
- LDNS_RR_TYPE_EUI64 = 109,
-
- LDNS_RR_TYPE_TKEY = 249, /* RFC 2930 */
- LDNS_RR_TYPE_TSIG = 250,
- LDNS_RR_TYPE_IXFR = 251,
- LDNS_RR_TYPE_AXFR = 252,
- /** A request for mailbox-related records (MB, MG or MR) */
- LDNS_RR_TYPE_MAILB = 253,
- /** A request for mail agent RRs (Obsolete - see MX) */
- LDNS_RR_TYPE_MAILA = 254,
- /** any type (wildcard) */
- LDNS_RR_TYPE_ANY = 255,
- /** draft-faltstrom-uri-06 */
- LDNS_RR_TYPE_URI = 256,
- LDNS_RR_TYPE_CAA = 257, /* RFC 6844 */
-
- /** DNSSEC Trust Authorities */
- LDNS_RR_TYPE_TA = 32768,
- /* RFC 4431, 5074, DNSSEC Lookaside Validation */
- LDNS_RR_TYPE_DLV = 32769,
-
- /* type codes from nsec3 experimental phase
- LDNS_RR_TYPE_NSEC3 = 65324,
- LDNS_RR_TYPE_NSEC3PARAMS = 65325, */
- LDNS_RR_TYPE_FIRST = 0,
- LDNS_RR_TYPE_LAST = 65535,
- LDNS_RR_TYPE_COUNT = LDNS_RR_TYPE_LAST - LDNS_RR_TYPE_FIRST + 1
-};
-typedef enum sldns_enum_rr_type sldns_rr_type;
-
-/* RDATA */
-#define LDNS_MAX_RDFLEN 65535
-
-#define LDNS_RDF_SIZE_BYTE 1
-#define LDNS_RDF_SIZE_WORD 2
-#define LDNS_RDF_SIZE_DOUBLEWORD 4
-#define LDNS_RDF_SIZE_6BYTES 6
-#define LDNS_RDF_SIZE_8BYTES 8
-#define LDNS_RDF_SIZE_16BYTES 16
-
-#define LDNS_NSEC3_VARS_OPTOUT_MASK 0x01
-
-#define LDNS_APL_IP4 1
-#define LDNS_APL_IP6 2
-#define LDNS_APL_MASK 0x7f
-#define LDNS_APL_NEGATION 0x80
-
-/**
- * The different types of RDATA fields.
- */
-enum sldns_enum_rdf_type
-{
- /** none */
- LDNS_RDF_TYPE_NONE,
- /** domain name */
- LDNS_RDF_TYPE_DNAME,
- /** 8 bits */
- LDNS_RDF_TYPE_INT8,
- /** 16 bits */
- LDNS_RDF_TYPE_INT16,
- /** 32 bits */
- LDNS_RDF_TYPE_INT32,
- /** A record */
- LDNS_RDF_TYPE_A,
- /** AAAA record */
- LDNS_RDF_TYPE_AAAA,
- /** txt string */
- LDNS_RDF_TYPE_STR,
- /** apl data */
- LDNS_RDF_TYPE_APL,
- /** b32 string */
- LDNS_RDF_TYPE_B32_EXT,
- /** b64 string */
- LDNS_RDF_TYPE_B64,
- /** hex string */
- LDNS_RDF_TYPE_HEX,
- /** nsec type codes */
- LDNS_RDF_TYPE_NSEC,
- /** a RR type */
- LDNS_RDF_TYPE_TYPE,
- /** a class */
- LDNS_RDF_TYPE_CLASS,
- /** certificate algorithm */
- LDNS_RDF_TYPE_CERT_ALG,
- /** a key algorithm */
- LDNS_RDF_TYPE_ALG,
- /** unknown types */
- LDNS_RDF_TYPE_UNKNOWN,
- /** time (32 bits) */
- LDNS_RDF_TYPE_TIME,
- /** period */
- LDNS_RDF_TYPE_PERIOD,
- /** tsig time 48 bits */
- LDNS_RDF_TYPE_TSIGTIME,
- /** Represents the Public Key Algorithm, HIT and Public Key fields
- for the HIP RR types. A HIP specific rdf type is used because of
- the unusual layout in wireformat (see RFC 5205 Section 5) */
- LDNS_RDF_TYPE_HIP,
- /** variable length any type rdata where the length
- is specified by the first 2 bytes */
- LDNS_RDF_TYPE_INT16_DATA,
- /** protocol and port bitmaps */
- LDNS_RDF_TYPE_SERVICE,
- /** location data */
- LDNS_RDF_TYPE_LOC,
- /** well known services */
- LDNS_RDF_TYPE_WKS,
- /** NSAP */
- LDNS_RDF_TYPE_NSAP,
- /** ATMA */
- LDNS_RDF_TYPE_ATMA,
- /** IPSECKEY */
- LDNS_RDF_TYPE_IPSECKEY,
- /** nsec3 hash salt */
- LDNS_RDF_TYPE_NSEC3_SALT,
- /** nsec3 base32 string (with length byte on wire */
- LDNS_RDF_TYPE_NSEC3_NEXT_OWNER,
-
- /** 4 shorts represented as 4 * 16 bit hex numbers
- * seperated by colons. For NID and L64.
- */
- LDNS_RDF_TYPE_ILNP64,
-
- /** 6 * 8 bit hex numbers seperated by dashes. For EUI48. */
- LDNS_RDF_TYPE_EUI48,
- /** 8 * 8 bit hex numbers seperated by dashes. For EUI64. */
- LDNS_RDF_TYPE_EUI64,
-
- /** A non-zero sequence of US-ASCII letters and numbers in lower case.
- * For CAA.
- */
- LDNS_RDF_TYPE_TAG,
-
- /** A <character-string> encoding of the value field as specified
- * [RFC1035], Section 5.1., encoded as remaining rdata.
- * For CAA.
- */
- LDNS_RDF_TYPE_LONG_STR,
-
- /* Aliases */
- LDNS_RDF_TYPE_BITMAP = LDNS_RDF_TYPE_NSEC
-};
-typedef enum sldns_enum_rdf_type sldns_rdf_type;
-
-/**
- * Algorithms used in dns
- */
-enum sldns_enum_algorithm
-{
- LDNS_RSAMD5 = 1, /* RFC 4034,4035 */
- LDNS_DH = 2,
- LDNS_DSA = 3,
- LDNS_ECC = 4,
- LDNS_RSASHA1 = 5,
- LDNS_DSA_NSEC3 = 6,
- LDNS_RSASHA1_NSEC3 = 7,
- LDNS_RSASHA256 = 8, /* RFC 5702 */
- LDNS_RSASHA512 = 10, /* RFC 5702 */
- LDNS_ECC_GOST = 12, /* RFC 5933 */
- LDNS_ECDSAP256SHA256 = 13, /* RFC 6605 */
- LDNS_ECDSAP384SHA384 = 14, /* RFC 6605 */
- LDNS_INDIRECT = 252,
- LDNS_PRIVATEDNS = 253,
- LDNS_PRIVATEOID = 254
-};
-typedef enum sldns_enum_algorithm sldns_algorithm;
-
-/**
- * Hashing algorithms used in the DS record
- */
-enum sldns_enum_hash
-{
- LDNS_SHA1 = 1, /* RFC 4034 */
- LDNS_SHA256 = 2, /* RFC 4509 */
- LDNS_HASH_GOST = 3, /* RFC 5933 */
- LDNS_SHA384 = 4 /* RFC 6605 */
-};
-typedef enum sldns_enum_hash sldns_hash;
-
-/**
- * algorithms used in CERT rrs
- */
-enum sldns_enum_cert_algorithm
-{
- LDNS_CERT_PKIX = 1,
- LDNS_CERT_SPKI = 2,
- LDNS_CERT_PGP = 3,
- LDNS_CERT_IPKIX = 4,
- LDNS_CERT_ISPKI = 5,
- LDNS_CERT_IPGP = 6,
- LDNS_CERT_ACPKIX = 7,
- LDNS_CERT_IACPKIX = 8,
- LDNS_CERT_URI = 253,
- LDNS_CERT_OID = 254
-};
-typedef enum sldns_enum_cert_algorithm sldns_cert_algorithm;
-
-/**
- * EDNS option codes
- */
-enum sldns_enum_edns_option
-{
- LDNS_EDNS_LLQ = 1, /* http://files.dns-sd.org/draft-sekar-dns-llq.txt */
- LDNS_EDNS_UL = 2, /* http://files.dns-sd.org/draft-sekar-dns-ul.txt */
- LDNS_EDNS_NSID = 3, /* RFC5001 */
- /* 4 draft-cheshire-edns0-owner-option */
- LDNS_EDNS_DAU = 5, /* RFC6975 */
- LDNS_EDNS_DHU = 6, /* RFC6975 */
- LDNS_EDNS_N3U = 7, /* RFC6975 */
- LDNS_EDNS_CLIENT_SUBNET = 8 /* draft-vandergaast-edns-client-subnet */
-};
-typedef enum sldns_enum_edns_option sldns_edns_option;
-
-#define LDNS_EDNS_MASK_DO_BIT 0x8000
-
-/**
- * Contains all information about resource record types.
- *
- * This structure contains, for all rr types, the rdata fields that are defined.
- */
-struct sldns_struct_rr_descriptor
-{
- /** Type of the RR that is described here */
- sldns_rr_type _type;
- /** Textual name of the RR type. */
- const char *_name;
- /** Minimum number of rdata fields in the RRs of this type. */
- uint8_t _minimum;
- /** Maximum number of rdata fields in the RRs of this type. */
- uint8_t _maximum;
- /** Wireformat specification for the rr, i.e. the types of rdata fields in their respective order. */
- const sldns_rdf_type *_wireformat;
- /** Special rdf types */
- sldns_rdf_type _variable;
- /** Specifies whether compression can be used for dnames in this RR type. */
- sldns_rr_compress _compress;
- /** The number of DNAMEs in the _wireformat string, for parsing. */
- uint8_t _dname_count;
-};
-typedef struct sldns_struct_rr_descriptor sldns_rr_descriptor;
-
-/**
- * returns the resource record descriptor for the given rr type.
- *
- * \param[in] type the type value of the rr type
- *\return the sldns_rr_descriptor for this type
- */
-const sldns_rr_descriptor *sldns_rr_descript(uint16_t type);
-
-/**
- * returns the minimum number of rdata fields of the rr type this descriptor describes.
- *
- * \param[in] descriptor for an rr type
- * \return the minimum number of rdata fields
- */
-size_t sldns_rr_descriptor_minimum(const sldns_rr_descriptor *descriptor);
-
-/**
- * returns the maximum number of rdata fields of the rr type this descriptor describes.
- *
- * \param[in] descriptor for an rr type
- * \return the maximum number of rdata fields
- */
-size_t sldns_rr_descriptor_maximum(const sldns_rr_descriptor *descriptor);
-
-/**
- * returns the rdf type for the given rdata field number of the rr type for the given descriptor.
- *
- * \param[in] descriptor for an rr type
- * \param[in] field the field number
- * \return the rdf type for the field
- */
-sldns_rdf_type sldns_rr_descriptor_field_type(const sldns_rr_descriptor *descriptor, size_t field);
-
-/**
- * retrieves a rrtype by looking up its name.
- * \param[in] name a string with the name
- * \return the type which corresponds with the name
- */
-sldns_rr_type sldns_get_rr_type_by_name(const char *name);
-
-/**
- * retrieves a class by looking up its name.
- * \param[in] name string with the name
- * \return the cass which corresponds with the name
- */
-sldns_rr_class sldns_get_rr_class_by_name(const char *name);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LDNS_RRDEF_H */
+++ /dev/null
-/*
- * buffer.c -- generic memory buffer .
- *
- * Copyright (c) 2001-2008, NLnet Labs. All rights reserved.
- *
- * See LICENSE for the license.
- *
- */
-/**
- * \file
- *
- * This file contains the definition of sldns_buffer, and functions to manipulate those.
- */
-#include "config.h"
-#include "ldns/sbuffer.h"
-#include <stdarg.h>
-
-sldns_buffer *
-sldns_buffer_new(size_t capacity)
-{
- sldns_buffer *buffer = (sldns_buffer*)malloc(sizeof(sldns_buffer));
-
- if (!buffer) {
- return NULL;
- }
-
- buffer->_data = (uint8_t *) malloc(capacity);
- if (!buffer->_data) {
- free(buffer);
- return NULL;
- }
-
- buffer->_position = 0;
- buffer->_limit = buffer->_capacity = capacity;
- buffer->_fixed = 0;
- buffer->_status_err = 0;
-
- sldns_buffer_invariant(buffer);
-
- return buffer;
-}
-
-void
-sldns_buffer_new_frm_data(sldns_buffer *buffer, void *data, size_t size)
-{
- assert(data != NULL);
-
- buffer->_position = 0;
- buffer->_limit = buffer->_capacity = size;
- buffer->_fixed = 0;
- buffer->_data = malloc(size);
- if(!buffer->_data) {
- buffer->_status_err = 1;
- return;
- }
- memcpy(buffer->_data, data, size);
- buffer->_status_err = 0;
-
- sldns_buffer_invariant(buffer);
-}
-
-void
-sldns_buffer_init_frm_data(sldns_buffer *buffer, void *data, size_t size)
-{
- memset(buffer, 0, sizeof(*buffer));
- buffer->_data = data;
- buffer->_capacity = buffer->_limit = size;
- buffer->_fixed = 1;
-}
-
-int
-sldns_buffer_set_capacity(sldns_buffer *buffer, size_t capacity)
-{
- void *data;
-
- sldns_buffer_invariant(buffer);
- assert(buffer->_position <= capacity);
-
- data = (uint8_t *) realloc(buffer->_data, capacity);
- if (!data) {
- buffer->_status_err = 1;
- return 0;
- } else {
- buffer->_data = data;
- buffer->_limit = buffer->_capacity = capacity;
- return 1;
- }
-}
-
-int
-sldns_buffer_reserve(sldns_buffer *buffer, size_t amount)
-{
- sldns_buffer_invariant(buffer);
- assert(!buffer->_fixed);
- if (buffer->_capacity < buffer->_position + amount) {
- size_t new_capacity = buffer->_capacity * 3 / 2;
-
- if (new_capacity < buffer->_position + amount) {
- new_capacity = buffer->_position + amount;
- }
- if (!sldns_buffer_set_capacity(buffer, new_capacity)) {
- buffer->_status_err = 1;
- return 0;
- }
- }
- buffer->_limit = buffer->_capacity;
- return 1;
-}
-
-int
-sldns_buffer_printf(sldns_buffer *buffer, const char *format, ...)
-{
- va_list args;
- int written = 0;
- size_t remaining;
-
- if (sldns_buffer_status_ok(buffer)) {
- sldns_buffer_invariant(buffer);
- assert(buffer->_limit == buffer->_capacity);
-
- remaining = sldns_buffer_remaining(buffer);
- va_start(args, format);
- written = vsnprintf((char *) sldns_buffer_current(buffer), remaining,
- format, args);
- va_end(args);
- if (written == -1) {
- buffer->_status_err = 1;
- return -1;
- } else if ((size_t) written >= remaining) {
- if (!sldns_buffer_reserve(buffer, (size_t) written + 1)) {
- buffer->_status_err = 1;
- return -1;
- }
- va_start(args, format);
- written = vsnprintf((char *) sldns_buffer_current(buffer),
- sldns_buffer_remaining(buffer), format, args);
- va_end(args);
- if (written == -1) {
- buffer->_status_err = 1;
- return -1;
- }
- }
- buffer->_position += written;
- }
- return written;
-}
-
-void
-sldns_buffer_free(sldns_buffer *buffer)
-{
- if (!buffer) {
- return;
- }
-
- if (!buffer->_fixed)
- free(buffer->_data);
-
- free(buffer);
-}
-
-void *
-sldns_buffer_export(sldns_buffer *buffer)
-{
- buffer->_fixed = 1;
- return buffer->_data;
-}
-
-void
-sldns_buffer_copy(sldns_buffer* result, sldns_buffer* from)
-{
- size_t tocopy = sldns_buffer_limit(from);
-
- if(tocopy > sldns_buffer_capacity(result))
- tocopy = sldns_buffer_capacity(result);
- sldns_buffer_clear(result);
- sldns_buffer_write(result, sldns_buffer_begin(from), tocopy);
- sldns_buffer_flip(result);
-}
+++ /dev/null
-/*
- * buffer.h -- generic memory buffer.
- *
- * Copyright (c) 2005-2008, NLnet Labs. All rights reserved.
- *
- * See LICENSE for the license.
- *
- *
- * The buffer module implements a generic buffer. The API is based on
- * the java.nio.Buffer interface.
- */
-
-#ifndef LDNS_SBUFFER_H
-#define LDNS_SBUFFER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef S_SPLINT_S
-# define INLINE
-#else
-# ifdef SWIG
-# define INLINE static
-# else
-# define INLINE static inline
-# endif
-#endif
-
-/*
- * Copy data allowing for unaligned accesses in network byte order
- * (big endian).
- */
-INLINE uint16_t
-sldns_read_uint16(const void *src)
-{
-#ifdef ALLOW_UNALIGNED_ACCESSES
- return ntohs(*(const uint16_t *) src);
-#else
- const uint8_t *p = (const uint8_t *) src;
- return ((uint16_t) p[0] << 8) | (uint16_t) p[1];
-#endif
-}
-
-INLINE uint32_t
-sldns_read_uint32(const void *src)
-{
-#ifdef ALLOW_UNALIGNED_ACCESSES
- return ntohl(*(const uint32_t *) src);
-#else
- const uint8_t *p = (const uint8_t *) src;
- return ( ((uint32_t) p[0] << 24)
- | ((uint32_t) p[1] << 16)
- | ((uint32_t) p[2] << 8)
- | (uint32_t) p[3]);
-#endif
-}
-
-/*
- * Copy data allowing for unaligned accesses in network byte order
- * (big endian).
- */
-INLINE void
-sldns_write_uint16(void *dst, uint16_t data)
-{
-#ifdef ALLOW_UNALIGNED_ACCESSES
- * (uint16_t *) dst = htons(data);
-#else
- uint8_t *p = (uint8_t *) dst;
- p[0] = (uint8_t) ((data >> 8) & 0xff);
- p[1] = (uint8_t) (data & 0xff);
-#endif
-}
-
-INLINE void
-sldns_write_uint32(void *dst, uint32_t data)
-{
-#ifdef ALLOW_UNALIGNED_ACCESSES
- * (uint32_t *) dst = htonl(data);
-#else
- uint8_t *p = (uint8_t *) dst;
- p[0] = (uint8_t) ((data >> 24) & 0xff);
- p[1] = (uint8_t) ((data >> 16) & 0xff);
- p[2] = (uint8_t) ((data >> 8) & 0xff);
- p[3] = (uint8_t) (data & 0xff);
-#endif
-}
-
-
-/**
- * \file sbuffer.h
- *
- * This file contains the definition of sldns_buffer, and functions to manipulate those.
- */
-
-/**
- * implementation of buffers to ease operations
- *
- * sldns_buffers can contain arbitrary information, per octet. You can write
- * to the current end of a buffer, read from the current position, and
- * access any data within it.
- */
-struct sldns_buffer
-{
- /** The current position used for reading/writing */
- size_t _position;
-
- /** The read/write limit */
- size_t _limit;
-
- /** The amount of data the buffer can contain */
- size_t _capacity;
-
- /** The data contained in the buffer */
- uint8_t *_data;
-
- /** If the buffer is fixed it cannot be resized */
- unsigned _fixed : 1;
-
- /** The current state of the buffer. If writing to the buffer fails
- * for any reason, this value is changed. This way, you can perform
- * multiple writes in sequence and check for success afterwards. */
- unsigned _status_err : 1;
-};
-typedef struct sldns_buffer sldns_buffer;
-
-#ifdef NDEBUG
-INLINE void
-sldns_buffer_invariant(sldns_buffer *ATTR_UNUSED(buffer))
-{
-}
-#else
-INLINE void
-sldns_buffer_invariant(sldns_buffer *buffer)
-{
- assert(buffer != NULL);
- assert(buffer->_position <= buffer->_limit);
- assert(buffer->_limit <= buffer->_capacity);
- assert(buffer->_data != NULL);
-}
-#endif
-
-/**
- * creates a new buffer with the specified capacity.
- *
- * \param[in] capacity the size (in bytes) to allocate for the buffer
- * \return the created buffer
- */
-sldns_buffer *sldns_buffer_new(size_t capacity);
-
-/**
- * creates a buffer with the specified data. The data IS copied
- * and MEMORY allocations are done. The buffer is not fixed and can
- * be resized using buffer_reserve().
- *
- * \param[in] buffer pointer to the buffer to put the data in
- * \param[in] data the data to encapsulate in the buffer
- * \param[in] size the size of the data
- */
-void sldns_buffer_new_frm_data(sldns_buffer *buffer, void *data, size_t size);
-
-/**
- * Setup a buffer with the data pointed to. No data copied, no memory allocs.
- * The buffer is fixed.
- * \param[in] buffer pointer to the buffer to put the data in
- * \param[in] data the data to encapsulate in the buffer
- * \param[in] size the size of the data
- */
-void sldns_buffer_init_frm_data(sldns_buffer *buffer, void *data, size_t size);
-
-/**
- * clears the buffer and make it ready for writing. The buffer's limit
- * is set to the capacity and the position is set to 0.
- * \param[in] buffer the buffer to clear
- */
-INLINE void sldns_buffer_clear(sldns_buffer *buffer)
-{
- sldns_buffer_invariant(buffer);
-
- /* reset status here? */
-
- buffer->_position = 0;
- buffer->_limit = buffer->_capacity;
-}
-
-/**
- * makes the buffer ready for reading the data that has been written to
- * the buffer. The buffer's limit is set to the current position and
- * the position is set to 0.
- *
- * \param[in] buffer the buffer to flip
- * \return void
- */
-INLINE void sldns_buffer_flip(sldns_buffer *buffer)
-{
- sldns_buffer_invariant(buffer);
-
- buffer->_limit = buffer->_position;
- buffer->_position = 0;
-}
-
-/**
- * make the buffer ready for re-reading the data. The buffer's
- * position is reset to 0.
- * \param[in] buffer the buffer to rewind
- */
-INLINE void sldns_buffer_rewind(sldns_buffer *buffer)
-{
- sldns_buffer_invariant(buffer);
-
- buffer->_position = 0;
-}
-
-/**
- * returns the current position in the buffer (as a number of bytes)
- * \param[in] buffer the buffer
- * \return the current position
- */
-INLINE size_t
-sldns_buffer_position(sldns_buffer *buffer)
-{
- return buffer->_position;
-}
-
-/**
- * sets the buffer's position to MARK. The position must be less than
- * or equal to the buffer's limit.
- * \param[in] buffer the buffer
- * \param[in] mark the mark to use
- */
-INLINE void
-sldns_buffer_set_position(sldns_buffer *buffer, size_t mark)
-{
- assert(mark <= buffer->_limit);
- buffer->_position = mark;
-}
-
-/**
- * changes the buffer's position by COUNT bytes. The position must not
- * be moved behind the buffer's limit or before the beginning of the
- * buffer.
- * \param[in] buffer the buffer
- * \param[in] count the count to use
- */
-INLINE void
-sldns_buffer_skip(sldns_buffer *buffer, ssize_t count)
-{
- assert(buffer->_position + count <= buffer->_limit);
- buffer->_position += count;
-}
-
-/**
- * returns the maximum size of the buffer
- * \param[in] buffer
- * \return the size
- */
-INLINE size_t
-sldns_buffer_limit(sldns_buffer *buffer)
-{
- return buffer->_limit;
-}
-
-/**
- * changes the buffer's limit. If the buffer's position is greater
- * than the new limit the position is set to the limit.
- * \param[in] buffer the buffer
- * \param[in] limit the new limit
- */
-INLINE void
-sldns_buffer_set_limit(sldns_buffer *buffer, size_t limit)
-{
- assert(limit <= buffer->_capacity);
- buffer->_limit = limit;
- if (buffer->_position > buffer->_limit)
- buffer->_position = buffer->_limit;
-}
-
-/**
- * returns the number of bytes the buffer can hold.
- * \param[in] buffer the buffer
- * \return the number of bytes
- */
-INLINE size_t
-sldns_buffer_capacity(sldns_buffer *buffer)
-{
- return buffer->_capacity;
-}
-
-/**
- * changes the buffer's capacity. The data is reallocated so any
- * pointers to the data may become invalid. The buffer's limit is set
- * to the buffer's new capacity.
- * \param[in] buffer the buffer
- * \param[in] capacity the capacity to use
- * \return whether this failed or succeeded
- */
-int sldns_buffer_set_capacity(sldns_buffer *buffer, size_t capacity);
-
-/**
- * ensures BUFFER can contain at least AMOUNT more bytes. The buffer's
- * capacity is increased if necessary using buffer_set_capacity().
- *
- * The buffer's limit is always set to the (possibly increased)
- * capacity.
- * \param[in] buffer the buffer
- * \param[in] amount amount to use
- * \return whether this failed or succeeded
- */
-int sldns_buffer_reserve(sldns_buffer *buffer, size_t amount);
-
-/**
- * returns a pointer to the data at the indicated position.
- * \param[in] buffer the buffer
- * \param[in] at position
- * \return the pointer to the data
- */
-INLINE uint8_t *
-sldns_buffer_at(const sldns_buffer *buffer, size_t at)
-{
- assert(at <= buffer->_limit);
- return buffer->_data + at;
-}
-
-/**
- * returns a pointer to the beginning of the buffer (the data at
- * position 0).
- * \param[in] buffer the buffer
- * \return the pointer
- */
-INLINE uint8_t *
-sldns_buffer_begin(const sldns_buffer *buffer)
-{
- return sldns_buffer_at(buffer, 0);
-}
-
-/**
- * returns a pointer to the end of the buffer (the data at the buffer's
- * limit).
- * \param[in] buffer the buffer
- * \return the pointer
- */
-INLINE uint8_t *
-sldns_buffer_end(sldns_buffer *buffer)
-{
- return sldns_buffer_at(buffer, buffer->_limit);
-}
-
-/**
- * returns a pointer to the data at the buffer's current position.
- * \param[in] buffer the buffer
- * \return the pointer
- */
-INLINE uint8_t *
-sldns_buffer_current(sldns_buffer *buffer)
-{
- return sldns_buffer_at(buffer, buffer->_position);
-}
-
-/**
- * returns the number of bytes remaining between the indicated position and
- * the limit.
- * \param[in] buffer the buffer
- * \param[in] at indicated position
- * \return number of bytes
- */
-INLINE size_t
-sldns_buffer_remaining_at(sldns_buffer *buffer, size_t at)
-{
- sldns_buffer_invariant(buffer);
- assert(at <= buffer->_limit);
- return buffer->_limit - at;
-}
-
-/**
- * returns the number of bytes remaining between the buffer's position and
- * limit.
- * \param[in] buffer the buffer
- * \return the number of bytes
- */
-INLINE size_t
-sldns_buffer_remaining(sldns_buffer *buffer)
-{
- return sldns_buffer_remaining_at(buffer, buffer->_position);
-}
-
-/**
- * checks if the buffer has at least COUNT more bytes available.
- * Before reading or writing the caller needs to ensure enough space
- * is available!
- * \param[in] buffer the buffer
- * \param[in] at indicated position
- * \param[in] count how much is available
- * \return true or false (as int?)
- */
-INLINE int
-sldns_buffer_available_at(sldns_buffer *buffer, size_t at, size_t count)
-{
- return count <= sldns_buffer_remaining_at(buffer, at);
-}
-
-/**
- * checks if the buffer has count bytes available at the current position
- * \param[in] buffer the buffer
- * \param[in] count how much is available
- * \return true or false (as int?)
- */
-INLINE int
-sldns_buffer_available(sldns_buffer *buffer, size_t count)
-{
- return sldns_buffer_available_at(buffer, buffer->_position, count);
-}
-
-/**
- * writes the given data to the buffer at the specified position
- * \param[in] buffer the buffer
- * \param[in] at the position (in number of bytes) to write the data at
- * \param[in] data pointer to the data to write to the buffer
- * \param[in] count the number of bytes of data to write
- */
-INLINE void
-sldns_buffer_write_at(sldns_buffer *buffer, size_t at, const void *data, size_t count)
-{
- assert(sldns_buffer_available_at(buffer, at, count));
- memcpy(buffer->_data + at, data, count);
-}
-
-/**
- * writes count bytes of data to the current position of the buffer
- * \param[in] buffer the buffer
- * \param[in] data the data to write
- * \param[in] count the lenght of the data to write
- */
-INLINE void
-sldns_buffer_write(sldns_buffer *buffer, const void *data, size_t count)
-{
- sldns_buffer_write_at(buffer, buffer->_position, data, count);
- buffer->_position += count;
-}
-
-/**
- * copies the given (null-delimited) string to the specified position at the buffer
- * \param[in] buffer the buffer
- * \param[in] at the position in the buffer
- * \param[in] str the string to write
- */
-INLINE void
-sldns_buffer_write_string_at(sldns_buffer *buffer, size_t at, const char *str)
-{
- sldns_buffer_write_at(buffer, at, str, strlen(str));
-}
-
-/**
- * copies the given (null-delimited) string to the current position at the buffer
- * \param[in] buffer the buffer
- * \param[in] str the string to write
- */
-INLINE void
-sldns_buffer_write_string(sldns_buffer *buffer, const char *str)
-{
- sldns_buffer_write(buffer, str, strlen(str));
-}
-
-/**
- * writes the given byte of data at the given position in the buffer
- * \param[in] buffer the buffer
- * \param[in] at the position in the buffer
- * \param[in] data the 8 bits to write
- */
-INLINE void
-sldns_buffer_write_u8_at(sldns_buffer *buffer, size_t at, uint8_t data)
-{
- assert(sldns_buffer_available_at(buffer, at, sizeof(data)));
- buffer->_data[at] = data;
-}
-
-/**
- * writes the given byte of data at the current position in the buffer
- * \param[in] buffer the buffer
- * \param[in] data the 8 bits to write
- */
-INLINE void
-sldns_buffer_write_u8(sldns_buffer *buffer, uint8_t data)
-{
- sldns_buffer_write_u8_at(buffer, buffer->_position, data);
- buffer->_position += sizeof(data);
-}
-
-/**
- * writes the given 2 byte integer at the given position in the buffer
- * \param[in] buffer the buffer
- * \param[in] at the position in the buffer
- * \param[in] data the 16 bits to write
- */
-INLINE void
-sldns_buffer_write_u16_at(sldns_buffer *buffer, size_t at, uint16_t data)
-{
- assert(sldns_buffer_available_at(buffer, at, sizeof(data)));
- sldns_write_uint16(buffer->_data + at, data);
-}
-
-/**
- * writes the given 2 byte integer at the current position in the buffer
- * \param[in] buffer the buffer
- * \param[in] data the 16 bits to write
- */
-INLINE void
-sldns_buffer_write_u16(sldns_buffer *buffer, uint16_t data)
-{
- sldns_buffer_write_u16_at(buffer, buffer->_position, data);
- buffer->_position += sizeof(data);
-}
-
-/**
- * writes the given 4 byte integer at the given position in the buffer
- * \param[in] buffer the buffer
- * \param[in] at the position in the buffer
- * \param[in] data the 32 bits to write
- */
-INLINE void
-sldns_buffer_write_u32_at(sldns_buffer *buffer, size_t at, uint32_t data)
-{
- assert(sldns_buffer_available_at(buffer, at, sizeof(data)));
- sldns_write_uint32(buffer->_data + at, data);
-}
-
-/**
- * writes the given 4 byte integer at the current position in the buffer
- * \param[in] buffer the buffer
- * \param[in] data the 32 bits to write
- */
-INLINE void
-sldns_buffer_write_u32(sldns_buffer *buffer, uint32_t data)
-{
- sldns_buffer_write_u32_at(buffer, buffer->_position, data);
- buffer->_position += sizeof(data);
-}
-
-/**
- * copies count bytes of data at the given position to the given data-array
- * \param[in] buffer the buffer
- * \param[in] at the position in the buffer to start
- * \param[out] data buffer to copy to
- * \param[in] count the length of the data to copy
- */
-INLINE void
-sldns_buffer_read_at(sldns_buffer *buffer, size_t at, void *data, size_t count)
-{
- assert(sldns_buffer_available_at(buffer, at, count));
- memcpy(data, buffer->_data + at, count);
-}
-
-/**
- * copies count bytes of data at the current position to the given data-array
- * \param[in] buffer the buffer
- * \param[out] data buffer to copy to
- * \param[in] count the length of the data to copy
- */
-INLINE void
-sldns_buffer_read(sldns_buffer *buffer, void *data, size_t count)
-{
- sldns_buffer_read_at(buffer, buffer->_position, data, count);
- buffer->_position += count;
-}
-
-/**
- * returns the byte value at the given position in the buffer
- * \param[in] buffer the buffer
- * \param[in] at the position in the buffer
- * \return 1 byte integer
- */
-INLINE uint8_t
-sldns_buffer_read_u8_at(sldns_buffer *buffer, size_t at)
-{
- assert(sldns_buffer_available_at(buffer, at, sizeof(uint8_t)));
- return buffer->_data[at];
-}
-
-/**
- * returns the byte value at the current position in the buffer
- * \param[in] buffer the buffer
- * \return 1 byte integer
- */
-INLINE uint8_t
-sldns_buffer_read_u8(sldns_buffer *buffer)
-{
- uint8_t result = sldns_buffer_read_u8_at(buffer, buffer->_position);
- buffer->_position += sizeof(uint8_t);
- return result;
-}
-
-/**
- * returns the 2-byte integer value at the given position in the buffer
- * \param[in] buffer the buffer
- * \param[in] at position in the buffer
- * \return 2 byte integer
- */
-INLINE uint16_t
-sldns_buffer_read_u16_at(sldns_buffer *buffer, size_t at)
-{
- assert(sldns_buffer_available_at(buffer, at, sizeof(uint16_t)));
- return sldns_read_uint16(buffer->_data + at);
-}
-
-/**
- * returns the 2-byte integer value at the current position in the buffer
- * \param[in] buffer the buffer
- * \return 2 byte integer
- */
-INLINE uint16_t
-sldns_buffer_read_u16(sldns_buffer *buffer)
-{
- uint16_t result = sldns_buffer_read_u16_at(buffer, buffer->_position);
- buffer->_position += sizeof(uint16_t);
- return result;
-}
-
-/**
- * returns the 4-byte integer value at the given position in the buffer
- * \param[in] buffer the buffer
- * \param[in] at position in the buffer
- * \return 4 byte integer
- */
-INLINE uint32_t
-sldns_buffer_read_u32_at(sldns_buffer *buffer, size_t at)
-{
- assert(sldns_buffer_available_at(buffer, at, sizeof(uint32_t)));
- return sldns_read_uint32(buffer->_data + at);
-}
-
-/**
- * returns the 4-byte integer value at the current position in the buffer
- * \param[in] buffer the buffer
- * \return 4 byte integer
- */
-INLINE uint32_t
-sldns_buffer_read_u32(sldns_buffer *buffer)
-{
- uint32_t result = sldns_buffer_read_u32_at(buffer, buffer->_position);
- buffer->_position += sizeof(uint32_t);
- return result;
-}
-
-/**
- * returns the status of the buffer
- * \param[in] buffer
- * \return the status
- */
-INLINE int
-sldns_buffer_status(sldns_buffer *buffer)
-{
- return (int)buffer->_status_err;
-}
-
-/**
- * returns true if the status of the buffer is LDNS_STATUS_OK, false otherwise
- * \param[in] buffer the buffer
- * \return true or false
- */
-INLINE int
-sldns_buffer_status_ok(sldns_buffer *buffer)
-{
- if (buffer) {
- return sldns_buffer_status(buffer) == 0;
- } else {
- return 0;
- }
-}
-
-/**
- * prints to the buffer, increasing the capacity if required using
- * buffer_reserve(). The buffer's position is set to the terminating '\\0'
- * Returns the number of characters written (not including the
- * terminating '\\0') or -1 on failure.
- */
-int sldns_buffer_printf(sldns_buffer *buffer, const char *format, ...)
- ATTR_FORMAT(printf, 2, 3);
-
-/**
- * frees the buffer.
- * \param[in] *buffer the buffer to be freed
- * \return void
- */
-void sldns_buffer_free(sldns_buffer *buffer);
-
-/**
- * Makes the buffer fixed and returns a pointer to the data. The
- * caller is responsible for free'ing the result.
- * \param[in] *buffer the buffer to be exported
- * \return void
- */
-void *sldns_buffer_export(sldns_buffer *buffer);
-
-/**
- * Copy contents of the from buffer to the result buffer and then flips
- * the result buffer. Data will be silently truncated if the result buffer is
- * too small.
- * \param[out] *result resulting buffer which is copied to.
- * \param[in] *from what to copy to result.
- */
-void sldns_buffer_copy(sldns_buffer* result, sldns_buffer* from);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LDNS_SBUFFER_H */
+++ /dev/null
-/**
- * str2wire.c - read txt presentation of RRs
- *
- * (c) NLnet Labs, 2005-2006
- *
- * See the file LICENSE for the license
- */
-
-/**
- * \file
- *
- * Parses text to wireformat.
- */
-#include "config.h"
-#include "ldns/str2wire.h"
-#include "ldns/wire2str.h"
-#include "ldns/sbuffer.h"
-#include "ldns/parse.h"
-#include "ldns/parseutil.h"
-#include <ctype.h>
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-
-/** return an error */
-#define RET_ERR(e, off) ((int)((e)|((off)<<LDNS_WIREPARSE_SHIFT)))
-/** Move parse error but keep its ID */
-#define RET_ERR_SHIFT(e, move) RET_ERR(LDNS_WIREPARSE_ERROR(e), LDNS_WIREPARSE_OFFSET(e)+(move));
-#define LDNS_IP6ADDRLEN (128/8)
-
-/*
- * No special care is taken, all dots are translated into
- * label separators.
- * @param rel: true if the domain is not absolute (not terminated in .).
- * The output is then still terminated with a '0' rootlabel.
- */
-static int sldns_str2wire_dname_buf_rel(const char* str, uint8_t* buf,
- size_t* olen, int* rel)
-{
- size_t len;
-
- const char *s;
- uint8_t *q, *pq, label_len;
-
- if(rel) *rel = 0;
- len = strlen((char*)str);
- /* octet representation can make strings a lot longer than actual length */
- if (len > LDNS_MAX_DOMAINLEN * 4) {
- return RET_ERR(LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW, 0);
- }
- if (0 == len) {
- return RET_ERR(LDNS_WIREPARSE_ERR_DOMAINNAME_UNDERFLOW, 0);
- }
-
- /* root label */
- if (1 == len && *str == '.') {
- if(*olen < 1)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, 0);
- buf[0] = 0;
- *olen = 1;
- return LDNS_WIREPARSE_ERR_OK;
- }
-
- /* get on with the rest */
-
- /* s is on the current character in the string
- * pq points to where the labellength is going to go
- * label_len keeps track of the current label's length
- * q builds the dname inside the buf array
- */
- len = 0;
- if(*olen < 1)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, 0);
- q = buf+1;
- pq = buf;
- label_len = 0;
- for (s = str; *s; s++, q++) {
- if (q >= buf + *olen)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, q-buf);
- if (q > buf + LDNS_MAX_DOMAINLEN)
- return RET_ERR(LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW, q-buf);
- switch (*s) {
- case '.':
- if (label_len > LDNS_MAX_LABELLEN) {
- return RET_ERR(LDNS_WIREPARSE_ERR_LABEL_OVERFLOW, q-buf);
- }
- if (label_len == 0) {
- return RET_ERR(LDNS_WIREPARSE_ERR_EMPTY_LABEL, q-buf);
- }
- len += label_len + 1;
- *q = 0;
- *pq = label_len;
- label_len = 0;
- pq = q;
- break;
- case '\\':
- /* octet value or literal char */
- s += 1;
- if (!sldns_parse_escape(q, &s)) {
- *q = 0;
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE, q-buf);
- }
- s -= 1;
- label_len++;
- break;
- default:
- *q = (uint8_t)*s;
- label_len++;
- }
- }
-
- /* add root label if last char was not '.' */
- if(label_len != 0) {
- if(rel) *rel = 1;
- if (q >= buf + *olen)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, q-buf);
- if (q > buf + LDNS_MAX_DOMAINLEN) {
- return RET_ERR(LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW, q-buf);
- }
- if (label_len > LDNS_MAX_LABELLEN) {
- return RET_ERR(LDNS_WIREPARSE_ERR_LABEL_OVERFLOW, q-buf);
- }
- if (label_len == 0) { /* label_len 0 but not . at end? */
- return RET_ERR(LDNS_WIREPARSE_ERR_EMPTY_LABEL, q-buf);
- }
- len += label_len + 1;
- *pq = label_len;
- *q = 0;
- }
- len++;
- *olen = len;
-
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_dname_buf(const char* str, uint8_t* buf, size_t* len)
-{
- return sldns_str2wire_dname_buf_rel(str, buf, len, NULL);
-}
-
-int sldns_str2wire_dname_buf_origin(const char* str, uint8_t* buf, size_t* len,
- uint8_t* origin, size_t origin_len)
-{
- size_t dlen = *len;
- int rel = 0;
- int s = sldns_str2wire_dname_buf_rel(str, buf, &dlen, &rel);
- if(s) return s;
-
- if(rel && origin && dlen > 0) {
- if(dlen + origin_len - 1 > LDNS_MAX_DOMAINLEN)
- return RET_ERR(LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW,
- LDNS_MAX_DOMAINLEN);
- if(dlen + origin_len - 1 > *len)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
- *len);
- memmove(buf+dlen-1, origin, origin_len);
- *len = dlen + origin_len - 1;
- } else
- *len = dlen;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-uint8_t* sldns_str2wire_dname(const char* str, size_t* len)
-{
- uint8_t dname[LDNS_MAX_DOMAINLEN+1];
- *len = sizeof(dname);
- if(sldns_str2wire_dname_buf(str, dname, len) == 0) {
- uint8_t* r = (uint8_t*)malloc(*len);
- if(r) return memcpy(r, dname, *len);
- }
- *len = 0;
- return NULL;
-}
-
-/** read owner name */
-static int
-rrinternal_get_owner(sldns_buffer* strbuf, uint8_t* rr, size_t* len,
- size_t* dname_len, uint8_t* origin, size_t origin_len, uint8_t* prev,
- size_t prev_len, char* token, size_t token_len)
-{
- /* split the rr in its parts -1 signals trouble */
- if(sldns_bget_token(strbuf, token, "\t\n ", token_len) == -1) {
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX,
- sldns_buffer_position(strbuf));
- }
-
- if(strcmp(token, "@") == 0) {
- uint8_t* tocopy;
- if (origin) {
- *dname_len = origin_len;
- tocopy = origin;
- } else if (prev) {
- *dname_len = prev_len;
- tocopy = prev;
- } else {
- /* default to root */
- *dname_len = 1;
- tocopy = (uint8_t*)"\0";
- }
- if(*len < *dname_len)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
- sldns_buffer_position(strbuf));
- memmove(rr, tocopy, *dname_len);
- } else if(strlen(token) == 0) {
- /* no ownername was given, try prev, if that fails
- * origin, else default to root */
- uint8_t* tocopy;
- if(prev) {
- *dname_len = prev_len;
- tocopy = prev;
- } else if(origin) {
- *dname_len = origin_len;
- tocopy = origin;
- } else {
- *dname_len = 1;
- tocopy = (uint8_t*)"\0";
- }
- if(*len < *dname_len)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
- sldns_buffer_position(strbuf));
- memmove(rr, tocopy, *dname_len);
- } else {
- size_t dlen = *len;
- int s = sldns_str2wire_dname_buf_origin(token, rr, &dlen,
- origin, origin_len);
- if(s) return RET_ERR_SHIFT(s,
- sldns_buffer_position(strbuf)-strlen(token));
- *dname_len = dlen;
- }
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-/** read ttl */
-static int
-rrinternal_get_ttl(sldns_buffer* strbuf, char* token, size_t token_len,
- int* not_there, uint32_t* ttl, uint32_t default_ttl)
-{
- const char* endptr;
- if(sldns_bget_token(strbuf, token, "\t\n ", token_len) == -1) {
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TTL,
- sldns_buffer_position(strbuf));
- }
- *ttl = (uint32_t) sldns_str2period(token, &endptr);
-
- if (strlen(token) > 0 && !isdigit((unsigned char)token[0])) {
- *not_there = 1;
- /* ah, it's not there or something */
- if (default_ttl == 0) {
- *ttl = LDNS_DEFAULT_TTL;
- } else {
- *ttl = default_ttl;
- }
- }
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-/** read class */
-static int
-rrinternal_get_class(sldns_buffer* strbuf, char* token, size_t token_len,
- int* not_there, uint16_t* cl)
-{
- /* if 'not_there' then we got token from previous parse routine */
- if(!*not_there) {
- /* parse new token for class */
- if(sldns_bget_token(strbuf, token, "\t\n ", token_len) == -1) {
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_CLASS,
- sldns_buffer_position(strbuf));
- }
- } else *not_there = 0;
- *cl = sldns_get_rr_class_by_name(token);
- /* class can be left out too, assume IN, current token must be type */
- if(*cl == 0 && strcmp(token, "CLASS0") != 0) {
- *not_there = 1;
- *cl = LDNS_RR_CLASS_IN;
- }
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-/** read type */
-static int
-rrinternal_get_type(sldns_buffer* strbuf, char* token, size_t token_len,
- int* not_there, uint16_t* tp)
-{
- /* if 'not_there' then we got token from previous parse routine */
- if(!*not_there) {
- /* parse new token for type */
- if(sldns_bget_token(strbuf, token, "\t\n ", token_len) == -1) {
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TYPE,
- sldns_buffer_position(strbuf));
- }
- }
- *tp = sldns_get_rr_type_by_name(token);
- if(*tp == 0 && strcmp(token, "TYPE0") != 0) {
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TYPE,
- sldns_buffer_position(strbuf));
- }
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-/** put type, class, ttl into rr buffer */
-static int
-rrinternal_write_typeclassttl(sldns_buffer* strbuf, uint8_t* rr, size_t len,
- size_t dname_len, uint16_t tp, uint16_t cl, uint32_t ttl, int question)
-{
- if(question) {
- /* question is : name, type, class */
- if(dname_len + 4 > len)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
- sldns_buffer_position(strbuf));
- sldns_write_uint16(rr+dname_len, tp);
- sldns_write_uint16(rr+dname_len+2, cl);
- return LDNS_WIREPARSE_ERR_OK;
- }
-
- /* type(2), class(2), ttl(4), rdatalen(2 (later)) = 10 */
- if(dname_len + 10 > len)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
- sldns_buffer_position(strbuf));
- sldns_write_uint16(rr+dname_len, tp);
- sldns_write_uint16(rr+dname_len+2, cl);
- sldns_write_uint32(rr+dname_len+4, ttl);
- sldns_write_uint16(rr+dname_len+8, 0); /* rdatalen placeholder */
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-/** find delimiters for type */
-static const char*
-rrinternal_get_delims(sldns_rdf_type rdftype, uint16_t r_cnt, uint16_t r_max)
-{
- switch(rdftype) {
- case LDNS_RDF_TYPE_B64 :
- case LDNS_RDF_TYPE_HEX : /* These rdf types may con- */
- case LDNS_RDF_TYPE_LOC : /* tain whitespace, only if */
- case LDNS_RDF_TYPE_WKS : /* it is the last rd field. */
- case LDNS_RDF_TYPE_IPSECKEY :
- case LDNS_RDF_TYPE_NSEC : if (r_cnt == r_max - 1) {
- return "\n";
- }
- break;
- default : break;
- }
- return "\n\t ";
-}
-
-/* Syntactic sugar for sldns_rr_new_frm_str_internal */
-static int
-sldns_rdf_type_maybe_quoted(sldns_rdf_type rdf_type)
-{
- return rdf_type == LDNS_RDF_TYPE_STR ||
- rdf_type == LDNS_RDF_TYPE_LONG_STR;
-}
-
-/** see if rdata is quoted */
-static int
-rrinternal_get_quoted(sldns_buffer* strbuf, const char** delimiters,
- sldns_rdf_type rdftype)
-{
- if(sldns_rdf_type_maybe_quoted(rdftype) &&
- sldns_buffer_remaining(strbuf) > 0) {
-
- /* skip spaces */
- while(sldns_buffer_remaining(strbuf) > 0 &&
- *(sldns_buffer_current(strbuf)) == ' ') {
- sldns_buffer_skip(strbuf, 1);
- }
-
- if(sldns_buffer_remaining(strbuf) > 0 &&
- *(sldns_buffer_current(strbuf)) == '\"') {
- *delimiters = "\"\0";
- sldns_buffer_skip(strbuf, 1);
- return 1;
- }
- }
- return 0;
-}
-
-/** spool hex data into rdata */
-static int
-rrinternal_spool_hex(char* token, uint8_t* rr, size_t rr_len,
- size_t rr_cur_len, size_t* cur_hex_data_size, size_t hex_data_size)
-{
- char* p = token;
- while(*p) {
- if(isspace((unsigned char)*p)) {
- p++;
- continue;
- }
- if(!isxdigit((unsigned char)*p))
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_RDATA,
- p-token);
- if(*cur_hex_data_size >= hex_data_size)
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_RDATA,
- p-token);
- /* extra robust check */
- if(rr_cur_len+(*cur_hex_data_size)/2 >= rr_len)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
- p-token);
- /* see if 16s or 1s */
- if( ((*cur_hex_data_size)&1) == 0) {
- rr[rr_cur_len+(*cur_hex_data_size)/2] =
- (uint8_t)sldns_hexdigit_to_int(*p)*16;
- } else {
- rr[rr_cur_len+(*cur_hex_data_size)/2] +=
- (uint8_t)sldns_hexdigit_to_int(*p);
- }
- p++;
- (*cur_hex_data_size)++;
- }
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-/** read unknown rr type format */
-static int
-rrinternal_parse_unknown(sldns_buffer* strbuf, char* token, size_t token_len,
- uint8_t* rr, size_t* rr_len, size_t* rr_cur_len, size_t pre_data_pos)
-{
- const char* delim = "\n\t ";
- size_t hex_data_size, cur_hex_data_size;
- /* go back to before \#
- * and skip it while setting delimiters better
- */
- sldns_buffer_set_position(strbuf, pre_data_pos);
- if(sldns_bget_token(strbuf, token, delim, token_len) == -1)
- return LDNS_WIREPARSE_ERR_GENERAL; /* should not fail */
- /* read rdata octet length */
- if(sldns_bget_token(strbuf, token, delim, token_len) == -1) {
- /* something goes very wrong here */
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_RDATA,
- sldns_buffer_position(strbuf));
- }
- hex_data_size = (size_t)atoi(token);
- if(hex_data_size > LDNS_MAX_RDFLEN ||
- *rr_cur_len + hex_data_size > *rr_len) {
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
- sldns_buffer_position(strbuf));
- }
- /* copy hex chars into hex str (2 chars per byte) */
- hex_data_size *= 2;
- cur_hex_data_size = 0;
- while(cur_hex_data_size < hex_data_size) {
- int status;
- ssize_t c = sldns_bget_token(strbuf, token, delim, token_len);
- if((status = rrinternal_spool_hex(token, rr, *rr_len,
- *rr_cur_len, &cur_hex_data_size, hex_data_size)) != 0)
- return RET_ERR_SHIFT(status,
- sldns_buffer_position(strbuf)-strlen(token));
- if(c == -1) {
- if(cur_hex_data_size != hex_data_size)
- return RET_ERR(
- LDNS_WIREPARSE_ERR_SYNTAX_RDATA,
- sldns_buffer_position(strbuf));
- break;
- }
- }
- *rr_cur_len += hex_data_size/2;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-/** parse normal RR rdata element */
-static int
-rrinternal_parse_rdf(sldns_buffer* strbuf, char* token, size_t token_len,
- uint8_t* rr, size_t rr_len, size_t* rr_cur_len, sldns_rdf_type rdftype,
- uint16_t rr_type, uint16_t r_cnt, uint16_t r_max, size_t dname_len,
- uint8_t* origin, size_t origin_len)
-{
- size_t len;
- int status;
-
- switch(rdftype) {
- case LDNS_RDF_TYPE_DNAME:
- /* check if the origin should be used or concatenated */
- if(strcmp(token, "@") == 0) {
- uint8_t* tocopy;
- size_t copylen;
- if(origin) {
- copylen = origin_len;
- tocopy = origin;
- } else if(rr_type == LDNS_RR_TYPE_SOA) {
- copylen = dname_len;
- tocopy = rr; /* copy rr owner name */
- } else {
- copylen = 1;
- tocopy = (uint8_t*)"\0";
- }
- if((*rr_cur_len) + copylen > rr_len)
- return RET_ERR(
- LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
- sldns_buffer_position(strbuf));
- memmove(rr+*rr_cur_len, tocopy, copylen);
- (*rr_cur_len) += copylen;
- } else {
- size_t dlen = rr_len - (*rr_cur_len);
- int s = sldns_str2wire_dname_buf_origin(token,
- rr+*rr_cur_len, &dlen, origin, origin_len);
- if(s) return RET_ERR_SHIFT(s,
- sldns_buffer_position(strbuf)-strlen(token));
- (*rr_cur_len) += dlen;
- }
- return LDNS_WIREPARSE_ERR_OK;
-
- case LDNS_RDF_TYPE_HEX:
- case LDNS_RDF_TYPE_B64:
- /* When this is the last rdata field, then the
- * rest should be read in (cause then these
- * rdf types may contain spaces). */
- if(r_cnt == r_max - 1) {
- size_t tlen = strlen(token);
- (void)sldns_bget_token(strbuf, token+tlen, "\n",
- token_len - tlen);
- }
- break;
- default:
- break;
- }
-
- len = rr_len - (*rr_cur_len);
- if((status=sldns_str2wire_rdf_buf(token, rr+(*rr_cur_len), &len,
- rdftype)) != 0)
- return RET_ERR_SHIFT(status,
- sldns_buffer_position(strbuf)-strlen(token));
- *rr_cur_len += len;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-/**
- * Parse one rdf token. Takes care of quotes and parenthesis.
- */
-static int
-sldns_parse_rdf_token(sldns_buffer* strbuf, char* token, size_t token_len,
- int* quoted, int* parens, size_t* pre_data_pos,
- const char* delimiters, sldns_rdf_type rdftype, size_t* token_strlen)
-{
- size_t slen;
-
- /* skip spaces */
- while(sldns_buffer_remaining(strbuf) > 0 && !*quoted &&
- *(sldns_buffer_current(strbuf)) == ' ') {
- sldns_buffer_skip(strbuf, 1);
- }
-
- *pre_data_pos = sldns_buffer_position(strbuf);
- if(sldns_bget_token_par(strbuf, token, (*quoted)?"\"":delimiters,
- token_len, parens, (*quoted)?NULL:" \t") == -1) {
- return 0;
- }
- slen = strlen(token);
- /* check if not quoted yet, and we have encountered quotes */
- if(!*quoted && sldns_rdf_type_maybe_quoted(rdftype) &&
- slen >= 2 &&
- (token[0] == '"' || token[0] == '\'') &&
- (token[slen-1] == '"' || token[slen-1] == '\'')) {
- /* move token two smaller (quotes) with endnull */
- memmove(token, token+1, slen-2);
- token[slen-2] = 0;
- slen -= 2;
- *quoted = 1;
- } else if(!*quoted && sldns_rdf_type_maybe_quoted(rdftype) &&
- slen >= 2 &&
- (token[0] == '"' || token[0] == '\'')) {
- /* got the start quote (remove it) but read remainder
- * of quoted string as well into remainder of token */
- memmove(token, token+1, slen-1);
- token[slen-1] = 0;
- slen -= 1;
- *quoted = 1;
- /* rewind buffer over skipped whitespace */
- while(sldns_buffer_position(strbuf) > 0 &&
- (sldns_buffer_current(strbuf)[-1] == ' ' ||
- sldns_buffer_current(strbuf)[-1] == '\t')) {
- sldns_buffer_skip(strbuf, -1);
- }
- if(sldns_bget_token_par(strbuf, token+slen,
- "\"", token_len-slen,
- parens, NULL) == -1) {
- return 0;
- }
- slen = strlen(token);
- }
- *token_strlen = slen;
- return 1;
-}
-
-/** Add space and one more rdf token onto the existing token string. */
-static int
-sldns_affix_token(sldns_buffer* strbuf, char* token, size_t* token_len,
- int* quoted, int* parens, size_t* pre_data_pos,
- const char* delimiters, sldns_rdf_type rdftype, size_t* token_strlen)
-{
- size_t addlen = *token_len - *token_strlen;
- size_t addstrlen = 0;
-
- /* add space */
- if(addlen < 1) return 0;
- token[*token_strlen] = ' ';
- token[++(*token_strlen)] = 0;
-
- /* read another token */
- addlen = *token_len - *token_strlen;
- if(!sldns_parse_rdf_token(strbuf, token+*token_strlen, addlen, quoted,
- parens, pre_data_pos, delimiters, rdftype, &addstrlen))
- return 0;
- (*token_strlen) += addstrlen;
- return 1;
-}
-
-/** parse rdata from string into rr buffer(-remainder after dname). */
-static int
-rrinternal_parse_rdata(sldns_buffer* strbuf, char* token, size_t token_len,
- uint8_t* rr, size_t* rr_len, size_t dname_len, uint16_t rr_type,
- uint8_t* origin, size_t origin_len)
-{
- const sldns_rr_descriptor *desc = sldns_rr_descript((uint16_t)rr_type);
- uint16_t r_cnt, r_min, r_max;
- size_t rr_cur_len = dname_len + 10, pre_data_pos, token_strlen;
- int was_unknown_rr_format = 0, parens = 0, status, quoted;
- const char* delimiters;
- sldns_rdf_type rdftype;
- /* a desc is always returned */
- if(!desc) return LDNS_WIREPARSE_ERR_GENERAL;
- r_max = sldns_rr_descriptor_maximum(desc);
- r_min = sldns_rr_descriptor_minimum(desc);
- /* robust check */
- if(rr_cur_len > *rr_len)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
- sldns_buffer_position(strbuf));
-
- /* because number of fields can be variable, we can't rely on
- * _maximum() only */
- for(r_cnt=0; r_cnt < r_max; r_cnt++) {
- rdftype = sldns_rr_descriptor_field_type(desc, r_cnt);
- delimiters = rrinternal_get_delims(rdftype, r_cnt, r_max);
- quoted = rrinternal_get_quoted(strbuf, &delimiters, rdftype);
-
- if(!sldns_parse_rdf_token(strbuf, token, token_len, "ed,
- &parens, &pre_data_pos, delimiters, rdftype,
- &token_strlen))
- break;
-
- /* rfc3597 specifies that any type can be represented
- * with \# method, which can contain spaces...
- * it does specify size though... */
-
- /* unknown RR data */
- if(token_strlen>=2 && strncmp(token, "\\#", 2) == 0 &&
- !quoted && (token_strlen == 2 || token[2]==' ')) {
- was_unknown_rr_format = 1;
- if((status=rrinternal_parse_unknown(strbuf, token,
- token_len, rr, rr_len, &rr_cur_len,
- pre_data_pos)) != 0)
- return status;
- } else if(token_strlen > 0 || quoted) {
- if(rdftype == LDNS_RDF_TYPE_HIP) {
- /* affix the HIT and PK fields, with a space */
- if(!sldns_affix_token(strbuf, token,
- &token_len, "ed, &parens,
- &pre_data_pos, delimiters,
- rdftype, &token_strlen))
- break;
- if(!sldns_affix_token(strbuf, token,
- &token_len, "ed, &parens,
- &pre_data_pos, delimiters,
- rdftype, &token_strlen))
- break;
- }
-
- /* normal RR */
- if((status=rrinternal_parse_rdf(strbuf, token,
- token_len, rr, *rr_len, &rr_cur_len, rdftype,
- rr_type, r_cnt, r_max, dname_len, origin,
- origin_len)) != 0) {
- return status;
- }
- }
- }
- if(!was_unknown_rr_format && r_cnt+1 < r_min) {
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_MISSING_VALUE,
- sldns_buffer_position(strbuf));
- }
- while(parens != 0) {
- /* read remainder, must be "" */
- if(sldns_bget_token_par(strbuf, token, "\n", token_len,
- &parens, " \t") == -1) {
- if(parens != 0)
- return RET_ERR(LDNS_WIREPARSE_ERR_PARENTHESIS,
- sldns_buffer_position(strbuf));
- break;
- }
- if(strcmp(token, "") != 0)
- return RET_ERR(LDNS_WIREPARSE_ERR_PARENTHESIS,
- sldns_buffer_position(strbuf));
- }
- /* write rdata length */
- sldns_write_uint16(rr+dname_len+8, rr_cur_len-dname_len-10);
- *rr_len = rr_cur_len;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-/*
- * trailing spaces are allowed
- * leading spaces are not allowed
- * allow ttl to be optional
- * class is optional too
- * if ttl is missing, and default_ttl is 0, use DEF_TTL
- * allow ttl to be written as 1d3h
- * So the RR should look like. e.g.
- * miek.nl. 3600 IN MX 10 elektron.atoom.net
- * or
- * miek.nl. 1h IN MX 10 elektron.atoom.net
- * or
- * miek.nl. IN MX 10 elektron.atoom.net
- */
-static int
-sldns_str2wire_rr_buf_internal(const char* str, uint8_t* rr, size_t* len,
- size_t* dname_len, uint32_t default_ttl, uint8_t* origin,
- size_t origin_len, uint8_t* prev, size_t prev_len, int question)
-{
- int status;
- int not_there = 0;
- char token[LDNS_MAX_RDFLEN+1];
- uint32_t ttl = 0;
- uint16_t tp = 0, cl = 0;
- size_t ddlen = 0;
-
- /* string in buffer */
- sldns_buffer strbuf;
- sldns_buffer_init_frm_data(&strbuf, (uint8_t*)str, strlen(str));
- if(!dname_len) dname_len = &ddlen;
-
- /* parse the owner */
- if((status=rrinternal_get_owner(&strbuf, rr, len, dname_len, origin,
- origin_len, prev, prev_len, token, sizeof(token))) != 0)
- return status;
-
- /* parse the [ttl] [class] <type> */
- if((status=rrinternal_get_ttl(&strbuf, token, sizeof(token),
- ¬_there, &ttl, default_ttl)) != 0)
- return status;
- if((status=rrinternal_get_class(&strbuf, token, sizeof(token),
- ¬_there, &cl)) != 0)
- return status;
- if((status=rrinternal_get_type(&strbuf, token, sizeof(token),
- ¬_there, &tp)) != 0)
- return status;
- /* put ttl, class, type into the rr result */
- if((status=rrinternal_write_typeclassttl(&strbuf, rr, *len, *dname_len, tp, cl,
- ttl, question)) != 0)
- return status;
- /* for a question-RR we are done, no rdata */
- if(question) {
- *len = *dname_len + 4;
- return LDNS_WIREPARSE_ERR_OK;
- }
-
- /* rdata */
- if((status=rrinternal_parse_rdata(&strbuf, token, sizeof(token),
- rr, len, *dname_len, tp, origin, origin_len)) != 0)
- return status;
-
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_rr_buf(const char* str, uint8_t* rr, size_t* len,
- size_t* dname_len, uint32_t default_ttl, uint8_t* origin,
- size_t origin_len, uint8_t* prev, size_t prev_len)
-{
- return sldns_str2wire_rr_buf_internal(str, rr, len, dname_len,
- default_ttl, origin, origin_len, prev, prev_len, 0);
-}
-
-int sldns_str2wire_rr_question_buf(const char* str, uint8_t* rr, size_t* len,
- size_t* dname_len, uint8_t* origin, size_t origin_len, uint8_t* prev,
- size_t prev_len)
-{
- return sldns_str2wire_rr_buf_internal(str, rr, len, dname_len,
- 0, origin, origin_len, prev, prev_len, 1);
-}
-
-uint16_t sldns_wirerr_get_type(uint8_t* rr, size_t len, size_t dname_len)
-{
- if(len < dname_len+2)
- return 0;
- return sldns_read_uint16(rr+dname_len);
-}
-
-uint16_t sldns_wirerr_get_class(uint8_t* rr, size_t len, size_t dname_len)
-{
- if(len < dname_len+4)
- return 0;
- return sldns_read_uint16(rr+dname_len+2);
-}
-
-uint32_t sldns_wirerr_get_ttl(uint8_t* rr, size_t len, size_t dname_len)
-{
- if(len < dname_len+8)
- return 0;
- return sldns_read_uint32(rr+dname_len+4);
-}
-
-uint16_t sldns_wirerr_get_rdatalen(uint8_t* rr, size_t len, size_t dname_len)
-{
- if(len < dname_len+10)
- return 0;
- return sldns_read_uint16(rr+dname_len+8);
-}
-
-uint8_t* sldns_wirerr_get_rdata(uint8_t* rr, size_t len, size_t dname_len)
-{
- if(len < dname_len+10)
- return NULL;
- return rr+dname_len+10;
-}
-
-uint8_t* sldns_wirerr_get_rdatawl(uint8_t* rr, size_t len, size_t dname_len)
-{
- if(len < dname_len+10)
- return NULL;
- return rr+dname_len+8;
-}
-
-const char* sldns_get_errorstr_parse(int e)
-{
- sldns_lookup_table *lt;
- lt = sldns_lookup_by_id(sldns_wireparse_errors, LDNS_WIREPARSE_ERROR(e));
- return lt?lt->name:"unknown error";
-}
-
-/* Strip whitespace from the start and the end of <line>. */
-static char *
-sldns_strip_ws(char *line)
-{
- char *s = line, *e;
-
- for (s = line; *s && isspace((unsigned char)*s); s++)
- ;
- for (e = strchr(s, 0); e > s+2 && isspace((unsigned char)e[-1]) && e[-2] != '\\'; e--)
- ;
- *e = 0;
- return s;
-}
-
-int sldns_fp2wire_rr_buf(FILE* in, uint8_t* rr, size_t* len, size_t* dname_len,
- struct sldns_file_parse_state* parse_state)
-{
- char line[LDNS_RR_BUF_SIZE+1];
- ssize_t size;
-
- /* read an entire line in from the file */
- if((size = sldns_fget_token_l(in, line, LDNS_PARSE_SKIP_SPACE,
- LDNS_RR_BUF_SIZE, parse_state?&parse_state->lineno:NULL))
- == -1) {
- /* if last line was empty, we are now at feof, which is not
- * always a parse error (happens when for instance last line
- * was a comment)
- */
- return LDNS_WIREPARSE_ERR_SYNTAX;
- }
-
- /* we can have the situation, where we've read ok, but still got
- * no bytes to play with, in this case size is 0 */
- if(size == 0) {
- *len = 0;
- *dname_len = 0;
- return LDNS_WIREPARSE_ERR_OK;
- }
-
- if(strncmp(line, "$ORIGIN", 7) == 0 && isspace((unsigned char)line[7])) {
- int s;
- *len = 0;
- *dname_len = 0;
- if(!parse_state) return LDNS_WIREPARSE_ERR_OK;
- parse_state->origin_len = sizeof(parse_state->origin);
- s = sldns_str2wire_dname_buf(sldns_strip_ws(line+8),
- parse_state->origin, &parse_state->origin_len);
- if(s) parse_state->origin_len = 0;
- return s;
- } else if(strncmp(line, "$TTL", 4) == 0 && isspace((unsigned char)line[4])) {
- const char* end = NULL;
- *len = 0;
- *dname_len = 0;
- if(!parse_state) return LDNS_WIREPARSE_ERR_OK;
- parse_state->default_ttl = sldns_str2period(
- sldns_strip_ws(line+5), &end);
- } else if (strncmp(line, "$INCLUDE", 8) == 0) {
- *len = 0;
- *dname_len = 0;
- return LDNS_WIREPARSE_ERR_INCLUDE;
- } else {
- return sldns_str2wire_rr_buf(line, rr, len, dname_len,
- parse_state?parse_state->default_ttl:0,
- (parse_state&&parse_state->origin_len)?
- parse_state->origin:NULL,
- parse_state->origin_len,
- (parse_state&&parse_state->prev_rr_len)?
- parse_state->prev_rr:NULL,
- parse_state->prev_rr_len);
- }
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_rdf_buf(const char* str, uint8_t* rd, size_t* len,
- sldns_rdf_type rdftype)
-{
- switch (rdftype) {
- case LDNS_RDF_TYPE_DNAME:
- return sldns_str2wire_dname_buf(str, rd, len);
- case LDNS_RDF_TYPE_INT8:
- return sldns_str2wire_int8_buf(str, rd, len);
- case LDNS_RDF_TYPE_INT16:
- return sldns_str2wire_int16_buf(str, rd, len);
- case LDNS_RDF_TYPE_INT32:
- return sldns_str2wire_int32_buf(str, rd, len);
- case LDNS_RDF_TYPE_A:
- return sldns_str2wire_a_buf(str, rd, len);
- case LDNS_RDF_TYPE_AAAA:
- return sldns_str2wire_aaaa_buf(str, rd, len);
- case LDNS_RDF_TYPE_STR:
- return sldns_str2wire_str_buf(str, rd, len);
- case LDNS_RDF_TYPE_APL:
- return sldns_str2wire_apl_buf(str, rd, len);
- case LDNS_RDF_TYPE_B64:
- return sldns_str2wire_b64_buf(str, rd, len);
- case LDNS_RDF_TYPE_B32_EXT:
- return sldns_str2wire_b32_ext_buf(str, rd, len);
- case LDNS_RDF_TYPE_HEX:
- return sldns_str2wire_hex_buf(str, rd, len);
- case LDNS_RDF_TYPE_NSEC:
- return sldns_str2wire_nsec_buf(str, rd, len);
- case LDNS_RDF_TYPE_TYPE:
- return sldns_str2wire_type_buf(str, rd, len);
- case LDNS_RDF_TYPE_CLASS:
- return sldns_str2wire_class_buf(str, rd, len);
- case LDNS_RDF_TYPE_CERT_ALG:
- return sldns_str2wire_cert_alg_buf(str, rd, len);
- case LDNS_RDF_TYPE_ALG:
- return sldns_str2wire_alg_buf(str, rd, len);
- case LDNS_RDF_TYPE_TIME:
- return sldns_str2wire_time_buf(str, rd, len);
- case LDNS_RDF_TYPE_PERIOD:
- return sldns_str2wire_period_buf(str, rd, len);
- case LDNS_RDF_TYPE_LOC:
- return sldns_str2wire_loc_buf(str, rd, len);
- case LDNS_RDF_TYPE_WKS:
- return sldns_str2wire_wks_buf(str, rd, len);
- case LDNS_RDF_TYPE_NSAP:
- return sldns_str2wire_nsap_buf(str, rd, len);
- case LDNS_RDF_TYPE_ATMA:
- return sldns_str2wire_atma_buf(str, rd, len);
- case LDNS_RDF_TYPE_IPSECKEY:
- return sldns_str2wire_ipseckey_buf(str, rd, len);
- case LDNS_RDF_TYPE_NSEC3_SALT:
- return sldns_str2wire_nsec3_salt_buf(str, rd, len);
- case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER:
- return sldns_str2wire_b32_ext_buf(str, rd, len);
- case LDNS_RDF_TYPE_ILNP64:
- return sldns_str2wire_ilnp64_buf(str, rd, len);
- case LDNS_RDF_TYPE_EUI48:
- return sldns_str2wire_eui48_buf(str, rd, len);
- case LDNS_RDF_TYPE_EUI64:
- return sldns_str2wire_eui64_buf(str, rd, len);
- case LDNS_RDF_TYPE_TAG:
- return sldns_str2wire_tag_buf(str, rd, len);
- case LDNS_RDF_TYPE_LONG_STR:
- return sldns_str2wire_long_str_buf(str, rd, len);
- case LDNS_RDF_TYPE_HIP:
- return sldns_str2wire_hip_buf(str, rd, len);
- case LDNS_RDF_TYPE_INT16_DATA:
- return sldns_str2wire_int16_data_buf(str, rd, len);
- case LDNS_RDF_TYPE_UNKNOWN:
- case LDNS_RDF_TYPE_SERVICE:
- return LDNS_WIREPARSE_ERR_NOT_IMPL;
- case LDNS_RDF_TYPE_NONE:
- default:
- break;
- }
- return LDNS_WIREPARSE_ERR_GENERAL;
-}
-
-int sldns_str2wire_int8_buf(const char* str, uint8_t* rd, size_t* len)
-{
- char* end;
- uint8_t r = (uint8_t)strtol((char*)str, &end, 10);
- if(*end != 0)
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_INT, end-(char*)str);
- if(*len < 1)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- rd[0] = r;
- *len = 1;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_int16_buf(const char* str, uint8_t* rd, size_t* len)
-{
- char* end;
- uint16_t r = (uint16_t)strtol((char*)str, &end, 10);
- if(*end != 0)
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_INT, end-(char*)str);
- if(*len < 2)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- sldns_write_uint16(rd, r);
- *len = 2;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_int32_buf(const char* str, uint8_t* rd, size_t* len)
-{
- char* end;
- uint32_t r;
- errno = 0; /* must set to zero before call,
- note race condition on errno */
- if(*str == '-')
- r = (uint32_t)strtol((char*)str, &end, 10);
- else r = (uint32_t)strtoul((char*)str, &end, 10);
- if(*end != 0)
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_INT, end-(char*)str);
- if(errno == ERANGE)
- return LDNS_WIREPARSE_ERR_SYNTAX_INTEGER_OVERFLOW;
- if(*len < 4)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- sldns_write_uint32(rd, r);
- *len = 4;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_a_buf(const char* str, uint8_t* rd, size_t* len)
-{
- struct in_addr address;
- if(inet_pton(AF_INET, (char*)str, &address) != 1)
- return LDNS_WIREPARSE_ERR_SYNTAX_IP4;
- if(*len < sizeof(address))
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- memmove(rd, &address, sizeof(address));
- *len = sizeof(address);
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_aaaa_buf(const char* str, uint8_t* rd, size_t* len)
-{
-#ifdef AF_INET6
- uint8_t address[LDNS_IP6ADDRLEN + 1];
- if(inet_pton(AF_INET6, (char*)str, address) != 1)
- return LDNS_WIREPARSE_ERR_SYNTAX_IP6;
- if(*len < LDNS_IP6ADDRLEN)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- memmove(rd, address, LDNS_IP6ADDRLEN);
- *len = LDNS_IP6ADDRLEN;
- return LDNS_WIREPARSE_ERR_OK;
-#else
- return LDNS_WIREPARSE_ERR_NOT_IMPL;
-#endif
-}
-
-int sldns_str2wire_str_buf(const char* str, uint8_t* rd, size_t* len)
-{
- uint8_t ch = 0;
- size_t sl = 0;
- const char* s = str;
- /* skip length byte */
- if(*len < 1)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
-
- /* read characters */
- while(sldns_parse_char(&ch, &s)) {
- if(sl >= 255)
- return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR, s-str);
- if(*len < sl+1)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
- s-str);
- rd[++sl] = ch;
- }
- if(!s)
- return LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE;
- rd[0] = (uint8_t)sl;
- *len = sl+1;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_apl_buf(const char* str, uint8_t* rd, size_t* len)
-{
- const char *my_str = str;
-
- char my_ip_str[64];
- size_t ip_str_len;
-
- uint16_t family;
- int negation;
- size_t adflength = 0;
- uint8_t data[16+4];
- uint8_t prefix;
- size_t i;
-
- if(strlen(my_str) == 0) {
- /* empty APL element, no data, no string */
- *len = 0;
- return LDNS_WIREPARSE_ERR_OK;
- }
-
- /* [!]afi:address/prefix */
- if (strlen(my_str) < 2
- || strchr(my_str, ':') == NULL
- || strchr(my_str, '/') == NULL
- || strchr(my_str, ':') > strchr(my_str, '/')) {
- return LDNS_WIREPARSE_ERR_INVALID_STR;
- }
-
- if (my_str[0] == '!') {
- negation = 1;
- my_str += 1;
- } else {
- negation = 0;
- }
-
- family = (uint16_t) atoi(my_str);
-
- my_str = strchr(my_str, ':') + 1;
-
- /* need ip addr and only ip addr for inet_pton */
- ip_str_len = (size_t) (strchr(my_str, '/') - my_str);
- if(ip_str_len+1 > sizeof(my_ip_str))
- return LDNS_WIREPARSE_ERR_INVALID_STR;
- (void)strlcpy(my_ip_str, my_str, sizeof(my_ip_str));
- my_ip_str[ip_str_len] = 0;
-
- if (family == 1) {
- /* ipv4 */
- if(inet_pton(AF_INET, my_ip_str, data+4) == 0)
- return LDNS_WIREPARSE_ERR_INVALID_STR;
- for (i = 0; i < 4; i++) {
- if (data[i+4] != 0) {
- adflength = i + 1;
- }
- }
- } else if (family == 2) {
- /* ipv6 */
- if (inet_pton(AF_INET6, my_ip_str, data+4) == 0)
- return LDNS_WIREPARSE_ERR_INVALID_STR;
- for (i = 0; i < 16; i++) {
- if (data[i+4] != 0) {
- adflength = i + 1;
- }
- }
- } else {
- /* unknown family */
- return LDNS_WIREPARSE_ERR_INVALID_STR;
- }
-
- my_str = strchr(my_str, '/') + 1;
- prefix = (uint8_t) atoi(my_str);
-
- sldns_write_uint16(data, family);
- data[2] = prefix;
- data[3] = (uint8_t)adflength;
- if (negation) {
- /* set bit 1 of byte 3 */
- data[3] = data[3] | 0x80;
- }
-
- if(*len < 4+adflength)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- memmove(rd, data, 4+adflength);
- *len = 4+adflength;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_b64_buf(const char* str, uint8_t* rd, size_t* len)
-{
- size_t sz = sldns_b64_pton_calculate_size(strlen(str));
- int n;
- if(*len < sz)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- n = sldns_b64_pton(str, rd, *len);
- if(n < 0)
- return LDNS_WIREPARSE_ERR_SYNTAX_B64;
- *len = (size_t)n;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_b32_ext_buf(const char* str, uint8_t* rd, size_t* len)
-{
- size_t slen = strlen(str);
- size_t sz = sldns_b32_pton_calculate_size(slen);
- int n;
- if(*len < 1+sz)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- rd[0] = (uint8_t)sz;
- n = sldns_b32_pton_extended_hex(str, slen, rd+1, *len-1);
- if(n < 0)
- return LDNS_WIREPARSE_ERR_SYNTAX_B32_EXT;
- *len = (size_t)n+1;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_hex_buf(const char* str, uint8_t* rd, size_t* len)
-{
- const char* s = str;
- size_t dlen = 0; /* number of hexdigits parsed */
- while(*s) {
- if(isspace((unsigned char)*s)) {
- s++;
- continue;
- }
- if(!isxdigit((unsigned char)*s))
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
- if(*len < dlen/2 + 1)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
- s-str);
- if((dlen&1)==0)
- rd[dlen/2] = (uint8_t)sldns_hexdigit_to_int(*s++) * 16;
- else rd[dlen/2] += (uint8_t)sldns_hexdigit_to_int(*s++);
- dlen++;
- }
- if((dlen&1)!=0)
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
- *len = dlen/2;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_nsec_buf(const char* str, uint8_t* rd, size_t* len)
-{
- const char *delim = "\n\t ";
- char token[64]; /* for a type name */
- size_t type_count = 0;
- int block;
- size_t used = 0;
- uint16_t maxtype = 0;
- uint8_t typebits[8192]; /* 65536 bits */
- uint8_t window_in_use[256];
-
- /* string in buffer */
- sldns_buffer strbuf;
- sldns_buffer_init_frm_data(&strbuf, (uint8_t*)str, strlen(str));
-
- /* parse the types */
- memset(typebits, 0, sizeof(typebits));
- memset(window_in_use, 0, sizeof(window_in_use));
- while(sldns_buffer_remaining(&strbuf) > 0 &&
- sldns_bget_token(&strbuf, token, delim, sizeof(token)) != -1) {
- uint16_t t = sldns_get_rr_type_by_name(token);
- if(token[0] == 0)
- continue;
- if(t == 0 && strcmp(token, "TYPE0") != 0)
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TYPE,
- sldns_buffer_position(&strbuf));
- typebits[t/8] |= (0x80>>(t%8));
- window_in_use[t/256] = 1;
- type_count++;
- if(t > maxtype) maxtype = t;
- }
-
- /* empty NSEC bitmap */
- if(type_count == 0) {
- *len = 0;
- return LDNS_WIREPARSE_ERR_OK;
- }
-
- /* encode windows {u8 windowblock, u8 bitmaplength, 0-32u8 bitmap},
- * block is 0-255 upper octet of types, length if 0-32. */
- for(block = 0; block <= (int)maxtype/256; block++) {
- int i, blocklen = 0;
- if(!window_in_use[block])
- continue;
- for(i=0; i<32; i++) {
- if(typebits[block*32+i] != 0)
- blocklen = i+1;
- }
- if(blocklen == 0)
- continue; /* empty window should have been !in_use */
- if(used+blocklen+2 > *len)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- rd[used+0] = (uint8_t)block;
- rd[used+1] = (uint8_t)blocklen;
- for(i=0; i<blocklen; i++) {
- rd[used+2+i] = typebits[block*32+i];
- }
- used += blocklen+2;
- }
- *len = used;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_type_buf(const char* str, uint8_t* rd, size_t* len)
-{
- uint16_t t = sldns_get_rr_type_by_name(str);
- if(t == 0 && strcmp(str, "TYPE0") != 0)
- return LDNS_WIREPARSE_ERR_SYNTAX_TYPE;
- if(*len < 2)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- sldns_write_uint16(rd, t);
- *len = 2;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_class_buf(const char* str, uint8_t* rd, size_t* len)
-{
- uint16_t c = sldns_get_rr_class_by_name(str);
- if(c == 0 && strcmp(str, "CLASS0") != 0)
- return LDNS_WIREPARSE_ERR_SYNTAX_CLASS;
- if(*len < 2)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- sldns_write_uint16(rd, c);
- *len = 2;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-/* An certificate alg field can either be specified as a 8 bits number
- * or by its symbolic name. Handle both */
-int sldns_str2wire_cert_alg_buf(const char* str, uint8_t* rd, size_t* len)
-{
- sldns_lookup_table *lt = sldns_lookup_by_name(sldns_cert_algorithms,
- str);
- if(*len < 2)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- if(lt) {
- sldns_write_uint16(rd, (uint16_t)lt->id);
- } else {
- int s = sldns_str2wire_int16_buf(str, rd, len);
- if(s) return s;
- if(sldns_read_uint16(rd) == 0)
- return LDNS_WIREPARSE_ERR_CERT_BAD_ALGORITHM;
- }
- *len = 2;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-/* An alg field can either be specified as a 8 bits number
- * or by its symbolic name. Handle both */
-int sldns_str2wire_alg_buf(const char* str, uint8_t* rd, size_t* len)
-{
- sldns_lookup_table *lt = sldns_lookup_by_name(sldns_algorithms, str);
- if(*len < 1)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- if(lt) {
- rd[0] = (uint8_t)lt->id;
- *len = 1;
- } else {
- /* try as-is (a number) */
- return sldns_str2wire_int8_buf(str, rd, len);
- }
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_time_buf(const char* str, uint8_t* rd, size_t* len)
-{
- /* convert a time YYYYDDMMHHMMSS to wireformat */
- struct tm tm;
- if(*len < 4)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
-
- /* Try to scan the time... */
- memset(&tm, 0, sizeof(tm));
- if (strlen(str) == 14 && sscanf(str, "%4d%2d%2d%2d%2d%2d",
- &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour,
- &tm.tm_min, &tm.tm_sec) == 6) {
- tm.tm_year -= 1900;
- tm.tm_mon--;
- /* Check values */
- if (tm.tm_year < 70)
- return LDNS_WIREPARSE_ERR_SYNTAX_TIME;
- if (tm.tm_mon < 0 || tm.tm_mon > 11)
- return LDNS_WIREPARSE_ERR_SYNTAX_TIME;
- if (tm.tm_mday < 1 || tm.tm_mday > 31)
- return LDNS_WIREPARSE_ERR_SYNTAX_TIME;
- if (tm.tm_hour < 0 || tm.tm_hour > 23)
- return LDNS_WIREPARSE_ERR_SYNTAX_TIME;
- if (tm.tm_min < 0 || tm.tm_min > 59)
- return LDNS_WIREPARSE_ERR_SYNTAX_TIME;
- if (tm.tm_sec < 0 || tm.tm_sec > 59)
- return LDNS_WIREPARSE_ERR_SYNTAX_TIME;
-
- sldns_write_uint32(rd, sldns_mktime_from_utc(&tm));
- } else {
- /* handle it as 32 bits timestamp */
- char *end;
- uint32_t l = (uint32_t)strtol((char*)str, &end, 10);
- if(*end != 0)
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TIME,
- end-(char*)str);
- sldns_write_uint32(rd, l);
- }
- *len = 4;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_period_buf(const char* str, uint8_t* rd, size_t* len)
-{
- const char* end;
- uint32_t p = sldns_str2period(str, &end);
- if(*end != 0)
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_PERIOD, end-str);
- if(*len < 4)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- sldns_write_uint32(rd, p);
- *len = 4;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-/** read "<digits>[.<digits>][mM]" into mantissa exponent format for LOC type */
-static int
-loc_parse_cm(char* my_str, char** endstr, uint8_t* m, uint8_t* e)
-{
- uint32_t meters = 0, cm = 0, val;
- while (isblank((unsigned char)*my_str)) {
- my_str++;
- }
- meters = (uint32_t)strtol(my_str, &my_str, 10);
- if (*my_str == '.') {
- my_str++;
- cm = (uint32_t)strtol(my_str, &my_str, 10);
- }
- if (meters >= 1) {
- *e = 2;
- val = meters;
- } else {
- *e = 0;
- val = cm;
- }
- while(val >= 10) {
- (*e)++;
- val /= 10;
- }
- *m = (uint8_t)val;
-
- if (*e > 9)
- return 0;
- if (*my_str == 'm' || *my_str == 'M') {
- my_str++;
- }
- *endstr = my_str;
- return 1;
-}
-
-int sldns_str2wire_loc_buf(const char* str, uint8_t* rd, size_t* len)
-{
- uint32_t latitude = 0;
- uint32_t longitude = 0;
- uint32_t altitude = 0;
-
- uint32_t equator = (uint32_t)1<<31; /* 2**31 */
-
- /* only support version 0 */
- uint32_t h = 0;
- uint32_t m = 0;
- uint8_t size_b = 1, size_e = 2;
- uint8_t horiz_pre_b = 1, horiz_pre_e = 6;
- uint8_t vert_pre_b = 1, vert_pre_e = 3;
-
- double s = 0.0;
- int northerness;
- int easterness;
-
- char *my_str = (char *) str;
-
- if (isdigit((unsigned char) *my_str)) {
- h = (uint32_t) strtol(my_str, &my_str, 10);
- } else {
- return LDNS_WIREPARSE_ERR_INVALID_STR;
- }
-
- while (isblank((unsigned char) *my_str)) {
- my_str++;
- }
-
- if (isdigit((unsigned char) *my_str)) {
- m = (uint32_t) strtol(my_str, &my_str, 10);
- } else if (*my_str == 'N' || *my_str == 'S') {
- goto north;
- } else {
- return LDNS_WIREPARSE_ERR_INVALID_STR;
- }
-
- while (isblank((unsigned char) *my_str)) {
- my_str++;
- }
-
- if (isdigit((unsigned char) *my_str)) {
- s = strtod(my_str, &my_str);
- }
-
- /* skip blanks before norterness */
- while (isblank((unsigned char) *my_str)) {
- my_str++;
- }
-
-north:
- if (*my_str == 'N') {
- northerness = 1;
- } else if (*my_str == 'S') {
- northerness = 0;
- } else {
- return LDNS_WIREPARSE_ERR_INVALID_STR;
- }
-
- my_str++;
-
- /* store number */
- s = 1000.0 * s;
- /* add a little to make floor in conversion a round */
- s += 0.0005;
- latitude = (uint32_t) s;
- latitude += 1000 * 60 * m;
- latitude += 1000 * 60 * 60 * h;
- if (northerness) {
- latitude = equator + latitude;
- } else {
- latitude = equator - latitude;
- }
- while (isblank((unsigned char)*my_str)) {
- my_str++;
- }
-
- if (isdigit((unsigned char) *my_str)) {
- h = (uint32_t) strtol(my_str, &my_str, 10);
- } else {
- return LDNS_WIREPARSE_ERR_INVALID_STR;
- }
-
- while (isblank((unsigned char) *my_str)) {
- my_str++;
- }
-
- if (isdigit((unsigned char) *my_str)) {
- m = (uint32_t) strtol(my_str, &my_str, 10);
- } else if (*my_str == 'E' || *my_str == 'W') {
- goto east;
- } else {
- return LDNS_WIREPARSE_ERR_INVALID_STR;
- }
-
- while (isblank((unsigned char)*my_str)) {
- my_str++;
- }
-
- if (isdigit((unsigned char) *my_str)) {
- s = strtod(my_str, &my_str);
- }
-
- /* skip blanks before easterness */
- while (isblank((unsigned char)*my_str)) {
- my_str++;
- }
-
-east:
- if (*my_str == 'E') {
- easterness = 1;
- } else if (*my_str == 'W') {
- easterness = 0;
- } else {
- return LDNS_WIREPARSE_ERR_INVALID_STR;
- }
-
- my_str++;
-
- /* store number */
- s *= 1000.0;
- /* add a little to make floor in conversion a round */
- s += 0.0005;
- longitude = (uint32_t) s;
- longitude += 1000 * 60 * m;
- longitude += 1000 * 60 * 60 * h;
-
- if (easterness) {
- longitude += equator;
- } else {
- longitude = equator - longitude;
- }
-
- altitude = (uint32_t)(strtod(my_str, &my_str)*100.0 +
- 10000000.0 + 0.5);
- if (*my_str == 'm' || *my_str == 'M') {
- my_str++;
- }
-
- if (strlen(my_str) > 0) {
- if(!loc_parse_cm(my_str, &my_str, &size_b, &size_e))
- return LDNS_WIREPARSE_ERR_INVALID_STR;
- }
-
- if (strlen(my_str) > 0) {
- if(!loc_parse_cm(my_str, &my_str, &horiz_pre_b, &horiz_pre_e))
- return LDNS_WIREPARSE_ERR_INVALID_STR;
- }
-
- if (strlen(my_str) > 0) {
- if(!loc_parse_cm(my_str, &my_str, &vert_pre_b, &vert_pre_e))
- return LDNS_WIREPARSE_ERR_INVALID_STR;
- }
-
- if(*len < 16)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- rd[0] = 0;
- rd[1] = ((size_b << 4) & 0xf0) | (size_e & 0x0f);
- rd[2] = ((horiz_pre_b << 4) & 0xf0) | (horiz_pre_e & 0x0f);
- rd[3] = ((vert_pre_b << 4) & 0xf0) | (vert_pre_e & 0x0f);
- sldns_write_uint32(rd + 4, latitude);
- sldns_write_uint32(rd + 8, longitude);
- sldns_write_uint32(rd + 12, altitude);
- *len = 16;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-static void
-ldns_tolower_str(char* s)
-{
- if(s) {
- while(*s) {
- *s = (char)tolower((unsigned char)*s);
- s++;
- }
- }
-}
-
-int sldns_str2wire_wks_buf(const char* str, uint8_t* rd, size_t* len)
-{
- int rd_len = 1;
- int have_proto = 0;
- char token[50], proto_str[50];
- sldns_buffer strbuf;
- sldns_buffer_init_frm_data(&strbuf, (uint8_t*)str, strlen(str));
- proto_str[0]=0;
-
- /* check we have one byte for proto */
- if(*len < 1)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
-
- while(sldns_bget_token(&strbuf, token, "\t\n ", sizeof(token)) > 0) {
- ldns_tolower_str(token);
- if(!have_proto) {
- struct protoent *p = getprotobyname(token);
- have_proto = 1;
- if(p) rd[0] = (uint8_t)p->p_proto;
- else rd[0] = (uint8_t)atoi(token);
- (void)strlcpy(proto_str, token, sizeof(proto_str));
- } else {
- int serv_port;
- struct servent *serv = getservbyname(token, proto_str);
- if(serv) serv_port=(int)ntohs((uint16_t)serv->s_port);
- else {
- serv_port = atoi(token);
- if(serv_port == 0 && strcmp(token, "0") != 0) {
-#ifdef HAVE_ENDSERVENT
- endservent();
-#endif
-#ifdef HAVE_ENDPROTOENT
- endprotoent();
-#endif
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX,
- sldns_buffer_position(&strbuf));
- }
- if(serv_port < 0 || serv_port > 65535) {
-#ifdef HAVE_ENDSERVENT
- endservent();
-#endif
-#ifdef HAVE_ENDPROTOENT
- endprotoent();
-#endif
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX,
- sldns_buffer_position(&strbuf));
- }
- }
- if(rd_len < 1+serv_port/8+1) {
- /* bitmap is larger, init new bytes at 0 */
- if(*len < 1+(size_t)serv_port/8+1) {
-#ifdef HAVE_ENDSERVENT
- endservent();
-#endif
-#ifdef HAVE_ENDPROTOENT
- endprotoent();
-#endif
- return RET_ERR(
- LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
- sldns_buffer_position(&strbuf));
- }
- memset(rd+rd_len, 0, 1+(size_t)serv_port/8+1-rd_len);
- rd_len = 1+serv_port/8+1;
- }
- rd[1+ serv_port/8] |= (1 << (7 - serv_port % 8));
- }
- }
- *len = (size_t)rd_len;
-
-#ifdef HAVE_ENDSERVENT
- endservent();
-#endif
-#ifdef HAVE_ENDPROTOENT
- endprotoent();
-#endif
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_nsap_buf(const char* str, uint8_t* rd, size_t* len)
-{
- const char* s = str;
- size_t slen;
- size_t dlen = 0; /* number of hexdigits parsed */
-
- /* just a hex string with optional dots? */
- if (s[0] != '0' || s[1] != 'x')
- return LDNS_WIREPARSE_ERR_INVALID_STR;
- s += 2;
- slen = strlen(s);
- if(slen > LDNS_MAX_RDFLEN*2)
- return LDNS_WIREPARSE_ERR_LABEL_OVERFLOW;
- while(*s) {
- if(isspace((unsigned char)*s) || *s == '.') {
- s++;
- continue;
- }
- if(!isxdigit((unsigned char)*s))
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
- if(*len < dlen/2 + 1)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
- s-str);
- if((dlen&1)==0)
- rd[dlen/2] = (uint8_t)sldns_hexdigit_to_int(*s++) * 16;
- else rd[dlen/2] += sldns_hexdigit_to_int(*s++);
- dlen++;
- }
- if((dlen&1)!=0)
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
- *len = dlen/2;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_atma_buf(const char* str, uint8_t* rd, size_t* len)
-{
- const char* s = str;
- size_t slen = strlen(str);
- size_t dlen = 0; /* number of hexdigits parsed */
-
- /* just a hex string with optional dots? */
- /* notimpl e.164 format */
- if(slen > LDNS_MAX_RDFLEN*2)
- return LDNS_WIREPARSE_ERR_LABEL_OVERFLOW;
- while(*s) {
- if(isspace((unsigned char)*s) || *s == '.') {
- s++;
- continue;
- }
- if(!isxdigit((unsigned char)*s))
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
- if(*len < dlen/2 + 1)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
- s-str);
- if((dlen&1)==0)
- rd[dlen/2] = (uint8_t)sldns_hexdigit_to_int(*s++) * 16;
- else rd[dlen/2] += sldns_hexdigit_to_int(*s++);
- dlen++;
- }
- if((dlen&1)!=0)
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
- *len = dlen/2;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_ipseckey_buf(const char* str, uint8_t* rd, size_t* len)
-{
- size_t gwlen = 0, keylen = 0;
- int s;
- uint8_t gwtype;
- char token[512];
- sldns_buffer strbuf;
- sldns_buffer_init_frm_data(&strbuf, (uint8_t*)str, strlen(str));
-
- if(*len < 3)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- /* precedence */
- if(sldns_bget_token(&strbuf, token, "\t\n ", sizeof(token)) <= 0)
- return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR,
- sldns_buffer_position(&strbuf));
- rd[0] = (uint8_t)atoi(token);
- /* gateway_type */
- if(sldns_bget_token(&strbuf, token, "\t\n ", sizeof(token)) <= 0)
- return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR,
- sldns_buffer_position(&strbuf));
- rd[1] = (uint8_t)atoi(token);
- gwtype = rd[1];
- /* algorithm */
- if(sldns_bget_token(&strbuf, token, "\t\n ", sizeof(token)) <= 0)
- return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR,
- sldns_buffer_position(&strbuf));
- rd[2] = (uint8_t)atoi(token);
-
- /* gateway */
- if(sldns_bget_token(&strbuf, token, "\t\n ", sizeof(token)) <= 0)
- return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR,
- sldns_buffer_position(&strbuf));
- if(gwtype == 0) {
- /* NOGATEWAY */
- if(strcmp(token, ".") != 0)
- return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR,
- sldns_buffer_position(&strbuf));
- gwlen = 0;
- } else if(gwtype == 1) {
- /* IP4 */
- gwlen = *len - 3;
- s = sldns_str2wire_a_buf(token, rd+3, &gwlen);
- if(s) return RET_ERR_SHIFT(s, sldns_buffer_position(&strbuf));
- } else if(gwtype == 2) {
- /* IP6 */
- gwlen = *len - 3;
- s = sldns_str2wire_aaaa_buf(token, rd+3, &gwlen);
- if(s) return RET_ERR_SHIFT(s, sldns_buffer_position(&strbuf));
- } else if(gwtype == 3) {
- /* DNAME */
- gwlen = *len - 3;
- s = sldns_str2wire_dname_buf(token, rd+3, &gwlen);
- if(s) return RET_ERR_SHIFT(s, sldns_buffer_position(&strbuf));
- } else {
- /* unknown gateway type */
- return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR,
- sldns_buffer_position(&strbuf));
- }
- /* double check for size */
- if(*len < 3 + gwlen)
- return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
- sldns_buffer_position(&strbuf));
-
- /* publickey in remainder of strbuf */
- keylen = *len - 3 - gwlen;
- s = sldns_str2wire_b64_buf((const char*)sldns_buffer_current(&strbuf),
- rd+3+gwlen, &keylen);
- if(s) return RET_ERR_SHIFT(s, sldns_buffer_position(&strbuf));
-
- *len = 3 + gwlen + keylen;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_nsec3_salt_buf(const char* str, uint8_t* rd, size_t* len)
-{
- int i, salt_length_str = (int)strlen(str);
- if (salt_length_str == 1 && str[0] == '-') {
- salt_length_str = 0;
- } else if (salt_length_str % 2 != 0) {
- return LDNS_WIREPARSE_ERR_SYNTAX_HEX;
- }
- if (salt_length_str > 512)
- return LDNS_WIREPARSE_ERR_SYNTAX_HEX;
- if(*len < 1+(size_t)salt_length_str / 2)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- rd[0] = (uint8_t) (salt_length_str / 2);
- for (i = 0; i < salt_length_str; i += 2) {
- if (isxdigit((unsigned char)str[i]) &&
- isxdigit((unsigned char)str[i+1])) {
- rd[1+i/2] = (uint8_t)(sldns_hexdigit_to_int(str[i])*16
- + sldns_hexdigit_to_int(str[i+1]));
- } else {
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, i);
- }
- }
- *len = 1 + (size_t)rd[0];
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_ilnp64_buf(const char* str, uint8_t* rd, size_t* len)
-{
- unsigned int a, b, c, d;
- uint16_t shorts[4];
- int l;
- if(*len < sizeof(shorts))
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
-
- if (sscanf(str, "%4x:%4x:%4x:%4x%n", &a, &b, &c, &d, &l) != 4 ||
- l != (int)strlen(str) || /* more data to read */
- strpbrk(str, "+-") /* signed hexes */
- )
- return LDNS_WIREPARSE_ERR_SYNTAX_ILNP64;
- shorts[0] = htons(a);
- shorts[1] = htons(b);
- shorts[2] = htons(c);
- shorts[3] = htons(d);
- memmove(rd, &shorts, sizeof(shorts));
- *len = sizeof(shorts);
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_eui48_buf(const char* str, uint8_t* rd, size_t* len)
-{
- unsigned int a, b, c, d, e, f;
- int l;
-
- if(*len < 6)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- if (sscanf(str, "%2x-%2x-%2x-%2x-%2x-%2x%n",
- &a, &b, &c, &d, &e, &f, &l) != 6 ||
- l != (int)strlen(str))
- return LDNS_WIREPARSE_ERR_SYNTAX_EUI48;
- rd[0] = a;
- rd[1] = b;
- rd[2] = c;
- rd[3] = d;
- rd[4] = e;
- rd[5] = f;
- *len = 6;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_eui64_buf(const char* str, uint8_t* rd, size_t* len)
-{
- unsigned int a, b, c, d, e, f, g, h;
- int l;
-
- if(*len < 8)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- if (sscanf(str, "%2x-%2x-%2x-%2x-%2x-%2x-%2x-%2x%n",
- &a, &b, &c, &d, &e, &f, &g, &h, &l) != 8 ||
- l != (int)strlen(str))
- return LDNS_WIREPARSE_ERR_SYNTAX_EUI64;
- rd[0] = a;
- rd[1] = b;
- rd[2] = c;
- rd[3] = d;
- rd[4] = e;
- rd[5] = f;
- rd[6] = g;
- rd[7] = h;
- *len = 8;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_tag_buf(const char* str, uint8_t* rd, size_t* len)
-{
- size_t slen = strlen(str);
- const char* ptr;
-
- if (slen > 255)
- return LDNS_WIREPARSE_ERR_SYNTAX_TAG;
- if(*len < slen+1)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- for (ptr = str; *ptr; ptr++) {
- if(!isalnum((unsigned char)*ptr))
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TAG, ptr-str);
- }
- rd[0] = slen;
- memmove(rd+1, str, slen);
- *len = slen+1;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_long_str_buf(const char* str, uint8_t* rd, size_t* len)
-{
- uint8_t ch = 0;
- const char* pstr = str;
- size_t length = 0;
-
- /* Fill data with parsed bytes */
- while (sldns_parse_char(&ch, &pstr)) {
- if(*len < length+1)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- rd[length++] = ch;
- }
- if(!pstr)
- return LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE;
- *len = length;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_hip_buf(const char* str, uint8_t* rd, size_t* len)
-{
- char* s, *end;
- int e;
- size_t hitlen, pklen = 0;
- /* presentation format:
- * pk-algo HIThex pubkeybase64
- * wireformat:
- * hitlen[1byte] pkalgo[1byte] pubkeylen[2byte] [hit] [pubkey] */
- if(*len < 4)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
-
- /* read PK algorithm */
- rd[1] = (uint8_t)strtol((char*)str, &s, 10);
- if(*s != ' ')
- return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_INT, s-(char*)str);
- s++;
- while(*s == ' ')
- s++;
-
- /* read HIT hex tag */
- /* zero terminate the tag (replace later) */
- end = strchr(s, ' ');
- if(!end) return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX, s-(char*)str);
- *end = 0;
- hitlen = *len - 4;
- if((e = sldns_str2wire_hex_buf(s, rd+4, &hitlen)) != 0) {
- *end = ' ';
- return RET_ERR_SHIFT(e, s-(char*)str);
- }
- if(hitlen > 255) {
- *end = ' ';
- return RET_ERR(LDNS_WIREPARSE_ERR_LABEL_OVERFLOW, s-(char*)str+255*2);
- }
- rd[0] = (uint8_t)hitlen;
- *end = ' ';
- s = end+1;
-
- /* read pubkey base64 sequence */
- pklen = *len - 4 - hitlen;
- if((e = sldns_str2wire_b64_buf(s, rd+4+hitlen, &pklen)) != 0)
- return RET_ERR_SHIFT(e, s-(char*)str);
- if(pklen > 65535)
- return RET_ERR(LDNS_WIREPARSE_ERR_LABEL_OVERFLOW, s-(char*)str+65535);
- sldns_write_uint16(rd+2, pklen);
-
- *len = 4 + hitlen + pklen;
- return LDNS_WIREPARSE_ERR_OK;
-}
-
-int sldns_str2wire_int16_data_buf(const char* str, uint8_t* rd, size_t* len)
-{
- size_t sz = sldns_b64_pton_calculate_size(strlen(str));
- int n;
- if(*len < sz+2)
- return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
- if(sz > 65535)
- return LDNS_WIREPARSE_ERR_LABEL_OVERFLOW;
- n = sldns_b64_pton(str, rd+2, (*len)-2);
- if(n < 0)
- return LDNS_WIREPARSE_ERR_SYNTAX_B64;
- sldns_write_uint16(rd, (uint16_t)n);
- *len = (size_t)n;
- return LDNS_WIREPARSE_ERR_OK;
-}
+++ /dev/null
-/**
- * str2wire.h - read txt presentation of RRs
- *
- * (c) NLnet Labs, 2005-2006
- *
- * See the file LICENSE for the license
- */
-
-/**
- * \file
- *
- * Parses text to wireformat.
- */
-
-#ifndef LDNS_STR2WIRE_H
-#define LDNS_STR2WIRE_H
-
-/* include rrdef for MAX_DOMAINLEN constant */
-#include <ldns/rrdef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-struct sldns_struct_lookup_table;
-
-/** buffer to read an RR, cannot be larger than 64K because of packet size */
-#define LDNS_RR_BUF_SIZE 65535 /* bytes */
-#define LDNS_DEFAULT_TTL 3600
-
-/*
- * To convert class and type to string see
- * sldns_get_rr_class_by_name(str)
- * sldns_get_rr_type_by_name(str)
- * from rrdef.h
- */
-
-/**
- * Convert text string into dname wireformat, mallocless, with user buffer.
- * @param str: the text string with the domain name.
- * @param buf: the result buffer, suggested size LDNS_MAX_DOMAINLEN+1
- * @param len: length of the buffer on input, length of the result on output.
- * @return 0 on success, otherwise an error.
- */
-int sldns_str2wire_dname_buf(const char* str, uint8_t* buf, size_t* len);
-
-/**
- * Same as sldns_str2wire_dname_buf, but concatenates origin if the domain
- * name is relative (does not end in '.').
- * @param str: the text string with the domain name.
- * @param buf: the result buffer, suggested size LDNS_MAX_DOMAINLEN+1
- * @param len: length of the buffer on input, length of the result on output.
- * @param origin: the origin to append or NULL (nothing is appended).
- * @param origin_len: length of origin.
- * @return 0 on success, otherwise an error.
- */
-int sldns_str2wire_dname_buf_origin(const char* str, uint8_t* buf, size_t* len,
- uint8_t* origin, size_t origin_len);
-
-/**
- * Convert text string into dname wireformat
- * @param str: the text string with the domain name.
- * @param len: returned length of wireformat.
- * @return wireformat dname (malloced) or NULL on failure.
- */
-uint8_t* sldns_str2wire_dname(const char* str, size_t* len);
-
-/**
- * Convert text RR to wireformat, with user buffer.
- * @param str: the RR data in text presentation format.
- * @param rr: the buffer where the result is stored into. This buffer has
- * the wire-dname(uncompressed), type, class, ttl, rdatalen, rdata.
- * These values are probably not aligned, and in network format.
- * Use the sldns_wirerr_get_xxx functions to access them safely.
- * buffer size LDNS_RR_BUF_SIZE is suggested.
- * @param len: on input the length of the buffer, on output the amount of
- * the buffer used for the rr.
- * @param dname_len: if non-NULL, filled with the dname length as result.
- * Because after the dname you find the type, class, ttl, rdatalen, rdata.
- * @param default_ttl: TTL used if no TTL available.
- * @param origin: used for origin dname (if not NULL)
- * @param origin_len: length of origin.
- * @param prev: used for prev_rr dname (if not NULL)
- * @param prev_len: length of prev.
- * @return 0 on success, an error on failure.
- */
-int sldns_str2wire_rr_buf(const char* str, uint8_t* rr, size_t* len,
- size_t* dname_len, uint32_t default_ttl, uint8_t* origin,
- size_t origin_len, uint8_t* prev, size_t prev_len);
-
-/**
- * Same as sldns_str2wire_rr_buf, but there is no rdata, it returns an RR
- * with zero rdata and no ttl. It has name, type, class.
- * You can access those with the sldns_wirerr_get_type and class functions.
- * @param str: the RR data in text presentation format.
- * @param rr: the buffer where the result is stored into.
- * @param len: on input the length of the buffer, on output the amount of
- * the buffer used for the rr.
- * @param dname_len: if non-NULL, filled with the dname length as result.
- * Because after the dname you find the type, class, ttl, rdatalen, rdata.
- * @param origin: used for origin dname (if not NULL)
- * @param origin_len: length of origin.
- * @param prev: used for prev_rr dname (if not NULL)
- * @param prev_len: length of prev.
- * @return 0 on success, an error on failure.
- */
-int sldns_str2wire_rr_question_buf(const char* str, uint8_t* rr, size_t* len,
- size_t* dname_len, uint8_t* origin, size_t origin_len, uint8_t* prev,
- size_t prev_len);
-
-/**
- * Get the type of the RR.
- * @param rr: the RR in wire format.
- * @param len: rr length.
- * @param dname_len: dname length to skip.
- * @return type in host byteorder
- */
-uint16_t sldns_wirerr_get_type(uint8_t* rr, size_t len, size_t dname_len);
-
-/**
- * Get the class of the RR.
- * @param rr: the RR in wire format.
- * @param len: rr length.
- * @param dname_len: dname length to skip.
- * @return class in host byteorder
- */
-uint16_t sldns_wirerr_get_class(uint8_t* rr, size_t len, size_t dname_len);
-
-/**
- * Get the ttl of the RR.
- * @param rr: the RR in wire format.
- * @param len: rr length.
- * @param dname_len: dname length to skip.
- * @return ttl in host byteorder
- */
-uint32_t sldns_wirerr_get_ttl(uint8_t* rr, size_t len, size_t dname_len);
-
-/**
- * Get the rdata length of the RR.
- * @param rr: the RR in wire format.
- * @param len: rr length.
- * @param dname_len: dname length to skip.
- * @return rdata length in host byteorder
- * If the rdata length is larger than the rr-len allows, it is truncated.
- * So, that it is safe to read the data length returned
- * from this function from the rdata pointer of sldns_wirerr_get_rdata.
- */
-uint16_t sldns_wirerr_get_rdatalen(uint8_t* rr, size_t len, size_t dname_len);
-
-/**
- * Get the rdata pointer of the RR.
- * @param rr: the RR in wire format.
- * @param len: rr length.
- * @param dname_len: dname length to skip.
- * @return rdata pointer
- */
-uint8_t* sldns_wirerr_get_rdata(uint8_t* rr, size_t len, size_t dname_len);
-
-/**
- * Get the rdata pointer of the RR. prefixed with rdata length.
- * @param rr: the RR in wire format.
- * @param len: rr length.
- * @param dname_len: dname length to skip.
- * @return pointer to rdatalength, followed by the rdata.
- */
-uint8_t* sldns_wirerr_get_rdatawl(uint8_t* rr, size_t len, size_t dname_len);
-
-/**
- * Parse result codes
- */
-#define LDNS_WIREPARSE_MASK 0x0fff
-#define LDNS_WIREPARSE_SHIFT 12
-#define LDNS_WIREPARSE_ERROR(e) ((e)&LDNS_WIREPARSE_MASK)
-#define LDNS_WIREPARSE_OFFSET(e) (((e)&~LDNS_WIREPARSE_MASK)>>LDNS_WIREPARSE_SHIFT)
-/* use lookuptable to get error string, sldns_wireparse_errors */
-#define LDNS_WIREPARSE_ERR_OK 0
-#define LDNS_WIREPARSE_ERR_GENERAL 342
-#define LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW 343
-#define LDNS_WIREPARSE_ERR_DOMAINNAME_UNDERFLOW 344
-#define LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL 345
-#define LDNS_WIREPARSE_ERR_LABEL_OVERFLOW 346
-#define LDNS_WIREPARSE_ERR_EMPTY_LABEL 347
-#define LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE 348
-#define LDNS_WIREPARSE_ERR_SYNTAX 349
-#define LDNS_WIREPARSE_ERR_SYNTAX_TTL 350
-#define LDNS_WIREPARSE_ERR_SYNTAX_TYPE 351
-#define LDNS_WIREPARSE_ERR_SYNTAX_CLASS 352
-#define LDNS_WIREPARSE_ERR_SYNTAX_RDATA 353
-#define LDNS_WIREPARSE_ERR_SYNTAX_MISSING_VALUE 354
-#define LDNS_WIREPARSE_ERR_INVALID_STR 355
-#define LDNS_WIREPARSE_ERR_SYNTAX_B64 356
-#define LDNS_WIREPARSE_ERR_SYNTAX_B32_EXT 357
-#define LDNS_WIREPARSE_ERR_SYNTAX_HEX 358
-#define LDNS_WIREPARSE_ERR_CERT_BAD_ALGORITHM 359
-#define LDNS_WIREPARSE_ERR_SYNTAX_TIME 360
-#define LDNS_WIREPARSE_ERR_SYNTAX_PERIOD 361
-#define LDNS_WIREPARSE_ERR_SYNTAX_ILNP64 362
-#define LDNS_WIREPARSE_ERR_SYNTAX_EUI48 363
-#define LDNS_WIREPARSE_ERR_SYNTAX_EUI64 364
-#define LDNS_WIREPARSE_ERR_SYNTAX_TAG 365
-#define LDNS_WIREPARSE_ERR_NOT_IMPL 366
-#define LDNS_WIREPARSE_ERR_SYNTAX_INT 367
-#define LDNS_WIREPARSE_ERR_SYNTAX_IP4 368
-#define LDNS_WIREPARSE_ERR_SYNTAX_IP6 369
-#define LDNS_WIREPARSE_ERR_SYNTAX_INTEGER_OVERFLOW 370
-#define LDNS_WIREPARSE_ERR_INCLUDE 371
-#define LDNS_WIREPARSE_ERR_PARENTHESIS 372
-
-/**
- * Get reference to a constant string for the (parse) error.
- * @param e: error return value
- * @return string.
- */
-const char* sldns_get_errorstr_parse(int e);
-
-/**
- * wire parse state for parsing files
- */
-struct sldns_file_parse_state {
- /** the origin domain name, if len!=0. uncompressed wireformat */
- uint8_t origin[LDNS_MAX_DOMAINLEN+1];
- /** length of origin domain name, in bytes. 0 if not set. */
- size_t origin_len;
- /** the previous domain name, if len!=0. uncompressed wireformat*/
- uint8_t prev_rr[LDNS_MAX_DOMAINLEN+1];
- /** length of the previous domain name, in bytes. 0 if not set. */
- size_t prev_rr_len;
- /** default TTL, this is used if the text does not specify a TTL,
- * host byteorder */
- uint32_t default_ttl;
- /** line number information */
- int lineno;
-};
-
-/**
- * Read one RR from zonefile with buffer for the data.
- * @param in: file that is read from (one RR, multiple lines if it spans them).
- * @param rr: this is malloced by the user and the result is stored here,
- * if an RR is read. If no RR is read this is signalled with the
- * return len set to 0 (for ORIGIN, TTL directives).
- * @param len: on input, the length of the rr buffer. on output the rr len.
- * Buffer size of 64k should be enough.
- * @param dname_len: returns the length of the dname initial part of the rr.
- * @param parse_state: pass a pointer to user-allocated struct.
- * Contents are maintained by this function.
- * If you pass NULL then ORIGIN and TTL directives are not honored.
- * You can start out with a particular origin by pre-filling it.
- * otherwise, zero the structure before passing it.
- * lineno is incremented when a newline is passed by the parser,
- * you should initialize it at 1 at the start of the file.
- * @return 0 on success, error on failure.
- */
-int sldns_fp2wire_rr_buf(FILE* in, uint8_t* rr, size_t* len, size_t* dname_len,
- struct sldns_file_parse_state* parse_state);
-
-/**
- * Convert one rdf in rdata to wireformat and parse from string.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @param rdftype: the type of the rdf.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_rdf_buf(const char* str, uint8_t* rd, size_t* len,
- sldns_rdf_type rdftype);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_INT8 from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_int8_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_INT16 from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_int16_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_INT32 from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_int32_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_A from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_a_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_AAAA from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_aaaa_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_STR from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_str_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_APL from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_apl_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_B64 from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_b64_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_B32_EXT from string to wireformat.
- * And also LDNS_RDF_TYPE_NSEC3_NEXT_OWNER.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_b32_ext_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_HEX from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_hex_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_NSEC from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_nsec_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_TYPE from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_type_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_CLASS from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_class_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_CERT_ALG from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_cert_alg_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_ALG from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_alg_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_TIME from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_time_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_PERIOD from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_period_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_LOC from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_loc_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_WKS from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_wks_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_NSAP from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_nsap_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_ATMA from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_atma_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_IPSECKEY from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_ipseckey_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_NSEC3_SALT from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_nsec3_salt_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_ILNP64 from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_ilnp64_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_EUI48 from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_eui48_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_EUI64 from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_eui64_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_TAG from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_tag_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_LONG_STR from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_long_str_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_HIP from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_hip_buf(const char* str, uint8_t* rd, size_t* len);
-
-/**
- * Convert rdf of type LDNS_RDF_TYPE_INT16_DATA from string to wireformat.
- * @param str: the text to convert for this rdata element.
- * @param rd: rdata buffer for the wireformat.
- * @param len: length of rd buffer on input, used length on output.
- * @return 0 on success, error on failure.
- */
-int sldns_str2wire_int16_data_buf(const char* str, uint8_t* rd, size_t* len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LDNS_STR2WIRE_H */
+++ /dev/null
-/*
- * wire2str.c
- *
- * conversion routines from the wire format
- * to the presentation format (strings)
- *
- * (c) NLnet Labs, 2004-2006
- *
- * See the file LICENSE for the license
- */
-/**
- * \file
- *
- * Contains functions to translate the wireformat to text
- * representation, as well as functions to print them.
- */
-#include "config.h"
-#include "ldns/wire2str.h"
-#include "ldns/str2wire.h"
-#include "ldns/rrdef.h"
-#include "ldns/pkthdr.h"
-#include "ldns/parseutil.h"
-#include "ldns/sbuffer.h"
-#include "ldns/keyraw.h"
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
-#include <sys/time.h>
-#include <stdarg.h>
-#include <ctype.h>
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-
-/* lookup tables for standard DNS stuff */
-/* Taken from RFC 2535, section 7. */
-static sldns_lookup_table sldns_algorithms_data[] = {
- { LDNS_RSAMD5, "RSAMD5" },
- { LDNS_DH, "DH" },
- { LDNS_DSA, "DSA" },
- { LDNS_ECC, "ECC" },
- { LDNS_RSASHA1, "RSASHA1" },
- { LDNS_DSA_NSEC3, "DSA-NSEC3-SHA1" },
- { LDNS_RSASHA1_NSEC3, "RSASHA1-NSEC3-SHA1" },
- { LDNS_RSASHA256, "RSASHA256"},
- { LDNS_RSASHA512, "RSASHA512"},
- { LDNS_ECC_GOST, "ECC-GOST"},
- { LDNS_ECDSAP256SHA256, "ECDSAP256SHA256"},
- { LDNS_ECDSAP384SHA384, "ECDSAP384SHA384"},
- { LDNS_INDIRECT, "INDIRECT" },
- { LDNS_PRIVATEDNS, "PRIVATEDNS" },
- { LDNS_PRIVATEOID, "PRIVATEOID" },
- { 0, NULL }
-};
-sldns_lookup_table* sldns_algorithms = sldns_algorithms_data;
-
-/* hash algorithms in DS record */
-static sldns_lookup_table sldns_hashes_data[] = {
- { LDNS_SHA1, "SHA1" },
- { LDNS_SHA256, "SHA256" },
- { LDNS_HASH_GOST, "HASH-GOST" },
- { LDNS_SHA384, "SHA384" },
- { 0, NULL }
-};
-sldns_lookup_table* sldns_hashes = sldns_hashes_data;
-
-/* Taken from RFC 4398 */
-static sldns_lookup_table sldns_cert_algorithms_data[] = {
- { LDNS_CERT_PKIX, "PKIX" },
- { LDNS_CERT_SPKI, "SPKI" },
- { LDNS_CERT_PGP, "PGP" },
- { LDNS_CERT_IPKIX, "IPKIX" },
- { LDNS_CERT_ISPKI, "ISPKI" },
- { LDNS_CERT_IPGP, "IPGP" },
- { LDNS_CERT_ACPKIX, "ACPKIX" },
- { LDNS_CERT_IACPKIX, "IACPKIX" },
- { LDNS_CERT_URI, "URI" },
- { LDNS_CERT_OID, "OID" },
- { 0, NULL }
-};
-sldns_lookup_table* sldns_cert_algorithms = sldns_cert_algorithms_data;
-
-/* if these are used elsewhere */
-static sldns_lookup_table sldns_rcodes_data[] = {
- { LDNS_RCODE_NOERROR, "NOERROR" },
- { LDNS_RCODE_FORMERR, "FORMERR" },
- { LDNS_RCODE_SERVFAIL, "SERVFAIL" },
- { LDNS_RCODE_NXDOMAIN, "NXDOMAIN" },
- { LDNS_RCODE_NOTIMPL, "NOTIMPL" },
- { LDNS_RCODE_REFUSED, "REFUSED" },
- { LDNS_RCODE_YXDOMAIN, "YXDOMAIN" },
- { LDNS_RCODE_YXRRSET, "YXRRSET" },
- { LDNS_RCODE_NXRRSET, "NXRRSET" },
- { LDNS_RCODE_NOTAUTH, "NOTAUTH" },
- { LDNS_RCODE_NOTZONE, "NOTZONE" },
- { 0, NULL }
-};
-sldns_lookup_table* sldns_rcodes = sldns_rcodes_data;
-
-static sldns_lookup_table sldns_opcodes_data[] = {
- { LDNS_PACKET_QUERY, "QUERY" },
- { LDNS_PACKET_IQUERY, "IQUERY" },
- { LDNS_PACKET_STATUS, "STATUS" },
- { LDNS_PACKET_NOTIFY, "NOTIFY" },
- { LDNS_PACKET_UPDATE, "UPDATE" },
- { 0, NULL }
-};
-sldns_lookup_table* sldns_opcodes = sldns_opcodes_data;
-
-static sldns_lookup_table sldns_wireparse_errors_data[] = {
- { LDNS_WIREPARSE_ERR_OK, "no parse error" },
- { LDNS_WIREPARSE_ERR_GENERAL, "parse error" },
- { LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW, "Domainname length overflow" },
- { LDNS_WIREPARSE_ERR_DOMAINNAME_UNDERFLOW, "Domainname length underflow (zero length)" },
- { LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, "buffer too small" },
- { LDNS_WIREPARSE_ERR_LABEL_OVERFLOW, "Label length overflow" },
- { LDNS_WIREPARSE_ERR_EMPTY_LABEL, "Empty label" },
- { LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE, "Syntax error, bad escape sequence" },
- { LDNS_WIREPARSE_ERR_SYNTAX, "Syntax error, could not parse the RR" },
- { LDNS_WIREPARSE_ERR_SYNTAX_TTL, "Syntax error, could not parse the RR's TTL" },
- { LDNS_WIREPARSE_ERR_SYNTAX_TYPE, "Syntax error, could not parse the RR's type" },
- { LDNS_WIREPARSE_ERR_SYNTAX_CLASS, "Syntax error, could not parse the RR's class" },
- { LDNS_WIREPARSE_ERR_SYNTAX_RDATA, "Syntax error, could not parse the RR's rdata" },
- { LDNS_WIREPARSE_ERR_SYNTAX_MISSING_VALUE, "Syntax error, value expected" },
- { LDNS_WIREPARSE_ERR_INVALID_STR, "Conversion error, string expected" },
- { LDNS_WIREPARSE_ERR_SYNTAX_B64, "Conversion error, b64 encoding expected" },
- { LDNS_WIREPARSE_ERR_SYNTAX_B32_EXT, "Conversion error, b32 ext encoding expected" },
- { LDNS_WIREPARSE_ERR_SYNTAX_HEX, "Conversion error, hex encoding expected" },
- { LDNS_WIREPARSE_ERR_CERT_BAD_ALGORITHM, "Bad algorithm type for CERT record" },
- { LDNS_WIREPARSE_ERR_SYNTAX_TIME, "Conversion error, time encoding expected" },
- { LDNS_WIREPARSE_ERR_SYNTAX_PERIOD, "Conversion error, time period encoding expected" },
- { LDNS_WIREPARSE_ERR_SYNTAX_ILNP64, "Conversion error, 4 colon separated hex numbers expected" },
- { LDNS_WIREPARSE_ERR_SYNTAX_EUI48,
- "Conversion error, 6 two character hex numbers "
- "separated by dashes expected (i.e. xx-xx-xx-xx-xx-xx" },
- { LDNS_WIREPARSE_ERR_SYNTAX_EUI64,
- "Conversion error, 8 two character hex numbers "
- "separated by dashes expected (i.e. xx-xx-xx-xx-xx-xx-xx-xx" },
- { LDNS_WIREPARSE_ERR_SYNTAX_TAG,
- "Conversion error, a non-zero sequence of US-ASCII letters "
- "and numbers in lower case expected" },
- { LDNS_WIREPARSE_ERR_NOT_IMPL, "not implemented" },
- { LDNS_WIREPARSE_ERR_SYNTAX_INT, "Conversion error, integer expected" },
- { LDNS_WIREPARSE_ERR_SYNTAX_IP4, "Conversion error, ip4 addr expected" },
- { LDNS_WIREPARSE_ERR_SYNTAX_IP6, "Conversion error, ip6 addr expected" },
- { LDNS_WIREPARSE_ERR_SYNTAX_INTEGER_OVERFLOW, "Syntax error, integer overflow" },
- { LDNS_WIREPARSE_ERR_INCLUDE, "$INCLUDE directive was seen in the zone" },
- { LDNS_WIREPARSE_ERR_PARENTHESIS, "Parse error, parenthesis mismatch" },
- { 0, NULL }
-};
-sldns_lookup_table* sldns_wireparse_errors = sldns_wireparse_errors_data;
-
-static sldns_lookup_table sldns_edns_flags_data[] = {
- { 3600, "do"},
- { 0, NULL}
-};
-sldns_lookup_table* sldns_edns_flags = sldns_edns_flags_data;
-
-static sldns_lookup_table sldns_edns_options_data[] = {
- { 1, "LLQ" },
- { 2, "UL" },
- { 3, "NSID" },
- /* 4 draft-cheshire-edns0-owner-option */
- { 5, "DAU" },
- { 6, "DHU" },
- { 7, "N3U" },
- { 8, "edns-client-subnet" },
- { 0, NULL}
-};
-sldns_lookup_table* sldns_edns_options = sldns_edns_options_data;
-
-char* sldns_wire2str_pkt(uint8_t* data, size_t len)
-{
- size_t slen = (size_t)sldns_wire2str_pkt_buf(data, len, NULL, 0);
- char* result = (char*)malloc(slen+1);
- if(!result) return NULL;
- sldns_wire2str_pkt_buf(data, len, result, slen+1);
- return result;
-}
-
-char* sldns_wire2str_rr(uint8_t* rr, size_t len)
-{
- size_t slen = (size_t)sldns_wire2str_rr_buf(rr, len, NULL, 0);
- char* result = (char*)malloc(slen+1);
- if(!result) return NULL;
- sldns_wire2str_rr_buf(rr, len, result, slen+1);
- return result;
-}
-
-char* sldns_wire2str_type(uint16_t rrtype)
-{
- char buf[16];
- sldns_wire2str_type_buf(rrtype, buf, sizeof(buf));
- return strdup(buf);
-}
-
-char* sldns_wire2str_class(uint16_t rrclass)
-{
- char buf[16];
- sldns_wire2str_class_buf(rrclass, buf, sizeof(buf));
- return strdup(buf);
-}
-
-char* sldns_wire2str_dname(uint8_t* dname, size_t dname_len)
-{
- size_t slen=(size_t)sldns_wire2str_dname_buf(dname, dname_len, NULL, 0);
- char* result = (char*)malloc(slen+1);
- if(!result) return NULL;
- sldns_wire2str_dname_buf(dname, dname_len, result, slen+1);
- return result;
-}
-
-char* sldns_wire2str_rcode(int rcode)
-{
- char buf[16];
- sldns_wire2str_rcode_buf(rcode, buf, sizeof(buf));
- return strdup(buf);
-}
-
-int sldns_wire2str_pkt_buf(uint8_t* d, size_t dlen, char* s, size_t slen)
-{
- /* use arguments as temporary variables */
- return sldns_wire2str_pkt_scan(&d, &dlen, &s, &slen);
-}
-
-int sldns_wire2str_rr_buf(uint8_t* d, size_t dlen, char* s, size_t slen)
-{
- /* use arguments as temporary variables */
- return sldns_wire2str_rr_scan(&d, &dlen, &s, &slen, NULL, 0);
-}
-
-int sldns_wire2str_rdata_buf(uint8_t* rdata, size_t rdata_len, char* str,
- size_t str_len, uint16_t rrtype)
-{
- /* use arguments as temporary variables */
- return sldns_wire2str_rdata_scan(&rdata, &rdata_len, &str, &str_len,
- rrtype, NULL, 0);
-}
-
-int sldns_wire2str_rr_unknown_buf(uint8_t* d, size_t dlen, char* s, size_t slen)
-{
- /* use arguments as temporary variables */
- return sldns_wire2str_rr_unknown_scan(&d, &dlen, &s, &slen, NULL, 0);
-}
-
-int sldns_wire2str_rr_comment_buf(uint8_t* rr, size_t rrlen, size_t dname_len,
- char* s, size_t slen)
-{
- uint16_t rrtype = sldns_wirerr_get_type(rr, rrlen, dname_len);
- return sldns_wire2str_rr_comment_print(&s, &slen, rr, rrlen, dname_len,
- rrtype);
-}
-
-int sldns_wire2str_type_buf(uint16_t rrtype, char* s, size_t slen)
-{
- /* use arguments as temporary variables */
- return sldns_wire2str_type_print(&s, &slen, rrtype);
-}
-
-int sldns_wire2str_class_buf(uint16_t rrclass, char* s, size_t slen)
-{
- /* use arguments as temporary variables */
- return sldns_wire2str_class_print(&s, &slen, rrclass);
-}
-
-int sldns_wire2str_rcode_buf(int rcode, char* s, size_t slen)
-{
- /* use arguments as temporary variables */
- return sldns_wire2str_rcode_print(&s, &slen, rcode);
-}
-
-int sldns_wire2str_dname_buf(uint8_t* d, size_t dlen, char* s, size_t slen)
-{
- /* use arguments as temporary variables */
- return sldns_wire2str_dname_scan(&d, &dlen, &s, &slen, NULL, 0);
-}
-
-int sldns_str_vprint(char** str, size_t* slen, const char* format, va_list args)
-{
- int w = vsnprintf(*str, *slen, format, args);
- if(w < 0) {
- /* error in printout */
- return 0;
- } else if((size_t)w >= *slen) {
- *str = NULL; /* we do not want str to point outside of buffer*/
- *slen = 0;
- } else {
- *str += w;
- *slen -= w;
- }
- return w;
-}
-
-int sldns_str_print(char** str, size_t* slen, const char* format, ...)
-{
- int w;
- va_list args;
- va_start(args, format);
- w = sldns_str_vprint(str, slen, format, args);
- va_end(args);
- return w;
-}
-
-/** print hex format into text buffer for specified length */
-static int print_hex_buf(char** s, size_t* slen, uint8_t* buf, size_t len)
-{
- const char* hex = "0123456789ABCDEF";
- size_t i;
- for(i=0; i<len; i++) {
- (void)sldns_str_print(s, slen, "%c%c", hex[(buf[i]&0xf0)>>4],
- hex[buf[i]&0x0f]);
- }
- return (int)len*2;
-}
-
-/** print remainder of buffer in hex format with prefixed text */
-static int print_remainder_hex(const char* pref, uint8_t** d, size_t* dlen,
- char** s, size_t* slen)
-{
- int w = 0;
- w += sldns_str_print(s, slen, "%s", pref);
- w += print_hex_buf(s, slen, *d, *dlen);
- *d += *dlen;
- *dlen = 0;
- return w;
-}
-
-int sldns_wire2str_pkt_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen)
-{
- int w = 0;
- unsigned qdcount, ancount, nscount, arcount, i;
- uint8_t* pkt = *d;
- size_t pktlen = *dlen;
- if(*dlen >= LDNS_HEADER_SIZE) {
- qdcount = (unsigned)LDNS_QDCOUNT(*d);
- ancount = (unsigned)LDNS_ANCOUNT(*d);
- nscount = (unsigned)LDNS_NSCOUNT(*d);
- arcount = (unsigned)LDNS_ARCOUNT(*d);
- } else {
- qdcount = ancount = nscount = arcount = 0;
- }
- w += sldns_wire2str_header_scan(d, dlen, s, slen);
- w += sldns_str_print(s, slen, "\n");
- w += sldns_str_print(s, slen, ";; QUESTION SECTION:\n");
- for(i=0; i<qdcount; i++) {
- w += sldns_wire2str_rrquestion_scan(d, dlen, s, slen,
- pkt, pktlen);
- if(!*dlen) break;
- }
- w += sldns_str_print(s, slen, "\n");
- w += sldns_str_print(s, slen, ";; ANSWER SECTION:\n");
- for(i=0; i<ancount; i++) {
- w += sldns_wire2str_rr_scan(d, dlen, s, slen, pkt, pktlen);
- if(!*dlen) break;
- }
- w += sldns_str_print(s, slen, "\n");
- w += sldns_str_print(s, slen, ";; AUTHORITY SECTION:\n");
- for(i=0; i<nscount; i++) {
- w += sldns_wire2str_rr_scan(d, dlen, s, slen, pkt, pktlen);
- if(!*dlen) break;
- }
- w += sldns_str_print(s, slen, "\n");
- w += sldns_str_print(s, slen, ";; ADDITIONAL SECTION:\n");
- for(i=0; i<arcount; i++) {
- w += sldns_wire2str_rr_scan(d, dlen, s, slen, pkt, pktlen);
- if(!*dlen) break;
- }
- /* other fields: WHEN(time), SERVER(IP) not available here. */
- w += sldns_str_print(s, slen, ";; MSG SIZE rcvd: %d\n", (int)pktlen);
- if(*dlen > 0) {
- w += print_remainder_hex(";; trailing garbage 0x",
- d, dlen, s, slen);
- w += sldns_str_print(s, slen, "\n");
- }
- return w;
-}
-
-/** scan type, class and ttl and printout, for rr */
-static int sldns_rr_tcttl_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- int w = 0;
- uint16_t t, c;
- uint32_t ttl;
- if(*dl < 8) {
- if(*dl < 4)
- return w + print_remainder_hex("; Error malformed 0x",
- d, dl, s, sl);
- /* these print values or 0x.. if none left */
- t = sldns_read_uint16(*d);
- c = sldns_read_uint16((*d)+2);
- (*d)+=4;
- (*dl)-=4;
- w += sldns_wire2str_class_print(s, sl, c);
- w += sldns_str_print(s, sl, "\t");
- w += sldns_wire2str_type_print(s, sl, t);
- if(*dl == 0)
- return w + sldns_str_print(s, sl, "; Error no ttl");
- return w + print_remainder_hex(
- "; Error malformed ttl 0x", d, dl, s, sl);
- }
- t = sldns_read_uint16(*d);
- c = sldns_read_uint16((*d)+2);
- ttl = sldns_read_uint32((*d)+4);
- (*d)+=8;
- (*dl)-=8;
- w += sldns_str_print(s, sl, "%lu\t", (unsigned long)ttl);
- w += sldns_wire2str_class_print(s, sl, c);
- w += sldns_str_print(s, sl, "\t");
- w += sldns_wire2str_type_print(s, sl, t);
- return w;
-}
-
-int sldns_wire2str_rr_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen,
- uint8_t* pkt, size_t pktlen)
-{
- int w = 0;
- uint8_t* rr = *d;
- size_t rrlen = *dlen, dname_off, rdlen, ordlen;
- uint16_t rrtype = 0;
-
- if(*dlen >= 3 && (*d)[0]==0 &&
- sldns_read_uint16((*d)+1)==LDNS_RR_TYPE_OPT) {
- /* perform EDNS OPT processing */
- return sldns_wire2str_edns_scan(d, dlen, s, slen, pkt, pktlen);
- }
-
- /* try to scan the rdata with pretty-printing, but if that fails, then
- * scan the rdata as an unknown RR type */
- w += sldns_wire2str_dname_scan(d, dlen, s, slen, pkt, pktlen);
- w += sldns_str_print(s, slen, "\t");
- dname_off = rrlen-(*dlen);
- if(*dlen == 4) {
- /* like a question-RR */
- uint16_t t = sldns_read_uint16(*d);
- uint16_t c = sldns_read_uint16((*d)+2);
- (*d)+=4;
- (*dlen)-=4;
- w += sldns_wire2str_class_print(s, slen, c);
- w += sldns_str_print(s, slen, "\t");
- w += sldns_wire2str_type_print(s, slen, t);
- w += sldns_str_print(s, slen, " ; Error no ttl,rdata\n");
- return w;
- }
- if(*dlen < 8) {
- if(*dlen == 0)
- return w + sldns_str_print(s, slen, ";Error missing RR\n");
- w += print_remainder_hex(";Error partial RR 0x", d, dlen, s, slen);
- return w + sldns_str_print(s, slen, "\n");
- }
- rrtype = sldns_read_uint16(*d);
- w += sldns_rr_tcttl_scan(d, dlen, s, slen);
- w += sldns_str_print(s, slen, "\t");
-
- /* rdata */
- if(*dlen < 2) {
- if(*dlen == 0)
- return w + sldns_str_print(s, slen, ";Error missing rdatalen\n");
- w += print_remainder_hex(";Error missing rdatalen 0x",
- d, dlen, s, slen);
- return w + sldns_str_print(s, slen, "\n");
- }
- rdlen = sldns_read_uint16(*d);
- ordlen = rdlen;
- (*d)+=2;
- (*dlen)-=2;
- if(*dlen < rdlen) {
- w += sldns_str_print(s, slen, "\\# %u ", (unsigned)rdlen);
- if(*dlen == 0)
- return w + sldns_str_print(s, slen, ";Error missing rdata\n");
- w += print_remainder_hex(";Error partial rdata 0x", d, dlen, s, slen);
- return w + sldns_str_print(s, slen, "\n");
- }
- w += sldns_wire2str_rdata_scan(d, &rdlen, s, slen, rrtype, pkt, pktlen);
- (*dlen) -= (ordlen-rdlen);
-
- /* default comment */
- w += sldns_wire2str_rr_comment_print(s, slen, rr, rrlen, dname_off,
- rrtype);
- w += sldns_str_print(s, slen, "\n");
- return w;
-}
-
-int sldns_wire2str_rrquestion_scan(uint8_t** d, size_t* dlen, char** s,
- size_t* slen, uint8_t* pkt, size_t pktlen)
-{
- int w = 0;
- uint16_t t, c;
- w += sldns_wire2str_dname_scan(d, dlen, s, slen, pkt, pktlen);
- w += sldns_str_print(s, slen, "\t");
- if(*dlen < 4) {
- if(*dlen == 0)
- return w + sldns_str_print(s, slen, "Error malformed\n");
- w += print_remainder_hex("Error malformed 0x", d, dlen, s, slen);
- return w + sldns_str_print(s, slen, "\n");
- }
- t = sldns_read_uint16(*d);
- c = sldns_read_uint16((*d)+2);
- (*d)+=4;
- (*dlen)-=4;
- w += sldns_wire2str_class_print(s, slen, c);
- w += sldns_str_print(s, slen, "\t");
- w += sldns_wire2str_type_print(s, slen, t);
- w += sldns_str_print(s, slen, "\n");
- return w;
-}
-
-int sldns_wire2str_rr_unknown_scan(uint8_t** d, size_t* dlen, char** s,
- size_t* slen, uint8_t* pkt, size_t pktlen)
-{
- size_t rdlen, ordlen;
- int w = 0;
- w += sldns_wire2str_dname_scan(d, dlen, s, slen, pkt, pktlen);
- w += sldns_str_print(s, slen, "\t");
- w += sldns_rr_tcttl_scan(d, dlen, s, slen);
- w += sldns_str_print(s, slen, "\t");
- if(*dlen < 2) {
- if(*dlen == 0)
- return w + sldns_str_print(s, slen, ";Error missing rdatalen\n");
- w += print_remainder_hex(";Error missing rdatalen 0x",
- d, dlen, s, slen);
- return w + sldns_str_print(s, slen, "\n");
- }
- rdlen = sldns_read_uint16(*d);
- ordlen = rdlen;
- (*d) += 2;
- (*dlen) -= 2;
- if(*dlen < rdlen) {
- w += sldns_str_print(s, slen, "\\# %u ", (unsigned)rdlen);
- if(*dlen == 0)
- return w + sldns_str_print(s, slen, ";Error missing rdata\n");
- w += print_remainder_hex(";Error partial rdata 0x", d, dlen, s, slen);
- return w + sldns_str_print(s, slen, "\n");
- }
- w += sldns_wire2str_rdata_unknown_scan(d, &rdlen, s, slen);
- (*dlen) -= (ordlen-rdlen);
- w += sldns_str_print(s, slen, "\n");
- return w;
-}
-
-/** print rr comment for type DNSKEY */
-static int rr_comment_dnskey(char** s, size_t* slen, uint8_t* rr,
- size_t rrlen, size_t dname_off)
-{
- size_t rdlen;
- uint8_t* rdata;
- int flags, w = 0;
- if(rrlen < dname_off + 10) return 0;
- rdlen = sldns_read_uint16(rr+dname_off+8);
- if(rrlen < dname_off + 10 + rdlen) return 0;
- rdata = rr + dname_off + 10;
- flags = (int)sldns_read_uint16(rdata);
- w += sldns_str_print(s, slen, " ;{");
-
- /* id */
- w += sldns_str_print(s, slen, "id = %u",
- sldns_calc_keytag_raw(rdata, rdlen));
-
- /* flags */
- if((flags&LDNS_KEY_ZONE_KEY)) {
- if((flags&LDNS_KEY_SEP_KEY))
- w += sldns_str_print(s, slen, " (ksk)");
- else w += sldns_str_print(s, slen, " (zsk)");
- }
-
- /* keysize */
- if(rdlen > 4) {
- w += sldns_str_print(s, slen, ", ");
- w += sldns_str_print(s, slen, "size = %db",
- (int)sldns_rr_dnskey_key_size_raw(
- (unsigned char*)rdata+4, rdlen-4, (int)(rdata[3])));
- }
-
- w += sldns_str_print(s, slen, "}");
- return w;
-}
-
-/** print rr comment for type RRSIG */
-static int rr_comment_rrsig(char** s, size_t* slen, uint8_t* rr,
- size_t rrlen, size_t dname_off)
-{
- size_t rdlen;
- uint8_t* rdata;
- if(rrlen < dname_off + 10) return 0;
- rdlen = sldns_read_uint16(rr+dname_off+8);
- if(rrlen < dname_off + 10 + rdlen) return 0;
- rdata = rr + dname_off + 10;
- if(rdlen < 18) return 0;
- return sldns_str_print(s, slen, " ;{id = %d}",
- (int)sldns_read_uint16(rdata+16));
-}
-
-/** print rr comment for type NSEC3 */
-static int rr_comment_nsec3(char** s, size_t* slen, uint8_t* rr,
- size_t rrlen, size_t dname_off)
-{
- size_t rdlen;
- uint8_t* rdata;
- int w = 0;
- if(rrlen < dname_off + 10) return 0;
- rdlen = sldns_read_uint16(rr+dname_off+8);
- if(rrlen < dname_off + 10 + rdlen) return 0;
- rdata = rr + dname_off + 10;
- if(rdlen < 2) return 0;
- if((rdata[1] & LDNS_NSEC3_VARS_OPTOUT_MASK))
- w += sldns_str_print(s, slen, " ;{flags: optout}");
- return w;
-}
-
-int sldns_wire2str_rr_comment_print(char** s, size_t* slen, uint8_t* rr,
- size_t rrlen, size_t dname_off, uint16_t rrtype)
-{
- if(rrtype == LDNS_RR_TYPE_DNSKEY) {
- return rr_comment_dnskey(s, slen, rr, rrlen, dname_off);
- } else if(rrtype == LDNS_RR_TYPE_RRSIG) {
- return rr_comment_rrsig(s, slen, rr, rrlen, dname_off);
- } else if(rrtype == LDNS_RR_TYPE_NSEC3) {
- return rr_comment_nsec3(s, slen, rr, rrlen, dname_off);
- }
- return 0;
-}
-
-int sldns_wire2str_header_scan(uint8_t** d, size_t* dlen, char** s,
- size_t* slen)
-{
- int w = 0;
- int opcode, rcode;
- w += sldns_str_print(s, slen, ";; ->>HEADER<<- ");
- if(*dlen == 0)
- return w+sldns_str_print(s, slen, "Error empty packet");
- if(*dlen < 4)
- return w+print_remainder_hex("Error header too short 0x", d, dlen, s, slen);
- opcode = (int)LDNS_OPCODE_WIRE(*d);
- rcode = (int)LDNS_RCODE_WIRE(*d);
- w += sldns_str_print(s, slen, "opcode: ");
- w += sldns_wire2str_opcode_print(s, slen, opcode);
- w += sldns_str_print(s, slen, ", ");
- w += sldns_str_print(s, slen, "rcode: ");
- w += sldns_wire2str_rcode_print(s, slen, rcode);
- w += sldns_str_print(s, slen, ", ");
- w += sldns_str_print(s, slen, "id: %d\n", (int)LDNS_ID_WIRE(*d));
- w += sldns_str_print(s, slen, ";; flags:");
- if(LDNS_QR_WIRE(*d)) w += sldns_str_print(s, slen, " qr");
- if(LDNS_AA_WIRE(*d)) w += sldns_str_print(s, slen, " aa");
- if(LDNS_TC_WIRE(*d)) w += sldns_str_print(s, slen, " tc");
- if(LDNS_RD_WIRE(*d)) w += sldns_str_print(s, slen, " rd");
- if(LDNS_CD_WIRE(*d)) w += sldns_str_print(s, slen, " cd");
- if(LDNS_RA_WIRE(*d)) w += sldns_str_print(s, slen, " ra");
- if(LDNS_AD_WIRE(*d)) w += sldns_str_print(s, slen, " ad");
- if(LDNS_Z_WIRE(*d)) w += sldns_str_print(s, slen, " z");
- w += sldns_str_print(s, slen, " ; ");
- if(*dlen < LDNS_HEADER_SIZE)
- return w+print_remainder_hex("Error header too short 0x", d, dlen, s, slen);
- w += sldns_str_print(s, slen, "QUERY: %d, ", (int)LDNS_QDCOUNT(*d));
- w += sldns_str_print(s, slen, "ANSWER: %d, ", (int)LDNS_ANCOUNT(*d));
- w += sldns_str_print(s, slen, "AUTHORITY: %d, ", (int)LDNS_NSCOUNT(*d));
- w += sldns_str_print(s, slen, "ADDITIONAL: %d ", (int)LDNS_ARCOUNT(*d));
- *d += LDNS_HEADER_SIZE;
- *dlen -= LDNS_HEADER_SIZE;
- return w;
-}
-
-int sldns_wire2str_rdata_scan(uint8_t** d, size_t* dlen, char** s,
- size_t* slen, uint16_t rrtype, uint8_t* pkt, size_t pktlen)
-{
- /* try to prettyprint, but if that fails, use unknown format */
- uint8_t* origd = *d;
- char* origs = *s;
- size_t origdlen = *dlen, origslen = *slen;
- uint16_t r_cnt, r_max;
- sldns_rdf_type rdftype;
- int w = 0, n;
-
- const sldns_rr_descriptor *desc = sldns_rr_descript(rrtype);
- if(!desc) /* unknown format */
- return sldns_wire2str_rdata_unknown_scan(d, dlen, s, slen);
- /* dlen equals the rdatalen for the rdata */
-
- r_max = sldns_rr_descriptor_maximum(desc);
- for(r_cnt=0; r_cnt < r_max; r_cnt++) {
- if(*dlen == 0) {
- if(r_cnt < sldns_rr_descriptor_minimum(desc))
- goto failed;
- break; /* nothing more to print */
- }
- rdftype = sldns_rr_descriptor_field_type(desc, r_cnt);
- if(r_cnt != 0)
- w += sldns_str_print(s, slen, " ");
- n = sldns_wire2str_rdf_scan(d, dlen, s, slen, rdftype,
- pkt, pktlen);
- if(n == -1) {
- failed:
- /* failed, use unknown format */
- *d = origd; *s = origs;
- *dlen = origdlen; *slen = origslen;
- return sldns_wire2str_rdata_unknown_scan(d, dlen,
- s, slen);
- }
- w += n;
- }
- return w;
-}
-
-int sldns_wire2str_rdata_unknown_scan(uint8_t** d, size_t* dlen, char** s,
- size_t* slen)
-{
- int w = 0;
-
- /* print length */
- w += sldns_str_print(s, slen, "\\# %u", (unsigned)*dlen);
-
- /* print rdlen in hex */
- if(*dlen != 0)
- w += sldns_str_print(s, slen, " ");
- w += print_hex_buf(s, slen, *d, *dlen);
- (*d) += *dlen;
- (*dlen) = 0;
- return w;
-}
-
-/** print and escape one character for a domain dname */
-static int dname_char_print(char** s, size_t* slen, uint8_t c)
-{
- if(c == '.' || c == ';' || c == '(' || c == ')' || c == '\\')
- return sldns_str_print(s, slen, "\\%c", c);
- else if(!(isascii((unsigned char)c) && isgraph((unsigned char)c)))
- return sldns_str_print(s, slen, "\\%03u", (unsigned)c);
- /* plain printout */
- if(*slen) {
- **s = (char)c;
- (*s)++;
- (*slen)--;
- }
- return 1;
-}
-
-int sldns_wire2str_dname_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen,
- uint8_t* pkt, size_t pktlen)
-{
- int w = 0;
- /* spool labels onto the string, use compression if its there */
- uint8_t* pos = *d;
- unsigned i, counter=0;
- const unsigned maxcompr = 1000; /* loop detection, max compr ptrs */
- int in_buf = 1;
- if(*dlen == 0) return sldns_str_print(s, slen, "ErrorMissingDname");
- if(*pos == 0) {
- (*d)++;
- (*dlen)--;
- return sldns_str_print(s, slen, ".");
- }
- while(*pos) {
- /* read label length */
- uint8_t labellen = *pos++;
- if(in_buf) { (*d)++; (*dlen)--; }
-
- /* find out what sort of label we have */
- if((labellen&0xc0) == 0xc0) {
- /* compressed */
- uint16_t target = 0;
- if(in_buf && *dlen == 0)
- return w + sldns_str_print(s, slen,
- "ErrorPartialDname");
- else if(!in_buf && pos+1 > pkt+pktlen)
- return w + sldns_str_print(s, slen,
- "ErrorPartialDname");
- target = ((labellen&0x3f)<<8) | *pos;
- if(in_buf) { (*d)++; (*dlen)--; }
- /* move to target, if possible */
- if(!pkt || target >= pktlen)
- return w + sldns_str_print(s, slen,
- "ErrorComprPtrOutOfBounds");
- if(counter++ > maxcompr)
- return w + sldns_str_print(s, slen,
- "ErrorComprPtrLooped");
- in_buf = 0;
- pos = pkt+target;
- continue;
- } else if((labellen&0xc0)) {
- /* notimpl label type */
- w += sldns_str_print(s, slen,
- "ErrorLABELTYPE%xIsUnknown",
- (int)(labellen&0xc0));
- return w;
- }
-
- /* spool label characters, end with '.' */
- if(in_buf && *dlen < labellen) labellen = *dlen;
- else if(!in_buf && pos+labellen > pkt+pktlen)
- labellen = (uint8_t)(pkt + pktlen - pos);
- for(i=0; i<(unsigned)labellen; i++) {
- w += dname_char_print(s, slen, *pos++);
- }
- if(in_buf) {
- (*d) += labellen;
- (*dlen) -= labellen;
- if(*dlen == 0) break;
- }
- w += sldns_str_print(s, slen, ".");
- }
- /* skip over final root label */
- if(in_buf && *dlen > 0) { (*d)++; (*dlen)--; }
- /* in case we printed no labels, terminate dname */
- if(w == 0) w += sldns_str_print(s, slen, ".");
- return w;
-}
-
-int sldns_wire2str_opcode_print(char** s, size_t* slen, int opcode)
-{
- sldns_lookup_table *lt = sldns_lookup_by_id(sldns_opcodes, opcode);
- if (lt && lt->name) {
- return sldns_str_print(s, slen, "%s", lt->name);
- }
- return sldns_str_print(s, slen, "OPCODE%u", (unsigned)opcode);
-}
-
-int sldns_wire2str_rcode_print(char** s, size_t* slen, int rcode)
-{
- sldns_lookup_table *lt = sldns_lookup_by_id(sldns_rcodes, rcode);
- if (lt && lt->name) {
- return sldns_str_print(s, slen, "%s", lt->name);
- }
- return sldns_str_print(s, slen, "RCODE%u", (unsigned)rcode);
-}
-
-int sldns_wire2str_class_print(char** s, size_t* slen, uint16_t rrclass)
-{
- sldns_lookup_table *lt = sldns_lookup_by_id(sldns_rr_classes,
- (int)rrclass);
- if (lt && lt->name) {
- return sldns_str_print(s, slen, "%s", lt->name);
- }
- return sldns_str_print(s, slen, "CLASS%u", (unsigned)rrclass);
-}
-
-int sldns_wire2str_type_print(char** s, size_t* slen, uint16_t rrtype)
-{
- const sldns_rr_descriptor *descriptor = sldns_rr_descript(rrtype);
- if (descriptor && descriptor->_name) {
- return sldns_str_print(s, slen, "%s", descriptor->_name);
- }
- return sldns_str_print(s, slen, "TYPE%u", (unsigned)rrtype);
-}
-
-int sldns_wire2str_edns_option_code_print(char** s, size_t* slen,
- uint16_t opcode)
-{
- sldns_lookup_table *lt = sldns_lookup_by_id(sldns_edns_options,
- (int)opcode);
- if (lt && lt->name) {
- return sldns_str_print(s, slen, "%s", lt->name);
- }
- return sldns_str_print(s, slen, "OPT%u", (unsigned)opcode);
-}
-
-int sldns_wire2str_class_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen)
-{
- uint16_t c;
- if(*dlen == 0) return 0;
- if(*dlen < 2) return print_remainder_hex("Error malformed 0x", d, dlen, s, slen);
- c = sldns_read_uint16(*d);
- (*d)+=2;
- (*dlen)-=2;
- return sldns_wire2str_class_print(s, slen, c);
-}
-
-int sldns_wire2str_type_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen)
-{
- uint16_t t;
- if(*dlen == 0) return 0;
- if(*dlen < 2) return print_remainder_hex("Error malformed 0x", d, dlen, s, slen);
- t = sldns_read_uint16(*d);
- (*d)+=2;
- (*dlen)-=2;
- return sldns_wire2str_type_print(s, slen, t);
-}
-
-int sldns_wire2str_ttl_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen)
-{
- uint32_t ttl;
- if(*dlen == 0) return 0;
- if(*dlen < 4) return print_remainder_hex("Error malformed 0x", d, dlen, s, slen);
- ttl = sldns_read_uint32(*d);
- (*d)+=4;
- (*dlen)-=4;
- return sldns_str_print(s, slen, "%u", (unsigned)ttl);
-}
-
-int sldns_wire2str_rdf_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen,
- int rdftype, uint8_t* pkt, size_t pktlen)
-{
- if(*dlen == 0) return 0;
- switch(rdftype) {
- case LDNS_RDF_TYPE_NONE:
- return 0;
- case LDNS_RDF_TYPE_DNAME:
- return sldns_wire2str_dname_scan(d, dlen, s, slen, pkt, pktlen);
- case LDNS_RDF_TYPE_INT8:
- return sldns_wire2str_int8_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_INT16:
- return sldns_wire2str_int16_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_INT32:
- return sldns_wire2str_int32_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_PERIOD:
- return sldns_wire2str_period_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_TSIGTIME:
- return sldns_wire2str_tsigtime_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_A:
- return sldns_wire2str_a_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_AAAA:
- return sldns_wire2str_aaaa_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_STR:
- return sldns_wire2str_str_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_APL:
- return sldns_wire2str_apl_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_B32_EXT:
- return sldns_wire2str_b32_ext_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_B64:
- return sldns_wire2str_b64_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_HEX:
- return sldns_wire2str_hex_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_NSEC:
- return sldns_wire2str_nsec_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_NSEC3_SALT:
- return sldns_wire2str_nsec3_salt_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_TYPE:
- return sldns_wire2str_type_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_CLASS:
- return sldns_wire2str_class_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_CERT_ALG:
- return sldns_wire2str_cert_alg_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_ALG:
- return sldns_wire2str_alg_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_UNKNOWN:
- return sldns_wire2str_unknown_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_TIME:
- return sldns_wire2str_time_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_LOC:
- return sldns_wire2str_loc_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_WKS:
- case LDNS_RDF_TYPE_SERVICE:
- return sldns_wire2str_wks_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_NSAP:
- return sldns_wire2str_nsap_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_ATMA:
- return sldns_wire2str_atma_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_IPSECKEY:
- return sldns_wire2str_ipseckey_scan(d, dlen, s, slen, pkt,
- pktlen);
- case LDNS_RDF_TYPE_HIP:
- return sldns_wire2str_hip_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_INT16_DATA:
- return sldns_wire2str_int16_data_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER:
- return sldns_wire2str_b32_ext_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_ILNP64:
- return sldns_wire2str_ilnp64_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_EUI48:
- return sldns_wire2str_eui48_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_EUI64:
- return sldns_wire2str_eui64_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_TAG:
- return sldns_wire2str_tag_scan(d, dlen, s, slen);
- case LDNS_RDF_TYPE_LONG_STR:
- return sldns_wire2str_long_str_scan(d, dlen, s, slen);
- }
- /* unknown rdf type */
- return -1;
-}
-
-int sldns_wire2str_int8_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- int w;
- if(*dl < 1) return -1;
- w = sldns_str_print(s, sl, "%u", (unsigned)**d);
- (*d)++;
- (*dl)--;
- return w;
-}
-
-int sldns_wire2str_int16_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- int w;
- if(*dl < 2) return -1;
- w = sldns_str_print(s, sl, "%lu", (unsigned long)sldns_read_uint16(*d));
- (*d)+=2;
- (*dl)-=2;
- return w;
-}
-
-int sldns_wire2str_int32_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- int w;
- if(*dl < 4) return -1;
- w = sldns_str_print(s, sl, "%lu", (unsigned long)sldns_read_uint32(*d));
- (*d)+=4;
- (*dl)-=4;
- return w;
-}
-
-int sldns_wire2str_period_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- int w;
- if(*dl < 4) return -1;
- w = sldns_str_print(s, sl, "%u", (unsigned)sldns_read_uint32(*d));
- (*d)+=4;
- (*dl)-=4;
- return w;
-}
-
-int sldns_wire2str_tsigtime_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- /* tsigtime is 48 bits network order unsigned integer */
- int w;
- uint64_t tsigtime = 0;
- uint64_t d0, d1, d2, d3, d4, d5;
- if(*dl < 6) return -1;
- d0 = (*d)[0]; /* cast to uint64 for shift operations */
- d1 = (*d)[1];
- d2 = (*d)[2];
- d3 = (*d)[3];
- d4 = (*d)[4];
- d5 = (*d)[5];
- tsigtime = (d0<<40) | (d1<<32) | (d2<<24) | (d3<<16) | (d4<<8) | d5;
-#ifndef USE_WINSOCK
- w = sldns_str_print(s, sl, "%llu", (long long)tsigtime);
-#else
- w = sldns_str_print(s, sl, "%I64u", (long long)tsigtime);
-#endif
- (*d)+=6;
- (*dl)-=6;
- return w;
-}
-
-int sldns_wire2str_a_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- char buf[32];
- int w;
- if(*dl < 4) return -1;
- if(!inet_ntop(AF_INET, *d, buf, (socklen_t)sizeof(buf)))
- return -1;
- w = sldns_str_print(s, sl, "%s", buf);
- (*d)+=4;
- (*dl)-=4;
- return w;
-}
-
-int sldns_wire2str_aaaa_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
-#ifdef AF_INET6
- char buf[64];
- int w;
- if(*dl < 16) return -1;
- if(!inet_ntop(AF_INET6, *d, buf, (socklen_t)sizeof(buf)))
- return -1;
- w = sldns_str_print(s, sl, "%s", buf);
- (*d)+=16;
- (*dl)-=16;
- return w;
-#else
- return -1;
-#endif
-}
-
-/** printout escaped TYPE_STR character */
-static int str_char_print(char** s, size_t* sl, uint8_t c)
-{
- if(isprint((unsigned char)c) || c == '\t') {
- if(c == '\"' || c == '\\')
- return sldns_str_print(s, sl, "\\%c", c);
- if(*sl) {
- **s = (char)c;
- (*s)++;
- (*sl)--;
- }
- return 1;
- }
- return sldns_str_print(s, sl, "\\%03u", (unsigned)c);
-}
-
-int sldns_wire2str_str_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- int w = 0;
- size_t i, len;
- if(*dl < 1) return -1;
- len = **d;
- if(*dl < 1+len) return -1;
- (*d)++;
- (*dl)--;
- w += sldns_str_print(s, sl, "\"");
- for(i=0; i<len; i++)
- w += str_char_print(s, sl, (*d)[i]);
- w += sldns_str_print(s, sl, "\"");
- (*d)+=len;
- (*dl)-=len;
- return w;
-}
-
-int sldns_wire2str_apl_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- int i, w = 0;
- uint16_t family;
- uint8_t negation, prefix, adflength;
- if(*dl < 4) return -1;
- family = sldns_read_uint16(*d);
- prefix = (*d)[2];
- negation = ((*d)[3] & LDNS_APL_NEGATION);
- adflength = ((*d)[3] & LDNS_APL_MASK);
- if(*dl < 4+(size_t)adflength) return -1;
- if(family != LDNS_APL_IP4 && family != LDNS_APL_IP6)
- return -1; /* unknown address family */
- if(negation)
- w += sldns_str_print(s, sl, "!");
- w += sldns_str_print(s, sl, "%u:", (unsigned)family);
- if(family == LDNS_APL_IP4) {
- /* check if prefix <32 ? */
- /* address is variable length 0 - 4 */
- for(i=0; i<4; i++) {
- if(i > 0)
- w += sldns_str_print(s, sl, ".");
- if(i < (int)adflength)
- w += sldns_str_print(s, sl, "%d", (*d)[4+i]);
- else w += sldns_str_print(s, sl, "0");
- }
- } else if(family == LDNS_APL_IP6) {
- /* check if prefix <128 ? */
- /* address is variable length 0 - 16 */
- for(i=0; i<16; i++) {
- if(i%2 == 0 && i>0)
- w += sldns_str_print(s, sl, ":");
- if(i < (int)adflength)
- w += sldns_str_print(s, sl, "%02x", (*d)[4+i]);
- else w += sldns_str_print(s, sl, "00");
- }
- }
- w += sldns_str_print(s, sl, "/%u", (unsigned)prefix);
- (*d) += 4+adflength;
- (*dl) -= 4+adflength;
- return w;
-}
-
-int sldns_wire2str_b32_ext_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- size_t datalen;
- size_t sz;
- if(*dl < 1) return -1;
- datalen = (*d)[0];
- if(*dl < 1+datalen) return -1;
- sz = sldns_b32_ntop_calculate_size(datalen);
- if(*sl < sz+1) {
- (*d) += datalen+1;
- (*dl) -= (datalen+1);
- return (int)sz; /* out of space really, but would need buffer
- in order to truncate the output */
- }
- sldns_b32_ntop_extended_hex((*d)+1, datalen, *s, *sl);
- (*d) += datalen+1;
- (*dl) -= (datalen+1);
- (*s) += sz;
- (*sl) -= sz;
- return (int)sz;
-}
-
-/** scan number of bytes from wire into b64 presentation format */
-static int sldns_wire2str_b64_scan_num(uint8_t** d, size_t* dl, char** s,
- size_t* sl, size_t num)
-{
- /* b64_ntop_calculate size includes null at the end */
- size_t sz = sldns_b64_ntop_calculate_size(num)-1;
- if(*sl < sz+1) {
- (*d) += num;
- (*dl) -= num;
- return (int)sz; /* out of space really, but would need buffer
- in order to truncate the output */
- }
- sldns_b64_ntop(*d, num, *s, *sl);
- (*d) += num;
- (*dl) -= num;
- (*s) += sz;
- (*sl) -= sz;
- return (int)sz;
-}
-
-int sldns_wire2str_b64_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- return sldns_wire2str_b64_scan_num(d, dl, s, sl, *dl);
-}
-
-int sldns_wire2str_hex_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- return print_remainder_hex("", d, dl, s, sl);
-}
-
-int sldns_wire2str_nsec_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- uint8_t* p = *d;
- size_t pl = *dl;
- unsigned i, bit, window, block_len;
- uint16_t t;
- int w = 0;
-
- /* check for errors */
- while(pl) {
- if(pl < 2) return -1;
- block_len = (unsigned)p[1];
- if(pl < 2+block_len) return -1;
- p += block_len+2;
- pl -= block_len+2;
- }
-
- /* do it */
- p = *d;
- pl = *dl;
- while(pl) {
- if(pl < 2) return -1; /* cannot happen */
- window = (unsigned)p[0];
- block_len = (unsigned)p[1];
- if(pl < 2+block_len) return -1; /* cannot happen */
- p += 2;
- for(i=0; i<block_len; i++) {
- if(p[i] == 0) continue;
- /* base type number for this octet */
- t = ((window)<<8) | (i << 3);
- for(bit=0; bit<8; bit++) {
- if((p[i]&(0x80>>bit))) {
- if(w) w += sldns_str_print(s, sl, " ");
- w += sldns_wire2str_type_print(s, sl,
- t+bit);
- }
- }
- }
- p += block_len;
- pl -= block_len+2;
- }
- (*d) += *dl;
- (*dl) = 0;
- return w;
-}
-
-int sldns_wire2str_nsec3_salt_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- size_t salt_len;
- int w;
- if(*dl < 1) return -1;
- salt_len = (size_t)(*d)[0];
- if(*dl < 1+salt_len) return -1;
- (*d)++;
- (*dl)--;
- if(salt_len == 0) {
- return sldns_str_print(s, sl, "-");
- }
- w = print_hex_buf(s, sl, *d, salt_len);
- (*dl)-=salt_len;
- (*d)+=salt_len;
- return w;
-}
-
-int sldns_wire2str_cert_alg_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- sldns_lookup_table *lt;
- int data, w;
- if(*dl < 2) return -1;
- data = (int)sldns_read_uint16(*d);
- lt = sldns_lookup_by_id(sldns_cert_algorithms, data);
- if(lt && lt->name)
- w = sldns_str_print(s, sl, "%s", lt->name);
- else w = sldns_str_print(s, sl, "%d", data);
- (*dl)-=2;
- (*d)+=2;
- return w;
-}
-
-int sldns_wire2str_alg_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- /* don't use algorithm mnemonics in the presentation format
- * this kind of got sneaked into the rfc's */
- return sldns_wire2str_int8_scan(d, dl, s, sl);
-}
-
-int sldns_wire2str_unknown_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- return sldns_wire2str_rdata_unknown_scan(d, dl, s, sl);
-}
-
-int sldns_wire2str_time_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- /* create a YYYYMMDDHHMMSS string if possible */
- struct tm tm;
- char date_buf[16];
- uint32_t t;
- memset(&tm, 0, sizeof(tm));
- if(*dl < 4) return -1;
- t = sldns_read_uint32(*d);
- date_buf[15]=0;
- if(sldns_serial_arithmitics_gmtime_r(t, time(NULL), &tm) &&
- strftime(date_buf, 15, "%Y%m%d%H%M%S", &tm)) {
- (*d) += 4;
- (*dl) -= 4;
- return sldns_str_print(s, sl, "%s", date_buf);
- }
- return -1;
-}
-
-static int
-loc_cm_print(char** str, size_t* sl, uint8_t mantissa, uint8_t exponent)
-{
- int w = 0;
- uint8_t i;
- /* is it 0.<two digits> ? */
- if(exponent < 2) {
- if(exponent == 1)
- mantissa *= 10;
- return sldns_str_print(str, sl, "0.%02ld", (long)mantissa);
- }
- /* always <digit><string of zeros> */
- w += sldns_str_print(str, sl, "%d", (int)mantissa);
- for(i=0; i<exponent-2; i++)
- w += sldns_str_print(str, sl, "0");
- return w;
-}
-
-int sldns_wire2str_loc_scan(uint8_t** d, size_t* dl, char** str, size_t* sl)
-{
- /* we could do checking (ie degrees < 90 etc)? */
- uint8_t version;
- uint8_t size;
- uint8_t horizontal_precision;
- uint8_t vertical_precision;
- uint32_t longitude;
- uint32_t latitude;
- uint32_t altitude;
- char northerness;
- char easterness;
- uint32_t h;
- uint32_t m;
- double s;
- uint32_t equator = (uint32_t)1 << 31; /* 2**31 */
- int w = 0;
-
- if(*dl < 16) return -1;
- version = (*d)[0];
- if(version != 0)
- return sldns_wire2str_hex_scan(d, dl, str, sl);
- size = (*d)[1];
- horizontal_precision = (*d)[2];
- vertical_precision = (*d)[3];
-
- latitude = sldns_read_uint32((*d)+4);
- longitude = sldns_read_uint32((*d)+8);
- altitude = sldns_read_uint32((*d)+12);
-
- if (latitude > equator) {
- northerness = 'N';
- latitude = latitude - equator;
- } else {
- northerness = 'S';
- latitude = equator - latitude;
- }
- h = latitude / (1000 * 60 * 60);
- latitude = latitude % (1000 * 60 * 60);
- m = latitude / (1000 * 60);
- latitude = latitude % (1000 * 60);
- s = (double) latitude / 1000.0;
- w += sldns_str_print(str, sl, "%02u %02u %06.3f %c ",
- h, m, s, northerness);
-
- if (longitude > equator) {
- easterness = 'E';
- longitude = longitude - equator;
- } else {
- easterness = 'W';
- longitude = equator - longitude;
- }
- h = longitude / (1000 * 60 * 60);
- longitude = longitude % (1000 * 60 * 60);
- m = longitude / (1000 * 60);
- longitude = longitude % (1000 * 60);
- s = (double) longitude / (1000.0);
- w += sldns_str_print(str, sl, "%02u %02u %06.3f %c ",
- h, m, s, easterness);
-
- s = ((double) altitude) / 100;
- s -= 100000;
-
- if(altitude%100 != 0)
- w += sldns_str_print(str, sl, "%.2f", s);
- else
- w += sldns_str_print(str, sl, "%.0f", s);
-
- w += sldns_str_print(str, sl, "m ");
-
- w += loc_cm_print(str, sl, (size & 0xf0) >> 4, size & 0x0f);
- w += sldns_str_print(str, sl, "m ");
-
- w += loc_cm_print(str, sl, (horizontal_precision & 0xf0) >> 4,
- horizontal_precision & 0x0f);
- w += sldns_str_print(str, sl, "m ");
-
- w += loc_cm_print(str, sl, (vertical_precision & 0xf0) >> 4,
- vertical_precision & 0x0f);
- w += sldns_str_print(str, sl, "m");
-
- (*d)+=16;
- (*dl)-=16;
- return w;
-}
-
-int sldns_wire2str_wks_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- /* protocol, followed by bitmap of services */
- const char* proto_name = NULL;
- struct protoent *protocol;
- struct servent *service;
- uint8_t protocol_nr;
- int bit, port, w = 0;
- size_t i;
- /* we cannot print with strings because they
- * are not portable, the presentation format may
- * not be able to be read in on another computer. */
- int print_symbols = 0;
-
- /* protocol */
- if(*dl < 1) return -1;
- protocol_nr = (*d)[0];
- (*d)++;
- (*dl)--;
- protocol = getprotobynumber((int)protocol_nr);
- if(protocol && (protocol->p_name != NULL)) {
- w += sldns_str_print(s, sl, "%s", protocol->p_name);
- proto_name = protocol->p_name;
- } else {
- w += sldns_str_print(s, sl, "%u", (unsigned)protocol_nr);
- }
-
- for(i=0; i<*dl; i++) {
- if((*d)[i] == 0)
- continue;
- for(bit=0; bit<8; bit++) {
- if(!(((*d)[i])&(0x80>>bit)))
- continue;
- port = (int)i*8 + bit;
-
- if(!print_symbols)
- service = NULL;
- else
- service = getservbyport(
- (int)htons((uint16_t)port), proto_name);
- if(service && service->s_name)
- w += sldns_str_print(s, sl, " %s",
- service->s_name);
- else w += sldns_str_print(s, sl, " %u",
- (unsigned)port);
- }
- }
-
-#ifdef HAVE_ENDSERVENT
- endservent();
-#endif
-#ifdef HAVE_ENDPROTOENT
- endprotoent();
-#endif
- (*d) += *dl;
- (*dl) = 0;
- return w;
-}
-
-int sldns_wire2str_nsap_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- return print_remainder_hex("0x", d, dl, s, sl);
-}
-
-int sldns_wire2str_atma_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- return print_remainder_hex("", d, dl, s, sl);
-}
-
-/* internal scan routine that can modify arguments on failure */
-static int sldns_wire2str_ipseckey_scan_internal(uint8_t** d, size_t* dl,
- char** s, size_t* sl, uint8_t* pkt, size_t pktlen)
-{
- /* http://www.ietf.org/internet-drafts/draft-ietf-ipseckey-rr-12.txt*/
- uint8_t precedence, gateway_type, algorithm;
- int w = 0;
-
- if(*dl < 3) return -1;
- precedence = (*d)[0];
- gateway_type = (*d)[1];
- algorithm = (*d)[2];
- if(gateway_type > 3)
- return -1; /* unknown */
- (*d)+=3;
- (*dl)-=3;
- w += sldns_str_print(s, sl, "%d %d %d ",
- (int)precedence, (int)gateway_type, (int)algorithm);
-
- switch(gateway_type) {
- case 0: /* no gateway */
- w += sldns_str_print(s, sl, ".");
- break;
- case 1: /* ip4 */
- w += sldns_wire2str_a_scan(d, dl, s, sl);
- break;
- case 2: /* ip6 */
- w += sldns_wire2str_aaaa_scan(d, dl, s, sl);
- break;
- case 3: /* dname */
- w += sldns_wire2str_dname_scan(d, dl, s, sl, pkt, pktlen);
- break;
- default: /* unknown */
- return -1;
- }
-
- if(*dl < 1)
- return -1;
- w += sldns_str_print(s, sl, " ");
- w += sldns_wire2str_b64_scan_num(d, dl, s, sl, *dl);
- return w;
-}
-
-int sldns_wire2str_ipseckey_scan(uint8_t** d, size_t* dl, char** s, size_t* sl,
- uint8_t* pkt, size_t pktlen)
-{
- uint8_t* od = *d;
- char* os = *s;
- size_t odl = *dl, osl = *sl;
- int w=sldns_wire2str_ipseckey_scan_internal(d, dl, s, sl, pkt, pktlen);
- if(w == -1) {
- *d = od;
- *s = os;
- *dl = odl;
- *sl = osl;
- return -1;
- }
- return w;
-}
-
-int sldns_wire2str_hip_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- int w;
- uint8_t algo, hitlen;
- uint16_t pklen;
-
- /* read lengths */
- if(*dl < 4)
- return -1;
- hitlen = (*d)[0];
- algo = (*d)[1];
- pklen = sldns_read_uint16((*d)+2);
- if(*dl < (size_t)4 + (size_t)hitlen + (size_t)pklen)
- return -1;
-
- /* write: algo hit pubkey */
- w = sldns_str_print(s, sl, "%u ", (unsigned)algo);
- w += print_hex_buf(s, sl, (*d)+4, hitlen);
- w += sldns_str_print(s, sl, " ");
- (*d)+=4+hitlen;
- (*dl)-= (4+hitlen);
- w += sldns_wire2str_b64_scan_num(d, dl, s, sl, pklen);
- return w;
-}
-
-int sldns_wire2str_int16_data_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- uint16_t n;
- if(*dl < 2)
- return -1;
- n = sldns_read_uint16(*d);
- if(*dl < 2+(size_t)n)
- return -1;
- (*d)+=2;
- (*dl)-=2;
- return sldns_wire2str_b64_scan_num(d, dl, s, sl, n);
-}
-
-int sldns_wire2str_nsec3_next_owner_scan(uint8_t** d, size_t* dl, char** s,
- size_t* sl)
-{
- return sldns_wire2str_b32_ext_scan(d, dl, s, sl);
-}
-
-int sldns_wire2str_ilnp64_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- int w;
- if(*dl < 8)
- return -1;
- w = sldns_str_print(s, sl, "%.4x:%.4x:%.4x:%.4x",
- sldns_read_uint16(*d), sldns_read_uint16((*d)+2),
- sldns_read_uint16((*d)+4), sldns_read_uint16((*d)+6));
- (*d)+=8;
- (*dl)-=8;
- return w;
-}
-
-int sldns_wire2str_eui48_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- int w;
- if(*dl < 6)
- return -1;
- w = sldns_str_print(s, sl, "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",
- (*d)[0], (*d)[1], (*d)[2], (*d)[3], (*d)[4], (*d)[5]);
- (*d)+=6;
- (*dl)-=6;
- return w;
-}
-
-int sldns_wire2str_eui64_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- int w;
- if(*dl < 8)
- return -1;
- w = sldns_str_print(s, sl, "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",
- (*d)[0], (*d)[1], (*d)[2], (*d)[3], (*d)[4], (*d)[5],
- (*d)[6], (*d)[7]);
- (*d)+=8;
- (*dl)-=8;
- return w;
-}
-
-int sldns_wire2str_tag_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- size_t i, n;
- int w = 0;
- if(*dl < 1)
- return -1;
- n = (size_t)((*d)[0]);
- if(*dl < 1+n)
- return -1;
- for(i=0; i<n; i++)
- if(!isalnum((unsigned char)(*d)[i]))
- return -1;
- for(i=0; i<n; i++)
- w += sldns_str_print(s, sl, "%c", (char)(*d)[i]);
- (*d)+=n+1;
- (*dl)-=(n+1);
- return w;
-}
-
-int sldns_wire2str_long_str_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
-{
- size_t i;
- int w = 0;
- w += sldns_str_print(s, sl, "\"");
- for(i=0; i<*dl; i++)
- w += str_char_print(s, sl, (*d)[i]);
- w += sldns_str_print(s, sl, "\"");
- (*d)+=*dl;
- (*dl)=0;
- return w;
-}
-
-int sldns_wire2str_edns_llq_print(char** s, size_t* sl, uint8_t* data,
- size_t len)
-{
- /* LLQ constants */
- const char* llq_errors[] = {"NO-ERROR", "SERV-FULL", "STATIC",
- "FORMAT-ERR", "NO-SUCH-LLQ", "BAD-VERS", "UNKNOWN_ERR"};
- const unsigned int llq_errors_num = 7;
- const char* llq_opcodes[] = {"LLQ-SETUP", "LLQ-REFRESH", "LLQ-EVENT"};
- const unsigned int llq_opcodes_num = 3;
- uint16_t version, llq_opcode, error_code;
- uint64_t llq_id;
- uint32_t lease_life; /* Requested or granted life of LLQ, in seconds */
- int w = 0;
-
- /* read the record */
- if(len != 18) {
- w += sldns_str_print(s, sl, "malformed LLQ ");
- w += print_hex_buf(s, sl, data, len);
- return w;
- }
- version = sldns_read_uint16(data);
- llq_opcode = sldns_read_uint16(data+2);
- error_code = sldns_read_uint16(data+4);
- memmove(&llq_id, data+6, sizeof(llq_id));
- lease_life = sldns_read_uint32(data+14);
-
- /* print it */
- w += sldns_str_print(s, sl, "v%d ", (int)version);
- if(llq_opcode < llq_opcodes_num)
- w += sldns_str_print(s, sl, "%s", llq_opcodes[llq_opcode]);
- else w += sldns_str_print(s, sl, "opcode %d", (int)llq_opcode);
- if(error_code < llq_errors_num)
- w += sldns_str_print(s, sl, " %s", llq_errors[error_code]);
- else w += sldns_str_print(s, sl, " error %d", (int)error_code);
-#ifndef USE_WINSOCK
- w += sldns_str_print(s, sl, " id %llx lease-life %lu",
- (unsigned long long)llq_id, (unsigned long)lease_life);
-#else
- w += sldns_str_print(s, sl, " id %I64x lease-life %lu",
- (unsigned long long)llq_id, (unsigned long)lease_life);
-#endif
- return w;
-}
-
-int sldns_wire2str_edns_ul_print(char** s, size_t* sl, uint8_t* data,
- size_t len)
-{
- uint32_t lease;
- int w = 0;
- if(len != 4) {
- w += sldns_str_print(s, sl, "malformed UL ");
- w += print_hex_buf(s, sl, data, len);
- return w;
- }
- lease = sldns_read_uint32(data);
- w += sldns_str_print(s, sl, "lease %lu", (unsigned long)lease);
- return w;
-}
-
-int sldns_wire2str_edns_nsid_print(char** s, size_t* sl, uint8_t* data,
- size_t len)
-{
- int w = 0;
- size_t i, printed=0;
- w += print_hex_buf(s, sl, data, len);
- for(i=0; i<len; i++) {
- if(isprint((unsigned char)data[i]) || data[i] == '\t') {
- if(!printed) {
- w += sldns_str_print(s, sl, " (");
- printed = 1;
- }
- w += sldns_str_print(s, sl, "%c", (char)data[i]);
- }
- }
- if(printed)
- w += sldns_str_print(s, sl, ")");
- return w;
-}
-
-int sldns_wire2str_edns_dau_print(char** s, size_t* sl, uint8_t* data,
- size_t len)
-{
- sldns_lookup_table *lt;
- size_t i;
- int w = 0;
- for(i=0; i<len; i++) {
- lt = sldns_lookup_by_id(sldns_algorithms, (int)data[i]);
- if(lt && lt->name)
- w += sldns_str_print(s, sl, " %s", lt->name);
- else w += sldns_str_print(s, sl, " %d", (int)data[i]);
- }
- return w;
-}
-
-int sldns_wire2str_edns_dhu_print(char** s, size_t* sl, uint8_t* data,
- size_t len)
-{
- sldns_lookup_table *lt;
- size_t i;
- int w = 0;
- for(i=0; i<len; i++) {
- lt = sldns_lookup_by_id(sldns_hashes, (int)data[i]);
- if(lt && lt->name)
- w += sldns_str_print(s, sl, " %s", lt->name);
- else w += sldns_str_print(s, sl, " %d", (int)data[i]);
- }
- return w;
-}
-
-int sldns_wire2str_edns_n3u_print(char** s, size_t* sl, uint8_t* data,
- size_t len)
-{
- size_t i;
- int w = 0;
- for(i=0; i<len; i++) {
- if(data[i] == 1)
- w += sldns_str_print(s, sl, " SHA1");
- else w += sldns_str_print(s, sl, " %d", (int)data[i]);
- }
- return w;
-}
-
-int sldns_wire2str_edns_subnet_print(char** s, size_t* sl, uint8_t* data,
- size_t len)
-{
- int w = 0;
- uint16_t family;
- uint8_t source, scope;
- if(len < 4) {
- w += sldns_str_print(s, sl, "malformed subnet ");
- w += print_hex_buf(s, sl, data, len);
- return w;
- }
- family = sldns_read_uint16(data);
- source = data[2];
- scope = data[3];
- if(family == 1) {
- /* IP4 */
- char buf[64];
- uint8_t ip4[4];
- memset(ip4, 0, sizeof(ip4));
- if(len-4 > 4) {
- w += sldns_str_print(s, sl, "trailingdata:");
- w += print_hex_buf(s, sl, data+4+4, len-4-4);
- w += sldns_str_print(s, sl, " ");
- len = 4+4;
- }
- memmove(ip4, data+4, len-4);
- if(!inet_ntop(AF_INET, ip4, buf, (socklen_t)sizeof(buf))) {
- w += sldns_str_print(s, sl, "ip4ntoperror ");
- w += print_hex_buf(s, sl, data+4+4, len-4-4);
- } else {
- w += sldns_str_print(s, sl, "%s", buf);
- }
- } else if(family == 2) {
- /* IP6 */
- char buf[64];
- uint8_t ip6[16];
- memset(ip6, 0, sizeof(ip6));
- if(len-4 > 16) {
- w += sldns_str_print(s, sl, "trailingdata:");
- w += print_hex_buf(s, sl, data+4+16, len-4-16);
- w += sldns_str_print(s, sl, " ");
- len = 4+16;
- }
- memmove(ip6, data+4, len-4);
-#ifdef AF_INET6
- if(!inet_ntop(AF_INET6, ip6, buf, (socklen_t)sizeof(buf))) {
- w += sldns_str_print(s, sl, "ip6ntoperror ");
- w += print_hex_buf(s, sl, data+4+4, len-4-4);
- } else {
- w += sldns_str_print(s, sl, "%s", buf);
- }
-#else
- w += print_hex_buf(s, sl, data+4+4, len-4-4);
-#endif
- } else {
- /* unknown */
- w += sldns_str_print(s, sl, "family %d ",
- (int)family);
- w += print_hex_buf(s, sl, data, len);
- }
- w += sldns_str_print(s, sl, "/%d scope /%d", (int)source, (int)scope);
- return w;
-}
-
-int sldns_wire2str_edns_option_print(char** s, size_t* sl,
- uint16_t option_code, uint8_t* optdata, size_t optlen)
-{
- int w = 0;
- w += sldns_wire2str_edns_option_code_print(s, sl, option_code);
- w += sldns_str_print(s, sl, ": ");
- switch(option_code) {
- case LDNS_EDNS_LLQ:
- w += sldns_wire2str_edns_llq_print(s, sl, optdata, optlen);
- break;
- case LDNS_EDNS_UL:
- w += sldns_wire2str_edns_ul_print(s, sl, optdata, optlen);
- break;
- case LDNS_EDNS_NSID:
- w += sldns_wire2str_edns_nsid_print(s, sl, optdata, optlen);
- break;
- case LDNS_EDNS_DAU:
- w += sldns_wire2str_edns_dau_print(s, sl, optdata, optlen);
- break;
- case LDNS_EDNS_DHU:
- w += sldns_wire2str_edns_dhu_print(s, sl, optdata, optlen);
- break;
- case LDNS_EDNS_N3U:
- w += sldns_wire2str_edns_n3u_print(s, sl, optdata, optlen);
- break;
- case LDNS_EDNS_CLIENT_SUBNET:
- w += sldns_wire2str_edns_subnet_print(s, sl, optdata, optlen);
- break;
- default:
- /* unknown option code */
- w += print_hex_buf(s, sl, optdata, optlen);
- break;
- }
- return w;
-}
-
-/** print the edns options to string */
-static int
-print_edns_opts(char** s, size_t* sl, uint8_t* rdata, size_t rdatalen)
-{
- uint16_t option_code, option_len;
- int w = 0;
- while(rdatalen > 0) {
- /* option name */
- if(rdatalen < 4) {
- w += sldns_str_print(s, sl, " ; malformed: ");
- w += print_hex_buf(s, sl, rdata, rdatalen);
- return w;
- }
- option_code = sldns_read_uint16(rdata);
- option_len = sldns_read_uint16(rdata+2);
- rdata += 4;
- rdatalen -= 4;
-
- /* option value */
- if(rdatalen < (size_t)option_len) {
- w += sldns_str_print(s, sl, " ; malformed ");
- w += sldns_wire2str_edns_option_code_print(s, sl,
- option_code);
- w += sldns_str_print(s, sl, ": ");
- w += print_hex_buf(s, sl, rdata, rdatalen);
- return w;
- }
- w += sldns_str_print(s, sl, " ; ");
- w += sldns_wire2str_edns_option_print(s, sl, option_code,
- rdata, option_len);
- rdata += option_len;
- rdatalen -= option_len;
- }
- return w;
-}
-
-int sldns_wire2str_edns_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len, uint8_t* pkt, size_t pktlen)
-{
- int w = 0;
- uint8_t ext_rcode, edns_version;
- uint16_t udpsize, edns_bits, rdatalen;
- w += sldns_str_print(str, str_len, "; EDNS:");
-
- /* some input checks, domain name */
- if(*data_len < 1+10)
- return w + print_remainder_hex("Error malformed 0x",
- data, data_len, str, str_len);
- if(*data[0] != 0) {
- return w + print_remainder_hex("Error nonrootdname 0x",
- data, data_len, str, str_len);
- }
- (*data)++;
- (*data_len)--;
-
- /* check type and read fixed contents */
- if(sldns_read_uint16((*data)) != LDNS_RR_TYPE_OPT) {
- return w + print_remainder_hex("Error nottypeOPT 0x",
- data, data_len, str, str_len);
- }
- udpsize = sldns_read_uint16((*data)+2);
- ext_rcode = (*data)[4];
- edns_version = (*data)[5];
- edns_bits = sldns_read_uint16((*data)+6);
- rdatalen = sldns_read_uint16((*data)+8);
- (*data)+=10;
- (*data_len)-=10;
-
- w += sldns_str_print(str, str_len, " version: %u;",
- (unsigned)edns_version);
- w += sldns_str_print(str, str_len, " flags:");
- if((edns_bits & LDNS_EDNS_MASK_DO_BIT))
- w += sldns_str_print(str, str_len, " do");
- /* the extended rcode is the value set, shifted four bits,
- * and or'd with the original rcode */
- if(ext_rcode) {
- int rc = ((int)ext_rcode)<<4;
- if(pkt && pktlen >= LDNS_HEADER_SIZE)
- rc |= LDNS_RCODE_WIRE(pkt);
- w += sldns_str_print(str, str_len, " ; ext-rcode: %d", rc);
- }
- w += sldns_str_print(str, str_len, " ; udp: %u", (unsigned)udpsize);
-
- if(rdatalen) {
- if(*data_len < rdatalen) {
- w += sldns_str_print(str, str_len,
- " ; Error EDNS rdata too short; ");
- rdatalen = *data_len;
- }
- w += print_edns_opts(str, str_len, *data, rdatalen);
- (*data) += rdatalen;
- (*data_len) -= rdatalen;
- }
- w += sldns_str_print(str, str_len, "\n");
- return w;
-}
+++ /dev/null
-/**
- * wire2str.h - txt presentation of RRs
- *
- * (c) NLnet Labs, 2005-2006
- *
- * See the file LICENSE for the license
- */
-
-/**
- * \file
- *
- * Contains functions to translate the wireformat to text
- * representation, as well as functions to print them.
- */
-
-#ifndef LDNS_WIRE2STR_H
-#define LDNS_WIRE2STR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-struct sldns_struct_lookup_table;
-
-/* lookup tables for standard DNS stuff */
-/** Taken from RFC 2535, section 7. */
-extern struct sldns_struct_lookup_table* sldns_algorithms;
-/** DS record hash algorithms */
-extern struct sldns_struct_lookup_table* sldns_hashes;
-/** Taken from RFC 2538, section 2.1. */
-extern struct sldns_struct_lookup_table* sldns_cert_algorithms;
-/** Response codes */
-extern struct sldns_struct_lookup_table* sldns_rcodes;
-/** Operation codes */
-extern struct sldns_struct_lookup_table* sldns_opcodes;
-/** EDNS flags */
-extern struct sldns_struct_lookup_table* sldns_edns_flags;
-/** EDNS option codes */
-extern struct sldns_struct_lookup_table* sldns_edns_options;
-/** error string from wireparse */
-extern struct sldns_struct_lookup_table* sldns_wireparse_errors;
-
-/**
- * Convert wireformat packet to a string representation
- * @param data: wireformat packet data (starting at ID bytes).
- * @param len: length of packet.
- * @return string(malloced) or NULL on failure.
- */
-char* sldns_wire2str_pkt(uint8_t* data, size_t len);
-
-/**
- * Convert wireformat RR to a string representation.
- * @param rr: the wireformat RR, in uncompressed form. Starts at the domain
- * name start, ends with the rdata of the RR.
- * @param len: length of the rr wireformat.
- * @return string(malloced) or NULL on failure.
- */
-char* sldns_wire2str_rr(uint8_t* rr, size_t len);
-
-/**
- * Conver wire dname to a string.
- * @param dname: the dname in uncompressed wireformat.
- * @param dname_len: length of the dname.
- * @return string or NULL on failure.
- */
-char* sldns_wire2str_dname(uint8_t* dname, size_t dname_len);
-
-/**
- * Convert wire RR type to a string, 'MX', 'TYPE1234'...
- * @param rrtype: the RR type in host order.
- * @return malloced string with the RR type or NULL on malloc failure.
- */
-char* sldns_wire2str_type(uint16_t rrtype);
-
-/**
- * Convert wire RR class to a string, 'IN', 'CLASS1'.
- * @param rrclass: the RR class in host order.
- * @return malloced string with the RR class or NULL on malloc failure.
- */
-char* sldns_wire2str_class(uint16_t rrclass);
-
-/**
- * Convert wire packet rcode to a string, 'NOERROR', 'NXDOMAIN'...
- * @param rcode: as integer, host order
- * @return malloced string with the rcode or NULL on malloc failure.
- */
-char* sldns_wire2str_rcode(int rcode);
-
-/**
- * Print to string, move string along for next content. With va_list.
- * @param str: string buffer. Adjusted at end to after the output.
- * @param slen: length of the string buffer. Adjusted at end.
- * @param format: printf format string.
- * @param args: arguments for printf.
- * @return number of characters needed. Can be larger than slen.
- */
-int sldns_str_vprint(char** str, size_t* slen, const char* format, va_list args);
-
-/**
- * Print to string, move string along for next content.
- * @param str: string buffer. Adjusted at end to after the output.
- * @param slen: length of the string buffer. Adjusted at end.
- * @param format: printf format string and arguments for it.
- * @return number of characters needed. Can be larger than slen.
- */
-int sldns_str_print(char** str, size_t* slen, const char* format, ...)
- ATTR_FORMAT(printf, 3, 4);
-
-/**
- * Convert wireformat packet to a string representation with user buffer
- * It appends every RR with default comments.
- * For more formatter options use the function: TBD(TODO)
- * @param data: wireformat packet data (starting at ID bytes).
- * @param data_len: length of packet.
- * @param str: the string buffer for the output.
- * If you pass NULL as the str the return value of the function is
- * the str_len you need for the entire packet. It does not include
- * the 0 byte at the end.
- * @param str_len: the size of the string buffer. If more is needed, it'll
- * silently truncate the output to fit in the buffer.
- * @return the number of characters for this element, excluding zerobyte.
- * Is larger than str_len if output was truncated.
- */
-int sldns_wire2str_pkt_buf(uint8_t* data, size_t data_len, char* str,
- size_t str_len);
-
-/**
- * Scan wireformat packet to a string representation with user buffer
- * It appends every RR with default comments.
- * For more formatter options use the function: TBD(TODO)
- * @param data: wireformat packet data (starting at ID bytes).
- * @param data_len: length of packet.
- * @param str: the string buffer for the output.
- * @param str_len: the size of the string buffer.
- * @return number of characters for string.
- * returns the number of characters that are needed (except terminating null),
- * so it may return a value larger than str_len.
- * On error you get less output (i.e. shorter output in str (null terminated))
- * On exit the data, data_len, str and str_len values are adjusted to move them
- * from their original position along the input and output for the content
- * that has been consumed (and produced) by this function. If the end of the
- * output string is reached, *str_len is set to 0. The output string is null
- * terminated (shortening the output if necessary). If the end of the input
- * is reached *data_len is set to 0.
- */
-int sldns_wire2str_pkt_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat rr to string, with user buffers. It shifts the arguments
- * to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param pkt: packet for decompression, if NULL no decompression.
- * @param pktlen: length of packet buffer.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_rr_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len, uint8_t* pkt, size_t pktlen);
-
-/**
- * Scan wireformat question rr to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param pkt: packet for decompression, if NULL no decompression.
- * @param pktlen: length of packet buffer.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_rrquestion_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len, uint8_t* pkt, size_t pktlen);
-
-/**
- * Scan wireformat RR to string in unknown RR format, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param pkt: packet for decompression, if NULL no decompression.
- * @param pktlen: length of packet buffer.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_rr_unknown_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len, uint8_t* pkt, size_t pktlen);
-
-/**
- * Print to string the RR-information comment in default format,
- * with user buffers. Moves string along.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param rr: wireformat data.
- * @param rrlen: length of data buffer.
- * @param dname_off: offset in buffer behind owner dname, the compressed size
- * of the owner name.
- * @param rrtype: type of the RR, host format.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_rr_comment_print(char** str, size_t* str_len, uint8_t* rr,
- size_t rrlen, size_t dname_off, uint16_t rrtype);
-
-/**
- * Scan wireformat packet header to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_header_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat rdata to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer. The length of the rdata in the
- * buffer. The rdatalen itself has already been scanned, the data
- * points to the rdata after the rdatalen.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param rrtype: RR type of Rdata, host format.
- * @param pkt: packet for decompression, if NULL no decompression.
- * @param pktlen: length of packet buffer.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_rdata_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len, uint16_t rrtype, uint8_t* pkt, size_t pktlen);
-
-/**
- * Scan wireformat rdata to string in unknown format, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer, the length of the rdata in buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_rdata_unknown_scan(uint8_t** data, size_t* data_len,
- char** str, size_t* str_len);
-
-/**
- * Scan wireformat domain name to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param pkt: packet for decompression, if NULL no decompression.
- * @param pktlen: length of packet buffer.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_dname_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len, uint8_t* pkt, size_t pktlen);
-
-/**
- * Scan wireformat rr type to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_type_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat rr class to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_class_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat rr ttl to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_ttl_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-
-/**
- * Print host format rr type to string. Moves string along, user buffers.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param rrtype: host format rr type.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_type_print(char** str, size_t* str_len, uint16_t rrtype);
-
-/**
- * Print host format rr class to string. Moves string along, user buffers.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param rrclass: host format rr class.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_class_print(char** str, size_t* str_len, uint16_t rrclass);
-
-/**
- * Print host format rcode to string. Moves string along, user buffers.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param rcode: host format rcode number.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_rcode_print(char** str, size_t* str_len, int rcode);
-
-/**
- * Print host format opcode to string. Moves string along, user buffers.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param opcode: host format opcode number.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_opcode_print(char** str, size_t* str_len, int opcode);
-
-/**
- * Print host format EDNS0 option to string. Moves string along, user buffers.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param opcode: host format option number.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_edns_option_code_print(char** str, size_t* str_len,
- uint16_t opcode);
-
-/**
- * Convert RR to string presentation format, on one line. User buffer.
- * @param rr: wireformat RR data
- * @param rr_len: length of the rr wire data.
- * @param str: the string buffer to write to.
- * If you pass NULL as the str, the return value of the function is
- * the str_len you need for the entire packet. It does not include
- * the 0 byte at the end.
- * @param str_len: the size of the string buffer. If more is needed, it'll
- * silently truncate the output to fit in the buffer.
- * @return the number of characters for this element, excluding zerobyte.
- * Is larger than str_len if output was truncated.
- */
-int sldns_wire2str_rr_buf(uint8_t* rr, size_t rr_len, char* str,
- size_t str_len);
-
-/**
- * 3597 printout of an RR in unknown rr format.
- * There are more format and comment options available for printout
- * with the function: TBD(TODO)
- * @param rr: wireformat RR data
- * @param rr_len: length of the rr wire data.
- * @param str: the string buffer to write to.
- * If you pass NULL as the str, the return value of the function is
- * the str_len you need for the entire rr. It does not include
- * the 0 byte at the end.
- * @param str_len: the size of the string buffer. If more is needed, it'll
- * silently truncate the output to fit in the buffer.
- * @return the number of characters for this element, excluding zerobyte.
- * Is larger than str_len if output was truncated.
- */
-int sldns_wire2str_rr_unknown_buf(uint8_t* rr, size_t rr_len, char* str,
- size_t str_len);
-
-/**
- * This creates the comment to print after the RR. ; keytag=... , and other
- * basic comments for RRs.
- * There are more format and comment options available for printout
- * with the function: TBD(TODO)
- * @param rr: wireformat RR data
- * @param rr_len: length of the rr wire data.
- * @param dname_len: length of the dname in front of the RR.
- * @param str: the string buffer to write to.
- * If you pass NULL as the str, the return value of the function is
- * the str_len you need for the entire comment. It does not include
- * the 0 byte at the end.
- * @param str_len: the size of the string buffer. If more is needed, it'll
- * silently truncate the output to fit in the buffer.
- * @return the number of characters for this element, excluding zerobyte.
- * Is larger than str_len if output was truncated.
- */
-int sldns_wire2str_rr_comment_buf(uint8_t* rr, size_t rr_len, size_t dname_len,
- char* str, size_t str_len);
-
-/**
- * Convert RDATA to string presentation format, on one line. User buffer.
- * @param rdata: wireformat rdata part of an RR.
- * @param rdata_len: length of the rr wire data.
- * @param str: the string buffer to write to.
- * If you pass NULL as the str, the return value of the function is
- * the str_len you need for the entire packet. It does not include
- * the 0 byte at the end.
- * @param str_len: the size of the string buffer. If more is needed, it'll
- * silently truncate the output to fit in the buffer.
- * @param rrtype: rr type of the data
- * @return the number of characters for this element, excluding zerobyte.
- * Is larger than str_len if output was truncated.
- */
-int sldns_wire2str_rdata_buf(uint8_t* rdata, size_t rdata_len, char* str,
- size_t str_len, uint16_t rrtype);
-
-/**
- * Convert wire RR type to a string, 'MX', 'TYPE12'. With user buffer.
- * @param rrtype: the RR type in host order.
- * @param str: the string to write to.
- * @param len: length of str.
- * @return the number of characters for this element, excluding zerobyte.
- * Is larger than str_len if output was truncated.
- */
-int sldns_wire2str_type_buf(uint16_t rrtype, char* str, size_t len);
-
-/**
- * Convert wire RR class to a string, 'IN', 'CLASS12'. With user buffer.
- * @param rrclass: the RR class in host order.
- * @param str: the string to write to.
- * @param len: length of str.
- * @return the number of characters for this element, excluding zerobyte.
- * Is larger than str_len if output was truncated.
- */
-int sldns_wire2str_class_buf(uint16_t rrclass, char* str, size_t len);
-
-/**
- * Convert wire RR rcode to a string, 'NOERROR', 'NXDOMAIN'. With user buffer.
- * @param rcode: rcode as integer in host order
- * @param str: the string to write to.
- * @param len: length of str.
- * @return the number of characters for this element, excluding zerobyte.
- * Is larger than str_len if output was truncated.
- */
-int sldns_wire2str_rcode_buf(int rcode, char* str, size_t len);
-
-/**
- * Convert wire dname to a string, "example.com.". With user buffer.
- * @param dname: the dname in uncompressed wireformat.
- * @param dname_len: length of the dname.
- * @param str: the string to write to.
- * @param len: length of string.
- * @return the number of characters for this element, excluding zerobyte.
- * Is larger than str_len if output was truncated.
- */
-int sldns_wire2str_dname_buf(uint8_t* dname, size_t dname_len, char* str,
- size_t len);
-
-/**
- * Scan wireformat rdf field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param rdftype: the type of the rdata field, enum sldns_rdf_type.
- * @param pkt: packet for decompression, if NULL no decompression.
- * @param pktlen: length of packet buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_rdf_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len, int rdftype, uint8_t* pkt, size_t pktlen);
-
-/**
- * Scan wireformat int8 field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_int8_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat int16 field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_int16_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat int32 field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_int32_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat period field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_period_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat tsigtime field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_tsigtime_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat ip4 A field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_a_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat ip6 AAAA field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_aaaa_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat str field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_str_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat apl field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_apl_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat b32_ext field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_b32_ext_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat b64 field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_b64_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat hex field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_hex_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat nsec bitmap field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_nsec_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat nsec3_salt field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_nsec3_salt_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat cert_alg field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_cert_alg_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat alg field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_alg_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat type unknown field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_unknown_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat time field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_time_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat LOC field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_loc_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat WKS field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_wks_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat NSAP field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_nsap_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat ATMA field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_atma_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat IPSECKEY field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param pkt: packet for decompression, if NULL no decompression.
- * @param pktlen: length of packet buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_ipseckey_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len, uint8_t* pkt, size_t pktlen);
-
-/**
- * Scan wireformat HIP (algo, HIT, pubkey) field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_hip_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat int16_data field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_int16_data_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat nsec3_next_owner field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_nsec3_next_owner_scan(uint8_t** data, size_t* data_len,
- char** str, size_t* str_len);
-
-/**
- * Scan wireformat ILNP64 field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_ilnp64_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat EUI48 field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_eui48_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat EUI64 field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_eui64_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat TAG field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_tag_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Scan wireformat long_str field to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @return number of characters (except null) needed to print.
- * Can return -1 on failure.
- */
-int sldns_wire2str_long_str_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len);
-
-/**
- * Print EDNS LLQ option data to string. User buffers, moves string pointers.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param option_data: buffer with EDNS option code data.
- * @param option_len: length of the data for this option.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_edns_llq_print(char** str, size_t* str_len,
- uint8_t* option_data, size_t option_len);
-
-/**
- * Print EDNS UL option data to string. User buffers, moves string pointers.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param option_data: buffer with EDNS option code data.
- * @param option_len: length of the data for this option.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_edns_ul_print(char** str, size_t* str_len,
- uint8_t* option_data, size_t option_len);
-
-/**
- * Print EDNS NSID option data to string. User buffers, moves string pointers.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param option_data: buffer with EDNS option code data.
- * @param option_len: length of the data for this option.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_edns_nsid_print(char** str, size_t* str_len,
- uint8_t* option_data, size_t option_len);
-
-/**
- * Print EDNS DAU option data to string. User buffers, moves string pointers.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param option_data: buffer with EDNS option code data.
- * @param option_len: length of the data for this option.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_edns_dau_print(char** str, size_t* str_len,
- uint8_t* option_data, size_t option_len);
-
-/**
- * Print EDNS DHU option data to string. User buffers, moves string pointers.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param option_data: buffer with EDNS option code data.
- * @param option_len: length of the data for this option.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_edns_dhu_print(char** str, size_t* str_len,
- uint8_t* option_data, size_t option_len);
-
-/**
- * Print EDNS N3U option data to string. User buffers, moves string pointers.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param option_data: buffer with EDNS option code data.
- * @param option_len: length of the data for this option.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_edns_n3u_print(char** str, size_t* str_len,
- uint8_t* option_data, size_t option_len);
-
-/**
- * Print EDNS SUBNET option data to string. User buffers, moves string pointers.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param option_data: buffer with EDNS option code data.
- * @param option_len: length of the data for this option.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_edns_subnet_print(char** str, size_t* str_len,
- uint8_t* option_data, size_t option_len);
-
-/**
- * Print an EDNS option as OPT: VALUE. User buffers, moves string pointers.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param option_code: host format EDNS option code.
- * @param option_data: buffer with EDNS option code data.
- * @param option_len: length of the data for this option.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_edns_option_print(char** str, size_t* str_len,
- uint16_t option_code, uint8_t* option_data, size_t option_len);
-
-/**
- * Scan wireformat EDNS OPT to string, with user buffers.
- * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
- * @param data: wireformat data.
- * @param data_len: length of data buffer.
- * @param str: string buffer.
- * @param str_len: length of string buffer.
- * @param pkt: packet with header and other info (may be NULL)
- * @param pktlen: length of packet buffer.
- * @return number of characters (except null) needed to print.
- */
-int sldns_wire2str_edns_scan(uint8_t** data, size_t* data_len, char** str,
- size_t* str_len, uint8_t* pkt, size_t pktlen);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LDNS_WIRE2STR_H */
#include "services/cache/infra.h"
#include "util/data/msgreply.h"
#include "util/storage/slabhash.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
int
context_finalize(struct ub_ctx* ctx)
/* format of cancel:
* o uint32 cmd
* o uint32 async-id */
- uint8_t* p = (uint8_t*)malloc(2*sizeof(uint32_t));
+ uint8_t* p = (uint8_t*)reallocarray(NULL, sizeof(uint32_t), 2);
if(!p) return NULL;
*len = 2*sizeof(uint32_t);
sldns_write_uint32(p, UB_LIBCMD_CANCEL);
#include "services/localzone.h"
#include "services/cache/infra.h"
#include "services/cache/rrset.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
#ifdef HAVE_PTHREAD
#include <signal.h>
#endif
"\\hosts");
retval=ub_ctx_hosts(ctx, buf);
}
- free(name);
return retval;
}
return UB_READFILE;
/* skip addr */
while(isxdigit((unsigned char)*parse) || *parse == '.' || *parse == ':')
parse++;
+ if(*parse == '\r')
+ parse++;
if(*parse == '\n' || *parse == 0)
continue;
if(*parse == '%')
*parse++ = 0; /* end delimiter for addr ... */
/* go to names and add them */
while(*parse) {
- while(*parse == ' ' || *parse == '\t' || *parse=='\n')
+ while(*parse == ' ' || *parse == '\t' || *parse=='\n'
+ || *parse=='\r')
parse++;
if(*parse == 0 || *parse == '#')
break;
#include "util/tube.h"
#include "iterator/iter_fwd.h"
#include "iterator/iter_hints.h"
-#include "ldns/sbuffer.h"
-#include "ldns/str2wire.h"
+#include "sldns/sbuffer.h"
+#include "sldns/str2wire.h"
/** handle new query command for bg worker */
static void handle_newq(struct libworker* w, uint8_t* buf, uint32_t len);
#../../.libs/libunbound.so.0: ../../Makefile
#$(MAKE) -C ../..
-#../../ldns-src/lib/libldns.so: ../../ldns-src/Makefile
- #$(MAKE) -C ../../ldns-src
-
clean:
rm -rdf examples/unbound
rm -f _unbound.so libunbound_wrap.o
$(MAKE) -C ../.. clean
-testenv: ../../.libs/libunbound.so.2 ../../ldns-src/lib/libldns.so ../../.libs/_unbound.so
+testenv: ../../.libs/libunbound.so.2 ../../.libs/_unbound.so
rm -rdf examples/unbound
- cd examples && mkdir unbound && ln -s ../../unbound.py unbound/__init__.py && ln -s ../../_unbound.so unbound/_unbound.so && ln -s ../../../../.libs/libunbound.so.2 unbound/libunbound.so.2 && ln -s ../../../../ldns-src/lib/libldns.so.1 unbound/libldns.so.1 && ls -la
+ cd examples && mkdir unbound && ln -s ../../unbound.py unbound/__init__.py && ln -s ../../_unbound.so unbound/_unbound.so && ln -s ../../../../.libs/libunbound.so.2 unbound/libunbound.so.2 && ls -la
cd examples && if test -f ../../../.libs/_unbound.so; then cp ../../../.libs/_unbound.so . ; fi
@echo "Run a script by typing ./script_name.py"
cd examples && LD_LIBRARY_PATH=unbound bash
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
'''
+from __future__ import print_function
import unbound
import time
ctx.resolvconf("/etc/resolv.conf")
def call_back(my_data,status,result):
- print("Call_back:", my_data)
+ print("Call_back:", sorted(my_data))
if status == 0 and result.havedata:
- print("Result:", result.data.address_list)
+ print("Result:", sorted(result.data.address_list))
my_data['done_flag'] = True
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
'''
+from __future__ import print_function
import unbound
ctx = unbound.ub_ctx()
status, result = ctx.resolve("www.nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
if status == 0 and result.havedata:
- print("Result:", result.data.address_list)
+ print("Result:", sorted(result.data.address_list))
elif status != 0:
print("Error:", unbound.ub_strerror(status))
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
'''
+from __future__ import print_function
import os
from unbound import ub_ctx,RR_TYPE_A,RR_CLASS_IN
status, result = ctx.resolve("www.nic.cz", RR_TYPE_A, RR_CLASS_IN)
if status == 0 and result.havedata:
- print("Result:", result.data.address_list)
+ print("Result:", sorted(result.data.address_list))
if result.secure:
print("Result is secure")
#!/usr/bin/env python
+from __future__ import print_function
from unbound import ub_ctx, RR_TYPE_A, RR_TYPE_RRSIG, RR_TYPE_NSEC, RR_TYPE_NSEC3
import ldns
raise RuntimeError("Error parsing DNS packet")
rrsigs = pkt.rr_list_by_type(RR_TYPE_RRSIG, ldns.LDNS_SECTION_ANSWER)
- print("RRSIGs from answer:", rrsigs)
+ print("RRSIGs from answer:", sorted(rrsigs))
rrsigs = pkt.rr_list_by_type(RR_TYPE_RRSIG, ldns.LDNS_SECTION_AUTHORITY)
- print("RRSIGs from authority:", rrsigs)
+ print("RRSIGs from authority:", sorted(rrsigs))
nsecs = pkt.rr_list_by_type(RR_TYPE_NSEC, ldns.LDNS_SECTION_AUTHORITY)
- print("NSECs:", nsecs)
+ print("NSECs:", sorted(nsecs))
nsec3s = pkt.rr_list_by_type(RR_TYPE_NSEC3, ldns.LDNS_SECTION_AUTHORITY)
- print("NSEC3s:", nsec3s)
+ print("NSEC3s:", sorted(nsec3s))
print("---")
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
'''
+from __future__ import print_function
import unbound
ctx = unbound.ub_ctx()
if status == 0 and result.havedata:
print("Result:")
print(" raw data:", result.data)
- for k in result.data.mx_list:
+ for k in sorted(result.data.mx_list):
print(" priority:%d address:%s" % k)
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
if status == 0 and result.havedata:
print("Result:")
print(" raw data:", result.data)
- for k in result.data.address_list:
+ for k in sorted(result.data.address_list):
print(" address:%s" % k)
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_NS, unbound.RR_CLASS_IN)
if status == 0 and result.havedata:
print("Result:")
print(" raw data:", result.data)
- for k in result.data.domain_list:
+ for k in sorted(result.data.domain_list):
print(" host: %s" % k)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
'''
+from __future__ import print_function
import unbound
import locale
if status == 0 and result.havedata:
print("Result:")
print(" raw data:", result.data)
- for k in result.data.address_list:
+ for k in sorted(result.data.address_list):
print(" address:%s" % k)
status, result = ctx.resolve(u"háčkyčárky.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
if status == 0 and result.havedata:
print("Result:")
print(" raw data:", result.data)
- for k in result.data.mx_list_idn:
+ for k in sorted(result.data.mx_list_idn):
print(" priority:%d address:%s" % k)
status, result = ctx.resolve(unbound.reverse('217.31.204.66')+'.in-addr.arpa', unbound.RR_TYPE_PTR, unbound.RR_CLASS_IN)
if status == 0 and result.havedata:
print("Result.data:", result.data)
- for k in result.data.domain_list_idn:
+ for k in sorted(result.data.domain_list_idn):
print(" dname:%s" % k)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
'''
+from __future__ import print_function
import unbound
ctx = unbound.ub_ctx()
if status == 0 and result.havedata:
print("Result:")
print(" raw data:", result.data)
- for k in result.data.mx_list:
+ for k in sorted(result.data.mx_list):
print(" priority:%d address:%s" % k)
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
if status == 0 and result.havedata:
print("Result:")
print(" raw data:", result.data)
- for k in result.data.address_list:
+ for k in sorted(result.data.address_list):
print(" address:%s" % k)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
'''
+from __future__ import print_function
import unbound
ctx = unbound.ub_ctx()
if status == 0 and result.havedata:
print("Result:")
print(" raw data:", result.data)
- for k in result.data.domain_list:
+ for k in sorted(result.data.domain_list):
print(" host: %s" % k)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
'''
+from __future__ import print_function
import unbound
ctx = unbound.ub_ctx()
status, result = ctx.resolve(unbound.reverse("74.125.43.147") + ".in-addr.arpa.", unbound.RR_TYPE_PTR, unbound.RR_CLASS_IN)
if status == 0 and result.havedata:
- print("Result.data:", result.data, result.data.domain_list)
+ print("Result.data:", result.data, sorted(result.data.domain_list))
--- /dev/null
+/*
+ * file_py3.i: Typemaps for FILE* for Python 3
+ *
+ * Copyright (c) 2011, Karel Slany (karel.slany AT nic.cz)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the organization nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+%{
+#include <unistd.h>
+#include <fcntl.h>
+%}
+
+%types(FILE *);
+
+//#define SWIG_FILE3_DEBUG
+
+/* converts basic file descriptor flags onto a string */
+%fragment("fdfl_to_str", "header") {
+const char *
+fdfl_to_str(int fdfl) {
+
+ static const char * const file_mode[] = {"w+", "w", "r"};
+
+ if (fdfl & O_RDWR) {
+ return file_mode[0];
+ } else if (fdfl & O_WRONLY) {
+ return file_mode[1];
+ } else {
+ return file_mode[2];
+ }
+}
+}
+
+%fragment("is_obj_file", "header") {
+int
+is_obj_file(PyObject *obj) {
+ int fd, fdfl;
+ if (!PyLong_Check(obj) && /* is not an integer */
+ PyObject_HasAttrString(obj, "fileno") && /* has fileno method */
+ (PyObject_CallMethod(obj, "flush", NULL) != NULL) && /* flush() succeeded */
+ ((fd = PyObject_AsFileDescriptor(obj)) != -1) && /* got file descriptor */
+ ((fdfl = fcntl(fd, F_GETFL)) != -1) /* got descriptor flags */
+ ) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+}
+
+%fragment("obj_to_file","header", fragment="fdfl_to_str,is_obj_file") {
+FILE *
+obj_to_file(PyObject *obj) {
+ int fd, fdfl;
+ FILE *fp;
+ if (is_obj_file(obj)) {
+ fd = PyObject_AsFileDescriptor(obj);
+ fdfl = fcntl(fd, F_GETFL);
+ fp = fdopen(dup(fd), fdfl_to_str(fdfl)); /* the FILE* must be flushed
+ and closed after being used */
+#ifdef SWIG_FILE3_DEBUG
+ fprintf(stderr, "opening fd %d (fl %d \"%s\") as FILE %p\n",
+ fd, fdfl, fdfl_to_str(fdfl), (void *)fp);
+#endif
+ return fp;
+ }
+ return NULL;
+}
+}
+
+/* returns -1 if error occurred */
+/* caused magic SWIG Syntax errors when was commented out */
+#if 0
+%fragment("dispose_file", "header") {
+int
+dispose_file(FILE **fp) {
+#ifdef SWIG_FILE3_DEBUG
+ fprintf(stderr, "flushing FILE %p\n", (void *)fp);
+#endif
+ if (*fp == NULL) {
+ return 0;
+ }
+ if ((fflush(*fp) == 0) && /* flush file */
+ (fclose(*fp) == 0)) { /* close file */
+ *fp = NULL;
+ return 0;
+ }
+ return -1;
+}
+}
+#endif
+
+%typemap(arginit, noblock = 1) FILE* {
+ $1 = NULL;
+}
+
+/*
+ * added due to ub_ctx_debugout since since it is overloaded:
+ * takes void* and FILE*. In reality only FILE* but the wrapper
+ * and the function is declared in such way.
+ */
+%typemap(typecheck, noblock = 1, fragment = "is_obj_file", precedence = SWIG_TYPECHECK_POINTER) FILE* {
+ $1 = is_obj_file($input);
+}
+
+%typemap(check, noblock = 1) FILE* {
+ if ($1 == NULL) {
+ /* The generated wrapper function raises TypeError on mismatching types. */
+ SWIG_exception_fail(SWIG_TypeError, "in method '" "$symname" "', argument "
+ "$argnum"" of type '" "$type""'");
+ }
+}
+
+%typemap(in, noblock = 1, fragment = "obj_to_file") FILE* {
+ $1 = obj_to_file($input);
+}
+
+/*
+ * Commented out due the way how ub_ctx_debugout() uses the parameter.
+ * This typemap would cause the FILE* to be closed after return from
+ * the function. This caused Python interpreter to crash, since the
+ * function just stores the FILE* internally in ctx and use it for
+ * logging. So we'll leave the closing of the file on the OS.
+ */
+/*%typemap(freearg, noblock = 1, fragment = "dispose_file") FILE* {
+ if (dispose_file(&$1) == -1) {
+ SWIG_exception_fail(SWIG_IOError, "closing file in method '" "$symname" "', argument "
+ "$argnum"" of type '" "$type""'");
+ }
+}*/
%}
//%include "doc.i"
+#if PY_MAJOR_VERSION >= 3
+%include "file_py3.i" // python 3 FILE *
+#else
%include "file.i"
+#endif
%feature("docstring") strerror "Convert error value to a human readable string."
#ifndef LIBUNBOUND_WORKER_H
#define LIBUNBOUND_WORKER_H
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
#include "util/data/packed_rrset.h" /* for enum sec_status */
struct comm_reply;
struct comm_point;
#include "iterator/iter_delegpt.h"
#include "iterator/iter_hints.h"
#include "iterator/iter_utils.h"
- #include "ldns/wire2str.h"
- #include "ldns/str2wire.h"
- #include "ldns/pkthdr.h"
+ #include "sldns/wire2str.h"
+ #include "sldns/str2wire.h"
+ #include "sldns/pkthdr.h"
%}
%include "stdint.i" // uint_16_t can be known type now
%inline %{
- //converts [len][data][len][data][0] string to a List of labels (PyStrings)
+ //converts [len][data][len][data][0] string to a List of labels (PyBytes)
PyObject* GetNameAsLabelList(const char* name, int len) {
PyObject* list;
int cnt=0, i;
%inline %{
enum enum_rr_class {
RR_CLASS_IN = 1,
- RR_CLASS_CH = 3,
- RR_CLASS_HS = 4,
+ RR_CLASS_CH = 3,
+ RR_CLASS_HS = 4,
RR_CLASS_NONE = 254,
RR_CLASS_ANY = 255,
};
char buf[LDNS_MAX_DOMAINLEN+1];
buf[0] = '\0';
dname_str((uint8_t*)dname, buf);
- return PyString_FromString(buf);
+ return PyBytes_FromString(buf);
}
%}
reply_addr2str(reply, dest, 64);
if (dest[0] == 0)
return Py_None;
- return PyString_FromString(dest);
+ return PyBytes_FromString(dest);
}
PyObject* _comm_reply_family_get(struct comm_reply* reply) {
int af = (int)((struct sockaddr_in*) &(reply->addr))->sin_family;
switch(af) {
- case AF_INET: return PyString_FromString("ip4");
- case AF_INET6: return PyString_FromString("ip6");
- case AF_UNIX: return PyString_FromString("unix");
+ case AF_INET: return PyBytes_FromString("ip4");
+ case AF_INET6: return PyBytes_FromString("ip6");
+ case AF_UNIX: return PyBytes_FromString("unix");
}
return Py_None;
%inline %{
PyObject* _get_dp_dname(struct delegpt* dp) {
- return PyString_FromStringAndSize((char*)dp->name, dp->namelen);
+ return PyBytes_FromStringAndSize((char*)dp->name, dp->namelen);
}
PyObject* _get_dp_dname_components(struct delegpt* dp) {
return GetNameAsLabelList((char*)dp->name, dp->namelen);
}
PyObject* _get_dpns_dname(struct delegpt_ns* dpns) {
- return PyString_FromStringAndSize((char*)dpns->name, dpns->namelen);
+ return PyBytes_FromStringAndSize((char*)dpns->name, dpns->namelen);
}
PyObject* _get_dpns_dname_components(struct delegpt_ns* dpns) {
return GetNameAsLabelList((char*)dpns->name, dpns->namelen);
delegpt_addr_addr2str(target, dest, 64);
if (dest[0] == 0)
return Py_None;
- return PyString_FromString(dest);
+ return PyBytes_FromString(dest);
}
%}
for (i=0; i < PyList_Size(l); i++)
{
item = PyList_GetItem(l, i);
- if (!PyString_Check(item))
+ if (!PyBytes_Check(item))
return 0;
}
return 1;
len = sldns_buffer_remaining(qb);
if(qsec) {
- if(sldns_str2wire_rr_question_buf(PyString_AsString(item),
+ if(sldns_str2wire_rr_question_buf(PyBytes_AsString(item),
sldns_buffer_current(qb), &len, NULL, NULL, 0, NULL, 0)
!= 0)
return 0;
} else {
- if(sldns_str2wire_rr_buf(PyString_AsString(item),
+ if(sldns_str2wire_rr_buf(PyBytes_AsString(item),
sldns_buffer_current(qb), &len, NULL, default_ttl,
NULL, 0, NULL, 0) != 0)
return 0;
#endif
#include "config.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
#undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE
/* Initialize Python libraries */
if (!Py_IsInitialized())
{
- Py_SetProgramName("unbound");
+#if PY_MAJOR_VERSION >= 3
+ wchar_t progname[8];
+ mbstowcs(progname, "unbound", 8);
+#else
+ char *progname = "unbound";
+#endif
+ Py_SetProgramName(progname);
Py_NoSiteFlag = 1;
Py_Initialize();
PyEval_InitThreads();
#include "util/storage/slabhash.h"
#include "util/regional.h"
#include "iterator/iter_delegpt.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
#undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE
#include "util/net_help.h"
#include "util/regional.h"
#include "util/config_file.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
/** store rrsets in the rrset cache.
* @param env: module environment with caches.
sizeof(struct reply_info)-sizeof(struct rrset_ref));
if(!msg->rep)
return NULL;
+ if(capacity > RR_COUNT_MAX)
+ return NULL; /* integer overflow protection */
msg->rep->flags = BIT_QR; /* with QR, no AA */
msg->rep->qdcount = 1;
msg->rep->rrsets = (struct ub_packed_rrset_key**)
return 1;
}
+/** add rrset to answer section */
+static int
+dns_msg_ansadd(struct dns_msg* msg, struct regional* region,
+ struct ub_packed_rrset_key* rrset, time_t now)
+{
+ if(!(msg->rep->rrsets[msg->rep->rrset_count++] =
+ packed_rrset_copy_region(rrset, region, now)))
+ return 0;
+ msg->rep->an_numrrsets++;
+ return 1;
+}
+
struct delegpt*
dns_cache_find_delegation(struct module_env* env, uint8_t* qname,
size_t qnamelen, uint16_t qtype, uint16_t qclass,
sizeof(struct reply_info) - sizeof(struct rrset_ref));
if(!msg->rep)
return NULL;
+ if(num > RR_COUNT_MAX)
+ return NULL; /* integer overflow protection */
msg->rep->rrsets = (struct ub_packed_rrset_key**)
regional_alloc(region,
num * sizeof(struct ub_packed_rrset_key*));
return NULL;
if(r->an_numrrsets > 0 && (r->rrsets[0]->rk.type == htons(
LDNS_RR_TYPE_CNAME) || r->rrsets[0]->rk.type == htons(
- LDNS_RR_TYPE_DNAME)) && !reply_check_cname_chain(r)) {
+ LDNS_RR_TYPE_DNAME)) && !reply_check_cname_chain(q, r)) {
/* cname chain is now invalid, reconstruct msg */
rrset_array_unlock(r->ref, r->rrset_count);
return NULL;
return msg;
}
+/** Fill TYPE_ANY response with some data from cache */
+static struct dns_msg*
+fill_any(struct module_env* env,
+ uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass,
+ struct regional* region)
+{
+ time_t now = *env->now;
+ struct dns_msg* msg = NULL;
+ uint16_t lookup[] = {LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA,
+ LDNS_RR_TYPE_MX, LDNS_RR_TYPE_SOA, LDNS_RR_TYPE_NS, 0};
+ int i, num=5; /* number of RR types to look up */
+ log_assert(lookup[num] == 0);
+
+ for(i=0; i<num; i++) {
+ /* look up this RR for inclusion in type ANY response */
+ struct ub_packed_rrset_key* rrset = rrset_cache_lookup(
+ env->rrset_cache, qname, qnamelen, lookup[i],
+ qclass, 0, now, 0);
+ struct packed_rrset_data *d;
+ if(!rrset)
+ continue;
+
+ /* only if rrset from answer section */
+ d = (struct packed_rrset_data*)rrset->entry.data;
+ if(d->trust == rrset_trust_add_noAA ||
+ d->trust == rrset_trust_auth_noAA ||
+ d->trust == rrset_trust_add_AA ||
+ d->trust == rrset_trust_auth_AA) {
+ lock_rw_unlock(&rrset->entry.lock);
+ continue;
+ }
+
+ /* create msg if none */
+ if(!msg) {
+ msg = dns_msg_create(qname, qnamelen, qtype, qclass,
+ region, (size_t)(num-i));
+ if(!msg) {
+ lock_rw_unlock(&rrset->entry.lock);
+ return NULL;
+ }
+ }
+
+ /* add RRset to response */
+ if(!dns_msg_ansadd(msg, region, rrset, now)) {
+ lock_rw_unlock(&rrset->entry.lock);
+ return NULL;
+ }
+ lock_rw_unlock(&rrset->entry.lock);
+ }
+ return msg;
+}
+
struct dns_msg*
dns_cache_lookup(struct module_env* env,
uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass,
}
}
+ /* fill common RR types for ANY response to avoid requery */
+ if(qtype == LDNS_RR_TYPE_ANY) {
+ return fill_any(env, qname, qnamelen, qtype, qclass, region);
+ }
+
return NULL;
}
* This file contains the infrastructure cache.
*/
#include "config.h"
-#include "ldns/rrdef.h"
+#include "sldns/rrdef.h"
+#include "sldns/str2wire.h"
#include "services/cache/infra.h"
#include "util/storage/slabhash.h"
#include "util/storage/lookup3.h"
* can do this number of packets (until those all timeout too) */
#define TIMEOUT_COUNT_MAX 3
+/** ratelimit value for delegation point */
+int infra_dp_ratelimit = 0;
+
size_t
infra_sizefunc(void* k, void* ATTR_UNUSED(d))
{
free(data);
}
+size_t
+rate_sizefunc(void* k, void* ATTR_UNUSED(d))
+{
+ struct rate_key* key = (struct rate_key*)k;
+ return sizeof(*key) + sizeof(struct rate_data) + key->namelen
+ + lock_get_mem(&key->entry.lock);
+}
+
+int
+rate_compfunc(void* key1, void* key2)
+{
+ struct rate_key* k1 = (struct rate_key*)key1;
+ struct rate_key* k2 = (struct rate_key*)key2;
+ if(k1->namelen != k2->namelen) {
+ if(k1->namelen < k2->namelen)
+ return -1;
+ return 1;
+ }
+ return query_dname_compare(k1->name, k2->name);
+}
+
+void
+rate_delkeyfunc(void* k, void* ATTR_UNUSED(arg))
+{
+ struct rate_key* key = (struct rate_key*)k;
+ if(!key)
+ return;
+ lock_rw_destroy(&key->entry.lock);
+ free(key->name);
+ free(key);
+}
+
+void
+rate_deldatafunc(void* d, void* ATTR_UNUSED(arg))
+{
+ struct rate_data* data = (struct rate_data*)d;
+ free(data);
+}
+
+/** find or create element in domainlimit tree */
+static struct domain_limit_data* domain_limit_findcreate(
+ struct infra_cache* infra, char* name)
+{
+ uint8_t* nm;
+ int labs;
+ size_t nmlen;
+ struct domain_limit_data* d;
+
+ /* parse name */
+ nm = sldns_str2wire_dname(name, &nmlen);
+ if(!nm) {
+ log_err("could not parse %s", name);
+ return NULL;
+ }
+ labs = dname_count_labels(nm);
+
+ /* can we find it? */
+ d = (struct domain_limit_data*)name_tree_find(&infra->domain_limits,
+ nm, nmlen, labs, LDNS_RR_CLASS_IN);
+ if(d) {
+ free(nm);
+ return d;
+ }
+
+ /* create it */
+ d = (struct domain_limit_data*)calloc(1, sizeof(*d));
+ if(!d) {
+ free(nm);
+ return NULL;
+ }
+ d->node.node.key = &d->node;
+ d->node.name = nm;
+ d->node.len = nmlen;
+ d->node.labs = labs;
+ d->node.dclass = LDNS_RR_CLASS_IN;
+ d->lim = -1;
+ d->below = -1;
+ if(!name_tree_insert(&infra->domain_limits, &d->node, nm, nmlen,
+ labs, LDNS_RR_CLASS_IN)) {
+ log_err("duplicate element in domainlimit tree");
+ free(nm);
+ free(d);
+ return NULL;
+ }
+ return d;
+}
+
+/** insert rate limit configuration into lookup tree */
+static int infra_ratelimit_cfg_insert(struct infra_cache* infra,
+ struct config_file* cfg)
+{
+ struct config_str2list* p;
+ struct domain_limit_data* d;
+ for(p = cfg->ratelimit_for_domain; p; p = p->next) {
+ d = domain_limit_findcreate(infra, p->str);
+ if(!d)
+ return 0;
+ d->lim = atoi(p->str2);
+ }
+ for(p = cfg->ratelimit_below_domain; p; p = p->next) {
+ d = domain_limit_findcreate(infra, p->str);
+ if(!d)
+ return 0;
+ d->below = atoi(p->str2);
+ }
+ return 1;
+}
+
struct infra_cache*
infra_create(struct config_file* cfg)
{
return NULL;
}
infra->host_ttl = cfg->host_ttl;
+ name_tree_init(&infra->domain_limits);
+ infra_dp_ratelimit = cfg->ratelimit;
+ if(cfg->ratelimit != 0) {
+ infra->domain_rates = slabhash_create(cfg->ratelimit_slabs,
+ INFRA_HOST_STARTSIZE, cfg->ratelimit_size,
+ &rate_sizefunc, &rate_compfunc, &rate_delkeyfunc,
+ &rate_deldatafunc, NULL);
+ if(!infra->domain_rates) {
+ infra_delete(infra);
+ return NULL;
+ }
+ /* insert config data into ratelimits */
+ if(!infra_ratelimit_cfg_insert(infra, cfg)) {
+ infra_delete(infra);
+ return NULL;
+ }
+ name_tree_init_parents(&infra->domain_limits);
+ }
return infra;
}
+/** delete domain_limit entries */
+static void domain_limit_free(rbnode_t* n, void* ATTR_UNUSED(arg))
+{
+ if(n) {
+ free(((struct domain_limit_data*)n)->node.name);
+ free(n);
+ }
+}
+
void
infra_delete(struct infra_cache* infra)
{
if(!infra)
return;
slabhash_delete(infra->hosts);
+ slabhash_delete(infra->domain_rates);
+ traverse_postorder(&infra->domain_limits, domain_limit_free, NULL);
free(infra);
}
return 1;
}
+int infra_find_ratelimit(struct infra_cache* infra, uint8_t* name,
+ size_t namelen)
+{
+ int labs = dname_count_labels(name);
+ struct domain_limit_data* d = (struct domain_limit_data*)
+ name_tree_lookup(&infra->domain_limits, name, namelen, labs,
+ LDNS_RR_CLASS_IN);
+ if(!d) return infra_dp_ratelimit;
+
+ if(d->node.labs == labs && d->lim != -1)
+ return d->lim; /* exact match */
+
+ /* find 'below match' */
+ if(d->node.labs == labs)
+ d = (struct domain_limit_data*)d->node.parent;
+ while(d) {
+ if(d->below != -1)
+ return d->below;
+ d = (struct domain_limit_data*)d->node.parent;
+ }
+ return infra_dp_ratelimit;
+}
+
+/** find data item in array, for write access, caller unlocks */
+static struct lruhash_entry* infra_find_ratedata(struct infra_cache* infra,
+ uint8_t* name, size_t namelen, int wr)
+{
+ struct rate_key key;
+ hashvalue_t h = dname_query_hash(name, 0xab);
+ memset(&key, 0, sizeof(key));
+ key.name = name;
+ key.namelen = namelen;
+ key.entry.hash = h;
+ return slabhash_lookup(infra->domain_rates, h, &key, wr);
+}
+
+/** create rate data item for name, number 1 in now */
+static void infra_create_ratedata(struct infra_cache* infra,
+ uint8_t* name, size_t namelen, time_t timenow)
+{
+ hashvalue_t h = dname_query_hash(name, 0xab);
+ struct rate_key* k = (struct rate_key*)calloc(1, sizeof(*k));
+ struct rate_data* d = (struct rate_data*)calloc(1, sizeof(*d));
+ if(!k || !d) {
+ free(k);
+ free(d);
+ return; /* alloc failure */
+ }
+ k->namelen = namelen;
+ k->name = memdup(name, namelen);
+ if(!k->name) {
+ free(k);
+ free(d);
+ return; /* alloc failure */
+ }
+ lock_rw_init(&k->entry.lock);
+ k->entry.hash = h;
+ k->entry.key = k;
+ k->entry.data = d;
+ d->qps[0] = 1;
+ d->timestamp[0] = timenow;
+ slabhash_insert(infra->domain_rates, h, &k->entry, d, NULL);
+}
+
+/** find the second and return its rate counter, if none, remove oldest */
+static int* infra_rate_find_second(void* data, time_t t)
+{
+ struct rate_data* d = (struct rate_data*)data;
+ int i, oldest;
+ for(i=0; i<RATE_WINDOW; i++) {
+ if(d->timestamp[i] == t)
+ return &(d->qps[i]);
+ }
+ /* remove oldest timestamp, and insert it at t with 0 qps */
+ oldest = 0;
+ for(i=0; i<RATE_WINDOW; i++) {
+ if(d->timestamp[i] < d->timestamp[oldest])
+ oldest = i;
+ }
+ d->timestamp[oldest] = t;
+ d->qps[oldest] = 0;
+ return &(d->qps[oldest]);
+}
+
+int infra_rate_max(void* data, time_t now)
+{
+ struct rate_data* d = (struct rate_data*)data;
+ int i, max = 0;
+ for(i=0; i<RATE_WINDOW; i++) {
+ if(now-d->timestamp[i] <= RATE_WINDOW) {
+ if(d->qps[i] > max)
+ max = d->qps[i];
+ }
+ }
+ return max;
+}
+
+int infra_ratelimit_inc(struct infra_cache* infra, uint8_t* name,
+ size_t namelen, time_t timenow)
+{
+ int lim, max;
+ struct lruhash_entry* entry;
+
+ if(!infra_dp_ratelimit)
+ return 1; /* not enabled */
+
+ /* find ratelimit */
+ lim = infra_find_ratelimit(infra, name, namelen);
+
+ /* find or insert ratedata */
+ entry = infra_find_ratedata(infra, name, namelen, 1);
+ if(entry) {
+ int premax = infra_rate_max(entry->data, timenow);
+ int* cur = infra_rate_find_second(entry->data, timenow);
+ (*cur)++;
+ max = infra_rate_max(entry->data, timenow);
+ lock_rw_unlock(&entry->lock);
+
+ if(premax < lim && max >= lim) {
+ char buf[257];
+ dname_str(name, buf);
+ verbose(VERB_OPS, "ratelimit exceeded %s %d", buf, lim);
+ }
+ return (max < lim);
+ }
+
+ /* create */
+ infra_create_ratedata(infra, name, namelen, timenow);
+ return (1 < lim);
+}
+
+void infra_ratelimit_dec(struct infra_cache* infra, uint8_t* name,
+ size_t namelen, time_t timenow)
+{
+ struct lruhash_entry* entry;
+ int* cur;
+ if(!infra_dp_ratelimit)
+ return; /* not enabled */
+ entry = infra_find_ratedata(infra, name, namelen, 1);
+ if(!entry) return; /* not cached */
+ cur = infra_rate_find_second(entry->data, timenow);
+ if((*cur) > 0)
+ (*cur)--;
+ lock_rw_unlock(&entry->lock);
+}
+
+int infra_ratelimit_exceeded(struct infra_cache* infra, uint8_t* name,
+ size_t namelen, time_t timenow)
+{
+ struct lruhash_entry* entry;
+ int lim, max;
+ if(!infra_dp_ratelimit)
+ return 0; /* not enabled */
+
+ /* find ratelimit */
+ lim = infra_find_ratelimit(infra, name, namelen);
+
+ /* find current rate */
+ entry = infra_find_ratedata(infra, name, namelen, 0);
+ if(!entry)
+ return 0; /* not cached */
+ max = infra_rate_max(entry->data, timenow);
+ lock_rw_unlock(&entry->lock);
+
+ return (max >= lim);
+}
+
size_t
infra_get_mem(struct infra_cache* infra)
{
- return sizeof(*infra) + slabhash_get_mem(infra->hosts);
+ size_t s = sizeof(*infra) + slabhash_get_mem(infra->hosts);
+ if(infra->domain_rates) s += slabhash_get_mem(infra->domain_rates);
+ /* ignore domain_limits because walk through tree is big */
+ return s;
}
#ifndef SERVICES_CACHE_INFRA_H
#define SERVICES_CACHE_INFRA_H
#include "util/storage/lruhash.h"
+#include "util/storage/dnstree.h"
#include "util/rtt.h"
struct slabhash;
struct config_file;
struct slabhash* hosts;
/** TTL value for host information, in seconds */
int host_ttl;
+ /** hash table with query rates per name: rate_key, rate_data */
+ struct slabhash* domain_rates;
+ /** ratelimit settings for domains, struct domain_limit_data */
+ rbtree_t domain_limits;
+};
+
+/** ratelimit, unless overridden by domain_limits, 0 is off */
+extern int infra_dp_ratelimit;
+
+/**
+ * ratelimit settings for domains
+ */
+struct domain_limit_data {
+ /** key for rbtree, must be first in struct, name of domain */
+ struct name_tree_node node;
+ /** ratelimit for exact match with this name, -1 if not set */
+ int lim;
+ /** ratelimit for names below this name, -1 if not set */
+ int below;
+};
+
+/**
+ * key for ratelimit lookups, a domain name
+ */
+struct rate_key {
+ /** lruhash key entry */
+ struct lruhash_entry entry;
+ /** domain name in uncompressed wireformat */
+ uint8_t* name;
+ /** length of name */
+ size_t namelen;
+};
+
+/** number of seconds to track qps rate */
+#define RATE_WINDOW 2
+
+/**
+ * Data for ratelimits per domain name
+ * It is incremented when a non-cache-lookup happens for that domain name.
+ * The name is the delegation point we have for the name.
+ * If a new delegation point is found (a referral reply), the previous
+ * delegation point is decremented, and the new one is charged with the query.
+ */
+struct rate_data {
+ /** queries counted, for that second. 0 if not in use. */
+ int qps[RATE_WINDOW];
+ /** what the timestamp is of the qps array members, counter is
+ * valid for that timestamp. Usually now and now-1. */
+ time_t timestamp[RATE_WINDOW];
};
/** infra host cache default hash lookup size */
size_t namelen, struct rtt_info* rtt, int* delay, time_t timenow,
int* tA, int* tAAAA, int* tother);
+/**
+ * Increment the query rate counter for a delegation point.
+ * @param infra: infra cache.
+ * @param name: zone name
+ * @param namelen: zone name length
+ * @param timenow: what time it is now.
+ * @return 1 if it could be incremented. 0 if the increment overshot the
+ * ratelimit or if in the previous second the ratelimit was exceeded.
+ * Failures like alloc failures are not returned (probably as 1).
+ */
+int infra_ratelimit_inc(struct infra_cache* infra, uint8_t* name,
+ size_t namelen, time_t timenow);
+
+/**
+ * Decrement the query rate counter for a delegation point.
+ * Because the reply received for the delegation point was pleasant,
+ * we do not charge this delegation point with it (i.e. it was a referral).
+ * Should call it with same second as when inc() was called.
+ * @param infra: infra cache.
+ * @param name: zone name
+ * @param namelen: zone name length
+ * @param timenow: what time it is now.
+ */
+void infra_ratelimit_dec(struct infra_cache* infra, uint8_t* name,
+ size_t namelen, time_t timenow);
+
+/**
+ * See if the query rate counter for a delegation point is exceeded.
+ * So, no queries are going to be allowed.
+ * @param infra: infra cache.
+ * @param name: zone name
+ * @param namelen: zone name length
+ * @param timenow: what time it is now.
+ * @return true if exceeded.
+ */
+int infra_ratelimit_exceeded(struct infra_cache* infra, uint8_t* name,
+ size_t namelen, time_t timenow);
+
+/** find the maximum rate stored, not too old. 0 if no information. */
+int infra_rate_max(void* data, time_t now);
+
+/** find the ratelimit in qps for a domain */
+int infra_find_ratelimit(struct infra_cache* infra, uint8_t* name,
+ size_t namelen);
+
/**
* Get memory used by the infra cache.
* @param infra: infrastructure cache.
/** delete data and destroy the lameness hashtable */
void infra_deldatafunc(void* d, void* arg);
+/** calculate size for the hashtable */
+size_t rate_sizefunc(void* k, void* d);
+
+/** compare two names, returns -1, 0, or +1 */
+int rate_compfunc(void* key1, void* key2);
+
+/** delete key, and destroy the lock */
+void rate_delkeyfunc(void* k, void* arg);
+
+/** delete data */
+void rate_deldatafunc(void* d, void* arg);
+
#endif /* SERVICES_CACHE_INFRA_H */
*/
#include "config.h"
#include "services/cache/rrset.h"
-#include "ldns/rrdef.h"
+#include "sldns/rrdef.h"
#include "util/storage/slabhash.h"
#include "util/config_file.h"
#include "util/data/packed_rrset.h"
{
hashvalue_t* h;
size_t i;
- if(!(h = (hashvalue_t*)regional_alloc(scratch,
- sizeof(hashvalue_t)*count)))
+ if(count > RR_COUNT_MAX || !(h = (hashvalue_t*)regional_alloc(scratch,
+ sizeof(hashvalue_t)*count))) {
log_warn("rrset LRU: memory allocation failed");
- else /* store hash values */
+ h = NULL;
+ } else /* store hash values */
for(i=0; i<count; i++)
h[i] = ref[i].key->entry.hash;
/* unlock */
#include "util/log.h"
#include "util/config_file.h"
#include "util/net_help.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
#ifdef HAVE_NETDB_H
#include <netdb.h>
int
create_udp_sock(int family, int socktype, struct sockaddr* addr,
socklen_t addrlen, int v6only, int* inuse, int* noproto,
- int rcv, int snd, int listen, int* reuseport)
+ int rcv, int snd, int listen, int* reuseport, int transparent)
{
int s;
-#if defined(SO_REUSEADDR) || defined(SO_REUSEPORT) || defined(IPV6_USE_MIN_MTU)
+#if defined(SO_REUSEADDR) || defined(SO_REUSEPORT) || defined(IPV6_USE_MIN_MTU) || defined(IP_TRANSPARENT)
int on=1;
#endif
#ifdef IPV6_MTU
#endif
#ifndef IPV6_V6ONLY
(void)v6only;
+#endif
+#ifndef IP_TRANSPARENT
+ (void)transparent;
#endif
if((s = socket(family, socktype, 0)) == -1) {
*inuse = 0;
#else
(void)reuseport;
#endif /* defined(SO_REUSEPORT) */
+#ifdef IP_TRANSPARENT
+ if (transparent &&
+ setsockopt(s, IPPROTO_IP, IP_TRANSPARENT, (void*)&on,
+ (socklen_t)sizeof(on)) < 0) {
+ log_warn("setsockopt(.. IP_TRANSPARENT ..) failed: %s",
+ strerror(errno));
+ }
+#endif /* IP_TRANSPARENT */
}
if(rcv) {
#ifdef SO_RCVBUF
int
create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto,
- int* reuseport)
+ int* reuseport, int transparent)
{
int s;
-#if defined(SO_REUSEADDR) || defined(SO_REUSEPORT) || defined(IPV6_V6ONLY)
+#if defined(SO_REUSEADDR) || defined(SO_REUSEPORT) || defined(IPV6_V6ONLY) || defined(IP_TRANSPARENT)
int on = 1;
-#endif /* SO_REUSEADDR || IPV6_V6ONLY */
+#endif
+#ifndef IP_TRANSPARENT
+ (void)transparent;
+#endif
verbose_print_addr(addr);
*noproto = 0;
if((s = socket(addr->ai_family, addr->ai_socktype, 0)) == -1) {
#else
(void)v6only;
#endif /* IPV6_V6ONLY */
+#ifdef IP_TRANSPARENT
+ if (transparent &&
+ setsockopt(s, IPPROTO_IP, IP_TRANSPARENT, (void*)&on,
+ (socklen_t)sizeof(on)) < 0) {
+ log_warn("setsockopt(.. IP_TRANSPARENT ..) failed: %s",
+ strerror(errno));
+ }
+#endif /* IP_TRANSPARENT */
if(bind(s, addr->ai_addr, addr->ai_addrlen) != 0) {
#ifndef USE_WINSOCK
/* detect freebsd jail with no ipv6 permission */
static int
make_sock(int stype, const char* ifname, const char* port,
struct addrinfo *hints, int v6only, int* noip6, size_t rcv, size_t snd,
- int* reuseport)
+ int* reuseport, int transparent)
{
struct addrinfo *res = NULL;
int r, s, inuse, noproto;
s = create_udp_sock(res->ai_family, res->ai_socktype,
(struct sockaddr*)res->ai_addr, res->ai_addrlen,
v6only, &inuse, &noproto, (int)rcv, (int)snd, 1,
- reuseport);
+ reuseport, transparent);
if(s == -1 && inuse) {
log_err("bind: address already in use");
} else if(s == -1 && noproto && hints->ai_family == AF_INET6){
*noip6 = 1;
}
} else {
- s = create_tcp_accept_sock(res, v6only, &noproto, reuseport);
+ s = create_tcp_accept_sock(res, v6only, &noproto, reuseport,
+ transparent);
if(s == -1 && noproto && hints->ai_family == AF_INET6){
*noip6 = 1;
}
static int
make_sock_port(int stype, const char* ifname, const char* port,
struct addrinfo *hints, int v6only, int* noip6, size_t rcv, size_t snd,
- int* reuseport)
+ int* reuseport, int transparent)
{
char* s = strchr(ifname, '@');
if(s) {
(void)strlcpy(p, s+1, sizeof(p));
p[strlen(s+1)]=0;
return make_sock(stype, newif, p, hints, v6only, noip6,
- rcv, snd, reuseport);
+ rcv, snd, reuseport, transparent);
}
return make_sock(stype, ifname, port, hints, v6only, noip6, rcv, snd,
- reuseport);
+ reuseport, transparent);
}
/**
* @param ssl_port: ssl service port number
* @param reuseport: try to set SO_REUSEPORT if nonNULL and true.
* set to false on exit if reuseport failed due to no kernel support.
+ * @param transparent: set IP_TRANSPARENT socket option.
* @return: returns false on error.
*/
static int
ports_create_if(const char* ifname, int do_auto, int do_udp, int do_tcp,
struct addrinfo *hints, const char* port, struct listen_port** list,
- size_t rcv, size_t snd, int ssl_port, int* reuseport)
+ size_t rcv, size_t snd, int ssl_port, int* reuseport, int transparent)
{
int s, noip6=0;
if(!do_udp && !do_tcp)
return 0;
if(do_auto) {
if((s = make_sock_port(SOCK_DGRAM, ifname, port, hints, 1,
- &noip6, rcv, snd, reuseport)) == -1) {
+ &noip6, rcv, snd, reuseport, transparent)) == -1) {
if(noip6) {
log_warn("IPv6 protocol not available");
return 1;
} else if(do_udp) {
/* regular udp socket */
if((s = make_sock_port(SOCK_DGRAM, ifname, port, hints, 1,
- &noip6, rcv, snd, reuseport)) == -1) {
+ &noip6, rcv, snd, reuseport, transparent)) == -1) {
if(noip6) {
log_warn("IPv6 protocol not available");
return 1;
atoi(strchr(ifname, '@')+1) == ssl_port) ||
(!strchr(ifname, '@') && atoi(port) == ssl_port));
if((s = make_sock_port(SOCK_STREAM, ifname, port, hints, 1,
- &noip6, 0, 0, reuseport)) == -1) {
+ &noip6, 0, 0, reuseport, transparent)) == -1) {
if(noip6) {
/*log_warn("IPv6 protocol not available");*/
return 1;
do_auto, cfg->do_udp, do_tcp,
&hints, portbuf, &list,
cfg->so_rcvbuf, cfg->so_sndbuf,
- cfg->ssl_port, reuseport)) {
+ cfg->ssl_port, reuseport,
+ cfg->ip_transparent)) {
listening_ports_free(list);
return NULL;
}
do_auto, cfg->do_udp, do_tcp,
&hints, portbuf, &list,
cfg->so_rcvbuf, cfg->so_sndbuf,
- cfg->ssl_port, reuseport)) {
+ cfg->ssl_port, reuseport,
+ cfg->ip_transparent)) {
listening_ports_free(list);
return NULL;
}
if(!ports_create_if(cfg->ifs[i], 0, cfg->do_udp,
do_tcp, &hints, portbuf, &list,
cfg->so_rcvbuf, cfg->so_sndbuf,
- cfg->ssl_port, reuseport)) {
+ cfg->ssl_port, reuseport,
+ cfg->ip_transparent)) {
listening_ports_free(list);
return NULL;
}
if(!ports_create_if(cfg->ifs[i], 0, cfg->do_udp,
do_tcp, &hints, portbuf, &list,
cfg->so_rcvbuf, cfg->so_sndbuf,
- cfg->ssl_port, reuseport)) {
+ cfg->ssl_port, reuseport,
+ cfg->ip_transparent)) {
listening_ports_free(list);
return NULL;
}
* set SO_REUSEADDR on it.
* @param reuseport: if nonNULL and true, try to set SO_REUSEPORT on
* listening UDP port. Set to false on return if it failed to do so.
+ * @param transparent: set IP_TRANSPARENT socket option.
* @return: the socket. -1 on error.
*/
int create_udp_sock(int family, int socktype, struct sockaddr* addr,
socklen_t addrlen, int v6only, int* inuse, int* noproto, int rcv,
- int snd, int listen, int* reuseport);
+ int snd, int listen, int* reuseport, int transparent);
/**
* Create and bind TCP listening socket
* @param noproto: if error caused by lack of protocol support.
* @param reuseport: if nonNULL and true, try to set SO_REUSEPORT on
* listening UDP port. Set to false on return if it failed to do so.
+ * @param transparent: set IP_TRANSPARENT socket option.
* @return: the socket. -1 on error.
*/
int create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto,
- int* reuseport);
+ int* reuseport, int transparent);
/**
* Create and bind local listening socket
*/
#include "config.h"
#include "services/localzone.h"
-#include "ldns/str2wire.h"
-#include "ldns/sbuffer.h"
+#include "sldns/str2wire.h"
+#include "sldns/sbuffer.h"
#include "util/regional.h"
#include "util/config_file.h"
#include "util/data/dname.h"
log_nametypeclass(0, "inform zone",
z->name, 0, z->dclass);
break;
+ case local_zone_inform_deny:
+ log_nametypeclass(0, "inform_deny zone",
+ z->name, 0, z->dclass);
+ break;
default:
log_nametypeclass(0, "badtyped zone",
z->name, 0, z->dclass);
struct edns_data* edns, sldns_buffer* buf, struct regional* temp,
struct local_data* ld)
{
- if(z->type == local_zone_deny) {
+ if(z->type == local_zone_deny || z->type == local_zone_inform_deny) {
/** no reply at all, signal caller by clearing buffer. */
sldns_buffer_clear(buf);
sldns_buffer_flip(buf);
lock_rw_rdlock(&z->lock);
lock_rw_unlock(&zones->lock);
- if(z->type == local_zone_inform && repinfo)
+ if((z->type == local_zone_inform || z->type == local_zone_inform_deny)
+ && repinfo)
lz_inform_print(z, qinfo, repinfo);
if(local_data_answer(z, qinfo, edns, buf, temp, labs, &ld)) {
case local_zone_static: return "static";
case local_zone_nodefault: return "nodefault";
case local_zone_inform: return "inform";
+ case local_zone_inform_deny: return "inform_deny";
}
return "badtyped";
}
*t = local_zone_redirect;
else if(strcmp(type, "inform") == 0)
*t = local_zone_inform;
+ else if(strcmp(type, "inform_deny") == 0)
+ *t = local_zone_inform_deny;
else return 0;
return 1;
}
* nodefault is used in config not during service. */
local_zone_nodefault,
/** log client address, but no block (transparent) */
- local_zone_inform
+ local_zone_inform,
+ /** log client address, and block (drop) */
+ local_zone_inform_deny
};
/**
#include "util/fptr_wlist.h"
#include "util/alloc.h"
#include "util/config_file.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
/** subtract timers and the values do not overflow or become negative */
static void
#include "util/net_help.h"
#include "util/random.h"
#include "util/fptr_wlist.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
#include "dnstap/dnstap.h"
#ifdef HAVE_OPENSSL_SSL_H
#include <openssl/ssl.h>
sa->sin6_port = (in_port_t)htons((uint16_t)port);
fd = create_udp_sock(AF_INET6, SOCK_DGRAM,
(struct sockaddr*)addr, addrlen, 1, inuse, &noproto,
- 0, 0, 0, NULL);
+ 0, 0, 0, NULL, 0);
} else {
struct sockaddr_in* sa = (struct sockaddr_in*)addr;
sa->sin_port = (in_port_t)htons((uint16_t)port);
fd = create_udp_sock(AF_INET, SOCK_DGRAM,
(struct sockaddr*)addr, addrlen, 1, inuse, &noproto,
- 0, 0, 0, NULL);
+ 0, 0, 0, NULL, 0);
}
return fd;
}
log_assert(rem); /* should have been present */
sq->to_be_deleted = 1;
verbose(VERB_ALGO, "svcd callbacks start");
- if(sq->outnet->use_caps_for_id && error == NETEVENT_NOERROR && c) {
+ if(sq->outnet->use_caps_for_id && error == NETEVENT_NOERROR && c &&
+ !sq->nocaps) {
/* noerror and nxdomain must have a qname in reply */
if(sldns_buffer_read_u16_at(c->buffer, 4) == 0 &&
(LDNS_RCODE_WIRE(sldns_buffer_begin(c->buffer))
infra_update_tcp_works(sq->outnet->infra, &sq->addr,
sq->addrlen, sq->zone, sq->zonelen);
#ifdef USE_DNSTAP
- if(sq->outnet->dtenv &&
+ if(error==NETEVENT_NOERROR && sq->outnet->dtenv &&
(sq->outnet->dtenv->log_resolver_response_messages ||
sq->outnet->dtenv->log_forwarder_response_messages))
dt_msg_send_outside_response(sq->outnet->dtenv, &sq->addr,
--- /dev/null
+/*
+ * keyraw.c - raw key operations and conversions
+ *
+ * (c) NLnet Labs, 2004-2008
+ *
+ * See the file LICENSE for the license
+ */
+/**
+ * \file
+ * Implementation of raw DNSKEY functions (work on wire rdata).
+ */
+
+#include "config.h"
+#include "sldns/keyraw.h"
+#include "sldns/rrdef.h"
+
+#ifdef HAVE_SSL
+#include <openssl/ssl.h>
+#include <openssl/evp.h>
+#include <openssl/rand.h>
+#include <openssl/err.h>
+#include <openssl/md5.h>
+#ifdef HAVE_OPENSSL_ENGINE_H
+# include <openssl/engine.h>
+#endif
+#endif /* HAVE_SSL */
+
+size_t
+sldns_rr_dnskey_key_size_raw(const unsigned char* keydata,
+ const size_t len, int alg)
+{
+ /* for DSA keys */
+ uint8_t t;
+
+ /* for RSA keys */
+ uint16_t exp;
+ uint16_t int16;
+
+ switch ((sldns_algorithm)alg) {
+ case LDNS_DSA:
+ case LDNS_DSA_NSEC3:
+ if (len > 0) {
+ t = keydata[0];
+ return (64 + t*8)*8;
+ } else {
+ return 0;
+ }
+ break;
+ case LDNS_RSAMD5:
+ case LDNS_RSASHA1:
+ case LDNS_RSASHA1_NSEC3:
+#ifdef USE_SHA2
+ case LDNS_RSASHA256:
+ case LDNS_RSASHA512:
+#endif
+ if (len > 0) {
+ if (keydata[0] == 0) {
+ /* big exponent */
+ if (len > 3) {
+ memmove(&int16, keydata + 1, 2);
+ exp = ntohs(int16);
+ return (len - exp - 3)*8;
+ } else {
+ return 0;
+ }
+ } else {
+ exp = keydata[0];
+ return (len-exp-1)*8;
+ }
+ } else {
+ return 0;
+ }
+ break;
+#ifdef USE_GOST
+ case LDNS_ECC_GOST:
+ return 512;
+#endif
+#ifdef USE_ECDSA
+ case LDNS_ECDSAP256SHA256:
+ return 256;
+ case LDNS_ECDSAP384SHA384:
+ return 384;
+#endif
+ default:
+ return 0;
+ }
+}
+
+uint16_t sldns_calc_keytag_raw(uint8_t* key, size_t keysize)
+{
+ if(keysize < 4) {
+ return 0;
+ }
+ /* look at the algorithm field, copied from 2535bis */
+ if (key[3] == LDNS_RSAMD5) {
+ uint16_t ac16 = 0;
+ if (keysize > 4) {
+ memmove(&ac16, key + keysize - 3, 2);
+ }
+ ac16 = ntohs(ac16);
+ return (uint16_t) ac16;
+ } else {
+ size_t i;
+ uint32_t ac32 = 0;
+ for (i = 0; i < keysize; ++i) {
+ ac32 += (i & 1) ? key[i] : key[i] << 8;
+ }
+ ac32 += (ac32 >> 16) & 0xFFFF;
+ return (uint16_t) (ac32 & 0xFFFF);
+ }
+}
+
+#ifdef HAVE_SSL
+#ifdef USE_GOST
+/** store GOST engine reference loaded into OpenSSL library */
+ENGINE* sldns_gost_engine = NULL;
+
+int
+sldns_key_EVP_load_gost_id(void)
+{
+ static int gost_id = 0;
+ const EVP_PKEY_ASN1_METHOD* meth;
+ ENGINE* e;
+
+ if(gost_id) return gost_id;
+
+ /* see if configuration loaded gost implementation from other engine*/
+ meth = EVP_PKEY_asn1_find_str(NULL, "gost2001", -1);
+ if(meth) {
+ EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth);
+ return gost_id;
+ }
+
+ /* see if engine can be loaded already */
+ e = ENGINE_by_id("gost");
+ if(!e) {
+ /* load it ourself, in case statically linked */
+ ENGINE_load_builtin_engines();
+ ENGINE_load_dynamic();
+ e = ENGINE_by_id("gost");
+ }
+ if(!e) {
+ /* no gost engine in openssl */
+ return 0;
+ }
+ if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
+ ENGINE_finish(e);
+ ENGINE_free(e);
+ return 0;
+ }
+
+ meth = EVP_PKEY_asn1_find_str(&e, "gost2001", -1);
+ if(!meth) {
+ /* algo not found */
+ ENGINE_finish(e);
+ ENGINE_free(e);
+ return 0;
+ }
+ /* Note: do not ENGINE_finish and ENGINE_free the acquired engine
+ * on some platforms this frees up the meth and unloads gost stuff */
+ sldns_gost_engine = e;
+
+ EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth);
+ return gost_id;
+}
+
+void sldns_key_EVP_unload_gost(void)
+{
+ if(sldns_gost_engine) {
+ ENGINE_finish(sldns_gost_engine);
+ ENGINE_free(sldns_gost_engine);
+ sldns_gost_engine = NULL;
+ }
+}
+#endif /* USE_GOST */
+
+DSA *
+sldns_key_buf2dsa_raw(unsigned char* key, size_t len)
+{
+ uint8_t T;
+ uint16_t length;
+ uint16_t offset;
+ DSA *dsa;
+ BIGNUM *Q; BIGNUM *P;
+ BIGNUM *G; BIGNUM *Y;
+
+ if(len == 0)
+ return NULL;
+ T = (uint8_t)key[0];
+ length = (64 + T * 8);
+ offset = 1;
+
+ if (T > 8) {
+ return NULL;
+ }
+ if(len < (size_t)1 + SHA_DIGEST_LENGTH + 3*length)
+ return NULL;
+
+ Q = BN_bin2bn(key+offset, SHA_DIGEST_LENGTH, NULL);
+ offset += SHA_DIGEST_LENGTH;
+
+ P = BN_bin2bn(key+offset, (int)length, NULL);
+ offset += length;
+
+ G = BN_bin2bn(key+offset, (int)length, NULL);
+ offset += length;
+
+ Y = BN_bin2bn(key+offset, (int)length, NULL);
+ offset += length;
+
+ /* create the key and set its properties */
+ if(!Q || !P || !G || !Y || !(dsa = DSA_new())) {
+ BN_free(Q);
+ BN_free(P);
+ BN_free(G);
+ BN_free(Y);
+ return NULL;
+ }
+#ifndef S_SPLINT_S
+ dsa->p = P;
+ dsa->q = Q;
+ dsa->g = G;
+ dsa->pub_key = Y;
+#endif /* splint */
+
+ return dsa;
+}
+
+RSA *
+sldns_key_buf2rsa_raw(unsigned char* key, size_t len)
+{
+ uint16_t offset;
+ uint16_t exp;
+ uint16_t int16;
+ RSA *rsa;
+ BIGNUM *modulus;
+ BIGNUM *exponent;
+
+ if (len == 0)
+ return NULL;
+ if (key[0] == 0) {
+ if(len < 3)
+ return NULL;
+ memmove(&int16, key+1, 2);
+ exp = ntohs(int16);
+ offset = 3;
+ } else {
+ exp = key[0];
+ offset = 1;
+ }
+
+ /* key length at least one */
+ if(len < (size_t)offset + exp + 1)
+ return NULL;
+
+ /* Exponent */
+ exponent = BN_new();
+ if(!exponent) return NULL;
+ (void) BN_bin2bn(key+offset, (int)exp, exponent);
+ offset += exp;
+
+ /* Modulus */
+ modulus = BN_new();
+ if(!modulus) {
+ BN_free(exponent);
+ return NULL;
+ }
+ /* length of the buffer must match the key length! */
+ (void) BN_bin2bn(key+offset, (int)(len - offset), modulus);
+
+ rsa = RSA_new();
+ if(!rsa) {
+ BN_free(exponent);
+ BN_free(modulus);
+ return NULL;
+ }
+#ifndef S_SPLINT_S
+ rsa->n = modulus;
+ rsa->e = exponent;
+#endif /* splint */
+
+ return rsa;
+}
+
+#ifdef USE_GOST
+EVP_PKEY*
+sldns_gost2pkey_raw(unsigned char* key, size_t keylen)
+{
+ /* prefix header for X509 encoding */
+ uint8_t asn[37] = { 0x30, 0x63, 0x30, 0x1c, 0x06, 0x06, 0x2a, 0x85,
+ 0x03, 0x02, 0x02, 0x13, 0x30, 0x12, 0x06, 0x07, 0x2a, 0x85,
+ 0x03, 0x02, 0x02, 0x23, 0x01, 0x06, 0x07, 0x2a, 0x85, 0x03,
+ 0x02, 0x02, 0x1e, 0x01, 0x03, 0x43, 0x00, 0x04, 0x40};
+ unsigned char encoded[37+64];
+ const unsigned char* pp;
+ if(keylen != 64) {
+ /* key wrong size */
+ return NULL;
+ }
+
+ /* create evp_key */
+ memmove(encoded, asn, 37);
+ memmove(encoded+37, key, 64);
+ pp = (unsigned char*)&encoded[0];
+
+ return d2i_PUBKEY(NULL, &pp, (int)sizeof(encoded));
+}
+#endif /* USE_GOST */
+
+#ifdef USE_ECDSA
+EVP_PKEY*
+sldns_ecdsa2pkey_raw(unsigned char* key, size_t keylen, uint8_t algo)
+{
+ unsigned char buf[256+2]; /* sufficient for 2*384/8+1 */
+ const unsigned char* pp = buf;
+ EVP_PKEY *evp_key;
+ EC_KEY *ec;
+ /* check length, which uncompressed must be 2 bignums */
+ if(algo == LDNS_ECDSAP256SHA256) {
+ if(keylen != 2*256/8) return NULL;
+ ec = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
+ } else if(algo == LDNS_ECDSAP384SHA384) {
+ if(keylen != 2*384/8) return NULL;
+ ec = EC_KEY_new_by_curve_name(NID_secp384r1);
+ } else ec = NULL;
+ if(!ec) return NULL;
+ if(keylen+1 > sizeof(buf)) { /* sanity check */
+ EC_KEY_free(ec);
+ return NULL;
+ }
+ /* prepend the 0x02 (from docs) (or actually 0x04 from implementation
+ * of openssl) for uncompressed data */
+ buf[0] = POINT_CONVERSION_UNCOMPRESSED;
+ memmove(buf+1, key, keylen);
+ if(!o2i_ECPublicKey(&ec, &pp, (int)keylen+1)) {
+ EC_KEY_free(ec);
+ return NULL;
+ }
+ evp_key = EVP_PKEY_new();
+ if(!evp_key) {
+ EC_KEY_free(ec);
+ return NULL;
+ }
+ if (!EVP_PKEY_assign_EC_KEY(evp_key, ec)) {
+ EVP_PKEY_free(evp_key);
+ EC_KEY_free(ec);
+ return NULL;
+ }
+ return evp_key;
+}
+#endif /* USE_ECDSA */
+
+int
+sldns_digest_evp(unsigned char* data, unsigned int len, unsigned char* dest,
+ const EVP_MD* md)
+{
+ EVP_MD_CTX* ctx;
+ ctx = EVP_MD_CTX_create();
+ if(!ctx)
+ return 0;
+ if(!EVP_DigestInit_ex(ctx, md, NULL) ||
+ !EVP_DigestUpdate(ctx, data, len) ||
+ !EVP_DigestFinal_ex(ctx, dest, NULL)) {
+ EVP_MD_CTX_destroy(ctx);
+ return 0;
+ }
+ EVP_MD_CTX_destroy(ctx);
+ return 1;
+}
+#endif /* HAVE_SSL */
--- /dev/null
+/*
+ * keyraw.h -- raw key and signature access and conversion
+ *
+ * Copyright (c) 2005-2008, NLnet Labs. All rights reserved.
+ *
+ * See LICENSE for the license.
+ *
+ */
+
+/**
+ * \file
+ *
+ * raw key and signature access and conversion
+ *
+ * Since those functions heavily rely op cryptographic operations,
+ * this module is dependent on openssl.
+ *
+ */
+
+#ifndef LDNS_KEYRAW_H
+#define LDNS_KEYRAW_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if LDNS_BUILD_CONFIG_HAVE_SSL
+# include <openssl/ssl.h>
+# include <openssl/evp.h>
+#endif /* LDNS_BUILD_CONFIG_HAVE_SSL */
+
+/**
+ * get the length of the keydata in bits
+ * \param[in] keydata the raw key data
+ * \param[in] len the length of the keydata
+ * \param[in] alg the cryptographic algorithm this is a key for
+ * \return the keysize in bits, or 0 on error
+ */
+size_t sldns_rr_dnskey_key_size_raw(const unsigned char *keydata,
+ const size_t len, int alg);
+
+/**
+ * Calculates keytag of DNSSEC key, operates on wireformat rdata.
+ * \param[in] key the key as uncompressed wireformat rdata.
+ * \param[in] keysize length of key data.
+ * \return the keytag
+ */
+uint16_t sldns_calc_keytag_raw(uint8_t* key, size_t keysize);
+
+#if LDNS_BUILD_CONFIG_HAVE_SSL
+/**
+ * Get the PKEY id for GOST, loads GOST into openssl as a side effect.
+ * Only available if GOST is compiled into the library and openssl.
+ * \return the gost id for EVP_CTX creation.
+ */
+int sldns_key_EVP_load_gost_id(void);
+
+/** Release the engine reference held for the GOST engine. */
+void sldns_key_EVP_unload_gost(void);
+
+/**
+ * Like sldns_key_buf2dsa, but uses raw buffer.
+ * \param[in] key the uncompressed wireformat of the key.
+ * \param[in] len length of key data
+ * \return a DSA * structure with the key material
+ */
+DSA *sldns_key_buf2dsa_raw(unsigned char* key, size_t len);
+
+/**
+ * Converts a holding buffer with key material to EVP PKEY in openssl.
+ * Only available if ldns was compiled with GOST.
+ * \param[in] key data to convert
+ * \param[in] keylen length of the key data
+ * \return the key or NULL on error.
+ */
+EVP_PKEY* sldns_gost2pkey_raw(unsigned char* key, size_t keylen);
+
+/**
+ * Converts a holding buffer with key material to EVP PKEY in openssl.
+ * Only available if ldns was compiled with ECDSA.
+ * \param[in] key data to convert
+ * \param[in] keylen length of the key data
+ * \param[in] algo precise algorithm to initialize ECC group values.
+ * \return the key or NULL on error.
+ */
+EVP_PKEY* sldns_ecdsa2pkey_raw(unsigned char* key, size_t keylen, uint8_t algo);
+
+/**
+ * Like sldns_key_buf2rsa, but uses raw buffer.
+ * \param[in] key the uncompressed wireformat of the key.
+ * \param[in] len length of key data
+ * \return a RSA * structure with the key material
+ */
+RSA *sldns_key_buf2rsa_raw(unsigned char* key, size_t len);
+
+/**
+ * Utility function to calculate hash using generic EVP_MD pointer.
+ * \param[in] data the data to hash.
+ * \param[in] len length of data.
+ * \param[out] dest the destination of the hash, must be large enough.
+ * \param[in] md the message digest to use.
+ * \return true if worked, false on failure.
+ */
+int sldns_digest_evp(unsigned char* data, unsigned int len,
+ unsigned char* dest, const EVP_MD* md);
+
+#endif /* LDNS_BUILD_CONFIG_HAVE_SSL */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LDNS_KEYRAW_H */
--- /dev/null
+/*
+ * a generic (simple) parser. Use to parse rr's, private key
+ * information and /etc/resolv.conf files
+ *
+ * a Net::DNS like library for C
+ * LibDNS Team @ NLnet Labs
+ * (c) NLnet Labs, 2005-2006
+ * See the file LICENSE for the license
+ */
+#include "config.h"
+#include "sldns/parse.h"
+#include "sldns/parseutil.h"
+#include "sldns/sbuffer.h"
+
+#include <limits.h>
+#include <strings.h>
+
+sldns_lookup_table sldns_directive_types[] = {
+ { LDNS_DIR_TTL, "$TTL" },
+ { LDNS_DIR_ORIGIN, "$ORIGIN" },
+ { LDNS_DIR_INCLUDE, "$INCLUDE" },
+ { 0, NULL }
+};
+
+/* add max_limit here? */
+ssize_t
+sldns_fget_token(FILE *f, char *token, const char *delim, size_t limit)
+{
+ return sldns_fget_token_l(f, token, delim, limit, NULL);
+}
+
+ssize_t
+sldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr)
+{
+ int c, prev_c;
+ int p; /* 0 -> no parenthese seen, >0 nr of ( seen */
+ int com, quoted;
+ char *t;
+ size_t i;
+ const char *d;
+ const char *del;
+
+ /* standard delimeters */
+ if (!delim) {
+ /* from isspace(3) */
+ del = LDNS_PARSE_NORMAL;
+ } else {
+ del = delim;
+ }
+
+ p = 0;
+ i = 0;
+ com = 0;
+ quoted = 0;
+ prev_c = 0;
+ t = token;
+ if (del[0] == '"') {
+ quoted = 1;
+ }
+ while ((c = getc(f)) != EOF) {
+ if (c == '\r') /* carriage return */
+ c = ' ';
+ if (c == '(' && prev_c != '\\' && !quoted) {
+ /* this only counts for non-comments */
+ if (com == 0) {
+ p++;
+ }
+ prev_c = c;
+ continue;
+ }
+
+ if (c == ')' && prev_c != '\\' && !quoted) {
+ /* this only counts for non-comments */
+ if (com == 0) {
+ p--;
+ }
+ prev_c = c;
+ continue;
+ }
+
+ if (p < 0) {
+ /* more ) then ( - close off the string */
+ *t = '\0';
+ return 0;
+ }
+
+ /* do something with comments ; */
+ if (c == ';' && quoted == 0) {
+ if (prev_c != '\\') {
+ com = 1;
+ }
+ }
+ if (c == '\"' && com == 0 && prev_c != '\\') {
+ quoted = 1 - quoted;
+ }
+
+ if (c == '\n' && com != 0) {
+ /* comments */
+ com = 0;
+ *t = ' ';
+ if (line_nr) {
+ *line_nr = *line_nr + 1;
+ }
+ if (p == 0 && i > 0) {
+ goto tokenread;
+ } else {
+ prev_c = c;
+ continue;
+ }
+ }
+
+ if (com == 1) {
+ *t = ' ';
+ prev_c = c;
+ continue;
+ }
+
+ if (c == '\n' && p != 0 && t > token) {
+ /* in parentheses */
+ if (line_nr) {
+ *line_nr = *line_nr + 1;
+ }
+ *t++ = ' ';
+ prev_c = c;
+ continue;
+ }
+
+ /* check if we hit the delim */
+ for (d = del; *d; d++) {
+ if (c == *d && i > 0 && prev_c != '\\' && p == 0) {
+ if (c == '\n' && line_nr) {
+ *line_nr = *line_nr + 1;
+ }
+ goto tokenread;
+ }
+ }
+ if (c != '\0' && c != '\n') {
+ i++;
+ }
+ if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) {
+ *t = '\0';
+ return -1;
+ }
+ if (c != '\0' && c != '\n') {
+ *t++ = c;
+ }
+ if (c == '\\' && prev_c == '\\')
+ prev_c = 0;
+ else prev_c = c;
+ }
+ *t = '\0';
+ if (c == EOF) {
+ return (ssize_t)i;
+ }
+
+ if (i == 0) {
+ /* nothing read */
+ return -1;
+ }
+ if (p != 0) {
+ return -1;
+ }
+ return (ssize_t)i;
+
+tokenread:
+ if(*del == '"')
+ /* do not skip over quotes after the string, they are part
+ * of the next string. But skip over whitespace (if needed)*/
+ sldns_fskipcs_l(f, del+1, line_nr);
+ else sldns_fskipcs_l(f, del, line_nr);
+ *t = '\0';
+ if (p != 0) {
+ return -1;
+ }
+
+ return (ssize_t)i;
+}
+
+ssize_t
+sldns_fget_keyword_data(FILE *f, const char *keyword, const char *k_del, char *data,
+ const char *d_del, size_t data_limit)
+{
+ return sldns_fget_keyword_data_l(f, keyword, k_del, data, d_del,
+ data_limit, NULL);
+}
+
+ssize_t
+sldns_fget_keyword_data_l(FILE *f, const char *keyword, const char *k_del, char *data,
+ const char *d_del, size_t data_limit, int *line_nr)
+{
+ /* we assume: keyword|sep|data */
+ char *fkeyword;
+ ssize_t i;
+
+ if(strlen(keyword) >= LDNS_MAX_KEYWORDLEN)
+ return -1;
+ fkeyword = (char*)malloc(LDNS_MAX_KEYWORDLEN);
+ if(!fkeyword)
+ return -1;
+
+ i = sldns_fget_token(f, fkeyword, k_del, LDNS_MAX_KEYWORDLEN);
+ if(i==0 || i==-1) {
+ free(fkeyword);
+ return -1;
+ }
+
+ /* case??? i instead of strlen? */
+ if (strncmp(fkeyword, keyword, LDNS_MAX_KEYWORDLEN - 1) == 0) {
+ /* whee! */
+ /* printf("%s\n%s\n", "Matching keyword", fkeyword); */
+ i = sldns_fget_token_l(f, data, d_del, data_limit, line_nr);
+ free(fkeyword);
+ return i;
+ } else {
+ /*printf("no match for %s (read: %s)\n", keyword, fkeyword);*/
+ free(fkeyword);
+ return -1;
+ }
+}
+
+int
+sldns_bgetc(sldns_buffer *buffer)
+{
+ if (!sldns_buffer_available_at(buffer, buffer->_position, sizeof(uint8_t))) {
+ sldns_buffer_set_position(buffer, sldns_buffer_limit(buffer));
+ /* sldns_buffer_rewind(buffer);*/
+ return EOF;
+ }
+ return (int)sldns_buffer_read_u8(buffer);
+}
+
+ssize_t
+sldns_bget_token(sldns_buffer *b, char *token, const char *delim, size_t limit)
+{
+ return sldns_bget_token_par(b, token, delim, limit, NULL, NULL);
+}
+
+ssize_t
+sldns_bget_token_par(sldns_buffer *b, char *token, const char *delim,
+ size_t limit, int* par, const char* skipw)
+{
+ int c, lc;
+ int p; /* 0 -> no parenthese seen, >0 nr of ( seen */
+ int com, quoted;
+ char *t;
+ size_t i;
+ const char *d;
+ const char *del;
+
+ /* standard delimiters */
+ if (!delim) {
+ /* from isspace(3) */
+ del = LDNS_PARSE_NORMAL;
+ } else {
+ del = delim;
+ }
+
+ p = (par?*par:0);
+ i = 0;
+ com = 0;
+ quoted = 0;
+ t = token;
+ lc = 0;
+ if (del[0] == '"') {
+ quoted = 1;
+ }
+
+ while ((c = sldns_bgetc(b)) != EOF) {
+ if (c == '\r') /* carriage return */
+ c = ' ';
+ if (c == '(' && lc != '\\' && !quoted) {
+ /* this only counts for non-comments */
+ if (com == 0) {
+ if(par) (*par)++;
+ p++;
+ }
+ lc = c;
+ continue;
+ }
+
+ if (c == ')' && lc != '\\' && !quoted) {
+ /* this only counts for non-comments */
+ if (com == 0) {
+ if(par) (*par)--;
+ p--;
+ }
+ lc = c;
+ continue;
+ }
+
+ if (p < 0) {
+ /* more ) then ( */
+ *t = '\0';
+ return 0;
+ }
+
+ /* do something with comments ; */
+ if (c == ';' && quoted == 0) {
+ if (lc != '\\') {
+ com = 1;
+ }
+ }
+ if (c == '"' && com == 0 && lc != '\\') {
+ quoted = 1 - quoted;
+ }
+
+ if (c == '\n' && com != 0) {
+ /* comments */
+ com = 0;
+ *t = ' ';
+ lc = c;
+ continue;
+ }
+
+ if (com == 1) {
+ *t = ' ';
+ lc = c;
+ continue;
+ }
+
+ if (c == '\n' && p != 0) {
+ /* in parentheses */
+ /* do not write ' ' if we want to skip spaces */
+ if(!(skipw && (strchr(skipw, c)||strchr(skipw, ' '))))
+ *t++ = ' ';
+ lc = c;
+ continue;
+ }
+
+ /* check to skip whitespace at start, but also after ( */
+ if(skipw && i==0 && !com && !quoted && lc != '\\') {
+ if(strchr(skipw, c)) {
+ lc = c;
+ continue;
+ }
+ }
+
+ /* check if we hit the delim */
+ for (d = del; *d; d++) {
+ /* we can only exit if no parens or user tracks them */
+ if (c == *d && lc != '\\' && (p == 0 || par)) {
+ goto tokenread;
+ }
+ }
+
+ i++;
+ if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) {
+ *t = '\0';
+ return -1;
+ }
+ *t++ = c;
+
+ if (c == '\\' && lc == '\\') {
+ lc = 0;
+ } else {
+ lc = c;
+ }
+ }
+ *t = '\0';
+ if (i == 0) {
+ /* nothing read */
+ return -1;
+ }
+ if (!par && p != 0) {
+ return -1;
+ }
+ return (ssize_t)i;
+
+tokenread:
+ if(*del == '"')
+ /* do not skip over quotes after the string, they are part
+ * of the next string. But skip over whitespace (if needed)*/
+ sldns_bskipcs(b, del+1);
+ else sldns_bskipcs(b, del);
+ *t = '\0';
+
+ if (!par && p != 0) {
+ return -1;
+ }
+ return (ssize_t)i;
+}
+
+
+void
+sldns_bskipcs(sldns_buffer *buffer, const char *s)
+{
+ int found;
+ char c;
+ const char *d;
+
+ while(sldns_buffer_available_at(buffer, buffer->_position, sizeof(char))) {
+ c = (char) sldns_buffer_read_u8_at(buffer, buffer->_position);
+ found = 0;
+ for (d = s; *d; d++) {
+ if (*d == c) {
+ found = 1;
+ }
+ }
+ if (found && buffer->_limit > buffer->_position) {
+ buffer->_position += sizeof(char);
+ } else {
+ return;
+ }
+ }
+}
+
+void
+sldns_fskipcs(FILE *fp, const char *s)
+{
+ sldns_fskipcs_l(fp, s, NULL);
+}
+
+void
+sldns_fskipcs_l(FILE *fp, const char *s, int *line_nr)
+{
+ int found;
+ int c;
+ const char *d;
+
+ while ((c = fgetc(fp)) != EOF) {
+ if (line_nr && c == '\n') {
+ *line_nr = *line_nr + 1;
+ }
+ found = 0;
+ for (d = s; *d; d++) {
+ if (*d == c) {
+ found = 1;
+ }
+ }
+ if (!found) {
+ /* with getc, we've read too far */
+ ungetc(c, fp);
+ return;
+ }
+ }
+}
+
+ssize_t
+sldns_bget_keyword_data(sldns_buffer *b, const char *keyword, const char *k_del, char
+*data, const char *d_del, size_t data_limit)
+{
+ /* we assume: keyword|sep|data */
+ char *fkeyword;
+ ssize_t i;
+
+ if(strlen(keyword) >= LDNS_MAX_KEYWORDLEN)
+ return -1;
+ fkeyword = (char*)malloc(LDNS_MAX_KEYWORDLEN);
+ if(!fkeyword)
+ return -1; /* out of memory */
+
+ i = sldns_bget_token(b, fkeyword, k_del, data_limit);
+ if(i==0 || i==-1) {
+ free(fkeyword);
+ return -1; /* nothing read */
+ }
+
+ /* case??? */
+ if (strncmp(fkeyword, keyword, strlen(keyword)) == 0) {
+ free(fkeyword);
+ /* whee, the match! */
+ /* retrieve it's data */
+ i = sldns_bget_token(b, data, d_del, 0);
+ return i;
+ } else {
+ free(fkeyword);
+ return -1;
+ }
+}
+
--- /dev/null
+/*
+ * parse.h
+ *
+ * a Net::DNS like library for C
+ * LibDNS Team @ NLnet Labs
+ * (c) NLnet Labs, 2005-2006
+ * See the file LICENSE for the license
+ */
+
+#ifndef LDNS_PARSE_H
+#define LDNS_PARSE_H
+
+struct sldns_buffer;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LDNS_PARSE_SKIP_SPACE "\f\n\r\v"
+#define LDNS_PARSE_NORMAL " \f\n\r\t\v"
+#define LDNS_PARSE_NO_NL " \t"
+#define LDNS_MAX_LINELEN 10230
+#define LDNS_MAX_KEYWORDLEN 32
+
+
+/**
+ * \file
+ *
+ * Contains some low-level parsing functions, mostly used in the _frm_str
+ * family of functions.
+ */
+
+/**
+ * different type of directives in zone files
+ * We now deal with $TTL, $ORIGIN and $INCLUDE.
+ * The latter is not implemented in ldns (yet)
+ */
+enum sldns_enum_directive
+{
+ LDNS_DIR_TTL,
+ LDNS_DIR_ORIGIN,
+ LDNS_DIR_INCLUDE
+};
+typedef enum sldns_enum_directive sldns_directive;
+
+/**
+ * returns a token/char from the stream F.
+ * This function deals with ( and ) in the stream,
+ * and ignores them when encountered
+ * \param[in] *f the file to read from
+ * \param[out] *token the read token is put here
+ * \param[in] *delim chars at which the parsing should stop
+ * \param[in] *limit how much to read. If 0 the builtin maximum is used
+ * \return 0 on error of EOF of the stream F. Otherwise return the length of what is read
+ */
+ssize_t sldns_fget_token(FILE *f, char *token, const char *delim, size_t limit);
+
+/**
+ * returns a token/char from the stream F.
+ * This function deals with ( and ) in the stream,
+ * and ignores when it finds them.
+ * \param[in] *f the file to read from
+ * \param[out] *token the token is put here
+ * \param[in] *delim chars at which the parsing should stop
+ * \param[in] *limit how much to read. If 0 use builtin maximum
+ * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes)
+ * \return 0 on error of EOF of F otherwise return the length of what is read
+ */
+ssize_t sldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr);
+
+/**
+ * returns a token/char from the buffer b.
+ * This function deals with ( and ) in the buffer,
+ * and ignores when it finds them.
+ * \param[in] *b the buffer to read from
+ * \param[out] *token the token is put here
+ * \param[in] *delim chars at which the parsing should stop
+ * \param[in] *limit how much to read. If 0 the builtin maximum is used
+ * \param[in] *par if you pass nonNULL, set to 0 on first call, the parenthesis
+ * state is stored in it, for use on next call. User must check it is back
+ * to zero after last bget in string (for parse error). If you pass NULL,
+ * the entire parenthesized string is read in.
+ * \param[in] skipw string with whitespace to skip before the start of the
+ * token, like " ", or " \t", or NULL for none.
+ * \returns 0 on error of EOF of b. Otherwise return the length of what is read
+ */
+ssize_t sldns_bget_token_par(struct sldns_buffer *b, char *token, const char *delim, size_t limit, int* par, const char* skipw);
+
+/**
+ * returns a token/char from the buffer b.
+ * This function deals with ( and ) in the buffer,
+ * and ignores when it finds them.
+ * \param[in] *b the buffer to read from
+ * \param[out] *token the token is put here
+ * \param[in] *delim chars at which the parsing should stop
+ * \param[in] *limit how much to read. If 0 the builtin maximum is used
+ * \returns 0 on error of EOF of b. Otherwise return the length of what is read
+ */
+ssize_t sldns_bget_token(struct sldns_buffer *b, char *token, const char *delim, size_t limit);
+
+/*
+ * searches for keyword and delim in a file. Gives everything back
+ * after the keyword + k_del until we hit d_del
+ * \param[in] f file pointer to read from
+ * \param[in] keyword keyword to look for
+ * \param[in] k_del keyword delimeter
+ * \param[out] data the data found
+ * \param[in] d_del the data delimeter
+ * \param[in] data_limit maximum size the the data buffer
+ * \return the number of character read
+ */
+ssize_t sldns_fget_keyword_data(FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit);
+
+/*
+ * searches for keyword and delim. Gives everything back
+ * after the keyword + k_del until we hit d_del
+ * \param[in] f file pointer to read from
+ * \param[in] keyword keyword to look for
+ * \param[in] k_del keyword delimeter
+ * \param[out] data the data found
+ * \param[in] d_del the data delimeter
+ * \param[in] data_limit maximum size the the data buffer
+ * \param[in] line_nr pointer to an integer containing the current line number (for
+debugging purposes)
+ * \return the number of character read
+ */
+ssize_t sldns_fget_keyword_data_l(FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit, int *line_nr);
+
+/*
+ * searches for keyword and delim in a buffer. Gives everything back
+ * after the keyword + k_del until we hit d_del
+ * \param[in] b buffer pointer to read from
+ * \param[in] keyword keyword to look for
+ * \param[in] k_del keyword delimeter
+ * \param[out] data the data found
+ * \param[in] d_del the data delimeter
+ * \param[in] data_limit maximum size the the data buffer
+ * \return the number of character read
+ */
+ssize_t sldns_bget_keyword_data(struct sldns_buffer *b, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit);
+
+/**
+ * returns the next character from a buffer. Advances the position pointer with 1.
+ * When end of buffer is reached returns EOF. This is the buffer's equivalent
+ * for getc().
+ * \param[in] *buffer buffer to read from
+ * \return EOF on failure otherwise return the character
+ */
+int sldns_bgetc(struct sldns_buffer *buffer);
+
+/**
+ * skips all of the characters in the given string in the buffer, moving
+ * the position to the first character that is not in *s.
+ * \param[in] *buffer buffer to use
+ * \param[in] *s characters to skip
+ * \return void
+ */
+void sldns_bskipcs(struct sldns_buffer *buffer, const char *s);
+
+/**
+ * skips all of the characters in the given string in the fp, moving
+ * the position to the first character that is not in *s.
+ * \param[in] *fp file to use
+ * \param[in] *s characters to skip
+ * \return void
+ */
+void sldns_fskipcs(FILE *fp, const char *s);
+
+
+/**
+ * skips all of the characters in the given string in the fp, moving
+ * the position to the first character that is not in *s.
+ * \param[in] *fp file to use
+ * \param[in] *s characters to skip
+ * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes)
+ * \return void
+ */
+void sldns_fskipcs_l(FILE *fp, const char *s, int *line_nr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LDNS_PARSE_H */
--- /dev/null
+/*
+ * parseutil.c - parse utilities for string and wire conversion
+ *
+ * (c) NLnet Labs, 2004-2006
+ *
+ * See the file LICENSE for the license
+ */
+/**
+ * \file
+ *
+ * Utility functions for parsing, base32(DNS variant) and base64 encoding
+ * and decoding, Hex, Time units, Escape codes.
+ */
+
+#include "config.h"
+#include "sldns/parseutil.h"
+#include <sys/time.h>
+#include <time.h>
+#include <ctype.h>
+
+sldns_lookup_table *
+sldns_lookup_by_name(sldns_lookup_table *table, const char *name)
+{
+ while (table->name != NULL) {
+ if (strcasecmp(name, table->name) == 0)
+ return table;
+ table++;
+ }
+ return NULL;
+}
+
+sldns_lookup_table *
+sldns_lookup_by_id(sldns_lookup_table *table, int id)
+{
+ while (table->name != NULL) {
+ if (table->id == id)
+ return table;
+ table++;
+ }
+ return NULL;
+}
+
+/* Number of days per month (except for February in leap years). */
+static const int mdays[] = {
+ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+};
+
+#define LDNS_MOD(x,y) (((x) % (y) < 0) ? ((x) % (y) + (y)) : ((x) % (y)))
+#define LDNS_DIV(x,y) (((x) % (y) < 0) ? ((x) / (y) - 1 ) : ((x) / (y)))
+
+static int
+is_leap_year(int year)
+{
+ return LDNS_MOD(year, 4) == 0 && (LDNS_MOD(year, 100) != 0
+ || LDNS_MOD(year, 400) == 0);
+}
+
+static int
+leap_days(int y1, int y2)
+{
+ --y1;
+ --y2;
+ return (LDNS_DIV(y2, 4) - LDNS_DIV(y1, 4)) -
+ (LDNS_DIV(y2, 100) - LDNS_DIV(y1, 100)) +
+ (LDNS_DIV(y2, 400) - LDNS_DIV(y1, 400));
+}
+
+/*
+ * Code adapted from Python 2.4.1 sources (Lib/calendar.py).
+ */
+time_t
+sldns_mktime_from_utc(const struct tm *tm)
+{
+ int year = 1900 + tm->tm_year;
+ time_t days = 365 * ((time_t) year - 1970) + leap_days(1970, year);
+ time_t hours;
+ time_t minutes;
+ time_t seconds;
+ int i;
+
+ for (i = 0; i < tm->tm_mon; ++i) {
+ days += mdays[i];
+ }
+ if (tm->tm_mon > 1 && is_leap_year(year)) {
+ ++days;
+ }
+ days += tm->tm_mday - 1;
+
+ hours = days * 24 + tm->tm_hour;
+ minutes = hours * 60 + tm->tm_min;
+ seconds = minutes * 60 + tm->tm_sec;
+
+ return seconds;
+}
+
+#if SIZEOF_TIME_T <= 4
+
+static void
+sldns_year_and_yday_from_days_since_epoch(int64_t days, struct tm *result)
+{
+ int year = 1970;
+ int new_year;
+
+ while (days < 0 || days >= (int64_t) (is_leap_year(year) ? 366 : 365)) {
+ new_year = year + (int) LDNS_DIV(days, 365);
+ days -= (new_year - year) * 365;
+ days -= leap_days(year, new_year);
+ year = new_year;
+ }
+ result->tm_year = year;
+ result->tm_yday = (int) days;
+}
+
+/* Number of days per month in a leap year. */
+static const int leap_year_mdays[] = {
+ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+};
+
+static void
+sldns_mon_and_mday_from_year_and_yday(struct tm *result)
+{
+ int idays = result->tm_yday;
+ const int *mon_lengths = is_leap_year(result->tm_year) ?
+ leap_year_mdays : mdays;
+
+ result->tm_mon = 0;
+ while (idays >= mon_lengths[result->tm_mon]) {
+ idays -= mon_lengths[result->tm_mon++];
+ }
+ result->tm_mday = idays + 1;
+}
+
+static void
+sldns_wday_from_year_and_yday(struct tm *result)
+{
+ result->tm_wday = 4 /* 1-1-1970 was a thursday */
+ + LDNS_MOD((result->tm_year - 1970), 7) * LDNS_MOD(365, 7)
+ + leap_days(1970, result->tm_year)
+ + result->tm_yday;
+ result->tm_wday = LDNS_MOD(result->tm_wday, 7);
+ if (result->tm_wday < 0) {
+ result->tm_wday += 7;
+ }
+}
+
+static struct tm *
+sldns_gmtime64_r(int64_t clock, struct tm *result)
+{
+ result->tm_isdst = 0;
+ result->tm_sec = (int) LDNS_MOD(clock, 60);
+ clock = LDNS_DIV(clock, 60);
+ result->tm_min = (int) LDNS_MOD(clock, 60);
+ clock = LDNS_DIV(clock, 60);
+ result->tm_hour = (int) LDNS_MOD(clock, 24);
+ clock = LDNS_DIV(clock, 24);
+
+ sldns_year_and_yday_from_days_since_epoch(clock, result);
+ sldns_mon_and_mday_from_year_and_yday(result);
+ sldns_wday_from_year_and_yday(result);
+ result->tm_year -= 1900;
+
+ return result;
+}
+
+#endif /* SIZEOF_TIME_T <= 4 */
+
+static int64_t
+sldns_serial_arithmitics_time(int32_t time, time_t now)
+{
+ int32_t offset = time - (int32_t) now;
+ return (int64_t) now + offset;
+}
+
+struct tm *
+sldns_serial_arithmitics_gmtime_r(int32_t time, time_t now, struct tm *result)
+{
+#if SIZEOF_TIME_T <= 4
+ int64_t secs_since_epoch = sldns_serial_arithmitics_time(time, now);
+ return sldns_gmtime64_r(secs_since_epoch, result);
+#else
+ time_t secs_since_epoch = sldns_serial_arithmitics_time(time, now);
+ return gmtime_r(&secs_since_epoch, result);
+#endif
+}
+
+int
+sldns_hexdigit_to_int(char ch)
+{
+ switch (ch) {
+ case '0': return 0;
+ case '1': return 1;
+ case '2': return 2;
+ case '3': return 3;
+ case '4': return 4;
+ case '5': return 5;
+ case '6': return 6;
+ case '7': return 7;
+ case '8': return 8;
+ case '9': return 9;
+ case 'a': case 'A': return 10;
+ case 'b': case 'B': return 11;
+ case 'c': case 'C': return 12;
+ case 'd': case 'D': return 13;
+ case 'e': case 'E': return 14;
+ case 'f': case 'F': return 15;
+ default:
+ return -1;
+ }
+}
+
+uint32_t
+sldns_str2period(const char *nptr, const char **endptr)
+{
+ int sign = 0;
+ uint32_t i = 0;
+ uint32_t seconds = 0;
+
+ for(*endptr = nptr; **endptr; (*endptr)++) {
+ switch (**endptr) {
+ case ' ':
+ case '\t':
+ break;
+ case '-':
+ if(sign == 0) {
+ sign = -1;
+ } else {
+ return seconds;
+ }
+ break;
+ case '+':
+ if(sign == 0) {
+ sign = 1;
+ } else {
+ return seconds;
+ }
+ break;
+ case 's':
+ case 'S':
+ seconds += i;
+ i = 0;
+ break;
+ case 'm':
+ case 'M':
+ seconds += i * 60;
+ i = 0;
+ break;
+ case 'h':
+ case 'H':
+ seconds += i * 60 * 60;
+ i = 0;
+ break;
+ case 'd':
+ case 'D':
+ seconds += i * 60 * 60 * 24;
+ i = 0;
+ break;
+ case 'w':
+ case 'W':
+ seconds += i * 60 * 60 * 24 * 7;
+ i = 0;
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ i *= 10;
+ i += (**endptr - '0');
+ break;
+ default:
+ seconds += i;
+ /* disregard signedness */
+ return seconds;
+ }
+ }
+ seconds += i;
+ /* disregard signedness */
+ return seconds;
+}
+
+int
+sldns_parse_escape(uint8_t *ch_p, const char** str_p)
+{
+ uint16_t val;
+
+ if ((*str_p)[0] && isdigit((unsigned char)(*str_p)[0]) &&
+ (*str_p)[1] && isdigit((unsigned char)(*str_p)[1]) &&
+ (*str_p)[2] && isdigit((unsigned char)(*str_p)[2])) {
+
+ val = (uint16_t)(((*str_p)[0] - '0') * 100 +
+ ((*str_p)[1] - '0') * 10 +
+ ((*str_p)[2] - '0'));
+
+ if (val > 255) {
+ goto error;
+ }
+ *ch_p = (uint8_t)val;
+ *str_p += 3;
+ return 1;
+
+ } else if ((*str_p)[0] && !isdigit((unsigned char)(*str_p)[0])) {
+
+ *ch_p = (uint8_t)*(*str_p)++;
+ return 1;
+ }
+error:
+ *str_p = NULL;
+ return 0; /* LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE */
+}
+
+/** parse one character, with escape codes */
+int
+sldns_parse_char(uint8_t *ch_p, const char** str_p)
+{
+ switch (**str_p) {
+
+ case '\0': return 0;
+
+ case '\\': *str_p += 1;
+ return sldns_parse_escape(ch_p, str_p);
+
+ default: *ch_p = (uint8_t)*(*str_p)++;
+ return 1;
+ }
+}
+
+size_t sldns_b32_ntop_calculate_size(size_t src_data_length)
+{
+ return src_data_length == 0 ? 0 : ((src_data_length - 1) / 5 + 1) * 8;
+}
+
+size_t sldns_b32_ntop_calculate_size_no_padding(size_t src_data_length)
+{
+ return ((src_data_length + 3) * 8 / 5) - 4;
+}
+
+static int
+sldns_b32_ntop_base(const uint8_t* src, size_t src_sz, char* dst, size_t dst_sz,
+ int extended_hex, int add_padding)
+{
+ size_t ret_sz;
+ const char* b32 = extended_hex ? "0123456789abcdefghijklmnopqrstuv"
+ : "abcdefghijklmnopqrstuvwxyz234567";
+
+ size_t c = 0; /* c is used to carry partial base32 character over
+ * byte boundaries for sizes with a remainder.
+ * (i.e. src_sz % 5 != 0)
+ */
+
+ ret_sz = add_padding ? sldns_b32_ntop_calculate_size(src_sz)
+ : sldns_b32_ntop_calculate_size_no_padding(src_sz);
+
+ /* Do we have enough space? */
+ if (dst_sz < ret_sz + 1)
+ return -1;
+
+ /* We know the size; terminate the string */
+ dst[ret_sz] = '\0';
+
+ /* First process all chunks of five */
+ while (src_sz >= 5) {
+ /* 00000... ........ ........ ........ ........ */
+ dst[0] = b32[(src[0] ) >> 3];
+
+ /* .....111 11...... ........ ........ ........ */
+ dst[1] = b32[(src[0] & 0x07) << 2 | src[1] >> 6];
+
+ /* ........ ..22222. ........ ........ ........ */
+ dst[2] = b32[(src[1] & 0x3e) >> 1];
+
+ /* ........ .......3 3333.... ........ ........ */
+ dst[3] = b32[(src[1] & 0x01) << 4 | src[2] >> 4];
+
+ /* ........ ........ ....4444 4....... ........ */
+ dst[4] = b32[(src[2] & 0x0f) << 1 | src[3] >> 7];
+
+ /* ........ ........ ........ .55555.. ........ */
+ dst[5] = b32[(src[3] & 0x7c) >> 2];
+
+ /* ........ ........ ........ ......66 666..... */
+ dst[6] = b32[(src[3] & 0x03) << 3 | src[4] >> 5];
+
+ /* ........ ........ ........ ........ ...77777 */
+ dst[7] = b32[(src[4] & 0x1f) ];
+
+ src_sz -= 5;
+ src += 5;
+ dst += 8;
+ }
+ /* Process what remains */
+ switch (src_sz) {
+ case 4: /* ........ ........ ........ ......66 666..... */
+ dst[6] = b32[(src[3] & 0x03) << 3];
+
+ /* ........ ........ ........ .55555.. ........ */
+ dst[5] = b32[(src[3] & 0x7c) >> 2];
+
+ /* ........ ........ ....4444 4....... ........ */
+ c = src[3] >> 7 ;
+ case 3: dst[4] = b32[(src[2] & 0x0f) << 1 | c];
+
+ /* ........ .......3 3333.... ........ ........ */
+ c = src[2] >> 4 ;
+ case 2: dst[3] = b32[(src[1] & 0x01) << 4 | c];
+
+ /* ........ ..22222. ........ ........ ........ */
+ dst[2] = b32[(src[1] & 0x3e) >> 1];
+
+ /* .....111 11...... ........ ........ ........ */
+ c = src[1] >> 6 ;
+ case 1: dst[1] = b32[(src[0] & 0x07) << 2 | c];
+
+ /* 00000... ........ ........ ........ ........ */
+ dst[0] = b32[ src[0] >> 3];
+ }
+ /* Add padding */
+ if (add_padding) {
+ switch (src_sz) {
+ case 1: dst[2] = '=';
+ dst[3] = '=';
+ case 2: dst[4] = '=';
+ case 3: dst[5] = '=';
+ dst[6] = '=';
+ case 4: dst[7] = '=';
+ }
+ }
+ return (int)ret_sz;
+}
+
+int
+sldns_b32_ntop(const uint8_t* src, size_t src_sz, char* dst, size_t dst_sz)
+{
+ return sldns_b32_ntop_base(src, src_sz, dst, dst_sz, 0, 1);
+}
+
+int
+sldns_b32_ntop_extended_hex(const uint8_t* src, size_t src_sz,
+ char* dst, size_t dst_sz)
+{
+ return sldns_b32_ntop_base(src, src_sz, dst, dst_sz, 1, 1);
+}
+
+size_t sldns_b32_pton_calculate_size(size_t src_text_length)
+{
+ return src_text_length * 5 / 8;
+}
+
+static int
+sldns_b32_pton_base(const char* src, size_t src_sz, uint8_t* dst, size_t dst_sz,
+ int extended_hex, int check_padding)
+{
+ size_t i = 0;
+ char ch = '\0';
+ uint8_t buf[8];
+ uint8_t* start = dst;
+
+ while (src_sz) {
+ /* Collect 8 characters in buf (if possible) */
+ for (i = 0; i < 8; i++) {
+
+ do {
+ ch = *src++;
+ --src_sz;
+
+ } while (isspace((unsigned char)ch) && src_sz > 0);
+
+ if (ch == '=' || ch == '\0')
+ break;
+
+ else if (extended_hex)
+
+ if (ch >= '0' && ch <= '9')
+ buf[i] = (uint8_t)ch - '0';
+ else if (ch >= 'a' && ch <= 'v')
+ buf[i] = (uint8_t)ch - 'a' + 10;
+ else if (ch >= 'A' && ch <= 'V')
+ buf[i] = (uint8_t)ch - 'A' + 10;
+ else
+ return -1;
+
+ else if (ch >= 'a' && ch <= 'z')
+ buf[i] = (uint8_t)ch - 'a';
+ else if (ch >= 'A' && ch <= 'Z')
+ buf[i] = (uint8_t)ch - 'A';
+ else if (ch >= '2' && ch <= '7')
+ buf[i] = (uint8_t)ch - '2' + 26;
+ else
+ return -1;
+ }
+ /* Less that 8 characters. We're done. */
+ if (i < 8)
+ break;
+
+ /* Enough space available at the destination? */
+ if (dst_sz < 5)
+ return -1;
+
+ /* 00000... ........ ........ ........ ........ */
+ /* .....111 11...... ........ ........ ........ */
+ dst[0] = buf[0] << 3 | buf[1] >> 2;
+
+ /* .....111 11...... ........ ........ ........ */
+ /* ........ ..22222. ........ ........ ........ */
+ /* ........ .......3 3333.... ........ ........ */
+ dst[1] = buf[1] << 6 | buf[2] << 1 | buf[3] >> 4;
+
+ /* ........ .......3 3333.... ........ ........ */
+ /* ........ ........ ....4444 4....... ........ */
+ dst[2] = buf[3] << 4 | buf[4] >> 1;
+
+ /* ........ ........ ....4444 4....... ........ */
+ /* ........ ........ ........ .55555.. ........ */
+ /* ........ ........ ........ ......66 666..... */
+ dst[3] = buf[4] << 7 | buf[5] << 2 | buf[6] >> 3;
+
+ /* ........ ........ ........ ......66 666..... */
+ /* ........ ........ ........ ........ ...77777 */
+ dst[4] = buf[6] << 5 | buf[7];
+
+ dst += 5;
+ dst_sz -= 5;
+ }
+ /* Not ending on a eight byte boundary? */
+ if (i > 0 && i < 8) {
+
+ /* Enough space available at the destination? */
+ if (dst_sz < (i + 1) / 2)
+ return -1;
+
+ switch (i) {
+ case 7: /* ........ ........ ........ ......66 666..... */
+ /* ........ ........ ........ .55555.. ........ */
+ /* ........ ........ ....4444 4....... ........ */
+ dst[3] = buf[4] << 7 | buf[5] << 2 | buf[6] >> 3;
+
+ case 5: /* ........ ........ ....4444 4....... ........ */
+ /* ........ .......3 3333.... ........ ........ */
+ dst[2] = buf[3] << 4 | buf[4] >> 1;
+
+ case 4: /* ........ .......3 3333.... ........ ........ */
+ /* ........ ..22222. ........ ........ ........ */
+ /* .....111 11...... ........ ........ ........ */
+ dst[1] = buf[1] << 6 | buf[2] << 1 | buf[3] >> 4;
+
+ case 2: /* .....111 11...... ........ ........ ........ */
+ /* 00000... ........ ........ ........ ........ */
+ dst[0] = buf[0] << 3 | buf[1] >> 2;
+
+ break;
+
+ default:
+ return -1;
+ }
+ dst += (i + 1) / 2;
+
+ if (check_padding) {
+ /* Check remaining padding characters */
+ if (ch != '=')
+ return -1;
+
+ /* One down, 8 - i - 1 more to come... */
+ for (i = 8 - i - 1; i > 0; i--) {
+
+ do {
+ if (src_sz == 0)
+ return -1;
+ ch = *src++;
+ src_sz--;
+
+ } while (isspace((unsigned char)ch));
+
+ if (ch != '=')
+ return -1;
+ }
+ }
+ }
+ return dst - start;
+}
+
+int
+sldns_b32_pton(const char* src, size_t src_sz, uint8_t* dst, size_t dst_sz)
+{
+ return sldns_b32_pton_base(src, src_sz, dst, dst_sz, 0, 1);
+}
+
+int
+sldns_b32_pton_extended_hex(const char* src, size_t src_sz,
+ uint8_t* dst, size_t dst_sz)
+{
+ return sldns_b32_pton_base(src, src_sz, dst, dst_sz, 1, 1);
+}
+
+size_t sldns_b64_ntop_calculate_size(size_t srcsize)
+{
+ return ((((srcsize + 2) / 3) * 4) + 1);
+}
+
+/* RFC 1521, section 5.2.
+ *
+ * The encoding process represents 24-bit groups of input bits as output
+ * strings of 4 encoded characters. Proceeding from left to right, a
+ * 24-bit input group is formed by concatenating 3 8-bit input groups.
+ * These 24 bits are then treated as 4 concatenated 6-bit groups, each
+ * of which is translated into a single digit in the base64 alphabet.
+ *
+ * This routine does not insert spaces or linebreaks after 76 characters.
+ */
+int sldns_b64_ntop(uint8_t const *src, size_t srclength,
+ char *target, size_t targsize)
+{
+ const char* b64 =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ const char pad64 = '=';
+ size_t i = 0, o = 0;
+ if(targsize < sldns_b64_ntop_calculate_size(srclength))
+ return -1;
+ /* whole chunks: xxxxxxyy yyyyzzzz zzwwwwww */
+ while(i+3 <= srclength) {
+ if(o+4 > targsize) return -1;
+ target[o] = b64[src[i] >> 2];
+ target[o+1] = b64[ ((src[i]&0x03)<<4) | (src[i+1]>>4) ];
+ target[o+2] = b64[ ((src[i+1]&0x0f)<<2) | (src[i+2]>>6) ];
+ target[o+3] = b64[ (src[i+2]&0x3f) ];
+ i += 3;
+ o += 4;
+ }
+ /* remainder */
+ switch(srclength - i) {
+ case 2:
+ /* two at end, converted into A B C = */
+ target[o] = b64[src[i] >> 2];
+ target[o+1] = b64[ ((src[i]&0x03)<<4) | (src[i+1]>>4) ];
+ target[o+2] = b64[ ((src[i+1]&0x0f)<<2) ];
+ target[o+3] = pad64;
+ i += 2;
+ o += 4;
+ break;
+ case 1:
+ /* one at end, converted into A B = = */
+ target[o] = b64[src[i] >> 2];
+ target[o+1] = b64[ ((src[i]&0x03)<<4) ];
+ target[o+2] = pad64;
+ target[o+3] = pad64;
+ i += 1;
+ o += 4;
+ break;
+ case 0:
+ default:
+ /* nothing */
+ break;
+ }
+ /* assert: i == srclength */
+ if(o+1 > targsize) return -1;
+ target[o] = 0;
+ return (int)o;
+}
+
+size_t sldns_b64_pton_calculate_size(size_t srcsize)
+{
+ return (((((srcsize + 3) / 4) * 3)) + 1);
+}
+
+int sldns_b64_pton(char const *src, uint8_t *target, size_t targsize)
+{
+ const uint8_t pad64 = 64; /* is 64th in the b64 array */
+ const char* s = src;
+ uint8_t in[4];
+ size_t o = 0, incount = 0;
+
+ while(*s) {
+ /* skip any character that is not base64 */
+ /* conceptually we do:
+ const char* b64 = pad'=' is appended to array
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+ const char* d = strchr(b64, *s++);
+ and use d-b64;
+ */
+ char d = *s++;
+ if(d <= 'Z' && d >= 'A')
+ d -= 'A';
+ else if(d <= 'z' && d >= 'a')
+ d = d - 'a' + 26;
+ else if(d <= '9' && d >= '0')
+ d = d - '0' + 52;
+ else if(d == '+')
+ d = 62;
+ else if(d == '/')
+ d = 63;
+ else if(d == '=')
+ d = 64;
+ else continue;
+ in[incount++] = (uint8_t)d;
+ if(incount != 4)
+ continue;
+ /* process whole block of 4 characters into 3 output bytes */
+ if(in[3] == pad64 && in[2] == pad64) { /* A B = = */
+ if(o+1 > targsize)
+ return -1;
+ target[o] = (in[0]<<2) | ((in[1]&0x30)>>4);
+ o += 1;
+ break; /* we are done */
+ } else if(in[3] == pad64) { /* A B C = */
+ if(o+2 > targsize)
+ return -1;
+ target[o] = (in[0]<<2) | ((in[1]&0x30)>>4);
+ target[o+1]= ((in[1]&0x0f)<<4) | ((in[2]&0x3c)>>2);
+ o += 2;
+ break; /* we are done */
+ } else {
+ if(o+3 > targsize)
+ return -1;
+ /* write xxxxxxyy yyyyzzzz zzwwwwww */
+ target[o] = (in[0]<<2) | ((in[1]&0x30)>>4);
+ target[o+1]= ((in[1]&0x0f)<<4) | ((in[2]&0x3c)>>2);
+ target[o+2]= ((in[2]&0x03)<<6) | in[3];
+ o += 3;
+ }
+ incount = 0;
+ }
+ return (int)o;
+}
--- /dev/null
+/*
+ * parseutil.h - parse utilities for string and wire conversion
+ *
+ * (c) NLnet Labs, 2004
+ *
+ * See the file LICENSE for the license
+ */
+/**
+ * \file
+ *
+ * Utility functions for parsing, base32(DNS variant) and base64 encoding
+ * and decoding, Hex, Time units, Escape codes.
+ */
+
+#ifndef LDNS_PARSEUTIL_H
+#define LDNS_PARSEUTIL_H
+struct tm;
+
+/**
+ * A general purpose lookup table
+ *
+ * Lookup tables are arrays of (id, name) pairs,
+ * So you can for instance lookup the RCODE 3, which is "NXDOMAIN",
+ * and vice versa. The lookup tables themselves are defined wherever needed,
+ * for instance in host2str.c
+ */
+struct sldns_struct_lookup_table {
+ int id;
+ const char *name;
+};
+typedef struct sldns_struct_lookup_table sldns_lookup_table;
+
+/**
+ * Looks up the table entry by name, returns NULL if not found.
+ * \param[in] table the lookup table to search in
+ * \param[in] name what to search for
+ * \return the item found
+ */
+sldns_lookup_table *sldns_lookup_by_name(sldns_lookup_table table[],
+ const char *name);
+/**
+ * Looks up the table entry by id, returns NULL if not found.
+ * \param[in] table the lookup table to search in
+ * \param[in] id what to search for
+ * \return the item found
+ */
+sldns_lookup_table *sldns_lookup_by_id(sldns_lookup_table table[], int id);
+
+/**
+ * Convert TM to seconds since epoch (midnight, January 1st, 1970).
+ * Like timegm(3), which is not always available.
+ * \param[in] tm a struct tm* with the date
+ * \return the seconds since epoch
+ */
+time_t sldns_mktime_from_utc(const struct tm *tm);
+
+/**
+ * The function interprets time as the number of seconds since epoch
+ * with respect to now using serial arithmitics (rfc1982).
+ * That number of seconds is then converted to broken-out time information.
+ * This is especially usefull when converting the inception and expiration
+ * fields of RRSIG records.
+ *
+ * \param[in] time number of seconds since epoch (midnight, January 1st, 1970)
+ * to be intepreted as a serial arithmitics number relative to now.
+ * \param[in] now number of seconds since epoch (midnight, January 1st, 1970)
+ * to which the time value is compared to determine the final value.
+ * \param[out] result the struct with the broken-out time information
+ * \return result on success or NULL on error
+ */
+struct tm * sldns_serial_arithmitics_gmtime_r(int32_t time, time_t now, struct tm *result);
+
+/**
+ * converts a ttl value (like 5d2h) to a long.
+ * \param[in] nptr the start of the string
+ * \param[out] endptr points to the last char in case of error
+ * \return the convert duration value
+ */
+uint32_t sldns_str2period(const char *nptr, const char **endptr);
+
+/**
+ * Returns the int value of the given (hex) digit
+ * \param[in] ch the hex char to convert
+ * \return the converted decimal value
+ */
+int sldns_hexdigit_to_int(char ch);
+
+/**
+ * calculates the size needed to store the result of b64_ntop
+ */
+size_t sldns_b64_ntop_calculate_size(size_t srcsize);
+
+int sldns_b64_ntop(uint8_t const *src, size_t srclength,
+ char *target, size_t targsize);
+
+/**
+ * calculates the size needed to store the result of sldns_b64_pton
+ */
+size_t sldns_b64_pton_calculate_size(size_t srcsize);
+
+int sldns_b64_pton(char const *src, uint8_t *target, size_t targsize);
+
+/**
+ * calculates the size needed to store the result of b32_ntop
+ */
+size_t sldns_b32_ntop_calculate_size(size_t src_data_length);
+
+size_t sldns_b32_ntop_calculate_size_no_padding(size_t src_data_length);
+
+int sldns_b32_ntop(const uint8_t* src_data, size_t src_data_length,
+ char* target_text_buffer, size_t target_text_buffer_size);
+
+int sldns_b32_ntop_extended_hex(const uint8_t* src_data, size_t src_data_length,
+ char* target_text_buffer, size_t target_text_buffer_size);
+
+/**
+ * calculates the size needed to store the result of b32_pton
+ */
+size_t sldns_b32_pton_calculate_size(size_t src_text_length);
+
+int sldns_b32_pton(const char* src_text, size_t src_text_length,
+ uint8_t* target_data_buffer, size_t target_data_buffer_size);
+
+int sldns_b32_pton_extended_hex(const char* src_text, size_t src_text_length,
+ uint8_t* target_data_buffer, size_t target_data_buffer_size);
+
+/*
+ * Checks whether the escaped value at **s is an octal value or
+ * a 'normally' escaped character (and not eos)
+ *
+ * @param ch_p: the parsed character
+ * @param str_p: the string. moved along for characters read.
+ * The string pointer at *s is increased by either 0 (on error), 1 (on
+ * normal escapes), or 3 (on octals)
+ *
+ * @return 0 on error
+ */
+int sldns_parse_escape(uint8_t *ch_p, const char** str_p);
+
+/**
+ * Parse one character, with escape codes,
+ * @param ch_p: the parsed character
+ * @param str_p: the string. moved along for characters read.
+ * @return 0 on error
+ */
+int sldns_parse_char(uint8_t *ch_p, const char** str_p);
+
+#endif /* LDNS_PARSEUTIL_H */
--- /dev/null
+/*
+ * pkthdr.h - packet header from wire conversion routines
+ *
+ * a Net::DNS like library for C
+ *
+ * (c) NLnet Labs, 2005-2006
+ *
+ * See the file LICENSE for the license
+ */
+
+/**
+ * \file
+ *
+ * Contains functions that translate dns data from the wire format (as sent
+ * by servers and clients) to the internal structures for the packet header.
+ */
+
+#ifndef LDNS_PKTHDR_H
+#define LDNS_PKTHDR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* The length of the header */
+#define LDNS_HEADER_SIZE 12
+
+/* First octet of flags */
+#define LDNS_RD_MASK 0x01U
+#define LDNS_RD_SHIFT 0
+#define LDNS_RD_WIRE(wirebuf) (*(wirebuf+2) & LDNS_RD_MASK)
+#define LDNS_RD_SET(wirebuf) (*(wirebuf+2) |= LDNS_RD_MASK)
+#define LDNS_RD_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_RD_MASK)
+
+#define LDNS_TC_MASK 0x02U
+#define LDNS_TC_SHIFT 1
+#define LDNS_TC_WIRE(wirebuf) (*(wirebuf+2) & LDNS_TC_MASK)
+#define LDNS_TC_SET(wirebuf) (*(wirebuf+2) |= LDNS_TC_MASK)
+#define LDNS_TC_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_TC_MASK)
+
+#define LDNS_AA_MASK 0x04U
+#define LDNS_AA_SHIFT 2
+#define LDNS_AA_WIRE(wirebuf) (*(wirebuf+2) & LDNS_AA_MASK)
+#define LDNS_AA_SET(wirebuf) (*(wirebuf+2) |= LDNS_AA_MASK)
+#define LDNS_AA_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_AA_MASK)
+
+#define LDNS_OPCODE_MASK 0x78U
+#define LDNS_OPCODE_SHIFT 3
+#define LDNS_OPCODE_WIRE(wirebuf) ((*(wirebuf+2) & LDNS_OPCODE_MASK) >> LDNS_OPCODE_SHIFT)
+#define LDNS_OPCODE_SET(wirebuf, opcode) \
+ (*(wirebuf+2) = ((*(wirebuf+2)) & ~LDNS_OPCODE_MASK) | ((opcode) << LDNS_OPCODE_SHIFT))
+
+#define LDNS_QR_MASK 0x80U
+#define LDNS_QR_SHIFT 7
+#define LDNS_QR_WIRE(wirebuf) (*(wirebuf+2) & LDNS_QR_MASK)
+#define LDNS_QR_SET(wirebuf) (*(wirebuf+2) |= LDNS_QR_MASK)
+#define LDNS_QR_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_QR_MASK)
+
+/* Second octet of flags */
+#define LDNS_RCODE_MASK 0x0fU
+#define LDNS_RCODE_SHIFT 0
+#define LDNS_RCODE_WIRE(wirebuf) (*(wirebuf+3) & LDNS_RCODE_MASK)
+#define LDNS_RCODE_SET(wirebuf, rcode) \
+ (*(wirebuf+3) = ((*(wirebuf+3)) & ~LDNS_RCODE_MASK) | (rcode))
+
+#define LDNS_CD_MASK 0x10U
+#define LDNS_CD_SHIFT 4
+#define LDNS_CD_WIRE(wirebuf) (*(wirebuf+3) & LDNS_CD_MASK)
+#define LDNS_CD_SET(wirebuf) (*(wirebuf+3) |= LDNS_CD_MASK)
+#define LDNS_CD_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_CD_MASK)
+
+#define LDNS_AD_MASK 0x20U
+#define LDNS_AD_SHIFT 5
+#define LDNS_AD_WIRE(wirebuf) (*(wirebuf+3) & LDNS_AD_MASK)
+#define LDNS_AD_SET(wirebuf) (*(wirebuf+3) |= LDNS_AD_MASK)
+#define LDNS_AD_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_AD_MASK)
+
+#define LDNS_Z_MASK 0x40U
+#define LDNS_Z_SHIFT 6
+#define LDNS_Z_WIRE(wirebuf) (*(wirebuf+3) & LDNS_Z_MASK)
+#define LDNS_Z_SET(wirebuf) (*(wirebuf+3) |= LDNS_Z_MASK)
+#define LDNS_Z_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_Z_MASK)
+
+#define LDNS_RA_MASK 0x80U
+#define LDNS_RA_SHIFT 7
+#define LDNS_RA_WIRE(wirebuf) (*(wirebuf+3) & LDNS_RA_MASK)
+#define LDNS_RA_SET(wirebuf) (*(wirebuf+3) |= LDNS_RA_MASK)
+#define LDNS_RA_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_RA_MASK)
+
+/* Query ID */
+#define LDNS_ID_WIRE(wirebuf) (sldns_read_uint16(wirebuf))
+#define LDNS_ID_SET(wirebuf, id) (sldns_write_uint16(wirebuf, id))
+
+/* Counter of the question section */
+#define LDNS_QDCOUNT_OFF 4
+/*
+#define QDCOUNT(wirebuf) (ntohs(*(uint16_t *)(wirebuf+QDCOUNT_OFF)))
+*/
+#define LDNS_QDCOUNT(wirebuf) (sldns_read_uint16(wirebuf+LDNS_QDCOUNT_OFF))
+
+/* Counter of the answer section */
+#define LDNS_ANCOUNT_OFF 6
+#define LDNS_ANCOUNT(wirebuf) (sldns_read_uint16(wirebuf+LDNS_ANCOUNT_OFF))
+
+/* Counter of the authority section */
+#define LDNS_NSCOUNT_OFF 8
+#define LDNS_NSCOUNT(wirebuf) (sldns_read_uint16(wirebuf+LDNS_NSCOUNT_OFF))
+
+/* Counter of the additional section */
+#define LDNS_ARCOUNT_OFF 10
+#define LDNS_ARCOUNT(wirebuf) (sldns_read_uint16(wirebuf+LDNS_ARCOUNT_OFF))
+
+/**
+ * The sections of a packet
+ */
+enum sldns_enum_pkt_section {
+ LDNS_SECTION_QUESTION = 0,
+ LDNS_SECTION_ANSWER = 1,
+ LDNS_SECTION_AUTHORITY = 2,
+ LDNS_SECTION_ADDITIONAL = 3,
+ /** bogus section, if not interested */
+ LDNS_SECTION_ANY = 4,
+ /** used to get all non-question rrs from a packet */
+ LDNS_SECTION_ANY_NOQUESTION = 5
+};
+typedef enum sldns_enum_pkt_section sldns_pkt_section;
+
+/* opcodes for pkt's */
+enum sldns_enum_pkt_opcode {
+ LDNS_PACKET_QUERY = 0,
+ LDNS_PACKET_IQUERY = 1,
+ LDNS_PACKET_STATUS = 2, /* there is no 3?? DNS is weird */
+ LDNS_PACKET_NOTIFY = 4,
+ LDNS_PACKET_UPDATE = 5
+};
+typedef enum sldns_enum_pkt_opcode sldns_pkt_opcode;
+
+/* rcodes for pkts */
+enum sldns_enum_pkt_rcode {
+ LDNS_RCODE_NOERROR = 0,
+ LDNS_RCODE_FORMERR = 1,
+ LDNS_RCODE_SERVFAIL = 2,
+ LDNS_RCODE_NXDOMAIN = 3,
+ LDNS_RCODE_NOTIMPL = 4,
+ LDNS_RCODE_REFUSED = 5,
+ LDNS_RCODE_YXDOMAIN = 6,
+ LDNS_RCODE_YXRRSET = 7,
+ LDNS_RCODE_NXRRSET = 8,
+ LDNS_RCODE_NOTAUTH = 9,
+ LDNS_RCODE_NOTZONE = 10
+};
+typedef enum sldns_enum_pkt_rcode sldns_pkt_rcode;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LDNS_PKTHDR_H */
--- /dev/null
+/* rrdef.c
+ *
+ * access functions to rr definitions list.
+ * a Net::DNS like library for C
+ * LibDNS Team @ NLnet Labs
+ *
+ * (c) NLnet Labs, 2004-2006
+ * See the file LICENSE for the license
+ */
+/**
+ * \file
+ *
+ * Defines resource record types and constants.
+ */
+#include "config.h"
+#include "sldns/rrdef.h"
+#include "sldns/parseutil.h"
+
+/* classes */
+static sldns_lookup_table sldns_rr_classes_data[] = {
+ { LDNS_RR_CLASS_IN, "IN" },
+ { LDNS_RR_CLASS_CH, "CH" },
+ { LDNS_RR_CLASS_HS, "HS" },
+ { LDNS_RR_CLASS_NONE, "NONE" },
+ { LDNS_RR_CLASS_ANY, "ANY" },
+ { 0, NULL }
+};
+sldns_lookup_table* sldns_rr_classes = sldns_rr_classes_data;
+
+/* types */
+static const sldns_rdf_type type_0_wireformat[] = { LDNS_RDF_TYPE_UNKNOWN };
+static const sldns_rdf_type type_a_wireformat[] = { LDNS_RDF_TYPE_A };
+static const sldns_rdf_type type_ns_wireformat[] = { LDNS_RDF_TYPE_DNAME };
+static const sldns_rdf_type type_md_wireformat[] = { LDNS_RDF_TYPE_DNAME };
+static const sldns_rdf_type type_mf_wireformat[] = { LDNS_RDF_TYPE_DNAME };
+static const sldns_rdf_type type_cname_wireformat[] = { LDNS_RDF_TYPE_DNAME };
+static const sldns_rdf_type type_soa_wireformat[] = {
+ LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_INT32,
+ LDNS_RDF_TYPE_PERIOD, LDNS_RDF_TYPE_PERIOD, LDNS_RDF_TYPE_PERIOD,
+ LDNS_RDF_TYPE_PERIOD
+};
+static const sldns_rdf_type type_mb_wireformat[] = { LDNS_RDF_TYPE_DNAME };
+static const sldns_rdf_type type_mg_wireformat[] = { LDNS_RDF_TYPE_DNAME };
+static const sldns_rdf_type type_mr_wireformat[] = { LDNS_RDF_TYPE_DNAME };
+static const sldns_rdf_type type_wks_wireformat[] = {
+ LDNS_RDF_TYPE_A, LDNS_RDF_TYPE_WKS
+};
+static const sldns_rdf_type type_ptr_wireformat[] = { LDNS_RDF_TYPE_DNAME };
+static const sldns_rdf_type type_hinfo_wireformat[] = {
+ LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR
+};
+static const sldns_rdf_type type_minfo_wireformat[] = {
+ LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME
+};
+static const sldns_rdf_type type_mx_wireformat[] = {
+ LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME
+};
+static const sldns_rdf_type type_rp_wireformat[] = {
+ LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME
+};
+static const sldns_rdf_type type_afsdb_wireformat[] = {
+ LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME
+};
+static const sldns_rdf_type type_x25_wireformat[] = { LDNS_RDF_TYPE_STR };
+static const sldns_rdf_type type_isdn_wireformat[] = {
+ LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR
+};
+static const sldns_rdf_type type_rt_wireformat[] = {
+ LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME
+};
+static const sldns_rdf_type type_nsap_wireformat[] = {
+ LDNS_RDF_TYPE_NSAP
+};
+static const sldns_rdf_type type_nsap_ptr_wireformat[] = {
+ LDNS_RDF_TYPE_STR
+};
+static const sldns_rdf_type type_sig_wireformat[] = {
+ LDNS_RDF_TYPE_TYPE, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT32,
+ LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_INT16,
+ LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_B64
+};
+static const sldns_rdf_type type_key_wireformat[] = {
+ LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_B64
+};
+static const sldns_rdf_type type_px_wireformat[] = {
+ LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME
+};
+static const sldns_rdf_type type_gpos_wireformat[] = {
+ LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR
+};
+static const sldns_rdf_type type_aaaa_wireformat[] = { LDNS_RDF_TYPE_AAAA };
+static const sldns_rdf_type type_loc_wireformat[] = { LDNS_RDF_TYPE_LOC };
+static const sldns_rdf_type type_nxt_wireformat[] = {
+ LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_UNKNOWN
+};
+static const sldns_rdf_type type_eid_wireformat[] = {
+ LDNS_RDF_TYPE_HEX
+};
+static const sldns_rdf_type type_nimloc_wireformat[] = {
+ LDNS_RDF_TYPE_HEX
+};
+static const sldns_rdf_type type_srv_wireformat[] = {
+ LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME
+};
+static const sldns_rdf_type type_atma_wireformat[] = {
+ LDNS_RDF_TYPE_ATMA
+};
+static const sldns_rdf_type type_naptr_wireformat[] = {
+ LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_DNAME
+};
+static const sldns_rdf_type type_kx_wireformat[] = {
+ LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME
+};
+static const sldns_rdf_type type_cert_wireformat[] = {
+ LDNS_RDF_TYPE_CERT_ALG, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_B64
+};
+static const sldns_rdf_type type_a6_wireformat[] = { LDNS_RDF_TYPE_UNKNOWN };
+static const sldns_rdf_type type_dname_wireformat[] = { LDNS_RDF_TYPE_DNAME };
+static const sldns_rdf_type type_sink_wireformat[] = { LDNS_RDF_TYPE_INT8,
+ LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_B64
+};
+static const sldns_rdf_type type_apl_wireformat[] = {
+ LDNS_RDF_TYPE_APL
+};
+static const sldns_rdf_type type_ds_wireformat[] = {
+ LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_HEX
+};
+static const sldns_rdf_type type_sshfp_wireformat[] = {
+ LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_HEX
+};
+static const sldns_rdf_type type_ipseckey_wireformat[] = {
+ LDNS_RDF_TYPE_IPSECKEY
+};
+static const sldns_rdf_type type_rrsig_wireformat[] = {
+ LDNS_RDF_TYPE_TYPE, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT32,
+ LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_B64
+};
+static const sldns_rdf_type type_nsec_wireformat[] = {
+ LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_NSEC
+};
+static const sldns_rdf_type type_dhcid_wireformat[] = {
+ LDNS_RDF_TYPE_B64
+};
+static const sldns_rdf_type type_talink_wireformat[] = {
+ LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME
+};
+/* nsec3 is some vars, followed by same type of data of nsec */
+static const sldns_rdf_type type_nsec3_wireformat[] = {
+/* LDNS_RDF_TYPE_NSEC3_VARS, LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, LDNS_RDF_TYPE_NSEC*/
+ LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_NSEC3_SALT, LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, LDNS_RDF_TYPE_NSEC
+};
+
+static const sldns_rdf_type type_nsec3param_wireformat[] = {
+/* LDNS_RDF_TYPE_NSEC3_PARAMS_VARS*/
+ LDNS_RDF_TYPE_INT8,
+ LDNS_RDF_TYPE_INT8,
+ LDNS_RDF_TYPE_INT16,
+ LDNS_RDF_TYPE_NSEC3_SALT
+};
+
+static const sldns_rdf_type type_dnskey_wireformat[] = {
+ LDNS_RDF_TYPE_INT16,
+ LDNS_RDF_TYPE_INT8,
+ LDNS_RDF_TYPE_ALG,
+ LDNS_RDF_TYPE_B64
+};
+static const sldns_rdf_type type_tkey_wireformat[] = {
+ LDNS_RDF_TYPE_DNAME,
+ LDNS_RDF_TYPE_TIME,
+ LDNS_RDF_TYPE_TIME,
+ LDNS_RDF_TYPE_INT16,
+ LDNS_RDF_TYPE_INT16,
+ LDNS_RDF_TYPE_INT16_DATA,
+ LDNS_RDF_TYPE_INT16_DATA,
+};
+static const sldns_rdf_type type_tsig_wireformat[] = {
+ LDNS_RDF_TYPE_DNAME,
+ LDNS_RDF_TYPE_TSIGTIME,
+ LDNS_RDF_TYPE_INT16,
+ LDNS_RDF_TYPE_INT16_DATA,
+ LDNS_RDF_TYPE_INT16,
+ LDNS_RDF_TYPE_INT16,
+ LDNS_RDF_TYPE_INT16_DATA
+};
+static const sldns_rdf_type type_tlsa_wireformat[] = {
+ LDNS_RDF_TYPE_INT8,
+ LDNS_RDF_TYPE_INT8,
+ LDNS_RDF_TYPE_INT8,
+ LDNS_RDF_TYPE_HEX
+};
+static const sldns_rdf_type type_hip_wireformat[] = {
+ LDNS_RDF_TYPE_HIP
+};
+static const sldns_rdf_type type_nid_wireformat[] = {
+ LDNS_RDF_TYPE_INT16,
+ LDNS_RDF_TYPE_ILNP64
+};
+static const sldns_rdf_type type_l32_wireformat[] = {
+ LDNS_RDF_TYPE_INT16,
+ LDNS_RDF_TYPE_A
+};
+static const sldns_rdf_type type_l64_wireformat[] = {
+ LDNS_RDF_TYPE_INT16,
+ LDNS_RDF_TYPE_ILNP64
+};
+static const sldns_rdf_type type_lp_wireformat[] = {
+ LDNS_RDF_TYPE_INT16,
+ LDNS_RDF_TYPE_DNAME
+};
+static const sldns_rdf_type type_eui48_wireformat[] = {
+ LDNS_RDF_TYPE_EUI48
+};
+static const sldns_rdf_type type_eui64_wireformat[] = {
+ LDNS_RDF_TYPE_EUI64
+};
+static const sldns_rdf_type type_uri_wireformat[] = {
+ LDNS_RDF_TYPE_INT16,
+ LDNS_RDF_TYPE_INT16,
+ LDNS_RDF_TYPE_LONG_STR
+};
+static const sldns_rdf_type type_caa_wireformat[] = {
+ LDNS_RDF_TYPE_INT8,
+ LDNS_RDF_TYPE_TAG,
+ LDNS_RDF_TYPE_LONG_STR
+};
+
+/* All RR's defined in 1035 are well known and can thus
+ * be compressed. See RFC3597. These RR's are:
+ * CNAME HINFO MB MD MF MG MINFO MR MX NULL NS PTR SOA TXT
+ */
+static sldns_rr_descriptor rdata_field_descriptors[] = {
+ /* 0 */
+ { 0, NULL, 0, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 1 */
+ {LDNS_RR_TYPE_A, "A", 1, 1, type_a_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 2 */
+ {LDNS_RR_TYPE_NS, "NS", 1, 1, type_ns_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
+ /* 3 */
+ {LDNS_RR_TYPE_MD, "MD", 1, 1, type_md_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
+ /* 4 */
+ {LDNS_RR_TYPE_MF, "MF", 1, 1, type_mf_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
+ /* 5 */
+ {LDNS_RR_TYPE_CNAME, "CNAME", 1, 1, type_cname_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
+ /* 6 */
+ {LDNS_RR_TYPE_SOA, "SOA", 7, 7, type_soa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 2 },
+ /* 7 */
+ {LDNS_RR_TYPE_MB, "MB", 1, 1, type_mb_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
+ /* 8 */
+ {LDNS_RR_TYPE_MG, "MG", 1, 1, type_mg_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
+ /* 9 */
+ {LDNS_RR_TYPE_MR, "MR", 1, 1, type_mr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
+ /* 10 */
+ {LDNS_RR_TYPE_NULL, "NULL", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 11 */
+ {LDNS_RR_TYPE_WKS, "WKS", 2, 2, type_wks_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 12 */
+ {LDNS_RR_TYPE_PTR, "PTR", 1, 1, type_ptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
+ /* 13 */
+ {LDNS_RR_TYPE_HINFO, "HINFO", 2, 2, type_hinfo_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 14 */
+ {LDNS_RR_TYPE_MINFO, "MINFO", 2, 2, type_minfo_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 2 },
+ /* 15 */
+ {LDNS_RR_TYPE_MX, "MX", 2, 2, type_mx_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 },
+ /* 16 */
+ {LDNS_RR_TYPE_TXT, "TXT", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 },
+ /* 17 */
+ {LDNS_RR_TYPE_RP, "RP", 2, 2, type_rp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 },
+ /* 18 */
+ {LDNS_RR_TYPE_AFSDB, "AFSDB", 2, 2, type_afsdb_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
+ /* 19 */
+ {LDNS_RR_TYPE_X25, "X25", 1, 1, type_x25_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 20 */
+ {LDNS_RR_TYPE_ISDN, "ISDN", 1, 2, type_isdn_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 21 */
+ {LDNS_RR_TYPE_RT, "RT", 2, 2, type_rt_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
+ /* 22 */
+ {LDNS_RR_TYPE_NSAP, "NSAP", 1, 1, type_nsap_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 23 */
+ {LDNS_RR_TYPE_NSAP_PTR, "NSAP-PTR", 1, 1, type_nsap_ptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 24 */
+ {LDNS_RR_TYPE_SIG, "SIG", 9, 9, type_sig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
+ /* 25 */
+ {LDNS_RR_TYPE_KEY, "KEY", 4, 4, type_key_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 26 */
+ {LDNS_RR_TYPE_PX, "PX", 3, 3, type_px_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 },
+ /* 27 */
+ {LDNS_RR_TYPE_GPOS, "GPOS", 3, 3, type_gpos_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 28 */
+ {LDNS_RR_TYPE_AAAA, "AAAA", 1, 1, type_aaaa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 29 */
+ {LDNS_RR_TYPE_LOC, "LOC", 1, 1, type_loc_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 30 */
+ {LDNS_RR_TYPE_NXT, "NXT", 2, 2, type_nxt_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
+ /* 31 */
+ {LDNS_RR_TYPE_EID, "EID", 1, 1, type_eid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 32 */
+ {LDNS_RR_TYPE_NIMLOC, "NIMLOC", 1, 1, type_nimloc_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 33 */
+ {LDNS_RR_TYPE_SRV, "SRV", 4, 4, type_srv_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
+ /* 34 */
+ {LDNS_RR_TYPE_ATMA, "ATMA", 1, 1, type_atma_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 35 */
+ {LDNS_RR_TYPE_NAPTR, "NAPTR", 6, 6, type_naptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
+ /* 36 */
+ {LDNS_RR_TYPE_KX, "KX", 2, 2, type_kx_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
+ /* 37 */
+ {LDNS_RR_TYPE_CERT, "CERT", 4, 4, type_cert_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 38 */
+ {LDNS_RR_TYPE_A6, "A6", 1, 1, type_a6_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 39 */
+ {LDNS_RR_TYPE_DNAME, "DNAME", 1, 1, type_dname_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
+ /* 40 */
+ {LDNS_RR_TYPE_SINK, "SINK", 1, 1, type_sink_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 41 */
+ {LDNS_RR_TYPE_OPT, "OPT", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 42 */
+ {LDNS_RR_TYPE_APL, "APL", 0, 0, type_apl_wireformat, LDNS_RDF_TYPE_APL, LDNS_RR_NO_COMPRESS, 0 },
+ /* 43 */
+ {LDNS_RR_TYPE_DS, "DS", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 44 */
+ {LDNS_RR_TYPE_SSHFP, "SSHFP", 3, 3, type_sshfp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 45 */
+ {LDNS_RR_TYPE_IPSECKEY, "IPSECKEY", 1, 1, type_ipseckey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 46 */
+ {LDNS_RR_TYPE_RRSIG, "RRSIG", 9, 9, type_rrsig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
+ /* 47 */
+ {LDNS_RR_TYPE_NSEC, "NSEC", 1, 2, type_nsec_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
+ /* 48 */
+ {LDNS_RR_TYPE_DNSKEY, "DNSKEY", 4, 4, type_dnskey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 49 */
+ {LDNS_RR_TYPE_DHCID, "DHCID", 1, 1, type_dhcid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 50 */
+ {LDNS_RR_TYPE_NSEC3, "NSEC3", 5, 6, type_nsec3_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 51 */
+ {LDNS_RR_TYPE_NSEC3PARAM, "NSEC3PARAM", 4, 4, type_nsec3param_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 52 */
+ {LDNS_RR_TYPE_TLSA, "TLSA", 4, 4, type_tlsa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+
+{LDNS_RR_TYPE_NULL, "TYPE53", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE54", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 55
+ * Hip ends with 0 or more Rendezvous Servers represented as dname's.
+ * Hence the LDNS_RDF_TYPE_DNAME _variable field and the _maximum field
+ * set to 0.
+ */
+ {LDNS_RR_TYPE_HIP, "HIP", 1, 1, type_hip_wireformat, LDNS_RDF_TYPE_DNAME, LDNS_RR_NO_COMPRESS, 0 },
+
+#ifdef DRAFT_RRTYPES
+ /* 56 */
+ {LDNS_RR_TYPE_NINFO, "NINFO", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 },
+ /* 57 */
+ {LDNS_RR_TYPE_RKEY, "RKEY", 4, 4, type_key_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+#else
+{LDNS_RR_TYPE_NULL, "TYPE56", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE57", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+#endif
+ /* 58 */
+ {LDNS_RR_TYPE_TALINK, "TALINK", 2, 2, type_talink_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 },
+
+ /* 59 */
+ {LDNS_RR_TYPE_CDS, "CDS", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 60 */
+ {LDNS_RR_TYPE_CDNSKEY, "CDNSKEY", 4, 4, type_dnskey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE61", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE62", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE63", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE64", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE65", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE66", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE67", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE68", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE69", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE70", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE71", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE72", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE73", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE74", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE75", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE76", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE77", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE78", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE79", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE80", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE81", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE82", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE83", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE84", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE85", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE86", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE87", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE88", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE89", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE90", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE91", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE92", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE93", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE94", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE95", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE96", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE97", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE98", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+
+ /* 99 */
+ {LDNS_RR_TYPE_SPF, "SPF", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 },
+
+ /* UINFO [IANA-Reserved] */
+{LDNS_RR_TYPE_NULL, "TYPE100", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* UID [IANA-Reserved] */
+{LDNS_RR_TYPE_NULL, "TYPE101", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* GID [IANA-Reserved] */
+{LDNS_RR_TYPE_NULL, "TYPE102", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* UNSPEC [IANA-Reserved] */
+{LDNS_RR_TYPE_NULL, "TYPE103", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+
+ /* 104 */
+ {LDNS_RR_TYPE_NID, "NID", 2, 2, type_nid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 105 */
+ {LDNS_RR_TYPE_L32, "L32", 2, 2, type_l32_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 106 */
+ {LDNS_RR_TYPE_L64, "L64", 2, 2, type_l64_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 107 */
+ {LDNS_RR_TYPE_LP, "LP", 2, 2, type_lp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
+
+ /* 108 */
+ {LDNS_RR_TYPE_EUI48, "EUI48", 1, 1, type_eui48_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 109 */
+ {LDNS_RR_TYPE_EUI64, "EUI64", 1, 1, type_eui64_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+
+{LDNS_RR_TYPE_NULL, "TYPE110", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE111", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE112", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE113", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE114", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE115", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE116", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE117", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE118", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE119", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE120", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE121", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE122", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE123", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE124", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE125", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE126", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE127", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE128", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE129", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE130", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE131", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE132", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE133", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE134", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE135", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE136", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE137", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE138", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE139", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE140", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE141", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE142", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE143", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE144", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE145", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE146", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE147", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE148", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE149", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE150", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE151", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE152", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE153", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE154", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE155", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE156", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE157", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE158", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE159", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE160", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE161", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE162", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE163", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE164", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE165", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE166", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE167", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE168", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE169", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE170", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE171", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE172", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE173", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE174", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE175", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE176", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE177", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE178", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE179", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE180", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE181", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE182", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE183", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE184", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE185", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE186", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE187", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE188", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE189", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE190", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE191", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE192", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE193", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE194", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE195", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE196", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE197", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE198", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE199", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE200", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE201", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE202", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE203", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE204", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE205", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE206", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE207", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE208", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE209", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE210", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE211", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE212", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE213", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE214", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE215", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE216", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE217", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE218", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE219", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE220", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE221", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE222", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE223", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE224", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE225", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE226", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE227", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE228", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE229", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE230", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE231", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE232", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE233", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE234", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE235", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE236", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE237", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE238", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE239", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE240", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE241", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE242", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE243", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE244", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE245", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE246", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE247", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+{LDNS_RR_TYPE_NULL, "TYPE248", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+
+ /* LDNS_RDF_TYPE_INT16_DATA takes two fields (length and data) as one.
+ * So, unlike RFC 2930 spec, we have 7 min/max rdf's i.s.o. 8/9.
+ */
+ /* 249 */
+ {LDNS_RR_TYPE_TKEY, "TKEY", 7, 7, type_tkey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
+ /* LDNS_RDF_TYPE_INT16_DATA takes two fields (length and data) as one.
+ * So, unlike RFC 2930 spec, we have 7 min/max rdf's i.s.o. 8/9.
+ */
+ /* 250 */
+ {LDNS_RR_TYPE_TSIG, "TSIG", 7, 7, type_tsig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 },
+
+ /* IXFR: A request for a transfer of an incremental zone transfer */
+{LDNS_RR_TYPE_IXFR, "IXFR", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* AXFR: A request for a transfer of an entire zone */
+{LDNS_RR_TYPE_AXFR, "AXFR", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* MAILB: A request for mailbox-related records (MB, MG or MR) */
+{LDNS_RR_TYPE_MAILB, "MAILB", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* MAILA: A request for mail agent RRs (Obsolete - see MX) */
+{LDNS_RR_TYPE_MAILA, "MAILA", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* ANY: A request for all (available) records */
+{LDNS_RR_TYPE_ANY, "ANY", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+
+ /* 256 */
+ {LDNS_RR_TYPE_URI, "URI", 3, 3, type_uri_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+ /* 257 */
+ {LDNS_RR_TYPE_CAA, "CAA", 3, 3, type_caa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+
+/* split in array, no longer contiguous */
+
+#ifdef DRAFT_RRTYPES
+ /* 32768 */
+ {LDNS_RR_TYPE_TA, "TA", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+#else
+{LDNS_RR_TYPE_NULL, "TYPE32768", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 },
+#endif
+ /* 32769 */
+ {LDNS_RR_TYPE_DLV, "DLV", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }
+};
+
+/**
+ * \def LDNS_RDATA_FIELD_DESCRIPTORS_COUNT
+ * computes the number of rdata fields
+ */
+#define LDNS_RDATA_FIELD_DESCRIPTORS_COUNT \
+ (sizeof(rdata_field_descriptors)/sizeof(rdata_field_descriptors[0]))
+
+const sldns_rr_descriptor *
+sldns_rr_descript(uint16_t type)
+{
+ size_t i;
+ if (type < LDNS_RDATA_FIELD_DESCRIPTORS_COMMON) {
+ return &rdata_field_descriptors[type];
+ } else {
+ /* because not all array index equals type code */
+ for (i = LDNS_RDATA_FIELD_DESCRIPTORS_COMMON;
+ i < LDNS_RDATA_FIELD_DESCRIPTORS_COUNT;
+ i++) {
+ if (rdata_field_descriptors[i]._type == type) {
+ return &rdata_field_descriptors[i];
+ }
+ }
+ return &rdata_field_descriptors[0];
+ }
+}
+
+size_t
+sldns_rr_descriptor_minimum(const sldns_rr_descriptor *descriptor)
+{
+ if (descriptor) {
+ return descriptor->_minimum;
+ } else {
+ return 0;
+ }
+}
+
+size_t
+sldns_rr_descriptor_maximum(const sldns_rr_descriptor *descriptor)
+{
+ if (descriptor) {
+ if (descriptor->_variable != LDNS_RDF_TYPE_NONE) {
+ return 65535; /* cannot be more than 64k */
+ } else {
+ return descriptor->_maximum;
+ }
+ } else {
+ return 0;
+ }
+}
+
+sldns_rdf_type
+sldns_rr_descriptor_field_type(const sldns_rr_descriptor *descriptor,
+ size_t index)
+{
+ assert(descriptor != NULL);
+ assert(index < descriptor->_maximum
+ || descriptor->_variable != LDNS_RDF_TYPE_NONE);
+ if (index < descriptor->_maximum) {
+ return descriptor->_wireformat[index];
+ } else {
+ return descriptor->_variable;
+ }
+}
+
+sldns_rr_type
+sldns_get_rr_type_by_name(const char *name)
+{
+ unsigned int i;
+ const char *desc_name;
+ const sldns_rr_descriptor *desc;
+
+ /* TYPEXX representation */
+ if (strlen(name) > 4 && strncasecmp(name, "TYPE", 4) == 0) {
+ return atoi(name + 4);
+ }
+
+ /* Normal types */
+ for (i = 0; i < (unsigned int) LDNS_RDATA_FIELD_DESCRIPTORS_COUNT; i++) {
+ desc = &rdata_field_descriptors[i];
+ desc_name = desc->_name;
+ if(desc_name &&
+ strlen(name) == strlen(desc_name) &&
+ strncasecmp(name, desc_name, strlen(desc_name)) == 0) {
+ /* because not all array index equals type code */
+ return desc->_type;
+ }
+ }
+
+ /* special cases for query types */
+ if (strlen(name) == 4 && strncasecmp(name, "IXFR", 4) == 0) {
+ return 251;
+ } else if (strlen(name) == 4 && strncasecmp(name, "AXFR", 4) == 0) {
+ return 252;
+ } else if (strlen(name) == 5 && strncasecmp(name, "MAILB", 5) == 0) {
+ return 253;
+ } else if (strlen(name) == 5 && strncasecmp(name, "MAILA", 5) == 0) {
+ return 254;
+ } else if (strlen(name) == 3 && strncasecmp(name, "ANY", 3) == 0) {
+ return 255;
+ }
+
+ return 0;
+}
+
+sldns_rr_class
+sldns_get_rr_class_by_name(const char *name)
+{
+ sldns_lookup_table *lt;
+
+ /* CLASSXX representation */
+ if (strlen(name) > 5 && strncasecmp(name, "CLASS", 5) == 0) {
+ return atoi(name + 5);
+ }
+
+ /* Normal types */
+ lt = sldns_lookup_by_name(sldns_rr_classes, name);
+ if (lt) {
+ return lt->id;
+ }
+ return 0;
+}
--- /dev/null
+/*
+ * rrdef.h
+ *
+ * RR definitions
+ *
+ * a Net::DNS like library for C
+ *
+ * (c) NLnet Labs, 2005-2006
+ *
+ * See the file LICENSE for the license
+ */
+
+/**
+ * \file
+ *
+ * Defines resource record types and constants.
+ */
+
+#ifndef LDNS_RRDEF_H
+#define LDNS_RRDEF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Maximum length of a dname label */
+#define LDNS_MAX_LABELLEN 63
+/** Maximum length of a complete dname */
+#define LDNS_MAX_DOMAINLEN 255
+/** Maximum number of pointers in 1 dname */
+#define LDNS_MAX_POINTERS 65535
+/** The bytes TTL, CLASS and length use up in an rr */
+#define LDNS_RR_OVERHEAD 10
+
+#define LDNS_DNSSEC_KEYPROTO 3
+#define LDNS_KEY_ZONE_KEY 0x0100 /* set for ZSK&KSK, rfc 4034 */
+#define LDNS_KEY_SEP_KEY 0x0001 /* set for KSK, rfc 4034 */
+#define LDNS_KEY_REVOKE_KEY 0x0080 /* used to revoke KSK, rfc 5011 */
+
+/* The first fields are contiguous and can be referenced instantly */
+#define LDNS_RDATA_FIELD_DESCRIPTORS_COMMON 258
+
+/** lookuptable for rr classes */
+extern struct sldns_struct_lookup_table* sldns_rr_classes;
+
+/**
+ * The different RR classes.
+ */
+enum sldns_enum_rr_class
+{
+ /** the Internet */
+ LDNS_RR_CLASS_IN = 1,
+ /** Chaos class */
+ LDNS_RR_CLASS_CH = 3,
+ /** Hesiod (Dyer 87) */
+ LDNS_RR_CLASS_HS = 4,
+ /** None class, dynamic update */
+ LDNS_RR_CLASS_NONE = 254,
+ /** Any class */
+ LDNS_RR_CLASS_ANY = 255,
+
+ LDNS_RR_CLASS_FIRST = 0,
+ LDNS_RR_CLASS_LAST = 65535,
+ LDNS_RR_CLASS_COUNT = LDNS_RR_CLASS_LAST - LDNS_RR_CLASS_FIRST + 1
+};
+typedef enum sldns_enum_rr_class sldns_rr_class;
+
+/**
+ * Used to specify whether compression is allowed.
+ */
+enum sldns_enum_rr_compress
+{
+ /** compression is allowed */
+ LDNS_RR_COMPRESS,
+ LDNS_RR_NO_COMPRESS
+};
+typedef enum sldns_enum_rr_compress sldns_rr_compress;
+
+/**
+ * The different RR types.
+ */
+enum sldns_enum_rr_type
+{
+ /** a host address */
+ LDNS_RR_TYPE_A = 1,
+ /** an authoritative name server */
+ LDNS_RR_TYPE_NS = 2,
+ /** a mail destination (Obsolete - use MX) */
+ LDNS_RR_TYPE_MD = 3,
+ /** a mail forwarder (Obsolete - use MX) */
+ LDNS_RR_TYPE_MF = 4,
+ /** the canonical name for an alias */
+ LDNS_RR_TYPE_CNAME = 5,
+ /** marks the start of a zone of authority */
+ LDNS_RR_TYPE_SOA = 6,
+ /** a mailbox domain name (EXPERIMENTAL) */
+ LDNS_RR_TYPE_MB = 7,
+ /** a mail group member (EXPERIMENTAL) */
+ LDNS_RR_TYPE_MG = 8,
+ /** a mail rename domain name (EXPERIMENTAL) */
+ LDNS_RR_TYPE_MR = 9,
+ /** a null RR (EXPERIMENTAL) */
+ LDNS_RR_TYPE_NULL = 10,
+ /** a well known service description */
+ LDNS_RR_TYPE_WKS = 11,
+ /** a domain name pointer */
+ LDNS_RR_TYPE_PTR = 12,
+ /** host information */
+ LDNS_RR_TYPE_HINFO = 13,
+ /** mailbox or mail list information */
+ LDNS_RR_TYPE_MINFO = 14,
+ /** mail exchange */
+ LDNS_RR_TYPE_MX = 15,
+ /** text strings */
+ LDNS_RR_TYPE_TXT = 16,
+ /** RFC1183 */
+ LDNS_RR_TYPE_RP = 17,
+ /** RFC1183 */
+ LDNS_RR_TYPE_AFSDB = 18,
+ /** RFC1183 */
+ LDNS_RR_TYPE_X25 = 19,
+ /** RFC1183 */
+ LDNS_RR_TYPE_ISDN = 20,
+ /** RFC1183 */
+ LDNS_RR_TYPE_RT = 21,
+ /** RFC1706 */
+ LDNS_RR_TYPE_NSAP = 22,
+ /** RFC1348 */
+ LDNS_RR_TYPE_NSAP_PTR = 23,
+ /** 2535typecode */
+ LDNS_RR_TYPE_SIG = 24,
+ /** 2535typecode */
+ LDNS_RR_TYPE_KEY = 25,
+ /** RFC2163 */
+ LDNS_RR_TYPE_PX = 26,
+ /** RFC1712 */
+ LDNS_RR_TYPE_GPOS = 27,
+ /** ipv6 address */
+ LDNS_RR_TYPE_AAAA = 28,
+ /** LOC record RFC1876 */
+ LDNS_RR_TYPE_LOC = 29,
+ /** 2535typecode */
+ LDNS_RR_TYPE_NXT = 30,
+ /** draft-ietf-nimrod-dns-01.txt */
+ LDNS_RR_TYPE_EID = 31,
+ /** draft-ietf-nimrod-dns-01.txt */
+ LDNS_RR_TYPE_NIMLOC = 32,
+ /** SRV record RFC2782 */
+ LDNS_RR_TYPE_SRV = 33,
+ /** http://www.jhsoft.com/rfc/af-saa-0069.000.rtf */
+ LDNS_RR_TYPE_ATMA = 34,
+ /** RFC2915 */
+ LDNS_RR_TYPE_NAPTR = 35,
+ /** RFC2230 */
+ LDNS_RR_TYPE_KX = 36,
+ /** RFC2538 */
+ LDNS_RR_TYPE_CERT = 37,
+ /** RFC2874 */
+ LDNS_RR_TYPE_A6 = 38,
+ /** RFC2672 */
+ LDNS_RR_TYPE_DNAME = 39,
+ /** dnsind-kitchen-sink-02.txt */
+ LDNS_RR_TYPE_SINK = 40,
+ /** Pseudo OPT record... */
+ LDNS_RR_TYPE_OPT = 41,
+ /** RFC3123 */
+ LDNS_RR_TYPE_APL = 42,
+ /** RFC4034, RFC3658 */
+ LDNS_RR_TYPE_DS = 43,
+ /** SSH Key Fingerprint */
+ LDNS_RR_TYPE_SSHFP = 44, /* RFC 4255 */
+ /** IPsec Key */
+ LDNS_RR_TYPE_IPSECKEY = 45, /* RFC 4025 */
+ /** DNSSEC */
+ LDNS_RR_TYPE_RRSIG = 46, /* RFC 4034 */
+ LDNS_RR_TYPE_NSEC = 47, /* RFC 4034 */
+ LDNS_RR_TYPE_DNSKEY = 48, /* RFC 4034 */
+
+ LDNS_RR_TYPE_DHCID = 49, /* RFC 4701 */
+ /* NSEC3 */
+ LDNS_RR_TYPE_NSEC3 = 50, /* RFC 5155 */
+ LDNS_RR_TYPE_NSEC3PARAM = 51, /* RFC 5155 */
+ LDNS_RR_TYPE_NSEC3PARAMS = 51,
+ LDNS_RR_TYPE_TLSA = 52, /* RFC 6698 */
+
+ LDNS_RR_TYPE_HIP = 55, /* RFC 5205 */
+
+ /** draft-reid-dnsext-zs */
+ LDNS_RR_TYPE_NINFO = 56,
+ /** draft-reid-dnsext-rkey */
+ LDNS_RR_TYPE_RKEY = 57,
+ /** draft-ietf-dnsop-trust-history */
+ LDNS_RR_TYPE_TALINK = 58,
+ LDNS_RR_TYPE_CDS = 59, /** RFC 7344 */
+ LDNS_RR_TYPE_CDNSKEY = 60, /** RFC 7344 */
+
+ LDNS_RR_TYPE_SPF = 99, /* RFC 4408 */
+
+ LDNS_RR_TYPE_UINFO = 100,
+ LDNS_RR_TYPE_UID = 101,
+ LDNS_RR_TYPE_GID = 102,
+ LDNS_RR_TYPE_UNSPEC = 103,
+
+ LDNS_RR_TYPE_NID = 104, /* RFC 6742 */
+ LDNS_RR_TYPE_L32 = 105, /* RFC 6742 */
+ LDNS_RR_TYPE_L64 = 106, /* RFC 6742 */
+ LDNS_RR_TYPE_LP = 107, /* RFC 6742 */
+
+ /** draft-jabley-dnsext-eui48-eui64-rrtypes */
+ LDNS_RR_TYPE_EUI48 = 108,
+ LDNS_RR_TYPE_EUI64 = 109,
+
+ LDNS_RR_TYPE_TKEY = 249, /* RFC 2930 */
+ LDNS_RR_TYPE_TSIG = 250,
+ LDNS_RR_TYPE_IXFR = 251,
+ LDNS_RR_TYPE_AXFR = 252,
+ /** A request for mailbox-related records (MB, MG or MR) */
+ LDNS_RR_TYPE_MAILB = 253,
+ /** A request for mail agent RRs (Obsolete - see MX) */
+ LDNS_RR_TYPE_MAILA = 254,
+ /** any type (wildcard) */
+ LDNS_RR_TYPE_ANY = 255,
+ LDNS_RR_TYPE_URI = 256, /* RFC 7553 */
+ LDNS_RR_TYPE_CAA = 257, /* RFC 6844 */
+
+ /** DNSSEC Trust Authorities */
+ LDNS_RR_TYPE_TA = 32768,
+ /* RFC 4431, 5074, DNSSEC Lookaside Validation */
+ LDNS_RR_TYPE_DLV = 32769,
+
+ /* type codes from nsec3 experimental phase
+ LDNS_RR_TYPE_NSEC3 = 65324,
+ LDNS_RR_TYPE_NSEC3PARAMS = 65325, */
+ LDNS_RR_TYPE_FIRST = 0,
+ LDNS_RR_TYPE_LAST = 65535,
+ LDNS_RR_TYPE_COUNT = LDNS_RR_TYPE_LAST - LDNS_RR_TYPE_FIRST + 1
+};
+typedef enum sldns_enum_rr_type sldns_rr_type;
+
+/* RDATA */
+#define LDNS_MAX_RDFLEN 65535
+
+#define LDNS_RDF_SIZE_BYTE 1
+#define LDNS_RDF_SIZE_WORD 2
+#define LDNS_RDF_SIZE_DOUBLEWORD 4
+#define LDNS_RDF_SIZE_6BYTES 6
+#define LDNS_RDF_SIZE_8BYTES 8
+#define LDNS_RDF_SIZE_16BYTES 16
+
+#define LDNS_NSEC3_VARS_OPTOUT_MASK 0x01
+
+#define LDNS_APL_IP4 1
+#define LDNS_APL_IP6 2
+#define LDNS_APL_MASK 0x7f
+#define LDNS_APL_NEGATION 0x80
+
+/**
+ * The different types of RDATA fields.
+ */
+enum sldns_enum_rdf_type
+{
+ /** none */
+ LDNS_RDF_TYPE_NONE,
+ /** domain name */
+ LDNS_RDF_TYPE_DNAME,
+ /** 8 bits */
+ LDNS_RDF_TYPE_INT8,
+ /** 16 bits */
+ LDNS_RDF_TYPE_INT16,
+ /** 32 bits */
+ LDNS_RDF_TYPE_INT32,
+ /** A record */
+ LDNS_RDF_TYPE_A,
+ /** AAAA record */
+ LDNS_RDF_TYPE_AAAA,
+ /** txt string */
+ LDNS_RDF_TYPE_STR,
+ /** apl data */
+ LDNS_RDF_TYPE_APL,
+ /** b32 string */
+ LDNS_RDF_TYPE_B32_EXT,
+ /** b64 string */
+ LDNS_RDF_TYPE_B64,
+ /** hex string */
+ LDNS_RDF_TYPE_HEX,
+ /** nsec type codes */
+ LDNS_RDF_TYPE_NSEC,
+ /** a RR type */
+ LDNS_RDF_TYPE_TYPE,
+ /** a class */
+ LDNS_RDF_TYPE_CLASS,
+ /** certificate algorithm */
+ LDNS_RDF_TYPE_CERT_ALG,
+ /** a key algorithm */
+ LDNS_RDF_TYPE_ALG,
+ /** unknown types */
+ LDNS_RDF_TYPE_UNKNOWN,
+ /** time (32 bits) */
+ LDNS_RDF_TYPE_TIME,
+ /** period */
+ LDNS_RDF_TYPE_PERIOD,
+ /** tsig time 48 bits */
+ LDNS_RDF_TYPE_TSIGTIME,
+ /** Represents the Public Key Algorithm, HIT and Public Key fields
+ for the HIP RR types. A HIP specific rdf type is used because of
+ the unusual layout in wireformat (see RFC 5205 Section 5) */
+ LDNS_RDF_TYPE_HIP,
+ /** variable length any type rdata where the length
+ is specified by the first 2 bytes */
+ LDNS_RDF_TYPE_INT16_DATA,
+ /** protocol and port bitmaps */
+ LDNS_RDF_TYPE_SERVICE,
+ /** location data */
+ LDNS_RDF_TYPE_LOC,
+ /** well known services */
+ LDNS_RDF_TYPE_WKS,
+ /** NSAP */
+ LDNS_RDF_TYPE_NSAP,
+ /** ATMA */
+ LDNS_RDF_TYPE_ATMA,
+ /** IPSECKEY */
+ LDNS_RDF_TYPE_IPSECKEY,
+ /** nsec3 hash salt */
+ LDNS_RDF_TYPE_NSEC3_SALT,
+ /** nsec3 base32 string (with length byte on wire */
+ LDNS_RDF_TYPE_NSEC3_NEXT_OWNER,
+
+ /** 4 shorts represented as 4 * 16 bit hex numbers
+ * seperated by colons. For NID and L64.
+ */
+ LDNS_RDF_TYPE_ILNP64,
+
+ /** 6 * 8 bit hex numbers seperated by dashes. For EUI48. */
+ LDNS_RDF_TYPE_EUI48,
+ /** 8 * 8 bit hex numbers seperated by dashes. For EUI64. */
+ LDNS_RDF_TYPE_EUI64,
+
+ /** A non-zero sequence of US-ASCII letters and numbers in lower case.
+ * For CAA.
+ */
+ LDNS_RDF_TYPE_TAG,
+
+ /** A <character-string> encoding of the value field as specified
+ * [RFC1035], Section 5.1., encoded as remaining rdata.
+ * For CAA.
+ */
+ LDNS_RDF_TYPE_LONG_STR,
+
+ /* Aliases */
+ LDNS_RDF_TYPE_BITMAP = LDNS_RDF_TYPE_NSEC
+};
+typedef enum sldns_enum_rdf_type sldns_rdf_type;
+
+/**
+ * Algorithms used in dns
+ */
+enum sldns_enum_algorithm
+{
+ LDNS_RSAMD5 = 1, /* RFC 4034,4035 */
+ LDNS_DH = 2,
+ LDNS_DSA = 3,
+ LDNS_ECC = 4,
+ LDNS_RSASHA1 = 5,
+ LDNS_DSA_NSEC3 = 6,
+ LDNS_RSASHA1_NSEC3 = 7,
+ LDNS_RSASHA256 = 8, /* RFC 5702 */
+ LDNS_RSASHA512 = 10, /* RFC 5702 */
+ LDNS_ECC_GOST = 12, /* RFC 5933 */
+ LDNS_ECDSAP256SHA256 = 13, /* RFC 6605 */
+ LDNS_ECDSAP384SHA384 = 14, /* RFC 6605 */
+ LDNS_INDIRECT = 252,
+ LDNS_PRIVATEDNS = 253,
+ LDNS_PRIVATEOID = 254
+};
+typedef enum sldns_enum_algorithm sldns_algorithm;
+
+/**
+ * Hashing algorithms used in the DS record
+ */
+enum sldns_enum_hash
+{
+ LDNS_SHA1 = 1, /* RFC 4034 */
+ LDNS_SHA256 = 2, /* RFC 4509 */
+ LDNS_HASH_GOST = 3, /* RFC 5933 */
+ LDNS_SHA384 = 4 /* RFC 6605 */
+};
+typedef enum sldns_enum_hash sldns_hash;
+
+/**
+ * algorithms used in CERT rrs
+ */
+enum sldns_enum_cert_algorithm
+{
+ LDNS_CERT_PKIX = 1,
+ LDNS_CERT_SPKI = 2,
+ LDNS_CERT_PGP = 3,
+ LDNS_CERT_IPKIX = 4,
+ LDNS_CERT_ISPKI = 5,
+ LDNS_CERT_IPGP = 6,
+ LDNS_CERT_ACPKIX = 7,
+ LDNS_CERT_IACPKIX = 8,
+ LDNS_CERT_URI = 253,
+ LDNS_CERT_OID = 254
+};
+typedef enum sldns_enum_cert_algorithm sldns_cert_algorithm;
+
+/**
+ * EDNS option codes
+ */
+enum sldns_enum_edns_option
+{
+ LDNS_EDNS_LLQ = 1, /* http://files.dns-sd.org/draft-sekar-dns-llq.txt */
+ LDNS_EDNS_UL = 2, /* http://files.dns-sd.org/draft-sekar-dns-ul.txt */
+ LDNS_EDNS_NSID = 3, /* RFC5001 */
+ /* 4 draft-cheshire-edns0-owner-option */
+ LDNS_EDNS_DAU = 5, /* RFC6975 */
+ LDNS_EDNS_DHU = 6, /* RFC6975 */
+ LDNS_EDNS_N3U = 7, /* RFC6975 */
+ LDNS_EDNS_CLIENT_SUBNET = 8 /* draft-vandergaast-edns-client-subnet */
+};
+typedef enum sldns_enum_edns_option sldns_edns_option;
+
+#define LDNS_EDNS_MASK_DO_BIT 0x8000
+
+/**
+ * Contains all information about resource record types.
+ *
+ * This structure contains, for all rr types, the rdata fields that are defined.
+ */
+struct sldns_struct_rr_descriptor
+{
+ /** Type of the RR that is described here */
+ sldns_rr_type _type;
+ /** Textual name of the RR type. */
+ const char *_name;
+ /** Minimum number of rdata fields in the RRs of this type. */
+ uint8_t _minimum;
+ /** Maximum number of rdata fields in the RRs of this type. */
+ uint8_t _maximum;
+ /** Wireformat specification for the rr, i.e. the types of rdata fields in their respective order. */
+ const sldns_rdf_type *_wireformat;
+ /** Special rdf types */
+ sldns_rdf_type _variable;
+ /** Specifies whether compression can be used for dnames in this RR type. */
+ sldns_rr_compress _compress;
+ /** The number of DNAMEs in the _wireformat string, for parsing. */
+ uint8_t _dname_count;
+};
+typedef struct sldns_struct_rr_descriptor sldns_rr_descriptor;
+
+/**
+ * returns the resource record descriptor for the given rr type.
+ *
+ * \param[in] type the type value of the rr type
+ *\return the sldns_rr_descriptor for this type
+ */
+const sldns_rr_descriptor *sldns_rr_descript(uint16_t type);
+
+/**
+ * returns the minimum number of rdata fields of the rr type this descriptor describes.
+ *
+ * \param[in] descriptor for an rr type
+ * \return the minimum number of rdata fields
+ */
+size_t sldns_rr_descriptor_minimum(const sldns_rr_descriptor *descriptor);
+
+/**
+ * returns the maximum number of rdata fields of the rr type this descriptor describes.
+ *
+ * \param[in] descriptor for an rr type
+ * \return the maximum number of rdata fields
+ */
+size_t sldns_rr_descriptor_maximum(const sldns_rr_descriptor *descriptor);
+
+/**
+ * returns the rdf type for the given rdata field number of the rr type for the given descriptor.
+ *
+ * \param[in] descriptor for an rr type
+ * \param[in] field the field number
+ * \return the rdf type for the field
+ */
+sldns_rdf_type sldns_rr_descriptor_field_type(const sldns_rr_descriptor *descriptor, size_t field);
+
+/**
+ * retrieves a rrtype by looking up its name.
+ * \param[in] name a string with the name
+ * \return the type which corresponds with the name
+ */
+sldns_rr_type sldns_get_rr_type_by_name(const char *name);
+
+/**
+ * retrieves a class by looking up its name.
+ * \param[in] name string with the name
+ * \return the cass which corresponds with the name
+ */
+sldns_rr_class sldns_get_rr_class_by_name(const char *name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LDNS_RRDEF_H */
--- /dev/null
+/*
+ * buffer.c -- generic memory buffer .
+ *
+ * Copyright (c) 2001-2008, NLnet Labs. All rights reserved.
+ *
+ * See LICENSE for the license.
+ *
+ */
+/**
+ * \file
+ *
+ * This file contains the definition of sldns_buffer, and functions to manipulate those.
+ */
+#include "config.h"
+#include "sldns/sbuffer.h"
+#include <stdarg.h>
+
+sldns_buffer *
+sldns_buffer_new(size_t capacity)
+{
+ sldns_buffer *buffer = (sldns_buffer*)malloc(sizeof(sldns_buffer));
+
+ if (!buffer) {
+ return NULL;
+ }
+
+ buffer->_data = (uint8_t *) malloc(capacity);
+ if (!buffer->_data) {
+ free(buffer);
+ return NULL;
+ }
+
+ buffer->_position = 0;
+ buffer->_limit = buffer->_capacity = capacity;
+ buffer->_fixed = 0;
+ buffer->_status_err = 0;
+
+ sldns_buffer_invariant(buffer);
+
+ return buffer;
+}
+
+void
+sldns_buffer_new_frm_data(sldns_buffer *buffer, void *data, size_t size)
+{
+ assert(data != NULL);
+
+ buffer->_position = 0;
+ buffer->_limit = buffer->_capacity = size;
+ buffer->_fixed = 0;
+ buffer->_data = malloc(size);
+ if(!buffer->_data) {
+ buffer->_status_err = 1;
+ return;
+ }
+ memcpy(buffer->_data, data, size);
+ buffer->_status_err = 0;
+
+ sldns_buffer_invariant(buffer);
+}
+
+void
+sldns_buffer_init_frm_data(sldns_buffer *buffer, void *data, size_t size)
+{
+ memset(buffer, 0, sizeof(*buffer));
+ buffer->_data = data;
+ buffer->_capacity = buffer->_limit = size;
+ buffer->_fixed = 1;
+}
+
+int
+sldns_buffer_set_capacity(sldns_buffer *buffer, size_t capacity)
+{
+ void *data;
+
+ sldns_buffer_invariant(buffer);
+ assert(buffer->_position <= capacity);
+
+ data = (uint8_t *) realloc(buffer->_data, capacity);
+ if (!data) {
+ buffer->_status_err = 1;
+ return 0;
+ } else {
+ buffer->_data = data;
+ buffer->_limit = buffer->_capacity = capacity;
+ return 1;
+ }
+}
+
+int
+sldns_buffer_reserve(sldns_buffer *buffer, size_t amount)
+{
+ sldns_buffer_invariant(buffer);
+ assert(!buffer->_fixed);
+ if (buffer->_capacity < buffer->_position + amount) {
+ size_t new_capacity = buffer->_capacity * 3 / 2;
+
+ if (new_capacity < buffer->_position + amount) {
+ new_capacity = buffer->_position + amount;
+ }
+ if (!sldns_buffer_set_capacity(buffer, new_capacity)) {
+ buffer->_status_err = 1;
+ return 0;
+ }
+ }
+ buffer->_limit = buffer->_capacity;
+ return 1;
+}
+
+int
+sldns_buffer_printf(sldns_buffer *buffer, const char *format, ...)
+{
+ va_list args;
+ int written = 0;
+ size_t remaining;
+
+ if (sldns_buffer_status_ok(buffer)) {
+ sldns_buffer_invariant(buffer);
+ assert(buffer->_limit == buffer->_capacity);
+
+ remaining = sldns_buffer_remaining(buffer);
+ va_start(args, format);
+ written = vsnprintf((char *) sldns_buffer_current(buffer), remaining,
+ format, args);
+ va_end(args);
+ if (written == -1) {
+ buffer->_status_err = 1;
+ return -1;
+ } else if ((size_t) written >= remaining) {
+ if (!sldns_buffer_reserve(buffer, (size_t) written + 1)) {
+ buffer->_status_err = 1;
+ return -1;
+ }
+ va_start(args, format);
+ written = vsnprintf((char *) sldns_buffer_current(buffer),
+ sldns_buffer_remaining(buffer), format, args);
+ va_end(args);
+ if (written == -1) {
+ buffer->_status_err = 1;
+ return -1;
+ }
+ }
+ buffer->_position += written;
+ }
+ return written;
+}
+
+void
+sldns_buffer_free(sldns_buffer *buffer)
+{
+ if (!buffer) {
+ return;
+ }
+
+ if (!buffer->_fixed)
+ free(buffer->_data);
+
+ free(buffer);
+}
+
+void *
+sldns_buffer_export(sldns_buffer *buffer)
+{
+ buffer->_fixed = 1;
+ return buffer->_data;
+}
+
+void
+sldns_buffer_copy(sldns_buffer* result, sldns_buffer* from)
+{
+ size_t tocopy = sldns_buffer_limit(from);
+
+ if(tocopy > sldns_buffer_capacity(result))
+ tocopy = sldns_buffer_capacity(result);
+ sldns_buffer_clear(result);
+ sldns_buffer_write(result, sldns_buffer_begin(from), tocopy);
+ sldns_buffer_flip(result);
+}
--- /dev/null
+/*
+ * buffer.h -- generic memory buffer.
+ *
+ * Copyright (c) 2005-2008, NLnet Labs. All rights reserved.
+ *
+ * See LICENSE for the license.
+ *
+ *
+ * The buffer module implements a generic buffer. The API is based on
+ * the java.nio.Buffer interface.
+ */
+
+#ifndef LDNS_SBUFFER_H
+#define LDNS_SBUFFER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef S_SPLINT_S
+# define INLINE
+#else
+# ifdef SWIG
+# define INLINE static
+# else
+# define INLINE static inline
+# endif
+#endif
+
+/*
+ * Copy data allowing for unaligned accesses in network byte order
+ * (big endian).
+ */
+INLINE uint16_t
+sldns_read_uint16(const void *src)
+{
+#ifdef ALLOW_UNALIGNED_ACCESSES
+ return ntohs(*(const uint16_t *) src);
+#else
+ const uint8_t *p = (const uint8_t *) src;
+ return ((uint16_t) p[0] << 8) | (uint16_t) p[1];
+#endif
+}
+
+INLINE uint32_t
+sldns_read_uint32(const void *src)
+{
+#ifdef ALLOW_UNALIGNED_ACCESSES
+ return ntohl(*(const uint32_t *) src);
+#else
+ const uint8_t *p = (const uint8_t *) src;
+ return ( ((uint32_t) p[0] << 24)
+ | ((uint32_t) p[1] << 16)
+ | ((uint32_t) p[2] << 8)
+ | (uint32_t) p[3]);
+#endif
+}
+
+/*
+ * Copy data allowing for unaligned accesses in network byte order
+ * (big endian).
+ */
+INLINE void
+sldns_write_uint16(void *dst, uint16_t data)
+{
+#ifdef ALLOW_UNALIGNED_ACCESSES
+ * (uint16_t *) dst = htons(data);
+#else
+ uint8_t *p = (uint8_t *) dst;
+ p[0] = (uint8_t) ((data >> 8) & 0xff);
+ p[1] = (uint8_t) (data & 0xff);
+#endif
+}
+
+INLINE void
+sldns_write_uint32(void *dst, uint32_t data)
+{
+#ifdef ALLOW_UNALIGNED_ACCESSES
+ * (uint32_t *) dst = htonl(data);
+#else
+ uint8_t *p = (uint8_t *) dst;
+ p[0] = (uint8_t) ((data >> 24) & 0xff);
+ p[1] = (uint8_t) ((data >> 16) & 0xff);
+ p[2] = (uint8_t) ((data >> 8) & 0xff);
+ p[3] = (uint8_t) (data & 0xff);
+#endif
+}
+
+
+/**
+ * \file sbuffer.h
+ *
+ * This file contains the definition of sldns_buffer, and functions to manipulate those.
+ */
+
+/**
+ * implementation of buffers to ease operations
+ *
+ * sldns_buffers can contain arbitrary information, per octet. You can write
+ * to the current end of a buffer, read from the current position, and
+ * access any data within it.
+ */
+struct sldns_buffer
+{
+ /** The current position used for reading/writing */
+ size_t _position;
+
+ /** The read/write limit */
+ size_t _limit;
+
+ /** The amount of data the buffer can contain */
+ size_t _capacity;
+
+ /** The data contained in the buffer */
+ uint8_t *_data;
+
+ /** If the buffer is fixed it cannot be resized */
+ unsigned _fixed : 1;
+
+ /** The current state of the buffer. If writing to the buffer fails
+ * for any reason, this value is changed. This way, you can perform
+ * multiple writes in sequence and check for success afterwards. */
+ unsigned _status_err : 1;
+};
+typedef struct sldns_buffer sldns_buffer;
+
+#ifdef NDEBUG
+INLINE void
+sldns_buffer_invariant(sldns_buffer *ATTR_UNUSED(buffer))
+{
+}
+#else
+INLINE void
+sldns_buffer_invariant(sldns_buffer *buffer)
+{
+ assert(buffer != NULL);
+ assert(buffer->_position <= buffer->_limit);
+ assert(buffer->_limit <= buffer->_capacity);
+ assert(buffer->_data != NULL);
+}
+#endif
+
+/**
+ * creates a new buffer with the specified capacity.
+ *
+ * \param[in] capacity the size (in bytes) to allocate for the buffer
+ * \return the created buffer
+ */
+sldns_buffer *sldns_buffer_new(size_t capacity);
+
+/**
+ * creates a buffer with the specified data. The data IS copied
+ * and MEMORY allocations are done. The buffer is not fixed and can
+ * be resized using buffer_reserve().
+ *
+ * \param[in] buffer pointer to the buffer to put the data in
+ * \param[in] data the data to encapsulate in the buffer
+ * \param[in] size the size of the data
+ */
+void sldns_buffer_new_frm_data(sldns_buffer *buffer, void *data, size_t size);
+
+/**
+ * Setup a buffer with the data pointed to. No data copied, no memory allocs.
+ * The buffer is fixed.
+ * \param[in] buffer pointer to the buffer to put the data in
+ * \param[in] data the data to encapsulate in the buffer
+ * \param[in] size the size of the data
+ */
+void sldns_buffer_init_frm_data(sldns_buffer *buffer, void *data, size_t size);
+
+/**
+ * clears the buffer and make it ready for writing. The buffer's limit
+ * is set to the capacity and the position is set to 0.
+ * \param[in] buffer the buffer to clear
+ */
+INLINE void sldns_buffer_clear(sldns_buffer *buffer)
+{
+ sldns_buffer_invariant(buffer);
+
+ /* reset status here? */
+
+ buffer->_position = 0;
+ buffer->_limit = buffer->_capacity;
+}
+
+/**
+ * makes the buffer ready for reading the data that has been written to
+ * the buffer. The buffer's limit is set to the current position and
+ * the position is set to 0.
+ *
+ * \param[in] buffer the buffer to flip
+ * \return void
+ */
+INLINE void sldns_buffer_flip(sldns_buffer *buffer)
+{
+ sldns_buffer_invariant(buffer);
+
+ buffer->_limit = buffer->_position;
+ buffer->_position = 0;
+}
+
+/**
+ * make the buffer ready for re-reading the data. The buffer's
+ * position is reset to 0.
+ * \param[in] buffer the buffer to rewind
+ */
+INLINE void sldns_buffer_rewind(sldns_buffer *buffer)
+{
+ sldns_buffer_invariant(buffer);
+
+ buffer->_position = 0;
+}
+
+/**
+ * returns the current position in the buffer (as a number of bytes)
+ * \param[in] buffer the buffer
+ * \return the current position
+ */
+INLINE size_t
+sldns_buffer_position(sldns_buffer *buffer)
+{
+ return buffer->_position;
+}
+
+/**
+ * sets the buffer's position to MARK. The position must be less than
+ * or equal to the buffer's limit.
+ * \param[in] buffer the buffer
+ * \param[in] mark the mark to use
+ */
+INLINE void
+sldns_buffer_set_position(sldns_buffer *buffer, size_t mark)
+{
+ assert(mark <= buffer->_limit);
+ buffer->_position = mark;
+}
+
+/**
+ * changes the buffer's position by COUNT bytes. The position must not
+ * be moved behind the buffer's limit or before the beginning of the
+ * buffer.
+ * \param[in] buffer the buffer
+ * \param[in] count the count to use
+ */
+INLINE void
+sldns_buffer_skip(sldns_buffer *buffer, ssize_t count)
+{
+ assert(buffer->_position + count <= buffer->_limit);
+ buffer->_position += count;
+}
+
+/**
+ * returns the maximum size of the buffer
+ * \param[in] buffer
+ * \return the size
+ */
+INLINE size_t
+sldns_buffer_limit(sldns_buffer *buffer)
+{
+ return buffer->_limit;
+}
+
+/**
+ * changes the buffer's limit. If the buffer's position is greater
+ * than the new limit the position is set to the limit.
+ * \param[in] buffer the buffer
+ * \param[in] limit the new limit
+ */
+INLINE void
+sldns_buffer_set_limit(sldns_buffer *buffer, size_t limit)
+{
+ assert(limit <= buffer->_capacity);
+ buffer->_limit = limit;
+ if (buffer->_position > buffer->_limit)
+ buffer->_position = buffer->_limit;
+}
+
+/**
+ * returns the number of bytes the buffer can hold.
+ * \param[in] buffer the buffer
+ * \return the number of bytes
+ */
+INLINE size_t
+sldns_buffer_capacity(sldns_buffer *buffer)
+{
+ return buffer->_capacity;
+}
+
+/**
+ * changes the buffer's capacity. The data is reallocated so any
+ * pointers to the data may become invalid. The buffer's limit is set
+ * to the buffer's new capacity.
+ * \param[in] buffer the buffer
+ * \param[in] capacity the capacity to use
+ * \return whether this failed or succeeded
+ */
+int sldns_buffer_set_capacity(sldns_buffer *buffer, size_t capacity);
+
+/**
+ * ensures BUFFER can contain at least AMOUNT more bytes. The buffer's
+ * capacity is increased if necessary using buffer_set_capacity().
+ *
+ * The buffer's limit is always set to the (possibly increased)
+ * capacity.
+ * \param[in] buffer the buffer
+ * \param[in] amount amount to use
+ * \return whether this failed or succeeded
+ */
+int sldns_buffer_reserve(sldns_buffer *buffer, size_t amount);
+
+/**
+ * returns a pointer to the data at the indicated position.
+ * \param[in] buffer the buffer
+ * \param[in] at position
+ * \return the pointer to the data
+ */
+INLINE uint8_t *
+sldns_buffer_at(const sldns_buffer *buffer, size_t at)
+{
+ assert(at <= buffer->_limit);
+ return buffer->_data + at;
+}
+
+/**
+ * returns a pointer to the beginning of the buffer (the data at
+ * position 0).
+ * \param[in] buffer the buffer
+ * \return the pointer
+ */
+INLINE uint8_t *
+sldns_buffer_begin(const sldns_buffer *buffer)
+{
+ return sldns_buffer_at(buffer, 0);
+}
+
+/**
+ * returns a pointer to the end of the buffer (the data at the buffer's
+ * limit).
+ * \param[in] buffer the buffer
+ * \return the pointer
+ */
+INLINE uint8_t *
+sldns_buffer_end(sldns_buffer *buffer)
+{
+ return sldns_buffer_at(buffer, buffer->_limit);
+}
+
+/**
+ * returns a pointer to the data at the buffer's current position.
+ * \param[in] buffer the buffer
+ * \return the pointer
+ */
+INLINE uint8_t *
+sldns_buffer_current(sldns_buffer *buffer)
+{
+ return sldns_buffer_at(buffer, buffer->_position);
+}
+
+/**
+ * returns the number of bytes remaining between the indicated position and
+ * the limit.
+ * \param[in] buffer the buffer
+ * \param[in] at indicated position
+ * \return number of bytes
+ */
+INLINE size_t
+sldns_buffer_remaining_at(sldns_buffer *buffer, size_t at)
+{
+ sldns_buffer_invariant(buffer);
+ assert(at <= buffer->_limit);
+ return buffer->_limit - at;
+}
+
+/**
+ * returns the number of bytes remaining between the buffer's position and
+ * limit.
+ * \param[in] buffer the buffer
+ * \return the number of bytes
+ */
+INLINE size_t
+sldns_buffer_remaining(sldns_buffer *buffer)
+{
+ return sldns_buffer_remaining_at(buffer, buffer->_position);
+}
+
+/**
+ * checks if the buffer has at least COUNT more bytes available.
+ * Before reading or writing the caller needs to ensure enough space
+ * is available!
+ * \param[in] buffer the buffer
+ * \param[in] at indicated position
+ * \param[in] count how much is available
+ * \return true or false (as int?)
+ */
+INLINE int
+sldns_buffer_available_at(sldns_buffer *buffer, size_t at, size_t count)
+{
+ return count <= sldns_buffer_remaining_at(buffer, at);
+}
+
+/**
+ * checks if the buffer has count bytes available at the current position
+ * \param[in] buffer the buffer
+ * \param[in] count how much is available
+ * \return true or false (as int?)
+ */
+INLINE int
+sldns_buffer_available(sldns_buffer *buffer, size_t count)
+{
+ return sldns_buffer_available_at(buffer, buffer->_position, count);
+}
+
+/**
+ * writes the given data to the buffer at the specified position
+ * \param[in] buffer the buffer
+ * \param[in] at the position (in number of bytes) to write the data at
+ * \param[in] data pointer to the data to write to the buffer
+ * \param[in] count the number of bytes of data to write
+ */
+INLINE void
+sldns_buffer_write_at(sldns_buffer *buffer, size_t at, const void *data, size_t count)
+{
+ assert(sldns_buffer_available_at(buffer, at, count));
+ memcpy(buffer->_data + at, data, count);
+}
+
+/**
+ * writes count bytes of data to the current position of the buffer
+ * \param[in] buffer the buffer
+ * \param[in] data the data to write
+ * \param[in] count the lenght of the data to write
+ */
+INLINE void
+sldns_buffer_write(sldns_buffer *buffer, const void *data, size_t count)
+{
+ sldns_buffer_write_at(buffer, buffer->_position, data, count);
+ buffer->_position += count;
+}
+
+/**
+ * copies the given (null-delimited) string to the specified position at the buffer
+ * \param[in] buffer the buffer
+ * \param[in] at the position in the buffer
+ * \param[in] str the string to write
+ */
+INLINE void
+sldns_buffer_write_string_at(sldns_buffer *buffer, size_t at, const char *str)
+{
+ sldns_buffer_write_at(buffer, at, str, strlen(str));
+}
+
+/**
+ * copies the given (null-delimited) string to the current position at the buffer
+ * \param[in] buffer the buffer
+ * \param[in] str the string to write
+ */
+INLINE void
+sldns_buffer_write_string(sldns_buffer *buffer, const char *str)
+{
+ sldns_buffer_write(buffer, str, strlen(str));
+}
+
+/**
+ * writes the given byte of data at the given position in the buffer
+ * \param[in] buffer the buffer
+ * \param[in] at the position in the buffer
+ * \param[in] data the 8 bits to write
+ */
+INLINE void
+sldns_buffer_write_u8_at(sldns_buffer *buffer, size_t at, uint8_t data)
+{
+ assert(sldns_buffer_available_at(buffer, at, sizeof(data)));
+ buffer->_data[at] = data;
+}
+
+/**
+ * writes the given byte of data at the current position in the buffer
+ * \param[in] buffer the buffer
+ * \param[in] data the 8 bits to write
+ */
+INLINE void
+sldns_buffer_write_u8(sldns_buffer *buffer, uint8_t data)
+{
+ sldns_buffer_write_u8_at(buffer, buffer->_position, data);
+ buffer->_position += sizeof(data);
+}
+
+/**
+ * writes the given 2 byte integer at the given position in the buffer
+ * \param[in] buffer the buffer
+ * \param[in] at the position in the buffer
+ * \param[in] data the 16 bits to write
+ */
+INLINE void
+sldns_buffer_write_u16_at(sldns_buffer *buffer, size_t at, uint16_t data)
+{
+ assert(sldns_buffer_available_at(buffer, at, sizeof(data)));
+ sldns_write_uint16(buffer->_data + at, data);
+}
+
+/**
+ * writes the given 2 byte integer at the current position in the buffer
+ * \param[in] buffer the buffer
+ * \param[in] data the 16 bits to write
+ */
+INLINE void
+sldns_buffer_write_u16(sldns_buffer *buffer, uint16_t data)
+{
+ sldns_buffer_write_u16_at(buffer, buffer->_position, data);
+ buffer->_position += sizeof(data);
+}
+
+/**
+ * writes the given 4 byte integer at the given position in the buffer
+ * \param[in] buffer the buffer
+ * \param[in] at the position in the buffer
+ * \param[in] data the 32 bits to write
+ */
+INLINE void
+sldns_buffer_write_u32_at(sldns_buffer *buffer, size_t at, uint32_t data)
+{
+ assert(sldns_buffer_available_at(buffer, at, sizeof(data)));
+ sldns_write_uint32(buffer->_data + at, data);
+}
+
+/**
+ * writes the given 4 byte integer at the current position in the buffer
+ * \param[in] buffer the buffer
+ * \param[in] data the 32 bits to write
+ */
+INLINE void
+sldns_buffer_write_u32(sldns_buffer *buffer, uint32_t data)
+{
+ sldns_buffer_write_u32_at(buffer, buffer->_position, data);
+ buffer->_position += sizeof(data);
+}
+
+/**
+ * copies count bytes of data at the given position to the given data-array
+ * \param[in] buffer the buffer
+ * \param[in] at the position in the buffer to start
+ * \param[out] data buffer to copy to
+ * \param[in] count the length of the data to copy
+ */
+INLINE void
+sldns_buffer_read_at(sldns_buffer *buffer, size_t at, void *data, size_t count)
+{
+ assert(sldns_buffer_available_at(buffer, at, count));
+ memcpy(data, buffer->_data + at, count);
+}
+
+/**
+ * copies count bytes of data at the current position to the given data-array
+ * \param[in] buffer the buffer
+ * \param[out] data buffer to copy to
+ * \param[in] count the length of the data to copy
+ */
+INLINE void
+sldns_buffer_read(sldns_buffer *buffer, void *data, size_t count)
+{
+ sldns_buffer_read_at(buffer, buffer->_position, data, count);
+ buffer->_position += count;
+}
+
+/**
+ * returns the byte value at the given position in the buffer
+ * \param[in] buffer the buffer
+ * \param[in] at the position in the buffer
+ * \return 1 byte integer
+ */
+INLINE uint8_t
+sldns_buffer_read_u8_at(sldns_buffer *buffer, size_t at)
+{
+ assert(sldns_buffer_available_at(buffer, at, sizeof(uint8_t)));
+ return buffer->_data[at];
+}
+
+/**
+ * returns the byte value at the current position in the buffer
+ * \param[in] buffer the buffer
+ * \return 1 byte integer
+ */
+INLINE uint8_t
+sldns_buffer_read_u8(sldns_buffer *buffer)
+{
+ uint8_t result = sldns_buffer_read_u8_at(buffer, buffer->_position);
+ buffer->_position += sizeof(uint8_t);
+ return result;
+}
+
+/**
+ * returns the 2-byte integer value at the given position in the buffer
+ * \param[in] buffer the buffer
+ * \param[in] at position in the buffer
+ * \return 2 byte integer
+ */
+INLINE uint16_t
+sldns_buffer_read_u16_at(sldns_buffer *buffer, size_t at)
+{
+ assert(sldns_buffer_available_at(buffer, at, sizeof(uint16_t)));
+ return sldns_read_uint16(buffer->_data + at);
+}
+
+/**
+ * returns the 2-byte integer value at the current position in the buffer
+ * \param[in] buffer the buffer
+ * \return 2 byte integer
+ */
+INLINE uint16_t
+sldns_buffer_read_u16(sldns_buffer *buffer)
+{
+ uint16_t result = sldns_buffer_read_u16_at(buffer, buffer->_position);
+ buffer->_position += sizeof(uint16_t);
+ return result;
+}
+
+/**
+ * returns the 4-byte integer value at the given position in the buffer
+ * \param[in] buffer the buffer
+ * \param[in] at position in the buffer
+ * \return 4 byte integer
+ */
+INLINE uint32_t
+sldns_buffer_read_u32_at(sldns_buffer *buffer, size_t at)
+{
+ assert(sldns_buffer_available_at(buffer, at, sizeof(uint32_t)));
+ return sldns_read_uint32(buffer->_data + at);
+}
+
+/**
+ * returns the 4-byte integer value at the current position in the buffer
+ * \param[in] buffer the buffer
+ * \return 4 byte integer
+ */
+INLINE uint32_t
+sldns_buffer_read_u32(sldns_buffer *buffer)
+{
+ uint32_t result = sldns_buffer_read_u32_at(buffer, buffer->_position);
+ buffer->_position += sizeof(uint32_t);
+ return result;
+}
+
+/**
+ * returns the status of the buffer
+ * \param[in] buffer
+ * \return the status
+ */
+INLINE int
+sldns_buffer_status(sldns_buffer *buffer)
+{
+ return (int)buffer->_status_err;
+}
+
+/**
+ * returns true if the status of the buffer is LDNS_STATUS_OK, false otherwise
+ * \param[in] buffer the buffer
+ * \return true or false
+ */
+INLINE int
+sldns_buffer_status_ok(sldns_buffer *buffer)
+{
+ if (buffer) {
+ return sldns_buffer_status(buffer) == 0;
+ } else {
+ return 0;
+ }
+}
+
+/**
+ * prints to the buffer, increasing the capacity if required using
+ * buffer_reserve(). The buffer's position is set to the terminating '\\0'
+ * Returns the number of characters written (not including the
+ * terminating '\\0') or -1 on failure.
+ */
+int sldns_buffer_printf(sldns_buffer *buffer, const char *format, ...)
+ ATTR_FORMAT(printf, 2, 3);
+
+/**
+ * frees the buffer.
+ * \param[in] *buffer the buffer to be freed
+ * \return void
+ */
+void sldns_buffer_free(sldns_buffer *buffer);
+
+/**
+ * Makes the buffer fixed and returns a pointer to the data. The
+ * caller is responsible for free'ing the result.
+ * \param[in] *buffer the buffer to be exported
+ * \return void
+ */
+void *sldns_buffer_export(sldns_buffer *buffer);
+
+/**
+ * Copy contents of the from buffer to the result buffer and then flips
+ * the result buffer. Data will be silently truncated if the result buffer is
+ * too small.
+ * \param[out] *result resulting buffer which is copied to.
+ * \param[in] *from what to copy to result.
+ */
+void sldns_buffer_copy(sldns_buffer* result, sldns_buffer* from);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LDNS_SBUFFER_H */
--- /dev/null
+/**
+ * str2wire.c - read txt presentation of RRs
+ *
+ * (c) NLnet Labs, 2005-2006
+ *
+ * See the file LICENSE for the license
+ */
+
+/**
+ * \file
+ *
+ * Parses text to wireformat.
+ */
+#include "config.h"
+#include "sldns/str2wire.h"
+#include "sldns/wire2str.h"
+#include "sldns/sbuffer.h"
+#include "sldns/parse.h"
+#include "sldns/parseutil.h"
+#include <ctype.h>
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+/** return an error */
+#define RET_ERR(e, off) ((int)((e)|((off)<<LDNS_WIREPARSE_SHIFT)))
+/** Move parse error but keep its ID */
+#define RET_ERR_SHIFT(e, move) RET_ERR(LDNS_WIREPARSE_ERROR(e), LDNS_WIREPARSE_OFFSET(e)+(move));
+#define LDNS_IP6ADDRLEN (128/8)
+
+/*
+ * No special care is taken, all dots are translated into
+ * label separators.
+ * @param rel: true if the domain is not absolute (not terminated in .).
+ * The output is then still terminated with a '0' rootlabel.
+ */
+static int sldns_str2wire_dname_buf_rel(const char* str, uint8_t* buf,
+ size_t* olen, int* rel)
+{
+ size_t len;
+
+ const char *s;
+ uint8_t *q, *pq, label_len;
+
+ if(rel) *rel = 0;
+ len = strlen((char*)str);
+ /* octet representation can make strings a lot longer than actual length */
+ if (len > LDNS_MAX_DOMAINLEN * 4) {
+ return RET_ERR(LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW, 0);
+ }
+ if (0 == len) {
+ return RET_ERR(LDNS_WIREPARSE_ERR_DOMAINNAME_UNDERFLOW, 0);
+ }
+
+ /* root label */
+ if (1 == len && *str == '.') {
+ if(*olen < 1)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, 0);
+ buf[0] = 0;
+ *olen = 1;
+ return LDNS_WIREPARSE_ERR_OK;
+ }
+
+ /* get on with the rest */
+
+ /* s is on the current character in the string
+ * pq points to where the labellength is going to go
+ * label_len keeps track of the current label's length
+ * q builds the dname inside the buf array
+ */
+ len = 0;
+ if(*olen < 1)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, 0);
+ q = buf+1;
+ pq = buf;
+ label_len = 0;
+ for (s = str; *s; s++, q++) {
+ if (q >= buf + *olen)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, q-buf);
+ if (q > buf + LDNS_MAX_DOMAINLEN)
+ return RET_ERR(LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW, q-buf);
+ switch (*s) {
+ case '.':
+ if (label_len > LDNS_MAX_LABELLEN) {
+ return RET_ERR(LDNS_WIREPARSE_ERR_LABEL_OVERFLOW, q-buf);
+ }
+ if (label_len == 0) {
+ return RET_ERR(LDNS_WIREPARSE_ERR_EMPTY_LABEL, q-buf);
+ }
+ len += label_len + 1;
+ *q = 0;
+ *pq = label_len;
+ label_len = 0;
+ pq = q;
+ break;
+ case '\\':
+ /* octet value or literal char */
+ s += 1;
+ if (!sldns_parse_escape(q, &s)) {
+ *q = 0;
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE, q-buf);
+ }
+ s -= 1;
+ label_len++;
+ break;
+ default:
+ *q = (uint8_t)*s;
+ label_len++;
+ }
+ }
+
+ /* add root label if last char was not '.' */
+ if(label_len != 0) {
+ if(rel) *rel = 1;
+ if (q >= buf + *olen)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, q-buf);
+ if (q > buf + LDNS_MAX_DOMAINLEN) {
+ return RET_ERR(LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW, q-buf);
+ }
+ if (label_len > LDNS_MAX_LABELLEN) {
+ return RET_ERR(LDNS_WIREPARSE_ERR_LABEL_OVERFLOW, q-buf);
+ }
+ if (label_len == 0) { /* label_len 0 but not . at end? */
+ return RET_ERR(LDNS_WIREPARSE_ERR_EMPTY_LABEL, q-buf);
+ }
+ len += label_len + 1;
+ *pq = label_len;
+ *q = 0;
+ }
+ len++;
+ *olen = len;
+
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_dname_buf(const char* str, uint8_t* buf, size_t* len)
+{
+ return sldns_str2wire_dname_buf_rel(str, buf, len, NULL);
+}
+
+int sldns_str2wire_dname_buf_origin(const char* str, uint8_t* buf, size_t* len,
+ uint8_t* origin, size_t origin_len)
+{
+ size_t dlen = *len;
+ int rel = 0;
+ int s = sldns_str2wire_dname_buf_rel(str, buf, &dlen, &rel);
+ if(s) return s;
+
+ if(rel && origin && dlen > 0) {
+ if(dlen + origin_len - 1 > LDNS_MAX_DOMAINLEN)
+ return RET_ERR(LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW,
+ LDNS_MAX_DOMAINLEN);
+ if(dlen + origin_len - 1 > *len)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
+ *len);
+ memmove(buf+dlen-1, origin, origin_len);
+ *len = dlen + origin_len - 1;
+ } else
+ *len = dlen;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+uint8_t* sldns_str2wire_dname(const char* str, size_t* len)
+{
+ uint8_t dname[LDNS_MAX_DOMAINLEN+1];
+ *len = sizeof(dname);
+ if(sldns_str2wire_dname_buf(str, dname, len) == 0) {
+ uint8_t* r = (uint8_t*)malloc(*len);
+ if(r) return memcpy(r, dname, *len);
+ }
+ *len = 0;
+ return NULL;
+}
+
+/** read owner name */
+static int
+rrinternal_get_owner(sldns_buffer* strbuf, uint8_t* rr, size_t* len,
+ size_t* dname_len, uint8_t* origin, size_t origin_len, uint8_t* prev,
+ size_t prev_len, char* token, size_t token_len)
+{
+ /* split the rr in its parts -1 signals trouble */
+ if(sldns_bget_token(strbuf, token, "\t\n ", token_len) == -1) {
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX,
+ sldns_buffer_position(strbuf));
+ }
+
+ if(strcmp(token, "@") == 0) {
+ uint8_t* tocopy;
+ if (origin) {
+ *dname_len = origin_len;
+ tocopy = origin;
+ } else if (prev) {
+ *dname_len = prev_len;
+ tocopy = prev;
+ } else {
+ /* default to root */
+ *dname_len = 1;
+ tocopy = (uint8_t*)"\0";
+ }
+ if(*len < *dname_len)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
+ sldns_buffer_position(strbuf));
+ memmove(rr, tocopy, *dname_len);
+ } else if(strlen(token) == 0) {
+ /* no ownername was given, try prev, if that fails
+ * origin, else default to root */
+ uint8_t* tocopy;
+ if(prev) {
+ *dname_len = prev_len;
+ tocopy = prev;
+ } else if(origin) {
+ *dname_len = origin_len;
+ tocopy = origin;
+ } else {
+ *dname_len = 1;
+ tocopy = (uint8_t*)"\0";
+ }
+ if(*len < *dname_len)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
+ sldns_buffer_position(strbuf));
+ memmove(rr, tocopy, *dname_len);
+ } else {
+ size_t dlen = *len;
+ int s = sldns_str2wire_dname_buf_origin(token, rr, &dlen,
+ origin, origin_len);
+ if(s) return RET_ERR_SHIFT(s,
+ sldns_buffer_position(strbuf)-strlen(token));
+ *dname_len = dlen;
+ }
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+/** read ttl */
+static int
+rrinternal_get_ttl(sldns_buffer* strbuf, char* token, size_t token_len,
+ int* not_there, uint32_t* ttl, uint32_t default_ttl)
+{
+ const char* endptr;
+ if(sldns_bget_token(strbuf, token, "\t\n ", token_len) == -1) {
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TTL,
+ sldns_buffer_position(strbuf));
+ }
+ *ttl = (uint32_t) sldns_str2period(token, &endptr);
+
+ if (strlen(token) > 0 && !isdigit((unsigned char)token[0])) {
+ *not_there = 1;
+ /* ah, it's not there or something */
+ if (default_ttl == 0) {
+ *ttl = LDNS_DEFAULT_TTL;
+ } else {
+ *ttl = default_ttl;
+ }
+ }
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+/** read class */
+static int
+rrinternal_get_class(sldns_buffer* strbuf, char* token, size_t token_len,
+ int* not_there, uint16_t* cl)
+{
+ /* if 'not_there' then we got token from previous parse routine */
+ if(!*not_there) {
+ /* parse new token for class */
+ if(sldns_bget_token(strbuf, token, "\t\n ", token_len) == -1) {
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_CLASS,
+ sldns_buffer_position(strbuf));
+ }
+ } else *not_there = 0;
+ *cl = sldns_get_rr_class_by_name(token);
+ /* class can be left out too, assume IN, current token must be type */
+ if(*cl == 0 && strcmp(token, "CLASS0") != 0) {
+ *not_there = 1;
+ *cl = LDNS_RR_CLASS_IN;
+ }
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+/** read type */
+static int
+rrinternal_get_type(sldns_buffer* strbuf, char* token, size_t token_len,
+ int* not_there, uint16_t* tp)
+{
+ /* if 'not_there' then we got token from previous parse routine */
+ if(!*not_there) {
+ /* parse new token for type */
+ if(sldns_bget_token(strbuf, token, "\t\n ", token_len) == -1) {
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TYPE,
+ sldns_buffer_position(strbuf));
+ }
+ }
+ *tp = sldns_get_rr_type_by_name(token);
+ if(*tp == 0 && strcmp(token, "TYPE0") != 0) {
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TYPE,
+ sldns_buffer_position(strbuf));
+ }
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+/** put type, class, ttl into rr buffer */
+static int
+rrinternal_write_typeclassttl(sldns_buffer* strbuf, uint8_t* rr, size_t len,
+ size_t dname_len, uint16_t tp, uint16_t cl, uint32_t ttl, int question)
+{
+ if(question) {
+ /* question is : name, type, class */
+ if(dname_len + 4 > len)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
+ sldns_buffer_position(strbuf));
+ sldns_write_uint16(rr+dname_len, tp);
+ sldns_write_uint16(rr+dname_len+2, cl);
+ return LDNS_WIREPARSE_ERR_OK;
+ }
+
+ /* type(2), class(2), ttl(4), rdatalen(2 (later)) = 10 */
+ if(dname_len + 10 > len)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
+ sldns_buffer_position(strbuf));
+ sldns_write_uint16(rr+dname_len, tp);
+ sldns_write_uint16(rr+dname_len+2, cl);
+ sldns_write_uint32(rr+dname_len+4, ttl);
+ sldns_write_uint16(rr+dname_len+8, 0); /* rdatalen placeholder */
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+/** find delimiters for type */
+static const char*
+rrinternal_get_delims(sldns_rdf_type rdftype, uint16_t r_cnt, uint16_t r_max)
+{
+ switch(rdftype) {
+ case LDNS_RDF_TYPE_B64 :
+ case LDNS_RDF_TYPE_HEX : /* These rdf types may con- */
+ case LDNS_RDF_TYPE_LOC : /* tain whitespace, only if */
+ case LDNS_RDF_TYPE_WKS : /* it is the last rd field. */
+ case LDNS_RDF_TYPE_IPSECKEY :
+ case LDNS_RDF_TYPE_NSEC : if (r_cnt == r_max - 1) {
+ return "\n";
+ }
+ break;
+ default : break;
+ }
+ return "\n\t ";
+}
+
+/* Syntactic sugar for sldns_rr_new_frm_str_internal */
+static int
+sldns_rdf_type_maybe_quoted(sldns_rdf_type rdf_type)
+{
+ return rdf_type == LDNS_RDF_TYPE_STR ||
+ rdf_type == LDNS_RDF_TYPE_LONG_STR;
+}
+
+/** see if rdata is quoted */
+static int
+rrinternal_get_quoted(sldns_buffer* strbuf, const char** delimiters,
+ sldns_rdf_type rdftype)
+{
+ if(sldns_rdf_type_maybe_quoted(rdftype) &&
+ sldns_buffer_remaining(strbuf) > 0) {
+
+ /* skip spaces */
+ while(sldns_buffer_remaining(strbuf) > 0 &&
+ *(sldns_buffer_current(strbuf)) == ' ') {
+ sldns_buffer_skip(strbuf, 1);
+ }
+
+ if(sldns_buffer_remaining(strbuf) > 0 &&
+ *(sldns_buffer_current(strbuf)) == '\"') {
+ *delimiters = "\"\0";
+ sldns_buffer_skip(strbuf, 1);
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/** spool hex data into rdata */
+static int
+rrinternal_spool_hex(char* token, uint8_t* rr, size_t rr_len,
+ size_t rr_cur_len, size_t* cur_hex_data_size, size_t hex_data_size)
+{
+ char* p = token;
+ while(*p) {
+ if(isspace((unsigned char)*p)) {
+ p++;
+ continue;
+ }
+ if(!isxdigit((unsigned char)*p))
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_RDATA,
+ p-token);
+ if(*cur_hex_data_size >= hex_data_size)
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_RDATA,
+ p-token);
+ /* extra robust check */
+ if(rr_cur_len+(*cur_hex_data_size)/2 >= rr_len)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
+ p-token);
+ /* see if 16s or 1s */
+ if( ((*cur_hex_data_size)&1) == 0) {
+ rr[rr_cur_len+(*cur_hex_data_size)/2] =
+ (uint8_t)sldns_hexdigit_to_int(*p)*16;
+ } else {
+ rr[rr_cur_len+(*cur_hex_data_size)/2] +=
+ (uint8_t)sldns_hexdigit_to_int(*p);
+ }
+ p++;
+ (*cur_hex_data_size)++;
+ }
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+/** read unknown rr type format */
+static int
+rrinternal_parse_unknown(sldns_buffer* strbuf, char* token, size_t token_len,
+ uint8_t* rr, size_t* rr_len, size_t* rr_cur_len, size_t pre_data_pos)
+{
+ const char* delim = "\n\t ";
+ size_t hex_data_size, cur_hex_data_size;
+ /* go back to before \#
+ * and skip it while setting delimiters better
+ */
+ sldns_buffer_set_position(strbuf, pre_data_pos);
+ if(sldns_bget_token(strbuf, token, delim, token_len) == -1)
+ return LDNS_WIREPARSE_ERR_GENERAL; /* should not fail */
+ /* read rdata octet length */
+ if(sldns_bget_token(strbuf, token, delim, token_len) == -1) {
+ /* something goes very wrong here */
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_RDATA,
+ sldns_buffer_position(strbuf));
+ }
+ hex_data_size = (size_t)atoi(token);
+ if(hex_data_size > LDNS_MAX_RDFLEN ||
+ *rr_cur_len + hex_data_size > *rr_len) {
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
+ sldns_buffer_position(strbuf));
+ }
+ /* copy hex chars into hex str (2 chars per byte) */
+ hex_data_size *= 2;
+ cur_hex_data_size = 0;
+ while(cur_hex_data_size < hex_data_size) {
+ int status;
+ ssize_t c = sldns_bget_token(strbuf, token, delim, token_len);
+ if((status = rrinternal_spool_hex(token, rr, *rr_len,
+ *rr_cur_len, &cur_hex_data_size, hex_data_size)) != 0)
+ return RET_ERR_SHIFT(status,
+ sldns_buffer_position(strbuf)-strlen(token));
+ if(c == -1) {
+ if(cur_hex_data_size != hex_data_size)
+ return RET_ERR(
+ LDNS_WIREPARSE_ERR_SYNTAX_RDATA,
+ sldns_buffer_position(strbuf));
+ break;
+ }
+ }
+ *rr_cur_len += hex_data_size/2;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+/** parse normal RR rdata element */
+static int
+rrinternal_parse_rdf(sldns_buffer* strbuf, char* token, size_t token_len,
+ uint8_t* rr, size_t rr_len, size_t* rr_cur_len, sldns_rdf_type rdftype,
+ uint16_t rr_type, uint16_t r_cnt, uint16_t r_max, size_t dname_len,
+ uint8_t* origin, size_t origin_len)
+{
+ size_t len;
+ int status;
+
+ switch(rdftype) {
+ case LDNS_RDF_TYPE_DNAME:
+ /* check if the origin should be used or concatenated */
+ if(strcmp(token, "@") == 0) {
+ uint8_t* tocopy;
+ size_t copylen;
+ if(origin) {
+ copylen = origin_len;
+ tocopy = origin;
+ } else if(rr_type == LDNS_RR_TYPE_SOA) {
+ copylen = dname_len;
+ tocopy = rr; /* copy rr owner name */
+ } else {
+ copylen = 1;
+ tocopy = (uint8_t*)"\0";
+ }
+ if((*rr_cur_len) + copylen > rr_len)
+ return RET_ERR(
+ LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
+ sldns_buffer_position(strbuf));
+ memmove(rr+*rr_cur_len, tocopy, copylen);
+ (*rr_cur_len) += copylen;
+ } else {
+ size_t dlen = rr_len - (*rr_cur_len);
+ int s = sldns_str2wire_dname_buf_origin(token,
+ rr+*rr_cur_len, &dlen, origin, origin_len);
+ if(s) return RET_ERR_SHIFT(s,
+ sldns_buffer_position(strbuf)-strlen(token));
+ (*rr_cur_len) += dlen;
+ }
+ return LDNS_WIREPARSE_ERR_OK;
+
+ case LDNS_RDF_TYPE_HEX:
+ case LDNS_RDF_TYPE_B64:
+ /* When this is the last rdata field, then the
+ * rest should be read in (cause then these
+ * rdf types may contain spaces). */
+ if(r_cnt == r_max - 1) {
+ size_t tlen = strlen(token);
+ (void)sldns_bget_token(strbuf, token+tlen, "\n",
+ token_len - tlen);
+ }
+ break;
+ default:
+ break;
+ }
+
+ len = rr_len - (*rr_cur_len);
+ if((status=sldns_str2wire_rdf_buf(token, rr+(*rr_cur_len), &len,
+ rdftype)) != 0)
+ return RET_ERR_SHIFT(status,
+ sldns_buffer_position(strbuf)-strlen(token));
+ *rr_cur_len += len;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+/**
+ * Parse one rdf token. Takes care of quotes and parenthesis.
+ */
+static int
+sldns_parse_rdf_token(sldns_buffer* strbuf, char* token, size_t token_len,
+ int* quoted, int* parens, size_t* pre_data_pos,
+ const char* delimiters, sldns_rdf_type rdftype, size_t* token_strlen)
+{
+ size_t slen;
+
+ /* skip spaces */
+ while(sldns_buffer_remaining(strbuf) > 0 && !*quoted &&
+ *(sldns_buffer_current(strbuf)) == ' ') {
+ sldns_buffer_skip(strbuf, 1);
+ }
+
+ *pre_data_pos = sldns_buffer_position(strbuf);
+ if(sldns_bget_token_par(strbuf, token, (*quoted)?"\"":delimiters,
+ token_len, parens, (*quoted)?NULL:" \t") == -1) {
+ return 0;
+ }
+ slen = strlen(token);
+ /* check if not quoted yet, and we have encountered quotes */
+ if(!*quoted && sldns_rdf_type_maybe_quoted(rdftype) &&
+ slen >= 2 &&
+ (token[0] == '"' || token[0] == '\'') &&
+ (token[slen-1] == '"' || token[slen-1] == '\'')) {
+ /* move token two smaller (quotes) with endnull */
+ memmove(token, token+1, slen-2);
+ token[slen-2] = 0;
+ slen -= 2;
+ *quoted = 1;
+ } else if(!*quoted && sldns_rdf_type_maybe_quoted(rdftype) &&
+ slen >= 2 &&
+ (token[0] == '"' || token[0] == '\'')) {
+ /* got the start quote (remove it) but read remainder
+ * of quoted string as well into remainder of token */
+ memmove(token, token+1, slen-1);
+ token[slen-1] = 0;
+ slen -= 1;
+ *quoted = 1;
+ /* rewind buffer over skipped whitespace */
+ while(sldns_buffer_position(strbuf) > 0 &&
+ (sldns_buffer_current(strbuf)[-1] == ' ' ||
+ sldns_buffer_current(strbuf)[-1] == '\t')) {
+ sldns_buffer_skip(strbuf, -1);
+ }
+ if(sldns_bget_token_par(strbuf, token+slen,
+ "\"", token_len-slen,
+ parens, NULL) == -1) {
+ return 0;
+ }
+ slen = strlen(token);
+ }
+ *token_strlen = slen;
+ return 1;
+}
+
+/** Add space and one more rdf token onto the existing token string. */
+static int
+sldns_affix_token(sldns_buffer* strbuf, char* token, size_t* token_len,
+ int* quoted, int* parens, size_t* pre_data_pos,
+ const char* delimiters, sldns_rdf_type rdftype, size_t* token_strlen)
+{
+ size_t addlen = *token_len - *token_strlen;
+ size_t addstrlen = 0;
+
+ /* add space */
+ if(addlen < 1) return 0;
+ token[*token_strlen] = ' ';
+ token[++(*token_strlen)] = 0;
+
+ /* read another token */
+ addlen = *token_len - *token_strlen;
+ if(!sldns_parse_rdf_token(strbuf, token+*token_strlen, addlen, quoted,
+ parens, pre_data_pos, delimiters, rdftype, &addstrlen))
+ return 0;
+ (*token_strlen) += addstrlen;
+ return 1;
+}
+
+/** parse rdata from string into rr buffer(-remainder after dname). */
+static int
+rrinternal_parse_rdata(sldns_buffer* strbuf, char* token, size_t token_len,
+ uint8_t* rr, size_t* rr_len, size_t dname_len, uint16_t rr_type,
+ uint8_t* origin, size_t origin_len)
+{
+ const sldns_rr_descriptor *desc = sldns_rr_descript((uint16_t)rr_type);
+ uint16_t r_cnt, r_min, r_max;
+ size_t rr_cur_len = dname_len + 10, pre_data_pos, token_strlen;
+ int was_unknown_rr_format = 0, parens = 0, status, quoted;
+ const char* delimiters;
+ sldns_rdf_type rdftype;
+ /* a desc is always returned */
+ if(!desc) return LDNS_WIREPARSE_ERR_GENERAL;
+ r_max = sldns_rr_descriptor_maximum(desc);
+ r_min = sldns_rr_descriptor_minimum(desc);
+ /* robust check */
+ if(rr_cur_len > *rr_len)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
+ sldns_buffer_position(strbuf));
+
+ /* because number of fields can be variable, we can't rely on
+ * _maximum() only */
+ for(r_cnt=0; r_cnt < r_max; r_cnt++) {
+ rdftype = sldns_rr_descriptor_field_type(desc, r_cnt);
+ delimiters = rrinternal_get_delims(rdftype, r_cnt, r_max);
+ quoted = rrinternal_get_quoted(strbuf, &delimiters, rdftype);
+
+ if(!sldns_parse_rdf_token(strbuf, token, token_len, "ed,
+ &parens, &pre_data_pos, delimiters, rdftype,
+ &token_strlen))
+ break;
+
+ /* rfc3597 specifies that any type can be represented
+ * with \# method, which can contain spaces...
+ * it does specify size though... */
+
+ /* unknown RR data */
+ if(token_strlen>=2 && strncmp(token, "\\#", 2) == 0 &&
+ !quoted && (token_strlen == 2 || token[2]==' ')) {
+ was_unknown_rr_format = 1;
+ if((status=rrinternal_parse_unknown(strbuf, token,
+ token_len, rr, rr_len, &rr_cur_len,
+ pre_data_pos)) != 0)
+ return status;
+ } else if(token_strlen > 0 || quoted) {
+ if(rdftype == LDNS_RDF_TYPE_HIP) {
+ /* affix the HIT and PK fields, with a space */
+ if(!sldns_affix_token(strbuf, token,
+ &token_len, "ed, &parens,
+ &pre_data_pos, delimiters,
+ rdftype, &token_strlen))
+ break;
+ if(!sldns_affix_token(strbuf, token,
+ &token_len, "ed, &parens,
+ &pre_data_pos, delimiters,
+ rdftype, &token_strlen))
+ break;
+ }
+
+ /* normal RR */
+ if((status=rrinternal_parse_rdf(strbuf, token,
+ token_len, rr, *rr_len, &rr_cur_len, rdftype,
+ rr_type, r_cnt, r_max, dname_len, origin,
+ origin_len)) != 0) {
+ return status;
+ }
+ }
+ }
+ if(!was_unknown_rr_format && r_cnt+1 < r_min) {
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_MISSING_VALUE,
+ sldns_buffer_position(strbuf));
+ }
+ while(parens != 0) {
+ /* read remainder, must be "" */
+ if(sldns_bget_token_par(strbuf, token, "\n", token_len,
+ &parens, " \t") == -1) {
+ if(parens != 0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_PARENTHESIS,
+ sldns_buffer_position(strbuf));
+ break;
+ }
+ if(strcmp(token, "") != 0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_PARENTHESIS,
+ sldns_buffer_position(strbuf));
+ }
+ /* write rdata length */
+ sldns_write_uint16(rr+dname_len+8, rr_cur_len-dname_len-10);
+ *rr_len = rr_cur_len;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+/*
+ * trailing spaces are allowed
+ * leading spaces are not allowed
+ * allow ttl to be optional
+ * class is optional too
+ * if ttl is missing, and default_ttl is 0, use DEF_TTL
+ * allow ttl to be written as 1d3h
+ * So the RR should look like. e.g.
+ * miek.nl. 3600 IN MX 10 elektron.atoom.net
+ * or
+ * miek.nl. 1h IN MX 10 elektron.atoom.net
+ * or
+ * miek.nl. IN MX 10 elektron.atoom.net
+ */
+static int
+sldns_str2wire_rr_buf_internal(const char* str, uint8_t* rr, size_t* len,
+ size_t* dname_len, uint32_t default_ttl, uint8_t* origin,
+ size_t origin_len, uint8_t* prev, size_t prev_len, int question)
+{
+ int status;
+ int not_there = 0;
+ char token[LDNS_MAX_RDFLEN+1];
+ uint32_t ttl = 0;
+ uint16_t tp = 0, cl = 0;
+ size_t ddlen = 0;
+
+ /* string in buffer */
+ sldns_buffer strbuf;
+ sldns_buffer_init_frm_data(&strbuf, (uint8_t*)str, strlen(str));
+ if(!dname_len) dname_len = &ddlen;
+
+ /* parse the owner */
+ if((status=rrinternal_get_owner(&strbuf, rr, len, dname_len, origin,
+ origin_len, prev, prev_len, token, sizeof(token))) != 0)
+ return status;
+
+ /* parse the [ttl] [class] <type> */
+ if((status=rrinternal_get_ttl(&strbuf, token, sizeof(token),
+ ¬_there, &ttl, default_ttl)) != 0)
+ return status;
+ if((status=rrinternal_get_class(&strbuf, token, sizeof(token),
+ ¬_there, &cl)) != 0)
+ return status;
+ if((status=rrinternal_get_type(&strbuf, token, sizeof(token),
+ ¬_there, &tp)) != 0)
+ return status;
+ /* put ttl, class, type into the rr result */
+ if((status=rrinternal_write_typeclassttl(&strbuf, rr, *len, *dname_len, tp, cl,
+ ttl, question)) != 0)
+ return status;
+ /* for a question-RR we are done, no rdata */
+ if(question) {
+ *len = *dname_len + 4;
+ return LDNS_WIREPARSE_ERR_OK;
+ }
+
+ /* rdata */
+ if((status=rrinternal_parse_rdata(&strbuf, token, sizeof(token),
+ rr, len, *dname_len, tp, origin, origin_len)) != 0)
+ return status;
+
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_rr_buf(const char* str, uint8_t* rr, size_t* len,
+ size_t* dname_len, uint32_t default_ttl, uint8_t* origin,
+ size_t origin_len, uint8_t* prev, size_t prev_len)
+{
+ return sldns_str2wire_rr_buf_internal(str, rr, len, dname_len,
+ default_ttl, origin, origin_len, prev, prev_len, 0);
+}
+
+int sldns_str2wire_rr_question_buf(const char* str, uint8_t* rr, size_t* len,
+ size_t* dname_len, uint8_t* origin, size_t origin_len, uint8_t* prev,
+ size_t prev_len)
+{
+ return sldns_str2wire_rr_buf_internal(str, rr, len, dname_len,
+ 0, origin, origin_len, prev, prev_len, 1);
+}
+
+uint16_t sldns_wirerr_get_type(uint8_t* rr, size_t len, size_t dname_len)
+{
+ if(len < dname_len+2)
+ return 0;
+ return sldns_read_uint16(rr+dname_len);
+}
+
+uint16_t sldns_wirerr_get_class(uint8_t* rr, size_t len, size_t dname_len)
+{
+ if(len < dname_len+4)
+ return 0;
+ return sldns_read_uint16(rr+dname_len+2);
+}
+
+uint32_t sldns_wirerr_get_ttl(uint8_t* rr, size_t len, size_t dname_len)
+{
+ if(len < dname_len+8)
+ return 0;
+ return sldns_read_uint32(rr+dname_len+4);
+}
+
+uint16_t sldns_wirerr_get_rdatalen(uint8_t* rr, size_t len, size_t dname_len)
+{
+ if(len < dname_len+10)
+ return 0;
+ return sldns_read_uint16(rr+dname_len+8);
+}
+
+uint8_t* sldns_wirerr_get_rdata(uint8_t* rr, size_t len, size_t dname_len)
+{
+ if(len < dname_len+10)
+ return NULL;
+ return rr+dname_len+10;
+}
+
+uint8_t* sldns_wirerr_get_rdatawl(uint8_t* rr, size_t len, size_t dname_len)
+{
+ if(len < dname_len+10)
+ return NULL;
+ return rr+dname_len+8;
+}
+
+const char* sldns_get_errorstr_parse(int e)
+{
+ sldns_lookup_table *lt;
+ lt = sldns_lookup_by_id(sldns_wireparse_errors, LDNS_WIREPARSE_ERROR(e));
+ return lt?lt->name:"unknown error";
+}
+
+/* Strip whitespace from the start and the end of <line>. */
+static char *
+sldns_strip_ws(char *line)
+{
+ char *s = line, *e;
+
+ for (s = line; *s && isspace((unsigned char)*s); s++)
+ ;
+ for (e = strchr(s, 0); e > s+2 && isspace((unsigned char)e[-1]) && e[-2] != '\\'; e--)
+ ;
+ *e = 0;
+ return s;
+}
+
+int sldns_fp2wire_rr_buf(FILE* in, uint8_t* rr, size_t* len, size_t* dname_len,
+ struct sldns_file_parse_state* parse_state)
+{
+ char line[LDNS_RR_BUF_SIZE+1];
+ ssize_t size;
+
+ /* read an entire line in from the file */
+ if((size = sldns_fget_token_l(in, line, LDNS_PARSE_SKIP_SPACE,
+ LDNS_RR_BUF_SIZE, parse_state?&parse_state->lineno:NULL))
+ == -1) {
+ /* if last line was empty, we are now at feof, which is not
+ * always a parse error (happens when for instance last line
+ * was a comment)
+ */
+ return LDNS_WIREPARSE_ERR_SYNTAX;
+ }
+
+ /* we can have the situation, where we've read ok, but still got
+ * no bytes to play with, in this case size is 0 */
+ if(size == 0) {
+ *len = 0;
+ *dname_len = 0;
+ return LDNS_WIREPARSE_ERR_OK;
+ }
+
+ if(strncmp(line, "$ORIGIN", 7) == 0 && isspace((unsigned char)line[7])) {
+ int s;
+ *len = 0;
+ *dname_len = 0;
+ if(!parse_state) return LDNS_WIREPARSE_ERR_OK;
+ parse_state->origin_len = sizeof(parse_state->origin);
+ s = sldns_str2wire_dname_buf(sldns_strip_ws(line+8),
+ parse_state->origin, &parse_state->origin_len);
+ if(s) parse_state->origin_len = 0;
+ return s;
+ } else if(strncmp(line, "$TTL", 4) == 0 && isspace((unsigned char)line[4])) {
+ const char* end = NULL;
+ *len = 0;
+ *dname_len = 0;
+ if(!parse_state) return LDNS_WIREPARSE_ERR_OK;
+ parse_state->default_ttl = sldns_str2period(
+ sldns_strip_ws(line+5), &end);
+ } else if (strncmp(line, "$INCLUDE", 8) == 0) {
+ *len = 0;
+ *dname_len = 0;
+ return LDNS_WIREPARSE_ERR_INCLUDE;
+ } else {
+ return sldns_str2wire_rr_buf(line, rr, len, dname_len,
+ parse_state?parse_state->default_ttl:0,
+ (parse_state&&parse_state->origin_len)?
+ parse_state->origin:NULL,
+ parse_state->origin_len,
+ (parse_state&&parse_state->prev_rr_len)?
+ parse_state->prev_rr:NULL,
+ parse_state->prev_rr_len);
+ }
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_rdf_buf(const char* str, uint8_t* rd, size_t* len,
+ sldns_rdf_type rdftype)
+{
+ switch (rdftype) {
+ case LDNS_RDF_TYPE_DNAME:
+ return sldns_str2wire_dname_buf(str, rd, len);
+ case LDNS_RDF_TYPE_INT8:
+ return sldns_str2wire_int8_buf(str, rd, len);
+ case LDNS_RDF_TYPE_INT16:
+ return sldns_str2wire_int16_buf(str, rd, len);
+ case LDNS_RDF_TYPE_INT32:
+ return sldns_str2wire_int32_buf(str, rd, len);
+ case LDNS_RDF_TYPE_A:
+ return sldns_str2wire_a_buf(str, rd, len);
+ case LDNS_RDF_TYPE_AAAA:
+ return sldns_str2wire_aaaa_buf(str, rd, len);
+ case LDNS_RDF_TYPE_STR:
+ return sldns_str2wire_str_buf(str, rd, len);
+ case LDNS_RDF_TYPE_APL:
+ return sldns_str2wire_apl_buf(str, rd, len);
+ case LDNS_RDF_TYPE_B64:
+ return sldns_str2wire_b64_buf(str, rd, len);
+ case LDNS_RDF_TYPE_B32_EXT:
+ return sldns_str2wire_b32_ext_buf(str, rd, len);
+ case LDNS_RDF_TYPE_HEX:
+ return sldns_str2wire_hex_buf(str, rd, len);
+ case LDNS_RDF_TYPE_NSEC:
+ return sldns_str2wire_nsec_buf(str, rd, len);
+ case LDNS_RDF_TYPE_TYPE:
+ return sldns_str2wire_type_buf(str, rd, len);
+ case LDNS_RDF_TYPE_CLASS:
+ return sldns_str2wire_class_buf(str, rd, len);
+ case LDNS_RDF_TYPE_CERT_ALG:
+ return sldns_str2wire_cert_alg_buf(str, rd, len);
+ case LDNS_RDF_TYPE_ALG:
+ return sldns_str2wire_alg_buf(str, rd, len);
+ case LDNS_RDF_TYPE_TIME:
+ return sldns_str2wire_time_buf(str, rd, len);
+ case LDNS_RDF_TYPE_PERIOD:
+ return sldns_str2wire_period_buf(str, rd, len);
+ case LDNS_RDF_TYPE_LOC:
+ return sldns_str2wire_loc_buf(str, rd, len);
+ case LDNS_RDF_TYPE_WKS:
+ return sldns_str2wire_wks_buf(str, rd, len);
+ case LDNS_RDF_TYPE_NSAP:
+ return sldns_str2wire_nsap_buf(str, rd, len);
+ case LDNS_RDF_TYPE_ATMA:
+ return sldns_str2wire_atma_buf(str, rd, len);
+ case LDNS_RDF_TYPE_IPSECKEY:
+ return sldns_str2wire_ipseckey_buf(str, rd, len);
+ case LDNS_RDF_TYPE_NSEC3_SALT:
+ return sldns_str2wire_nsec3_salt_buf(str, rd, len);
+ case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER:
+ return sldns_str2wire_b32_ext_buf(str, rd, len);
+ case LDNS_RDF_TYPE_ILNP64:
+ return sldns_str2wire_ilnp64_buf(str, rd, len);
+ case LDNS_RDF_TYPE_EUI48:
+ return sldns_str2wire_eui48_buf(str, rd, len);
+ case LDNS_RDF_TYPE_EUI64:
+ return sldns_str2wire_eui64_buf(str, rd, len);
+ case LDNS_RDF_TYPE_TAG:
+ return sldns_str2wire_tag_buf(str, rd, len);
+ case LDNS_RDF_TYPE_LONG_STR:
+ return sldns_str2wire_long_str_buf(str, rd, len);
+ case LDNS_RDF_TYPE_HIP:
+ return sldns_str2wire_hip_buf(str, rd, len);
+ case LDNS_RDF_TYPE_INT16_DATA:
+ return sldns_str2wire_int16_data_buf(str, rd, len);
+ case LDNS_RDF_TYPE_UNKNOWN:
+ case LDNS_RDF_TYPE_SERVICE:
+ return LDNS_WIREPARSE_ERR_NOT_IMPL;
+ case LDNS_RDF_TYPE_NONE:
+ default:
+ break;
+ }
+ return LDNS_WIREPARSE_ERR_GENERAL;
+}
+
+int sldns_str2wire_int8_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ char* end;
+ uint8_t r = (uint8_t)strtol((char*)str, &end, 10);
+ if(*end != 0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_INT, end-(char*)str);
+ if(*len < 1)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ rd[0] = r;
+ *len = 1;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_int16_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ char* end;
+ uint16_t r = (uint16_t)strtol((char*)str, &end, 10);
+ if(*end != 0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_INT, end-(char*)str);
+ if(*len < 2)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ sldns_write_uint16(rd, r);
+ *len = 2;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_int32_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ char* end;
+ uint32_t r;
+ errno = 0; /* must set to zero before call,
+ note race condition on errno */
+ if(*str == '-')
+ r = (uint32_t)strtol((char*)str, &end, 10);
+ else r = (uint32_t)strtoul((char*)str, &end, 10);
+ if(*end != 0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_INT, end-(char*)str);
+ if(errno == ERANGE)
+ return LDNS_WIREPARSE_ERR_SYNTAX_INTEGER_OVERFLOW;
+ if(*len < 4)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ sldns_write_uint32(rd, r);
+ *len = 4;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_a_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ struct in_addr address;
+ if(inet_pton(AF_INET, (char*)str, &address) != 1)
+ return LDNS_WIREPARSE_ERR_SYNTAX_IP4;
+ if(*len < sizeof(address))
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ memmove(rd, &address, sizeof(address));
+ *len = sizeof(address);
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_aaaa_buf(const char* str, uint8_t* rd, size_t* len)
+{
+#ifdef AF_INET6
+ uint8_t address[LDNS_IP6ADDRLEN + 1];
+ if(inet_pton(AF_INET6, (char*)str, address) != 1)
+ return LDNS_WIREPARSE_ERR_SYNTAX_IP6;
+ if(*len < LDNS_IP6ADDRLEN)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ memmove(rd, address, LDNS_IP6ADDRLEN);
+ *len = LDNS_IP6ADDRLEN;
+ return LDNS_WIREPARSE_ERR_OK;
+#else
+ return LDNS_WIREPARSE_ERR_NOT_IMPL;
+#endif
+}
+
+int sldns_str2wire_str_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ uint8_t ch = 0;
+ size_t sl = 0;
+ const char* s = str;
+ /* skip length byte */
+ if(*len < 1)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+
+ /* read characters */
+ while(sldns_parse_char(&ch, &s)) {
+ if(sl >= 255)
+ return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR, s-str);
+ if(*len < sl+1)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
+ s-str);
+ rd[++sl] = ch;
+ }
+ if(!s)
+ return LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE;
+ rd[0] = (uint8_t)sl;
+ *len = sl+1;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_apl_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ const char *my_str = str;
+
+ char my_ip_str[64];
+ size_t ip_str_len;
+
+ uint16_t family;
+ int negation;
+ size_t adflength = 0;
+ uint8_t data[16+4];
+ uint8_t prefix;
+ size_t i;
+
+ if(strlen(my_str) == 0) {
+ /* empty APL element, no data, no string */
+ *len = 0;
+ return LDNS_WIREPARSE_ERR_OK;
+ }
+
+ /* [!]afi:address/prefix */
+ if (strlen(my_str) < 2
+ || strchr(my_str, ':') == NULL
+ || strchr(my_str, '/') == NULL
+ || strchr(my_str, ':') > strchr(my_str, '/')) {
+ return LDNS_WIREPARSE_ERR_INVALID_STR;
+ }
+
+ if (my_str[0] == '!') {
+ negation = 1;
+ my_str += 1;
+ } else {
+ negation = 0;
+ }
+
+ family = (uint16_t) atoi(my_str);
+
+ my_str = strchr(my_str, ':') + 1;
+
+ /* need ip addr and only ip addr for inet_pton */
+ ip_str_len = (size_t) (strchr(my_str, '/') - my_str);
+ if(ip_str_len+1 > sizeof(my_ip_str))
+ return LDNS_WIREPARSE_ERR_INVALID_STR;
+ (void)strlcpy(my_ip_str, my_str, sizeof(my_ip_str));
+ my_ip_str[ip_str_len] = 0;
+
+ if (family == 1) {
+ /* ipv4 */
+ if(inet_pton(AF_INET, my_ip_str, data+4) == 0)
+ return LDNS_WIREPARSE_ERR_INVALID_STR;
+ for (i = 0; i < 4; i++) {
+ if (data[i+4] != 0) {
+ adflength = i + 1;
+ }
+ }
+ } else if (family == 2) {
+ /* ipv6 */
+ if (inet_pton(AF_INET6, my_ip_str, data+4) == 0)
+ return LDNS_WIREPARSE_ERR_INVALID_STR;
+ for (i = 0; i < 16; i++) {
+ if (data[i+4] != 0) {
+ adflength = i + 1;
+ }
+ }
+ } else {
+ /* unknown family */
+ return LDNS_WIREPARSE_ERR_INVALID_STR;
+ }
+
+ my_str = strchr(my_str, '/') + 1;
+ prefix = (uint8_t) atoi(my_str);
+
+ sldns_write_uint16(data, family);
+ data[2] = prefix;
+ data[3] = (uint8_t)adflength;
+ if (negation) {
+ /* set bit 1 of byte 3 */
+ data[3] = data[3] | 0x80;
+ }
+
+ if(*len < 4+adflength)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ memmove(rd, data, 4+adflength);
+ *len = 4+adflength;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_b64_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ size_t sz = sldns_b64_pton_calculate_size(strlen(str));
+ int n;
+ if(*len < sz)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ n = sldns_b64_pton(str, rd, *len);
+ if(n < 0)
+ return LDNS_WIREPARSE_ERR_SYNTAX_B64;
+ *len = (size_t)n;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_b32_ext_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ size_t slen = strlen(str);
+ size_t sz = sldns_b32_pton_calculate_size(slen);
+ int n;
+ if(*len < 1+sz)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ rd[0] = (uint8_t)sz;
+ n = sldns_b32_pton_extended_hex(str, slen, rd+1, *len-1);
+ if(n < 0)
+ return LDNS_WIREPARSE_ERR_SYNTAX_B32_EXT;
+ *len = (size_t)n+1;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_hex_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ const char* s = str;
+ size_t dlen = 0; /* number of hexdigits parsed */
+ while(*s) {
+ if(isspace((unsigned char)*s)) {
+ s++;
+ continue;
+ }
+ if(!isxdigit((unsigned char)*s))
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
+ if(*len < dlen/2 + 1)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
+ s-str);
+ if((dlen&1)==0)
+ rd[dlen/2] = (uint8_t)sldns_hexdigit_to_int(*s++) * 16;
+ else rd[dlen/2] += (uint8_t)sldns_hexdigit_to_int(*s++);
+ dlen++;
+ }
+ if((dlen&1)!=0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
+ *len = dlen/2;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_nsec_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ const char *delim = "\n\t ";
+ char token[64]; /* for a type name */
+ size_t type_count = 0;
+ int block;
+ size_t used = 0;
+ uint16_t maxtype = 0;
+ uint8_t typebits[8192]; /* 65536 bits */
+ uint8_t window_in_use[256];
+
+ /* string in buffer */
+ sldns_buffer strbuf;
+ sldns_buffer_init_frm_data(&strbuf, (uint8_t*)str, strlen(str));
+
+ /* parse the types */
+ memset(typebits, 0, sizeof(typebits));
+ memset(window_in_use, 0, sizeof(window_in_use));
+ while(sldns_buffer_remaining(&strbuf) > 0 &&
+ sldns_bget_token(&strbuf, token, delim, sizeof(token)) != -1) {
+ uint16_t t = sldns_get_rr_type_by_name(token);
+ if(token[0] == 0)
+ continue;
+ if(t == 0 && strcmp(token, "TYPE0") != 0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TYPE,
+ sldns_buffer_position(&strbuf));
+ typebits[t/8] |= (0x80>>(t%8));
+ window_in_use[t/256] = 1;
+ type_count++;
+ if(t > maxtype) maxtype = t;
+ }
+
+ /* empty NSEC bitmap */
+ if(type_count == 0) {
+ *len = 0;
+ return LDNS_WIREPARSE_ERR_OK;
+ }
+
+ /* encode windows {u8 windowblock, u8 bitmaplength, 0-32u8 bitmap},
+ * block is 0-255 upper octet of types, length if 0-32. */
+ for(block = 0; block <= (int)maxtype/256; block++) {
+ int i, blocklen = 0;
+ if(!window_in_use[block])
+ continue;
+ for(i=0; i<32; i++) {
+ if(typebits[block*32+i] != 0)
+ blocklen = i+1;
+ }
+ if(blocklen == 0)
+ continue; /* empty window should have been !in_use */
+ if(used+blocklen+2 > *len)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ rd[used+0] = (uint8_t)block;
+ rd[used+1] = (uint8_t)blocklen;
+ for(i=0; i<blocklen; i++) {
+ rd[used+2+i] = typebits[block*32+i];
+ }
+ used += blocklen+2;
+ }
+ *len = used;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_type_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ uint16_t t = sldns_get_rr_type_by_name(str);
+ if(t == 0 && strcmp(str, "TYPE0") != 0)
+ return LDNS_WIREPARSE_ERR_SYNTAX_TYPE;
+ if(*len < 2)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ sldns_write_uint16(rd, t);
+ *len = 2;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_class_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ uint16_t c = sldns_get_rr_class_by_name(str);
+ if(c == 0 && strcmp(str, "CLASS0") != 0)
+ return LDNS_WIREPARSE_ERR_SYNTAX_CLASS;
+ if(*len < 2)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ sldns_write_uint16(rd, c);
+ *len = 2;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+/* An certificate alg field can either be specified as a 8 bits number
+ * or by its symbolic name. Handle both */
+int sldns_str2wire_cert_alg_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ sldns_lookup_table *lt = sldns_lookup_by_name(sldns_cert_algorithms,
+ str);
+ if(*len < 2)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ if(lt) {
+ sldns_write_uint16(rd, (uint16_t)lt->id);
+ } else {
+ int s = sldns_str2wire_int16_buf(str, rd, len);
+ if(s) return s;
+ if(sldns_read_uint16(rd) == 0)
+ return LDNS_WIREPARSE_ERR_CERT_BAD_ALGORITHM;
+ }
+ *len = 2;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+/* An alg field can either be specified as a 8 bits number
+ * or by its symbolic name. Handle both */
+int sldns_str2wire_alg_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ sldns_lookup_table *lt = sldns_lookup_by_name(sldns_algorithms, str);
+ if(*len < 1)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ if(lt) {
+ rd[0] = (uint8_t)lt->id;
+ *len = 1;
+ } else {
+ /* try as-is (a number) */
+ return sldns_str2wire_int8_buf(str, rd, len);
+ }
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_time_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ /* convert a time YYYYDDMMHHMMSS to wireformat */
+ struct tm tm;
+ if(*len < 4)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+
+ /* Try to scan the time... */
+ memset(&tm, 0, sizeof(tm));
+ if (strlen(str) == 14 && sscanf(str, "%4d%2d%2d%2d%2d%2d",
+ &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour,
+ &tm.tm_min, &tm.tm_sec) == 6) {
+ tm.tm_year -= 1900;
+ tm.tm_mon--;
+ /* Check values */
+ if (tm.tm_year < 70)
+ return LDNS_WIREPARSE_ERR_SYNTAX_TIME;
+ if (tm.tm_mon < 0 || tm.tm_mon > 11)
+ return LDNS_WIREPARSE_ERR_SYNTAX_TIME;
+ if (tm.tm_mday < 1 || tm.tm_mday > 31)
+ return LDNS_WIREPARSE_ERR_SYNTAX_TIME;
+ if (tm.tm_hour < 0 || tm.tm_hour > 23)
+ return LDNS_WIREPARSE_ERR_SYNTAX_TIME;
+ if (tm.tm_min < 0 || tm.tm_min > 59)
+ return LDNS_WIREPARSE_ERR_SYNTAX_TIME;
+ if (tm.tm_sec < 0 || tm.tm_sec > 59)
+ return LDNS_WIREPARSE_ERR_SYNTAX_TIME;
+
+ sldns_write_uint32(rd, sldns_mktime_from_utc(&tm));
+ } else {
+ /* handle it as 32 bits timestamp */
+ char *end;
+ uint32_t l = (uint32_t)strtol((char*)str, &end, 10);
+ if(*end != 0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TIME,
+ end-(char*)str);
+ sldns_write_uint32(rd, l);
+ }
+ *len = 4;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_period_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ const char* end;
+ uint32_t p = sldns_str2period(str, &end);
+ if(*end != 0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_PERIOD, end-str);
+ if(*len < 4)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ sldns_write_uint32(rd, p);
+ *len = 4;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+/** read "<digits>[.<digits>][mM]" into mantissa exponent format for LOC type */
+static int
+loc_parse_cm(char* my_str, char** endstr, uint8_t* m, uint8_t* e)
+{
+ uint32_t meters = 0, cm = 0, val;
+ while (isblank((unsigned char)*my_str)) {
+ my_str++;
+ }
+ meters = (uint32_t)strtol(my_str, &my_str, 10);
+ if (*my_str == '.') {
+ my_str++;
+ cm = (uint32_t)strtol(my_str, &my_str, 10);
+ }
+ if (meters >= 1) {
+ *e = 2;
+ val = meters;
+ } else {
+ *e = 0;
+ val = cm;
+ }
+ while(val >= 10) {
+ (*e)++;
+ val /= 10;
+ }
+ *m = (uint8_t)val;
+
+ if (*e > 9)
+ return 0;
+ if (*my_str == 'm' || *my_str == 'M') {
+ my_str++;
+ }
+ *endstr = my_str;
+ return 1;
+}
+
+int sldns_str2wire_loc_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ uint32_t latitude = 0;
+ uint32_t longitude = 0;
+ uint32_t altitude = 0;
+
+ uint32_t equator = (uint32_t)1<<31; /* 2**31 */
+
+ /* only support version 0 */
+ uint32_t h = 0;
+ uint32_t m = 0;
+ uint8_t size_b = 1, size_e = 2;
+ uint8_t horiz_pre_b = 1, horiz_pre_e = 6;
+ uint8_t vert_pre_b = 1, vert_pre_e = 3;
+
+ double s = 0.0;
+ int northerness;
+ int easterness;
+
+ char *my_str = (char *) str;
+
+ if (isdigit((unsigned char) *my_str)) {
+ h = (uint32_t) strtol(my_str, &my_str, 10);
+ } else {
+ return LDNS_WIREPARSE_ERR_INVALID_STR;
+ }
+
+ while (isblank((unsigned char) *my_str)) {
+ my_str++;
+ }
+
+ if (isdigit((unsigned char) *my_str)) {
+ m = (uint32_t) strtol(my_str, &my_str, 10);
+ } else if (*my_str == 'N' || *my_str == 'S') {
+ goto north;
+ } else {
+ return LDNS_WIREPARSE_ERR_INVALID_STR;
+ }
+
+ while (isblank((unsigned char) *my_str)) {
+ my_str++;
+ }
+
+ if (isdigit((unsigned char) *my_str)) {
+ s = strtod(my_str, &my_str);
+ }
+
+ /* skip blanks before norterness */
+ while (isblank((unsigned char) *my_str)) {
+ my_str++;
+ }
+
+north:
+ if (*my_str == 'N') {
+ northerness = 1;
+ } else if (*my_str == 'S') {
+ northerness = 0;
+ } else {
+ return LDNS_WIREPARSE_ERR_INVALID_STR;
+ }
+
+ my_str++;
+
+ /* store number */
+ s = 1000.0 * s;
+ /* add a little to make floor in conversion a round */
+ s += 0.0005;
+ latitude = (uint32_t) s;
+ latitude += 1000 * 60 * m;
+ latitude += 1000 * 60 * 60 * h;
+ if (northerness) {
+ latitude = equator + latitude;
+ } else {
+ latitude = equator - latitude;
+ }
+ while (isblank((unsigned char)*my_str)) {
+ my_str++;
+ }
+
+ if (isdigit((unsigned char) *my_str)) {
+ h = (uint32_t) strtol(my_str, &my_str, 10);
+ } else {
+ return LDNS_WIREPARSE_ERR_INVALID_STR;
+ }
+
+ while (isblank((unsigned char) *my_str)) {
+ my_str++;
+ }
+
+ if (isdigit((unsigned char) *my_str)) {
+ m = (uint32_t) strtol(my_str, &my_str, 10);
+ } else if (*my_str == 'E' || *my_str == 'W') {
+ goto east;
+ } else {
+ return LDNS_WIREPARSE_ERR_INVALID_STR;
+ }
+
+ while (isblank((unsigned char)*my_str)) {
+ my_str++;
+ }
+
+ if (isdigit((unsigned char) *my_str)) {
+ s = strtod(my_str, &my_str);
+ }
+
+ /* skip blanks before easterness */
+ while (isblank((unsigned char)*my_str)) {
+ my_str++;
+ }
+
+east:
+ if (*my_str == 'E') {
+ easterness = 1;
+ } else if (*my_str == 'W') {
+ easterness = 0;
+ } else {
+ return LDNS_WIREPARSE_ERR_INVALID_STR;
+ }
+
+ my_str++;
+
+ /* store number */
+ s *= 1000.0;
+ /* add a little to make floor in conversion a round */
+ s += 0.0005;
+ longitude = (uint32_t) s;
+ longitude += 1000 * 60 * m;
+ longitude += 1000 * 60 * 60 * h;
+
+ if (easterness) {
+ longitude += equator;
+ } else {
+ longitude = equator - longitude;
+ }
+
+ altitude = (uint32_t)(strtod(my_str, &my_str)*100.0 +
+ 10000000.0 + 0.5);
+ if (*my_str == 'm' || *my_str == 'M') {
+ my_str++;
+ }
+
+ if (strlen(my_str) > 0) {
+ if(!loc_parse_cm(my_str, &my_str, &size_b, &size_e))
+ return LDNS_WIREPARSE_ERR_INVALID_STR;
+ }
+
+ if (strlen(my_str) > 0) {
+ if(!loc_parse_cm(my_str, &my_str, &horiz_pre_b, &horiz_pre_e))
+ return LDNS_WIREPARSE_ERR_INVALID_STR;
+ }
+
+ if (strlen(my_str) > 0) {
+ if(!loc_parse_cm(my_str, &my_str, &vert_pre_b, &vert_pre_e))
+ return LDNS_WIREPARSE_ERR_INVALID_STR;
+ }
+
+ if(*len < 16)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ rd[0] = 0;
+ rd[1] = ((size_b << 4) & 0xf0) | (size_e & 0x0f);
+ rd[2] = ((horiz_pre_b << 4) & 0xf0) | (horiz_pre_e & 0x0f);
+ rd[3] = ((vert_pre_b << 4) & 0xf0) | (vert_pre_e & 0x0f);
+ sldns_write_uint32(rd + 4, latitude);
+ sldns_write_uint32(rd + 8, longitude);
+ sldns_write_uint32(rd + 12, altitude);
+ *len = 16;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+static void
+ldns_tolower_str(char* s)
+{
+ if(s) {
+ while(*s) {
+ *s = (char)tolower((unsigned char)*s);
+ s++;
+ }
+ }
+}
+
+int sldns_str2wire_wks_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ int rd_len = 1;
+ int have_proto = 0;
+ char token[50], proto_str[50];
+ sldns_buffer strbuf;
+ sldns_buffer_init_frm_data(&strbuf, (uint8_t*)str, strlen(str));
+ proto_str[0]=0;
+
+ /* check we have one byte for proto */
+ if(*len < 1)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+
+ while(sldns_bget_token(&strbuf, token, "\t\n ", sizeof(token)) > 0) {
+ ldns_tolower_str(token);
+ if(!have_proto) {
+ struct protoent *p = getprotobyname(token);
+ have_proto = 1;
+ if(p) rd[0] = (uint8_t)p->p_proto;
+ else rd[0] = (uint8_t)atoi(token);
+ (void)strlcpy(proto_str, token, sizeof(proto_str));
+ } else {
+ int serv_port;
+ struct servent *serv = getservbyname(token, proto_str);
+ if(serv) serv_port=(int)ntohs((uint16_t)serv->s_port);
+ else {
+ serv_port = atoi(token);
+ if(serv_port == 0 && strcmp(token, "0") != 0) {
+#ifdef HAVE_ENDSERVENT
+ endservent();
+#endif
+#ifdef HAVE_ENDPROTOENT
+ endprotoent();
+#endif
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX,
+ sldns_buffer_position(&strbuf));
+ }
+ if(serv_port < 0 || serv_port > 65535) {
+#ifdef HAVE_ENDSERVENT
+ endservent();
+#endif
+#ifdef HAVE_ENDPROTOENT
+ endprotoent();
+#endif
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX,
+ sldns_buffer_position(&strbuf));
+ }
+ }
+ if(rd_len < 1+serv_port/8+1) {
+ /* bitmap is larger, init new bytes at 0 */
+ if(*len < 1+(size_t)serv_port/8+1) {
+#ifdef HAVE_ENDSERVENT
+ endservent();
+#endif
+#ifdef HAVE_ENDPROTOENT
+ endprotoent();
+#endif
+ return RET_ERR(
+ LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
+ sldns_buffer_position(&strbuf));
+ }
+ memset(rd+rd_len, 0, 1+(size_t)serv_port/8+1-rd_len);
+ rd_len = 1+serv_port/8+1;
+ }
+ rd[1+ serv_port/8] |= (1 << (7 - serv_port % 8));
+ }
+ }
+ *len = (size_t)rd_len;
+
+#ifdef HAVE_ENDSERVENT
+ endservent();
+#endif
+#ifdef HAVE_ENDPROTOENT
+ endprotoent();
+#endif
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_nsap_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ const char* s = str;
+ size_t slen;
+ size_t dlen = 0; /* number of hexdigits parsed */
+
+ /* just a hex string with optional dots? */
+ if (s[0] != '0' || s[1] != 'x')
+ return LDNS_WIREPARSE_ERR_INVALID_STR;
+ s += 2;
+ slen = strlen(s);
+ if(slen > LDNS_MAX_RDFLEN*2)
+ return LDNS_WIREPARSE_ERR_LABEL_OVERFLOW;
+ while(*s) {
+ if(isspace((unsigned char)*s) || *s == '.') {
+ s++;
+ continue;
+ }
+ if(!isxdigit((unsigned char)*s))
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
+ if(*len < dlen/2 + 1)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
+ s-str);
+ if((dlen&1)==0)
+ rd[dlen/2] = (uint8_t)sldns_hexdigit_to_int(*s++) * 16;
+ else rd[dlen/2] += sldns_hexdigit_to_int(*s++);
+ dlen++;
+ }
+ if((dlen&1)!=0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
+ *len = dlen/2;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_atma_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ const char* s = str;
+ size_t slen = strlen(str);
+ size_t dlen = 0; /* number of hexdigits parsed */
+
+ /* just a hex string with optional dots? */
+ /* notimpl e.164 format */
+ if(slen > LDNS_MAX_RDFLEN*2)
+ return LDNS_WIREPARSE_ERR_LABEL_OVERFLOW;
+ while(*s) {
+ if(isspace((unsigned char)*s) || *s == '.') {
+ s++;
+ continue;
+ }
+ if(!isxdigit((unsigned char)*s))
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
+ if(*len < dlen/2 + 1)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
+ s-str);
+ if((dlen&1)==0)
+ rd[dlen/2] = (uint8_t)sldns_hexdigit_to_int(*s++) * 16;
+ else rd[dlen/2] += sldns_hexdigit_to_int(*s++);
+ dlen++;
+ }
+ if((dlen&1)!=0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
+ *len = dlen/2;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_ipseckey_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ size_t gwlen = 0, keylen = 0;
+ int s;
+ uint8_t gwtype;
+ char token[512];
+ sldns_buffer strbuf;
+ sldns_buffer_init_frm_data(&strbuf, (uint8_t*)str, strlen(str));
+
+ if(*len < 3)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ /* precedence */
+ if(sldns_bget_token(&strbuf, token, "\t\n ", sizeof(token)) <= 0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR,
+ sldns_buffer_position(&strbuf));
+ rd[0] = (uint8_t)atoi(token);
+ /* gateway_type */
+ if(sldns_bget_token(&strbuf, token, "\t\n ", sizeof(token)) <= 0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR,
+ sldns_buffer_position(&strbuf));
+ rd[1] = (uint8_t)atoi(token);
+ gwtype = rd[1];
+ /* algorithm */
+ if(sldns_bget_token(&strbuf, token, "\t\n ", sizeof(token)) <= 0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR,
+ sldns_buffer_position(&strbuf));
+ rd[2] = (uint8_t)atoi(token);
+
+ /* gateway */
+ if(sldns_bget_token(&strbuf, token, "\t\n ", sizeof(token)) <= 0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR,
+ sldns_buffer_position(&strbuf));
+ if(gwtype == 0) {
+ /* NOGATEWAY */
+ if(strcmp(token, ".") != 0)
+ return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR,
+ sldns_buffer_position(&strbuf));
+ gwlen = 0;
+ } else if(gwtype == 1) {
+ /* IP4 */
+ gwlen = *len - 3;
+ s = sldns_str2wire_a_buf(token, rd+3, &gwlen);
+ if(s) return RET_ERR_SHIFT(s, sldns_buffer_position(&strbuf));
+ } else if(gwtype == 2) {
+ /* IP6 */
+ gwlen = *len - 3;
+ s = sldns_str2wire_aaaa_buf(token, rd+3, &gwlen);
+ if(s) return RET_ERR_SHIFT(s, sldns_buffer_position(&strbuf));
+ } else if(gwtype == 3) {
+ /* DNAME */
+ gwlen = *len - 3;
+ s = sldns_str2wire_dname_buf(token, rd+3, &gwlen);
+ if(s) return RET_ERR_SHIFT(s, sldns_buffer_position(&strbuf));
+ } else {
+ /* unknown gateway type */
+ return RET_ERR(LDNS_WIREPARSE_ERR_INVALID_STR,
+ sldns_buffer_position(&strbuf));
+ }
+ /* double check for size */
+ if(*len < 3 + gwlen)
+ return RET_ERR(LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL,
+ sldns_buffer_position(&strbuf));
+
+ /* publickey in remainder of strbuf */
+ keylen = *len - 3 - gwlen;
+ s = sldns_str2wire_b64_buf((const char*)sldns_buffer_current(&strbuf),
+ rd+3+gwlen, &keylen);
+ if(s) return RET_ERR_SHIFT(s, sldns_buffer_position(&strbuf));
+
+ *len = 3 + gwlen + keylen;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_nsec3_salt_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ int i, salt_length_str = (int)strlen(str);
+ if (salt_length_str == 1 && str[0] == '-') {
+ salt_length_str = 0;
+ } else if (salt_length_str % 2 != 0) {
+ return LDNS_WIREPARSE_ERR_SYNTAX_HEX;
+ }
+ if (salt_length_str > 512)
+ return LDNS_WIREPARSE_ERR_SYNTAX_HEX;
+ if(*len < 1+(size_t)salt_length_str / 2)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ rd[0] = (uint8_t) (salt_length_str / 2);
+ for (i = 0; i < salt_length_str; i += 2) {
+ if (isxdigit((unsigned char)str[i]) &&
+ isxdigit((unsigned char)str[i+1])) {
+ rd[1+i/2] = (uint8_t)(sldns_hexdigit_to_int(str[i])*16
+ + sldns_hexdigit_to_int(str[i+1]));
+ } else {
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, i);
+ }
+ }
+ *len = 1 + (size_t)rd[0];
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_ilnp64_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ unsigned int a, b, c, d;
+ uint16_t shorts[4];
+ int l;
+ if(*len < sizeof(shorts))
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+
+ if (sscanf(str, "%4x:%4x:%4x:%4x%n", &a, &b, &c, &d, &l) != 4 ||
+ l != (int)strlen(str) || /* more data to read */
+ strpbrk(str, "+-") /* signed hexes */
+ )
+ return LDNS_WIREPARSE_ERR_SYNTAX_ILNP64;
+ shorts[0] = htons(a);
+ shorts[1] = htons(b);
+ shorts[2] = htons(c);
+ shorts[3] = htons(d);
+ memmove(rd, &shorts, sizeof(shorts));
+ *len = sizeof(shorts);
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_eui48_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ unsigned int a, b, c, d, e, f;
+ int l;
+
+ if(*len < 6)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ if (sscanf(str, "%2x-%2x-%2x-%2x-%2x-%2x%n",
+ &a, &b, &c, &d, &e, &f, &l) != 6 ||
+ l != (int)strlen(str))
+ return LDNS_WIREPARSE_ERR_SYNTAX_EUI48;
+ rd[0] = a;
+ rd[1] = b;
+ rd[2] = c;
+ rd[3] = d;
+ rd[4] = e;
+ rd[5] = f;
+ *len = 6;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_eui64_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ unsigned int a, b, c, d, e, f, g, h;
+ int l;
+
+ if(*len < 8)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ if (sscanf(str, "%2x-%2x-%2x-%2x-%2x-%2x-%2x-%2x%n",
+ &a, &b, &c, &d, &e, &f, &g, &h, &l) != 8 ||
+ l != (int)strlen(str))
+ return LDNS_WIREPARSE_ERR_SYNTAX_EUI64;
+ rd[0] = a;
+ rd[1] = b;
+ rd[2] = c;
+ rd[3] = d;
+ rd[4] = e;
+ rd[5] = f;
+ rd[6] = g;
+ rd[7] = h;
+ *len = 8;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_tag_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ size_t slen = strlen(str);
+ const char* ptr;
+
+ if (slen > 255)
+ return LDNS_WIREPARSE_ERR_SYNTAX_TAG;
+ if(*len < slen+1)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ for (ptr = str; *ptr; ptr++) {
+ if(!isalnum((unsigned char)*ptr))
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_TAG, ptr-str);
+ }
+ rd[0] = slen;
+ memmove(rd+1, str, slen);
+ *len = slen+1;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_long_str_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ uint8_t ch = 0;
+ const char* pstr = str;
+ size_t length = 0;
+
+ /* Fill data with parsed bytes */
+ while (sldns_parse_char(&ch, &pstr)) {
+ if(*len < length+1)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ rd[length++] = ch;
+ }
+ if(!pstr)
+ return LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE;
+ *len = length;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_hip_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ char* s, *end;
+ int e;
+ size_t hitlen, pklen = 0;
+ /* presentation format:
+ * pk-algo HIThex pubkeybase64
+ * wireformat:
+ * hitlen[1byte] pkalgo[1byte] pubkeylen[2byte] [hit] [pubkey] */
+ if(*len < 4)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+
+ /* read PK algorithm */
+ rd[1] = (uint8_t)strtol((char*)str, &s, 10);
+ if(*s != ' ')
+ return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_INT, s-(char*)str);
+ s++;
+ while(*s == ' ')
+ s++;
+
+ /* read HIT hex tag */
+ /* zero terminate the tag (replace later) */
+ end = strchr(s, ' ');
+ if(!end) return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX, s-(char*)str);
+ *end = 0;
+ hitlen = *len - 4;
+ if((e = sldns_str2wire_hex_buf(s, rd+4, &hitlen)) != 0) {
+ *end = ' ';
+ return RET_ERR_SHIFT(e, s-(char*)str);
+ }
+ if(hitlen > 255) {
+ *end = ' ';
+ return RET_ERR(LDNS_WIREPARSE_ERR_LABEL_OVERFLOW, s-(char*)str+255*2);
+ }
+ rd[0] = (uint8_t)hitlen;
+ *end = ' ';
+ s = end+1;
+
+ /* read pubkey base64 sequence */
+ pklen = *len - 4 - hitlen;
+ if((e = sldns_str2wire_b64_buf(s, rd+4+hitlen, &pklen)) != 0)
+ return RET_ERR_SHIFT(e, s-(char*)str);
+ if(pklen > 65535)
+ return RET_ERR(LDNS_WIREPARSE_ERR_LABEL_OVERFLOW, s-(char*)str+65535);
+ sldns_write_uint16(rd+2, pklen);
+
+ *len = 4 + hitlen + pklen;
+ return LDNS_WIREPARSE_ERR_OK;
+}
+
+int sldns_str2wire_int16_data_buf(const char* str, uint8_t* rd, size_t* len)
+{
+ size_t sz = sldns_b64_pton_calculate_size(strlen(str));
+ int n;
+ if(*len < sz+2)
+ return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
+ if(sz > 65535)
+ return LDNS_WIREPARSE_ERR_LABEL_OVERFLOW;
+ n = sldns_b64_pton(str, rd+2, (*len)-2);
+ if(n < 0)
+ return LDNS_WIREPARSE_ERR_SYNTAX_B64;
+ sldns_write_uint16(rd, (uint16_t)n);
+ *len = (size_t)n;
+ return LDNS_WIREPARSE_ERR_OK;
+}
--- /dev/null
+/**
+ * str2wire.h - read txt presentation of RRs
+ *
+ * (c) NLnet Labs, 2005-2006
+ *
+ * See the file LICENSE for the license
+ */
+
+/**
+ * \file
+ *
+ * Parses text to wireformat.
+ */
+
+#ifndef LDNS_STR2WIRE_H
+#define LDNS_STR2WIRE_H
+
+/* include rrdef for MAX_DOMAINLEN constant */
+#include <sldns/rrdef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+struct sldns_struct_lookup_table;
+
+/** buffer to read an RR, cannot be larger than 64K because of packet size */
+#define LDNS_RR_BUF_SIZE 65535 /* bytes */
+#define LDNS_DEFAULT_TTL 3600
+
+/*
+ * To convert class and type to string see
+ * sldns_get_rr_class_by_name(str)
+ * sldns_get_rr_type_by_name(str)
+ * from rrdef.h
+ */
+
+/**
+ * Convert text string into dname wireformat, mallocless, with user buffer.
+ * @param str: the text string with the domain name.
+ * @param buf: the result buffer, suggested size LDNS_MAX_DOMAINLEN+1
+ * @param len: length of the buffer on input, length of the result on output.
+ * @return 0 on success, otherwise an error.
+ */
+int sldns_str2wire_dname_buf(const char* str, uint8_t* buf, size_t* len);
+
+/**
+ * Same as sldns_str2wire_dname_buf, but concatenates origin if the domain
+ * name is relative (does not end in '.').
+ * @param str: the text string with the domain name.
+ * @param buf: the result buffer, suggested size LDNS_MAX_DOMAINLEN+1
+ * @param len: length of the buffer on input, length of the result on output.
+ * @param origin: the origin to append or NULL (nothing is appended).
+ * @param origin_len: length of origin.
+ * @return 0 on success, otherwise an error.
+ */
+int sldns_str2wire_dname_buf_origin(const char* str, uint8_t* buf, size_t* len,
+ uint8_t* origin, size_t origin_len);
+
+/**
+ * Convert text string into dname wireformat
+ * @param str: the text string with the domain name.
+ * @param len: returned length of wireformat.
+ * @return wireformat dname (malloced) or NULL on failure.
+ */
+uint8_t* sldns_str2wire_dname(const char* str, size_t* len);
+
+/**
+ * Convert text RR to wireformat, with user buffer.
+ * @param str: the RR data in text presentation format.
+ * @param rr: the buffer where the result is stored into. This buffer has
+ * the wire-dname(uncompressed), type, class, ttl, rdatalen, rdata.
+ * These values are probably not aligned, and in network format.
+ * Use the sldns_wirerr_get_xxx functions to access them safely.
+ * buffer size LDNS_RR_BUF_SIZE is suggested.
+ * @param len: on input the length of the buffer, on output the amount of
+ * the buffer used for the rr.
+ * @param dname_len: if non-NULL, filled with the dname length as result.
+ * Because after the dname you find the type, class, ttl, rdatalen, rdata.
+ * @param default_ttl: TTL used if no TTL available.
+ * @param origin: used for origin dname (if not NULL)
+ * @param origin_len: length of origin.
+ * @param prev: used for prev_rr dname (if not NULL)
+ * @param prev_len: length of prev.
+ * @return 0 on success, an error on failure.
+ */
+int sldns_str2wire_rr_buf(const char* str, uint8_t* rr, size_t* len,
+ size_t* dname_len, uint32_t default_ttl, uint8_t* origin,
+ size_t origin_len, uint8_t* prev, size_t prev_len);
+
+/**
+ * Same as sldns_str2wire_rr_buf, but there is no rdata, it returns an RR
+ * with zero rdata and no ttl. It has name, type, class.
+ * You can access those with the sldns_wirerr_get_type and class functions.
+ * @param str: the RR data in text presentation format.
+ * @param rr: the buffer where the result is stored into.
+ * @param len: on input the length of the buffer, on output the amount of
+ * the buffer used for the rr.
+ * @param dname_len: if non-NULL, filled with the dname length as result.
+ * Because after the dname you find the type, class, ttl, rdatalen, rdata.
+ * @param origin: used for origin dname (if not NULL)
+ * @param origin_len: length of origin.
+ * @param prev: used for prev_rr dname (if not NULL)
+ * @param prev_len: length of prev.
+ * @return 0 on success, an error on failure.
+ */
+int sldns_str2wire_rr_question_buf(const char* str, uint8_t* rr, size_t* len,
+ size_t* dname_len, uint8_t* origin, size_t origin_len, uint8_t* prev,
+ size_t prev_len);
+
+/**
+ * Get the type of the RR.
+ * @param rr: the RR in wire format.
+ * @param len: rr length.
+ * @param dname_len: dname length to skip.
+ * @return type in host byteorder
+ */
+uint16_t sldns_wirerr_get_type(uint8_t* rr, size_t len, size_t dname_len);
+
+/**
+ * Get the class of the RR.
+ * @param rr: the RR in wire format.
+ * @param len: rr length.
+ * @param dname_len: dname length to skip.
+ * @return class in host byteorder
+ */
+uint16_t sldns_wirerr_get_class(uint8_t* rr, size_t len, size_t dname_len);
+
+/**
+ * Get the ttl of the RR.
+ * @param rr: the RR in wire format.
+ * @param len: rr length.
+ * @param dname_len: dname length to skip.
+ * @return ttl in host byteorder
+ */
+uint32_t sldns_wirerr_get_ttl(uint8_t* rr, size_t len, size_t dname_len);
+
+/**
+ * Get the rdata length of the RR.
+ * @param rr: the RR in wire format.
+ * @param len: rr length.
+ * @param dname_len: dname length to skip.
+ * @return rdata length in host byteorder
+ * If the rdata length is larger than the rr-len allows, it is truncated.
+ * So, that it is safe to read the data length returned
+ * from this function from the rdata pointer of sldns_wirerr_get_rdata.
+ */
+uint16_t sldns_wirerr_get_rdatalen(uint8_t* rr, size_t len, size_t dname_len);
+
+/**
+ * Get the rdata pointer of the RR.
+ * @param rr: the RR in wire format.
+ * @param len: rr length.
+ * @param dname_len: dname length to skip.
+ * @return rdata pointer
+ */
+uint8_t* sldns_wirerr_get_rdata(uint8_t* rr, size_t len, size_t dname_len);
+
+/**
+ * Get the rdata pointer of the RR. prefixed with rdata length.
+ * @param rr: the RR in wire format.
+ * @param len: rr length.
+ * @param dname_len: dname length to skip.
+ * @return pointer to rdatalength, followed by the rdata.
+ */
+uint8_t* sldns_wirerr_get_rdatawl(uint8_t* rr, size_t len, size_t dname_len);
+
+/**
+ * Parse result codes
+ */
+#define LDNS_WIREPARSE_MASK 0x0fff
+#define LDNS_WIREPARSE_SHIFT 12
+#define LDNS_WIREPARSE_ERROR(e) ((e)&LDNS_WIREPARSE_MASK)
+#define LDNS_WIREPARSE_OFFSET(e) (((e)&~LDNS_WIREPARSE_MASK)>>LDNS_WIREPARSE_SHIFT)
+/* use lookuptable to get error string, sldns_wireparse_errors */
+#define LDNS_WIREPARSE_ERR_OK 0
+#define LDNS_WIREPARSE_ERR_GENERAL 342
+#define LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW 343
+#define LDNS_WIREPARSE_ERR_DOMAINNAME_UNDERFLOW 344
+#define LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL 345
+#define LDNS_WIREPARSE_ERR_LABEL_OVERFLOW 346
+#define LDNS_WIREPARSE_ERR_EMPTY_LABEL 347
+#define LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE 348
+#define LDNS_WIREPARSE_ERR_SYNTAX 349
+#define LDNS_WIREPARSE_ERR_SYNTAX_TTL 350
+#define LDNS_WIREPARSE_ERR_SYNTAX_TYPE 351
+#define LDNS_WIREPARSE_ERR_SYNTAX_CLASS 352
+#define LDNS_WIREPARSE_ERR_SYNTAX_RDATA 353
+#define LDNS_WIREPARSE_ERR_SYNTAX_MISSING_VALUE 354
+#define LDNS_WIREPARSE_ERR_INVALID_STR 355
+#define LDNS_WIREPARSE_ERR_SYNTAX_B64 356
+#define LDNS_WIREPARSE_ERR_SYNTAX_B32_EXT 357
+#define LDNS_WIREPARSE_ERR_SYNTAX_HEX 358
+#define LDNS_WIREPARSE_ERR_CERT_BAD_ALGORITHM 359
+#define LDNS_WIREPARSE_ERR_SYNTAX_TIME 360
+#define LDNS_WIREPARSE_ERR_SYNTAX_PERIOD 361
+#define LDNS_WIREPARSE_ERR_SYNTAX_ILNP64 362
+#define LDNS_WIREPARSE_ERR_SYNTAX_EUI48 363
+#define LDNS_WIREPARSE_ERR_SYNTAX_EUI64 364
+#define LDNS_WIREPARSE_ERR_SYNTAX_TAG 365
+#define LDNS_WIREPARSE_ERR_NOT_IMPL 366
+#define LDNS_WIREPARSE_ERR_SYNTAX_INT 367
+#define LDNS_WIREPARSE_ERR_SYNTAX_IP4 368
+#define LDNS_WIREPARSE_ERR_SYNTAX_IP6 369
+#define LDNS_WIREPARSE_ERR_SYNTAX_INTEGER_OVERFLOW 370
+#define LDNS_WIREPARSE_ERR_INCLUDE 371
+#define LDNS_WIREPARSE_ERR_PARENTHESIS 372
+
+/**
+ * Get reference to a constant string for the (parse) error.
+ * @param e: error return value
+ * @return string.
+ */
+const char* sldns_get_errorstr_parse(int e);
+
+/**
+ * wire parse state for parsing files
+ */
+struct sldns_file_parse_state {
+ /** the origin domain name, if len!=0. uncompressed wireformat */
+ uint8_t origin[LDNS_MAX_DOMAINLEN+1];
+ /** length of origin domain name, in bytes. 0 if not set. */
+ size_t origin_len;
+ /** the previous domain name, if len!=0. uncompressed wireformat*/
+ uint8_t prev_rr[LDNS_MAX_DOMAINLEN+1];
+ /** length of the previous domain name, in bytes. 0 if not set. */
+ size_t prev_rr_len;
+ /** default TTL, this is used if the text does not specify a TTL,
+ * host byteorder */
+ uint32_t default_ttl;
+ /** line number information */
+ int lineno;
+};
+
+/**
+ * Read one RR from zonefile with buffer for the data.
+ * @param in: file that is read from (one RR, multiple lines if it spans them).
+ * @param rr: this is malloced by the user and the result is stored here,
+ * if an RR is read. If no RR is read this is signalled with the
+ * return len set to 0 (for ORIGIN, TTL directives).
+ * @param len: on input, the length of the rr buffer. on output the rr len.
+ * Buffer size of 64k should be enough.
+ * @param dname_len: returns the length of the dname initial part of the rr.
+ * @param parse_state: pass a pointer to user-allocated struct.
+ * Contents are maintained by this function.
+ * If you pass NULL then ORIGIN and TTL directives are not honored.
+ * You can start out with a particular origin by pre-filling it.
+ * otherwise, zero the structure before passing it.
+ * lineno is incremented when a newline is passed by the parser,
+ * you should initialize it at 1 at the start of the file.
+ * @return 0 on success, error on failure.
+ */
+int sldns_fp2wire_rr_buf(FILE* in, uint8_t* rr, size_t* len, size_t* dname_len,
+ struct sldns_file_parse_state* parse_state);
+
+/**
+ * Convert one rdf in rdata to wireformat and parse from string.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @param rdftype: the type of the rdf.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_rdf_buf(const char* str, uint8_t* rd, size_t* len,
+ sldns_rdf_type rdftype);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_INT8 from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_int8_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_INT16 from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_int16_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_INT32 from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_int32_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_A from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_a_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_AAAA from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_aaaa_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_STR from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_str_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_APL from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_apl_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_B64 from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_b64_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_B32_EXT from string to wireformat.
+ * And also LDNS_RDF_TYPE_NSEC3_NEXT_OWNER.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_b32_ext_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_HEX from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_hex_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_NSEC from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_nsec_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_TYPE from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_type_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_CLASS from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_class_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_CERT_ALG from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_cert_alg_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_ALG from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_alg_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_TIME from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_time_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_PERIOD from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_period_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_LOC from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_loc_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_WKS from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_wks_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_NSAP from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_nsap_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_ATMA from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_atma_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_IPSECKEY from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_ipseckey_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_NSEC3_SALT from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_nsec3_salt_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_ILNP64 from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_ilnp64_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_EUI48 from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_eui48_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_EUI64 from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_eui64_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_TAG from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_tag_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_LONG_STR from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_long_str_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_HIP from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_hip_buf(const char* str, uint8_t* rd, size_t* len);
+
+/**
+ * Convert rdf of type LDNS_RDF_TYPE_INT16_DATA from string to wireformat.
+ * @param str: the text to convert for this rdata element.
+ * @param rd: rdata buffer for the wireformat.
+ * @param len: length of rd buffer on input, used length on output.
+ * @return 0 on success, error on failure.
+ */
+int sldns_str2wire_int16_data_buf(const char* str, uint8_t* rd, size_t* len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LDNS_STR2WIRE_H */
--- /dev/null
+/*
+ * wire2str.c
+ *
+ * conversion routines from the wire format
+ * to the presentation format (strings)
+ *
+ * (c) NLnet Labs, 2004-2006
+ *
+ * See the file LICENSE for the license
+ */
+/**
+ * \file
+ *
+ * Contains functions to translate the wireformat to text
+ * representation, as well as functions to print them.
+ */
+#include "config.h"
+#include "sldns/wire2str.h"
+#include "sldns/str2wire.h"
+#include "sldns/rrdef.h"
+#include "sldns/pkthdr.h"
+#include "sldns/parseutil.h"
+#include "sldns/sbuffer.h"
+#include "sldns/keyraw.h"
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#include <sys/time.h>
+#include <stdarg.h>
+#include <ctype.h>
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+/* lookup tables for standard DNS stuff */
+/* Taken from RFC 2535, section 7. */
+static sldns_lookup_table sldns_algorithms_data[] = {
+ { LDNS_RSAMD5, "RSAMD5" },
+ { LDNS_DH, "DH" },
+ { LDNS_DSA, "DSA" },
+ { LDNS_ECC, "ECC" },
+ { LDNS_RSASHA1, "RSASHA1" },
+ { LDNS_DSA_NSEC3, "DSA-NSEC3-SHA1" },
+ { LDNS_RSASHA1_NSEC3, "RSASHA1-NSEC3-SHA1" },
+ { LDNS_RSASHA256, "RSASHA256"},
+ { LDNS_RSASHA512, "RSASHA512"},
+ { LDNS_ECC_GOST, "ECC-GOST"},
+ { LDNS_ECDSAP256SHA256, "ECDSAP256SHA256"},
+ { LDNS_ECDSAP384SHA384, "ECDSAP384SHA384"},
+ { LDNS_INDIRECT, "INDIRECT" },
+ { LDNS_PRIVATEDNS, "PRIVATEDNS" },
+ { LDNS_PRIVATEOID, "PRIVATEOID" },
+ { 0, NULL }
+};
+sldns_lookup_table* sldns_algorithms = sldns_algorithms_data;
+
+/* hash algorithms in DS record */
+static sldns_lookup_table sldns_hashes_data[] = {
+ { LDNS_SHA1, "SHA1" },
+ { LDNS_SHA256, "SHA256" },
+ { LDNS_HASH_GOST, "HASH-GOST" },
+ { LDNS_SHA384, "SHA384" },
+ { 0, NULL }
+};
+sldns_lookup_table* sldns_hashes = sldns_hashes_data;
+
+/* Taken from RFC 4398 */
+static sldns_lookup_table sldns_cert_algorithms_data[] = {
+ { LDNS_CERT_PKIX, "PKIX" },
+ { LDNS_CERT_SPKI, "SPKI" },
+ { LDNS_CERT_PGP, "PGP" },
+ { LDNS_CERT_IPKIX, "IPKIX" },
+ { LDNS_CERT_ISPKI, "ISPKI" },
+ { LDNS_CERT_IPGP, "IPGP" },
+ { LDNS_CERT_ACPKIX, "ACPKIX" },
+ { LDNS_CERT_IACPKIX, "IACPKIX" },
+ { LDNS_CERT_URI, "URI" },
+ { LDNS_CERT_OID, "OID" },
+ { 0, NULL }
+};
+sldns_lookup_table* sldns_cert_algorithms = sldns_cert_algorithms_data;
+
+/* if these are used elsewhere */
+static sldns_lookup_table sldns_rcodes_data[] = {
+ { LDNS_RCODE_NOERROR, "NOERROR" },
+ { LDNS_RCODE_FORMERR, "FORMERR" },
+ { LDNS_RCODE_SERVFAIL, "SERVFAIL" },
+ { LDNS_RCODE_NXDOMAIN, "NXDOMAIN" },
+ { LDNS_RCODE_NOTIMPL, "NOTIMPL" },
+ { LDNS_RCODE_REFUSED, "REFUSED" },
+ { LDNS_RCODE_YXDOMAIN, "YXDOMAIN" },
+ { LDNS_RCODE_YXRRSET, "YXRRSET" },
+ { LDNS_RCODE_NXRRSET, "NXRRSET" },
+ { LDNS_RCODE_NOTAUTH, "NOTAUTH" },
+ { LDNS_RCODE_NOTZONE, "NOTZONE" },
+ { 0, NULL }
+};
+sldns_lookup_table* sldns_rcodes = sldns_rcodes_data;
+
+static sldns_lookup_table sldns_opcodes_data[] = {
+ { LDNS_PACKET_QUERY, "QUERY" },
+ { LDNS_PACKET_IQUERY, "IQUERY" },
+ { LDNS_PACKET_STATUS, "STATUS" },
+ { LDNS_PACKET_NOTIFY, "NOTIFY" },
+ { LDNS_PACKET_UPDATE, "UPDATE" },
+ { 0, NULL }
+};
+sldns_lookup_table* sldns_opcodes = sldns_opcodes_data;
+
+static sldns_lookup_table sldns_wireparse_errors_data[] = {
+ { LDNS_WIREPARSE_ERR_OK, "no parse error" },
+ { LDNS_WIREPARSE_ERR_GENERAL, "parse error" },
+ { LDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW, "Domainname length overflow" },
+ { LDNS_WIREPARSE_ERR_DOMAINNAME_UNDERFLOW, "Domainname length underflow (zero length)" },
+ { LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, "buffer too small" },
+ { LDNS_WIREPARSE_ERR_LABEL_OVERFLOW, "Label length overflow" },
+ { LDNS_WIREPARSE_ERR_EMPTY_LABEL, "Empty label" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_BAD_ESCAPE, "Syntax error, bad escape sequence" },
+ { LDNS_WIREPARSE_ERR_SYNTAX, "Syntax error, could not parse the RR" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_TTL, "Syntax error, could not parse the RR's TTL" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_TYPE, "Syntax error, could not parse the RR's type" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_CLASS, "Syntax error, could not parse the RR's class" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_RDATA, "Syntax error, could not parse the RR's rdata" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_MISSING_VALUE, "Syntax error, value expected" },
+ { LDNS_WIREPARSE_ERR_INVALID_STR, "Conversion error, string expected" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_B64, "Conversion error, b64 encoding expected" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_B32_EXT, "Conversion error, b32 ext encoding expected" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_HEX, "Conversion error, hex encoding expected" },
+ { LDNS_WIREPARSE_ERR_CERT_BAD_ALGORITHM, "Bad algorithm type for CERT record" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_TIME, "Conversion error, time encoding expected" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_PERIOD, "Conversion error, time period encoding expected" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_ILNP64, "Conversion error, 4 colon separated hex numbers expected" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_EUI48,
+ "Conversion error, 6 two character hex numbers "
+ "separated by dashes expected (i.e. xx-xx-xx-xx-xx-xx" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_EUI64,
+ "Conversion error, 8 two character hex numbers "
+ "separated by dashes expected (i.e. xx-xx-xx-xx-xx-xx-xx-xx" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_TAG,
+ "Conversion error, a non-zero sequence of US-ASCII letters "
+ "and numbers in lower case expected" },
+ { LDNS_WIREPARSE_ERR_NOT_IMPL, "not implemented" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_INT, "Conversion error, integer expected" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_IP4, "Conversion error, ip4 addr expected" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_IP6, "Conversion error, ip6 addr expected" },
+ { LDNS_WIREPARSE_ERR_SYNTAX_INTEGER_OVERFLOW, "Syntax error, integer overflow" },
+ { LDNS_WIREPARSE_ERR_INCLUDE, "$INCLUDE directive was seen in the zone" },
+ { LDNS_WIREPARSE_ERR_PARENTHESIS, "Parse error, parenthesis mismatch" },
+ { 0, NULL }
+};
+sldns_lookup_table* sldns_wireparse_errors = sldns_wireparse_errors_data;
+
+static sldns_lookup_table sldns_edns_flags_data[] = {
+ { 3600, "do"},
+ { 0, NULL}
+};
+sldns_lookup_table* sldns_edns_flags = sldns_edns_flags_data;
+
+static sldns_lookup_table sldns_edns_options_data[] = {
+ { 1, "LLQ" },
+ { 2, "UL" },
+ { 3, "NSID" },
+ /* 4 draft-cheshire-edns0-owner-option */
+ { 5, "DAU" },
+ { 6, "DHU" },
+ { 7, "N3U" },
+ { 8, "edns-client-subnet" },
+ { 0, NULL}
+};
+sldns_lookup_table* sldns_edns_options = sldns_edns_options_data;
+
+char* sldns_wire2str_pkt(uint8_t* data, size_t len)
+{
+ size_t slen = (size_t)sldns_wire2str_pkt_buf(data, len, NULL, 0);
+ char* result = (char*)malloc(slen+1);
+ if(!result) return NULL;
+ sldns_wire2str_pkt_buf(data, len, result, slen+1);
+ return result;
+}
+
+char* sldns_wire2str_rr(uint8_t* rr, size_t len)
+{
+ size_t slen = (size_t)sldns_wire2str_rr_buf(rr, len, NULL, 0);
+ char* result = (char*)malloc(slen+1);
+ if(!result) return NULL;
+ sldns_wire2str_rr_buf(rr, len, result, slen+1);
+ return result;
+}
+
+char* sldns_wire2str_type(uint16_t rrtype)
+{
+ char buf[16];
+ sldns_wire2str_type_buf(rrtype, buf, sizeof(buf));
+ return strdup(buf);
+}
+
+char* sldns_wire2str_class(uint16_t rrclass)
+{
+ char buf[16];
+ sldns_wire2str_class_buf(rrclass, buf, sizeof(buf));
+ return strdup(buf);
+}
+
+char* sldns_wire2str_dname(uint8_t* dname, size_t dname_len)
+{
+ size_t slen=(size_t)sldns_wire2str_dname_buf(dname, dname_len, NULL, 0);
+ char* result = (char*)malloc(slen+1);
+ if(!result) return NULL;
+ sldns_wire2str_dname_buf(dname, dname_len, result, slen+1);
+ return result;
+}
+
+char* sldns_wire2str_rcode(int rcode)
+{
+ char buf[16];
+ sldns_wire2str_rcode_buf(rcode, buf, sizeof(buf));
+ return strdup(buf);
+}
+
+int sldns_wire2str_pkt_buf(uint8_t* d, size_t dlen, char* s, size_t slen)
+{
+ /* use arguments as temporary variables */
+ return sldns_wire2str_pkt_scan(&d, &dlen, &s, &slen);
+}
+
+int sldns_wire2str_rr_buf(uint8_t* d, size_t dlen, char* s, size_t slen)
+{
+ /* use arguments as temporary variables */
+ return sldns_wire2str_rr_scan(&d, &dlen, &s, &slen, NULL, 0);
+}
+
+int sldns_wire2str_rdata_buf(uint8_t* rdata, size_t rdata_len, char* str,
+ size_t str_len, uint16_t rrtype)
+{
+ /* use arguments as temporary variables */
+ return sldns_wire2str_rdata_scan(&rdata, &rdata_len, &str, &str_len,
+ rrtype, NULL, 0);
+}
+
+int sldns_wire2str_rr_unknown_buf(uint8_t* d, size_t dlen, char* s, size_t slen)
+{
+ /* use arguments as temporary variables */
+ return sldns_wire2str_rr_unknown_scan(&d, &dlen, &s, &slen, NULL, 0);
+}
+
+int sldns_wire2str_rr_comment_buf(uint8_t* rr, size_t rrlen, size_t dname_len,
+ char* s, size_t slen)
+{
+ uint16_t rrtype = sldns_wirerr_get_type(rr, rrlen, dname_len);
+ return sldns_wire2str_rr_comment_print(&s, &slen, rr, rrlen, dname_len,
+ rrtype);
+}
+
+int sldns_wire2str_type_buf(uint16_t rrtype, char* s, size_t slen)
+{
+ /* use arguments as temporary variables */
+ return sldns_wire2str_type_print(&s, &slen, rrtype);
+}
+
+int sldns_wire2str_class_buf(uint16_t rrclass, char* s, size_t slen)
+{
+ /* use arguments as temporary variables */
+ return sldns_wire2str_class_print(&s, &slen, rrclass);
+}
+
+int sldns_wire2str_rcode_buf(int rcode, char* s, size_t slen)
+{
+ /* use arguments as temporary variables */
+ return sldns_wire2str_rcode_print(&s, &slen, rcode);
+}
+
+int sldns_wire2str_dname_buf(uint8_t* d, size_t dlen, char* s, size_t slen)
+{
+ /* use arguments as temporary variables */
+ return sldns_wire2str_dname_scan(&d, &dlen, &s, &slen, NULL, 0);
+}
+
+int sldns_str_vprint(char** str, size_t* slen, const char* format, va_list args)
+{
+ int w = vsnprintf(*str, *slen, format, args);
+ if(w < 0) {
+ /* error in printout */
+ return 0;
+ } else if((size_t)w >= *slen) {
+ *str = NULL; /* we do not want str to point outside of buffer*/
+ *slen = 0;
+ } else {
+ *str += w;
+ *slen -= w;
+ }
+ return w;
+}
+
+int sldns_str_print(char** str, size_t* slen, const char* format, ...)
+{
+ int w;
+ va_list args;
+ va_start(args, format);
+ w = sldns_str_vprint(str, slen, format, args);
+ va_end(args);
+ return w;
+}
+
+/** print hex format into text buffer for specified length */
+static int print_hex_buf(char** s, size_t* slen, uint8_t* buf, size_t len)
+{
+ const char* hex = "0123456789ABCDEF";
+ size_t i;
+ for(i=0; i<len; i++) {
+ (void)sldns_str_print(s, slen, "%c%c", hex[(buf[i]&0xf0)>>4],
+ hex[buf[i]&0x0f]);
+ }
+ return (int)len*2;
+}
+
+/** print remainder of buffer in hex format with prefixed text */
+static int print_remainder_hex(const char* pref, uint8_t** d, size_t* dlen,
+ char** s, size_t* slen)
+{
+ int w = 0;
+ w += sldns_str_print(s, slen, "%s", pref);
+ w += print_hex_buf(s, slen, *d, *dlen);
+ *d += *dlen;
+ *dlen = 0;
+ return w;
+}
+
+int sldns_wire2str_pkt_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen)
+{
+ int w = 0;
+ unsigned qdcount, ancount, nscount, arcount, i;
+ uint8_t* pkt = *d;
+ size_t pktlen = *dlen;
+ if(*dlen >= LDNS_HEADER_SIZE) {
+ qdcount = (unsigned)LDNS_QDCOUNT(*d);
+ ancount = (unsigned)LDNS_ANCOUNT(*d);
+ nscount = (unsigned)LDNS_NSCOUNT(*d);
+ arcount = (unsigned)LDNS_ARCOUNT(*d);
+ } else {
+ qdcount = ancount = nscount = arcount = 0;
+ }
+ w += sldns_wire2str_header_scan(d, dlen, s, slen);
+ w += sldns_str_print(s, slen, "\n");
+ w += sldns_str_print(s, slen, ";; QUESTION SECTION:\n");
+ for(i=0; i<qdcount; i++) {
+ w += sldns_wire2str_rrquestion_scan(d, dlen, s, slen,
+ pkt, pktlen);
+ if(!*dlen) break;
+ }
+ w += sldns_str_print(s, slen, "\n");
+ w += sldns_str_print(s, slen, ";; ANSWER SECTION:\n");
+ for(i=0; i<ancount; i++) {
+ w += sldns_wire2str_rr_scan(d, dlen, s, slen, pkt, pktlen);
+ if(!*dlen) break;
+ }
+ w += sldns_str_print(s, slen, "\n");
+ w += sldns_str_print(s, slen, ";; AUTHORITY SECTION:\n");
+ for(i=0; i<nscount; i++) {
+ w += sldns_wire2str_rr_scan(d, dlen, s, slen, pkt, pktlen);
+ if(!*dlen) break;
+ }
+ w += sldns_str_print(s, slen, "\n");
+ w += sldns_str_print(s, slen, ";; ADDITIONAL SECTION:\n");
+ for(i=0; i<arcount; i++) {
+ w += sldns_wire2str_rr_scan(d, dlen, s, slen, pkt, pktlen);
+ if(!*dlen) break;
+ }
+ /* other fields: WHEN(time), SERVER(IP) not available here. */
+ w += sldns_str_print(s, slen, ";; MSG SIZE rcvd: %d\n", (int)pktlen);
+ if(*dlen > 0) {
+ w += print_remainder_hex(";; trailing garbage 0x",
+ d, dlen, s, slen);
+ w += sldns_str_print(s, slen, "\n");
+ }
+ return w;
+}
+
+/** scan type, class and ttl and printout, for rr */
+static int sldns_rr_tcttl_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ int w = 0;
+ uint16_t t, c;
+ uint32_t ttl;
+ if(*dl < 8) {
+ if(*dl < 4)
+ return w + print_remainder_hex("; Error malformed 0x",
+ d, dl, s, sl);
+ /* these print values or 0x.. if none left */
+ t = sldns_read_uint16(*d);
+ c = sldns_read_uint16((*d)+2);
+ (*d)+=4;
+ (*dl)-=4;
+ w += sldns_wire2str_class_print(s, sl, c);
+ w += sldns_str_print(s, sl, "\t");
+ w += sldns_wire2str_type_print(s, sl, t);
+ if(*dl == 0)
+ return w + sldns_str_print(s, sl, "; Error no ttl");
+ return w + print_remainder_hex(
+ "; Error malformed ttl 0x", d, dl, s, sl);
+ }
+ t = sldns_read_uint16(*d);
+ c = sldns_read_uint16((*d)+2);
+ ttl = sldns_read_uint32((*d)+4);
+ (*d)+=8;
+ (*dl)-=8;
+ w += sldns_str_print(s, sl, "%lu\t", (unsigned long)ttl);
+ w += sldns_wire2str_class_print(s, sl, c);
+ w += sldns_str_print(s, sl, "\t");
+ w += sldns_wire2str_type_print(s, sl, t);
+ return w;
+}
+
+int sldns_wire2str_rr_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen,
+ uint8_t* pkt, size_t pktlen)
+{
+ int w = 0;
+ uint8_t* rr = *d;
+ size_t rrlen = *dlen, dname_off, rdlen, ordlen;
+ uint16_t rrtype = 0;
+
+ if(*dlen >= 3 && (*d)[0]==0 &&
+ sldns_read_uint16((*d)+1)==LDNS_RR_TYPE_OPT) {
+ /* perform EDNS OPT processing */
+ return sldns_wire2str_edns_scan(d, dlen, s, slen, pkt, pktlen);
+ }
+
+ /* try to scan the rdata with pretty-printing, but if that fails, then
+ * scan the rdata as an unknown RR type */
+ w += sldns_wire2str_dname_scan(d, dlen, s, slen, pkt, pktlen);
+ w += sldns_str_print(s, slen, "\t");
+ dname_off = rrlen-(*dlen);
+ if(*dlen == 4) {
+ /* like a question-RR */
+ uint16_t t = sldns_read_uint16(*d);
+ uint16_t c = sldns_read_uint16((*d)+2);
+ (*d)+=4;
+ (*dlen)-=4;
+ w += sldns_wire2str_class_print(s, slen, c);
+ w += sldns_str_print(s, slen, "\t");
+ w += sldns_wire2str_type_print(s, slen, t);
+ w += sldns_str_print(s, slen, " ; Error no ttl,rdata\n");
+ return w;
+ }
+ if(*dlen < 8) {
+ if(*dlen == 0)
+ return w + sldns_str_print(s, slen, ";Error missing RR\n");
+ w += print_remainder_hex(";Error partial RR 0x", d, dlen, s, slen);
+ return w + sldns_str_print(s, slen, "\n");
+ }
+ rrtype = sldns_read_uint16(*d);
+ w += sldns_rr_tcttl_scan(d, dlen, s, slen);
+ w += sldns_str_print(s, slen, "\t");
+
+ /* rdata */
+ if(*dlen < 2) {
+ if(*dlen == 0)
+ return w + sldns_str_print(s, slen, ";Error missing rdatalen\n");
+ w += print_remainder_hex(";Error missing rdatalen 0x",
+ d, dlen, s, slen);
+ return w + sldns_str_print(s, slen, "\n");
+ }
+ rdlen = sldns_read_uint16(*d);
+ ordlen = rdlen;
+ (*d)+=2;
+ (*dlen)-=2;
+ if(*dlen < rdlen) {
+ w += sldns_str_print(s, slen, "\\# %u ", (unsigned)rdlen);
+ if(*dlen == 0)
+ return w + sldns_str_print(s, slen, ";Error missing rdata\n");
+ w += print_remainder_hex(";Error partial rdata 0x", d, dlen, s, slen);
+ return w + sldns_str_print(s, slen, "\n");
+ }
+ w += sldns_wire2str_rdata_scan(d, &rdlen, s, slen, rrtype, pkt, pktlen);
+ (*dlen) -= (ordlen-rdlen);
+
+ /* default comment */
+ w += sldns_wire2str_rr_comment_print(s, slen, rr, rrlen, dname_off,
+ rrtype);
+ w += sldns_str_print(s, slen, "\n");
+ return w;
+}
+
+int sldns_wire2str_rrquestion_scan(uint8_t** d, size_t* dlen, char** s,
+ size_t* slen, uint8_t* pkt, size_t pktlen)
+{
+ int w = 0;
+ uint16_t t, c;
+ w += sldns_wire2str_dname_scan(d, dlen, s, slen, pkt, pktlen);
+ w += sldns_str_print(s, slen, "\t");
+ if(*dlen < 4) {
+ if(*dlen == 0)
+ return w + sldns_str_print(s, slen, "Error malformed\n");
+ w += print_remainder_hex("Error malformed 0x", d, dlen, s, slen);
+ return w + sldns_str_print(s, slen, "\n");
+ }
+ t = sldns_read_uint16(*d);
+ c = sldns_read_uint16((*d)+2);
+ (*d)+=4;
+ (*dlen)-=4;
+ w += sldns_wire2str_class_print(s, slen, c);
+ w += sldns_str_print(s, slen, "\t");
+ w += sldns_wire2str_type_print(s, slen, t);
+ w += sldns_str_print(s, slen, "\n");
+ return w;
+}
+
+int sldns_wire2str_rr_unknown_scan(uint8_t** d, size_t* dlen, char** s,
+ size_t* slen, uint8_t* pkt, size_t pktlen)
+{
+ size_t rdlen, ordlen;
+ int w = 0;
+ w += sldns_wire2str_dname_scan(d, dlen, s, slen, pkt, pktlen);
+ w += sldns_str_print(s, slen, "\t");
+ w += sldns_rr_tcttl_scan(d, dlen, s, slen);
+ w += sldns_str_print(s, slen, "\t");
+ if(*dlen < 2) {
+ if(*dlen == 0)
+ return w + sldns_str_print(s, slen, ";Error missing rdatalen\n");
+ w += print_remainder_hex(";Error missing rdatalen 0x",
+ d, dlen, s, slen);
+ return w + sldns_str_print(s, slen, "\n");
+ }
+ rdlen = sldns_read_uint16(*d);
+ ordlen = rdlen;
+ (*d) += 2;
+ (*dlen) -= 2;
+ if(*dlen < rdlen) {
+ w += sldns_str_print(s, slen, "\\# %u ", (unsigned)rdlen);
+ if(*dlen == 0)
+ return w + sldns_str_print(s, slen, ";Error missing rdata\n");
+ w += print_remainder_hex(";Error partial rdata 0x", d, dlen, s, slen);
+ return w + sldns_str_print(s, slen, "\n");
+ }
+ w += sldns_wire2str_rdata_unknown_scan(d, &rdlen, s, slen);
+ (*dlen) -= (ordlen-rdlen);
+ w += sldns_str_print(s, slen, "\n");
+ return w;
+}
+
+/** print rr comment for type DNSKEY */
+static int rr_comment_dnskey(char** s, size_t* slen, uint8_t* rr,
+ size_t rrlen, size_t dname_off)
+{
+ size_t rdlen;
+ uint8_t* rdata;
+ int flags, w = 0;
+ if(rrlen < dname_off + 10) return 0;
+ rdlen = sldns_read_uint16(rr+dname_off+8);
+ if(rrlen < dname_off + 10 + rdlen) return 0;
+ rdata = rr + dname_off + 10;
+ flags = (int)sldns_read_uint16(rdata);
+ w += sldns_str_print(s, slen, " ;{");
+
+ /* id */
+ w += sldns_str_print(s, slen, "id = %u",
+ sldns_calc_keytag_raw(rdata, rdlen));
+
+ /* flags */
+ if((flags&LDNS_KEY_ZONE_KEY)) {
+ if((flags&LDNS_KEY_SEP_KEY))
+ w += sldns_str_print(s, slen, " (ksk)");
+ else w += sldns_str_print(s, slen, " (zsk)");
+ }
+
+ /* keysize */
+ if(rdlen > 4) {
+ w += sldns_str_print(s, slen, ", ");
+ w += sldns_str_print(s, slen, "size = %db",
+ (int)sldns_rr_dnskey_key_size_raw(
+ (unsigned char*)rdata+4, rdlen-4, (int)(rdata[3])));
+ }
+
+ w += sldns_str_print(s, slen, "}");
+ return w;
+}
+
+/** print rr comment for type RRSIG */
+static int rr_comment_rrsig(char** s, size_t* slen, uint8_t* rr,
+ size_t rrlen, size_t dname_off)
+{
+ size_t rdlen;
+ uint8_t* rdata;
+ if(rrlen < dname_off + 10) return 0;
+ rdlen = sldns_read_uint16(rr+dname_off+8);
+ if(rrlen < dname_off + 10 + rdlen) return 0;
+ rdata = rr + dname_off + 10;
+ if(rdlen < 18) return 0;
+ return sldns_str_print(s, slen, " ;{id = %d}",
+ (int)sldns_read_uint16(rdata+16));
+}
+
+/** print rr comment for type NSEC3 */
+static int rr_comment_nsec3(char** s, size_t* slen, uint8_t* rr,
+ size_t rrlen, size_t dname_off)
+{
+ size_t rdlen;
+ uint8_t* rdata;
+ int w = 0;
+ if(rrlen < dname_off + 10) return 0;
+ rdlen = sldns_read_uint16(rr+dname_off+8);
+ if(rrlen < dname_off + 10 + rdlen) return 0;
+ rdata = rr + dname_off + 10;
+ if(rdlen < 2) return 0;
+ if((rdata[1] & LDNS_NSEC3_VARS_OPTOUT_MASK))
+ w += sldns_str_print(s, slen, " ;{flags: optout}");
+ return w;
+}
+
+int sldns_wire2str_rr_comment_print(char** s, size_t* slen, uint8_t* rr,
+ size_t rrlen, size_t dname_off, uint16_t rrtype)
+{
+ if(rrtype == LDNS_RR_TYPE_DNSKEY) {
+ return rr_comment_dnskey(s, slen, rr, rrlen, dname_off);
+ } else if(rrtype == LDNS_RR_TYPE_RRSIG) {
+ return rr_comment_rrsig(s, slen, rr, rrlen, dname_off);
+ } else if(rrtype == LDNS_RR_TYPE_NSEC3) {
+ return rr_comment_nsec3(s, slen, rr, rrlen, dname_off);
+ }
+ return 0;
+}
+
+int sldns_wire2str_header_scan(uint8_t** d, size_t* dlen, char** s,
+ size_t* slen)
+{
+ int w = 0;
+ int opcode, rcode;
+ w += sldns_str_print(s, slen, ";; ->>HEADER<<- ");
+ if(*dlen == 0)
+ return w+sldns_str_print(s, slen, "Error empty packet");
+ if(*dlen < 4)
+ return w+print_remainder_hex("Error header too short 0x", d, dlen, s, slen);
+ opcode = (int)LDNS_OPCODE_WIRE(*d);
+ rcode = (int)LDNS_RCODE_WIRE(*d);
+ w += sldns_str_print(s, slen, "opcode: ");
+ w += sldns_wire2str_opcode_print(s, slen, opcode);
+ w += sldns_str_print(s, slen, ", ");
+ w += sldns_str_print(s, slen, "rcode: ");
+ w += sldns_wire2str_rcode_print(s, slen, rcode);
+ w += sldns_str_print(s, slen, ", ");
+ w += sldns_str_print(s, slen, "id: %d\n", (int)LDNS_ID_WIRE(*d));
+ w += sldns_str_print(s, slen, ";; flags:");
+ if(LDNS_QR_WIRE(*d)) w += sldns_str_print(s, slen, " qr");
+ if(LDNS_AA_WIRE(*d)) w += sldns_str_print(s, slen, " aa");
+ if(LDNS_TC_WIRE(*d)) w += sldns_str_print(s, slen, " tc");
+ if(LDNS_RD_WIRE(*d)) w += sldns_str_print(s, slen, " rd");
+ if(LDNS_CD_WIRE(*d)) w += sldns_str_print(s, slen, " cd");
+ if(LDNS_RA_WIRE(*d)) w += sldns_str_print(s, slen, " ra");
+ if(LDNS_AD_WIRE(*d)) w += sldns_str_print(s, slen, " ad");
+ if(LDNS_Z_WIRE(*d)) w += sldns_str_print(s, slen, " z");
+ w += sldns_str_print(s, slen, " ; ");
+ if(*dlen < LDNS_HEADER_SIZE)
+ return w+print_remainder_hex("Error header too short 0x", d, dlen, s, slen);
+ w += sldns_str_print(s, slen, "QUERY: %d, ", (int)LDNS_QDCOUNT(*d));
+ w += sldns_str_print(s, slen, "ANSWER: %d, ", (int)LDNS_ANCOUNT(*d));
+ w += sldns_str_print(s, slen, "AUTHORITY: %d, ", (int)LDNS_NSCOUNT(*d));
+ w += sldns_str_print(s, slen, "ADDITIONAL: %d ", (int)LDNS_ARCOUNT(*d));
+ *d += LDNS_HEADER_SIZE;
+ *dlen -= LDNS_HEADER_SIZE;
+ return w;
+}
+
+int sldns_wire2str_rdata_scan(uint8_t** d, size_t* dlen, char** s,
+ size_t* slen, uint16_t rrtype, uint8_t* pkt, size_t pktlen)
+{
+ /* try to prettyprint, but if that fails, use unknown format */
+ uint8_t* origd = *d;
+ char* origs = *s;
+ size_t origdlen = *dlen, origslen = *slen;
+ uint16_t r_cnt, r_max;
+ sldns_rdf_type rdftype;
+ int w = 0, n;
+
+ const sldns_rr_descriptor *desc = sldns_rr_descript(rrtype);
+ if(!desc) /* unknown format */
+ return sldns_wire2str_rdata_unknown_scan(d, dlen, s, slen);
+ /* dlen equals the rdatalen for the rdata */
+
+ r_max = sldns_rr_descriptor_maximum(desc);
+ for(r_cnt=0; r_cnt < r_max; r_cnt++) {
+ if(*dlen == 0) {
+ if(r_cnt < sldns_rr_descriptor_minimum(desc))
+ goto failed;
+ break; /* nothing more to print */
+ }
+ rdftype = sldns_rr_descriptor_field_type(desc, r_cnt);
+ if(r_cnt != 0)
+ w += sldns_str_print(s, slen, " ");
+ n = sldns_wire2str_rdf_scan(d, dlen, s, slen, rdftype,
+ pkt, pktlen);
+ if(n == -1) {
+ failed:
+ /* failed, use unknown format */
+ *d = origd; *s = origs;
+ *dlen = origdlen; *slen = origslen;
+ return sldns_wire2str_rdata_unknown_scan(d, dlen,
+ s, slen);
+ }
+ w += n;
+ }
+ return w;
+}
+
+int sldns_wire2str_rdata_unknown_scan(uint8_t** d, size_t* dlen, char** s,
+ size_t* slen)
+{
+ int w = 0;
+
+ /* print length */
+ w += sldns_str_print(s, slen, "\\# %u", (unsigned)*dlen);
+
+ /* print rdlen in hex */
+ if(*dlen != 0)
+ w += sldns_str_print(s, slen, " ");
+ w += print_hex_buf(s, slen, *d, *dlen);
+ (*d) += *dlen;
+ (*dlen) = 0;
+ return w;
+}
+
+/** print and escape one character for a domain dname */
+static int dname_char_print(char** s, size_t* slen, uint8_t c)
+{
+ if(c == '.' || c == ';' || c == '(' || c == ')' || c == '\\')
+ return sldns_str_print(s, slen, "\\%c", c);
+ else if(!(isascii((unsigned char)c) && isgraph((unsigned char)c)))
+ return sldns_str_print(s, slen, "\\%03u", (unsigned)c);
+ /* plain printout */
+ if(*slen) {
+ **s = (char)c;
+ (*s)++;
+ (*slen)--;
+ }
+ return 1;
+}
+
+int sldns_wire2str_dname_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen,
+ uint8_t* pkt, size_t pktlen)
+{
+ int w = 0;
+ /* spool labels onto the string, use compression if its there */
+ uint8_t* pos = *d;
+ unsigned i, counter=0;
+ const unsigned maxcompr = 1000; /* loop detection, max compr ptrs */
+ int in_buf = 1;
+ if(*dlen == 0) return sldns_str_print(s, slen, "ErrorMissingDname");
+ if(*pos == 0) {
+ (*d)++;
+ (*dlen)--;
+ return sldns_str_print(s, slen, ".");
+ }
+ while(*pos) {
+ /* read label length */
+ uint8_t labellen = *pos++;
+ if(in_buf) { (*d)++; (*dlen)--; }
+
+ /* find out what sort of label we have */
+ if((labellen&0xc0) == 0xc0) {
+ /* compressed */
+ uint16_t target = 0;
+ if(in_buf && *dlen == 0)
+ return w + sldns_str_print(s, slen,
+ "ErrorPartialDname");
+ else if(!in_buf && pos+1 > pkt+pktlen)
+ return w + sldns_str_print(s, slen,
+ "ErrorPartialDname");
+ target = ((labellen&0x3f)<<8) | *pos;
+ if(in_buf) { (*d)++; (*dlen)--; }
+ /* move to target, if possible */
+ if(!pkt || target >= pktlen)
+ return w + sldns_str_print(s, slen,
+ "ErrorComprPtrOutOfBounds");
+ if(counter++ > maxcompr)
+ return w + sldns_str_print(s, slen,
+ "ErrorComprPtrLooped");
+ in_buf = 0;
+ pos = pkt+target;
+ continue;
+ } else if((labellen&0xc0)) {
+ /* notimpl label type */
+ w += sldns_str_print(s, slen,
+ "ErrorLABELTYPE%xIsUnknown",
+ (int)(labellen&0xc0));
+ return w;
+ }
+
+ /* spool label characters, end with '.' */
+ if(in_buf && *dlen < labellen) labellen = *dlen;
+ else if(!in_buf && pos+labellen > pkt+pktlen)
+ labellen = (uint8_t)(pkt + pktlen - pos);
+ for(i=0; i<(unsigned)labellen; i++) {
+ w += dname_char_print(s, slen, *pos++);
+ }
+ if(in_buf) {
+ (*d) += labellen;
+ (*dlen) -= labellen;
+ if(*dlen == 0) break;
+ }
+ w += sldns_str_print(s, slen, ".");
+ }
+ /* skip over final root label */
+ if(in_buf && *dlen > 0) { (*d)++; (*dlen)--; }
+ /* in case we printed no labels, terminate dname */
+ if(w == 0) w += sldns_str_print(s, slen, ".");
+ return w;
+}
+
+int sldns_wire2str_opcode_print(char** s, size_t* slen, int opcode)
+{
+ sldns_lookup_table *lt = sldns_lookup_by_id(sldns_opcodes, opcode);
+ if (lt && lt->name) {
+ return sldns_str_print(s, slen, "%s", lt->name);
+ }
+ return sldns_str_print(s, slen, "OPCODE%u", (unsigned)opcode);
+}
+
+int sldns_wire2str_rcode_print(char** s, size_t* slen, int rcode)
+{
+ sldns_lookup_table *lt = sldns_lookup_by_id(sldns_rcodes, rcode);
+ if (lt && lt->name) {
+ return sldns_str_print(s, slen, "%s", lt->name);
+ }
+ return sldns_str_print(s, slen, "RCODE%u", (unsigned)rcode);
+}
+
+int sldns_wire2str_class_print(char** s, size_t* slen, uint16_t rrclass)
+{
+ sldns_lookup_table *lt = sldns_lookup_by_id(sldns_rr_classes,
+ (int)rrclass);
+ if (lt && lt->name) {
+ return sldns_str_print(s, slen, "%s", lt->name);
+ }
+ return sldns_str_print(s, slen, "CLASS%u", (unsigned)rrclass);
+}
+
+int sldns_wire2str_type_print(char** s, size_t* slen, uint16_t rrtype)
+{
+ const sldns_rr_descriptor *descriptor = sldns_rr_descript(rrtype);
+ if (descriptor && descriptor->_name) {
+ return sldns_str_print(s, slen, "%s", descriptor->_name);
+ }
+ return sldns_str_print(s, slen, "TYPE%u", (unsigned)rrtype);
+}
+
+int sldns_wire2str_edns_option_code_print(char** s, size_t* slen,
+ uint16_t opcode)
+{
+ sldns_lookup_table *lt = sldns_lookup_by_id(sldns_edns_options,
+ (int)opcode);
+ if (lt && lt->name) {
+ return sldns_str_print(s, slen, "%s", lt->name);
+ }
+ return sldns_str_print(s, slen, "OPT%u", (unsigned)opcode);
+}
+
+int sldns_wire2str_class_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen)
+{
+ uint16_t c;
+ if(*dlen == 0) return 0;
+ if(*dlen < 2) return print_remainder_hex("Error malformed 0x", d, dlen, s, slen);
+ c = sldns_read_uint16(*d);
+ (*d)+=2;
+ (*dlen)-=2;
+ return sldns_wire2str_class_print(s, slen, c);
+}
+
+int sldns_wire2str_type_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen)
+{
+ uint16_t t;
+ if(*dlen == 0) return 0;
+ if(*dlen < 2) return print_remainder_hex("Error malformed 0x", d, dlen, s, slen);
+ t = sldns_read_uint16(*d);
+ (*d)+=2;
+ (*dlen)-=2;
+ return sldns_wire2str_type_print(s, slen, t);
+}
+
+int sldns_wire2str_ttl_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen)
+{
+ uint32_t ttl;
+ if(*dlen == 0) return 0;
+ if(*dlen < 4) return print_remainder_hex("Error malformed 0x", d, dlen, s, slen);
+ ttl = sldns_read_uint32(*d);
+ (*d)+=4;
+ (*dlen)-=4;
+ return sldns_str_print(s, slen, "%u", (unsigned)ttl);
+}
+
+int sldns_wire2str_rdf_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen,
+ int rdftype, uint8_t* pkt, size_t pktlen)
+{
+ if(*dlen == 0) return 0;
+ switch(rdftype) {
+ case LDNS_RDF_TYPE_NONE:
+ return 0;
+ case LDNS_RDF_TYPE_DNAME:
+ return sldns_wire2str_dname_scan(d, dlen, s, slen, pkt, pktlen);
+ case LDNS_RDF_TYPE_INT8:
+ return sldns_wire2str_int8_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_INT16:
+ return sldns_wire2str_int16_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_INT32:
+ return sldns_wire2str_int32_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_PERIOD:
+ return sldns_wire2str_period_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_TSIGTIME:
+ return sldns_wire2str_tsigtime_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_A:
+ return sldns_wire2str_a_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_AAAA:
+ return sldns_wire2str_aaaa_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_STR:
+ return sldns_wire2str_str_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_APL:
+ return sldns_wire2str_apl_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_B32_EXT:
+ return sldns_wire2str_b32_ext_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_B64:
+ return sldns_wire2str_b64_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_HEX:
+ return sldns_wire2str_hex_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_NSEC:
+ return sldns_wire2str_nsec_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_NSEC3_SALT:
+ return sldns_wire2str_nsec3_salt_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_TYPE:
+ return sldns_wire2str_type_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_CLASS:
+ return sldns_wire2str_class_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_CERT_ALG:
+ return sldns_wire2str_cert_alg_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_ALG:
+ return sldns_wire2str_alg_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_UNKNOWN:
+ return sldns_wire2str_unknown_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_TIME:
+ return sldns_wire2str_time_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_LOC:
+ return sldns_wire2str_loc_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_WKS:
+ case LDNS_RDF_TYPE_SERVICE:
+ return sldns_wire2str_wks_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_NSAP:
+ return sldns_wire2str_nsap_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_ATMA:
+ return sldns_wire2str_atma_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_IPSECKEY:
+ return sldns_wire2str_ipseckey_scan(d, dlen, s, slen, pkt,
+ pktlen);
+ case LDNS_RDF_TYPE_HIP:
+ return sldns_wire2str_hip_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_INT16_DATA:
+ return sldns_wire2str_int16_data_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER:
+ return sldns_wire2str_b32_ext_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_ILNP64:
+ return sldns_wire2str_ilnp64_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_EUI48:
+ return sldns_wire2str_eui48_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_EUI64:
+ return sldns_wire2str_eui64_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_TAG:
+ return sldns_wire2str_tag_scan(d, dlen, s, slen);
+ case LDNS_RDF_TYPE_LONG_STR:
+ return sldns_wire2str_long_str_scan(d, dlen, s, slen);
+ }
+ /* unknown rdf type */
+ return -1;
+}
+
+int sldns_wire2str_int8_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ int w;
+ if(*dl < 1) return -1;
+ w = sldns_str_print(s, sl, "%u", (unsigned)**d);
+ (*d)++;
+ (*dl)--;
+ return w;
+}
+
+int sldns_wire2str_int16_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ int w;
+ if(*dl < 2) return -1;
+ w = sldns_str_print(s, sl, "%lu", (unsigned long)sldns_read_uint16(*d));
+ (*d)+=2;
+ (*dl)-=2;
+ return w;
+}
+
+int sldns_wire2str_int32_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ int w;
+ if(*dl < 4) return -1;
+ w = sldns_str_print(s, sl, "%lu", (unsigned long)sldns_read_uint32(*d));
+ (*d)+=4;
+ (*dl)-=4;
+ return w;
+}
+
+int sldns_wire2str_period_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ int w;
+ if(*dl < 4) return -1;
+ w = sldns_str_print(s, sl, "%u", (unsigned)sldns_read_uint32(*d));
+ (*d)+=4;
+ (*dl)-=4;
+ return w;
+}
+
+int sldns_wire2str_tsigtime_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ /* tsigtime is 48 bits network order unsigned integer */
+ int w;
+ uint64_t tsigtime = 0;
+ uint64_t d0, d1, d2, d3, d4, d5;
+ if(*dl < 6) return -1;
+ d0 = (*d)[0]; /* cast to uint64 for shift operations */
+ d1 = (*d)[1];
+ d2 = (*d)[2];
+ d3 = (*d)[3];
+ d4 = (*d)[4];
+ d5 = (*d)[5];
+ tsigtime = (d0<<40) | (d1<<32) | (d2<<24) | (d3<<16) | (d4<<8) | d5;
+#ifndef USE_WINSOCK
+ w = sldns_str_print(s, sl, "%llu", (long long)tsigtime);
+#else
+ w = sldns_str_print(s, sl, "%I64u", (long long)tsigtime);
+#endif
+ (*d)+=6;
+ (*dl)-=6;
+ return w;
+}
+
+int sldns_wire2str_a_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ char buf[32];
+ int w;
+ if(*dl < 4) return -1;
+ if(!inet_ntop(AF_INET, *d, buf, (socklen_t)sizeof(buf)))
+ return -1;
+ w = sldns_str_print(s, sl, "%s", buf);
+ (*d)+=4;
+ (*dl)-=4;
+ return w;
+}
+
+int sldns_wire2str_aaaa_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+#ifdef AF_INET6
+ char buf[64];
+ int w;
+ if(*dl < 16) return -1;
+ if(!inet_ntop(AF_INET6, *d, buf, (socklen_t)sizeof(buf)))
+ return -1;
+ w = sldns_str_print(s, sl, "%s", buf);
+ (*d)+=16;
+ (*dl)-=16;
+ return w;
+#else
+ return -1;
+#endif
+}
+
+/** printout escaped TYPE_STR character */
+static int str_char_print(char** s, size_t* sl, uint8_t c)
+{
+ if(isprint((unsigned char)c) || c == '\t') {
+ if(c == '\"' || c == '\\')
+ return sldns_str_print(s, sl, "\\%c", c);
+ if(*sl) {
+ **s = (char)c;
+ (*s)++;
+ (*sl)--;
+ }
+ return 1;
+ }
+ return sldns_str_print(s, sl, "\\%03u", (unsigned)c);
+}
+
+int sldns_wire2str_str_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ int w = 0;
+ size_t i, len;
+ if(*dl < 1) return -1;
+ len = **d;
+ if(*dl < 1+len) return -1;
+ (*d)++;
+ (*dl)--;
+ w += sldns_str_print(s, sl, "\"");
+ for(i=0; i<len; i++)
+ w += str_char_print(s, sl, (*d)[i]);
+ w += sldns_str_print(s, sl, "\"");
+ (*d)+=len;
+ (*dl)-=len;
+ return w;
+}
+
+int sldns_wire2str_apl_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ int i, w = 0;
+ uint16_t family;
+ uint8_t negation, prefix, adflength;
+ if(*dl < 4) return -1;
+ family = sldns_read_uint16(*d);
+ prefix = (*d)[2];
+ negation = ((*d)[3] & LDNS_APL_NEGATION);
+ adflength = ((*d)[3] & LDNS_APL_MASK);
+ if(*dl < 4+(size_t)adflength) return -1;
+ if(family != LDNS_APL_IP4 && family != LDNS_APL_IP6)
+ return -1; /* unknown address family */
+ if(negation)
+ w += sldns_str_print(s, sl, "!");
+ w += sldns_str_print(s, sl, "%u:", (unsigned)family);
+ if(family == LDNS_APL_IP4) {
+ /* check if prefix <32 ? */
+ /* address is variable length 0 - 4 */
+ for(i=0; i<4; i++) {
+ if(i > 0)
+ w += sldns_str_print(s, sl, ".");
+ if(i < (int)adflength)
+ w += sldns_str_print(s, sl, "%d", (*d)[4+i]);
+ else w += sldns_str_print(s, sl, "0");
+ }
+ } else if(family == LDNS_APL_IP6) {
+ /* check if prefix <128 ? */
+ /* address is variable length 0 - 16 */
+ for(i=0; i<16; i++) {
+ if(i%2 == 0 && i>0)
+ w += sldns_str_print(s, sl, ":");
+ if(i < (int)adflength)
+ w += sldns_str_print(s, sl, "%02x", (*d)[4+i]);
+ else w += sldns_str_print(s, sl, "00");
+ }
+ }
+ w += sldns_str_print(s, sl, "/%u", (unsigned)prefix);
+ (*d) += 4+adflength;
+ (*dl) -= 4+adflength;
+ return w;
+}
+
+int sldns_wire2str_b32_ext_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ size_t datalen;
+ size_t sz;
+ if(*dl < 1) return -1;
+ datalen = (*d)[0];
+ if(*dl < 1+datalen) return -1;
+ sz = sldns_b32_ntop_calculate_size(datalen);
+ if(*sl < sz+1) {
+ (*d) += datalen+1;
+ (*dl) -= (datalen+1);
+ return (int)sz; /* out of space really, but would need buffer
+ in order to truncate the output */
+ }
+ sldns_b32_ntop_extended_hex((*d)+1, datalen, *s, *sl);
+ (*d) += datalen+1;
+ (*dl) -= (datalen+1);
+ (*s) += sz;
+ (*sl) -= sz;
+ return (int)sz;
+}
+
+/** scan number of bytes from wire into b64 presentation format */
+static int sldns_wire2str_b64_scan_num(uint8_t** d, size_t* dl, char** s,
+ size_t* sl, size_t num)
+{
+ /* b64_ntop_calculate size includes null at the end */
+ size_t sz = sldns_b64_ntop_calculate_size(num)-1;
+ if(*sl < sz+1) {
+ (*d) += num;
+ (*dl) -= num;
+ return (int)sz; /* out of space really, but would need buffer
+ in order to truncate the output */
+ }
+ sldns_b64_ntop(*d, num, *s, *sl);
+ (*d) += num;
+ (*dl) -= num;
+ (*s) += sz;
+ (*sl) -= sz;
+ return (int)sz;
+}
+
+int sldns_wire2str_b64_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ return sldns_wire2str_b64_scan_num(d, dl, s, sl, *dl);
+}
+
+int sldns_wire2str_hex_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ return print_remainder_hex("", d, dl, s, sl);
+}
+
+int sldns_wire2str_nsec_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ uint8_t* p = *d;
+ size_t pl = *dl;
+ unsigned i, bit, window, block_len;
+ uint16_t t;
+ int w = 0;
+
+ /* check for errors */
+ while(pl) {
+ if(pl < 2) return -1;
+ block_len = (unsigned)p[1];
+ if(pl < 2+block_len) return -1;
+ p += block_len+2;
+ pl -= block_len+2;
+ }
+
+ /* do it */
+ p = *d;
+ pl = *dl;
+ while(pl) {
+ if(pl < 2) return -1; /* cannot happen */
+ window = (unsigned)p[0];
+ block_len = (unsigned)p[1];
+ if(pl < 2+block_len) return -1; /* cannot happen */
+ p += 2;
+ for(i=0; i<block_len; i++) {
+ if(p[i] == 0) continue;
+ /* base type number for this octet */
+ t = ((window)<<8) | (i << 3);
+ for(bit=0; bit<8; bit++) {
+ if((p[i]&(0x80>>bit))) {
+ if(w) w += sldns_str_print(s, sl, " ");
+ w += sldns_wire2str_type_print(s, sl,
+ t+bit);
+ }
+ }
+ }
+ p += block_len;
+ pl -= block_len+2;
+ }
+ (*d) += *dl;
+ (*dl) = 0;
+ return w;
+}
+
+int sldns_wire2str_nsec3_salt_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ size_t salt_len;
+ int w;
+ if(*dl < 1) return -1;
+ salt_len = (size_t)(*d)[0];
+ if(*dl < 1+salt_len) return -1;
+ (*d)++;
+ (*dl)--;
+ if(salt_len == 0) {
+ return sldns_str_print(s, sl, "-");
+ }
+ w = print_hex_buf(s, sl, *d, salt_len);
+ (*dl)-=salt_len;
+ (*d)+=salt_len;
+ return w;
+}
+
+int sldns_wire2str_cert_alg_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ sldns_lookup_table *lt;
+ int data, w;
+ if(*dl < 2) return -1;
+ data = (int)sldns_read_uint16(*d);
+ lt = sldns_lookup_by_id(sldns_cert_algorithms, data);
+ if(lt && lt->name)
+ w = sldns_str_print(s, sl, "%s", lt->name);
+ else w = sldns_str_print(s, sl, "%d", data);
+ (*dl)-=2;
+ (*d)+=2;
+ return w;
+}
+
+int sldns_wire2str_alg_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ /* don't use algorithm mnemonics in the presentation format
+ * this kind of got sneaked into the rfc's */
+ return sldns_wire2str_int8_scan(d, dl, s, sl);
+}
+
+int sldns_wire2str_unknown_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ return sldns_wire2str_rdata_unknown_scan(d, dl, s, sl);
+}
+
+int sldns_wire2str_time_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ /* create a YYYYMMDDHHMMSS string if possible */
+ struct tm tm;
+ char date_buf[16];
+ uint32_t t;
+ memset(&tm, 0, sizeof(tm));
+ if(*dl < 4) return -1;
+ t = sldns_read_uint32(*d);
+ date_buf[15]=0;
+ if(sldns_serial_arithmitics_gmtime_r(t, time(NULL), &tm) &&
+ strftime(date_buf, 15, "%Y%m%d%H%M%S", &tm)) {
+ (*d) += 4;
+ (*dl) -= 4;
+ return sldns_str_print(s, sl, "%s", date_buf);
+ }
+ return -1;
+}
+
+static int
+loc_cm_print(char** str, size_t* sl, uint8_t mantissa, uint8_t exponent)
+{
+ int w = 0;
+ uint8_t i;
+ /* is it 0.<two digits> ? */
+ if(exponent < 2) {
+ if(exponent == 1)
+ mantissa *= 10;
+ return sldns_str_print(str, sl, "0.%02ld", (long)mantissa);
+ }
+ /* always <digit><string of zeros> */
+ w += sldns_str_print(str, sl, "%d", (int)mantissa);
+ for(i=0; i<exponent-2; i++)
+ w += sldns_str_print(str, sl, "0");
+ return w;
+}
+
+int sldns_wire2str_loc_scan(uint8_t** d, size_t* dl, char** str, size_t* sl)
+{
+ /* we could do checking (ie degrees < 90 etc)? */
+ uint8_t version;
+ uint8_t size;
+ uint8_t horizontal_precision;
+ uint8_t vertical_precision;
+ uint32_t longitude;
+ uint32_t latitude;
+ uint32_t altitude;
+ char northerness;
+ char easterness;
+ uint32_t h;
+ uint32_t m;
+ double s;
+ uint32_t equator = (uint32_t)1 << 31; /* 2**31 */
+ int w = 0;
+
+ if(*dl < 16) return -1;
+ version = (*d)[0];
+ if(version != 0)
+ return sldns_wire2str_hex_scan(d, dl, str, sl);
+ size = (*d)[1];
+ horizontal_precision = (*d)[2];
+ vertical_precision = (*d)[3];
+
+ latitude = sldns_read_uint32((*d)+4);
+ longitude = sldns_read_uint32((*d)+8);
+ altitude = sldns_read_uint32((*d)+12);
+
+ if (latitude > equator) {
+ northerness = 'N';
+ latitude = latitude - equator;
+ } else {
+ northerness = 'S';
+ latitude = equator - latitude;
+ }
+ h = latitude / (1000 * 60 * 60);
+ latitude = latitude % (1000 * 60 * 60);
+ m = latitude / (1000 * 60);
+ latitude = latitude % (1000 * 60);
+ s = (double) latitude / 1000.0;
+ w += sldns_str_print(str, sl, "%02u %02u %06.3f %c ",
+ h, m, s, northerness);
+
+ if (longitude > equator) {
+ easterness = 'E';
+ longitude = longitude - equator;
+ } else {
+ easterness = 'W';
+ longitude = equator - longitude;
+ }
+ h = longitude / (1000 * 60 * 60);
+ longitude = longitude % (1000 * 60 * 60);
+ m = longitude / (1000 * 60);
+ longitude = longitude % (1000 * 60);
+ s = (double) longitude / (1000.0);
+ w += sldns_str_print(str, sl, "%02u %02u %06.3f %c ",
+ h, m, s, easterness);
+
+ s = ((double) altitude) / 100;
+ s -= 100000;
+
+ if(altitude%100 != 0)
+ w += sldns_str_print(str, sl, "%.2f", s);
+ else
+ w += sldns_str_print(str, sl, "%.0f", s);
+
+ w += sldns_str_print(str, sl, "m ");
+
+ w += loc_cm_print(str, sl, (size & 0xf0) >> 4, size & 0x0f);
+ w += sldns_str_print(str, sl, "m ");
+
+ w += loc_cm_print(str, sl, (horizontal_precision & 0xf0) >> 4,
+ horizontal_precision & 0x0f);
+ w += sldns_str_print(str, sl, "m ");
+
+ w += loc_cm_print(str, sl, (vertical_precision & 0xf0) >> 4,
+ vertical_precision & 0x0f);
+ w += sldns_str_print(str, sl, "m");
+
+ (*d)+=16;
+ (*dl)-=16;
+ return w;
+}
+
+int sldns_wire2str_wks_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ /* protocol, followed by bitmap of services */
+ const char* proto_name = NULL;
+ struct protoent *protocol;
+ struct servent *service;
+ uint8_t protocol_nr;
+ int bit, port, w = 0;
+ size_t i;
+ /* we cannot print with strings because they
+ * are not portable, the presentation format may
+ * not be able to be read in on another computer. */
+ int print_symbols = 0;
+
+ /* protocol */
+ if(*dl < 1) return -1;
+ protocol_nr = (*d)[0];
+ (*d)++;
+ (*dl)--;
+ protocol = getprotobynumber((int)protocol_nr);
+ if(protocol && (protocol->p_name != NULL)) {
+ w += sldns_str_print(s, sl, "%s", protocol->p_name);
+ proto_name = protocol->p_name;
+ } else {
+ w += sldns_str_print(s, sl, "%u", (unsigned)protocol_nr);
+ }
+
+ for(i=0; i<*dl; i++) {
+ if((*d)[i] == 0)
+ continue;
+ for(bit=0; bit<8; bit++) {
+ if(!(((*d)[i])&(0x80>>bit)))
+ continue;
+ port = (int)i*8 + bit;
+
+ if(!print_symbols)
+ service = NULL;
+ else
+ service = getservbyport(
+ (int)htons((uint16_t)port), proto_name);
+ if(service && service->s_name)
+ w += sldns_str_print(s, sl, " %s",
+ service->s_name);
+ else w += sldns_str_print(s, sl, " %u",
+ (unsigned)port);
+ }
+ }
+
+#ifdef HAVE_ENDSERVENT
+ endservent();
+#endif
+#ifdef HAVE_ENDPROTOENT
+ endprotoent();
+#endif
+ (*d) += *dl;
+ (*dl) = 0;
+ return w;
+}
+
+int sldns_wire2str_nsap_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ return print_remainder_hex("0x", d, dl, s, sl);
+}
+
+int sldns_wire2str_atma_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ return print_remainder_hex("", d, dl, s, sl);
+}
+
+/* internal scan routine that can modify arguments on failure */
+static int sldns_wire2str_ipseckey_scan_internal(uint8_t** d, size_t* dl,
+ char** s, size_t* sl, uint8_t* pkt, size_t pktlen)
+{
+ /* http://www.ietf.org/internet-drafts/draft-ietf-ipseckey-rr-12.txt*/
+ uint8_t precedence, gateway_type, algorithm;
+ int w = 0;
+
+ if(*dl < 3) return -1;
+ precedence = (*d)[0];
+ gateway_type = (*d)[1];
+ algorithm = (*d)[2];
+ if(gateway_type > 3)
+ return -1; /* unknown */
+ (*d)+=3;
+ (*dl)-=3;
+ w += sldns_str_print(s, sl, "%d %d %d ",
+ (int)precedence, (int)gateway_type, (int)algorithm);
+
+ switch(gateway_type) {
+ case 0: /* no gateway */
+ w += sldns_str_print(s, sl, ".");
+ break;
+ case 1: /* ip4 */
+ w += sldns_wire2str_a_scan(d, dl, s, sl);
+ break;
+ case 2: /* ip6 */
+ w += sldns_wire2str_aaaa_scan(d, dl, s, sl);
+ break;
+ case 3: /* dname */
+ w += sldns_wire2str_dname_scan(d, dl, s, sl, pkt, pktlen);
+ break;
+ default: /* unknown */
+ return -1;
+ }
+
+ if(*dl < 1)
+ return -1;
+ w += sldns_str_print(s, sl, " ");
+ w += sldns_wire2str_b64_scan_num(d, dl, s, sl, *dl);
+ return w;
+}
+
+int sldns_wire2str_ipseckey_scan(uint8_t** d, size_t* dl, char** s, size_t* sl,
+ uint8_t* pkt, size_t pktlen)
+{
+ uint8_t* od = *d;
+ char* os = *s;
+ size_t odl = *dl, osl = *sl;
+ int w=sldns_wire2str_ipseckey_scan_internal(d, dl, s, sl, pkt, pktlen);
+ if(w == -1) {
+ *d = od;
+ *s = os;
+ *dl = odl;
+ *sl = osl;
+ return -1;
+ }
+ return w;
+}
+
+int sldns_wire2str_hip_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ int w;
+ uint8_t algo, hitlen;
+ uint16_t pklen;
+
+ /* read lengths */
+ if(*dl < 4)
+ return -1;
+ hitlen = (*d)[0];
+ algo = (*d)[1];
+ pklen = sldns_read_uint16((*d)+2);
+ if(*dl < (size_t)4 + (size_t)hitlen + (size_t)pklen)
+ return -1;
+
+ /* write: algo hit pubkey */
+ w = sldns_str_print(s, sl, "%u ", (unsigned)algo);
+ w += print_hex_buf(s, sl, (*d)+4, hitlen);
+ w += sldns_str_print(s, sl, " ");
+ (*d)+=4+hitlen;
+ (*dl)-= (4+hitlen);
+ w += sldns_wire2str_b64_scan_num(d, dl, s, sl, pklen);
+ return w;
+}
+
+int sldns_wire2str_int16_data_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ uint16_t n;
+ if(*dl < 2)
+ return -1;
+ n = sldns_read_uint16(*d);
+ if(*dl < 2+(size_t)n)
+ return -1;
+ (*d)+=2;
+ (*dl)-=2;
+ return sldns_wire2str_b64_scan_num(d, dl, s, sl, n);
+}
+
+int sldns_wire2str_nsec3_next_owner_scan(uint8_t** d, size_t* dl, char** s,
+ size_t* sl)
+{
+ return sldns_wire2str_b32_ext_scan(d, dl, s, sl);
+}
+
+int sldns_wire2str_ilnp64_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ int w;
+ if(*dl < 8)
+ return -1;
+ w = sldns_str_print(s, sl, "%.4x:%.4x:%.4x:%.4x",
+ sldns_read_uint16(*d), sldns_read_uint16((*d)+2),
+ sldns_read_uint16((*d)+4), sldns_read_uint16((*d)+6));
+ (*d)+=8;
+ (*dl)-=8;
+ return w;
+}
+
+int sldns_wire2str_eui48_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ int w;
+ if(*dl < 6)
+ return -1;
+ w = sldns_str_print(s, sl, "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",
+ (*d)[0], (*d)[1], (*d)[2], (*d)[3], (*d)[4], (*d)[5]);
+ (*d)+=6;
+ (*dl)-=6;
+ return w;
+}
+
+int sldns_wire2str_eui64_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ int w;
+ if(*dl < 8)
+ return -1;
+ w = sldns_str_print(s, sl, "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",
+ (*d)[0], (*d)[1], (*d)[2], (*d)[3], (*d)[4], (*d)[5],
+ (*d)[6], (*d)[7]);
+ (*d)+=8;
+ (*dl)-=8;
+ return w;
+}
+
+int sldns_wire2str_tag_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ size_t i, n;
+ int w = 0;
+ if(*dl < 1)
+ return -1;
+ n = (size_t)((*d)[0]);
+ if(*dl < 1+n)
+ return -1;
+ for(i=0; i<n; i++)
+ if(!isalnum((unsigned char)(*d)[i]))
+ return -1;
+ for(i=0; i<n; i++)
+ w += sldns_str_print(s, sl, "%c", (char)(*d)[i]);
+ (*d)+=n+1;
+ (*dl)-=(n+1);
+ return w;
+}
+
+int sldns_wire2str_long_str_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
+{
+ size_t i;
+ int w = 0;
+ w += sldns_str_print(s, sl, "\"");
+ for(i=0; i<*dl; i++)
+ w += str_char_print(s, sl, (*d)[i]);
+ w += sldns_str_print(s, sl, "\"");
+ (*d)+=*dl;
+ (*dl)=0;
+ return w;
+}
+
+int sldns_wire2str_edns_llq_print(char** s, size_t* sl, uint8_t* data,
+ size_t len)
+{
+ /* LLQ constants */
+ const char* llq_errors[] = {"NO-ERROR", "SERV-FULL", "STATIC",
+ "FORMAT-ERR", "NO-SUCH-LLQ", "BAD-VERS", "UNKNOWN_ERR"};
+ const unsigned int llq_errors_num = 7;
+ const char* llq_opcodes[] = {"LLQ-SETUP", "LLQ-REFRESH", "LLQ-EVENT"};
+ const unsigned int llq_opcodes_num = 3;
+ uint16_t version, llq_opcode, error_code;
+ uint64_t llq_id;
+ uint32_t lease_life; /* Requested or granted life of LLQ, in seconds */
+ int w = 0;
+
+ /* read the record */
+ if(len != 18) {
+ w += sldns_str_print(s, sl, "malformed LLQ ");
+ w += print_hex_buf(s, sl, data, len);
+ return w;
+ }
+ version = sldns_read_uint16(data);
+ llq_opcode = sldns_read_uint16(data+2);
+ error_code = sldns_read_uint16(data+4);
+ memmove(&llq_id, data+6, sizeof(llq_id));
+ lease_life = sldns_read_uint32(data+14);
+
+ /* print it */
+ w += sldns_str_print(s, sl, "v%d ", (int)version);
+ if(llq_opcode < llq_opcodes_num)
+ w += sldns_str_print(s, sl, "%s", llq_opcodes[llq_opcode]);
+ else w += sldns_str_print(s, sl, "opcode %d", (int)llq_opcode);
+ if(error_code < llq_errors_num)
+ w += sldns_str_print(s, sl, " %s", llq_errors[error_code]);
+ else w += sldns_str_print(s, sl, " error %d", (int)error_code);
+#ifndef USE_WINSOCK
+ w += sldns_str_print(s, sl, " id %llx lease-life %lu",
+ (unsigned long long)llq_id, (unsigned long)lease_life);
+#else
+ w += sldns_str_print(s, sl, " id %I64x lease-life %lu",
+ (unsigned long long)llq_id, (unsigned long)lease_life);
+#endif
+ return w;
+}
+
+int sldns_wire2str_edns_ul_print(char** s, size_t* sl, uint8_t* data,
+ size_t len)
+{
+ uint32_t lease;
+ int w = 0;
+ if(len != 4) {
+ w += sldns_str_print(s, sl, "malformed UL ");
+ w += print_hex_buf(s, sl, data, len);
+ return w;
+ }
+ lease = sldns_read_uint32(data);
+ w += sldns_str_print(s, sl, "lease %lu", (unsigned long)lease);
+ return w;
+}
+
+int sldns_wire2str_edns_nsid_print(char** s, size_t* sl, uint8_t* data,
+ size_t len)
+{
+ int w = 0;
+ size_t i, printed=0;
+ w += print_hex_buf(s, sl, data, len);
+ for(i=0; i<len; i++) {
+ if(isprint((unsigned char)data[i]) || data[i] == '\t') {
+ if(!printed) {
+ w += sldns_str_print(s, sl, " (");
+ printed = 1;
+ }
+ w += sldns_str_print(s, sl, "%c", (char)data[i]);
+ }
+ }
+ if(printed)
+ w += sldns_str_print(s, sl, ")");
+ return w;
+}
+
+int sldns_wire2str_edns_dau_print(char** s, size_t* sl, uint8_t* data,
+ size_t len)
+{
+ sldns_lookup_table *lt;
+ size_t i;
+ int w = 0;
+ for(i=0; i<len; i++) {
+ lt = sldns_lookup_by_id(sldns_algorithms, (int)data[i]);
+ if(lt && lt->name)
+ w += sldns_str_print(s, sl, " %s", lt->name);
+ else w += sldns_str_print(s, sl, " %d", (int)data[i]);
+ }
+ return w;
+}
+
+int sldns_wire2str_edns_dhu_print(char** s, size_t* sl, uint8_t* data,
+ size_t len)
+{
+ sldns_lookup_table *lt;
+ size_t i;
+ int w = 0;
+ for(i=0; i<len; i++) {
+ lt = sldns_lookup_by_id(sldns_hashes, (int)data[i]);
+ if(lt && lt->name)
+ w += sldns_str_print(s, sl, " %s", lt->name);
+ else w += sldns_str_print(s, sl, " %d", (int)data[i]);
+ }
+ return w;
+}
+
+int sldns_wire2str_edns_n3u_print(char** s, size_t* sl, uint8_t* data,
+ size_t len)
+{
+ size_t i;
+ int w = 0;
+ for(i=0; i<len; i++) {
+ if(data[i] == 1)
+ w += sldns_str_print(s, sl, " SHA1");
+ else w += sldns_str_print(s, sl, " %d", (int)data[i]);
+ }
+ return w;
+}
+
+int sldns_wire2str_edns_subnet_print(char** s, size_t* sl, uint8_t* data,
+ size_t len)
+{
+ int w = 0;
+ uint16_t family;
+ uint8_t source, scope;
+ if(len < 4) {
+ w += sldns_str_print(s, sl, "malformed subnet ");
+ w += print_hex_buf(s, sl, data, len);
+ return w;
+ }
+ family = sldns_read_uint16(data);
+ source = data[2];
+ scope = data[3];
+ if(family == 1) {
+ /* IP4 */
+ char buf[64];
+ uint8_t ip4[4];
+ memset(ip4, 0, sizeof(ip4));
+ if(len-4 > 4) {
+ w += sldns_str_print(s, sl, "trailingdata:");
+ w += print_hex_buf(s, sl, data+4+4, len-4-4);
+ w += sldns_str_print(s, sl, " ");
+ len = 4+4;
+ }
+ memmove(ip4, data+4, len-4);
+ if(!inet_ntop(AF_INET, ip4, buf, (socklen_t)sizeof(buf))) {
+ w += sldns_str_print(s, sl, "ip4ntoperror ");
+ w += print_hex_buf(s, sl, data+4+4, len-4-4);
+ } else {
+ w += sldns_str_print(s, sl, "%s", buf);
+ }
+ } else if(family == 2) {
+ /* IP6 */
+ char buf[64];
+ uint8_t ip6[16];
+ memset(ip6, 0, sizeof(ip6));
+ if(len-4 > 16) {
+ w += sldns_str_print(s, sl, "trailingdata:");
+ w += print_hex_buf(s, sl, data+4+16, len-4-16);
+ w += sldns_str_print(s, sl, " ");
+ len = 4+16;
+ }
+ memmove(ip6, data+4, len-4);
+#ifdef AF_INET6
+ if(!inet_ntop(AF_INET6, ip6, buf, (socklen_t)sizeof(buf))) {
+ w += sldns_str_print(s, sl, "ip6ntoperror ");
+ w += print_hex_buf(s, sl, data+4+4, len-4-4);
+ } else {
+ w += sldns_str_print(s, sl, "%s", buf);
+ }
+#else
+ w += print_hex_buf(s, sl, data+4+4, len-4-4);
+#endif
+ } else {
+ /* unknown */
+ w += sldns_str_print(s, sl, "family %d ",
+ (int)family);
+ w += print_hex_buf(s, sl, data, len);
+ }
+ w += sldns_str_print(s, sl, "/%d scope /%d", (int)source, (int)scope);
+ return w;
+}
+
+int sldns_wire2str_edns_option_print(char** s, size_t* sl,
+ uint16_t option_code, uint8_t* optdata, size_t optlen)
+{
+ int w = 0;
+ w += sldns_wire2str_edns_option_code_print(s, sl, option_code);
+ w += sldns_str_print(s, sl, ": ");
+ switch(option_code) {
+ case LDNS_EDNS_LLQ:
+ w += sldns_wire2str_edns_llq_print(s, sl, optdata, optlen);
+ break;
+ case LDNS_EDNS_UL:
+ w += sldns_wire2str_edns_ul_print(s, sl, optdata, optlen);
+ break;
+ case LDNS_EDNS_NSID:
+ w += sldns_wire2str_edns_nsid_print(s, sl, optdata, optlen);
+ break;
+ case LDNS_EDNS_DAU:
+ w += sldns_wire2str_edns_dau_print(s, sl, optdata, optlen);
+ break;
+ case LDNS_EDNS_DHU:
+ w += sldns_wire2str_edns_dhu_print(s, sl, optdata, optlen);
+ break;
+ case LDNS_EDNS_N3U:
+ w += sldns_wire2str_edns_n3u_print(s, sl, optdata, optlen);
+ break;
+ case LDNS_EDNS_CLIENT_SUBNET:
+ w += sldns_wire2str_edns_subnet_print(s, sl, optdata, optlen);
+ break;
+ default:
+ /* unknown option code */
+ w += print_hex_buf(s, sl, optdata, optlen);
+ break;
+ }
+ return w;
+}
+
+/** print the edns options to string */
+static int
+print_edns_opts(char** s, size_t* sl, uint8_t* rdata, size_t rdatalen)
+{
+ uint16_t option_code, option_len;
+ int w = 0;
+ while(rdatalen > 0) {
+ /* option name */
+ if(rdatalen < 4) {
+ w += sldns_str_print(s, sl, " ; malformed: ");
+ w += print_hex_buf(s, sl, rdata, rdatalen);
+ return w;
+ }
+ option_code = sldns_read_uint16(rdata);
+ option_len = sldns_read_uint16(rdata+2);
+ rdata += 4;
+ rdatalen -= 4;
+
+ /* option value */
+ if(rdatalen < (size_t)option_len) {
+ w += sldns_str_print(s, sl, " ; malformed ");
+ w += sldns_wire2str_edns_option_code_print(s, sl,
+ option_code);
+ w += sldns_str_print(s, sl, ": ");
+ w += print_hex_buf(s, sl, rdata, rdatalen);
+ return w;
+ }
+ w += sldns_str_print(s, sl, " ; ");
+ w += sldns_wire2str_edns_option_print(s, sl, option_code,
+ rdata, option_len);
+ rdata += option_len;
+ rdatalen -= option_len;
+ }
+ return w;
+}
+
+int sldns_wire2str_edns_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len, uint8_t* pkt, size_t pktlen)
+{
+ int w = 0;
+ uint8_t ext_rcode, edns_version;
+ uint16_t udpsize, edns_bits, rdatalen;
+ w += sldns_str_print(str, str_len, "; EDNS:");
+
+ /* some input checks, domain name */
+ if(*data_len < 1+10)
+ return w + print_remainder_hex("Error malformed 0x",
+ data, data_len, str, str_len);
+ if(*data[0] != 0) {
+ return w + print_remainder_hex("Error nonrootdname 0x",
+ data, data_len, str, str_len);
+ }
+ (*data)++;
+ (*data_len)--;
+
+ /* check type and read fixed contents */
+ if(sldns_read_uint16((*data)) != LDNS_RR_TYPE_OPT) {
+ return w + print_remainder_hex("Error nottypeOPT 0x",
+ data, data_len, str, str_len);
+ }
+ udpsize = sldns_read_uint16((*data)+2);
+ ext_rcode = (*data)[4];
+ edns_version = (*data)[5];
+ edns_bits = sldns_read_uint16((*data)+6);
+ rdatalen = sldns_read_uint16((*data)+8);
+ (*data)+=10;
+ (*data_len)-=10;
+
+ w += sldns_str_print(str, str_len, " version: %u;",
+ (unsigned)edns_version);
+ w += sldns_str_print(str, str_len, " flags:");
+ if((edns_bits & LDNS_EDNS_MASK_DO_BIT))
+ w += sldns_str_print(str, str_len, " do");
+ /* the extended rcode is the value set, shifted four bits,
+ * and or'd with the original rcode */
+ if(ext_rcode) {
+ int rc = ((int)ext_rcode)<<4;
+ if(pkt && pktlen >= LDNS_HEADER_SIZE)
+ rc |= LDNS_RCODE_WIRE(pkt);
+ w += sldns_str_print(str, str_len, " ; ext-rcode: %d", rc);
+ }
+ w += sldns_str_print(str, str_len, " ; udp: %u", (unsigned)udpsize);
+
+ if(rdatalen) {
+ if(*data_len < rdatalen) {
+ w += sldns_str_print(str, str_len,
+ " ; Error EDNS rdata too short; ");
+ rdatalen = *data_len;
+ }
+ w += print_edns_opts(str, str_len, *data, rdatalen);
+ (*data) += rdatalen;
+ (*data_len) -= rdatalen;
+ }
+ w += sldns_str_print(str, str_len, "\n");
+ return w;
+}
--- /dev/null
+/**
+ * wire2str.h - txt presentation of RRs
+ *
+ * (c) NLnet Labs, 2005-2006
+ *
+ * See the file LICENSE for the license
+ */
+
+/**
+ * \file
+ *
+ * Contains functions to translate the wireformat to text
+ * representation, as well as functions to print them.
+ */
+
+#ifndef LDNS_WIRE2STR_H
+#define LDNS_WIRE2STR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+struct sldns_struct_lookup_table;
+
+/* lookup tables for standard DNS stuff */
+/** Taken from RFC 2535, section 7. */
+extern struct sldns_struct_lookup_table* sldns_algorithms;
+/** DS record hash algorithms */
+extern struct sldns_struct_lookup_table* sldns_hashes;
+/** Taken from RFC 2538, section 2.1. */
+extern struct sldns_struct_lookup_table* sldns_cert_algorithms;
+/** Response codes */
+extern struct sldns_struct_lookup_table* sldns_rcodes;
+/** Operation codes */
+extern struct sldns_struct_lookup_table* sldns_opcodes;
+/** EDNS flags */
+extern struct sldns_struct_lookup_table* sldns_edns_flags;
+/** EDNS option codes */
+extern struct sldns_struct_lookup_table* sldns_edns_options;
+/** error string from wireparse */
+extern struct sldns_struct_lookup_table* sldns_wireparse_errors;
+
+/**
+ * Convert wireformat packet to a string representation
+ * @param data: wireformat packet data (starting at ID bytes).
+ * @param len: length of packet.
+ * @return string(malloced) or NULL on failure.
+ */
+char* sldns_wire2str_pkt(uint8_t* data, size_t len);
+
+/**
+ * Convert wireformat RR to a string representation.
+ * @param rr: the wireformat RR, in uncompressed form. Starts at the domain
+ * name start, ends with the rdata of the RR.
+ * @param len: length of the rr wireformat.
+ * @return string(malloced) or NULL on failure.
+ */
+char* sldns_wire2str_rr(uint8_t* rr, size_t len);
+
+/**
+ * Conver wire dname to a string.
+ * @param dname: the dname in uncompressed wireformat.
+ * @param dname_len: length of the dname.
+ * @return string or NULL on failure.
+ */
+char* sldns_wire2str_dname(uint8_t* dname, size_t dname_len);
+
+/**
+ * Convert wire RR type to a string, 'MX', 'TYPE1234'...
+ * @param rrtype: the RR type in host order.
+ * @return malloced string with the RR type or NULL on malloc failure.
+ */
+char* sldns_wire2str_type(uint16_t rrtype);
+
+/**
+ * Convert wire RR class to a string, 'IN', 'CLASS1'.
+ * @param rrclass: the RR class in host order.
+ * @return malloced string with the RR class or NULL on malloc failure.
+ */
+char* sldns_wire2str_class(uint16_t rrclass);
+
+/**
+ * Convert wire packet rcode to a string, 'NOERROR', 'NXDOMAIN'...
+ * @param rcode: as integer, host order
+ * @return malloced string with the rcode or NULL on malloc failure.
+ */
+char* sldns_wire2str_rcode(int rcode);
+
+/**
+ * Print to string, move string along for next content. With va_list.
+ * @param str: string buffer. Adjusted at end to after the output.
+ * @param slen: length of the string buffer. Adjusted at end.
+ * @param format: printf format string.
+ * @param args: arguments for printf.
+ * @return number of characters needed. Can be larger than slen.
+ */
+int sldns_str_vprint(char** str, size_t* slen, const char* format, va_list args);
+
+/**
+ * Print to string, move string along for next content.
+ * @param str: string buffer. Adjusted at end to after the output.
+ * @param slen: length of the string buffer. Adjusted at end.
+ * @param format: printf format string and arguments for it.
+ * @return number of characters needed. Can be larger than slen.
+ */
+int sldns_str_print(char** str, size_t* slen, const char* format, ...)
+ ATTR_FORMAT(printf, 3, 4);
+
+/**
+ * Convert wireformat packet to a string representation with user buffer
+ * It appends every RR with default comments.
+ * For more formatter options use the function: TBD(TODO)
+ * @param data: wireformat packet data (starting at ID bytes).
+ * @param data_len: length of packet.
+ * @param str: the string buffer for the output.
+ * If you pass NULL as the str the return value of the function is
+ * the str_len you need for the entire packet. It does not include
+ * the 0 byte at the end.
+ * @param str_len: the size of the string buffer. If more is needed, it'll
+ * silently truncate the output to fit in the buffer.
+ * @return the number of characters for this element, excluding zerobyte.
+ * Is larger than str_len if output was truncated.
+ */
+int sldns_wire2str_pkt_buf(uint8_t* data, size_t data_len, char* str,
+ size_t str_len);
+
+/**
+ * Scan wireformat packet to a string representation with user buffer
+ * It appends every RR with default comments.
+ * For more formatter options use the function: TBD(TODO)
+ * @param data: wireformat packet data (starting at ID bytes).
+ * @param data_len: length of packet.
+ * @param str: the string buffer for the output.
+ * @param str_len: the size of the string buffer.
+ * @return number of characters for string.
+ * returns the number of characters that are needed (except terminating null),
+ * so it may return a value larger than str_len.
+ * On error you get less output (i.e. shorter output in str (null terminated))
+ * On exit the data, data_len, str and str_len values are adjusted to move them
+ * from their original position along the input and output for the content
+ * that has been consumed (and produced) by this function. If the end of the
+ * output string is reached, *str_len is set to 0. The output string is null
+ * terminated (shortening the output if necessary). If the end of the input
+ * is reached *data_len is set to 0.
+ */
+int sldns_wire2str_pkt_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat rr to string, with user buffers. It shifts the arguments
+ * to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param pkt: packet for decompression, if NULL no decompression.
+ * @param pktlen: length of packet buffer.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_rr_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len, uint8_t* pkt, size_t pktlen);
+
+/**
+ * Scan wireformat question rr to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param pkt: packet for decompression, if NULL no decompression.
+ * @param pktlen: length of packet buffer.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_rrquestion_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len, uint8_t* pkt, size_t pktlen);
+
+/**
+ * Scan wireformat RR to string in unknown RR format, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param pkt: packet for decompression, if NULL no decompression.
+ * @param pktlen: length of packet buffer.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_rr_unknown_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len, uint8_t* pkt, size_t pktlen);
+
+/**
+ * Print to string the RR-information comment in default format,
+ * with user buffers. Moves string along.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param rr: wireformat data.
+ * @param rrlen: length of data buffer.
+ * @param dname_off: offset in buffer behind owner dname, the compressed size
+ * of the owner name.
+ * @param rrtype: type of the RR, host format.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_rr_comment_print(char** str, size_t* str_len, uint8_t* rr,
+ size_t rrlen, size_t dname_off, uint16_t rrtype);
+
+/**
+ * Scan wireformat packet header to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_header_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat rdata to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer. The length of the rdata in the
+ * buffer. The rdatalen itself has already been scanned, the data
+ * points to the rdata after the rdatalen.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param rrtype: RR type of Rdata, host format.
+ * @param pkt: packet for decompression, if NULL no decompression.
+ * @param pktlen: length of packet buffer.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_rdata_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len, uint16_t rrtype, uint8_t* pkt, size_t pktlen);
+
+/**
+ * Scan wireformat rdata to string in unknown format, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer, the length of the rdata in buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_rdata_unknown_scan(uint8_t** data, size_t* data_len,
+ char** str, size_t* str_len);
+
+/**
+ * Scan wireformat domain name to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param pkt: packet for decompression, if NULL no decompression.
+ * @param pktlen: length of packet buffer.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_dname_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len, uint8_t* pkt, size_t pktlen);
+
+/**
+ * Scan wireformat rr type to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_type_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat rr class to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_class_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat rr ttl to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_ttl_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+
+/**
+ * Print host format rr type to string. Moves string along, user buffers.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param rrtype: host format rr type.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_type_print(char** str, size_t* str_len, uint16_t rrtype);
+
+/**
+ * Print host format rr class to string. Moves string along, user buffers.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param rrclass: host format rr class.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_class_print(char** str, size_t* str_len, uint16_t rrclass);
+
+/**
+ * Print host format rcode to string. Moves string along, user buffers.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param rcode: host format rcode number.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_rcode_print(char** str, size_t* str_len, int rcode);
+
+/**
+ * Print host format opcode to string. Moves string along, user buffers.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param opcode: host format opcode number.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_opcode_print(char** str, size_t* str_len, int opcode);
+
+/**
+ * Print host format EDNS0 option to string. Moves string along, user buffers.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param opcode: host format option number.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_edns_option_code_print(char** str, size_t* str_len,
+ uint16_t opcode);
+
+/**
+ * Convert RR to string presentation format, on one line. User buffer.
+ * @param rr: wireformat RR data
+ * @param rr_len: length of the rr wire data.
+ * @param str: the string buffer to write to.
+ * If you pass NULL as the str, the return value of the function is
+ * the str_len you need for the entire packet. It does not include
+ * the 0 byte at the end.
+ * @param str_len: the size of the string buffer. If more is needed, it'll
+ * silently truncate the output to fit in the buffer.
+ * @return the number of characters for this element, excluding zerobyte.
+ * Is larger than str_len if output was truncated.
+ */
+int sldns_wire2str_rr_buf(uint8_t* rr, size_t rr_len, char* str,
+ size_t str_len);
+
+/**
+ * 3597 printout of an RR in unknown rr format.
+ * There are more format and comment options available for printout
+ * with the function: TBD(TODO)
+ * @param rr: wireformat RR data
+ * @param rr_len: length of the rr wire data.
+ * @param str: the string buffer to write to.
+ * If you pass NULL as the str, the return value of the function is
+ * the str_len you need for the entire rr. It does not include
+ * the 0 byte at the end.
+ * @param str_len: the size of the string buffer. If more is needed, it'll
+ * silently truncate the output to fit in the buffer.
+ * @return the number of characters for this element, excluding zerobyte.
+ * Is larger than str_len if output was truncated.
+ */
+int sldns_wire2str_rr_unknown_buf(uint8_t* rr, size_t rr_len, char* str,
+ size_t str_len);
+
+/**
+ * This creates the comment to print after the RR. ; keytag=... , and other
+ * basic comments for RRs.
+ * There are more format and comment options available for printout
+ * with the function: TBD(TODO)
+ * @param rr: wireformat RR data
+ * @param rr_len: length of the rr wire data.
+ * @param dname_len: length of the dname in front of the RR.
+ * @param str: the string buffer to write to.
+ * If you pass NULL as the str, the return value of the function is
+ * the str_len you need for the entire comment. It does not include
+ * the 0 byte at the end.
+ * @param str_len: the size of the string buffer. If more is needed, it'll
+ * silently truncate the output to fit in the buffer.
+ * @return the number of characters for this element, excluding zerobyte.
+ * Is larger than str_len if output was truncated.
+ */
+int sldns_wire2str_rr_comment_buf(uint8_t* rr, size_t rr_len, size_t dname_len,
+ char* str, size_t str_len);
+
+/**
+ * Convert RDATA to string presentation format, on one line. User buffer.
+ * @param rdata: wireformat rdata part of an RR.
+ * @param rdata_len: length of the rr wire data.
+ * @param str: the string buffer to write to.
+ * If you pass NULL as the str, the return value of the function is
+ * the str_len you need for the entire packet. It does not include
+ * the 0 byte at the end.
+ * @param str_len: the size of the string buffer. If more is needed, it'll
+ * silently truncate the output to fit in the buffer.
+ * @param rrtype: rr type of the data
+ * @return the number of characters for this element, excluding zerobyte.
+ * Is larger than str_len if output was truncated.
+ */
+int sldns_wire2str_rdata_buf(uint8_t* rdata, size_t rdata_len, char* str,
+ size_t str_len, uint16_t rrtype);
+
+/**
+ * Convert wire RR type to a string, 'MX', 'TYPE12'. With user buffer.
+ * @param rrtype: the RR type in host order.
+ * @param str: the string to write to.
+ * @param len: length of str.
+ * @return the number of characters for this element, excluding zerobyte.
+ * Is larger than str_len if output was truncated.
+ */
+int sldns_wire2str_type_buf(uint16_t rrtype, char* str, size_t len);
+
+/**
+ * Convert wire RR class to a string, 'IN', 'CLASS12'. With user buffer.
+ * @param rrclass: the RR class in host order.
+ * @param str: the string to write to.
+ * @param len: length of str.
+ * @return the number of characters for this element, excluding zerobyte.
+ * Is larger than str_len if output was truncated.
+ */
+int sldns_wire2str_class_buf(uint16_t rrclass, char* str, size_t len);
+
+/**
+ * Convert wire RR rcode to a string, 'NOERROR', 'NXDOMAIN'. With user buffer.
+ * @param rcode: rcode as integer in host order
+ * @param str: the string to write to.
+ * @param len: length of str.
+ * @return the number of characters for this element, excluding zerobyte.
+ * Is larger than str_len if output was truncated.
+ */
+int sldns_wire2str_rcode_buf(int rcode, char* str, size_t len);
+
+/**
+ * Convert wire dname to a string, "example.com.". With user buffer.
+ * @param dname: the dname in uncompressed wireformat.
+ * @param dname_len: length of the dname.
+ * @param str: the string to write to.
+ * @param len: length of string.
+ * @return the number of characters for this element, excluding zerobyte.
+ * Is larger than str_len if output was truncated.
+ */
+int sldns_wire2str_dname_buf(uint8_t* dname, size_t dname_len, char* str,
+ size_t len);
+
+/**
+ * Scan wireformat rdf field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param rdftype: the type of the rdata field, enum sldns_rdf_type.
+ * @param pkt: packet for decompression, if NULL no decompression.
+ * @param pktlen: length of packet buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_rdf_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len, int rdftype, uint8_t* pkt, size_t pktlen);
+
+/**
+ * Scan wireformat int8 field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_int8_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat int16 field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_int16_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat int32 field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_int32_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat period field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_period_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat tsigtime field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_tsigtime_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat ip4 A field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_a_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat ip6 AAAA field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_aaaa_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat str field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_str_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat apl field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_apl_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat b32_ext field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_b32_ext_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat b64 field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_b64_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat hex field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_hex_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat nsec bitmap field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_nsec_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat nsec3_salt field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_nsec3_salt_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat cert_alg field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_cert_alg_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat alg field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_alg_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat type unknown field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_unknown_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat time field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_time_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat LOC field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_loc_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat WKS field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_wks_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat NSAP field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_nsap_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat ATMA field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_atma_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat IPSECKEY field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param pkt: packet for decompression, if NULL no decompression.
+ * @param pktlen: length of packet buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_ipseckey_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len, uint8_t* pkt, size_t pktlen);
+
+/**
+ * Scan wireformat HIP (algo, HIT, pubkey) field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_hip_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat int16_data field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_int16_data_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat nsec3_next_owner field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_nsec3_next_owner_scan(uint8_t** data, size_t* data_len,
+ char** str, size_t* str_len);
+
+/**
+ * Scan wireformat ILNP64 field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_ilnp64_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat EUI48 field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_eui48_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat EUI64 field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_eui64_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat TAG field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_tag_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Scan wireformat long_str field to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @return number of characters (except null) needed to print.
+ * Can return -1 on failure.
+ */
+int sldns_wire2str_long_str_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len);
+
+/**
+ * Print EDNS LLQ option data to string. User buffers, moves string pointers.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param option_data: buffer with EDNS option code data.
+ * @param option_len: length of the data for this option.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_edns_llq_print(char** str, size_t* str_len,
+ uint8_t* option_data, size_t option_len);
+
+/**
+ * Print EDNS UL option data to string. User buffers, moves string pointers.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param option_data: buffer with EDNS option code data.
+ * @param option_len: length of the data for this option.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_edns_ul_print(char** str, size_t* str_len,
+ uint8_t* option_data, size_t option_len);
+
+/**
+ * Print EDNS NSID option data to string. User buffers, moves string pointers.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param option_data: buffer with EDNS option code data.
+ * @param option_len: length of the data for this option.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_edns_nsid_print(char** str, size_t* str_len,
+ uint8_t* option_data, size_t option_len);
+
+/**
+ * Print EDNS DAU option data to string. User buffers, moves string pointers.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param option_data: buffer with EDNS option code data.
+ * @param option_len: length of the data for this option.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_edns_dau_print(char** str, size_t* str_len,
+ uint8_t* option_data, size_t option_len);
+
+/**
+ * Print EDNS DHU option data to string. User buffers, moves string pointers.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param option_data: buffer with EDNS option code data.
+ * @param option_len: length of the data for this option.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_edns_dhu_print(char** str, size_t* str_len,
+ uint8_t* option_data, size_t option_len);
+
+/**
+ * Print EDNS N3U option data to string. User buffers, moves string pointers.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param option_data: buffer with EDNS option code data.
+ * @param option_len: length of the data for this option.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_edns_n3u_print(char** str, size_t* str_len,
+ uint8_t* option_data, size_t option_len);
+
+/**
+ * Print EDNS SUBNET option data to string. User buffers, moves string pointers.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param option_data: buffer with EDNS option code data.
+ * @param option_len: length of the data for this option.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_edns_subnet_print(char** str, size_t* str_len,
+ uint8_t* option_data, size_t option_len);
+
+/**
+ * Print an EDNS option as OPT: VALUE. User buffers, moves string pointers.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param option_code: host format EDNS option code.
+ * @param option_data: buffer with EDNS option code data.
+ * @param option_len: length of the data for this option.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_edns_option_print(char** str, size_t* str_len,
+ uint16_t option_code, uint8_t* option_data, size_t option_len);
+
+/**
+ * Scan wireformat EDNS OPT to string, with user buffers.
+ * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
+ * @param data: wireformat data.
+ * @param data_len: length of data buffer.
+ * @param str: string buffer.
+ * @param str_len: length of string buffer.
+ * @param pkt: packet with header and other info (may be NULL)
+ * @param pktlen: length of packet buffer.
+ * @return number of characters (except null) needed to print.
+ */
+int sldns_wire2str_edns_scan(uint8_t** data, size_t* data_len, char** str,
+ size_t* str_len, uint8_t* pkt, size_t pktlen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LDNS_WIRE2STR_H */
#include "config.h"
#include "libunbound/unbound.h"
-#include "ldns/rrdef.h"
+#include "sldns/rrdef.h"
#include <expat.h>
#ifndef HAVE_EXPAT_H
#error "need libexpat to parse root-anchors.xml file."
{
size_t got = 0;
int r;
- char* data = malloc(len+1);
+ char* data;
+ if(len >= 0xfffffff0)
+ return NULL; /* to protect against integer overflow in malloc*/
+ data = malloc(len+1);
if(!data) {
if(verb) printf("out of memory\n");
return NULL;
#include "iterator/iter_hints.h"
#include "validator/validator.h"
#include "services/localzone.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
DAYS=7200
# size of keys in bits
-BITS=1536
+BITS=3072
# hash algorithm
HASH=sha256
printf(" get_option opt get option value\n");
printf(" list_stubs list stub-zones and root hints in use\n");
printf(" list_forwards list forward-zones in use\n");
+ printf(" list_insecure list domain-insecure zones\n");
printf(" list_local_zones list local-zones in use\n");
printf(" list_local_data list local-data RRs in use\n");
printf(" insecure_add zone add domain-insecure zone\n");
printf(" forward [off | addr ...] without arg show forward setup\n");
printf(" or off to turn off root forwarding\n");
printf(" or give list of ip addresses\n");
+ printf(" ratelimit_list [+a] list ratelimited domains\n");
+ printf(" +a list all, also not ratelimited\n");
printf("Version %s\n", PACKAGE_VERSION);
printf("BSD licensed, see LICENSE in source package for details.\n");
printf("Report bugs to %s\n", PACKAGE_BUGREPORT);
#define unbound_lite_wrapstr(s) s
#endif
#include "libunbound/unbound.h"
-#include "ldns/rrdef.h"
-#include "ldns/wire2str.h"
+#include "sldns/rrdef.h"
+#include "sldns/wire2str.h"
#ifdef HAVE_NSS
/* nss3 */
#include "nss.h"
#include "libunbound/context.h"
#include "util/locks.h"
#include "util/log.h"
-#include "ldns/rrdef.h"
+#include "sldns/rrdef.h"
#ifdef UNBOUND_ALLOC_LITE
#undef malloc
#undef calloc
#include <sys/time.h>
#include "util/net_help.h"
#include "util/config_file.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
#include <signal.h>
/** number of reads per select for delayer */
#include "testcode/testpkts.h"
#include "util/log.h"
#include "util/fptr_wlist.h"
-#include "ldns/sbuffer.h"
-#include "ldns/wire2str.h"
-#include "ldns/str2wire.h"
+#include "sldns/sbuffer.h"
+#include "sldns/wire2str.h"
+#include "sldns/str2wire.h"
#include <signal.h>
struct worker;
struct daemon_remote;
#include "util/data/msgencode.h"
#include "util/data/msgreply.h"
#include "util/data/msgparse.h"
-#include "ldns/sbuffer.h"
-#include "ldns/wire2str.h"
-#include "ldns/str2wire.h"
+#include "sldns/sbuffer.h"
+#include "sldns/wire2str.h"
+#include "sldns/str2wire.h"
#include <sys/time.h>
/** usage information for perf */
#include "util/data/msgparse.h"
#include "testcode/unitmain.h"
#include "testcode/readhex.h"
-#include "ldns/sbuffer.h"
-#include "ldns/parseutil.h"
+#include "sldns/sbuffer.h"
+#include "sldns/parseutil.h"
/** usage information for pktview */
static void usage(char* argv[])
#include <ctype.h>
#include "testcode/readhex.h"
#include "util/log.h"
-#include "ldns/sbuffer.h"
-#include "ldns/parseutil.h"
+#include "sldns/sbuffer.h"
+#include "sldns/parseutil.h"
/** skip whitespace */
static void
#include "testcode/replay.h"
#include "testcode/testpkts.h"
#include "testcode/fake_event.h"
-#include "ldns/str2wire.h"
+#include "sldns/str2wire.h"
/** max length of lines in file */
#define MAX_LINE_LEN 10240
#include "util/data/msgparse.h"
#include "util/data/msgreply.h"
#include "util/data/dname.h"
-#include "ldns/sbuffer.h"
-#include "ldns/str2wire.h"
-#include "ldns/wire2str.h"
+#include "sldns/sbuffer.h"
+#include "sldns/str2wire.h"
+#include "sldns/wire2str.h"
#include <openssl/ssl.h>
#include <openssl/rand.h>
#include <openssl/err.h>
#include "testcode/fake_event.h"
#include "daemon/remote.h"
#include "util/config_file.h"
-#include "ldns/keyraw.h"
+#include "sldns/keyraw.h"
#include <ctype.h>
/** signal that this is a testbound compile */
#include <ctype.h>
#include "testcode/testpkts.h"
#include "util/net_help.h"
-#include "ldns/sbuffer.h"
-#include "ldns/rrdef.h"
-#include "ldns/pkthdr.h"
-#include "ldns/str2wire.h"
-#include "ldns/wire2str.h"
+#include "sldns/sbuffer.h"
+#include "sldns/rrdef.h"
+#include "sldns/pkthdr.h"
+#include "sldns/str2wire.h"
+#include "sldns/wire2str.h"
/** max size of a packet */
#define MAX_PACKETLEN 65536
#include "util/data/dname.h"
#include "testcode/unitmain.h"
#include "validator/val_anchor.h"
-#include "ldns/sbuffer.h"
-#include "ldns/rrdef.h"
+#include "sldns/sbuffer.h"
+#include "sldns/rrdef.h"
/** test empty set */
static void
#include "util/log.h"
#include "testcode/unitmain.h"
#include "util/data/dname.h"
-#include "ldns/sbuffer.h"
-#include "ldns/str2wire.h"
+#include "sldns/sbuffer.h"
+#include "sldns/str2wire.h"
/** put dname into buffer */
static sldns_buffer*
#include "config.h"
#include "util/log.h"
#include "testcode/unitmain.h"
-#include "ldns/sbuffer.h"
-#include "ldns/str2wire.h"
-#include "ldns/wire2str.h"
+#include "sldns/sbuffer.h"
+#include "sldns/str2wire.h"
+#include "sldns/wire2str.h"
/** verbose this unit test */
static int vbmp = 0;
#include "nss.h"
#endif
-#include "ldns/rrdef.h"
-#include "ldns/keyraw.h"
+#include "sldns/rrdef.h"
+#include "sldns/keyraw.h"
#include "util/log.h"
#include "testcode/unitmain.h"
#include "util/net_help.h"
#include "testcode/readhex.h"
#include "testcode/testpkts.h"
-#include "ldns/sbuffer.h"
-#include "ldns/str2wire.h"
-#include "ldns/wire2str.h"
+#include "sldns/sbuffer.h"
+#include "sldns/str2wire.h"
+#include "sldns/wire2str.h"
/** verbose message parse unit test */
static int vbmp = 0;
void msgparse_test(void)
{
+ time_t origttl = MAX_NEG_TTL;
sldns_buffer* pkt = sldns_buffer_new(65553);
sldns_buffer* out = sldns_buffer_new(65553);
struct alloc_cache super_a, alloc;
+ MAX_NEG_TTL = 86400;
/* init */
alloc_init(&super_a, NULL, 0);
alloc_init(&alloc, &super_a, 2);
alloc_clear(&super_a);
sldns_buffer_free(pkt);
sldns_buffer_free(out);
+ MAX_NEG_TTL = origttl;
}
#include "util/data/dname.h"
#include "testcode/unitmain.h"
#include "validator/val_neg.h"
-#include "ldns/rrdef.h"
+#include "sldns/rrdef.h"
/** verbose unit test for negative cache */
static int negverbose = 0;
#include "util/net_help.h"
#include "util/module.h"
#include "util/config_file.h"
-#include "ldns/sbuffer.h"
-#include "ldns/keyraw.h"
-#include "ldns/str2wire.h"
-#include "ldns/wire2str.h"
+#include "sldns/sbuffer.h"
+#include "sldns/keyraw.h"
+#include "sldns/str2wire.h"
+#include "sldns/wire2str.h"
/** verbose signature test */
static int vsig = 0;
--- /dev/null
+; This is a comment.
+; config options go here.
+forward-zone: name: "." forward-addr: 216.0.0.1
+CONFIG_END
+
+SCENARIO_BEGIN Test query and cache with type ANY
+RANGE_BEGIN 0 1000
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR RD RA NOERROR
+SECTION QUESTION
+www.example.com. IN A
+SECTION ANSWER
+www.example.com. IN A 10.20.30.40
+SECTION AUTHORITY
+www.example.com. IN NS ns.example.com.
+SECTION ADDITIONAL
+ns.example.com. IN A 10.20.30.50
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR RD RA NOERROR
+SECTION QUESTION
+www.example.com. IN ANY
+SECTION ANSWER
+;; different type in this answer.
+www.example.com. IN TXT "text"
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR RD RA NOERROR
+SECTION QUESTION
+www.example.com. IN AAAA
+SECTION ANSWER
+www.example.com. IN AAAA ::5
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qname qtype
+ADJUST copy_id
+REPLY QR RD RA NOERROR
+SECTION QUESTION
+www.foo.com. IN ANY
+SECTION ANSWER
+www.foo.com. IN A 1.2.3.77
+www.foo.com. IN AAAA ::77
+ENTRY_END
+
+RANGE_END
+
+STEP 10 QUERY
+ENTRY_BEGIN
+REPLY RD
+SECTION QUESTION
+www.example.com. IN A
+ENTRY_END
+; unneccesary nothing steps.
+STEP 20 NOTHING
+STEP 30 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH opcode qname qtype
+SECTION QUESTION
+www.example.com. IN A
+SECTION ANSWER
+www.example.com. IN A 10.20.30.40
+ENTRY_END
+
+; test cache synthesis
+STEP 40 QUERY
+ENTRY_BEGIN
+REPLY RD
+SECTION QUESTION
+www.example.com. IN ANY
+ENTRY_END
+STEP 50 NOTHING
+STEP 60 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH opcode qname qtype
+SECTION QUESTION
+www.example.com. IN ANY
+SECTION ANSWER
+www.example.com. IN A 10.20.30.40
+ENTRY_END
+
+; and again
+; the synthesized result itself is not added to the cache
+STEP 62 QUERY
+ENTRY_BEGIN
+REPLY RD
+SECTION QUESTION
+www.example.com. IN ANY
+ENTRY_END
+STEP 63 NOTHING
+STEP 64 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH opcode qname qtype
+SECTION QUESTION
+www.example.com. IN ANY
+SECTION ANSWER
+www.example.com. IN A 10.20.30.40
+ENTRY_END
+
+; AAAA lookup to add more data in cache
+STEP 70 QUERY
+ENTRY_BEGIN
+REPLY RD
+SECTION QUESTION
+www.example.com. IN AAAA
+ENTRY_END
+STEP 80 NOTHING
+STEP 90 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH opcode qname qtype
+SECTION QUESTION
+www.example.com. IN AAAA
+SECTION ANSWER
+www.example.com. IN AAAA ::5
+ENTRY_END
+
+; test cache synthesis of AAAA, and two rrsets.
+STEP 100 QUERY
+ENTRY_BEGIN
+REPLY RD
+SECTION QUESTION
+www.example.com. IN ANY
+ENTRY_END
+STEP 110 NOTHING
+STEP 120 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH opcode qname qtype
+SECTION QUESTION
+www.example.com. IN ANY
+SECTION ANSWER
+www.example.com. IN A 10.20.30.40
+www.example.com. IN AAAA ::5
+ENTRY_END
+
+; test query that is not synthesized from cache.
+STEP 130 QUERY
+ENTRY_BEGIN
+REPLY RD
+SECTION QUESTION
+www.foo.com. IN ANY
+ENTRY_END
+STEP 140 NOTHING
+STEP 150 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH opcode qname qtype
+SECTION QUESTION
+www.foo.com. IN ANY
+SECTION ANSWER
+www.foo.com. IN A 1.2.3.77
+www.foo.com. IN AAAA ::77
+ENTRY_END
+
+SCENARIO_END
nx1.example.com. IN A
SECTION ANSWER
SECTION AUTHORITY
-example.com. 3600 IN SOA a. b. 1 2 3 4 5
+; at TTL 5 because TTL is capped at min-ttl of 5 in rdata of SOA
+example.com. 5 IN SOA a. b. 1 2 3 4 5
example.com. 1800 IN NS ns.example.com.
SECTION ADDITIONAL
ns.example.com. 1800 IN A 1.2.3.4
nx1.example.com. IN A
SECTION ANSWER
SECTION AUTHORITY
-example.com. 3600 IN SOA a. b. 1 2 3 4 5
+; at TTL 5 because TTL capped at ttl of minttl in rdata of SOA.
+example.com. 5 IN SOA a. b. 1 2 3 4 5
example.com. 3600 IN NS nsb.example.com.
SECTION ADDITIONAL
nsb.example.com. 3600 IN A 1.2.3.4
nx1.example.com. IN A
SECTION ANSWER
SECTION AUTHORITY
-example.com. 3600 IN SOA a. b. 1 2 3 4 5
+; at TTL 5 because TTL capped at ttl of minttl in rdata of SOA.
+example.com. 5 IN SOA a. b. 1 2 3 4 5
example.com. 1800 IN NS nsb.example.com.
SECTION ADDITIONAL
nsb.example.com. 3600 IN A 1.2.3.4
SECTION ADDITIONAL
ENTRY_END
+; Check cache response for DNAME
+; so 100+ the authority will not respond any more : must be from cache.
+STEP 110 TIME_PASSES ELAPSE 10
+
+STEP 120 QUERY
+ENTRY_BEGIN
+REPLY RD DO
+SECTION QUESTION
+www.example.com. IN A
+ENTRY_END
+
+STEP 130 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH all ttl
+REPLY QR RD RA AD DO NOERROR
+SECTION QUESTION
+www.example.com. IN A
+SECTION ANSWER
+example.com. 3590 IN DNAME example.net.
+example.com. 3590 IN RRSIG DNAME 3 2 3600 20070926134150 20070829134150 2854 example.com. MCwCFH1xw24Hswia3g10AVL1yFUHUPdFAhQDrA+qZJwqXRPg2C1oiNPk9fosGg== ;{id = 2854}
+www.example.com. 3590 IN CNAME www.example.net.
+www.example.net. 3590 IN A 11.12.13.14
+www.example.net. 3590 IN RRSIG A 5 3 3600 20070926134150 20070829134150 30899 example.net. CPxF5hK9Kg5eT7W6LgZwr0ePYEm9HMcSY4vvqCS6gDWB4X9jvXLCfBkCLhsNybPBpGWlsLi5wM6MTdJXuPpsRA== ;{id = 30899}
+SECTION AUTHORITY
+SECTION ADDITIONAL
+ENTRY_END
+
SCENARIO_END
--- /dev/null
+; config options
+; The island of trust is at example.com
+server:
+ trust-anchor: "example.com. 3600 IN DNSKEY 256 3 3 ALXLUsWqUrY3JYER3T4TBJIIs70j+sDS/UT2QRp61SE7S3EEXopNXoFE73JLRmvpi/UrOO/Vz4Se6wXv/CYCKjGw06U4WRgRYXcpEhJROyNapmdIKSxhOzfLVE1gqA0PweZR8dtY3aNQSRn3sPpwJr6Mi/PqQKAMMrZ9ckJpf1+bQMOOvxgzz2U1GS18b3yZKcgTMEaJzd/GZYzi/BN2DzQ0MsrSwYXfsNLFOBbs8PJMW4LYIxeeOe6rUgkWOF7CC9Dh/dduQ1QrsJhmZAEFfd6ByYV+ ;{id = 2854 (zsk), size = 1688b}"
+ trust-anchor: "example.com. 3600 IN DS 30899 5 1 d4bf9d2e10f6d76840d42ef5913022abcd0bf512"
+ val-override-date: "20070916134226"
+ target-fetch-policy: "0 0 0 0 0"
+ harden-algo-downgrade: no
+
+stub-zone:
+ name: "."
+ stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
+CONFIG_END
+
+SCENARIO_BEGIN Test validator with multiple algorithm trust anchor without harden
+
+; K.ROOT-SERVERS.NET.
+RANGE_BEGIN 0 100
+ ADDRESS 193.0.14.129
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+. IN NS
+SECTION ANSWER
+. IN NS K.ROOT-SERVERS.NET.
+SECTION ADDITIONAL
+K.ROOT-SERVERS.NET. IN A 193.0.14.129
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+www.example.com. IN A
+SECTION AUTHORITY
+com. IN NS a.gtld-servers.net.
+SECTION ADDITIONAL
+a.gtld-servers.net. IN A 192.5.6.30
+ENTRY_END
+RANGE_END
+
+; a.gtld-servers.net.
+RANGE_BEGIN 0 100
+ ADDRESS 192.5.6.30
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+com. IN NS
+SECTION ANSWER
+com. IN NS a.gtld-servers.net.
+SECTION ADDITIONAL
+a.gtld-servers.net. IN A 192.5.6.30
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+www.example.com. IN A
+SECTION AUTHORITY
+example.com. IN NS ns.example.com.
+SECTION ADDITIONAL
+ns.example.com. IN A 1.2.3.4
+ENTRY_END
+RANGE_END
+
+; ns.example.com.
+RANGE_BEGIN 0 100
+ ADDRESS 1.2.3.4
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+example.com. IN NS
+SECTION ANSWER
+example.com. IN NS ns.example.com.
+example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
+example.com. 3600 IN RRSIG NS 5 2 3600 20070926134150 20070829134150 30899 example.com. YTqtYba73HIOQuPr5oDyIX9pfmz1ybEBjwlD/jUgcPmFINUOZ9FeqG6ywgRKwn4AizkKTK00p1sxZYMKxl91wg== ;{id = 30899}
+SECTION ADDITIONAL
+ns.example.com. IN A 1.2.3.4
+ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
+ns.example.com. 3600 IN RRSIG A 5 3 3600 20070926134150 20070829134150 30899 example.com. Dn1ziMKrc3NdJkSv8g61Y9WNk3+BAuwCwnYzAZiHmkejkSCPViLJN7+f4Conp9l8LkTl50ZnLgoYrrUYNhMj6w== ;{id = 30899}
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR AA NOERROR
+SECTION QUESTION
+ns.example.com. IN AAAA
+SECTION ANSWER
+SECTION AUTHORITY
+example.com. IN NS ns.example.com.
+example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
+example.com. 3600 IN RRSIG NS 5 2 3600 20070926134150 20070829134150 30899 example.com. YTqtYba73HIOQuPr5oDyIX9pfmz1ybEBjwlD/jUgcPmFINUOZ9FeqG6ywgRKwn4AizkKTK00p1sxZYMKxl91wg== ;{id = 30899}
+SECTION ADDITIONAL
+ns.example.com. IN A 1.2.3.4
+ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
+ns.example.com. 3600 IN RRSIG A 5 3 3600 20070926134150 20070829134150 30899 example.com. Dn1ziMKrc3NdJkSv8g61Y9WNk3+BAuwCwnYzAZiHmkejkSCPViLJN7+f4Conp9l8LkTl50ZnLgoYrrUYNhMj6w== ;{id = 30899}
+ENTRY_END
+
+
+; response to DNSKEY priming query
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+example.com. IN DNSKEY
+SECTION ANSWER
+example.com. 3600 IN DNSKEY 256 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 30899 (zsk), size = 512b}
+example.com. 3600 IN DNSKEY 256 3 3 ALXLUsWqUrY3JYER3T4TBJIIs70j+sDS/UT2QRp61SE7S3EEXopNXoFE73JLRmvpi/UrOO/Vz4Se6wXv/CYCKjGw06U4WRgRYXcpEhJROyNapmdIKSxhOzfLVE1gqA0PweZR8dtY3aNQSRn3sPpwJr6Mi/PqQKAMMrZ9ckJpf1+bQMOOvxgzz2U1GS18b3yZKcgTMEaJzd/GZYzi/BN2DzQ0MsrSwYXfsNLFOBbs8PJMW4LYIxeeOe6rUgkWOF7CC9Dh/dduQ1QrsJhmZAEFfd6ByYV+ ;{id = 2854 (zsk), size = 512b}
+example.com. 3600 IN RRSIG DNSKEY 3 2 3600 20070926134150 20070829134150 2854 example.com. AKIIYDOGHogglFqJK94ZtOnF7EfGikgAyloMNRSMCrQgFaFkmcOyjrc= ;{id = 2854}
+example.com. 3600 IN RRSIG DNSKEY 5 2 3600 20070926134150 20070829134150 30899 example.com. J55fsz1GGMnngc4r50xvXDUdaVMlfcLKLVsfMhwNLF+ERac5XV/lLRAc/aSER+qQdsSo0CrjYjy1wat7YQpDAA== ;{id = 30899}
+SECTION AUTHORITY
+example.com. IN NS ns.example.com.
+example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
+example.com. 3600 IN RRSIG NS 5 2 3600 20070926134150 20070829134150 30899 example.com. YTqtYba73HIOQuPr5oDyIX9pfmz1ybEBjwlD/jUgcPmFINUOZ9FeqG6ywgRKwn4AizkKTK00p1sxZYMKxl91wg== ;{id = 30899}
+SECTION ADDITIONAL
+ns.example.com. IN A 1.2.3.4
+ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
+ns.example.com. 3600 IN RRSIG A 5 3 3600 20070926134150 20070829134150 30899 example.com. Dn1ziMKrc3NdJkSv8g61Y9WNk3+BAuwCwnYzAZiHmkejkSCPViLJN7+f4Conp9l8LkTl50ZnLgoYrrUYNhMj6w== ;{id = 30899}
+ENTRY_END
+
+; response to query of interest
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+www.example.com. IN A
+SECTION ANSWER
+www.example.com. IN A 10.20.30.40
+ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCQMyTjn7WWwpwAR1LlVeLpRgZGuQIUCcJDEkwAuzytTDRlYK7nIMwH1CM= ;{id = 2854}
+www.example.com. 3600 IN RRSIG A 5 3 3600 20070926134150 20070829134150 30899 example.com. JNWECShNE+nCLQwOXJJ3xpUkh2G+FCh5nk8uYAHIVQRse/BIvCMSlvRrtVyw9RnXvk5RR2bEgN0pRdLWW7ug5Q== ;{id = 30899}
+SECTION AUTHORITY
+example.com. IN NS ns.example.com.
+example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
+example.com. 3600 IN RRSIG NS 5 2 3600 20070926134150 20070829134150 30899 example.com. YTqtYba73HIOQuPr5oDyIX9pfmz1ybEBjwlD/jUgcPmFINUOZ9FeqG6ywgRKwn4AizkKTK00p1sxZYMKxl91wg== ;{id = 30899}
+SECTION ADDITIONAL
+ns.example.com. IN A 1.2.3.4
+www.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFC99iE9K5y2WNgI0gFvBWaTi9wm6AhUAoUqOpDtG5Zct+Qr9F3mSdnbc6V4= ;{id = 2854}
+ns.example.com. 3600 IN RRSIG A 5 3 3600 20070926134150 20070829134150 30899 example.com. Dn1ziMKrc3NdJkSv8g61Y9WNk3+BAuwCwnYzAZiHmkejkSCPViLJN7+f4Conp9l8LkTl50ZnLgoYrrUYNhMj6w== ;{id = 30899}
+ENTRY_END
+RANGE_END
+
+STEP 1 QUERY
+ENTRY_BEGIN
+REPLY RD DO
+SECTION QUESTION
+www.example.com. IN A
+ENTRY_END
+
+; recursion happens here.
+STEP 10 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH all
+REPLY QR RD RA AD DO NOERROR
+SECTION QUESTION
+www.example.com. IN A
+SECTION ANSWER
+www.example.com. IN A 10.20.30.40
+www.example.com. 3600 IN RRSIG A 5 3 3600 20070926134150 20070829134150 30899 example.com. JNWECShNE+nCLQwOXJJ3xpUkh2G+FCh5nk8uYAHIVQRse/BIvCMSlvRrtVyw9RnXvk5RR2bEgN0pRdLWW7ug5Q== ;{id = 30899}
+www.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFC99iE9K5y2WNgI0gFvBWaTi9wm6AhUAoUqOpDtG5Zct+Qr9F3mSdnbc6V4= ;{id = 2854}
+SECTION AUTHORITY
+example.com. IN NS ns.example.com.
+example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
+example.com. 3600 IN RRSIG NS 5 2 3600 20070926134150 20070829134150 30899 example.com. YTqtYba73HIOQuPr5oDyIX9pfmz1ybEBjwlD/jUgcPmFINUOZ9FeqG6ywgRKwn4AizkKTK00p1sxZYMKxl91wg== ;{id = 30899}
+SECTION ADDITIONAL
+ns.example.com. IN A 1.2.3.4
+ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCQMyTjn7WWwpwAR1LlVeLpRgZGuQIUCcJDEkwAuzytTDRlYK7nIMwH1CM= ;{id = 2854}
+ns.example.com. 3600 IN RRSIG A 5 3 3600 20070926134150 20070829134150 30899 example.com. Dn1ziMKrc3NdJkSv8g61Y9WNk3+BAuwCwnYzAZiHmkejkSCPViLJN7+f4Conp9l8LkTl50ZnLgoYrrUYNhMj6w== ;{id = 30899}
+ENTRY_END
+
+SCENARIO_END
--- /dev/null
+; config options
+; The island of trust is at example.com
+server:
+ trust-anchor: "example.com. 3600 IN DNSKEY 256 3 3 ALXLUsWqUrY3JYER3T4TBJIIs70j+sDS/UT2QRp61SE7S3EEXopNXoFE73JLRmvpi/UrOO/Vz4Se6wXv/CYCKjGw06U4WRgRYXcpEhJROyNapmdIKSxhOzfLVE1gqA0PweZR8dtY3aNQSRn3sPpwJr6Mi/PqQKAMMrZ9ckJpf1+bQMOOvxgzz2U1GS18b3yZKcgTMEaJzd/GZYzi/BN2DzQ0MsrSwYXfsNLFOBbs8PJMW4LYIxeeOe6rUgkWOF7CC9Dh/dduQ1QrsJhmZAEFfd6ByYV+ ;{id = 2854 (zsk), size = 1688b}"
+ trust-anchor: "example.com. 3600 IN DS 30899 5 1 d4bf9d2e10f6d76840d42ef5913022abcd0bf512"
+ trust-anchor: "example.com. 3600 IN DS 30899 7 1 d4bf9d2e10f6d76840d42ef5913022abcd0bf512"
+ val-override-date: "20070916134226"
+ target-fetch-policy: "0 0 0 0 0"
+ harden-algo-downgrade: no
+
+stub-zone:
+ name: "."
+ stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET.
+CONFIG_END
+
+SCENARIO_BEGIN Test validator with multiple algorithm missing one
+
+; K.ROOT-SERVERS.NET.
+RANGE_BEGIN 0 100
+ ADDRESS 193.0.14.129
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+. IN NS
+SECTION ANSWER
+. IN NS K.ROOT-SERVERS.NET.
+SECTION ADDITIONAL
+K.ROOT-SERVERS.NET. IN A 193.0.14.129
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+www.example.com. IN A
+SECTION AUTHORITY
+com. IN NS a.gtld-servers.net.
+SECTION ADDITIONAL
+a.gtld-servers.net. IN A 192.5.6.30
+ENTRY_END
+RANGE_END
+
+; a.gtld-servers.net.
+RANGE_BEGIN 0 100
+ ADDRESS 192.5.6.30
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+com. IN NS
+SECTION ANSWER
+com. IN NS a.gtld-servers.net.
+SECTION ADDITIONAL
+a.gtld-servers.net. IN A 192.5.6.30
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+www.example.com. IN A
+SECTION AUTHORITY
+example.com. IN NS ns.example.com.
+SECTION ADDITIONAL
+ns.example.com. IN A 1.2.3.4
+ENTRY_END
+RANGE_END
+
+; ns.example.com.
+RANGE_BEGIN 0 100
+ ADDRESS 1.2.3.4
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+example.com. IN NS
+SECTION ANSWER
+example.com. IN NS ns.example.com.
+example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
+example.com. 3600 IN RRSIG NS 5 2 3600 20070926134150 20070829134150 30899 example.com. YTqtYba73HIOQuPr5oDyIX9pfmz1ybEBjwlD/jUgcPmFINUOZ9FeqG6ywgRKwn4AizkKTK00p1sxZYMKxl91wg== ;{id = 30899}
+SECTION ADDITIONAL
+ns.example.com. IN A 1.2.3.4
+ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
+ns.example.com. 3600 IN RRSIG A 5 3 3600 20070926134150 20070829134150 30899 example.com. Dn1ziMKrc3NdJkSv8g61Y9WNk3+BAuwCwnYzAZiHmkejkSCPViLJN7+f4Conp9l8LkTl50ZnLgoYrrUYNhMj6w== ;{id = 30899}
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR AA NOERROR
+SECTION QUESTION
+ns.example.com. IN AAAA
+SECTION ANSWER
+SECTION AUTHORITY
+example.com. IN NS ns.example.com.
+example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
+example.com. 3600 IN RRSIG NS 5 2 3600 20070926134150 20070829134150 30899 example.com. YTqtYba73HIOQuPr5oDyIX9pfmz1ybEBjwlD/jUgcPmFINUOZ9FeqG6ywgRKwn4AizkKTK00p1sxZYMKxl91wg== ;{id = 30899}
+SECTION ADDITIONAL
+ns.example.com. IN A 1.2.3.4
+ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
+ns.example.com. 3600 IN RRSIG A 5 3 3600 20070926134150 20070829134150 30899 example.com. Dn1ziMKrc3NdJkSv8g61Y9WNk3+BAuwCwnYzAZiHmkejkSCPViLJN7+f4Conp9l8LkTl50ZnLgoYrrUYNhMj6w== ;{id = 30899}
+ENTRY_END
+
+
+; response to DNSKEY priming query
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+example.com. IN DNSKEY
+SECTION ANSWER
+example.com. 3600 IN DNSKEY 256 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 30899 (zsk), size = 512b}
+example.com. 3600 IN DNSKEY 256 3 3 ALXLUsWqUrY3JYER3T4TBJIIs70j+sDS/UT2QRp61SE7S3EEXopNXoFE73JLRmvpi/UrOO/Vz4Se6wXv/CYCKjGw06U4WRgRYXcpEhJROyNapmdIKSxhOzfLVE1gqA0PweZR8dtY3aNQSRn3sPpwJr6Mi/PqQKAMMrZ9ckJpf1+bQMOOvxgzz2U1GS18b3yZKcgTMEaJzd/GZYzi/BN2DzQ0MsrSwYXfsNLFOBbs8PJMW4LYIxeeOe6rUgkWOF7CC9Dh/dduQ1QrsJhmZAEFfd6ByYV+ ;{id = 2854 (zsk), size = 512b}
+example.com. 3600 IN RRSIG DNSKEY 3 2 3600 20070926134150 20070829134150 2854 example.com. AKIIYDOGHogglFqJK94ZtOnF7EfGikgAyloMNRSMCrQgFaFkmcOyjrc= ;{id = 2854}
+example.com. 3600 IN RRSIG DNSKEY 5 2 3600 20070926134150 20070829134150 30899 example.com. J55fsz1GGMnngc4r50xvXDUdaVMlfcLKLVsfMhwNLF+ERac5XV/lLRAc/aSER+qQdsSo0CrjYjy1wat7YQpDAA== ;{id = 30899}
+SECTION AUTHORITY
+example.com. IN NS ns.example.com.
+example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
+example.com. 3600 IN RRSIG NS 5 2 3600 20070926134150 20070829134150 30899 example.com. YTqtYba73HIOQuPr5oDyIX9pfmz1ybEBjwlD/jUgcPmFINUOZ9FeqG6ywgRKwn4AizkKTK00p1sxZYMKxl91wg== ;{id = 30899}
+SECTION ADDITIONAL
+ns.example.com. IN A 1.2.3.4
+ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
+ns.example.com. 3600 IN RRSIG A 5 3 3600 20070926134150 20070829134150 30899 example.com. Dn1ziMKrc3NdJkSv8g61Y9WNk3+BAuwCwnYzAZiHmkejkSCPViLJN7+f4Conp9l8LkTl50ZnLgoYrrUYNhMj6w== ;{id = 30899}
+ENTRY_END
+
+; response to query of interest
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+www.example.com. IN A
+SECTION ANSWER
+www.example.com. IN A 10.20.30.40
+ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCQMyTjn7WWwpwAR1LlVeLpRgZGuQIUCcJDEkwAuzytTDRlYK7nIMwH1CM= ;{id = 2854}
+www.example.com. 3600 IN RRSIG A 5 3 3600 20070926134150 20070829134150 30899 example.com. JNWECShNE+nCLQwOXJJ3xpUkh2G+FCh5nk8uYAHIVQRse/BIvCMSlvRrtVyw9RnXvk5RR2bEgN0pRdLWW7ug5Q== ;{id = 30899}
+SECTION AUTHORITY
+example.com. IN NS ns.example.com.
+example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
+example.com. 3600 IN RRSIG NS 5 2 3600 20070926134150 20070829134150 30899 example.com. YTqtYba73HIOQuPr5oDyIX9pfmz1ybEBjwlD/jUgcPmFINUOZ9FeqG6ywgRKwn4AizkKTK00p1sxZYMKxl91wg== ;{id = 30899}
+SECTION ADDITIONAL
+ns.example.com. IN A 1.2.3.4
+www.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFC99iE9K5y2WNgI0gFvBWaTi9wm6AhUAoUqOpDtG5Zct+Qr9F3mSdnbc6V4= ;{id = 2854}
+ns.example.com. 3600 IN RRSIG A 5 3 3600 20070926134150 20070829134150 30899 example.com. Dn1ziMKrc3NdJkSv8g61Y9WNk3+BAuwCwnYzAZiHmkejkSCPViLJN7+f4Conp9l8LkTl50ZnLgoYrrUYNhMj6w== ;{id = 30899}
+ENTRY_END
+RANGE_END
+
+STEP 1 QUERY
+ENTRY_BEGIN
+REPLY RD DO
+SECTION QUESTION
+www.example.com. IN A
+ENTRY_END
+
+; recursion happens here.
+STEP 10 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH all
+REPLY QR RD RA AD DO NOERROR
+SECTION QUESTION
+www.example.com. IN A
+SECTION ANSWER
+www.example.com. 3600 IN A 10.20.30.40
+www.example.com. 3600 IN RRSIG A 5 3 3600 20070926134150 20070829134150 30899 example.com. JNWECShNE+nCLQwOXJJ3xpUkh2G+FCh5nk8uYAHIVQRse/BIvCMSlvRrtVyw9RnXvk5RR2bEgN0pRdLWW7ug5Q== ;{id = 30899}
+www.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFC99iE9K5y2WNgI0gFvBWaTi9wm6AhUAoUqOpDtG5Zct+Qr9F3mSdnbc6V4= ;{id = 2854}
+
+SECTION AUTHORITY
+example.com. 3600 IN NS ns.example.com.
+example.com. 3600 IN RRSIG NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
+example.com. 3600 IN RRSIG NS 5 2 3600 20070926134150 20070829134150 30899 example.com. YTqtYba73HIOQuPr5oDyIX9pfmz1ybEBjwlD/jUgcPmFINUOZ9FeqG6ywgRKwn4AizkKTK00p1sxZYMKxl91wg== ;{id = 30899}
+
+SECTION ADDITIONAL
+ns.example.com. 3600 IN A 1.2.3.4
+ns.example.com. 3600 IN RRSIG A 3 3 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCQMyTjn7WWwpwAR1LlVeLpRgZGuQIUCcJDEkwAuzytTDRlYK7nIMwH1CM= ;{id = 2854}
+ns.example.com. 3600 IN RRSIG A 5 3 3600 20070926134150 20070829134150 30899 example.com. Dn1ziMKrc3NdJkSv8g61Y9WNk3+BAuwCwnYzAZiHmkejkSCPViLJN7+f4Conp9l8LkTl50ZnLgoYrrUYNhMj6w== ;{id = 30899}
+ENTRY_END
+
+SCENARIO_END
#ifdef calloc
#undef calloc
#endif
+#ifndef INT_MAX
+#define INT_MAX (((int)-1)>>1)
+#endif
/** calloc with stats */
void *unbound_stat_calloc(size_t nmemb, size_t size)
{
- size_t s = (nmemb*size==0)?(size_t)1:nmemb*size;
- void* res = calloc(1, s+16);
+ size_t s;
+ void* res;
+ if(nmemb != 0 && INT_MAX/nmemb < size)
+ return NULL; /* integer overflow check */
+ s = (nmemb*size==0)?(size_t)1:nmemb*size;
+ res = calloc(1, s+16);
if(!res) return NULL;
log_info("stat %p=calloc(%u, %u)", res+16, (unsigned)nmemb, (unsigned)size);
unbound_mem_alloc += s;
void *unbound_stat_calloc_lite(size_t nmemb, size_t size, const char* file,
int line, const char* func)
{
- size_t req = nmemb * size;
- void* res = malloc(req+lite_pad*2+sizeof(size_t));
+ size_t req;
+ void* res;
+ if(nmemb != 0 && INT_MAX/nmemb < size)
+ return NULL; /* integer overflow check */
+ req = nmemb * size;
+ res = malloc(req+lite_pad*2+sizeof(size_t));
if(!res) return NULL;
memmove(res, lite_pre, lite_pad);
memmove(res+lite_pad, &req, sizeof(size_t));
void* arg);
#ifdef UNBOUND_ALLOC_LITE
-# include <ldns/ldns.h>
-# include <ldns/packet.h>
+# include <sldns/ldns.h>
+# include <sldns/packet.h>
# ifdef HAVE_OPENSSL_SSL_H
# include <openssl/ssl.h>
# endif
#include "util/fptr_wlist.h"
#include "util/data/dname.h"
#include "util/rtt.h"
-#include "ldns/wire2str.h"
-#include "ldns/parseutil.h"
+#include "services/cache/infra.h"
+#include "sldns/wire2str.h"
+#include "sldns/parseutil.h"
#ifdef HAVE_GLOB_H
# include <glob.h>
#endif
cfg->bogus_ttl = 60;
cfg->min_ttl = 0;
cfg->max_ttl = 3600 * 24;
+ cfg->max_negative_ttl = 3600;
cfg->prefetch = 0;
cfg->prefetch_key = 0;
cfg->infra_cache_slabs = 4;
cfg->so_rcvbuf = 0;
cfg->so_sndbuf = 0;
cfg->so_reuseport = 0;
+ cfg->ip_transparent = 0;
cfg->num_ifs = 0;
cfg->ifs = NULL;
cfg->num_out_ifs = 0;
cfg->harden_dnssec_stripped = 1;
cfg->harden_below_nxdomain = 0;
cfg->harden_referral_path = 0;
+ cfg->harden_algo_downgrade = 1;
cfg->use_caps_bits_for_id = 0;
+ cfg->caps_whitelist = NULL;
cfg->private_address = NULL;
cfg->private_domain = NULL;
cfg->unwanted_threshold = 0;
if(!(cfg->dnstap_socket_path = strdup(DNSTAP_SOCKET_PATH)))
goto error_exit;
#endif
+ cfg->ratelimit = 0;
+ cfg->ratelimit_slabs = 4;
+ cfg->ratelimit_size = 4*1024*1024;
+ cfg->ratelimit_for_domain = NULL;
+ cfg->ratelimit_below_domain = NULL;
+ cfg->ratelimit_factor = 10;
return cfg;
error_exit:
config_delete(cfg);
else S_MEMSIZE("so-rcvbuf:", so_rcvbuf)
else S_MEMSIZE("so-sndbuf:", so_sndbuf)
else S_YNO("so-reuseport:", so_reuseport)
+ else S_YNO("ip-transparent:", ip_transparent)
else S_MEMSIZE("rrset-cache-size:", rrset_cache_size)
else S_POW2("rrset-cache-slabs:", rrset_cache_slabs)
else S_YNO("prefetch:", prefetch)
else S_YNO("prefetch-key:", prefetch_key)
else if(strcmp(opt, "cache-max-ttl:") == 0)
{ IS_NUMBER_OR_ZERO; cfg->max_ttl = atoi(val); MAX_TTL=(time_t)cfg->max_ttl;}
+ else if(strcmp(opt, "cache-max-negative-ttl:") == 0)
+ { IS_NUMBER_OR_ZERO; cfg->max_negative_ttl = atoi(val); MAX_NEG_TTL=(time_t)cfg->max_negative_ttl;}
else if(strcmp(opt, "cache-min-ttl:") == 0)
{ IS_NUMBER_OR_ZERO; cfg->min_ttl = atoi(val); MIN_TTL=(time_t)cfg->min_ttl;}
else if(strcmp(opt, "infra-cache-min-rtt:") == 0) {
else S_YNO("harden-dnssec-stripped:", harden_dnssec_stripped)
else S_YNO("harden-below-nxdomain:", harden_below_nxdomain)
else S_YNO("harden-referral-path:", harden_referral_path)
+ else S_YNO("harden-algo-downgrade:", harden_algo_downgrade)
else S_YNO("use-caps-for-id", use_caps_bits_for_id)
+ else S_STRLIST("caps-whitelist:", caps_whitelist)
else S_SIZET_OR_ZERO("unwanted-reply-threshold:", unwanted_threshold)
else S_STRLIST("private-address:", private_address)
else S_STRLIST("private-domain:", private_domain)
else S_STR("control-cert-file:", control_cert_file)
else S_STR("module-config:", module_conf)
else S_STR("python-script:", python_script)
+ else if(strcmp(opt, "ratelimit:") == 0) {
+ IS_NUMBER_OR_ZERO; cfg->ratelimit = atoi(val);
+ infra_dp_ratelimit=cfg->ratelimit;
+ }
+ else S_MEMSIZE("ratelimit-size:", ratelimit_size)
+ else S_POW2("ratelimit-slabs:", ratelimit_slabs)
+ else S_NUMBER_OR_ZERO("ratelimit-factor:", ratelimit_factor)
/* val_sig_skew_min and max are copied into val_env during init,
* so this does not update val_env with set_option */
else if(strcmp(opt, "val-sig-skew-min:") == 0)
{ IS_NUMBER_OR_ZERO; cfg->val_sig_skew_max = (int32_t)atoi(val); }
else if (strcmp(opt, "outgoing-interface:") == 0) {
char* d = strdup(val);
- char** oi = (char**)malloc((cfg->num_out_ifs+1)*sizeof(char*));
+ char** oi =
+ (char**)reallocarray(NULL, (size_t)cfg->num_out_ifs+1, sizeof(char*));
if(!d || !oi) { free(d); free(oi); return -1; }
if(cfg->out_ifs && cfg->num_out_ifs) {
memmove(oi, cfg->out_ifs, cfg->num_out_ifs*sizeof(char*));
* interface, outgoing-interface, access-control,
* stub-zone, name, stub-addr, stub-host, stub-prime
* forward-first, stub-first,
- * forward-zone, name, forward-addr, forward-host */
+ * forward-zone, name, forward-addr, forward-host,
+ * ratelimit-for-domain, ratelimit-below-domain */
return 0;
}
return 1;
#define O_MEM(opt, str, var) if(strcmp(opt, str)==0) { \
if(cfg->var > 1024*1024*1024) { \
size_t f=cfg->var/(size_t)1000000, b=cfg->var%(size_t)1000000; \
- snprintf(buf, len, "%u%6.6u\n", (unsigned)f, (unsigned)b); \
- } else snprintf(buf, len, "%u\n", (unsigned)cfg->var); \
+ snprintf(buf, len, "%u%6.6u", (unsigned)f, (unsigned)b); \
+ } else snprintf(buf, len, "%u", (unsigned)cfg->var); \
func(buf, arg);}
/** compare and print list option */
#define O_LST(opt, name, lst) if(strcmp(opt, name)==0) { \
else O_MEM(opt, "so-rcvbuf", so_rcvbuf)
else O_MEM(opt, "so-sndbuf", so_sndbuf)
else O_YNO(opt, "so-reuseport", so_reuseport)
+ else O_YNO(opt, "ip-transparent", ip_transparent)
else O_MEM(opt, "rrset-cache-size", rrset_cache_size)
else O_DEC(opt, "rrset-cache-slabs", rrset_cache_slabs)
else O_YNO(opt, "prefetch-key", prefetch_key)
else O_YNO(opt, "prefetch", prefetch)
else O_DEC(opt, "cache-max-ttl", max_ttl)
+ else O_DEC(opt, "cache-max-negative-ttl", max_negative_ttl)
else O_DEC(opt, "cache-min-ttl", min_ttl)
else O_DEC(opt, "infra-host-ttl", host_ttl)
else O_DEC(opt, "infra-cache-slabs", infra_cache_slabs)
else O_YNO(opt, "harden-dnssec-stripped", harden_dnssec_stripped)
else O_YNO(opt, "harden-below-nxdomain", harden_below_nxdomain)
else O_YNO(opt, "harden-referral-path", harden_referral_path)
+ else O_YNO(opt, "harden-algo-downgrade", harden_algo_downgrade)
else O_YNO(opt, "use-caps-for-id", use_caps_bits_for_id)
+ else O_LST(opt, "caps-whitelist", caps_whitelist)
else O_DEC(opt, "unwanted-reply-threshold", unwanted_threshold)
else O_YNO(opt, "do-not-query-localhost", donotquery_localhost)
else O_STR(opt, "module-config", module_conf)
else O_YNO(opt, "unblock-lan-zones", unblock_lan_zones)
else O_DEC(opt, "max-udp-size", max_udp_size)
else O_STR(opt, "python-script", python_script)
+ else O_DEC(opt, "ratelimit", ratelimit)
+ else O_MEM(opt, "ratelimit-size", ratelimit_size)
+ else O_DEC(opt, "ratelimit-slabs", ratelimit_slabs)
+ else O_LS2(opt, "ratelimit-for-domain", ratelimit_for_domain)
+ else O_LS2(opt, "ratelimit-below-domain", ratelimit_below_domain)
+ else O_DEC(opt, "ratelimit-factor", ratelimit_factor)
else O_DEC(opt, "val-sig-skew-min", val_sig_skew_min)
else O_DEC(opt, "val-sig-skew-max", val_sig_skew_max)
/* not here:
free(cfg->version);
free(cfg->module_conf);
free(cfg->outgoing_avail_ports);
+ config_delstrlist(cfg->caps_whitelist);
config_delstrlist(cfg->private_address);
config_delstrlist(cfg->private_domain);
config_delstrlist(cfg->auto_trust_anchor_file_list);
free(cfg->server_cert_file);
free(cfg->control_key_file);
free(cfg->control_cert_file);
+ free(cfg->dns64_prefix);
free(cfg->dnstap_socket_path);
free(cfg->dnstap_identity);
free(cfg->dnstap_version);
+ config_deldblstrlist(cfg->ratelimit_for_domain);
+ config_deldblstrlist(cfg->ratelimit_below_domain);
free(cfg);
}
*avail = NULL;
if(num == 0)
return 0;
- *avail = (int*)malloc(sizeof(int)*num);
+ *avail = (int*)reallocarray(NULL, (size_t)num, sizeof(int));
if(!*avail)
return 0;
for(i=0; i<65536; i++) {
{
MAX_TTL = (time_t)config->max_ttl;
MIN_TTL = (time_t)config->min_ttl;
+ MAX_NEG_TTL = (time_t)config->max_negative_ttl;
RTT_MIN_TIMEOUT = config->infra_cache_min_rtt;
EDNS_ADVERTISED_SIZE = (uint16_t)config->edns_buffer_size;
MINIMAL_RESPONSES = config->minimal_responses;
size_t so_sndbuf;
/** SO_REUSEPORT requested on port 53 sockets */
int so_reuseport;
+ /** IP_TRANSPARENT socket option requested on port 53 sockets */
+ int ip_transparent;
/** number of interfaces to open. If 0 default all interfaces. */
int num_ifs;
int harden_below_nxdomain;
/** harden the referral path, query for NS,A,AAAA and validate */
int harden_referral_path;
+ /** harden against algorithm downgrade */
+ int harden_algo_downgrade;
/** use 0x20 bits in query as random ID bits */
int use_caps_bits_for_id;
+ /** 0x20 whitelist, domains that do not use capsforid */
+ struct config_strlist* caps_whitelist;
/** strip away these private addrs from answers, no DNS Rebinding */
struct config_strlist* private_address;
/** allow domain (and subdomains) to use private address space */
int max_ttl;
/** the number of seconds minimum TTL used for RRsets and messages */
int min_ttl;
+ /** the number of seconds maximal negative TTL for SOA in auth */
+ int max_negative_ttl;
/** if prefetching of messages should be performed. */
int prefetch;
/** if prefetching of DNSKEYs should be performed. */
int dnstap_log_forwarder_query_messages;
/** true to log dnstap FORWARDER_RESPONSE message events */
int dnstap_log_forwarder_response_messages;
+
+ /** ratelimit 0 is off, otherwise qps (unless overridden) */
+ int ratelimit;
+ /** number of slabs for ratelimit cache */
+ size_t ratelimit_slabs;
+ /** memory size in bytes for ratelimit cache */
+ size_t ratelimit_size;
+ /** ratelimits for domain (exact match) */
+ struct config_str2list* ratelimit_for_domain;
+ /** ratelimits below domain */
+ struct config_str2list* ratelimit_below_domain;
+ /** ratelimit factor, 0 blocks all, 10 allows 1/10 of traffic */
+ int ratelimit_factor;
};
/** from cfg username, after daemonise setup performed */
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
-#define YY_NUM_RULES 164
-#define YY_END_OF_BUFFER 165
+#define YY_NUM_RULES 174
+#define YY_END_OF_BUFFER 175
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[1628] =
+static yyconst flex_int16_t yy_accept[1731] =
{ 0,
- 1, 1, 146, 146, 150, 150, 154, 154, 158, 158,
- 1, 1, 165, 162, 1, 144, 144, 163, 2, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 163, 146,
- 147, 147, 148, 163, 150, 151, 151, 152, 163, 157,
- 154, 155, 155, 156, 163, 158, 159, 159, 160, 163,
- 161, 145, 2, 149, 161, 163, 162, 0, 1, 2,
- 2, 2, 2, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
-
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 146, 0, 150, 0, 157, 0, 154, 158,
- 0, 161, 0, 2, 2, 161, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 161, 162, 162, 162, 162, 162, 162,
-
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 161, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
-
- 162, 162, 162, 162, 162, 66, 162, 162, 162, 162,
- 162, 6, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 161, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
-
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 161, 162, 162, 162, 162, 29, 162, 162, 162,
- 162, 162, 162, 162, 162, 131, 162, 12, 13, 162,
- 15, 14, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 124,
- 162, 162, 162, 162, 162, 3, 162, 162, 162, 162,
-
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 161, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 153, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 32, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 33, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
-
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 81, 153, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 80, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 64, 162, 162, 162, 162, 162, 162, 162, 162, 162,
-
- 162, 162, 162, 20, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 30, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 31, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 22, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
-
- 162, 162, 162, 162, 162, 162, 26, 162, 27, 162,
- 162, 162, 67, 162, 68, 162, 65, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 5, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 83, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 23,
- 162, 162, 162, 162, 108, 107, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
-
- 162, 162, 162, 162, 162, 34, 162, 162, 162, 162,
- 162, 162, 162, 162, 70, 69, 162, 162, 162, 162,
- 162, 162, 162, 104, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 51, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 55, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 106, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 4, 162, 162, 162, 162, 162, 162,
-
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 101, 162, 162,
- 162, 162, 162, 162, 162, 117, 162, 102, 162, 129,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 21, 162, 162, 162, 162, 72, 162, 73, 71, 162,
- 162, 162, 162, 162, 162, 79, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 103, 162, 162, 162,
- 162, 128, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 63, 162, 162, 162, 162, 162, 162,
-
- 162, 162, 28, 162, 162, 17, 162, 162, 162, 16,
- 162, 88, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 41, 42, 162, 162, 162,
- 162, 162, 162, 162, 132, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 74, 162,
- 162, 162, 162, 162, 78, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 82, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 123, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 92,
-
- 162, 96, 162, 162, 162, 162, 77, 162, 162, 115,
- 162, 162, 162, 162, 130, 162, 162, 162, 162, 162,
- 162, 162, 137, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 95, 162, 162, 162, 162, 162, 43,
- 44, 162, 50, 97, 162, 109, 105, 162, 162, 37,
- 162, 99, 162, 162, 162, 162, 162, 7, 162, 62,
- 114, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 84, 136, 162,
- 162, 162, 162, 162, 162, 162, 162, 125, 162, 162,
-
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 98, 162, 36, 38, 162, 162, 162, 162, 162,
- 61, 162, 162, 162, 162, 119, 18, 19, 162, 162,
- 162, 162, 162, 162, 162, 59, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 121, 118, 162, 162, 162,
- 162, 162, 162, 162, 162, 35, 162, 162, 162, 162,
- 162, 162, 11, 162, 162, 162, 162, 162, 162, 162,
- 162, 10, 162, 162, 39, 162, 127, 120, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 91,
- 90, 162, 122, 116, 162, 162, 162, 162, 162, 162,
-
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 45, 162, 126, 162, 162, 162, 162, 40, 162,
- 162, 162, 85, 87, 110, 162, 162, 162, 89, 162,
- 162, 162, 162, 162, 162, 162, 162, 133, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 24, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 135, 162, 162,
- 113, 162, 162, 162, 162, 162, 162, 48, 162, 25,
- 162, 9, 162, 162, 111, 52, 162, 162, 162, 94,
- 162, 162, 162, 162, 162, 162, 134, 75, 162, 162,
-
- 162, 54, 58, 53, 162, 46, 162, 8, 162, 162,
- 93, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 57, 162, 47, 162, 112, 162, 162, 86, 162, 162,
- 162, 162, 162, 162, 76, 56, 49, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 60, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 100, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
-
- 162, 140, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 138, 162, 141, 142, 162,
- 162, 162, 162, 162, 139, 143, 0
+ 1, 1, 156, 156, 160, 160, 164, 164, 168, 168,
+ 1, 1, 175, 172, 1, 154, 154, 173, 2, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 173, 156,
+ 157, 157, 158, 173, 160, 161, 161, 162, 173, 167,
+ 164, 165, 165, 166, 173, 168, 169, 169, 170, 173,
+ 171, 155, 2, 159, 171, 173, 172, 0, 1, 2,
+ 2, 2, 2, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 156, 0, 160, 0, 167, 0, 164,
+ 168, 0, 171, 0, 2, 2, 171, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 171, 172, 172, 172,
+
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 171, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 70, 172, 172, 172, 172, 172, 6,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 171, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 171, 172, 172, 172, 172, 172, 30,
+ 172, 172, 172, 172, 172, 172, 172, 172, 135, 172,
+ 12, 13, 172, 15, 14, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+
+ 172, 172, 172, 128, 172, 172, 172, 172, 172, 172,
+ 3, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 171, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 163, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 33, 172, 172, 172, 172, 172, 172, 172,
+
+ 172, 172, 34, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 85, 163, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 84, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 68, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 20, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 31, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 32, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+
+ 22, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 148, 172, 172,
+ 172, 172, 172, 172, 26, 172, 27, 172, 172, 172,
+ 71, 172, 72, 172, 69, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 5, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 87, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 23, 172, 172, 172, 172, 172, 112, 111, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 35, 172, 172, 172, 172, 172, 172, 172, 172, 74,
+ 73, 172, 172, 172, 172, 172, 172, 172, 108, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 53, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+
+ 172, 172, 172, 172, 57, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 110, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 4, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 105, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 121, 172, 106, 172, 133, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 21, 172, 172, 172,
+
+ 172, 76, 172, 77, 75, 172, 172, 172, 172, 172,
+ 172, 172, 83, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 107, 172, 172, 172, 172, 132,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 67, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 28, 172, 172, 17, 172,
+ 172, 172, 16, 172, 92, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 42,
+ 44, 172, 172, 172, 172, 172, 172, 172, 172, 136,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+
+ 172, 172, 172, 78, 172, 172, 172, 172, 172, 172,
+ 82, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 86, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 127,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 96, 172, 100, 172, 172, 172, 172, 81, 172,
+ 172, 63, 172, 119, 172, 172, 172, 172, 134, 172,
+ 172, 172, 172, 172, 172, 172, 141, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 99, 172,
+
+ 172, 172, 172, 172, 45, 46, 172, 29, 52, 101,
+ 172, 113, 109, 172, 172, 38, 172, 103, 172, 172,
+ 172, 172, 172, 7, 172, 66, 172, 172, 172, 150,
+ 172, 118, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 88,
+ 140, 172, 172, 172, 172, 172, 172, 172, 172, 129,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 102, 172, 37, 39, 172, 172,
+ 172, 172, 172, 65, 172, 172, 172, 149, 172, 172,
+
+ 172, 172, 123, 18, 19, 172, 172, 172, 172, 172,
+ 172, 172, 62, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 125, 122, 172, 172, 172, 172, 172,
+ 172, 172, 172, 36, 172, 172, 172, 172, 172, 172,
+ 172, 11, 172, 172, 172, 172, 172, 172, 172, 172,
+ 10, 172, 172, 172, 153, 172, 40, 172, 131, 124,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 95, 94, 172, 172, 126, 120, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 47, 172, 130, 172, 172,
+
+ 172, 172, 172, 172, 41, 172, 172, 172, 89, 91,
+ 114, 172, 172, 172, 93, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 137, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 24,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 139, 172,
+ 172, 117, 172, 172, 172, 172, 172, 172, 172, 50,
+ 172, 25, 172, 9, 172, 172, 172, 172, 115, 54,
+ 172, 172, 172, 98, 172, 172, 172, 172, 172, 172,
+ 172, 138, 79, 172, 172, 172, 172, 56, 60, 55,
+
+ 172, 48, 172, 8, 172, 151, 172, 172, 97, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 61,
+ 59, 172, 49, 172, 172, 116, 172, 172, 90, 43,
+ 172, 172, 172, 172, 172, 172, 80, 58, 51, 152,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 64, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 104, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+
+ 172, 172, 172, 172, 144, 172, 172, 172, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 172, 142, 172,
+ 145, 146, 172, 172, 172, 172, 172, 143, 147, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int16_t yy_base[1642] =
+static yyconst flex_int16_t yy_base[1745] =
{ 0,
0, 0, 63, 66, 69, 71, 77, 83, 88, 91,
- 129, 135, 428, 340, 95, 4681, 4681, 4681, 107, 110,
+ 129, 135, 378, 309, 95, 5006, 5006, 5006, 107, 110,
142, 180, 108, 50, 145, 172, 118, 148, 121, 181,
- 197, 166, 217, 223, 251, 230, 164, 262, 116, 312,
- 4681, 4681, 4681, 94, 298, 4681, 4681, 4681, 96, 269,
- 294, 4681, 4681, 4681, 244, 254, 4681, 4681, 4681, 102,
- 249, 4681, 259, 4681, 247, 287, 237, 309, 111, 0,
- 313, 0, 0, 284, 170, 265, 288, 289, 296, 305,
- 301, 273, 302, 328, 306, 311, 308, 309, 216, 325,
- 329, 339, 353, 344, 356, 357, 338, 365, 346, 367,
-
- 369, 368, 372, 373, 394, 386, 402, 383, 392, 399,
- 396, 400, 401, 410, 423, 421, 419, 426, 431, 438,
- 428, 434, 203, 159, 177, 169, 141, 483, 165, 122,
- 174, 115, 490, 494, 0, 461, 463, 467, 477, 485,
- 481, 478, 501, 495, 476, 510, 554, 245, 480, 506,
- 490, 512, 509, 504, 517, 534, 497, 545, 551, 533,
- 539, 538, 561, 587, 560, 577, 543, 571, 579, 573,
- 596, 590, 588, 583, 599, 585, 600, 601, 598, 604,
- 611, 621, 623, 602, 349, 630, 645, 625, 634, 641,
- 657, 651, 660, 643, 658, 666, 663, 649, 665, 638,
-
- 678, 669, 685, 690, 213, 696, 698, 684, 693, 692,
- 705, 701, 702, 689, 713, 726, 737, 718, 716, 721,
- 733, 743, 729, 735, 740, 753, 748, 745, 765, 741,
- 760, 763, 771, 786, 759, 790, 774, 780, 787, 797,
- 799, 801, 810, 807, 803, 812, 806, 837, 821, 828,
- 834, 809, 814, 824, 830, 838, 846, 863, 854, 908,
- 864, 869, 865, 856, 870, 874, 862, 887, 873, 889,
- 902, 898, 903, 912, 916, 914, 954, 913, 939, 940,
- 934, 960, 938, 945, 943, 949, 959, 969, 973, 970,
- 982, 985, 976, 983, 981, 992, 996, 978, 1002, 1001,
-
- 1010, 1015, 1012, 1003, 1021, 4681, 1026, 1004, 1028, 1023,
- 1033, 4681, 1037, 1038, 1020, 1041, 1048, 1006, 1044, 1047,
- 1049, 1063, 1051, 1072, 1064, 1060, 1107, 1075, 1076, 1104,
- 1098, 1085, 1110, 1089, 1116, 1103, 1112, 1131, 1102, 1125,
- 1122, 1144, 1136, 1141, 1157, 1130, 1150, 1148, 1151, 899,
- 1158, 1160, 1173, 1152, 1178, 1179, 1169, 1177, 1159, 1192,
- 1205, 1202, 1207, 1213, 1189, 1206, 1208, 1217, 1214, 1215,
- 1201, 1219, 1222, 1209, 1248, 1225, 1237, 1234, 1249, 1240,
- 1253, 1254, 1250, 1261, 1246, 1280, 1269, 1268, 1288, 1294,
- 1267, 1282, 1284, 1299, 1302, 1303, 1314, 1275, 1307, 1310,
-
- 1342, 1318, 1317, 1321, 1331, 1333, 1327, 1332, 1335, 1344,
- 1341, 1343, 1350, 1337, 1348, 1371, 1370, 1373, 1376, 1366,
- 1368, 1377, 1378, 1386, 1389, 1397, 1401, 1392, 1400, 1411,
- 1408, 1416, 1412, 1426, 1404, 1431, 4681, 1445, 1442, 1424,
- 1437, 1448, 1443, 1435, 1484, 4681, 1439, 4681, 4681, 1451,
- 4681, 4681, 1465, 1438, 1473, 1449, 1532, 1475, 1467, 1472,
- 1483, 1490, 1491, 1504, 1499, 1518, 1525, 1510, 1502, 1508,
- 1513, 1537, 1541, 1535, 1542, 1543, 1561, 1562, 1557, 1566,
- 1559, 1565, 1558, 1570, 1574, 1579, 1582, 1586, 1577, 4681,
- 1588, 1584, 1594, 1592, 1609, 4681, 1589, 1600, 1603, 1606,
-
- 1613, 1611, 1619, 1625, 1623, 1630, 1633, 1634, 1637, 1639,
- 1640, 1618, 1667, 1661, 1652, 1660, 1668, 1653, 1676, 1682,
- 1680, 1666, 1678, 1686, 1669, 1685, 1690, 1687, 1693, 1696,
- 1695, 1694, 1744, 1721, 1712, 1705, 1716, 1701, 1723, 1742,
- 1732, 1746, 1757, 1763, 1752, 1754, 1764, 1771, 1774, 1802,
- 1780, 1782, 1788, 1793, 1792, 1798, 1799, 1795, 1740, 1807,
- 4681, 1790, 1815, 1812, 1819, 1838, 1817, 1839, 1830, 1842,
- 1833, 1837, 1841, 1856, 4681, 1835, 1855, 1852, 1866, 1879,
- 1880, 1863, 1860, 1890, 4681, 1895, 1888, 1893, 1882, 1881,
- 1899, 1883, 1898, 1900, 1907, 1917, 1908, 1918, 1912, 1919,
-
- 1935, 1924, 1928, 1916, 1939, 1944, 1945, 1940, 1951, 1946,
- 1941, 1960, 1963, 1955, 1961, 1956, 1972, 1977, 120, 1973,
- 1983, 1974, 1969, 4681, 76, 1981, 1988, 1978, 2010, 2011,
- 2004, 2000, 2012, 2018, 2002, 2005, 2013, 2015, 2033, 2025,
- 2029, 2027, 2045, 2044, 2041, 2050, 2054, 2040, 2056, 2061,
- 2059, 2074, 2063, 2076, 2060, 2083, 2084, 2077, 2075, 2087,
- 2095, 2091, 2085, 2103, 2106, 4681, 2121, 2105, 2112, 2109,
- 2126, 2138, 2118, 2128, 2134, 2132, 2148, 2139, 2146, 2153,
- 2158, 2147, 2155, 2145, 2161, 2164, 2157, 2173, 2183, 2175,
- 4681, 2189, 2180, 2185, 2184, 2187, 2200, 2191, 2211, 2190,
-
- 2209, 2216, 2221, 4681, 2220, 2232, 2222, 2234, 2219, 2240,
- 2246, 2244, 2225, 2248, 2247, 2249, 2256, 2242, 2259, 2263,
- 4681, 2266, 2267, 2272, 2283, 2276, 2269, 2278, 2291, 2275,
- 2284, 2302, 2281, 2286, 2282, 2313, 2297, 2294, 2305, 2315,
- 2303, 2330, 4681, 2343, 2322, 2328, 2346, 2311, 2341, 2347,
- 2334, 2337, 2333, 2349, 2360, 2353, 2357, 2362, 2361, 2363,
- 2381, 2354, 2372, 2380, 2390, 2396, 2384, 2394, 2398, 2399,
- 2389, 2409, 2404, 2419, 2426, 4681, 2420, 2428, 2421, 2415,
- 2443, 2438, 2425, 2430, 2424, 2437, 2439, 2462, 2440, 2454,
- 2455, 2460, 2461, 2442, 2453, 2477, 2480, 2487, 2471, 2483,
-
- 2476, 2493, 2489, 2495, 2488, 2501, 4681, 2506, 4681, 2504,
- 2512, 2521, 4681, 2525, 4681, 2527, 4681, 2526, 2531, 2515,
- 2516, 2520, 2533, 2522, 2544, 2535, 2545, 2547, 2539, 2559,
- 2548, 2565, 4681, 2558, 2564, 2579, 2561, 2573, 2575, 2582,
- 2594, 2583, 2592, 2587, 2590, 2589, 2607, 4681, 2574, 2614,
- 2606, 2603, 2626, 2628, 2622, 2634, 2630, 2611, 2645, 2641,
- 2646, 2633, 2639, 2649, 2659, 2654, 2660, 2652, 2662, 2666,
- 2663, 2668, 2685, 2670, 2687, 2702, 2681, 2686, 2695, 4681,
- 2690, 2696, 2709, 2704, 4681, 4681, 2680, 2722, 2714, 2708,
- 2728, 2715, 2741, 2729, 2743, 2740, 2739, 2731, 2736, 2746,
-
- 2747, 2751, 2756, 2763, 2758, 4681, 2766, 2764, 2792, 2783,
- 2774, 2796, 2784, 2795, 4681, 4681, 2799, 2787, 2790, 2786,
- 2806, 2802, 2810, 4681, 2816, 2811, 2825, 2834, 2835, 2832,
- 2821, 2831, 2820, 2837, 2838, 2842, 2853, 2848, 2852, 2866,
- 2856, 2871, 2876, 4681, 2873, 2884, 2877, 2880, 2879, 2878,
- 2881, 2886, 2905, 2875, 2904, 2894, 2924, 2907, 2906, 2909,
- 2910, 2915, 2926, 2930, 2942, 2936, 4681, 2944, 2931, 2947,
- 2920, 2948, 2958, 2954, 2965, 2940, 2941, 2953, 2943, 2982,
- 2963, 2992, 2974, 4681, 2986, 2983, 2981, 2990, 2998, 2976,
- 3011, 2988, 3010, 4681, 3013, 3003, 3008, 3020, 3031, 3037,
-
- 3023, 3016, 3029, 3030, 3033, 3040, 3043, 3051, 3050, 3062,
- 3047, 3058, 3069, 3080, 3086, 3085, 3057, 3075, 3094, 3079,
- 3088, 3089, 3073, 3107, 3082, 3109, 3096, 4681, 3114, 3097,
- 3111, 3116, 3115, 3121, 3123, 4681, 3124, 4681, 3118, 4681,
- 3125, 3126, 3113, 3146, 3140, 3142, 3135, 3160, 3150, 3149,
- 4681, 3167, 3153, 3166, 3169, 4681, 3170, 4681, 4681, 3172,
- 3176, 3157, 3180, 3187, 3183, 4681, 3184, 3192, 3199, 3195,
- 3188, 3205, 3208, 3211, 3206, 3210, 4681, 3219, 3226, 3207,
- 3231, 4681, 3215, 3241, 3233, 3238, 3247, 3256, 3257, 3227,
- 3244, 3267, 3268, 4681, 3250, 3252, 3275, 3270, 3278, 3279,
-
- 3271, 3289, 4681, 3294, 3298, 4681, 3291, 3265, 3295, 4681,
- 3307, 4681, 3309, 3305, 3302, 3310, 3323, 3324, 3335, 3322,
- 3339, 3340, 3331, 3348, 3347, 4681, 4681, 3350, 3352, 3356,
- 3349, 3346, 3358, 3353, 4681, 3362, 3373, 3342, 3366, 3389,
- 3377, 3380, 3397, 3398, 3384, 3401, 3383, 3393, 4681, 3391,
- 3400, 3410, 3405, 3413, 4681, 3403, 3432, 3425, 3427, 3430,
- 3444, 3447, 3448, 3436, 3450, 3451, 3437, 3453, 3455, 3454,
- 4681, 3461, 3460, 3465, 3467, 3468, 3463, 3476, 3488, 3485,
- 3472, 3497, 4681, 3498, 3475, 3506, 3496, 3502, 3503, 3492,
- 3509, 3499, 3516, 3512, 3528, 3529, 3526, 3546, 3541, 4681,
-
- 3530, 4681, 3542, 3557, 3556, 3561, 4681, 3544, 3548, 4681,
- 3563, 3569, 3571, 3576, 4681, 3579, 3567, 3594, 3580, 3585,
- 3583, 3603, 4681, 3578, 3597, 3611, 3608, 3596, 3610, 3605,
- 3612, 3619, 3622, 4681, 3618, 3615, 3637, 3640, 3649, 4681,
- 4681, 3635, 4681, 4681, 3650, 4681, 4681, 3652, 3653, 4681,
- 3654, 4681, 3660, 3658, 3655, 3643, 3661, 4681, 3668, 4681,
- 4681, 3664, 3670, 3675, 3678, 3673, 3674, 3690, 3682, 3685,
- 3692, 3695, 3696, 3701, 3691, 3713, 3705, 3698, 3700, 3702,
- 3712, 3723, 3725, 3721, 3739, 3745, 3746, 4681, 4681, 3729,
- 3740, 3732, 3735, 3748, 3741, 3742, 3764, 4681, 3774, 3768,
-
- 3763, 3762, 3775, 3767, 3779, 3786, 3800, 3781, 3782, 3784,
- 3792, 4681, 3795, 4681, 4681, 3796, 3815, 3817, 3806, 3810,
- 4681, 3829, 3813, 3831, 3834, 4681, 4681, 4681, 3835, 3824,
- 3838, 3844, 3845, 3833, 3856, 4681, 3839, 3848, 3862, 3842,
- 3868, 3870, 3882, 3885, 3886, 4681, 4681, 3891, 3884, 3887,
- 3881, 3878, 3894, 3895, 3889, 4681, 3896, 3897, 3898, 3921,
- 3905, 3922, 4681, 3916, 3918, 3917, 3939, 3932, 3940, 3934,
- 3945, 4681, 3937, 3943, 4681, 3947, 4681, 4681, 3933, 3951,
- 3968, 3954, 3955, 3975, 3958, 3970, 3990, 3987, 3985, 4681,
- 4681, 3982, 4681, 4681, 3974, 3994, 3978, 3973, 4008, 4004,
-
- 4005, 3998, 4009, 4012, 4011, 4002, 4010, 4015, 4034, 4025,
- 4026, 4681, 4044, 4681, 4032, 4048, 4052, 4049, 4681, 4051,
- 4053, 4037, 4681, 4681, 4681, 4061, 4068, 4054, 4681, 4077,
- 4075, 4070, 4081, 4076, 4071, 4074, 4100, 4681, 4087, 4090,
- 4107, 4101, 4096, 4097, 4111, 4115, 4103, 4122, 4117, 4125,
- 4126, 4681, 4135, 4121, 4118, 4150, 4151, 4138, 4142, 4139,
- 4155, 4148, 4156, 4145, 4174, 4162, 4171, 4681, 4173, 4166,
- 4681, 4176, 4187, 4194, 4195, 4196, 4197, 4681, 4199, 4681,
- 4203, 4681, 4205, 4206, 4681, 4681, 4200, 4209, 4210, 4681,
- 4213, 4198, 4212, 4229, 4223, 4236, 4681, 4681, 4231, 4234,
-
- 4245, 4681, 4681, 4681, 4248, 4681, 4250, 4681, 4252, 4238,
- 4681, 4239, 4259, 4235, 4255, 4262, 4264, 4280, 4271, 4267,
- 4681, 4288, 4681, 4292, 4681, 4281, 4294, 4681, 4303, 4286,
- 4296, 4287, 4284, 4289, 4681, 4681, 4681, 4314, 4304, 4312,
- 4307, 4317, 4320, 4313, 4322, 4342, 4334, 4341, 4345, 4329,
- 4333, 4359, 4344, 4681, 4351, 4355, 4361, 4363, 4353, 4370,
- 4357, 4365, 4368, 4378, 4385, 4377, 4384, 4394, 4381, 4401,
- 4404, 4408, 4410, 4403, 4411, 4417, 4412, 4405, 4414, 4438,
- 4426, 4430, 4681, 4442, 4429, 4431, 4439, 4453, 4456, 4436,
- 4458, 4463, 4457, 4460, 4449, 4471, 4466, 4485, 4477, 4494,
-
- 4478, 4681, 4498, 4501, 4483, 4488, 4508, 4495, 4512, 4510,
- 4513, 4520, 4516, 4517, 4525, 4681, 4537, 4681, 4681, 4540,
- 4529, 4530, 4546, 4550, 4681, 4681, 4681, 4589, 4596, 4603,
- 4610, 4617, 82, 4624, 4631, 4638, 4645, 4652, 4659, 4666,
- 4673
+ 197, 166, 217, 233, 252, 236, 164, 269, 116, 298,
+ 5006, 5006, 5006, 94, 295, 5006, 5006, 5006, 96, 249,
+ 265, 5006, 5006, 5006, 238, 216, 5006, 5006, 5006, 102,
+ 214, 5006, 290, 5006, 259, 257, 209, 312, 111, 0,
+ 316, 0, 0, 265, 170, 283, 310, 296, 301, 306,
+ 302, 297, 308, 325, 317, 312, 330, 333, 345, 329,
+ 336, 361, 250, 343, 368, 376, 347, 341, 365, 377,
+
+ 372, 380, 388, 370, 382, 398, 413, 399, 403, 408,
+ 409, 410, 414, 260, 415, 437, 426, 436, 412, 445,
+ 450, 449, 439, 193, 159, 177, 169, 141, 298, 165,
+ 122, 174, 115, 488, 497, 0, 464, 470, 262, 471,
+ 485, 477, 484, 480, 505, 498, 435, 509, 553, 513,
+ 491, 511, 492, 517, 523, 508, 519, 539, 541, 526,
+ 544, 543, 549, 556, 568, 579, 581, 578, 561, 583,
+ 588, 601, 602, 592, 597, 584, 607, 594, 609, 618,
+ 610, 612, 622, 611, 628, 626, 615, 639, 644, 652,
+ 637, 645, 660, 662, 667, 663, 658, 650, 668, 671,
+
+ 681, 679, 678, 673, 694, 674, 701, 709, 213, 711,
+ 713, 700, 707, 720, 715, 708, 728, 718, 724, 743,
+ 734, 733, 736, 735, 744, 763, 740, 761, 750, 760,
+ 770, 766, 762, 759, 773, 777, 781, 790, 808, 778,
+ 804, 795, 799, 809, 813, 819, 822, 801, 820, 828,
+ 831, 833, 825, 851, 847, 846, 855, 870, 858, 850,
+ 849, 857, 873, 876, 888, 928, 878, 877, 880, 889,
+ 894, 890, 922, 896, 905, 897, 911, 937, 907, 934,
+ 945, 935, 954, 967, 936, 952, 957, 962, 958, 978,
+ 970, 963, 971, 983, 986, 995, 987, 1005, 1000, 998,
+
+ 1007, 1011, 1004, 1020, 1015, 1003, 1019, 1025, 1032, 1038,
+ 1035, 1029, 1044, 5006, 1048, 1033, 1053, 1059, 1046, 5006,
+ 1062, 1063, 1043, 1060, 1073, 1066, 1095, 1076, 1070, 1077,
+ 1075, 1084, 1102, 1096, 1089, 1139, 1097, 1111, 1132, 1130,
+ 1116, 1114, 1121, 1148, 1135, 1141, 1143, 1142, 1129, 1166,
+ 1170, 1162, 1168, 1180, 1190, 1175, 1173, 1186, 1188, 1194,
+ 1189, 1192, 1200, 1197, 1202, 1206, 1238, 1223, 1220, 1235,
+ 1213, 1237, 1241, 1246, 1224, 1239, 1249, 1247, 1250, 1243,
+ 1240, 1259, 1251, 1255, 1276, 1289, 1267, 1277, 1262, 1283,
+ 1294, 1296, 1293, 1286, 1302, 1312, 1318, 1305, 1308, 1306,
+
+ 1334, 1326, 1320, 1329, 1335, 1339, 1341, 1348, 1347, 1354,
+ 1350, 1373, 1382, 1361, 1352, 1370, 1362, 1365, 1366, 1374,
+ 1392, 1375, 1389, 1387, 1393, 1399, 1398, 1412, 1402, 1411,
+ 1410, 1414, 1409, 1421, 1420, 1419, 1436, 1440, 1447, 1432,
+ 1446, 1449, 1442, 1455, 1459, 1461, 1454, 1489, 1457, 5006,
+ 1468, 1474, 1479, 1476, 1488, 1481, 1482, 1530, 5006, 1485,
+ 5006, 5006, 1487, 5006, 5006, 1501, 1505, 1493, 1517, 1579,
+ 1514, 1518, 1523, 1526, 1533, 1540, 1550, 1528, 1557, 1562,
+ 1563, 1569, 1567, 1574, 1592, 1601, 1584, 1585, 1577, 1605,
+ 1534, 1544, 1613, 1611, 1614, 1615, 1618, 1626, 1627, 1621,
+
+ 1625, 1639, 1628, 5006, 1637, 1648, 1642, 1658, 1650, 1668,
+ 5006, 1641, 1667, 1649, 1660, 1666, 1664, 1673, 1677, 1678,
+ 1683, 1692, 1676, 1706, 1693, 1700, 1720, 1722, 1717, 1705,
+ 1718, 1726, 1715, 1733, 1729, 1732, 1719, 1725, 1747, 1746,
+ 1750, 1754, 1740, 1764, 1751, 1745, 1757, 1756, 1801, 1782,
+ 1760, 1763, 1765, 1784, 1791, 1794, 1796, 1799, 1815, 1819,
+ 1811, 1813, 1829, 1839, 1823, 1847, 1842, 1831, 1850, 1856,
+ 1858, 1857, 1852, 1851, 1869, 1867, 1872, 5006, 1875, 1887,
+ 1874, 1884, 1899, 1879, 1889, 1900, 1891, 1902, 1892, 1894,
+ 1913, 1917, 5006, 1911, 1915, 1926, 1918, 1938, 1942, 1919,
+
+ 1950, 1952, 5006, 1956, 1957, 1959, 1944, 1939, 1953, 1960,
+ 1955, 1967, 1970, 1986, 1977, 1989, 1996, 1997, 1980, 2002,
+ 1983, 1990, 1988, 1999, 2013, 2016, 2019, 2011, 2020, 2015,
+ 2034, 2038, 2029, 2049, 2032, 2036, 2040, 120, 2035, 2046,
+ 2041, 2045, 5006, 76, 2061, 2042, 2054, 2087, 2089, 2081,
+ 2085, 2077, 2078, 2088, 2079, 2076, 2083, 2080, 2096, 2082,
+ 2105, 2104, 2127, 2125, 2122, 2119, 2131, 2117, 2132, 2137,
+ 2120, 2138, 2121, 2146, 2136, 2156, 2159, 2168, 2164, 2160,
+ 2157, 2162, 2182, 2166, 2165, 2187, 5006, 2186, 2183, 2191,
+ 2184, 2189, 2229, 2200, 2216, 2207, 2213, 2232, 2234, 2225,
+
+ 2228, 2236, 2239, 2240, 2224, 2223, 2243, 2246, 2249, 2265,
+ 2268, 2247, 5006, 2267, 2263, 2261, 2287, 2266, 2270, 2283,
+ 2285, 2290, 2275, 2301, 2288, 2319, 5006, 2317, 2316, 2304,
+ 2322, 2305, 2324, 2328, 2329, 2314, 2331, 2330, 2332, 2339,
+ 2327, 2347, 2335, 5006, 2343, 2372, 2366, 2377, 2367, 2356,
+ 2368, 2378, 2361, 2359, 2388, 2387, 2365, 2384, 2373, 2389,
+ 2393, 2394, 2404, 2405, 2402, 2421, 5006, 2439, 2415, 2428,
+ 2431, 2416, 2442, 2423, 2434, 2437, 2441, 2444, 2454, 2447,
+ 2450, 2469, 2457, 2460, 2464, 2461, 2480, 2463, 2488, 2491,
+ 2494, 2483, 2502, 2489, 2506, 2487, 2514, 2517, 2521, 2522,
+
+ 5006, 2524, 2509, 2525, 2518, 2515, 2547, 2537, 2536, 2539,
+ 2541, 2543, 2550, 2544, 2546, 2553, 2557, 2559, 2561, 2560,
+ 2564, 2568, 2585, 2589, 2584, 2591, 2607, 5006, 2594, 2598,
+ 2596, 2606, 2595, 2608, 5006, 2611, 5006, 2625, 2618, 2635,
+ 5006, 2632, 5006, 2639, 5006, 2640, 2646, 2633, 2624, 2636,
+ 2653, 2654, 2644, 2641, 2663, 2656, 2668, 2680, 2667, 2660,
+ 5006, 2671, 2683, 2681, 2688, 2692, 2694, 2690, 2698, 2700,
+ 2696, 2676, 2710, 2704, 2708, 2732, 2727, 5006, 2716, 2735,
+ 2726, 2724, 2752, 2746, 2729, 2739, 2742, 2725, 2761, 2772,
+ 2775, 2760, 2762, 2763, 2779, 2790, 2769, 2788, 2780, 2789,
+
+ 2777, 2798, 2803, 2786, 2797, 2799, 2802, 2808, 2811, 2813,
+ 5006, 2827, 2822, 2826, 2835, 2825, 5006, 5006, 2842, 2840,
+ 2846, 2849, 2839, 2853, 2870, 2854, 2850, 2856, 2864, 2873,
+ 2867, 2874, 2862, 2875, 2894, 2880, 2898, 2904, 2915, 2890,
+ 5006, 2902, 2910, 2914, 2912, 2906, 2920, 2921, 2935, 5006,
+ 5006, 2932, 2923, 2925, 2930, 2960, 2942, 2946, 5006, 2948,
+ 2962, 2967, 2969, 2973, 2970, 2954, 2965, 2982, 2976, 2981,
+ 2971, 2999, 2993, 3006, 3001, 2996, 3010, 3018, 3019, 3021,
+ 5006, 3015, 3025, 3017, 3026, 3023, 3035, 3039, 3050, 3048,
+ 3040, 3046, 3036, 3038, 3051, 3049, 3044, 3069, 3059, 3080,
+
+ 3083, 3081, 3093, 3087, 5006, 3096, 3076, 3097, 3073, 3101,
+ 3103, 3106, 3122, 3091, 3095, 3099, 3102, 3118, 3105, 3121,
+ 3126, 3117, 5006, 3131, 3150, 3142, 3144, 3143, 3129, 3158,
+ 3146, 3149, 5006, 3170, 3164, 3160, 3174, 3183, 3184, 3179,
+ 3173, 3178, 3191, 3177, 3186, 3197, 3199, 3200, 3208, 3203,
+ 3220, 3228, 3221, 3231, 3213, 3224, 3246, 3233, 3249, 3247,
+ 3226, 3242, 3248, 3245, 3258, 3251, 3241, 3271, 3255, 3274,
+ 3268, 5006, 3283, 3287, 3291, 3292, 3276, 3293, 3289, 3300,
+ 3302, 5006, 3303, 5006, 3285, 5006, 3305, 3309, 3314, 3313,
+ 3310, 3312, 3321, 3337, 3275, 3329, 5006, 3345, 3332, 3338,
+
+ 3344, 5006, 3351, 5006, 5006, 3339, 3348, 3349, 3365, 3359,
+ 3361, 3367, 5006, 3372, 3371, 3384, 3374, 3375, 3381, 3388,
+ 3392, 3380, 3394, 3397, 5006, 3398, 3411, 3408, 3407, 5006,
+ 3415, 3405, 3410, 3423, 3431, 3434, 3440, 3430, 3427, 3450,
+ 3444, 5006, 3432, 3438, 3462, 3453, 3461, 3473, 3459, 3480,
+ 3458, 3475, 3488, 3474, 3486, 5006, 3489, 3491, 5006, 3479,
+ 3485, 3477, 5006, 3497, 5006, 3516, 3511, 3502, 3519, 3531,
+ 3524, 3534, 3517, 3535, 3532, 3529, 3540, 3544, 3521, 5006,
+ 5006, 3545, 3538, 3550, 3556, 3558, 3555, 3571, 3575, 5006,
+ 3553, 3581, 3564, 3574, 3583, 3572, 3577, 3592, 3591, 3579,
+
+ 3602, 3585, 3604, 5006, 3601, 3603, 3606, 3605, 3628, 3614,
+ 5006, 3609, 3634, 3629, 3630, 3632, 3638, 3643, 3646, 3636,
+ 3647, 3648, 3658, 3641, 3677, 3678, 3661, 5006, 3674, 3681,
+ 3663, 3683, 3666, 3685, 3686, 3698, 3692, 3675, 3695, 5006,
+ 3673, 3688, 3693, 3717, 3708, 3728, 3705, 3732, 3720, 3722,
+ 3735, 3711, 3724, 3718, 3738, 3742, 3741, 3744, 3758, 3746,
+ 3748, 5006, 3754, 5006, 3767, 3777, 3786, 3782, 5006, 3773,
+ 3780, 5006, 3775, 5006, 3790, 3792, 3801, 3795, 5006, 3796,
+ 3784, 3805, 3800, 3815, 3807, 3830, 5006, 3832, 3834, 3808,
+ 3833, 3820, 3827, 3839, 3824, 3845, 3849, 3846, 5006, 3853,
+
+ 3857, 3859, 3866, 3873, 5006, 5006, 3877, 5006, 5006, 5006,
+ 3881, 5006, 5006, 3880, 3882, 5006, 3883, 5006, 3891, 3887,
+ 3876, 3868, 3889, 5006, 3897, 5006, 3895, 3893, 3898, 5006,
+ 3899, 5006, 3901, 3921, 3915, 3922, 3930, 3931, 3932, 3924,
+ 3916, 3925, 3933, 3935, 3939, 3926, 3941, 3956, 3943, 3955,
+ 3954, 3952, 3963, 3960, 3958, 3979, 3981, 3988, 3989, 5006,
+ 5006, 3971, 3982, 3990, 3994, 3992, 4002, 4005, 3998, 5006,
+ 3993, 4015, 4003, 4016, 4017, 4018, 4030, 4021, 4033, 4038,
+ 4029, 4037, 4034, 4039, 5006, 4049, 5006, 5006, 4050, 4051,
+ 4055, 4056, 4057, 5006, 4065, 4072, 4074, 5006, 4085, 4081,
+
+ 4088, 4089, 5006, 5006, 5006, 4090, 4082, 4084, 4098, 4101,
+ 4086, 4099, 5006, 4095, 4114, 4116, 4108, 4124, 4129, 4140,
+ 4133, 4139, 4142, 5006, 5006, 4144, 4141, 4147, 4146, 4134,
+ 4150, 4148, 4151, 5006, 4154, 4165, 4173, 4161, 4178, 4188,
+ 4182, 5006, 4174, 4175, 4177, 4194, 4190, 4198, 4200, 4201,
+ 5006, 4202, 4217, 4192, 5006, 4223, 5006, 4212, 5006, 5006,
+ 4216, 4231, 4234, 4240, 4241, 4242, 4227, 4233, 4235, 4246,
+ 4244, 5006, 5006, 4243, 4256, 5006, 5006, 4260, 4261, 4262,
+ 4259, 4267, 4255, 4265, 4282, 4272, 4294, 4296, 4269, 4293,
+ 4283, 4274, 4304, 4299, 4308, 5006, 4311, 5006, 4315, 4302,
+
+ 4312, 4323, 4321, 4327, 5006, 4335, 4325, 4320, 5006, 5006,
+ 5006, 4346, 4348, 4347, 5006, 4352, 4358, 4350, 4359, 4360,
+ 4363, 4362, 4341, 4369, 5006, 4372, 4373, 4382, 4394, 4386,
+ 4385, 4383, 4396, 4400, 4390, 4403, 4387, 4411, 4414, 5006,
+ 4420, 4415, 4423, 4412, 4418, 4434, 4436, 4425, 4437, 4428,
+ 4454, 4445, 4438, 4451, 4441, 4463, 4452, 4466, 5006, 4473,
+ 4455, 5006, 4472, 4475, 4481, 4480, 4488, 4491, 4487, 5006,
+ 4494, 5006, 4497, 5006, 4495, 4496, 4503, 4501, 5006, 5006,
+ 4502, 4509, 4507, 5006, 4515, 4499, 4513, 4519, 4526, 4524,
+ 4522, 5006, 5006, 4521, 4550, 4552, 4551, 5006, 5006, 5006,
+
+ 4556, 5006, 4553, 5006, 4546, 5006, 4559, 4548, 5006, 4547,
+ 4561, 4564, 4542, 4566, 4568, 4571, 4580, 4577, 4597, 5006,
+ 5006, 4599, 5006, 4600, 4601, 5006, 4590, 4604, 5006, 5006,
+ 4610, 4595, 4606, 4594, 4607, 4603, 5006, 5006, 5006, 5006,
+ 4614, 4615, 4626, 4624, 4629, 4628, 4623, 4634, 4654, 4650,
+ 4652, 4653, 4638, 4645, 4668, 4655, 5006, 4673, 4664, 4671,
+ 4672, 4675, 4665, 4674, 4680, 4684, 4691, 4695, 4687, 4692,
+ 4707, 4690, 4722, 4720, 4721, 4724, 4713, 4717, 4727, 4730,
+ 4719, 4736, 4745, 4739, 4747, 5006, 4756, 4743, 4748, 4763,
+ 4741, 4766, 4754, 4777, 4779, 4781, 4784, 4782, 4792, 4788,
+
+ 4789, 4783, 4794, 4793, 5006, 4809, 4819, 4798, 4808, 4829,
+ 4813, 4815, 4836, 4831, 4826, 4838, 4843, 4840, 5006, 4844,
+ 5006, 5006, 4845, 4854, 4856, 4852, 4855, 5006, 5006, 5006,
+ 4914, 4921, 4928, 4935, 4942, 82, 4949, 4956, 4963, 4970,
+ 4977, 4984, 4991, 4998
} ;
-static yyconst flex_int16_t yy_def[1642] =
+static yyconst flex_int16_t yy_def[1745] =
{ 0,
- 1627, 1, 1628, 1628, 1629, 1629, 1630, 1630, 1631, 1631,
- 1632, 1632, 1627, 1633, 1627, 1627, 1627, 1627, 1634, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1635,
- 1627, 1627, 1627, 1635, 1636, 1627, 1627, 1627, 1636, 1637,
- 1627, 1627, 1627, 1627, 1637, 1638, 1627, 1627, 1627, 1638,
- 1639, 1627, 1640, 1627, 1639, 1639, 1633, 1633, 1627, 1641,
- 1634, 1641, 1634, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
-
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1635, 1635, 1636, 1636, 1637, 1637, 1627, 1638,
- 1638, 1639, 1639, 1640, 1640, 1639, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1639, 1633, 1633, 1633, 1633, 1633, 1633,
-
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1639, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
-
- 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633,
- 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1639, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
-
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1639, 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1627, 1627, 1633,
- 1627, 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1627,
- 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633,
-
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1639, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
-
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1627, 1639, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
-
- 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
-
- 1633, 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1627, 1633,
- 1633, 1633, 1627, 1633, 1627, 1633, 1627, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1627,
- 1633, 1633, 1633, 1633, 1627, 1627, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
-
- 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1627, 1627, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633,
-
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1627, 1633, 1627,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1627, 1633, 1633, 1633, 1633, 1627, 1633, 1627, 1627, 1633,
- 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633,
- 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633,
-
- 1633, 1633, 1627, 1633, 1633, 1627, 1633, 1633, 1633, 1627,
- 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1627, 1627, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1627, 1633,
- 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1627,
-
- 1633, 1627, 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1627,
- 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1627,
- 1627, 1633, 1627, 1627, 1633, 1627, 1627, 1633, 1633, 1627,
- 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1627,
- 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1627, 1627, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1633,
-
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1627, 1633, 1627, 1627, 1633, 1633, 1633, 1633, 1633,
- 1627, 1633, 1633, 1633, 1633, 1627, 1627, 1627, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1627, 1627, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633,
- 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1627, 1633, 1633, 1627, 1633, 1627, 1627, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1627,
- 1627, 1633, 1627, 1627, 1633, 1633, 1633, 1633, 1633, 1633,
-
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1627, 1633, 1627, 1633, 1633, 1633, 1633, 1627, 1633,
- 1633, 1633, 1627, 1627, 1627, 1633, 1633, 1633, 1627, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1633,
- 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1627,
- 1633, 1627, 1633, 1633, 1627, 1627, 1633, 1633, 1633, 1627,
- 1633, 1633, 1633, 1633, 1633, 1633, 1627, 1627, 1633, 1633,
-
- 1633, 1627, 1627, 1627, 1633, 1627, 1633, 1627, 1633, 1633,
- 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1627, 1633, 1627, 1633, 1627, 1633, 1633, 1627, 1633, 1633,
- 1633, 1633, 1633, 1633, 1627, 1627, 1627, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
-
- 1633, 1627, 1633, 1633, 1633, 1633, 1633, 1633, 1633, 1633,
- 1633, 1633, 1633, 1633, 1633, 1627, 1633, 1627, 1627, 1633,
- 1633, 1633, 1633, 1633, 1627, 1627, 0, 1627, 1627, 1627,
- 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627,
- 1627
+ 1730, 1, 1731, 1731, 1732, 1732, 1733, 1733, 1734, 1734,
+ 1735, 1735, 1730, 1736, 1730, 1730, 1730, 1730, 1737, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1738,
+ 1730, 1730, 1730, 1738, 1739, 1730, 1730, 1730, 1739, 1740,
+ 1730, 1730, 1730, 1730, 1740, 1741, 1730, 1730, 1730, 1741,
+ 1742, 1730, 1743, 1730, 1742, 1742, 1736, 1736, 1730, 1744,
+ 1737, 1744, 1737, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1738, 1738, 1739, 1739, 1740, 1740, 1730,
+ 1741, 1741, 1742, 1742, 1743, 1743, 1742, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1742, 1736, 1736, 1736,
+
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1742, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1730,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1742, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1742, 1736, 1736, 1736, 1736, 1736, 1730,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1736,
+ 1730, 1730, 1736, 1730, 1730, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+
+ 1736, 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1742, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+
+ 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1730, 1742, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+
+ 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1730, 1736, 1730, 1736, 1736, 1736,
+ 1730, 1736, 1730, 1736, 1730, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1730, 1736, 1736, 1736, 1736, 1736, 1730, 1730, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730,
+ 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+
+ 1736, 1736, 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1730, 1736, 1730, 1736, 1730, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1736, 1736, 1736,
+
+ 1736, 1730, 1736, 1730, 1730, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1730,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1730, 1736, 1736, 1730, 1736,
+ 1736, 1736, 1730, 1736, 1730, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730,
+ 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+
+ 1736, 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1730, 1736, 1730, 1736, 1736, 1736, 1736, 1730, 1736,
+ 1736, 1730, 1736, 1730, 1736, 1736, 1736, 1736, 1730, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1736,
+
+ 1736, 1736, 1736, 1736, 1730, 1730, 1736, 1730, 1730, 1730,
+ 1736, 1730, 1730, 1736, 1736, 1730, 1736, 1730, 1736, 1736,
+ 1736, 1736, 1736, 1730, 1736, 1730, 1736, 1736, 1736, 1730,
+ 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730,
+ 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1730, 1736, 1730, 1730, 1736, 1736,
+ 1736, 1736, 1736, 1730, 1736, 1736, 1736, 1730, 1736, 1736,
+
+ 1736, 1736, 1730, 1730, 1730, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1730, 1730, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1730, 1736, 1736, 1736, 1730, 1736, 1730, 1736, 1730, 1730,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1730, 1730, 1736, 1736, 1730, 1730, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1730, 1736, 1730, 1736, 1736,
+
+ 1736, 1736, 1736, 1736, 1730, 1736, 1736, 1736, 1730, 1730,
+ 1730, 1736, 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1736,
+ 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730,
+ 1736, 1730, 1736, 1730, 1736, 1736, 1736, 1736, 1730, 1730,
+ 1736, 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1730, 1730, 1736, 1736, 1736, 1736, 1730, 1730, 1730,
+
+ 1736, 1730, 1736, 1730, 1736, 1730, 1736, 1736, 1730, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730,
+ 1730, 1736, 1730, 1736, 1736, 1730, 1736, 1736, 1730, 1730,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1730, 1730, 1730,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1730, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
+
+ 1736, 1736, 1736, 1736, 1730, 1736, 1736, 1736, 1736, 1736,
+ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1730, 1736,
+ 1730, 1730, 1736, 1736, 1736, 1736, 1736, 1730, 1730, 0,
+ 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730,
+ 1730, 1730, 1730, 1730
} ;
-static yyconst flex_int16_t yy_nxt[4747] =
+static yyconst flex_int16_t yy_nxt[5072] =
{ 0,
14, 15, 16, 17, 18, 19, 18, 14, 14, 14,
14, 18, 20, 14, 21, 22, 23, 24, 14, 25,
38, 14, 14, 14, 14, 41, 42, 43, 41, 42,
43, 46, 47, 46, 47, 48, 87, 48, 51, 52,
53, 54, 67, 18, 51, 52, 53, 54, 68, 18,
- 57, 58, 59, 57, 58, 59, 69, 123, 123, 125,
+ 57, 58, 59, 57, 58, 59, 69, 124, 124, 126,
- 70, 44, 125, 87, 44, 130, 130, 49, 72, 49,
- 72, 72, 69, 72, 133, 55, 70, 67, 72, 67,
- 67, 55, 67, 85, 74, 75, 60, 67, 725, 60,
+ 70, 44, 126, 87, 44, 131, 131, 49, 72, 49,
+ 72, 72, 69, 72, 134, 55, 70, 67, 72, 67,
+ 67, 55, 67, 85, 74, 75, 60, 67, 748, 60,
15, 16, 17, 62, 63, 64, 15, 16, 17, 62,
63, 64, 76, 86, 94, 73, 68, 96, 68, 65,
- 85, 74, 75, 133, 77, 65, 68, 88, 68, 68,
- 131, 78, 123, 123, 95, 89, 129, 66, 79, 76,
- 86, 94, 125, 66, 96, 125, 65, 130, 130, 128,
- 68, 77, 65, 68, 88, 138, 68, 90, 78, 119,
- 91, 95, 89, 97, 120, 79, 80, 92, 104, 93,
+ 85, 74, 75, 134, 77, 65, 68, 88, 68, 68,
+ 132, 78, 124, 124, 95, 89, 130, 66, 79, 76,
+ 86, 94, 126, 66, 96, 126, 65, 131, 131, 129,
+ 68, 77, 65, 68, 88, 139, 68, 90, 78, 120,
+ 91, 95, 89, 97, 121, 79, 80, 92, 104, 93,
81, 98, 68, 82, 68, 83, 84, 99, 68, 101,
- 68, 100, 138, 102, 90, 126, 119, 91, 68, 68,
- 97, 120, 274, 80, 92, 104, 93, 81, 98, 103,
- 82, 153, 83, 84, 99, 68, 101, 105, 100, 109,
- 102, 124, 116, 106, 117, 127, 107, 127, 127, 110,
- 127, 68, 111, 108, 68, 68, 103, 212, 153, 118,
- 72, 68, 72, 72, 105, 72, 109, 112, 68, 116,
- 106, 117, 136, 107, 121, 68, 110, 113, 122, 111,
- 108, 114, 115, 68, 212, 133, 118, 133, 132, 68,
- 132, 132, 131, 132, 112, 129, 139, 135, 137, 136,
-
- 68, 121, 140, 68, 113, 122, 145, 128, 114, 115,
- 67, 68, 67, 67, 72, 67, 72, 72, 141, 72,
- 67, 142, 68, 139, 72, 137, 68, 68, 143, 140,
- 144, 149, 146, 145, 68, 147, 126, 151, 152, 68,
- 68, 154, 150, 68, 68, 141, 68, 68, 142, 68,
- 124, 73, 148, 156, 155, 143, 157, 144, 149, 146,
- 159, 167, 252, 68, 151, 152, 68, 68, 154, 150,
- 158, 163, 161, 165, 160, 164, 68, 68, 68, 148,
- 156, 155, 68, 157, 68, 168, 170, 68, 167, 252,
- 166, 68, 162, 169, 68, 68, 171, 158, 163, 161,
-
- 165, 160, 164, 68, 172, 68, 68, 68, 182, 173,
- 68, 68, 168, 170, 177, 174, 178, 166, 175, 162,
- 169, 68, 176, 171, 68, 179, 180, 1627, 1627, 181,
- 68, 172, 68, 183, 68, 184, 173, 68, 68, 68,
- 68, 177, 174, 178, 189, 175, 187, 1627, 68, 176,
- 186, 192, 179, 180, 191, 185, 181, 68, 188, 68,
- 183, 68, 184, 193, 68, 190, 68, 1627, 1627, 68,
- 1627, 189, 68, 187, 196, 194, 68, 186, 192, 195,
- 1627, 191, 185, 204, 127, 188, 127, 127, 1627, 127,
- 193, 132, 190, 132, 132, 72, 132, 72, 72, 133,
-
- 72, 68, 194, 197, 198, 68, 195, 199, 201, 200,
- 213, 203, 1627, 202, 68, 68, 68, 1627, 68, 68,
- 205, 1627, 214, 68, 215, 217, 222, 216, 68, 218,
- 197, 198, 135, 68, 199, 68, 200, 213, 203, 68,
- 202, 206, 68, 219, 68, 227, 1627, 68, 68, 214,
- 68, 215, 217, 222, 216, 68, 218, 220, 1627, 1627,
- 221, 223, 1627, 224, 225, 1627, 226, 231, 206, 207,
- 219, 68, 68, 228, 208, 233, 68, 68, 234, 209,
- 236, 68, 1627, 68, 220, 210, 211, 221, 223, 68,
- 224, 225, 68, 226, 229, 235, 207, 232, 68, 68,
-
- 228, 208, 233, 237, 230, 239, 209, 1627, 238, 68,
- 1627, 68, 210, 211, 240, 68, 241, 68, 242, 243,
- 246, 68, 235, 68, 232, 68, 68, 244, 68, 245,
- 250, 230, 239, 251, 68, 238, 68, 68, 68, 68,
- 68, 240, 68, 241, 247, 242, 243, 246, 253, 68,
- 248, 249, 254, 257, 244, 255, 245, 256, 260, 68,
- 251, 68, 1627, 68, 258, 267, 263, 269, 68, 1627,
- 266, 247, 68, 261, 1627, 253, 68, 248, 249, 68,
- 257, 133, 255, 68, 256, 265, 259, 68, 264, 68,
- 262, 268, 267, 263, 269, 68, 68, 270, 68, 272,
-
- 261, 68, 273, 68, 68, 271, 279, 68, 275, 282,
- 276, 277, 265, 259, 283, 264, 68, 262, 268, 278,
- 280, 281, 68, 68, 270, 284, 272, 68, 68, 273,
- 68, 68, 271, 279, 68, 275, 68, 276, 277, 68,
- 68, 283, 285, 68, 286, 288, 278, 280, 281, 287,
- 293, 68, 284, 289, 68, 291, 68, 290, 292, 68,
- 295, 300, 296, 294, 68, 1627, 1627, 68, 297, 285,
- 306, 68, 288, 68, 1627, 68, 287, 293, 68, 68,
- 289, 68, 291, 68, 290, 292, 68, 302, 300, 296,
- 294, 68, 301, 298, 303, 297, 299, 68, 68, 304,
-
- 305, 68, 308, 68, 307, 309, 310, 311, 312, 68,
- 317, 1627, 68, 314, 302, 313, 327, 1627, 68, 301,
- 298, 303, 319, 299, 68, 68, 304, 305, 68, 308,
- 328, 307, 309, 310, 311, 68, 315, 68, 316, 68,
- 314, 68, 313, 318, 68, 68, 322, 68, 68, 319,
- 68, 320, 68, 321, 326, 323, 329, 328, 324, 68,
- 325, 330, 68, 315, 331, 316, 68, 1627, 68, 349,
- 318, 332, 68, 322, 1627, 68, 68, 333, 320, 335,
- 321, 326, 323, 329, 68, 324, 346, 325, 330, 344,
- 343, 331, 68, 334, 68, 1627, 347, 345, 332, 351,
-
- 68, 68, 68, 133, 333, 348, 335, 68, 68, 353,
- 437, 68, 68, 346, 1627, 352, 344, 343, 350, 356,
- 334, 336, 337, 347, 345, 68, 351, 68, 355, 354,
- 358, 338, 348, 339, 340, 341, 68, 68, 342, 1627,
- 68, 68, 352, 357, 361, 350, 68, 1627, 336, 337,
- 68, 68, 68, 366, 68, 355, 354, 358, 338, 364,
- 339, 340, 341, 359, 360, 342, 362, 363, 368, 369,
- 357, 361, 68, 365, 367, 1627, 68, 68, 68, 371,
- 366, 68, 370, 68, 1627, 372, 364, 68, 373, 375,
- 374, 377, 68, 362, 363, 368, 369, 68, 68, 378,
-
- 365, 367, 376, 381, 380, 379, 371, 68, 68, 370,
- 382, 68, 372, 400, 68, 373, 68, 374, 377, 68,
- 68, 68, 383, 68, 384, 385, 378, 386, 387, 376,
- 68, 380, 379, 389, 68, 388, 391, 382, 390, 68,
- 68, 68, 68, 393, 68, 397, 1627, 392, 68, 383,
- 68, 384, 385, 68, 386, 387, 394, 398, 68, 68,
- 389, 68, 388, 391, 68, 390, 68, 399, 395, 396,
- 393, 68, 397, 401, 392, 68, 68, 405, 404, 68,
- 402, 403, 68, 394, 398, 68, 68, 68, 406, 68,
- 408, 407, 1627, 1627, 399, 395, 396, 1627, 68, 1627,
-
- 401, 68, 68, 415, 405, 404, 414, 402, 403, 1627,
- 68, 416, 418, 68, 68, 406, 419, 408, 407, 409,
- 417, 1627, 420, 68, 410, 421, 411, 68, 422, 423,
- 415, 1627, 426, 414, 412, 424, 68, 433, 428, 418,
- 68, 68, 68, 419, 413, 68, 409, 417, 68, 420,
- 68, 410, 421, 411, 68, 422, 423, 425, 427, 426,
- 68, 412, 424, 68, 429, 428, 430, 431, 68, 68,
- 448, 413, 432, 434, 68, 436, 445, 435, 441, 68,
- 446, 438, 68, 439, 425, 427, 68, 440, 68, 68,
- 68, 429, 442, 430, 431, 133, 68, 68, 68, 432,
-
- 434, 447, 436, 449, 435, 441, 443, 68, 438, 444,
- 439, 68, 450, 451, 440, 68, 68, 68, 452, 442,
- 453, 454, 455, 456, 457, 1627, 461, 68, 447, 458,
- 68, 459, 460, 443, 463, 1627, 444, 467, 462, 68,
- 68, 469, 1627, 68, 68, 68, 68, 68, 454, 455,
- 456, 68, 68, 68, 471, 68, 458, 68, 459, 460,
- 68, 463, 464, 68, 467, 462, 468, 465, 472, 470,
- 474, 466, 68, 477, 475, 68, 479, 476, 68, 1627,
- 1627, 471, 491, 483, 68, 480, 68, 68, 68, 464,
- 473, 68, 68, 468, 465, 472, 470, 474, 466, 68,
-
- 477, 475, 481, 478, 476, 68, 68, 68, 482, 485,
- 483, 484, 480, 68, 1627, 486, 487, 473, 68, 488,
- 68, 489, 68, 1627, 493, 490, 68, 492, 1627, 481,
- 478, 497, 68, 1627, 499, 482, 485, 68, 484, 494,
- 68, 68, 486, 487, 509, 68, 488, 498, 68, 495,
- 504, 493, 68, 496, 492, 68, 68, 502, 497, 68,
- 500, 499, 501, 503, 505, 68, 494, 506, 1627, 68,
- 68, 68, 507, 68, 498, 68, 508, 504, 510, 68,
- 68, 68, 68, 511, 502, 512, 68, 500, 68, 501,
- 503, 505, 514, 515, 506, 513, 518, 1627, 516, 507,
-
- 1627, 517, 519, 508, 68, 510, 68, 520, 68, 68,
- 511, 68, 512, 521, 68, 68, 68, 522, 524, 514,
- 515, 523, 513, 518, 68, 516, 528, 68, 517, 519,
- 68, 525, 527, 526, 520, 68, 530, 1627, 68, 68,
- 521, 529, 68, 531, 522, 524, 68, 535, 523, 68,
- 68, 532, 533, 528, 133, 548, 550, 534, 525, 527,
- 526, 1627, 68, 530, 68, 545, 536, 537, 529, 68,
- 531, 539, 538, 68, 535, 68, 68, 68, 532, 546,
- 68, 68, 548, 68, 534, 547, 68, 68, 549, 68,
- 1627, 557, 545, 536, 537, 1627, 558, 560, 539, 538,
-
- 540, 561, 1627, 68, 541, 68, 546, 542, 559, 562,
- 68, 68, 547, 68, 543, 549, 563, 544, 557, 1627,
- 1627, 68, 68, 558, 560, 564, 567, 540, 68, 68,
- 565, 541, 570, 568, 542, 559, 562, 68, 569, 566,
- 68, 543, 68, 563, 544, 551, 68, 552, 68, 571,
- 553, 68, 564, 567, 575, 554, 68, 565, 574, 570,
- 568, 555, 556, 68, 573, 569, 566, 572, 576, 577,
- 68, 578, 551, 68, 552, 68, 571, 553, 580, 68,
- 68, 68, 554, 579, 581, 574, 583, 582, 555, 556,
- 585, 573, 584, 587, 572, 68, 68, 68, 578, 68,
-
- 68, 586, 589, 68, 68, 580, 591, 588, 68, 590,
- 579, 581, 68, 583, 582, 68, 596, 68, 592, 584,
- 68, 595, 68, 593, 68, 610, 68, 68, 586, 589,
- 68, 594, 68, 591, 588, 597, 590, 598, 68, 601,
- 602, 68, 600, 596, 68, 592, 599, 68, 595, 68,
- 593, 68, 603, 605, 607, 1627, 68, 68, 594, 606,
- 604, 68, 597, 68, 598, 609, 601, 602, 68, 600,
- 608, 68, 68, 599, 611, 68, 612, 68, 68, 603,
- 605, 607, 613, 614, 615, 616, 606, 604, 617, 618,
- 68, 68, 609, 622, 619, 620, 624, 608, 68, 68,
-
- 623, 625, 621, 612, 68, 68, 68, 68, 627, 613,
- 614, 615, 616, 626, 68, 617, 68, 641, 68, 630,
- 68, 619, 620, 68, 68, 68, 628, 623, 133, 621,
- 629, 68, 68, 68, 68, 627, 637, 1627, 638, 68,
- 626, 639, 640, 68, 641, 1627, 630, 644, 642, 1627,
- 68, 666, 1627, 628, 68, 1627, 1627, 629, 631, 68,
- 632, 68, 1627, 637, 633, 638, 634, 643, 639, 640,
- 68, 635, 645, 646, 644, 642, 636, 649, 68, 648,
- 68, 653, 68, 647, 68, 631, 650, 632, 652, 651,
- 68, 633, 68, 634, 643, 68, 658, 668, 635, 645,
-
- 646, 68, 68, 636, 649, 661, 648, 659, 662, 68,
- 647, 660, 68, 650, 654, 652, 651, 663, 68, 655,
- 68, 656, 667, 658, 664, 665, 68, 1627, 68, 669,
- 68, 68, 661, 68, 659, 662, 68, 68, 660, 657,
- 68, 654, 670, 671, 663, 68, 655, 673, 656, 667,
- 68, 664, 665, 68, 672, 68, 669, 68, 676, 674,
- 675, 679, 678, 680, 677, 681, 657, 1627, 68, 670,
- 671, 68, 688, 68, 673, 68, 68, 68, 683, 68,
- 68, 672, 684, 687, 682, 676, 674, 675, 679, 678,
- 68, 677, 681, 68, 68, 685, 686, 689, 68, 688,
-
- 692, 68, 690, 693, 68, 683, 691, 694, 695, 684,
- 687, 682, 696, 697, 699, 698, 700, 68, 68, 68,
- 68, 68, 685, 686, 701, 703, 68, 692, 68, 704,
- 693, 68, 705, 68, 694, 695, 68, 68, 68, 696,
- 697, 699, 698, 700, 702, 68, 68, 710, 706, 707,
- 68, 701, 703, 708, 68, 68, 68, 68, 709, 705,
- 712, 713, 68, 711, 717, 715, 68, 718, 716, 714,
- 719, 702, 721, 68, 710, 706, 707, 68, 68, 68,
- 708, 720, 68, 68, 68, 709, 722, 712, 713, 68,
- 711, 717, 715, 68, 68, 716, 714, 723, 68, 68,
-
- 724, 68, 726, 727, 728, 729, 730, 68, 720, 732,
- 68, 68, 68, 722, 731, 68, 68, 733, 734, 68,
- 735, 68, 1627, 1627, 723, 736, 68, 724, 739, 726,
- 727, 728, 729, 730, 738, 740, 732, 737, 68, 741,
- 68, 731, 68, 68, 743, 742, 745, 735, 68, 68,
- 68, 68, 736, 68, 744, 739, 68, 747, 746, 749,
- 748, 738, 740, 68, 737, 68, 741, 68, 751, 752,
- 1627, 68, 742, 745, 1627, 750, 753, 754, 68, 68,
- 759, 744, 68, 68, 747, 746, 749, 748, 68, 755,
- 756, 758, 68, 757, 68, 751, 752, 68, 68, 68,
-
- 762, 68, 750, 753, 754, 763, 1627, 759, 766, 760,
- 761, 767, 68, 68, 68, 68, 755, 756, 758, 764,
- 757, 68, 68, 68, 765, 68, 769, 762, 770, 68,
- 771, 772, 763, 68, 768, 766, 760, 761, 767, 780,
- 773, 68, 774, 68, 68, 775, 764, 68, 777, 776,
- 68, 765, 778, 769, 779, 782, 68, 771, 772, 68,
- 781, 768, 783, 786, 68, 784, 68, 773, 789, 774,
- 68, 790, 68, 791, 788, 777, 68, 68, 785, 778,
- 787, 779, 782, 68, 68, 68, 68, 781, 792, 783,
- 786, 68, 784, 68, 1627, 68, 68, 797, 1627, 68,
-
- 791, 788, 68, 793, 798, 785, 799, 787, 794, 801,
- 795, 68, 796, 68, 800, 792, 804, 802, 68, 803,
- 807, 68, 68, 68, 797, 68, 806, 68, 68, 68,
- 793, 798, 809, 799, 810, 794, 801, 795, 68, 796,
- 805, 800, 808, 804, 802, 813, 803, 68, 811, 68,
- 814, 815, 812, 806, 68, 817, 818, 68, 68, 68,
- 68, 810, 816, 68, 819, 821, 820, 805, 822, 808,
- 68, 823, 68, 826, 827, 811, 824, 814, 68, 812,
- 68, 825, 68, 818, 68, 68, 68, 68, 828, 816,
- 829, 819, 821, 820, 68, 822, 830, 68, 823, 831,
-
- 832, 68, 833, 824, 68, 68, 834, 68, 825, 836,
- 68, 839, 837, 68, 68, 828, 68, 838, 835, 68,
- 68, 68, 68, 830, 68, 840, 831, 832, 841, 68,
- 842, 844, 68, 834, 843, 68, 852, 845, 839, 837,
- 68, 68, 849, 68, 838, 835, 846, 850, 853, 68,
- 847, 68, 840, 68, 848, 841, 855, 842, 844, 851,
- 68, 843, 854, 852, 845, 1627, 68, 856, 68, 849,
- 857, 68, 68, 846, 850, 68, 859, 862, 858, 68,
- 866, 68, 860, 855, 68, 68, 851, 68, 861, 854,
- 863, 68, 68, 864, 856, 68, 868, 857, 68, 68,
-
- 68, 68, 867, 859, 862, 858, 865, 866, 869, 860,
- 68, 877, 870, 871, 872, 861, 874, 863, 68, 68,
- 864, 875, 68, 868, 873, 876, 878, 68, 68, 867,
- 1627, 880, 68, 865, 68, 869, 68, 68, 879, 870,
- 871, 872, 68, 874, 881, 883, 882, 68, 875, 886,
- 884, 873, 876, 68, 885, 887, 891, 68, 68, 68,
- 888, 889, 68, 68, 68, 879, 68, 890, 68, 892,
- 893, 881, 883, 882, 898, 68, 68, 68, 68, 899,
- 68, 68, 887, 891, 894, 895, 897, 888, 889, 900,
- 896, 68, 68, 68, 890, 903, 901, 893, 68, 68,
-
- 68, 898, 902, 904, 906, 907, 899, 905, 910, 68,
- 908, 894, 895, 897, 68, 68, 900, 896, 68, 909,
- 912, 68, 903, 901, 913, 68, 68, 68, 914, 902,
- 904, 68, 907, 68, 905, 911, 915, 908, 916, 68,
- 917, 919, 68, 918, 68, 921, 909, 912, 923, 922,
- 68, 913, 920, 68, 68, 924, 1627, 926, 68, 68,
- 68, 928, 911, 68, 68, 68, 925, 917, 919, 68,
- 918, 68, 921, 68, 929, 923, 922, 68, 930, 920,
- 927, 931, 68, 68, 926, 68, 68, 932, 928, 933,
- 940, 934, 935, 925, 942, 938, 68, 68, 1627, 68,
-
- 944, 929, 68, 68, 936, 930, 937, 927, 931, 946,
- 939, 68, 68, 68, 932, 943, 933, 68, 934, 935,
- 68, 68, 938, 941, 945, 68, 947, 68, 68, 948,
- 68, 936, 68, 937, 949, 953, 946, 939, 954, 1627,
- 950, 68, 943, 951, 68, 68, 956, 957, 959, 68,
- 941, 945, 68, 947, 955, 952, 948, 1627, 960, 958,
- 68, 949, 961, 967, 68, 954, 68, 950, 68, 962,
- 951, 68, 68, 956, 957, 964, 966, 68, 968, 68,
- 963, 955, 952, 68, 68, 960, 958, 68, 965, 961,
- 68, 984, 68, 973, 970, 969, 962, 68, 68, 971,
-
- 68, 68, 964, 966, 68, 968, 68, 963, 68, 975,
- 972, 974, 976, 1627, 980, 965, 979, 977, 68, 68,
- 973, 970, 969, 68, 68, 68, 971, 978, 68, 981,
- 986, 983, 982, 68, 68, 987, 985, 972, 974, 976,
- 68, 980, 68, 979, 977, 989, 68, 68, 988, 992,
- 993, 994, 68, 68, 978, 996, 981, 986, 983, 982,
- 68, 990, 987, 985, 991, 997, 68, 68, 1001, 68,
- 995, 998, 989, 1004, 68, 988, 992, 68, 68, 68,
- 1000, 68, 996, 999, 68, 68, 1627, 1003, 990, 68,
- 1002, 991, 997, 1005, 68, 1001, 68, 995, 998, 1006,
-
- 1007, 68, 68, 1009, 68, 1008, 1627, 1000, 1010, 1011,
- 999, 1014, 68, 1017, 1003, 1012, 1016, 1002, 1013, 1015,
- 1005, 68, 68, 1627, 68, 68, 1021, 1007, 68, 1018,
- 68, 1028, 1008, 68, 68, 1010, 1011, 68, 1014, 1019,
- 68, 1022, 1012, 1016, 68, 1013, 1015, 1020, 68, 68,
- 1023, 1024, 1025, 1021, 68, 1026, 1018, 1027, 68, 68,
- 1032, 1030, 1029, 68, 1627, 1031, 1019, 1036, 1022, 68,
- 68, 1033, 68, 68, 1020, 68, 68, 1023, 1024, 1025,
- 68, 1034, 1026, 1035, 1027, 1037, 68, 1038, 1030, 1029,
- 68, 68, 1031, 1039, 68, 1040, 1042, 1627, 1033, 1043,
-
- 1041, 1044, 1046, 1627, 68, 1051, 1049, 1045, 1034, 68,
- 1035, 68, 1037, 68, 68, 68, 68, 68, 68, 68,
- 1039, 1056, 68, 1042, 68, 1047, 1043, 1041, 1044, 1046,
- 1050, 1052, 68, 1049, 1045, 1627, 1054, 1058, 1048, 1053,
- 1055, 1059, 68, 68, 68, 68, 1057, 68, 68, 1060,
- 1061, 1062, 1047, 68, 1064, 1627, 1065, 1050, 68, 1066,
- 1063, 1068, 68, 1054, 68, 1048, 1053, 1055, 68, 68,
- 1067, 1073, 1074, 1057, 68, 1076, 1627, 1061, 68, 68,
- 68, 68, 68, 1065, 1075, 68, 68, 1063, 1069, 1070,
- 1071, 68, 68, 1077, 1082, 1072, 68, 1067, 1073, 1074,
-
- 1078, 68, 1076, 68, 1079, 1080, 1081, 1083, 1084, 1627,
- 1091, 1075, 68, 1086, 68, 1069, 1070, 1071, 1085, 68,
- 68, 68, 1072, 1087, 68, 1088, 68, 1078, 68, 1090,
- 68, 1079, 1080, 1081, 1083, 1084, 68, 1089, 1093, 1092,
- 1086, 68, 1094, 1096, 1627, 1085, 68, 1097, 68, 68,
- 1087, 68, 1088, 1095, 68, 1098, 1090, 1101, 68, 1100,
- 1099, 68, 1103, 1102, 1089, 1093, 1092, 68, 68, 68,
- 1096, 68, 1104, 1106, 1097, 68, 1109, 1105, 68, 1107,
- 1095, 68, 1098, 1108, 1101, 68, 1100, 1099, 68, 68,
- 1102, 1110, 1113, 1111, 1114, 68, 68, 1112, 1115, 1104,
-
- 68, 1116, 1117, 1118, 1105, 1627, 1107, 68, 1126, 1120,
- 1108, 68, 1119, 68, 1121, 1122, 1123, 68, 68, 1124,
- 68, 1114, 1127, 68, 68, 1115, 68, 68, 1125, 1117,
- 1118, 1129, 68, 1128, 68, 68, 1120, 1135, 1130, 1119,
- 1132, 1133, 1122, 1131, 1136, 68, 1124, 68, 1134, 68,
- 1140, 68, 68, 68, 68, 1125, 68, 1142, 1129, 68,
- 1128, 68, 68, 68, 68, 1130, 1137, 1132, 1133, 1138,
- 1131, 1136, 1139, 68, 1143, 1134, 1141, 1140, 68, 1144,
- 68, 1149, 1146, 1151, 68, 1152, 1147, 68, 68, 1148,
- 1145, 68, 1153, 1137, 1155, 68, 1138, 1150, 68, 1139,
-
- 1154, 1143, 1156, 1141, 68, 68, 1144, 68, 68, 1146,
- 68, 1158, 1152, 1147, 68, 1159, 1148, 1145, 68, 1153,
- 1160, 68, 68, 1157, 1150, 68, 68, 1154, 1161, 1156,
- 68, 1162, 1164, 68, 1163, 1166, 1168, 68, 1158, 1167,
- 1170, 1165, 1159, 68, 68, 68, 68, 1160, 68, 68,
- 1157, 1169, 1171, 68, 1173, 1161, 1177, 68, 1162, 1164,
- 1174, 1163, 1166, 1168, 68, 68, 1167, 1170, 1165, 68,
- 1172, 68, 1175, 1176, 1179, 1178, 68, 1182, 1169, 68,
- 1181, 1173, 68, 1177, 1180, 68, 1183, 1174, 68, 1627,
- 68, 1188, 1187, 1184, 68, 68, 1193, 1172, 1185, 1175,
-
- 1176, 1186, 1178, 68, 1182, 68, 68, 1181, 68, 68,
- 1190, 1180, 1189, 68, 1191, 1192, 68, 68, 1188, 1187,
- 1184, 1627, 1194, 1193, 1195, 1185, 1196, 68, 1186, 68,
- 1199, 1197, 68, 68, 1200, 1627, 68, 1190, 1198, 1189,
- 68, 1191, 1192, 68, 1201, 68, 1202, 68, 68, 1194,
- 1627, 1195, 1203, 1196, 1204, 1206, 1205, 1199, 1197, 1207,
- 68, 68, 68, 1210, 1215, 1198, 1208, 1627, 1211, 68,
- 1209, 1201, 1212, 68, 1214, 1213, 1218, 68, 68, 1203,
- 68, 1204, 1206, 1205, 68, 68, 68, 68, 68, 1217,
- 68, 68, 1219, 1208, 68, 1211, 68, 1209, 1216, 1212,
-
- 68, 1214, 1213, 1218, 68, 1220, 1221, 1222, 1223, 1627,
- 1225, 68, 1627, 1224, 1234, 68, 1217, 1226, 68, 1219,
- 1227, 68, 68, 1228, 1627, 1216, 1229, 68, 1232, 68,
- 1230, 68, 1220, 1221, 1222, 68, 68, 1225, 68, 68,
- 1224, 68, 1231, 68, 1226, 1233, 1235, 1227, 68, 1236,
- 1228, 68, 1237, 1229, 1238, 1232, 1239, 1230, 1240, 1241,
- 1242, 1243, 1244, 68, 1246, 68, 1247, 1245, 68, 1231,
- 68, 1250, 1233, 1235, 68, 68, 1236, 1249, 1252, 1237,
- 1254, 1238, 68, 1239, 1248, 68, 68, 1242, 68, 68,
- 1255, 68, 68, 68, 1245, 1251, 1258, 1253, 68, 68,
-
- 1256, 68, 1259, 68, 1249, 68, 68, 1254, 1260, 1261,
- 68, 1248, 1262, 68, 68, 1257, 1264, 1255, 1263, 1266,
- 1627, 1627, 1251, 68, 1253, 1265, 68, 1256, 1267, 1259,
- 68, 1269, 1270, 1268, 68, 68, 68, 68, 1271, 1262,
- 68, 68, 1257, 1264, 68, 1263, 1266, 68, 1272, 1273,
- 68, 1274, 1265, 1275, 68, 1267, 1276, 1627, 1269, 1270,
- 1268, 1277, 1278, 1280, 68, 1271, 68, 68, 68, 1279,
- 1283, 1284, 1627, 1281, 1627, 1272, 1273, 1285, 1274, 68,
- 68, 1282, 68, 1276, 68, 1286, 68, 1288, 1277, 1278,
- 1289, 1627, 1290, 1296, 68, 68, 1279, 1283, 1284, 68,
-
- 1281, 68, 1287, 1292, 1285, 68, 1291, 68, 1282, 68,
- 1293, 1297, 1286, 1294, 68, 1295, 68, 68, 68, 1290,
- 1296, 68, 1298, 68, 1299, 1301, 1304, 1300, 1303, 1287,
- 1292, 1307, 68, 1291, 68, 68, 1302, 1293, 1297, 1305,
- 1294, 68, 1295, 68, 1308, 1306, 68, 1311, 68, 68,
- 68, 1299, 1301, 68, 1300, 1303, 68, 68, 1307, 1309,
- 68, 1312, 1310, 1302, 1314, 1315, 1305, 1316, 1313, 1627,
- 1317, 1627, 1306, 68, 1311, 68, 1319, 1320, 68, 1321,
- 1322, 68, 1318, 1323, 1326, 1327, 1309, 68, 68, 1310,
- 68, 68, 68, 68, 1325, 1313, 68, 1317, 68, 68,
-
- 1324, 1328, 68, 1319, 1320, 1329, 68, 1322, 68, 1318,
- 1323, 68, 68, 68, 1330, 1331, 68, 1334, 1332, 1333,
- 68, 1325, 1335, 68, 1336, 1337, 1340, 1324, 68, 68,
- 68, 1339, 1329, 68, 68, 1338, 68, 1344, 68, 68,
- 68, 1330, 1331, 68, 1334, 1332, 1333, 1341, 1342, 1335,
- 68, 68, 1337, 1340, 1343, 1345, 1346, 1347, 1339, 68,
- 1348, 68, 1338, 68, 1344, 1350, 1351, 68, 1352, 1349,
- 68, 1354, 1353, 68, 1341, 1342, 1355, 68, 68, 68,
- 68, 1343, 1345, 68, 68, 1356, 68, 1348, 1357, 1358,
- 1627, 1359, 1350, 1351, 1361, 1352, 1349, 1363, 1354, 1353,
-
- 68, 68, 68, 1355, 1360, 68, 68, 1364, 1366, 1362,
- 1365, 1627, 68, 68, 1367, 1357, 1358, 68, 1359, 68,
- 68, 1361, 68, 1368, 68, 1369, 1627, 1370, 1372, 1371,
- 68, 1360, 1373, 68, 68, 1366, 1362, 1365, 68, 1374,
- 1375, 1367, 1377, 1376, 68, 1378, 1627, 1379, 68, 1627,
- 1368, 68, 1369, 68, 1370, 68, 1371, 1380, 1381, 1373,
- 1382, 1383, 68, 1384, 1387, 1386, 1374, 68, 1389, 68,
- 1376, 68, 68, 68, 1379, 1385, 68, 68, 1388, 1390,
- 68, 1391, 68, 68, 1380, 1381, 68, 1382, 1383, 1392,
- 1384, 1387, 1386, 1627, 68, 1389, 1393, 1394, 1395, 1396,
-
- 68, 1398, 1385, 1397, 1399, 1388, 68, 1627, 68, 1627,
- 1403, 1401, 1402, 1400, 1627, 1627, 68, 1407, 1405, 68,
- 68, 1404, 68, 68, 68, 68, 1396, 68, 1398, 68,
- 1397, 1399, 68, 68, 68, 68, 68, 1403, 1401, 1402,
- 1400, 1406, 1408, 68, 1407, 1405, 1409, 1411, 1404, 1410,
- 1412, 1414, 1413, 1415, 68, 68, 68, 1417, 1419, 68,
- 68, 1416, 1627, 1421, 1420, 1423, 1424, 1418, 1406, 1408,
- 68, 68, 68, 1409, 1411, 68, 1410, 68, 68, 1413,
- 1415, 68, 1422, 68, 1417, 68, 1425, 1426, 1416, 68,
- 1421, 1420, 68, 68, 1418, 1427, 68, 1428, 1429, 1431,
-
- 1430, 1627, 1432, 1433, 1436, 1627, 68, 1435, 68, 1422,
- 1434, 68, 68, 68, 1426, 1438, 68, 1440, 1444, 1627,
- 68, 1627, 1427, 68, 1442, 68, 1431, 1430, 68, 1432,
- 1433, 1436, 68, 1437, 1435, 1439, 68, 1434, 1443, 1441,
- 68, 1445, 68, 68, 1440, 1444, 68, 68, 68, 68,
- 68, 1442, 1446, 68, 1447, 1627, 1448, 1449, 1450, 1452,
- 1437, 1451, 1439, 68, 68, 1443, 1441, 1453, 1445, 1454,
- 68, 1455, 68, 1457, 1460, 68, 1456, 1458, 1466, 1446,
- 1459, 1447, 68, 1448, 1449, 1450, 68, 68, 1451, 68,
- 68, 68, 68, 1461, 1453, 1462, 1454, 1464, 1455, 68,
-
- 1457, 1460, 1463, 1456, 1458, 1465, 68, 1459, 68, 68,
- 1467, 1468, 68, 68, 68, 68, 1470, 1469, 1471, 68,
- 1461, 1472, 1462, 1473, 1464, 68, 1627, 1474, 68, 1463,
- 1475, 1476, 1465, 1478, 68, 68, 1480, 1467, 68, 68,
- 1477, 68, 1481, 1470, 1469, 68, 1482, 1479, 1472, 68,
- 1473, 1484, 1483, 68, 1474, 68, 68, 1475, 1476, 68,
- 68, 1485, 1486, 68, 68, 1488, 1490, 1477, 1487, 1481,
- 1489, 1491, 1492, 68, 1479, 1493, 68, 68, 1484, 1483,
- 68, 1494, 1497, 68, 1498, 1627, 68, 1627, 68, 68,
- 1495, 1496, 1488, 68, 68, 1487, 1499, 1489, 1491, 1492,
-
- 68, 1500, 1493, 1501, 68, 1502, 1503, 1504, 1627, 68,
- 1506, 68, 68, 1505, 68, 1507, 1508, 1495, 1496, 1510,
- 1511, 1627, 1509, 1499, 1627, 68, 1512, 1514, 1500, 1513,
- 1501, 1627, 68, 68, 68, 68, 68, 68, 68, 1515,
- 1505, 68, 1507, 68, 68, 1521, 1510, 68, 68, 1509,
- 68, 68, 1519, 1512, 1514, 1518, 1513, 1516, 1517, 1523,
- 1522, 68, 1520, 1525, 1526, 1524, 1515, 68, 1527, 68,
- 1528, 1529, 68, 68, 68, 1627, 68, 68, 1535, 1519,
- 1532, 1530, 1518, 68, 1516, 1517, 68, 1522, 68, 1520,
- 68, 1526, 1524, 68, 1531, 1527, 1533, 68, 1529, 1536,
-
- 68, 1534, 68, 1537, 1538, 68, 1539, 1532, 1530, 68,
- 1540, 1541, 1542, 1544, 1627, 1627, 1545, 1543, 68, 68,
- 1627, 1531, 68, 1533, 68, 68, 68, 68, 1534, 1546,
- 68, 1538, 68, 1539, 68, 1547, 1548, 1549, 1541, 1542,
- 1544, 68, 68, 1545, 1543, 68, 1550, 1551, 1553, 1552,
- 68, 68, 68, 1554, 1555, 68, 1546, 1556, 68, 1559,
- 68, 1557, 1547, 1548, 1549, 1558, 1560, 68, 1564, 1561,
- 1565, 68, 68, 1550, 1551, 1553, 1552, 1562, 1566, 68,
- 68, 1555, 68, 68, 1556, 1563, 1559, 1568, 1557, 68,
- 1569, 68, 1558, 68, 1567, 68, 1561, 68, 1570, 68,
-
- 1574, 68, 1571, 68, 1562, 1566, 68, 1573, 68, 1572,
- 1575, 1576, 1563, 1577, 1568, 68, 68, 1569, 1582, 68,
- 1578, 1567, 68, 68, 1579, 1570, 1580, 1574, 1583, 1571,
- 1584, 1627, 68, 1581, 1573, 1585, 1572, 1575, 1576, 68,
- 1577, 68, 68, 68, 1586, 1587, 68, 1578, 68, 68,
- 68, 1579, 68, 1580, 1589, 68, 1588, 1584, 1590, 1591,
- 1581, 1592, 1585, 1593, 68, 1594, 1596, 68, 68, 68,
- 1597, 1586, 1595, 1599, 68, 1598, 68, 68, 1600, 1601,
- 68, 1589, 1602, 1588, 1603, 1590, 1591, 68, 1592, 1627,
- 1593, 68, 1594, 1596, 68, 68, 68, 1597, 68, 1595,
-
- 1599, 68, 1598, 1604, 68, 1600, 1601, 1605, 1607, 68,
- 1606, 1603, 1627, 1610, 1608, 68, 68, 1609, 1611, 1627,
- 1612, 68, 1615, 68, 1616, 1613, 68, 1618, 1619, 1627,
- 1604, 1627, 68, 68, 1605, 1607, 68, 1606, 1617, 68,
- 1610, 1608, 1614, 1620, 1609, 1611, 68, 1612, 68, 1615,
- 68, 68, 1613, 1621, 68, 68, 1622, 1625, 68, 1623,
- 1624, 1626, 1627, 68, 1627, 1617, 1627, 68, 68, 1614,
- 1620, 1627, 1627, 1627, 1627, 68, 1627, 1627, 68, 1627,
- 1621, 1627, 1627, 1622, 68, 1627, 1623, 1624, 68, 40,
- 40, 40, 40, 40, 40, 40, 45, 45, 45, 45,
-
- 45, 45, 45, 50, 50, 50, 50, 50, 50, 50,
- 56, 56, 56, 56, 56, 56, 56, 61, 61, 61,
- 61, 61, 61, 61, 71, 71, 1627, 71, 71, 71,
- 71, 123, 123, 1627, 1627, 1627, 123, 123, 125, 125,
- 1627, 1627, 125, 1627, 125, 127, 1627, 1627, 1627, 1627,
- 1627, 127, 130, 130, 1627, 1627, 1627, 130, 130, 132,
- 1627, 1627, 1627, 1627, 1627, 132, 134, 134, 1627, 134,
- 134, 134, 134, 72, 72, 1627, 72, 72, 72, 72,
- 13, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627,
- 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627,
-
- 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627,
- 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627,
- 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627,
- 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627,
- 1627, 1627, 1627, 1627, 1627, 1627
+ 68, 100, 139, 102, 90, 127, 120, 91, 68, 68,
+ 97, 121, 281, 80, 92, 104, 93, 81, 98, 103,
+ 82, 125, 83, 84, 99, 68, 101, 105, 100, 128,
+ 102, 128, 128, 106, 128, 109, 107, 68, 117, 110,
+ 118, 68, 134, 108, 132, 68, 103, 161, 133, 111,
+ 133, 133, 112, 133, 105, 119, 130, 185, 113, 199,
+ 106, 68, 109, 107, 68, 117, 110, 118, 114, 138,
+ 108, 122, 115, 116, 137, 123, 111, 129, 68, 112,
+ 68, 72, 119, 72, 72, 113, 72, 134, 68, 128,
+
+ 68, 128, 128, 68, 128, 114, 138, 68, 122, 115,
+ 116, 137, 123, 67, 140, 67, 67, 72, 67, 72,
+ 72, 68, 72, 67, 141, 143, 144, 72, 136, 145,
+ 147, 146, 149, 127, 68, 68, 125, 142, 148, 68,
+ 68, 140, 151, 152, 68, 156, 68, 68, 68, 150,
+ 68, 141, 143, 144, 73, 68, 145, 147, 146, 153,
+ 155, 157, 154, 68, 142, 148, 168, 68, 68, 151,
+ 152, 68, 156, 162, 68, 158, 150, 1730, 159, 68,
+ 169, 68, 167, 68, 163, 68, 153, 155, 157, 154,
+ 165, 1730, 160, 168, 166, 170, 171, 175, 172, 68,
+
+ 162, 174, 158, 68, 164, 159, 68, 169, 68, 167,
+ 68, 163, 173, 1730, 68, 68, 1730, 165, 68, 160,
+ 68, 166, 170, 171, 175, 172, 68, 176, 174, 177,
+ 179, 164, 181, 178, 180, 182, 68, 68, 186, 173,
+ 183, 68, 208, 184, 191, 1730, 68, 68, 68, 187,
+ 68, 68, 68, 68, 176, 189, 177, 179, 192, 181,
+ 178, 180, 182, 190, 68, 186, 194, 183, 196, 188,
+ 184, 191, 195, 68, 68, 68, 187, 68, 197, 193,
+ 1730, 1730, 189, 68, 1730, 192, 198, 68, 68, 133,
+ 190, 133, 133, 194, 133, 196, 188, 200, 72, 195,
+
+ 72, 72, 134, 72, 201, 197, 193, 202, 68, 68,
+ 203, 204, 205, 198, 207, 68, 1730, 206, 68, 209,
+ 1730, 217, 68, 68, 200, 216, 219, 218, 1730, 68,
+ 68, 201, 220, 222, 202, 136, 68, 203, 204, 221,
+ 210, 207, 227, 68, 206, 223, 68, 68, 217, 68,
+ 1730, 68, 216, 219, 218, 68, 228, 68, 1730, 220,
+ 222, 68, 224, 232, 68, 225, 221, 210, 211, 227,
+ 226, 1730, 223, 212, 230, 229, 231, 68, 213, 68,
+ 233, 68, 68, 228, 214, 215, 234, 68, 236, 224,
+ 239, 68, 225, 238, 68, 211, 235, 226, 237, 68,
+
+ 212, 230, 229, 231, 240, 213, 68, 233, 241, 242,
+ 243, 214, 215, 1730, 244, 245, 68, 68, 1730, 68,
+ 238, 68, 68, 235, 246, 237, 68, 247, 248, 1730,
+ 68, 240, 68, 256, 249, 68, 250, 243, 252, 68,
+ 68, 244, 245, 251, 253, 68, 257, 68, 68, 68,
+ 68, 246, 258, 68, 247, 248, 68, 254, 255, 260,
+ 68, 249, 259, 250, 68, 252, 68, 261, 262, 264,
+ 251, 253, 263, 257, 266, 68, 267, 68, 272, 258,
+ 270, 269, 68, 68, 254, 255, 274, 271, 68, 259,
+ 68, 265, 1730, 268, 261, 262, 134, 273, 68, 263,
+
+ 68, 68, 276, 267, 275, 68, 68, 270, 269, 68,
+ 278, 68, 68, 277, 271, 279, 68, 68, 265, 68,
+ 268, 280, 1730, 282, 273, 283, 1730, 284, 288, 276,
+ 287, 275, 68, 285, 286, 289, 291, 278, 68, 68,
+ 277, 293, 279, 290, 1730, 68, 68, 68, 280, 68,
+ 282, 68, 283, 68, 284, 288, 68, 287, 68, 292,
+ 285, 286, 68, 291, 294, 295, 68, 296, 297, 299,
+ 290, 68, 68, 68, 68, 298, 300, 303, 68, 301,
+ 304, 68, 68, 302, 1730, 305, 292, 306, 68, 314,
+ 307, 294, 295, 308, 296, 297, 299, 68, 68, 68,
+
+ 68, 68, 298, 300, 68, 310, 301, 304, 68, 309,
+ 302, 68, 305, 311, 306, 68, 68, 307, 315, 68,
+ 308, 312, 313, 316, 320, 318, 317, 323, 68, 319,
+ 1730, 1730, 310, 68, 322, 321, 309, 68, 326, 68,
+ 311, 328, 68, 324, 1730, 315, 68, 68, 312, 313,
+ 316, 68, 318, 317, 323, 1730, 319, 68, 68, 325,
+ 68, 322, 321, 68, 327, 329, 68, 330, 328, 68,
+ 324, 68, 331, 332, 337, 335, 333, 336, 334, 1730,
+ 339, 1730, 338, 340, 68, 68, 325, 68, 68, 68,
+ 342, 327, 329, 68, 330, 68, 68, 353, 341, 331,
+
+ 332, 337, 335, 333, 352, 334, 343, 339, 68, 338,
+ 340, 68, 354, 344, 68, 68, 68, 342, 134, 355,
+ 356, 357, 1730, 361, 353, 341, 68, 68, 68, 358,
+ 359, 352, 68, 343, 68, 68, 360, 362, 364, 354,
+ 344, 345, 346, 68, 363, 68, 355, 356, 357, 68,
+ 361, 347, 366, 348, 349, 350, 1730, 359, 351, 365,
+ 68, 1730, 367, 360, 362, 364, 68, 371, 345, 346,
+ 368, 375, 68, 68, 68, 68, 369, 370, 347, 372,
+ 348, 349, 350, 68, 373, 351, 365, 374, 378, 367,
+ 68, 379, 68, 376, 371, 68, 68, 368, 375, 377,
+
+ 68, 68, 382, 381, 380, 68, 372, 384, 68, 68,
+ 383, 373, 385, 387, 374, 378, 68, 386, 379, 388,
+ 376, 68, 392, 1730, 68, 68, 377, 389, 390, 382,
+ 381, 380, 391, 68, 384, 393, 68, 383, 68, 394,
+ 387, 68, 68, 68, 386, 68, 388, 396, 395, 68,
+ 397, 398, 1730, 68, 389, 390, 400, 68, 68, 391,
+ 401, 399, 393, 68, 1730, 402, 394, 68, 408, 405,
+ 68, 68, 403, 68, 396, 395, 68, 397, 398, 404,
+ 409, 68, 68, 400, 68, 411, 68, 401, 399, 410,
+ 416, 68, 402, 406, 407, 408, 405, 68, 68, 403,
+
+ 68, 68, 412, 414, 68, 413, 404, 409, 68, 415,
+ 417, 68, 411, 68, 68, 68, 410, 416, 418, 420,
+ 406, 407, 68, 419, 1730, 1730, 432, 68, 426, 1730,
+ 414, 1730, 413, 68, 68, 68, 415, 417, 427, 428,
+ 68, 1730, 1730, 1730, 430, 418, 420, 431, 429, 68,
+ 419, 421, 68, 432, 68, 426, 422, 433, 423, 68,
+ 434, 435, 439, 1730, 436, 427, 424, 68, 68, 437,
+ 68, 430, 438, 68, 431, 429, 425, 68, 421, 68,
+ 68, 68, 440, 422, 433, 423, 68, 434, 435, 439,
+ 441, 436, 442, 424, 443, 444, 437, 445, 446, 438,
+
+ 68, 1730, 447, 425, 68, 450, 68, 449, 68, 440,
+ 448, 68, 451, 68, 453, 452, 455, 441, 134, 442,
+ 463, 443, 444, 454, 68, 446, 68, 68, 68, 447,
+ 68, 461, 68, 456, 449, 68, 457, 448, 68, 451,
+ 68, 453, 452, 455, 68, 458, 462, 460, 464, 459,
+ 454, 68, 465, 466, 470, 468, 467, 1730, 68, 472,
+ 456, 68, 68, 457, 469, 471, 474, 475, 1730, 483,
+ 1730, 473, 1730, 68, 460, 68, 68, 68, 68, 68,
+ 476, 68, 468, 467, 68, 68, 472, 68, 68, 68,
+ 477, 469, 471, 68, 475, 478, 481, 68, 473, 479,
+
+ 68, 480, 482, 484, 1730, 68, 1730, 476, 485, 488,
+ 489, 486, 493, 1730, 68, 68, 1730, 477, 490, 1730,
+ 495, 68, 478, 481, 68, 494, 479, 68, 480, 482,
+ 484, 68, 68, 487, 68, 485, 488, 489, 486, 491,
+ 68, 492, 497, 68, 68, 490, 68, 495, 496, 498,
+ 68, 500, 494, 501, 499, 503, 68, 502, 68, 504,
+ 487, 506, 1730, 1730, 68, 1730, 491, 68, 492, 497,
+ 507, 505, 68, 68, 512, 496, 498, 68, 500, 68,
+ 501, 499, 513, 514, 502, 68, 68, 508, 68, 510,
+ 68, 515, 68, 511, 516, 520, 517, 507, 505, 68,
+
+ 68, 512, 509, 68, 68, 518, 524, 519, 68, 513,
+ 514, 68, 68, 68, 508, 521, 522, 527, 515, 523,
+ 68, 516, 520, 517, 526, 68, 529, 68, 525, 509,
+ 68, 68, 518, 528, 519, 534, 68, 68, 533, 531,
+ 68, 530, 521, 522, 527, 532, 523, 68, 68, 68,
+ 68, 526, 68, 529, 535, 525, 536, 68, 68, 68,
+ 528, 538, 534, 537, 539, 533, 531, 541, 530, 540,
+ 68, 542, 532, 543, 68, 549, 544, 548, 68, 1730,
+ 68, 535, 1730, 536, 68, 68, 545, 68, 538, 550,
+ 537, 539, 68, 134, 541, 68, 540, 68, 542, 68,
+
+ 543, 546, 551, 544, 548, 552, 68, 553, 565, 547,
+ 554, 561, 68, 545, 68, 562, 550, 68, 555, 68,
+ 68, 563, 564, 68, 566, 68, 68, 68, 546, 551,
+ 574, 68, 552, 1730, 553, 565, 547, 554, 561, 68,
+ 577, 594, 562, 68, 578, 555, 556, 575, 563, 564,
+ 557, 595, 68, 558, 581, 68, 68, 574, 579, 576,
+ 559, 68, 580, 560, 68, 1730, 68, 577, 68, 582,
+ 1730, 68, 68, 556, 575, 1730, 583, 557, 68, 584,
+ 558, 581, 68, 1730, 1730, 579, 576, 559, 68, 580,
+ 560, 567, 568, 592, 569, 68, 582, 570, 586, 585,
+
+ 68, 68, 571, 583, 587, 68, 584, 68, 572, 573,
+ 590, 588, 68, 589, 591, 68, 593, 68, 567, 568,
+ 592, 569, 68, 68, 570, 586, 585, 596, 597, 571,
+ 68, 587, 603, 598, 599, 572, 573, 590, 588, 68,
+ 589, 591, 601, 68, 604, 602, 605, 600, 1730, 68,
+ 1730, 68, 68, 68, 596, 597, 68, 607, 606, 68,
+ 598, 599, 608, 68, 68, 68, 68, 609, 1730, 601,
+ 610, 604, 602, 614, 600, 68, 611, 68, 1730, 68,
+ 68, 616, 612, 615, 607, 606, 68, 68, 68, 608,
+ 613, 617, 621, 620, 609, 619, 68, 610, 68, 618,
+
+ 614, 625, 68, 611, 68, 68, 68, 622, 616, 612,
+ 615, 68, 624, 623, 68, 68, 68, 613, 617, 621,
+ 620, 68, 619, 626, 627, 628, 618, 629, 625, 630,
+ 68, 68, 631, 1730, 622, 632, 637, 1730, 68, 624,
+ 623, 633, 634, 68, 68, 636, 638, 635, 639, 640,
+ 626, 627, 628, 68, 641, 68, 68, 68, 68, 631,
+ 68, 643, 632, 68, 68, 644, 645, 68, 633, 634,
+ 68, 68, 636, 638, 635, 639, 640, 642, 68, 646,
+ 648, 647, 649, 68, 68, 68, 658, 650, 68, 68,
+ 1730, 660, 134, 645, 68, 68, 1730, 657, 68, 659,
+
+ 661, 68, 68, 68, 642, 1730, 646, 648, 647, 649,
+ 1730, 664, 1730, 658, 650, 651, 662, 652, 660, 663,
+ 68, 653, 68, 654, 657, 665, 659, 661, 655, 68,
+ 673, 666, 68, 656, 68, 668, 669, 68, 664, 68,
+ 1730, 667, 651, 662, 652, 670, 663, 679, 653, 68,
+ 654, 68, 665, 68, 671, 655, 672, 68, 666, 674,
+ 656, 68, 668, 669, 675, 678, 676, 68, 667, 68,
+ 682, 684, 670, 683, 679, 680, 685, 68, 687, 681,
+ 68, 671, 689, 672, 677, 68, 674, 688, 68, 68,
+ 68, 675, 678, 676, 68, 68, 68, 682, 684, 686,
+
+ 683, 690, 680, 685, 691, 68, 681, 68, 692, 694,
+ 68, 677, 68, 68, 688, 693, 695, 68, 698, 700,
+ 696, 697, 68, 699, 702, 68, 686, 68, 690, 68,
+ 68, 691, 68, 701, 706, 692, 694, 68, 68, 709,
+ 68, 703, 693, 695, 704, 698, 700, 696, 697, 68,
+ 699, 68, 705, 68, 707, 68, 68, 68, 708, 711,
+ 701, 706, 710, 712, 68, 718, 709, 713, 703, 714,
+ 1730, 704, 715, 716, 720, 717, 68, 68, 1730, 705,
+ 68, 707, 68, 722, 719, 708, 723, 721, 68, 710,
+ 68, 68, 718, 68, 68, 68, 714, 68, 68, 715,
+
+ 716, 720, 717, 724, 725, 68, 726, 727, 68, 729,
+ 722, 719, 731, 723, 721, 68, 730, 728, 68, 733,
+ 732, 68, 1730, 734, 68, 738, 68, 68, 68, 735,
+ 724, 725, 736, 726, 68, 68, 729, 68, 740, 731,
+ 68, 741, 739, 730, 728, 742, 733, 732, 737, 68,
+ 734, 68, 738, 68, 68, 743, 735, 68, 68, 736,
+ 744, 746, 745, 747, 749, 740, 750, 68, 754, 739,
+ 68, 751, 68, 68, 68, 737, 68, 1730, 68, 68,
+ 68, 752, 743, 68, 68, 755, 753, 68, 746, 745,
+ 747, 749, 68, 750, 756, 754, 757, 758, 751, 68,
+
+ 1730, 759, 760, 761, 762, 763, 764, 767, 752, 765,
+ 766, 768, 755, 753, 68, 68, 68, 68, 68, 68,
+ 68, 68, 769, 68, 758, 68, 68, 68, 759, 760,
+ 761, 762, 763, 764, 68, 770, 765, 766, 768, 771,
+ 773, 772, 68, 68, 774, 775, 776, 1730, 1730, 769,
+ 779, 781, 777, 778, 780, 68, 783, 68, 68, 68,
+ 68, 782, 770, 68, 1730, 68, 771, 773, 772, 68,
+ 68, 774, 775, 776, 68, 68, 68, 779, 781, 777,
+ 778, 780, 784, 783, 68, 785, 786, 787, 782, 789,
+ 788, 790, 792, 795, 68, 68, 793, 68, 68, 791,
+
+ 68, 1730, 68, 68, 68, 799, 68, 794, 796, 784,
+ 797, 1730, 785, 786, 787, 798, 789, 788, 790, 792,
+ 68, 68, 68, 793, 68, 68, 791, 68, 803, 68,
+ 802, 804, 799, 805, 794, 796, 800, 797, 68, 806,
+ 801, 808, 798, 1730, 809, 68, 807, 1730, 810, 813,
+ 815, 68, 814, 816, 68, 803, 812, 802, 804, 811,
+ 805, 68, 68, 68, 1730, 817, 68, 68, 808, 823,
+ 68, 809, 68, 807, 68, 810, 813, 68, 68, 814,
+ 818, 68, 824, 812, 68, 68, 811, 68, 819, 825,
+ 826, 829, 817, 820, 827, 821, 823, 822, 828, 68,
+
+ 830, 68, 831, 68, 68, 68, 68, 818, 68, 824,
+ 832, 834, 835, 68, 836, 819, 825, 826, 829, 833,
+ 820, 68, 821, 68, 822, 68, 68, 830, 68, 831,
+ 837, 838, 839, 841, 840, 843, 842, 832, 834, 68,
+ 845, 836, 68, 68, 844, 846, 833, 847, 849, 848,
+ 854, 850, 68, 853, 68, 68, 851, 68, 838, 839,
+ 68, 840, 68, 842, 852, 68, 68, 68, 68, 68,
+ 68, 844, 846, 68, 847, 849, 848, 68, 850, 855,
+ 853, 68, 856, 851, 857, 68, 859, 858, 1730, 861,
+ 860, 852, 862, 863, 68, 864, 867, 68, 1730, 68,
+
+ 1730, 870, 869, 68, 68, 68, 68, 868, 1730, 856,
+ 68, 68, 865, 859, 858, 68, 68, 860, 866, 862,
+ 863, 874, 68, 867, 871, 68, 68, 68, 870, 869,
+ 872, 68, 68, 873, 868, 879, 875, 876, 884, 865,
+ 68, 882, 68, 68, 881, 866, 877, 880, 874, 883,
+ 878, 871, 1730, 68, 68, 1730, 885, 872, 1730, 68,
+ 873, 68, 879, 875, 876, 884, 68, 886, 882, 68,
+ 889, 881, 68, 888, 880, 68, 890, 68, 887, 68,
+ 68, 891, 68, 885, 892, 68, 893, 896, 68, 895,
+ 894, 1730, 68, 898, 886, 68, 1730, 889, 68, 68,
+
+ 888, 68, 68, 890, 899, 887, 897, 68, 891, 900,
+ 901, 892, 902, 893, 896, 904, 895, 894, 68, 906,
+ 898, 68, 903, 905, 908, 68, 68, 68, 909, 68,
+ 907, 899, 68, 897, 910, 911, 900, 901, 912, 902,
+ 68, 913, 904, 914, 68, 915, 906, 68, 918, 903,
+ 905, 924, 68, 68, 916, 68, 68, 907, 917, 68,
+ 68, 910, 68, 68, 1730, 912, 919, 923, 913, 920,
+ 914, 1730, 915, 922, 68, 68, 925, 68, 921, 68,
+ 932, 68, 68, 926, 68, 68, 929, 927, 68, 928,
+ 931, 68, 930, 919, 923, 68, 920, 68, 68, 68,
+
+ 922, 933, 68, 925, 934, 921, 68, 932, 935, 941,
+ 926, 936, 942, 929, 927, 945, 928, 931, 1730, 930,
+ 937, 943, 68, 68, 938, 940, 944, 68, 933, 68,
+ 948, 934, 68, 68, 68, 935, 68, 939, 936, 942,
+ 946, 947, 949, 950, 68, 68, 68, 937, 943, 68,
+ 951, 938, 940, 944, 952, 959, 68, 948, 953, 954,
+ 955, 956, 68, 68, 939, 1730, 1730, 946, 947, 957,
+ 68, 68, 960, 68, 68, 961, 966, 68, 68, 68,
+ 958, 952, 68, 977, 68, 953, 954, 955, 956, 962,
+ 963, 68, 68, 969, 68, 964, 957, 965, 68, 960,
+
+ 967, 68, 961, 966, 970, 68, 68, 958, 968, 68,
+ 973, 979, 976, 975, 68, 1730, 962, 963, 68, 68,
+ 969, 68, 964, 971, 965, 972, 68, 967, 68, 974,
+ 68, 970, 68, 980, 68, 968, 68, 973, 68, 976,
+ 975, 978, 68, 981, 982, 991, 68, 984, 68, 985,
+ 971, 983, 972, 990, 68, 986, 974, 1730, 993, 992,
+ 980, 994, 68, 68, 68, 68, 987, 68, 978, 988,
+ 68, 982, 991, 68, 984, 995, 985, 68, 983, 996,
+ 68, 989, 986, 1730, 68, 993, 992, 997, 994, 998,
+ 68, 1005, 999, 987, 1000, 1001, 988, 1002, 68, 68,
+
+ 68, 68, 995, 1003, 1004, 1006, 1007, 68, 989, 1013,
+ 68, 1010, 1730, 68, 997, 68, 998, 68, 68, 999,
+ 1011, 1000, 1001, 1012, 68, 1730, 68, 68, 68, 1008,
+ 1003, 1004, 1006, 1007, 1009, 68, 68, 68, 1010, 1014,
+ 68, 68, 1015, 1017, 1019, 1016, 68, 1011, 1018, 68,
+ 1012, 68, 1022, 1023, 1024, 1020, 1008, 1032, 1021, 1027,
+ 68, 1009, 1025, 68, 68, 68, 1014, 1033, 1730, 1015,
+ 1017, 1019, 1016, 68, 1031, 1018, 1026, 68, 68, 1022,
+ 68, 1024, 1020, 1028, 68, 1021, 1027, 68, 68, 1025,
+ 1029, 68, 68, 1030, 68, 1034, 1036, 1035, 1038, 1037,
+
+ 68, 1031, 68, 1026, 1039, 68, 1040, 1041, 68, 1048,
+ 1028, 68, 68, 68, 1042, 1730, 1043, 1029, 68, 1047,
+ 1030, 1050, 1034, 1036, 1035, 1038, 1037, 1053, 68, 1051,
+ 1044, 1039, 68, 1040, 1041, 1045, 68, 1052, 1046, 1049,
+ 68, 1042, 68, 1043, 68, 1054, 1047, 1058, 68, 1055,
+ 68, 1057, 68, 68, 1059, 1056, 1051, 1044, 68, 68,
+ 1060, 68, 1045, 68, 1052, 1046, 1049, 1061, 68, 1062,
+ 68, 1730, 1054, 68, 1058, 1063, 1055, 1065, 1057, 1064,
+ 68, 1059, 1056, 1066, 68, 1067, 68, 1060, 1070, 1068,
+ 1069, 1071, 68, 1072, 1075, 1730, 1062, 1730, 68, 1074,
+
+ 68, 1073, 1063, 68, 1065, 68, 1064, 68, 68, 68,
+ 1066, 68, 1067, 1078, 68, 1070, 1068, 1069, 1071, 68,
+ 68, 1075, 1076, 1077, 1079, 1080, 1074, 1081, 1073, 1082,
+ 1730, 68, 1084, 1083, 68, 1085, 1086, 68, 1730, 68,
+ 1087, 1730, 1088, 1089, 68, 1098, 1730, 1097, 68, 1076,
+ 1077, 1079, 1080, 68, 1081, 68, 68, 68, 1090, 68,
+ 1083, 68, 1085, 68, 68, 1091, 1092, 1087, 1093, 1088,
+ 1089, 1095, 1096, 68, 68, 1101, 68, 68, 68, 1100,
+ 1102, 1094, 68, 1099, 68, 1090, 68, 68, 68, 68,
+ 1103, 1104, 1091, 1092, 1105, 1093, 1106, 68, 1095, 1096,
+
+ 1107, 1108, 1101, 1109, 1111, 1110, 1100, 68, 1094, 1112,
+ 1099, 68, 1113, 1115, 68, 1114, 1125, 1103, 68, 68,
+ 1730, 68, 1120, 1106, 1730, 68, 1121, 1123, 1108, 68,
+ 1122, 68, 1110, 68, 68, 68, 1112, 68, 1127, 68,
+ 68, 68, 1114, 68, 68, 1116, 1117, 1118, 1128, 1120,
+ 1124, 1129, 1119, 1121, 1123, 68, 68, 1122, 1126, 68,
+ 68, 1130, 1132, 1133, 68, 1127, 1134, 68, 1131, 68,
+ 1135, 1139, 1116, 1117, 1118, 1128, 1137, 1124, 1129, 1119,
+ 68, 68, 68, 1136, 68, 1126, 1138, 68, 68, 1132,
+ 1133, 1140, 1141, 1134, 1142, 1131, 68, 1135, 68, 1144,
+
+ 1143, 1146, 68, 1137, 1145, 1147, 1148, 1730, 68, 1150,
+ 1136, 68, 68, 1138, 1730, 68, 68, 68, 1140, 1141,
+ 1154, 68, 68, 1149, 68, 1151, 1144, 1143, 1146, 68,
+ 1152, 1145, 1147, 1148, 1153, 68, 1150, 68, 68, 1156,
+ 1155, 68, 1159, 1157, 1163, 1160, 68, 1154, 1158, 1161,
+ 1149, 68, 1151, 1162, 1166, 1169, 1164, 1152, 68, 68,
+ 1165, 1153, 68, 1167, 68, 1168, 68, 1155, 1170, 68,
+ 1157, 68, 1160, 1171, 1172, 1158, 1161, 1173, 1174, 68,
+ 68, 1176, 1197, 68, 68, 68, 68, 68, 1175, 68,
+ 1167, 1177, 1168, 68, 1730, 1170, 68, 1178, 1730, 1179,
+
+ 1171, 1172, 1180, 1181, 1173, 1184, 68, 1182, 1188, 68,
+ 1183, 1730, 68, 68, 68, 1175, 1730, 1185, 1177, 1187,
+ 1190, 68, 1186, 68, 1178, 68, 1179, 68, 1189, 68,
+ 68, 68, 1184, 1192, 1182, 1188, 1195, 1183, 68, 1193,
+ 68, 68, 1194, 68, 1185, 1191, 1187, 68, 68, 1186,
+ 68, 68, 68, 1196, 1198, 1189, 1207, 1199, 1202, 68,
+ 1192, 1201, 1204, 1195, 1203, 1205, 1193, 68, 1200, 1194,
+ 68, 1209, 1191, 1206, 1210, 68, 68, 68, 1211, 1730,
+ 1196, 1198, 68, 68, 1199, 1202, 68, 68, 1201, 68,
+ 1212, 1203, 1205, 1208, 1215, 1200, 1214, 68, 1209, 68,
+
+ 1206, 1210, 1213, 68, 1217, 68, 1220, 1216, 1730, 68,
+ 68, 1218, 68, 68, 1223, 1219, 1228, 1212, 68, 68,
+ 1208, 1215, 68, 1214, 1224, 1221, 68, 1226, 1222, 1213,
+ 68, 1217, 68, 1220, 1216, 68, 68, 1225, 1218, 1230,
+ 1227, 1223, 1219, 68, 1231, 68, 68, 1229, 68, 68,
+ 1232, 1224, 1221, 68, 1226, 1222, 1233, 1236, 1235, 1234,
+ 1237, 68, 1238, 1239, 1225, 68, 1230, 1227, 68, 68,
+ 68, 1231, 68, 1240, 1229, 1244, 68, 1232, 68, 1241,
+ 1243, 1246, 68, 1233, 1730, 1235, 1234, 1237, 68, 1238,
+ 1239, 68, 1242, 1245, 1250, 1247, 68, 68, 1248, 68,
+
+ 68, 1249, 1244, 1254, 1256, 1252, 1241, 1253, 1246, 1251,
+ 1730, 68, 68, 68, 1257, 68, 1255, 68, 68, 1242,
+ 1245, 1250, 1247, 68, 68, 1248, 68, 68, 1249, 68,
+ 1254, 1256, 1252, 1258, 1253, 68, 1251, 1259, 1260, 1261,
+ 68, 1257, 1262, 1255, 1263, 1264, 1730, 1265, 1267, 68,
+ 1266, 1269, 1271, 1268, 68, 68, 1272, 68, 1273, 68,
+ 1258, 1274, 68, 1270, 1259, 1260, 1261, 68, 1275, 68,
+ 68, 1263, 68, 68, 1265, 1267, 68, 1266, 68, 1271,
+ 1268, 1276, 68, 68, 1277, 1273, 1279, 1278, 68, 1280,
+ 1270, 68, 1730, 68, 68, 1275, 68, 1281, 1282, 1284,
+
+ 1283, 1285, 68, 1287, 1286, 1289, 1288, 1730, 1276, 68,
+ 68, 1277, 68, 68, 1278, 68, 1280, 68, 1290, 68,
+ 1299, 68, 1291, 68, 1281, 1282, 1284, 1283, 1285, 68,
+ 68, 1286, 1289, 1288, 1292, 1293, 1295, 1296, 1294, 68,
+ 68, 68, 68, 68, 68, 1290, 1298, 68, 1300, 1291,
+ 1304, 1297, 68, 1301, 1305, 1302, 1303, 1306, 1308, 1309,
+ 1307, 1292, 1293, 1295, 1296, 1294, 68, 68, 68, 1310,
+ 68, 1311, 68, 1298, 68, 1300, 68, 1304, 1297, 68,
+ 1301, 68, 1302, 1303, 68, 68, 68, 1307, 1312, 1313,
+ 1315, 1314, 1316, 1317, 1318, 1319, 68, 1730, 1311, 68,
+
+ 1321, 68, 1320, 1324, 68, 1325, 1326, 1327, 1329, 1730,
+ 1322, 68, 68, 68, 1328, 68, 68, 1315, 1314, 68,
+ 1317, 68, 1319, 68, 68, 1323, 68, 1321, 1330, 1320,
+ 68, 68, 1325, 68, 1327, 1329, 68, 1322, 1331, 1332,
+ 1335, 1328, 1333, 68, 1334, 1336, 68, 1338, 1339, 68,
+ 1340, 1337, 1323, 1346, 1341, 68, 68, 1730, 68, 1730,
+ 68, 1343, 68, 1347, 1344, 1331, 68, 1335, 1342, 1333,
+ 68, 1334, 1336, 68, 1338, 1339, 68, 1340, 1337, 68,
+ 68, 1341, 68, 1345, 68, 1348, 68, 1349, 1343, 1350,
+ 1347, 1344, 68, 1351, 1352, 1342, 68, 1730, 1356, 1354,
+
+ 1355, 1730, 1353, 1730, 1357, 68, 1360, 1361, 1358, 1362,
+ 1345, 68, 1348, 68, 1349, 68, 1350, 1363, 68, 1370,
+ 68, 1352, 68, 1364, 68, 1356, 1354, 1355, 68, 1353,
+ 68, 1357, 1359, 68, 68, 1358, 1362, 1366, 68, 68,
+ 1365, 1730, 1367, 68, 1363, 68, 68, 1368, 1369, 1371,
+ 1364, 1372, 1373, 68, 1374, 1375, 1377, 1730, 68, 1359,
+ 1730, 1376, 68, 1378, 1366, 68, 1381, 1365, 68, 1367,
+ 68, 68, 68, 1380, 1368, 1369, 1371, 68, 1372, 1373,
+ 1379, 1374, 1375, 68, 68, 1382, 1383, 68, 1376, 1384,
+ 1378, 68, 1385, 1387, 1388, 68, 1386, 68, 1389, 1390,
+
+ 1380, 1392, 1395, 1391, 68, 1393, 68, 1379, 1394, 1730,
+ 1398, 68, 1382, 1383, 68, 68, 1384, 1399, 68, 68,
+ 68, 68, 1396, 1386, 1397, 68, 1390, 68, 1392, 68,
+ 1391, 68, 1393, 68, 1400, 68, 68, 68, 1402, 68,
+ 1401, 1403, 1404, 1405, 1399, 1407, 1730, 1406, 1408, 1396,
+ 1730, 1397, 1413, 68, 68, 1411, 1409, 1412, 1410, 68,
+ 68, 1400, 68, 68, 68, 1402, 1730, 1401, 68, 68,
+ 68, 68, 1407, 68, 1406, 1408, 1414, 68, 1417, 68,
+ 1415, 68, 1411, 1409, 1412, 1410, 1416, 1418, 1419, 1420,
+ 68, 1421, 68, 68, 68, 1422, 68, 1423, 68, 1424,
+
+ 1425, 68, 1426, 1414, 1434, 1417, 1730, 1415, 1730, 68,
+ 1433, 1427, 1430, 1416, 1418, 1419, 1420, 68, 1421, 68,
+ 68, 1436, 1422, 1428, 1423, 1429, 68, 68, 68, 1426,
+ 68, 68, 68, 1431, 1432, 1435, 68, 1433, 1427, 1430,
+ 68, 68, 1437, 68, 1442, 1443, 1438, 1439, 1436, 1730,
+ 1428, 1441, 1429, 68, 68, 68, 68, 1440, 1444, 68,
+ 1431, 1432, 1435, 1445, 1446, 1450, 1451, 68, 68, 1437,
+ 1447, 68, 68, 1438, 1439, 68, 68, 68, 1441, 1448,
+ 1454, 1449, 1452, 1455, 1440, 1444, 1453, 68, 68, 68,
+ 1445, 1446, 1450, 68, 68, 68, 1457, 1447, 1456, 1459,
+
+ 1460, 1730, 1461, 68, 1463, 1730, 1448, 1454, 1449, 1452,
+ 68, 1458, 68, 1453, 1464, 1462, 1466, 1465, 1467, 68,
+ 68, 1468, 68, 68, 68, 1456, 68, 68, 68, 1461,
+ 1469, 1463, 1470, 68, 1471, 1472, 68, 68, 1458, 68,
+ 1473, 1464, 1462, 1466, 1465, 1467, 68, 1474, 1468, 1475,
+ 1476, 1478, 68, 1477, 68, 1730, 1479, 1469, 1730, 1470,
+ 1482, 1471, 68, 1480, 1484, 1730, 1481, 68, 1486, 1483,
+ 1730, 68, 68, 1730, 1485, 1730, 1475, 68, 68, 68,
+ 68, 1489, 68, 1479, 68, 68, 68, 1482, 68, 68,
+ 1480, 1484, 68, 1481, 1487, 1486, 1483, 1488, 1490, 68,
+
+ 1491, 1485, 1492, 68, 1493, 1496, 1494, 1495, 1489, 1498,
+ 1497, 68, 68, 68, 1730, 68, 68, 1500, 1503, 1499,
+ 68, 1487, 1501, 1505, 1488, 1490, 68, 1491, 68, 1492,
+ 68, 1493, 68, 1494, 1495, 1504, 68, 1497, 68, 68,
+ 68, 1502, 1514, 1507, 1500, 1503, 1499, 1506, 1508, 1501,
+ 68, 1509, 1510, 1511, 68, 68, 1512, 1515, 1513, 1516,
+ 1517, 68, 1504, 1518, 1730, 68, 1525, 1730, 1502, 68,
+ 1507, 68, 68, 68, 1506, 1508, 1730, 1521, 68, 68,
+ 68, 68, 68, 1512, 68, 1513, 1516, 1517, 1519, 1520,
+ 1523, 1522, 1524, 68, 68, 1526, 1531, 68, 68, 68,
+
+ 68, 1527, 1528, 68, 1521, 68, 1529, 68, 1530, 1532,
+ 68, 1534, 68, 1540, 1533, 1519, 1520, 1523, 1522, 1524,
+ 68, 68, 1526, 1531, 1535, 1538, 1730, 1541, 1527, 1528,
+ 1536, 68, 68, 1529, 68, 1530, 1532, 68, 1534, 1537,
+ 68, 1533, 68, 1542, 1539, 1543, 68, 1544, 1546, 68,
+ 68, 1535, 1538, 68, 1541, 1545, 1547, 1536, 68, 68,
+ 1549, 68, 1548, 68, 1730, 68, 1537, 1550, 1551, 1557,
+ 1542, 1539, 1543, 68, 1544, 1546, 1555, 1558, 1552, 68,
+ 1559, 1553, 1545, 1547, 68, 68, 68, 1549, 68, 1548,
+ 68, 1554, 1556, 1562, 1550, 1551, 68, 68, 68, 1561,
+
+ 68, 68, 1560, 1555, 1558, 1552, 1564, 68, 1553, 1563,
+ 68, 68, 1565, 1566, 1570, 1567, 1568, 1571, 1554, 1556,
+ 68, 68, 1572, 68, 68, 68, 1561, 1569, 68, 1560,
+ 1573, 1574, 68, 1564, 68, 1576, 1563, 1577, 68, 1565,
+ 1566, 68, 1567, 1568, 1571, 1579, 1575, 1580, 1730, 68,
+ 68, 1578, 68, 68, 1569, 1581, 68, 1573, 68, 1583,
+ 1582, 68, 1576, 68, 1577, 1584, 68, 1587, 1585, 1586,
+ 1589, 1588, 68, 1575, 68, 68, 68, 1592, 1578, 68,
+ 1590, 1591, 1581, 68, 1593, 1594, 1583, 1582, 1595, 68,
+ 68, 1598, 68, 68, 1587, 1585, 1586, 1597, 1588, 1599,
+
+ 1596, 68, 1600, 1601, 68, 1602, 1604, 1590, 1591, 1603,
+ 68, 68, 1594, 68, 1606, 1595, 1605, 1607, 68, 68,
+ 1609, 1608, 1612, 1610, 1597, 68, 68, 1596, 1730, 68,
+ 1601, 1611, 68, 68, 68, 68, 1603, 68, 1618, 68,
+ 68, 68, 1613, 1605, 1607, 68, 1614, 68, 1608, 1612,
+ 1610, 68, 1619, 68, 1615, 1616, 1617, 68, 1611, 68,
+ 68, 1620, 68, 1621, 68, 1618, 1622, 1623, 1624, 1613,
+ 1626, 1625, 1629, 1614, 1627, 1630, 1628, 1730, 1631, 1619,
+ 68, 1615, 1616, 1617, 68, 68, 68, 1634, 68, 68,
+ 68, 68, 1632, 1622, 68, 1624, 1635, 68, 1625, 68,
+
+ 1633, 1627, 68, 1628, 68, 1631, 68, 1636, 1637, 68,
+ 1638, 1639, 1640, 1641, 1634, 68, 1642, 1643, 68, 1632,
+ 1644, 1730, 1645, 1635, 1646, 1730, 1730, 1633, 68, 1649,
+ 1648, 1730, 68, 68, 1636, 68, 1647, 68, 68, 68,
+ 1641, 68, 68, 1642, 68, 68, 1650, 1644, 68, 1645,
+ 1651, 1646, 68, 68, 1652, 1654, 1649, 1648, 1653, 1655,
+ 1656, 68, 68, 1647, 68, 1657, 68, 68, 1659, 1660,
+ 1658, 1662, 68, 1650, 1661, 1663, 68, 1651, 1667, 1668,
+ 1664, 1652, 1654, 68, 1730, 1653, 1655, 1656, 68, 1670,
+ 68, 68, 68, 68, 1666, 1659, 1660, 1658, 1662, 1665,
+
+ 1669, 1661, 68, 68, 1671, 1672, 68, 1664, 1677, 68,
+ 68, 68, 68, 68, 1673, 1674, 1670, 1676, 68, 1675,
+ 1679, 1666, 68, 1678, 1685, 68, 1665, 1669, 68, 68,
+ 68, 1671, 1672, 68, 1680, 1677, 1681, 1682, 1686, 1730,
+ 1683, 1673, 1674, 1684, 1676, 68, 1675, 1679, 1687, 1688,
+ 1678, 68, 1690, 1697, 1730, 68, 1730, 68, 68, 68,
+ 68, 1680, 68, 1681, 1682, 68, 1689, 1683, 68, 1691,
+ 1684, 1692, 1693, 1694, 68, 1687, 1688, 68, 1695, 68,
+ 1697, 68, 1698, 68, 1699, 68, 68, 1696, 1730, 1700,
+ 1730, 1701, 68, 1689, 68, 1730, 1691, 1702, 1692, 1693,
+
+ 1694, 68, 1703, 1705, 68, 1695, 1706, 1707, 1730, 1698,
+ 1709, 1699, 1704, 1708, 1696, 68, 1700, 68, 1701, 68,
+ 68, 68, 68, 1710, 1702, 1711, 68, 68, 1713, 1703,
+ 68, 68, 68, 1706, 1707, 1712, 68, 1709, 1714, 1704,
+ 1708, 1715, 1719, 1716, 1720, 1717, 68, 68, 1718, 1721,
+ 1710, 68, 1711, 68, 1722, 1713, 1730, 68, 1723, 1730,
+ 1724, 1725, 1712, 1728, 68, 1714, 1729, 68, 1715, 68,
+ 1716, 1720, 1717, 1730, 68, 1718, 68, 1730, 68, 1730,
+ 1730, 68, 68, 68, 1726, 1723, 1727, 1724, 1725, 1730,
+ 68, 1730, 68, 68, 68, 1730, 1730, 1730, 1730, 1730,
+
+ 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730,
+ 1730, 1726, 1730, 1727, 40, 40, 40, 40, 40, 40,
+ 40, 45, 45, 45, 45, 45, 45, 45, 50, 50,
+ 50, 50, 50, 50, 50, 56, 56, 56, 56, 56,
+ 56, 56, 61, 61, 61, 61, 61, 61, 61, 71,
+ 71, 1730, 71, 71, 71, 71, 124, 124, 1730, 1730,
+ 1730, 124, 124, 126, 126, 1730, 1730, 126, 1730, 126,
+ 128, 1730, 1730, 1730, 1730, 1730, 128, 131, 131, 1730,
+ 1730, 1730, 131, 131, 133, 1730, 1730, 1730, 1730, 1730,
+ 133, 135, 135, 1730, 135, 135, 135, 135, 72, 72,
+
+ 1730, 72, 72, 72, 72, 13, 1730, 1730, 1730, 1730,
+ 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730,
+ 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730,
+ 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730,
+ 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730,
+ 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730,
+ 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730,
+ 1730
} ;
-static yyconst flex_int16_t yy_chk[4747] =
+static yyconst flex_int16_t yy_chk[5072] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 3, 3, 3, 4, 4,
4, 5, 5, 6, 6, 5, 24, 6, 7, 7,
- 7, 7, 1633, 7, 8, 8, 8, 8, 24, 8,
+ 7, 7, 1736, 7, 8, 8, 8, 8, 24, 8,
9, 9, 9, 10, 10, 10, 15, 44, 44, 49,
15, 3, 49, 24, 4, 60, 60, 5, 19, 6,
- 19, 19, 69, 19, 625, 7, 69, 39, 19, 39,
- 39, 8, 39, 23, 20, 20, 9, 39, 619, 10,
+ 19, 19, 69, 19, 644, 7, 69, 39, 19, 39,
+ 39, 8, 39, 23, 20, 20, 9, 39, 638, 10,
11, 11, 11, 11, 11, 11, 12, 12, 12, 12,
12, 12, 20, 23, 27, 19, 23, 29, 20, 11,
- 23, 20, 20, 132, 21, 12, 27, 25, 619, 29,
- 130, 21, 124, 124, 28, 25, 129, 11, 21, 20,
- 23, 27, 126, 12, 29, 126, 11, 131, 131, 127,
+ 23, 20, 20, 133, 21, 12, 27, 25, 638, 29,
+ 131, 21, 125, 125, 28, 25, 130, 11, 21, 20,
+ 23, 27, 127, 12, 29, 127, 11, 132, 132, 128,
21, 21, 12, 25, 25, 75, 28, 26, 21, 37,
26, 28, 25, 30, 37, 21, 22, 26, 32, 26,
22, 30, 37, 22, 32, 22, 22, 30, 75, 31,
- 26, 30, 75, 31, 26, 125, 37, 26, 22, 30,
- 30, 37, 205, 22, 26, 32, 26, 22, 30, 31,
- 22, 89, 22, 22, 30, 31, 31, 33, 30, 34,
- 31, 123, 36, 33, 36, 55, 33, 55, 55, 34,
- 55, 205, 34, 33, 89, 33, 31, 148, 89, 36,
- 63, 34, 63, 63, 33, 63, 34, 35, 36, 36,
- 33, 36, 65, 33, 38, 67, 34, 35, 38, 34,
- 33, 35, 35, 148, 148, 65, 36, 61, 66, 35,
- 66, 66, 56, 66, 35, 51, 76, 63, 74, 65,
-
- 38, 38, 77, 76, 35, 38, 82, 50, 35, 35,
- 68, 82, 68, 68, 71, 68, 71, 71, 78, 71,
- 68, 79, 74, 76, 71, 74, 77, 78, 80, 77,
- 81, 85, 83, 82, 79, 84, 45, 87, 88, 81,
- 83, 90, 86, 80, 85, 78, 87, 88, 79, 86,
- 40, 71, 84, 92, 91, 80, 92, 81, 85, 83,
- 93, 99, 185, 90, 87, 88, 84, 91, 90, 86,
- 92, 96, 95, 97, 94, 96, 97, 92, 14, 84,
- 92, 91, 94, 92, 99, 100, 102, 185, 99, 185,
- 98, 93, 95, 101, 95, 96, 103, 92, 96, 95,
-
- 97, 94, 96, 98, 104, 100, 102, 101, 113, 105,
- 103, 104, 100, 102, 108, 106, 109, 98, 107, 95,
- 101, 108, 107, 103, 106, 110, 111, 13, 0, 112,
- 109, 104, 105, 114, 111, 115, 105, 110, 112, 113,
- 107, 108, 106, 109, 119, 107, 117, 0, 114, 107,
- 116, 121, 110, 111, 120, 115, 112, 117, 118, 116,
- 114, 115, 115, 122, 118, 119, 121, 0, 0, 119,
- 0, 119, 122, 117, 138, 136, 120, 116, 121, 137,
- 0, 120, 115, 145, 128, 118, 128, 128, 0, 128,
- 122, 133, 119, 133, 133, 134, 133, 134, 134, 136,
-
- 134, 137, 136, 139, 140, 138, 137, 141, 143, 142,
- 149, 144, 0, 143, 145, 139, 142, 0, 149, 141,
- 146, 0, 150, 140, 151, 153, 157, 152, 151, 154,
- 139, 140, 134, 144, 141, 157, 142, 149, 144, 143,
- 143, 146, 154, 155, 150, 162, 0, 153, 146, 150,
- 152, 151, 153, 157, 152, 155, 154, 156, 0, 0,
- 156, 158, 0, 159, 160, 0, 161, 165, 146, 147,
- 155, 160, 156, 163, 147, 167, 162, 161, 168, 147,
- 170, 167, 0, 158, 156, 147, 147, 156, 158, 159,
- 159, 160, 147, 161, 164, 169, 147, 166, 165, 163,
-
- 163, 147, 167, 171, 164, 173, 147, 0, 172, 168,
- 0, 170, 147, 147, 174, 166, 175, 169, 176, 177,
- 180, 174, 169, 176, 166, 164, 173, 178, 172, 179,
- 183, 164, 173, 184, 171, 172, 179, 175, 177, 178,
- 184, 174, 180, 175, 181, 176, 177, 180, 186, 181,
- 182, 182, 187, 190, 178, 188, 179, 189, 192, 182,
- 184, 183, 0, 188, 191, 198, 194, 200, 186, 0,
- 197, 181, 189, 193, 0, 186, 200, 182, 182, 190,
- 190, 194, 188, 187, 189, 196, 191, 198, 195, 192,
- 193, 199, 198, 194, 200, 191, 195, 201, 193, 203,
-
- 193, 197, 204, 199, 196, 202, 210, 202, 206, 213,
- 207, 208, 196, 191, 214, 195, 201, 193, 199, 209,
- 211, 212, 208, 203, 201, 215, 203, 214, 204, 204,
- 210, 209, 202, 210, 206, 206, 207, 207, 208, 212,
- 213, 214, 216, 211, 217, 219, 209, 211, 212, 218,
- 224, 215, 215, 220, 219, 222, 218, 221, 223, 220,
- 226, 230, 227, 225, 216, 0, 0, 223, 228, 216,
- 235, 221, 219, 224, 0, 217, 218, 224, 225, 230,
- 220, 222, 222, 228, 221, 223, 227, 232, 230, 227,
- 225, 226, 231, 229, 233, 228, 229, 235, 231, 234,
-
- 234, 232, 237, 229, 236, 237, 238, 239, 240, 233,
- 245, 0, 237, 242, 232, 241, 252, 0, 238, 231,
- 229, 233, 247, 229, 234, 239, 234, 234, 236, 237,
- 253, 236, 237, 238, 239, 240, 243, 241, 244, 242,
- 242, 245, 241, 246, 247, 244, 249, 252, 243, 247,
- 246, 248, 253, 248, 251, 250, 254, 253, 250, 249,
- 250, 255, 254, 243, 256, 244, 250, 0, 255, 267,
- 246, 257, 251, 249, 0, 248, 256, 258, 248, 259,
- 248, 251, 250, 254, 257, 250, 264, 250, 255, 262,
- 261, 256, 259, 258, 264, 0, 265, 263, 257, 269,
-
- 267, 258, 261, 263, 258, 266, 259, 262, 265, 271,
- 350, 269, 266, 264, 0, 270, 262, 261, 268, 274,
- 258, 260, 260, 265, 263, 268, 269, 270, 273, 272,
- 276, 260, 266, 260, 260, 260, 272, 350, 260, 0,
- 271, 273, 270, 275, 278, 268, 260, 0, 260, 260,
- 274, 278, 276, 283, 275, 273, 272, 276, 260, 281,
- 260, 260, 260, 277, 277, 260, 279, 280, 285, 286,
- 275, 278, 281, 282, 284, 0, 283, 279, 280, 287,
- 283, 285, 286, 284, 0, 288, 281, 286, 289, 291,
- 290, 293, 277, 279, 280, 285, 286, 287, 282, 294,
-
- 282, 284, 292, 297, 296, 295, 287, 288, 290, 286,
- 298, 289, 288, 318, 293, 289, 298, 290, 293, 295,
- 291, 294, 299, 292, 300, 301, 294, 302, 303, 292,
- 296, 296, 295, 305, 297, 304, 308, 298, 307, 300,
- 299, 304, 308, 310, 318, 315, 0, 309, 301, 299,
- 303, 300, 301, 302, 302, 303, 311, 316, 315, 305,
- 305, 310, 304, 308, 307, 307, 309, 317, 313, 314,
- 310, 311, 315, 319, 309, 313, 314, 323, 322, 316,
- 320, 321, 319, 311, 316, 320, 317, 321, 324, 323,
- 326, 325, 0, 0, 317, 313, 314, 0, 326, 0,
-
- 319, 322, 325, 329, 323, 322, 328, 320, 321, 0,
- 324, 330, 331, 328, 329, 324, 332, 326, 325, 327,
- 330, 0, 333, 332, 327, 334, 327, 334, 335, 336,
- 329, 0, 339, 328, 327, 337, 331, 346, 341, 331,
- 339, 336, 330, 332, 327, 327, 327, 330, 333, 333,
- 337, 327, 334, 327, 335, 335, 336, 338, 340, 339,
- 341, 327, 337, 340, 342, 341, 343, 344, 346, 338,
- 359, 327, 345, 347, 343, 349, 357, 348, 354, 344,
- 357, 351, 342, 352, 338, 340, 348, 353, 347, 349,
- 354, 342, 355, 343, 344, 345, 351, 359, 352, 345,
-
- 347, 358, 349, 360, 348, 354, 356, 357, 351, 356,
- 352, 353, 361, 362, 353, 358, 355, 356, 363, 355,
- 364, 365, 366, 367, 368, 0, 372, 365, 358, 369,
- 360, 370, 371, 356, 374, 0, 356, 376, 373, 371,
- 362, 378, 0, 361, 366, 363, 367, 374, 365, 366,
- 367, 364, 369, 370, 380, 368, 369, 372, 370, 371,
- 373, 374, 375, 376, 376, 373, 377, 375, 381, 379,
- 382, 375, 378, 385, 383, 377, 387, 384, 380, 0,
- 0, 380, 398, 391, 385, 388, 375, 379, 383, 375,
- 381, 381, 382, 377, 375, 381, 379, 382, 375, 384,
-
- 385, 383, 389, 386, 384, 391, 388, 387, 390, 393,
- 391, 392, 388, 398, 0, 394, 395, 381, 386, 396,
- 392, 397, 393, 0, 400, 397, 389, 399, 0, 389,
- 386, 402, 390, 0, 404, 390, 393, 394, 392, 400,
- 395, 396, 394, 395, 414, 399, 396, 403, 400, 401,
- 409, 400, 397, 401, 399, 403, 402, 407, 402, 404,
- 405, 404, 406, 408, 410, 407, 400, 411, 0, 405,
- 408, 406, 412, 409, 403, 414, 413, 409, 415, 411,
- 401, 412, 410, 416, 407, 417, 415, 405, 413, 406,
- 408, 410, 419, 420, 411, 418, 423, 0, 421, 412,
-
- 0, 422, 424, 413, 420, 415, 421, 425, 417, 416,
- 416, 418, 417, 426, 419, 422, 423, 427, 429, 419,
- 420, 428, 418, 423, 424, 421, 433, 425, 422, 424,
- 428, 430, 432, 431, 425, 426, 435, 0, 429, 427,
- 426, 434, 435, 436, 427, 429, 431, 440, 428, 430,
- 433, 436, 438, 433, 432, 454, 456, 439, 430, 432,
- 431, 0, 440, 435, 434, 447, 441, 442, 434, 436,
- 436, 444, 443, 444, 440, 441, 454, 447, 436, 450,
- 439, 443, 454, 438, 439, 453, 442, 456, 455, 450,
- 0, 458, 447, 441, 442, 0, 459, 461, 444, 443,
-
- 445, 462, 0, 453, 445, 459, 450, 445, 460, 463,
- 460, 455, 453, 458, 445, 455, 464, 445, 458, 0,
- 0, 461, 445, 459, 461, 465, 468, 445, 462, 463,
- 466, 445, 471, 469, 445, 460, 463, 465, 470, 467,
- 469, 445, 464, 464, 445, 457, 470, 457, 468, 472,
- 457, 471, 465, 468, 476, 457, 466, 466, 475, 471,
- 469, 457, 457, 467, 474, 470, 467, 473, 477, 478,
- 457, 479, 457, 474, 457, 472, 472, 457, 481, 473,
- 475, 476, 457, 480, 482, 475, 484, 483, 457, 457,
- 486, 474, 485, 488, 473, 479, 483, 481, 479, 477,
-
- 478, 487, 491, 482, 480, 481, 493, 489, 484, 492,
- 480, 482, 485, 484, 483, 489, 498, 486, 494, 485,
- 487, 497, 492, 495, 488, 512, 491, 497, 487, 491,
- 494, 495, 493, 493, 489, 499, 492, 500, 498, 503,
- 504, 499, 502, 498, 500, 494, 501, 495, 497, 502,
- 495, 501, 505, 507, 509, 0, 512, 503, 495, 508,
- 506, 505, 499, 504, 500, 511, 503, 504, 506, 502,
- 510, 507, 508, 501, 513, 509, 514, 510, 511, 505,
- 507, 509, 515, 516, 517, 518, 508, 506, 519, 520,
- 515, 518, 511, 524, 521, 522, 526, 510, 516, 514,
-
- 525, 527, 523, 514, 522, 513, 517, 525, 529, 515,
- 516, 517, 518, 528, 519, 519, 523, 538, 521, 532,
- 520, 521, 522, 526, 524, 528, 530, 525, 527, 523,
- 531, 529, 532, 531, 530, 529, 534, 0, 535, 538,
- 528, 536, 537, 536, 538, 0, 532, 541, 539, 0,
- 535, 559, 0, 530, 537, 0, 0, 531, 533, 534,
- 533, 539, 0, 534, 533, 535, 533, 540, 536, 537,
- 541, 533, 542, 543, 541, 539, 533, 545, 559, 544,
- 540, 549, 533, 543, 542, 533, 546, 533, 548, 547,
- 545, 533, 546, 533, 540, 543, 551, 562, 533, 542,
-
- 543, 544, 547, 533, 545, 554, 544, 552, 555, 548,
- 543, 553, 549, 546, 550, 548, 547, 556, 551, 550,
- 552, 550, 560, 551, 557, 558, 553, 0, 562, 563,
- 555, 554, 554, 558, 552, 555, 556, 557, 553, 550,
- 550, 550, 564, 565, 556, 560, 550, 567, 550, 560,
- 564, 557, 558, 563, 566, 567, 563, 565, 570, 568,
- 569, 573, 572, 574, 571, 576, 550, 0, 569, 564,
- 565, 571, 583, 576, 567, 572, 566, 568, 578, 573,
- 570, 566, 579, 582, 577, 570, 568, 569, 573, 572,
- 578, 571, 576, 577, 574, 580, 581, 584, 583, 583,
-
- 587, 582, 586, 587, 579, 578, 586, 588, 589, 579,
- 582, 577, 590, 591, 593, 592, 594, 580, 581, 590,
- 589, 592, 580, 581, 595, 597, 587, 587, 584, 598,
- 587, 588, 599, 586, 588, 589, 593, 591, 594, 590,
- 591, 593, 592, 594, 596, 595, 597, 604, 600, 601,
- 599, 595, 597, 602, 604, 596, 598, 600, 603, 599,
- 606, 607, 602, 605, 611, 609, 603, 612, 610, 608,
- 613, 596, 615, 601, 604, 600, 601, 605, 608, 611,
- 602, 614, 606, 607, 610, 603, 616, 606, 607, 609,
- 605, 611, 609, 614, 616, 610, 608, 617, 612, 615,
-
- 618, 613, 620, 621, 622, 623, 626, 623, 614, 628,
- 617, 620, 622, 616, 627, 618, 628, 629, 630, 626,
- 631, 621, 0, 0, 617, 632, 627, 618, 635, 620,
- 621, 622, 623, 626, 634, 636, 628, 633, 632, 637,
- 635, 627, 631, 636, 639, 638, 641, 631, 629, 630,
- 633, 637, 632, 638, 640, 635, 634, 643, 642, 645,
- 644, 634, 636, 640, 633, 642, 637, 641, 647, 648,
- 0, 639, 638, 641, 0, 646, 649, 650, 648, 645,
- 655, 640, 644, 643, 643, 642, 645, 644, 646, 651,
- 652, 654, 647, 653, 649, 647, 648, 651, 655, 650,
-
- 658, 653, 646, 649, 650, 659, 0, 655, 662, 656,
- 657, 663, 652, 659, 654, 658, 651, 652, 654, 660,
- 653, 656, 657, 663, 661, 660, 665, 658, 667, 662,
- 668, 669, 659, 661, 664, 662, 656, 657, 663, 676,
- 670, 664, 671, 668, 665, 672, 660, 670, 673, 672,
- 669, 661, 674, 665, 675, 678, 673, 668, 669, 667,
- 677, 664, 679, 682, 671, 680, 674, 670, 685, 671,
- 676, 686, 675, 687, 684, 673, 672, 678, 681, 674,
- 683, 675, 678, 684, 679, 682, 677, 677, 688, 679,
- 682, 680, 680, 683, 0, 687, 681, 690, 0, 685,
-
- 687, 684, 686, 689, 692, 681, 693, 683, 689, 695,
- 689, 688, 689, 690, 694, 688, 698, 696, 693, 697,
- 701, 689, 695, 694, 690, 696, 700, 692, 700, 698,
- 689, 692, 703, 693, 705, 689, 695, 689, 697, 689,
- 699, 694, 702, 698, 696, 708, 697, 701, 706, 699,
- 709, 710, 707, 700, 702, 712, 713, 709, 705, 703,
- 707, 705, 711, 713, 714, 716, 715, 699, 717, 702,
- 706, 718, 708, 722, 723, 706, 719, 709, 710, 707,
- 718, 720, 712, 713, 711, 715, 714, 716, 724, 711,
- 725, 714, 716, 715, 717, 717, 726, 719, 718, 727,
-
- 728, 720, 729, 719, 722, 723, 730, 727, 720, 732,
- 724, 735, 733, 730, 726, 724, 728, 734, 731, 733,
- 735, 725, 731, 726, 734, 736, 727, 728, 737, 729,
- 738, 740, 738, 730, 739, 737, 748, 741, 735, 733,
- 732, 741, 745, 739, 734, 731, 742, 746, 749, 748,
- 744, 736, 736, 740, 744, 737, 751, 738, 740, 747,
- 745, 739, 750, 748, 741, 0, 746, 752, 742, 745,
- 753, 753, 751, 742, 746, 752, 755, 758, 754, 749,
- 762, 744, 756, 751, 747, 750, 747, 754, 757, 750,
- 759, 756, 762, 760, 752, 757, 764, 753, 755, 759,
-
- 758, 760, 763, 755, 758, 754, 761, 762, 765, 756,
- 763, 773, 766, 767, 768, 757, 770, 759, 764, 761,
- 760, 771, 767, 764, 769, 772, 774, 771, 765, 763,
- 0, 777, 768, 761, 766, 765, 769, 770, 775, 766,
- 767, 768, 773, 770, 778, 780, 779, 772, 771, 782,
- 781, 769, 772, 780, 781, 783, 787, 774, 777, 779,
- 784, 785, 785, 783, 775, 775, 778, 786, 784, 788,
- 789, 778, 780, 779, 794, 786, 782, 787, 789, 795,
- 794, 781, 783, 787, 790, 791, 793, 784, 785, 796,
- 792, 795, 790, 791, 786, 799, 797, 789, 792, 793,
-
- 788, 794, 798, 800, 802, 803, 795, 801, 806, 799,
- 804, 790, 791, 793, 801, 796, 796, 792, 797, 805,
- 810, 800, 799, 797, 811, 798, 805, 803, 812, 798,
- 800, 802, 803, 804, 801, 808, 814, 804, 816, 806,
- 818, 820, 810, 819, 808, 822, 805, 810, 824, 823,
- 811, 811, 821, 820, 821, 825, 0, 827, 822, 812,
- 824, 829, 808, 814, 818, 816, 826, 818, 820, 819,
- 819, 823, 822, 826, 830, 824, 823, 829, 831, 821,
- 828, 832, 825, 827, 827, 828, 831, 834, 829, 835,
- 842, 836, 837, 826, 844, 840, 834, 830, 0, 837,
-
- 846, 830, 835, 832, 838, 831, 839, 828, 832, 849,
- 841, 838, 849, 839, 834, 845, 835, 836, 836, 837,
- 840, 842, 840, 843, 847, 844, 850, 846, 845, 851,
- 843, 838, 841, 839, 852, 854, 849, 841, 855, 0,
- 853, 852, 845, 853, 851, 847, 857, 858, 860, 858,
- 843, 847, 850, 850, 856, 853, 851, 0, 861, 859,
- 855, 852, 862, 868, 853, 855, 854, 853, 857, 863,
- 853, 862, 856, 857, 858, 865, 867, 863, 869, 860,
- 864, 856, 853, 859, 861, 861, 859, 864, 866, 862,
- 868, 887, 866, 874, 871, 870, 863, 865, 867, 872,
-
- 869, 871, 865, 867, 870, 869, 872, 864, 874, 876,
- 873, 875, 877, 0, 882, 866, 881, 878, 887, 877,
- 874, 871, 870, 873, 878, 875, 872, 879, 881, 883,
- 889, 884, 883, 879, 882, 890, 888, 873, 875, 877,
- 876, 882, 884, 881, 878, 892, 890, 883, 891, 894,
- 895, 896, 889, 892, 879, 898, 883, 889, 884, 883,
- 888, 893, 890, 888, 893, 899, 891, 894, 903, 898,
- 897, 900, 892, 907, 899, 891, 894, 897, 896, 893,
- 902, 895, 898, 901, 900, 901, 0, 905, 893, 902,
- 904, 893, 899, 908, 903, 903, 905, 897, 900, 909,
-
- 910, 904, 908, 912, 907, 911, 0, 902, 913, 914,
- 901, 918, 911, 921, 905, 914, 920, 904, 917, 919,
- 908, 910, 913, 0, 920, 918, 926, 910, 919, 922,
- 909, 933, 911, 914, 912, 913, 914, 917, 918, 923,
- 922, 927, 914, 920, 921, 917, 919, 925, 923, 926,
- 928, 929, 930, 926, 925, 931, 922, 932, 933, 931,
- 937, 935, 934, 927, 0, 936, 923, 941, 927, 932,
- 930, 938, 928, 929, 925, 934, 935, 928, 929, 930,
- 936, 939, 931, 940, 932, 942, 938, 943, 935, 934,
- 939, 937, 936, 945, 941, 946, 948, 0, 938, 949,
-
- 947, 950, 952, 0, 940, 956, 954, 951, 939, 942,
- 940, 945, 942, 954, 943, 947, 950, 949, 948, 951,
- 945, 961, 946, 948, 952, 953, 949, 947, 950, 952,
- 955, 957, 956, 954, 951, 0, 959, 963, 953, 958,
- 960, 964, 955, 953, 959, 958, 962, 960, 961, 965,
- 966, 968, 953, 962, 970, 0, 971, 955, 971, 972,
- 969, 974, 957, 959, 963, 953, 958, 960, 964, 969,
- 973, 976, 977, 962, 966, 979, 0, 966, 976, 977,
- 965, 979, 968, 971, 978, 970, 972, 969, 975, 975,
- 975, 978, 974, 980, 986, 975, 973, 973, 976, 977,
-
- 981, 981, 979, 975, 982, 983, 985, 987, 988, 0,
- 996, 978, 983, 990, 990, 975, 975, 975, 989, 987,
- 980, 986, 975, 991, 985, 992, 992, 981, 988, 995,
- 982, 982, 983, 985, 987, 988, 989, 993, 998, 997,
- 990, 996, 999, 1001, 0, 989, 997, 1002, 993, 991,
- 991, 995, 992, 1000, 1002, 1003, 995, 1006, 998, 1005,
- 1004, 1001, 1008, 1007, 993, 998, 997, 1003, 1004, 999,
- 1001, 1005, 1009, 1010, 1002, 1000, 1013, 1009, 1006, 1011,
- 1000, 1007, 1003, 1012, 1006, 1011, 1005, 1004, 1009, 1008,
- 1007, 1014, 1016, 1015, 1017, 1017, 1012, 1015, 1018, 1009,
-
- 1010, 1019, 1020, 1021, 1009, 0, 1011, 1013, 1030, 1023,
- 1012, 1023, 1022, 1018, 1024, 1025, 1026, 1020, 1014, 1027,
- 1025, 1017, 1031, 1016, 1015, 1018, 1021, 1022, 1029, 1020,
- 1021, 1033, 1019, 1032, 1027, 1030, 1023, 1042, 1034, 1022,
- 1037, 1039, 1025, 1035, 1043, 1024, 1027, 1026, 1041, 1031,
- 1047, 1043, 1029, 1033, 1032, 1029, 1039, 1049, 1033, 1034,
- 1032, 1035, 1037, 1041, 1042, 1034, 1044, 1037, 1039, 1045,
- 1035, 1043, 1046, 1047, 1050, 1041, 1048, 1047, 1045, 1052,
- 1046, 1057, 1053, 1061, 1044, 1062, 1054, 1050, 1049, 1055,
- 1052, 1053, 1063, 1044, 1065, 1062, 1045, 1060, 1048, 1046,
-
- 1064, 1050, 1067, 1048, 1054, 1052, 1052, 1055, 1057, 1053,
- 1060, 1069, 1062, 1054, 1061, 1070, 1055, 1052, 1063, 1063,
- 1071, 1065, 1067, 1068, 1060, 1064, 1071, 1064, 1072, 1067,
- 1068, 1073, 1075, 1070, 1074, 1078, 1080, 1069, 1069, 1079,
- 1083, 1076, 1070, 1072, 1075, 1080, 1073, 1071, 1076, 1074,
- 1068, 1081, 1084, 1083, 1086, 1072, 1090, 1078, 1073, 1075,
- 1087, 1074, 1078, 1080, 1079, 1090, 1079, 1083, 1076, 1081,
- 1085, 1085, 1088, 1089, 1092, 1091, 1086, 1096, 1081, 1084,
- 1095, 1086, 1091, 1090, 1093, 1087, 1097, 1087, 1095, 0,
- 1096, 1101, 1100, 1098, 1088, 1089, 1108, 1085, 1099, 1088,
-
- 1089, 1099, 1091, 1108, 1096, 1092, 1093, 1095, 1098, 1101,
- 1104, 1093, 1102, 1097, 1105, 1107, 1099, 1100, 1101, 1100,
- 1098, 0, 1109, 1108, 1111, 1099, 1113, 1102, 1099, 1107,
- 1116, 1114, 1104, 1109, 1117, 0, 1105, 1104, 1115, 1102,
- 1115, 1105, 1107, 1114, 1118, 1111, 1119, 1113, 1116, 1109,
- 0, 1111, 1120, 1113, 1121, 1123, 1122, 1116, 1114, 1124,
- 1120, 1117, 1118, 1129, 1134, 1115, 1125, 0, 1130, 1123,
- 1128, 1118, 1131, 1119, 1133, 1132, 1138, 1121, 1122, 1120,
- 1138, 1121, 1123, 1122, 1132, 1125, 1124, 1131, 1128, 1137,
- 1129, 1134, 1139, 1125, 1130, 1130, 1133, 1128, 1136, 1131,
-
- 1136, 1133, 1132, 1138, 1139, 1140, 1141, 1142, 1143, 0,
- 1145, 1137, 0, 1144, 1156, 1141, 1137, 1146, 1142, 1139,
- 1147, 1147, 1145, 1148, 0, 1136, 1150, 1140, 1153, 1150,
- 1151, 1148, 1140, 1141, 1142, 1143, 1144, 1145, 1151, 1146,
- 1144, 1156, 1152, 1153, 1146, 1154, 1157, 1147, 1152, 1158,
- 1148, 1154, 1159, 1150, 1160, 1153, 1161, 1151, 1162, 1163,
- 1164, 1165, 1166, 1158, 1168, 1159, 1169, 1167, 1160, 1152,
- 1157, 1173, 1154, 1157, 1164, 1167, 1158, 1172, 1175, 1159,
- 1177, 1160, 1161, 1161, 1170, 1162, 1163, 1164, 1165, 1166,
- 1178, 1168, 1170, 1169, 1167, 1174, 1180, 1176, 1173, 1172,
-
- 1179, 1177, 1181, 1174, 1172, 1175, 1176, 1177, 1182, 1184,
- 1181, 1170, 1185, 1185, 1178, 1179, 1187, 1178, 1186, 1189,
- 0, 0, 1174, 1180, 1176, 1188, 1179, 1179, 1190, 1181,
- 1190, 1192, 1193, 1191, 1187, 1182, 1184, 1192, 1194, 1185,
- 1188, 1189, 1179, 1187, 1186, 1186, 1189, 1191, 1195, 1196,
- 1194, 1197, 1188, 1198, 1193, 1190, 1199, 0, 1192, 1193,
- 1191, 1201, 1203, 1205, 1197, 1194, 1195, 1196, 1201, 1204,
- 1208, 1209, 0, 1206, 0, 1195, 1196, 1211, 1197, 1199,
- 1203, 1206, 1208, 1199, 1198, 1212, 1209, 1214, 1201, 1203,
- 1216, 0, 1217, 1224, 1205, 1204, 1204, 1208, 1209, 1206,
-
- 1206, 1211, 1213, 1219, 1211, 1217, 1218, 1212, 1206, 1213,
- 1220, 1225, 1212, 1221, 1214, 1222, 1224, 1216, 1219, 1217,
- 1224, 1221, 1226, 1220, 1227, 1229, 1232, 1228, 1231, 1213,
- 1219, 1236, 1218, 1218, 1228, 1225, 1230, 1220, 1225, 1233,
- 1221, 1222, 1222, 1230, 1237, 1235, 1227, 1242, 1229, 1226,
- 1231, 1227, 1229, 1236, 1228, 1231, 1235, 1232, 1236, 1238,
- 1233, 1245, 1239, 1230, 1249, 1251, 1233, 1253, 1248, 0,
- 1254, 0, 1235, 1242, 1242, 1237, 1256, 1257, 1238, 1259,
- 1262, 1256, 1255, 1263, 1266, 1267, 1238, 1239, 1245, 1239,
- 1248, 1249, 1251, 1255, 1265, 1248, 1254, 1254, 1253, 1257,
-
- 1264, 1268, 1262, 1256, 1257, 1269, 1259, 1262, 1263, 1255,
- 1263, 1266, 1267, 1264, 1270, 1271, 1265, 1274, 1272, 1273,
- 1269, 1265, 1275, 1270, 1276, 1277, 1280, 1264, 1268, 1275,
- 1271, 1279, 1269, 1272, 1273, 1278, 1278, 1284, 1279, 1274,
- 1280, 1270, 1271, 1277, 1274, 1272, 1273, 1281, 1282, 1275,
- 1281, 1276, 1277, 1280, 1283, 1285, 1286, 1287, 1279, 1284,
- 1290, 1282, 1278, 1283, 1284, 1292, 1293, 1290, 1294, 1291,
- 1292, 1296, 1295, 1293, 1281, 1282, 1297, 1285, 1291, 1295,
- 1296, 1283, 1285, 1286, 1287, 1299, 1294, 1290, 1300, 1301,
- 0, 1302, 1292, 1293, 1304, 1294, 1291, 1306, 1296, 1295,
-
- 1302, 1301, 1297, 1297, 1303, 1304, 1300, 1307, 1309, 1305,
- 1308, 0, 1299, 1303, 1310, 1300, 1301, 1305, 1302, 1308,
- 1309, 1304, 1310, 1311, 1306, 1313, 0, 1316, 1318, 1317,
- 1311, 1303, 1319, 1313, 1316, 1309, 1305, 1308, 1307, 1320,
- 1322, 1310, 1324, 1323, 1319, 1325, 0, 1329, 1320, 0,
- 1311, 1323, 1313, 1317, 1316, 1318, 1317, 1330, 1331, 1319,
- 1332, 1333, 1330, 1334, 1338, 1337, 1320, 1322, 1340, 1324,
- 1323, 1334, 1325, 1329, 1329, 1335, 1331, 1337, 1339, 1341,
- 1340, 1342, 1332, 1333, 1330, 1331, 1338, 1332, 1333, 1343,
- 1334, 1338, 1337, 0, 1335, 1340, 1344, 1345, 1348, 1349,
-
- 1339, 1351, 1335, 1350, 1352, 1339, 1341, 0, 1342, 0,
- 1357, 1354, 1355, 1353, 0, 0, 1352, 1361, 1359, 1351,
- 1343, 1358, 1349, 1344, 1345, 1350, 1349, 1355, 1351, 1348,
- 1350, 1352, 1353, 1354, 1357, 1358, 1359, 1357, 1354, 1355,
- 1353, 1360, 1362, 1361, 1361, 1359, 1364, 1366, 1358, 1365,
- 1367, 1369, 1368, 1370, 1364, 1366, 1365, 1373, 1376, 1360,
- 1362, 1371, 0, 1380, 1379, 1382, 1383, 1374, 1360, 1362,
- 1368, 1379, 1370, 1364, 1366, 1373, 1365, 1367, 1369, 1368,
- 1370, 1374, 1381, 1371, 1373, 1376, 1384, 1385, 1371, 1380,
- 1380, 1379, 1382, 1383, 1374, 1386, 1385, 1387, 1388, 1392,
-
- 1389, 0, 1395, 1395, 1398, 0, 1381, 1397, 1386, 1381,
- 1396, 1398, 1395, 1384, 1385, 1400, 1397, 1402, 1406, 0,
- 1392, 0, 1386, 1389, 1404, 1388, 1392, 1389, 1387, 1395,
- 1395, 1398, 1396, 1399, 1397, 1401, 1402, 1396, 1405, 1403,
- 1406, 1407, 1400, 1401, 1402, 1406, 1399, 1403, 1407, 1405,
- 1404, 1404, 1408, 1408, 1409, 0, 1410, 1411, 1413, 1416,
- 1399, 1415, 1401, 1410, 1411, 1405, 1403, 1417, 1407, 1418,
- 1415, 1420, 1409, 1422, 1428, 1422, 1421, 1426, 1435, 1408,
- 1427, 1409, 1413, 1410, 1411, 1413, 1416, 1418, 1415, 1420,
- 1417, 1421, 1428, 1430, 1417, 1431, 1418, 1433, 1420, 1426,
-
- 1422, 1428, 1432, 1421, 1426, 1434, 1427, 1427, 1432, 1435,
- 1436, 1437, 1436, 1431, 1434, 1430, 1440, 1439, 1441, 1433,
- 1430, 1442, 1431, 1443, 1433, 1439, 0, 1444, 1440, 1432,
- 1445, 1446, 1434, 1448, 1443, 1444, 1450, 1436, 1437, 1442,
- 1447, 1447, 1451, 1440, 1439, 1441, 1453, 1449, 1442, 1445,
- 1443, 1455, 1454, 1446, 1444, 1449, 1455, 1445, 1446, 1454,
- 1448, 1456, 1457, 1450, 1451, 1459, 1461, 1447, 1458, 1451,
- 1460, 1462, 1463, 1453, 1449, 1464, 1458, 1460, 1455, 1454,
- 1459, 1465, 1467, 1464, 1469, 0, 1462, 0, 1456, 1457,
- 1466, 1466, 1459, 1461, 1463, 1458, 1470, 1460, 1462, 1463,
-
- 1466, 1472, 1464, 1473, 1470, 1474, 1475, 1476, 0, 1467,
- 1479, 1469, 1465, 1477, 1472, 1481, 1483, 1466, 1466, 1487,
- 1488, 0, 1484, 1470, 0, 1473, 1489, 1492, 1472, 1491,
- 1473, 0, 1474, 1475, 1476, 1477, 1492, 1479, 1487, 1493,
- 1477, 1481, 1481, 1483, 1484, 1500, 1487, 1488, 1489, 1484,
- 1493, 1491, 1496, 1489, 1492, 1495, 1491, 1494, 1494, 1505,
- 1501, 1495, 1499, 1509, 1510, 1507, 1493, 1494, 1512, 1499,
- 1513, 1514, 1500, 1514, 1496, 0, 1510, 1512, 1520, 1496,
- 1517, 1515, 1495, 1501, 1494, 1494, 1505, 1501, 1507, 1499,
- 1509, 1510, 1507, 1515, 1516, 1512, 1518, 1513, 1514, 1522,
-
- 1516, 1519, 1517, 1524, 1526, 1520, 1527, 1517, 1515, 1519,
- 1529, 1530, 1531, 1533, 0, 0, 1534, 1532, 1518, 1526,
- 0, 1516, 1533, 1518, 1530, 1532, 1522, 1534, 1519, 1538,
- 1524, 1526, 1527, 1527, 1531, 1539, 1540, 1541, 1530, 1531,
- 1533, 1529, 1539, 1534, 1532, 1541, 1542, 1543, 1545, 1544,
- 1540, 1544, 1538, 1546, 1547, 1542, 1538, 1548, 1543, 1551,
- 1545, 1549, 1539, 1540, 1541, 1550, 1552, 1550, 1557, 1553,
- 1558, 1551, 1547, 1542, 1543, 1545, 1544, 1555, 1559, 1548,
- 1546, 1547, 1553, 1549, 1548, 1556, 1551, 1561, 1549, 1555,
- 1562, 1559, 1550, 1556, 1560, 1561, 1553, 1552, 1563, 1557,
-
- 1567, 1558, 1564, 1562, 1555, 1559, 1563, 1566, 1560, 1565,
- 1568, 1569, 1556, 1570, 1561, 1566, 1564, 1562, 1575, 1569,
- 1571, 1560, 1567, 1565, 1572, 1563, 1573, 1567, 1576, 1564,
- 1577, 0, 1568, 1574, 1566, 1578, 1565, 1568, 1569, 1570,
- 1570, 1574, 1571, 1578, 1579, 1580, 1572, 1571, 1573, 1575,
- 1577, 1572, 1579, 1573, 1582, 1576, 1581, 1577, 1584, 1585,
- 1574, 1586, 1578, 1587, 1581, 1588, 1590, 1585, 1582, 1586,
- 1591, 1579, 1589, 1593, 1590, 1592, 1580, 1587, 1594, 1595,
- 1584, 1582, 1596, 1581, 1597, 1584, 1585, 1595, 1586, 0,
- 1587, 1588, 1588, 1590, 1589, 1593, 1591, 1591, 1594, 1589,
-
- 1593, 1592, 1592, 1598, 1597, 1594, 1595, 1599, 1601, 1596,
- 1600, 1597, 0, 1605, 1603, 1599, 1601, 1604, 1606, 0,
- 1607, 1605, 1610, 1598, 1611, 1608, 1606, 1613, 1614, 0,
- 1598, 0, 1600, 1608, 1599, 1601, 1603, 1600, 1612, 1604,
- 1605, 1603, 1609, 1615, 1604, 1606, 1607, 1607, 1610, 1610,
- 1609, 1611, 1608, 1617, 1613, 1614, 1620, 1623, 1612, 1621,
- 1622, 1624, 0, 1615, 0, 1612, 0, 1621, 1622, 1609,
- 1615, 0, 0, 0, 0, 1617, 0, 0, 1620, 0,
- 1617, 0, 0, 1620, 1623, 0, 1621, 1622, 1624, 1628,
- 1628, 1628, 1628, 1628, 1628, 1628, 1629, 1629, 1629, 1629,
-
- 1629, 1629, 1629, 1630, 1630, 1630, 1630, 1630, 1630, 1630,
- 1631, 1631, 1631, 1631, 1631, 1631, 1631, 1632, 1632, 1632,
- 1632, 1632, 1632, 1632, 1634, 1634, 0, 1634, 1634, 1634,
- 1634, 1635, 1635, 0, 0, 0, 1635, 1635, 1636, 1636,
- 0, 0, 1636, 0, 1636, 1637, 0, 0, 0, 0,
- 0, 1637, 1638, 1638, 0, 0, 0, 1638, 1638, 1639,
- 0, 0, 0, 0, 0, 1639, 1640, 1640, 0, 1640,
- 1640, 1640, 1640, 1641, 1641, 0, 1641, 1641, 1641, 1641,
- 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627,
- 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627,
-
- 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627,
- 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627,
- 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627,
- 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627,
- 1627, 1627, 1627, 1627, 1627, 1627
+ 26, 30, 75, 31, 26, 126, 37, 26, 22, 30,
+ 30, 37, 209, 22, 26, 32, 26, 22, 30, 31,
+ 22, 124, 22, 22, 30, 31, 31, 33, 30, 55,
+ 31, 55, 55, 33, 55, 34, 33, 67, 36, 34,
+ 36, 209, 61, 33, 56, 33, 31, 93, 66, 34,
+ 66, 66, 34, 66, 33, 36, 51, 114, 35, 139,
+ 33, 34, 34, 33, 36, 36, 34, 36, 35, 74,
+ 33, 38, 35, 35, 65, 38, 34, 50, 93, 34,
+ 35, 63, 36, 63, 63, 35, 63, 65, 114, 129,
+
+ 139, 129, 129, 74, 129, 35, 74, 38, 38, 35,
+ 35, 65, 38, 68, 76, 68, 68, 71, 68, 71,
+ 71, 76, 71, 68, 77, 78, 79, 71, 63, 80,
+ 82, 81, 84, 45, 78, 82, 40, 77, 83, 79,
+ 81, 76, 85, 86, 80, 90, 83, 14, 77, 84,
+ 86, 77, 78, 79, 71, 85, 80, 82, 81, 87,
+ 89, 91, 88, 84, 77, 83, 98, 90, 87, 85,
+ 86, 88, 90, 94, 91, 92, 84, 13, 92, 98,
+ 99, 94, 97, 89, 95, 97, 87, 89, 91, 88,
+ 96, 0, 92, 98, 96, 100, 101, 105, 102, 92,
+
+ 94, 104, 92, 99, 95, 92, 95, 99, 104, 97,
+ 101, 95, 103, 0, 96, 100, 0, 96, 102, 92,
+ 105, 96, 100, 101, 105, 102, 103, 106, 104, 107,
+ 108, 95, 110, 107, 109, 111, 106, 108, 115, 103,
+ 112, 109, 147, 113, 119, 0, 110, 111, 112, 116,
+ 119, 107, 113, 115, 106, 117, 107, 108, 120, 110,
+ 107, 109, 111, 118, 117, 115, 121, 112, 123, 116,
+ 113, 119, 122, 147, 118, 116, 116, 123, 137, 120,
+ 0, 0, 117, 120, 0, 120, 138, 122, 121, 134,
+ 118, 134, 134, 121, 134, 123, 116, 140, 135, 122,
+
+ 135, 135, 137, 135, 141, 137, 120, 142, 138, 140,
+ 143, 144, 145, 138, 146, 142, 0, 145, 144, 148,
+ 0, 151, 143, 141, 140, 150, 153, 152, 0, 151,
+ 153, 141, 154, 156, 142, 135, 146, 143, 144, 155,
+ 148, 146, 160, 145, 145, 157, 156, 148, 151, 152,
+ 0, 150, 150, 153, 152, 154, 161, 157, 0, 154,
+ 156, 155, 158, 164, 160, 158, 155, 148, 149, 160,
+ 159, 0, 157, 149, 162, 161, 163, 158, 149, 159,
+ 165, 162, 161, 161, 149, 149, 166, 163, 167, 158,
+ 170, 149, 158, 169, 164, 149, 166, 159, 168, 169,
+
+ 149, 162, 161, 163, 171, 149, 165, 165, 172, 173,
+ 174, 149, 149, 0, 175, 176, 168, 166, 0, 167,
+ 169, 170, 176, 166, 177, 168, 171, 178, 179, 0,
+ 174, 171, 178, 186, 180, 175, 181, 174, 183, 172,
+ 173, 175, 176, 182, 184, 177, 187, 179, 181, 184,
+ 182, 177, 188, 187, 178, 179, 180, 185, 185, 190,
+ 183, 180, 189, 181, 186, 183, 185, 191, 192, 194,
+ 182, 184, 193, 187, 195, 191, 196, 188, 200, 188,
+ 198, 197, 189, 192, 185, 185, 202, 199, 198, 189,
+ 190, 194, 0, 196, 191, 192, 197, 201, 193, 193,
+
+ 194, 196, 204, 196, 203, 195, 199, 198, 197, 200,
+ 206, 204, 206, 205, 199, 207, 203, 202, 194, 201,
+ 196, 208, 0, 210, 201, 211, 0, 212, 216, 204,
+ 215, 203, 205, 213, 214, 217, 219, 206, 212, 207,
+ 205, 221, 207, 218, 0, 213, 216, 208, 208, 210,
+ 210, 211, 211, 215, 212, 216, 218, 215, 214, 220,
+ 213, 214, 219, 219, 222, 223, 217, 224, 225, 227,
+ 218, 222, 221, 224, 223, 226, 228, 231, 227, 229,
+ 232, 220, 225, 230, 0, 233, 220, 234, 229, 240,
+ 234, 222, 223, 235, 224, 225, 227, 234, 230, 228,
+
+ 233, 226, 226, 228, 232, 237, 229, 232, 231, 236,
+ 230, 235, 233, 238, 234, 236, 240, 234, 241, 237,
+ 235, 239, 239, 242, 245, 243, 242, 248, 238, 244,
+ 0, 0, 237, 242, 247, 246, 236, 243, 251, 248,
+ 238, 253, 241, 249, 0, 241, 239, 244, 239, 239,
+ 242, 245, 243, 242, 248, 0, 244, 246, 249, 250,
+ 247, 247, 246, 253, 252, 254, 250, 254, 253, 251,
+ 249, 252, 255, 256, 259, 257, 256, 258, 256, 0,
+ 261, 0, 260, 262, 256, 255, 250, 261, 260, 254,
+ 264, 252, 254, 257, 254, 262, 259, 268, 263, 255,
+
+ 256, 259, 257, 256, 267, 256, 264, 261, 258, 260,
+ 262, 263, 269, 265, 264, 268, 267, 264, 269, 270,
+ 271, 272, 0, 276, 268, 263, 265, 270, 272, 273,
+ 274, 267, 271, 264, 274, 276, 275, 277, 279, 269,
+ 265, 266, 266, 275, 278, 279, 270, 271, 272, 277,
+ 276, 266, 281, 266, 266, 266, 0, 274, 266, 280,
+ 273, 0, 282, 275, 277, 279, 266, 285, 266, 266,
+ 283, 289, 280, 282, 285, 278, 284, 284, 266, 286,
+ 266, 266, 266, 281, 287, 266, 280, 288, 292, 282,
+ 286, 293, 283, 290, 285, 287, 289, 283, 289, 291,
+
+ 288, 292, 295, 294, 293, 284, 286, 297, 291, 293,
+ 296, 287, 298, 300, 288, 292, 290, 299, 293, 301,
+ 290, 294, 305, 0, 295, 297, 291, 302, 303, 295,
+ 294, 293, 304, 296, 297, 306, 300, 296, 299, 307,
+ 300, 306, 303, 298, 299, 301, 301, 309, 308, 302,
+ 310, 311, 0, 305, 302, 303, 313, 307, 304, 304,
+ 315, 312, 306, 308, 0, 316, 307, 312, 323, 319,
+ 309, 316, 317, 311, 309, 308, 310, 310, 311, 318,
+ 324, 323, 313, 313, 319, 326, 315, 315, 312, 325,
+ 331, 317, 316, 321, 322, 323, 319, 318, 324, 317,
+
+ 321, 322, 327, 329, 326, 328, 318, 324, 329, 330,
+ 332, 325, 326, 331, 328, 330, 325, 331, 333, 335,
+ 321, 322, 332, 334, 0, 0, 342, 335, 337, 0,
+ 329, 0, 328, 327, 334, 337, 330, 332, 338, 339,
+ 333, 0, 0, 0, 340, 333, 335, 341, 339, 338,
+ 334, 336, 342, 342, 341, 337, 336, 343, 336, 343,
+ 344, 345, 349, 0, 346, 338, 336, 349, 340, 347,
+ 339, 340, 348, 345, 341, 339, 336, 336, 336, 346,
+ 348, 347, 350, 336, 343, 336, 344, 344, 345, 349,
+ 351, 346, 352, 336, 353, 354, 347, 355, 356, 348,
+
+ 352, 0, 357, 336, 350, 360, 353, 359, 351, 350,
+ 358, 357, 361, 356, 363, 362, 365, 351, 354, 352,
+ 371, 353, 354, 364, 358, 356, 359, 361, 355, 357,
+ 362, 369, 360, 366, 359, 364, 366, 358, 363, 361,
+ 365, 363, 362, 365, 366, 367, 370, 368, 372, 367,
+ 364, 371, 373, 374, 378, 376, 375, 0, 369, 380,
+ 366, 368, 375, 366, 377, 379, 382, 383, 0, 389,
+ 0, 381, 0, 370, 368, 372, 367, 376, 381, 373,
+ 384, 380, 376, 375, 374, 378, 380, 377, 379, 383,
+ 385, 377, 379, 384, 383, 385, 387, 382, 381, 385,
+
+ 389, 386, 388, 390, 0, 387, 0, 384, 391, 393,
+ 394, 392, 398, 0, 385, 388, 0, 385, 395, 0,
+ 400, 390, 385, 387, 394, 399, 385, 386, 386, 388,
+ 390, 393, 391, 392, 392, 391, 393, 394, 392, 396,
+ 395, 397, 402, 398, 400, 395, 399, 400, 401, 403,
+ 396, 405, 399, 406, 404, 408, 397, 407, 403, 408,
+ 392, 410, 0, 0, 402, 0, 396, 404, 397, 402,
+ 411, 409, 401, 405, 414, 401, 403, 406, 405, 407,
+ 406, 404, 415, 416, 407, 409, 408, 412, 411, 413,
+ 415, 417, 410, 413, 418, 422, 419, 411, 409, 414,
+
+ 417, 414, 412, 418, 419, 420, 426, 421, 416, 415,
+ 416, 412, 420, 422, 412, 423, 424, 429, 417, 425,
+ 413, 418, 422, 419, 428, 424, 431, 423, 427, 412,
+ 421, 425, 420, 430, 421, 436, 427, 426, 435, 433,
+ 429, 432, 423, 424, 429, 434, 425, 433, 431, 430,
+ 428, 428, 432, 431, 437, 427, 438, 436, 435, 434,
+ 430, 440, 436, 439, 441, 435, 433, 443, 432, 442,
+ 440, 444, 434, 445, 437, 451, 446, 449, 438, 0,
+ 443, 437, 0, 438, 441, 439, 447, 442, 440, 452,
+ 439, 441, 447, 444, 443, 449, 442, 445, 444, 446,
+
+ 445, 448, 453, 446, 449, 454, 451, 455, 468, 448,
+ 456, 460, 452, 447, 454, 463, 452, 453, 457, 456,
+ 457, 466, 467, 460, 469, 463, 455, 448, 448, 453,
+ 471, 468, 454, 0, 455, 468, 448, 456, 460, 466,
+ 474, 491, 463, 467, 475, 457, 458, 472, 466, 467,
+ 458, 492, 471, 458, 478, 469, 472, 471, 476, 473,
+ 458, 473, 477, 458, 474, 0, 478, 474, 458, 479,
+ 0, 475, 491, 458, 472, 0, 480, 458, 476, 481,
+ 458, 478, 492, 0, 0, 476, 473, 458, 477, 477,
+ 458, 470, 470, 489, 470, 479, 479, 470, 483, 482,
+
+ 480, 481, 470, 480, 484, 483, 481, 482, 470, 470,
+ 487, 485, 484, 486, 488, 489, 490, 470, 470, 470,
+ 489, 470, 487, 488, 470, 483, 482, 493, 494, 470,
+ 485, 484, 500, 495, 496, 470, 470, 487, 485, 486,
+ 486, 488, 498, 490, 501, 499, 502, 497, 0, 494,
+ 0, 493, 495, 496, 493, 494, 497, 505, 503, 500,
+ 495, 496, 506, 501, 498, 499, 503, 507, 0, 498,
+ 508, 501, 499, 512, 497, 505, 509, 502, 0, 512,
+ 507, 514, 510, 513, 505, 503, 506, 514, 509, 506,
+ 510, 515, 519, 518, 507, 517, 508, 508, 515, 516,
+
+ 512, 523, 517, 509, 516, 513, 510, 520, 514, 510,
+ 513, 518, 522, 521, 523, 519, 520, 510, 515, 519,
+ 518, 521, 517, 524, 525, 526, 516, 527, 523, 528,
+ 522, 525, 529, 0, 520, 530, 535, 0, 526, 522,
+ 521, 531, 532, 530, 524, 534, 536, 533, 537, 538,
+ 524, 525, 526, 533, 539, 529, 531, 537, 527, 529,
+ 528, 541, 530, 538, 532, 542, 543, 535, 531, 532,
+ 536, 534, 534, 536, 533, 537, 538, 540, 543, 544,
+ 546, 545, 547, 546, 540, 539, 551, 548, 541, 545,
+ 0, 553, 542, 543, 548, 547, 0, 550, 551, 552,
+
+ 554, 552, 544, 553, 540, 0, 544, 546, 545, 547,
+ 0, 557, 0, 551, 548, 549, 555, 549, 553, 556,
+ 550, 549, 554, 549, 550, 558, 552, 554, 549, 555,
+ 565, 559, 556, 549, 557, 560, 561, 558, 557, 549,
+ 0, 559, 549, 555, 549, 562, 556, 568, 549, 561,
+ 549, 562, 558, 559, 563, 549, 564, 560, 559, 566,
+ 549, 565, 560, 561, 566, 567, 566, 563, 559, 568,
+ 571, 573, 562, 572, 568, 569, 574, 564, 576, 570,
+ 567, 563, 579, 564, 566, 566, 566, 577, 569, 574,
+ 573, 566, 567, 566, 570, 572, 571, 571, 573, 575,
+
+ 572, 580, 569, 574, 581, 576, 570, 575, 582, 584,
+ 577, 566, 581, 579, 577, 583, 585, 584, 588, 590,
+ 586, 587, 582, 589, 592, 580, 575, 585, 580, 587,
+ 589, 581, 590, 591, 597, 582, 584, 583, 586, 600,
+ 588, 594, 583, 585, 595, 588, 590, 586, 587, 594,
+ 589, 591, 596, 595, 598, 592, 597, 600, 599, 602,
+ 591, 597, 601, 604, 596, 608, 600, 604, 594, 605,
+ 0, 595, 605, 606, 610, 607, 598, 608, 0, 596,
+ 599, 598, 607, 612, 609, 599, 613, 611, 601, 601,
+ 602, 609, 608, 611, 604, 605, 605, 606, 610, 605,
+
+ 606, 610, 607, 614, 615, 612, 616, 617, 613, 619,
+ 612, 609, 621, 613, 611, 615, 620, 618, 619, 623,
+ 622, 621, 0, 624, 614, 628, 623, 616, 622, 625,
+ 614, 615, 626, 616, 617, 618, 619, 624, 630, 621,
+ 620, 631, 629, 620, 618, 632, 623, 622, 627, 628,
+ 624, 625, 628, 630, 626, 633, 625, 627, 629, 626,
+ 634, 636, 635, 637, 639, 630, 640, 633, 646, 629,
+ 635, 641, 631, 639, 636, 627, 632, 0, 637, 641,
+ 646, 642, 633, 642, 640, 647, 645, 634, 636, 635,
+ 637, 639, 647, 640, 648, 646, 649, 650, 641, 645,
+
+ 0, 651, 652, 653, 654, 655, 656, 659, 642, 657,
+ 658, 660, 647, 645, 656, 652, 653, 655, 658, 650,
+ 660, 657, 661, 651, 650, 648, 654, 649, 651, 652,
+ 653, 654, 655, 656, 659, 662, 657, 658, 660, 663,
+ 665, 664, 662, 661, 666, 667, 668, 0, 0, 661,
+ 671, 673, 669, 670, 672, 668, 675, 666, 671, 673,
+ 665, 674, 662, 664, 0, 663, 663, 665, 664, 667,
+ 669, 666, 667, 668, 675, 670, 672, 671, 673, 669,
+ 670, 672, 676, 675, 674, 677, 678, 679, 674, 681,
+ 680, 682, 684, 688, 676, 681, 685, 677, 680, 683,
+
+ 682, 0, 679, 685, 684, 692, 678, 686, 689, 676,
+ 690, 0, 677, 678, 679, 691, 681, 680, 682, 684,
+ 683, 689, 691, 685, 688, 686, 683, 692, 695, 690,
+ 694, 696, 692, 697, 686, 689, 693, 690, 694, 698,
+ 693, 700, 691, 0, 701, 696, 699, 0, 702, 705,
+ 707, 697, 706, 708, 695, 695, 704, 694, 696, 703,
+ 697, 706, 705, 700, 0, 709, 701, 693, 700, 712,
+ 698, 701, 699, 699, 702, 702, 705, 703, 704, 706,
+ 710, 707, 714, 704, 708, 712, 703, 709, 711, 715,
+ 716, 718, 709, 711, 717, 711, 712, 711, 717, 716,
+
+ 719, 715, 720, 710, 718, 714, 711, 710, 719, 714,
+ 721, 723, 724, 723, 725, 711, 715, 716, 718, 722,
+ 711, 720, 711, 721, 711, 717, 725, 719, 722, 720,
+ 726, 728, 729, 731, 730, 733, 732, 721, 723, 724,
+ 735, 725, 730, 732, 734, 736, 722, 737, 739, 738,
+ 745, 740, 736, 743, 729, 728, 741, 726, 728, 729,
+ 731, 730, 733, 732, 742, 741, 734, 735, 738, 737,
+ 739, 734, 736, 743, 737, 739, 738, 740, 740, 746,
+ 743, 745, 747, 741, 748, 742, 750, 749, 0, 752,
+ 751, 742, 753, 754, 750, 755, 757, 754, 0, 753,
+
+ 0, 760, 759, 757, 747, 749, 751, 758, 0, 747,
+ 746, 759, 756, 750, 749, 748, 752, 751, 756, 753,
+ 754, 764, 758, 757, 761, 756, 755, 760, 760, 759,
+ 762, 761, 762, 763, 758, 769, 765, 766, 774, 756,
+ 765, 772, 763, 764, 771, 756, 768, 770, 764, 773,
+ 768, 761, 0, 769, 772, 0, 775, 762, 0, 766,
+ 763, 774, 769, 765, 766, 774, 770, 776, 772, 771,
+ 779, 771, 775, 778, 770, 776, 780, 768, 777, 777,
+ 773, 781, 778, 775, 782, 780, 783, 786, 781, 785,
+ 784, 0, 779, 788, 776, 783, 0, 779, 784, 786,
+
+ 778, 788, 785, 780, 789, 777, 787, 782, 781, 790,
+ 791, 782, 792, 783, 786, 794, 785, 784, 787, 796,
+ 788, 792, 793, 795, 798, 796, 789, 794, 799, 790,
+ 797, 789, 791, 787, 800, 802, 790, 791, 803, 792,
+ 793, 804, 794, 805, 795, 806, 796, 803, 808, 793,
+ 795, 814, 797, 806, 807, 798, 805, 797, 807, 799,
+ 800, 800, 802, 804, 0, 803, 809, 813, 804, 810,
+ 805, 0, 806, 812, 809, 808, 815, 810, 811, 811,
+ 822, 812, 814, 816, 815, 807, 819, 817, 813, 818,
+ 821, 816, 820, 809, 813, 817, 810, 818, 820, 819,
+
+ 812, 823, 821, 815, 824, 811, 822, 822, 825, 830,
+ 816, 826, 831, 819, 817, 834, 818, 821, 0, 820,
+ 827, 832, 825, 823, 827, 829, 833, 824, 823, 826,
+ 839, 824, 829, 833, 831, 825, 830, 827, 826, 831,
+ 836, 838, 840, 842, 832, 827, 834, 827, 832, 836,
+ 844, 827, 829, 833, 846, 853, 839, 839, 847, 848,
+ 849, 850, 849, 838, 827, 0, 0, 836, 838, 851,
+ 842, 848, 854, 840, 850, 855, 860, 844, 846, 854,
+ 852, 846, 853, 872, 847, 847, 848, 849, 850, 856,
+ 857, 851, 852, 864, 856, 858, 851, 859, 860, 854,
+
+ 862, 855, 855, 860, 865, 859, 857, 852, 863, 862,
+ 868, 874, 871, 870, 872, 0, 856, 857, 858, 864,
+ 864, 863, 858, 866, 859, 867, 865, 862, 868, 869,
+ 866, 865, 867, 875, 871, 863, 869, 868, 870, 871,
+ 870, 873, 874, 876, 877, 885, 875, 880, 873, 881,
+ 866, 879, 867, 884, 879, 882, 869, 0, 887, 886,
+ 875, 888, 882, 888, 881, 877, 883, 885, 873, 883,
+ 876, 877, 885, 880, 880, 889, 881, 886, 879, 890,
+ 887, 883, 882, 0, 884, 887, 886, 891, 888, 892,
+ 883, 899, 893, 883, 894, 895, 883, 896, 892, 889,
+
+ 893, 894, 889, 897, 898, 900, 901, 897, 883, 907,
+ 890, 904, 0, 891, 891, 901, 892, 895, 899, 893,
+ 905, 894, 895, 906, 904, 0, 898, 900, 896, 902,
+ 897, 898, 900, 901, 903, 905, 902, 906, 904, 908,
+ 907, 903, 909, 912, 914, 910, 908, 905, 913, 909,
+ 906, 910, 916, 919, 920, 915, 902, 927, 915, 923,
+ 913, 903, 921, 916, 914, 912, 908, 928, 0, 909,
+ 912, 914, 910, 915, 926, 913, 922, 923, 920, 916,
+ 919, 920, 915, 924, 921, 915, 923, 922, 927, 921,
+ 925, 924, 926, 925, 928, 929, 931, 930, 933, 932,
+
+ 933, 926, 929, 922, 934, 931, 935, 936, 925, 942,
+ 924, 930, 932, 934, 937, 0, 938, 925, 936, 940,
+ 925, 944, 929, 931, 930, 933, 932, 947, 940, 945,
+ 938, 934, 935, 935, 936, 939, 937, 946, 939, 943,
+ 942, 937, 938, 938, 946, 948, 940, 953, 943, 949,
+ 945, 952, 944, 939, 954, 949, 945, 938, 947, 948,
+ 955, 953, 939, 954, 946, 939, 943, 956, 955, 957,
+ 952, 0, 948, 949, 953, 958, 949, 961, 952, 960,
+ 957, 954, 949, 962, 958, 963, 960, 955, 966, 964,
+ 965, 967, 966, 968, 971, 0, 957, 0, 956, 970,
+
+ 961, 969, 958, 967, 961, 962, 960, 963, 965, 971,
+ 962, 964, 963, 974, 969, 966, 964, 965, 967, 970,
+ 968, 971, 972, 973, 975, 976, 970, 977, 969, 978,
+ 0, 973, 980, 979, 976, 982, 983, 972, 0, 975,
+ 984, 0, 985, 986, 974, 994, 0, 993, 977, 972,
+ 973, 975, 976, 982, 977, 984, 978, 979, 987, 980,
+ 979, 986, 982, 983, 985, 988, 989, 984, 990, 985,
+ 986, 991, 992, 987, 993, 997, 994, 988, 991, 996,
+ 998, 990, 997, 995, 992, 987, 990, 996, 989, 995,
+ 999, 1000, 988, 989, 1001, 990, 1002, 999, 991, 992,
+
+ 1003, 1004, 997, 1006, 1008, 1007, 996, 998, 990, 1009,
+ 995, 1009, 1010, 1012, 1007, 1011, 1019, 999, 1000, 1002,
+ 0, 1001, 1014, 1002, 0, 1004, 1015, 1017, 1004, 1014,
+ 1016, 1003, 1007, 1015, 1006, 1008, 1009, 1016, 1021, 1010,
+ 1017, 1011, 1011, 1019, 1012, 1013, 1013, 1013, 1022, 1014,
+ 1018, 1024, 1013, 1015, 1017, 1022, 1018, 1016, 1020, 1020,
+ 1013, 1025, 1027, 1028, 1021, 1021, 1029, 1029, 1026, 1024,
+ 1030, 1035, 1013, 1013, 1013, 1022, 1032, 1018, 1024, 1013,
+ 1026, 1028, 1027, 1031, 1031, 1020, 1034, 1032, 1025, 1027,
+ 1028, 1036, 1037, 1029, 1038, 1026, 1030, 1030, 1036, 1040,
+
+ 1039, 1042, 1035, 1032, 1041, 1043, 1044, 0, 1034, 1046,
+ 1031, 1041, 1037, 1034, 0, 1044, 1042, 1040, 1036, 1037,
+ 1050, 1038, 1039, 1045, 1045, 1047, 1040, 1039, 1042, 1043,
+ 1048, 1041, 1043, 1044, 1049, 1046, 1046, 1047, 1048, 1052,
+ 1051, 1050, 1054, 1053, 1058, 1055, 1049, 1050, 1053, 1056,
+ 1045, 1055, 1047, 1057, 1060, 1063, 1059, 1048, 1051, 1053,
+ 1059, 1049, 1056, 1061, 1061, 1062, 1052, 1051, 1064, 1054,
+ 1053, 1058, 1055, 1065, 1066, 1053, 1056, 1067, 1068, 1067,
+ 1062, 1070, 1095, 1064, 1057, 1060, 1063, 1059, 1069, 1066,
+ 1061, 1071, 1062, 1069, 0, 1064, 1065, 1073, 0, 1074,
+
+ 1065, 1066, 1075, 1076, 1067, 1079, 1071, 1077, 1085, 1068,
+ 1078, 0, 1070, 1095, 1077, 1069, 0, 1080, 1071, 1083,
+ 1088, 1073, 1081, 1085, 1073, 1074, 1074, 1079, 1087, 1075,
+ 1076, 1078, 1079, 1090, 1077, 1085, 1093, 1078, 1080, 1091,
+ 1081, 1083, 1092, 1087, 1080, 1089, 1083, 1088, 1091, 1081,
+ 1092, 1090, 1089, 1094, 1096, 1087, 1108, 1098, 1100, 1093,
+ 1090, 1099, 1103, 1093, 1101, 1106, 1091, 1096, 1098, 1092,
+ 1099, 1110, 1089, 1107, 1111, 1094, 1100, 1106, 1112, 0,
+ 1094, 1096, 1101, 1098, 1098, 1100, 1107, 1108, 1099, 1103,
+ 1114, 1101, 1106, 1109, 1117, 1098, 1116, 1110, 1110, 1111,
+
+ 1107, 1111, 1115, 1109, 1119, 1112, 1122, 1118, 0, 1115,
+ 1114, 1120, 1117, 1118, 1126, 1121, 1132, 1114, 1122, 1119,
+ 1109, 1117, 1116, 1116, 1127, 1123, 1120, 1129, 1124, 1115,
+ 1121, 1119, 1123, 1122, 1118, 1124, 1126, 1128, 1120, 1134,
+ 1131, 1126, 1121, 1132, 1135, 1129, 1128, 1133, 1133, 1127,
+ 1136, 1127, 1123, 1131, 1129, 1124, 1137, 1140, 1139, 1138,
+ 1141, 1134, 1143, 1144, 1128, 1139, 1134, 1131, 1138, 1135,
+ 1143, 1135, 1136, 1145, 1133, 1149, 1144, 1136, 1137, 1146,
+ 1148, 1151, 1141, 1137, 0, 1139, 1138, 1141, 1140, 1143,
+ 1144, 1146, 1147, 1150, 1154, 1152, 1151, 1149, 1152, 1147,
+
+ 1145, 1153, 1149, 1160, 1162, 1157, 1146, 1158, 1151, 1155,
+ 0, 1148, 1154, 1152, 1164, 1162, 1161, 1160, 1150, 1147,
+ 1150, 1154, 1152, 1161, 1155, 1152, 1153, 1157, 1153, 1158,
+ 1160, 1162, 1157, 1166, 1158, 1164, 1155, 1167, 1168, 1169,
+ 1168, 1164, 1170, 1161, 1171, 1172, 0, 1173, 1175, 1167,
+ 1174, 1177, 1179, 1176, 1166, 1173, 1182, 1169, 1183, 1179,
+ 1166, 1184, 1171, 1178, 1167, 1168, 1169, 1176, 1185, 1170,
+ 1175, 1171, 1172, 1174, 1173, 1175, 1183, 1174, 1177, 1179,
+ 1176, 1186, 1178, 1182, 1187, 1183, 1189, 1188, 1184, 1191,
+ 1178, 1191, 0, 1187, 1185, 1185, 1186, 1192, 1193, 1195,
+
+ 1194, 1196, 1193, 1198, 1197, 1200, 1199, 0, 1186, 1188,
+ 1196, 1187, 1194, 1189, 1188, 1197, 1191, 1200, 1201, 1192,
+ 1212, 1195, 1202, 1202, 1192, 1193, 1195, 1194, 1196, 1199,
+ 1198, 1197, 1200, 1199, 1203, 1205, 1207, 1208, 1206, 1205,
+ 1201, 1206, 1203, 1208, 1207, 1201, 1210, 1212, 1213, 1202,
+ 1217, 1209, 1210, 1214, 1218, 1215, 1216, 1219, 1221, 1222,
+ 1220, 1203, 1205, 1207, 1208, 1206, 1209, 1214, 1215, 1223,
+ 1216, 1224, 1213, 1210, 1220, 1213, 1217, 1217, 1209, 1224,
+ 1214, 1218, 1215, 1216, 1219, 1221, 1222, 1220, 1225, 1226,
+ 1229, 1227, 1230, 1231, 1232, 1233, 1223, 0, 1224, 1227,
+
+ 1235, 1231, 1234, 1237, 1233, 1238, 1239, 1241, 1243, 0,
+ 1236, 1241, 1229, 1238, 1242, 1225, 1226, 1229, 1227, 1230,
+ 1231, 1232, 1233, 1234, 1235, 1236, 1242, 1235, 1244, 1234,
+ 1237, 1243, 1238, 1239, 1241, 1243, 1236, 1236, 1245, 1246,
+ 1249, 1242, 1247, 1247, 1248, 1250, 1245, 1252, 1253, 1252,
+ 1254, 1251, 1236, 1260, 1255, 1244, 1254, 0, 1249, 0,
+ 1250, 1257, 1253, 1261, 1258, 1245, 1246, 1249, 1256, 1247,
+ 1248, 1248, 1250, 1251, 1252, 1253, 1255, 1254, 1251, 1257,
+ 1256, 1255, 1258, 1259, 1260, 1263, 1261, 1265, 1257, 1266,
+ 1261, 1258, 1263, 1267, 1268, 1256, 1259, 0, 1273, 1270,
+
+ 1271, 0, 1268, 0, 1275, 1265, 1278, 1280, 1276, 1281,
+ 1259, 1270, 1263, 1273, 1265, 1266, 1266, 1282, 1271, 1290,
+ 1268, 1268, 1281, 1283, 1267, 1273, 1270, 1271, 1275, 1268,
+ 1276, 1275, 1277, 1278, 1280, 1276, 1281, 1285, 1283, 1277,
+ 1284, 0, 1286, 1282, 1282, 1285, 1290, 1288, 1289, 1291,
+ 1283, 1292, 1293, 1284, 1294, 1295, 1297, 0, 1292, 1277,
+ 0, 1296, 1295, 1298, 1285, 1293, 1302, 1284, 1286, 1286,
+ 1288, 1291, 1289, 1301, 1288, 1289, 1291, 1294, 1292, 1293,
+ 1300, 1294, 1295, 1296, 1298, 1303, 1304, 1297, 1296, 1307,
+ 1298, 1300, 1311, 1315, 1317, 1301, 1314, 1302, 1319, 1320,
+
+ 1301, 1322, 1327, 1321, 1303, 1323, 1322, 1300, 1325, 0,
+ 1331, 1304, 1303, 1304, 1321, 1307, 1307, 1333, 1314, 1311,
+ 1315, 1317, 1328, 1314, 1329, 1320, 1320, 1323, 1322, 1319,
+ 1321, 1328, 1323, 1327, 1334, 1325, 1329, 1331, 1336, 1333,
+ 1335, 1337, 1338, 1339, 1333, 1341, 0, 1340, 1342, 1328,
+ 0, 1329, 1347, 1335, 1341, 1345, 1343, 1346, 1344, 1334,
+ 1336, 1334, 1340, 1342, 1346, 1336, 0, 1335, 1337, 1338,
+ 1339, 1343, 1341, 1344, 1340, 1342, 1348, 1345, 1351, 1347,
+ 1349, 1349, 1345, 1343, 1346, 1344, 1350, 1352, 1353, 1354,
+ 1352, 1355, 1351, 1350, 1348, 1356, 1355, 1357, 1354, 1358,
+
+ 1359, 1353, 1362, 1348, 1371, 1351, 0, 1349, 0, 1362,
+ 1369, 1363, 1366, 1350, 1352, 1353, 1354, 1356, 1355, 1357,
+ 1363, 1373, 1356, 1364, 1357, 1365, 1358, 1359, 1364, 1362,
+ 1366, 1371, 1365, 1367, 1368, 1372, 1369, 1369, 1363, 1366,
+ 1367, 1373, 1374, 1368, 1379, 1380, 1375, 1376, 1373, 0,
+ 1364, 1378, 1365, 1372, 1374, 1375, 1376, 1377, 1381, 1378,
+ 1367, 1368, 1372, 1382, 1383, 1390, 1391, 1381, 1377, 1374,
+ 1384, 1379, 1383, 1375, 1376, 1382, 1380, 1384, 1378, 1386,
+ 1395, 1389, 1392, 1396, 1377, 1381, 1393, 1386, 1389, 1390,
+ 1382, 1383, 1390, 1391, 1392, 1393, 1399, 1384, 1397, 1401,
+
+ 1402, 0, 1406, 1395, 1408, 0, 1386, 1395, 1389, 1392,
+ 1396, 1400, 1397, 1393, 1409, 1407, 1411, 1410, 1412, 1400,
+ 1407, 1414, 1408, 1399, 1411, 1397, 1401, 1402, 1406, 1406,
+ 1415, 1408, 1416, 1414, 1417, 1418, 1409, 1412, 1400, 1410,
+ 1419, 1409, 1407, 1411, 1410, 1412, 1417, 1420, 1414, 1421,
+ 1422, 1426, 1415, 1423, 1416, 0, 1427, 1415, 0, 1416,
+ 1430, 1417, 1418, 1428, 1432, 0, 1429, 1419, 1435, 1431,
+ 0, 1421, 1430, 0, 1433, 0, 1421, 1422, 1420, 1427,
+ 1423, 1438, 1426, 1427, 1429, 1428, 1432, 1430, 1431, 1433,
+ 1428, 1432, 1435, 1429, 1436, 1435, 1431, 1437, 1439, 1438,
+
+ 1440, 1433, 1441, 1436, 1443, 1446, 1444, 1445, 1438, 1448,
+ 1447, 1437, 1443, 1444, 0, 1445, 1439, 1450, 1454, 1449,
+ 1441, 1436, 1452, 1458, 1437, 1439, 1440, 1440, 1447, 1441,
+ 1454, 1443, 1446, 1444, 1445, 1456, 1448, 1447, 1449, 1450,
+ 1452, 1453, 1469, 1462, 1450, 1454, 1449, 1461, 1463, 1452,
+ 1458, 1464, 1465, 1466, 1461, 1453, 1467, 1470, 1468, 1471,
+ 1474, 1456, 1456, 1475, 0, 1467, 1483, 0, 1453, 1462,
+ 1462, 1468, 1463, 1469, 1461, 1463, 0, 1479, 1464, 1465,
+ 1466, 1474, 1471, 1467, 1470, 1468, 1471, 1474, 1478, 1478,
+ 1481, 1480, 1482, 1483, 1475, 1484, 1489, 1481, 1478, 1479,
+
+ 1480, 1485, 1486, 1484, 1479, 1482, 1487, 1489, 1488, 1490,
+ 1486, 1492, 1492, 1500, 1491, 1478, 1478, 1481, 1480, 1482,
+ 1485, 1491, 1484, 1489, 1493, 1497, 0, 1501, 1485, 1486,
+ 1494, 1490, 1487, 1487, 1488, 1488, 1490, 1494, 1492, 1495,
+ 1500, 1491, 1493, 1502, 1499, 1503, 1495, 1504, 1507, 1497,
+ 1501, 1493, 1497, 1499, 1501, 1506, 1508, 1494, 1508, 1503,
+ 1513, 1502, 1512, 1507, 0, 1504, 1495, 1514, 1516, 1522,
+ 1502, 1499, 1503, 1506, 1504, 1507, 1520, 1523, 1517, 1523,
+ 1524, 1518, 1506, 1508, 1512, 1514, 1513, 1513, 1518, 1512,
+ 1516, 1519, 1521, 1528, 1514, 1516, 1517, 1519, 1520, 1527,
+
+ 1522, 1521, 1526, 1520, 1523, 1517, 1530, 1524, 1518, 1529,
+ 1526, 1527, 1531, 1532, 1536, 1533, 1534, 1537, 1519, 1521,
+ 1528, 1532, 1538, 1531, 1530, 1537, 1527, 1535, 1535, 1526,
+ 1539, 1541, 1529, 1530, 1533, 1543, 1529, 1544, 1534, 1531,
+ 1532, 1536, 1533, 1534, 1537, 1546, 1542, 1547, 0, 1538,
+ 1544, 1545, 1539, 1542, 1535, 1548, 1545, 1539, 1541, 1550,
+ 1549, 1543, 1543, 1548, 1544, 1551, 1550, 1554, 1552, 1553,
+ 1556, 1555, 1546, 1542, 1547, 1549, 1553, 1558, 1545, 1555,
+ 1557, 1557, 1548, 1552, 1560, 1561, 1550, 1549, 1563, 1554,
+ 1557, 1566, 1551, 1561, 1554, 1552, 1553, 1565, 1555, 1567,
+
+ 1564, 1556, 1568, 1569, 1558, 1571, 1575, 1557, 1557, 1573,
+ 1563, 1560, 1561, 1564, 1577, 1563, 1576, 1578, 1566, 1565,
+ 1582, 1581, 1586, 1583, 1565, 1569, 1567, 1564, 0, 1568,
+ 1569, 1585, 1571, 1575, 1576, 1573, 1573, 1586, 1591, 1578,
+ 1581, 1577, 1587, 1576, 1578, 1583, 1588, 1582, 1581, 1586,
+ 1583, 1587, 1594, 1585, 1589, 1589, 1590, 1588, 1585, 1594,
+ 1591, 1595, 1590, 1596, 1589, 1591, 1597, 1601, 1603, 1587,
+ 1607, 1605, 1611, 1588, 1608, 1612, 1610, 0, 1613, 1594,
+ 1613, 1589, 1589, 1590, 1605, 1610, 1608, 1616, 1595, 1597,
+ 1596, 1603, 1614, 1597, 1601, 1603, 1617, 1607, 1605, 1611,
+
+ 1615, 1608, 1612, 1610, 1614, 1613, 1615, 1618, 1619, 1616,
+ 1622, 1624, 1625, 1627, 1616, 1618, 1628, 1631, 1617, 1614,
+ 1632, 0, 1633, 1617, 1634, 0, 0, 1615, 1627, 1641,
+ 1636, 0, 1634, 1632, 1618, 1619, 1635, 1622, 1624, 1625,
+ 1627, 1636, 1628, 1628, 1633, 1635, 1642, 1632, 1631, 1633,
+ 1643, 1634, 1641, 1642, 1644, 1646, 1641, 1636, 1645, 1647,
+ 1648, 1647, 1644, 1635, 1643, 1649, 1646, 1645, 1651, 1652,
+ 1650, 1654, 1648, 1642, 1653, 1655, 1653, 1643, 1660, 1661,
+ 1656, 1644, 1646, 1654, 0, 1645, 1647, 1648, 1650, 1663,
+ 1651, 1652, 1649, 1656, 1659, 1651, 1652, 1650, 1654, 1658,
+
+ 1662, 1653, 1659, 1663, 1664, 1665, 1655, 1656, 1670, 1660,
+ 1661, 1658, 1664, 1662, 1666, 1667, 1663, 1669, 1665, 1668,
+ 1672, 1659, 1666, 1671, 1678, 1669, 1658, 1662, 1672, 1667,
+ 1670, 1664, 1665, 1668, 1673, 1670, 1674, 1675, 1679, 0,
+ 1676, 1666, 1667, 1677, 1669, 1671, 1668, 1672, 1680, 1681,
+ 1671, 1677, 1683, 1691, 0, 1678, 0, 1681, 1674, 1675,
+ 1673, 1673, 1676, 1674, 1675, 1679, 1682, 1676, 1680, 1684,
+ 1677, 1685, 1687, 1688, 1682, 1680, 1681, 1684, 1689, 1691,
+ 1691, 1688, 1692, 1683, 1693, 1685, 1689, 1690, 0, 1694,
+ 0, 1695, 1693, 1682, 1687, 0, 1684, 1696, 1685, 1687,
+
+ 1688, 1690, 1697, 1699, 1692, 1689, 1700, 1701, 0, 1692,
+ 1703, 1693, 1698, 1702, 1690, 1694, 1694, 1695, 1695, 1696,
+ 1698, 1702, 1697, 1704, 1696, 1706, 1700, 1701, 1708, 1697,
+ 1699, 1704, 1703, 1700, 1701, 1707, 1708, 1703, 1709, 1698,
+ 1702, 1710, 1714, 1711, 1715, 1712, 1709, 1706, 1713, 1716,
+ 1704, 1711, 1706, 1712, 1717, 1708, 0, 1707, 1718, 0,
+ 1720, 1723, 1707, 1726, 1715, 1709, 1727, 1710, 1710, 1714,
+ 1711, 1715, 1712, 0, 1713, 1713, 1716, 0, 1718, 0,
+ 0, 1717, 1720, 1723, 1724, 1718, 1725, 1720, 1723, 0,
+ 1726, 0, 1724, 1727, 1725, 0, 0, 0, 0, 0,
+
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1724, 0, 1725, 1731, 1731, 1731, 1731, 1731, 1731,
+ 1731, 1732, 1732, 1732, 1732, 1732, 1732, 1732, 1733, 1733,
+ 1733, 1733, 1733, 1733, 1733, 1734, 1734, 1734, 1734, 1734,
+ 1734, 1734, 1735, 1735, 1735, 1735, 1735, 1735, 1735, 1737,
+ 1737, 0, 1737, 1737, 1737, 1737, 1738, 1738, 0, 0,
+ 0, 1738, 1738, 1739, 1739, 0, 0, 1739, 0, 1739,
+ 1740, 0, 0, 0, 0, 0, 1740, 1741, 1741, 0,
+ 0, 0, 1741, 1741, 1742, 0, 0, 0, 0, 0,
+ 1742, 1743, 1743, 0, 1743, 1743, 1743, 1743, 1744, 1744,
+
+ 0, 1744, 1744, 1744, 1744, 1730, 1730, 1730, 1730, 1730,
+ 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730,
+ 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730,
+ 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730,
+ 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730,
+ 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730,
+ 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730,
+ 1730
} ;
static yy_state_type yy_last_accepting_state;
#define YY_NO_INPUT 1
#endif
-#line 2220 "<stdout>"
+#line 2325 "<stdout>"
#define INITIAL 0
#define quotedstring 1
#line 197 "util/configlexer.lex"
-#line 2407 "<stdout>"
+#line 2512 "<stdout>"
if ( !(yy_init) )
{
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 1628 )
+ if ( yy_current_state >= 1731 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 4681 );
+ while ( yy_base[yy_current_state] != 5006 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
case 29:
YY_RULE_SETUP
#line 229 "util/configlexer.lex"
-{ YDVAR(1, VAR_CHROOT) }
+{ YDVAR(1, VAR_IP_TRANSPARENT) }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 230 "util/configlexer.lex"
-{ YDVAR(1, VAR_USERNAME) }
+{ YDVAR(1, VAR_CHROOT) }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 231 "util/configlexer.lex"
-{ YDVAR(1, VAR_DIRECTORY) }
+{ YDVAR(1, VAR_USERNAME) }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 232 "util/configlexer.lex"
-{ YDVAR(1, VAR_LOGFILE) }
+{ YDVAR(1, VAR_DIRECTORY) }
YY_BREAK
case 33:
YY_RULE_SETUP
#line 233 "util/configlexer.lex"
-{ YDVAR(1, VAR_PIDFILE) }
+{ YDVAR(1, VAR_LOGFILE) }
YY_BREAK
case 34:
YY_RULE_SETUP
#line 234 "util/configlexer.lex"
-{ YDVAR(1, VAR_ROOT_HINTS) }
+{ YDVAR(1, VAR_PIDFILE) }
YY_BREAK
case 35:
YY_RULE_SETUP
#line 235 "util/configlexer.lex"
-{ YDVAR(1, VAR_EDNS_BUFFER_SIZE) }
+{ YDVAR(1, VAR_ROOT_HINTS) }
YY_BREAK
case 36:
YY_RULE_SETUP
#line 236 "util/configlexer.lex"
-{ YDVAR(1, VAR_MSG_BUFFER_SIZE) }
+{ YDVAR(1, VAR_EDNS_BUFFER_SIZE) }
YY_BREAK
case 37:
YY_RULE_SETUP
#line 237 "util/configlexer.lex"
-{ YDVAR(1, VAR_MSG_CACHE_SIZE) }
+{ YDVAR(1, VAR_MSG_BUFFER_SIZE) }
YY_BREAK
case 38:
YY_RULE_SETUP
#line 238 "util/configlexer.lex"
-{ YDVAR(1, VAR_MSG_CACHE_SLABS) }
+{ YDVAR(1, VAR_MSG_CACHE_SIZE) }
YY_BREAK
case 39:
YY_RULE_SETUP
#line 239 "util/configlexer.lex"
-{ YDVAR(1, VAR_RRSET_CACHE_SIZE) }
+{ YDVAR(1, VAR_MSG_CACHE_SLABS) }
YY_BREAK
case 40:
YY_RULE_SETUP
#line 240 "util/configlexer.lex"
-{ YDVAR(1, VAR_RRSET_CACHE_SLABS) }
+{ YDVAR(1, VAR_RRSET_CACHE_SIZE) }
YY_BREAK
case 41:
YY_RULE_SETUP
#line 241 "util/configlexer.lex"
-{ YDVAR(1, VAR_CACHE_MAX_TTL) }
+{ YDVAR(1, VAR_RRSET_CACHE_SLABS) }
YY_BREAK
case 42:
YY_RULE_SETUP
#line 242 "util/configlexer.lex"
-{ YDVAR(1, VAR_CACHE_MIN_TTL) }
+{ YDVAR(1, VAR_CACHE_MAX_TTL) }
YY_BREAK
case 43:
YY_RULE_SETUP
#line 243 "util/configlexer.lex"
-{ YDVAR(1, VAR_INFRA_HOST_TTL) }
+{ YDVAR(1, VAR_CACHE_MAX_NEGATIVE_TTL) }
YY_BREAK
case 44:
YY_RULE_SETUP
#line 244 "util/configlexer.lex"
-{ YDVAR(1, VAR_INFRA_LAME_TTL) }
+{ YDVAR(1, VAR_CACHE_MIN_TTL) }
YY_BREAK
case 45:
YY_RULE_SETUP
#line 245 "util/configlexer.lex"
-{ YDVAR(1, VAR_INFRA_CACHE_SLABS) }
+{ YDVAR(1, VAR_INFRA_HOST_TTL) }
YY_BREAK
case 46:
YY_RULE_SETUP
#line 246 "util/configlexer.lex"
-{ YDVAR(1, VAR_INFRA_CACHE_NUMHOSTS) }
+{ YDVAR(1, VAR_INFRA_LAME_TTL) }
YY_BREAK
case 47:
YY_RULE_SETUP
#line 247 "util/configlexer.lex"
-{ YDVAR(1, VAR_INFRA_CACHE_LAME_SIZE) }
+{ YDVAR(1, VAR_INFRA_CACHE_SLABS) }
YY_BREAK
case 48:
YY_RULE_SETUP
#line 248 "util/configlexer.lex"
-{ YDVAR(1, VAR_INFRA_CACHE_MIN_RTT) }
+{ YDVAR(1, VAR_INFRA_CACHE_NUMHOSTS) }
YY_BREAK
case 49:
YY_RULE_SETUP
#line 249 "util/configlexer.lex"
-{ YDVAR(1, VAR_NUM_QUERIES_PER_THREAD) }
+{ YDVAR(1, VAR_INFRA_CACHE_LAME_SIZE) }
YY_BREAK
case 50:
YY_RULE_SETUP
#line 250 "util/configlexer.lex"
-{ YDVAR(1, VAR_JOSTLE_TIMEOUT) }
+{ YDVAR(1, VAR_INFRA_CACHE_MIN_RTT) }
YY_BREAK
case 51:
YY_RULE_SETUP
#line 251 "util/configlexer.lex"
-{ YDVAR(1, VAR_DELAY_CLOSE) }
+{ YDVAR(1, VAR_NUM_QUERIES_PER_THREAD) }
YY_BREAK
case 52:
YY_RULE_SETUP
#line 252 "util/configlexer.lex"
-{ YDVAR(1, VAR_TARGET_FETCH_POLICY) }
+{ YDVAR(1, VAR_JOSTLE_TIMEOUT) }
YY_BREAK
case 53:
YY_RULE_SETUP
#line 253 "util/configlexer.lex"
-{ YDVAR(1, VAR_HARDEN_SHORT_BUFSIZE) }
+{ YDVAR(1, VAR_DELAY_CLOSE) }
YY_BREAK
case 54:
YY_RULE_SETUP
#line 254 "util/configlexer.lex"
-{ YDVAR(1, VAR_HARDEN_LARGE_QUERIES) }
+{ YDVAR(1, VAR_TARGET_FETCH_POLICY) }
YY_BREAK
case 55:
YY_RULE_SETUP
#line 255 "util/configlexer.lex"
-{ YDVAR(1, VAR_HARDEN_GLUE) }
+{ YDVAR(1, VAR_HARDEN_SHORT_BUFSIZE) }
YY_BREAK
case 56:
YY_RULE_SETUP
#line 256 "util/configlexer.lex"
-{ YDVAR(1, VAR_HARDEN_DNSSEC_STRIPPED) }
+{ YDVAR(1, VAR_HARDEN_LARGE_QUERIES) }
YY_BREAK
case 57:
YY_RULE_SETUP
#line 257 "util/configlexer.lex"
-{ YDVAR(1, VAR_HARDEN_BELOW_NXDOMAIN) }
+{ YDVAR(1, VAR_HARDEN_GLUE) }
YY_BREAK
case 58:
YY_RULE_SETUP
#line 258 "util/configlexer.lex"
-{ YDVAR(1, VAR_HARDEN_REFERRAL_PATH) }
+{ YDVAR(1, VAR_HARDEN_DNSSEC_STRIPPED) }
YY_BREAK
case 59:
YY_RULE_SETUP
#line 259 "util/configlexer.lex"
-{ YDVAR(1, VAR_USE_CAPS_FOR_ID) }
+{ YDVAR(1, VAR_HARDEN_BELOW_NXDOMAIN) }
YY_BREAK
case 60:
YY_RULE_SETUP
#line 260 "util/configlexer.lex"
-{ YDVAR(1, VAR_UNWANTED_REPLY_THRESHOLD) }
+{ YDVAR(1, VAR_HARDEN_REFERRAL_PATH) }
YY_BREAK
case 61:
YY_RULE_SETUP
#line 261 "util/configlexer.lex"
-{ YDVAR(1, VAR_PRIVATE_ADDRESS) }
+{ YDVAR(1, VAR_HARDEN_ALGO_DOWNGRADE) }
YY_BREAK
case 62:
YY_RULE_SETUP
#line 262 "util/configlexer.lex"
-{ YDVAR(1, VAR_PRIVATE_DOMAIN) }
+{ YDVAR(1, VAR_USE_CAPS_FOR_ID) }
YY_BREAK
case 63:
YY_RULE_SETUP
#line 263 "util/configlexer.lex"
-{ YDVAR(1, VAR_PREFETCH_KEY) }
+{ YDVAR(1, VAR_CAPS_WHITELIST) }
YY_BREAK
case 64:
YY_RULE_SETUP
#line 264 "util/configlexer.lex"
-{ YDVAR(1, VAR_PREFETCH) }
+{ YDVAR(1, VAR_UNWANTED_REPLY_THRESHOLD) }
YY_BREAK
case 65:
YY_RULE_SETUP
#line 265 "util/configlexer.lex"
-{ YDVAR(0, VAR_STUB_ZONE) }
+{ YDVAR(1, VAR_PRIVATE_ADDRESS) }
YY_BREAK
case 66:
YY_RULE_SETUP
#line 266 "util/configlexer.lex"
-{ YDVAR(1, VAR_NAME) }
+{ YDVAR(1, VAR_PRIVATE_DOMAIN) }
YY_BREAK
case 67:
YY_RULE_SETUP
#line 267 "util/configlexer.lex"
-{ YDVAR(1, VAR_STUB_ADDR) }
+{ YDVAR(1, VAR_PREFETCH_KEY) }
YY_BREAK
case 68:
YY_RULE_SETUP
#line 268 "util/configlexer.lex"
-{ YDVAR(1, VAR_STUB_HOST) }
+{ YDVAR(1, VAR_PREFETCH) }
YY_BREAK
case 69:
YY_RULE_SETUP
#line 269 "util/configlexer.lex"
-{ YDVAR(1, VAR_STUB_PRIME) }
+{ YDVAR(0, VAR_STUB_ZONE) }
YY_BREAK
case 70:
YY_RULE_SETUP
#line 270 "util/configlexer.lex"
-{ YDVAR(1, VAR_STUB_FIRST) }
+{ YDVAR(1, VAR_NAME) }
YY_BREAK
case 71:
YY_RULE_SETUP
#line 271 "util/configlexer.lex"
-{ YDVAR(0, VAR_FORWARD_ZONE) }
+{ YDVAR(1, VAR_STUB_ADDR) }
YY_BREAK
case 72:
YY_RULE_SETUP
#line 272 "util/configlexer.lex"
-{ YDVAR(1, VAR_FORWARD_ADDR) }
+{ YDVAR(1, VAR_STUB_HOST) }
YY_BREAK
case 73:
YY_RULE_SETUP
#line 273 "util/configlexer.lex"
-{ YDVAR(1, VAR_FORWARD_HOST) }
+{ YDVAR(1, VAR_STUB_PRIME) }
YY_BREAK
case 74:
YY_RULE_SETUP
#line 274 "util/configlexer.lex"
-{ YDVAR(1, VAR_FORWARD_FIRST) }
+{ YDVAR(1, VAR_STUB_FIRST) }
YY_BREAK
case 75:
YY_RULE_SETUP
#line 275 "util/configlexer.lex"
-{ YDVAR(1, VAR_DO_NOT_QUERY_ADDRESS) }
+{ YDVAR(0, VAR_FORWARD_ZONE) }
YY_BREAK
case 76:
YY_RULE_SETUP
#line 276 "util/configlexer.lex"
-{ YDVAR(1, VAR_DO_NOT_QUERY_LOCALHOST) }
+{ YDVAR(1, VAR_FORWARD_ADDR) }
YY_BREAK
case 77:
YY_RULE_SETUP
#line 277 "util/configlexer.lex"
-{ YDVAR(2, VAR_ACCESS_CONTROL) }
+{ YDVAR(1, VAR_FORWARD_HOST) }
YY_BREAK
case 78:
YY_RULE_SETUP
#line 278 "util/configlexer.lex"
-{ YDVAR(1, VAR_HIDE_IDENTITY) }
+{ YDVAR(1, VAR_FORWARD_FIRST) }
YY_BREAK
case 79:
YY_RULE_SETUP
#line 279 "util/configlexer.lex"
-{ YDVAR(1, VAR_HIDE_VERSION) }
+{ YDVAR(1, VAR_DO_NOT_QUERY_ADDRESS) }
YY_BREAK
case 80:
YY_RULE_SETUP
#line 280 "util/configlexer.lex"
-{ YDVAR(1, VAR_IDENTITY) }
+{ YDVAR(1, VAR_DO_NOT_QUERY_LOCALHOST) }
YY_BREAK
case 81:
YY_RULE_SETUP
#line 281 "util/configlexer.lex"
-{ YDVAR(1, VAR_VERSION) }
+{ YDVAR(2, VAR_ACCESS_CONTROL) }
YY_BREAK
case 82:
YY_RULE_SETUP
#line 282 "util/configlexer.lex"
-{ YDVAR(1, VAR_MODULE_CONF) }
+{ YDVAR(1, VAR_HIDE_IDENTITY) }
YY_BREAK
case 83:
YY_RULE_SETUP
#line 283 "util/configlexer.lex"
-{ YDVAR(1, VAR_DLV_ANCHOR) }
+{ YDVAR(1, VAR_HIDE_VERSION) }
YY_BREAK
case 84:
YY_RULE_SETUP
#line 284 "util/configlexer.lex"
-{ YDVAR(1, VAR_DLV_ANCHOR_FILE) }
+{ YDVAR(1, VAR_IDENTITY) }
YY_BREAK
case 85:
YY_RULE_SETUP
#line 285 "util/configlexer.lex"
-{ YDVAR(1, VAR_TRUST_ANCHOR_FILE) }
+{ YDVAR(1, VAR_VERSION) }
YY_BREAK
case 86:
YY_RULE_SETUP
#line 286 "util/configlexer.lex"
-{ YDVAR(1, VAR_AUTO_TRUST_ANCHOR_FILE) }
+{ YDVAR(1, VAR_MODULE_CONF) }
YY_BREAK
case 87:
YY_RULE_SETUP
#line 287 "util/configlexer.lex"
-{ YDVAR(1, VAR_TRUSTED_KEYS_FILE) }
+{ YDVAR(1, VAR_DLV_ANCHOR) }
YY_BREAK
case 88:
YY_RULE_SETUP
#line 288 "util/configlexer.lex"
-{ YDVAR(1, VAR_TRUST_ANCHOR) }
+{ YDVAR(1, VAR_DLV_ANCHOR_FILE) }
YY_BREAK
case 89:
YY_RULE_SETUP
#line 289 "util/configlexer.lex"
-{ YDVAR(1, VAR_VAL_OVERRIDE_DATE) }
+{ YDVAR(1, VAR_TRUST_ANCHOR_FILE) }
YY_BREAK
case 90:
YY_RULE_SETUP
#line 290 "util/configlexer.lex"
-{ YDVAR(1, VAR_VAL_SIG_SKEW_MIN) }
+{ YDVAR(1, VAR_AUTO_TRUST_ANCHOR_FILE) }
YY_BREAK
case 91:
YY_RULE_SETUP
#line 291 "util/configlexer.lex"
-{ YDVAR(1, VAR_VAL_SIG_SKEW_MAX) }
+{ YDVAR(1, VAR_TRUSTED_KEYS_FILE) }
YY_BREAK
case 92:
YY_RULE_SETUP
#line 292 "util/configlexer.lex"
-{ YDVAR(1, VAR_BOGUS_TTL) }
+{ YDVAR(1, VAR_TRUST_ANCHOR) }
YY_BREAK
case 93:
YY_RULE_SETUP
#line 293 "util/configlexer.lex"
-{ YDVAR(1, VAR_VAL_CLEAN_ADDITIONAL) }
+{ YDVAR(1, VAR_VAL_OVERRIDE_DATE) }
YY_BREAK
case 94:
YY_RULE_SETUP
#line 294 "util/configlexer.lex"
-{ YDVAR(1, VAR_VAL_PERMISSIVE_MODE) }
+{ YDVAR(1, VAR_VAL_SIG_SKEW_MIN) }
YY_BREAK
case 95:
YY_RULE_SETUP
#line 295 "util/configlexer.lex"
-{ YDVAR(1, VAR_IGNORE_CD_FLAG) }
+{ YDVAR(1, VAR_VAL_SIG_SKEW_MAX) }
YY_BREAK
case 96:
YY_RULE_SETUP
#line 296 "util/configlexer.lex"
-{ YDVAR(1, VAR_VAL_LOG_LEVEL) }
+{ YDVAR(1, VAR_BOGUS_TTL) }
YY_BREAK
case 97:
YY_RULE_SETUP
#line 297 "util/configlexer.lex"
-{ YDVAR(1, VAR_KEY_CACHE_SIZE) }
+{ YDVAR(1, VAR_VAL_CLEAN_ADDITIONAL) }
YY_BREAK
case 98:
YY_RULE_SETUP
#line 298 "util/configlexer.lex"
-{ YDVAR(1, VAR_KEY_CACHE_SLABS) }
+{ YDVAR(1, VAR_VAL_PERMISSIVE_MODE) }
YY_BREAK
case 99:
YY_RULE_SETUP
#line 299 "util/configlexer.lex"
-{ YDVAR(1, VAR_NEG_CACHE_SIZE) }
+{ YDVAR(1, VAR_IGNORE_CD_FLAG) }
YY_BREAK
case 100:
YY_RULE_SETUP
#line 300 "util/configlexer.lex"
-{
- YDVAR(1, VAR_VAL_NSEC3_KEYSIZE_ITERATIONS) }
+{ YDVAR(1, VAR_VAL_LOG_LEVEL) }
YY_BREAK
case 101:
YY_RULE_SETUP
-#line 302 "util/configlexer.lex"
-{ YDVAR(1, VAR_ADD_HOLDDOWN) }
+#line 301 "util/configlexer.lex"
+{ YDVAR(1, VAR_KEY_CACHE_SIZE) }
YY_BREAK
case 102:
YY_RULE_SETUP
-#line 303 "util/configlexer.lex"
-{ YDVAR(1, VAR_DEL_HOLDDOWN) }
+#line 302 "util/configlexer.lex"
+{ YDVAR(1, VAR_KEY_CACHE_SLABS) }
YY_BREAK
case 103:
YY_RULE_SETUP
-#line 304 "util/configlexer.lex"
-{ YDVAR(1, VAR_KEEP_MISSING) }
+#line 303 "util/configlexer.lex"
+{ YDVAR(1, VAR_NEG_CACHE_SIZE) }
YY_BREAK
case 104:
YY_RULE_SETUP
-#line 305 "util/configlexer.lex"
-{ YDVAR(1, VAR_USE_SYSLOG) }
+#line 304 "util/configlexer.lex"
+{
+ YDVAR(1, VAR_VAL_NSEC3_KEYSIZE_ITERATIONS) }
YY_BREAK
case 105:
YY_RULE_SETUP
#line 306 "util/configlexer.lex"
-{ YDVAR(1, VAR_LOG_TIME_ASCII) }
+{ YDVAR(1, VAR_ADD_HOLDDOWN) }
YY_BREAK
case 106:
YY_RULE_SETUP
#line 307 "util/configlexer.lex"
-{ YDVAR(1, VAR_LOG_QUERIES) }
+{ YDVAR(1, VAR_DEL_HOLDDOWN) }
YY_BREAK
case 107:
YY_RULE_SETUP
#line 308 "util/configlexer.lex"
-{ YDVAR(2, VAR_LOCAL_ZONE) }
+{ YDVAR(1, VAR_KEEP_MISSING) }
YY_BREAK
case 108:
YY_RULE_SETUP
#line 309 "util/configlexer.lex"
-{ YDVAR(1, VAR_LOCAL_DATA) }
+{ YDVAR(1, VAR_USE_SYSLOG) }
YY_BREAK
case 109:
YY_RULE_SETUP
#line 310 "util/configlexer.lex"
-{ YDVAR(1, VAR_LOCAL_DATA_PTR) }
+{ YDVAR(1, VAR_LOG_TIME_ASCII) }
YY_BREAK
case 110:
YY_RULE_SETUP
#line 311 "util/configlexer.lex"
-{ YDVAR(1, VAR_UNBLOCK_LAN_ZONES) }
+{ YDVAR(1, VAR_LOG_QUERIES) }
YY_BREAK
case 111:
YY_RULE_SETUP
#line 312 "util/configlexer.lex"
-{ YDVAR(1, VAR_STATISTICS_INTERVAL) }
+{ YDVAR(2, VAR_LOCAL_ZONE) }
YY_BREAK
case 112:
YY_RULE_SETUP
#line 313 "util/configlexer.lex"
-{ YDVAR(1, VAR_STATISTICS_CUMULATIVE) }
+{ YDVAR(1, VAR_LOCAL_DATA) }
YY_BREAK
case 113:
YY_RULE_SETUP
#line 314 "util/configlexer.lex"
-{ YDVAR(1, VAR_EXTENDED_STATISTICS) }
+{ YDVAR(1, VAR_LOCAL_DATA_PTR) }
YY_BREAK
case 114:
YY_RULE_SETUP
#line 315 "util/configlexer.lex"
-{ YDVAR(0, VAR_REMOTE_CONTROL) }
+{ YDVAR(1, VAR_UNBLOCK_LAN_ZONES) }
YY_BREAK
case 115:
YY_RULE_SETUP
#line 316 "util/configlexer.lex"
-{ YDVAR(1, VAR_CONTROL_ENABLE) }
+{ YDVAR(1, VAR_STATISTICS_INTERVAL) }
YY_BREAK
case 116:
YY_RULE_SETUP
#line 317 "util/configlexer.lex"
-{ YDVAR(1, VAR_CONTROL_INTERFACE) }
+{ YDVAR(1, VAR_STATISTICS_CUMULATIVE) }
YY_BREAK
case 117:
YY_RULE_SETUP
#line 318 "util/configlexer.lex"
-{ YDVAR(1, VAR_CONTROL_PORT) }
+{ YDVAR(1, VAR_EXTENDED_STATISTICS) }
YY_BREAK
case 118:
YY_RULE_SETUP
#line 319 "util/configlexer.lex"
-{ YDVAR(1, VAR_CONTROL_USE_CERT) }
+{ YDVAR(0, VAR_REMOTE_CONTROL) }
YY_BREAK
case 119:
YY_RULE_SETUP
#line 320 "util/configlexer.lex"
-{ YDVAR(1, VAR_SERVER_KEY_FILE) }
+{ YDVAR(1, VAR_CONTROL_ENABLE) }
YY_BREAK
case 120:
YY_RULE_SETUP
#line 321 "util/configlexer.lex"
-{ YDVAR(1, VAR_SERVER_CERT_FILE) }
+{ YDVAR(1, VAR_CONTROL_INTERFACE) }
YY_BREAK
case 121:
YY_RULE_SETUP
#line 322 "util/configlexer.lex"
-{ YDVAR(1, VAR_CONTROL_KEY_FILE) }
+{ YDVAR(1, VAR_CONTROL_PORT) }
YY_BREAK
case 122:
YY_RULE_SETUP
#line 323 "util/configlexer.lex"
-{ YDVAR(1, VAR_CONTROL_CERT_FILE) }
+{ YDVAR(1, VAR_CONTROL_USE_CERT) }
YY_BREAK
case 123:
YY_RULE_SETUP
#line 324 "util/configlexer.lex"
-{ YDVAR(1, VAR_PYTHON_SCRIPT) }
+{ YDVAR(1, VAR_SERVER_KEY_FILE) }
YY_BREAK
case 124:
YY_RULE_SETUP
#line 325 "util/configlexer.lex"
-{ YDVAR(0, VAR_PYTHON) }
+{ YDVAR(1, VAR_SERVER_CERT_FILE) }
YY_BREAK
case 125:
YY_RULE_SETUP
#line 326 "util/configlexer.lex"
-{ YDVAR(1, VAR_DOMAIN_INSECURE) }
+{ YDVAR(1, VAR_CONTROL_KEY_FILE) }
YY_BREAK
case 126:
YY_RULE_SETUP
#line 327 "util/configlexer.lex"
-{ YDVAR(1, VAR_MINIMAL_RESPONSES) }
+{ YDVAR(1, VAR_CONTROL_CERT_FILE) }
YY_BREAK
case 127:
YY_RULE_SETUP
#line 328 "util/configlexer.lex"
-{ YDVAR(1, VAR_RRSET_ROUNDROBIN) }
+{ YDVAR(1, VAR_PYTHON_SCRIPT) }
YY_BREAK
case 128:
YY_RULE_SETUP
#line 329 "util/configlexer.lex"
-{ YDVAR(1, VAR_MAX_UDP_SIZE) }
+{ YDVAR(0, VAR_PYTHON) }
YY_BREAK
case 129:
YY_RULE_SETUP
#line 330 "util/configlexer.lex"
-{ YDVAR(1, VAR_DNS64_PREFIX) }
+{ YDVAR(1, VAR_DOMAIN_INSECURE) }
YY_BREAK
case 130:
YY_RULE_SETUP
#line 331 "util/configlexer.lex"
-{ YDVAR(1, VAR_DNS64_SYNTHALL) }
+{ YDVAR(1, VAR_MINIMAL_RESPONSES) }
YY_BREAK
case 131:
YY_RULE_SETUP
#line 332 "util/configlexer.lex"
-{ YDVAR(0, VAR_DNSTAP) }
+{ YDVAR(1, VAR_RRSET_ROUNDROBIN) }
YY_BREAK
case 132:
YY_RULE_SETUP
#line 333 "util/configlexer.lex"
-{ YDVAR(1, VAR_DNSTAP_ENABLE) }
+{ YDVAR(1, VAR_MAX_UDP_SIZE) }
YY_BREAK
case 133:
YY_RULE_SETUP
#line 334 "util/configlexer.lex"
-{ YDVAR(1, VAR_DNSTAP_SOCKET_PATH) }
+{ YDVAR(1, VAR_DNS64_PREFIX) }
YY_BREAK
case 134:
YY_RULE_SETUP
#line 335 "util/configlexer.lex"
-{ YDVAR(1, VAR_DNSTAP_SEND_IDENTITY) }
+{ YDVAR(1, VAR_DNS64_SYNTHALL) }
YY_BREAK
case 135:
YY_RULE_SETUP
#line 336 "util/configlexer.lex"
-{ YDVAR(1, VAR_DNSTAP_SEND_VERSION) }
+{ YDVAR(0, VAR_DNSTAP) }
YY_BREAK
case 136:
YY_RULE_SETUP
#line 337 "util/configlexer.lex"
-{ YDVAR(1, VAR_DNSTAP_IDENTITY) }
+{ YDVAR(1, VAR_DNSTAP_ENABLE) }
YY_BREAK
case 137:
YY_RULE_SETUP
#line 338 "util/configlexer.lex"
-{ YDVAR(1, VAR_DNSTAP_VERSION) }
+{ YDVAR(1, VAR_DNSTAP_SOCKET_PATH) }
YY_BREAK
case 138:
YY_RULE_SETUP
#line 339 "util/configlexer.lex"
-{
- YDVAR(1, VAR_DNSTAP_LOG_RESOLVER_QUERY_MESSAGES) }
+{ YDVAR(1, VAR_DNSTAP_SEND_IDENTITY) }
YY_BREAK
case 139:
YY_RULE_SETUP
+#line 340 "util/configlexer.lex"
+{ YDVAR(1, VAR_DNSTAP_SEND_VERSION) }
+ YY_BREAK
+case 140:
+YY_RULE_SETUP
#line 341 "util/configlexer.lex"
+{ YDVAR(1, VAR_DNSTAP_IDENTITY) }
+ YY_BREAK
+case 141:
+YY_RULE_SETUP
+#line 342 "util/configlexer.lex"
+{ YDVAR(1, VAR_DNSTAP_VERSION) }
+ YY_BREAK
+case 142:
+YY_RULE_SETUP
+#line 343 "util/configlexer.lex"
+{
+ YDVAR(1, VAR_DNSTAP_LOG_RESOLVER_QUERY_MESSAGES) }
+ YY_BREAK
+case 143:
+YY_RULE_SETUP
+#line 345 "util/configlexer.lex"
{
YDVAR(1, VAR_DNSTAP_LOG_RESOLVER_RESPONSE_MESSAGES) }
YY_BREAK
-case 140:
+case 144:
YY_RULE_SETUP
-#line 343 "util/configlexer.lex"
+#line 347 "util/configlexer.lex"
{
YDVAR(1, VAR_DNSTAP_LOG_CLIENT_QUERY_MESSAGES) }
YY_BREAK
-case 141:
+case 145:
YY_RULE_SETUP
-#line 345 "util/configlexer.lex"
+#line 349 "util/configlexer.lex"
{
YDVAR(1, VAR_DNSTAP_LOG_CLIENT_RESPONSE_MESSAGES) }
YY_BREAK
-case 142:
+case 146:
YY_RULE_SETUP
-#line 347 "util/configlexer.lex"
+#line 351 "util/configlexer.lex"
{
YDVAR(1, VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES) }
YY_BREAK
-case 143:
+case 147:
YY_RULE_SETUP
-#line 349 "util/configlexer.lex"
+#line 353 "util/configlexer.lex"
{
YDVAR(1, VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES) }
YY_BREAK
-case 144:
-/* rule 144 can match eol */
+case 148:
YY_RULE_SETUP
-#line 351 "util/configlexer.lex"
+#line 355 "util/configlexer.lex"
+{ YDVAR(1, VAR_RATELIMIT) }
+ YY_BREAK
+case 149:
+YY_RULE_SETUP
+#line 356 "util/configlexer.lex"
+{ YDVAR(1, VAR_RATELIMIT_SLABS) }
+ YY_BREAK
+case 150:
+YY_RULE_SETUP
+#line 357 "util/configlexer.lex"
+{ YDVAR(1, VAR_RATELIMIT_SIZE) }
+ YY_BREAK
+case 151:
+YY_RULE_SETUP
+#line 358 "util/configlexer.lex"
+{ YDVAR(2, VAR_RATELIMIT_FOR_DOMAIN) }
+ YY_BREAK
+case 152:
+YY_RULE_SETUP
+#line 359 "util/configlexer.lex"
+{ YDVAR(2, VAR_RATELIMIT_BELOW_DOMAIN) }
+ YY_BREAK
+case 153:
+YY_RULE_SETUP
+#line 360 "util/configlexer.lex"
+{ YDVAR(1, VAR_RATELIMIT_FACTOR) }
+ YY_BREAK
+case 154:
+/* rule 154 can match eol */
+YY_RULE_SETUP
+#line 361 "util/configlexer.lex"
{ LEXOUT(("NL\n")); cfg_parser->line++; }
YY_BREAK
/* Quoted strings. Strip leading and ending quotes */
-case 145:
+case 155:
YY_RULE_SETUP
-#line 354 "util/configlexer.lex"
+#line 364 "util/configlexer.lex"
{ BEGIN(quotedstring); LEXOUT(("QS ")); }
YY_BREAK
case YY_STATE_EOF(quotedstring):
-#line 355 "util/configlexer.lex"
+#line 365 "util/configlexer.lex"
{
yyerror("EOF inside quoted string");
if(--num_args == 0) { BEGIN(INITIAL); }
else { BEGIN(val); }
}
YY_BREAK
-case 146:
+case 156:
YY_RULE_SETUP
-#line 360 "util/configlexer.lex"
+#line 370 "util/configlexer.lex"
{ LEXOUT(("STR(%s) ", yytext)); yymore(); }
YY_BREAK
-case 147:
-/* rule 147 can match eol */
+case 157:
+/* rule 157 can match eol */
YY_RULE_SETUP
-#line 361 "util/configlexer.lex"
+#line 371 "util/configlexer.lex"
{ yyerror("newline inside quoted string, no end \"");
cfg_parser->line++; BEGIN(INITIAL); }
YY_BREAK
-case 148:
+case 158:
YY_RULE_SETUP
-#line 363 "util/configlexer.lex"
+#line 373 "util/configlexer.lex"
{
LEXOUT(("QE "));
if(--num_args == 0) { BEGIN(INITIAL); }
}
YY_BREAK
/* Single Quoted strings. Strip leading and ending quotes */
-case 149:
+case 159:
YY_RULE_SETUP
-#line 375 "util/configlexer.lex"
+#line 385 "util/configlexer.lex"
{ BEGIN(singlequotedstr); LEXOUT(("SQS ")); }
YY_BREAK
case YY_STATE_EOF(singlequotedstr):
-#line 376 "util/configlexer.lex"
+#line 386 "util/configlexer.lex"
{
yyerror("EOF inside quoted string");
if(--num_args == 0) { BEGIN(INITIAL); }
else { BEGIN(val); }
}
YY_BREAK
-case 150:
+case 160:
YY_RULE_SETUP
-#line 381 "util/configlexer.lex"
+#line 391 "util/configlexer.lex"
{ LEXOUT(("STR(%s) ", yytext)); yymore(); }
YY_BREAK
-case 151:
-/* rule 151 can match eol */
+case 161:
+/* rule 161 can match eol */
YY_RULE_SETUP
-#line 382 "util/configlexer.lex"
+#line 392 "util/configlexer.lex"
{ yyerror("newline inside quoted string, no end '");
cfg_parser->line++; BEGIN(INITIAL); }
YY_BREAK
-case 152:
+case 162:
YY_RULE_SETUP
-#line 384 "util/configlexer.lex"
+#line 394 "util/configlexer.lex"
{
LEXOUT(("SQE "));
if(--num_args == 0) { BEGIN(INITIAL); }
}
YY_BREAK
/* include: directive */
-case 153:
+case 163:
YY_RULE_SETUP
-#line 396 "util/configlexer.lex"
+#line 406 "util/configlexer.lex"
{
LEXOUT(("v(%s) ", yytext)); inc_prev = YYSTATE; BEGIN(include); }
YY_BREAK
case YY_STATE_EOF(include):
-#line 398 "util/configlexer.lex"
+#line 408 "util/configlexer.lex"
{
yyerror("EOF inside include directive");
BEGIN(inc_prev);
}
YY_BREAK
-case 154:
+case 164:
YY_RULE_SETUP
-#line 402 "util/configlexer.lex"
+#line 412 "util/configlexer.lex"
{ LEXOUT(("ISP ")); /* ignore */ }
YY_BREAK
-case 155:
-/* rule 155 can match eol */
+case 165:
+/* rule 165 can match eol */
YY_RULE_SETUP
-#line 403 "util/configlexer.lex"
+#line 413 "util/configlexer.lex"
{ LEXOUT(("NL\n")); cfg_parser->line++;}
YY_BREAK
-case 156:
+case 166:
YY_RULE_SETUP
-#line 404 "util/configlexer.lex"
+#line 414 "util/configlexer.lex"
{ LEXOUT(("IQS ")); BEGIN(include_quoted); }
YY_BREAK
-case 157:
+case 167:
YY_RULE_SETUP
-#line 405 "util/configlexer.lex"
+#line 415 "util/configlexer.lex"
{
LEXOUT(("Iunquotedstr(%s) ", yytext));
config_start_include_glob(yytext);
}
YY_BREAK
case YY_STATE_EOF(include_quoted):
-#line 410 "util/configlexer.lex"
+#line 420 "util/configlexer.lex"
{
yyerror("EOF inside quoted string");
BEGIN(inc_prev);
}
YY_BREAK
-case 158:
+case 168:
YY_RULE_SETUP
-#line 414 "util/configlexer.lex"
+#line 424 "util/configlexer.lex"
{ LEXOUT(("ISTR(%s) ", yytext)); yymore(); }
YY_BREAK
-case 159:
-/* rule 159 can match eol */
+case 169:
+/* rule 169 can match eol */
YY_RULE_SETUP
-#line 415 "util/configlexer.lex"
+#line 425 "util/configlexer.lex"
{ yyerror("newline before \" in include name");
cfg_parser->line++; BEGIN(inc_prev); }
YY_BREAK
-case 160:
+case 170:
YY_RULE_SETUP
-#line 417 "util/configlexer.lex"
+#line 427 "util/configlexer.lex"
{
LEXOUT(("IQE "));
yytext[yyleng - 1] = '\0';
YY_BREAK
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(val):
-#line 423 "util/configlexer.lex"
+#line 433 "util/configlexer.lex"
{
LEXOUT(("LEXEOF "));
yy_set_bol(1); /* Set beginning of line, so "^" rules match. */
}
}
YY_BREAK
-case 161:
+case 171:
YY_RULE_SETUP
-#line 434 "util/configlexer.lex"
+#line 444 "util/configlexer.lex"
{ LEXOUT(("unquotedstr(%s) ", yytext));
if(--num_args == 0) { BEGIN(INITIAL); }
yylval.str = strdup(yytext); return STRING_ARG; }
YY_BREAK
-case 162:
+case 172:
YY_RULE_SETUP
-#line 438 "util/configlexer.lex"
+#line 448 "util/configlexer.lex"
{
ub_c_error_msg("unknown keyword '%s'", yytext);
}
YY_BREAK
-case 163:
+case 173:
YY_RULE_SETUP
-#line 442 "util/configlexer.lex"
+#line 452 "util/configlexer.lex"
{
ub_c_error_msg("stray '%s'", yytext);
}
YY_BREAK
-case 164:
+case 174:
YY_RULE_SETUP
-#line 446 "util/configlexer.lex"
+#line 456 "util/configlexer.lex"
ECHO;
YY_BREAK
-#line 3415 "<stdout>"
+#line 3570 "<stdout>"
case YY_END_OF_BUFFER:
{
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 1628 )
+ if ( yy_current_state >= 1731 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 1628 )
+ if ( yy_current_state >= 1731 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 1627);
+ yy_is_jam = (yy_current_state == 1730);
return yy_is_jam ? 0 : yy_current_state;
}
#define YYTABLES_NAME "yytables"
-#line 446 "util/configlexer.lex"
+#line 456 "util/configlexer.lex"
so-rcvbuf{COLON} { YDVAR(1, VAR_SO_RCVBUF) }
so-sndbuf{COLON} { YDVAR(1, VAR_SO_SNDBUF) }
so-reuseport{COLON} { YDVAR(1, VAR_SO_REUSEPORT) }
+ip-transparent{COLON} { YDVAR(1, VAR_IP_TRANSPARENT) }
chroot{COLON} { YDVAR(1, VAR_CHROOT) }
username{COLON} { YDVAR(1, VAR_USERNAME) }
directory{COLON} { YDVAR(1, VAR_DIRECTORY) }
rrset-cache-size{COLON} { YDVAR(1, VAR_RRSET_CACHE_SIZE) }
rrset-cache-slabs{COLON} { YDVAR(1, VAR_RRSET_CACHE_SLABS) }
cache-max-ttl{COLON} { YDVAR(1, VAR_CACHE_MAX_TTL) }
+cache-max-negative-ttl{COLON} { YDVAR(1, VAR_CACHE_MAX_NEGATIVE_TTL) }
cache-min-ttl{COLON} { YDVAR(1, VAR_CACHE_MIN_TTL) }
infra-host-ttl{COLON} { YDVAR(1, VAR_INFRA_HOST_TTL) }
infra-lame-ttl{COLON} { YDVAR(1, VAR_INFRA_LAME_TTL) }
harden-dnssec-stripped{COLON} { YDVAR(1, VAR_HARDEN_DNSSEC_STRIPPED) }
harden-below-nxdomain{COLON} { YDVAR(1, VAR_HARDEN_BELOW_NXDOMAIN) }
harden-referral-path{COLON} { YDVAR(1, VAR_HARDEN_REFERRAL_PATH) }
+harden-algo-downgrade{COLON} { YDVAR(1, VAR_HARDEN_ALGO_DOWNGRADE) }
use-caps-for-id{COLON} { YDVAR(1, VAR_USE_CAPS_FOR_ID) }
+caps-whitelist{COLON} { YDVAR(1, VAR_CAPS_WHITELIST) }
unwanted-reply-threshold{COLON} { YDVAR(1, VAR_UNWANTED_REPLY_THRESHOLD) }
private-address{COLON} { YDVAR(1, VAR_PRIVATE_ADDRESS) }
private-domain{COLON} { YDVAR(1, VAR_PRIVATE_DOMAIN) }
YDVAR(1, VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES) }
dnstap-log-forwarder-response-messages{COLON} {
YDVAR(1, VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES) }
+ratelimit{COLON} { YDVAR(1, VAR_RATELIMIT) }
+ratelimit-slabs{COLON} { YDVAR(1, VAR_RATELIMIT_SLABS) }
+ratelimit-size{COLON} { YDVAR(1, VAR_RATELIMIT_SIZE) }
+ratelimit-for-domain{COLON} { YDVAR(2, VAR_RATELIMIT_FOR_DOMAIN) }
+ratelimit-below-domain{COLON} { YDVAR(2, VAR_RATELIMIT_BELOW_DOMAIN) }
+ratelimit-factor{COLON} { YDVAR(1, VAR_RATELIMIT_FACTOR) }
<INITIAL,val>{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++; }
/* Quoted strings. Strip leading and ending quotes */
VAR_DNSTAP_LOG_CLIENT_QUERY_MESSAGES = 402,
VAR_DNSTAP_LOG_CLIENT_RESPONSE_MESSAGES = 403,
VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES = 404,
- VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES = 405
+ VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES = 405,
+ VAR_HARDEN_ALGO_DOWNGRADE = 406,
+ VAR_IP_TRANSPARENT = 407,
+ VAR_RATELIMIT = 408,
+ VAR_RATELIMIT_SLABS = 409,
+ VAR_RATELIMIT_SIZE = 410,
+ VAR_RATELIMIT_FOR_DOMAIN = 411,
+ VAR_RATELIMIT_BELOW_DOMAIN = 412,
+ VAR_RATELIMIT_FACTOR = 413,
+ VAR_CAPS_WHITELIST = 414,
+ VAR_CACHE_MAX_NEGATIVE_TTL = 415
};
#endif
/* Tokens. */
#define VAR_DNSTAP_LOG_CLIENT_RESPONSE_MESSAGES 403
#define VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES 404
#define VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES 405
+#define VAR_HARDEN_ALGO_DOWNGRADE 406
+#define VAR_IP_TRANSPARENT 407
+#define VAR_RATELIMIT 408
+#define VAR_RATELIMIT_SLABS 409
+#define VAR_RATELIMIT_SIZE 410
+#define VAR_RATELIMIT_FOR_DOMAIN 411
+#define VAR_RATELIMIT_BELOW_DOMAIN 412
+#define VAR_RATELIMIT_FACTOR 413
+#define VAR_CAPS_WHITELIST 414
+#define VAR_CACHE_MAX_NEGATIVE_TTL 415
/* Line 387 of yacc.c */
-#line 443 "util/configparser.c"
+#line 463 "util/configparser.c"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
/* Copy the second part of user declarations. */
/* Line 390 of yacc.c */
-#line 471 "util/configparser.c"
+#line 491 "util/configparser.c"
#ifdef short
# undef short
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 280
+#define YYLAST 301
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 151
+#define YYNTOKENS 161
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 156
+#define YYNNTS 166
/* YYNRULES -- Number of rules. */
-#define YYNRULES 297
+#define YYNRULES 317
/* YYNRULES -- Number of states. */
-#define YYNSTATES 435
+#define YYNSTATES 467
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 405
+#define YYMAXUTOK 415
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
- 145, 146, 147, 148, 149, 150
+ 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
+ 155, 156, 157, 158, 159, 160
};
#if YYDEBUG
185, 187, 189, 191, 193, 195, 197, 199, 201, 203,
205, 207, 209, 211, 213, 215, 217, 219, 221, 223,
225, 227, 229, 231, 233, 235, 237, 239, 241, 243,
- 246, 247, 249, 251, 253, 255, 257, 259, 262, 263,
- 265, 267, 269, 271, 274, 277, 280, 283, 286, 289,
- 292, 295, 298, 301, 304, 307, 310, 313, 316, 319,
- 322, 325, 328, 331, 334, 337, 340, 343, 346, 349,
- 352, 355, 358, 361, 364, 367, 370, 373, 376, 379,
- 382, 385, 388, 391, 394, 397, 400, 403, 406, 409,
- 412, 415, 418, 421, 424, 427, 430, 433, 436, 439,
- 442, 445, 448, 451, 454, 457, 460, 463, 466, 469,
- 472, 475, 478, 481, 484, 487, 490, 493, 496, 499,
- 502, 505, 509, 512, 515, 518, 521, 524, 527, 530,
- 533, 536, 539, 542, 545, 548, 551, 554, 557, 560,
- 563, 567, 570, 573, 576, 579, 582, 585, 588, 591,
- 594, 597, 600, 603, 606, 609, 612, 615, 617, 620,
- 621, 623, 625, 627, 629, 631, 633, 635, 637, 640,
- 643, 646, 649, 652, 655, 658, 661, 663, 666, 667,
- 669, 671, 673, 675, 677, 679, 681, 683, 685, 687,
- 689, 691, 694, 697, 700, 703, 706, 709, 712, 715,
- 718, 721, 724, 727, 729, 732, 733, 735
+ 245, 247, 249, 251, 253, 255, 257, 259, 261, 263,
+ 266, 267, 269, 271, 273, 275, 277, 279, 282, 283,
+ 285, 287, 289, 291, 294, 297, 300, 303, 306, 309,
+ 312, 315, 318, 321, 324, 327, 330, 333, 336, 339,
+ 342, 345, 348, 351, 354, 357, 360, 363, 366, 369,
+ 372, 375, 378, 381, 384, 387, 390, 393, 396, 399,
+ 402, 405, 408, 411, 414, 417, 420, 423, 426, 429,
+ 432, 435, 438, 441, 444, 447, 450, 453, 456, 459,
+ 462, 465, 468, 471, 474, 477, 480, 483, 486, 489,
+ 492, 495, 498, 501, 504, 507, 510, 513, 516, 519,
+ 522, 525, 528, 531, 534, 538, 541, 544, 547, 550,
+ 553, 556, 559, 562, 565, 568, 571, 574, 577, 580,
+ 583, 586, 589, 592, 595, 599, 602, 605, 608, 611,
+ 614, 617, 620, 623, 626, 629, 633, 637, 640, 643,
+ 646, 649, 652, 655, 658, 661, 664, 667, 669, 672,
+ 673, 675, 677, 679, 681, 683, 685, 687, 689, 692,
+ 695, 698, 701, 704, 707, 710, 713, 715, 718, 719,
+ 721, 723, 725, 727, 729, 731, 733, 735, 737, 739,
+ 741, 743, 746, 749, 752, 755, 758, 761, 764, 767,
+ 770, 773, 776, 779, 781, 784, 785, 787
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int16 yyrhs[] =
{
- 152, 0, -1, -1, 152, 153, -1, 154, 155, -1,
- 157, 158, -1, 160, 161, -1, 303, 304, -1, 277,
- 278, -1, 288, 289, -1, 11, -1, 155, 156, -1,
- -1, 163, -1, 164, -1, 168, -1, 171, -1, 177,
- -1, 178, -1, 179, -1, 180, -1, 169, -1, 190,
- -1, 191, -1, 192, -1, 193, -1, 194, -1, 212,
- -1, 213, -1, 214, -1, 218, -1, 219, -1, 174,
- -1, 220, -1, 221, -1, 224, -1, 222, -1, 223,
- -1, 226, -1, 227, -1, 228, -1, 239, -1, 203,
- -1, 204, -1, 205, -1, 206, -1, 229, -1, 242,
- -1, 199, -1, 201, -1, 243, -1, 248, -1, 249,
- -1, 250, -1, 175, -1, 211, -1, 257, -1, 258,
- -1, 200, -1, 253, -1, 187, -1, 170, -1, 195,
- -1, 240, -1, 246, -1, 230, -1, 241, -1, 260,
- -1, 261, -1, 176, -1, 165, -1, 186, -1, 233,
- -1, 166, -1, 172, -1, 173, -1, 196, -1, 197,
- -1, 259, -1, 232, -1, 234, -1, 235, -1, 167,
- -1, 262, -1, 215, -1, 238, -1, 188, -1, 202,
- -1, 244, -1, 245, -1, 247, -1, 252, -1, 198,
- -1, 254, -1, 255, -1, 256, -1, 207, -1, 210,
- -1, 236, -1, 237, -1, 208, -1, 231, -1, 251,
- -1, 189, -1, 181, -1, 182, -1, 183, -1, 184,
- -1, 185, -1, 263, -1, 264, -1, 265, -1, 209,
- -1, 216, -1, 217, -1, 266, -1, 267, -1, 225,
- -1, 38, -1, 158, 159, -1, -1, 268, -1, 269,
- -1, 270, -1, 272, -1, 271, -1, 44, -1, 161,
- 162, -1, -1, 273, -1, 274, -1, 275, -1, 276,
+ 162, 0, -1, -1, 162, 163, -1, 164, 165, -1,
+ 167, 168, -1, 170, 171, -1, 323, 324, -1, 297,
+ 298, -1, 308, 309, -1, 11, -1, 165, 166, -1,
+ -1, 173, -1, 174, -1, 178, -1, 181, -1, 187,
+ -1, 188, -1, 189, -1, 190, -1, 179, -1, 200,
+ -1, 201, -1, 202, -1, 203, -1, 204, -1, 223,
+ -1, 224, -1, 225, -1, 229, -1, 230, -1, 184,
+ -1, 231, -1, 232, -1, 235, -1, 233, -1, 234,
+ -1, 237, -1, 238, -1, 239, -1, 252, -1, 213,
+ -1, 214, -1, 215, -1, 216, -1, 240, -1, 255,
+ -1, 209, -1, 211, -1, 256, -1, 262, -1, 263,
+ -1, 264, -1, 185, -1, 222, -1, 271, -1, 272,
+ -1, 210, -1, 267, -1, 197, -1, 180, -1, 205,
+ -1, 253, -1, 259, -1, 241, -1, 254, -1, 274,
+ -1, 275, -1, 186, -1, 175, -1, 196, -1, 245,
+ -1, 176, -1, 182, -1, 183, -1, 206, -1, 207,
+ -1, 273, -1, 243, -1, 247, -1, 248, -1, 177,
+ -1, 276, -1, 226, -1, 251, -1, 198, -1, 212,
+ -1, 257, -1, 258, -1, 261, -1, 266, -1, 208,
+ -1, 268, -1, 269, -1, 270, -1, 217, -1, 221,
+ -1, 249, -1, 250, -1, 218, -1, 242, -1, 265,
+ -1, 199, -1, 191, -1, 192, -1, 193, -1, 194,
+ -1, 195, -1, 277, -1, 278, -1, 279, -1, 219,
+ -1, 227, -1, 228, -1, 280, -1, 281, -1, 236,
+ -1, 244, -1, 220, -1, 282, -1, 284, -1, 283,
+ -1, 285, -1, 286, -1, 287, -1, 246, -1, 260,
+ -1, 38, -1, 168, 169, -1, -1, 288, -1, 289,
+ -1, 290, -1, 292, -1, 291, -1, 44, -1, 171,
+ 172, -1, -1, 293, -1, 294, -1, 295, -1, 296,
-1, 13, 10, -1, 12, 10, -1, 76, 10, -1,
79, 10, -1, 97, 10, -1, 14, 10, -1, 16,
10, -1, 67, 10, -1, 15, 10, -1, 80, 10,
10, -1, 64, 10, -1, 55, 10, -1, 103, 10,
-1, 48, 10, -1, 49, 10, -1, 50, 10, -1,
51, 10, -1, 114, 10, -1, 118, 10, -1, 119,
- 10, -1, 115, 10, -1, 61, 10, -1, 26, 10,
- -1, 27, 10, -1, 28, 10, -1, 99, 10, -1,
- 133, 10, -1, 134, 10, -1, 29, 10, -1, 30,
- 10, -1, 32, 10, -1, 33, 10, -1, 35, 10,
- -1, 36, 10, -1, 34, 10, -1, 135, 10, -1,
- 41, 10, -1, 42, 10, -1, 43, 10, -1, 52,
- 10, -1, 71, 10, -1, 120, 10, -1, 85, 10,
- -1, 78, 10, -1, 86, 10, -1, 87, 10, -1,
- 116, 10, -1, 117, 10, -1, 101, 10, -1, 47,
- 10, -1, 69, 10, -1, 72, 10, 10, -1, 53,
- 10, -1, 56, 10, -1, 106, 10, -1, 107, 10,
- -1, 70, 10, -1, 108, 10, -1, 57, 10, -1,
- 58, 10, -1, 59, 10, -1, 121, 10, -1, 109,
- 10, -1, 65, 10, -1, 112, 10, -1, 113, 10,
- -1, 111, 10, -1, 62, 10, -1, 63, 10, -1,
- 84, 10, -1, 73, 10, 10, -1, 74, 10, -1,
- 98, 10, -1, 130, 10, -1, 131, 10, -1, 132,
- 10, -1, 136, 10, -1, 137, 10, -1, 37, 10,
- -1, 39, 10, -1, 40, 10, -1, 129, 10, -1,
- 100, 10, -1, 37, 10, -1, 45, 10, -1, 46,
- 10, -1, 128, 10, -1, 88, -1, 278, 279, -1,
- -1, 280, -1, 282, -1, 281, -1, 284, -1, 285,
- -1, 286, -1, 287, -1, 283, -1, 89, 10, -1,
- 91, 10, -1, 90, 10, -1, 96, 10, -1, 92,
- 10, -1, 93, 10, -1, 94, 10, -1, 95, 10,
- -1, 138, -1, 289, 290, -1, -1, 291, -1, 292,
- -1, 293, -1, 294, -1, 295, -1, 296, -1, 297,
- -1, 298, -1, 299, -1, 300, -1, 301, -1, 302,
- -1, 139, 10, -1, 140, 10, -1, 141, 10, -1,
- 142, 10, -1, 143, 10, -1, 144, 10, -1, 145,
- 10, -1, 146, 10, -1, 147, 10, -1, 148, 10,
- -1, 149, 10, -1, 150, 10, -1, 104, -1, 304,
- 305, -1, -1, 306, -1, 105, 10, -1
+ 10, -1, 152, 10, -1, 115, 10, -1, 61, 10,
+ -1, 26, 10, -1, 27, 10, -1, 28, 10, -1,
+ 99, 10, -1, 133, 10, -1, 134, 10, -1, 29,
+ 10, -1, 30, 10, -1, 32, 10, -1, 33, 10,
+ -1, 35, 10, -1, 36, 10, -1, 34, 10, -1,
+ 135, 10, -1, 41, 10, -1, 42, 10, -1, 43,
+ 10, -1, 52, 10, -1, 71, 10, -1, 120, 10,
+ -1, 85, 10, -1, 151, 10, -1, 78, 10, -1,
+ 159, 10, -1, 86, 10, -1, 87, 10, -1, 116,
+ 10, -1, 117, 10, -1, 101, 10, -1, 47, 10,
+ -1, 69, 10, -1, 72, 10, 10, -1, 53, 10,
+ -1, 56, 10, -1, 106, 10, -1, 107, 10, -1,
+ 70, 10, -1, 160, 10, -1, 108, 10, -1, 57,
+ 10, -1, 58, 10, -1, 59, 10, -1, 121, 10,
+ -1, 109, 10, -1, 65, 10, -1, 112, 10, -1,
+ 113, 10, -1, 111, 10, -1, 62, 10, -1, 63,
+ 10, -1, 84, 10, -1, 73, 10, 10, -1, 74,
+ 10, -1, 98, 10, -1, 130, 10, -1, 131, 10,
+ -1, 132, 10, -1, 136, 10, -1, 137, 10, -1,
+ 153, 10, -1, 155, 10, -1, 154, 10, -1, 156,
+ 10, 10, -1, 157, 10, 10, -1, 158, 10, -1,
+ 37, 10, -1, 39, 10, -1, 40, 10, -1, 129,
+ 10, -1, 100, 10, -1, 37, 10, -1, 45, 10,
+ -1, 46, 10, -1, 128, 10, -1, 88, -1, 298,
+ 299, -1, -1, 300, -1, 302, -1, 301, -1, 304,
+ -1, 305, -1, 306, -1, 307, -1, 303, -1, 89,
+ 10, -1, 91, 10, -1, 90, 10, -1, 96, 10,
+ -1, 92, 10, -1, 93, 10, -1, 94, 10, -1,
+ 95, 10, -1, 138, -1, 309, 310, -1, -1, 311,
+ -1, 312, -1, 313, -1, 314, -1, 315, -1, 316,
+ -1, 317, -1, 318, -1, 319, -1, 320, -1, 321,
+ -1, 322, -1, 139, 10, -1, 140, 10, -1, 141,
+ 10, -1, 142, 10, -1, 143, 10, -1, 144, 10,
+ -1, 145, 10, -1, 146, 10, -1, 147, 10, -1,
+ 148, 10, -1, 149, 10, -1, 150, 10, -1, 104,
+ -1, 324, 325, -1, -1, 326, -1, 105, 10, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 123, 123, 123, 124, 124, 125, 125, 126, 126,
- 130, 135, 136, 137, 137, 137, 138, 138, 139, 139,
- 139, 140, 140, 140, 141, 141, 141, 142, 142, 143,
- 143, 144, 144, 145, 145, 146, 146, 147, 147, 148,
- 148, 149, 149, 150, 150, 150, 151, 151, 151, 152,
- 152, 152, 153, 153, 154, 154, 155, 155, 156, 156,
- 157, 157, 157, 158, 158, 159, 159, 160, 160, 160,
- 161, 161, 162, 162, 163, 163, 164, 164, 164, 165,
- 165, 166, 166, 167, 167, 168, 168, 169, 169, 170,
- 170, 170, 171, 171, 172, 172, 172, 173, 173, 173,
- 174, 174, 174, 175, 175, 175, 176, 176, 176, 177,
- 177, 177, 178, 178, 178, 179, 179, 180, 182, 194,
- 195, 196, 196, 196, 196, 196, 198, 210, 211, 212,
- 212, 212, 212, 214, 223, 232, 243, 252, 261, 270,
- 283, 298, 307, 316, 325, 334, 343, 352, 361, 370,
- 379, 388, 397, 406, 413, 420, 429, 438, 452, 461,
- 470, 477, 484, 491, 499, 506, 513, 520, 527, 535,
- 543, 551, 558, 565, 574, 583, 590, 597, 605, 613,
- 623, 636, 647, 655, 668, 677, 686, 695, 705, 713,
- 726, 735, 743, 752, 760, 773, 782, 789, 799, 809,
- 819, 829, 839, 849, 859, 866, 873, 882, 891, 900,
- 907, 917, 934, 941, 959, 972, 985, 994, 1003, 1012,
- 1022, 1032, 1041, 1050, 1057, 1066, 1075, 1084, 1092, 1105,
- 1113, 1136, 1143, 1158, 1168, 1178, 1185, 1192, 1201, 1211,
- 1218, 1225, 1234, 1244, 1254, 1261, 1268, 1277, 1282, 1283,
- 1284, 1284, 1284, 1285, 1285, 1285, 1286, 1286, 1288, 1298,
- 1307, 1314, 1324, 1331, 1338, 1345, 1352, 1357, 1358, 1359,
- 1359, 1360, 1360, 1361, 1361, 1362, 1363, 1364, 1365, 1366,
- 1367, 1369, 1377, 1384, 1392, 1400, 1407, 1414, 1423, 1432,
- 1441, 1450, 1459, 1468, 1473, 1474, 1475, 1477
+ 0, 127, 127, 127, 128, 128, 129, 129, 130, 130,
+ 134, 139, 140, 141, 141, 141, 142, 142, 143, 143,
+ 143, 144, 144, 144, 145, 145, 145, 146, 146, 147,
+ 147, 148, 148, 149, 149, 150, 150, 151, 151, 152,
+ 152, 153, 153, 154, 154, 154, 155, 155, 155, 156,
+ 156, 156, 157, 157, 158, 158, 159, 159, 160, 160,
+ 161, 161, 161, 162, 162, 163, 163, 164, 164, 164,
+ 165, 165, 166, 166, 167, 167, 168, 168, 168, 169,
+ 169, 170, 170, 171, 171, 172, 172, 173, 173, 174,
+ 174, 174, 175, 175, 176, 176, 176, 177, 177, 177,
+ 178, 178, 178, 179, 179, 179, 180, 180, 180, 181,
+ 181, 181, 182, 182, 182, 183, 183, 184, 184, 185,
+ 185, 185, 186, 186, 187, 187, 188, 188, 190, 202,
+ 203, 204, 204, 204, 204, 204, 206, 218, 219, 220,
+ 220, 220, 220, 222, 231, 240, 251, 260, 269, 278,
+ 291, 306, 315, 324, 333, 342, 351, 360, 369, 378,
+ 387, 396, 405, 414, 421, 428, 437, 446, 460, 469,
+ 478, 485, 492, 499, 507, 514, 521, 528, 535, 543,
+ 551, 559, 566, 573, 582, 591, 598, 605, 613, 621,
+ 631, 641, 654, 665, 673, 686, 695, 704, 713, 723,
+ 731, 744, 753, 761, 770, 778, 791, 800, 807, 817,
+ 827, 837, 847, 857, 867, 877, 887, 894, 901, 908,
+ 917, 926, 935, 942, 952, 969, 976, 994, 1007, 1020,
+ 1029, 1038, 1047, 1056, 1066, 1076, 1085, 1094, 1101, 1110,
+ 1119, 1128, 1136, 1149, 1157, 1181, 1188, 1203, 1213, 1223,
+ 1230, 1237, 1246, 1255, 1263, 1276, 1289, 1302, 1311, 1321,
+ 1328, 1335, 1344, 1354, 1364, 1371, 1378, 1387, 1392, 1393,
+ 1394, 1394, 1394, 1395, 1395, 1395, 1396, 1396, 1398, 1408,
+ 1417, 1424, 1434, 1441, 1448, 1455, 1462, 1467, 1468, 1469,
+ 1469, 1470, 1470, 1471, 1471, 1472, 1473, 1474, 1475, 1476,
+ 1477, 1479, 1487, 1494, 1502, 1510, 1517, 1524, 1533, 1542,
+ 1551, 1560, 1569, 1578, 1583, 1584, 1585, 1587
};
#endif
"VAR_DNSTAP_LOG_CLIENT_QUERY_MESSAGES",
"VAR_DNSTAP_LOG_CLIENT_RESPONSE_MESSAGES",
"VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES",
- "VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES", "$accept", "toplevelvars",
- "toplevelvar", "serverstart", "contents_server", "content_server",
- "stubstart", "contents_stub", "content_stub", "forwardstart",
- "contents_forward", "content_forward", "server_num_threads",
- "server_verbosity", "server_statistics_interval",
+ "VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES",
+ "VAR_HARDEN_ALGO_DOWNGRADE", "VAR_IP_TRANSPARENT", "VAR_RATELIMIT",
+ "VAR_RATELIMIT_SLABS", "VAR_RATELIMIT_SIZE", "VAR_RATELIMIT_FOR_DOMAIN",
+ "VAR_RATELIMIT_BELOW_DOMAIN", "VAR_RATELIMIT_FACTOR",
+ "VAR_CAPS_WHITELIST", "VAR_CACHE_MAX_NEGATIVE_TTL", "$accept",
+ "toplevelvars", "toplevelvar", "serverstart", "contents_server",
+ "content_server", "stubstart", "contents_stub", "content_stub",
+ "forwardstart", "contents_forward", "content_forward",
+ "server_num_threads", "server_verbosity", "server_statistics_interval",
"server_statistics_cumulative", "server_extended_statistics",
"server_port", "server_interface", "server_outgoing_interface",
"server_outgoing_range", "server_outgoing_port_permit",
"server_trust_anchor", "server_domain_insecure", "server_hide_identity",
"server_hide_version", "server_identity", "server_version",
"server_so_rcvbuf", "server_so_sndbuf", "server_so_reuseport",
- "server_edns_buffer_size", "server_msg_buffer_size",
- "server_msg_cache_size", "server_msg_cache_slabs",
- "server_num_queries_per_thread", "server_jostle_timeout",
- "server_delay_close", "server_unblock_lan_zones",
- "server_rrset_cache_size", "server_rrset_cache_slabs",
- "server_infra_host_ttl", "server_infra_lame_ttl",
- "server_infra_cache_numhosts", "server_infra_cache_lame_size",
- "server_infra_cache_slabs", "server_infra_cache_min_rtt",
- "server_target_fetch_policy", "server_harden_short_bufsize",
- "server_harden_large_queries", "server_harden_glue",
- "server_harden_dnssec_stripped", "server_harden_below_nxdomain",
- "server_harden_referral_path", "server_use_caps_for_id",
- "server_private_address", "server_private_domain", "server_prefetch",
- "server_prefetch_key", "server_unwanted_reply_threshold",
- "server_do_not_query_address", "server_do_not_query_localhost",
- "server_access_control", "server_module_conf",
- "server_val_override_date", "server_val_sig_skew_min",
- "server_val_sig_skew_max", "server_cache_max_ttl",
+ "server_ip_transparent", "server_edns_buffer_size",
+ "server_msg_buffer_size", "server_msg_cache_size",
+ "server_msg_cache_slabs", "server_num_queries_per_thread",
+ "server_jostle_timeout", "server_delay_close",
+ "server_unblock_lan_zones", "server_rrset_cache_size",
+ "server_rrset_cache_slabs", "server_infra_host_ttl",
+ "server_infra_lame_ttl", "server_infra_cache_numhosts",
+ "server_infra_cache_lame_size", "server_infra_cache_slabs",
+ "server_infra_cache_min_rtt", "server_target_fetch_policy",
+ "server_harden_short_bufsize", "server_harden_large_queries",
+ "server_harden_glue", "server_harden_dnssec_stripped",
+ "server_harden_below_nxdomain", "server_harden_referral_path",
+ "server_harden_algo_downgrade", "server_use_caps_for_id",
+ "server_caps_whitelist", "server_private_address",
+ "server_private_domain", "server_prefetch", "server_prefetch_key",
+ "server_unwanted_reply_threshold", "server_do_not_query_address",
+ "server_do_not_query_localhost", "server_access_control",
+ "server_module_conf", "server_val_override_date",
+ "server_val_sig_skew_min", "server_val_sig_skew_max",
+ "server_cache_max_ttl", "server_cache_max_negative_ttl",
"server_cache_min_ttl", "server_bogus_ttl",
"server_val_clean_additional", "server_val_permissive_mode",
"server_ignore_cd_flag", "server_val_log_level",
"server_key_cache_slabs", "server_neg_cache_size", "server_local_zone",
"server_local_data", "server_local_data_ptr", "server_minimal_responses",
"server_rrset_roundrobin", "server_max_udp_size", "server_dns64_prefix",
- "server_dns64_synthall", "stub_name", "stub_host", "stub_addr",
- "stub_first", "stub_prime", "forward_name", "forward_host",
- "forward_addr", "forward_first", "rcstart", "contents_rc", "content_rc",
- "rc_control_enable", "rc_control_port", "rc_control_interface",
- "rc_control_use_cert", "rc_server_key_file", "rc_server_cert_file",
- "rc_control_key_file", "rc_control_cert_file", "dtstart", "contents_dt",
- "content_dt", "dt_dnstap_enable", "dt_dnstap_socket_path",
- "dt_dnstap_send_identity", "dt_dnstap_send_version",
- "dt_dnstap_identity", "dt_dnstap_version",
+ "server_dns64_synthall", "server_ratelimit", "server_ratelimit_size",
+ "server_ratelimit_slabs", "server_ratelimit_for_domain",
+ "server_ratelimit_below_domain", "server_ratelimit_factor", "stub_name",
+ "stub_host", "stub_addr", "stub_first", "stub_prime", "forward_name",
+ "forward_host", "forward_addr", "forward_first", "rcstart",
+ "contents_rc", "content_rc", "rc_control_enable", "rc_control_port",
+ "rc_control_interface", "rc_control_use_cert", "rc_server_key_file",
+ "rc_server_cert_file", "rc_control_key_file", "rc_control_cert_file",
+ "dtstart", "contents_dt", "content_dt", "dt_dnstap_enable",
+ "dt_dnstap_socket_path", "dt_dnstap_send_identity",
+ "dt_dnstap_send_version", "dt_dnstap_identity", "dt_dnstap_version",
"dt_dnstap_log_resolver_query_messages",
"dt_dnstap_log_resolver_response_messages",
"dt_dnstap_log_client_query_messages",
375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
- 405
+ 405, 406, 407, 408, 409, 410, 411, 412, 413, 414,
+ 415
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint16 yyr1[] =
{
- 0, 151, 152, 152, 153, 153, 153, 153, 153, 153,
- 154, 155, 155, 156, 156, 156, 156, 156, 156, 156,
- 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
- 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
- 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
- 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
- 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
- 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
- 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
- 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
- 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
- 156, 156, 156, 156, 156, 156, 156, 156, 157, 158,
- 158, 159, 159, 159, 159, 159, 160, 161, 161, 162,
- 162, 162, 162, 163, 164, 165, 166, 167, 168, 169,
- 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
+ 0, 161, 162, 162, 163, 163, 163, 163, 163, 163,
+ 164, 165, 165, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 166, 167, 168,
+ 168, 169, 169, 169, 169, 169, 170, 171, 171, 172,
+ 172, 172, 172, 173, 174, 175, 176, 177, 178, 179,
180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
250, 251, 252, 253, 254, 255, 256, 257, 258, 259,
260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
- 270, 271, 272, 273, 274, 275, 276, 277, 278, 278,
- 279, 279, 279, 279, 279, 279, 279, 279, 280, 281,
- 282, 283, 284, 285, 286, 287, 288, 289, 289, 290,
- 290, 290, 290, 290, 290, 290, 290, 290, 290, 290,
- 290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
- 300, 301, 302, 303, 304, 304, 305, 306
+ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
+ 280, 281, 282, 283, 284, 285, 286, 287, 288, 289,
+ 290, 291, 292, 293, 294, 295, 296, 297, 298, 298,
+ 299, 299, 299, 299, 299, 299, 299, 299, 300, 301,
+ 302, 303, 304, 305, 306, 307, 308, 309, 309, 310,
+ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
+ 310, 311, 312, 313, 314, 315, 316, 317, 318, 319,
+ 320, 321, 322, 323, 324, 324, 325, 326
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
0, 1, 1, 1, 1, 1, 1, 2, 0, 1,
1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 3, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 3, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 3, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 3, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 3, 3, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 1, 2, 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 0, 1,
means the default is an error. */
static const yytype_uint16 yydefact[] =
{
- 2, 0, 1, 10, 118, 126, 247, 293, 266, 3,
- 12, 120, 128, 249, 268, 295, 4, 5, 6, 8,
+ 2, 0, 1, 10, 128, 136, 267, 313, 286, 3,
+ 12, 130, 138, 269, 288, 315, 4, 5, 6, 8,
9, 7, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 11, 13, 14,
70, 73, 82, 15, 21, 61, 16, 74, 75, 32,
54, 69, 17, 18, 19, 20, 104, 105, 106, 107,
108, 71, 60, 86, 103, 22, 23, 24, 25, 26,
62, 76, 77, 92, 48, 58, 49, 87, 42, 43,
- 44, 45, 96, 100, 112, 97, 55, 27, 28, 29,
- 84, 113, 114, 30, 31, 33, 34, 36, 37, 35,
- 117, 38, 39, 40, 46, 65, 101, 79, 72, 80,
- 81, 98, 99, 85, 41, 63, 66, 47, 50, 88,
- 89, 64, 90, 51, 52, 53, 102, 91, 59, 93,
- 94, 95, 56, 57, 78, 67, 68, 83, 109, 110,
- 111, 115, 116, 0, 0, 0, 0, 0, 119, 121,
- 122, 123, 125, 124, 0, 0, 0, 0, 127, 129,
- 130, 131, 132, 0, 0, 0, 0, 0, 0, 0,
- 0, 248, 250, 252, 251, 257, 253, 254, 255, 256,
+ 44, 45, 96, 100, 112, 119, 97, 55, 27, 28,
+ 29, 84, 113, 114, 30, 31, 33, 34, 36, 37,
+ 35, 117, 38, 39, 40, 46, 65, 101, 79, 118,
+ 72, 126, 80, 81, 98, 99, 85, 41, 63, 66,
+ 47, 50, 88, 89, 64, 127, 90, 51, 52, 53,
+ 102, 91, 59, 93, 94, 95, 56, 57, 78, 67,
+ 68, 83, 109, 110, 111, 115, 116, 120, 122, 121,
+ 123, 124, 125, 0, 0, 0, 0, 0, 129, 131,
+ 132, 133, 135, 134, 0, 0, 0, 0, 137, 139,
+ 140, 141, 142, 0, 0, 0, 0, 0, 0, 0,
+ 0, 268, 270, 272, 271, 277, 273, 274, 275, 276,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 267, 269, 270, 271, 272, 273, 274, 275,
- 276, 277, 278, 279, 280, 0, 294, 296, 134, 133,
- 138, 141, 139, 147, 148, 149, 150, 160, 161, 162,
- 163, 164, 182, 183, 184, 188, 189, 144, 190, 191,
- 194, 192, 193, 196, 197, 198, 209, 173, 174, 175,
- 176, 199, 212, 169, 171, 213, 218, 219, 220, 145,
- 181, 227, 228, 170, 223, 157, 140, 165, 210, 216,
- 200, 0, 0, 231, 146, 135, 156, 203, 136, 142,
- 143, 166, 167, 229, 202, 204, 205, 137, 232, 185,
- 208, 158, 172, 214, 215, 217, 222, 168, 226, 224,
- 225, 177, 180, 206, 207, 178, 179, 201, 221, 159,
- 151, 152, 153, 154, 155, 233, 234, 235, 186, 187,
- 195, 236, 237, 238, 239, 240, 242, 241, 243, 244,
- 245, 246, 258, 260, 259, 262, 263, 264, 265, 261,
- 281, 282, 283, 284, 285, 286, 287, 288, 289, 290,
- 291, 292, 297, 211, 230
+ 0, 0, 287, 289, 290, 291, 292, 293, 294, 295,
+ 296, 297, 298, 299, 300, 0, 314, 316, 144, 143,
+ 148, 151, 149, 157, 158, 159, 160, 170, 171, 172,
+ 173, 174, 193, 194, 195, 199, 200, 154, 201, 202,
+ 205, 203, 204, 207, 208, 209, 222, 183, 184, 185,
+ 186, 210, 225, 179, 181, 226, 232, 233, 234, 155,
+ 192, 241, 242, 180, 237, 167, 150, 175, 223, 229,
+ 211, 0, 0, 245, 156, 145, 166, 215, 146, 152,
+ 153, 176, 177, 243, 213, 217, 218, 147, 246, 196,
+ 221, 168, 182, 227, 228, 231, 236, 178, 240, 238,
+ 239, 187, 191, 219, 220, 188, 189, 212, 235, 169,
+ 161, 162, 163, 164, 165, 247, 248, 249, 197, 198,
+ 206, 250, 251, 214, 190, 252, 254, 253, 0, 0,
+ 257, 216, 230, 258, 259, 260, 262, 261, 263, 264,
+ 265, 266, 278, 280, 279, 282, 283, 284, 285, 281,
+ 301, 302, 303, 304, 305, 306, 307, 308, 309, 310,
+ 311, 312, 317, 224, 244, 255, 256
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 1, 9, 10, 16, 127, 11, 17, 238, 12,
- 18, 248, 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
+ -1, 1, 9, 10, 16, 137, 11, 17, 258, 12,
+ 18, 268, 138, 139, 140, 141, 142, 143, 144, 145,
146, 147, 148, 149, 150, 151, 152, 153, 154, 155,
156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
- 226, 227, 228, 229, 230, 231, 232, 239, 240, 241,
- 242, 243, 249, 250, 251, 252, 13, 19, 261, 262,
- 263, 264, 265, 266, 267, 268, 269, 14, 20, 282,
- 283, 284, 285, 286, 287, 288, 289, 290, 291, 292,
- 293, 294, 15, 21, 296, 297
+ 226, 227, 228, 229, 230, 231, 232, 233, 234, 235,
+ 236, 237, 238, 239, 240, 241, 242, 243, 244, 245,
+ 246, 247, 248, 249, 250, 251, 252, 259, 260, 261,
+ 262, 263, 269, 270, 271, 272, 13, 19, 281, 282,
+ 283, 284, 285, 286, 287, 288, 289, 14, 20, 302,
+ 303, 304, 305, 306, 307, 308, 309, 310, 311, 312,
+ 313, 314, 15, 21, 316, 317
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -125
+#define YYPACT_NINF -81
static const yytype_int16 yypact[] =
{
- -125, 0, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, 93, -36, -32, -62,
- -124, -103, -4, -3, -2, -1, 2, 25, 26, 27,
- 29, 30, 31, 32, 33, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 55, 56, 57, 58, 59, 60,
- 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
- 71, 72, 73, 74, 75, 76, 77, 79, 80, 81,
- 82, 84, 85, 87, 88, 89, 90, 91, 92, 120,
- 121, 122, 123, 127, 129, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 183, 187, 188, 211, 212, 221,
- 222, 223, 224, 225, 226, 227, 228, 229, 230, 231,
- 232, 233, 234, 235, 236, 237, 238, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, 239, 240, 241, 242, 243, -125, -125,
- -125, -125, -125, -125, 244, 245, 246, 247, -125, -125,
- -125, -125, -125, 248, 249, 250, 251, 252, 253, 254,
- 255, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
- 266, 267, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, 268, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, 269, 270, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125
+ -81, 116, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -12, 89, 47, -13,
+ 22, -80, 16, 17, 18, 23, 24, 78, 107, 120,
+ 121, 122, 123, 124, 125, 126, 127, 128, 139, 140,
+ 141, 142, 143, 145, 146, 147, 148, 149, 163, 164,
+ 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
+ 176, 177, 178, 180, 181, 182, 183, 184, 185, 186,
+ 187, 188, 189, 190, 191, 192, 193, 195, 196, 197,
+ 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
+ 209, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
+ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+ 240, 241, 242, 243, 245, 246, 247, 248, 249, 250,
+ 251, 252, 253, 254, 255, 256, 257, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, 258, 259, 260, 261, 262, -81, -81,
+ -81, -81, -81, -81, 263, 264, 265, 266, -81, -81,
+ -81, -81, -81, 267, 268, 269, 270, 271, 272, 273,
+ 274, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
+ 285, 286, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, 287, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, 288, 289, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, 290, 291,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
- -125, -125, -125, -125, -125, -125
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81, -81, -81, -81, -81,
+ -81, -81, -81, -81, -81, -81
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
#define YYTABLE_NINF -1
static const yytype_uint16 yytable[] =
{
- 2, 233, 295, 234, 235, 244, 298, 299, 300, 301,
- 0, 3, 302, 245, 246, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 280, 281, 253, 254, 255,
- 256, 257, 258, 259, 260, 303, 304, 305, 4, 306,
- 307, 308, 309, 310, 5, 311, 312, 313, 314, 315,
- 316, 317, 318, 319, 320, 321, 322, 323, 324, 325,
- 326, 327, 328, 329, 236, 330, 331, 332, 333, 334,
- 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
- 345, 346, 347, 348, 349, 350, 351, 352, 6, 353,
- 354, 355, 356, 237, 357, 358, 247, 359, 360, 361,
- 362, 363, 364, 0, 7, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
- 365, 366, 367, 368, 47, 48, 49, 369, 8, 370,
- 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
- 90, 371, 372, 373, 374, 375, 376, 377, 378, 379,
- 91, 92, 93, 380, 94, 95, 96, 381, 382, 97,
- 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
- 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
- 118, 383, 384, 119, 120, 121, 122, 123, 124, 125,
- 126, 385, 386, 387, 388, 389, 390, 391, 392, 393,
- 394, 395, 396, 397, 398, 399, 400, 401, 402, 403,
- 404, 405, 406, 407, 408, 409, 410, 411, 412, 413,
- 414, 415, 416, 417, 418, 419, 420, 421, 422, 423,
- 424, 425, 426, 427, 428, 429, 430, 431, 432, 433,
- 434
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ 42, 43, 44, 45, 46, 315, 318, 319, 320, 47,
+ 48, 49, 0, 321, 322, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
+ 85, 86, 87, 88, 89, 90, 273, 274, 275, 276,
+ 277, 278, 279, 280, 264, 91, 92, 93, 323, 94,
+ 95, 96, 265, 266, 97, 98, 99, 100, 101, 102,
+ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
+ 113, 114, 115, 116, 117, 118, 2, 324, 119, 120,
+ 121, 122, 123, 124, 125, 126, 253, 3, 254, 255,
+ 325, 326, 327, 328, 329, 330, 331, 332, 333, 127,
+ 128, 129, 130, 131, 132, 133, 134, 135, 136, 334,
+ 335, 336, 337, 338, 4, 339, 340, 341, 342, 343,
+ 5, 290, 291, 292, 293, 294, 295, 296, 297, 298,
+ 299, 300, 301, 344, 345, 267, 346, 347, 348, 349,
+ 350, 351, 352, 353, 354, 355, 356, 357, 358, 256,
+ 359, 360, 361, 362, 363, 364, 365, 366, 367, 368,
+ 369, 370, 371, 372, 6, 373, 374, 375, 376, 377,
+ 378, 379, 380, 381, 382, 383, 384, 385, 257, 386,
+ 7, 387, 388, 389, 390, 391, 392, 393, 394, 395,
+ 396, 397, 398, 399, 400, 401, 402, 403, 404, 405,
+ 406, 407, 408, 409, 410, 411, 412, 413, 414, 415,
+ 416, 417, 418, 419, 8, 420, 421, 422, 423, 424,
+ 425, 426, 427, 428, 429, 430, 431, 432, 433, 434,
+ 435, 436, 437, 438, 439, 440, 441, 442, 443, 444,
+ 445, 446, 447, 448, 449, 450, 451, 452, 453, 454,
+ 455, 456, 457, 458, 459, 460, 461, 462, 463, 464,
+ 465, 466
};
#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-125)))
+ (!!((Yystate) == (-81)))
#define yytable_value_is_error(Yytable_value) \
YYID (0)
static const yytype_int16 yycheck[] =
{
- 0, 37, 105, 39, 40, 37, 10, 10, 10, 10,
- -1, 11, 10, 45, 46, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 89, 90, 91,
- 92, 93, 94, 95, 96, 10, 10, 10, 38, 10,
- 10, 10, 10, 10, 44, 10, 10, 10, 10, 10,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 105, 10, 10, 10, 41,
+ 42, 43, -1, 10, 10, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
+ 82, 83, 84, 85, 86, 87, 89, 90, 91, 92,
+ 93, 94, 95, 96, 37, 97, 98, 99, 10, 101,
+ 102, 103, 45, 46, 106, 107, 108, 109, 110, 111,
+ 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
+ 122, 123, 124, 125, 126, 127, 0, 10, 130, 131,
+ 132, 133, 134, 135, 136, 137, 37, 11, 39, 40,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 151,
+ 152, 153, 154, 155, 156, 157, 158, 159, 160, 10,
+ 10, 10, 10, 10, 38, 10, 10, 10, 10, 10,
+ 44, 139, 140, 141, 142, 143, 144, 145, 146, 147,
+ 148, 149, 150, 10, 10, 128, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 100,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 100, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 88, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 129, 10,
+ 104, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 88, 10,
- 10, 10, 10, 129, 10, 10, 128, 10, 10, 10,
- 10, 10, 10, -1, 104, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- 10, 10, 10, 10, 41, 42, 43, 10, 138, 10,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
- 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
- 87, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 97, 98, 99, 10, 101, 102, 103, 10, 10, 106,
- 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
- 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
- 127, 10, 10, 130, 131, 132, 133, 134, 135, 136,
- 137, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 138, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10
+ 10, 10
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint16 yystos[] =
{
- 0, 152, 0, 11, 38, 44, 88, 104, 138, 153,
- 154, 157, 160, 277, 288, 303, 155, 158, 161, 278,
- 289, 304, 12, 13, 14, 15, 16, 17, 18, 19,
+ 0, 162, 0, 11, 38, 44, 88, 104, 138, 163,
+ 164, 167, 170, 297, 308, 323, 165, 168, 171, 298,
+ 309, 324, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 41, 42, 43,
47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
87, 97, 98, 99, 101, 102, 103, 106, 107, 108,
109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
119, 120, 121, 122, 123, 124, 125, 126, 127, 130,
- 131, 132, 133, 134, 135, 136, 137, 156, 163, 164,
- 165, 166, 167, 168, 169, 170, 171, 172, 173, 174,
+ 131, 132, 133, 134, 135, 136, 137, 151, 152, 153,
+ 154, 155, 156, 157, 158, 159, 160, 166, 173, 174,
175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
255, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 37, 39, 40, 100, 129, 159, 268,
- 269, 270, 271, 272, 37, 45, 46, 128, 162, 273,
- 274, 275, 276, 89, 90, 91, 92, 93, 94, 95,
- 96, 279, 280, 281, 282, 283, 284, 285, 286, 287,
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
+ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
+ 285, 286, 287, 37, 39, 40, 100, 129, 169, 288,
+ 289, 290, 291, 292, 37, 45, 46, 128, 172, 293,
+ 294, 295, 296, 89, 90, 91, 92, 93, 94, 95,
+ 96, 299, 300, 301, 302, 303, 304, 305, 306, 307,
139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
- 149, 150, 290, 291, 292, 293, 294, 295, 296, 297,
- 298, 299, 300, 301, 302, 105, 305, 306, 10, 10,
+ 149, 150, 310, 311, 312, 313, 314, 315, 316, 317,
+ 318, 319, 320, 321, 322, 105, 325, 326, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10
+ 10, 10, 10, 10, 10, 10, 10
};
#define yyerrok (yyerrstatus = 0)
{
case 10:
/* Line 1792 of yacc.c */
-#line 131 "util/configparser.y"
+#line 135 "util/configparser.y"
{
OUTYY(("\nP(server:)\n"));
}
break;
- case 118:
+ case 128:
/* Line 1792 of yacc.c */
-#line 183 "util/configparser.y"
+#line 191 "util/configparser.y"
{
struct config_stub* s;
OUTYY(("\nP(stub_zone:)\n"));
}
break;
- case 126:
+ case 136:
/* Line 1792 of yacc.c */
-#line 199 "util/configparser.y"
+#line 207 "util/configparser.y"
{
struct config_stub* s;
OUTYY(("\nP(forward_zone:)\n"));
}
break;
- case 133:
+ case 143:
/* Line 1792 of yacc.c */
-#line 215 "util/configparser.y"
+#line 223 "util/configparser.y"
{
OUTYY(("P(server_num_threads:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 134:
+ case 144:
/* Line 1792 of yacc.c */
-#line 224 "util/configparser.y"
+#line 232 "util/configparser.y"
{
OUTYY(("P(server_verbosity:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 135:
+ case 145:
/* Line 1792 of yacc.c */
-#line 233 "util/configparser.y"
+#line 241 "util/configparser.y"
{
OUTYY(("P(server_statistics_interval:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "") == 0 || strcmp((yyvsp[(2) - (2)].str), "0") == 0)
}
break;
- case 136:
+ case 146:
/* Line 1792 of yacc.c */
-#line 244 "util/configparser.y"
+#line 252 "util/configparser.y"
{
OUTYY(("P(server_statistics_cumulative:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 137:
+ case 147:
/* Line 1792 of yacc.c */
-#line 253 "util/configparser.y"
+#line 261 "util/configparser.y"
{
OUTYY(("P(server_extended_statistics:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 138:
+ case 148:
/* Line 1792 of yacc.c */
-#line 262 "util/configparser.y"
+#line 270 "util/configparser.y"
{
OUTYY(("P(server_port:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0)
}
break;
- case 139:
+ case 149:
/* Line 1792 of yacc.c */
-#line 271 "util/configparser.y"
+#line 279 "util/configparser.y"
{
OUTYY(("P(server_interface:%s)\n", (yyvsp[(2) - (2)].str)));
if(cfg_parser->cfg->num_ifs == 0)
}
break;
- case 140:
+ case 150:
/* Line 1792 of yacc.c */
-#line 284 "util/configparser.y"
+#line 292 "util/configparser.y"
{
OUTYY(("P(server_outgoing_interface:%s)\n", (yyvsp[(2) - (2)].str)));
if(cfg_parser->cfg->num_out_ifs == 0)
}
break;
- case 141:
+ case 151:
/* Line 1792 of yacc.c */
-#line 299 "util/configparser.y"
+#line 307 "util/configparser.y"
{
OUTYY(("P(server_outgoing_range:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0)
}
break;
- case 142:
+ case 152:
/* Line 1792 of yacc.c */
-#line 308 "util/configparser.y"
+#line 316 "util/configparser.y"
{
OUTYY(("P(server_outgoing_port_permit:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_mark_ports((yyvsp[(2) - (2)].str), 1,
}
break;
- case 143:
+ case 153:
/* Line 1792 of yacc.c */
-#line 317 "util/configparser.y"
+#line 325 "util/configparser.y"
{
OUTYY(("P(server_outgoing_port_avoid:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_mark_ports((yyvsp[(2) - (2)].str), 0,
}
break;
- case 144:
+ case 154:
/* Line 1792 of yacc.c */
-#line 326 "util/configparser.y"
+#line 334 "util/configparser.y"
{
OUTYY(("P(server_outgoing_num_tcp:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 145:
+ case 155:
/* Line 1792 of yacc.c */
-#line 335 "util/configparser.y"
+#line 343 "util/configparser.y"
{
OUTYY(("P(server_incoming_num_tcp:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 146:
+ case 156:
/* Line 1792 of yacc.c */
-#line 344 "util/configparser.y"
+#line 352 "util/configparser.y"
{
OUTYY(("P(server_interface_automatic:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 147:
+ case 157:
/* Line 1792 of yacc.c */
-#line 353 "util/configparser.y"
+#line 361 "util/configparser.y"
{
OUTYY(("P(server_do_ip4:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 148:
+ case 158:
/* Line 1792 of yacc.c */
-#line 362 "util/configparser.y"
+#line 370 "util/configparser.y"
{
OUTYY(("P(server_do_ip6:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 149:
+ case 159:
/* Line 1792 of yacc.c */
-#line 371 "util/configparser.y"
+#line 379 "util/configparser.y"
{
OUTYY(("P(server_do_udp:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 150:
+ case 160:
/* Line 1792 of yacc.c */
-#line 380 "util/configparser.y"
+#line 388 "util/configparser.y"
{
OUTYY(("P(server_do_tcp:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 151:
+ case 161:
/* Line 1792 of yacc.c */
-#line 389 "util/configparser.y"
+#line 397 "util/configparser.y"
{
OUTYY(("P(server_tcp_upstream:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 152:
+ case 162:
/* Line 1792 of yacc.c */
-#line 398 "util/configparser.y"
+#line 406 "util/configparser.y"
{
OUTYY(("P(server_ssl_upstream:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 153:
+ case 163:
/* Line 1792 of yacc.c */
-#line 407 "util/configparser.y"
+#line 415 "util/configparser.y"
{
OUTYY(("P(server_ssl_service_key:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->ssl_service_key);
}
break;
- case 154:
+ case 164:
/* Line 1792 of yacc.c */
-#line 414 "util/configparser.y"
+#line 422 "util/configparser.y"
{
OUTYY(("P(server_ssl_service_pem:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->ssl_service_pem);
}
break;
- case 155:
+ case 165:
/* Line 1792 of yacc.c */
-#line 421 "util/configparser.y"
+#line 429 "util/configparser.y"
{
OUTYY(("P(server_ssl_port:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0)
}
break;
- case 156:
+ case 166:
/* Line 1792 of yacc.c */
-#line 430 "util/configparser.y"
+#line 438 "util/configparser.y"
{
OUTYY(("P(server_do_daemonize:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 157:
+ case 167:
/* Line 1792 of yacc.c */
-#line 439 "util/configparser.y"
+#line 447 "util/configparser.y"
{
OUTYY(("P(server_use_syslog:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 158:
+ case 168:
/* Line 1792 of yacc.c */
-#line 453 "util/configparser.y"
+#line 461 "util/configparser.y"
{
OUTYY(("P(server_log_time_ascii:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 159:
+ case 169:
/* Line 1792 of yacc.c */
-#line 462 "util/configparser.y"
+#line 470 "util/configparser.y"
{
OUTYY(("P(server_log_queries:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 160:
+ case 170:
/* Line 1792 of yacc.c */
-#line 471 "util/configparser.y"
+#line 479 "util/configparser.y"
{
OUTYY(("P(server_chroot:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->chrootdir);
}
break;
- case 161:
+ case 171:
/* Line 1792 of yacc.c */
-#line 478 "util/configparser.y"
+#line 486 "util/configparser.y"
{
OUTYY(("P(server_username:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->username);
}
break;
- case 162:
+ case 172:
/* Line 1792 of yacc.c */
-#line 485 "util/configparser.y"
+#line 493 "util/configparser.y"
{
OUTYY(("P(server_directory:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->directory);
}
break;
- case 163:
+ case 173:
/* Line 1792 of yacc.c */
-#line 492 "util/configparser.y"
+#line 500 "util/configparser.y"
{
OUTYY(("P(server_logfile:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->logfile);
}
break;
- case 164:
+ case 174:
/* Line 1792 of yacc.c */
-#line 500 "util/configparser.y"
+#line 508 "util/configparser.y"
{
OUTYY(("P(server_pidfile:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->pidfile);
}
break;
- case 165:
+ case 175:
/* Line 1792 of yacc.c */
-#line 507 "util/configparser.y"
+#line 515 "util/configparser.y"
{
OUTYY(("P(server_root_hints:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->root_hints, (yyvsp[(2) - (2)].str)))
}
break;
- case 166:
+ case 176:
/* Line 1792 of yacc.c */
-#line 514 "util/configparser.y"
+#line 522 "util/configparser.y"
{
OUTYY(("P(server_dlv_anchor_file:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->dlv_anchor_file);
}
break;
- case 167:
+ case 177:
/* Line 1792 of yacc.c */
-#line 521 "util/configparser.y"
+#line 529 "util/configparser.y"
{
OUTYY(("P(server_dlv_anchor:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->dlv_anchor_list, (yyvsp[(2) - (2)].str)))
}
break;
- case 168:
+ case 178:
/* Line 1792 of yacc.c */
-#line 528 "util/configparser.y"
+#line 536 "util/configparser.y"
{
OUTYY(("P(server_auto_trust_anchor_file:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->
}
break;
- case 169:
+ case 179:
/* Line 1792 of yacc.c */
-#line 536 "util/configparser.y"
+#line 544 "util/configparser.y"
{
OUTYY(("P(server_trust_anchor_file:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->
}
break;
- case 170:
+ case 180:
/* Line 1792 of yacc.c */
-#line 544 "util/configparser.y"
+#line 552 "util/configparser.y"
{
OUTYY(("P(server_trusted_keys_file:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->
}
break;
- case 171:
+ case 181:
/* Line 1792 of yacc.c */
-#line 552 "util/configparser.y"
+#line 560 "util/configparser.y"
{
OUTYY(("P(server_trust_anchor:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->trust_anchor_list, (yyvsp[(2) - (2)].str)))
}
break;
- case 172:
+ case 182:
/* Line 1792 of yacc.c */
-#line 559 "util/configparser.y"
+#line 567 "util/configparser.y"
{
OUTYY(("P(server_domain_insecure:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->domain_insecure, (yyvsp[(2) - (2)].str)))
}
break;
- case 173:
+ case 183:
/* Line 1792 of yacc.c */
-#line 566 "util/configparser.y"
+#line 574 "util/configparser.y"
{
OUTYY(("P(server_hide_identity:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 174:
+ case 184:
/* Line 1792 of yacc.c */
-#line 575 "util/configparser.y"
+#line 583 "util/configparser.y"
{
OUTYY(("P(server_hide_version:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 175:
+ case 185:
/* Line 1792 of yacc.c */
-#line 584 "util/configparser.y"
+#line 592 "util/configparser.y"
{
OUTYY(("P(server_identity:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->identity);
}
break;
- case 176:
+ case 186:
/* Line 1792 of yacc.c */
-#line 591 "util/configparser.y"
+#line 599 "util/configparser.y"
{
OUTYY(("P(server_version:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->version);
}
break;
- case 177:
+ case 187:
/* Line 1792 of yacc.c */
-#line 598 "util/configparser.y"
+#line 606 "util/configparser.y"
{
OUTYY(("P(server_so_rcvbuf:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_parse_memsize((yyvsp[(2) - (2)].str), &cfg_parser->cfg->so_rcvbuf))
}
break;
- case 178:
+ case 188:
/* Line 1792 of yacc.c */
-#line 606 "util/configparser.y"
+#line 614 "util/configparser.y"
{
OUTYY(("P(server_so_sndbuf:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_parse_memsize((yyvsp[(2) - (2)].str), &cfg_parser->cfg->so_sndbuf))
}
break;
- case 179:
+ case 189:
/* Line 1792 of yacc.c */
-#line 614 "util/configparser.y"
+#line 622 "util/configparser.y"
{
OUTYY(("P(server_so_reuseport:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 180:
+ case 190:
+/* Line 1792 of yacc.c */
+#line 632 "util/configparser.y"
+ {
+ OUTYY(("P(server_ip_transparent:%s)\n", (yyvsp[(2) - (2)].str)));
+ if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
+ yyerror("expected yes or no.");
+ else cfg_parser->cfg->ip_transparent =
+ (strcmp((yyvsp[(2) - (2)].str), "yes")==0);
+ free((yyvsp[(2) - (2)].str));
+ }
+ break;
+
+ case 191:
/* Line 1792 of yacc.c */
-#line 624 "util/configparser.y"
+#line 642 "util/configparser.y"
{
OUTYY(("P(server_edns_buffer_size:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0)
}
break;
- case 181:
+ case 192:
/* Line 1792 of yacc.c */
-#line 637 "util/configparser.y"
+#line 655 "util/configparser.y"
{
OUTYY(("P(server_msg_buffer_size:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0)
}
break;
- case 182:
+ case 193:
/* Line 1792 of yacc.c */
-#line 648 "util/configparser.y"
+#line 666 "util/configparser.y"
{
OUTYY(("P(server_msg_cache_size:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_parse_memsize((yyvsp[(2) - (2)].str), &cfg_parser->cfg->msg_cache_size))
}
break;
- case 183:
+ case 194:
/* Line 1792 of yacc.c */
-#line 656 "util/configparser.y"
+#line 674 "util/configparser.y"
{
OUTYY(("P(server_msg_cache_slabs:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0)
}
break;
- case 184:
+ case 195:
/* Line 1792 of yacc.c */
-#line 669 "util/configparser.y"
+#line 687 "util/configparser.y"
{
OUTYY(("P(server_num_queries_per_thread:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0)
}
break;
- case 185:
+ case 196:
/* Line 1792 of yacc.c */
-#line 678 "util/configparser.y"
+#line 696 "util/configparser.y"
{
OUTYY(("P(server_jostle_timeout:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 186:
+ case 197:
/* Line 1792 of yacc.c */
-#line 687 "util/configparser.y"
+#line 705 "util/configparser.y"
{
OUTYY(("P(server_delay_close:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 187:
+ case 198:
/* Line 1792 of yacc.c */
-#line 696 "util/configparser.y"
+#line 714 "util/configparser.y"
{
OUTYY(("P(server_unblock_lan_zones:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 188:
+ case 199:
/* Line 1792 of yacc.c */
-#line 706 "util/configparser.y"
+#line 724 "util/configparser.y"
{
OUTYY(("P(server_rrset_cache_size:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_parse_memsize((yyvsp[(2) - (2)].str), &cfg_parser->cfg->rrset_cache_size))
}
break;
- case 189:
+ case 200:
/* Line 1792 of yacc.c */
-#line 714 "util/configparser.y"
+#line 732 "util/configparser.y"
{
OUTYY(("P(server_rrset_cache_slabs:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0)
}
break;
- case 190:
+ case 201:
/* Line 1792 of yacc.c */
-#line 727 "util/configparser.y"
+#line 745 "util/configparser.y"
{
OUTYY(("P(server_infra_host_ttl:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 191:
+ case 202:
/* Line 1792 of yacc.c */
-#line 736 "util/configparser.y"
+#line 754 "util/configparser.y"
{
OUTYY(("P(server_infra_lame_ttl:%s)\n", (yyvsp[(2) - (2)].str)));
verbose(VERB_DETAIL, "ignored infra-lame-ttl: %s (option "
}
break;
- case 192:
+ case 203:
/* Line 1792 of yacc.c */
-#line 744 "util/configparser.y"
+#line 762 "util/configparser.y"
{
OUTYY(("P(server_infra_cache_numhosts:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0)
}
break;
- case 193:
+ case 204:
/* Line 1792 of yacc.c */
-#line 753 "util/configparser.y"
+#line 771 "util/configparser.y"
{
OUTYY(("P(server_infra_cache_lame_size:%s)\n", (yyvsp[(2) - (2)].str)));
verbose(VERB_DETAIL, "ignored infra-cache-lame-size: %s "
}
break;
- case 194:
+ case 205:
/* Line 1792 of yacc.c */
-#line 761 "util/configparser.y"
+#line 779 "util/configparser.y"
{
OUTYY(("P(server_infra_cache_slabs:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0)
}
break;
- case 195:
+ case 206:
/* Line 1792 of yacc.c */
-#line 774 "util/configparser.y"
+#line 792 "util/configparser.y"
{
OUTYY(("P(server_infra_cache_min_rtt:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 196:
+ case 207:
/* Line 1792 of yacc.c */
-#line 783 "util/configparser.y"
+#line 801 "util/configparser.y"
{
OUTYY(("P(server_target_fetch_policy:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->target_fetch_policy);
}
break;
- case 197:
+ case 208:
/* Line 1792 of yacc.c */
-#line 790 "util/configparser.y"
+#line 808 "util/configparser.y"
{
OUTYY(("P(server_harden_short_bufsize:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 198:
+ case 209:
/* Line 1792 of yacc.c */
-#line 800 "util/configparser.y"
+#line 818 "util/configparser.y"
{
OUTYY(("P(server_harden_large_queries:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 199:
+ case 210:
/* Line 1792 of yacc.c */
-#line 810 "util/configparser.y"
+#line 828 "util/configparser.y"
{
OUTYY(("P(server_harden_glue:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 200:
+ case 211:
/* Line 1792 of yacc.c */
-#line 820 "util/configparser.y"
+#line 838 "util/configparser.y"
{
OUTYY(("P(server_harden_dnssec_stripped:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 201:
+ case 212:
/* Line 1792 of yacc.c */
-#line 830 "util/configparser.y"
+#line 848 "util/configparser.y"
{
OUTYY(("P(server_harden_below_nxdomain:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 202:
+ case 213:
/* Line 1792 of yacc.c */
-#line 840 "util/configparser.y"
+#line 858 "util/configparser.y"
{
OUTYY(("P(server_harden_referral_path:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 203:
+ case 214:
+/* Line 1792 of yacc.c */
+#line 868 "util/configparser.y"
+ {
+ OUTYY(("P(server_harden_algo_downgrade:%s)\n", (yyvsp[(2) - (2)].str)));
+ if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
+ yyerror("expected yes or no.");
+ else cfg_parser->cfg->harden_algo_downgrade =
+ (strcmp((yyvsp[(2) - (2)].str), "yes")==0);
+ free((yyvsp[(2) - (2)].str));
+ }
+ break;
+
+ case 215:
/* Line 1792 of yacc.c */
-#line 850 "util/configparser.y"
+#line 878 "util/configparser.y"
{
OUTYY(("P(server_use_caps_for_id:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 204:
+ case 216:
+/* Line 1792 of yacc.c */
+#line 888 "util/configparser.y"
+ {
+ OUTYY(("P(server_caps_whitelist:%s)\n", (yyvsp[(2) - (2)].str)));
+ if(!cfg_strlist_insert(&cfg_parser->cfg->caps_whitelist, (yyvsp[(2) - (2)].str)))
+ yyerror("out of memory");
+ }
+ break;
+
+ case 217:
/* Line 1792 of yacc.c */
-#line 860 "util/configparser.y"
+#line 895 "util/configparser.y"
{
OUTYY(("P(server_private_address:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->private_address, (yyvsp[(2) - (2)].str)))
}
break;
- case 205:
+ case 218:
/* Line 1792 of yacc.c */
-#line 867 "util/configparser.y"
+#line 902 "util/configparser.y"
{
OUTYY(("P(server_private_domain:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->private_domain, (yyvsp[(2) - (2)].str)))
}
break;
- case 206:
+ case 219:
/* Line 1792 of yacc.c */
-#line 874 "util/configparser.y"
+#line 909 "util/configparser.y"
{
OUTYY(("P(server_prefetch:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 207:
+ case 220:
/* Line 1792 of yacc.c */
-#line 883 "util/configparser.y"
+#line 918 "util/configparser.y"
{
OUTYY(("P(server_prefetch_key:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 208:
+ case 221:
/* Line 1792 of yacc.c */
-#line 892 "util/configparser.y"
+#line 927 "util/configparser.y"
{
OUTYY(("P(server_unwanted_reply_threshold:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 209:
+ case 222:
/* Line 1792 of yacc.c */
-#line 901 "util/configparser.y"
+#line 936 "util/configparser.y"
{
OUTYY(("P(server_do_not_query_address:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->donotqueryaddrs, (yyvsp[(2) - (2)].str)))
}
break;
- case 210:
+ case 223:
/* Line 1792 of yacc.c */
-#line 908 "util/configparser.y"
+#line 943 "util/configparser.y"
{
OUTYY(("P(server_do_not_query_localhost:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 211:
+ case 224:
/* Line 1792 of yacc.c */
-#line 918 "util/configparser.y"
+#line 953 "util/configparser.y"
{
OUTYY(("P(server_access_control:%s %s)\n", (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)));
if(strcmp((yyvsp[(3) - (3)].str), "deny")!=0 && strcmp((yyvsp[(3) - (3)].str), "refuse")!=0 &&
}
break;
- case 212:
+ case 225:
/* Line 1792 of yacc.c */
-#line 935 "util/configparser.y"
+#line 970 "util/configparser.y"
{
OUTYY(("P(server_module_conf:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->module_conf);
}
break;
- case 213:
+ case 226:
/* Line 1792 of yacc.c */
-#line 942 "util/configparser.y"
+#line 977 "util/configparser.y"
{
OUTYY(("P(server_val_override_date:%s)\n", (yyvsp[(2) - (2)].str)));
if(strlen((yyvsp[(2) - (2)].str)) == 0 || strcmp((yyvsp[(2) - (2)].str), "0") == 0) {
}
break;
- case 214:
+ case 227:
/* Line 1792 of yacc.c */
-#line 960 "util/configparser.y"
+#line 995 "util/configparser.y"
{
OUTYY(("P(server_val_sig_skew_min:%s)\n", (yyvsp[(2) - (2)].str)));
if(strlen((yyvsp[(2) - (2)].str)) == 0 || strcmp((yyvsp[(2) - (2)].str), "0") == 0) {
}
break;
- case 215:
+ case 228:
/* Line 1792 of yacc.c */
-#line 973 "util/configparser.y"
+#line 1008 "util/configparser.y"
{
OUTYY(("P(server_val_sig_skew_max:%s)\n", (yyvsp[(2) - (2)].str)));
if(strlen((yyvsp[(2) - (2)].str)) == 0 || strcmp((yyvsp[(2) - (2)].str), "0") == 0) {
}
break;
- case 216:
+ case 229:
/* Line 1792 of yacc.c */
-#line 986 "util/configparser.y"
+#line 1021 "util/configparser.y"
{
OUTYY(("P(server_cache_max_ttl:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 217:
+ case 230:
/* Line 1792 of yacc.c */
-#line 995 "util/configparser.y"
+#line 1030 "util/configparser.y"
+ {
+ OUTYY(("P(server_cache_max_negative_ttl:%s)\n", (yyvsp[(2) - (2)].str)));
+ if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
+ yyerror("number expected");
+ else cfg_parser->cfg->max_negative_ttl = atoi((yyvsp[(2) - (2)].str));
+ free((yyvsp[(2) - (2)].str));
+ }
+ break;
+
+ case 231:
+/* Line 1792 of yacc.c */
+#line 1039 "util/configparser.y"
{
OUTYY(("P(server_cache_min_ttl:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 218:
+ case 232:
/* Line 1792 of yacc.c */
-#line 1004 "util/configparser.y"
+#line 1048 "util/configparser.y"
{
OUTYY(("P(server_bogus_ttl:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 219:
+ case 233:
/* Line 1792 of yacc.c */
-#line 1013 "util/configparser.y"
+#line 1057 "util/configparser.y"
{
OUTYY(("P(server_val_clean_additional:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 220:
+ case 234:
/* Line 1792 of yacc.c */
-#line 1023 "util/configparser.y"
+#line 1067 "util/configparser.y"
{
OUTYY(("P(server_val_permissive_mode:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 221:
+ case 235:
/* Line 1792 of yacc.c */
-#line 1033 "util/configparser.y"
+#line 1077 "util/configparser.y"
{
OUTYY(("P(server_ignore_cd_flag:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 222:
+ case 236:
/* Line 1792 of yacc.c */
-#line 1042 "util/configparser.y"
+#line 1086 "util/configparser.y"
{
OUTYY(("P(server_val_log_level:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 223:
+ case 237:
/* Line 1792 of yacc.c */
-#line 1051 "util/configparser.y"
+#line 1095 "util/configparser.y"
{
OUTYY(("P(server_val_nsec3_keysize_iterations:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->val_nsec3_key_iterations);
}
break;
- case 224:
+ case 238:
/* Line 1792 of yacc.c */
-#line 1058 "util/configparser.y"
+#line 1102 "util/configparser.y"
{
OUTYY(("P(server_add_holddown:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 225:
+ case 239:
/* Line 1792 of yacc.c */
-#line 1067 "util/configparser.y"
+#line 1111 "util/configparser.y"
{
OUTYY(("P(server_del_holddown:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 226:
+ case 240:
/* Line 1792 of yacc.c */
-#line 1076 "util/configparser.y"
+#line 1120 "util/configparser.y"
{
OUTYY(("P(server_keep_missing:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
}
break;
- case 227:
+ case 241:
/* Line 1792 of yacc.c */
-#line 1085 "util/configparser.y"
+#line 1129 "util/configparser.y"
{
OUTYY(("P(server_key_cache_size:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_parse_memsize((yyvsp[(2) - (2)].str), &cfg_parser->cfg->key_cache_size))
}
break;
- case 228:
+ case 242:
/* Line 1792 of yacc.c */
-#line 1093 "util/configparser.y"
+#line 1137 "util/configparser.y"
{
OUTYY(("P(server_key_cache_slabs:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0)
}
break;
- case 229:
+ case 243:
/* Line 1792 of yacc.c */
-#line 1106 "util/configparser.y"
+#line 1150 "util/configparser.y"
{
OUTYY(("P(server_neg_cache_size:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_parse_memsize((yyvsp[(2) - (2)].str), &cfg_parser->cfg->neg_cache_size))
}
break;
- case 230:
+ case 244:
/* Line 1792 of yacc.c */
-#line 1114 "util/configparser.y"
+#line 1158 "util/configparser.y"
{
OUTYY(("P(server_local_zone:%s %s)\n", (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)));
if(strcmp((yyvsp[(3) - (3)].str), "static")!=0 && strcmp((yyvsp[(3) - (3)].str), "deny")!=0 &&
strcmp((yyvsp[(3) - (3)].str), "refuse")!=0 && strcmp((yyvsp[(3) - (3)].str), "redirect")!=0 &&
strcmp((yyvsp[(3) - (3)].str), "transparent")!=0 && strcmp((yyvsp[(3) - (3)].str), "nodefault")!=0
&& strcmp((yyvsp[(3) - (3)].str), "typetransparent")!=0 &&
- strcmp((yyvsp[(3) - (3)].str), "inform")!=0)
+ strcmp((yyvsp[(3) - (3)].str), "inform")!=0 && strcmp((yyvsp[(3) - (3)].str), "inform_deny")!=0)
yyerror("local-zone type: expected static, deny, "
"refuse, redirect, transparent, "
- "typetransparent, inform or nodefault");
+ "typetransparent, inform, inform_deny "
+ "or nodefault");
else if(strcmp((yyvsp[(3) - (3)].str), "nodefault")==0) {
if(!cfg_strlist_insert(&cfg_parser->cfg->
local_zones_nodefault, (yyvsp[(2) - (3)].str)))
}
break;
- case 231:
+ case 245:
/* Line 1792 of yacc.c */
-#line 1137 "util/configparser.y"
+#line 1182 "util/configparser.y"
{
OUTYY(("P(server_local_data:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->local_data, (yyvsp[(2) - (2)].str)))
}
break;
- case 232:
+ case 246:
/* Line 1792 of yacc.c */
-#line 1144 "util/configparser.y"
+#line 1189 "util/configparser.y"
{
char* ptr;
OUTYY(("P(server_local_data_ptr:%s)\n", (yyvsp[(2) - (2)].str)));
}
break;
- case 233:
+ case 247:
/* Line 1792 of yacc.c */
-#line 1159 "util/configparser.y"
+#line 1204 "util/configparser.y"
{
OUTYY(("P(server_minimal_responses:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 234:
+ case 248:
/* Line 1792 of yacc.c */
-#line 1169 "util/configparser.y"
+#line 1214 "util/configparser.y"
{
OUTYY(("P(server_rrset_roundrobin:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 235:
+ case 249:
/* Line 1792 of yacc.c */
-#line 1179 "util/configparser.y"
+#line 1224 "util/configparser.y"
{
OUTYY(("P(server_max_udp_size:%s)\n", (yyvsp[(2) - (2)].str)));
cfg_parser->cfg->max_udp_size = atoi((yyvsp[(2) - (2)].str));
}
break;
- case 236:
+ case 250:
/* Line 1792 of yacc.c */
-#line 1186 "util/configparser.y"
+#line 1231 "util/configparser.y"
{
OUTYY(("P(dns64_prefix:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->dns64_prefix);
}
break;
- case 237:
+ case 251:
/* Line 1792 of yacc.c */
-#line 1193 "util/configparser.y"
+#line 1238 "util/configparser.y"
{
OUTYY(("P(server_dns64_synthall:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 238:
+ case 252:
+/* Line 1792 of yacc.c */
+#line 1247 "util/configparser.y"
+ {
+ OUTYY(("P(server_ratelimit:%s)\n", (yyvsp[(2) - (2)].str)));
+ if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
+ yyerror("number expected");
+ else cfg_parser->cfg->ratelimit = atoi((yyvsp[(2) - (2)].str));
+ free((yyvsp[(2) - (2)].str));
+ }
+ break;
+
+ case 253:
+/* Line 1792 of yacc.c */
+#line 1256 "util/configparser.y"
+ {
+ OUTYY(("P(server_ratelimit_size:%s)\n", (yyvsp[(2) - (2)].str)));
+ if(!cfg_parse_memsize((yyvsp[(2) - (2)].str), &cfg_parser->cfg->ratelimit_size))
+ yyerror("memory size expected");
+ free((yyvsp[(2) - (2)].str));
+ }
+ break;
+
+ case 254:
+/* Line 1792 of yacc.c */
+#line 1264 "util/configparser.y"
+ {
+ OUTYY(("P(server_ratelimit_slabs:%s)\n", (yyvsp[(2) - (2)].str)));
+ if(atoi((yyvsp[(2) - (2)].str)) == 0)
+ yyerror("number expected");
+ else {
+ cfg_parser->cfg->ratelimit_slabs = atoi((yyvsp[(2) - (2)].str));
+ if(!is_pow2(cfg_parser->cfg->ratelimit_slabs))
+ yyerror("must be a power of 2");
+ }
+ free((yyvsp[(2) - (2)].str));
+ }
+ break;
+
+ case 255:
+/* Line 1792 of yacc.c */
+#line 1277 "util/configparser.y"
+ {
+ OUTYY(("P(server_ratelimit_for_domain:%s %s)\n", (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)));
+ if(atoi((yyvsp[(3) - (3)].str)) == 0 && strcmp((yyvsp[(3) - (3)].str), "0") != 0) {
+ yyerror("number expected");
+ } else {
+ if(!cfg_str2list_insert(&cfg_parser->cfg->
+ ratelimit_for_domain, (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)))
+ fatal_exit("out of memory adding "
+ "ratelimit-for-domain");
+ }
+ }
+ break;
+
+ case 256:
+/* Line 1792 of yacc.c */
+#line 1290 "util/configparser.y"
+ {
+ OUTYY(("P(server_ratelimit_below_domain:%s %s)\n", (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)));
+ if(atoi((yyvsp[(3) - (3)].str)) == 0 && strcmp((yyvsp[(3) - (3)].str), "0") != 0) {
+ yyerror("number expected");
+ } else {
+ if(!cfg_str2list_insert(&cfg_parser->cfg->
+ ratelimit_below_domain, (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)))
+ fatal_exit("out of memory adding "
+ "ratelimit-below-domain");
+ }
+ }
+ break;
+
+ case 257:
+/* Line 1792 of yacc.c */
+#line 1303 "util/configparser.y"
+ {
+ OUTYY(("P(server_ratelimit_factor:%s)\n", (yyvsp[(2) - (2)].str)));
+ if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0)
+ yyerror("number expected");
+ else cfg_parser->cfg->ratelimit_factor = atoi((yyvsp[(2) - (2)].str));
+ free((yyvsp[(2) - (2)].str));
+ }
+ break;
+
+ case 258:
/* Line 1792 of yacc.c */
-#line 1202 "util/configparser.y"
+#line 1312 "util/configparser.y"
{
OUTYY(("P(name:%s)\n", (yyvsp[(2) - (2)].str)));
if(cfg_parser->cfg->stubs->name)
}
break;
- case 239:
+ case 259:
/* Line 1792 of yacc.c */
-#line 1212 "util/configparser.y"
+#line 1322 "util/configparser.y"
{
OUTYY(("P(stub-host:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->stubs->hosts, (yyvsp[(2) - (2)].str)))
}
break;
- case 240:
+ case 260:
/* Line 1792 of yacc.c */
-#line 1219 "util/configparser.y"
+#line 1329 "util/configparser.y"
{
OUTYY(("P(stub-addr:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->stubs->addrs, (yyvsp[(2) - (2)].str)))
}
break;
- case 241:
+ case 261:
/* Line 1792 of yacc.c */
-#line 1226 "util/configparser.y"
+#line 1336 "util/configparser.y"
{
OUTYY(("P(stub-first:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 242:
+ case 262:
/* Line 1792 of yacc.c */
-#line 1235 "util/configparser.y"
+#line 1345 "util/configparser.y"
{
OUTYY(("P(stub-prime:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 243:
+ case 263:
/* Line 1792 of yacc.c */
-#line 1245 "util/configparser.y"
+#line 1355 "util/configparser.y"
{
OUTYY(("P(name:%s)\n", (yyvsp[(2) - (2)].str)));
if(cfg_parser->cfg->forwards->name)
}
break;
- case 244:
+ case 264:
/* Line 1792 of yacc.c */
-#line 1255 "util/configparser.y"
+#line 1365 "util/configparser.y"
{
OUTYY(("P(forward-host:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->forwards->hosts, (yyvsp[(2) - (2)].str)))
}
break;
- case 245:
+ case 265:
/* Line 1792 of yacc.c */
-#line 1262 "util/configparser.y"
+#line 1372 "util/configparser.y"
{
OUTYY(("P(forward-addr:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->forwards->addrs, (yyvsp[(2) - (2)].str)))
}
break;
- case 246:
+ case 266:
/* Line 1792 of yacc.c */
-#line 1269 "util/configparser.y"
+#line 1379 "util/configparser.y"
{
OUTYY(("P(forward-first:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 247:
+ case 267:
/* Line 1792 of yacc.c */
-#line 1278 "util/configparser.y"
+#line 1388 "util/configparser.y"
{
OUTYY(("\nP(remote-control:)\n"));
}
break;
- case 258:
+ case 278:
/* Line 1792 of yacc.c */
-#line 1289 "util/configparser.y"
+#line 1399 "util/configparser.y"
{
OUTYY(("P(control_enable:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 259:
+ case 279:
/* Line 1792 of yacc.c */
-#line 1299 "util/configparser.y"
+#line 1409 "util/configparser.y"
{
OUTYY(("P(control_port:%s)\n", (yyvsp[(2) - (2)].str)));
if(atoi((yyvsp[(2) - (2)].str)) == 0)
}
break;
- case 260:
+ case 280:
/* Line 1792 of yacc.c */
-#line 1308 "util/configparser.y"
+#line 1418 "util/configparser.y"
{
OUTYY(("P(control_interface:%s)\n", (yyvsp[(2) - (2)].str)));
if(!cfg_strlist_insert(&cfg_parser->cfg->control_ifs, (yyvsp[(2) - (2)].str)))
}
break;
- case 261:
+ case 281:
/* Line 1792 of yacc.c */
-#line 1315 "util/configparser.y"
+#line 1425 "util/configparser.y"
{
OUTYY(("P(control_use_cert:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 262:
+ case 282:
/* Line 1792 of yacc.c */
-#line 1325 "util/configparser.y"
+#line 1435 "util/configparser.y"
{
OUTYY(("P(rc_server_key_file:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->server_key_file);
}
break;
- case 263:
+ case 283:
/* Line 1792 of yacc.c */
-#line 1332 "util/configparser.y"
+#line 1442 "util/configparser.y"
{
OUTYY(("P(rc_server_cert_file:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->server_cert_file);
}
break;
- case 264:
+ case 284:
/* Line 1792 of yacc.c */
-#line 1339 "util/configparser.y"
+#line 1449 "util/configparser.y"
{
OUTYY(("P(rc_control_key_file:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->control_key_file);
}
break;
- case 265:
+ case 285:
/* Line 1792 of yacc.c */
-#line 1346 "util/configparser.y"
+#line 1456 "util/configparser.y"
{
OUTYY(("P(rc_control_cert_file:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->control_cert_file);
}
break;
- case 266:
+ case 286:
/* Line 1792 of yacc.c */
-#line 1353 "util/configparser.y"
+#line 1463 "util/configparser.y"
{
OUTYY(("\nP(dnstap:)\n"));
}
break;
- case 281:
+ case 301:
/* Line 1792 of yacc.c */
-#line 1370 "util/configparser.y"
+#line 1480 "util/configparser.y"
{
OUTYY(("P(dt_dnstap_enable:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 282:
+ case 302:
/* Line 1792 of yacc.c */
-#line 1378 "util/configparser.y"
+#line 1488 "util/configparser.y"
{
OUTYY(("P(dt_dnstap_socket_path:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->dnstap_socket_path);
}
break;
- case 283:
+ case 303:
/* Line 1792 of yacc.c */
-#line 1385 "util/configparser.y"
+#line 1495 "util/configparser.y"
{
OUTYY(("P(dt_dnstap_send_identity:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 284:
+ case 304:
/* Line 1792 of yacc.c */
-#line 1393 "util/configparser.y"
+#line 1503 "util/configparser.y"
{
OUTYY(("P(dt_dnstap_send_version:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 285:
+ case 305:
/* Line 1792 of yacc.c */
-#line 1401 "util/configparser.y"
+#line 1511 "util/configparser.y"
{
OUTYY(("P(dt_dnstap_identity:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->dnstap_identity);
}
break;
- case 286:
+ case 306:
/* Line 1792 of yacc.c */
-#line 1408 "util/configparser.y"
+#line 1518 "util/configparser.y"
{
OUTYY(("P(dt_dnstap_version:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->dnstap_version);
}
break;
- case 287:
+ case 307:
/* Line 1792 of yacc.c */
-#line 1415 "util/configparser.y"
+#line 1525 "util/configparser.y"
{
OUTYY(("P(dt_dnstap_log_resolver_query_messages:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 288:
+ case 308:
/* Line 1792 of yacc.c */
-#line 1424 "util/configparser.y"
+#line 1534 "util/configparser.y"
{
OUTYY(("P(dt_dnstap_log_resolver_response_messages:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 289:
+ case 309:
/* Line 1792 of yacc.c */
-#line 1433 "util/configparser.y"
+#line 1543 "util/configparser.y"
{
OUTYY(("P(dt_dnstap_log_client_query_messages:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 290:
+ case 310:
/* Line 1792 of yacc.c */
-#line 1442 "util/configparser.y"
+#line 1552 "util/configparser.y"
{
OUTYY(("P(dt_dnstap_log_client_response_messages:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 291:
+ case 311:
/* Line 1792 of yacc.c */
-#line 1451 "util/configparser.y"
+#line 1561 "util/configparser.y"
{
OUTYY(("P(dt_dnstap_log_forwarder_query_messages:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 292:
+ case 312:
/* Line 1792 of yacc.c */
-#line 1460 "util/configparser.y"
+#line 1570 "util/configparser.y"
{
OUTYY(("P(dt_dnstap_log_forwarder_response_messages:%s)\n", (yyvsp[(2) - (2)].str)));
if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0)
}
break;
- case 293:
+ case 313:
/* Line 1792 of yacc.c */
-#line 1469 "util/configparser.y"
+#line 1579 "util/configparser.y"
{
OUTYY(("\nP(python:)\n"));
}
break;
- case 297:
+ case 317:
/* Line 1792 of yacc.c */
-#line 1478 "util/configparser.y"
+#line 1588 "util/configparser.y"
{
OUTYY(("P(python-script:%s)\n", (yyvsp[(2) - (2)].str)));
free(cfg_parser->cfg->python_script);
/* Line 1792 of yacc.c */
-#line 3893 "util/configparser.c"
+#line 4083 "util/configparser.c"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
/* Line 2055 of yacc.c */
-#line 1483 "util/configparser.y"
+#line 1593 "util/configparser.y"
/* parse helper routines could be here */
VAR_DNSTAP_LOG_CLIENT_QUERY_MESSAGES = 402,
VAR_DNSTAP_LOG_CLIENT_RESPONSE_MESSAGES = 403,
VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES = 404,
- VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES = 405
+ VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES = 405,
+ VAR_HARDEN_ALGO_DOWNGRADE = 406,
+ VAR_IP_TRANSPARENT = 407,
+ VAR_RATELIMIT = 408,
+ VAR_RATELIMIT_SLABS = 409,
+ VAR_RATELIMIT_SIZE = 410,
+ VAR_RATELIMIT_FOR_DOMAIN = 411,
+ VAR_RATELIMIT_BELOW_DOMAIN = 412,
+ VAR_RATELIMIT_FACTOR = 413,
+ VAR_CAPS_WHITELIST = 414,
+ VAR_CACHE_MAX_NEGATIVE_TTL = 415
};
#endif
/* Tokens. */
#define VAR_DNSTAP_LOG_CLIENT_RESPONSE_MESSAGES 403
#define VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES 404
#define VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES 405
+#define VAR_HARDEN_ALGO_DOWNGRADE 406
+#define VAR_IP_TRANSPARENT 407
+#define VAR_RATELIMIT 408
+#define VAR_RATELIMIT_SLABS 409
+#define VAR_RATELIMIT_SIZE 410
+#define VAR_RATELIMIT_FOR_DOMAIN 411
+#define VAR_RATELIMIT_BELOW_DOMAIN 412
+#define VAR_RATELIMIT_FACTOR 413
+#define VAR_CAPS_WHITELIST 414
+#define VAR_CACHE_MAX_NEGATIVE_TTL 415
/* Line 2058 of yacc.c */
-#line 362 "util/configparser.h"
+#line 382 "util/configparser.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
%token VAR_DNSTAP_LOG_CLIENT_RESPONSE_MESSAGES
%token VAR_DNSTAP_LOG_FORWARDER_QUERY_MESSAGES
%token VAR_DNSTAP_LOG_FORWARDER_RESPONSE_MESSAGES
+%token VAR_HARDEN_ALGO_DOWNGRADE VAR_IP_TRANSPARENT
+%token VAR_RATELIMIT VAR_RATELIMIT_SLABS VAR_RATELIMIT_SIZE
+%token VAR_RATELIMIT_FOR_DOMAIN VAR_RATELIMIT_BELOW_DOMAIN VAR_RATELIMIT_FACTOR
+%token VAR_CAPS_WHITELIST VAR_CACHE_MAX_NEGATIVE_TTL
%%
toplevelvars: /* empty */ | toplevelvars toplevelvar ;
server_minimal_responses | server_rrset_roundrobin | server_max_udp_size |
server_so_reuseport | server_delay_close | server_unblock_lan_zones |
server_dns64_prefix | server_dns64_synthall |
- server_infra_cache_min_rtt
+ server_infra_cache_min_rtt | server_harden_algo_downgrade |
+ server_ip_transparent | server_ratelimit | server_ratelimit_slabs |
+ server_ratelimit_size | server_ratelimit_for_domain |
+ server_ratelimit_below_domain | server_ratelimit_factor |
+ server_caps_whitelist | server_cache_max_negative_ttl
;
stubstart: VAR_STUB_ZONE
{
free($2);
}
;
+server_ip_transparent: VAR_IP_TRANSPARENT STRING_ARG
+ {
+ OUTYY(("P(server_ip_transparent:%s)\n", $2));
+ if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
+ yyerror("expected yes or no.");
+ else cfg_parser->cfg->ip_transparent =
+ (strcmp($2, "yes")==0);
+ free($2);
+ }
+ ;
server_edns_buffer_size: VAR_EDNS_BUFFER_SIZE STRING_ARG
{
OUTYY(("P(server_edns_buffer_size:%s)\n", $2));
free($2);
}
;
+server_harden_algo_downgrade: VAR_HARDEN_ALGO_DOWNGRADE STRING_ARG
+ {
+ OUTYY(("P(server_harden_algo_downgrade:%s)\n", $2));
+ if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
+ yyerror("expected yes or no.");
+ else cfg_parser->cfg->harden_algo_downgrade =
+ (strcmp($2, "yes")==0);
+ free($2);
+ }
+ ;
server_use_caps_for_id: VAR_USE_CAPS_FOR_ID STRING_ARG
{
OUTYY(("P(server_use_caps_for_id:%s)\n", $2));
free($2);
}
;
+server_caps_whitelist: VAR_CAPS_WHITELIST STRING_ARG
+ {
+ OUTYY(("P(server_caps_whitelist:%s)\n", $2));
+ if(!cfg_strlist_insert(&cfg_parser->cfg->caps_whitelist, $2))
+ yyerror("out of memory");
+ }
+ ;
server_private_address: VAR_PRIVATE_ADDRESS STRING_ARG
{
OUTYY(("P(server_private_address:%s)\n", $2));
free($2);
}
;
+server_cache_max_negative_ttl: VAR_CACHE_MAX_NEGATIVE_TTL STRING_ARG
+ {
+ OUTYY(("P(server_cache_max_negative_ttl:%s)\n", $2));
+ if(atoi($2) == 0 && strcmp($2, "0") != 0)
+ yyerror("number expected");
+ else cfg_parser->cfg->max_negative_ttl = atoi($2);
+ free($2);
+ }
+ ;
server_cache_min_ttl: VAR_CACHE_MIN_TTL STRING_ARG
{
OUTYY(("P(server_cache_min_ttl:%s)\n", $2));
strcmp($3, "refuse")!=0 && strcmp($3, "redirect")!=0 &&
strcmp($3, "transparent")!=0 && strcmp($3, "nodefault")!=0
&& strcmp($3, "typetransparent")!=0 &&
- strcmp($3, "inform")!=0)
+ strcmp($3, "inform")!=0 && strcmp($3, "inform_deny")!=0)
yyerror("local-zone type: expected static, deny, "
"refuse, redirect, transparent, "
- "typetransparent, inform or nodefault");
+ "typetransparent, inform, inform_deny "
+ "or nodefault");
else if(strcmp($3, "nodefault")==0) {
if(!cfg_strlist_insert(&cfg_parser->cfg->
local_zones_nodefault, $2))
free($2);
}
;
+server_ratelimit: VAR_RATELIMIT STRING_ARG
+ {
+ OUTYY(("P(server_ratelimit:%s)\n", $2));
+ if(atoi($2) == 0 && strcmp($2, "0") != 0)
+ yyerror("number expected");
+ else cfg_parser->cfg->ratelimit = atoi($2);
+ free($2);
+ }
+ ;
+server_ratelimit_size: VAR_RATELIMIT_SIZE STRING_ARG
+ {
+ OUTYY(("P(server_ratelimit_size:%s)\n", $2));
+ if(!cfg_parse_memsize($2, &cfg_parser->cfg->ratelimit_size))
+ yyerror("memory size expected");
+ free($2);
+ }
+ ;
+server_ratelimit_slabs: VAR_RATELIMIT_SLABS STRING_ARG
+ {
+ OUTYY(("P(server_ratelimit_slabs:%s)\n", $2));
+ if(atoi($2) == 0)
+ yyerror("number expected");
+ else {
+ cfg_parser->cfg->ratelimit_slabs = atoi($2);
+ if(!is_pow2(cfg_parser->cfg->ratelimit_slabs))
+ yyerror("must be a power of 2");
+ }
+ free($2);
+ }
+ ;
+server_ratelimit_for_domain: VAR_RATELIMIT_FOR_DOMAIN STRING_ARG STRING_ARG
+ {
+ OUTYY(("P(server_ratelimit_for_domain:%s %s)\n", $2, $3));
+ if(atoi($3) == 0 && strcmp($3, "0") != 0) {
+ yyerror("number expected");
+ } else {
+ if(!cfg_str2list_insert(&cfg_parser->cfg->
+ ratelimit_for_domain, $2, $3))
+ fatal_exit("out of memory adding "
+ "ratelimit-for-domain");
+ }
+ }
+ ;
+server_ratelimit_below_domain: VAR_RATELIMIT_BELOW_DOMAIN STRING_ARG STRING_ARG
+ {
+ OUTYY(("P(server_ratelimit_below_domain:%s %s)\n", $2, $3));
+ if(atoi($3) == 0 && strcmp($3, "0") != 0) {
+ yyerror("number expected");
+ } else {
+ if(!cfg_str2list_insert(&cfg_parser->cfg->
+ ratelimit_below_domain, $2, $3))
+ fatal_exit("out of memory adding "
+ "ratelimit-below-domain");
+ }
+ }
+ ;
+server_ratelimit_factor: VAR_RATELIMIT_FACTOR STRING_ARG
+ {
+ OUTYY(("P(server_ratelimit_factor:%s)\n", $2));
+ if(atoi($2) == 0 && strcmp($2, "0") != 0)
+ yyerror("number expected");
+ else cfg_parser->cfg->ratelimit_factor = atoi($2);
+ free($2);
+ }
+ ;
stub_name: VAR_NAME STRING_ARG
{
OUTYY(("P(name:%s)\n", $2));
#include "util/data/msgparse.h"
#include "util/log.h"
#include "util/storage/lookup3.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
/* determine length of a dname in buffer, no compression pointers allowed */
size_t
#include "util/log.h"
#include "util/regional.h"
#include "util/net_help.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
/** return code that means the function ran out of memory. negative so it does
* not conflict with DNS rcodes. */
#include "util/data/packed_rrset.h"
#include "util/storage/lookup3.h"
#include "util/regional.h"
-#include "ldns/rrdef.h"
-#include "ldns/sbuffer.h"
-#include "ldns/parseutil.h"
-#include "ldns/wire2str.h"
+#include "sldns/rrdef.h"
+#include "sldns/sbuffer.h"
+#include "sldns/parseutil.h"
+#include "sldns/wire2str.h"
/** smart comparison of (compressed, valid) dnames from packet */
static int
#ifndef UTIL_DATA_MSGPARSE_H
#define UTIL_DATA_MSGPARSE_H
#include "util/storage/lruhash.h"
-#include "ldns/pkthdr.h"
-#include "ldns/rrdef.h"
+#include "sldns/pkthdr.h"
+#include "sldns/rrdef.h"
struct sldns_buffer;
struct rrset_parse;
struct rr_parse;
extern time_t MAX_TTL;
/** Minimum TTL that is allowed. */
extern time_t MIN_TTL;
+/** Maximum Negative TTL that is allowed */
+extern time_t MAX_NEG_TTL;
/** Negative cache time (for entries without any RRs.) */
#define NORR_TTL 5 /* seconds */
#include "util/regional.h"
#include "util/data/msgparse.h"
#include "util/data/msgencode.h"
-#include "ldns/sbuffer.h"
-#include "ldns/wire2str.h"
+#include "sldns/sbuffer.h"
+#include "sldns/wire2str.h"
/** MAX TTL default for messages and rrsets */
time_t MAX_TTL = 3600 * 24 * 10; /* ten days */
/** MIN TTL default for messages and rrsets */
time_t MIN_TTL = 0;
+/** MAX Negative TTL, for SOA records in authority section */
+time_t MAX_NEG_TTL = 3600; /* one hour */
/** allocate qinfo, return 0 on error */
static int
/* rrset_count-1 because the first ref is part of the struct. */
size_t s = sizeof(struct reply_info) - sizeof(struct rrset_ref) +
sizeof(struct ub_packed_rrset_key*) * total;
+ if(total >= RR_COUNT_MAX) return NULL; /* sanity check on numRRS*/
if(region)
rep = (struct reply_info*)regional_alloc(region, s);
else rep = (struct reply_info*)malloc(s +
return 1;
}
+/** find the minimumttl in the rdata of SOA record */
+static time_t
+soa_find_minttl(struct rr_parse* rr)
+{
+ uint16_t rlen = sldns_read_uint16(rr->ttl_data+4);
+ if(rlen < 20)
+ return 0; /* rdata too small for SOA (dname, dname, 5*32bit) */
+ /* minimum TTL is the last 32bit value in the rdata of the record */
+ /* at position ttl_data + 4(ttl) + 2(rdatalen) + rdatalen - 4(timeval)*/
+ return (time_t)sldns_read_uint32(rr->ttl_data+6+rlen-4);
+}
+
/** do the rdata copy */
static int
rdata_copy(sldns_buffer* pkt, struct packed_rrset_data* data, uint8_t* to,
- struct rr_parse* rr, time_t* rr_ttl, uint16_t type)
+ struct rr_parse* rr, time_t* rr_ttl, uint16_t type,
+ sldns_pkt_section section)
{
uint16_t pkt_len;
const sldns_rr_descriptor* desc;
/* RFC 2181 Section 8. if msb of ttl is set treat as if zero. */
if(*rr_ttl & 0x80000000U)
*rr_ttl = 0;
+ if(type == LDNS_RR_TYPE_SOA && section == LDNS_SECTION_AUTHORITY) {
+ /* negative response. see if TTL of SOA record larger than the
+ * minimum-ttl in the rdata of the SOA record */
+ if(*rr_ttl > soa_find_minttl(rr))
+ *rr_ttl = soa_find_minttl(rr);
+ if(*rr_ttl > MAX_NEG_TTL)
+ *rr_ttl = MAX_NEG_TTL;
+ }
if(*rr_ttl < MIN_TTL)
*rr_ttl = MIN_TTL;
if(*rr_ttl < data->ttl)
data->rr_data[i] = nextrdata;
nextrdata += rr->size;
if(!rdata_copy(pkt, data, data->rr_data[i], rr,
- &data->rr_ttl[i], pset->type))
+ &data->rr_ttl[i], pset->type, pset->section))
return 0;
rr = rr->next;
}
data->rr_data[i] = nextrdata;
nextrdata += rr->size;
if(!rdata_copy(pkt, data, data->rr_data[i], rr,
- &data->rr_ttl[i], LDNS_RR_TYPE_RRSIG))
+ &data->rr_ttl[i], LDNS_RR_TYPE_RRSIG, pset->section))
return 0;
rr = rr->next;
}
struct packed_rrset_data** data, struct regional* region)
{
/* allocate */
- size_t s = sizeof(struct packed_rrset_data) +
+ size_t s;
+ if(pset->rr_count > RR_COUNT_MAX || pset->rrsig_count > RR_COUNT_MAX ||
+ pset->size > RR_COUNT_MAX)
+ return 0; /* protect against integer overflow */
+ s = sizeof(struct packed_rrset_data) +
(pset->rr_count + pset->rrsig_count) *
(sizeof(size_t)+sizeof(uint8_t*)+sizeof(time_t)) +
pset->size;
}
int
-reply_check_cname_chain(struct reply_info* rep)
+reply_check_cname_chain(struct query_info* qinfo, struct reply_info* rep)
{
/* check only answer section rrs for matching cname chain.
* the cache may return changed rdata, but owner names are untouched.*/
size_t i;
- uint8_t* sname = rep->rrsets[0]->rk.dname;
- size_t snamelen = rep->rrsets[0]->rk.dname_len;
+ uint8_t* sname = qinfo->qname;
+ size_t snamelen = qinfo->qname_len;
for(i=0; i<rep->an_numrrsets; i++) {
uint16_t t = ntohs(rep->rrsets[i]->rk.type);
if(t == LDNS_RR_TYPE_DNAME)
/**
* Check if cname chain in cached reply is still valid.
+ * @param qinfo: query info with query name.
* @param rep: reply to check.
* @return: true if valid, false if invalid.
*/
-int reply_check_cname_chain(struct reply_info* rep);
+int reply_check_cname_chain(struct query_info* qinfo, struct reply_info* rep);
/**
* Check security status of all RRs in the message.
#include "util/alloc.h"
#include "util/regional.h"
#include "util/net_help.h"
-#include "ldns/rrdef.h"
-#include "ldns/sbuffer.h"
-#include "ldns/wire2str.h"
+#include "sldns/rrdef.h"
+#include "sldns/sbuffer.h"
+#include "sldns/wire2str.h"
void
ub_packed_rrset_parsedelete(struct ub_packed_rrset_key* pkey,
* from the SOA in the answer section from a direct SOA query or ANY query. */
#define PACKED_RRSET_SOA_NEG 0x4
+/** number of rrs and rrsets for integer overflow protection. More than
+ * this is not really possible (64K packet has much less RRs and RRsets) in
+ * a message. And this is small enough that also multiplied there is no
+ * integer overflow. */
+#define RR_COUNT_MAX 0xffffff
+
/**
* The identifying information for an RRset.
*/
else if(fptr == &ub_rrset_sizefunc) return 1;
else if(fptr == &infra_sizefunc) return 1;
else if(fptr == &key_entry_sizefunc) return 1;
+ else if(fptr == &rate_sizefunc) return 1;
else if(fptr == &test_slabhash_sizefunc) return 1;
return 0;
}
else if(fptr == &ub_rrset_compare) return 1;
else if(fptr == &infra_compfunc) return 1;
else if(fptr == &key_entry_compfunc) return 1;
+ else if(fptr == &rate_compfunc) return 1;
else if(fptr == &test_slabhash_compfunc) return 1;
return 0;
}
else if(fptr == &ub_rrset_key_delete) return 1;
else if(fptr == &infra_delkeyfunc) return 1;
else if(fptr == &key_entry_delkeyfunc) return 1;
+ else if(fptr == &rate_delkeyfunc) return 1;
else if(fptr == &test_slabhash_delkey) return 1;
return 0;
}
else if(fptr == &rrset_data_delete) return 1;
else if(fptr == &infra_deldatafunc) return 1;
else if(fptr == &key_entry_deldatafunc) return 1;
+ else if(fptr == &rate_deldatafunc) return 1;
else if(fptr == &test_slabhash_deldata) return 1;
return 0;
}
1404,
1405,
1406,
-1407,
1408,
1409,
1410,
4321,
4322,
4323,
-4324,
4325,
4326,
4327,
4952,
4969,
4970,
+4980,
4986,
4987,
4988,
6072,
6073,
6074,
+6080,
6081,
6082,
6083,
6389,
6390,
6417,
+6419,
6420,
6421,
6443,
8379,
8380,
8383,
+8384,
8400,
8401,
8402,
8474,
8500,
8501,
+8503,
8554,
8555,
8567,
9000,
9001,
9002,
+9006,
9007,
9009,
9020,
10200,
10201,
10252,
+10253,
10260,
10288,
10439,
22005,
22273,
22305,
+22335,
22343,
22347,
22350,
40843,
40853,
41111,
+41230,
41794,
41795,
42508,
#include "config.h"
#include "util/log.h"
#include "util/locks.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
#include <stdarg.h>
#ifdef HAVE_TIME_H
#include <time.h>
ub_thread_key_set(logkey, num);
}
+int log_thread_get(void)
+{
+ unsigned int* tid;
+ if(!key_created) return 0;
+ tid = (unsigned int*)ub_thread_key_get(logkey);
+ return (int)(tid?*tid:0);
+}
+
void log_ident_set(const char* id)
{
ident = id;
*/
void log_thread_set(int* num);
+/**
+ * Get the thread id from logging system. Set after log_init is
+ * initialised, or log_thread_set for newly created threads.
+ * This initialisation happens in unbound as a daemon, in daemon
+ * startup code, when that spawns threads.
+ * @return thread number, from 0 and up. Before initialised, returns 0.
+ */
+int log_thread_get(void);
+
/**
* Set identity to print, default is 'unbound'.
* @param id: string to print. Name of executable.
#include "util/data/dname.h"
#include "util/module.h"
#include "util/regional.h"
-#include "ldns/parseutil.h"
-#include "ldns/wire2str.h"
+#include "sldns/parseutil.h"
+#include "sldns/wire2str.h"
#include <fcntl.h>
#ifdef HAVE_OPENSSL_SSL_H
#include <openssl/ssl.h>
static unsigned long
ub_crypto_id_cb(void)
{
- return (unsigned long)ub_thread_self();
+ return (unsigned long)log_thread_get();
}
static void
{
#if defined(HAVE_SSL) && defined(OPENSSL_THREADS) && !defined(THREADS_DISABLED)
int i;
- ub_openssl_locks = (lock_basic_t*)malloc(
- sizeof(lock_basic_t)*CRYPTO_num_locks());
+ ub_openssl_locks = (lock_basic_t*)reallocarray(
+ NULL, (size_t)CRYPTO_num_locks(), sizeof(lock_basic_t));
if(!ub_openssl_locks)
return 0;
for(i=0; i<CRYPTO_num_locks(); i++) {
#include "util/log.h"
#include "util/net_help.h"
#include "util/fptr_wlist.h"
-#include "ldns/pkthdr.h"
-#include "ldns/sbuffer.h"
+#include "sldns/pkthdr.h"
+#include "sldns/sbuffer.h"
#include "dnstap/dnstap.h"
#ifdef HAVE_OPENSSL_SSL_H
#include <openssl/ssl.h>
cmsg = CMSG_FIRSTHDR(&msg);
if(r->srctype == 4) {
#ifdef IP_PKTINFO
+ void* cmsg_data;
msg.msg_controllen = CMSG_SPACE(sizeof(struct in_pktinfo));
log_assert(msg.msg_controllen <= sizeof(control));
cmsg->cmsg_level = IPPROTO_IP;
cmsg->cmsg_type = IP_PKTINFO;
memmove(CMSG_DATA(cmsg), &r->pktinfo.v4info,
sizeof(struct in_pktinfo));
+ /* unset the ifindex to not bypass the routing tables */
+ cmsg_data = CMSG_DATA(cmsg);
+ ((struct in_pktinfo *) cmsg_data)->ipi_ifindex = 0;
cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo));
#elif defined(IP_SENDSRCADDR)
msg.msg_controllen = CMSG_SPACE(sizeof(struct in_addr));
msg.msg_control = NULL;
#endif /* IP_PKTINFO or IP_SENDSRCADDR */
} else if(r->srctype == 6) {
+ void* cmsg_data;
msg.msg_controllen = CMSG_SPACE(sizeof(struct in6_pktinfo));
log_assert(msg.msg_controllen <= sizeof(control));
cmsg->cmsg_level = IPPROTO_IPV6;
cmsg->cmsg_type = IPV6_PKTINFO;
memmove(CMSG_DATA(cmsg), &r->pktinfo.v6info,
sizeof(struct in6_pktinfo));
+ /* unset the ifindex to not bypass the routing tables */
+ cmsg_data = CMSG_DATA(cmsg);
+ ((struct in6_pktinfo *) cmsg_data)->ipi6_ifindex = 0;
cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
} else {
/* try to pass all 0 to use default route */
}
/* grab the tcp handler buffers */
+ c->cur_tcp_count++;
c->tcp_free = c_hdl->tcp_free;
if(!c->tcp_free) {
/* stop accepting incoming queries for now. */
comm_point_stop_listening(c);
}
- /* addr is dropped. Not needed for tcp reply. */
setup_tcp_handler(c_hdl, new_fd);
}
}
comm_point_close(c);
if(c->tcp_parent) {
+ c->tcp_parent->cur_tcp_count--;
c->tcp_free = c->tcp_parent->tcp_free;
c->tcp_parent->tcp_free = c;
if(!c->tcp_free) {
c->tcp_byte_count = 0;
c->tcp_parent = NULL;
c->max_tcp_count = 0;
+ c->cur_tcp_count = 0;
c->tcp_handlers = NULL;
c->tcp_free = NULL;
c->type = comm_udp;
c->tcp_byte_count = 0;
c->tcp_parent = NULL;
c->max_tcp_count = 0;
+ c->cur_tcp_count = 0;
c->tcp_handlers = NULL;
c->tcp_free = NULL;
c->type = comm_udp;
c->tcp_byte_count = 0;
c->tcp_parent = parent;
c->max_tcp_count = 0;
+ c->cur_tcp_count = 0;
c->tcp_handlers = NULL;
c->tcp_free = NULL;
c->type = comm_tcp;
c->tcp_byte_count = 0;
c->tcp_parent = NULL;
c->max_tcp_count = num;
+ c->cur_tcp_count = 0;
c->tcp_handlers = (struct comm_point**)calloc((size_t)num,
sizeof(struct comm_point*));
if(!c->tcp_handlers) {
c->tcp_byte_count = 0;
c->tcp_parent = NULL;
c->max_tcp_count = 0;
+ c->cur_tcp_count = 0;
c->tcp_handlers = NULL;
c->tcp_free = NULL;
c->type = comm_tcp;
c->tcp_byte_count = 0;
c->tcp_parent = NULL;
c->max_tcp_count = 0;
+ c->cur_tcp_count = 0;
c->tcp_handlers = NULL;
c->tcp_free = NULL;
c->type = comm_local;
c->tcp_byte_count = 0;
c->tcp_parent = NULL;
c->max_tcp_count = 0;
+ c->cur_tcp_count = 0;
c->tcp_handlers = NULL;
c->tcp_free = NULL;
c->type = comm_raw;
/* -------- TCP Accept -------- */
/** the number of TCP handlers for this tcp-accept socket */
int max_tcp_count;
+ /** current number of tcp handler in-use for this accept socket */
+ int cur_tcp_count;
/** malloced array of tcp handlers for a tcp-accept,
of size max_tcp_count. */
struct comm_point** tcp_handlers;
#include "services/mesh.h"
#include "services/cache/rrset.h"
#include "validator/val_kcache.h"
-#include "ldns/sbuffer.h"
-#include "ldns/wire2str.h"
-#include "ldns/str2wire.h"
-#include "ldns/keyraw.h"
-#include "ldns/rrdef.h"
+#include "sldns/sbuffer.h"
+#include "sldns/wire2str.h"
+#include "sldns/str2wire.h"
+#include "sldns/keyraw.h"
+#include "sldns/rrdef.h"
#include <stdarg.h>
#include <ctype.h>
verbose(VERB_ALGO, "autotrust: write to disk: %s", tempf);
out = fopen(tempf, "w");
if(!out) {
- log_err("could not open autotrust file for writing, %s: %s",
+ fatal_exit("could not open autotrust file for writing, %s: %s",
tempf, strerror(errno));
return;
}
/* failed to write contents (completely) */
fclose(out);
unlink(tempf);
- log_err("could not completely write: %s", fname);
+ fatal_exit("could not completely write: %s", fname);
return;
}
if(fclose(out) != 0) {
- log_err("could not complete write: %s: %s",
+ fatal_exit("could not complete write: %s: %s",
fname, strerror(errno));
unlink(tempf);
return;
(void)unlink(fname); /* windows does not replace file with rename() */
#endif
if(rename(tempf, fname) < 0) {
- log_err("rename(%s to %s): %s", tempf, fname, strerror(errno));
+ fatal_exit("rename(%s to %s): %s", tempf, fname, strerror(errno));
}
}
#include "util/log.h"
#include "util/net_help.h"
#include "util/config_file.h"
-#include "ldns/sbuffer.h"
-#include "ldns/rrdef.h"
-#include "ldns/str2wire.h"
+#include "sldns/sbuffer.h"
+#include "sldns/rrdef.h"
+#include "sldns/str2wire.h"
#ifdef HAVE_GLOB_H
#include <glob.h>
#endif
memset(pd, 0, sizeof(*pd));
pd->count = num;
pd->trust = rrset_trust_ultimate;
- pd->rr_len = (size_t*)malloc(num*sizeof(size_t));
+ pd->rr_len = (size_t*)reallocarray(NULL, num, sizeof(size_t));
if(!pd->rr_len) {
free(pd);
free(pkey->rk.dname);
free(pkey);
return NULL;
}
- pd->rr_ttl = (time_t*)malloc(num*sizeof(time_t));
+ pd->rr_ttl = (time_t*)reallocarray(NULL, num, sizeof(time_t));
if(!pd->rr_ttl) {
free(pd->rr_len);
free(pd);
free(pkey);
return NULL;
}
- pd->rr_data = (uint8_t**)malloc(num*sizeof(uint8_t*));
+ pd->rr_data = (uint8_t**)reallocarray(NULL, num, sizeof(uint8_t*));
if(!pd->rr_data) {
free(pd->rr_ttl);
free(pd->rr_len);
dname_str(ta->name, b);
log_warn("trust anchor %s has no supported algorithms,"
" the anchor is ignored (check if you need to"
- " upgrade unbound and openssl)", b);
+ " upgrade unbound and "
+#ifdef HAVE_LIBRESSL
+ "libressl"
+#else
+ "openssl"
+#endif
+ ")", b);
(void)rbtree_delete(anchors->tree, &ta->node);
lock_basic_unlock(&ta->lock);
anchors_delfunc(&ta->node, NULL);
#include "util/storage/lookup3.h"
#include "util/regional.h"
#include "util/net_help.h"
-#include "ldns/rrdef.h"
-#include "ldns/keyraw.h"
+#include "sldns/rrdef.h"
+#include "sldns/keyraw.h"
size_t
key_entry_sizefunc(void* key, void* data)
#include "util/config_file.h"
#include "services/cache/rrset.h"
#include "services/cache/dns.h"
-#include "ldns/rrdef.h"
-#include "ldns/sbuffer.h"
+#include "sldns/rrdef.h"
+#include "sldns/sbuffer.h"
int val_neg_data_compare(const void* a, const void* b)
{
#include "util/data/msgreply.h"
/* we include nsec.h for the bitmap_has_type function */
#include "validator/val_nsec.h"
-#include "ldns/sbuffer.h"
+#include "sldns/sbuffer.h"
/**
* This function we get from ldns-compat or from base system
#include "util/data/packed_rrset.h"
#include "validator/val_secalgo.h"
#include "util/log.h"
-#include "ldns/rrdef.h"
-#include "ldns/keyraw.h"
-#include "ldns/sbuffer.h"
+#include "sldns/rrdef.h"
+#include "sldns/keyraw.h"
+#include "sldns/sbuffer.h"
#if !defined(HAVE_SSL) && !defined(HAVE_NSS)
#error "Need crypto library to do digital signature cryptography"
#include "util/module.h"
#include "util/net_help.h"
#include "util/regional.h"
-#include "ldns/keyraw.h"
-#include "ldns/sbuffer.h"
-#include "ldns/parseutil.h"
-#include "ldns/wire2str.h"
+#include "sldns/keyraw.h"
+#include "sldns/sbuffer.h"
+#include "sldns/parseutil.h"
+#include "sldns/wire2str.h"
#include <ctype.h>
#if !defined(HAVE_SSL) && !defined(HAVE_NSS)
fd.rr_data = fdata;
rbtree_init(&sortree1, &canonical_tree_compare);
rbtree_init(&sortree2, &canonical_tree_compare);
+ if(d1->count > RR_COUNT_MAX || d2->count > RR_COUNT_MAX)
+ return 1; /* protection against integer overflow */
rrs1 = regional_alloc(region, sizeof(struct canon_rr)*d1->count);
rrs2 = regional_alloc(region, sizeof(struct canon_rr)*d2->count);
if(!rrs1 || !rrs2) return 1; /* alloc failure */
sizeof(rbtree_t));
if(!*sortree)
return 0;
+ if(d->count > RR_COUNT_MAX)
+ return 0; /* integer overflow protection */
rrs = regional_alloc(region, sizeof(struct canon_rr)*d->count);
if(!rrs) {
*sortree = NULL;
#include "util/regional.h"
#include "util/config_file.h"
#include "util/fptr_wlist.h"
-#include "ldns/rrdef.h"
-#include "ldns/wire2str.h"
+#include "sldns/rrdef.h"
+#include "sldns/wire2str.h"
/* forward decl for cache response and normal super inform calls of a DS */
static void process_ds_response(struct module_qstate* qstate,
sizeof(struct reply_info) - sizeof(struct rrset_ref));
if(!vq->chase_reply)
return NULL;
+ if(vq->orig_msg->rep->rrset_count > RR_COUNT_MAX)
+ return NULL; /* protect against integer overflow */
vq->chase_reply->rrsets = regional_alloc_init(qstate->region,
vq->orig_msg->rep->rrsets, sizeof(struct ub_packed_rrset_key*)
* vq->orig_msg->rep->rrset_count);
"has failed AUTHORITY rrset:", s->rk.dname,
ntohs(s->rk.type), ntohs(s->rk.rrset_class));
errinf(qstate, reason);
- errinf_rrset(qstate, s);
errinf_origin(qstate, qstate->reply_origin);
+ errinf_rrset(qstate, s);
chase_reply->security = sec_status_bogus;
return 0;
}
/**
* Init DLV check.
+ * DLV is going to be decommissioned, but the code is still here for some time.
+ *
* Called when a query is determined by other trust anchors to be insecure
* (or indeterminate). Then we look if there is a key in the DLV.
* Performs aggressive negative cache check to see if there is no key.
struct key_entry_key* kkey = NULL;
enum sec_status sec = sec_status_unchecked;
char* reason = NULL;
- int downprot = 1;
+ int downprot = qstate->env->cfg->harden_algo_downgrade;
if(!dnskey_rrset) {
log_nametypeclass(VERB_OPS, "failed to prime trust anchor -- "
Unbound is a recursive DNS server. It does caching, full recursion, stub\r
recursion, DNSSEC validation, NSEC3, IPv6. More information can be found \r
at the http://unbound.net site. Unbound has been built and tested on \r
-Windows XP, Vista and 7.\r
+Windows XP, Vista, 7 and 8.\r
\r
At http://unbound.net/documentation is an install and configuration manual\r
for windows.\r
*/
#include "config.h"
#include "libunbound/unbound.h"
-#include "ldns/rrdef.h"
-#include "ldns/pkthdr.h"
-#include "ldns/wire2str.h"
+#include "sldns/rrdef.h"
+#include "sldns/pkthdr.h"
+#include "sldns/wire2str.h"
/** usage */
static void
AddSize 2
sectionEnd
-# the /o means it is not selected by default.
-section /o "DLV - dlv.isc.org" SectionDLV
- # add estimated size for key (Kb)
- AddSize 2
- SetOutPath $INSTDIR
-
- # libgcc exception lib used by NSISdl plugin (in crosscompile).
- File /nonfatal "/oname=$PLUGINSDIR\libgcc_s_sjlj-1.dll" "/usr/i686-w64-mingw32/sys-root/mingw/bin/libgcc_s_sjlj-1.dll"
-
- NSISdl::download "http://ftp.isc.org/www/dlv/dlv.isc.org.key" "$INSTDIR\dlv.isc.org.key"
- Pop $R0 # result from Inetc::get
- ${If} $R0 != "success"
- MessageBox MB_OK|MB_ICONEXCLAMATION "Download error (ftp.isc.org: $R0), click OK to abort installation" /SD IDOK
- SetOutPath "C:\"
- RMDir "$INSTDIR" # doesnt work directory in use by us ...
- Abort
- ${EndIf}
-sectionEnd
-
section "-hidden.postinstall"
# copy files
setOutPath $INSTDIR
WriteRegStr HKLM "Software\Unbound" "RootAnchor" ""
${EndIf}
- # Store DLV choice
- SectionGetFlags ${SectionDLV} $R0
- IntOp $R0 $R0 & ${SF_SELECTED}
- ${If} $R0 == ${SF_SELECTED}
- ClearErrors
- FileOpen $R1 "$INSTDIR\service.conf" a
- IfErrors done_dlv
- FileSeek $R1 0 END
- FileWrite $R1 "$\nserver: dlv-anchor-file: $\"$INSTDIR\dlv.isc.org.key$\"$\n"
- FileClose $R1
- done_dlv:
- WriteRegStr HKLM "Software\Unbound" "CronAction" "$\"$INSTDIR\anchor-update.exe$\" dlv.isc.org $\"$INSTDIR\dlv.isc.org.key$\""
- ${Else}
- WriteRegStr HKLM "Software\Unbound" "CronAction" ""
- ${EndIf}
-
# store installation folder
WriteRegStr HKLM "Software\Unbound" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Unbound" "ConfigFile" "$INSTDIR\service.conf"
+ WriteRegStr HKLM "Software\Unbound" "CronAction" ""
WriteRegDWORD HKLM "Software\Unbound" "CronTime" 86400
# uninstaller
# set section descriptions
LangString DESC_unbound ${LANG_ENGLISH} "The base unbound DNS(SEC) validating caching resolver. $\r$\n$\r$\nStarted at boot from the Services control panel, logs to the Application Log, and the config file is its Program Files folder."
LangString DESC_rootkey ${LANG_ENGLISH} "Set up to use the DNSSEC root trust anchor. It is automatically updated. $\r$\n$\r$\nThis provides the main key that is used for security verification."
-LangString DESC_dlv ${LANG_ENGLISH} "Set up to use DLV with dlv.isc.org. Downloads the key during install. $\r$\n$\r$\nIt fetches additional public keys that are used for security verification by querying the isc.org server with names encountered."
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SectionUnbound} $(DESC_unbound)
!insertmacro MUI_DESCRIPTION_TEXT ${SectionRootKey} $(DESC_rootkey)
- !insertmacro MUI_DESCRIPTION_TEXT ${SectionDLV} $(DESC_dlv)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
# setup macros for uninstall functions.
Delete "$INSTDIR\unbound-website.url"
Delete "$INSTDIR\service.conf"
Delete "$INSTDIR\example.conf"
- Delete "$INSTDIR\dlv.isc.org.key"
Delete "$INSTDIR\root.key"
RMDir "$INSTDIR"