summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInternet Software Consortium, Inc <@isc.org>2007-09-07 14:08:40 -0600
committerLaMont Jones <lamont@debian.org>2007-09-07 14:08:40 -0600
commitc380ae240a9a3b5e71bfb604936b73aae6a49d5e (patch)
tree7b0bde489fb07de552f095d4616fccdd4386f89e
parent1430f0bc941f5280d1359e99a8db3f8cddf028ef (diff)
downloadbind9-c380ae240a9a3b5e71bfb604936b73aae6a49d5e.tar.gz
9.1.0b2
-rw-r--r--CHANGES181
-rw-r--r--FAQ43
-rw-r--r--Makefile.in2
-rw-r--r--README21
-rw-r--r--acconfig.h8
-rw-r--r--bin/Makefile.in4
-rw-r--r--bin/check/Makefile.in63
-rw-r--r--bin/check/check-tool.c56
-rw-r--r--bin/check/check-tool.h21
-rw-r--r--bin/check/named-checkconf.c87
-rw-r--r--bin/check/named-checkzone.c169
-rw-r--r--bin/dig/dig.c39
-rw-r--r--bin/dig/dighost.c46
-rw-r--r--bin/dig/host.c15
-rw-r--r--bin/dig/include/dig/dig.h4
-rw-r--r--bin/dig/nslookup.c76
-rw-r--r--bin/dnssec/Makefile.in7
-rw-r--r--bin/dnssec/dnssec-keygen.c4
-rw-r--r--bin/dnssec/dnssec-makekeyset.c4
-rw-r--r--bin/dnssec/dnssec-signkey.c18
-rw-r--r--bin/dnssec/dnssec-signzone.c677
-rw-r--r--bin/dnssec/dnssectool.c10
-rw-r--r--bin/named/Makefile.in10
-rw-r--r--bin/named/client.c4
-rw-r--r--bin/named/include/named/globals.h7
-rw-r--r--bin/named/include/named/omapi.h3
-rw-r--r--bin/named/include/named/server.h12
-rw-r--r--bin/named/interfacemgr.c32
-rw-r--r--bin/named/log.c16
-rw-r--r--bin/named/lwaddr.c16
-rw-r--r--bin/named/lwdgrbn.c170
-rw-r--r--bin/named/lwresd.c6
-rw-r--r--bin/named/lwsearch.c8
-rw-r--r--bin/named/main.c8
-rw-r--r--bin/named/notify.c6
-rw-r--r--bin/named/omapi.c11
-rw-r--r--bin/named/query.c46
-rw-r--r--bin/named/server.c104
-rw-r--r--bin/named/unix/os.c11
-rw-r--r--bin/named/update.c265
-rw-r--r--bin/named/xfrout.c15
-rw-r--r--bin/named/zoneconf.c11
-rw-r--r--bin/nsupdate/nsupdate.c108
-rw-r--r--bin/rndc/rndc.c7
-rw-r--r--bin/tests/adb_test.c4
-rw-r--r--bin/tests/db/t_db.c14
-rw-r--r--bin/tests/genrandom.c4
-rw-r--r--bin/tests/log_test.c5
-rw-r--r--bin/tests/names/dns_name_fromwire_1_data1
-rw-r--r--bin/tests/names/dns_name_fromwire_2_data1
-rw-r--r--bin/tests/names/dns_name_fromwire_3_data1
-rw-r--r--bin/tests/names/dns_name_fromwire_4_data1
-rw-r--r--bin/tests/names/dns_name_fromwire_5_data1
-rw-r--r--bin/tests/names/dns_name_fromwire_6_data1
-rw-r--r--bin/tests/names/dns_name_fromwire_7_data1
-rw-r--r--bin/tests/names/dns_name_fromwire_8_data1
-rw-r--r--bin/tests/names/dns_name_fromwire_9_data1
-rw-r--r--bin/tests/names/dns_name_towire_1_data1
-rw-r--r--bin/tests/names/dns_name_towire_2_data1
-rw-r--r--bin/tests/names/t_names.c4
-rw-r--r--bin/tests/rdata_test.c8
-rw-r--r--bin/tests/system/Makefile.in7
-rw-r--r--bin/tests/system/README6
-rw-r--r--bin/tests/system/common/controls.conf (renamed from bin/named/named.conf.test)16
-rw-r--r--bin/tests/system/common/rndc.conf (renamed from bin/tests/system/views/rndc.conf)2
-rw-r--r--bin/tests/system/common/root.hint20
-rw-r--r--bin/tests/system/glue/ns1/named.conf3
-rw-r--r--bin/tests/system/glue/ns1/namedopts1
-rw-r--r--bin/tests/system/lwresd/lwtest.c26
-rwxr-xr-xbin/tests/system/nsupdate/clean.sh5
-rw-r--r--bin/tests/system/nsupdate/ns1/example1.db159
-rwxr-xr-xbin/tests/system/nsupdate/setup.sh20
-rw-r--r--bin/tests/system/nsupdate/update_test.pl34
-rwxr-xr-xbin/tests/system/run.sh3
-rwxr-xr-xbin/tests/system/stress/clean.sh28
-rw-r--r--bin/tests/system/stress/ns1/named.conf35
-rw-r--r--bin/tests/system/stress/ns1/root.db40
-rw-r--r--bin/tests/system/stress/ns2/named.conf37
-rw-r--r--bin/tests/system/stress/ns3/named.conf53
-rw-r--r--bin/tests/system/stress/ns4/named.conf38
-rwxr-xr-xbin/tests/system/stress/setup.pl91
-rwxr-xr-xbin/tests/system/stress/setup.sh24
-rw-r--r--bin/tests/system/stress/tests.sh53
-rw-r--r--bin/tests/system/stress/update.pl107
-rw-r--r--bin/tests/system/views/ns2/named1.conf11
-rw-r--r--bin/tests/system/views/ns2/named2.conf11
-rw-r--r--bin/tests/system/views/tests.sh6
-rw-r--r--bin/tests/system/xfer/tests.sh16
-rwxr-xr-xbin/tests/update_test.pl400
-rw-r--r--config.h.in8
-rwxr-xr-xconfigure738
-rw-r--r--configure.in214
-rw-r--r--contrib/idn/mdnkit/ChangeLog192
-rw-r--r--contrib/idn/mdnkit/LICENSE.txt55
-rw-r--r--contrib/idn/mdnkit/Makefile.in87
-rw-r--r--contrib/idn/mdnkit/NEWS58
-rw-r--r--contrib/idn/mdnkit/README304
-rw-r--r--contrib/idn/mdnkit/README.ja300
-rw-r--r--contrib/idn/mdnkit/acconfig.h77
-rw-r--r--contrib/idn/mdnkit/aclocal.m4434
-rwxr-xr-xcontrib/idn/mdnkit/config.guess1183
-rwxr-xr-xcontrib/idn/mdnkit/config.sub1268
-rwxr-xr-xcontrib/idn/mdnkit/configure2411
-rw-r--r--contrib/idn/mdnkit/configure.in274
-rw-r--r--contrib/idn/mdnkit/dnsproxy/Makefile.in158
-rw-r--r--contrib/idn/mdnkit/dnsproxy/dnsproxy.8.in282
-rwxr-xr-xcontrib/idn/mdnkit/dnsproxy/dnsproxy.conf.sample170
-rw-r--r--contrib/idn/mdnkit/dnsproxy/dnsproxy.def3
-rw-r--r--contrib/idn/mdnkit/dnsproxy/dnsproxy.h192
-rw-r--r--contrib/idn/mdnkit/dnsproxy/logging.c294
-rw-r--r--contrib/idn/mdnkit/dnsproxy/message.c627
-rw-r--r--contrib/idn/mdnkit/dnsproxy/os2main.c138
-rw-r--r--contrib/idn/mdnkit/dnsproxy/proxycnf.c776
-rw-r--r--contrib/idn/mdnkit/dnsproxy/proxycnf.h119
-rw-r--r--contrib/idn/mdnkit/dnsproxy/server.c1409
-rw-r--r--contrib/idn/mdnkit/dnsproxy/translate.c521
-rw-r--r--contrib/idn/mdnkit/dnsproxy/unxmain.c288
-rw-r--r--contrib/idn/mdnkit/dnsproxy/winmain.c174
-rw-r--r--contrib/idn/mdnkit/dnsproxy/winserv.c446
-rw-r--r--contrib/idn/mdnkit/dnsproxy/winserv.h72
-rw-r--r--contrib/idn/mdnkit/include/Makefile.in73
-rw-r--r--contrib/idn/mdnkit/include/config.h123
-rw-r--r--contrib/idn/mdnkit/include/config.h.in122
-rw-r--r--contrib/idn/mdnkit/include/config.h.os285
-rw-r--r--contrib/idn/mdnkit/include/config.h.win85
-rw-r--r--contrib/idn/mdnkit/include/mdn/Makefile.in110
-rw-r--r--contrib/idn/mdnkit/include/mdn/assert.h69
-rw-r--r--contrib/idn/mdnkit/include/mdn/brace.h82
-rw-r--r--contrib/idn/mdnkit/include/mdn/converter.h234
-rw-r--r--contrib/idn/mdnkit/include/mdn/debug.h72
-rw-r--r--contrib/idn/mdnkit/include/mdn/dn.h117
-rw-r--r--contrib/idn/mdnkit/include/mdn/lace.h82
-rw-r--r--contrib/idn/mdnkit/include/mdn/localencoding.h85
-rw-r--r--contrib/idn/mdnkit/include/mdn/log.h113
-rw-r--r--contrib/idn/mdnkit/include/mdn/logmacro.h80
-rw-r--r--contrib/idn/mdnkit/include/mdn/msgheader.h113
-rw-r--r--contrib/idn/mdnkit/include/mdn/msgtrans.h130
-rw-r--r--contrib/idn/mdnkit/include/mdn/normalizer.h151
-rw-r--r--contrib/idn/mdnkit/include/mdn/race.h82
-rw-r--r--contrib/idn/mdnkit/include/mdn/res.h203
-rw-r--r--contrib/idn/mdnkit/include/mdn/resconf.h173
-rw-r--r--contrib/idn/mdnkit/include/mdn/result.h88
-rw-r--r--contrib/idn/mdnkit/include/mdn/selectiveencode.h85
-rw-r--r--contrib/idn/mdnkit/include/mdn/strhash.h131
-rw-r--r--contrib/idn/mdnkit/include/mdn/translator.h127
-rw-r--r--contrib/idn/mdnkit/include/mdn/unicode.h193
-rw-r--r--contrib/idn/mdnkit/include/mdn/unormalize.h100
-rw-r--r--contrib/idn/mdnkit/include/mdn/utf5.h96
-rw-r--r--contrib/idn/mdnkit/include/mdn/utf8.h143
-rw-r--r--contrib/idn/mdnkit/include/mdn/util.h101
-rw-r--r--contrib/idn/mdnkit/include/mdn/zldrule.h128
-rwxr-xr-xcontrib/idn/mdnkit/install-sh250
-rw-r--r--contrib/idn/mdnkit/lib/Makefile.in163
-rw-r--r--contrib/idn/mdnkit/lib/README82
-rw-r--r--contrib/idn/mdnkit/lib/brace.c775
-rw-r--r--contrib/idn/mdnkit/lib/converter.c994
-rw-r--r--contrib/idn/mdnkit/lib/debug.c180
-rw-r--r--contrib/idn/mdnkit/lib/dn.c341
-rw-r--r--contrib/idn/mdnkit/lib/lace.c570
-rw-r--r--contrib/idn/mdnkit/lib/localencoding.c195
-rw-r--r--contrib/idn/mdnkit/lib/log.c230
-rw-r--r--contrib/idn/mdnkit/lib/mdnres.conf.sample53
-rw-r--r--contrib/idn/mdnkit/lib/msgheader.c147
-rw-r--r--contrib/idn/mdnkit/lib/msgtrans.c633
-rw-r--r--contrib/idn/mdnkit/lib/normalizer.c867
-rw-r--r--contrib/idn/mdnkit/lib/race.c539
-rw-r--r--contrib/idn/mdnkit/lib/res.c285
-rw-r--r--contrib/idn/mdnkit/lib/resconf.c468
-rw-r--r--contrib/idn/mdnkit/lib/result.c88
-rw-r--r--contrib/idn/mdnkit/lib/selectiveencode.c140
-rw-r--r--contrib/idn/mdnkit/lib/strhash.c299
-rw-r--r--contrib/idn/mdnkit/lib/translator.c376
-rw-r--r--contrib/idn/mdnkit/lib/unicode.c625
-rw-r--r--contrib/idn/mdnkit/lib/unicodedata.c3209
-rw-r--r--contrib/idn/mdnkit/lib/unormalize.c459
-rw-r--r--contrib/idn/mdnkit/lib/utf5.c175
-rw-r--r--contrib/idn/mdnkit/lib/utf8.c292
-rw-r--r--contrib/idn/mdnkit/lib/util.c193
-rw-r--r--contrib/idn/mdnkit/lib/zldrule.c262
-rwxr-xr-xcontrib/idn/mdnkit/libtool4284
-rwxr-xr-xcontrib/idn/mdnkit/ltconfig3114
-rw-r--r--contrib/idn/mdnkit/ltmain.sh4024
-rw-r--r--contrib/idn/mdnkit/man/Makefile.in90
-rw-r--r--contrib/idn/mdnkit/man/mdnres.conf.5.in296
-rw-r--r--contrib/idn/mdnkit/patch/bind9/patch.configure1471
-rw-r--r--contrib/idn/mdnkit/patch/bind9/patch.most2177
-rw-r--r--contrib/idn/mdnkit/tools/Makefile.in73
-rw-r--r--contrib/idn/mdnkit/tools/mdnconv/Makefile.in109
-rw-r--r--contrib/idn/mdnkit/tools/mdnconv/README.ja117
-rw-r--r--contrib/idn/mdnkit/tools/mdnconv/mdnconv.1304
-rw-r--r--contrib/idn/mdnkit/tools/mdnconv/mdnconv.c397
-rw-r--r--contrib/idn/mdnkit/tools/mdnconv/util.c424
-rw-r--r--contrib/idn/mdnkit/tools/mdnconv/util.h72
-rw-r--r--contrib/idn/mdnkit/tools/rpm/dnsproxy.init42
-rw-r--r--contrib/idn/mdnkit/tools/rpm/mdnkit.spec116
-rw-r--r--contrib/idn/mdnkit/tools/runmdn/Makefile.in146
-rw-r--r--contrib/idn/mdnkit/tools/runmdn/ns_name.c695
-rw-r--r--contrib/idn/mdnkit/tools/runmdn/res_comp.c238
-rw-r--r--contrib/idn/mdnkit/tools/runmdn/runmdn.1160
-rw-r--r--contrib/idn/mdnkit/tools/runmdn/runmdn.in95
-rwxr-xr-xcontrib/idn/mdnkit/util/generate_normalize_data.pl910
-rw-r--r--contrib/linux/coredump-patch12
-rw-r--r--contrib/sdb/dirdb.c14
-rw-r--r--contrib/sdb/lookup.tcl21
-rw-r--r--contrib/sdb/pgsqldb.c4
-rw-r--r--contrib/sdb/tcldb.c14
-rw-r--r--contrib/sdb/timedb.c12
-rw-r--r--contrib/sdb/zonetodb.c4
-rw-r--r--doc/arm/Bv9ARM-book.xml76
-rw-r--r--doc/arm/Bv9ARM.ch03.html90
-rw-r--r--doc/arm/Bv9ARM.ch04.html56
-rw-r--r--doc/arm/Bv9ARM.ch05.html4
-rw-r--r--doc/arm/Bv9ARM.ch06.html236
-rw-r--r--doc/arm/Bv9ARM.ch07.html15
-rw-r--r--doc/arm/Bv9ARM.ch08.html14
-rw-r--r--doc/arm/Bv9ARM.ch09.html116
-rw-r--r--doc/arm/Bv9ARM.html116
-rw-r--r--doc/draft/draft-ietf-dhc-dhcp-dns-12.txt1072
-rw-r--r--doc/draft/draft-ietf-dhc-dhcp-dns-13.txt20
-rw-r--r--doc/draft/draft-ietf-dnsext-dhcid-rr-00.txt336
-rw-r--r--doc/draft/draft-ietf-dnsext-dhcid-rr-01.txt448
-rw-r--r--doc/draft/draft-ietf-dnsext-mdns-00.txt521
-rw-r--r--doc/draft/draft-ietf-enum-e164-gstn-np-00.txt2009
-rw-r--r--doc/draft/draft-ietf-enum-e164s2-np-00.txt1596
-rw-r--r--doc/draft/draft-ietf-enum-operation-01.txt882
-rw-r--r--doc/draft/draft-ietf-ipngwg-default-addr-select-01.txt695
-rw-r--r--doc/draft/draft-ietf-ipngwg-default-addr-select-02.txt1101
-rw-r--r--doc/draft/draft-klensin-1591-reflections-01.txt393
-rw-r--r--doc/draft/draft-manning-multicast-dns-02.txt419
-rw-r--r--doc/draft/draft-skwan-gss-tsig-06.txt11
-rw-r--r--doc/man/bin/named-checkconf.148
-rw-r--r--doc/man/bin/named-checkzone.161
-rw-r--r--doc/man/bin/rndc.conf.519
-rw-r--r--doc/man/dnssec/dnssec-signzone.812
-rw-r--r--doc/misc/migration6
-rw-r--r--doc/misc/options7
-rw-r--r--doc/rfc/index5
-rw-r--r--doc/rfc/rfc2317.txt563
-rw-r--r--doc/rfc/rfc2825.txt395
-rw-r--r--doc/rfc/rfc2826.txt339
-rw-r--r--doc/rfc/rfc2915.txt1011
-rw-r--r--lib/dns/Makefile.in16
-rw-r--r--lib/dns/adb.c185
-rw-r--r--lib/dns/cache.c8
-rw-r--r--lib/dns/config/confcommon.c27
-rw-r--r--lib/dns/config/confctl.c4
-rw-r--r--lib/dns/config/confctx.c67
-rw-r--r--lib/dns/config/confip.c100
-rw-r--r--lib/dns/config/confkeys.c3
-rw-r--r--lib/dns/config/confparser.y297
-rw-r--r--lib/dns/config/confview.c107
-rw-r--r--lib/dns/config/confzone.c125
-rw-r--r--lib/dns/diff.c530
-rw-r--r--lib/dns/dispatch.c11
-rw-r--r--lib/dns/dnssec.c4
-rw-r--r--lib/dns/forward.c6
-rw-r--r--lib/dns/gen.c4
-rw-r--r--lib/dns/include/dns/Makefile.in4
-rw-r--r--lib/dns/include/dns/compress.h5
-rw-r--r--lib/dns/include/dns/confcommon.h5
-rw-r--r--lib/dns/include/dns/confctx.h16
-rw-r--r--lib/dns/include/dns/confip.h6
-rw-r--r--lib/dns/include/dns/confview.h19
-rw-r--r--lib/dns/include/dns/confzone.h15
-rw-r--r--lib/dns/include/dns/db.h6
-rw-r--r--lib/dns/include/dns/diff.h274
-rw-r--r--lib/dns/include/dns/journal.h222
-rw-r--r--lib/dns/include/dns/log.h3
-rw-r--r--lib/dns/include/dns/lookup.h4
-rw-r--r--lib/dns/include/dns/master.h8
-rw-r--r--lib/dns/include/dns/name.h3
-rw-r--r--lib/dns/include/dns/rdata.h6
-rw-r--r--lib/dns/include/dns/rdataslab.h4
-rw-r--r--lib/dns/include/dns/result.h7
-rw-r--r--lib/dns/include/dns/sdb.h7
-rw-r--r--lib/dns/include/dns/validator.h6
-rw-r--r--lib/dns/include/dns/view.h69
-rw-r--r--lib/dns/include/dns/zone.h46
-rw-r--r--lib/dns/journal.c502
-rw-r--r--lib/dns/keytable.c6
-rw-r--r--lib/dns/log.c3
-rw-r--r--lib/dns/lookup.c80
-rw-r--r--lib/dns/master.c55
-rw-r--r--lib/dns/masterdump.c12
-rw-r--r--lib/dns/message.c10
-rw-r--r--lib/dns/name.c40
-rw-r--r--lib/dns/rbt.c14
-rw-r--r--lib/dns/rbtdb.c25
-rw-r--r--lib/dns/rdata.c22
-rw-r--r--lib/dns/rdataset.c10
-rw-r--r--lib/dns/rdataslab.c4
-rw-r--r--lib/dns/request.c92
-rw-r--r--lib/dns/resolver.c28
-rw-r--r--lib/dns/result.c9
-rw-r--r--lib/dns/sdb.c31
-rw-r--r--lib/dns/sec/dst/dst_api.c4
-rw-r--r--lib/dns/sec/dst/opensslrsa_link.c6
-rw-r--r--lib/dns/sec/openssl/rsa_oaep.c4
-rw-r--r--lib/dns/ssu.c4
-rw-r--r--lib/dns/stats.c4
-rw-r--r--lib/dns/tkey.c24
-rw-r--r--lib/dns/tsig.c49
-rw-r--r--lib/dns/validator.c37
-rw-r--r--lib/dns/view.c98
-rw-r--r--lib/dns/xfrin.c12
-rw-r--r--lib/dns/zone.c772
-rw-r--r--lib/dns/zt.c4
-rw-r--r--lib/isc/assertions.c14
-rw-r--r--lib/isc/commandline.c21
-rw-r--r--lib/isc/error.c11
-rw-r--r--lib/isc/include/isc/Makefile.in4
-rw-r--r--lib/isc/include/isc/buffer.h20
-rw-r--r--lib/isc/include/isc/lex.h17
-rw-r--r--lib/isc/include/isc/list.h38
-rw-r--r--lib/isc/include/isc/log.h63
-rw-r--r--lib/isc/include/isc/msgs.h181
-rw-r--r--lib/isc/include/isc/platform.h.in8
-rw-r--r--lib/isc/include/isc/print.h12
-rw-r--r--lib/isc/include/isc/result.h5
-rw-r--r--lib/isc/include/isc/symtab.h8
-rw-r--r--lib/isc/include/isc/util.h55
-rw-r--r--lib/isc/lex.c48
-rw-r--r--lib/isc/lib.c14
-rw-r--r--lib/isc/log.c153
-rw-r--r--lib/isc/mem.c108
-rw-r--r--lib/isc/netaddr.c7
-rw-r--r--lib/isc/nothreads/include/isc/Makefile.in4
-rw-r--r--lib/isc/nothreads/include/isc/thread.h4
-rw-r--r--lib/isc/print.c53
-rw-r--r--lib/isc/pthreads/condition.c7
-rw-r--r--lib/isc/pthreads/thread.c4
-rw-r--r--lib/isc/random.c3
-rw-r--r--lib/isc/result.c12
-rw-r--r--lib/isc/rwlock.c47
-rw-r--r--lib/isc/sockaddr.c34
-rw-r--r--lib/isc/task.c63
-rw-r--r--lib/isc/timer.c92
-rw-r--r--lib/isc/unix/app.c9
-rw-r--r--lib/isc/unix/entropy.c17
-rw-r--r--lib/isc/unix/file.c4
-rw-r--r--lib/isc/unix/ifiter_ioctl.c34
-rw-r--r--lib/isc/unix/ifiter_sysctl.c19
-rw-r--r--lib/isc/unix/include/isc/net.h22
-rw-r--r--lib/isc/unix/interfaceiter.c3
-rw-r--r--lib/isc/unix/net.c59
-rw-r--r--lib/isc/unix/resource.c12
-rw-r--r--lib/isc/unix/socket.c204
-rw-r--r--lib/lwres/getaddrinfo.c5
-rw-r--r--lib/lwres/getrrset.c12
-rw-r--r--lib/lwres/include/lwres/lwres.h3
-rw-r--r--lib/lwres/include/lwres/netdb.h.in4
-rw-r--r--lib/tests/t_api.c3
-rw-r--r--make/rules.in2
-rw-r--r--version4
354 files changed, 65644 insertions, 5670 deletions
diff --git a/CHANGES b/CHANGES
index e7f0b539..294f008e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,173 @@
+ --- 9.1.0b2 released ---
+
+ 641. [bug] $GENERATE caused a uninitialized link to be used.
+ [RT #595]
+
+ 640. [bug] Memory leak in error path could cause
+ "mpctx->allocated == 0" failure. [RT #584]
+
+ 639. [bug] Reading entropy from the keyboard would sometimes fail.
+ [RT #591]
+
+ 638. [port] lib/isc/random.c needed to explicitly include
+ time.h explicitly to get a prototype for time() when
+ pthreads was not being used. [RT #592]
+
+ 637. [port] Use isc_u?int64_t instead of (unsigned) long long in
+ lib/isc/print.c. Also allow lib/isc/print.c to
+ be compiled even if the platform does not need it.
+ [RT #592]
+
+ 636. [port] Shut up MSVC++ about a possible loss of precision
+ in the ISC__BUFFER_PUTUINT*() macros. [RT #592]
+
+ 635. [bug] Reloading a server with a configured blackhole list
+ would cause an assertion. [RT #590]
+
+ 634. [bug] A log file will completely stop being written when
+ it reaches the maximum size in all cases, not just
+ when versioning is also enabled. [RT #570]
+
+ 633. [port] Cope with rlim_t missing on BSD/OS systems. [RT #575]
+
+ 632. [bug] The index array of the journal file was
+ corrupted as it was written to disk.
+
+ 631. [port] Build without thread support on systems without
+ pthreads.
+
+ 630. [bug] Locking failure in zone code. [RT #582]
+
+ 629. [bug] 9.1.0b1 dereferenced a null pointer and crashed
+ when responding to a UDP IXFR request.
+
+ 628. [bug] If the root hints contained only AAAA addresses,
+ named would be unable to perform resolution.
+
+ 627. [bug] The EDNS0 blackhole detection code of changed 324
+ waited for three retransmissions to each server,
+ which takes much too long when a domain has many
+ name servers and all of them drop EDNS0 queries.
+ Now we retry without EDNS0 after three consecutive
+ timeouts, even if they are all from different
+ servers. [RT #143]
+
+ 626. [bug] The lightweight resolver daemon no longer crashes
+ when asked for a SIG rrset. [RT #558]
+
+ 625. [func] Zones now inherit their class from the enclosing view.
+
+ 624. [bug] The zone object could get timer events after it had
+ been destroyed, causing a server crash. [RT #571]
+
+ 623. [func] Added "named-checkconf" and "named-checkzone" program
+ for syntax checking named.conf files and zone files,
+ respectively.
+
+ 622. [bug] A canceled request could be destroyed before
+ dns_request_destroy() was called. [RT #562]
+
+ 621. [port] Disable IPv6 at runtime if IPv6 sockets are unusable.
+ This mostly affects Red Hat Linux 7.0, which has
+ conflicts between libc and the kernel.
+
+ 620. [bug] dns_master_load*inc() now require 'task' and 'load'
+ to be non-null. Also 'done' will not be called if
+ dns_master_load*inc() fails immediately. [RT #565]
+
+ 618. [bug] Queries to a signed zone could sometimes cause
+ an assertion failure.
+
+ 617. [bug] When using dynamic update to add a new RR to an
+ existing RRset with a different TTL, the journal
+ entries generated from the update did not include
+ explicit deletions and re-additions of the existing
+ RRs to update their TTL to the new value.
+
+ 616. [func] dnssec-signzone -t output now includes performance
+ statistics.
+
+ 615. [bug] dnssec-signzone did not like child keysets signed
+ by multiple keys.
+
+ 614. [bug] Checks for uninitialized link fields were prone
+ to false positives, causing assertion failures.
+ The checks are now disabled by default and may
+ be re-enabled by defining ISC_LIST_CHECKINIT.
+
+ 613. [bug] "rndc reload zone" now reloads primary zones.
+ It previously only updated slave and stub zones,
+ if an SOA query indicated an out of date serial.
+
+ 612. [cleanup] Shutup a ridiculously noisy HP-UX compiler that
+ complains relentlessly about how its treatment
+ of 'const' has changed as well as how casting
+ sometimes tightens alignment constraints.
+
+ 611. [func] allow-notify can be used to permit processing of
+ notify messages from hosts other than a slave's
+ masters.
+
+ 610. [func] rndc dumpdb is now supported.
+
+ 609. [bug] getrrsetbyname() would crash lwresd if the server
+ found more SIGs than answers. [RT #554]
+
+ 608. [func] dnssec-signzone now adds a comment to the zone
+ with the time the file was signed.
+
+ 607. [bug] nsupdate would fail if it encountered a CNAME or
+ DNAME in a response to an SOA query. [RT #515]
+
+ 606. [bug] Compiling with --disable-threads failed due
+ to isc_thread_self() being incorrectly defined
+ as an integer rather than a function.
+
+ 605. [func] New function isc_lex_getlasttokentext().
+
+ 604. [bug] The named.conf parser could print incorrect line
+ numbers when long comments were present.
+
+ 603. [bug] Make dig handle multiple types or classes on the same
+ query more correctly.
+
+ 602. [func] Cope automatically with UnixWare's broken
+ IN6_IS_ADDR_* macros. [RT #539]
+
+ 601. [func] Return a non-zero exit code if an update fails
+ in nsupdate.
+
+ 600. [bug] Reverse lookups sometimes failed in dig, etc...
+
+ 599. [func] Added four new functions to the libisc log API to
+ support i18n messages. isc_log_iwrite(),
+ isc_log_ivwrite(), isc_log_iwrite1() and
+ isc_log_ivwrite1() were added.
+
+ 598. [bug] An update-policy statement would cause the server
+ to assert while loading. [RT #536]
+
+ 597. [func] dnssec-signzone is now multithreaded.
+
+ 596. [bug] DNS_RDATASLAB_FORCE and DNS_RDATASLAB_EXACT are
+ not mutually exclusive.
+
+ 595. [port] On Linux 2.2, socket() returns EINVAL when it
+ should return EAFNOSUPPORT. Work around this.
+ [RT #531]
+
+ 594. [func] sdb drivers are now assumed to not be thread-safe
+ unless the DNS_SDBFLAG_THREADSAFE flag is supplied.
+
+ 593. [bug] If a secure zone was missing all its NXTs and
+ a dynamic update was attempted, the server entered
+ an infinite loop.
+
+ 592. [bug] The sig-validity-interval option now specifies a
+ number of days, not seconds. This matches the
+ documentation. [RT #529]
+
--- 9.1.0b1 released ---
591. [bug] Work around non-reentrancy in openssl by disabling
@@ -189,7 +358,7 @@
530. [func] New function dns_rdata_invalidate().
529. [bug] 521 contained a bug which caused zones to always
- reload. [RT #410]
+ reload. [RT #410]
528. [func] The ISC_LIST_XXXX macros now perform sanity checks
on their arguements. ISC_LIST_XXXXUNSAFE can be use
@@ -614,6 +783,8 @@
warning and then later throwing an assertion.
[RT #252]
+ 401. [func] Added simple database API.
+
400. [bug] SIG(0) signing and verifying was done incorrectly.
[RT #249]
@@ -809,6 +980,14 @@
dns_name_dup() when generating a TSIG
key using TKEY.
+ 341. [func] Support 'key' clause in named.conf zone masters
+ statement to allow authentication via TSIG keys:
+
+ masters {
+ 10.0.0.1 port 5353 key "foo";
+ 10.0.0.2 ;
+ };
+
340. [bug] The top-level COPYRIGHT file was missing from
the distribution.
diff --git a/FAQ b/FAQ
index 7d5c66d8..9cbec88f 100644
--- a/FAQ
+++ b/FAQ
@@ -49,10 +49,51 @@ number of threads running is n+4, where n is the number of CPUs.
Q: Why does BIND 9 log "permission denied" errors accessing its
-configuration files on my Linux sysetm even though it is running as
+configuration files on my Linux system even though it is running as
root?
A: On Linux, BIND 9 drops most of its root privileges on startup.
This including the privilege to open files owned by other users.
Therefore, if the server is running as root, the configuration files
should also be owned by root.
+
+
+Q: Why do I get errors like "dns_zone_load: zone foo/IN: loading master file
+bar: ran out of space"
+
+A: This is often caused by TXT records with missing close quotes. Check that
+all TXT records containing quoted strings have both open and close quotes.
+
+
+Q: How do I produce a useful core file on Linux?
+
+A: Apply the kernel patch found in bind9/linux/coredump-patch and rebuild
+the kernel. This patch causes multithreaded programs to dump the correct
+thread.
+
+
+Q: How do I restrict people from looking up the server version?
+
+A: Put a "version" option containing something other than the real
+version in the "options" section of named.conf. Note doing this will
+not prevent attacks and may impede people trying to diagnose problems
+with your server. Also it is possible to "fingerprint" nameservers to
+determine their version.
+
+
+Q: How do I restrict only remote users from looking up the server
+version?
+
+A: The following view statement will intercept lookups as the internal
+view that holds the version information will be matched last. The
+caveats of the previous answer still apply, of course.
+
+ view "chaos" chaos {
+ match-clients { <those to be refused>; };
+ allow-query { none; };
+ zone "." {
+ type hint;
+ file "/dev/null"; // or any empty file
+ };
+ };
+
diff --git a/Makefile.in b/Makefile.in
index 06062cc3..c57112f5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.34 2000/12/01 02:12:26 gson Exp $
+# $Id: Makefile.in,v 1.36 2000/12/15 08:28:43 gson Exp $
srcdir = @srcdir@
VPATH = @srcdir@
diff --git a/README b/README
index a9c1a717..fc2608af 100644
--- a/README
+++ b/README
@@ -45,10 +45,14 @@ BIND 9
-BIND 9.1.0b1
+BIND 9.1.0b2
- BIND 9.1.0b1 is the first beta release of BIND 9.1.0.
- It includes a number of new features:
+ BIND 9.1.0b2 is the second beta release of BIND 9.1.0.
+ It fixes a number of bugs in 9.1.0b1 and adds some new
+ features such as a multithreaded DNSSEC signer and
+ support for "rndc dumpdb" command.
+
+ Other features added since 9.0.x include:
- Many BIND 8 features previously unimplemented in BIND 9,
including domain-specific forwarding, the $GENERATE
@@ -59,7 +63,7 @@ BIND 9.1.0b1
by the "allow-update-forwarding" option
- A new, simplified database interface and a number of
- sample drivers based on it; see doc/dev/sdb for details
+ sample drivers based on it; see doc/misc/sdb for details
- Support for building single-threaded servers for
environments that do not supply POSIX threads
@@ -145,7 +149,7 @@ Building
HP-UX 11
IRIX64 6.5
NetBSD-current (with unproven-pthreads-0.17)
- Red Hat Linux 6.0, 6.1, 6.2
+ Red Hat Linux 6.0, 6.1, 6.2, 7.0
Solaris 2.6, 7, 8
Additionally, we have unverified reports of success building
@@ -154,8 +158,7 @@ Building
Slackware Linux 7.0 with 2.4.0-test6 kernel and glibc 2.1.3
Slackware Linux 7.0.1 with glibc 2.1.3
OpenBSD 2.6, 2.8, -current
- UnixWare 7.1.1 once the IN6_IS_ADDR_MULTICAST macro in
- /usr/include/netinet/in6_f.h is repaired (== vs =).
+ UnixWare 7.1.1
To build, just
@@ -210,6 +213,10 @@ Building
on your system, and some require Perl; see bin/tests/system/README
for details.
+ Linux systems do not provide useful core dumps for multithreaded
+ programs unless the kernel patch in contrib/linux/coredump-patch
+ has been applied. We recommend all Linux users to install this
+ patch so that any server crashes can be properly diagnosed.
Documentation
diff --git a/acconfig.h b/acconfig.h
index 864eedcc..de224abf 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: acconfig.h,v 1.29 2000/09/22 18:52:32 bwelling Exp $ */
+/* $Id: acconfig.h,v 1.31 2000/12/23 02:45:41 tale Exp $ */
/***
*** This file is not to be included by any public header files, because
@@ -78,6 +78,9 @@
/* define if flockfile() is available */
#undef HAVE_FLOCKFILE
+/* define if rlim_t is defined via sys/types.h or sys/resource.h */
+#undef HAVE_RLIM_T
+
/* Shut up warnings about sputaux in stdio.h on BSD/OS pre-4.1 */
#undef SHUTUP_SPUTAUX
#ifdef SHUTUP_SPUTAUX
@@ -111,3 +114,6 @@ int sigwait(const unsigned int *set, int *sig);
/* define if the system has a random number generating device */
#undef PATH_RANDOMDEV
+
+/* define if pthread_attr_getstacksize() is available */
+#undef HAVE_PTHREAD_ATTR_GETSTACKSIZE
diff --git a/bin/Makefile.in b/bin/Makefile.in
index 7046c918..759f33e0 100644
--- a/bin/Makefile.in
+++ b/bin/Makefile.in
@@ -13,13 +13,13 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.19 2000/08/01 01:11:11 tale Exp $
+# $Id: Makefile.in,v 1.21 2000/12/19 01:42:15 bwelling Exp $
srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
-SUBDIRS = named rndc dig dnssec tests nsupdate
+SUBDIRS = named rndc dig dnssec tests nsupdate check
TARGETS =
@BIND9_MAKE_RULES@
diff --git a/bin/check/Makefile.in b/bin/check/Makefile.in
new file mode 100644
index 00000000..7651c07c
--- /dev/null
+++ b/bin/check/Makefile.in
@@ -0,0 +1,63 @@
+# Copyright (C) 2000 Internet Software Consortium.
+#
+# 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 INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM 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.
+
+# $Id: Makefile.in,v 1.5 2000/12/22 17:25:56 gson Exp $
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+top_srcdir = @top_srcdir@
+
+@BIND9_INCLUDES@
+
+CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES}
+
+CDEFINES =
+CWARNINGS =
+
+DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_OPENSSL_LIBS@ @DNS_GSSAPI_LIBS@
+ISCLIBS = ../../lib/isc/libisc.@A@
+
+DNSDEPLIBS = ../../lib/dns/libdns.@A@
+ISCDEPLIBS = ../../lib/isc/libisc.@A@
+
+LIBS = @LIBS@
+
+SUBDIRS =
+
+# Alphabetically
+TARGETS = named-checkconf named-checkzone
+
+# Alphabetically
+SRCS = named-checkconf.c named-checkzone.c check-tool.c
+
+@BIND9_MAKE_RULES@
+
+named-checkconf: named-checkconf.@O@ check-tool.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
+ ${LIBTOOL} ${CC} ${CFLAGS} -o $@ named-checkconf.@O@ check-tool.@O@ \
+ ${DNSLIBS} ${ISCLIBS} ${LIBS}
+
+named-checkzone: named-checkzone.@O@ check-tool.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
+ ${LIBTOOL} ${CC} ${CFLAGS} -o $@ named-checkzone.@O@ check-tool.@O@ \
+ ${DNSLIBS} ${ISCLIBS} ${LIBS}
+
+clean distclean::
+ rm -f ${TARGETS}
+
+installdirs:
+ $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir}
+
+install:: named-checkconf named-checkzone
+ ${LIBTOOL} ${INSTALL_PROGRAM} named-checkconf ${DESTDIR}${sbindir}
+ ${LIBTOOL} ${INSTALL_PROGRAM} named-checkzone ${DESTDIR}${sbindir}
diff --git a/bin/check/check-tool.c b/bin/check/check-tool.c
new file mode 100644
index 00000000..842bf1d6
--- /dev/null
+++ b/bin/check/check-tool.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * 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 INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM 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.
+ */
+
+/* $Id: check-tool.c,v 1.2 2000/12/23 22:02:49 tale Exp $ */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "check-tool.h"
+#include <isc/util.h>
+
+#include <isc/log.h>
+#include <isc/types.h>
+
+#include <dns/log.h>
+
+isc_result_t
+setup_logging(isc_mem_t *mctx, isc_log_t **logp) {
+ isc_logdestination_t destination;
+ isc_logconfig_t *logconfig = NULL;
+ isc_log_t *log = NULL;
+
+ RUNTIME_CHECK(isc_log_create(mctx, &log, &logconfig) == ISC_R_SUCCESS);
+ isc_log_setcontext(log);
+ dns_log_init(log);
+ dns_log_setcontext(log);
+
+ destination.file.stream = stdout;
+ destination.file.name = NULL;
+ destination.file.versions = ISC_LOG_ROLLNEVER;
+ destination.file.maximum_size = 0;
+ RUNTIME_CHECK(isc_log_createchannel(logconfig, "stderr",
+ ISC_LOG_TOFILEDESC,
+ ISC_LOG_DYNAMIC,
+ &destination, 0) == ISC_R_SUCCESS);
+ RUNTIME_CHECK(isc_log_usechannel(logconfig, "stderr",
+ NULL, NULL) == ISC_R_SUCCESS);
+
+ *logp = log;
+ return (ISC_R_SUCCESS);
+}
diff --git a/bin/check/check-tool.h b/bin/check/check-tool.h
new file mode 100644
index 00000000..359ed55a
--- /dev/null
+++ b/bin/check/check-tool.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright
+ */
+
+/* $Id: check-tool.h,v 1.1 2000/12/14 21:33:11 marka Exp $ */
+
+#ifndef CHECK_TOOL_H
+#define CHECK_TOOL_H
+
+#include <isc/lang.h>
+
+#include <isc/types.h>
+
+ISC_LANG_BEGINDECLS
+
+isc_result_t
+setup_logging(isc_mem_t *mctx, isc_log_t **logp);
+
+ISC_LANG_ENDDECLS
+
+#endif
diff --git a/bin/check/named-checkconf.c b/bin/check/named-checkconf.c
new file mode 100644
index 00000000..40a34996
--- /dev/null
+++ b/bin/check/named-checkconf.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 1999, 2000 Internet Software Consortium.
+ *
+ * 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 INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM 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.
+ */
+
+/* $Id: named-checkconf.c,v 1.2 2000/12/19 19:53:58 gson Exp $ */
+
+#include <config.h>
+
+#include <errno.h>
+#include <stdlib.h>
+
+#include <isc/mem.h>
+#include <isc/string.h>
+#include <isc/util.h>
+
+#include <dns/log.h>
+#include <dns/namedconf.h>
+
+#include "check-tool.h"
+
+static isc_result_t
+zonecbk(dns_c_ctx_t *ctx, dns_c_zone_t *zone, dns_c_view_t *view, void *uap) {
+
+ UNUSED(ctx);
+ UNUSED(uap);
+ UNUSED(zone);
+ UNUSED(view);
+
+ return (ISC_R_SUCCESS);
+}
+
+static isc_result_t
+optscbk(dns_c_ctx_t *ctx, void *uap) {
+ UNUSED(ctx);
+ UNUSED(uap);
+
+ return (ISC_R_SUCCESS);
+}
+
+int
+main(int argc, char **argv) {
+ dns_c_ctx_t *configctx = NULL;
+ const char *conffile = NULL;
+ isc_mem_t *mctx = NULL;
+ dns_c_cbks_t callbacks;
+ isc_log_t *log = NULL;
+
+ callbacks.zonecbk = zonecbk;
+ callbacks.optscbk = optscbk;
+ callbacks.zonecbkuap = NULL;
+ callbacks.optscbkuap = NULL;
+
+ if (argc > 1)
+ conffile = argv[1];
+ if (conffile == NULL || conffile[0] == '\0')
+ conffile = "/etc/named.conf";
+
+ RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
+
+ RUNTIME_CHECK(setup_logging(mctx, &log) == ISC_R_SUCCESS);
+
+ if (dns_c_parse_namedconf(conffile, mctx, &configctx, &callbacks) !=
+ ISC_R_SUCCESS) {
+ exit(1);
+ }
+
+ dns_c_ctx_delete(&configctx);
+
+ isc_log_destroy(&log);
+
+ isc_mem_destroy(&mctx);
+
+ return (0);
+}
diff --git a/bin/check/named-checkzone.c b/bin/check/named-checkzone.c
new file mode 100644
index 00000000..0fbc9ff9
--- /dev/null
+++ b/bin/check/named-checkzone.c
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 1999, 2000 Internet Software Consortium.
+ *
+ * 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 INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM 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.
+ */
+
+/* $Id: named-checkzone.c,v 1.6 2000/12/21 22:11:03 gson Exp $ */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <isc/app.h>
+#include <isc/commandline.h>
+#include <isc/log.h>
+#include <isc/mem.h>
+#include <isc/socket.h>
+#include <isc/string.h>
+#include <isc/task.h>
+#include <isc/timer.h>
+#include <isc/util.h>
+
+#include <dns/db.h>
+#include <dns/fixedname.h>
+#include <dns/log.h>
+#include <dns/rdataclass.h>
+#include <dns/rdataset.h>
+#include <dns/result.h>
+#include <dns/zone.h>
+
+#include "check-tool.h"
+
+static int debug = 0;
+static int quiet = 0;
+static isc_mem_t *mctx = NULL;
+dns_zone_t *zone = NULL;
+dns_zonetype_t zonetype = dns_zone_master;
+static const char *dbtype[] = { "rbt" };
+
+#define ERRRET(result, function) \
+ do { \
+ if (result != ISC_R_SUCCESS) { \
+ if (!quiet) \
+ fprintf(stderr, "%s() returned %s\n", \
+ function, dns_result_totext(result)); \
+ return (result); \
+ } \
+ } while (0)
+
+static void
+usage(void) {
+ fprintf(stderr,
+ "usage: zone_test [-dq] [-c class] zone [filename]\n");
+ exit(1);
+}
+
+static isc_result_t
+setup(char *zonename, char *filename, char *classname) {
+ isc_result_t result;
+ dns_rdataclass_t rdclass;
+ isc_textregion_t region;
+ isc_buffer_t buffer;
+ dns_fixedname_t fixorigin;
+ dns_name_t *origin;
+
+ if (debug)
+ fprintf(stderr, "loading \"%s\" from \"%s\" class \"%s\"\n",
+ zonename, filename, classname);
+ result = dns_zone_create(&zone, mctx);
+ ERRRET(result, "dns_zone_new");
+
+ dns_zone_settype(zone, zonetype);
+
+ isc_buffer_init(&buffer, zonename, strlen(zonename));
+ isc_buffer_add(&buffer, strlen(zonename));
+ dns_fixedname_init(&fixorigin);
+ result = dns_name_fromtext(dns_fixedname_name(&fixorigin),
+ &buffer, dns_rootname, ISC_FALSE, NULL);
+ ERRRET(result, "dns_name_fromtext");
+ origin = dns_fixedname_name(&fixorigin);
+
+ result = dns_zone_setorigin(zone, origin);
+ ERRRET(result, "dns_zone_setorigin");
+
+ result = dns_zone_setdbtype(zone, 1, (const char * const *) dbtype);
+ ERRRET(result, "dns_zone_setdatabase");
+
+ result = dns_zone_setfile(zone, filename);
+ ERRRET(result, "dns_zone_setdatabase");
+
+ region.base = classname;
+ region.length = strlen(classname);
+ result = dns_rdataclass_fromtext(&rdclass, &region);
+ ERRRET(result, "dns_rdataclass_fromtext");
+
+ dns_zone_setclass(zone, rdclass);
+
+ result = dns_zone_load(zone);
+
+ return (result);
+}
+
+static void
+destroy(void) {
+ if (zone != NULL)
+ dns_zone_detach(&zone);
+}
+
+int
+main(int argc, char **argv) {
+ int c;
+ char *origin = NULL;
+ char *filename = NULL;
+ char *classname;
+ isc_log_t *lctx = NULL;
+ isc_result_t result;
+ char classname_in[] = "IN";
+
+ classname = classname_in;
+
+ while ((c = isc_commandline_parse(argc, argv, "c:dqs")) != EOF) {
+ switch (c) {
+ case 'c':
+ classname = isc_commandline_argument;
+ break;
+ case 'd':
+ debug++;
+ break;
+ case 'q':
+ quiet++;
+ break;
+ default:
+ usage();
+ }
+ }
+
+ if (argv[isc_commandline_index] == NULL)
+ usage();
+
+ RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
+ if (!quiet)
+ RUNTIME_CHECK(setup_logging(mctx, &lctx) == ISC_R_SUCCESS);
+
+ origin = argv[isc_commandline_index];
+ isc_commandline_index++;
+ if (argv[isc_commandline_index] != NULL)
+ filename = argv[isc_commandline_index];
+ else
+ filename = origin;
+ result = setup(origin, filename, (char *)classname);
+ if (!quiet && result == ISC_R_SUCCESS)
+ fprintf(stdout, "OK\n");
+ destroy();
+ if (lctx != NULL)
+ isc_log_destroy(&lctx);
+ isc_mem_destroy(&mctx);
+ return ((result == ISC_R_SUCCESS) ? 0 : 1);
+}
diff --git a/bin/dig/dig.c b/bin/dig/dig.c
index 480a852b..39b0dd25 100644
--- a/bin/dig/dig.c
+++ b/bin/dig/dig.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dig.c,v 1.129 2000/11/21 20:54:59 mws Exp $ */
+/* $Id: dig.c,v 1.131 2000/12/11 19:15:44 bwelling Exp $ */
#include <config.h>
#include <stdlib.h>
@@ -749,6 +749,7 @@ plus_option(char *option, isc_boolean_t is_batchfile,
lookup->section_authority = ISC_FALSE;
lookup->section_question = ISC_FALSE;
lookup->rdtype = dns_rdatatype_soa;
+ lookup->rdtypeset = ISC_TRUE;
short_form = ISC_TRUE;
}
break;
@@ -919,13 +920,20 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
specified_source = ISC_TRUE;
return (value_from_next);
case 'c':
+ if ((*lookup)->rdclassset) {
+ fprintf(stderr, ";; Warning, ignoring multiple "
+ "class options\n");
+ return (value_from_next);
+ }
*open_type_class = ISC_FALSE;
tr.base = value;
tr.length = strlen(value);
result = dns_rdataclass_fromtext(&rdclass,
(isc_textregion_t *)&tr);
- if (result == ISC_R_SUCCESS)
+ if (result == ISC_R_SUCCESS) {
(*lookup)->rdclass = rdclass;
+ (*lookup)->rdclassset = ISC_TRUE;
+ }
else
fprintf(stderr, ";; Warning, ignoring "
"invalid class %s\n",
@@ -942,9 +950,15 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
port = parse_int(value, "port number", MAXPORT);
return (value_from_next);
case 't':
+ if ((*lookup)->rdtypeset) {
+ fprintf(stderr, ";; Warning, ignoring multiple "
+ "type options\n");
+ return (value_from_next);
+ }
*open_type_class = ISC_FALSE;
if (strncasecmp(value, "ixfr=", 5) == 0) {
(*lookup)->rdtype = dns_rdatatype_ixfr;
+ (*lookup)->rdtypeset = ISC_TRUE;
(*lookup)->ixfr_serial =
parse_int(&value[5], "serial number",
MAXSERIAL);
@@ -958,6 +972,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
(isc_textregion_t *)&tr);
if (result == ISC_R_SUCCESS) {
(*lookup)->rdtype = rdtype;
+ (*lookup)->rdtypeset = ISC_TRUE;
if (rdtype == dns_rdatatype_axfr) {
(*lookup)->section_question = plusquest;
(*lookup)->comments = pluscomm;
@@ -990,10 +1005,12 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
sizeof((*lookup)->textname));
debug("looking up %s", (*lookup)->textname);
(*lookup)->trace_root = ISC_TF((*lookup)->trace ||
- (*lookup)->ns_search_only);
+ (*lookup)->ns_search_only);
(*lookup)->nibble = nibble;
(*lookup)->rdtype = dns_rdatatype_ptr;
+ (*lookup)->rdtypeset = ISC_TRUE;
(*lookup)->rdclass = dns_rdataclass_in;
+ (*lookup)->rdclassset = ISC_TRUE;
(*lookup)->new_search = ISC_TRUE;
ISC_LIST_APPEND(lookup_list, *lookup, link);
} else {
@@ -1147,6 +1164,7 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
tr.length = strlen(rv[0]);
if (strncmp(rv[0], "ixfr=", 5) == 0) {
lookup->rdtype = dns_rdatatype_ixfr;
+ lookup->rdtypeset = ISC_TRUE;
lookup->ixfr_serial =
parse_int(&rv[0][5],
"serial number",
@@ -1159,18 +1177,32 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
(isc_textregion_t *)&tr);
if ((result == ISC_R_SUCCESS) &&
(rdtype != dns_rdatatype_ixfr)) {
+ if (lookup->rdtypeset) {
+ fprintf(stderr, ";; Warning, "
+ "ignoring multiple "
+ "type options\n");
+ continue;
+ }
if (rdtype == dns_rdatatype_axfr) {
lookup->section_question =
plusquest;
lookup->comments = pluscomm;
}
lookup->rdtype = rdtype;
+ lookup->rdtypeset = ISC_TRUE;
continue;
}
result = dns_rdataclass_fromtext(&rdclass,
(isc_textregion_t *)&tr);
if (result == ISC_R_SUCCESS) {
+ if (lookup->rdclassset) {
+ fprintf(stderr, ";; Warning, "
+ "ignoring multiple "
+ "class options\n");
+ continue;
+ }
lookup->rdclass = rdclass;
+ lookup->rdclassset = ISC_TRUE;
continue;
}
}
@@ -1241,6 +1273,7 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
lookup->new_search = ISC_TRUE;
strcpy(lookup->textname, ".");
lookup->rdtype = dns_rdatatype_ns;
+ lookup->rdtypeset = ISC_TRUE;
printgreeting(argc, argv, lookup);
ISC_LIST_APPEND(lookup_list, lookup, link);
}
diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c
index 75375094..e2523592 100644
--- a/bin/dig/dighost.c
+++ b/bin/dig/dighost.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dighost.c,v 1.168 2000/12/02 05:13:37 gson Exp $ */
+/* $Id: dighost.c,v 1.174 2000/12/11 19:15:45 bwelling Exp $ */
/*
* Notice to programmers: Do not use this code as an example of how to
@@ -132,14 +132,14 @@ isc_uint32_t rr_limit = INT_MAX;
* Can I get rid of these using shutdown events? XXX
*/
#define LOCK_LOOKUP {\
- debug("lock_lookup %s:%d", __FILE__, __LINE__);\
- check_result(isc_mutex_lock((&lookup_lock)), "isc_mutex_lock");\
- debug("success");\
+ debug("lock_lookup %s:%d", __FILE__, __LINE__);\
+ check_result(isc_mutex_lock((&lookup_lock)), "isc_mutex_lock");\
+ debug("success");\
}
#define UNLOCK_LOOKUP {\
- debug("unlock_lookup %s:%d", __FILE__, __LINE__);\
- check_result(isc_mutex_unlock((&lookup_lock)),\
- "isc_mutex_unlock");\
+ debug("unlock_lookup %s:%d", __FILE__, __LINE__);\
+ check_result(isc_mutex_unlock((&lookup_lock)),\
+ "isc_mutex_unlock");\
}
static void
@@ -161,7 +161,7 @@ next_token(char **stringp, const char *delim) {
break;
} while (*res == '\0');
return (res);
-}
+}
static int
count_dots(char *string) {
@@ -196,13 +196,14 @@ hex_dump(isc_buffer_t *b) {
isc_result_t
-get_reverse(char reverse[MXNAME], char *value, isc_boolean_t nibble) {
+get_reverse(char *reverse, char *value, isc_boolean_t nibble) {
int adrs[4];
char working[MXNAME];
int i, n;
isc_result_t result;
result = DNS_R_BADDOTTEDQUAD;
+ reverse[0] = 0;
debug("get_reverse(%s)", value);
if (strspn(value, "0123456789.") == strlen(value)) {
@@ -339,8 +340,10 @@ make_empty_lookup(void) {
looknew->pending = ISC_TRUE;
looknew->textname[0] = 0;
looknew->cmdline[0] = 0; /* Not copied in clone_lookup! */
- looknew->rdtype = dns_rdatatype_a;
- looknew->rdclass = dns_rdataclass_in;
+ looknew->rdtype = dns_rdatatype_none;
+ looknew->rdclass = dns_rdataclass_none;
+ looknew->rdtypeset = ISC_FALSE;
+ looknew->rdclassset = ISC_FALSE;
looknew->sendspace = NULL;
looknew->sendmsg = NULL;
looknew->name = NULL;
@@ -404,6 +407,8 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
looknew->textname[MXNAME-1]=0;
looknew->rdtype = lookold->rdtype;
looknew->rdclass = lookold->rdclass;
+ looknew->rdtypeset = lookold->rdtypeset;
+ looknew->rdclassset = lookold->rdclassset;
looknew->doing_xfr = lookold->doing_xfr;
looknew->ixfr_serial = lookold->ixfr_serial;
looknew->defname = lookold->defname;
@@ -416,7 +421,7 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
looknew->dnssec = lookold->dnssec;
looknew->udpsize = lookold->udpsize;
looknew->recurse = lookold->recurse;
- looknew->aaonly = lookold->aaonly;
+ looknew->aaonly = lookold->aaonly;
looknew->adflag = lookold->adflag;
looknew->cdflag = lookold->cdflag;
looknew->ns_search_only = lookold->ns_search_only;
@@ -637,7 +642,7 @@ setup_system(void) {
ptr,
MXNAME);
search->origin[MXNAME-1]=0;
- ISC_LIST_APPENDUNSAFE
+ ISC_LIST_INITANDAPPEND
(search_list,
search,
link);
@@ -661,7 +666,7 @@ setup_system(void) {
ptr,
MXNAME - 1);
search->origin[MXNAME-1]=0;
- ISC_LIST_PREPENDUNSAFE
+ ISC_LIST_INITANDPREPEND
(search_list,
search,
link);
@@ -1005,7 +1010,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query,
if ((section == DNS_SECTION_ANSWER) &&
(query->lookup->trace || query->lookup->ns_search_only))
followup_lookup(msg, query, DNS_SECTION_AUTHORITY);
- return;
+ return;
}
debug("following up %s", query->lookup->textname);
@@ -1383,6 +1388,15 @@ setup_lookup(dig_lookup_t *lookup) {
*/
lookup->tcp_mode = ISC_TRUE;
}
+
+ /*
+ * Change NONE lookups to something meaningful.
+ */
+ if (!lookup->rdtypeset)
+ lookup->rdtype = dns_rdatatype_a;
+ if (!lookup->rdclassset)
+ lookup->rdclass = dns_rdataclass_in;
+
add_question(lookup->sendmsg, lookup->name, lookup->rdclass,
lookup->rdtype);
@@ -2672,7 +2686,7 @@ destroy_libs(void) {
if (taskmgr != NULL) {
debug("freeing taskmgr");
isc_taskmgr_destroy(&taskmgr);
- }
+ }
LOCK_LOOKUP;
REQUIRE(sockcount == 0);
REQUIRE(recvcount == 0);
diff --git a/bin/dig/host.c b/bin/dig/host.c
index ba8dd6aa..1023fbcc 100644
--- a/bin/dig/host.c
+++ b/bin/dig/host.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: host.c,v 1.59 2000/10/31 03:21:38 marka Exp $ */
+/* $Id: host.c,v 1.60 2000/12/08 17:06:49 mws Exp $ */
#include <config.h>
#include <stdlib.h>
@@ -560,6 +560,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
case 'l':
lookup->tcp_mode = ISC_TRUE;
lookup->rdtype = dns_rdatatype_axfr;
+ lookup->rdtypeset = ISC_TRUE;
break;
case 'v':
case 'd':
@@ -577,8 +578,10 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
if (result != ISC_R_SUCCESS)
fprintf (stderr,"Warning: invalid type: %s\n",
isc_commandline_argument);
- else
+ else {
lookup->rdtype = rdtype;
+ lookup->rdtypeset = ISC_TRUE;
+ }
break;
case 'c':
tr.base = isc_commandline_argument;
@@ -589,11 +592,14 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
if (result != ISC_R_SUCCESS)
fprintf (stderr,"Warning: invalid class: %s\n",
isc_commandline_argument);
- else
+ else {
lookup->rdclass = rdclass;
+ lookup->rdclassset = ISC_TRUE;
+ }
break;
case 'a':
lookup->rdtype = dns_rdatatype_any;
+ lookup->rdtypeset = ISC_TRUE;
short_form = ISC_FALSE;
break;
case 'n':
@@ -622,7 +628,9 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
case 'C':
debug("showing all SOAs");
lookup->rdtype = dns_rdatatype_soa;
+ lookup->rdtypeset = ISC_TRUE;
lookup->rdclass = dns_rdataclass_in;
+ lookup->rdclassset = ISC_TRUE;
lookup->ns_search_only = ISC_TRUE;
lookup->trace_root = ISC_TRUE;
break;
@@ -653,6 +661,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
strncpy(lookup->textname, store, sizeof(lookup->textname));
lookup->textname[sizeof(lookup->textname)-1] = 0;
lookup->rdtype = dns_rdatatype_ptr;
+ lookup->rdtypeset = ISC_TRUE;
} else {
strncpy(lookup->textname, hostname, sizeof(lookup->textname));
lookup->textname[sizeof(lookup->textname)-1]=0;
diff --git a/bin/dig/include/dig/dig.h b/bin/dig/include/dig/dig.h
index 11c5b50c..e78e8ccf 100644
--- a/bin/dig/include/dig/dig.h
+++ b/bin/dig/include/dig/dig.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dig.h,v 1.59 2000/11/21 21:40:12 mws Exp $ */
+/* $Id: dig.h,v 1.60 2000/12/08 17:06:52 mws Exp $ */
#ifndef DIG_H
#define DIG_H
@@ -108,6 +108,8 @@ struct dig_lookup {
char cmdline[MXNAME];
dns_rdatatype_t rdtype;
dns_rdataclass_t rdclass;
+ isc_boolean_t rdtypeset;
+ isc_boolean_t rdclassset;
char namespace[BUFSIZE];
char onamespace[BUFSIZE];
isc_buffer_t namebuf;
diff --git a/bin/dig/nslookup.c b/bin/dig/nslookup.c
index ffcc569c..b0b78908 100644
--- a/bin/dig/nslookup.c
+++ b/bin/dig/nslookup.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: nslookup.c,v 1.63 2000/10/31 03:21:39 marka Exp $ */
+/* $Id: nslookup.c,v 1.69 2000/12/11 19:15:46 bwelling Exp $ */
#include <config.h>
@@ -110,16 +110,16 @@ static const char *rtypetext[] = {
"md = ", /* 3 */
"mf = ", /* 4 */
"canonical name = ", /* 5 */
- "soa = ", /* 6 */
- "mb = ", /* 7 */
- "mg = ", /* 8 */
- "mr = ", /* 9 */
- "rtype_10 = ", /* 10 */
+ "soa = ", /* 6 */
+ "mb = ", /* 7 */
+ "mg = ", /* 8 */
+ "mr = ", /* 9 */
+ "rtype_10 = ", /* 10 */
"protocol = ", /* 11 */
"name = ", /* 12 */
"hinfo = ", /* 13 */
"minfo = ", /* 14 */
- "mail exchanger = ", /* 15 */
+ "mail exchanger = ", /* 15 */
"text = ", /* 16 */
"rp = ", /* 17 */
"afsdb = ", /* 18 */
@@ -130,32 +130,27 @@ static const char *rtypetext[] = {
"nsap_ptr = ", /* 23 */
"signature = ", /* 24 */
"key = ", /* 25 */
- "px = ", /* 26 */
- "gpos = ", /* 27 */
- "has AAAA address", /* 28 */
- "loc = ", /* 29 */
+ "px = ", /* 26 */
+ "gpos = ", /* 27 */
+ "has AAAA address", /* 28 */
+ "loc = ", /* 29 */
"next = ", /* 30 */
"rtype_31 = ", /* 31 */
"rtype_32 = ", /* 32 */
- "service = ", /* 33 */
+ "service = ", /* 33 */
"rtype_34 = ", /* 34 */
"naptr = ", /* 35 */
"kx = ", /* 36 */
"cert = ", /* 37 */
"v6 address = ", /* 38 */
"dname = ", /* 39 */
- "rtype_40 = ", /* 40 */
+ "rtype_40 = ", /* 40 */
"optional = "}; /* 41 */
static void flush_lookup_list(void);
static void getinput(isc_task_t *task, isc_event_t *event);
-static void
-show_usage(void) {
- fputs("Usage:\n", stderr);
-}
-
void
dighost_shutdown(void) {
isc_event_t *event = global_event;
@@ -351,6 +346,7 @@ detailsection(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers,
dns_name_t *name;
dns_rdataset_t *rdataset = NULL;
dns_rdata_t rdata = DNS_RDATA_INIT;
+ char namestore[DNS_NAME_MAXTEXT + 1]; /* Leave room for the NULL */
char *ptr;
char *input;
@@ -389,6 +385,19 @@ detailsection(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers,
for (rdataset = ISC_LIST_HEAD(name->list);
rdataset != NULL;
rdataset = ISC_LIST_NEXT(rdataset, link)) {
+ if (section == DNS_SECTION_QUESTION) {
+ dns_name_format(name, namestore,
+ sizeof(namestore));
+ printf("\t%s, ", namestore);
+ dns_rdatatype_format(rdataset->type,
+ namestore,
+ sizeof(namestore));
+ printf("type = %s, ", namestore);
+ dns_rdataclass_format(rdataset->rdclass,
+ namestore,
+ sizeof(namestore));
+ printf("class = %s\n", namestore);
+ }
loopresult = dns_rdataset_first(rdataset);
while (loopresult == ISC_R_SUCCESS) {
dns_rdataset_current(rdataset, &rdata);
@@ -550,6 +559,7 @@ show_settings(isc_boolean_t full, isc_boolean_t serv_only) {
isc_sockaddr_t sockaddr;
isc_buffer_t *b = NULL;
isc_result_t result;
+ dig_searchlist_t *listent;
srv = ISC_LIST_HEAD(server_list);
@@ -580,7 +590,13 @@ show_settings(isc_boolean_t full, isc_boolean_t serv_only) {
printf("\t timeout = %d\t\tretry = %d\tport = %d\n",
timeout, tries, port);
printf("\t querytype = %-8s\tclass = %s\n", deftype, defclass);
- printf("\t domain = %s\n", fixeddomain);
+ if (fixeddomain[0] != 0)
+ printf("\t domain = %s\n", fixeddomain);
+ else if (!ISC_LIST_EMPTY(search_list)) {
+ listent = ISC_LIST_HEAD(search_list);
+ printf("\t domain = %s\n", listent->origin);
+ } else
+ printf("\t domain =\n");
}
@@ -637,7 +653,7 @@ setoption(char *opt) {
safecpy(defclass, &opt[3], MXRD);
} else if (strncasecmp(opt, "type=", 5) == 0) {
if (testtype(&opt[5]))
- safecpy(deftype, &opt[3], MXRD);
+ safecpy(deftype, &opt[5], MXRD);
} else if (strncasecmp(opt, "ty=", 3) == 0) {
if (testtype(&opt[3]))
safecpy(deftype, &opt[3], MXRD);
@@ -664,6 +680,10 @@ setoption(char *opt) {
timeout = atoi(&opt[8]);
} else if (strncasecmp(opt, "t=", 2) == 0) {
timeout = atoi(&opt[2]);
+ } else if (strncasecmp(opt, "rec", 3) == 0) {
+ recurse = ISC_TRUE;
+ } else if (strncasecmp(opt, "norec", 5) == 0) {
+ recurse = ISC_FALSE;
} else if (strncasecmp(opt, "retry=", 6) == 0) {
tries = atoi(&opt[6]);
} else if (strncasecmp(opt, "ret=", 4) == 0) {
@@ -695,7 +715,7 @@ setoption(char *opt) {
}
}
-static dig_lookup_t*
+static void
addlookup(char *opt) {
dig_lookup_t *lookup;
isc_result_t result;
@@ -723,11 +743,14 @@ addlookup(char *opt) {
if (get_reverse(store, opt, lookup->nibble) == ISC_R_SUCCESS) {
safecpy(lookup->textname, store, sizeof(lookup->textname));
lookup->rdtype = dns_rdatatype_ptr;
+ lookup->rdtypeset = ISC_TRUE;
} else {
safecpy(lookup->textname, opt, sizeof(lookup->textname));
lookup->rdtype = rdtype;
+ lookup->rdtypeset = ISC_TRUE;
}
lookup->rdclass = rdclass;
+ lookup->rdclassset = ISC_TRUE;
lookup->trace = ISC_TF(trace || ns_search_only);
lookup->trace_root = trace;
lookup->ns_search_only = ns_search_only;
@@ -750,7 +773,6 @@ addlookup(char *opt) {
lookup->origin = NULL;
ISC_LIST_INIT(lookup->my_server_list);
debug("looking up %s", lookup->textname);
- return (lookup);
}
static void
@@ -783,7 +805,7 @@ setsrv(char *opt) {
if (srv == NULL)
fatal("Memory allocation failure.");
safecpy(srv->servername, opt, MXNAME-1);
- ISC_LIST_APPENDUNSAFE(server_list, srv, link);
+ ISC_LIST_INITANDAPPEND(server_list, srv, link);
}
static void
@@ -838,17 +860,11 @@ get_next_command(void) {
static void
parse_args(int argc, char **argv) {
- dig_lookup_t *lookup = NULL;
isc_boolean_t have_lookup = ISC_FALSE;
for (argc--, argv++; argc > 0; argc--, argv++) {
debug("main parsing %s", argv[0]);
if (argv[0][0] == '-') {
- if ((argv[0][1] == 'h') &&
- (argv[0][2] == 0)) {
- show_usage();
- exit (1);
- }
if (argv[0][1] != 0)
setoption(&argv[0][1]);
else
@@ -857,7 +873,7 @@ parse_args(int argc, char **argv) {
if (!have_lookup) {
have_lookup = ISC_TRUE;
in_use = ISC_TRUE;
- lookup = addlookup(argv[0]);
+ addlookup(argv[0]);
}
else
setsrv(argv[0]);
diff --git a/bin/dnssec/Makefile.in b/bin/dnssec/Makefile.in
index 4799f4df..06ea76ff 100644
--- a/bin/dnssec/Makefile.in
+++ b/bin/dnssec/Makefile.in
@@ -13,12 +13,14 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.12 2000/11/13 20:09:45 bwelling Exp $
+# $Id: Makefile.in,v 1.13 2000/12/12 20:21:33 bwelling Exp $
srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
+@BIND9_VERSION@
+
@BIND9_INCLUDES@
CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES}
@@ -59,6 +61,9 @@ dnssec-makekeyset: dnssec-makekeyset.@O@ ${OBJS} ${DEPLIBS}
dnssec-signkey: dnssec-signkey.@O@ ${OBJS} ${DEPLIBS}
${LIBTOOL} ${CC} ${CFLAGS} -o $@ dnssec-signkey.@O@ ${OBJS} ${LIBS}
+dnssec-signzone.@O@: dnssec-signzone.c
+ ${LIBTOOL} ${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" -c $<
+
dnssec-signzone: dnssec-signzone.@O@ ${OBJS} ${DEPLIBS}
${LIBTOOL} ${CC} ${CFLAGS} -o $@ dnssec-signzone.@O@ ${OBJS} ${LIBS}
diff --git a/bin/dnssec/dnssec-keygen.c b/bin/dnssec/dnssec-keygen.c
index b053d2a9..e3a384e7 100644
--- a/bin/dnssec/dnssec-keygen.c
+++ b/bin/dnssec/dnssec-keygen.c
@@ -17,7 +17,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dnssec-keygen.c,v 1.44 2000/11/07 20:10:14 bwelling Exp $ */
+/* $Id: dnssec-keygen.c,v 1.45 2000/12/11 19:15:48 bwelling Exp $ */
#include <config.h>
@@ -397,7 +397,7 @@ main(int argc, char **argv) {
dst_lib_destroy();
if (verbose > 10)
isc_mem_stats(mctx, stdout);
- isc_mem_destroy(&mctx);
+ isc_mem_destroy(&mctx);
return (0);
}
diff --git a/bin/dnssec/dnssec-makekeyset.c b/bin/dnssec/dnssec-makekeyset.c
index 38a3332c..b8526c36 100644
--- a/bin/dnssec/dnssec-makekeyset.c
+++ b/bin/dnssec/dnssec-makekeyset.c
@@ -17,7 +17,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dnssec-makekeyset.c,v 1.44 2000/11/09 18:55:16 bwelling Exp $ */
+/* $Id: dnssec-makekeyset.c,v 1.45 2000/12/07 20:15:43 marka Exp $ */
#include <config.h>
@@ -286,7 +286,7 @@ main(int argc, char *argv[]) {
if (keynode == NULL)
fatal("out of memory");
keynode->key = zonekey;
- ISC_LIST_APPENDUNSAFE(keylist, keynode, link);
+ ISC_LIST_INITANDAPPEND(keylist, keynode, link);
}
rdata = isc_mem_get(mctx, sizeof(dns_rdata_t));
if (rdata == NULL)
diff --git a/bin/dnssec/dnssec-signkey.c b/bin/dnssec/dnssec-signkey.c
index 12df7a00..e4292336 100644
--- a/bin/dnssec/dnssec-signkey.c
+++ b/bin/dnssec/dnssec-signkey.c
@@ -17,7 +17,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dnssec-signkey.c,v 1.43 2000/11/09 18:55:17 bwelling Exp $ */
+/* $Id: dnssec-signkey.c,v 1.45 2000/12/11 19:15:49 bwelling Exp $ */
#include <config.h>
@@ -124,7 +124,7 @@ loadkeys(dns_name_t *name, dns_rdataset_t *rdataset) {
fatal("out of memory");
keynode->key = key;
keynode->verified = ISC_FALSE;
- ISC_LIST_APPENDUNSAFE(keylist, keynode, link);
+ ISC_LIST_INITANDAPPEND(keylist, keynode, link);
}
if (result != ISC_R_NOMORE)
fatal("failure traversing key list");
@@ -430,12 +430,12 @@ main(int argc, char *argv[]) {
dns_rdata_freestruct(&sig);
- while (!ISC_LIST_EMPTY(sigrdatalist.rdata)) {
- rdata = ISC_LIST_HEAD(sigrdatalist.rdata);
- ISC_LIST_UNLINK(sigrdatalist.rdata, rdata, link);
- isc_mem_put(mctx, rdata->data, BUFSIZE);
- isc_mem_put(mctx, rdata, sizeof *rdata);
- }
+ while (!ISC_LIST_EMPTY(sigrdatalist.rdata)) {
+ rdata = ISC_LIST_HEAD(sigrdatalist.rdata);
+ ISC_LIST_UNLINK(sigrdatalist.rdata, rdata, link);
+ isc_mem_put(mctx, rdata->data, BUFSIZE);
+ isc_mem_put(mctx, rdata, sizeof *rdata);
+ }
dns_db_detach(&db);
@@ -448,7 +448,7 @@ main(int argc, char *argv[]) {
cleanup_logging(&log);
- isc_mem_free(mctx, output);
+ isc_mem_free(mctx, output);
cleanup_entropy(&ectx);
dst_lib_destroy();
if (verbose > 10)
diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c
index 0bd6e802..8695655d 100644
--- a/bin/dnssec/dnssec-signzone.c
+++ b/bin/dnssec/dnssec-signzone.c
@@ -17,21 +17,29 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dnssec-signzone.c,v 1.113 2000/11/09 18:39:46 bwelling Exp $ */
+/* $Id: dnssec-signzone.c,v 1.126 2000/12/15 19:26:54 gson Exp $ */
#include <config.h>
#include <stdlib.h>
+#include <time.h>
+#include <isc/app.h>
#include <isc/commandline.h>
#include <isc/entropy.h>
+#include <isc/event.h>
#include <isc/mem.h>
+#include <isc/mutex.h>
+#include <isc/os.h>
#include <isc/stdio.h>
#include <isc/string.h>
+#include <isc/task.h>
#include <isc/util.h>
+#include <isc/time.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
+#include <dns/diff.h>
#include <dns/dnssec.h>
#include <dns/fixedname.h>
#include <dns/journal.h>
@@ -69,11 +77,24 @@ struct signer_key_struct {
ISC_LINK(signer_key_t) link;
};
+#define SIGNER_EVENTCLASS ISC_EVENTCLASS(0x4453)
+#define SIGNER_EVENT_WRITE (SIGNER_EVENTCLASS + 0)
+#define SIGNER_EVENT_WORK (SIGNER_EVENTCLASS + 1)
+
+typedef struct signer_event sevent_t;
+struct signer_event {
+ ISC_EVENT_COMMON(sevent_t);
+ dns_fixedname_t *fname;
+ dns_fixedname_t *fnextname;
+ dns_dbnode_t *node;
+};
+
static ISC_LIST(signer_key_t) keylist;
static unsigned int keycount = 0;
static isc_stdtime_t starttime = 0, endtime = 0, now;
static int cycle = -1;
static isc_boolean_t tryverify = ISC_FALSE;
+static isc_boolean_t printstats = ISC_FALSE;
static isc_mem_t *mctx = NULL;
static isc_entropy_t *ectx = NULL;
static dns_ttl_t zonettl;
@@ -82,6 +103,30 @@ static const dns_master_style_t *masterstyle = &dns_master_style_explicitttl;
static unsigned int nsigned = 0, nretained = 0, ndropped = 0;
static unsigned int nverified = 0, nverifyfailed = 0;
static const char *directory;
+static isc_mutex_t namelock, statslock;
+static isc_taskmgr_t *taskmgr = NULL;
+static dns_db_t *gdb; /* The database */
+static dns_dbversion_t *gversion; /* The database version */
+static dns_dbiterator_t *gdbiter; /* The database iterator */
+static dns_name_t *gorigin; /* The database origin */
+static dns_dbnode_t *gnode = NULL; /* The "current" database node */
+static dns_name_t *lastzonecut;
+static isc_task_t *master = NULL;
+static unsigned int ntasks = 0;
+static isc_boolean_t shuttingdown = ISC_FALSE, finished = ISC_FALSE;
+static unsigned int assigned = 0, completed = 0;
+static isc_boolean_t nokeys = ISC_FALSE;
+
+#define INCSTAT(counter) \
+ if (printstats) { \
+ LOCK(&statslock); \
+ counter++; \
+ UNLOCK(&statslock); \
+ }
+
+static void
+sign(isc_task_t *task, isc_event_t *event);
+
static inline void
set_bit(unsigned char *array, unsigned int index, unsigned int bit) {
@@ -125,17 +170,17 @@ signwithkey(dns_name_t *name, dns_rdataset_t *rdataset, dns_rdata_t *rdata,
fatal("key '%s' failed to sign data: %s",
keystr, isc_result_totext(result));
}
- nsigned++;
+ INCSTAT(nsigned);
if (tryverify) {
result = dns_dnssec_verify(name, rdataset, key,
ISC_TRUE, mctx, rdata);
if (result == ISC_R_SUCCESS) {
vbprintf(3, "\tsignature verified\n");
- nverified++;
+ INCSTAT(nverified);
} else {
vbprintf(3, "\tsignature failed to verify\n");
- nverifyfailed++;
+ INCSTAT(nverifyfailed);
}
}
}
@@ -146,9 +191,8 @@ issigningkey(signer_key_t *key) {
}
static inline isc_boolean_t
-iszonekey(signer_key_t *key, dns_db_t *db) {
- return (ISC_TF(dns_name_equal(dst_key_name(key->key),
- dns_db_origin(db)) &&
+iszonekey(signer_key_t *key) {
+ return (ISC_TF(dns_name_equal(dst_key_name(key->key), gorigin) &&
dst_key_iszonekey(key->key)));
}
@@ -176,10 +220,6 @@ keythatsigned(dns_rdata_sig_t *sig) {
if (result != ISC_R_SUCCESS)
return (NULL);
- key = isc_mem_get(mctx, sizeof(signer_key_t));
- if (key == NULL)
- fatal("out of memory");
-
result = dst_key_fromfile(&sig->signer, sig->keyid, sig->algorithm,
DST_TYPE_PRIVATE, NULL, mctx, &privkey);
if (result == ISC_R_SUCCESS) {
@@ -197,14 +237,14 @@ keythatsigned(dns_rdata_sig_t *sig) {
* I'm not sure if this is completely correct, but it seems to work.
*/
static isc_boolean_t
-expecttofindkey(dns_name_t *name, dns_db_t *db, dns_dbversion_t *version) {
+expecttofindkey(dns_name_t *name) {
unsigned int options = DNS_DBFIND_NOWILD;
dns_fixedname_t fname;
isc_result_t result;
char namestr[DNS_NAME_FORMATSIZE];
dns_fixedname_init(&fname);
- result = dns_db_find(db, name, version, dns_rdatatype_key, options,
+ result = dns_db_find(gdb, name, gversion, dns_rdatatype_key, options,
0, NULL, dns_fixedname_name(&fname), NULL, NULL);
switch (result) {
case ISC_R_SUCCESS:
@@ -229,10 +269,10 @@ setverifies(dns_name_t *name, dns_rdataset_t *set, signer_key_t *key,
isc_result_t result;
result = dns_dnssec_verify(name, set, key->key, ISC_FALSE, mctx, sig);
if (result == ISC_R_SUCCESS) {
- nverified++;
+ INCSTAT(nverified);
return (ISC_TRUE);
} else {
- nverifyfailed++;
+ INCSTAT(nverifyfailed);
return (ISC_FALSE);
}
}
@@ -243,8 +283,8 @@ setverifies(dns_name_t *name, dns_rdataset_t *set, signer_key_t *key,
* be generated.
*/
static void
-signset(dns_db_t *db, dns_dbversion_t *version, dns_diff_t *diff,
- dns_dbnode_t *node, dns_name_t *name, dns_rdataset_t *set)
+signset(dns_diff_t *diff, dns_dbnode_t *node, dns_name_t *name,
+ dns_rdataset_t *set)
{
dns_rdataset_t sigset;
dns_rdata_t sigrdata = DNS_RDATA_INIT;
@@ -267,7 +307,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_diff_t *diff,
ttl = ISC_MIN(set->ttl, endtime - starttime);
dns_rdataset_init(&sigset);
- result = dns_db_findrdataset(db, node, version, dns_rdatatype_sig,
+ result = dns_db_findrdataset(gdb, node, gversion, dns_rdatatype_sig,
set->type, 0, &sigset, NULL);
if (result == ISC_R_NOTFOUND) {
result = ISC_R_SUCCESS;
@@ -282,10 +322,8 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_diff_t *diff,
arraysize = keycount;
if (!nosigs)
arraysize += dns_rdataset_count(&sigset);
- wassignedby = isc_mem_get(mctx,
- arraysize * sizeof(isc_boolean_t));
- nowsignedby = isc_mem_get(mctx,
- arraysize * sizeof(isc_boolean_t));
+ wassignedby = isc_mem_get(mctx, arraysize * sizeof(isc_boolean_t));
+ nowsignedby = isc_mem_get(mctx, arraysize * sizeof(isc_boolean_t));
if (wassignedby == NULL || nowsignedby == NULL)
fatal("out of memory");
@@ -318,7 +356,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_diff_t *diff,
"invalid validity period\n",
sigstr);
} else if (key == NULL && !future &&
- expecttofindkey(&sig.signer, db, version))
+ expecttofindkey(&sig.signer))
{
/* sig is dropped and not replaced */
vbprintf(2, "\tsig by %s dropped - "
@@ -344,7 +382,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_diff_t *diff,
wassignedby[key->position] = ISC_TRUE;
resign = ISC_TRUE;
}
- } else if (iszonekey(key, db)) {
+ } else if (iszonekey(key)) {
if (!expired && setverifies(name, set, key, &sigrdata))
{
vbprintf(2, "\tsig by %s retained\n", sigstr);
@@ -367,7 +405,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_diff_t *diff,
if (keep) {
nowsignedby[key->position] = ISC_TRUE;
- nretained++;
+ INCSTAT(nretained);
} else {
tuple = NULL;
result = dns_difftuple_create(mctx, DNS_DIFFOP_DEL,
@@ -375,7 +413,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_diff_t *diff,
&tuple);
check_result(result, "dns_difftuple_create");
dns_diff_append(diff, &tuple);
- ndropped++;
+ INCSTAT(ndropped);
}
if (resign) {
@@ -438,14 +476,14 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_diff_t *diff,
static isc_boolean_t
hasnullkey(dns_rdataset_t *rdataset) {
isc_result_t result;
- dns_rdata_t rdata;
+ dns_rdata_t rdata = DNS_RDATA_INIT;
isc_boolean_t found = ISC_FALSE;
result = dns_rdataset_first(rdataset);
while (result == ISC_R_SUCCESS) {
dst_key_t *key = NULL;
- dns_rdata_init(&rdata);
+ dns_rdata_reset(&rdata);
dns_rdataset_current(rdataset, &rdata);
result = dns_dnssec_keyfromrdata(dns_rootname,
&rdata, mctx, &key);
@@ -453,19 +491,19 @@ hasnullkey(dns_rdataset_t *rdataset) {
fatal("could not convert KEY into internal format");
if (dst_key_isnullkey(key))
found = ISC_TRUE;
- dst_key_free(&key);
+ dst_key_free(&key);
if (found == ISC_TRUE)
return (ISC_TRUE);
- result = dns_rdataset_next(rdataset);
- }
- if (result != ISC_R_NOMORE)
- fatal("failure looking for null keys");
- return (ISC_FALSE);
+ result = dns_rdataset_next(rdataset);
+ }
+ if (result != ISC_R_NOMORE)
+ fatal("failure looking for null keys");
+ return (ISC_FALSE);
}
static void
opendb(const char *prefix, dns_name_t *name, dns_rdataclass_t rdclass,
- dns_db_t **db)
+ dns_db_t **dbp)
{
char filename[256];
isc_buffer_t b;
@@ -488,12 +526,12 @@ opendb(const char *prefix, dns_name_t *name, dns_rdataclass_t rdclass,
isc_buffer_putuint8(&b, 0);
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
- rdclass, 0, NULL, db);
+ rdclass, 0, NULL, dbp);
check_result(result, "dns_db_create()");
- result = dns_db_load(*db, filename);
+ result = dns_db_load(*dbp, filename);
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
- dns_db_detach(db);
+ dns_db_detach(dbp);
}
/*
@@ -501,21 +539,17 @@ opendb(const char *prefix, dns_name_t *name, dns_rdataclass_t rdclass,
* if found.
*/
static void
-importparentsig(dns_db_t *db, dns_diff_t *diff, dns_name_t *name,
- dns_rdataset_t *set)
-{
+importparentsig(dns_diff_t *diff, dns_name_t *name, dns_rdataset_t *set) {
dns_db_t *newdb = NULL;
dns_dbnode_t *newnode = NULL;
dns_rdataset_t newset, sigset;
- dns_rdata_t rdata, newrdata;
+ dns_rdata_t rdata = DNS_RDATA_INIT, newrdata = DNS_RDATA_INIT;
isc_result_t result;
dns_rdataset_init(&newset);
dns_rdataset_init(&sigset);
- dns_rdata_init(&rdata);
- dns_rdata_init(&newrdata);
- opendb("signedkey-", name, dns_db_class(db), &newdb);
+ opendb("signedkey-", name, dns_db_class(gdb), &newdb);
if (newdb == NULL)
return;
@@ -551,10 +585,10 @@ importparentsig(dns_db_t *db, dns_diff_t *diff, dns_name_t *name,
break;
dns_rdata_reset(&newrdata);
}
- if (result != ISC_R_SUCCESS)
- break;
dns_rdata_reset(&newrdata);
dns_rdata_reset(&rdata);
+ if (result != ISC_R_SUCCESS)
+ break;
}
if (result != ISC_R_NOMORE)
goto failure;
@@ -571,6 +605,7 @@ importparentsig(dns_db_t *db, dns_diff_t *diff, dns_name_t *name,
check_result(result, "dns_difftuple_create");
dns_diff_append(diff, &tuple);
result = dns_rdataset_next(&sigset);
+ dns_rdata_reset(&rdata);
}
if (result == ISC_R_NOMORE)
result = ISC_R_SUCCESS;
@@ -592,7 +627,7 @@ importparentsig(dns_db_t *db, dns_diff_t *diff, dns_name_t *name,
* Looks for our signatures of child keys. If present, inform the caller.
*/
static isc_boolean_t
-haschildkey(dns_db_t *db, dns_name_t *name) {
+haschildkey(dns_name_t *name) {
dns_db_t *newdb = NULL;
dns_dbnode_t *newnode = NULL;
dns_rdataset_t set, sigset;
@@ -605,7 +640,7 @@ haschildkey(dns_db_t *db, dns_name_t *name) {
dns_rdataset_init(&set);
dns_rdataset_init(&sigset);
- opendb("signedkey-", name, dns_db_class(db), &newdb);
+ opendb("signedkey-", name, dns_db_class(gdb), &newdb);
if (newdb == NULL)
return (ISC_FALSE);
@@ -737,9 +772,7 @@ createnullkey(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name) {
* parent/child KEY signatures, and handles other exceptional cases.
*/
static void
-signname(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
- dns_name_t *name)
-{
+signname(dns_dbnode_t *node, dns_name_t *name) {
isc_result_t result;
dns_rdataset_t rdataset;
dns_rdatasetiter_t *rdsiter;
@@ -766,7 +799,7 @@ signname(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
program, namestr);
}
- atorigin = dns_name_equal(name, dns_db_origin(db));
+ atorigin = dns_name_equal(name, gorigin);
/*
* If this is not the origin, determine if it's a delegation point.
@@ -775,7 +808,7 @@ signname(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
dns_rdataset_t nsset;
dns_rdataset_init(&nsset);
- result = dns_db_findrdataset(db, node, version,
+ result = dns_db_findrdataset(gdb, node, gversion,
dns_rdatatype_ns, 0, 0, &nsset,
NULL);
/* Is this a delegation point? */
@@ -792,11 +825,11 @@ signname(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
if (isdelegation) {
dns_rdataset_t keyset;
- childkey = haschildkey(db, name);
+ childkey = haschildkey(name);
neednullkey = ISC_TRUE;
dns_rdataset_init(&keyset);
- result = dns_db_findrdataset(db, node, version,
+ result = dns_db_findrdataset(gdb, node, gversion,
dns_rdatatype_key, 0, 0, &keyset,
NULL);
if (result == ISC_R_SUCCESS && childkey) {
@@ -817,7 +850,7 @@ signname(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
}
if (neednullkey)
- createnullkey(db, version, name);
+ createnullkey(gdb, gversion, name);
}
/*
@@ -826,7 +859,7 @@ signname(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
dns_diff_init(mctx, &diff);
dns_rdataset_init(&rdataset);
rdsiter = NULL;
- result = dns_db_allrdatasets(db, node, version, 0, &rdsiter);
+ result = dns_db_allrdatasets(gdb, node, gversion, 0, &rdsiter);
check_result(result, "dns_db_allrdatasets()");
result = dns_rdatasetiter_first(rdsiter);
while (result == ISC_R_SUCCESS) {
@@ -840,7 +873,7 @@ signname(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
* If this is a KEY set at the apex, look for a signedkey file.
*/
if (atorigin && rdataset.type == dns_rdatatype_key) {
- importparentsig(db, &diff, name, &rdataset);
+ importparentsig(&diff, name, &rdataset);
goto skip;
}
@@ -856,12 +889,13 @@ signname(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
}
if (rdataset.type == dns_rdatatype_nxt) {
- nxt_setbit(&rdataset, dns_rdatatype_sig);
+ if (!nokeys)
+ nxt_setbit(&rdataset, dns_rdatatype_sig);
if (neednullkey)
nxt_setbit(&rdataset, dns_rdatatype_key);
}
- signset(db, version, &diff, node, name, &rdataset);
+ signset(&diff, node, name, &rdataset);
skip:
dns_rdataset_disassociate(&rdataset);
@@ -875,7 +909,7 @@ signname(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
}
dns_rdatasetiter_destroy(&rdsiter);
- result = dns_diff_apply(&diff, db, version);
+ result = dns_diff_apply(&diff, gdb, gversion);
if (result != ISC_R_SUCCESS) {
char namestr[DNS_NAME_FORMATSIZE];
dns_name_format(name, namestr, sizeof namestr);
@@ -885,7 +919,7 @@ signname(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
}
static inline isc_boolean_t
-active_node(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node) {
+active_node(dns_dbnode_t *node) {
dns_rdatasetiter_t *rdsiter;
isc_boolean_t active = ISC_FALSE;
isc_result_t result;
@@ -893,7 +927,7 @@ active_node(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node) {
dns_rdataset_init(&rdataset);
rdsiter = NULL;
- result = dns_db_allrdatasets(db, node, version, 0, &rdsiter);
+ result = dns_db_allrdatasets(gdb, node, gversion, 0, &rdsiter);
check_result(result, "dns_db_allrdatasets()");
result = dns_rdatasetiter_first(rdsiter);
while (result == ISC_R_SUCCESS) {
@@ -915,7 +949,7 @@ active_node(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node) {
/*
* Make sure there is no NXT record for this node.
*/
- result = dns_db_deleterdataset(db, node, version,
+ result = dns_db_deleterdataset(gdb, node, gversion,
dns_rdatatype_nxt, 0);
if (result == DNS_R_UNCHANGED)
result = ISC_R_SUCCESS;
@@ -926,20 +960,18 @@ active_node(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node) {
}
static inline isc_result_t
-next_active(dns_db_t *db, dns_dbversion_t *version, dns_dbiterator_t *dbiter,
- dns_name_t *name, dns_dbnode_t **nodep)
-{
+next_active(dns_name_t *name, dns_dbnode_t **nodep) {
isc_result_t result;
isc_boolean_t active;
do {
active = ISC_FALSE;
- result = dns_dbiterator_current(dbiter, nodep, name);
+ result = dns_dbiterator_current(gdbiter, nodep, name);
if (result == ISC_R_SUCCESS) {
- active = active_node(db, version, *nodep);
+ active = active_node(*nodep);
if (!active) {
- dns_db_detachnode(db, nodep);
- result = dns_dbiterator_next(dbiter);
+ dns_db_detachnode(gdb, nodep);
+ result = dns_dbiterator_next(gdbiter);
}
}
} while (result == ISC_R_SUCCESS && !active);
@@ -948,26 +980,25 @@ next_active(dns_db_t *db, dns_dbversion_t *version, dns_dbiterator_t *dbiter,
}
static inline isc_result_t
-next_nonglue(dns_db_t *db, dns_dbversion_t *version, dns_dbiterator_t *dbiter,
- dns_name_t *name, dns_dbnode_t **nodep, dns_name_t *origin,
- dns_name_t *lastcut)
+next_nonglue(dns_name_t *name, dns_dbnode_t **nodep, dns_name_t *origin,
+ dns_name_t *lastcut)
{
- isc_result_t result, dresult;
+ isc_result_t result;
do {
- result = next_active(db, version, dbiter, name, nodep);
+ result = next_active(name, nodep);
if (result == ISC_R_SUCCESS) {
if (dns_name_issubdomain(name, origin) &&
(lastcut == NULL ||
!dns_name_issubdomain(name, lastcut)))
return (ISC_R_SUCCESS);
- dresult = dns_master_dumpnodetostream(mctx, db,
- version,
- *nodep, name,
- masterstyle, fp);
- check_result(dresult, "dns_master_dumpnodetostream");
- dns_db_detachnode(db, nodep);
- result = dns_dbiterator_next(dbiter);
+ result = dns_master_dumpnodetostream(mctx, gdb,
+ gversion,
+ *nodep, name,
+ masterstyle, fp);
+ check_result(result, "dns_master_dumpnodetostream");
+ dns_db_detachnode(gdb, nodep);
+ result = dns_dbiterator_next(gdbiter);
}
} while (result == ISC_R_SUCCESS);
return (result);
@@ -977,20 +1008,17 @@ next_nonglue(dns_db_t *db, dns_dbversion_t *version, dns_dbiterator_t *dbiter,
* Extracts the TTL from the SOA.
*/
static dns_ttl_t
-soattl(dns_db_t *db, dns_dbversion_t *version) {
+soattl(void) {
dns_rdataset_t soaset;
- dns_name_t *origin;
dns_fixedname_t fname;
dns_name_t *name;
isc_result_t result;
dns_ttl_t ttl;
- origin = dns_db_origin(db);
-
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
dns_rdataset_init(&soaset);
- result = dns_db_find(db, origin, version, dns_rdatatype_soa,
+ result = dns_db_find(gdb, gorigin, gversion, dns_rdatatype_soa,
0, 0, NULL, name, &soaset, NULL);
if (result != ISC_R_SUCCESS) {
char namestr[DNS_NAME_FORMATSIZE];
@@ -1003,6 +1031,9 @@ soattl(dns_db_t *db, dns_dbversion_t *version) {
return (ttl);
}
+/*
+ * Delete any SIG records at a node.
+ */
static void
cleannode(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node) {
dns_rdatasetiter_t *rdsiter = NULL;
@@ -1027,7 +1058,7 @@ cleannode(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node) {
dresult = dns_db_deleterdataset(db, node, version,
dns_rdatatype_sig,
covers);
- check_result(dresult, "dns_db_allrdatasets");
+ check_result(dresult, "dns_db_deleterdataset");
}
}
if (result != ISC_R_NOMORE)
@@ -1037,106 +1068,232 @@ cleannode(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node) {
}
/*
- * Generates NXTs and SIGs for each non-glue name in the zone.
+ * Set up the iterator and global state before starting the tasks.
*/
static void
-signzone(dns_db_t *db, dns_dbversion_t *version) {
- isc_result_t result, nxtresult, dresult;
- dns_dbnode_t *node, *nextnode;
- dns_fixedname_t fname, fnextname;
- dns_name_t *name, *nextname, *target, *lastcut;
- dns_dbiterator_t *dbiter;
- dns_name_t *origin;
+presign(void) {
+ isc_result_t result;
- zonettl = soattl(db, version);
+ gdbiter = NULL;
+ result = dns_db_createiterator(gdb, ISC_FALSE, &gdbiter);
+ check_result(result, "dns_db_createiterator()");
- dns_fixedname_init(&fname);
- name = dns_fixedname_name(&fname);
- dns_fixedname_init(&fnextname);
- nextname = dns_fixedname_name(&fnextname);
+ result = dns_dbiterator_first(gdbiter);
+ check_result(result, "dns_dbiterator_first()");
- origin = dns_db_origin(db);
+ lastzonecut = NULL;
- lastcut = NULL;
- dbiter = NULL;
- result = dns_db_createiterator(db, ISC_FALSE, &dbiter);
- check_result(result, "dns_db_createiterator()");
- result = dns_dbiterator_first(dbiter);
- node = NULL;
- dns_name_concatenate(origin, NULL, name, NULL);
- result = next_nonglue(db, version, dbiter, name, &node, origin,
- lastcut);
- while (result == ISC_R_SUCCESS) {
- nextnode = NULL;
- if (!dns_name_equal(name, dns_db_origin(db))) {
- dns_rdatasetiter_t *rdsiter = NULL;
- dns_rdataset_t set;
-
- dns_rdataset_init(&set);
- result = dns_db_allrdatasets(db, node, version,
- 0, &rdsiter);
- check_result(result, "dns_db_allrdatasets");
- result = dns_rdatasetiter_first(rdsiter);
- while (result == ISC_R_SUCCESS) {
- dns_rdatasetiter_current(rdsiter, &set);
- if (set.type == dns_rdatatype_ns) {
- dns_rdataset_disassociate(&set);
- break;
- }
+ zonettl = soattl();
+
+}
+
+/*
+ * Clean up the iterator and global state after the tasks complete.
+ */
+static void
+postsign(void) {
+ if (lastzonecut != NULL) {
+ dns_name_free(lastzonecut, mctx);
+ isc_mem_put(mctx, lastzonecut, sizeof(dns_name_t));
+ }
+ dns_dbiterator_destroy(&gdbiter);
+}
+
+/*
+ * Find the next name to nxtify & sign
+ */
+static isc_result_t
+getnextname(dns_name_t *name, dns_name_t *nextname, dns_dbnode_t **nodep) {
+ isc_result_t result;
+ dns_dbnode_t *nextnode, *curnode;
+
+ LOCK(&namelock);
+
+ if (shuttingdown || finished) {
+ result = ISC_R_NOMORE;
+ if (gnode != NULL)
+ dns_db_detachnode(gdb, &gnode);
+ goto out;
+ }
+
+ if (gnode == NULL) {
+ dns_fixedname_t ftname;
+ dns_name_t *tname;
+
+ dns_fixedname_init(&ftname);
+ tname = dns_fixedname_name(&ftname);
+
+ result = next_nonglue(tname, &gnode, gorigin, lastzonecut);
+ if (result != ISC_R_SUCCESS)
+ fatal("failed to iterate through the zone");
+ }
+
+ nextnode = NULL;
+ curnode = NULL;
+ dns_dbiterator_current(gdbiter, &curnode, name);
+ if (!dns_name_equal(name, gorigin)) {
+ dns_rdatasetiter_t *rdsiter = NULL;
+ dns_rdataset_t set;
+
+ dns_rdataset_init(&set);
+ result = dns_db_allrdatasets(gdb, curnode, gversion, 0,
+ &rdsiter);
+ check_result(result, "dns_db_allrdatasets");
+ result = dns_rdatasetiter_first(rdsiter);
+ while (result == ISC_R_SUCCESS) {
+ dns_rdatasetiter_current(rdsiter, &set);
+ if (set.type == dns_rdatatype_ns) {
dns_rdataset_disassociate(&set);
- result = dns_rdatasetiter_next(rdsiter);
- }
- if (result != ISC_R_SUCCESS && result != ISC_R_NOMORE)
- fatal("rdataset iteration failed: %s",
- isc_result_totext(result));
- if (result == ISC_R_SUCCESS) {
- if (lastcut != NULL)
- dns_name_free(lastcut, mctx);
- else {
- lastcut = isc_mem_get(mctx,
- sizeof(dns_name_t));
- if (lastcut == NULL)
- fatal("out of memory");
- }
- dns_name_init(lastcut, NULL);
- result = dns_name_dup(name, mctx, lastcut);
- check_result(result, "dns_name_dup()");
+ break;
}
- dns_rdatasetiter_destroy(&rdsiter);
+ dns_rdataset_disassociate(&set);
+ result = dns_rdatasetiter_next(rdsiter);
}
- result = dns_dbiterator_next(dbiter);
- if (result == ISC_R_SUCCESS)
- result = next_nonglue(db, version, dbiter, nextname,
- &nextnode, origin, lastcut);
- if (result == ISC_R_SUCCESS)
- target = nextname;
- else if (result == ISC_R_NOMORE)
- target = origin;
- else {
- target = NULL; /* Make compiler happy. */
- fatal("iterating through the database failed: %s",
+ if (result != ISC_R_SUCCESS && result != ISC_R_NOMORE)
+ fatal("rdataset iteration failed: %s",
isc_result_totext(result));
+ if (result == ISC_R_SUCCESS) {
+ if (lastzonecut != NULL)
+ dns_name_free(lastzonecut, mctx);
+ else {
+ lastzonecut = isc_mem_get(mctx,
+ sizeof(dns_name_t));
+ if (lastzonecut == NULL)
+ fatal("out of memory");
+ }
+ dns_name_init(lastzonecut, NULL);
+ result = dns_name_dup(name, mctx, lastzonecut);
+ check_result(result, "dns_name_dup()");
}
- nxtresult = dns_nxt_build(db, version, node, target, zonettl);
- check_result(nxtresult, "dns_nxt_build()");
- signname(db, version, node, name);
- dresult = dns_master_dumpnodetostream(mctx, db, version,
- node, name,
- masterstyle, fp);
- check_result(dresult, "dns_master_dumpnodetostream");
- cleannode(db, version, node);
- dns_db_detachnode(db, &node);
- node = nextnode;
- dns_name_concatenate(nextname, NULL, name, NULL);
+ dns_rdatasetiter_destroy(&rdsiter);
}
- if (result != ISC_R_NOMORE)
+ result = dns_dbiterator_next(gdbiter);
+ if (result == ISC_R_SUCCESS)
+ result = next_nonglue(nextname, &nextnode, gorigin,
+ lastzonecut);
+ if (result == ISC_R_NOMORE) {
+ dns_name_clone(gorigin, nextname);
+ finished = ISC_TRUE;
+ result = ISC_R_SUCCESS;
+ } else if (result != ISC_R_SUCCESS)
fatal("iterating through the database failed: %s",
isc_result_totext(result));
- if (lastcut != NULL) {
- dns_name_free(lastcut, mctx);
- isc_mem_put(mctx, lastcut, sizeof(dns_name_t));
+ dns_db_detachnode(gdb, &curnode);
+
+ *nodep = gnode;
+ gnode = nextnode;
+
+ out:
+ UNLOCK(&namelock);
+ return (result);
+}
+
+/*
+ * Assigns a node to a worker thread. This is protected by the master task's
+ * lock.
+ */
+static void
+assignwork(isc_task_t *task, isc_task_t *worker) {
+ dns_fixedname_t *fname, *fnextname;
+ dns_dbnode_t *node;
+ sevent_t *sevent;
+ isc_result_t result;
+
+ fname = isc_mem_get(mctx, sizeof(dns_fixedname_t));
+ fnextname = isc_mem_get(mctx, sizeof(dns_fixedname_t));
+ if (fname == NULL || fnextname == NULL)
+ fatal("out of memory");
+ dns_fixedname_init(fname);
+ dns_fixedname_init(fnextname);
+ node = NULL;
+ result = getnextname(dns_fixedname_name(fname),
+ dns_fixedname_name(fnextname), &node);
+ if (result == ISC_R_NOMORE) {
+ isc_mem_put(mctx, fname, sizeof(dns_fixedname_t));
+ isc_mem_put(mctx, fnextname, sizeof(dns_fixedname_t));
+ if (assigned == completed) {
+ isc_task_detach(&task);
+ isc_app_shutdown();
+ }
+ return;
}
- dns_dbiterator_destroy(&dbiter);
+ sevent = (sevent_t *)
+ isc_event_allocate(mctx, task, SIGNER_EVENT_WORK,
+ sign, NULL, sizeof(sevent_t));
+ if (sevent == NULL)
+ fatal("failed to allocate event\n");
+
+ sevent->node = node;
+ sevent->fname = fname;
+ sevent->fnextname = fnextname;
+ isc_task_send(worker, (isc_event_t **)&sevent);
+ assigned++;
+}
+
+/*
+ * Start a worker task
+ */
+static void
+startworker(isc_task_t *task, isc_event_t *event) {
+ isc_task_t *worker;
+
+ worker = (isc_task_t *)event->ev_arg;
+ assignwork(task, worker);
+ isc_event_free(&event);
+}
+
+/*
+ * Write a node to the output file, and restart the worker task.
+ */
+static void
+writenode(isc_task_t *task, isc_event_t *event) {
+ isc_result_t result;
+ isc_task_t *worker;
+ sevent_t *sevent = (sevent_t *)event;
+
+ completed++;
+ worker = (isc_task_t *)event->ev_sender;
+ result = dns_master_dumpnodetostream(mctx, gdb, gversion,
+ sevent->node,
+ dns_fixedname_name(sevent->fname),
+ masterstyle, fp);
+ check_result(result, "dns_master_dumpnodetostream");
+ cleannode(gdb, gversion, sevent->node);
+ dns_db_detachnode(gdb, &sevent->node);
+ isc_mem_put(mctx, sevent->fname, sizeof(dns_fixedname_t));
+ assignwork(task, worker);
+ isc_event_free(&event);
+}
+
+/*
+ * Sign and nxtify a database node.
+ */
+static void
+sign(isc_task_t *task, isc_event_t *event) {
+ dns_fixedname_t *fname, *fnextname;
+ dns_dbnode_t *node;
+ sevent_t *sevent, *wevent;
+ isc_result_t result;
+
+ sevent = (sevent_t *)event;
+ node = sevent->node;
+ fname = sevent->fname;
+ fnextname = sevent->fnextname;
+ isc_event_free(&event);
+
+ result = dns_nxt_build(gdb, gversion, node,
+ dns_fixedname_name(fnextname), zonettl);
+ check_result(result, "dns_nxt_build()");
+ isc_mem_put(mctx, fnextname, sizeof(dns_fixedname_t));
+ signname(node, dns_fixedname_name(fname));
+ wevent = (sevent_t *)
+ isc_event_allocate(mctx, task, SIGNER_EVENT_WRITE,
+ writenode, NULL, sizeof(sevent_t));
+ if (wevent == NULL)
+ fatal("failed to allocate event\n");
+ wevent->node = node;
+ wevent->fname = fname;
+ isc_task_send(master, (isc_event_t **)&wevent);
}
/*
@@ -1144,25 +1301,24 @@ signzone(dns_db_t *db, dns_dbversion_t *version) {
*/
static void
loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
- isc_buffer_t b, b2;
- unsigned char namedata[1024];
+ isc_buffer_t b;
int len;
- dns_name_t name;
+ dns_fixedname_t fname;
+ dns_name_t *name;
isc_result_t result;
len = strlen(origin);
isc_buffer_init(&b, origin, len);
isc_buffer_add(&b, len);
- isc_buffer_init(&b2, namedata, sizeof(namedata));
-
- dns_name_init(&name, NULL);
- result = dns_name_fromtext(&name, &b, dns_rootname, ISC_FALSE, &b2);
+ dns_fixedname_init(&fname);
+ name = dns_fixedname_name(&fname);
+ result = dns_name_fromtext(name, &b, dns_rootname, ISC_FALSE, NULL);
if (result != ISC_R_SUCCESS)
fatal("failed converting name '%s' to dns format: %s",
origin, isc_result_totext(result));
- result = dns_db_create(mctx, "rbt", &name, dns_dbtype_zone,
+ result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
rdclass, 0, NULL, db);
check_result(result, "dns_db_create()");
@@ -1178,25 +1334,23 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
*/
static void
loadzonekeys(dns_db_t *db) {
- dns_name_t *origin;
dns_dbnode_t *node;
dns_dbversion_t *currentversion;
isc_result_t result;
dst_key_t *keys[20];
unsigned int nkeys, i;
- origin = dns_db_origin(db);
currentversion = NULL;
dns_db_currentversion(db, &currentversion);
node = NULL;
- result = dns_db_findnode(db, origin, ISC_FALSE, &node);
+ result = dns_db_findnode(db, gorigin, ISC_FALSE, &node);
if (result != ISC_R_SUCCESS)
fatal("failed to find the zone's origin: %s",
isc_result_totext(result));
- result = dns_dnssec_findzonekeys(db, currentversion, node, origin, mctx,
- 20, keys, &nkeys);
+ result = dns_dnssec_findzonekeys(db, currentversion, node, gorigin,
+ mctx, 20, keys, &nkeys);
if (result == ISC_R_NOTFOUND)
result = ISC_R_SUCCESS;
if (result != ISC_R_SUCCESS)
@@ -1218,19 +1372,17 @@ loadzonekeys(dns_db_t *db) {
*/
static void
loadzonepubkeys(dns_db_t *db) {
- dns_name_t *origin;
dns_dbversion_t *currentversion = NULL;
dns_dbnode_t *node = NULL;
dns_rdataset_t rdataset;
- dns_rdata_t rdata;
+ dns_rdata_t rdata = DNS_RDATA_INIT;
dst_key_t *pubkey;
signer_key_t *key;
isc_result_t result;
- origin = dns_db_origin(db);
dns_db_currentversion(db, &currentversion);
- result = dns_db_findnode(db, origin, ISC_FALSE, &node);
+ result = dns_db_findnode(db, gorigin, ISC_FALSE, &node);
if (result != ISC_R_SUCCESS)
fatal("failed to find the zone's origin: %s",
isc_result_totext(result));
@@ -1245,9 +1397,9 @@ loadzonepubkeys(dns_db_t *db) {
check_result(result, "dns_rdataset_first");
while (result == ISC_R_SUCCESS) {
pubkey = NULL;
- dns_rdata_init(&rdata);
+ dns_rdata_reset(&rdata);
dns_rdataset_current(&rdataset, &rdata);
- result = dns_dnssec_keyfromrdata(origin, &rdata, mctx,
+ result = dns_dnssec_keyfromrdata(gorigin, &rdata, mctx,
&pubkey);
if (result != ISC_R_SUCCESS)
goto next;
@@ -1267,6 +1419,19 @@ loadzonepubkeys(dns_db_t *db) {
}
static void
+print_time(FILE *fp) {
+ time_t currenttime;
+
+ currenttime = time(NULL);
+ fprintf(fp, "; File written on %s", ctime(&currenttime));
+}
+
+static void
+print_version(FILE *fp) {
+ fprintf(fp, "; dnssec_signzone version " VERSION "\n");
+}
+
+static void
usage(void) {
fprintf(stderr, "Usage:\n");
fprintf(stderr, "\t%s [options] zonefile [keys]\n", program);
@@ -1299,6 +1464,7 @@ usage(void) {
fprintf(stderr, "use pseudorandom data (faster but less secure)\n");
fprintf(stderr, "\t-t:\t");
fprintf(stderr, "print statistics\n");
+ fprintf(stderr, "\t-n ncpus (number of cpus present)\n");
fprintf(stderr, "\n");
@@ -1315,17 +1481,20 @@ main(int argc, char *argv[]) {
char *origin = NULL, *file = NULL, *output = NULL;
char *randomfile = NULL;
char *endp;
- dns_db_t *db;
- dns_dbversion_t *version;
+ isc_time_t timer_start, timer_finish;
signer_key_t *key;
isc_result_t result;
isc_log_t *log = NULL;
isc_boolean_t pseudorandom = ISC_FALSE;
- isc_boolean_t printstats = ISC_FALSE;
unsigned int eflags;
isc_boolean_t free_output = ISC_FALSE;
dns_rdataclass_t rdclass;
isc_textregion_t r;
+ isc_task_t **tasks = NULL;
+
+
+
+ check_result(isc_app_start(), "isc_app_start");
result = isc_mem_create(0, 0, &mctx);
if (result != ISC_R_SUCCESS)
@@ -1334,7 +1503,7 @@ main(int argc, char *argv[]) {
dns_result_register();
while ((ch = isc_commandline_parse(argc, argv,
- "c:s:e:i:v:o:f:ahpr:td:"))
+ "c:s:e:i:v:o:f:ahpr:td:n:"))
!= -1) {
switch (ch) {
case 'c':
@@ -1392,6 +1561,13 @@ main(int argc, char *argv[]) {
directory = isc_commandline_argument;
break;
+ case 'n':
+ endp = NULL;
+ ntasks = strtol(isc_commandline_argument, &endp, 0);
+ if (*endp != '\0' || ntasks > ISC_INT32_MAX)
+ fatal("number of cpus must be numeric");
+ break;
+
case 'h':
default:
usage();
@@ -1422,6 +1598,10 @@ main(int argc, char *argv[]) {
if (cycle == -1)
cycle = (endtime - starttime) / 4;
+ if (ntasks == 0)
+ ntasks = isc_os_ncpus();
+ vbprintf(4, "using %d cpus\n", ntasks);
+
if (classname != NULL) {
r.base = classname;
@@ -1457,15 +1637,17 @@ main(int argc, char *argv[]) {
if (origin == NULL)
origin = file;
- db = NULL;
- loadzone(file, origin, rdclass, &db);
+ gdb = NULL;
+ isc_time_now(&timer_start);
+ loadzone(file, origin, rdclass, &gdb);
+ gorigin = dns_db_origin(gdb);
ISC_LIST_INIT(keylist);
if (argc == 0) {
signer_key_t *key;
- loadzonekeys(db);
+ loadzonekeys(gdb);
key = ISC_LIST_HEAD(keylist);
while (key != NULL) {
@@ -1480,7 +1662,7 @@ main(int argc, char *argv[]) {
DST_TYPE_PRIVATE,
mctx, &newkey);
if (result != ISC_R_SUCCESS)
- usage();
+ fatal("cannot load key %s", argv[i]);
key = ISC_LIST_HEAD(keylist);
while (key != NULL) {
@@ -1506,15 +1688,17 @@ main(int argc, char *argv[]) {
dst_key_free(&newkey);
}
- loadzonepubkeys(db);
+ loadzonepubkeys(gdb);
}
- if (ISC_LIST_EMPTY(keylist))
+ if (ISC_LIST_EMPTY(keylist)) {
fprintf(stderr, "%s: warning: No keys specified or found\n",
program);
+ nokeys = ISC_TRUE;
+ }
- version = NULL;
- result = dns_db_newversion(db, &version);
+ gversion = NULL;
+ result = dns_db_newversion(gdb, &gversion);
check_result(result, "dns_db_newversion()");
fp = NULL;
@@ -1522,17 +1706,61 @@ main(int argc, char *argv[]) {
if (result != ISC_R_SUCCESS)
fatal("failed to open output file %s: %s", output,
isc_result_totext(result));
+ print_time(fp);
+ print_version(fp);
- signzone(db, version);
+ result = isc_taskmgr_create(mctx, ntasks, 0, &taskmgr);
+ if (result != ISC_R_SUCCESS)
+ fatal("failed to create task manager: %s",
+ isc_result_totext(result));
+
+ master = NULL;
+ result = isc_task_create(taskmgr, 0, &master);
+ if (result != ISC_R_SUCCESS)
+ fatal("failed to create task: %s", isc_result_totext(result));
+
+ tasks = isc_mem_get(mctx, ntasks * sizeof(isc_task_t *));
+ if (tasks == NULL)
+ fatal("out of memory");
+ for (i = 0; i < (int)ntasks; i++) {
+ tasks[i] = NULL;
+ result = isc_task_create(taskmgr, 0, &tasks[i]);
+ if (result != ISC_R_SUCCESS)
+ fatal("failed to create task: %s",
+ isc_result_totext(result));
+ result = isc_app_onrun(mctx, master, startworker, tasks[i]);
+ if (result != ISC_R_SUCCESS)
+ fatal("failed to start task: %s",
+ isc_result_totext(result));
+ }
+
+ RUNTIME_CHECK(isc_mutex_init(&namelock) == ISC_R_SUCCESS);
+ if (printstats)
+ RUNTIME_CHECK(isc_mutex_init(&statslock) == ISC_R_SUCCESS);
+
+ presign();
+ (void)isc_app_run();
+ if (!finished)
+ fatal("process aborted by user");
+ shuttingdown = ISC_TRUE;
+ for (i = 0; i < (int)ntasks; i++)
+ isc_task_detach(&tasks[i]);
+ isc_taskmgr_destroy(&taskmgr);
+ isc_mem_put(mctx, tasks, ntasks * sizeof(isc_task_t *));
+ postsign();
result = isc_stdio_close(fp);
check_result(result, "isc_stdio_close");
+ DESTROYLOCK(&namelock);
+ if (printstats)
+ DESTROYLOCK(&statslock);
+
printf("%s\n", output);
- dns_db_closeversion(db, &version, ISC_FALSE);
+ dns_db_closeversion(gdb, &gversion, ISC_FALSE);
- dns_db_detach(&db);
+ dns_db_detach(&gdb);
while (!ISC_LIST_EMPTY(keylist)) {
key = ISC_LIST_HEAD(keylist);
@@ -1551,17 +1779,38 @@ main(int argc, char *argv[]) {
isc_mem_stats(mctx, stdout);
isc_mem_destroy(&mctx);
+ (void) isc_app_finish();
+
if (printstats) {
- printf("Signatures generated: %d\n",
+ isc_uint64_t runtime_us; /* Runtime in microseconds */
+ isc_uint64_t runtime_100s; /* Same in hundredths of seconds */
+ isc_uint64_t sigs_100s; /* Signatures per 100 seconds */
+
+ isc_time_now(&timer_finish);
+
+ runtime_us = isc_time_microdiff(&timer_finish, &timer_start);
+
+ printf("Signatures generated: %10d\n",
nsigned);
- printf("Signatures retained: %d\n",
+ printf("Signatures retained: %10d\n",
nretained);
- printf("Signatures dropped: %d\n",
+ printf("Signatures dropped: %10d\n",
ndropped);
- printf("Signatures successfully verified: %d\n",
+ printf("Signatures successfully verified: %10d\n",
nverified);
- printf("Signatures unsuccessfully verified: %d\n",
+ printf("Signatures unsuccessfully verified: %10d\n",
nverifyfailed);
+#define MICROSECONDS 1000000
+ runtime_100s = 100 * runtime_us / MICROSECONDS;
+ printf("Runtime in seconds: %7u.%02u\n",
+ (unsigned int) (runtime_100s / 100),
+ (unsigned int) (runtime_100s % 100));
+ if (runtime_us > 0) {
+ sigs_100s = nsigned * 100 * MICROSECONDS / runtime_us;
+ printf("Signatures per second: %7u.%02u\n",
+ (unsigned int) sigs_100s / 100,
+ (unsigned int) sigs_100s % 100);
+ }
}
return (0);
diff --git a/bin/dnssec/dnssectool.c b/bin/dnssec/dnssectool.c
index bc10a39a..1f5d4e52 100644
--- a/bin/dnssec/dnssectool.c
+++ b/bin/dnssec/dnssectool.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dnssectool.c,v 1.24 2000/11/27 22:19:37 gson Exp $ */
+/* $Id: dnssectool.c,v 1.26 2000/12/27 00:11:23 bwelling Exp $ */
#include <config.h>
@@ -133,8 +133,8 @@ setup_logging(int verbose, isc_mem_t *mctx, isc_log_t **logp) {
int level;
switch (verbose) {
- case 0:
- /*
+ case 0:
+ /*
* We want to see warnings about things like out-of-zone
* data in the master file even when not verbose.
*/
@@ -235,7 +235,7 @@ kbdget(isc_entropysource_t *source, void *arg, isc_boolean_t blocking) {
unsigned char c;
if (!blocking)
- return (ISC_R_NOENTROPY);
+ return (ISC_R_NOTBLOCKING);
result = isc_keyboard_getchar(kbd, &c);
if (result != ISC_R_SUCCESS)
@@ -245,7 +245,7 @@ kbdget(isc_entropysource_t *source, void *arg, isc_boolean_t blocking) {
if (result != ISC_R_SUCCESS)
return (result);
- sample = isc_time_nanoseconds(&t);
+ sample = isc_time_nanoseconds(&t);
extra = c;
result = isc_entropy_addcallbacksample(source, sample, extra);
diff --git a/bin/named/Makefile.in b/bin/named/Makefile.in
index 27280baf..b377caa1 100644
--- a/bin/named/Makefile.in
+++ b/bin/named/Makefile.in
@@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.62 2000/11/30 00:50:49 sjacob Exp $
+# $Id: Makefile.in,v 1.63 2000/12/06 01:04:09 bwelling Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@@ -26,10 +26,10 @@ top_srcdir = @top_srcdir@
#
# Add database drivers here.
#
-DBDRIVER_OBJS =
-DBDRIVER_SRCS =
-DBDRIVER_INCLUDES =
-DBDRIVER_LIBS =
+DBDRIVER_OBJS =
+DBDRIVER_SRCS =
+DBDRIVER_INCLUDES =
+DBDRIVER_LIBS =
CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include \
${LWRES_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES} \
diff --git a/bin/named/client.c b/bin/named/client.c
index 0d9679fe..2e235cc2 100644
--- a/bin/named/client.c
+++ b/bin/named/client.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: client.c,v 1.135 2000/12/02 05:57:16 gson Exp $ */
+/* $Id: client.c,v 1.136 2000/12/19 19:21:39 gson Exp $ */
#include <config.h>
@@ -1855,7 +1855,7 @@ ns_client_logv(ns_client_t *client, isc_logcategory_t *category,
isc_logmodule_t *module, int level, const char *fmt, va_list ap)
{
char msgbuf[2048];
- char peerbuf[256];
+ char peerbuf[ISC_SOCKADDR_FORMATSIZE];
vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap);
diff --git a/bin/named/include/named/globals.h b/bin/named/include/named/globals.h
index ac2f6da5..1ec106c5 100644
--- a/bin/named/include/named/globals.h
+++ b/bin/named/include/named/globals.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: globals.h,v 1.50 2000/11/14 23:59:21 tale Exp $ */
+/* $Id: globals.h,v 1.51 2000/12/12 23:05:57 bwelling Exp $ */
#ifndef NAMED_GLOBALS_H
#define NAMED_GLOBALS_H 1
@@ -103,11 +103,6 @@ EXTERN const char * lwresd_g_defaultpidfile INIT(NS_LOCALSTATEDIR
"/run/lwresd.pid");
EXTERN const char * ns_g_username INIT(NULL);
-/*
- * XXX Temporary.
- */
-EXTERN const char * ns_g_cachefile INIT(NULL);
-
#undef EXTERN
#undef INIT
diff --git a/bin/named/include/named/omapi.h b/bin/named/include/named/omapi.h
index f960f5da..bb8b66b4 100644
--- a/bin/named/include/named/omapi.h
+++ b/bin/named/include/named/omapi.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: omapi.h,v 1.16 2000/11/30 00:25:13 gson Exp $ */
+/* $Id: omapi.h,v 1.17 2000/12/12 23:03:16 bwelling Exp $ */
#ifndef NAMED_OMAPI_H
#define NAMED_OMAPI_H 1
@@ -42,6 +42,7 @@
#define NS_OMAPI_COMMAND_REFRESH "refresh"
#define NS_OMAPI_COMMAND_DUMPSTATS "stats"
#define NS_OMAPI_COMMAND_QUERYLOG "querylog"
+#define NS_OMAPI_COMMAND_DUMPDB "dumpdb"
isc_result_t
ns_omapi_init(void);
diff --git a/bin/named/include/named/server.h b/bin/named/include/named/server.h
index 938cfbea..059ee611 100644
--- a/bin/named/include/named/server.h
+++ b/bin/named/include/named/server.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: server.h,v 1.47 2000/12/01 23:49:52 gson Exp $ */
+/* $Id: server.h,v 1.48 2000/12/12 21:33:11 bwelling Exp $ */
#ifndef NAMED_SERVER_H
#define NAMED_SERVER_H 1
@@ -71,6 +71,8 @@ struct ns_server {
char * statsfile; /* Statistics file name */
isc_uint64_t * querystats; /* Query statistics counters */
+
+ char * dumpfile; /* Dump file name */
};
#define NS_SERVER_MAGIC 0x53564552 /* SVER */
@@ -125,9 +127,15 @@ ns_server_togglequerylog(ns_server_t *server);
*/
/*
- * Dump the current statistics to the statstics file.
+ * Dump the current statistics to the statistics file.
*/
isc_result_t
ns_server_dumpstats(ns_server_t *server);
+/*
+ * Dump the current cache to the dump file.
+ */
+isc_result_t
+ns_server_dumpdb(ns_server_t *server);
+
#endif /* NAMED_SERVER_H */
diff --git a/bin/named/interfacemgr.c b/bin/named/interfacemgr.c
index 0f5fc4ee..fa8df079 100644
--- a/bin/named/interfacemgr.c
+++ b/bin/named/interfacemgr.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: interfacemgr.c,v 1.51 2000/09/26 18:26:18 gson Exp $ */
+/* $Id: interfacemgr.c,v 1.54 2000/12/15 01:07:52 gson Exp $ */
#include <config.h>
@@ -172,7 +172,7 @@ static isc_result_t
ns_interface_create(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr,
const char *name, ns_interface_t **ifpret)
{
- ns_interface_t *ifp;
+ ns_interface_t *ifp;
isc_result_t result;
REQUIRE(NS_INTERFACEMGR_VALID(mgr));
@@ -252,9 +252,9 @@ ns_interface_listenudp(ns_interface_t *ifp) {
4096, 1000, 32768, 8219, 8237,
attrs, attrmask, &ifp->udpdispatch);
if (result != ISC_R_SUCCESS) {
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "UDP dns_dispatch_create(): %s",
- isc_result_totext(result));
+ isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_ERROR,
+ "could not listen on UDP socket: %s",
+ isc_result_totext(result));
goto udp_dispatch_failure;
}
@@ -419,13 +419,13 @@ ns_interface_detach(ns_interface_t **targetp) {
*/
static ns_interface_t *
find_matching_interface(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr) {
- ns_interface_t *ifp;
- for (ifp = ISC_LIST_HEAD(mgr->interfaces); ifp != NULL;
+ ns_interface_t *ifp;
+ for (ifp = ISC_LIST_HEAD(mgr->interfaces); ifp != NULL;
ifp = ISC_LIST_NEXT(ifp, link)) {
if (isc_sockaddr_equal(&ifp->addr, addr))
break;
}
- return (ifp);
+ return (ifp);
}
/*
@@ -433,8 +433,8 @@ find_matching_interface(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr) {
*/
static void
purge_old_interfaces(ns_interfacemgr_t *mgr) {
- ns_interface_t *ifp, *next;
- for (ifp = ISC_LIST_HEAD(mgr->interfaces); ifp != NULL; ifp = next) {
+ ns_interface_t *ifp, *next;
+ for (ifp = ISC_LIST_HEAD(mgr->interfaces); ifp != NULL; ifp = next) {
INSIST(NS_INTERFACE_VALID(ifp));
next = ISC_LIST_NEXT(ifp, link);
if (ifp->generation != mgr->generation) {
@@ -548,7 +548,7 @@ do_ipv4(ns_interfacemgr_t *mgr) {
if (ifp != NULL) {
ifp->generation = mgr->generation;
} else {
- char sabuf[256];
+ char sabuf[ISC_SOCKADDR_FORMATSIZE];
isc_sockaddr_format(&listen_sockaddr,
sabuf, sizeof(sabuf));
isc_log_write(IFMGR_COMMON_LOGARGS,
@@ -681,11 +681,11 @@ ns_interfacemgr_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose) {
verbose ? ISC_LOG_INFO : ISC_LOG_DEBUG(1),
"no IPv4 interfaces found");
- /*
- * Now go through the interface list and delete anything that
- * does not have the current generation number. This is
- * how we catch interfaces that go away or change their
- * addresses.
+ /*
+ * Now go through the interface list and delete anything that
+ * does not have the current generation number. This is
+ * how we catch interfaces that go away or change their
+ * addresses.
*/
purge_old_interfaces(mgr);
diff --git a/bin/named/log.c b/bin/named/log.c
index 90ffc951..0d35a691 100644
--- a/bin/named/log.c
+++ b/bin/named/log.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log.c,v 1.26 2000/11/25 01:33:11 marka Exp $ */
+/* $Id: log.c,v 1.27 2000/12/11 19:19:08 bwelling Exp $ */
#include <config.h>
@@ -113,10 +113,10 @@ ns_log_setdefaultchannels(isc_logconfig_t *lcfg) {
destination.file.versions = ISC_LOG_ROLLNEVER;
destination.file.maximum_size = 0;
result = isc_log_createchannel(lcfg, "default_debug",
- ISC_LOG_TOFILE,
- ISC_LOG_DYNAMIC,
- &destination,
- ISC_LOG_PRINTTIME|
+ ISC_LOG_TOFILE,
+ ISC_LOG_DYNAMIC,
+ &destination,
+ ISC_LOG_PRINTTIME|
ISC_LOG_DEBUGONLY);
if (result != ISC_R_SUCCESS)
goto cleanup;
@@ -139,9 +139,9 @@ ns_log_setsafechannels(isc_logconfig_t *lcfg) {
if (! ns_g_logstderr) {
result = isc_log_createchannel(lcfg, "default_debug",
- ISC_LOG_TONULL,
- ISC_LOG_DYNAMIC,
- NULL, 0);
+ ISC_LOG_TONULL,
+ ISC_LOG_DYNAMIC,
+ NULL, 0);
if (result != ISC_R_SUCCESS)
goto cleanup;
}
diff --git a/bin/named/lwaddr.c b/bin/named/lwaddr.c
index a20b71fd..0f6153c7 100644
--- a/bin/named/lwaddr.c
+++ b/bin/named/lwaddr.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lwaddr.c,v 1.1 2000/11/15 23:56:20 bwelling Exp $ */
+/* $Id: lwaddr.c,v 1.2 2000/12/11 19:19:09 bwelling Exp $ */
#include <config.h>
@@ -53,14 +53,14 @@ isc_result_t
lwaddr_sockaddr_fromlwresaddr(isc_sockaddr_t *sa, lwres_addr_t *la,
in_port_t port)
{
- isc_netaddr_t na;
- isc_result_t result;
+ isc_netaddr_t na;
+ isc_result_t result;
- result = lwaddr_netaddr_fromlwresaddr(&na, la);
- if (result != ISC_R_SUCCESS)
- return (result);
- isc_sockaddr_fromnetaddr(sa, &na, port);
- return (ISC_R_SUCCESS);
+ result = lwaddr_netaddr_fromlwresaddr(&na, la);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+ isc_sockaddr_fromnetaddr(sa, &na, port);
+ return (ISC_R_SUCCESS);
}
/*
diff --git a/bin/named/lwdgrbn.c b/bin/named/lwdgrbn.c
index 5d60f7bb..29242159 100644
--- a/bin/named/lwdgrbn.c
+++ b/bin/named/lwdgrbn.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lwdgrbn.c,v 1.2 2000/11/18 02:57:07 bwelling Exp $ */
+/* $Id: lwdgrbn.c,v 1.6 2000/12/22 21:17:59 gson Exp $ */
#include <config.h>
@@ -24,9 +24,11 @@
#include <isc/string.h> /* Required for HP/UX (and others?) */
#include <isc/util.h>
+#include <dns/db.h>
#include <dns/lookup.h>
#include <dns/rdata.h>
#include <dns/rdataset.h>
+#include <dns/rdatasetiter.h>
#include <dns/result.h>
#include <dns/view.h>
@@ -37,6 +39,65 @@
static void start_lookup(ns_lwdclient_t *);
+static isc_result_t
+count_rdatasets(dns_db_t *db, dns_dbnode_t *node, lwres_uint16_t *count) {
+ dns_rdatasetiter_t *iter = NULL;
+ int n = 0;
+ isc_result_t result;
+
+ result = dns_db_allrdatasets(db, node, NULL, 0, &iter);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+ for (result = dns_rdatasetiter_first(iter);
+ result == ISC_R_SUCCESS;
+ result = dns_rdatasetiter_next(iter))
+ {
+ dns_rdataset_t set;
+
+ dns_rdataset_init(&set);
+ dns_rdatasetiter_current(iter, &set);
+ if (set.type == dns_rdatatype_sig)
+ n += dns_rdataset_count(&set);
+ dns_rdataset_disassociate(&set);
+ }
+ if (result != ISC_R_NOMORE)
+ goto cleanup;
+ *count = n;
+ result = ISC_R_SUCCESS;
+ cleanup:
+ if (iter != NULL)
+ dns_rdatasetiter_destroy(&iter);
+ return (result);
+}
+
+static isc_result_t
+fill_array(int *pos, dns_rdataset_t *rdataset,
+ int size, unsigned char **rdatas, lwres_uint16_t *rdatalen)
+{
+ dns_rdata_t rdata;
+ isc_result_t result;
+ isc_region_t r;
+
+ UNUSED(size);
+
+ dns_rdata_init(&rdata);
+ for (result = dns_rdataset_first(rdataset);
+ result == ISC_R_SUCCESS;
+ result = dns_rdataset_next(rdataset))
+ {
+ INSIST(*pos < size);
+ dns_rdataset_current(rdataset, &rdata);
+ dns_rdata_toregion(&rdata, &r);
+ rdatas[*pos] = r.base;
+ rdatalen[*pos] = r.length;
+ dns_rdata_reset(&rdata);
+ (*pos)++;
+ }
+ if (result == ISC_R_NOMORE)
+ result = ISC_R_SUCCESS;
+ return (result);
+}
+
static void
lookup_done(isc_task_t *task, isc_event_t *event) {
ns_lwdclient_t *client;
@@ -46,7 +107,6 @@ lookup_done(isc_task_t *task, isc_event_t *event) {
dns_name_t *name;
dns_rdataset_t *rdataset;
dns_rdataset_t *sigrdataset;
- dns_rdata_t rdata;
isc_result_t result;
lwres_result_t lwresult;
isc_region_t r;
@@ -101,7 +161,14 @@ lookup_done(isc_task_t *task, isc_event_t *event) {
grbn->flags = 0;
rdataset = levent->rdataset;
- grbn->nrdatas = dns_rdataset_count(rdataset);
+ if (rdataset != NULL)
+ grbn->nrdatas = dns_rdataset_count(rdataset);
+ else {
+ result = count_rdatasets(levent->db, levent->node,
+ &grbn->nrdatas);
+ if (result != ISC_R_SUCCESS)
+ goto out;
+ }
grbn->rdatas = NULL;
grbn->rdatalen = NULL;
@@ -123,9 +190,18 @@ lookup_done(isc_task_t *task, isc_event_t *event) {
ns_lwdclient_log(50, "found name '%.*s'", grbn->realnamelen,
grbn->realname);
- grbn->rdclass = rdataset->rdclass;
- grbn->rdtype = rdataset->type;
- grbn->ttl = rdataset->ttl;
+ grbn->rdclass = cm->view->rdclass;
+ grbn->rdtype = client->rdtype;
+
+ /* If rdataset is NULL, get this later. */
+ if (rdataset == NULL)
+ grbn->ttl = ISC_INT32_MAX;
+ else
+ grbn->ttl = rdataset->ttl;
+
+ /* If rdataset is NULL, remove this later. */
+ if (rdataset == NULL || rdataset->trust == dns_trust_secure)
+ grbn->flags |= LWRDATA_VALIDATED;
grbn->rdatas = isc_mem_get(cm->mctx,
grbn->nrdatas * sizeof(unsigned char *));
@@ -135,21 +211,48 @@ lookup_done(isc_task_t *task, isc_event_t *event) {
grbn->nrdatas * sizeof(lwres_uint16_t));
if (grbn->rdatalen == NULL)
goto out;
- dns_rdata_init(&rdata);
- i = 0;
- for (result = dns_rdataset_first(rdataset);
- result == ISC_R_SUCCESS;
- result = dns_rdataset_next(rdataset))
- {
- INSIST(i < grbn->nrdatas);
- dns_rdataset_current(rdataset, &rdata);
- dns_rdata_toregion(&rdata, &r);
- grbn->rdatas[i] = r.base;
- grbn->rdatalen[i] = r.length;
- dns_rdata_reset(&rdata);
- i++;
+
+ if (rdataset != NULL) {
+ i = 0;
+ result = fill_array(&i, rdataset, grbn->nrdatas, grbn->rdatas,
+ grbn->rdatalen);
+ if (result != ISC_R_SUCCESS || i != grbn->nrdatas)
+ goto out;
+ } else {
+ dns_rdatasetiter_t *iter = NULL;
+ dns_rdataset_t set;
+
+ result = dns_db_allrdatasets(levent->db, levent->node,
+ NULL, 0, &iter);
+ if (result != ISC_R_SUCCESS)
+ goto out;
+ i = 0;
+ for (result = dns_rdatasetiter_first(iter);
+ result == ISC_R_SUCCESS;
+ result = dns_rdatasetiter_next(iter))
+ {
+ dns_rdataset_init(&set);
+ dns_rdatasetiter_current(iter, &set);
+ if (set.type != dns_rdatatype_sig) {
+ dns_rdataset_disassociate(&set);
+ continue;
+ }
+ if (set.ttl < grbn->ttl)
+ grbn->ttl = set.ttl;
+ if (set.trust < dns_trust_secure)
+ grbn->flags &= (~LWRDATA_VALIDATED);
+ result = fill_array(&i, &set, grbn->nrdatas,
+ grbn->rdatas, grbn->rdatalen);
+ dns_rdataset_disassociate(&set);
+ if (result != ISC_R_SUCCESS)
+ break;
+ }
+ dns_rdatasetiter_destroy(&iter);
+ if (result == ISC_R_NOMORE)
+ result = ISC_R_SUCCESS;
+ if (result != ISC_R_SUCCESS || i != grbn->nrdatas)
+ goto out;
}
- INSIST(i == grbn->nrdatas);
grbn->sigs = isc_mem_get(cm->mctx, grbn->nsigs *
sizeof(unsigned char *));
@@ -161,31 +264,16 @@ lookup_done(isc_task_t *task, isc_event_t *event) {
goto out;
if (sigrdataset != NULL) {
- dns_rdata_init(&rdata);
i = 0;
- for (result = dns_rdataset_first(sigrdataset);
- result == ISC_R_SUCCESS;
- result = dns_rdataset_next(sigrdataset))
- {
- INSIST(i < grbn->nrdatas);
- dns_rdataset_current(sigrdataset, &rdata);
- dns_rdata_toregion(&rdata, &r);
- grbn->sigs[i] = r.base;
- grbn->siglen[i] = r.length;
- dns_rdata_reset(&rdata);
- i++;
- }
- INSIST(i == grbn->nsigs);
+ result = fill_array(&i, rdataset, grbn->nsigs, grbn->sigs,
+ grbn->siglen);
+ if (result != ISC_R_SUCCESS || i != grbn->nsigs)
+ goto out;
}
dns_lookup_destroy(&client->lookup);
isc_event_free(&event);
- if (rdataset->trust == dns_trust_secure)
- grbn->flags |= LWRDATA_VALIDATED;
- if (rdataset->trust == dns_trust_ultimate)
- grbn->flags |= LWRDATA_AUTHORITATIVE;
-
/*
* Render the packet.
*/
@@ -315,6 +403,10 @@ ns_lwdclient_processgrbn(ns_lwdclient_t *client, lwres_buffer_t *b) {
if (req->rdclass != cm->view->rdclass)
goto out;
+ if (req->rdclass == dns_rdataclass_any ||
+ req->rdtype == dns_rdatatype_any)
+ goto out;
+
client->rdtype = req->rdtype;
isc_buffer_init(&namebuf, req->name, req->namelen);
diff --git a/bin/named/lwresd.c b/bin/named/lwresd.c
index e496f12c..9c364467 100644
--- a/bin/named/lwresd.c
+++ b/bin/named/lwresd.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lwresd.c,v 1.26 2000/11/15 23:56:21 bwelling Exp $ */
+/* $Id: lwresd.c,v 1.27 2000/12/13 00:15:02 tale Exp $ */
/*
* Main program for the Lightweight Resolver Daemon.
@@ -214,7 +214,7 @@ ns_lwresd_parseresolvconf(isc_mem_t *mctx, dns_c_ctx_t **ctxp) {
port));
if (result != ISC_R_SUCCESS)
continue;
- CHECK(dns_c_iplist_append(forwarders, sa));
+ CHECK(dns_c_iplist_append(forwarders, sa, NULL));
}
if (forwarders->nextidx != 0) {
@@ -262,7 +262,7 @@ ns_lwresd_parseresolvconf(isc_mem_t *mctx, dns_c_ctx_t **ctxp) {
}
CHECK(dns_c_iplist_new(mctx, 1, &locallist));
- CHECK(dns_c_iplist_append(locallist, sa));
+ CHECK(dns_c_iplist_append(locallist, sa, NULL));
CHECK(dns_c_lwres_setlistenon(lwres, locallist));
dns_c_iplist_detach(&locallist);
diff --git a/bin/named/lwsearch.c b/bin/named/lwsearch.c
index c795e582..fcd5d381 100644
--- a/bin/named/lwsearch.c
+++ b/bin/named/lwsearch.c
@@ -15,7 +15,9 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lwsearch.c,v 1.4 2000/10/28 00:09:11 bwelling Exp $ */
+/* $Id: lwsearch.c,v 1.6 2000/12/23 22:02:47 tale Exp $ */
+
+#include <config.h>
#include <isc/magic.h>
#include <isc/mem.h>
@@ -30,8 +32,8 @@
#include <named/lwsearch.h>
#include <named/types.h>
-#define LWSEARCHLIST_MAGIC ISC_MAGIC('L', 'W', 'S', 'L')
-#define VALID_LWSEARCHLIST(l) ISC_MAGIC_VALID(l, LWSEARCHLIST_MAGIC)
+#define LWSEARCHLIST_MAGIC ISC_MAGIC('L', 'W', 'S', 'L')
+#define VALID_LWSEARCHLIST(l) ISC_MAGIC_VALID(l, LWSEARCHLIST_MAGIC)
isc_result_t
ns_lwsearchlist_create(isc_mem_t *mctx, ns_lwsearchlist_t **listp) {
diff --git a/bin/named/main.c b/bin/named/main.c
index 868ee33d..2296a0b8 100644
--- a/bin/named/main.c
+++ b/bin/named/main.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: main.c,v 1.95 2000/11/27 19:12:23 gson Exp $ */
+/* $Id: main.c,v 1.97 2000/12/12 23:05:54 bwelling Exp $ */
#include <config.h>
@@ -54,7 +54,7 @@
/*
* Include header files for database drivers here.
*/
-/* #include <xxdb.h> */
+/* #include "xxdb.h" */
static isc_boolean_t want_stats = ISC_FALSE;
static const char * program_name = "named";
@@ -346,10 +346,6 @@ parse_command_line(int argc, char *argv[]) {
case 'v':
printf("BIND %s\n", ns_g_version);
exit(0);
- case 'x':
- /* XXXRTH temporary syntax */
- ns_g_cachefile = isc_commandline_argument;
- break;
case '?':
usage();
ns_main_earlyfatal("unknown option '-%c'",
diff --git a/bin/named/notify.c b/bin/named/notify.c
index c226e797..2a7787fc 100644
--- a/bin/named/notify.c
+++ b/bin/named/notify.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: notify.c,v 1.21 2000/11/28 03:17:48 marka Exp $ */
+/* $Id: notify.c,v 1.22 2000/12/11 19:19:11 bwelling Exp $ */
#include <config.h>
@@ -117,8 +117,8 @@
static void
respond(ns_client_t *client, isc_result_t result) {
dns_rcode_t rcode;
- dns_message_t *message;
- isc_result_t msg_result;
+ dns_message_t *message;
+ isc_result_t msg_result;
message = client->message;
rcode = dns_result_torcode(result);
diff --git a/bin/named/omapi.c b/bin/named/omapi.c
index d4ed8adf..c904d61a 100644
--- a/bin/named/omapi.c
+++ b/bin/named/omapi.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: omapi.c,v 1.26 2000/11/30 19:38:00 gson Exp $ */
+/* $Id: omapi.c,v 1.29 2000/12/15 19:32:55 gson Exp $ */
/*
* Principal Author: DCL
@@ -72,7 +72,7 @@ control_setvalue(omapi_object_t *handle, omapi_string_t *name,
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_OMAPI, ISC_LOG_DEBUG(1),
- "control_setvalue: '%.*s' control command received",
+ "received control channel command '%.*s'",
REGION_FMT(&region));
if (value == NULL)
@@ -102,7 +102,7 @@ control_setvalue(omapi_object_t *handle, omapi_string_t *name,
NS_OMAPI_COMMAND_RELOADZONES) == 0) {
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_OMAPI, ISC_LOG_WARNING,
- "control_setvalue: '%.*s' not yet implemented",
+ "unimplemented channel command '%.*s'",
REGION_FMT(&region));
result = ISC_R_NOTIMPLEMENTED;
} else if (omapi_string_strcmp(name, NS_OMAPI_COMMAND_DUMPSTATS)
@@ -110,10 +110,13 @@ control_setvalue(omapi_object_t *handle, omapi_string_t *name,
result = ns_server_dumpstats(ns_g_server);
} else if (omapi_string_strcmp(name, NS_OMAPI_COMMAND_QUERYLOG) == 0) {
result = ns_server_togglequerylog(ns_g_server);
+ } else if (omapi_string_strcmp(name, NS_OMAPI_COMMAND_DUMPDB) == 0) {
+ ns_server_dumpdb(ns_g_server);
+ result = ISC_R_SUCCESS;
} else {
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_OMAPI, ISC_LOG_WARNING,
- "control_setvalue: unknown name: '%.*s'",
+ "unknown control channel command '%.*s'",
REGION_FMT(&region));
result = omapi_object_passsetvalue(handle, name, value);
}
diff --git a/bin/named/query.c b/bin/named/query.c
index 73965974..28894804 100644
--- a/bin/named/query.c
+++ b/bin/named/query.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: query.c,v 1.159 2000/12/05 19:17:32 gson Exp $ */
+/* $Id: query.c,v 1.163 2000/12/27 23:01:25 marka Exp $ */
#include <config.h>
@@ -67,13 +67,13 @@
#define CTRACE(m) isc_log_write(ns_g_lctx, \
NS_LOGCATEGORY_CLIENT, \
NS_LOGMODULE_QUERY, \
- ISC_LOG_DEBUG(3), \
- "client %p: %s", client, (m))
+ ISC_LOG_DEBUG(3), \
+ "client %p: %s", client, (m))
#define QTRACE(m) isc_log_write(ns_g_lctx, \
NS_LOGCATEGORY_GENERAL, \
NS_LOGMODULE_QUERY, \
- ISC_LOG_DEBUG(3), \
- "query %p: %s", query, (m))
+ ISC_LOG_DEBUG(3), \
+ "query %p: %s", query, (m))
#else
#define CTRACE(m) ((void)m)
#define QTRACE(m) ((void)m)
@@ -152,7 +152,7 @@ query_reset(ns_client_t *client, isc_boolean_t everything) {
dns_db_closeversion(dbversion->db, &dbversion->version,
ISC_FALSE);
dns_db_detach(&dbversion->db);
- ISC_LIST_APPENDUNSAFE(client->query.freeversions,
+ ISC_LIST_INITANDAPPEND(client->query.freeversions,
dbversion, link);
}
ISC_LIST_INIT(client->query.activeversions);
@@ -381,7 +381,7 @@ query_newdbversion(ns_client_t *client, unsigned int n) {
if (dbversion != NULL) {
dbversion->db = NULL;
dbversion->version = NULL;
- ISC_LIST_APPENDUNSAFE(client->query.freeversions,
+ ISC_LIST_INITANDAPPEND(client->query.freeversions,
dbversion, link);
} else {
/*
@@ -1198,8 +1198,12 @@ query_addadditional(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
goto addname;
if (WANTDNSSEC(client) && sigrdataset == NULL)
goto addname;
- } else
+ } else {
dns_rdataset_disassociate(rdataset);
+ if (sigrdataset != NULL &&
+ dns_rdataset_isassociated(sigrdataset))
+ dns_rdataset_disassociate(sigrdataset);
+ }
}
result = dns_db_findrdataset(db, node, version,
dns_rdatatype_aaaa, 0,
@@ -2377,7 +2381,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) {
if (result == DNS_R_REFUSED)
QUERY_ERROR(DNS_R_REFUSED);
else
- QUERY_ERROR(DNS_R_SERVFAIL);
+ QUERY_ERROR(DNS_R_SERVFAIL);
goto cleanup;
}
@@ -2865,8 +2869,10 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) {
if (result != ISC_R_SUCCESS)
goto cleanup;
result = dns_rdataset_first(trdataset);
- if (result != ISC_R_SUCCESS)
+ if (result != ISC_R_SUCCESS) {
+ dns_message_puttempname(client->message, &tname);
goto cleanup;
+ }
dns_rdataset_current(trdataset, &rdata);
result = dns_rdata_tostruct(&rdata, &cname, NULL);
dns_rdata_reset(&rdata);
@@ -2916,13 +2922,17 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) {
if (result != ISC_R_SUCCESS)
goto cleanup;
result = dns_rdataset_first(trdataset);
- if (result != ISC_R_SUCCESS)
+ if (result != ISC_R_SUCCESS) {
+ dns_message_puttempname(client->message, &tname);
goto cleanup;
+ }
dns_rdataset_current(trdataset, &rdata);
result = dns_rdata_tostruct(&rdata, &dname, NULL);
dns_rdata_reset(&rdata);
- if (result != ISC_R_SUCCESS)
+ if (result != ISC_R_SUCCESS) {
+ dns_message_puttempname(client->message, &tname);
goto cleanup;
+ }
dns_name_init(tname, NULL);
dns_name_clone(&dname.dname, tname);
dns_rdata_freestruct(&dname);
@@ -2933,15 +2943,21 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) {
prefix = dns_fixedname_name(&fixed);
result = dns_name_split(client->query.qname, nlabels, nbits,
prefix, NULL);
- if (result != ISC_R_SUCCESS)
+ if (result != ISC_R_SUCCESS) {
+ dns_message_puttempname(client->message, &tname);
goto cleanup;
+ }
INSIST(fname == NULL);
dbuf = query_getnamebuf(client);
- if (dbuf == NULL)
+ if (dbuf == NULL) {
+ dns_message_puttempname(client->message, &tname);
goto cleanup;
+ }
fname = query_newname(client, dbuf, &b);
- if (fname == NULL)
+ if (fname == NULL) {
+ dns_message_puttempname(client->message, &tname);
goto cleanup;
+ }
result = dns_name_concatenate(prefix, tname, fname, NULL);
if (result != ISC_R_SUCCESS) {
dns_message_puttempname(client->message, &tname);
diff --git a/bin/named/server.c b/bin/named/server.c
index 51216366..c1c7f0d4 100644
--- a/bin/named/server.c
+++ b/bin/named/server.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: server.c,v 1.269 2000/12/05 17:23:45 gson Exp $ */
+/* $Id: server.c,v 1.276 2000/12/15 21:11:38 gson Exp $ */
#include <config.h>
@@ -495,17 +495,6 @@ configure_view(dns_view_t *view, dns_c_ctx_t *cctx, dns_c_view_t *cview,
dns_cache_detach(&cache);
/*
- * XXXRTH Temporary support for loading cache contents.
- */
- if (ns_g_cachefile != NULL) {
- isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
- NS_LOGMODULE_SERVER, ISC_LOG_DEBUG(1),
- "loading cache '%s'", ns_g_cachefile);
- /* DNS_R_SEENINCLUDE should be impossible here. */
- CHECK(dns_db_load(view->cachedb, ns_g_cachefile));
- }
-
- /*
* Resolver.
*
* XXXRTH Hardwired number of tasks.
@@ -712,6 +701,32 @@ configure_view(dns_view_t *view, dns_c_ctx_t *cctx, dns_c_view_t *cview,
val = 7 * 24 * 3600;
view->maxncachettl = val;
}
+ {
+ char *cachefile = NULL, *p = NULL;
+ if (cview != NULL)
+ result = dns_c_view_getcachefile(cview, &cachefile);
+ else
+ result = dns_c_ctx_getcachefile(cctx, &cachefile);
+ if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND)
+ goto cleanup;
+ if (cachefile != NULL) {
+ p = isc_mem_strdup(view->mctx, cachefile);
+ if (p == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ }
+ if (view->cachefile != NULL)
+ isc_mem_free(view->mctx, view->cachefile);
+ view->cachefile = p;
+ if (view->cachefile != NULL) {
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
+ NS_LOGMODULE_SERVER, ISC_LOG_DEBUG(1),
+ "loading cache '%s'", view->cachefile);
+ /* DNS_R_SEENINCLUDE should be impossible here. */
+ CHECK(dns_db_load(view->cachedb, view->cachefile));
+ }
+ }
result = ISC_R_SUCCESS;
@@ -1277,6 +1292,10 @@ options_callback(dns_c_ctx_t *cctx, void *uap) {
static void
scan_interfaces(ns_server_t *server, isc_boolean_t verbose) {
ns_interfacemgr_scan(server->interfacemgr, verbose);
+ /*
+ * Update the "localhost" and "localnets" ACLs to match the
+ * current set of network interfaces.
+ */
dns_aclenv_copy(&server->aclenv,
ns_interfacemgr_getaclenv(server->interfacemgr));
}
@@ -1326,6 +1345,21 @@ setstatsfile(ns_server_t *server, const char *name) {
return (ISC_R_SUCCESS);
}
+static isc_result_t
+setdumpfile(ns_server_t *server, const char *name) {
+ char *p;
+
+ REQUIRE(name != NULL);
+
+ p = isc_mem_strdup(server->mctx, name);
+ if (p == NULL)
+ return (ISC_R_NOMEMORY);
+ if (server->dumpfile != NULL)
+ isc_mem_free(server->mctx, server->dumpfile);
+ server->dumpfile = p;
+ return (ISC_R_SUCCESS);
+}
+
#define SETLIMIT(cfgvar, resource, description) \
if (dns_c_ctx_get ## cfgvar(cctx, &resource) == ISC_R_SUCCESS) { \
if (resource == DNS_C_SIZE_SPEC_DEFAULT) \
@@ -1376,6 +1410,7 @@ load_configuration(const char *filename, ns_server_t *server,
dns_dispatch_t *dispatchv6 = NULL;
char *pidfilename;
char *statsfilename;
+ char *dumpfilename;
isc_uint32_t interface_interval;
isc_uint32_t heartbeat_interval;
in_port_t listen_port;
@@ -1748,6 +1783,13 @@ load_configuration(const char *filename, ns_server_t *server,
CHECKM(setstatsfile(server, statsfilename), "strdup");
}
+ result = dns_c_ctx_getdumpfilename(cctx, &dumpfilename);
+ if (result == ISC_R_NOTFOUND) {
+ CHECKM(setdumpfile(server, "named_dump.db"), "strdup");
+ } else {
+ CHECKM(setdumpfile(server, dumpfilename), "strdup");
+ }
+
cleanup:
ns_aclconfctx_destroy(&aclconfctx);
@@ -1998,6 +2040,10 @@ ns_server_create(isc_mem_t *mctx, ns_server_t **serverp) {
CHECKFATAL(dns_stats_alloccounters(ns_g_mctx, &server->querystats),
"dns_stats_alloccounters");
+ server->dumpfile = isc_mem_strdup(server->mctx, "named.dump");
+ CHECKFATAL(server->dumpfile == NULL ? ISC_R_NOMEMORY : ISC_R_SUCCESS,
+ "isc_mem_strdup");
+
server->flushonshutdown = ISC_FALSE;
server->log_queries = ISC_FALSE;
@@ -2013,6 +2059,8 @@ ns_server_destroy(ns_server_t **serverp) {
dns_stats_freecounters(server->mctx, &server->querystats);
isc_mem_free(server->mctx, server->statsfile);
+ isc_mem_free(server->mctx, server->dumpfile);
+
dns_loadmgr_detach(&server->loadmgr);
dns_zonemgr_detach(&server->zonemgr);
@@ -2181,6 +2229,7 @@ isc_result_t
ns_server_reloadcommand(ns_server_t *server, char *args) {
isc_result_t result;
dns_zone_t *zone = NULL;
+ dns_zonetype_t type;
UNUSED(server);
result = zone_from_args(server, args, &zone);
@@ -2189,7 +2238,11 @@ ns_server_reloadcommand(ns_server_t *server, char *args) {
if (zone == NULL) {
ns_server_reloadwanted(server);
} else {
- dns_zone_forcereload(zone);
+ type = dns_zone_gettype(zone);
+ if (type == dns_zone_slave || type == dns_zone_stub)
+ dns_zone_refresh(zone);
+ else
+ dns_zone_load(zone);
dns_zone_detach(&zone);
}
return (ISC_R_SUCCESS);
@@ -2217,7 +2270,7 @@ ns_server_refreshcommand(ns_server_t *server, char *args) {
isc_result_t
ns_server_togglequerylog(ns_server_t *server) {
- server->log_queries = ! server->log_queries;
+ server->log_queries = server->log_queries ? ISC_FALSE : ISC_TRUE;
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER, ISC_LOG_INFO,
@@ -2346,3 +2399,26 @@ ns_server_dumpstats(ns_server_t *server) {
(void)isc_stdio_close(fp);
return (result);
}
+
+isc_result_t
+ns_server_dumpdb(ns_server_t *server) {
+ FILE *fp = NULL;
+ dns_view_t *view;
+ isc_result_t result;
+
+ CHECKM(isc_stdio_open(server->dumpfile, "w", &fp),
+ "could not open dump file");
+
+ for (view = ISC_LIST_HEAD(server->viewlist);
+ view != NULL;
+ view = ISC_LIST_NEXT(view, link))
+ {
+ if (view->cachedb != NULL)
+ CHECKM(dns_view_dumpdbtostream(view, fp),
+ "could not dump view databases");
+ }
+ cleanup:
+ if (fp != NULL)
+ (void)isc_stdio_close(fp);
+ return (result);
+}
diff --git a/bin/named/unix/os.c b/bin/named/unix/os.c
index 22ef56da..c7ebb557 100644
--- a/bin/named/unix/os.c
+++ b/bin/named/unix/os.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: os.c,v 1.35 2000/11/14 23:57:45 tale Exp $ */
+/* $Id: os.c,v 1.36 2000/12/14 18:29:57 marka Exp $ */
#include <config.h>
#include <stdarg.h>
@@ -210,6 +210,15 @@ linux_minprivs(void) {
caps = 0;
caps |= (1 << CAP_NET_BIND_SERVICE);
+ /*
+ * XXX We might want to add CAP_SYS_RESOURCE, though it's not
+ * clear it would work right given the way linuxthreads work.
+ * XXXDCL But since we need to be able to set the maximum number
+ * of files, the stack size, data size, and core dump size to
+ * support named.conf options, this is now being added to test.
+ */
+ caps |= (1 << CAP_SYS_RESOURCE);
+
linux_setcaps(caps);
}
diff --git a/bin/named/update.c b/bin/named/update.c
index 50742c6e..12fa6a98 100644
--- a/bin/named/update.c
+++ b/bin/named/update.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: update.c,v 1.75 2000/12/01 21:37:08 gson Exp $ */
+/* $Id: update.c,v 1.79 2000/12/28 01:29:09 marka Exp $ */
#include <config.h>
@@ -25,6 +25,7 @@
#include <dns/db.h>
#include <dns/dbiterator.h>
+#include <dns/diff.h>
#include <dns/dnssec.h>
#include <dns/events.h>
#include <dns/fixedname.h>
@@ -146,7 +147,7 @@ struct update_event {
ISC_EVENT_COMMON(update_event_t);
dns_zone_t *zone;
isc_result_t result;
-
+ dns_message_t *answer;
};
/**************************************************************************/
@@ -157,9 +158,9 @@ struct update_event {
static void update_action(isc_task_t *task, isc_event_t *event);
static void updatedone_action(isc_task_t *task, isc_event_t *event);
static isc_result_t send_forward_event(ns_client_t *client, dns_zone_t *zone);
+static void forward_done(isc_task_t *task, isc_event_t *event);
/**************************************************************************/
-
/*
* Update a single RR in version 'ver' of 'db' and log the
* update in 'diff'.
@@ -203,6 +204,30 @@ do_one_tuple(dns_difftuple_t **tuple,
return (ISC_R_SUCCESS);
}
+/*
+ * Perform the updates in 'updates' in version 'ver' of 'db' and log the
+ * update in 'diff'.
+ *
+ * Ensures:
+ * 'updates' is empty.
+ */
+static isc_result_t
+do_diff(dns_diff_t *updates, dns_db_t *db, dns_dbversion_t *ver,
+ dns_diff_t *diff)
+{
+ isc_result_t result;
+ while (! ISC_LIST_EMPTY(updates->tuples)) {
+ dns_difftuple_t *t = ISC_LIST_HEAD(updates->tuples);
+ ISC_LIST_UNLINK(updates->tuples, t, link);
+ CHECK(do_one_tuple(&t, db, ver, diff));
+ }
+ return (ISC_R_SUCCESS);
+
+ failure:
+ dns_diff_clear(diff);
+ return (result);
+}
+
static isc_result_t
update_one_rr(dns_db_t *db, dns_dbversion_t *ver, dns_diff_t *diff,
dns_diffop_t op, dns_name_t *name,
@@ -536,59 +561,6 @@ rr_count(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name,
}
/*
- * Context struct for matching_rr_exists().
- */
-
-typedef struct {
- rr_predicate *predicate;
- dns_db_t *db;
- dns_dbversion_t *ver;
- dns_name_t *name;
- dns_rdata_t *update_rr;
-} matching_rr_exists_ctx_t;
-
-/*
- * Helper function for matching_rr_exists().
- */
-
-static isc_result_t
-matching_rr_exists_action(void *data, rr_t *rr) {
- matching_rr_exists_ctx_t *ctx = data;
- if ((*ctx->predicate)(ctx->update_rr, &rr->rdata))
- return (ISC_R_EXISTS);
- return (ISC_R_SUCCESS);
-}
-
-/*
- * Compare the 'update_rr' with all RRs in the RRset specified by 'db',
- * 'ver', 'name', and 'type' using 'predicate'. If the predicate returns
- * true for at least one of them, set '*exists' to ISC_TRUE. Otherwise,
- * set it to ISC_FALSE.
- */
-static isc_result_t
-matching_rr_exists(rr_predicate *predicate,
- dns_db_t *db,
- dns_dbversion_t *ver,
- dns_name_t *name,
- dns_rdatatype_t type,
- dns_rdatatype_t covers,
- dns_rdata_t *update_rr,
- isc_boolean_t *exists)
-{
- isc_result_t result;
- matching_rr_exists_ctx_t ctx;
- ctx.predicate = predicate;
- ctx.db = db;
- ctx.ver = ver;
- ctx.name = name;
- ctx.update_rr = update_rr;
- result = foreach_rr(db, ver, name, type, covers,
- matching_rr_exists_action, &ctx);
- RETURN_EXISTENCE_FLAG;
-}
-
-
-/*
* Context struct and helper function for name_exists().
*/
@@ -1007,6 +979,79 @@ delete_if(rr_predicate *predicate,
/**************************************************************************/
/*
+ * Prepare an RR for the addition of the new RR 'ctx->update_rr',
+ * with TTL 'ctx->update_rr_ttl', to its rdataset, by deleting
+ * the RRs if it is replaced by the new RR or has a conflicting TTL.
+ * The necessary changes are appended to ctx->del_diff and ctx->add_diff;
+ * we need to do all deletions before any additions so that we don't run
+ * into transient states with conflicting TTLs.
+ */
+
+typedef struct {
+ dns_db_t *db;
+ dns_dbversion_t *ver;
+ dns_diff_t *diff;
+ dns_name_t *name;
+ dns_rdata_t *update_rr;
+ dns_ttl_t update_rr_ttl;
+ isc_boolean_t ignore_add;
+ dns_diff_t del_diff;
+ dns_diff_t add_diff;
+} add_rr_prepare_ctx_t;
+
+static isc_result_t
+add_rr_prepare_action(void *data, rr_t *rr) {
+ isc_result_t result = ISC_R_SUCCESS;
+ add_rr_prepare_ctx_t *ctx = data;
+ dns_difftuple_t *tuple = NULL;
+
+ /*
+ * If the update RR is a "duplicate" of the update RR,
+ * the update should be silently ignored.
+ */
+ if (dns_rdata_compare(&rr->rdata, ctx->update_rr) == 0 &&
+ rr->ttl == ctx->update_rr_ttl) {
+ ctx->ignore_add = ISC_TRUE;
+ }
+
+ /*
+ * If this RR is "equal" to the update RR, it should
+ * be deleted before the update RR is added.
+ */
+ if (replaces_p(ctx->update_rr, &rr->rdata)) {
+ CHECK(dns_difftuple_create(ctx->del_diff.mctx,
+ DNS_DIFFOP_DEL, ctx->name,
+ rr->ttl,
+ &rr->rdata,
+ &tuple));
+ dns_diff_append(&ctx->del_diff, &tuple);
+ return (ISC_R_SUCCESS);
+ }
+
+ /*
+ * If this RR differs in TTL from the update RR,
+ * its TTL must be adjusted.
+ */
+ if (rr->ttl != ctx->update_rr_ttl) {
+ CHECK(dns_difftuple_create(ctx->del_diff.mctx,
+ DNS_DIFFOP_DEL, ctx->name,
+ rr->ttl,
+ &rr->rdata,
+ &tuple));
+ dns_diff_append(&ctx->del_diff, &tuple);
+ CHECK(dns_difftuple_create(ctx->add_diff.mctx,
+ DNS_DIFFOP_ADD, ctx->name,
+ ctx->update_rr_ttl,
+ &rr->rdata,
+ &tuple));
+ dns_diff_append(&ctx->add_diff, &tuple);
+ }
+ failure:
+ return (result);
+}
+
+/**************************************************************************/
+/*
* Miscellaneous subroutines.
*/
@@ -1296,6 +1341,7 @@ next_active(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *oldname,
isc_result_t result;
dns_dbiterator_t *dbit = NULL;
isc_boolean_t has_nxt;
+ unsigned int wraps = 0;
CHECK(dns_db_createiterator(db, ISC_FALSE, &dbit));
@@ -1315,6 +1361,15 @@ next_active(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *oldname,
CHECK(dns_dbiterator_first(dbit));
else
CHECK(dns_dbiterator_last(dbit));
+ wraps++;
+ if (wraps == 2) {
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_UPDATE,
+ NS_LOGMODULE_UPDATE,
+ ISC_LOG_ERROR,
+ "secure zone with no NXTs");
+ result = DNS_R_BADZONE;
+ goto failure;
+ }
}
dns_dbiterator_current(dbit, &node, newname);
dns_db_detachnode(db, &node);
@@ -2203,29 +2258,34 @@ update_action(isc_task_t *task, isc_event_t *event) {
}
soa_serial_changed = ISC_TRUE;
}
- /*
- * Add an RR. If an identical RR already exists,
- * do nothing. If a similar but not identical
- * CNAME, SOA, or WKS exists, remove it first.
- */
- CHECK(matching_rr_exists(rr_equal_p, db, ver, name,
- rdata.type, covers, &rdata,
- &flag));
- if (! flag) {
- isc_log_write(UPDATE_PROTOCOL_LOGARGS,
- "adding an RR");
- CHECK(delete_if(replaces_p, db, ver, name,
- rdata.type, covers, &rdata,
- &diff));
- result = update_one_rr(db, ver, &diff,
- DNS_DIFFOP_ADD,
- name, ttl, &rdata);
- if (result != ISC_R_SUCCESS)
- FAIL(result);
- } else {
- isc_log_write(UPDATE_PROTOCOL_LOGARGS,
- "attempt to add existing RR "
- "ignored");
+
+ isc_log_write(UPDATE_PROTOCOL_LOGARGS, "adding an RR");
+
+ /* Prepare the affected RRset for the addition. */
+ {
+ add_rr_prepare_ctx_t ctx;
+ ctx.db = db;
+ ctx.ver = ver;
+ ctx.diff = &diff;
+ ctx.name = name;
+ ctx.update_rr = &rdata;
+ ctx.update_rr_ttl = ttl;
+ ctx.ignore_add = ISC_FALSE;
+ dns_diff_init(mctx, &ctx.del_diff);
+ dns_diff_init(mctx, &ctx.add_diff);
+ CHECK(foreach_rr(db, ver, name, rdata.type, covers,
+ add_rr_prepare_action, &ctx));
+
+ if (ctx.ignore_add) {
+ dns_diff_clear(&ctx.del_diff);
+ dns_diff_clear(&ctx.add_diff);
+ } else {
+ CHECK(do_diff(&ctx.del_diff, db, ver, &diff));
+ CHECK(do_diff(&ctx.add_diff, db, ver, &diff));
+ CHECK(update_one_rr(db, ver, &diff,
+ DNS_DIFFOP_ADD,
+ name, ttl, &rdata));
+ }
}
} else if (update_class == dns_rdataclass_any) {
if (rdata.type == dns_rdatatype_any) {
@@ -2413,19 +2473,44 @@ updatedone_action(isc_task_t *task, isc_event_t *event) {
*/
static void
-forward_fail(ns_client_t *client, isc_result_t result) {
- UNUSED(result);
+forward_fail(isc_task_t *task, isc_event_t *event) {
+ ns_client_t *client = (ns_client_t *)event->ev_arg;
+
+ UNUSED(task);
+
respond(client, DNS_R_SERVFAIL);
+ ns_client_detach(&client);
+ isc_event_free((isc_event_t **)&event);
}
+
static void
forward_callback(void *arg, isc_result_t result, dns_message_t *answer) {
- ns_client_t *client = arg;
+ update_event_t *uev = arg;
+ ns_client_t *client = uev->ev_arg;
- if (result != ISC_R_SUCCESS)
- forward_fail(client, result);
- else
- ns_client_sendraw(client, answer);
+ if (result != ISC_R_SUCCESS) {
+ INSIST(answer == NULL);
+ uev->ev_type = DNS_EVENT_UPDATEDONE;
+ uev->ev_action = forward_fail;
+ } else {
+ uev->ev_type = DNS_EVENT_UPDATEDONE;
+ uev->ev_action = forward_done;
+ uev->answer = answer;
+ }
+ isc_task_send(client->task, (isc_event_t**)&uev);
+}
+
+static void
+forward_done(isc_task_t *task, isc_event_t *event) {
+ update_event_t *uev = (update_event_t *) event;
+ ns_client_t *client = (ns_client_t *)event->ev_arg;
+
+ UNUSED(task);
+
+ ns_client_sendraw(client, uev->answer);
+ dns_message_destroy(&uev->answer);
+ isc_event_free((isc_event_t **)&event);
ns_client_detach(&client);
}
@@ -2437,13 +2522,13 @@ forward_action(isc_task_t *task, isc_event_t *event) {
isc_result_t result;
result = dns_zone_forwardupdate(zone, client->message,
- forward_callback, client);
+ forward_callback, event);
if (result != ISC_R_SUCCESS) {
- forward_fail(client, result);
- ns_client_detach(&client);
+ uev->ev_type = DNS_EVENT_UPDATEDONE;
+ uev->ev_action = forward_fail;
+ isc_task_send(client->task, &event);
}
dns_zone_detach(&zone);
- isc_event_free(&event);
isc_task_detach(&task);
}
diff --git a/bin/named/xfrout.c b/bin/named/xfrout.c
index c2da755e..919db431 100644
--- a/bin/named/xfrout.c
+++ b/bin/named/xfrout.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: xfrout.c,v 1.83 2000/12/04 06:31:41 gson Exp $ */
+/* $Id: xfrout.c,v 1.87 2000/12/22 18:32:06 gson Exp $ */
#include <config.h>
@@ -263,7 +263,7 @@ log_rr(dns_name_t *name, dns_rdata_t *rdata, isc_uint32_t ttl) {
char mem[2000];
dns_rdatalist_t rdl;
dns_rdataset_t rds;
- dns_rdata_t rd;
+ dns_rdata_t rd = DNS_RDATA_INIT;
rdl.type = rdata->type;
rdl.rdclass = rdata->rdclass;
@@ -1045,7 +1045,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
*/
if (DNS_SERIAL_GE(begin_serial, current_serial) ||
(client->attributes & NS_CLIENTATTR_TCP) == 0)
- {
+ {
CHECK(soa_rrstream_create(mctx, db, ver, &stream));
goto have_stream;
}
@@ -1446,9 +1446,9 @@ sendstream(xfrout_ctx_t *xfr) {
xfr->client->message = msg;
msg = NULL;
ns_client_send(xfr->client);
+ xfr->stream->methods->pause(xfr->stream);
xfrout_ctx_destroy(&xfr);
- result = ISC_R_SUCCESS;
- goto done;
+ return;
}
/* Advance lasttsig to be the last TSIG generated */
@@ -1478,7 +1478,6 @@ sendstream(xfrout_ctx_t *xfr) {
dns_message_destroy(&msg);
}
- done:
/*
* Make sure to release any locks held by database
* iterators before returning from the event handler.
@@ -1607,7 +1606,7 @@ static void
xfrout_log1(ns_client_t *client, dns_name_t *zonename, int level,
const char *fmt, ...)
{
- va_list ap;
+ va_list ap;
va_start(ap, fmt);
xfrout_logv(client, zonename, level, fmt, ap);
va_end(ap);
@@ -1618,7 +1617,7 @@ xfrout_log1(ns_client_t *client, dns_name_t *zonename, int level,
*/
static void
xfrout_log(xfrout_ctx_t *xfr, unsigned int level, const char *fmt, ...) {
- va_list ap;
+ va_list ap;
va_start(ap, fmt);
xfrout_logv(xfr->client, xfr->qname, level, fmt, ap);
va_end(ap);
diff --git a/bin/named/zoneconf.c b/bin/named/zoneconf.c
index c9dab610..98906e2c 100644
--- a/bin/named/zoneconf.c
+++ b/bin/named/zoneconf.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zoneconf.c,v 1.76 2000/12/01 23:49:50 gson Exp $ */
+/* $Id: zoneconf.c,v 1.78 2000/12/13 00:15:03 tale Exp $ */
#include <config.h>
@@ -223,6 +223,13 @@ ns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
dns_zone_setchecknames(zone, dns_c_severity_warn);
#endif
+ if (czone->ztype == dns_c_zone_slave)
+ RETERR(configure_zone_acl(czone, cctx, cview, ac, zone,
+ dns_c_zone_getallownotify,
+ dns_c_view_getallownotify,
+ dns_c_ctx_getallownotify,
+ dns_zone_setnotifyacl,
+ dns_zone_clearnotifyacl));
/*
* XXXAG This probably does not make sense for stubs.
*/
@@ -275,7 +282,7 @@ ns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
result = dns_c_ctx_getalsonotify(cctx, &iplist);
if (result == ISC_R_SUCCESS) {
result = dns_zone_setalsonotify(zone, iplist->ips,
- iplist->nextidx);
+ iplist->nextidx);
dns_c_iplist_detach(&iplist);
if (result != ISC_R_SUCCESS)
return (result);
diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c
index c366c329..3804ef25 100644
--- a/bin/nsupdate/nsupdate.c
+++ b/bin/nsupdate/nsupdate.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: nsupdate.c,v 1.70 2000/12/01 21:37:33 gson Exp $ */
+/* $Id: nsupdate.c,v 1.75 2000/12/11 23:09:40 marka Exp $ */
#include <config.h>
@@ -118,6 +118,7 @@ static isc_entropy_t *entp = NULL;
static isc_boolean_t shuttingdown = ISC_FALSE;
static FILE *input;
static isc_boolean_t interactive = ISC_TRUE;
+static isc_boolean_t seenerror = ISC_FALSE;
typedef struct nsu_requestinfo {
dns_message_t *msg;
@@ -490,21 +491,21 @@ setup_system(void) {
static void
get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr) {
- struct in_addr in4;
- struct in6_addr in6;
+ struct in_addr in4;
+ struct in6_addr in6;
#if defined(HAVE_ADDRINFO) && defined(HAVE_GETADDRINFO)
struct addrinfo *res = NULL;
int result;
#else
- struct hostent *he;
+ struct hostent *he;
#endif
- ddebug("get_address()");
- if (have_ipv6 && inet_pton(AF_INET6, host, &in6) == 1)
- isc_sockaddr_fromin6(sockaddr, &in6, port);
- else if (inet_pton(AF_INET, host, &in4) == 1)
- isc_sockaddr_fromin(sockaddr, &in4, port);
- else {
+ ddebug("get_address()");
+ if (have_ipv6 && inet_pton(AF_INET6, host, &in6) == 1)
+ isc_sockaddr_fromin6(sockaddr, &in6, port);
+ else if (inet_pton(AF_INET, host, &in4) == 1)
+ isc_sockaddr_fromin(sockaddr, &in4, port);
+ else {
#if defined(HAVE_ADDRINFO) && defined(HAVE_GETADDRINFO)
result = getaddrinfo(host, NULL, NULL, &res);
if (result != 0) {
@@ -516,16 +517,16 @@ get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr) {
isc_sockaddr_setport(sockaddr, port);
freeaddrinfo(res);
#else
- he = gethostbyname(host);
- if (he == NULL)
- fatal("Couldn't look up your server host %s. errno=%d",
- host, h_errno);
- INSIST(he->h_addrtype == AF_INET);
- isc_sockaddr_fromin(sockaddr,
- (struct in_addr *)(he->h_addr_list[0]),
- port);
+ he = gethostbyname(host);
+ if (he == NULL)
+ fatal("Couldn't look up your server host %s. errno=%d",
+ host, h_errno);
+ INSIST(he->h_addrtype == AF_INET);
+ isc_sockaddr_fromin(sockaddr,
+ (struct in_addr *)(he->h_addr_list[0]),
+ port);
#endif
- }
+ }
}
static void
@@ -969,7 +970,7 @@ update_addordelete(char *cmdline, isc_boolean_t isdelete) {
* which will be equal to TTL_MAX.
*/
fprintf(stderr, "ttl '%s' is out of range "
- "(1 to %d)\n", word, TTL_MAX);
+ "(0 to %d)\n", word, TTL_MAX);
goto failure;
}
} else
@@ -1193,6 +1194,7 @@ update_completed(isc_task_t *task, isc_event_t *event) {
if (reqev->result != ISC_R_SUCCESS) {
fprintf(stderr, "; Communication with server failed: %s\n",
isc_result_totext(reqev->result));
+ seenerror = ISC_TRUE;
goto done;
}
@@ -1201,6 +1203,8 @@ update_completed(isc_task_t *task, isc_event_t *event) {
result = dns_request_getresponse(reqev->request, rcvmsg,
DNS_MESSAGEPARSE_PRESERVEORDER);
check_result(result, "dns_request_getresponse");
+ if (rcvmsg->rcode != dns_rcode_noerror)
+ seenerror = ISC_TRUE;
if (debugging) {
isc_buffer_t *buf = NULL;
int bufsz;
@@ -1275,7 +1279,7 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
dns_name_t *name = NULL;
dns_rdataset_t *soaset = NULL;
dns_rdata_soa_t soa;
- dns_rdata_t soarr;
+ dns_rdata_t soarr = DNS_RDATA_INIT;
int pass = 0;
dns_name_t master;
isc_sockaddr_t *serveraddr, tempaddr;
@@ -1283,6 +1287,7 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
nsu_requestinfo_t *reqinfo;
dns_message_t *soaquery = NULL;
isc_sockaddr_t *addr;
+ isc_boolean_t seencname = ISC_FALSE;
UNUSED(task);
@@ -1311,11 +1316,10 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
ddebug("Destroying request [%lx]", request);
dns_request_destroy(&request);
dns_message_renderreset(soaquery);
- sendrequest(localaddr,&servers[ns_inuse], soaquery, &request);
+ sendrequest(localaddr, &servers[ns_inuse], soaquery, &request);
isc_mem_put(mctx, reqinfo, sizeof(nsu_requestinfo_t));
return;
}
- dns_message_destroy(&soaquery);
isc_mem_put(mctx, reqinfo, sizeof(nsu_requestinfo_t));
ddebug("About to create rcvmsg");
@@ -1374,14 +1378,52 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
&soaset);
if (result == ISC_R_SUCCESS)
break;
+ if (section == DNS_SECTION_ANSWER) {
+ dns_rdataset_t *tset = NULL;
+ if (dns_message_findtype(name, dns_rdatatype_cname, 0,
+ &tset) == ISC_R_SUCCESS
+ ||
+ dns_message_findtype(name, dns_rdatatype_dname, 0,
+ &tset) == ISC_R_SUCCESS
+ )
+ {
+ seencname = ISC_TRUE;
+ break;
+ }
+ }
+
result = dns_message_nextname(rcvmsg, section);
}
- if (soaset == NULL) {
+ if (soaset == NULL && !seencname) {
pass++;
goto lookforsoa;
}
+ if (seencname) {
+ dns_name_t tname;
+ unsigned int nlabels;
+
+ result = dns_message_firstname(soaquery, DNS_SECTION_QUESTION);
+ INSIST(result == ISC_R_SUCCESS);
+ name = NULL;
+ dns_message_currentname(soaquery, DNS_SECTION_QUESTION, &name);
+ nlabels = dns_name_countlabels(name);
+ if (nlabels == 1)
+ fatal("could not find enclosing zone");
+ dns_name_init(&tname, NULL);
+ dns_name_getlabelsequence(name, 1, nlabels - 1, &tname);
+ dns_name_clone(&tname, name);
+ dns_request_destroy(&request);
+ dns_message_renderreset(soaquery);
+ if (userserver != NULL)
+ sendrequest(localaddr, userserver, soaquery, &request);
+ else
+ sendrequest(localaddr, &servers[ns_inuse], soaquery,
+ &request);
+ goto out;
+ }
+
if (debugging) {
char namestr[DNS_NAME_FORMATSIZE];
dns_name_format(name, namestr, sizeof(namestr));
@@ -1426,9 +1468,12 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
send_update(zonename, serveraddr, localaddr);
+ dns_message_destroy(&soaquery);
+ dns_request_destroy(&request);
+
+ out:
dns_rdata_freestruct(&soa);
dns_message_destroy(&rcvmsg);
- dns_request_destroy(&request);
ddebug("Out of recvsoa");
}
@@ -1596,24 +1641,27 @@ getinput(isc_task_t *task, isc_event_t *event) {
int
main(int argc, char **argv) {
- isc_result_t result;
+ isc_result_t result;
input = stdin;
isc_app_start();
- parse_args(argc, argv);
+ parse_args(argc, argv);
- setup_system();
+ setup_system();
result = isc_app_onrun(mctx, global_task, getinput, NULL);
check_result(result, "isc_app_onrun");
(void)isc_app_run();
- cleanup();
+ cleanup();
isc_app_finish();
- return (0);
+ if (seenerror)
+ return (2);
+ else
+ return (0);
}
diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c
index c4e19c58..a1915758 100644
--- a/bin/rndc/rndc.c
+++ b/bin/rndc/rndc.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rndc.c,v 1.35 2000/12/01 21:32:02 gson Exp $ */
+/* $Id: rndc.c,v 1.37 2000/12/15 19:39:58 gson Exp $ */
/*
* Principal Author: DCL
@@ -267,10 +267,10 @@ command is one of the following:\n\
Schedule immediate maintenance for a zone.\n\
stats Write server statistics to the statistics file.\n\
querylog Toggle query logging.\n\
+ dumpdb Dump cache(s) to the dump file (named_dump.db).\n\
stop Save pending updates to master files and stop the server.\n\
halt Stop the server without saving pending updates.\n\
*status Display ps(1) status of named.\n\
- *dumpdb Dump database and cache to /var/tmp/named_dump.db.\n\
*trace Increment debugging level by one.\n\
*notrace Set debugging level to 0.\n\
*restart Restart the server.\n\
@@ -513,8 +513,7 @@ main(int argc, char **argv) {
notify(command);
- if (strcmp(command, "dumpdb") == 0 ||
- strcmp(command, "notrace") == 0 ||
+ if (strcmp(command, "notrace") == 0 ||
strcmp(command, "restart") == 0 ||
strcmp(command, "status") == 0 ||
strcmp(command, "trace") == 0) {
diff --git a/bin/tests/adb_test.c b/bin/tests/adb_test.c
index 98bf4c7c..712585b0 100644
--- a/bin/tests/adb_test.c
+++ b/bin/tests/adb_test.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: adb_test.c,v 1.59 2000/11/10 05:34:07 bwelling Exp $ */
+/* $Id: adb_test.c,v 1.60 2000/12/21 02:50:43 gson Exp $ */
#include <config.h>
@@ -41,7 +41,7 @@
typedef struct client client_t;
struct client {
dns_name_t name;
- char *target;
+ const char *target;
ISC_LINK(client_t) link;
dns_adbfind_t *find;
};
diff --git a/bin/tests/db/t_db.c b/bin/tests/db/t_db.c
index 9b9fdc16..3a8b46f3 100644
--- a/bin/tests/db/t_db.c
+++ b/bin/tests/db/t_db.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: t_db.c,v 1.25 2000/08/01 01:13:35 tale Exp $ */
+/* $Id: t_db.c,v 1.26 2000/12/11 23:09:43 marka Exp $ */
#include <config.h>
@@ -896,10 +896,10 @@ t_dns_db_newversion(char **av) {
isc_buffer_t newname_buffer;
dns_fixedname_t dns_newname;
dns_fixedname_t dns_foundname;
- dns_rdata_t added_rdata;
+ dns_rdata_t added_rdata = DNS_RDATA_INIT;
const char * added_rdata_data;
dns_rdataset_t added_rdataset;
- dns_rdata_t found_rdata;
+ dns_rdata_t found_rdata = DNS_RDATA_INIT;
dns_rdataset_t found_rdataset;
dns_rdatatype_t rdatatype;
dns_rdataclass_t rdataclass;
@@ -1174,10 +1174,10 @@ t_dns_db_closeversion_1(char **av) {
dns_fixedname_t dns_newname;
dns_fixedname_t dns_foundname;
dns_fixedname_t dns_existingname;
- dns_rdata_t added_rdata;
+ dns_rdata_t added_rdata = DNS_RDATA_INIT;
const char * added_rdata_data;
dns_rdataset_t added_rdataset;
- dns_rdata_t found_rdata;
+ dns_rdata_t found_rdata = DNS_RDATA_INIT;
dns_rdataset_t found_rdataset;
dns_rdatatype_t new_rdatatype;
dns_rdatatype_t existing_rdatatype;
@@ -1535,10 +1535,10 @@ t_dns_db_closeversion_2(char **av) {
dns_fixedname_t dns_newname;
dns_fixedname_t dns_foundname;
dns_fixedname_t dns_existingname;
- dns_rdata_t added_rdata;
+ dns_rdata_t added_rdata = DNS_RDATA_INIT;
const char * added_rdata_data;
dns_rdataset_t added_rdataset;
- dns_rdata_t found_rdata;
+ dns_rdata_t found_rdata = DNS_RDATA_INIT;
dns_rdataset_t found_rdataset;
dns_rdatatype_t new_rdatatype;
dns_rdatatype_t existing_rdatatype;
diff --git a/bin/tests/genrandom.c b/bin/tests/genrandom.c
index 27384dea..e8122f28 100644
--- a/bin/tests/genrandom.c
+++ b/bin/tests/genrandom.c
@@ -15,7 +15,9 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: genrandom.c,v 1.6 2000/08/14 03:32:53 gson Exp $ */
+/* $Id: genrandom.c,v 1.7 2000/12/23 22:02:48 tale Exp $ */
+
+#include <config.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/bin/tests/log_test.c b/bin/tests/log_test.c
index a4c294bb..244a5022 100644
--- a/bin/tests/log_test.c
+++ b/bin/tests/log_test.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log_test.c,v 1.20 2000/08/01 01:12:56 tale Exp $ */
+/* $Id: log_test.c,v 1.21 2000/12/23 19:24:18 tale Exp $ */
/* Principal Authors: DCL */
@@ -104,7 +104,7 @@ main (int argc, char **argv) {
"8 lines to stderr (first 4 numbered, #3 repeated)\n",
file_versions == 0 || file_versions == ISC_LOG_ROLLNEVER ? 1 :
file_versions > 0 ? file_versions + 1 : FILE_VERSIONS + 1,
- " /tmp/test_log files, and\n",
+ " " TEST_FILE " files, and\n",
"2 lines to syslog\n",
"lines ending with exclamation marks are errors\n\n");
@@ -112,6 +112,7 @@ main (int argc, char **argv) {
mctx = NULL;
lctx = NULL;
+ lcfg = NULL;
CHECK(isc_mem_create(0, 0, &mctx));
CHECK(isc_log_create(mctx, &lctx, &lcfg));
diff --git a/bin/tests/names/dns_name_fromwire_1_data b/bin/tests/names/dns_name_fromwire_1_data
index f3291502..549a8b03 100644
--- a/bin/tests/names/dns_name_fromwire_1_data
+++ b/bin/tests/names/dns_name_fromwire_1_data
@@ -15,7 +15,6 @@
# DNS_COMPRESS_ALL
# DNS_COMPRESS_GLOBAL
# DNS_COMPRESS_GLOBAL14
-# DNS_COMPRESS_GLOBAL16
# DNS_COMPRESS_NONE
#
# and where exp_name is the expected name after any decompression
diff --git a/bin/tests/names/dns_name_fromwire_2_data b/bin/tests/names/dns_name_fromwire_2_data
index fd790c0a..d6694905 100644
--- a/bin/tests/names/dns_name_fromwire_2_data
+++ b/bin/tests/names/dns_name_fromwire_2_data
@@ -15,7 +15,6 @@
# DNS_COMPRESS_ALL
# DNS_COMPRESS_GLOBAL
# DNS_COMPRESS_GLOBAL14
-# DNS_COMPRESS_GLOBAL16
# DNS_COMPRESS_NONE
#
# and where exp_name is the expected name after any decompression
diff --git a/bin/tests/names/dns_name_fromwire_3_data b/bin/tests/names/dns_name_fromwire_3_data
index 04a16385..deeca0a3 100644
--- a/bin/tests/names/dns_name_fromwire_3_data
+++ b/bin/tests/names/dns_name_fromwire_3_data
@@ -15,7 +15,6 @@
# DNS_COMPRESS_ALL
# DNS_COMPRESS_GLOBAL
# DNS_COMPRESS_GLOBAL14
-# DNS_COMPRESS_GLOBAL16
# DNS_COMPRESS_NONE
#
# and where exp_name is the expected name after any decompression
diff --git a/bin/tests/names/dns_name_fromwire_4_data b/bin/tests/names/dns_name_fromwire_4_data
index 4dc91049..a45855e1 100644
--- a/bin/tests/names/dns_name_fromwire_4_data
+++ b/bin/tests/names/dns_name_fromwire_4_data
@@ -15,7 +15,6 @@
# DNS_COMPRESS_ALL
# DNS_COMPRESS_GLOBAL
# DNS_COMPRESS_GLOBAL14
-# DNS_COMPRESS_GLOBAL16
# DNS_COMPRESS_NONE
#
# and where exp_name is the expected name after any decompression
diff --git a/bin/tests/names/dns_name_fromwire_5_data b/bin/tests/names/dns_name_fromwire_5_data
index 0803e0df..4d2da865 100644
--- a/bin/tests/names/dns_name_fromwire_5_data
+++ b/bin/tests/names/dns_name_fromwire_5_data
@@ -15,7 +15,6 @@
# DNS_COMPRESS_ALL
# DNS_COMPRESS_GLOBAL
# DNS_COMPRESS_GLOBAL14
-# DNS_COMPRESS_GLOBAL16
# DNS_COMPRESS_NONE
#
# and where exp_name is the expected name after any decompression
diff --git a/bin/tests/names/dns_name_fromwire_6_data b/bin/tests/names/dns_name_fromwire_6_data
index fdd6ca8d..39dd88b2 100644
--- a/bin/tests/names/dns_name_fromwire_6_data
+++ b/bin/tests/names/dns_name_fromwire_6_data
@@ -15,7 +15,6 @@
# DNS_COMPRESS_ALL
# DNS_COMPRESS_GLOBAL
# DNS_COMPRESS_GLOBAL14
-# DNS_COMPRESS_GLOBAL16
# DNS_COMPRESS_NONE
#
# and where exp_name is the expected name after any decompression
diff --git a/bin/tests/names/dns_name_fromwire_7_data b/bin/tests/names/dns_name_fromwire_7_data
index fd13d533..65c02022 100644
--- a/bin/tests/names/dns_name_fromwire_7_data
+++ b/bin/tests/names/dns_name_fromwire_7_data
@@ -15,7 +15,6 @@
# DNS_COMPRESS_ALL
# DNS_COMPRESS_GLOBAL
# DNS_COMPRESS_GLOBAL14
-# DNS_COMPRESS_GLOBAL16
# DNS_COMPRESS_NONE
#
# and where exp_name is the expected name after any decompression
diff --git a/bin/tests/names/dns_name_fromwire_8_data b/bin/tests/names/dns_name_fromwire_8_data
index b0523abb..160d9a15 100644
--- a/bin/tests/names/dns_name_fromwire_8_data
+++ b/bin/tests/names/dns_name_fromwire_8_data
@@ -15,7 +15,6 @@
# DNS_COMPRESS_ALL
# DNS_COMPRESS_GLOBAL
# DNS_COMPRESS_GLOBAL14
-# DNS_COMPRESS_GLOBAL16
# DNS_COMPRESS_NONE
#
# and where exp_name is the expected name after any decompression
diff --git a/bin/tests/names/dns_name_fromwire_9_data b/bin/tests/names/dns_name_fromwire_9_data
index fb92336c..22e68387 100644
--- a/bin/tests/names/dns_name_fromwire_9_data
+++ b/bin/tests/names/dns_name_fromwire_9_data
@@ -15,7 +15,6 @@
# DNS_COMPRESS_ALL
# DNS_COMPRESS_GLOBAL
# DNS_COMPRESS_GLOBAL14
-# DNS_COMPRESS_GLOBAL16
# DNS_COMPRESS_NONE
#
# and where exp_name is the expected name after any decompression
diff --git a/bin/tests/names/dns_name_towire_1_data b/bin/tests/names/dns_name_towire_1_data
index a853989f..60adf11c 100644
--- a/bin/tests/names/dns_name_towire_1_data
+++ b/bin/tests/names/dns_name_towire_1_data
@@ -9,7 +9,6 @@
# DNS_COMPRESS_ALL
# DNS_COMPRESS_GLOBAL
# DNS_COMPRESS_GLOBAL14
-# DNS_COMPRESS_GLOBAL16
# DNS_COMPRESS_NONE
#
# and where exp_data is the expected wire format data in hex format
diff --git a/bin/tests/names/dns_name_towire_2_data b/bin/tests/names/dns_name_towire_2_data
index 77bfc92e..22aa60ec 100644
--- a/bin/tests/names/dns_name_towire_2_data
+++ b/bin/tests/names/dns_name_towire_2_data
@@ -9,7 +9,6 @@
# DNS_COMPRESS_ALL
# DNS_COMPRESS_GLOBAL
# DNS_COMPRESS_GLOBAL14
-# DNS_COMPRESS_GLOBAL16
# DNS_COMPRESS_NONE
#
# and where exp_data is the expected wire format data in hex format
diff --git a/bin/tests/names/t_names.c b/bin/tests/names/t_names.c
index 28f9eba3..2dc39ff9 100644
--- a/bin/tests/names/t_names.c
+++ b/bin/tests/names/t_names.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: t_names.c,v 1.29 2000/11/14 23:29:47 bwelling Exp $ */
+/* $Id: t_names.c,v 1.30 2000/12/28 00:43:12 bwelling Exp $ */
#include <config.h>
@@ -2242,8 +2242,6 @@ t_dns_name_fromwire_x(const char *testfile, size_t buflen) {
dc_method = DNS_COMPRESS_NONE;
if (! strcmp(tok, "DNS_COMPRESS_GLOBAL14"))
dc_method = DNS_COMPRESS_GLOBAL14;
- else if (! strcmp(tok,"DNS_COMPRESS_GLOBAL16"))
- dc_method = DNS_COMPRESS_GLOBAL16;
else if (! strcmp(tok, "DNS_COMPRESS_GLOBAL"))
dc_method = DNS_COMPRESS_GLOBAL;
else if (! strcmp(tok, "DNS_COMPRESS_ALL"))
diff --git a/bin/tests/rdata_test.c b/bin/tests/rdata_test.c
index 525ce3cd..a9fe7d53 100644
--- a/bin/tests/rdata_test.c
+++ b/bin/tests/rdata_test.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdata_test.c,v 1.33 2000/11/14 23:29:46 bwelling Exp $ */
+/* $Id: rdata_test.c,v 1.34 2000/12/11 23:09:42 marka Exp $ */
#include <config.h>
@@ -786,8 +786,8 @@ main(int argc, char *argv[]) {
isc_buffer_t dbuf;
isc_buffer_t tbuf;
isc_buffer_t wbuf;
- dns_rdata_t rdata;
- dns_rdata_t last;
+ dns_rdata_t rdata = DNS_RDATA_INIT;
+ dns_rdata_t last = DNS_RDATA_INIT;
int need_eol = 0;
int wire = 0;
dns_compress_t cctx;
@@ -1028,7 +1028,7 @@ main(int argc, char *argv[]) {
}
if (tostruct) {
isc_mem_t *mctx2 = NULL;
- dns_rdata_t rdata2;
+ dns_rdata_t rdata2 = DNS_RDATA_INIT;
isc_buffer_t vbuf;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx2)
diff --git a/bin/tests/system/Makefile.in b/bin/tests/system/Makefile.in
index c9909b39..589daf87 100644
--- a/bin/tests/system/Makefile.in
+++ b/bin/tests/system/Makefile.in
@@ -13,9 +13,14 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.21 2000/12/01 02:17:15 gson Exp $
+# $Id: Makefile.in,v 1.22 2000/12/15 01:40:40 gson Exp $
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+top_srcdir = @top_srcdir@
@BIND9_INCLUDES@
+
SUBDIRS = lwresd
TARGETS =
diff --git a/bin/tests/system/README b/bin/tests/system/README
index 227f98a1..a158a578 100644
--- a/bin/tests/system/README
+++ b/bin/tests/system/README
@@ -11,14 +11,14 @@ involving a different DNS setup. They are:
limits/ Tests of handling of large data (close to server limits)
lwresd/ Tests of the lightweight resolver library and daemon
notify/ More NOTIFY tests
- nsupdate/ Dynamic update tests
+ nsupdate/ Dynamic update and IXFR tests
resolver/ Regression tests for resolver bugs that have been fixed
(not a complete resolver test suite)
stub/ Tests of stub zone functionality
unknown/ Unknown type and class tests
upforwd/ Update forwarding tests
views/ Tests of the "views" statement
- xfer/ Zone transfer, update, and NOTIFY tests
+ xfer/ Zone transfer tests
xferquota/ Zone transfer quota tests
Typically each test suite sets up 2-5 name servers and then performs
@@ -48,4 +48,4 @@ The tests can be run individually like this:
To run all the tests, just type "make test".
-$Id: README,v 1.8 2000/11/10 03:05:49 bwelling Exp $
+$Id: README,v 1.9 2000/12/19 19:21:06 gson Exp $
diff --git a/bin/named/named.conf.test b/bin/tests/system/common/controls.conf
index 593bcbfe..d17ac88b 100644
--- a/bin/named/named.conf.test
+++ b/bin/tests/system/common/controls.conf
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999, 2000 Internet Software Consortium.
+ * Copyright (C) 2000 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,14 +15,14 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: named.conf.test,v 1.5 2000/08/01 01:11:52 tale Exp $ */
+/* $Id: controls.conf,v 1.2 2000/12/19 03:42:34 marka Exp $ */
-options {
- directory "/var/named";
- };
+key rndc_key {
+ secret "1234abcd8765";
+ algorithm hmac-md5;
+};
-zone "vix.com" {
- type master;
- file "whatever";
+controls {
+ inet 10.53.0.2 port 9953 allow { any; } keys { rndc_key; };
};
diff --git a/bin/tests/system/views/rndc.conf b/bin/tests/system/common/rndc.conf
index e570dc71..f7ca17b8 100644
--- a/bin/tests/system/views/rndc.conf
+++ b/bin/tests/system/common/rndc.conf
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rndc.conf,v 1.3 2000/08/01 01:16:46 tale Exp $ */
+/* $Id: rndc.conf,v 1.1 2000/12/18 21:04:15 gson Exp $ */
options {
default-key "rndc_key";
diff --git a/bin/tests/system/common/root.hint b/bin/tests/system/common/root.hint
new file mode 100644
index 00000000..57367c3d
--- /dev/null
+++ b/bin/tests/system/common/root.hint
@@ -0,0 +1,20 @@
+; Copyright (C) 2000 Internet Software Consortium.
+;
+; 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 INTERNET SOFTWARE CONSORTIUM
+; DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+; INTERNET SOFTWARE CONSORTIUM 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.
+
+; $Id: root.hint,v 1.1 2000/12/22 17:01:51 gson Exp $
+
+$TTL 999999
+. IN NS a.root-servers.nil.
+a.root-servers.nil. IN A 10.53.0.1
diff --git a/bin/tests/system/glue/ns1/named.conf b/bin/tests/system/glue/ns1/named.conf
index b8cb66b6..c881b6df 100644
--- a/bin/tests/system/glue/ns1/named.conf
+++ b/bin/tests/system/glue/ns1/named.conf
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: named.conf,v 1.6 2000/11/28 19:06:26 gson Exp $ */
+/* $Id: named.conf,v 1.7 2000/12/12 23:05:58 bwelling Exp $ */
options {
query-source address 10.53.0.1;
@@ -27,6 +27,7 @@ options {
listen-on-v6 { none; };
recursion no;
notify no;
+ cache-file "cache";
};
zone "." {
diff --git a/bin/tests/system/glue/ns1/namedopts b/bin/tests/system/glue/ns1/namedopts
deleted file mode 100644
index f31953b9..00000000
--- a/bin/tests/system/glue/ns1/namedopts
+++ /dev/null
@@ -1 +0,0 @@
--x cache
diff --git a/bin/tests/system/lwresd/lwtest.c b/bin/tests/system/lwresd/lwtest.c
index 562c6ddf..501b8c3a 100644
--- a/bin/tests/system/lwresd/lwtest.c
+++ b/bin/tests/system/lwresd/lwtest.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lwtest.c,v 1.18 2000/11/02 02:05:01 bwelling Exp $ */
+/* $Id: lwtest.c,v 1.19 2000/12/20 03:42:01 bwelling Exp $ */
#include <config.h>
@@ -597,17 +597,23 @@ test_getnameinfo(const char *address, int af, const char *name) {
static void
test_getrrsetbyname(const char *name, int rdclass, int rdtype,
- unsigned int nrdatas, unsigned int nsigs)
+ unsigned int nrdatas, unsigned int nsigs,
+ int should_pass)
{
int ret;
struct rrsetinfo *rrinfo = NULL;
ret = getrrsetbyname(name, rdclass, rdtype, 0, &rrinfo);
- if (ret != 0) {
- printf("I:getrrsetbyname(%s, %d) returned %d, expected %d\n",
- name, rdtype, ret, 0);
+ if (ret != 0 && should_pass == 1) {
+ printf("I:getrrsetbyname(%s, %d) failed\n", name, rdtype);
fails++;
return;
- }
+ } else if (ret == 0 && should_pass == 0) {
+ printf("I:getrrsetbyname(%s, %d) unexpectedly succeeded\n",
+ name, rdtype);
+ fails++;
+ return;
+ } else if (ret != 0)
+ return;
if (rrinfo->rri_nrdatas != nrdatas) {
printf("I:getrrsetbyname(%s, %d): got %d rr, expected %d\n",
name, rdtype, rrinfo->rri_nrdatas, nrdatas);
@@ -743,9 +749,11 @@ main(void) {
test_getnameinfo("1122:3344:5566:7788:99aa:bbcc:ddee:ff00",
AF_INET6, "dname.example1");
- test_getrrsetbyname("a", 1, 1, 1, 0);
- test_getrrsetbyname("a.example1.", 1, 1, 1, 0);
- test_getrrsetbyname("e.example1.", 1, 1, 1, 1);
+ test_getrrsetbyname("a", 1, 1, 1, 0, 1);
+ test_getrrsetbyname("a.example1.", 1, 1, 1, 0, 1);
+ test_getrrsetbyname("e.example1.", 1, 1, 1, 1, 1);
+ test_getrrsetbyname("e.example1.", 1, 255, 1, 1, 0);
+ test_getrrsetbyname("e.example1.", 1, 24, 1, 0, 1);
if (fails == 0)
printf("I:ok\n");
diff --git a/bin/tests/system/nsupdate/clean.sh b/bin/tests/system/nsupdate/clean.sh
index 2cddd9e5..1129f476 100755
--- a/bin/tests/system/nsupdate/clean.sh
+++ b/bin/tests/system/nsupdate/clean.sh
@@ -15,13 +15,14 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: clean.sh,v 1.5 2000/08/01 01:16:11 tale Exp $
+# $Id: clean.sh,v 1.6 2000/12/21 23:44:47 gson Exp $
#
# Clean up after zone transfer tests.
#
-rm -f dig.out.ns1 dig.out.ns2 dig.out.ns1.after ns1/*.jnl ns2/*.jnl ns1/*.db
+rm -f dig.out.ns1 dig.out.ns2 dig.out.ns1.after ns1/*.jnl ns2/*.jnl \
+ ns1/example.db ns1/update.db
diff --git a/bin/tests/system/nsupdate/ns1/example1.db b/bin/tests/system/nsupdate/ns1/example1.db
new file mode 100644
index 00000000..51a8d321
--- /dev/null
+++ b/bin/tests/system/nsupdate/ns1/example1.db
@@ -0,0 +1,159 @@
+; Copyright (C) 2000 Internet Software Consortium.
+;
+; 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 INTERNET SOFTWARE CONSORTIUM
+; DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+; INTERNET SOFTWARE CONSORTIUM 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.
+
+; $Id: example1.db,v 1.1 2000/12/21 23:44:51 gson Exp $
+
+$ORIGIN .
+$TTL 300 ; 5 minutes
+example.nil IN SOA ns1.example.nil. hostmaster.example.nil. (
+ 1 ; serial
+ 2000 ; refresh (2000 seconds)
+ 2000 ; retry (2000 seconds)
+ 1814400 ; expire (3 weeks)
+ 3600 ; minimum (1 hour)
+ )
+example.nil. NS ns2.example.nil.
+ns1.example.nil. A 10.53.0.1
+example.nil. NS ns3.example.nil.
+ns2.example.nil. A 10.53.0.2
+
+$ORIGIN example.nil.
+* MX 10 mail
+a TXT "foo foo foo"
+ PTR foo.net.
+$TTL 3600 ; 1 hour
+a01 A 0.0.0.0
+a02 A 255.255.255.255
+a601 A6 0 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
+ A6 64 ::ffff:ffff:ffff:ffff foo.
+ A6 127 ::1 foo.
+ A6 128 .
+afsdb01 AFSDB 0 hostname
+afsdb02 AFSDB 65535 .
+$TTL 300 ; 5 minutes
+b CNAME foo.net.
+c A 73.80.65.49
+$TTL 3600 ; 1 hour
+cert01 CERT 65534 65535 PRIVATEOID (
+ MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgi
+ WCn/GxHhai6VAuHAoNUz4YoU1tVfSCSqQYn6//11U6Nl
+ d80jEeC8aTrO+KKmCaY= )
+cname01 CNAME cname-target.
+cname02 CNAME cname-target
+cname03 CNAME .
+$TTL 300 ; 5 minutes
+d A 73.80.65.49
+$TTL 3600 ; 1 hour
+dname01 DNAME dname-target.
+dname02 DNAME dname-target
+dname03 DNAME .
+$TTL 300 ; 5 minutes
+e MX 10 mail
+ TXT "one"
+ TXT "three"
+ TXT "two"
+ A 73.80.65.49
+ A 73.80.65.50
+ A 73.80.65.52
+ A 73.80.65.51
+f A 73.80.65.52
+$TTL 3600 ; 1 hour
+gpos01 GPOS "-22.6882" "116.8652" "250.0"
+gpos02 GPOS "" "" ""
+hinfo01 HINFO "Generic PC clone" "NetBSD-1.4"
+hinfo02 HINFO "PC" "NetBSD"
+isdn01 ISDN "isdn-address"
+isdn02 ISDN "isdn-address" "subaddress"
+isdn03 ISDN "isdn-address"
+isdn04 ISDN "isdn-address" "subaddress"
+key01 KEY 512 255 1 (
+ AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aR
+ yzWZriO6i2odGWWQVucZqKVsENW91IOW4vqudngPZsY3
+ GvQ/xVA8/7pyFj6b7Esga60zyGW6LFe9r8n6paHrlG5o
+ jqf0BaqHT+8= )
+kx01 KX 10 kdc
+kx02 KX 10 .
+loc01 LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m
+loc02 LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m
+mb01 MG madname
+mb02 MG .
+md01 MD madname
+ MD .
+mf01 MF madname
+ MF .
+mg01 MG mgmname
+mg02 MG .
+minfo01 MINFO rmailbx emailbx
+minfo02 MINFO . .
+mr01 MR mrname
+mr02 MR .
+mx01 MX 10 mail
+mx02 MX 10 .
+naptr01 NAPTR 0 0 "" "" "" .
+naptr02 NAPTR 65535 65535 "blurgh" "blorf" "blegh" foo.
+nsap-ptr01 NSAP-PTR foo.
+ NSAP-PTR .
+nsap01 NSAP 0x47000580005a0000000001e133ffffff00016100
+nsap02 NSAP 0x47000580005a0000000001e133ffffff00016100
+nxt01 NXT a.secure ( NS SOA MX SIG KEY LOC NXT )
+nxt02 NXT . ( NSAP-PTR NXT )
+nxt03 NXT . ( A )
+nxt04 NXT . ( 127 )
+ptr01 PTR example.nil.
+px01 PX 65535 foo. bar.
+px02 PX 65535 . .
+rp01 RP mbox-dname txt-dname
+rp02 RP . .
+rt01 RT 0 intermediate-host
+rt02 RT 65535 .
+$TTL 300 ; 5 minutes
+s NS ns.s
+$ORIGIN s.example.nil.
+ns A 73.80.65.49
+$ORIGIN example.nil.
+$TTL 3600 ; 1 hour
+sig01 SIG NXT 1 3 3600 20000102030405 (
+ 19961211100908 2143 foo
+ MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgi
+ WCn/GxHhai6VAuHAoNUz4YoU1tVfSCSqQYn6//11U6Nl
+ d80jEeC8aTrO+KKmCaY= )
+srv01 SRV 0 0 0 .
+srv02 SRV 65535 65535 65535 old-slow-box.example.com.
+$TTL 301 ; 5 minutes 1 second
+t A 73.80.65.49
+$TTL 3600 ; 1 hour
+txt01 TXT "foo"
+txt02 TXT "foo" "bar"
+txt03 TXT "foo"
+txt04 TXT "foo" "bar"
+txt05 TXT "foo bar"
+txt06 TXT "foo bar"
+txt07 TXT "foo bar"
+txt08 TXT "foo\010bar"
+txt09 TXT "foo\010bar"
+txt10 TXT "foo bar"
+txt11 TXT "\"foo\""
+txt12 TXT "\"foo\""
+$TTL 300 ; 5 minutes
+u TXT "txt-not-in-nxt"
+$ORIGIN u.example.nil.
+a A 73.80.65.49
+b A 73.80.65.49
+$ORIGIN example.nil.
+$TTL 3600 ; 1 hour
+wks01 WKS 10.0.0.1 6 ( 0 1 2 21 23 )
+wks02 WKS 10.0.0.1 17 ( 0 1 2 53 )
+wks03 WKS 10.0.0.2 6 ( 65535 )
+x2501 X25 "123456789"
diff --git a/bin/tests/system/nsupdate/setup.sh b/bin/tests/system/nsupdate/setup.sh
index ab81e49c..367e9edf 100755
--- a/bin/tests/system/nsupdate/setup.sh
+++ b/bin/tests/system/nsupdate/setup.sh
@@ -15,14 +15,28 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: setup.sh,v 1.4 2000/08/01 01:16:12 tale Exp $
+# $Id: setup.sh,v 1.5 2000/12/21 23:44:49 gson Exp $
#
# jnl and database files MUST be removed before we start
#
rm -f ns1/*.jnl ns1/example.db ns2/*.jnl ns2/example.bk
-cp ns1/example.orig ns1/example.db
-cp ns1/update.orig ns1/update.db
+cp ns1/example1.db ns1/example.db
+# update_test.pl has its own zone file because it
+# requires a specific NS record set.
+cat <<\EOF >ns1/update.db
+$ORIGIN .
+$TTL 300 ; 5 minutes
+update.nil IN SOA ns1.example.nil. hostmaster.example.nil. (
+ 1 ; serial
+ 2000 ; refresh (2000 seconds)
+ 2000 ; retry (2000 seconds)
+ 1814400 ; expire (3 weeks)
+ 3600 ; minimum (1 hour)
+ )
+update.nil. NS ns1.update.nil.
+ns1.update.nil. A 10.53.0.2
+EOF
diff --git a/bin/tests/system/nsupdate/update_test.pl b/bin/tests/system/nsupdate/update_test.pl
index 0b9b3da8..9240651b 100644
--- a/bin/tests/system/nsupdate/update_test.pl
+++ b/bin/tests/system/nsupdate/update_test.pl
@@ -37,7 +37,7 @@
#
# perl -MCPAN -e "install Net::DNS"
#
-# $Id: update_test.pl,v 1.4 2000/08/01 01:16:14 tale Exp $
+# $Id: update_test.pl,v 1.5 2000/12/16 00:58:03 gson Exp $
#
use Getopt::Std;
@@ -375,12 +375,40 @@ section("Updating TTLs only");
test("NOERROR", ["update", rr_add("t.$zone 300 A 73.80.65.49")]);
($a) = $res->query("t.$zone", "A")->answer;
-assert($a->ttl == 300);
+$ttl = $a->ttl;
+assert($ttl == 300, "incorrect TTL value $ttl != 300");
test("NOERROR", ["update",
rr_del("t.$zone 300 A 73.80.65.49"),
rr_add("t.$zone 301 A 73.80.65.49")]);
($a) = $res->query("t.$zone", "A")->answer;
-assert($a->ttl == 301);
+$ttl = $a->ttl;
+assert($ttl == 301, "incorrect TTL value $ttl != 301");
+
+# Add an RR that is identical to an existing one except for the TTL.
+# RFC2136 is not clear about what this should do; it says "duplicate RRs
+# will be silently ignored" but is an RR differing only in TTL
+# to be considered a duplicate or not? The test assumes that it
+# should not be considered a duplicate.
+test("NOERROR", ["update", rr_add("t.$zone 302 A 73.80.65.50")]);
+($a) = $res->query("t.$zone", "A")->answer;
+$ttl = $a->ttl;
+assert($ttl == 302, "incorrect TTL value $ttl != 302");
+
+section("TTL normalization");
+
+# The desired behaviour is that the old RRs get their TTL
+# changed to match the new one. RFC2136 does not explicitly
+# specify this, but I think it makes more sense than the
+# alternatives.
+
+test("NOERROR", ["update", rr_add("t.$zone 303 A 73.80.65.51")]);
+(@answers) = $res->query("t.$zone", "A")->answer;
+$nanswers = scalar @answers;
+assert($nanswers == 3, "wrong number of answers $nanswers != 3");
+foreach $a (@answers) {
+ $ttl = $a->ttl;
+ assert($ttl == 303, "incorrect TTL value $ttl != 303");
+}
section("Obscuring existing data by zone cut");
test("NOERROR", ["update", rr_add("a.u.$zone 300 A 73.80.65.49")]);
diff --git a/bin/tests/system/run.sh b/bin/tests/system/run.sh
index 86958efa..04efa902 100755
--- a/bin/tests/system/run.sh
+++ b/bin/tests/system/run.sh
@@ -15,7 +15,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: run.sh,v 1.34 2000/11/22 18:31:27 gson Exp $
+# $Id: run.sh,v 1.35 2000/12/06 19:37:19 bwelling Exp $
#
# Run a system test.
@@ -101,6 +101,7 @@ status=`expr $status + $?`
if [ $status != 0 ]; then
echo "R:FAIL"
# Don't clean up - we need the evidence.
+ find . -name core -exec chmod 0644 '{}' \;
else
echo "R:PASS"
diff --git a/bin/tests/system/stress/clean.sh b/bin/tests/system/stress/clean.sh
new file mode 100755
index 00000000..3a519833
--- /dev/null
+++ b/bin/tests/system/stress/clean.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# Copyright (C) 2000 Internet Software Consortium.
+#
+# 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 INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM 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.
+
+# $Id: clean.sh,v 1.1 2000/12/22 17:03:01 gson Exp $
+
+rm -f reload.pid
+
+rm -f ns?/zones.conf
+rm -f ns?/zone*.bk
+
+rm -f ns1/delegations.db
+
+rm -f ns2/zone0*.db
+rm -f ns2/zone0*.jnl
diff --git a/bin/tests/system/stress/ns1/named.conf b/bin/tests/system/stress/ns1/named.conf
new file mode 100644
index 00000000..6fd2c3d6
--- /dev/null
+++ b/bin/tests/system/stress/ns1/named.conf
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * 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 INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM 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.
+ */
+
+/* $Id: named.conf,v 1.1 2000/12/22 17:03:02 gson Exp $ */
+
+options {
+ query-source address 10.53.0.1;
+ notify-source 10.53.0.1;
+ transfer-source 10.53.0.1;
+ port 5300;
+ pid-file "named.pid";
+ listen-on { 10.53.0.1; };
+ listen-on-v6 { none; };
+ recursion no;
+ notify yes;
+};
+
+zone "." {
+ type master;
+ file "root.db";
+};
diff --git a/bin/tests/system/stress/ns1/root.db b/bin/tests/system/stress/ns1/root.db
new file mode 100644
index 00000000..66f9b345
--- /dev/null
+++ b/bin/tests/system/stress/ns1/root.db
@@ -0,0 +1,40 @@
+ 300
+. IN SOA gson.nominum.com. a.root.servers.nil. (
+ 2000042100 ; serial
+ 600 ; refresh
+ 600 ; retry
+ 1200 ; expire
+ 600 ; minimum
+ )
+. NS a.root-servers.nil.
+a.root-servers.nil. A 10.53.0.1
+zone000000.example. NS ns2.zone000000.example.
+ns2.zone000000.example. A 10.53.0.2
+zone000000.example. NS ns3.zone000000.example.
+ns3.zone000000.example. A 10.53.0.3
+zone000000.example. NS ns4.zone000000.example.
+ns4.zone000000.example. A 10.53.0.4
+zone000001.example. NS ns2.zone000001.example.
+ns2.zone000001.example. A 10.53.0.2
+zone000001.example. NS ns3.zone000001.example.
+ns3.zone000001.example. A 10.53.0.3
+zone000001.example. NS ns4.zone000001.example.
+ns4.zone000001.example. A 10.53.0.4
+zone000002.example. NS ns2.zone000002.example.
+ns2.zone000002.example. A 10.53.0.2
+zone000002.example. NS ns3.zone000002.example.
+ns3.zone000002.example. A 10.53.0.3
+zone000002.example. NS ns4.zone000002.example.
+ns4.zone000002.example. A 10.53.0.4
+zone000003.example. NS ns2.zone000003.example.
+ns2.zone000003.example. A 10.53.0.2
+zone000003.example. NS ns3.zone000003.example.
+ns3.zone000003.example. A 10.53.0.3
+zone000003.example. NS ns4.zone000003.example.
+ns4.zone000003.example. A 10.53.0.4
+zone000004.example. NS ns2.zone000004.example.
+ns2.zone000004.example. A 10.53.0.2
+zone000004.example. NS ns3.zone000004.example.
+ns3.zone000004.example. A 10.53.0.3
+zone000004.example. NS ns4.zone000004.example.
+ns4.zone000004.example. A 10.53.0.4
diff --git a/bin/tests/system/stress/ns2/named.conf b/bin/tests/system/stress/ns2/named.conf
new file mode 100644
index 00000000..5d538fa9
--- /dev/null
+++ b/bin/tests/system/stress/ns2/named.conf
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * 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 INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM 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.
+ */
+
+/* $Id: named.conf,v 1.2 2000/12/22 18:57:16 gson Exp $ */
+
+options {
+ query-source address 10.53.0.2;
+ notify-source 10.53.0.2;
+ transfer-source 10.53.0.2;
+ port 5300;
+ pid-file "named.pid";
+ listen-on { 10.53.0.2; };
+ listen-on-v6 { none; };
+ recursion no;
+ notify yes;
+};
+
+zone "." {
+ type hint;
+ file "../../common/root.hint";
+};
+
+include "zones.conf";
diff --git a/bin/tests/system/stress/ns3/named.conf b/bin/tests/system/stress/ns3/named.conf
new file mode 100644
index 00000000..e27b040b
--- /dev/null
+++ b/bin/tests/system/stress/ns3/named.conf
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * 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 INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM 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.
+ */
+
+/* $Id: named.conf,v 1.2 2000/12/22 18:57:17 gson Exp $ */
+
+options {
+ query-source address 10.53.0.3;
+ notify-source 10.53.0.3;
+ transfer-source 10.53.0.3;
+ port 5300;
+ pid-file "named.pid";
+ listen-on { 10.53.0.3; };
+ listen-on-v6 { none; };
+ recursion yes;
+ notify yes;
+};
+
+key rndc_key {
+ secret "1234abcd8765";
+ algorithm hmac-md5;
+};
+
+controls {
+ inet 10.53.0.3 port 9953 allow { any; } keys { rndc_key; };
+};
+
+zone "." {
+ type hint;
+ file "../../common/root.hint";
+};
+
+server 10.53.0.4 {
+ provide-ixfr no;
+};
+server 10.53.0.2 {
+ request-ixfr no;
+};
+
+include "zones.conf";
diff --git a/bin/tests/system/stress/ns4/named.conf b/bin/tests/system/stress/ns4/named.conf
new file mode 100644
index 00000000..e3e6d493
--- /dev/null
+++ b/bin/tests/system/stress/ns4/named.conf
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * 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 INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM 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.
+ */
+
+/* $Id: named.conf,v 1.2 2000/12/22 18:57:18 gson Exp $ */
+
+options {
+ query-source address 10.53.0.4;
+ notify-source 10.53.0.4;
+ transfer-source 10.53.0.4;
+ port 5300;
+ pid-file "named.pid";
+ listen-on { 10.53.0.4; };
+ listen-on-v6 { none; };
+ recursion yes;
+ notify yes;
+};
+
+zone "." {
+ type hint;
+ file "../../common/root.hint";
+};
+
+include "zones.conf";
+
diff --git a/bin/tests/system/stress/setup.pl b/bin/tests/system/stress/setup.pl
new file mode 100755
index 00000000..af569cf3
--- /dev/null
+++ b/bin/tests/system/stress/setup.pl
@@ -0,0 +1,91 @@
+#!/usr/bin/perl
+#
+# Copyright (C) 2000 Internet Software Consortium.
+#
+# 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 INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM 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.
+
+# $Id: setup.pl,v 1.1 2000/12/22 17:03:01 gson Exp $
+
+#
+# Set up test data for zone transfer quota tests.
+#
+use FileHandle;
+
+my $n_zones = 5;
+my $n_names = 1000;
+
+make_zones(2, undef);
+make_zones(3, "10.53.0.2");
+make_zones(4, "10.53.0.3");
+
+my $rootdelegations =
+ new FileHandle("ns1/root.db", "w") or die;
+
+print $rootdelegations <<END;
+$TTL 300
+. IN SOA gson.nominum.com. a.root.servers.nil. (
+ 2000042100 ; serial
+ 600 ; refresh
+ 600 ; retry
+ 1200 ; expire
+ 600 ; minimum
+ )
+. NS a.root-servers.nil.
+a.root-servers.nil. A 10.53.0.1
+END
+
+for ($z = 0; $z < $n_zones; $z++) {
+ my $zn = sprintf("zone%06d.example", $z);
+ foreach $ns (qw(2 3 4)) {
+ print $rootdelegations "$zn. NS ns$ns.$zn.\n";
+ print $rootdelegations "ns$ns.$zn. A 10.53.0.$ns\n";
+ }
+}
+close $rootdelegations;
+
+sub make_zones {
+ my ($nsno, $slaved_from) = @_;
+ my $namedconf = new FileHandle("ns$nsno/zones.conf", "w") or die;
+ for ($z = 0; $z < $n_zones; $z++) {
+ my $zn = sprintf("zone%06d.example", $z);
+ if (defined($slaved_from)) {
+ print $namedconf "zone \"$zn\" { type slave; " .
+ "file \"$zn.bk\"; masters { $slaved_from; }; };\n";
+ } else {
+ print $namedconf "zone \"$zn\" { " .
+ "type master; " .
+ "allow-update { any; }; " .
+ "file \"$zn.db\"; };\n";
+
+ my $fn = "ns$nsno/$zn.db";
+ my $f = new FileHandle($fn, "w") or die "open: $fn: $!";
+ print $f "\$TTL 300
+\@ IN SOA ns2.$zn. hostmaster 1 300 120 3600 86400
+@ NS ns2.$zn.
+ns2.$zn. A 10.53.0.2
+@ NS ns3.$zn.
+ns3.$zn. A 10.53.0.3
+@ NS ns4.$zn.
+ns4.$zn. A 10.53.0.4
+ MX 10 mail1.isp.example.
+ MX 20 mail2.isp.example.
+";
+ for ($i = 0; $i < $n_names; $i++) {
+ print $f sprintf("name%06d", $i) .
+ " A 10.0.0.1\n";
+ }
+ $f->close;
+ }
+ }
+}
diff --git a/bin/tests/system/stress/setup.sh b/bin/tests/system/stress/setup.sh
new file mode 100755
index 00000000..d3e95ca1
--- /dev/null
+++ b/bin/tests/system/stress/setup.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# Copyright (C) 2000 Internet Software Consortium.
+#
+# 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 INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM 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.
+
+# $Id: setup.sh,v 1.1 2000/12/22 17:03:01 gson Exp $
+
+#
+# Set up test data for zone transfer quota tests.
+#
+
+$PERL setup.pl
diff --git a/bin/tests/system/stress/tests.sh b/bin/tests/system/stress/tests.sh
new file mode 100644
index 00000000..bb6f3434
--- /dev/null
+++ b/bin/tests/system/stress/tests.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# Copyright (C) 2000 Internet Software Consortium.
+#
+# 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 INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM 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.
+
+# $Id: tests.sh,v 1.1 2000/12/22 17:03:01 gson Exp $
+
+SYSTEMTESTTOP=..
+. $SYSTEMTESTTOP/conf.sh
+
+status=0
+
+if $PERL -e 'use Net::DNS;' 2>/dev/null
+then
+ :
+else
+ echo "I:This test requires the Net::DNS library." >&2
+ exit 1
+fi
+
+(
+sh -c "while true
+ do $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 reload 2>&1 |
+ sed 's/^/I:ns3 /';
+ sleep 1
+ done" & echo $! >reload.pid
+) &
+
+for i in 0 1 2 3 4
+do
+ $PERL update.pl -s 10.53.0.2 -p 5300 zone00000$i.example. &
+done
+
+echo "I:waiting for background processes to finish"
+wait
+
+echo "I:killing reload loop"
+kill `cat reload.pid`
+
+echo "I:exit status: $status"
+exit $status
diff --git a/bin/tests/system/stress/update.pl b/bin/tests/system/stress/update.pl
new file mode 100644
index 00000000..ad583473
--- /dev/null
+++ b/bin/tests/system/stress/update.pl
@@ -0,0 +1,107 @@
+#!/usr/bin/perl
+#
+# Copyright (C) 2000 Internet Software Consortium.
+#
+# 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 INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM 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.
+
+#
+# Dynamic update test suite.
+#
+# Usage:
+#
+# perl update_test.pl [-s server] [-p port] zone
+#
+# The server defaults to 127.0.0.1.
+# The port defaults to 53.
+#
+# The "Special NS rules" tests will only work correctly if the
+# has no NS records to begin with, or alternatively has a
+# single NS record pointing at the name "ns1" (relative to
+# the zone name).
+#
+# Installation notes:
+#
+# This program uses the Net::DNS::Resolver module.
+# You can install it by saying
+#
+# perl -MCPAN -e "install Net::DNS"
+#
+# $Id: update.pl,v 1.1 2000/12/22 17:03:02 gson Exp $
+#
+
+use Getopt::Std;
+use Net::DNS;
+use Net::DNS::Update;
+use Net::DNS::Resolver;
+
+$opt_s = "127.0.0.1";
+$opt_p = 53;
+
+getopt('s:p:');
+
+$res = new Net::DNS::Resolver;
+$res->nameservers($opt_s);
+$res->port($opt_p);
+$res->defnames(0); # Do not append default domain.
+
+@ARGV == 1 or die
+ "usage: perl update_test.pl [-s server] [-p port] zone\n";
+
+$zone = shift @ARGV;
+
+my $failures = 0;
+
+sub assert {
+ my ($cond, $explanation) = @_;
+ if (!$cond) {
+ print "I:Test Failed: $explanation ***\n";
+ $failures++
+ }
+}
+
+sub test {
+ my ($expected, @records) = @_;
+
+ my $update = new Net::DNS::Update("$zone");
+
+ foreach $rec (@records) {
+ $update->push(@$rec);
+ }
+
+ $reply = $res->send($update);
+
+ # Did it work?
+ if (defined $reply) {
+ my $rcode = $reply->header->rcode;
+ assert($rcode eq $expected, "expected $expected, got $rcode");
+ } else {
+ print "I:Update failed: ", $res->errorstring, "\n";
+ }
+}
+
+sub section {
+ my ($msg) = @_;
+ print "I:$msg\n";
+}
+
+for ($i = 0; $i < 1000; $i++) {
+ test("NOERROR", ["update", rr_add("dynamic-$i.$zone 300 TXT txt-$i" )]);
+}
+
+if ($failures) {
+ print "I:$failures tests failed.\n";
+} else {
+ print "I:Update of $opt_s zone $zone successful.\n";
+}
+exit $failures;
diff --git a/bin/tests/system/views/ns2/named1.conf b/bin/tests/system/views/ns2/named1.conf
index 98d44acc..197ff82b 100644
--- a/bin/tests/system/views/ns2/named1.conf
+++ b/bin/tests/system/views/ns2/named1.conf
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: named1.conf,v 1.13 2000/11/28 19:06:50 gson Exp $ */
+/* $Id: named1.conf,v 1.14 2000/12/18 23:24:23 gson Exp $ */
options {
query-source address 10.53.0.2;
@@ -29,14 +29,7 @@ options {
notify yes;
};
-key rndc_key {
- secret "1234abcd8765";
- algorithm hmac-md5;
-};
-
-controls {
- inet 10.53.0.2 port 9953 allow { any; } keys { rndc_key; };
-};
+include "../../common/controls.conf";
zone "." {
type hint;
diff --git a/bin/tests/system/views/ns2/named2.conf b/bin/tests/system/views/ns2/named2.conf
index 6b9fca7a..48cc108d 100644
--- a/bin/tests/system/views/ns2/named2.conf
+++ b/bin/tests/system/views/ns2/named2.conf
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: named2.conf,v 1.14 2000/11/28 19:06:51 gson Exp $ */
+/* $Id: named2.conf,v 1.16 2000/12/19 03:42:36 marka Exp $ */
options {
query-source address 10.53.0.2;
@@ -29,14 +29,7 @@ options {
notify yes;
};
-key rndc_key {
- secret "1234abcd8765";
- algorithm hmac-md5;
-};
-
-controls {
- inet 10.53.0.2 port 11953 allow { any; } keys { rndc_key; };
-};
+include "../../common/controls.conf";
view "internal" {
match-clients { 10.53.0.2;
diff --git a/bin/tests/system/views/tests.sh b/bin/tests/system/views/tests.sh
index 0d1e8557..56af567d 100644
--- a/bin/tests/system/views/tests.sh
+++ b/bin/tests/system/views/tests.sh
@@ -15,7 +15,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: tests.sh,v 1.23 2000/11/22 19:00:46 gson Exp $
+# $Id: tests.sh,v 1.24 2000/12/18 23:24:22 gson Exp $
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
@@ -40,8 +40,8 @@ cp ns2/example2.db ns2/example.db
echo "I:sleeping five seconds then reloading ns2 and ns3 with rndc"
sleep 5
-$RNDC -c rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
-$RNDC -c rndc.conf -s 10.53.0.3 -p 9953 reload 2>&1 | sed 's/^/I:ns3 /'
+$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
+$RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 reload 2>&1 | sed 's/^/I:ns3 /'
echo "I:sleeping one minute"
sleep 60
diff --git a/bin/tests/system/xfer/tests.sh b/bin/tests/system/xfer/tests.sh
index ce0740d5..ca004b79 100644
--- a/bin/tests/system/xfer/tests.sh
+++ b/bin/tests/system/xfer/tests.sh
@@ -15,17 +15,19 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: tests.sh,v 1.22 2000/11/20 17:53:41 gson Exp $
+# $Id: tests.sh,v 1.23 2000/12/18 22:39:17 gson Exp $
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
+DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd"
+
status=0
-$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example. \
+$DIG $DIGOPTS example. \
@10.53.0.2 axfr -p 5300 > dig.out.ns2 || status=1
grep ";" dig.out.ns2
-$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example. \
+$DIG $DIGOPTS example. \
@10.53.0.3 axfr -p 5300 > dig.out.ns3 || status=1
grep ";" dig.out.ns3
@@ -33,13 +35,13 @@ $PERL ../digcomp.pl knowngood.dig.out dig.out.ns2 || status=1
$PERL ../digcomp.pl knowngood.dig.out dig.out.ns3 || status=1
-../../../dig/dig +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd \
- tsigzone. @10.53.0.2 axfr -y tsigzone.:1234abcd8765 -p 5300 \
+$DIG $DIGOPTS tsigzone. \
+ @10.53.0.2 axfr -y tsigzone.:1234abcd8765 -p 5300 \
> dig.out.ns2 || status=1
grep ";" dig.out.ns2
-../../../dig/dig +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd \
- tsigzone. @10.53.0.3 axfr -y tsigzone.:1234abcd8765 -p 5300 \
+$DIG $DIGOPTS tsigzone. \
+ @10.53.0.3 axfr -y tsigzone.:1234abcd8765 -p 5300 \
> dig.out.ns3 || status=1
grep ";" dig.out.ns3
diff --git a/bin/tests/update_test.pl b/bin/tests/update_test.pl
deleted file mode 100755
index a11a9988..00000000
--- a/bin/tests/update_test.pl
+++ /dev/null
@@ -1,400 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 1999, 2000 Internet Software Consortium.
-#
-# 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 INTERNET SOFTWARE CONSORTIUM
-# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
-# INTERNET SOFTWARE CONSORTIUM 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.
-
-#
-# Dynamic update test suite.
-#
-# Usage:
-#
-# perl update_test.pl [-s server] [-p port] zone
-#
-# The server defaults to 127.0.0.1.
-# The port defaults to 53.
-#
-# The "Special NS rules" tests will only work correctly if the
-# has no NS records to begin with, or alternatively has a
-# single NS record pointing at the name "ns1" (relative to
-# the zone name).
-#
-# Installation notes:
-#
-# This program uses the Net::DNS::Resolver module.
-# You can install it by saying
-#
-# perl -MCPAN -e "install Net::DNS"
-#
-# $Id: update_test.pl,v 1.6 2000/08/01 01:13:28 tale Exp $
-#
-
-use Getopt::Std;
-use Net::DNS;
-use Net::DNS::Update;
-use Net::DNS::Resolver;
-
-$opt_s = "127.0.0.1";
-$opt_p = 53;
-
-getopt('s:p:');
-
-$res = new Net::DNS::Resolver;
-$res->nameservers($opt_s);
-$res->port($opt_p);
-$res->defnames(0); # Do not append default domain.
-
-@ARGV == 1 or die
- "usage: perl update_test.pl [-s server] [-p port] zone\n";
-
-$zone = shift @ARGV;
-
-my $failures = 0;
-
-sub assert {
- my ($cond, $explanation) = @_;
- if ($cond) {
- print "OK\n";
- } else {
- print "*** Test Failed: $explanation ***\n";
- $failures++
- }
-}
-
-sub test {
- my ($expected, @records) = @_;
-
- my $update = new Net::DNS::Update("$zone");
-
- foreach $rec (@records) {
- $update->push(@$rec);
- }
-
- $reply = $res->send($update);
-
- # Did it work?
- if (defined $reply) {
- my $rcode = $reply->header->rcode;
- assert($rcode eq $expected, "expected $expected, got $rcode");
- } else {
- print "Update failed: ", $res->errorstring, "\n";
- }
-}
-
-sub section {
- my ($msg) = @_;
- print "- $msg\n";
-}
-
-section("Delete any leftovers from previous tests");
-test("NOERROR", ["update", rr_del("a.$zone")]);
-test("NOERROR", ["update", rr_del("b.$zone")]);
-test("NOERROR", ["update", rr_del("c.$zone")]);
-test("NOERROR", ["update", rr_del("d.$zone")]);
-test("NOERROR", ["update", rr_del("e.$zone")]);
-test("NOERROR", ["update", rr_del("f.$zone")]);
-test("NOERROR", ["update", rr_del("ns.s.$zone")]);
-test("NOERROR", ["update", rr_del("s.$zone")]);
-test("NOERROR", ["update", rr_del("t.$zone")]);
-test("NOERROR", ["update", rr_del("*.$zone")]);
-test("NOERROR", ["update", rr_del("u.$zone")]);
-test("NOERROR", ["update", rr_del("a.u.$zone")]);
-test("NOERROR", ["update", rr_del("b.u.$zone")]);
-
-section("Simple prerequisites in the absence of data");
-# Name is in Use
-test("NXDOMAIN", ["pre", yxdomain("a.$zone")]);
-# RRset exists (value independent)
-test("NXRRSET", ["pre", yxrrset("a.$zone A")]);
-# Name is not in use
-test("NOERROR", ["pre", nxdomain("a.$zone")]);
-# RRset does not exist
-test("NOERROR", ["pre", nxrrset("a.$zone A")]);
-# RRset exists (value dependent)
-test("NXRRSET", ["pre", yxrrset("a.$zone 300 A 73.80.65.49")]);
-
-
-section ("Simple creation of data");
-test("NOERROR", ["update", rr_add("a.$zone 300 A 73.80.65.49")]);
-
-section ("Simple prerequisites in the presence of data");
-# Name is in use
-test("NOERROR", ["pre", yxdomain("a.$zone")]);
-# RRset exists (value independent)
-test("NOERROR", ["pre", yxrrset("a.$zone A")]);
-# Name is not in use
-test("YXDOMAIN", ["pre", nxdomain("a.$zone")]);
-# RRset does not exist
-test("YXRRSET", ["pre", nxrrset("a.$zone A")]);
-# RRset exists (value dependent)
-test("NOERROR", ["pre", yxrrset("a.$zone 300 A 73.80.65.49")]);
-
-#
-# Merging of RRsets
-#
-test("NOERROR", ["update", rr_add("a.$zone 300 A 73.80.65.50")]);
-
-section("Detailed tests of \"RRset exists (value dependent)\" prerequisites");
-test("NOERROR", ["pre",
- yxrrset("a.$zone 300 A 73.80.65.49"),
- yxrrset("a.$zone 300 A 73.80.65.50")]);
-test("NOERROR", ["pre",
- yxrrset("a.$zone 300 A 73.80.65.50"),
- yxrrset("a.$zone 300 A 73.80.65.49")]);
-test("NXRRSET", ["pre", yxrrset("a.$zone 300 A 73.80.65.49")]);
-test("NXRRSET", ["pre", yxrrset("a.$zone 300 A 73.80.65.50")]);
-test("NXRRSET", ["pre",
- yxrrset("a.$zone 300 A 73.80.65.49"),
- yxrrset("a.$zone 300 A 73.80.65.50"),
- yxrrset("a.$zone 300 A 73.80.65.51")]);
-
-
-section("Torture test of \"RRset exists (value dependent)\" prerequisites.");
-
-test("NOERROR", ["update",
- rr_add("e.$zone 300 A 73.80.65.49"),
- rr_add("e.$zone 300 TXT 'one'"),
- rr_add("e.$zone 300 A 73.80.65.50")]);
-test("NOERROR", ["update",
- rr_add("e.$zone 300 A 73.80.65.52"),
- rr_add("f.$zone 300 A 73.80.65.52"),
- rr_add("e.$zone 300 A 73.80.65.51")]);
-test("NOERROR", ["update",
- rr_add("e.$zone 300 TXT 'three'"),
- rr_add("e.$zone 300 TXT 'two'")]);
-test("NOERROR", ["update",
- rr_add("e.$zone 300 MX 10 mail.$zone")]);
-
-test("NOERROR", ["pre",
- yxrrset("e.$zone 300 A 73.80.65.52"),
- yxrrset("e.$zone 300 TXT 'two'"),
- yxrrset("e.$zone 300 A 73.80.65.51"),
- yxrrset("e.$zone 300 TXT 'three'"),
- yxrrset("e.$zone 300 A 73.80.65.50"),
- yxrrset("f.$zone 300 A 73.80.65.52"),
- yxrrset("e.$zone 300 A 73.80.65.49"),
- yxrrset("e.$zone 300 TXT 'one'")]);
-
-
-section("Subtraction of RRsets");
-test("NOERROR", ["update", rr_del("a.$zone 300 A 73.80.65.49")]);
-test("NOERROR", ["pre",
- yxrrset("a.$zone 300 A 73.80.65.50")]);
-
-test("NOERROR", ["update", rr_del("a.$zone 300 A 73.80.65.50")]);
-test("NOERROR", ["pre", nxrrset("a.$zone 300 A")]);
-test("NOERROR", ["pre", nxdomain("a.$zone")]);
-
-section("Other forms of deletion");
-test("NOERROR", ["update", rr_add("a.$zone 300 A 73.80.65.49")]);
-test("NOERROR", ["update", rr_add("a.$zone 300 A 73.80.65.50")]);
-test("NOERROR", ["update", rr_add("a.$zone 300 MX 10 mail.$zone")]);
-test("NOERROR", ["update", rr_del("a.$zone 300 A")]);
-test("NOERROR", ["pre", nxrrset("a.$zone 300 A")]);
-test("NOERROR", ["update", rr_add("a.$zone 300 A 73.80.65.49")]);
-test("NOERROR", ["update", rr_add("a.$zone 300 A 73.80.65.50")]);
-test("NOERROR", ["update", rr_del("a.$zone")]);
-test("NOERROR", ["pre", nxdomain("a.$zone")]);
-
-section("Case insensitivity");
-test("NOERROR", ["update", rr_add("a.$zone 300 PTR foo.net.")]);
-test("NOERROR", ["pre", yxrrset("A.$zone 300 PTR fOo.NeT.")]);
-
-section("Special CNAME rules");
-test("NOERROR", ["update", rr_add("b.$zone 300 CNAME foo.net.")]);
-test("NOERROR", ["update", rr_add("b.$zone 300 A 73.80.65.49")]);
-test("NOERROR", ["pre", yxrrset("b.$zone 300 CNAME foo.net.")]);
-test("NOERROR", ["pre", nxrrset("b.$zone A")]);
-
-test("NOERROR", ["update", rr_add("c.$zone 300 A 73.80.65.49")]);
-test("NOERROR", ["update", rr_add("c.$zone 300 CNAME foo.net.")]);
-test("NOERROR", ["pre", yxrrset("c.$zone A")]);
-test("NOERROR", ["pre", nxrrset("c.$zone CNAME")]);
-
-# XXX should test with SIG, KEY, NXT, too.
-
-#
-# Currently commented out because Net::DNS does not properly
-# support WKS records.
-#
-#section("Special WKS rules");
-#test("NOERROR", ["update", rr_add("c.$zone 300 WKS 73.80.65.49 TCP telnet ftp")]);
-#test("NOERROR", ["update", rr_add("c.$zone 300 WKS 73.80.65.49 UDP telnet ftp")]);
-#test("NOERROR", ["update", rr_add("c.$zone 300 WKS 73.80.65.50 TCP telnet ftp")]);
-#test("NOERROR", ["update", rr_add("c.$zone 300 WKS 73.80.65.49 TCP smtp")]);
-#test("NOERROR", ["pre",
-# yxrrset("c.$zone 300 WKS 73.80.65.49 TCP smtp"),
-# yxrrset("c.$zone 300 WKS 73.80.65.49 UDP telnet ftp"),
-# yxrrset("c.$zone 300 WKS 73.80.65.50 TCP telnet ftp")]);
-
-
-section("Special NS rules");
-
-# Deleting the last NS record using "Delete an RR from an RRset"
-# should fail at the zone apex and work elsewhere. The pseudocode
-# in RFC2136 says it should fail everywhere, but this is in conflict
-# with the actual text.
-
-# Apex
-test("NOERROR", ["update",
- rr_add("$zone 300 NS ns1.$zone"),
- rr_add("$zone 300 NS ns2.$zone")]);
-test("NOERROR", ["update", rr_del("$zone 300 NS ns1.$zone")]);
-test("NOERROR", ["update", rr_del("$zone 300 NS ns2.$zone")]);
-test("NOERROR", ["pre",
- yxrrset("$zone 300 NS ns2.$zone")]);
-
-# Non-apex
-test("NOERROR", ["update", rr_add("n.$zone 300 NS ns1.$zone")]);
-test("NOERROR", ["update", rr_del("n.$zone 300 NS ns1.$zone")]);
-test("NOERROR", ["pre", nxrrset("n.$zone 300 NS")]);
-
-# Other ways of deleting NS records should also fail at the apex
-# and work elsewhere.
-
-# Non-apex
-test("NOERROR", ["update", rr_add("n.$zone 300 NS ns1.$zone")]);
-test("NOERROR", ["update", rr_del("n.$zone 300 NS")]);
-test("NOERROR", ["pre", nxrrset("n.$zone 300 NS")]);
-
-test("NOERROR", ["update", rr_add("n.$zone 300 NS ns1.$zone")]);
-test("NOERROR", ["pre", yxrrset("n.$zone 300 NS")]);
-test("NOERROR", ["update", rr_del("n.$zone")]);
-test("NOERROR", ["pre", nxrrset("n.$zone 300 NS")]);
-
-# Apex
-test("NOERROR", ["update", rr_del("$zone NS")]);
-test("NOERROR", ["pre",
- yxrrset("$zone 300 NS ns2.$zone")]);
-
-test("NOERROR", ["update", rr_del("$zone")]);
-test("NOERROR", ["pre",
- yxrrset("$zone 300 NS ns2.$zone")]);
-
-# They should not touch the SOA, either.
-
-test("NOERROR", ["update", rr_del("$zone SOA")]);
-test("NOERROR", ["pre", yxrrset("$zone SOA")]);
-
-
-section("Idempotency");
-
-test("NOERROR", ["update", rr_add("d.$zone 300 A 73.80.65.49")]);
-test("NOERROR", ["pre", yxrrset("d.$zone 300 A 73.80.65.49")]);
-test("NOERROR", ["update",
- rr_add("d.$zone 300 A 73.80.65.49"),
- rr_del("d.$zone A")]);
-test("NOERROR", ["pre", nxrrset("d.$zone 300 A 73.80.65.49")]);
-
-test("NOERROR", ["update", rr_del("d.$zone 300 A 73.80.65.49")]);
-test("NOERROR", ["pre", nxrrset("d.$zone 300 A")]);
-test("NOERROR", ["update",
- rr_del("d.$zone 300 A"),
- rr_add("d.$zone 300 A 73.80.65.49")]);
-
-test("NOERROR", ["pre", yxrrset("d.$zone 300 A")]);
-
-section("Out-of-zone prerequisites and updates");
-test("NOTZONE", ["pre", yxrrset("a.somewhere.else. 300 A 73.80.65.49")]);
-test("NOTZONE", ["update", rr_add("a.somewhere.else. 300 A 73.80.65.49")]);
-
-
-section("Glue");
-test("NOERROR", ["update", rr_add("s.$zone 300 NS ns.s.$zone")]);
-test("NOERROR", ["update", rr_add("ns.s.$zone 300 A 73.80.65.49")]);
-test("NOERROR", ["pre", yxrrset("ns.s.$zone 300 A 73.80.65.49")]);
-
-section("Wildcards");
-test("NOERROR", ["update", rr_add("*.$zone 300 MX 10 mail.$zone")]);
-test("NOERROR", ["pre", yxrrset("*.$zone 300 MX 10 mail.$zone")]);
-test("NXRRSET", ["pre", yxrrset("w.$zone 300 MX 10 mail.$zone")]);
-test("NOERROR", ["pre", nxrrset("w.$zone MX")]);
-test("NOERROR", ["pre", nxdomain("w.$zone")]);
-
-
-section("SOA serial handling");
-
-my $soatimers = "20 20 1814400 3600";
-
-# Get the current SOA serial number.
-my $query = $res->query($zone, "SOA");
-my ($old_soa) = $query->answer;
-
-my $old_serial = $old_soa->serial;
-
-# Increment it by 10.
-my $new_serial = $old_serial + 10;
-if ($new_serial > 0xFFFFFFFF) {
- $new_serial -= 0x80000000;
- $new_serial -= 0x80000000;
-}
-
-# Replace the SOA with a new one.
-test("NOERROR", ["update", rr_add("$zone 300 SOA mname1. . $new_serial $soatimers")]);
-
-# Check that the SOA really got replaced.
-($db_soa) = $res->query($zone, "SOA")->answer;
-assert($db_soa->mname eq "mname1");
-
-# Check that attempts to decrement the serial number are ignored.
-$new_serial = $old_serial - 10;
-if ($new_serial < 0) {
- $new_serial += 0x80000000;
- $new_serial += 0x80000000;
-}
-test("NOERROR", ["update", rr_add("$zone 300 SOA mname2. . $new_serial $soatimers")]);
-assert($db_soa->mname eq "mname1");
-
-# Check that attempts to leave the serial number unchanged are ignored.
-($old_soa) = $res->query($zone, "SOA")->answer;
-$old_serial = $old_soa->serial;
-test("NOERROR", ["update", rr_add("$zone 300 SOA mname3. . $old_serial " .
- $soatimers)]);
-($db_soa) = $res->query($zone, "SOA")->answer;
-assert($db_soa->mname eq "mname1");
-
-#
-# Currently commented out because Net::DNS does not properly
-# support multiple strings in TXT records.
-#
-#section("Big data");
-#test("NOERROR", ["update", rr_add("a.$zone 300 TXT aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc")]);
-#test("NOERROR", ["update", rr_del("a.$zone 300 TXT aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc")]);
-test("NOERROR", ["update", rr_add("a.$zone 300 TXT " . ("foo " x 3))]);
-
-section("Updating TTLs only");
-
-test("NOERROR", ["update", rr_add("t.$zone 300 A 73.80.65.49")]);
-($a) = $res->query("t.$zone", "A")->answer;
-assert($a->ttl == 300);
-test("NOERROR", ["update",
- rr_del("t.$zone 300 A 73.80.65.49"),
- rr_add("t.$zone 301 A 73.80.65.49")]);
-($a) = $res->query("t.$zone", "A")->answer;
-assert($a->ttl == 301);
-
-section("Obscuring existing data by zone cut");
-test("NOERROR", ["update", rr_add("a.u.$zone 300 A 73.80.65.49")]);
-test("NOERROR", ["update", rr_add("b.u.$zone 300 A 73.80.65.49")]);
-test("NOERROR", ["update", rr_add("u.$zone 300 TXT txt-not-in-nxt")]);
-test("NOERROR", ["update", rr_add("u.$zone 300 NS ns.u.$zone")]);
-
-test("NOERROR", ["update", rr_del("u.$zone 300 NS ns.u.$zone")]);
-
-if ($failures) {
- print "$failures tests failed.\n";
-} else {
- print "All tests successful.\n";
-}
-exit $failures;
diff --git a/config.h.in b/config.h.in
index fdd4e810..18d48362 100644
--- a/config.h.in
+++ b/config.h.in
@@ -16,7 +16,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: config.h.in,v 1.38 2000/09/22 18:52:34 bwelling Exp $ */
+/* $Id: config.h.in,v 1.40 2000/12/23 02:45:43 tale Exp $ */
/***
*** This file is not to be included by any public header files, because
@@ -89,6 +89,9 @@
/* define if flockfile() is available */
#undef HAVE_FLOCKFILE
+/* define if rlim_t is defined via sys/types.h or sys/resource.h */
+#undef HAVE_RLIM_T
+
/* Shut up warnings about sputaux in stdio.h on BSD/OS pre-4.1 */
#undef SHUTUP_SPUTAUX
#ifdef SHUTUP_SPUTAUX
@@ -123,6 +126,9 @@ int sigwait(const unsigned int *set, int *sig);
/* define if the system has a random number generating device */
#undef PATH_RANDOMDEV
+/* define if pthread_attr_getstacksize() is available */
+#undef HAVE_PTHREAD_ATTR_GETSTACKSIZE
+
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
diff --git a/configure b/configure
index bac9eace..4dacd41d 100755
--- a/configure
+++ b/configure
@@ -15,7 +15,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# From configure.in Revision: 1.195
+# From configure.in Revision: 1.205.2.1
## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc.
@@ -129,8 +129,6 @@ ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
- --enable-threads use multithreading"
-ac_help="$ac_help
--with-openssl=PATH Specify path for system-supplied openssl
(rather than using bind-9 internal openssl)"
ac_help="$ac_help
@@ -138,6 +136,8 @@ ac_help="$ac_help
ac_help="$ac_help
--with-randomdev=PATH Specify path for random device"
ac_help="$ac_help
+ --enable-threads use multithreading"
+ac_help="$ac_help
--with-ptl2 on NetBSD, use the ptl2 thread library (experimental)"
ac_help="$ac_help
--with-libtool use GNU libtool (following indented options supported)"
@@ -1046,38 +1046,6 @@ case "$INSTALL" in
esac
#
-# Decide whether to use multithreading or not.
-#
-echo $ac_n "checking whether to use threads""... $ac_c" 1>&6
-echo "configure:1053: checking whether to use threads" >&5
-# Check whether --enable-threads or --disable-threads was given.
-if test "${enable_threads+set}" = set; then
- enableval="$enable_threads"
- :
-fi
-
-case "$enable_threads" in
- yes|'')
- echo "$ac_t""yes" 1>&6
- use_threads=true
- ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
- ;;
- no)
- echo "$ac_t""no" 1>&6
- use_threads=false
-#ifdef ISC_PLATFORM_USETHREADS
- ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
-#else /* ISC_PLATFORM_USETHREADS */
-#+ AC_MSG_ERROR(["--enable-threads is not implemented"])
-#endif /* ISC_PLATFORM_USETHREADS */
- ;;
- *)
- { echo "configure: error: "--enable-threads takes yes or no"" 1>&2; exit 1; }
- ;;
-esac
-
-
-#
# On these hosts, we really want to use cc, not gcc, even if it is
# found. The gcc that these systems have will not correctly handle
# pthreads.
@@ -1127,14 +1095,14 @@ fi
# Find the machine's endian flavor.
#
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:1131: checking whether byte ordering is bigendian" >&5
+echo "configure:1099: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
-#line 1138 "configure"
+#line 1106 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -1145,11 +1113,11 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:1149: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1117: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF
-#line 1153 "configure"
+#line 1121 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -1160,7 +1128,7 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:1164: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1132: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
@@ -1180,7 +1148,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1184 "configure"
+#line 1152 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
@@ -1193,7 +1161,7 @@ main () {
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
-if { (eval echo configure:1197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_bigendian=no
else
@@ -1221,7 +1189,7 @@ fi
# was --with-openssl specified?
#
echo $ac_n "checking for compatible OpenSSL library""... $ac_c" 1>&6
-echo "configure:1225: checking for compatible OpenSSL library" >&5
+echo "configure:1193: checking for compatible OpenSSL library" >&5
# Check whether --with-openssl or --without-openssl was given.
if test "${with_openssl+set}" = set; then
withval="$with_openssl"
@@ -1278,7 +1246,7 @@ esac
# was --with-gssapi specified?
#
echo $ac_n "checking for GSSAPI library""... $ac_c" 1>&6
-echo "configure:1282: checking for GSSAPI library" >&5
+echo "configure:1250: checking for GSSAPI library" >&5
# Check whether --with-gssapi or --without-gssapi was given.
if test "${with_gssapi+set}" = set; then
withval="$with_gssapi"
@@ -1314,7 +1282,7 @@ esac
# was --with-randomdev specified?
#
echo $ac_n "checking for random device""... $ac_c" 1>&6
-echo "configure:1318: checking for random device" >&5
+echo "configure:1286: checking for random device" >&5
# Check whether --with-randomdev or --without-randomdev was given.
if test "${with_randomdev+set}" = set; then
withval="$with_randomdev"
@@ -1361,7 +1329,7 @@ esac
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1365: checking for $ac_word" >&5
+echo "configure:1333: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1391,7 +1359,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1395: checking for $ac_word" >&5
+echo "configure:1363: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1442,7 +1410,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1446: checking for $ac_word" >&5
+echo "configure:1414: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1474,7 +1442,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1478: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1446: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1485,12 +1453,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 1489 "configure"
+#line 1457 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:1494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -1516,12 +1484,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1520: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1488: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1525: checking whether we are using GNU C" >&5
+echo "configure:1493: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1530,7 +1498,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1534: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1502: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -1549,7 +1517,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1553: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1521: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1585,7 +1553,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1589: checking for $ac_word" >&5
+echo "configure:1557: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1617,7 +1585,7 @@ test -n "$YACC" || YACC="yacc"
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1621: checking how to run the C preprocessor" >&5
+echo "configure:1589: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -1632,13 +1600,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1636 "configure"
+#line 1604 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1642: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1610: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1649,13 +1617,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1653 "configure"
+#line 1621 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1659: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1627: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1666,13 +1634,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 1670 "configure"
+#line 1638 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1676: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1644: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1697,12 +1665,12 @@ fi
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1701: checking for ANSI C header files" >&5
+echo "configure:1669: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1706 "configure"
+#line 1674 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -1710,7 +1678,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1682: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1727,7 +1695,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1731 "configure"
+#line 1699 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -1745,7 +1713,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1749 "configure"
+#line 1717 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1766,7 +1734,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 1770 "configure"
+#line 1738 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1777,7 +1745,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:1781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -1805,17 +1773,17 @@ for ac_hdr in fcntl.h sys/time.h unistd.h sys/sockio.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1809: checking for $ac_hdr" >&5
+echo "configure:1777: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1814 "configure"
+#line 1782 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1819: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1787: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1843,12 +1811,12 @@ done
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1847: checking for working const" >&5
+echo "configure:1815: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1852 "configure"
+#line 1820 "configure"
#include "confdefs.h"
int main() {
@@ -1897,7 +1865,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:1901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -1918,21 +1886,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:1922: checking for inline" >&5
+echo "configure:1890: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
-#line 1929 "configure"
+#line 1897 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:1936: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1904: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -1958,12 +1926,12 @@ EOF
esac
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1962: checking for size_t" >&5
+echo "configure:1930: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1967 "configure"
+#line 1935 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1991,12 +1959,12 @@ EOF
fi
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:1995: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:1963: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2000 "configure"
+#line 1968 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -2005,7 +1973,7 @@ int main() {
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:2009: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1977: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
@@ -2026,6 +1994,33 @@ EOF
fi
+#
+# Begin pthreads checking.
+#
+# First, decide whether to use multithreading or not.
+#
+echo $ac_n "checking whether to look for thread support""... $ac_c" 1>&6
+echo "configure:2004: checking whether to look for thread support" >&5
+# Check whether --enable-threads or --disable-threads was given.
+if test "${enable_threads+set}" = set; then
+ enableval="$enable_threads"
+ :
+fi
+
+case "$enable_threads" in
+ yes|'')
+ echo "$ac_t""yes" 1>&6
+ use_threads=true
+ ;;
+ no)
+ echo "$ac_t""no" 1>&6
+ use_threads=false
+ ;;
+ *)
+ { echo "configure: error: "--enable-threads takes yes or no"" 1>&2; exit 1; }
+ ;;
+esac
+
if $use_threads
then
#
@@ -2042,7 +2037,7 @@ then
# experiment with it.
CC="gcc"
echo $ac_n "checking which NetBSD thread library to use""... $ac_c" 1>&6
-echo "configure:2046: checking which NetBSD thread library to use" >&5
+echo "configure:2041: checking which NetBSD thread library to use" >&5
# Check whether --with-ptl2 or --without-ptl2 was given.
if test "${with_ptl2+set}" = set; then
@@ -2081,7 +2076,7 @@ Please install the devel/unproven-pthreads package and rerun configure.
;;
*)
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:2085: checking for pthread_create in -lpthread" >&5
+echo "configure:2080: checking for pthread_create in -lpthread" >&5
ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2089,7 +2084,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2093 "configure"
+#line 2088 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2100,7 +2095,7 @@ int main() {
pthread_create()
; return 0; }
EOF
-if { (eval echo configure:2104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2126,7 +2121,7 @@ EOF
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for __pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:2130: checking for __pthread_create in -lpthread" >&5
+echo "configure:2125: checking for __pthread_create in -lpthread" >&5
ac_lib_var=`echo pthread'_'__pthread_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2134,7 +2129,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2138 "configure"
+#line 2133 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2145,7 +2140,7 @@ int main() {
__pthread_create()
; return 0; }
EOF
-if { (eval echo configure:2149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2144: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2170,10 +2165,8 @@ EOF
else
echo "$ac_t""no" 1>&6
-fi
-
- echo $ac_n "checking for __pthread_create_system in -lpthread""... $ac_c" 1>&6
-echo "configure:2177: checking for __pthread_create_system in -lpthread" >&5
+echo $ac_n "checking for __pthread_create_system in -lpthread""... $ac_c" 1>&6
+echo "configure:2170: checking for __pthread_create_system in -lpthread" >&5
ac_lib_var=`echo pthread'_'__pthread_create_system | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2181,7 +2174,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2185 "configure"
+#line 2178 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2192,7 +2185,7 @@ int main() {
__pthread_create_system()
; return 0; }
EOF
-if { (eval echo configure:2196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2217,18 +2210,61 @@ EOF
else
echo "$ac_t""no" 1>&6
+echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
+echo "configure:2215: checking for pthread_create in -lc_r" >&5
+ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lc_r $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2223 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pthread_create();
+
+int main() {
+pthread_create()
+; return 0; }
+EOF
+if { (eval echo configure:2234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo c_r | sed -e 's/^a-zA-Z0-9_/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
- echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:2224: checking for pthread_create in -lpthreads" >&5
-ac_lib_var=`echo pthreads'_'pthread_create | sed 'y%./+-%__p_%'`
+ LIBS="-lc_r $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
+echo "configure:2260: checking for pthread_create in -lc" >&5
+ac_lib_var=`echo c'_'pthread_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
-LIBS="-lpthreads $LIBS"
+LIBS="-lc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2232 "configure"
+#line 2268 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2239,7 +2275,7 @@ int main() {
pthread_create()
; return 0; }
EOF
-if { (eval echo configure:2243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2254,28 +2290,38 @@ LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo pthreads | sed -e 's/^a-zA-Z0-9_/_/g' \
+ ac_tr_lib=HAVE_LIB`echo c | sed -e 's/^a-zA-Z0-9_/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF
- LIBS="-lpthreads $LIBS"
+ LIBS="-lc $LIBS"
else
echo "$ac_t""no" 1>&6
+use_threads=false
+fi
+
+fi
+
+fi
+
fi
fi
;;
esac
+fi
+if $use_threads
+then
#
# We'd like to use sigwait() too
#
echo $ac_n "checking for sigwait in -lc""... $ac_c" 1>&6
-echo "configure:2279: checking for sigwait in -lc" >&5
+echo "configure:2325: checking for sigwait in -lc" >&5
ac_lib_var=`echo c'_'sigwait | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2283,7 +2329,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2287 "configure"
+#line 2333 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2294,7 +2340,7 @@ int main() {
sigwait()
; return 0; }
EOF
-if { (eval echo configure:2298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2316,7 +2362,7 @@ EOF
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sigwait in -lpthread""... $ac_c" 1>&6
-echo "configure:2320: checking for sigwait in -lpthread" >&5
+echo "configure:2366: checking for sigwait in -lpthread" >&5
ac_lib_var=`echo pthread'_'sigwait | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2324,7 +2370,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2328 "configure"
+#line 2374 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2335,7 +2381,7 @@ int main() {
sigwait()
; return 0; }
EOF
-if { (eval echo configure:2339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2357,7 +2403,7 @@ EOF
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for _Psigwait in -lpthread""... $ac_c" 1>&6
-echo "configure:2361: checking for _Psigwait in -lpthread" >&5
+echo "configure:2407: checking for _Psigwait in -lpthread" >&5
ac_lib_var=`echo pthread'_'_Psigwait | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2365,7 +2411,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2369 "configure"
+#line 2415 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2376,7 +2422,7 @@ int main() {
_Psigwait()
; return 0; }
EOF
-if { (eval echo configure:2380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2405,6 +2451,58 @@ fi
fi
+ echo $ac_n "checking for pthread_attr_getstacksize""... $ac_c" 1>&6
+echo "configure:2456: checking for pthread_attr_getstacksize" >&5
+if eval "test \"`echo '$''{'ac_cv_func_pthread_attr_getstacksize'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2461 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char pthread_attr_getstacksize(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pthread_attr_getstacksize();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_pthread_attr_getstacksize) || defined (__stub___pthread_attr_getstacksize)
+choke me
+#else
+pthread_attr_getstacksize();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2484: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_pthread_attr_getstacksize=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_pthread_attr_getstacksize=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'pthread_attr_getstacksize`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_PTHREAD_ATTR_GETSTACKSIZE 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
#
# Additional OS-specific issues related to pthreads and sigwait.
#
@@ -2414,7 +2512,7 @@ fi
#
*-freebsd*)
echo $ac_n "checking for sigwait in -lc_r""... $ac_c" 1>&6
-echo "configure:2418: checking for sigwait in -lc_r" >&5
+echo "configure:2516: checking for sigwait in -lc_r" >&5
ac_lib_var=`echo c_r'_'sigwait | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2422,7 +2520,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lc_r $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2426 "configure"
+#line 2524 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2433,7 +2531,7 @@ int main() {
sigwait()
; return 0; }
EOF
-if { (eval echo configure:2437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2488,12 +2586,12 @@ EOF
EOF
echo $ac_n "checking for pthread_setconcurrency""... $ac_c" 1>&6
-echo "configure:2492: checking for pthread_setconcurrency" >&5
+echo "configure:2590: checking for pthread_setconcurrency" >&5
if eval "test \"`echo '$''{'ac_cv_func_pthread_setconcurrency'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2497 "configure"
+#line 2595 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char pthread_setconcurrency(); below. */
@@ -2516,7 +2614,7 @@ pthread_setconcurrency();
; return 0; }
EOF
-if { (eval echo configure:2520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_pthread_setconcurrency=yes"
else
@@ -2554,12 +2652,12 @@ EOF
# Look for sysconf to allow detection of the number of processors.
#
echo $ac_n "checking for sysconf""... $ac_c" 1>&6
-echo "configure:2558: checking for sysconf" >&5
+echo "configure:2656: checking for sysconf" >&5
if eval "test \"`echo '$''{'ac_cv_func_sysconf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2563 "configure"
+#line 2661 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char sysconf(); below. */
@@ -2582,7 +2680,7 @@ sysconf();
; return 0; }
EOF
-if { (eval echo configure:2586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_sysconf=yes"
else
@@ -2626,34 +2724,30 @@ fi
else
case $host in
*-dec-osf*)
- CC="$CC -std -pthread"
- CCOPT="$CCOPT -std -pthread"
- MKDEPCC="$CC"
+ CC="$CC -pthread"
+ CCOPT="$CCOPT -pthread"
;;
*-solaris*)
CC="$CC -mt"
CCOPT="$CCOPT -mt"
;;
- *-hp-hpux*)
- CC="$CC -Ae -z +w1"
- CCOPT="$CCOPT -Ae -z"
- ;;
*-ibm-aix*)
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
*-UnixWare*)
- CC="$CC -Kthread -w"
+ CC="$CC -Kthread"
CCOPT="$CCOPT -Kthread"
;;
esac
fi
+ ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
thread_dir=pthreads
else
+ ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
thread_dir=nothreads
fi
-#
-# End of pthreads stuff.
-#
+
+
ISC_THREAD_DIR=$thread_dir
@@ -2663,12 +2757,12 @@ ISC_THREAD_DIR=$thread_dir
# even if compiled with --disable-threads.
#
echo $ac_n "checking for flockfile""... $ac_c" 1>&6
-echo "configure:2667: checking for flockfile" >&5
+echo "configure:2761: checking for flockfile" >&5
if eval "test \"`echo '$''{'ac_cv_func_flockfile'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2672 "configure"
+#line 2766 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char flockfile(); below. */
@@ -2691,7 +2785,7 @@ flockfile();
; return 0; }
EOF
-if { (eval echo configure:2695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_flockfile=yes"
else
@@ -2714,16 +2808,92 @@ else
fi
+#
+# Indicate what the final decision was regarding threads.
+#
+echo $ac_n "checking whether to build with threads""... $ac_c" 1>&6
+echo "configure:2816: checking whether to build with threads" >&5
+if $use_threads; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+#
+# End of pthreads stuff.
+#
+
+#
+# Additional compiler settings.
+#
+MKDEPCC="$CC"
+MKDEPCFLAGS="-M"
+IRIX_DNSSEC_WARNINGS_HACK=""
+
+if test "X$GCC" = "Xyes"; then
+ STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings"
+else
+ case $host in
+ *-dec-osf*)
+ CC="$CC -std"
+ CCOPT="$CCOPT -std"
+ MKDEPCC="$CC"
+ ;;
+ *-hp-hpux*)
+ CC="$CC -Ae -z"
+ # The version of the C compiler that constantly warns about
+ # 'const' as well as alignment issues is unfortunately not
+ # able to be discerned via the version of the operating
+ # system, nor does cc have a version flag.
+ case "`$CC +W 123 2>&1`" in
+ *Unknown?option*)
+ STD_CWARNINGS="+w1"
+ ;;
+ *)
+ # Turn off the pointlessly noisy warnings.
+ STD_CWARNINGS="+w1 +W 474,530"
+ ;;
+ esac
+ CCOPT="$CCOPT -Ae -z"
+ LIBS="-Wl,+vnocompatwarnings $LIBS"
+ MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
+ ;;
+ *-sgi-irix*)
+ STD_CWARNINGS="-fullwarn -woff 1209"
+ #
+ # Silence more than 250 instances of
+ # "prototyped function redeclared without prototype"
+ # and 11 instances of
+ # "variable ... was set but never used"
+ # from lib/dns/sec/openssl.
+ #
+ IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
+ ;;
+ *-solaris*)
+ MKDEPCFLAGS="-xM"
+ ;;
+ *-UnixWare*)
+ CC="$CC -w"
+ YACC="yacc" # bison calls alloca, avoid on UnixWare
+ ;;
+ esac
+fi
+
+
+
+
+
+
#
# NLS
#
echo $ac_n "checking for catgets""... $ac_c" 1>&6
-echo "configure:2722: checking for catgets" >&5
+echo "configure:2892: checking for catgets" >&5
if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2727 "configure"
+#line 2897 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char catgets(); below. */
@@ -2746,7 +2916,7 @@ catgets();
; return 0; }
EOF
-if { (eval echo configure:2750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_catgets=yes"
else
@@ -2784,7 +2954,7 @@ case "$host" in
;;
*)
echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:2788: checking for socket in -lsocket" >&5
+echo "configure:2958: checking for socket in -lsocket" >&5
ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2792,7 +2962,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2796 "configure"
+#line 2966 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2803,7 +2973,7 @@ int main() {
socket()
; return 0; }
EOF
-if { (eval echo configure:2807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2831,7 +3001,7 @@ else
fi
echo $ac_n "checking for inet_ntoa in -lnsl""... $ac_c" 1>&6
-echo "configure:2835: checking for inet_ntoa in -lnsl" >&5
+echo "configure:3005: checking for inet_ntoa in -lnsl" >&5
ac_lib_var=`echo nsl'_'inet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2839,7 +3009,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2843 "configure"
+#line 3013 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2850,7 +3020,7 @@ int main() {
inet_ntoa()
; return 0; }
EOF
-if { (eval echo configure:2854: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3024: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2880,43 +3050,6 @@ fi
;;
esac
-MKDEPCC="$CC"
-MKDEPCFLAGS="-M"
-IRIX_DNSSEC_WARNINGS_HACK=""
-if test "X$GCC" = "Xyes"; then
- STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings"
-else
- case "$host" in
- *-solaris*)
- MKDEPCC="$CC"
- MKDEPCFLAGS="-xM"
- ;;
- *-hp-hpux*)
- LIBS="-Wl,+vnocompatwarnings $LIBS"
- MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
- ;;
- *-sgi-irix*)
- STD_CWARNINGS="-fullwarn -woff 1209"
- #
- # Silence more than 250 instances of
- # "prototyped function redeclared without prototype"
- # and 11 instances of
- # "variable ... was set but never used"
- # from lib/dns/sec/openssl.
- #
- IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
- ;;
- *-UnixWare*)
- MKDEPCC="$CC"
- YACC="yacc" # bison calls alloca, avoid on UnixWare
- ;;
- esac
-fi
-
-
-
-
-
#
#
# GNU libtool support
@@ -3002,7 +3135,7 @@ else
fi
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:3006: checking build system type" >&5
+echo "configure:3139: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -3031,7 +3164,7 @@ ac_prog=ld
if test "$ac_cv_prog_gcc" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:3035: checking for ld used by GCC" >&5
+echo "configure:3168: checking for ld used by GCC" >&5
ac_prog=`($CC -print-prog-name=ld) 2>&5`
case "$ac_prog" in
# Accept absolute paths.
@@ -3055,10 +3188,10 @@ echo "configure:3035: checking for ld used by GCC" >&5
esac
elif test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:3059: checking for GNU ld" >&5
+echo "configure:3192: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:3062: checking for non-GNU ld" >&5
+echo "configure:3195: checking for non-GNU ld" >&5
fi
if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3093,7 +3226,7 @@ else
fi
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:3097: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:3230: checking if the linker ($LD) is GNU ld" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3109,7 +3242,7 @@ echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6
echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:3113: checking for BSD-compatible nm" >&5
+echo "configure:3246: checking for BSD-compatible nm" >&5
if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3145,7 +3278,7 @@ NM="$ac_cv_path_NM"
echo "$ac_t""$NM" 1>&6
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:3149: checking whether ln -s works" >&5
+echo "configure:3282: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3194,8 +3327,8 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
case "$lt_target" in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 3198 "configure"' > conftest.$ac_ext
- if { (eval echo configure:3199: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ echo '#line 3331 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:3332: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
LD="${LD-ld} -32"
@@ -3216,19 +3349,19 @@ case "$lt_target" in
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:3220: checking whether the C compiler needs -belf" >&5
+echo "configure:3353: checking whether the C compiler needs -belf" >&5
if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3225 "configure"
+#line 3358 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:3232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_cc_needs_belf=yes
else
@@ -3379,9 +3512,9 @@ esac
# the right suffix on the files.
#
echo $ac_n "checking for IPv6 structures""... $ac_c" 1>&6
-echo "configure:3383: checking for IPv6 structures" >&5
+echo "configure:3516: checking for IPv6 structures" >&5
cat > conftest.$ac_ext <<EOF
-#line 3385 "configure"
+#line 3518 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -3391,7 +3524,7 @@ int main() {
struct sockaddr_in6 sin6; return (0);
; return 0; }
EOF
-if { (eval echo configure:3395: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3528: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
found_ipv6=yes
@@ -3409,7 +3542,7 @@ rm -f conftest*
# This is done before other IPv6 linking tests to LIBS is properly set.
#
echo $ac_n "checking for Kame IPv6 support""... $ac_c" 1>&6
-echo "configure:3413: checking for Kame IPv6 support" >&5
+echo "configure:3546: checking for Kame IPv6 support" >&5
# Check whether --with-kame or --without-kame was given.
if test "${with_kame+set}" = set; then
withval="$with_kame"
@@ -3479,11 +3612,13 @@ case "$host" in
*-UnixWare*)
ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
LWRES_PLATFORM_NEEDNETINETIN6H="#define LWRES_PLATFORM_NEEDNETINETIN6H 1"
+ ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
isc_netinetin6_hack="#include <netinet/in6.h>"
;;
*)
ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
LWRES_PLATFORM_NEEDNETINETIN6H="#undef LWRES_PLATFORM_NEEDNETINETIN6H"
+ ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
isc_netinetin6_hack=""
;;
esac
@@ -3497,9 +3632,9 @@ case "$found_ipv6" in
LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
echo $ac_n "checking for in6addr_any""... $ac_c" 1>&6
-echo "configure:3501: checking for in6addr_any" >&5
+echo "configure:3636: checking for in6addr_any" >&5
cat > conftest.$ac_ext <<EOF
-#line 3503 "configure"
+#line 3638 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -3510,7 +3645,7 @@ int main() {
struct in6_addr in6; in6 = in6addr_any; return (0);
; return 0; }
EOF
-if { (eval echo configure:3514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
@@ -3526,9 +3661,9 @@ fi
rm -f conftest*
echo $ac_n "checking for sin6_scope_id in struct sockaddr_in6""... $ac_c" 1>&6
-echo "configure:3530: checking for sin6_scope_id in struct sockaddr_in6" >&5
+echo "configure:3665: checking for sin6_scope_id in struct sockaddr_in6" >&5
cat > conftest.$ac_ext <<EOF
-#line 3532 "configure"
+#line 3667 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -3541,7 +3676,7 @@ int main() {
struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);
; return 0; }
EOF
-if { (eval echo configure:3545: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3680: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
@@ -3556,9 +3691,9 @@ rm -f conftest*
LWRES_HAVE_SIN6_SCOPE_ID="$result"
echo $ac_n "checking for in6_pktinfo""... $ac_c" 1>&6
-echo "configure:3560: checking for in6_pktinfo" >&5
+echo "configure:3695: checking for in6_pktinfo" >&5
cat > conftest.$ac_ext <<EOF
-#line 3562 "configure"
+#line 3697 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -3571,7 +3706,7 @@ int main() {
struct in6_pktinfo xyzzy; return (0);
; return 0; }
EOF
-if { (eval echo configure:3575: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3710: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"
@@ -3613,6 +3748,7 @@ esac
+
#
# Check for network functions that are often missing. We do this
# after the libtool checking, so we can put the right suffix on
@@ -3620,9 +3756,9 @@ esac
# which provides some (all?) of the desired functions.
#
echo $ac_n "checking for inet_ntop""... $ac_c" 1>&6
-echo "configure:3624: checking for inet_ntop" >&5
+echo "configure:3760: checking for inet_ntop" >&5
cat > conftest.$ac_ext <<EOF
-#line 3626 "configure"
+#line 3762 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -3632,7 +3768,7 @@ int main() {
inet_ntop(0, 0, 0, 0); return (0);
; return 0; }
EOF
-if { (eval echo configure:3636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"
@@ -3647,9 +3783,9 @@ else
fi
rm -f conftest*
echo $ac_n "checking for inet_pton""... $ac_c" 1>&6
-echo "configure:3651: checking for inet_pton" >&5
+echo "configure:3787: checking for inet_pton" >&5
cat > conftest.$ac_ext <<EOF
-#line 3653 "configure"
+#line 3789 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -3659,7 +3795,7 @@ int main() {
inet_pton(0, 0, 0); return (0);
; return 0; }
EOF
-if { (eval echo configure:3663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"
@@ -3674,9 +3810,9 @@ else
fi
rm -f conftest*
echo $ac_n "checking for inet_aton""... $ac_c" 1>&6
-echo "configure:3678: checking for inet_aton" >&5
+echo "configure:3814: checking for inet_aton" >&5
cat > conftest.$ac_ext <<EOF
-#line 3680 "configure"
+#line 3816 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -3686,7 +3822,7 @@ int main() {
struct in_addr in; inet_aton(0, &in); return (0);
; return 0; }
EOF
-if { (eval echo configure:3690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_NEEDATON="#undef ISC_PLATFORM_NEEDATON"
@@ -3719,9 +3855,9 @@ EOF
esac
echo $ac_n "checking for sa_len in struct sockaddr""... $ac_c" 1>&6
-echo "configure:3723: checking for sa_len in struct sockaddr" >&5
+echo "configure:3859: checking for sa_len in struct sockaddr" >&5
cat > conftest.$ac_ext <<EOF
-#line 3725 "configure"
+#line 3861 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -3730,7 +3866,7 @@ int main() {
struct sockaddr sa; sa.sa_len = 0; return (0);
; return 0; }
EOF
-if { (eval echo configure:3734: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3870: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"
@@ -3751,9 +3887,9 @@ rm -f conftest*
# Look for a 4.4BSD or 4.3BSD struct msghdr
#
echo $ac_n "checking for struct msghdr flavor""... $ac_c" 1>&6
-echo "configure:3755: checking for struct msghdr flavor" >&5
+echo "configure:3891: checking for struct msghdr flavor" >&5
cat > conftest.$ac_ext <<EOF
-#line 3757 "configure"
+#line 3893 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -3762,7 +3898,7 @@ int main() {
struct msghdr msg; msg.msg_flags = 0; return (0);
; return 0; }
EOF
-if { (eval echo configure:3766: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3902: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""4.4BSD" 1>&6
ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"
@@ -3780,9 +3916,9 @@ rm -f conftest*
# Look for in_port_t.
#
echo $ac_n "checking for type in_port_t""... $ac_c" 1>&6
-echo "configure:3784: checking for type in_port_t" >&5
+echo "configure:3920: checking for type in_port_t" >&5
cat > conftest.$ac_ext <<EOF
-#line 3786 "configure"
+#line 3922 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -3791,7 +3927,7 @@ int main() {
in_port_t port = 25; return (0);
; return 0; }
EOF
-if { (eval echo configure:3795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3931: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"
@@ -3809,9 +3945,9 @@ rm -f conftest*
# Check for addrinfo
#
echo $ac_n "checking for struct addrinfo""... $ac_c" 1>&6
-echo "configure:3813: checking for struct addrinfo" >&5
+echo "configure:3949: checking for struct addrinfo" >&5
cat > conftest.$ac_ext <<EOF
-#line 3815 "configure"
+#line 3951 "configure"
#include "confdefs.h"
#include <netdb.h>
@@ -3819,7 +3955,7 @@ int main() {
struct addrinfo a; return (0);
; return 0; }
EOF
-if { (eval echo configure:3823: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3959: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_LWRES_NEEDADDRINFO="#undef ISC_LWRES_NEEDADDRINFO"
@@ -3838,9 +3974,9 @@ rm -f conftest*
echo $ac_n "checking for int sethostent""... $ac_c" 1>&6
-echo "configure:3842: checking for int sethostent" >&5
+echo "configure:3978: checking for int sethostent" >&5
cat > conftest.$ac_ext <<EOF
-#line 3844 "configure"
+#line 3980 "configure"
#include "confdefs.h"
#include <netdb.h>
@@ -3848,7 +3984,7 @@ int main() {
int i = sethostent(0); return(0);
; return 0; }
EOF
-if { (eval echo configure:3852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3988: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_LWRES_SETHOSTENTINT="#define ISC_LWRES_SETHOSTENTINT 1"
@@ -3863,9 +3999,9 @@ rm -f conftest*
echo $ac_n "checking for int endhostent""... $ac_c" 1>&6
-echo "configure:3867: checking for int endhostent" >&5
+echo "configure:4003: checking for int endhostent" >&5
cat > conftest.$ac_ext <<EOF
-#line 3869 "configure"
+#line 4005 "configure"
#include "confdefs.h"
#include <netdb.h>
@@ -3873,7 +4009,7 @@ int main() {
int i = endhostent(); return(0);
; return 0; }
EOF
-if { (eval echo configure:3877: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4013: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"
@@ -3888,9 +4024,9 @@ rm -f conftest*
echo $ac_n "checking for getnetbyaddr(in_addr_t, ...)""... $ac_c" 1>&6
-echo "configure:3892: checking for getnetbyaddr(in_addr_t, ...)" >&5
+echo "configure:4028: checking for getnetbyaddr(in_addr_t, ...)" >&5
cat > conftest.$ac_ext <<EOF
-#line 3894 "configure"
+#line 4030 "configure"
#include "confdefs.h"
#include <netdb.h>
@@ -3899,7 +4035,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:3903: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4039: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_LWRES_GETNETBYADDRINADDR="#define ISC_LWRES_GETNETBYADDRINADDR 1"
@@ -3914,9 +4050,9 @@ rm -f conftest*
echo $ac_n "checking for int setnetent""... $ac_c" 1>&6
-echo "configure:3918: checking for int setnetent" >&5
+echo "configure:4054: checking for int setnetent" >&5
cat > conftest.$ac_ext <<EOF
-#line 3920 "configure"
+#line 4056 "configure"
#include "confdefs.h"
#include <netdb.h>
@@ -3924,7 +4060,7 @@ int main() {
int i = setnetent(0); return(0);
; return 0; }
EOF
-if { (eval echo configure:3928: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4064: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"
@@ -3939,9 +4075,9 @@ rm -f conftest*
echo $ac_n "checking for int endnetent""... $ac_c" 1>&6
-echo "configure:3943: checking for int endnetent" >&5
+echo "configure:4079: checking for int endnetent" >&5
cat > conftest.$ac_ext <<EOF
-#line 3945 "configure"
+#line 4081 "configure"
#include "confdefs.h"
#include <netdb.h>
@@ -3949,7 +4085,7 @@ int main() {
int i = endnetent(); return(0);
; return 0; }
EOF
-if { (eval echo configure:3953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"
@@ -3964,9 +4100,9 @@ rm -f conftest*
echo $ac_n "checking for gethostbyaddr(const void *, size_t, ...)""... $ac_c" 1>&6
-echo "configure:3968: checking for gethostbyaddr(const void *, size_t, ...)" >&5
+echo "configure:4104: checking for gethostbyaddr(const void *, size_t, ...)" >&5
cat > conftest.$ac_ext <<EOF
-#line 3970 "configure"
+#line 4106 "configure"
#include "confdefs.h"
#include <netdb.h>
@@ -3975,7 +4111,7 @@ int main() {
return(0);
; return 0; }
EOF
-if { (eval echo configure:3979: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"
@@ -3990,9 +4126,9 @@ rm -f conftest*
echo $ac_n "checking for h_errno in netdb.h""... $ac_c" 1>&6
-echo "configure:3994: checking for h_errno in netdb.h" >&5
+echo "configure:4130: checking for h_errno in netdb.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 3996 "configure"
+#line 4132 "configure"
#include "confdefs.h"
#include <netdb.h>
@@ -4000,7 +4136,7 @@ int main() {
h_errno = 1; return(0);
; return 0; }
EOF
-if { (eval echo configure:4004: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4140: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"
@@ -4015,12 +4151,12 @@ rm -f conftest*
echo $ac_n "checking for getipnodebyname""... $ac_c" 1>&6
-echo "configure:4019: checking for getipnodebyname" >&5
+echo "configure:4155: checking for getipnodebyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_getipnodebyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4024 "configure"
+#line 4160 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char getipnodebyname(); below. */
@@ -4043,7 +4179,7 @@ getipnodebyname();
; return 0; }
EOF
-if { (eval echo configure:4047: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_getipnodebyname=yes"
else
@@ -4064,12 +4200,12 @@ ISC_LWRES_GETIPNODEPROTO="#define ISC_LWRES_GETIPNODEPROTO 1"
fi
echo $ac_n "checking for getnameinfo""... $ac_c" 1>&6
-echo "configure:4068: checking for getnameinfo" >&5
+echo "configure:4204: checking for getnameinfo" >&5
if eval "test \"`echo '$''{'ac_cv_func_getnameinfo'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4073 "configure"
+#line 4209 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char getnameinfo(); below. */
@@ -4092,7 +4228,7 @@ getnameinfo();
; return 0; }
EOF
-if { (eval echo configure:4096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_getnameinfo=yes"
else
@@ -4113,12 +4249,12 @@ ISC_LWRES_GETNAMEINFOPROTO="#define ISC_LWRES_GETNAMEINFOPROTO 1"
fi
echo $ac_n "checking for getaddrinfo""... $ac_c" 1>&6
-echo "configure:4117: checking for getaddrinfo" >&5
+echo "configure:4253: checking for getaddrinfo" >&5
if eval "test \"`echo '$''{'ac_cv_func_getaddrinfo'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4122 "configure"
+#line 4258 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char getaddrinfo(); below. */
@@ -4141,7 +4277,7 @@ getaddrinfo();
; return 0; }
EOF
-if { (eval echo configure:4145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4281: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_getaddrinfo=yes"
else
@@ -4173,9 +4309,9 @@ fi
# Look for a sysctl call to get the list of network interfaces.
#
echo $ac_n "checking for interface list sysctl""... $ac_c" 1>&6
-echo "configure:4177: checking for interface list sysctl" >&5
+echo "configure:4313: checking for interface list sysctl" >&5
cat > conftest.$ac_ext <<EOF
-#line 4179 "configure"
+#line 4315 "configure"
#include "confdefs.h"
#include <sys/param.h>
@@ -4205,12 +4341,12 @@ rm -f conftest*
# Check for some other useful functions that are not ever-present.
#
echo $ac_n "checking for strsep""... $ac_c" 1>&6
-echo "configure:4209: checking for strsep" >&5
+echo "configure:4345: checking for strsep" >&5
if eval "test \"`echo '$''{'ac_cv_func_strsep'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4214 "configure"
+#line 4350 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char strsep(); below. */
@@ -4233,7 +4369,7 @@ strsep();
; return 0; }
EOF
-if { (eval echo configure:4237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_strsep=yes"
else
@@ -4254,12 +4390,12 @@ ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"
fi
echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6
-echo "configure:4258: checking for vsnprintf" >&5
+echo "configure:4394: checking for vsnprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_vsnprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4263 "configure"
+#line 4399 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vsnprintf(); below. */
@@ -4282,7 +4418,7 @@ vsnprintf();
; return 0; }
EOF
-if { (eval echo configure:4286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vsnprintf=yes"
else
@@ -4311,17 +4447,17 @@ fi
echo $ac_n "checking for sizeof(long long int) == sizeof(long int)""... $ac_c" 1>&6
-echo "configure:4315: checking for sizeof(long long int) == sizeof(long int)" >&5
+echo "configure:4451: checking for sizeof(long long int) == sizeof(long int)" >&5
if test "$cross_compiling" = yes; then
echo "$ac_t""default yes" 1>&6
ISC_PLATFORM_LONGLONGEQUALLONG="#define ISC_PLATFORM_LONGLONGEQUALLONG 1"
else
cat > conftest.$ac_ext <<EOF
-#line 4321 "configure"
+#line 4457 "configure"
#include "confdefs.h"
main() { exit(!(sizeof(long long int) == sizeof(long int))); }
EOF
-if { (eval echo configure:4325: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_LONGLONGEQUALLONG="#define ISC_PLATFORM_LONGLONGEQUALLONG 1"
@@ -4341,12 +4477,12 @@ fi
# Security Stuff
#
echo $ac_n "checking for chroot""... $ac_c" 1>&6
-echo "configure:4345: checking for chroot" >&5
+echo "configure:4481: checking for chroot" >&5
if eval "test \"`echo '$''{'ac_cv_func_chroot'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4350 "configure"
+#line 4486 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char chroot(); below. */
@@ -4369,7 +4505,7 @@ chroot();
; return 0; }
EOF
-if { (eval echo configure:4373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_chroot=yes"
else
@@ -4395,17 +4531,17 @@ for ac_hdr in linux/capability.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4399: checking for $ac_hdr" >&5
+echo "configure:4535: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4404 "configure"
+#line 4540 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4409: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4545: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4435,17 +4571,17 @@ for ac_hdr in linux/prctl.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4439: checking for $ac_hdr" >&5
+echo "configure:4575: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4444 "configure"
+#line 4580 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4449: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4585: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4473,7 +4609,38 @@ done
#
-# Random remaining OS-specific issues.
+# BSD/OS, and perhaps some others, don't define rlim_t.
+#
+echo $ac_n "checking for type rlim_t""... $ac_c" 1>&6
+echo "configure:4616: checking for type rlim_t" >&5
+cat > conftest.$ac_ext <<EOF
+#line 4618 "configure"
+#include "confdefs.h"
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+int main() {
+rlim_t rl = 19671212; return (0);
+; return 0; }
+EOF
+if { (eval echo configure:4628: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_RLIM_T 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+
+#
+# Random remaining OS-specific issues involving compiler warnings.
# XXXDCL print messages to indicate some compensation is being done?
#
@@ -4550,7 +4717,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4554: checking for $ac_word" >&5
+echo "configure:4721: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_JADE'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4596,7 +4763,7 @@ test -n "$JADE" || JADE="jade"
SGMLDIR=""
echo $ac_n "checking for SGML files""... $ac_c" 1>&6
-echo "configure:4600: checking for SGML files" >&5
+echo "configure:4767: checking for SGML files" >&5
for d in /usr/pkg/share/sgml /usr/local/share/sgml
do
if test -f $d/docbook/dsssl/modular/html/docbook.dsl
@@ -4622,7 +4789,7 @@ fi
XGMLDIR=""
echo $ac_n "checking for XML files""... $ac_c" 1>&6
-echo "configure:4626: checking for XML files" >&5
+echo "configure:4793: checking for XML files" >&5
for d in /usr/pkg/share/xml /usr/local/share/xml
do
if test -f $d/dtd/docbook/docbookx.dtd
@@ -4826,6 +4993,7 @@ trap 'rm -fr `echo "make/rules
lib/tests/include/Makefile
lib/tests/include/tests/Makefile
bin/Makefile
+ bin/check/Makefile
bin/named/Makefile
bin/named/unix/Makefile
bin/rndc/Makefile
@@ -4904,7 +5072,6 @@ s%@ARFLAGS@%$ARFLAGS%g
s%@LN@%$LN%g
s%@ETAGS@%$ETAGS%g
s%@PERL@%$PERL%g
-s%@ISC_PLATFORM_USETHREADS@%$ISC_PLATFORM_USETHREADS%g
s%@DST_PRIVATEOPENSSL@%$DST_PRIVATEOPENSSL%g
s%@dst_privateopenssl@%$dst_privateopenssl%g
s%@DST_OPENSSL_INC@%$DST_OPENSSL_INC%g
@@ -4917,6 +5084,7 @@ s%@DNS_GSSAPI_LIBS@%$DNS_GSSAPI_LIBS%g
s%@CC@%$CC%g
s%@YACC@%$YACC%g
s%@CPP@%$CPP%g
+s%@ISC_PLATFORM_USETHREADS@%$ISC_PLATFORM_USETHREADS%g
s%@ISC_THREAD_DIR@%$ISC_THREAD_DIR%g
s%@MKDEPCC@%$MKDEPCC%g
s%@MKDEPCFLAGS@%$MKDEPCFLAGS%g
@@ -4941,6 +5109,7 @@ s%@LWRES_PLATFORM_NEEDNETINET6IN6H@%$LWRES_PLATFORM_NEEDNETINET6IN6H%g
s%@ISC_PLATFORM_NEEDIN6ADDRANY@%$ISC_PLATFORM_NEEDIN6ADDRANY%g
s%@LWRES_PLATFORM_NEEDIN6ADDRANY@%$LWRES_PLATFORM_NEEDIN6ADDRANY%g
s%@ISC_PLATFORM_HAVEIN6PKTINFO@%$ISC_PLATFORM_HAVEIN6PKTINFO%g
+s%@ISC_PLATFORM_FIXIN6ISADDR@%$ISC_PLATFORM_FIXIN6ISADDR%g
s%@ISC_IPV6_H@%$ISC_IPV6_H%g
s%@ISC_IPV6_O@%$ISC_IPV6_O%g
s%@ISC_ISCIPV6_O@%$ISC_ISCIPV6_O%g
@@ -5072,6 +5241,7 @@ CONFIG_FILES=\${CONFIG_FILES-"make/rules
lib/tests/include/Makefile
lib/tests/include/tests/Makefile
bin/Makefile
+ bin/check/Makefile
bin/named/Makefile
bin/named/unix/Makefile
bin/rndc/Makefile
diff --git a/configure.in b/configure.in
index 5c3a5fe5..82d5a742 100644
--- a/configure.in
+++ b/configure.in
@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
-AC_REVISION($Revision: 1.195 $)
+AC_REVISION($Revision: 1.205.2.1 $)
AC_INIT(lib/dns/name.c)
AC_PREREQ(2.13)
@@ -127,33 +127,6 @@ case "$INSTALL" in
esac
#
-# Decide whether to use multithreading or not.
-#
-AC_MSG_CHECKING(whether to use threads)
-AC_ARG_ENABLE(threads,
- [ --enable-threads use multithreading])
-case "$enable_threads" in
- yes|'')
- AC_MSG_RESULT(yes)
- use_threads=true
- ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
- ;;
- no)
- AC_MSG_RESULT(no)
- use_threads=false
-#ifdef ISC_PLATFORM_USETHREADS
- ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
-#else /* ISC_PLATFORM_USETHREADS */
-#+ AC_MSG_ERROR(["--enable-threads is not implemented"])
-#endif /* ISC_PLATFORM_USETHREADS */
- ;;
- *)
- AC_MSG_ERROR(["--enable-threads takes yes or no"])
- ;;
-esac
-AC_SUBST(ISC_PLATFORM_USETHREADS)
-
-#
# On these hosts, we really want to use cc, not gcc, even if it is
# found. The gcc that these systems have will not correctly handle
# pthreads.
@@ -331,6 +304,28 @@ AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_TIME
+#
+# Begin pthreads checking.
+#
+# First, decide whether to use multithreading or not.
+#
+AC_MSG_CHECKING(whether to look for thread support)
+AC_ARG_ENABLE(threads,
+ [ --enable-threads use multithreading])
+case "$enable_threads" in
+ yes|'')
+ AC_MSG_RESULT(yes)
+ use_threads=true
+ ;;
+ no)
+ AC_MSG_RESULT(no)
+ use_threads=false
+ ;;
+ *)
+ AC_MSG_ERROR(["--enable-threads takes yes or no"])
+ ;;
+esac
+
if $use_threads
then
#
@@ -381,12 +376,17 @@ Please install the devel/unproven-pthreads package and rerun configure.
;;
*)
AC_CHECK_LIB(pthread, pthread_create,,
- AC_CHECK_LIB(pthread, __pthread_create)
- AC_CHECK_LIB(pthread, __pthread_create_system)
- AC_CHECK_LIB(pthreads, pthread_create))
+ AC_CHECK_LIB(pthread, __pthread_create,,
+ AC_CHECK_LIB(pthread, __pthread_create_system,,
+ AC_CHECK_LIB(c_r, pthread_create,,
+ AC_CHECK_LIB(c, pthread_create,,
+ use_threads=false)))))
;;
esac
+fi
+if $use_threads
+then
#
# We'd like to use sigwait() too
#
@@ -398,6 +398,9 @@ Please install the devel/unproven-pthreads package and rerun configure.
AC_DEFINE(HAVE_SIGWAIT),))
)
+ AC_CHECK_FUNC(pthread_attr_getstacksize,
+ AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
+
#
# Additional OS-specific issues related to pthreads and sigwait.
#
@@ -466,34 +469,30 @@ Please install the devel/unproven-pthreads package and rerun configure.
else
case $host in
*-dec-osf*)
- CC="$CC -std -pthread"
- CCOPT="$CCOPT -std -pthread"
- MKDEPCC="$CC"
+ CC="$CC -pthread"
+ CCOPT="$CCOPT -pthread"
;;
*-solaris*)
CC="$CC -mt"
CCOPT="$CCOPT -mt"
;;
- *-hp-hpux*)
- CC="$CC -Ae -z +w1"
- CCOPT="$CCOPT -Ae -z"
- ;;
*-ibm-aix*)
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
*-UnixWare*)
- CC="$CC -Kthread -w"
+ CC="$CC -Kthread"
CCOPT="$CCOPT -Kthread"
;;
esac
fi
+ ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
thread_dir=pthreads
else
+ ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
thread_dir=nothreads
fi
-#
-# End of pthreads stuff.
-#
+
+AC_SUBST(ISC_PLATFORM_USETHREADS)
ISC_THREAD_DIR=$thread_dir
AC_SUBST(ISC_THREAD_DIR)
@@ -504,6 +503,81 @@ AC_SUBST(ISC_THREAD_DIR)
#
AC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),)
+#
+# Indicate what the final decision was regarding threads.
+#
+AC_MSG_CHECKING(whether to build with threads)
+if $use_threads; then
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+
+#
+# End of pthreads stuff.
+#
+
+#
+# Additional compiler settings.
+#
+MKDEPCC="$CC"
+MKDEPCFLAGS="-M"
+IRIX_DNSSEC_WARNINGS_HACK=""
+
+if test "X$GCC" = "Xyes"; then
+ STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings"
+else
+ case $host in
+ *-dec-osf*)
+ CC="$CC -std"
+ CCOPT="$CCOPT -std"
+ MKDEPCC="$CC"
+ ;;
+ *-hp-hpux*)
+ CC="$CC -Ae -z"
+ # The version of the C compiler that constantly warns about
+ # 'const' as well as alignment issues is unfortunately not
+ # able to be discerned via the version of the operating
+ # system, nor does cc have a version flag.
+ case "`$CC +W 123 2>&1`" in
+ *Unknown?option*)
+ STD_CWARNINGS="+w1"
+ ;;
+ *)
+ # Turn off the pointlessly noisy warnings.
+ STD_CWARNINGS="+w1 +W 474,530"
+ ;;
+ esac
+ CCOPT="$CCOPT -Ae -z"
+ LIBS="-Wl,+vnocompatwarnings $LIBS"
+ MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
+ ;;
+ *-sgi-irix*)
+ STD_CWARNINGS="-fullwarn -woff 1209"
+ #
+ # Silence more than 250 instances of
+ # "prototyped function redeclared without prototype"
+ # and 11 instances of
+ # "variable ... was set but never used"
+ # from lib/dns/sec/openssl.
+ #
+ IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
+ ;;
+ *-solaris*)
+ MKDEPCFLAGS="-xM"
+ ;;
+ *-UnixWare*)
+ CC="$CC -w"
+ YACC="yacc" # bison calls alloca, avoid on UnixWare
+ ;;
+ esac
+fi
+
+AC_SUBST(MKDEPCC)
+AC_SUBST(MKDEPCFLAGS)
+AC_SUBST(MKDEPPROG)
+AC_SUBST(IRIX_DNSSEC_WARNINGS_HACK)
+
#
# NLS
#
@@ -528,43 +602,6 @@ case "$host" in
;;
esac
-MKDEPCC="$CC"
-MKDEPCFLAGS="-M"
-IRIX_DNSSEC_WARNINGS_HACK=""
-if test "X$GCC" = "Xyes"; then
- STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings"
-else
- case "$host" in
- *-solaris*)
- MKDEPCC="$CC"
- MKDEPCFLAGS="-xM"
- ;;
- *-hp-hpux*)
- LIBS="-Wl,+vnocompatwarnings $LIBS"
- MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
- ;;
- *-sgi-irix*)
- STD_CWARNINGS="-fullwarn -woff 1209"
- #
- # Silence more than 250 instances of
- # "prototyped function redeclared without prototype"
- # and 11 instances of
- # "variable ... was set but never used"
- # from lib/dns/sec/openssl.
- #
- IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
- ;;
- *-UnixWare*)
- MKDEPCC="$CC"
- YACC="yacc" # bison calls alloca, avoid on UnixWare
- ;;
- esac
-fi
-AC_SUBST(MKDEPCC)
-AC_SUBST(MKDEPCFLAGS)
-AC_SUBST(MKDEPPROG)
-AC_SUBST(IRIX_DNSSEC_WARNINGS_HACK)
-
#
#
# GNU libtool support
@@ -698,11 +735,13 @@ case "$host" in
*-UnixWare*)
ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
LWRES_PLATFORM_NEEDNETINETIN6H="#define LWRES_PLATFORM_NEEDNETINETIN6H 1"
+ ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
isc_netinetin6_hack="#include <netinet/in6.h>"
;;
*)
ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
LWRES_PLATFORM_NEEDNETINETIN6H="#undef LWRES_PLATFORM_NEEDNETINETIN6H"
+ ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
isc_netinetin6_hack=""
;;
esac
@@ -781,6 +820,7 @@ AC_SUBST(LWRES_PLATFORM_NEEDNETINET6IN6H)
AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY)
AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRANY)
AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
+AC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
AC_SUBST(ISC_IPV6_H)
AC_SUBST(ISC_IPV6_O)
AC_SUBST(ISC_ISCIPV6_O)
@@ -1040,7 +1080,20 @@ AC_CHECK_HEADERS(linux/capability.h)
AC_CHECK_HEADERS(linux/prctl.h)
#
-# Random remaining OS-specific issues.
+# BSD/OS, and perhaps some others, don't define rlim_t.
+#
+AC_MSG_CHECKING(for type rlim_t)
+AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>],
+[rlim_t rl = 19671212; return (0);],
+ [AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_RLIM_T)],
+ [AC_MSG_RESULT(no)])
+
+#
+# Random remaining OS-specific issues involving compiler warnings.
# XXXDCL print messages to indicate some compensation is being done?
#
AC_SUBST(ISC_PLATFORM_BRACEPTHREADONCEINIT)
@@ -1242,6 +1295,7 @@ AC_OUTPUT(
lib/tests/include/Makefile
lib/tests/include/tests/Makefile
bin/Makefile
+ bin/check/Makefile
bin/named/Makefile
bin/named/unix/Makefile
bin/rndc/Makefile
diff --git a/contrib/idn/mdnkit/ChangeLog b/contrib/idn/mdnkit/ChangeLog
new file mode 100644
index 00000000..9a0bb236
--- /dev/null
+++ b/contrib/idn/mdnkit/ChangeLog
@@ -0,0 +1,192 @@
+2000-11-27
+ * wsock/config/mdnconf.tcl: implement "unwrap all" button.
+ * wsock/README.txt, wsock/README_j.txt: add description on "unwrap
+ all" button. add important notice on installing a new version
+ to the top of each file.
+ * Makefile.in, tools/rpm/mdnkit.spec: update for version 1.2.
+ * wsock/bin/README_e.txt, wsock/bind/README_j.txt: updated.
+ * version 1.2 release.
+
+2000-11-22
+ * lib/brace.c, lib/lace.c, lib/race.c: keep lint happy.
+ * lib/brace.c: fix a bug that the encoder outputs a broken string.
+ * dnsproxy/dnsproxy.conf.sample, lib/mdnres.conf.sample: add
+ description of new normalization schemes.
+
+2000-11-21
+ * lib/translator.c, include/mdn/translator.h: add new parameter
+ "local_alternate_converter" to mdn_translator_translate(), to
+ accept and correctly process names encoded in alternate-encoding.
+ * lib/msgtrans.c, include/mdn/msgtrans.h: add a new parameter
+ to mdn_msgtrans_param_t which is required for the new
+ mdn_translator_translate() above.
+ * dnsproxy/translate.c, wsock/common/convert.c: according to the
+ changes above.
+ * DISTFILES: replace patch/bind8/bind-8.2.2-P5-patch with
+ patch/bind8/bind-8.2.2-P7-patch.
+ * lib/Makefile.in, tools/runmdn/Makefile.in: increase version
+ number.
+ * lib/brace.c, lib/lace.c, lib/race.c: fix buffer overrun bugs.
+ * wsock/README.txt, wsock/README_j.txt: updated.
+ * README, README.ja: updated for version 1.2 release.
+ * Makefile.in: updated for version 1.2-rc1.
+
+2000-11-20
+ * lib/race.c: fix a buffer overrun bug.
+ * patch/bind8/bind-8.2.2-P5-patch: removed.
+ * patch/bind8/bind-8.2.2-P7-patch: created.
+
+2000-11-17
+ * lib/normalizer.c: add normalize scheme "ja-kana-fullwidth"
+ as an alias of "ja-fullwidth". also add new scheme
+ "ja-alnum-halfwidth".
+ * lib/normalizer.c: make the size of intermediate buffer used for
+ normalization grow dynamically. previously, the size was a fixed
+ value based on the size of the input string and overflow was
+ possible.
+ * lib/brace.c: add internal error checking. keep lint happy.
+ * dnsproxy/config.c, dnsproxy/config.h: removed (renamed to
+ proxycnf.[ch], in order to avoid confusion with include/config.h).
+ * dnsproxy/proxycnf.c, dnsproxy/proxycnf.h: created.
+ * DISTFILES, dnsproxy/Makefile.in, dnsproxy/make.os2,
+ dnsproxy/make.wnt: remove dnsproxy/config.[ch], add
+ dnsproxy/proxycnf.[ch]
+ * dnsproxy/logging.c, dnsproxy/message.c dnsproxy/proxycnf.c:
+ include <config.h>.
+ * configure.in, configure, acconfig.h, include/config.h.in:
+ add checking whether the system defines BOOL type or not.
+ add configuration option --with-brace-suffix and --with-lace-prefix.
+ * README, README.ja: mention about new configuration options above.
+ * dnsproxy/dnsproxy.h: take the definition of BOOL out. use own
+ version of TRUE/FALSE, instead of system-supplied ones.
+ * wsock/config/mdnconf.tcl: add log configuration feature (log level
+ and log file). implement log file operation (view/delete).
+ change widgets layout so that they look neater.
+ * wsock/common/encoding.c, wsock/common/jpnicmdn.h: add new
+ function for retrieving the pathname of the log file from the
+ registry.
+ * wsock/common/printf.c: retrieve log file pathname from the
+ registry. stop writing log if the log level is negative.
+ * tools/mdnconv/Makefile.in: add dependency to libmdn.la.
+ * man/mdnres.conf.5.in, tools/mdnconv/mdnconv.1: add description
+ on the new encodings and normalization schemes.
+ * dnsproxy/dnsproxy.8: removed.
+ * dnsproxy/dnsproxy.8.in: created.
+ * dnsproxy/Makefile.in: generate dnsproxy.8 from dnsproxy.8.in,
+ reflecting correct path.
+ * DISTFILES: replace dnsproxy/dnsproxy.8 with dnsproxy/dnsproxy.8.in.
+
+2000-11-16
+ * lib/brace.c: fix buffer-overrun bugs.
+
+2000-11-14
+ * include/mdn/brace.h, lib/mdn/brace.c: created. (for BRACE encoding)
+ * include/mdn/lace.h, lib/mdn/lace.c: created. (for LACE encoding)
+ * include/mdn/util.h, lib/util.c: incorporate some functionalities
+ from race.c, such as UTF-8 <-> UTF-16 conversion.
+ * lib/race.c: move some functionalities shared with brace.c and
+ lace.c out to util.c.
+ * lib/converter.c: add BRACE and LACE converters.
+ * include/mdn/Makefile.in: add brace.h and lace.h to the intall files.
+ * lib/Makefile.in: add brace.c and lace.c.
+ * DISTFILES: add include/mdn/{brace,lace}.h, lib/{brace,lace}.c.
+
+2000-11-10
+ * lib/normalizer.c: add normalize scheme
+ "ja-compose-voiced-sound".
+
+2000-11-06
+ * wsock/common/printf.c: mDN Wrapper enable libmdn trace
+ * wsock/wsock11/dllmain.c: mDN Wrapper enable libmdn trace
+ * wsock/wsock20/dllmain.c: mDN Wrapper enable libmdn trace
+ * wsock/common/jpnicmdn.h: mDN Wrapper enable libmdn trace
+ * wsock/common/jpnicmdn.def: mDN Wrapper enable libmdn trace
+ * wsock/wsock11/dllfunc.c: check status of conversion
+ * wsock/wsock20/dllfunc.c: check status of conversion
+ * wsock/common/encoding.c: Fixed query on program side encoding
+ * wsock/common/convert.c : Fixed setting program side encoding
+
+2000-11-02
+ * lib/util.c, include/mdn/util.h: created.
+ * lib/race.c, tools/mdnconv/util.c: make use of the above util
+ module.
+ * DISTFILES, include/mdn/Makefile.in, lib/Makefile.in,
+ tools/runmdn/Makefile.in, lib/make.wnt, lib/make.os2: add
+ util.[ch].
+ * lib/Makefile.in, tools/runmdn/Makefile.in: increase revision
+ number.
+ * tools/runmdn/Makefile.in: use INSTALL_SCRIPT rather than
+ INSTALL_PROGRAM for shell script installation.
+ * tools/rpm/mdnkit.spec: increase version and serial.
+ * Makefile.in: change package name to mdnkit-1.1-src. add patch
+ target.
+ * DISTFILES: add ChangeLog and NEWS.
+ * lib/msgtrans.c: remove extra semicolon at the end of #undef
+ line.
+ * tools/rpm/mdnkit.spec: update for version 1.1.
+ * README, README.ja: update for version 1.1.
+ * version 1.1 release.
+
+2000-11-01
+ * lib/race.c, tools/mdnconv/util.c: fix race prefix matching bug.
+ Previously, matching failed if the prefix contains any uppercase
+ letters (such as Bq--),
+
+2000-10-31
+ * dnsproxy/dnsproxy.8: fix typo.
+ * dnsproxy/dnsproxy.conf.sample: add log-level entry. correct
+ description of the behavior when log-file is not specified.
+ * NEWS: created.
+
+2000-10-30
+ * patch/bind9/bind-9.0.0-patch (lib/dns/config/confparser.y):
+ typo fixed.
+
+2000-10-27
+ * dnsproxy/Makefile.in: remove -DDEBUG.
+ * dnsproxy/logging.c: supply default log file if not specfied.
+ * dnsproxy/translate.c: make the log correctly display "tcp" or
+ "udp" instead of "unknown". fix typo.
+ * dnsproxy/winserv.c: comment out message logging code because
+ they are also recorded in event logger.
+
+2000-10-26
+ * dnsproxy/config.c: stop redefining logging macros (since it's
+ not needed). use fprintf instead of log_printf for logging (since
+ log file is not yet determined at this stage).
+ * dnsproxy/dnsproxy.8: add description on log-level entry.
+ mention about SIGHUP feature.
+ * dnsproxy/dnsproxy.h: add log-level constants. change log macro
+ definitions. add prototypes for new logging functions.
+ * dnsproxy/logging.c: add log-level setting feature, including new
+ logging interface functions and log-level entry in the
+ configuration file. add log file turnover support
+ (close and reopen the file when receiving SIGHUP)
+ * dnsproxy/server.c: ignore transient errors such as EAGAIN or
+ EINTR. do not quit server process even if recvfrom returns
+ ECONNREFUSED, which seems to happen on Linux. Same for
+ ENETUNREACH and EHOSTUNREACH.
+ * dnsproxy/translate.c: make mdn_log_level_info messages are
+ logged at 'warn' level instead of 'trace' level.
+ * dnsproxy/unxmain.c: add handler for SIGHUP.
+
+2000-10-25
+ * lib/utf8.c: fix mdn_utf8_getmb so that it returns correct
+ value.
+
+2000-10-24
+ * dnsproxy/server.c: don't terminate server process even if
+ recvfrom (on UDP socket) returns 0.
+ * tools/mdnconv/mdnconv.1: correct syntax of -noconf option.
+
+2000-10-23
+ * dnsproxy/message.c: fix DNS message ID allocation bug (only
+ 4096 IDs out of 65536 could be used before). release internal
+ data structure for each request when receiving reply (previously
+ it is kept for 10 minutes, causing large memory footprint for
+ busy servers). add some debug statements.
+ * dnsproxy/server.c: increase interval for calling timer dispatch
+ routine (1sec -> 10sec).
+
+2000-10-08
+ * version 1.0 release
diff --git a/contrib/idn/mdnkit/LICENSE.txt b/contrib/idn/mdnkit/LICENSE.txt
new file mode 100644
index 00000000..0e333813
--- /dev/null
+++ b/contrib/idn/mdnkit/LICENSE.txt
@@ -0,0 +1,55 @@
+Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+
+By using this file, you agree to the terms and conditions set forth bellow.
+
+ LICENSE TERMS AND CONDITIONS
+
+The following License Terms and Conditions apply, unless a different
+license is obtained from Japan Network Information Center ("JPNIC"),
+a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+Tokyo, Japan.
+
+1. Use, Modification and Redistribution (including distribution of any
+ modified or derived work) in source and/or binary forms is permitted
+ under this License Terms and Conditions.
+
+2. Redistribution of source code must retain the copyright notices as they
+ appear in each source code file, this License Terms and Conditions.
+
+3. Redistribution in binary form must reproduce the Copyright Notice,
+ this License Terms and Conditions, in the documentation and/or other
+ materials provided with the distribution. For the purposes of binary
+ distribution the "Copyright Notice" refers to the following language:
+ "Copyright (c) Japan Network Information Center. All rights reserved."
+
+4. Neither the name of JPNIC may be used to endorse or promote products
+ derived from this Software without specific prior written approval of
+ JPNIC.
+
+5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ "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 JPNIC 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 DAMAGES.
+
+6. Indemnification by Licensee
+ Any person or entities using and/or redistributing this Software under
+ this License Terms and Conditions shall defend indemnify and hold
+ harmless JPNIC from and against any and all judgements damages,
+ expenses, settlement liabilities, cost and other liabilities of any
+ kind as a result of use and redistribution of this Software or any
+ claim, suite, action, litigation or proceeding by any third party
+ arising out of or relates to this License Terms and Conditions.
+
+7. Governing Law, Jurisdiction and Venue
+ This License Terms and Conditions shall be governed by and and
+ construed in accordance with the law of Japan. Any person or entities
+ using and/or redistributing this Software under this License Terms and
+ Conditions hereby agrees and consent to the personal and exclusive
+ jurisdiction and venue of Tokyo District Court of Japan.
diff --git a/contrib/idn/mdnkit/Makefile.in b/contrib/idn/mdnkit/Makefile.in
new file mode 100644
index 00000000..68aa4aa3
--- /dev/null
+++ b/contrib/idn/mdnkit/Makefile.in
@@ -0,0 +1,87 @@
+# $Id: Makefile.in,v 1.1 2000/12/07 00:52:17 tale Exp $
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+# Tokyo, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) Japan Network Information Center. All rights reserved."
+#
+# 4. Neither the name of JPNIC may be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "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 JPNIC 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 DAMAGES.
+#
+# 6. Indemnification by Licensee
+# Any person or entities using and/or redistributing this Software under
+# this License Terms and Conditions shall defend indemnify and hold
+# harmless JPNIC from and against any and all judgements damages,
+# expenses, settlement liabilities, cost and other liabilities of any
+# kind as a result of use and redistribution of this Software or any
+# claim, suite, action, litigation or proceeding by any third party
+# arising out of or relates to this License Terms and Conditions.
+#
+# 7. Governing Law, Jurisdiction and Venue
+# This License Terms and Conditions shall be governed by and and
+# construed in accordance with the law of Japan. Any person or entities
+# using and/or redistributing this Software under this License Terms and
+# Conditions hereby agrees and consent to the personal and exclusive
+# jurisdiction and venue of Tokyo District Court of Japan.
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+SUBDIRS = include lib dnsproxy man tools
+
+CUR_VERSION = 1.2
+PREV_VERSION = 1.1
+PREV_TAG = REL_1_1
+
+DISTFILE = mdnkit-$(CUR_VERSION)-src
+PATCHFILE = mdnkit-$(PREV_VERSION)-$(CUR_VERSION)-src-patch
+
+all:
+ for d in $(SUBDIRS); do (cd $$d; $(MAKE) all); done
+
+install:
+ for d in $(SUBDIRS); do (cd $$d; $(MAKE) install); done
+
+clean:
+ for d in $(SUBDIRS); do (cd $$d; $(MAKE) clean); done
+
+dist:
+ cd $(srcdir); mktarpkg --gzip=9 $(DISTFILE)
+
+patch:
+ cd $(srcdir); mkcvspatch --gzip=9 --header=patch.header \
+ --from=$(PREV_TAG) $(PATCHFILE)
diff --git a/contrib/idn/mdnkit/NEWS b/contrib/idn/mdnkit/NEWS
new file mode 100644
index 00000000..b0e235aa
--- /dev/null
+++ b/contrib/idn/mdnkit/NEWS
@@ -0,0 +1,58 @@
+; $Id: NEWS,v 1.1 2000/12/07 00:52:17 tale Exp $
+
+Major changes in version 1.2:
+
+* New encoding converters for `BRACE' and `LACE' are implemented.
+
+* New normalize schemes `ja-compose-voiced-sound', 'ja-kana-fullwidth'
+ and 'ja-alnum-halfwidth' introduced.
+
+* mDN Wrapper is thoroughly overhauled.
+ - Log level can be specified by using GUI (or directly editing the
+ registry Software\JPNIC\MDN\LogLevel). Note that fine grain
+ control over logging is supported only by the MDN library (libmdn).
+ Log output from mDN Wrapper itself can be turned on or off, but
+ no log level support.
+ - Log file can also specified.
+ - Some serious bugs are fixed, including incorrect program-side
+ encoding (codeset) detection.
+ - Advanced configuration feature implemented. Now DNS encoding and
+ normalization can be customizable. Also you can configure which
+ winsock DLL to be wrapped.
+
+* dnsproxy and mDN Wrapper now correctly accept and process client-
+ supplied domain names encoded in the alternate encoding. Previously
+ worked correctly only when the alternate encoding happened to be the
+ same as the server encoding.
+
+* 8bit-through patch for BIND-8.2.2-P5 is replaced by a new patch
+ for BIND-8.2.2-P7.
+
+* A buffer overrun bug in RACE converter is fixed.
+
+
+Major changes in version 1.1:
+
+* Log level of dnsproxy can be specified with ``log-level'' entry.
+ available levels are `none', `fatal', `warning' and `trace'. See
+ dnsproxy.8 or dnsproxy.conf.sample for details.
+
+* Sending SIGHUP to dnsproxy causes it to close and re-open the log file.
+ Useful for log file turnover.
+
+* If log file is not specified, dnsproxy uses the default log file
+ /tmp/dnsproxy.log. Previously behavior was that no logging was done
+ at all, conflicting with what document says.
+
+* dnsproxy won't terminate even if recvfrom() returns unexpected
+ errors such as `connection refused (ECONNREFUSED)'. On Linux, it is
+ reported that it sometimes returns this error even for
+ connection-less (ie UDP) sockets.
+
+* DNS message ID allocation/release bugs in dnsproxy are fixed.
+ Previously dnsproxy seems to stop working if it receives more than
+ 4096 requests in 10 minutes.
+
+* RACE conversion bug is fixed. Previously, if the prefix part contains
+ any uppercase letters (such as "Bq--"), it is not recognized as a
+ RACE prefix.
diff --git a/contrib/idn/mdnkit/README b/contrib/idn/mdnkit/README
new file mode 100644
index 00000000..4566cd46
--- /dev/null
+++ b/contrib/idn/mdnkit/README
@@ -0,0 +1,304 @@
+
+ mDNkit
+ -- multilingual domain name evaluation kit --
+ version 1.2
+ Japan Network Information Center (JPNIC)
+
+
+* Overview
+
+mDNkit is a kit for evaluating various proposed methods regarding
+multilingualized/internationalized DNS. To handle multilingualized
+domain name, the following features are required:
+ + encoding conversion of domain names between
+ the encoding application uses (local encoding) and
+ the encoding on DNS protocol.
+ + normalization of domain names.
+mDNkit provides several ways for adding these features.
+
+This kit consists of following components.
+
+ + DNS proxy server (dnsproxy)
+ This works as a fake DNS server for the clients. It receives
+ DNS request containing domain names in the client's local
+ encoding (e.g. Shift_JIS), translates them into the encoding
+ on DNS protocol (e.g. UTF-8 or RACE), and forwards to the real
+ DNS server. Also the response from the server is converted
+ back to the client's local encoding and returned. See
+ ``1. using dnsproxy'' below.
+
+ + a command dynamically adds MDN feature to unix applications (runmdn)
+ This command enables normal applications to handle
+ multilingual domain names by dynamically attaching special
+ library to them. See ``2. using runmdn'' below.
+
+ + a patch for BIND-9 that adds MDN capability
+ This patch adds MDN capability to BIND9. BIND 9 employs a
+ completely new name resolving scheme called ``light weight
+ resolver'', consisting of client-side library (liblwres) and a
+ name resolving daemon (lwresd). This patch adds MDN features
+ to them. See ``3. using patched version of bind-9'' below.
+
+ + mDN wrapper for Windows applications
+ On windows, name resolving request is passed to WINSOCK DLL. So,
+ replacing WINSOCK DLL with multi-lingual domain name version
+ makes legacy windows applications compatible with mDN. This is
+ wrapper DLL for WINSOCK's name resolving functions. See
+ ``4. using mDN wrapper'' below.
+
+ + a codeset converter for named.conf/zone master files (mdnconv)
+ This is a codeset (encoding) converter specially designed for
+ converting named.conf and zone master files from your local
+ encoding (e.g. EUC-JP) to the encoding which internationalized
+ DNS servers employ (e.g. UTF-8).
+
+ + libraries for handling multilingual domain names (libmdn, libmdnres)
+ These are the basic libraries implementing encoding conversion
+ and normalization. All the commands in this kit (such as
+ dnsproxy and mdnconv) are built using these libraries.
+
+ + a patch that makes BIND-8 8-bit through
+ This is needed in order for named and resolver to handle
+ non-ascii domain names encoded in local encoding or UTF-8.
+ The patch is rudimentary; it makes almost any byte sequence
+ legal as a domain name (which is what 8-bit through is for).
+
+ + a patch for making Squid cache server 8-bit through
+ This is a simple patch that disables Squid's validity check
+ for host name part in URLs. Without this patch, Squid rejects
+ URLs containing multilingual domain name (correctly).
+
+
+This kit provides several ways to handle multilingual domain names
+using above components.
+
+ ** 1. using dnsproxy
+
+ domain name encoding domain name
+ in local conversion and in encoding
+ +------------+ encoding normalization on DNS
+ | client | +----------------+ protocol +----------+
+ |application |------------>| dnsproxy |------------>|DNS server|
+ | with |<------------| |<------------| |
+ |8bit through| +----------------+ +----------+
+ | resolver |
+ +------------+
+
+ ** 2. using runmdn
+
+ encoding domain name
+ conversion and in encoding
+ normalization on DNS
+ +-----------+-------------+ protocol
+ | client | dynamically | +----------+
+ |application| attached |---------------->|DNS server|
+ |with normal| library |<----------------| |
+ | resolver | (libmdnres) | +----------+
+ +-----------+-------------+
+
+ ** 3. using patched version of bind-9
+
+ domain name normalization domain name
+ in UTF-8 and encoding in encoding
+ +------------+ encoding conversion on DNS
+ | client | +----------------+ protocol +----------+
+ |application |------------>| light weight |------------>|DNS server|
+ |with bind9's|<------------| resolver |<------------| |
+ |light weight| | daemon | +----------+
+ | resolver | +----------------+
+ +------------+
+
+ ** 4. using mDN wrapper
+
+ domain name normalization domain name
+ in local and encoding in ecnoding
+ +-----------+ encoding conversion on DNS
+ | legacy | +---------+---------+ protocol +----------+
+ | windows |------------>| mDN | orignal |---------->|DNS server|
+ | network |<------------| wrapper | winsock |<----------| |
+ |application| +---------+---------+ +----------+
+ +-----------+
+
+* Directory structure of this distribution
+
+Below is a directory structure of this distribution with some
+important files and their brief description.
+
+ +README this file
+ +README.ja .. in Japanese
+ +DISTFILES list of files in this distribution
+ +NEWS what's new in this version
+ +ChangeLog list of changes
+ +configure a `configure' script
+ +Makefile.in toplevel makefile template
+ +include/
+ | +config.h.in template header file for configuration
+ | +mdn/ header files for mdn library
+ +dnsproxy/ source directory for DNS proxy server
+ +lib/ source directory for mdn library
+ +wsock/ source directory for mDN wrapper
+ +tools/ source directory for tools
+ | +mdnconv/ source directory for codeset converter
+ | +runmdn/ source directory for runmdn command
+ +patch/ various patch files
+ | +bind8/ bind-8 patch directory
+ | +bind9/ bind-9 patch directory
+ | +squid/ squid patch directory
+ +util/ utilities
+
+
+* Compilation and installation
+
+0. Prerequisite
+
+If your system's library does not have iconv() function, which is a
+general codeset conversion utility, install it as an external library.
+You also need external library if the system's implementation cannot
+handle UTF-8 encoding, or it doesn't support some encodings which your
+client applications uses.
+
+You can get a free version of iconv() implementation (under LGPL
+license), from:
+
+ http://clisp.cons.org/~haible/packages-libiconv.html
+
+1. Running configure script
+
+Run `configure' script in the top directory. This checks various
+characteristics of your system and it will create Makefiles and
+config.h appropriate for your system.
+
+ % ./configure
+
+`configure' accepts many options. Here is a list of some important
+options.
+
+ --with-iconv=LIB
+ If your libc doesn't contain iconv(), specify the library
+ that contains iconv(). For example, if iconv() is libiconv
+ in /usr/local/lib, you should specify:
+
+ --with-iconv="-L/usr/local/lib -liconv"
+
+ Note that if the library is a shared one, you might also want to
+ specify -R option, like:
+
+ --with-iconv="-L/usr/local/lib -R/usr/local/lib -liconv"
+
+ If the header file "iconv.h" has installed in a non-standard
+ directory like /usr/local/include, you should specify CFLAGS
+ environment variable. See below.
+
+ --with-iconv-sofile=PATH
+ ``runmdn'' command in this kit needs to know the pathname of
+ shared library file that contains iconv(), if iconv() is not
+ part of libc. mDNkit tries to find out the pathname from the
+ informaiton provided by ``--with-iconv'' option described
+ above. But when it fails, you have to specify it with this
+ option, like:
+
+ --with-iconv-sofile=/usr/local/lib/libiconv.so.2.0
+
+ --with-utf8=NAME
+ If your iconv() (precisely, iconv_open()) does not accept
+ "UTF-8" as the name of UTF-8 encoding, specify the name for
+ it. For example if your iconv() uses "utf8" instead, you
+ should specify:
+
+ --with-utf8=utf8
+
+ --with-race-prefix=PREFIX
+ --with-brace-suffix=SUFFIX
+ --with-lace-prefix=PREFIX
+ RACE (Row-based ASCII-Compatible Encoding), BRACE (Bi-mode
+ Row-based ASCII-Compatible Encoding) and LACE (Length-based
+ ASCII Compatible Encoding) are proposed encodings for
+ multilingual domain name in DNS protocol data. They uses a
+ fixed prefix (or suffix) string to distinguish names encoded
+ by them from normal ASCII domain names. These prefix/suffix
+ are defined by the current Internet Drafts and mDNkit uses
+ them by default, but later version of the drafts may change
+ them. In that case you can specify the prefix/suffix with
+ these options.
+
+ --enable-zld
+ The ZLD (zero level domain) support is disabled by default.
+ If you want to try this feature, this option must be
+ specified.
+
+ --sbindir=DIR
+ Specifies the install directory for dnsproxy. Default is
+ /usr/local/sbin.
+
+ --bindir=DIR
+ Specifies the install directory for mdnconv and runmdn.
+ Default is /usr/local/bin.
+
+ --sysconfdir=DIR
+ Specifies the install directory for sample files of dnsproxy
+ configuration and mDNkit's resolver configuration. Default is
+ /usr/local/etc.
+
+ --mandir=DIR
+ Specifies the base install directory for online manuals.
+ Default is /usr/local/man.
+
+`configure' has many more options. To see the list of available
+options, you should run it with --help option.
+
+ % ./configure --help
+
+If you want to specify extra compiler options, like adding non-standard
+directory to include file search path, use environment variable CFLAGS.
+
+ % CFLAGS="-I/usr/local/include -O2" ./configure ... (for sh)
+ % setenv CFLAGS "-I/usr/local/include -g"; ./configure ... (for csh)
+
+2. Compiling
+
+Run `make' for compilation.
+
+ % make
+
+3. Installation
+
+Run `make install' to install binaries and manuals. Don't forget to
+become a super-user before the installation.
+
+ % su
+ # make install
+
+4. Configuration and usage
+
+Please consult online manuals for configuration and usage of `dnsproxy'
+`mdnconv', and `runmdn'. Also for `mdnconv' and `runmdn', please refer
+the manual of mDNkit's resolver configuration file `mdnres.conf'.
+
+ % man dnsproxy
+ % man mdnconv
+ % man runmdn
+ % man mdnres.conf
+
+
+* Applying patches
+
+This distribution also contains patches for BIND 8.2.2-P7,
+BIND 8.2.3-T6B, BIND 9.0.0 and Squid 2.3.STABLE3. The top of these
+patch files describe how to apply the patch and (re)install.
+
+Note that on Solaris, "patch" command that comes with the system
+sometimes doesn't work correctly. You may want to install the GNU
+version of the command (http://www.gnu.org/software/patch/) and use
+it.
+
+
+* Contact information
+
+Please see http//www.nic.ad.jp/jp/research/idn/ for the latest news
+about this kit.
+
+Bug reports and comments on this kit should be sent to
+mdnkit-bugs@nic.ad.jp and idn-cmt@nic.ad.jp, respectively.
+
+
+; $Id: README,v 1.1 2000/12/07 00:52:17 tale Exp $
diff --git a/contrib/idn/mdnkit/README.ja b/contrib/idn/mdnkit/README.ja
new file mode 100644
index 00000000..72a5495b
--- /dev/null
+++ b/contrib/idn/mdnkit/README.ja
@@ -0,0 +1,300 @@
+
+ mDNkit
+ -- ¿¸À¸ì¥É¥á¥¤¥ó̾ɾ²Á¥­¥Ã¥È --
+ ¥Ð¡¼¥¸¥ç¥ó 1.2
+ (¼Ò) ÆüËܥͥåȥ¥¯¥¤¥ó¥Õ¥©¥á¡¼¥·¥ç¥ó¥»¥ó¥¿¡¼ (JPNIC)
+
+
+* ³µÍ×
+
+mDNkit ¤È¤Ï DNS ¤Ç¿¸À¸ì¥É¥á¥¤¥ó̾¤ò°·¤¦¤¿¤á¤ËÄó°Æ¤µ¤ì¤Æ¤¤¤ë³Æ¼ï¤ÎÊý¼°
+¤òɾ²Á¤¹¤ë¤¿¤á¤Î¥­¥Ã¥È¤Ç¤¹¡£Â¿¸À¸ì¥É¥á¥¤¥ó̾¤ò°·¤¦¤¿¤á¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ê
+µ¡Ç½¤¬Í׵ᤵ¤ì¤Þ¤¹¡£
+
+¡¦¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬»ÈÍѤ¹¤ë¥¨¥ó¥³¡¼¥Ç¥£¥ó¥° (¥í¡¼¥«¥ë¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°)
+ ¤È DNS ¥×¥í¥È¥³¥ë¾å¤Î¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤È¤Î´Ö¤Î¡¢¥É¥á¥¤¥ó̾¤Î¥¨¥ó¥³¡¼
+ ¥Ç¥£¥ó¥°ÊÑ´¹¡£
+¡¦¥É¥á¥¤¥ó̾¤ÎÀµµ¬²½¡£
+
+mDNkit ¤Ç¤Ï¡¢¤³¤ì¤é¤Îµ¡Ç½¤òÄɲ乤뤿¤á¤Î³Æ¼ï¤ÎÊýË¡¤òÄ󶡤·¤Æ¤¤¤Þ¤¹¡£
+
+¤³¤ÎÇÛÉÛ¥­¥Ã¥È¤Ë¤Ï¼¡¤Î¤è¤¦¤Ê¤â¤Î¤¬´Þ¤Þ¤ì¤Þ¤¹¡£
+
+¡¦DNS¥×¥í¥­¥·¥µ¡¼¥Ð (dnsproxy)
+ ¥É¥á¥¤¥ó̾ÊÑ´¹µ¡Ç½¤ò¤â¤Ä DNS ¤Î¥×¥í¥­¥·¥µ¡¼¥Ð¤Ç¤¹¡£¥¯¥é¥¤¥¢¥ó¥È¤«¤é
+ ¼õ¿®¤·¤¿ DNS ¥á¥Ã¥»¡¼¥¸Ãæ¤Î¥É¥á¥¤¥ó̾¤ò¥¯¥é¥¤¥¢¥ó¥È¤Î¥í¡¼¥«¥ë¥¨¥ó¥³¡¼
+ ¥Ç¥£¥ó¥°¤«¤é DNS ¥µ¡¼¥Ð¤Î»ÈÍѤ¹¤ë DNS ¥×¥í¥È¥³¥ë¾å¤Î¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°
+ ¤Ø¤ÈÊÑ´¹¤·¤Æ DNS ¥µ¡¼¥Ð¤ËÁ÷¿®¤·¤Þ¤¹¡£¤Þ¤¿ DNS ¥µ¡¼¥Ð¤«¤éÊÖ¤µ¤ì¤¿DNS
+ ¥á¥Ã¥»¡¼¥¸Ãæ¤Î¥É¥á¥¤¥ó̾¤ò¥¯¥é¥¤¥¢¥ó¥È¤Î¥í¡¼¥«¥ë¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤ËÌá
+ ¤·¤Æ¥¯¥é¥¤¥¢¥ó¥È¤ËÊÖ¤·¤Þ¤¹¡£¾Ü¤·¤¯¤Ï¡¢¸å½Ò¤Î¡Ö1. dnsproxy ¤ò»È¤¦¡×¤ò
+ ¸æÍ÷¤¯¤À¤µ¤¤¡£
+
+¡¦UNIX ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ë MDN µ¡Ç½¤òưŪ¤ËÄɲ乤륳¥Þ¥ó¥É (runmdn)
+ UNIX ¤ÎÄ̾ï¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¿¸À¸ì¥É¥á¥¤¥ó̾¤ò¼è¤ê°·¤¦¤¿¤á¤Ë¡¢ÆÃ
+ Ê̤ʥ饤¥Ö¥é¥ê¤òưŪ¤Ë¥ê¥ó¥¯¤¹¤ë¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£¾Ü¤·¤¯¤Ï¡¢¸å½Ò¤Î
+ ¡Ö2. runmdn ¤ò»È¤¦¡×¤ò¸æÍ÷¤¯¤À¤µ¤¤¡£
+
+¡¦bind-9 ¤Ë MDN µ¡Ç½¤òÄɲ乤ë¥Ñ¥Ã¥Á
+ bind-9 ¤Ë MDN ¤Îµ¡Ç½¤òÄɲ乤ë¥Ñ¥Ã¥Á¤Ç¤¹¡£bind-9 ¤Ç¤Ï¡¢¥¯¥é¥¤¥¢¥ó¥È
+ ¦¤Î¥é¥¤¥Ö¥é¥ê (liblwres) ¤È¡¢¿·¤·¤¤Ì¾Á°²ò·èÍѥǡ¼¥â¥ó (lwresd) ¤«¤é
+ À®¤ë¡¢¥é¥¤¥È¥¦¥¨¥¤¥È¥ê¥¾¥ë¥Ð¤È¤¤¤¦Á´¤¯¿·¤·¤¤Ì¾Á°²ò·è¤ÎÊýË¡¤¬»È¤ï¤ì¤Æ
+ ¤¤¤Þ¤¹¡£¤³¤Î¥Ñ¥Ã¥Á¤Ï¡¢¤³¤ì¤é¤Ë MDN ¤Îµ¡Ç½¤òÄɲä·¤Þ¤¹¡£¾Ü¤·¤¯¤Ï¡¢¸å
+ ½Ò¤Î¡Ö3. bind9 ¤Ë¥Ñ¥Ã¥Á¤òÅö¤Æ¤Æ»È¤¦¡×¤ò¸æÍ÷¤¯¤À¤µ¤¤¡£
+
+¡¦Windows ¥¢¥×¥ê¥±¡¼¥·¥ç¥óÍѤΠmDN ¥é¥Ã¥Ñ¡¼
+ WINSOCK ¤Î̾Á°²ò·èµ¡Ç½¤ËÂФ¹¤ë¥é¥Ã¥Ñ¡¼ DLL ¤Ç¤¹¡£Windows ¾å¤Ç¤Ï¡¢Ì¾
+ Á°²ò·è¤ÎÍ×µá¤Ï¡¢WINSOCK DLL ¤òÄ̤·¤Æ¹Ô¤ï¤ì¤Þ¤¹¡£¤½¤³¤Ç¡¢¤³¤ì¤ò¿¸À¸ì
+ ¥É¥á¥¤¥óÍѤΠWINSOCK DLL ¤ËÃÖ¤­´¹¤¨¤ë¤³¤È¤Ç¡¢½¾Íè¤Î Windows ¥¢¥×¥ê¥±¡¼
+ ¥·¥ç¥ó¤Ç¤â mDN µ¡Ç½¤ò»ÈÍѤǤ­¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£¾Ü¤·¤¯¤Ï¡¢¸å½Ò¤Î
+ ¡Ö4. mDN ¥é¥Ã¥Ñ¡¼¤ò»È¤¦¡×¤ò¸æÍ÷¤¯¤À¤µ¤¤¡£
+
+¡¦named.conf ¤ª¤è¤Ó¥¾¡¼¥ó¥Þ¥¹¥¿¥Õ¥¡¥¤¥ëÍÑ¥³¡¼¥É¥»¥Ã¥È¥³¥ó¥Ð¡¼¥¿ (mdnconv)
+ named.conf ¤ª¤è¤Ó¥¾¡¼¥ó¥Þ¥¹¥¿¥Õ¥¡¥¤¥ë¤òÂоݤȤ·¤¿¥³¡¼¥É¥»¥Ã¥È (¥¨¥ó
+ ¥³¡¼¥Ç¥£¥ó¥°)ÊÑ´¹Íѥġ¼¥ë¤Ç¤¹¡£SJIS ¤Ê¤É¤Î¥í¡¼¥«¥ë¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Ç
+ ½ñ¤«¤ì¤¿¤³¤ì¤é¤Î¥Õ¥¡¥¤¥ë¤ò¡¢Â¿¸À¸ì²½ DNS ¤Ç»ÈÍѤ¹¤ë¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°
+ (Î㤨¤ÐUTF-8) ¤Ø¤ÈÊÑ´¹¤·¤Þ¤¹¡£
+
+¡¦Â¿¸À¸ì¥É¥á¥¤¥ó̾¤ò½èÍý¤¹¤ë¤¿¤á¤Î¥é¥¤¥Ö¥é¥ê (libmdn, libmdnres)
+ dnsproxy ¤ä mdnconv ¤¬ÍøÍѤ·¤Æ¤¤¤ë¥é¥¤¥Ö¥é¥ê¤Ç¤¹¡£¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°ÊÑ
+ ´¹¤äÀµµ¬²½¡¢ZLD (zero-level domain) ¤Î½èÍýÅù¤Îµ¡Ç½¤òÄ󶡤·¤Þ¤¹¡£
+
+¡¦bind-8 ¤ò 8 ¥Ó¥Ã¥È¥¹¥ë¡¼²½¤¹¤ë¥Ñ¥Ã¥Á
+ named ¤ä¥ê¥¾¥ë¥Ð¤Ç¥í¡¼¥«¥ë¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤ä UTF-8 ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°
+ ¤Î¥É¥á¥¤¥ó̾¤ò»ÈÍѲÄǽ¤Ë¤¹¤ë¤¿¤á¤Î¥Ñ¥Ã¥Á¤Ç¤¹¡£8¥Ó¥Ã¥È¥¹¥ë¡¼¤Ê¤Î¤Ç¤Û
+ ¤È¤ó¤É¤É¤ó¤Ê¥³¡¼¥É¤Ç¤âÄ̤äƤ·¤Þ¤¤¤Þ¤¹¡£
+
+¡¦squid ¤ò 8 ¥Ó¥Ã¥È¥¹¥ë¡¼²½¤¹¤ë¥Ñ¥Ã¥Á
+ URL Ãæ¤Î¥Û¥¹¥È̾¤Ë´Ø¤¹¤ëÀµÅöÀ­¥Á¥§¥Ã¥¯¤ò³°¤¹¤¿¤á¤Î¥Ñ¥Ã¥Á¤Ç¤¹¡£¤³¤Î¥Ñ¥Ã
+ ¥Á¤òÅö¤Æ¤Ê¤¤¤È Squid ¤Ï¿¸À¸ì¥É¥á¥¤¥ó̾¤ò´Þ¤à URL ¤ò¥¨¥é¡¼¤È¤·¤Æ¤Ï¤¸
+ ¤¤¤Æ¤·¤Þ¤¤¤Þ¤¹¡£
+
+
+¤³¤ÎÇÛÉÛ¥­¥Ã¥È¤Ï¡¢°Ê¾å¤Î¤â¤Î¤òÍѤ¤¤Æ¡¢Â¿¸À¸ì¥É¥á¥¤¥ó̾¤ò°·¤¦¤¿¤á¤ÎÊ£¿ô
+¤ÎÊýË¡¤òÄ󶡤·¤Æ¤¤¤Þ¤¹¡£
+
+ ** 1. dnsproxy ¤ò»È¤¦
+
+ ¥í¡¼¥«¥ë¥¨¥ó ¥¨¥ó¥³¡¼¥Ç¥£¥ó DNS ¥×¥í¥È¥³¥ë¾å¤Î
+ ¥³¡¼¥É¥£¥ó¥° ¥°ÊÑ´¹¤ª¤è¤ÓÀµ ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Î
+ +----------------+¤Î¥É¥á¥¤¥ó̾ µ¬²½ ¥É¥á¥¤¥ó̾
+ |¥¯¥é¥¤¥¢¥ó¥È | +--------------+ +------+
+ |¥¢¥×¥ê¥±¡¼¥·¥ç¥ó|------------>| dnsproxy |------------>| DNS |
+ |¤È 8¥Ó¥Ã¥È¥¹¥ë¡¼|<------------| |<------------|¥µ¡¼¥Ð|
+ |²½¤·¤¿¥ê¥¾¥ë¥Ð | +--------------+ +------+
+ +----------------+
+
+ ** 2. runmdn ¤ò»È¤¦
+
+ ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°ÊÑ´¹ DNS ¥×¥í¥È¥³¥ë¾å¤Î
+ ¤ª¤è¤ÓÀµµ¬²½ ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Î
+ +----------------+------------------+ ¥É¥á¥¤¥ó̾
+ |¥¯¥é¥¤¥¢¥ó¥È |ưŪ¤Ë¥ê¥ó¥¯¤µ¤ì¤¿| +------+
+ |¥¢¥×¥ê¥±¡¼¥·¥ç¥ó| ¥é¥¤¥Ö¥é¥ê |---------------->| DNS |
+ |¤ÈÄ̾ï¤Î¥ê¥¾¥ë¥Ð| (libmdnres) |<----------------|¥µ¡¼¥Ð|
+ +----------------+------------------+ +------+
+
+ ** 3. bind9 ¤Ë¥Ñ¥Ã¥Á¤òÅö¤Æ¤Æ»È¤¦
+
+ UTF-8 ¤Î¥É ¥¨¥ó¥³¡¼¥Ç¥£ DNS ¥×¥í¥È¥³¥ë¾å¤Î
+ ¥á¥¤¥ó̾ ¥ó¥°ÊÑ´¹¤ª¤è ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Î
+ +----------------+ ¤ÓÀµµ¬²½ ¥É¥á¥¤¥ó̾
+ |¥¯¥é¥¤¥¢¥ó¥È | +----------------+ +------+
+ |¥¢¥×¥ê¥±¡¼¥·¥ç¥ó|---------->| ¥é¥¤¥È¥¦¥§¥¤¥È |------------>| DNS |
+ |¤È bind9¤Î¥é¥¤¥È|-----------| ¥ê¥¾¥ë¥Ð |<------------|¥µ¡¼¥Ð|
+ |¥¦¥§¥¤¥È¥ê¥¾¥ë¥Ð| | ¥Ç¡¼¥â¥ó | +------+
+ +----------------+ +----------------+
+
+ ** 4. mDN ¥é¥Ã¥Ñ¡¼¤ò»È¤¦
+
+ ¥í¡¼¥«¥ë¥¨ Àµµ¬²½¤ª¤è¤Ó DNS ¥×¥í¥È¥³¥ë¾å¤Î
+ ¥ó¥³¡¼¥Ç¥£ ¥¨¥ó¥³¡¼¥Ç¥£ ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Î
+ +----------------+ ¥ó¥°¤Î¥É¥á ¥ó¥°ÊÑ´¹ ¥É¥á¥¤¥ó̾
+ |½¾Íè¤Î Windows | ¥¤¥ó̾ +---------+------------+ +------+
+ |¥Í¥Ã¥È¥ï¡¼¥¯ |---------->| mDN | ¥ª¥ê¥¸¥Ê¥ë |---------->| DNS |
+ |¥¢¥×¥ê¥±¡¼¥·¥ç¥ó|<----------| ¥é¥Ã¥Ñ¡¼| winsock |<----------|¥µ¡¼¥Ð|
+ +----------------+ +---------+------------+ +------+
+
+
+* ¥Ç¥£¥ì¥¯¥È¥ê¹½À®
+
+ÇÛÉÛ¥­¥Ã¥È¤Î¥Ç¥£¥ì¥¯¥È¥ê¹½À®¤È¡¢¼çÍפʥե¡¥¤¥ë¤ò¼¨¤·¤Þ¤¹¡£
+
+ README ±Ñ¸ìÈǤΠREADME
+ README.ja ¤³¤Î¥Õ¥¡¥¤¥ë
+ DISTFILES ÇÛÉÛ¤µ¤ì¤ë¥Õ¥¡¥¤¥ë°ìÍ÷
+ NEWS ¼ç¤ÊÊѹ¹
+ ChangeLog Êѹ¹¾ÜºÙ
+ configure configure ¥¹¥¯¥ê¥×¥È
+ Makefile.in ¥È¥Ã¥×¥ì¥Ù¥ë¤Î Makefile ¤Î¥Æ¥ó¥×¥ì¡¼¥È
+ include/ ¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¥Ç¥£¥ì¥¯¥È¥ê
+ config.h.in config.h ¤Î¥Æ¥ó¥×¥ì¡¼¥È
+ mdn/ mdn ¥é¥¤¥Ö¥é¥êÍÑ¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë
+ dnsproxy/ DNS ¥×¥í¥­¥·¥µ¡¼¥Ð¥½¡¼¥¹
+ lib/ mdn ¥é¥¤¥Ö¥é¥ê¥½¡¼¥¹
+ wsock/ mDN ¥é¥Ã¥Ñ¡¼¥½¡¼¥¹
+ tools/ ¼þÊեġ¼¥ë
+ mdnconv/ ¥³¡¼¥É¥»¥Ã¥È¥³¥ó¥Ð¡¼¥¿¥½¡¼¥¹
+ runmdn/ runmdn ¥³¥Þ¥ó¥É¥½¡¼¥¹
+ patch/ ³Æ¼ï¥Ñ¥Ã¥Á¥Õ¥¡¥¤¥ë
+ bind8/ bind8 ÍѥѥåÁ
+ bind9/ bind9 ÍѥѥåÁ
+ squid/ squid ÍѥѥåÁ
+ util/ ¥æ¡¼¥Æ¥£¥ê¥Æ¥£
+
+
+* ¥³¥ó¥Ñ¥¤¥ë¤ª¤è¤Ó¥¤¥ó¥¹¥È¡¼¥ë
+
+0. Á°½àÈ÷
+
+¤â¤·¤¢¤Ê¤¿¤Î»ÈÍѤ·¤Æ¤¤¤ë¥·¥¹¥Æ¥à¤Î¥é¥¤¥Ö¥é¥ê¤Ë iconv() ¤¬¤Ê¤¤¾ì¹ç¡¢¤¢
+¤ë¤¤¤Ï¤¢¤Ã¤Æ¤â UTF-8 ¤ò°·¤¦¤³¤È¤¬¤Ç¤­¤Ê¤¤¾ì¹ç¤Ë¤Ï¤¢¤é¤«¤¸¤á iconv() ¤ò
+¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£iconv() ¤Î¼ÂÁõ¤Ï¡¢Î㤨¤Ð LGPL ¤Î¤â¤Î¤¬
+
+ http://clisp.cons.org/~haible/packages-libiconv.html
+
+¤«¤éÆþ¼ê²Äǽ¤Ç¤¹¡£
+
+1. configure ¥¹¥¯¥ê¥×¥È¤Î¼Â¹Ô
+
+¥È¥Ã¥×¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¢¤ë configure ¥¹¥¯¥ê¥×¥È¤ò¼Â¹Ô¤·¤Æ¤¯¤À¤µ¤¤¡£
+
+ % ./configure
+
+configure ¥¹¥¯¥ê¥×¥È¤Ë¤Ï¤¤¤¯¤Ä¤«¤Î¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+mdn ¤ËľÀÜ´Ø·¸¤¹¤ë¤â¤Î¤Ï¼¡¤ÎÄ̤ê¤Ç¤¹¡£
+
+ --with-iconv=LIB
+ libc ¤Ë iconv ¤¬Æþ¤Ã¤Æ¤¤¤Ê¤¤¾ì¹ç (¾åµ­¤Î¥Ñ¥Ã¥±¡¼¥¸¤òÆþ¤ì¤¿
+ ¾ì¹ç¤Ê¤É) ¤Ë¡¢iconv ¤Î¥é¥¤¥Ö¥é¥ê¤ò»ØÄꤷ¤Þ¤¹¡£Î㤨¤Ð
+
+ --with-iconv="-L/usr/local/lib -liconv"
+
+ ¤Î¤è¤¦¤Ë»ØÄꤷ¤Þ¤¹¡£¤â¤· iconv ¤¬¶¦Í­¥é¥¤¥Ö¥é¥ê¤Ë¤Ê¤Ã¤Æ¤¤¤ë
+ ¾ì¹ç¤Ë¤Ï¡¢-R ¥ª¥×¥·¥ç¥ó¤â»ØÄꤷ¤Æ
+
+ --with-iconv="-L/usr/local/lib -R/usr/local/lib -liconv"
+
+ ¤È¤¹¤ëɬÍפ¬¤¢¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¡£
+
+ --with-iconv-sofile=PATH
+ mDNkit ¤Ë´Þ¤Þ¤ì¤Æ¤¤¤ë runmdn ¥³¥Þ¥ó¥É¤Ï¡¢iconv() ¤¬ libc ¤Î°ì
+ Éô¤È¤·¤ÆÄ󶡤µ¤ì¤Ê¤¤¤È¤­¤Ë¡¢iconv() ¤ò´Þ¤à¶¦Í­¥é¥¤¥Ö¥é¥ê¤Ø¤Î¥Ñ
+ ¥¹Ì¾¤òÃΤëɬÍפ¬¤¢¤ê¤Þ¤¹¡£mDNkit ¤Ï¡¢--with-iconv ¥ª¥×¥·¥ç¥ó¤Î
+ µ­½Ò¤ò´ð¤Ë¥Ñ¥¹Ì¾¤ò¸¡º÷¤·¤Þ¤¹¤¬¡¢¤³¤ì¤Ë¼ºÇÔ¤·¤¿¤È¤­¤Ë¡¢°Ê²¼¤Î¤è
+ ¤¦¤Ë¶¦Í­¥é¥¤¥Ö¥é¥ê¤ò»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
+
+ --with-iconv-sofile=/usr/local/lib/libiconvv.so.2.0
+
+ --with-utf8=NAME
+ iconv ¤Ë utf-8 ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤ò»ØÄꤹ¤ë¾ì¹ç¡¢Ëܥ饤¥Ö¥é¥ê¤Ï
+ ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï "UTF-8" ¤È¤¤¤¦Ì¾Á°¤ò»ØÄꤷ¤Þ¤¹¡£¤â¤·¤¢¤Ê¤¿¤Î
+ ¥·¥¹¥Æ¥à¤Î iconv ¤¬ "UTF-8" ¤È¤¤¤¦Ì¾Á°¤ò¼õ¤±ÉÕ¤±¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢
+ Âå¤ê¤Î̾Á°¤ò»ØÄꤷ¤Þ¤¹¡£Î㤨¤Ð "UTF-8" ¤Ç¤Ï¤Ê¤¯ "utf8" ¤Î
+ ¾ì¹ç¤Ë¤Ï¼¡¤Î¤è¤¦¤Ë»ØÄꤷ¤Þ¤¹¡£
+
+ --with-utf8=utf8
+
+ --with-race-prefix=PREFIX
+ --with-brace-suffix=SUFFIX
+ --with-lace-prefix=PREFIX
+ RACE (Row-based ASCII-Compatible Encoding)¡¢BRACE (Bi-mode
+ Row-based ASCII-Compatible Encoding) ¤ª¤è¤Ó LACE (Length-based
+ ASCII Compatible Encoding) ¤Ï¤¤¤º¤ì¤â DNS ¥×¥í¥È¥³¥ë
+ ¾å¤Ç»ÈÍѤµ¤ì¤ë¿¸À¸ì¥É¥á¥¤¥ó̾¤Ë´Ø¤·¤ÆÄó°Æ¤µ¤ì¤Æ¤¤¤ë¥¨¥ó¥³¡¼¥Ç¥£
+ ¥ó¥°Êý¼°¤Ç¤¹¡£Ä̾ï¤Î ASCII ¥É¥á¥¤¥ó̾¤È¤³¤ì¤é¤Ë¤è¤Ã¤Æ¥¨¥ó¥³¡¼
+ ¥É¤µ¤ì¤¿¥É¥á¥¤¥ó̾¤ò¶èÊ̤¹¤ë¤¿¤á¤Ë¡¢¸ÇÄê¤ÎÀÜƬ¼­ (BRACE ¤Î¾ì¹ç
+ ¤Ë¤ÏÀÜÈø¼­) ¤¬ÍѤ¤¤é¤ì¤Þ¤¹¡£
+
+ mDNkit ¤Ç¤Ï¸½ºß¤Î¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥É¥é¥Õ¥È¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ëÀÜƬ¼­
+ ¤¢¤ë¤¤¤ÏÀÜÈø¼­¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¤¬¡¢º£¸å¤Î¥É¥é¥Õ¥È¤Ç
+ ÊѤï¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¡£¤½¤³¤Ç¡¢¤³¤ì¤é¤Î¥ª¥×¥·¥ç¥ó¤òÍѤ¤¤Æ»ØÄê¤Ç
+ ¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
+
+ --enable-zld
+ ZLD (zero level domain) ¤Ï¡¢¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï»ÈÍѤǤ­¤Þ¤»¤ó¡£¤³¤Î
+ µ¡Ç½¤ò»ÈÍѤ·¤¿¤¤¤È¤­¤Ë¡¢¤³¤Î¥ª¥×¥·¥ç¥ó¤ò»ØÄꤷ¤Þ¤¹¡£
+
+ --sbindir=DIR
+ DNS ¥×¥í¥­¥·¥µ¡¼¥Ð¤ò¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¤ò»ØÄꤷ¤Þ¤¹¡£
+ ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï /usr/local/sbin ¤Ç¤¹¡£
+
+ --bindir=DIR
+ ¥³¡¼¥É¥»¥Ã¥È¥³¥ó¥Ð¡¼¥¿ mdnconv ¤ò¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¤ò
+ »ØÄꤷ¤Þ¤¹¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï /usr/local/bin ¤Ç¤¹¡£
+
+ --sysconfdir=DIR
+ DNS ¥×¥í¥­¥·¥µ¡¼¥Ð¤ÎÀßÄê¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¤ò
+ »ØÄꤷ¤Þ¤¹¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï /usr/local/etc ¤Ç¤¹¡£
+
+ --mandir=DIR
+ ¥ª¥ó¥é¥¤¥ó¥Þ¥Ë¥å¥¢¥ë¤Î¥¤¥ó¥¹¥È¡¼¥ë¥Ç¥£¥ì¥¯¥È¥ê¤ò»ØÄꤷ¤Þ¤¹¡£
+ ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï /usr/local/man ¤Ç¤¹¡£
+
+--with-iconv ¥ª¥×¥·¥ç¥ó¤Ç¤Ï¥é¥¤¥Ö¥é¥ê¤À¤±¤ò»ØÄꤷ¤Þ¤¹¡£¤â¤·¥¤¥ó¥¯¥ë¡¼
+¥É¥Õ¥¡¥¤¥ë iconv.h ¤¬¥Ç¥Õ¥©¥ë¥È¤Î¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹¤Ë¥¤¥ó¥¹¥È¡¼
+¥ë¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢¤¢¤ë¤¤¤Ï¾¤Ë C ¥³¥ó¥Ñ¥¤¥é¤Ø¤Î¥ª¥×¥·¥ç¥ó¤ò»ØÄꤷ¤¿
+¤¤¾ì¹ç¤Ë¤Ï´Ä¶­ÊÑ¿ô CFLAGS ¤ò»ÈÍѤ·¤Æ¤¯¤À¤µ¤¤¡£Î㤨¤Ð
+
+ % CFLAGS=-I/usr/local/include ./configure ...
+ (sh ·Ï¤Î¥·¥§¥ë¤Î¾ì¹ç)
+ % setenv CFLAGS -I/usr/local/include; ./configure ...
+ (csh ·Ï¤Î¥·¥§¥ë¤Î¾ì¹ç)
+
+¤È¤·¤Þ¤¹¡£
+
+configure ¤Ë¤Ï¾¤Ë¤â¿¤¯¤Î¥ª¥×¥·¥ç¥ó¤¬¤¢¤ê¤Þ¤¹¤¬¡¢»Ä¤ê¤Ï°ìÈÌŪ¤Ê¥ª¥×¥·¥ç
+¥ó¤Ê¤Î¤ÇÀâÌÀ¤Ï¾Ê¤­¤Þ¤¹¡£
+
+ % ./configure --help
+
+¤ò¼Â¹Ô¤¹¤ë¤È¥ª¥×¥·¥ç¥ó¤Î°ìÍ÷¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£
+
+2. ¥³¥ó¥Ñ¥¤¥ë
+
+configure ¤ò¼Â¹Ô¤¹¤ë¤È Makefile ¤Ê¤É¤¬À¸À®¤µ¤ì¤Þ¤¹¤Î¤Ç¡¢Â³¤±¤Æ make¤ò
+¼Â¹Ô¤·¤Æ¥³¥ó¥Ñ¥¤¥ë¤·¤Þ¤¹¡£
+
+ % make
+
+3. ¥¤¥ó¥¹¥È¡¼¥ë
+
+¥¹¡¼¥Ñ¥æ¡¼¥¶¤Ë¤Ê¤Ã¤Æ¥¤¥ó¥¹¥È¡¼¥ë¤·¤Þ¤¹¡£
+
+ % su
+ # make install
+
+4. Configuration and usage
+
+¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤ë¥Ä¡¼¥ë (dnsproxy¡¢mdnconv¡¢runmdn) ¤Î»È¤¤Êý¡¢ÀßÄêÊý
+Ë¡¤Ë´Ø¤·¤Æ¤Ï¥ª¥ó¥é¥¤¥ó¥Þ¥Ë¥å¥¢¥ë¤ò¤´Í÷¤¯¤À¤µ¤¤¡£mdnconv ¤È runmdn ¤Ë¤Ä
+¤¤¤Æ¤Ï¡¢mDNkit ¤Î¥ê¥¾¥ë¥ÐÀßÄê¥Õ¥¡¥¤¥ë mdnres.conf ¤Î¥Þ¥Ë¥å¥¢¥ë¤â»²¾È¤·
+¤Æ¤¯¤À¤µ¤¤¡£
+
+ % man dnsproxy
+ % man mdnconv
+ % man runmdn
+ % man mdnres.conf
+
+
+* ¥Ñ¥Ã¥Á¤ÎÅö¤ÆÊý
+
+¤³¤ÎÇÛÉÛ¥­¥Ã¥È¤Ë¤Ï¡¢bind-8.2.2-P7¡¢bind-8.2.3-T6B¡¢bind-9.0.0¡¢¤ª¤è¤Ó
+squid-2.3-STABLE3 ¤ËÂФ¹¤ë¥Ñ¥Ã¥Á¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£¥Ñ¥Ã¥Á¤ÎÅö¤ÆÊý¤Ï¡¢¥Ñ¥Ã
+¥Á¥Õ¥¡¥¤¥ë¤ÎÀèƬ¤Ë½ñ¤«¤ì¤Æ¤¤¤Þ¤¹¤Î¤Ç¤½¤Á¤é¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
+
+Solaris ¤Ç¤Ï¡¢¥·¥¹¥Æ¥àÉÕ°¤Î patch ¥³¥Þ¥ó¥É¤¬Àµ¾ï¤ËÆ°ºî¤·¤Ê¤¤¤³¤È¤¬¤¢
+¤ê¤Þ¤¹¡£¤½¤Î¤è¤¦¤Ê¾ì¹ç¤Ë¤Ï¡¢GNU ¥Ð¡¼¥¸¥ç¥ó¤Î patch
+(http://www.gnu.org/software/patch/) ¤ò¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¡¢¤³¤ì¤ò»ÈÍѤ·
+¤Æ¤¯¤À¤µ¤¤¡£
+
+
+* ËÜ¥­¥Ã¥È¤Ë´Ø¤¹¤ëºÇ¿·¾ðÊó¡¢Ì䤤¹ç¤ï¤»¤Ë¤Ä¤¤¤Æ
+
+ËÜ¥­¥Ã¥È¤Ë´Ø¤¹¤ëºÇ¿·¾ðÊó¤Ë¤Ä¤¤¤Æ¤Ï¡¢
+http://www.nic.ad.jp/jp/research/idn/ ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤
+
+ËÜ¥­¥Ã¥È¤Ë´Ø¤¹¤ë¥Ð¥°¥ì¥Ý¡¼¥È¤ª¤è¤Ó¥³¥á¥ó¥È¤Ï¡¢¤½¤ì¤¾¤ì
+mdnkit-bugs@nic.ad.jp ¤ª¤è¤Ó idn-cmt@nic.ad.jp ¤Ø¤ª´ê¤¤¤·¤Þ¤¹¡£
+
+
+; $Id: README.ja,v 1.1 2000/12/07 00:52:17 tale Exp $
diff --git a/contrib/idn/mdnkit/acconfig.h b/contrib/idn/mdnkit/acconfig.h
new file mode 100644
index 00000000..5a91ce55
--- /dev/null
+++ b/contrib/idn/mdnkit/acconfig.h
@@ -0,0 +1,77 @@
+/* $Id: acconfig.h,v 1.1 2000/12/07 00:52:17 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+@TOP@
+
+/* Define if your iconv() does not accept "UTF-8" as the codeset name for utf-8. */
+#undef MDN_UTF8_ENCODING_NAME
+
+/* Define if you want ZLD feature compiled in. */
+#undef MDN_SUPPORT_ZLD
+
+/* Define if the prefix of RACE encoding differs from 'bq--'. */
+#undef MDN_RACE_PREFIX
+
+/* Define if the suffix of BRACE encoding differs from '-8q9'. */
+#undef MDN_BRACE_SUFFIX
+
+/* Define if the prefix of LACE encoding differs from 'bq--'. */
+#undef MDN_LACE_PREFIX
+
+/* Define as an appropriate type (ex. int) if your system doesn't have. */
+#undef BOOL
diff --git a/contrib/idn/mdnkit/aclocal.m4 b/contrib/idn/mdnkit/aclocal.m4
new file mode 100644
index 00000000..c41d84aa
--- /dev/null
+++ b/contrib/idn/mdnkit/aclocal.m4
@@ -0,0 +1,434 @@
+## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
+## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc.
+## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+##
+## As a special exception to the GNU General Public License, if you
+## distribute this file as part of a program that contains a
+## configuration script generated by Autoconf, you may include it under
+## the same distribution terms that you use for the rest of that program.
+
+# serial 40 AC_PROG_LIBTOOL
+AC_DEFUN(AC_PROG_LIBTOOL,
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+
+# Save cache, so that ltconfig can load it
+AC_CACHE_SAVE
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
+DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+|| AC_MSG_ERROR([libtool configure failed])
+
+# Reload cache, that may have been modified by ltconfig
+AC_CACHE_LOAD
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+AC_DEFUN(AC_LIBTOOL_SETUP,
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_RANLIB])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+dnl
+
+case "$target" in
+NONE) lt_target="$host" ;;
+*) lt_target="$target" ;;
+esac
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
+[libtool_flags="$libtool_flags --enable-dlopen"])
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[libtool_flags="$libtool_flags --enable-win32-dll"])
+AC_ARG_ENABLE(libtool-lock,
+ [ --disable-libtool-lock avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case "$lt_target" in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+])
+esac
+])
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
+
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_ENABLE_SHARED[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_SHARED, [dnl
+define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)])
+
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_ENABLE_STATIC[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_STATIC, [dnl
+define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
+
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
+define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN(AC_PROG_LD,
+[AC_ARG_WITH(gnu-ld,
+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$ac_cv_prog_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by GCC])
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+changequote(,)dnl
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+changequote([,])dnl
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(ac_cv_path_LD,
+[if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ ac_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ ac_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$ac_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])
+
+AC_DEFUN(AC_PROG_LD_GNU,
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ ac_cv_prog_gnu_ld=yes
+else
+ ac_cv_prog_gnu_ld=no
+fi])
+])
+
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN(AC_PROG_NM,
+[AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(ac_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ ac_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -B"
+ break
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -p"
+ break
+ else
+ ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+fi])
+NM="$ac_cv_path_NM"
+AC_MSG_RESULT([$NM])
+])
+
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN(AC_CHECK_LIBM,
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case "$lt_target" in
+*-*-beos* | *-*-cygwin*)
+ # These system don't have libm
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, main, LIBM="-lm")
+ ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-convenience to the
+# configure arguments. Note that LIBLTDL and INCLTDL are not
+# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not
+# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed
+# with '${top_builddir}/' and INCLTDL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!). If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case "$enable_ltdl_convenience" in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+ INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-install to the configure
+# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
+# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed
+# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will
+# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
+# with '${top_srcdir}/' (note the single quotes!). If your package is
+# not flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, main,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+ INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ INCLTDL=
+ fi
+])
+
+dnl old names
+AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
+AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
+AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
+
+dnl This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])dnl
diff --git a/contrib/idn/mdnkit/config.guess b/contrib/idn/mdnkit/config.guess
new file mode 100755
index 00000000..0ce538bb
--- /dev/null
+++ b/contrib/idn/mdnkit/config.guess
@@ -0,0 +1,1183 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+# Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# Please send patches to <config-patches@gnu.org>.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# Use $HOST_CC if defined. $CC may point to a cross-compiler
+if test x"$CC_FOR_BUILD" = x; then
+ if test x"$HOST_CC" != x; then
+ CC_FOR_BUILD="$HOST_CC"
+ else
+ if test x"$CC" != x; then
+ CC_FOR_BUILD="$CC"
+ else
+ CC_FOR_BUILD=cc
+ fi
+ fi
+fi
+
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 8/24/94.)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # Netbsd (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ # Determine the machine/vendor (is the vendor relevant).
+ case "${UNAME_MACHINE}" in
+ amiga) machine=m68k-cbm ;;
+ arm32) machine=arm-unknown ;;
+ atari*) machine=m68k-atari ;;
+ sun3*) machine=m68k-sun ;;
+ mac68k) machine=m68k-apple ;;
+ macppc) machine=powerpc-apple ;;
+ hp3[0-9][05]) machine=m68k-hp ;;
+ ibmrt|romp-ibm) machine=romp-ibm ;;
+ *) machine=${UNAME_MACHINE}-unknown ;;
+ esac
+ # The Operating System including object format.
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ # The OS release
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit 0 ;;
+ alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ cat <<EOF >$dummy.s
+ .data
+\$Lformat:
+ .byte 37,100,45,37,120,10,0 # "%d-%x\n"
+
+ .text
+ .globl main
+ .align 4
+ .ent main
+main:
+ .frame \$30,16,\$26,0
+ ldgp \$29,0(\$27)
+ .prologue 1
+ .long 0x47e03d80 # implver \$0
+ lda \$2,-1
+ .long 0x47e20c21 # amask \$2,\$1
+ lda \$16,\$Lformat
+ mov \$0,\$17
+ not \$1,\$18
+ jsr \$26,printf
+ ldgp \$29,0(\$26)
+ mov 0,\$16
+ jsr \$26,exit
+ .end main
+EOF
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ case `./$dummy` in
+ 0-0)
+ UNAME_MACHINE="alpha"
+ ;;
+ 1-0)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 1-1)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 1-101)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 2-303)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ 2-307)
+ UNAME_MACHINE="alphaev67"
+ ;;
+ esac
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit 0 ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-cbm-sysv4
+ exit 0;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit 0 ;;
+ arc64:OpenBSD:*:*)
+ echo mips64el-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hkmips:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ SR2?01:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit 0 ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy \
+ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i?86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:4)
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=4.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[34678]??:HP-UX:*:*)
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+ rm -f $dummy.c $dummy
+ esac
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ *9??*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i?86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ hppa*:OpenBSD:*:*)
+ echo hppa-unknown-openbsd
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*X-MP:*:*:*)
+ echo xmp-cray-unicos
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3E:*:*:*)
+ echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY-2:*:*:*)
+ echo cray2-cray-unicos
+ exit 0 ;;
+ F300:UNIX_System_V:*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ F301:UNIX_System_V:*:*)
+ echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i386-pc-interix
+ exit 0 ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ *:Linux:*:*)
+
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ ld_help_string=`cd /; ld --help 2>&1`
+ ld_supported_emulations=`echo $ld_help_string \
+ | sed -ne '/supported emulations:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported emulations: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_emulations" in
+ *ia64)
+ echo "${UNAME_MACHINE}-unknown-linux"
+ exit 0
+ ;;
+ i?86linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit 0
+ ;;
+ elf_i?86)
+ echo "${UNAME_MACHINE}-pc-linux"
+ exit 0
+ ;;
+ i?86coff)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit 0
+ ;;
+ sparclinux)
+ echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
+ exit 0
+ ;;
+ armlinux)
+ echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
+ exit 0
+ ;;
+ elf32arm*)
+ echo "${UNAME_MACHINE}-unknown-linux-gnuoldld"
+ exit 0
+ ;;
+ armelf_linux*)
+ echo "${UNAME_MACHINE}-unknown-linux-gnu"
+ exit 0
+ ;;
+ m68klinux)
+ echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
+ exit 0
+ ;;
+ elf32ppc | elf32ppclinux)
+ # Determine Lib Version
+ cat >$dummy.c <<EOF
+#include <features.h>
+#if defined(__GLIBC__)
+extern char __libc_version[];
+extern char __libc_release[];
+#endif
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+#if defined(__GLIBC__)
+ printf("%s %s\n", __libc_version, __libc_release);
+#else
+ printf("unkown\n");
+#endif
+ return 0;
+}
+EOF
+ LIBC=""
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./$dummy | grep 1\.99 > /dev/null
+ if test "$?" = 0 ; then
+ LIBC="libc1"
+ fi
+ fi
+ rm -f $dummy.c $dummy
+ echo powerpc-unknown-linux-gnu${LIBC}
+ exit 0
+ ;;
+ esac
+
+ if test "${UNAME_MACHINE}" = "alpha" ; then
+ cat <<EOF >$dummy.s
+ .data
+ \$Lformat:
+ .byte 37,100,45,37,120,10,0 # "%d-%x\n"
+
+ .text
+ .globl main
+ .align 4
+ .ent main
+ main:
+ .frame \$30,16,\$26,0
+ ldgp \$29,0(\$27)
+ .prologue 1
+ .long 0x47e03d80 # implver \$0
+ lda \$2,-1
+ .long 0x47e20c21 # amask \$2,\$1
+ lda \$16,\$Lformat
+ mov \$0,\$17
+ not \$1,\$18
+ jsr \$26,printf
+ ldgp \$29,0(\$26)
+ mov 0,\$16
+ jsr \$26,exit
+ .end main
+EOF
+ LIBC=""
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ case `./$dummy` in
+ 0-0)
+ UNAME_MACHINE="alpha"
+ ;;
+ 1-0)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 1-1)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 1-101)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 2-303)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ 2-307)
+ UNAME_MACHINE="alphaev67"
+ ;;
+ esac
+
+ objdump --private-headers $dummy | \
+ grep ld.so.1 > /dev/null
+ if test "$?" = 0 ; then
+ LIBC="libc1"
+ fi
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
+ elif test "${UNAME_MACHINE}" = "mips" ; then
+ cat >$dummy.c <<EOF
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+#ifdef __MIPSEB__
+ printf ("%s-unknown-linux-gnu\n", argv[1]);
+#endif
+#ifdef __MIPSEL__
+ printf ("%sel-unknown-linux-gnu\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ elif test "${UNAME_MACHINE}" = "s390"; then
+ echo s390-ibm-linux && exit 0
+ else
+ # Either a pre-BFD a.out linker (linux-gnuoldld)
+ # or one that does not give us useful --help.
+ # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
+ # If ld does not provide *any* "supported emulations:"
+ # that means it is gnuoldld.
+ echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
+ test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+
+ case "${UNAME_MACHINE}" in
+ i?86)
+ VENDOR=pc;
+ ;;
+ *)
+ VENDOR=unknown;
+ ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ cat >$dummy.c <<EOF
+#include <features.h>
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+#ifdef __ELF__
+# ifdef __GLIBC__
+# if __GLIBC__ >= 2
+ printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+#else
+ printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ fi ;;
+# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
+# are messed up and put the nodename in both sysname and nodename.
+ i?86:DYNIX/ptx:4*:*)
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i?86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
+ i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit 0 ;;
+ i?86:*:5:7*)
+ # Fixed at (any) Pentium or better
+ UNAME_MACHINE=i586
+ if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
+ echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ i?86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ i?86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit 0 ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ news*:NEWS-OS:*:6*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit 0 ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit 0 ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Darwin:*:*)
+ echo `uname -p`-apple-darwin${UNAME_RELEASE}
+ exit 0 ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ if test "${UNAME_MACHINE}" = "x86pc"; then
+ UNAME_MACHINE=pc
+ fi
+ echo `uname -p`-${UNAME_MACHINE}-nto-qnx
+ exit 0 ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit 0 ;;
+ NSR-W:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit 0 ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit 0 ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+ printf ("vax-dec-bsd\n"); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
+rm -f $dummy.c $dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1
diff --git a/contrib/idn/mdnkit/config.sub b/contrib/idn/mdnkit/config.sub
new file mode 100755
index 00000000..c8e77851
--- /dev/null
+++ b/contrib/idn/mdnkit/config.sub
@@ -0,0 +1,1268 @@
+#! /bin/sh
+# Configuration validation subroutine script, version 1.1.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+# Free Software Foundation, Inc.
+#
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# Please send patches to <config-patches@gnu.org>.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+if [ x$1 = x ]
+then
+ echo Configuration name missing. 1>&2
+ echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
+ echo "or $0 ALIAS" 1>&2
+ echo where ALIAS is a recognized configuration type. 1>&2
+ exit 1
+fi
+
+# First pass through any local machine types.
+case $1 in
+ *local*)
+ echo $1
+ exit 0
+ ;;
+ *)
+ ;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
+ | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
+ | 580 | i960 | h8300 \
+ | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \
+ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
+ | hppa64 \
+ | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
+ | alphaev6[78] \
+ | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
+ | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
+ | mips64orion | mips64orionel | mipstx39 | mipstx39el \
+ | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
+ | mips64vr5000 | miprs64vr5000el | mcore \
+ | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
+ | thumb | d10v | fr30 | avr)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i[34567]86)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ # FIXME: clean up the formatting here.
+ vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
+ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
+ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
+ | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
+ | xmp-* | ymp-* \
+ | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \
+ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
+ | hppa2.0n-* | hppa64-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
+ | alphaev6[78]-* \
+ | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
+ | clipper-* | orion-* \
+ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+ | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
+ | mips64el-* | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
+ | mipstx39-* | mipstx39el-* | mcore-* \
+ | f301-* | armv*-* | s390-* | sv1-* | t3e-* \
+ | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
+ | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
+ | bs2000-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-cbm
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-cbm
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-cbm
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ cray2)
+ basic_machine=cray2-cray
+ os=-unicos
+ ;;
+ [ctj]90-cray)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i[34567]86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i[34567]86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i[34567]86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i[34567]86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ i386-go32 | go32)
+ basic_machine=i386-unknown
+ os=-go32
+ ;;
+ i386-mingw32 | mingw32)
+ basic_machine=i386-unknown
+ os=-mingw32
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mipsel*-linux*)
+ basic_machine=mipsel-unknown
+ os=-linux-gnu
+ ;;
+ mips*-linux*)
+ basic_machine=mips-unknown
+ os=-linux-gnu
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ mmix*)
+ basic_machine=mmix-knuth
+ os=-mmixware
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ msdos)
+ basic_machine=i386-unknown
+ os=-msdos
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | k5 | k6 | nexen)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexen-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=rs6000-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sparclite-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=t3e-cray
+ os=-unicos
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xmp)
+ basic_machine=xmp-cray
+ os=-unicos
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ mips)
+ if [ x$os = x-linux-gnu ]; then
+ basic_machine=mips-unknown
+ else
+ basic_machine=mips-mips
+ fi
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sparc | sparcv9)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ c4x*)
+ basic_machine=c4x-none
+ os=-coff
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i[34567]86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto*)
+ os=-nto-qnx
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -*MiNT)
+ os=-mint
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f301-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxsim* | -vxworks*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -*MiNT)
+ vendor=atari
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
diff --git a/contrib/idn/mdnkit/configure b/contrib/idn/mdnkit/configure
new file mode 100755
index 00000000..b3dbdccb
--- /dev/null
+++ b/contrib/idn/mdnkit/configure
@@ -0,0 +1,2411 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+ --enable-zld enable ZLD support. [default=no]"
+ac_help="$ac_help
+ --with-utf8=NAME codeset name for UTF-8 encoding [UTF-8]"
+ac_help="$ac_help
+ --with-race-prefix=PREFIX prefix for RACE encoding [bq--]"
+ac_help="$ac_help
+ --with-brace-suffix=PREFIX suffix for BRACE encoding [-8q9]"
+ac_help="$ac_help
+ --with-lace-prefix=PREFIX prefix for LACE encoding [bq--]"
+ac_help="$ac_help
+ --with-iconv=LIB special library for iconv []"
+ac_help="$ac_help
+ --with-iconv-sofile=PATH shared library file for libiconv []"
+ac_help="$ac_help
+ --enable-shared[=PKGS] build shared libraries [default=yes]"
+ac_help="$ac_help
+ --enable-static[=PKGS] build static libraries [default=yes]"
+ac_help="$ac_help
+ --enable-fast-install[=PKGS] optimize for fast installation [default=yes]"
+ac_help="$ac_help
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]"
+ac_help="$ac_help
+ --disable-libtool-lock avoid locking (might break parallel builds)"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # 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 << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=include/mdn/converter.h
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:576: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+
+zld=no
+# Check whether --enable-zld or --disable-zld was given.
+if test "${enable_zld+set}" = set; then
+ enableval="$enable_zld"
+ zld=$enableval
+fi
+
+case "$zld" in
+no)
+ ;;
+yes)
+ cat >> confdefs.h <<\EOF
+#define MDN_SUPPORT_ZLD 1
+EOF
+
+ ;;
+*)
+ { echo "configure: error: You must specify yes or no to --enable-zld option." 1>&2; exit 1; }
+ ;;
+esac
+
+utf8name=no
+# Check whether --with-utf8 or --without-utf8 was given.
+if test "${with_utf8+set}" = set; then
+ withval="$with_utf8"
+ utf8name=$withval
+fi
+
+case "$utf8name" in
+no)
+ ;;
+yes)
+ { echo "configure: error: You must specify NAME to --with-utf8 option." 1>&2; exit 1; }
+ ;;
+*)
+ cat >> confdefs.h <<EOF
+#define MDN_UTF8_ENCODING_NAME "$utf8name"
+EOF
+
+ ;;
+esac
+
+raceprefix=no
+# Check whether --with-race-prefix or --without-race-prefix was given.
+if test "${with_race_prefix+set}" = set; then
+ withval="$with_race_prefix"
+ raceprefix=$withval
+fi
+
+case "$raceprefix" in
+no)
+ ;;
+yes)
+ { echo "configure: error: You must specify PREFIX to --with-race-prefix option." 1>&2; exit 1; }
+ ;;
+*)
+ cat >> confdefs.h <<EOF
+#define MDN_RACE_PREFIX "$raceprefix"
+EOF
+
+ ;;
+esac
+
+bracesuffix=no
+# Check whether --with-brace-suffix or --without-brace-suffix was given.
+if test "${with_brace_suffix+set}" = set; then
+ withval="$with_brace_suffix"
+ bracesuffix=$withval
+fi
+
+case "$bracesuffix" in
+no)
+ ;;
+yes)
+ { echo "configure: error: You must specify SUFFIX to --with-brace-suffix option." 1>&2; exit 1; }
+ ;;
+*)
+ cat >> confdefs.h <<EOF
+#define MDN_BRACE_SUFFIX "$bracesuffix"
+EOF
+
+ ;;
+esac
+
+laceprefix=no
+# Check whether --with-lace-prefix or --without-lace-prefix was given.
+if test "${with_lace_prefix+set}" = set; then
+ withval="$with_lace_prefix"
+ laceprefix=$withval
+fi
+
+case "$laceprefix" in
+no)
+ ;;
+yes)
+ { echo "configure: error: You must specify PREFIX to --with-lace-prefix option." 1>&2; exit 1; }
+ ;;
+*)
+ cat >> confdefs.h <<EOF
+#define MDN_LACE_PREFIX "$laceprefix"
+EOF
+
+ ;;
+esac
+
+iconv=no
+echo $ac_n "checking for iconv in -liconv""... $ac_c" 1>&6
+echo "configure:704: checking for iconv in -liconv" >&5
+ac_lib_var=`echo iconv'_'iconv | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-liconv $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 712 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char iconv();
+
+int main() {
+iconv()
+; return 0; }
+EOF
+if { (eval echo configure:723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo iconv | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-liconv $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+# Check whether --with-iconv or --without-iconv was given.
+if test "${with_iconv+set}" = set; then
+ withval="$with_iconv"
+ iconv=$withval
+fi
+
+case "$iconv" in
+no)
+ ICONVLIB=
+ ;;
+yes)
+ echo "configure: warning: You must supply LIB to --with-iconv option.
+ -liconv is assumed." 1>&2
+ ICONVLIB=-liconv
+ ;;
+*)
+ ICONVLIB=$iconv
+ ;;
+esac
+
+
+# Check whether --with-iconv-sofile or --without-iconv-sofile was given.
+if test "${with_iconv_sofile+set}" = set; then
+ withval="$with_iconv_sofile"
+ iconv_file=$withval
+else
+ iconv_file=guess
+fi
+
+ICONVSOFILE=
+case "$iconv_file" in
+no)
+ ICONVSOFILE=none
+ ;;
+yes)
+ { echo "configure: error: You must supply PATH to --with-iconv-sofile option." 1>&2; exit 1; }
+ ;;
+guess)
+ if test "$ICONVLIB" = ""; then
+ ICONVSOFILE=none
+ else
+ echo $ac_n "checking pathname of iconv shared library""... $ac_c" 1>&6
+echo "configure:792: checking pathname of iconv shared library" >&5
+ ic_libdir=
+ ic_libname=
+ case "$host" in
+ *-hpux*)
+ SO=sl
+ ;;
+ *)
+ SO=so
+ ;;
+ esac
+ for arg in $ICONVLIB; do
+ case "$arg" in
+ -L*) ic_libdir="$ic_libdir `echo $arg | sed s/-L//`" ;;
+ -l*) ic_libname=`echo $arg | sed s/-l//` ;;
+ /*.$SO*) ICONVSOFILE=$arg ;;
+ esac
+ done
+ if test "$ICONVSOFILE" = ""; then
+ if test "$ic_libname" = ""; then
+ echo "$ac_t""unknown" 1>&6
+ echo "configure: warning: use --with-iconv-sofile for specifying iconv shared library file" 1>&2
+ ICONVSOFILE=none
+ else
+ if test "$ic_libdir" = ""; then
+ # Standard (and semi-standard) library directories
+ ic_libdir="/lib /usr/lib /usr/local/lib"
+ fi
+ for dir in $ic_libdir; do
+ ICONVSOFILE=`ls -r $dir/lib$ic_libname.$SO* 2>/dev/null | head -1`
+ if test "$ICONVSOFILE" != ""; then
+ break
+ fi
+ done
+ if test "$ICONVSOFILE" != ""; then
+ echo "$ac_t""$ICONVSOFILE" 1>&6
+ else
+ echo "$ac_t""unknown" 1>&6
+ echo "configure: warning: use --with-iconv-sofile for specifying iconv shared library file" 1>&2
+ ICONVSOFILE=none
+ fi
+ fi
+ fi
+ fi
+ ;;
+*)
+ ICONVSOFILE=$iconv_file
+ ;;
+esac
+
+
+PRELOAD_VAR="LD_PRELOAD"
+PRELOAD_SEP=":"
+PRELOAD_LAST=""
+case "$host" in
+*-solaris*)
+ PRELOAD_SEP=" "
+ ;;
+*-osf*)
+ PRELOAD_VAR="_RLD_LIST"
+ PRELOAD_LAST=":DEFAULT"
+ ;;
+esac
+
+
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:862: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:892: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:943: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:975: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 986 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1017: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1022: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1050: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:1093: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_shared=yes
+fi
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval="$enable_static"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_static=yes
+fi
+
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_fast_install=yes
+fi
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:1215: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1235: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval="$with_gnu_ld"
+ test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$ac_cv_prog_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
+echo "configure:1274: checking for ld used by GCC" >&5
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
+echo "configure:1298: checking for GNU ld" >&5
+else
+ echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+echo "configure:1301: checking for non-GNU ld" >&5
+fi
+if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ ac_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ ac_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$ac_cv_path_LD"
+if test -n "$LD"; then
+ echo "$ac_t""$LD" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
+echo "configure:1336: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ ac_cv_prog_gnu_ld=yes
+else
+ ac_cv_prog_gnu_ld=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6
+
+
+echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
+echo "configure:1352: checking for BSD-compatible nm" >&5
+if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ ac_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -B"
+ break
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -p"
+ break
+ else
+ ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+fi
+fi
+
+NM="$ac_cv_path_NM"
+echo "$ac_t""$NM" 1>&6
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:1388: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ rm -f conftestdata
+if ln -s X conftestdata 2>/dev/null
+then
+ rm -f conftestdata
+ ac_cv_prog_LN_S="ln -s"
+else
+ ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+case "$target" in
+NONE) lt_target="$host" ;;
+*) lt_target="$target" ;;
+esac
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval="$enable_libtool_lock"
+ :
+fi
+
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case "$lt_target" in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 1437 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:1438: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+echo "configure:1459: checking whether the C compiler needs -belf" >&5
+if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1464 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+
+esac
+
+
+# Save cache, so that ltconfig can load it
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
+DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
+
+# Reload cache, that may have been modified by ltconfig
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1574: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1589 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1595: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1606 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1612: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1623 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1629: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+for ac_hdr in unistd.h locale.h langinfo.h sys/select.h iconv.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1657: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1662 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1667: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
+echo "configure:1695: checking for uid_t in sys/types.h" >&5
+if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1700 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "uid_t" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_uid_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_uid_t=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_type_uid_t" 1>&6
+if test $ac_cv_type_uid_t = no; then
+ cat >> confdefs.h <<\EOF
+#define uid_t int
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define gid_t int
+EOF
+
+fi
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1729: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1734 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1742: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1759 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1777 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1798 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:1809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+echo $ac_n "checking for BOOL""... $ac_c" 1>&6
+echo "configure:1833: checking for BOOL" >&5
+if eval "test \"`echo '$''{'ac_cv_type_BOOL'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1838 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])BOOL[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_BOOL=yes
+else
+ rm -rf conftest*
+ ac_cv_type_BOOL=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_BOOL" 1>&6
+if test $ac_cv_type_BOOL = no; then
+ cat >> confdefs.h <<\EOF
+#define BOOL int
+EOF
+
+fi
+
+
+echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
+echo "configure:1867: checking for socket in -lsocket" >&5
+ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lsocket $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1875 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char socket();
+
+int main() {
+socket()
+; return 0; }
+EOF
+if { (eval echo configure:1886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lsocket $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for inet_addr in -lnsl""... $ac_c" 1>&6
+echo "configure:1914: checking for inet_addr in -lnsl" >&5
+ac_lib_var=`echo nsl'_'inet_addr | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lnsl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1922 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char inet_addr();
+
+int main() {
+inet_addr()
+; return 0; }
+EOF
+if { (eval echo configure:1933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lnsl $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+for ac_func in vsnprintf setvbuf setlocale nl_langinfo memmove bcopy
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1964: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1969 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile
+ include/Makefile
+ include/mdn/Makefile
+ lib/Makefile
+ dnsproxy/Makefile
+ man/Makefile
+ tools/Makefile
+ tools/mdnconv/Makefile
+ tools/runmdn/Makefile
+ tools/runmdn/runmdn
+ include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@ICONVLIB@%$ICONVLIB%g
+s%@ICONVSOFILE@%$ICONVSOFILE%g
+s%@PRELOAD_VAR@%$PRELOAD_VAR%g
+s%@PRELOAD_SEP@%$PRELOAD_SEP%g
+s%@PRELOAD_LAST@%$PRELOAD_LAST%g
+s%@CC@%$CC%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@RANLIB@%$RANLIB%g
+s%@LN_S@%$LN_S%g
+s%@LIBTOOL@%$LIBTOOL%g
+s%@CPP@%$CPP%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile
+ include/Makefile
+ include/mdn/Makefile
+ lib/Makefile
+ dnsproxy/Makefile
+ man/Makefile
+ tools/Makefile
+ tools/mdnconv/Makefile
+ tools/runmdn/Makefile
+ tools/runmdn/runmdn
+"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS="include/config.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/contrib/idn/mdnkit/configure.in b/contrib/idn/mdnkit/configure.in
new file mode 100644
index 00000000..45a4a85d
--- /dev/null
+++ b/contrib/idn/mdnkit/configure.in
@@ -0,0 +1,274 @@
+dnl $Id: configure.in,v 1.1 2000/12/07 00:52:17 tale Exp $
+dnl Process this file with autoconf to produce a configure script.
+dnl
+dnl Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+dnl
+dnl By using this file, you agree to the terms and conditions set forth bellow.
+dnl
+dnl LICENSE TERMS AND CONDITIONS
+dnl
+dnl The following License Terms and Conditions apply, unless a different
+dnl license is obtained from Japan Network Information Center ("JPNIC"),
+dnl a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+dnl Tokyo, Japan.
+dnl
+dnl 1. Use, Modification and Redistribution (including distribution of any
+dnl modified or derived work) in source and/or binary forms is permitted
+dnl under this License Terms and Conditions.
+dnl
+dnl 2. Redistribution of source code must retain the copyright notices as they
+dnl appear in each source code file, this License Terms and Conditions.
+dnl
+dnl 3. Redistribution in binary form must reproduce the Copyright Notice,
+dnl this License Terms and Conditions, in the documentation and/or other
+dnl materials provided with the distribution. For the purposes of binary
+dnl distribution the "Copyright Notice" refers to the following language:
+dnl "Copyright (c) Japan Network Information Center. All rights reserved."
+dnl
+dnl 4. Neither the name of JPNIC may be used to endorse or promote products
+dnl derived from this Software without specific prior written approval of
+dnl JPNIC.
+dnl
+dnl 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
+dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+dnl SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+dnl BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+dnl WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+dnl ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+dnl
+dnl 6. Indemnification by Licensee
+dnl Any person or entities using and/or redistributing this Software under
+dnl this License Terms and Conditions shall defend indemnify and hold
+dnl harmless JPNIC from and against any and all judgements damages,
+dnl expenses, settlement liabilities, cost and other liabilities of any
+dnl kind as a result of use and redistribution of this Software or any
+dnl claim, suite, action, litigation or proceeding by any third party
+dnl arising out of or relates to this License Terms and Conditions.
+dnl
+dnl 7. Governing Law, Jurisdiction and Venue
+dnl This License Terms and Conditions shall be governed by and and
+dnl construed in accordance with the law of Japan. Any person or entities
+dnl using and/or redistributing this Software under this License Terms and
+dnl Conditions hereby agrees and consent to the personal and exclusive
+dnl jurisdiction and venue of Tokyo District Court of Japan.
+
+AC_INIT(include/mdn/converter.h)
+
+AC_CANONICAL_HOST
+
+zld=no
+AC_ARG_ENABLE(zld,
+[ --enable-zld enable ZLD support. [default=no]],
+ zld=$enableval)
+case "$zld" in
+no)
+ ;;
+yes)
+ AC_DEFINE(MDN_SUPPORT_ZLD)
+ ;;
+*)
+ AC_MSG_ERROR([You must specify yes or no to --enable-zld option.])
+ ;;
+esac
+
+utf8name=no
+AC_ARG_WITH(utf8,
+[ --with-utf8=NAME codeset name for UTF-8 encoding [UTF-8]],
+ utf8name=$withval)
+case "$utf8name" in
+no)
+ ;;
+yes)
+ AC_MSG_ERROR([You must specify NAME to --with-utf8 option.])
+ ;;
+*)
+ AC_DEFINE_UNQUOTED(MDN_UTF8_ENCODING_NAME, "$utf8name")
+ ;;
+esac
+
+raceprefix=no
+AC_ARG_WITH(race-prefix,
+[ --with-race-prefix=PREFIX prefix for RACE encoding [bq--]],
+ raceprefix=$withval)
+case "$raceprefix" in
+no)
+ ;;
+yes)
+ AC_MSG_ERROR([You must specify PREFIX to --with-race-prefix option.])
+ ;;
+*)
+ AC_DEFINE_UNQUOTED(MDN_RACE_PREFIX, "$raceprefix")
+ ;;
+esac
+
+bracesuffix=no
+AC_ARG_WITH(brace-suffix,
+[ --with-brace-suffix=PREFIX suffix for BRACE encoding [-8q9]],
+ bracesuffix=$withval)
+case "$bracesuffix" in
+no)
+ ;;
+yes)
+ AC_MSG_ERROR([You must specify SUFFIX to --with-brace-suffix option.])
+ ;;
+*)
+ AC_DEFINE_UNQUOTED(MDN_BRACE_SUFFIX, "$bracesuffix")
+ ;;
+esac
+
+laceprefix=no
+AC_ARG_WITH(lace-prefix,
+[ --with-lace-prefix=PREFIX prefix for LACE encoding [bq--]],
+ laceprefix=$withval)
+case "$laceprefix" in
+no)
+ ;;
+yes)
+ AC_MSG_ERROR([You must specify PREFIX to --with-lace-prefix option.])
+ ;;
+*)
+ AC_DEFINE_UNQUOTED(MDN_LACE_PREFIX, "$laceprefix")
+ ;;
+esac
+
+iconv=no
+AC_ARG_WITH(iconv,
+[ --with-iconv=LIB special library for iconv []],
+ iconv=$withval)
+case "$iconv" in
+no)
+ ICONVLIB=
+ ;;
+yes)
+ AC_MSG_WARN([You must supply LIB to --with-iconv option.
+ -liconv is assumed.])
+ ICONVLIB=-liconv
+ ;;
+*)
+ ICONVLIB=$iconv
+ ;;
+esac
+AC_SUBST(ICONVLIB)
+
+AC_ARG_WITH(iconv-sofile,
+[ --with-iconv-sofile=PATH shared library file for libiconv []],
+ iconv_file=$withval, iconv_file=guess)
+ICONVSOFILE=
+case "$iconv_file" in
+no)
+ ICONVSOFILE=none
+ ;;
+yes)
+ AC_MSG_ERROR([You must supply PATH to --with-iconv-sofile option.])
+ ;;
+guess)
+ if test "$ICONVLIB" = ""; then
+ ICONVSOFILE=none
+ else
+ AC_MSG_CHECKING(pathname of iconv shared library)
+ ic_libdir=
+ ic_libname=
+ case "$host" in
+ *-hpux*)
+ SO=sl
+ ;;
+ *)
+ SO=so
+ ;;
+ esac
+ for arg in $ICONVLIB; do
+ case "$arg" in
+ -L*) ic_libdir="$ic_libdir `echo $arg | sed s/-L//`" ;;
+ -l*) ic_libname=`echo $arg | sed s/-l//` ;;
+ /*.$SO*) ICONVSOFILE=$arg ;;
+ esac
+ done
+ if test "$ICONVSOFILE" = ""; then
+ if test "$ic_libname" = ""; then
+ AC_MSG_RESULT(unknown)
+ AC_MSG_WARN([use --with-iconv-sofile for specifying iconv shared library file])
+ ICONVSOFILE=none
+ else
+ if test "$ic_libdir" = ""; then
+ # Standard (and semi-standard) library directories
+ ic_libdir="/lib /usr/lib /usr/local/lib"
+ fi
+ for dir in $ic_libdir; do
+ ICONVSOFILE=`ls -r $dir/lib$ic_libname.$SO* 2>/dev/null | head -1`
+ if test "$ICONVSOFILE" != ""; then
+ break
+ fi
+ done
+ if test "$ICONVSOFILE" != ""; then
+ AC_MSG_RESULT($ICONVSOFILE)
+ else
+ AC_MSG_RESULT(unknown)
+ AC_MSG_WARN([use --with-iconv-sofile for specifying iconv shared library file])
+ ICONVSOFILE=none
+ fi
+ fi
+ fi
+ fi
+ ;;
+*)
+ ICONVSOFILE=$iconv_file
+ ;;
+esac
+AC_SUBST(ICONVSOFILE)
+
+dnl Figure out preload stuff.
+PRELOAD_VAR="LD_PRELOAD"
+PRELOAD_SEP=":"
+PRELOAD_LAST=""
+case "$host" in
+*-solaris*)
+ PRELOAD_SEP=" "
+ ;;
+*-osf*)
+ PRELOAD_VAR="_RLD_LIST"
+ PRELOAD_LAST=":DEFAULT"
+ ;;
+esac
+AC_SUBST(PRELOAD_VAR)
+AC_SUBST(PRELOAD_SEP)
+AC_SUBST(PRELOAD_LAST)
+
+dnl Checks for standard tools.
+AC_PROG_CC
+AC_PROG_INSTALL
+AM_PROG_LIBTOOL
+
+dnl Checks for header files.
+AC_CHECK_HEADERS(unistd.h locale.h langinfo.h sys/select.h iconv.h)
+
+dnl Checks for data types.
+AC_TYPE_UID_T
+dnl for dnsproxy.
+AC_CHECK_TYPE(BOOL, int)
+
+dnl Checks for libraries.
+AC_CHECK_LIB(socket, socket)
+AC_CHECK_LIB(nsl, inet_addr)
+
+dnl Checks for library functions.
+AC_CHECK_FUNCS(vsnprintf setvbuf setlocale nl_langinfo memmove bcopy)
+
+dnl Output.
+AC_CONFIG_HEADER(include/config.h)
+AC_OUTPUT(
+ Makefile
+ include/Makefile
+ include/mdn/Makefile
+ lib/Makefile
+ dnsproxy/Makefile
+ man/Makefile
+ tools/Makefile
+ tools/mdnconv/Makefile
+ tools/runmdn/Makefile
+ tools/runmdn/runmdn
+)
diff --git a/contrib/idn/mdnkit/dnsproxy/Makefile.in b/contrib/idn/mdnkit/dnsproxy/Makefile.in
new file mode 100644
index 00000000..2bcf7c43
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/Makefile.in
@@ -0,0 +1,158 @@
+# $Id: Makefile.in,v 1.1 2000/12/07 00:52:18 tale Exp $
+# Makefile for mDNS Proxy Server
+#
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+# Tokyo, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) Japan Network Information Center. All rights reserved."
+#
+# 4. Neither the name of JPNIC may be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "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 JPNIC 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 DAMAGES.
+#
+# 6. Indemnification by Licensee
+# Any person or entities using and/or redistributing this Software under
+# this License Terms and Conditions shall defend indemnify and hold
+# harmless JPNIC from and against any and all judgements damages,
+# expenses, settlement liabilities, cost and other liabilities of any
+# kind as a result of use and redistribution of this Software or any
+# claim, suite, action, litigation or proceeding by any third party
+# arising out of or relates to this License Terms and Conditions.
+#
+# 7. Governing Law, Jurisdiction and Venue
+# This License Terms and Conditions shall be governed by and and
+# construed in accordance with the law of Japan. Any person or entities
+# using and/or redistributing this Software under this License Terms and
+# Conditions hereby agrees and consent to the personal and exclusive
+# jurisdiction and venue of Tokyo District Court of Japan.
+
+top_builddir = ..
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+SBINDIR = @sbindir@
+ETCDIR = @sysconfdir@
+CONFIG_PATH = $(ETCDIR)
+MANDIR = @mandir@
+
+CC = @CC@
+PURIFY = purify
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+SHELL = @SHELL@
+LIBTOOL = @LIBTOOL@
+
+OPTS =
+INCS = -I$(srcdir)/../include -I../include
+DEFS = -DUNIX -DCONFIG_PATH="\"$(CONFIG_PATH)/\""
+CFLAGS = $(OPTS) $(INCS) $(DEFS) @CFLAGS@
+LDFLAGS = $(OPTS) @LDFLAGS@
+
+LIBS = ../lib/libmdn.la
+SYSLIBS = @LIBS@ @ICONVLIB@
+
+#
+# Files to build mDNS Proxy
+#
+
+SRCS = unxmain.c server.c message.c logging.c proxycnf.c translate.c
+OBJS = unxmain.o server.o message.o logging.o proxycnf.o translate.o
+
+#
+# Target to build
+#
+
+TARGETS = dnsproxy dnsproxy.8
+
+all : $(TARGETS)
+
+dnsproxy : $(OBJS) $(LIBS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
+ $(OBJS) $(LIBS) $(SYSLIBS)
+
+dnsproxy.purify : $(OBJS) $(LIBS)
+ $(LIBTOOL) --mode=link $(PURIFY) $(CC) $(LDFLAGS) -o $@ \
+ $(OBJS) $(LIBS) $(SYSLIBS)
+
+#
+# Installation
+#
+
+install: install-program install-config install-man
+
+install-program: dnsproxy
+ [ -d $(SBINDIR) ] || mkdir $(SBINDIR)
+ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) dnsproxy $(SBINDIR)
+
+# Do not overwrite existing configuration file.
+install-config:
+ [ -d $(ETCDIR) ] || mkdir $(ETCDIR)
+ @if [ -f $(ETCDIR)/dnsproxy.conf ]; then \
+ echo '** dnsproxy.conf already exists in the install directory.'; \
+ echo '** install as dnsproxy.conf.sample.'; \
+ $(INSTALL_DATA) $(srcdir)/dnsproxy.conf.sample $(ETCDIR)/; \
+ else \
+ echo installing sample configuration file.; \
+ $(INSTALL_DATA) $(srcdir)/dnsproxy.conf.sample \
+ $(ETCDIR)/dnsproxy.conf; fi
+
+install-man: dnsproxy.8
+ [ -d $(MANDIR) ] || mkdir $(MANDIR)
+ [ -d $(MANDIR)/man8 ] || mkdir $(MANDIR)/man8
+ $(INSTALL_DATA) dnsproxy.8 $(MANDIR)/man8
+
+dnsproxy.8: dnsproxy.8.in
+ sed 's%@ETCDIR@%$(ETCDIR)%' < $(srcdir)/dnsproxy.8.in > $@
+
+clean:
+ rm -f $(TARGETS) *.o core *.core *~
+
+#
+# Dependecnies
+#
+
+unxmain.o : unxmain.c dnsproxy.h
+
+server.o : server.c dnsproxy.h
+
+message.o : message.c dnsproxy.h
+
+logging.o : logging.c dnsproxy.h
+
+proxycnf.o : proxycnf.c dnsproxy.h proxycnf.h
diff --git a/contrib/idn/mdnkit/dnsproxy/dnsproxy.8.in b/contrib/idn/mdnkit/dnsproxy/dnsproxy.8.in
new file mode 100644
index 00000000..e3005e71
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/dnsproxy.8.in
@@ -0,0 +1,282 @@
+.\" $Id: dnsproxy.8.in,v 1.1 2000/12/07 00:52:18 tale Exp $
+.\"
+.\" Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+.\"
+.\" By using this file, you agree to the terms and conditions set forth bellow.
+.\"
+.\" LICENSE TERMS AND CONDITIONS
+.\"
+.\" The following License Terms and Conditions apply, unless a different
+.\" license is obtained from Japan Network Information Center ("JPNIC"),
+.\" a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+.\" Tokyo, Japan.
+.\"
+.\" 1. Use, Modification and Redistribution (including distribution of any
+.\" modified or derived work) in source and/or binary forms is permitted
+.\" under this License Terms and Conditions.
+.\"
+.\" 2. Redistribution of source code must retain the copyright notices as they
+.\" appear in each source code file, this License Terms and Conditions.
+.\"
+.\" 3. Redistribution in binary form must reproduce the Copyright Notice,
+.\" this License Terms and Conditions, in the documentation and/or other
+.\" materials provided with the distribution. For the purposes of binary
+.\" distribution the "Copyright Notice" refers to the following language:
+.\" "Copyright (c) Japan Network Information Center. All rights reserved."
+.\"
+.\" 4. Neither the name of JPNIC may be used to endorse or promote products
+.\" derived from this Software without specific prior written approval of
+.\" JPNIC.
+.\"
+.\" 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+.\" "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 JPNIC 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 DAMAGES.
+.\"
+.\" 6. Indemnification by Licensee
+.\" Any person or entities using and/or redistributing this Software under
+.\" this License Terms and Conditions shall defend indemnify and hold
+.\" harmless JPNIC from and against any and all judgements damages,
+.\" expenses, settlement liabilities, cost and other liabilities of any
+.\" kind as a result of use and redistribution of this Software or any
+.\" claim, suite, action, litigation or proceeding by any third party
+.\" arising out of or relates to this License Terms and Conditions.
+.\"
+.\" 7. Governing Law, Jurisdiction and Venue
+.\" This License Terms and Conditions shall be governed by and and
+.\" construed in accordance with the law of Japan. Any person or entities
+.\" using and/or redistributing this Software under this License Terms and
+.\" Conditions hereby agrees and consent to the personal and exclusive
+.\" jurisdiction and venue of Tokyo District Court of Japan.
+.TH DNSPROXY 8
+.SH NAME
+dnsproxy \- DNS proxy server for multi-lingual DNS
+
+.SH SYNOPSIS
+.B dnsproxy
+[ \-daemon ] [ \-config <config\-file> ] [ \-logfile <log\-file> ]
+
+.SH DESCRIPTION
+.B dnsproxy
+resides between application (resolver) and DNS server.
+.PP
+It accepts DNS requests from application (resolver) and converting
+domain names in those requests into DNS server's acceptable encoding,
+and forward those converted requests. It also accepts responses from
+DNS server and converting domain names in those resopnses into
+application's acceptable encoding and forward those responses to
+applications.
+
+.SH OPTIONS
+.TP
+.B \-daemon
+Run dnsproxy as daemon. Otherwise, dnsproxy will run as normal
+console program.
+.TP
+.B \-config <config\-file>
+Specifies configuration file (see later). If not specified,
+dnsproxy uses default configuration file.
+See
+.B FILES
+section for default configuration file.
+.TP
+.B \-logfile <log\-file>
+Specifies logging file. If not specified.
+dnsproxy uses default logging file.
+See
+.B FILES
+section for default configuration file.
+
+.SH CONFIGURATION
+Configuration file is simple text file which defines several
+configuration data.
+.IP "listen <address>"
+.RS
+Defines listening port (both TCP and UDP). <address> is one of
+.RS
+.PP
+<IP address>:<port number>
+.br
+:<port number>
+.br
+<IP address>
+.PP
+.RE
+If omitted, dnsproxy uses default value shown below.
+.RS
+.PP
+IP Address INADDR_ANY (0.0.0.0)
+.br
+port number 53
+.PP
+.RE
+.RE
+.IP "forward <address> [ bind4compat ]"
+.RS
+Defines forwarding server's address. Format is same as 'listen'.
+.PP
+example:
+.RS
+forward 10.1.2.3
+.RE
+.PP
+If "bind4compat" was given, dnsproxy uses above listen port
+as forwading UDP's source address. If not given, dnsproxy uses
+port > 1024 as forwading UDP's source.
+.RE
+.IP "log-file <path>"
+.RS
+Defines log file name. It may be overridden with command line
+option '-logfile <path>'. If no log file given, dnsproxy writes
+log data into "/tmp/dnsproxy.log".
+Sending SIGHUP causes dnsproxy to close the log file and then reopen it.
+.RE
+.IP "client-translation <ZLD> <Encoding>"
+.RS
+Defines client side character encoding scheme. Some clients
+locally encode domain name and add <ZLD> (Zero Level Domain) to
+it. In those cases, use <ZLD> and specify corresponding encoding.
+Usually, no mDNS'nized client passes domain name in client's
+local encoding. For those case, use '.' as ZLD. You may
+specify several 'client-translation's if client uses several
+encoding with different ZLD.
+.PP
+example:
+.RS
+.nf
+client-translation .i-dns.net UTF-5 # accept ZLDs
+client-translation . Shift_JIS
+.fi
+.RE
+.PP
+Acceptable ZLD will depend on client programs. Also acceptable
+encodings depend on client and the implementation of `iconv()' function,
+which dnsproxy uses internally for encoding conversion.
+Check the document on `iconv()' for acceptable encoding names.
+.RE
+.IP "alternate-encoding <Encoding>"
+.RS
+Defines client side alternative encoding scheme. The alternative
+encoding will be used when the conversion from server-side encoding
+to the default local encoding is failed due to the lack of mapping
+some certain characters to the local character set.
+.PP
+example:
+.RS
+alternate-encoding\ \ RACE
+.RE
+.PP
+The alternative encoding must be an ASCII compatible encoding, such as RACE.
+.RE
+.IP "normalize <Normalization Scheme> ..."
+.RS
+Defines domain name normalization schemes. You can specify
+several normalizations and they are applied left to right.
+.PP
+example:
+.RS
+normalize ja-fullwidth unicode-form-c
+.RE
+.PP
+Acceptable normalizations depend on 'libmdn' library. Check
+documents for 'libmdn' for more detail.
+.RE
+.IP "server-translation <Encoding>"
+.RS
+Defines server side character encoding scheme. Finally, domain
+names in DNS request from clients are converted to this encoding
+and forwarded to mDNS'nized DNS server.
+.PP
+example:
+.RS
+server-translation . UTF-8
+.RE
+.RE
+.IP "user-id <Name-or-ID>"
+.RS
+Defines a user ID in which dnsproxy operates.
+Dnsproxy tries to change the user ID of its process to the specified one,
+soon after initialization.
+.PP
+example:
+.RS
+.nf
+user-id\ \ nobody
+user-id\ \ 9999
+.fi
+.RE
+.PP
+It is strongly recommended to use this option for security reasons.
+.RE
+.IP "group-id <Name-or-ID>"
+.RS
+Defines a group ID in which dnsproxy operates.
+Dnsproxy tries to change the group ID of its process to the specified one,
+soon after initialization.
+.PP
+example:
+.RS
+.nf
+group-id\ \ nobody
+group-id\ \ 9999
+.fi
+.RE
+.RE
+.IP "root-directory <Directory>"
+.RS
+Defines the pathname of the root directory for the dnsproxy process.
+Dnsproxy performs chroot() to set the specified directory as the
+root directory for the process after initialization.
+.PP
+example:
+.RS
+.nf
+root-directory /var/dnsproxy
+.fi
+.RE
+.RE
+.IP "log-level <Level>"
+.RS
+Sets the log level. Available levels are ``none'' (no logging at all),
+``fatal'' (only logs fatal errors), ``warn'' (also logs warning messages)
+and ``trace'' (also includes trace level messages). The default level is
+``warn''. Please note that if you set the level to ``trace'', the size of
+the log file grows quickly.
+.RE
+
+.SH NOTES
+Some applications locally mangles domain names. In those cases,
+dnsproxy cannot works correctly.
+.PP
+For 'nslookup', it generally reject non-ascii domain names.
+You need 8bit through patched version of nslookup.
+.PP
+For UNIX resolver generally rejects domain names using non-ascii characters.
+You need 8bit through patched version of resolver.
+.PP
+For Windows, NS works well with dnsproxy. For IE, turn off "use UTF-8"
+setting, and generally works. But for IE, embedded URL's in page will
+converted by IE (to page's original encoding),
+and they conflict with dnsproxy.
+
+.SH FILES
+.PD 0
+.TP 30
+.B @ETCDIR@/dnsproxy.conf
+Default configuration file.
+.TP
+.B /tmp/dnsproxy.log
+Default logging file.
+.PD
+
+.SH SLL ALSO
+.BR named(8),
+.BR libmdn(3),
+.BR iconv(3)
diff --git a/contrib/idn/mdnkit/dnsproxy/dnsproxy.conf.sample b/contrib/idn/mdnkit/dnsproxy/dnsproxy.conf.sample
new file mode 100755
index 00000000..889dfdad
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/dnsproxy.conf.sample
@@ -0,0 +1,170 @@
+# $Id: dnsproxy.conf.sample,v 1.1 2000/12/07 00:52:18 tale Exp $
+#
+# Sample dnsproxy configuration file 'dnsproxy.conf'.
+#
+
+#
+# 'listen' entry specifies the dnsproxy's listening port.
+# The default is to use address 0.0.0.0 (INADDR_ANY) and port 53.
+#
+# syntax)
+# listen [<IP address>][:<port number>]
+#
+# ex) listen 127.0.0.1 -- only accept loopback connections
+# listen :1053 -- port number can be specified
+# listen 127.0.0.1:1053 -- combination of above
+#
+#listen 127.0.0.1
+
+#
+# 'forward' entry specifies the name server's port to which dnsproxy
+# forwards requests. This entry MUST be specified.
+#
+# Normally dnsproxy uses unspecified local port number for sending
+# queries to the server, but if 'bind4compat' option is specified,
+# dnsproxy uses the same port number as the listening port specified
+# by the 'listen' entry.
+#
+# syntax)
+# forward <IP address>[:<port number>] [bind4compat]
+#
+# ex) forward 10.0.0.2 -- forward 10.0.0.2 port 53
+# forward 10.0.0.2:1053 -- port number can be specified
+# forward 10.0.0.2 bind4compat -- use fixed port number.
+forward xxx.xxx.xxx.xxx
+
+#
+# 'client-tranlation' entries specify the codeset (encoding) of domain
+# names in the messages sent by the clients. If you configure mDNkit
+# with '--enable-zld' option, ZLD (zero level domain) can be specified.
+# In this case multiple entries are permitted as long as each entry has
+# different ZLD.
+#
+# If ZLD is not enabled (this is the default), ZLD part is ignored.
+#
+# syntax)
+# client-translation <ZLD> <codeset>
+#
+# ex) client-translation .xyz UTF-5
+# -- If the domain name ends with '.xyz', the client encoding
+# is assumed to be UTF-5. The ZLD part (.xyz) will be removed
+# from the domain name before converting to the server
+# encoding.
+# client-translation . Shift_JIS
+# -- '.' denotes absence of ZLD. If the given domain name
+# doesn't match any of other ZLDs, this entry matches
+# and codeset Shift_JIS is assumed.
+#
+#client-translation .i-dns.net UTF-5 # ZLD is .i-dns.net, codeset is UTF-5
+client-translation . Shift_JIS
+
+#
+# Normally domain names in the DNS reply messages from the (real) name
+# server are translated back to the client codeset determined by the
+# above 'client-translation' entries.
+#
+# 'alternate-encoding' entry specifies the alternative codeset which
+# is used instead of the client codeset when the translation to the
+# client codeset fails. This alternative codeset must be an ASCII-
+# compatible encoding, such as RACE.
+#
+# syntax)
+# alternate-encoding <codeset>
+#
+alternate-encoding RACE
+
+#
+#
+# 'normalize' entry specifies the normalization. You can specify any of
+# these normalization schemes:
+# ascii-lowercase -- ASCII uppercase letters to lowercase
+# ascii-uppercase -- ASCII lowercase letters to uppercase
+# unicode-lowercase -- Unicode uppercase letters to lowercase
+# unicode-uppercase -- Unicode lowercase letters to uppercase
+# unicode-form-c -- Unicode normalization form C
+# unicode-form-kc -- Unicode normalization form KC
+# ja-kana-fullwidth -- Japanese halfwidth kana letters to fullwidth
+# ja-alnum-halfwidth -- Fullwidth alphabets, digits and minus sign
+# to halfwidth
+# ja-compose-voiced-sound -- Combine Japanese fullwidth kana and the
+# following (semi) voiced sound mark
+# ja-minus-hack -- Japanse fullwidth minus sign to '-'
+#
+# If more than one schemes are specified, they are applied in turn.
+#
+# syntax)
+# normalize <normalization scheme>...
+#
+# ex) normalize unicode-form-kc unicode-lowercase
+# -- first 'unicode-form-kc', then 'unicode-lowercase'
+#
+normalize unicode-lowercase unicode-form-kc
+
+#
+# 'server-translation' entry specifies the codeset (encoding) of domain
+# names used by the (real) name servers. Also ZLD can be specified if
+# configured with '--enable-zld' option.
+#
+# syntax)
+# server-translation <ZLD> <encoding>
+#
+# ex) server-translation . UTF-8 -- use UTF-8 without ZLD
+#
+server-translation . RACE
+
+#
+# 'log-file' entry specifies the pathname of the log file. If it is
+# not specified, default log file (/tmp/dnsproxy.log) will be used.
+#
+# syntax)
+# log-file <pathname>
+#
+log-file /var/log/dnsproxy.log
+
+#
+# 'user-id' entry and 'group-id' entry specify the user/group ID
+# in which privilege dnsproxy operates. dnsproxy tries to switch
+# to the specified user/group after initialization process is finished.
+#
+# syntax)
+# user-id <name-or-number>
+# group-id <name-or-number>
+#
+# ex) user-id nobody -- specify by name,
+# group-id 1000 -- or by number
+#
+user-id nobody
+#group-id nobody
+
+#
+# 'root-directory' entry specifies the root directory of dnsproxy
+# process. dnsproxy performs chroot() to this directory after
+# initialization. Note that chroot() is allowed only for super-users.
+#
+# syntax)
+# root-directory <path>
+#
+root-directory /var/dnsproxy
+
+#
+# 'log-level' entry specifies the logging level for dnsproxy.
+# Valid levels are 'none' (no logging at all, not recommended),
+# 'fatal' (only logs fatal errors), 'warn' (also logs warning messages)
+# and 'trace' (also includes trace messages). The default level is 'warn'.
+# 'trace' level is useful for debugging dnsproxy itself, but it makes
+# the log file grow rather quickly.
+#
+# syntax)
+# log-level <level>
+#
+log-level warn
+
+#
+# 'mdn-log-level' entry specifies the logging level for libmdn, the
+# library responsible for most of the MDN processing for dnsproxy.
+# Unless you are debugging mDNkit, you should keep this entry unspecified.
+#
+# syntax)
+# mdn-log-level <number>
+#
+# mdn-log-level 1
diff --git a/contrib/idn/mdnkit/dnsproxy/dnsproxy.def b/contrib/idn/mdnkit/dnsproxy/dnsproxy.def
new file mode 100644
index 00000000..abdcb93e
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/dnsproxy.def
@@ -0,0 +1,3 @@
+NAME dnsproxy WINDOWCOMPAT NEWFILES
+EXETYPE OS2
+STACKSIZE 32768
diff --git a/contrib/idn/mdnkit/dnsproxy/dnsproxy.h b/contrib/idn/mdnkit/dnsproxy/dnsproxy.h
new file mode 100644
index 00000000..4c8cc4eb
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/dnsproxy.h
@@ -0,0 +1,192 @@
+/*
+ * dnsproxy.h - mDNS Proxy, Common Definitions
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+/* $Id: dnsproxy.h,v 1.1 2000/12/07 00:52:19 tale Exp $ */
+
+#ifndef DNSPROXY_H
+#define DNSPROXY_H 1
+
+#include <stdio.h>
+
+#ifdef WIN32
+#include <windows.h>
+#include <winsock.h>
+#else /* for normal systems */
+#include <sys/types.h>
+#include <sys/socket.h>
+#endif
+
+/*
+ * Redefine TRUE and FALSE.
+ */
+#undef TRUE
+#undef FALSE
+#define TRUE 1
+#define FALSE 0
+
+/*
+ * Macro for Error Logging
+ */
+
+enum {
+ LOGLEVEL_NONE = 0,
+ LOGLEVEL_FATAL = 1,
+ LOGLEVEL_WARN = 2,
+ LOGLEVEL_TRACE = 3
+};
+
+void log_configure(int ac, char *av[]) ;
+void log_terminate(void) ;
+void log_turnover_request(void) ;
+void log_turnover(void) ;
+void log_setlevel(int level) ;
+int log_strtolevel(char *s) ;
+void log_fatal_printf(char *fmt, ...) ;
+void log_warn_printf(char *fmt, ...) ;
+void log_trace_printf(char *fmt, ...) ;
+
+#define TRACE log_trace_printf
+#define WARN log_warn_printf
+#define FATAL log_fatal_printf
+
+/*
+ * Server's Control Entries
+ */
+
+BOOL server_init(int ac, char *av[]) ;
+void server_stop(void) ;
+void server_loop(void) ;
+void server_done(void) ;
+
+/*
+ * Server calls following callback when received message
+ */
+
+void notify_message(struct sockaddr *from, int proto,
+ u_char *msg, int len) ;
+
+void notify_timer(void) ;
+
+/*
+ * To send messages, call following entires in server module
+ */
+
+void server_forward(struct sockaddr *to, int proto,
+ u_char *msg, int len) ;
+void server_response(struct sockaddr *to, int proto,
+ u_char *msg, int len) ;
+
+/*
+ * load/dump/dispose configuration data
+ */
+
+BOOL config_load(int ac, char *av[]) ;
+void config_free(void) ;
+void config_dump(FILE *ofp) ;
+
+/*
+ * query configuration data
+ */
+
+BOOL config_query_value(char *key, int *count, char ***array) ;
+BOOL config_query_listen(struct sockaddr *addr) ;
+BOOL config_query_forward(struct sockaddr *addr) ;
+BOOL config_query_restrict(BOOL *restrict) ;
+
+/*
+ * Message (domain name) translation
+ */
+
+typedef struct translation_context {
+ struct sockaddr *client; /* address family/IP address/port */
+ int protocol; /* IPPROTO_TCP or IPPROTO_UDP */
+ unsigned int old_id; /* original message ID */
+ unsigned int new_id; /* new message ID */
+ char *zld; /* ZLD */
+ void *converter; /* encoding: actual type is mdn_converter_t */
+} translation_context_t;
+
+BOOL translate_initialize(void) ;
+int translate_request(translation_context_t *ctx,
+ const char *msg, size_t msglen,
+ char *translated, size_t bufsize, size_t *translatedlenp) ;
+int translate_reply(translation_context_t *ctx,
+ const char *msg, size_t msglen,
+ char *translated, size_t bufsize, size_t *translatedlenp) ;
+
+/*
+ * query configuration having multiple entries (with same key)
+ *
+ * ctx = config_query_open(key, ...) ;
+ * while (ctx != NULL) {
+ * ctx = config_query_more(ctx, ...) ;
+ * }
+ * config_query_close(ctx) ;
+ */
+
+typedef void *config_ctx_t ; /* opaque pointer to lookup context */
+
+config_ctx_t config_query_open(char *key, int *count, char ***array) ;
+config_ctx_t config_query_more(config_ctx_t ctx, int *count, char ***array) ;
+void config_query_close(config_ctx_t ctx) ;
+
+#endif /* DNSPROXY_H */
diff --git a/contrib/idn/mdnkit/dnsproxy/logging.c b/contrib/idn/mdnkit/dnsproxy/logging.c
new file mode 100644
index 00000000..db2fe1a5
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/logging.c
@@ -0,0 +1,294 @@
+/*
+ * logging.c - logging support
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef lint
+static char *rcsid = "$Id: logging.c,v 1.1 2000/12/07 00:52:19 tale Exp $";
+#endif
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <time.h>
+
+#include "dnsproxy.h"
+
+#define DEFAULT_LOGFILE "dnsproxy.log"
+
+#ifdef DEBUG
+#define DEFAULT_LOG_LEVEL LOGLEVEL_TRACE
+#else
+#define DEFAULT_LOG_LEVEL LOGLEVEL_WARN
+#endif
+
+/*
+ * Logging Control Variables
+ */
+
+static char logFname[256] = { 0 } ;
+static FILE *logFptr = NULL ;
+static int logLevel = DEFAULT_LOG_LEVEL ;
+static int timeToTurnOver = 0 ;
+
+/*
+ * log_default_path -- get default log file pathname
+ */
+
+static void log_default_path(void)
+{
+#ifdef UNIX
+ (void)strcpy(logFname, "/tmp/") ;
+ (void)strcat(logFname, DEFAULT_LOGFILE) ;
+#endif
+#if defined(WIN32) || defined(OS2)
+ {
+ char *env;
+ if ((env = getenv("TEMP")) == NULL)
+ env = getenv("TMP");
+ if (env != NULL &&
+ strlen(env) + strlen(DEFAULT_LOGFILE) + 1 < sizeof(logFname)) {
+ (void)strcpy(logFname, env);
+ (void)strcat(logFname, "\\");
+ (void)strcat(logFname, DEFAULT_LOGFILE);
+ }
+ }
+#endif
+}
+
+/*
+ * log_configure - configure logging (must be called after 'config_load')
+ */
+
+void log_configure(int ac, char *av[])
+{
+ int i, nArgs ;
+ char **aArgs ;
+ char *fn = NULL ;
+
+ if (config_query_value("log-file", &nArgs, &aArgs) == TRUE) {
+ if (nArgs >= 2) {
+ fn = aArgs[1] ;
+ }
+ }
+ for (i = 1 ; i < ac ; i++) {
+ if (strcmp(av[i], "-logfile") == 0) {
+ fn = av[i+=1] ;
+ }
+ }
+ if (fn != NULL && strlen(fn) < sizeof(logFname)) {
+ strcpy(logFname, fn) ;
+ } else {
+ log_default_path();
+ }
+
+ if (config_query_value("log-level", &nArgs, &aArgs) == TRUE) {
+ int level ;
+
+ if (nArgs != 2) {
+ WARN("syntax error at log-level line\n");
+ } else if ((level = log_strtolevel(aArgs[1])) < 0) {
+ WARN("invalid log level %s\n", aArgs[1]);
+ } else {
+ log_setlevel(level);
+ }
+ }
+}
+
+/*
+ * log_terminate - terminate logging
+ */
+
+void log_terminate(void)
+{
+ if (logFptr != NULL) {
+ fclose(logFptr) ;
+ logFptr = NULL ;
+ }
+}
+
+/*
+ * log_turnover_request - request turning over log
+ * this function is intended for calling from singnal handler.
+ */
+
+void log_turnover_request(void)
+{
+ timeToTurnOver = 1;
+}
+
+/*
+ * log_turnover - turn over log if requested
+ */
+
+void log_turnover(void)
+{
+ if (timeToTurnOver) {
+ timeToTurnOver = 0;
+ log_trace_printf("--- log file turned over\n");
+ log_terminate() ;
+ }
+}
+
+/*
+ * log_setlevel - set log level
+ */
+void log_setlevel(int level)
+{
+ logLevel = level;
+}
+
+/*
+ * log_strtolevel - string to log level
+ */
+int log_strtolevel(char *s)
+{
+ if ('0' <= s[0] && s[0] <= '9') {
+ return atoi(s) ;
+ } else if (!strcmp(s, "none")) {
+ return LOGLEVEL_NONE;
+ } else if (!strcmp(s, "fatal")) {
+ return LOGLEVEL_FATAL;
+ } else if (!strcmp(s, "warn") || !strcmp(s, "warning")) {
+ return LOGLEVEL_WARN;
+ } else if (!strcmp(s, "trace")) {
+ return LOGLEVEL_TRACE;
+ } else {
+ return -1;
+ }
+}
+
+/*
+ * log_vprintf - as name describes
+ */
+
+static void log_vprintf(int level, char *fmt, va_list arg_ptr)
+{
+ char buff[512] ;
+
+ if (logLevel < level) {
+ return;
+ }
+
+ /*
+ * format message
+ */
+
+ vsprintf(buff, fmt, arg_ptr) ;
+
+#ifdef DEBUG
+ printf("%s", buff) ;
+ fflush(stdout) ;
+#endif
+
+ /*
+ * log to file
+ */
+
+ if (*logFname == '\0') {
+ return ; /* no logging file specified */
+ }
+ if (logFptr == NULL) {
+ logFptr = fopen(logFname, "a") ;
+ }
+ if (logFptr != NULL) {
+ fputs(buff, logFptr) ;
+ fflush(logFptr) ;
+ }
+#ifdef WIN32 /* For NT, having trouble with */
+ fclose(logFptr) ; /* reading open'd logging file */
+ logFptr = NULL ; /* so, close and re-open it */
+#endif
+}
+
+/*
+ * log_fatal_printf, log_warn_printf, log_trace_printf - write out
+ * fatal/warning/trace log to the log file
+ */
+
+void log_fatal_printf(char *fmt, ...)
+{
+ va_list arg_ptr ;
+
+ va_start(arg_ptr, fmt) ;
+ log_vprintf(LOGLEVEL_FATAL, fmt, arg_ptr) ;
+ va_end(arg_ptr) ;
+}
+
+void log_warn_printf(char *fmt, ...)
+{
+ va_list arg_ptr ;
+
+ va_start(arg_ptr, fmt) ;
+ log_vprintf(LOGLEVEL_WARN, fmt, arg_ptr) ;
+ va_end(arg_ptr) ;
+}
+
+void log_trace_printf(char *fmt, ...)
+{
+ va_list arg_ptr ;
+
+ va_start(arg_ptr, fmt) ;
+ log_vprintf(LOGLEVEL_TRACE, fmt, arg_ptr) ;
+ va_end(arg_ptr) ;
+}
diff --git a/contrib/idn/mdnkit/dnsproxy/message.c b/contrib/idn/mdnkit/dnsproxy/message.c
new file mode 100644
index 00000000..230ca9b5
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/message.c
@@ -0,0 +1,627 @@
+/*
+ * message.c - mDNS Proxy, message handling
+ *
+ * message will passed with callback 'notify_message'.
+ * this module parse received message and forward request,
+ * or reply to originator
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef lint
+static char *rcsid = "$Id: message.c,v 1.1 2000/12/07 00:52:19 tale Exp $";
+#endif
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#ifdef WIN32
+#include <windows.h>
+#include <winsock.h>
+#else /* for normal systems */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#endif
+
+#include "dnsproxy.h"
+
+/*
+ * address handling utilities
+ *
+ * addrEq check same addresses
+ * addrFmt format address, port & protocol
+ *
+ * these functions are same with those in 'server.c'.
+ * may be put in another 'utility' module.
+ */
+
+static BOOL addrEq(struct sockaddr *a1, struct sockaddr *a2)
+{
+ struct sockaddr_in *ip1 = (struct sockaddr_in *) a1 ;
+ struct sockaddr_in *ip2 = (struct sockaddr_in *) a2 ;
+
+ if (ip1->sin_addr.s_addr != ip2->sin_addr.s_addr) {
+ return FALSE ;
+ }
+ if (ip1->sin_port != ip2->sin_port) {
+ return FALSE ;
+ }
+ return TRUE ;
+}
+
+static u_char fmtbuff[64] ;
+
+static u_char *addrFmt(struct sockaddr *addr, int proto)
+{
+ struct sockaddr_in *iaddr = (struct sockaddr_in *) addr ;
+ u_char *ap ;
+ u_char *pp ;
+
+ ap = (u_char *) &iaddr->sin_addr ;
+ pp = (u_char *) &iaddr->sin_port ;
+
+ sprintf(fmtbuff, "%s:%d.%d.%d.%d:%d",
+ (proto == SOCK_STREAM ? "TCP" : "UDP"),
+ (ap[0] & 0xff), (ap[1] & 0xff), (ap[2] & 0xff), (ap[3] & 0xff),
+ ((pp[0] & 0xff) * 256 + (pp[1] & 0xff)) ) ;
+
+ return fmtbuff ;
+}
+
+/*
+ * Managing Message ID
+ */
+
+static u_short msgidLast = 0xffff ;
+static u_short msgidMap[4096] = { 0 } ;
+
+#define ID_INDEX(x) (((x) & 0xfff0) >> 4)
+#define ID_MASK(x) (1 << ((x) & 0x000f))
+
+#define ID_CHECK(x) (msgidMap[ID_INDEX((x))] & ID_MASK((x)))
+#define ID_USEIT(x) (msgidMap[ID_INDEX((x))] |= ID_MASK((x)))
+#define ID_CLEAR(x) (msgidMap[ID_INDEX((x))] &= ~ID_MASK((x)))
+
+static BOOL idAlloc(u_short *id)
+{
+ u_short newid ;
+
+ for (newid = (msgidLast + 1) & 0xffff ;
+ newid != msgidLast ;
+ newid = (newid + 1) & 0xffff) {
+ if (ID_CHECK(newid) == 0) {
+ ID_USEIT(newid) ;
+ msgidLast = newid ;
+ *id = newid ;
+ return TRUE ;
+ }
+ }
+ WARN("idAlloc - no more ID\n") ;
+ return FALSE ;
+}
+
+static void idFree(u_short id)
+{
+ if (ID_CHECK(id) == 0) {
+ WARN("idAlloc - %04x is not in use\n", id) ;
+ return ;
+ }
+ ID_CLEAR(id) ;
+}
+
+/*
+ * Message Managements
+ *
+ * Request from client is identified with its ID word. It is unique
+ * on one client, but proxy accepts requests from multiple clients,
+ * proxy cannot distinguish request with ID only, and cannot forward
+ * request with such ID word.
+ *
+ * So, proxy will identify requests with combination of address, port,
+ * (which identified client) and ID word. Then forwarding request,
+ * proxy allocate unique ID, and change request's ID with new one.
+ *
+ * Response from DNS server will identified with newly allocated ID.
+ * For responding such response to originator, replace response's
+ * ID with original one, and send response to marked address/port.
+ */
+
+typedef struct _MSG *MSGPTR ;
+
+typedef struct _MSG {
+ MSGPTR prev ;
+ MSGPTR next ;
+ time_t last ;
+ struct sockaddr from ;
+ int proto ;
+ u_short orgId ;
+ u_short newId ;
+ translation_context_t trctx ;
+} MSGREC ;
+
+static MSGREC listMsg = { 0 } ;
+
+/*
+ * searchReq - search request in message list, search on original ID
+ */
+
+static MSGPTR searchReq(u_short id, int proto, struct sockaddr *addr)
+{
+ MSGPTR p ;
+
+ if (listMsg.prev == NULL || listMsg.next == NULL) {
+ listMsg.prev = &listMsg ;
+ listMsg.next = &listMsg ;
+ }
+ for (p = listMsg.next ; p != &listMsg ; p = p->next) {
+ if (p->orgId != id || p->proto != proto) {
+ continue ;
+ }
+ if (addrEq(&p->from, addr) != TRUE) {
+ continue ;
+ }
+ p->last = time(NULL) ;
+ return p ;
+ }
+ return NULL ;
+}
+
+/*
+ * searchOrg - search original request matching to new ID
+ */
+
+static MSGPTR searchOrg(u_short id, int proto)
+{
+ MSGPTR p ;
+
+ if (listMsg.prev == NULL || listMsg.next == NULL) {
+ listMsg.prev = &listMsg ;
+ listMsg.next = &listMsg ;
+ }
+ for (p = listMsg.next ; p != &listMsg ; p = p->next) {
+ if (p->newId != id || p->proto != proto) {
+ continue ;
+ }
+ p->last = time(NULL) ;
+ return p ;
+ }
+ return NULL ;
+}
+
+/*
+ * createReq - create new message record for new request
+ *
+ * it also allocate new ID for this request, used for
+ * forwarding this request
+ */
+
+static MSGPTR createReq(u_short id, int proto, struct sockaddr *addr)
+{
+ u_short newid ;
+ MSGPTR pMsg, prev, next ;
+
+ if (listMsg.prev == NULL || listMsg.next == NULL) {
+ listMsg.prev = &listMsg ;
+ listMsg.next = &listMsg ;
+ }
+
+ if (idAlloc(&newid) != TRUE) {
+ WARN("createReq - no more ID\n") ;
+ return NULL ;
+ }
+ if ((pMsg = (MSGPTR) malloc(sizeof(MSGREC))) == NULL) {
+ WARN("createReq - cannot allocate message record\n") ;
+ idFree(newid) ;
+ return NULL ;
+ }
+
+ memset(pMsg, 0, sizeof(MSGREC)) ;
+
+ memcpy(&pMsg->from, addr, sizeof(struct sockaddr)) ;
+ pMsg->proto = proto ;
+ pMsg->orgId = id ;
+ pMsg->newId = newid ;
+ pMsg->last = time(NULL) ;
+
+ pMsg->trctx.client = &pMsg->from ;
+ pMsg->trctx.protocol = pMsg->proto ;
+ pMsg->trctx.old_id = pMsg->orgId ;
+ pMsg->trctx.new_id = pMsg->newId ;
+
+ prev = listMsg.prev ;
+ next = prev->next ;
+
+ prev->next = pMsg ;
+ next->prev = pMsg ;
+ pMsg->prev = prev ;
+ pMsg->next = next ;
+
+ return pMsg ;
+}
+
+/*
+ * disposeReq - dispose message record
+ */
+
+static void disposeReq(MSGPTR pMsg)
+{
+ MSGPTR p ;
+
+ if (listMsg.prev == NULL || listMsg.next == NULL) {
+ listMsg.prev = &listMsg ;
+ listMsg.next = &listMsg ;
+ }
+
+ for (p = listMsg.next ; p != &listMsg ; p = p->next) {
+ if (p == pMsg) {
+ break ;
+ }
+ }
+ if (p == pMsg) { /* safe to unlink it */
+ pMsg->prev->next = pMsg->next ;
+ pMsg->next->prev = pMsg->prev ;
+ }
+ idFree(pMsg->newId) ;
+ free(pMsg) ;
+}
+
+/*
+ * messageForward - forward the request
+ */
+
+static void errorOnRequest(MSGPTR pMsg, u_char *msg, int len, size_t err)
+{
+ u_short errmsg[6] ;
+ u_short flags ;
+ u_short *ps ;
+
+ TRACE("errorOnRequest %d\n", err) ;
+
+ ps = (u_short *) msg ;
+ flags = ntohs(ps[1]) ;
+ flags = ((flags & 0x7fff) | 0x8000) ; /* QR to response */
+ flags = ((flags & 0xfff8) | (err & 0x0007)) ; /* set RCODE */
+
+ memset(errmsg, 0, sizeof(errmsg)) ;
+ errmsg[0] = htons(pMsg->orgId) ;
+ errmsg[1] = htons(flags) ;
+
+ server_response(&pMsg->from, pMsg->proto, (u_char *) errmsg, sizeof(errmsg)) ;
+}
+
+static void messageForward(MSGPTR pMsg, u_char *msg, int len)
+{
+ u_short *p ;
+ u_char buff[1024] ;
+ u_char *bbase ;
+ size_t bleng ;
+ size_t cleng = 0 ; /* avoid un-expected length on xlate error */
+ size_t cstat = 0 ; /* avoid un-expected status on xlate error */
+
+ TRACE("messageForward - %04x -> %04x\n", pMsg->orgId, pMsg->newId) ;
+
+ /*
+ * prepare conversion buffer
+ */
+
+ if (len < sizeof(buff) / 2) {
+ bbase = buff ;
+ bleng = sizeof(buff) ;
+ } else {
+ bbase = malloc(len * 2) ;
+ bleng = len * 2 ;
+ }
+ if (bbase == NULL) {
+ WARN("messageForward - cannot prepare conversion buffer\n") ;
+ return ;
+ }
+
+ /*
+ * translate message (domain names)
+ */
+
+ TRACE("messageForward - translate request\n") ;
+
+ cstat = translate_request(&pMsg->trctx, msg, len, bbase, bleng, &cleng) ;
+
+ TRACE("messageForward - translated status %d length %d\n", cstat, cleng) ;
+
+ if (cstat != 0) { /* error on conversion */
+ WARN("messageForward - translation error %d\n", cstat) ;
+ errorOnRequest(pMsg, msg, len, cstat) ;
+ return ;
+ }
+ if (pMsg->proto == SOCK_DGRAM && cleng > 512) {
+ WARN("messageForward - translation overflow %d\n", cleng) ;
+ errorOnRequest(pMsg, msg, len, 2) ;
+ return ;
+ }
+
+ /*
+ * forward the request
+ */
+
+ p = (u_short *) bbase ;
+ p[0] = htons(pMsg->newId) ;
+
+ server_forward(NULL, pMsg->proto, bbase, cleng) ;
+
+ /*
+ * cleanup buffer
+ */
+
+ if (bbase != buff) {
+ free(bbase) ;
+ }
+}
+
+/*
+ * messageResponse - response to originating client
+ */
+
+static void errorOnResponse(MSGPTR pMsg, u_char *msg, int len, size_t err)
+{
+ u_short errmsg[6] ;
+ u_short flags ;
+ u_short *ps ;
+
+ TRACE("errorOnResponse %d\n", err) ;
+
+ ps = (u_short *) msg ;
+ flags = ntohs(ps[1]) ;
+ flags = ((flags & 0x7fff) | 0x8000) ; /* QR to response */
+ flags = ((flags & 0xfff8) | (err & 0x0007)) ; /* set RCODE */
+
+ memset(errmsg, 0, sizeof(errmsg)) ;
+ errmsg[0] = htons(pMsg->orgId) ;
+ errmsg[1] = htons(flags) ;
+
+ server_response(&pMsg->from, pMsg->proto, (u_char *) errmsg, sizeof(errmsg)) ;
+}
+
+static void messageResponse(MSGPTR pMsg, u_char *msg, int len)
+{
+ u_short *p ;
+ u_char buff[1024] ;
+ u_char *bbase ;
+ size_t bleng ;
+ size_t cleng ;
+ size_t cstat ;
+
+ TRACE("messageResponse - %04x <- %04x\n", pMsg->orgId, pMsg->newId) ;
+
+ /*
+ * prepare conversion buffer
+ */
+
+ if (len < sizeof(buff) / 2) {
+ bbase = buff ;
+ bleng = sizeof(buff) ;
+ } else {
+ bbase = malloc(len * 2) ;
+ bleng = len * 2 ;
+ }
+ if (bbase == NULL) {
+ WARN("messageResponse - cannot prepare conversion buffer\n") ;
+ return ;
+ }
+
+ /*
+ * translate message (domain names)
+ */
+
+ TRACE("messageResponse - translate response\n") ;
+
+ cstat = translate_reply(&pMsg->trctx, msg, len, bbase, bleng, &cleng) ;
+
+ TRACE("messageResponse - translated status %d length %d\n", cstat, cleng) ;
+
+ if (cstat != 0) { /* error on conversion */
+ WARN("messageResponse - translation error %d\n", cstat) ;
+ errorOnResponse(pMsg, msg, len, cstat) ;
+ return ;
+ }
+ if (pMsg->proto == SOCK_DGRAM && cleng > 512) {
+ WARN("messageResponse - translation overflow %d\n", cleng) ;
+ errorOnResponse(pMsg, msg, len, 2) ;
+ return ;
+ }
+
+ /*
+ * reply back to requester
+ */
+
+ p = (u_short *) bbase ;
+ p[0] = htons(pMsg->orgId) ;
+
+ server_response(&pMsg->from, pMsg->proto, bbase, cleng) ;
+
+ /*
+ * cleanup buffer
+ */
+
+ if (bbase != buff) {
+ free(bbase) ;
+ }
+}
+
+/*
+ * notify_message - callback from server loop
+ */
+
+void notify_message(struct sockaddr *from, int proto, u_char *msg, int len)
+{
+ u_short *p = (u_short *) msg ;
+ u_short msgid, flags ;
+ MSGPTR pMsg ;
+#ifdef DEBUG
+ char logbuf[256] ;
+#endif
+
+ msgid = ntohs(p[0]) ;
+ flags = ntohs(p[1]) ;
+
+#ifdef DEBUG
+ if ((flags & 0x8000) == 0) {
+ sprintf(logbuf, "Request %04x (%04x) from %s, %d bytes",
+ msgid, flags, addrFmt(from, proto), len) ;
+ } else {
+ sprintf(logbuf, "Response %04x (%04x) from %s %d bytes",
+ msgid, flags, addrFmt(from, proto), len) ;
+ }
+ TRACE("%s\n", logbuf) ;
+
+ strcpy(logbuf, " ") ;
+
+ switch ((flags & 0x7800) >> 11) {
+ case 0 : strcat(logbuf, "QUERY ") ; break ;
+ case 1 : strcat(logbuf, "IQUERY ") ; break ;
+ case 2 : strcat(logbuf, "STATUS ") ; break ;
+ default : strcat(logbuf, "UNKNOWN") ; break ;
+ }
+ if ((flags & 0x0400) != 0) {
+ strcat(logbuf, ",AA") ;
+ }
+ if ((flags & 0x0200) != 0) {
+ strcat(logbuf, ",TC") ;
+ }
+ if ((flags & 0x0100) != 0) {
+ strcat(logbuf, ",RD") ;
+ }
+ if ((flags & 0x0080) != 0) {
+ strcat(logbuf, ",RA") ;
+ }
+ switch (flags & 0x00f) {
+ case 0 : strcat(logbuf, ",No Error ") ; break ;
+ case 1 : strcat(logbuf, ",Format Error ") ; break ;
+ case 2 : strcat(logbuf, ",Server Failure ") ; break ;
+ case 3 : strcat(logbuf, ",Name Error ") ; break ;
+ case 4 : strcat(logbuf, ",Not Implemented") ; break ;
+ case 5 : strcat(logbuf, ",Refused ") ; break ;
+ default : strcat(logbuf, ",Unknown Error ") ; break ;
+ }
+ TRACE("%s\n", logbuf) ;
+#endif
+
+ if ((flags & 0x8000) == 0) { /* request from client */
+
+ if ((pMsg = searchReq(msgid, proto, from)) == NULL) {
+ pMsg = createReq(msgid, proto, from) ;
+ }
+ if (pMsg == NULL) {
+ WARN("notify_message - cannot create message record\n") ;
+ return ;
+ }
+ messageForward(pMsg, msg, len) ;
+
+ } else { /* response from server */
+
+ if ((pMsg = searchOrg(msgid, proto)) == NULL) {
+ WARN("notify_message - no corresponding request\n") ;
+ return ;
+ }
+ messageResponse(pMsg, msg, len) ;
+ disposeReq(pMsg);
+ }
+}
+
+/*
+ * notify_timer - timer callback
+ */
+
+static time_t timeLastCheck = 0 ;
+static time_t timeInterval = 60 ;
+static time_t timeTimeout = (60 * 10) ;
+
+void notify_timer(void)
+{
+ time_t t = time(NULL) ;
+ MSGPTR p, np ;
+#ifdef DEBUG
+ int ndiscarded = 0;
+#endif
+
+ if (listMsg.prev == NULL || listMsg.next == NULL) {
+ listMsg.prev = &listMsg ;
+ listMsg.next = &listMsg ;
+ }
+
+ if ((t - timeLastCheck) < timeInterval) {
+ return ;
+ }
+ for (p = listMsg.next ; p != &listMsg ; p = np) {
+ np = p->next ;
+ if ((t - p->last) > timeTimeout) {
+ disposeReq(p) ;
+#ifdef DEBUG
+ ndiscarded++;
+#endif
+ }
+ }
+#ifdef DEBUG
+ TRACE("notify_timer: %d discarded\n", ndiscarded);
+#endif
+ timeLastCheck = t;
+}
diff --git a/contrib/idn/mdnkit/dnsproxy/os2main.c b/contrib/idn/mdnkit/dnsproxy/os2main.c
new file mode 100644
index 00000000..dabe9c5f
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/os2main.c
@@ -0,0 +1,138 @@
+/*
+ * os2main.c - mDNS Proxy, entry for OS2
+ *
+ * For OS/2, there are no daemon, nor service. Simply
+ * start server program with
+ *
+ * RUN in config.sys
+ * START in startup.cmd
+ * put server program (object) into startup folder
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef lint
+static char *rcsid = "$Id: os2main.c,v 1.1 2000/12/07 00:52:19 tale Exp $";
+#endif
+
+#ifdef OS2
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+
+#include "dnsproxy.h" /* Common definitions for mDNS proxy */
+
+/*
+ * signal handler to catch signal to terminate server
+ */
+
+static void handler(int signo)
+{
+ server_stop() ;
+ signal(signo, SIG_DFL) ;
+}
+
+/*
+ * main - entry of os2 version
+ */
+
+int main(int ac, char *av[])
+{
+ if (config_load(ac, av) != TRUE) {
+ printf("cannot load configurations\n") ;
+ return 1 ;
+ }
+ log_configure(ac, av) ;
+
+ if (server_init(ac, av) != TRUE) {
+ printf("cannot initialize server\n") ;
+ log_terminate() ;
+ return 1 ;
+ }
+
+ signal(SIGINT, handler) ;
+ signal(SIGKILL, handler) ;
+ signal(SIGTERM, handler) ;
+ signal(SIGBREAK, handler) ;
+
+#ifdef DEBUG
+ printf("Service Started\n") ;
+#endif
+
+ server_loop() ;
+
+#ifdef DEBUG
+ printf("Service Termiating...\n") ;
+#endif
+
+ server_done() ;
+
+ log_terminate() ;
+
+#ifdef DEBUG
+ printf("Service Terminated\n") ;
+#endif
+
+ return 0 ;
+}
+
+#endif /* OS2 */
+
diff --git a/contrib/idn/mdnkit/dnsproxy/proxycnf.c b/contrib/idn/mdnkit/dnsproxy/proxycnf.c
new file mode 100644
index 00000000..8bfab239
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/proxycnf.c
@@ -0,0 +1,776 @@
+/*
+ * proxycnf.c - mDNS Proxy, configuration
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef lint
+static char *rcsid = "$Id: proxycnf.c,v 1.1 2000/12/07 00:52:19 tale Exp $";
+#endif
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#ifdef WIN32
+#include <windows.h>
+#include <winsock.h>
+#else /* for normal systems */
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#endif
+
+#include "dnsproxy.h" /* Common definitions for mDNS proxy */
+#include "proxycnf.h" /* Machine/Env specific configuration */
+
+/*
+ * Note that logging macros (FATAL, WARN and TRACE) cannot be used
+ * until logging file is configured, i.e. log_configure() is called.
+ * Be careful.
+ */
+
+/*
+ * default config file (path & basename), depend on MACHINE
+ */
+
+#ifndef CONFIG_PATH
+#warning "no \"CONFIG_PATH\", use "\"./\" as default"
+#define CONFIG_PATH "./"
+#endif
+#ifndef CONFIG_FILE
+#warning "no \"CONFIG_FILE\", use "dnsproxy.ini" as default"
+#define CONFIG_FILE "dnsproxy.ini"
+#endif
+#ifndef CONFIG_HOME
+#warning "no \"CONFIG_HOME\", use "\"./\" as default"
+#define CONFIG_HOME "./"
+#endif
+
+static u_char *confFile = CONFIG_FILE ;
+
+static u_char *confPath[] = {
+#ifdef DEBUG
+ "./",
+ CONFIG_HOME,
+#endif
+ CONFIG_PATH,
+ NULL
+} ;
+
+static u_char *expandName(u_char *name, u_char *buff)
+{
+ int inEnv = FALSE ;
+ u_char *bp, *ep ;
+ u_char env[512] ;
+
+ for (bp = buff, ep = env ; *name != '\0' ; name++) {
+ if (inEnv == FALSE) {
+ if (*name == '$') {
+ inEnv = TRUE ;
+ ep = env ;
+ } else {
+ *bp++ = *name ;
+ *bp = '\0' ;
+ }
+ } else {
+ if (*name == '(') {
+ /* skip this */
+ } else if (*name != ')') {
+ *ep++ = *name ;
+ *ep = '\0' ;
+ } else if ((ep = getenv(env)) == NULL) {
+ return NULL ;
+ } else {
+ while (*ep != '\0') {
+ *bp++ = *ep++ ;
+ }
+ *bp = '\0' ;
+ inEnv = FALSE ;
+ }
+ }
+ }
+ return buff ;
+}
+
+static FILE *openConfig(u_char *fname)
+{
+ int i ;
+ FILE *fp = NULL ;
+ u_char path[512] ;
+ u_char name[512] ;
+
+ /*
+ * if coinfiguration file specified, open it
+ */
+
+ if (fname != NULL) {
+ if (expandName(fname, name) == NULL) {
+ return NULL ;
+ }
+ if ((fp = fopen(name, "r")) == NULL) {
+ return NULL ;
+ }
+ return fp ;
+ }
+
+ /*
+ * otherwise, look for configuration file in search path
+ */
+
+ for (i = 0 ; confPath[i] != NULL ; i++) {
+
+ if (expandName(confPath[i], path) == NULL) {
+ continue ;
+ }
+
+ sprintf(name, "%s%s", path, confFile) ;
+
+ if ((fp = fopen(name, "r")) != NULL) {
+ return fp ;
+ }
+ }
+ return NULL ;
+}
+
+/*
+ * configuration data in file consists of
+ *
+ * key value ...
+ *
+ * lines. This module hold them as following list.
+ */
+
+typedef struct _CONF *CNFPTR ;
+
+typedef struct _CONF {
+ CNFPTR prev ;
+ CNFPTR next ;
+ u_char *key ; /* really, buffer for key & val */
+ int nVal ;
+ u_char *aVal[1] ; /* really, follows 'nVal' entries */
+} CNFREC ;
+
+static CNFREC confList = { 0 } ;
+
+static void disposeData(void)
+{
+ CNFPTR p ;
+
+ if (confList.prev == NULL || confList.next == NULL) {
+ return ;
+ }
+ while ((p = confList.next) != &confList) {
+ confList.next = p->next ;
+ free(p->key) ;
+ free(p) ;
+ }
+}
+
+static u_char *getString(u_char *p, CNFPTR pCnf)
+{
+ /*
+ * mark start of value string
+ */
+
+ pCnf->aVal[pCnf->nVal++] = p ;
+
+ /*
+ * look for end of string, any space
+ */
+
+ for ( ; *p != '\0' ; p++) {
+ if (isspace(*p)) {
+ break ;
+ }
+ }
+ if (*p != '\0') {
+ *p++ = '\0' ;
+ }
+ return p ;
+}
+
+static u_char *getQuoted(u_char *p, CNFPTR pCnf)
+{
+ if (*p != '"') { /* Oh, something wrong !! */
+ return p ;
+ }
+ p++ ; /* skip leading '"' */
+
+ /*
+ * mark start of value string
+ */
+
+ pCnf->aVal[pCnf->nVal++] = p ;
+
+ /*
+ * look for terminating '"', may be escaped with '\'
+ */
+
+ while (*p != '\0' && *p != '\n' && *p != '\r') {
+ if (*p == '"') {
+ break ;
+ } else if (*p == '\\') { /* quoted pair */
+ p += 2 ;
+ } else {
+ p += 1 ;
+ }
+ }
+ if (*p != '\0') {
+ *p++ = '\0' ;
+ }
+ return p ;
+}
+
+static BOOL appendData(u_char *line)
+{
+ int len ;
+ u_char *pStr, *p ;
+ CNFPTR pCnf, pNew ;
+ CNFPTR prev, next ;
+
+ /*
+ * list is not initialized, initialize it
+ */
+
+ if (confList.prev == NULL || confList.next == NULL) {
+ confList.prev = &confList ;
+ confList.next = &confList ;
+ }
+
+ /*
+ * prepare buffers
+ */
+
+ len = strlen(line) ;
+
+ pCnf = (CNFPTR) malloc(sizeof(CNFREC) + sizeof(u_char *) * len) ;
+ pStr = malloc(len + 2) ;
+
+ if (pStr == NULL || pCnf == NULL) {
+ fprintf(stderr, "configure - cannot allocate parsing buffer\n") ;
+ if (pStr != NULL) free(pStr) ;
+ if (pCnf != NULL) free(pCnf) ;
+ return FALSE ;
+ }
+
+ memset(pCnf, 0, sizeof(CNFREC)) ;
+
+ for (p = pStr ; *line != '\0' ; ) {
+ if (*line == '\n' || *line == '\r') {
+ break ;
+ }
+ *p++ = *line++ ;
+ }
+ *p = '\0' ;
+
+ /*
+ * parse line (save results into pCnf)
+ *
+ * term may be string or quoted-string
+ */
+
+ for (p = pStr ; *p != '\0' ; ) {
+ if (isspace(*p)) {
+ p += 1 ;
+ } else if (*p == '#') {
+ break ;
+ } else if (*p == '"') {
+ p = getQuoted(p, pCnf) ;
+ } else {
+ p = getString(p, pCnf) ;
+ }
+ }
+
+ /*
+ * if no term found, skip the line
+ */
+
+ if (pCnf->nVal == 0) {
+ free(pStr) ;
+ free(pCnf) ;
+ return TRUE ;
+ }
+
+ /*
+ * create resulting CNF record
+ */
+
+ pNew = (CNFPTR) malloc(sizeof(CNFREC) + sizeof(u_char *) * pCnf->nVal) ;
+
+ if (pNew == NULL) {
+ fprintf(stderr, "configure - cannot allocate parsed record\n") ;
+ free(pStr) ;
+ free(pCnf) ;
+ return FALSE ;
+ }
+
+ memset(pNew, 0, sizeof(CNFREC)) ;
+
+ pNew->key = pStr ;
+ pNew->nVal = pCnf->nVal ;
+ memcpy(pNew->aVal, pCnf->aVal, sizeof(u_char *) * pCnf->nVal) ;
+
+ free(pCnf) ;
+
+ /*
+ * link to list
+ */
+
+ prev = confList.prev ;
+ next = prev->next ;
+ pNew->prev = confList.prev ;
+ pNew->next = &confList ;
+ prev->next = pNew ;
+ next->prev = pNew ;
+
+ return TRUE ;
+}
+
+/*
+ * config_load - load mDNS Proxy configuration data
+ */
+
+BOOL config_load(int ac, char *av[])
+{
+ int i ;
+ u_char *conf ;
+ FILE *fp ;
+ u_char line[512] ;
+
+ /*
+ * check if alternate config file specified
+ */
+
+ for (i = 1, conf = NULL ; i < ac ; i++) {
+ if (strcmp(av[i], "-config") == 0) {
+ if ((i + 1) < ac) {
+ conf = av[i+=1] ;
+ }
+ }
+ }
+
+ /*
+ * open configuration file
+ */
+
+ if ((fp = openConfig(conf)) == NULL) {
+ fprintf(stderr, "config - cannot locate config file\n") ;
+ return FALSE ;
+ }
+
+ /*
+ * read and parse configuration data (per line)
+ */
+
+ while (fgets(line, 512, fp) != NULL) {
+ if (appendData(line) != TRUE) {
+ fprintf(stderr, "config - cannot load data %s\n", line) ;
+ fclose(fp) ;
+ return FALSE ;
+ }
+ }
+
+ fclose(fp) ;
+ return TRUE ;
+}
+
+/*
+ * config_dump - dump contents of mDNS Proxy configuration data
+ */
+
+static BOOL haveSpace(u_char *str)
+{
+ for ( ; *str != '\0' ; str++) {
+ if (isspace(*str)) {
+ return TRUE ;
+ }
+ }
+ return FALSE ;
+}
+
+void config_dump(FILE *ofp)
+{
+ CNFPTR p ;
+ int i ;
+
+ if (confList.next == NULL || confList.prev == NULL) {
+ return ;
+ }
+ for (p = confList.next ; p != &confList ; p = p->next) {
+ if (haveSpace(p->key)) {
+ fprintf(ofp, "<%s>", p->key) ;
+ } else {
+ fprintf(ofp, "<%s>", p->key) ;
+ }
+ for (i = 0 ; i < p->nVal ; i++) {
+ if (haveSpace(p->aVal[i])) {
+ fprintf(ofp, " \"%s\"", p->aVal[i]) ;
+ } else {
+ fprintf(ofp, " %s", p->aVal[i]) ;
+ }
+ }
+ fprintf(ofp, "\n") ;
+ }
+}
+
+/*
+ * config_free - dispose mDNS configuration data
+ */
+
+void config_free(void)
+{
+ disposeData() ;
+}
+
+/*
+ * config_query_value - query configuration data
+ *
+ * this is generic interface to access configuration data
+ * but note, this function cannot work with multiple
+ * configuration data, such as client-translation
+ */
+
+BOOL config_query_value(char *key, int *count, char ***array)
+{
+ CNFPTR p ;
+
+ for (p = confList.next ; p != &confList ; p = p->next) {
+ if (strcmp(p->key, key) != 0) {
+ continue ;
+ }
+ *count = p->nVal ;
+ *array = (char **) p->aVal ;
+ return TRUE ;
+ }
+ return FALSE ;
+}
+
+/*
+ * config_query_listen, config_query_forward
+ *
+ * queries sockaddr (really sockaddr_in) of proxy to listen,
+ * and DNS server to which proxy forwards the requests.
+ * These function set
+ *
+ * addr->sin_family <- AF_INET
+ * addr->sin_addr <- specified/default
+ * addr->sin_port <- specified/default
+ *
+ * for 'listen' address, both sin_addr/sin_port have default values,
+ * but for 'forward' address, there is no default for 'sin_addr',
+ * and result error on such case.
+ *
+ * NOTE: for DNS proxy, both listen/forward address should be
+ * specified with xx.xx.xx.xx notation, never be host name
+ */
+
+#define DEFAULT_ADDR INADDR_ANY
+#define DEFAULT_PORT 53
+
+static CNFPTR queryData(u_char *key)
+{
+ CNFPTR p ;
+
+ for (p = confList.next ; p != &confList ; p = p->next) {
+ if (strcmp(p->key, key) == 0) {
+ return p ;
+ }
+ }
+ return NULL ;
+}
+
+static void getHostPort(u_char *arg, u_char *host, u_char *port)
+{
+ for (*host = '\0' ; *arg != '\0' ; arg++) {
+ if (*arg == ':') {
+ arg += 1 ;
+ break ;
+ }
+ *host++ = *arg ;
+ *host = '\0' ;
+ }
+ for (*port = '\0' ; *arg != '\0' ; arg++) {
+ *port++ = *arg ;
+ *port = '\0' ;
+ }
+}
+
+BOOL config_query_listen(struct sockaddr *addr)
+{
+ CNFPTR pListen ;
+ u_char host[64], port[64] ;
+ struct sockaddr_in *iaddr ;
+
+ memset(addr, 0, sizeof(struct sockaddr)) ;
+ iaddr = (struct sockaddr_in *) addr ;
+
+ iaddr->sin_family = AF_INET ;
+
+ if ((pListen = queryData("listen")) == NULL) {
+ iaddr->sin_addr.s_addr = htonl(DEFAULT_ADDR) ;
+ iaddr->sin_port = htons(DEFAULT_PORT) ;
+ return TRUE ;
+ }
+ if (pListen->nVal < 2) {
+ iaddr->sin_addr.s_addr = htonl(DEFAULT_ADDR) ;
+ iaddr->sin_port = htons(DEFAULT_PORT) ;
+ return TRUE ;
+ }
+
+ getHostPort(pListen->aVal[1], host, port) ;
+
+ if (isdigit(*host)) {
+ iaddr->sin_addr.s_addr = inet_addr(host) ;
+ } else {
+ iaddr->sin_addr.s_addr = htonl(DEFAULT_ADDR) ;
+ }
+ if (isdigit(*port)) {
+ iaddr->sin_port = htons(atoi(port)) ;
+ } else {
+ iaddr->sin_port = htons(DEFAULT_PORT) ;
+ }
+ return TRUE ;
+}
+
+BOOL config_query_forward(struct sockaddr *addr)
+{
+ CNFPTR pForward ;
+ u_char host[64], port[64] ;
+ struct sockaddr_in *iaddr ;
+
+ memset(addr, 0, sizeof(struct sockaddr)) ;
+ iaddr = (struct sockaddr_in *) addr ;
+
+ if ((pForward = queryData("forward")) == NULL) {
+ WARN("config - no \"forward\" record\n") ;
+ return FALSE ;
+ }
+ if (pForward->nVal < 2) {
+ WARN("config - no \"forward\" value\n") ;
+ return FALSE ;
+ }
+
+ getHostPort(pForward->aVal[1], host, port) ;
+
+ if (isdigit(*host)) {
+ iaddr->sin_addr.s_addr = inet_addr(host) ;
+ } else {
+ WARN("config - no \"forward\" address\n") ;
+ return FALSE ;
+ }
+ if (isdigit(*port)) {
+ iaddr->sin_port = htons(atoi(port)) ;
+ } else {
+ iaddr->sin_port = htons(DEFAULT_PORT) ;
+ }
+ iaddr->sin_family = AF_INET ;
+
+ return TRUE ;
+}
+
+/*
+ * config_query_restrict - query 'source-restrict' flag
+ */
+
+BOOL config_query_restrict(BOOL *restrict)
+{
+ CNFPTR pForward ;
+
+ if ((pForward = queryData("forward")) == NULL) {
+ *restrict = FALSE ;
+ } else if (pForward->nVal < 3) {
+ *restrict = FALSE ;
+ } else if (strcmp(pForward->aVal[2], "bind4compat") != 0) {
+ *restrict = FALSE ;
+ } else {
+ *restrict = TRUE ;
+ }
+ return TRUE ;
+}
+
+/*
+ * config_query_open, config_query_more, config_query_close
+ *
+ * this is generic interface to access configuration data
+ * for multiple entires for same key value.
+ */
+
+config_ctx_t config_query_open(char *key, int *count, char ***array)
+{
+ CNFPTR p ;
+
+ for (p = confList.next ; p != &confList ; p = p->next) {
+ if (strcmp(p->key, key) != 0) {
+ continue ;
+ }
+ *count = p->nVal ;
+ *array = (char **) p->aVal ;
+ return (config_ctx_t) p ;
+ }
+ return NULL ;
+}
+
+config_ctx_t config_query_more(config_ctx_t ctx, int *count, char ***array)
+{
+ CNFPTR p = (CNFPTR) ctx ;
+ CNFPTR np ;
+
+ for (np = p->next ; np != &confList ; np = np->next) {
+ if (strcmp(np->key, p->key) != 0) {
+ continue ;
+ }
+ *count = np->nVal ;
+ *array = (char **) np->aVal ;
+ return (config_ctx_t) np ;
+ }
+ return NULL ;
+}
+
+void config_query_close(config_ctx_t ctx)
+{
+ /* nothing to do */
+}
+
+#ifdef TEST
+/*
+ * test driver for 'config' module
+ */
+
+static void dumpaddr(u_char *str, struct sockaddr *addr)
+{
+ u_char *p ;
+ struct sockaddr_in *iaddr = (struct sockaddr_in *) addr ;
+
+ printf("%s ", str) ;
+
+ p = (u_char *) &iaddr->sin_addr ;
+ printf("address %d.%d.%d.%d",
+ (p[0] & 0xff), (p[1] & 0xff), (p[2] & 0xff), (p[3] & 0xff)) ;
+
+ p = (u_char *) &iaddr->sin_port ;
+ printf(" port %d", ((p[0] & 0xff) * 256 + (p[1] & 0xff))) ;
+
+ printf("\n") ;
+}
+
+static void dumpvalue(char *key, int count, char **array)
+{
+ int i ;
+
+ for (i = 0 ; i < count ; i++) {
+ printf("%s ", array[i]) ;
+ }
+ printf("\n") ; fflush(stdout) ;
+}
+
+int main(int ac, char *av[])
+{
+ int stat ;
+ struct sockaddr addr ;
+ int count ;
+ char **array ;
+ config_ctx_t ctx ;
+
+ if ((stat = config_load(ac, av)) != TRUE) {
+ printf("config_load failed %d\n", stat) ;
+ return 1 ;
+ }
+ config_dump(stdout) ;
+
+ if (config_query_value("listen", &count, &array) == TRUE) {
+ dumpvalue("listen", count, array) ;
+ }
+ if (config_query_value("forward", &count, &array) == TRUE) {
+ dumpvalue("forward", count, array) ;
+ }
+ if (config_query_value("normalize", &count, &array) == TRUE) {
+ dumpvalue("normalize", count, array) ;
+ }
+ if (config_query_value("server-translation", &count, &array) == TRUE) {
+ dumpvalue("server-translation", count, array) ;
+ }
+
+ ctx = config_query_open("client-translation", &count, &array) ;
+ while (ctx != NULL) {
+ dumpvalue("client-translation", count, array) ;
+ ctx = config_query_more(ctx, &count, &array) ;
+ }
+ config_query_close(ctx) ;
+
+ if (config_query_listen(&addr) != TRUE) {
+ printf("no \"listen\" data\n") ;
+ } else {
+ dumpaddr("listen", &addr) ;
+ }
+
+ if (config_query_forward(&addr) != TRUE) {
+ printf("no \"forward\" data\n") ;
+ } else {
+ dumpaddr("forward", &addr) ;
+ }
+
+ config_free() ;
+ return 0 ;
+}
+#endif /* TEST */
diff --git a/contrib/idn/mdnkit/dnsproxy/proxycnf.h b/contrib/idn/mdnkit/dnsproxy/proxycnf.h
new file mode 100644
index 00000000..b4b20e70
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/proxycnf.h
@@ -0,0 +1,119 @@
+/*
+ * proxycnf.h - mDNS Proxy, Configure Proxy Server
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+/* $Id: proxycnf.h,v 1.1 2000/12/07 00:52:19 tale Exp $ */
+
+#ifndef PROXYCNF_H
+#define PROXYCNF_H 1
+
+/*
+ * CONFIG_PATH
+ * where configuration file placed
+ */
+
+#ifndef CONFIG_PATH
+#ifdef UNIX
+#define CONFIG_PATH "/usr/local/etc/"
+#endif
+#ifdef WIN32
+#define CONFIG_PATH "$(SystemRoot)/"
+#endif
+#ifdef OS2
+#define CONFIG_PATH "$(ETC)/"
+#endif
+#endif /* CONFIG_PATH */
+
+/*
+ * CONFIG_FILE
+ * name of configuration file
+ */
+
+#ifndef CONFIG_FILE
+#ifdef UNIX
+#define CONFIG_FILE "dnsproxy.conf"
+#endif
+#ifdef WIN32
+#define CONFIG_FILE "dnsproxy.cnf"
+#endif
+#ifdef OS2
+#define CONFIG_FILE "dnsproxy.cnf"
+#endif
+#endif /* CONFIG_FILE */
+
+/*
+ * CONFIG_HOME
+ * debugging support, $HOME environment name
+ */
+
+#ifndef CONFIG_HOME
+#ifdef UNIX
+#define CONFIG_HOME "$(HOME)/"
+#endif
+#ifdef WIN32
+#define CONFIG_HOME "$(HOMEPATH)/"
+#endif
+#ifdef OS2
+#define CONFIG_HOME "$(HOME)/"
+#endif
+#endif /* CONFIG_HOME */
+
+#endif /* PROXYCNF_H */
diff --git a/contrib/idn/mdnkit/dnsproxy/server.c b/contrib/idn/mdnkit/dnsproxy/server.c
new file mode 100644
index 00000000..6de4cbf0
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/server.c
@@ -0,0 +1,1409 @@
+/*
+ * server.c - mDNS Proxy, proxy server core
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef lint
+static char *rcsid = "$Id: server.c,v 1.1 2000/12/07 00:52:19 tale Exp $";
+#endif
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef WIN32
+#include <windows.h>
+#include <winsock.h>
+#else /* for normal systems */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#include <netinet/in.h>
+#include <errno.h>
+#endif
+
+#include "dnsproxy.h"
+
+#ifdef WIN32
+#define close(s) closesocket(s)
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#endif
+
+#ifndef max
+#define max(x, y) ((x) > (y) ? (x) : (y))
+#endif
+
+/*
+ * send buffer for TCP
+ * hold sending data when sending socket blocked
+ */
+
+typedef struct _SNDBUF {
+ struct _SNDBUF *prev ;
+ struct _SNDBUF *next ;
+ int leng ; /* data length in the buffer */
+ int sent ; /* data have been sent */
+ int size ; /* size of this bufefr */
+ u_char buff[1] ; /* 'size' array follows */
+} SNDREC, *SNDPTR ;
+
+/*
+ * recv buffer for TCP
+ * hold incomplete message
+ */
+
+typedef struct _RCVBUF {
+ int stat ; /* what data receiving now */
+ int leng ; /* length of the message */
+ int recv ; /* message have been received */
+ int size ; /* size of this buffer */
+ u_char *buff ; /* points 'size' array of char */
+} RCVREC, *RCVPTR ;
+
+#define RCV_STAT_LEN1 0 /* waiting 1st byte of length */
+#define RCV_STAT_LEN2 1 /* waiting 2nd byte of length */
+#define RCV_STAT_DATA 2 /* waiting message data */
+
+/*
+ * transport control block
+ * is used to handle pending recv/send data of the socket
+ */
+
+typedef struct _NETREC {
+ struct _NETREC *prev ;
+ struct _NETREC *next ;
+ int sock ; /* socket to do network I/O */
+ int proto ; /* TCP or UDP */
+ int type ; /* see below */
+ struct sockaddr peer ; /* peer of this transoport */
+ SNDREC send ; /* pending send data (TPC) */
+ RCVREC recv ; /* pending recv message */
+} NETREC, *NETPTR ;
+
+#define NET_LISTEN 1 /* is proxy's listening socket */
+#define NET_CLIENT 2 /* is connection from client */
+#define NET_SERVER 3 /* is transport to server */
+
+static NETREC listNet = { 0 } ; /* list of transports */
+
+/*
+ * allocate/dispose buffer for SND/RCV buffer managements
+ * simply mapped to malloc/free, but may be
+ * re-maped to spceific function if speed required
+ */
+
+#define xalloc(x) malloc((x))
+#define xfree(p) free((p))
+
+/*
+ * transientError - utility for handling "soft" errors
+ */
+
+static BOOL transientError(int eno)
+{
+ if (
+#ifdef EAGAIN
+ eno == EAGAIN ||
+#endif
+#ifdef EWOULDBLOCK
+ eno == EWOULDBLOCK ||
+#endif
+#ifdef EINTR
+ eno == EINTR ||
+#endif
+ eno == 0)
+ return TRUE ;
+ else
+ return FALSE ;
+}
+
+/*
+ * addrEq, addrFmt - utilities for handling address
+ */
+
+static BOOL addrEq(struct sockaddr *a1, struct sockaddr *a2)
+{
+ struct sockaddr_in *ip1 = (struct sockaddr_in *) a1 ;
+ struct sockaddr_in *ip2 = (struct sockaddr_in *) a2 ;
+
+ if (ip1->sin_addr.s_addr != ip2->sin_addr.s_addr) {
+ return FALSE ;
+ }
+ if (ip1->sin_port != ip2->sin_port) {
+ return FALSE ;
+ }
+ return TRUE ;
+}
+
+static u_char fmtbuff[64] ;
+
+static u_char *addrFmt(struct sockaddr *addr, int proto)
+{
+ struct sockaddr_in *iaddr = (struct sockaddr_in *) addr ;
+ u_char *ap ;
+ u_char *pp ;
+
+ ap = (u_char *) &iaddr->sin_addr ;
+ pp = (u_char *) &iaddr->sin_port ;
+
+ sprintf(fmtbuff, "%s:%d.%d.%d.%d:%d",
+ (proto == SOCK_STREAM ? "TCP" : "UDP"),
+ (ap[0] & 0xff), (ap[1] & 0xff), (ap[2] & 0xff), (ap[3] & 0xff),
+ ((pp[0] & 0xff) * 256 + (pp[1] & 0xff)) ) ;
+
+ return fmtbuff ;
+}
+
+/*
+ * netCreate, netDispose - create/dispose transport control block
+ */
+
+#define SZRCVBUF 1024
+
+static NETPTR netCreate(int sock, struct sockaddr *peer, int proto, int type)
+{
+ NETPTR pNet, prev, next ;
+ u_char *pBuf ;
+
+ if (listNet.prev == NULL || listNet.next == NULL) {
+ WARN("netCreate - transport list is not initialized\n") ;
+ listNet.prev = &listNet ;
+ listNet.next = &listNet ;
+ }
+
+ pNet = (NETPTR) xalloc(sizeof(NETREC)) ;
+ pBuf = (u_char *) xalloc(SZRCVBUF) ;
+
+ if (pNet == NULL || pBuf == NULL) {
+ WARN("netCreate - cannot allocate buffer\n") ;
+ if (pNet != NULL) xfree(pNet) ;
+ if (pBuf != NULL) xfree(pBuf) ;
+ return NULL ;
+ }
+ memset(pNet, 0, sizeof(NETREC)) ;
+
+ pNet->sock = sock ;
+ pNet->proto = proto ;
+ pNet->type = type ;
+
+ if (peer != NULL) {
+ memcpy(&pNet->peer, peer, sizeof(struct sockaddr)) ;
+ }
+
+ pNet->send.prev = &pNet->send ;
+ pNet->send.next = &pNet->send ;
+ pNet->recv.stat = RCV_STAT_LEN1 ;
+ pNet->recv.leng = 0 ;
+ pNet->recv.recv = 0 ;
+ pNet->recv.size = SZRCVBUF ;
+ pNet->recv.buff = pBuf ;
+
+ prev = listNet.prev ;
+ next = prev->next ;
+
+ prev->next = pNet ;
+ next->prev = pNet ;
+ pNet->prev = prev ;
+ pNet->next = next ;
+
+ return pNet ;
+}
+
+static void netDispose(NETPTR pNet)
+{
+ NETPTR p ;
+ SNDPTR pSnd ;
+
+ if (listNet.prev == NULL || listNet.next == NULL) {
+ WARN("netCreate - transport list is not initialized\n") ;
+ listNet.prev = &listNet ;
+ listNet.next = &listNet ;
+ }
+
+ /*
+ * unlink from transport list
+ */
+
+ for (p = listNet.next ; p != &listNet ; p = p->next) {
+ if (p == pNet) {
+ break ;
+ }
+ }
+ if (p == pNet) { /* safe to unlink it */
+ pNet->prev->next = pNet->next ;
+ pNet->next->prev = pNet->prev ;
+ }
+
+ /*
+ * dispose control block resources
+ */
+
+ if (pNet->send.prev == NULL || pNet->send.next == NULL) {
+ WARN("netDispose - un-initialized SNDREC\n") ;
+ pNet->send.prev = &pNet->send ;
+ pNet->send.next = &pNet->send ;
+ }
+ while ((pSnd = pNet->send.next) != &pNet->send) {
+ pSnd->prev->next = pSnd->next ;
+ pSnd->next->prev = pSnd->prev ;
+ xfree(pSnd) ;
+ }
+ if (pNet->recv.buff != NULL) {
+ xfree(pNet->recv.buff) ;
+ }
+ close(pNet->sock) ;
+ xfree(pNet) ;
+}
+
+/*
+ * netExpand - expand receive buffer
+ */
+
+static BOOL netExpand(NETPTR p)
+{
+ int len ;
+ u_char *np ;
+
+ if (p->recv.size > p->recv.leng) {
+ return TRUE ;
+ }
+
+ len = 1024 * ((p->recv.leng + 1023) / 1024) ;
+
+ TRACE("netExpand %d -> %d\n", p->recv.size, len) ;
+
+ if ((np = xalloc(len)) == NULL) {
+ WARN("netExpand - cannot allocate memory\n") ;
+ return FALSE ;
+ }
+ if (p->recv.recv > 0) {
+ memcpy(np, p->recv.buff, p->recv.recv) ;
+ }
+ xfree(p->recv.buff) ;
+ p->recv.buff = np ;
+ p->recv.size = len ;
+
+ return TRUE ;
+}
+
+/*
+ * tcpSend, tcpQueue, tcpFlush - send message over stream socket
+ *
+ * tcpSend - send message over TCP socket
+ * tcpQueue - en-queue message if stream blocked
+ * tcpFlush - flush pending messages
+ */
+
+static int tcpSend(int sock, u_char *msg, int len)
+{
+ int n, cnt = 0 ;
+
+ while (len > 0) {
+ if ((n = send(sock, msg, len, 0)) > 0) {
+ msg += n ;
+ len -= n ;
+ cnt += n ;
+ continue ;
+ }
+ if (!transientError(errno)) {
+ WARN("tcpSend - send error %d\n", errno) ;
+ return -1 ;
+ }
+ break ;
+ }
+ return cnt ;
+}
+
+static BOOL tcpQueue(NETPTR p, u_char *msg, int len)
+{
+ SNDPTR sp, prev, next ;
+
+ if ((sp = (SNDPTR) xalloc(sizeof(SNDREC) + len)) == NULL) {
+ WARN("tcpQueue - cannot allocate buffer\n") ;
+ return FALSE ;
+ }
+
+ sp->sent = 0 ;
+ sp->leng = len ;
+ sp->size = len ;
+ memcpy(sp->buff, msg, len) ;
+
+ prev = p->send.prev ;
+ next = prev->next ;
+ prev->next = sp ;
+ next->prev = sp ;
+ sp->next = next ;
+ sp->prev = prev ;
+
+ return TRUE ;
+}
+
+static BOOL tcpFlush(NETPTR p)
+{
+ SNDPTR sp ;
+ int n, len ;
+
+ if (p->proto != SOCK_STREAM) {
+ WARN("tcpFlush - flushing on non-stream socket\n") ;
+ return FALSE ;
+ }
+ if (p->send.prev == NULL || p->send.prev == NULL) {
+ WARN("tcpFlush - send buffer is not initialized\n") ;
+ p->send.prev = &p->send ;
+ p->send.next = &p->send ;
+ }
+
+ while ((sp = p->send.next) != &p->send) {
+
+ /*
+ * try to send data
+ */
+
+ if ((len = sp->leng - sp->sent) > 0) {
+ if ((n = tcpSend(p->sock, &sp->buff[sp->sent], len)) < 0) {
+ WARN("tcpFlush - send error %d\n", errno) ;
+ return FALSE ;
+ }
+ if (n == 0) {
+ TRACE("tcpFlush - blocked\n") ;
+ return TRUE ;
+ }
+ sp->sent += n ;
+ }
+
+ /*
+ * if no more data in send buffer, unlink and free
+ */
+
+ if ((len = sp->leng - sp->sent) <= 0) {
+ sp->prev->next = sp->next ;
+ sp->next->prev = sp->prev ;
+ xfree(sp) ;
+ }
+ }
+ return TRUE ;
+}
+
+/*
+ * Server Control Variables
+ */
+
+static BOOL servActive = FALSE ;
+
+static NETPTR listenTcp = NULL ; /* proxy's listening socket */
+static NETPTR listenUdp = NULL ; /* proxy's listening socket */
+
+static struct sockaddr serverDefaultAddr = { 0 } ;
+static BOOL serverRestrictPort = FALSE ;
+
+/*
+ * server_done - finalize server
+ *
+ * is also used when 'server_init' failed in initialization sequence
+ *
+ * using module level utilities
+ *
+ * netDispose dispose transport control block
+ */
+
+void server_done(void)
+{
+ NETPTR p ;
+
+ if (listNet.prev == NULL || listNet.next == NULL) {
+ listNet.prev = &listNet ;
+ listNet.next = &listNet ;
+ }
+ while ((p = listNet.next) != &listNet) {
+ netDispose(p) ;
+ }
+}
+
+/*
+ * server_init - initialize server
+ *
+ * using sub-functions
+ *
+ * initTcp create socket to listening TCP connection
+ * initUdp create socket to listening UDP message
+ *
+ * and also using module level utilities
+ *
+ * netCreate create transport control block
+ *
+ * also use 'server_done' to cleanup resources
+ */
+
+static NETPTR initTcp(void)
+{
+ NETPTR p ;
+ int sock ;
+ int one = 1 ;
+ struct sockaddr addr ;
+
+ if (config_query_listen(&addr) != TRUE) {
+ WARN("initTcp - no listen address\n") ;
+ return NULL ;
+ }
+
+ if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ WARN("initTcp - cannot create TCP socket\n") ;
+ return NULL ;
+ }
+
+ setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) ;
+
+ if (bind(sock, &addr, sizeof(addr)) < 0) {
+ WARN("initTcp - cannot bind TCP socket\n") ;
+ close(sock) ;
+ return NULL ;
+ }
+ if (listen(sock, 5) < 0) {
+ WARN("initTcp - cannot listen on TCP socket\n") ;
+ close(sock) ;
+ return NULL ;
+ }
+ if ((p = netCreate(sock, &addr, SOCK_STREAM, NET_LISTEN)) == NULL) {
+ WARN("initTcp - cannot create control block\n") ;
+ close(sock) ;
+ return NULL ;
+ }
+ return p ;
+}
+
+static NETPTR initUdp(void)
+{
+ NETPTR p ;
+ int sock ;
+ int one = 1 ;
+ struct sockaddr addr ;
+
+ if (config_query_listen(&addr) != TRUE) {
+ WARN("initUdp - no listen address\n") ;
+ return NULL ;
+ }
+
+ if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ WARN("initUdp - cannot create UDP socket\n") ;
+ return NULL ;
+ }
+
+ setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) ;
+
+ if (bind(sock, &addr, sizeof(addr)) < 0) {
+ WARN("initUdp- cannot bind UDP socket\n") ;
+ close(sock) ;
+ return NULL ;
+ }
+ if ((p = netCreate(sock, &addr, SOCK_DGRAM, NET_LISTEN)) == NULL) {
+ WARN("initUdp - cannot create control block\n") ;
+ close(sock) ;
+ return NULL ;
+ }
+ return p ;
+}
+
+/*
+ * server_init - initialize proxy server
+ */
+
+BOOL server_init(int ac, char *av[])
+{
+ /*
+ * initialize transport list
+ */
+
+ listNet.prev = &listNet ;
+ listNet.next = &listNet ;
+
+ /*
+ * setup transports
+ */
+
+ listenTcp = initTcp() ;
+ listenUdp = initUdp() ;
+
+ if (listenTcp == NULL || listenUdp == NULL) {
+ WARN("server_init - cannot create proxy's listening port\n") ;
+ server_done() ;
+ return FALSE ;
+ }
+
+ if (config_query_forward(&serverDefaultAddr) != TRUE) {
+ WARN("server_init - no DNS server address\n") ;
+ server_done() ;
+ return FALSE ;
+ }
+ if (config_query_restrict(&serverRestrictPort) != TRUE) {
+ WARN("server_init - cannot query 'serverRestrictPort' flag\n") ;
+ server_done() ;
+ return FALSE ;
+ }
+
+ /*
+ * also initialize translator
+ */
+
+ if (translate_initialize() != TRUE) {
+ WARN("server_init - translation configuration failed\n") ;
+ server_done() ;
+ return FALSE ;
+ }
+
+ /*
+ * now server is ready, turn on active flags now
+ */
+
+ servActive = TRUE ;
+
+ return TRUE ;
+}
+
+/*
+ * server_stop - request to stop server
+ *
+ * simply turn off 'servActive' control flag.
+ * then 'server_loop' terminate
+ */
+
+void server_stop(void)
+{
+ servActive = FALSE ;
+}
+
+/*
+ * server_loop - proxy server's message loop
+ *
+ * using sub-funcstions
+ *
+ * setRdFds listup sockets to check read ready
+ * setWtFds listup sockets to check write ready
+ * sockAccept accept connection from client
+ * sockRecvTcp receive message over TCP
+ * sockRecvUdp receive message over UDP
+ * sockDispatch dispatch on ready sockets
+ * sockValidate validate sockets
+ * timerDispatch entry of timer processing
+ *
+ * and also using module level utilities
+ *
+ * netCreate create transport control block
+ * netDispose dispose transport control block
+ * tcpFlush send pending message
+ * addrFmt formatting address (& proto)
+ */
+
+/*
+ * setRdFds, setWtFds - listup socket to check if ready
+ */
+
+static int setRdFds(fd_set *rfds)
+{
+ int maxfd = 0 ;
+ NETPTR p ;
+
+ /*
+ * listup sockets to check read ready
+ */
+
+ if (listNet.prev == NULL || listNet.next == NULL) {
+ WARN("setRdFds - listNet is not initialized\n") ;
+ listNet.prev = &listNet ;
+ listNet.next = &listNet ;
+ }
+ for (p = listNet.next ; p != &listNet ; p = p->next) {
+ FD_SET(p->sock, rfds) ;
+ maxfd = max(maxfd, p->sock) ;
+ }
+ return maxfd ;
+}
+
+static int setWtFds(fd_set *wfds)
+{
+ int maxfd = 0 ;
+ NETPTR p ;
+
+ /*
+ * listup sockets to check read ready
+ */
+
+ if (listNet.prev == NULL || listNet.next == NULL) {
+ WARN("setRdFds - listNet is not initialized\n") ;
+ listNet.prev = &listNet ;
+ listNet.next = &listNet ;
+ }
+ for (p = listNet.next ; p != &listNet ; p = p->next) {
+ if (p->send.prev == NULL || p->send.next == NULL) {
+ WARN("setWtFds - send buffer is not initialized\n") ;
+ p->send.prev = &p->send ;
+ p->send.next = &p->send ;
+ }
+ if (p->send.next != &p->send) {
+ FD_SET(p->sock, wfds) ;
+ maxfd = max(maxfd, p->sock) ;
+ }
+ }
+ return maxfd ;
+}
+
+/*
+ * sockAccept - accept connection from client
+ */
+
+static BOOL sockAccept(NETPTR p)
+{
+ NETPTR np ;
+ int ns, addrlen ;
+ struct sockaddr addr ;
+ struct sockaddr peer ;
+
+ memset(&addr, 0, sizeof(addr)) ;
+ memset(&peer, 0, sizeof(peer)) ;
+
+ addrlen = sizeof(addr) ;
+
+ if ((ns = accept(p->sock, &addr, &addrlen)) < 0) {
+ WARN("sockAccept - cannot accept connection %d\n", errno) ;
+ return FALSE ;
+ }
+
+ addrlen = sizeof(peer) ;
+ getpeername(ns, &peer, &addrlen) ;
+
+ if ((np = netCreate(ns, &peer, SOCK_STREAM, NET_CLIENT)) == NULL) {
+ WARN("sockAccept - cannot create control block\n") ;
+ close(ns) ;
+ return FALSE ;
+ }
+
+ TRACE("sockAccept - accept connection from %s on socket %d\n", addrFmt(&peer, SOCK_STREAM), ns) ;
+
+ return TRUE ;
+}
+
+/*
+ * sockRecvTcp, sockRecvUdp - receive message
+ *
+ * when message complete, call 'notify_message' to
+ * notify message arrival.
+ */
+
+static BOOL sockRecvTcp(NETPTR p)
+{
+ int n, len ;
+ u_char buff[2] ;
+ u_char *bp ;
+
+ /*
+ * validate transport
+ */
+
+ if (p == NULL || p->proto != SOCK_STREAM) {
+ WARN("sockRecvTcp - bad parameter\n") ;
+ return FALSE ;
+ }
+ if (p->recv.buff == NULL || p->recv.size == 0) {
+ WARN("sockRecvTcp - no receiver buffer\n") ;
+ return FALSE ;
+ }
+
+ /*
+ * when receiving message over TCP, constuct state machine with
+ * RCVBUF's status.
+ */
+
+ if (p->recv.stat == RCV_STAT_LEN1) {
+ if ((n = recv(p->sock, buff, 2, 0)) <= 0) {
+ if (errno == EWOULDBLOCK) {
+ return TRUE ;
+ }
+ WARN("sockRecvTcp - recv error %d on socket %d, STAT_LEN1\n", errno, p->sock) ;
+ return FALSE ;
+ }
+ if (n == 1) {
+ p->recv.leng = ((int) (buff[0] & 0xff)) * 256 ;
+ p->recv.stat = RCV_STAT_LEN2 ;
+ return TRUE ; /* blocked, try later */
+ }
+ p->recv.leng = ((int) (buff[0] & 0xff)) * 256 + ((int) (buff[1] & 0xff)) ;
+ p->recv.stat = RCV_STAT_DATA ;
+ /* then fall through */
+ }
+
+ if (p->recv.stat == RCV_STAT_LEN2) {
+ if ((n = recv(p->sock, buff, 1, 0)) <= 0) {
+ if (errno == EWOULDBLOCK) {
+ return TRUE ;
+ }
+ WARN("sockRecvTcp - recv error %d on socket %d, STAT_LEN2\n", errno, p->sock) ;
+ return FALSE ;
+ }
+ p->recv.leng += ((int) (buff[0] & 0xff)) ;
+ p->recv.stat = RCV_STAT_DATA ;
+ /* then fall through */
+ }
+
+ if (p->recv.stat == RCV_STAT_DATA) {
+ if (p->recv.size < p->recv.leng) {
+ if (netExpand(p) != TRUE) {
+ WARN("sockRecvTcp - cannot expand recv buffer\n") ;
+ return FALSE ;
+ }
+ }
+
+ bp = &p->recv.buff[p->recv.recv] ;
+ len = p->recv.leng - p->recv.recv ;
+
+ if ((n = recv(p->sock, bp, len, 0)) <= 0) {
+ if (errno == EWOULDBLOCK) {
+ return TRUE ;
+ }
+ WARN("sockRecvTcp - recv error %d on socket %d, STAT_DATA %d (%d/%d)\n",
+ errno, p->sock, len, p->recv.recv, p->recv.leng) ;
+ return FALSE ;
+ }
+ if ((p->recv.recv += n) < p->recv.leng) {
+ return TRUE ; /* still in-complete */
+ }
+
+ /*
+ * message complete, notify it
+ */
+
+ notify_message(&p->peer, SOCK_STREAM, p->recv.buff, p->recv.leng) ;
+
+ /*
+ * reset recv buffer
+ */
+
+ p->recv.stat = RCV_STAT_LEN1 ;
+ p->recv.leng = 0 ;
+ p->recv.recv = 0 ;
+
+ return TRUE ;
+ }
+ WARN("sockRecvTcp - something wrong\n") ;
+ return FALSE ;
+}
+
+static BOOL sockRecvUdp(NETPTR p)
+{
+ int n, fromlen ;
+ struct sockaddr fromaddr ;
+
+ /*
+ * validate transport
+ */
+
+ if (p == NULL || p->proto != SOCK_DGRAM) {
+ WARN("sockRecvUdp - bad parameter\n") ;
+ return FALSE ;
+ }
+ if (p->recv.buff == NULL || p->recv.size == 0) {
+ WARN("sockRecvUdp - no receiver buffer\n") ;
+ return FALSE ;
+ }
+
+ /*
+ * receive over UDP
+ */
+
+ fromlen = sizeof(fromaddr) ;
+
+ n = recvfrom(p->sock, p->recv.buff, p->recv.size, 0, &fromaddr, &fromlen) ;
+
+ if (n == 0) {
+ WARN("sockRecvUdp - no data\n") ;
+ return TRUE ;
+ } else if (n < 0) {
+ if (transientError(errno))
+ return TRUE ;
+ switch (errno) {
+#ifdef ECONNREFUSED
+ case ECONNREFUSED:
+#endif
+#ifdef ENETUNREACH
+ case ENETUNREACH:
+#endif
+#ifdef EHOSTUNREACH
+ case EHOSTUNREACH:
+#endif
+ WARN("sockRecvUdp - recv error %d (ignored)\n", errno) ;
+ return TRUE ;
+ default:
+ WARN("sockRecvUdp - recv error %d\n", errno) ;
+ return FALSE ;
+ }
+ }
+
+ /*
+ * notify message arrival
+ */
+
+ notify_message(&fromaddr, SOCK_DGRAM, p->recv.buff, n) ;
+
+ return TRUE ;
+}
+
+/*
+ * sockDispatch - process on ready sockets
+ */
+
+static void sockDispatch(int nfds, fd_set *rfds, fd_set *wfds)
+{
+ NETPTR p, np ;
+ BOOL stat ;
+
+ /*
+ * process on ready sockets
+ */
+
+ if (listNet.prev == NULL || listNet.next == NULL) {
+ WARN("sockDispatch - listNet is not initialized\n") ;
+ listNet.prev = &listNet ;
+ listNet.next = &listNet ;
+ }
+ for (p = listNet.next ; p != &listNet ; p = np) {
+
+ np = p->next ;
+ stat = TRUE ; /* assume no problem */
+
+ /*
+ * if receiving socket ready, then
+ *
+ * LISTEN TCP accept connection
+ * LISTEN UDP receive message
+ * CLIENT receive message
+ * SERVER receive message
+ */
+
+ if (stat == TRUE && FD_ISSET(p->sock, rfds)) {
+ if (p->type != NET_LISTEN) {
+ if (p->proto == SOCK_STREAM) {
+ stat = sockRecvTcp(p) ;
+ } else {
+ stat = sockRecvUdp(p) ;
+ }
+ } else if (p->proto == SOCK_DGRAM) {
+ stat = sockRecvUdp(p) ;
+ } else { /* connect request on listening TCP socket */
+ stat = sockAccept(p) ;
+ }
+ }
+
+ /*
+ * if send socket ready, then send pending message
+ *
+ * don't check transport type, protocol, but
+ * this happens only for TCP socket to CLIENT/SERVER
+ */
+
+ if (stat == TRUE && FD_ISSET(p->sock, wfds)) {
+ tcpFlush(p) ;
+ }
+
+ /*
+ * if something wrong on socket, dispose it
+ */
+
+ if (stat != TRUE) {
+ if (p->type == NET_LISTEN || p->proto == SOCK_DGRAM) {
+ WARN("sockDispatch - error on listening socket\n") ;
+ server_stop() ;
+ } else {
+ WARN("sockDispatch - error on socket %d\n", p->sock) ;
+ }
+ netDispose(p) ;
+ }
+ }
+}
+
+/*
+ * sockValidate - validate socket when select error
+ */
+
+static void sockValidate(int nfds, fd_set *rfds, fd_set *wfds)
+{
+ NETPTR p, np ;
+ fd_set fds ;
+ struct timeval tm ;
+
+ TRACE("sockValidate\n") ;
+
+ FD_ZERO(&fds) ;
+ tm.tv_sec = 0 ;
+ tm.tv_usec = 0 ;
+
+ if (listNet.prev == NULL || listNet.next == NULL) {
+ WARN("sockValidate - listNet is not initialized\n") ;
+ listNet.prev = &listNet ;
+ listNet.next = &listNet ;
+ }
+
+ for (p = listNet.next ; p != &listNet ; p = np) {
+
+ np = p->next ;
+
+ /*
+ * check if socket is still available
+ */
+
+ FD_SET(p->sock, &fds) ;
+
+ if (!FD_ISSET(p->sock, rfds) && !FD_ISSET(p->sock, wfds)) {
+ FD_CLR(p->sock, &fds) ;
+ continue ;
+ }
+ if (select(p->sock + 1, &fds, NULL, NULL, &tm) >= 0) {
+ FD_CLR(p->sock, &fds) ;
+ continue ;
+ }
+ FD_CLR(p->sock, &fds) ;
+
+ /*
+ * something wrong on socket
+ */
+
+ if (p->type == NET_LISTEN) {
+ WARN("sockValidate - closed listening socket\n") ;
+ server_stop() ;
+ } else {
+ WARN("sockValidate - closed socket %d\n", p->sock) ;
+ }
+ netDispose(p) ;
+ }
+}
+
+/*
+ * timerDispatch - entry of timer processing
+ */
+
+static time_t timeLast = 0 ; /* last time of timer process */
+static time_t timeWait = 10 ; /* wait till next timer process */
+
+static void timerDispatch(void)
+{
+ time_t t = time(NULL) ;
+
+ /*
+ * do timer process every 'timeWait' interval
+ */
+
+ if ((t - timeLast) < timeWait) {
+ return ;
+ }
+
+ /*
+ * call timer processes here
+ */
+
+ notify_timer() ;
+
+ /*
+ * update timer
+ */
+
+ timeLast = t ;
+}
+
+/*
+ * server_loop - proxy's main, select loop
+ */
+
+void server_loop(void)
+{
+ struct timeval tm ;
+ fd_set rfds, wfds ;
+ int maxrfd, maxwfd ;
+ int n, nfds ;
+
+ while (servActive) {
+
+ FD_ZERO(&rfds) ;
+ FD_ZERO(&wfds) ;
+
+ maxrfd = setRdFds(&rfds) ;
+ maxwfd = setWtFds(&wfds) ;
+ nfds = max(maxrfd, maxwfd) + 1 ;
+
+ tm.tv_sec = 10 ;
+ tm.tv_usec = 0 ;
+
+ if (maxwfd == 0) {
+ n = select(nfds, &rfds, NULL, NULL, &tm) ;
+ } else {
+ n = select(nfds, &rfds, &wfds, NULL, &tm) ;
+ }
+
+ if (n > 0) {
+ sockDispatch(nfds, &rfds, &wfds) ;
+ } else if (n < 0) {
+ if (!transientError(errno)) {
+ sockValidate(nfds, &rfds, &wfds) ;
+ }
+ }
+ timerDispatch() ;
+#ifdef DEBUG
+ fflush(stdout) ;
+ fflush(stderr) ;
+#endif
+ log_turnover();
+ }
+}
+
+/*
+ * Server's entries for send message (forward or response)
+ *
+ * server_forward forward request to DNS server
+ * server_response send back response to client
+ *
+ * using sub-functions,
+ *
+ * openTcp open TCP connection to the upstream server
+ * openUdp open UDP transport to the upstream server
+ * getServer get transport to the upstream server
+ * getClient get transport to responding client
+ * sendTcp send message via TCP
+ * sendUdp send message via UDP
+ *
+ * and also using module level utilities,
+ *
+ * netCreate create transport control block
+ * tcpSend send message over TCP socket
+ * tcpQueue enqueue if TCP blocked
+ * addrEq check if addresses are same
+ * addrFmt formatting address (& proto)
+ */
+
+/*
+ * openTcp, openUdp - create TCP/UDP transport to DNS server
+ */
+
+static NETPTR openTcp(struct sockaddr *to)
+{
+ int sock ;
+ NETPTR p ;
+
+ TRACE("openTcp - creating transport to %s\n", addrFmt(to, SOCK_STREAM)) ;
+
+ if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ WARN("openTcp - cannote create socket %d\n", errno) ;
+ return NULL ;
+ }
+ if (connect(sock, to, sizeof(struct sockaddr)) < 0) {
+ WARN("openTcp - cannot connect to server %d\n", errno) ;
+ close(sock) ;
+ return NULL ;
+ }
+ if ((p = netCreate(sock, to, SOCK_STREAM, NET_SERVER)) == NULL) {
+ WARN("openTcp - cannot create control block\n") ;
+ close(sock) ;
+ return NULL ;
+ }
+ return p ;
+}
+
+static NETPTR openUdp(struct sockaddr *to)
+{
+ int sock ;
+ NETPTR p ;
+ struct sockaddr_in saddr ; /* source port */
+
+ TRACE("openUdp - creating transport to %s\n", addrFmt(to, SOCK_DGRAM)) ;
+
+ memset(&saddr, 0, sizeof(saddr)) ;
+ saddr.sin_family = AF_INET ;
+ saddr.sin_addr.s_addr = htonl(INADDR_ANY) ;
+ saddr.sin_port = htons(0) ;
+
+ if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ WARN("openUdp - cannote create socket %d\n", errno) ;
+ return NULL ;
+ }
+ if (bind(sock, (struct sockaddr *) &saddr, sizeof(saddr)) < 0) {
+ WARN("openUdp - cannot bind source port\n") ;
+ close(sock) ;
+ return NULL ;
+ }
+ if (connect(sock, to, sizeof(struct sockaddr)) < 0) {
+ WARN("openUdp - cannot connect to server\n") ;
+ close(sock) ;
+ return NULL ;
+ }
+ if ((p = netCreate(sock, to, SOCK_DGRAM, NET_SERVER)) == NULL) {
+ WARN("openUdp - cannot create control block\n") ;
+ close(sock) ;
+ return NULL ;
+ }
+ return p ;
+}
+
+/*
+ * getServer - search/create transport to the DNS server
+ */
+
+static NETPTR getServer(struct sockaddr *to, int proto)
+{
+ NETPTR p ;
+
+ /*
+ * if proxy should use DNS port to communicate DNS server,
+ * use proxy's listen port to forward request to the server
+ */
+
+ if (proto == SOCK_DGRAM && serverRestrictPort) {
+ return listenUdp ;
+ }
+
+ /*
+ * search transport to specified DNS server
+ */
+
+ if (listNet.prev == NULL || listNet.next == NULL) {
+ WARN("getServer - listNet is not initialized\n") ;
+ listNet.prev = &listNet ;
+ listNet.next = &listNet ;
+ }
+ for (p = listNet.next ; p != &listNet ; p = p->next) {
+ if (p->proto != proto || p->type != NET_SERVER) {
+ continue ;
+ }
+ if (addrEq(&p->peer, to)) {
+ return p ;
+ }
+ }
+
+ /*
+ * if not exist, create new one
+ */
+
+ if (proto == SOCK_STREAM) {
+ p = openTcp(to) ;
+ } else {
+ p = openUdp(to) ;
+ }
+ return p ;
+}
+
+/*
+ * getClient - search transport to the client
+ */
+
+static NETPTR getClient(struct sockaddr *to, int proto)
+{
+ NETPTR p ;
+
+ /*
+ * for response using UDP, use proxy's UDP socket
+ */
+
+ if (proto == SOCK_DGRAM) {
+ return listenUdp ;
+ }
+
+ /*
+ * otherwise (TCP), use existing transport to the client
+ */
+
+ if (listNet.prev == NULL || listNet.next == NULL) {
+ WARN("getClient - listNet is not initialized\n") ;
+ listNet.prev = &listNet ;
+ listNet.next = &listNet ;
+ }
+ for (p = listNet.next ; p != &listNet ; p = p->next) {
+ if (p->proto != proto || p->type != NET_CLIENT) {
+ continue ;
+ }
+ if (addrEq(&p->peer, to)) {
+ return p ;
+ }
+ }
+ return NULL ;
+}
+
+/*
+ * sendTcp, sendUdp - send message over TCP/UDP
+ */
+
+static void sendTcp(NETPTR p, u_char *msg, int len)
+{
+ int n ;
+ u_char buff[1024] ;
+ u_char *bp ;
+
+ /*
+ * insert 2 bytes message length field before the message
+ */
+
+ if (len < (1024 - 2)) {
+ bp = buff ;
+ } else {
+ bp = malloc(len + 2) ;
+ }
+ if (bp == NULL) {
+ WARN("sendTcp - cannot alocate send buffer\n") ;
+ return ;
+ }
+ bp[0] = len / 256 ;
+ bp[1] = len % 256 ;
+ memcpy(&bp[2], msg, len) ;
+ len += 2 ;
+
+ /*
+ * if there is pending data, enqueue sending message
+ */
+
+ if (p->send.prev == NULL || p->send.next == NULL) {
+ WARN("sendTcp - send buffer is not initialized\n") ;
+ p->send.prev = &p->send ;
+ p->send.next = &p->send ;
+ }
+ if (p->send.next != &p->send) {
+ tcpQueue(p, bp, len) ;
+ if (bp != buff) free(bp) ;
+ return ;
+ }
+
+ /*
+ * then, try to send message
+ */
+
+ if ((n = tcpSend(p->sock, bp, len)) < 0) {
+ WARN("sendTcp - cannot send message\n") ;
+ if (bp != buff) free(bp) ;
+ return ;
+ }
+ if (n != len) {
+ tcpQueue(p, (bp + n), (len - n)) ;
+ }
+ if (bp != buff) free(bp) ;
+}
+
+static void sendUdp(NETPTR p, u_char *msg, int len, struct sockaddr *to)
+{
+ int n ;
+
+ if (p->type == NET_SERVER) { /* target is binded */
+ n = send(p->sock, msg, len, 0) ;
+ } else { /* need to specify target */
+ n = sendto(p->sock, msg, len, 0, to, sizeof(struct sockaddr)) ;
+ }
+ if (n < 0) {
+ if (!transientError(errno)) {
+ WARN("sendUdp - cannot send message %d\n", errno) ;
+ }
+ return ;
+ }
+ if (n != len) {
+ WARN("sendUdp - cannot send entire message %d/%d\n", n, len) ;
+ return ;
+ }
+}
+
+/*
+ * server_forward - forward request to the DNS server
+ */
+
+void server_forward(struct sockaddr *to, int proto, u_char *msg, int len)
+{
+ NETPTR p ;
+
+ if (to == NULL) {
+ to = &serverDefaultAddr ;
+ }
+ if ((p = getServer(to, proto)) == NULL) {
+ WARN("server_forward - no transport to server %s\n", addrFmt(to, proto)) ;
+ return ;
+ }
+ if (proto == SOCK_STREAM) {
+ sendTcp(p, msg, len) ;
+ } else {
+ sendUdp(p, msg, len, to) ;
+ }
+}
+
+/*
+ * server_response - response to cllient
+ */
+
+void server_response(struct sockaddr *to, int proto, u_char *msg, int len)
+{
+ NETPTR p ;
+
+ if ((p = getClient(to, proto)) == NULL) {
+ WARN("server_response - no transport to client %s\n", addrFmt(to, proto)) ;
+ return ;
+ }
+ if (proto == SOCK_STREAM) {
+ sendTcp(p, msg, len) ;
+ } else {
+ sendUdp(p, msg, len, to) ;
+ }
+}
diff --git a/contrib/idn/mdnkit/dnsproxy/translate.c b/contrib/idn/mdnkit/dnsproxy/translate.c
new file mode 100644
index 00000000..0fa45b7a
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/translate.c
@@ -0,0 +1,521 @@
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef lint
+static char *rcsid = "$Id: translate.c,v 1.1 2000/12/07 00:52:20 tale Exp $";
+#endif
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdarg.h>
+#include <stdlib.h>
+
+#ifdef WIN32
+#include <windows.h>
+#include <winsock.h>
+#else /* for normal systems */
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#endif
+
+#include <mdn/result.h>
+#include <mdn/log.h>
+#include <mdn/converter.h>
+#include <mdn/normalizer.h>
+#include <mdn/translator.h>
+#include <mdn/zldrule.h>
+#include <mdn/msgtrans.h>
+
+#include "dnsproxy.h"
+
+/*
+ * Configuration file keywords.
+ */
+#define KW_LOG_LEVEL "mdn-log-level" /* tentative */
+#define KW_ALIAS_FILE "encoding-alias-file"
+#define KW_CLIENT_TRANSLATION "client-translation"
+#define KW_ALTERNATE_ENCODING "alternate-encoding"
+#define KW_NORMALIZATION "normalize"
+#define KW_SERVER_TRANSLATION "server-translation"
+
+/*
+ * DNS message rcode.
+ */
+enum {
+ RCODE_NO_ERROR = 0,
+ RCODE_FORMAT_ERROR = 1,
+ RCODE_SERVER_FAILURE = 2,
+ RCODE_NAME_ERROR = 3,
+ RCODE_NOT_IMPLEMENTED = 4,
+ RCODE_REFUSED = 5
+};
+
+typedef struct translation {
+ mdn_zldrule_t rule;
+ char *server_zld;
+ mdn_converter_t server_converter;
+ mdn_normalizer_t normalizer;
+ mdn_converter_t alternate_converter;
+} translation_t;
+
+static translation_t trans;
+
+static int result_to_rcode(mdn_result_t r);
+static char *address_to_string(struct sockaddr *sa);
+static int string_to_loglevel(char *s);
+static void config_required(char *keyword);
+static void mdnerror(int code, char *fmt, ...);
+static void translate_log_handler(int level, const char *msg);
+
+
+BOOL
+translate_initialize(void)
+{
+ mdn_result_t r;
+ config_ctx_t cctx;
+ int ac;
+ char **av;
+ int i;
+
+ TRACE("translate_initialize()\n");
+
+ /*
+ * Set MDN library log handler.
+ */
+ mdn_log_setproc(translate_log_handler);
+
+ /*
+ * Set log level before calling any other functions in
+ * MDN library.
+ */
+ if (config_query_value(KW_LOG_LEVEL, &ac, &av)) {
+ int level;
+
+ if (ac != 2) {
+ WARN("syntax error at %s line\n", KW_LOG_LEVEL);
+ return FALSE;
+ }
+ if ((level = string_to_loglevel(av[1])) >= 0) {
+ mdn_log_setlevel(level);
+ } else {
+ WARN("unknown log level %.100s -- ignored\n", av[1]);
+ }
+ }
+
+ /*
+ * Initialize modules.
+ */
+ mdn_converter_initialize();
+ mdn_normalizer_initialize();
+
+ /*
+ * Create context.
+ */
+ if ((r = mdn_zldrule_create(&trans.rule)) != mdn_success) {
+ mdnerror(r, "initializing ZLD rules");
+ return FALSE;
+ }
+ if ((r = mdn_normalizer_create(&trans.normalizer)) != mdn_success) {
+ mdnerror(r, "initializing normalization");
+ return FALSE;
+ }
+
+ /*
+ * Load configuration data other than log level.
+ */
+
+ /*
+ * Encoding alias file.
+ */
+ if (config_query_value(KW_ALIAS_FILE, &ac, &av)) {
+ if (ac != 2) {
+ WARN("syntax error at %s line\n", KW_ALIAS_FILE);
+ return FALSE;
+ }
+ if ((r = mdn_converter_aliasfile(av[1])) != mdn_success) {
+ mdnerror(r, "reading codeset alias file %.200s", av[1]);
+ return FALSE;
+ }
+ }
+
+ /*
+ * Client-side translation rule.
+ */
+ if ((cctx = config_query_open(KW_CLIENT_TRANSLATION, &ac, &av)) == NULL) {
+ config_required(KW_CLIENT_TRANSLATION);
+ return FALSE;
+ }
+ do {
+ if (ac < 3) {
+ WARN("syntax error at %s line\n", KW_ALIAS_FILE);
+ return FALSE;
+ }
+#ifndef MDN_SUPPORT_ZLD
+ if (strcmp(av[1], "") != 0 && strcmp(av[1], ".") != 0) {
+ WARN("ignore ZLD %s\n", av[1]);
+ }
+#endif
+ r = mdn_zldrule_add(trans.rule, av[1], (const char **)&av[2], ac - 2);
+ if (r != mdn_success) {
+ mdnerror(r, "adding ZLD rules for %s", av[1]);
+ return FALSE;
+ }
+ } while ((cctx = config_query_more(cctx, &ac, &av)) != NULL);
+ config_query_close(cctx);
+
+ /*
+ * Client-side alternate encoding.
+ */
+ if (config_query_value(KW_ALTERNATE_ENCODING, &ac, &av)) {
+ if (ac != 2) {
+ WARN("syntax error at %s line\n", KW_ALTERNATE_ENCODING);
+ return FALSE;
+ }
+ if ((r = mdn_converter_create(av[1], &trans.alternate_converter, 0))
+ != mdn_success) {
+ mdnerror(r, "alternate encoding %s", av[2]);
+ return FALSE;
+ }
+ if (!mdn_converter_isasciicompatible(trans.alternate_converter)) {
+ WARN("alternate encoding must be ASCII-compatible\n");
+ return FALSE;
+ }
+ } else {
+ trans.alternate_converter = NULL;
+ }
+
+ /*
+ * Normalization.
+ */
+ if (!config_query_value(KW_NORMALIZATION, &ac, &av)) {
+ config_required(KW_NORMALIZATION);
+ return FALSE;
+ }
+ for (i = 1; i < ac; i++) {
+ if ((r = mdn_normalizer_add(trans.normalizer, av[i])) != mdn_success) {
+ mdnerror(r, "adding normalization scheme %s", av[i]);
+ return FALSE;
+ }
+ }
+
+ /*
+ * Server-side translation.
+ */
+ if (!config_query_value(KW_SERVER_TRANSLATION, &ac, &av)) {
+ config_required(KW_SERVER_TRANSLATION);
+ return FALSE;
+ }
+ if (ac != 3) {
+ WARN("syntax error at %s line\n", KW_SERVER_TRANSLATION);
+ return FALSE;
+ }
+ if ((r = mdn_translator_canonicalzld(av[1], &trans.server_zld))
+ != mdn_success) {
+ mdnerror(r, "server-side ZLD %s", av[2]);
+ return FALSE;
+ }
+#ifndef MDN_SUPPORT_ZLD
+ if (trans.server_zld != NULL) {
+ WARN("ignore ZLD %s\n", av[1]);
+ free(trans.server_zld);
+ trans.server_zld = NULL;
+ }
+#endif
+ if ((r = mdn_converter_create(av[2], &trans.server_converter, 0))
+ != mdn_success) {
+ mdnerror(r, "server-side encoding %s", av[2]);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+void
+translate_finish(void)
+{
+ if (trans.rule != NULL) {
+ mdn_zldrule_destroy(trans.rule);
+ trans.rule = NULL;
+ }
+ if (trans.server_zld != NULL) {
+ free(trans.server_zld);
+ trans.server_zld = NULL;
+ }
+ if (trans.server_converter != NULL) {
+ mdn_converter_destroy(trans.server_converter);
+ trans.server_converter = NULL;
+ }
+ if (trans.normalizer != NULL) {
+ mdn_normalizer_destroy(trans.normalizer);
+ trans.normalizer = NULL;
+ }
+ if (trans.alternate_converter != NULL) {
+ mdn_converter_destroy(trans.alternate_converter);
+ trans.alternate_converter = NULL;
+ }
+}
+
+int
+translate_request(translation_context_t *ctx,
+ const char *msg, size_t msglen,
+ char *translated, size_t bufsize, size_t *translatedlenp)
+{
+ mdn_msgtrans_param_t param;
+ mdn_result_t r;
+
+ TRACE("translate_request()\n");
+
+ ctx->zld = NULL;
+ ctx->converter = NULL;
+
+ /*
+ * Initialize translation parameters.
+ */
+ param.use_local_rule = 1;
+ param.local_rule = trans.rule;
+ param.local_converter = NULL;
+ param.local_zld = NULL;
+ param.local_alt_converter = trans.alternate_converter;
+ param.target_converter = trans.server_converter;
+ param.target_alt_converter = NULL;
+ param.target_zld = trans.server_zld;
+ param.normalizer = trans.normalizer;
+
+ r = mdn_msgtrans_translate(&param, msg, msglen,
+ translated, bufsize, translatedlenp);
+
+ if (r != mdn_success) {
+ mdnerror(r, "translating request message from %s(%s)",
+ address_to_string(ctx->client),
+ ctx->protocol == SOCK_STREAM ? "tcp" : "udp");
+ } else {
+ ctx->zld = param.local_zld;
+ ctx->converter = param.local_converter;
+ }
+
+ return result_to_rcode(r);
+}
+
+int
+translate_reply(translation_context_t *ctx,
+ const char *msg, size_t msglen,
+ char *translated, size_t bufsize, size_t *translatedlenp)
+{
+ mdn_msgtrans_param_t param;
+ mdn_result_t r;
+
+ TRACE("translate_reply()\n");
+
+ if (ctx->converter == NULL) {
+ /*
+ * No translation required.
+ */
+ TRACE("translate_reply: pass through message (old_id=%d,new_id=%d)\n",
+ ctx->old_id, ctx->new_id);
+ if (bufsize < msglen)
+ return (RCODE_SERVER_FAILURE);
+ (void)memcpy(translated, msg, msglen);
+ *translatedlenp = msglen;
+ return RCODE_NO_ERROR;
+ }
+
+ /*
+ * Initialize translation parameters.
+ */
+ param.use_local_rule = 0;
+ param.local_rule = NULL;
+ param.local_converter = trans.server_converter;
+ param.local_zld = trans.server_zld;
+ param.local_alt_converter = NULL;
+ param.target_converter = ctx->converter;
+ param.target_alt_converter = trans.alternate_converter;
+ param.target_zld = ctx->zld;
+ param.normalizer = NULL;
+
+ r = mdn_msgtrans_translate(&param, msg, msglen,
+ translated, bufsize, translatedlenp);
+
+ if (r != mdn_success) {
+ mdnerror(r, "translating reply message from %s",
+ address_to_string(ctx->client));
+ }
+
+ return result_to_rcode(r);
+}
+
+static int
+result_to_rcode(mdn_result_t r)
+{
+ int rcode;
+
+ switch (r) {
+ case mdn_success:
+ rcode = RCODE_NO_ERROR;
+ break;
+ case mdn_buffer_overflow:
+ case mdn_nomemory:
+ rcode = RCODE_SERVER_FAILURE;
+ break;
+ case mdn_invalid_message:
+ case mdn_invalid_encoding:
+ rcode = RCODE_FORMAT_ERROR;
+ break;
+ default:
+ rcode = RCODE_SERVER_FAILURE;
+ break;
+ }
+ return rcode;
+}
+
+static char *
+address_to_string(struct sockaddr *sa)
+{
+ static char tmp[200];
+
+ switch (sa->sa_family) {
+ case AF_INET:
+ {
+ struct sockaddr_in *sin = (struct sockaddr_in *)sa;
+
+ sprintf(tmp, "%s/%d", inet_ntoa(sin->sin_addr),
+ ntohs(sin->sin_port));
+ break;
+ }
+#if 0
+#ifdef AF_INET6
+ case AF_INET6:
+ {
+ char buf[INET6_ADDRSTRLEN];
+
+ struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
+
+ sprintf(tmp, "%s/%d",
+ inet_ntop(AF_INET6, &sin6->sin6_addr, buf, sizeof(buf)),
+ ntohs(sin6->sin6_port));
+ break;
+ }
+#endif
+#endif
+ default:
+ sprintf(tmp, "unknown address family %d", sa->sa_family);
+ break;
+ }
+ return tmp;
+}
+
+static int
+string_to_loglevel(char *s)
+{
+ if ('0' <= s[0] && s[0] <= '9')
+ return atoi(s);
+ else if (!strcmp(s, "fatal"))
+ return mdn_log_level_fatal;
+ else if (!strcmp(s, "error"))
+ return mdn_log_level_error;
+ else if (!strcmp(s, "warning"))
+ return mdn_log_level_warning;
+ else if (!strcmp(s, "info"))
+ return mdn_log_level_info;
+ else if (!strcmp(s, "trace"))
+ return mdn_log_level_trace;
+ else if (!strcmp(s, "dump"))
+ return mdn_log_level_dump;
+ else
+ return -1;
+}
+
+static void
+config_required(char *keyword)
+{
+ WARN("%s line required in the configuration file\n", keyword);
+}
+
+static void
+mdnerror(int code, char *fmt, ...)
+{
+ char buf[1024];
+ va_list args;
+
+ va_start(args, fmt);
+ vsprintf(buf, fmt, args);
+ va_end(args);
+
+ sprintf(buf + strlen(buf), ": %s", mdn_result_tostring(code));
+ WARN("%s\n", buf);
+}
+
+static void
+translate_log_handler(int level, const char *msg)
+{
+ switch (level) {
+ case mdn_log_level_fatal:
+ FATAL((char *)msg);
+ break;
+ case mdn_log_level_warning:
+ case mdn_log_level_info:
+ WARN((char *)msg);
+ break;
+ case mdn_log_level_trace:
+ case mdn_log_level_dump:
+ TRACE((char *)msg);
+ break;
+ }
+}
diff --git a/contrib/idn/mdnkit/dnsproxy/unxmain.c b/contrib/idn/mdnkit/dnsproxy/unxmain.c
new file mode 100644
index 00000000..c6669cee
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/unxmain.c
@@ -0,0 +1,288 @@
+/*
+ * unxmain.c - mDNS Proxy, entry for UNIX
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef lint
+static char *rcsid = "$Id: unxmain.c,v 1.1 2000/12/07 00:52:20 tale Exp $";
+#endif
+
+#ifdef UNIX
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <ctype.h>
+#include <errno.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#include <pwd.h>
+#include <grp.h>
+#include "dnsproxy.h" /* Common definitions for mDNS proxy */
+
+#define KW_ROOT_DIR "root-directory"
+#define KW_USER_ID "user-id"
+#define KW_GROUP_ID "group-id"
+
+static uid_t uid;
+static gid_t gid;
+static char *root_dir;
+static BOOL uid_specified = FALSE;
+static BOOL gid_specified = FALSE;
+
+/*
+ * signal handler to catch signal to terminate server
+ */
+
+static void handler(int signo)
+{
+ server_stop() ;
+ signal(signo, SIG_DFL) ;
+}
+
+/*
+ * signal handler to turn over the log file
+ */
+
+static void hup_handler(int signo)
+{
+ log_turnover_request();
+ signal(signo, hup_handler) ;
+}
+
+/*
+ * Set root directory.
+ */
+
+static void change_root(void)
+{
+ int err;
+
+ if (root_dir != NULL && chroot(root_dir) < 0) {
+ err = errno;
+ FATAL("cannot change root directory: %s\n", strerror(err));
+ exit(1);
+ }
+}
+
+/*
+ * Set user/group ID.
+ */
+
+static void set_id(void)
+{
+ int err;
+
+ if (uid_specified && setuid(uid) < 0) {
+ err = errno;
+ FATAL("cannot set user ID: %s\n", strerror(err));
+ exit(1);
+ }
+
+ if (gid_specified && setgid(gid) < 0) {
+ err = errno;
+ FATAL("cannot set group ID: %s\n", strerror(err));
+ exit(1);
+ }
+}
+
+/*
+ * Load configuration parameter related to security.
+ */
+
+static void get_security_conf(void)
+{
+ int ac;
+ char **av;
+
+ if (config_query_value(KW_ROOT_DIR, &ac, &av)) {
+ if (ac != 2) {
+ WARN("syntax error at %s line\n", KW_ROOT_DIR);
+ exit(1);
+ }
+ root_dir = malloc(strlen(av[1]) + 1);
+ if (root_dir == NULL) {
+ FATAL("malloc failed\n");
+ exit(1);
+ }
+ (void)strcpy(root_dir, av[1]);
+ }
+
+ if (config_query_value(KW_USER_ID, &ac, &av)) {
+ struct passwd *pwd;
+
+ if (ac != 2) {
+ WARN("syntax error at %s line\n", KW_USER_ID);
+ exit(1);
+ } else if ((pwd = getpwnam(av[1])) != NULL) {
+ uid = pwd->pw_uid;
+ uid_specified = TRUE;
+ } else if (isdigit((unsigned char)(av[1][0]))) {
+ uid = atoi(av[1]);
+ uid_specified = TRUE;
+ } else {
+ FATAL("unknown user %s\n", av[1]);
+ exit(1);
+ }
+ }
+
+ if (config_query_value(KW_GROUP_ID, &ac, &av)) {
+ struct group *gr;
+
+ if (ac != 2) {
+ WARN("syntax error at %s line\n", KW_GROUP_ID);
+ exit(1);
+ } else if ((gr = getgrnam(av[1])) != NULL) {
+ gid = gr->gr_gid;
+ gid_specified = TRUE;
+ } else if (isdigit((unsigned char)(av[1][0]))) {
+ gid = atoi(av[1]);
+ gid_specified = TRUE;
+ } else {
+ FATAL("unknown group %s\n", av[1]);
+ exit(1);
+ }
+ }
+}
+
+/*
+ * main - entry of UNIX version
+ */
+
+int main(int ac, char *av[])
+{
+ int i, pid ;
+ BOOL as_daemon = FALSE ;
+
+ for (i = 1 ; i < ac ; i++) {
+ if (strcmp(av[i], "-daemon") == 0) {
+ as_daemon = TRUE ;
+ }
+ }
+ if (config_load(ac, av) != TRUE) {
+ printf("cannot load configurations\n") ;
+ return 1 ;
+ }
+ log_configure(ac, av) ;
+
+ get_security_conf();
+
+ if (server_init(ac, av) != TRUE) {
+ printf("cannot initialize server\n") ;
+ log_terminate() ;
+ return 1 ;
+ }
+
+ if (as_daemon) {
+ switch (pid = fork()) {
+ case -1 :
+ printf("cannot start daemon %d\n", errno) ;
+ server_done() ;
+ log_terminate() ;
+ return 2 ;
+ case 0 : /* children, as daemon */
+ setsid() ;
+ close(0) ;
+ close(1) ;
+ close(2) ;
+ break ;
+ default :
+ printf("start daemon PID %d\n", pid) ;
+ return 0 ;
+ }
+ }
+
+ /*
+ * Change root directory/user ID/group ID if specified.
+ */
+ change_root();
+ set_id();
+
+ signal(SIGHUP, hup_handler) ;
+ signal(SIGINT, handler) ;
+ signal(SIGKILL, handler) ;
+ signal(SIGTERM, handler) ;
+
+#ifdef DEBUG
+ printf("Service Started\n") ;
+#endif
+
+ server_loop() ;
+
+#ifdef DEBUG
+ printf("Service Terminating...\n") ;
+#endif
+
+ server_done() ;
+
+ log_terminate() ;
+
+#ifdef DEBUG
+ printf("Service Terminated\n") ;
+#endif
+
+ return 0 ;
+}
+#endif /* UNIX */
diff --git a/contrib/idn/mdnkit/dnsproxy/winmain.c b/contrib/idn/mdnkit/dnsproxy/winmain.c
new file mode 100644
index 00000000..a3611700
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/winmain.c
@@ -0,0 +1,174 @@
+/*
+ * winmain.c - mDNS Proxy, entry for WIN32
+ *
+ * Windows version works as
+ *
+ * Service Program, as mDNS Proxy Server
+ * Service Configuration Program, Install/Remove mDNS Proxy
+ *
+ * or simply as
+ *
+ * Application Program, for debugging
+ *
+ * with single executable, switched with first option
+ *
+ * -service as Service Program
+ * -install as Configuration, install serivce
+ * -remove as Configuration, remove service
+ *
+ * Otherwise, it runs as simple console apllication.
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef lint
+static char *rcsid = "$Id: winmain.c,v 1.1 2000/12/07 00:52:20 tale Exp $";
+#endif
+
+#ifdef WIN32
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+
+#include "dnsproxy.h" /* Common definitions for mDNS proxy */
+#include "winserv.h" /* WIN32 Service Related Functions */
+
+/*
+ * signal handler to catch signal to terminate server
+ */
+
+static void handler(int signo)
+{
+ server_stop() ;
+ signal(signo, SIG_DFL) ;
+}
+
+/*
+ * main - entry of windows version
+ */
+
+int main(int ac, char *av[])
+{
+ WORD version = MAKEWORD(2, 0) ;
+ WSADATA wsaData ;
+
+ /*
+ * check 1st option
+ */
+
+ if (ac >= 2) {
+ if (strcmp(av[1], "-service") == 0) {
+ serviceRun(ac, av) ;
+ return 0 ;
+ }
+ if (strcmp(av[1], "-install") == 0) {
+ serviceInstall(ac, av) ;
+ return 0 ;
+ }
+ if (strcmp(av[1], "-remove") == 0) {
+ serviceRemove(ac, av) ;
+ return 0 ;
+ }
+ }
+
+ /*
+ * otherwise run as normal application
+ */
+
+ if (config_load(ac, av) != TRUE) {
+ printf("cannot load configration\n") ;
+ return 1 ;
+ }
+ log_configure(ac, av) ;
+
+ if (WSAStartup(version, &wsaData) != 0) {
+ printf("cannot startup WinSock\n") ;
+ return FALSE ;
+ }
+ if (server_init(ac, av) != TRUE) {
+ printf("cannot initialize server\n") ;
+ WSACleanup() ;
+ return 1 ;
+ }
+
+ signal(SIGINT, handler) ;
+ signal(SIGTERM, handler) ;
+ signal(SIGBREAK, handler) ;
+
+ printf("Service Started\n") ;
+
+ server_loop() ;
+
+ printf("Service Termiating...\n") ;
+
+ server_done() ;
+
+ printf("Service Terminated\n") ;
+
+ WSACleanup() ;
+
+ log_terminate() ;
+
+ return 0 ;
+}
+
+#endif /* WIN32 */
diff --git a/contrib/idn/mdnkit/dnsproxy/winserv.c b/contrib/idn/mdnkit/dnsproxy/winserv.c
new file mode 100644
index 00000000..41668643
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/winserv.c
@@ -0,0 +1,446 @@
+/*
+ * winserv.c - mDNS Proxy, WIN32 Service Specific Functions
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef lint
+static char *rcsid = "$Id: winserv.c,v 1.1 2000/12/07 00:52:20 tale Exp $";
+#endif
+
+#ifdef WIN32
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <tchar.h>
+
+#include "dnsproxy.h" /* Common definitions for mDNS proxy */
+#include "winserv.h" /* Windows's Service Specific */
+
+/*
+ * Parameters for WIN32 Service
+ */
+
+#define SERVICENAME "dnsproxy"
+#define DISPLAYNAME "mDNS Proxy"
+
+static UCHAR pathService[1024] ;
+
+/*
+ * getFileName - get fullpath and split it
+ */
+
+static UCHAR p_ful[256] ;
+static UCHAR p_drv[256] ;
+static UCHAR p_dir[256] ;
+static UCHAR p_nam[256] ;
+static UCHAR p_ext[256] ;
+
+static void getFileName(void)
+{
+ GetModuleFileName(NULL, p_ful, 256) ;
+ _splitpath(p_ful, p_drv, p_dir, p_nam, p_ext) ;
+}
+
+/*
+ * Service management Varibales
+ */
+
+SERVICE_STATUS_HANDLE ServiceStatusHandle = 0 ;
+SERVICE_STATUS ServiceStatusRecord = { 0 } ;
+int ServiceErrorCode = 0 ;
+
+void serviceLogTrace(PUCHAR msg)
+{
+ char msgbuff[256] ;
+ HANDLE hEventSrc ;
+ char *strings[2] ;
+
+ ServiceErrorCode = GetLastError() ;
+
+ sprintf(msgbuff, "%s trace: %d", SERVICENAME, ServiceErrorCode) ;
+ strings[0] = msgbuff ;
+ strings[1] = msg ;
+
+ hEventSrc = RegisterEventSource(NULL, TEXT(SERVICENAME)) ;
+
+ if (hEventSrc != NULL) {
+ ReportEvent(
+ hEventSrc,
+ EVENTLOG_INFORMATION_TYPE,
+ 0,
+ 0,
+ NULL,
+ 2,
+ 0,
+ (const char **) strings,
+ NULL) ;
+ DeregisterEventSource(hEventSrc) ;
+ }
+ /* TRACE("%s %s\n", msgbuff, msg) ; */
+}
+
+void serviceLogError(PUCHAR msg)
+{
+ char msgbuff[256] ;
+ HANDLE hEventSrc ;
+ char *strings[2] ;
+
+ ServiceErrorCode = GetLastError() ;
+
+ sprintf(msgbuff, "%s error: %d", SERVICENAME, ServiceErrorCode) ;
+ strings[0] = msgbuff ;
+ strings[1] = msg ;
+
+ hEventSrc = RegisterEventSource(NULL, TEXT(SERVICENAME)) ;
+
+ if (hEventSrc != NULL) {
+ ReportEvent(
+ hEventSrc,
+ EVENTLOG_ERROR_TYPE,
+ 0,
+ 0,
+ NULL,
+ 2,
+ 0,
+ (const char **) strings,
+ NULL) ;
+ DeregisterEventSource(hEventSrc) ;
+ }
+ /* FATAL("%s %s\n", msgbuff, msg) ; */
+}
+
+/*
+ * serviceReport - report service status
+ */
+
+VOID serviceReport(DWORD state, DWORD exitcode, DWORD waithint)
+{
+ static DWORD checkpoint = 1 ;
+
+ if (state == SERVICE_START_PENDING) {
+ ServiceStatusRecord.dwControlsAccepted = 0 ;
+ } else {
+ ServiceStatusRecord.dwControlsAccepted = SERVICE_ACCEPT_STOP ;
+ }
+ ServiceStatusRecord.dwCurrentState = state ;
+ ServiceStatusRecord.dwWin32ExitCode = exitcode ;
+ ServiceStatusRecord.dwWaitHint = waithint ;
+
+ if (state == SERVICE_RUNNING || state == SERVICE_STOPPED) {
+ ServiceStatusRecord.dwCheckPoint = 0 ;
+ } else {
+ ServiceStatusRecord.dwCheckPoint = checkpoint++ ;
+ }
+
+ SetServiceStatus(ServiceStatusHandle, &ServiceStatusRecord) ;
+}
+
+/*
+ * ServiceCtrl - service control handler
+ */
+
+VOID ServiceCtrl(DWORD opcode)
+{
+ switch (opcode) {
+
+ case SERVICE_CONTROL_STOP :
+ serviceLogTrace("ServiceCtrl STOP") ;
+ ServiceStatusRecord.dwCurrentState = SERVICE_STOP_PENDING ;
+ /* nofity later, so set status only */
+ server_stop() ; /* stop server loop */
+ break ;
+
+ case SERVICE_CONTROL_INTERROGATE :
+ /* query, report later */
+ serviceLogTrace("ServiceCtrl INTERROGATE") ;
+ break ;
+
+ default :
+ break ;
+ }
+ serviceReport(ServiceStatusRecord.dwCurrentState, NO_ERROR, 0) ;
+}
+
+/*
+ * ServiceMain - as name describes
+ */
+
+static UCHAR cmdline[1024] ;
+
+VOID ServiceMain(DWORD dwArgc, LPTSTR *lpszArgv)
+{
+ WORD version = MAKEWORD(2, 0) ;
+ WSADATA wsaData ;
+
+ /*
+ * initialize service status
+ */
+
+ ServiceStatusRecord.dwServiceType = SERVICE_WIN32 | SERVICE_INTERACTIVE_PROCESS ;
+ ServiceStatusRecord.dwServiceSpecificExitCode = 0 ;
+
+ /*
+ * register Service Control Handler
+ */
+
+ ServiceStatusHandle = RegisterServiceCtrlHandler(
+ TEXT(SERVICENAME),
+ (LPHANDLER_FUNCTION) ServiceCtrl) ;
+ if (ServiceStatusHandle == (SERVICE_STATUS_HANDLE) 0) {
+ serviceLogError("RegisterServiceCtrlHandler failed") ;
+ return ;
+ }
+
+ serviceReport(SERVICE_START_PENDING, NO_ERROR, (30 * 1000)) ;
+
+ /*
+ * Initialize & Run service
+ */
+
+ serviceLogTrace("start initializing") ;
+
+ if (config_load((int) dwArgc, (char **) lpszArgv) != TRUE) {
+ serviceLogError("cannot initialize server") ;
+ serviceReport(SERVICE_STOPPED, 0, 0) ;
+ return ;
+ }
+ log_configure((int) dwArgc, (char **) lpszArgv) ;
+
+ if (WSAStartup(version, &wsaData) != 0) {
+ serviceLogError("cannot initialize WinSock") ;
+ serviceReport(SERVICE_STOPPED, 0, 0) ;
+ return ;
+ }
+ if (server_init((int) dwArgc, (char **) lpszArgv) != TRUE) {
+ serviceLogError("cannot initialize server") ;
+ serviceReport(SERVICE_STOPPED, 0, 0) ;
+ WSACleanup() ;
+ return ;
+ }
+
+ serviceReport(SERVICE_RUNNING, NO_ERROR, 0) ;
+
+ serviceLogTrace("initialization done, running now") ;
+
+ server_loop() ; /* do service here */
+
+ serviceLogTrace("service loop finished, closing") ;
+
+ serviceReport(SERVICE_STOP_PENDING, NO_ERROR, (10 * 1000)) ;
+
+ server_done() ; /* cleaup */
+ WSACleanup() ;
+
+ serviceLogTrace("service finised") ;
+
+ serviceReport(SERVICE_STOPPED, NO_ERROR, 0) ;
+
+ log_terminate() ;
+}
+
+/*
+ * serviceRun - run Service
+ */
+
+static SERVICE_TABLE_ENTRY ServiceTable[] = {
+ { TEXT(SERVICENAME), (LPSERVICE_MAIN_FUNCTION) ServiceMain } ,
+ { NULL, NULL }
+} ;
+
+void serviceRun(int ac, char *av[])
+{
+ serviceLogTrace("serviceRun - start") ;
+
+ if (StartServiceCtrlDispatcher(ServiceTable) == 0) {
+ serviceLogError("StartServiceCtrlDispatcher failed") ;
+ }
+}
+
+/*
+ * serviceInstall - install service
+ */
+
+void serviceInstall(int ac, char *av[])
+{
+ SC_HANDLE hSCManager = NULL ;
+ SC_HANDLE hService = NULL ;
+
+ getFileName() ;
+
+#ifdef DEBUG
+ printf("Install Service %s \"%s\"\n", SERVICENAME, p_ful) ;
+#endif
+
+ /*
+ * open Service Manager
+ */
+
+ hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS) ;
+
+ if (hSCManager == NULL) {
+ printf("cannot open SCManager %d\n", GetLastError()) ;
+ return ;
+ }
+
+#ifdef DEBUG
+ printf("open SCManager\n") ; fflush(stdout) ;
+#endif
+
+ /*
+ * prepare service path (exe path with arguments)
+ */
+
+ sprintf(pathService, "\"%s\" -service", p_ful) ;
+
+#ifdef DEBUG
+ printf("Installing %s\n", pathService) ;
+#endif
+
+ /*
+ * create service entry
+ */
+
+ hService = CreateService(
+ hSCManager, /* SCManager database */
+ TEXT(SERVICENAME), /* name of service */
+ TEXT(DISPLAYNAME), /* its display name */
+ SERVICE_ALL_ACCESS, /* desired access */
+ SERVICE_WIN32_OWN_PROCESS, /* service type */
+ SERVICE_DEMAND_START, /* start type */
+ SERVICE_ERROR_IGNORE, /* error control type */
+ TEXT(pathService), /* service image */
+ NULL, /* no load order */
+ NULL, /* no tag identifier */
+ NULL, /* no dependencies */
+ NULL, /* LocalSystem account */
+ NULL) ; /* no password */
+
+ CloseServiceHandle(hSCManager) ;
+
+ if (hService == NULL) {
+ printf("cannot create service %d\n", GetLastError()) ;
+ return ;
+ }
+
+ CloseServiceHandle(hSCManager) ;
+
+ printf("Installed Service %s\n", pathService) ;
+}
+
+/*
+ * serviceRemove - remove service
+ */
+
+void serviceRemove(int ac, char *av[])
+{
+ SC_HANDLE hSCManager = NULL ;
+ SC_HANDLE hService = NULL ;
+
+ getFileName() ;
+
+#ifdef DEBUG
+ printf("Removing Service %s\n", SERVICENAME) ;
+#endif
+
+ /*
+ * open Service Manager
+ */
+
+ hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS) ;
+
+ if (hSCManager == NULL) {
+ printf("cannot open SCManager %d\n", GetLastError()) ;
+ return ;
+ }
+
+#ifdef DEBUG
+ printf("open SCManager\n") ; fflush(stdout) ;
+#endif
+
+ /*
+ * delete service
+ */
+
+ hService = OpenService(
+ hSCManager, /* SCManager database */
+ TEXT(SERVICENAME), /* name of service */
+ DELETE) ; /* type of access */
+
+ if (hService == NULL) {
+ printf("cannot open service %s %d\n", SERVICENAME, GetLastError()) ;
+ CloseServiceHandle(hSCManager) ;
+ return ;
+ }
+ if (DeleteService(hService) == 0) {
+ printf("cannot remove service %s %d\n", SERVICENAME, GetLastError()) ;
+ CloseServiceHandle(hService) ;
+ CloseServiceHandle(hSCManager) ;
+ return ;
+ }
+
+ CloseServiceHandle(hService) ;
+ CloseServiceHandle(hSCManager) ;
+
+ printf("Removed Service %s\n", SERVICENAME) ;
+}
+
+#endif /* WIN32 */
diff --git a/contrib/idn/mdnkit/dnsproxy/winserv.h b/contrib/idn/mdnkit/dnsproxy/winserv.h
new file mode 100644
index 00000000..7247cca6
--- /dev/null
+++ b/contrib/idn/mdnkit/dnsproxy/winserv.h
@@ -0,0 +1,72 @@
+/*
+ * winserv.h - mDNS Proxy, WIN32 Service Specific Functions
+ */
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+/* $Id: winserv.h,v 1.1 2000/12/07 00:52:20 tale Exp $ */
+
+#ifndef WINSERV_H
+#define WINSERV_H 1
+
+void serviceRun(int ac, char *av[]) ;
+void serviceInstall(int ac, char *av[]) ;
+void serviceRemove(int ac, char *av[]) ;
+
+#endif /* WINSERV_H */
diff --git a/contrib/idn/mdnkit/include/Makefile.in b/contrib/idn/mdnkit/include/Makefile.in
new file mode 100644
index 00000000..b1e1a033
--- /dev/null
+++ b/contrib/idn/mdnkit/include/Makefile.in
@@ -0,0 +1,73 @@
+# $Id: Makefile.in,v 1.1 2000/12/07 00:52:21 tale Exp $
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+# Tokyo, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) Japan Network Information Center. All rights reserved."
+#
+# 4. Neither the name of JPNIC may be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "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 JPNIC 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 DAMAGES.
+#
+# 6. Indemnification by Licensee
+# Any person or entities using and/or redistributing this Software under
+# this License Terms and Conditions shall defend indemnify and hold
+# harmless JPNIC from and against any and all judgements damages,
+# expenses, settlement liabilities, cost and other liabilities of any
+# kind as a result of use and redistribution of this Software or any
+# claim, suite, action, litigation or proceeding by any third party
+# arising out of or relates to this License Terms and Conditions.
+#
+# 7. Governing Law, Jurisdiction and Venue
+# This License Terms and Conditions shall be governed by and and
+# construed in accordance with the law of Japan. Any person or entities
+# using and/or redistributing this Software under this License Terms and
+# Conditions hereby agrees and consent to the personal and exclusive
+# jurisdiction and venue of Tokyo District Court of Japan.
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+SUBDIRS = mdn
+
+all:
+ for d in $(SUBDIRS); do (cd $$d; $(MAKE) all); done
+
+install:
+ for d in $(SUBDIRS); do (cd $$d; $(MAKE) install); done
+
+clean:
+ for d in $(SUBDIRS); do (cd $$d; $(MAKE) clean); done
diff --git a/contrib/idn/mdnkit/include/config.h b/contrib/idn/mdnkit/include/config.h
new file mode 100644
index 00000000..3e444382
--- /dev/null
+++ b/contrib/idn/mdnkit/include/config.h
@@ -0,0 +1,123 @@
+/* include/config.h. Generated automatically by configure. */
+/* include/config.h.in. Generated automatically from configure.in by autoheader. */
+/* $Id: config.h,v 1.1 2000/12/07 00:52:21 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef gid_t */
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef uid_t */
+
+/* Define if your iconv() does not accept "UTF-8" as the codeset name for utf-8. */
+/* #undef MDN_UTF8_ENCODING_NAME */
+
+/* Define if you want ZLD feature compiled in. */
+/* #undef MDN_SUPPORT_ZLD */
+
+/* Define if the prefix of RACE encoding differs from 'bq--'. */
+/* #undef MDN_RACE_PREFIX */
+
+/* Define if the suffix of BRACE encoding differs from '-8q9'. */
+/* #undef MDN_BRACE_SUFFIX */
+
+/* Define if the prefix of LACE encoding differs from 'bq--'. */
+/* #undef MDN_LACE_PREFIX */
+
+/* Define as an appropriate type (ex. int) if your system doesn't have. */
+#define BOOL int
+
+/* Define if you have the bcopy function. */
+#define HAVE_BCOPY 1
+
+/* Define if you have the memmove function. */
+#define HAVE_MEMMOVE 1
+
+/* Define if you have the nl_langinfo function. */
+#define HAVE_NL_LANGINFO 1
+
+/* Define if you have the setlocale function. */
+#define HAVE_SETLOCALE 1
+
+/* Define if you have the setvbuf function. */
+#define HAVE_SETVBUF 1
+
+/* Define if you have the vsnprintf function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define if you have the <langinfo.h> header file. */
+#define HAVE_LANGINFO_H 1
+
+/* Define if you have the <locale.h> header file. */
+#define HAVE_LOCALE_H 1
+
+/* Define if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define if you have the nsl library (-lnsl). */
+/* #undef HAVE_LIBNSL */
+
+/* Define if you have the socket library (-lsocket). */
+/* #undef HAVE_LIBSOCKET */
diff --git a/contrib/idn/mdnkit/include/config.h.in b/contrib/idn/mdnkit/include/config.h.in
new file mode 100644
index 00000000..830f0fce
--- /dev/null
+++ b/contrib/idn/mdnkit/include/config.h.in
@@ -0,0 +1,122 @@
+/* include/config.h.in. Generated automatically from configure.in by autoheader. */
+/* $Id: config.h.in,v 1.1 2000/12/07 00:52:21 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef gid_t
+
+/* Define if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef uid_t
+
+/* Define if your iconv() does not accept "UTF-8" as the codeset name for utf-8. */
+#undef MDN_UTF8_ENCODING_NAME
+
+/* Define if you want ZLD feature compiled in. */
+#undef MDN_SUPPORT_ZLD
+
+/* Define if the prefix of RACE encoding differs from 'bq--'. */
+#undef MDN_RACE_PREFIX
+
+/* Define if the suffix of BRACE encoding differs from '-8q9'. */
+#undef MDN_BRACE_SUFFIX
+
+/* Define if the prefix of LACE encoding differs from 'bq--'. */
+#undef MDN_LACE_PREFIX
+
+/* Define as an appropriate type (ex. int) if your system doesn't have. */
+#undef BOOL
+
+/* Define if you have the bcopy function. */
+#undef HAVE_BCOPY
+
+/* Define if you have the memmove function. */
+#undef HAVE_MEMMOVE
+
+/* Define if you have the nl_langinfo function. */
+#undef HAVE_NL_LANGINFO
+
+/* Define if you have the setlocale function. */
+#undef HAVE_SETLOCALE
+
+/* Define if you have the setvbuf function. */
+#undef HAVE_SETVBUF
+
+/* Define if you have the vsnprintf function. */
+#undef HAVE_VSNPRINTF
+
+/* Define if you have the <langinfo.h> header file. */
+#undef HAVE_LANGINFO_H
+
+/* Define if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
+/* Define if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the nsl library (-lnsl). */
+#undef HAVE_LIBNSL
+
+/* Define if you have the socket library (-lsocket). */
+#undef HAVE_LIBSOCKET
diff --git a/contrib/idn/mdnkit/include/config.h.os2 b/contrib/idn/mdnkit/include/config.h.os2
new file mode 100644
index 00000000..010953e9
--- /dev/null
+++ b/contrib/idn/mdnkit/include/config.h.os2
@@ -0,0 +1,85 @@
+/* $Id: config.h.os2,v 1.1 2000/12/07 00:52:21 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+/* Define if you have the vsnprintf function. */
+#undef HAVE_VSNPRINTF
+
+/* Define if you have the setvbuf function. */
+#undef HAVE_SETVBUF
+
+/* Define if you have the setlocale function. */
+#undef HAVE_SETLOCALE
+
+/* Define if you have the nl_langinfo function. */
+#undef HAVE_NL_LANGINFO
+
+/* Define if you have the <langinfo.h> header file. */
+#undef HAVE_LANGINFO_H
+
+/* Define if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define if your iconv() does not accept "UTF-8" as the codeset name for utf-8. */
+#undef MDN_UTF8_ENCODING_NAME
+
+/* Define if you want ZLD feature compiled in. */
+#undef MDN_SUPPORT_ZLD
diff --git a/contrib/idn/mdnkit/include/config.h.win b/contrib/idn/mdnkit/include/config.h.win
new file mode 100644
index 00000000..d117a4d1
--- /dev/null
+++ b/contrib/idn/mdnkit/include/config.h.win
@@ -0,0 +1,85 @@
+/* $Id: config.h.win,v 1.1 2000/12/07 00:52:21 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+/* Define if you have the vsnprintf function. */
+#undef HAVE_VSNPRINTF
+
+/* Define if you have the setvbuf function. */
+#undef HAVE_SETVBUF
+
+/* Define if you have the setlocale function. */
+#undef HAVE_SETLOCALE
+
+/* Define if you have the nl_langinfo function. */
+#undef HAVE_NL_LANGINFO
+
+/* Define if you have the <langinfo.h> header file. */
+#undef HAVE_LANGINFO_H
+
+/* Define if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define if your iconv() does not accept "UTF-8" as the codeset name for utf-8. */
+#undef MDN_UTF8_ENCODING_NAME
+
+/* Define if you want ZLD feature compiled in. */
+#undef MDN_SUPPORT_ZLD
diff --git a/contrib/idn/mdnkit/include/mdn/Makefile.in b/contrib/idn/mdnkit/include/mdn/Makefile.in
new file mode 100644
index 00000000..b48a16fd
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/Makefile.in
@@ -0,0 +1,110 @@
+# $Id: Makefile.in,v 1.1 2000/12/07 00:52:21 tale Exp $
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+# Tokyo, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) Japan Network Information Center. All rights reserved."
+#
+# 4. Neither the name of JPNIC may be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "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 JPNIC 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 DAMAGES.
+#
+# 6. Indemnification by Licensee
+# Any person or entities using and/or redistributing this Software under
+# this License Terms and Conditions shall defend indemnify and hold
+# harmless JPNIC from and against any and all judgements damages,
+# expenses, settlement liabilities, cost and other liabilities of any
+# kind as a result of use and redistribution of this Software or any
+# claim, suite, action, litigation or proceeding by any third party
+# arising out of or relates to this License Terms and Conditions.
+#
+# 7. Governing Law, Jurisdiction and Venue
+# This License Terms and Conditions shall be governed by and and
+# construed in accordance with the law of Japan. Any person or entities
+# using and/or redistributing this Software under this License Terms and
+# Conditions hereby agrees and consent to the personal and exclusive
+# jurisdiction and venue of Tokyo District Court of Japan.
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+BINDIR = @bindir@
+LIBDIR = @libdir@
+INCDIR = @includedir@
+MDNINCDIR = $(INCDIR)/mdn
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+HDRS = \
+ assert.h \
+ brace.h \
+ converter.h \
+ debug.h \
+ dn.h \
+ lace.h \
+ localencoding.h \
+ log.h \
+ logmacro.h \
+ msgheader.h \
+ msgtrans.h \
+ normalizer.h \
+ race.h \
+ res.h \
+ resconf.h \
+ result.h \
+ selectiveencode.h \
+ strhash.h \
+ translator.h \
+ unicode.h \
+ unormalize.h \
+ utf5.h \
+ utf8.h \
+ util.h \
+ zldrule.h
+
+all:
+
+install:
+ [ -d $(INCDIR) ] || mkdir $(INCDIR)
+ [ -d $(MDNINCDIR) ] || mkdir $(MDNINCDIR)
+ for hdr in $(HDRS); \
+ do $(INSTALL_DATA) $(srcdir)/$$hdr $(MDNINCDIR); done
+
+clean:
+ rm -f *~
+
diff --git a/contrib/idn/mdnkit/include/mdn/assert.h b/contrib/idn/mdnkit/include/mdn/assert.h
new file mode 100644
index 00000000..521cf508
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/assert.h
@@ -0,0 +1,69 @@
+/* $Id: assert.h,v 1.1 2000/12/07 00:52:21 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_ASSERT_H
+#define MDN_ASSERT_H 1
+
+#ifndef DEBUG
+#define NDEBUG
+#endif
+
+#include <assert.h>
+
+# endif /* MDN_ASSERT_H */
diff --git a/contrib/idn/mdnkit/include/mdn/brace.h b/contrib/idn/mdnkit/include/mdn/brace.h
new file mode 100644
index 00000000..b5fe3bd6
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/brace.h
@@ -0,0 +1,82 @@
+/* $Id: brace.h,v 1.1 2000/12/07 00:52:21 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_BRACE_H
+#define MDN_BRACE_H 1
+
+/*
+ * BRACE Converter.
+ *
+ * See Internet Draft draft-ietf-idn-brace-00.txt for details.
+ */
+
+#include <mdn/result.h>
+#include <mdn/converter.h>
+
+extern mdn_result_t
+mdn__brace_open(mdn_converter_t ctx, mdn_converter_dir_t dir);
+
+extern mdn_result_t
+mdn__brace_close(mdn_converter_t ctx, mdn_converter_dir_t dir);
+
+extern mdn_result_t
+mdn__brace_convert(mdn_converter_t ctx, mdn_converter_dir_t dir,
+ const char *from, char *to, size_t tolen);
+
+#endif /* MDN_BRACE_H */
diff --git a/contrib/idn/mdnkit/include/mdn/converter.h b/contrib/idn/mdnkit/include/mdn/converter.h
new file mode 100644
index 00000000..e77f88f5
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/converter.h
@@ -0,0 +1,234 @@
+/* $Id: converter.h,v 1.1 2000/12/07 00:52:21 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_CONVERTER_H
+#define MDN_CONVERTER_H 1
+
+/*
+ * Codeset converter.
+ *
+ * This module provides conversions from some local codeset to UTF-8
+ * and vice versa.
+ */
+
+#include <mdn/result.h>
+
+/*
+ * Converter context type (opaque).
+ */
+typedef struct mdn_converter *mdn_converter_t;
+
+/*
+ * Conversion direction (local codeset -> UTF-8 or the opposite)
+ */
+typedef enum {
+ mdn_converter_l2u, /* local-to-utf8 */
+ mdn_converter_u2l /* utf8-to-local */
+} mdn_converter_dir_t;
+
+/*
+ * Conversion flags.
+ */
+#define MDN_CONVERTER_DELAYEDOPEN 1
+#define MDN_CONVERTER_RTCHECK 2
+
+/*
+ * Initialize module. Must be called before any other calls of
+ * the functions of this module.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_converter_initialize(void);
+
+/*
+ * Create a conversion context.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_invalid_name -- specified codeset is not supported.
+ * mdn_nomemory -- malloc failed.
+ * mdn_failure -- other failure (unknown cause).
+ */
+extern mdn_result_t
+mdn_converter_create(const char *name, mdn_converter_t *ctxp,
+ int flags);
+
+/*
+ * Destroy the conversion context created by mdn_converter_create.
+ */
+extern void
+mdn_converter_destroy(mdn_converter_t ctx);
+
+/*
+ * Convert between local codeset and UTF-8. Note that each conversion
+ * is started with initial state.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_buffer_overflow -- output buffer is too small.
+ * mdn_invalid_encoding -- the input string has invalid/illegal
+ * byte sequence.
+ * mdn_invalid_name -- codeset is not supported (this error
+ * should happen only if 'delayedopen'
+ * flag was set when mdn_converter_create
+ * was called)
+ * mdn_failure -- other failure.
+ */
+extern mdn_result_t
+mdn_converter_convert(mdn_converter_t ctx, mdn_converter_dir_t dir,
+ const char *from, char *to, size_t tolen);
+
+/*
+ * Macros for convenience.
+ */
+#define mdn_converter_localtoutf8(ctx, from, to, tolen) \
+ mdn_converter_convert((ctx), mdn_converter_l2u, (from), (to), (tolen))
+
+#define mdn_converter_utf8tolocal(ctx, from, to, tolen) \
+ mdn_converter_convert((ctx), mdn_converter_u2l, (from), (to), (tolen))
+
+/*
+ * Get the name of local codeset. The returned name may be different from
+ * the one specified to mdn_converter_create, if the specified one was an
+ * alias.
+ *
+ * Returns:
+ * the local codeset name.
+ */
+extern char *
+mdn_converter_localencoding(mdn_converter_t ctx);
+
+/*
+ * Return if this local encoding is a special one that a string in this
+ * encoding just looks like an ordinary ASCII string.
+ * A few types of encoding designed specially for domain name conversion
+ * (such as UTF-5) fall into this category.
+ *
+ * Returns:
+ * 1 -- yes, it is special.
+ * 0 -- no.
+ */
+extern int
+mdn_converter_isasciicompatible(mdn_converter_t ctx);
+
+/*
+ * Register an alias for a codeset name.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_converter_addalias(const char *alias_name, const char *real_name);
+
+/*
+ * Register aliases defined by the specified file.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nofile -- no such file.
+ * mdn_invalid_syntax -- file is malformed.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_converter_aliasfile(const char *path);
+
+/*
+ * Unregister all the aliases.
+ */
+extern mdn_result_t
+mdn_converter_resetalias(void);
+
+
+/*
+ * New converter registration.
+ */
+
+/*
+ * Conversion operation functions.
+ */
+typedef mdn_result_t (*mdn_converter_openproc_t)(mdn_converter_t ctx,
+ mdn_converter_dir_t dir);
+typedef mdn_result_t (*mdn_converter_closeproc_t)(mdn_converter_t ctx,
+ mdn_converter_dir_t dir);
+typedef mdn_result_t (*mdn_converter_convertproc_t)(mdn_converter_t ctx,
+ mdn_converter_dir_t dir,
+ const char *from,
+ char *to, size_t tolen);
+
+/*
+ * Register a new converter.
+ * 'ascii_compatible' is a boolean flag indicating this encoding is
+ * an `ascii-compatible encoding'.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_converter_register(const char *name,
+ mdn_converter_openproc_t open,
+ mdn_converter_closeproc_t close,
+ mdn_converter_convertproc_t convert,
+ int ascii_compatible);
+
+#endif /* MDN_CONVERTER_H */
diff --git a/contrib/idn/mdnkit/include/mdn/debug.h b/contrib/idn/mdnkit/include/mdn/debug.h
new file mode 100644
index 00000000..b66c6586
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/debug.h
@@ -0,0 +1,72 @@
+/* $Id: debug.h,v 1.1 2000/12/07 00:52:21 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_DEBUG_H
+#define MDN_DEBUG_H 1
+
+/*
+ * Debug utility
+ */
+
+extern char *mdn_debug_hexstring(const char *s, int maxbytes);
+extern char *mdn_debug_xstring(const char *s, int maxbytes);
+extern char *mdn_debug_hexdata(const char *s, int length, int maxlength);
+extern void mdn_debug_hexdump(const char *s, int length);
+
+#endif /* MDN_DEBUG_H */
diff --git a/contrib/idn/mdnkit/include/mdn/dn.h b/contrib/idn/mdnkit/include/mdn/dn.h
new file mode 100644
index 00000000..3ddbf0b3
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/dn.h
@@ -0,0 +1,117 @@
+/* $Id: dn.h,v 1.1 2000/12/07 00:52:21 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_DN_H
+#define MDN_DN_H 1
+
+#define MDN_DN_NPTRS 64
+
+/*
+ * Domain name compression/expansion.
+ *
+ * The interface this module provides is similar to the standard
+ * dn_comp and dn_expand, but with a twist.
+ */
+
+#include <mdn/result.h>
+
+/*
+ * Compression context.
+ */
+typedef struct {
+ const unsigned char *msg;
+ int cur;
+ int offset[MDN_DN_NPTRS];
+} mdn__dn_t;
+
+/*
+ * Expand a compressed domain name.
+ *
+ * It is similar to dn_expand in resolver library.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_buffer_overflow -- 'buflen' is too small.
+ * mdn_invalid_message -- the specified message is not valid.
+ */
+extern mdn_result_t
+mdn__dn_expand(const char *msg, size_t msglen, const char *compressed,
+ char *expanded, size_t buflen, size_t *complenp);
+
+/*
+ * Initialize compression context.
+ */
+extern void
+mdn__dn_initcompress(mdn__dn_t *ctx, const char *msg);
+
+/*
+ * Compress a domain name.
+ *
+ * It is similar to dn_comp.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_buffer_overflow -- 'length' is too small.
+ * mdn_invalid_name -- the specified name is invalid.
+ */
+extern mdn_result_t
+mdn__dn_compress(const char *name, char *sptr, size_t length,
+ mdn__dn_t *ctx, size_t *complenp);
+
+#endif /* MDN_DN_H */
diff --git a/contrib/idn/mdnkit/include/mdn/lace.h b/contrib/idn/mdnkit/include/mdn/lace.h
new file mode 100644
index 00000000..08f6d699
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/lace.h
@@ -0,0 +1,82 @@
+/* $Id: lace.h,v 1.1 2000/12/07 00:52:22 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_LACE_H
+#define MDN_LACE_H 1
+
+/*
+ * LACE Converter.
+ *
+ * See Internet Draft draft-ietf-idn-lace-00.txt for details.
+ */
+
+#include <mdn/result.h>
+#include <mdn/converter.h>
+
+extern mdn_result_t
+mdn__lace_open(mdn_converter_t ctx, mdn_converter_dir_t dir);
+
+extern mdn_result_t
+mdn__lace_close(mdn_converter_t ctx, mdn_converter_dir_t dir);
+
+extern mdn_result_t
+mdn__lace_convert(mdn_converter_t ctx, mdn_converter_dir_t dir,
+ const char *from, char *to, size_t tolen);
+
+#endif /* MDN_LACE_H */
diff --git a/contrib/idn/mdnkit/include/mdn/localencoding.h b/contrib/idn/mdnkit/include/mdn/localencoding.h
new file mode 100644
index 00000000..949075d5
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/localencoding.h
@@ -0,0 +1,85 @@
+/* $Id: localencoding.h,v 1.1 2000/12/07 00:52:22 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_LOCALENCODING_H
+#define MDN_LOCALENCODING_H 1
+
+/*
+ * Local codeset detection.
+ *
+ * Determine the local codeset (the codeset used by the current application),
+ * based on the locale information.
+ */
+
+#define MDN_LOCALCS_ENV "MDN_LOCAL_CODESET"
+
+/*
+ * Get the codeset name corresponding to the current locale,
+ * suitable for passing to 'mdn_converter_create'.
+ *
+ * If the codeset cannot be determined, the locale name itself
+ * will be returned in the hope that codeset alias file translates it
+ * to the right name.
+ *
+ * If it cannot retrieve the current locale name, NULL will be
+ * returned.
+ */
+extern const char *mdn_localencoding_name(void);
+
+#endif /* MDN_LOCALENCODING_H */
diff --git a/contrib/idn/mdnkit/include/mdn/log.h b/contrib/idn/mdnkit/include/mdn/log.h
new file mode 100644
index 00000000..4e0a6da8
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/log.h
@@ -0,0 +1,113 @@
+/* $Id: log.h,v 1.1 2000/12/07 00:52:22 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_LOG_H
+#define MDN_LOG_H 1
+
+/*
+ * MDN library logging facility.
+ */
+
+/*
+ * Log level definition.
+ */
+enum {
+ mdn_log_level_fatal = 0,
+ mdn_log_level_error = 1,
+ mdn_log_level_warning = 2,
+ mdn_log_level_info = 3,
+ mdn_log_level_trace = 4,
+ mdn_log_level_dump = 5
+};
+
+/*
+ * Log handler type.
+ */
+typedef void (*mdn_log_proc_t)(int level, const char *msg);
+
+/*
+ * Log routines.
+ */
+extern void mdn_log_fatal(const char *fmt, ...);
+extern void mdn_log_error(const char *fmt, ...);
+extern void mdn_log_warning(const char *fmt, ...);
+extern void mdn_log_info(const char *fmt, ...);
+extern void mdn_log_trace(const char *fmt, ...);
+extern void mdn_log_dump(const char *fmt, ...);
+
+/*
+ * Set/get log level.
+ *
+ * If log level has not been explicitly defined by 'mdn_log_setlevel',
+ * the default level is determined by the value of enrironment
+ * variable 'MDN_LOG_LEVEL'.
+ */
+extern void mdn_log_setlevel(int level);
+extern int mdn_log_getlevel(void);
+
+/*
+ * Set log handler.
+ *
+ * If no log handler is set, log goes to stderr by default.
+ * You can reset the handler to the default one by specifying
+ * NULL.
+ */
+extern void mdn_log_setproc(mdn_log_proc_t proc);
+
+#endif /* MDN_LOG_H */
diff --git a/contrib/idn/mdnkit/include/mdn/logmacro.h b/contrib/idn/mdnkit/include/mdn/logmacro.h
new file mode 100644
index 00000000..9fb81e69
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/logmacro.h
@@ -0,0 +1,80 @@
+/* $Id: logmacro.h,v 1.1 2000/12/07 00:52:22 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_LOGMACRO_H
+#define MDN_LOGMACRO_H 1
+
+#include <mdn/log.h>
+
+#define FATAL(x) mdn_log_fatal x
+#define ERROR(x) mdn_log_error x
+#define WARNING(x) mdn_log_warning x
+#define INFO(x) mdn_log_info x
+
+#ifdef DEBUG
+#define TRACE(x) mdn_log_trace x
+#define DUMP(x) mdn_log_dump x
+#else
+#define TRACE(x)
+#define DUMP(x)
+#endif /* DEBUG */
+
+#define LOGLEVEL mdn_log_getlevel()
+
+#endif /* MDN_LOGMACRO_H */
diff --git a/contrib/idn/mdnkit/include/mdn/msgheader.h b/contrib/idn/mdnkit/include/mdn/msgheader.h
new file mode 100644
index 00000000..083ae371
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/msgheader.h
@@ -0,0 +1,113 @@
+/* $Id: msgheader.h,v 1.1 2000/12/07 00:52:22 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_MSGHEADER_H
+#define MDN_MSGHEADER_H 1
+
+/*
+ * DNS message header parsing/construction.
+ */
+
+#include <mdn/result.h>
+
+/*
+ * Parsed DNS message header.
+ */
+typedef struct mdn_msgheader {
+ unsigned int id;
+ int qr;
+ int opcode;
+ int flags;
+ int rcode;
+ unsigned int qdcount;
+ unsigned int ancount;
+ unsigned int nscount;
+ unsigned int arcount;
+} mdn_msgheader_t;
+
+/*
+ * Parse DNS message header into mdn_msgheader_t type.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_invalid_message -- message is too short.
+ */
+extern mdn_result_t
+mdn_msgheader_parse(const char *msg, size_t msglen, mdn_msgheader_t *parsed);
+
+/*
+ * Pack mdn_msgheader_t data.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_buffer_overflow -- output buffer is too small.
+ */
+extern mdn_result_t
+mdn_msgheader_unparse(mdn_msgheader_t *parsed, char *msg, size_t msglen);
+
+/*
+ * Convenient functions.
+ *
+ * They do not check the length of the message. Caller must make sure
+ * the message is not smaller than the header size (12 octets).
+ */
+extern unsigned int mdn_msgheader_getid(const char *msg);
+extern void mdn_msgheader_setid(char *msg, unsigned int id);
+
+#endif /* MDN_MSGHEADER_H */
diff --git a/contrib/idn/mdnkit/include/mdn/msgtrans.h b/contrib/idn/mdnkit/include/mdn/msgtrans.h
new file mode 100644
index 00000000..b65450ce
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/msgtrans.h
@@ -0,0 +1,130 @@
+/* $Id: msgtrans.h,v 1.1 2000/12/07 00:52:22 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_MSGTRANS_H
+#define MDN_MSGTRANS_H 1
+
+/*
+ * DNS message translator.
+ *
+ * Parse a DNS message, translate each domain name in it according
+ * to a rule, and rebuild a message with the translated domain names.
+ */
+
+#include <mdn/result.h>
+#include <mdn/converter.h>
+#include <mdn/normalizer.h>
+#include <mdn/zldrule.h>
+
+/*
+ * Translation parameters.
+ *
+ * 'use_local_rule' determines how local codeset and ZLD should be
+ * derived.
+ *
+ * If 'use_local_rule' is true, 'local_rule' will be used for
+ * determining ZLD/codeset. 'mdn_msgtrans_translate' will use
+ * the rule to determine the ZLD and codeset, and set 'local_zld'
+ * and 'local_converter' properly upon return.
+ *
+ * Otherwise, 'mdn_msgtrans_translate' will assume that specified
+ * domain name is either
+ * + the one having ZLD specified by 'local_zld' and codeset
+ * specified by 'local_converter', or
+ * + the one without ZLD and made of only legitimate characters
+ * (alphabets, digits and hyphens), that is, a non-internationalized
+ * domain name.
+ *
+ * If 'local_alt_converter' is not NULL, 'mdn_msgtrans_translate' tries
+ * converting the specified domain name using it before attempting
+ * 'local_conerter'.
+ *
+ * 'target_conveter' and 'target_zld' together define the ZLD/codeset
+ * of the target. If 'target_alt_converter' is not NULL, then it is
+ * used instead of 'target_converter' if the conversion from UTF-8 to
+ * the target encoding fails with error 'mdn_nomapping'.
+ *
+ * 'normalizer' defines the normalization schemes.
+ */
+typedef struct mdn_msgtrans_param {
+ int use_local_rule;
+ mdn_zldrule_t local_rule;
+ mdn_converter_t local_converter;
+ mdn_converter_t local_alt_converter;
+ char *local_zld;
+ mdn_converter_t target_converter;
+ mdn_converter_t target_alt_converter;
+ char *target_zld;
+ mdn_normalizer_t normalizer;
+} mdn_msgtrans_param_t;
+
+/*
+ * Translate DNS message according to the parameters given.
+ *
+ * Returns:
+ * mdn_success -- ok, translated successfully.
+ * mdn_invalid_message -- the specified message is not valid.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_msgtrans_translate(mdn_msgtrans_param_t *param,
+ const char *msg, size_t msglen,
+ char *outbuf, size_t outbufsize, size_t *outmsglenp);
+
+#endif /* MDN_MSGTRANS_H */
diff --git a/contrib/idn/mdnkit/include/mdn/normalizer.h b/contrib/idn/mdnkit/include/mdn/normalizer.h
new file mode 100644
index 00000000..1927111e
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/normalizer.h
@@ -0,0 +1,151 @@
+/* $Id: normalizer.h,v 1.1 2000/12/07 00:52:22 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_NORMALIZER_H
+#define MDN_NORMALIZER_H 1
+
+/*
+ * Domain name normalizer.
+ *
+ * Perform normalization on the specified strings. String must be
+ * in UTF-8 encoding.
+ */
+
+#include <mdn/result.h>
+
+/*
+ * Normalizer type (opaque).
+ */
+typedef struct mdn_normalizer *mdn_normalizer_t;
+
+/*
+ * Normalizer procedure type.
+ */
+typedef mdn_result_t (*mdn_normalizer_proc_t)(const char *from,
+ char *to, size_t tolen);
+
+/*
+ * Initialize this module.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_normalizer_initialize(void);
+
+/*
+ * Create a empty normalizer.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_normalizer_create(mdn_normalizer_t *ctxp);
+
+/*
+ * Release all the memory allocated for a normalizer created by
+ * 'mdn_normalizer_create'.
+ */
+extern void
+mdn_normalizer_destroy(mdn_normalizer_t ctx);
+
+/*
+ * Add a normalization scheme to a normalizer.
+ *
+ * Multiple shemes can be added to a normalizer, and they will be
+ * applied in order.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_invalid_name -- unknown scheme was specified.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_normalizer_add(mdn_normalizer_t ctx, const char *scheme_name);
+
+/*
+ * Perform normalization(s) defined by a normalizer to the specified string,
+ * If the normalizer has two or more normalization schemes, they are
+ * applied in order.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_buffer_overflow -- output buffer is too small.
+ * mdn_invalid_encoding -- input is not a valid UTF-8 string.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_normalizer_normalize(mdn_normalizer_t ctx, const char *from,
+ char *to, size_t tolen);
+
+/*
+ * Register a new normalization scheme.
+ *
+ * You can override the default normalization schemes, if you want.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_normalizer_register(const char *scheme_name, mdn_normalizer_proc_t proc);
+
+#endif /* MDN_NORMALIZER_H */
diff --git a/contrib/idn/mdnkit/include/mdn/race.h b/contrib/idn/mdnkit/include/mdn/race.h
new file mode 100644
index 00000000..946ab59f
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/race.h
@@ -0,0 +1,82 @@
+/* $Id: race.h,v 1.1 2000/12/07 00:52:22 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_RACE_H
+#define MDN_RACE_H 1
+
+/*
+ * RACE Converter.
+ *
+ * See Internet Draft draft-ietf-idn-race-02.txt for details.
+ */
+
+#include <mdn/result.h>
+#include <mdn/converter.h>
+
+extern mdn_result_t
+mdn__race_open(mdn_converter_t ctx, mdn_converter_dir_t dir);
+
+extern mdn_result_t
+mdn__race_close(mdn_converter_t ctx, mdn_converter_dir_t dir);
+
+extern mdn_result_t
+mdn__race_convert(mdn_converter_t ctx, mdn_converter_dir_t dir,
+ const char *from, char *to, size_t tolen);
+
+#endif /* MDN_RACE_H */
diff --git a/contrib/idn/mdnkit/include/mdn/res.h b/contrib/idn/mdnkit/include/mdn/res.h
new file mode 100644
index 00000000..93b83b85
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/res.h
@@ -0,0 +1,203 @@
+/* $Id: res.h,v 1.1 2000/12/07 00:52:22 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_RES_H
+#define MDN_RES_H 1
+
+/*
+ * Resolver library support.
+ *
+ * All the functions provided by this module requires MDN resolver
+ * configuration context of type 'mdn_resconf_t' as an argument.
+ * This context holds information described in the configuration file
+ * (mdnres.conf). See mdn_resconf module for details.
+ *
+ * All functions also accept NULL as the context, but since
+ * no conversion/normalization will be done in this case, it is
+ * pretty useless.
+ */
+
+#include <mdn/result.h>
+#include <mdn/resconf.h>
+
+/*
+ * Convert from the local codeset string to UCS (UTF-8).
+ *
+ * 'local_name' is a string containing a domain name encoded in the
+ * local codeset or the encoding specified by 'alternate-encoding'
+ * directive in the MDN configuration file (mdnres.conf).
+ * This function converts it to UCS and stores in
+ * the buffer 'ucs_name', which is 'ucs_name_len' bytes long.
+ *
+ * 'conf' is a MDN resolver configuration context created by
+ * 'mdn_resconf_create()', or NULL. If it is NULL, no conversion is
+ * performed, and the contents of 'local_name' are copied to 'ucs_name'
+ * verbatim.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_buffer_overflow -- output buffer is too small.
+ * mdn_invalid_encoding -- input string has invalid byte sequence.
+ * mdn_invalid_name -- local encoding (codeset) name is invalid.
+ * mdn_failure -- other failure.
+ */
+extern mdn_result_t
+mdn_res_localtoucs(mdn_resconf_t conf, const char *local_name,
+ char *ucs_name, size_t ucs_name_len);
+
+/*
+ * Convert from UCS (UTF-8) string to the local codeset.
+ *
+ * 'ucs_name' is a string containing a domain name encoded in UTF-8.
+ * This function converts it to the local codeset and stores in
+ * the buffer 'local_name', which is 'local_name_len' bytes long.
+ * If there are any characters which cannot be converted to the local
+ * codeset, the 'alternate-encoding' is used instead of the local codeset.
+ *
+ * 'conf' is a MDN resolver configuration context created by
+ * 'mdn_resconf_create()', or NULL. If it is NULL, no conversion is
+ * performed, and the contents of 'local_name' are copied to 'ucs_name'
+ * verbatim.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_buffer_overflow -- output buffer is too small.
+ * mdn_invalid_encoding -- input string has invalid byte sequence.
+ * mdn_invalid_name -- local encoding (codeset) name is invalid.
+ * mdn_failure -- other failure.
+ */
+extern mdn_result_t
+mdn_res_ucstolocal(mdn_resconf_t conf, const char *ucs_name,
+ char *local_name, size_t local_name_len);
+
+/*
+ * Normalize UCS string.
+ *
+ * Perform normalization/canonicalization specified by the configuration
+ * context 'conf' on the UTF-8 encoded string 'name', and store the result
+ * in 'normalized_name', whose size is 'normalized_name_len' bytes.
+ *
+ * 'conf' is a MDN resolver configuration context created by
+ * 'mdn_resconf_create()', or NULL. If it is NULL, no normalization is
+ * performed, and the contents of 'name' are copied to 'normalized_name'
+ * verbatim.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_buffer_overflow -- output buffer is too small.
+ * mdn_invalid_encoding -- input is not a valid UTF-8 string.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_res_normalize(mdn_resconf_t conf, const char *name,
+ char *normalized_name, size_t normalized_name_len);
+
+/*
+ * Convert from UCS (UTF-8) string to the encoding used in DNS protocol.
+ *
+ * 'ucs_name' is a string containing a domain name encoded in UTF-8.
+ * This function converts it to the encoding used in DNS protocol data
+ * (such as RACE), and stores in the buffer 'dns_name', which is
+ * 'dns_name_len' bytes long. Also if ZLD is specified in the configuration
+ * file, it is appended to the conversion result.
+ *
+ * Both the encoding used in DNS protocol and ZLD are specified by 'conf'
+ * which is a MDN resolver configuration context. If 'conf' is NULL,
+ * then no conversion is done.
+ *
+ * Requires:
+ * 'ucs_name' must be a FQDN. Otherwise the conversion result might
+ * not be correct for some DNS protocol encoding (namely UTF-5).
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_buffer_overflow -- output buffer is too small.
+ * mdn_invalid_encoding -- input string has invalid byte sequence.
+ * mdn_invalid_name -- local encoding (codeset) name is invalid.
+ * mdn_failure -- other failure.
+ */
+extern mdn_result_t
+mdn_res_ucstodns(mdn_resconf_t conf, const char *ucs_name, char *dns_name,
+ size_t dns_name_len);
+
+/*
+ * Convert from the DNS protocol encoding to UCS (UTF-8).
+ *
+ * This function converts 'dns_name' whose encoding is the encoding
+ * used in DNS protocol data into UTF-8, and stores the result in the
+ * buffer 'ucs_name', which is 'ucs_name_len' bytes long. Also, if
+ * 'dns_name' has ZLD specified by 'conf', the ZLD part is removed
+ * from 'dns_name' before the conversion.
+ *
+ * Both the encoding used in DNS protocol and ZLD are specified by 'conf'
+ * which is a MDN resolver configuration context. If 'conf' is NULL,
+ * then no conversion is done.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_buffer_overflow -- output buffer is too small.
+ * mdn_invalid_encoding -- input string has invalid byte sequence.
+ * mdn_invalid_name -- local encoding (codeset) name is invalid.
+ * mdn_failure -- other failure.
+ */
+extern mdn_result_t
+mdn_res_dnstoucs(mdn_resconf_t conf, const char *dns_name, char *ucs_name,
+ size_t ucs_name_len);
+
+#endif
diff --git a/contrib/idn/mdnkit/include/mdn/resconf.h b/contrib/idn/mdnkit/include/mdn/resconf.h
new file mode 100644
index 00000000..22762b15
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/resconf.h
@@ -0,0 +1,173 @@
+/* $Id: resconf.h,v 1.1 2000/12/07 00:52:23 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_RESCONF_H
+#define MDN_RESCONF_H 1
+
+/*
+ * MDN resolver configuration.
+ */
+
+#include <mdn/result.h>
+#include <mdn/converter.h>
+#include <mdn/normalizer.h>
+
+/*
+ * Configuration type (opaque).
+ */
+typedef struct mdn_resconf *mdn_resconf_t;
+
+/*
+ * Initialize.
+ *
+ * Initialize this module and underlying ones. Must be called before
+ * any other functions of this module.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_resconf_initialize(void);
+
+/*
+ * Create a configuration context.
+ *
+ * Create an empty context and store it in '*ctxp'.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_resconf_create(mdn_resconf_t *ctxp);
+
+/*
+ * Destroy the configuration context.
+ *
+ * Destroy the configuration context created by 'mdn_resconf_create',
+ * and release memory for it.
+ */
+extern void
+mdn_resconf_destroy(mdn_resconf_t ctx);
+
+/*
+ * Load configuration file.
+ *
+ * Parse an MDN configuration file whose name is specified by 'file',
+ * store the result in 'ctx'. If 'file' is NULL, the default file is
+ * loaded.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nofile -- couldn't open specified file.
+ * mdn_invalid_syntax -- syntax error found.
+ * mdn_invalid_name -- invalid encoding/nomalization name is
+ * specified.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_resconf_loadfile(mdn_resconf_t ctx, const char *file);
+
+/*
+ * Get the pathname of the default configuration file.
+ *
+ * Returns:
+ * the pathname of the default MDN configuration file.
+ */
+extern char *
+mdn_resconf_defaultfile(void);
+
+/*
+ * Get codeset converters.
+ *
+ * + for local encoding,
+ * + for DNS protocol encoding,
+ * + for alternate encoding (which is used when the string to be converterd
+ * to the local encoding has some characters having no mapping to the
+ * local encoding)
+ * In case of error, NULL will be returned.
+ */
+
+extern mdn_converter_t
+mdn_resconf_localconverter(mdn_resconf_t ctx);
+
+extern mdn_converter_t
+mdn_resconf_serverconverter(mdn_resconf_t ctx);
+
+extern mdn_converter_t
+mdn_resconf_alternateconverter(mdn_resconf_t ctx);
+
+/*
+ * Get Zero-Level-Domain name.
+ *
+ * If there's no ZLD, NULL will be returned.
+ */
+extern const char *
+mdn_resconf_zld(mdn_resconf_t ctx);
+
+/*
+ * Get domain name normalizer.
+ *
+ * In case of error, NULL will be returned.
+ */
+extern mdn_normalizer_t
+mdn_resconf_normalizer(mdn_resconf_t ctx);
+
+#endif
diff --git a/contrib/idn/mdnkit/include/mdn/result.h b/contrib/idn/mdnkit/include/mdn/result.h
new file mode 100644
index 00000000..4cb0cb29
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/result.h
@@ -0,0 +1,88 @@
+/* $Id: result.h,v 1.1 2000/12/07 00:52:23 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_RESULT_H
+#define MDN_RESULT_H 1
+
+/*
+ * MDN library result code.
+ */
+typedef enum {
+ mdn_success,
+ mdn_notfound,
+ mdn_invalid_encoding,
+ mdn_invalid_syntax,
+ mdn_invalid_name,
+ mdn_invalid_message,
+ mdn_buffer_overflow,
+ mdn_noentry,
+ mdn_nomemory,
+ mdn_nofile,
+ mdn_nomapping,
+ mdn_context_required,
+ mdn_failure /* !!This must be the last one!! */
+} mdn_result_t;
+
+/*
+ * Get the string description of a result code.
+ */
+extern char *
+mdn_result_tostring(mdn_result_t result);
+
+#endif /* MDN_RESULT_H */
diff --git a/contrib/idn/mdnkit/include/mdn/selectiveencode.h b/contrib/idn/mdnkit/include/mdn/selectiveencode.h
new file mode 100644
index 00000000..0d886210
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/selectiveencode.h
@@ -0,0 +1,85 @@
+/* $Id: selectiveencode.h,v 1.1 2000/12/07 00:52:23 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_SELECTIVENCODE_H
+#define MDN_SELECTIVENCODE_H 1
+
+/*
+ * Find where to convert.
+ *
+ * Find a substring for which MDN domain name codeset conversion is necessary.
+ */
+
+#include <mdn/result.h>
+
+/*
+ * Scan the given string 's' (in UTF-8 encoding) looking for a substring
+ * made of
+ * + at least one non-ascii character and
+ * + zero or more legitimate domain-name characters (i.e. ascii alphabets,
+ * digits and hyphens) and periods.
+ *
+ * Returns:
+ * mdn_success -- ok, found.
+ * mdn_notfound -- not found.
+ */
+extern mdn_result_t
+mdn_selectiveencode_findregion(const char *s, char **startp, char **endp);
+
+#endif /* MDN_SELECTIVENCODE_H */
diff --git a/contrib/idn/mdnkit/include/mdn/strhash.h b/contrib/idn/mdnkit/include/mdn/strhash.h
new file mode 100644
index 00000000..5e98cff2
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/strhash.h
@@ -0,0 +1,131 @@
+/* $Id: strhash.h,v 1.1 2000/12/07 00:52:23 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_STRHASH_H
+#define MDN_STRHASH_H 1
+
+/*
+ * String-keyed hash table
+ *
+ * Just a hash table. Nothing special. Number of hash buckets
+ * grows automatically.
+ */
+
+#include <mdn/result.h>
+
+/*
+ * Hash table type, which is opaque.
+ */
+typedef struct mdn_strhash *mdn_strhash_t;
+
+/*
+ * Hash value free proc.
+ */
+typedef void (*mdn_strhash_freeproc_t)(void *value);
+
+/*
+ * Create a hash table.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_strhash_create(mdn_strhash_t *hashp);
+
+/*
+ * Delete a hash table created by 'mdn_strhash_create'.
+ * If 'proc' is not NULL, it is called for each value in the
+ * hash to release memory for them.
+ */
+extern void
+mdn_strhash_destroy(mdn_strhash_t hash, mdn_strhash_freeproc_t proc);
+
+/*
+ * Register an item to the hash table. This function makes a
+ * private copy of the key string.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_strhash_put(mdn_strhash_t hash, const char *key, void *value);
+
+/*
+ * Find an item with the specified key.
+ *
+ * Returns:
+ * mdn_success -- ok. found.
+ * mdn_noentry -- not found.
+ */
+extern mdn_result_t
+mdn_strhash_get(mdn_strhash_t hash, const char *key, void **valuep);
+
+/*
+ * Check if an item with the specified key exists.
+ *
+ * Returns:
+ * 1 -- yes.
+ * 0 -- no.
+ */
+extern int
+mdn_strhash_exists(mdn_strhash_t hash, const char *key);
+
+#endif /* MDN_STRHASH_H */
diff --git a/contrib/idn/mdnkit/include/mdn/translator.h b/contrib/idn/mdnkit/include/mdn/translator.h
new file mode 100644
index 00000000..4f87045c
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/translator.h
@@ -0,0 +1,127 @@
+/* $Id: translator.h,v 1.1 2000/12/07 00:52:23 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_TRANSLATOR_H
+#define MDN_TRANSLATOR_H 1
+
+/*
+ * Domain name ZLD/codeset translator.
+ */
+
+#include <mdn/result.h>
+#include <mdn/converter.h>
+#include <mdn/normalizer.h>
+
+/*
+ * Translate domain name encoded in the local codeset to the target
+ * codeset.
+ *
+ * Requires:
+ * Both 'local_zld' and 'target_zld' must be canonicalized (or NULL)
+ * using mdn_translator_canonicalzld.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nomemory -- malloc failed.
+ * mdn_buffer_overflow -- output buffer too small.
+ * mdn_invalid_encoding -- there are some invalid characters in
+ * the specified domain name.
+ */
+extern mdn_result_t
+mdn_translator_translate(mdn_converter_t local_converter,
+ mdn_converter_t local_alternate_converter,
+ const char *local_zld,
+ mdn_normalizer_t normalizer,
+ mdn_converter_t target_converter,
+ mdn_converter_t target_alternate_converter,
+ const char *target_zld,
+ const char *from, char *to, size_t tolen);
+
+/*
+ * Canonicalize ZLD.
+ *
+ * Note:
+ * The string returned in *canonicalizedp is malloc'ed by this
+ * function. You should free it when no longer needed.
+ *
+ * If specified ZLD is "" or ".", NULL will be returned in
+ * *canonicalizedp.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_translator_canonicalzld(const char *zld, char **canonicalizedp);
+
+/*
+ * Try matching ZLD against domain name.
+ *
+ * Requires:
+ * 'zld' must be canonicalized (or NULL) using
+ * mdn_translator_canonicalzld.
+ *
+ * Returns:
+ * 1 -- match.
+ * 0 -- no match.
+ */
+extern int
+mdn_translator_matchzld(const char *domain, const char *zld);
+
+#endif /* MDN_TRANSLATOR_H */
diff --git a/contrib/idn/mdnkit/include/mdn/unicode.h b/contrib/idn/mdnkit/include/mdn/unicode.h
new file mode 100644
index 00000000..9cac4e13
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/unicode.h
@@ -0,0 +1,193 @@
+/* $Id: unicode.h,v 1.1 2000/12/07 00:52:23 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_UNICODE_H
+#define MDN_UNICODE_H 1
+
+/*
+ * Unicode attributes retriever.
+ *
+ * All the information this module provides is based on UnicodeData.txt,
+ * CompositionExclusions-1.txt and SpecialCasing.txt, all of which can be
+ * obtained from unicode.org.
+ *
+ * Unicode characters are represented as 'unsigned long'.
+ */
+
+#include <mdn/result.h>
+
+/*
+ * Context information for case conversion.
+ */
+typedef enum {
+ mdn__unicode_context_unknown,
+ mdn__unicode_context_final,
+ mdn__unicode_context_nonfinal
+} mdn__unicode_context_t;
+
+/*
+ * Get canonical class.
+ *
+ * For characters out of unicode range (i.e. above 0xffff), 0 will
+ * be returned.
+ */
+extern int
+mdn__unicode_canonicalclass(unsigned long c);
+
+/*
+ * Decompose a character.
+ *
+ * Decompose character given by 'c', and put the result into 'v',
+ * which can hold 'vlen' characters. The number of decomposed characters
+ * will be stored in '*decomp_lenp'.
+ *
+ * If 'compat' is true, compatibility decomposition is performed.
+ * Otherwise canonical decomposition is done.
+ *
+ * Since decomposition is done recursively, no further decomposition
+ * will be needed.
+ *
+ * Returns:
+ * mdn_success -- ok, decomposed.
+ * mdn_notfound -- no decomposition possible.
+ * mdn_buffer_overflow -- 'vlen' is too small.
+ */
+extern mdn_result_t
+mdn__unicode_decompose(int compat, unsigned long *v, size_t vlen,
+ unsigned long c, int *decomp_lenp);
+
+/*
+ * Perform canonical composition.
+ *
+ * Do canonical composition to the character sequence 'c1' and 'c2', put the
+ * result into '*compp'.
+ *
+ * Since Unicode Nomalization Froms requires only canonical composition,
+ * compatibility composition is not supported.
+ *
+ * Returns:
+ * mdn_success -- ok, composed.
+ * mdn_notfound -- no composition possible.
+ */
+extern mdn_result_t
+mdn__unicode_compose(unsigned long c1, unsigned long c2, unsigned long *compp);
+
+/*
+ * Returns if there may be a canonical composition sequence which starts
+ * with the given character.
+ *
+ * Returns:
+ * 1 -- there may be a composition sequence
+ * (maybe not).
+ * 0 -- no, there is definitely no such sequences.
+ */
+extern int
+mdn__unicode_iscompositecandidate(unsigned long c);
+
+/*
+ * Translate lowercase character to uppercase, and vice versa, according
+ * to Unicode Technical Report #21 "Case Mappings".
+ *
+ * Both functions perform conversion on the given unicode character 'c',
+ * put the result into 'v', whose size is specified by 'vlen'. The actual
+ * number of characters stored in 'v' are returned as '*convlenp'.
+ * In case 'c' has no mapping, 'v[0]' will contain 'c', and '*convlenp'
+ * will be 1.
+ *
+ * Note that these functions perform locale-independent case conversion.
+ *
+ * There are some characters whose case mapping depends on the context.
+ * 'ctx' specifies the context, which can be obtained by
+ * 'mdn__unicode_getcontext'. Most of the time you can just specify
+ * 'mdn__unicode_context_unknown' as 'ctx', and if those functions
+ * return 'mdn_context_required', you can get the context using
+ * 'mdn__unicode_getcontext' and try again.
+ *
+ * Returns:
+ * mdn_success -- successfully converted.
+ * mdn_context_required -- context information is needed to
+ * perform case conversion on 'c'.
+ * mdn_buffer_overflow -- 'vlen' is too small.
+ */
+extern mdn_result_t
+mdn__unicode_toupper(unsigned long c, mdn__unicode_context_t ctx,
+ unsigned long *v, size_t vlen, int *convlenp);
+extern mdn_result_t
+mdn__unicode_tolower(unsigned long c, mdn__unicode_context_t ctx,
+ unsigned long *v, size_t vlen, int *convlenp);
+
+/*
+ * Determine the context needed by the case conversion functions.
+ *
+ * Case conversion functions above needs context information for some
+ * characters. To get the context, you should call this function with
+ * the next character as the parameter. If you get final or nonfinal,
+ * you're done. If you get unknown, move on to the next character until
+ * you get final or nonfinal.
+ *
+ * Returns:
+ * mdn__unicode_context_final -- context is 'FINAL'.
+ * mdn__unicode_context_nonfinal -- context is 'NON_FINAL'.
+ * mdn__unicode_context_unknown -- context cannot be determined,
+ * try the next character.
+ */
+extern mdn__unicode_context_t
+mdn__unicode_getcontext(unsigned long c);
+
+#endif
diff --git a/contrib/idn/mdnkit/include/mdn/unormalize.h b/contrib/idn/mdnkit/include/mdn/unormalize.h
new file mode 100644
index 00000000..7444e051
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/unormalize.h
@@ -0,0 +1,100 @@
+/* $Id: unormalize.h,v 1.1 2000/12/07 00:52:23 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_UNORMALIZE_H
+#define MDN_UNORMALIZE_H 1
+
+/*
+ * Unicode Normalizations.
+ *
+ * Perform 4 normalizations defined by 'Unicode Normalization Forms'
+ * (http://www.unicode.org/unicode/reports/tr15)
+ *
+ * All of the functions use UTF-8 encoding for input/output.
+ */
+
+#include <mdn/result.h>
+
+/*
+ * Perform Unicode Normalication Form C, D, KC and KD.
+ *
+ * They take NUL-terminated UTF-8 encoded string 'from', perform
+ * the normalization, put the result (also a NUL-terminated UTF-8
+ * encoded string) to 'to', which must be able to hold at least
+ * 'tolen' bytes.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nomemory -- malloc failed.
+ * mdn_invalid_encoding -- input text is not a valid UTF-8 string.
+ * mdn_buffer_overflow -- 'tolen' is too small.
+ */
+extern mdn_result_t
+mdn__unormalize_formc(const char *from, char *to, size_t tolen);
+
+extern mdn_result_t
+mdn__unormalize_formd(const char *from, char *to, size_t tolen);
+
+extern mdn_result_t
+mdn__unormalize_formkc(const char *from, char *to, size_t tolen);
+
+extern mdn_result_t
+mdn__unormalize_formkd(const char *from, char *to, size_t tolen);
+
+#endif /* MDN_UNORMALIZE_H */
diff --git a/contrib/idn/mdnkit/include/mdn/utf5.h b/contrib/idn/mdnkit/include/mdn/utf5.h
new file mode 100644
index 00000000..4c1ae68d
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/utf5.h
@@ -0,0 +1,96 @@
+/* $Id: utf5.h,v 1.1 2000/12/07 00:52:23 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_UTF5_H
+#define MDN_UTF5_H 1
+
+/*
+ * UTF-5 encoded string facility.
+ */
+
+/*
+ * Get one character.
+ *
+ * Get the first character of the UTF-5 string pointed by 's', translate
+ * it into UCS-4 (an unsigned log value), and store it to '*vp'.
+ *
+ * It returns the number of bytes read, or zero if the encoding is invalid.
+ *
+ * This routine treats period (".") specially, that is, "." is recognized
+ * as a valid UTF-5 sequence which translated into itself. This is very
+ * convenient when converting domain names, but you should note that
+ * "." is NOT a valid byte in UTF-5 encoded sequece.
+ */
+extern int
+mdn_utf5_getwc(const char *s, size_t len, unsigned long *vp);
+
+/*
+ * Put one character.
+ *
+ * This function is an opposite of 'mdn_utf8_getwc'. It takes a UCS-4
+ * value 'v', convert it to UTF-5 encoded sequence, and store it to 's',
+ * whose length is 'len'. It returns the number of bytes written, or
+ * zero 'v' is out of range or 'len' is too small.
+ *
+ * The above note regarding "." also applies to this function.
+ */
+extern int
+mdn_utf5_putwc(char *s, size_t len, unsigned long v);
+
+#endif /* MDN_UTF5_H */
diff --git a/contrib/idn/mdnkit/include/mdn/utf8.h b/contrib/idn/mdnkit/include/mdn/utf8.h
new file mode 100644
index 00000000..13c226e7
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/utf8.h
@@ -0,0 +1,143 @@
+/* $Id: utf8.h,v 1.1 2000/12/07 00:52:23 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_UTF8_H
+#define MDN_UTF8_H 1
+
+/*
+ * UTF-8 encoded string facility.
+ */
+
+/*
+ * Get the length of a character.
+ *
+ * Get the length (in bytes) of a character whose first byte is pointed
+ * by 's'. Since this function only looks one first byte to determine the
+ * length, it is possible some of the following bytes are invalid.
+ */
+extern int
+mdn_utf8_mblen(const char *s);
+
+/*
+ * Get one character.
+ *
+ * Get the first character of the string pointed by 's', and copy it
+ * to 'buf', whose length is 'len'. Returns the number of bytes copied,
+ * or zero if the encoding is invalid or len is too small.
+ *
+ * The area pointed by 'buf' must be large enough to store any UTF-8 encoded
+ * character.
+ *
+ * Note that the copied string is not NUL-terminated.
+ */
+extern int
+mdn_utf8_getmb(const char *s, size_t len, char *buf);
+
+/*
+ * Get one character in UCS-4.
+ *
+ * Similar to 'mdn_utf8_getmb', except that the result is not in UTF-8
+ * encoding, but in UCS-4 format (plain 32bit integer value).
+ */
+extern int
+mdn_utf8_getwc(const char *s, size_t len, unsigned long *vp);
+
+/*
+ * Put one character.
+ *
+ * This function is an opposite of 'mdn_utf8_getwc'. It takes a UCS-4
+ * value 'v', convert it to UTF-8 encoded sequence, and store it to 's',
+ * whose length is 'len'. It returns the number of bytes written, or
+ * zero 'v' is out of range or 'len' is too small.
+ */
+extern int
+mdn_utf8_putwc(char *s, size_t len, unsigned long v);
+
+/*
+ * Check the validity of UTF-8 encoded character.
+ *
+ * Check if the character pointed by 's' is a valid UTF-8 encoded
+ * character. Return the length of the character (in bytes) if it is valid,
+ * 0 otherwise.
+ */
+extern int
+mdn_utf8_isvalidchar(const char *s);
+
+/*
+ * Check the validity of UTF-8 encoded string.
+ *
+ * Check if the NUL-terminated string 's' is valid as a UTF-8 encoded
+ * string. Return 1 if it is valid, 0 otherwise.
+ */
+extern int
+mdn_utf8_isvalidstring(const char *s);
+
+/*
+ * Find first byte of a character.
+ *
+ * Find the first byte of a character 's' points to. 's' may point
+ * the 2nd or later byte of a character. 'known_top' is a pointer to
+ * a string which contains 's', and is known to be the first byte of
+ * a character. If it couldn't find the first byte between 'known_top'
+ * and 's', NULL will be returned.
+ */
+extern char *
+mdn_utf8_findfirstbyte(const char *s, const char *known_top);
+
+#endif /* MDN_UTF8_H */
diff --git a/contrib/idn/mdnkit/include/mdn/util.h b/contrib/idn/mdnkit/include/mdn/util.h
new file mode 100644
index 00000000..0f81bd88
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/util.h
@@ -0,0 +1,101 @@
+/* $Id: util.h,v 1.1 2000/12/07 00:52:23 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_UTIL_H
+#define MDN_UTIL_H 1
+
+/*
+ * Utility functions.
+ */
+
+/*
+ * Case-insensitive string match.
+ *
+ * This function compares two strings in case-insensitive way, like
+ * strcasencmp() function which can be found in many systems.
+ * However, this function only disregards the case difference of ASCII
+ * letters ([A-Za-z]), so it is locale independent.
+ * The result is 1 if 's1' and 's2' match, 0 otherwise.
+ */
+extern int
+mdn_util_casematch(const char *s1, const char *s2, size_t n);
+
+/*
+ * Get a range of valid domain name characters.
+ *
+ * This function sees each character in string 's' until 'end',
+ * and checks if it is valid as a character in ASCII domain names.
+ * It returns a pointer to the first invalid character, or 'end'
+ * if all characters are valid.
+ */
+extern const char *
+mdn_util_domainspan(const char *s, const char *end);
+
+/*
+ * UTF-8 to UTF-16 conversion and vice versa.
+ */
+extern mdn_result_t
+mdn_util_utf8toutf16(const char *utf8, size_t fromlen,
+ unsigned short *utf16, size_t tolen, size_t *reslenp);
+
+extern mdn_result_t
+mdn_util_utf16toutf8(const unsigned short *utf16, size_t fromlen,
+ char *utf8, size_t tolen, size_t *reslenp);
+
+#endif /* MDN_UTIL_H */
diff --git a/contrib/idn/mdnkit/include/mdn/zldrule.h b/contrib/idn/mdnkit/include/mdn/zldrule.h
new file mode 100644
index 00000000..b8c744b1
--- /dev/null
+++ b/contrib/idn/mdnkit/include/mdn/zldrule.h
@@ -0,0 +1,128 @@
+/* $Id: zldrule.h,v 1.1 2000/12/07 00:52:23 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#ifndef MDN_ZLDRULE_H
+#define MDN_ZLDRULE_H 1
+
+/*
+ * ZLD matcher.
+ *
+ * This module provides a function that takes a domain name as input,
+ * and matches against set of ZLDs.
+ *
+ * Each ZLD has its corresponding codeset (character encoding), or codesets
+ * in which a domain name with the ZLD is encoded.
+ *
+ * The function returns the matched ZLD and the corresponding codeset.
+ *
+ * If a name matches more than one ZLDs, the longer one takes precedence.
+ *
+ * If matched ZLD has more than one codesets, each codeset is applied to
+ * the given domain name in order, and the first one for which the name
+ * is valid is chosen.
+ */
+
+#include <mdn/result.h>
+#include <mdn/converter.h>
+
+/*
+ * ZLD matching rule set type (opaque)
+ */
+typedef struct mdn_zldrule *mdn_zldrule_t;
+
+/*
+ * Create an empty rule set.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_zldrule_create(mdn_zldrule_t *ctxp);
+
+/*
+ * Destroy the rule set created by mdn_zldrule_create.
+ */
+extern void
+mdn_zldrule_destroy(mdn_zldrule_t ctx);
+
+/*
+ * Add a ZLD and corresponding encoding(s) to the rule set.
+ *
+ * Returns:
+ * mdn_success -- ok.
+ * mdn_nomemory -- malloc failed.
+ */
+extern mdn_result_t
+mdn_zldrule_add(mdn_zldrule_t ctx, const char *zld,
+ const char **encodings, int nencodings);
+
+/*
+ * Select matching ZLD and encoding for the specified domain name.
+ *
+ * Returns:
+ * mdn_success -- found.
+ * mdn_notfound -- not found.
+ * mdn_invalid_encoding -- ZLD matched, but encoding is wrong.
+ */
+extern mdn_result_t
+mdn_zldrule_select(mdn_zldrule_t ctx, const char *domain,
+ char **zldp, mdn_converter_t *convctxp);
+
+#endif /* MDN_ZLDRULE_H */
diff --git a/contrib/idn/mdnkit/install-sh b/contrib/idn/mdnkit/install-sh
new file mode 100755
index 00000000..ebc66913
--- /dev/null
+++ b/contrib/idn/mdnkit/install-sh
@@ -0,0 +1,250 @@
+#! /bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/contrib/idn/mdnkit/lib/Makefile.in b/contrib/idn/mdnkit/lib/Makefile.in
new file mode 100644
index 00000000..39605a3b
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/Makefile.in
@@ -0,0 +1,163 @@
+# $Id: Makefile.in,v 1.1 2000/12/07 00:52:23 tale Exp $
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+# Tokyo, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) Japan Network Information Center. All rights reserved."
+#
+# 4. Neither the name of JPNIC may be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "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 JPNIC 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 DAMAGES.
+#
+# 6. Indemnification by Licensee
+# Any person or entities using and/or redistributing this Software under
+# this License Terms and Conditions shall defend indemnify and hold
+# harmless JPNIC from and against any and all judgements damages,
+# expenses, settlement liabilities, cost and other liabilities of any
+# kind as a result of use and redistribution of this Software or any
+# claim, suite, action, litigation or proceeding by any third party
+# arising out of or relates to this License Terms and Conditions.
+#
+# 7. Governing Law, Jurisdiction and Venue
+# This License Terms and Conditions shall be governed by and and
+# construed in accordance with the law of Japan. Any person or entities
+# using and/or redistributing this Software under this License Terms and
+# Conditions hereby agrees and consent to the personal and exclusive
+# jurisdiction and venue of Tokyo District Court of Japan.
+
+LIB_CURRENT = 4
+LIB_REVISION = 0
+
+.SUFFIXES: .lo
+
+top_builddir = ..
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+BINDIR = @bindir@
+LIBDIR = @libdir@
+ETCDIR = @sysconfdir@
+
+CC = @CC@
+RANLIB = @RANLIB@
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+SHELL = @SHELL@
+LIBTOOL = @LIBTOOL@
+
+OPTS =
+INCS = -I$(srcdir)/../include -I../include
+DEFS = -DMDN_RESCONF_DIR="\"$(ETCDIR)\""
+
+CFLAGS = $(OPTS) $(INCS) $(DEFS) @CFLAGS@
+LDFLAGS = @LDFLAGS@
+
+ICONVLIB = @ICONVLIB@
+
+SRCS = \
+ brace.c \
+ converter.c \
+ debug.c \
+ dn.c \
+ lace.c \
+ localencoding.c \
+ log.c \
+ msgheader.c \
+ msgtrans.c \
+ normalizer.c \
+ race.c \
+ res.c \
+ resconf.c \
+ result.c \
+ selectiveencode.c \
+ strhash.c \
+ translator.c \
+ unicode.c \
+ unicodedata.c \
+ unormalize.c \
+ utf5.c \
+ utf8.c \
+ util.c \
+ zldrule.c
+
+OBJS = \
+ brace.lo \
+ converter.lo \
+ debug.lo \
+ dn.lo \
+ lace.lo \
+ localencoding.lo \
+ log.lo \
+ msgheader.lo \
+ msgtrans.lo \
+ normalizer.lo \
+ race.lo \
+ res.lo \
+ resconf.lo \
+ result.lo \
+ selectiveencode.lo \
+ strhash.lo \
+ translator.lo \
+ unicode.lo \
+ unormalize.lo \
+ utf5.lo \
+ utf8.lo \
+ util.lo \
+ zldrule.lo
+
+LIB = libmdn
+
+.c.lo:
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<
+
+all: $(LIB).la
+
+$(LIB).la: $(OBJS)
+ $(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
+ -version-info $(LIB_CURRENT):$(LIB_REVISION) \
+ -rpath $(LIBDIR) $(OBJS)
+
+install: $(LIB).la
+ [ -d $(LIBDIR) ] || mkdir $(LIBDIR)
+ $(LIBTOOL) $(INSTALL_DATA) $(LIB).la $(LIBDIR)
+ [ -f $(LIBDIR)/$(LIB).a ] && $(RANLIB) $(LIBDIR)/$(LIB).a
+ [ -d $(ETCDIR) ] || mkdir $(ETCDIR)
+ $(INSTALL_DATA) $(srcdir)/mdnres.conf.sample $(ETCDIR)
+
+clean:
+ rm -f *.o *.lo *.la *.a core *.core *~
diff --git a/contrib/idn/mdnkit/lib/README b/contrib/idn/mdnkit/lib/README
new file mode 100644
index 00000000..63d0d7d9
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/README
@@ -0,0 +1,82 @@
+This directory contains source files for MDN library.
+
+Here's the brief description of each module.
+
+
+* Higher level modules
+
+msgtrans.c
+ DNS message translator.
+ This is the heart of 'dnsproxy' daemon.
+
+translator.c
+ Domain name translator.
+ Perform domain name translation, including
+ + add/remove ZLD
+ + conversion between local codeset and target codeset
+ + normalization
+
+res.c
+resconf.c
+ Domain name translation interface suitable for embedding in
+ client-side resolver library, including configuration file
+ (mdnres.conf) reader.
+
+* Lower level modules
+
+converter.c
+ Codeset converter.
+ All the conversion is done between some local encoding and UTF-8.
+ It is specially designed for domain-name conversion.
+ For example some converter (such as UTF-5 <-> UTF-8)
+ treats period specially.
+
+normalizer.c
+ String normalizer, including Unicode normalization forms.
+
+unormalize.c
+ Perform normalization defined in "Unicode Normalization Forms".
+
+zldrule.c
+ Find out ZLD and codeset of a domain name.
+
+
+* Utility modules
+
+localencoding.c
+ Local encoding (codeset) detecter based on the locale information.
+
+debug.c
+ Debug utilities.
+
+log.c
+ Logging facility.
+
+msgheader.c
+ DNS message header parser/builder.
+
+dn.c
+ Domain name compression/expansion, similar to dn_comp/dn_expand
+ in the resolver library.
+
+race.c
+ Codeset conversion routine for RACE encoding.
+
+result.c
+ MDN result code to string conversion.
+
+strhash.c
+ String-keyed hash table.
+
+utf5.c
+ UTF-5 encoding utility.
+
+utf8.c
+ UTF-8 encoding utility.
+
+unicode.c
+ Provide access to various information contained in "UnicodeData.txt".
+
+selectiveencode.c
+ Find a substring which seems to be a part of domain name containing
+ non-ascii characters.
diff --git a/contrib/idn/mdnkit/lib/brace.c b/contrib/idn/mdnkit/lib/brace.c
new file mode 100644
index 00000000..0adf533f
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/brace.c
@@ -0,0 +1,775 @@
+#ifndef lint
+static char *rcsid = "$Id: brace.c,v 1.1 2000/12/07 00:52:24 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <mdn/result.h>
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/converter.h>
+#include <mdn/utf8.h>
+#include <mdn/debug.h>
+#include <mdn/brace.h>
+#include <mdn/util.h>
+
+#ifndef MDN_BRACE_SUFFIX
+#define MDN_BRACE_SUFFIX "-8q9"
+#endif
+#define BRACE_SUFFIX_LEN (strlen(MDN_BRACE_SUFFIX))
+#define BRACE_BUF_SIZE 128 /* more than enough */
+#define BRACE_BASE32(n) (brace_base32[n])
+#define BRACE_RBASE32(c) (brace_rbase32(c))
+
+#define IS_LDH(c) \
+ (('a' <= (c) && (c) <= 'z') || ('A' <= (c) && (c) <= 'Z') || \
+ ('0' <= (c) && (c) <= '9') || (c) == '-')
+
+/*
+ * Encoding Styles.
+ */
+enum {
+ half_row_style, /* all non-LDH characters are in a single half row */
+ full_row_style, /* all non-LDH characters are in a single row */
+ mixed_style,
+ no_row_style
+};
+
+/*
+ * Base-32 encoding array.
+ */
+static char brace_base32[] = "23456789abcdefghijkmnpqrstuvwxyz";
+
+static mdn_result_t brace_l2u(const char *from, const char *end,
+ char *to, size_t tolen, size_t *clenp);
+static mdn_result_t brace_u2l(const char *from, const char *end,
+ char *to, size_t tolen, size_t *clenp);
+static mdn_result_t brace_decode(const char *from, size_t fromlen,
+ char *to, size_t tolen);
+static mdn_result_t brace_decode_utf16(const char *from,
+ size_t fromlen,
+ unsigned short *buf,
+ size_t *lenp);
+static mdn_result_t brace_encode(const char *from, size_t fromlen,
+ char *to, size_t tolen);
+static mdn_result_t brace_encode_utf16(const unsigned short *p, size_t len,
+ char *to, size_t tolen,
+ int encoding_style,
+ unsigned short row);
+static mdn_result_t get_encoding_style(unsigned short *p, size_t len,
+ int *stylep, unsigned short *rowp);
+static int brace_rbase32(int c);
+
+/* ARGSUSED */
+mdn_result_t
+mdn__brace_open(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ return (mdn_success);
+}
+
+/* ARGSUSED */
+mdn_result_t
+mdn__brace_close(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ return (mdn_success);
+}
+
+mdn_result_t
+mdn__brace_convert(mdn_converter_t ctx, mdn_converter_dir_t dir,
+ const char *from, char *toorg, size_t tolen)
+{
+ char *to = toorg;
+
+ assert(ctx != NULL &&
+ (dir == mdn_converter_l2u || dir == mdn_converter_u2l));
+
+ TRACE(("mdn__brace_convert(dir=%s,from=\"%s\")\n",
+ dir == mdn_converter_l2u ? "l2u" : "u2l",
+ mdn_debug_xstring(from, 20)));
+
+ for (;;) {
+ const char *end;
+ size_t convlen;
+ mdn_result_t r;
+
+ /*
+ * Find the end of this component (label).
+ */
+ if ((end = strchr(from, '.')) == NULL)
+ end = from + strlen(from);
+
+ /*
+ * Convert it.
+ */
+ if (dir == mdn_converter_l2u)
+ r = brace_l2u(from, end, to, tolen, &convlen);
+ else
+ r = brace_u2l(from, end, to, tolen, &convlen);
+ if (r != mdn_success)
+ return (r);
+
+ /*
+ * Copy '.' or NUL.
+ */
+ if (tolen <= convlen)
+ return (mdn_buffer_overflow);
+
+ to += convlen;
+ *to++ = *end;
+ tolen -= convlen + 1;
+
+ if (*end == '\0')
+ break;
+
+ from = end + 1;
+ }
+
+ DUMP(("mdn__brace_convert: \"%s\"\n", mdn_debug_xstring(toorg, 70)));
+
+ return (mdn_success);
+}
+
+static mdn_result_t
+brace_l2u(const char *from, const char *end,
+ char *to, size_t tolen, size_t *clenp) {
+ size_t len = end - from;
+ size_t suflen = BRACE_SUFFIX_LEN;
+
+ if (len >= suflen &&
+ mdn_util_casematch(end - suflen, MDN_BRACE_SUFFIX, suflen)) {
+ /*
+ * BRACE encoding suffix found.
+ */
+ mdn_result_t r;
+
+ r = brace_decode(from, len - suflen, to, tolen);
+ if (r == mdn_invalid_encoding)
+ goto copy;
+ else if (r != mdn_success)
+ return (r);
+
+ len = strlen(to);
+ } else {
+ /*
+ * Not BRACE encoded. Copy verbatim.
+ */
+ copy:
+ if (mdn_util_domainspan(from, end) < end) {
+ /* invalid character found */
+ return (mdn_invalid_encoding);
+ }
+
+ if (tolen < len)
+ return (mdn_buffer_overflow);
+
+ (void)memcpy(to, from, len);
+ }
+ *clenp = len;
+ return (mdn_success);
+}
+
+static mdn_result_t
+brace_u2l(const char *from, const char *end,
+ char *to, size_t tolen, size_t *clenp) {
+ size_t len = end - from;
+ size_t suflen = BRACE_SUFFIX_LEN;
+
+ /*
+ * See if encoding is necessary.
+ */
+ if (mdn_util_domainspan(from, end) < end ||
+ (len >= suflen &&
+ mdn_util_casematch(end - suflen, MDN_BRACE_SUFFIX, suflen))) {
+ /*
+ * Conversion is necessary.
+ */
+ mdn_result_t r;
+ size_t t;
+
+ r = brace_encode(from, len, to, tolen);
+ if (r != mdn_success)
+ return (r);
+ t = strlen(to);
+
+ /* Append suffix. */
+ if (tolen < t + suflen)
+ return (mdn_buffer_overflow);
+ (void)memcpy(to + t, MDN_BRACE_SUFFIX, suflen);
+
+ len = t + suflen;
+ } else {
+ /*
+ * Conversion is NOT necessary.
+ * Copy verbatim.
+ */
+ if (tolen < len)
+ return (mdn_buffer_overflow);
+
+ (void)memcpy(to, from, len);
+ }
+ *clenp = len;
+ return (mdn_success);
+}
+
+static mdn_result_t
+brace_decode(const char *from, size_t fromlen, char *to, size_t tolen) {
+ unsigned short *buf;
+ unsigned short local_buf[BRACE_BUF_SIZE];
+ size_t len, reslen;
+ mdn_result_t r;
+
+ /*
+ * Allocate sufficient buffer.
+ */
+ if (fromlen > BRACE_BUF_SIZE) {
+ if ((buf = malloc(sizeof(*buf) * fromlen)) == NULL)
+ return (mdn_nomemory);
+ } else {
+ /* Use local buffer. */
+ buf = local_buf;
+ }
+
+ /*
+ * Decode into UTF-16 string.
+ */
+ r = brace_decode_utf16(from, fromlen, buf, &len);
+ if (r != mdn_success)
+ goto ret;
+
+ /*
+ * Now 'buf' points the decompressed string, which must contain
+ * UTF-16 characters.
+ */
+
+ /*
+ * Convert to utf-8.
+ */
+ r = mdn_util_utf16toutf8(buf, len, to, tolen, &reslen);
+ if (r != mdn_success)
+ goto ret;
+ if (reslen >= tolen) {
+ r = mdn_buffer_overflow;
+ goto ret;
+ }
+ to[reslen] = '\0';
+
+ r = mdn_success;
+
+ret:
+ if (buf != local_buf)
+ free(buf);
+ return (r);
+}
+
+static mdn_result_t
+brace_decode_utf16(const char *from, size_t fromlen,
+ unsigned short *buf, size_t *lenp)
+{
+ int encoding_style;
+ unsigned short row;
+ unsigned long bitbuf = 0;
+ int bitlen = 0;
+ int literal_mode;
+ int i;
+
+#define READ_BITS(n) \
+ do { \
+ int len = (n); \
+ while (bitlen < len) { \
+ int x; \
+ if (fromlen-- <= 0) \
+ return (mdn_invalid_encoding); \
+ if ((x = BRACE_RBASE32(*from++)) < 0) \
+ return (mdn_invalid_encoding); \
+ bitbuf = (bitbuf << 5) | x; \
+ bitlen += 5; \
+ } \
+ } while (0)
+#define EXTRACT_BITS(n) \
+ (bitlen -= (n), ((bitbuf >> bitlen) & ((1<<(n)) - 1)))
+
+ READ_BITS(2);
+ switch (EXTRACT_BITS(2)) {
+ case 0:
+ encoding_style = half_row_style;
+ READ_BITS(9);
+ row = EXTRACT_BITS(9) << 7;
+ break;
+ case 1:
+ encoding_style = full_row_style;
+ READ_BITS(8);
+ row = EXTRACT_BITS(8) << 8;
+ break;
+ case 2:
+ encoding_style = mixed_style;
+ READ_BITS(9);
+ row = EXTRACT_BITS(9) << 7;
+ break;
+ case 3:
+ encoding_style = no_row_style;
+ row = 0; /* to keep lint happy */
+ break;
+ default:
+ FATAL(("brace_decode_utf16: internal error\n"));
+ abort();
+ return (mdn_failure); /* to keep lint happy */
+ }
+
+ i = 0;
+ literal_mode = 0;
+ while (fromlen > 0) {
+ int c = *from; /* peek */
+
+ if (c == '-') {
+ if (fromlen > 0 && from[1] == '-') {
+ buf[i++] = '-';
+ from += 2;
+ fromlen -= 2;
+ } else {
+ literal_mode = !literal_mode;
+ from++;
+ fromlen--;
+ }
+ } else if (literal_mode) {
+ buf[i++] = c;
+ from++;
+ fromlen--;
+ } else {
+ switch (encoding_style) {
+ case half_row_style:
+ READ_BITS(7);
+ buf[i++] = row | EXTRACT_BITS(7);
+ break;
+ case full_row_style:
+ READ_BITS(8);
+ buf[i++] = row | EXTRACT_BITS(8);
+ break;
+ case mixed_style:
+ READ_BITS(2);
+ if (EXTRACT_BITS(1)) {
+ if (EXTRACT_BITS(1)) {
+ READ_BITS(16);
+ buf[i++] = EXTRACT_BITS(16);
+ } else {
+ READ_BITS(7);
+ buf[i++] = (row ^ 0x80) |
+ EXTRACT_BITS(7);
+ }
+ } else {
+ READ_BITS(7);
+ buf[i++] = row | EXTRACT_BITS(7);
+ }
+ break;
+ case no_row_style:
+ READ_BITS(16);
+ buf[i++] = EXTRACT_BITS(16);
+ break;
+ }
+ }
+ }
+
+ if (bitlen > 4)
+ return (mdn_invalid_encoding);
+
+ *lenp = i;
+ return (mdn_success);
+#undef READ_BITS
+#undef EXTRACT_BITS
+}
+
+static mdn_result_t
+brace_encode(const char *from, size_t fromlen, char *to, size_t tolen) {
+ unsigned short *buf;
+ unsigned short local_buf[BRACE_BUF_SIZE]; /* UTF-16 */
+ unsigned short row;
+ mdn_result_t r;
+ size_t buflen, len;
+ int encoding_style;
+
+ /*
+ * Convert to UTF-16.
+ */
+ buf = local_buf;
+ buflen = BRACE_BUF_SIZE;
+ for (;;) {
+ r = mdn_util_utf8toutf16(from, fromlen,
+ buf, buflen, &len);
+ if (r == mdn_buffer_overflow) {
+ buflen *= 2;
+ if (buf == local_buf)
+ buf = malloc(sizeof(*buf) * buflen);
+ else
+ buf = realloc(buf, sizeof(*buf) * buflen);
+ if (buf == NULL)
+ return (mdn_nomemory);
+ } else if (r == mdn_success) {
+ break;
+ } else {
+ goto finish;
+ }
+ }
+
+ /*
+ * Now 'buf' contains UTF-16 encoded string consisting of
+ * 'len' characters.
+ */
+
+ /*
+ * Choose encoding style.
+ */
+ r = get_encoding_style(buf, len, &encoding_style, &row);
+ if (r != mdn_success)
+ goto finish;
+
+ r = brace_encode_utf16(buf, len, to, tolen, encoding_style, row);
+
+finish:
+ if (buf != local_buf)
+ free(buf);
+ return (r);
+}
+
+static mdn_result_t
+brace_encode_utf16(const unsigned short *p, size_t len,
+ char *to, size_t tolen,
+ int encoding_style, unsigned short row)
+{
+ unsigned long bitbuf = 0; /* bit stream buffer */
+ char *save_to;
+ int bitlen = 0; /* # of bits in 'bitbuf' */
+ int nonhyphen;
+ int i;
+
+#define FLUSH_BITS_1(p) \
+ do { \
+ int x = (bitbuf >> (bitlen - 5)) & 0x1f; \
+ bitlen -= 5; \
+ *p = BRACE_BASE32(x); \
+ } while (0)
+#define FLUSH_BITS \
+ do { \
+ while (bitlen >= 5) { \
+ if (tolen < 1) \
+ return (mdn_buffer_overflow); \
+ FLUSH_BITS_1(to); \
+ to++, tolen--; \
+ } \
+ } while (0)
+#define PUT(c) \
+ do { \
+ if (tolen-- < 1) \
+ return (mdn_buffer_overflow); \
+ *to++ = c; \
+ } while (0)
+
+ switch (encoding_style) {
+ case half_row_style:
+ /* 00xxxxxxxxx */
+ bitbuf = row >> 7;
+ bitlen = 2 + 9;
+ break;
+ case full_row_style:
+ /* 01xxxxxxxx */
+ bitbuf = (1 << 8) | (row >> 8);
+ bitlen = 2 + 8;
+ break;
+ case mixed_style:
+ /* 10xxxxxxxxx */
+ bitbuf = (1 << 10) | (row >> 7);
+ bitlen = 2 + 9;
+ break;
+ case no_row_style:
+ /* 11 */
+ bitbuf = 3;
+ bitlen = 2;
+ break;
+ default:
+ FATAL(("brace_compress_encode: internal error "
+ "invalid encoding_style\n"));
+ abort();
+ break;
+ }
+
+ FLUSH_BITS;
+
+ if (bitlen > 0) {
+ save_to = to++;
+ if (tolen-- < 1)
+ return (mdn_buffer_overflow);
+ } else {
+ save_to = NULL;
+ }
+
+ nonhyphen = 0;
+ for (i = 0; i < len; i++) {
+ if (p[i] == 0x2d) {
+ PUT('-');
+ PUT('-');
+ } else if (IS_LDH(p[i])) {
+ if (!nonhyphen)
+ PUT('-');
+ PUT(p[i]);
+ nonhyphen = 1;
+ } else {
+ if (nonhyphen) {
+ PUT('-');
+ }
+ nonhyphen = 0;
+ switch (encoding_style) {
+ case half_row_style:
+ bitlen += 7;
+ bitbuf = (bitbuf << 7) | (p[i] & 0x7f);
+ break;
+ case full_row_style:
+ bitlen += 8;
+ bitbuf = (bitbuf << 8) | (p[i] & 0xff);
+ break;
+ case mixed_style:
+ if ((p[i] & 0xff80) == row) {
+ bitlen += 8;
+ bitbuf = (bitbuf << 8) | (p[i] & 0x7f);
+ } else if ((p[i] & 0xff80) == (row ^ 0x80)) {
+ bitlen += 9;
+ bitbuf = (bitbuf << 9) | (1 << 8) |
+ (p[i] & 0x7f);
+ } else {
+ bitlen += 18;
+ bitbuf = (bitbuf << 18) | (3 << 16) |
+ p[i];
+ }
+ break;
+ case no_row_style:
+ bitlen += 16;
+ bitbuf = (bitbuf << 16) | p[i];
+ break;
+ }
+ if (save_to != NULL)
+ FLUSH_BITS_1(save_to);
+ FLUSH_BITS;
+ if (bitlen > 0) {
+ save_to = to++;
+ if (tolen-- < 1)
+ return (mdn_buffer_overflow);
+ } else {
+ save_to = NULL;
+ }
+ }
+ }
+ if (bitlen > 0) {
+ assert(save_to != NULL && bitlen < 5);
+ bitbuf <<= 5 - bitlen;
+ bitlen = 5;
+ FLUSH_BITS_1(save_to);
+ }
+
+ if (tolen <= 0)
+ return (mdn_buffer_overflow);
+
+ *to = '\0';
+ return (mdn_success);
+#undef FLUSH_BITS_1
+#undef FLUSH_BITS
+#undef PUT
+}
+
+static mdn_result_t
+get_encoding_style(unsigned short *p, size_t len,
+ int *stylep, unsigned short *rowp)
+{
+ struct row {
+ unsigned short upper;
+ unsigned short num;
+ unsigned short cmpl;
+ } *row_cands, row_cands_buf[64]; /* usually 64 is enough */
+ int cands_size = 64;
+ int num_cands = 0;
+ int num_nonldh = 0;
+ int style = no_row_style; /* to keep lint happy */
+ int best;
+ int m, m_prime;
+ int i, j;
+
+ row_cands = row_cands_buf;
+
+ for (i = 0; i < len; i++) {
+ unsigned int upper;
+
+ /* Ignore LDH characters. */
+ if (IS_LDH(p[i]))
+ continue;
+
+ num_nonldh++;
+ upper = p[i] & 0xff80; /* upper 9bits */
+
+ for (j = 0; j < num_cands; j++) {
+ if (upper == row_cands[j].upper) {
+ row_cands[j].num++;
+ goto found;
+ }
+ }
+ if (num_cands >= cands_size) {
+ /* Make the row buffer bigger. */
+ cands_size *= 2;
+ if (row_cands == row_cands_buf)
+ row_cands = malloc(sizeof(struct row) *
+ cands_size);
+ else
+ row_cands = realloc(row_cands,
+ sizeof(struct row) *
+ cands_size);
+ if (row_cands == NULL)
+ return (mdn_nomemory);
+ }
+ row_cands[num_cands].upper = upper;
+ row_cands[num_cands].num = 1;
+ row_cands[num_cands].cmpl = 0;
+ num_cands++;
+ found:
+ ;
+ }
+
+ if (num_cands == 0) {
+ /*
+ * There is no non-LDH characters. Draft is not clear on
+ * this case, but the sample implementation uses no-row style.
+ */
+ style = no_row_style;
+ goto ret;
+ }
+ if (num_cands == 1) {
+ /*
+ * Choose half-row style.
+ */
+ *rowp = row_cands[0].upper;
+ style = half_row_style;
+ goto ret;
+ }
+ if (num_cands == 2 &&
+ (row_cands[0].upper ^ row_cands[1].upper) == 0x80) {
+ /*
+ * All the non-LDH characters are in the same row.
+ * Choose full-row style.
+ */
+ *rowp = row_cands[0].upper & ~0x80;
+ style = full_row_style;
+ goto ret;
+ }
+
+ /*
+ * Get the number of characters in the complementary half-row.
+ */
+ for (i = 1; i < num_cands; i++) {
+ unsigned int upper = row_cands[i].upper;
+
+ for (j = 0; j < i; j++) {
+ if ((row_cands[j].upper ^ upper) == 0x80) {
+ row_cands[i].cmpl = row_cands[j].num;
+ row_cands[j].cmpl = row_cands[i].num;
+ break;
+ }
+ }
+ }
+
+ /*
+ * Choose the best M.
+ */
+#define M(i) \
+ (3 + (num_nonldh * 18 - row_cands[i].num * 10 - row_cands[i].cmpl * 9) / 5)
+ for (best = 0, m = M(0), i = 1; i < num_cands; i++) {
+ int m_i = M(i);
+ if (m_i < m ||
+ (m_i == m && row_cands[i].upper < row_cands[best].upper)) {
+ best = i;
+ m = m_i;
+ }
+ }
+#undef M
+ m_prime = (6 + num_nonldh * 16) / 5;
+ if (m_prime <= m) {
+ style = no_row_style;
+ } else {
+ *rowp = row_cands[best].upper;
+ style = mixed_style;
+ }
+ ret:
+ if (row_cands != row_cands_buf)
+ free(row_cands);
+ *stylep = style;
+ return (mdn_success);
+}
+
+static int
+brace_rbase32(int c) {
+ if ('A' <= c && c <= 'Z')
+ c = 'a' + (c - 'A');
+ if ('2' <= c && c <= '9')
+ return (c - '2');
+ else if ('a' <= c && c <= 'k')
+ return (c - 'a' + 8);
+ else if ('m' <= c && c <= 'n')
+ return (c - 'm' + 19);
+ else if ('p' <= c && c <= 'z')
+ return (c - 'p' + 21);
+ else
+ return (-1);
+}
diff --git a/contrib/idn/mdnkit/lib/converter.c b/contrib/idn/mdnkit/lib/converter.c
new file mode 100644
index 00000000..b9591721
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/converter.c
@@ -0,0 +1,994 @@
+#ifndef lint
+static char *rcsid = "$Id: converter.c,v 1.1 2000/12/07 00:52:24 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <iconv.h>
+
+#include <mdn/result.h>
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/converter.h>
+#include <mdn/strhash.h>
+#include <mdn/utf8.h>
+#include <mdn/utf5.h>
+#include <mdn/debug.h>
+#include <mdn/race.h>
+#include <mdn/brace.h>
+#include <mdn/lace.h>
+
+#ifndef MDN_UTF8_ENCODING_NAME
+#define MDN_UTF8_ENCODING_NAME "UTF-8" /* by IANA */
+#endif
+#ifndef MDN_UTF5_ENCODING_NAME
+#define MDN_UTF5_ENCODING_NAME "UTF-5"
+#endif
+#ifndef MDN_RACE_ENCODING_NAME
+#define MDN_RACE_ENCODING_NAME "RACE"
+#endif
+#ifndef MDN_BRACE_ENCODING_NAME
+#define MDN_BRACE_ENCODING_NAME "BRACE"
+#endif
+#ifndef MDN_LACE_ENCODING_NAME
+#define MDN_LACE_ENCODING_NAME "LACE"
+#endif
+
+#define MAX_RECURSE 20
+
+typedef struct {
+ mdn_converter_openproc_t open;
+ mdn_converter_closeproc_t close;
+ mdn_converter_convertproc_t convert;
+ int ascii_compatible;
+} converter_ops_t;
+
+struct mdn_converter {
+ char *local_encoding_name;
+ converter_ops_t *ops;
+ int flags;
+ int opened[2];
+ iconv_t ictx[2];
+};
+
+static mdn_strhash_t encoding_name_hash;
+static mdn_strhash_t encoding_alias_hash;
+
+static mdn_result_t converter_open(mdn_converter_t ctx,
+ mdn_converter_dir_t dir);
+static mdn_result_t converter_close(mdn_converter_t ctx,
+ mdn_converter_dir_t dir);
+static mdn_result_t register_standard_encoding(void);
+static const char *get_realname(const char *name);
+static void free_alias_value(void *value);
+static mdn_result_t roundtrip_check(mdn_converter_t ctx,
+ mdn_converter_dir_t dir,
+ const char *from, const char *to);
+static mdn_result_t converter_none_open(mdn_converter_t ctx,
+ mdn_converter_dir_t dir);
+static mdn_result_t converter_none_close(mdn_converter_t ctx,
+ mdn_converter_dir_t dir);
+static mdn_result_t converter_none_convert(mdn_converter_t ctx,
+ mdn_converter_dir_t dir,
+ const char *from,
+ char *to, size_t tolen);
+static mdn_result_t converter_iconv_open(mdn_converter_t ctx,
+ mdn_converter_dir_t dir);
+static mdn_result_t converter_iconv_close(mdn_converter_t ctx,
+ mdn_converter_dir_t dir);
+static mdn_result_t converter_iconv_convert(mdn_converter_t ctx,
+ mdn_converter_dir_t dir,
+ const char *from,
+ char *to, size_t tolen);
+static mdn_result_t converter_utf5_open(mdn_converter_t ctx,
+ mdn_converter_dir_t dir);
+static mdn_result_t converter_utf5_close(mdn_converter_t ctx,
+ mdn_converter_dir_t dir);
+static mdn_result_t converter_utf5_convert(mdn_converter_t ctx,
+ mdn_converter_dir_t dir,
+ const char *from,
+ char *to, size_t tolen);
+#ifdef DEBUG
+static mdn_result_t converter_uescape_open(mdn_converter_t ctx,
+ mdn_converter_dir_t dir);
+static mdn_result_t converter_uescape_close(mdn_converter_t ctx,
+ mdn_converter_dir_t dir);
+static mdn_result_t converter_uescape_convert(mdn_converter_t ctx,
+ mdn_converter_dir_t dir,
+ const char *from,
+ char *to, size_t tolen);
+#endif
+
+static converter_ops_t none_converter_ops = {
+ converter_none_open,
+ converter_none_close,
+ converter_none_convert,
+ 0,
+};
+
+static converter_ops_t iconv_converter_ops = {
+ converter_iconv_open,
+ converter_iconv_close,
+ converter_iconv_convert,
+ 0,
+};
+
+/*
+ * Initialize.
+ */
+
+mdn_result_t
+mdn_converter_initialize(void) {
+ mdn_result_t r = mdn_success;
+ mdn_strhash_t hash;
+
+ if (encoding_alias_hash == NULL) {
+ if ((r = mdn_strhash_create(&hash)) != mdn_success)
+ return (r);
+ encoding_alias_hash = hash;
+ }
+ if (encoding_name_hash == NULL) {
+ if ((r = mdn_strhash_create(&hash)) != mdn_success)
+ return (r);
+ encoding_name_hash = hash;
+ r = register_standard_encoding();
+ }
+ return (r);
+}
+
+mdn_result_t
+mdn_converter_create(const char *name, mdn_converter_t *ctxp, int flags) {
+ const char *realname;
+ mdn_converter_t ctx;
+ mdn_result_t r;
+ void *v;
+
+ assert(name != NULL && ctxp != NULL);
+
+ TRACE(("mdn_converter_create(%s)\n", name));
+
+ realname = get_realname(name);
+#ifdef DEBUG
+ if (strcmp(name, realname) != 0) {
+ TRACE(("mdn_converter_create: realname=%s\n", realname));
+ }
+#endif
+
+ *ctxp = NULL;
+
+ /* Allocate memory for a converter context and the name. */
+ ctx = malloc(sizeof(struct mdn_converter) + strlen(realname) + 1);
+ if (ctx == NULL) {
+ WARNING(("mdn_converter_create: malloc failed\n"));
+ return (mdn_nomemory);
+ }
+ (void)memset(ctx, 0, sizeof(*ctx));
+ ctx->local_encoding_name = (char *)(ctx + 1);
+ (void)strcpy(ctx->local_encoding_name, realname);
+ ctx->flags = flags;
+
+ assert(encoding_name_hash != NULL);
+
+ if (strcmp(realname, MDN_UTF8_ENCODING_NAME) == 0) {
+ /* No conversion needed */
+ ctx->ops = &none_converter_ops;
+ } else if ((r = mdn_strhash_get(encoding_name_hash, realname, &v))
+ == mdn_success) {
+ /* Special converter found */
+ ctx->ops = (converter_ops_t *)v;
+ } else {
+ /* General case */
+ ctx->ops = &iconv_converter_ops;
+ }
+
+ if ((flags & MDN_CONVERTER_DELAYEDOPEN) == 0) {
+ mdn_result_t r;
+
+ if ((r = converter_open(ctx,
+ mdn_converter_l2u)) != mdn_success) {
+ WARNING(("mdn_converter_create: open failed "
+ "(local->utf8)\n"));
+ return (r);
+ }
+ if ((r = converter_open(ctx,
+ mdn_converter_u2l)) != mdn_success) {
+ WARNING(("mdn_converter_create: open failed "
+ "(utf8->local)\n"));
+ return (r);
+ }
+ }
+
+ *ctxp = ctx;
+ return (mdn_success);
+}
+
+static mdn_result_t
+converter_open(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ mdn_result_t st = mdn_success;
+
+ assert(ctx != NULL &&
+ (dir == mdn_converter_l2u || dir == mdn_converter_u2l));
+
+ if (!ctx->opened[dir]) {
+ st = (*ctx->ops->open)(ctx, dir);
+ if (st == mdn_success)
+ ctx->opened[dir] = 1;
+ }
+ return (st);
+}
+
+void
+mdn_converter_destroy(mdn_converter_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("mdn_converter_destroy()\n"));
+
+ (void)converter_close(ctx, mdn_converter_l2u);
+ (void)converter_close(ctx, mdn_converter_u2l);
+ free(ctx);
+}
+
+static mdn_result_t
+converter_close(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ mdn_result_t st = mdn_success;
+
+ assert(ctx != NULL &&
+ (dir == mdn_converter_l2u || dir == mdn_converter_u2l));
+
+ if (ctx->opened[dir]) {
+ st = (*ctx->ops->close)(ctx, dir);
+ if (st == mdn_success)
+ ctx->opened[dir] = 0;
+ }
+ return (st);
+}
+
+char *
+mdn_converter_localencoding(mdn_converter_t ctx) {
+ assert(ctx != NULL);
+ TRACE(("mdn_converter_localencoding()\n"));
+ return (ctx->local_encoding_name);
+}
+
+int
+mdn_converter_isasciicompatible(mdn_converter_t ctx) {
+ assert(ctx != NULL);
+ TRACE(("mdn_converter_isasciicompatible()\n"));
+ return (ctx->ops->ascii_compatible);
+}
+
+mdn_result_t
+mdn_converter_convert(mdn_converter_t ctx, mdn_converter_dir_t dir,
+ const char *from, char *to, size_t tolen)
+{
+ mdn_result_t r;
+
+ assert(ctx != NULL &&
+ (dir == mdn_converter_l2u || dir == mdn_converter_u2l));
+
+ TRACE(("mdn_converter_convert(dir=%s,from=\"%s\")\n",
+ dir == mdn_converter_l2u ? "l2u" : "u2l",
+ from == NULL ? "(null)" : mdn_debug_xstring(from, 20)));
+
+ if (!ctx->opened[dir]) {
+ mdn_result_t st = converter_open(ctx, dir);
+ if (st != mdn_success)
+ return (st);
+ }
+
+ if (from == NULL) {
+ /* for compatibility */
+ INFO(("mdn_converter_convert: "
+ "obsolete feature (reset) invoked\n"));
+ return (mdn_success);
+ }
+
+ r = (*ctx->ops->convert)(ctx, dir, from, to, tolen);
+ if (r == mdn_success && dir == mdn_converter_u2l &&
+ (ctx->flags & MDN_CONVERTER_RTCHECK) != 0) {
+ return (roundtrip_check(ctx, dir, from, to));
+ }
+
+ return (r);
+}
+
+/*
+ * Encoding registration.
+ */
+
+mdn_result_t
+mdn_converter_register(const char *name,
+ mdn_converter_openproc_t open,
+ mdn_converter_closeproc_t close,
+ mdn_converter_convertproc_t convert,
+ int ascii_compatible) {
+ converter_ops_t *ops;
+ mdn_result_t r;
+
+ assert(name != NULL && open != NULL && close != NULL &&
+ convert != NULL);
+
+ TRACE(("mdn_converter_register(name=%s)\n", name));
+
+ if ((ops = malloc(sizeof(*ops))) == NULL) {
+ WARNING(("mdn_converter_register: malloc failed\n"));
+ return (mdn_nomemory);
+ }
+ ops->open = open;
+ ops->close = close;
+ ops->convert = convert;
+ ops->ascii_compatible = ascii_compatible;
+
+ r = mdn_strhash_put(encoding_name_hash, name, ops);
+ if (r != mdn_success)
+ free(ops);
+
+ return (r);
+}
+
+static mdn_result_t
+register_standard_encoding(void) {
+ mdn_result_t r;
+
+ r = mdn_converter_register(MDN_UTF5_ENCODING_NAME,
+ converter_utf5_open,
+ converter_utf5_close,
+ converter_utf5_convert,
+ 1);
+ if (r != mdn_success)
+ return (r);
+
+ r = mdn_converter_register(MDN_RACE_ENCODING_NAME,
+ mdn__race_open,
+ mdn__race_close,
+ mdn__race_convert,
+ 1);
+ if (r != mdn_success)
+ return (r);
+
+ r = mdn_converter_register(MDN_BRACE_ENCODING_NAME,
+ mdn__brace_open,
+ mdn__brace_close,
+ mdn__brace_convert,
+ 1);
+ if (r != mdn_success)
+ return (r);
+
+ r = mdn_converter_register(MDN_LACE_ENCODING_NAME,
+ mdn__lace_open,
+ mdn__lace_close,
+ mdn__lace_convert,
+ 1);
+ if (r != mdn_success)
+ return (r);
+
+#ifdef DEBUG
+ /* This is convenient for debug. Not useful for other purposes. */
+ r = mdn_converter_register("U-escape",
+ converter_uescape_open,
+ converter_uescape_close,
+ converter_uescape_convert,
+ 0);
+ if (r != mdn_success)
+ return (r);
+#endif /* DEBUG */
+
+ return (r);
+}
+
+/*
+ * Encoding alias support.
+ */
+
+mdn_result_t
+mdn_converter_addalias(const char *alias_name, const char *real_name) {
+ char *rn_copy;
+
+ assert(alias_name != NULL && real_name != NULL);
+
+ TRACE(("mdn_converter_addalias(alias_name=%s,real_name=%s)\n",
+ alias_name, real_name));
+
+ if (strcmp(alias_name, real_name) == 0)
+ return (mdn_success);
+
+ if (encoding_alias_hash == NULL)
+ return (mdn_failure);
+
+ if ((rn_copy = malloc(strlen(real_name) + 1)) == NULL) {
+ WARNING(("mdn_converter_addalias: malloc failed\n"));
+ return (mdn_nomemory);
+ }
+ (void)strcpy(rn_copy, real_name);
+ (void)mdn_strhash_put(encoding_alias_hash, alias_name, rn_copy);
+
+ return (mdn_success);
+}
+
+mdn_result_t
+mdn_converter_aliasfile(const char *path) {
+ FILE *fp;
+ int line_no;
+ mdn_result_t st = mdn_success;
+ char line[200], alias[200], real[200];
+
+ assert(path != NULL);
+
+ TRACE(("mdn_converter_aliasfile(path=%s)\n", path));
+
+ if ((fp = fopen(path, "r")) == NULL) {
+ return (mdn_nofile);
+ }
+ for (line_no = 1; fgets(line, sizeof(line), fp) != NULL; line_no++) {
+ unsigned char *p = (unsigned char *)line;
+
+ while (isascii(*p) && isspace(*p))
+ p++;
+ if (*p == '#' || *p == '\n')
+ continue;
+ if (sscanf((char *)p, "%s %s", alias, real) == 2) {
+ st = mdn_converter_addalias(alias, real);
+ if (st != mdn_success)
+ break;
+ } else {
+ WARNING(("mdn_converter_aliasfile: file %s has "
+ "invalid contents at line %d\n",
+ path, line_no));
+ st = mdn_invalid_syntax;
+ break;
+ }
+ }
+ fclose(fp);
+ return st;
+}
+
+mdn_result_t
+mdn_converter_resetalias(void) {
+ mdn_strhash_t hash;
+ mdn_result_t r;
+
+ TRACE(("mdn_converter_resetalias()\n"));
+
+ hash = encoding_alias_hash;
+ encoding_alias_hash = NULL;
+ mdn_strhash_destroy(hash, free_alias_value);
+ hash = NULL;
+ r = mdn_strhash_create(&hash);
+ encoding_alias_hash = hash;
+ return (r);
+}
+
+static const char *
+get_realname(const char *name) {
+ if (encoding_alias_hash != NULL) {
+ char *realname;
+ int recurse = 0;
+
+ while (recurse < MAX_RECURSE) {
+ mdn_result_t r;
+
+ r = mdn_strhash_get(encoding_alias_hash,
+ name, (void **)&realname);
+ if (r != mdn_success)
+ break;
+
+ name = realname;
+ recurse++;
+ }
+ if (recurse >= MAX_RECURSE) {
+ WARNING(("mdn_converter: encoding alias table has "
+ "cyclic reference\n"));
+ }
+ }
+ return (name);
+}
+
+static void
+free_alias_value(void *value) {
+ free(value);
+}
+
+/*
+ * Round trip check.
+ */
+
+static mdn_result_t
+roundtrip_check(mdn_converter_t ctx, mdn_converter_dir_t dir,
+ const char *from, const char *to)
+{
+ /*
+ * One problem with iconv() convertion is that
+ * iconv() doesn't signal an error if the input
+ * string contains characters which are valid but
+ * do not have mapping to the output codeset.
+ * (the behavior of iconv() for that case is defined as
+ * `implementation dependent')
+ * One way to check this case is to perform round-trip
+ * conversion and see if it is same as the original string.
+ */
+ mdn_result_t r;
+ char *back_converted;
+ char buf[256];
+ size_t len;
+
+ TRACE(("mdn_converter_convert: round-trip checking ("
+ " from=\"%s\")\n", mdn_debug_xstring(from, 20)));
+
+ /* Allocate enough buffer. */
+ len = strlen(from) + 1;
+ if (len <= sizeof(buf)) {
+ back_converted = buf;
+ len = sizeof(buf);
+ } else {
+ back_converted = malloc(len);
+ if (back_converted == NULL)
+ return (mdn_nomemory);
+ }
+
+ /*
+ * Perform backward conversion.
+ */
+ if (dir == mdn_converter_l2u)
+ dir = mdn_converter_u2l;
+ else
+ dir = mdn_converter_l2u;
+ r = mdn_converter_convert(ctx, dir, to, back_converted, len);
+
+ switch (r) {
+ case mdn_success:
+ if (strcmp(back_converted, from) != 0)
+ r = mdn_nomapping;
+ break;
+ case mdn_invalid_encoding:
+ case mdn_buffer_overflow:
+ r = mdn_nomapping;
+ break;
+ default:
+ break;
+ }
+
+ if (back_converted != buf)
+ free(back_converted);
+
+ if (r != mdn_success) {
+ TRACE(("round-trip check failed: %s\n",
+ mdn_result_tostring(r)));
+ }
+
+ return (r);
+}
+
+/*
+ * Identity conversion (or, no conversion at all).
+ */
+
+/* ARGSUSED */
+static mdn_result_t
+converter_none_open(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ return (mdn_success);
+}
+
+/* ARGSUSED */
+static mdn_result_t
+converter_none_close(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ return (mdn_success);
+}
+
+static mdn_result_t
+converter_none_convert(mdn_converter_t ctx, mdn_converter_dir_t dir,
+ const char *from, char *to, size_t tolen)
+{
+ size_t fromlen;
+
+ assert(ctx != NULL &&
+ (dir == mdn_converter_l2u || dir == mdn_converter_u2l));
+
+ /*
+ * Just copying is not enough. We should at least check
+ * the validity of 'from'.
+ */
+ if (!mdn_utf8_isvalidstring(from))
+ return (mdn_invalid_encoding);
+
+ fromlen = strlen(from) + 1; /* including NUL */
+ if (fromlen > tolen)
+ return (mdn_buffer_overflow);
+
+ (void)memcpy(to, from, fromlen); /* including NUL */
+ return (mdn_success);
+}
+
+
+/*
+ * Conversion using iconv() interface.
+ */
+
+static mdn_result_t
+converter_iconv_open(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ iconv_t ictx;
+
+ if (dir == mdn_converter_l2u) {
+ ictx = iconv_open(MDN_UTF8_ENCODING_NAME,
+ ctx->local_encoding_name);
+ } else {
+ ictx = iconv_open(ctx->local_encoding_name,
+ MDN_UTF8_ENCODING_NAME);
+ }
+ ctx->ictx[dir] = ictx;
+ if (ictx == (iconv_t)(-1)) {
+ switch (errno) {
+ case ENOMEM:
+ return (mdn_nomemory);
+ case EINVAL:
+ return (mdn_invalid_name);
+ default:
+ WARNING(("iconv_open failed with errno %d\n", errno));
+ return (mdn_failure);
+ }
+ }
+ return (mdn_success);
+}
+
+static mdn_result_t
+converter_iconv_close(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ assert(ctx != NULL &&
+ (dir == mdn_converter_l2u || dir == mdn_converter_u2l));
+
+ if (ctx->opened[dir])
+ (void)iconv_close(ctx->ictx[dir]);
+ return (mdn_success);
+}
+
+static mdn_result_t
+converter_iconv_convert(mdn_converter_t ctx, mdn_converter_dir_t dir,
+ const char *from, char *to, size_t tolen)
+{
+ char *toorg = to;
+ size_t sz;
+ size_t fromsz;
+ size_t tosz;
+ char *p;
+
+ assert(ctx != NULL &&
+ (dir == mdn_converter_l2u || dir == mdn_converter_u2l));
+
+ if (tolen <= 0)
+ return (mdn_buffer_overflow); /* need space for NUL */
+
+ /*
+ * For utf-8 -> local conversion, check the validity of
+ * the input string.
+ */
+ if (dir == mdn_converter_u2l && !mdn_utf8_isvalidstring(from)) {
+ WARNING(("mdn_converter_convert: "
+ "input is not a valid UTF-8 string\n"));
+ return (mdn_invalid_encoding);
+ }
+
+ /*
+ * Reset internal state.
+ */
+#if 0
+ (void)iconv(ctx->ictx[dir], (const char **)NULL, (size_t *)NULL,
+ (char **)NULL, (size_t *)NULL);
+#else
+ /*
+ * Above code should work according to the spec, but causes
+ * segmentation fault with Solaris 2.6.
+ * So.. a work-around.
+ */
+ fromsz = tosz = 0;
+ p = NULL;
+ (void)iconv(ctx->ictx[dir], (const char **)NULL,
+ &fromsz, &p, &tosz);
+#endif
+
+ fromsz = strlen(from);
+ tosz = tolen - 1; /* reserve space for terminating NUL */
+ sz = iconv(ctx->ictx[dir], &from, &fromsz, &to, &tosz);
+
+ if (sz == (size_t)(-1) || fromsz > 0) {
+ switch (errno) {
+ case EILSEQ:
+ case EINVAL:
+ if (dir == mdn_converter_u2l) {
+ /*
+ * We already checked the validity of the
+ * input string. So we assume a mapping
+ * error.
+ */
+ return (mdn_nomapping);
+ } else {
+ /*
+ * We assume all the characters in the local
+ * codeset are included in UCS. This means
+ * mapping error is not possible, so the
+ * input string must have some problem.
+ */
+ return (mdn_invalid_encoding);
+ }
+ case E2BIG:
+ return (mdn_buffer_overflow);
+ default:
+ return (mdn_failure);
+ }
+ }
+ *to = '\0';
+
+ /*
+ * For local -> utf-8 conversion, check the validity of the
+ * output string.
+ */
+ if (dir == mdn_converter_l2u && !mdn_utf8_isvalidstring(toorg)) {
+ WARNING(("mdn_converter_convert: "
+ "output is not a valid UTF-8 string\n"));
+ return (mdn_invalid_encoding);
+ }
+
+ return (mdn_success);
+}
+
+/*
+ * Conversion to/from UTF-5.
+ */
+
+/* ARGSUSED */
+static mdn_result_t
+converter_utf5_open(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ return (mdn_success);
+}
+
+/* ARGSUSED */
+static mdn_result_t
+converter_utf5_close(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ return (mdn_success);
+}
+
+static mdn_result_t
+converter_utf5_convert(mdn_converter_t ctx, mdn_converter_dir_t dir,
+ const char *from, char *to, size_t tolen)
+{
+ size_t fromlen = strlen(from);
+
+ if (dir == mdn_converter_l2u) {
+ unsigned long v;
+ int flen, tlen;
+
+ while (fromlen > 0) {
+ flen = mdn_utf5_getwc(from, fromlen, &v);
+ if (flen == 0) {
+ WARNING(("mdn_converter_convert: "
+ "invalid character\n"));
+ return (mdn_invalid_encoding);
+ }
+ from += flen;
+ fromlen -= flen;
+
+ tlen = mdn_utf8_putwc(to, tolen, v);
+ if (tlen == 0)
+ goto overflow;
+ to += tlen;
+ tolen -= tlen;
+ }
+ } else { /* mdn_converter_u2l */
+ unsigned long v;
+ int flen, tlen;
+
+ while (fromlen > 0) {
+ flen = mdn_utf8_getwc(from, fromlen, &v);
+ if (flen == 0) {
+ WARNING(("mdn_converter_convert: "
+ "invalid character\n"));
+ return (mdn_invalid_encoding);
+ }
+ from += flen;
+ fromlen -= flen;
+
+ tlen = mdn_utf5_putwc(to, tolen, v);
+ if (tlen == 0)
+ goto overflow;
+ to += tlen;
+ tolen -= tlen;
+ }
+ }
+ if (tolen <= 0)
+ goto overflow;
+
+ *to = '\0';
+ return (mdn_success);
+
+overflow:
+ WARNING(("mdn_converter_convert: buffer overflow\n"));
+ return (mdn_buffer_overflow);
+}
+
+#ifdef DEBUG
+/*
+ * Conversion to/from unicode escape string.
+ * Arbitrary UCS-4 character can be specified by a special sequence
+ * \u{XXXXXX}
+ * where XXXXX denotes any hexadecimal string up to FFFFFFFF.
+ * This is designed for debugging.
+ */
+
+static int uescape_getwc(const char *from, size_t fromlen,
+ unsigned long *vp);
+static int uescape_putwc(char *to, size_t tolen, unsigned long v);
+
+/* ARGSUSED */
+static mdn_result_t
+converter_uescape_open(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ return (mdn_success);
+}
+
+/* ARGSUSED */
+static mdn_result_t
+converter_uescape_close(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ return (mdn_success);
+}
+
+static mdn_result_t
+converter_uescape_convert(mdn_converter_t ctx, mdn_converter_dir_t dir,
+ const char *from, char *to, size_t tolen)
+{
+ size_t fromlen = strlen(from);
+
+ if (dir == mdn_converter_l2u) {
+ unsigned long v;
+ int flen, tlen;
+
+ while (fromlen > 0) {
+ flen = uescape_getwc(from, fromlen, &v);
+ if (flen == 0) {
+ WARNING(("mdn_converter_convert: "
+ "invalid character\n"));
+ return (mdn_invalid_encoding);
+ }
+ from += flen;
+ fromlen -= flen;
+
+ tlen = mdn_utf8_putwc(to, tolen, v);
+ if (tlen == 0)
+ goto overflow;
+ to += tlen;
+ tolen -= tlen;
+ }
+ } else { /* mdn_converter_u2l */
+ unsigned long v;
+ int flen, tlen;
+
+ while (fromlen > 0) {
+ flen = mdn_utf8_getwc(from, fromlen, &v);
+ if (flen == 0) {
+ WARNING(("mdn_converter_convert: "
+ "invalid character\n"));
+ return (mdn_invalid_encoding);
+ }
+ from += flen;
+ fromlen -= flen;
+
+ tlen = uescape_putwc(to, tolen, v);
+ if (tlen == 0)
+ goto overflow;
+ to += tlen;
+ tolen -= tlen;
+ }
+ }
+ if (tolen <= 0)
+ goto overflow;
+
+ *to = '\0';
+ return (mdn_success);
+
+overflow:
+ WARNING(("mdn_converter_convert: buffer overflow\n"));
+ return (mdn_buffer_overflow);
+}
+
+static int
+uescape_getwc(const char *from, size_t fromlen, unsigned long *vp) {
+ char *end;
+ if (fromlen >= 4 && strncmp(from, "\\u{", 3) == 0 &&
+ (end = memchr(from, '}', fromlen)) != NULL &&
+ end - from <= 3 + 8) { /* '\u{' + 'xxxxxxxx' */
+ int len = end - from - 3;
+ char tmp[9];
+
+ (void)memcpy(tmp, from + 3, len);
+ tmp[len] = '\0';
+ *vp = strtoul(tmp, NULL, 16);
+ return (end + 1 - from);
+ } else if (fromlen > 0) {
+ *vp = (unsigned char)from[0];
+ return (1);
+ } else {
+ return (0);
+ }
+}
+
+static int
+uescape_putwc(char *to, size_t tolen, unsigned long v) {
+ if (v <= 0x7f) {
+ if (tolen < 1)
+ return (0);
+ *to = v;
+ return (1);
+ } else if (v <= 0xffffffff) {
+ char tmp[20];
+ int len;
+
+ (void)sprintf(tmp, "\\u{%lx}", v);
+ len = strlen(tmp);
+ if (tolen < len)
+ return (0);
+ (void)memcpy(to, tmp, len);
+ return (len);
+ } else {
+ return (0);
+ }
+}
+#endif
diff --git a/contrib/idn/mdnkit/lib/debug.c b/contrib/idn/mdnkit/lib/debug.c
new file mode 100644
index 00000000..742c9d6a
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/debug.c
@@ -0,0 +1,180 @@
+#ifndef lint
+static char *rcsid = "$Id: debug.c,v 1.1 2000/12/07 00:52:24 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+
+#include <mdn/debug.h>
+
+static char *hex = "0123456789abcdef";
+
+char *
+mdn_debug_hexstring(const char *s, int maxbytes) {
+ int i;
+ char *p;
+ static char buf[256 * 3 + 3 + 1]; /* +3 for "..." */
+
+ if (maxbytes > 256)
+ maxbytes = 256;
+
+ for (i = 0, p = buf; i < maxbytes; i++) {
+ int c = ((unsigned char *)s)[i];
+
+ if (c == '\0')
+ break;
+ *p++ = hex[c >> 4];
+ *p++ = hex[c & 15];
+ *p++ = ' ';
+ }
+
+ if (i >= maxbytes)
+ (void)strcpy(p, "...");
+ else
+ *p = '\0';
+
+ return (buf);
+}
+
+char *
+mdn_debug_xstring(const char *s, int maxbytes) {
+ int i;
+ char *p;
+ static char buf[256 * 4 + 3 + 1]; /* +3 for "..." */
+
+ if (maxbytes > 256)
+ maxbytes = 256;
+
+ for (i = 0, p = buf; i < maxbytes; i++) {
+ int c = ((unsigned char *)s)[i];
+
+ if (c == '\0') {
+ break;
+ } else if (c < 0x20 || c > 0x7e) {
+ *p++ = '\\';
+ *p++ = 'x';
+ *p++ = hex[c >> 4];
+ *p++ = hex[c & 15];
+ } else {
+ *p++ = c;
+ }
+ }
+
+ if (i >= maxbytes)
+ (void)strcpy(p, "...");
+ else
+ *p = '\0';
+
+ return (buf);
+}
+
+char *
+mdn_debug_hexdata(const char *s, int length, int maxlength) {
+ int i;
+ const unsigned char *p = (const unsigned char *)s;
+ char *q;
+ static char buf[256 * 3 + 3 + 1]; /* +3 for "..." */
+ char *cont = NULL;
+
+ if (maxlength > 256)
+ maxlength = 256;
+
+ if (length > maxlength) {
+ length = maxlength;
+ cont = "...";
+ }
+
+ for (i = 0, q = buf; i < length; i++) {
+ int c = p[i];
+
+ *q++ = hex[c >> 4];
+ *q++ = hex[c & 15];
+ *q++ = ' ';
+ }
+
+ if (cont != NULL)
+ (void)strcpy(q, "...");
+ else
+ *q = '\0';
+
+ return (buf);
+}
+
+void
+mdn_debug_hexdump(const char *s, int length) {
+ int i;
+ const unsigned char *p = (const unsigned char *)s;
+
+ i = 0;
+ while (length-- > 0) {
+ if (i % 16 == 0) {
+ if (i > 0)
+ fprintf(stderr, "\n");
+ fprintf(stderr, "%4x:", i);
+ }
+ fprintf(stderr, " %02x", p[i]);
+ i++;
+ }
+ fprintf(stderr, "\n");
+}
diff --git a/contrib/idn/mdnkit/lib/dn.c b/contrib/idn/mdnkit/lib/dn.c
new file mode 100644
index 00000000..5fb697fa
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/dn.c
@@ -0,0 +1,341 @@
+#ifndef lint
+static char *rcsid = "$Id: dn.c,v 1.1 2000/12/07 00:52:24 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+/*
+ * Domain name compression/expansion.
+ *
+ * Similar to the functionality of dn_comp/dn_expand in the resolv library.
+ * In fact, the loop detection in mdn__dn_expand is borrowed from
+ * ns_name_unpack.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <mdn/result.h>
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/dn.h>
+
+#define COMPRESS_MASK 0xc0
+#define COMPRESS_FLAG 0xc0
+#define MAX_OFFSET 0x3fff
+
+#define MAXNAMELEN 1024
+#define MAXLABEL 63
+#define MAXCOMPRESS 255
+
+/*
+ * uppercase -> lowercase conversion table, to be initialized
+ * by init_lcase().
+ */
+static char lcase[128];
+
+static mdn_result_t split_name(const char *name, unsigned char *namebuf);
+static int find_label(const unsigned char *p, int limit,
+ mdn__dn_t *ctx);
+static int match(const unsigned char *p, const unsigned char *q,
+ mdn__dn_t *ctx);
+static void append_ptr(mdn__dn_t *ctx, unsigned char *ptr);
+static int get_offset(const unsigned char *p);
+static void init_lcase(void);
+
+
+mdn_result_t
+mdn__dn_expand(const char *msg, size_t msglen, const char *compressed,
+ char *expanded, size_t buflen, size_t *complenp)
+{
+ const unsigned char *p = (const unsigned char *)compressed;
+ const unsigned char *ueom = (const unsigned char *)(msg + msglen);
+ int compress_len = 0;
+ size_t checked = 0;
+
+ assert(msg != NULL && expanded != NULL && complenp != NULL);
+
+ /*
+ * Sanity check.
+ */
+ if (compressed < msg || msg + msglen <= compressed)
+ return (mdn_invalid_message);
+
+ if (*p == 0) {
+ /* Root label */
+ if (buflen < 2)
+ return (mdn_buffer_overflow);
+ (void)strcpy(expanded, ".");
+ *complenp = 1;
+ return (mdn_success);
+ }
+
+ while (p < ueom) {
+ int c = *p++;
+ size_t len;
+
+ len = c & ~COMPRESS_MASK;
+
+ if (c == 0) {
+ if (compress_len == 0)
+ compress_len = (const char *)p - compressed;
+ *complenp = compress_len;
+ return (mdn_success);
+ } else if ((c & COMPRESS_MASK) == 0) {
+ if (p + len > ueom)
+ return (mdn_invalid_message);
+ if (buflen < len + 2)
+ return (mdn_buffer_overflow);
+ (void)memcpy(expanded, p, len);
+ (void)strcpy(expanded + len, "."); /* dot and NUL */
+ p += len;
+ checked += len + 1;
+ expanded += len + 1;
+ buflen -= len + 1;
+ } else if ((c & COMPRESS_MASK) == COMPRESS_FLAG) {
+ if (p >= ueom)
+ return (mdn_invalid_message);
+ len = (len << 8) + *p++;
+ if (compress_len == 0)
+ compress_len = (const char *)p - compressed;
+ p = (const unsigned char *)(msg + len);
+
+ /*
+ * Loop detection.
+ */
+ checked += 2;
+ if (checked >= msglen) {
+ WARNING(("mdn__dn_expand: loop detected\n"));
+ return (mdn_invalid_message);
+ }
+ } else {
+ return (mdn_invalid_message);
+ }
+ }
+ return (mdn_invalid_message);
+}
+
+void
+mdn__dn_initcompress(mdn__dn_t *ctx, const char *msg) {
+ ctx->msg = (const unsigned char *)msg;
+ ctx->cur = 0;
+}
+
+mdn_result_t
+mdn__dn_compress(const char *name, char *sptr, size_t length,
+ mdn__dn_t *ctx, size_t *complenp)
+{
+ unsigned char namebuf[MAXNAMELEN+1];
+ unsigned char *ptr, *p;
+ mdn_result_t r;
+ int offset_limit;
+ static int initialized = 0;
+
+ if (!initialized) {
+ init_lcase();
+ initialized = 1;
+ }
+
+ /*
+ * Split domain name into labels.
+ */
+ if ((r = split_name(name, namebuf)) != mdn_success)
+ return (r);
+
+ p = namebuf;
+ ptr = (unsigned char *)sptr;
+ offset_limit = ctx->cur;
+ while (*p != 0) {
+ int off;
+
+ if ((off = find_label(p, offset_limit, ctx)) >= 0) {
+ if (length < 2)
+ return (mdn_buffer_overflow);
+
+ ptr[0] = COMPRESS_FLAG | (off >> 8);
+ ptr[1] = off & 0xff;
+ ptr += 2;
+ if ((*complenp = (char *)ptr - sptr) > MAXCOMPRESS)
+ return (mdn_invalid_name);
+ return (mdn_success);
+ } else {
+ int l = *p + 1;
+
+ if (length < l)
+ return (mdn_buffer_overflow);
+
+ (void)memcpy(ptr, p, l);
+ append_ptr(ctx, ptr);
+
+ ptr += l;
+ length -= l;
+ }
+ p += *p + 1;
+ }
+ if (length < 1)
+ return (mdn_buffer_overflow);
+ *ptr++ = 0;
+ if ((*complenp = (char *)ptr - sptr) > MAXCOMPRESS)
+ return (mdn_invalid_name);
+ return (mdn_success);
+}
+
+static mdn_result_t
+split_name(const char *name, unsigned char *namebuf) {
+ const unsigned char *p = (const unsigned char *)name;
+ const unsigned char *end = p + MAXNAMELEN;
+ unsigned char *q, *qtop;
+
+ q = namebuf;
+ qtop = q++;
+ while (p < end) {
+ if (*p == '.' || *p == '\0') {
+ int len = q - qtop - 1;
+ if (len > MAXLABEL)
+ return (mdn_invalid_name);
+ *qtop = len;
+ qtop = q++;
+ if (*p == '\0') {
+ *qtop = 0;
+ return (mdn_success);
+ }
+ p++;
+ } else {
+ *q++ = *p++;
+ }
+ }
+ /* Name too long. */
+ return (mdn_invalid_name);
+}
+
+static int
+find_label(const unsigned char *p, int limit, mdn__dn_t *ctx) {
+ int i;
+
+ assert(limit <= ctx->cur);
+
+ if (ctx == NULL)
+ return (-1);
+
+ for (i = 0; i < limit; i++) {
+ if (match(p, ctx->msg + ctx->offset[i], ctx))
+ return (ctx->offset[i]);
+ }
+ return (-1);
+}
+
+static int
+match(const unsigned char *p, const unsigned char *q, mdn__dn_t *ctx) {
+ for (;;) {
+ int len, l;
+
+ /* Dereference 'q'. */
+ while ((*q & COMPRESS_FLAG) != 0) {
+ int offset = get_offset(q);
+
+ if (offset < 0 || offset > MAX_OFFSET)
+ return (0);
+ q = ctx->msg + offset;
+ }
+
+ /* Check length. */
+ len = *p++;
+ if (*q++ != len)
+ return (0);
+
+ if (len == 0)
+ return (1);
+
+ /* Compare labels. */
+ for (l = 0; l < len; l++, p++, q++) {
+ if (*p == *q)
+ continue;
+ else if (*p < 128 && *q < 128 &&
+ lcase[*p] == lcase[*q])
+ continue;
+ else
+ return (0);
+ }
+ }
+}
+
+static void
+append_ptr(mdn__dn_t *ctx, unsigned char *ptr) {
+ if (ctx != NULL && ctx->cur < MDN_DN_NPTRS &&
+ ptr >= ctx->msg && (ptr - ctx->msg) <= MAX_OFFSET)
+ ctx->offset[ctx->cur++] = ptr - ctx->msg;
+}
+
+static int
+get_offset(const unsigned char *p) {
+ return (((p[0] & ~COMPRESS_MASK) << 8) | p[1]);
+}
+
+static void
+init_lcase(void) {
+ int i;
+
+ for (i = 0; i < 128; i++)
+ lcase[i] = i;
+ for (i = 'A'; i <= 'Z'; i++)
+ lcase[i] += 'a' - 'A';
+}
diff --git a/contrib/idn/mdnkit/lib/lace.c b/contrib/idn/mdnkit/lib/lace.c
new file mode 100644
index 00000000..471ae621
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/lace.c
@@ -0,0 +1,570 @@
+#ifndef lint
+static char *rcsid = "$Id: lace.c,v 1.1 2000/12/07 00:52:24 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <mdn/result.h>
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/converter.h>
+#include <mdn/utf8.h>
+#include <mdn/debug.h>
+#include <mdn/lace.h>
+#include <mdn/util.h>
+
+#ifdef DEBUG
+/* Be paranoid. */
+#define PARANOID
+#endif
+
+#ifndef MDN_LACE_PREFIX
+#define MDN_LACE_PREFIX "bq--"
+#endif
+#define LACE_PREFIX_LEN (strlen(MDN_LACE_PREFIX))
+
+#define LACE_BUF_SIZE 128 /* more than enough */
+
+static mdn_result_t lace_l2u(const char *from, const char *end,
+ char *to, size_t tolen, size_t *clenp);
+static mdn_result_t lace_u2l(const char *from, const char *end,
+ char *to, size_t tolen, size_t *clenp);
+static mdn_result_t lace_decode(const char *from, size_t fromlen,
+ char *to, size_t tolen);
+static mdn_result_t lace_decode_utf16(const char *from, size_t fromlen,
+ unsigned short *buf, size_t *lenp);
+static mdn_result_t lace_encode(const char *from, size_t fromlen,
+ char *to, size_t tolen);
+static mdn_result_t lace_encode_utf16(const unsigned short *p,
+ size_t len, char *to, size_t tolen,
+ int compress);
+static int is_compress_effective(unsigned short *p, size_t len);
+
+/* ARGSUSED */
+mdn_result_t
+mdn__lace_open(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ return (mdn_success);
+}
+
+/* ARGSUSED */
+mdn_result_t
+mdn__lace_close(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ return (mdn_success);
+}
+
+mdn_result_t
+mdn__lace_convert(mdn_converter_t ctx, mdn_converter_dir_t dir,
+ const char *from, char *toorg, size_t tolen)
+{
+ char *to = toorg;
+
+ assert(ctx != NULL &&
+ (dir == mdn_converter_l2u || dir == mdn_converter_u2l));
+
+ TRACE(("mdn__lace_convert(dir=%s,from=\"%s\")\n",
+ dir == mdn_converter_l2u ? "l2u" : "u2l",
+ mdn_debug_xstring(from, 20)));
+
+ for (;;) {
+ const char *end;
+ size_t convlen;
+ mdn_result_t r;
+
+ /*
+ * Find the end of this component (label).
+ */
+ if ((end = strchr(from, '.')) == NULL)
+ end = from + strlen(from);
+
+ /*
+ * Convert it.
+ */
+ if (dir == mdn_converter_l2u)
+ r = lace_l2u(from, end, to, tolen, &convlen);
+ else
+ r = lace_u2l(from, end, to, tolen, &convlen);
+ if (r != mdn_success)
+ return (r);
+
+ /*
+ * Copy '.' or NUL.
+ */
+ if (tolen <= convlen)
+ return (mdn_buffer_overflow);
+
+ to += convlen;
+ *to++ = *end;
+ tolen -= convlen + 1;
+
+ if (*end == '\0')
+ break;
+
+ from = end + 1;
+ }
+
+ DUMP(("mdn__lace_convert: \"%s\"\n", mdn_debug_xstring(toorg, 70)));
+
+ return (mdn_success);
+}
+
+static mdn_result_t
+lace_l2u(const char *from, const char *end,
+ char *to, size_t tolen, size_t *clenp)
+{
+ size_t len = end - from;
+ size_t prefix_len = LACE_PREFIX_LEN;
+
+ if (len >= prefix_len &&
+ mdn_util_casematch(from, MDN_LACE_PREFIX, prefix_len)) {
+ /*
+ * LACE encoding prefix found.
+ */
+ mdn_result_t r;
+
+ r = lace_decode(from + prefix_len,
+ len - prefix_len, to, tolen);
+ if (r == mdn_invalid_encoding)
+ goto copy;
+ else if (r != mdn_success)
+ return (r);
+
+ len = strlen(to);
+ } else {
+ /*
+ * Not LACE encoded. Copy verbatim.
+ */
+ copy:
+ if (mdn_util_domainspan(from, end) < end) {
+ /* invalid character found */
+ return (mdn_invalid_encoding);
+ }
+
+ if (tolen < len)
+ return (mdn_buffer_overflow);
+
+ (void)memcpy(to, from, len);
+ }
+ *clenp = len;
+ return (mdn_success);
+}
+
+static mdn_result_t
+lace_u2l(const char *from, const char *end,
+ char *to, size_t tolen, size_t *clenp) {
+ size_t len = end - from;
+ size_t prefix_len = LACE_PREFIX_LEN;
+
+ /*
+ * See if encoding is necessary.
+ */
+ if (mdn_util_domainspan(from, end) < end) {
+ /*
+ * Conversion is necessary.
+ */
+ mdn_result_t r;
+
+ /* Set prefix. */
+ if (tolen < prefix_len)
+ return (mdn_buffer_overflow);
+ (void)memcpy(to, MDN_LACE_PREFIX, prefix_len);
+ to += prefix_len;
+ tolen -= prefix_len;
+
+ r = lace_encode(from, len, to, tolen);
+ if (r != mdn_success)
+ return (r);
+
+ len = prefix_len + strlen(to);
+ } else {
+ /*
+ * Conversion is NOT necessary.
+ * Copy verbatim.
+ */
+ if (tolen < len)
+ return (mdn_buffer_overflow);
+
+ (void)memcpy(to, from, len);
+ }
+ *clenp = len;
+ return (mdn_success);
+}
+
+static mdn_result_t
+lace_decode(const char *from, size_t fromlen, char *to, size_t tolen) {
+ unsigned short *buf;
+ unsigned short local_buf[LACE_BUF_SIZE];
+ size_t len, reslen;
+ mdn_result_t r;
+
+ /*
+ * Allocate sufficient buffer.
+ */
+ if (fromlen > LACE_BUF_SIZE) {
+ if ((buf = malloc(sizeof(*buf) * fromlen)) == NULL)
+ return (mdn_nomemory);
+ } else {
+ /* Use local buffer. */
+ buf = local_buf;
+ }
+
+ /*
+ * Decode base32 and decompress.
+ */
+ r = lace_decode_utf16(from, fromlen, buf, &len);
+ if (r != mdn_success)
+ goto ret;
+
+ /*
+ * Now 'buf' holds the decompressed string, which must contain
+ * UTF-16 characters. Convert them into UTF-8.
+ */
+ r = mdn_util_utf16toutf8(buf, len, to, tolen, &reslen);
+ if (r != mdn_success)
+ goto ret;
+
+ /*
+ * Terminate with NUL.
+ */
+ if (tolen <= reslen) {
+ r = mdn_buffer_overflow;
+ goto ret;
+ }
+
+ to += reslen;
+ *to = '\0';
+ tolen -= reslen;
+
+ r = mdn_success;
+
+ret:
+ if (buf != local_buf)
+ free(buf);
+ return (r);
+}
+
+static mdn_result_t
+lace_decode_utf16(const char *from, size_t fromlen,
+ unsigned short *buf, size_t *lenp)
+{
+ unsigned short *p, *q;
+ unsigned int bitbuf = 0;
+ int bitlen = 0;
+ size_t len;
+
+ /*
+ * Decode Base32 and put the result bytes to 'buf'.
+ * Since decoded string will be shorter in length, and
+ * the caller allocated 'buf' so that its length is not
+ * less than 'fromlen', we don't have to worry about overflow.
+ */
+ p = buf;
+ while (fromlen-- > 0) {
+ int c = *from++;
+ int x;
+
+ if ('a' <= c && c <= 'z')
+ x = c - 'a';
+ else if ('A' <= c && c <= 'Z')
+ x = c - 'A';
+ else if ('2' <= c && c <= '7')
+ x = c - '2' + 26;
+ else
+ return (mdn_invalid_encoding);
+
+ bitbuf = (bitbuf << 5) + x;
+ bitlen += 5;
+ if (bitlen >= 8) {
+ *p++ = (bitbuf >> (bitlen - 8)) & 0xff;
+ bitlen -= 8;
+ }
+ }
+#ifdef PARANOID
+ /* Check if the padding bits are all zero. */
+ if (bitlen > 0 && (bitbuf & ((1 << bitlen) - 1)) != 0) {
+ WARNING(("mdn__lace_convert: non-zero padding\n"));
+ return (mdn_invalid_encoding);
+ }
+#endif
+ len = p - buf;
+
+ if (len == 0)
+ return (mdn_invalid_encoding);
+
+ /*
+ * Now 'buf' holds the decoded bytes. Rebuild the
+ * original UTF-16 string.
+ */
+ if (buf[0] == 0xff) {
+ /*
+ * Not compressed.
+ */
+ len--; /* skip first byte (0xff) */
+ if (len % 2 != 0) {
+ /* number of bytes must be even. */
+ return (mdn_invalid_encoding);
+ }
+ for (p = buf + 1, q = buf; len > 0; p += 2, q++, len -= 2) {
+ *q = (p[0] << 8) | p[1];
+ }
+#ifdef PARANOID
+ if (is_compress_effective(buf, q - buf)) {
+ /*
+ * This string must have been compressed.
+ */
+ WARNING(("mdn__lace_convert: decoded string is not "
+ "compressed, though it should be.\n"));
+ return (mdn_invalid_encoding);
+ }
+#endif
+ } else {
+ /*
+ * Compressed.
+ */
+ int count = 0;
+ unsigned short high = 0; /* initialize for lint */
+
+ for (p = q = buf; len > 0; p++, q++, len--) {
+ if (count == 0) {
+ if (len < 3 || p[0] == 0)
+ return (mdn_invalid_encoding);
+ /* Get COUNT and HIGH. */
+ count = p[0];
+ high = p[1] << 8;
+ p += 2;
+ len -= 2;
+ }
+ *q = high | *p;
+ count--;
+ }
+ if (count != 0)
+ return (mdn_invalid_encoding);
+#ifdef PARANOID
+ if (!is_compress_effective(buf, q - buf)) {
+ /*
+ * This string must not have been compressed.
+ */
+ WARNING(("mdn__lace_convert: decoded string is "
+ "compressed, though it shouldn't.\n"));
+ return (mdn_invalid_encoding);
+ }
+#endif
+ }
+
+ *lenp = q - buf;
+ return (mdn_success);
+}
+
+static mdn_result_t
+lace_encode(const char *from, size_t fromlen, char *to, size_t tolen) {
+ unsigned short *buf;
+ unsigned short local_buf[LACE_BUF_SIZE]; /* UTF-16 */
+ mdn_result_t r;
+ size_t buflen, len;
+
+ /*
+ * Convert to UTF-16.
+ */
+ buf = local_buf;
+ buflen = LACE_BUF_SIZE;
+ for (;;) {
+ r = mdn_util_utf8toutf16(from, fromlen,
+ buf, buflen, &len);
+ if (r == mdn_buffer_overflow) {
+ buflen *= 2;
+ if (buf == local_buf)
+ buf = malloc(sizeof(*buf) * buflen);
+ else
+ buf = realloc(buf, sizeof(*buf) * buflen);
+ if (buf == NULL)
+ return (mdn_nomemory);
+ } else if (r == mdn_success) {
+ break;
+ } else {
+ goto ret;
+ }
+ }
+
+ /*
+ * Compress, encode in base-32 and output.
+ */
+ r = lace_encode_utf16(buf, len, to, tolen,
+ is_compress_effective(buf, len));
+
+ret:
+ if (buf != local_buf)
+ free(buf);
+ return (r);
+}
+
+static mdn_result_t
+lace_encode_utf16(const unsigned short *p, size_t len,
+ char *to, size_t tolen, int compress)
+{
+ unsigned long bitbuf = 0; /* bit stream buffer */
+ int bitlen = 0; /* # of bits in 'bitbuf' */
+ int compress_count = 0;
+ int i, j;
+
+ if (!compress) {
+ /* prepend non-compression mark */
+ bitbuf = 0xff;
+ bitlen = 8;
+ }
+
+ for (i = 0; i <= len; i++) {
+ if (i == len) {
+ /*
+ * End of data. Flush. The current draft (-00)
+ * doesn't seem to define which value to use for
+ * padding (which it should). We assume zero.
+ */
+ if (bitlen % 5 == 0)
+ break;
+ bitbuf <<= 5 - (bitlen % 5); /* padding with zero */
+ bitlen += 5 - (bitlen % 5);
+ } else if (compress) {
+ if (compress_count == 0) {
+ /*
+ * Get the number of consecutive characters
+ * with the same high byte.
+ */
+ unsigned short high = p[i] & 0xff00;
+
+ compress_count = 1;
+ for (j = i + 1; j < len; j++) {
+ if ((p[j] & 0xff00) != high)
+ break;
+ compress_count++;
+ }
+ bitbuf = (bitbuf << 16) |
+ (compress_count << 8) |
+ (high >> 8);
+ bitlen += 16;
+ }
+ bitbuf = (bitbuf << 8) | (p[i] & 0xff);
+ bitlen += 8;
+ compress_count--;
+ } else {
+ bitbuf = (bitbuf << 16) | p[i];
+ bitlen += 16;
+ }
+
+ /*
+ * Output bits in 'bitbuf' in 5-bit unit.
+ */
+ while (bitlen >= 5) {
+ int x;
+
+ /* Get top 5 bits. */
+ x = (bitbuf >> (bitlen - 5)) & 0x1f;
+ bitlen -= 5;
+
+ /* Encode. */
+ if (x < 26)
+ x += 'a';
+ else
+ x = (x - 26) + '2';
+
+ if (tolen < 1)
+ return (mdn_buffer_overflow);
+
+ *to++ = x;
+ tolen--;
+ }
+ }
+
+ if (tolen <= 0)
+ return (mdn_buffer_overflow);
+
+ *to = '\0';
+ return (mdn_success);
+}
+
+static int
+is_compress_effective(unsigned short *p, size_t len) {
+ unsigned short last_high = 0x1; /* initialize with an invalid value */
+ int nhigh = 0;
+ int i;
+
+ /*
+ * Find the number of HIGH value in the compressed string.
+ */
+ for (i = 0; i < len; i++) {
+ unsigned short high = p[i] & 0xff00;
+ if (high != last_high)
+ nhigh++;
+ last_high = high;
+ }
+
+ /*
+ * Compressed string would take 2 * 'nhigh' + 'len' bytes,
+ * while the original (uncomressed) string would take 2 * 'len'.
+ * So the difference is 2 * 'nhigh' - len.
+ */
+ if (2 * nhigh <= len)
+ return (1); /* Compression is effective. */
+ else
+ return (0); /* Nope. */
+}
diff --git a/contrib/idn/mdnkit/lib/localencoding.c b/contrib/idn/mdnkit/lib/localencoding.c
new file mode 100644
index 00000000..9d4d492f
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/localencoding.c
@@ -0,0 +1,195 @@
+#ifndef lint
+static char *rcsid = "$Id: localencoding.c,v 1.1 2000/12/07 00:52:24 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+#ifdef HAVE_LANGINFO_H
+#include <langinfo.h>
+#endif
+
+#include <mdn/logmacro.h>
+#include <mdn/localencoding.h>
+#include <mdn/debug.h>
+
+#if defined(HAVE_NL_LANGINFO) && defined(CODESET)
+
+/*
+ * This is the correct method to get the codeset name
+ * corresponding to the current locale.
+ */
+const char *
+mdn_localencoding_name(void) {
+ char *name;
+
+ TRACE(("mdn_localencoding_name()\n"));
+ if ((name = getenv(MDN_LOCALCS_ENV)) == NULL)
+ name = nl_langinfo(CODESET);
+ TRACE(("local encoding=\"%-.30s\"\n", name == NULL ? "<null>" : name));
+ return (name);
+}
+
+#else
+
+typedef struct locale2encoding {
+ char *locale_pattern; /* locale name pattern */
+ char *encoding; /* MIME-preferred charset name */
+} locale2encoding_t;
+
+static locale2encoding_t l2e[] = {
+ { "*.ISO_8859-1", "ISO-8859-1" },
+ { "*.ISO_8859-2", "ISO-8859-2" },
+ { "*.SJIS", "Shift_JIS" },
+ { "*.Shift_JIS", "Shift_JIS" },
+ { "ja_JP.EUC", "EUC-JP" },
+ { "ko_KR.EUC", "EUC-KR" },
+ { "*.big5" "Big5" },
+ { "*.Big5" "Big5" },
+ { "*.KOI8-R", "KOI8-R" },
+ { "*.GB2312", "GB2312" },
+#ifdef hpux
+ { "japanese", "Shift_JIS" },
+#else
+ { "japanese", "EUC-JP" },
+#endif
+ { "ja", "EUC-JP" },
+ { NULL, NULL },
+};
+
+static const char *locale_to_encoding(const char *name);
+static int match(const char *pattern, const char *str);
+
+const char *
+mdn_localencoding_name(void) {
+ char *name;
+
+ TRACE(("mdn_localencoding_name()\n"));
+
+ if ((name = getenv(MDN_LOCALCS_ENV)) != NULL) {
+ TRACE(("local encoding=\"%-.30s\"\n",
+ name == NULL ? "<null>" : name));
+ return (name);
+ }
+ (void)(
+#if HAVE_SETLOCALE
+ (name = setlocale(LC_CTYPE, NULL)) ||
+#endif
+ (name = getenv("LC_ALL")) ||
+ (name = getenv("LC_CTYPE")) ||
+ (name = getenv("LANG")));
+ name = (char *)locale_to_encoding(name);
+ TRACE(("local encoding=\"%-.30s\"\n", name == NULL ? "<null>" : name));
+ return (name);
+}
+
+/*
+ * Locale name to encoding name.
+ */
+static const char *
+locale_to_encoding(const char *name) {
+ int i;
+
+ if (name == NULL)
+ return (NULL);
+
+ for (i = 0; l2e[i].locale_pattern != NULL; i++) {
+ if (match(l2e[i].locale_pattern, name))
+ return (l2e[i].encoding);
+ }
+ return name;
+}
+
+/*
+ * Wild card matching function that supports only '*'.
+ */
+static int
+match(const char *pattern, const char *str) {
+ for (;;) {
+ int c;
+
+ switch (c = *pattern++) {
+ case '\0':
+ return (*str == '\0');
+ case '*':
+ while (!match(pattern, str)) {
+ if (*str == '\0')
+ return (0);
+ str++;
+ }
+ return (1);
+ break;
+ default:
+ if (*str++ != c)
+ return (0);
+ break;
+ }
+ }
+}
+
+#endif
diff --git a/contrib/idn/mdnkit/lib/log.c b/contrib/idn/mdnkit/lib/log.c
new file mode 100644
index 00000000..d41bad96
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/log.c
@@ -0,0 +1,230 @@
+#ifndef lint
+static char *rcsid = "$Id: log.c,v 1.1 2000/12/07 00:52:24 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <mdn/log.h>
+
+#define LOGLEVEL_ENV "MDN_LOG_LEVEL"
+
+#ifdef DEBUG
+#define DEFAULT_LOG_LEVEL mdn_log_level_info
+#else
+#define DEFAULT_LOG_LEVEL mdn_log_level_error
+#endif
+
+static int log_level = -1;
+static mdn_log_proc_t log_proc;
+
+static void initialize(void);
+static void log(int level, const char *fmt, va_list args);
+static void log_to_stderr(int level, const char *buf);
+
+void
+mdn_log_fatal(const char *fmt, ...) {
+ va_list args;
+
+ va_start(args, fmt);
+ log(mdn_log_level_fatal, fmt, args);
+ va_end(args);
+ exit(1);
+}
+
+void
+mdn_log_error(const char *fmt, ...) {
+ va_list args;
+
+ va_start(args, fmt);
+ log(mdn_log_level_error, fmt, args);
+ va_end(args);
+}
+
+void
+mdn_log_warning(const char *fmt, ...) {
+ va_list args;
+
+ va_start(args, fmt);
+ log(mdn_log_level_warning, fmt, args);
+ va_end(args);
+}
+
+void
+mdn_log_info(const char *fmt, ...) {
+ va_list args;
+
+ va_start(args, fmt);
+ log(mdn_log_level_info, fmt, args);
+ va_end(args);
+}
+
+void
+mdn_log_trace(const char *fmt, ...) {
+ va_list args;
+
+ va_start(args, fmt);
+ log(mdn_log_level_trace, fmt, args);
+ va_end(args);
+}
+
+void
+mdn_log_dump(const char *fmt, ...) {
+ va_list args;
+
+ va_start(args, fmt);
+ log(mdn_log_level_dump, fmt, args);
+ va_end(args);
+}
+
+void
+mdn_log_setlevel(int level) {
+ if (level >= 0)
+ log_level = level;
+}
+
+int
+mdn_log_getlevel(void) {
+ initialize();
+ return log_level;
+}
+
+void
+mdn_log_setproc(mdn_log_proc_t proc) {
+ if (proc == NULL)
+ log_proc = log_to_stderr;
+ else
+ log_proc = proc;
+}
+
+static void
+initialize(void) {
+ char *s;
+
+ if (log_level < 0) {
+ if ((s = getenv(LOGLEVEL_ENV)) != NULL) {
+ int level = atoi(s);
+ if (level >= 0)
+ log_level = level;
+ }
+ if (log_level < 0)
+ log_level = DEFAULT_LOG_LEVEL;
+ }
+
+ if (log_proc == NULL)
+ log_proc = log_to_stderr;
+}
+
+static void
+log(int level, const char *fmt, va_list args) {
+ char buf[1024];
+
+ initialize();
+
+ if (log_level < level)
+ return;
+
+#if HAVE_VSNPRINTF
+ (void)vsnprintf(buf, sizeof(buf), fmt, args);
+#else
+ /* Let's hope 1024 is enough.. */
+ (void)vsprintf(buf, fmt, args);
+#endif
+ (*log_proc)(level, buf);
+}
+
+static void
+log_to_stderr(int level, const char *buf) {
+ char *title;
+ char tmp[20];
+
+ switch (level) {
+ case mdn_log_level_fatal:
+ title = "FATAL";
+ break;
+ case mdn_log_level_error:
+ title = "ERROR";
+ break;
+ case mdn_log_level_warning:
+ title = "WARNING";
+ break;
+ case mdn_log_level_info:
+ title = "INFO";
+ break;
+ case mdn_log_level_trace:
+ title = "TRACE";
+ break;
+ case mdn_log_level_dump:
+ title = "DUMP";
+ break;
+ default:
+ (void)sprintf(tmp, "LEVEL%d", level);
+ title = tmp;
+ break;
+ }
+ fprintf(stderr, "%u: [%s] %s", (unsigned int)getpid(), title, buf);
+}
diff --git a/contrib/idn/mdnkit/lib/mdnres.conf.sample b/contrib/idn/mdnkit/lib/mdnres.conf.sample
new file mode 100644
index 00000000..6781c948
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/mdnres.conf.sample
@@ -0,0 +1,53 @@
+# $Id: mdnres.conf.sample,v 1.1 2000/12/07 00:52:24 tale Exp $
+#
+# A sample file for mDNkit's resolver configuration file (mdnres.conf)
+#
+
+#
+# The following line specifies the encoding which DNS protocol uses,
+# such as RACE or UTF-8.
+# Note that the application's local encoding is determined from its
+# locale, so there is no 'client-encoding' line.
+#
+server-encoding RACE
+
+#
+# If the server-encoding needs ZLD (zero level domain). Use the following
+# line to spcify. Note that you must enable ZLD feature (by giving
+# "--enable-zld" option to the configure script) to use it.
+#
+# server-zld zld.to.be.used
+
+#
+# The following line specifies the normalization scheme(s) to be used.
+# If two or more shemes are specified, they are applied in order
+# (from left to right). The available shmemes are:
+# ascii-lowercase -- ASCII uppercase letters to lowercase
+# ascii-uppercase -- ASCII lowercase letters to uppercase
+# unicode-lowercase -- Unicode uppercase letters to lowercase
+# unicode-uppercase -- Unicode lowercase letters to uppercase
+# unicode-form-c -- Unicode normalization form C
+# unicode-form-kc -- Unicode normalization form KC
+# ja-kana-fullwidth -- Japanese halfwidth kana letters to fullwidth
+# ja-alnum-halfwidth -- Fullwidth alphabets, digits and minus sign
+# to halfwidth
+# ja-compose-voiced-sound -- Combine Japanese fullwidth kana and the
+# following (semi) voiced sound mark
+# ja-minus-hack -- Japanse fullwidth minus sign to '-'
+#
+normalize unicode-lowercase unicode-form-kc
+
+#
+# The following line specifies the alternative encoding to use in case
+# the conversion from DNS protocol encoding to the application's local
+# encoding fails due to the lack of certain character in the character
+# set of the local encoding.
+# The alternative encoding must be an ASCII-compatible encoding (ACE).
+#
+alternate-encoding RACE
+
+#
+# You can add alias names to the encoding (codeset) names. The following
+# line specifies the pathname of the alias definition file.
+#
+# alias-file /some/where/mdnalias.txt
diff --git a/contrib/idn/mdnkit/lib/msgheader.c b/contrib/idn/mdnkit/lib/msgheader.c
new file mode 100644
index 00000000..b7dda15e
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/msgheader.c
@@ -0,0 +1,147 @@
+#ifndef lint
+static char *rcsid = "$Id: msgheader.c,v 1.1 2000/12/07 00:52:25 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdarg.h>
+
+#include <mdn/result.h>
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/debug.h>
+#include <mdn/msgheader.h>
+
+#define DNS_HEADER_SIZE 12
+
+mdn_result_t
+mdn_msgheader_parse(const char *msg, size_t msglen, mdn_msgheader_t *parsed) {
+ const unsigned char *p = (const unsigned char *)msg;
+ unsigned int v;
+
+ assert(msg != NULL && parsed != NULL);
+
+ TRACE(("mdn_msgheader_parse(msg=<%s>, msglen=%d)\n",
+ mdn_debug_hexdata(msg, msglen, 12), msglen));
+
+ if (msglen < DNS_HEADER_SIZE)
+ return (mdn_invalid_message);
+
+#define GET16(off) ((p[off]<<8)+p[(off)+1])
+ parsed->id = GET16(0);
+ v = GET16(2);
+ parsed->qr = (v & 0x8000) != 0;
+ parsed->opcode = (v >> 11) & 0xf;
+ parsed->flags = (v >> 4) & 0x7f;
+ parsed->rcode = v & 0xf;
+ parsed->qdcount = GET16(4);
+ parsed->ancount = GET16(6);
+ parsed->nscount = GET16(8);
+ parsed->arcount = GET16(10);
+#undef GET16
+
+ return (mdn_success);
+}
+
+mdn_result_t
+mdn_msgheader_unparse(mdn_msgheader_t *parsed, char *msg, size_t msglen) {
+ unsigned char *p = (unsigned char *)msg;
+ unsigned int v;
+
+ assert(parsed != NULL && msg != NULL);
+
+ TRACE(("mdn_msgheader_unparse()\n"));
+
+ if (msglen < DNS_HEADER_SIZE)
+ return (mdn_buffer_overflow);
+
+ v = ((parsed->qr & 1) << 15) +
+ ((parsed->opcode & 0xf) << 11) +
+ ((parsed->flags & 0x7f) << 4) +
+ (parsed->rcode & 0xf);
+
+#define PUT16(off, v) p[off] = ((v)>>8) & 0xff; p[(off)+1] = (v) & 0xff
+ PUT16(0, parsed->id);
+ PUT16(2, v);
+ PUT16(4, parsed->qdcount);
+ PUT16(6, parsed->ancount);
+ PUT16(8, parsed->nscount);
+ PUT16(10, parsed->arcount);
+#undef PUT16
+
+ return (mdn_success);
+}
+
+unsigned int
+mdn_msgheader_getid(const char *msg) {
+ const unsigned char *p = (const unsigned char *)msg;
+
+ return ((p[0] << 8) + p[1]);
+}
+
+void
+mdn_msgheader_setid(char *msg, unsigned int id) {
+ unsigned char *p = (unsigned char *)msg;
+
+ p[0] = (id >> 8) & 0xff;
+ p[1] = id & 0xff;
+}
diff --git a/contrib/idn/mdnkit/lib/msgtrans.c b/contrib/idn/mdnkit/lib/msgtrans.c
new file mode 100644
index 00000000..0b10a71d
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/msgtrans.c
@@ -0,0 +1,633 @@
+#ifndef lint
+static char *rcsid = "$Id: msgtrans.c,v 1.1 2000/12/07 00:52:25 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef WIN32
+#include <windows.h>
+#include <winsock.h>
+#else /* for normal systems */
+#include <errno.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+#endif
+
+#include <mdn/result.h>
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/converter.h>
+#include <mdn/normalizer.h>
+#include <mdn/translator.h>
+#include <mdn/zldrule.h>
+#include <mdn/msgheader.h>
+#include <mdn/msgtrans.h>
+#include <mdn/dn.h>
+#include <mdn/debug.h>
+
+#define DNS_HEADER_SIZE 12
+#define DNAME_SIZE 512
+#define RRFORMAT_HASH_SIZE 47
+
+/*
+ * DNS opcodes.
+ */
+enum {
+ opcode_query = 0,
+ opcode_iquery = 1,
+ opcode_status = 2,
+ opcode_notify = 4,
+ opcode_update = 5
+};
+
+/*
+ * Resource record types.
+ */
+enum {
+ rrtype_A = 1,
+ rrtype_NS = 2,
+ rrtype_MD = 3,
+ rrtype_MF = 4,
+ rrtype_CNAME = 5,
+ rrtype_SOA = 6,
+ rrtype_MB = 7,
+ rrtype_MG = 8,
+ rrtype_MR = 9,
+ rrtype_NULL = 10,
+ rrtype_WKS = 11,
+ rrtype_PTR = 12,
+ rrtype_HINFO = 13,
+ rrtype_MINFO = 14,
+ rrtype_MX = 15,
+ rrtype_TXT = 16,
+ rrtype_RP = 17,
+ rrtype_AFSDB = 18,
+ rrtype_X25 = 19,
+ rrtype_ISDN = 20,
+ rrtype_RT = 21,
+ rrtype_AAAA = 28
+};
+
+/*
+ * Resource record classes.
+ */
+enum {
+ rrclass_IN = 1,
+ rrclass_CS = 2,
+ rrclass_CH = 3,
+ rrclass_ANY = 255
+};
+
+typedef struct msgtrans_ctx {
+ const char *in; /* input message */
+ size_t in_len; /* length of it */
+ const char *in_ptr; /* current pointer */
+ size_t in_remain; /* # of remaining octets */
+ char *out; /* output (translated) message */
+ char *out_ptr; /* current pointer */
+ size_t out_remain; /* # of remaining (available) octets */
+ mdn__dn_t dn_ctx; /* for compression */
+ int determined; /* if ZLD/codeset are determined */
+ mdn_msgtrans_param_t *param; /* translation parameters */
+} msgtrans_ctx_t;
+
+static struct rrformat {
+ unsigned int type; /* RR type */
+ unsigned int class; /* RR class */
+ const char *format; /* RDATA format */
+ struct rrformat *next; /* hash chain */
+} rrformats[] = {
+ { rrtype_CNAME, rrclass_ANY, "D" },
+ { rrtype_HINFO, rrclass_ANY, "TT" },
+ { rrtype_MB, rrclass_ANY, "D" },
+ { rrtype_MD, rrclass_ANY, "D" },
+ { rrtype_MF, rrclass_ANY, "D" },
+ { rrtype_MG, rrclass_ANY, "D" },
+ { rrtype_MINFO, rrclass_ANY, "DD" },
+ { rrtype_MR, rrclass_ANY, "D" },
+ { rrtype_MX, rrclass_ANY, "SD" },
+ { rrtype_NULL, rrclass_ANY, "R" },
+ { rrtype_NS, rrclass_ANY, "D" },
+ { rrtype_PTR, rrclass_ANY, "D" },
+ { rrtype_SOA, rrclass_ANY, "DDLLLLL" },
+ { rrtype_TXT, rrclass_ANY, "T" },
+ { rrtype_A, rrclass_IN, "L" },
+ { rrtype_WKS, rrclass_IN, "LCR" },
+ { rrtype_RP, rrclass_ANY, "DD" },
+ { rrtype_AFSDB, rrclass_ANY, "SD" },
+ { rrtype_X25, rrclass_ANY, "T" },
+ { rrtype_ISDN, rrclass_ANY, "TT" },
+ { rrtype_RT, rrclass_ANY, "SD" },
+ { rrtype_AAAA, rrclass_IN, "H" },
+ { 0, 0, NULL },
+};
+static struct rrformat *rrformathash[RRFORMAT_HASH_SIZE];
+
+static mdn_result_t copy_header(msgtrans_ctx_t *ctx);
+static mdn_result_t translate_question(msgtrans_ctx_t *ctx);
+static mdn_result_t translate_rr(msgtrans_ctx_t *ctx);
+static mdn_result_t translate_rdata(msgtrans_ctx_t *ctx,
+ unsigned int rr_type,
+ unsigned int rr_class,
+ unsigned int rr_length);
+static const char *rdata_format(unsigned int rr_type, unsigned int rr_class);
+static mdn_result_t translate_domain(msgtrans_ctx_t *ctx);
+static mdn_result_t translate_name(mdn_msgtrans_param_t *param,
+ char *from, char *to, size_t tolen);
+static mdn_result_t get_domainname(msgtrans_ctx_t *ctx, char *buf, size_t bufsize);
+static mdn_result_t put_domainname(msgtrans_ctx_t *ctx, char *name);
+static void ctx_init(msgtrans_ctx_t *ctx,
+ mdn_msgtrans_param_t *param,
+ const char *msg, size_t msglen,
+ char *outbuf, size_t outbufsize);
+static mdn_result_t copy_rest(msgtrans_ctx_t *ctx);
+static mdn_result_t copy_message(msgtrans_ctx_t *ctx, size_t len);
+static size_t output_length(msgtrans_ctx_t *ctx);
+static void dump_message(const char *title, const char *p,
+ size_t length);
+
+
+mdn_result_t
+mdn_msgtrans_translate(mdn_msgtrans_param_t *param,
+ const char *msg, size_t msglen,
+ char *outbuf, size_t outbufsize, size_t *outmsglenp)
+{
+ mdn_result_t r;
+ msgtrans_ctx_t ctx;
+ mdn_msgheader_t header;
+ int i;
+
+ assert(param != NULL && msg != NULL &&
+ outbuf != NULL && outbufsize > 0 && outmsglenp != NULL);
+
+ TRACE(("mdn_msgtrans_translate(msg=<%s>,msglen=%d)\n",
+ mdn_debug_hexdata(msg, msglen, 64), msglen));
+
+ if (LOGLEVEL >= mdn_log_level_dump)
+ dump_message("before translation", msg, msglen);
+
+ /*
+ * Check message length.
+ */
+ if (msglen < DNS_HEADER_SIZE) {
+ INFO(("mdn_msgtrans_translate: incoming packet too short "
+ "(%d octets)\n", msglen));
+ return (mdn_invalid_message);
+ }
+
+ /*
+ * Parse message header.
+ */
+ if ((r = mdn_msgheader_parse(msg, msglen, &header)) != mdn_success) {
+ WARNING(("mdn_msgtrans_translate: message header "
+ "parsing failed: %s\n",
+ mdn_result_tostring(r)));
+ return (r);
+ }
+
+ /*
+ * Create translation context.
+ */
+ ctx_init(&ctx, param, msg, msglen, outbuf, outbufsize);
+
+ /*
+ * We handle only query, notify and update messages.
+ * Do not process others.
+ */
+ switch (header.opcode) {
+ case opcode_query:
+ case opcode_notify:
+ case opcode_update:
+ break;
+ default:
+ INFO(("mdn_msgtrans_translate: pass through message "
+ "whose opcode is %d", header.opcode));
+ if ((r = copy_rest(&ctx)) == mdn_success)
+ *outmsglenp = output_length(&ctx);
+ return (mdn_success);
+ }
+
+ /*
+ * Copy header part verbatim.
+ */
+ (void)copy_header(&ctx);
+
+ /*
+ * Parse question/zone section.
+ */
+ for (i = 0; i < header.qdcount; i++) {
+ if ((r = translate_question(&ctx)) != mdn_success)
+ return (r);
+ }
+
+ /*
+ * Translate other sections.
+ */
+ for (i = 0;
+ i < header.ancount + header.nscount + header.arcount;
+ i++) {
+ if ((r = translate_rr(&ctx)) != mdn_success)
+ return (r);
+ }
+
+ if (LOGLEVEL >= mdn_log_level_dump)
+ dump_message("after translation",
+ ctx.out, output_length(&ctx));
+
+ /*
+ * Is there anything left out?
+ */
+ if (ctx.in_remain != 0) {
+ WARNING(("mdn_msgtrans_translate: garbage at the end "
+ "(%d octets)\n", ctx.in_remain));
+ /* don't consider this as an error. */
+ /* return (mdn_invalid_message); */
+ }
+
+ *outmsglenp = output_length(&ctx);
+ return (mdn_success);
+}
+
+static mdn_result_t
+copy_header(msgtrans_ctx_t *ctx) {
+ return (copy_message(ctx, DNS_HEADER_SIZE));
+}
+
+static mdn_result_t
+translate_question(msgtrans_ctx_t *ctx) {
+ mdn_result_t r;
+ mdn_msgtrans_param_t *param;
+ char qname[DNAME_SIZE], qname_translated[DNAME_SIZE];
+
+ param = ctx->param;
+
+ /* Get QNAME. */
+ if ((r = get_domainname(ctx, qname, sizeof(qname))) != mdn_success)
+ return (r);
+
+ if (!ctx->determined) {
+ /*
+ * Determine ZLD and character set/encoding.
+ */
+ r = mdn_zldrule_select(param->local_rule, qname,
+ &param->local_zld,
+ &param->local_converter);
+ switch (r) {
+ case mdn_success:
+ ctx->determined = 1;
+ break;
+ case mdn_notfound:
+ /*
+ * No matching ZLD, no default.
+ */
+ param->local_zld = NULL;
+ param->local_converter = NULL;
+ break;
+ default:
+ return (r);
+ }
+ }
+
+ /* Translate QNAME. */
+ r = translate_name(param, qname, qname_translated,
+ sizeof(qname_translated));
+ if (r != mdn_success)
+ return (r);
+
+ if ((r = put_domainname(ctx, qname_translated)) != mdn_success)
+ return (r);
+
+ /* Copy QTYPE and QCLASS */
+ return (copy_message(ctx, 4));
+}
+
+static mdn_result_t
+translate_rr(msgtrans_ctx_t *ctx) {
+ mdn_result_t r;
+ unsigned char *p;
+ unsigned int rr_type, rr_class, rr_length;
+ char dname[DNAME_SIZE], dname_translated[DNAME_SIZE];
+ size_t length_before;
+
+ /* Get NAME. */
+ if ((r = get_domainname(ctx, dname, sizeof(dname))) != mdn_success)
+ return (r);
+
+ /* Translate NAME. */
+ r = translate_name(ctx->param, dname, dname_translated,
+ sizeof(dname_translated));
+ if (r != mdn_success)
+ return (r);
+
+ if ((r = put_domainname(ctx, dname_translated)) != mdn_success)
+ return (r);
+
+ /* Get TYPE and CLASS */
+ if (ctx->in_remain < 10)
+ return (mdn_invalid_message);
+ p = (unsigned char *)ctx->in_ptr;
+#define GET16(off) ((p[off]<<8)+p[(off)+1])
+ rr_type = GET16(0);
+ rr_class = GET16(2);
+ rr_length = GET16(8);
+#undef GET16
+
+ /* Copy TYPE, CLASS, TTL and RDLENGTH. */
+ if ((r = copy_message(ctx, 10)) != mdn_success)
+ return (r);
+
+ /* Remember the current output length. */
+ length_before = output_length(ctx);
+
+ /* Translate RDATA. */
+ r = translate_rdata(ctx, rr_type, rr_class, rr_length);
+
+ if (r == mdn_success) {
+ /* Reset RDLENGTH */
+ rr_length = output_length(ctx) - length_before;
+ ctx->out[length_before - 2] = (rr_length >> 8) & 0xff;
+ ctx->out[length_before - 1] = rr_length & 0xff;
+ }
+
+ return (r);
+}
+
+static mdn_result_t
+translate_rdata(msgtrans_ctx_t *ctx, unsigned int rr_type,
+ unsigned int rr_class, unsigned int rr_length)
+{
+ const char *format;
+ int c;
+
+ if ((format = rdata_format(rr_type, rr_class)) == NULL) {
+ INFO(("mdn_msgtrans: unknown resource record type %d "
+ "pass through\n", rr_type));
+ return (copy_message(ctx, rr_length));
+ }
+
+ while ((c = *format++) != '\0') {
+ int copy_len;
+ mdn_result_t r;
+
+ switch (c) {
+ case 'D': /* domain name */
+ {
+ int remain_org = ctx->in_remain;
+
+ if ((r = translate_domain(ctx)) != mdn_success)
+ return (r);
+ rr_length -= remain_org - ctx->in_remain;
+ continue;
+ }
+ case 'T': /* character string */
+ copy_len = *((unsigned char *)ctx->in_ptr) + 1;
+ break;
+ case 'C': /* 1-octet value */
+ copy_len = 1;
+ break;
+ case 'S': /* 2-octet value */
+ copy_len = 2;
+ break;
+ case 'L': /* 4-octet value */
+ copy_len = 4;
+ break;
+ case 'H': /* 16-octet value (AAAA) */
+ copy_len = 16;
+ break;
+ case 'R': /* the rest */
+ copy_len = rr_length;
+ break;
+ default:
+ copy_len = 0; /* for gcc -Wall */
+ FATAL(("mdn_msgtrans: internal error -- "
+ "unknown format character %c", c));
+ /* NOTREACHED */
+ break;
+ }
+ if ((r = copy_message(ctx, copy_len)) != mdn_success)
+ return (r);
+ rr_length -= copy_len;
+ }
+ return (mdn_success);
+}
+
+static const char *
+rdata_format(unsigned int rr_type, unsigned int rr_class) {
+ static int initialized;
+ struct rrformat *rp;
+ int h;
+
+ if (!initialized) {
+ /*
+ * Build hash table.
+ */
+ for (rp = rrformats; rp->format != NULL; rp++) {
+ h = rp->type % RRFORMAT_HASH_SIZE;
+ rp->next = rrformathash[h];
+ rrformathash[h] = rp;
+ }
+ initialized = 1;
+ }
+
+ /*
+ * Find the element with the specified type and class.
+ */
+ h = rr_type % RRFORMAT_HASH_SIZE;
+ for (rp = rrformathash[h]; rp != NULL; rp = rp->next) {
+ if (rp->type == rr_type &&
+ (rp->class == rr_class || rp->class == rrclass_ANY))
+ return (rp->format);
+ }
+ return (NULL);
+}
+
+static mdn_result_t
+translate_domain(msgtrans_ctx_t *ctx) {
+ mdn_result_t r;
+ char dname[DNAME_SIZE], dname_translated[DNAME_SIZE];
+
+ /* Get NAME. */
+ if ((r = get_domainname(ctx, dname, sizeof(dname))) != mdn_success)
+ return (r);
+
+ /* Translate NAME. */
+ r = translate_name(ctx->param, dname, dname_translated,
+ sizeof(dname_translated));
+ if (r != mdn_success)
+ return (r);
+
+ if ((r = put_domainname(ctx, dname_translated)) != mdn_success)
+ return (r);
+
+ return (mdn_success);
+}
+
+static mdn_result_t
+translate_name(mdn_msgtrans_param_t *param,
+ char *from, char *to, size_t tolen)
+{
+ if (param->local_converter == NULL) {
+ /*
+ * No translation is required.
+ */
+ size_t fromlen = strlen(from) + 1;
+ if (fromlen > tolen)
+ return (mdn_buffer_overflow);
+ (void)memcpy(to, from, fromlen);
+ return (mdn_success);
+ } else {
+ return (mdn_translator_translate(param->local_converter,
+ param->local_alt_converter,
+ param->local_zld,
+ param->normalizer,
+ param->target_converter,
+ param->target_alt_converter,
+ param->target_zld,
+ from, to, tolen));
+ }
+}
+
+static mdn_result_t
+get_domainname(msgtrans_ctx_t *ctx, char *buf, size_t bufsize) {
+ mdn_result_t r;
+ size_t n;
+
+ r = mdn__dn_expand(ctx->in, ctx->in_len, ctx->in_ptr,
+ buf, bufsize, &n);
+ if (r == mdn_success) {
+ ctx->in_ptr += n;
+ ctx->in_remain -= n;
+ }
+ return (r);
+}
+
+static mdn_result_t
+put_domainname(msgtrans_ctx_t *ctx, char *name) {
+ mdn_result_t r;
+ size_t n;
+
+ r = mdn__dn_compress(name, ctx->out_ptr, ctx->out_remain,
+ &ctx->dn_ctx, &n);
+ if (r == mdn_success) {
+ ctx->out_ptr += n;
+ ctx->out_remain -= n;
+ }
+ return (r);
+}
+
+static void
+ctx_init(msgtrans_ctx_t *ctx, mdn_msgtrans_param_t *param,
+ const char *msg, size_t msglen, char *outbuf, size_t outbufsize)
+{
+ ctx->in = ctx->in_ptr = msg;
+ ctx->in_len = ctx->in_remain = msglen;
+ ctx->out = ctx->out_ptr = outbuf;
+ ctx->out_remain = outbufsize;
+ ctx->determined = !param->use_local_rule;
+ ctx->param = param;
+ mdn__dn_initcompress(&ctx->dn_ctx, outbuf);
+}
+
+static mdn_result_t
+copy_rest(msgtrans_ctx_t *ctx) {
+ return (copy_message(ctx, ctx->in_remain));
+}
+
+static mdn_result_t
+copy_message(msgtrans_ctx_t *ctx, size_t len) {
+ assert(ctx != NULL);
+
+ if (ctx->in_remain < len)
+ return (mdn_invalid_message);
+
+ if (ctx->out_remain < len)
+ return (mdn_buffer_overflow);
+
+ (void)memcpy(ctx->out_ptr, ctx->in_ptr, len);
+
+ ctx->in_ptr += len;
+ ctx->in_remain -= len;
+ ctx->out_ptr += len;
+ ctx->out_remain -= len;
+
+ return (mdn_success);
+}
+
+static size_t
+output_length(msgtrans_ctx_t *ctx) {
+ return (ctx->out_ptr - ctx->out);
+}
+
+static void
+dump_message(const char *title, const char *p, size_t length) {
+ DUMP(("message (%s): length %d\n", title, length));
+ while (length > 0) {
+ int len = length < 16 ? length : 16;
+ DUMP((" %s\n", mdn_debug_hexdata(p, len, 16)));
+ p += len;
+ length -= len;
+ }
+}
diff --git a/contrib/idn/mdnkit/lib/normalizer.c b/contrib/idn/mdnkit/lib/normalizer.c
new file mode 100644
index 00000000..6706fb2e
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/normalizer.c
@@ -0,0 +1,867 @@
+#ifndef lint
+static char *rcsid = "$Id: normalizer.c,v 1.1 2000/12/07 00:52:25 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/result.h>
+#include <mdn/normalizer.h>
+#include <mdn/strhash.h>
+#include <mdn/unormalize.h>
+#include <mdn/unicode.h>
+#include <mdn/utf8.h>
+#include <mdn/debug.h>
+
+#define UNICODE_IDEOGRAPHIC_FULL_STOP 0x3002
+#define UNICODE_FULLWIDTH_FULL_STOP 0xff0e
+#define UNICODE_HALFWIDTH_IDEOGRAPHIC_FULL_STOP 0xff61
+#define UNICODE_HALFWIDTH_KATAKANA_SEMI_VOICED_SOUND_MARK 0xff9f
+#define UNICODE_MINUS_SIGN 0x2212
+#define UNICODE_FULLWIDTH_DIGIT_ZERO 0xff10
+#define UNICODE_FULLWIDTH_DIGIT_NINE 0xff19
+#define UNICODE_FULLWIDTH_LATIN_CAPITAL_LETTER_A 0xff21
+#define UNICODE_FULLWIDTH_LATIN_CAPITAL_LETTER_Z 0xff3a
+#define UNICODE_FULLWIDTH_LATIN_SMALL_LETTER_A 0xff41
+#define UNICODE_FULLWIDTH_LATIN_SMALL_LETTER_Z 0xff5a
+#define UNICODE_KATAKANA_HIRAGANA_VOICED_SOUND_MARK 0x309b
+#define UNICODE_KATAKANA_HIRAGANA_SEMI_VOICED_SOUND_MARK 0x309c
+#define UNICODE_VOICED_SOUND_CANDIDATE_BEGIN 0x304b /* ka */
+#define UNICODE_VOICED_SOUND_CANDIDATE_END 0x30dd /* ho */
+
+#define MAX_LOCAL_SCHEME 3
+
+#define INITIALIZED (scheme_hash != NULL)
+
+typedef struct {
+ char *name;
+ mdn_normalizer_proc_t proc;
+} normalize_scheme_t;
+
+struct mdn_normalizer {
+ int nschemes;
+ int scheme_size;
+ normalize_scheme_t **schemes;
+ normalize_scheme_t *local_buf[MAX_LOCAL_SCHEME];
+};
+
+static unsigned long ja_half_to_full[] = {
+ 0x3002, 0x300c, 0x300d, 0x3001, 0x30fb, 0x30f2,
+ 0x30a1, 0x30a3, 0x30a5, 0x30a7, 0x30a9, 0x30e3,
+ 0x30e5, 0x30e7, 0x30c3, 0x30fc, 0x30a2, 0x30a4,
+ 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad, 0x30af,
+ 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb,
+ 0x30bd, 0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8,
+ 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf,
+ 0x30d2, 0x30d5, 0x30d8, 0x30db, 0x30de, 0x30df,
+ 0x30e0, 0x30e1, 0x30e2, 0x30e4, 0x30e6, 0x30e8,
+ 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ef,
+ 0x30f3, 0x309b, 0x309c,
+};
+
+typedef struct {
+ unsigned long ucs;
+ unsigned long composed_ucs;
+} voiced_sound_tbl_t;
+
+static voiced_sound_tbl_t ja_voiced_sound[] = {
+ { 0x304b, 0x304c }, { 0x304d, 0x304e },
+ { 0x304f, 0x3050 }, { 0x3051, 0x3052 },
+ { 0x3053, 0x3054 }, { 0x3055, 0x3056 },
+ { 0x3057, 0x3058 }, { 0x3059, 0x305a },
+ { 0x305b, 0x305c }, { 0x305d, 0x305e },
+ { 0x305f, 0x3060 }, { 0x3061, 0x3062 },
+ { 0x3064, 0x3065 }, { 0x3066, 0x3067 },
+ { 0x3068, 0x3069 }, { 0x306f, 0x3070 },
+ { 0x3072, 0x3073 }, { 0x3075, 0x3076 },
+ { 0x3078, 0x3079 }, { 0x307b, 0x307c },
+ { 0x30a6, 0x30f4 }, { 0x30ab, 0x30ac },
+ { 0x30ad, 0x30ae }, { 0x30af, 0x30b0 },
+ { 0x30b1, 0x30b2 }, { 0x30b3, 0x30b4 },
+ { 0x30b5, 0x30b6 }, { 0x30b7, 0x30b8 },
+ { 0x30b9, 0x30ba }, { 0x30bb, 0x30bc },
+ { 0x30bd, 0x30be }, { 0x30bf, 0x30c0 },
+ { 0x30c1, 0x30c2 }, { 0x30c4, 0x30c5 },
+ { 0x30c6, 0x30c7 }, { 0x30c8, 0x30c9 },
+ { 0x30cf, 0x30d0 }, { 0x30d2, 0x30d3 },
+ { 0x30d5, 0x30d6 }, { 0x30d8, 0x30d9 },
+ { 0x30db, 0x30dc },
+};
+
+static voiced_sound_tbl_t ja_semi_voiced_sound[] = {
+ { 0x306f, 0x3071 }, { 0x3072, 0x3074 },
+ { 0x3075, 0x3077 }, { 0x3078, 0x307a },
+ { 0x307b, 0x307d }, { 0x30cf, 0x30d1 },
+ { 0x30d2, 0x30d4 }, { 0x30d5, 0x30d7 },
+ { 0x30d8, 0x30da }, { 0x30db, 0x30dd },
+};
+
+static mdn_strhash_t scheme_hash;
+
+static mdn_result_t expand_schemes(mdn_normalizer_t ctx);
+static mdn_result_t register_standard_normalizers(void);
+static mdn_result_t normalizer_ascii_lowercase(const char *from,
+ char *to, size_t tolen);
+static mdn_result_t normalizer_ascii_uppercase(const char *from,
+ char *to, size_t tolen);
+static mdn_result_t normalizer_unicode_lowercase(const char *from,
+ char *to, size_t tolen);
+static mdn_result_t normalizer_unicode_uppercase(const char *from,
+ char *to, size_t tolen);
+static mdn_result_t normalizer_unicode_caseconv(mdn_result_t (*caseconv)(),
+ const char *from,
+ char *to, size_t tolen);
+static mdn__unicode_context_t get_casemap_context(const char *from,
+ size_t fromlen);
+static mdn_result_t normalizer_ja_minus_hack(const char *from,
+ char *to, size_t tolen);
+static mdn_result_t normalizer_ja_delimiter_hack(const char *from,
+ char *to, size_t tolen);
+static mdn_result_t normalizer_ja_fullwidth(const char *from,
+ char *to, size_t tolen);
+static mdn_result_t normalizer_ja_alnum_halfwidth(const char *from,
+ char *to, size_t tolen);
+static mdn_result_t normalizer_ja_voicedsound(const char *from,
+ char *to, size_t tolen);
+static int compose_voicedsound(unsigned long ucs1,
+ unsigned long ucs2,
+ unsigned long *composed);
+
+static struct standard_normalizer {
+ char *name;
+ mdn_normalizer_proc_t proc;
+} standard_normalizer[] = {
+ { "ascii-lowercase", normalizer_ascii_lowercase },
+ { "ascii-uppercase", normalizer_ascii_uppercase },
+ { "unicode-lowercase", normalizer_unicode_lowercase },
+ { "unicode-uppercase", normalizer_unicode_uppercase },
+ { "unicode-form-c", mdn__unormalize_formc },
+ { "unicode-form-d", mdn__unormalize_formd },
+ { "unicode-form-kc", mdn__unormalize_formkc },
+ { "unicode-form-kd", mdn__unormalize_formkd },
+ { "ja-minus-hack", normalizer_ja_minus_hack },
+ { "ja-delimiter-hack", normalizer_ja_delimiter_hack },
+ { "ja-fullwidth", normalizer_ja_fullwidth },
+ { "ja-kana-fullwidth", normalizer_ja_fullwidth },
+ { "ja-alnum-halfwidth", normalizer_ja_alnum_halfwidth },
+ { "ja-compose-voiced-sound", normalizer_ja_voicedsound },
+ { NULL, NULL },
+};
+
+mdn_result_t
+mdn_normalizer_initialize(void) {
+ mdn_strhash_t hash;
+ mdn_result_t r;
+
+ if (scheme_hash != NULL)
+ return (mdn_success); /* already initialized */
+
+ if ((r = mdn_strhash_create(&hash)) != mdn_success) {
+ WARNING(("mdn_normalizer_initialize: "
+ "hash table creation failed\n"));
+ return (r);
+ }
+ scheme_hash = hash;
+
+ /* Register standard normalizers */
+ return (register_standard_normalizers());
+}
+
+mdn_result_t
+mdn_normalizer_create(mdn_normalizer_t *ctxp) {
+ mdn_normalizer_t ctx;
+
+ assert(ctxp != NULL);
+ TRACE(("mdn_normalizer_create()\n"));
+
+ if ((ctx = malloc(sizeof(struct mdn_normalizer))) == NULL) {
+ WARNING(("mdn_normalizer_create: malloc failed\n"));
+ return (mdn_nomemory);
+ }
+
+ ctx->nschemes = 0;
+ ctx->scheme_size = MAX_LOCAL_SCHEME;
+ ctx->schemes = ctx->local_buf;
+ *ctxp = ctx;
+
+ return (mdn_success);
+}
+
+void
+mdn_normalizer_destroy(mdn_normalizer_t ctx) {
+ assert(ctx != NULL);
+
+ TRACE(("mdn_normalizer_destroy()\n"));
+
+ if (ctx->schemes != ctx->local_buf)
+ free(ctx->schemes);
+
+ free(ctx);
+}
+
+mdn_result_t
+mdn_normalizer_add(mdn_normalizer_t ctx, const char *scheme_name) {
+ mdn_result_t r;
+ void *v;
+ normalize_scheme_t *scheme;
+
+ assert(ctx != NULL && scheme_name != NULL);
+
+ TRACE(("mdn_normalizer_add(scheme_name=%s)\n", scheme_name));
+
+ assert(INITIALIZED);
+
+ if (mdn_strhash_get(scheme_hash, scheme_name, &v) != mdn_success) {
+ WARNING(("mdn_normalizer_add: invalid scheme %s\n",
+ scheme_name));
+ return (mdn_invalid_name);
+ }
+
+ scheme = v;
+
+ assert(ctx->nschemes <= ctx->scheme_size);
+
+ if (ctx->nschemes == ctx->scheme_size &&
+ (r = expand_schemes(ctx)) != mdn_success) {
+ WARNING(("mdn_normalizer_add: malloc failed\n"));
+ return (r);
+ }
+
+ ctx->schemes[ctx->nschemes++] = scheme;
+ return (mdn_success);
+}
+
+
+mdn_result_t
+mdn_normalizer_normalize(mdn_normalizer_t ctx, const char *from,
+ char *to, size_t tolen)
+{
+ assert(ctx != NULL && from != NULL && to != NULL);
+
+ TRACE(("mdn_normalizer_normalize(from=\"%s\")\n",
+ mdn_debug_xstring(from, 20)));
+
+ if (ctx->nschemes == 0) {
+ /* No normalization needed. */
+ size_t flen = strlen(from);
+
+ if (tolen < flen + 1)
+ return (mdn_buffer_overflow);
+ memcpy(to, from, flen + 1); /* +1 for NUL */
+ return (mdn_success);
+ } else if (ctx->nschemes == 1) {
+ /* No temporary buffer needed. */
+ TRACE(("mdn_normalizer_normalize: nomalization %s\n",
+ ctx->schemes[0]->name));
+ return ((*ctx->schemes[0]->proc)(from, to, tolen));
+ } else {
+ /*
+ * Allocate two intermediate buffers.
+ */
+ char *buffer[2];
+ char local_buf[2][1024]; /* usually big enough */
+ size_t buffer_size[2];
+ mdn_result_t r = mdn_success;
+ int i;
+
+ /*
+ * Initialize the buffers to use the local
+ * storage (stack memory).
+ */
+ buffer[0] = local_buf[0];
+ buffer[1] = local_buf[1];
+ buffer_size[0] = sizeof(local_buf[0]);
+ buffer_size[1] = sizeof(local_buf[1]);
+
+ for (i = 0; i < ctx->nschemes; i++) {
+ const char *f;
+ char *t;
+ size_t len;
+ int f_idx = i % 2;
+ int t_idx = !f_idx;
+
+ TRACE(("mdn_normalizer_normalize: nomalization %s\n",
+ ctx->schemes[i]->name));
+
+ /*
+ * Set up from/to buffers.
+ */
+ retry:
+ if (i == 0)
+ f = from;
+ else
+ f = buffer[f_idx];
+ if (i == ctx->nschemes - 1) {
+ t = to;
+ len = tolen;
+ } else {
+ t = buffer[t_idx];
+ len = buffer_size[t_idx];
+ }
+
+ /*
+ * Call the normalize procedure.
+ */
+ r = (*ctx->schemes[i]->proc)(f, t, len);
+
+ if (r == mdn_buffer_overflow && t != to) {
+ /*
+ * Temporary buffer is too small.
+ * Make it bigger.
+ */
+ char *p;
+
+ TRACE(("mdn_normalizer_normalize: "
+ "allocating temporary buffer\n"));
+
+ /* Make it double. */
+ buffer_size[t_idx] *= 2;
+
+ if (buffer[t_idx] == local_buf[t_idx]) {
+ size_t flen = strlen(f) + 100;
+ if (buffer_size[t_idx] < flen)
+ buffer_size[t_idx] = flen;
+ p = malloc(buffer_size[t_idx]);
+ } else {
+ p = realloc(buffer[t_idx],
+ buffer_size[t_idx]);
+ }
+ if (p == NULL) {
+ WARNING(("mdn_normalizer_normalize: "
+ "malloc failed\n"));
+ r = mdn_nomemory;
+ goto ret;
+ }
+ buffer[t_idx] = p;
+ /* Start it over again. */
+ goto retry;
+ } else if (r != mdn_success) {
+ break;
+ }
+ }
+
+ ret:
+ if (buffer[0] != local_buf[0])
+ free(buffer[0]);
+ if (buffer[1] != local_buf[1])
+ free(buffer[1]);
+
+ return (r);
+ }
+}
+
+mdn_result_t
+mdn_normalizer_register(const char *scheme_name, mdn_normalizer_proc_t proc) {
+ mdn_result_t r;
+ normalize_scheme_t *scheme;
+
+ assert(scheme_name != NULL && proc != NULL);
+
+ TRACE(("mdn_normalizer_register(scheme_name=%s)\n", scheme_name));
+
+ assert(INITIALIZED);
+
+ scheme = malloc(sizeof(*scheme) + strlen(scheme_name) + 1);
+ if (scheme == NULL) {
+ WARNING(("mdn_normalizer_register: malloc failed\n"));
+ return (mdn_nomemory);
+ }
+ scheme->name = (char *)(scheme + 1);
+ (void)strcpy(scheme->name, scheme_name);
+ scheme->proc = proc;
+
+ r = mdn_strhash_put(scheme_hash, scheme_name, scheme);
+ if (r != mdn_success)
+ WARNING(("mdn_normalizer_register: registration failed\n"));
+
+ return (r);
+}
+
+static mdn_result_t
+expand_schemes(mdn_normalizer_t ctx) {
+ normalize_scheme_t **new_schemes;
+ int new_size = ctx->scheme_size * 2;
+
+ if (ctx->schemes == ctx->local_buf) {
+ new_schemes = malloc(sizeof(normalize_scheme_t) * new_size);
+ } else {
+ new_schemes = realloc(ctx->schemes,
+ sizeof(normalize_scheme_t) * new_size);
+ }
+ if (new_schemes == NULL)
+ return (mdn_nomemory);
+
+ if (ctx->schemes == ctx->local_buf)
+ memcpy(new_schemes, ctx->local_buf, sizeof(ctx->local_buf));
+
+ ctx->schemes = new_schemes;
+ ctx->scheme_size = new_size;
+
+ return (mdn_success);
+}
+
+static mdn_result_t
+register_standard_normalizers(void) {
+ int i;
+ int failed = 0;
+
+ for (i = 0; standard_normalizer[i].name != NULL; i++) {
+ mdn_result_t r;
+ r = mdn_normalizer_register(standard_normalizer[i].name,
+ standard_normalizer[i].proc);
+ if (r != mdn_success) {
+ WARNING(("mdn_normalizer_initialize: "
+ "failed to register \"%-.100s\"\n",
+ standard_normalizer[i].name));
+ failed++;
+ }
+ }
+ if (failed > 0)
+ return (mdn_failure);
+ else
+ return (mdn_success);
+}
+
+/*
+ * Standard Normalizer
+ */
+
+static mdn_result_t
+normalizer_ascii_lowercase(const char *from, char *to, size_t tolen) {
+ size_t fromlen = strlen(from);
+
+ while (fromlen > 0 && tolen > 0) {
+ int w = mdn_utf8_mblen(from);
+
+ if (w == 0 || fromlen < w)
+ return (mdn_invalid_encoding);
+ else if (tolen < w)
+ return (mdn_buffer_overflow);
+
+ if (w == 1 && isupper((unsigned char)*from)) {
+ *to++ = tolower((unsigned char)(*from++));
+ } else {
+ int i = w;
+ while (i-- > 0)
+ *to++ = *from++;
+ }
+ fromlen -= w;
+ tolen -= w;
+ }
+ if (tolen <= 0)
+ return (mdn_buffer_overflow);
+
+ *to = '\0';
+ return (mdn_success);
+}
+
+static mdn_result_t
+normalizer_ascii_uppercase(const char *from, char *to, size_t tolen) {
+ size_t fromlen = strlen(from);
+
+ while (fromlen > 0 && tolen > 0) {
+ int w = mdn_utf8_mblen(from);
+
+ if (w == 0 || fromlen < w)
+ return (mdn_invalid_encoding);
+ else if (tolen < w)
+ return (mdn_buffer_overflow);
+
+ if (w == 1 && islower((unsigned char)*from)) {
+ *to++ = toupper((unsigned char)(*from++));
+ } else {
+ int i = w;
+ while (i-- > 0)
+ *to++ = *from++;
+ }
+ fromlen -= w;
+ tolen -= w;
+ }
+ if (tolen <= 0)
+ return (mdn_buffer_overflow);
+
+ *to = '\0';
+ return (mdn_success);
+}
+
+static mdn_result_t
+normalizer_unicode_lowercase(const char *from, char *to, size_t tolen) {
+ return (normalizer_unicode_caseconv(mdn__unicode_tolower,
+ from, to, tolen));
+}
+
+static mdn_result_t
+normalizer_unicode_uppercase(const char *from, char *to, size_t tolen) {
+ return (normalizer_unicode_caseconv(mdn__unicode_toupper,
+ from, to, tolen));
+}
+
+static mdn_result_t
+normalizer_unicode_caseconv(mdn_result_t (*caseconv)(),
+ const char *from, char *to, size_t tolen)
+{
+ size_t fromlen = strlen(from);
+
+ while (fromlen > 0 && tolen > 0) {
+#define CASEMAPBUFSZ 4
+ unsigned long c;
+ unsigned long v[CASEMAPBUFSZ];
+ mdn_result_t r;
+ mdn__unicode_context_t ctx = mdn__unicode_context_unknown;
+ size_t vlen;
+ int w;
+ int i;
+
+ if ((w = mdn_utf8_getwc(from, fromlen, &c)) == 0)
+ return (mdn_invalid_encoding);
+ from += w;
+ fromlen -= w;
+
+ redo:
+ r = (*caseconv)(c, ctx, v, CASEMAPBUFSZ, &vlen);
+ switch (r) {
+ case mdn_success:
+ break;
+ case mdn_context_required:
+ ctx = get_casemap_context(from, fromlen);
+ goto redo;
+ case mdn_buffer_overflow:
+ FATAL(("mdn_normalizer_normalize: "
+ "internal buffer overflow\n"));
+ break;
+ default:
+ return (r);
+ }
+
+ for (i = 0; i < vlen; i++) {
+ if ((w = mdn_utf8_putwc(to, tolen, v[i])) == 0)
+ return (mdn_buffer_overflow);
+ to += w;
+ tolen -= w;
+ }
+ }
+ if (tolen <= 0)
+ return (mdn_buffer_overflow);
+
+ *to = '\0';
+ return (mdn_success);
+}
+
+static mdn__unicode_context_t
+get_casemap_context(const char *from, size_t fromlen) {
+ while (fromlen > 0) {
+ unsigned long v;
+ mdn__unicode_context_t ctx;
+ int w;
+
+ if ((w = mdn_utf8_getwc(from, fromlen, &v)) == 0)
+ return (mdn_invalid_encoding);
+ from += w;
+ fromlen -= w;
+ ctx = mdn__unicode_getcontext(v);
+ if (ctx == mdn__unicode_context_nonfinal ||
+ ctx == mdn__unicode_context_final)
+ return (ctx);
+ }
+ return (mdn__unicode_context_final);
+}
+
+static mdn_result_t
+normalizer_ja_minus_hack(const char *from, char *to, size_t tolen) {
+ size_t fromlen = strlen(from);
+
+ while (fromlen > 0 && tolen > 0) {
+ unsigned long ucs;
+ int width;
+
+ if ((width = mdn_utf8_getwc(from, fromlen, &ucs)) == 0)
+ return (mdn_invalid_encoding);
+ from += width;
+ fromlen -= width;
+
+ if (ucs == UNICODE_MINUS_SIGN)
+ ucs = '-';
+
+ if ((width = mdn_utf8_putwc(to, tolen, ucs)) == 0)
+ return (mdn_buffer_overflow);
+ to += width;
+ tolen -= width;
+ }
+
+ if (tolen <= 0)
+ return (mdn_buffer_overflow);
+
+ *to = '\0';
+ return (mdn_success);
+}
+
+static mdn_result_t
+normalizer_ja_delimiter_hack(const char *from, char *to, size_t tolen) {
+ size_t fromlen = strlen(from);
+
+ while (fromlen > 0 && tolen > 0) {
+ unsigned long ucs;
+ int width;
+
+ if ((width = mdn_utf8_getwc(from, fromlen, &ucs)) == 0)
+ return (mdn_invalid_encoding);
+ from += width;
+ fromlen -= width;
+
+ if (ucs == UNICODE_IDEOGRAPHIC_FULL_STOP ||
+ ucs == UNICODE_FULLWIDTH_FULL_STOP)
+ ucs = '.';
+
+ if ((width = mdn_utf8_putwc(to, tolen, ucs)) == 0)
+ return (mdn_buffer_overflow);
+ to += width;
+ tolen -= width;
+ }
+
+ if (tolen <= 0)
+ return (mdn_buffer_overflow);
+
+ *to = '\0';
+ return (mdn_success);
+}
+
+static mdn_result_t
+normalizer_ja_fullwidth(const char *from, char *to, size_t tolen) {
+ size_t fromlen = strlen(from);
+
+ while (fromlen > 0 && tolen > 0) {
+ unsigned long ucs;
+ int width;
+
+ if ((width = mdn_utf8_getwc(from, fromlen, &ucs)) == 0)
+ return (mdn_invalid_encoding);
+ from += width;
+ fromlen -= width;
+
+ if (UNICODE_HALFWIDTH_IDEOGRAPHIC_FULL_STOP <= ucs &&
+ ucs <= UNICODE_HALFWIDTH_KATAKANA_SEMI_VOICED_SOUND_MARK) {
+ ucs = ja_half_to_full[ucs - UNICODE_HALFWIDTH_IDEOGRAPHIC_FULL_STOP];
+ }
+
+ if ((width = mdn_utf8_putwc(to, tolen, ucs)) == 0)
+ return (mdn_buffer_overflow);
+ to += width;
+ tolen -= width;
+ }
+
+ if (tolen <= 0)
+ return (mdn_buffer_overflow);
+
+ *to = '\0';
+ return (mdn_success);
+}
+
+static mdn_result_t
+normalizer_ja_alnum_halfwidth(const char *from, char *to, size_t tolen) {
+ size_t fromlen = strlen(from);
+
+ while (fromlen > 0 && tolen > 0) {
+ unsigned long ucs;
+ int width;
+
+ if ((width = mdn_utf8_getwc(from, fromlen, &ucs)) == 0)
+ return (mdn_invalid_encoding);
+ from += width;
+ fromlen -= width;
+
+ if (ucs >= UNICODE_FULLWIDTH_DIGIT_ZERO &&
+ ucs <= UNICODE_FULLWIDTH_DIGIT_NINE) {
+ ucs -= UNICODE_FULLWIDTH_DIGIT_ZERO;
+ ucs += '0';
+ } else if (ucs >= UNICODE_FULLWIDTH_LATIN_CAPITAL_LETTER_A &&
+ ucs <= UNICODE_FULLWIDTH_LATIN_CAPITAL_LETTER_Z) {
+ ucs -= UNICODE_FULLWIDTH_LATIN_CAPITAL_LETTER_A;
+ ucs += 'A';
+ } else if (ucs >= UNICODE_FULLWIDTH_LATIN_SMALL_LETTER_A &&
+ ucs <= UNICODE_FULLWIDTH_LATIN_SMALL_LETTER_Z) {
+ ucs -= UNICODE_FULLWIDTH_LATIN_SMALL_LETTER_A;
+ ucs += 'a';
+ } else if (ucs == UNICODE_MINUS_SIGN) {
+ ucs = '-';
+ }
+
+ if ((width = mdn_utf8_putwc(to, tolen, ucs)) == 0)
+ return (mdn_buffer_overflow);
+ to += width;
+ tolen -= width;
+ }
+
+ if (tolen <= 0)
+ return (mdn_buffer_overflow);
+
+ *to = '\0';
+ return (mdn_success);
+}
+
+static mdn_result_t
+normalizer_ja_voicedsound(const char *from, char *to, size_t tolen) {
+ size_t fromlen = strlen(from);
+ unsigned long ucs, last_ucs;
+ int width;
+
+#define VOID_UCS 0xffffffff /* not a valid UCS-4 character. */
+
+ for (last_ucs = VOID_UCS; fromlen > 0 && tolen > 0; last_ucs = ucs) {
+ unsigned long composed_ucs;
+
+ if ((width = mdn_utf8_getwc(from, fromlen, &ucs)) == 0)
+ return (mdn_invalid_encoding);
+ from += width;
+ fromlen -= width;
+
+ if (last_ucs == VOID_UCS)
+ continue;
+
+ /*
+ * See if 'ucs' can be composed with the previous character
+ * 'last_ucs'.
+ */
+ if ((ucs == UNICODE_KATAKANA_HIRAGANA_SEMI_VOICED_SOUND_MARK ||
+ ucs == UNICODE_KATAKANA_HIRAGANA_VOICED_SOUND_MARK) &&
+ compose_voicedsound(last_ucs, ucs, &composed_ucs)) {
+ /*
+ * They can be composed. Replace 'last_ucs'
+ * with the composed character, and void 'ucs'.
+ */
+ last_ucs = composed_ucs;
+ ucs = VOID_UCS;
+ }
+
+ /*
+ * Append 'last_ucs' to the result buffer.
+ */
+ if ((width = mdn_utf8_putwc(to, tolen, last_ucs)) == 0)
+ return (mdn_buffer_overflow);
+ to += width;
+ tolen -= width;
+ }
+
+ /*
+ * If there is non-void 'last_ucs' character, append it to
+ * the result buffer.
+ */
+ if (last_ucs != VOID_UCS) {
+ if ((width = mdn_utf8_putwc(to, tolen, last_ucs)) == 0)
+ return (mdn_buffer_overflow);
+ to += width;
+ tolen -= width;
+ }
+#undef VOID_UCS
+
+ /*
+ * Terminate the result buffer with NUL.
+ */
+ if (tolen <= 0)
+ return (mdn_buffer_overflow);
+ *to = '\0';
+
+ return (mdn_success);
+}
+
+static int
+compose_voicedsound(unsigned long ucs1, unsigned long ucs2,
+ unsigned long *composed)
+{
+ voiced_sound_tbl_t *tbl;
+ size_t tblsize;
+ int top, end;
+
+ assert(ucs2 == UNICODE_KATAKANA_HIRAGANA_VOICED_SOUND_MARK ||
+ ucs2 == UNICODE_KATAKANA_HIRAGANA_SEMI_VOICED_SOUND_MARK);
+
+ if (ucs1 < UNICODE_VOICED_SOUND_CANDIDATE_BEGIN ||
+ ucs1 > UNICODE_VOICED_SOUND_CANDIDATE_END)
+ return (0);
+
+ if (ucs2 == UNICODE_KATAKANA_HIRAGANA_VOICED_SOUND_MARK) {
+ tbl = ja_voiced_sound;
+ tblsize = sizeof(ja_voiced_sound) / sizeof(tbl[0]);
+ } else {
+ tbl = ja_semi_voiced_sound;
+ tblsize = sizeof(ja_semi_voiced_sound) / sizeof(tbl[0]);
+ }
+
+ for (top = 0, end = tblsize - 1; top <= end;) {
+ int mid = (top + end) / 2;
+ unsigned long miducs = tbl[mid].ucs;
+
+ if (ucs1 == miducs) {
+ *composed = tbl[mid].composed_ucs;
+ return (1);
+ } else if (ucs1 < miducs) {
+ end = mid - 1;
+ } else {
+ top = mid + 1;
+ }
+ }
+ return (0);
+}
diff --git a/contrib/idn/mdnkit/lib/race.c b/contrib/idn/mdnkit/lib/race.c
new file mode 100644
index 00000000..f923f44f
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/race.c
@@ -0,0 +1,539 @@
+#ifndef lint
+static char *rcsid = "$Id: race.c,v 1.1 2000/12/07 00:52:25 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <mdn/result.h>
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/converter.h>
+#include <mdn/utf8.h>
+#include <mdn/debug.h>
+#include <mdn/race.h>
+#include <mdn/util.h>
+
+#ifndef MDN_RACE_PREFIX
+#define MDN_RACE_PREFIX "bq--"
+#endif
+#define RACE_PREFIX_LEN (strlen(MDN_RACE_PREFIX))
+#define RACE_2OCTET_MODE 0xd8
+#define RACE_ESCAPE 0xff
+#define RACE_ESCAPE_2ND 0x99
+
+#define RACE_BUF_SIZE 128 /* more than enough */
+
+/*
+ * Unicode surrogate pair.
+ */
+#define IS_SURROGATE_HIGH(v) (0xd800 <= (v) && (v) <= 0xdbff)
+#define IS_SURROGATE_LOW(v) (0xdc00 <= (v) && (v) <= 0xdfff)
+#define SURROGATE_HIGH(v) (SURROGATE_H_OFF + (((v) - 0x10000) >> 10))
+#define SURROGATE_LOW(v) (SURROGATE_L_OFF + ((v) & 0x3ff))
+#define SURROGATE_BASE 0x10000
+#define SURROGATE_H_OFF 0xd800
+#define SURROGATE_L_OFF 0xdc00
+#define COMBINE_SURROGATE(h, l) \
+ (SURROGATE_BASE + (((h)-SURROGATE_H_OFF)<<10) + ((l)-SURROGATE_L_OFF))
+
+/*
+ * Compression type.
+ */
+enum {
+ compress_one, /* all characters are in a single row */
+ compress_two, /* row 0 and another row */
+ compress_none, /* nope */
+};
+
+static mdn_result_t race_l2u(const char *from, const char *end,
+ char *to, size_t tolen, size_t *clenp);
+static mdn_result_t race_u2l(const char *from, const char *end,
+ char *to, size_t tolen, size_t *clenp);
+static mdn_result_t race_decode(const char *from, size_t fromlen,
+ char *to, size_t tolen);
+static mdn_result_t race_decode_decompress(const char *from,
+ size_t fromlen,
+ unsigned short *buf,
+ size_t *lenp);
+static mdn_result_t race_encode(const char *from, size_t fromlen,
+ char *to, size_t tolen);
+static mdn_result_t race_compress_encode(const unsigned short *p,
+ size_t len, int compress_mode,
+ char *to, size_t tolen);
+static int get_compress_mode(unsigned short *p, size_t len);
+
+/* ARGSUSED */
+mdn_result_t
+mdn__race_open(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ return (mdn_success);
+}
+
+/* ARGSUSED */
+mdn_result_t
+mdn__race_close(mdn_converter_t ctx, mdn_converter_dir_t dir) {
+ return (mdn_success);
+}
+
+mdn_result_t
+mdn__race_convert(mdn_converter_t ctx, mdn_converter_dir_t dir,
+ const char *from, char *toorg, size_t tolen)
+{
+ char *to = toorg;
+
+ assert(ctx != NULL &&
+ (dir == mdn_converter_l2u || dir == mdn_converter_u2l));
+
+ TRACE(("mdn__race_convert(dir=%s,from=\"%s\")\n",
+ dir == mdn_converter_l2u ? "l2u" : "u2l",
+ mdn_debug_xstring(from, 20)));
+
+ for (;;) {
+ const char *end;
+ size_t convlen;
+ mdn_result_t r;
+
+ /*
+ * Find the end of this component (label).
+ */
+ if ((end = strchr(from, '.')) == NULL)
+ end = from + strlen(from);
+
+ /*
+ * Convert it.
+ */
+ if (dir == mdn_converter_l2u)
+ r = race_l2u(from, end, to, tolen, &convlen);
+ else
+ r = race_u2l(from, end, to, tolen, &convlen);
+ if (r != mdn_success)
+ return (r);
+
+ /*
+ * Copy '.' or NUL.
+ */
+ if (tolen <= convlen)
+ return (mdn_buffer_overflow);
+
+ to += convlen;
+ *to++ = *end;
+ tolen -= convlen + 1;
+
+ if (*end == '\0')
+ break;
+
+ from = end + 1;
+ }
+
+ DUMP(("mdn__race_convert: \"%s\"\n", mdn_debug_xstring(toorg, 70)));
+
+ return (mdn_success);
+}
+
+static mdn_result_t
+race_l2u(const char *from, const char *end,
+ char *to, size_t tolen, size_t *clenp) {
+ size_t len = end - from;
+
+ if (len >= RACE_PREFIX_LEN &&
+ mdn_util_casematch(from, MDN_RACE_PREFIX, RACE_PREFIX_LEN)) {
+ /*
+ * RACE encoding prefix found.
+ */
+ mdn_result_t r;
+
+ r = race_decode(from + RACE_PREFIX_LEN,
+ len - RACE_PREFIX_LEN, to, tolen);
+ if (r == mdn_invalid_encoding)
+ goto copy;
+ else if (r != mdn_success)
+ return (r);
+
+ len = strlen(to);
+ } else {
+ /*
+ * Not RACE encoded. Copy verbatim.
+ */
+ copy:
+ if (mdn_util_domainspan(from, end) < end) {
+ /* invalid character found */
+ return (mdn_invalid_encoding);
+ }
+
+ if (tolen < len)
+ return (mdn_buffer_overflow);
+
+ (void)memcpy(to, from, len);
+ }
+ *clenp = len;
+ return (mdn_success);
+}
+
+static mdn_result_t
+race_u2l(const char *from, const char *end,
+ char *to, size_t tolen, size_t *clenp) {
+ size_t len = end - from;
+
+ /*
+ * See if encoding is necessary.
+ */
+ if (mdn_util_domainspan(from, end) < end) {
+ /*
+ * Conversion is necessary.
+ */
+ mdn_result_t r;
+
+ /* Set prefix. */
+ if (tolen < RACE_PREFIX_LEN)
+ return (mdn_buffer_overflow);
+ (void)memcpy(to, MDN_RACE_PREFIX, RACE_PREFIX_LEN);
+ to += RACE_PREFIX_LEN;
+ tolen -= RACE_PREFIX_LEN;
+
+ r = race_encode(from, len, to, tolen);
+ if (r != mdn_success)
+ return (r);
+
+ len = RACE_PREFIX_LEN + strlen(to);
+ } else {
+ /*
+ * Conversion is NOT necessary.
+ * Copy verbatim.
+ */
+
+ if (tolen < len)
+ return (mdn_buffer_overflow);
+
+ (void)memcpy(to, from, len);
+ }
+ *clenp = len;
+ return (mdn_success);
+}
+
+static mdn_result_t
+race_decode(const char *from, size_t fromlen, char *to, size_t tolen) {
+ unsigned short *buf;
+ unsigned short local_buf[RACE_BUF_SIZE];
+ size_t len, reslen;
+ mdn_result_t r;
+
+ /*
+ * Allocate sufficient buffer.
+ */
+ if (fromlen > RACE_BUF_SIZE) {
+ if ((buf = malloc(sizeof(*buf) * fromlen)) == NULL)
+ return (mdn_nomemory);
+ } else {
+ /* Use local buffer. */
+ buf = local_buf;
+ }
+
+ /*
+ * Decode base32 and decompress.
+ */
+ r = race_decode_decompress(from, fromlen, buf, &len);
+ if (r != mdn_success)
+ goto ret;
+
+ /*
+ * Now 'buf' points the decompressed string, which must contain
+ * UTF-16 characters.
+ */
+
+ /*
+ * Convert to UTF-8.
+ */
+ r = mdn_util_utf16toutf8(buf, len, to, tolen, &reslen);
+ if (r != mdn_success)
+ goto ret;
+
+ if (tolen <= reslen) {
+ r = mdn_buffer_overflow;
+ goto ret;
+ }
+ to += reslen;
+ *to = '\0';
+ tolen -= reslen;
+
+ r = mdn_success;
+
+ret:
+ if (buf != local_buf)
+ free(buf);
+ return (r);
+}
+
+static mdn_result_t
+race_decode_decompress(const char *from, size_t fromlen,
+ unsigned short *buf, size_t *lenp)
+{
+ unsigned short *p = buf;
+ unsigned int bitbuf = 0;
+ int bitlen = 0;
+ int i, j;
+ size_t len;
+
+ while (fromlen-- > 0) {
+ int c = *from++;
+ int x;
+
+ if ('a' <= c && c <= 'z')
+ x = c - 'a';
+ else if ('A' <= c && c <= 'Z')
+ x = c - 'A';
+ else if ('2' <= c && c <= '7')
+ x = c - '2' + 26;
+ else
+ return (mdn_invalid_encoding);
+
+ bitbuf = (bitbuf << 5) + x;
+ bitlen += 5;
+ if (bitlen >= 8) {
+ *p++ = (bitbuf >> (bitlen - 8)) & 0xff;
+ bitlen -= 8;
+ }
+ }
+ len = p - buf;
+
+ /*
+ * Now 'buf' holds the decoded string.
+ */
+
+ /*
+ * Decompress.
+ */
+ if (buf[0] == RACE_2OCTET_MODE) {
+ if ((len - 1) % 2 != 0)
+ return (mdn_invalid_encoding);
+ for (i = 1, j = 0; i < len; i += 2, j++)
+ buf[j] = (buf[i] << 8) + buf[i + 1];
+ len = j;
+ } else {
+ unsigned short c = buf[0] << 8; /* higher octet */
+
+ for (i = 1, j = 0; i < len; j++) {
+ if (buf[i] == RACE_ESCAPE) {
+ if (i + 1 >= len)
+ return (mdn_invalid_encoding);
+ else if (buf[i + 1] == RACE_ESCAPE_2ND)
+ buf[j] = c | 0xff;
+ else
+ buf[j] = buf[i + 1];
+ i += 2;
+ } else {
+ buf[j] = c | buf[i++];
+ }
+ }
+ len = j;
+ }
+ *lenp = len;
+ return (mdn_success);
+}
+
+static mdn_result_t
+race_encode(const char *from, size_t fromlen, char *to, size_t tolen) {
+ unsigned short *p, *buf;
+ unsigned short local_buf[RACE_BUF_SIZE]; /* UTF-16 */
+ mdn_result_t r;
+ size_t len, buflen;
+ int compress_mode;
+
+ /*
+ * Convert to UTF-16.
+ * Preserve space for a character at the top of the buffer.
+ */
+ buf = local_buf;
+ buflen = RACE_BUF_SIZE;
+ for (;;) {
+ r = mdn_util_utf8toutf16(from, fromlen,
+ buf + 1, buflen - 1, &len);
+ if (r == mdn_buffer_overflow) {
+ buflen *= 2;
+ if (buf == local_buf)
+ buf = malloc(sizeof(*buf) * buflen);
+ else
+ buf = realloc(buf, sizeof(*buf) * buflen);
+ if (buf == NULL)
+ return (mdn_nomemory);
+ } else if (r == mdn_success) {
+ break;
+ } else {
+ goto ret;
+ }
+ }
+ p = buf + 1;
+
+ /*
+ * Now 'p' contains UTF-16 encoded string.
+ */
+
+ /*
+ * Compress, encode in base-32 and output.
+ */
+ compress_mode = get_compress_mode(p, len);
+ r = race_compress_encode(buf, len + 1, compress_mode, to, tolen);
+
+ret:
+ if (buf != local_buf)
+ free(buf);
+ return (r);
+}
+
+static mdn_result_t
+race_compress_encode(const unsigned short *p, size_t len, int compress_mode,
+ char *to, size_t tolen)
+{
+ unsigned long bitbuf = 0; /* bit stream buffer */
+ int bitlen = 0; /* # of bits in 'bitbuf' */
+ int i;
+
+ for (i = 0; i <= len; i++) {
+ if (i == len) {
+ /* End of data. Flush. */
+ if (bitlen == 0)
+ break;
+ bitbuf <<= (5 - bitlen);
+ bitlen = 5;
+ } else if (i == 0 || compress_mode == compress_one) {
+ /* Push 8 bit data into bitbuf. */
+ bitbuf = (bitbuf << 8) | (p[i] & 0xff);
+ bitlen += 8;
+ } else if (compress_mode == compress_two) {
+ /* Push 8 or 16 bit data. */
+ if ((p[i] & 0xff00) == 0) {
+ /* Upper octet is zero. */
+ bitbuf = (bitbuf << 16) | 0xff00 | p[i];
+ bitlen += 16;
+ } else if ((p[i] & 0xff) == 0xff) {
+ /* Lower octet is 0xff. */
+ bitbuf = (bitbuf << 16) |
+ (RACE_ESCAPE << 8) | RACE_ESCAPE_2ND;
+ bitlen += 16;
+ } else {
+ bitbuf = (bitbuf << 8) | (p[i] & 0xff);
+ bitlen += 8;
+ }
+ } else { /* compresss_mode == compress_none */
+ /* Push 16 bit data. */
+ bitbuf = (bitbuf << 16) | p[i];
+ bitlen += 16;
+ }
+
+ /*
+ * Output bits in 'bitbuf' in 5-bit unit.
+ */
+ while (bitlen >= 5) {
+ int x;
+
+ /* Get top 5 bits. */
+ x = (bitbuf >> (bitlen - 5)) & 0x1f;
+ bitlen -= 5;
+
+ /* Encode. */
+ if (x < 26)
+ x += 'a';
+ else
+ x = (x - 26) + '2';
+
+ if (tolen < 1)
+ return (mdn_buffer_overflow);
+
+ *to++ = x;
+ tolen--;
+ }
+ }
+
+ if (tolen <= 0)
+ return (mdn_buffer_overflow);
+
+ *to = '\0';
+ return (mdn_success);
+}
+
+static int
+get_compress_mode(unsigned short *p, size_t len) {
+ int zero = 0;
+ unsigned int upper = 0;
+ int i;
+
+ for (i = 0; i < len; i++) {
+ unsigned int hi = p[i] & 0xff00;
+
+ if (hi == 0) {
+ zero++;
+ } else if (hi == upper) {
+ ;
+ } else if (upper == 0) {
+ upper = hi;
+ } else {
+ p[-1] = RACE_2OCTET_MODE;
+ return (compress_none);
+ }
+ }
+ p[-1] = upper >> 8;
+ if (upper > 0 && zero > 0)
+ return (compress_two);
+ else
+ return (compress_one);
+}
diff --git a/contrib/idn/mdnkit/lib/res.c b/contrib/idn/mdnkit/lib/res.c
new file mode 100644
index 00000000..802c19ec
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/res.c
@@ -0,0 +1,285 @@
+#ifndef lint
+static char *rcsid = "$Id: res.c,v 1.1 2000/12/07 00:52:25 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <mdn/result.h>
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/converter.h>
+#include <mdn/normalizer.h>
+#include <mdn/translator.h>
+#include <mdn/resconf.h>
+#include <mdn/res.h>
+#include <mdn/debug.h>
+
+static mdn_result_t copy_verbatim(const char *from, char *to,
+ size_t tolen);
+static int contain_invalid_char(const char *name);
+
+mdn_result_t
+mdn_res_localtoucs(mdn_resconf_t conf, const char *local_name,
+ char *ucs_name, size_t ucs_name_len)
+{
+ mdn_converter_t conv;
+ mdn_result_t r;
+
+ assert(local_name != NULL && ucs_name != NULL);
+
+ TRACE(("mdn_res_localtoucs(local_name=\"%-.20s\")\n", local_name));
+
+ if (conf == NULL)
+ return (copy_verbatim(local_name, ucs_name, ucs_name_len));
+
+ if (!contain_invalid_char(local_name) &&
+ (conv = mdn_resconf_alternateconverter(conf)) != NULL) {
+ TRACE(("mdn_res_localtoucs: trying alternate converter..\n"));
+ r = mdn_converter_convert(conv, mdn_converter_l2u,
+ local_name, ucs_name, ucs_name_len);
+ if (r == mdn_success)
+ return (r);
+ }
+
+ if ((conv = mdn_resconf_localconverter(conf)) == NULL)
+ return (copy_verbatim(local_name, ucs_name, ucs_name_len));
+
+ TRACE(("mdn_res_localtoucs: using local converter..\n"));
+ return (mdn_converter_convert(conv, mdn_converter_l2u,
+ local_name, ucs_name, ucs_name_len));
+}
+
+mdn_result_t
+mdn_res_ucstolocal(mdn_resconf_t conf, const char *ucs_name,
+ char *local_name, size_t local_name_len)
+{
+ mdn_converter_t conv;
+ mdn_result_t r;
+
+ assert(ucs_name != NULL && local_name != NULL);
+
+ TRACE(("mdn_res_ucstolocal(ucs_name=\"%s\")\n",
+ mdn_debug_xstring(ucs_name, 20)));
+
+ if (conf == NULL ||
+ (conv = mdn_resconf_localconverter(conf)) == NULL)
+ return (copy_verbatim(ucs_name, local_name, local_name_len));
+
+ r = mdn_converter_convert(conv, mdn_converter_u2l,
+ ucs_name, local_name, local_name_len);
+
+ if (r == mdn_nomapping &&
+ (conv = mdn_resconf_alternateconverter(conf)) != NULL) {
+ TRACE(("mdn_res_ucstolocal: switched to alternate converter\n"));
+ r = mdn_converter_convert(conv, mdn_converter_u2l,
+ ucs_name, local_name,
+ local_name_len);
+ }
+ return (r);
+}
+
+mdn_result_t
+mdn_res_normalize(mdn_resconf_t conf, const char *name,
+ char *normalized_name, size_t normalized_name_len)
+{
+ mdn_normalizer_t norm;
+
+ assert(name != NULL && normalized_name != NULL);
+
+ TRACE(("mdn_res_normalize(name=\"%s\")\n",
+ mdn_debug_xstring(name, 20)));
+
+ if (conf == NULL ||
+ (norm = mdn_resconf_normalizer(conf)) == NULL)
+ return (copy_verbatim(name, normalized_name,
+ normalized_name_len));
+ return (mdn_normalizer_normalize(norm, name, normalized_name,
+ normalized_name_len));
+}
+
+mdn_result_t
+mdn_res_ucstodns(mdn_resconf_t conf, const char *ucs_name, char *dns_name,
+ size_t dns_name_len)
+{
+ mdn_converter_t conv;
+ mdn_result_t r;
+ const char *zld;
+
+ assert(ucs_name != NULL && dns_name != NULL);
+
+ TRACE(("mdn_res_ucstodns(ucs_name=\"%s\")\n",
+ mdn_debug_xstring(ucs_name, 20)));
+
+ if (conf == NULL ||
+ (conv = mdn_resconf_serverconverter(conf)) == NULL ||
+ !contain_invalid_char(ucs_name))
+ return (copy_verbatim(ucs_name, dns_name, dns_name_len));
+
+ r = mdn_converter_convert(conv, mdn_converter_u2l,
+ ucs_name, dns_name, dns_name_len);
+ if (r != mdn_success)
+ return (r);
+
+ if ((zld = mdn_resconf_zld(conf)) != NULL) {
+ size_t len;
+
+ TRACE(("mdn_res_ucstodns: adding ZLD\n"));
+ len = strlen(dns_name);
+ if (len > 0 && dns_name[len - 1] != '.') {
+ if (len + 1 >= dns_name_len)
+ return (mdn_buffer_overflow);
+ strcpy(dns_name + len, ".");
+ len++;
+ }
+ if (len + strlen(zld) >= dns_name_len)
+ return (mdn_buffer_overflow);
+ (void)strcat(dns_name, zld);
+ }
+ return (mdn_success);
+}
+
+mdn_result_t
+mdn_res_dnstoucs(mdn_resconf_t conf, const char *dns_name, char *ucs_name,
+ size_t ucs_name_len)
+{
+ const char *zld;
+ mdn_converter_t conv;
+ char domainbuf[512];
+ int convert;
+
+ assert(dns_name != NULL && ucs_name != NULL);
+
+ TRACE(("mdn_res_dnstoucs(dns_name=\"%s\")\n",
+ mdn_debug_xstring(dns_name, 20)));
+
+ if (conf == NULL ||
+ (conv = mdn_resconf_serverconverter(conf)) == NULL)
+ return (copy_verbatim(dns_name, ucs_name, ucs_name_len));
+
+ if ((zld = mdn_resconf_zld(conf)) != NULL) {
+ if (mdn_translator_matchzld(dns_name, zld)) {
+ /*
+ * Strip 'zld' from 'dns_name'.
+ */
+ size_t namelen = strlen(dns_name);
+
+ TRACE(("mdn_res_dnstoucs: ZLD matched\n"));
+ /* 'zld' must end with dot, but 'dns_name' may not. */
+ if (namelen > 0 && dns_name[namelen - 1] != '.')
+ namelen++;
+ namelen -= strlen(zld);
+ if (namelen >= sizeof(domainbuf))
+ return (mdn_invalid_name);
+ (void)strncpy(domainbuf, dns_name, namelen);
+ domainbuf[namelen] = '\0';
+ dns_name = domainbuf;
+ convert = 1;
+ } else if (contain_invalid_char(dns_name)) {
+ TRACE(("mdn_res_dnstoucs: contain invalid char\n"));
+ return (mdn_invalid_name);
+ } else {
+ convert = 0;
+ }
+ } else if (!mdn_converter_isasciicompatible(conv) &&
+ !contain_invalid_char(dns_name)) {
+ convert = 0;
+ } else {
+ convert = 1;
+ }
+
+ if (convert) {
+ TRACE(("mdn_res_dnstoucs: convert to ucs\n"));
+ return (mdn_converter_convert(conv, mdn_converter_l2u,
+ dns_name, ucs_name,
+ ucs_name_len));
+ } else {
+ return (copy_verbatim(dns_name, ucs_name, ucs_name_len));
+ }
+}
+
+static mdn_result_t
+copy_verbatim(const char *from, char *to, size_t tolen) {
+ size_t fromlen = strlen(from) + 1;
+
+ if (tolen < fromlen)
+ return (mdn_buffer_overflow);
+ (void)memcpy(to, from, fromlen);
+ return (mdn_success);
+}
+
+static int
+contain_invalid_char(const char *name) {
+ int c;
+
+ while ((c = *name++) != '\0') {
+ if (('a' <= c && c <= 'z') ||
+ ('A' <= c && c <= 'Z') ||
+ ('0' <= c && c <= '9') ||
+ c == '.' || c == '-')
+ continue; /* valid character */
+ return (1);
+ }
+ return (0);
+}
diff --git a/contrib/idn/mdnkit/lib/resconf.c b/contrib/idn/mdnkit/lib/resconf.c
new file mode 100644
index 00000000..31c71620
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/resconf.c
@@ -0,0 +1,468 @@
+#ifndef lint
+static char *rcsid = "$Id: resconf.c,v 1.1 2000/12/07 00:52:25 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include <mdn/result.h>
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/converter.h>
+#include <mdn/normalizer.h>
+#include <mdn/translator.h>
+#include <mdn/localencoding.h>
+#include <mdn/resconf.h>
+#include <mdn/debug.h>
+
+#ifndef MDN_RESCONF_DIR
+#define MDN_RESCONF_DIR "/etc"
+#endif
+#define MDN_RESCONF_FILE MDN_RESCONF_DIR "/mdnres.conf"
+
+struct mdn_resconf {
+ char *local_encoding;
+ mdn_converter_t local_converter;
+ mdn_converter_t alternate_converter;
+ mdn_converter_t server_converter;
+ mdn_normalizer_t normalizer;
+ char *zld;
+ int edns0;
+};
+
+static mdn_result_t parse_conf(mdn_resconf_t ctx, FILE *fp);
+static mdn_result_t parse_normalize(mdn_resconf_t ctx, int argc,
+ char **argv);
+static mdn_result_t parse_alias_file(mdn_resconf_t ctx, int argc,
+ char **argv);
+static mdn_result_t parse_server_encoding(mdn_resconf_t ctx, int argc,
+ char **argv);
+static mdn_result_t parse_server_zld(mdn_resconf_t ctx, int argc,
+ char **argv);
+static mdn_result_t parse_alternate_encoding(mdn_resconf_t ctx, int argc,
+ char **argv);
+static int split_args(char *s, char **av, int nav);
+static void resetconf(mdn_resconf_t ctx);
+static mdn_result_t update_local_converter(mdn_resconf_t ctx);
+static mdn_result_t mystrdup(const char *from, char **top);
+
+mdn_result_t
+mdn_resconf_initialize(void) {
+ mdn_result_t r;
+
+ TRACE(("mdn_resconf_initialize()\n"));
+
+ if ((r = mdn_converter_initialize()) != mdn_success)
+ return (r);
+ if ((r = mdn_normalizer_initialize()) != mdn_success)
+ return (r);
+ return (r);
+}
+
+mdn_result_t
+mdn_resconf_create(mdn_resconf_t *ctxp) {
+ mdn_resconf_t ctx = NULL;
+
+ assert(ctxp != NULL);
+
+ TRACE(("mdn_resconf_create()\n"));
+
+ if ((ctx = malloc(sizeof(*ctx))) == NULL)
+ return (mdn_nomemory);
+ ctx->local_encoding = NULL;
+ ctx->local_converter = NULL;
+ ctx->server_converter = NULL;
+ ctx->alternate_converter = NULL;
+ ctx->normalizer = NULL;
+ ctx->zld = NULL;
+ ctx->edns0 = 0;
+ *ctxp = ctx;
+ return (mdn_success);
+}
+
+char *
+mdn_resconf_defaultfile() {
+ return MDN_RESCONF_FILE;
+}
+
+mdn_result_t
+mdn_resconf_loadfile(mdn_resconf_t ctx, const char *file) {
+ FILE *fp;
+ mdn_result_t r;
+
+ assert(ctx != NULL);
+
+ TRACE(("mdn_resconf_loadfile(file=%s)\n",
+ file == NULL ? "<null>" : file));
+
+ if ((r = mdn_converter_resetalias()) != mdn_success)
+ return (r);
+
+ resetconf(ctx);
+
+ if (file == NULL)
+ file = mdn_resconf_defaultfile();
+ if ((fp = fopen(file, "r")) == NULL) {
+ TRACE(("mdn_resconf_loadfile: cannot open %-.40s\n", file));
+ return (mdn_nofile);
+ }
+
+ r = parse_conf(ctx, fp);
+ fclose(fp);
+
+ return (r);
+}
+
+void
+mdn_resconf_destroy(mdn_resconf_t ctx) {
+ TRACE(("mdn_resconf_destroy()\n"));
+ resetconf(ctx);
+ free(ctx);
+}
+
+mdn_converter_t
+mdn_resconf_localconverter(mdn_resconf_t ctx) {
+ TRACE(("mdn_resconf_localconverter()\n"));
+ if (update_local_converter(ctx) != mdn_success)
+ return (NULL);
+ return (ctx->local_converter);
+}
+
+mdn_converter_t
+mdn_resconf_serverconverter(mdn_resconf_t ctx) {
+ TRACE(("mdn_resconf_serverconverter()\n"));
+ return (ctx->server_converter);
+}
+
+mdn_converter_t
+mdn_resconf_alternateconverter(mdn_resconf_t ctx) {
+ TRACE(("mdn_resconf_alternateconverter()\n"));
+ return (ctx->alternate_converter);
+}
+
+const char *
+mdn_resconf_zld(mdn_resconf_t ctx) {
+ TRACE(("mdn_resconf_zld()\n"));
+ return (ctx->zld);
+}
+
+mdn_normalizer_t
+mdn_resconf_normalizer(mdn_resconf_t ctx) {
+ TRACE(("mdn_resconf_normalizer()\n"));
+ return (ctx->normalizer);
+}
+
+static mdn_result_t
+parse_conf(mdn_resconf_t ctx, FILE *fp) {
+ char line[256];
+ char *argv[20];
+ int argc;
+ mdn_result_t r;
+ char *sencoding_line = NULL;
+ char *fencoding_line = NULL;
+
+ /*
+ * Parse config file. parsing of 'server-encoding' and
+ * 'alternate-encoding' lines are postponed because
+ * 'alias-file' line must be processed before them.
+ */
+ while (fgets(line, sizeof(line), fp) != NULL) {
+ char buf[256];
+
+ if (line[0] == '\n')
+ continue;
+
+ (void)strcpy(buf, line);
+ argc = split_args(buf, argv, 20);
+ if (argc == 0 || argv[0][0] == '#')
+ continue;
+ if (strcmp(argv[0], "normalize") == 0)
+ r = parse_normalize(ctx, argc, argv);
+ else if (strcmp(argv[0], "alias-file") == 0)
+ r = parse_alias_file(ctx, argc, argv);
+ else if (strcmp(argv[0], "server-zld") == 0)
+ r = parse_server_zld(ctx, argc, argv);
+ else if (strcmp(argv[0], "server-encoding") == 0)
+ r = mystrdup(line, &sencoding_line);
+ else if (strcmp(argv[0], "alternate-encoding") == 0)
+ r = mystrdup(line, &fencoding_line);
+ else {
+ mdn_log_error("mdnres: unrecognized command "
+ "\"%-.30s\"\n", argv[0]);
+ r = mdn_invalid_syntax;
+ }
+ if (r != mdn_success)
+ return (r);
+ }
+
+ if (sencoding_line != NULL) {
+ argc = split_args(sencoding_line, argv, 50);
+ r = parse_server_encoding(ctx, argc, argv);
+ free(sencoding_line);
+ if (r != mdn_success)
+ return (r);
+ }
+ if (fencoding_line != NULL) {
+ argc = split_args(fencoding_line, argv, 50);
+ r = parse_alternate_encoding(ctx, argc, argv);
+ free(fencoding_line);
+ if (r != mdn_success)
+ return (r);
+ }
+
+ return (mdn_success);
+}
+
+static mdn_result_t
+parse_normalize(mdn_resconf_t ctx, int argc, char **argv) {
+ mdn_result_t r;
+ int i;
+
+ if (ctx->normalizer == NULL) {
+ r = mdn_normalizer_create(&ctx->normalizer);
+ if (r != mdn_success)
+ return (r);
+ }
+ for (i = 1; i < argc; i++) {
+ r = mdn_normalizer_add(ctx->normalizer, argv[i]);
+ if (r != mdn_success) {
+ if (r == mdn_invalid_name)
+ mdn_log_error("mdnres: unknown "
+ "normalization scheme %-.30s\n",
+ argv[i]);
+ return (r);
+ }
+ }
+ return (mdn_success);
+}
+
+static mdn_result_t
+parse_alias_file(mdn_resconf_t ctx, int argc, char **argv) {
+ if (argc != 2) {
+ mdn_log_error("mdnres: wrong # of args for %s\n", argv[0]);
+ return (mdn_invalid_syntax);
+ }
+ return (mdn_converter_aliasfile(argv[1]));
+}
+
+static mdn_result_t
+parse_server_encoding(mdn_resconf_t ctx, int argc, char **argv) {
+ if (argc != 2) {
+ mdn_log_error("mdnres: wrong # of args for %s\n", argv[0]);
+ return (mdn_invalid_syntax);
+ }
+ return (mdn_converter_create(argv[1], &ctx->server_converter,
+ MDN_CONVERTER_DELAYEDOPEN));
+}
+
+static mdn_result_t
+parse_server_zld(mdn_resconf_t ctx, int argc, char **argv) {
+#ifdef MDN_SUPPORT_ZLD
+ mdn_result_t r;
+
+ if (argc != 2) {
+ mdn_log_error("mdnres: wrong # of args for %s\n", argv[0]);
+ return (mdn_invalid_syntax);
+ }
+ r = mdn_translator_canonicalzld(argv[1], &ctx->zld);
+ if (r != mdn_success)
+ return (r);
+
+ return (mdn_success);
+#else
+ mdn_log_warning("mdnres: ZLD support is disabled -- ignored\n");
+ return (mdn_success);
+#endif /* MDN_SUPPORT_ZLD */
+}
+
+static mdn_result_t
+parse_alternate_encoding(mdn_resconf_t ctx, int argc, char **argv) {
+ mdn_result_t r;
+
+ if (argc != 2) {
+ mdn_log_error("mdnres: wrong # of args for %s\n", argv[0]);
+ return (mdn_invalid_syntax);
+ }
+ r = mdn_converter_create(argv[1], &ctx->alternate_converter,
+ MDN_CONVERTER_DELAYEDOPEN);
+ if (r == mdn_success &&
+ !mdn_converter_isasciicompatible(ctx->alternate_converter)) {
+ mdn_log_error("mdnres: alternate encoding must be "
+ "ASCII-compatible\n");
+ mdn_converter_destroy(ctx->alternate_converter);
+ ctx->alternate_converter = NULL;
+ return (mdn_invalid_name);
+ }
+ return (r);
+}
+
+static int
+split_args(char *s, char **av, int nav) {
+ int i;
+
+ for (i = 0; i < nav; i++) {
+ while (isspace((unsigned char)*s))
+ s++;
+ if (*s == '\0')
+ break;
+ if (*s == '"' || *s == '\'') {
+ int qc = *s++;
+ av[i] = s;
+ while (*s != '\0' && *s != qc)
+ s++;
+ } else {
+ av[i] = s;
+ while (*s != '\0' && !isspace((unsigned char)*s))
+ s++;
+ }
+ if (*s == '\0')
+ return (i + 1);
+ *s++ = '\0';
+ }
+ return (i);
+}
+
+static void
+resetconf(mdn_resconf_t ctx) {
+ if (ctx->local_encoding != NULL) {
+ free(ctx->local_encoding);
+ ctx->local_encoding = NULL;
+ }
+ if (ctx->local_converter != NULL) {
+ mdn_converter_destroy(ctx->local_converter);
+ ctx->local_converter = NULL;
+ }
+ if (ctx->server_converter != NULL) {
+ mdn_converter_destroy(ctx->server_converter);
+ ctx->server_converter = NULL;
+ }
+ if (ctx->alternate_converter != NULL) {
+ mdn_converter_destroy(ctx->alternate_converter);
+ ctx->alternate_converter = NULL;
+ }
+ if (ctx->normalizer != NULL) {
+ mdn_normalizer_destroy(ctx->normalizer);
+ ctx->normalizer = NULL;
+ }
+ if (ctx->zld != NULL) {
+ free(ctx->zld);
+ ctx->zld = NULL;
+ }
+ ctx->edns0 = 0;
+}
+
+
+static mdn_result_t
+update_local_converter(mdn_resconf_t ctx) {
+ mdn_result_t r;
+ const char *local_encoding = mdn_localencoding_name();
+
+ if (local_encoding == NULL) {
+ mdn_log_error("cannot determine local codeset name\n");
+ return (mdn_notfound);
+ }
+
+ if (ctx->local_encoding != NULL &&
+ strcmp(ctx->local_encoding, local_encoding) == 0 &&
+ ctx->local_converter != NULL) {
+ return (mdn_success);
+ }
+
+ if (ctx->local_encoding != NULL) {
+ free(ctx->local_encoding);
+ ctx->local_encoding = NULL;
+ }
+ if (ctx->local_converter != NULL) {
+ mdn_converter_destroy(ctx->local_converter);
+ ctx->local_converter = NULL;
+ }
+
+ r = mystrdup(local_encoding, &ctx->local_encoding);
+ if (r != mdn_success)
+ return (r);
+ r = mdn_converter_create(ctx->local_encoding,
+ &ctx->local_converter,
+ MDN_CONVERTER_RTCHECK);
+ return (r);
+}
+
+static mdn_result_t
+mystrdup(const char *from, char **top) {
+ char *s = malloc(strlen(from) + 1);
+
+ if (*top != NULL) {
+ free(*top);
+ *top = NULL;
+ }
+
+ if (s == NULL)
+ return (mdn_nomemory);
+ (void)strcpy(s, from);
+ *top = s;
+ return (mdn_success);
+}
diff --git a/contrib/idn/mdnkit/lib/result.c b/contrib/idn/mdnkit/lib/result.c
new file mode 100644
index 00000000..b3aaefe8
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/result.c
@@ -0,0 +1,88 @@
+#ifndef lint
+static char *rcsid = "$Id: result.c,v 1.1 2000/12/07 00:52:25 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+#include <mdn/result.h>
+
+static char *result_string[] = {
+ "success",
+ "not found",
+ "invalid encoding found",
+ "syntax error",
+ "invalid name",
+ "invalid message",
+ "buffer overflow",
+ "no such entry",
+ "out of memory",
+ "no such file",
+ "no mapping to output codeset",
+ "context information required",
+ "generic failure",
+};
+
+char *
+mdn_result_tostring(mdn_result_t result) {
+ if (result < 0 || result > mdn_failure)
+ return ("unknown result code");
+
+ return (result_string[result]);
+}
diff --git a/contrib/idn/mdnkit/lib/selectiveencode.c b/contrib/idn/mdnkit/lib/selectiveencode.c
new file mode 100644
index 00000000..ffbd620b
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/selectiveencode.c
@@ -0,0 +1,140 @@
+#ifndef lint
+static char *rcsid = "$Id: selectiveencode.c,v 1.1 2000/12/07 00:52:25 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/result.h>
+#include <mdn/utf8.h>
+#include <mdn/debug.h>
+
+static int is_domain_delimiter(char c);
+static char *find_nonascii(const char *s);
+
+mdn_result_t
+mdn_selectiveencode_findregion(const char *s,
+ char **startp, char **endp)
+{
+ char *non_ascii;
+ char *start, *end;
+
+ assert(s != NULL && startp != NULL && endp != NULL);
+
+ TRACE(("mdn_selectiveencode_findregion(s=\"%s\")\n",
+ mdn_debug_xstring(s, 20)));
+
+ /*
+ * Scan the specified string looking for non-ascii character.
+ */
+ if ((non_ascii = find_nonascii(s)) == NULL)
+ return (mdn_notfound);
+
+ /*
+ * Non-ascii character found.
+ * Determine the region to encode.
+ */
+
+ /*
+ * First, we scan backwards to find the beginning of the region
+ * that should be converted.
+ */
+ start = non_ascii;
+ while (start > s) {
+ char *prev = mdn_utf8_findfirstbyte(start - 1, s);
+ if (is_domain_delimiter(*prev))
+ break; /* Found */
+ start = prev;
+ }
+ *startp = start;
+
+ /*
+ * Next we scan forwards looking for the end of the region.
+ */
+ end = non_ascii + mdn_utf8_mblen(non_ascii);
+ while (!is_domain_delimiter(*end))
+ end += mdn_utf8_mblen(end);
+ *endp = end;
+
+ return (mdn_success);
+}
+
+static int
+is_domain_delimiter(char c) {
+ return ((unsigned char)c < 0x80 &&
+ !('A' <= c && c <= 'Z') &&
+ !('a' <= c && c <= 'z') &&
+ !('0' <= c && c <= '9') &&
+ c != '-' && c != '.');
+}
+
+static char *
+find_nonascii(const char *s) {
+ while (*s != '\0' && (unsigned char)*s < 0x80)
+ s++;
+ if (*s == '\0')
+ return (NULL);
+ else
+ return ((char *)s);
+}
diff --git a/contrib/idn/mdnkit/lib/strhash.c b/contrib/idn/mdnkit/lib/strhash.c
new file mode 100644
index 00000000..72304c93
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/strhash.c
@@ -0,0 +1,299 @@
+#ifndef lint
+static char *rcsid = "$Id: strhash.c,v 1.1 2000/12/07 00:52:26 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/result.h>
+#include <mdn/strhash.h>
+
+/*
+ * Initially, the number of hash buckets is INITIAL_HASH_SIZE.
+ * As the more elements are put in the hash, the number of elements
+ * per bucket will exceed THRESHOLD eventually. When it happens,
+ * the number of buckets will be multiplied by FACTOR.
+ */
+#define INITIAL_HASH_SIZE 67
+#define FACTOR 7
+#define THRESHOLD 5
+
+#define HASH_MULT 31
+
+typedef struct strhash_entry {
+ struct strhash_entry *next;
+ unsigned long hash_value;
+ char *key;
+ void *value;
+} strhash_entry_t;
+
+struct mdn_strhash {
+ int nbins;
+ int nelements;
+ strhash_entry_t **bins;
+};
+
+static unsigned long hash_value(const char *key);
+static strhash_entry_t *find_entry(strhash_entry_t *entry, const char *key,
+ unsigned long hash);
+static strhash_entry_t *new_entry(const char *key, void *value);
+static mdn_result_t expand_bins(mdn_strhash_t hash, int new_size);
+
+mdn_result_t
+mdn_strhash_create(mdn_strhash_t *hashp) {
+ mdn_strhash_t hash;
+ mdn_result_t r;
+
+ TRACE(("mdn_strhash_create()\n"));
+
+ assert(hashp != NULL);
+
+ *hashp = NULL;
+
+ if ((hash = malloc(sizeof(struct mdn_strhash))) == NULL) {
+ WARNING(("mdn_strhash_create: malloc failed (hash)\n"));
+ return (mdn_nomemory);
+ }
+ hash->nbins = 0;
+ hash->nelements = 0;
+ hash->bins = NULL;
+ if ((r = expand_bins(hash, INITIAL_HASH_SIZE)) != mdn_success) {
+ WARNING(("mdn_strhash_create: malloc failed (bins)\n"));
+ free(hash);
+ return (r);
+ }
+
+ *hashp = hash;
+
+ return (mdn_success);
+}
+
+void
+mdn_strhash_destroy(mdn_strhash_t hash, mdn_strhash_freeproc_t proc) {
+ int i;
+
+ assert(hash != NULL && hash->bins != NULL);
+
+ for (i = 0; i < hash->nbins; i++) {
+ strhash_entry_t *bin = hash->bins[i];
+ strhash_entry_t *next;
+
+ while (bin != NULL) {
+ next = bin->next;
+ if (proc != NULL)
+ (*proc)(bin->value);
+ free(bin);
+ bin = next;
+ }
+ }
+ free(hash->bins);
+ free(hash);
+}
+
+mdn_result_t
+mdn_strhash_put(mdn_strhash_t hash, const char *key, void *value) {
+ unsigned long h, h_index;
+ strhash_entry_t *entry;
+
+ assert(hash != NULL && key != NULL);
+
+ h = hash_value(key);
+ h_index = h % hash->nbins;
+
+ if ((entry = find_entry(hash->bins[h_index], key, h)) != NULL) {
+ /* Entry exists. Replace the value. */
+ entry->value = value;
+ } else {
+ /* Create new entry. */
+ if ((entry = new_entry(key, value)) == NULL) {
+ return (mdn_nomemory);
+ }
+ /* Insert it to the list. */
+ entry->next = hash->bins[h_index];
+ hash->bins[h_index] = entry;
+ hash->nelements++;
+
+ if (hash->nelements > hash->nbins * THRESHOLD) {
+ mdn_result_t r;
+ r = expand_bins(hash, hash->nbins * FACTOR);
+ if (r != mdn_success) {
+ TRACE(("mdn_strhash_put: hash table "
+ "expansion failed\n"));
+ }
+ }
+ }
+
+ return (mdn_success);
+}
+
+mdn_result_t
+mdn_strhash_get(mdn_strhash_t hash, const char *key, void **valuep) {
+ unsigned long h;
+ strhash_entry_t *entry;
+
+ assert(hash != NULL && key != NULL && valuep != NULL);
+
+ h = hash_value(key);
+ entry = find_entry(hash->bins[h % hash->nbins], key, h);
+ if (entry == NULL)
+ return (mdn_noentry);
+
+ *valuep = entry->value;
+ return (mdn_success);
+}
+
+int
+mdn_strhash_exists(mdn_strhash_t hash, const char *key) {
+ unsigned long h;
+
+ assert(hash != NULL && key != NULL);
+
+ h = hash_value(key);
+ return (find_entry(hash->bins[h % hash->nbins], key, h) != NULL);
+}
+
+static unsigned long
+hash_value(const char *key) {
+ unsigned long h = 0;
+ unsigned char *p = (unsigned char *)key;
+ int c;
+
+ while ((c = *p++) != '\0') {
+ h = h * HASH_MULT + c;
+ }
+ return (h);
+}
+
+static strhash_entry_t *
+find_entry(strhash_entry_t *entry, const char *key, unsigned long hash) {
+ assert(key != NULL);
+
+ while (entry != NULL) {
+ if (entry->hash_value == hash && strcmp(key, entry->key) == 0)
+ return (entry);
+ entry = entry->next;
+ }
+ return (NULL);
+}
+
+static strhash_entry_t *
+new_entry(const char *key, void *value) {
+ strhash_entry_t *entry;
+ int len;
+
+ assert(key != NULL);
+
+ len = strlen(key) + 1;
+ if ((entry = malloc(sizeof(strhash_entry_t) + len)) == NULL) {
+ return (NULL);
+ }
+ entry->next = NULL;
+ entry->hash_value = hash_value(key);
+ entry->key = (char *)(entry + 1);
+ (void)strcpy(entry->key, key);
+ entry->value = value;
+
+ return (entry);
+}
+
+static mdn_result_t
+expand_bins(mdn_strhash_t hash, int new_size) {
+ strhash_entry_t **old_bins, **new_bins;
+ int old_size;
+ int old_index, new_index;
+
+ new_bins = malloc(sizeof(strhash_entry_t *) * new_size);
+ if (new_bins == NULL)
+ return (mdn_nomemory);
+
+ memset(new_bins, 0, sizeof(strhash_entry_t *) * new_size);
+
+ old_bins = hash->bins;
+ old_size = hash->nbins;
+ for (old_index = 0; old_index < old_size; old_index++) {
+ strhash_entry_t *entries = old_bins[old_index];
+
+ while (entries != NULL) {
+ strhash_entry_t *e = entries;
+
+ /* Remove the top element from the linked list. */
+ entries = entries->next;
+
+ /* ..and move to the new hash. */
+ new_index = e->hash_value % new_size;
+ e->next = new_bins[new_index];
+ new_bins[new_index] = e;
+ }
+ }
+
+ hash->nbins = new_size;
+ hash->bins = new_bins;
+
+ if (old_bins != NULL)
+ free(old_bins);
+
+ return (mdn_success);
+}
diff --git a/contrib/idn/mdnkit/lib/translator.c b/contrib/idn/mdnkit/lib/translator.c
new file mode 100644
index 00000000..fc78bf48
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/translator.c
@@ -0,0 +1,376 @@
+#ifndef lint
+static char *rcsid = "$Id: translator.c,v 1.1 2000/12/07 00:52:26 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <mdn/result.h>
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/converter.h>
+#include <mdn/normalizer.h>
+#include <mdn/translator.h>
+#include <mdn/debug.h>
+
+static int numdots(const char *s);
+static int contain_invalid_char(const char *s);
+static mdn_result_t append_zld(char *s, size_t len, const char *zld);
+
+mdn_result_t
+mdn_translator_translate(mdn_converter_t local_converter,
+ mdn_converter_t local_alternate_converter,
+ const char *local_zld,
+ mdn_normalizer_t normalizer,
+ mdn_converter_t target_converter,
+ mdn_converter_t target_alternate_converter,
+ const char *target_zld,
+ const char *from, char *to, size_t tolen)
+{
+ mdn_result_t r;
+ size_t fromlen;
+ int process;
+ char domainbuf1[512], domainbuf2[512]; /* enough */
+
+ assert(local_converter != NULL && target_converter != NULL &&
+ from != NULL && to != NULL && tolen >= 0);
+
+ TRACE(("mdn_translator_translate(local_encoding=%s,local_zld=%s,"
+ "target_encoding=%s,target_zld=%s,from=\"%s\")\n",
+ mdn_converter_localencoding(local_converter),
+ local_zld == NULL ? "(none)" : local_zld,
+ mdn_converter_localencoding(target_converter),
+ target_zld == NULL ? "(none)" : target_zld,
+ mdn_debug_xstring(from, 30)));
+
+ fromlen = strlen(from);
+ if (fromlen + 1 > sizeof(domainbuf1)) {
+ WARNING(("mdn_translator_translate: "
+ "given domainname too long\n"));
+ return (mdn_invalid_name);
+ }
+
+ (void)strcpy(domainbuf1, from);
+
+ DUMP(("mdn_translator_translate: before translation \"%s\"\n",
+ mdn_debug_xstring(domainbuf1, 200)));
+
+#define PROCESS_LOCAL 1
+#define PROCESS_LOCALALT 2
+#define PROCESS_DONE 4
+
+ process = 0;
+
+ if (local_zld != NULL) {
+ /*
+ * Check if the domain name matches the local ZLD.
+ * If it does, strip ZLD and continue translation.
+ * Otherwise, no further processing is needed.
+ */
+ if (mdn_translator_matchzld(domainbuf1, local_zld)) {
+ /* Remove ZLD. */
+ domainbuf1[fromlen - strlen(local_zld)] = '\0';
+ process |= PROCESS_LOCAL;
+ if (local_alternate_converter != NULL &&
+ !contain_invalid_char(domainbuf1))
+ process |= PROCESS_LOCALALT;
+ }
+ } else if (contain_invalid_char(domainbuf1)) {
+ /*
+ * The name contains invalid characters (as a legal
+ * traditional domain name). So there's no point in
+ * trying local-alt codeset.
+ */
+ process |= PROCESS_LOCAL;
+ } else {
+ /*
+ * The given name is a valid ASCII domain name.
+ */
+ if (mdn_converter_isasciicompatible(local_converter))
+ process |= PROCESS_LOCAL;
+ if (local_alternate_converter != NULL)
+ process |= PROCESS_LOCALALT;
+ }
+
+ if ((process & PROCESS_LOCALALT) != 0) {
+ /*
+ * First, try converting from the alternate encoding to UTF-8.
+ */
+ TRACE(("mdn_translator_translate: %s to UTF-8\n",
+ mdn_converter_localencoding(
+ local_alternate_converter)));
+ r = mdn_converter_convert(local_alternate_converter,
+ mdn_converter_l2u,
+ domainbuf1, domainbuf2,
+ sizeof(domainbuf2));
+ if (r == mdn_success)
+ process |= PROCESS_DONE;
+ else if (r != mdn_invalid_encoding)
+ return (r);
+ }
+ if ((process & PROCESS_DONE) == 0 && (process & PROCESS_LOCAL) != 0) {
+ /*
+ * Convert from local encoding to UTF-8.
+ */
+ TRACE(("mdn_translator_translate: %s to UTF-8\n",
+ mdn_converter_localencoding(local_converter)));
+ r = mdn_converter_convert(local_converter,
+ mdn_converter_l2u,
+ domainbuf1, domainbuf2,
+ sizeof(domainbuf2));
+ if (r == mdn_success)
+ process |= PROCESS_DONE;
+ else if (r != mdn_invalid_encoding)
+ return (r);
+ }
+ if ((process & PROCESS_DONE) == 0) {
+ /*
+ * Not converted. Copy verbatim.
+ */
+ TRACE(("mdn_translator_translate: no translation required\n"));
+ if (tolen < fromlen + 1)
+ return (mdn_buffer_overflow);
+ (void)memcpy(to, from, fromlen + 1);
+ return (mdn_success);
+ }
+#undef PROCESS_LOCAL
+#undef PROCESS_LOCALALT
+#undef PROCESS_DONE
+
+ DUMP(("mdn_translator_translate: UTF-8 string \"%s\"\n",
+ mdn_debug_xstring(domainbuf2, 200)));
+
+ /*
+ * Normalize, if normalizer is specified.
+ */
+ if (normalizer != NULL) {
+ r = mdn_normalizer_normalize(normalizer,
+ domainbuf2, domainbuf1,
+ sizeof(domainbuf1));
+ if (r != mdn_success)
+ return (r);
+
+ DUMP(("mdn_translator_translate: after normalization \"%s\"\n",
+ mdn_debug_xstring(domainbuf1, 200)));
+
+ if (numdots(domainbuf2) != numdots(domainbuf1)) {
+ INFO(("mdn_translator_translate: "
+ "number of labels has been changed by "
+ "normalization\n"));
+ }
+ }
+
+ /*
+ * Convert from UTF-8 to target encoding.
+ */
+ TRACE(("mdn_translator_translate: UTF-8 to %s\n",
+ mdn_converter_localencoding(target_converter)));
+ r = mdn_converter_convert(target_converter,
+ mdn_converter_u2l,
+ normalizer == NULL ?
+ domainbuf2 : domainbuf1,
+ to, tolen);
+ if (r == mdn_nomapping && target_alternate_converter != NULL) {
+ TRACE(("mdn_translator_translate: use alternate encoding\n"));
+ r = mdn_converter_convert(target_alternate_converter,
+ mdn_converter_u2l,
+ normalizer == NULL ?
+ domainbuf2 : domainbuf1,
+ to, tolen);
+ }
+ if (r != mdn_success)
+ return (r);
+
+ /*
+ * Append ZLD, if any.
+ */
+ if (target_zld != NULL)
+ r = append_zld(to, tolen, target_zld);
+
+ DUMP(("mdn_translator_translate: after translation \"%s\"\n",
+ mdn_debug_xstring(to, 200)));
+
+ return (r);
+}
+
+int
+mdn_translator_matchzld(const char *domain, const char *zld) {
+ int dlen;
+ int zlen;
+ const char *p;
+ int i;
+
+ /* An empty ZLD can match everything. */
+ if (zld == NULL)
+ return (1);
+
+ dlen = strlen(domain);
+ zlen = strlen(zld);
+
+ /*
+ * Since ZLD is canonicalized, it must end with dot.
+ * DOMAIN may or may not end with dot.
+ */
+ if (dlen > 0 && domain[dlen - 1] != '.')
+ zlen--;
+
+ /* If ZLD is longer than domain, no way. */
+ if (zlen > dlen)
+ return (0);
+
+ p = domain + dlen - zlen;
+ for (i = 0; p[i] != '\0'; i++) {
+ /* ZLD is canonicalized (i.e. uppercase letters) */
+ if (p[i] == zld[i] ||
+ ('a' <= p[i] && p[i] <= 'z' && p[i] - 'a' + 'A' == zld[i]))
+ continue;
+ else
+ return (0);
+ }
+
+ if (p > domain && p[-1] != '.')
+ return (0);
+
+ return (1);
+}
+
+/*
+ * Canonicalize ZLD.
+ * -- empty ZLD are nullified.
+ * -- leading dot is removed.
+ * -- append dot if it does not end with dot.
+ * -- lowercase characters are converted to uppercase.
+ */
+mdn_result_t
+mdn_translator_canonicalzld(const char *zld, char **canonicalizedp) {
+ size_t len;
+ int append_dot = 0;
+ char *canonicalized, *p;
+ int c;
+
+ /* Remove leading '.' */
+ if (zld != NULL && zld[0] == '.')
+ zld++;
+
+ /* Is it empty? */
+ if (zld == NULL || strcmp(zld, "") == 0) {
+ *canonicalizedp = NULL;
+ return (mdn_success);
+ }
+
+ len = strlen(zld);
+ if (zld[len - 1] != '.')
+ append_dot = 1;
+
+ if ((canonicalized = malloc(len + 1 + append_dot)) == NULL)
+ return (mdn_nomemory);
+ *canonicalizedp = canonicalized;
+
+ for (p = canonicalized; (c = *zld) != '\0'; zld++, p++) {
+ if ('a' <= c && c <= 'z')
+ c += 'A' - 'a';
+ *p = c;
+ }
+ if (append_dot)
+ *p++ = '.';
+ *p = '\0';
+
+ return (mdn_success);
+}
+
+static int
+numdots(const char *s) {
+ int n = 0;
+
+ while ((s = strchr(s, '.')) != NULL) {
+ n++;
+ s++;
+ }
+ return (n);
+}
+
+static int
+contain_invalid_char(const char *s) {
+ int c;
+
+ while ((c = *s++) != '\0') {
+ if (('a' <= c && c <= 'z') ||
+ ('A' <= c && c <= 'Z') ||
+ ('0' <= c && c <= '9') ||
+ c == '.' || c == '-')
+ continue; /* valid character */
+ return (1);
+ }
+ return (0);
+}
+
+static mdn_result_t
+append_zld(char *s, size_t len, const char *zld) {
+ size_t slen = strlen(s);
+
+ if (slen + strlen(zld) + 1 > len)
+ return (mdn_buffer_overflow);
+ (void)strcpy(s + slen, zld);
+ return (mdn_success);
+}
diff --git a/contrib/idn/mdnkit/lib/unicode.c b/contrib/idn/mdnkit/lib/unicode.c
new file mode 100644
index 00000000..fb849cd6
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/unicode.c
@@ -0,0 +1,625 @@
+#ifndef lint
+static char *rcsid = "$Id: unicode.c,v 1.1 2000/12/07 00:52:26 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#ifdef DEBUG_HASHSTAT
+#include <stdio.h>
+#endif
+
+#include <mdn/result.h>
+#include <mdn/logmacro.h>
+#include <mdn/assert.h>
+#include <mdn/unicode.h>
+
+#ifndef CANON_CLASS_NBUCKETS
+#define CANON_CLASS_NBUCKETS 121
+#endif
+#ifndef COMPOSITION_NBUCKETS
+#define COMPOSITION_NBUCKETS 332
+#endif
+#ifndef DECOMPOSITION_NBUCKETS
+#define DECOMPOSITION_NBUCKETS 731
+#endif
+#ifndef CASEMAP_NBUCKETS
+#define CASEMAP_NBUCKETS 269
+#endif
+
+/*
+ * Some constants for Hangul decomposition/composition.
+ */
+#define SBase 0xac00
+#define LBase 0x1100
+#define VBase 0x1161
+#define TBase 0x11a7
+#define LCount 19
+#define VCount 21
+#define TCount 28
+#define SLast (SBase + LCount * VCount * TCount)
+
+typedef unsigned short unicode_t; /* 16bit unsigned integer is suffice */
+
+struct canon_class {
+ unicode_t c;
+ unsigned short class;
+ struct canon_class *next;
+};
+
+struct composition {
+ unicode_t c1;
+ unicode_t c2;
+ unicode_t composed;
+ struct composition *next;
+};
+
+struct decomposition {
+ unicode_t c;
+ unsigned short offset;
+ unsigned short length;
+ struct decomposition *next;
+};
+
+struct casemap {
+ unicode_t c;
+ unicode_t map;
+ unsigned short flags;
+ unsigned short length;
+ struct casemap *next;
+};
+
+#include "unicodedata.c"
+
+/*
+ * Hash tables.
+ */
+
+static struct canon_class *canon_class_hash[CANON_CLASS_NBUCKETS];
+static struct composition *composition_hash[COMPOSITION_NBUCKETS];
+static struct decomposition *canon_decomposition_hash[DECOMPOSITION_NBUCKETS];
+static struct decomposition *compat_decomposition_hash[DECOMPOSITION_NBUCKETS];
+static struct casemap *toupper_hash[CASEMAP_NBUCKETS];
+static struct casemap *tolower_hash[CASEMAP_NBUCKETS];
+
+static int initialized = 0;
+
+static mdn_result_t casemap(unsigned long c, mdn__unicode_context_t ctx,
+ unsigned long *v, size_t vlen, int *convlenp,
+ unsigned long *bitmap, struct casemap **hash);
+static int canon_class_hashval(unicode_t c);
+static int composition_hashval(unicode_t c1, unicode_t c2);
+static int decomposition_hashval(unicode_t c);
+static int casemap_hashval(unicode_t c);
+static void initialize(void);
+
+
+#define CHECKBIT(v, bitmap, shift) \
+ (((bitmap)[((v)>>(shift)) / 32] & (1 << (((v)>>(shift)) & 31))) != 0)
+
+int
+mdn__unicode_canonicalclass(unsigned long c) {
+ struct canon_class *hp;
+
+#if 0
+ TRACE(("mdn__unicode_canonicalclass(c=%lx)\n", c));
+#endif
+
+ initialize();
+
+ if (c > 0xffff)
+ return (0);
+
+ if (!CHECKBIT(c, canon_class_bitmap, CANON_CLASS_BM_SHIFT))
+ return (0);
+
+ hp = canon_class_hash[canon_class_hashval((unicode_t)c)];
+ while (hp != NULL) {
+ if (hp->c == c)
+ return (hp->class);
+ hp = hp->next;
+ }
+ return 0;
+}
+
+mdn_result_t
+mdn__unicode_decompose(int compat, unsigned long *v, size_t vlen,
+ unsigned long c, int *decomp_lenp)
+{
+ unsigned long *vorg = v;
+ int h;
+ struct decomposition *hp;
+ unicode_t *base;
+ int i;
+
+ assert(v != NULL && vlen >= 0 && decomp_lenp != NULL);
+
+#if 0
+ TRACE(("mdn__unicode_decompose(compat=%d,vlen=%d,c=%lx)\n",
+ compat, vlen, c));
+#endif
+
+ initialize();
+
+ /*
+ * First, check for Hangul.
+ */
+ if (SBase <= c && c < SLast) {
+ int idx, t_offset, v_offset, l_offset;
+
+ idx = c - SBase;
+ t_offset = idx % TCount;
+ idx /= TCount;
+ v_offset = idx % VCount;
+ l_offset = idx / VCount;
+ if ((t_offset == 0 && vlen < 2) || (t_offset > 0 && vlen < 3))
+ return (mdn_buffer_overflow);
+ *v++ = LBase + l_offset;
+ *v++ = VBase + v_offset;
+ if (t_offset > 0)
+ *v++ = TBase + t_offset;
+ *decomp_lenp = v - vorg;
+ return (mdn_success);
+ }
+
+ /*
+ * Check bitmap.
+ */
+ if (c > 0xffff ||
+ (compat &&
+ !CHECKBIT(c, compat_decompose_bitmap, DECOMPOSE_BM_SHIFT)) ||
+ (!compat &&
+ !CHECKBIT(c, canon_decompose_bitmap, DECOMPOSE_BM_SHIFT)))
+ return (mdn_notfound);
+
+ /*
+ * Now, C is a decomposition candidate.
+ * Search the hash tables.
+ */
+ h = decomposition_hashval((unicode_t)c);
+
+ /*
+ * First, look for canonical decomposition.
+ */
+ base = canon_decompose_data;
+ hp = canon_decomposition_hash[h];
+ while (hp != NULL) {
+ if (hp->c == c)
+ goto found;
+ hp = hp->next;
+ }
+
+ if (!compat)
+ return (mdn_notfound);
+
+ /*
+ * Then, compatibility decomposition.
+ */
+ base = compat_decompose_data;
+ hp = compat_decomposition_hash[h];
+ while (hp != NULL) {
+ if (hp->c == c)
+ goto found;
+ hp = hp->next;
+ }
+
+ return (mdn_notfound);
+
+found:
+ /* Do we have enough space? */
+ if (vlen < hp->length)
+ return (mdn_buffer_overflow);
+
+ base += hp->offset;
+ for (i = 0; i < hp->length; i++) {
+ mdn_result_t r;
+ int len;
+
+ /* Decompose recursively. */
+ r = mdn__unicode_decompose(compat, v, vlen, base[i], &len);
+
+ if (r == mdn_success) {
+ v += len;
+ vlen -= len;
+ } else {
+ *v++ = base[i];
+ vlen--;
+ }
+ }
+ *decomp_lenp = v - vorg;
+
+ return (mdn_success);
+}
+
+int
+mdn__unicode_iscompositecandidate(unsigned long c) {
+#if 0
+ TRACE(("mdn__unicode_iscompositecandidate(c=%lx)\n", c));
+#endif
+ return (c <= 0xffff &&
+ ((LBase <= c && c < LBase + LCount) ||
+ (SBase <= c && c < SLast) ||
+ CHECKBIT(c, compose_bitmap, COMPOSE_BM_SHIFT)));
+}
+
+mdn_result_t
+mdn__unicode_compose(unsigned long c1, unsigned long c2, unsigned long *compp)
+{
+ struct composition *hp;
+
+ assert(compp != NULL);
+
+#if 0
+ TRACE(("mdn__unicode_compose(c1=%lx,c2=%lx)\n", c1, c2));
+#endif
+
+ initialize();
+
+ /*
+ * Check for Hangul.
+ */
+ if (LBase <= c1 && c1 < LBase + LCount &&
+ VBase <= c2 && c2 < VBase + VCount) {
+ /*
+ * Hangul L and V.
+ */
+ *compp = SBase +
+ ((c1 - LBase) * VCount + (c2 - VBase)) * TCount;
+ return (mdn_success);
+ } else if (SBase <= c1 && c1 < SLast &&
+ TBase <= c2 && c2 < TBase + TCount &&
+ (c1 - SBase) % TCount == 0) {
+ /*
+ * Hangul LV and T.
+ */
+ *compp = c1 + (c2 - TBase);
+ return (mdn_success);
+ }
+
+ /*
+ * Check bitmap.
+ */
+ if (c1 > 0xffff || c2 > 0xffff ||
+ !CHECKBIT(c1, compose_bitmap, COMPOSE_BM_SHIFT))
+ return (mdn_notfound);
+
+ /*
+ * Composition candidate. Search the hash table.
+ */
+ hp = composition_hash[composition_hashval((unicode_t)c1,
+ (unicode_t)c2)];
+ while (hp != NULL) {
+ if (hp->c1 == c1 && hp->c2 == c2) {
+ *compp = hp->composed;
+ return (mdn_success);
+ }
+ hp = hp->next;
+ }
+ return (mdn_notfound);
+}
+
+mdn_result_t
+mdn__unicode_toupper(unsigned long c, mdn__unicode_context_t ctx,
+ unsigned long *v, size_t vlen, int *convlenp)
+{
+#if 0
+ TRACE(("mdn__unicode_toupper(c=%lx)\n", c));
+#endif
+ initialize();
+ return (casemap(c, ctx, v, vlen, convlenp,
+ toupper_bitmap, toupper_hash));
+}
+
+mdn_result_t
+mdn__unicode_tolower(unsigned long c, mdn__unicode_context_t ctx,
+ unsigned long *v, size_t vlen, int *convlenp)
+{
+#if 0
+ TRACE(("mdn__unicode_tolower(c=%lx)\n", c));
+#endif
+ initialize();
+ return (casemap(c, ctx, v, vlen, convlenp,
+ tolower_bitmap, tolower_hash));
+}
+
+static mdn_result_t
+casemap(unsigned long c, mdn__unicode_context_t ctx,
+ unsigned long *v, size_t vlen, int *convlenp,
+ unsigned long *bitmap, struct casemap **hash)
+{
+ struct casemap *hp;
+
+ if (vlen < 1)
+ return (mdn_buffer_overflow);
+
+ if (c > 0xffff)
+ goto one_to_one;
+
+ if (!CHECKBIT(c, bitmap, CASEMAP_BM_SHIFT))
+ goto one_to_one;
+
+ hp = hash[casemap_hashval((unicode_t)c)];
+ while (hp != NULL) {
+ if (hp->c == c) {
+ if ((hp->flags & CMF_CTXDEP) == 0) {
+ found:
+ if (hp->flags & CMF_MULTICHAR) {
+ int len = hp->length;
+ unicode_t *up;
+
+ if (vlen < hp->length)
+ return (mdn_buffer_overflow);
+ up = multichar_casemap_data +
+ (unsigned int)hp->map;
+ *convlenp = len;
+ while (len-- > 0)
+ *v++ = (unsigned long)*up++;
+ return (mdn_success);
+ } else {
+ c = hp->map;
+ goto one_to_one;
+ }
+ } else if (ctx == mdn__unicode_context_unknown) {
+ return (mdn_context_required);
+ } else if (((hp->flags & CMF_FINAL) &&
+ ctx == mdn__unicode_context_final) ||
+ ((hp->flags & CMF_NONFINAL) &&
+ ctx == mdn__unicode_context_nonfinal)) {
+ goto found;
+ }
+ }
+ hp = hp->next;
+ }
+
+ one_to_one:
+ *convlenp = 1;
+ *v = c;
+ return (mdn_success);
+}
+
+mdn__unicode_context_t
+mdn__unicode_getcontext(unsigned long c) {
+ int idx;
+ int offset;
+ unsigned long *bm;
+ int v;
+
+#if 0
+ TRACE(("mdn__unicode_getcontext(c=%lx)\n", c));
+#endif
+
+ if (c > 0xffff) {
+ return (mdn__unicode_context_final);
+ }
+ idx = c / CTX_BLOCK_SZ;
+ offset = c % CTX_BLOCK_SZ;
+ if ((bm = casemap_ctx_sections[idx]) == NULL) {
+ return (mdn__unicode_context_final);
+ }
+ v = (bm[(offset * 2) / 32] >> ((offset * 2) % 32)) & 3;
+ if (v & CTX_NSM)
+ return (mdn__unicode_context_unknown);
+ else if (v & CTX_CASED)
+ return (mdn__unicode_context_nonfinal);
+ else
+ return (mdn__unicode_context_final);
+}
+
+static int
+canon_class_hashval(unicode_t c) {
+ return c % CANON_CLASS_NBUCKETS;
+}
+
+static int
+composition_hashval(unicode_t c1, unicode_t c2) {
+ return (c1 * 11 + c2) % COMPOSITION_NBUCKETS;
+}
+
+static int
+decomposition_hashval(unicode_t c) {
+ return c % DECOMPOSITION_NBUCKETS;
+}
+
+static int
+casemap_hashval(unicode_t c) {
+ return c % CASEMAP_NBUCKETS;
+}
+
+static void
+initialize(void) {
+ int i;
+
+ if (initialized)
+ return;
+
+#define ARRAYSIZE(var) (sizeof(var) / sizeof((var)[0]))
+#define INSERT(tbl, h, what) \
+ (what).next = (tbl)[h]; \
+ (tbl)[h] = &(what)
+
+ for (i = 0; i < ARRAYSIZE(canon_class); i++) {
+ int h = canon_class_hashval(canon_class[i].c);
+ INSERT(canon_class_hash, h, canon_class[i]);
+ }
+ for (i = 0; i < ARRAYSIZE(compose_seq); i++) {
+ int h = composition_hashval(compose_seq[i].c1,
+ compose_seq[i].c2);
+ INSERT(composition_hash, h, compose_seq[i]);
+ }
+ for (i = 0; i < ARRAYSIZE(canon_decompose_seq); i++) {
+ int h = decomposition_hashval(canon_decompose_seq[i].c);
+ INSERT(canon_decomposition_hash, h, canon_decompose_seq[i]);
+ }
+ for (i = 0; i < ARRAYSIZE(compat_decompose_seq); i++) {
+ int h = decomposition_hashval(compat_decompose_seq[i].c);
+ INSERT(compat_decomposition_hash, h, compat_decompose_seq[i]);
+ }
+ for (i = 0; i < ARRAYSIZE(toupper_map); i++) {
+ int h = casemap_hashval(toupper_map[i].c);
+ INSERT(toupper_hash, h, toupper_map[i]);
+ }
+ for (i = 0; i < ARRAYSIZE(tolower_map); i++) {
+ int h = casemap_hashval(tolower_map[i].c);
+ INSERT(tolower_hash, h, tolower_map[i]);
+ }
+#undef ARRAYSIZE
+#undef INSERT
+
+ initialized = 1;
+}
+
+#ifdef DEBUG_HASHSTAT
+
+#define DEFINE_GETLENGTH(name, type) \
+static int \
+name(type p) { \
+ int len = 0; \
+ while (p != NULL) { \
+ len++; \
+ p = p->next; \
+ } \
+ return (len); \
+}
+
+DEFINE_GETLENGTH(getlength_canon_class, struct canon_class *)
+DEFINE_GETLENGTH(getlength_composition, struct composition *)
+DEFINE_GETLENGTH(getlength_decomposition, struct decomposition *)
+DEFINE_GETLENGTH(getlength_casemap, struct casemap *)
+
+static void
+print_hash_stat(void) {
+ int i;
+ int len;
+ int total, max;
+
+#define LENGTH(n) total += (n); if ((n) > max) {max = (n);}
+#define PRINT(nb) \
+ printf("\n nbuckets=%d, total=%d, max=%d (avr=%f)\n", \
+ nb, total, max, (double)total / nb)
+
+#if 1
+ printf("canon_class hash:\n ");
+ for (i = total = max = 0; i < CANON_CLASS_NBUCKETS; i++) {
+ len = getlength_canon_class(canon_class_hash[i]);
+ LENGTH(len);
+ printf("%d ", len);
+ }
+ PRINT(CANON_CLASS_NBUCKETS);
+#endif
+
+#if 1
+ printf("composition hash:\n ");
+ for (i = total = max = 0; i < COMPOSITION_NBUCKETS; i++) {
+ len = getlength_composition(composition_hash[i]);
+ LENGTH(len);
+ printf("%d ", len);
+ }
+ PRINT(COMPOSITION_NBUCKETS);
+#endif
+
+#if 1
+ printf("canonical decomposition hash:\n ");
+ for (i = total = max = 0; i < DECOMPOSITION_NBUCKETS; i++) {
+ len = getlength_decomposition(canon_decomposition_hash[i]);
+ LENGTH(len);
+ printf("%d ", len);
+ }
+ PRINT(DECOMPOSITION_NBUCKETS);
+#endif
+
+#if 1
+ printf("compatibility decomposition hash:\n ");
+ for (i = total = max = 0; i < DECOMPOSITION_NBUCKETS; i++) {
+ len = getlength_decomposition(compat_decomposition_hash[i]);
+ LENGTH(len);
+ printf("%d ", len);
+ }
+ PRINT(DECOMPOSITION_NBUCKETS);
+#endif
+
+#if 1
+ printf("toupper hash:\n ");
+ for (i = total = max = 0; i < CASEMAP_NBUCKETS; i++) {
+ len = getlength_casemap(toupper_hash[i]);
+ LENGTH(len);
+ printf("%d ", len);
+ }
+ PRINT(CASEMAP_NBUCKETS);
+#endif
+
+#if 1
+ printf("tolower hash:\n ");
+ for (i = total = max = 0; i < CASEMAP_NBUCKETS; i++) {
+ len = getlength_casemap(tolower_hash[i]);
+ LENGTH(len);
+ printf("%d ", len);
+ }
+ PRINT(CASEMAP_NBUCKETS);
+#endif
+}
+
+int
+main(int ac, char **av) {
+ initialize();
+ print_hash_stat();
+}
+#endif /* DEBUG_HASHSTAT */
diff --git a/contrib/idn/mdnkit/lib/unicodedata.c b/contrib/idn/mdnkit/lib/unicodedata.c
new file mode 100644
index 00000000..de519450
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/unicodedata.c
@@ -0,0 +1,3209 @@
+/* $Id: unicodedata.c,v 1.1 2000/12/07 00:52:26 tale Exp $ */
+/* $-Id: generate_normalize_data.pl,v 1.4 2000/09/27 02:55:40 ishisone Exp -$ */
+/*
+ * Do not edit this file!
+ * This file is generated from UnicodeData.txt and
+ * CompositionExclusions-1.txt.
+ *
+ */
+
+
+/*
+ * Canonical Class
+ */
+
+#define CANON_CLASS_BM_SHIFT (16 - 11)
+
+static unsigned long canon_class_bitmap[] = {
+ 0x0f000000, 0x07cc7010, 0x46666600, 0x5b664444,
+ 0x00000002, 0x40000000, 0x00000020, 0x00000000,
+ 0x000000c0, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000012, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x01000000, 0x00020000,
+};
+
+static struct canon_class canon_class[] = {
+ {0x0300, 230}, {0x0301, 230}, {0x0302, 230}, {0x0303, 230},
+ {0x0304, 230}, {0x0305, 230}, {0x0306, 230}, {0x0307, 230},
+ {0x0308, 230}, {0x0309, 230}, {0x030a, 230}, {0x030b, 230},
+ {0x030c, 230}, {0x030d, 230}, {0x030e, 230}, {0x030f, 230},
+ {0x0310, 230}, {0x0311, 230}, {0x0312, 230}, {0x0313, 230},
+ {0x0314, 230}, {0x0315, 232}, {0x0316, 220}, {0x0317, 220},
+ {0x0318, 220}, {0x0319, 220}, {0x031a, 232}, {0x031b, 216},
+ {0x031c, 220}, {0x031d, 220}, {0x031e, 220}, {0x031f, 220},
+ {0x0320, 220}, {0x0321, 202}, {0x0322, 202}, {0x0323, 220},
+ {0x0324, 220}, {0x0325, 220}, {0x0326, 220}, {0x0327, 202},
+ {0x0328, 202}, {0x0329, 220}, {0x032a, 220}, {0x032b, 220},
+ {0x032c, 220}, {0x032d, 220}, {0x032e, 220}, {0x032f, 220},
+ {0x0330, 220}, {0x0331, 220}, {0x0332, 220}, {0x0333, 220},
+ {0x0334, 1}, {0x0335, 1}, {0x0336, 1}, {0x0337, 1},
+ {0x0338, 1}, {0x0339, 220}, {0x033a, 220}, {0x033b, 220},
+ {0x033c, 220}, {0x033d, 230}, {0x033e, 230}, {0x033f, 230},
+ {0x0340, 230}, {0x0341, 230}, {0x0342, 230}, {0x0343, 230},
+ {0x0344, 230}, {0x0345, 240}, {0x0346, 230}, {0x0347, 220},
+ {0x0348, 220}, {0x0349, 220}, {0x034a, 230}, {0x034b, 230},
+ {0x034c, 230}, {0x034d, 220}, {0x034e, 220}, {0x0360, 234},
+ {0x0361, 234}, {0x0362, 233}, {0x0483, 230}, {0x0484, 230},
+ {0x0485, 230}, {0x0486, 230}, {0x0591, 220}, {0x0592, 230},
+ {0x0593, 230}, {0x0594, 230}, {0x0595, 230}, {0x0596, 220},
+ {0x0597, 230}, {0x0598, 230}, {0x0599, 230}, {0x059a, 222},
+ {0x059b, 220}, {0x059c, 230}, {0x059d, 230}, {0x059e, 230},
+ {0x059f, 230}, {0x05a0, 230}, {0x05a1, 230}, {0x05a3, 220},
+ {0x05a4, 220}, {0x05a5, 220}, {0x05a6, 220}, {0x05a7, 220},
+ {0x05a8, 230}, {0x05a9, 230}, {0x05aa, 220}, {0x05ab, 230},
+ {0x05ac, 230}, {0x05ad, 222}, {0x05ae, 228}, {0x05af, 230},
+ {0x05b0, 10}, {0x05b1, 11}, {0x05b2, 12}, {0x05b3, 13},
+ {0x05b4, 14}, {0x05b5, 15}, {0x05b6, 16}, {0x05b7, 17},
+ {0x05b8, 18}, {0x05b9, 19}, {0x05bb, 20}, {0x05bc, 21},
+ {0x05bd, 22}, {0x05bf, 23}, {0x05c1, 24}, {0x05c2, 25},
+ {0x05c4, 230}, {0x064b, 27}, {0x064c, 28}, {0x064d, 29},
+ {0x064e, 30}, {0x064f, 31}, {0x0650, 32}, {0x0651, 33},
+ {0x0652, 34}, {0x0653, 230}, {0x0654, 230}, {0x0655, 220},
+ {0x0670, 35}, {0x06d6, 230}, {0x06d7, 230}, {0x06d8, 230},
+ {0x06d9, 230}, {0x06da, 230}, {0x06db, 230}, {0x06dc, 230},
+ {0x06df, 230}, {0x06e0, 230}, {0x06e1, 230}, {0x06e2, 230},
+ {0x06e3, 220}, {0x06e4, 230}, {0x06e7, 230}, {0x06e8, 230},
+ {0x06ea, 220}, {0x06eb, 230}, {0x06ec, 230}, {0x06ed, 220},
+ {0x0711, 36}, {0x0730, 230}, {0x0731, 220}, {0x0732, 230},
+ {0x0733, 230}, {0x0734, 220}, {0x0735, 230}, {0x0736, 230},
+ {0x0737, 220}, {0x0738, 220}, {0x0739, 220}, {0x073a, 230},
+ {0x073b, 220}, {0x073c, 220}, {0x073d, 230}, {0x073e, 220},
+ {0x073f, 230}, {0x0740, 230}, {0x0741, 230}, {0x0742, 220},
+ {0x0743, 230}, {0x0744, 220}, {0x0745, 230}, {0x0746, 220},
+ {0x0747, 230}, {0x0748, 220}, {0x0749, 230}, {0x074a, 230},
+ {0x093c, 7}, {0x094d, 9}, {0x0951, 230}, {0x0952, 220},
+ {0x0953, 230}, {0x0954, 230}, {0x09bc, 7}, {0x09cd, 9},
+ {0x0a3c, 7}, {0x0a4d, 9}, {0x0abc, 7}, {0x0acd, 9},
+ {0x0b3c, 7}, {0x0b4d, 9}, {0x0bcd, 9}, {0x0c4d, 9},
+ {0x0c55, 84}, {0x0c56, 91}, {0x0ccd, 9}, {0x0d4d, 9},
+ {0x0dca, 9}, {0x0e38, 103}, {0x0e39, 103}, {0x0e3a, 9},
+ {0x0e48, 107}, {0x0e49, 107}, {0x0e4a, 107}, {0x0e4b, 107},
+ {0x0eb8, 118}, {0x0eb9, 118}, {0x0ec8, 122}, {0x0ec9, 122},
+ {0x0eca, 122}, {0x0ecb, 122}, {0x0f18, 220}, {0x0f19, 220},
+ {0x0f35, 220}, {0x0f37, 220}, {0x0f39, 216}, {0x0f71, 129},
+ {0x0f72, 130}, {0x0f74, 132}, {0x0f7a, 130}, {0x0f7b, 130},
+ {0x0f7c, 130}, {0x0f7d, 130}, {0x0f80, 130}, {0x0f82, 230},
+ {0x0f83, 230}, {0x0f84, 9}, {0x0f86, 230}, {0x0f87, 230},
+ {0x0fc6, 220}, {0x1037, 7}, {0x1039, 9}, {0x17d2, 9},
+ {0x18a9, 228}, {0x20d0, 230}, {0x20d1, 230}, {0x20d2, 1},
+ {0x20d3, 1}, {0x20d4, 230}, {0x20d5, 230}, {0x20d6, 230},
+ {0x20d7, 230}, {0x20d8, 1}, {0x20d9, 1}, {0x20da, 1},
+ {0x20db, 230}, {0x20dc, 230}, {0x20e1, 230}, {0x302a, 218},
+ {0x302b, 228}, {0x302c, 232}, {0x302d, 222}, {0x302e, 224},
+ {0x302f, 224}, {0x3099, 8}, {0x309a, 8}, {0xfb1e, 26},
+ {0xfe20, 230}, {0xfe21, 230}, {0xfe22, 230}, {0xfe23, 230},
+};
+
+
+/*
+ * Canonical Composition
+ */
+
+#define COMPOSE_BM_SHIFT (16 - 11)
+
+static unsigned long compose_bitmap[] = {
+ 0x7012adee, 0x004640cf, 0x54004200, 0x00004464,
+ 0x00000002, 0x00000000, 0x00000000, 0xef6e0000,
+ 0x003f5000, 0x00000000, 0x00000000, 0x00000000,
+ 0x000000fc, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static struct composition compose_seq[] = {
+ {0x0041, 0x0300, 0x00c0}, {0x0041, 0x0301, 0x00c1},
+ {0x0041, 0x0302, 0x00c2}, {0x0041, 0x0303, 0x00c3},
+ {0x0041, 0x0308, 0x00c4}, {0x0041, 0x030a, 0x00c5},
+ {0x0043, 0x0327, 0x00c7}, {0x0045, 0x0300, 0x00c8},
+ {0x0045, 0x0301, 0x00c9}, {0x0045, 0x0302, 0x00ca},
+ {0x0045, 0x0308, 0x00cb}, {0x0049, 0x0300, 0x00cc},
+ {0x0049, 0x0301, 0x00cd}, {0x0049, 0x0302, 0x00ce},
+ {0x0049, 0x0308, 0x00cf}, {0x004e, 0x0303, 0x00d1},
+ {0x004f, 0x0300, 0x00d2}, {0x004f, 0x0301, 0x00d3},
+ {0x004f, 0x0302, 0x00d4}, {0x004f, 0x0303, 0x00d5},
+ {0x004f, 0x0308, 0x00d6}, {0x0055, 0x0300, 0x00d9},
+ {0x0055, 0x0301, 0x00da}, {0x0055, 0x0302, 0x00db},
+ {0x0055, 0x0308, 0x00dc}, {0x0059, 0x0301, 0x00dd},
+ {0x0061, 0x0300, 0x00e0}, {0x0061, 0x0301, 0x00e1},
+ {0x0061, 0x0302, 0x00e2}, {0x0061, 0x0303, 0x00e3},
+ {0x0061, 0x0308, 0x00e4}, {0x0061, 0x030a, 0x00e5},
+ {0x0063, 0x0327, 0x00e7}, {0x0065, 0x0300, 0x00e8},
+ {0x0065, 0x0301, 0x00e9}, {0x0065, 0x0302, 0x00ea},
+ {0x0065, 0x0308, 0x00eb}, {0x0069, 0x0300, 0x00ec},
+ {0x0069, 0x0301, 0x00ed}, {0x0069, 0x0302, 0x00ee},
+ {0x0069, 0x0308, 0x00ef}, {0x006e, 0x0303, 0x00f1},
+ {0x006f, 0x0300, 0x00f2}, {0x006f, 0x0301, 0x00f3},
+ {0x006f, 0x0302, 0x00f4}, {0x006f, 0x0303, 0x00f5},
+ {0x006f, 0x0308, 0x00f6}, {0x0075, 0x0300, 0x00f9},
+ {0x0075, 0x0301, 0x00fa}, {0x0075, 0x0302, 0x00fb},
+ {0x0075, 0x0308, 0x00fc}, {0x0079, 0x0301, 0x00fd},
+ {0x0079, 0x0308, 0x00ff}, {0x0041, 0x0304, 0x0100},
+ {0x0061, 0x0304, 0x0101}, {0x0041, 0x0306, 0x0102},
+ {0x0061, 0x0306, 0x0103}, {0x0041, 0x0328, 0x0104},
+ {0x0061, 0x0328, 0x0105}, {0x0043, 0x0301, 0x0106},
+ {0x0063, 0x0301, 0x0107}, {0x0043, 0x0302, 0x0108},
+ {0x0063, 0x0302, 0x0109}, {0x0043, 0x0307, 0x010a},
+ {0x0063, 0x0307, 0x010b}, {0x0043, 0x030c, 0x010c},
+ {0x0063, 0x030c, 0x010d}, {0x0044, 0x030c, 0x010e},
+ {0x0064, 0x030c, 0x010f}, {0x0045, 0x0304, 0x0112},
+ {0x0065, 0x0304, 0x0113}, {0x0045, 0x0306, 0x0114},
+ {0x0065, 0x0306, 0x0115}, {0x0045, 0x0307, 0x0116},
+ {0x0065, 0x0307, 0x0117}, {0x0045, 0x0328, 0x0118},
+ {0x0065, 0x0328, 0x0119}, {0x0045, 0x030c, 0x011a},
+ {0x0065, 0x030c, 0x011b}, {0x0047, 0x0302, 0x011c},
+ {0x0067, 0x0302, 0x011d}, {0x0047, 0x0306, 0x011e},
+ {0x0067, 0x0306, 0x011f}, {0x0047, 0x0307, 0x0120},
+ {0x0067, 0x0307, 0x0121}, {0x0047, 0x0327, 0x0122},
+ {0x0067, 0x0327, 0x0123}, {0x0048, 0x0302, 0x0124},
+ {0x0068, 0x0302, 0x0125}, {0x0049, 0x0303, 0x0128},
+ {0x0069, 0x0303, 0x0129}, {0x0049, 0x0304, 0x012a},
+ {0x0069, 0x0304, 0x012b}, {0x0049, 0x0306, 0x012c},
+ {0x0069, 0x0306, 0x012d}, {0x0049, 0x0328, 0x012e},
+ {0x0069, 0x0328, 0x012f}, {0x0049, 0x0307, 0x0130},
+ {0x004a, 0x0302, 0x0134}, {0x006a, 0x0302, 0x0135},
+ {0x004b, 0x0327, 0x0136}, {0x006b, 0x0327, 0x0137},
+ {0x004c, 0x0301, 0x0139}, {0x006c, 0x0301, 0x013a},
+ {0x004c, 0x0327, 0x013b}, {0x006c, 0x0327, 0x013c},
+ {0x004c, 0x030c, 0x013d}, {0x006c, 0x030c, 0x013e},
+ {0x004e, 0x0301, 0x0143}, {0x006e, 0x0301, 0x0144},
+ {0x004e, 0x0327, 0x0145}, {0x006e, 0x0327, 0x0146},
+ {0x004e, 0x030c, 0x0147}, {0x006e, 0x030c, 0x0148},
+ {0x004f, 0x0304, 0x014c}, {0x006f, 0x0304, 0x014d},
+ {0x004f, 0x0306, 0x014e}, {0x006f, 0x0306, 0x014f},
+ {0x004f, 0x030b, 0x0150}, {0x006f, 0x030b, 0x0151},
+ {0x0052, 0x0301, 0x0154}, {0x0072, 0x0301, 0x0155},
+ {0x0052, 0x0327, 0x0156}, {0x0072, 0x0327, 0x0157},
+ {0x0052, 0x030c, 0x0158}, {0x0072, 0x030c, 0x0159},
+ {0x0053, 0x0301, 0x015a}, {0x0073, 0x0301, 0x015b},
+ {0x0053, 0x0302, 0x015c}, {0x0073, 0x0302, 0x015d},
+ {0x0053, 0x0327, 0x015e}, {0x0073, 0x0327, 0x015f},
+ {0x0053, 0x030c, 0x0160}, {0x0073, 0x030c, 0x0161},
+ {0x0054, 0x0327, 0x0162}, {0x0074, 0x0327, 0x0163},
+ {0x0054, 0x030c, 0x0164}, {0x0074, 0x030c, 0x0165},
+ {0x0055, 0x0303, 0x0168}, {0x0075, 0x0303, 0x0169},
+ {0x0055, 0x0304, 0x016a}, {0x0075, 0x0304, 0x016b},
+ {0x0055, 0x0306, 0x016c}, {0x0075, 0x0306, 0x016d},
+ {0x0055, 0x030a, 0x016e}, {0x0075, 0x030a, 0x016f},
+ {0x0055, 0x030b, 0x0170}, {0x0075, 0x030b, 0x0171},
+ {0x0055, 0x0328, 0x0172}, {0x0075, 0x0328, 0x0173},
+ {0x0057, 0x0302, 0x0174}, {0x0077, 0x0302, 0x0175},
+ {0x0059, 0x0302, 0x0176}, {0x0079, 0x0302, 0x0177},
+ {0x0059, 0x0308, 0x0178}, {0x005a, 0x0301, 0x0179},
+ {0x007a, 0x0301, 0x017a}, {0x005a, 0x0307, 0x017b},
+ {0x007a, 0x0307, 0x017c}, {0x005a, 0x030c, 0x017d},
+ {0x007a, 0x030c, 0x017e}, {0x004f, 0x031b, 0x01a0},
+ {0x006f, 0x031b, 0x01a1}, {0x0055, 0x031b, 0x01af},
+ {0x0075, 0x031b, 0x01b0}, {0x0041, 0x030c, 0x01cd},
+ {0x0061, 0x030c, 0x01ce}, {0x0049, 0x030c, 0x01cf},
+ {0x0069, 0x030c, 0x01d0}, {0x004f, 0x030c, 0x01d1},
+ {0x006f, 0x030c, 0x01d2}, {0x0055, 0x030c, 0x01d3},
+ {0x0075, 0x030c, 0x01d4}, {0x00dc, 0x0304, 0x01d5},
+ {0x00fc, 0x0304, 0x01d6}, {0x00dc, 0x0301, 0x01d7},
+ {0x00fc, 0x0301, 0x01d8}, {0x00dc, 0x030c, 0x01d9},
+ {0x00fc, 0x030c, 0x01da}, {0x00dc, 0x0300, 0x01db},
+ {0x00fc, 0x0300, 0x01dc}, {0x00c4, 0x0304, 0x01de},
+ {0x00e4, 0x0304, 0x01df}, {0x0226, 0x0304, 0x01e0},
+ {0x0227, 0x0304, 0x01e1}, {0x00c6, 0x0304, 0x01e2},
+ {0x00e6, 0x0304, 0x01e3}, {0x0047, 0x030c, 0x01e6},
+ {0x0067, 0x030c, 0x01e7}, {0x004b, 0x030c, 0x01e8},
+ {0x006b, 0x030c, 0x01e9}, {0x004f, 0x0328, 0x01ea},
+ {0x006f, 0x0328, 0x01eb}, {0x01ea, 0x0304, 0x01ec},
+ {0x01eb, 0x0304, 0x01ed}, {0x01b7, 0x030c, 0x01ee},
+ {0x0292, 0x030c, 0x01ef}, {0x006a, 0x030c, 0x01f0},
+ {0x0047, 0x0301, 0x01f4}, {0x0067, 0x0301, 0x01f5},
+ {0x004e, 0x0300, 0x01f8}, {0x006e, 0x0300, 0x01f9},
+ {0x00c5, 0x0301, 0x01fa}, {0x00e5, 0x0301, 0x01fb},
+ {0x00c6, 0x0301, 0x01fc}, {0x00e6, 0x0301, 0x01fd},
+ {0x00d8, 0x0301, 0x01fe}, {0x00f8, 0x0301, 0x01ff},
+ {0x0041, 0x030f, 0x0200}, {0x0061, 0x030f, 0x0201},
+ {0x0041, 0x0311, 0x0202}, {0x0061, 0x0311, 0x0203},
+ {0x0045, 0x030f, 0x0204}, {0x0065, 0x030f, 0x0205},
+ {0x0045, 0x0311, 0x0206}, {0x0065, 0x0311, 0x0207},
+ {0x0049, 0x030f, 0x0208}, {0x0069, 0x030f, 0x0209},
+ {0x0049, 0x0311, 0x020a}, {0x0069, 0x0311, 0x020b},
+ {0x004f, 0x030f, 0x020c}, {0x006f, 0x030f, 0x020d},
+ {0x004f, 0x0311, 0x020e}, {0x006f, 0x0311, 0x020f},
+ {0x0052, 0x030f, 0x0210}, {0x0072, 0x030f, 0x0211},
+ {0x0052, 0x0311, 0x0212}, {0x0072, 0x0311, 0x0213},
+ {0x0055, 0x030f, 0x0214}, {0x0075, 0x030f, 0x0215},
+ {0x0055, 0x0311, 0x0216}, {0x0075, 0x0311, 0x0217},
+ {0x0053, 0x0326, 0x0218}, {0x0073, 0x0326, 0x0219},
+ {0x0054, 0x0326, 0x021a}, {0x0074, 0x0326, 0x021b},
+ {0x0048, 0x030c, 0x021e}, {0x0068, 0x030c, 0x021f},
+ {0x0041, 0x0307, 0x0226}, {0x0061, 0x0307, 0x0227},
+ {0x0045, 0x0327, 0x0228}, {0x0065, 0x0327, 0x0229},
+ {0x00d6, 0x0304, 0x022a}, {0x00f6, 0x0304, 0x022b},
+ {0x00d5, 0x0304, 0x022c}, {0x00f5, 0x0304, 0x022d},
+ {0x004f, 0x0307, 0x022e}, {0x006f, 0x0307, 0x022f},
+ {0x022e, 0x0304, 0x0230}, {0x022f, 0x0304, 0x0231},
+ {0x0059, 0x0304, 0x0232}, {0x0079, 0x0304, 0x0233},
+ {0x00a8, 0x0301, 0x0385}, {0x0391, 0x0301, 0x0386},
+ {0x0395, 0x0301, 0x0388}, {0x0397, 0x0301, 0x0389},
+ {0x0399, 0x0301, 0x038a}, {0x039f, 0x0301, 0x038c},
+ {0x03a5, 0x0301, 0x038e}, {0x03a9, 0x0301, 0x038f},
+ {0x03ca, 0x0301, 0x0390}, {0x0399, 0x0308, 0x03aa},
+ {0x03a5, 0x0308, 0x03ab}, {0x03b1, 0x0301, 0x03ac},
+ {0x03b5, 0x0301, 0x03ad}, {0x03b7, 0x0301, 0x03ae},
+ {0x03b9, 0x0301, 0x03af}, {0x03cb, 0x0301, 0x03b0},
+ {0x03b9, 0x0308, 0x03ca}, {0x03c5, 0x0308, 0x03cb},
+ {0x03bf, 0x0301, 0x03cc}, {0x03c5, 0x0301, 0x03cd},
+ {0x03c9, 0x0301, 0x03ce}, {0x03d2, 0x0301, 0x03d3},
+ {0x03d2, 0x0308, 0x03d4}, {0x0415, 0x0300, 0x0400},
+ {0x0415, 0x0308, 0x0401}, {0x0413, 0x0301, 0x0403},
+ {0x0406, 0x0308, 0x0407}, {0x041a, 0x0301, 0x040c},
+ {0x0418, 0x0300, 0x040d}, {0x0423, 0x0306, 0x040e},
+ {0x0418, 0x0306, 0x0419}, {0x0438, 0x0306, 0x0439},
+ {0x0435, 0x0300, 0x0450}, {0x0435, 0x0308, 0x0451},
+ {0x0433, 0x0301, 0x0453}, {0x0456, 0x0308, 0x0457},
+ {0x043a, 0x0301, 0x045c}, {0x0438, 0x0300, 0x045d},
+ {0x0443, 0x0306, 0x045e}, {0x0474, 0x030f, 0x0476},
+ {0x0475, 0x030f, 0x0477}, {0x0416, 0x0306, 0x04c1},
+ {0x0436, 0x0306, 0x04c2}, {0x0410, 0x0306, 0x04d0},
+ {0x0430, 0x0306, 0x04d1}, {0x0410, 0x0308, 0x04d2},
+ {0x0430, 0x0308, 0x04d3}, {0x0415, 0x0306, 0x04d6},
+ {0x0435, 0x0306, 0x04d7}, {0x04d8, 0x0308, 0x04da},
+ {0x04d9, 0x0308, 0x04db}, {0x0416, 0x0308, 0x04dc},
+ {0x0436, 0x0308, 0x04dd}, {0x0417, 0x0308, 0x04de},
+ {0x0437, 0x0308, 0x04df}, {0x0418, 0x0304, 0x04e2},
+ {0x0438, 0x0304, 0x04e3}, {0x0418, 0x0308, 0x04e4},
+ {0x0438, 0x0308, 0x04e5}, {0x041e, 0x0308, 0x04e6},
+ {0x043e, 0x0308, 0x04e7}, {0x04e8, 0x0308, 0x04ea},
+ {0x04e9, 0x0308, 0x04eb}, {0x042d, 0x0308, 0x04ec},
+ {0x044d, 0x0308, 0x04ed}, {0x0423, 0x0304, 0x04ee},
+ {0x0443, 0x0304, 0x04ef}, {0x0423, 0x0308, 0x04f0},
+ {0x0443, 0x0308, 0x04f1}, {0x0423, 0x030b, 0x04f2},
+ {0x0443, 0x030b, 0x04f3}, {0x0427, 0x0308, 0x04f4},
+ {0x0447, 0x0308, 0x04f5}, {0x042b, 0x0308, 0x04f8},
+ {0x044b, 0x0308, 0x04f9}, {0x0627, 0x0653, 0x0622},
+ {0x0627, 0x0654, 0x0623}, {0x0648, 0x0654, 0x0624},
+ {0x0627, 0x0655, 0x0625}, {0x064a, 0x0654, 0x0626},
+ {0x06d5, 0x0654, 0x06c0}, {0x06c1, 0x0654, 0x06c2},
+ {0x06d2, 0x0654, 0x06d3}, {0x0928, 0x093c, 0x0929},
+ {0x0930, 0x093c, 0x0931}, {0x0933, 0x093c, 0x0934},
+ {0x09c7, 0x09be, 0x09cb}, {0x09c7, 0x09d7, 0x09cc},
+ {0x0b47, 0x0b56, 0x0b48}, {0x0b47, 0x0b3e, 0x0b4b},
+ {0x0b47, 0x0b57, 0x0b4c}, {0x0b92, 0x0bd7, 0x0b94},
+ {0x0bc6, 0x0bbe, 0x0bca}, {0x0bc7, 0x0bbe, 0x0bcb},
+ {0x0bc6, 0x0bd7, 0x0bcc}, {0x0c46, 0x0c56, 0x0c48},
+ {0x0cbf, 0x0cd5, 0x0cc0}, {0x0cc6, 0x0cd5, 0x0cc7},
+ {0x0cc6, 0x0cd6, 0x0cc8}, {0x0cc6, 0x0cc2, 0x0cca},
+ {0x0cca, 0x0cd5, 0x0ccb}, {0x0d46, 0x0d3e, 0x0d4a},
+ {0x0d47, 0x0d3e, 0x0d4b}, {0x0d46, 0x0d57, 0x0d4c},
+ {0x0dd9, 0x0dca, 0x0dda}, {0x0dd9, 0x0dcf, 0x0ddc},
+ {0x0ddc, 0x0dca, 0x0ddd}, {0x0dd9, 0x0ddf, 0x0dde},
+ {0x1025, 0x102e, 0x1026}, {0x0041, 0x0325, 0x1e00},
+ {0x0061, 0x0325, 0x1e01}, {0x0042, 0x0307, 0x1e02},
+ {0x0062, 0x0307, 0x1e03}, {0x0042, 0x0323, 0x1e04},
+ {0x0062, 0x0323, 0x1e05}, {0x0042, 0x0331, 0x1e06},
+ {0x0062, 0x0331, 0x1e07}, {0x00c7, 0x0301, 0x1e08},
+ {0x00e7, 0x0301, 0x1e09}, {0x0044, 0x0307, 0x1e0a},
+ {0x0064, 0x0307, 0x1e0b}, {0x0044, 0x0323, 0x1e0c},
+ {0x0064, 0x0323, 0x1e0d}, {0x0044, 0x0331, 0x1e0e},
+ {0x0064, 0x0331, 0x1e0f}, {0x0044, 0x0327, 0x1e10},
+ {0x0064, 0x0327, 0x1e11}, {0x0044, 0x032d, 0x1e12},
+ {0x0064, 0x032d, 0x1e13}, {0x0112, 0x0300, 0x1e14},
+ {0x0113, 0x0300, 0x1e15}, {0x0112, 0x0301, 0x1e16},
+ {0x0113, 0x0301, 0x1e17}, {0x0045, 0x032d, 0x1e18},
+ {0x0065, 0x032d, 0x1e19}, {0x0045, 0x0330, 0x1e1a},
+ {0x0065, 0x0330, 0x1e1b}, {0x0228, 0x0306, 0x1e1c},
+ {0x0229, 0x0306, 0x1e1d}, {0x0046, 0x0307, 0x1e1e},
+ {0x0066, 0x0307, 0x1e1f}, {0x0047, 0x0304, 0x1e20},
+ {0x0067, 0x0304, 0x1e21}, {0x0048, 0x0307, 0x1e22},
+ {0x0068, 0x0307, 0x1e23}, {0x0048, 0x0323, 0x1e24},
+ {0x0068, 0x0323, 0x1e25}, {0x0048, 0x0308, 0x1e26},
+ {0x0068, 0x0308, 0x1e27}, {0x0048, 0x0327, 0x1e28},
+ {0x0068, 0x0327, 0x1e29}, {0x0048, 0x032e, 0x1e2a},
+ {0x0068, 0x032e, 0x1e2b}, {0x0049, 0x0330, 0x1e2c},
+ {0x0069, 0x0330, 0x1e2d}, {0x00cf, 0x0301, 0x1e2e},
+ {0x00ef, 0x0301, 0x1e2f}, {0x004b, 0x0301, 0x1e30},
+ {0x006b, 0x0301, 0x1e31}, {0x004b, 0x0323, 0x1e32},
+ {0x006b, 0x0323, 0x1e33}, {0x004b, 0x0331, 0x1e34},
+ {0x006b, 0x0331, 0x1e35}, {0x004c, 0x0323, 0x1e36},
+ {0x006c, 0x0323, 0x1e37}, {0x1e36, 0x0304, 0x1e38},
+ {0x1e37, 0x0304, 0x1e39}, {0x004c, 0x0331, 0x1e3a},
+ {0x006c, 0x0331, 0x1e3b}, {0x004c, 0x032d, 0x1e3c},
+ {0x006c, 0x032d, 0x1e3d}, {0x004d, 0x0301, 0x1e3e},
+ {0x006d, 0x0301, 0x1e3f}, {0x004d, 0x0307, 0x1e40},
+ {0x006d, 0x0307, 0x1e41}, {0x004d, 0x0323, 0x1e42},
+ {0x006d, 0x0323, 0x1e43}, {0x004e, 0x0307, 0x1e44},
+ {0x006e, 0x0307, 0x1e45}, {0x004e, 0x0323, 0x1e46},
+ {0x006e, 0x0323, 0x1e47}, {0x004e, 0x0331, 0x1e48},
+ {0x006e, 0x0331, 0x1e49}, {0x004e, 0x032d, 0x1e4a},
+ {0x006e, 0x032d, 0x1e4b}, {0x00d5, 0x0301, 0x1e4c},
+ {0x00f5, 0x0301, 0x1e4d}, {0x00d5, 0x0308, 0x1e4e},
+ {0x00f5, 0x0308, 0x1e4f}, {0x014c, 0x0300, 0x1e50},
+ {0x014d, 0x0300, 0x1e51}, {0x014c, 0x0301, 0x1e52},
+ {0x014d, 0x0301, 0x1e53}, {0x0050, 0x0301, 0x1e54},
+ {0x0070, 0x0301, 0x1e55}, {0x0050, 0x0307, 0x1e56},
+ {0x0070, 0x0307, 0x1e57}, {0x0052, 0x0307, 0x1e58},
+ {0x0072, 0x0307, 0x1e59}, {0x0052, 0x0323, 0x1e5a},
+ {0x0072, 0x0323, 0x1e5b}, {0x1e5a, 0x0304, 0x1e5c},
+ {0x1e5b, 0x0304, 0x1e5d}, {0x0052, 0x0331, 0x1e5e},
+ {0x0072, 0x0331, 0x1e5f}, {0x0053, 0x0307, 0x1e60},
+ {0x0073, 0x0307, 0x1e61}, {0x0053, 0x0323, 0x1e62},
+ {0x0073, 0x0323, 0x1e63}, {0x015a, 0x0307, 0x1e64},
+ {0x015b, 0x0307, 0x1e65}, {0x0160, 0x0307, 0x1e66},
+ {0x0161, 0x0307, 0x1e67}, {0x1e62, 0x0307, 0x1e68},
+ {0x1e63, 0x0307, 0x1e69}, {0x0054, 0x0307, 0x1e6a},
+ {0x0074, 0x0307, 0x1e6b}, {0x0054, 0x0323, 0x1e6c},
+ {0x0074, 0x0323, 0x1e6d}, {0x0054, 0x0331, 0x1e6e},
+ {0x0074, 0x0331, 0x1e6f}, {0x0054, 0x032d, 0x1e70},
+ {0x0074, 0x032d, 0x1e71}, {0x0055, 0x0324, 0x1e72},
+ {0x0075, 0x0324, 0x1e73}, {0x0055, 0x0330, 0x1e74},
+ {0x0075, 0x0330, 0x1e75}, {0x0055, 0x032d, 0x1e76},
+ {0x0075, 0x032d, 0x1e77}, {0x0168, 0x0301, 0x1e78},
+ {0x0169, 0x0301, 0x1e79}, {0x016a, 0x0308, 0x1e7a},
+ {0x016b, 0x0308, 0x1e7b}, {0x0056, 0x0303, 0x1e7c},
+ {0x0076, 0x0303, 0x1e7d}, {0x0056, 0x0323, 0x1e7e},
+ {0x0076, 0x0323, 0x1e7f}, {0x0057, 0x0300, 0x1e80},
+ {0x0077, 0x0300, 0x1e81}, {0x0057, 0x0301, 0x1e82},
+ {0x0077, 0x0301, 0x1e83}, {0x0057, 0x0308, 0x1e84},
+ {0x0077, 0x0308, 0x1e85}, {0x0057, 0x0307, 0x1e86},
+ {0x0077, 0x0307, 0x1e87}, {0x0057, 0x0323, 0x1e88},
+ {0x0077, 0x0323, 0x1e89}, {0x0058, 0x0307, 0x1e8a},
+ {0x0078, 0x0307, 0x1e8b}, {0x0058, 0x0308, 0x1e8c},
+ {0x0078, 0x0308, 0x1e8d}, {0x0059, 0x0307, 0x1e8e},
+ {0x0079, 0x0307, 0x1e8f}, {0x005a, 0x0302, 0x1e90},
+ {0x007a, 0x0302, 0x1e91}, {0x005a, 0x0323, 0x1e92},
+ {0x007a, 0x0323, 0x1e93}, {0x005a, 0x0331, 0x1e94},
+ {0x007a, 0x0331, 0x1e95}, {0x0068, 0x0331, 0x1e96},
+ {0x0074, 0x0308, 0x1e97}, {0x0077, 0x030a, 0x1e98},
+ {0x0079, 0x030a, 0x1e99}, {0x017f, 0x0307, 0x1e9b},
+ {0x0041, 0x0323, 0x1ea0}, {0x0061, 0x0323, 0x1ea1},
+ {0x0041, 0x0309, 0x1ea2}, {0x0061, 0x0309, 0x1ea3},
+ {0x00c2, 0x0301, 0x1ea4}, {0x00e2, 0x0301, 0x1ea5},
+ {0x00c2, 0x0300, 0x1ea6}, {0x00e2, 0x0300, 0x1ea7},
+ {0x00c2, 0x0309, 0x1ea8}, {0x00e2, 0x0309, 0x1ea9},
+ {0x00c2, 0x0303, 0x1eaa}, {0x00e2, 0x0303, 0x1eab},
+ {0x1ea0, 0x0302, 0x1eac}, {0x1ea1, 0x0302, 0x1ead},
+ {0x0102, 0x0301, 0x1eae}, {0x0103, 0x0301, 0x1eaf},
+ {0x0102, 0x0300, 0x1eb0}, {0x0103, 0x0300, 0x1eb1},
+ {0x0102, 0x0309, 0x1eb2}, {0x0103, 0x0309, 0x1eb3},
+ {0x0102, 0x0303, 0x1eb4}, {0x0103, 0x0303, 0x1eb5},
+ {0x1ea0, 0x0306, 0x1eb6}, {0x1ea1, 0x0306, 0x1eb7},
+ {0x0045, 0x0323, 0x1eb8}, {0x0065, 0x0323, 0x1eb9},
+ {0x0045, 0x0309, 0x1eba}, {0x0065, 0x0309, 0x1ebb},
+ {0x0045, 0x0303, 0x1ebc}, {0x0065, 0x0303, 0x1ebd},
+ {0x00ca, 0x0301, 0x1ebe}, {0x00ea, 0x0301, 0x1ebf},
+ {0x00ca, 0x0300, 0x1ec0}, {0x00ea, 0x0300, 0x1ec1},
+ {0x00ca, 0x0309, 0x1ec2}, {0x00ea, 0x0309, 0x1ec3},
+ {0x00ca, 0x0303, 0x1ec4}, {0x00ea, 0x0303, 0x1ec5},
+ {0x1eb8, 0x0302, 0x1ec6}, {0x1eb9, 0x0302, 0x1ec7},
+ {0x0049, 0x0309, 0x1ec8}, {0x0069, 0x0309, 0x1ec9},
+ {0x0049, 0x0323, 0x1eca}, {0x0069, 0x0323, 0x1ecb},
+ {0x004f, 0x0323, 0x1ecc}, {0x006f, 0x0323, 0x1ecd},
+ {0x004f, 0x0309, 0x1ece}, {0x006f, 0x0309, 0x1ecf},
+ {0x00d4, 0x0301, 0x1ed0}, {0x00f4, 0x0301, 0x1ed1},
+ {0x00d4, 0x0300, 0x1ed2}, {0x00f4, 0x0300, 0x1ed3},
+ {0x00d4, 0x0309, 0x1ed4}, {0x00f4, 0x0309, 0x1ed5},
+ {0x00d4, 0x0303, 0x1ed6}, {0x00f4, 0x0303, 0x1ed7},
+ {0x1ecc, 0x0302, 0x1ed8}, {0x1ecd, 0x0302, 0x1ed9},
+ {0x01a0, 0x0301, 0x1eda}, {0x01a1, 0x0301, 0x1edb},
+ {0x01a0, 0x0300, 0x1edc}, {0x01a1, 0x0300, 0x1edd},
+ {0x01a0, 0x0309, 0x1ede}, {0x01a1, 0x0309, 0x1edf},
+ {0x01a0, 0x0303, 0x1ee0}, {0x01a1, 0x0303, 0x1ee1},
+ {0x01a0, 0x0323, 0x1ee2}, {0x01a1, 0x0323, 0x1ee3},
+ {0x0055, 0x0323, 0x1ee4}, {0x0075, 0x0323, 0x1ee5},
+ {0x0055, 0x0309, 0x1ee6}, {0x0075, 0x0309, 0x1ee7},
+ {0x01af, 0x0301, 0x1ee8}, {0x01b0, 0x0301, 0x1ee9},
+ {0x01af, 0x0300, 0x1eea}, {0x01b0, 0x0300, 0x1eeb},
+ {0x01af, 0x0309, 0x1eec}, {0x01b0, 0x0309, 0x1eed},
+ {0x01af, 0x0303, 0x1eee}, {0x01b0, 0x0303, 0x1eef},
+ {0x01af, 0x0323, 0x1ef0}, {0x01b0, 0x0323, 0x1ef1},
+ {0x0059, 0x0300, 0x1ef2}, {0x0079, 0x0300, 0x1ef3},
+ {0x0059, 0x0323, 0x1ef4}, {0x0079, 0x0323, 0x1ef5},
+ {0x0059, 0x0309, 0x1ef6}, {0x0079, 0x0309, 0x1ef7},
+ {0x0059, 0x0303, 0x1ef8}, {0x0079, 0x0303, 0x1ef9},
+ {0x03b1, 0x0313, 0x1f00}, {0x03b1, 0x0314, 0x1f01},
+ {0x1f00, 0x0300, 0x1f02}, {0x1f01, 0x0300, 0x1f03},
+ {0x1f00, 0x0301, 0x1f04}, {0x1f01, 0x0301, 0x1f05},
+ {0x1f00, 0x0342, 0x1f06}, {0x1f01, 0x0342, 0x1f07},
+ {0x0391, 0x0313, 0x1f08}, {0x0391, 0x0314, 0x1f09},
+ {0x1f08, 0x0300, 0x1f0a}, {0x1f09, 0x0300, 0x1f0b},
+ {0x1f08, 0x0301, 0x1f0c}, {0x1f09, 0x0301, 0x1f0d},
+ {0x1f08, 0x0342, 0x1f0e}, {0x1f09, 0x0342, 0x1f0f},
+ {0x03b5, 0x0313, 0x1f10}, {0x03b5, 0x0314, 0x1f11},
+ {0x1f10, 0x0300, 0x1f12}, {0x1f11, 0x0300, 0x1f13},
+ {0x1f10, 0x0301, 0x1f14}, {0x1f11, 0x0301, 0x1f15},
+ {0x0395, 0x0313, 0x1f18}, {0x0395, 0x0314, 0x1f19},
+ {0x1f18, 0x0300, 0x1f1a}, {0x1f19, 0x0300, 0x1f1b},
+ {0x1f18, 0x0301, 0x1f1c}, {0x1f19, 0x0301, 0x1f1d},
+ {0x03b7, 0x0313, 0x1f20}, {0x03b7, 0x0314, 0x1f21},
+ {0x1f20, 0x0300, 0x1f22}, {0x1f21, 0x0300, 0x1f23},
+ {0x1f20, 0x0301, 0x1f24}, {0x1f21, 0x0301, 0x1f25},
+ {0x1f20, 0x0342, 0x1f26}, {0x1f21, 0x0342, 0x1f27},
+ {0x0397, 0x0313, 0x1f28}, {0x0397, 0x0314, 0x1f29},
+ {0x1f28, 0x0300, 0x1f2a}, {0x1f29, 0x0300, 0x1f2b},
+ {0x1f28, 0x0301, 0x1f2c}, {0x1f29, 0x0301, 0x1f2d},
+ {0x1f28, 0x0342, 0x1f2e}, {0x1f29, 0x0342, 0x1f2f},
+ {0x03b9, 0x0313, 0x1f30}, {0x03b9, 0x0314, 0x1f31},
+ {0x1f30, 0x0300, 0x1f32}, {0x1f31, 0x0300, 0x1f33},
+ {0x1f30, 0x0301, 0x1f34}, {0x1f31, 0x0301, 0x1f35},
+ {0x1f30, 0x0342, 0x1f36}, {0x1f31, 0x0342, 0x1f37},
+ {0x0399, 0x0313, 0x1f38}, {0x0399, 0x0314, 0x1f39},
+ {0x1f38, 0x0300, 0x1f3a}, {0x1f39, 0x0300, 0x1f3b},
+ {0x1f38, 0x0301, 0x1f3c}, {0x1f39, 0x0301, 0x1f3d},
+ {0x1f38, 0x0342, 0x1f3e}, {0x1f39, 0x0342, 0x1f3f},
+ {0x03bf, 0x0313, 0x1f40}, {0x03bf, 0x0314, 0x1f41},
+ {0x1f40, 0x0300, 0x1f42}, {0x1f41, 0x0300, 0x1f43},
+ {0x1f40, 0x0301, 0x1f44}, {0x1f41, 0x0301, 0x1f45},
+ {0x039f, 0x0313, 0x1f48}, {0x039f, 0x0314, 0x1f49},
+ {0x1f48, 0x0300, 0x1f4a}, {0x1f49, 0x0300, 0x1f4b},
+ {0x1f48, 0x0301, 0x1f4c}, {0x1f49, 0x0301, 0x1f4d},
+ {0x03c5, 0x0313, 0x1f50}, {0x03c5, 0x0314, 0x1f51},
+ {0x1f50, 0x0300, 0x1f52}, {0x1f51, 0x0300, 0x1f53},
+ {0x1f50, 0x0301, 0x1f54}, {0x1f51, 0x0301, 0x1f55},
+ {0x1f50, 0x0342, 0x1f56}, {0x1f51, 0x0342, 0x1f57},
+ {0x03a5, 0x0314, 0x1f59}, {0x1f59, 0x0300, 0x1f5b},
+ {0x1f59, 0x0301, 0x1f5d}, {0x1f59, 0x0342, 0x1f5f},
+ {0x03c9, 0x0313, 0x1f60}, {0x03c9, 0x0314, 0x1f61},
+ {0x1f60, 0x0300, 0x1f62}, {0x1f61, 0x0300, 0x1f63},
+ {0x1f60, 0x0301, 0x1f64}, {0x1f61, 0x0301, 0x1f65},
+ {0x1f60, 0x0342, 0x1f66}, {0x1f61, 0x0342, 0x1f67},
+ {0x03a9, 0x0313, 0x1f68}, {0x03a9, 0x0314, 0x1f69},
+ {0x1f68, 0x0300, 0x1f6a}, {0x1f69, 0x0300, 0x1f6b},
+ {0x1f68, 0x0301, 0x1f6c}, {0x1f69, 0x0301, 0x1f6d},
+ {0x1f68, 0x0342, 0x1f6e}, {0x1f69, 0x0342, 0x1f6f},
+ {0x03b1, 0x0300, 0x1f70}, {0x03b5, 0x0300, 0x1f72},
+ {0x03b7, 0x0300, 0x1f74}, {0x03b9, 0x0300, 0x1f76},
+ {0x03bf, 0x0300, 0x1f78}, {0x03c5, 0x0300, 0x1f7a},
+ {0x03c9, 0x0300, 0x1f7c}, {0x1f00, 0x0345, 0x1f80},
+ {0x1f01, 0x0345, 0x1f81}, {0x1f02, 0x0345, 0x1f82},
+ {0x1f03, 0x0345, 0x1f83}, {0x1f04, 0x0345, 0x1f84},
+ {0x1f05, 0x0345, 0x1f85}, {0x1f06, 0x0345, 0x1f86},
+ {0x1f07, 0x0345, 0x1f87}, {0x1f08, 0x0345, 0x1f88},
+ {0x1f09, 0x0345, 0x1f89}, {0x1f0a, 0x0345, 0x1f8a},
+ {0x1f0b, 0x0345, 0x1f8b}, {0x1f0c, 0x0345, 0x1f8c},
+ {0x1f0d, 0x0345, 0x1f8d}, {0x1f0e, 0x0345, 0x1f8e},
+ {0x1f0f, 0x0345, 0x1f8f}, {0x1f20, 0x0345, 0x1f90},
+ {0x1f21, 0x0345, 0x1f91}, {0x1f22, 0x0345, 0x1f92},
+ {0x1f23, 0x0345, 0x1f93}, {0x1f24, 0x0345, 0x1f94},
+ {0x1f25, 0x0345, 0x1f95}, {0x1f26, 0x0345, 0x1f96},
+ {0x1f27, 0x0345, 0x1f97}, {0x1f28, 0x0345, 0x1f98},
+ {0x1f29, 0x0345, 0x1f99}, {0x1f2a, 0x0345, 0x1f9a},
+ {0x1f2b, 0x0345, 0x1f9b}, {0x1f2c, 0x0345, 0x1f9c},
+ {0x1f2d, 0x0345, 0x1f9d}, {0x1f2e, 0x0345, 0x1f9e},
+ {0x1f2f, 0x0345, 0x1f9f}, {0x1f60, 0x0345, 0x1fa0},
+ {0x1f61, 0x0345, 0x1fa1}, {0x1f62, 0x0345, 0x1fa2},
+ {0x1f63, 0x0345, 0x1fa3}, {0x1f64, 0x0345, 0x1fa4},
+ {0x1f65, 0x0345, 0x1fa5}, {0x1f66, 0x0345, 0x1fa6},
+ {0x1f67, 0x0345, 0x1fa7}, {0x1f68, 0x0345, 0x1fa8},
+ {0x1f69, 0x0345, 0x1fa9}, {0x1f6a, 0x0345, 0x1faa},
+ {0x1f6b, 0x0345, 0x1fab}, {0x1f6c, 0x0345, 0x1fac},
+ {0x1f6d, 0x0345, 0x1fad}, {0x1f6e, 0x0345, 0x1fae},
+ {0x1f6f, 0x0345, 0x1faf}, {0x03b1, 0x0306, 0x1fb0},
+ {0x03b1, 0x0304, 0x1fb1}, {0x1f70, 0x0345, 0x1fb2},
+ {0x03b1, 0x0345, 0x1fb3}, {0x03ac, 0x0345, 0x1fb4},
+ {0x03b1, 0x0342, 0x1fb6}, {0x1fb6, 0x0345, 0x1fb7},
+ {0x0391, 0x0306, 0x1fb8}, {0x0391, 0x0304, 0x1fb9},
+ {0x0391, 0x0300, 0x1fba}, {0x0391, 0x0345, 0x1fbc},
+ {0x00a8, 0x0342, 0x1fc1}, {0x1f74, 0x0345, 0x1fc2},
+ {0x03b7, 0x0345, 0x1fc3}, {0x03ae, 0x0345, 0x1fc4},
+ {0x03b7, 0x0342, 0x1fc6}, {0x1fc6, 0x0345, 0x1fc7},
+ {0x0395, 0x0300, 0x1fc8}, {0x0397, 0x0300, 0x1fca},
+ {0x0397, 0x0345, 0x1fcc}, {0x1fbf, 0x0300, 0x1fcd},
+ {0x1fbf, 0x0301, 0x1fce}, {0x1fbf, 0x0342, 0x1fcf},
+ {0x03b9, 0x0306, 0x1fd0}, {0x03b9, 0x0304, 0x1fd1},
+ {0x03ca, 0x0300, 0x1fd2}, {0x03b9, 0x0342, 0x1fd6},
+ {0x03ca, 0x0342, 0x1fd7}, {0x0399, 0x0306, 0x1fd8},
+ {0x0399, 0x0304, 0x1fd9}, {0x0399, 0x0300, 0x1fda},
+ {0x1ffe, 0x0300, 0x1fdd}, {0x1ffe, 0x0301, 0x1fde},
+ {0x1ffe, 0x0342, 0x1fdf}, {0x03c5, 0x0306, 0x1fe0},
+ {0x03c5, 0x0304, 0x1fe1}, {0x03cb, 0x0300, 0x1fe2},
+ {0x03c1, 0x0313, 0x1fe4}, {0x03c1, 0x0314, 0x1fe5},
+ {0x03c5, 0x0342, 0x1fe6}, {0x03cb, 0x0342, 0x1fe7},
+ {0x03a5, 0x0306, 0x1fe8}, {0x03a5, 0x0304, 0x1fe9},
+ {0x03a5, 0x0300, 0x1fea}, {0x03a1, 0x0314, 0x1fec},
+ {0x00a8, 0x0300, 0x1fed}, {0x1f7c, 0x0345, 0x1ff2},
+ {0x03c9, 0x0345, 0x1ff3}, {0x03ce, 0x0345, 0x1ff4},
+ {0x03c9, 0x0342, 0x1ff6}, {0x1ff6, 0x0345, 0x1ff7},
+ {0x039f, 0x0300, 0x1ff8}, {0x03a9, 0x0300, 0x1ffa},
+ {0x03a9, 0x0345, 0x1ffc}, {0x2190, 0x0338, 0x219a},
+ {0x2192, 0x0338, 0x219b}, {0x2194, 0x0338, 0x21ae},
+ {0x21d0, 0x0338, 0x21cd}, {0x21d4, 0x0338, 0x21ce},
+ {0x21d2, 0x0338, 0x21cf}, {0x2203, 0x0338, 0x2204},
+ {0x2208, 0x0338, 0x2209}, {0x220b, 0x0338, 0x220c},
+ {0x2223, 0x0338, 0x2224}, {0x2225, 0x0338, 0x2226},
+ {0x223c, 0x0338, 0x2241}, {0x2243, 0x0338, 0x2244},
+ {0x2245, 0x0338, 0x2247}, {0x2248, 0x0338, 0x2249},
+ {0x003d, 0x0338, 0x2260}, {0x2261, 0x0338, 0x2262},
+ {0x224d, 0x0338, 0x226d}, {0x003c, 0x0338, 0x226e},
+ {0x003e, 0x0338, 0x226f}, {0x2264, 0x0338, 0x2270},
+ {0x2265, 0x0338, 0x2271}, {0x2272, 0x0338, 0x2274},
+ {0x2273, 0x0338, 0x2275}, {0x2276, 0x0338, 0x2278},
+ {0x2277, 0x0338, 0x2279}, {0x227a, 0x0338, 0x2280},
+ {0x227b, 0x0338, 0x2281}, {0x2282, 0x0338, 0x2284},
+ {0x2283, 0x0338, 0x2285}, {0x2286, 0x0338, 0x2288},
+ {0x2287, 0x0338, 0x2289}, {0x22a2, 0x0338, 0x22ac},
+ {0x22a8, 0x0338, 0x22ad}, {0x22a9, 0x0338, 0x22ae},
+ {0x22ab, 0x0338, 0x22af}, {0x227c, 0x0338, 0x22e0},
+ {0x227d, 0x0338, 0x22e1}, {0x2291, 0x0338, 0x22e2},
+ {0x2292, 0x0338, 0x22e3}, {0x22b2, 0x0338, 0x22ea},
+ {0x22b3, 0x0338, 0x22eb}, {0x22b4, 0x0338, 0x22ec},
+ {0x22b5, 0x0338, 0x22ed}, {0x304b, 0x3099, 0x304c},
+ {0x304d, 0x3099, 0x304e}, {0x304f, 0x3099, 0x3050},
+ {0x3051, 0x3099, 0x3052}, {0x3053, 0x3099, 0x3054},
+ {0x3055, 0x3099, 0x3056}, {0x3057, 0x3099, 0x3058},
+ {0x3059, 0x3099, 0x305a}, {0x305b, 0x3099, 0x305c},
+ {0x305d, 0x3099, 0x305e}, {0x305f, 0x3099, 0x3060},
+ {0x3061, 0x3099, 0x3062}, {0x3064, 0x3099, 0x3065},
+ {0x3066, 0x3099, 0x3067}, {0x3068, 0x3099, 0x3069},
+ {0x306f, 0x3099, 0x3070}, {0x306f, 0x309a, 0x3071},
+ {0x3072, 0x3099, 0x3073}, {0x3072, 0x309a, 0x3074},
+ {0x3075, 0x3099, 0x3076}, {0x3075, 0x309a, 0x3077},
+ {0x3078, 0x3099, 0x3079}, {0x3078, 0x309a, 0x307a},
+ {0x307b, 0x3099, 0x307c}, {0x307b, 0x309a, 0x307d},
+ {0x3046, 0x3099, 0x3094}, {0x309d, 0x3099, 0x309e},
+ {0x30ab, 0x3099, 0x30ac}, {0x30ad, 0x3099, 0x30ae},
+ {0x30af, 0x3099, 0x30b0}, {0x30b1, 0x3099, 0x30b2},
+ {0x30b3, 0x3099, 0x30b4}, {0x30b5, 0x3099, 0x30b6},
+ {0x30b7, 0x3099, 0x30b8}, {0x30b9, 0x3099, 0x30ba},
+ {0x30bb, 0x3099, 0x30bc}, {0x30bd, 0x3099, 0x30be},
+ {0x30bf, 0x3099, 0x30c0}, {0x30c1, 0x3099, 0x30c2},
+ {0x30c4, 0x3099, 0x30c5}, {0x30c6, 0x3099, 0x30c7},
+ {0x30c8, 0x3099, 0x30c9}, {0x30cf, 0x3099, 0x30d0},
+ {0x30cf, 0x309a, 0x30d1}, {0x30d2, 0x3099, 0x30d3},
+ {0x30d2, 0x309a, 0x30d4}, {0x30d5, 0x3099, 0x30d6},
+ {0x30d5, 0x309a, 0x30d7}, {0x30d8, 0x3099, 0x30d9},
+ {0x30d8, 0x309a, 0x30da}, {0x30db, 0x3099, 0x30dc},
+ {0x30db, 0x309a, 0x30dd}, {0x30a6, 0x3099, 0x30f4},
+ {0x30ef, 0x3099, 0x30f7}, {0x30f0, 0x3099, 0x30f8},
+ {0x30f1, 0x3099, 0x30f9}, {0x30f2, 0x3099, 0x30fa},
+ {0x30fd, 0x3099, 0x30fe}, {0x05d9, 0x05b4, 0xfb1d},
+};
+
+
+/*
+ * Canonical/Compatibility Decomposition
+ */
+
+#define DECOMPOSE_BM_SHIFT (16 - 10)
+
+static unsigned long canon_decompose_bitmap[] = {
+ 0x090be1f8, 0x60aae3b0, 0x00000001, 0xff000000,
+ 0x00001fd1, 0x00000000, 0x0000000e, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x000031f0,
+};
+
+static struct decomposition canon_decompose_seq[] = {
+ {0x00c0, 0, 2}, {0x00c1, 2, 2}, {0x00c2, 4, 2},
+ {0x00c3, 6, 2}, {0x00c4, 8, 2}, {0x00c5, 10, 2},
+ {0x00c7, 12, 2}, {0x00c8, 14, 2}, {0x00c9, 16, 2},
+ {0x00ca, 18, 2}, {0x00cb, 20, 2}, {0x00cc, 22, 2},
+ {0x00cd, 24, 2}, {0x00ce, 26, 2}, {0x00cf, 28, 2},
+ {0x00d1, 30, 2}, {0x00d2, 32, 2}, {0x00d3, 34, 2},
+ {0x00d4, 36, 2}, {0x00d5, 38, 2}, {0x00d6, 40, 2},
+ {0x00d9, 42, 2}, {0x00da, 44, 2}, {0x00db, 46, 2},
+ {0x00dc, 48, 2}, {0x00dd, 50, 2}, {0x00e0, 52, 2},
+ {0x00e1, 54, 2}, {0x00e2, 56, 2}, {0x00e3, 58, 2},
+ {0x00e4, 60, 2}, {0x00e5, 62, 2}, {0x00e7, 64, 2},
+ {0x00e8, 66, 2}, {0x00e9, 68, 2}, {0x00ea, 70, 2},
+ {0x00eb, 72, 2}, {0x00ec, 74, 2}, {0x00ed, 76, 2},
+ {0x00ee, 78, 2}, {0x00ef, 80, 2}, {0x00f1, 82, 2},
+ {0x00f2, 84, 2}, {0x00f3, 86, 2}, {0x00f4, 88, 2},
+ {0x00f5, 90, 2}, {0x00f6, 92, 2}, {0x00f9, 94, 2},
+ {0x00fa, 96, 2}, {0x00fb, 98, 2}, {0x00fc, 100, 2},
+ {0x00fd, 102, 2}, {0x00ff, 104, 2}, {0x0100, 106, 2},
+ {0x0101, 108, 2}, {0x0102, 110, 2}, {0x0103, 112, 2},
+ {0x0104, 114, 2}, {0x0105, 116, 2}, {0x0106, 118, 2},
+ {0x0107, 120, 2}, {0x0108, 122, 2}, {0x0109, 124, 2},
+ {0x010a, 126, 2}, {0x010b, 128, 2}, {0x010c, 130, 2},
+ {0x010d, 132, 2}, {0x010e, 134, 2}, {0x010f, 136, 2},
+ {0x0112, 138, 2}, {0x0113, 140, 2}, {0x0114, 142, 2},
+ {0x0115, 144, 2}, {0x0116, 146, 2}, {0x0117, 148, 2},
+ {0x0118, 150, 2}, {0x0119, 152, 2}, {0x011a, 154, 2},
+ {0x011b, 156, 2}, {0x011c, 158, 2}, {0x011d, 160, 2},
+ {0x011e, 162, 2}, {0x011f, 164, 2}, {0x0120, 166, 2},
+ {0x0121, 168, 2}, {0x0122, 170, 2}, {0x0123, 172, 2},
+ {0x0124, 174, 2}, {0x0125, 176, 2}, {0x0128, 178, 2},
+ {0x0129, 180, 2}, {0x012a, 182, 2}, {0x012b, 184, 2},
+ {0x012c, 186, 2}, {0x012d, 188, 2}, {0x012e, 190, 2},
+ {0x012f, 192, 2}, {0x0130, 194, 2}, {0x0134, 196, 2},
+ {0x0135, 198, 2}, {0x0136, 200, 2}, {0x0137, 202, 2},
+ {0x0139, 204, 2}, {0x013a, 206, 2}, {0x013b, 208, 2},
+ {0x013c, 210, 2}, {0x013d, 212, 2}, {0x013e, 214, 2},
+ {0x0143, 216, 2}, {0x0144, 218, 2}, {0x0145, 220, 2},
+ {0x0146, 222, 2}, {0x0147, 224, 2}, {0x0148, 226, 2},
+ {0x014c, 228, 2}, {0x014d, 230, 2}, {0x014e, 232, 2},
+ {0x014f, 234, 2}, {0x0150, 236, 2}, {0x0151, 238, 2},
+ {0x0154, 240, 2}, {0x0155, 242, 2}, {0x0156, 244, 2},
+ {0x0157, 246, 2}, {0x0158, 248, 2}, {0x0159, 250, 2},
+ {0x015a, 252, 2}, {0x015b, 254, 2}, {0x015c, 256, 2},
+ {0x015d, 258, 2}, {0x015e, 260, 2}, {0x015f, 262, 2},
+ {0x0160, 264, 2}, {0x0161, 266, 2}, {0x0162, 268, 2},
+ {0x0163, 270, 2}, {0x0164, 272, 2}, {0x0165, 274, 2},
+ {0x0168, 276, 2}, {0x0169, 278, 2}, {0x016a, 280, 2},
+ {0x016b, 282, 2}, {0x016c, 284, 2}, {0x016d, 286, 2},
+ {0x016e, 288, 2}, {0x016f, 290, 2}, {0x0170, 292, 2},
+ {0x0171, 294, 2}, {0x0172, 296, 2}, {0x0173, 298, 2},
+ {0x0174, 300, 2}, {0x0175, 302, 2}, {0x0176, 304, 2},
+ {0x0177, 306, 2}, {0x0178, 308, 2}, {0x0179, 310, 2},
+ {0x017a, 312, 2}, {0x017b, 314, 2}, {0x017c, 316, 2},
+ {0x017d, 318, 2}, {0x017e, 320, 2}, {0x01a0, 322, 2},
+ {0x01a1, 324, 2}, {0x01af, 326, 2}, {0x01b0, 328, 2},
+ {0x01cd, 330, 2}, {0x01ce, 332, 2}, {0x01cf, 334, 2},
+ {0x01d0, 336, 2}, {0x01d1, 338, 2}, {0x01d2, 340, 2},
+ {0x01d3, 342, 2}, {0x01d4, 344, 2}, {0x01d5, 346, 2},
+ {0x01d6, 348, 2}, {0x01d7, 350, 2}, {0x01d8, 352, 2},
+ {0x01d9, 354, 2}, {0x01da, 356, 2}, {0x01db, 358, 2},
+ {0x01dc, 360, 2}, {0x01de, 362, 2}, {0x01df, 364, 2},
+ {0x01e0, 366, 2}, {0x01e1, 368, 2}, {0x01e2, 370, 2},
+ {0x01e3, 372, 2}, {0x01e6, 374, 2}, {0x01e7, 376, 2},
+ {0x01e8, 378, 2}, {0x01e9, 380, 2}, {0x01ea, 382, 2},
+ {0x01eb, 384, 2}, {0x01ec, 386, 2}, {0x01ed, 388, 2},
+ {0x01ee, 390, 2}, {0x01ef, 392, 2}, {0x01f0, 394, 2},
+ {0x01f4, 396, 2}, {0x01f5, 398, 2}, {0x01f8, 400, 2},
+ {0x01f9, 402, 2}, {0x01fa, 404, 2}, {0x01fb, 406, 2},
+ {0x01fc, 408, 2}, {0x01fd, 410, 2}, {0x01fe, 412, 2},
+ {0x01ff, 414, 2}, {0x0200, 416, 2}, {0x0201, 418, 2},
+ {0x0202, 420, 2}, {0x0203, 422, 2}, {0x0204, 424, 2},
+ {0x0205, 426, 2}, {0x0206, 428, 2}, {0x0207, 430, 2},
+ {0x0208, 432, 2}, {0x0209, 434, 2}, {0x020a, 436, 2},
+ {0x020b, 438, 2}, {0x020c, 440, 2}, {0x020d, 442, 2},
+ {0x020e, 444, 2}, {0x020f, 446, 2}, {0x0210, 448, 2},
+ {0x0211, 450, 2}, {0x0212, 452, 2}, {0x0213, 454, 2},
+ {0x0214, 456, 2}, {0x0215, 458, 2}, {0x0216, 460, 2},
+ {0x0217, 462, 2}, {0x0218, 464, 2}, {0x0219, 466, 2},
+ {0x021a, 468, 2}, {0x021b, 470, 2}, {0x021e, 472, 2},
+ {0x021f, 474, 2}, {0x0226, 476, 2}, {0x0227, 478, 2},
+ {0x0228, 480, 2}, {0x0229, 482, 2}, {0x022a, 484, 2},
+ {0x022b, 486, 2}, {0x022c, 488, 2}, {0x022d, 490, 2},
+ {0x022e, 492, 2}, {0x022f, 494, 2}, {0x0230, 496, 2},
+ {0x0231, 498, 2}, {0x0232, 500, 2}, {0x0233, 502, 2},
+ {0x0340, 504, 1}, {0x0341, 505, 1}, {0x0343, 506, 1},
+ {0x0344, 507, 2}, {0x0374, 509, 1}, {0x037e, 510, 1},
+ {0x0385, 511, 2}, {0x0386, 513, 2}, {0x0387, 515, 1},
+ {0x0388, 516, 2}, {0x0389, 518, 2}, {0x038a, 520, 2},
+ {0x038c, 522, 2}, {0x038e, 524, 2}, {0x038f, 526, 2},
+ {0x0390, 528, 2}, {0x03aa, 530, 2}, {0x03ab, 532, 2},
+ {0x03ac, 534, 2}, {0x03ad, 536, 2}, {0x03ae, 538, 2},
+ {0x03af, 540, 2}, {0x03b0, 542, 2}, {0x03ca, 544, 2},
+ {0x03cb, 546, 2}, {0x03cc, 548, 2}, {0x03cd, 550, 2},
+ {0x03ce, 552, 2}, {0x03d3, 554, 2}, {0x03d4, 556, 2},
+ {0x0400, 558, 2}, {0x0401, 560, 2}, {0x0403, 562, 2},
+ {0x0407, 564, 2}, {0x040c, 566, 2}, {0x040d, 568, 2},
+ {0x040e, 570, 2}, {0x0419, 572, 2}, {0x0439, 574, 2},
+ {0x0450, 576, 2}, {0x0451, 578, 2}, {0x0453, 580, 2},
+ {0x0457, 582, 2}, {0x045c, 584, 2}, {0x045d, 586, 2},
+ {0x045e, 588, 2}, {0x0476, 590, 2}, {0x0477, 592, 2},
+ {0x04c1, 594, 2}, {0x04c2, 596, 2}, {0x04d0, 598, 2},
+ {0x04d1, 600, 2}, {0x04d2, 602, 2}, {0x04d3, 604, 2},
+ {0x04d6, 606, 2}, {0x04d7, 608, 2}, {0x04da, 610, 2},
+ {0x04db, 612, 2}, {0x04dc, 614, 2}, {0x04dd, 616, 2},
+ {0x04de, 618, 2}, {0x04df, 620, 2}, {0x04e2, 622, 2},
+ {0x04e3, 624, 2}, {0x04e4, 626, 2}, {0x04e5, 628, 2},
+ {0x04e6, 630, 2}, {0x04e7, 632, 2}, {0x04ea, 634, 2},
+ {0x04eb, 636, 2}, {0x04ec, 638, 2}, {0x04ed, 640, 2},
+ {0x04ee, 642, 2}, {0x04ef, 644, 2}, {0x04f0, 646, 2},
+ {0x04f1, 648, 2}, {0x04f2, 650, 2}, {0x04f3, 652, 2},
+ {0x04f4, 654, 2}, {0x04f5, 656, 2}, {0x04f8, 658, 2},
+ {0x04f9, 660, 2}, {0x0622, 662, 2}, {0x0623, 664, 2},
+ {0x0624, 666, 2}, {0x0625, 668, 2}, {0x0626, 670, 2},
+ {0x06c0, 672, 2}, {0x06c2, 674, 2}, {0x06d3, 676, 2},
+ {0x0929, 678, 2}, {0x0931, 680, 2}, {0x0934, 682, 2},
+ {0x0958, 684, 2}, {0x0959, 686, 2}, {0x095a, 688, 2},
+ {0x095b, 690, 2}, {0x095c, 692, 2}, {0x095d, 694, 2},
+ {0x095e, 696, 2}, {0x095f, 698, 2}, {0x09cb, 700, 2},
+ {0x09cc, 702, 2}, {0x09dc, 704, 2}, {0x09dd, 706, 2},
+ {0x09df, 708, 2}, {0x0a33, 710, 2}, {0x0a36, 712, 2},
+ {0x0a59, 714, 2}, {0x0a5a, 716, 2}, {0x0a5b, 718, 2},
+ {0x0a5e, 720, 2}, {0x0b48, 722, 2}, {0x0b4b, 724, 2},
+ {0x0b4c, 726, 2}, {0x0b5c, 728, 2}, {0x0b5d, 730, 2},
+ {0x0b94, 732, 2}, {0x0bca, 734, 2}, {0x0bcb, 736, 2},
+ {0x0bcc, 738, 2}, {0x0c48, 740, 2}, {0x0cc0, 742, 2},
+ {0x0cc7, 744, 2}, {0x0cc8, 746, 2}, {0x0cca, 748, 2},
+ {0x0ccb, 750, 2}, {0x0d4a, 752, 2}, {0x0d4b, 754, 2},
+ {0x0d4c, 756, 2}, {0x0dda, 758, 2}, {0x0ddc, 760, 2},
+ {0x0ddd, 762, 2}, {0x0dde, 764, 2}, {0x0f43, 766, 2},
+ {0x0f4d, 768, 2}, {0x0f52, 770, 2}, {0x0f57, 772, 2},
+ {0x0f5c, 774, 2}, {0x0f69, 776, 2}, {0x0f73, 778, 2},
+ {0x0f75, 780, 2}, {0x0f76, 782, 2}, {0x0f78, 784, 2},
+ {0x0f81, 786, 2}, {0x0f93, 788, 2}, {0x0f9d, 790, 2},
+ {0x0fa2, 792, 2}, {0x0fa7, 794, 2}, {0x0fac, 796, 2},
+ {0x0fb9, 798, 2}, {0x1026, 800, 2}, {0x1e00, 802, 2},
+ {0x1e01, 804, 2}, {0x1e02, 806, 2}, {0x1e03, 808, 2},
+ {0x1e04, 810, 2}, {0x1e05, 812, 2}, {0x1e06, 814, 2},
+ {0x1e07, 816, 2}, {0x1e08, 818, 2}, {0x1e09, 820, 2},
+ {0x1e0a, 822, 2}, {0x1e0b, 824, 2}, {0x1e0c, 826, 2},
+ {0x1e0d, 828, 2}, {0x1e0e, 830, 2}, {0x1e0f, 832, 2},
+ {0x1e10, 834, 2}, {0x1e11, 836, 2}, {0x1e12, 838, 2},
+ {0x1e13, 840, 2}, {0x1e14, 842, 2}, {0x1e15, 844, 2},
+ {0x1e16, 846, 2}, {0x1e17, 848, 2}, {0x1e18, 850, 2},
+ {0x1e19, 852, 2}, {0x1e1a, 854, 2}, {0x1e1b, 856, 2},
+ {0x1e1c, 858, 2}, {0x1e1d, 860, 2}, {0x1e1e, 862, 2},
+ {0x1e1f, 864, 2}, {0x1e20, 866, 2}, {0x1e21, 868, 2},
+ {0x1e22, 870, 2}, {0x1e23, 872, 2}, {0x1e24, 874, 2},
+ {0x1e25, 876, 2}, {0x1e26, 878, 2}, {0x1e27, 880, 2},
+ {0x1e28, 882, 2}, {0x1e29, 884, 2}, {0x1e2a, 886, 2},
+ {0x1e2b, 888, 2}, {0x1e2c, 890, 2}, {0x1e2d, 892, 2},
+ {0x1e2e, 894, 2}, {0x1e2f, 896, 2}, {0x1e30, 898, 2},
+ {0x1e31, 900, 2}, {0x1e32, 902, 2}, {0x1e33, 904, 2},
+ {0x1e34, 906, 2}, {0x1e35, 908, 2}, {0x1e36, 910, 2},
+ {0x1e37, 912, 2}, {0x1e38, 914, 2}, {0x1e39, 916, 2},
+ {0x1e3a, 918, 2}, {0x1e3b, 920, 2}, {0x1e3c, 922, 2},
+ {0x1e3d, 924, 2}, {0x1e3e, 926, 2}, {0x1e3f, 928, 2},
+ {0x1e40, 930, 2}, {0x1e41, 932, 2}, {0x1e42, 934, 2},
+ {0x1e43, 936, 2}, {0x1e44, 938, 2}, {0x1e45, 940, 2},
+ {0x1e46, 942, 2}, {0x1e47, 944, 2}, {0x1e48, 946, 2},
+ {0x1e49, 948, 2}, {0x1e4a, 950, 2}, {0x1e4b, 952, 2},
+ {0x1e4c, 954, 2}, {0x1e4d, 956, 2}, {0x1e4e, 958, 2},
+ {0x1e4f, 960, 2}, {0x1e50, 962, 2}, {0x1e51, 964, 2},
+ {0x1e52, 966, 2}, {0x1e53, 968, 2}, {0x1e54, 970, 2},
+ {0x1e55, 972, 2}, {0x1e56, 974, 2}, {0x1e57, 976, 2},
+ {0x1e58, 978, 2}, {0x1e59, 980, 2}, {0x1e5a, 982, 2},
+ {0x1e5b, 984, 2}, {0x1e5c, 986, 2}, {0x1e5d, 988, 2},
+ {0x1e5e, 990, 2}, {0x1e5f, 992, 2}, {0x1e60, 994, 2},
+ {0x1e61, 996, 2}, {0x1e62, 998, 2}, {0x1e63, 1000, 2},
+ {0x1e64, 1002, 2}, {0x1e65, 1004, 2}, {0x1e66, 1006, 2},
+ {0x1e67, 1008, 2}, {0x1e68, 1010, 2}, {0x1e69, 1012, 2},
+ {0x1e6a, 1014, 2}, {0x1e6b, 1016, 2}, {0x1e6c, 1018, 2},
+ {0x1e6d, 1020, 2}, {0x1e6e, 1022, 2}, {0x1e6f, 1024, 2},
+ {0x1e70, 1026, 2}, {0x1e71, 1028, 2}, {0x1e72, 1030, 2},
+ {0x1e73, 1032, 2}, {0x1e74, 1034, 2}, {0x1e75, 1036, 2},
+ {0x1e76, 1038, 2}, {0x1e77, 1040, 2}, {0x1e78, 1042, 2},
+ {0x1e79, 1044, 2}, {0x1e7a, 1046, 2}, {0x1e7b, 1048, 2},
+ {0x1e7c, 1050, 2}, {0x1e7d, 1052, 2}, {0x1e7e, 1054, 2},
+ {0x1e7f, 1056, 2}, {0x1e80, 1058, 2}, {0x1e81, 1060, 2},
+ {0x1e82, 1062, 2}, {0x1e83, 1064, 2}, {0x1e84, 1066, 2},
+ {0x1e85, 1068, 2}, {0x1e86, 1070, 2}, {0x1e87, 1072, 2},
+ {0x1e88, 1074, 2}, {0x1e89, 1076, 2}, {0x1e8a, 1078, 2},
+ {0x1e8b, 1080, 2}, {0x1e8c, 1082, 2}, {0x1e8d, 1084, 2},
+ {0x1e8e, 1086, 2}, {0x1e8f, 1088, 2}, {0x1e90, 1090, 2},
+ {0x1e91, 1092, 2}, {0x1e92, 1094, 2}, {0x1e93, 1096, 2},
+ {0x1e94, 1098, 2}, {0x1e95, 1100, 2}, {0x1e96, 1102, 2},
+ {0x1e97, 1104, 2}, {0x1e98, 1106, 2}, {0x1e99, 1108, 2},
+ {0x1e9b, 1110, 2}, {0x1ea0, 1112, 2}, {0x1ea1, 1114, 2},
+ {0x1ea2, 1116, 2}, {0x1ea3, 1118, 2}, {0x1ea4, 1120, 2},
+ {0x1ea5, 1122, 2}, {0x1ea6, 1124, 2}, {0x1ea7, 1126, 2},
+ {0x1ea8, 1128, 2}, {0x1ea9, 1130, 2}, {0x1eaa, 1132, 2},
+ {0x1eab, 1134, 2}, {0x1eac, 1136, 2}, {0x1ead, 1138, 2},
+ {0x1eae, 1140, 2}, {0x1eaf, 1142, 2}, {0x1eb0, 1144, 2},
+ {0x1eb1, 1146, 2}, {0x1eb2, 1148, 2}, {0x1eb3, 1150, 2},
+ {0x1eb4, 1152, 2}, {0x1eb5, 1154, 2}, {0x1eb6, 1156, 2},
+ {0x1eb7, 1158, 2}, {0x1eb8, 1160, 2}, {0x1eb9, 1162, 2},
+ {0x1eba, 1164, 2}, {0x1ebb, 1166, 2}, {0x1ebc, 1168, 2},
+ {0x1ebd, 1170, 2}, {0x1ebe, 1172, 2}, {0x1ebf, 1174, 2},
+ {0x1ec0, 1176, 2}, {0x1ec1, 1178, 2}, {0x1ec2, 1180, 2},
+ {0x1ec3, 1182, 2}, {0x1ec4, 1184, 2}, {0x1ec5, 1186, 2},
+ {0x1ec6, 1188, 2}, {0x1ec7, 1190, 2}, {0x1ec8, 1192, 2},
+ {0x1ec9, 1194, 2}, {0x1eca, 1196, 2}, {0x1ecb, 1198, 2},
+ {0x1ecc, 1200, 2}, {0x1ecd, 1202, 2}, {0x1ece, 1204, 2},
+ {0x1ecf, 1206, 2}, {0x1ed0, 1208, 2}, {0x1ed1, 1210, 2},
+ {0x1ed2, 1212, 2}, {0x1ed3, 1214, 2}, {0x1ed4, 1216, 2},
+ {0x1ed5, 1218, 2}, {0x1ed6, 1220, 2}, {0x1ed7, 1222, 2},
+ {0x1ed8, 1224, 2}, {0x1ed9, 1226, 2}, {0x1eda, 1228, 2},
+ {0x1edb, 1230, 2}, {0x1edc, 1232, 2}, {0x1edd, 1234, 2},
+ {0x1ede, 1236, 2}, {0x1edf, 1238, 2}, {0x1ee0, 1240, 2},
+ {0x1ee1, 1242, 2}, {0x1ee2, 1244, 2}, {0x1ee3, 1246, 2},
+ {0x1ee4, 1248, 2}, {0x1ee5, 1250, 2}, {0x1ee6, 1252, 2},
+ {0x1ee7, 1254, 2}, {0x1ee8, 1256, 2}, {0x1ee9, 1258, 2},
+ {0x1eea, 1260, 2}, {0x1eeb, 1262, 2}, {0x1eec, 1264, 2},
+ {0x1eed, 1266, 2}, {0x1eee, 1268, 2}, {0x1eef, 1270, 2},
+ {0x1ef0, 1272, 2}, {0x1ef1, 1274, 2}, {0x1ef2, 1276, 2},
+ {0x1ef3, 1278, 2}, {0x1ef4, 1280, 2}, {0x1ef5, 1282, 2},
+ {0x1ef6, 1284, 2}, {0x1ef7, 1286, 2}, {0x1ef8, 1288, 2},
+ {0x1ef9, 1290, 2}, {0x1f00, 1292, 2}, {0x1f01, 1294, 2},
+ {0x1f02, 1296, 2}, {0x1f03, 1298, 2}, {0x1f04, 1300, 2},
+ {0x1f05, 1302, 2}, {0x1f06, 1304, 2}, {0x1f07, 1306, 2},
+ {0x1f08, 1308, 2}, {0x1f09, 1310, 2}, {0x1f0a, 1312, 2},
+ {0x1f0b, 1314, 2}, {0x1f0c, 1316, 2}, {0x1f0d, 1318, 2},
+ {0x1f0e, 1320, 2}, {0x1f0f, 1322, 2}, {0x1f10, 1324, 2},
+ {0x1f11, 1326, 2}, {0x1f12, 1328, 2}, {0x1f13, 1330, 2},
+ {0x1f14, 1332, 2}, {0x1f15, 1334, 2}, {0x1f18, 1336, 2},
+ {0x1f19, 1338, 2}, {0x1f1a, 1340, 2}, {0x1f1b, 1342, 2},
+ {0x1f1c, 1344, 2}, {0x1f1d, 1346, 2}, {0x1f20, 1348, 2},
+ {0x1f21, 1350, 2}, {0x1f22, 1352, 2}, {0x1f23, 1354, 2},
+ {0x1f24, 1356, 2}, {0x1f25, 1358, 2}, {0x1f26, 1360, 2},
+ {0x1f27, 1362, 2}, {0x1f28, 1364, 2}, {0x1f29, 1366, 2},
+ {0x1f2a, 1368, 2}, {0x1f2b, 1370, 2}, {0x1f2c, 1372, 2},
+ {0x1f2d, 1374, 2}, {0x1f2e, 1376, 2}, {0x1f2f, 1378, 2},
+ {0x1f30, 1380, 2}, {0x1f31, 1382, 2}, {0x1f32, 1384, 2},
+ {0x1f33, 1386, 2}, {0x1f34, 1388, 2}, {0x1f35, 1390, 2},
+ {0x1f36, 1392, 2}, {0x1f37, 1394, 2}, {0x1f38, 1396, 2},
+ {0x1f39, 1398, 2}, {0x1f3a, 1400, 2}, {0x1f3b, 1402, 2},
+ {0x1f3c, 1404, 2}, {0x1f3d, 1406, 2}, {0x1f3e, 1408, 2},
+ {0x1f3f, 1410, 2}, {0x1f40, 1412, 2}, {0x1f41, 1414, 2},
+ {0x1f42, 1416, 2}, {0x1f43, 1418, 2}, {0x1f44, 1420, 2},
+ {0x1f45, 1422, 2}, {0x1f48, 1424, 2}, {0x1f49, 1426, 2},
+ {0x1f4a, 1428, 2}, {0x1f4b, 1430, 2}, {0x1f4c, 1432, 2},
+ {0x1f4d, 1434, 2}, {0x1f50, 1436, 2}, {0x1f51, 1438, 2},
+ {0x1f52, 1440, 2}, {0x1f53, 1442, 2}, {0x1f54, 1444, 2},
+ {0x1f55, 1446, 2}, {0x1f56, 1448, 2}, {0x1f57, 1450, 2},
+ {0x1f59, 1452, 2}, {0x1f5b, 1454, 2}, {0x1f5d, 1456, 2},
+ {0x1f5f, 1458, 2}, {0x1f60, 1460, 2}, {0x1f61, 1462, 2},
+ {0x1f62, 1464, 2}, {0x1f63, 1466, 2}, {0x1f64, 1468, 2},
+ {0x1f65, 1470, 2}, {0x1f66, 1472, 2}, {0x1f67, 1474, 2},
+ {0x1f68, 1476, 2}, {0x1f69, 1478, 2}, {0x1f6a, 1480, 2},
+ {0x1f6b, 1482, 2}, {0x1f6c, 1484, 2}, {0x1f6d, 1486, 2},
+ {0x1f6e, 1488, 2}, {0x1f6f, 1490, 2}, {0x1f70, 1492, 2},
+ {0x1f71, 1494, 1}, {0x1f72, 1495, 2}, {0x1f73, 1497, 1},
+ {0x1f74, 1498, 2}, {0x1f75, 1500, 1}, {0x1f76, 1501, 2},
+ {0x1f77, 1503, 1}, {0x1f78, 1504, 2}, {0x1f79, 1506, 1},
+ {0x1f7a, 1507, 2}, {0x1f7b, 1509, 1}, {0x1f7c, 1510, 2},
+ {0x1f7d, 1512, 1}, {0x1f80, 1513, 2}, {0x1f81, 1515, 2},
+ {0x1f82, 1517, 2}, {0x1f83, 1519, 2}, {0x1f84, 1521, 2},
+ {0x1f85, 1523, 2}, {0x1f86, 1525, 2}, {0x1f87, 1527, 2},
+ {0x1f88, 1529, 2}, {0x1f89, 1531, 2}, {0x1f8a, 1533, 2},
+ {0x1f8b, 1535, 2}, {0x1f8c, 1537, 2}, {0x1f8d, 1539, 2},
+ {0x1f8e, 1541, 2}, {0x1f8f, 1543, 2}, {0x1f90, 1545, 2},
+ {0x1f91, 1547, 2}, {0x1f92, 1549, 2}, {0x1f93, 1551, 2},
+ {0x1f94, 1553, 2}, {0x1f95, 1555, 2}, {0x1f96, 1557, 2},
+ {0x1f97, 1559, 2}, {0x1f98, 1561, 2}, {0x1f99, 1563, 2},
+ {0x1f9a, 1565, 2}, {0x1f9b, 1567, 2}, {0x1f9c, 1569, 2},
+ {0x1f9d, 1571, 2}, {0x1f9e, 1573, 2}, {0x1f9f, 1575, 2},
+ {0x1fa0, 1577, 2}, {0x1fa1, 1579, 2}, {0x1fa2, 1581, 2},
+ {0x1fa3, 1583, 2}, {0x1fa4, 1585, 2}, {0x1fa5, 1587, 2},
+ {0x1fa6, 1589, 2}, {0x1fa7, 1591, 2}, {0x1fa8, 1593, 2},
+ {0x1fa9, 1595, 2}, {0x1faa, 1597, 2}, {0x1fab, 1599, 2},
+ {0x1fac, 1601, 2}, {0x1fad, 1603, 2}, {0x1fae, 1605, 2},
+ {0x1faf, 1607, 2}, {0x1fb0, 1609, 2}, {0x1fb1, 1611, 2},
+ {0x1fb2, 1613, 2}, {0x1fb3, 1615, 2}, {0x1fb4, 1617, 2},
+ {0x1fb6, 1619, 2}, {0x1fb7, 1621, 2}, {0x1fb8, 1623, 2},
+ {0x1fb9, 1625, 2}, {0x1fba, 1627, 2}, {0x1fbb, 1629, 1},
+ {0x1fbc, 1630, 2}, {0x1fbe, 1632, 1}, {0x1fc1, 1633, 2},
+ {0x1fc2, 1635, 2}, {0x1fc3, 1637, 2}, {0x1fc4, 1639, 2},
+ {0x1fc6, 1641, 2}, {0x1fc7, 1643, 2}, {0x1fc8, 1645, 2},
+ {0x1fc9, 1647, 1}, {0x1fca, 1648, 2}, {0x1fcb, 1650, 1},
+ {0x1fcc, 1651, 2}, {0x1fcd, 1653, 2}, {0x1fce, 1655, 2},
+ {0x1fcf, 1657, 2}, {0x1fd0, 1659, 2}, {0x1fd1, 1661, 2},
+ {0x1fd2, 1663, 2}, {0x1fd3, 1665, 1}, {0x1fd6, 1666, 2},
+ {0x1fd7, 1668, 2}, {0x1fd8, 1670, 2}, {0x1fd9, 1672, 2},
+ {0x1fda, 1674, 2}, {0x1fdb, 1676, 1}, {0x1fdd, 1677, 2},
+ {0x1fde, 1679, 2}, {0x1fdf, 1681, 2}, {0x1fe0, 1683, 2},
+ {0x1fe1, 1685, 2}, {0x1fe2, 1687, 2}, {0x1fe3, 1689, 1},
+ {0x1fe4, 1690, 2}, {0x1fe5, 1692, 2}, {0x1fe6, 1694, 2},
+ {0x1fe7, 1696, 2}, {0x1fe8, 1698, 2}, {0x1fe9, 1700, 2},
+ {0x1fea, 1702, 2}, {0x1feb, 1704, 1}, {0x1fec, 1705, 2},
+ {0x1fed, 1707, 2}, {0x1fee, 1709, 1}, {0x1fef, 1710, 1},
+ {0x1ff2, 1711, 2}, {0x1ff3, 1713, 2}, {0x1ff4, 1715, 2},
+ {0x1ff6, 1717, 2}, {0x1ff7, 1719, 2}, {0x1ff8, 1721, 2},
+ {0x1ff9, 1723, 1}, {0x1ffa, 1724, 2}, {0x1ffb, 1726, 1},
+ {0x1ffc, 1727, 2}, {0x1ffd, 1729, 1}, {0x2000, 1730, 1},
+ {0x2001, 1731, 1}, {0x2126, 1732, 1}, {0x212a, 1733, 1},
+ {0x212b, 1734, 1}, {0x219a, 1735, 2}, {0x219b, 1737, 2},
+ {0x21ae, 1739, 2}, {0x21cd, 1741, 2}, {0x21ce, 1743, 2},
+ {0x21cf, 1745, 2}, {0x2204, 1747, 2}, {0x2209, 1749, 2},
+ {0x220c, 1751, 2}, {0x2224, 1753, 2}, {0x2226, 1755, 2},
+ {0x2241, 1757, 2}, {0x2244, 1759, 2}, {0x2247, 1761, 2},
+ {0x2249, 1763, 2}, {0x2260, 1765, 2}, {0x2262, 1767, 2},
+ {0x226d, 1769, 2}, {0x226e, 1771, 2}, {0x226f, 1773, 2},
+ {0x2270, 1775, 2}, {0x2271, 1777, 2}, {0x2274, 1779, 2},
+ {0x2275, 1781, 2}, {0x2278, 1783, 2}, {0x2279, 1785, 2},
+ {0x2280, 1787, 2}, {0x2281, 1789, 2}, {0x2284, 1791, 2},
+ {0x2285, 1793, 2}, {0x2288, 1795, 2}, {0x2289, 1797, 2},
+ {0x22ac, 1799, 2}, {0x22ad, 1801, 2}, {0x22ae, 1803, 2},
+ {0x22af, 1805, 2}, {0x22e0, 1807, 2}, {0x22e1, 1809, 2},
+ {0x22e2, 1811, 2}, {0x22e3, 1813, 2}, {0x22ea, 1815, 2},
+ {0x22eb, 1817, 2}, {0x22ec, 1819, 2}, {0x22ed, 1821, 2},
+ {0x2329, 1823, 1}, {0x232a, 1824, 1}, {0x304c, 1825, 2},
+ {0x304e, 1827, 2}, {0x3050, 1829, 2}, {0x3052, 1831, 2},
+ {0x3054, 1833, 2}, {0x3056, 1835, 2}, {0x3058, 1837, 2},
+ {0x305a, 1839, 2}, {0x305c, 1841, 2}, {0x305e, 1843, 2},
+ {0x3060, 1845, 2}, {0x3062, 1847, 2}, {0x3065, 1849, 2},
+ {0x3067, 1851, 2}, {0x3069, 1853, 2}, {0x3070, 1855, 2},
+ {0x3071, 1857, 2}, {0x3073, 1859, 2}, {0x3074, 1861, 2},
+ {0x3076, 1863, 2}, {0x3077, 1865, 2}, {0x3079, 1867, 2},
+ {0x307a, 1869, 2}, {0x307c, 1871, 2}, {0x307d, 1873, 2},
+ {0x3094, 1875, 2}, {0x309e, 1877, 2}, {0x30ac, 1879, 2},
+ {0x30ae, 1881, 2}, {0x30b0, 1883, 2}, {0x30b2, 1885, 2},
+ {0x30b4, 1887, 2}, {0x30b6, 1889, 2}, {0x30b8, 1891, 2},
+ {0x30ba, 1893, 2}, {0x30bc, 1895, 2}, {0x30be, 1897, 2},
+ {0x30c0, 1899, 2}, {0x30c2, 1901, 2}, {0x30c5, 1903, 2},
+ {0x30c7, 1905, 2}, {0x30c9, 1907, 2}, {0x30d0, 1909, 2},
+ {0x30d1, 1911, 2}, {0x30d3, 1913, 2}, {0x30d4, 1915, 2},
+ {0x30d6, 1917, 2}, {0x30d7, 1919, 2}, {0x30d9, 1921, 2},
+ {0x30da, 1923, 2}, {0x30dc, 1925, 2}, {0x30dd, 1927, 2},
+ {0x30f4, 1929, 2}, {0x30f7, 1931, 2}, {0x30f8, 1933, 2},
+ {0x30f9, 1935, 2}, {0x30fa, 1937, 2}, {0x30fe, 1939, 2},
+ {0xf900, 1941, 1}, {0xf901, 1942, 1}, {0xf902, 1943, 1},
+ {0xf903, 1944, 1}, {0xf904, 1945, 1}, {0xf905, 1946, 1},
+ {0xf906, 1947, 1}, {0xf907, 1948, 1}, {0xf908, 1949, 1},
+ {0xf909, 1950, 1}, {0xf90a, 1951, 1}, {0xf90b, 1952, 1},
+ {0xf90c, 1953, 1}, {0xf90d, 1954, 1}, {0xf90e, 1955, 1},
+ {0xf90f, 1956, 1}, {0xf910, 1957, 1}, {0xf911, 1958, 1},
+ {0xf912, 1959, 1}, {0xf913, 1960, 1}, {0xf914, 1961, 1},
+ {0xf915, 1962, 1}, {0xf916, 1963, 1}, {0xf917, 1964, 1},
+ {0xf918, 1965, 1}, {0xf919, 1966, 1}, {0xf91a, 1967, 1},
+ {0xf91b, 1968, 1}, {0xf91c, 1969, 1}, {0xf91d, 1970, 1},
+ {0xf91e, 1971, 1}, {0xf91f, 1972, 1}, {0xf920, 1973, 1},
+ {0xf921, 1974, 1}, {0xf922, 1975, 1}, {0xf923, 1976, 1},
+ {0xf924, 1977, 1}, {0xf925, 1978, 1}, {0xf926, 1979, 1},
+ {0xf927, 1980, 1}, {0xf928, 1981, 1}, {0xf929, 1982, 1},
+ {0xf92a, 1983, 1}, {0xf92b, 1984, 1}, {0xf92c, 1985, 1},
+ {0xf92d, 1986, 1}, {0xf92e, 1987, 1}, {0xf92f, 1988, 1},
+ {0xf930, 1989, 1}, {0xf931, 1990, 1}, {0xf932, 1991, 1},
+ {0xf933, 1992, 1}, {0xf934, 1993, 1}, {0xf935, 1994, 1},
+ {0xf936, 1995, 1}, {0xf937, 1996, 1}, {0xf938, 1997, 1},
+ {0xf939, 1998, 1}, {0xf93a, 1999, 1}, {0xf93b, 2000, 1},
+ {0xf93c, 2001, 1}, {0xf93d, 2002, 1}, {0xf93e, 2003, 1},
+ {0xf93f, 2004, 1}, {0xf940, 2005, 1}, {0xf941, 2006, 1},
+ {0xf942, 2007, 1}, {0xf943, 2008, 1}, {0xf944, 2009, 1},
+ {0xf945, 2010, 1}, {0xf946, 2011, 1}, {0xf947, 2012, 1},
+ {0xf948, 2013, 1}, {0xf949, 2014, 1}, {0xf94a, 2015, 1},
+ {0xf94b, 2016, 1}, {0xf94c, 2017, 1}, {0xf94d, 2018, 1},
+ {0xf94e, 2019, 1}, {0xf94f, 2020, 1}, {0xf950, 2021, 1},
+ {0xf951, 2022, 1}, {0xf952, 2023, 1}, {0xf953, 2024, 1},
+ {0xf954, 2025, 1}, {0xf955, 2026, 1}, {0xf956, 2027, 1},
+ {0xf957, 2028, 1}, {0xf958, 2029, 1}, {0xf959, 2030, 1},
+ {0xf95a, 2031, 1}, {0xf95b, 2032, 1}, {0xf95c, 2033, 1},
+ {0xf95d, 2034, 1}, {0xf95e, 2035, 1}, {0xf95f, 2036, 1},
+ {0xf960, 2037, 1}, {0xf961, 2038, 1}, {0xf962, 2039, 1},
+ {0xf963, 2040, 1}, {0xf964, 2041, 1}, {0xf965, 2042, 1},
+ {0xf966, 2043, 1}, {0xf967, 2044, 1}, {0xf968, 2045, 1},
+ {0xf969, 2046, 1}, {0xf96a, 2047, 1}, {0xf96b, 2048, 1},
+ {0xf96c, 2049, 1}, {0xf96d, 2050, 1}, {0xf96e, 2051, 1},
+ {0xf96f, 2052, 1}, {0xf970, 2053, 1}, {0xf971, 2054, 1},
+ {0xf972, 2055, 1}, {0xf973, 2056, 1}, {0xf974, 2057, 1},
+ {0xf975, 2058, 1}, {0xf976, 2059, 1}, {0xf977, 2060, 1},
+ {0xf978, 2061, 1}, {0xf979, 2062, 1}, {0xf97a, 2063, 1},
+ {0xf97b, 2064, 1}, {0xf97c, 2065, 1}, {0xf97d, 2066, 1},
+ {0xf97e, 2067, 1}, {0xf97f, 2068, 1}, {0xf980, 2069, 1},
+ {0xf981, 2070, 1}, {0xf982, 2071, 1}, {0xf983, 2072, 1},
+ {0xf984, 2073, 1}, {0xf985, 2074, 1}, {0xf986, 2075, 1},
+ {0xf987, 2076, 1}, {0xf988, 2077, 1}, {0xf989, 2078, 1},
+ {0xf98a, 2079, 1}, {0xf98b, 2080, 1}, {0xf98c, 2081, 1},
+ {0xf98d, 2082, 1}, {0xf98e, 2083, 1}, {0xf98f, 2084, 1},
+ {0xf990, 2085, 1}, {0xf991, 2086, 1}, {0xf992, 2087, 1},
+ {0xf993, 2088, 1}, {0xf994, 2089, 1}, {0xf995, 2090, 1},
+ {0xf996, 2091, 1}, {0xf997, 2092, 1}, {0xf998, 2093, 1},
+ {0xf999, 2094, 1}, {0xf99a, 2095, 1}, {0xf99b, 2096, 1},
+ {0xf99c, 2097, 1}, {0xf99d, 2098, 1}, {0xf99e, 2099, 1},
+ {0xf99f, 2100, 1}, {0xf9a0, 2101, 1}, {0xf9a1, 2102, 1},
+ {0xf9a2, 2103, 1}, {0xf9a3, 2104, 1}, {0xf9a4, 2105, 1},
+ {0xf9a5, 2106, 1}, {0xf9a6, 2107, 1}, {0xf9a7, 2108, 1},
+ {0xf9a8, 2109, 1}, {0xf9a9, 2110, 1}, {0xf9aa, 2111, 1},
+ {0xf9ab, 2112, 1}, {0xf9ac, 2113, 1}, {0xf9ad, 2114, 1},
+ {0xf9ae, 2115, 1}, {0xf9af, 2116, 1}, {0xf9b0, 2117, 1},
+ {0xf9b1, 2118, 1}, {0xf9b2, 2119, 1}, {0xf9b3, 2120, 1},
+ {0xf9b4, 2121, 1}, {0xf9b5, 2122, 1}, {0xf9b6, 2123, 1},
+ {0xf9b7, 2124, 1}, {0xf9b8, 2125, 1}, {0xf9b9, 2126, 1},
+ {0xf9ba, 2127, 1}, {0xf9bb, 2128, 1}, {0xf9bc, 2129, 1},
+ {0xf9bd, 2130, 1}, {0xf9be, 2131, 1}, {0xf9bf, 2132, 1},
+ {0xf9c0, 2133, 1}, {0xf9c1, 2134, 1}, {0xf9c2, 2135, 1},
+ {0xf9c3, 2136, 1}, {0xf9c4, 2137, 1}, {0xf9c5, 2138, 1},
+ {0xf9c6, 2139, 1}, {0xf9c7, 2140, 1}, {0xf9c8, 2141, 1},
+ {0xf9c9, 2142, 1}, {0xf9ca, 2143, 1}, {0xf9cb, 2144, 1},
+ {0xf9cc, 2145, 1}, {0xf9cd, 2146, 1}, {0xf9ce, 2147, 1},
+ {0xf9cf, 2148, 1}, {0xf9d0, 2149, 1}, {0xf9d1, 2150, 1},
+ {0xf9d2, 2151, 1}, {0xf9d3, 2152, 1}, {0xf9d4, 2153, 1},
+ {0xf9d5, 2154, 1}, {0xf9d6, 2155, 1}, {0xf9d7, 2156, 1},
+ {0xf9d8, 2157, 1}, {0xf9d9, 2158, 1}, {0xf9da, 2159, 1},
+ {0xf9db, 2160, 1}, {0xf9dc, 2161, 1}, {0xf9dd, 2162, 1},
+ {0xf9de, 2163, 1}, {0xf9df, 2164, 1}, {0xf9e0, 2165, 1},
+ {0xf9e1, 2166, 1}, {0xf9e2, 2167, 1}, {0xf9e3, 2168, 1},
+ {0xf9e4, 2169, 1}, {0xf9e5, 2170, 1}, {0xf9e6, 2171, 1},
+ {0xf9e7, 2172, 1}, {0xf9e8, 2173, 1}, {0xf9e9, 2174, 1},
+ {0xf9ea, 2175, 1}, {0xf9eb, 2176, 1}, {0xf9ec, 2177, 1},
+ {0xf9ed, 2178, 1}, {0xf9ee, 2179, 1}, {0xf9ef, 2180, 1},
+ {0xf9f0, 2181, 1}, {0xf9f1, 2182, 1}, {0xf9f2, 2183, 1},
+ {0xf9f3, 2184, 1}, {0xf9f4, 2185, 1}, {0xf9f5, 2186, 1},
+ {0xf9f6, 2187, 1}, {0xf9f7, 2188, 1}, {0xf9f8, 2189, 1},
+ {0xf9f9, 2190, 1}, {0xf9fa, 2191, 1}, {0xf9fb, 2192, 1},
+ {0xf9fc, 2193, 1}, {0xf9fd, 2194, 1}, {0xf9fe, 2195, 1},
+ {0xf9ff, 2196, 1}, {0xfa00, 2197, 1}, {0xfa01, 2198, 1},
+ {0xfa02, 2199, 1}, {0xfa03, 2200, 1}, {0xfa04, 2201, 1},
+ {0xfa05, 2202, 1}, {0xfa06, 2203, 1}, {0xfa07, 2204, 1},
+ {0xfa08, 2205, 1}, {0xfa09, 2206, 1}, {0xfa0a, 2207, 1},
+ {0xfa0b, 2208, 1}, {0xfa0c, 2209, 1}, {0xfa0d, 2210, 1},
+ {0xfa10, 2211, 1}, {0xfa12, 2212, 1}, {0xfa15, 2213, 1},
+ {0xfa16, 2214, 1}, {0xfa17, 2215, 1}, {0xfa18, 2216, 1},
+ {0xfa19, 2217, 1}, {0xfa1a, 2218, 1}, {0xfa1b, 2219, 1},
+ {0xfa1c, 2220, 1}, {0xfa1d, 2221, 1}, {0xfa1e, 2222, 1},
+ {0xfa20, 2223, 1}, {0xfa22, 2224, 1}, {0xfa25, 2225, 1},
+ {0xfa26, 2226, 1}, {0xfa2a, 2227, 1}, {0xfa2b, 2228, 1},
+ {0xfa2c, 2229, 1}, {0xfa2d, 2230, 1}, {0xfb1d, 2231, 2},
+ {0xfb1f, 2233, 2}, {0xfb2a, 2235, 2}, {0xfb2b, 2237, 2},
+ {0xfb2c, 2239, 2}, {0xfb2d, 2241, 2}, {0xfb2e, 2243, 2},
+ {0xfb2f, 2245, 2}, {0xfb30, 2247, 2}, {0xfb31, 2249, 2},
+ {0xfb32, 2251, 2}, {0xfb33, 2253, 2}, {0xfb34, 2255, 2},
+ {0xfb35, 2257, 2}, {0xfb36, 2259, 2}, {0xfb38, 2261, 2},
+ {0xfb39, 2263, 2}, {0xfb3a, 2265, 2}, {0xfb3b, 2267, 2},
+ {0xfb3c, 2269, 2}, {0xfb3e, 2271, 2}, {0xfb40, 2273, 2},
+ {0xfb41, 2275, 2}, {0xfb43, 2277, 2}, {0xfb44, 2279, 2},
+ {0xfb46, 2281, 2}, {0xfb47, 2283, 2}, {0xfb48, 2285, 2},
+ {0xfb49, 2287, 2}, {0xfb4a, 2289, 2}, {0xfb4b, 2291, 2},
+ {0xfb4c, 2293, 2}, {0xfb4d, 2295, 2}, {0xfb4e, 2297, 2},
+};
+
+static unicode_t canon_decompose_data[] = {
+ 65, 768, 65, 769, 65, 770, 65, 771, 65, 776,
+ 65, 778, 67, 807, 69, 768, 69, 769, 69, 770,
+ 69, 776, 73, 768, 73, 769, 73, 770, 73, 776,
+ 78, 771, 79, 768, 79, 769, 79, 770, 79, 771,
+ 79, 776, 85, 768, 85, 769, 85, 770, 85, 776,
+ 89, 769, 97, 768, 97, 769, 97, 770, 97, 771,
+ 97, 776, 97, 778, 99, 807, 101, 768, 101, 769,
+ 101, 770, 101, 776, 105, 768, 105, 769, 105, 770,
+ 105, 776, 110, 771, 111, 768, 111, 769, 111, 770,
+ 111, 771, 111, 776, 117, 768, 117, 769, 117, 770,
+ 117, 776, 121, 769, 121, 776, 65, 772, 97, 772,
+ 65, 774, 97, 774, 65, 808, 97, 808, 67, 769,
+ 99, 769, 67, 770, 99, 770, 67, 775, 99, 775,
+ 67, 780, 99, 780, 68, 780, 100, 780, 69, 772,
+ 101, 772, 69, 774, 101, 774, 69, 775, 101, 775,
+ 69, 808, 101, 808, 69, 780, 101, 780, 71, 770,
+ 103, 770, 71, 774, 103, 774, 71, 775, 103, 775,
+ 71, 807, 103, 807, 72, 770, 104, 770, 73, 771,
+ 105, 771, 73, 772, 105, 772, 73, 774, 105, 774,
+ 73, 808, 105, 808, 73, 775, 74, 770, 106, 770,
+ 75, 807, 107, 807, 76, 769, 108, 769, 76, 807,
+ 108, 807, 76, 780, 108, 780, 78, 769, 110, 769,
+ 78, 807, 110, 807, 78, 780, 110, 780, 79, 772,
+ 111, 772, 79, 774, 111, 774, 79, 779, 111, 779,
+ 82, 769, 114, 769, 82, 807, 114, 807, 82, 780,
+ 114, 780, 83, 769, 115, 769, 83, 770, 115, 770,
+ 83, 807, 115, 807, 83, 780, 115, 780, 84, 807,
+ 116, 807, 84, 780, 116, 780, 85, 771, 117, 771,
+ 85, 772, 117, 772, 85, 774, 117, 774, 85, 778,
+ 117, 778, 85, 779, 117, 779, 85, 808, 117, 808,
+ 87, 770, 119, 770, 89, 770, 121, 770, 89, 776,
+ 90, 769, 122, 769, 90, 775, 122, 775, 90, 780,
+ 122, 780, 79, 795, 111, 795, 85, 795, 117, 795,
+ 65, 780, 97, 780, 73, 780, 105, 780, 79, 780,
+ 111, 780, 85, 780, 117, 780, 220, 772, 252, 772,
+ 220, 769, 252, 769, 220, 780, 252, 780, 220, 768,
+ 252, 768, 196, 772, 228, 772, 550, 772, 551, 772,
+ 198, 772, 230, 772, 71, 780, 103, 780, 75, 780,
+ 107, 780, 79, 808, 111, 808, 490, 772, 491, 772,
+ 439, 780, 658, 780, 106, 780, 71, 769, 103, 769,
+ 78, 768, 110, 768, 197, 769, 229, 769, 198, 769,
+ 230, 769, 216, 769, 248, 769, 65, 783, 97, 783,
+ 65, 785, 97, 785, 69, 783, 101, 783, 69, 785,
+ 101, 785, 73, 783, 105, 783, 73, 785, 105, 785,
+ 79, 783, 111, 783, 79, 785, 111, 785, 82, 783,
+ 114, 783, 82, 785, 114, 785, 85, 783, 117, 783,
+ 85, 785, 117, 785, 83, 806, 115, 806, 84, 806,
+ 116, 806, 72, 780, 104, 780, 65, 775, 97, 775,
+ 69, 807, 101, 807, 214, 772, 246, 772, 213, 772,
+ 245, 772, 79, 775, 111, 775, 558, 772, 559, 772,
+ 89, 772, 121, 772, 768, 769, 787, 776, 769, 697,
+ 59, 168, 769, 913, 769, 183, 917, 769, 919, 769,
+ 921, 769, 927, 769, 933, 769, 937, 769, 970, 769,
+ 921, 776, 933, 776, 945, 769, 949, 769, 951, 769,
+ 953, 769, 971, 769, 953, 776, 965, 776, 959, 769,
+ 965, 769, 969, 769, 978, 769, 978, 776, 1045, 768,
+ 1045, 776, 1043, 769, 1030, 776, 1050, 769, 1048, 768,
+ 1059, 774, 1048, 774, 1080, 774, 1077, 768, 1077, 776,
+ 1075, 769, 1110, 776, 1082, 769, 1080, 768, 1091, 774,
+ 1140, 783, 1141, 783, 1046, 774, 1078, 774, 1040, 774,
+ 1072, 774, 1040, 776, 1072, 776, 1045, 774, 1077, 774,
+ 1240, 776, 1241, 776, 1046, 776, 1078, 776, 1047, 776,
+ 1079, 776, 1048, 772, 1080, 772, 1048, 776, 1080, 776,
+ 1054, 776, 1086, 776, 1256, 776, 1257, 776, 1069, 776,
+ 1101, 776, 1059, 772, 1091, 772, 1059, 776, 1091, 776,
+ 1059, 779, 1091, 779, 1063, 776, 1095, 776, 1067, 776,
+ 1099, 776, 1575, 1619, 1575, 1620, 1608, 1620, 1575, 1621,
+ 1610, 1620, 1749, 1620, 1729, 1620, 1746, 1620, 2344, 2364,
+ 2352, 2364, 2355, 2364, 2325, 2364, 2326, 2364, 2327, 2364,
+ 2332, 2364, 2337, 2364, 2338, 2364, 2347, 2364, 2351, 2364,
+ 2503, 2494, 2503, 2519, 2465, 2492, 2466, 2492, 2479, 2492,
+ 2610, 2620, 2616, 2620, 2582, 2620, 2583, 2620, 2588, 2620,
+ 2603, 2620, 2887, 2902, 2887, 2878, 2887, 2903, 2849, 2876,
+ 2850, 2876, 2962, 3031, 3014, 3006, 3015, 3006, 3014, 3031,
+ 3142, 3158, 3263, 3285, 3270, 3285, 3270, 3286, 3270, 3266,
+ 3274, 3285, 3398, 3390, 3399, 3390, 3398, 3415, 3545, 3530,
+ 3545, 3535, 3548, 3530, 3545, 3551, 3906, 4023, 3916, 4023,
+ 3921, 4023, 3926, 4023, 3931, 4023, 3904, 4021, 3953, 3954,
+ 3953, 3956, 4018, 3968, 4019, 3968, 3953, 3968, 3986, 4023,
+ 3996, 4023, 4001, 4023, 4006, 4023, 4011, 4023, 3984, 4021,
+ 4133, 4142, 65, 805, 97, 805, 66, 775, 98, 775,
+ 66, 803, 98, 803, 66, 817, 98, 817, 199, 769,
+ 231, 769, 68, 775, 100, 775, 68, 803, 100, 803,
+ 68, 817, 100, 817, 68, 807, 100, 807, 68, 813,
+ 100, 813, 274, 768, 275, 768, 274, 769, 275, 769,
+ 69, 813, 101, 813, 69, 816, 101, 816, 552, 774,
+ 553, 774, 70, 775, 102, 775, 71, 772, 103, 772,
+ 72, 775, 104, 775, 72, 803, 104, 803, 72, 776,
+ 104, 776, 72, 807, 104, 807, 72, 814, 104, 814,
+ 73, 816, 105, 816, 207, 769, 239, 769, 75, 769,
+ 107, 769, 75, 803, 107, 803, 75, 817, 107, 817,
+ 76, 803, 108, 803, 7734, 772, 7735, 772, 76, 817,
+ 108, 817, 76, 813, 108, 813, 77, 769, 109, 769,
+ 77, 775, 109, 775, 77, 803, 109, 803, 78, 775,
+ 110, 775, 78, 803, 110, 803, 78, 817, 110, 817,
+ 78, 813, 110, 813, 213, 769, 245, 769, 213, 776,
+ 245, 776, 332, 768, 333, 768, 332, 769, 333, 769,
+ 80, 769, 112, 769, 80, 775, 112, 775, 82, 775,
+ 114, 775, 82, 803, 114, 803, 7770, 772, 7771, 772,
+ 82, 817, 114, 817, 83, 775, 115, 775, 83, 803,
+ 115, 803, 346, 775, 347, 775, 352, 775, 353, 775,
+ 7778, 775, 7779, 775, 84, 775, 116, 775, 84, 803,
+ 116, 803, 84, 817, 116, 817, 84, 813, 116, 813,
+ 85, 804, 117, 804, 85, 816, 117, 816, 85, 813,
+ 117, 813, 360, 769, 361, 769, 362, 776, 363, 776,
+ 86, 771, 118, 771, 86, 803, 118, 803, 87, 768,
+ 119, 768, 87, 769, 119, 769, 87, 776, 119, 776,
+ 87, 775, 119, 775, 87, 803, 119, 803, 88, 775,
+ 120, 775, 88, 776, 120, 776, 89, 775, 121, 775,
+ 90, 770, 122, 770, 90, 803, 122, 803, 90, 817,
+ 122, 817, 104, 817, 116, 776, 119, 778, 121, 778,
+ 383, 775, 65, 803, 97, 803, 65, 777, 97, 777,
+ 194, 769, 226, 769, 194, 768, 226, 768, 194, 777,
+ 226, 777, 194, 771, 226, 771, 7840, 770, 7841, 770,
+ 258, 769, 259, 769, 258, 768, 259, 768, 258, 777,
+ 259, 777, 258, 771, 259, 771, 7840, 774, 7841, 774,
+ 69, 803, 101, 803, 69, 777, 101, 777, 69, 771,
+ 101, 771, 202, 769, 234, 769, 202, 768, 234, 768,
+ 202, 777, 234, 777, 202, 771, 234, 771, 7864, 770,
+ 7865, 770, 73, 777, 105, 777, 73, 803, 105, 803,
+ 79, 803, 111, 803, 79, 777, 111, 777, 212, 769,
+ 244, 769, 212, 768, 244, 768, 212, 777, 244, 777,
+ 212, 771, 244, 771, 7884, 770, 7885, 770, 416, 769,
+ 417, 769, 416, 768, 417, 768, 416, 777, 417, 777,
+ 416, 771, 417, 771, 416, 803, 417, 803, 85, 803,
+ 117, 803, 85, 777, 117, 777, 431, 769, 432, 769,
+ 431, 768, 432, 768, 431, 777, 432, 777, 431, 771,
+ 432, 771, 431, 803, 432, 803, 89, 768, 121, 768,
+ 89, 803, 121, 803, 89, 777, 121, 777, 89, 771,
+ 121, 771, 945, 787, 945, 788, 7936, 768, 7937, 768,
+ 7936, 769, 7937, 769, 7936, 834, 7937, 834, 913, 787,
+ 913, 788, 7944, 768, 7945, 768, 7944, 769, 7945, 769,
+ 7944, 834, 7945, 834, 949, 787, 949, 788, 7952, 768,
+ 7953, 768, 7952, 769, 7953, 769, 917, 787, 917, 788,
+ 7960, 768, 7961, 768, 7960, 769, 7961, 769, 951, 787,
+ 951, 788, 7968, 768, 7969, 768, 7968, 769, 7969, 769,
+ 7968, 834, 7969, 834, 919, 787, 919, 788, 7976, 768,
+ 7977, 768, 7976, 769, 7977, 769, 7976, 834, 7977, 834,
+ 953, 787, 953, 788, 7984, 768, 7985, 768, 7984, 769,
+ 7985, 769, 7984, 834, 7985, 834, 921, 787, 921, 788,
+ 7992, 768, 7993, 768, 7992, 769, 7993, 769, 7992, 834,
+ 7993, 834, 959, 787, 959, 788, 8000, 768, 8001, 768,
+ 8000, 769, 8001, 769, 927, 787, 927, 788, 8008, 768,
+ 8009, 768, 8008, 769, 8009, 769, 965, 787, 965, 788,
+ 8016, 768, 8017, 768, 8016, 769, 8017, 769, 8016, 834,
+ 8017, 834, 933, 788, 8025, 768, 8025, 769, 8025, 834,
+ 969, 787, 969, 788, 8032, 768, 8033, 768, 8032, 769,
+ 8033, 769, 8032, 834, 8033, 834, 937, 787, 937, 788,
+ 8040, 768, 8041, 768, 8040, 769, 8041, 769, 8040, 834,
+ 8041, 834, 945, 768, 940, 949, 768, 941, 951, 768,
+ 942, 953, 768, 943, 959, 768, 972, 965, 768, 973,
+ 969, 768, 974, 7936, 837, 7937, 837, 7938, 837, 7939,
+ 837, 7940, 837, 7941, 837, 7942, 837, 7943, 837, 7944,
+ 837, 7945, 837, 7946, 837, 7947, 837, 7948, 837, 7949,
+ 837, 7950, 837, 7951, 837, 7968, 837, 7969, 837, 7970,
+ 837, 7971, 837, 7972, 837, 7973, 837, 7974, 837, 7975,
+ 837, 7976, 837, 7977, 837, 7978, 837, 7979, 837, 7980,
+ 837, 7981, 837, 7982, 837, 7983, 837, 8032, 837, 8033,
+ 837, 8034, 837, 8035, 837, 8036, 837, 8037, 837, 8038,
+ 837, 8039, 837, 8040, 837, 8041, 837, 8042, 837, 8043,
+ 837, 8044, 837, 8045, 837, 8046, 837, 8047, 837, 945,
+ 774, 945, 772, 8048, 837, 945, 837, 940, 837, 945,
+ 834, 8118, 837, 913, 774, 913, 772, 913, 768, 902,
+ 913, 837, 953, 168, 834, 8052, 837, 951, 837, 942,
+ 837, 951, 834, 8134, 837, 917, 768, 904, 919, 768,
+ 905, 919, 837, 8127, 768, 8127, 769, 8127, 834, 953,
+ 774, 953, 772, 970, 768, 912, 953, 834, 970, 834,
+ 921, 774, 921, 772, 921, 768, 906, 8190, 768, 8190,
+ 769, 8190, 834, 965, 774, 965, 772, 971, 768, 944,
+ 961, 787, 961, 788, 965, 834, 971, 834, 933, 774,
+ 933, 772, 933, 768, 910, 929, 788, 168, 768, 901,
+ 96, 8060, 837, 969, 837, 974, 837, 969, 834, 8182,
+ 837, 927, 768, 908, 937, 768, 911, 937, 837, 180,
+ 8194, 8195, 937, 75, 197, 8592, 824, 8594, 824, 8596,
+ 824, 8656, 824, 8660, 824, 8658, 824, 8707, 824, 8712,
+ 824, 8715, 824, 8739, 824, 8741, 824, 8764, 824, 8771,
+ 824, 8773, 824, 8776, 824, 61, 824, 8801, 824, 8781,
+ 824, 60, 824, 62, 824, 8804, 824, 8805, 824, 8818,
+ 824, 8819, 824, 8822, 824, 8823, 824, 8826, 824, 8827,
+ 824, 8834, 824, 8835, 824, 8838, 824, 8839, 824, 8866,
+ 824, 8872, 824, 8873, 824, 8875, 824, 8828, 824, 8829,
+ 824, 8849, 824, 8850, 824, 8882, 824, 8883, 824, 8884,
+ 824, 8885, 824, 12296, 12297, 12363, 12441, 12365, 12441, 12367,
+ 12441, 12369, 12441, 12371, 12441, 12373, 12441, 12375, 12441, 12377,
+ 12441, 12379, 12441, 12381, 12441, 12383, 12441, 12385, 12441, 12388,
+ 12441, 12390, 12441, 12392, 12441, 12399, 12441, 12399, 12442, 12402,
+ 12441, 12402, 12442, 12405, 12441, 12405, 12442, 12408, 12441, 12408,
+ 12442, 12411, 12441, 12411, 12442, 12358, 12441, 12445, 12441, 12459,
+ 12441, 12461, 12441, 12463, 12441, 12465, 12441, 12467, 12441, 12469,
+ 12441, 12471, 12441, 12473, 12441, 12475, 12441, 12477, 12441, 12479,
+ 12441, 12481, 12441, 12484, 12441, 12486, 12441, 12488, 12441, 12495,
+ 12441, 12495, 12442, 12498, 12441, 12498, 12442, 12501, 12441, 12501,
+ 12442, 12504, 12441, 12504, 12442, 12507, 12441, 12507, 12442, 12454,
+ 12441, 12527, 12441, 12528, 12441, 12529, 12441, 12530, 12441, 12541,
+ 12441, 35912, 26356, 36554, 36040, 28369, 20018, 21477, 40860, 40860,
+ 22865, 37329, 21895, 22856, 25078, 30313, 32645, 34367, 34746, 35064,
+ 37007, 27138, 27931, 28889, 29662, 33853, 37226, 39409, 20098, 21365,
+ 27396, 29211, 34349, 40478, 23888, 28651, 34253, 35172, 25289, 33240,
+ 34847, 24266, 26391, 28010, 29436, 37070, 20358, 20919, 21214, 25796,
+ 27347, 29200, 30439, 32769, 34310, 34396, 36335, 38706, 39791, 40442,
+ 30860, 31103, 32160, 33737, 37636, 40575, 35542, 22751, 24324, 31840,
+ 32894, 29282, 30922, 36034, 38647, 22744, 23650, 27155, 28122, 28431,
+ 32047, 32311, 38651, 21202, 32907, 20956, 20940, 31260, 32190, 33777,
+ 38517, 35712, 25295, 27138, 35582, 20025, 23527, 24594, 29575, 30064,
+ 21271, 30971, 20415, 24489, 19981, 27852, 25976, 32034, 21443, 22622,
+ 30465, 33865, 35498, 27578, 36784, 27784, 25342, 33509, 25504, 30053,
+ 20142, 20841, 20937, 26753, 31975, 33391, 35538, 37327, 21237, 21570,
+ 22899, 24300, 26053, 28670, 31018, 38317, 39530, 40599, 40654, 21147,
+ 26310, 27511, 36706, 24180, 24976, 25088, 25754, 28451, 29001, 29833,
+ 31178, 32244, 32879, 36646, 34030, 36899, 37706, 21015, 21155, 21693,
+ 28872, 35010, 35498, 24265, 24565, 25467, 27566, 31806, 29557, 20196,
+ 22265, 23527, 23994, 24604, 29618, 29801, 32666, 32838, 37428, 38646,
+ 38728, 38936, 20363, 31150, 37300, 38584, 24801, 20102, 20698, 23534,
+ 23615, 26009, 27138, 29134, 30274, 34044, 36988, 40845, 26248, 38446,
+ 21129, 26491, 26611, 27969, 28316, 29705, 30041, 30827, 32016, 39006,
+ 20845, 25134, 38520, 20523, 23833, 28138, 36650, 24459, 24900, 26647,
+ 29575, 38534, 21033, 21519, 23653, 26131, 26446, 26792, 27877, 29702,
+ 30178, 32633, 35023, 35041, 37324, 38626, 21311, 28346, 21533, 29136,
+ 29848, 34298, 38563, 40023, 40607, 26519, 28107, 33256, 31435, 31520,
+ 31890, 29376, 28825, 35672, 20160, 33590, 21050, 20999, 24230, 25299,
+ 31958, 23429, 27934, 26292, 36667, 34892, 38477, 35211, 24275, 20800,
+ 21952, 22618, 26228, 20958, 29482, 30410, 31036, 31070, 31077, 31119,
+ 38742, 31934, 32701, 34322, 35576, 36920, 37117, 39151, 39164, 39208,
+ 40372, 1497, 1460, 1522, 1463, 1513, 1473, 1513, 1474, 64329,
+ 1473, 64329, 1474, 1488, 1463, 1488, 1464, 1488, 1468, 1489,
+ 1468, 1490, 1468, 1491, 1468, 1492, 1468, 1493, 1468, 1494,
+ 1468, 1496, 1468, 1497, 1468, 1498, 1468, 1499, 1468, 1500,
+ 1468, 1502, 1468, 1504, 1468, 1505, 1468, 1507, 1468, 1508,
+ 1468, 1510, 1468, 1511, 1468, 1512, 1468, 1513, 1468, 1514,
+ 1468, 1493, 1465, 1489, 1471, 1499, 1471, 1508, 1471,
+};
+
+static unsigned long compat_decompose_bitmap[] = {
+ 0x0b4bedfc, 0x7daae3b0, 0x00000001, 0xff000000,
+ 0x000e1ff7, 0xfc000000, 0x0000ff7f, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0xfffff1f0,
+};
+
+static struct decomposition compat_decompose_seq[] = {
+ {0x00a0, 0, 1}, {0x00a8, 1, 2}, {0x00aa, 3, 1},
+ {0x00af, 4, 2}, {0x00b2, 6, 1}, {0x00b3, 7, 1},
+ {0x00b4, 8, 2}, {0x00b5, 10, 1}, {0x00b8, 11, 2},
+ {0x00b9, 13, 1}, {0x00ba, 14, 1}, {0x00bc, 15, 3},
+ {0x00bd, 18, 3}, {0x00be, 21, 3}, {0x0132, 24, 2},
+ {0x0133, 26, 2}, {0x013f, 28, 2}, {0x0140, 30, 2},
+ {0x0149, 32, 2}, {0x017f, 34, 1}, {0x01c4, 35, 2},
+ {0x01c5, 37, 2}, {0x01c6, 39, 2}, {0x01c7, 41, 2},
+ {0x01c8, 43, 2}, {0x01c9, 45, 2}, {0x01ca, 47, 2},
+ {0x01cb, 49, 2}, {0x01cc, 51, 2}, {0x01f1, 53, 2},
+ {0x01f2, 55, 2}, {0x01f3, 57, 2}, {0x02b0, 59, 1},
+ {0x02b1, 60, 1}, {0x02b2, 61, 1}, {0x02b3, 62, 1},
+ {0x02b4, 63, 1}, {0x02b5, 64, 1}, {0x02b6, 65, 1},
+ {0x02b7, 66, 1}, {0x02b8, 67, 1}, {0x02d8, 68, 2},
+ {0x02d9, 70, 2}, {0x02da, 72, 2}, {0x02db, 74, 2},
+ {0x02dc, 76, 2}, {0x02dd, 78, 2}, {0x02e0, 80, 1},
+ {0x02e1, 81, 1}, {0x02e2, 82, 1}, {0x02e3, 83, 1},
+ {0x02e4, 84, 1}, {0x037a, 85, 2}, {0x0384, 87, 2},
+ {0x03d0, 89, 1}, {0x03d1, 90, 1}, {0x03d2, 91, 1},
+ {0x03d5, 92, 1}, {0x03d6, 93, 1}, {0x03f0, 94, 1},
+ {0x03f1, 95, 1}, {0x03f2, 96, 1}, {0x0587, 97, 2},
+ {0x0675, 99, 2}, {0x0676, 101, 2}, {0x0677, 103, 2},
+ {0x0678, 105, 2}, {0x0e33, 107, 2}, {0x0eb3, 109, 2},
+ {0x0edc, 111, 2}, {0x0edd, 113, 2}, {0x0f0c, 115, 1},
+ {0x0f77, 116, 2}, {0x0f79, 118, 2}, {0x1e9a, 120, 2},
+ {0x1fbd, 122, 2}, {0x1fbf, 124, 2}, {0x1fc0, 126, 2},
+ {0x1ffe, 128, 2}, {0x2002, 130, 1}, {0x2003, 131, 1},
+ {0x2004, 132, 1}, {0x2005, 133, 1}, {0x2006, 134, 1},
+ {0x2007, 135, 1}, {0x2008, 136, 1}, {0x2009, 137, 1},
+ {0x200a, 138, 1}, {0x2011, 139, 1}, {0x2017, 140, 2},
+ {0x2024, 142, 1}, {0x2025, 143, 2}, {0x2026, 145, 3},
+ {0x202f, 148, 1}, {0x2033, 149, 2}, {0x2034, 151, 3},
+ {0x2036, 154, 2}, {0x2037, 156, 3}, {0x203c, 159, 2},
+ {0x203e, 161, 2}, {0x2048, 163, 2}, {0x2049, 165, 2},
+ {0x2070, 167, 1}, {0x2074, 168, 1}, {0x2075, 169, 1},
+ {0x2076, 170, 1}, {0x2077, 171, 1}, {0x2078, 172, 1},
+ {0x2079, 173, 1}, {0x207a, 174, 1}, {0x207b, 175, 1},
+ {0x207c, 176, 1}, {0x207d, 177, 1}, {0x207e, 178, 1},
+ {0x207f, 179, 1}, {0x2080, 180, 1}, {0x2081, 181, 1},
+ {0x2082, 182, 1}, {0x2083, 183, 1}, {0x2084, 184, 1},
+ {0x2085, 185, 1}, {0x2086, 186, 1}, {0x2087, 187, 1},
+ {0x2088, 188, 1}, {0x2089, 189, 1}, {0x208a, 190, 1},
+ {0x208b, 191, 1}, {0x208c, 192, 1}, {0x208d, 193, 1},
+ {0x208e, 194, 1}, {0x20a8, 195, 2}, {0x2100, 197, 3},
+ {0x2101, 200, 3}, {0x2102, 203, 1}, {0x2103, 204, 2},
+ {0x2105, 206, 3}, {0x2106, 209, 3}, {0x2107, 212, 1},
+ {0x2109, 213, 2}, {0x210a, 215, 1}, {0x210b, 216, 1},
+ {0x210c, 217, 1}, {0x210d, 218, 1}, {0x210e, 219, 1},
+ {0x210f, 220, 1}, {0x2110, 221, 1}, {0x2111, 222, 1},
+ {0x2112, 223, 1}, {0x2113, 224, 1}, {0x2115, 225, 1},
+ {0x2116, 226, 2}, {0x2119, 228, 1}, {0x211a, 229, 1},
+ {0x211b, 230, 1}, {0x211c, 231, 1}, {0x211d, 232, 1},
+ {0x2120, 233, 2}, {0x2121, 235, 3}, {0x2122, 238, 2},
+ {0x2124, 240, 1}, {0x2128, 241, 1}, {0x212c, 242, 1},
+ {0x212d, 243, 1}, {0x212f, 244, 1}, {0x2130, 245, 1},
+ {0x2131, 246, 1}, {0x2133, 247, 1}, {0x2134, 248, 1},
+ {0x2135, 249, 1}, {0x2136, 250, 1}, {0x2137, 251, 1},
+ {0x2138, 252, 1}, {0x2139, 253, 1}, {0x2153, 254, 3},
+ {0x2154, 257, 3}, {0x2155, 260, 3}, {0x2156, 263, 3},
+ {0x2157, 266, 3}, {0x2158, 269, 3}, {0x2159, 272, 3},
+ {0x215a, 275, 3}, {0x215b, 278, 3}, {0x215c, 281, 3},
+ {0x215d, 284, 3}, {0x215e, 287, 3}, {0x215f, 290, 2},
+ {0x2160, 292, 1}, {0x2161, 293, 2}, {0x2162, 295, 3},
+ {0x2163, 298, 2}, {0x2164, 300, 1}, {0x2165, 301, 2},
+ {0x2166, 303, 3}, {0x2167, 306, 4}, {0x2168, 310, 2},
+ {0x2169, 312, 1}, {0x216a, 313, 2}, {0x216b, 315, 3},
+ {0x216c, 318, 1}, {0x216d, 319, 1}, {0x216e, 320, 1},
+ {0x216f, 321, 1}, {0x2170, 322, 1}, {0x2171, 323, 2},
+ {0x2172, 325, 3}, {0x2173, 328, 2}, {0x2174, 330, 1},
+ {0x2175, 331, 2}, {0x2176, 333, 3}, {0x2177, 336, 4},
+ {0x2178, 340, 2}, {0x2179, 342, 1}, {0x217a, 343, 2},
+ {0x217b, 345, 3}, {0x217c, 348, 1}, {0x217d, 349, 1},
+ {0x217e, 350, 1}, {0x217f, 351, 1}, {0x222c, 352, 2},
+ {0x222d, 354, 3}, {0x222f, 357, 2}, {0x2230, 359, 3},
+ {0x2460, 362, 1}, {0x2461, 363, 1}, {0x2462, 364, 1},
+ {0x2463, 365, 1}, {0x2464, 366, 1}, {0x2465, 367, 1},
+ {0x2466, 368, 1}, {0x2467, 369, 1}, {0x2468, 370, 1},
+ {0x2469, 371, 2}, {0x246a, 373, 2}, {0x246b, 375, 2},
+ {0x246c, 377, 2}, {0x246d, 379, 2}, {0x246e, 381, 2},
+ {0x246f, 383, 2}, {0x2470, 385, 2}, {0x2471, 387, 2},
+ {0x2472, 389, 2}, {0x2473, 391, 2}, {0x2474, 393, 3},
+ {0x2475, 396, 3}, {0x2476, 399, 3}, {0x2477, 402, 3},
+ {0x2478, 405, 3}, {0x2479, 408, 3}, {0x247a, 411, 3},
+ {0x247b, 414, 3}, {0x247c, 417, 3}, {0x247d, 420, 4},
+ {0x247e, 424, 4}, {0x247f, 428, 4}, {0x2480, 432, 4},
+ {0x2481, 436, 4}, {0x2482, 440, 4}, {0x2483, 444, 4},
+ {0x2484, 448, 4}, {0x2485, 452, 4}, {0x2486, 456, 4},
+ {0x2487, 460, 4}, {0x2488, 464, 2}, {0x2489, 466, 2},
+ {0x248a, 468, 2}, {0x248b, 470, 2}, {0x248c, 472, 2},
+ {0x248d, 474, 2}, {0x248e, 476, 2}, {0x248f, 478, 2},
+ {0x2490, 480, 2}, {0x2491, 482, 3}, {0x2492, 485, 3},
+ {0x2493, 488, 3}, {0x2494, 491, 3}, {0x2495, 494, 3},
+ {0x2496, 497, 3}, {0x2497, 500, 3}, {0x2498, 503, 3},
+ {0x2499, 506, 3}, {0x249a, 509, 3}, {0x249b, 512, 3},
+ {0x249c, 515, 3}, {0x249d, 518, 3}, {0x249e, 521, 3},
+ {0x249f, 524, 3}, {0x24a0, 527, 3}, {0x24a1, 530, 3},
+ {0x24a2, 533, 3}, {0x24a3, 536, 3}, {0x24a4, 539, 3},
+ {0x24a5, 542, 3}, {0x24a6, 545, 3}, {0x24a7, 548, 3},
+ {0x24a8, 551, 3}, {0x24a9, 554, 3}, {0x24aa, 557, 3},
+ {0x24ab, 560, 3}, {0x24ac, 563, 3}, {0x24ad, 566, 3},
+ {0x24ae, 569, 3}, {0x24af, 572, 3}, {0x24b0, 575, 3},
+ {0x24b1, 578, 3}, {0x24b2, 581, 3}, {0x24b3, 584, 3},
+ {0x24b4, 587, 3}, {0x24b5, 590, 3}, {0x24b6, 593, 1},
+ {0x24b7, 594, 1}, {0x24b8, 595, 1}, {0x24b9, 596, 1},
+ {0x24ba, 597, 1}, {0x24bb, 598, 1}, {0x24bc, 599, 1},
+ {0x24bd, 600, 1}, {0x24be, 601, 1}, {0x24bf, 602, 1},
+ {0x24c0, 603, 1}, {0x24c1, 604, 1}, {0x24c2, 605, 1},
+ {0x24c3, 606, 1}, {0x24c4, 607, 1}, {0x24c5, 608, 1},
+ {0x24c6, 609, 1}, {0x24c7, 610, 1}, {0x24c8, 611, 1},
+ {0x24c9, 612, 1}, {0x24ca, 613, 1}, {0x24cb, 614, 1},
+ {0x24cc, 615, 1}, {0x24cd, 616, 1}, {0x24ce, 617, 1},
+ {0x24cf, 618, 1}, {0x24d0, 619, 1}, {0x24d1, 620, 1},
+ {0x24d2, 621, 1}, {0x24d3, 622, 1}, {0x24d4, 623, 1},
+ {0x24d5, 624, 1}, {0x24d6, 625, 1}, {0x24d7, 626, 1},
+ {0x24d8, 627, 1}, {0x24d9, 628, 1}, {0x24da, 629, 1},
+ {0x24db, 630, 1}, {0x24dc, 631, 1}, {0x24dd, 632, 1},
+ {0x24de, 633, 1}, {0x24df, 634, 1}, {0x24e0, 635, 1},
+ {0x24e1, 636, 1}, {0x24e2, 637, 1}, {0x24e3, 638, 1},
+ {0x24e4, 639, 1}, {0x24e5, 640, 1}, {0x24e6, 641, 1},
+ {0x24e7, 642, 1}, {0x24e8, 643, 1}, {0x24e9, 644, 1},
+ {0x24ea, 645, 1}, {0x2e9f, 646, 1}, {0x2ef3, 647, 1},
+ {0x2f00, 648, 1}, {0x2f01, 649, 1}, {0x2f02, 650, 1},
+ {0x2f03, 651, 1}, {0x2f04, 652, 1}, {0x2f05, 653, 1},
+ {0x2f06, 654, 1}, {0x2f07, 655, 1}, {0x2f08, 656, 1},
+ {0x2f09, 657, 1}, {0x2f0a, 658, 1}, {0x2f0b, 659, 1},
+ {0x2f0c, 660, 1}, {0x2f0d, 661, 1}, {0x2f0e, 662, 1},
+ {0x2f0f, 663, 1}, {0x2f10, 664, 1}, {0x2f11, 665, 1},
+ {0x2f12, 666, 1}, {0x2f13, 667, 1}, {0x2f14, 668, 1},
+ {0x2f15, 669, 1}, {0x2f16, 670, 1}, {0x2f17, 671, 1},
+ {0x2f18, 672, 1}, {0x2f19, 673, 1}, {0x2f1a, 674, 1},
+ {0x2f1b, 675, 1}, {0x2f1c, 676, 1}, {0x2f1d, 677, 1},
+ {0x2f1e, 678, 1}, {0x2f1f, 679, 1}, {0x2f20, 680, 1},
+ {0x2f21, 681, 1}, {0x2f22, 682, 1}, {0x2f23, 683, 1},
+ {0x2f24, 684, 1}, {0x2f25, 685, 1}, {0x2f26, 686, 1},
+ {0x2f27, 687, 1}, {0x2f28, 688, 1}, {0x2f29, 689, 1},
+ {0x2f2a, 690, 1}, {0x2f2b, 691, 1}, {0x2f2c, 692, 1},
+ {0x2f2d, 693, 1}, {0x2f2e, 694, 1}, {0x2f2f, 695, 1},
+ {0x2f30, 696, 1}, {0x2f31, 697, 1}, {0x2f32, 698, 1},
+ {0x2f33, 699, 1}, {0x2f34, 700, 1}, {0x2f35, 701, 1},
+ {0x2f36, 702, 1}, {0x2f37, 703, 1}, {0x2f38, 704, 1},
+ {0x2f39, 705, 1}, {0x2f3a, 706, 1}, {0x2f3b, 707, 1},
+ {0x2f3c, 708, 1}, {0x2f3d, 709, 1}, {0x2f3e, 710, 1},
+ {0x2f3f, 711, 1}, {0x2f40, 712, 1}, {0x2f41, 713, 1},
+ {0x2f42, 714, 1}, {0x2f43, 715, 1}, {0x2f44, 716, 1},
+ {0x2f45, 717, 1}, {0x2f46, 718, 1}, {0x2f47, 719, 1},
+ {0x2f48, 720, 1}, {0x2f49, 721, 1}, {0x2f4a, 722, 1},
+ {0x2f4b, 723, 1}, {0x2f4c, 724, 1}, {0x2f4d, 725, 1},
+ {0x2f4e, 726, 1}, {0x2f4f, 727, 1}, {0x2f50, 728, 1},
+ {0x2f51, 729, 1}, {0x2f52, 730, 1}, {0x2f53, 731, 1},
+ {0x2f54, 732, 1}, {0x2f55, 733, 1}, {0x2f56, 734, 1},
+ {0x2f57, 735, 1}, {0x2f58, 736, 1}, {0x2f59, 737, 1},
+ {0x2f5a, 738, 1}, {0x2f5b, 739, 1}, {0x2f5c, 740, 1},
+ {0x2f5d, 741, 1}, {0x2f5e, 742, 1}, {0x2f5f, 743, 1},
+ {0x2f60, 744, 1}, {0x2f61, 745, 1}, {0x2f62, 746, 1},
+ {0x2f63, 747, 1}, {0x2f64, 748, 1}, {0x2f65, 749, 1},
+ {0x2f66, 750, 1}, {0x2f67, 751, 1}, {0x2f68, 752, 1},
+ {0x2f69, 753, 1}, {0x2f6a, 754, 1}, {0x2f6b, 755, 1},
+ {0x2f6c, 756, 1}, {0x2f6d, 757, 1}, {0x2f6e, 758, 1},
+ {0x2f6f, 759, 1}, {0x2f70, 760, 1}, {0x2f71, 761, 1},
+ {0x2f72, 762, 1}, {0x2f73, 763, 1}, {0x2f74, 764, 1},
+ {0x2f75, 765, 1}, {0x2f76, 766, 1}, {0x2f77, 767, 1},
+ {0x2f78, 768, 1}, {0x2f79, 769, 1}, {0x2f7a, 770, 1},
+ {0x2f7b, 771, 1}, {0x2f7c, 772, 1}, {0x2f7d, 773, 1},
+ {0x2f7e, 774, 1}, {0x2f7f, 775, 1}, {0x2f80, 776, 1},
+ {0x2f81, 777, 1}, {0x2f82, 778, 1}, {0x2f83, 779, 1},
+ {0x2f84, 780, 1}, {0x2f85, 781, 1}, {0x2f86, 782, 1},
+ {0x2f87, 783, 1}, {0x2f88, 784, 1}, {0x2f89, 785, 1},
+ {0x2f8a, 786, 1}, {0x2f8b, 787, 1}, {0x2f8c, 788, 1},
+ {0x2f8d, 789, 1}, {0x2f8e, 790, 1}, {0x2f8f, 791, 1},
+ {0x2f90, 792, 1}, {0x2f91, 793, 1}, {0x2f92, 794, 1},
+ {0x2f93, 795, 1}, {0x2f94, 796, 1}, {0x2f95, 797, 1},
+ {0x2f96, 798, 1}, {0x2f97, 799, 1}, {0x2f98, 800, 1},
+ {0x2f99, 801, 1}, {0x2f9a, 802, 1}, {0x2f9b, 803, 1},
+ {0x2f9c, 804, 1}, {0x2f9d, 805, 1}, {0x2f9e, 806, 1},
+ {0x2f9f, 807, 1}, {0x2fa0, 808, 1}, {0x2fa1, 809, 1},
+ {0x2fa2, 810, 1}, {0x2fa3, 811, 1}, {0x2fa4, 812, 1},
+ {0x2fa5, 813, 1}, {0x2fa6, 814, 1}, {0x2fa7, 815, 1},
+ {0x2fa8, 816, 1}, {0x2fa9, 817, 1}, {0x2faa, 818, 1},
+ {0x2fab, 819, 1}, {0x2fac, 820, 1}, {0x2fad, 821, 1},
+ {0x2fae, 822, 1}, {0x2faf, 823, 1}, {0x2fb0, 824, 1},
+ {0x2fb1, 825, 1}, {0x2fb2, 826, 1}, {0x2fb3, 827, 1},
+ {0x2fb4, 828, 1}, {0x2fb5, 829, 1}, {0x2fb6, 830, 1},
+ {0x2fb7, 831, 1}, {0x2fb8, 832, 1}, {0x2fb9, 833, 1},
+ {0x2fba, 834, 1}, {0x2fbb, 835, 1}, {0x2fbc, 836, 1},
+ {0x2fbd, 837, 1}, {0x2fbe, 838, 1}, {0x2fbf, 839, 1},
+ {0x2fc0, 840, 1}, {0x2fc1, 841, 1}, {0x2fc2, 842, 1},
+ {0x2fc3, 843, 1}, {0x2fc4, 844, 1}, {0x2fc5, 845, 1},
+ {0x2fc6, 846, 1}, {0x2fc7, 847, 1}, {0x2fc8, 848, 1},
+ {0x2fc9, 849, 1}, {0x2fca, 850, 1}, {0x2fcb, 851, 1},
+ {0x2fcc, 852, 1}, {0x2fcd, 853, 1}, {0x2fce, 854, 1},
+ {0x2fcf, 855, 1}, {0x2fd0, 856, 1}, {0x2fd1, 857, 1},
+ {0x2fd2, 858, 1}, {0x2fd3, 859, 1}, {0x2fd4, 860, 1},
+ {0x2fd5, 861, 1}, {0x3000, 862, 1}, {0x3036, 863, 1},
+ {0x3038, 864, 1}, {0x3039, 865, 1}, {0x303a, 866, 1},
+ {0x309b, 867, 2}, {0x309c, 869, 2}, {0x3131, 871, 1},
+ {0x3132, 872, 1}, {0x3133, 873, 1}, {0x3134, 874, 1},
+ {0x3135, 875, 1}, {0x3136, 876, 1}, {0x3137, 877, 1},
+ {0x3138, 878, 1}, {0x3139, 879, 1}, {0x313a, 880, 1},
+ {0x313b, 881, 1}, {0x313c, 882, 1}, {0x313d, 883, 1},
+ {0x313e, 884, 1}, {0x313f, 885, 1}, {0x3140, 886, 1},
+ {0x3141, 887, 1}, {0x3142, 888, 1}, {0x3143, 889, 1},
+ {0x3144, 890, 1}, {0x3145, 891, 1}, {0x3146, 892, 1},
+ {0x3147, 893, 1}, {0x3148, 894, 1}, {0x3149, 895, 1},
+ {0x314a, 896, 1}, {0x314b, 897, 1}, {0x314c, 898, 1},
+ {0x314d, 899, 1}, {0x314e, 900, 1}, {0x314f, 901, 1},
+ {0x3150, 902, 1}, {0x3151, 903, 1}, {0x3152, 904, 1},
+ {0x3153, 905, 1}, {0x3154, 906, 1}, {0x3155, 907, 1},
+ {0x3156, 908, 1}, {0x3157, 909, 1}, {0x3158, 910, 1},
+ {0x3159, 911, 1}, {0x315a, 912, 1}, {0x315b, 913, 1},
+ {0x315c, 914, 1}, {0x315d, 915, 1}, {0x315e, 916, 1},
+ {0x315f, 917, 1}, {0x3160, 918, 1}, {0x3161, 919, 1},
+ {0x3162, 920, 1}, {0x3163, 921, 1}, {0x3164, 922, 1},
+ {0x3165, 923, 1}, {0x3166, 924, 1}, {0x3167, 925, 1},
+ {0x3168, 926, 1}, {0x3169, 927, 1}, {0x316a, 928, 1},
+ {0x316b, 929, 1}, {0x316c, 930, 1}, {0x316d, 931, 1},
+ {0x316e, 932, 1}, {0x316f, 933, 1}, {0x3170, 934, 1},
+ {0x3171, 935, 1}, {0x3172, 936, 1}, {0x3173, 937, 1},
+ {0x3174, 938, 1}, {0x3175, 939, 1}, {0x3176, 940, 1},
+ {0x3177, 941, 1}, {0x3178, 942, 1}, {0x3179, 943, 1},
+ {0x317a, 944, 1}, {0x317b, 945, 1}, {0x317c, 946, 1},
+ {0x317d, 947, 1}, {0x317e, 948, 1}, {0x317f, 949, 1},
+ {0x3180, 950, 1}, {0x3181, 951, 1}, {0x3182, 952, 1},
+ {0x3183, 953, 1}, {0x3184, 954, 1}, {0x3185, 955, 1},
+ {0x3186, 956, 1}, {0x3187, 957, 1}, {0x3188, 958, 1},
+ {0x3189, 959, 1}, {0x318a, 960, 1}, {0x318b, 961, 1},
+ {0x318c, 962, 1}, {0x318d, 963, 1}, {0x318e, 964, 1},
+ {0x3192, 965, 1}, {0x3193, 966, 1}, {0x3194, 967, 1},
+ {0x3195, 968, 1}, {0x3196, 969, 1}, {0x3197, 970, 1},
+ {0x3198, 971, 1}, {0x3199, 972, 1}, {0x319a, 973, 1},
+ {0x319b, 974, 1}, {0x319c, 975, 1}, {0x319d, 976, 1},
+ {0x319e, 977, 1}, {0x319f, 978, 1}, {0x3200, 979, 3},
+ {0x3201, 982, 3}, {0x3202, 985, 3}, {0x3203, 988, 3},
+ {0x3204, 991, 3}, {0x3205, 994, 3}, {0x3206, 997, 3},
+ {0x3207, 1000, 3}, {0x3208, 1003, 3}, {0x3209, 1006, 3},
+ {0x320a, 1009, 3}, {0x320b, 1012, 3}, {0x320c, 1015, 3},
+ {0x320d, 1018, 3}, {0x320e, 1021, 4}, {0x320f, 1025, 4},
+ {0x3210, 1029, 4}, {0x3211, 1033, 4}, {0x3212, 1037, 4},
+ {0x3213, 1041, 4}, {0x3214, 1045, 4}, {0x3215, 1049, 4},
+ {0x3216, 1053, 4}, {0x3217, 1057, 4}, {0x3218, 1061, 4},
+ {0x3219, 1065, 4}, {0x321a, 1069, 4}, {0x321b, 1073, 4},
+ {0x321c, 1077, 4}, {0x3220, 1081, 3}, {0x3221, 1084, 3},
+ {0x3222, 1087, 3}, {0x3223, 1090, 3}, {0x3224, 1093, 3},
+ {0x3225, 1096, 3}, {0x3226, 1099, 3}, {0x3227, 1102, 3},
+ {0x3228, 1105, 3}, {0x3229, 1108, 3}, {0x322a, 1111, 3},
+ {0x322b, 1114, 3}, {0x322c, 1117, 3}, {0x322d, 1120, 3},
+ {0x322e, 1123, 3}, {0x322f, 1126, 3}, {0x3230, 1129, 3},
+ {0x3231, 1132, 3}, {0x3232, 1135, 3}, {0x3233, 1138, 3},
+ {0x3234, 1141, 3}, {0x3235, 1144, 3}, {0x3236, 1147, 3},
+ {0x3237, 1150, 3}, {0x3238, 1153, 3}, {0x3239, 1156, 3},
+ {0x323a, 1159, 3}, {0x323b, 1162, 3}, {0x323c, 1165, 3},
+ {0x323d, 1168, 3}, {0x323e, 1171, 3}, {0x323f, 1174, 3},
+ {0x3240, 1177, 3}, {0x3241, 1180, 3}, {0x3242, 1183, 3},
+ {0x3243, 1186, 3}, {0x3260, 1189, 1}, {0x3261, 1190, 1},
+ {0x3262, 1191, 1}, {0x3263, 1192, 1}, {0x3264, 1193, 1},
+ {0x3265, 1194, 1}, {0x3266, 1195, 1}, {0x3267, 1196, 1},
+ {0x3268, 1197, 1}, {0x3269, 1198, 1}, {0x326a, 1199, 1},
+ {0x326b, 1200, 1}, {0x326c, 1201, 1}, {0x326d, 1202, 1},
+ {0x326e, 1203, 2}, {0x326f, 1205, 2}, {0x3270, 1207, 2},
+ {0x3271, 1209, 2}, {0x3272, 1211, 2}, {0x3273, 1213, 2},
+ {0x3274, 1215, 2}, {0x3275, 1217, 2}, {0x3276, 1219, 2},
+ {0x3277, 1221, 2}, {0x3278, 1223, 2}, {0x3279, 1225, 2},
+ {0x327a, 1227, 2}, {0x327b, 1229, 2}, {0x3280, 1231, 1},
+ {0x3281, 1232, 1}, {0x3282, 1233, 1}, {0x3283, 1234, 1},
+ {0x3284, 1235, 1}, {0x3285, 1236, 1}, {0x3286, 1237, 1},
+ {0x3287, 1238, 1}, {0x3288, 1239, 1}, {0x3289, 1240, 1},
+ {0x328a, 1241, 1}, {0x328b, 1242, 1}, {0x328c, 1243, 1},
+ {0x328d, 1244, 1}, {0x328e, 1245, 1}, {0x328f, 1246, 1},
+ {0x3290, 1247, 1}, {0x3291, 1248, 1}, {0x3292, 1249, 1},
+ {0x3293, 1250, 1}, {0x3294, 1251, 1}, {0x3295, 1252, 1},
+ {0x3296, 1253, 1}, {0x3297, 1254, 1}, {0x3298, 1255, 1},
+ {0x3299, 1256, 1}, {0x329a, 1257, 1}, {0x329b, 1258, 1},
+ {0x329c, 1259, 1}, {0x329d, 1260, 1}, {0x329e, 1261, 1},
+ {0x329f, 1262, 1}, {0x32a0, 1263, 1}, {0x32a1, 1264, 1},
+ {0x32a2, 1265, 1}, {0x32a3, 1266, 1}, {0x32a4, 1267, 1},
+ {0x32a5, 1268, 1}, {0x32a6, 1269, 1}, {0x32a7, 1270, 1},
+ {0x32a8, 1271, 1}, {0x32a9, 1272, 1}, {0x32aa, 1273, 1},
+ {0x32ab, 1274, 1}, {0x32ac, 1275, 1}, {0x32ad, 1276, 1},
+ {0x32ae, 1277, 1}, {0x32af, 1278, 1}, {0x32b0, 1279, 1},
+ {0x32c0, 1280, 2}, {0x32c1, 1282, 2}, {0x32c2, 1284, 2},
+ {0x32c3, 1286, 2}, {0x32c4, 1288, 2}, {0x32c5, 1290, 2},
+ {0x32c6, 1292, 2}, {0x32c7, 1294, 2}, {0x32c8, 1296, 2},
+ {0x32c9, 1298, 3}, {0x32ca, 1301, 3}, {0x32cb, 1304, 3},
+ {0x32d0, 1307, 1}, {0x32d1, 1308, 1}, {0x32d2, 1309, 1},
+ {0x32d3, 1310, 1}, {0x32d4, 1311, 1}, {0x32d5, 1312, 1},
+ {0x32d6, 1313, 1}, {0x32d7, 1314, 1}, {0x32d8, 1315, 1},
+ {0x32d9, 1316, 1}, {0x32da, 1317, 1}, {0x32db, 1318, 1},
+ {0x32dc, 1319, 1}, {0x32dd, 1320, 1}, {0x32de, 1321, 1},
+ {0x32df, 1322, 1}, {0x32e0, 1323, 1}, {0x32e1, 1324, 1},
+ {0x32e2, 1325, 1}, {0x32e3, 1326, 1}, {0x32e4, 1327, 1},
+ {0x32e5, 1328, 1}, {0x32e6, 1329, 1}, {0x32e7, 1330, 1},
+ {0x32e8, 1331, 1}, {0x32e9, 1332, 1}, {0x32ea, 1333, 1},
+ {0x32eb, 1334, 1}, {0x32ec, 1335, 1}, {0x32ed, 1336, 1},
+ {0x32ee, 1337, 1}, {0x32ef, 1338, 1}, {0x32f0, 1339, 1},
+ {0x32f1, 1340, 1}, {0x32f2, 1341, 1}, {0x32f3, 1342, 1},
+ {0x32f4, 1343, 1}, {0x32f5, 1344, 1}, {0x32f6, 1345, 1},
+ {0x32f7, 1346, 1}, {0x32f8, 1347, 1}, {0x32f9, 1348, 1},
+ {0x32fa, 1349, 1}, {0x32fb, 1350, 1}, {0x32fc, 1351, 1},
+ {0x32fd, 1352, 1}, {0x32fe, 1353, 1}, {0x3300, 1354, 4},
+ {0x3301, 1358, 4}, {0x3302, 1362, 4}, {0x3303, 1366, 3},
+ {0x3304, 1369, 4}, {0x3305, 1373, 3}, {0x3306, 1376, 3},
+ {0x3307, 1379, 5}, {0x3308, 1384, 4}, {0x3309, 1388, 3},
+ {0x330a, 1391, 3}, {0x330b, 1394, 3}, {0x330c, 1397, 4},
+ {0x330d, 1401, 4}, {0x330e, 1405, 3}, {0x330f, 1408, 3},
+ {0x3310, 1411, 2}, {0x3311, 1413, 3}, {0x3312, 1416, 4},
+ {0x3313, 1420, 4}, {0x3314, 1424, 2}, {0x3315, 1426, 5},
+ {0x3316, 1431, 6}, {0x3317, 1437, 5}, {0x3318, 1442, 3},
+ {0x3319, 1445, 5}, {0x331a, 1450, 5}, {0x331b, 1455, 4},
+ {0x331c, 1459, 3}, {0x331d, 1462, 3}, {0x331e, 1465, 3},
+ {0x331f, 1468, 4}, {0x3320, 1472, 5}, {0x3321, 1477, 4},
+ {0x3322, 1481, 3}, {0x3323, 1484, 3}, {0x3324, 1487, 3},
+ {0x3325, 1490, 2}, {0x3326, 1492, 2}, {0x3327, 1494, 2},
+ {0x3328, 1496, 2}, {0x3329, 1498, 3}, {0x332a, 1501, 3},
+ {0x332b, 1504, 5}, {0x332c, 1509, 3}, {0x332d, 1512, 4},
+ {0x332e, 1516, 5}, {0x332f, 1521, 3}, {0x3330, 1524, 2},
+ {0x3331, 1526, 2}, {0x3332, 1528, 5}, {0x3333, 1533, 4},
+ {0x3334, 1537, 5}, {0x3335, 1542, 3}, {0x3336, 1545, 5},
+ {0x3337, 1550, 2}, {0x3338, 1552, 3}, {0x3339, 1555, 3},
+ {0x333a, 1558, 3}, {0x333b, 1561, 3}, {0x333c, 1564, 3},
+ {0x333d, 1567, 4}, {0x333e, 1571, 3}, {0x333f, 1574, 2},
+ {0x3340, 1576, 3}, {0x3341, 1579, 3}, {0x3342, 1582, 3},
+ {0x3343, 1585, 4}, {0x3344, 1589, 3}, {0x3345, 1592, 3},
+ {0x3346, 1595, 3}, {0x3347, 1598, 5}, {0x3348, 1603, 4},
+ {0x3349, 1607, 2}, {0x334a, 1609, 5}, {0x334b, 1614, 2},
+ {0x334c, 1616, 4}, {0x334d, 1620, 4}, {0x334e, 1624, 3},
+ {0x334f, 1627, 3}, {0x3350, 1630, 3}, {0x3351, 1633, 4},
+ {0x3352, 1637, 2}, {0x3353, 1639, 3}, {0x3354, 1642, 4},
+ {0x3355, 1646, 2}, {0x3356, 1648, 5}, {0x3357, 1653, 3},
+ {0x3358, 1656, 2}, {0x3359, 1658, 2}, {0x335a, 1660, 2},
+ {0x335b, 1662, 2}, {0x335c, 1664, 2}, {0x335d, 1666, 2},
+ {0x335e, 1668, 2}, {0x335f, 1670, 2}, {0x3360, 1672, 2},
+ {0x3361, 1674, 2}, {0x3362, 1676, 3}, {0x3363, 1679, 3},
+ {0x3364, 1682, 3}, {0x3365, 1685, 3}, {0x3366, 1688, 3},
+ {0x3367, 1691, 3}, {0x3368, 1694, 3}, {0x3369, 1697, 3},
+ {0x336a, 1700, 3}, {0x336b, 1703, 3}, {0x336c, 1706, 3},
+ {0x336d, 1709, 3}, {0x336e, 1712, 3}, {0x336f, 1715, 3},
+ {0x3370, 1718, 3}, {0x3371, 1721, 3}, {0x3372, 1724, 2},
+ {0x3373, 1726, 2}, {0x3374, 1728, 3}, {0x3375, 1731, 2},
+ {0x3376, 1733, 2}, {0x337b, 1735, 2}, {0x337c, 1737, 2},
+ {0x337d, 1739, 2}, {0x337e, 1741, 2}, {0x337f, 1743, 4},
+ {0x3380, 1747, 2}, {0x3381, 1749, 2}, {0x3382, 1751, 2},
+ {0x3383, 1753, 2}, {0x3384, 1755, 2}, {0x3385, 1757, 2},
+ {0x3386, 1759, 2}, {0x3387, 1761, 2}, {0x3388, 1763, 3},
+ {0x3389, 1766, 4}, {0x338a, 1770, 2}, {0x338b, 1772, 2},
+ {0x338c, 1774, 2}, {0x338d, 1776, 2}, {0x338e, 1778, 2},
+ {0x338f, 1780, 2}, {0x3390, 1782, 2}, {0x3391, 1784, 3},
+ {0x3392, 1787, 3}, {0x3393, 1790, 3}, {0x3394, 1793, 3},
+ {0x3395, 1796, 2}, {0x3396, 1798, 2}, {0x3397, 1800, 2},
+ {0x3398, 1802, 2}, {0x3399, 1804, 2}, {0x339a, 1806, 2},
+ {0x339b, 1808, 2}, {0x339c, 1810, 2}, {0x339d, 1812, 2},
+ {0x339e, 1814, 2}, {0x339f, 1816, 3}, {0x33a0, 1819, 3},
+ {0x33a1, 1822, 2}, {0x33a2, 1824, 3}, {0x33a3, 1827, 3},
+ {0x33a4, 1830, 3}, {0x33a5, 1833, 2}, {0x33a6, 1835, 3},
+ {0x33a7, 1838, 3}, {0x33a8, 1841, 4}, {0x33a9, 1845, 2},
+ {0x33aa, 1847, 3}, {0x33ab, 1850, 3}, {0x33ac, 1853, 3},
+ {0x33ad, 1856, 3}, {0x33ae, 1859, 5}, {0x33af, 1864, 6},
+ {0x33b0, 1870, 2}, {0x33b1, 1872, 2}, {0x33b2, 1874, 2},
+ {0x33b3, 1876, 2}, {0x33b4, 1878, 2}, {0x33b5, 1880, 2},
+ {0x33b6, 1882, 2}, {0x33b7, 1884, 2}, {0x33b8, 1886, 2},
+ {0x33b9, 1888, 2}, {0x33ba, 1890, 2}, {0x33bb, 1892, 2},
+ {0x33bc, 1894, 2}, {0x33bd, 1896, 2}, {0x33be, 1898, 2},
+ {0x33bf, 1900, 2}, {0x33c0, 1902, 2}, {0x33c1, 1904, 2},
+ {0x33c2, 1906, 4}, {0x33c3, 1910, 2}, {0x33c4, 1912, 2},
+ {0x33c5, 1914, 2}, {0x33c6, 1916, 4}, {0x33c7, 1920, 3},
+ {0x33c8, 1923, 2}, {0x33c9, 1925, 2}, {0x33ca, 1927, 2},
+ {0x33cb, 1929, 2}, {0x33cc, 1931, 2}, {0x33cd, 1933, 2},
+ {0x33ce, 1935, 2}, {0x33cf, 1937, 2}, {0x33d0, 1939, 2},
+ {0x33d1, 1941, 2}, {0x33d2, 1943, 3}, {0x33d3, 1946, 2},
+ {0x33d4, 1948, 2}, {0x33d5, 1950, 3}, {0x33d6, 1953, 3},
+ {0x33d7, 1956, 2}, {0x33d8, 1958, 4}, {0x33d9, 1962, 3},
+ {0x33da, 1965, 2}, {0x33db, 1967, 2}, {0x33dc, 1969, 2},
+ {0x33dd, 1971, 2}, {0x33e0, 1973, 2}, {0x33e1, 1975, 2},
+ {0x33e2, 1977, 2}, {0x33e3, 1979, 2}, {0x33e4, 1981, 2},
+ {0x33e5, 1983, 2}, {0x33e6, 1985, 2}, {0x33e7, 1987, 2},
+ {0x33e8, 1989, 2}, {0x33e9, 1991, 3}, {0x33ea, 1994, 3},
+ {0x33eb, 1997, 3}, {0x33ec, 2000, 3}, {0x33ed, 2003, 3},
+ {0x33ee, 2006, 3}, {0x33ef, 2009, 3}, {0x33f0, 2012, 3},
+ {0x33f1, 2015, 3}, {0x33f2, 2018, 3}, {0x33f3, 2021, 3},
+ {0x33f4, 2024, 3}, {0x33f5, 2027, 3}, {0x33f6, 2030, 3},
+ {0x33f7, 2033, 3}, {0x33f8, 2036, 3}, {0x33f9, 2039, 3},
+ {0x33fa, 2042, 3}, {0x33fb, 2045, 3}, {0x33fc, 2048, 3},
+ {0x33fd, 2051, 3}, {0x33fe, 2054, 3}, {0xfb00, 2057, 2},
+ {0xfb01, 2059, 2}, {0xfb02, 2061, 2}, {0xfb03, 2063, 3},
+ {0xfb04, 2066, 3}, {0xfb05, 2069, 2}, {0xfb06, 2071, 2},
+ {0xfb13, 2073, 2}, {0xfb14, 2075, 2}, {0xfb15, 2077, 2},
+ {0xfb16, 2079, 2}, {0xfb17, 2081, 2}, {0xfb20, 2083, 1},
+ {0xfb21, 2084, 1}, {0xfb22, 2085, 1}, {0xfb23, 2086, 1},
+ {0xfb24, 2087, 1}, {0xfb25, 2088, 1}, {0xfb26, 2089, 1},
+ {0xfb27, 2090, 1}, {0xfb28, 2091, 1}, {0xfb29, 2092, 1},
+ {0xfb4f, 2093, 2}, {0xfb50, 2095, 1}, {0xfb51, 2096, 1},
+ {0xfb52, 2097, 1}, {0xfb53, 2098, 1}, {0xfb54, 2099, 1},
+ {0xfb55, 2100, 1}, {0xfb56, 2101, 1}, {0xfb57, 2102, 1},
+ {0xfb58, 2103, 1}, {0xfb59, 2104, 1}, {0xfb5a, 2105, 1},
+ {0xfb5b, 2106, 1}, {0xfb5c, 2107, 1}, {0xfb5d, 2108, 1},
+ {0xfb5e, 2109, 1}, {0xfb5f, 2110, 1}, {0xfb60, 2111, 1},
+ {0xfb61, 2112, 1}, {0xfb62, 2113, 1}, {0xfb63, 2114, 1},
+ {0xfb64, 2115, 1}, {0xfb65, 2116, 1}, {0xfb66, 2117, 1},
+ {0xfb67, 2118, 1}, {0xfb68, 2119, 1}, {0xfb69, 2120, 1},
+ {0xfb6a, 2121, 1}, {0xfb6b, 2122, 1}, {0xfb6c, 2123, 1},
+ {0xfb6d, 2124, 1}, {0xfb6e, 2125, 1}, {0xfb6f, 2126, 1},
+ {0xfb70, 2127, 1}, {0xfb71, 2128, 1}, {0xfb72, 2129, 1},
+ {0xfb73, 2130, 1}, {0xfb74, 2131, 1}, {0xfb75, 2132, 1},
+ {0xfb76, 2133, 1}, {0xfb77, 2134, 1}, {0xfb78, 2135, 1},
+ {0xfb79, 2136, 1}, {0xfb7a, 2137, 1}, {0xfb7b, 2138, 1},
+ {0xfb7c, 2139, 1}, {0xfb7d, 2140, 1}, {0xfb7e, 2141, 1},
+ {0xfb7f, 2142, 1}, {0xfb80, 2143, 1}, {0xfb81, 2144, 1},
+ {0xfb82, 2145, 1}, {0xfb83, 2146, 1}, {0xfb84, 2147, 1},
+ {0xfb85, 2148, 1}, {0xfb86, 2149, 1}, {0xfb87, 2150, 1},
+ {0xfb88, 2151, 1}, {0xfb89, 2152, 1}, {0xfb8a, 2153, 1},
+ {0xfb8b, 2154, 1}, {0xfb8c, 2155, 1}, {0xfb8d, 2156, 1},
+ {0xfb8e, 2157, 1}, {0xfb8f, 2158, 1}, {0xfb90, 2159, 1},
+ {0xfb91, 2160, 1}, {0xfb92, 2161, 1}, {0xfb93, 2162, 1},
+ {0xfb94, 2163, 1}, {0xfb95, 2164, 1}, {0xfb96, 2165, 1},
+ {0xfb97, 2166, 1}, {0xfb98, 2167, 1}, {0xfb99, 2168, 1},
+ {0xfb9a, 2169, 1}, {0xfb9b, 2170, 1}, {0xfb9c, 2171, 1},
+ {0xfb9d, 2172, 1}, {0xfb9e, 2173, 1}, {0xfb9f, 2174, 1},
+ {0xfba0, 2175, 1}, {0xfba1, 2176, 1}, {0xfba2, 2177, 1},
+ {0xfba3, 2178, 1}, {0xfba4, 2179, 1}, {0xfba5, 2180, 1},
+ {0xfba6, 2181, 1}, {0xfba7, 2182, 1}, {0xfba8, 2183, 1},
+ {0xfba9, 2184, 1}, {0xfbaa, 2185, 1}, {0xfbab, 2186, 1},
+ {0xfbac, 2187, 1}, {0xfbad, 2188, 1}, {0xfbae, 2189, 1},
+ {0xfbaf, 2190, 1}, {0xfbb0, 2191, 1}, {0xfbb1, 2192, 1},
+ {0xfbd3, 2193, 1}, {0xfbd4, 2194, 1}, {0xfbd5, 2195, 1},
+ {0xfbd6, 2196, 1}, {0xfbd7, 2197, 1}, {0xfbd8, 2198, 1},
+ {0xfbd9, 2199, 1}, {0xfbda, 2200, 1}, {0xfbdb, 2201, 1},
+ {0xfbdc, 2202, 1}, {0xfbdd, 2203, 1}, {0xfbde, 2204, 1},
+ {0xfbdf, 2205, 1}, {0xfbe0, 2206, 1}, {0xfbe1, 2207, 1},
+ {0xfbe2, 2208, 1}, {0xfbe3, 2209, 1}, {0xfbe4, 2210, 1},
+ {0xfbe5, 2211, 1}, {0xfbe6, 2212, 1}, {0xfbe7, 2213, 1},
+ {0xfbe8, 2214, 1}, {0xfbe9, 2215, 1}, {0xfbea, 2216, 2},
+ {0xfbeb, 2218, 2}, {0xfbec, 2220, 2}, {0xfbed, 2222, 2},
+ {0xfbee, 2224, 2}, {0xfbef, 2226, 2}, {0xfbf0, 2228, 2},
+ {0xfbf1, 2230, 2}, {0xfbf2, 2232, 2}, {0xfbf3, 2234, 2},
+ {0xfbf4, 2236, 2}, {0xfbf5, 2238, 2}, {0xfbf6, 2240, 2},
+ {0xfbf7, 2242, 2}, {0xfbf8, 2244, 2}, {0xfbf9, 2246, 2},
+ {0xfbfa, 2248, 2}, {0xfbfb, 2250, 2}, {0xfbfc, 2252, 1},
+ {0xfbfd, 2253, 1}, {0xfbfe, 2254, 1}, {0xfbff, 2255, 1},
+ {0xfc00, 2256, 2}, {0xfc01, 2258, 2}, {0xfc02, 2260, 2},
+ {0xfc03, 2262, 2}, {0xfc04, 2264, 2}, {0xfc05, 2266, 2},
+ {0xfc06, 2268, 2}, {0xfc07, 2270, 2}, {0xfc08, 2272, 2},
+ {0xfc09, 2274, 2}, {0xfc0a, 2276, 2}, {0xfc0b, 2278, 2},
+ {0xfc0c, 2280, 2}, {0xfc0d, 2282, 2}, {0xfc0e, 2284, 2},
+ {0xfc0f, 2286, 2}, {0xfc10, 2288, 2}, {0xfc11, 2290, 2},
+ {0xfc12, 2292, 2}, {0xfc13, 2294, 2}, {0xfc14, 2296, 2},
+ {0xfc15, 2298, 2}, {0xfc16, 2300, 2}, {0xfc17, 2302, 2},
+ {0xfc18, 2304, 2}, {0xfc19, 2306, 2}, {0xfc1a, 2308, 2},
+ {0xfc1b, 2310, 2}, {0xfc1c, 2312, 2}, {0xfc1d, 2314, 2},
+ {0xfc1e, 2316, 2}, {0xfc1f, 2318, 2}, {0xfc20, 2320, 2},
+ {0xfc21, 2322, 2}, {0xfc22, 2324, 2}, {0xfc23, 2326, 2},
+ {0xfc24, 2328, 2}, {0xfc25, 2330, 2}, {0xfc26, 2332, 2},
+ {0xfc27, 2334, 2}, {0xfc28, 2336, 2}, {0xfc29, 2338, 2},
+ {0xfc2a, 2340, 2}, {0xfc2b, 2342, 2}, {0xfc2c, 2344, 2},
+ {0xfc2d, 2346, 2}, {0xfc2e, 2348, 2}, {0xfc2f, 2350, 2},
+ {0xfc30, 2352, 2}, {0xfc31, 2354, 2}, {0xfc32, 2356, 2},
+ {0xfc33, 2358, 2}, {0xfc34, 2360, 2}, {0xfc35, 2362, 2},
+ {0xfc36, 2364, 2}, {0xfc37, 2366, 2}, {0xfc38, 2368, 2},
+ {0xfc39, 2370, 2}, {0xfc3a, 2372, 2}, {0xfc3b, 2374, 2},
+ {0xfc3c, 2376, 2}, {0xfc3d, 2378, 2}, {0xfc3e, 2380, 2},
+ {0xfc3f, 2382, 2}, {0xfc40, 2384, 2}, {0xfc41, 2386, 2},
+ {0xfc42, 2388, 2}, {0xfc43, 2390, 2}, {0xfc44, 2392, 2},
+ {0xfc45, 2394, 2}, {0xfc46, 2396, 2}, {0xfc47, 2398, 2},
+ {0xfc48, 2400, 2}, {0xfc49, 2402, 2}, {0xfc4a, 2404, 2},
+ {0xfc4b, 2406, 2}, {0xfc4c, 2408, 2}, {0xfc4d, 2410, 2},
+ {0xfc4e, 2412, 2}, {0xfc4f, 2414, 2}, {0xfc50, 2416, 2},
+ {0xfc51, 2418, 2}, {0xfc52, 2420, 2}, {0xfc53, 2422, 2},
+ {0xfc54, 2424, 2}, {0xfc55, 2426, 2}, {0xfc56, 2428, 2},
+ {0xfc57, 2430, 2}, {0xfc58, 2432, 2}, {0xfc59, 2434, 2},
+ {0xfc5a, 2436, 2}, {0xfc5b, 2438, 2}, {0xfc5c, 2440, 2},
+ {0xfc5d, 2442, 2}, {0xfc5e, 2444, 3}, {0xfc5f, 2447, 3},
+ {0xfc60, 2450, 3}, {0xfc61, 2453, 3}, {0xfc62, 2456, 3},
+ {0xfc63, 2459, 3}, {0xfc64, 2462, 2}, {0xfc65, 2464, 2},
+ {0xfc66, 2466, 2}, {0xfc67, 2468, 2}, {0xfc68, 2470, 2},
+ {0xfc69, 2472, 2}, {0xfc6a, 2474, 2}, {0xfc6b, 2476, 2},
+ {0xfc6c, 2478, 2}, {0xfc6d, 2480, 2}, {0xfc6e, 2482, 2},
+ {0xfc6f, 2484, 2}, {0xfc70, 2486, 2}, {0xfc71, 2488, 2},
+ {0xfc72, 2490, 2}, {0xfc73, 2492, 2}, {0xfc74, 2494, 2},
+ {0xfc75, 2496, 2}, {0xfc76, 2498, 2}, {0xfc77, 2500, 2},
+ {0xfc78, 2502, 2}, {0xfc79, 2504, 2}, {0xfc7a, 2506, 2},
+ {0xfc7b, 2508, 2}, {0xfc7c, 2510, 2}, {0xfc7d, 2512, 2},
+ {0xfc7e, 2514, 2}, {0xfc7f, 2516, 2}, {0xfc80, 2518, 2},
+ {0xfc81, 2520, 2}, {0xfc82, 2522, 2}, {0xfc83, 2524, 2},
+ {0xfc84, 2526, 2}, {0xfc85, 2528, 2}, {0xfc86, 2530, 2},
+ {0xfc87, 2532, 2}, {0xfc88, 2534, 2}, {0xfc89, 2536, 2},
+ {0xfc8a, 2538, 2}, {0xfc8b, 2540, 2}, {0xfc8c, 2542, 2},
+ {0xfc8d, 2544, 2}, {0xfc8e, 2546, 2}, {0xfc8f, 2548, 2},
+ {0xfc90, 2550, 2}, {0xfc91, 2552, 2}, {0xfc92, 2554, 2},
+ {0xfc93, 2556, 2}, {0xfc94, 2558, 2}, {0xfc95, 2560, 2},
+ {0xfc96, 2562, 2}, {0xfc97, 2564, 2}, {0xfc98, 2566, 2},
+ {0xfc99, 2568, 2}, {0xfc9a, 2570, 2}, {0xfc9b, 2572, 2},
+ {0xfc9c, 2574, 2}, {0xfc9d, 2576, 2}, {0xfc9e, 2578, 2},
+ {0xfc9f, 2580, 2}, {0xfca0, 2582, 2}, {0xfca1, 2584, 2},
+ {0xfca2, 2586, 2}, {0xfca3, 2588, 2}, {0xfca4, 2590, 2},
+ {0xfca5, 2592, 2}, {0xfca6, 2594, 2}, {0xfca7, 2596, 2},
+ {0xfca8, 2598, 2}, {0xfca9, 2600, 2}, {0xfcaa, 2602, 2},
+ {0xfcab, 2604, 2}, {0xfcac, 2606, 2}, {0xfcad, 2608, 2},
+ {0xfcae, 2610, 2}, {0xfcaf, 2612, 2}, {0xfcb0, 2614, 2},
+ {0xfcb1, 2616, 2}, {0xfcb2, 2618, 2}, {0xfcb3, 2620, 2},
+ {0xfcb4, 2622, 2}, {0xfcb5, 2624, 2}, {0xfcb6, 2626, 2},
+ {0xfcb7, 2628, 2}, {0xfcb8, 2630, 2}, {0xfcb9, 2632, 2},
+ {0xfcba, 2634, 2}, {0xfcbb, 2636, 2}, {0xfcbc, 2638, 2},
+ {0xfcbd, 2640, 2}, {0xfcbe, 2642, 2}, {0xfcbf, 2644, 2},
+ {0xfcc0, 2646, 2}, {0xfcc1, 2648, 2}, {0xfcc2, 2650, 2},
+ {0xfcc3, 2652, 2}, {0xfcc4, 2654, 2}, {0xfcc5, 2656, 2},
+ {0xfcc6, 2658, 2}, {0xfcc7, 2660, 2}, {0xfcc8, 2662, 2},
+ {0xfcc9, 2664, 2}, {0xfcca, 2666, 2}, {0xfccb, 2668, 2},
+ {0xfccc, 2670, 2}, {0xfccd, 2672, 2}, {0xfcce, 2674, 2},
+ {0xfccf, 2676, 2}, {0xfcd0, 2678, 2}, {0xfcd1, 2680, 2},
+ {0xfcd2, 2682, 2}, {0xfcd3, 2684, 2}, {0xfcd4, 2686, 2},
+ {0xfcd5, 2688, 2}, {0xfcd6, 2690, 2}, {0xfcd7, 2692, 2},
+ {0xfcd8, 2694, 2}, {0xfcd9, 2696, 2}, {0xfcda, 2698, 2},
+ {0xfcdb, 2700, 2}, {0xfcdc, 2702, 2}, {0xfcdd, 2704, 2},
+ {0xfcde, 2706, 2}, {0xfcdf, 2708, 2}, {0xfce0, 2710, 2},
+ {0xfce1, 2712, 2}, {0xfce2, 2714, 2}, {0xfce3, 2716, 2},
+ {0xfce4, 2718, 2}, {0xfce5, 2720, 2}, {0xfce6, 2722, 2},
+ {0xfce7, 2724, 2}, {0xfce8, 2726, 2}, {0xfce9, 2728, 2},
+ {0xfcea, 2730, 2}, {0xfceb, 2732, 2}, {0xfcec, 2734, 2},
+ {0xfced, 2736, 2}, {0xfcee, 2738, 2}, {0xfcef, 2740, 2},
+ {0xfcf0, 2742, 2}, {0xfcf1, 2744, 2}, {0xfcf2, 2746, 3},
+ {0xfcf3, 2749, 3}, {0xfcf4, 2752, 3}, {0xfcf5, 2755, 2},
+ {0xfcf6, 2757, 2}, {0xfcf7, 2759, 2}, {0xfcf8, 2761, 2},
+ {0xfcf9, 2763, 2}, {0xfcfa, 2765, 2}, {0xfcfb, 2767, 2},
+ {0xfcfc, 2769, 2}, {0xfcfd, 2771, 2}, {0xfcfe, 2773, 2},
+ {0xfcff, 2775, 2}, {0xfd00, 2777, 2}, {0xfd01, 2779, 2},
+ {0xfd02, 2781, 2}, {0xfd03, 2783, 2}, {0xfd04, 2785, 2},
+ {0xfd05, 2787, 2}, {0xfd06, 2789, 2}, {0xfd07, 2791, 2},
+ {0xfd08, 2793, 2}, {0xfd09, 2795, 2}, {0xfd0a, 2797, 2},
+ {0xfd0b, 2799, 2}, {0xfd0c, 2801, 2}, {0xfd0d, 2803, 2},
+ {0xfd0e, 2805, 2}, {0xfd0f, 2807, 2}, {0xfd10, 2809, 2},
+ {0xfd11, 2811, 2}, {0xfd12, 2813, 2}, {0xfd13, 2815, 2},
+ {0xfd14, 2817, 2}, {0xfd15, 2819, 2}, {0xfd16, 2821, 2},
+ {0xfd17, 2823, 2}, {0xfd18, 2825, 2}, {0xfd19, 2827, 2},
+ {0xfd1a, 2829, 2}, {0xfd1b, 2831, 2}, {0xfd1c, 2833, 2},
+ {0xfd1d, 2835, 2}, {0xfd1e, 2837, 2}, {0xfd1f, 2839, 2},
+ {0xfd20, 2841, 2}, {0xfd21, 2843, 2}, {0xfd22, 2845, 2},
+ {0xfd23, 2847, 2}, {0xfd24, 2849, 2}, {0xfd25, 2851, 2},
+ {0xfd26, 2853, 2}, {0xfd27, 2855, 2}, {0xfd28, 2857, 2},
+ {0xfd29, 2859, 2}, {0xfd2a, 2861, 2}, {0xfd2b, 2863, 2},
+ {0xfd2c, 2865, 2}, {0xfd2d, 2867, 2}, {0xfd2e, 2869, 2},
+ {0xfd2f, 2871, 2}, {0xfd30, 2873, 2}, {0xfd31, 2875, 2},
+ {0xfd32, 2877, 2}, {0xfd33, 2879, 2}, {0xfd34, 2881, 2},
+ {0xfd35, 2883, 2}, {0xfd36, 2885, 2}, {0xfd37, 2887, 2},
+ {0xfd38, 2889, 2}, {0xfd39, 2891, 2}, {0xfd3a, 2893, 2},
+ {0xfd3b, 2895, 2}, {0xfd3c, 2897, 2}, {0xfd3d, 2899, 2},
+ {0xfd50, 2901, 3}, {0xfd51, 2904, 3}, {0xfd52, 2907, 3},
+ {0xfd53, 2910, 3}, {0xfd54, 2913, 3}, {0xfd55, 2916, 3},
+ {0xfd56, 2919, 3}, {0xfd57, 2922, 3}, {0xfd58, 2925, 3},
+ {0xfd59, 2928, 3}, {0xfd5a, 2931, 3}, {0xfd5b, 2934, 3},
+ {0xfd5c, 2937, 3}, {0xfd5d, 2940, 3}, {0xfd5e, 2943, 3},
+ {0xfd5f, 2946, 3}, {0xfd60, 2949, 3}, {0xfd61, 2952, 3},
+ {0xfd62, 2955, 3}, {0xfd63, 2958, 3}, {0xfd64, 2961, 3},
+ {0xfd65, 2964, 3}, {0xfd66, 2967, 3}, {0xfd67, 2970, 3},
+ {0xfd68, 2973, 3}, {0xfd69, 2976, 3}, {0xfd6a, 2979, 3},
+ {0xfd6b, 2982, 3}, {0xfd6c, 2985, 3}, {0xfd6d, 2988, 3},
+ {0xfd6e, 2991, 3}, {0xfd6f, 2994, 3}, {0xfd70, 2997, 3},
+ {0xfd71, 3000, 3}, {0xfd72, 3003, 3}, {0xfd73, 3006, 3},
+ {0xfd74, 3009, 3}, {0xfd75, 3012, 3}, {0xfd76, 3015, 3},
+ {0xfd77, 3018, 3}, {0xfd78, 3021, 3}, {0xfd79, 3024, 3},
+ {0xfd7a, 3027, 3}, {0xfd7b, 3030, 3}, {0xfd7c, 3033, 3},
+ {0xfd7d, 3036, 3}, {0xfd7e, 3039, 3}, {0xfd7f, 3042, 3},
+ {0xfd80, 3045, 3}, {0xfd81, 3048, 3}, {0xfd82, 3051, 3},
+ {0xfd83, 3054, 3}, {0xfd84, 3057, 3}, {0xfd85, 3060, 3},
+ {0xfd86, 3063, 3}, {0xfd87, 3066, 3}, {0xfd88, 3069, 3},
+ {0xfd89, 3072, 3}, {0xfd8a, 3075, 3}, {0xfd8b, 3078, 3},
+ {0xfd8c, 3081, 3}, {0xfd8d, 3084, 3}, {0xfd8e, 3087, 3},
+ {0xfd8f, 3090, 3}, {0xfd92, 3093, 3}, {0xfd93, 3096, 3},
+ {0xfd94, 3099, 3}, {0xfd95, 3102, 3}, {0xfd96, 3105, 3},
+ {0xfd97, 3108, 3}, {0xfd98, 3111, 3}, {0xfd99, 3114, 3},
+ {0xfd9a, 3117, 3}, {0xfd9b, 3120, 3}, {0xfd9c, 3123, 3},
+ {0xfd9d, 3126, 3}, {0xfd9e, 3129, 3}, {0xfd9f, 3132, 3},
+ {0xfda0, 3135, 3}, {0xfda1, 3138, 3}, {0xfda2, 3141, 3},
+ {0xfda3, 3144, 3}, {0xfda4, 3147, 3}, {0xfda5, 3150, 3},
+ {0xfda6, 3153, 3}, {0xfda7, 3156, 3}, {0xfda8, 3159, 3},
+ {0xfda9, 3162, 3}, {0xfdaa, 3165, 3}, {0xfdab, 3168, 3},
+ {0xfdac, 3171, 3}, {0xfdad, 3174, 3}, {0xfdae, 3177, 3},
+ {0xfdaf, 3180, 3}, {0xfdb0, 3183, 3}, {0xfdb1, 3186, 3},
+ {0xfdb2, 3189, 3}, {0xfdb3, 3192, 3}, {0xfdb4, 3195, 3},
+ {0xfdb5, 3198, 3}, {0xfdb6, 3201, 3}, {0xfdb7, 3204, 3},
+ {0xfdb8, 3207, 3}, {0xfdb9, 3210, 3}, {0xfdba, 3213, 3},
+ {0xfdbb, 3216, 3}, {0xfdbc, 3219, 3}, {0xfdbd, 3222, 3},
+ {0xfdbe, 3225, 3}, {0xfdbf, 3228, 3}, {0xfdc0, 3231, 3},
+ {0xfdc1, 3234, 3}, {0xfdc2, 3237, 3}, {0xfdc3, 3240, 3},
+ {0xfdc4, 3243, 3}, {0xfdc5, 3246, 3}, {0xfdc6, 3249, 3},
+ {0xfdc7, 3252, 3}, {0xfdf0, 3255, 3}, {0xfdf1, 3258, 3},
+ {0xfdf2, 3261, 4}, {0xfdf3, 3265, 4}, {0xfdf4, 3269, 4},
+ {0xfdf5, 3273, 4}, {0xfdf6, 3277, 4}, {0xfdf7, 3281, 4},
+ {0xfdf8, 3285, 4}, {0xfdf9, 3289, 3}, {0xfdfa, 3292, 18},
+ {0xfdfb, 3310, 8}, {0xfe30, 3318, 1}, {0xfe31, 3319, 1},
+ {0xfe32, 3320, 1}, {0xfe33, 3321, 1}, {0xfe34, 3322, 1},
+ {0xfe35, 3323, 1}, {0xfe36, 3324, 1}, {0xfe37, 3325, 1},
+ {0xfe38, 3326, 1}, {0xfe39, 3327, 1}, {0xfe3a, 3328, 1},
+ {0xfe3b, 3329, 1}, {0xfe3c, 3330, 1}, {0xfe3d, 3331, 1},
+ {0xfe3e, 3332, 1}, {0xfe3f, 3333, 1}, {0xfe40, 3334, 1},
+ {0xfe41, 3335, 1}, {0xfe42, 3336, 1}, {0xfe43, 3337, 1},
+ {0xfe44, 3338, 1}, {0xfe49, 3339, 1}, {0xfe4a, 3340, 1},
+ {0xfe4b, 3341, 1}, {0xfe4c, 3342, 1}, {0xfe4d, 3343, 1},
+ {0xfe4e, 3344, 1}, {0xfe4f, 3345, 1}, {0xfe50, 3346, 1},
+ {0xfe51, 3347, 1}, {0xfe52, 3348, 1}, {0xfe54, 3349, 1},
+ {0xfe55, 3350, 1}, {0xfe56, 3351, 1}, {0xfe57, 3352, 1},
+ {0xfe58, 3353, 1}, {0xfe59, 3354, 1}, {0xfe5a, 3355, 1},
+ {0xfe5b, 3356, 1}, {0xfe5c, 3357, 1}, {0xfe5d, 3358, 1},
+ {0xfe5e, 3359, 1}, {0xfe5f, 3360, 1}, {0xfe60, 3361, 1},
+ {0xfe61, 3362, 1}, {0xfe62, 3363, 1}, {0xfe63, 3364, 1},
+ {0xfe64, 3365, 1}, {0xfe65, 3366, 1}, {0xfe66, 3367, 1},
+ {0xfe68, 3368, 1}, {0xfe69, 3369, 1}, {0xfe6a, 3370, 1},
+ {0xfe6b, 3371, 1}, {0xfe70, 3372, 2}, {0xfe71, 3374, 2},
+ {0xfe72, 3376, 2}, {0xfe74, 3378, 2}, {0xfe76, 3380, 2},
+ {0xfe77, 3382, 2}, {0xfe78, 3384, 2}, {0xfe79, 3386, 2},
+ {0xfe7a, 3388, 2}, {0xfe7b, 3390, 2}, {0xfe7c, 3392, 2},
+ {0xfe7d, 3394, 2}, {0xfe7e, 3396, 2}, {0xfe7f, 3398, 2},
+ {0xfe80, 3400, 1}, {0xfe81, 3401, 1}, {0xfe82, 3402, 1},
+ {0xfe83, 3403, 1}, {0xfe84, 3404, 1}, {0xfe85, 3405, 1},
+ {0xfe86, 3406, 1}, {0xfe87, 3407, 1}, {0xfe88, 3408, 1},
+ {0xfe89, 3409, 1}, {0xfe8a, 3410, 1}, {0xfe8b, 3411, 1},
+ {0xfe8c, 3412, 1}, {0xfe8d, 3413, 1}, {0xfe8e, 3414, 1},
+ {0xfe8f, 3415, 1}, {0xfe90, 3416, 1}, {0xfe91, 3417, 1},
+ {0xfe92, 3418, 1}, {0xfe93, 3419, 1}, {0xfe94, 3420, 1},
+ {0xfe95, 3421, 1}, {0xfe96, 3422, 1}, {0xfe97, 3423, 1},
+ {0xfe98, 3424, 1}, {0xfe99, 3425, 1}, {0xfe9a, 3426, 1},
+ {0xfe9b, 3427, 1}, {0xfe9c, 3428, 1}, {0xfe9d, 3429, 1},
+ {0xfe9e, 3430, 1}, {0xfe9f, 3431, 1}, {0xfea0, 3432, 1},
+ {0xfea1, 3433, 1}, {0xfea2, 3434, 1}, {0xfea3, 3435, 1},
+ {0xfea4, 3436, 1}, {0xfea5, 3437, 1}, {0xfea6, 3438, 1},
+ {0xfea7, 3439, 1}, {0xfea8, 3440, 1}, {0xfea9, 3441, 1},
+ {0xfeaa, 3442, 1}, {0xfeab, 3443, 1}, {0xfeac, 3444, 1},
+ {0xfead, 3445, 1}, {0xfeae, 3446, 1}, {0xfeaf, 3447, 1},
+ {0xfeb0, 3448, 1}, {0xfeb1, 3449, 1}, {0xfeb2, 3450, 1},
+ {0xfeb3, 3451, 1}, {0xfeb4, 3452, 1}, {0xfeb5, 3453, 1},
+ {0xfeb6, 3454, 1}, {0xfeb7, 3455, 1}, {0xfeb8, 3456, 1},
+ {0xfeb9, 3457, 1}, {0xfeba, 3458, 1}, {0xfebb, 3459, 1},
+ {0xfebc, 3460, 1}, {0xfebd, 3461, 1}, {0xfebe, 3462, 1},
+ {0xfebf, 3463, 1}, {0xfec0, 3464, 1}, {0xfec1, 3465, 1},
+ {0xfec2, 3466, 1}, {0xfec3, 3467, 1}, {0xfec4, 3468, 1},
+ {0xfec5, 3469, 1}, {0xfec6, 3470, 1}, {0xfec7, 3471, 1},
+ {0xfec8, 3472, 1}, {0xfec9, 3473, 1}, {0xfeca, 3474, 1},
+ {0xfecb, 3475, 1}, {0xfecc, 3476, 1}, {0xfecd, 3477, 1},
+ {0xfece, 3478, 1}, {0xfecf, 3479, 1}, {0xfed0, 3480, 1},
+ {0xfed1, 3481, 1}, {0xfed2, 3482, 1}, {0xfed3, 3483, 1},
+ {0xfed4, 3484, 1}, {0xfed5, 3485, 1}, {0xfed6, 3486, 1},
+ {0xfed7, 3487, 1}, {0xfed8, 3488, 1}, {0xfed9, 3489, 1},
+ {0xfeda, 3490, 1}, {0xfedb, 3491, 1}, {0xfedc, 3492, 1},
+ {0xfedd, 3493, 1}, {0xfede, 3494, 1}, {0xfedf, 3495, 1},
+ {0xfee0, 3496, 1}, {0xfee1, 3497, 1}, {0xfee2, 3498, 1},
+ {0xfee3, 3499, 1}, {0xfee4, 3500, 1}, {0xfee5, 3501, 1},
+ {0xfee6, 3502, 1}, {0xfee7, 3503, 1}, {0xfee8, 3504, 1},
+ {0xfee9, 3505, 1}, {0xfeea, 3506, 1}, {0xfeeb, 3507, 1},
+ {0xfeec, 3508, 1}, {0xfeed, 3509, 1}, {0xfeee, 3510, 1},
+ {0xfeef, 3511, 1}, {0xfef0, 3512, 1}, {0xfef1, 3513, 1},
+ {0xfef2, 3514, 1}, {0xfef3, 3515, 1}, {0xfef4, 3516, 1},
+ {0xfef5, 3517, 2}, {0xfef6, 3519, 2}, {0xfef7, 3521, 2},
+ {0xfef8, 3523, 2}, {0xfef9, 3525, 2}, {0xfefa, 3527, 2},
+ {0xfefb, 3529, 2}, {0xfefc, 3531, 2}, {0xff01, 3533, 1},
+ {0xff02, 3534, 1}, {0xff03, 3535, 1}, {0xff04, 3536, 1},
+ {0xff05, 3537, 1}, {0xff06, 3538, 1}, {0xff07, 3539, 1},
+ {0xff08, 3540, 1}, {0xff09, 3541, 1}, {0xff0a, 3542, 1},
+ {0xff0b, 3543, 1}, {0xff0c, 3544, 1}, {0xff0d, 3545, 1},
+ {0xff0e, 3546, 1}, {0xff0f, 3547, 1}, {0xff10, 3548, 1},
+ {0xff11, 3549, 1}, {0xff12, 3550, 1}, {0xff13, 3551, 1},
+ {0xff14, 3552, 1}, {0xff15, 3553, 1}, {0xff16, 3554, 1},
+ {0xff17, 3555, 1}, {0xff18, 3556, 1}, {0xff19, 3557, 1},
+ {0xff1a, 3558, 1}, {0xff1b, 3559, 1}, {0xff1c, 3560, 1},
+ {0xff1d, 3561, 1}, {0xff1e, 3562, 1}, {0xff1f, 3563, 1},
+ {0xff20, 3564, 1}, {0xff21, 3565, 1}, {0xff22, 3566, 1},
+ {0xff23, 3567, 1}, {0xff24, 3568, 1}, {0xff25, 3569, 1},
+ {0xff26, 3570, 1}, {0xff27, 3571, 1}, {0xff28, 3572, 1},
+ {0xff29, 3573, 1}, {0xff2a, 3574, 1}, {0xff2b, 3575, 1},
+ {0xff2c, 3576, 1}, {0xff2d, 3577, 1}, {0xff2e, 3578, 1},
+ {0xff2f, 3579, 1}, {0xff30, 3580, 1}, {0xff31, 3581, 1},
+ {0xff32, 3582, 1}, {0xff33, 3583, 1}, {0xff34, 3584, 1},
+ {0xff35, 3585, 1}, {0xff36, 3586, 1}, {0xff37, 3587, 1},
+ {0xff38, 3588, 1}, {0xff39, 3589, 1}, {0xff3a, 3590, 1},
+ {0xff3b, 3591, 1}, {0xff3c, 3592, 1}, {0xff3d, 3593, 1},
+ {0xff3e, 3594, 1}, {0xff3f, 3595, 1}, {0xff40, 3596, 1},
+ {0xff41, 3597, 1}, {0xff42, 3598, 1}, {0xff43, 3599, 1},
+ {0xff44, 3600, 1}, {0xff45, 3601, 1}, {0xff46, 3602, 1},
+ {0xff47, 3603, 1}, {0xff48, 3604, 1}, {0xff49, 3605, 1},
+ {0xff4a, 3606, 1}, {0xff4b, 3607, 1}, {0xff4c, 3608, 1},
+ {0xff4d, 3609, 1}, {0xff4e, 3610, 1}, {0xff4f, 3611, 1},
+ {0xff50, 3612, 1}, {0xff51, 3613, 1}, {0xff52, 3614, 1},
+ {0xff53, 3615, 1}, {0xff54, 3616, 1}, {0xff55, 3617, 1},
+ {0xff56, 3618, 1}, {0xff57, 3619, 1}, {0xff58, 3620, 1},
+ {0xff59, 3621, 1}, {0xff5a, 3622, 1}, {0xff5b, 3623, 1},
+ {0xff5c, 3624, 1}, {0xff5d, 3625, 1}, {0xff5e, 3626, 1},
+ {0xff61, 3627, 1}, {0xff62, 3628, 1}, {0xff63, 3629, 1},
+ {0xff64, 3630, 1}, {0xff65, 3631, 1}, {0xff66, 3632, 1},
+ {0xff67, 3633, 1}, {0xff68, 3634, 1}, {0xff69, 3635, 1},
+ {0xff6a, 3636, 1}, {0xff6b, 3637, 1}, {0xff6c, 3638, 1},
+ {0xff6d, 3639, 1}, {0xff6e, 3640, 1}, {0xff6f, 3641, 1},
+ {0xff70, 3642, 1}, {0xff71, 3643, 1}, {0xff72, 3644, 1},
+ {0xff73, 3645, 1}, {0xff74, 3646, 1}, {0xff75, 3647, 1},
+ {0xff76, 3648, 1}, {0xff77, 3649, 1}, {0xff78, 3650, 1},
+ {0xff79, 3651, 1}, {0xff7a, 3652, 1}, {0xff7b, 3653, 1},
+ {0xff7c, 3654, 1}, {0xff7d, 3655, 1}, {0xff7e, 3656, 1},
+ {0xff7f, 3657, 1}, {0xff80, 3658, 1}, {0xff81, 3659, 1},
+ {0xff82, 3660, 1}, {0xff83, 3661, 1}, {0xff84, 3662, 1},
+ {0xff85, 3663, 1}, {0xff86, 3664, 1}, {0xff87, 3665, 1},
+ {0xff88, 3666, 1}, {0xff89, 3667, 1}, {0xff8a, 3668, 1},
+ {0xff8b, 3669, 1}, {0xff8c, 3670, 1}, {0xff8d, 3671, 1},
+ {0xff8e, 3672, 1}, {0xff8f, 3673, 1}, {0xff90, 3674, 1},
+ {0xff91, 3675, 1}, {0xff92, 3676, 1}, {0xff93, 3677, 1},
+ {0xff94, 3678, 1}, {0xff95, 3679, 1}, {0xff96, 3680, 1},
+ {0xff97, 3681, 1}, {0xff98, 3682, 1}, {0xff99, 3683, 1},
+ {0xff9a, 3684, 1}, {0xff9b, 3685, 1}, {0xff9c, 3686, 1},
+ {0xff9d, 3687, 1}, {0xff9e, 3688, 1}, {0xff9f, 3689, 1},
+ {0xffa0, 3690, 1}, {0xffa1, 3691, 1}, {0xffa2, 3692, 1},
+ {0xffa3, 3693, 1}, {0xffa4, 3694, 1}, {0xffa5, 3695, 1},
+ {0xffa6, 3696, 1}, {0xffa7, 3697, 1}, {0xffa8, 3698, 1},
+ {0xffa9, 3699, 1}, {0xffaa, 3700, 1}, {0xffab, 3701, 1},
+ {0xffac, 3702, 1}, {0xffad, 3703, 1}, {0xffae, 3704, 1},
+ {0xffaf, 3705, 1}, {0xffb0, 3706, 1}, {0xffb1, 3707, 1},
+ {0xffb2, 3708, 1}, {0xffb3, 3709, 1}, {0xffb4, 3710, 1},
+ {0xffb5, 3711, 1}, {0xffb6, 3712, 1}, {0xffb7, 3713, 1},
+ {0xffb8, 3714, 1}, {0xffb9, 3715, 1}, {0xffba, 3716, 1},
+ {0xffbb, 3717, 1}, {0xffbc, 3718, 1}, {0xffbd, 3719, 1},
+ {0xffbe, 3720, 1}, {0xffc2, 3721, 1}, {0xffc3, 3722, 1},
+ {0xffc4, 3723, 1}, {0xffc5, 3724, 1}, {0xffc6, 3725, 1},
+ {0xffc7, 3726, 1}, {0xffca, 3727, 1}, {0xffcb, 3728, 1},
+ {0xffcc, 3729, 1}, {0xffcd, 3730, 1}, {0xffce, 3731, 1},
+ {0xffcf, 3732, 1}, {0xffd2, 3733, 1}, {0xffd3, 3734, 1},
+ {0xffd4, 3735, 1}, {0xffd5, 3736, 1}, {0xffd6, 3737, 1},
+ {0xffd7, 3738, 1}, {0xffda, 3739, 1}, {0xffdb, 3740, 1},
+ {0xffdc, 3741, 1}, {0xffe0, 3742, 1}, {0xffe1, 3743, 1},
+ {0xffe2, 3744, 1}, {0xffe3, 3745, 1}, {0xffe4, 3746, 1},
+ {0xffe5, 3747, 1}, {0xffe6, 3748, 1}, {0xffe8, 3749, 1},
+ {0xffe9, 3750, 1}, {0xffea, 3751, 1}, {0xffeb, 3752, 1},
+ {0xffec, 3753, 1}, {0xffed, 3754, 1}, {0xffee, 3755, 1},
+};
+
+static unicode_t compat_decompose_data[] = {
+ 32, 32, 776, 97, 32, 772, 50, 51, 32, 769,
+ 956, 32, 807, 49, 111, 49, 8260, 52, 49, 8260,
+ 50, 51, 8260, 52, 73, 74, 105, 106, 76, 183,
+ 108, 183, 700, 110, 115, 68, 381, 68, 382, 100,
+ 382, 76, 74, 76, 106, 108, 106, 78, 74, 78,
+ 106, 110, 106, 68, 90, 68, 122, 100, 122, 104,
+ 614, 106, 114, 633, 635, 641, 119, 121, 32, 774,
+ 32, 775, 32, 778, 32, 808, 32, 771, 32, 779,
+ 611, 108, 115, 120, 661, 32, 837, 32, 769, 946,
+ 952, 933, 966, 960, 954, 961, 962, 1381, 1410, 1575,
+ 1652, 1608, 1652, 1735, 1652, 1610, 1652, 3661, 3634, 3789,
+ 3762, 3755, 3737, 3755, 3745, 3851, 4018, 3969, 4019, 3969,
+ 97, 702, 32, 787, 32, 787, 32, 834, 32, 788,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 8208,
+ 32, 819, 46, 46, 46, 46, 46, 46, 32, 8242,
+ 8242, 8242, 8242, 8242, 8245, 8245, 8245, 8245, 8245, 33,
+ 33, 32, 773, 63, 33, 33, 63, 48, 52, 53,
+ 54, 55, 56, 57, 43, 8722, 61, 40, 41, 110,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+ 43, 8722, 61, 40, 41, 82, 115, 97, 47, 99,
+ 97, 47, 115, 67, 176, 67, 99, 47, 111, 99,
+ 47, 117, 400, 176, 70, 103, 72, 72, 72, 104,
+ 295, 73, 73, 76, 108, 78, 78, 111, 80, 81,
+ 82, 82, 82, 83, 77, 84, 69, 76, 84, 77,
+ 90, 90, 66, 67, 101, 69, 70, 77, 111, 1488,
+ 1489, 1490, 1491, 105, 49, 8260, 51, 50, 8260, 51,
+ 49, 8260, 53, 50, 8260, 53, 51, 8260, 53, 52,
+ 8260, 53, 49, 8260, 54, 53, 8260, 54, 49, 8260,
+ 56, 51, 8260, 56, 53, 8260, 56, 55, 8260, 56,
+ 49, 8260, 73, 73, 73, 73, 73, 73, 73, 86,
+ 86, 86, 73, 86, 73, 73, 86, 73, 73, 73,
+ 73, 88, 88, 88, 73, 88, 73, 73, 76, 67,
+ 68, 77, 105, 105, 105, 105, 105, 105, 105, 118,
+ 118, 118, 105, 118, 105, 105, 118, 105, 105, 105,
+ 105, 120, 120, 120, 105, 120, 105, 105, 108, 99,
+ 100, 109, 8747, 8747, 8747, 8747, 8747, 8750, 8750, 8750,
+ 8750, 8750, 49, 50, 51, 52, 53, 54, 55, 56,
+ 57, 49, 48, 49, 49, 49, 50, 49, 51, 49,
+ 52, 49, 53, 49, 54, 49, 55, 49, 56, 49,
+ 57, 50, 48, 40, 49, 41, 40, 50, 41, 40,
+ 51, 41, 40, 52, 41, 40, 53, 41, 40, 54,
+ 41, 40, 55, 41, 40, 56, 41, 40, 57, 41,
+ 40, 49, 48, 41, 40, 49, 49, 41, 40, 49,
+ 50, 41, 40, 49, 51, 41, 40, 49, 52, 41,
+ 40, 49, 53, 41, 40, 49, 54, 41, 40, 49,
+ 55, 41, 40, 49, 56, 41, 40, 49, 57, 41,
+ 40, 50, 48, 41, 49, 46, 50, 46, 51, 46,
+ 52, 46, 53, 46, 54, 46, 55, 46, 56, 46,
+ 57, 46, 49, 48, 46, 49, 49, 46, 49, 50,
+ 46, 49, 51, 46, 49, 52, 46, 49, 53, 46,
+ 49, 54, 46, 49, 55, 46, 49, 56, 46, 49,
+ 57, 46, 50, 48, 46, 40, 97, 41, 40, 98,
+ 41, 40, 99, 41, 40, 100, 41, 40, 101, 41,
+ 40, 102, 41, 40, 103, 41, 40, 104, 41, 40,
+ 105, 41, 40, 106, 41, 40, 107, 41, 40, 108,
+ 41, 40, 109, 41, 40, 110, 41, 40, 111, 41,
+ 40, 112, 41, 40, 113, 41, 40, 114, 41, 40,
+ 115, 41, 40, 116, 41, 40, 117, 41, 40, 118,
+ 41, 40, 119, 41, 40, 120, 41, 40, 121, 41,
+ 40, 122, 41, 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, 97,
+ 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
+ 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
+ 118, 119, 120, 121, 122, 48, 27597, 40863, 19968, 20008,
+ 20022, 20031, 20057, 20101, 20108, 20128, 20154, 20799, 20837, 20843,
+ 20866, 20886, 20907, 20960, 20981, 20992, 21147, 21241, 21269, 21274,
+ 21304, 21313, 21340, 21353, 21378, 21430, 21448, 21475, 22231, 22303,
+ 22763, 22786, 22794, 22805, 22823, 22899, 23376, 23424, 23544, 23567,
+ 23586, 23608, 23662, 23665, 24027, 24037, 24049, 24062, 24178, 24186,
+ 24191, 24308, 24318, 24331, 24339, 24400, 24417, 24435, 24515, 25096,
+ 25142, 25163, 25903, 25908, 25991, 26007, 26020, 26041, 26080, 26085,
+ 26352, 26376, 26408, 27424, 27490, 27513, 27571, 27595, 27604, 27611,
+ 27663, 27668, 27700, 28779, 29226, 29238, 29243, 29247, 29255, 29273,
+ 29275, 29356, 29572, 29577, 29916, 29926, 29976, 29983, 29992, 30000,
+ 30091, 30098, 30326, 30333, 30382, 30399, 30446, 30683, 30690, 30707,
+ 31034, 31160, 31166, 31348, 31435, 31481, 31859, 31992, 32566, 32593,
+ 32650, 32701, 32769, 32780, 32786, 32819, 32895, 32905, 33251, 33258,
+ 33267, 33276, 33292, 33307, 33311, 33390, 33394, 33400, 34381, 34411,
+ 34880, 34892, 34915, 35198, 35211, 35282, 35328, 35895, 35910, 35925,
+ 35960, 35997, 36196, 36208, 36275, 36523, 36554, 36763, 36784, 36789,
+ 37009, 37193, 37318, 37324, 37329, 38263, 38272, 38428, 38582, 38585,
+ 38632, 38737, 38750, 38754, 38761, 38859, 38893, 38899, 38913, 39080,
+ 39131, 39135, 39318, 39321, 39340, 39592, 39640, 39647, 39717, 39727,
+ 39730, 39740, 39770, 40165, 40565, 40575, 40613, 40635, 40643, 40653,
+ 40657, 40697, 40701, 40718, 40723, 40736, 40763, 40778, 40786, 40845,
+ 40860, 40864, 32, 12306, 21313, 21316, 21317, 32, 12441, 32,
+ 12442, 4352, 4353, 4522, 4354, 4524, 4525, 4355, 4356, 4357,
+ 4528, 4529, 4530, 4531, 4532, 4533, 4378, 4358, 4359, 4360,
+ 4385, 4361, 4362, 4363, 4364, 4365, 4366, 4367, 4368, 4369,
+ 4370, 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457,
+ 4458, 4459, 4460, 4461, 4462, 4463, 4464, 4465, 4466, 4467,
+ 4468, 4469, 4448, 4372, 4373, 4551, 4552, 4556, 4558, 4563,
+ 4567, 4569, 4380, 4573, 4575, 4381, 4382, 4384, 4386, 4387,
+ 4391, 4393, 4395, 4396, 4397, 4398, 4399, 4402, 4406, 4416,
+ 4423, 4428, 4593, 4594, 4439, 4440, 4441, 4484, 4485, 4488,
+ 4497, 4498, 4500, 4510, 4513, 19968, 20108, 19977, 22235, 19978,
+ 20013, 19979, 30002, 20057, 19993, 19969, 22825, 22320, 20154, 40,
+ 4352, 41, 40, 4354, 41, 40, 4355, 41, 40, 4357,
+ 41, 40, 4358, 41, 40, 4359, 41, 40, 4361, 41,
+ 40, 4363, 41, 40, 4364, 41, 40, 4366, 41, 40,
+ 4367, 41, 40, 4368, 41, 40, 4369, 41, 40, 4370,
+ 41, 40, 4352, 4449, 41, 40, 4354, 4449, 41, 40,
+ 4355, 4449, 41, 40, 4357, 4449, 41, 40, 4358, 4449,
+ 41, 40, 4359, 4449, 41, 40, 4361, 4449, 41, 40,
+ 4363, 4449, 41, 40, 4364, 4449, 41, 40, 4366, 4449,
+ 41, 40, 4367, 4449, 41, 40, 4368, 4449, 41, 40,
+ 4369, 4449, 41, 40, 4370, 4449, 41, 40, 4364, 4462,
+ 41, 40, 19968, 41, 40, 20108, 41, 40, 19977, 41,
+ 40, 22235, 41, 40, 20116, 41, 40, 20845, 41, 40,
+ 19971, 41, 40, 20843, 41, 40, 20061, 41, 40, 21313,
+ 41, 40, 26376, 41, 40, 28779, 41, 40, 27700, 41,
+ 40, 26408, 41, 40, 37329, 41, 40, 22303, 41, 40,
+ 26085, 41, 40, 26666, 41, 40, 26377, 41, 40, 31038,
+ 41, 40, 21517, 41, 40, 29305, 41, 40, 36001, 41,
+ 40, 31069, 41, 40, 21172, 41, 40, 20195, 41, 40,
+ 21628, 41, 40, 23398, 41, 40, 30435, 41, 40, 20225,
+ 41, 40, 36039, 41, 40, 21332, 41, 40, 31085, 41,
+ 40, 20241, 41, 40, 33258, 41, 40, 33267, 41, 4352,
+ 4354, 4355, 4357, 4358, 4359, 4361, 4363, 4364, 4366, 4367,
+ 4368, 4369, 4370, 4352, 4449, 4354, 4449, 4355, 4449, 4357,
+ 4449, 4358, 4449, 4359, 4449, 4361, 4449, 4363, 4449, 4364,
+ 4449, 4366, 4449, 4367, 4449, 4368, 4449, 4369, 4449, 4370,
+ 4449, 19968, 20108, 19977, 22235, 20116, 20845, 19971, 20843, 20061,
+ 21313, 26376, 28779, 27700, 26408, 37329, 22303, 26085, 26666, 26377,
+ 31038, 21517, 29305, 36001, 31069, 21172, 31192, 30007, 22899, 36969,
+ 20778, 21360, 27880, 38917, 20241, 20889, 27491, 19978, 20013, 19979,
+ 24038, 21491, 21307, 23447, 23398, 30435, 20225, 36039, 21332, 22812,
+ 49, 26376, 50, 26376, 51, 26376, 52, 26376, 53, 26376,
+ 54, 26376, 55, 26376, 56, 26376, 57, 26376, 49, 48,
+ 26376, 49, 49, 26376, 49, 50, 26376, 12450, 12452, 12454,
+ 12456, 12458, 12459, 12461, 12463, 12465, 12467, 12469, 12471, 12473,
+ 12475, 12477, 12479, 12481, 12484, 12486, 12488, 12490, 12491, 12492,
+ 12493, 12494, 12495, 12498, 12501, 12504, 12507, 12510, 12511, 12512,
+ 12513, 12514, 12516, 12518, 12520, 12521, 12522, 12523, 12524, 12525,
+ 12527, 12528, 12529, 12530, 12450, 12497, 12540, 12488, 12450, 12523,
+ 12501, 12449, 12450, 12531, 12506, 12450, 12450, 12540, 12523, 12452,
+ 12491, 12531, 12464, 12452, 12531, 12481, 12454, 12457, 12531, 12456,
+ 12473, 12463, 12540, 12489, 12456, 12540, 12459, 12540, 12458, 12531,
+ 12473, 12458, 12540, 12512, 12459, 12452, 12522, 12459, 12521, 12483,
+ 12488, 12459, 12525, 12522, 12540, 12460, 12525, 12531, 12460, 12531,
+ 12510, 12462, 12460, 12462, 12491, 12540, 12461, 12517, 12522, 12540,
+ 12462, 12523, 12480, 12540, 12461, 12525, 12461, 12525, 12464, 12521,
+ 12512, 12461, 12525, 12513, 12540, 12488, 12523, 12461, 12525, 12527,
+ 12483, 12488, 12464, 12521, 12512, 12464, 12521, 12512, 12488, 12531,
+ 12463, 12523, 12476, 12452, 12525, 12463, 12525, 12540, 12493, 12465,
+ 12540, 12473, 12467, 12523, 12490, 12467, 12540, 12509, 12469, 12452,
+ 12463, 12523, 12469, 12531, 12481, 12540, 12512, 12471, 12522, 12531,
+ 12464, 12475, 12531, 12481, 12475, 12531, 12488, 12480, 12540, 12473,
+ 12487, 12471, 12489, 12523, 12488, 12531, 12490, 12494, 12494, 12483,
+ 12488, 12495, 12452, 12484, 12497, 12540, 12475, 12531, 12488, 12497,
+ 12540, 12484, 12496, 12540, 12524, 12523, 12500, 12450, 12473, 12488,
+ 12523, 12500, 12463, 12523, 12500, 12467, 12499, 12523, 12501, 12449,
+ 12521, 12483, 12489, 12501, 12451, 12540, 12488, 12502, 12483, 12471,
+ 12455, 12523, 12501, 12521, 12531, 12504, 12463, 12479, 12540, 12523,
+ 12506, 12477, 12506, 12491, 12498, 12504, 12523, 12484, 12506, 12531,
+ 12473, 12506, 12540, 12472, 12505, 12540, 12479, 12509, 12452, 12531,
+ 12488, 12508, 12523, 12488, 12507, 12531, 12509, 12531, 12489, 12507,
+ 12540, 12523, 12507, 12540, 12531, 12510, 12452, 12463, 12525, 12510,
+ 12452, 12523, 12510, 12483, 12495, 12510, 12523, 12463, 12510, 12531,
+ 12471, 12519, 12531, 12511, 12463, 12525, 12531, 12511, 12522, 12511,
+ 12522, 12496, 12540, 12523, 12513, 12460, 12513, 12460, 12488, 12531,
+ 12513, 12540, 12488, 12523, 12516, 12540, 12489, 12516, 12540, 12523,
+ 12518, 12450, 12531, 12522, 12483, 12488, 12523, 12522, 12521, 12523,
+ 12500, 12540, 12523, 12540, 12502, 12523, 12524, 12512, 12524, 12531,
+ 12488, 12466, 12531, 12527, 12483, 12488, 48, 28857, 49, 28857,
+ 50, 28857, 51, 28857, 52, 28857, 53, 28857, 54, 28857,
+ 55, 28857, 56, 28857, 57, 28857, 49, 48, 28857, 49,
+ 49, 28857, 49, 50, 28857, 49, 51, 28857, 49, 52,
+ 28857, 49, 53, 28857, 49, 54, 28857, 49, 55, 28857,
+ 49, 56, 28857, 49, 57, 28857, 50, 48, 28857, 50,
+ 49, 28857, 50, 50, 28857, 50, 51, 28857, 50, 52,
+ 28857, 104, 80, 97, 100, 97, 65, 85, 98, 97,
+ 114, 111, 86, 112, 99, 24179, 25104, 26157, 21644, 22823,
+ 27491, 26126, 27835, 26666, 24335, 20250, 31038, 112, 65, 110,
+ 65, 956, 65, 109, 65, 107, 65, 75, 66, 77,
+ 66, 71, 66, 99, 97, 108, 107, 99, 97, 108,
+ 112, 70, 110, 70, 956, 70, 956, 103, 109, 103,
+ 107, 103, 72, 122, 107, 72, 122, 77, 72, 122,
+ 71, 72, 122, 84, 72, 122, 956, 8467, 109, 8467,
+ 100, 8467, 107, 8467, 102, 109, 110, 109, 956, 109,
+ 109, 109, 99, 109, 107, 109, 109, 109, 178, 99,
+ 109, 178, 109, 178, 107, 109, 178, 109, 109, 179,
+ 99, 109, 179, 109, 179, 107, 109, 179, 109, 8725,
+ 115, 109, 8725, 115, 178, 80, 97, 107, 80, 97,
+ 77, 80, 97, 71, 80, 97, 114, 97, 100, 114,
+ 97, 100, 8725, 115, 114, 97, 100, 8725, 115, 178,
+ 112, 115, 110, 115, 956, 115, 109, 115, 112, 86,
+ 110, 86, 956, 86, 109, 86, 107, 86, 77, 86,
+ 112, 87, 110, 87, 956, 87, 109, 87, 107, 87,
+ 77, 87, 107, 937, 77, 937, 97, 46, 109, 46,
+ 66, 113, 99, 99, 99, 100, 67, 8725, 107, 103,
+ 67, 111, 46, 100, 66, 71, 121, 104, 97, 72,
+ 80, 105, 110, 75, 75, 75, 77, 107, 116, 108,
+ 109, 108, 110, 108, 111, 103, 108, 120, 109, 98,
+ 109, 105, 108, 109, 111, 108, 80, 72, 112, 46,
+ 109, 46, 80, 80, 77, 80, 82, 115, 114, 83,
+ 118, 87, 98, 49, 26085, 50, 26085, 51, 26085, 52,
+ 26085, 53, 26085, 54, 26085, 55, 26085, 56, 26085, 57,
+ 26085, 49, 48, 26085, 49, 49, 26085, 49, 50, 26085,
+ 49, 51, 26085, 49, 52, 26085, 49, 53, 26085, 49,
+ 54, 26085, 49, 55, 26085, 49, 56, 26085, 49, 57,
+ 26085, 50, 48, 26085, 50, 49, 26085, 50, 50, 26085,
+ 50, 51, 26085, 50, 52, 26085, 50, 53, 26085, 50,
+ 54, 26085, 50, 55, 26085, 50, 56, 26085, 50, 57,
+ 26085, 51, 48, 26085, 51, 49, 26085, 102, 102, 102,
+ 105, 102, 108, 102, 102, 105, 102, 102, 108, 383,
+ 116, 115, 116, 1396, 1398, 1396, 1381, 1396, 1387, 1406,
+ 1398, 1396, 1389, 1506, 1488, 1491, 1492, 1499, 1500, 1501,
+ 1512, 1514, 43, 1488, 1500, 1649, 1649, 1659, 1659, 1659,
+ 1659, 1662, 1662, 1662, 1662, 1664, 1664, 1664, 1664, 1658,
+ 1658, 1658, 1658, 1663, 1663, 1663, 1663, 1657, 1657, 1657,
+ 1657, 1700, 1700, 1700, 1700, 1702, 1702, 1702, 1702, 1668,
+ 1668, 1668, 1668, 1667, 1667, 1667, 1667, 1670, 1670, 1670,
+ 1670, 1671, 1671, 1671, 1671, 1677, 1677, 1676, 1676, 1678,
+ 1678, 1672, 1672, 1688, 1688, 1681, 1681, 1705, 1705, 1705,
+ 1705, 1711, 1711, 1711, 1711, 1715, 1715, 1715, 1715, 1713,
+ 1713, 1713, 1713, 1722, 1722, 1723, 1723, 1723, 1723, 1728,
+ 1728, 1729, 1729, 1729, 1729, 1726, 1726, 1726, 1726, 1746,
+ 1746, 1747, 1747, 1709, 1709, 1709, 1709, 1735, 1735, 1734,
+ 1734, 1736, 1736, 1655, 1739, 1739, 1733, 1733, 1737, 1737,
+ 1744, 1744, 1744, 1744, 1609, 1609, 1574, 1575, 1574, 1575,
+ 1574, 1749, 1574, 1749, 1574, 1608, 1574, 1608, 1574, 1735,
+ 1574, 1735, 1574, 1734, 1574, 1734, 1574, 1736, 1574, 1736,
+ 1574, 1744, 1574, 1744, 1574, 1744, 1574, 1609, 1574, 1609,
+ 1574, 1609, 1740, 1740, 1740, 1740, 1574, 1580, 1574, 1581,
+ 1574, 1605, 1574, 1609, 1574, 1610, 1576, 1580, 1576, 1581,
+ 1576, 1582, 1576, 1605, 1576, 1609, 1576, 1610, 1578, 1580,
+ 1578, 1581, 1578, 1582, 1578, 1605, 1578, 1609, 1578, 1610,
+ 1579, 1580, 1579, 1605, 1579, 1609, 1579, 1610, 1580, 1581,
+ 1580, 1605, 1581, 1580, 1581, 1605, 1582, 1580, 1582, 1581,
+ 1582, 1605, 1587, 1580, 1587, 1581, 1587, 1582, 1587, 1605,
+ 1589, 1581, 1589, 1605, 1590, 1580, 1590, 1581, 1590, 1582,
+ 1590, 1605, 1591, 1581, 1591, 1605, 1592, 1605, 1593, 1580,
+ 1593, 1605, 1594, 1580, 1594, 1605, 1601, 1580, 1601, 1581,
+ 1601, 1582, 1601, 1605, 1601, 1609, 1601, 1610, 1602, 1581,
+ 1602, 1605, 1602, 1609, 1602, 1610, 1603, 1575, 1603, 1580,
+ 1603, 1581, 1603, 1582, 1603, 1604, 1603, 1605, 1603, 1609,
+ 1603, 1610, 1604, 1580, 1604, 1581, 1604, 1582, 1604, 1605,
+ 1604, 1609, 1604, 1610, 1605, 1580, 1605, 1581, 1605, 1582,
+ 1605, 1605, 1605, 1609, 1605, 1610, 1606, 1580, 1606, 1581,
+ 1606, 1582, 1606, 1605, 1606, 1609, 1606, 1610, 1607, 1580,
+ 1607, 1605, 1607, 1609, 1607, 1610, 1610, 1580, 1610, 1581,
+ 1610, 1582, 1610, 1605, 1610, 1609, 1610, 1610, 1584, 1648,
+ 1585, 1648, 1609, 1648, 32, 1612, 1617, 32, 1613, 1617,
+ 32, 1614, 1617, 32, 1615, 1617, 32, 1616, 1617, 32,
+ 1617, 1648, 1574, 1585, 1574, 1586, 1574, 1605, 1574, 1606,
+ 1574, 1609, 1574, 1610, 1576, 1585, 1576, 1586, 1576, 1605,
+ 1576, 1606, 1576, 1609, 1576, 1610, 1578, 1585, 1578, 1586,
+ 1578, 1605, 1578, 1606, 1578, 1609, 1578, 1610, 1579, 1585,
+ 1579, 1586, 1579, 1605, 1579, 1606, 1579, 1609, 1579, 1610,
+ 1601, 1609, 1601, 1610, 1602, 1609, 1602, 1610, 1603, 1575,
+ 1603, 1604, 1603, 1605, 1603, 1609, 1603, 1610, 1604, 1605,
+ 1604, 1609, 1604, 1610, 1605, 1575, 1605, 1605, 1606, 1585,
+ 1606, 1586, 1606, 1605, 1606, 1606, 1606, 1609, 1606, 1610,
+ 1609, 1648, 1610, 1585, 1610, 1586, 1610, 1605, 1610, 1606,
+ 1610, 1609, 1610, 1610, 1574, 1580, 1574, 1581, 1574, 1582,
+ 1574, 1605, 1574, 1607, 1576, 1580, 1576, 1581, 1576, 1582,
+ 1576, 1605, 1576, 1607, 1578, 1580, 1578, 1581, 1578, 1582,
+ 1578, 1605, 1578, 1607, 1579, 1605, 1580, 1581, 1580, 1605,
+ 1581, 1580, 1581, 1605, 1582, 1580, 1582, 1605, 1587, 1580,
+ 1587, 1581, 1587, 1582, 1587, 1605, 1589, 1581, 1589, 1582,
+ 1589, 1605, 1590, 1580, 1590, 1581, 1590, 1582, 1590, 1605,
+ 1591, 1581, 1592, 1605, 1593, 1580, 1593, 1605, 1594, 1580,
+ 1594, 1605, 1601, 1580, 1601, 1581, 1601, 1582, 1601, 1605,
+ 1602, 1581, 1602, 1605, 1603, 1580, 1603, 1581, 1603, 1582,
+ 1603, 1604, 1603, 1605, 1604, 1580, 1604, 1581, 1604, 1582,
+ 1604, 1605, 1604, 1607, 1605, 1580, 1605, 1581, 1605, 1582,
+ 1605, 1605, 1606, 1580, 1606, 1581, 1606, 1582, 1606, 1605,
+ 1606, 1607, 1607, 1580, 1607, 1605, 1607, 1648, 1610, 1580,
+ 1610, 1581, 1610, 1582, 1610, 1605, 1610, 1607, 1574, 1605,
+ 1574, 1607, 1576, 1605, 1576, 1607, 1578, 1605, 1578, 1607,
+ 1579, 1605, 1579, 1607, 1587, 1605, 1587, 1607, 1588, 1605,
+ 1588, 1607, 1603, 1604, 1603, 1605, 1604, 1605, 1606, 1605,
+ 1606, 1607, 1610, 1605, 1610, 1607, 1600, 1614, 1617, 1600,
+ 1615, 1617, 1600, 1616, 1617, 1591, 1609, 1591, 1610, 1593,
+ 1609, 1593, 1610, 1594, 1609, 1594, 1610, 1587, 1609, 1587,
+ 1610, 1588, 1609, 1588, 1610, 1581, 1609, 1581, 1610, 1580,
+ 1609, 1580, 1610, 1582, 1609, 1582, 1610, 1589, 1609, 1589,
+ 1610, 1590, 1609, 1590, 1610, 1588, 1580, 1588, 1581, 1588,
+ 1582, 1588, 1605, 1588, 1585, 1587, 1585, 1589, 1585, 1590,
+ 1585, 1591, 1609, 1591, 1610, 1593, 1609, 1593, 1610, 1594,
+ 1609, 1594, 1610, 1587, 1609, 1587, 1610, 1588, 1609, 1588,
+ 1610, 1581, 1609, 1581, 1610, 1580, 1609, 1580, 1610, 1582,
+ 1609, 1582, 1610, 1589, 1609, 1589, 1610, 1590, 1609, 1590,
+ 1610, 1588, 1580, 1588, 1581, 1588, 1582, 1588, 1605, 1588,
+ 1585, 1587, 1585, 1589, 1585, 1590, 1585, 1588, 1580, 1588,
+ 1581, 1588, 1582, 1588, 1605, 1587, 1607, 1588, 1607, 1591,
+ 1605, 1587, 1580, 1587, 1581, 1587, 1582, 1588, 1580, 1588,
+ 1581, 1588, 1582, 1591, 1605, 1592, 1605, 1575, 1611, 1575,
+ 1611, 1578, 1580, 1605, 1578, 1581, 1580, 1578, 1581, 1580,
+ 1578, 1581, 1605, 1578, 1582, 1605, 1578, 1605, 1580, 1578,
+ 1605, 1581, 1578, 1605, 1582, 1580, 1605, 1581, 1580, 1605,
+ 1581, 1581, 1605, 1610, 1581, 1605, 1609, 1587, 1581, 1580,
+ 1587, 1580, 1581, 1587, 1580, 1609, 1587, 1605, 1581, 1587,
+ 1605, 1581, 1587, 1605, 1580, 1587, 1605, 1605, 1587, 1605,
+ 1605, 1589, 1581, 1581, 1589, 1581, 1581, 1589, 1605, 1605,
+ 1588, 1581, 1605, 1588, 1581, 1605, 1588, 1580, 1610, 1588,
+ 1605, 1582, 1588, 1605, 1582, 1588, 1605, 1605, 1588, 1605,
+ 1605, 1590, 1581, 1609, 1590, 1582, 1605, 1590, 1582, 1605,
+ 1591, 1605, 1581, 1591, 1605, 1581, 1591, 1605, 1605, 1591,
+ 1605, 1610, 1593, 1580, 1605, 1593, 1605, 1605, 1593, 1605,
+ 1605, 1593, 1605, 1609, 1594, 1605, 1605, 1594, 1605, 1610,
+ 1594, 1605, 1609, 1601, 1582, 1605, 1601, 1582, 1605, 1602,
+ 1605, 1581, 1602, 1605, 1605, 1604, 1581, 1605, 1604, 1581,
+ 1610, 1604, 1581, 1609, 1604, 1580, 1580, 1604, 1580, 1580,
+ 1604, 1582, 1605, 1604, 1582, 1605, 1604, 1605, 1581, 1604,
+ 1605, 1581, 1605, 1581, 1580, 1605, 1581, 1605, 1605, 1581,
+ 1610, 1605, 1580, 1581, 1605, 1580, 1605, 1605, 1582, 1580,
+ 1605, 1582, 1605, 1605, 1580, 1582, 1607, 1605, 1580, 1607,
+ 1605, 1605, 1606, 1581, 1605, 1606, 1581, 1609, 1606, 1580,
+ 1605, 1606, 1580, 1605, 1606, 1580, 1609, 1606, 1605, 1610,
+ 1606, 1605, 1609, 1610, 1605, 1605, 1610, 1605, 1605, 1576,
+ 1582, 1610, 1578, 1580, 1610, 1578, 1580, 1609, 1578, 1582,
+ 1610, 1578, 1582, 1609, 1578, 1605, 1610, 1578, 1605, 1609,
+ 1580, 1605, 1610, 1580, 1581, 1609, 1580, 1605, 1609, 1587,
+ 1582, 1609, 1589, 1581, 1610, 1588, 1581, 1610, 1590, 1581,
+ 1610, 1604, 1580, 1610, 1604, 1605, 1610, 1610, 1581, 1610,
+ 1610, 1580, 1610, 1610, 1605, 1610, 1605, 1605, 1610, 1602,
+ 1605, 1610, 1606, 1581, 1610, 1602, 1605, 1581, 1604, 1581,
+ 1605, 1593, 1605, 1610, 1603, 1605, 1610, 1606, 1580, 1581,
+ 1605, 1582, 1610, 1604, 1580, 1605, 1603, 1605, 1605, 1604,
+ 1580, 1605, 1606, 1580, 1581, 1580, 1581, 1610, 1581, 1580,
+ 1610, 1605, 1580, 1610, 1601, 1605, 1610, 1576, 1581, 1610,
+ 1603, 1605, 1605, 1593, 1580, 1605, 1589, 1605, 1605, 1587,
+ 1582, 1610, 1606, 1580, 1610, 1589, 1604, 1746, 1602, 1604,
+ 1746, 1575, 1604, 1604, 1607, 1575, 1603, 1576, 1585, 1605,
+ 1581, 1605, 1583, 1589, 1604, 1593, 1605, 1585, 1587, 1608,
+ 1604, 1593, 1604, 1610, 1607, 1608, 1587, 1604, 1605, 1589,
+ 1604, 1609, 1589, 1604, 1609, 32, 1575, 1604, 1604, 1607,
+ 32, 1593, 1604, 1610, 1607, 32, 1608, 1587, 1604, 1605,
+ 1580, 1604, 32, 1580, 1604, 1575, 1604, 1607, 8229, 8212,
+ 8211, 95, 95, 40, 41, 123, 125, 12308, 12309, 12304,
+ 12305, 12298, 12299, 12296, 12297, 12300, 12301, 12302, 12303, 8254,
+ 8254, 8254, 8254, 95, 95, 95, 44, 12289, 46, 59,
+ 58, 63, 33, 8212, 40, 41, 123, 125, 12308, 12309,
+ 35, 38, 42, 43, 45, 60, 62, 61, 92, 36,
+ 37, 64, 32, 1611, 1600, 1611, 32, 1612, 32, 1613,
+ 32, 1614, 1600, 1614, 32, 1615, 1600, 1615, 32, 1616,
+ 1600, 1616, 32, 1617, 1600, 1617, 32, 1618, 1600, 1618,
+ 1569, 1570, 1570, 1571, 1571, 1572, 1572, 1573, 1573, 1574,
+ 1574, 1574, 1574, 1575, 1575, 1576, 1576, 1576, 1576, 1577,
+ 1577, 1578, 1578, 1578, 1578, 1579, 1579, 1579, 1579, 1580,
+ 1580, 1580, 1580, 1581, 1581, 1581, 1581, 1582, 1582, 1582,
+ 1582, 1583, 1583, 1584, 1584, 1585, 1585, 1586, 1586, 1587,
+ 1587, 1587, 1587, 1588, 1588, 1588, 1588, 1589, 1589, 1589,
+ 1589, 1590, 1590, 1590, 1590, 1591, 1591, 1591, 1591, 1592,
+ 1592, 1592, 1592, 1593, 1593, 1593, 1593, 1594, 1594, 1594,
+ 1594, 1601, 1601, 1601, 1601, 1602, 1602, 1602, 1602, 1603,
+ 1603, 1603, 1603, 1604, 1604, 1604, 1604, 1605, 1605, 1605,
+ 1605, 1606, 1606, 1606, 1606, 1607, 1607, 1607, 1607, 1608,
+ 1608, 1609, 1609, 1610, 1610, 1610, 1610, 1604, 1570, 1604,
+ 1570, 1604, 1571, 1604, 1571, 1604, 1573, 1604, 1573, 1604,
+ 1575, 1604, 1575, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 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, 88, 89,
+ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
+ 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 126, 12290, 12300, 12301,
+ 12289, 12539, 12530, 12449, 12451, 12453, 12455, 12457, 12515, 12517,
+ 12519, 12483, 12540, 12450, 12452, 12454, 12456, 12458, 12459, 12461,
+ 12463, 12465, 12467, 12469, 12471, 12473, 12475, 12477, 12479, 12481,
+ 12484, 12486, 12488, 12490, 12491, 12492, 12493, 12494, 12495, 12498,
+ 12501, 12504, 12507, 12510, 12511, 12512, 12513, 12514, 12516, 12518,
+ 12520, 12521, 12522, 12523, 12524, 12525, 12527, 12531, 12441, 12442,
+ 12644, 12593, 12594, 12595, 12596, 12597, 12598, 12599, 12600, 12601,
+ 12602, 12603, 12604, 12605, 12606, 12607, 12608, 12609, 12610, 12611,
+ 12612, 12613, 12614, 12615, 12616, 12617, 12618, 12619, 12620, 12621,
+ 12622, 12623, 12624, 12625, 12626, 12627, 12628, 12629, 12630, 12631,
+ 12632, 12633, 12634, 12635, 12636, 12637, 12638, 12639, 12640, 12641,
+ 12642, 12643, 162, 163, 172, 175, 166, 165, 8361, 9474,
+ 8592, 8593, 8594, 8595, 9632, 9675,
+};
+
+
+/*
+ * Flags for special case mapping.
+ */
+#define CMF_MULTICHAR 0x1
+#define CMF_FINAL 0x2
+#define CMF_NONFINAL 0x4
+#define CMF_CTXDEP (CMF_FINAL|CMF_NONFINAL)
+
+/*
+ * Lowercase <-> Uppercase mapping
+ */
+
+#define CASEMAP_BM_SHIFT (16 - 11)
+
+static unsigned long toupper_bitmap[] = {
+ 0xf41fffe8, 0x000018fe, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0xffff0000,
+ 0x00000800, 0x000000c0, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x01000000, 0x04000000,
+};
+
+static struct casemap toupper_map[] = {
+ /* non-conditional one-to-one mapping */
+ {0x0061, 0x0041}, {0x0062, 0x0042}, {0x0063, 0x0043}, {0x0064, 0x0044},
+ {0x0065, 0x0045}, {0x0066, 0x0046}, {0x0067, 0x0047}, {0x0068, 0x0048},
+ {0x0069, 0x0049}, {0x006a, 0x004a}, {0x006b, 0x004b}, {0x006c, 0x004c},
+ {0x006d, 0x004d}, {0x006e, 0x004e}, {0x006f, 0x004f}, {0x0070, 0x0050},
+ {0x0071, 0x0051}, {0x0072, 0x0052}, {0x0073, 0x0053}, {0x0074, 0x0054},
+ {0x0075, 0x0055}, {0x0076, 0x0056}, {0x0077, 0x0057}, {0x0078, 0x0058},
+ {0x0079, 0x0059}, {0x007a, 0x005a}, {0x00b5, 0x039c}, {0x00e0, 0x00c0},
+ {0x00e1, 0x00c1}, {0x00e2, 0x00c2}, {0x00e3, 0x00c3}, {0x00e4, 0x00c4},
+ {0x00e5, 0x00c5}, {0x00e6, 0x00c6}, {0x00e7, 0x00c7}, {0x00e8, 0x00c8},
+ {0x00e9, 0x00c9}, {0x00ea, 0x00ca}, {0x00eb, 0x00cb}, {0x00ec, 0x00cc},
+ {0x00ed, 0x00cd}, {0x00ee, 0x00ce}, {0x00ef, 0x00cf}, {0x00f0, 0x00d0},
+ {0x00f1, 0x00d1}, {0x00f2, 0x00d2}, {0x00f3, 0x00d3}, {0x00f4, 0x00d4},
+ {0x00f5, 0x00d5}, {0x00f6, 0x00d6}, {0x00f8, 0x00d8}, {0x00f9, 0x00d9},
+ {0x00fa, 0x00da}, {0x00fb, 0x00db}, {0x00fc, 0x00dc}, {0x00fd, 0x00dd},
+ {0x00fe, 0x00de}, {0x00ff, 0x0178}, {0x0101, 0x0100}, {0x0103, 0x0102},
+ {0x0105, 0x0104}, {0x0107, 0x0106}, {0x0109, 0x0108}, {0x010b, 0x010a},
+ {0x010d, 0x010c}, {0x010f, 0x010e}, {0x0111, 0x0110}, {0x0113, 0x0112},
+ {0x0115, 0x0114}, {0x0117, 0x0116}, {0x0119, 0x0118}, {0x011b, 0x011a},
+ {0x011d, 0x011c}, {0x011f, 0x011e}, {0x0121, 0x0120}, {0x0123, 0x0122},
+ {0x0125, 0x0124}, {0x0127, 0x0126}, {0x0129, 0x0128}, {0x012b, 0x012a},
+ {0x012d, 0x012c}, {0x012f, 0x012e}, {0x0131, 0x0049}, {0x0133, 0x0132},
+ {0x0135, 0x0134}, {0x0137, 0x0136}, {0x013a, 0x0139}, {0x013c, 0x013b},
+ {0x013e, 0x013d}, {0x0140, 0x013f}, {0x0142, 0x0141}, {0x0144, 0x0143},
+ {0x0146, 0x0145}, {0x0148, 0x0147}, {0x014b, 0x014a}, {0x014d, 0x014c},
+ {0x014f, 0x014e}, {0x0151, 0x0150}, {0x0153, 0x0152}, {0x0155, 0x0154},
+ {0x0157, 0x0156}, {0x0159, 0x0158}, {0x015b, 0x015a}, {0x015d, 0x015c},
+ {0x015f, 0x015e}, {0x0161, 0x0160}, {0x0163, 0x0162}, {0x0165, 0x0164},
+ {0x0167, 0x0166}, {0x0169, 0x0168}, {0x016b, 0x016a}, {0x016d, 0x016c},
+ {0x016f, 0x016e}, {0x0171, 0x0170}, {0x0173, 0x0172}, {0x0175, 0x0174},
+ {0x0177, 0x0176}, {0x017a, 0x0179}, {0x017c, 0x017b}, {0x017e, 0x017d},
+ {0x017f, 0x0053}, {0x0183, 0x0182}, {0x0185, 0x0184}, {0x0188, 0x0187},
+ {0x018c, 0x018b}, {0x0192, 0x0191}, {0x0195, 0x01f6}, {0x0199, 0x0198},
+ {0x01a1, 0x01a0}, {0x01a3, 0x01a2}, {0x01a5, 0x01a4}, {0x01a8, 0x01a7},
+ {0x01ad, 0x01ac}, {0x01b0, 0x01af}, {0x01b4, 0x01b3}, {0x01b6, 0x01b5},
+ {0x01b9, 0x01b8}, {0x01bd, 0x01bc}, {0x01bf, 0x01f7}, {0x01c5, 0x01c4},
+ {0x01c6, 0x01c4}, {0x01c8, 0x01c7}, {0x01c9, 0x01c7}, {0x01cb, 0x01ca},
+ {0x01cc, 0x01ca}, {0x01ce, 0x01cd}, {0x01d0, 0x01cf}, {0x01d2, 0x01d1},
+ {0x01d4, 0x01d3}, {0x01d6, 0x01d5}, {0x01d8, 0x01d7}, {0x01da, 0x01d9},
+ {0x01dc, 0x01db}, {0x01dd, 0x018e}, {0x01df, 0x01de}, {0x01e1, 0x01e0},
+ {0x01e3, 0x01e2}, {0x01e5, 0x01e4}, {0x01e7, 0x01e6}, {0x01e9, 0x01e8},
+ {0x01eb, 0x01ea}, {0x01ed, 0x01ec}, {0x01ef, 0x01ee}, {0x01f2, 0x01f1},
+ {0x01f3, 0x01f1}, {0x01f5, 0x01f4}, {0x01f9, 0x01f8}, {0x01fb, 0x01fa},
+ {0x01fd, 0x01fc}, {0x01ff, 0x01fe}, {0x0201, 0x0200}, {0x0203, 0x0202},
+ {0x0205, 0x0204}, {0x0207, 0x0206}, {0x0209, 0x0208}, {0x020b, 0x020a},
+ {0x020d, 0x020c}, {0x020f, 0x020e}, {0x0211, 0x0210}, {0x0213, 0x0212},
+ {0x0215, 0x0214}, {0x0217, 0x0216}, {0x0219, 0x0218}, {0x021b, 0x021a},
+ {0x021d, 0x021c}, {0x021f, 0x021e}, {0x0223, 0x0222}, {0x0225, 0x0224},
+ {0x0227, 0x0226}, {0x0229, 0x0228}, {0x022b, 0x022a}, {0x022d, 0x022c},
+ {0x022f, 0x022e}, {0x0231, 0x0230}, {0x0233, 0x0232}, {0x0253, 0x0181},
+ {0x0254, 0x0186}, {0x0256, 0x0189}, {0x0257, 0x018a}, {0x0259, 0x018f},
+ {0x025b, 0x0190}, {0x0260, 0x0193}, {0x0263, 0x0194}, {0x0268, 0x0197},
+ {0x0269, 0x0196}, {0x026f, 0x019c}, {0x0272, 0x019d}, {0x0275, 0x019f},
+ {0x0280, 0x01a6}, {0x0283, 0x01a9}, {0x0288, 0x01ae}, {0x028a, 0x01b1},
+ {0x028b, 0x01b2}, {0x0292, 0x01b7}, {0x0345, 0x0399}, {0x03ac, 0x0386},
+ {0x03ad, 0x0388}, {0x03ae, 0x0389}, {0x03af, 0x038a}, {0x03b1, 0x0391},
+ {0x03b2, 0x0392}, {0x03b3, 0x0393}, {0x03b4, 0x0394}, {0x03b5, 0x0395},
+ {0x03b6, 0x0396}, {0x03b7, 0x0397}, {0x03b8, 0x0398}, {0x03b9, 0x0399},
+ {0x03ba, 0x039a}, {0x03bb, 0x039b}, {0x03bc, 0x039c}, {0x03bd, 0x039d},
+ {0x03be, 0x039e}, {0x03bf, 0x039f}, {0x03c0, 0x03a0}, {0x03c1, 0x03a1},
+ {0x03c2, 0x03a3}, {0x03c3, 0x03a3}, {0x03c4, 0x03a4}, {0x03c5, 0x03a5},
+ {0x03c6, 0x03a6}, {0x03c7, 0x03a7}, {0x03c8, 0x03a8}, {0x03c9, 0x03a9},
+ {0x03ca, 0x03aa}, {0x03cb, 0x03ab}, {0x03cc, 0x038c}, {0x03cd, 0x038e},
+ {0x03ce, 0x038f}, {0x03d0, 0x0392}, {0x03d1, 0x0398}, {0x03d5, 0x03a6},
+ {0x03d6, 0x03a0}, {0x03db, 0x03da}, {0x03dd, 0x03dc}, {0x03df, 0x03de},
+ {0x03e1, 0x03e0}, {0x03e3, 0x03e2}, {0x03e5, 0x03e4}, {0x03e7, 0x03e6},
+ {0x03e9, 0x03e8}, {0x03eb, 0x03ea}, {0x03ed, 0x03ec}, {0x03ef, 0x03ee},
+ {0x03f0, 0x039a}, {0x03f1, 0x03a1}, {0x03f2, 0x03a3}, {0x0430, 0x0410},
+ {0x0431, 0x0411}, {0x0432, 0x0412}, {0x0433, 0x0413}, {0x0434, 0x0414},
+ {0x0435, 0x0415}, {0x0436, 0x0416}, {0x0437, 0x0417}, {0x0438, 0x0418},
+ {0x0439, 0x0419}, {0x043a, 0x041a}, {0x043b, 0x041b}, {0x043c, 0x041c},
+ {0x043d, 0x041d}, {0x043e, 0x041e}, {0x043f, 0x041f}, {0x0440, 0x0420},
+ {0x0441, 0x0421}, {0x0442, 0x0422}, {0x0443, 0x0423}, {0x0444, 0x0424},
+ {0x0445, 0x0425}, {0x0446, 0x0426}, {0x0447, 0x0427}, {0x0448, 0x0428},
+ {0x0449, 0x0429}, {0x044a, 0x042a}, {0x044b, 0x042b}, {0x044c, 0x042c},
+ {0x044d, 0x042d}, {0x044e, 0x042e}, {0x044f, 0x042f}, {0x0450, 0x0400},
+ {0x0451, 0x0401}, {0x0452, 0x0402}, {0x0453, 0x0403}, {0x0454, 0x0404},
+ {0x0455, 0x0405}, {0x0456, 0x0406}, {0x0457, 0x0407}, {0x0458, 0x0408},
+ {0x0459, 0x0409}, {0x045a, 0x040a}, {0x045b, 0x040b}, {0x045c, 0x040c},
+ {0x045d, 0x040d}, {0x045e, 0x040e}, {0x045f, 0x040f}, {0x0461, 0x0460},
+ {0x0463, 0x0462}, {0x0465, 0x0464}, {0x0467, 0x0466}, {0x0469, 0x0468},
+ {0x046b, 0x046a}, {0x046d, 0x046c}, {0x046f, 0x046e}, {0x0471, 0x0470},
+ {0x0473, 0x0472}, {0x0475, 0x0474}, {0x0477, 0x0476}, {0x0479, 0x0478},
+ {0x047b, 0x047a}, {0x047d, 0x047c}, {0x047f, 0x047e}, {0x0481, 0x0480},
+ {0x048d, 0x048c}, {0x048f, 0x048e}, {0x0491, 0x0490}, {0x0493, 0x0492},
+ {0x0495, 0x0494}, {0x0497, 0x0496}, {0x0499, 0x0498}, {0x049b, 0x049a},
+ {0x049d, 0x049c}, {0x049f, 0x049e}, {0x04a1, 0x04a0}, {0x04a3, 0x04a2},
+ {0x04a5, 0x04a4}, {0x04a7, 0x04a6}, {0x04a9, 0x04a8}, {0x04ab, 0x04aa},
+ {0x04ad, 0x04ac}, {0x04af, 0x04ae}, {0x04b1, 0x04b0}, {0x04b3, 0x04b2},
+ {0x04b5, 0x04b4}, {0x04b7, 0x04b6}, {0x04b9, 0x04b8}, {0x04bb, 0x04ba},
+ {0x04bd, 0x04bc}, {0x04bf, 0x04be}, {0x04c2, 0x04c1}, {0x04c4, 0x04c3},
+ {0x04c8, 0x04c7}, {0x04cc, 0x04cb}, {0x04d1, 0x04d0}, {0x04d3, 0x04d2},
+ {0x04d5, 0x04d4}, {0x04d7, 0x04d6}, {0x04d9, 0x04d8}, {0x04db, 0x04da},
+ {0x04dd, 0x04dc}, {0x04df, 0x04de}, {0x04e1, 0x04e0}, {0x04e3, 0x04e2},
+ {0x04e5, 0x04e4}, {0x04e7, 0x04e6}, {0x04e9, 0x04e8}, {0x04eb, 0x04ea},
+ {0x04ed, 0x04ec}, {0x04ef, 0x04ee}, {0x04f1, 0x04f0}, {0x04f3, 0x04f2},
+ {0x04f5, 0x04f4}, {0x04f9, 0x04f8}, {0x0561, 0x0531}, {0x0562, 0x0532},
+ {0x0563, 0x0533}, {0x0564, 0x0534}, {0x0565, 0x0535}, {0x0566, 0x0536},
+ {0x0567, 0x0537}, {0x0568, 0x0538}, {0x0569, 0x0539}, {0x056a, 0x053a},
+ {0x056b, 0x053b}, {0x056c, 0x053c}, {0x056d, 0x053d}, {0x056e, 0x053e},
+ {0x056f, 0x053f}, {0x0570, 0x0540}, {0x0571, 0x0541}, {0x0572, 0x0542},
+ {0x0573, 0x0543}, {0x0574, 0x0544}, {0x0575, 0x0545}, {0x0576, 0x0546},
+ {0x0577, 0x0547}, {0x0578, 0x0548}, {0x0579, 0x0549}, {0x057a, 0x054a},
+ {0x057b, 0x054b}, {0x057c, 0x054c}, {0x057d, 0x054d}, {0x057e, 0x054e},
+ {0x057f, 0x054f}, {0x0580, 0x0550}, {0x0581, 0x0551}, {0x0582, 0x0552},
+ {0x0583, 0x0553}, {0x0584, 0x0554}, {0x0585, 0x0555}, {0x0586, 0x0556},
+ {0x1e01, 0x1e00}, {0x1e03, 0x1e02}, {0x1e05, 0x1e04}, {0x1e07, 0x1e06},
+ {0x1e09, 0x1e08}, {0x1e0b, 0x1e0a}, {0x1e0d, 0x1e0c}, {0x1e0f, 0x1e0e},
+ {0x1e11, 0x1e10}, {0x1e13, 0x1e12}, {0x1e15, 0x1e14}, {0x1e17, 0x1e16},
+ {0x1e19, 0x1e18}, {0x1e1b, 0x1e1a}, {0x1e1d, 0x1e1c}, {0x1e1f, 0x1e1e},
+ {0x1e21, 0x1e20}, {0x1e23, 0x1e22}, {0x1e25, 0x1e24}, {0x1e27, 0x1e26},
+ {0x1e29, 0x1e28}, {0x1e2b, 0x1e2a}, {0x1e2d, 0x1e2c}, {0x1e2f, 0x1e2e},
+ {0x1e31, 0x1e30}, {0x1e33, 0x1e32}, {0x1e35, 0x1e34}, {0x1e37, 0x1e36},
+ {0x1e39, 0x1e38}, {0x1e3b, 0x1e3a}, {0x1e3d, 0x1e3c}, {0x1e3f, 0x1e3e},
+ {0x1e41, 0x1e40}, {0x1e43, 0x1e42}, {0x1e45, 0x1e44}, {0x1e47, 0x1e46},
+ {0x1e49, 0x1e48}, {0x1e4b, 0x1e4a}, {0x1e4d, 0x1e4c}, {0x1e4f, 0x1e4e},
+ {0x1e51, 0x1e50}, {0x1e53, 0x1e52}, {0x1e55, 0x1e54}, {0x1e57, 0x1e56},
+ {0x1e59, 0x1e58}, {0x1e5b, 0x1e5a}, {0x1e5d, 0x1e5c}, {0x1e5f, 0x1e5e},
+ {0x1e61, 0x1e60}, {0x1e63, 0x1e62}, {0x1e65, 0x1e64}, {0x1e67, 0x1e66},
+ {0x1e69, 0x1e68}, {0x1e6b, 0x1e6a}, {0x1e6d, 0x1e6c}, {0x1e6f, 0x1e6e},
+ {0x1e71, 0x1e70}, {0x1e73, 0x1e72}, {0x1e75, 0x1e74}, {0x1e77, 0x1e76},
+ {0x1e79, 0x1e78}, {0x1e7b, 0x1e7a}, {0x1e7d, 0x1e7c}, {0x1e7f, 0x1e7e},
+ {0x1e81, 0x1e80}, {0x1e83, 0x1e82}, {0x1e85, 0x1e84}, {0x1e87, 0x1e86},
+ {0x1e89, 0x1e88}, {0x1e8b, 0x1e8a}, {0x1e8d, 0x1e8c}, {0x1e8f, 0x1e8e},
+ {0x1e91, 0x1e90}, {0x1e93, 0x1e92}, {0x1e95, 0x1e94}, {0x1e9b, 0x1e60},
+ {0x1ea1, 0x1ea0}, {0x1ea3, 0x1ea2}, {0x1ea5, 0x1ea4}, {0x1ea7, 0x1ea6},
+ {0x1ea9, 0x1ea8}, {0x1eab, 0x1eaa}, {0x1ead, 0x1eac}, {0x1eaf, 0x1eae},
+ {0x1eb1, 0x1eb0}, {0x1eb3, 0x1eb2}, {0x1eb5, 0x1eb4}, {0x1eb7, 0x1eb6},
+ {0x1eb9, 0x1eb8}, {0x1ebb, 0x1eba}, {0x1ebd, 0x1ebc}, {0x1ebf, 0x1ebe},
+ {0x1ec1, 0x1ec0}, {0x1ec3, 0x1ec2}, {0x1ec5, 0x1ec4}, {0x1ec7, 0x1ec6},
+ {0x1ec9, 0x1ec8}, {0x1ecb, 0x1eca}, {0x1ecd, 0x1ecc}, {0x1ecf, 0x1ece},
+ {0x1ed1, 0x1ed0}, {0x1ed3, 0x1ed2}, {0x1ed5, 0x1ed4}, {0x1ed7, 0x1ed6},
+ {0x1ed9, 0x1ed8}, {0x1edb, 0x1eda}, {0x1edd, 0x1edc}, {0x1edf, 0x1ede},
+ {0x1ee1, 0x1ee0}, {0x1ee3, 0x1ee2}, {0x1ee5, 0x1ee4}, {0x1ee7, 0x1ee6},
+ {0x1ee9, 0x1ee8}, {0x1eeb, 0x1eea}, {0x1eed, 0x1eec}, {0x1eef, 0x1eee},
+ {0x1ef1, 0x1ef0}, {0x1ef3, 0x1ef2}, {0x1ef5, 0x1ef4}, {0x1ef7, 0x1ef6},
+ {0x1ef9, 0x1ef8}, {0x1f00, 0x1f08}, {0x1f01, 0x1f09}, {0x1f02, 0x1f0a},
+ {0x1f03, 0x1f0b}, {0x1f04, 0x1f0c}, {0x1f05, 0x1f0d}, {0x1f06, 0x1f0e},
+ {0x1f07, 0x1f0f}, {0x1f10, 0x1f18}, {0x1f11, 0x1f19}, {0x1f12, 0x1f1a},
+ {0x1f13, 0x1f1b}, {0x1f14, 0x1f1c}, {0x1f15, 0x1f1d}, {0x1f20, 0x1f28},
+ {0x1f21, 0x1f29}, {0x1f22, 0x1f2a}, {0x1f23, 0x1f2b}, {0x1f24, 0x1f2c},
+ {0x1f25, 0x1f2d}, {0x1f26, 0x1f2e}, {0x1f27, 0x1f2f}, {0x1f30, 0x1f38},
+ {0x1f31, 0x1f39}, {0x1f32, 0x1f3a}, {0x1f33, 0x1f3b}, {0x1f34, 0x1f3c},
+ {0x1f35, 0x1f3d}, {0x1f36, 0x1f3e}, {0x1f37, 0x1f3f}, {0x1f40, 0x1f48},
+ {0x1f41, 0x1f49}, {0x1f42, 0x1f4a}, {0x1f43, 0x1f4b}, {0x1f44, 0x1f4c},
+ {0x1f45, 0x1f4d}, {0x1f51, 0x1f59}, {0x1f53, 0x1f5b}, {0x1f55, 0x1f5d},
+ {0x1f57, 0x1f5f}, {0x1f60, 0x1f68}, {0x1f61, 0x1f69}, {0x1f62, 0x1f6a},
+ {0x1f63, 0x1f6b}, {0x1f64, 0x1f6c}, {0x1f65, 0x1f6d}, {0x1f66, 0x1f6e},
+ {0x1f67, 0x1f6f}, {0x1f70, 0x1fba}, {0x1f71, 0x1fbb}, {0x1f72, 0x1fc8},
+ {0x1f73, 0x1fc9}, {0x1f74, 0x1fca}, {0x1f75, 0x1fcb}, {0x1f76, 0x1fda},
+ {0x1f77, 0x1fdb}, {0x1f78, 0x1ff8}, {0x1f79, 0x1ff9}, {0x1f7a, 0x1fea},
+ {0x1f7b, 0x1feb}, {0x1f7c, 0x1ffa}, {0x1f7d, 0x1ffb}, {0x1f80, 0x1f88},
+ {0x1f81, 0x1f89}, {0x1f82, 0x1f8a}, {0x1f83, 0x1f8b}, {0x1f84, 0x1f8c},
+ {0x1f85, 0x1f8d}, {0x1f86, 0x1f8e}, {0x1f87, 0x1f8f}, {0x1f90, 0x1f98},
+ {0x1f91, 0x1f99}, {0x1f92, 0x1f9a}, {0x1f93, 0x1f9b}, {0x1f94, 0x1f9c},
+ {0x1f95, 0x1f9d}, {0x1f96, 0x1f9e}, {0x1f97, 0x1f9f}, {0x1fa0, 0x1fa8},
+ {0x1fa1, 0x1fa9}, {0x1fa2, 0x1faa}, {0x1fa3, 0x1fab}, {0x1fa4, 0x1fac},
+ {0x1fa5, 0x1fad}, {0x1fa6, 0x1fae}, {0x1fa7, 0x1faf}, {0x1fb0, 0x1fb8},
+ {0x1fb1, 0x1fb9}, {0x1fb3, 0x1fbc}, {0x1fbe, 0x0399}, {0x1fc3, 0x1fcc},
+ {0x1fd0, 0x1fd8}, {0x1fd1, 0x1fd9}, {0x1fe0, 0x1fe8}, {0x1fe1, 0x1fe9},
+ {0x1fe5, 0x1fec}, {0x1ff3, 0x1ffc}, {0x2170, 0x2160}, {0x2171, 0x2161},
+ {0x2172, 0x2162}, {0x2173, 0x2163}, {0x2174, 0x2164}, {0x2175, 0x2165},
+ {0x2176, 0x2166}, {0x2177, 0x2167}, {0x2178, 0x2168}, {0x2179, 0x2169},
+ {0x217a, 0x216a}, {0x217b, 0x216b}, {0x217c, 0x216c}, {0x217d, 0x216d},
+ {0x217e, 0x216e}, {0x217f, 0x216f}, {0x24d0, 0x24b6}, {0x24d1, 0x24b7},
+ {0x24d2, 0x24b8}, {0x24d3, 0x24b9}, {0x24d4, 0x24ba}, {0x24d5, 0x24bb},
+ {0x24d6, 0x24bc}, {0x24d7, 0x24bd}, {0x24d8, 0x24be}, {0x24d9, 0x24bf},
+ {0x24da, 0x24c0}, {0x24db, 0x24c1}, {0x24dc, 0x24c2}, {0x24dd, 0x24c3},
+ {0x24de, 0x24c4}, {0x24df, 0x24c5}, {0x24e0, 0x24c6}, {0x24e1, 0x24c7},
+ {0x24e2, 0x24c8}, {0x24e3, 0x24c9}, {0x24e4, 0x24ca}, {0x24e5, 0x24cb},
+ {0x24e6, 0x24cc}, {0x24e7, 0x24cd}, {0x24e8, 0x24ce}, {0x24e9, 0x24cf},
+ {0xff41, 0xff21}, {0xff42, 0xff22}, {0xff43, 0xff23}, {0xff44, 0xff24},
+ {0xff45, 0xff25}, {0xff46, 0xff26}, {0xff47, 0xff27}, {0xff48, 0xff28},
+ {0xff49, 0xff29}, {0xff4a, 0xff2a}, {0xff4b, 0xff2b}, {0xff4c, 0xff2c},
+ {0xff4d, 0xff2d}, {0xff4e, 0xff2e}, {0xff4f, 0xff2f}, {0xff50, 0xff30},
+ {0xff51, 0xff31}, {0xff52, 0xff32}, {0xff53, 0xff33}, {0xff54, 0xff34},
+ {0xff55, 0xff35}, {0xff56, 0xff36}, {0xff57, 0xff37}, {0xff58, 0xff38},
+ {0xff59, 0xff39}, {0xff5a, 0xff3a},
+ /* conditional or one-to-many mapping */
+ {0x00df, 0x0000, CMF_MULTICHAR, 2}, {0xfb00, 0x0002, CMF_MULTICHAR, 2},
+ {0xfb01, 0x0004, CMF_MULTICHAR, 2}, {0xfb02, 0x0006, CMF_MULTICHAR, 2},
+ {0xfb03, 0x0008, CMF_MULTICHAR, 3}, {0xfb04, 0x000b, CMF_MULTICHAR, 3},
+ {0xfb05, 0x000e, CMF_MULTICHAR, 2}, {0xfb06, 0x0010, CMF_MULTICHAR, 2},
+ {0x0587, 0x0012, CMF_MULTICHAR, 2}, {0xfb13, 0x0014, CMF_MULTICHAR, 2},
+ {0xfb14, 0x0016, CMF_MULTICHAR, 2}, {0xfb15, 0x0018, CMF_MULTICHAR, 2},
+ {0xfb16, 0x001a, CMF_MULTICHAR, 2}, {0xfb17, 0x001c, CMF_MULTICHAR, 2},
+ {0x0149, 0x001e, CMF_MULTICHAR, 2}, {0x0390, 0x0020, CMF_MULTICHAR, 3},
+ {0x03b0, 0x0023, CMF_MULTICHAR, 3}, {0x01f0, 0x0026, CMF_MULTICHAR, 2},
+ {0x1e96, 0x0028, CMF_MULTICHAR, 2}, {0x1e97, 0x002a, CMF_MULTICHAR, 2},
+ {0x1e98, 0x002c, CMF_MULTICHAR, 2}, {0x1e99, 0x002e, CMF_MULTICHAR, 2},
+ {0x1e9a, 0x0030, CMF_MULTICHAR, 2}, {0x1f50, 0x0032, CMF_MULTICHAR, 2},
+ {0x1f52, 0x0034, CMF_MULTICHAR, 3}, {0x1f54, 0x0037, CMF_MULTICHAR, 3},
+ {0x1f56, 0x003a, CMF_MULTICHAR, 3}, {0x1fb6, 0x003d, CMF_MULTICHAR, 2},
+ {0x1fc6, 0x003f, CMF_MULTICHAR, 2}, {0x1fd2, 0x0041, CMF_MULTICHAR, 3},
+ {0x1fd3, 0x0044, CMF_MULTICHAR, 3}, {0x1fd6, 0x0047, CMF_MULTICHAR, 2},
+ {0x1fd7, 0x0049, CMF_MULTICHAR, 3}, {0x1fe2, 0x004c, CMF_MULTICHAR, 3},
+ {0x1fe3, 0x004f, CMF_MULTICHAR, 3}, {0x1fe4, 0x0052, CMF_MULTICHAR, 2},
+ {0x1fe6, 0x0054, CMF_MULTICHAR, 2}, {0x1fe7, 0x0056, CMF_MULTICHAR, 3},
+ {0x1ff6, 0x0059, CMF_MULTICHAR, 2}, {0x1f80, 0x005b, CMF_MULTICHAR, 2},
+ {0x1f81, 0x005d, CMF_MULTICHAR, 2}, {0x1f82, 0x005f, CMF_MULTICHAR, 2},
+ {0x1f83, 0x0061, CMF_MULTICHAR, 2}, {0x1f84, 0x0063, CMF_MULTICHAR, 2},
+ {0x1f85, 0x0065, CMF_MULTICHAR, 2}, {0x1f86, 0x0067, CMF_MULTICHAR, 2},
+ {0x1f87, 0x0069, CMF_MULTICHAR, 2}, {0x1f88, 0x006b, CMF_MULTICHAR, 2},
+ {0x1f89, 0x006d, CMF_MULTICHAR, 2}, {0x1f8a, 0x006f, CMF_MULTICHAR, 2},
+ {0x1f8b, 0x0071, CMF_MULTICHAR, 2}, {0x1f8c, 0x0073, CMF_MULTICHAR, 2},
+ {0x1f8d, 0x0075, CMF_MULTICHAR, 2}, {0x1f8e, 0x0077, CMF_MULTICHAR, 2},
+ {0x1f8f, 0x0079, CMF_MULTICHAR, 2}, {0x1f90, 0x007b, CMF_MULTICHAR, 2},
+ {0x1f91, 0x007d, CMF_MULTICHAR, 2}, {0x1f92, 0x007f, CMF_MULTICHAR, 2},
+ {0x1f93, 0x0081, CMF_MULTICHAR, 2}, {0x1f94, 0x0083, CMF_MULTICHAR, 2},
+ {0x1f95, 0x0085, CMF_MULTICHAR, 2}, {0x1f96, 0x0087, CMF_MULTICHAR, 2},
+ {0x1f97, 0x0089, CMF_MULTICHAR, 2}, {0x1f98, 0x008b, CMF_MULTICHAR, 2},
+ {0x1f99, 0x008d, CMF_MULTICHAR, 2}, {0x1f9a, 0x008f, CMF_MULTICHAR, 2},
+ {0x1f9b, 0x0091, CMF_MULTICHAR, 2}, {0x1f9c, 0x0093, CMF_MULTICHAR, 2},
+ {0x1f9d, 0x0095, CMF_MULTICHAR, 2}, {0x1f9e, 0x0097, CMF_MULTICHAR, 2},
+ {0x1f9f, 0x0099, CMF_MULTICHAR, 2}, {0x1fa0, 0x009b, CMF_MULTICHAR, 2},
+ {0x1fa1, 0x009d, CMF_MULTICHAR, 2}, {0x1fa2, 0x009f, CMF_MULTICHAR, 2},
+ {0x1fa3, 0x00a1, CMF_MULTICHAR, 2}, {0x1fa4, 0x00a3, CMF_MULTICHAR, 2},
+ {0x1fa5, 0x00a5, CMF_MULTICHAR, 2}, {0x1fa6, 0x00a7, CMF_MULTICHAR, 2},
+ {0x1fa7, 0x00a9, CMF_MULTICHAR, 2}, {0x1fa8, 0x00ab, CMF_MULTICHAR, 2},
+ {0x1fa9, 0x00ad, CMF_MULTICHAR, 2}, {0x1faa, 0x00af, CMF_MULTICHAR, 2},
+ {0x1fab, 0x00b1, CMF_MULTICHAR, 2}, {0x1fac, 0x00b3, CMF_MULTICHAR, 2},
+ {0x1fad, 0x00b5, CMF_MULTICHAR, 2}, {0x1fae, 0x00b7, CMF_MULTICHAR, 2},
+ {0x1faf, 0x00b9, CMF_MULTICHAR, 2}, {0x1fb3, 0x00bb, CMF_MULTICHAR, 2},
+ {0x1fbc, 0x00bd, CMF_MULTICHAR, 2}, {0x1fc3, 0x00bf, CMF_MULTICHAR, 2},
+ {0x1fcc, 0x00c1, CMF_MULTICHAR, 2}, {0x1ff3, 0x00c3, CMF_MULTICHAR, 2},
+ {0x1ffc, 0x00c5, CMF_MULTICHAR, 2}, {0x1fb2, 0x00c7, CMF_MULTICHAR, 2},
+ {0x1fb4, 0x00c9, CMF_MULTICHAR, 2}, {0x1fc2, 0x00cb, CMF_MULTICHAR, 2},
+ {0x1fc4, 0x00cd, CMF_MULTICHAR, 2}, {0x1ff2, 0x00cf, CMF_MULTICHAR, 2},
+ {0x1ff4, 0x00d1, CMF_MULTICHAR, 2}, {0x1fb7, 0x00d3, CMF_MULTICHAR, 3},
+ {0x1fc7, 0x00d6, CMF_MULTICHAR, 3}, {0x1ff7, 0x00d9, CMF_MULTICHAR, 3},
+};
+
+static unsigned long tolower_bitmap[] = {
+ 0xf003ff44, 0x000006fb, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0xffff0000,
+ 0x00000a00, 0x00000060, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x02000000,
+};
+
+static struct casemap tolower_map[] = {
+ /* non-conditional one-to-one mapping */
+ {0x0041, 0x0061}, {0x0042, 0x0062}, {0x0043, 0x0063}, {0x0044, 0x0064},
+ {0x0045, 0x0065}, {0x0046, 0x0066}, {0x0047, 0x0067}, {0x0048, 0x0068},
+ {0x0049, 0x0069}, {0x004a, 0x006a}, {0x004b, 0x006b}, {0x004c, 0x006c},
+ {0x004d, 0x006d}, {0x004e, 0x006e}, {0x004f, 0x006f}, {0x0050, 0x0070},
+ {0x0051, 0x0071}, {0x0052, 0x0072}, {0x0053, 0x0073}, {0x0054, 0x0074},
+ {0x0055, 0x0075}, {0x0056, 0x0076}, {0x0057, 0x0077}, {0x0058, 0x0078},
+ {0x0059, 0x0079}, {0x005a, 0x007a}, {0x00c0, 0x00e0}, {0x00c1, 0x00e1},
+ {0x00c2, 0x00e2}, {0x00c3, 0x00e3}, {0x00c4, 0x00e4}, {0x00c5, 0x00e5},
+ {0x00c6, 0x00e6}, {0x00c7, 0x00e7}, {0x00c8, 0x00e8}, {0x00c9, 0x00e9},
+ {0x00ca, 0x00ea}, {0x00cb, 0x00eb}, {0x00cc, 0x00ec}, {0x00cd, 0x00ed},
+ {0x00ce, 0x00ee}, {0x00cf, 0x00ef}, {0x00d0, 0x00f0}, {0x00d1, 0x00f1},
+ {0x00d2, 0x00f2}, {0x00d3, 0x00f3}, {0x00d4, 0x00f4}, {0x00d5, 0x00f5},
+ {0x00d6, 0x00f6}, {0x00d8, 0x00f8}, {0x00d9, 0x00f9}, {0x00da, 0x00fa},
+ {0x00db, 0x00fb}, {0x00dc, 0x00fc}, {0x00dd, 0x00fd}, {0x00de, 0x00fe},
+ {0x0100, 0x0101}, {0x0102, 0x0103}, {0x0104, 0x0105}, {0x0106, 0x0107},
+ {0x0108, 0x0109}, {0x010a, 0x010b}, {0x010c, 0x010d}, {0x010e, 0x010f},
+ {0x0110, 0x0111}, {0x0112, 0x0113}, {0x0114, 0x0115}, {0x0116, 0x0117},
+ {0x0118, 0x0119}, {0x011a, 0x011b}, {0x011c, 0x011d}, {0x011e, 0x011f},
+ {0x0120, 0x0121}, {0x0122, 0x0123}, {0x0124, 0x0125}, {0x0126, 0x0127},
+ {0x0128, 0x0129}, {0x012a, 0x012b}, {0x012c, 0x012d}, {0x012e, 0x012f},
+ {0x0130, 0x0069}, {0x0132, 0x0133}, {0x0134, 0x0135}, {0x0136, 0x0137},
+ {0x0139, 0x013a}, {0x013b, 0x013c}, {0x013d, 0x013e}, {0x013f, 0x0140},
+ {0x0141, 0x0142}, {0x0143, 0x0144}, {0x0145, 0x0146}, {0x0147, 0x0148},
+ {0x014a, 0x014b}, {0x014c, 0x014d}, {0x014e, 0x014f}, {0x0150, 0x0151},
+ {0x0152, 0x0153}, {0x0154, 0x0155}, {0x0156, 0x0157}, {0x0158, 0x0159},
+ {0x015a, 0x015b}, {0x015c, 0x015d}, {0x015e, 0x015f}, {0x0160, 0x0161},
+ {0x0162, 0x0163}, {0x0164, 0x0165}, {0x0166, 0x0167}, {0x0168, 0x0169},
+ {0x016a, 0x016b}, {0x016c, 0x016d}, {0x016e, 0x016f}, {0x0170, 0x0171},
+ {0x0172, 0x0173}, {0x0174, 0x0175}, {0x0176, 0x0177}, {0x0178, 0x00ff},
+ {0x0179, 0x017a}, {0x017b, 0x017c}, {0x017d, 0x017e}, {0x0181, 0x0253},
+ {0x0182, 0x0183}, {0x0184, 0x0185}, {0x0186, 0x0254}, {0x0187, 0x0188},
+ {0x0189, 0x0256}, {0x018a, 0x0257}, {0x018b, 0x018c}, {0x018e, 0x01dd},
+ {0x018f, 0x0259}, {0x0190, 0x025b}, {0x0191, 0x0192}, {0x0193, 0x0260},
+ {0x0194, 0x0263}, {0x0196, 0x0269}, {0x0197, 0x0268}, {0x0198, 0x0199},
+ {0x019c, 0x026f}, {0x019d, 0x0272}, {0x019f, 0x0275}, {0x01a0, 0x01a1},
+ {0x01a2, 0x01a3}, {0x01a4, 0x01a5}, {0x01a6, 0x0280}, {0x01a7, 0x01a8},
+ {0x01a9, 0x0283}, {0x01ac, 0x01ad}, {0x01ae, 0x0288}, {0x01af, 0x01b0},
+ {0x01b1, 0x028a}, {0x01b2, 0x028b}, {0x01b3, 0x01b4}, {0x01b5, 0x01b6},
+ {0x01b7, 0x0292}, {0x01b8, 0x01b9}, {0x01bc, 0x01bd}, {0x01c4, 0x01c6},
+ {0x01c5, 0x01c6}, {0x01c7, 0x01c9}, {0x01c8, 0x01c9}, {0x01ca, 0x01cc},
+ {0x01cb, 0x01cc}, {0x01cd, 0x01ce}, {0x01cf, 0x01d0}, {0x01d1, 0x01d2},
+ {0x01d3, 0x01d4}, {0x01d5, 0x01d6}, {0x01d7, 0x01d8}, {0x01d9, 0x01da},
+ {0x01db, 0x01dc}, {0x01de, 0x01df}, {0x01e0, 0x01e1}, {0x01e2, 0x01e3},
+ {0x01e4, 0x01e5}, {0x01e6, 0x01e7}, {0x01e8, 0x01e9}, {0x01ea, 0x01eb},
+ {0x01ec, 0x01ed}, {0x01ee, 0x01ef}, {0x01f1, 0x01f3}, {0x01f2, 0x01f3},
+ {0x01f4, 0x01f5}, {0x01f6, 0x0195}, {0x01f7, 0x01bf}, {0x01f8, 0x01f9},
+ {0x01fa, 0x01fb}, {0x01fc, 0x01fd}, {0x01fe, 0x01ff}, {0x0200, 0x0201},
+ {0x0202, 0x0203}, {0x0204, 0x0205}, {0x0206, 0x0207}, {0x0208, 0x0209},
+ {0x020a, 0x020b}, {0x020c, 0x020d}, {0x020e, 0x020f}, {0x0210, 0x0211},
+ {0x0212, 0x0213}, {0x0214, 0x0215}, {0x0216, 0x0217}, {0x0218, 0x0219},
+ {0x021a, 0x021b}, {0x021c, 0x021d}, {0x021e, 0x021f}, {0x0222, 0x0223},
+ {0x0224, 0x0225}, {0x0226, 0x0227}, {0x0228, 0x0229}, {0x022a, 0x022b},
+ {0x022c, 0x022d}, {0x022e, 0x022f}, {0x0230, 0x0231}, {0x0232, 0x0233},
+ {0x0386, 0x03ac}, {0x0388, 0x03ad}, {0x0389, 0x03ae}, {0x038a, 0x03af},
+ {0x038c, 0x03cc}, {0x038e, 0x03cd}, {0x038f, 0x03ce}, {0x0391, 0x03b1},
+ {0x0392, 0x03b2}, {0x0393, 0x03b3}, {0x0394, 0x03b4}, {0x0395, 0x03b5},
+ {0x0396, 0x03b6}, {0x0397, 0x03b7}, {0x0398, 0x03b8}, {0x0399, 0x03b9},
+ {0x039a, 0x03ba}, {0x039b, 0x03bb}, {0x039c, 0x03bc}, {0x039d, 0x03bd},
+ {0x039e, 0x03be}, {0x039f, 0x03bf}, {0x03a0, 0x03c0}, {0x03a1, 0x03c1},
+ {0x03a3, 0x03c3}, {0x03a4, 0x03c4}, {0x03a5, 0x03c5}, {0x03a6, 0x03c6},
+ {0x03a7, 0x03c7}, {0x03a8, 0x03c8}, {0x03a9, 0x03c9}, {0x03aa, 0x03ca},
+ {0x03ab, 0x03cb}, {0x03da, 0x03db}, {0x03dc, 0x03dd}, {0x03de, 0x03df},
+ {0x03e0, 0x03e1}, {0x03e2, 0x03e3}, {0x03e4, 0x03e5}, {0x03e6, 0x03e7},
+ {0x03e8, 0x03e9}, {0x03ea, 0x03eb}, {0x03ec, 0x03ed}, {0x03ee, 0x03ef},
+ {0x0400, 0x0450}, {0x0401, 0x0451}, {0x0402, 0x0452}, {0x0403, 0x0453},
+ {0x0404, 0x0454}, {0x0405, 0x0455}, {0x0406, 0x0456}, {0x0407, 0x0457},
+ {0x0408, 0x0458}, {0x0409, 0x0459}, {0x040a, 0x045a}, {0x040b, 0x045b},
+ {0x040c, 0x045c}, {0x040d, 0x045d}, {0x040e, 0x045e}, {0x040f, 0x045f},
+ {0x0410, 0x0430}, {0x0411, 0x0431}, {0x0412, 0x0432}, {0x0413, 0x0433},
+ {0x0414, 0x0434}, {0x0415, 0x0435}, {0x0416, 0x0436}, {0x0417, 0x0437},
+ {0x0418, 0x0438}, {0x0419, 0x0439}, {0x041a, 0x043a}, {0x041b, 0x043b},
+ {0x041c, 0x043c}, {0x041d, 0x043d}, {0x041e, 0x043e}, {0x041f, 0x043f},
+ {0x0420, 0x0440}, {0x0421, 0x0441}, {0x0422, 0x0442}, {0x0423, 0x0443},
+ {0x0424, 0x0444}, {0x0425, 0x0445}, {0x0426, 0x0446}, {0x0427, 0x0447},
+ {0x0428, 0x0448}, {0x0429, 0x0449}, {0x042a, 0x044a}, {0x042b, 0x044b},
+ {0x042c, 0x044c}, {0x042d, 0x044d}, {0x042e, 0x044e}, {0x042f, 0x044f},
+ {0x0460, 0x0461}, {0x0462, 0x0463}, {0x0464, 0x0465}, {0x0466, 0x0467},
+ {0x0468, 0x0469}, {0x046a, 0x046b}, {0x046c, 0x046d}, {0x046e, 0x046f},
+ {0x0470, 0x0471}, {0x0472, 0x0473}, {0x0474, 0x0475}, {0x0476, 0x0477},
+ {0x0478, 0x0479}, {0x047a, 0x047b}, {0x047c, 0x047d}, {0x047e, 0x047f},
+ {0x0480, 0x0481}, {0x048c, 0x048d}, {0x048e, 0x048f}, {0x0490, 0x0491},
+ {0x0492, 0x0493}, {0x0494, 0x0495}, {0x0496, 0x0497}, {0x0498, 0x0499},
+ {0x049a, 0x049b}, {0x049c, 0x049d}, {0x049e, 0x049f}, {0x04a0, 0x04a1},
+ {0x04a2, 0x04a3}, {0x04a4, 0x04a5}, {0x04a6, 0x04a7}, {0x04a8, 0x04a9},
+ {0x04aa, 0x04ab}, {0x04ac, 0x04ad}, {0x04ae, 0x04af}, {0x04b0, 0x04b1},
+ {0x04b2, 0x04b3}, {0x04b4, 0x04b5}, {0x04b6, 0x04b7}, {0x04b8, 0x04b9},
+ {0x04ba, 0x04bb}, {0x04bc, 0x04bd}, {0x04be, 0x04bf}, {0x04c1, 0x04c2},
+ {0x04c3, 0x04c4}, {0x04c7, 0x04c8}, {0x04cb, 0x04cc}, {0x04d0, 0x04d1},
+ {0x04d2, 0x04d3}, {0x04d4, 0x04d5}, {0x04d6, 0x04d7}, {0x04d8, 0x04d9},
+ {0x04da, 0x04db}, {0x04dc, 0x04dd}, {0x04de, 0x04df}, {0x04e0, 0x04e1},
+ {0x04e2, 0x04e3}, {0x04e4, 0x04e5}, {0x04e6, 0x04e7}, {0x04e8, 0x04e9},
+ {0x04ea, 0x04eb}, {0x04ec, 0x04ed}, {0x04ee, 0x04ef}, {0x04f0, 0x04f1},
+ {0x04f2, 0x04f3}, {0x04f4, 0x04f5}, {0x04f8, 0x04f9}, {0x0531, 0x0561},
+ {0x0532, 0x0562}, {0x0533, 0x0563}, {0x0534, 0x0564}, {0x0535, 0x0565},
+ {0x0536, 0x0566}, {0x0537, 0x0567}, {0x0538, 0x0568}, {0x0539, 0x0569},
+ {0x053a, 0x056a}, {0x053b, 0x056b}, {0x053c, 0x056c}, {0x053d, 0x056d},
+ {0x053e, 0x056e}, {0x053f, 0x056f}, {0x0540, 0x0570}, {0x0541, 0x0571},
+ {0x0542, 0x0572}, {0x0543, 0x0573}, {0x0544, 0x0574}, {0x0545, 0x0575},
+ {0x0546, 0x0576}, {0x0547, 0x0577}, {0x0548, 0x0578}, {0x0549, 0x0579},
+ {0x054a, 0x057a}, {0x054b, 0x057b}, {0x054c, 0x057c}, {0x054d, 0x057d},
+ {0x054e, 0x057e}, {0x054f, 0x057f}, {0x0550, 0x0580}, {0x0551, 0x0581},
+ {0x0552, 0x0582}, {0x0553, 0x0583}, {0x0554, 0x0584}, {0x0555, 0x0585},
+ {0x0556, 0x0586}, {0x1e00, 0x1e01}, {0x1e02, 0x1e03}, {0x1e04, 0x1e05},
+ {0x1e06, 0x1e07}, {0x1e08, 0x1e09}, {0x1e0a, 0x1e0b}, {0x1e0c, 0x1e0d},
+ {0x1e0e, 0x1e0f}, {0x1e10, 0x1e11}, {0x1e12, 0x1e13}, {0x1e14, 0x1e15},
+ {0x1e16, 0x1e17}, {0x1e18, 0x1e19}, {0x1e1a, 0x1e1b}, {0x1e1c, 0x1e1d},
+ {0x1e1e, 0x1e1f}, {0x1e20, 0x1e21}, {0x1e22, 0x1e23}, {0x1e24, 0x1e25},
+ {0x1e26, 0x1e27}, {0x1e28, 0x1e29}, {0x1e2a, 0x1e2b}, {0x1e2c, 0x1e2d},
+ {0x1e2e, 0x1e2f}, {0x1e30, 0x1e31}, {0x1e32, 0x1e33}, {0x1e34, 0x1e35},
+ {0x1e36, 0x1e37}, {0x1e38, 0x1e39}, {0x1e3a, 0x1e3b}, {0x1e3c, 0x1e3d},
+ {0x1e3e, 0x1e3f}, {0x1e40, 0x1e41}, {0x1e42, 0x1e43}, {0x1e44, 0x1e45},
+ {0x1e46, 0x1e47}, {0x1e48, 0x1e49}, {0x1e4a, 0x1e4b}, {0x1e4c, 0x1e4d},
+ {0x1e4e, 0x1e4f}, {0x1e50, 0x1e51}, {0x1e52, 0x1e53}, {0x1e54, 0x1e55},
+ {0x1e56, 0x1e57}, {0x1e58, 0x1e59}, {0x1e5a, 0x1e5b}, {0x1e5c, 0x1e5d},
+ {0x1e5e, 0x1e5f}, {0x1e60, 0x1e61}, {0x1e62, 0x1e63}, {0x1e64, 0x1e65},
+ {0x1e66, 0x1e67}, {0x1e68, 0x1e69}, {0x1e6a, 0x1e6b}, {0x1e6c, 0x1e6d},
+ {0x1e6e, 0x1e6f}, {0x1e70, 0x1e71}, {0x1e72, 0x1e73}, {0x1e74, 0x1e75},
+ {0x1e76, 0x1e77}, {0x1e78, 0x1e79}, {0x1e7a, 0x1e7b}, {0x1e7c, 0x1e7d},
+ {0x1e7e, 0x1e7f}, {0x1e80, 0x1e81}, {0x1e82, 0x1e83}, {0x1e84, 0x1e85},
+ {0x1e86, 0x1e87}, {0x1e88, 0x1e89}, {0x1e8a, 0x1e8b}, {0x1e8c, 0x1e8d},
+ {0x1e8e, 0x1e8f}, {0x1e90, 0x1e91}, {0x1e92, 0x1e93}, {0x1e94, 0x1e95},
+ {0x1ea0, 0x1ea1}, {0x1ea2, 0x1ea3}, {0x1ea4, 0x1ea5}, {0x1ea6, 0x1ea7},
+ {0x1ea8, 0x1ea9}, {0x1eaa, 0x1eab}, {0x1eac, 0x1ead}, {0x1eae, 0x1eaf},
+ {0x1eb0, 0x1eb1}, {0x1eb2, 0x1eb3}, {0x1eb4, 0x1eb5}, {0x1eb6, 0x1eb7},
+ {0x1eb8, 0x1eb9}, {0x1eba, 0x1ebb}, {0x1ebc, 0x1ebd}, {0x1ebe, 0x1ebf},
+ {0x1ec0, 0x1ec1}, {0x1ec2, 0x1ec3}, {0x1ec4, 0x1ec5}, {0x1ec6, 0x1ec7},
+ {0x1ec8, 0x1ec9}, {0x1eca, 0x1ecb}, {0x1ecc, 0x1ecd}, {0x1ece, 0x1ecf},
+ {0x1ed0, 0x1ed1}, {0x1ed2, 0x1ed3}, {0x1ed4, 0x1ed5}, {0x1ed6, 0x1ed7},
+ {0x1ed8, 0x1ed9}, {0x1eda, 0x1edb}, {0x1edc, 0x1edd}, {0x1ede, 0x1edf},
+ {0x1ee0, 0x1ee1}, {0x1ee2, 0x1ee3}, {0x1ee4, 0x1ee5}, {0x1ee6, 0x1ee7},
+ {0x1ee8, 0x1ee9}, {0x1eea, 0x1eeb}, {0x1eec, 0x1eed}, {0x1eee, 0x1eef},
+ {0x1ef0, 0x1ef1}, {0x1ef2, 0x1ef3}, {0x1ef4, 0x1ef5}, {0x1ef6, 0x1ef7},
+ {0x1ef8, 0x1ef9}, {0x1f08, 0x1f00}, {0x1f09, 0x1f01}, {0x1f0a, 0x1f02},
+ {0x1f0b, 0x1f03}, {0x1f0c, 0x1f04}, {0x1f0d, 0x1f05}, {0x1f0e, 0x1f06},
+ {0x1f0f, 0x1f07}, {0x1f18, 0x1f10}, {0x1f19, 0x1f11}, {0x1f1a, 0x1f12},
+ {0x1f1b, 0x1f13}, {0x1f1c, 0x1f14}, {0x1f1d, 0x1f15}, {0x1f28, 0x1f20},
+ {0x1f29, 0x1f21}, {0x1f2a, 0x1f22}, {0x1f2b, 0x1f23}, {0x1f2c, 0x1f24},
+ {0x1f2d, 0x1f25}, {0x1f2e, 0x1f26}, {0x1f2f, 0x1f27}, {0x1f38, 0x1f30},
+ {0x1f39, 0x1f31}, {0x1f3a, 0x1f32}, {0x1f3b, 0x1f33}, {0x1f3c, 0x1f34},
+ {0x1f3d, 0x1f35}, {0x1f3e, 0x1f36}, {0x1f3f, 0x1f37}, {0x1f48, 0x1f40},
+ {0x1f49, 0x1f41}, {0x1f4a, 0x1f42}, {0x1f4b, 0x1f43}, {0x1f4c, 0x1f44},
+ {0x1f4d, 0x1f45}, {0x1f59, 0x1f51}, {0x1f5b, 0x1f53}, {0x1f5d, 0x1f55},
+ {0x1f5f, 0x1f57}, {0x1f68, 0x1f60}, {0x1f69, 0x1f61}, {0x1f6a, 0x1f62},
+ {0x1f6b, 0x1f63}, {0x1f6c, 0x1f64}, {0x1f6d, 0x1f65}, {0x1f6e, 0x1f66},
+ {0x1f6f, 0x1f67}, {0x1f88, 0x1f80}, {0x1f89, 0x1f81}, {0x1f8a, 0x1f82},
+ {0x1f8b, 0x1f83}, {0x1f8c, 0x1f84}, {0x1f8d, 0x1f85}, {0x1f8e, 0x1f86},
+ {0x1f8f, 0x1f87}, {0x1f98, 0x1f90}, {0x1f99, 0x1f91}, {0x1f9a, 0x1f92},
+ {0x1f9b, 0x1f93}, {0x1f9c, 0x1f94}, {0x1f9d, 0x1f95}, {0x1f9e, 0x1f96},
+ {0x1f9f, 0x1f97}, {0x1fa8, 0x1fa0}, {0x1fa9, 0x1fa1}, {0x1faa, 0x1fa2},
+ {0x1fab, 0x1fa3}, {0x1fac, 0x1fa4}, {0x1fad, 0x1fa5}, {0x1fae, 0x1fa6},
+ {0x1faf, 0x1fa7}, {0x1fb8, 0x1fb0}, {0x1fb9, 0x1fb1}, {0x1fba, 0x1f70},
+ {0x1fbb, 0x1f71}, {0x1fbc, 0x1fb3}, {0x1fc8, 0x1f72}, {0x1fc9, 0x1f73},
+ {0x1fca, 0x1f74}, {0x1fcb, 0x1f75}, {0x1fcc, 0x1fc3}, {0x1fd8, 0x1fd0},
+ {0x1fd9, 0x1fd1}, {0x1fda, 0x1f76}, {0x1fdb, 0x1f77}, {0x1fe8, 0x1fe0},
+ {0x1fe9, 0x1fe1}, {0x1fea, 0x1f7a}, {0x1feb, 0x1f7b}, {0x1fec, 0x1fe5},
+ {0x1ff8, 0x1f78}, {0x1ff9, 0x1f79}, {0x1ffa, 0x1f7c}, {0x1ffb, 0x1f7d},
+ {0x1ffc, 0x1ff3}, {0x2126, 0x03c9}, {0x212a, 0x006b}, {0x212b, 0x00e5},
+ {0x2160, 0x2170}, {0x2161, 0x2171}, {0x2162, 0x2172}, {0x2163, 0x2173},
+ {0x2164, 0x2174}, {0x2165, 0x2175}, {0x2166, 0x2176}, {0x2167, 0x2177},
+ {0x2168, 0x2178}, {0x2169, 0x2179}, {0x216a, 0x217a}, {0x216b, 0x217b},
+ {0x216c, 0x217c}, {0x216d, 0x217d}, {0x216e, 0x217e}, {0x216f, 0x217f},
+ {0x24b6, 0x24d0}, {0x24b7, 0x24d1}, {0x24b8, 0x24d2}, {0x24b9, 0x24d3},
+ {0x24ba, 0x24d4}, {0x24bb, 0x24d5}, {0x24bc, 0x24d6}, {0x24bd, 0x24d7},
+ {0x24be, 0x24d8}, {0x24bf, 0x24d9}, {0x24c0, 0x24da}, {0x24c1, 0x24db},
+ {0x24c2, 0x24dc}, {0x24c3, 0x24dd}, {0x24c4, 0x24de}, {0x24c5, 0x24df},
+ {0x24c6, 0x24e0}, {0x24c7, 0x24e1}, {0x24c8, 0x24e2}, {0x24c9, 0x24e3},
+ {0x24ca, 0x24e4}, {0x24cb, 0x24e5}, {0x24cc, 0x24e6}, {0x24cd, 0x24e7},
+ {0x24ce, 0x24e8}, {0x24cf, 0x24e9}, {0xff21, 0xff41}, {0xff22, 0xff42},
+ {0xff23, 0xff43}, {0xff24, 0xff44}, {0xff25, 0xff45}, {0xff26, 0xff46},
+ {0xff27, 0xff47}, {0xff28, 0xff48}, {0xff29, 0xff49}, {0xff2a, 0xff4a},
+ {0xff2b, 0xff4b}, {0xff2c, 0xff4c}, {0xff2d, 0xff4d}, {0xff2e, 0xff4e},
+ {0xff2f, 0xff4f}, {0xff30, 0xff50}, {0xff31, 0xff51}, {0xff32, 0xff52},
+ {0xff33, 0xff53}, {0xff34, 0xff54}, {0xff35, 0xff55}, {0xff36, 0xff56},
+ {0xff37, 0xff57}, {0xff38, 0xff58}, {0xff39, 0xff59}, {0xff3a, 0xff5a},
+ /* conditional or one-to-many mapping */
+ {0x03a3, 0x03c2, CMF_FINAL},
+};
+
+static unicode_t multichar_casemap_data[] = {
+ 83, 83, 70, 70, 70, 73, 70, 76, 70, 70,
+ 73, 70, 70, 76, 83, 84, 83, 84, 1333, 1362,
+ 1348, 1350, 1348, 1333, 1348, 1339, 1358, 1350, 1348, 1341,
+ 700, 78, 921, 776, 769, 933, 776, 769, 74, 780,
+ 72, 817, 84, 776, 87, 778, 89, 778, 65, 702,
+ 933, 787, 933, 787, 768, 933, 787, 769, 933, 787,
+ 834, 913, 834, 919, 834, 921, 776, 768, 921, 776,
+ 769, 921, 834, 921, 776, 834, 933, 776, 768, 933,
+ 776, 769, 929, 787, 933, 834, 933, 776, 834, 937,
+ 834, 7944, 921, 7945, 921, 7946, 921, 7947, 921, 7948,
+ 921, 7949, 921, 7950, 921, 7951, 921, 7944, 921, 7945,
+ 921, 7946, 921, 7947, 921, 7948, 921, 7949, 921, 7950,
+ 921, 7951, 921, 7976, 921, 7977, 921, 7978, 921, 7979,
+ 921, 7980, 921, 7981, 921, 7982, 921, 7983, 921, 7976,
+ 921, 7977, 921, 7978, 921, 7979, 921, 7980, 921, 7981,
+ 921, 7982, 921, 7983, 921, 8040, 921, 8041, 921, 8042,
+ 921, 8043, 921, 8044, 921, 8045, 921, 8046, 921, 8047,
+ 921, 8040, 921, 8041, 921, 8042, 921, 8043, 921, 8044,
+ 921, 8045, 921, 8046, 921, 8047, 921, 913, 921, 913,
+ 921, 919, 921, 919, 921, 937, 921, 937, 921, 8122,
+ 921, 902, 921, 8138, 921, 905, 921, 8186, 921, 911,
+ 921, 913, 834, 921, 919, 834, 921, 937, 834, 921,
+};
+
+/*
+ * Cased characters and non-spacing marks (for casemap context)
+ */
+
+#define CTX_BLOCK_SZ 512
+#define CTX_CASED 1 /* cased character */
+#define CTX_NSM 2 /* non-spacing mark */
+
+static unsigned long casemap_ctx_section0[] = {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x55555554, 0x00155555, 0x55555554, 0x00155555,
+ 0x00000000, 0x00000000, 0x00100000, 0x00100400,
+ 0x55555555, 0x55551555, 0x55555555, 0x55551555,
+ 0x55555555, 0x55555555, 0x55555555, 0x55555555,
+ 0x55555555, 0x55555555, 0x55555555, 0x55555555,
+ 0x55555555, 0x55555555, 0x55555555, 0x55155555,
+ 0x55555500, 0x55555555, 0x55555555, 0x55555555,
+};
+
+static unsigned long casemap_ctx_section1[] = {
+ 0x55555555, 0x55555555, 0x55555550, 0x00000055,
+ 0x00000000, 0x55555555, 0x55555555, 0x55555555,
+ 0x55555555, 0x55555555, 0x05555555, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa,
+ 0x2aaaaaaa, 0x00000000, 0x0000002a, 0x00000000,
+ 0x51151000, 0x55555555, 0x55555545, 0x55555555,
+ 0x15555555, 0x55505555, 0x55555555, 0x00000055,
+};
+
+static unsigned long casemap_ctx_section2[] = {
+ 0x55555555, 0x55555555, 0x55555555, 0x55555555,
+ 0x55555555, 0x55555555, 0x55555555, 0x55555555,
+ 0x55002a85, 0x55555555, 0x55555555, 0x55555555,
+ 0x01414155, 0x55555555, 0x55555555, 0x00050555,
+ 0x00000000, 0x00000000, 0x00000000, 0x55555554,
+ 0x55555555, 0x00001555, 0x55555554, 0x55555555,
+ 0x00005555, 0xaaaaaaa8, 0xaaaaaa8a, 0x8a8aaaaa,
+ 0x00000228, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static unsigned long casemap_ctx_section3[] = {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xaa800000, 0x00000aaa, 0x00000000, 0x00000002,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x82aaa000, 0x0aa282aa, 0x00000000,
+ 0x00000000, 0x00000008, 0x00000000, 0xaaaaaaaa,
+ 0x002aaaaa, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0xaaaaa000, 0x00000002,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static unsigned long casemap_ctx_section4[] = {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000028, 0x00000000, 0x00000000, 0x02000000,
+ 0x0802aaa8, 0x000002a8, 0x000000a0, 0x00000000,
+ 0x00000008, 0x00000000, 0x00000000, 0x02000000,
+ 0x080002a8, 0x00000000, 0x000000a0, 0x00000000,
+};
+
+static unsigned long casemap_ctx_section5[] = {
+ 0x00000020, 0x00000000, 0x00000000, 0x02000000,
+ 0x0a828028, 0x00000000, 0x00000000, 0x0000000a,
+ 0x00000028, 0x00000000, 0x00000000, 0x02000000,
+ 0x08028aa8, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000008, 0x00000000, 0x00000000, 0x82000000,
+ 0x080000a8, 0x00002000, 0x00000000, 0x00000000,
+ 0x00000020, 0x00000000, 0x00000000, 0x00000000,
+ 0x08000002, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static unsigned long casemap_ctx_section6[] = {
+ 0x00000000, 0x00000000, 0x00000000, 0xa0000000,
+ 0x0aa2a002, 0x00002800, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x80000000,
+ 0x0a002000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x080000a8, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00200000, 0x000022a0, 0x00000000, 0x00000000,
+};
+
+static unsigned long casemap_ctx_section7[] = {
+ 0x00000000, 0x00000000, 0x00000000, 0x002aaa08,
+ 0x2aaa8000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x028aaa08,
+ 0x0aaa0000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x000a0000, 0x00000000, 0x00088800,
+ 0x00000000, 0x00000000, 0x00000000, 0x2aaaaaa8,
+ 0x0000a2aa, 0xaaa8aaaa, 0xaaaaaaaa, 0x02aaaaaa,
+ 0x00002000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static unsigned long casemap_ctx_section8[] = {
+ 0x00000000, 0x00000000, 0xa8000000, 0x0008a022,
+ 0x00000000, 0x000a0000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x55555555, 0x55555555,
+ 0x00000555, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static unsigned long casemap_ctx_section11[] = {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x0aaa8000,
+ 0xaaa82000, 0x000000aa, 0x00000000, 0x00000000,
+};
+
+static unsigned long casemap_ctx_section12[] = {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00080000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static unsigned long casemap_ctx_section15[] = {
+ 0x55555555, 0x55555555, 0x55555555, 0x55555555,
+ 0x55555555, 0x55555555, 0x55555555, 0x55555555,
+ 0x55555555, 0x00555555, 0x55555555, 0x55555555,
+ 0x55555555, 0x55555555, 0x55555555, 0x00055555,
+ 0x55555555, 0x05550555, 0x55555555, 0x55555555,
+ 0x05550555, 0x44445555, 0x55555555, 0x05555555,
+ 0x55555555, 0x55555555, 0x55555555, 0x11555155,
+ 0x01555150, 0x00555055, 0x01555555, 0x01555150,
+};
+
+static unsigned long casemap_ctx_section16[] = {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x40000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x02aaaaaa, 0x00000008, 0x00000000,
+ 0x55504010, 0x05540455, 0x45511100, 0x00040145,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static unsigned long casemap_ctx_section24[] = {
+ 0x00000000, 0x00000000, 0xaaa00000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00280000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static unsigned long casemap_ctx_section125[] = {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00001555, 0x20005540, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static unsigned long casemap_ctx_section127[] = {
+ 0x00000000, 0x00000000, 0x000000aa, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x55555554, 0x00155555,
+ 0x55555554, 0x00155555, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static unsigned long *casemap_ctx_sections[] = {
+ casemap_ctx_section0,
+ casemap_ctx_section1,
+ casemap_ctx_section2,
+ casemap_ctx_section3,
+ casemap_ctx_section4,
+ casemap_ctx_section5,
+ casemap_ctx_section6,
+ casemap_ctx_section7,
+ casemap_ctx_section8,
+ NULL,
+ NULL,
+ casemap_ctx_section11,
+ casemap_ctx_section12,
+ NULL,
+ NULL,
+ casemap_ctx_section15,
+ casemap_ctx_section16,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ casemap_ctx_section24,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ casemap_ctx_section125,
+ NULL,
+ casemap_ctx_section127,
+};
+
diff --git a/contrib/idn/mdnkit/lib/unormalize.c b/contrib/idn/mdnkit/lib/unormalize.c
new file mode 100644
index 00000000..065a0bb3
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/unormalize.c
@@ -0,0 +1,459 @@
+#ifndef lint
+static char *rcsid = "$Id: unormalize.c,v 1.1 2000/12/07 00:52:26 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef DEBUG_HASHSTAT
+#include <stdio.h>
+#endif
+
+#include <mdn/result.h>
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/utf8.h>
+#include <mdn/unicode.h>
+#include <mdn/unormalize.h>
+#include <mdn/debug.h>
+
+#if !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY)
+#define memmove(a,b,c) bcopy((char *)(b),(char *)(a),(int)(c))
+#endif
+
+#define WORKBUF_SIZE 128
+#define WORKBUF_SIZE_MAX 10000
+
+typedef struct {
+ int cur; /* pointing now processing character */
+ int last; /* pointing just after the last character */
+ int size; /* size of UCS and CLASS array */
+ unsigned long *ucs; /* UCS-4 characters */
+ int *class; /* and their canonical classes */
+ unsigned long ucs_buf[WORKBUF_SIZE]; /* local buffer */
+ int class_buf[WORKBUF_SIZE]; /* ditto */
+} workbuf_t;
+
+static mdn_result_t normalize(int do_composition, int compat,
+ const char *from, char *to, size_t tolen);
+static mdn_result_t decompose(workbuf_t *wb, unsigned long c, int compat);
+static void get_class(workbuf_t *wb);
+static void reorder(workbuf_t *wb);
+static void compose(workbuf_t *wb);
+static mdn_result_t flush_before_cur(workbuf_t *wb,
+ char **top, size_t *tolenp);
+static void workbuf_init(workbuf_t *wb);
+static void workbuf_free(workbuf_t *wb);
+static mdn_result_t workbuf_extend(workbuf_t *wb);
+static mdn_result_t workbuf_append(workbuf_t *wb, unsigned long c);
+static void workbuf_shift(workbuf_t *wb, int shift);
+static void workbuf_removevoid(workbuf_t *wb);
+
+
+mdn_result_t
+mdn__unormalize_formc(const char *from, char *to, size_t tolen) {
+ assert(from != NULL && to != NULL && tolen >= 0);
+ TRACE(("mdn__unormalize_formc(from=\"%s\", tolen=%d)\n",
+ mdn_debug_xstring(from, 20), tolen));
+ return (normalize(1, 0, from, to, tolen));
+}
+
+mdn_result_t
+mdn__unormalize_formd(const char *from, char *to, size_t tolen) {
+ assert(from != NULL && to != NULL && tolen >= 0);
+ TRACE(("mdn__unormalize_formd(from=\"%s\", tolen=%d)\n",
+ mdn_debug_xstring(from, 20), tolen));
+ return (normalize(0, 0, from, to, tolen));
+}
+
+mdn_result_t
+mdn__unormalize_formkc(const char *from, char *to, size_t tolen) {
+ assert(from != NULL && to != NULL && tolen >= 0);
+ TRACE(("mdn__unormalize_formkc(from=\"%s\", tolen=%d)\n",
+ mdn_debug_xstring(from, 20), tolen));
+ return (normalize(1, 1, from, to, tolen));
+}
+
+mdn_result_t
+mdn__unormalize_formkd(const char *from, char *to, size_t tolen) {
+ assert(from != NULL && to != NULL && tolen >= 0);
+ TRACE(("mdn__unormalize_formkd(from=\"%s\", tolen=%d)\n",
+ mdn_debug_xstring(from, 20), tolen));
+ return (normalize(0, 1, from, to, tolen));
+}
+
+static mdn_result_t
+normalize(int do_composition, int compat,
+ const char *from, char *to, size_t tolen)
+{
+ workbuf_t wb;
+ size_t fromlen = strlen(from);
+ mdn_result_t r = mdn_success;
+
+ /*
+ * Initialize working buffer.
+ */
+ workbuf_init(&wb);
+
+ while (fromlen > 0) {
+ unsigned long c;
+ int mblen;
+
+ assert(wb.cur == wb.last);
+
+ /*
+ * Get one character from 'from'.
+ */
+ if ((mblen = mdn_utf8_getwc(from, fromlen, &c)) == 0) {
+ r = mdn_invalid_encoding;
+ break;
+ }
+ from += mblen;
+ fromlen -= mblen;
+
+ /*
+ * Decompose it.
+ */
+ if ((r = decompose(&wb, c, compat)) != mdn_success)
+ break;
+
+ /*
+ * Get canonical class.
+ */
+ get_class(&wb);
+
+ /*
+ * Reorder & compose.
+ */
+ for (; wb.cur < wb.last; wb.cur++) {
+ if (wb.cur == 0) {
+ continue;
+ } else if (wb.class[wb.cur] > 0) {
+ /*
+ * This is not a starter. Try reordering.
+ * Note that characters up to it are
+ * already in canonical order.
+ */
+ reorder(&wb);
+ continue;
+ }
+
+ /*
+ * This is a starter character, and there are
+ * some characters before it. Those characters
+ * have been reordered properly, and
+ * ready for composition.
+ */
+ if (do_composition && wb.class[0] == 0)
+ compose(&wb);
+
+ /*
+ * If CUR points to a starter character,
+ * then process of characters before CUR are
+ * already finished, because any further
+ * reordering/composition for them are blocked
+ * by the starter CUR points.
+ */
+ if (wb.cur > 0 && wb.class[wb.cur] == 0) {
+ /* Flush everything before CUR. */
+ r = flush_before_cur(&wb, &to, &tolen);
+ if (r != mdn_success)
+ break;
+ }
+ }
+ }
+
+ if (r == mdn_success) {
+ if (do_composition && wb.cur > 0 && wb.class[0] == 0) {
+ /*
+ * There is some characters left in WB.
+ * They are ordered, but not composed yet.
+ * Now CUR points just after the last character in WB,
+ * and since compose() tries to compose characters
+ * between top and CUR inclusive, we must make CUR
+ * one character back during compose().
+ */
+ wb.cur--;
+ compose(&wb);
+ wb.cur++;
+ }
+ /*
+ * Call this even when WB.CUR == 0, to make TO
+ * NUL-terminated.
+ */
+ r = flush_before_cur(&wb, &to, &tolen);
+ }
+
+ workbuf_free(&wb);
+ return (r);
+}
+
+static mdn_result_t
+decompose(workbuf_t *wb, unsigned long c, int compat) {
+ mdn_result_t r;
+ int dec_len;
+
+again:
+ r = mdn__unicode_decompose(compat, wb->ucs + wb->last,
+ wb->size - wb->last,
+ c, &dec_len);
+ switch (r) {
+ case mdn_success:
+ wb->last += dec_len;
+ return (mdn_success);
+ case mdn_notfound:
+ return (workbuf_append(wb, c));
+ case mdn_buffer_overflow:
+ if ((r = workbuf_extend(wb)) != mdn_success)
+ return (r);
+ if (wb->size > WORKBUF_SIZE_MAX) {
+ WARNING(("mdn__unormalize_form*: "
+ "working buffer too large\n"));
+ return (mdn_nomemory);
+ }
+ goto again;
+ default:
+ return (r);
+ }
+ /* NOTREACHED */
+}
+
+static void
+get_class(workbuf_t *wb) {
+ int i;
+
+ for (i = wb->cur; i < wb->last; i++)
+ wb->class[i] = mdn__unicode_canonicalclass(wb->ucs[i]);
+}
+
+static void
+reorder(workbuf_t *wb) {
+ unsigned long c;
+ int i;
+ int class;
+
+ assert(wb != NULL);
+
+ i = wb->cur;
+ c = wb->ucs[i];
+ class = wb->class[i];
+
+ while (i > 0 && wb->class[i - 1] > class) {
+ wb->ucs[i] = wb->ucs[i - 1];
+ wb->class[i] =wb->class[i - 1];
+ i--;
+ wb->ucs[i] = c;
+ wb->class[i] = class;
+ }
+}
+
+static void
+compose(workbuf_t *wb) {
+ int cur;
+ unsigned long *ucs;
+ int *class;
+ int last_class;
+ int nvoids;
+ int i;
+
+ assert(wb != NULL && wb->class[0] == 0);
+
+ cur = wb->cur;
+ ucs = wb->ucs;
+ class = wb->class;
+
+ /*
+ * If there are no decomposition sequence that begins with
+ * the top character, composition is impossible.
+ */
+ if (!mdn__unicode_iscompositecandidate(ucs[0]))
+ return;
+
+ last_class = 0;
+ nvoids = 0;
+ for (i = 1; i <= cur; i++) {
+ unsigned long c;
+ int cl = class[i];
+
+ if ((last_class < cl || cl == 0) &&
+ mdn__unicode_compose(ucs[0], ucs[i], &c) == mdn_success) {
+ /*
+ * Replace the top character with the composed one.
+ */
+ ucs[0] = c;
+ class[0] = mdn__unicode_canonicalclass(c);
+
+ class[i] = -1; /* void this character */
+ nvoids++;
+ } else {
+ last_class = cl;
+ }
+ }
+
+ /* Purge void characters, if any. */
+ if (nvoids > 0)
+ workbuf_removevoid(wb);
+}
+
+static mdn_result_t
+flush_before_cur(workbuf_t *wb, char **top, size_t *tolenp) {
+ int cur = wb->cur;
+ char *to = *top;
+ size_t tolen = *tolenp;
+ int i;
+
+ for (i = 0; i < cur; i++) {
+ int len = mdn_utf8_putwc(to, tolen, wb->ucs[i]);
+ if (len == 0)
+ return (mdn_buffer_overflow);
+ to += len;
+ tolen -= len;
+ }
+ if (tolen < 1)
+ return (mdn_buffer_overflow);
+ *to = '\0';
+
+ *top = to;
+ *tolenp = tolen;
+
+ workbuf_shift(wb, cur);
+
+ return (mdn_success);
+}
+
+static void
+workbuf_init(workbuf_t *wb) {
+ wb->cur = 0;
+ wb->last = 0;
+ wb->size = WORKBUF_SIZE;
+ wb->ucs = wb->ucs_buf;
+ wb->class = wb->class_buf;
+}
+
+static void
+workbuf_free(workbuf_t *wb) {
+ if (wb->ucs != wb->ucs_buf) {
+ free(wb->ucs);
+ free(wb->class);
+ }
+}
+
+static mdn_result_t
+workbuf_extend(workbuf_t *wb) {
+ int newsize = wb->size * 3;
+
+ if (wb->ucs == wb->ucs_buf) {
+ wb->ucs = malloc(sizeof(wb->ucs[0]) * newsize);
+ wb->class = malloc(sizeof(wb->class[0]) * newsize);
+ } else {
+ wb->ucs = realloc(wb->ucs, sizeof(wb->ucs[0]) * newsize);
+ wb->class = realloc(wb->class, sizeof(wb->class[0]) * newsize);
+ }
+ if (wb->ucs == NULL || wb->class == NULL)
+ return (mdn_nomemory);
+ else
+ return (mdn_success);
+}
+
+static mdn_result_t
+workbuf_append(workbuf_t *wb, unsigned long c) {
+ mdn_result_t r;
+
+ if (wb->last >= wb->size && (r = workbuf_extend(wb)) != mdn_success)
+ return (r);
+ wb->ucs[wb->last++] = c;
+ return (mdn_success);
+}
+
+static void
+workbuf_shift(workbuf_t *wb, int shift) {
+ int nmove;
+
+ assert(wb != NULL && wb->cur >= shift);
+
+ nmove = wb->last - shift;
+ (void)memmove(&wb->ucs[0], &wb->ucs[shift],
+ nmove * sizeof(wb->ucs[0]));
+ (void)memmove(&wb->class[0], &wb->class[shift],
+ nmove * sizeof(wb->class[0]));
+ wb->cur -= shift;
+ wb->last -= shift;
+}
+
+static void
+workbuf_removevoid(workbuf_t *wb) {
+ int i, j;
+ int last = wb->last;
+
+ for (i = j = 0; i < last; i++) {
+ if (wb->class[i] >= 0) {
+ if (j < i) {
+ wb->ucs[j] = wb->ucs[i];
+ wb->class[j] = wb->class[i];
+ }
+ j++;
+ }
+ }
+ wb->cur -= last - j;
+ wb->last = j;
+}
diff --git a/contrib/idn/mdnkit/lib/utf5.c b/contrib/idn/mdnkit/lib/utf5.c
new file mode 100644
index 00000000..6edcfdc1
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/utf5.c
@@ -0,0 +1,175 @@
+#ifndef lint
+static char *rcsid = "$Id: utf5.c,v 1.1 2000/12/07 00:52:26 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/utf5.h>
+#include <mdn/debug.h>
+
+int
+mdn_utf5_getwc(const char *s, size_t len, unsigned long *vp) {
+ int top = 1;
+ size_t orglen = len;
+ unsigned long v = 0;
+
+ assert(s != NULL && len >= 0 && vp != NULL);
+
+#if 0
+ TRACE(("mdn_utf5_getwc(s=<%s>,len=%d)\n",
+ mdn_debug_hexstring(s, 10), len));
+#endif
+
+ if (len == 0)
+ return (0);
+
+ /* Special case for domain name handling. */
+ if (*s == '.') {
+ *vp = '.';
+ return (1);
+ }
+
+ while (len > 0) {
+ int c = *s++;
+
+ if (top) {
+ if ('G' <= c && c <= 'V')
+ v = c - 'G';
+ else if ('g' <= c && c <= 'v')
+ v = c - 'g';
+ else
+ return (0);
+ top = 0;
+ } else {
+ if ('0' <= c && c <= '9')
+ v = (v << 4) + (c - '0');
+ else if ('A' <= c && c <= 'F')
+ v = (v << 4) + (c - 'A' + 10);
+ else if ('a' <= c && c <= 'f')
+ v = (v << 4) + (c - 'a' + 10);
+ else
+ break;
+ }
+ len--;
+ }
+ *vp = v;
+ return (orglen - len);
+}
+
+int
+mdn_utf5_putwc(char *s, size_t len, unsigned long v) {
+ int w;
+ int off;
+
+ assert(s != NULL);
+
+#if 0
+ TRACE(("mdn_utf5_putwc(v=%lx)\n", v));
+#endif
+
+ /* Special handling for domain delimiter '.' */
+ if (v == '.') {
+ if (len < 1)
+ return (0);
+ *s = v;
+ return (1);
+ }
+
+ if (v < 0x10) {
+ w = 1;
+ } else if (v < 0x100) {
+ w = 2;
+ } else if (v < 0x1000) {
+ w = 3;
+ } else if (v < 0x10000) {
+ w = 4;
+ } else if (v < 0x100000) {
+ w = 5;
+ } else if (v < 0x1000000) {
+ w = 6;
+ } else if (v < 0x10000000) {
+ w = 7;
+ } else if (v < 0x80000000) {
+ w = 8;
+ } else {
+ return (0);
+ }
+
+ if (len < w)
+ return (0);
+
+ off = (w - 1) * 4;
+ *s++ = 'G' + ((v >> off) & 0xf);
+ off -= 4;
+ while (off >= 0) {
+ int x = (v >> off) & 0xf;
+ if (x < 10)
+ *s++ = '0' + x;
+ else
+ *s++ = 'A' + x - 10;
+ off -= 4;
+ }
+ return (w);
+}
diff --git a/contrib/idn/mdnkit/lib/utf8.c b/contrib/idn/mdnkit/lib/utf8.c
new file mode 100644
index 00000000..0b8a2ca7
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/utf8.c
@@ -0,0 +1,292 @@
+#ifndef lint
+static char *rcsid = "$Id: utf8.c,v 1.1 2000/12/07 00:52:26 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/utf8.h>
+#include <mdn/debug.h>
+
+#define UTF8_WIDTH(c) \
+ (((c) < 0x80) ? 1 : \
+ ((c) < 0xc0) ? 0 : \
+ ((c) < 0xe0) ? 2 : \
+ ((c) < 0xf0) ? 3 : \
+ ((c) < 0xf8) ? 4 : \
+ ((c) < 0xfc) ? 5 : \
+ ((c) < 0xfe) ? 6 : 0)
+
+#define VALID_CONT_BYTE(c) (0x80 <= (c) && (c) < 0xc0)
+
+int
+mdn_utf8_mblen(const char *s) {
+ int c = *(unsigned char *)s;
+
+ assert(s != NULL);
+
+#if 0
+ TRACE(("mdn_utf8_mblen(s=<%s>)\n", mdn_debug_hexstring(s, 6)));
+#endif
+
+ return UTF8_WIDTH(c);
+}
+
+int
+mdn_utf8_getmb(const char *s, size_t len, char *buf) {
+ /* buf must be at least 7-bytes long */
+ const unsigned char *p = (const unsigned char *)s;
+ unsigned char *q = (unsigned char *)buf;
+ int width = UTF8_WIDTH(*p);
+ int w;
+
+ assert(s != NULL);
+
+#if 0
+ TRACE(("mdn_utf8_getmb(s=<%s>,len=%d)\n",
+ mdn_debug_hexstring(s, 6), len));
+#endif
+
+ if (width == 0 || len < width)
+ return (0);
+
+ /* Copy the first byte. */
+ *q++ = *p++;
+
+ /* .. and the rest. */
+ w = width;
+ while (--w > 0) {
+ if (!VALID_CONT_BYTE(*p))
+ return (0);
+ *q++ = *p++;
+ }
+ return (width);
+}
+
+extern int
+mdn_utf8_getwc(const char *s, size_t len, unsigned long *vp) {
+ unsigned long v;
+ unsigned long min;
+ const unsigned char *p = (const unsigned char *)s;
+ int c;
+ int width;
+ int rest;
+
+ assert(s != NULL);
+
+#if 0
+ TRACE(("mdn_utf8_getwc(s=<%s>,len=%d)\n",
+ mdn_debug_hexstring(s, 10), len));
+#endif
+
+ c = *p++;
+ width = UTF8_WIDTH(c);
+
+ switch (width) {
+ case 0:
+ return (0);
+ case 1:
+ v = c;
+ min = 0;
+ break;
+ case 2:
+ v = c & 0x1f;
+ min = 0x80;
+ break;
+ case 3:
+ v = c & 0xf;
+ min = 0x800;
+ break;
+ case 4:
+ v = c & 0x7;
+ min = 0x10000;
+ break;
+ case 5:
+ v = c & 3;
+ min = 0x200000;
+ break;
+ case 6:
+ v = c & 1;
+ min = 0x4000000;
+ break;
+ default:
+ FATAL(("mdn_utf8_getint: internal error\n"));
+ return (0);
+ }
+
+ if (len < width)
+ return (0);
+
+ rest = width - 1;
+ while (rest-- > 0) {
+ if (!VALID_CONT_BYTE(*p))
+ return (0);
+ v = (v << 6) | (*p & 0x3f);
+ p++;
+ }
+
+ if (v < min)
+ return (0);
+
+ *vp = v;
+ return (width);
+}
+
+extern int
+mdn_utf8_putwc(char *s, size_t len, unsigned long v) {
+ unsigned char *p = (unsigned char *)s;
+ int mask;
+ int off;
+ int l;
+
+ assert(s != NULL);
+
+#if 0
+ TRACE(("mdn_utf8_putwc(v=%lx)\n", v));
+#endif
+
+ if (v < 0x80) {
+ mask = 0;
+ l = 1;
+ } else if (v < 0x800) {
+ mask = 0xc0;
+ l = 2;
+ } else if (v < 0x10000) {
+ mask = 0xe0;
+ l = 3;
+ } else if (v < 0x200000) {
+ mask = 0xf0;
+ l = 4;
+ } else if (v < 0x4000000) {
+ mask = 0xf8;
+ l = 5;
+ } else if (v < 0x80000000) {
+ mask = 0xfc;
+ l = 6;
+ } else {
+ return (0);
+ }
+
+ if (len < l)
+ return (0);
+
+ off = 6 * (l - 1);
+ *p++ = (v >> off) | mask;
+ mask = 0x80;
+ while (off > 0) {
+ off -= 6;
+ *p++ = ((v >> off) & 0x3f) | mask;
+ }
+ return l;
+}
+
+int
+mdn_utf8_isvalidchar(const char *s) {
+ unsigned long dummy;
+
+ TRACE(("mdn_utf8_isvalidchar(s=<%s>)\n",
+ mdn_debug_hexstring(s, 6)));
+
+ return (mdn_utf8_getwc(s, 6, &dummy) > 0);
+}
+
+int
+mdn_utf8_isvalidstring(const char *s) {
+ unsigned long dummy;
+ int width;
+
+ assert(s != NULL);
+
+ TRACE(("mdn_utf8_isvalidstring(s=<%s>)\n",
+ mdn_debug_hexstring(s, 20)));
+
+ while (*s != '\0') {
+ width = mdn_utf8_getwc(s, 6, &dummy);
+ if (width == 0)
+ return (0);
+ s += width;
+ }
+ return (1);
+}
+
+char *
+mdn_utf8_findfirstbyte(const char *s, const char *known_top) {
+ const unsigned char *p = (const unsigned char *)s;
+ const unsigned char *t = (const unsigned char *)known_top;
+
+ assert(s != NULL && known_top != NULL && known_top <= s);
+
+ TRACE(("mdn_utf8_findfirstbyte(s=<%s>)\n",
+ mdn_debug_hexstring(s, 8)));
+
+ while (p >= t) {
+ if (!VALID_CONT_BYTE(*p))
+ break;
+ p--;
+ }
+ if (p < t || UTF8_WIDTH(*p) == 0)
+ return (NULL);
+
+ return ((char *)p);
+}
diff --git a/contrib/idn/mdnkit/lib/util.c b/contrib/idn/mdnkit/lib/util.c
new file mode 100644
index 00000000..97cf77fe
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/util.c
@@ -0,0 +1,193 @@
+#ifndef lint
+static char *rcsid = "$Id: util.c,v 1.1 2000/12/07 00:52:26 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+
+#include <mdn/assert.h>
+#include <mdn/result.h>
+#include <mdn/logmacro.h>
+#include <mdn/utf8.h>
+
+/*
+ * ASCII tolower() macro.
+ * Note that this macro evaluates the argument multiple times. Be careful.
+ */
+#define ASCII_TOLOWER(c) \
+ (('A' <= (c) && (c) <= 'Z') ? ((c) - 'A' + 'a') : (c))
+
+/*
+ * Unicode surrogate pair.
+ */
+#define IS_SURROGATE_HIGH(v) (0xd800 <= (v) && (v) <= 0xdbff)
+#define IS_SURROGATE_LOW(v) (0xdc00 <= (v) && (v) <= 0xdfff)
+#define SURROGATE_HIGH(v) (SURROGATE_H_OFF + (((v) - 0x10000) >> 10))
+#define SURROGATE_LOW(v) (SURROGATE_L_OFF + ((v) & 0x3ff))
+#define SURROGATE_BASE 0x10000
+#define SURROGATE_H_OFF 0xd800
+#define SURROGATE_L_OFF 0xdc00
+#define COMBINE_SURROGATE(h, l) \
+ (SURROGATE_BASE + (((h)-SURROGATE_H_OFF)<<10) + ((l)-SURROGATE_L_OFF))
+
+int
+mdn_util_casematch(const char *s1, const char *s2, size_t n) {
+ assert(s1 != NULL && s2 != NULL);
+
+ while (n-- > 0) {
+ if (*s1 != *s2 && ASCII_TOLOWER(*s1) != ASCII_TOLOWER(*s2))
+ return (0);
+ else if (*s1 == '\0')
+ break;
+ s1++;
+ s2++;
+ }
+ return (1);
+}
+
+const char *
+mdn_util_domainspan(const char *s, const char *end) {
+ while (s < end &&
+ (('a' <= *s && *s <= 'z') ||
+ ('A' <= *s && *s <= 'Z') ||
+ ('0' <= *s && *s <= '9') ||
+ *s == '-'))
+ s++;
+ return (s);
+}
+
+mdn_result_t
+mdn_util_utf8toutf16(const char *utf8, size_t fromlen,
+ unsigned short *utf16, size_t tolen, size_t *reslenp)
+{
+ int i = 0;
+
+ while (fromlen > 0) {
+ unsigned long v;
+ int flen;
+
+ flen = mdn_utf8_getwc(utf8, fromlen, &v);
+ if (flen == 0) {
+ WARNING(("mdn_util_utf8toutf16: "
+ "invalid character\n"));
+ return (mdn_invalid_encoding);
+ }
+ utf8 += flen;
+ fromlen -= flen;
+
+ if (tolen < 1)
+ return (mdn_buffer_overflow);
+
+ if (IS_SURROGATE_LOW(v) || IS_SURROGATE_HIGH(v)) {
+ WARNING(("mdn_util_utf8toutf16: UTF-8 string contains "
+ "surrogate pair\n"));
+ return (mdn_invalid_encoding);
+ } else if (v > 0xffff) {
+ /* Convert to surrogate pair */
+ if (v >= 0x110000)
+ return (mdn_invalid_encoding);
+ if (tolen < 2)
+ return (mdn_buffer_overflow);
+ utf16[i++] = SURROGATE_HIGH(v);
+ utf16[i++] = SURROGATE_LOW(v);
+ tolen -= 2;
+ } else {
+ utf16[i++] = v;
+ tolen--;
+ }
+ }
+ *reslenp = i;
+ return (mdn_success);
+}
+
+mdn_result_t
+mdn_util_utf16toutf8(const unsigned short *utf16, size_t fromlen,
+ char *utf8, size_t tolen, size_t *reslenp)
+{
+ int i;
+ char *org = utf8;
+
+ for (i = 0; i < fromlen; i++) {
+ unsigned long v;
+ int w;
+
+ if (IS_SURROGATE_HIGH(utf16[i])) {
+ if (i + 1 >= fromlen ||
+ !IS_SURROGATE_LOW(utf16[i + 1])) {
+ WARNING(("mdn_util_utf16toutf8: "
+ "corrupted surrogate pair\n"));
+ return (mdn_invalid_encoding);
+ }
+ v = COMBINE_SURROGATE(utf16[i], utf16[i + 1]);
+ i++;
+ } else {
+ v = utf16[i];
+ }
+ w = mdn_utf8_putwc(utf8, tolen, v);
+ if (w == 0)
+ return (mdn_buffer_overflow);
+ utf8 += w;
+ tolen -= w;
+ }
+ *reslenp = utf8 - org;
+ return (mdn_success);
+}
diff --git a/contrib/idn/mdnkit/lib/zldrule.c b/contrib/idn/mdnkit/lib/zldrule.c
new file mode 100644
index 00000000..baed52bc
--- /dev/null
+++ b/contrib/idn/mdnkit/lib/zldrule.c
@@ -0,0 +1,262 @@
+#ifndef lint
+static char *rcsid = "$Id: zldrule.c,v 1.1 2000/12/07 00:52:26 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <mdn/result.h>
+#include <mdn/assert.h>
+#include <mdn/logmacro.h>
+#include <mdn/converter.h>
+#include <mdn/translator.h>
+#include <mdn/zldrule.h>
+#include <mdn/debug.h>
+
+typedef struct zld_rule {
+ struct zld_rule *next;
+ char *zld;
+ int zld_depth;
+ int nencodings;
+ mdn_converter_t ctx[1]; /* actually, a variable sized array */
+} zld_rule_t;
+
+struct mdn_zldrule {
+ zld_rule_t *rules;
+};
+
+static int delayedopen = MDN_CONVERTER_RTCHECK; /* XXX */
+
+static void insert_rule(mdn_zldrule_t ctx, zld_rule_t *rule);
+static int domain_depth(const char *domain);
+
+
+mdn_result_t
+mdn_zldrule_create(mdn_zldrule_t *ctxp) {
+ mdn_zldrule_t ctx;
+
+ assert(ctxp != NULL);
+
+ TRACE(("mdn_zldrule_create()\n"));
+
+ *ctxp = NULL;
+
+ if ((ctx = malloc(sizeof(*ctx))) == NULL) {
+ WARNING(("mdn_zldrule_create: malloc failed\n"));
+ return (mdn_nomemory);
+ }
+
+ ctx->rules = NULL;
+
+ *ctxp = ctx;
+ return (mdn_success);
+}
+
+void
+mdn_zldrule_destroy(mdn_zldrule_t ctx) {
+ zld_rule_t *rule;
+
+ assert(ctx != NULL);
+
+ TRACE(("mdn_zldrule_destroy()\n"));
+
+ rule = ctx->rules;
+ while (rule != NULL) {
+ zld_rule_t *next = rule->next;
+ int i;
+
+ free(rule->zld);
+ for (i = 0; i < rule->nencodings; i++)
+ mdn_converter_destroy(rule->ctx[i]);
+ free(rule);
+ rule = next;
+ }
+
+ free(ctx);
+}
+
+mdn_result_t
+mdn_zldrule_add(mdn_zldrule_t ctx, const char *zld,
+ const char **encodings, int nencodings)
+{
+ mdn_result_t r;
+ zld_rule_t *rule;
+ size_t sz;
+ int i;
+
+ assert(ctx != NULL && zld != NULL && encodings != NULL &&
+ nencodings > 0);
+
+ TRACE(("mdn_zldrule_add(zld=%s)\n", zld));
+
+ sz = sizeof(*rule) + sizeof(mdn_converter_t) * nencodings;
+ if ((rule = malloc(sz)) == NULL) {
+ WARNING(("mdn_zldrule_add: malloc failed\n"));
+ return (mdn_nomemory);
+ }
+ rule->next = NULL;
+ rule->zld = NULL;
+ rule->zld_depth = 0;
+ rule->nencodings = 0;
+
+ r = mdn_translator_canonicalzld(zld, &rule->zld);
+ if (r != mdn_success)
+ goto error;
+
+ rule->zld_depth = domain_depth(rule->zld);
+
+ for (i = 0; i < nencodings; i++) {
+ r = mdn_converter_create(encodings[i], &rule->ctx[i],
+ delayedopen);
+ if (r != mdn_success)
+ goto error;
+ }
+
+ insert_rule(ctx, rule);
+
+ return (mdn_success);
+
+error:
+ free(rule);
+ return (r);
+}
+
+mdn_result_t
+mdn_zldrule_select(mdn_zldrule_t ctx, const char *domain,
+ char **zldp, mdn_converter_t *convctxp)
+{
+ char dummy[1024];
+ zld_rule_t *rule;
+ int i;
+ mdn_result_t r;
+
+ assert(ctx != NULL && domain != NULL &&
+ zldp != NULL && convctxp != NULL);
+
+ TRACE(("mdn_zldrule_select(domain=\"%s\")\n",
+ mdn_debug_xstring(domain, 30)));
+
+ for (rule = ctx->rules; rule != NULL; rule = rule->next) {
+ if (mdn_translator_matchzld(domain, rule->zld))
+ goto found;
+ }
+ return (mdn_notfound);
+
+found:
+ *zldp = rule->zld;
+ if (rule->nencodings > 1) {
+ for (i = 0; i < rule->nencodings; i++) {
+ mdn_converter_t convctx = rule->ctx[i];
+ r = mdn_converter_convert(convctx, mdn_converter_l2u,
+ domain, dummy,
+ sizeof(dummy));
+ if (r != mdn_success)
+ continue;
+ *convctxp = rule->ctx[i];
+ return (mdn_success);
+ }
+ return (mdn_invalid_encoding);
+ } else {
+ *convctxp = rule->ctx[0];
+ }
+
+ return (mdn_success);
+}
+
+static void
+insert_rule(mdn_zldrule_t ctx, zld_rule_t *rule) {
+ zld_rule_t *prev, *cur;
+
+ for (prev = NULL, cur = ctx->rules;
+ cur != NULL;
+ prev = cur, cur = cur->next) {
+ if (cur->zld_depth <= rule->zld_depth) {
+ rule->next = cur;
+ if (prev == NULL)
+ ctx->rules = rule;
+ else
+ prev->next = rule;
+ return;
+ }
+ }
+ rule ->next = NULL;
+ if (prev == NULL)
+ ctx->rules = rule;
+ else
+ prev->next = rule;
+}
+
+static int
+domain_depth(const char *s) {
+ int n = 0;
+
+ if (s == NULL)
+ return (0);
+
+ while ((s = strchr(s, '.')) != NULL) {
+ n++;
+ s++;
+ }
+ return (n);
+}
diff --git a/contrib/idn/mdnkit/libtool b/contrib/idn/mdnkit/libtool
new file mode 100755
index 00000000..e41c013d
--- /dev/null
+++ b/contrib/idn/mdnkit/libtool
@@ -0,0 +1,4284 @@
+#! /bin/sh
+
+# libtool - Provide generalized library-building support services.
+# Generated automatically by ltconfig (GNU libtool 1.3.5 (1.385.2.206 2000/05/27 11:12:27))
+# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
+#
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="sed -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+### BEGIN LIBTOOL CONFIG
+# Libtool was configured as follows, on host go.dd.org:
+#
+# CC="gcc" CFLAGS="-g -I/usr/local/include" CPPFLAGS="" \
+# LD="/usr/bin/ld" LDFLAGS="" LIBS="" \
+# NM="/usr/bin/nm -B" RANLIB="ranlib" LN_S="ln -s" \
+# DLLTOOL="" OBJDUMP="" AS="" \
+# ./ltconfig --cache-file=./config.cache --with-gcc --with-gnu-ld --no-verify ./ltmain.sh i386-unknown-netbsdelf1.5.
+#
+# Compiler and other test output produced by ltconfig, useful for
+# debugging ltconfig, is in ./config.log if it exists.
+
+# The version of ltconfig that generated this script.
+LTCONFIG_VERSION="1.3.5"
+
+# Shell to use when invoking shell scripts.
+SHELL="/bin/sh"
+
+# Whether or not to build shared libraries.
+build_libtool_libs=yes
+
+# Whether or not to build static libraries.
+build_old_libs=yes
+
+# Whether or not to optimize for fast installation.
+fast_install=yes
+
+# The host system.
+host_alias=i386-unknown-netbsdelf1.5.
+host=i386-unknown-netbsdelf1.5.
+
+# An echo program that does not interpret backslashes.
+echo="echo"
+
+# The archiver.
+AR="ar"
+
+# The default C compiler.
+CC="gcc"
+
+# The linker used to build libraries.
+LD="/usr/bin/ld"
+
+# Whether we need hard or soft links.
+LN_S="ln -s"
+
+# A BSD-compatible nm program.
+NM="/usr/bin/nm -B"
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="dlltool"
+
+# Used on cygwin: object dumper.
+OBJDUMP="objdump"
+
+# Used on cygwin: assembler.
+AS="as"
+
+# The name of the directory that contains temporary libtool files.
+objdir=.libs
+
+# How to create reloadable object files.
+reload_flag=" -r"
+reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
+
+# How to pass a linker flag through the compiler.
+wl="-Wl,"
+
+# Object file suffix (normally "o").
+objext="o"
+
+# Old archive suffix (normally "a").
+libext="a"
+
+# Executable file suffix (normally "").
+exeext=""
+
+# Additional compiler flags for building library objects.
+pic_flag=" -fPIC"
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o="yes"
+
+# Can we write directly to a .lo ?
+compiler_o_lo="yes"
+
+# Must we lock files when doing compilation ?
+need_locks="no"
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=unknown
+
+# Do we need a version for libraries?
+need_version=unknown
+
+# Whether dlopen is supported.
+dlopen=unknown
+
+# Whether dlopen of programs is supported.
+dlopen_self=unknown
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=unknown
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag="-static"
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=" -fno-builtin -fno-rtti -fno-exceptions"
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec="\${wl}--export-dynamic"
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=""
+
+# Library versioning type.
+version_type=sunos
+
+# Format of library name prefix.
+libname_spec="lib\$name"
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec="\${libname}\${release}.so\$versuffix \${libname}\${release}.so\$major \${libname}\${release}.so \${libname}.so"
+
+# The coded name of the library, if different from the real name.
+soname_spec="\${libname}\${release}.so\$major"
+
+# Commands used to build and install an old-style archive.
+RANLIB="ranlib"
+old_archive_cmds="\$AR cru \$oldlib\$oldobjs~\$RANLIB \$oldlib"
+old_postinstall_cmds="\$RANLIB \$oldlib~chmod 644 \$oldlib"
+old_postuninstall_cmds=""
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=""
+
+# Commands used to build and install a shared archive.
+archive_cmds="\$LD -Bshareable \$libobjs \$deplibs \$linkopts -o \$lib"
+archive_expsym_cmds=""
+postinstall_cmds=""
+postuninstall_cmds=""
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method="unknown"
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=""
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=""
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=""
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=""
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=""
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGISTW]\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'"
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern char \\1;/p'"
+
+# This is the shared library runtime path variable.
+runpath_var=LD_RUN_PATH
+
+# This is the shared library path variable.
+shlibpath_var=LD_LIBRARY_PATH
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=unknown
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=immediate
+
+# Flag to hardcode $libdir into a binary during linking.
+# This must work even if $libdir does not exist.
+hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir"
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=""
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=no
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=no
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=unsupported
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+# Fix the shell variable $srcfile for the compiler.
+fix_srcfile_path=""
+
+# Set to yes if exported symbols are required.
+always_export_symbols=no
+
+# The commands to list exported symbols.
+export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | sed 's/.* //' | sort | uniq > \$export_symbols"
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+
+# Symbols that must always be exported.
+include_expsyms=""
+
+### END LIBTOOL CONFIG
+
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun ltconfig.
+#
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell, and then maybe $echo will work.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# The name of this program.
+progname=`$echo "$0" | sed 's%^.*/%%'`
+modename="$progname"
+
+# Constants.
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.3.5
+TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+SP2NL='tr \040 \012'
+NL2SP='tr \015\012 \040\040'
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+ save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+ save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+if test "$LTCONFIG_VERSION" != "$VERSION"; then
+ echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+fi
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ echo "$modename: not configured to build any kind of library" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+# Parse our command line options once, thoroughly.
+while test $# -gt 0
+do
+ arg="$1"
+ shift
+
+ case "$arg" in
+ -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case "$prev" in
+ execute_dlfiles)
+ eval "$prev=\"\$$prev \$arg\""
+ ;;
+ *)
+ eval "$prev=\$arg"
+ ;;
+ esac
+
+ prev=
+ prevopt=
+ continue
+ fi
+
+ # Have we seen a non-optional argument yet?
+ case "$arg" in
+ --help)
+ show_help=yes
+ ;;
+
+ --version)
+ echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+ exit 0
+ ;;
+
+ --config)
+ sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
+ exit 0
+ ;;
+
+ --debug)
+ echo "$progname: enabling shell trace mode"
+ set -x
+ ;;
+
+ --dry-run | -n)
+ run=:
+ ;;
+
+ --features)
+ echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ echo "enable shared libraries"
+ else
+ echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ echo "enable static libraries"
+ else
+ echo "disable static libraries"
+ fi
+ exit 0
+ ;;
+
+ --finish) mode="finish" ;;
+
+ --mode) prevopt="--mode" prev=mode ;;
+ --mode=*) mode="$optarg" ;;
+
+ --quiet | --silent)
+ show=:
+ ;;
+
+ -dlopen)
+ prevopt="-dlopen"
+ prev=execute_dlfiles
+ ;;
+
+ -*)
+ $echo "$modename: unrecognized option \`$arg'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *)
+ nonopt="$arg"
+ break
+ ;;
+ esac
+done
+
+if test -n "$prevopt"; then
+ $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+fi
+
+if test -z "$show_help"; then
+
+ # Infer the operation mode.
+ if test -z "$mode"; then
+ case "$nonopt" in
+ *cc | *++ | gcc* | *-gcc*)
+ mode=link
+ for arg
+ do
+ case "$arg" in
+ -c)
+ mode=compile
+ break
+ ;;
+ esac
+ done
+ ;;
+ *db | *dbx | *strace | *truss)
+ mode=execute
+ ;;
+ *install*|cp|mv)
+ mode=install
+ ;;
+ *rm)
+ mode=uninstall
+ ;;
+ *)
+ # If we have no mode, but dlfiles were specified, then do execute mode.
+ test -n "$execute_dlfiles" && mode=execute
+
+ # Just use the default operation mode.
+ if test -z "$mode"; then
+ if test -n "$nonopt"; then
+ $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+ else
+ $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+ fi
+ fi
+ ;;
+ esac
+ fi
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$execute_dlfiles" && test "$mode" != execute; then
+ $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$modename --help --mode=$mode' for more information."
+
+ # These modes are in order of execution frequency so that they run quickly.
+ case "$mode" in
+ # libtool compile mode
+ compile)
+ modename="$modename: compile"
+ # Get the compilation command and the source file.
+ base_compile=
+ lastarg=
+ srcfile="$nonopt"
+ suppress_output=
+
+ user_target=no
+ for arg
+ do
+ # Accept any command-line options.
+ case "$arg" in
+ -o)
+ if test "$user_target" != "no"; then
+ $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+ exit 1
+ fi
+ user_target=next
+ ;;
+
+ -static)
+ build_old_libs=yes
+ continue
+ ;;
+ esac
+
+ case "$user_target" in
+ next)
+ # The next one is the -o target name
+ user_target=yes
+ continue
+ ;;
+ yes)
+ # We got the output file
+ user_target=set
+ libobj="$arg"
+ continue
+ ;;
+ esac
+
+ # Accept the current argument as the source file.
+ lastarg="$srcfile"
+ srcfile="$arg"
+
+ # Aesthetically quote the previous argument.
+
+ # Backslashify any backslashes, double quotes, and dollar signs.
+ # These are the only characters that are still specially
+ # interpreted inside of double-quoted scrings.
+ lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly in scan
+ # sets, so we specify it separately.
+ case "$lastarg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ lastarg="\"$lastarg\""
+ ;;
+ esac
+
+ # Add the previous argument to base_compile.
+ if test -z "$base_compile"; then
+ base_compile="$lastarg"
+ else
+ base_compile="$base_compile $lastarg"
+ fi
+ done
+
+ case "$user_target" in
+ set)
+ ;;
+ no)
+ # Get the name of the library object.
+ libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ ;;
+ *)
+ $echo "$modename: you must specify a target with \`-o'" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ xform='[cCFSfmso]'
+ case "$libobj" in
+ *.ada) xform=ada ;;
+ *.adb) xform=adb ;;
+ *.ads) xform=ads ;;
+ *.asm) xform=asm ;;
+ *.c++) xform=c++ ;;
+ *.cc) xform=cc ;;
+ *.cpp) xform=cpp ;;
+ *.cxx) xform=cxx ;;
+ *.f90) xform=f90 ;;
+ *.for) xform=for ;;
+ esac
+
+ libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+ case "$libobj" in
+ *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+ *)
+ $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test -z "$base_compile"; then
+ $echo "$modename: you must specify a compilation command" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $libobj"
+ else
+ removelist="$libobj"
+ fi
+
+ $run $rm $removelist
+ trap "$run $rm $removelist; exit 1" 1 2 15
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ removelist="$removelist $output_obj $lockfile"
+ trap "$run $rm $removelist; exit 1" 1 2 15
+ else
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until ln "$0" "$lockfile" 2>/dev/null; do
+ $show "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+ echo $srcfile > "$lockfile"
+ fi
+
+ if test -n "$fix_srcfile_path"; then
+ eval srcfile=\"$fix_srcfile_path\"
+ fi
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ # All platforms use -DPIC, to notify preprocessed assembler code.
+ command="$base_compile $srcfile $pic_flag -DPIC"
+ if test "$build_old_libs" = yes; then
+ lo_libobj="$libobj"
+ dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$libobj"; then
+ dir="$objdir"
+ else
+ dir="$dir/$objdir"
+ fi
+ libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+
+ if test -d "$dir"; then
+ $show "$rm $libobj"
+ $run $rm $libobj
+ else
+ $show "$mkdir $dir"
+ $run $mkdir $dir
+ status=$?
+ if test $status -ne 0 && test ! -d $dir; then
+ exit $status
+ fi
+ fi
+ fi
+ if test "$compiler_o_lo" = yes; then
+ output_obj="$libobj"
+ command="$command -o $output_obj"
+ elif test "$compiler_c_o" = yes; then
+ output_obj="$obj"
+ command="$command -o $output_obj"
+ fi
+
+ $run $rm "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ test -n "$output_obj" && $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+ echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test x"$output_obj" != x"$libobj"; then
+ $show "$mv $output_obj $libobj"
+ if $run $mv $output_obj $libobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # If we have no pic_flag, then copy the object into place and finish.
+ if test -z "$pic_flag" && test "$build_old_libs" = yes; then
+ # Rename the .lo from within objdir to obj
+ if test -f $obj; then
+ $show $rm $obj
+ $run $rm $obj
+ fi
+
+ $show "$mv $libobj $obj"
+ if $run $mv $libobj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
+ libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+ # Now arrange that obj and lo_libobj become the same file
+ $show "(cd $xdir && $LN_S $baseobj $libobj)"
+ if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
+ exit 0
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Allow error messages only from the first compilation.
+ suppress_output=' >/dev/null 2>&1'
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ command="$base_compile $srcfile"
+ if test "$compiler_c_o" = yes; then
+ command="$command -o $obj"
+ output_obj="$obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ command="$command$suppress_output"
+ $run $rm "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+ echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed
+ if test x"$output_obj" != x"$obj"; then
+ $show "$mv $output_obj $obj"
+ if $run $mv $output_obj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we do not
+ # accidentally link it into a program.
+ if test "$build_libtool_libs" != yes; then
+ $show "echo timestamp > $libobj"
+ $run eval "echo timestamp > \$libobj" || exit $?
+ else
+ # Move the .lo from within objdir
+ $show "$mv $libobj $lo_libobj"
+ if $run $mv $libobj $lo_libobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+ fi
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ $rm "$lockfile"
+ fi
+
+ exit 0
+ ;;
+
+ # libtool link mode
+ link)
+ modename="$modename: link"
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invokation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+
+ # This is a source program that is used to create dlls on Windows
+ # Don't remove nor modify the starting and closing comments
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# # ifdef __CYGWIN32__
+# # define __CYGWIN__ __CYGWIN32__
+# # endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+# __hDllInstance_base = hInst;
+# return TRUE;
+# }
+# /* ltdll.c ends here */
+ # This is a source program that is used to create import libraries
+ # on Windows for dlls which lack them. Don't remove nor modify the
+ # starting and closing comments
+# /* impgen.c starts here */
+# /* Copyright (C) 1999 Free Software Foundation, Inc.
+#
+# This file is part of GNU libtool.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# */
+#
+# #include <stdio.h> /* for printf() */
+# #include <unistd.h> /* for open(), lseek(), read() */
+# #include <fcntl.h> /* for O_RDONLY, O_BINARY */
+# #include <string.h> /* for strdup() */
+#
+# static unsigned int
+# pe_get16 (fd, offset)
+# int fd;
+# int offset;
+# {
+# unsigned char b[2];
+# lseek (fd, offset, SEEK_SET);
+# read (fd, b, 2);
+# return b[0] + (b[1]<<8);
+# }
+#
+# static unsigned int
+# pe_get32 (fd, offset)
+# int fd;
+# int offset;
+# {
+# unsigned char b[4];
+# lseek (fd, offset, SEEK_SET);
+# read (fd, b, 4);
+# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# static unsigned int
+# pe_as32 (ptr)
+# void *ptr;
+# {
+# unsigned char *b = ptr;
+# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# int
+# main (argc, argv)
+# int argc;
+# char *argv[];
+# {
+# int dll;
+# unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+# unsigned long export_rva, export_size, nsections, secptr, expptr;
+# unsigned long name_rvas, nexp;
+# unsigned char *expdata, *erva;
+# char *filename, *dll_name;
+#
+# filename = argv[1];
+#
+# dll = open(filename, O_RDONLY|O_BINARY);
+# if (!dll)
+# return 1;
+#
+# dll_name = filename;
+#
+# for (i=0; filename[i]; i++)
+# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
+# dll_name = filename + i +1;
+#
+# pe_header_offset = pe_get32 (dll, 0x3c);
+# opthdr_ofs = pe_header_offset + 4 + 20;
+# num_entries = pe_get32 (dll, opthdr_ofs + 92);
+#
+# if (num_entries < 1) /* no exports */
+# return 1;
+#
+# export_rva = pe_get32 (dll, opthdr_ofs + 96);
+# export_size = pe_get32 (dll, opthdr_ofs + 100);
+# nsections = pe_get16 (dll, pe_header_offset + 4 +2);
+# secptr = (pe_header_offset + 4 + 20 +
+# pe_get16 (dll, pe_header_offset + 4 + 16));
+#
+# expptr = 0;
+# for (i = 0; i < nsections; i++)
+# {
+# char sname[8];
+# unsigned long secptr1 = secptr + 40 * i;
+# unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+# unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+# unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+# lseek(dll, secptr1, SEEK_SET);
+# read(dll, sname, 8);
+# if (vaddr <= export_rva && vaddr+vsize > export_rva)
+# {
+# expptr = fptr + (export_rva - vaddr);
+# if (export_rva + export_size > vaddr + vsize)
+# export_size = vsize - (export_rva - vaddr);
+# break;
+# }
+# }
+#
+# expdata = (unsigned char*)malloc(export_size);
+# lseek (dll, expptr, SEEK_SET);
+# read (dll, expdata, export_size);
+# erva = expdata - export_rva;
+#
+# nexp = pe_as32 (expdata+24);
+# name_rvas = pe_as32 (expdata+32);
+#
+# printf ("EXPORTS\n");
+# for (i = 0; i<nexp; i++)
+# {
+# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
+# }
+#
+# return 0;
+# }
+# /* impgen.c ends here */
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ compile_command="$nonopt"
+ finalize_command="$nonopt"
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ linkopts=
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+ else
+ lib_search_path=
+ fi
+ # now prepend the system-specific ones
+ eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ avoid_version=no
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ link_against_libtool_libs=
+ ltlibs=
+ module=no
+ objs=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case "$arg" in
+ -all-static | -static)
+ if test "X$arg" = "X-all-static"; then
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ else
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ fi
+ build_libtool_libs=no
+ build_old_libs=yes
+ prefer_static_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test $# -gt 0; do
+ arg="$1"
+ shift
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case "$prev" in
+ output)
+ compile_command="$compile_command @OUTPUT@"
+ finalize_command="$finalize_command @OUTPUT@"
+ ;;
+ esac
+
+ case "$prev" in
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ compile_command="$compile_command @SYMFILE@"
+ finalize_command="$finalize_command @SYMFILE@"
+ preload=yes
+ fi
+ case "$arg" in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ else
+ dlprefiles="$dlprefiles $arg"
+ fi
+ prev=
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ if test ! -f "$arg"; then
+ $echo "$modename: symbol file \`$arg' does not exist"
+ exit 1
+ fi
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case "$arg" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) rpath="$rpath $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) xrpath="$xrpath $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi
+
+ prevarg="$arg"
+
+ case "$arg" in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+ continue
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: not more than one -exported-symbols argument allowed"
+ exit 1
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -L*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+ # We need an absolute path.
+ case "$dir" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ absdir="$dir"
+ fi
+ dir="$absdir"
+ ;;
+ esac
+ case " $deplibs " in
+ *" $arg "*) ;;
+ *) deplibs="$deplibs $arg";;
+ esac
+ case " $lib_search_path " in
+ *" $dir "*) ;;
+ *) lib_search_path="$lib_search_path $dir";;
+ esac
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2*)
+ dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
+ case ":$dllsearchpath:" in
+ ::) dllsearchpath="$dllsearchdir";;
+ *":$dllsearchdir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
+ esac
+ ;;
+ esac
+ ;;
+
+ -l*)
+ if test "$arg" = "-lc"; then
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+ # These systems don't actually have c library (as such)
+ continue
+ ;;
+ esac
+ elif test "$arg" = "-lm"; then
+ case "$host" in
+ *-*-cygwin* | *-*-beos*)
+ # These systems don't actually have math library (as such)
+ continue
+ ;;
+ esac
+ fi
+ deplibs="$deplibs $arg"
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+ # We need an absolute path.
+ case "$dir" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ continue
+ ;;
+
+ -static)
+ # If we have no pic_flag, then this is the same as -all-static.
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+
+ *.o | *.obj | *.a | *.lib)
+ # A standard object.
+ objs="$objs $arg"
+ ;;
+
+ *.lo)
+ # A library object.
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
+ prev=
+ fi
+ libobjs="$libobjs $arg"
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ dlname=
+ libdir=
+ library_names=
+ old_library=
+
+ # Check to see that this really is a libtool archive.
+ if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variable installed.
+ installed=yes
+
+ # Read the .la file
+ # If there is no directory component, then add one.
+ case "$arg" in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ # Get the name of the library we link against.
+ linklib=
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+
+ if test -z "$linklib"; then
+ $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
+ exit 1
+ fi
+
+ # Find the relevant object directory and library name.
+ name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
+
+ if test "X$installed" = Xyes; then
+ dir="$libdir"
+ else
+ dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$arg"; then
+ dir="$objdir"
+ else
+ dir="$dir/$objdir"
+ fi
+ fi
+
+ if test -n "$dependency_libs"; then
+ # Extract -R and -L from dependency_libs
+ temp_deplibs=
+ for deplib in $dependency_libs; do
+ case "$deplib" in
+ -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ case " $rpath $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) xrpath="$xrpath $temp_xrpath";;
+ esac;;
+ -L*) case "$compile_command $temp_deplibs " in
+ *" $deplib "*) ;;
+ *) temp_deplibs="$temp_deplibs $deplib";;
+ esac
+ temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ case " $lib_search_path " in
+ *" $temp_dir "*) ;;
+ *) lib_search_path="$lib_search_path $temp_dir";;
+ esac
+ ;;
+ *) temp_deplibs="$temp_deplibs $deplib";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ if test -z "$libdir"; then
+ # It is a libtool convenience library, so add in its objects.
+ convenience="$convenience $dir/$old_library"
+ old_convenience="$old_convenience $dir/$old_library"
+ deplibs="$deplibs$dependency_libs"
+ compile_command="$compile_command $dir/$old_library$dependency_libs"
+ finalize_command="$finalize_command $dir/$old_library$dependency_libs"
+ continue
+ fi
+
+ # This library was specified with -dlopen.
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking statically,
+ # we need to preload.
+ prev=dlprefiles
+ else
+ # We should not create a dependency on this library, but we
+ # may need any libraries it requires.
+ compile_command="$compile_command$dependency_libs"
+ finalize_command="$finalize_command$dependency_libs"
+ prev=
+ continue
+ fi
+ fi
+
+ # The library was specified with -dlpreopen.
+ if test "$prev" = dlprefiles; then
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ dlprefiles="$dlprefiles $dir/$old_library"
+ else
+ dlprefiles="$dlprefiles $dir/$linklib"
+ fi
+ prev=
+ fi
+
+ if test -n "$library_names" &&
+ { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+ link_against_libtool_libs="$link_against_libtool_libs $arg"
+ if test -n "$shlibpath_var"; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath " in
+ *" $dir "*) ;;
+ *) temp_rpath="$temp_rpath $dir" ;;
+ esac
+ fi
+
+ # We need an absolute path.
+ case "$dir" in
+ [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ absdir="$dir"
+ fi
+ ;;
+ esac
+
+ # This is the magic to use -rpath.
+ # Skip directories that are in the system default run-time
+ # search path, unless they have been requested with -R.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+
+ lib_linked=yes
+ case "$hardcode_action" in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ compile_command="$compile_command $dir/$linklib"
+ deplibs="$deplibs $dir/$linklib"
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2*)
+ dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
+ if test -n "$dllsearchpath"; then
+ dllsearchpath="$dllsearchpath:$dllsearchdir"
+ else
+ dllsearchpath="$dllsearchdir"
+ fi
+ ;;
+ esac
+ elif test "$hardcode_minus_L" = no; then
+ case "$host" in
+ *-*-sunos*)
+ compile_shlibpath="$compile_shlibpath$dir:"
+ ;;
+ esac
+ case "$compile_command " in
+ *" -L$dir "*) ;;
+ *) compile_command="$compile_command -L$dir";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -L$dir -l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ case ":$compile_shlibpath:" in
+ *":$dir:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$dir:";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+
+ relink)
+ if test "$hardcode_direct" = yes; then
+ compile_command="$compile_command $absdir/$linklib"
+ deplibs="$deplibs $absdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ case "$compile_command " in
+ *" -L$absdir "*) ;;
+ *) compile_command="$compile_command -L$absdir";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -L$absdir -l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case ":$compile_shlibpath:" in
+ *":$absdir:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$absdir:";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+
+ *)
+ lib_linked=no
+ ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ $echo "$modename: configuration error: unsupported hardcode properties"
+ exit 1
+ fi
+
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes; then
+ finalize_command="$finalize_command $libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ case "$finalize_command " in
+ *" -L$libdir "*) ;;
+ *) finalize_command="$finalize_command -L$libdir";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case ":$finalize_shlibpath:" in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ case "$finalize_command " in
+ *" -L$dir "*) ;;
+ *) finalize_command="$finalize_command -L$libdir";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ fi
+ else
+ # Transform directly to old archives if we don't build new libraries.
+ if test -n "$pic_flag" && test -z "$old_library"; then
+ $echo "$modename: cannot find static library for \`$arg'" 1>&2
+ exit 1
+ fi
+
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_command="$compile_command $dir/$linklib"
+ finalize_command="$finalize_command $dir/$linklib"
+ else
+ case "$compile_command " in
+ *" -L$dir "*) ;;
+ *) compile_command="$compile_command -L$dir";;
+ esac
+ compile_command="$compile_command -l$name"
+ case "$finalize_command " in
+ *" -L$dir "*) ;;
+ *) finalize_command="$finalize_command -L$dir";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ fi
+ fi
+
+ # Add in any libraries that this one depends upon.
+ compile_command="$compile_command$dependency_libs"
+ finalize_command="$finalize_command$dependency_libs"
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+ esac
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+ done
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+
+ oldlibs=
+ # calculate the name of the file, without its directory
+ outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+ libobjs_save="$libobjs"
+
+ case "$output" in
+ "")
+ $echo "$modename: you must specify an output file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *.a | *.lib)
+ if test -n "$link_against_libtool_libs"; then
+ $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
+ exit 1
+ fi
+
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+ fi
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ ;;
+
+ *.la)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case "$outputname" in
+ lib*)
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ if test "$module" = no; then
+ $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ eval libname=\"$libname_spec\"
+ else
+ libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ fi
+ ;;
+ esac
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+
+ if test -n "$objs"; then
+ $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
+ exit 1
+ fi
+
+ # How the heck are we supposed to write a wrapper for a shared library?
+ if test -n "$link_against_libtool_libs"; then
+ $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
+ exit 1
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
+ fi
+
+ set dummy $rpath
+ if test $# -gt 2; then
+ $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+ fi
+ install_libdir="$2"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ libext=al
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+ dependency_libs="$deplibs"
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+ fi
+ else
+
+ # Parse the version information argument.
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ IFS="$save_ifs"
+
+ if test -n "$8"; then
+ $echo "$modename: too many parameters to \`-version-info'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ current="$2"
+ revision="$3"
+ age="$4"
+
+ # Check that each of the things are valid numbers.
+ case "$current" in
+ 0 | [1-9] | [1-9][0-9]*) ;;
+ *)
+ $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case "$revision" in
+ 0 | [1-9] | [1-9][0-9]*) ;;
+ *)
+ $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case "$age" in
+ 0 | [1-9] | [1-9][0-9]*) ;;
+ *)
+ $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test $age -gt $current; then
+ $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case "$version_type" in
+ none) ;;
+
+ irix)
+ major=`expr $current - $age + 1`
+ versuffix="$major.$revision"
+ verstring="sgi$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test $loop != 0; do
+ iface=`expr $revision - $loop`
+ loop=`expr $loop - 1`
+ verstring="sgi$major.$iface:$verstring"
+ done
+ ;;
+
+ linux)
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ major=`expr $current - $age`
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test $loop != 0; do
+ iface=`expr $current - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ verstring="$verstring:${current}.0"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current";
+ ;;
+
+ windows)
+ # Like Linux, but with '-' rather than '.', since we only
+ # want one extension on Windows 95.
+ major=`expr $current - $age`
+ versuffix="-$major-$age-$revision"
+ ;;
+
+ *)
+ $echo "$modename: unknown library version type \`$version_type'" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ verstring="0.0"
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+
+ dependency_libs="$deplibs"
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *-*-rhapsody*)
+ # rhapsody is a little odd...
+ deplibs="$deplibs -framework System"
+ ;;
+ *)
+ # Add libc to deplibs on all other systems.
+ deplibs="$deplibs -lc"
+ ;;
+ esac
+ fi
+
+ # Create the output directory, or remove our outputs if we need to.
+ if test -d $output_objdir; then
+ $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
+ $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
+ else
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ status=$?
+ if test $status -ne 0 && test ! -d $output_objdir; then
+ exit $status
+ fi
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+ fi
+
+ if test "$build_libtool_libs" = yes; then
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case "$deplibs_check_method" in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behaviour.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $rm conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $rm conftest
+ $CC -o conftest conftest.c $deplibs
+ if test $? -eq 0 ; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning: This library needs some functionality provided by $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ else
+ # Error occured in the first compile. Let's try to salvage the situation:
+ # Compile a seperate program for each library.
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" ; then
+ $rm conftest
+ $CC -o conftest conftest.c $i
+ # Did it work?
+ if test $? -eq 0 ; then
+ ldd_output=`ldd conftest`
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning: This library needs some functionality provided by $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ fi
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning! Library $i is needed by this library but I was not able to"
+ echo "*** make it link in! You will probably need to install it or some"
+ echo "*** library that it depends on before this library will be fully"
+ echo "*** functional. Installing it before continuing would be even better."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
+ for a_deplib in $deplibs; do
+ name="`expr $a_deplib : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null \
+ | grep " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | sed 's/.* -> //'`
+ case "$potliblink" in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+ | sed 10q \
+ | egrep "$file_magic_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ echo "*** Warning: This library needs some functionality provided by $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+ -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
+ grep . >/dev/null; then
+ echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ fi
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ echo
+ echo "*** Warning: libtool could not satisfy all declared inter-library"
+ echo "*** dependencies of module $libname. Therefore, libtool will create"
+ echo "*** a static module, that should work as long as the dlopening"
+ echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ echo "*** The inter-library dependencies that have been dropped here will be"
+ echo "*** automatically added whenever a program is linked with this library"
+ echo "*** or is declared to -dlopen it."
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ # Get the real and link names of the library.
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ lib="$output_objdir/$realname"
+ for link
+ do
+ linknames="$linknames $link"
+ done
+
+ # Ensure that we have .o objects for linkers which dislike .lo
+ # (e.g. aix) in case we are running --disable-static
+ for obj in $libobjs; do
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+ if test ! -f $xdir/$oldobj; then
+ $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
+ $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
+ fi
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ eval cmds=\"$export_symbols_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex"; then
+ $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+ $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+ $run eval '$mv "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+ fi
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case "$xlib" in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ linkopts="$linkopts $flag"
+ fi
+
+ # Do each of the archive commands.
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval cmds=\"$archive_expsym_cmds\"
+ else
+ eval cmds=\"$archive_cmds\"
+ fi
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ *.lo | *.o | *.obj)
+ if test -n "$link_against_libtool_libs"; then
+ $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
+ exit 1
+ fi
+
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+ fi
+
+ case "$output" in
+ *.lo)
+ if test -n "$objs"; then
+ $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+ exit 1
+ fi
+ libobj="$output"
+ obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $run $rm $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${obj}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case "$xlib" in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ # Create the old-style object.
+ reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
+
+ output="$obj"
+ eval cmds=\"$reload_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ $show "echo timestamp > $libobj"
+ $run eval "echo timestamp > $libobj" || exit $?
+ exit 0
+ fi
+
+ if test -n "$pic_flag"; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ eval cmds=\"$reload_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ else
+ # Just create a symlink.
+ $show $rm $libobj
+ $run $rm $libobj
+ xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$libobj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+ oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+ $show "(cd $xdir && $LN_S $oldobj $baseobj)"
+ $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
+ fi
+
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ ;;
+
+ # Anything else should be a program.
+ *)
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+ fi
+
+ if test "$preload" = yes; then
+ if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
+ test "$dlopen_self_static" = unknown; then
+ $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+ fi
+ fi
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$compile_rpath " in
+ *" $libdir "*) ;;
+ *) compile_rpath="$compile_rpath $libdir" ;;
+ esac
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+
+ # Create the binary in the object directory, then wrap it.
+ if test ! -d $output_objdir; then
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ status=$?
+ if test $status -ne 0 && test ! -d $output_objdir; then
+ exit $status
+ fi
+ fi
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ fi
+
+ dlsyms=
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ dlsyms="${outputname}S.c"
+ else
+ $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+ fi
+ fi
+
+ if test -n "$dlsyms"; then
+ case "$dlsyms" in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${outputname}.nm"
+
+ $show "$rm $nlist ${nlist}S ${nlist}T"
+ $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+ # Parse the name list into a source file.
+ $show "creating $output_objdir/$dlsyms"
+
+ test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ $show "generating symbol list for \`$output'"
+
+ test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ for arg in $progfiles; do
+ $show "extracting global C symbols from \`$arg'"
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$output.exp"
+ $run $rm $export_symbols
+ $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ else
+ $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+ $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+ $run eval 'mv "$nlist"T "$nlist"'
+ fi
+ fi
+
+ for arg in $dlprefiles; do
+ $show "extracting global C symbols from \`$arg'"
+ name=`echo "$arg" | sed -e 's%^.*/%%'`
+ $run eval 'echo ": $name " >> "$nlist"'
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -z "$run"; then
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $mv "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
+ :
+ else
+ grep -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+ else
+ echo '/* NONE */' >> "$output_objdir/$dlsyms"
+ fi
+
+ $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+ sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
+ -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
+ < "$nlist" >> "$output_objdir/$dlsyms"
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ {0, (lt_ptr_t) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ fi
+
+ pic_flag_for_symtable=
+ case "$host" in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
+ esac;;
+ *-*-hpux*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DPIC";;
+ esac
+ esac
+
+ # Now compile the dynamic symbol file.
+ $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+ $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+ # Clean up the generated files.
+ $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+ $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+ # Transform the symbol file into the correct name.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ ;;
+ *)
+ $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+ exit 1
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+ fi
+
+ if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
+ # Replace the output file specification.
+ compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ $show "$link_command"
+ $run eval "$link_command"
+ status=$?
+
+ # Delete the generated files.
+ if test -n "$dlsyms"; then
+ $show "$rm $output_objdir/${outputname}S.${objext}"
+ $run $rm "$output_objdir/${outputname}S.${objext}"
+ fi
+
+ exit $status
+ fi
+
+ if test -n "$shlibpath_var"; then
+ # We should set the shlibpath_var
+ rpath=
+ for dir in $temp_rpath; do
+ case "$dir" in
+ [\\/]* | [A-Za-z]:[\\/]*)
+ # Absolute path.
+ rpath="$rpath$dir:"
+ ;;
+ *)
+ # Relative path: add a thisdir entry.
+ rpath="$rpath\$thisdir/$dir:"
+ ;;
+ esac
+ done
+ temp_rpath="$rpath"
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+ $echo "$modename: \`$output' will be relinked during installation" 1>&2
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+
+ # Now create the wrapper script.
+ $show "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Quote $echo for shipping.
+ if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
+ case "$0" in
+ [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
+ *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
+ esac
+ qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+ else
+ qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if our run command is non-null.
+ if test -z "$run"; then
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
+ esac
+ $rm $output
+ trap "$rm $output; exit 1" 1 2 15
+
+ $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variable:
+ link_against_libtool_libs='$link_against_libtool_libs'
+else
+ # When we are sourced in execute mode, \$file and \$echo are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ echo=\"$qecho\"
+ file=\"\$0\"
+ # Make sure echo works.
+ if test \"X\$1\" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+ # Yippee, \$echo works!
+ :
+ else
+ # Restart under the correct shell, and then maybe \$echo will work.
+ exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+ fi
+ fi\
+"
+ $echo >> $output "\
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
+ done
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ echo >> $output "\
+ program=lt-'$outputname'
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" || \\
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $mkdir \"\$progdir\"
+ else
+ $rm \"\$progdir/\$file\"
+ fi"
+
+ echo >> $output "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if (cd \"\$thisdir\" && eval \$relink_command); then :
+ else
+ $rm \"\$progdir/\$file\"
+ exit 1
+ fi
+ fi
+
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $rm \"\$progdir/\$program\";
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $rm \"\$progdir/\$file\"
+ fi"
+ else
+ echo >> $output "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ echo >> $output "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $echo >> $output "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ # fixup the dll searchpath if we need to.
+ if test -n "$dllsearchpath"; then
+ $echo >> $output "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $echo >> $output "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+"
+ case $host in
+ # win32 systems need to use the prog path for dll
+ # lookup to work
+ *-*-cygwin*)
+ $echo >> $output "\
+ exec \$progdir/\$program \${1+\"\$@\"}
+"
+ ;;
+
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2*)
+ $echo >> $output "\
+ exec \$progdir\\\\\$program \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $echo >> $output "\
+ # Export the path to the program.
+ PATH=\"\$progdir:\$PATH\"
+ export PATH
+
+ exec \$program \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $echo >> $output "\
+ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+ exit 1
+ fi
+ else
+ # The program doesn't exist.
+ \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
+ \$echo \"This script is just a wrapper for \$program.\" 1>&2
+ echo \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit 1
+ fi
+fi\
+"
+ chmod +x $output
+ fi
+ exit 0
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ # Add in members from convenience archives.
+ for xlib in $addlibs; do
+ # Extract the objects.
+ case "$xlib" in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ eval cmds=\"$old_archive_from_new_cmds\"
+ else
+ # Ensure that we have .o objects in place in case we decided
+ # not to build a shared library, and have fallen back to building
+ # static libs even though --disable-static was passed!
+ for oldobj in $oldobjs; do
+ if test ! -f $oldobj; then
+ xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$oldobj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
+ obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+ $show "(cd $xdir && ${LN_S} $obj $baseobj)"
+ $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
+ fi
+ done
+
+ eval cmds=\"$old_archive_cmds\"
+ fi
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$generated"; then
+ $show "${rm}r$generated"
+ $run ${rm}r$generated
+ fi
+
+ # Now create the libtool archive.
+ case "$output" in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ $show "creating $output"
+
+ if test -n "$xrpath"; then
+ temp_xrpath=
+ for libdir in $xrpath; do
+ temp_xrpath="$temp_xrpath -R$libdir"
+ done
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+
+ # Only create the output if not a dry run.
+ if test -z "$run"; then
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ fi
+ $rm $output
+ $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$dlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'\
+"
+ done
+ fi
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+ $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
+ ;;
+ esac
+ exit 0
+ ;;
+
+ # libtool install mode
+ install)
+ modename="$modename: install"
+
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
+ # Aesthetically quote it.
+ arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$arg "
+ arg="$1"
+ shift
+ else
+ install_prog=
+ arg="$nonopt"
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog$arg"
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ for arg
+ do
+ if test -n "$dest"; then
+ files="$files $dest"
+ dest="$arg"
+ continue
+ fi
+
+ case "$arg" in
+ -d) isdir=yes ;;
+ -f) prev="-f" ;;
+ -g) prev="-g" ;;
+ -m) prev="-m" ;;
+ -o) prev="-o" ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*) ;;
+
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ prev=
+ else
+ dest="$arg"
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog $arg"
+ done
+
+ if test -z "$install_prog"; then
+ $echo "$modename: you must specify an install program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prev' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ $echo "$modename: no file or destination specified" 1>&2
+ else
+ $echo "$modename: you must specify a destination" 1>&2
+ fi
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Strip any trailing slash from the destination.
+ dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$destdir" = "X$dest" && destdir=.
+ destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files
+ if test $# -gt 2; then
+ $echo "$modename: \`$dest' is not a directory" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ fi
+ case "$destdir" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case "$file" in
+ *.lo) ;;
+ *)
+ $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case "$file" in
+ *.a | *.lib)
+ # Do the static libraries later.
+ staticlibs="$staticlibs $file"
+ ;;
+
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ library_names=
+ old_library=
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) current_libdirs="$current_libdirs $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) future_libdirs="$future_libdirs $libdir" ;;
+ esac
+ fi
+
+ dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
+ test "X$dir" = "X$file/" && dir=
+ dir="$dir$objdir"
+
+ # See the names of the shared library.
+ set dummy $library_names
+ if test -n "$2"; then
+ realname="$2"
+ shift
+ shift
+
+ # Install the shared library and build the symlinks.
+ $show "$install_prog $dir/$realname $destdir/$realname"
+ $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
+
+ if test $# -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ for linkname
+ do
+ if test "$linkname" != "$realname"; then
+ $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ fi
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ eval cmds=\"$postinstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Install the pseudo-library for information purposes.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ instname="$dir/$name"i
+ $show "$install_prog $instname $destdir/$name"
+ $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case "$destfile" in
+ *.lo)
+ staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+ ;;
+ *.o | *.obj)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ if test -n "$destfile"; then
+ $show "$install_prog $file $destfile"
+ $run eval "$install_prog $file $destfile" || exit $?
+ fi
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+ $show "$install_prog $staticobj $staticdest"
+ $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+ fi
+ exit 0
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Do a test to see if this is really a libtool program.
+ if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ link_against_libtool_libs=
+ relink_command=
+
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Check the variables that should have been set.
+ if test -z "$link_against_libtool_libs"; then
+ $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
+ exit 1
+ fi
+
+ finalize=yes
+ for lib in $link_against_libtool_libs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ # If there is no directory component, then add one.
+ case "$lib" in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ fi
+ libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+ finalize=no
+ fi
+ done
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ if test "$finalize" = yes && test -z "$run"; then
+ tmpdir="/tmp"
+ test -n "$TMPDIR" && tmpdir="$TMPDIR"
+ tmpdir="$tmpdir/libtool-$$"
+ if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
+ else
+ $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
+ continue
+ fi
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ ${rm}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ $echo "$modename: warning: cannot relink \`$file'" 1>&2
+ fi
+ else
+ # Install the binary that we compiled earlier.
+ file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ $show "$install_prog$stripme $file $destfile"
+ $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+ test -n "$outputname" && ${rm}r "$tmpdir"
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ $show "$install_prog $file $oldlib"
+ $run eval "$install_prog \$file \$oldlib" || exit $?
+
+ # Do each command in the postinstall commands.
+ eval cmds=\"$old_postinstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$future_libdirs"; then
+ $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+ fi
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ test -n "$run" && current_libdirs=" -n$current_libdirs"
+ exec $SHELL $0 --finish$current_libdirs
+ exit 1
+ fi
+
+ exit 0
+ ;;
+
+ # libtool finish mode
+ finish)
+ modename="$modename: finish"
+ libdirs="$nonopt"
+ admincmds=
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for dir
+ do
+ libdirs="$libdirs $dir"
+ done
+
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ eval cmds=\"$finish_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || admincmds="$admincmds
+ $cmd"
+ done
+ IFS="$save_ifs"
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $run eval "$cmds" || admincmds="$admincmds
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ test "$show" = : && exit 0
+
+ echo "----------------------------------------------------------------------"
+ echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ echo " $libdir"
+ done
+ echo
+ echo "If you ever happen to want to link against installed libraries"
+ echo "in a given directory, LIBDIR, you must either use libtool, and"
+ echo "specify the full pathname of the library, or use \`-LLIBDIR'"
+ echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ echo " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ echo " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ echo
+ echo "See any operating system documentation about shared libraries for"
+ echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ echo "----------------------------------------------------------------------"
+ exit 0
+ ;;
+
+ # libtool execute mode
+ execute)
+ modename="$modename: execute"
+
+ # The first argument is the command name.
+ cmd="$nonopt"
+ if test -z "$cmd"; then
+ $echo "$modename: you must specify a COMMAND" 1>&2
+ $echo "$help"
+ exit 1
+ fi
+
+ # Handle -dlopen flags immediately.
+ for file in $execute_dlfiles; do
+ if test ! -f "$file"; then
+ $echo "$modename: \`$file' is not a file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ dir=
+ case "$file" in
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+
+ if test -f "$dir/$objdir/$dlname"; then
+ dir="$dir/$objdir"
+ else
+ $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+ exit 1
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ ;;
+
+ *)
+ $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case "$file" in
+ -*) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+ args="$args \"$file\""
+ done
+
+ if test -z "$run"; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved enviroment variables
+ if test "${save_LC_ALL+set}" = set; then
+ LC_ALL="$save_LC_ALL"; export LC_ALL
+ fi
+ if test "${save_LANG+set}" = set; then
+ LANG="$save_LANG"; export LANG
+ fi
+
+ # Now actually exec the command.
+ eval "exec \$cmd$args"
+
+ $echo "$modename: cannot exec \$cmd$args"
+ exit 1
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+ $echo "export $shlibpath_var"
+ fi
+ $echo "$cmd$args"
+ exit 0
+ fi
+ ;;
+
+ # libtool uninstall mode
+ uninstall)
+ modename="$modename: uninstall"
+ rm="$nonopt"
+ files=
+
+ for arg
+ do
+ case "$arg" in
+ -*) rm="$rm $arg" ;;
+ *) files="$files $arg" ;;
+ esac
+ done
+
+ if test -z "$rm"; then
+ $echo "$modename: you must specify an RM program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ for file in $files; do
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ rmfiles="$file"
+
+ case "$name" in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ . $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ rmfiles="$rmfiles $dir/$n"
+ done
+ test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
+
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
+
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ eval cmds=\"$postuninstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ eval cmds=\"$old_postuninstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ done
+ IFS="$save_ifs"
+ fi
+
+ # FIXME: should reinstall the best remaining shared library.
+ fi
+ ;;
+
+ *.lo)
+ if test "$build_old_libs" = yes; then
+ oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
+ rmfiles="$rmfiles $dir/$oldobj"
+ fi
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
+ ;;
+
+ *)
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
+ ;;
+ esac
+ done
+ exit 0
+ ;;
+
+ "")
+ $echo "$modename: you must specify a MODE" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+fi # test -z "$show_help"
+
+# We need to display help for each of the modes.
+case "$mode" in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+ --config show all configuration variables
+ --debug enable verbose shell tracing
+-n, --dry-run display commands without modifying any files
+ --features display basic configuration information and exit
+ --finish same as \`--mode=finish'
+ --help display this help message and exit
+ --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
+ --quiet same as \`--silent'
+ --silent don't print informational messages
+ --version print version information
+
+MODE must be one of the following:
+
+ compile compile a source file into a libtool object
+ execute automatically set library path, then run a program
+ finish complete the installation of libtool libraries
+ install install libraries or executables
+ link create a library or an executable
+ uninstall remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE."
+ exit 0
+ ;;
+
+compile)
+ $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -static always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+execute)
+ $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+finish)
+ $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+install)
+ $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+link)
+ $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -static do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+uninstall)
+ $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+*)
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+esac
+
+echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/contrib/idn/mdnkit/ltconfig b/contrib/idn/mdnkit/ltconfig
new file mode 100755
index 00000000..c14d83c1
--- /dev/null
+++ b/contrib/idn/mdnkit/ltconfig
@@ -0,0 +1,3114 @@
+#! /bin/sh
+
+# ltconfig - Create a system-specific libtool.
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A lot of this script is taken from autoconf-2.10.
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+echo=echo
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell.
+ exec "$SHELL" "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# Find the correct PATH separator. Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+ UNAME=${UNAME-`uname 2>/dev/null`}
+ case X$UNAME in
+ *-DOS) PATH_SEPARATOR=';' ;;
+ *) PATH_SEPARATOR=':' ;;
+ esac
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test "X${echo_test_string+set}" != Xset; then
+ # find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+ echo_test_string="`eval $cmd`" &&
+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then
+ break
+ fi
+ done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" != 'X\t' ||
+ test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for dir in $PATH /usr/ucb; do
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ echo="$dir/echo"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+
+ if test "X$echo" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ echo='print -r'
+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running ltconfig again with it.
+ ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}"
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"}
+ else
+ # Try using printf.
+ echo='printf "%s\n"'
+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL"
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "$0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ echo=echo
+ fi
+ fi
+ fi
+ fi
+fi
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# The name of this program.
+progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'`
+
+# Constants:
+PROGRAM=ltconfig
+PACKAGE=libtool
+VERSION=1.3.5
+TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+rm="rm -f"
+
+help="Try \`$progname --help' for more information."
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+enable_shared=yes
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+enable_static=yes
+enable_fast_install=yes
+enable_dlopen=unknown
+enable_win32_dll=no
+ltmain=
+silent=
+srcdir=
+ac_config_guess=
+ac_config_sub=
+host=
+nonopt=
+ofile="$default_ofile"
+verify_host=yes
+with_gcc=no
+with_gnu_ld=no
+need_locks=yes
+ac_ext=c
+objext=o
+libext=a
+exeext=
+cache_file=
+
+old_AR="$AR"
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+old_CPPFLAGS="$CPPFLAGS"
+old_LDFLAGS="$LDFLAGS"
+old_LD="$LD"
+old_LN_S="$LN_S"
+old_LIBS="$LIBS"
+old_NM="$NM"
+old_RANLIB="$RANLIB"
+old_DLLTOOL="$DLLTOOL"
+old_OBJDUMP="$OBJDUMP"
+old_AS="$AS"
+
+# Parse the command line options.
+args=
+prev=
+for option
+do
+ case "$option" in
+ -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ eval "$prev=\$option"
+ prev=
+ continue
+ fi
+
+ case "$option" in
+ --help) cat <<EOM
+Usage: $progname [OPTION]... [HOST [LTMAIN]]
+
+Generate a system-specific libtool script.
+
+ --debug enable verbose shell tracing
+ --disable-shared do not build shared libraries
+ --disable-static do not build static libraries
+ --disable-fast-install do not optimize for fast installation
+ --enable-dlopen enable dlopen support
+ --enable-win32-dll enable building dlls on win32 hosts
+ --help display this help and exit
+ --no-verify do not verify that HOST is a valid host type
+-o, --output=FILE specify the output file [default=$default_ofile]
+ --quiet same as \`--silent'
+ --silent do not print informational messages
+ --srcdir=DIR find \`config.guess' in DIR
+ --version output version information and exit
+ --with-gcc assume that the GNU C compiler will be used
+ --with-gnu-ld assume that the C compiler uses the GNU linker
+ --disable-lock disable file locking
+ --cache-file=FILE configure cache file
+
+LTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program
+that provides basic libtool functionality.
+
+HOST is the canonical host system name [default=guessed].
+EOM
+ exit 0
+ ;;
+
+ --debug)
+ echo "$progname: enabling shell trace mode"
+ set -x
+ ;;
+
+ --disable-shared) enable_shared=no ;;
+
+ --disable-static) enable_static=no ;;
+
+ --disable-fast-install) enable_fast_install=no ;;
+
+ --enable-dlopen) enable_dlopen=yes ;;
+
+ --enable-win32-dll) enable_win32_dll=yes ;;
+
+ --quiet | --silent) silent=yes ;;
+
+ --srcdir) prev=srcdir ;;
+ --srcdir=*) srcdir="$optarg" ;;
+
+ --no-verify) verify_host=no ;;
+
+ --output | -o) prev=ofile ;;
+ --output=*) ofile="$optarg" ;;
+
+ --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"; exit 0 ;;
+
+ --with-gcc) with_gcc=yes ;;
+ --with-gnu-ld) with_gnu_ld=yes ;;
+
+ --disable-lock) need_locks=no ;;
+
+ --cache-file=*) cache_file="$optarg" ;;
+
+ -*)
+ echo "$progname: unrecognized option \`$option'" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *)
+ if test -z "$ltmain"; then
+ ltmain="$option"
+ elif test -z "$host"; then
+# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
+# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then
+# echo "$progname: warning \`$option' is not a valid host type" 1>&2
+# fi
+ host="$option"
+ else
+ echo "$progname: too many arguments" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi ;;
+ esac
+done
+
+if test -z "$ltmain"; then
+ echo "$progname: you must specify a LTMAIN file" 1>&2
+ echo "$help" 1>&2
+ exit 1
+fi
+
+if test ! -f "$ltmain"; then
+ echo "$progname: \`$ltmain' does not exist" 1>&2
+ echo "$help" 1>&2
+ exit 1
+fi
+
+# Quote any args containing shell metacharacters.
+ltconfig_args=
+for arg
+do
+ case "$arg" in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ltconfig_args="$ltconfig_args '$arg'" ;;
+ *) ltconfig_args="$ltconfig_args $arg" ;;
+ esac
+done
+
+# A relevant subset of AC_INIT.
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 5 compiler messages saved in config.log
+# 6 checking for... messages and results
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>>./config.log
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi
+if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi
+
+if test -n "$cache_file" && test -r "$cache_file"; then
+ echo "loading cache $cache_file within ltconfig"
+ . $cache_file
+fi
+
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+if test -z "$srcdir"; then
+ # Assume the source directory is the same one as the path to LTMAIN.
+ srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'`
+ test "$srcdir" = "$ltmain" && srcdir=.
+fi
+
+trap "$rm conftest*; exit 1" 1 2 15
+if test "$verify_host" = yes; then
+ # Check for config.guess and config.sub.
+ ac_aux_dir=
+ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/config.guess; then
+ ac_aux_dir=$ac_dir
+ break
+ fi
+ done
+ if test -z "$ac_aux_dir"; then
+ echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi
+ ac_config_guess=$ac_aux_dir/config.guess
+ ac_config_sub=$ac_aux_dir/config.sub
+
+ # Make sure we can run config.sub.
+ if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then :
+ else
+ echo "$progname: cannot run $ac_config_sub" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi
+
+ echo $ac_n "checking host system type""... $ac_c" 1>&6
+
+ host_alias=$host
+ case "$host_alias" in
+ "")
+ if host_alias=`$SHELL $ac_config_guess`; then :
+ else
+ echo "$progname: cannot guess host type; you must specify one" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi ;;
+ esac
+ host=`$SHELL $ac_config_sub $host_alias`
+ echo "$ac_t$host" 1>&6
+
+ # Make sure the host verified.
+ test -z "$host" && exit 1
+
+elif test -z "$host"; then
+ echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
+ echo "$help" 1>&2
+ exit 1
+else
+ host_alias=$host
+fi
+
+# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+case "$host_os" in
+linux-gnu*) ;;
+linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+case "$host_os" in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR cru $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+# Set a sane default for `AR'.
+test -z "$AR" && AR=ar
+
+# Set a sane default for `OBJDUMP'.
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+# If RANLIB is not set, then run the test.
+if test "${RANLIB+set}" != "set"; then
+ result=no
+
+ echo $ac_n "checking for ranlib... $ac_c" 1>&6
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for dir in $PATH; do
+ test -z "$dir" && dir=.
+ if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then
+ RANLIB="ranlib"
+ result="ranlib"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+
+ echo "$ac_t$result" 1>&6
+fi
+
+if test -n "$RANLIB"; then
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+ old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+fi
+
+# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin.
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$AS" && AS=as
+
+# Check to see if we are using GCC.
+if test "$with_gcc" != yes || test -z "$CC"; then
+ # If CC is not set, then try to find GCC or a usable CC.
+ if test -z "$CC"; then
+ echo $ac_n "checking for gcc... $ac_c" 1>&6
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for dir in $PATH; do
+ test -z "$dir" && dir=.
+ if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then
+ CC="gcc"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+
+ if test -n "$CC"; then
+ echo "$ac_t$CC" 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+ fi
+
+ # Not "gcc", so try "cc", rejecting "/usr/ucb/cc".
+ if test -z "$CC"; then
+ echo $ac_n "checking for cc... $ac_c" 1>&6
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ cc_rejected=no
+ for dir in $PATH; do
+ test -z "$dir" && dir=.
+ if test -f $dir/cc || test -f $dir/cc$ac_exeext; then
+ if test "$dir/cc" = "/usr/ucb/cc"; then
+ cc_rejected=yes
+ continue
+ fi
+ CC="cc"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+ if test $cc_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same name, so the bogon will be chosen
+ # first if we set CC to just the name; use the full file name.
+ shift
+ set dummy "$dir/cc" "$@"
+ shift
+ CC="$@"
+ fi
+ fi
+
+ if test -n "$CC"; then
+ echo "$ac_t$CC" 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+
+ if test -z "$CC"; then
+ echo "$progname: error: no acceptable cc found in \$PATH" 1>&2
+ exit 1
+ fi
+ fi
+
+ # Now see if the compiler is really GCC.
+ with_gcc=no
+ echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6
+ echo "$progname:581: checking whether we are using GNU C" >&5
+
+ $rm conftest.c
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+ if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ with_gcc=yes
+ fi
+ $rm conftest.c
+ echo "$ac_t$with_gcc" 1>&6
+fi
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler="$2"
+
+echo $ac_n "checking for object suffix... $ac_c" 1>&6
+$rm conftest*
+echo 'int i = 1;' > conftest.c
+echo "$progname:603: checking for object suffix" >& 5
+if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
+ # Append any warnings to the config.log.
+ cat conftest.err 1>&5
+
+ for ac_file in conftest.*; do
+ case $ac_file in
+ *.c) ;;
+ *) objext=`echo $ac_file | sed -e s/conftest.//` ;;
+ esac
+ done
+else
+ cat conftest.err 1>&5
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+fi
+$rm conftest*
+echo "$ac_t$objext" 1>&6
+
+echo $ac_n "checking for executable suffix... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_exeext="no"
+ $rm conftest*
+ echo 'main () { return 0; }' > conftest.c
+ echo "$progname:629: checking for executable suffix" >& 5
+ if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then
+ # Append any warnings to the config.log.
+ cat conftest.err 1>&5
+
+ for ac_file in conftest.*; do
+ case $ac_file in
+ *.c | *.err | *.$objext ) ;;
+ *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;;
+ esac
+ done
+ else
+ cat conftest.err 1>&5
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+ fi
+ $rm conftest*
+fi
+if test "X$ac_cv_exeext" = Xno; then
+ exeext=""
+else
+ exeext="$ac_cv_exeext"
+fi
+echo "$ac_t$ac_cv_exeext" 1>&6
+
+echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
+pic_flag=
+special_shlib_compile_flags=
+wl=
+link_static_flag=
+no_builtin_flag=
+
+if test "$with_gcc" = yes; then
+ wl='-Wl,'
+ link_static_flag='-static'
+
+ case "$host_os" in
+ beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ aix*)
+ # Below there is a dirty hack to force normal static linking with -ldl
+ # The problem is because libdl dynamically linked with both libc and
+ # libC (AIX C++ library), which obviously doesn't included in libraries
+ # list by gcc. This cause undefined symbols with -static flags.
+ # This hack allows C programs to be linked with "-static -ldl", but
+ # we not sure about C++ programs.
+ link_static_flag="$link_static_flag ${wl}-lC"
+ ;;
+ cygwin* | mingw* | os2*)
+ # We can build DLLs from non-PIC.
+ ;;
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ pic_flag='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ pic_flag=-Kconform_pic
+ fi
+ ;;
+ *)
+ pic_flag='-fPIC'
+ ;;
+ esac
+else
+ # PORTME Check for PIC flags for the system compiler.
+ case "$host_os" in
+ aix3* | aix4*)
+ # All AIX code is PIC.
+ link_static_flag='-bnso -bI:/lib/syscalls.exp'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ # Is there a better link_static_flag that works with the bundled CC?
+ wl='-Wl,'
+ link_static_flag="${wl}-a ${wl}archive"
+ pic_flag='+Z'
+ ;;
+
+ irix5* | irix6*)
+ wl='-Wl,'
+ link_static_flag='-non_shared'
+ # PIC (with -KPIC) is the default.
+ ;;
+
+ cygwin* | mingw* | os2*)
+ # We can build DLLs from non-PIC.
+ ;;
+
+ osf3* | osf4* | osf5*)
+ # All OSF/1 code is PIC.
+ wl='-Wl,'
+ link_static_flag='-non_shared'
+ ;;
+
+ sco3.2v5*)
+ pic_flag='-Kpic'
+ link_static_flag='-dn'
+ special_shlib_compile_flags='-belf'
+ ;;
+
+ solaris*)
+ pic_flag='-KPIC'
+ link_static_flag='-Bstatic'
+ wl='-Wl,'
+ ;;
+
+ sunos4*)
+ pic_flag='-PIC'
+ link_static_flag='-Bstatic'
+ wl='-Qoption ld '
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ pic_flag='-KPIC'
+ link_static_flag='-Bstatic'
+ wl='-Wl,'
+ ;;
+
+ uts4*)
+ pic_flag='-pic'
+ link_static_flag='-Bstatic'
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ pic_flag='-Kconform_pic'
+ link_static_flag='-Bstatic'
+ fi
+ ;;
+ *)
+ can_build_shared=no
+ ;;
+ esac
+fi
+
+if test -n "$pic_flag"; then
+ echo "$ac_t$pic_flag" 1>&6
+
+ # Check to make sure the pic_flag actually works.
+ echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6
+ $rm conftest*
+ echo "int some_variable = 0;" > conftest.c
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $pic_flag -DPIC"
+ echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5
+ if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
+ # Append any warnings to the config.log.
+ cat conftest.err 1>&5
+
+ case "$host_os" in
+ hpux9* | hpux10* | hpux11*)
+ # On HP-UX, both CC and GCC only warn that PIC is supported... then they
+ # create non-PIC objects. So, if there were any warnings, we assume that
+ # PIC is not supported.
+ if test -s conftest.err; then
+ echo "$ac_t"no 1>&6
+ can_build_shared=no
+ pic_flag=
+ else
+ echo "$ac_t"yes 1>&6
+ pic_flag=" $pic_flag"
+ fi
+ ;;
+ *)
+ echo "$ac_t"yes 1>&6
+ pic_flag=" $pic_flag"
+ ;;
+ esac
+ else
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ can_build_shared=no
+ pic_flag=
+ echo "$ac_t"no 1>&6
+ fi
+ CFLAGS="$save_CFLAGS"
+ $rm conftest*
+else
+ echo "$ac_t"none 1>&6
+fi
+
+# Check to see if options -o and -c are simultaneously supported by compiler
+echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6
+$rm -r conftest 2>/dev/null
+mkdir conftest
+cd conftest
+$rm conftest*
+echo "int some_variable = 0;" > conftest.c
+mkdir out
+# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+# that will create temporary files in the current directory regardless of
+# the output directory. Thus, making CWD read-only will cause this test
+# to fail, enabling locking or at least warning the user not to do parallel
+# builds.
+chmod -w .
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -o out/conftest2.o"
+echo "$progname:829: checking if $compiler supports -c -o file.o" >&5
+if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then
+
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s out/conftest.err; then
+ echo "$ac_t"no 1>&6
+ compiler_c_o=no
+ else
+ echo "$ac_t"yes 1>&6
+ compiler_c_o=yes
+ fi
+else
+ # Append any errors to the config.log.
+ cat out/conftest.err 1>&5
+ compiler_c_o=no
+ echo "$ac_t"no 1>&6
+fi
+CFLAGS="$save_CFLAGS"
+chmod u+w .
+$rm conftest* out/*
+rmdir out
+cd ..
+rmdir conftest
+$rm -r conftest 2>/dev/null
+
+if test x"$compiler_c_o" = x"yes"; then
+ # Check to see if we can write to a .lo
+ echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6
+ $rm conftest*
+ echo "int some_variable = 0;" > conftest.c
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -c -o conftest.lo"
+ echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5
+if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then
+
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ echo "$ac_t"no 1>&6
+ compiler_o_lo=no
+ else
+ echo "$ac_t"yes 1>&6
+ compiler_o_lo=yes
+ fi
+ else
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ compiler_o_lo=no
+ echo "$ac_t"no 1>&6
+ fi
+ CFLAGS="$save_CFLAGS"
+ $rm conftest*
+else
+ compiler_o_lo=no
+fi
+
+# Check to see if we can do hard links to lock some files if needed
+hard_links="nottested"
+if test "$compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ echo "$ac_t$hard_links" 1>&6
+ $rm conftest*
+ if test "$hard_links" = no; then
+ echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+if test "$with_gcc" = yes; then
+ # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+ echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6
+ $rm conftest*
+ echo "int some_variable = 0;" > conftest.c
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c"
+ echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+ if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
+
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ echo "$ac_t"no 1>&6
+ compiler_rtti_exceptions=no
+ else
+ echo "$ac_t"yes 1>&6
+ compiler_rtti_exceptions=yes
+ fi
+ else
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ compiler_rtti_exceptions=no
+ echo "$ac_t"no 1>&6
+ fi
+ CFLAGS="$save_CFLAGS"
+ $rm conftest*
+
+ if test "$compiler_rtti_exceptions" = "yes"; then
+ no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
+ else
+ no_builtin_flag=' -fno-builtin'
+ fi
+
+fi
+
+# Check for any special shared library compilation flags.
+if test -n "$special_shlib_compile_flags"; then
+ echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
+ if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then :
+ else
+ echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2
+ can_build_shared=no
+ fi
+fi
+
+echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6
+$rm conftest*
+echo 'main(){return(0);}' > conftest.c
+save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS $link_static_flag"
+echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5
+if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ echo "$ac_t$link_static_flag" 1>&6
+else
+ echo "$ac_t"none 1>&6
+ link_static_flag=
+fi
+LDFLAGS="$save_LDFLAGS"
+$rm conftest*
+
+if test -z "$LN_S"; then
+ # Check to see if we can use ln -s, or we need hard links.
+ echo $ac_n "checking whether ln -s works... $ac_c" 1>&6
+ $rm conftest.dat
+ if ln -s X conftest.dat 2>/dev/null; then
+ $rm conftest.dat
+ LN_S="ln -s"
+ else
+ LN_S=ln
+ fi
+ if test "$LN_S" = "ln -s"; then
+ echo "$ac_t"yes 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+fi
+
+# Make sure LD is an absolute path.
+if test -z "$LD"; then
+ ac_prog=ld
+ if test "$with_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6
+ echo "$progname:991: checking for ld used by GCC" >&5
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we are not using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+ elif test "$with_gnu_ld" = yes; then
+ echo $ac_n "checking for GNU ld... $ac_c" 1>&6
+ echo "$progname:1015: checking for GNU ld" >&5
+ else
+ echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+ echo "$progname:1018: checking for non-GNU ld" >&5
+ fi
+
+ if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ fi
+
+ if test -n "$LD"; then
+ echo "$ac_t$LD" 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+
+ if test -z "$LD"; then
+ echo "$progname: error: no acceptable ld found in \$PATH" 1>&2
+ exit 1
+ fi
+fi
+
+# Check to see if it really is or is not GNU ld.
+echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6
+# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+echo "$ac_t$with_gnu_ld" 1>&6
+
+# See if the linker supports building shared libraries.
+echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
+
+allow_undefined_flag=
+no_undefined_flag=
+need_lib_prefix=unknown
+need_version=unknown
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+archive_cmds=
+archive_expsym_cmds=
+old_archive_from_new_cmds=
+export_dynamic_flag_spec=
+whole_archive_flag_spec=
+thread_safe_flag_spec=
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by ` (' and `)$', so one must not match beginning or
+# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+# platforms (ab)use it in PIC code, but their linkers get confused if
+# the symbol is explicitly referenced. Since portable code cannot
+# rely on this symbol name, it's probably fine to never include it in
+# preloaded symbol tables.
+
+case "$host_os" in
+cygwin* | mingw*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$with_gcc" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # See if GNU ld supports shared libraries.
+ case "$host_os" in
+ aix3* | aix4*)
+ # On AIX, the GNU linker is very broken
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can use
+ # them.
+ ld_shlibs=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw*)
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+
+ # Extract the symbol export list from an `--export-all' def file,
+ # then regenerate the def file from the symbol export list, so that
+ # the compiled dll only exports the symbol export list.
+ # Be careful not to strip the DATA tag left by newer dlltools.
+ export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
+ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
+ $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~
+ sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols'
+
+ # If DATA tags from a recent dlltool are present, honour them!
+ archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~
+ _lt_hint=1;
+ cat $export_symbols | while read symbol; do
+ set dummy \$symbol;
+ case \$# in
+ 2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;;
+ *) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;;
+ esac;
+ _lt_hint=`expr 1 + \$_lt_hint`;
+ done~
+ test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
+ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
+ $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
+ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
+ $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
+ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
+ $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts'
+
+ old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a'
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib'
+ # can we support soname and/or expsyms with a.out? -oliva
+ fi
+ ;;
+
+ solaris* | sysv5*)
+ if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = yes; then
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ case $host_os in
+ cygwin* | mingw*)
+ # dlltool doesn't understand --whole-archive et. al.
+ whole_archive_flag_spec=
+ ;;
+ *)
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ ;;
+ esac
+ fi
+else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case "$host_os" in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$with_gcc" = yes && test -z "$link_static_flag"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix4*)
+ hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib'
+ hardcode_libdir_separator=':'
+ if test "$with_gcc" = yes; then
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct=yes
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ shared_flag='-shared'
+ else
+ shared_flag='${wl}-bM:SRE'
+ hardcode_direct=yes
+ fi
+ allow_undefined_flag=' ${wl}-berok'
+ archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
+ archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}'
+ case "$host_os" in aix4.[01]|aix4.[01].*)
+ # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
+ always_export_symbols=yes ;;
+ esac
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+
+ cygwin* | mingw*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib /OUT:$oldlib$oldobjs'
+ fix_srcfile_path='`cygpath -w $srcfile`'
+ ;;
+
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd*)
+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ case "$host_os" in
+ hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;;
+ *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;;
+ esac
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_minus_L=yes # Not in the search PATH, but as the default
+ # location of the library.
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ irix5* | irix6*)
+ if test "$with_gcc" = yes; then
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+ else
+ archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF
+ fi
+ hardcode_libdir_flag_spec='${wl}-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ openbsd*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$with_gcc" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # As osf3* with the addition of the -msym flag
+ if test "$with_gcc" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ rhapsody*)
+ archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flags_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sco3.2v5*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z text'
+ # $CC -shared without GNU ld will not create a library from C++
+ # object files and a static libstdc++, better avoid it by now
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case "$host_os" in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $linkopts'
+ else
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ fi
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv5*)
+ no_undefined_flag=' -z text'
+ # $CC -shared without GNU ld will not create a library from C++
+ # object files and a static libstdc++, better avoid it by now
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
+ hardcode_libdir_flag_spec=
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4.2uw2*)
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts'
+ hardcode_direct=yes
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=no
+ hardcode_runpath_var=yes
+ runpath_var=LD_RUN_PATH
+ ;;
+
+ unixware7*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+fi
+echo "$ac_t$ld_shlibs" 1>&6
+test "$ld_shlibs" = no && can_build_shared=no
+
+if test -z "$NM"; then
+ echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
+ case "$NM" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path.
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ NM="$ac_dir/nm -B"
+ break
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ NM="$ac_dir/nm -p"
+ break
+ else
+ NM=${NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$NM" && NM=nm
+ ;;
+ esac
+ echo "$ac_t$NM" 1>&6
+fi
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+
+# Define system-specific variables.
+case "$host_os" in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*) # Its linker distinguishes data from code symbols
+ global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
+ ;;
+irix*)
+ symcode='[BCDEGRST]'
+ ;;
+solaris*)
+ symcode='[BDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+ symcode='[ABCDGISTW]'
+fi
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Write the raw and C identifiers.
+ global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+ $rm conftest*
+ cat > conftest.c <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+ echo "$progname:1653: checking if global_symbol_pipe works" >&5
+ if { (eval echo $progname:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { echo "$progname:1657: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
+
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+ if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<EOF > conftest.c
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+ # Now generate the symbol file.
+ eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c'
+
+ cat <<EOF >> conftest.c
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+ sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c
+ cat <<\EOF >> conftest.c
+ {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+ # Now try linking the two files.
+ mv conftest.$objext conftstm.$objext
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$objext"
+ CFLAGS="$CFLAGS$no_builtin_flag"
+ if { (eval echo $progname:1709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ pipe_works=yes
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+ fi
+ LIBS="$save_LIBS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+ fi
+ $rm conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ global_symbol_pipe=
+ fi
+done
+if test "$pipe_works" = yes; then
+ echo "${ac_t}ok" 1>&6
+else
+ echo "${ac_t}failed" 1>&6
+fi
+
+if test -z "$global_symbol_pipe"; then
+ global_symbol_to_cdecl=
+fi
+
+# Check hardcoding attributes.
+echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+ test -n "$runpath_var"; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$hardcode_shlibpath_var" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+echo "$ac_t$hardcode_action" 1>&6
+
+
+reload_flag=
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6
+# PORTME Some linkers may need a different reload flag.
+reload_flag='-r'
+echo "$ac_t$reload_flag" 1>&6
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+# PORTME Fill in your ld.so characteristics
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+file_magic_cmd=
+file_magic_test_file=
+deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
+case "$host_os" in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}.so$major'
+ ;;
+
+aix4*)
+ version_type=linux
+ # AIX has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ # We preserve .a as extension for shared libraries though AIX4.2
+ # and later linker supports .so
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a'
+ shlibpath_var=LIBPATH
+ deplibs_check_method=pass_all
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}.so'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ deplibs_check_method=pass_all
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+bsdi4*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=/shlib/libc.so
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ export_dynamic_flag_spec=-rdynamic
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw*)
+ version_type=windows
+ need_version=no
+ need_lib_prefix=no
+ if test "$with_gcc" = yes; then
+ library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a'
+ else
+ library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
+ fi
+ dynamic_linker='Win32 ld.exe'
+ deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ file_magic_cmd='${OBJDUMP} -f'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+ version_type=freebsd-$objformat
+ case "$version_type" in
+ freebsd-elf*)
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /usr/lib/libc.so*`
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ deplibs_check_method=unknown
+ library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case "$host_os" in
+ freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ *) # from 3.2 on
+ shlibpath_overrides_runpath=no
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ dynamic_linker="$host_os dld.sl"
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
+ soname_spec='${libname}${release}.sl$major'
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ case "$host_os" in
+ hpux10.20*)
+ # TODO: Does this work for hpux-11 too?
+ deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+irix5* | irix6*)
+ version_type=irix
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}.so.$major'
+ library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so'
+ case "$host_os" in
+ irix5*)
+ libsuff= shlibsuff=
+ # this will be overridden with pass_all, but let us keep it just in case
+ deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+ ;;
+ *)
+ case "$LD" in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+ deplibs_check_method='pass_all'
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ deplibs_check_method=pass_all
+
+ if test -f /lib/ld.so.1; then
+ dynamic_linker='GNU ld.so'
+ else
+ # Only the GNU ld.so supports shared libraries on MkLinux.
+ case "$host_cpu" in
+ powerpc*) dynamic_linker=no ;;
+ *) dynamic_linker='Linux ld.so' ;;
+ esac
+ fi
+ ;;
+
+netbsd*)
+ version_type=sunos
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
+ soname_spec='${libname}${release}.so$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+openbsd*)
+ version_type=sunos
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ need_version=no
+ fi
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+os2*)
+ libname_spec='$name'
+ need_lib_prefix=no
+ library_names_spec='$libname.dll $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_version=no
+ soname_spec='${libname}${release}.so'
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ # this will be overridden with pass_all, but let us keep it just in case
+ deplibs_check_method='file_magic COFF format alpha shared library'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=/shlib/libc.so
+ deplibs_check_method='pass_all'
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rhapsody*)
+ version_type=sunos
+ library_names_spec='${libname}.so'
+ soname_spec='${libname}.so'
+ shlibpath_var=DYLD_LIBRARY_PATH
+ deplibs_check_method=pass_all
+ ;;
+
+sco3.2v5*)
+ version_type=osf
+ soname_spec='${libname}${release}.so$major'
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib"
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=/lib/libc.so
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case "$host_vendor" in
+ sequent)
+ file_magic_cmd='/bin/file'
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ ncr)
+ deplibs_check_method='pass_all'
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ esac
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
+ soname_spec='$libname.so.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+echo "$ac_t$dynamic_linker" 1>&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+# Report the final consequences.
+echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
+
+# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in
+# configure.in, otherwise build static only libraries.
+case "$host_os" in
+cygwin* | mingw* | os2*)
+ if test x$can_build_shared = xyes; then
+ test x$enable_win32_dll = xno && can_build_shared=no
+ echo "checking if package supports dlls... $can_build_shared" 1>&6
+ fi
+;;
+esac
+
+if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then
+ case "$deplibs_check_method" in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+fi
+
+echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+aix4*)
+ test "$enable_shared" = yes && enable_static=no
+ ;;
+esac
+
+echo "$ac_t$enable_shared" 1>&6
+
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+
+echo "checking whether to build static libraries... $enable_static" 1>&6
+
+if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+echo $ac_n "checking for objdir... $ac_c" 1>&6
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+echo "$ac_t$objdir" 1>&6
+
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then
+ lt_cv_dlopen=no lt_cv_dlopen_libs=
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "$progname:2248: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2256 "ltconfig"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo $progname:2269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen""... $ac_c" 1>&6
+echo "$progname:2288: checking for dlopen" >&5
+if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2293 "ltconfig"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+dlopen();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo $progname:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="dlopen"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
+echo "$progname:2335: checking for dld_link in -ldld" >&5
+ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldld $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2343 "ltconfig"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link();
+
+int main() {
+dld_link()
+; return 0; }
+EOF
+if { (eval echo $progname:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for shl_load""... $ac_c" 1>&6
+echo "$progname:2375: checking for shl_load" >&5
+if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2380 "ltconfig"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char shl_load(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
+choke me
+#else
+shl_load();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo $progname:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_shl_load=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_shl_load=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="shl_load"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
+echo "$progname:2423: checking for shl_load in -ldld" >&5
+ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldld $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2431 "ltconfig"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load();
+
+int main() {
+shl_load()
+; return 0; }
+EOF
+if { (eval echo $progname:2445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+fi
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ fi
+
+ case "$lt_cv_dlopen" in
+ dlopen)
+for ac_hdr in dlfcn.h; do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "$progname:2488: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2493 "ltconfig"
+#include <$ac_hdr>
+int fnord = 0;
+EOF
+ac_try="$ac_compile >/dev/null 2>conftest.out"
+{ (eval echo $progname:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ if test "x$ac_cv_header_dlfcn_h" = xyes; then
+ CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+ fi
+ eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
+echo "$progname:2526: checking whether a program can dlopen itself" >&5
+if test "${lt_cv_dlopen_self+set}" = set; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ lt_cv_dlopen_self=cross
+ else
+ cat > conftest.c <<EOF
+#line 2534 "ltconfig"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LTDL_GLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LTDL_GLOBAL DL_GLOBAL
+# else
+# define LTDL_GLOBAL 0
+# endif
+#endif
+
+/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LTDL_LAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LTDL_LAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LTDL_LAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LTDL_LAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LTDL_LAZY_OR_NOW DL_NOW
+# else
+# define LTDL_LAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+fnord() { int i=42;}
+main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
+ if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
+ if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
+
+EOF
+if { (eval echo $progname:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ lt_cv_dlopen_self=yes
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ lt_cv_dlopen_self=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self" 1>&6
+
+ if test "$lt_cv_dlopen_self" = yes; then
+ LDFLAGS="$LDFLAGS $link_static_flag"
+ echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
+echo "$progname:2599: checking whether a statically linked program can dlopen itself" >&5
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ lt_cv_dlopen_self_static=cross
+ else
+ cat > conftest.c <<EOF
+#line 2607 "ltconfig"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LTDL_GLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LTDL_GLOBAL DL_GLOBAL
+# else
+# define LTDL_GLOBAL 0
+# endif
+#endif
+
+/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LTDL_LAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LTDL_LAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LTDL_LAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LTDL_LAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LTDL_LAZY_OR_NOW DL_NOW
+# else
+# define LTDL_LAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+fnord() { int i=42;}
+main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
+ if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
+ if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
+
+EOF
+if { (eval echo $progname:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ lt_cv_dlopen_self_static=yes
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ lt_cv_dlopen_self_static=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6
+fi
+ ;;
+ esac
+
+ case "$lt_cv_dlopen_self" in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case "$lt_cv_dlopen_self_static" in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+# Copy echo and quote the copy, instead of the original, because it is
+# used later.
+ltecho="$echo"
+if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+ ltecho="$CONFIG_SHELL \$0 --fallback-echo"
+fi
+LTSHELL="$SHELL"
+
+LTCONFIG_VERSION="$VERSION"
+
+# Only quote variables if we're using ltmain.sh.
+case "$ltmain" in
+*.sh)
+ # Now quote all the things that may contain metacharacters.
+ for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \
+ old_LD old_LDFLAGS old_LIBS \
+ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \
+ AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \
+ reload_flag reload_cmds wl \
+ pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
+ thread_safe_flag_spec whole_archive_flag_spec libname_spec \
+ library_names_spec soname_spec \
+ RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
+ old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \
+ file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \
+ finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
+ hardcode_libdir_flag_spec hardcode_libdir_separator \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+
+ case "$var" in
+ reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case "$ltecho" in
+ *'\$0 --fallback-echo"')
+ ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+ trap "$rm \"$ofile\"; exit 1" 1 2 15
+ echo "creating $ofile"
+ $rm "$ofile"
+ cat <<EOF > "$ofile"
+#! $SHELL
+
+# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
+#
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="sed -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+### BEGIN LIBTOOL CONFIG
+EOF
+ cfgfile="$ofile"
+ ;;
+
+*)
+ # Double-quote the variables that need it (for aesthetics).
+ for var in old_CC old_CFLAGS old_CPPFLAGS \
+ old_LD old_LDFLAGS old_LIBS \
+ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do
+ eval "$var=\\\"\$var\\\""
+ done
+
+ # Just create a config file.
+ cfgfile="$ofile.cfg"
+ trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+ echo "creating $cfgfile"
+ $rm "$cfgfile"
+ cat <<EOF > "$cfgfile"
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+EOF
+ ;;
+esac
+
+cat <<EOF >> "$cfgfile"
+# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\
+# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\
+# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\
+# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\
+# $0$ltconfig_args
+#
+# Compiler and other test output produced by $progname, useful for
+# debugging $progname, is in ./config.log if it exists.
+
+# The version of $progname that generated this script.
+LTCONFIG_VERSION=$LTCONFIG_VERSION
+
+# Shell to use when invoking shell scripts.
+SHELL=$LTSHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$ltecho
+
+# The archiver.
+AR=$AR
+
+# The default C compiler.
+CC=$CC
+
+# The linker used to build libraries.
+LD=$LD
+
+# Whether we need hard or soft links.
+LN_S=$LN_S
+
+# A BSD-compatible nm program.
+NM=$NM
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$reload_flag
+reload_cmds=$reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$wl
+
+# Object file suffix (normally "o").
+objext="$objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$pic_flag
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$compiler_c_o
+
+# Can we write directly to a .lo ?
+compiler_o_lo=$compiler_o_lo
+
+# Must we lock files when doing compilation ?
+need_locks=$need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$link_static_flag
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$RANLIB
+old_archive_cmds=$old_archive_cmds
+old_postinstall_cmds=$old_postinstall_cmds
+old_postuninstall_cmds=$old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$old_archive_from_new_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$archive_cmds
+archive_expsym_cmds=$archive_expsym_cmds
+postinstall_cmds=$postinstall_cmds
+postuninstall_cmds=$postuninstall_cmds
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$global_symbol_to_cdecl
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$include_expsyms
+
+EOF
+
+case "$ltmain" in
+*.sh)
+ echo '### END LIBTOOL CONFIG' >> "$ofile"
+ echo >> "$ofile"
+ case "$host_os" in
+ aix3*)
+ cat <<\EOF >> "$ofile"
+
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+EOF
+ ;;
+ esac
+
+ # Append the ltmain.sh script.
+ sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1)
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+
+ chmod +x "$ofile"
+ ;;
+
+*)
+ # Compile the libtool program.
+ echo "FIXME: would compile $ltmain"
+ ;;
+esac
+
+test -n "$cache_file" || exit 0
+
+# AC_CACHE_SAVE
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/contrib/idn/mdnkit/ltmain.sh b/contrib/idn/mdnkit/ltmain.sh
new file mode 100644
index 00000000..766732da
--- /dev/null
+++ b/contrib/idn/mdnkit/ltmain.sh
@@ -0,0 +1,4024 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun ltconfig.
+#
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell, and then maybe $echo will work.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# The name of this program.
+progname=`$echo "$0" | sed 's%^.*/%%'`
+modename="$progname"
+
+# Constants.
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.3.5
+TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+SP2NL='tr \040 \012'
+NL2SP='tr \015\012 \040\040'
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+ save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+ save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+if test "$LTCONFIG_VERSION" != "$VERSION"; then
+ echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+fi
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ echo "$modename: not configured to build any kind of library" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+# Parse our command line options once, thoroughly.
+while test $# -gt 0
+do
+ arg="$1"
+ shift
+
+ case "$arg" in
+ -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case "$prev" in
+ execute_dlfiles)
+ eval "$prev=\"\$$prev \$arg\""
+ ;;
+ *)
+ eval "$prev=\$arg"
+ ;;
+ esac
+
+ prev=
+ prevopt=
+ continue
+ fi
+
+ # Have we seen a non-optional argument yet?
+ case "$arg" in
+ --help)
+ show_help=yes
+ ;;
+
+ --version)
+ echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+ exit 0
+ ;;
+
+ --config)
+ sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
+ exit 0
+ ;;
+
+ --debug)
+ echo "$progname: enabling shell trace mode"
+ set -x
+ ;;
+
+ --dry-run | -n)
+ run=:
+ ;;
+
+ --features)
+ echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ echo "enable shared libraries"
+ else
+ echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ echo "enable static libraries"
+ else
+ echo "disable static libraries"
+ fi
+ exit 0
+ ;;
+
+ --finish) mode="finish" ;;
+
+ --mode) prevopt="--mode" prev=mode ;;
+ --mode=*) mode="$optarg" ;;
+
+ --quiet | --silent)
+ show=:
+ ;;
+
+ -dlopen)
+ prevopt="-dlopen"
+ prev=execute_dlfiles
+ ;;
+
+ -*)
+ $echo "$modename: unrecognized option \`$arg'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *)
+ nonopt="$arg"
+ break
+ ;;
+ esac
+done
+
+if test -n "$prevopt"; then
+ $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+fi
+
+if test -z "$show_help"; then
+
+ # Infer the operation mode.
+ if test -z "$mode"; then
+ case "$nonopt" in
+ *cc | *++ | gcc* | *-gcc*)
+ mode=link
+ for arg
+ do
+ case "$arg" in
+ -c)
+ mode=compile
+ break
+ ;;
+ esac
+ done
+ ;;
+ *db | *dbx | *strace | *truss)
+ mode=execute
+ ;;
+ *install*|cp|mv)
+ mode=install
+ ;;
+ *rm)
+ mode=uninstall
+ ;;
+ *)
+ # If we have no mode, but dlfiles were specified, then do execute mode.
+ test -n "$execute_dlfiles" && mode=execute
+
+ # Just use the default operation mode.
+ if test -z "$mode"; then
+ if test -n "$nonopt"; then
+ $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+ else
+ $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+ fi
+ fi
+ ;;
+ esac
+ fi
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$execute_dlfiles" && test "$mode" != execute; then
+ $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$modename --help --mode=$mode' for more information."
+
+ # These modes are in order of execution frequency so that they run quickly.
+ case "$mode" in
+ # libtool compile mode
+ compile)
+ modename="$modename: compile"
+ # Get the compilation command and the source file.
+ base_compile=
+ lastarg=
+ srcfile="$nonopt"
+ suppress_output=
+
+ user_target=no
+ for arg
+ do
+ # Accept any command-line options.
+ case "$arg" in
+ -o)
+ if test "$user_target" != "no"; then
+ $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+ exit 1
+ fi
+ user_target=next
+ ;;
+
+ -static)
+ build_old_libs=yes
+ continue
+ ;;
+ esac
+
+ case "$user_target" in
+ next)
+ # The next one is the -o target name
+ user_target=yes
+ continue
+ ;;
+ yes)
+ # We got the output file
+ user_target=set
+ libobj="$arg"
+ continue
+ ;;
+ esac
+
+ # Accept the current argument as the source file.
+ lastarg="$srcfile"
+ srcfile="$arg"
+
+ # Aesthetically quote the previous argument.
+
+ # Backslashify any backslashes, double quotes, and dollar signs.
+ # These are the only characters that are still specially
+ # interpreted inside of double-quoted scrings.
+ lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly in scan
+ # sets, so we specify it separately.
+ case "$lastarg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ lastarg="\"$lastarg\""
+ ;;
+ esac
+
+ # Add the previous argument to base_compile.
+ if test -z "$base_compile"; then
+ base_compile="$lastarg"
+ else
+ base_compile="$base_compile $lastarg"
+ fi
+ done
+
+ case "$user_target" in
+ set)
+ ;;
+ no)
+ # Get the name of the library object.
+ libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ ;;
+ *)
+ $echo "$modename: you must specify a target with \`-o'" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ xform='[cCFSfmso]'
+ case "$libobj" in
+ *.ada) xform=ada ;;
+ *.adb) xform=adb ;;
+ *.ads) xform=ads ;;
+ *.asm) xform=asm ;;
+ *.c++) xform=c++ ;;
+ *.cc) xform=cc ;;
+ *.cpp) xform=cpp ;;
+ *.cxx) xform=cxx ;;
+ *.f90) xform=f90 ;;
+ *.for) xform=for ;;
+ esac
+
+ libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+ case "$libobj" in
+ *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+ *)
+ $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test -z "$base_compile"; then
+ $echo "$modename: you must specify a compilation command" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $libobj"
+ else
+ removelist="$libobj"
+ fi
+
+ $run $rm $removelist
+ trap "$run $rm $removelist; exit 1" 1 2 15
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ removelist="$removelist $output_obj $lockfile"
+ trap "$run $rm $removelist; exit 1" 1 2 15
+ else
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until ln "$0" "$lockfile" 2>/dev/null; do
+ $show "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+ echo $srcfile > "$lockfile"
+ fi
+
+ if test -n "$fix_srcfile_path"; then
+ eval srcfile=\"$fix_srcfile_path\"
+ fi
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ # All platforms use -DPIC, to notify preprocessed assembler code.
+ command="$base_compile $srcfile $pic_flag -DPIC"
+ if test "$build_old_libs" = yes; then
+ lo_libobj="$libobj"
+ dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$libobj"; then
+ dir="$objdir"
+ else
+ dir="$dir/$objdir"
+ fi
+ libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+
+ if test -d "$dir"; then
+ $show "$rm $libobj"
+ $run $rm $libobj
+ else
+ $show "$mkdir $dir"
+ $run $mkdir $dir
+ status=$?
+ if test $status -ne 0 && test ! -d $dir; then
+ exit $status
+ fi
+ fi
+ fi
+ if test "$compiler_o_lo" = yes; then
+ output_obj="$libobj"
+ command="$command -o $output_obj"
+ elif test "$compiler_c_o" = yes; then
+ output_obj="$obj"
+ command="$command -o $output_obj"
+ fi
+
+ $run $rm "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ test -n "$output_obj" && $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+ echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test x"$output_obj" != x"$libobj"; then
+ $show "$mv $output_obj $libobj"
+ if $run $mv $output_obj $libobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # If we have no pic_flag, then copy the object into place and finish.
+ if test -z "$pic_flag" && test "$build_old_libs" = yes; then
+ # Rename the .lo from within objdir to obj
+ if test -f $obj; then
+ $show $rm $obj
+ $run $rm $obj
+ fi
+
+ $show "$mv $libobj $obj"
+ if $run $mv $libobj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
+ libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+ # Now arrange that obj and lo_libobj become the same file
+ $show "(cd $xdir && $LN_S $baseobj $libobj)"
+ if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
+ exit 0
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Allow error messages only from the first compilation.
+ suppress_output=' >/dev/null 2>&1'
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ command="$base_compile $srcfile"
+ if test "$compiler_c_o" = yes; then
+ command="$command -o $obj"
+ output_obj="$obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ command="$command$suppress_output"
+ $run $rm "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+ echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed
+ if test x"$output_obj" != x"$obj"; then
+ $show "$mv $output_obj $obj"
+ if $run $mv $output_obj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we do not
+ # accidentally link it into a program.
+ if test "$build_libtool_libs" != yes; then
+ $show "echo timestamp > $libobj"
+ $run eval "echo timestamp > \$libobj" || exit $?
+ else
+ # Move the .lo from within objdir
+ $show "$mv $libobj $lo_libobj"
+ if $run $mv $libobj $lo_libobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+ fi
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ $rm "$lockfile"
+ fi
+
+ exit 0
+ ;;
+
+ # libtool link mode
+ link)
+ modename="$modename: link"
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invokation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+
+ # This is a source program that is used to create dlls on Windows
+ # Don't remove nor modify the starting and closing comments
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# # ifdef __CYGWIN32__
+# # define __CYGWIN__ __CYGWIN32__
+# # endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+# __hDllInstance_base = hInst;
+# return TRUE;
+# }
+# /* ltdll.c ends here */
+ # This is a source program that is used to create import libraries
+ # on Windows for dlls which lack them. Don't remove nor modify the
+ # starting and closing comments
+# /* impgen.c starts here */
+# /* Copyright (C) 1999 Free Software Foundation, Inc.
+#
+# This file is part of GNU libtool.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# */
+#
+# #include <stdio.h> /* for printf() */
+# #include <unistd.h> /* for open(), lseek(), read() */
+# #include <fcntl.h> /* for O_RDONLY, O_BINARY */
+# #include <string.h> /* for strdup() */
+#
+# static unsigned int
+# pe_get16 (fd, offset)
+# int fd;
+# int offset;
+# {
+# unsigned char b[2];
+# lseek (fd, offset, SEEK_SET);
+# read (fd, b, 2);
+# return b[0] + (b[1]<<8);
+# }
+#
+# static unsigned int
+# pe_get32 (fd, offset)
+# int fd;
+# int offset;
+# {
+# unsigned char b[4];
+# lseek (fd, offset, SEEK_SET);
+# read (fd, b, 4);
+# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# static unsigned int
+# pe_as32 (ptr)
+# void *ptr;
+# {
+# unsigned char *b = ptr;
+# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# int
+# main (argc, argv)
+# int argc;
+# char *argv[];
+# {
+# int dll;
+# unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+# unsigned long export_rva, export_size, nsections, secptr, expptr;
+# unsigned long name_rvas, nexp;
+# unsigned char *expdata, *erva;
+# char *filename, *dll_name;
+#
+# filename = argv[1];
+#
+# dll = open(filename, O_RDONLY|O_BINARY);
+# if (!dll)
+# return 1;
+#
+# dll_name = filename;
+#
+# for (i=0; filename[i]; i++)
+# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
+# dll_name = filename + i +1;
+#
+# pe_header_offset = pe_get32 (dll, 0x3c);
+# opthdr_ofs = pe_header_offset + 4 + 20;
+# num_entries = pe_get32 (dll, opthdr_ofs + 92);
+#
+# if (num_entries < 1) /* no exports */
+# return 1;
+#
+# export_rva = pe_get32 (dll, opthdr_ofs + 96);
+# export_size = pe_get32 (dll, opthdr_ofs + 100);
+# nsections = pe_get16 (dll, pe_header_offset + 4 +2);
+# secptr = (pe_header_offset + 4 + 20 +
+# pe_get16 (dll, pe_header_offset + 4 + 16));
+#
+# expptr = 0;
+# for (i = 0; i < nsections; i++)
+# {
+# char sname[8];
+# unsigned long secptr1 = secptr + 40 * i;
+# unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+# unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+# unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+# lseek(dll, secptr1, SEEK_SET);
+# read(dll, sname, 8);
+# if (vaddr <= export_rva && vaddr+vsize > export_rva)
+# {
+# expptr = fptr + (export_rva - vaddr);
+# if (export_rva + export_size > vaddr + vsize)
+# export_size = vsize - (export_rva - vaddr);
+# break;
+# }
+# }
+#
+# expdata = (unsigned char*)malloc(export_size);
+# lseek (dll, expptr, SEEK_SET);
+# read (dll, expdata, export_size);
+# erva = expdata - export_rva;
+#
+# nexp = pe_as32 (expdata+24);
+# name_rvas = pe_as32 (expdata+32);
+#
+# printf ("EXPORTS\n");
+# for (i = 0; i<nexp; i++)
+# {
+# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
+# }
+#
+# return 0;
+# }
+# /* impgen.c ends here */
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ compile_command="$nonopt"
+ finalize_command="$nonopt"
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ linkopts=
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+ else
+ lib_search_path=
+ fi
+ # now prepend the system-specific ones
+ eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ avoid_version=no
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ link_against_libtool_libs=
+ ltlibs=
+ module=no
+ objs=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case "$arg" in
+ -all-static | -static)
+ if test "X$arg" = "X-all-static"; then
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ else
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ fi
+ build_libtool_libs=no
+ build_old_libs=yes
+ prefer_static_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test $# -gt 0; do
+ arg="$1"
+ shift
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case "$prev" in
+ output)
+ compile_command="$compile_command @OUTPUT@"
+ finalize_command="$finalize_command @OUTPUT@"
+ ;;
+ esac
+
+ case "$prev" in
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ compile_command="$compile_command @SYMFILE@"
+ finalize_command="$finalize_command @SYMFILE@"
+ preload=yes
+ fi
+ case "$arg" in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ else
+ dlprefiles="$dlprefiles $arg"
+ fi
+ prev=
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ if test ! -f "$arg"; then
+ $echo "$modename: symbol file \`$arg' does not exist"
+ exit 1
+ fi
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case "$arg" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) rpath="$rpath $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) xrpath="$xrpath $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi
+
+ prevarg="$arg"
+
+ case "$arg" in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+ continue
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: not more than one -exported-symbols argument allowed"
+ exit 1
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -L*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+ # We need an absolute path.
+ case "$dir" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ absdir="$dir"
+ fi
+ dir="$absdir"
+ ;;
+ esac
+ case " $deplibs " in
+ *" $arg "*) ;;
+ *) deplibs="$deplibs $arg";;
+ esac
+ case " $lib_search_path " in
+ *" $dir "*) ;;
+ *) lib_search_path="$lib_search_path $dir";;
+ esac
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2*)
+ dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
+ case ":$dllsearchpath:" in
+ ::) dllsearchpath="$dllsearchdir";;
+ *":$dllsearchdir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
+ esac
+ ;;
+ esac
+ ;;
+
+ -l*)
+ if test "$arg" = "-lc"; then
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+ # These systems don't actually have c library (as such)
+ continue
+ ;;
+ esac
+ elif test "$arg" = "-lm"; then
+ case "$host" in
+ *-*-cygwin* | *-*-beos*)
+ # These systems don't actually have math library (as such)
+ continue
+ ;;
+ esac
+ fi
+ deplibs="$deplibs $arg"
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+ # We need an absolute path.
+ case "$dir" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ continue
+ ;;
+
+ -static)
+ # If we have no pic_flag, then this is the same as -all-static.
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+
+ *.o | *.obj | *.a | *.lib)
+ # A standard object.
+ objs="$objs $arg"
+ ;;
+
+ *.lo)
+ # A library object.
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
+ prev=
+ fi
+ libobjs="$libobjs $arg"
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ dlname=
+ libdir=
+ library_names=
+ old_library=
+
+ # Check to see that this really is a libtool archive.
+ if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variable installed.
+ installed=yes
+
+ # Read the .la file
+ # If there is no directory component, then add one.
+ case "$arg" in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ # Get the name of the library we link against.
+ linklib=
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+
+ if test -z "$linklib"; then
+ $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
+ exit 1
+ fi
+
+ # Find the relevant object directory and library name.
+ name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
+
+ if test "X$installed" = Xyes; then
+ dir="$libdir"
+ else
+ dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$arg"; then
+ dir="$objdir"
+ else
+ dir="$dir/$objdir"
+ fi
+ fi
+
+ if test -n "$dependency_libs"; then
+ # Extract -R and -L from dependency_libs
+ temp_deplibs=
+ for deplib in $dependency_libs; do
+ case "$deplib" in
+ -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ case " $rpath $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) xrpath="$xrpath $temp_xrpath";;
+ esac;;
+ -L*) case "$compile_command $temp_deplibs " in
+ *" $deplib "*) ;;
+ *) temp_deplibs="$temp_deplibs $deplib";;
+ esac
+ temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ case " $lib_search_path " in
+ *" $temp_dir "*) ;;
+ *) lib_search_path="$lib_search_path $temp_dir";;
+ esac
+ ;;
+ *) temp_deplibs="$temp_deplibs $deplib";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ if test -z "$libdir"; then
+ # It is a libtool convenience library, so add in its objects.
+ convenience="$convenience $dir/$old_library"
+ old_convenience="$old_convenience $dir/$old_library"
+ deplibs="$deplibs$dependency_libs"
+ compile_command="$compile_command $dir/$old_library$dependency_libs"
+ finalize_command="$finalize_command $dir/$old_library$dependency_libs"
+ continue
+ fi
+
+ # This library was specified with -dlopen.
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking statically,
+ # we need to preload.
+ prev=dlprefiles
+ else
+ # We should not create a dependency on this library, but we
+ # may need any libraries it requires.
+ compile_command="$compile_command$dependency_libs"
+ finalize_command="$finalize_command$dependency_libs"
+ prev=
+ continue
+ fi
+ fi
+
+ # The library was specified with -dlpreopen.
+ if test "$prev" = dlprefiles; then
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ dlprefiles="$dlprefiles $dir/$old_library"
+ else
+ dlprefiles="$dlprefiles $dir/$linklib"
+ fi
+ prev=
+ fi
+
+ if test -n "$library_names" &&
+ { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+ link_against_libtool_libs="$link_against_libtool_libs $arg"
+ if test -n "$shlibpath_var"; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath " in
+ *" $dir "*) ;;
+ *) temp_rpath="$temp_rpath $dir" ;;
+ esac
+ fi
+
+ # We need an absolute path.
+ case "$dir" in
+ [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ absdir="$dir"
+ fi
+ ;;
+ esac
+
+ # This is the magic to use -rpath.
+ # Skip directories that are in the system default run-time
+ # search path, unless they have been requested with -R.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+
+ lib_linked=yes
+ case "$hardcode_action" in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ compile_command="$compile_command $dir/$linklib"
+ deplibs="$deplibs $dir/$linklib"
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2*)
+ dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
+ if test -n "$dllsearchpath"; then
+ dllsearchpath="$dllsearchpath:$dllsearchdir"
+ else
+ dllsearchpath="$dllsearchdir"
+ fi
+ ;;
+ esac
+ elif test "$hardcode_minus_L" = no; then
+ case "$host" in
+ *-*-sunos*)
+ compile_shlibpath="$compile_shlibpath$dir:"
+ ;;
+ esac
+ case "$compile_command " in
+ *" -L$dir "*) ;;
+ *) compile_command="$compile_command -L$dir";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -L$dir -l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ case ":$compile_shlibpath:" in
+ *":$dir:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$dir:";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+
+ relink)
+ if test "$hardcode_direct" = yes; then
+ compile_command="$compile_command $absdir/$linklib"
+ deplibs="$deplibs $absdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ case "$compile_command " in
+ *" -L$absdir "*) ;;
+ *) compile_command="$compile_command -L$absdir";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -L$absdir -l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case ":$compile_shlibpath:" in
+ *":$absdir:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$absdir:";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+
+ *)
+ lib_linked=no
+ ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ $echo "$modename: configuration error: unsupported hardcode properties"
+ exit 1
+ fi
+
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes; then
+ finalize_command="$finalize_command $libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ case "$finalize_command " in
+ *" -L$libdir "*) ;;
+ *) finalize_command="$finalize_command -L$libdir";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case ":$finalize_shlibpath:" in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ case "$finalize_command " in
+ *" -L$dir "*) ;;
+ *) finalize_command="$finalize_command -L$libdir";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ fi
+ else
+ # Transform directly to old archives if we don't build new libraries.
+ if test -n "$pic_flag" && test -z "$old_library"; then
+ $echo "$modename: cannot find static library for \`$arg'" 1>&2
+ exit 1
+ fi
+
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_command="$compile_command $dir/$linklib"
+ finalize_command="$finalize_command $dir/$linklib"
+ else
+ case "$compile_command " in
+ *" -L$dir "*) ;;
+ *) compile_command="$compile_command -L$dir";;
+ esac
+ compile_command="$compile_command -l$name"
+ case "$finalize_command " in
+ *" -L$dir "*) ;;
+ *) finalize_command="$finalize_command -L$dir";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ fi
+ fi
+
+ # Add in any libraries that this one depends upon.
+ compile_command="$compile_command$dependency_libs"
+ finalize_command="$finalize_command$dependency_libs"
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+ esac
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+ done
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+
+ oldlibs=
+ # calculate the name of the file, without its directory
+ outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+ libobjs_save="$libobjs"
+
+ case "$output" in
+ "")
+ $echo "$modename: you must specify an output file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *.a | *.lib)
+ if test -n "$link_against_libtool_libs"; then
+ $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
+ exit 1
+ fi
+
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+ fi
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ ;;
+
+ *.la)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case "$outputname" in
+ lib*)
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ if test "$module" = no; then
+ $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ eval libname=\"$libname_spec\"
+ else
+ libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ fi
+ ;;
+ esac
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+
+ if test -n "$objs"; then
+ $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
+ exit 1
+ fi
+
+ # How the heck are we supposed to write a wrapper for a shared library?
+ if test -n "$link_against_libtool_libs"; then
+ $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
+ exit 1
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
+ fi
+
+ set dummy $rpath
+ if test $# -gt 2; then
+ $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+ fi
+ install_libdir="$2"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ libext=al
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+ dependency_libs="$deplibs"
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+ fi
+ else
+
+ # Parse the version information argument.
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ IFS="$save_ifs"
+
+ if test -n "$8"; then
+ $echo "$modename: too many parameters to \`-version-info'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ current="$2"
+ revision="$3"
+ age="$4"
+
+ # Check that each of the things are valid numbers.
+ case "$current" in
+ 0 | [1-9] | [1-9][0-9]*) ;;
+ *)
+ $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case "$revision" in
+ 0 | [1-9] | [1-9][0-9]*) ;;
+ *)
+ $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case "$age" in
+ 0 | [1-9] | [1-9][0-9]*) ;;
+ *)
+ $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test $age -gt $current; then
+ $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case "$version_type" in
+ none) ;;
+
+ irix)
+ major=`expr $current - $age + 1`
+ versuffix="$major.$revision"
+ verstring="sgi$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test $loop != 0; do
+ iface=`expr $revision - $loop`
+ loop=`expr $loop - 1`
+ verstring="sgi$major.$iface:$verstring"
+ done
+ ;;
+
+ linux)
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ major=`expr $current - $age`
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test $loop != 0; do
+ iface=`expr $current - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ verstring="$verstring:${current}.0"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current";
+ ;;
+
+ windows)
+ # Like Linux, but with '-' rather than '.', since we only
+ # want one extension on Windows 95.
+ major=`expr $current - $age`
+ versuffix="-$major-$age-$revision"
+ ;;
+
+ *)
+ $echo "$modename: unknown library version type \`$version_type'" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ verstring="0.0"
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+
+ dependency_libs="$deplibs"
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *-*-rhapsody*)
+ # rhapsody is a little odd...
+ deplibs="$deplibs -framework System"
+ ;;
+ *)
+ # Add libc to deplibs on all other systems.
+ deplibs="$deplibs -lc"
+ ;;
+ esac
+ fi
+
+ # Create the output directory, or remove our outputs if we need to.
+ if test -d $output_objdir; then
+ $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
+ $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
+ else
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ status=$?
+ if test $status -ne 0 && test ! -d $output_objdir; then
+ exit $status
+ fi
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+ fi
+
+ if test "$build_libtool_libs" = yes; then
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case "$deplibs_check_method" in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behaviour.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $rm conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $rm conftest
+ $CC -o conftest conftest.c $deplibs
+ if test $? -eq 0 ; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning: This library needs some functionality provided by $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ else
+ # Error occured in the first compile. Let's try to salvage the situation:
+ # Compile a seperate program for each library.
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" ; then
+ $rm conftest
+ $CC -o conftest conftest.c $i
+ # Did it work?
+ if test $? -eq 0 ; then
+ ldd_output=`ldd conftest`
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning: This library needs some functionality provided by $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ fi
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning! Library $i is needed by this library but I was not able to"
+ echo "*** make it link in! You will probably need to install it or some"
+ echo "*** library that it depends on before this library will be fully"
+ echo "*** functional. Installing it before continuing would be even better."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
+ for a_deplib in $deplibs; do
+ name="`expr $a_deplib : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null \
+ | grep " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | sed 's/.* -> //'`
+ case "$potliblink" in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+ | sed 10q \
+ | egrep "$file_magic_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ echo "*** Warning: This library needs some functionality provided by $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+ -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
+ grep . >/dev/null; then
+ echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ fi
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ echo
+ echo "*** Warning: libtool could not satisfy all declared inter-library"
+ echo "*** dependencies of module $libname. Therefore, libtool will create"
+ echo "*** a static module, that should work as long as the dlopening"
+ echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ echo "*** The inter-library dependencies that have been dropped here will be"
+ echo "*** automatically added whenever a program is linked with this library"
+ echo "*** or is declared to -dlopen it."
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ # Get the real and link names of the library.
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ lib="$output_objdir/$realname"
+ for link
+ do
+ linknames="$linknames $link"
+ done
+
+ # Ensure that we have .o objects for linkers which dislike .lo
+ # (e.g. aix) in case we are running --disable-static
+ for obj in $libobjs; do
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+ if test ! -f $xdir/$oldobj; then
+ $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
+ $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
+ fi
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ eval cmds=\"$export_symbols_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex"; then
+ $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+ $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+ $run eval '$mv "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+ fi
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case "$xlib" in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ linkopts="$linkopts $flag"
+ fi
+
+ # Do each of the archive commands.
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval cmds=\"$archive_expsym_cmds\"
+ else
+ eval cmds=\"$archive_cmds\"
+ fi
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ *.lo | *.o | *.obj)
+ if test -n "$link_against_libtool_libs"; then
+ $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
+ exit 1
+ fi
+
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+ fi
+
+ case "$output" in
+ *.lo)
+ if test -n "$objs"; then
+ $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+ exit 1
+ fi
+ libobj="$output"
+ obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $run $rm $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${obj}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case "$xlib" in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ # Create the old-style object.
+ reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
+
+ output="$obj"
+ eval cmds=\"$reload_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ $show "echo timestamp > $libobj"
+ $run eval "echo timestamp > $libobj" || exit $?
+ exit 0
+ fi
+
+ if test -n "$pic_flag"; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ eval cmds=\"$reload_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ else
+ # Just create a symlink.
+ $show $rm $libobj
+ $run $rm $libobj
+ xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$libobj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+ oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+ $show "(cd $xdir && $LN_S $oldobj $baseobj)"
+ $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
+ fi
+
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ ;;
+
+ # Anything else should be a program.
+ *)
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+ fi
+
+ if test "$preload" = yes; then
+ if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
+ test "$dlopen_self_static" = unknown; then
+ $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+ fi
+ fi
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$compile_rpath " in
+ *" $libdir "*) ;;
+ *) compile_rpath="$compile_rpath $libdir" ;;
+ esac
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+
+ # Create the binary in the object directory, then wrap it.
+ if test ! -d $output_objdir; then
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ status=$?
+ if test $status -ne 0 && test ! -d $output_objdir; then
+ exit $status
+ fi
+ fi
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ fi
+
+ dlsyms=
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ dlsyms="${outputname}S.c"
+ else
+ $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+ fi
+ fi
+
+ if test -n "$dlsyms"; then
+ case "$dlsyms" in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${outputname}.nm"
+
+ $show "$rm $nlist ${nlist}S ${nlist}T"
+ $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+ # Parse the name list into a source file.
+ $show "creating $output_objdir/$dlsyms"
+
+ test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ $show "generating symbol list for \`$output'"
+
+ test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ for arg in $progfiles; do
+ $show "extracting global C symbols from \`$arg'"
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$output.exp"
+ $run $rm $export_symbols
+ $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ else
+ $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+ $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+ $run eval 'mv "$nlist"T "$nlist"'
+ fi
+ fi
+
+ for arg in $dlprefiles; do
+ $show "extracting global C symbols from \`$arg'"
+ name=`echo "$arg" | sed -e 's%^.*/%%'`
+ $run eval 'echo ": $name " >> "$nlist"'
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -z "$run"; then
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $mv "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
+ :
+ else
+ grep -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+ else
+ echo '/* NONE */' >> "$output_objdir/$dlsyms"
+ fi
+
+ $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+ sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
+ -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
+ < "$nlist" >> "$output_objdir/$dlsyms"
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ {0, (lt_ptr_t) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ fi
+
+ pic_flag_for_symtable=
+ case "$host" in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
+ esac;;
+ *-*-hpux*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DPIC";;
+ esac
+ esac
+
+ # Now compile the dynamic symbol file.
+ $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+ $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+ # Clean up the generated files.
+ $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+ $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+ # Transform the symbol file into the correct name.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ ;;
+ *)
+ $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+ exit 1
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+ fi
+
+ if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
+ # Replace the output file specification.
+ compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ $show "$link_command"
+ $run eval "$link_command"
+ status=$?
+
+ # Delete the generated files.
+ if test -n "$dlsyms"; then
+ $show "$rm $output_objdir/${outputname}S.${objext}"
+ $run $rm "$output_objdir/${outputname}S.${objext}"
+ fi
+
+ exit $status
+ fi
+
+ if test -n "$shlibpath_var"; then
+ # We should set the shlibpath_var
+ rpath=
+ for dir in $temp_rpath; do
+ case "$dir" in
+ [\\/]* | [A-Za-z]:[\\/]*)
+ # Absolute path.
+ rpath="$rpath$dir:"
+ ;;
+ *)
+ # Relative path: add a thisdir entry.
+ rpath="$rpath\$thisdir/$dir:"
+ ;;
+ esac
+ done
+ temp_rpath="$rpath"
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+ $echo "$modename: \`$output' will be relinked during installation" 1>&2
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+
+ # Now create the wrapper script.
+ $show "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Quote $echo for shipping.
+ if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
+ case "$0" in
+ [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
+ *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
+ esac
+ qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+ else
+ qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if our run command is non-null.
+ if test -z "$run"; then
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
+ esac
+ $rm $output
+ trap "$rm $output; exit 1" 1 2 15
+
+ $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variable:
+ link_against_libtool_libs='$link_against_libtool_libs'
+else
+ # When we are sourced in execute mode, \$file and \$echo are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ echo=\"$qecho\"
+ file=\"\$0\"
+ # Make sure echo works.
+ if test \"X\$1\" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+ # Yippee, \$echo works!
+ :
+ else
+ # Restart under the correct shell, and then maybe \$echo will work.
+ exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+ fi
+ fi\
+"
+ $echo >> $output "\
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
+ done
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ echo >> $output "\
+ program=lt-'$outputname'
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" || \\
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $mkdir \"\$progdir\"
+ else
+ $rm \"\$progdir/\$file\"
+ fi"
+
+ echo >> $output "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if (cd \"\$thisdir\" && eval \$relink_command); then :
+ else
+ $rm \"\$progdir/\$file\"
+ exit 1
+ fi
+ fi
+
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $rm \"\$progdir/\$program\";
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $rm \"\$progdir/\$file\"
+ fi"
+ else
+ echo >> $output "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ echo >> $output "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $echo >> $output "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ # fixup the dll searchpath if we need to.
+ if test -n "$dllsearchpath"; then
+ $echo >> $output "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $echo >> $output "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+"
+ case $host in
+ # win32 systems need to use the prog path for dll
+ # lookup to work
+ *-*-cygwin*)
+ $echo >> $output "\
+ exec \$progdir/\$program \${1+\"\$@\"}
+"
+ ;;
+
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2*)
+ $echo >> $output "\
+ exec \$progdir\\\\\$program \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $echo >> $output "\
+ # Export the path to the program.
+ PATH=\"\$progdir:\$PATH\"
+ export PATH
+
+ exec \$program \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $echo >> $output "\
+ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+ exit 1
+ fi
+ else
+ # The program doesn't exist.
+ \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
+ \$echo \"This script is just a wrapper for \$program.\" 1>&2
+ echo \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit 1
+ fi
+fi\
+"
+ chmod +x $output
+ fi
+ exit 0
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ # Add in members from convenience archives.
+ for xlib in $addlibs; do
+ # Extract the objects.
+ case "$xlib" in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ eval cmds=\"$old_archive_from_new_cmds\"
+ else
+ # Ensure that we have .o objects in place in case we decided
+ # not to build a shared library, and have fallen back to building
+ # static libs even though --disable-static was passed!
+ for oldobj in $oldobjs; do
+ if test ! -f $oldobj; then
+ xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$oldobj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
+ obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+ $show "(cd $xdir && ${LN_S} $obj $baseobj)"
+ $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
+ fi
+ done
+
+ eval cmds=\"$old_archive_cmds\"
+ fi
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$generated"; then
+ $show "${rm}r$generated"
+ $run ${rm}r$generated
+ fi
+
+ # Now create the libtool archive.
+ case "$output" in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ $show "creating $output"
+
+ if test -n "$xrpath"; then
+ temp_xrpath=
+ for libdir in $xrpath; do
+ temp_xrpath="$temp_xrpath -R$libdir"
+ done
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+
+ # Only create the output if not a dry run.
+ if test -z "$run"; then
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ fi
+ $rm $output
+ $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$dlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'\
+"
+ done
+ fi
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+ $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
+ ;;
+ esac
+ exit 0
+ ;;
+
+ # libtool install mode
+ install)
+ modename="$modename: install"
+
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
+ # Aesthetically quote it.
+ arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$arg "
+ arg="$1"
+ shift
+ else
+ install_prog=
+ arg="$nonopt"
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog$arg"
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ for arg
+ do
+ if test -n "$dest"; then
+ files="$files $dest"
+ dest="$arg"
+ continue
+ fi
+
+ case "$arg" in
+ -d) isdir=yes ;;
+ -f) prev="-f" ;;
+ -g) prev="-g" ;;
+ -m) prev="-m" ;;
+ -o) prev="-o" ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*) ;;
+
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ prev=
+ else
+ dest="$arg"
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog $arg"
+ done
+
+ if test -z "$install_prog"; then
+ $echo "$modename: you must specify an install program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prev' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ $echo "$modename: no file or destination specified" 1>&2
+ else
+ $echo "$modename: you must specify a destination" 1>&2
+ fi
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Strip any trailing slash from the destination.
+ dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$destdir" = "X$dest" && destdir=.
+ destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files
+ if test $# -gt 2; then
+ $echo "$modename: \`$dest' is not a directory" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ fi
+ case "$destdir" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case "$file" in
+ *.lo) ;;
+ *)
+ $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case "$file" in
+ *.a | *.lib)
+ # Do the static libraries later.
+ staticlibs="$staticlibs $file"
+ ;;
+
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ library_names=
+ old_library=
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) current_libdirs="$current_libdirs $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) future_libdirs="$future_libdirs $libdir" ;;
+ esac
+ fi
+
+ dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
+ test "X$dir" = "X$file/" && dir=
+ dir="$dir$objdir"
+
+ # See the names of the shared library.
+ set dummy $library_names
+ if test -n "$2"; then
+ realname="$2"
+ shift
+ shift
+
+ # Install the shared library and build the symlinks.
+ $show "$install_prog $dir/$realname $destdir/$realname"
+ $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
+
+ if test $# -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ for linkname
+ do
+ if test "$linkname" != "$realname"; then
+ $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ fi
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ eval cmds=\"$postinstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Install the pseudo-library for information purposes.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ instname="$dir/$name"i
+ $show "$install_prog $instname $destdir/$name"
+ $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case "$destfile" in
+ *.lo)
+ staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+ ;;
+ *.o | *.obj)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ if test -n "$destfile"; then
+ $show "$install_prog $file $destfile"
+ $run eval "$install_prog $file $destfile" || exit $?
+ fi
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+ $show "$install_prog $staticobj $staticdest"
+ $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+ fi
+ exit 0
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Do a test to see if this is really a libtool program.
+ if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ link_against_libtool_libs=
+ relink_command=
+
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Check the variables that should have been set.
+ if test -z "$link_against_libtool_libs"; then
+ $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
+ exit 1
+ fi
+
+ finalize=yes
+ for lib in $link_against_libtool_libs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ # If there is no directory component, then add one.
+ case "$lib" in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ fi
+ libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+ finalize=no
+ fi
+ done
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ if test "$finalize" = yes && test -z "$run"; then
+ tmpdir="/tmp"
+ test -n "$TMPDIR" && tmpdir="$TMPDIR"
+ tmpdir="$tmpdir/libtool-$$"
+ if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
+ else
+ $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
+ continue
+ fi
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ ${rm}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ $echo "$modename: warning: cannot relink \`$file'" 1>&2
+ fi
+ else
+ # Install the binary that we compiled earlier.
+ file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ $show "$install_prog$stripme $file $destfile"
+ $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+ test -n "$outputname" && ${rm}r "$tmpdir"
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ $show "$install_prog $file $oldlib"
+ $run eval "$install_prog \$file \$oldlib" || exit $?
+
+ # Do each command in the postinstall commands.
+ eval cmds=\"$old_postinstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$future_libdirs"; then
+ $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+ fi
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ test -n "$run" && current_libdirs=" -n$current_libdirs"
+ exec $SHELL $0 --finish$current_libdirs
+ exit 1
+ fi
+
+ exit 0
+ ;;
+
+ # libtool finish mode
+ finish)
+ modename="$modename: finish"
+ libdirs="$nonopt"
+ admincmds=
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for dir
+ do
+ libdirs="$libdirs $dir"
+ done
+
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ eval cmds=\"$finish_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || admincmds="$admincmds
+ $cmd"
+ done
+ IFS="$save_ifs"
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $run eval "$cmds" || admincmds="$admincmds
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ test "$show" = : && exit 0
+
+ echo "----------------------------------------------------------------------"
+ echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ echo " $libdir"
+ done
+ echo
+ echo "If you ever happen to want to link against installed libraries"
+ echo "in a given directory, LIBDIR, you must either use libtool, and"
+ echo "specify the full pathname of the library, or use \`-LLIBDIR'"
+ echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ echo " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ echo " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ echo
+ echo "See any operating system documentation about shared libraries for"
+ echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ echo "----------------------------------------------------------------------"
+ exit 0
+ ;;
+
+ # libtool execute mode
+ execute)
+ modename="$modename: execute"
+
+ # The first argument is the command name.
+ cmd="$nonopt"
+ if test -z "$cmd"; then
+ $echo "$modename: you must specify a COMMAND" 1>&2
+ $echo "$help"
+ exit 1
+ fi
+
+ # Handle -dlopen flags immediately.
+ for file in $execute_dlfiles; do
+ if test ! -f "$file"; then
+ $echo "$modename: \`$file' is not a file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ dir=
+ case "$file" in
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+
+ if test -f "$dir/$objdir/$dlname"; then
+ dir="$dir/$objdir"
+ else
+ $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+ exit 1
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ ;;
+
+ *)
+ $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case "$file" in
+ -*) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+ args="$args \"$file\""
+ done
+
+ if test -z "$run"; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved enviroment variables
+ if test "${save_LC_ALL+set}" = set; then
+ LC_ALL="$save_LC_ALL"; export LC_ALL
+ fi
+ if test "${save_LANG+set}" = set; then
+ LANG="$save_LANG"; export LANG
+ fi
+
+ # Now actually exec the command.
+ eval "exec \$cmd$args"
+
+ $echo "$modename: cannot exec \$cmd$args"
+ exit 1
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+ $echo "export $shlibpath_var"
+ fi
+ $echo "$cmd$args"
+ exit 0
+ fi
+ ;;
+
+ # libtool uninstall mode
+ uninstall)
+ modename="$modename: uninstall"
+ rm="$nonopt"
+ files=
+
+ for arg
+ do
+ case "$arg" in
+ -*) rm="$rm $arg" ;;
+ *) files="$files $arg" ;;
+ esac
+ done
+
+ if test -z "$rm"; then
+ $echo "$modename: you must specify an RM program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ for file in $files; do
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ rmfiles="$file"
+
+ case "$name" in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ . $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ rmfiles="$rmfiles $dir/$n"
+ done
+ test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
+
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
+
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ eval cmds=\"$postuninstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ eval cmds=\"$old_postuninstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ done
+ IFS="$save_ifs"
+ fi
+
+ # FIXME: should reinstall the best remaining shared library.
+ fi
+ ;;
+
+ *.lo)
+ if test "$build_old_libs" = yes; then
+ oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
+ rmfiles="$rmfiles $dir/$oldobj"
+ fi
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
+ ;;
+
+ *)
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
+ ;;
+ esac
+ done
+ exit 0
+ ;;
+
+ "")
+ $echo "$modename: you must specify a MODE" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+fi # test -z "$show_help"
+
+# We need to display help for each of the modes.
+case "$mode" in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+ --config show all configuration variables
+ --debug enable verbose shell tracing
+-n, --dry-run display commands without modifying any files
+ --features display basic configuration information and exit
+ --finish same as \`--mode=finish'
+ --help display this help message and exit
+ --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
+ --quiet same as \`--silent'
+ --silent don't print informational messages
+ --version print version information
+
+MODE must be one of the following:
+
+ compile compile a source file into a libtool object
+ execute automatically set library path, then run a program
+ finish complete the installation of libtool libraries
+ install install libraries or executables
+ link create a library or an executable
+ uninstall remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE."
+ exit 0
+ ;;
+
+compile)
+ $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -static always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+execute)
+ $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+finish)
+ $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+install)
+ $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+link)
+ $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -static do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+uninstall)
+ $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+*)
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+esac
+
+echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/contrib/idn/mdnkit/man/Makefile.in b/contrib/idn/mdnkit/man/Makefile.in
new file mode 100644
index 00000000..384b916b
--- /dev/null
+++ b/contrib/idn/mdnkit/man/Makefile.in
@@ -0,0 +1,90 @@
+# $Id: Makefile.in,v 1.1 2000/12/07 00:52:27 tale Exp $
+#
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+# Tokyo, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) Japan Network Information Center. All rights reserved."
+#
+# 4. Neither the name of JPNIC may be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "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 JPNIC 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 DAMAGES.
+#
+# 6. Indemnification by Licensee
+# Any person or entities using and/or redistributing this Software under
+# this License Terms and Conditions shall defend indemnify and hold
+# harmless JPNIC from and against any and all judgements damages,
+# expenses, settlement liabilities, cost and other liabilities of any
+# kind as a result of use and redistribution of this Software or any
+# claim, suite, action, litigation or proceeding by any third party
+# arising out of or relates to this License Terms and Conditions.
+#
+# 7. Governing Law, Jurisdiction and Venue
+# This License Terms and Conditions shall be governed by and and
+# construed in accordance with the law of Japan. Any person or entities
+# using and/or redistributing this Software under this License Terms and
+# Conditions hereby agrees and consent to the personal and exclusive
+# jurisdiction and venue of Tokyo District Court of Japan.
+
+top_builddir = ..
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+ETCDIR = @sysconfdir@
+MANDIR = @mandir@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+GEN_FILES = mdnres.conf.5
+MAN5 = mdnres.conf.5
+
+all: $(GEN_FILES)
+
+install: install-man
+
+install-man:
+ [ -d $(MANDIR) ] || mkdir $(MANDIR)
+ [ -d $(MANDIR)/man5 ] || mkdir $(MANDIR)/man5
+ $(INSTALL_DATA) $(MAN5) $(MANDIR)/man5
+
+mdnres.conf.5: mdnres.conf.5.in
+ sed 's%@ETCDIR@%$(ETCDIR)%' < $(srcdir)/mdnres.conf.5.in > $@
+
+clean:
+ rm -f *~ $(GEN_FILES)
diff --git a/contrib/idn/mdnkit/man/mdnres.conf.5.in b/contrib/idn/mdnkit/man/mdnres.conf.5.in
new file mode 100644
index 00000000..adb0fc30
--- /dev/null
+++ b/contrib/idn/mdnkit/man/mdnres.conf.5.in
@@ -0,0 +1,296 @@
+.\" $Id: mdnres.conf.5.in,v 1.1 2000/12/07 00:52:27 tale Exp $"
+.\"
+.\" Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+.\"
+.\" By using this file, you agree to the terms and conditions set forth bellow.
+.\"
+.\" LICENSE TERMS AND CONDITIONS
+.\"
+.\" The following License Terms and Conditions apply, unless a different
+.\" license is obtained from Japan Network Information Center ("JPNIC"),
+.\" a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+.\" Tokyo, Japan.
+.\"
+.\" 1. Use, Modification and Redistribution (including distribution of any
+.\" modified or derived work) in source and/or binary forms is permitted
+.\" under this License Terms and Conditions.
+.\"
+.\" 2. Redistribution of source code must retain the copyright notices as they
+.\" appear in each source code file, this License Terms and Conditions.
+.\"
+.\" 3. Redistribution in binary form must reproduce the Copyright Notice,
+.\" this License Terms and Conditions, in the documentation and/or other
+.\" materials provided with the distribution. For the purposes of binary
+.\" distribution the "Copyright Notice" refers to the following language:
+.\" "Copyright (c) Japan Network Information Center. All rights reserved."
+.\"
+.\" 4. Neither the name of JPNIC may be used to endorse or promote products
+.\" derived from this Software without specific prior written approval of
+.\" JPNIC.
+.\"
+.\" 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+.\" "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 JPNIC 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 DAMAGES.
+.\"
+.\" 6. Indemnification by Licensee
+.\" Any person or entities using and/or redistributing this Software under
+.\" this License Terms and Conditions shall defend indemnify and hold
+.\" harmless JPNIC from and against any and all judgements damages,
+.\" expenses, settlement liabilities, cost and other liabilities of any
+.\" kind as a result of use and redistribution of this Software or any
+.\" claim, suite, action, litigation or proceeding by any third party
+.\" arising out of or relates to this License Terms and Conditions.
+.\"
+.\" 7. Governing Law, Jurisdiction and Venue
+.\" This License Terms and Conditions shall be governed by and and
+.\" construed in accordance with the law of Japan. Any person or entities
+.\" using and/or redistributing this Software under this License Terms and
+.\" Conditions hereby agrees and consent to the personal and exclusive
+.\" jurisdiction and venue of Tokyo District Court of Japan.
+.\"
+.TH mdnres.conf 5 "Sep 7, 2000"
+.\"
+.SH NAME
+mdnres.conf \- configuration file for the mDNkit client-side library
+.\"
+.SH SYNOPSIS
+@ETCDIR@/mdnres.conf
+.\"
+.SH DESCRIPTION
+.B mdnres.conf
+is read by the client-side resolver which is multilingualized
+(internationalized) using mDNkit.
+This file specifies various properties regarding multilingual domain names
+such as:
+.RS 4
+\- the encoding of domain names in DNS protocol.
+.br
+\- normalization schemes.
+.br
+\- the alternative encoding which is used in case the domain name in
+ the DNS reply message cannot be convertible to the local encoding.
+.br
+\- encoding name aliases.
+.RE
+.PP
+This file is a simple text file, and each line in the file
+(other than comment lines that begin with # and empty lines) forms an entry
+of the following format:
+.PP
+.RS 8
+.nf
+\fIkeyword\fP\ \fIvalue..\fP
+.fi
+.RE
+\."
+.SH "SERVER ENCODING ENTRY"
+Server encoding entry specifies the encoding name (codeset name) which
+is used as the encoding of multilingualized domain names by the DNS protocol.
+.PP
+The syntax of this entry is:
+.PP
+.RS 8
+.nf
+\f(CWserver-encoding \fP\fIencoding\fP
+.fi
+.RE
+.PP
+\fIencoding\fP is the encoding name to be used, and any of the following
+names can be specified.
+.RS 4
+.IP "\(bu" 2
+``UTF-8''
+.IP "\(bu" 2
+``RACE''
+.IP "\(bu" 2
+``BRACE''
+.IP "\(bu" 2
+``LACE''
+.IP "\(bu" 2
+``UTF-5''
+.IP "\(bu" 2
+Codeset names which iconv_open() library function accepts. Please
+consult iconv() documentation for the available codesets.
+.IP "\(bu" 2
+Any alias names for the above, defined by the alias file.
+(See section ``ENCODING ALIAS ENTRY'')
+.RE
+.SH "SERVER ZLD ENTRY"
+Some of the encodings used by internationalized name servers (the one
+specified by `server-encoding' entry) requires ZLD (zero-level domain),
+additional toplevel domain that is hidden from users/applications.
+This entry specifies the ZLD.
+.PP
+The syntax of this entry is:
+.PP
+.RS 8
+.nf
+\f(CWserver-zld \fP\fIZLD\fP
+.fi
+.RE
+.PP
+Note that this entry is ignored unless mDNkit is configured with
+\f(CW--enable-zld\fR so that its ZLD support is enabled.
+.SH "NORMALIZATION ENTRY"
+Normalization entry specifies the normalization schemes which should be
+applied to the domain names before sending them to name servers.
+.\"
+The syntax of this entry is:
+.PP
+.RS 8
+.nf
+\f(CWnormalize \fP\fIscheme\fP [\fIscheme\fP..]
+.fi
+.RE
+.PP
+.I scheme
+is the normalization scheme, and following shows the currently available
+schemes:
+.RS 4
+.TP 4
+\f(CWascii-lowercase\fP
+Convert ASCII uppercase letters to lowercase.
+.TP 4
+\f(CWascii-uppercase\fP
+Convert ASCII lowercase letters to uppercase.
+.TP 4
+\f(CWunicode-lowercase\fP
+Convert Unicode uppercase letters to lowercase, based on ``Unicode
+Technical Report #21: Case Mappings''.
+Note that only locale-independent conversion is supported.
+.TP 4
+\f(CWunicode-uppercase\fP
+Convert Unicode lowercase letters to uppercase, based on ``Unicode
+Technical Report #21: Case Mappings''.
+Note that only locale-independent conversion is supported.
+.TP 4
+\f(CWunicode-form-c\fP
+Perform Unicode normalization called ``Unicode Normalization Form C''.
+.TP 4
+\f(CWunicode-form-kc\fP
+Perform Unicode normalization called ``Unicode Normalization Form KC''.
+.TP 4
+\f(CWja-compose-voiced-sound\fP
+Compose Japanese full-width hiragana/katakana character and the following
+(semi) voiced sound mark (dakuten or han-dakuten in Japanese) into a
+single combined letter if such letter exists.
+.TP 4
+\f(CWja-kana-fullwidth\fP
+Convert Japanese half-width kana characters to full-width.
+.TP 4
+\f(CWja-alnum-halfwidth\fP
+Convert full-width alphabets, digits and minus sign to half-width.
+.TP 4
+\f(CWja-minus-hack\fP
+Convert Japanese full-width minus sign
+(Unicode ``MINUS SIGN'') to ``\-'' (Unicode ``HYPHEN-MINUS'').
+.RE
+.PP
+More than one
+.I schemes
+can be specified.
+If multiple schemes are specified, they are applied in turn.
+.SH "ALTERNATIVE ENCODING ENTRY"
+The resolver library multilingualized by mDNkit automatically
+determines the local codeset the application uses, and tries to
+convert domain names in a DNS reply message to the codeset.
+However, it is possible that the conversion fails because some
+characters in the domain names have no mapping to the local codeset.
+This occurs, for example, when a Japanese application using Japanese
+codeset receives a DNS reply containing Chinese characters which
+are not included in the Japanese character set.
+.PP
+Alternative encoding entry specifies the codeset name to be used
+instead of the local codeset in case the above problem happens.
+.PP
+The syntax of this entry is:
+.PP
+.RS 8
+.nf
+\f(CWalternate-encoding \fP\fIencoding\fP
+.fi
+.RE
+.PP
+.I encoding
+is the name of the codeset. It must be an ASCII-compatible
+encoding such as RACE.
+.\"
+.SH "ENCODING ALIAS ENTRY"
+Encoding alias entry specifies the file containing codeset name aliases.
+The aliases can be used just as the real names.
+.PP
+The syntax of this entry is:
+.PP
+.RS 8
+.nf
+\f(CWalias-file \fP\fIpathname\fP
+.fi
+.RE
+.PP
+.I pathname
+specifies the path name of the alias file.
+The alias file is a simple text file, consisting of lines of the form:
+.PP
+.RS 8
+.nf
+\fIalias-name\fP\ \fIname\fP
+.fi
+.RE
+.PP
+.I alias-name
+is the alias name to be defined, and
+.I name
+is the real name or another alias name.
+.\"
+.SH "LOCAL CODESET"
+.B mdnres.conf
+does not have an entry to specify the local codeset, since
+it is determined from the application's current locale information.
+So each application can use different local codeset.
+.PP
+Although mDNkit tries hard to find out the local codeset, sometimes it
+fails. For example, there are applications which use non-ASCII codeset
+but work in C locale. In this case, you can specify the application's
+local codeset by an environment variable ``MDN_LOCAL_CODESET''.
+Just set the codeset name (or its alias name) to the variable, and
+mDNkit will use the codeset as the local one, regardless of the locale
+setting.
+.SH "SAMPLE CONFIGURATION"
+The following shows a sample configuration file.
+.RS 4
+.ft CW
+.nf
+
+#
+# a sample configuration.
+#
+
+# Use RACE as the DNS protocol encoding.
+server-encoding RACE
+
+# Use lowercase conversion and Normalization Form KC for normalization.
+normalize unicode-lowercase unicode-form-kc
+
+# Use RACE as the alternative encoding.
+alternate-encoding RACE
+
+.fi
+.ft R
+.RE
+.\"
+.SH FILES
+.I @ETCDIR@/mdnres.conf
+.br
+.I @ETCDIR@/mdnres.conf.sample
+\- sample configuration with comments
+.\"
+.SH "SEE ALSO"
+iconv(3)
diff --git a/contrib/idn/mdnkit/patch/bind9/patch.configure b/contrib/idn/mdnkit/patch/bind9/patch.configure
new file mode 100644
index 00000000..433375db
--- /dev/null
+++ b/contrib/idn/mdnkit/patch/bind9/patch.configure
@@ -0,0 +1,1471 @@
+Index: configure
+===================================================================
+RCS file: /proj/cvs/isc/bind9/configure,v
+retrieving revision 1.194
+diff -u -u -2 -r1.194 configure
+--- configure 2000/12/13 06:21:38 1.194
++++ configure 2000/12/21 17:35:23
+@@ -16,5 +16,5 @@
+ # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+-# From configure.in Revision: 1.197
++# From configure.in Revision: 1.198
+
+ ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
+@@ -156,4 +156,10 @@
+ ac_help="$ac_help
+ --with-kame[=PATH] use Kame IPv6 [default path /usr/local/v6]"
++ac_help="$ac_help
++ --with-mdn[=PREFIX] enable MDN support using mDNkit [default prefix /usr/local]"
++ac_help="$ac_help
++ --with-iconv[=LIBSPEC] specify iconv library [default -liconv]"
++ac_help="$ac_help
++ --with-mdnlib=ARG specify libmdn"
+
+ # Initialize some variables set by options.
+@@ -696,5 +702,5 @@
+
+ echo $ac_n "checking host system type""... $ac_c" 1>&6
+-echo "configure:699: checking host system type" >&5
++echo "configure:705: checking host system type" >&5
+
+ host_alias=$host
+@@ -718,5 +724,5 @@
+
+ echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+-echo "configure:721: checking whether ${MAKE-make} sets \${MAKE}" >&5
++echo "configure:727: checking whether ${MAKE-make} sets \${MAKE}" >&5
+ set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+@@ -747,5 +753,5 @@
+ set dummy ranlib; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:750: checking for $ac_word" >&5
++echo "configure:756: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -786,5 +792,5 @@
+ # ./install, which can be erroneously created by make from ./install.sh.
+ echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+-echo "configure:789: checking for a BSD compatible install" >&5
++echo "configure:795: checking for a BSD compatible install" >&5
+ if test -z "$INSTALL"; then
+ if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+@@ -847,5 +853,5 @@
+ set dummy ar; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:850: checking for $ac_word" >&5
++echo "configure:856: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -903,5 +909,5 @@
+ set dummy $ac_prog; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:906: checking for $ac_word" >&5
++echo "configure:912: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_ETAGS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -948,5 +954,5 @@
+ set dummy $ac_prog; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:951: checking for $ac_word" >&5
++echo "configure:957: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -1050,5 +1056,5 @@
+ #
+ echo $ac_n "checking whether to use threads""... $ac_c" 1>&6
+-echo "configure:1053: checking whether to use threads" >&5
++echo "configure:1059: checking whether to use threads" >&5
+ # Check whether --enable-threads or --disable-threads was given.
+ if test "${enable_threads+set}" = set; then
+@@ -1128,5 +1134,5 @@
+ #
+ echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
+-echo "configure:1131: checking whether byte ordering is bigendian" >&5
++echo "configure:1137: checking whether byte ordering is bigendian" >&5
+ if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -1135,5 +1141,5 @@
+ # See if sys/param.h defines the BYTE_ORDER macro.
+ cat > conftest.$ac_ext <<EOF
+-#line 1138 "configure"
++#line 1144 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+@@ -1146,9 +1152,9 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1149: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:1155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ # It does; now see whether it defined to BIG_ENDIAN or not.
+ cat > conftest.$ac_ext <<EOF
+-#line 1153 "configure"
++#line 1159 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+@@ -1161,5 +1167,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1164: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:1170: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_bigendian=yes
+@@ -1181,5 +1187,5 @@
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 1184 "configure"
++#line 1190 "configure"
+ #include "confdefs.h"
+ main () {
+@@ -1194,5 +1200,5 @@
+ }
+ EOF
+-if { (eval echo configure:1197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
++if { (eval echo configure:1203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ ac_cv_c_bigendian=no
+@@ -1222,5 +1228,5 @@
+ #
+ echo $ac_n "checking for compatible OpenSSL library""... $ac_c" 1>&6
+-echo "configure:1225: checking for compatible OpenSSL library" >&5
++echo "configure:1231: checking for compatible OpenSSL library" >&5
+ # Check whether --with-openssl or --without-openssl was given.
+ if test "${with_openssl+set}" = set; then
+@@ -1279,5 +1285,5 @@
+ #
+ echo $ac_n "checking for GSSAPI library""... $ac_c" 1>&6
+-echo "configure:1282: checking for GSSAPI library" >&5
++echo "configure:1288: checking for GSSAPI library" >&5
+ # Check whether --with-gssapi or --without-gssapi was given.
+ if test "${with_gssapi+set}" = set; then
+@@ -1315,5 +1321,5 @@
+ #
+ echo $ac_n "checking for random device""... $ac_c" 1>&6
+-echo "configure:1318: checking for random device" >&5
++echo "configure:1324: checking for random device" >&5
+ # Check whether --with-randomdev or --without-randomdev was given.
+ if test "${with_randomdev+set}" = set; then
+@@ -1362,5 +1368,5 @@
+ set dummy gcc; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1365: checking for $ac_word" >&5
++echo "configure:1371: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -1392,5 +1398,5 @@
+ set dummy cc; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1395: checking for $ac_word" >&5
++echo "configure:1401: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -1443,5 +1449,5 @@
+ set dummy cl; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1446: checking for $ac_word" >&5
++echo "configure:1452: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -1475,5 +1481,5 @@
+
+ echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+-echo "configure:1478: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
++echo "configure:1484: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ ac_ext=c
+@@ -1486,10 +1492,10 @@
+ cat > conftest.$ac_ext << EOF
+
+-#line 1489 "configure"
++#line 1495 "configure"
+ #include "confdefs.h"
+
+ main(){return(0);}
+ EOF
+-if { (eval echo configure:1494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:1500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+@@ -1517,10 +1523,10 @@
+ fi
+ echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+-echo "configure:1520: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
++echo "configure:1526: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+ echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+ cross_compiling=$ac_cv_prog_cc_cross
+
+ echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+-echo "configure:1525: checking whether we are using GNU C" >&5
++echo "configure:1531: checking whether we are using GNU C" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -1531,5 +1537,5 @@
+ #endif
+ EOF
+-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1534: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
++if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1540: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+ else
+@@ -1550,5 +1556,5 @@
+ CFLAGS=
+ echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+-echo "configure:1553: checking whether ${CC-cc} accepts -g" >&5
++echo "configure:1559: checking whether ${CC-cc} accepts -g" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -1586,5 +1592,5 @@
+ set dummy $ac_prog; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1589: checking for $ac_word" >&5
++echo "configure:1595: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -1618,5 +1624,5 @@
+
+ echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+-echo "configure:1621: checking how to run the C preprocessor" >&5
++echo "configure:1627: checking how to run the C preprocessor" >&5
+ # On Suns, sometimes $CPP names a directory.
+ if test -n "$CPP" && test -d "$CPP"; then
+@@ -1633,5 +1639,5 @@
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+-#line 1636 "configure"
++#line 1642 "configure"
+ #include "confdefs.h"
+ #include <assert.h>
+@@ -1639,5 +1645,5 @@
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1642: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:1648: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+@@ -1650,5 +1656,5 @@
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+-#line 1653 "configure"
++#line 1659 "configure"
+ #include "confdefs.h"
+ #include <assert.h>
+@@ -1656,5 +1662,5 @@
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1659: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:1665: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+@@ -1667,5 +1673,5 @@
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+-#line 1670 "configure"
++#line 1676 "configure"
+ #include "confdefs.h"
+ #include <assert.h>
+@@ -1673,5 +1679,5 @@
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1676: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:1682: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+@@ -1698,10 +1704,10 @@
+
+ echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+-echo "configure:1701: checking for ANSI C header files" >&5
++echo "configure:1707: checking for ANSI C header files" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 1706 "configure"
++#line 1712 "configure"
+ #include "confdefs.h"
+ #include <stdlib.h>
+@@ -1711,5 +1717,5 @@
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:1720: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+@@ -1728,5 +1734,5 @@
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat > conftest.$ac_ext <<EOF
+-#line 1731 "configure"
++#line 1737 "configure"
+ #include "confdefs.h"
+ #include <string.h>
+@@ -1746,5 +1752,5 @@
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat > conftest.$ac_ext <<EOF
+-#line 1749 "configure"
++#line 1755 "configure"
+ #include "confdefs.h"
+ #include <stdlib.h>
+@@ -1767,5 +1773,5 @@
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 1770 "configure"
++#line 1776 "configure"
+ #include "confdefs.h"
+ #include <ctype.h>
+@@ -1778,5 +1784,5 @@
+
+ EOF
+-if { (eval echo configure:1781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
++if { (eval echo configure:1787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ :
+@@ -1806,15 +1812,15 @@
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+-echo "configure:1809: checking for $ac_hdr" >&5
++echo "configure:1815: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 1814 "configure"
++#line 1820 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1819: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:1825: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+@@ -1844,10 +1850,10 @@
+
+ echo $ac_n "checking for working const""... $ac_c" 1>&6
+-echo "configure:1847: checking for working const" >&5
++echo "configure:1853: checking for working const" >&5
+ if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 1852 "configure"
++#line 1858 "configure"
+ #include "confdefs.h"
+
+@@ -1898,5 +1904,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:1907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_const=yes
+@@ -1919,5 +1925,5 @@
+
+ echo $ac_n "checking for inline""... $ac_c" 1>&6
+-echo "configure:1922: checking for inline" >&5
++echo "configure:1928: checking for inline" >&5
+ if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -1926,5 +1932,5 @@
+ for ac_kw in inline __inline__ __inline; do
+ cat > conftest.$ac_ext <<EOF
+-#line 1929 "configure"
++#line 1935 "configure"
+ #include "confdefs.h"
+
+@@ -1933,5 +1939,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1936: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:1942: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_inline=$ac_kw; break
+@@ -1959,10 +1965,10 @@
+
+ echo $ac_n "checking for size_t""... $ac_c" 1>&6
+-echo "configure:1962: checking for size_t" >&5
++echo "configure:1968: checking for size_t" >&5
+ if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 1967 "configure"
++#line 1973 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+@@ -1992,10 +1998,10 @@
+
+ echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+-echo "configure:1995: checking whether time.h and sys/time.h may both be included" >&5
++echo "configure:2001: checking whether time.h and sys/time.h may both be included" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 2000 "configure"
++#line 2006 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+@@ -2006,5 +2012,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2009: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:2015: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_header_time=yes
+@@ -2043,5 +2049,5 @@
+ CC="gcc"
+ echo $ac_n "checking which NetBSD thread library to use""... $ac_c" 1>&6
+-echo "configure:2046: checking which NetBSD thread library to use" >&5
++echo "configure:2052: checking which NetBSD thread library to use" >&5
+
+ # Check whether --with-ptl2 or --without-ptl2 was given.
+@@ -2082,5 +2088,5 @@
+ *)
+ echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
+-echo "configure:2085: checking for pthread_create in -lpthread" >&5
++echo "configure:2091: checking for pthread_create in -lpthread" >&5
+ ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+@@ -2090,5 +2096,5 @@
+ LIBS="-lpthread $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 2093 "configure"
++#line 2099 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+@@ -2101,5 +2107,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+@@ -2127,5 +2133,5 @@
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for __pthread_create in -lpthread""... $ac_c" 1>&6
+-echo "configure:2130: checking for __pthread_create in -lpthread" >&5
++echo "configure:2136: checking for __pthread_create in -lpthread" >&5
+ ac_lib_var=`echo pthread'_'__pthread_create | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+@@ -2135,5 +2141,5 @@
+ LIBS="-lpthread $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 2138 "configure"
++#line 2144 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+@@ -2146,5 +2152,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+@@ -2174,5 +2180,5 @@
+
+ echo $ac_n "checking for __pthread_create_system in -lpthread""... $ac_c" 1>&6
+-echo "configure:2177: checking for __pthread_create_system in -lpthread" >&5
++echo "configure:2183: checking for __pthread_create_system in -lpthread" >&5
+ ac_lib_var=`echo pthread'_'__pthread_create_system | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+@@ -2182,5 +2188,5 @@
+ LIBS="-lpthread $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 2185 "configure"
++#line 2191 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+@@ -2193,5 +2199,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+@@ -2221,5 +2227,5 @@
+
+ echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
+-echo "configure:2224: checking for pthread_create in -lpthreads" >&5
++echo "configure:2230: checking for pthread_create in -lpthreads" >&5
+ ac_lib_var=`echo pthreads'_'pthread_create | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+@@ -2229,5 +2235,5 @@
+ LIBS="-lpthreads $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 2232 "configure"
++#line 2238 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+@@ -2240,5 +2246,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+@@ -2276,5 +2282,5 @@
+ #
+ echo $ac_n "checking for sigwait in -lc""... $ac_c" 1>&6
+-echo "configure:2279: checking for sigwait in -lc" >&5
++echo "configure:2285: checking for sigwait in -lc" >&5
+ ac_lib_var=`echo c'_'sigwait | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+@@ -2284,5 +2290,5 @@
+ LIBS="-lc $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 2287 "configure"
++#line 2293 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+@@ -2295,5 +2301,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+@@ -2317,5 +2323,5 @@
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for sigwait in -lpthread""... $ac_c" 1>&6
+-echo "configure:2320: checking for sigwait in -lpthread" >&5
++echo "configure:2326: checking for sigwait in -lpthread" >&5
+ ac_lib_var=`echo pthread'_'sigwait | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+@@ -2325,5 +2331,5 @@
+ LIBS="-lpthread $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 2328 "configure"
++#line 2334 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+@@ -2336,5 +2342,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+@@ -2358,5 +2364,5 @@
+ echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for _Psigwait in -lpthread""... $ac_c" 1>&6
+-echo "configure:2361: checking for _Psigwait in -lpthread" >&5
++echo "configure:2367: checking for _Psigwait in -lpthread" >&5
+ ac_lib_var=`echo pthread'_'_Psigwait | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+@@ -2366,5 +2372,5 @@
+ LIBS="-lpthread $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 2369 "configure"
++#line 2375 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+@@ -2377,5 +2383,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+@@ -2415,5 +2421,5 @@
+ *-freebsd*)
+ echo $ac_n "checking for sigwait in -lc_r""... $ac_c" 1>&6
+-echo "configure:2418: checking for sigwait in -lc_r" >&5
++echo "configure:2424: checking for sigwait in -lc_r" >&5
+ ac_lib_var=`echo c_r'_'sigwait | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+@@ -2423,5 +2429,5 @@
+ LIBS="-lc_r $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 2426 "configure"
++#line 2432 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+@@ -2434,5 +2440,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2443: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+@@ -2489,10 +2495,10 @@
+
+ echo $ac_n "checking for pthread_setconcurrency""... $ac_c" 1>&6
+-echo "configure:2492: checking for pthread_setconcurrency" >&5
++echo "configure:2498: checking for pthread_setconcurrency" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_pthread_setconcurrency'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 2497 "configure"
++#line 2503 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+@@ -2517,5 +2523,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_pthread_setconcurrency=yes"
+@@ -2555,10 +2561,10 @@
+ #
+ echo $ac_n "checking for sysconf""... $ac_c" 1>&6
+-echo "configure:2558: checking for sysconf" >&5
++echo "configure:2564: checking for sysconf" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_sysconf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 2563 "configure"
++#line 2569 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+@@ -2583,5 +2589,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_sysconf=yes"
+@@ -2679,10 +2685,10 @@
+ #
+ echo $ac_n "checking for flockfile""... $ac_c" 1>&6
+-echo "configure:2682: checking for flockfile" >&5
++echo "configure:2688: checking for flockfile" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_flockfile'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 2687 "configure"
++#line 2693 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+@@ -2707,5 +2713,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_flockfile=yes"
+@@ -2734,10 +2740,10 @@
+ #
+ echo $ac_n "checking for catgets""... $ac_c" 1>&6
+-echo "configure:2737: checking for catgets" >&5
++echo "configure:2743: checking for catgets" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 2742 "configure"
++#line 2748 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+@@ -2762,5 +2768,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_catgets=yes"
+@@ -2800,5 +2806,5 @@
+ *)
+ echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
+-echo "configure:2803: checking for socket in -lsocket" >&5
++echo "configure:2809: checking for socket in -lsocket" >&5
+ ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+@@ -2808,5 +2814,5 @@
+ LIBS="-lsocket $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 2811 "configure"
++#line 2817 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+@@ -2819,5 +2825,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+@@ -2847,5 +2853,5 @@
+
+ echo $ac_n "checking for inet_ntoa in -lnsl""... $ac_c" 1>&6
+-echo "configure:2850: checking for inet_ntoa in -lnsl" >&5
++echo "configure:2856: checking for inet_ntoa in -lnsl" >&5
+ ac_lib_var=`echo nsl'_'inet_ntoa | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+@@ -2855,5 +2861,5 @@
+ LIBS="-lnsl $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 2858 "configure"
++#line 2864 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error. */
+@@ -2866,5 +2872,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+@@ -3017,5 +3023,5 @@
+
+ echo $ac_n "checking build system type""... $ac_c" 1>&6
+-echo "configure:3020: checking build system type" >&5
++echo "configure:3026: checking build system type" >&5
+
+ build_alias=$build
+@@ -3046,5 +3052,5 @@
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
+-echo "configure:3049: checking for ld used by GCC" >&5
++echo "configure:3055: checking for ld used by GCC" >&5
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+@@ -3070,8 +3076,8 @@
+ elif test "$with_gnu_ld" = yes; then
+ echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
+-echo "configure:3073: checking for GNU ld" >&5
++echo "configure:3079: checking for GNU ld" >&5
+ else
+ echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+-echo "configure:3076: checking for non-GNU ld" >&5
++echo "configure:3082: checking for non-GNU ld" >&5
+ fi
+ if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
+@@ -3108,5 +3114,5 @@
+ test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+ echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
+-echo "configure:3111: checking if the linker ($LD) is GNU ld" >&5
++echo "configure:3117: checking if the linker ($LD) is GNU ld" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -3124,5 +3130,5 @@
+
+ echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
+-echo "configure:3127: checking for BSD-compatible nm" >&5
++echo "configure:3133: checking for BSD-compatible nm" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -3160,5 +3166,5 @@
+
+ echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+-echo "configure:3163: checking whether ln -s works" >&5
++echo "configure:3169: checking whether ln -s works" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -3209,6 +3215,6 @@
+ *-*-irix6*)
+ # Find out which ABI we are using.
+- echo '#line 3212 "configure"' > conftest.$ac_ext
+- if { (eval echo configure:3213: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++ echo '#line 3218 "configure"' > conftest.$ac_ext
++ if { (eval echo configure:3219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+@@ -3231,10 +3237,10 @@
+ CFLAGS="$CFLAGS -belf"
+ echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+-echo "configure:3234: checking whether the C compiler needs -belf" >&5
++echo "configure:3240: checking whether the C compiler needs -belf" >&5
+ if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 3239 "configure"
++#line 3245 "configure"
+ #include "confdefs.h"
+
+@@ -3243,5 +3249,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:3252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=yes
+@@ -3394,7 +3400,7 @@
+ #
+ echo $ac_n "checking for IPv6 structures""... $ac_c" 1>&6
+-echo "configure:3397: checking for IPv6 structures" >&5
++echo "configure:3403: checking for IPv6 structures" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3399 "configure"
++#line 3405 "configure"
+ #include "confdefs.h"
+
+@@ -3406,5 +3412,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3409: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:3415: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -3424,5 +3430,5 @@
+ #
+ echo $ac_n "checking for Kame IPv6 support""... $ac_c" 1>&6
+-echo "configure:3427: checking for Kame IPv6 support" >&5
++echo "configure:3433: checking for Kame IPv6 support" >&5
+ # Check whether --with-kame or --without-kame was given.
+ if test "${with_kame+set}" = set; then
+@@ -3514,7 +3520,7 @@
+
+ echo $ac_n "checking for in6addr_any""... $ac_c" 1>&6
+-echo "configure:3517: checking for in6addr_any" >&5
++echo "configure:3523: checking for in6addr_any" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3519 "configure"
++#line 3525 "configure"
+ #include "confdefs.h"
+
+@@ -3527,5 +3533,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:3536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -3543,7 +3549,7 @@
+
+ echo $ac_n "checking for sin6_scope_id in struct sockaddr_in6""... $ac_c" 1>&6
+-echo "configure:3546: checking for sin6_scope_id in struct sockaddr_in6" >&5
++echo "configure:3552: checking for sin6_scope_id in struct sockaddr_in6" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3548 "configure"
++#line 3554 "configure"
+ #include "confdefs.h"
+
+@@ -3558,5 +3564,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3561: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:3567: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -3573,7 +3579,7 @@
+
+ echo $ac_n "checking for in6_pktinfo""... $ac_c" 1>&6
+-echo "configure:3576: checking for in6_pktinfo" >&5
++echo "configure:3582: checking for in6_pktinfo" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3578 "configure"
++#line 3584 "configure"
+ #include "confdefs.h"
+
+@@ -3588,5 +3594,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3591: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:3597: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -3638,7 +3644,7 @@
+ #
+ echo $ac_n "checking for inet_ntop""... $ac_c" 1>&6
+-echo "configure:3641: checking for inet_ntop" >&5
++echo "configure:3647: checking for inet_ntop" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3643 "configure"
++#line 3649 "configure"
+ #include "confdefs.h"
+
+@@ -3650,5 +3656,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:3659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -3665,7 +3671,7 @@
+ rm -f conftest*
+ echo $ac_n "checking for inet_pton""... $ac_c" 1>&6
+-echo "configure:3668: checking for inet_pton" >&5
++echo "configure:3674: checking for inet_pton" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3670 "configure"
++#line 3676 "configure"
+ #include "confdefs.h"
+
+@@ -3677,5 +3683,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:3686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -3692,7 +3698,7 @@
+ rm -f conftest*
+ echo $ac_n "checking for inet_aton""... $ac_c" 1>&6
+-echo "configure:3695: checking for inet_aton" >&5
++echo "configure:3701: checking for inet_aton" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3697 "configure"
++#line 3703 "configure"
+ #include "confdefs.h"
+
+@@ -3704,5 +3710,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:3713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -3737,7 +3743,7 @@
+
+ echo $ac_n "checking for sa_len in struct sockaddr""... $ac_c" 1>&6
+-echo "configure:3740: checking for sa_len in struct sockaddr" >&5
++echo "configure:3746: checking for sa_len in struct sockaddr" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3742 "configure"
++#line 3748 "configure"
+ #include "confdefs.h"
+
+@@ -3748,5 +3754,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:3757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -3769,7 +3775,7 @@
+ #
+ echo $ac_n "checking for struct msghdr flavor""... $ac_c" 1>&6
+-echo "configure:3772: checking for struct msghdr flavor" >&5
++echo "configure:3778: checking for struct msghdr flavor" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3774 "configure"
++#line 3780 "configure"
+ #include "confdefs.h"
+
+@@ -3780,5 +3786,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3783: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:3789: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""4.4BSD" 1>&6
+@@ -3798,7 +3804,7 @@
+ #
+ echo $ac_n "checking for type in_port_t""... $ac_c" 1>&6
+-echo "configure:3801: checking for type in_port_t" >&5
++echo "configure:3807: checking for type in_port_t" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3803 "configure"
++#line 3809 "configure"
+ #include "confdefs.h"
+
+@@ -3809,5 +3815,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3812: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:3818: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -3827,7 +3833,7 @@
+ #
+ echo $ac_n "checking for struct addrinfo""... $ac_c" 1>&6
+-echo "configure:3830: checking for struct addrinfo" >&5
++echo "configure:3836: checking for struct addrinfo" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3832 "configure"
++#line 3838 "configure"
+ #include "confdefs.h"
+
+@@ -3837,5 +3843,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:3846: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -3856,7 +3862,7 @@
+
+ echo $ac_n "checking for int sethostent""... $ac_c" 1>&6
+-echo "configure:3859: checking for int sethostent" >&5
++echo "configure:3865: checking for int sethostent" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3861 "configure"
++#line 3867 "configure"
+ #include "confdefs.h"
+
+@@ -3866,5 +3872,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:3875: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -3881,7 +3887,7 @@
+
+ echo $ac_n "checking for int endhostent""... $ac_c" 1>&6
+-echo "configure:3884: checking for int endhostent" >&5
++echo "configure:3890: checking for int endhostent" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3886 "configure"
++#line 3892 "configure"
+ #include "confdefs.h"
+
+@@ -3891,5 +3897,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:3900: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -3906,7 +3912,7 @@
+
+ echo $ac_n "checking for getnetbyaddr(in_addr_t, ...)""... $ac_c" 1>&6
+-echo "configure:3909: checking for getnetbyaddr(in_addr_t, ...)" >&5
++echo "configure:3915: checking for getnetbyaddr(in_addr_t, ...)" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3911 "configure"
++#line 3917 "configure"
+ #include "confdefs.h"
+
+@@ -3917,5 +3923,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3920: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:3926: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -3932,7 +3938,7 @@
+
+ echo $ac_n "checking for int setnetent""... $ac_c" 1>&6
+-echo "configure:3935: checking for int setnetent" >&5
++echo "configure:3941: checking for int setnetent" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3937 "configure"
++#line 3943 "configure"
+ #include "confdefs.h"
+
+@@ -3942,5 +3948,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3945: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:3951: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -3957,7 +3963,7 @@
+
+ echo $ac_n "checking for int endnetent""... $ac_c" 1>&6
+-echo "configure:3960: checking for int endnetent" >&5
++echo "configure:3966: checking for int endnetent" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3962 "configure"
++#line 3968 "configure"
+ #include "confdefs.h"
+
+@@ -3967,5 +3973,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3970: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:3976: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -3982,7 +3988,7 @@
+
+ echo $ac_n "checking for gethostbyaddr(const void *, size_t, ...)""... $ac_c" 1>&6
+-echo "configure:3985: checking for gethostbyaddr(const void *, size_t, ...)" >&5
++echo "configure:3991: checking for gethostbyaddr(const void *, size_t, ...)" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3987 "configure"
++#line 3993 "configure"
+ #include "confdefs.h"
+
+@@ -3993,5 +3999,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:4002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -4008,7 +4014,7 @@
+
+ echo $ac_n "checking for h_errno in netdb.h""... $ac_c" 1>&6
+-echo "configure:4011: checking for h_errno in netdb.h" >&5
++echo "configure:4017: checking for h_errno in netdb.h" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 4013 "configure"
++#line 4019 "configure"
+ #include "confdefs.h"
+
+@@ -4018,5 +4024,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:4021: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:4027: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+@@ -4033,10 +4039,10 @@
+
+ echo $ac_n "checking for getipnodebyname""... $ac_c" 1>&6
+-echo "configure:4036: checking for getipnodebyname" >&5
++echo "configure:4042: checking for getipnodebyname" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_getipnodebyname'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 4041 "configure"
++#line 4047 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+@@ -4061,5 +4067,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:4064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:4070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_getipnodebyname=yes"
+@@ -4082,10 +4088,10 @@
+
+ echo $ac_n "checking for getnameinfo""... $ac_c" 1>&6
+-echo "configure:4085: checking for getnameinfo" >&5
++echo "configure:4091: checking for getnameinfo" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_getnameinfo'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 4090 "configure"
++#line 4096 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+@@ -4110,5 +4116,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:4113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:4119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_getnameinfo=yes"
+@@ -4131,10 +4137,10 @@
+
+ echo $ac_n "checking for getaddrinfo""... $ac_c" 1>&6
+-echo "configure:4134: checking for getaddrinfo" >&5
++echo "configure:4140: checking for getaddrinfo" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_getaddrinfo'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 4139 "configure"
++#line 4145 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+@@ -4159,5 +4165,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:4162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:4168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_getaddrinfo=yes"
+@@ -4191,7 +4197,7 @@
+ #
+ echo $ac_n "checking for interface list sysctl""... $ac_c" 1>&6
+-echo "configure:4194: checking for interface list sysctl" >&5
++echo "configure:4200: checking for interface list sysctl" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 4196 "configure"
++#line 4202 "configure"
+ #include "confdefs.h"
+
+@@ -4223,10 +4229,10 @@
+ #
+ echo $ac_n "checking for strsep""... $ac_c" 1>&6
+-echo "configure:4226: checking for strsep" >&5
++echo "configure:4232: checking for strsep" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_strsep'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 4231 "configure"
++#line 4237 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+@@ -4251,5 +4257,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:4254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:4260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_strsep=yes"
+@@ -4272,10 +4278,10 @@
+
+ echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6
+-echo "configure:4275: checking for vsnprintf" >&5
++echo "configure:4281: checking for vsnprintf" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_vsnprintf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 4280 "configure"
++#line 4286 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+@@ -4300,5 +4306,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:4303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:4309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_vsnprintf=yes"
+@@ -4329,5 +4335,5 @@
+
+ echo $ac_n "checking for sizeof(long long int) == sizeof(long int)""... $ac_c" 1>&6
+-echo "configure:4332: checking for sizeof(long long int) == sizeof(long int)" >&5
++echo "configure:4338: checking for sizeof(long long int) == sizeof(long int)" >&5
+ if test "$cross_compiling" = yes; then
+ echo "$ac_t""default yes" 1>&6
+@@ -4335,9 +4341,9 @@
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 4338 "configure"
++#line 4344 "configure"
+ #include "confdefs.h"
+ main() { exit(!(sizeof(long long int) == sizeof(long int))); }
+ EOF
+-if { (eval echo configure:4342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
++if { (eval echo configure:4348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+ echo "$ac_t""yes" 1>&6
+@@ -4359,10 +4365,10 @@
+ #
+ echo $ac_n "checking for chroot""... $ac_c" 1>&6
+-echo "configure:4362: checking for chroot" >&5
++echo "configure:4368: checking for chroot" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_chroot'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 4367 "configure"
++#line 4373 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+@@ -4387,5 +4393,5 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:4390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:4396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_chroot=yes"
+@@ -4413,15 +4419,15 @@
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+-echo "configure:4416: checking for $ac_hdr" >&5
++echo "configure:4422: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 4421 "configure"
++#line 4427 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:4426: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:4432: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+@@ -4453,15 +4459,15 @@
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+-echo "configure:4456: checking for $ac_hdr" >&5
++echo "configure:4462: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 4461 "configure"
++#line 4467 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:4466: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:4472: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+@@ -4568,5 +4574,5 @@
+ set dummy $ac_prog; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:4571: checking for $ac_word" >&5
++echo "configure:4577: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_JADE'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+@@ -4614,5 +4620,5 @@
+
+ echo $ac_n "checking for SGML files""... $ac_c" 1>&6
+-echo "configure:4617: checking for SGML files" >&5
++echo "configure:4623: checking for SGML files" >&5
+ for d in /usr/pkg/share/sgml /usr/local/share/sgml
+ do
+@@ -4640,5 +4646,5 @@
+
+ echo $ac_n "checking for XML files""... $ac_c" 1>&6
+-echo "configure:4643: checking for XML files" >&5
++echo "configure:4649: checking for XML files" >&5
+ for d in /usr/pkg/share/xml /usr/local/share/xml
+ do
+@@ -4657,4 +4663,163 @@
+ fi
+
++
++
++#
++# MDN support
++#
++# Check whether --with-mdn or --without-mdn was given.
++if test "${with_mdn+set}" = set; then
++ withval="$with_mdn"
++ use_mdn="$withval"
++else
++ use_mdn="no"
++fi
++
++case "$use_mdn" in
++yes)
++ mdn_path=/usr/local
++ ;;
++no)
++ ;;
++*)
++ mdn_path="$use_mdn"
++ ;;
++esac
++
++# Check whether --with-iconv or --without-iconv was given.
++if test "${with_iconv+set}" = set; then
++ withval="$with_iconv"
++ iconvlib="$withval"
++else
++ iconvlib="no"
++fi
++
++case "$iconvlib" in
++no)
++ iconvlib=
++ ;;
++yes)
++ iconvlib=-liconv
++ ;;
++esac
++
++# Check whether --with-mdnlib or --without-mdnlib was given.
++if test "${with_mdnlib+set}" = set; then
++ withval="$with_mdnlib"
++ mdnlib="$withval"
++else
++ mdnlib="no"
++fi
++
++if test "$mdnlib" = yes; then
++ { echo "configure: error: You must specify ARG for --with-mdnlib." 1>&2; exit 1; }
++fi
++
++if test "$use_mdn" != no; then
++ cat >> confdefs.h <<\EOF
++#define WITH_MDN 1
++EOF
++
++ STD_CINCLUDES="$STD_CINCLUDES -I$mdn_path/include"
++ if test "$mdnlib" != no; then
++ LIBS="$mdnlib $iconvlib $LIBS"
++ else
++ LIBS="-L$mdn_path/lib -lmdn $iconvlib $LIBS"
++ fi
++fi
++for ac_hdr in locale.h
++do
++ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
++echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
++echo "configure:4735: checking for $ac_hdr" >&5
++if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
++ echo $ac_n "(cached) $ac_c" 1>&6
++else
++ cat > conftest.$ac_ext <<EOF
++#line 4740 "configure"
++#include "confdefs.h"
++#include <$ac_hdr>
++EOF
++ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
++{ (eval echo configure:4745: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
++if test -z "$ac_err"; then
++ rm -rf conftest*
++ eval "ac_cv_header_$ac_safe=yes"
++else
++ echo "$ac_err" >&5
++ echo "configure: failed program was:" >&5
++ cat conftest.$ac_ext >&5
++ rm -rf conftest*
++ eval "ac_cv_header_$ac_safe=no"
++fi
++rm -f conftest*
++fi
++if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
++ echo "$ac_t""yes" 1>&6
++ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
++ cat >> confdefs.h <<EOF
++#define $ac_tr_hdr 1
++EOF
++
++else
++ echo "$ac_t""no" 1>&6
++fi
++done
++
++for ac_func in setlocale
++do
++echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
++echo "configure:4774: checking for $ac_func" >&5
++if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
++ echo $ac_n "(cached) $ac_c" 1>&6
++else
++ cat > conftest.$ac_ext <<EOF
++#line 4779 "configure"
++#include "confdefs.h"
++/* System header to define __stub macros and hopefully few prototypes,
++ which can conflict with char $ac_func(); below. */
++#include <assert.h>
++/* Override any gcc2 internal prototype to avoid an error. */
++/* We use char because int might match the return type of a gcc2
++ builtin and then its argument prototype would still apply. */
++char $ac_func();
++
++int main() {
++
++/* The GNU C library defines this for functions which it implements
++ to always fail with ENOSYS. Some functions are actually named
++ something starting with __ and the normal name is an alias. */
++#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
++choke me
++#else
++$ac_func();
++#endif
++
++; return 0; }
++EOF
++if { (eval echo configure:4802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++ rm -rf conftest*
++ eval "ac_cv_func_$ac_func=yes"
++else
++ echo "configure: failed program was:" >&5
++ cat conftest.$ac_ext >&5
++ rm -rf conftest*
++ eval "ac_cv_func_$ac_func=no"
++fi
++rm -f conftest*
++fi
++
++if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
++ echo "$ac_t""yes" 1>&6
++ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
++ cat >> confdefs.h <<EOF
++#define $ac_tr_func 1
++EOF
++
++else
++ echo "$ac_t""no" 1>&6
++fi
++done
+
+
diff --git a/contrib/idn/mdnkit/patch/bind9/patch.most b/contrib/idn/mdnkit/patch/bind9/patch.most
new file mode 100644
index 00000000..3ed4250b
--- /dev/null
+++ b/contrib/idn/mdnkit/patch/bind9/patch.most
@@ -0,0 +1,2177 @@
+--- ./README.mdnkit.orig Thu Dec 21 10:53:17 2000
++++ ./README.mdnkit Thu Dec 21 10:53:17 2000
+@@ -0,0 +1,110 @@
++
++ BIND-9 MDN patch
++
++ Japan Network Information Center (JPNIC)
++
++
++* What is this patch for?
++
++This patch adds multilingual domain name (MDN) support to BIND-9.
++You'll get multilingualized version of light weight resolver and
++dig/host/nslookup commands.
++
++ + multilingualized version of light weight resolver
++ The following APIs accept non-ASCII host name encoded in the
++ local codeset (such as Shift JIS, Big5 or ISO8859-1)
++ determined by the application's current locale, and return
++ host names in the local codeset.
++ lwres_gethostbyname
++ lwres_gethostbyname_r
++ lwres_gethostbyname2
++ lwres_getipnodebyname
++ lwres_getaddrinfo
++ lwres_gethostbyaddr
++ lwres_gethostbyaddr_r
++ lwres_getipnodebyaddr
++ lwres_getnameinfo
++
++ + mulltilingualized dig/host/nslookup
++ dig/host/nslookup accepts non-ASCII domain names in the local
++ codeset. The domain names are normalized and converted to the
++ encoding on the DNS protocol, and sent to DNS servers. The
++ replies are converted back to the local codeset and displayed.
++
++
++* Compilation & installation
++
++0. Prerequisite
++
++You have to build and install mDNkit before building this patched version
++of bind-9.
++
++1. Running configure script
++
++Run `configure' in the top directory. See `README' for the
++configuration options.
++
++This patch adds the following 3 options to `configure'. You should
++at least specify `--with-mdn' option to enable MDN support.
++
++ --with-mdn[=PREFIX]
++ To enable MDN support, you have to specify `--with-mdn'
++ option. If you specified installation prefix other than
++ `/usr/local' (which is the default) when conifguring mDNkit,
++ also specify the prefix, like `--with-mdn=/usr/local/mdnkit'.
++
++ --with-iconv=LIBSPEC
++ If your libc doens't provide iconv(), you need to specify the
++ library containing iconv() with this option. `LIBSPEC' is the
++ argument(s) to `cc' or `ld' to link the library, for example,
++ `--with-iconv="-L/usr/local/lib -liconv"'.
++ You don't need to specify the header file directory for "iconv.h"
++ to the compiler, as it isn't included directly by bind-9 with
++ this patch.
++
++ --with-mdnlib=LIBSPEC
++ With this option, you can explicitly specify the argument(s)
++ to `cc' or `ld' to link the mDNkit's library, `libmdn'. If
++ this option is not specified, `-L${PREFIX}/lib -lmdn' is
++ assumed, where ${PREFIX} is the installation prefix specified
++ with `--with-mdn' option above. You may need to use this
++ option to specify extra argments, for example,
++ `--with-mdnlib="-L/usr/local/lib -R/usr/local/lib -lmdn"'.
++
++Please consult `README' for other configuration options.
++
++Note that if you want to specify some extra header file directories,
++you should use the environment variable STD_CINCLUDES instead of
++CFLAGS, as described in README.
++
++2. Compilation and installation
++
++After running "configure", just do
++
++ make
++ make install
++
++for compiling and installing.
++
++3. Resolver configuration
++
++To handle multilingual domain names, you have to specify the
++properties like:
++ + name encoding used in DNS protocol data
++ + normalization schemes
++These properties are specified by the mDNkit's resolver configuration
++file, "mdnres.conf". You have to create and set up the file properly.
++The pathname of the file and contents are described in the manual
++"mdnres.conf".
++
++
++* Contact information
++
++Please see http//www.nic.ad.jp/jp/research/idn/ for the latest news
++about mDNkit and this patch.
++
++Bug reports and comments on this kit should be sent to
++mdnkit-bugs@nic.ad.jp and idn-cmt@nic.ad.jp, respectively.
++
++
++; $Id: patch.most,v 1.2 2000/12/21 17:37:39 tale Exp $
+--- ./acconfig.h.orig Thu Dec 21 10:46:01 2000
++++ ./acconfig.h Thu Dec 21 10:53:17 2000
+@@ -110,4 +110,7 @@
+ #endif /* SHUTUP_STDARG_CAST && __GNUC__ */
+
++/* define if mDNkit support is to be included. */
++#undef WITH_MDN
++
+ /* define if the system has a random number generating device */
+ #undef PATH_RANDOMDEV
+--- ./config.h.in.orig Thu Dec 21 10:46:01 2000
++++ ./config.h.in Thu Dec 21 10:53:17 2000
+@@ -124,4 +124,10 @@
+ #undef PATH_RANDOMDEV
+
++/* define if mDNkit support is to be included. */
++#undef WITH_MDN
++
++/* Define if you have the setlocale function. */
++#undef HAVE_SETLOCALE
++
+ /* Define if you have the <fcntl.h> header file. */
+ #undef HAVE_FCNTL_H
+@@ -132,4 +138,7 @@
+ /* Define if you have the <linux/prctl.h> header file. */
+ #undef HAVE_LINUX_PRCTL_H
++
++/* Define if you have the <locale.h> header file. */
++#undef HAVE_LOCALE_H
+
+ /* Define if you have the <sys/sockio.h> header file. */
+--- ./configure.in.orig Thu Dec 21 10:46:00 2000
++++ ./configure.in Thu Dec 21 10:53:18 2000
+@@ -1176,4 +1176,52 @@
+
+ #
++# MDN support
++#
++AC_ARG_WITH(mdn,
++ [ --with-mdn[=PREFIX] enable MDN support using mDNkit [default prefix /usr/local]],
++ use_mdn="$withval", use_mdn="no")
++case "$use_mdn" in
++yes)
++ mdn_path=/usr/local
++ ;;
++no)
++ ;;
++*)
++ mdn_path="$use_mdn"
++ ;;
++esac
++
++AC_ARG_WITH(iconv,
++ [ --with-iconv[=LIBSPEC] specify iconv library [default -liconv]],
++ iconvlib="$withval", iconvlib="no")
++case "$iconvlib" in
++no)
++ iconvlib=
++ ;;
++yes)
++ iconvlib=-liconv
++ ;;
++esac
++
++AC_ARG_WITH(mdnlib,
++ [ --with-mdnlib=ARG specify libmdn],
++ mdnlib="$withval", mdnlib="no")
++if test "$mdnlib" = yes; then
++ AC_MSG_ERROR([You must specify ARG for --with-mdnlib.])
++fi
++
++if test "$use_mdn" != no; then
++ AC_DEFINE(WITH_MDN)
++ STD_CINCLUDES="$STD_CINCLUDES -I$mdn_path/include"
++ if test "$mdnlib" != no; then
++ LIBS="$mdnlib $iconvlib $LIBS"
++ else
++ LIBS="-L$mdn_path/lib -lmdn $iconvlib $LIBS"
++ fi
++fi
++AC_CHECK_HEADERS(locale.h)
++AC_CHECK_FUNCS(setlocale)
++
++#
+ # Substitutions
+ #
+--- ./lib/dns/config/confctx.c.orig Thu Dec 21 10:44:19 2000
++++ ./lib/dns/config/confctx.c Thu Dec 21 10:53:18 2000
+@@ -1038,4 +1038,7 @@
+ PRINT_AS_BOOLEAN(maintain_ixfr_base, "maintain-ixfr-base");
+ PRINT_AS_BOOLEAN(has_old_clients, "has-old-clients");
++#ifdef WITH_MDN
++ PRINT_AS_BOOLEAN(allow_utf8, "allow-utf8");
++#endif
+ PRINT_AS_BOOLEAN(auth_nx_domain, "auth-nxdomain");
+ PRINT_AS_BOOLEAN(multiple_cnames, "multiple-cnames");
+@@ -1573,4 +1576,7 @@
+ opts->maintain_ixfr_base = NULL;
+ opts->has_old_clients = NULL;
++#ifdef WITH_MDN
++ opts->allow_utf8 = NULL;
++#endif
+ opts->auth_nx_domain = NULL;
+ opts->multiple_cnames = NULL;
+@@ -1687,4 +1693,7 @@
+ FREEFIELD(maintain_ixfr_base);
+ FREEFIELD(has_old_clients);
++#ifdef WITH_MDN
++ FREEFIELD(allow_utf8);
++#endif
+ FREEFIELD(auth_nx_domain);
+ FREEFIELD(multiple_cnames);
+@@ -1864,4 +1873,7 @@
+ BOOL_FUNCS(maintainixfrbase, maintain_ixfr_base)
+ BOOL_FUNCS(hasoldclients, has_old_clients)
++#ifdef WITH_MDN
++BOOL_FUNCS(allowutf8, allow_utf8)
++#endif
+ BOOL_FUNCS(authnxdomain, auth_nx_domain)
+ BOOL_FUNCS(multiplecnames, multiple_cnames)
+--- ./lib/dns/config/confparser.y.orig Thu Dec 21 10:46:17 2000
++++ ./lib/dns/config/confparser.y Thu Dec 21 10:53:18 2000
+@@ -270,4 +270,5 @@
+ %token L_ALLOW_UPDATE
+ %token L_ALLOW_UPDATE_FORWARDING
++%token L_ALLOW_UTF8
+ %token L_ALSO_NOTIFY
+ %token L_AUTH_NXDOMAIN
+@@ -1718,4 +1719,19 @@
+ }
+ }
++ | L_ALLOW_UTF8 yea_or_nay
++ {
++#ifdef WITH_MDN
++ tmpres = dns_c_ctx_setallowutf8(currcfg, $2);
++ if (tmpres == ISC_R_EXISTS) {
++ parser_error(ISC_FALSE,
++ "cannot redefine allow-utf8");
++ YYABORT;
++ }
++#else
++ parser_error(ISC_FALSE, "must be configured with MDN"
++ "to use allow-utf8");
++ YYABORT;
++#endif
++ }
+ | L_ADDITIONAL_DATA additional_data
+ {
+@@ -6097,4 +6113,7 @@
+ { "allow-update", L_ALLOW_UPDATE },
+ { "allow-update-forwarding", L_ALLOW_UPDATE_FORWARDING },
++#ifdef WITH_MDN
++ { "allow-utf8", L_ALLOW_UTF8 },
++#endif
+ { "also-notify", L_ALSO_NOTIFY },
+ { "auth-nxdomain", L_AUTH_NXDOMAIN },
+--- ./lib/dns/include/dns/confctx.h.orig Thu Dec 21 10:44:45 2000
++++ ./lib/dns/include/dns/confctx.h Thu Dec 21 10:53:18 2000
+@@ -185,4 +185,7 @@
+ isc_sockaddr_t *transfer_source_v6;
+ isc_sockaddr_t *query_source;
++#ifdef WITH_MDN
++ isc_boolean_t *allow_utf8;
++#endif
+ isc_sockaddr_t *query_source_v6;
+
+@@ -630,4 +633,11 @@
+ isc_result_t dns_c_ctx_gettreatcrasspace(dns_c_ctx_t *cfg,
+ isc_boolean_t *retval);
++#ifdef WITH_MDN
++isc_result_t dns_c_ctx_setallowutf8(dns_c_ctx_t *cfg,
++ isc_boolean_t newval);
++isc_result_t dns_c_ctx_getallowutf8(dns_c_ctx_t *cfg,
++ isc_boolean_t *retval);
++isc_result_t dns_c_ctx_unsetallowutf8(dns_c_ctx_t *cfg);
++#endif
+
+
+--- ./lib/dns/include/dns/name.h.orig Thu Dec 21 10:44:34 2000
++++ ./lib/dns/include/dns/name.h Thu Dec 21 10:53:18 2000
+@@ -220,4 +220,15 @@
+ #define DNS_NAME_MAXWIRE 255
+
++#ifdef WITH_MDN
++/*
++ * Text output filter procedure.
++ * 'target' is the buffer to be converted. The region to be converted
++ * is from 'buffer'->base + 'used_org' to the end of the used region.
++ */
++typedef isc_result_t (*dns_name_totextfilter_t)(isc_buffer_t *target,
++ unsigned int used_org,
++ isc_boolean_t absolute);
++#endif
++
+ /***
+ *** Initialization
+@@ -1219,4 +1230,24 @@
+ *
+ */
++
++#ifdef WITH_MDN
++void
++dns_name_allowutf8(isc_boolean_t allowutf8);
++/*
++ * If 'allowutf8' is true, UTF-8 characters are not translated into
++ * backslash escape format (\DDD) by dns_name_totext().
++ *
++ * XXX:
++ * Setting this modifies the global state. Maybe there should be
++ * a way to set this for each name.
++ */
++
++void
++dns_name_settotextfilter(dns_name_totextfilter_t proc);
++/*
++ * Call 'proc' at the end of dns_name_totext.
++ */
++
++#endif /* WITH_MDN */
+
+ #define DNS_NAME_FORMATSIZE (DNS_NAME_MAXTEXT + 1)
+--- ./lib/dns/name.c.orig Thu Dec 21 10:45:44 2000
++++ ./lib/dns/name.c Thu Dec 21 12:14:44 2000
+@@ -32,4 +32,8 @@
+ #include <dns/compress.h>
+
++#ifdef WITH_MDN
++#include <mdn/utf8.h>
++#endif
++
+ #define VALID_NAME(n) ISC_MAGIC_VALID(n, DNS_NAME_MAGIC)
+
+@@ -206,4 +210,17 @@
+ dns_name_t *dns_wildcardname = &wild.name;
+
++#ifdef WITH_MDN
++/*
++ * If this flag is true, dns_name_totext() copies UTF-8 characters
++ * as is (ie not backslash-escaped form).
++ */
++static isc_boolean_t allow_utf8 = ISC_FALSE;
++
++/*
++ * dns_name_t to text post-conversion procedure.
++ */
++static dns_name_totextfilter_t totext_filter_proc = NULL;
++#endif
++
+ static void
+ set_offsets(const dns_name_t *name, unsigned char *offsets,
+@@ -1707,4 +1724,8 @@
+ isc_boolean_t saw_root = ISC_FALSE;
+ char num[4];
++#ifdef WITH_MDN
++ unsigned int oused = target->used;
++ unsigned int u8len;
++#endif
+
+ /*
+@@ -1802,4 +1823,18 @@
+ trem--;
+ nlen--;
++#ifdef WITH_MDN
++ } else if (c >= 0x80 &&
++ allow_utf8 &&
++ (u8len =
++ mdn_utf8_isvalidchar(ndata))
++ > 0 &&
++ u8len <= trem) {
++ memcpy(tdata, ndata, u8len);
++ ndata += u8len;
++ tdata += u8len;
++ trem -= u8len;
++ nlen -= u8len;
++ count -= u8len - 1;
++#endif
+ } else {
+ if (trem < 4)
+@@ -1883,4 +1918,8 @@
+ isc_buffer_add(target, tlen - trem);
+
++#ifdef WITH_MDN
++ if (totext_filter_proc != NULL)
++ return ((*totext_filter_proc)(target, oused, saw_root));
++#endif
+ return (ISC_R_SUCCESS);
+ }
+@@ -3169,2 +3208,14 @@
+ snprintf(cp, size, "<unknown>");
+ }
++
++#ifdef WITH_MDN
++void
++dns_name_allowutf8(isc_boolean_t allowutf8) {
++ allow_utf8 = allowutf8;
++}
++
++void
++dns_name_settotextfilter(dns_name_totextfilter_t proc) {
++ totext_filter_proc = proc;
++}
++#endif
+--- ./lib/lwres/getaddrinfo.c.orig Thu Dec 21 10:43:19 2000
++++ ./lib/lwres/getaddrinfo.c Thu Dec 21 10:53:18 2000
+@@ -54,4 +54,12 @@
+ #endif
+
++#ifdef WITH_MDN /* Add 'encodeflag' parameter to 3 functions. */
++static int add_ipv4(const char *hostname, int flags, struct addrinfo **aip,
++ int socktype, int port, int encodeflg);
++static int add_ipv6(const char *hostname, int flags, struct addrinfo **aip,
++ int socktype, int port, int encodeflg);
++static void set_order(int, int (**)(const char *, int, struct addrinfo **,
++ int, int, int));
++#else
+ static int add_ipv4(const char *hostname, int flags, struct addrinfo **aip,
+ int socktype, int port);
+@@ -60,4 +68,5 @@
+ static void set_order(int, int (**)(const char *, int, struct addrinfo **,
+ int, int));
++#endif /* WITH_MDN */
+
+ #define FOUND_IPV4 0x1
+@@ -67,7 +76,22 @@
+ #define ISC_AI_MASK (AI_PASSIVE|AI_CANONNAME|AI_NUMERICHOST)
+
++#ifdef WITH_MDN
+ int
+ lwres_getaddrinfo(const char *hostname, const char *servname,
++ const struct addrinfo *hints, struct addrinfo **res)
++{
++ /* The last parameter is a encoding type. Default is local encoding. */
++ return (lwres_getaddrinfo_enc(hostname, servname, hints, res, 0));
++}
++#endif /* WITH_MDN */
++
++int
++#ifdef WITH_MDN
++lwres_getaddrinfo_enc(const char *hostname, const char *servname,
++ const struct addrinfo *hints, struct addrinfo **res, int encodeflg)
++#else
++lwres_getaddrinfo(const char *hostname, const char *servname,
+ const struct addrinfo *hints, struct addrinfo **res)
++#endif /* WITH_MDN */
+ {
+ struct servent *sp;
+@@ -76,6 +100,11 @@
+ struct addrinfo *ai, *ai_list;
+ int port, err, i;
++#ifdef WITH_MDN
++ int (*net_order[FOUND_MAX+1])(const char *, int, struct addrinfo **,
++ int, int, int);
++#else
+ int (*net_order[FOUND_MAX+1])(const char *, int, struct addrinfo **,
+ int, int);
++#endif /* WITH_MDN */
+
+ if (hostname == NULL && servname == NULL)
+@@ -354,5 +383,9 @@
+ break;
+ err = (net_order[i])(hostname, flags, &ai_list,
++#ifdef WITH_MDN
++ socktype, port, encodeflg);
++#else
+ socktype, port);
++#endif
+ if (err != 0)
+ return (err);
+@@ -393,6 +426,11 @@
+
+ static void
++#ifdef WITH_MDN
++set_order(int family, int (**net_order)(const char *, int, struct addrinfo **,
++ int, int, int))
++#else
+ set_order(int family, int (**net_order)(const char *, int, struct addrinfo **,
+ int, int))
++#endif /* WITH_MDN */
+ {
+ char *order, *tok;
+@@ -452,6 +490,11 @@
+
+ static int
++#ifdef WITH_MDN
++add_ipv4(const char *hostname, int flags, struct addrinfo **aip,
++ int socktype, int port, int encodeflg)
++#else
+ add_ipv4(const char *hostname, int flags, struct addrinfo **aip,
+ int socktype, int port)
++#endif /* WITH_MDN */
+ {
+ struct addrinfo *ai;
+@@ -477,6 +520,12 @@
+ SIN(ai->ai_addr)->sin_port = port;
+ memcpy(&SIN(ai->ai_addr)->sin_addr, v4_loop, 4);
++#ifdef WITH_MDN
++ } else if (lwres_getaddrsbyname_enc(lwrctx, hostname,
++ LWRES_ADDRTYPE_V4,
++ &by, encodeflg) == 0) {
++#else
+ } else if (lwres_getaddrsbyname(lwrctx, hostname,
+ LWRES_ADDRTYPE_V4, &by) == 0) {
++#endif /* WITH_MDN */
+ addr = LWRES_LIST_HEAD(by->addrs);
+ while (addr != NULL) {
+@@ -512,6 +561,11 @@
+
+ static int
++#ifdef WITH_MDN
++add_ipv6(const char *hostname, int flags, struct addrinfo **aip,
++ int socktype, int port, int encodeflg)
++#else
+ add_ipv6(const char *hostname, int flags, struct addrinfo **aip,
+ int socktype, int port)
++#endif /* WITH_MDN */
+ {
+ struct addrinfo *ai;
+@@ -538,6 +592,12 @@
+ SIN6(ai->ai_addr)->sin6_port = port;
+ memcpy(&SIN6(ai->ai_addr)->sin6_addr, v6_loop, 16);
++#ifdef WITH_MDN
++ } else if (lwres_getaddrsbyname_enc(lwrctx, hostname,
++ LWRES_ADDRTYPE_V6,
++ &by, encodeflg) == 0) {
++#else
+ } else if (lwres_getaddrsbyname(lwrctx, hostname,
+ LWRES_ADDRTYPE_V6, &by) == 0) {
++#endif /* WITH_MDN */
+ addr = LWRES_LIST_HEAD(by->addrs);
+ while (addr != NULL) {
+--- ./lib/lwres/gethost.c.orig Thu Dec 21 10:43:17 2000
++++ ./lib/lwres/gethost.c Thu Dec 21 10:53:18 2000
+@@ -26,4 +26,7 @@
+ #include <string.h>
+
++#ifdef WITH_MDN
++#include <lwres/lwres.h>
++#endif /* WITH_MDN */
+ #include <lwres/netdb.h>
+
+@@ -37,30 +40,81 @@
+ static int copytobuf(struct hostent *, struct hostent *, char *, int);
+
++#ifdef WITH_MDN
+ struct hostent *
+ lwres_gethostbyname(const char *name) {
++ /* The last parameter is a encoding type. Default is local encoding. */
++ return (lwres_gethostbyname_enc(name, LWRES_ENCODING_LOCAL));
++}
++#endif /* WITH_MDN */
++
++struct hostent *
++#ifdef WITH_MDN
++lwres_gethostbyname_enc(const char *name, int encodeflg) {
++#else
++lwres_gethostbyname(const char *name) {
++#endif /* WITH_MDN */
+
+ if (he != NULL)
+ lwres_freehostent(he);
+
++#ifdef WITH_MDN
++ he = lwres_getipnodebyname_enc(name, AF_INET, 0, &lwres_h_errno,
++ encodeflg);
++#else
+ he = lwres_getipnodebyname(name, AF_INET, 0, &lwres_h_errno);
++#endif /* WITH_MDN */
+ return (he);
+ }
+
++#ifdef WITH_MDN
+ struct hostent *
+ lwres_gethostbyname2(const char *name, int af) {
++ /* The last parameter is a encoding type. Default is local encoding. */
++ return (lwres_gethostbyname2_enc(name, af, LWRES_ENCODING_LOCAL));
++}
++#endif /* WITH_MDN */
++
++struct hostent *
++#ifdef WITH_MDN
++lwres_gethostbyname2_enc(const char *name, int af, int encodeflg) {
++#else
++lwres_gethostbyname2(const char *name, int af) {
++#endif /* WITH_MDN */
+ if (he != NULL)
+ lwres_freehostent(he);
+
++#ifdef WITH_MDN
++ he = lwres_getipnodebyname_enc(name, af, 0, &lwres_h_errno, encodeflg);
++#else
+ he = lwres_getipnodebyname(name, af, 0, &lwres_h_errno);
++#endif /* WITH_MDN */
+ return (he);
+ }
+
++#ifdef WITH_MDN
++struct hostent *
++lwres_gethostbyaddr(const char *addr, int len, int type) {
++ /* The last parameter is a encoding type. Default is local encoding. */
++ return (lwres_gethostbyaddr_enc(addr, len, type,
++ LWRES_ENCODING_LOCAL));
++}
++#endif /* WITH_MDN */
++
+ struct hostent *
++#ifdef WITH_MDN
++lwres_gethostbyaddr_enc(const char *addr, int len, int type, int encodeflg) {
++#else
+ lwres_gethostbyaddr(const char *addr, int len, int type) {
++#endif /* WITH_MDN */
+
+ if (he != NULL)
+ lwres_freehostent(he);
+
++#ifdef WITH_MDN
++ he = lwres_getipnodebyaddr_enc(addr, len, type, &lwres_h_errno,
++ encodeflg);
++#else
+ he = lwres_getipnodebyaddr(addr, len, type, &lwres_h_errno);
++#endif /* WITH_MDN */
+ return (he);
+ }
+@@ -89,12 +143,32 @@
+ }
+
++#ifdef WITH_MDN
+ struct hostent *
+ lwres_gethostbyname_r(const char *name, struct hostent *resbuf,
+ char *buf, int buflen, int *error)
+ {
++ /* The last parameter is a encoding type. Default is local encoding. */
++ return (lwres_gethostbyname_r_enc(name, resbuf, buf, buflen, error,
++ LWRES_ENCODING_LOCAL));
++}
++#endif /* WITH_MDN */
++
++struct hostent *
++#ifdef WITH_MDN
++lwres_gethostbyname_r_enc(const char *name, struct hostent *resbuf,
++ char *buf, int buflen, int *error, int encodeflg)
++#else
++lwres_gethostbyname_r(const char *name, struct hostent *resbuf,
++ char *buf, int buflen, int *error)
++#endif /* WITH_MDN */
++{
+ struct hostent *he;
+ int res;
+
++#ifdef WITH_MDN
++ he = lwres_getipnodebyname_enc(name, AF_INET, 0, error, encodeflg);
++#else
+ he = lwres_getipnodebyname(name, AF_INET, 0, error);
++#endif /* WITH_MDN */
+ if (he == NULL)
+ return (NULL);
+@@ -108,13 +182,35 @@
+ }
+
++#ifdef WITH_MDN
++struct hostent *
++lwres_gethostbyaddr_r(const char *addr, int len, int type,
++ struct hostent *resbuf, char *buf, int buflen,
++ int *error)
++{
++ /* The last parameter is a encoding type. Default is local encoding. */
++ return (lwres_gethostbyaddr_r_enc(addr, len, type, resbuf, buf, buflen,
++ error, LWRES_ENCODING_LOCAL));
++}
++#endif /* WITH_MDN */
++
+ struct hostent *
++#ifdef WITH_MDN
++lwres_gethostbyaddr_r_enc(const char *addr, int len, int type,
++ struct hostent *resbuf, char *buf, int buflen,
++ int *error, int encodeflg)
++#else
+ lwres_gethostbyaddr_r(const char *addr, int len, int type,
+ struct hostent *resbuf, char *buf, int buflen,
+ int *error)
++#endif /* WITH_MDN */
+ {
+ struct hostent *he;
+ int res;
+
++#ifdef WITH_MDN
++ he = lwres_getipnodebyaddr_enc(addr, len, type, error, encodeflg);
++#else
+ he = lwres_getipnodebyaddr(addr, len, type, error);
++#endif /* WITH_MDN */
+ if (he == NULL)
+ return (NULL);
+--- ./lib/lwres/getipnode.c.orig Thu Dec 21 10:43:18 2000
++++ ./lib/lwres/getipnode.c Thu Dec 21 10:53:18 2000
+@@ -99,6 +99,22 @@
+ */
+
++#ifdef WITH_MDN
+ struct hostent *
++lwres_getipnodebyname(const char *name, int af, int flags, int *error_num)
++{
++ /* The last parameter is a encoding type. Default is local encoding. */
++ return (lwres_getipnodebyname_enc(name, af, flags, error_num,
++ LWRES_ENCODING_LOCAL));
++}
++#endif /* WITH_MDN */
++
++struct hostent *
++#ifdef WITH_MDN
++lwres_getipnodebyname_enc(const char *name, int af, int flags, int *error_num,
++ int encodeflg)
++{
++#else
+ lwres_getipnodebyname(const char *name, int af, int flags, int *error_num) {
++#endif /* WITH_MDN */
+ int have_v4 = 1, have_v6 = 1;
+ struct in_addr in4;
+@@ -171,5 +187,10 @@
+ if (have_v6 && af == AF_INET6) {
+
++#ifdef WITH_MDN
++ n = lwres_getaddrsbyname_enc(lwrctx, name, LWRES_ADDRTYPE_V6,
++ &by, encodeflg);
++#else
+ n = lwres_getaddrsbyname(lwrctx, name, LWRES_ADDRTYPE_V6, &by);
++#endif /* WITH_MDN */
+ if (n == 0) {
+ he1 = hostfromname(by, AF_INET6);
+@@ -188,5 +209,10 @@
+ (af == AF_INET6 && (flags & AI_V4MAPPED) != 0 &&
+ (he1 == NULL || (flags & AI_ALL) != 0)))) {
++#ifdef WITH_MDN
++ n = lwres_getaddrsbyname_enc(lwrctx, name, LWRES_ADDRTYPE_V4,
++ &by, encodeflg);
++#else
+ n = lwres_getaddrsbyname(lwrctx, name, LWRES_ADDRTYPE_V4, &by);
++#endif /* WITH_MDN */
+ if (n == 0) {
+ he2 = hostfromname(by, AF_INET);
+@@ -220,6 +246,20 @@
+ }
+
++#ifdef WITH_MDN
++struct hostent *
++lwres_getipnodebyaddr(const void *src, size_t len, int af, int *error_num) {
++ /* The last parameter is a encoding type. Default is local encoding. */
++ return (lwres_getipnodebyaddr_enc(src, len, af, error_num,
++ LWRES_ENCODING_LOCAL));
++}
++#endif /* WITH_MDN */
+ struct hostent *
++#ifdef WITH_MDN
++lwres_getipnodebyaddr_enc(const void *src, size_t len, int af, int *error_num,
++ int encodeflg)
++{
++#else
+ lwres_getipnodebyaddr(const void *src, size_t len, int af, int *error_num) {
++#endif /* WITH_MDN */
+ struct hostent *he1, *he2;
+ lwres_context_t *lwrctx = NULL;
+@@ -282,6 +322,12 @@
+ (void) lwres_conf_parse(lwrctx, lwres_resolv_conf);
+ if (n == LWRES_R_SUCCESS)
++#ifdef WITH_MDN
++ n = lwres_getnamebyaddr_enc(lwrctx, LWRES_ADDRTYPE_V4,
++ INADDRSZ, cp, &by,
++ encodeflg);
++#else
+ n = lwres_getnamebyaddr(lwrctx, LWRES_ADDRTYPE_V4,
+ INADDRSZ, cp, &by);
++#endif /* WITH_MDN */
+ if (n != LWRES_R_SUCCESS) {
+ lwres_conf_clear(lwrctx);
+@@ -326,6 +372,11 @@
+ (void) lwres_conf_parse(lwrctx, lwres_resolv_conf);
+ if (n == LWRES_R_SUCCESS)
++#ifdef WITH_MDN
++ n = lwres_getnamebyaddr_enc(lwrctx, LWRES_ADDRTYPE_V6,
++ IN6ADDRSZ, src, &by, encodeflg);
++#else
+ n = lwres_getnamebyaddr(lwrctx, LWRES_ADDRTYPE_V6, IN6ADDRSZ,
+ src, &by);
++#endif /* WITH_MDN */
+ if (n != 0) {
+ *error_num = HOST_NOT_FOUND;
+--- ./lib/lwres/getnameinfo.c.orig Thu Dec 21 10:43:19 2000
++++ ./lib/lwres/getnameinfo.c Thu Dec 21 10:53:19 2000
+@@ -106,8 +106,24 @@
+ } while (0)
+
++#ifdef WITH_MDN
+ int
+ lwres_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
+ size_t hostlen, char *serv, size_t servlen, int flags)
+ {
++ /* The last parameter is a encoding type. Default is local encoding. */
++ return (lwres_getnameinfo_enc(sa, salen, host, hostlen, serv, servlen,
++ flags, LWRES_ENCODING_LOCAL));
++}
++#endif /* WITH_MDN */
++int
++#ifdef WITH_MDN
++lwres_getnameinfo_enc(const struct sockaddr *sa, size_t salen, char *host,
++ size_t hostlen, char *serv, size_t servlen, int flags,
++ int encodeflg)
++#else
++lwres_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
++ size_t hostlen, char *serv, size_t servlen, int flags)
++#endif /* WITH_MDN */
++{
+ struct afd *afd;
+ struct servent *sp;
+@@ -259,6 +275,12 @@
+
+ if (n == 0)
++#ifdef WITH_MDN
++ n = lwres_getnamebyaddr_enc(lwrctx, lwf,
++ afd->a_addrlen, addr, &by,
++ encodeflg);
++#else
+ n = lwres_getnamebyaddr(lwrctx, lwf, afd->a_addrlen,
+ addr, &by);
++#endif /* WITH_MDN */
+ if (n == 0) {
+ if (flags & NI_NOFQDN) {
+--- ./lib/lwres/include/lwres/lwres.h.orig Thu Dec 21 10:43:16 2000
++++ ./lib/lwres/include/lwres/lwres.h Thu Dec 21 10:53:19 2000
+@@ -27,4 +27,7 @@
+ #include <lwres/list.h>
+ #include <lwres/lwpacket.h>
++#ifdef WITH_MDN
++#include <mdn/resconf.h>
++#endif /* WITH_MDN */
+
+ /*
+@@ -247,4 +250,7 @@
+ lwres_uint8_t ndots; /* set to n in 'options ndots:n' */
+ lwres_uint8_t no_tld_query; /* non-zero if 'options no_tld_query' */
++#ifdef WITH_MDN
++ mdn_resconf_t mdnctx; /* structure for mdn configuration */
++#endif /* WITH_MDN */
+ } lwres_conf_t;
+
+@@ -255,4 +261,10 @@
+ #define LWRES_MAX_ADDRS 64 /* max # of addrs */
+
++#ifdef WITH_MDN
++/* These are used for specifying encoding of the domain names */
++#define LWRES_ENCODING_LOCAL 0 /* local encoding */
++#define LWRES_ENCODING_UCS 1 /* UTF-8 encoding */
++#endif /* WITH_MDN */
++
+ LWRES_LANG_BEGINDECLS
+
+@@ -264,4 +276,30 @@
+ extern const char *lwres_resolv_conf;
+
++#ifdef WITH_MDN
++/*
++ * Forward declarations
++ */
++struct addrinfo;
++struct sockaddr;
++
++int lwres_getaddrinfo_enc(const char *, const char *,
++ const struct addrinfo *,
++ struct addrinfo **,
++ int encodeflg);
++int lwres_getnameinfo_enc(const struct sockaddr *, size_t, char *,
++ size_t, char *, size_t, int, int);
++struct hostent *lwres_gethostbyaddr_enc(const char *, int, int, int);
++struct hostent *lwres_gethostbyname_enc(const char *, int);
++struct hostent *lwres_gethostbyname2_enc(const char *, int, int);
++struct hostent *lwres_getipnodebyname_enc(const char *, int, int, int *, int);
++struct hostent *lwres_getipnodebyaddr_enc(const void *, size_t, int, int *,
++ int);
++struct hostent *lwres_gethostbyaddr_r_enc(const char *, int, int,
++ struct hostent *, char *, int,
++ int *, int);
++struct hostent *lwres_gethostbyname_r_enc(const char *, struct hostent *,
++ char *, int, int *, int);
++#endif /* WITH_MDN */
++
+ lwres_result_t
+ lwres_gabnrequest_render(lwres_context_t *ctx, lwres_gabnrequest_t *req,
+@@ -277,7 +315,13 @@
+
+ lwres_result_t
++#ifdef WITH_MDN
++lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
++ lwres_lwpacket_t *pkt,
++ lwres_gabnresponse_t **structp, int encodeflg);
++#else
+ lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
+ lwres_lwpacket_t *pkt,
+ lwres_gabnresponse_t **structp);
++#endif /* WITH_MDN */
+
+ void
+@@ -332,8 +376,15 @@
+ lwres_lwpacket_t *pkt, lwres_gnbarequest_t **structp);
+
++#ifdef WITH_MDN
++lwres_result_t
++lwres_gnbaresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
++ lwres_lwpacket_t *pkt,
++ lwres_gnbaresponse_t **structp, int encodeflg);
++#else
+ lwres_result_t
+ lwres_gnbaresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
+ lwres_lwpacket_t *pkt,
+ lwres_gnbaresponse_t **structp);
++#endif /* WITH_MDN */
+
+ void
+@@ -570,4 +621,10 @@
+ lwres_getaddrsbyname(lwres_context_t *ctx, const char *name,
+ lwres_uint32_t addrtypes, lwres_gabnresponse_t **structp);
++#ifdef WITH_MDN
++lwres_result_t
++lwres_getaddrsbyname_enc(lwres_context_t *ctx, const char *name,
++ lwres_uint32_t addrtypes,
++ lwres_gabnresponse_t **structp, int encodeflg);
++#endif /* WITH_MDN */
+
+ lwres_result_t
+@@ -575,4 +632,10 @@
+ lwres_uint16_t addrlen, const unsigned char *addr,
+ lwres_gnbaresponse_t **structp);
++#ifdef WITH_MDN
++lwres_result_t
++lwres_getnamebyaddr_enc(lwres_context_t *ctx, lwres_uint32_t addrtype,
++ lwres_uint16_t addrlen, const unsigned char *addr,
++ lwres_gnbaresponse_t **structp, int encodeflg);
++#endif /* WITH_MDN */
+
+ lwres_result_t
+@@ -580,4 +643,9 @@
+ lwres_uint16_t rdclass, lwres_uint16_t rdtype,
+ lwres_uint32_t flags, lwres_grbnresponse_t **structp);
++
++#ifdef WITH_MDN
++lwres_result_t
++lwres_result_frommdn(mdn_result_t r);
++#endif
+
+ LWRES_LANG_ENDDECLS
+--- ./lib/lwres/lwconfig.c.orig Thu Dec 21 10:43:22 2000
++++ ./lib/lwres/lwconfig.c Thu Dec 21 10:53:19 2000
+@@ -56,4 +56,7 @@
+ #include <lwres/net.h>
+ #include <lwres/result.h>
++#ifdef WITH_MDN
++#include <mdn/result.h>
++#endif /* WITH_MDN */
+
+ #include "assert_p.h"
+@@ -241,4 +244,13 @@
+ lwres_resetaddr(&confdata->sortlist[i].mask);
+ }
++#ifdef WITH_MDN
++ /*
++ * Initialize the context for MDN.
++ */
++ confdata->mdnctx = NULL;
++ if (mdn_resconf_initialize() == mdn_success) {
++ (void)mdn_resconf_create(&confdata->mdnctx);
++ }
++#endif /* WITH_MDN */
+ }
+
+@@ -602,4 +614,9 @@
+ fclose(fp);
+
++#ifdef WITH_MDN
++ /* Read mdn configuration file. */
++ if (confdata->mdnctx != NULL)
++ (void)mdn_resconf_loadfile(confdata->mdnctx, NULL);
++#endif
+ return (ret);
+ }
+--- ./lib/lwres/lwres_gabn.c.orig Thu Dec 21 10:43:20 2000
++++ ./lib/lwres/lwres_gabn.c Thu Dec 21 10:53:19 2000
+@@ -28,4 +28,7 @@
+ #include <lwres/lwres.h>
+ #include <lwres/result.h>
++#ifdef WITH_MDN
++#include <mdn/res.h>
++#endif /* WITH_MDN */
+
+ #include "context_p.h"
+@@ -245,6 +248,12 @@
+
+ lwres_result_t
++#ifdef WITH_MDN
++lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
++ lwres_lwpacket_t *pkt, lwres_gabnresponse_t **structp,
++ int encodeflg)
++#else
+ lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
+ lwres_lwpacket_t *pkt, lwres_gabnresponse_t **structp)
++#endif /* WITH_MDN */
+ {
+ lwres_result_t ret;
+@@ -256,4 +265,9 @@
+ lwres_addrlist_t addrlist;
+ lwres_addr_t *addr;
++#ifdef WITH_MDN
++ char *tmp_realname;
++ char *tmp_aliases;
++ mdn_result_t r;
++#endif /* WITH_MDN */
+
+ REQUIRE(ctx != NULL);
+@@ -319,4 +333,26 @@
+ if (ret != LWRES_R_SUCCESS)
+ goto out;
++#ifdef WITH_MDN
++ /*
++ * Convert from UCS to local encoding if needed.
++ */
++ tmp_realname = (char *)malloc(1024);
++ switch (encodeflg) {
++ case LWRES_ENCODING_LOCAL: /* from UCS to local encoding */
++ r = mdn_res_ucstolocal(ctx->confdata.mdnctx, gabn->realname,
++ tmp_realname, 1024);
++ if (r != mdn_success) {
++ free(tmp_realname);
++ tmp_realname = NULL;
++ ret = lwres_result_frommdn(r);
++ goto out;
++ }
++ break;
++ default:
++ strcpy(tmp_realname, gabn->realname);
++ break;
++ }
++ gabn->realname = tmp_realname;
++#endif /* WITH_MDN */
+
+ /*
+@@ -328,4 +364,27 @@
+ if (ret != LWRES_R_SUCCESS)
+ goto out;
++#ifdef WITH_MDN
++ /*
++ * Convert from UCS to local encoding.
++ */
++ tmp_aliases = (char *)malloc(1024);
++ switch (encodeflg) {
++ case LWRES_ENCODING_LOCAL: /* from UCS to local encoding */
++ r = mdn_res_ucstolocal(ctx->confdata.mdnctx,
++ gabn->aliases[x],
++ tmp_aliases, 1024);
++ if (r != mdn_success) {
++ free(tmp_aliases);
++ tmp_aliases = NULL;
++ ret = lwres_result_frommdn(r);
++ goto out;
++ }
++ break;
++ default: /* When encoding on DNS protocol */
++ strcpy(tmp_aliases, gabn->aliases[x]);
++ break;
++ }
++ gabn->aliases[x] = tmp_aliases;
++#endif /* WITH_MDN */
+ }
+
+@@ -391,4 +450,7 @@
+ lwres_gabnresponse_t *gabn;
+ lwres_addr_t *addr;
++#ifdef WITH_MDN
++ unsigned int x;
++#endif /* WITH_MDN */
+
+ REQUIRE(ctx != NULL);
+@@ -398,4 +460,12 @@
+ *structp = NULL;
+
++#ifdef WITH_MDN
++ free(gabn->realname);
++ gabn->realname = NULL;
++ for (x = 0 ; x < gabn->naliases ; x++) {
++ free(gabn->aliases[x]);
++ gabn->aliases[x] = NULL;
++ }
++#endif /* WITH_MDN */
+ if (gabn->naliases > 0) {
+ CTXFREE(gabn->aliases, sizeof(char *) * gabn->naliases);
+--- ./lib/lwres/lwres_gnba.c.orig Thu Dec 21 10:43:20 2000
++++ ./lib/lwres/lwres_gnba.c Thu Dec 21 10:53:19 2000
+@@ -28,4 +28,7 @@
+ #include <lwres/lwres.h>
+ #include <lwres/result.h>
++#ifdef WITH_MDN
++#include <mdn/res.h>
++#endif /* WITH_MDN */
+
+ #include "context_p.h"
+@@ -204,6 +207,12 @@
+
+ lwres_result_t
++#ifdef WITH_MDN
++lwres_gnbaresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
++ lwres_lwpacket_t *pkt, lwres_gnbaresponse_t **structp,
++ int encodeflg)
++#else
+ lwres_gnbaresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
+ lwres_lwpacket_t *pkt, lwres_gnbaresponse_t **structp)
++#endif /* WITH_MDN */
+ {
+ int ret;
+@@ -212,4 +221,9 @@
+ lwres_uint16_t naliases;
+ lwres_gnbaresponse_t *gnba;
++#ifdef WITH_MDN
++ char *tmp_realname;
++ char *tmp_aliases;
++ mdn_result_t r;
++#endif /* WITH_MDN */
+
+ REQUIRE(ctx != NULL);
+@@ -261,4 +275,26 @@
+ if (ret != LWRES_R_SUCCESS)
+ goto out;
++#ifdef WITH_MDN
++ /*
++ * Convert from UCS to local encoding if needed.
++ */
++ tmp_realname = (char *)malloc(1024);
++ switch (encodeflg) {
++ case LWRES_ENCODING_LOCAL: /* from UCS to local encoding */
++ r = mdn_res_ucstolocal(ctx->confdata.mdnctx, gnba->realname,
++ tmp_realname, 1024);
++ if (r != mdn_success) {
++ free(tmp_realname);
++ tmp_realname = NULL;
++ ret = lwres_result_frommdn(r);
++ goto out;
++ }
++ break;
++ default:
++ strcpy(tmp_realname, gnba->realname);
++ break;
++ }
++ gnba->realname = tmp_realname;
++#endif /* WITH_MDN */
+
+ /*
+@@ -270,4 +306,27 @@
+ if (ret != LWRES_R_SUCCESS)
+ goto out;
++#ifdef WITH_MDN
++ /*
++ * Convert from UCS to local encoding.
++ */
++ tmp_aliases = (char *)malloc(1024);
++ switch (encodeflg) {
++ case LWRES_ENCODING_LOCAL: /* from UCS to local encoding */
++ r = mdn_res_ucstolocal(ctx->confdata.mdnctx,
++ gnba->aliases[x],
++ tmp_aliases, 1024);
++ if (r != mdn_success) {
++ free(tmp_aliases);
++ tmp_aliases = NULL;
++ ret = lwres_result_frommdn(r);
++ goto out;
++ }
++ break;
++ default: /* When encoding on DNS protocol */
++ strcpy(tmp_aliases, gnba->aliases[x]);
++ break;
++ }
++ gnba->aliases[x] = tmp_aliases;
++#endif /* WITH_MDN */
+ }
+
+@@ -311,4 +370,7 @@
+ {
+ lwres_gnbaresponse_t *gnba;
++#ifdef WITH_MDN
++ unsigned int x;
++#endif /* WITH_MDN */
+
+ REQUIRE(ctx != NULL);
+@@ -318,4 +380,12 @@
+ *structp = NULL;
+
++#ifdef WITH_MDN
++ free(gnba->realname);
++ gnba->realname = NULL;
++ for (x = 0 ; x < gnba->naliases ; x++) {
++ free(gnba->aliases[x]);
++ gnba->aliases[x] = NULL;
++ }
++#endif /* WITH_MDN */
+ if (gnba->naliases > 0) {
+ CTXFREE(gnba->aliases, sizeof(char *) * gnba->naliases);
+--- ./lib/lwres/lwresutil.c.orig Thu Dec 21 10:43:21 2000
++++ ./lib/lwres/lwresutil.c Thu Dec 21 10:53:19 2000
+@@ -33,4 +33,7 @@
+ #include <lwres/lwres.h>
+ #include <lwres/result.h>
++#ifdef WITH_MDN
++#include <mdn/res.h>
++#endif /* WITH_MDN */
+
+ #include "assert_p.h"
+@@ -160,8 +163,24 @@
+ }
+
++#ifdef WITH_MDN
+ lwres_result_t
+ lwres_getaddrsbyname(lwres_context_t *ctx, const char *name,
+ lwres_uint32_t addrtypes, lwres_gabnresponse_t **structp)
+ {
++ /* The last parameter is a encoding type. Default is local encoding. */
++ return (lwres_getaddrsbyname_enc(ctx, name, addrtypes, structp, 0));
++}
++#endif /* WITH_MDN */
++
++lwres_result_t
++#ifdef WITH_MDN
++lwres_getaddrsbyname_enc(lwres_context_t *ctx, const char *name,
++ lwres_uint32_t addrtypes, lwres_gabnresponse_t **structp,
++ int encodeflg)
++#else
++lwres_getaddrsbyname(lwres_context_t *ctx, const char *name,
++ lwres_uint32_t addrtypes, lwres_gabnresponse_t **structp)
++#endif /* WITH_MDN */
++{
+ lwres_gabnrequest_t request;
+ lwres_gabnresponse_t *response;
+@@ -174,4 +193,8 @@
+ char target_name[1024];
+ unsigned int target_length;
++#ifdef WITH_MDN
++ mdn_result_t r;
++ char request_name[1024];
++#endif /* WITH_MDN */
+
+ REQUIRE(ctx != NULL);
+@@ -201,6 +224,35 @@
+ */
+ request.addrtypes = addrtypes;
++#ifdef WITH_MDN
++ /*
++ * Convert from local encoding to UCS, then perform normalization.
++ */
++ switch (encodeflg) {
++ case LWRES_ENCODING_LOCAL: /* from local encoding */
++ r = mdn_res_localtoucs(ctx->confdata.mdnctx, target_name,
++ request_name, sizeof(request_name));
++ if (r == mdn_success) {
++ r = mdn_res_normalize(ctx->confdata.mdnctx,
++ request_name,
++ target_name,
++ sizeof(target_name));
++ }
++ request.name = target_name;
++ break;
++ default:
++ r = mdn_res_normalize(ctx->confdata.mdnctx, target_name,
++ request_name, sizeof(request_name));
++ request.name = request_name;
++ break;
++ }
++ if (r != mdn_success) {
++ ret = lwres_result_frommdn(r);
++ goto out;
++ }
++ request.namelen = strlen(request.name);
++#else
+ request.name = target_name;
+ request.namelen = target_length;
++#endif /* WITH_MDN */
+ pkt.pktflags = 0;
+ pkt.serial = serial;
+@@ -251,5 +303,9 @@
+ * Parse the response.
+ */
++#ifdef WITH_MDN
++ ret = lwres_gabnresponse_parse(ctx, &b_in, &pkt, &response, encodeflg);
++#else
+ ret = lwres_gabnresponse_parse(ctx, &b_in, &pkt, &response);
++#endif /* WITH_MDN */
+ if (ret != LWRES_R_SUCCESS)
+ goto out;
+@@ -273,8 +329,25 @@
+
+
++#ifdef WITH_MDN
++lwres_result_t
++lwres_getnamebyaddr(lwres_context_t *ctx, lwres_uint32_t addrtype,
++ lwres_uint16_t addrlen, const unsigned char *addr,
++ lwres_gnbaresponse_t **structp)
++{
++ /* The last parameter is a encoding type. Default is local encoding. */
++ return (lwres_getnamebyaddr_enc(ctx, addrtype, addrlen, addr, structp,
++ LWRES_ENCODING_LOCAL));
++}
++#endif /* WITH_MDN */
+ lwres_result_t
++#ifdef WITH_MDN
++lwres_getnamebyaddr_enc(lwres_context_t *ctx, lwres_uint32_t addrtype,
++ lwres_uint16_t addrlen, const unsigned char *addr,
++ lwres_gnbaresponse_t **structp, int encodeflg)
++#else
+ lwres_getnamebyaddr(lwres_context_t *ctx, lwres_uint32_t addrtype,
+ lwres_uint16_t addrlen, const unsigned char *addr,
+ lwres_gnbaresponse_t **structp)
++#endif /* WITH_MDN */
+ {
+ lwres_gnbarequest_t request;
+@@ -359,5 +432,9 @@
+ * Parse the response.
+ */
++#ifdef WITH_MDN
++ ret = lwres_gnbaresponse_parse(ctx, &b_in, &pkt, &response, encodeflg);
++#else
+ ret = lwres_gnbaresponse_parse(ctx, &b_in, &pkt, &response);
++#endif /* WITH_MDN */
+ if (ret != LWRES_R_SUCCESS)
+ goto out;
+@@ -379,4 +456,21 @@
+ return (ret);
+ }
++
++#ifdef WITH_MDN
++lwres_result_t
++lwres_result_frommdn(mdn_result_t r) {
++ /*
++ * Convert mDNkit's result code to lwres's one.
++ */
++ switch (r) {
++ case mdn_success:
++ return (LWRES_R_SUCCESS);
++ case mdn_nomemory:
++ return (LWRES_R_NOMEMORY);
++ default:
++ return (LWRES_R_FAILURE);
++ }
++}
++#endif
+
+ lwres_result_t
+--- ./bin/dig/dighost.c.orig Thu Dec 21 10:42:00 2000
++++ ./bin/dig/dighost.c Thu Dec 21 10:53:19 2000
+@@ -33,8 +33,18 @@
+ #include <string.h>
+ #include <limits.h>
++#ifdef HAVE_LOCALE_H
++#include <locale.h>
++#endif
+ #if (!(defined(HAVE_ADDRINFO) && defined(HAVE_GETADDRINFO)))
+ extern int h_errno;
+ #endif
+
++#ifdef WITH_MDN
++#include <mdn/result.h>
++#include <mdn/log.h>
++#include <mdn/resconf.h>
++#include <mdn/res.h>
++#endif
++
+ #include <dns/byaddr.h>
+ #include <dns/fixedname.h>
+@@ -128,4 +138,18 @@
+ isc_uint32_t rr_limit = INT_MAX;
+
++#ifdef WITH_MDN
++mdn_resconf_t mdnconf;
++
++static void initialize_mdn(void);
++static isc_result_t output_filter(isc_buffer_t *buffer,
++ unsigned int used_org,
++ isc_boolean_t absolute);
++static mdn_result_t append_textname(char *name, const char *origin,
++ size_t namesize);
++static void mdn_check_result(mdn_result_t r, const char *msg);
++
++#define MAXDLEN 256
++#endif
++
+ /*
+ * Apply and clear locks at the event level in global task.
+@@ -686,4 +710,8 @@
+ }
+
++#ifdef WITH_MDN
++ initialize_mdn();
++#endif
++
+ if (keyfile[0] != 0)
+ setup_file_key();
+@@ -1221,4 +1249,9 @@
+ isc_buffer_t b;
+ char store[MXNAME];
++ char *textname;
++#ifdef WITH_MDN
++ mdn_result_t mr;
++ char ucs_name[MXNAME], ucs_tmp[MXNAME];
++#endif
+
+ REQUIRE(lookup != NULL);
+@@ -1257,5 +1290,14 @@
+ */
+ /* XXX New search here? */
+- if ((count_dots(lookup->textname) >= ndots) || lookup->defname)
++#ifdef WITH_MDN
++ mr = mdn_res_localtoucs(mdnconf, lookup->textname, ucs_name,
++ sizeof(ucs_name));
++ mdn_check_result(mr, "local to UCS conversion");
++ textname = ucs_name;
++#else
++ textname = lookup->textname;
++#endif
++
++ if ((count_dots(textname) >= ndots) || lookup->defname)
+ lookup->origin = NULL; /* Force abs lookup */
+ else if (lookup->origin == NULL && lookup->new_search &&
+@@ -1279,4 +1321,22 @@
+ if (lookup->origin != NULL) {
+ debug("trying origin %s", lookup->origin->origin);
++#ifdef WITH_MDN
++ /*
++ * We cannot convert name and origin separately and combine
++ * them later, because some encoding scheme (such as UTF-5)
++ * can be applied only to an entire domain name, not a
++ * partial one.
++ */
++ mr = append_textname(ucs_name, lookup->origin->origin,
++ sizeof(ucs_name));
++ mdn_check_result(mr, "concatenation with origin");
++ mr = mdn_res_normalize(mdnconf, ucs_name, ucs_tmp,
++ sizeof(ucs_tmp));
++ mdn_check_result(mr, "normalization");
++ mr = mdn_res_ucstodns(mdnconf, ucs_tmp, ucs_name,
++ sizeof(ucs_name));
++ mdn_check_result(mr, "UCS to DNS encoding conversion");
++ goto no_origin;
++#else
+ result = dns_message_gettempname(lookup->sendmsg,
+ &lookup->oname);
+@@ -1317,7 +1377,26 @@
+ }
+ dns_message_puttempname(lookup->sendmsg, &lookup->oname);
++#endif
+ } else {
+ debug("using root origin");
++#ifdef WITH_MDN
++ no_origin:
++#endif
+ if (!lookup->trace_root) {
++#ifdef WITH_MDN
++ mr = mdn_res_normalize(mdnconf, ucs_name, ucs_tmp,
++ sizeof(ucs_tmp));
++ mdn_check_result(mr, "normalization");
++ mr = mdn_res_ucstodns(mdnconf, ucs_tmp, ucs_name,
++ sizeof(ucs_name));
++ mdn_check_result(mr, "UCS to DNS encoding conversion");
++ len = strlen(ucs_name);
++ isc_buffer_init(&b, ucs_name, len);
++ isc_buffer_add(&b, len);
++ result = dns_name_fromtext(lookup->name, &b,
++ dns_rootname,
++ ISC_FALSE,
++ &lookup->namebuf);
++#else
+ len = strlen(lookup->textname);
+ isc_buffer_init(&b, lookup->textname, len);
+@@ -1327,4 +1406,5 @@
+ ISC_FALSE,
+ &lookup->namebuf);
++#endif
+ } else {
+ dns_name_clone(dns_rootname, lookup->name);
+@@ -2754,2 +2834,123 @@
+ isc_mem_destroy(&mctx);
+ }
++
++#ifdef WITH_MDN
++static void
++initialize_mdn(void) {
++ mdn_result_t r;
++ mdn_converter_t conv;
++
++#ifdef HAVE_SETLOCALE
++ /* Set locale */
++ (void)setlocale(LC_ALL, "");
++#endif
++
++ /* General initialization. */
++ r = mdn_resconf_initialize();
++ if (r != mdn_success)
++ fatal("mdn initialization failed: %s",
++ mdn_result_tostring(r));
++
++ /* Create configuration context. */
++ r = mdn_resconf_create(&mdnconf);
++ if (r != mdn_success)
++ fatal("mdn resconf initialization failed: %s",
++ mdn_result_tostring(r));
++
++
++ /* Load mdn configuration file. */
++ r = mdn_resconf_loadfile(mdnconf, NULL);
++ if (r != mdn_success)
++ fatal("mdn configuration loading failed: %s",
++ mdn_result_tostring(r));
++
++ /* Allow utf-8 characters in domain names if necessary. */
++ if ((conv = mdn_resconf_serverconverter(mdnconf)) != NULL &&
++ !mdn_converter_isasciicompatible(conv)) {
++ debug("allowing UTF-8 characters in domain names");
++ dns_name_allowutf8(ISC_TRUE);
++ }
++ /* Set domain name -> text post-conversion filter. */
++ dns_name_settotextfilter(output_filter);
++}
++
++static isc_result_t
++output_filter(isc_buffer_t *buffer, unsigned int used_org,
++ isc_boolean_t absolute)
++{
++ char tmp1[MAXDLEN], tmp2[MAXDLEN];
++ size_t fromlen, tolen;
++ isc_boolean_t end_with_dot;
++
++ /*
++ * Copy contents of 'buffer' to 'tmp1', supply trailing dot
++ * if 'absolute' is true, and terminate with NUL.
++ */
++ fromlen = isc_buffer_usedlength(buffer) - used_org;
++ if (fromlen >= MAXDLEN)
++ return (ISC_R_SUCCESS);
++ memcpy(tmp1, (char *)isc_buffer_base(buffer) + used_org, fromlen);
++ end_with_dot = (tmp1[fromlen - 1] == '.') ? ISC_TRUE : ISC_FALSE;
++ if (absolute && !end_with_dot) {
++ fromlen++;
++ if (fromlen >= MAXDLEN)
++ return (ISC_R_SUCCESS);
++ tmp1[fromlen - 1] = '.';
++ }
++ tmp1[fromlen] = '\0';
++
++ /*
++ * Convert contents of 'tmp1' to local encoding.
++ */
++ if (mdn_res_dnstoucs(mdnconf, tmp1, tmp2, MAXDLEN)
++ != mdn_success ||
++ mdn_res_ucstolocal(mdnconf, tmp2, tmp1, MAXDLEN)
++ != mdn_success)
++ return (ISC_R_SUCCESS);
++
++ /*
++ * Copy the converted contents in 'tmp1' back to 'buffer'.
++ * If we have appended trailing dot, remove it.
++ */
++ tolen = strlen(tmp1);
++ if (absolute && !end_with_dot && tmp1[tolen - 1] == '.')
++ tolen--;
++
++ if (isc_buffer_length(buffer) < used_org + tolen)
++ return (ISC_R_NOSPACE);
++
++ isc_buffer_subtract(buffer, isc_buffer_usedlength(buffer) - used_org);
++ memcpy(isc_buffer_used(buffer), tmp1, tolen);
++ isc_buffer_add(buffer, tolen);
++
++ return (ISC_R_SUCCESS);
++}
++
++static mdn_result_t
++append_textname(char *name, const char *origin, size_t namesize) {
++ size_t namelen = strlen(name);
++ size_t originlen = strlen(origin);
++
++ /* Already absolute? */
++ if (namelen > 0 && name[namelen - 1] == '.')
++ return mdn_success;
++
++ /* Append dot and origin */
++
++ if (namelen + 1 + originlen >= namesize)
++ return mdn_buffer_overflow;
++
++ name[namelen++] = '.';
++ (void)strcpy(name + namelen, origin);
++ return mdn_success;
++}
++
++static void
++mdn_check_result(mdn_result_t r, const char *msg) {
++ if (r != mdn_success) {
++ exitcode = 1;
++ fatal("%s: %s", msg, mdn_result_tostring(r));
++ }
++}
++
++#endif /* WITH_MDN */
+--- ./bin/named/Makefile.in.orig Thu Dec 21 10:41:20 2000
++++ ./bin/named/Makefile.in Thu Dec 21 11:42:23 2000
+@@ -34,5 +34,5 @@
+ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include \
+ ${LWRES_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES} \
+- ${OMAPI_INCLUDES} ${DBDRIVER_INCLUDES}
++ ${OMAPI_INCLUDES} ${DBDRIVER_INCLUDES} \
+
+ CDEFINES =
+@@ -52,5 +52,5 @@
+
+ LIBS = ${LWRESLIBS} ${OMAPILIBS} ${DNSLIBS} ${ISCLIBS} \
+- ${DBDRIVER_LIBS} @LIBS@
++ ${DBDRIVER_LIBS} ${ICONVLIB} @LIBS@
+
+ SUBDIRS = unix
+@@ -64,5 +64,5 @@
+ zoneconf.@O@ \
+ lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \
+- lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \
++ lwdgnba.@O@ lwdgrbn.@O@ lwdmdn.@O@ lwdnoop.@O@ lwsearch.@O@ \
+ $(DBDRIVER_OBJS)
+
+@@ -75,5 +75,5 @@
+ zoneconf.c \
+ lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \
+- lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \
++ lwdgnba.c lwdgrbn.c lwdmdn.c lwdnoop.c lwsearch.c \
+ $(DBDRIVER_SRCS)
+
+--- ./bin/named/include/named/globals.h.orig Thu Dec 21 10:41:03 2000
++++ ./bin/named/include/named/globals.h Thu Dec 21 10:53:19 2000
+@@ -104,4 +104,12 @@
+ EXTERN const char * ns_g_username INIT(NULL);
+
++#ifdef WITH_MDN
++/*
++ * MDN configuration.
++ */
++EXTERN char * lwresd_g_mdnconffile;
++EXTERN isc_boolean_t lwresd_g_mdnreloadwanted;
++#endif
++
+ #undef EXTERN
+ #undef INIT
+--- ./bin/named/include/named/lwdmdn.h.orig Thu Dec 21 10:53:19 2000
++++ ./bin/named/include/named/lwdmdn.h Thu Dec 21 10:53:19 2000
+@@ -0,0 +1,23 @@
++/* $Id: patch.most,v 1.2 2000/12/21 17:37:39 tale Exp $ */
++
++#ifndef NAMED_LWDMDN_H
++#define NAMED_LWDMDN_H
++
++#include <isc/types.h>
++#include <mdn/result.h>
++
++ISC_LANG_BEGINDECLS
++
++void
++ns_lwdmdn_initialize(void);
++
++isc_result_t
++ns_lwdmdn_convertfromutf8(isc_buffer_t *from_buffer, isc_buffer_t *to_buffer);
++
++isc_result_t
++ns_lwdmdn_converttoutf8(isc_buffer_t *from_buffer, isc_buffer_t *to_buffer);
++
++ISC_LANG_ENDDECLS
++
++#endif /* NAMED_LWDMDN_H */
++
+--- ./bin/named/lwdgabn.c.orig Thu Dec 21 10:41:14 2000
++++ ./bin/named/lwdgabn.c Thu Dec 21 10:53:19 2000
+@@ -35,4 +35,7 @@
+ #include <named/lwaddr.h>
+ #include <named/lwdclient.h>
++#ifdef WITH_MDN
++#include <named/lwdmdn.h>
++#endif
+ #include <named/lwresd.h>
+ #include <named/lwsearch.h>
+@@ -277,4 +280,7 @@
+ isc_result_t result;
+ isc_uint16_t naliases;
++#ifdef WITH_MDN
++ isc_buffer_t *tbufp;
++#endif
+
+ b = client->recv_buffer;
+@@ -283,8 +289,25 @@
+ * Render the new name to the buffer.
+ */
++#ifdef WITH_MDN
++ tbufp = NULL;
++ result = isc_buffer_allocate(client->clientmgr->mctx, &tbufp, 256);
++ if (result != ISC_R_SUCCESS)
++ return (result);
++ result = dns_name_totext(dns_fixedname_name(&client->target_name),
++ ISC_TRUE, tbufp);
++ if (result != ISC_R_SUCCESS) {
++ isc_buffer_free(&tbufp);
++ return (result);
++ }
++ result = ns_lwdmdn_converttoutf8(tbufp, &client->recv_buffer);
++ isc_buffer_free(&tbufp);
++ if (result != ISC_R_SUCCESS)
++ return (result);
++#else
+ result = dns_name_totext(dns_fixedname_name(&client->target_name),
+ ISC_TRUE, &client->recv_buffer);
+ if (result != ISC_R_SUCCESS)
+ return (result);
++#endif
+
+ /*
+@@ -312,4 +335,7 @@
+ isc_result_t result;
+ dns_name_t *tname;
++#ifdef WITH_MDN
++ isc_buffer_t *tbufp;
++#endif
+
+ b = client->recv_buffer;
+@@ -323,5 +349,19 @@
+ * Render the new name to the buffer.
+ */
++#ifdef WITH_MDN
++ tbufp = NULL;
++ result = isc_buffer_allocate(client->clientmgr->mctx, &tbufp, 256);
++ if (result != ISC_R_SUCCESS)
++ return (result);
++ result = dns_name_totext(tname, ISC_TRUE, tbufp);
++ if (result != ISC_R_SUCCESS) {
++ isc_buffer_free(&tbufp);
++ return (result);
++ }
++ result = ns_lwdmdn_converttoutf8(tbufp, &client->recv_buffer);
++ isc_buffer_free(&tbufp);
++#else
+ result = dns_name_totext(tname, ISC_TRUE, &client->recv_buffer);
++#endif
+ if (result != ISC_R_SUCCESS)
+ return (result);
+@@ -599,4 +639,7 @@
+ ns_lwdclientmgr_t *cm;
+ isc_buffer_t namebuf;
++#ifdef WITH_MDN
++ isc_buffer_t *tnamebufp;
++#endif
+
+ REQUIRE(NS_LWDCLIENT_ISRECVDONE(client));
+@@ -610,11 +653,39 @@
+ goto out;
+
++#ifdef WITH_MDN
++ /*
++ * XXX Assuming allocation size for req->name is larger than
++ * req->namelen by at least one, which is true in the current
++ * implementation.
++ */
++ isc_buffer_init(&namebuf, req->name, req->namelen + 1);
++ isc_buffer_add(&namebuf, req->namelen);
++ tnamebufp = NULL;
++ result = isc_buffer_allocate(client->clientmgr->mctx, &tnamebufp, 256);
++ if (result != ISC_R_SUCCESS)
++ goto out;
++ /*
++ * Convert UTF-8 string in namebuf into DNS protocol encoding.
++ */
++ result = ns_lwdmdn_convertfromutf8(&namebuf, tnamebufp);
++ if (result != ISC_R_SUCCESS) {
++ isc_buffer_free(&tnamebufp);
++ goto out;
++ }
++#else
+ isc_buffer_init(&namebuf, req->name, req->namelen);
+ isc_buffer_add(&namebuf, req->namelen);
++#endif
+
+ dns_fixedname_init(&client->target_name);
+ dns_fixedname_init(&client->query_name);
++#ifdef WITH_MDN
++ result = dns_name_fromtext(dns_fixedname_name(&client->query_name),
++ tnamebufp, dns_rootname, ISC_FALSE, NULL);
++ isc_buffer_free(&tnamebufp);
++#else
+ result = dns_name_fromtext(dns_fixedname_name(&client->query_name),
+ &namebuf, NULL, ISC_FALSE, NULL);
++#endif
+ if (result != ISC_R_SUCCESS)
+ goto out;
+--- ./bin/named/lwdgnba.c.orig Thu Dec 21 10:41:15 2000
++++ ./bin/named/lwdgnba.c Thu Dec 21 10:53:20 2000
+@@ -30,4 +30,7 @@
+ #include <named/types.h>
+ #include <named/lwdclient.h>
++#ifdef WITH_MDN
++#include <named/lwdmdn.h>
++#endif
+
+ static void start_byaddr(ns_lwdclient_t *);
+@@ -48,4 +51,7 @@
+ isc_uint16_t naliases;
+ isc_stdtime_t now;
++#ifdef WITH_MDN
++ isc_buffer_t *tbufp;
++#endif
+
+ UNUSED(task);
+@@ -110,7 +116,23 @@
+ b = client->recv_buffer;
+
++#ifdef WITH_MDN
++ tbufp = NULL;
++ result = isc_buffer_allocate(cm->mctx, &tbufp, 256);
++ if (result != ISC_R_SUCCESS)
++ goto out;
++ result = dns_name_totext(name, ISC_TRUE, tbufp);
++ if (result != ISC_R_SUCCESS) {
++ isc_buffer_free(&tbufp);
++ goto out;
++ }
++ result = ns_lwdmdn_converttoutf8(tbufp, &client->recv_buffer);
++ isc_buffer_free(&tbufp);
++ if (result != ISC_R_SUCCESS)
++ goto out;
++#else
+ result = dns_name_totext(name, ISC_TRUE, &client->recv_buffer);
+ if (result != ISC_R_SUCCESS)
+ goto out;
++#endif
+ ns_lwdclient_log(50, "found name '%.*s'",
+ client->recv_buffer.used - b.used,
+--- ./bin/named/lwdmdn.c.orig Thu Dec 21 10:53:20 2000
++++ ./bin/named/lwdmdn.c Thu Dec 21 11:56:00 2000
+@@ -0,0 +1,283 @@
++/* $Id: patch.most,v 1.2 2000/12/21 17:37:39 tale Exp $ */
++
++#include <config.h>
++
++#include <stdlib.h>
++#include <stdarg.h>
++#include <string.h>
++
++#ifdef WITH_MDN
++#include <mdn/result.h>
++#include <mdn/log.h>
++#include <mdn/resconf.h>
++#include <mdn/res.h>
++#endif
++
++#include <isc/result.h>
++#include <isc/rwlock.h>
++#include <isc/util.h>
++
++#include <named/types.h>
++#include <named/log.h>
++#ifdef WITH_MDN
++#include <named/lwdmdn.h>
++#endif
++#include <named/lwdclient.h>
++#include <named/globals.h>
++
++#ifdef WITH_MDN
++
++typedef enum {
++ convert_from_utf8,
++ convert_to_utf8
++} convert_direction_t;
++
++static isc_logmodule_t modules[] = {
++ { "mdn", 0 },
++ { NULL, 0 }
++};
++#define NS_LOGMODULE_MDN (&modules[0])
++
++static isc_rwlock_t mdnconflock;
++static mdn_resconf_t mdnconf = NULL;
++
++static isc_result_t convert_buffer(isc_buffer_t *from_buffer,
++ isc_buffer_t *to_buffer,
++ convert_direction_t dir);
++static isc_result_t load_mdnconfiguration(const char *filename);
++static isc_result_t mdnresult_to_iscresult(mdn_result_t r);
++static void set_log_level(int level);
++static void logger(int level, const char *msg);
++static void logwrite(int level, const char *fmt, ...);
++
++void
++ns_lwdmdn_initialize(void) {
++ mdn_result_t r;
++ isc_result_t result;
++
++ logwrite(ISC_LOG_DEBUG(50), "initializing mdn");
++
++ /* Register MDN module for logging. */
++ isc_log_registermodules(ns_g_lctx, modules);
++
++ /* Set libmdn log hander. */
++ mdn_log_setproc(logger);
++
++ /* Set log level. */
++ set_log_level(ns_g_debuglevel);
++
++ /* General initialization. */
++ r = mdn_resconf_initialize();
++ RUNTIME_CHECK(r == mdn_success);
++
++ /* Create configuration context. */
++ r = mdn_resconf_create(&mdnconf);
++ RUNTIME_CHECK(r == mdn_success);
++
++ /* Initialize configuration lock variable. */
++ result = isc_rwlock_init(&mdnconflock, 1, 1);
++ RUNTIME_CHECK(result == ISC_R_SUCCESS);
++
++ /* Load configuration file. */
++ lwresd_g_mdnreloadwanted = 1;
++ (void)load_mdnconfiguration(lwresd_g_mdnconffile);
++}
++
++isc_result_t
++ns_lwdmdn_convertfromutf8(isc_buffer_t *from_buffer, isc_buffer_t *to_buffer) {
++ return convert_buffer(from_buffer, to_buffer, convert_from_utf8);
++}
++
++isc_result_t
++ns_lwdmdn_converttoutf8(isc_buffer_t *from_buffer, isc_buffer_t *to_buffer) {
++ return convert_buffer(from_buffer, to_buffer, convert_to_utf8);
++}
++
++static isc_result_t
++convert_buffer(isc_buffer_t *from_buffer, isc_buffer_t *to_buffer,
++ convert_direction_t dir)
++{
++ isc_result_t result;
++ mdn_result_t r;
++ char *fromstr, *tostr;
++ char tmp[256];
++ size_t tolen;
++
++ /*
++ * Reload MDN configuration file, if necessary.
++ */
++ if (lwresd_g_mdnreloadwanted) {
++ result = load_mdnconfiguration(lwresd_g_mdnconffile);
++ }
++
++ /*
++ * Since libmdn assumes all the strings are NUL-terminated,
++ * teminate the input string. If the buffer has some free space,
++ * utilize it. Otherwise, make a local copy.
++ */
++ if (isc_buffer_remaininglength(from_buffer) > 0) {
++ fromstr = isc_buffer_used(from_buffer); /* temporary */
++ *fromstr = '\0';
++ fromstr = isc_buffer_base(from_buffer);
++ } else {
++ size_t fromlen = isc_buffer_usedlength(from_buffer);
++
++ if (fromlen >= sizeof(tmp))
++ fromlen = sizeof(tmp) - 1;
++ fromstr = tmp;
++ memcpy(fromstr, isc_buffer_base(from_buffer), fromlen);
++ fromstr[fromlen] = '\0';
++ }
++ tostr = isc_buffer_used(to_buffer);
++ tolen = isc_buffer_availablelength(to_buffer);
++
++ RWLOCK(&mdnconflock, isc_rwlocktype_read);
++
++ if (dir == convert_from_utf8)
++ r = mdn_res_ucstodns(mdnconf, fromstr, tostr, tolen);
++ else
++ r = mdn_res_dnstoucs(mdnconf, fromstr, tostr, tolen);
++
++ RWUNLOCK(&mdnconflock, isc_rwlocktype_read);
++
++ if (r != mdn_success)
++ return (mdnresult_to_iscresult(r));
++
++ isc_buffer_add(to_buffer, strlen(tostr));
++
++ return (ISC_R_SUCCESS);
++}
++
++static isc_result_t
++load_mdnconfiguration(const char *filename) {
++ isc_result_t result = ISC_R_SUCCESS;
++ mdn_result_t r;
++ mdn_converter_t conv;
++ isc_boolean_t loaded = ISC_FALSE;
++ isc_boolean_t allow_utf8;
++
++ RWLOCK(&mdnconflock, isc_rwlocktype_write);
++
++ logwrite(ISC_LOG_DEBUG(50), "loading mdn configuration %s",
++ filename == NULL ? mdn_resconf_defaultfile() : filename);
++
++ if (lwresd_g_mdnreloadwanted) {
++ r = mdn_resconf_loadfile(mdnconf, filename);
++ if (r == mdn_success)
++ loaded = ISC_TRUE;
++ else
++ result = mdnresult_to_iscresult(r);
++ }
++ lwresd_g_mdnreloadwanted = 0;
++ logwrite(ISC_LOG_DEBUG(100), "finish loading mdn configuration");
++
++ RWUNLOCK(&mdnconflock, isc_rwlocktype_write);
++
++ if (loaded) {
++ if ((conv = mdn_resconf_serverconverter(mdnconf)) != NULL &&
++ !mdn_converter_isasciicompatible(conv)) {
++ logwrite(ISC_LOG_DEBUG(50),
++ "allowing UTF-8 domain names");
++ allow_utf8 = ISC_TRUE;
++ } else {
++ allow_utf8 = ISC_FALSE;
++ }
++ dns_name_allowutf8(allow_utf8);
++ }
++
++ return (result);
++}
++
++static isc_result_t
++mdnresult_to_iscresult(mdn_result_t r) {
++ switch (r) {
++ case mdn_success:
++ return (ISC_R_SUCCESS);
++ case mdn_notfound:
++ case mdn_noentry:
++ case mdn_invalid_name:
++ return (ISC_R_NOTFOUND);
++ case mdn_buffer_overflow:
++ return (ISC_R_NOSPACE);
++ case mdn_nomemory:
++ return (ISC_R_NOMEMORY);
++ case mdn_nofile:
++ return (ISC_R_FILENOTFOUND);
++ default:
++ return (ISC_R_FAILURE);
++ }
++}
++
++static void
++set_log_level(int level) {
++ int loglevel;
++
++ if (level < ISC_LOG_ERROR) {
++ loglevel = mdn_log_level_fatal;
++ } else if (level < ISC_LOG_WARNING) {
++ loglevel = mdn_log_level_error;
++ } else if (level < ISC_LOG_INFO) {
++ loglevel = mdn_log_level_warning;
++ } else if (level < ISC_LOG_DEBUG(50)) {
++ loglevel = mdn_log_level_info;
++ } else if (level < ISC_LOG_DEBUG(100)) {
++ loglevel = mdn_log_level_trace;
++ } else {
++ loglevel = mdn_log_level_dump;
++ }
++ mdn_log_setlevel(loglevel);
++}
++
++static void
++logger(int level, const char *msg) {
++ int loglevel;
++ int msglen;
++
++ /*
++ * Convert libmdn's log level to bind's log level.
++ */
++ switch (level) {
++ case mdn_log_level_fatal:
++ loglevel = ISC_LOG_CRITICAL;
++ break;
++ case mdn_log_level_error:
++ loglevel = ISC_LOG_ERROR;
++ break;
++ case mdn_log_level_warning:
++ loglevel = ISC_LOG_WARNING;
++ break;
++ case mdn_log_level_info:
++ loglevel = ISC_LOG_INFO;
++ break;
++ case mdn_log_level_trace:
++ loglevel = ISC_LOG_DEBUG(50); /* XXX */
++ break;
++ case mdn_log_level_dump:
++ default:
++ loglevel = ISC_LOG_DEBUG(100); /* XXX */
++ break;
++ }
++
++ /*
++ * Since libmdn's messages are end with newline, we have to
++ * remove it.
++ */
++ msglen = strlen(msg);
++ if (msglen > 0 && msg[msglen - 1] == '\n')
++ msglen--;
++
++ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_CLIENT, NS_LOGMODULE_MDN,
++ loglevel, "%.*s", msglen, msg);
++}
++
++static void
++logwrite(int level, const char *fmt, ...) {
++ va_list args;
++
++ va_start(args, fmt);
++ isc_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_CLIENT, NS_LOGMODULE_MDN,
++ level, fmt, args);
++ va_end(args);
++}
++
++#endif /* WITH_MDN */
+--- ./bin/named/lwresd.c.orig Thu Dec 21 10:41:16 2000
++++ ./bin/named/lwresd.c Thu Dec 21 10:53:20 2000
+@@ -47,4 +47,7 @@
+ #include <named/log.h>
+ #include <named/lwaddr.h>
++#ifdef WITH_MDN
++#include <named/lwdmdn.h>
++#endif
+ #include <named/lwresd.h>
+ #include <named/lwdclient.h>
+@@ -351,4 +354,11 @@
+ goto fail;
+ }
++
++#ifdef WITH_MDN
++ /*
++ * Initialize MDN stuff.
++ */
++ ns_lwdmdn_initialize();
++#endif
+
+ if (lwres->searchlist != NULL) {
+--- ./bin/named/main.c.orig Thu Dec 21 10:41:26 2000
++++ ./bin/named/main.c Thu Dec 21 10:53:20 2000
+@@ -277,5 +277,9 @@
+ isc_commandline_errprint = ISC_FALSE;
+ while ((ch = isc_commandline_parse(argc, argv,
++#ifdef WITH_MDN /* Additional option 'M'. */
++ "c:C:d:fgi:lM:n:N:p:P:st:u:vx:")) !=
++#else
+ "c:C:d:fgi:ln:N:p:P:st:u:vx:")) !=
++#endif
+ -1) {
+ switch (ch) {
+@@ -311,4 +315,9 @@
+ ns_g_lwresdonly = ISC_TRUE;
+ break;
++#ifdef WITH_MDN
++ case 'M':
++ lwresd_g_mdnconffile = isc_commandline_argument;
++ break;
++#endif
+ case 'N': /* Deprecated. */
+ case 'n':
diff --git a/contrib/idn/mdnkit/tools/Makefile.in b/contrib/idn/mdnkit/tools/Makefile.in
new file mode 100644
index 00000000..8247fbe7
--- /dev/null
+++ b/contrib/idn/mdnkit/tools/Makefile.in
@@ -0,0 +1,73 @@
+# $Id: Makefile.in,v 1.1 2000/12/07 00:52:27 tale Exp $
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+# Tokyo, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) Japan Network Information Center. All rights reserved."
+#
+# 4. Neither the name of JPNIC may be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "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 JPNIC 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 DAMAGES.
+#
+# 6. Indemnification by Licensee
+# Any person or entities using and/or redistributing this Software under
+# this License Terms and Conditions shall defend indemnify and hold
+# harmless JPNIC from and against any and all judgements damages,
+# expenses, settlement liabilities, cost and other liabilities of any
+# kind as a result of use and redistribution of this Software or any
+# claim, suite, action, litigation or proceeding by any third party
+# arising out of or relates to this License Terms and Conditions.
+#
+# 7. Governing Law, Jurisdiction and Venue
+# This License Terms and Conditions shall be governed by and and
+# construed in accordance with the law of Japan. Any person or entities
+# using and/or redistributing this Software under this License Terms and
+# Conditions hereby agrees and consent to the personal and exclusive
+# jurisdiction and venue of Tokyo District Court of Japan.
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+SUBDIRS = mdnconv runmdn
+
+all:
+ for d in $(SUBDIRS); do (cd $$d; $(MAKE) all); done
+
+install:
+ for d in $(SUBDIRS); do (cd $$d; $(MAKE) install); done
+
+clean:
+ for d in $(SUBDIRS); do (cd $$d; $(MAKE) clean); done
diff --git a/contrib/idn/mdnkit/tools/mdnconv/Makefile.in b/contrib/idn/mdnkit/tools/mdnconv/Makefile.in
new file mode 100644
index 00000000..2b296067
--- /dev/null
+++ b/contrib/idn/mdnkit/tools/mdnconv/Makefile.in
@@ -0,0 +1,109 @@
+# $Id: Makefile.in,v 1.1 2000/12/07 00:52:27 tale Exp $
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+# Tokyo, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) Japan Network Information Center. All rights reserved."
+#
+# 4. Neither the name of JPNIC may be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "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 JPNIC 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 DAMAGES.
+#
+# 6. Indemnification by Licensee
+# Any person or entities using and/or redistributing this Software under
+# this License Terms and Conditions shall defend indemnify and hold
+# harmless JPNIC from and against any and all judgements damages,
+# expenses, settlement liabilities, cost and other liabilities of any
+# kind as a result of use and redistribution of this Software or any
+# claim, suite, action, litigation or proceeding by any third party
+# arising out of or relates to this License Terms and Conditions.
+#
+# 7. Governing Law, Jurisdiction and Venue
+# This License Terms and Conditions shall be governed by and and
+# construed in accordance with the law of Japan. Any person or entities
+# using and/or redistributing this Software under this License Terms and
+# Conditions hereby agrees and consent to the personal and exclusive
+# jurisdiction and venue of Tokyo District Court of Japan.
+
+top_builddir = ../..
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+BINDIR = @bindir@
+LIBDIR = @libdir@
+MANDIR = @mandir@
+
+CC = @CC@
+RANLIB = @RANLIB@
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+SHELL = @SHELL@
+LIBTOOL = @LIBTOOL@
+
+OPTS =
+INCS = -I$(srcdir)/../../include -I../../include
+DEFS =
+
+CFLAGS = $(OPTS) $(INCS) $(DEFS) @CFLAGS@
+
+SRCS = mdnconv.c util.c
+OBJS = mdnconv.o util.o
+
+ICONVLIB = @ICONVLIB@
+MDNLIB = ../../lib/libmdn.la
+
+LIBS = $(MDNLIB) $(ICONVLIB)
+
+all: mdnconv
+
+mdnconv: $(OBJS) $(MDNLIB)
+ $(LIBTOOL) --mode=link $(CC) -o $@ $(OBJS) $(LIBS)
+
+install: install-prog install-man
+
+install-prog: mdnconv
+ [ -d $(BINDIR) ] || mkdir $(BINDIR)
+ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) mdnconv $(BINDIR)
+
+install-man:
+ [ -d $(MANDIR) ] || mkdir $(MANDIR)
+ [ -d $(MANDIR)/man1 ] || mkdir $(MANDIR)/man1
+ $(INSTALL_DATA) $(srcdir)/mdnconv.1 $(MANDIR)/man1
+
+clean:
+ rm -f *.o mdnconv *.core core *~
diff --git a/contrib/idn/mdnkit/tools/mdnconv/README.ja b/contrib/idn/mdnkit/tools/mdnconv/README.ja
new file mode 100644
index 00000000..21fac140
--- /dev/null
+++ b/contrib/idn/mdnkit/tools/mdnconv/README.ja
@@ -0,0 +1,117 @@
+
+ mdnconv -- named.conf/¥¾¡¼¥ó¥Õ¥¡¥¤¥ëÍÑ¥³¡¼¥É¥»¥Ã¥È¥³¥ó¥Ð¡¼¥¿
+
+* »ÈÍÑË¡
+ mdnconv [¥ª¥×¥·¥ç¥ó..] [¥Õ¥¡¥¤¥ë]
+
+* ³µÍ×
+
+mdnconv ¤Ï¥³¥Þ¥ó¥É¹Ô°ú¿ô¤Ç»ØÄꤵ¤ì¤¿¥ª¥×¥·¥ç¥ó¤Ë¤·¤¿¤¬¤Ã¤Æ¥Æ¥­¥¹¥È¤Î¥³¡¼
+¥É¥»¥Ã¥È¤òÊÑ´¹¤·¡¢É¸½à½ÐÎϤ˽ñ¤­½Ð¤·¤Þ¤¹¡£°ú¿ô¤È¤·¤Æ¥Õ¥¡¥¤¥ë̾¤¬»ØÄꤵ
+¤ì¤ì¤Ð¤½¤ÎÆâÍƤòÊÑ´¹¤·¡¢»ØÄꤵ¤ì¤Ê¤±¤ì¤Ðɸ½àÆþÎϤÎÆâÍƤòÊÑ´¹¤·¤Þ¤¹¡£
+
+* ¥ª¥×¥·¥ç¥ó
+
+mdnconv ¤Ï¼¡¤Î¤è¤¦¤Ê¥ª¥×¥·¥ç¥ó¤ò¼õ¤±ÉÕ¤±¤Þ¤¹¡£
+
+ -in ÆþÎÏ¥³¡¼¥É
+ ÆþÎÏ¥³¡¼¥É¥»¥Ã¥È¤Î»ØÄê¤Ç¤¹¡£»ØÄê¤Ç¤­¤ëÃͤϡ¢
+ iconv() ¤¬¼õ¤±ÉÕ¤±¤ë¥³¡¼¥É¥»¥Ã¥È̾¡¢"UTF-5"¡¢
+ ¤ª¤è¤Ó¸å½Ò¤¹¤ë -alias ¥ª¥×¥·¥ç¥ó¤ÇÄêµÁ¤·¤¿¤½¤ì¤é¤ÎÊÌ̾¤Ç¤¹¡£
+ ¸½ºß¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï¤³¤Î¥ª¥×¥·¥ç¥ó¤Î»ØÄê¤Ïɬ¿Ü¤Ç¤¹¡£
+
+ -out ½ÐÎÏ¥³¡¼¥É
+ ½ÐÎÏ¥³¡¼¥É¥»¥Ã¥È¤Î»ØÄê¤Ç¤¹¡£»ØÄê¤Ç¤­¤ëÃͤϡ¢
+ iconv() ¤¬¼õ¤±ÉÕ¤±¤ë¥³¡¼¥É¥»¥Ã¥È̾¡¢"UTF-5"¡¢
+ ¤ª¤è¤Ó¸å½Ò¤¹¤ë -alias ¥ª¥×¥·¥ç¥ó¤ÇÄêµÁ¤·¤¿¤½¤ì¤é¤ÎÊÌ̾¤Ç¤¹¡£
+ ¥Ç¥Õ¥©¥ë¥È¤Ï UTF-8 ¤Ç¤¹¡£
+
+ -normalize Àµµ¬²½
+ ¼Â¹Ô¤¹¤ëÀµµ¬²½¤Î¼ïÎà¤ò»ØÄꤷ¤Þ¤¹¡£¤³¤Î¥ª¥×¥·¥ç¥ó¤ÏÊ£¿ô
+ »ØÄꤹ¤ë¤³¤È¤¬¤Ç¤­¡¢¤½¤Î¾ì¹ç¤Ë¤Ï»ØÄꤵ¤ì¤¿½ç½ø¤Ç
+ Àµµ¬²½¤¬¹Ô¤ï¤ì¤Þ¤¹¡£¸½ºß¡¢»ÈÍѤǤ­¤ëÀµµ¬²½¤Î̾¾Î¤Ï
+ °Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
+
+ ascii-lowercase
+ ASCII ¤ÎÂçʸ»ú¤ò¾®Ê¸»ú¤ËÊÑ´¹¤·¤Þ¤¹¡£
+ ascii-uppercase
+ ASCII ¤Î¾®Ê¸»ú¤òÂçʸ»ú¤ËÊÑ´¹¤·¤Þ¤¹¡£
+ unicode-lowercase
+ UnicodeData.txt ¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë Lowercase Mapping
+ ¤Ë¤·¤¿¤¬¤Ã¤ÆÂçʸ»ú¤ò¾®Ê¸»ú¤ËÊÑ´¹¤·¤Þ¤¹¡£
+ unicode-uppercase
+ UnicodeData.txt ¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë Uppercase Mapping
+ ¤Ë¤·¤¿¤¬¤Ã¤Æ¾®Ê¸»ú¤òÂçʸ»ú¤ËÊÑ´¹¤·¤Þ¤¹¡£
+ unicode-form-c
+ Unicode Normalization Form C ¤Ë¤·¤¿¤¬¤Ã¤Æ
+ Àµµ¬²½¤ò¹Ô¤¤¤Þ¤¹¡£
+ unicode-form-kc
+ Unicode Normalization Form KC ¤Ë¤·¤¿¤¬¤Ã¤Æ
+ Àµµ¬²½¤ò¹Ô¤¤¤Þ¤¹¡£
+ ja-delimiter-hack
+ Á´³Ñ¤Î¶çÅÀ¡Ø¡£¡Ù¤ª¤è¤Ó¥Ô¥ê¥ª¥É¡Ø¡¥¡Ù¤ò
+ Ⱦ³Ñ¤Î¥Ô¥ê¥ª¥É¡Ø.¡Ù¤ËÊÑ´¹¤·¤Þ¤¹¡£
+ ja-fullwidth
+ Ⱦ³Ñ¥«¥¿¥«¥Ê¤òÁ´³Ñ¥«¥¿¥«¥Ê¤ËÊÑ´¹¤·¤Þ¤¹¡£
+
+ -zld ZLD
+ ZLD ¤ò»ØÄꤷ¤Þ¤¹¡£UTF-5 ¤Ø¤ÎÊÑ´¹¤ÎºÝ¡¢¥É¥á¥¤¥ó̾¤Î
+ ºÇ¸å¤¬»ØÄꤵ¤ì¤¿ ZLD ¤Ë°ìÃפ¹¤ë¾ì¹ç¡¢ZLD Éôʬ¤Ï
+ UTF-5 ¤ËÊÑ´¹¤µ¤ì¤Þ¤»¤ó¡£
+ ¤¢¤ë¤¤¤Ï¼¡¤Î -auto ¤ÈÁȤ߹ç¤ï¤»¤¿¾ì¹ç¤Ë¤Ï¡¢
+ ¥É¥á¥¤¥ó̾¤ÎºÇ¸å¤¬¥Ô¥ê¥ª¥É¤Ç¤¢¤ê¡¢¤«¤ÄÈóASCII
+ ʸ»ú¤ò´Þ¤ó¤Ç¤¤¤¿¾ì¹ç¡¢»ØÄꤷ¤¿ZLD ¤¬¼«Æ°Åª¤ËÉղ䵤ì¤Þ¤¹¡£
+
+ -auto
+ ¥É¥á¥¤¥ó̾¤ÎºÇ¸å¤¬¥Ô¥ê¥ª¥É¤Ç¤¢¤ê¡¢¤«¤ÄÈóASCII
+ ʸ»ú¤ò´Þ¤ó¤Ç¤¤¤ë¾ì¹ç¤Ë¡¢-zld ¥ª¥×¥·¥ç¥ó¤Ç»ØÄꤷ¤¿ZLD ¤ò
+ ¼«Æ°Åª¤ËÉղä·¤Þ¤¹¡£
+
+ -whole
+ Àµµ¬²½¤ª¤è¤Ó½ÐÎÏ¥³¡¼¥É¥»¥Ã¥È¤Ø¤ÎÊÑ´¹¤òÆþÎϥƥ­¥¹¥È
+ Á´ÂΤˤ錄¤Ã¤Æ¹Ô¤¤¤Þ¤¹¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢ÆþÎϥƥ­¥¹¥È¤Î
+ ÈóASCIIʸ»ú¤ª¤è¤Ó¤½¤Î¼þÊդΤߤòÂоݤȤ·¤Þ¤¹¡£
+
+ -alias ÊÌ̾¥Õ¥¡¥¤¥ë
+ ¥³¡¼¥É¥»¥Ã¥È̾¤ÎÊÌ̾¤òÄêµÁ¤·¤¿¥Õ¥¡¥¤¥ë¤ò»ØÄꤷ¤Þ¤¹¡£
+
+ -flush
+ ¹Ôñ°Ì¤Ç½ÐÎϤò¥Õ¥é¥Ã¥·¥å¤·¤Þ¤¹¡£
+
+
+* ÊÑ´¹¤Î»ÅÁȤß
+
+mdnconv ¤Ï¡¢ÆþÎϤµ¤ì¤¿¥Ç¡¼¥¿¤ò¤Þ¤º UTF-8 ¤Ø¤ÈÊÑ´¹¤·¤Þ¤¹¡£UTF-8 ¤Î¾õÂÖ
+¤ÇÀµµ¬²½¤ò¼Â¹Ô¤·¡¢ºÇ¸å¤Ë UTF-8 ¤«¤é½ÐÎÏ¥³¡¼¥É¥»¥Ã¥È¤Ø¤ÈÊÑ´¹¤·¤Æ½ÐÎϤ·
+¤Þ¤¹¡£ÆþÎϤµ¤ì¤¿¥Ç¡¼¥¿¤ÎUTF-8¤Ø¤ÎÊÑ´¹¡¢¤Ï¤¹¤Ù¤Æ¤Î¥Ç¡¼¥¿¤ËÂФ·¤Æ¹Ô¤ï¤ì
+¤Þ¤¹¤¬¡¢Àµµ¬²½¤ª¤è¤Ó UTF-8 ¤«¤é½ÐÎÏ¥³¡¼¥É¥»¥Ã¥È¤Ø¤ÎÊÑ´¹¤Ï¡¢ÈóASCIIʸ»ú
+¤È¤½¤Î¼þÊÕ¤ËÂФ·¤Æ¤Î¤ß¹Ô¤ï¤ì¤Þ¤¹¡£¶ñÂÎŪ¤Ë¤Ï¡¢
+
+ ÈóASCIIʸ»ú¡¢¤ª¤è¤Ó¤½¤ÎÁ°¸å¤Î¥É¥á¥¤¥ó̾¤ò¹½À®¤¹¤ëASCIIʸ»ú
+ ¤È¥Ô¥ê¥ª¥É ([-0-9A-Za-z.]) ¤ÎÉôʬ
+
+¤¬ÊÑ´¹Âоݤˤʤê¤Þ¤¹¡£mdnconv ¤ÏÆþÎϥǡ¼¥¿¤ò¹½Ê¸²òÀϤ¹¤ë¤è¤¦¤Ê½èÍý¤Ï¤·
+¤Æ¤¤¤Þ¤»¤ó¤Î¤Ç¡¢¼ÂºÝ¤Ë¤Ï¥É¥á¥¤¥ó̾¤Ç¤Ï¤Ê¤¯¤Æ¤â¡¢¾åµ­¤Î¾ò·ï¤Ë°ìÃפ¹¤ë¸Ä
+½ê¤Ï¤¹¤Ù¤ÆÊÑ´¹Âоݤˤʤê¤Þ¤¹¡£
+
+-whole ¥ª¥×¥·¥ç¥ó¤ò»ØÄꤷ¤Æ mdnconv ¤òµ¯Æ°¤¹¤ë¤³¤È¤Ë¤è¤ê¡¢¤¹¤Ù¤Æ¤Î¥Ç¡¼¥¿¤Ë
+ÂФ·¤ÆÀµµ¬²½¤È½ÐÎÏ¥³¡¼¥É¥»¥Ã¥È¤Ø¤ÎÊÑ´¹¤ò¹Ô¤¦¤³¤È¤¬²Äǽ¤Ç¤¹¡£
+
+
+* named.conf/¥¾¡¼¥ó¥Õ¥¡¥¤¥ë¤Î´ÉÍýÊýË¡
+
+named.conf ¤ä¥¾¡¼¥ó¥Õ¥¡¥¤¥ë¤Ï¥í¡¼¥«¥ë¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Ç½ñ¤«¤ì¤¿¤â¤Î¤ò
+¥Þ¥¹¥¿¡¼¤È¤·¡¢¤³¤ì¤ò mdnconv ¤Ç UTF-8 ¤ä UTF-5 ¤ËÊÑ´¹¤·¤Æ named ¤Ë¿©¤ï
+¤»¤ë¤Î¤¬¤è¤¤¤Ç¤·¤ç¤¦¡£Î㤨¤Ð¥í¡¼¥«¥ë¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Î¥Õ¥¡¥¤¥ë¤Ë¥µ¥Õ¥£¥Ã
+¥¯¥¹ .lc ¤ò¡¢UTF-5/UTF-8 ¤Î¥Õ¥¡¥¤¥ë¤Ë¤½¤ì¤¾¤ì¥µ¥Õ¥£¥Ã¥¯¥¹.utf5 .utf8
+¤ò¤Ä¤±¤ë¤³¤È¤Ë¤¹¤ì¤Ð¡¢¤Ä¤®¤Î¤è¤¦¤Ê Makefile ¤Î¥ë¡¼¥ë¤ò»ØÄꤹ¤ë¤³¤È¤ÇÊÑ
+´¹¤¬¤Ç¤­¤Þ¤¹¡£
+
+ .SUFFIXES: .lc .utf5 .utf8
+ .lc.utf5:
+ mdnconv -in $(LOCALCODE) -out UTF-5 $< > $@
+ .lc.utf8:
+ mdnconv -in $(LOCALCODE) -out UTF-8 $< > $@
+
+
+; $Id: README.ja,v 1.1 2000/12/07 00:52:28 tale Exp $
diff --git a/contrib/idn/mdnkit/tools/mdnconv/mdnconv.1 b/contrib/idn/mdnkit/tools/mdnconv/mdnconv.1
new file mode 100644
index 00000000..6cbccd9e
--- /dev/null
+++ b/contrib/idn/mdnkit/tools/mdnconv/mdnconv.1
@@ -0,0 +1,304 @@
+.\" $Id: mdnconv.1,v 1.1 2000/12/07 00:52:28 tale Exp $
+.\"
+.\" Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+.\"
+.\" By using this file, you agree to the terms and conditions set forth bellow.
+.\"
+.\" LICENSE TERMS AND CONDITIONS
+.\"
+.\" The following License Terms and Conditions apply, unless a different
+.\" license is obtained from Japan Network Information Center ("JPNIC"),
+.\" a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+.\" Tokyo, Japan.
+.\"
+.\" 1. Use, Modification and Redistribution (including distribution of any
+.\" modified or derived work) in source and/or binary forms is permitted
+.\" under this License Terms and Conditions.
+.\"
+.\" 2. Redistribution of source code must retain the copyright notices as they
+.\" appear in each source code file, this License Terms and Conditions.
+.\"
+.\" 3. Redistribution in binary form must reproduce the Copyright Notice,
+.\" this License Terms and Conditions, in the documentation and/or other
+.\" materials provided with the distribution. For the purposes of binary
+.\" distribution the "Copyright Notice" refers to the following language:
+.\" "Copyright (c) Japan Network Information Center. All rights reserved."
+.\"
+.\" 4. Neither the name of JPNIC may be used to endorse or promote products
+.\" derived from this Software without specific prior written approval of
+.\" JPNIC.
+.\"
+.\" 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+.\" "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 JPNIC 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 DAMAGES.
+.\"
+.\" 6. Indemnification by Licensee
+.\" Any person or entities using and/or redistributing this Software under
+.\" this License Terms and Conditions shall defend indemnify and hold
+.\" harmless JPNIC from and against any and all judgements damages,
+.\" expenses, settlement liabilities, cost and other liabilities of any
+.\" kind as a result of use and redistribution of this Software or any
+.\" claim, suite, action, litigation or proceeding by any third party
+.\" arising out of or relates to this License Terms and Conditions.
+.\"
+.\" 7. Governing Law, Jurisdiction and Venue
+.\" This License Terms and Conditions shall be governed by and and
+.\" construed in accordance with the law of Japan. Any person or entities
+.\" using and/or redistributing this Software under this License Terms and
+.\" Conditions hereby agrees and consent to the personal and exclusive
+.\" jurisdiction and venue of Tokyo District Court of Japan.
+.\"
+.TH MDNCONV 1 "June 30, 2000"
+.\"
+.SH NAME
+mdnconv \- codeset converter for named.conf and zone master files
+.\"
+.SH SYNOPSIS
+\fBmdnconv\fP [\fIoptions..\fP] [\fIfile\fP...]
+.\"
+.SH DESCRIPTION
+.B mdnconv
+is a codeset converter for named configuration files and zone master files.
+.B mdnconv
+performs codeset conversion specified by the command-line arguments,
+and writes the converted text to stdout.
+If file name is specified,
+.B mdnconv
+converts the contents of the file. Otherwise,
+.B mdnconv
+converts stdin.
+.PP
+.B mdnconv
+is specifically designed for converting internatinalized domain names,
+and may not be suitable as a general codeset converter.
+.SH OPTIONS
+.TP 4
+\fB\-in\fP \fIin-code\fP
+Specify the codeset name of the input text.
+Any of the following codeset names can be specified.
+.RS 4
+.IP "\(bu" 2
+Codeset names which iconv_open() library function accepts
+.IP "\(bu" 2
+``UTF-5''
+.IP "\(bu" 2
+``RACE''
+.IP "\(bu" 2
+``BRACE''
+.IP "\(bu" 2
+``LACE''
+.IP "\(bu" 2
+Any alias names for the above, defined by the codeset alias file.
+.RE
+.IP "" 4
+If this option is not specified, the default codeset is determined
+from the current locale.
+.TP 4
+\fB\-out\fP \fIout-code\fP
+Specify the codeset name of the output text. \fIout-code\fP can be any
+codeset name that can be specified for
+.B \-in
+option.
+If this option is not specified, the default is the codeset specified
+in MDN resolver configuration file (``server-encoding'' line).
+.TP 4
+\fB\-normalize\fP \fIscheme\fP
+Perform normalization specified by \fIscheme\fP.
+Currently, following \fIscheme\fPs are available:
+.RS 4
+.IP ``ascii-uppercase''
+ASCII lowercase to uppercase mapping.
+.IP ``ascii-lowercase''
+ASCII uppercase to lowercase mapping.
+.IP ``unicode-uppercase''
+Unicode lowercase to uppercase mapping, which is described in
+``Unicode Technical Report #21: Case Mappings'',
+available from unicode.org.
+.IP ``unicode-lowercase''
+Unicode uppercase to lowercase mapping, according ``Case Mappings''.
+.IP ``unicode-form-c''
+Unicode Normlization Form C, which is described in
+``Unicode Technical Report #15: Unicode Normalization Forms'',
+also available from unicode.org.
+.IP ``unicode-form-kc''
+Perform Unicode Normlization Form KC, also described in the above
+document.
+.IP ``ja-compose-voiced-sound''
+Compose Japanese full-width hiragana/katakana character and the following
+(semi) voiced sound mark (dakuten or han-dakuten in Japanese) into a
+single combined letter if such letter exists.
+.IP ``ja-kana-fullwidth''
+Convert Japanese half-width katakana characters (aka ``hankaku katakana'')
+to their corresponding full-width characters.
+.IP ``ja-alnum-halfwidth''
+Convert full-width alphabets, digits and minus sign to half-width.
+.IP ``ja-minus-hack''
+Convert Japanese full-width minus sign (U+2212 ``MINUS SIGN'') to
+``\-'' (U+002D ``HYPHEN-MINUS'').
+.IP ``ja-delimiter-hack''
+Map ``IDEOGRAPHIC FULL STOP'' (U+3002) and ``FULLWIDTH FULL STOP'' (U+FF0E)
+characters to period (``.'') so that these two characters can be used as
+domain component separaters.
+.br
+Note that there is no good reason to use this scheme when you convert
+configuration files or zone files, and its use is strongly
+deprecated.
+.RE
+.IP "" 4
+This option can be specified more than once.
+In that case, each normalization will be performed in the order of the
+specification.
+.br
+If this option is not specified, the schemes specified in MDN resolver
+configuration file (``normalize'' line) are used.
+.TP 4
+\fB\-zld\fP \fIZLD\fP
+Specify ZLD (zero-level domain) to use.
+If a domain name to be converted ends with the specified ZLD,
+the matching part will not be converted.
+This is important for some codesets such as UTF-5, in order to
+protect ZLD part intact from conversion.
+.br
+If this option is not specified, the default is the one specified
+in MDN resolver configuration file (``server-zld'' line) or empty (no ZLD).
+.TP 4
+\fB\-auto\fP
+Automatically append ZLD specified by \-zld option to domain names,
+if they contain non-ASCII character and end with period (``.'').
+By using this option, you don't have to specify ZLD explicitly in
+your zone master file. It is not perfect though, there are cases
+you have to write ZLD explicitly. So take care.
+.TP 4
+\fB\-whole\fP
+Perform normalization and conversion to output codeset for the entire
+input text. If this option is not specified, only non-ASCII characters
+and their surrounding texts will be normalized and converted.
+See ``CONVERSION MECHANISM'' for details.
+.TP 4
+\fB\-alias\fP \fIpath\fP
+Specify a codeset alias file. It is a simple text file, where
+each line has a pair of alias name and real name separated by one
+or more white spaces like below:
+.nf
+.ft CW
+
+ some-alias-codeset-name real-codeset-name
+
+.ft P
+.fi
+Lines starting with ``#'' are treated as comments.
+.TP 4
+\fB\-conf\fP \fIpath\fP
+Specify a MDN resolver configuration file (``mdnres.conf'').
+If not specified, system's default file is used.
+.TP 4
+\fB\-noconf\fP
+Specify that no configuration file is to be used.
+.TP 4
+\fB\-flush\fP
+Force line-buffering mode.
+.SH CONVERSION MECHANISM
+Here is a brief step-by-step description of how
+.B mdnconv
+does its job.
+.IP "1. input-side convnersion" 4
+.B mdnconv
+reads input text line by line, and converts them from the input codeset
+to UTF-8 encoding. Basically this conversion is done using iconv() utility,
+but for some special codesets like UTF-5, special converter will be used.
+.IP "2. finding where to process" 4
+Then
+.B mdnconv
+looks for (part of) internationalized domain name in the converted line,
+and picks them up for further processing.
+.br
+.B mdnconv
+recognizes the character sequence having the following property as
+the internationalized domain name.
+.RS 4
+.IP "\(bu" 2
+containing at least one non-ASCII character, and
+.IP "\(bu" 2
+consisting of legal domain name characters (alphabets, digits, hypens),
+non-ASCII characters and period.
+.RE
+.IP "" 4
+If you are not quite sure what this means (as I),
+the following regular expression may help you.
+.nf
+.ft CW
+
+ [-A-Za-z0-9.]*<non-ASCII char>([-A-Za-z0-9.]|<non-ASCII char>)*
+
+.ft P
+.fi
+For example, only ``www.###.com'' will be picked up from
+the following lines (`#' denotes non-ASCII character).
+.nf
+.ft CW
+
+ www.###.com. IN CNAME serv.xyz.com.
+ serv.xyz.com. IN A 10.0.0.1
+
+.ft P
+.fi
+If \-whole option is specified, this step is skipped and the entire line
+is subject to further processing.
+.IP "3. normalization"
+For each string picked up by the last step, normalization is performed.
+Multiple normalization schemes can be applied.
+.IP "4. output-side conversion" 4
+Finally,
+.B mdnconv
+converts the normalized strings from UTF-8 encoding to the output codeset,
+typically UTF-8, UTF-5 or RACE. And it writes them to stdout together with
+the rest of the line.
+.SH FILE MANAGEMENT
+Maybe the best way to manage named.conf or zone master files that contains
+internationalized domain name is to keep them in your local codeset so that
+they can be edited with your favorite editor, and generate UTF-8 or
+UTF-5 (or whatever) version using \fBmdnconv\fP.
+
+`make' is a convenient tool for this purpose.
+Suppose the local codeset version has suffix `.lc', and its UTF-8 version
+has suffix `.utf8'. The following Makefile enables you to generate
+UTF-8 version from local codeset version by just typing `make'.
+.RS 4
+.nf
+.ft CW
+
+\&.SUFFIXES: .lc .utf8
+\&.lc.utf8:
+ mdnconv -in $(LOCALCODE) -out UTF-8 $(MDNCONVOPT) $< > $@
+
+LOCALCODE = EUC-JP
+MDNCONVOPT = -normalize unicode-form-c
+
+DESTFILES = db.zone1.utf8 db.zone2.utf8
+
+all: $(DESTFILES)
+.ft
+.fi
+.RE
+.\"
+.SH SEE ALSO
+mdnres.conf(5),
+iconv(3) (if your system has one)
+.\"
+.SH BUGS
+The automatic input-code selection depends on your system, and sometimes
+it cannot guess or guess wrong. It is better to explicitly specify it using \-in option.
+.PP
+ZLD handling has some problems. Especially automatic ZLD supply feature
+(\-auto option) is inherently imperfect and you shouldn't rely on it.
+.PP
+Some mechanism is required to force normalization and output-side conversion
+on ASCII-only domain names.
diff --git a/contrib/idn/mdnkit/tools/mdnconv/mdnconv.c b/contrib/idn/mdnkit/tools/mdnconv/mdnconv.c
new file mode 100644
index 00000000..77a49206
--- /dev/null
+++ b/contrib/idn/mdnkit/tools/mdnconv/mdnconv.c
@@ -0,0 +1,397 @@
+#ifndef lint
+static char *rcsid = "$Id: mdnconv.c,v 1.1 2000/12/07 00:52:28 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+/*
+ * mdnconv -- Codeset converter for named.conf and zone files
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <errno.h>
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#include <mdn/result.h>
+#include <mdn/converter.h>
+#include <mdn/normalizer.h>
+#include <mdn/localencoding.h>
+#include <mdn/utf8.h>
+#include <mdn/resconf.h>
+
+#include "util.h"
+
+/* Maxmum number of normalizers */
+#define MAX_NORMALIZER 10
+
+#ifndef MDN_UTF8_ENCODING_NAME
+#define MDN_UTF8_ENCODING_NAME "UTF-8"
+#endif
+
+#ifndef MDN_RACE_ENCODING_NAME
+#define MDN_RACE_ENCODING_NAME "RACE"
+#endif
+
+#ifndef MDN_RACE_PREFIX
+#define MDN_RACE_PREFIX "bq--"
+#endif
+
+int line_number; /* current input file line number */
+int flush_every_line = 0; /* pretty obvious */
+mdn_converter_t conv_in_ctx; /* input converter */
+mdn_converter_t conv_out_ctx; /* output converter */
+mdn_normalizer_t norm_ctx; /* normalizer */
+
+void errormsg(const char *fmt, ...);
+static int convert_file(FILE *fp, char *zld, int auto_zld,
+ int selective);
+static void usage(char *cmd);
+
+int
+main(int ac, char **av) {
+ char *cmd = *av;
+ char *normalizer[MAX_NORMALIZER];
+ int nnormalizer = 0;
+ const char *in_code = NULL;
+ const char *out_code = NULL;
+ char *resconf_file = NULL;
+ int no_resconf = 0;
+ char zld[256 + 1];
+ int zld_specified = 0;
+ int auto_zld = 0;
+ char *encoding_alias = NULL;
+ int selective = 1;
+ FILE *fp;
+ mdn_resconf_t resconf;
+
+#ifdef HAVE_SETLOCALE
+ (void)setlocale(LC_ALL, "");
+#endif
+
+ zld[0] = '\0';
+
+ ac--;
+ av++;
+ while (ac > 0 && **av == '-') {
+
+#define MUST_HAVE_ARG if (ac < 2) usage(cmd)
+ if (strcmp(*av, "-in") == 0) {
+ MUST_HAVE_ARG;
+ in_code = av[1];
+ ac--;
+ av++;
+ } else if (strcmp(*av, "-out") == 0) {
+ MUST_HAVE_ARG;
+ out_code = av[1];
+ ac--;
+ av++;
+ } else if (strcmp(*av, "-conf") == 0) {
+ MUST_HAVE_ARG;
+ resconf_file = av[1];
+ ac--;
+ av++;
+ } else if (strcmp(*av, "-noconf") == 0) {
+ no_resconf = 1;
+ } else if (strcmp(*av, "-zld") == 0) {
+ MUST_HAVE_ARG;
+ canonical_zld(zld, av[1]);
+ zld_specified = 1;
+ ac--;
+ av++;
+ } else if (strcmp(*av, "-auto") == 0) {
+ auto_zld = 1;
+ } else if (strcmp(*av, "-normalize") == 0) {
+ MUST_HAVE_ARG;
+ if (nnormalizer >= MAX_NORMALIZER) {
+ errormsg("too many normalizers\n");
+ exit(1);
+ }
+ normalizer[nnormalizer++] = av[1];
+ ac--;
+ av++;
+ } else if (strcmp(*av, "-alias") == 0) {
+ MUST_HAVE_ARG;
+ encoding_alias = *av;
+ } else if (strcmp(*av, "-flush") == 0) {
+ flush_every_line = 1;
+ } else if (strcmp(*av, "-whole") == 0) {
+ selective = 0;
+ } else {
+ usage(cmd);
+ }
+#undef MUST_HAVE_ARG
+
+ ac--;
+ av++;
+ }
+
+ if (ac > 1)
+ usage(cmd);
+
+ /*
+ * Load configuration file.
+ */
+ resconf = NULL;
+ if (!no_resconf) {
+ mdn_result_t r;
+
+ r = mdn_resconf_initialize();
+ if (r == mdn_success)
+ r = mdn_resconf_create(&resconf);
+ if (r == mdn_success)
+ r = mdn_resconf_loadfile(resconf, resconf_file);
+ if (r != mdn_success) {
+ errormsg("error reading configuration file: %s\n",
+ mdn_result_tostring(r));
+ return (1);
+ }
+ }
+
+ /*
+ * Get default input/output code.
+ */
+ if (in_code == NULL)
+ in_code = mdn_localencoding_name();
+
+ if (out_code == NULL) {
+ mdn_converter_t c;
+ if (resconf != NULL &&
+ (c = mdn_resconf_serverconverter(resconf)) != NULL)
+ out_code = mdn_converter_localencoding(c);
+ }
+
+ if (in_code == NULL) {
+ errormsg("input codeset must be specified\n");
+ return (1);
+ }
+ if (out_code == NULL) {
+ errormsg("output codeset must be specified\n");
+ return (1);
+ }
+
+ /*
+ * Initialize codeset converter.
+ */
+ if (!initialize_converter(in_code, out_code, encoding_alias))
+ return (1);
+
+ /*
+ * Initialize normalizer.
+ */
+ if (nnormalizer == 0 && resconf != NULL)
+ norm_ctx = mdn_resconf_normalizer(resconf);
+ if (norm_ctx == NULL &&
+ !initialize_normalizer(normalizer, nnormalizer))
+ return (1);
+
+ /*
+ * Default ZLD.
+ */
+ if (!zld_specified && resconf != NULL) {
+ const char *conf_zld = mdn_resconf_zld(resconf);
+ if (conf_zld != NULL)
+ canonical_zld(zld, conf_zld);
+ }
+
+ /*
+ * Open input file.
+ */
+ if (ac > 0) {
+ if ((fp = fopen(av[0], "r")) == NULL) {
+ errormsg("cannot open file %s: %s\n",
+ av[0], strerror(errno));
+ return (1);
+ }
+ } else {
+ fp = stdin;
+ }
+
+ /*
+ * Do the conversion.
+ */
+ return convert_file(fp, zld, auto_zld, selective);
+}
+
+static int
+convert_file(FILE *fp, char *zld, int auto_zld, int selective) {
+ mdn_result_t r;
+ char line1[1024];
+ char line2[1024];
+ int nl_trimmed;
+ int race_hack;
+
+ if (strcmp(mdn_converter_localencoding(conv_in_ctx),
+ MDN_RACE_ENCODING_NAME) == 0)
+ race_hack = 1;
+ else
+ race_hack = 0;
+
+ line_number = 1;
+ while (fgets(line1, sizeof(line1), fp) != NULL) {
+ /*
+ * Trim newline at the end. This is needed for
+ * those ascii-comatible encodings such as UTF-5 or RACE
+ * not to try converting newlines, which will result
+ * in `invalid encoding' error.
+ */
+ if (line1[strlen(line1) - 1] == '\n') {
+ line1[strlen(line1) - 1] = '\0';
+ nl_trimmed = 1;
+ } else {
+ nl_trimmed = 0;
+ }
+
+ /*
+ * Convert input line to UTF-8.
+ */
+ if (race_hack) {
+ /*
+ * Find portions encoded in RACE using RACE's prefix
+ * "bq--", and selectively decode those portions.
+ */
+ r = selective_decode(MDN_RACE_PREFIX,
+ line1, line2, 1024);
+ } else {
+ r = mdn_converter_localtoutf8(conv_in_ctx,
+ line1, line2, 1024);
+ }
+ if (r != mdn_success) {
+ errormsg("conversion failed at line %d: %s\n",
+ line_number,
+ mdn_result_tostring(r));
+ return (1);
+ }
+ if (!mdn_utf8_isvalidstring(line2)) {
+ errormsg("conversion to utf-8 failed at line %d\n",
+ line_number);
+ return (1);
+ }
+
+ /*
+ * Normalize and convert to the output codeset.
+ */
+ if (selective) {
+ r = selective_encode(line2, line1, sizeof(line1),
+ zld, auto_zld);
+ } else {
+ r = encode_region(line2, line1, sizeof(line1),
+ zld, auto_zld);
+ }
+ if (r != mdn_success)
+ return (1);
+
+ fputs(line1, stdout);
+ if (nl_trimmed)
+ putc('\n', stdout);
+
+ if (flush_every_line)
+ fflush(stdout);
+
+ line_number++;
+ }
+ return (0);
+}
+
+void
+errormsg(const char *fmt, ...) {
+ va_list args;
+
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+}
+
+static void
+usage(char *cmd) {
+ int i;
+ static char *options[] = {
+ "-in input-codeset : specifies input codeset name.",
+ "-out output-codeset : specifies output codeset name.",
+ "-normalize scheme : specifies normalization scheme.",
+ " this option can be specified",
+ " multiple times.",
+ "-zld zld : specifies ZLD to use.",
+ "-auto : automatically appends ZLD where",
+ " seemed appropriate.",
+ "-alias alias-file : specifies codeset alias file.",
+ "-conf conf-file : specifies pathname of MDN resolver",
+ " configuration file.",
+ "-noconf : do not load MDN resolver configuration",
+ " file.",
+ "-flush : line-buffering mode.",
+ "-whole : convert the whole region instead of",
+ " regions containing non-ascii characters",
+ NULL,
+ };
+
+ fprintf(stderr, "Usage: %s [options..] [file]\n", cmd);
+
+ for (i = 0; options[i] != NULL; i++)
+ fprintf(stderr, "\t%s\n", options[i]);
+
+ exit(1);
+}
diff --git a/contrib/idn/mdnkit/tools/mdnconv/util.c b/contrib/idn/mdnkit/tools/mdnconv/util.c
new file mode 100644
index 00000000..45b0d552
--- /dev/null
+++ b/contrib/idn/mdnkit/tools/mdnconv/util.c
@@ -0,0 +1,424 @@
+#ifndef lint
+static char *rcsid = "$Id: util.c,v 1.1 2000/12/07 00:52:28 tale Exp $";
+#endif
+
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include <mdn/result.h>
+#include <mdn/converter.h>
+#include <mdn/normalizer.h>
+#include <mdn/localencoding.h>
+#include <mdn/utf8.h>
+#include <mdn/selectiveencode.h>
+#include <mdn/util.h>
+
+#include "util.h"
+
+extern int line_number;
+extern mdn_converter_t conv_in_ctx;
+extern mdn_converter_t conv_out_ctx;
+extern mdn_normalizer_t norm_ctx;
+
+extern void errormsg(const char *fmt, ...);
+
+static char *find_prefix(const char *str, const char *prefix);
+static int ascii_tolower(int c);
+
+mdn_result_t
+selective_encode(char *from, char *to, int tolen,
+ const char *zld, int auto_zld)
+{
+ for (;;) {
+ int len;
+ char *region_start, *region_end;
+ mdn_result_t r;
+ char save;
+
+ /*
+ * Find the region that needs conversion.
+ */
+ r = mdn_selectiveencode_findregion(from, &region_start,
+ &region_end);
+ if (r == mdn_notfound) {
+ /*
+ * Not found. Just copy the whole thing.
+ */
+ if (tolen <= strlen(from))
+ return (mdn_buffer_overflow);
+ (void)strcpy(to, from);
+ return (mdn_success);
+ } else if (r != mdn_success) {
+ /* This should not happen.. */
+ errormsg("internal error at line %d: %s\n",
+ line_number, mdn_result_tostring(r));
+ return (r);
+ }
+
+ /*
+ * We have found a region to convert.
+ * First, copy the prefix part verbatim.
+ */
+ len = region_start - from;
+ if (tolen < len) {
+ errormsg("internal buffer overflow at line %d\n",
+ line_number);
+ return (mdn_buffer_overflow);
+ }
+ (void)memcpy(to, from, len);
+ to += len;
+ tolen -= len;
+
+ /*
+ * Terminate the region with NUL.
+ */
+ save = *region_end;
+ *region_end = '\0';
+
+ /*
+ * Encode the region.
+ */
+ r = encode_region(region_start, to, tolen, zld, auto_zld);
+
+ /*
+ * Restore character.
+ */
+ *region_end = save;
+
+ if (r != mdn_success)
+ return (r);
+
+ len = strlen(to);
+ to += len;
+ tolen -= len;
+
+ from = region_end;
+ }
+}
+
+mdn_result_t
+encode_region(const char *region, char *to, int tolen,
+ const char *zld, int auto_zld)
+{
+ int len;
+ mdn_result_t r;
+ int full_domain;
+ int protect_zld;
+ char line[1024];
+
+ /*
+ * Perform normalization.
+ */
+ r = mdn_normalizer_normalize(norm_ctx, region, line, 1024);
+ if (r != mdn_success) {
+ errormsg("normalization failed at line %d: %s\n",
+ line_number,
+ mdn_result_tostring(r));
+ return (r);
+ }
+ /*
+ * This is not necessary if the noramlizer works correctly,
+ * but just in case..
+ */
+ if (!mdn_utf8_isvalidstring(line)) {
+ errormsg("normalizer corrupsed line %d\n",
+ line_number);
+ return (mdn_invalid_encoding);
+ }
+
+ /*
+ * Now we have normalized string in line.
+ * See if it ends with '.'.
+ */
+ len = strlen(line);
+ full_domain = (line[len - 1] == '.');
+
+ /*
+ * Protect ZLD part (if any) from conversion.
+ */
+ if ((protect_zld = zld_match(line, zld)) != 0)
+ line[len - strlen(zld)] = '\0';
+
+ /*
+ * Convert the region to the output encoding.
+ */
+ r = mdn_converter_utf8tolocal(conv_out_ctx, line, to, tolen);
+ if (r != mdn_success) {
+ errormsg("conversion to %s failed at line %d: %s\n",
+ mdn_converter_localencoding(conv_out_ctx),
+ line_number,
+ mdn_result_tostring(r));
+ return (r);
+ }
+
+ len = strlen(to);
+ to += len;
+ tolen -= len;
+
+ if ((full_domain && auto_zld) || protect_zld) {
+ /*
+ * Append ZLD.
+ */
+ if ((len = strlen(zld)) >= tolen)
+ return (mdn_buffer_overflow);
+ (void)strcpy(to, zld);
+ to += len;
+ tolen -= len;
+ }
+
+ return (mdn_success);
+}
+
+void
+canonical_zld(char *s, const char *zld) {
+ int i;
+ int zlen = strlen(zld);
+
+ if (zlen > 256) {
+ errormsg("ZLD is too long\n");
+ exit(1);
+ }
+
+ /* Remove leading dot. */
+ if (zld[0] == '.') {
+ zld++;
+ zlen--;
+ }
+
+ for (i = 0; i < zlen; i++) {
+ int c = *zld;
+ if (('A' <= c && c <= 'Z') ||
+ ('a' <= c && c <= 'z') ||
+ ('0' <= c && c <= '9') ||
+ c == '.' || c == '-') {
+ *s++ = *zld++;
+ } else {
+ errormsg("ZLD contains illegal character %c\n", c);
+ exit(1);
+ }
+ }
+
+ /* Supply trailing dot, if needed. */
+ if (zlen > 0 && s[-1] != '.')
+ (void)strcpy(s, ".");
+}
+
+int
+zld_match(const char *s, const char *zld) {
+ int slen = strlen(s);
+ int zlen = strlen(zld);
+ int i;
+
+ if (slen < zlen)
+ return (0);
+
+ /* oops, strcasecmp is not a stnadard function. */
+ /* return (strcasecmp(s + slen - zlen, zld) == 0); */
+ s += slen - zlen;
+ for (i = 0; i < zlen; i++) {
+ if (s[i] != zld[i] &&
+ s[i] != tolower((unsigned char)zld[i]) &&
+ s[i] != toupper((unsigned char)zld[i]))
+ return (0);
+ }
+ return (1);
+}
+
+mdn_result_t
+selective_decode(const char *prefix, char *from, char *to, int tolen) {
+ char *p;
+ char save;
+ int len;
+ mdn_result_t r;
+
+ while ((p = find_prefix(from, prefix)) != NULL) {
+ /*
+ * Copy up to the prefix.
+ */
+ len = p - from;
+ if (tolen < len)
+ return (mdn_buffer_overflow);
+ (void)memcpy(to, from, len);
+ from = p;
+ to += len;
+ tolen -= len;
+
+ /*
+ * Determine the extent.
+ */
+ p += strlen(prefix);
+ while (('a' <= *p && *p <= 'z') ||
+ ('A' <= *p && *p <= 'Z') ||
+ ('0' <= *p && *p <= '9') ||
+ *p == '-' || *p == '.')
+ p++;
+
+ /*
+ * Convert selected area to UTF-8.
+ */
+ save = *p;
+ *p = '\0';
+ r = mdn_converter_localtoutf8(conv_in_ctx, from, to, tolen);
+ if (r != mdn_success)
+ return (r);
+ *p = save;
+ from = p;
+ len = strlen(to);
+ to += len;
+ tolen -= len;
+ }
+
+ /*
+ * Copy the rest verbatim.
+ */
+ len = strlen(from);
+ if (tolen < len + 1) /* +1 for NUL */
+ return (mdn_buffer_overflow);
+ (void)strcpy(to, from);
+
+ return (mdn_success);
+}
+
+int
+initialize_converter(const char *in_code, const char *out_code,
+ const char *encoding_alias)
+{
+ mdn_result_t r;
+
+ if (encoding_alias != NULL &&
+ (r = mdn_converter_aliasfile(encoding_alias)) != mdn_success) {
+ errormsg("cannot read alias file %s: %s\n",
+ encoding_alias, mdn_result_tostring(r));
+ return (0);
+ }
+ if ((r = mdn_converter_initialize()) != mdn_success) {
+ errormsg("converter initialization failed: %s\n",
+ mdn_result_tostring(r));
+ return (0);
+ }
+ if ((r = mdn_converter_create(in_code, &conv_in_ctx, 0))
+ != mdn_success) {
+ errormsg("cannot create converter for codeset %s: %s\n",
+ in_code, mdn_result_tostring(r));
+ return (0);
+ }
+ if ((r = mdn_converter_create(out_code, &conv_out_ctx, 0))
+ != mdn_success) {
+ errormsg("cannot create converter for codeset %s: %s\n",
+ out_code, mdn_result_tostring(r));
+ return (0);
+ }
+ return (1);
+}
+
+int
+initialize_normalizer(char **normalizer, int nnormalizer) {
+ mdn_result_t r;
+ int i;
+
+ if ((r = mdn_normalizer_initialize()) != mdn_success) {
+ errormsg("normalizer initialization failed: %s\n",
+ mdn_result_tostring(r));
+ return (0);
+ }
+ if ((r = mdn_normalizer_create(&norm_ctx)) != mdn_success) {
+ errormsg("cannot create normalizer: %s\n",
+ mdn_result_tostring(r));
+ return (0);
+ }
+ for (i = 0; i < nnormalizer; i++) {
+ if ((r = mdn_normalizer_add(norm_ctx, normalizer[i]))
+ != mdn_success) {
+ errormsg("cannot add normalizer %s: %s\n",
+ normalizer[i], mdn_result_tostring(r));
+ return (0);
+ }
+ }
+ return (1);
+}
+
+static int
+ascii_tolower(int c) {
+ if ('A' <= c && c <= 'Z')
+ return (c - 'A' + 'a');
+ else
+ return (c);
+}
+
+static char *
+find_prefix(const char *str, const char *prefix) {
+ int top = ascii_tolower(prefix[0]);
+ size_t plen = strlen(prefix);
+
+ while (*str != '\0') {
+ if ((*str == top || ascii_tolower(*str) == top) &&
+ mdn_util_casematch(str, prefix, plen))
+ return ((char *)str);
+ str++;
+ }
+ return (NULL);
+}
diff --git a/contrib/idn/mdnkit/tools/mdnconv/util.h b/contrib/idn/mdnkit/tools/mdnconv/util.h
new file mode 100644
index 00000000..4bf90e2d
--- /dev/null
+++ b/contrib/idn/mdnkit/tools/mdnconv/util.h
@@ -0,0 +1,72 @@
+/* $Id: util.h,v 1.1 2000/12/07 00:52:28 tale Exp $ */
+/*
+ * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set forth bellow.
+ *
+ * LICENSE TERMS AND CONDITIONS
+ *
+ * The following License Terms and Conditions apply, unless a different
+ * license is obtained from Japan Network Information Center ("JPNIC"),
+ * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+ * Tokyo, Japan.
+ *
+ * 1. Use, Modification and Redistribution (including distribution of any
+ * modified or derived work) in source and/or binary forms is permitted
+ * under this License Terms and Conditions.
+ *
+ * 2. Redistribution of source code must retain the copyright notices as they
+ * appear in each source code file, this License Terms and Conditions.
+ *
+ * 3. Redistribution in binary form must reproduce the Copyright Notice,
+ * this License Terms and Conditions, in the documentation and/or other
+ * materials provided with the distribution. For the purposes of binary
+ * distribution the "Copyright Notice" refers to the following language:
+ * "Copyright (c) Japan Network Information Center. All rights reserved."
+ *
+ * 4. Neither the name of JPNIC may be used to endorse or promote products
+ * derived from this Software without specific prior written approval of
+ * JPNIC.
+ *
+ * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+ * "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 JPNIC 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 DAMAGES.
+ *
+ * 6. Indemnification by Licensee
+ * Any person or entities using and/or redistributing this Software under
+ * this License Terms and Conditions shall defend indemnify and hold
+ * harmless JPNIC from and against any and all judgements damages,
+ * expenses, settlement liabilities, cost and other liabilities of any
+ * kind as a result of use and redistribution of this Software or any
+ * claim, suite, action, litigation or proceeding by any third party
+ * arising out of or relates to this License Terms and Conditions.
+ *
+ * 7. Governing Law, Jurisdiction and Venue
+ * This License Terms and Conditions shall be governed by and and
+ * construed in accordance with the law of Japan. Any person or entities
+ * using and/or redistributing this Software under this License Terms and
+ * Conditions hereby agrees and consent to the personal and exclusive
+ * jurisdiction and venue of Tokyo District Court of Japan.
+ */
+
+extern mdn_result_t selective_encode(char *from, char *to, int tolen,
+ const char *zld, int auto_zld);
+extern mdn_result_t encode_region(const char *region, char *to, int tolen,
+ const char *zld, int auto_zld);
+extern void canonical_zld(char *s, const char *zld);
+extern int zld_match(const char *s, const char *zld);
+extern mdn_result_t selective_decode(const char *prefix,
+ char *from, char *to, int tolen);
+extern int initialize_converter(const char *in_code,
+ const char *out_code,
+ const char *encoding_alias);
+extern int initialize_normalizer(char **normalizer,
+ int nnormalizer);
diff --git a/contrib/idn/mdnkit/tools/rpm/dnsproxy.init b/contrib/idn/mdnkit/tools/rpm/dnsproxy.init
new file mode 100644
index 00000000..fd0edefe
--- /dev/null
+++ b/contrib/idn/mdnkit/tools/rpm/dnsproxy.init
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# chkconfig: 345 60 10
+# description: This shell script takes care of starting and stopping
+# dnsproxy (DNS proxy server).
+#
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+# Check that networking is up.
+[ ${NETWORKING} = "no" ] && exit 0
+
+[ -f /usr/sbin/dnsproxy ] || exit 0
+
+[ -f /etc/dnsproxy.conf ] || exit 0
+
+# See how we were called.
+case "$1" in
+ start)
+ # Start daemons.
+ echo -n "Starting dnsproxy: "
+ daemon dnsproxy -daemon
+ echo
+ touch /var/lock/subsys/dnsproxy
+ ;;
+ stop)
+ # Stop daemons.
+ echo -n "Shutting down dnsproxy: "
+ killproc dnsproxy
+ echo "done"
+ rm -f /var/lock/subsys/dnsproxy
+ ;;
+ *)
+ echo "Usage: dnsproxy {start|stop}"
+ exit 1
+esac
+
+exit 0
diff --git a/contrib/idn/mdnkit/tools/rpm/mdnkit.spec b/contrib/idn/mdnkit/tools/rpm/mdnkit.spec
new file mode 100644
index 00000000..592e8b9a
--- /dev/null
+++ b/contrib/idn/mdnkit/tools/rpm/mdnkit.spec
@@ -0,0 +1,116 @@
+%define name mdnkit
+%define version 1.2
+%define disttop %{name}-%{version}-src
+%define bind_version 8.2.2-P7
+%define serial 2000112701
+
+Name: %{name}
+Version: %{version}
+Release: 1
+Copyright: distributable
+Group: System Environment/Daemons
+Source: %{disttop}.tar.gz
+#Source10: ftp://ftp.isc.org/isc/bind/src/%{bind_version}/bind-src.tar.gz
+#Source11: ftp://ftp.isc.org/isc/bind/src/%{bind_version}/bind-doc.tar.gz
+#Source12: ftp://ftp.isc.org/isc/bind/src/%{bind_version}/bind-contrib.tar.gz
+#NoSource: 10
+#NoSource: 11
+#NoSource: 12
+#Patch0: dnsproxy.patch1
+BuildRoot: /var/tmp/%{name}-root
+Serial: %{serial}
+Summary: multilingual Domain Name evaluation kit (mDNkit/JPNIC)
+Vendor: JPNIC
+Packager: Japan Network Information Center
+
+%description
+mDNkit is a kit for evaluating various proposed methods regarding
+multilingualized/internationalized DNS.
+
+%package devel
+Group: Development/Libraries
+Summary: The development files for mDNkit
+
+%description devel
+The header files and library(libmdn.a) to develop applications
+that use MDN library.
+
+%prep
+%setup -n %{disttop}
+#%patch0 -p0 -b .patch1
+
+%build
+if [ -f /usr/lib/libiconv.a -o -f /usr/lib/libiconv.so ]
+then
+ ICONV="--with-iconv=yes"
+fi
+
+CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --sysconfdir=/etc $ICONV
+make
+
+%install
+rm -fr $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT/usr/bin
+mkdir -p $RPM_BUILD_ROOT/usr/sbin
+mkdir -p $RPM_BUILD_ROOT/usr/lib
+mkdir -p $RPM_BUILD_ROOT/usr/include
+mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
+make prefix=$RPM_BUILD_ROOT/usr ETCDIR=$RPM_BUILD_ROOT/etc install
+# make prefix=$RPM_BUILD_ROOT/usr sysconfdir=$RPM_BUILD_ROOT/etc install
+
+install -c -m 755 tools/rpm/dnsproxy.init $RPM_BUILD_ROOT/etc/rc.d/init.d/dnsproxy
+
+# devel kit
+#install -c lib/libmdn.a $RPM_BUILD_ROOT/usr/lib
+#cp -r include/mdn $RPM_BUILD_ROOT/usr/include
+
+# docs
+mkdir rpm_docs
+(cp DISTFILES README.ja README LICENSE.txt ChangeLog rpm_docs)
+cp tools/mdnconv/README.ja rpm_docs/README-mdnconv.ja
+cp -r patch rpm_docs
+
+%clean
+rm -fr $RPM_BUILD_ROOT
+
+%changelog
+* Mon Nov 27 2000 Makoto Ishisone <ishisone@sra.co.jp>
+- 1.2 release
+
+* Thu Nov 2 2000 MANABE Takashi <manabe@dsl.gr.jp>
+- 1.1 release
+
+* Fri Oct 27 2000 MANABE Takashi <manabe@dsl.gr.jp>
+- dnsproxy.patch1
+- move libmdnresolv.{la,so} from mdnkit-devel to mdnkit package
+
+* Wed Oct 18 2000 MANABE Takashi <manabe@dsl.gr.jp>
+- 1.0 release
+
+%files
+%defattr(-, root, root)
+/usr/sbin/dnsproxy
+/usr/bin/mdnconv
+/usr/bin/runmdn
+/etc/rc.d/init.d/dnsproxy
+/usr/lib/libmdn.so.*
+/usr/lib/libmdnresolv.so.*
+/usr/lib/libmdnresolv.so
+/usr/lib/libmdnresolv.la
+%attr(0644, root, root) %config(noreplace) /etc/dnsproxy.conf
+%attr(0644, root, root) /etc/mdnres.conf.sample
+%attr(0644, root, man) /usr/man/man1/mdnconv.1
+%attr(0644, root, man) /usr/man/man1/runmdn.1
+%attr(0644, root, man) /usr/man/man5/mdnres.conf.5
+%attr(0644, root, man) /usr/man/man8/dnsproxy.8
+%doc rpm_docs/*
+
+%files devel
+%defattr(-, root, root)
+/usr/lib/libmdn.a
+/usr/lib/libmdn.la
+/usr/lib/libmdn.so
+/usr/lib/libmdnresolv.a
+/usr/include/mdn/*
+%doc lib/README
diff --git a/contrib/idn/mdnkit/tools/runmdn/Makefile.in b/contrib/idn/mdnkit/tools/runmdn/Makefile.in
new file mode 100644
index 00000000..da51fd7e
--- /dev/null
+++ b/contrib/idn/mdnkit/tools/runmdn/Makefile.in
@@ -0,0 +1,146 @@
+# $Id: Makefile.in,v 1.1 2000/12/07 00:52:29 tale Exp $
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+# Tokyo, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) Japan Network Information Center. All rights reserved."
+#
+# 4. Neither the name of JPNIC may be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "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 JPNIC 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 DAMAGES.
+#
+# 6. Indemnification by Licensee
+# Any person or entities using and/or redistributing this Software under
+# this License Terms and Conditions shall defend indemnify and hold
+# harmless JPNIC from and against any and all judgements damages,
+# expenses, settlement liabilities, cost and other liabilities of any
+# kind as a result of use and redistribution of this Software or any
+# claim, suite, action, litigation or proceeding by any third party
+# arising out of or relates to this License Terms and Conditions.
+#
+# 7. Governing Law, Jurisdiction and Venue
+# This License Terms and Conditions shall be governed by and and
+# construed in accordance with the law of Japan. Any person or entities
+# using and/or redistributing this Software under this License Terms and
+# Conditions hereby agrees and consent to the personal and exclusive
+# jurisdiction and venue of Tokyo District Court of Japan.
+
+LIB_CURRENT=4
+LIB_REVISION=0
+
+.SUFFIXES: .lo
+
+top_builddir = ../..
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+libdir = @libdir@
+mandir = @mandir@
+
+CC = @CC@
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_DATA = @INSTALL_DATA@
+SHELL = @SHELL@
+LIBTOOL = @LIBTOOL@
+
+OPTS =
+INCS = -I$(srcdir)/../../include -I../../include
+DEFS =
+CFLAGS = $(INCS) $(OPTS) $(DEFS) @CFLAGS@
+LDFLAGS = @LDFLAGS@
+
+LIB = libmdnresolv
+OBJS = res_comp.lo ns_name.lo $(MDNOBJS)
+SCRIPT = runmdn
+
+MDNDIR = ../../lib
+MDNOBJS = \
+ $(MDNDIR)/converter.lo \
+ $(MDNDIR)/debug.lo \
+ $(MDNDIR)/dn.lo \
+ $(MDNDIR)/localencoding.lo \
+ $(MDNDIR)/log.lo \
+ $(MDNDIR)/normalizer.lo \
+ $(MDNDIR)/race.lo \
+ $(MDNDIR)/res.lo \
+ $(MDNDIR)/resconf.lo \
+ $(MDNDIR)/result.lo \
+ $(MDNDIR)/strhash.lo \
+ $(MDNDIR)/translator.lo \
+ $(MDNDIR)/unicode.lo \
+ $(MDNDIR)/unormalize.lo \
+ $(MDNDIR)/utf5.lo \
+ $(MDNDIR)/utf8.lo \
+ $(MDNDIR)/util.lo \
+ $(MDNDIR)/zldrule.lo
+
+ICONVLIB = @ICONVLIB@
+
+.c.lo:
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<
+
+all: $(LIB).la
+
+$(LIB).la: $(OBJS)
+ $(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
+ -version-info $(LIB_CURRENT):$(LIB_REVISION) \
+ -module -rpath $(libdir) $(OBJS)
+
+install: install-lib install-script install-man
+
+install-script:
+ [ -d $(bindir) ] || mkdir $(bindir)
+ $(INSTALL_SCRIPT) $(SCRIPT) $(bindir)
+
+install-lib:
+ [ -d $(libdir) ] || mkdir $(libdir)
+ $(LIBTOOL) --mode=install $(INSTALL_DATA) libmdnresolv.la $(libdir)
+
+install-man:
+ [ -d $(mandir) ] || mkdir $(mandir)
+ [ -d $(mandir)/man1 ] || mkdir $(mandir)/man1
+ $(INSTALL_DATA) $(srcdir)/runmdn.1 $(mandir)/man1
+
+clean:
+ rm -f *.lo *.la *.o
+
+realclean:
+ rm -f Makefile runmdn config.cache config.log config.status libtool
+ rm -f *.lo *.la *.o *~
+ rm -fr .libs/
diff --git a/contrib/idn/mdnkit/tools/runmdn/ns_name.c b/contrib/idn/mdnkit/tools/runmdn/ns_name.c
new file mode 100644
index 00000000..52100b32
--- /dev/null
+++ b/contrib/idn/mdnkit/tools/runmdn/ns_name.c
@@ -0,0 +1,695 @@
+/*
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef lint
+static const char rcsid[] = "$Id: ns_name.c,v 1.1 2000/12/07 00:52:29 tale Exp $";
+#endif
+
+#include <sys/types.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <resolv.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <mdn/resconf.h>
+#include <mdn/res.h>
+
+#ifndef NS_CMPRSFLGS
+#define NS_CMPRSFLGS 0xc0
+#endif
+#ifndef NS_MAXCDNAME
+#define NS_MAXCDNAME 255
+#endif
+
+/* Data. */
+
+static const char digits[] = "0123456789";
+
+static int mdn_initialized = 0;
+static mdn_resconf_t mdn_conf = NULL;
+
+/* Forward. */
+
+static int special(int);
+static int dn_find(const u_char *, const u_char *,
+ const u_char * const *,
+ const u_char * const *);
+static void mdn_initialize(void);
+static const char *convert_from_local(const char *local_name,
+ char *dns_name,
+ size_t dns_name_len);
+static const char *convert_to_local(const char *dns_name,
+ char *local_name,
+ size_t local_name_len);
+
+/* Public. */
+
+/*
+ * ns_name_ntop(src, dst, dstsiz)
+ * Convert an encoded domain name to printable ascii as per RFC1035.
+ * return:
+ * Number of bytes written to buffer, or -1 (with errno set)
+ * notes:
+ * The root is returned as "."
+ * All other domains are returned in non absolute form
+ */
+int
+ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) {
+ const u_char *cp;
+ char *dn, *eom;
+ u_char c;
+ u_int n;
+ char mdnbuf[256];
+
+ cp = src;
+ dn = mdnbuf;
+ eom = mdnbuf + sizeof(mdnbuf);
+
+ while ((n = *cp++) != 0) {
+ if ((n & NS_CMPRSFLGS) != 0) {
+ /* Some kind of compression pointer. */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ if (dn != mdnbuf) {
+ if (dn >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *dn++ = '.';
+ }
+ if (dn + n >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ for ((void)NULL; n > 0; n--) {
+ c = *cp++;
+ if (special(c)) {
+ if (dn + 1 >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *dn++ = '\\';
+ *dn++ = (char)c;
+ } else {
+ if (dn >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *dn++ = (char)c;
+ }
+ }
+ }
+ if (dn == mdnbuf) {
+ if (dn >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *dn++ = '.';
+ }
+ if (dn >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *dn++ = '\0';
+
+ n = dn - mdnbuf;
+ if (convert_to_local(mdnbuf, dst, dstsiz) == mdnbuf) {
+ if (dstsiz < n) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ (void)memcpy(dst, mdnbuf, n);
+ }
+ return (n);
+}
+
+/*
+ * For glibc-2.1, we want to define __ns_name_ntop() in addition with
+ * ns_name_ntop().
+ * However, on some systems the header files contain a macro that
+ * expands ns_name_ntop into __ns_name_ntop, causing function redefinition
+ * error. To prevent the error, we prepend "__" to what is the result
+ * of macro expansion of "ns_name_ntop". This requires two macros below.
+ */
+#define mdn_prepend(x) _mdn_prepend(x)
+#define _mdn_prepend(x) __ ## x
+int
+mdn_prepend(ns_name_ntop)(const u_char *src, char *dst, size_t dstsiz) {
+ return (ns_name_ntop(src, dst, dstsiz));
+}
+
+/*
+ * ns_name_pton(src, dst, dstsiz)
+ * Convert a ascii string into an encoded domain name as per RFC1035.
+ * return:
+ * -1 if it fails
+ * 1 if string was fully qualified
+ * 0 is string was not fully qualified
+ * notes:
+ * Enforces label and domain length limits.
+ */
+
+int
+ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
+ u_char *label, *bp, *eom;
+ int c, n, escaped;
+ char *cp;
+ char mdnbuf[256];
+
+ src = convert_from_local(src, mdnbuf, sizeof(mdnbuf));
+
+ escaped = 0;
+ bp = dst;
+ eom = dst + dstsiz;
+ label = bp++;
+
+ while ((c = *src++) != 0) {
+ if (c == '.') {
+ c = (bp - label - 1);
+ if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ if (label >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *label = c;
+ /* Fully qualified ? */
+ if (*src == '\0') {
+ if (c != 0) {
+ if (bp >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *bp++ = '\0';
+ }
+ if ((bp - dst) > MAXCDNAME) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ return (1);
+ }
+ if (c == 0 || *src == '.') {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ label = bp++;
+ continue;
+ }
+ if (bp >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *bp++ = (u_char)c;
+ }
+ c = (bp - label - 1);
+ if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ if (label >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *label = c;
+ if (c != 0) {
+ if (bp >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *bp++ = 0;
+ }
+ if ((bp - dst) > MAXCDNAME) { /* src too big */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ return (0);
+}
+
+/*
+ * ns_name_ntol(src, dst, dstsiz)
+ * Convert a network strings labels into all lowercase.
+ * return:
+ * Number of bytes written to buffer, or -1 (with errno set)
+ * notes:
+ * Enforces label and domain length limits.
+ */
+
+int
+ns_name_ntol(const u_char *src, u_char *dst, size_t dstsiz) {
+ const u_char *cp;
+ u_char *dn, *eom;
+ u_char c;
+ u_int n;
+
+ cp = src;
+ dn = dst;
+ eom = dst + dstsiz;
+
+ while ((n = *cp++) != 0) {
+ if ((n & NS_CMPRSFLGS) != 0) {
+ /* Some kind of compression pointer. */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *dn++ = n;
+ if (dn + n >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ for ((void)NULL; n > 0; n--) {
+ c = *cp++;
+ if (c < 128 && isupper(c))
+ *dn++ = tolower(c);
+ else
+ *dn++ = c;
+ }
+ }
+ *dn++ = '\0';
+ return (dn - dst);
+}
+
+/*
+ * ns_name_unpack(msg, eom, src, dst, dstsiz)
+ * Unpack a domain name from a message, source may be compressed.
+ * return:
+ * -1 if it fails, or consumed octets if it succeeds.
+ */
+int
+ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
+ u_char *dst, size_t dstsiz)
+{
+ const u_char *srcp, *dstlim;
+ u_char *dstp;
+ int n, len, checked;
+
+ len = -1;
+ checked = 0;
+ dstp = dst;
+ srcp = src;
+ dstlim = dst + dstsiz;
+ if (srcp < msg || srcp >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ /* Fetch next label in domain name. */
+ while ((n = *srcp++) != 0) {
+ /* Check for indirection. */
+ switch (n & NS_CMPRSFLGS) {
+ case 0:
+ /* Limit checks. */
+ if (dstp + n + 1 >= dstlim || srcp + n >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ checked += n + 1;
+ *dstp++ = n;
+ memcpy(dstp, srcp, n);
+ dstp += n;
+ srcp += n;
+ break;
+
+ case NS_CMPRSFLGS:
+ if (srcp >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ if (len < 0)
+ len = srcp - src + 1;
+ srcp = msg + (((n & 0x3f) << 8) | (*srcp & 0xff));
+ if (srcp < msg || srcp >= eom) { /* Out of range. */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ checked += 2;
+ /*
+ * Check for loops in the compressed name;
+ * if we've looked at the whole message,
+ * there must be a loop.
+ */
+ if (checked >= eom - msg) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ break;
+
+ default:
+ errno = EMSGSIZE;
+ return (-1); /* flag error */
+ }
+ }
+ *dstp = '\0';
+ if (len < 0)
+ len = srcp - src;
+ return (len);
+}
+
+/*
+ * ns_name_pack(src, dst, dstsiz, dnptrs, lastdnptr)
+ * Pack domain name 'domain' into 'comp_dn'.
+ * return:
+ * Size of the compressed name, or -1.
+ * notes:
+ * 'dnptrs' is an array of pointers to previous compressed names.
+ * dnptrs[0] is a pointer to the beginning of the message. The array
+ * ends with NULL.
+ * 'lastdnptr' is a pointer to the end of the array pointed to
+ * by 'dnptrs'.
+ * Side effects:
+ * The list of pointers in dnptrs is updated for labels inserted into
+ * the message as we compress the name. If 'dnptr' is NULL, we don't
+ * try to compress names. If 'lastdnptr' is NULL, we don't update the
+ * list.
+ */
+int
+ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
+ const u_char **dnptrs, const u_char **lastdnptr)
+{
+ u_char *dstp;
+ const u_char **cpp, **lpp, *eob, *msg;
+ const u_char *srcp;
+ int n, l;
+
+ srcp = src;
+ dstp = dst;
+ eob = dstp + dstsiz;
+ lpp = cpp = NULL;
+ if (dnptrs != NULL) {
+ if ((msg = *dnptrs++) != NULL) {
+ for (cpp = dnptrs; *cpp != NULL; cpp++)
+ (void)NULL;
+ lpp = cpp; /* end of list to search */
+ }
+ } else
+ msg = NULL;
+
+ /* make sure the domain we are about to add is legal */
+ l = 0;
+ do {
+ n = *srcp;
+ if ((n & NS_CMPRSFLGS) != 0) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ l += n + 1;
+ if (l > MAXCDNAME) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ srcp += n + 1;
+ } while (n != 0);
+
+ /* from here on we need to reset compression pointer array on error */
+ srcp = src;
+ do {
+ /* Look to see if we can use pointers. */
+ n = *srcp;
+ if (n != 0 && msg != NULL) {
+ l = dn_find(srcp, msg, (const u_char * const *)dnptrs,
+ (const u_char * const *)lpp);
+ if (l >= 0) {
+ if (dstp + 1 >= eob) {
+ goto cleanup;
+ }
+ *dstp++ = (l >> 8) | NS_CMPRSFLGS;
+ *dstp++ = l % 256;
+ return (dstp - dst);
+ }
+ /* Not found, save it. */
+ if (lastdnptr != NULL && cpp < lastdnptr - 1 &&
+ (dstp - msg) < 0x4000) {
+ *cpp++ = dstp;
+ *cpp = NULL;
+ }
+ }
+ /* copy label to buffer */
+ if (n & NS_CMPRSFLGS) { /* Should not happen. */
+ goto cleanup;
+ }
+ if (dstp + 1 + n >= eob) {
+ goto cleanup;
+ }
+ memcpy(dstp, srcp, n + 1);
+ srcp += n + 1;
+ dstp += n + 1;
+ } while (n != 0);
+
+ if (dstp > eob) {
+cleanup:
+ if (msg != NULL)
+ *lpp = NULL;
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ return (dstp - dst);
+}
+
+/*
+ * ns_name_uncompress(msg, eom, src, dst, dstsiz)
+ * Expand compressed domain name to presentation format.
+ * return:
+ * Number of bytes read out of `src', or -1 (with errno set).
+ * note:
+ * Root domain returns as "." not "".
+ */
+int
+ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src,
+ char *dst, size_t dstsiz)
+{
+ u_char tmp[NS_MAXCDNAME];
+ int n;
+
+ if ((n = ns_name_unpack(msg, eom, src, tmp, sizeof tmp)) == -1)
+ return (-1);
+ if (ns_name_ntop(tmp, dst, dstsiz) == -1)
+ return (-1);
+ return (n);
+}
+
+/*
+ * ns_name_compress(src, dst, dstsiz, dnptrs, lastdnptr)
+ * Compress a domain name into wire format, using compression pointers.
+ * return:
+ * Number of bytes consumed in `dst' or -1 (with errno set).
+ * notes:
+ * 'dnptrs' is an array of pointers to previous compressed names.
+ * dnptrs[0] is a pointer to the beginning of the message.
+ * The list ends with NULL. 'lastdnptr' is a pointer to the end of the
+ * array pointed to by 'dnptrs'. Side effect is to update the list of
+ * pointers for labels inserted into the message as we compress the name.
+ * If 'dnptr' is NULL, we don't try to compress names. If 'lastdnptr'
+ * is NULL, we don't update the list.
+ */
+int
+ns_name_compress(const char *src, u_char *dst, size_t dstsiz,
+ const u_char **dnptrs, const u_char **lastdnptr)
+{
+ u_char tmp[NS_MAXCDNAME];
+
+ if (ns_name_pton(src, tmp, sizeof tmp) == -1)
+ return (-1);
+ return (ns_name_pack(tmp, dst, dstsiz, dnptrs, lastdnptr));
+}
+
+/*
+ * ns_name_skip(ptrptr, eom)
+ * Advance *ptrptr to skip over the compressed name it points at.
+ * return:
+ * 0 on success, -1 (with errno set) on failure.
+ */
+int
+ns_name_skip(const u_char **ptrptr, const u_char *eom) {
+ const u_char *cp;
+ u_int n;
+
+ cp = *ptrptr;
+ while (cp < eom && (n = *cp++) != 0) {
+ /* Check for indirection. */
+ switch (n & NS_CMPRSFLGS) {
+ case 0: /* normal case, n == len */
+ cp += n;
+ continue;
+ case NS_CMPRSFLGS: /* indirection */
+ cp++;
+ break;
+ default: /* illegal type */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ break;
+ }
+ if (cp > eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *ptrptr = cp;
+ return (0);
+}
+
+/* Private. */
+
+/*
+ * special(ch)
+ * Thinking in noninternationalized USASCII (per the DNS spec),
+ * is this characted special ("in need of quoting") ?
+ * return:
+ * boolean.
+ */
+static int
+special(int ch) {
+ switch (ch) {
+ case 0x22: /* '"' */
+ case 0x2E: /* '.' */
+ case 0x3B: /* ';' */
+ case 0x5C: /* '\\' */
+ /* Special modifiers in zone files. */
+ case 0x40: /* '@' */
+ case 0x24: /* '$' */
+ return (1);
+ default:
+ return (0);
+ }
+}
+
+/*
+ * Thinking in noninternationalized USASCII (per the DNS spec),
+ * convert this character to lower case if it's upper case.
+ */
+static int
+mklower(int ch) {
+ if (ch >= 0x41 && ch <= 0x5A)
+ return (ch + 0x20);
+ return (ch);
+}
+
+/*
+ * dn_find(domain, msg, dnptrs, lastdnptr)
+ * Search for the counted-label name in an array of compressed names.
+ * return:
+ * offset from msg if found, or -1.
+ * notes:
+ * dnptrs is the pointer to the first name on the list,
+ * not the pointer to the start of the message.
+ */
+static int
+dn_find(const u_char *domain, const u_char *msg,
+ const u_char * const *dnptrs,
+ const u_char * const *lastdnptr)
+{
+ const u_char *dn, *cp, *sp;
+ const u_char * const *cpp;
+ u_int n;
+
+ for (cpp = dnptrs; cpp < lastdnptr; cpp++) {
+ dn = domain;
+ sp = cp = *cpp;
+ while ((n = *cp++) != 0) {
+ /*
+ * check for indirection
+ */
+ switch (n & NS_CMPRSFLGS) {
+ case 0: /* normal case, n == len */
+ if (n != *dn++)
+ goto next;
+ for ((void)NULL; n > 0; n--)
+ if (mklower(*dn++) != mklower(*cp++))
+ goto next;
+ /* Is next root for both ? */
+ if (*dn == '\0' && *cp == '\0')
+ return (sp - msg);
+ if (*dn)
+ continue;
+ goto next;
+
+ case NS_CMPRSFLGS: /* indirection */
+ cp = msg + (((n & 0x3f) << 8) | *cp);
+ break;
+
+ default: /* illegal type */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ }
+ next: ;
+ }
+ errno = ENOENT;
+ return (-1);
+}
+
+/*
+ * MDN support.
+ */
+
+static void
+mdn_initialize() {
+ mdn_resconf_t ctx;
+
+ if (mdn_initialized)
+ return;
+
+ mdn_initialized = 1;
+ if (mdn_resconf_initialize() != mdn_success)
+ return;
+ if (mdn_resconf_create(&ctx) != mdn_success)
+ return;
+ if (mdn_resconf_loadfile(ctx, NULL) != mdn_success)
+ return;
+ mdn_conf = ctx;
+}
+
+static const char *
+convert_from_local(const char *local_name, char *dns_name,
+ size_t dns_name_len)
+{
+ mdn_result_t r;
+ char buf1[256], buf2[256];
+
+ mdn_initialize();
+ r = mdn_res_localtoucs(mdn_conf, local_name, buf1, sizeof(buf1));
+ if (r != mdn_success)
+ return (local_name);
+ r = mdn_res_normalize(mdn_conf, buf1, buf2, sizeof(buf2));
+ if (r != mdn_success)
+ return (local_name);
+ r = mdn_res_ucstodns(mdn_conf, buf2, dns_name, dns_name_len);
+ if (r != mdn_success)
+ return (local_name);
+ return (dns_name);
+}
+
+static const char *
+convert_to_local(const char *dns_name, char *local_name,
+ size_t local_name_len)
+{
+ mdn_result_t r;
+ char buf[256];
+
+ mdn_initialize();
+ r = mdn_res_dnstoucs(mdn_conf, dns_name, buf, sizeof(buf));
+ if (r != mdn_success)
+ return (dns_name);
+ r = mdn_res_ucstolocal(mdn_conf, buf, local_name, local_name_len);
+ if (r != mdn_success)
+ return (dns_name);
+ return (local_name);
+}
diff --git a/contrib/idn/mdnkit/tools/runmdn/res_comp.c b/contrib/idn/mdnkit/tools/runmdn/res_comp.c
new file mode 100644
index 00000000..30aef371
--- /dev/null
+++ b/contrib/idn/mdnkit/tools/runmdn/res_comp.c
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 1985, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
+ */
+
+/*
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * 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, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION 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.
+ */
+
+/*
+ * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: res_comp.c,v 1.1 2000/12/07 00:52:29 tale Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <ctype.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <string.h>
+
+/*
+ * Expand compressed domain name 'comp_dn' to full domain name.
+ * 'msg' is a pointer to the begining of the message,
+ * 'eomorig' points to the first location after the message,
+ * 'exp_dn' is a pointer to a buffer of size 'length' for the result.
+ * Return size of compressed name or -1 if there was an error.
+ */
+int
+dn_expand(const u_char *msg, const u_char *eom, const u_char *src,
+ char *dst, int dstsiz)
+{
+ int n = ns_name_uncompress(msg, eom, src, dst, (size_t)dstsiz);
+
+ if (n > 0 && dst[0] == '.')
+ dst[0] = '\0';
+ return (n);
+}
+
+/*
+ * Pack domain name 'exp_dn' in presentation form into 'comp_dn'.
+ * Return the size of the compressed name or -1.
+ * 'length' is the size of the array pointed to by 'comp_dn'.
+ */
+int
+dn_comp(const char *src, u_char *dst, int dstsiz,
+ u_char **dnptrs, u_char **lastdnptr)
+{
+ return (ns_name_compress(src, dst, (size_t)dstsiz,
+ (const u_char **)dnptrs,
+ (const u_char **)lastdnptr));
+}
+
+/*
+ * Skip over a compressed domain name. Return the size or -1.
+ */
+int
+dn_skipname(const u_char *ptr, const u_char *eom) {
+ const u_char *saveptr = ptr;
+
+ if (ns_name_skip(&ptr, eom) == -1)
+ return (-1);
+ return (ptr - saveptr);
+}
+
+/*
+ * Verify that a domain name uses an acceptable character set.
+ */
+
+/*
+ * Note the conspicuous absence of ctype macros in these definitions. On
+ * non-ASCII hosts, we can't depend on string literals or ctype macros to
+ * tell us anything about network-format data. The rest of the BIND system
+ * is not careful about this, but for some reason, we're doing it right here.
+ */
+#define PERIOD 0x2e
+#define hyphenchar(c) ((c) == 0x2d)
+#define bslashchar(c) ((c) == 0x5c)
+#define periodchar(c) ((c) == PERIOD)
+#define asterchar(c) ((c) == 0x2a)
+#ifdef NO_8BIT_THRU
+#define alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) \
+ || ((c) >= 0x61 && (c) <= 0x7a))
+#else
+#define alphachar(c) (1)
+#endif
+#define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
+
+#define borderchar(c) (alphachar(c) || digitchar(c))
+#define middlechar(c) (borderchar(c) || hyphenchar(c))
+#ifdef NO_8BIT_THRU
+#define domainchar(c) ((c) > 0x20 && (c) < 0x7f)
+#else
+#define domainchar(c) (1)
+#endif
+
+int
+res_hnok(const char *dn) {
+ int ppch = '\0', pch = PERIOD, ch = *dn++;
+
+ while (ch != '\0') {
+ int nch = *dn++;
+
+ if (periodchar(ch)) {
+ (void)NULL;
+ } else if (periodchar(pch)) {
+ if (!borderchar(ch))
+ return (0);
+ } else if (periodchar(nch) || nch == '\0') {
+ if (!borderchar(ch))
+ return (0);
+ } else {
+ if (!middlechar(ch))
+ return (0);
+ }
+ ppch = pch, pch = ch, ch = nch;
+ }
+ return (1);
+}
+
+/*
+ * hostname-like (A, MX, WKS) owners can have "*" as their first label
+ * but must otherwise be as a host name.
+ */
+int
+res_ownok(const char *dn) {
+ if (asterchar(dn[0])) {
+ if (periodchar(dn[1]))
+ return (res_hnok(dn+2));
+ if (dn[1] == '\0')
+ return (1);
+ }
+ return (res_hnok(dn));
+}
+
+/*
+ * SOA RNAMEs and RP RNAMEs can have any printable character in their first
+ * label, but the rest of the name has to look like a host name.
+ */
+int
+res_mailok(const char *dn) {
+ int ch, escaped = 0;
+
+ /* "." is a valid missing representation */
+ if (*dn == '\0')
+ return (1);
+
+ /* otherwise <label>.<hostname> */
+ while ((ch = *dn++) != '\0') {
+ if (!domainchar(ch))
+ return (0);
+ if (!escaped && periodchar(ch))
+ break;
+ if (escaped)
+ escaped = 0;
+ else if (bslashchar(ch))
+ escaped = 1;
+ }
+ if (periodchar(ch))
+ return (res_hnok(dn));
+ return (0);
+}
+
+/*
+ * This function is quite liberal, since RFC 1034's character sets are only
+ * recommendations.
+ */
+int
+res_dnok(const char *dn) {
+ int ch;
+
+ while ((ch = *dn++) != '\0')
+ if (!domainchar(ch))
+ return (0);
+ return (1);
+}
diff --git a/contrib/idn/mdnkit/tools/runmdn/runmdn.1 b/contrib/idn/mdnkit/tools/runmdn/runmdn.1
new file mode 100644
index 00000000..60f03894
--- /dev/null
+++ b/contrib/idn/mdnkit/tools/runmdn/runmdn.1
@@ -0,0 +1,160 @@
+.\" $Id: runmdn.1,v 1.1 2000/12/07 00:52:29 tale Exp $
+.\"
+.\" Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+.\"
+.\" By using this file, you agree to the terms and conditions set forth bellow.
+.\"
+.\" LICENSE TERMS AND CONDITIONS
+.\"
+.\" The following License Terms and Conditions apply, unless a different
+.\" license is obtained from Japan Network Information Center ("JPNIC"),
+.\" a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+.\" Tokyo, Japan.
+.\"
+.\" 1. Use, Modification and Redistribution (including distribution of any
+.\" modified or derived work) in source and/or binary forms is permitted
+.\" under this License Terms and Conditions.
+.\"
+.\" 2. Redistribution of source code must retain the copyright notices as they
+.\" appear in each source code file, this License Terms and Conditions.
+.\"
+.\" 3. Redistribution in binary form must reproduce the Copyright Notice,
+.\" this License Terms and Conditions, in the documentation and/or other
+.\" materials provided with the distribution. For the purposes of binary
+.\" distribution the "Copyright Notice" refers to the following language:
+.\" "Copyright (c) Japan Network Information Center. All rights reserved."
+.\"
+.\" 4. Neither the name of JPNIC may be used to endorse or promote products
+.\" derived from this Software without specific prior written approval of
+.\" JPNIC.
+.\"
+.\" 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+.\" "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 JPNIC 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 DAMAGES.
+.\"
+.\" 6. Indemnification by Licensee
+.\" Any person or entities using and/or redistributing this Software under
+.\" this License Terms and Conditions shall defend indemnify and hold
+.\" harmless JPNIC from and against any and all judgements damages,
+.\" expenses, settlement liabilities, cost and other liabilities of any
+.\" kind as a result of use and redistribution of this Software or any
+.\" claim, suite, action, litigation or proceeding by any third party
+.\" arising out of or relates to this License Terms and Conditions.
+.\"
+.\" 7. Governing Law, Jurisdiction and Venue
+.\" This License Terms and Conditions shall be governed by and and
+.\" construed in accordance with the law of Japan. Any person or entities
+.\" using and/or redistributing this Software under this License Terms and
+.\" Conditions hereby agrees and consent to the personal and exclusive
+.\" jurisdiction and venue of Tokyo District Court of Japan.
+.\"
+.TH MDNCONV 1 "July 7, 2000"
+.\"
+.SH NAME
+runmdn \- A script to allow applications to use multilingual domain names.
+.\"
+.SH SYNOPSIS
+\fBrunmdn\fP \fIprogram-name\fP [\fIargs..\fP]
+.\"
+.SH DESCRIPTION
+.B runmdn
+enables applications to use multilingual domain names without recompilation.
+Just add ``runmdn'' before the application-name, and the application
+can handle non-ASCII domain names. For example, you can do:
+.PP
+.RS 4
+.nf
+\f(CW% runmdn telnet \fInon-ASCII-hostname\fR
+.fi
+.RE
+.PP
+Before using runmdn, you should set up properties related to
+multilingual DNS by configuring mDNkit's resolver configuration file
+\fBmdnres.conf\fP.
+See mdnres.conf(5) which describes the configuration.
+.\"
+.SH IMPLEMENTATION
+.B runmdn
+is a small shell script that sets up an environment variable called
+``LD_PRELOAD'', so that an application dynamically links a shared
+library ``libmdnresolv'' before any other shared libraries.
+.PP
+The library ``libmdnresolv'' provides a special version of some
+resolver functions which implement features for handling multilingual
+domain names.
+.B runmdn
+replaces the following functions with the special version:
+.PP
+.RS 4
+.nf
+.ft CW
+dn_comp
+dn_expand
+res_hnok
+res_ownok
+res_mailok
+res_dnok
+.ft R
+.fi
+.RE
+.PP
+These are the crucial functions in resolver library for multilingual
+domain name processing.
+By overriding them in the standard libraries with the special version
+provided by ``libmdnresolv'',
+.B runmdn
+enables applications to use multilingual domain names.
+.RS 4
+.IP \(bu 2
+Resolver API (such as gethostbyname()) accepts non-ASCII domain names
+encoded in the local codeset that the application is using.
+Also the result from these APIs may contain non-ASCII domain names.
+.IP \(bu 2
+The normalization and codeset conversion between application's local
+codeset and the codeset used in DNS protocol data are handled
+automatically, so users/applications need not worry about them.
+.RE
+.PP
+Properties of multilingual DNS (such as the normalization or the codeset
+used on DNS protocol data) can be configured with the mDNkit's
+resolver configuration file (
+.B mdnres.conf
+). See mdnres.conf(5) for details.
+.\"
+.SH "BIND 9"
+.B runmdn
+is designed for BIND4 and BIND8 based resolver libraries.
+Since BIND9 introduces a completely different resolver called ``light-weight
+resolver'', runmdn cannot be used for applications using BIND9 based resolver.
+.PP
+Since mDNkit also contains a patch to BIND9 source which makes BIND9
+multilingual-aware, use the patch to multilingualize your BIND9 based
+resolver.
+.SH NOTE
+The idea of using ``LD_PRELOAD'' to replace some functions in the standard
+library was taken from ``runsocks'' script distributed as part of SOCKS5
+reference implementation.
+.SH BUGS
+There are many cases where
+.B runmdn
+does not work.
+.PP
+Your system must support ``LD_PRELOAD'' mechanism in the first place.
+.PP
+Due to security reasons, ``LD_PRELOAD'' mechanism is disabled for
+setuid programs in any sane systems. So
+.B runmdn
+does not work for setuid programs such as ping or rsh.
+.PP
+If your system's resolver is an exotic one that does not use
+the functions libmdnresolv provides, you lose.
+.SH "SEE ALSO"
+mdnres.conf(5), runsocks(1)
diff --git a/contrib/idn/mdnkit/tools/runmdn/runmdn.in b/contrib/idn/mdnkit/tools/runmdn/runmdn.in
new file mode 100644
index 00000000..b8c4ebae
--- /dev/null
+++ b/contrib/idn/mdnkit/tools/runmdn/runmdn.in
@@ -0,0 +1,95 @@
+#! /bin/sh
+# $Id: runmdn.in,v 1.1 2000/12/07 00:52:29 tale Exp $
+#
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+# Tokyo, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is permitted
+# under this License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) Japan Network Information Center. All rights reserved."
+#
+# 4. Neither the name of JPNIC may be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "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 JPNIC 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 DAMAGES.
+#
+# 6. Indemnification by Licensee
+# Any person or entities using and/or redistributing this Software under
+# this License Terms and Conditions shall defend indemnify and hold
+# harmless JPNIC from and against any and all judgements damages,
+# expenses, settlement liabilities, cost and other liabilities of any
+# kind as a result of use and redistribution of this Software or any
+# claim, suite, action, litigation or proceeding by any third party
+# arising out of or relates to this License Terms and Conditions.
+#
+# 7. Governing Law, Jurisdiction and Venue
+# This License Terms and Conditions shall be governed by and and
+# construed in accordance with the law of Japan. Any person or entities
+# using and/or redistributing this Software under this License Terms and
+# Conditions hereby agrees and consent to the personal and exclusive
+# jurisdiction and venue of Tokyo District Court of Japan.
+
+preload=
+
+iconv_file=@ICONVSOFILE@
+if test "$iconv_file" != none; then
+ preload="$iconv_file@PRELOAD_SEP@"
+fi
+
+# Load library info.
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=`echo @libdir@`
+if test ! -f $libdir/libmdnresolv.la; then
+ cat <<EOF 1>&2
+Have you installed mdnkit? I cannot find libmdnresolv.la.
+EOF
+ exit 1
+fi
+eval `grep '^dlname' $libdir/libmdnresolv.la`
+if test "$dlname" = ""; then
+ cat <<EOF 1>&2
+Sorry, runmdn won't work because libmdnresolv is not dynamically loadable.
+EOF
+ exit 1
+fi
+preload=$preload$libdir/$dlname
+
+# Set @PRELOAD_VAR@.
+if [ X$@PRELOAD_VAR@ = X ]; then
+ @PRELOAD_VAR@="$preload@PRELOAD_LAST@"
+else
+ @PRELOAD_VAR@="$preload@PRELOAD_SEP@$@PRELOAD_VAR@@PRELOAD_LAST@"
+fi
+export @PRELOAD_VAR@
+
+# Shoot.
+exec "$@"
diff --git a/contrib/idn/mdnkit/util/generate_normalize_data.pl b/contrib/idn/mdnkit/util/generate_normalize_data.pl
new file mode 100755
index 00000000..bd0c0ee0
--- /dev/null
+++ b/contrib/idn/mdnkit/util/generate_normalize_data.pl
@@ -0,0 +1,910 @@
+#! /usr/local/bin/perl -w
+# $Id: generate_normalize_data.pl,v 1.1 2000/12/07 00:52:29 tale Exp $
+#
+# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set forth bellow.
+#
+# LICENSE TERMS AND CONDITIONS
+#
+# The following License Terms and Conditions apply, unless a different
+# license is obtained from Japan Network Information Center ("JPNIC"),
+# a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
+# Tokyo, Japan.
+#
+# 1. Use, Modification and Redistribution (including distribution of any
+# modified or derived work) in source and/or binary forms is under this
+# License Terms and Conditions.
+#
+# 2. Redistribution of source code must retain the copyright notices as they
+# appear in each source code file, this License Terms and Conditions.
+#
+# 3. Redistribution in binary form must reproduce the Copyright Notice,
+# this License Terms and Conditions, in the documentation and/or other
+# materials provided with the distribution. For the purposes of binary
+# distribution the "Copyright Notice" refers to the following language:
+# "Copyright (c) Japan Network Information Center. All rights reserved."
+#
+# 4. Neither the name of JPNIC may be used to endorse or promote products
+# derived from this Software without specific prior written approval of
+# JPNIC.
+#
+# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
+# "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 JPNIC 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 DAMAGES.
+#
+# 6. Indemnification by Licensee
+# Any person or entities using and/or redistributing this Software under
+# this License Terms and Conditions shall defend indemnify and hold
+# harmless JPNIC from and against any and all judgements damages,
+# expenses, settlement liabilities, cost and other liabilities of any
+# kind as a result of use and redistribution of this Software or any
+# claim, suite, action, litigation or proceeding by any third party
+# arising out of or relates to this License Terms and Conditions.
+#
+# 7. Governing Law, Jurisdiction and Venue
+# This License Terms and Conditions shall be governed by and and
+# construed in accordance with the law of Japan. Any person or entities
+# using and/or redistributing this Software under this License Terms and
+# Conditions hereby agrees and consent to the personal and exclusive
+# jurisdiction and venue of Tokyo District Court of Japan.
+#
+
+#
+# Generate lib/unicodedata.c from UnicodeData.txt and
+# CompositionExclusions-1.txt, both available from
+# ftp://ftp.unicode.org/Public/UNIDATA/.
+#
+# Usage: generate_normalize_data.pl UnicodeData.txt CompositionExclusions-1.txt
+#
+
+package Unicode::UnicodeData;
+use strict;
+use integer;
+use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS);
+use Exporter;
+use Carp;
+
+@ISA = qw(Exporter);
+
+@EXPORT_OK = qw(code_value character_name general_category
+ canonical_combining_class bidirectional_category
+ character_decomposition_mapping
+ decimal_digit_value digit_value numeric_value
+ mirrored unicode_10_name iso10646_comment_field
+ uppercase_mapping lowercase_mapping
+ titlecase_mapping composition_exclusion
+ specialcasing_source specialcasing_type
+ specialcasing_mapping specialcasing_cond);
+
+%EXPORT_TAGS =
+ (accessor => [qw(code_value character_name general_category
+ canonical_combining_class bidirectional_category
+ character_decomposition_mapping
+ decimal_digit_value digit_value numeric_value
+ mirrored unicode_10_name iso10646_comment_field
+ uppercase_mapping lowercase_mapping
+ titlecase_mapping composition_exclusion
+ specialcasing_source specialcasing_type
+ specialcasing_mapping specialcasing_cond)]);
+
+my @unicode_data;
+my @composition_exclusion;
+my %composition_exclusion;
+my @unicode_bycode;
+my %unicode_byname;
+my @specialcasing_data;
+
+sub CODE {0;}
+sub NAME {1;}
+sub CATEGORY {2;}
+sub CLASS {3;}
+sub BIDIRECTIONAL {4;}
+sub DECOMPOSITION {5;}
+sub DECIMAL {6;}
+sub DIGIT {7;}
+sub NUMERIC {8;}
+sub MIRRORED {9;}
+sub OLDNAME {10;}
+sub COMMENT {11;}
+sub UPPERCASE {12;}
+sub LOWERCASE {13;}
+sub TITLECASE {14;}
+sub EXCLUSION {15;}
+
+sub code_value ($) {
+ hex((split /;/, $_[0], 2+CODE)[CODE]);
+}
+sub character_name ($) {
+ my $s = (split /;/, $_[0], 2+NAME)[NAME];
+}
+sub general_category ($) {
+ (split /;/, $_[0], 2+CATEGORY)[CATEGORY];
+}
+sub canonical_combining_class ($) {
+ (split /;/, $_[0], 2+CLASS)[CLASS] + 0;
+}
+sub bidirectional_category ($) {
+ (split /;/, $_[0], 2+BIDIRECTIONAL)[BIDIRECTIONAL];
+}
+sub character_decomposition_mapping ($) {
+ dcmap((split /;/, $_[0], 2+DECOMPOSITION)[DECOMPOSITION]);
+}
+sub decimal_digit_value ($) {
+ dvalue((split /;/, $_[0], 2+DECIMAL)[DECIMAL]);
+}
+sub digit_value ($) {
+ dvalue((split /;/, $_[0], 2+DIGIT)[DIGIT]);
+}
+sub numeric_value ($) {
+ dvalue((split /;/, $_[0], 2+NUMERIC)[NUMERIC]);
+}
+sub mirrored ($) {
+ (split /;/, $_[0], 2+MIRRORED)[MIRRORED] eq 'Y';
+}
+sub unicode_10_name ($) {
+ (split /;/, $_[0], 2+OLDNAME)[OLDNAME];
+}
+sub iso10646_comment_field ($) {
+ (split /;/, $_[0], 2+COMMENT)[COMMENT];
+}
+sub uppercase_mapping ($) {
+ ucode((split /;/, $_[0], 2+UPPERCASE)[UPPERCASE]);
+}
+sub lowercase_mapping ($) {
+ ucode((split /;/, $_[0], 2+LOWERCASE)[LOWERCASE]);
+}
+sub titlecase_mapping ($) {
+ ucode((split /;/, $_[0], 2+TITLECASE)[TITLECASE]);
+}
+sub composition_exclusion($) {
+ my $s = shift;
+ return 1 if exists $composition_exclusion{code_value($s)};
+ my @d = character_decomposition_mapping($s);
+ return 0 if @d == 0; # no decomposition
+ return 1 if @d == 2; # singleton
+ my $x = bycode($d[1]);
+ defined($x) and canonical_combining_class($x) != 0; # non-starter
+}
+sub specialcasing_source($) {
+ my $r = shift;
+ $r->[0];
+}
+sub specialcasing_type($) {
+ my $r = shift;
+ $r->[1];
+}
+sub specialcasing_mapping($) {
+ my $r = shift;
+ @{$r->[2]};
+}
+sub specialcasing_cond($) {
+ my $r = shift;
+ $r->[3];
+}
+
+sub list () {
+ init();
+ @unicode_data;
+}
+
+sub specialcasing_list() {
+ specialcasing_init();
+ @specialcasing_data;
+}
+
+sub script_specific_exclusions () {
+ init();
+ @composition_exclusion;
+}
+
+sub bycode ($) {
+ my $code = shift;
+ init_bycode();
+ ${$unicode_bycode[$code]};
+}
+
+sub byname ($) {
+ my $name = shift;
+ init_byname();
+ ${$unicode_byname{$name}};
+}
+
+sub grep (&) {
+ my $prog = shift;
+ init();
+ grep {&$prog} @unicode_data;
+}
+
+sub init_bycode {
+ init();
+ return if @unicode_bycode > 0;
+ $#unicode_bycode = 65535;
+ foreach my $d (@unicode_data) {
+ $unicode_bycode[code_value($d)] = \$d;
+ }
+}
+
+sub init_byname {
+ init();
+ return if scalar(keys %unicode_byname);
+ keys %unicode_byname = 4000;
+ foreach my $d (@unicode_data) {
+ $unicode_byname{character_name($d)} = \$d;
+ }
+}
+
+sub init {
+ @unicode_data > 0 or croak "Unicode::UnicodeData: not initialized\n";
+}
+
+sub specialcasing_init {
+ @specialcasing_data > 0
+ or croak "Unicode::UnicodeData: not initialized\n";
+}
+
+sub initialize {
+ my ($data_file, $exclusion_file, $specialcase_file) = @_;
+ local $_;
+
+ @unicode_data = ();
+ @composition_exclusion = ();
+ %composition_exclusion = ();
+ @specialcasing_data = ();
+
+ open F, $data_file or croak "cannot open $data_file: $!\n";
+ while (<F>) {
+ chomp;
+ push @unicode_data, $_;
+ }
+
+ open F, $exclusion_file or croak "cannot open $exclusion_file: $!\n";
+ while (<F>) {
+ chomp;
+ next if /^#/;
+ next if /^\s*$/;
+ next unless /^([0-9A-Fa-f]+)/;
+ my $n = hex($1);
+ push @composition_exclusion, $n;
+ $composition_exclusion{$n} = 1;
+ }
+
+ open F, $specialcase_file or croak "cannot open $specialcase_file: $!\n";
+ while (<F>) {
+ chomp;
+ last if /\# Locale-sensitive/; # no locale-dependent mapping
+ next if /^#/;
+ next if /^\s*$/;
+ s/#.*$//; # remove trailing comment
+ s/\s*;\s*/;/g; # remove spaces around semicolons
+
+ parse_specialcasing_data($_);
+ }
+}
+
+sub parse_specialcasing_data {
+ my $s = shift;
+ my @a = split /;/, $_;
+ my @cond = ();
+
+ # Check condition.
+ if (defined($a[4])) {
+ if ($a[4] eq 'FINAL' or $a[4] eq 'NON_FINAL') {
+ push @cond, $a[4];
+ } else {
+ croak "Unicode::UnicodeData: unknown special casing condition \"$a[4]\"\n";
+ }
+ }
+ if ($a[0] ne $a[1]) {
+ # mapping to lowercase
+ my $src = hex($a[0]);
+ my @dst = map(hex, split ' ', $a[1]);
+ unless (@dst == 1 and @cond == 0 and
+ lowercase_mapping(bycode($src)) == $dst[0]) {
+ push @specialcasing_data, [$src, 'L', \@dst, @cond];
+ }
+ }
+ if ($a[0] ne $a[3]) {
+ # mapping to uppercase
+ my $src = hex($a[0]);
+ my @dst = map(hex, split ' ', $a[3]);
+ unless (@dst == 1 and @cond == 0 and
+ uppercase_mapping(bycode($src)) == $dst[0]) {
+ push @specialcasing_data, [$src, 'U', \@dst, @cond];
+ }
+ }
+}
+
+sub dcmap {
+ my $v = shift;
+ return () if $v eq '';
+ $v =~ /^(?:(<[^>]+>)\s*)?(\S.*)/
+ or die "invalid decomposition mapping \"$v\"";
+ my $tag = $1 || '';
+ ($tag, map {hex($_)} split(' ', $2));
+}
+
+sub ucode {
+ my $v = shift;
+ return undef if $v eq '';
+ hex($v);
+}
+
+sub dvalue {
+ my $v = shift;
+ return undef if $v eq '';
+ $v+0;
+}
+
+#------------------------------------------------------------------------------
+
+package main;
+
+use strict;
+use Data::Dumper;
+
+#use Unicode::UnicodeData qw(:accessor);
+import Unicode::UnicodeData qw(:accessor);
+
+my $canon_class_bits = 11;
+my $decomp_bits = 10;
+my $compose_bits = 11;
+my $casemap_bits = 11;
+my $context_secsize = 512;
+
+(my $myid = '$Id: generate_normalize_data.pl,v 1.1 2000/12/07 00:52:29 tale Exp $') =~ s/\$([^\$]+)\$/\$-$1-\$/;
+
+my $unicodedatafile = shift or usage();
+my $exclusionfile = shift or usage();
+my $specialcasefile = shift or usage();
+
+Unicode::UnicodeData::initialize($unicodedatafile, $exclusionfile,
+ $specialcasefile);
+
+print <<"END";
+/* \$Id\$ */
+/* $myid */
+/*
+ * Do not edit this file!
+ * This file is generated from UnicodeData.txt and
+ * CompositionExclusions-1.txt.
+ *
+ */
+
+END
+
+# Actual data generation.
+canon_class();
+composition();
+decomposition();
+casemap();
+letter_context();
+
+exit;
+
+sub usage {
+ die "Usage: $0 unicode-data-file compoisition-exclusion-file special-casing-file\n"
+}
+
+#
+# composition -- generate data for canonical composition
+#
+sub composition {
+ my @comp_data;
+ my $bm = create_bitmap($compose_bits);
+
+ foreach my $r (Unicode::UnicodeData::list) {
+ my ($tag, @map) = character_decomposition_mapping($r);
+ next unless defined($tag) and $tag eq '';
+ next if composition_exclusion($r);
+
+ die "too long decomposition sequence for \"",
+ character_name($r), "\"\n" if @map != 2;
+
+ push @comp_data, [@map, code_value($r)];
+ set_bitmap($bm, $map[0]);
+ }
+
+ # Hangul composition
+ if (0) {
+ my $lbase = 0x1100;
+ my $lcount = 19;
+ my $sbase = 0xac00;
+ my $scount = 19 * 21 * 28;
+ range_set($bm, $lbase, $lbase + $lcount - 1);
+ range_set($bm, $sbase, $sbase + $scount - 1);
+ }
+
+ my $bitmap_str = sprint_bitmap($bm);
+ my $hash_str = sprint_composition_hash(@comp_data);
+
+ print <<"END";
+
+/*
+ * Canonical Composition
+ */
+
+#define COMPOSE_BM_SHIFT (16 - $compose_bits)
+
+static unsigned long compose_bitmap[] = {
+$bitmap_str
+};
+
+static struct composition compose_seq[] = {
+$hash_str
+};
+
+END
+}
+
+#
+# decomposition -- generate data for canonical/compatibility decomposition
+#
+sub decomposition {
+ my @canon_data;
+ my @canon_buf;
+ my @compat_data;
+ my @compat_buf;
+ my $canon_bm = create_bitmap($decomp_bits);
+ my $compat_bm = create_bitmap($decomp_bits);
+
+ foreach my $r (Unicode::UnicodeData::list) {
+ my ($tag, @map) = character_decomposition_mapping($r);
+ next unless defined $tag;
+
+ my $n = code_value($r);
+ my $is_compat = $tag ne '';
+
+ if ($is_compat) {
+ # compatibility decomposition
+ set_bitmap($compat_bm, $n);
+ push @compat_data, [$n, scalar(@compat_buf), scalar(@map)];
+ push @compat_buf, @map;
+ } else {
+ # canonical composition
+ set_bitmap($canon_bm, $n);
+ push @canon_data, [$n, scalar(@canon_buf), scalar(@map)];
+ push @canon_buf, @map;
+ }
+ }
+ # Compatibility decomposition implies canonical decomposition
+ $compat_bm = or_bitmap($compat_bm, $canon_bm);
+
+ my $canon_bitmap_str = sprint_bitmap($canon_bm);
+ my $compat_bitmap_str = sprint_bitmap($compat_bm);
+ my $canon_decomp_hash = sprint_decomposition_hash(@canon_data);
+ my $compat_decomp_hash = sprint_decomposition_hash(@compat_data);
+ my $canon_data_str = sprint_decomposition_buf(@canon_buf);
+ my $compat_data_str = sprint_decomposition_buf(@compat_buf);
+ print <<"END";
+
+/*
+ * Canonical/Compatibility Decomposition
+ */
+
+#define DECOMPOSE_BM_SHIFT (16 - $decomp_bits)
+
+static unsigned long canon_decompose_bitmap[] = {
+$canon_bitmap_str
+};
+
+static struct decomposition canon_decompose_seq[] = {
+$canon_decomp_hash
+};
+
+static unicode_t canon_decompose_data[] = {
+$canon_data_str
+};
+
+static unsigned long compat_decompose_bitmap[] = {
+$compat_bitmap_str
+};
+
+static struct decomposition compat_decompose_seq[] = {
+$compat_decomp_hash
+};
+
+static unicode_t compat_decompose_data[] = {
+$compat_data_str
+};
+
+END
+}
+
+#
+# canon_class -- generate data for canonical class
+#
+sub canon_class {
+ my $bm = create_bitmap($canon_class_bits);
+ my @cldata;
+ my @classes;
+
+ foreach my $r (Unicode::UnicodeData::list) {
+ my $class = canonical_combining_class($r);
+ next unless $class > 0;
+ my $n = code_value($r);
+ set_bitmap($bm, $n);
+ push @cldata, $n, $class;
+ }
+
+ my $bitmap_str = sprint_bitmap($bm);
+ my $canon_hash_str = sprint_canon_class_hash(@cldata);
+
+ print <<"END";
+
+/*
+ * Canonical Class
+ */
+
+#define CANON_CLASS_BM_SHIFT (16 - $canon_class_bits)
+
+static unsigned long canon_class_bitmap[] = {
+$bitmap_str
+};
+
+static struct canon_class canon_class[] = {
+$canon_hash_str
+};
+
+END
+}
+
+#
+# casemap -- generate data for case mapping
+#
+sub casemap {
+ my (@toupper_data, @tolower_data);
+ my $toupper_bm = create_bitmap($casemap_bits);
+ my $tolower_bm = create_bitmap($casemap_bits);
+ my (@special_toupper_data, @special_tolower_data);
+ my @multi_mapping_data = ();
+
+ foreach my $r (Unicode::UnicodeData::list) {
+ if (defined uppercase_mapping($r)) {
+ my $n = code_value($r);
+ set_bitmap($toupper_bm, $n);
+ push @toupper_data, $n, uppercase_mapping($r);
+ }
+ if (defined lowercase_mapping($r)) {
+ my $n = code_value($r);
+ set_bitmap($tolower_bm, $n);
+ push @tolower_data, $n, lowercase_mapping($r);
+ }
+ }
+
+ foreach my $r (Unicode::UnicodeData::specialcasing_list) {
+ my $src = specialcasing_source($r);
+ my $type = specialcasing_type($r);
+ my @dst = specialcasing_mapping($r);
+ my $cond = specialcasing_cond($r);
+ my $dst;
+ my $len;
+
+ $len = scalar(@dst);
+ if ($len == 1) {
+ $dst = $dst[0];
+ } else {
+ $dst = scalar(@multi_mapping_data);
+ push @multi_mapping_data, @dst;
+ }
+ if ($type eq 'L') {
+ # tolower mapping
+ set_bitmap($tolower_bm, $src);
+ push @special_tolower_data, $src, $dst, $len, $cond;
+ } elsif ($type eq 'U') {
+ # toupper mapping
+ set_bitmap($toupper_bm, $src);
+ push @special_toupper_data, $src, $dst, $len, $cond;
+ } else {
+ die "unknown mapping type \"$type\"\n";
+ }
+ }
+
+ my $toupper_bitmap_str = sprint_bitmap($toupper_bm);
+ my $tolower_bitmap_str = sprint_bitmap($tolower_bm);
+ my $toupper_hash_str = sprint_casemap_hash(@toupper_data);
+ my $tolower_hash_str = sprint_casemap_hash(@tolower_data);
+ my $special_toupper_hash_str =
+ sprint_specialcasemap_hash(@special_toupper_data);
+ my $special_tolower_hash_str =
+ sprint_specialcasemap_hash(@special_tolower_data);
+ my $multichar_mapping_str = sprint_decomposition_buf(@multi_mapping_data);
+
+ print <<"END";
+
+/*
+ * Flags for special case mapping.
+ */
+#define CMF_MULTICHAR 0x1
+#define CMF_FINAL 0x2
+#define CMF_NONFINAL 0x4
+#define CMF_CTXDEP (CMF_FINAL|CMF_NONFINAL)
+
+/*
+ * Lowercase <-> Uppercase mapping
+ */
+
+#define CASEMAP_BM_SHIFT (16 - $casemap_bits)
+
+static unsigned long toupper_bitmap[] = {
+$toupper_bitmap_str
+};
+
+static struct casemap toupper_map[] = {
+ /* non-conditional one-to-one mapping */
+$toupper_hash_str
+ /* conditional or one-to-many mapping */
+$special_toupper_hash_str
+};
+
+static unsigned long tolower_bitmap[] = {
+$tolower_bitmap_str
+};
+
+static struct casemap tolower_map[] = {
+ /* non-conditional one-to-one mapping */
+$tolower_hash_str
+ /* conditional or one-to-many mapping */
+$special_tolower_hash_str
+};
+
+static unicode_t multichar_casemap_data[] = {
+$multichar_mapping_str
+};
+END
+}
+
+#
+# letter_context -- gerarate data for determining context (final/non-final)
+#
+sub letter_context {
+ my @ctx_data = ();
+ my $letter_bit = 1;
+ my $nspmark_bit = 2;
+ foreach my $r (Unicode::UnicodeData::list) {
+ my $cat = general_category($r);
+ if ($cat =~ /L[ult]/) {
+ push @ctx_data, code_value($r), $letter_bit;
+ } elsif ($cat eq 'Mn') {
+ push @ctx_data, code_value($r), $nspmark_bit;
+ }
+ }
+
+ my @sections;
+ while (@ctx_data >= 2) {
+ my $code = shift @ctx_data;
+ my $type = shift @ctx_data;
+ my $sec_idx = int($code / $context_secsize);
+ my $sec_off = $code % $context_secsize;
+
+ if (!defined $sections[$sec_idx]) {
+ my $bm = "\0" x ($context_secsize * 2 / 8);
+ $sections[$sec_idx] = \$bm;
+ }
+ vec(${$sections[$sec_idx]}, $sec_off, 2) = $type;
+ }
+
+ my $nsections = 65536 / $context_secsize;
+
+ print <<"END";
+
+/*
+ * Cased characters and non-spacing marks (for casemap context)
+ */
+
+#define CTX_BLOCK_SZ $context_secsize
+#define CTX_CASED $letter_bit /* cased character */
+#define CTX_NSM $nspmark_bit /* non-spacing mark */
+
+END
+
+ for (my $i = 0; $i < $nsections; $i++) {
+ if (defined $sections[$i]) {
+ my $bm_str = sprint_rawbitmap(${$sections[$i]});
+ print <<"END";
+static unsigned long casemap_ctx_section$i\[] = {
+$bm_str
+};
+
+END
+ }
+ }
+
+ print <<"END";
+static unsigned long *casemap_ctx_sections[] = {
+END
+
+ for (my $i = 0; $i < $nsections; $i++) {
+ if (defined $sections[$i]) {
+ print "\tcasemap_ctx_section$i,\n";
+ } else {
+ print "\tNULL,\n";
+ }
+ }
+
+ print <<"END";
+};
+
+END
+}
+
+sub sprint_canon_class_hash {
+ my $i = 0;
+ my $s = '';
+ while (@_ > 0) {
+ my $code = shift;
+ my $class = shift;
+ if ($i % 4 == 0) {
+ $s .= "\n" if $i != 0;
+ $s .= "\t";
+ }
+ $s .= sprintf "{0x%04x, %3d}, ", $code, $class;
+ $i++;
+ }
+ $s;
+}
+
+sub sprint_composition_hash {
+ my $i = 0;
+ my $s = '';
+ foreach my $r (@_) {
+ if ($i % 2 == 0) {
+ $s .= "\n" if $i != 0;
+ $s .= "\t";
+ }
+ $s .= sprintf "{0x%04x, 0x%04x, 0x%04x}, ", @{$r};
+ $i++;
+ }
+ $s;
+}
+
+sub sprint_decomposition_hash {
+ my $i = 0;
+ my $s = '';
+ foreach my $r (@_) {
+ if ($i % 3 == 0) {
+ $s .= "\n" if $i != 0;
+ $s .= "\t";
+ }
+ $s .= sprintf "{0x%04x, %4d, %2d}, ", @{$r};
+ $i++;
+ }
+ $s;
+}
+
+sub sprint_casemap_hash {
+ my $i = 0;
+ my $s = '';
+ while (@_ > 0) {
+ my $org = shift;
+ my $map = shift;
+ if ($i % 4 == 0) {
+ $s .= "\n" if $i != 0;
+ $s .= "\t";
+ }
+ $s .= sprintf "{0x%04x, 0x%04x}, ", $org, $map;
+ $i++;
+ }
+ $s;
+}
+
+sub sprint_specialcasemap_hash {
+ my $i = 0;
+ my $s = '';
+ while (@_ > 0) {
+ my $src = shift;
+ my $dst = shift;
+ my $len = shift;
+ my $cond = shift;
+ my @flags = ();
+
+ if ($i % 2 == 0) {
+ $s .= "\n" if $i != 0;
+ $s .= "\t";
+ }
+ $i++;
+
+ if ($len > 1) {
+ push @flags, 'CMF_MULTICHAR';
+ }
+ if (defined $cond) {
+ if ($cond eq 'FINAL') {
+ push @flags, 'CMF_FINAL';
+ } elsif ($cond eq 'NON_FINAL') {
+ push @flags, 'CMF_NONFINAL';
+ } else {
+ die "unknown case mapping condition \"$cond\"\n";
+ }
+ }
+ if ($len > 1) {
+ $s .= sprintf "{0x%04x, 0x%04x, %s, %d}, ", $src, $dst,
+ (@flags > 0) ? join('|', @flags) : '0', $len;
+ } else {
+ $s .= sprintf "{0x%04x, 0x%04x, %s}, ", $src, $dst,
+ (@flags > 0) ? join('|', @flags) : '0';
+ }
+ }
+ $s;
+}
+
+sub sprint_decomposition_buf {
+ my $i = 0;
+ my $s = '';
+ foreach my $d (@_) {
+ if ($i % 10 == 0) {
+ $s .= "\n" if $i != 0;
+ $s .= "\t";
+ }
+ $s .= sprintf "%5d, ", $d;
+ $i++;
+ }
+ $s;
+}
+
+sub create_bitmap {
+ my $bits = shift;
+ my $shift = 16 - $bits;
+ my $bmlen = 1 << ($bits - 3);
+ my $bitmap = "\0" x $bmlen;
+ [$bitmap, $shift];
+}
+
+sub set_bitmap {
+ my ($bm, $n) = @_;
+ vec($bm->[0], $n >> $bm->[1], 1) = 1;
+}
+
+sub range_set {
+ my ($bm, $start, $end) = @_;
+ my $shift = $bm->[1];
+ $start >>= $shift;
+ $end >>= $shift;
+ vec($bm->[0], $_, 1) = 1 foreach $start .. $end;
+}
+
+sub or_bitmap {
+ my ($bm1, $bm2) = @_;
+ die "incompatible bitmap\n"
+ if length($bm1->[0]) != length($bm2->[0]) or $bm1->[1] != $bm2->[1];
+ my $bitmap = $bm1->[0] | $bm2->[0];
+ [$bitmap, $bm1->[1]];
+}
+
+sub sprint_bitmap {
+ my $bm = shift;
+ my $data = $bm->[0];
+ my $i = 0;
+ my $s = '';
+ foreach my $v (unpack('V*', $data)) {
+ if ($i % 4 == 0) {
+ $s .= "\n" if $i != 0;
+ $s .= "\t";
+ }
+ $s .= sprintf "0x%08x, ", $v;
+ $i++;
+ }
+ $s;
+}
+
+sub sprint_rawbitmap {
+ my $data = shift;
+ my $i = 0;
+ my $s = '';
+ foreach my $v (unpack('V*', $data)) {
+ if ($i % 4 == 0) {
+ $s .= "\n" if $i != 0;
+ $s .= "\t";
+ }
+ $s .= sprintf "0x%08x, ", $v;
+ $i++;
+ }
+ $s;
+}
diff --git a/contrib/linux/coredump-patch b/contrib/linux/coredump-patch
new file mode 100644
index 00000000..d1792901
--- /dev/null
+++ b/contrib/linux/coredump-patch
@@ -0,0 +1,12 @@
+--- binfmt_elf.c.old Mon Dec 11 10:49:57 2000
++++ binfmt_elf.c Wed Nov 1 13:05:23 2000
+@@ -1091,7 +1091,8 @@
+
+ if (!current->dumpable ||
+ limit < ELF_EXEC_PAGESIZE ||
+- atomic_read(&current->mm->count) != 1)
++/* atomic_read(&current->mm->count) != 1) */
++ test_and_set_bit(31, &current->mm->def_flags) != 0)
+ return 0;
+ current->dumpable = 0;
+
diff --git a/contrib/sdb/dirdb.c b/contrib/sdb/dirdb.c
index 69f8a6b0..828f573d 100644
--- a/contrib/sdb/dirdb.c
+++ b/contrib/sdb/dirdb.c
@@ -15,7 +15,12 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dirdb.c,v 1.5 2000/11/20 19:49:59 bwelling Exp $ */
+/* $Id: dirdb.c,v 1.8 2000/12/10 07:53:11 gson Exp $ */
+
+/*
+ * A simple database driver that returns basic information about
+ * files and directories in the Unix file system as DNS data.
+ */
#include <config.h>
@@ -34,9 +39,7 @@
#include <named/globals.h>
-/*
- * A simple database driver that returns basic directory information.
- */
+#include "dirdb.h"
static dns_sdbimplementation_t *dirdb = NULL;
@@ -176,7 +179,8 @@ static dns_sdbmethods_t dirdb_methods = {
isc_result_t
dirdb_init(void) {
unsigned int flags;
- flags = DNS_SDBFLAG_RELATIVEOWNER | DNS_SDBFLAG_RELATIVERDATA;
+ flags = DNS_SDBFLAG_RELATIVEOWNER | DNS_SDBFLAG_RELATIVERDATA |
+ DNS_SDBFLAG_THREADSAFE;
return (dns_sdb_register("dir", &dirdb_methods, ns_g_mctx, flags,
ns_g_mctx, &dirdb));
}
diff --git a/contrib/sdb/lookup.tcl b/contrib/sdb/lookup.tcl
index c6887b3e..fc39a1c8 100644
--- a/contrib/sdb/lookup.tcl
+++ b/contrib/sdb/lookup.tcl
@@ -13,18 +13,35 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: lookup.tcl,v 1.5 2000/11/18 01:35:05 gson Exp $
+# $Id: lookup.tcl,v 1.6 2000/12/10 07:46:35 gson Exp $
#
# Sample lookup procedure for tcldb
#
+# This lookup procedure defines zones with identical SOA, NS, and MX
+# records at the apex and a single A record that varies from zone to
+# zone at the name "www".
+#
+# Something like this could be used by a web hosting company to serve
+# a number of domains without needing to create a separate master file
+# for each domain. Instead, all per-zone data (in this case, a single
+# IP address) specified in the named.conf file like this:
+#
+# zone "a.com." { type master; database "tcl 10.0.0.42"; };
+# zone "b.com." { type master; database "tcl 10.0.0.99"; };
+#
+# Since the tcldb driver doesn't support zone transfers, there should
+# be at least two identically configured master servers. In the
+# example below, they are assumed to be called ns1.isp.nil and
+# ns2.isp.nil.
+#
proc lookup {zone name} {
global dbargs
switch -- $name {
@ { return [list \
{SOA 86400 "ns1.isp.nil. hostmaster.isp.nil. \
- 0 3600 1800 1814400 3600"} \
+ 1 3600 1800 1814400 3600"} \
{NS 86400 "ns1.isp.nil."} \
{NS 86400 "ns2.isp.nil."} \
{MX 86400 "10 mail.isp.nil."} ] }
diff --git a/contrib/sdb/pgsqldb.c b/contrib/sdb/pgsqldb.c
index 6b69b566..627ea58c 100644
--- a/contrib/sdb/pgsqldb.c
+++ b/contrib/sdb/pgsqldb.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: pgsqldb.c,v 1.9 2000/11/22 21:18:12 bwelling Exp $ */
+/* $Id: pgsqldb.c,v 1.10 2000/12/06 00:59:07 bwelling Exp $ */
#include <config.h>
@@ -35,6 +35,8 @@
#include <named/globals.h>
+#include "pgsqldb.h"
+
/*
* A simple database driver that interfaces to a PostgreSQL database. This
* is not complete, and not designed for general use. It opens one
diff --git a/contrib/sdb/tcldb.c b/contrib/sdb/tcldb.c
index 68f0f784..e3678a0f 100644
--- a/contrib/sdb/tcldb.c
+++ b/contrib/sdb/tcldb.c
@@ -15,7 +15,14 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: tcldb.c,v 1.5 2000/11/20 18:24:41 gson Exp $ */
+/* $Id: tcldb.c,v 1.6 2000/12/10 07:47:43 gson Exp $ */
+
+/*
+ * A simple database driver that calls a Tcl procedure to define
+ * the contents of the DNS namespace. The procedure is loaded
+ * from the file lookup.tcl; look at the comments there for
+ * more information.
+ */
#include <config.h>
@@ -38,11 +45,6 @@
#include <tcldb.h>
-/*
- * A simple database driver that calls Tcl procedures to define
- * the contents of the DNS namespace.
- */
-
#define CHECK(op) \
do { result = (op); \
if (result != ISC_R_SUCCESS) return (result); \
diff --git a/contrib/sdb/timedb.c b/contrib/sdb/timedb.c
index 6830b1f4..75fd5d53 100644
--- a/contrib/sdb/timedb.c
+++ b/contrib/sdb/timedb.c
@@ -15,7 +15,12 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: timedb.c,v 1.4 2000/11/20 19:50:02 bwelling Exp $ */
+/* $Id: timedb.c,v 1.6 2000/12/10 07:53:12 gson Exp $ */
+
+/*
+ * A simple database driver that enables the server to return the
+ * current time in a DNS record.
+ */
#include <config.h>
@@ -31,10 +36,7 @@
#include <named/globals.h>
-/*
- * A simple database driver that enables the server to return the
- * current time in a DNS record.
- */
+#include "timedb.h"
static dns_sdbimplementation_t *timedb = NULL;
diff --git a/contrib/sdb/zonetodb.c b/contrib/sdb/zonetodb.c
index 4b9c31a8..b68917fd 100644
--- a/contrib/sdb/zonetodb.c
+++ b/contrib/sdb/zonetodb.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zonetodb.c,v 1.7 2000/11/20 19:56:12 bwelling Exp $ */
+/* $Id: zonetodb.c,v 1.8 2000/12/11 23:09:44 marka Exp $ */
#include <isc/buffer.h>
#include <isc/mem.h>
@@ -134,7 +134,7 @@ main(int argc, char **argv) {
dns_dbnode_t *node;
dns_rdatasetiter_t *rdsiter;
dns_rdataset_t rdataset;
- dns_rdata_t rdata;
+ dns_rdata_t rdata = DNS_RDATA_INIT;
isc_mem_t *mctx = NULL;
isc_buffer_t b;
isc_result_t result;
diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml
index aaac47e5..134b67b2 100644
--- a/doc/arm/Bv9ARM-book.xml
+++ b/doc/arm/Bv9ARM-book.xml
@@ -2,7 +2,7 @@
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.0//EN"
"http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd">
-<!-- File: $Id: Bv9ARM-book.xml,v 1.65 2000/12/02 00:34:39 gson Exp $ -->
+<!-- File: $Id: Bv9ARM-book.xml,v 1.72 2000/12/20 03:36:18 marka Exp $ -->
<book>
@@ -619,6 +619,29 @@ behavior, we do not recommend the use of <command>nslookup</command>.
Use <command>dig</command> instead.</para>
</listitem>
</varlistentry>
+ <varlistentry id="named-checkconf" xreflabel="Named Configuration Checking application">
+ <term><command>named-checkconf</command></term>
+ <listitem>
+ <para>Checks the syntax of <filename>named.conf</filename>.</para>
+ <cmdsynopsis label="Usage">
+ <command>named-checkconf</command>
+ <arg><replaceable>filename</replaceable></arg>
+ </cmdsynopsis>
+ </listitem>
+ </varlistentry>
+ <varlistentry id="named-checkzone" xreflabel="Zone Checking application">
+ <term><command>named-checkzone</command></term>
+ <listitem>
+ <para>Performs syntax and consistency checks on a individual zone.</para>
+ <cmdsynopsis label="Usage">
+ <command>named-checkzone</command>
+ <arg>-dq</arg>
+ <arg>-c <replaceable>class</replaceable></arg>
+ <arg choice="plain"><replaceable>zone</replaceable></arg>
+ <arg><replaceable>filename</replaceable></arg>
+ </cmdsynopsis>
+ </listitem>
+ </varlistentry>
</variablelist>
</sect3>
<sect3 id="admin_tools">
@@ -677,6 +700,15 @@ of a server.</para>
</row>
<row rowsep = "0">
+<entry colname = "1"><para><userinput>dumpdb</userinput></para></entry>
+<entry colname = "2"><para>Dump the current contents of the cache
+(or caches if there are multiple views) into the file named by the
+<command>dump-file</command> option
+(by default, <filename>named_dump.db</filename>).
+</para></entry>
+</row>
+
+<row rowsep = "0">
<entry colname = "1"><para><userinput>stop</userinput></para></entry>
<entry colname = "2"><para>Stop the server, making sure any recent changes
made through dynamic update or IXFR are first saved to the master files
@@ -1800,7 +1832,9 @@ for access control, defining listen-on ports, or as a topology,
and whether the element was negated.</para>
<para>When used as an access control list, a non-negated match allows
access and a negated match denies access. If there is no match,
-access is denied. The clauses <command>allow-query</command>, <command>allow-transfer</command>, <command>allow-update</command> and <command>blackhole</command> all
+access is denied. The clauses <command>allow-notify</command>,
+<command>allow-query</command>, <command>allow-transfer</command>,
+<command>allow-update</command> and <command>blackhole</command> all
use address match lists this. Similarly, the listen-on option will cause
the server to not accept queries on any of the machine's addresses
which do not match the list.</para>
@@ -2455,6 +2489,7 @@ lookups performed on behalf of clients by a caching name server.</para></entry>
<optional> forward ( <replaceable>only</replaceable> | <replaceable>first</replaceable> ); </optional>
<optional> forwarders { <optional> <replaceable>in_addr</replaceable> ; <optional> <replaceable>in_addr</replaceable> ; ... </optional> </optional> }; </optional>
<optional> check-names ( <replaceable>master</replaceable> | <replaceable>slave</replaceable> | <replaceable> response</replaceable> )( <replaceable>warn</replaceable> | <replaceable>fail</replaceable> | <replaceable>ignore</replaceable> ); </optional>
+ <optional> allow-notify { <replaceable>address_match_list</replaceable> }; </optional>
<optional> allow-query { <replaceable>address_match_list</replaceable> }; </optional>
<optional> allow-transfer { <replaceable>address_match_list</replaceable> }; </optional>
<optional> allow-recursion { <replaceable>address_match_list</replaceable> }; </optional>
@@ -2571,8 +2606,7 @@ most cases, the keyname should be the server's host name.</para></entry>
the database to when instructed to do so with
<command>rndc dumpdb</command>.
If not specified, the default is <filename>named_dump.db</filename>.</para>
-<note><simpara>Not yet implemented in <acronym>BIND</acronym> 9.</simpara></note></entry>
-</row>
+</entry></row>
<row rowsep = "0">
<entry colname = "1"><para><command>memstatistics-file</command></para></entry>
<entry colname = "2"><para>The pathname of the file the server writes memory
@@ -2880,6 +2914,16 @@ details on how to specify IP address lists.</para>
<colspec colname = "2" colnum = "2" colsep = "0" colwidth = "3.125in"/>
<tbody>
<row rowsep = "0">
+<entry colname = "1"><para><command>allow-notify</command></para></entry>
+<entry colname = "2"><para>Specifies which hosts are allowed to
+notify slaves of a zone change in addition to the zone masters.
+<command>allow-notify</command> may also be specified in the
+<command>zone</command> statement, in which case it overrides the
+<command>options allow-notify</command> statement. It is only meaningful
+for a slave zone. If not specified, the default is to process notify messages
+only from a zone's master.</para></entry>
+</row>
+<row rowsep = "0">
<entry colname = "1"><para><command>allow-query</command></para></entry>
<entry colname = "2"><para>Specifies which hosts are allowed to
ask ordinary questions. <command>allow-query</command> may also
@@ -3094,7 +3138,7 @@ except zone transfers are performed using IPv6.</para></entry>
which local source address, and optionally UDP port, will be used to
send NOTIFY messages.
This address must appear in the slave server's <command>masters</command>
-zone clause.
+zone clause or in an <command>allow-notify</command> clause.
This statement sets the <command>notify-source</command> for all zones,
but can be overridden on a per-zone / per-view basis by including a
<command>notify-source</command> statement within the <command>zone</command>
@@ -3646,6 +3690,7 @@ view "external" {
Statement Grammar</title>
<programlisting>zone <replaceable>zone_name</replaceable> <optional><replaceable>class</replaceable></optional> <optional>{
type ( master | slave | hint | stub | forward ) ;
+ <optional> allow-notify { <replaceable>address_match_list</replaceable> } ; </optional>
<optional> allow-query { <replaceable>address_match_list</replaceable> } ; </optional>
<optional> allow-transfer { <replaceable>address_match_list</replaceable> } ; </optional>
<optional> allow-update { <replaceable>address_match_list</replaceable> } ; </optional>
@@ -3660,7 +3705,7 @@ Statement Grammar</title>
<optional> ixfr-base <replaceable>string</replaceable> ; </optional>
<optional> ixfr-tmp-file <replaceable>string</replaceable> ; </optional>
<optional> maintain-ixfr-base <replaceable>yes_or_no</replaceable> ; </optional>
- <optional> masters <optional>port <replaceable>ip_port</replaceable></optional> { <replaceable>ip_addr</replaceable> ; <optional><replaceable>ip_addr</replaceable> <optional>port <replaceable>ip_port</replaceable></optional> ; <optional>...</optional></optional> } ; </optional>
+ <optional> masters <optional>port <replaceable>ip_port</replaceable></optional> { <replaceable>ip_addr</replaceable> <optional>port <replaceable>ip_port</replaceable></optional> <optional>key <replaceable>key</replaceable></optional>; <optional>...</optional> } ; </optional>
<optional> max-ixfr-log-size <replaceable>number</replaceable> ; </optional>
<optional> max-transfer-idle-in <replaceable>number</replaceable> ; </optional>
<optional> max-transfer-idle-out <replaceable>number</replaceable> ; </optional>
@@ -3700,6 +3745,7 @@ of master servers that the slave contacts to update its copy of the zone.
By default, transfers are made from port 53 on the servers; this can
be changed for all servers by specifying a port number before the
list of IP addresses, or on a per-server basis after the IP address.
+Authentication to the master can also be done with per-server TSIG keys.
If a file is specified, then the
replica will be written to this file whenever the zone is changed,
and reloaded from this file on a server restart. Use of a file is
@@ -3759,9 +3805,12 @@ Classes other than IN have no built-in defaults hints.</para></entry>
</tbody>
</tgroup></informaltable></sect3>
<sect3><title>Class</title>
-<para>The zone's name may optionally be followed by a class. If
-a class is not specified, class <literal>IN</literal> (for <varname>Internet</varname>),
-is assumed. This is correct for the vast majority of cases.</para>
+<para>In general <command>class</command> can now be omitted from
+a <command>zone's</command> definition.
+It is now inherited for the enclosing <command>view</command> or if
+there is no explicit <command>view</command>, from the default
+<command>view</command> which is <literal>IN</literal>
+(for <varname>Internet</varname>).</para>
<para>The <literal>hesiod</literal> class is
named for an information service from MIT's Project Athena. It is
used to share information about various systems databases, such
@@ -3779,6 +3828,11 @@ in the mid-1970s. Zone data for it can be specified with the <literal>CHAOS</lit
<colspec colname = "2" colnum = "2" colsep = "0" colwidth = "2.847in"/>
<tbody>
<row rowsep = "0">
+ <entry colname = "1"><para><command>allow-notify</command></para></entry>
+ <entry colname = "2"><para>See the description of
+<command>allow-notify</command> in <xref linkend="access_control"/></para></entry>
+ </row>
+ <row rowsep = "0">
<entry colname = "1"><para><command>allow-query</command></para></entry>
<entry colname = "2"><para>See the description of
<command>allow-query</command> in <xref linkend="access_control"/></para></entry>
@@ -4607,7 +4661,9 @@ and not part of the standard zone file format.</para>
<chapter id="ch07"><title><acronym>BIND</acronym> 9 Security Considerations</title>
<sect1 id="Access_Control_Lists"><title>Access Control Lists</title>
<para>Access Control Lists (ACLs), are address match lists that
-you can set up and nickname for future use in <command>allow-query</command>, <command>allow-recursion</command>, <command>blackhole</command>, <command>allow-transfer</command>,
+you can set up and nickname for future use in <command>allow-notify</command>,
+<command>allow-query</command>, <command>allow-recursion</command>,
+<command>blackhole</command>, <command>allow-transfer</command>,
etc.</para>
<para>Using ACLs allows you to have finer control over who can access
your nameserver, without cluttering up your config files with huge
diff --git a/doc/arm/Bv9ARM.ch03.html b/doc/arm/Bv9ARM.ch03.html
index e78e837d..9b83eb8f 100644
--- a/doc/arm/Bv9ARM.ch03.html
+++ b/doc/arm/Bv9ARM.ch03.html
@@ -700,6 +700,63 @@ CLASS="command"
>dig</B
> instead.</P
></DD
+><DT
+><A
+NAME="named-checkconf"
+><B
+CLASS="command"
+>named-checkconf</B
+></A
+></DT
+><DD
+><P
+>Checks the syntax of <TT
+CLASS="filename"
+>named.conf</TT
+>.</P
+><P
+><B
+CLASS="command"
+>named-checkconf</B
+> [<TT
+CLASS="replaceable"
+><I
+>filename</I
+></TT
+>]</P
+></DD
+><DT
+><A
+NAME="named-checkzone"
+><B
+CLASS="command"
+>named-checkzone</B
+></A
+></DT
+><DD
+><P
+>Performs syntax and consistency checks on a individual zone.</P
+><P
+><B
+CLASS="command"
+>named-checkzone</B
+> [-dq] [-c <TT
+CLASS="replaceable"
+><I
+>class</I
+></TT
+>] <TT
+CLASS="replaceable"
+><I
+>zone</I
+></TT
+> [<TT
+CLASS="replaceable"
+><I
+>filename</I
+></TT
+>]</P
+></DD
></DL
></DIV
><DIV
@@ -941,6 +998,37 @@ VALIGN="MIDDLE"
><TT
CLASS="userinput"
><B
+>dumpdb</B
+></TT
+></P
+></TD
+><TD
+WIDTH="288"
+ALIGN="LEFT"
+VALIGN="MIDDLE"
+><P
+>Dump the current contents of the cache
+(or caches if there are multiple views) into the file named by the
+<B
+CLASS="command"
+>dump-file</B
+> option
+(by default, <TT
+CLASS="filename"
+>named_dump.db</TT
+>).
+</P
+></TD
+></TR
+><TR
+><TD
+WIDTH="288"
+ALIGN="LEFT"
+VALIGN="MIDDLE"
+><P
+><TT
+CLASS="userinput"
+><B
>stop</B
></TT
></P
@@ -1191,7 +1279,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN588"
+NAME="AEN620"
>3.4.2. Signals</A
></H2
><P
diff --git a/doc/arm/Bv9ARM.ch04.html b/doc/arm/Bv9ARM.ch04.html
index e413a204..ca718a28 100644
--- a/doc/arm/Bv9ARM.ch04.html
+++ b/doc/arm/Bv9ARM.ch04.html
@@ -85,7 +85,7 @@ HREF="Bv9ARM.ch04.html#incremental_zone_transfers"
></DT
><DT
>4.3. <A
-HREF="Bv9ARM.ch04.html#AEN642"
+HREF="Bv9ARM.ch04.html#AEN674"
>Split DNS</A
></DT
><DT
@@ -95,12 +95,12 @@ HREF="Bv9ARM.ch04.html#tsig"
></DT
><DT
>4.5. <A
-HREF="Bv9ARM.ch04.html#AEN802"
+HREF="Bv9ARM.ch04.html#AEN834"
>TKEY</A
></DT
><DT
>4.6. <A
-HREF="Bv9ARM.ch04.html#AEN817"
+HREF="Bv9ARM.ch04.html#AEN849"
>SIG(0)</A
></DT
><DT
@@ -110,7 +110,7 @@ HREF="Bv9ARM.ch04.html#DNSSEC"
></DT
><DT
>4.8. <A
-HREF="Bv9ARM.ch04.html#AEN901"
+HREF="Bv9ARM.ch04.html#AEN933"
>IPv6 Support in <SPAN
CLASS="acronym"
>BIND</SPAN
@@ -229,7 +229,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
-NAME="AEN642"
+NAME="AEN674"
>4.3. Split DNS</A
></H1
><P
@@ -629,7 +629,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN733"
+NAME="AEN765"
>4.4.1. Generate Shared Keys for Each Pair of Hosts</A
></H2
><P
@@ -647,7 +647,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN738"
+NAME="AEN770"
>4.4.1.1. Automatic Generation</A
></H3
><P
@@ -689,7 +689,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN749"
+NAME="AEN781"
>4.4.1.2. Manual Generation</A
></H3
><P
@@ -710,7 +710,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN754"
+NAME="AEN786"
>4.4.2. Copying the Shared Secret to Both Machines</A
></H2
><P
@@ -722,7 +722,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN757"
+NAME="AEN789"
>4.4.3. Informing the Servers of the Key's Existence</A
></H2
><P
@@ -770,7 +770,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN769"
+NAME="AEN801"
>4.4.4. Instructing the Server to Use the Key</A
></H2
><P
@@ -830,7 +830,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN785"
+NAME="AEN817"
>4.4.5. TSIG Key Based Access Control</A
></H2
><P
@@ -876,7 +876,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN798"
+NAME="AEN830"
>4.4.6. Errors</A
></H2
><P
@@ -905,7 +905,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
-NAME="AEN802"
+NAME="AEN834"
>4.5. TKEY</A
></H1
><P
@@ -971,7 +971,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
-NAME="AEN817"
+NAME="AEN849"
>4.6. SIG(0)</A
></H1
><P
@@ -1040,7 +1040,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN833"
+NAME="AEN865"
>4.7.1. Generating Keys</A
></H2
><P
@@ -1119,7 +1119,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN853"
+NAME="AEN885"
>4.7.2. Creating a Keyset</A
></H2
><P
@@ -1172,7 +1172,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN865"
+NAME="AEN897"
>4.7.3. Signing the Child's Keyset</A
></H2
><P
@@ -1222,7 +1222,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN878"
+NAME="AEN910"
>4.7.4. Signing the Zone</A
></H2
><P
@@ -1284,7 +1284,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN894"
+NAME="AEN926"
>4.7.5. Configuring Servers</A
></H2
><P
@@ -1311,7 +1311,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
-NAME="AEN901"
+NAME="AEN933"
>4.8. IPv6 Support in <SPAN
CLASS="acronym"
>BIND</SPAN
@@ -1365,7 +1365,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN915"
+NAME="AEN947"
>4.8.1. Address Lookups Using AAAA Records</A
></H2
><P
@@ -1387,7 +1387,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN920"
+NAME="AEN952"
>4.8.2. Address Lookups Using A6 Records</A
></H2
><P
@@ -1407,7 +1407,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN924"
+NAME="AEN956"
>4.8.2.1. A6 Chains</A
></H3
><P
@@ -1453,7 +1453,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN935"
+NAME="AEN967"
>4.8.2.2. A6 Records for DNS Servers</A
></H3
><P
@@ -1483,7 +1483,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN941"
+NAME="AEN973"
>4.8.3. Address to Name Lookups Using Nibble Format</A
></H2
><P
@@ -1514,7 +1514,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN948"
+NAME="AEN980"
>4.8.4. Address to Name Lookups Using Bitstring Format</A
></H2
><P
@@ -1541,7 +1541,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN955"
+NAME="AEN987"
>4.8.5. Using DNAME for Delegation of IPv6 Reverse Addresses</A
></H2
><P
diff --git a/doc/arm/Bv9ARM.ch05.html b/doc/arm/Bv9ARM.ch05.html
index cf6563a5..2e1b6787 100644
--- a/doc/arm/Bv9ARM.ch05.html
+++ b/doc/arm/Bv9ARM.ch05.html
@@ -78,7 +78,7 @@ CLASS="TOC"
></DT
><DT
>5.1. <A
-HREF="Bv9ARM.ch05.html#AEN975"
+HREF="Bv9ARM.ch05.html#AEN1007"
>The Lightweight Resolver Library</A
></DT
><DT
@@ -93,7 +93,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
-NAME="AEN975"
+NAME="AEN1007"
>5.1. The Lightweight Resolver Library</A
></H1
><P
diff --git a/doc/arm/Bv9ARM.ch06.html b/doc/arm/Bv9ARM.ch06.html
index 266cb0bd..56778531 100644
--- a/doc/arm/Bv9ARM.ch06.html
+++ b/doc/arm/Bv9ARM.ch06.html
@@ -88,7 +88,7 @@ HREF="Bv9ARM.ch06.html#Configuration_File_Grammar"
></DT
><DT
>6.3. <A
-HREF="Bv9ARM.ch06.html#AEN3338"
+HREF="Bv9ARM.ch06.html#AEN3395"
>Zone File</A
></DT
></DL
@@ -732,7 +732,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN1180"
+NAME="AEN1212"
>6.1.1.1. Syntax</A
></H3
><PRE
@@ -763,7 +763,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN1188"
+NAME="AEN1220"
>6.1.1.2. Definition and Usage</A
></H3
><P
@@ -824,11 +824,16 @@ and whether the element was negated.</P
access and a negated match denies access. If there is no match,
access is denied. The clauses <B
CLASS="command"
+>allow-notify</B
+>,
+<B
+CLASS="command"
>allow-query</B
>, <B
CLASS="command"
>allow-transfer</B
->, <B
+>,
+<B
CLASS="command"
>allow-update</B
> and <B
@@ -869,7 +874,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN1216"
+NAME="AEN1249"
>6.1.2. Comment Syntax</A
></H2
><P
@@ -888,7 +893,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN1221"
+NAME="AEN1254"
>6.1.2.1. Syntax</A
></H3
><P
@@ -920,7 +925,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN1230"
+NAME="AEN1263"
>6.1.2.2. Definition and Usage</A
></H3
><P
@@ -1253,7 +1258,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN1323"
+NAME="AEN1356"
>6.2.1. <B
CLASS="command"
>acl</B
@@ -1393,7 +1398,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN1365"
+NAME="AEN1398"
>6.2.3. <B
CLASS="command"
>controls</B
@@ -1432,7 +1437,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN1374"
+NAME="AEN1407"
>6.2.4. <B
CLASS="command"
>controls</B
@@ -1539,7 +1544,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN1400"
+NAME="AEN1433"
>6.2.5. <B
CLASS="command"
>include</B
@@ -1559,7 +1564,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN1405"
+NAME="AEN1438"
>6.2.6. <B
CLASS="command"
>include</B
@@ -1589,7 +1594,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN1412"
+NAME="AEN1445"
>6.2.7. <B
CLASS="command"
>key</B
@@ -1623,7 +1628,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN1419"
+NAME="AEN1452"
>6.2.8. <B
CLASS="command"
>key</B
@@ -1677,7 +1682,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN1431"
+NAME="AEN1464"
>6.2.9. <B
CLASS="command"
>logging</B
@@ -1837,7 +1842,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN1471"
+NAME="AEN1504"
>6.2.10. <B
CLASS="command"
>logging</B
@@ -1903,7 +1908,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN1488"
+NAME="AEN1521"
>6.2.10.1. The <B
CLASS="command"
>channel</B
@@ -2599,7 +2604,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN1673"
+NAME="AEN1706"
>6.2.11. <B
CLASS="command"
>lwres</B
@@ -2672,7 +2677,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN1691"
+NAME="AEN1724"
>6.2.12. <B
CLASS="command"
>lwres</B
@@ -2745,7 +2750,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN1710"
+NAME="AEN1743"
>6.2.13. <B
CLASS="command"
>options</B
@@ -3053,6 +3058,15 @@ CLASS="replaceable"
>]
[<SPAN
CLASS="optional"
+> allow-notify { <TT
+CLASS="replaceable"
+><I
+>address_match_list</I
+></TT
+> }; </SPAN
+>]
+ [<SPAN
+CLASS="optional"
> allow-query { <TT
CLASS="replaceable"
><I
@@ -3622,7 +3636,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN1911"
+NAME="AEN1946"
>6.2.14. <B
CLASS="command"
>options</B
@@ -3849,20 +3863,7 @@ CLASS="filename"
>named_dump.db</TT
>.</P
>
-<DIV
-CLASS="note"
-><BLOCKQUOTE
-CLASS="note"
-><P
-><B
->Note: </B
->Not yet implemented in <SPAN
-CLASS="acronym"
->BIND</SPAN
-> 9.</P
-></BLOCKQUOTE
-></DIV
-></TD
+</TD
></TR
><TR
><TD
@@ -4813,7 +4814,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN2223"
+NAME="AEN2255"
>6.2.14.2. Forwarding</A
></H3
><P
@@ -4933,6 +4934,40 @@ VALIGN="MIDDLE"
><P
><B
CLASS="command"
+>allow-notify</B
+></P
+></TD
+><TD
+WIDTH="300"
+ALIGN="LEFT"
+VALIGN="MIDDLE"
+><P
+>Specifies which hosts are allowed to
+notify slaves of a zone change in addition to the zone masters.
+<B
+CLASS="command"
+>allow-notify</B
+> may also be specified in the
+<B
+CLASS="command"
+>zone</B
+> statement, in which case it overrides the
+<B
+CLASS="command"
+>options allow-notify</B
+> statement. It is only meaningful
+for a slave zone. If not specified, the default is to process notify messages
+only from a zone's master.</P
+></TD
+></TR
+><TR
+><TD
+WIDTH="132"
+ALIGN="LEFT"
+VALIGN="MIDDLE"
+><P
+><B
+CLASS="command"
>allow-query</B
></P
></TD
@@ -5050,7 +5085,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN2290"
+NAME="AEN2331"
>6.2.14.4. Interfaces</A
></H3
><P
@@ -5145,7 +5180,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN2316"
+NAME="AEN2357"
>6.2.14.5. Query Address</A
></H3
><P
@@ -5632,7 +5667,10 @@ This address must appear in the slave server's <B
CLASS="command"
>masters</B
>
-zone clause.
+zone clause or in an <B
+CLASS="command"
+>allow-notify</B
+> clause.
This statement sets the <B
CLASS="command"
>notify-source</B
@@ -5684,7 +5722,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN2462"
+NAME="AEN2504"
>6.2.14.7. Resource Limits</A
></H3
><P
@@ -5912,7 +5950,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN2528"
+NAME="AEN2570"
>6.2.14.8. Periodic Task Intervals</A
></H3
><DIV
@@ -7079,7 +7117,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN2829"
+NAME="AEN2871"
>6.2.17. <B
CLASS="command"
>trusted-keys</B
@@ -7154,7 +7192,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN2845"
+NAME="AEN2887"
>6.2.18. <B
CLASS="command"
>trusted-keys</B
@@ -7189,7 +7227,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN2853"
+NAME="AEN2895"
>6.2.19. <B
CLASS="command"
>view</B
@@ -7252,7 +7290,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN2867"
+NAME="AEN2909"
>6.2.20. <B
CLASS="command"
>view</B
@@ -7421,6 +7459,15 @@ CLASS="optional"
type ( master | slave | hint | stub | forward ) ;
[<SPAN
CLASS="optional"
+> allow-notify { <TT
+CLASS="replaceable"
+><I
+>address_match_list</I
+></TT
+> } ; </SPAN
+>]
+ [<SPAN
+CLASS="optional"
> allow-query { <TT
CLASS="replaceable"
><I
@@ -7606,25 +7653,25 @@ CLASS="replaceable"
><I
>ip_addr</I
></TT
-> ; [<SPAN
+> [<SPAN
CLASS="optional"
-><TT
+>port <TT
CLASS="replaceable"
><I
->ip_addr</I
+>ip_port</I
></TT
-> [<SPAN
+></SPAN
+>] [<SPAN
CLASS="optional"
->port <TT
+>key <TT
CLASS="replaceable"
><I
->ip_port</I
+>key</I
></TT
></SPAN
->] ; [<SPAN
+>]; [<SPAN
CLASS="optional"
>...</SPAN
->]</SPAN
>] } ; </SPAN
>]
[<SPAN
@@ -7826,7 +7873,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN3002"
+NAME="AEN3046"
>6.2.22. <B
CLASS="command"
>zone</B
@@ -7837,7 +7884,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN3005"
+NAME="AEN3049"
>6.2.22.1. Zone Types</A
></H3
><DIV
@@ -7894,6 +7941,7 @@ of master servers that the slave contacts to update its copy of the zone.
By default, transfers are made from port 53 on the servers; this can
be changed for all servers by specifying a port number before the
list of IP addresses, or on a per-server basis after the IP address.
+Authentication to the master can also be done with per-server TSIG keys.
If a file is specified, then the
replica will be written to this file whenever the zone is changed,
and reloaded from this file on a server restart. Use of a file is
@@ -8062,19 +8110,37 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN3062"
+NAME="AEN3106"
>6.2.22.2. Class</A
></H3
><P
->The zone's name may optionally be followed by a class. If
-a class is not specified, class <TT
+>In general <B
+CLASS="command"
+>class</B
+> can now be omitted from
+a <B
+CLASS="command"
+>zone's</B
+> definition.
+It is now inherited for the enclosing <B
+CLASS="command"
+>view</B
+> or if
+there is no explicit <B
+CLASS="command"
+>view</B
+>, from the default
+<B
+CLASS="command"
+>view</B
+> which is <TT
CLASS="literal"
>IN</TT
-> (for <TT
+>
+(for <TT
CLASS="varname"
>Internet</TT
->),
-is assumed. This is correct for the vast majority of cases.</P
+>).</P
><P
>The <TT
CLASS="literal"
@@ -8100,7 +8166,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN3072"
+NAME="AEN3121"
>6.2.22.3. Zone Options</A
></H3
><DIV
@@ -8119,6 +8185,32 @@ VALIGN="MIDDLE"
><P
><B
CLASS="command"
+>allow-notify</B
+></P
+></TD
+><TD
+WIDTH="273"
+ALIGN="LEFT"
+VALIGN="MIDDLE"
+><P
+>See the description of
+<B
+CLASS="command"
+>allow-notify</B
+> in <A
+HREF="Bv9ARM.ch06.html#access_control"
+>Section 6.2.14.3</A
+></P
+></TD
+></TR
+><TR
+><TD
+WIDTH="159"
+ALIGN="LEFT"
+VALIGN="MIDDLE"
+><P
+><B
+CLASS="command"
>allow-query</B
></P
></TD
@@ -9040,7 +9132,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
-NAME="AEN3338"
+NAME="AEN3395"
>6.3. Zone File</A
></H1
><DIV
@@ -9061,7 +9153,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN3343"
+NAME="AEN3400"
>6.3.1.1. Resource Records</A
></H3
><P
@@ -9781,7 +9873,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN3557"
+NAME="AEN3614"
>6.3.1.2. Textual expression of RRs</A
></H3
><P
@@ -10101,7 +10193,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN3658"
+NAME="AEN3715"
>6.3.2. Discussion of MX Records</A
></H2
><P
@@ -10502,7 +10594,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN3779"
+NAME="AEN3836"
>6.3.4. Inverse Mapping in IPv4</A
></H2
><P
@@ -10601,7 +10693,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN3806"
+NAME="AEN3863"
>6.3.5. Other Zone File Directives</A
></H2
><P
@@ -10626,7 +10718,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN3813"
+NAME="AEN3870"
>6.3.5.1. The <B
CLASS="command"
>$ORIGIN</B
@@ -10696,7 +10788,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN3833"
+NAME="AEN3890"
>6.3.5.2. The <B
CLASS="command"
>$INCLUDE</B
@@ -10772,7 +10864,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN3852"
+NAME="AEN3909"
>6.3.5.3. The <B
CLASS="command"
>$TTL</B
@@ -10812,7 +10904,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN3863"
+NAME="AEN3920"
>6.3.6. <SPAN
CLASS="acronym"
>BIND</SPAN
diff --git a/doc/arm/Bv9ARM.ch07.html b/doc/arm/Bv9ARM.ch07.html
index 958d1d57..f2111219 100644
--- a/doc/arm/Bv9ARM.ch07.html
+++ b/doc/arm/Bv9ARM.ch07.html
@@ -83,7 +83,7 @@ HREF="Bv9ARM.ch07.html#Access_Control_Lists"
></DT
><DT
>7.2. <A
-HREF="Bv9ARM.ch07.html#AEN3954"
+HREF="Bv9ARM.ch07.html#AEN4012"
><B
CLASS="command"
>chroot</B
@@ -112,11 +112,16 @@ NAME="Access_Control_Lists"
>Access Control Lists (ACLs), are address match lists that
you can set up and nickname for future use in <B
CLASS="command"
+>allow-notify</B
+>,
+<B
+CLASS="command"
>allow-query</B
>, <B
CLASS="command"
>allow-recursion</B
->, <B
+>,
+<B
CLASS="command"
>blackhole</B
>, <B
@@ -180,7 +185,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
-NAME="AEN3954"
+NAME="AEN4012"
>7.2. <B
CLASS="command"
>chroot</B
@@ -259,7 +264,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN3977"
+NAME="AEN4035"
>7.2.1. The <B
CLASS="command"
>chroot</B
@@ -315,7 +320,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN3992"
+NAME="AEN4050"
>7.2.2. Using the <B
CLASS="command"
>setuid</B
diff --git a/doc/arm/Bv9ARM.ch08.html b/doc/arm/Bv9ARM.ch08.html
index 9641043b..389900e9 100644
--- a/doc/arm/Bv9ARM.ch08.html
+++ b/doc/arm/Bv9ARM.ch08.html
@@ -75,17 +75,17 @@ CLASS="TOC"
></DT
><DT
>8.1. <A
-HREF="Bv9ARM.ch08.html#AEN4012"
+HREF="Bv9ARM.ch08.html#AEN4070"
>Common Problems</A
></DT
><DT
>8.2. <A
-HREF="Bv9ARM.ch08.html#AEN4018"
+HREF="Bv9ARM.ch08.html#AEN4076"
>Incrementing and Changing the Serial Number</A
></DT
><DT
>8.3. <A
-HREF="Bv9ARM.ch08.html#AEN4023"
+HREF="Bv9ARM.ch08.html#AEN4081"
>Where Can I Get Help?</A
></DT
></DL
@@ -95,7 +95,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
-NAME="AEN4012"
+NAME="AEN4070"
>8.1. Common Problems</A
></H1
><DIV
@@ -103,7 +103,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN4014"
+NAME="AEN4072"
>8.1.1. It's not working; how can I figure out what's wrong?</A
></H2
><P
@@ -123,7 +123,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
-NAME="AEN4018"
+NAME="AEN4076"
>8.2. Incrementing and Changing the Serial Number</A
></H1
><P
@@ -152,7 +152,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
-NAME="AEN4023"
+NAME="AEN4081"
>8.3. Where Can I Get Help?</A
></H1
><P
diff --git a/doc/arm/Bv9ARM.ch09.html b/doc/arm/Bv9ARM.ch09.html
index a3521b54..c52655c7 100644
--- a/doc/arm/Bv9ARM.ch09.html
+++ b/doc/arm/Bv9ARM.ch09.html
@@ -69,7 +69,7 @@ CLASS="TOC"
></DT
><DT
>A.1. <A
-HREF="Bv9ARM.ch09.html#AEN4039"
+HREF="Bv9ARM.ch09.html#AEN4097"
>Acknowledgements</A
></DT
><DT
@@ -82,7 +82,7 @@ CLASS="acronym"
></DT
><DT
>A.3. <A
-HREF="Bv9ARM.ch09.html#AEN4080"
+HREF="Bv9ARM.ch09.html#AEN4138"
>General <SPAN
CLASS="acronym"
>DNS</SPAN
@@ -100,7 +100,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
-NAME="AEN4039"
+NAME="AEN4097"
>A.1. Acknowledgements</A
></H1
><DIV
@@ -108,7 +108,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN4041"
+NAME="AEN4099"
>A.1.1. A Brief History of the <SPAN
CLASS="acronym"
>DNS</SPAN
@@ -243,7 +243,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN4071"
+NAME="AEN4129"
>A.2.1.1. HS = hesiod</A
></H3
><P
@@ -264,7 +264,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
-NAME="AEN4076"
+NAME="AEN4134"
>A.2.1.2. CH = chaos</A
></H3
><P
@@ -282,7 +282,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
-NAME="AEN4080"
+NAME="AEN4138"
>A.3. General <SPAN
CLASS="acronym"
>DNS</SPAN
@@ -293,7 +293,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN4083"
+NAME="AEN4141"
>A.3.1. IPv6 addresses (A6)</A
></H2
><P
@@ -866,19 +866,19 @@ TARGET="_top"
>.</P
><H3
><A
-NAME="AEN4259"
+NAME="AEN4317"
>Bibliography</A
></H3
><H1
CLASS="bibliodiv"
><A
-NAME="AEN4260"
+NAME="AEN4318"
>Standards</A
></H1
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4262"
+NAME="AEN4320"
></A
><P
>[RFC974]&nbsp;C. Partridge, <I
@@ -892,7 +892,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4269"
+NAME="AEN4327"
></A
><P
>[RFC1034]&nbsp;P.V. Mockapetris, <I
@@ -906,7 +906,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4276"
+NAME="AEN4334"
></A
><P
>[RFC1035]&nbsp;P. V. Mockapetris, <I
@@ -927,7 +927,7 @@ NAME="proposed_standards"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4285"
+NAME="AEN4343"
></A
><P
>[RFC2181]&nbsp;R., R. Bush Elz, <I
@@ -944,7 +944,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4293"
+NAME="AEN4351"
></A
><P
>[RFC2308]&nbsp;M. Andrews, <I
@@ -961,7 +961,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4301"
+NAME="AEN4359"
></A
><P
>[RFC1995]&nbsp;M. Ohta, <I
@@ -978,7 +978,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4309"
+NAME="AEN4367"
></A
><P
>[RFC1996]&nbsp;P. Vixie, <I
@@ -992,7 +992,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4316"
+NAME="AEN4374"
></A
><P
>[RFC2136]&nbsp;P. Vixie, S. Thomson, Y. Rekhter, and J. Bound, <I
@@ -1006,7 +1006,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4333"
+NAME="AEN4391"
></A
><P
>[RFC2845]&nbsp;P. Vixie, O. Gudmundsson, D. Eastlake, 3rd, and B. Wellington, <I
@@ -1023,13 +1023,13 @@ STYLE="margin-left=0.5in"
><H1
CLASS="bibliodiv"
><A
-NAME="AEN4352"
+NAME="AEN4410"
>Proposed Standards Still Under Development</A
></H1
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4357"
+NAME="AEN4415"
></A
><P
>[RFC1886]&nbsp;S. Thomson and C. Huitema, <I
@@ -1046,7 +1046,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4369"
+NAME="AEN4427"
></A
><P
>[RFC2065]&nbsp;D. Eastlake, 3rd and C. Kaufman, <I
@@ -1060,7 +1060,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4381"
+NAME="AEN4439"
></A
><P
>[RFC2137]&nbsp;D. Eastlake, 3rd, <I
@@ -1074,7 +1074,7 @@ STYLE="margin-left=0.5in"
><H1
CLASS="bibliodiv"
><A
-NAME="AEN4389"
+NAME="AEN4447"
>Other Important RFCs About <SPAN
CLASS="acronym"
>DNS</SPAN
@@ -1083,7 +1083,7 @@ CLASS="acronym"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4392"
+NAME="AEN4450"
></A
><P
>[RFC1535]&nbsp;E. Gavron, <I
@@ -1100,7 +1100,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4400"
+NAME="AEN4458"
></A
><P
>[RFC1536]&nbsp;A. Kumar, J. Postel, C. Neuman, P. Danzig, and S. Miller, <I
@@ -1117,7 +1117,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4421"
+NAME="AEN4479"
></A
><P
>[RFC1982]&nbsp;R. Elz and R. Bush, <I
@@ -1131,13 +1131,13 @@ STYLE="margin-left=0.5in"
><H1
CLASS="bibliodiv"
><A
-NAME="AEN4432"
+NAME="AEN4490"
>Resource Record Types</A
></H1
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4434"
+NAME="AEN4492"
></A
><P
>[RFC1183]&nbsp;C.F. Everhart, L. A. Mamakos, R. Ullmann, and P. Mockapetris, <I
@@ -1154,7 +1154,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4452"
+NAME="AEN4510"
></A
><P
>[RFC1706]&nbsp;B. Manning and R. Colella, <I
@@ -1171,7 +1171,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4464"
+NAME="AEN4522"
></A
><P
>[RFC2168]&nbsp;R. Daniel and M. Mealling, <I
@@ -1186,7 +1186,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4475"
+NAME="AEN4533"
></A
><P
>[RFC1876]&nbsp;C. Davis, P. Vixie, T., and I. Dickinson, <I
@@ -1201,7 +1201,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4492"
+NAME="AEN4550"
></A
><P
>[RFC2052]&nbsp;A. Gulbrandsen and P. Vixie, <I
@@ -1219,7 +1219,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4504"
+NAME="AEN4562"
></A
><P
>[RFC2163]&nbsp;A. Allocchio, <I
@@ -1237,7 +1237,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4512"
+NAME="AEN4570"
></A
><P
>[RFC2230]&nbsp;R. Atkinson, <I
@@ -1254,7 +1254,7 @@ STYLE="margin-left=0.5in"
><H1
CLASS="bibliodiv"
><A
-NAME="AEN4520"
+NAME="AEN4578"
><SPAN
CLASS="acronym"
>DNS</SPAN
@@ -1263,7 +1263,7 @@ CLASS="acronym"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4523"
+NAME="AEN4581"
></A
><P
>[RFC1101]&nbsp;P. V. Mockapetris, <I
@@ -1280,7 +1280,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4531"
+NAME="AEN4589"
></A
><P
>[RFC1123]&nbsp;Braden, <I
@@ -1294,7 +1294,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4538"
+NAME="AEN4596"
></A
><P
>[RFC1591]&nbsp;J. Postel, <I
@@ -1308,7 +1308,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4545"
+NAME="AEN4603"
></A
><P
>[RFC2317]&nbsp;H. Eidnes, G. de Groot, and P. Vixie, <I
@@ -1322,7 +1322,7 @@ STYLE="margin-left=0.5in"
><H1
CLASS="bibliodiv"
><A
-NAME="AEN4559"
+NAME="AEN4617"
><SPAN
CLASS="acronym"
>DNS</SPAN
@@ -1331,7 +1331,7 @@ CLASS="acronym"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4562"
+NAME="AEN4620"
></A
><P
>[RFC1537]&nbsp;P. Beertema, <I
@@ -1348,7 +1348,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4570"
+NAME="AEN4628"
></A
><P
>[RFC1912]&nbsp;D. Barr, <I
@@ -1365,7 +1365,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4578"
+NAME="AEN4636"
></A
><P
>[RFC1912]&nbsp;D. Barr, <I
@@ -1382,7 +1382,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4586"
+NAME="AEN4644"
></A
><P
>[RFC2010]&nbsp;B. Manning and P. Vixie, <I
@@ -1396,7 +1396,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4597"
+NAME="AEN4655"
></A
><P
>[RFC2219]&nbsp;M. Hamilton and R. Wright, <I
@@ -1413,7 +1413,7 @@ STYLE="margin-left=0.5in"
><H1
CLASS="bibliodiv"
><A
-NAME="AEN4609"
+NAME="AEN4667"
>Other <SPAN
CLASS="acronym"
>DNS</SPAN
@@ -1422,7 +1422,7 @@ CLASS="acronym"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4615"
+NAME="AEN4673"
></A
><P
>[RFC1464]&nbsp;R. Rosenbaum, <I
@@ -1436,7 +1436,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4622"
+NAME="AEN4680"
></A
><P
>[RFC1713]&nbsp;A. Romao, <I
@@ -1453,7 +1453,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4630"
+NAME="AEN4688"
></A
><P
>[RFC1794]&nbsp;T. Brisco, <I
@@ -1470,7 +1470,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4638"
+NAME="AEN4696"
></A
><P
>[RFC2240]&nbsp;O. Vaughan, <I
@@ -1484,7 +1484,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4645"
+NAME="AEN4703"
></A
><P
>[RFC2345]&nbsp;J. Klensin, T. Wolf, and G. Oglesby, <I
@@ -1498,7 +1498,7 @@ STYLE="margin-left=0.5in"
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4659"
+NAME="AEN4717"
></A
><P
>[RFC2352]&nbsp;O. Vaughan, <I
@@ -1512,13 +1512,13 @@ STYLE="margin-left=0.5in"
><H1
CLASS="bibliodiv"
><A
-NAME="AEN4666"
+NAME="AEN4724"
>Obsolete and Unimplemented Experimental RRs</A
></H1
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4668"
+NAME="AEN4726"
></A
><P
>[RFC1712]&nbsp;C. Farrell, M. Schulze, S. Pleitner, and D. Baldoni, <I
@@ -1557,7 +1557,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
-NAME="AEN4689"
+NAME="AEN4747"
>A.4.3. Other Documents About <SPAN
CLASS="acronym"
>BIND</SPAN
@@ -1567,13 +1567,13 @@ CLASS="acronym"
></P
><H3
><A
-NAME="AEN4693"
+NAME="AEN4751"
>Bibliography</A
></H3
><DIV
CLASS="biblioentry"
><A
-NAME="AEN4694"
+NAME="AEN4752"
></A
><P
>Paul Albitz and Cricket Liu, <I
diff --git a/doc/arm/Bv9ARM.html b/doc/arm/Bv9ARM.html
index 5e703cd7..a00b0879 100644
--- a/doc/arm/Bv9ARM.html
+++ b/doc/arm/Bv9ARM.html
@@ -168,7 +168,7 @@ HREF="Bv9ARM.ch03.html#AEN375"
></DT
><DT
>3.4.2. <A
-HREF="Bv9ARM.ch03.html#AEN588"
+HREF="Bv9ARM.ch03.html#AEN620"
>Signals</A
></DT
></DL
@@ -194,7 +194,7 @@ HREF="Bv9ARM.ch04.html#incremental_zone_transfers"
></DT
><DT
>4.3. <A
-HREF="Bv9ARM.ch04.html#AEN642"
+HREF="Bv9ARM.ch04.html#AEN674"
>Split DNS</A
></DT
><DT
@@ -206,44 +206,44 @@ HREF="Bv9ARM.ch04.html#tsig"
><DL
><DT
>4.4.1. <A
-HREF="Bv9ARM.ch04.html#AEN733"
+HREF="Bv9ARM.ch04.html#AEN765"
>Generate Shared Keys for Each Pair of Hosts</A
></DT
><DT
>4.4.2. <A
-HREF="Bv9ARM.ch04.html#AEN754"
+HREF="Bv9ARM.ch04.html#AEN786"
>Copying the Shared Secret to Both Machines</A
></DT
><DT
>4.4.3. <A
-HREF="Bv9ARM.ch04.html#AEN757"
+HREF="Bv9ARM.ch04.html#AEN789"
>Informing the Servers of the Key's Existence</A
></DT
><DT
>4.4.4. <A
-HREF="Bv9ARM.ch04.html#AEN769"
+HREF="Bv9ARM.ch04.html#AEN801"
>Instructing the Server to Use the Key</A
></DT
><DT
>4.4.5. <A
-HREF="Bv9ARM.ch04.html#AEN785"
+HREF="Bv9ARM.ch04.html#AEN817"
>TSIG Key Based Access Control</A
></DT
><DT
>4.4.6. <A
-HREF="Bv9ARM.ch04.html#AEN798"
+HREF="Bv9ARM.ch04.html#AEN830"
>Errors</A
></DT
></DL
></DD
><DT
>4.5. <A
-HREF="Bv9ARM.ch04.html#AEN802"
+HREF="Bv9ARM.ch04.html#AEN834"
>TKEY</A
></DT
><DT
>4.6. <A
-HREF="Bv9ARM.ch04.html#AEN817"
+HREF="Bv9ARM.ch04.html#AEN849"
>SIG(0)</A
></DT
><DT
@@ -255,34 +255,34 @@ HREF="Bv9ARM.ch04.html#DNSSEC"
><DL
><DT
>4.7.1. <A
-HREF="Bv9ARM.ch04.html#AEN833"
+HREF="Bv9ARM.ch04.html#AEN865"
>Generating Keys</A
></DT
><DT
>4.7.2. <A
-HREF="Bv9ARM.ch04.html#AEN853"
+HREF="Bv9ARM.ch04.html#AEN885"
>Creating a Keyset</A
></DT
><DT
>4.7.3. <A
-HREF="Bv9ARM.ch04.html#AEN865"
+HREF="Bv9ARM.ch04.html#AEN897"
>Signing the Child's Keyset</A
></DT
><DT
>4.7.4. <A
-HREF="Bv9ARM.ch04.html#AEN878"
+HREF="Bv9ARM.ch04.html#AEN910"
>Signing the Zone</A
></DT
><DT
>4.7.5. <A
-HREF="Bv9ARM.ch04.html#AEN894"
+HREF="Bv9ARM.ch04.html#AEN926"
>Configuring Servers</A
></DT
></DL
></DD
><DT
>4.8. <A
-HREF="Bv9ARM.ch04.html#AEN901"
+HREF="Bv9ARM.ch04.html#AEN933"
>IPv6 Support in <SPAN
CLASS="acronym"
>BIND</SPAN
@@ -292,27 +292,27 @@ CLASS="acronym"
><DL
><DT
>4.8.1. <A
-HREF="Bv9ARM.ch04.html#AEN915"
+HREF="Bv9ARM.ch04.html#AEN947"
>Address Lookups Using AAAA Records</A
></DT
><DT
>4.8.2. <A
-HREF="Bv9ARM.ch04.html#AEN920"
+HREF="Bv9ARM.ch04.html#AEN952"
>Address Lookups Using A6 Records</A
></DT
><DT
>4.8.3. <A
-HREF="Bv9ARM.ch04.html#AEN941"
+HREF="Bv9ARM.ch04.html#AEN973"
>Address to Name Lookups Using Nibble Format</A
></DT
><DT
>4.8.4. <A
-HREF="Bv9ARM.ch04.html#AEN948"
+HREF="Bv9ARM.ch04.html#AEN980"
>Address to Name Lookups Using Bitstring Format</A
></DT
><DT
>4.8.5. <A
-HREF="Bv9ARM.ch04.html#AEN955"
+HREF="Bv9ARM.ch04.html#AEN987"
>Using DNAME for Delegation of IPv6 Reverse Addresses</A
></DT
></DL
@@ -331,7 +331,7 @@ CLASS="acronym"
><DL
><DT
>5.1. <A
-HREF="Bv9ARM.ch05.html#AEN975"
+HREF="Bv9ARM.ch05.html#AEN1007"
>The Lightweight Resolver Library</A
></DT
><DT
@@ -365,7 +365,7 @@ HREF="Bv9ARM.ch06.html#address_match_lists"
></DT
><DT
>6.1.2. <A
-HREF="Bv9ARM.ch06.html#AEN1216"
+HREF="Bv9ARM.ch06.html#AEN1249"
>Comment Syntax</A
></DT
></DL
@@ -379,7 +379,7 @@ HREF="Bv9ARM.ch06.html#Configuration_File_Grammar"
><DL
><DT
>6.2.1. <A
-HREF="Bv9ARM.ch06.html#AEN1323"
+HREF="Bv9ARM.ch06.html#AEN1356"
><B
CLASS="command"
>acl</B
@@ -396,7 +396,7 @@ Usage</A
></DT
><DT
>6.2.3. <A
-HREF="Bv9ARM.ch06.html#AEN1365"
+HREF="Bv9ARM.ch06.html#AEN1398"
><B
CLASS="command"
>controls</B
@@ -404,7 +404,7 @@ CLASS="command"
></DT
><DT
>6.2.4. <A
-HREF="Bv9ARM.ch06.html#AEN1374"
+HREF="Bv9ARM.ch06.html#AEN1407"
><B
CLASS="command"
>controls</B
@@ -413,7 +413,7 @@ Usage</A
></DT
><DT
>6.2.5. <A
-HREF="Bv9ARM.ch06.html#AEN1400"
+HREF="Bv9ARM.ch06.html#AEN1433"
><B
CLASS="command"
>include</B
@@ -421,7 +421,7 @@ CLASS="command"
></DT
><DT
>6.2.6. <A
-HREF="Bv9ARM.ch06.html#AEN1405"
+HREF="Bv9ARM.ch06.html#AEN1438"
><B
CLASS="command"
>include</B
@@ -430,7 +430,7 @@ Usage</A
></DT
><DT
>6.2.7. <A
-HREF="Bv9ARM.ch06.html#AEN1412"
+HREF="Bv9ARM.ch06.html#AEN1445"
><B
CLASS="command"
>key</B
@@ -438,7 +438,7 @@ CLASS="command"
></DT
><DT
>6.2.8. <A
-HREF="Bv9ARM.ch06.html#AEN1419"
+HREF="Bv9ARM.ch06.html#AEN1452"
><B
CLASS="command"
>key</B
@@ -446,7 +446,7 @@ CLASS="command"
></DT
><DT
>6.2.9. <A
-HREF="Bv9ARM.ch06.html#AEN1431"
+HREF="Bv9ARM.ch06.html#AEN1464"
><B
CLASS="command"
>logging</B
@@ -454,7 +454,7 @@ CLASS="command"
></DT
><DT
>6.2.10. <A
-HREF="Bv9ARM.ch06.html#AEN1471"
+HREF="Bv9ARM.ch06.html#AEN1504"
><B
CLASS="command"
>logging</B
@@ -463,7 +463,7 @@ Usage</A
></DT
><DT
>6.2.11. <A
-HREF="Bv9ARM.ch06.html#AEN1673"
+HREF="Bv9ARM.ch06.html#AEN1706"
><B
CLASS="command"
>lwres</B
@@ -471,7 +471,7 @@ CLASS="command"
></DT
><DT
>6.2.12. <A
-HREF="Bv9ARM.ch06.html#AEN1691"
+HREF="Bv9ARM.ch06.html#AEN1724"
><B
CLASS="command"
>lwres</B
@@ -479,7 +479,7 @@ CLASS="command"
></DT
><DT
>6.2.13. <A
-HREF="Bv9ARM.ch06.html#AEN1710"
+HREF="Bv9ARM.ch06.html#AEN1743"
><B
CLASS="command"
>options</B
@@ -487,7 +487,7 @@ CLASS="command"
></DT
><DT
>6.2.14. <A
-HREF="Bv9ARM.ch06.html#AEN1911"
+HREF="Bv9ARM.ch06.html#AEN1946"
><B
CLASS="command"
>options</B
@@ -514,7 +514,7 @@ and Usage</A
></DT
><DT
>6.2.17. <A
-HREF="Bv9ARM.ch06.html#AEN2829"
+HREF="Bv9ARM.ch06.html#AEN2871"
><B
CLASS="command"
>trusted-keys</B
@@ -522,7 +522,7 @@ CLASS="command"
></DT
><DT
>6.2.18. <A
-HREF="Bv9ARM.ch06.html#AEN2845"
+HREF="Bv9ARM.ch06.html#AEN2887"
><B
CLASS="command"
>trusted-keys</B
@@ -531,7 +531,7 @@ and Usage</A
></DT
><DT
>6.2.19. <A
-HREF="Bv9ARM.ch06.html#AEN2853"
+HREF="Bv9ARM.ch06.html#AEN2895"
><B
CLASS="command"
>view</B
@@ -539,7 +539,7 @@ CLASS="command"
></DT
><DT
>6.2.20. <A
-HREF="Bv9ARM.ch06.html#AEN2867"
+HREF="Bv9ARM.ch06.html#AEN2909"
><B
CLASS="command"
>view</B
@@ -556,7 +556,7 @@ Statement Grammar</A
></DT
><DT
>6.2.22. <A
-HREF="Bv9ARM.ch06.html#AEN3002"
+HREF="Bv9ARM.ch06.html#AEN3046"
><B
CLASS="command"
>zone</B
@@ -566,7 +566,7 @@ CLASS="command"
></DD
><DT
>6.3. <A
-HREF="Bv9ARM.ch06.html#AEN3338"
+HREF="Bv9ARM.ch06.html#AEN3395"
>Zone File</A
></DT
><DD
@@ -578,7 +578,7 @@ HREF="Bv9ARM.ch06.html#types_of_resource_records_and_when_to_use_them"
></DT
><DT
>6.3.2. <A
-HREF="Bv9ARM.ch06.html#AEN3658"
+HREF="Bv9ARM.ch06.html#AEN3715"
>Discussion of MX Records</A
></DT
><DT
@@ -588,17 +588,17 @@ HREF="Bv9ARM.ch06.html#Setting_TTLs"
></DT
><DT
>6.3.4. <A
-HREF="Bv9ARM.ch06.html#AEN3779"
+HREF="Bv9ARM.ch06.html#AEN3836"
>Inverse Mapping in IPv4</A
></DT
><DT
>6.3.5. <A
-HREF="Bv9ARM.ch06.html#AEN3806"
+HREF="Bv9ARM.ch06.html#AEN3863"
>Other Zone File Directives</A
></DT
><DT
>6.3.6. <A
-HREF="Bv9ARM.ch06.html#AEN3863"
+HREF="Bv9ARM.ch06.html#AEN3920"
><SPAN
CLASS="acronym"
>BIND</SPAN
@@ -628,7 +628,7 @@ HREF="Bv9ARM.ch07.html#Access_Control_Lists"
></DT
><DT
>7.2. <A
-HREF="Bv9ARM.ch07.html#AEN3954"
+HREF="Bv9ARM.ch07.html#AEN4012"
><B
CLASS="command"
>chroot</B
@@ -642,7 +642,7 @@ UNIX servers)</A
><DL
><DT
>7.2.1. <A
-HREF="Bv9ARM.ch07.html#AEN3977"
+HREF="Bv9ARM.ch07.html#AEN4035"
>The <B
CLASS="command"
>chroot</B
@@ -650,7 +650,7 @@ CLASS="command"
></DT
><DT
>7.2.2. <A
-HREF="Bv9ARM.ch07.html#AEN3992"
+HREF="Bv9ARM.ch07.html#AEN4050"
>Using the <B
CLASS="command"
>setuid</B
@@ -674,26 +674,26 @@ HREF="Bv9ARM.ch08.html"
><DL
><DT
>8.1. <A
-HREF="Bv9ARM.ch08.html#AEN4012"
+HREF="Bv9ARM.ch08.html#AEN4070"
>Common Problems</A
></DT
><DD
><DL
><DT
>8.1.1. <A
-HREF="Bv9ARM.ch08.html#AEN4014"
+HREF="Bv9ARM.ch08.html#AEN4072"
>It's not working; how can I figure out what's wrong?</A
></DT
></DL
></DD
><DT
>8.2. <A
-HREF="Bv9ARM.ch08.html#AEN4018"
+HREF="Bv9ARM.ch08.html#AEN4076"
>Incrementing and Changing the Serial Number</A
></DT
><DT
>8.3. <A
-HREF="Bv9ARM.ch08.html#AEN4023"
+HREF="Bv9ARM.ch08.html#AEN4081"
>Where Can I Get Help?</A
></DT
></DL
@@ -707,14 +707,14 @@ HREF="Bv9ARM.ch09.html"
><DL
><DT
>A.1. <A
-HREF="Bv9ARM.ch09.html#AEN4039"
+HREF="Bv9ARM.ch09.html#AEN4097"
>Acknowledgements</A
></DT
><DD
><DL
><DT
>A.1.1. <A
-HREF="Bv9ARM.ch09.html#AEN4041"
+HREF="Bv9ARM.ch09.html#AEN4099"
>A Brief History of the <SPAN
CLASS="acronym"
>DNS</SPAN
@@ -744,7 +744,7 @@ HREF="Bv9ARM.ch09.html#classes_of_resource_records"
></DD
><DT
>A.3. <A
-HREF="Bv9ARM.ch09.html#AEN4080"
+HREF="Bv9ARM.ch09.html#AEN4138"
>General <SPAN
CLASS="acronym"
>DNS</SPAN
@@ -754,7 +754,7 @@ CLASS="acronym"
><DL
><DT
>A.3.1. <A
-HREF="Bv9ARM.ch09.html#AEN4083"
+HREF="Bv9ARM.ch09.html#AEN4141"
>IPv6 addresses (A6)</A
></DT
></DL
@@ -778,7 +778,7 @@ HREF="Bv9ARM.ch09.html#internet_drafts"
></DT
><DT
>A.4.3. <A
-HREF="Bv9ARM.ch09.html#AEN4689"
+HREF="Bv9ARM.ch09.html#AEN4747"
>Other Documents About <SPAN
CLASS="acronym"
>BIND</SPAN
diff --git a/doc/draft/draft-ietf-dhc-dhcp-dns-12.txt b/doc/draft/draft-ietf-dhc-dhcp-dns-12.txt
deleted file mode 100644
index d2424d07..00000000
--- a/doc/draft/draft-ietf-dhc-dhcp-dns-12.txt
+++ /dev/null
@@ -1,1072 +0,0 @@
-
-
-DHC Working Group M. Stapp
-Internet-Draft Y. Rekhter
-Expires: September 2000 Cisco Systems, Inc.
- March 10, 2000
-
-
- Interaction between DHCP and DNS
- <draft-ietf-dhc-dhcp-dns-12.txt>
-
-Status of this Memo
-
- This document is an Internet-Draft and is in full conformance with
- all provisions of Section 10 of RFC2026.
-
- Internet-Drafts are working documents of the Internet Engineering
- Task Force (IETF), its areas, and its working groups. Note that
- other groups may also distribute working documents as
- Internet-Drafts.
-
- Internet-Drafts are draft documents valid for a maximum of six
- months and may be updated, replaced, or obsoleted by other documents
- at any time. It is inappropriate to use Internet-Drafts as reference
- material or to cite them other than as "work in progress."
-
- To view the entire list of Internet-Draft Shadow Directories, see
- http://www.ietf.org/shadow.html.
-
- This Internet-Draft will expire on September 2000.
-
-Copyright Notice
-
- Copyright (C) The Internet Society (2000). All Rights Reserved.
-
-Abstract
-
- DHCP provides a powerful mechanism for IP host configuration.
- However, the configuration capability provided by DHCP does not
- include updating DNS, and specifically updating the name to address
- and address to name mappings maintained in the DNS.
-
- This document specifies how DHCP clients and servers should use the
- Dynamic DNS Updates mechanism in RFC2136[5] to update the DNS name
- to address and address to name mappings so that the mappings for
- DHCP clients will be consistent with the IP addresses that the
- clients acquire via DHCP.
-
-
-
-
-
-
-
-Stapp & Rekhter Expires September 2000 [Page 1]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
-Table of Contents
-
- 1. Terminology . . . . . . . . . . . . . . . . . . . . . . . . 3
- 2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
- 3. Models of Operation . . . . . . . . . . . . . . . . . . . . 3
- 4. Issues with DDNS in DHCP Environments . . . . . . . . . . . 4
- 4.1 Name Collisions . . . . . . . . . . . . . . . . . . . . . . 5
- 4.2 Multiple DHCP servers . . . . . . . . . . . . . . . . . . . 6
- 4.3 Use of the DHCID RR . . . . . . . . . . . . . . . . . . . . 6
- 4.3.1 Format of the DHCID RRDATA . . . . . . . . . . . . . . . . . 6
- 4.4 DNS RR TTLs . . . . . . . . . . . . . . . . . . . . . . . . 8
- 5. Client FQDN Option . . . . . . . . . . . . . . . . . . . . . 8
- 5.1 The Flags Field . . . . . . . . . . . . . . . . . . . . . . 9
- 5.2 The RCODE Fields . . . . . . . . . . . . . . . . . . . . . . 10
- 5.3 The Domain Name Field . . . . . . . . . . . . . . . . . . . 10
- 6. DHCP Client behavior . . . . . . . . . . . . . . . . . . . . 10
- 7. DHCP Server behavior . . . . . . . . . . . . . . . . . . . . 12
- 8. Procedures for performing DNS updates . . . . . . . . . . . 14
- 8.1 Adding A RRs to DNS . . . . . . . . . . . . . . . . . . . . 14
- 8.2 Adding PTR RR Entries to DNS . . . . . . . . . . . . . . . . 15
- 8.3 Removing Entries from DNS . . . . . . . . . . . . . . . . . 15
- 8.4 Updating other RRs . . . . . . . . . . . . . . . . . . . . . 16
- 9. Security Considerations . . . . . . . . . . . . . . . . . . 16
- 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 17
- References . . . . . . . . . . . . . . . . . . . . . . . . . 17
- Authors' Addresses . . . . . . . . . . . . . . . . . . . . . 18
- Full Copyright Statement . . . . . . . . . . . . . . . . . . 19
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Stapp & Rekhter Expires September 2000 [Page 2]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
-1. Terminology
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
- document are to be interpreted as described in RFC 2119[6].
-
-2. Introduction
-
- DNS (RFC1034[1], RFC1035[2]) maintains (among other things) the
- information about mapping between hosts' Fully Qualified Domain
- Names (FQDNs) RFC1594[4] and IP addresses assigned to the hosts. The
- information is maintained in two types of Resource Records (RRs): A
- and PTR. The A RR contains mapping from a FQDN to an IP address; the
- PTR RR contains mapping from an IP address to a FQDN. The Dynamic
- DNS Updates specification (RFC2136[5]) describes a mechanism that
- enables DNS information to be updated over a network.
-
- DHCP RFC2131[3] provides a mechanism by which a host (a DHCP client)
- can acquire certain configuration information, along with its IP
- address(es). However, DHCP does not provide any mechanisms to update
- the DNS RRs that contain the information about mapping between the
- host's FQDN and its IP address(es) (A and PTR RRs). Thus the
- information maintained by DNS for a DHCP client may be incorrect - a
- host (the client) could acquire its address by using DHCP, but the A
- RR for the host's FQDN wouldn't reflect the address that the host
- acquired, and the PTR RR for the acquired address wouldn't reflect
- the host's FQDN.
-
- The Dynamic DNS Update protocol can be used to maintain consistency
- between the information stored in the A and PTR RRs and the actual
- address assignment done via DHCP. When a host with a particular FQDN
- acquires its IP address via DHCP, the A RR associated with the
- host's FQDN would be updated (by using the Dynamic DNS Updates
- protocol) to reflect the new address. Likewise, when an IP address
- is assigned to a host with a particular FQDN, the PTR RR associated
- with this address would be updated (using the Dynamic DNS Updates
- protocol) to reflect the new FQDN.
-
- Although this document refers to the A and PTR DNS record types and
- to DHCP assignment of IPv4 addresses, the same procedures and
- requirements apply for updates to the analogous RR types that are
- used when clients are assigned IPv6 addresses via DHCPv6.
-
-3. Models of Operation
-
- When a DHCP client acquires a new address, a site's administrator
- may desire that one or both of the A RR for the client's FQDN and
- the PTR RR for the acquired address be updated. Therefore, two
- separate Dynamic DNS Update transactions occur. Acquiring an address
-
-
-Stapp & Rekhter Expires September 2000 [Page 3]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
- via DHCP involves two entities: a DHCP client and a DHCP server. In
- principle each of these entities could perform none, one, or both of
- the transactions. However, in practice not all permutations make
- sense. This document covers these possible design permutations:
-
- 1. DHCP client updates the A RR, DHCP server updates the PTR RR
- 2. DHCP server updates both the A and the PTR RRs
-
- The only difference between these two cases is whether the FQDN to
- IP address mapping is updated by a DHCP client or by a DHCP server.
- The IP address to FQDN mapping is updated by a DHCP server in both
- cases.
-
- The reason these two are important, while others are unlikely, has
- to do with authority over the respective DNS domain names. A DHCP
- client may be given authority over mapping its own A RRs, or that
- authority may be restricted to a server to prevent the client from
- listing arbitrary addresses or associating its address with
- arbitrary domain names. In all cases, the only reasonable place for
- the authority over the PTR RRs associated with the address is in the
- DHCP server that allocates the address.
-
- In any case, whether a site permits all, some, or no DHCP servers
- and clients to perform DNS updates into the zones which it controls
- is entirely a matter of local administrative policy. This document
- does not require any specific administrative policy, and does not
- propose one. The range of possible policies is very broad, from
- sites where only the DHCP servers have been given credentials that
- the DNS servers will accept, to sites where each individual DHCP
- client has been configured with credentials which allow the client
- to modify its own domain name. Compliant implementations MAY support
- some or all of these possibilities. Furthermore, this specification
- applies only to DHCP client and server processes: it does not apply
- to other processes which initiate dynamic DNS updates.
-
- This document describes a new DHCP option which a client can use to
- convey all or part of its domain name to a DHCP server.
- Site-specific policy determines whether DHCP servers use the names
- that clients offer or not, and what DHCP servers may do in cases
- where clients do not supply domain names.
-
-4. Issues with DDNS in DHCP Environments
-
- There are two DNS update situations that require special
- consideration in DHCP environments: cases where more than one DHCP
- client has been configured with the same FQDN, and cases where more
- than one DHCP server has been given authority to perform DNS updates
- in a zone. In these cases, it is possible for DNS records to be
- modified in inconsistent ways unless the updaters have a mechanism
- that allows them to detect anomolous situations. If DNS updaters can
-
-
-Stapp & Rekhter Expires September 2000 [Page 4]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
- detect these situations, site administrators can configure the
- updaters' behavior so that the site's policies can be enforced. We
- use the term "Name Collisions" to refer to cases where more than one
- DHCP client has been associated with a single FQDN. This
- specification describes a mechanism designed to allow updaters to
- detect these situations, and requires that DHCP implementations use
- this mechanism by default.
-
-4.1 Name Collisions
-
- How can the entity updating an A RR (either the DHCP client or DHCP
- server) detect that a domain name has an A RR which is already in
- use by a different DHCP client? Similarly, should a DHCP client or
- server update a domain name which has an A RR that has been
- configured by an administrator? In either of these cases, the
- domain name in question would either have an additional A RR, or
- would have its original A RR replaced by the new record. Either of
- these effects may be considered undesirable by some sites. Different
- authority and credential models have different levels of exposure to
- name collisions.
-
- 1. Client updates A RR, uses Secure DNS Update with credentials
- that are associated with the client's FQDN, and exclusive to the
- client. Name collisions in this scenario are unlikely (though
- not impossible), since the client has received credentials
- specific to the name it desires to use. This implies that the
- name has already been allocated (through some implementation- or
- organization-specific procedure) to that client.
-
- 2. Client updates A RR, uses Secure DNS Update with credentials
- that are valid for any name in the zone. Name collisions in this
- scenario are possible, since the credentials necessary for the
- client to update DNS are not necessarily name-specific. Thus,
- for the client to be attempting to update a unique name requires
- the existence of some administrative procedure to ensure client
- configuration with unique names.
-
- 3. Server updates the A RR, uses a name for the client which is
- known to the server. Name collisions in this scenario are likely
- unless prevented by the server's name configuration procedures.
- See Section 9 for security issues with this form of deployment.
-
- 4. Server updates the A RR, uses a name supplied by the client.
- Name collisions in this scenario are highly likely, even with
- administrative procedures designed to prevent them. (This
- scenario is a popular one in real-world deployments in many
- types of organizations.) See Section 9 for security issues with
- this type of deployment.
-
-
- Scenarios 2, 3, and 4 rely on administrative procedures to ensure
- name uniqueness for DNS updates, and these procedures may break
- down. Experience has shown that, in fact, these procedures will
- break down at least occasionally. The question is what to do when
-
-
-Stapp & Rekhter Expires September 2000 [Page 5]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
- these procedures break down or, for example in scenario #4, may not
- even exist.
-
- In all cases of name collisions, the desire is to offer two modes of
- operation to the administrator of the combined DHCP-DNS capability:
- first-update-wins (i.e., the first updating entity gets the name) or
- most-recent-update-wins (i.e., the last updating entity for a name
- gets the name).
-
-4.2 Multiple DHCP servers
-
- If multiple DHCP servers are able to update the same DNS zones, or
- if DHCP servers are performing A RR updates on behalf of DHCP
- clients, and more than one DHCP server may be able to serve
- addresses to the same DHCP clients, the DHCP servers should be able
- to provide reasonable and consistent DNS name update behavior for
- DHCP clients.
-
-4.3 Use of the DHCID RR
-
- A solution to both of these problems is for the updating entities
- (both DHCP clients and DHCP servers) to be able to detect that
- another entity has been associated with a DNS name, and to offer
- administrators the opportunity to configure update behavior.
-
- Specifically, a DHCID RR, described in DHCID RR[12] is used to
- associate client identification information with a DNS name and the
- A RR associated with that name. When either a client or server adds
- an A RR for a client, it also adds a DHCID RR which specifies a
- unique client identity (based on a "client specifier" created from
- the client's client-id or MAC address). In this model, only one A
- RR is associated with a given DNS name at a time.
-
- By associating this ownership information with each A RR,
- cooperating DNS updating entities may determine whether their client
- is the first or last updater of the name (and implement the
- appropriately configured administrative policy), and DHCP clients
- which currently have a host name may move from one DHCP server to
- another without losing their DNS name.
-
- The specific algorithms utilizing the DHCID RR to signal client
- ownership are explained below. The algorithms only work in the case
- where the updating entities all cooperate -- this approach is
- advisory only and is not substitute for DNS security, nor is it
- replaced by DNS security.
-
-4.3.1 Format of the DHCID RRDATA
-
- The DHCID RR used to hold the DHCP client's identity is formatted as
-
-
-Stapp & Rekhter Expires September 2000 [Page 6]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
- follows:
-
- The name of the DHCID RR is the name of the A or PTR RR which refers
- to the DHCP client.
-
- The RDATA section of a DHCID RR in transmission contains RDLENGTH
- bytes of binary data. From the perspective of DHCP clients and
- servers, the DHC resource record consists of a 16-bit identifier
- type, followed by one or more bytes representing the actual
- identifier. There are two possible forms for a DHCID RR - one that
- is used when the client's link-layer address is being used to
- identify it, and one that is used when some DHCP option that the
- DHCP client has sent is being used to identify it.
-
-
- DISCUSSION:
- Implementors should note that the actual identifying data is
- never placed into the DNS directly. Instead, the client-identity
- data is used as the input into a one-way hash algorithm, and the
- output of that hash is then used as DNS RRDATA. This has been
- specified in order to avoid placing data about DHCP clients that
- some sites might consider sensitive into the DNS.
-
- When the updater is using the client's link-layer address, the first
- two bytes of the DHCID RRDATA MUST be zero. To generate the rest of
- the resource record, the updater MUST compute a one-way hash using
- the MD5[13] algorithm across a buffer containing the client's
- network hardware type and link-layer address. Specifically, the
- first byte of the buffer contains the network hardware type as it
- appears in the DHCP htype field of the client's DHCPREQUEST message.
- All of the significant bytes of the chaddr field in the client's
- DHCPREQUEST message follow, in the same order in which the bytes
- appear in the DHCPREQUEST message. The number of significant bytes
- in the chaddr field is specified in the hlen field of the
- DHCPREQUEST message.
-
- When the updater is using a DHCP option sent by the client in its
- DHCPREQUEST message, the first two bytes of the DHCID RR MUST be the
- option code of that option, in network byte order. For example, if
- the DHCP client identifier option is being used, the first byte of
- the DHCID RR should be zero, and the second byte should be 61
- decimal. The rest of the DHCID RR MUST contain the results of
- computing a one-way hash across the payload of the option being
- used, using the MD5 algorithm. The payload of a DHCP option consists
- of the bytes of the option following the option code and length.
-
- In order for independent DHCP implementations to be able to use the
- DHCID RR as a prerequisite in dynamic DNS updates, each updater must
- be able to reliably choose the same identifier that any other would
- choose. To make this possible, we specify a prioritization which
-
-
-Stapp & Rekhter Expires September 2000 [Page 7]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
- will ensure that for any given DHCP client request, any updater will
- select the same client-identity data. All updaters MUST use this
- order of prioritization by default, but all implementations SHOULD
- be configurable to use a different prioritization if so desired by
- the site administrators. Because of the possibility of future
- changes in the DHCP protocol, implementors SHOULD check for updated
- versions of this draft when implementing new DHCP clients and
- servers which can perform DDNS updates, and also when releasing new
- versions of existing clients and servers.
-
- DHCP clients and servers should use the following forms of client
- identification, starting with the most preferable, and finishing
- with the least preferable. If the client does not send any of these
- forms of identification, the DHCP/DDNS interaction is not defined by
- this specification. The most preferable form of identification is
- the Globally Unique Identifier Option [TBD]. Next is the DHCP
- Client Identifier option. Last is the client's link-layer address,
- as conveyed in its DHCPREQUEST message. Implementors should note
- that the link-layer address cannot be used if there are no
- significant bytes in the chaddr field of the DHCP client's request,
- because this does not constitute a unique identifier.
-
-4.4 DNS RR TTLs
-
- RRs associated with DHCP clients may be more volatile than
- statically configured RRs. DHCP clients and servers which perform
- dynamic updates should attempt to specify resource record TTLs which
- reflect this volatility, in order to minimize the possibility that
- there will be stale records in resolvers' caches. A reasonable basis
- for RR TTLs is the lease duration itself: TTLs of 1/2 or 1/3 the
- expected lease duration might be reasonable defaults. Because
- configured DHCP lease times vary widely from site to site, it may
- also be desirable to establish a fixed TTL ceiling. DHCP clients and
- servers MAY allow administrators to configure the TTLs they will
- supply, possibly as a fraction of the actual lease time, or as a
- fixed value.
-
-5. Client FQDN Option
-
- To update the IP address to FQDN mapping a DHCP server needs to know
- the FQDN of the client to which the server leases the address. To
- allow the client to convey its FQDN to the server this document
- defines a new DHCP option, called "Client FQDN". The FQDN Option
- also contains Flags and RCode fields which DHCP servers can use to
- convey information about DNS updates to clients.
-
- Clients MAY send the FQDN option, setting appropriate Flags values,
- in both their DISCOVER and REQUEST messages. If a client sends the
- FQDN option in its DISCOVER message, it MUST send the option in
-
-
-Stapp & Rekhter Expires September 2000 [Page 8]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
- subsequent REQUEST messages.
-
- The code for this option is 81. Its minimum length is 4.
-
-
- Code Len Flags RCODE1 RCODE2 Domain Name
- +------+------+------+------+------+------+--
- | 81 | n | | | | ...
- +------+------+------+------+------+------+--
-
-
-5.1 The Flags Field
-
-
- 0 1 2 3 4 5 6 7
- +-+-+-+-+-+-+-+-+
- | MBZ |E|O|S|
- +-+-+-+-+-+-+-+-+
-
-
- When a DHCP client sends the FQDN option in its DHCPDISCOVER and/or
- DHCPREQUEST messages, it sets the right-most bit (labelled "S") to
- indicate that it will not perform any Dynamic DNS updates, and that
- it expects the DHCP server to perform any FQDN-to-IP (the A RR) DNS
- update on its behalf. If this bit is clear, the client indicates
- that it intends to maintain its own FQDN-to-IP mapping update.
-
- If a DHCP server intends to take responsibility for the A RR update
- whether or not the client sending the FQDN option has set the "S"
- bit, it sets both the "O" bit and the "S" bit, and sends the FQDN
- option in its DHCPOFFER and/or DHCPACK messages.
-
- The data in the Domain Name field may appear in one of two formats:
- ASCII, or DNS-style binary encoding (without compression, of
- course), as described in RFC1035[2]. A client which sends the FQDN
- option MUST set the "E" bit to indicate that the data in the Domain
- Name field is DNS binary encoded. If a server receives an FQDN
- option from a client, and intends to include an FQDN option in its
- reply, it MUST use the same encoding that the client used. The DNS
- encoding is recommended. The use of ASCII-encoded domain-names is
- fragile, and the use of ASCII encoding in this option should be
- considered deprecated.
-
- The remaining bits in the Flags field are reserved for future
- assignment. DHCP clients and servers which send the FQDN option MUST
- set the MBZ bits to 0, and they MUST ignore values in the part of
- the field labelled "MBZ".
-
-
-
-
-Stapp & Rekhter Expires September 2000 [Page 9]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
-5.2 The RCODE Fields
-
- The RCODE1 and RCODE2 fields are used by a DHCP server to indicate
- to a DHCP client the Response Code from any A or PTR RR Dynamic DNS
- Updates it has performed. The server may also use these fields to
- indicate whether it has attempted such an update before sending the
- DHCPACK message. Each of these fields is one byte long.
-
- Implementors should note that EDNS0 describes a mechanism for
- extending the length of a DNS RCODE to 12 bits. EDNS0 is specified
- in RFC2671[8]. Only the least-significant 8 bits of the RCODE from a
- Dynamic DNS Update will be carried in the Client FQDN DHCP Option.
- This provides enough number space to accomodate the RCODEs defined
- in the Dynamic DNS Update specification.
-
-5.3 The Domain Name Field
-
- The Domain Name part of the option carries all or part of the FQDN
- of a DHCP client. A client may be configured with a fully-qualified
- domain name, or with a partial name that is not fully-qualified. If
- a client knows only part of its name, it MAY send a single label,
- indicating that it knows part of the name but does not necessarily
- know the zone in which the name is to be embedded. The data in the
- Domain Name field may appear in one of two formats: ASCII (with no
- terminating NULL), or DNS encoding as specified in RFC1035[2]. If
- the DHCP client wishes to use DNS encoding, it MUST set the
- third-from-rightmost bit in the Flags field (the "E" bit); if it
- uses ASCII encoding, it MUST clear the "E" bit.
-
- A DHCP client that can only send a single label using ASCII encoding
- includes a series of ASCII characters in the Domain Name field,
- excluding the "." (dot) character. The client SHOULD follow the
- character-set recommendations of RFC1034[1] and RFC1035[2]. A client
- using DNS binary encoding which wants to suggest part of its FQDN
- MAY send a non-terminal sequence of labels in the Domain Name part
- of the option.
-
-6. DHCP Client behavior
-
- The following describes the behavior of a DHCP client that
- implements the Client FQDN option.
-
- If a client that owns/maintains its own FQDN wants to be responsible
- for updating the FQDN to IP address mapping for the FQDN and
- address(es) used by the client, then the client MUST include the
- Client FQDN option in the DHCPREQUEST message originated by the
- client. A DHCP client MAY choose to include the Client FQDN option
- in its DISCOVER messages as well as its REQUEST messages. The
- rightmost ("S") bit in the Flags field in the option MUST be set to
-
-
-Stapp & Rekhter Expires September 2000 [Page 10]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
- 0. Once the client's DHCP configuration is completed (the client
- receives a DHCPACK message, and successfully completes a final check
- on the parameters passed in the message), the client MAY originate
- an update for the A RR (associated with the client's FQDN). The
- update MUST be originated following the procedures described in
- RFC2136[5] and Section 8. If the DHCP server from which the client
- is requesting a lease includes the FQDN option in its ACK message,
- and if the server sets both the "S" and the "O" bits (the two
- rightmost bits) in the option's flags field, the DHCP client MUST
- NOT initiate an update for the name in the Domain Name field.
-
- A client can choose to delegate the responsibility for updating the
- FQDN to IP address mapping for the FQDN and address(es) used by the
- client to the server. In order to inform the server of this choice,
- the client SHOULD include the Client FQDN option in its DHCPREQUEST
- message. The rightmost (or "S") bit in the Flags field in the option
- MUST be set to 1. A client which delegates this responsibility MUST
- NOT attempt to perform a Dynamic DNS update for the name in the
- Domain Name field of the FQDN option. The client MAY supply an FQDN
- in the Client FQDN option, or it MAY supply a single label (the
- most-specific label), or it MAY leave that field empty as a signal
- to the server to generate an FQDN for the client in any manner the
- server chooses.
-
- Since there is a possibility that the DHCP server may be configured
- to complete or replace a domain name that the client was configured
- to send, the client might find it useful to send the FQDN option in
- its DISCOVER messages. If the DHCP server returns different Domain
- Name data in its OFFER message, the client could use that data in
- performing its own eventual A RR update, or in forming the FQDN
- option that it sends in its REQUEST message. There is no requirement
- that the client send identical FQDN option data in its DISCOVER and
- REQUEST messages. In particular, if a client has sent the FQDN
- option to its server, and the configuration of the client changes so
- that its notion of its domain name changes, it MAY send the new name
- data in an FQDN option when it communicates with the server again.
- This may allow the DHCP server to update the name associated with
- the PTR record, and, if the server updated the A record representing
- the client, to delete that record and attempt an update for the
- client's current domain name.
-
- A client that delegates the responsibility for updating the FQDN to
- IP address mapping to a server might not receive any indication
- (either positive or negative) from the server whether the server was
- able to perform the update. In this case the client MAY use a DNS
- query to check whether the mapping is updated.
-
- A client MUST set the RCODE1 and RCODE2 fields in the Client FQDN
- option to 0 when sending the option.
-
-
-Stapp & Rekhter Expires September 2000 [Page 11]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
- If a client releases its lease prior to the lease expiration time
- and the client is responsible for updating its A RR, the client
- SHOULD delete the A RR (following the procedures described in
- Section 8) associated with the leased address before sending a DHCP
- RELEASE message. Similarly, if a client was responsible for updating
- its A RR, but is unable to renew its lease, the client SHOULD
- attempt to delete the A RR before its lease expires. A DHCP client
- which has not been able to delete an A RR which it added (because it
- has lost the use of its DHCP IP address) should attempt to notify
- its administrator.
-
-7. DHCP Server behavior
-
- When a server receives a DHCPREQUEST message from a client, if the
- message contains the Client FQDN option, and the server replies to
- the message with a DHCPACK message, the server may be configured to
- originate an update for the PTR RR (associated with the address
- leased to the client). Any such update MUST be originated following
- the procedures described in Section 8. The server MAY complete the
- update before the server sends the DHCPACK message to the client. In
- this case the RCODE from the update MUST be carried to the client in
- the RCODE1 field of the Client FQDN option in the DHCPACK message.
- Alternatively, the server MAY send the DHCPACK message to the client
- without waiting for the update to be completed. In this case the
- RCODE1 field of the Client FQDN option in the DHCPACK message MUST
- be set to 255. The choice between the two alternatives is entirely
- determined by the configuration of the DHCP server. Servers SHOULD
- support both configuration options.
-
- When a server receives a DHCPREQUEST message containing the Client
- FQDN option, the server MUST ignore the values carried in the RCODE1
- and RCODE2 fields of the option.
-
- In addition, if the Client FQDN option carried in the DHCPREQUEST
- message has the "S" bit in its Flags field set, then the server MAY
- originate an update for the A RR (associated with the FQDN carried
- in the option) if it is configured to do so by the site's
- administrator, and if it has the necessary credentials. The server
- MAY be configured to use the name supplied in the client's FQDN
- option, or it MAY be configured to modify the supplied name, or
- substitute a different name.
-
- Any such update MUST be originated following the procedures
- described in Section 8. The server MAY originate the update before
- the server sends the DHCPACK message to the client. In this case the
- RCODE from the update [RFC2136] MUST be carried to the client in the
- RCODE2 field of the Client FQDN option in the DHCPACK message.
- Alternatively the server MAY send the DHCPACK message to the client
- without waiting for the update to be completed. In this case the
-
-
-Stapp & Rekhter Expires September 2000 [Page 12]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
- RCODE2 field of the Client FQDN option in the DHCPACK message MUST
- be set to 255. The choice between the two alternatives is entirely
- up to the DHCP server. In either case, if the server intends to
- perform the DNS update and the client's REQUEST message included the
- FQDN option, the server SHOULD include the FQDN option in its ACK
- message, and MUST set the "S" bit in the option's Flags field.
-
- Even if the Client FQDN option carried in the DHCPREQUEST message
- has the "S" bit in its Flags field clear (indicating that the client
- wants to update the A RR), the server MAY be configured by the local
- administrator to update the A RR on the client's behalf. A server
- which is configured to override the client's preference SHOULD
- include an FQDN option in its ACK message, and MUST set both the "O"
- and "S" bits in the FQDN option's Flags field. The update MUST be
- originated following the procedures described in Section 8. The
- server MAY originate the update before the server sends the DHCPACK
- message to the client. In this case the RCODE from the update
- [RFC2136] MUST be carried to the client in the RCODE2 field of the
- Client FQDN option in the DHCPACK message. Alternatively, the server
- MAY send the DHCPACK message to the client without waiting for the
- update to be completed. In this case the RCODE2 field of the Client
- FQDN option in the DHCPACK message MUST be set to 255. Whether the
- DNS update occurs before or after the DHCPACK is sent is entirely up
- to the DHCP server's configuration.
-
- When a DHCP server sends the Client FQDN option to a client in the
- DHCPACK message, the DHCP server SHOULD send its notion of the
- complete FQDN for the client in the Domain Name field. The server
- MAY simply copy the Domain Name field from the Client FQDN option
- that the client sent to the server in the DHCPREQUEST message. The
- DHCP server MAY be configured to complete or modify the domain name
- which a client sent, or it MAY be configured to substitute a
- different name. If the server initiates a DDNS update which is not
- complete until after the server has replied to the DHCP client, the
- server's The server MUST use the same encoding format (ASCII or DNS
- binary encoding) that the client used in the FQDN option in its
- DHCPREQUEST, and MUST set the "E" bit in the option's Flags field
- accordingly.
-
- If a client's DHCPREQUEST message doesn't carry the Client FQDN
- option (e.g., the client doesn't implement the Client FQDN option),
- the server MAY be configured to update either or both of the A and
- PTR RRs. The updates MUST be originated following the procedures
- described in Section 8.
-
- If a server detects that a lease on an address that the server
- leases to a client has expired, the server SHOULD delete any PTR RR
- which it added via dynamic update. In addition, if the server added
- an A RR on the client's behalf, the server SHOULD also delete the A
-
-
-Stapp & Rekhter Expires September 2000 [Page 13]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
- RR. The deletion MUST follow the procedures described in Section 8.
-
- If a server terminates a lease on an address prior to the lease's
- expiration time, for instance by sending a DHCPNAK to a client, the
- server SHOULD delete any PTR RR which it associated with the address
- via DNS Dynamic Update. In addition, if the server took
- responsibility for an A RR, the server SHOULD also delete that A RR.
- The deletion MUST follow the procedures described in Section 8.
-
-8. Procedures for performing DNS updates
-
-8.1 Adding A RRs to DNS
-
- When a DHCP client or server intends to update an A RR, it first
- prepares a DNS UPDATE query which includes as a prerequisite the
- assertion that the name does not exist. The update section of the
- query attempts to add the new name and its IP address mapping (an A
- RR), and the DHCID RR with its unique client-identity.
-
- If this update operation succeeds, the updater can conclude that it
- has added a new name whose only RRs are the A and DHCID RR records.
- The A RR update is now complete (and a client updater is finished,
- while a server might proceed to perform a PTR RR update).
-
- If the first update operation fails with YXDOMAIN, the updater can
- conclude that the intended name is in use. The updater then
- attempts to confirm that the DNS name is not being used by some
- other host. The updater prepares a second UPDATE query in which the
- prerequisite is that the desired name has attached to it a DHCID RR
- whose contents match the client identity. The update section of
- this query deletes the existing A records on the name, and adds the
- A record that matches the DHCP binding and the DHCID RR with the
- client identity.
-
- If this query succeeds, the updater can conclude that the current
- client was the last client associated with the domain name, and that
- the name now contains the updated A RR. The A RR update is now
- complete (and a client updater is finished, while a server would
- then proceed to perform a PTR RR update).
-
- If the second query fails with NXRRSET, the updater must conclude
- that the client's desired name is in use by another host. At this
- juncture, the updater can decide (based on some administrative
- configuration outside of the scope of this document) whether to let
- the existing owner of the name keep that name, and to (possibly)
- perform some name disambiguation operation on behalf of the current
- client, or to replace the RRs on the name with RRs that represent
- the current client. If the configured policy allows replacement of
- existing records, the updater submits a query that deletes the
-
-
-Stapp & Rekhter Expires September 2000 [Page 14]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
- existing A RR and the existing DHCID RR, adding A and DHCID RRs that
- represent the IP address and client-identity of the new client.
-
-
- DISCUSSION:
- The updating entity may be configured to allow the existing DNS
- records on the domain name to remain unchanged, and to perform
- disambiguation on the name of the current client in order to
- attempt to generate a similar but unique name for the current
- client. In this case, once another candidate name has been
- generated, the updater should restart the process of adding an A
- RR as specified in this section.
-
-8.2 Adding PTR RR Entries to DNS
-
- The DHCP server submits a DNS query which deletes all of the PTR RRs
- associated with the lease IP address, and adds a PTR RR whose data
- is the client's (possibly disambiguated) host name. The server also
- adds a DHCID RR specified in Section 4.3.
-
-8.3 Removing Entries from DNS
-
- The most important consideration in removing DNS entries is be sure
- that an entity removing a DNS entry is only removing an entry that
- it added, or for which an administrator has explicitly assigned it
- responsibility.
-
- When a lease expires or a DHCP client issues a DHCPRELEASE request,
- the DHCP server SHOULD delete the PTR RR that matches the DHCP
- binding, if one was successfully added. The server's update query
- SHOULD assert that the name in the PTR record matches the name of
- the client whose lease has expired or been released.
-
- The entity chosen to handle the A record for this client (either the
- client or the server) SHOULD delete the A record that was added when
- the lease was made to the client.
-
- In order to perform this delete, the updater prepares an UPDATE
- query which contains two prerequisites. The first prerequisite
- asserts that the DHCID RR exists whose data is the client identity
- described in Section 4.3. The second prerequisite asserts that the
- data in the A RR contains the IP address of the lease that has
- expired or been released.
-
- If the query fails, the updater MUST NOT delete the DNS name. It
- may be that the host whose lease on the server has expired has moved
- to another network and obtained a lease from a different server,
- which has caused the client's A RR to be replaced. It may also be
- that some other client has been configured with a name that matches
- the name of the DHCP client, and the policy was that the last client
-
-
-Stapp & Rekhter Expires September 2000 [Page 15]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
- to specify the name would get the name. In this case, the DHCID RR
- will no longer match the updater's notion of the client-identity of
- the host pointed to by the DNS name.
-
-8.4 Updating other RRs
-
- The procedures described in this document only cover updates to the
- A and PTR RRs. Updating other types of RRs is outside the scope of
- this document.
-
-9. Security Considerations
-
- Unauthenticated updates to the DNS can lead to tremendous confusion,
- through malicious attack or through inadvertent misconfiguration.
- Administrators should be wary of permitting unsecured DNS updates to
- zones which are exposed to the global Internet. Both DHCP clients
- and servers SHOULD use some form of update request origin
- authentication procedure (e.g., Simple Secure DNS Update[11]) when
- performing DNS updates.
-
- Whether a DHCP client may be responsible for updating an FQDN to IP
- address mapping, or whether this is the responsibility of the DHCP
- server is a site-local matter. The choice between the two
- alternatives may be based on the security model that is used with
- the Dynamic DNS Update protocol (e.g., only a client may have
- sufficient credentials to perform updates to the FQDN to IP address
- mapping for its FQDN).
-
- Whether a DHCP server is always responsible for updating the FQDN to
- IP address mapping (in addition to updating the IP to FQDN mapping),
- regardless of the wishes of an individual DHCP client, is also a
- site-local matter. The choice between the two alternatives may be
- based on the security model that is being used with dynamic DNS
- updates. In cases where a DHCP server is performing DNS updates on
- behalf of a client, the DHCP server should be sure of the DNS name
- to use for the client, and of the identity of the client.
-
- Currently, it is difficult for DHCP servers to develop much
- confidence in the identities of its clients, given the absence of
- entity authentication from the DHCP protocol itself. There are many
- ways for a DHCP server to develop a DNS name to use for a client,
- but only in certain relatively unusual circumstances will the DHCP
- server know for certain the identity of the client. If DHCP
- Authentication[10] becomes widely deployed this may become more
- customary.
-
- One example of a situation which offers some extra assurances is one
- where the DHCP client is connected to a network through an MCNS
- cable modem, and the CMTS (head-end) of the cable modem ensures that
-
-
-Stapp & Rekhter Expires September 2000 [Page 16]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
- MAC address spoofing simply does not occur. Another example of a
- configuration that might be trusted is one where clients obtain
- network access via a network access server using PPP. The NAS itself
- might be obtaining IP addresses via DHCP, encoding a client
- identification into the DHCP client-id option. In this case, the
- network access server as well as the DHCP server might be operating
- within a trusted environment, in which case the DHCP server could be
- configured to trust that the user authentication and authorization
- procedure of the remote access server was sufficient, and would
- therefore trust the client identification encoded within the DHCP
- client-id.
-
-10. Acknowledgements
-
- Many thanks to Mark Beyer, Jim Bound, Ralph Droms, Robert Elz, Peter
- Ford, Edie Gunter, Andreas Gustafsson, R. Barr Hibbs, Kim Kinnear,
- Stuart Kwan, Ted Lemon, Ed Lewis, Michael Lewis, Josh Littlefield,
- Michael Patton, and Glenn Stump for their review and comments.
-
-References
-
- [1] Mockapetris, P., "Domain names - Concepts and Facilities", RFC
- 1034, Nov 1987.
-
- [2] Mockapetris, P., "Domain names - Implementation and
- Specification", RFC 1035, Nov 1987.
-
- [3] Droms, R., "Dynamic Host Configuration Protocol", RFC 2131,
- March 1997.
-
- [4] Marine, A., Reynolds, J. and G. Malkin, "FYI on Questions and
- Answers to Commonly asked ``New Internet User'' Questions", RFC
- 1594, March 1994.
-
- [5] Vixie, P., Thomson, S., Rekhter, Y. and J. Bound, "Dynamic
- Updates in the Domain Name System", RFC 2136, April 1997.
-
- [6] Bradner, S., "Key words for use in RFCs to Indicate Requirement
- Levels", RFC 2119, March 1997.
-
- [7] Eastlake, D., "Domain Name System Security Extensions", RFC
- 2535, March 1999.
-
- [8] Vixie, P., "Extension Mechanisms for DNS (EDNS0)", RFC 2671,
- August 1999.
-
- [9] Vixie, P., Gudmundsson, O., Eastlake, D. and B. Wellington,
- "Secret Key Transaction Authentication for DNS (TSIG)
- (draft-ietf-dnsext-tsig-*)", July 1999.
-
-
-Stapp & Rekhter Expires September 2000 [Page 17]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
- [10] Droms, R. and W. Arbaugh, "Authentication for DHCP Messages
- (draft-ietf-dhc-authentication-*)", June 1999.
-
- [11] Wellington, B., "Simple Secure DNS Dynamic Updates
- (draft-ietf-dnsext-simple-secure-update-*)", June 1999.
-
- [12] Gustafsson, A., "A DNS RR for encoding DHCP client identity
- (draft-ietf-dnsext-dhcid-rr-*)", October 1999.
-
- [13] Rivest, R., "The MD5 Message Digest Algorithm", RFC 1321,
- April 1992.
-
-Authors' Addresses
-
- Mark Stapp
- Cisco Systems, Inc.
- 250 Apollo Dr.
- Chelmsford, MA 01824
- US
-
- Phone: 978.244.8498
- EMail: mjs@cisco.com
-
- Yakov Rekhter
- Cisco Systems, Inc.
- 170 Tasman Dr.
- San Jose, CA 95134
- US
-
- Phone: 914.235.2128
- EMail: yakov@cisco.com
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Stapp & Rekhter Expires September 2000 [Page 18]
-
-Internet-Draft Interaction between DHCP and DNS March 2000
-
-
-Full Copyright Statement
-
- Copyright (C) The Internet Society (2000). All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implmentation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph
- are included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-Acknowledgement
-
- Funding for the RFC editor function is currently provided by the
- Internet Society.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Stapp & Rekhter Expires September 2000 [Page 19]
-
diff --git a/doc/draft/draft-ietf-dhc-dhcp-dns-13.txt b/doc/draft/draft-ietf-dhc-dhcp-dns-13.txt
new file mode 100644
index 00000000..c15c2cd1
--- /dev/null
+++ b/doc/draft/draft-ietf-dhc-dhcp-dns-13.txt
@@ -0,0 +1,20 @@
+
+This Internet-Draft has been deleted. Unrevised documents placed in the
+Internet-Drafts directories have a maximum life of six months. After
+that time, they are deleted. This Internet-Draft was not published as
+an RFC.
+
+Internet-Drafts are not an archival document series, and expired
+drafts, such as this one, are not available; please do not ask for
+copies... they are not available. The Secretariat does not have
+information as to future plans of the authors or working groups WRT the
+deleted Internet-Draft.
+
+For more information or a copy of the document, contact the author directly.
+
+Draft Author(s):
+
+Y. Rekhter: yakov@cisco.com
+M. Stapp: mark@american.com
+
+
diff --git a/doc/draft/draft-ietf-dnsext-dhcid-rr-00.txt b/doc/draft/draft-ietf-dnsext-dhcid-rr-00.txt
deleted file mode 100644
index b6386e27..00000000
--- a/doc/draft/draft-ietf-dnsext-dhcid-rr-00.txt
+++ /dev/null
@@ -1,336 +0,0 @@
-Network Working Group A. Gustafsson
-Internet-Draft T. Lemon
-Expires: January 12, 2001 Nominum, Inc.
- M. Stapp
- Cisco Systems, Inc.
- July 14, 2000
-
-
- A DNS RR for encoding DHCP information
- <draft-ietf-dnsext-dhcid-rr-00.txt>
-
-Status of this Memo
-
- This document is an Internet-Draft and is in full conformance with
- all provisions of Section 10 of RFC2026.
-
- Internet-Drafts are working documents of the Internet Engineering
- Task Force (IETF), its areas, and its working groups. Note that
- other groups may also distribute working documents as
- Internet-Drafts.
-
- Internet-Drafts are draft documents valid for a maximum of six
- months and may be updated, replaced, or obsoleted by other documents
- at any time. It is inappropriate to use Internet-Drafts as reference
- material or to cite them other than as "work in progress."
-
- The list of current Internet-Drafts can be accessed at
- http://www.ietf.org/ietf/1id-abstracts.txt.
-
- The list of Internet-Draft Shadow Directories can be accessed at
- http://www.ietf.org/shadow.html.
-
- This Internet-Draft will expire on January 12, 2001.
-
-Copyright Notice
-
- Copyright (C) The Internet Society (2000). All Rights Reserved.
-
-Abstract
-
- A situation can arise where multiple DHCP clients request the same
- DNS name from their (possibly distinct) DHCP servers. To resolve
- such conflicts, 'Resolution of DNS Name Conflicts'[7] proposes
- storing client identifiers in the DNS to unambiguously associate
- domain names with the DHCP clients "owning" them. This memo defines
- a distinct RR type for use by DHCP servers, the "DHCID" RR.
-
-
-
-
-
-
-Gustafsson, et. al. Expires January 12, 2001 [Page 1]
-
-Internet-Draft A DNS RR for encoding DHCP information July 2000
-
-
-Table of Contents
-
- 1. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3
- 2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3
- 3. The DHCID RR . . . . . . . . . . . . . . . . . . . . . . . . . 3
- 4. DHCID RDATA format . . . . . . . . . . . . . . . . . . . . . . 3
- 4.1 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
- 5. Security Considerations . . . . . . . . . . . . . . . . . . . 4
- 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 4
- References . . . . . . . . . . . . . . . . . . . . . . . . . . 4
- Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . 5
- Full Copyright Statement . . . . . . . . . . . . . . . . . . . 6
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Gustafsson, et. al. Expires January 12, 2001 [Page 2]
-
-Internet-Draft A DNS RR for encoding DHCP information July 2000
-
-
-1. Terminology
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
- document are to be interpreted as described in RFC 2119[1].
-
-2. Introduction
-
- A set of procedures to allow DHCP [RFC2131] clients and servers to
- automatically update the DNS (RFC1034[2], RFC1035[3]) is proposed in
- Resolution of DNS Name Conflicts[7].
-
- A situation can arise where multiple DHCP clients wish to use the
- same DNS name. To resolve such conflicts, Resolution of DNS Name
- Conflicts[7] proposes storing client identifiers in the DNS to
- unambiguously associate domain names with the DHCP clients using
- them. In the interest of clarity, it would be preferable for this
- DHCP information to use a distinct RR type.
-
- This memo defines a distinct RR type for this purpose for use by
- DHCP clients or servers, the "DHCID" RR.
-
-3. The DHCID RR
-
- The DHCP RR is defined with mnemonic DHCID and type code [TBD].
-
-4. DHCID RDATA format
-
- The RDATA section of a DHCID RR in transmission contains RDLENGTH
- bytes of binary data. The format of this data and its
- interpretation by DHCP servers and clients are described below.
-
- DNS software should consider the RDATA section to be opaque. In DNS
- master files, the RDATA is represented as a hexadecimal string with
- an optional "0x" or "0X" prefix. Periods (".") may be inserted
- anywhere after the "0x" for readability. This format is identical
- to that of the NSAP RR (RFC1706[4]). The number of hexadecimal
- digits MUST be even.
-
- DHCP clients or servers use the DHCID RR to associate a DHCP
- client's identity with a DNS name, so that multiple DHCP clients and
- servers may safely perform dynamic DNS updates to the same zone.
- From the updater's perspective, the DHCID resource record consists
- of a 16-bit identifier type, followed by one or more bytes
- representing the actual identifier. There are two possible forms
- for a DHCID RR - one that is used when the DHCP server is using the
- client's link-layer address to identify it, and one that is used
- when the DHCP server is using some DHCP option that the DHCP client
- sent to identify it. When the link-layer address is used as the
-
-
-Gustafsson, et. al. Expires January 12, 2001 [Page 3]
-
-Internet-Draft A DNS RR for encoding DHCP information July 2000
-
-
- identifier, the first two bytes of the RRDATA are set to 0. When a
- DHCP option is used as the identifier, the first two bytes of the
- RRDATA contain the option number, in network byte order. The two
- bytes 0xffff are reserved. In both cases, the remainder of the
- RRDATA is the result of performing a one-way hash across the
- identifier.
-
- The details of the method used to generate the data in the RR and
- the use to which a DHCP client or server may put this association
- are beyond the scope of this draft, and are discussed in the draft
- that specifies the DNS update behavior, 'Resolution of DNS Name
- Conflicts'[7]. This RR MUST NOT be used for any purpose other than
- that detailed in the DHC document. Althought this RR contains data
- that is opaque to DNS servers, the data is meaningful to DHCP
- updaters. Therefore, new data formats may only be defined through
- actions of the DHC Working Group.
-
-4.1 Example
-
- A DHCP server allocating the IPv4 address 10.0.0.1 to a client
- "client.org.nil" might use the client's link-layer address to
- identify the client:
-
- client.org.nil. A 10.0.0.1
- client.org.nil. DHCID
-00.00.18.29.11.17.22.0a.ad.c1.88.10.a3.dd.ff.c8.d9.49
-
- A DHCP server allocating the IPv4 address 10.0.12.99 to a client
- "chi.org.nil" might use the DHCP client identifier option to
- identify the client:
-
- chi.org.nil. A 10.0.12.99
- chi.org.nil. DHCID 00.61.92.71.22.da.01.88.dd.3a.11.8c.1c.a0.ff.94.9d.81
-
-5. Security Considerations
-
- The DHCID record as such does not introduce any new security
- problems into the DNS. In order to avoid exposing private
- information about DHCP clients to public scrutiny, a one-way-hash is
- used to obscure all client information.
-
-6. IANA Considerations
-
- The IANA is requested to allocate an RR type number for the DHCP
- record type.
-
-References
-
- [1] Bradner, S., "Key words for use in RFCs to Indicate Requirement
- Levels", RFC 2119, March 1997.
-
-
-Gustafsson, et. al. Expires January 12, 2001 [Page 4]
-
-Internet-Draft A DNS RR for encoding DHCP information July 2000
-
-
- [2] Mockapetris, P., "Domain names - Concepts and Facilities", RFC
- 1034, Nov 1987.
-
- [3] Mockapetris, P., "Domain names - Implementation and
- Specification", RFC 1035, Nov 1987.
-
- [4] Manning, B. and R. Colella, "DNS NSAP Resource Records", RFC
- 1706, Oct 1994.
-
- [5] Droms, R., "Dynamic Host Configuration Protocol", RFC 2131, Mar
- 1997.
-
- [6] Alexander, S. and R. Droms, "DHCP Options and BOOTP Vendor
- Extensions", RFC 2132, Mar 1997.
-
- [7] Stapp, M., "Resolution of DNS Name Conflicts Among DHCP Clients
- (draft-ietf-dhc-dns-resolution-*)", July 2000.
-
-
-Authors' Addresses
-
- Andreas Gustafsson
- Nominum, Inc.
- 950 Charter St.
- Redwood City, CA 94063
- USA
-
- EMail: gson@nominum.com
-
-
- Ted Lemon
- Nominum, Inc.
- 950 Charter St.
- Redwood City, CA 94063
- USA
-
- EMail: mellon@nominum.com
-
-
- Mark Stapp
- Cisco Systems, Inc.
- 250 Apollo Dr.
- Chelmsford, MA 01824
- USA
-
- Phone: 978.244.8498
- EMail: mjs@cisco.com
-
-
-
-
-Gustafsson, et. al. Expires January 12, 2001 [Page 5]
-
-Internet-Draft A DNS RR for encoding DHCP information July 2000
-
-
-Full Copyright Statement
-
- Copyright (C) The Internet Society (2000). All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph
- are included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-Acknowledgement
-
- Funding for the RFC editor function is currently provided by the
- Internet Society.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Gustafsson, et. al. Expires January 12, 2001 [Page 6]
-
-
diff --git a/doc/draft/draft-ietf-dnsext-dhcid-rr-01.txt b/doc/draft/draft-ietf-dnsext-dhcid-rr-01.txt
new file mode 100644
index 00000000..cba30f45
--- /dev/null
+++ b/doc/draft/draft-ietf-dnsext-dhcid-rr-01.txt
@@ -0,0 +1,448 @@
+
+
+Network Working Group M. Stapp
+Internet-Draft Cisco Systems, Inc.
+Expires: June 1, 2001 T. Lemon
+ A. Gustafsson
+ Nominum, Inc.
+ December 2000
+
+
+ A DNS RR for Encoding DHCP Information
+ <draft-ietf-dnsext-dhcid-rr-01.txt>
+
+Status of this Memo
+
+ This document is an Internet-Draft and is in full conformance with
+ all provisions of Section 10 of RFC2026.
+
+ Internet-Drafts are working documents of the Internet Engineering
+ Task Force (IETF), its areas, and its working groups. Note that
+ other groups may also distribute working documents as
+ Internet-Drafts.
+
+ Internet-Drafts are draft documents valid for a maximum of six
+ months and may be updated, replaced, or obsoleted by other documents
+ at any time. It is inappropriate to use Internet-Drafts as reference
+ material or to cite them other than as "work in progress."
+
+ The list of current Internet-Drafts can be accessed at
+ http://www.ietf.org/ietf/1id-abstracts.txt.
+
+ The list of Internet-Draft Shadow Directories can be accessed at
+ http://www.ietf.org/shadow.html.
+
+ This Internet-Draft will expire on June 1, 2001.
+
+Copyright Notice
+
+ Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+Abstract
+
+ A situation can arise where multiple DHCP clients request the same
+ DNS name from their (possibly distinct) DHCP servers. To resolve
+ such conflicts, 'Resolution of DNS Name Conflicts'[5] proposes
+ storing client identifiers in the DNS to unambiguously associate
+ domain names with the DHCP clients "owning" them. This memo defines
+ a distinct RR type for use by DHCP servers, the "DHCID" RR.
+
+
+
+
+
+
+Stapp, et. al. Expires June 1, 2001 [Page 1]
+
+Internet-Draft A DNS RR for Encoding DHCP Information December 2000
+
+
+Table of Contents
+
+ 1. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3
+ 2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3
+ 3. The DHCID RR . . . . . . . . . . . . . . . . . . . . . . . . . 3
+ 4. DHCID RDATA format . . . . . . . . . . . . . . . . . . . . . . 3
+ 4.1 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
+ 5. Security Considerations . . . . . . . . . . . . . . . . . . . 4
+ 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 4
+ 7. Appendix A: Base 64 Encoding . . . . . . . . . . . . . . . . . 4
+ References . . . . . . . . . . . . . . . . . . . . . . . . . . 6
+ Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . 6
+ Full Copyright Statement . . . . . . . . . . . . . . . . . . . 8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Stapp, et. al. Expires June 1, 2001 [Page 2]
+
+Internet-Draft A DNS RR for Encoding DHCP Information December 2000
+
+
+1. Terminology
+
+ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
+ "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
+ document are to be interpreted as described in RFC 2119[1].
+
+2. Introduction
+
+ A set of procedures to allow DHCP[2] clients and servers to
+ automatically update the DNS (RFC1034[3], RFC1035[4]) is proposed in
+ "Resolution of DNS Name Conflicts"[5].
+
+ A situation can arise where multiple DHCP clients wish to use the
+ same DNS name. To resolve such conflicts, Resolution of DNS Name
+ Conflicts[5] proposes storing client identifiers in the DNS to
+ unambiguously associate domain names with the DHCP clients using
+ them. In the interest of clarity, it would be preferable for this
+ DHCP information to use a distinct RR type.
+
+ This memo defines a distinct RR type for this purpose for use by
+ DHCP clients or servers, the "DHCID" RR.
+
+3. The DHCID RR
+
+ The DHCID RR is defined with mnemonic DHCID and type code [TBD].
+
+4. DHCID RDATA format
+
+ The RDATA section of a DHCID RR in transmission contains RDLENGTH
+ bytes of binary data. The format of this data and its
+ interpretation by DHCP servers and clients are described below.
+
+ DNS software should consider the RDATA section to be opaque. In DNS
+ master files, the RDATA is represented in base 64 (see Appendix A)
+ and may be divided up into any number of white space separated
+ substrings, down to single base 64 digits, which are concatenated to
+ obtain the full signature. These substrings can span lines using
+ the standard parenthesis. This format is identical to that used for
+ representing binary data in DNSSEC (RFC2535[6]).
+
+ DHCP clients or servers use the DHCID RR to associate a DHCP
+ client's identity with a DNS name, so that multiple DHCP clients and
+ servers may safely perform dynamic DNS updates to the same zone.
+ From the updater's perspective, the DHCID resource record consists
+ of a 16-bit identifier type, followed by one or more bytes
+ representing the actual identifier. There are two possible forms
+ for a DHCID RR - one that is used when the DHCP server is using the
+ client's link-layer address to identify it, and one that is used
+ when the DHCP server is using some DHCP option that the DHCP client
+
+
+Stapp, et. al. Expires June 1, 2001 [Page 3]
+
+Internet-Draft A DNS RR for Encoding DHCP Information December 2000
+
+
+ sent to identify it. When the link-layer address is used as the
+ identifier, the first two bytes of the RRDATA are set to 0. When a
+ DHCP option is used as the identifier, the first two bytes of the
+ RRDATA contain the option number, in network byte order. The two
+ bytes 0xffff are reserved for future extensibility. In both cases,
+ the remainder of the RRDATA is the result of performing a one-way
+ hash across the identifier.
+
+ The details of the method used to generate the data in the RR and
+ the use to which a DHCP client or server may put this association
+ are beyond the scope of this draft, and are discussed in the
+ specification of the DNS update behavior, 'Resolution of DNS Name
+ Conflicts'[5]. This RR MUST NOT be used for any purpose other than
+ that detailed in the DHC document. Althought this RR contains data
+ that is opaque to DNS servers, the data is meaningful to DHCP
+ updaters. Therefore, new data formats may only be defined through
+ actions of the DHC Working Group.
+
+4.1 Example
+
+ A DHCP server allocating the IPv4 address 10.0.0.1 to a client
+ "client.org.nil" might use the client's link-layer address to
+ identify the client:
+
+ client.org.nil. A 10.0.0.1
+ client.org.nil. DHCID AAAY KREX Igqt wYgQ o93/ yNlJ
+
+ A DHCP server allocating the IPv4 address 10.0.12.99 to a client
+ "chi.org.nil" might use the DHCP client identifier option to
+ identify the client:
+
+ chi.org.nil. A 10.0.12.99
+ chi.org.nil. DHCID AGGS cSLa AYjd OhGM HKD/ lJ2B
+
+5. Security Considerations
+
+ The DHCID record as such does not introduce any new security
+ problems into the DNS. In order to avoid exposing private
+ information about DHCP clients to public scrutiny, a one-way-hash is
+ used to obscure all client information.
+
+6. IANA Considerations
+
+ IANA is requested to allocate an RR type number for the DHCID record
+ type.
+
+7. Appendix A: Base 64 Encoding
+
+ The following encoding technique is taken from RFC 2045[7] by N.
+
+
+Stapp, et. al. Expires June 1, 2001 [Page 4]
+
+Internet-Draft A DNS RR for Encoding DHCP Information December 2000
+
+
+ Borenstein and N. Freed. It is reproduced here in an edited form
+ for convenience.
+
+ A 65-character subset of US-ASCII is used, enabling 6 bits to be
+ represented per printable character. (The extra 65th character, "=",
+ is used to signify a special processing function.)
+
+ 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 base
+ 64 alphabet.
+
+ Each 6-bit group is used as an index into an array of 64 printable
+ characters. The character referenced by the index is placed in the
+ output string.
+
+ The Base 64 Alphabet
+
+ Value Encoding Value Encoding Value Encoding Value Encoding
+ 0 A 17 R 34 i 51 z
+ 1 B 18 S 35 j 52 0
+ 2 C 19 T 36 k 53 1
+ 3 D 20 U 37 l 54 2
+ 4 E 21 V 38 m 55 3
+ 5 F 22 W 39 n 56 4
+ 6 G 23 X 40 o 57 5
+ 7 H 24 Y 41 p 58 6
+ 8 I 25 Z 42 q 59 7
+ 9 J 26 a 43 r 60 8
+ 10 K 27 b 44 s 61 9
+ 11 L 28 c 45 t 62 +
+ 12 M 29 d 46 u 63 /
+ 13 N 30 e 47 v
+ 14 O 31 f 48 w (pad) =
+ 15 P 32 g 49 x
+ 16 Q 33 h 50 y
+
+
+ Special processing is performed if fewer than 24 bits are available
+ at the end of the data being encoded. A full encoding quantum is
+ always completed at the end of a quantity. When fewer than 24 input
+ bits are available in an input group, zero bits are added (on the
+ right) to form an integral number of 6-bit groups. Padding at the
+ end of the data is performed using the '=' character. Since all
+ base 64 input is an integral number of octets, only the following
+ cases can arise: (1) the final quantum of encoding input is an
+ integral multiple of 24 bits; here, the final unit of encoded output
+
+
+Stapp, et. al. Expires June 1, 2001 [Page 5]
+
+Internet-Draft A DNS RR for Encoding DHCP Information December 2000
+
+
+ will be an integral multiple of 4 characters with no "=" padding,
+ (2) the final quantum of encoding input is exactly 8 bits; here, the
+ final unit of encoded output will be two characters followed by two
+ "=" padding characters, or (3) the final quantum of encoding input
+ is exactly 16 bits; here, the final unit of encoded output will be
+ three characters followed by one "=" padding character.
+
+References
+
+ [1] Bradner, S., "Key words for use in RFCs to Indicate Requirement
+ Levels", RFC 2119, March 1997.
+
+ [2] Droms, R., "Dynamic Host Configuration Protocol", RFC 2131, Mar
+ 1997.
+
+ [3] Mockapetris, P., "Domain names - Concepts and Facilities", RFC
+ 1034, Nov 1987.
+
+ [4] Mockapetris, P., "Domain names - Implementation and
+ Specification", RFC 1035, Nov 1987.
+
+ [5] Stapp, M., "Resolution of DNS Name Conflicts Among DHCP Clients
+ (draft-ietf-dhc-dns-resolution-*)", July 2000.
+
+ [6] Eastlake, D., "Domain Name System Security Extensions", RFC
+ 2535, March 1999.
+
+ [7] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
+ Extensions (MIME) Part One: Format of Internet Message Bodies",
+ RFC 2045, November 1996.
+
+
+Authors' Addresses
+
+ Mark Stapp
+ Cisco Systems, Inc.
+ 250 Apollo Dr.
+ Chelmsford, MA 01824
+ USA
+
+ Phone: 978.244.8498
+ EMail: mjs@cisco.com
+
+
+
+
+
+
+
+
+
+Stapp, et. al. Expires June 1, 2001 [Page 6]
+
+Internet-Draft A DNS RR for Encoding DHCP Information December 2000
+
+
+ Ted Lemon
+ Nominum, Inc.
+ 950 Charter St.
+ Redwood City, CA 94063
+ USA
+
+ EMail: mellon@nominum.com
+
+
+ Andreas Gustafsson
+ Nominum, Inc.
+ 950 Charter St.
+ Redwood City, CA 94063
+ USA
+
+ EMail: gson@nominum.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Stapp, et. al. Expires June 1, 2001 [Page 7]
+
+Internet-Draft A DNS RR for Encoding DHCP Information December 2000
+
+
+Full Copyright Statement
+
+ Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+ This document and translations of it may be copied and furnished to
+ others, and derivative works that comment on or otherwise explain it
+ or assist in its implementation may be prepared, copied, published
+ and distributed, in whole or in part, without restriction of any
+ kind, provided that the above copyright notice and this paragraph
+ are included on all such copies and derivative works. However, this
+ document itself may not be modified in any way, such as by removing
+ the copyright notice or references to the Internet Society or other
+ Internet organizations, except as needed for the purpose of
+ developing Internet standards in which case the procedures for
+ copyrights defined in the Internet Standards process must be
+ followed, or as required to translate it into languages other than
+ English.
+
+ The limited permissions granted above are perpetual and will not be
+ revoked by the Internet Society or its successors or assigns.
+
+ This document and the information contained herein is provided on an
+ "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+ TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
+ BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
+ HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+Acknowledgement
+
+ Funding for the RFC editor function is currently provided by the
+ Internet Society.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Stapp, et. al. Expires June 1, 2001 [Page 8]
+
diff --git a/doc/draft/draft-ietf-dnsext-mdns-00.txt b/doc/draft/draft-ietf-dnsext-mdns-00.txt
new file mode 100644
index 00000000..1458fa68
--- /dev/null
+++ b/doc/draft/draft-ietf-dnsext-mdns-00.txt
@@ -0,0 +1,521 @@
+
+
+DNSEXT Working Group Levon Esibov
+INTERNET-DRAFT Bernard Aboba
+Category: Standards Track Dave Thaler
+<draft-ietf-dnsext-mdns-00.txt> Microsoft
+November 16, 2000
+
+
+ Multicast DNS
+
+This document is an Internet-Draft and is in full conformance with all
+provisions of Section 10 of RFC2026.
+
+Internet-Drafts are working documents of the Internet Engineering Task
+Force (IETF), its areas, and its working groups. Note that other groups
+may also distribute working documents as Internet- Drafts.
+
+Internet-Drafts are draft documents valid for a maximum of six months
+and may be updated, replaced, or obsoleted by other documents at any
+time. It is inappropriate to use Internet-Drafts as reference material
+or to cite them other than as "work in progress."
+
+The list of current Internet-Drafts can be accessed at
+http://www.ietf.org/ietf/1id-abstracts.txt
+
+The list of Internet-Draft Shadow Directories can be accessed at
+http://www.ietf.org/shadow.html.
+
+Copyright Notice
+
+Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+Abstract
+
+Today, with the rise of home networking, there are an increasing number
+of small networks operating without a DNS server. In order to allow DNS
+name resolution in such environments, the use of a multicast DNS is
+proposed.
+
+1. Introduction
+
+Multicast DNS enables DNS name resolution in the scenarios when
+conventional DNS name resolution is not possible. Namely, when there are
+no DNS servers available on the network or available DNS servers do not
+provide name resolution for the names of the hosts on the local
+network. The latter case, for example, corresponds to a scenario when a
+home network that doesn't have a DNS server is connected to the Internet
+through an ISP and the home network hosts are configured with the ISP's
+DNS server for the name resolution. The ISP's DNS server provides the
+name resolution for the names registered on the Internet, but doesn't
+provide name resolution for the names of the hosts on the home network.
+
+
+
+
+Esibov, Aboba & Thaler Standards Track [Page 1]
+
+INTERNET-DRAFT Multicast DNS 16 November 2000
+
+
+This document discusses multicast DNS, an extension to the DNS protocol
+which consists of a single change to the method of use, and no change to
+the format of DNS packets.
+
+Discovery of the services in general as well as discovery of the DNS
+servers in particular using multicast DNS is left outside of the scope
+of this document.
+
+Name resolution over non-multicast capable media is left outside of the
+scope of this document.
+
+In this document, the key words "MAY", "MUST, "MUST NOT", "optional",
+"recommended", "SHOULD", and "SHOULD NOT", are to be interpreted as
+described in [1].
+
+
+2. Name resolution using Multicast DNS
+
+This extension to the DNS protocol consists of a single change to the
+method of use, and no change whatsoever to the current format of DNS
+packets. Namely, this extension allows multicast DNS queries to be sent
+to and received on port 53 using the LINKLOCAL addresses [2] for IPv4
+and IPv6 (below in this text referred as LINKLOCAL address), which are
+yet to be assigned by IANA. LINKLOCAL addresses are used to prevent
+propagation of the multicast DNS traffic across the routers that may
+cause network flooding. Propagation of the multicast DNS packets within
+the boundaries is considered sufficient to enable DNS name resolution,
+since the expectation is that if a network has a router, then this
+router can function as a mini-DHCP server, as described in [3], and a
+DNS proxy, possibly implementing dynamic DNS. Thus there is not expected
+to be a need for use of multicast DNS in networks with multiple
+segments.
+
+2.1 Behavior of the sender and responder
+
+For the purpose of this document a device that sends a multicast query
+is called a "sender", while a device that listens to (but not
+necessarily responds to) a multicast query is called "responder". A
+device configured to be a "responder" may also be a "sender". A device
+configured to not be a "responder" cannot be a "sender".
+
+A sender sends multicast DNS query for any legal Type of resource record
+(e.g. A, PTR, etcà) for a name within the ".local.arpa." domain to the
+LINKLOCAL address. The RD (Recursion Desired) bit MUST NOT be set. If a
+responder receives a query with the header containing RD set bit, the
+responder MUST ignore the RD bit.
+
+
+
+
+
+
+
+Esibov, Aboba & Thaler Standards Track [Page 2]
+
+INTERNET-DRAFT Multicast DNS 16 November 2000
+
+
+If the multicast query is not positively resolved ("positively resolved"
+refers in this document to the response with the RCODE set to 0) during
+a limited amount of time, then a sender MAY repeat the transmission of a
+query in order to assure themselves that the query has been received by
+a host capable of responding to the query. Repetition MUST NOT be
+attempted more than 5 times, and the repetition SHOULD NOT be repeated
+more often than once per 0.1 seconds to reduce the unnecessary network
+traffic. Retry intervals SHOULD be exponentially increased.
+
+A responder listens on port 53 on the LINKLOCAL address. Responders MUST
+respond to multicast queries to those and only those names for which
+they are authoritative. As an example, computer
+"host.example.com.local.arpa." is authoritative for the domain
+"host.example.com.local.arpa.". When such host receives a multicast DNS
+query for an A record for the name "host.example.com.local.arpa." it
+responds with an A record(s) that contains its IP address(es) in the
+RDATA of the record.
+In conventional DNS terminology a DNS server authoritative for a zone is
+authoritative for all the domain names under the zone root except for
+the branches delegated into separate zones. Contrary to conventional DNS
+terminology, a responder is authoritative only for the zone root. For
+example the host "host.example.com.local.arpa." is not authoritative for
+the name "child.host.example.com.local.arpa." unless the host is
+configured with multiple names, including "host.example.com.local.arpa."
+and "child.host.example.com.local.arpa.". The purpose of such limitation
+of the name authority scope of a responder is to prevent complication
+that could be caused by coexistence of two or more devices with the
+names representing child and parent (or grandparents) nodes in the DNS
+tree, for example, "host.example.com.local.arpa." and
+"child.host.example.com.local.arpa.". In this example (unless this
+limitation introduced) the multicast query for an A record for the name
+"child.host.example.com.local.arpa." would cause two authoritative
+responses: name error received from "host.example.com.local.arpa.", and
+requested A record - from "child.host.example.com.local.arpa.". To
+prevent such ambiguity, we could propose to implement multicast enabled
+devices to perform a dynamic update of the parent (or grandparent) zone
+with a delegation to a child zone, in this example a host
+"child.host.example.com.local.arpa." would send a dynamic update for
+the NS and glue A record to the "host.example.com.local.arpa.", but this
+approach significantly complicates implementation of the multicast DNS
+and would not be acceptable for a lightweight devices.
+
+The response to the multicast query is composed in exactly the same
+manner as in case of a response to the unicast DNS query as specified
+in [4]. Responders MUST never respond using cached data, and the AA
+(Authoritative Answer) bit MUST be set. The response is sent to the
+sender via unicast. If a TC (truncation) bit is set in the response,
+then the sender MAY use the response if it contains all necessary
+information, or the sender MAY discard the response and resend the query
+over TCP or using EDNS0 with larger window using unicast address of the
+
+
+
+Esibov, Aboba & Thaler Standards Track [Page 3]
+
+INTERNET-DRAFT Multicast DNS 16 November 2000
+
+
+responder. The RA (Recursion Available) bit in the header of the
+response MUST NOT be set. Even if the RA bit is set in the response
+header, the sender MUST ignore it. The responder MUST set the Hop Limit
+field in IPv6 header and TTL field in IPv4 header of all responses to
+the multicast DNS query to 255. The sender MUST verify that the Hop
+Limit field in IPv6 header and TTL field in IPv4 header of each response
+to the multicast DNS query is set to 255. If it is not, then sender MUST
+ignore such response.
+
+The responder should use a pre-configured TTL [5] value in the records
+returned in the multicast DNS query response. Due to the TTL
+minimalization necessary when caching an RRset, all TTLs in an RRset
+MUST be set to the same value.
+
+The responder includes in the additional and authority section of the
+response the same records, as a DNS server would insert in the response
+to the unicast DNS query.
+
+Sender MUST anticipate receiving no replies to some multicasted queries,
+in the event that no responders are available within the multicast
+scope, or in the event that no positive non-null responses exist to the
+transmitted query.
+
+If no positive response is received, a resolver treats it as a response
+that no records of the specified type and class for the specified name
+exist (NXRRSET), which SHOULD be cached for a period that SHOULD NOT
+exceed 5 seconds.
+
+Sender MUST anticipate receiving multiple replies to the same
+multicasted query, in the event that several multicast DNS enabled
+computers receive the query and respond with valid answers. When this
+occurs, the responses MAY first be concatenated, and then treated in the
+same manner that multiple RRs received from the same DNS server would,
+ordinarily.
+
+
+3. Usage model
+
+A device configured to be a "responder" may also be a "sender". A device
+configured to not be a "responder" cannot be a "sender".
+
+Multicast DNS usage is determined by the domain search configuration as
+well as by special treatment of the ".local.arpa." namespace. Any
+device whose domain search configuration contains ".local.arpa." domain
+is configured to behave as "responder". A device configured to be a
+"responder" may also be a "sender". A device cannot be configured to
+behave as one (i.e. sender or responder), but not another. The sender
+treats queries for ".local.arpa." as a special case. The domain search
+list can be configured manually or automatically via a DHCP option.
+
+
+
+
+Esibov, Aboba & Thaler Standards Track [Page 4]
+
+INTERNET-DRAFT Multicast DNS 16 November 2000
+
+
+A sender MUST NOT send a unicast query for names ending with the
+".local.arpa." suffix except in the case when a sender repeats a query
+over TCP after it received a response to the previous multicast query
+with TC bit set or unless sender's cache contains NS resource record
+that enables sender to send a query directly to the devices
+authoritative for the name in query.
+
+It is not expected that a device "host.example.com." will be manually
+configured to have additional name "host.example.com.local.arpa." when
+it is configured to use multicast DNS. Instead, a responder with a name
+"host.example.com." configured with ".local.arpa." suffix in its domain
+search configuration is authoritative for the name
+"host.example.com.local.arpa.". I.e. when responder with the name
+"host.example.com." receives an A type query for the name
+"host.example.com.local.arpa." it authoritatively responds to the query.
+
+If ".local.arpa" is not in the domain search list, then multicast DNS
+MUST NOT be used by a device. This implies that the device will neither
+listen on the DNS LINKLOCAL multicast address, nor will it send queries
+to that address. An auto-configured host will typically have
+".local.arpa" first in its search list so that it will be enabled to
+use mDNS. Typically an enterprise host will not have ".local.arpa" in
+its search list at all so that it will not use mDNS.
+
+The same device may use multicast DNS queries for the name resolution of
+the names ending with ".local.arpa.", and unicast DNS queries for name
+resolution of all other names. When a DNS client is requested by a user
+or application to perform a name resolution of a dot-terminated name
+that contains a ".local.arpa" suffix, a query for such name MUST be
+multicasted and such name should not be concatenated with any suffix.
+
+If a DNS server is running on a device, the device MUST NOT listen for
+the multicast DNS queries, to prevent a device from listening on port 53
+and intercepting DNS queries directed to a DNS server. A DNS server may
+listen and respond to the multicast queries. A DNS server by default
+doesn't listen to the multicast DNS queries. Presence of the
+".local.arpa." in the domain search list doesn't affect the
+configuration on the DNS server.
+
+
+4. Sequence of events
+
+The sequence of events for usage of multicast DNS is as follows:
+
+ 1. If a sender needs to resolve a query for a name
+ "host.example.com.local.arpa", then it sends a multicast query to the
+ LINKLOCAL multicast address.
+
+ 2. A responder responds to this query only if it is authoritative
+ for the domain name "host.example.com.local.arpa". The responder sends
+ a response to the sender via unicast over UDP.
+
+
+Esibov, Aboba & Thaler Standards Track [Page 5]
+
+INTERNET-DRAFT Multicast DNS 16 November 2000
+
+
+ 3. Upon the reception of the response the sender verifies that the Hop
+ Limit field in IPv6 header or TTL field in IPv4 header (depending on
+ used protocol) of the response is set to 255. If it is, then sender
+ uses and caches the returned response. If not, then the sender ignores
+ the response and continues waiting for the response.
+
+
+5. Name conflicts
+
+It is required to verify the uniqueness of the host DNS name when a host
+boots, when its name is changed, or when it is configured to use
+multicast DNS (such as when the domain search option is changed to
+include ".local.arpa.").
+
+A gratuitous name resolution query SHOULD be done to check for a name
+conflict. This is done by having the resolver send a multicast query for
+a SOA type query for its own name (i.e. for the name it is authoritative
+for). If the query is not positively resolved then host assumes
+authority for the name. If the query is positively resolved, then the
+host should verify that the computer name specified in the RDATA of the
+SOA record in the answer section of the response is its own computer
+name. If the host verifies it, then it assumes authority for its name.
+If the host cannot match the returned computer name to its computer
+name, then a conflict has been detected. In order to resolve name
+conflict, the host will change the name.
+
+A host that has detected a name conflict MUST NOT use the name. This
+means that the host MUST NOT respond to multicast queries for that name
+and MUST NOT respond to other multicast queries with the records that
+contain in RDATA name in conflict (for example, PTR record).
+
+Note that this name conflict detection mechanism doesn't prevent name
+conflicts when previously separate networks are connected by a bridge.
+Name conflict in such situation is detected when a sender receives more
+than one response to its multicasted DNS query. Such sender sends using
+unicast the first response that it received to all responders, except
+the first one, that responded to this query. A host that receives a
+response for a query for it's own name, even if it didn't send such
+query, sends a multicast query for the SOA record for the name that it
+is authoritative for. Based on the response the host detects the name
+conflict and acts according to the description above.
+
+
+6. IANA Considerations
+
+Authors will contact IANA to reserve LINKLOCAL IPv4 and IPv6 addresses.
+
+
+
+
+
+
+
+Esibov, Aboba & Thaler Standards Track [Page 6]
+
+INTERNET-DRAFT Multicast DNS 16 November 2000
+
+
+7. Security Considerations
+
+This draft does not prescribe a means of securing the multicast DNS
+mechanism. It is possible that hosts will allocate conflicting names for
+a period of time, or that non-conforming hosts will attempt to deny
+service to other hosts by allocating the same name. Such attacks also
+allow nodes to receive packets destined for other nodes. The protocol
+reduces the exposure to such threats in the absence of authentication
+by ignoring multicast DNS query response packets received from off-link
+senders. The Hop Limit field in IPv6 and TTL field in IPv4 of all
+received packets is verified to contain 255, the maximum legal value.
+Because routers decrement the Hop Limit on all packets they forward,
+received packets containing a Hop Limit of 255 must have originated
+from a neighbor.
+
+These threats are most serious in wireless networks such as 802.11,
+since attackers on a wired network will require physical access to the
+home network, while wireless attackers may reside outside the home. In
+order to provide for privacy equivalent to a wired network, the 802.11
+specification provides for RC4-based encryption. This is known as the
+"Wired Equivalency Privacy" (WEP) specification. Where WEP is
+implemented, an attacker will need to obtain the WEP key prior to
+gaining access to the home network.
+
+The mechanism specified in this draft does not require use of the
+DNSSEC, which means that the responses to the multicast DNS queries may
+not be authenticated. If a network contains a "signed key distribution
+center" for all (or at least some) of the DNS zones that the responders
+are authoritative for, then those devices on such a network are
+configured with the key for the top zone, "local.arpa." (hosted by
+"signed keys distribution center") may use DNSSEC for the authentication
+of the responders using DNSSEC.
+
+8. Acknowledgements
+
+The authors would like to thank Stuart Cheshire, Michael Patton, Erik
+Guttman, Olafur Gudmundsson, Thomas Narten, Mark Andrews, Erik Nordmark,
+Myrong Hattig, Bill Manning and James Gilroy for comments on this draft.
+
+9. Authors' Addresses
+
+Levon Esibov
+Microsoft Corporation
+One Microsoft Way
+Redmond, WA 98052
+
+EMail: levone@microsoft.com
+
+
+
+
+
+
+Esibov, Aboba & Thaler Standards Track [Page 7]
+
+INTERNET-DRAFT Multicast DNS 16 November 2000
+
+Bernard Aboba
+Microsoft Corporation
+One Microsoft Way
+Redmond, WA 98052
+
+Phone: +1 (425) 936-6605
+EMail: bernarda@microsoft.com
+
+
+Dave Thaler
+Microsoft Corporation
+One Microsoft Way
+Redmond, WA 98052
+
+Phone: +1 (425) 703-8835
+EMail: dthaler@microsoft.com
+
+
+10. References
+
+[1] Bradner, S., "Key words for use in RFCs to Indicate Requirement
+ Levels", BCP 14, RFC 2119, March 1997.
+
+[2] Meyer, D., "Administratively Scoped IP Multicast", BCP 23, RFC
+ 2365, July 1998.
+
+[3] Aboba, B., "The Mini-DHCP Server", Internet draft (work in
+ progress), draft-aboba-dhc-mini-01.txt, April 2000.
+
+[4] Mockapetris, P., "Domain Names - Implementation and Specification",
+ RFC 1035, November 1987.
+
+[5] Mockapetris, P., "DOMAIN NAMES - CONCEPTS AND FACILITIES",
+ RFC 1034, November 1987.
+
+11. Intellectual Property Statement
+
+The IETF takes no position regarding the validity or scope of any
+intellectual property or other rights that might be claimed to pertain
+to the implementation or use of the technology described in this
+document or the extent to which any license under such rights might or
+might not be available; neither does it represent that it has made any
+effort to identify any such rights. Information on the IETF's
+procedures with respect to rights in standards-track and standards-
+related documentation can be found in BCP-11. Copies of claims of
+rights made available for publication and any assurances of licenses to
+be made available, or the result of an attempt made to obtain a general
+license or permission for the use of such proprietary rights by
+implementors or users of this specification can be obtained from the
+IETF Secretariat.
+
+
+
+
+Esibov, Aboba & Thaler Standards Track [Page 8]
+
+INTERNET-DRAFT Multicast DNS 16 November 2000
+
+
+The IETF invites any interested party to bring to its attention any
+copyrights, patents or patent applications, or other proprietary rights
+which may cover technology that may be required to practice this
+standard. Please address the information to the IETF Executive
+Director.
+
+12. Full Copyright Statement
+
+Copyright (C) The Internet Society (2000). All Rights Reserved.
+This document and translations of it may be copied and furnished to
+others, and derivative works that comment on or otherwise explain it or
+assist in its implementation may be prepared, copied, published and
+distributed, in whole or in part, without restriction of any kind,
+provided that the above copyright notice and this paragraph are included
+on all such copies and derivative works. However, this document itself
+may not be modified in any way, such as by removing the copyright notice
+or references to the Internet Society or other Internet organizations,
+except as needed for the purpose of developing Internet standards in
+which case the procedures for copyrights defined in the Internet
+Standards process must be followed, or as required to translate it into
+languages other than English. The limited permissions granted above are
+perpetual and will not be revoked by the Internet Society or its
+successors or assigns. This document and the information contained
+herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE
+INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
+INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
+WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE."
+
+13. Expiration Date
+
+This memo is filed as <draft-ietf-dnsext-mdns-00.txt>, and expires
+May 16, 2001.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Esibov, Aboba & Thaler Standards Track [Page 9]
diff --git a/doc/draft/draft-ietf-enum-e164-gstn-np-00.txt b/doc/draft/draft-ietf-enum-e164-gstn-np-00.txt
new file mode 100644
index 00000000..317d3cd4
--- /dev/null
+++ b/doc/draft/draft-ietf-enum-e164-gstn-np-00.txt
@@ -0,0 +1,2009 @@
+
+
+ Mark Foster
+Internet Draft Tom McGarry
+Document: <draft-ietf-enum-e164-gstn-np-00.txt> James Yu
+ NeuStar, Inc.
+Category: Informational July 2000
+
+
+ Number Portability in the GSTN: An Overview
+
+
+Status of this Memo
+
+ This document is an Internet-Draft and is in full conformance with
+ all provisions of Section 10 of RFC2026 [RFC].
+
+ Internet-Drafts are working documents of the Internet Engineering
+ Task Force (IETF), its areas, and its working groups. Note that
+ other groups may also distribute working documents as Internet-
+ Drafts. Internet-Drafts are draft documents valid for a maximum of
+ six months and may be updated, replaced, or obsoleted by other
+ documents at any time. It is inappropriate to use Internet- Drafts
+ as reference material or to cite them other than as "work in
+ progress."
+
+ The list of current Internet-Drafts can be accessed at
+ http://www.ietf.org/ietf/1id-abstracts.txt.
+
+ The list of Internet-Draft Shadow Directories can be accessed at
+ http://www.ietf.org/shadow.html.
+
+ To learn the current status of any Internet-Draft, please check the
+ "1id-abstracts.txt" listing contained in the Internet-Drafts Shadow
+ Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
+ munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or
+ ftp.isi.edu (US West Coast).
+
+
+1. Abstract
+
+ This document provides an overview of E.164 telephone number
+ portability (NP) in the Global Switched Telephone Network (GSTN).
+ There are three types of number portability: service provider number
+ portability (SPNP), location portability, and service portability.
+ Service provider portability, the focus of the present draft, is a
+ regulatory imperative in many countries seeking to liberalize local
+ telephony service competition, by enabling end-users to retain pre-
+ existing telephone numbers while changing service providers.
+ Implementation of NP within national GSTN entails potentially
+ significant changes to numbering administration, network element
+ signaling, call routing and processing, billing, service management,
+ and other functions. NP changes the fundamental nature of a dialed
+ E.164 number from a hierarchical physical routing address to a
+ virtual address, thereby requiring the transparent translation of
+ the later to the former. In addition, there are various regulatory
+
+
+<Foster,McGarry,Yu> Informational - Expiration in September 2000 [1]
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ constraints which establish relevant parameters for NP
+ implementation, most of which are not network technology specific.
+ Consequently, the implementation of NP behavior consistent with
+ applicable regulatory constraints, as well as the need for
+ interoperation with the existing GSTN NP implementations, are
+ relevant topics for numerous areas of IP telephony work-in-progress
+ at IETF.
+
+
+2. Introduction
+
+ This document provides an overview of E.164 telephone number
+ portability in the Global Switched Telephone Network (GSTN). There
+ are considered to be three types of number portability (NP): service
+ provider portability (SPNP), location portability (not to be
+ confused with terminal mobility), and service portability.
+
+ Service provider portability (SPNP), the focus of the present draft,
+ is a regulatory imperative in many countries seeking to liberalize
+ telephony service competition, especially local service.
+ Historically, local telephony service (as compared to long distance
+ or international service) has been regulated as a utility-like form
+ of service. While a number of countries had begun liberalization
+ (e.g. privatization, de-regulation, or re-regulation) some years
+ ago, the advent of NP is relatively recent (since ~1995).
+
+ E.164 numbers can be non-geographic and geographic numbers. Non-
+ geographic numbers do not reveal the locations information of those
+ numbers. Geographic E.164 numbers were intentionally designed as
+ hierarchical routing addresses which could systematically be digit-
+ analyzed to ascertain the country, serving network provider, serving
+ end-office switch, and specific line of the called party. As such,
+ without NP a subscriber wishing to change service providers would
+ incur a number change as a consequence of being served off of a
+ different end-office switch operated by the new service provider.
+ The cost and convenience impact to the subscriber of changing
+ numbers is seen as barrier to competition. Hence NP has become
+ associated with GSTN infrastructure enhancements associated with a
+ competitive environment driven by regulatory directives.
+
+ Forms of SPNP have been deployed or are being deployed widely in the
+ GSTN in various parts of the world, including the US, Canada,
+ Western Europe, Australia, and the Pacific Rim (e.g. Hong Kong).
+ Other regions, such as South America (e.g. Brazil) are actively
+ considering it.
+
+ Implementation of NP within a national telephony infrastructure
+ entails potentially significant changes to numbering administration,
+ network element signaling, call routing and processing, billing,
+ service management, and other functions.
+
+ NP changes the fundamental nature of a dialed E.164 number from a
+ hierarchical physical routing address to a virtual address. NP
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 2
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ implementations attempt to encapsulate the impacts to the GSTN and
+ make NP transparent to subscribers by incorporating a translation
+ function to map a dialed, potentially ported E.164 address, into a
+ network routing address (either a number prefix or another E.164
+ address) which can be hierarchically routed.
+
+ This is roughly analogous to the use of network address translation
+ on IP addresses to enable IP address portability by containing the
+ impact of the address change to the edge of the network and retain
+ the use of CIDR blocks in the core which can be route aggregated by
+ the network service provider to the rest of the internet.
+
+ NP bifurcates the historical role of a subscriberÆs E.164 address
+ into two or more data elements (a dialed or virtual address, and a
+ network routing address) that must be made available to network
+ elements through an NP translations database, carried by forward
+ call signaling, and recorded on call detail records. Not only is
+ call processing and routing affected, but also so is SS7/C7
+ messaging. A number of TCAP-based SS7 messaging sets utilize an
+ E.164 address as an application-level network element address in the
+ global title address (GTA) field of the SCCP message header.
+ Consequently, SS7/C7 signaling transfer points (STPs) and gateways
+ need to be able to perform n-digit global title translation (GTT) to
+ translate a dialed E.164 address into its network address
+ counterpart via the NP database.
+
+ In addition, there are various national regulatory constraints which
+ establish relevant parameters for NP implementation, most of which
+ are not network technology specific. Consequently, implementations
+ of NP behavior in IP telephony consistent with applicable regulatory
+ constraints, as well as the need for interoperation with the
+ existing GSTN NP implementations, are relevant topics for numerous
+ areas of IP telephony work-in-progress at IETF.
+
+ This document describes three types of number portability and the
+ four schemes that have been standardized to support SPNP for
+ geographic E.164 numbersspecifically. Following that, specific
+ information regarding the call routing and database query
+ implementations are described for several regions (North American
+ and Europe) and industries (wireless vs. wireline). The Number
+ Portability Database (NPDB) interfaces and the call routing schemes
+ that are used in the North America and Europe are described to show
+ the variety of standards that may be implemented worldwide. A
+ glance of the NP implementations worldwide is provided. Number
+ pooling is briefly discussed to show how NP is being enhanced in the
+ US to conserve North American area codes. The conclusion briefly
+ touches the potential impacts of NP on IP & Telecommunications
+ Interoperability. Appendix A provides some specific technical and
+ regulatory information on NP in North America. Appendix B describes
+ the number portability administration process that manages the
+ number portability database in North America.
+
+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 3
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+3. Abbreviations and Acronyms
+
+ ACQ All Call Query
+ AIN Advanced Intelligent Network
+ AMPS Advanced Mobile Phone System
+ ANSI American National Standards Institute
+ CDMA Code Division Multiple Access
+ CdPA Called Party Address
+ CdPN Called Party Number
+ CH Code Holder
+ CMIP Common Management Information Protocol
+ CRTC Canadian Radio and Television Commission
+ CS1 Capability Set 1
+ CS2 Capability Set 2
+ DN Directory Number
+ DNS Domain Name System
+ ETSI European Technical Standards Institute
+ FCC Federal Communications Commission
+ FCI Forward Call Indicator
+ GAP Generic Address Parameter
+ GMSC Gateway Mobile Services Switching Center or Gateway Mobile
+ Switching Center
+ GSM Global System for Mobile Communications
+ GSTN Global Switched Telephone Network
+ GW Gateways
+ HLR Home Location Register
+ IAM Initial Address Message
+ ICC Illinois Commerce Commission
+ IETF Internet Engineering Task Force
+ IN Intelligent Network
+ INAP Intelligent Network Application Part
+ IP Internet Protocol
+ IS-41 Interim Standards Number 41
+ ISDN Integrated Services Digital Network
+ ISUP ISDN User Part
+ ITN Individual Telephony Number
+ ITU International Telecommunication Union
+ ITU-TS ITU-Telecommunication Sector
+ LDAP Lightweight Directory Access Protocol
+ LEC Local Exchange Carrier
+ LLC Limited Liability Corporation
+ LNP Local Number Portability
+ LRN Location Routing Number
+ LSMS Local Service Management System
+ MAP Mobile Application Part
+ MNP Mobile Number Portability
+ MSRN Mobile Station Roaming Number
+ MTP Message Transfer Part
+ NANC North American Numbering Council
+ NANP North American Numbering Plan
+ NP Number Portability
+ NPAC Number Portability Administration Center
+ NPDB Number Portability Database
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 4
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ NPRM Notice of Proposed Rulemaking
+ NRN Network Routing Number
+ OR Onward Routing
+ OSS Operation Support System
+ PCS Personal Communication Services
+ PODP Public Office Dialing Plan
+ PUC Public Utility Commission
+ QoR Query on Release
+ RBOC Regional Bell Operating Company
+ RN Routing Number
+ RTP Return to Pivot
+ SCCP Signaling Connection Control Part
+ SIP Session Initiation Protocol
+ SMR Special Mobile Radio
+ SMS Service Management System
+ SOA Service Order Administration
+ SPNP Service Provider Number Portability
+ SRF Signaling Relaying Function
+ SRI Send Routing Information
+ SS7 Signaling System Number 7
+ STP Signaling Transfer Point
+ TCAP Transaction Capabilities Application Part
+ TCNI Translated Called Number Indicator
+ TDMA Time Division Multiple Access
+ TN Telephone Number
+ TRIP Telephony Routing Information Protocol
+ URL Universal Resource Locator
+
+
+4. Types of Number Portability
+
+ As there are several types of E.164 numbers (telephone numbers, or
+ just TN) in the GSTN, there are correspondingly several types of
+ E.164 NP in the GSTN. First there are so-call non-geographic E.164
+ numbers, commonly used for service-specific applications such as
+ freephone (800 or 0800). Portability of these are call non-
+ geographic number portability (NGNP). NGNP, for example, was
+ deployed in the US in 1986-92.
+
+ Geographic number portability, which includes traditional fixed or
+ wireline numbers as well as mobile numbers which are allocated out
+ of geographic number range prefixes, is called NP or GNP or in the
+ US local number portability (LNP).
+
+ Number portability allows the telephony subscribers in the Global
+ Switched Telephone Network (GSTN) to keep their phone numbers when
+ they change their service providers or subscribed services, or when
+ they move to a new location.
+
+ The ability to change the service provider while keeping the same
+ phone number is called service provider portability (SPNP) also
+ known as "operator portability."
+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 5
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ The ability to change the subscriberÆs fixed service location while
+ keeping the same phone number is called location portability.
+
+ The ability to change the subscribed services (e.g., from the plain
+ old telephone service to Integrated Services Digital Network (ISDN)
+ services) while keeping the same phone number is called service
+ portability. Another aspect of service portability is to allow the
+ subscribers to enjoy the subscribed services in the same way when
+ they roam outside their home networks as is supported by the
+ cellular/wireless networks.
+
+ In addition, mobile number portability (MNP) refers to specific NP
+ implementation in mobile networks either as part of a broader NP
+ implementation in the GSTN or on a stand-alone basis. Where
+ interoperation of LNP and MNP is supported, service portability
+ between fixed and mobile service types is possible.
+
+ At present, SPNP has been the primary form of NP deployed due to its
+ relevance in enabling local service competition.
+
+ Also in use in the GSTN are the terms interim NP (INP or ILNP) and
+ true NP. Interim NP usually refers to the use of remote call
+ forwarding-like measures to forward calls to ported numbers through
+ the donor network to the new service network. These are considered
+ interim relative to true NP, which seeks to remove the donor network
+ or old service provider from the call or signaling path altogether.
+ Often the distinction between interim and true NP is a national
+ regulatory matter relative to the technical/operational requirements
+ imposed on NP in that country.
+
+ Implementations of true NP in certain countries (e.g. US, Canada,
+ Spain, Belgium, Denmark) may pose specific requirements for IP
+ telephony implementations as a result of regulatory and industry
+ requirements for providing call routing and signaling independent of
+ the donor network or last previous serving network.
+
+
+5. Service Provider Number Portability Schemes
+
+ Four schemes can be used to support service provider portability and
+ are briefly described below. But first, some further terms are
+ introduced.
+
+ The donor network is the network that first assigned a telephone
+ number (e.g., TN +1-202-533-1234) to a subscriber, out of a number
+ range administratively (e.g., +1 202-533) assigned to it. The
+ current service provider (new SP) or new serving network is the
+ network that currently serves the ported number. The old serving
+ network (or old SP) is the network that previously served the ported
+ number before the number was ported to the new serving network.
+ Since a TN can port a number of times, the old SP is not necessarily
+ the same as the donor network, except for the first time the TN
+ ports away, or if the TN ports back into the donor network and away
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 6
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ again. While the new SP and old SP roles are transitory as a TN
+ ports around, the donor network is always the same for any
+ particular TN based on the service provider to whom the subtending
+ number range was administratively assigned. See the discussion
+ below on number pooling, as this enhancement to NP further
+ bifurcates the role of donor network into two (the number range or
+ code holder network, and the block holder network).
+
+ To simplify the illustration, all the transit networks are ignored,
+ the originating or donor network is the one that performs the
+ database queries or call redirection, and the dialed directory
+ number (TN) has been ported out of the donor network before.
+
+ It is assumed that the old serving network, the new serving network
+ and the donor network are different networks so as to show which
+ networks are involved in call handling and routing and database
+ queries in each of four schemes. Please note that the port of the
+ number (process of moving it from one network to another) happened
+ prior to the call setup and is not included in the call steps.
+ Information carried in the signaling messages to support each of the
+ four schemes is not discussed to simplify the explanation.
+
+
+5.1 All Call Query (ACQ)
+
+ Figure 1 shows the call steps for the ACQ scheme. Those call steps
+ are as follows:
+
+ (1) The Originating Network receives a call from the caller and
+ sends a query to a centrally administered Number Portability
+ Database (NPDB), a copy of which is usually resident on a
+ network element within its network or through a third party
+ provider.
+ (2) The NPDB returns the routing number associated with the dialed
+ directory number. The routing number is discussed later in
+ Section 7.
+ (3) The Originating Network uses the routing number to route the
+ call to the new serving network.
+
+
+
+ +-------------+ +-----------+ Number +-----------+
+ | Centralized | | New Serv. | ported | Old Serv. |
+ | NPDB | +-------->| Network |<------------| Network |
+ +-------------+ | +-----------+ +-----------+
+ ^ | |
+ | | |
+ 1| | 3.|
+ | | 2. |
+ | | |
+ | v |
+ +----------+ | +----------+ +----------+
+ | Orig. |------+ | Donor | | Internal |
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 7
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ | Network | | Network | | NPDB |
+ +----------+ +----------+ +----------+
+
+
+ Figure 1 - All Call Query (ACQ) Scheme.
+
+
+5.2 Query on Release (QoR)
+
+ Figure 2 shows the call steps for the QoR scheme. Those call steps
+ are as follows:
+
+ (1) The Originating Network receives a call from the caller and
+ routes the call to the donor network.
+ (2) The donor network releases the call and indicates that the
+ dialed directory number has been ported out of that switch.
+ (3) The Originating Network sends a query to its copy of the
+ centrally administered NPDB.
+ (4) The NPDB returns the routing number associated with the dialed
+ directory number.
+ (5) The Originating Network uses the routing number to route the
+ call to the new serving network.
+
+
+ +-------------+ +-----------+ Number +-----------+
+ | Centralized | | New Serv. | ported | Old Serv. |
+ | NPDB | | Network |<------------| Network |
+ +-------------+ +-----------+ +-----------+
+ ^ | ^
+ | | 4. |
+ 3.| | 5. |
+ | | +----------------------+
+ | | |
+ | v |
+ +----------+ 2. +----------+ +----------+
+ | Orig. |<---------------| Donor | | Internal |
+ | Network |--------------->| Network | | NPDB |
+ +----------+ 1. +----------+ +----------+
+
+
+ Figure 2 - Query on Release (QoS) Scheme.
+
+
+5.3 Call Dropback
+
+ Figure 3 shows the call steps for the Dropback scheme. This scheme
+ is also known as "Return to Pivot (RTP)." Those call steps are as
+ follows:
+
+ (1) The Originating Network receives a call from the caller and
+ routes the call to the donor network.
+
+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 8
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ (2) The donor network detects that the dialed directory number has
+ been ported out of the donor switch and checks with an internal
+ network-specific NPDB.
+ (3) The internal NPDB returns the routing number associated with the
+ dialed directory number.
+ (4) The donor network releases the call by providing the routing
+ number.
+ (5) The Originating Network uses the routing number to route the
+ call to the new serving network.
+
+
+ +-------------+ +-----------+ Number +-----------+
+ | Centralized | | New Serv. | porting | Old Serv. |
+ | NPDB | | Network |<------------| Network |
+ +-------------+ +-----------+ +-----------+
+ /\
+ |
+ 5. |
+ +------------------------+
+ |
+ |
+ +----------+ 4. +----------+ 3. +----------+
+ | Orig. |<---------------| Donor |<----------| Internal |
+ | Network |--------------->| Network |---------->| NPDB |
+ +----------+ 1. +----------+ 2. +----------+
+
+
+ Figure 3 - Dropback Scheme.
+
+
+5.4 Onward Routing (OR)
+
+ Figure 4 shows the call steps for the OR scheme. This scheme is also
+ called Remote Call Forwarding. Those call steps are as follows:
+
+ (1) The Originating Network receives a call from the caller and
+ routes the call to the donor network.
+ (2) The donor network detects that the dialed directory number has
+ been ported out of the donor switch and checks with an internal
+ network-specific NPDB.
+ (3) The internal NPDB returns the routing number associated with the
+ dialed directory number.
+ (4) The donor network uses the routing number to route the call to
+ the new serving network.
+
+
+ +-------------+ +-----------+ Number +-----------+
+ | Centralized | | New Serv. | porting | Old Serv. |
+ | NPDB | | Network |<------------| Network |
+ +-------------+ +-----------+ +-----------+
+ /\
+ |
+ 4.|
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 9
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ |
+ |
+ |
+ +----------+ +----------+ 3. +----------+
+ | Orig. | | Donor |<----------| Internal |
+ | Network |--------------->| Network |---------->| NPDB |
+ +----------+ 1. +----------+ 2. +----------+
+
+
+ Figure 4 - Onward Routing (OR) Scheme.
+
+
+5.5 Comparisons of the Four Schemes
+
+ Only the ACQ scheme does not involve the donor network when routing
+ the call to the new serving network of the dialed ported number.
+ The other three schemes involve call setup to or signaling with the
+ donor network.
+
+ Only the OR scheme requires the setup of two physical call segments,
+ one from the Originating Network to the donor network and the other
+ from the donor network to the new serving network. The OR scheme is
+ the least efficient in terms of using the network resources. The
+ QoR and Dropback schemes set up calls to the donor network first but
+ release the call back to the Originating Network that then initiates
+ a new call to the Current Serving Network. For the QoR and Dropback
+ schemes, circuits are still reserved one by one between the
+ Originating Network and the donor network when the Originating
+ Network sets up the call towards the donor network. Those circuits
+ are released one by one when the call is released from the donor
+ network back to the Originating Network. The ACQ scheme is the most
+ efficient in terms of using the switching and transmission
+ facilities for the call.
+
+ Both the ACQ and QoR schemes involve Centralized NPDBs for the
+ Originating Network to retrieve the routing information.
+ Centralized NPDB means that the NPDB contains ported number
+ information from multiple networks. This is in contrast to the
+ internal network-specific NPDB that is used for the Dropback and OR
+ schemes. The internal NPDB only contains information about the
+ numbers that were ported out of the donor network. The internal
+ NPDB can be a stand-alone database that contains information about
+ all or some ported-out numbers from the donor network. It can also
+ reside on the donor switch and only contains information about those
+ numbers ported out of the donor switch. In that case, no query to a
+ stand-alone internal NPDB is required. The donor switch for a
+ particular phone number is the switch to which the number range is
+ assigned from which that phone number was originally assigned.
+
+ For example, number ranges in the North American Numbering Plan
+ (NANP) are usually assigned in the form of central office codes (CO
+ codes) comprising a six-digit prefix formatted as a NPA+NXX. Thus a
+ switch serving +1-202-533 would typically serve +1-202-533-0000
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 10
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ through +1-202-533-9999. In major cities, switches usually host
+ several CO codes. NPA stands for Numbering Plan Area that is also
+ known as the area code. It is three-digit long and has the format
+ of NXX where N is any digit from 2 to 9 and X is any digit from 0 to
+ 9. NXX in the NPA+NXX format is known as the office code that has
+ the same format as the NPA. When the first number out of an NPA+NXX
+ code is ported out to another switch, that NPA+NXX is called
+ "portable NPA+NXX."
+
+ Similarly, in other national E.164 numbering plans, number ranges
+ cover a contiguous range of numbers within that range. Once a
+ number within that range has ported away from the donor network, all
+ numbers in that range are considered potentially ported and should
+ be queried in the NPDB.
+
+ The ACQ scheme has two versions. One version is for the Originating
+ Network to always query the NPDB when a call is received from the
+ caller regardless whether the dialed directory number is ported or
+ not. The other version is to check whether the dialed directory
+ number belongs to any portable number range. If yes, an NPDB query
+ is sent. If not, no NPDB query is sent. The former performs better
+ when there are many portable number ranges. The latter performs
+ better when there are not too many portable number ranges at the
+ expense of checking every call to see whether NPDB query is needed.
+ The latter ACQ scheme is similar to the QoR scheme except that the
+ QoR scheme uses call setup and relies on the donor network to
+ indicate "number ported out" before launching the NPDB query.
+
+
+6. Database Queries in the NP Environment
+
+ As indicated earlier, the ACQ and QoR schemes require that a switch
+ query the NPDB for routing information. Various standards have been
+ defined for the switch-to-NPDB interface. Those interfaces with
+ their protocol stacks are briefly described below. The term "NPDB"
+ is used for a stand-alone database that may support just one or some
+ or all of the interfaces mentioned below. The NPDB query contains
+ the dialed directory number and the NPDB response contains the
+ routing number. There are certainly other information that is sent
+ in the query and response. The primary interest is to get the
+ routing number from the NPDB to the switch for call routing.
+
+
+6.1 U.S. and Canada
+
+ One of the following five NPDB interfaces can be used to query an
+ NPDB:
+
+ (a) Advanced Intelligent Network (AIN) using the American National
+ Standards Institute (ANSI) version of the Intelligent Network
+ Application Part (INAP) [ANSI SS] [ANSI DB]. The INAP is
+ carried on top of the protocol stack that includes the (ANSI)
+ Message Transfer Part (MTP) Levels 1 through 3, ANSI Signaling
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 11
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ Connection Control Part (SCCP), and ANSI Transaction
+ Capabilities Application Part (TCAP). This interface can be
+ used by the wireline or wireless switches, is specific to the
+ LRN implementation of LNP in North America, and is modeled on
+ the Public Office Dialing Plan (PODP) trigger defined in the
+ Advanced Intelligent Network (AIN) 0.1 call model.
+
+ (b) Intelligent Network (IN), which is similar to the one used for
+ querying the 800 databases. The IN protocol is carried on top
+ of the protocol stack that includes the ANSI MTP Levels 1
+ through 3, ANSI SCCP, and ANSI TCAP. This interface can be used
+ by the wireline or wireless switches.
+
+ (c) ANSI IS-41 [IS41] [ISNP], which is carried on top of the
+ protocol stack that includes the ANSI MTP Levels 1 through 3,
+ ANSI SCCP, and ANSI TCAP. This interface can be used by the IS-
+ 41 based cellular/Personal Communication Services (PCS) wireless
+ switches (e.g., AMPS, TDMA and CDMA). Cellular systems use
+ spectrum at 800 MHz range and PCS systems use spectrum at 1900
+ MHz range.
+
+ (d) Global System for Mobile Communication Mobile Application Part
+ (GSM MAP) [GSM], which is carried on top of the protocol stack
+ that includes the ANSI MTP Levels 1 through 3, ANSI SCCP, and
+ International Telecommunication Union - Telecommunication Sector
+ (ITU-TS) TCAP. It can be used by the PCS1900 wireless switches
+ that are based on the GSM technologies. GSM is a series of
+ wireless standards defined by the European Telecommunications
+ Standards Institute (ETSI).
+
+ (e) ISUP triggerless translation. NP translations are performed
+ transparently to the switching network by the signaling network
+ (e.g. Signaling Transfer Points (STPs) or signaling gateways).
+ ISUP IAM messages are examined to determine if the CdPN field
+ has already been translated, and if not, an NPDB query is
+ performed, and the appropriate parameters in the IAM message
+ modified to reflect the results of the translation. The
+ modified IAM message is forwarded by the signaling node on to
+ the designated DPC in a transparent manner to continue call
+ setup. The NPDB can be integrated with the signaling node or be
+ accessed via an API locally or by a query to a remote NPDB using
+ a proprietary protocol or the schemes described above.
+
+
+ Wireline switches have the choice of using either (a), (b), or (e).
+ IS-41 based wireless switches have the choice of using (a), (b),
+ (c), or (e). PCS1900 wireless switches have the choice of using
+ (a), (b), (d), or (e). In the North America, service provider
+ portability will be supported by both the wireline and wireless
+ systems, not only within the wireline or wireless domain but also
+ across the wireline/wireless boundary. However, this is not true in
+ Europe where service provider portability is usually supported only
+ within the wireline or wireless domain, not across the
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 12
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ wireline/wireless boundary due to explicit use of service-specific
+ number range prefixes. The reason is to avoid caller confusion
+ about the call charge. GSM systems in Europe are assigned
+ distinctive destination network codes, and the caller pays a higher
+ charge when calling a GSM directory number.
+
+
+6.2 Europe
+
+ One of the following three interfaces can be used to query an NPDB:
+
+ (a) Capability Set 1 (CS1) of the ITU-TS INAP [CS1], which is
+ carried on top of the protocol stack that includes the ITU-TS
+ MTP Levels 1 through 3, ITU-TS SCCP, and ITU-TS TCAP.
+
+ (b) Capability Set 2 (CS2) of the ITU-TS INAP [CS2], which is
+ carried on top of the protocol stack that includes the ITU-TS
+ MTP Levels 1 through ITU-TS MTP Levels 1 through 3, ITU-TS SCCP,
+ and ITU-TS TCAP.
+
+ (c) ISUP triggerless translation. NP translations are performed
+ transparently to the switching network by the signaling network
+ (e.g. STPs or signaling gateways). ISUP IAM messages are
+ examined to determine if the CdPN field has already been
+ translated, and if not, an NPDB query is performed, and the
+ appropriate parameters in the IAM message modified to reflect
+ the results of the translation. The modified IAM message is
+ forwarded by the signaling node on to the designated DPC in a
+ transparent manner to continue call setup.
+
+
+ Wireline switches have the choice of using either (a), (b), or (c);
+ however, all the implementations in Europe so far are based on CS1.
+ As indicated earlier that number portability in Europe does not go
+ across the wireline/wireless boundary. The wireless switches can
+ also use (a) or (b) to query the NPDBs if those NPDBs contains
+ ported wireless directory numbers. The term "Mobile Number
+ Portability (MNP)" is used for the support of service provider
+ portability by the GSM networks in Europe.
+
+ In most, if not all, cases in Europe, the calls to the wireless
+ directory numbers are routed to the wireless donor network first.
+ Over there, an internal NPDB is queried to determine whether the
+ dialed wireless directory number has been ported out or not. In
+ this case, the interface to the internal NPDB is not subject to
+ standardization.
+
+ MNP in Europe can also be supported via MNP Signaling Relay Function
+ (MNP-SRF). Again, an internal NPDB or a database integrated at the
+ MNP-SRF is used to modify the SCCP Called Party Address parameter in
+ the GSM MAP messages so that they can be re-directed to the wireless
+ serving network. Call routing involving MNP will be explained in
+ Section 7.2.
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 13
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+
+
+7. Call Routing in the NP Environment
+
+ This section discusses the call routing after the routing
+ information has been retrieved either through an NPDB query or an
+ internal database lookup at the donor switch, or from the Integrated
+ Services Digital Network User Part (ISUP) signaling message (e.g.,
+ for the Dropback scheme). For the ACQ, QoR and Dropback schemes, it
+ is the Originating Network that has the routing information and is
+ ready to route the call. For the OR scheme, it is the donor network
+ that has the routing information and is ready to route the call.
+
+ A number of triggering schemes may be employed that determine where
+ in the call path the NPDB query is performed. In the US an ôN-1ö
+ policy is used, which essentially says that for domestic calls, the
+ originating local carriers performs the query, otherwise, the long
+ distance carrier is expected to. To ensure independence of the
+ actual trigger policy employed in any one carrier, forward call
+ signaling is used to flag that an NPDB query has already been
+ performed and to therefore suppress any subsequent NP triggers that
+ may be encountered in downstream switches, in downstream networks.
+ This allows the earliest able network in the call path to perform
+ the query without introducing additional costs and call setup delays
+ were redundant queries performed downstream.
+
+7.1 U.S. and Canada
+
+ In the U.S. and Canada, a ten-digit North American Numbering Plan
+ (NANP) number called Location Routing Number (LRN) is assigned to
+ every switch involved in NP. In the NANP, a switch is not reachable
+ unless it has a unique number range (CO code) assigned to it.
+ Consequently, the LRN for a switch is always assigned out of a CO
+ code that is assigned to that switch.
+
+ The LRN assigned to a switch currently serving a particular ported
+ telephone number is returned as the network routing address in the
+ NPDB response. The service portability scheme that was adopted in
+ the North America is very often referred to as the LRN scheme or
+ method.
+
+ LRN serves as a network address for terminating calls served off
+ that switch using ported numbers. The LRN is assigned by the switch
+ operator using any of the unique CO codes (NPA+NXX) assigned to that
+ switch. The LRN is considered a non-dialable address, as the same
+ 10-digit number value may be assigned to a line on that switch. A
+ switch may have more than one LRN.
+
+ During call routing/processing, a switch performs an NPDB query to
+ obtain the LRN associated with the dialed directory number. NPDB
+ queries are performed for all the dialed directory numbers whose
+ NPA+NXX codes are marked as portable NPA+NXX at that switch. When
+ formulating the ISUP Initial Address Message (IAM) to be sent to the
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 14
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ next switch, the switch puts the ten-digit LRN in the ISUP Called
+ Party Number (CdPN) parameter and the originally dialed directory
+ number in the ISUP Generic Address parameter (GAP). A new code in
+ the GAP was defined to indicate that the address information in the
+ GAP is the dialed directory number. A new bit in the ISUP Forward
+ Call Indicator (FCI) parameter, the Translated Called Number
+ Indicator (TCNI) bit, is set to imply that NPDB query has already
+ been performed. All the switches in the downstream will not perform
+ the NPDB query if the TCNI bit is set.
+
+ When the terminating switch receives the IAM and sees the TCNI bit
+ in the FCI parameter set and its own LRN in the CdPN parameter, it
+ retrieves the originally dialed directory number from the GAP and
+ uses the dialed directory number to terminate the call.
+
+ A dialed directory number with a portable NPA+NXX does not imply
+ that directory number has been ported. The NPDBs currently do not
+ store records for non-ported directory numbers. In that case, the
+ NPDB will return the same dialed directory number instead of the
+ LRN. The switch will then set the TCNI bit but keep the dialed
+ directory number in the CdPN parameter.
+
+ In the real world environment, the Originating Network is not always
+ the one that performs the NPDB query. For example, it is usually
+ the long distance carriers that query the NPDBs for long distance
+ calls. In that case, the Originating Network operated by the local
+ exchange carrier (LEC) simply routes the call to the long distance
+ carrier that is to handle that call. A wireless network acting as
+ the Originating Network can also route the call to the
+ interconnected local exchange carrier network if it does not want to
+ support the NPDB interface at its mobile switches.
+
+
+7.2 Europe
+
+ In Europe, a routing number is prefixed to the dialed directory
+ number. The ISUP CdPN parameter in the IAM will contain the routing
+ prefix and the dialed directory number. For example, United Kingdom
+ uses routing prefixes with the format of 5XXXXX and Italy uses
+ C600XXXXX as the routing prefix. The networks use the information
+ in the ISUP CdPN parameter to route the call to the New/Current
+ Serving Network.
+
+ The routing prefix can identify the Current Serving Network or the
+ Current Serving Switch of a ported number. For the former case,
+ another query to the "internal" NPDB at the Current Serving Network
+ is required to identify the Current Serving Switch before routing
+ the call to that switch. This shields the Current Serving Switch
+ information for a ported number from the other networks at the
+ expense of an additional NPDB query. Another routing number, may be
+ meaningful within the Current Serving Network, will replace the
+ previously prefixed routing number in the ISUP CdPN parameter. For
+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 15
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ the latter case, the call is routed to the Current Serving Switch
+ without an additional NPDB query.
+
+ When the terminating switch receives the IAM and sees its own
+ routing prefix in the CdPN parameter, it retrieves the originally
+ dialed directory number after the routing prefix, and uses the
+ dialed directory number to terminate the call.
+
+ In addition to the addition of the routing prefix to the CdPN
+ parameter, some other information may be added/modified as is listed
+ in the draft ITU-T Recommendation Q.769.1 [ISUP]. Those
+ enhancements in the ISUP to support number portability are briefly
+ described below.
+
+ Three methods can be used to transport the Directory Number (DN) and
+ the Routing Number (RN):
+
+ (a) Two separate parameters with the CdPN parameter containing the
+ RN and a new Called Directory Number (CdDN) parameter containing
+ the DN. A new value for the Nature of Address (NOA) indicator in
+ the CdPN parameter is defined to indicate that the RN is in the
+ CdPN parameter. The switches use the CdPN parameter to route the
+ call as is done today.
+
+ (b) Two separate parameters with the CdPN parameter containing the
+ DN and a new Network Routing Number (NRN) parameter containing
+ the RN. This method requires that the switches use the NRN
+ parameter to route the call.
+
+ (c) Concatenated parameter with the CdPN parameter containing the RN
+ plus the DN. A new Nature of Address (NOA) indicator in the CdPN
+ parameter is defined to indicate that the RN is concatenated with
+ the DN in the CdPN parameter. Some countries may not use new NOA
+ value because the routing prefix does not overlap with the dialed
+ directory numbers. But if the routing prefix overlaps with the
+ dialed directory numbers, a new NOA value must be assigned.
+ Spain uses "XXXXX" as the routing prefix to identify the new
+ serving network and uses a new NOA value of 126.
+
+ There is also a network option to add a new ISUP parameter called
+ Number Portability Forwarding Information parameter. This parameter
+ has a four-bit Number Portability Status Indicator field that can
+ provide an indication whether number portability query is done for
+ the called directory number and whether the called directory number
+ is ported or not if the number portability query is done.
+
+ Please note that all those enhancements are for national use. This
+ is because number portability is supported within a nation. Within
+ each nation, the telecommunications industry or the regulatory
+ bodies can decide which method or methods to use. Number
+ portability related parameters and coding are never passed across
+ the national boundaries.
+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 16
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ As indicated earlier, an originating wireless network can query the
+ NPDB and concatenate the RN with DN in the CdPN parameter and route
+ the call directly to the Current Serving Network.
+
+ If NPDBs do not contain information about the wireless directory
+ numbers, the call, originated from either a wireline or a wireless
+ network, will be routed to the Wireless donor network. Over there,
+ an internal NPDB is queried to retrieve the RN that then is
+ concatenated with the DN in the CdPN parameter.
+
+ If MNP-SRF is supported, the Gateway Mobile Services Switching
+ Center (GMSC) at the wireless donor network, when receiving a call
+ from the wireline network, can send the GSM MAP Send Routing
+ Information (SRI) message to the MNP-SRF. The MNP-SRF interrogates
+ an internal or integrated NPDB for the RN of the MNP-SRF of the
+ wireless Current Serving Network and prefixes the RN to the dialed
+ wireless directory number in the global title address information in
+ the SCCP Called Party Address (CdPA) parameter. This SRI message
+ will be routed to the MNP-SRF of the wireless Current Serving
+ Network, which then responds with an acknowledgement by providing
+ the RN plus the dialed wireless directory number as the Mobile
+ Station Roaming Number (MSRN). The GMSC of the wireless donor
+ network formulates the ISUP IAM with the RN plus the dialed wireless
+ directory number in the CdPN parameter and routes the call to the
+ wireless Current Serving Network. A GMSC of the wireless Current
+ Serving Network receives the call and sends an SRI message to the
+ associated MNP-SRF where the global title address information of the
+ SCCP CdPA parameter contains only the dialed wireless directory
+ number. The MNP-SRF then replaces the global title address
+ information in the SCCP CdPA parameter with the address information
+ associated with a Home Location Register (HLR) that hosts the dialed
+ wireless directory number and forwards the message to that HLR after
+ verifying that the dialed wireless directory number is a ported-in
+ number. The HLR then returns an acknowledgement by providing an
+ MSRN for the GMSC to route the call to the MSC that currently serves
+ the mobile station that is associated with the dialed wireless
+ directory number. Please see [MNP] for details and additional
+ scenarios.
+
+
+8. NP Implementations for Geographic E.164 Numbers
+
+ This section shows the known SPNP implementations worldwide.
+
+ +--------------+---------------------------------------------------+
+ + Country + SPNP Implementation +
+ +-------------+----------------------------------------------------+
+ + Argentina + Analyzing operative viability now. Will determine +
+ + + whether portability should be made obligatory +
+ + + after a technical solution has been determined. +
+ +-------------+----------------------------------------------------+
+ + Australia + NP supported by wireline operators since 11/30/99. +
+ + + NP among wireless operators in March/April 2000, +
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 17
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ + + but may be delayed to 1Q01. The access provider +
+ + + or long distance provider has the obligation to +
+ + + route the call to the correct destination. The +
+ + + donor network is obligated to maintain and make +
+ + + available a register of numbers ported away from +
+ + + its network. Telstra uses onward routing via an +
+ + + on-switch solution. +
+ +-------------+----------------------------------------------------+
+ + Austria + Uses onward routing at the donor network. Routing +
+ + + prefix is "86xx" where xx identifies the recipient +
+ + + switch. +
+ +-------------+----------------------------------------------------+
+ + Belgium + Uses onward routing and ACQ. Routing prefix is +
+ + + "Cxxxx" where "xxxx" identifies the recipient +
+ + + network. +
+ +-------------+----------------------------------------------------+
+ + Brazil + Considering NP for wireless users. +
+ +-------------+----------------------------------------------------+
+ + Chile + There has been discussions lately on NP. +
+ +-------------+----------------------------------------------------+
+ + Colombia + There was an Article 3.1 on NP to support NP prior +
+ + + to December 31, 1999 when NP becomes technically +
+ + + possible. Regulator has not yet issued regulations +
+ + + concerning this matter. +
+ +-------------+----------------------------------------------------+
+ + Denmark + Uses ACQ. Routing number not passed between +
+ + + operators; however, NOA is set to "112" to +
+ + + indicate "ported number." +
+ +-------------+----------------------------------------------------+
+ + Finland + Uses ACQ. Routing prefix is "1Dxxy" where xxy +
+ + + identifies the recipient network. +
+ +-------------+----------------------------------------------------+
+ + France + Uses onward routing. Routing prefix is "Z0xxx" +
+ + + where "xxx" identifies the recipient switch. +
+ +-------------+----------------------------------------------------+
+ + Germany + Uses QoS where the originating network needs to +
+ + + do necessary rerouting. Routing prefix is "Dxxx" +
+ + + where "xxx" identifies the recipient network. +
+ + + Operators use onward routing now. +
+ +-------------+----------------------------------------------------+
+ + Hong Kong + Recipient network informs other networks about +
+ + + ported-in numbers. Routing prefix is "14x" where +
+ + + "14x" identifies the recipient network, or a +
+ + + routing number of "4x" plus 7 or 8 digits is used +
+ + + where "4x" identifies the recipient network and +
+ + + the rest of digits identify the called party. +
+ +-------------+----------------------------------------------------+
+ + Ireland + Uses ACQ and onward routing. Routing prefix is +
+ + + "1750" as the intra-network routing code (network- +
+ + + specfic) and "1752xxx" to "1759xxx" for GNP. +
+ +-------------+----------------------------------------------------+
+ + Italy + Uses onward routing. Routing prefix is "C600xxxxx" +
+ + + where "xxxxx" identifies the recipient switch. +
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 18
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ + + Wireline NP supported in 1/1/00. Wireless NP set +
+ + + for 1/7/99 but has been postponed. Telecom Italia +
+ + + uses IN solution and other operators use on-switch +
+ + + solution. +
+ +-------------+----------------------------------------------------+
+ + Japan + Uses onward routing. Donor switch uses IN to get +
+ + + routing number. +
+ +-------------+----------------------------------------------------+
+ + Mexico + NP is considered in the Telecom law; however, the +
+ + + regulator (Cofetel) or the new local entrants have +
+ + + started no initiatives on this process. +
+ +-------------+----------------------------------------------------+
+ + Netherlands + Operators decide NP scheme to use. Operators have +
+ + + chosen ACQ or QoS. KPN implemented IN solution +
+ + + similar to U.S. solution. Routing prefix is not +
+ + + passed between operators. +
+ +-------------+----------------------------------------------------+
+ + Norway + Uses ACQ. Routing prefix can be "xx" with NOA=7, +
+ + + or "1ZZxx" with NOA=3 where "xx" identifies the +
+ + + recipient network. +
+ +------------ +----------------------------------------------------+
+ + Peru + Wireline NP may be supported in 2001. +
+ +-------------+----------------------------------------------------+
+ + Portugal + No NP today. +
+ +-------------+----------------------------------------------------+
+ + Spain + Operators decide NP scheme to use. Some use ACQ +
+ + + and some others use QoS. Routing prefix is +
+ + + "xxyyzz" where "xxyyzz" identifies the recipient +
+ + + network. NOA is set to 126. Wireline NP +
+ + + available in 2000 and wireless NP available in +
+ + + July 2000. +
+ +-------------+----------------------------------------------------+
+ + Sweden + The telecom industry has standardized the ACQ. +
+ + + Routing prefix is "xxx" with NOA=8 or "394xxx" +
+ + + with NOA=3 where "xxx identifies the recipient +
+ + + network. But operators decide NP scheme to use. +
+ + + Telia uses onward routing between operators. +
+ +-------------+----------------------------------------------------+
+ + Switzerland + Uses ACQ and onward routing. Routing prefix is +
+ + + "980xx" where "xx identifies the recipient +
+ + + network. +
+ +-------------+----------------------------------------------------+
+ + UK + Uses onward routing. Routing prefix is "5xxxxx" +
+ + + where "xxxxx" identifies the recipient switch. NOA +
+ + + is 126. BT uses the dropback scheme in some parts +
+ + + of its network. +
+ +-------------+----------------------------------------------------+
+ + US + Uses ACQ. "Location Routing Number (LRN)" is used +
+ + + in the Called Party Number parameter. Called party+
+ + + number is carried in the Generic Address Parameter +
+ + + Use a dip indicator in the Forward Call Indicator +
+ + + parameter to indicate that NPDB dip has been +
+ + + performed. +
+ +-------------+----------------------------------------------------+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 19
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+
+
+9. Number Conservation Methods Enabled by NP
+
+ In addition to porting numbers NP provides the ability for number
+ administrators to assign numbering resources to operators in smaller
+ increments. Today it is common for numbering resources to be
+ assigned to telephone operators in a large block of consecutive
+ telephone numbers (TNs). For example, in North America each of
+ these blocks contains 10,000 TNs and is of the format NXX+0000 to
+ NXX+9999. Operators are assigned a specific NXX, or block. That
+ operator is referred to as the block holder. In that block there
+ are 10,000 TNs with line numbers ranging from 0000 to 9999.
+
+ Instead of assigning an entire block to the operator NP allows the
+ administrator to assign a sub-block or even an individual telephone
+ number. This is referred to as block pooling and individual
+ telephone number (ITN) pooling, respectively.
+
+9.1 Block Pooling
+
+ Block Pooling refers to the process whereby the number administrator
+ assigns a range of numbers defined by a logical sub-block of the
+ existing block. Using North America as an example, block pooling
+ would allow the administrator to assign sub-blocks of 1,000 TNs to
+ multiple operators. That is, NXX+0000 to NXX+0999 can be assigned
+ to operator A, NXX+1000 to NXX+1999 can be assigned to operator B,
+ NXX-2000 to 2999 can be assigned to operator C, etc. In this
+ example block pooling divides one block of 10,000 TNs into ten
+ blocks of 1,000 TNs.
+
+ Porting the sub-blocks from the block holder enables block pooling.
+ Using the example above operator A is the block holder, as well as,
+ the holder of the first sub-block, NXX+0000 to NXX+0999. The second
+ sub-block, NXX+1000 to NXX+1999, is ported from operator A to
+ operator B. The third sub-block, NXX+2000 to NXX+2999, is ported
+ from operator A to operator C, and so on. NP administrative
+ processes and call processing will enable proper and efficient
+ routing.
+
+ From a number administration and NP administration perspective block
+ pooling introduces a new concept, that of the sub-block holder.
+ Block pooling requires coordination between the number
+ administrator, the NP administrator, the block holder, and the sub-
+ block holder. Block pooling must be implemented in a manner that
+ allows for NP within the sub-blocks. Each TN can have a different
+ serving operator, sub-block holder, and block holder.
+
+9.2 ITN Pooling
+
+ ITN pooling refers to the process whereby the number administrator
+ assigns individual telephone numbers to operators. Using the North
+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 20
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ American example, one block of 10,000 TNs can be divided into 10,000
+ ITNs. ITN is more commonly deployed in freephone services.
+
+ In ITN the block is not assigned to an operator but to a central
+ administrator. The administrator then assigns ITNs to operators.
+ NP administrative processes and call processing will enable proper
+ and efficient routing.
+
+10. Conclusion
+
+ There are three general areas of impact to IP telephony work-in-
+ progress at IETF:
+
+ 1. NP implementation or emulation in IP telephony
+ 2. Interoperation between NP in GSTN and IP telephony
+ 3. Interconnection to NP administrative environment
+
+ A good understanding of how number portability is supported in the
+ GSTN is important when addressing the interworking issues between IP
+ based networks and the GSTN. This is especially important when the
+ IP based network needs to route the calls to the GSTN. As shown in
+ Section 6, there are a variety of standards with various protocol
+ stacks for the switch-to-NPDB interface. Not only that, the
+ national variations of the protocol standards and make it very
+ complicate to deal with in a global environment. If an entity in
+ the IP-based network needs to query those existing NPDBs for routing
+ number information to terminate the calls to the destination GSTN,
+ it would be impractical, if not an impossible, job for that entity
+ to support all those interface standards to access the NPDBs in many
+ countries.
+
+ Several alternatives may address this particular problem. One
+ alternative is to use certain entities in the IP-based networks for
+ dealing with NP query, similar to the International Switches that
+ are used in the GSTN to interwork different national ISUP
+ variations. This will force signaling information associated with
+ the calls to certain NP-capable networks in the terminating GSTN to
+ be routed to those IP entities that support the NP functions. Those
+ IP entities then query the NPDBs in the terminating country. This
+ will limit the number of NPDB interfaces that certain IP entities
+ need to support. Another alternative can be to define a "common"
+ interface to be supported by all the NPDBs so that all the IP
+ entities use that standardized protocol to query them. The
+ existing NPDBs can support this additional interface, or new NPDBs
+ can be deployed that contain the same information but support the
+ common IP interface. The candidates for such a common interface
+ include Lightweight Directory Access Protocol (LDAP) and SIP
+ [SIP](e.g., using the SIP redirection capability).
+
+ IP-based networks can handle the domestic calls between two GSTNs.
+ If the originating GSTN has performed NPDB query, SIP will need to
+ transport and make use of some of the ISUP signaling information
+ even if ISUP signaling may be encapsulated in SIP. Also, IP-based
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 21
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ networks may perform the NPDB queries, as the N-1 carrier. In that
+ case, SIP also needs to transport the NP related information while
+ the call is being routed to the destination GSTN. There are three
+ pieces of NP related information that SIP needs to transport. They
+ are 1) the called directory number, 2) a routing number, and 3) a
+ NPDB dip indicator. The NPDB dip indicator is needed so that the
+ terminating GSTN will not perform another NPDB dip. The routing
+ number is needed so that it is used to route the call to the
+ destination network or switch in the destination GSTN. The called
+ directory number is needed so that the terminating GSTN switch can
+ terminate the call. When the routing number is present, the NPDB
+ dip indicator may not be present because there are cases where
+ routing number is added for routing the call even if NP is not
+ involved. One issue is how to transport the NP related information
+ via SIP. The SIP Universal Resource Locator (URL) is one mechanism.
+ Another better choice may be to add an extension to the "tel" URL
+ [TEL] that is also supported by SIP. If the called directory is +1-
+ 202-533-1234, and its associated routing number is +1-202-544-0000,
+ the "tel" URL may look like tel:+1-202-533-1234;rn=+1-202-544-
+ 0000;npdi=yes where "rn" stands for "routing number" and "npdi"
+ stands for "NPDB dip indicator." "rn" and "npdi" will be two new
+ parameters to be added as extensions to the "tel" URL to support NP.
+ Since the "fax" URL is similar to the "tel" URL where NP can impact
+ the fax calls as well as the telephone calls, the same extensions to
+ the "tel" URL need to be applied to the "fax" URL as well.
+
+ For a called directory number that belongs to a country that
+ supports NP, and if the IP-based network is to perform the NPDB
+ query, the logical step is to perform the NPDB dip first to retrieve
+ the routing number and use that routing number to select the correct
+ IP telephony gateways that can reach the serving switch that serves
+ the called directory number. Therefor, if the "rn" parameter is
+ present in the "tel" URL in the SIP INVITE message, it instead of
+ the called directory number should be used for making routing
+ decisions. If "rn" is not present, then the dialed directory number
+ can be used as the routing number for making routing decisions
+ [TEL].
+
+ Telephony Routing Information Protocol (TRIP) [TRIP] is a policy
+ driven inter-administrative domain protocol for advertising the
+ reachability of telephony destinations between location servers, and
+ for advertising attributes of the routes to those destinations.
+ With the NP in mind, it is very important to know that it is the
+ routing number,if present, not the called directory number that
+ should be used to check against the TRIP tables for making the
+ routing decisions.
+
+ Overlap signaling exists in the GSTN today. For a call routing from
+ the originating GSTN to the IP-based network that involves overlap
+ signaling, NP will impact the call processing within the IP-based
+ networks if they must deal with the overlap signaling. The entities
+ in the IP-based networks that are to retrieve the NP information
+ (e.g., the routing number) must collect a complete called directory
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 22
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ number information before retrieving the NP information for a ported
+ number. Otherwise, the information retrieval won't be successful.
+ This is an issue for the IP-based networks if the originating GSTN
+ does not handle the overlap signaling and collect the complete
+ called directory number.
+
+ The IETF enum working group is defining the use of Domain Name
+ System (DNS) for identifying available services associated with a
+ particular E.164 number [ENUM]. [ENUMPO] outlines the principles
+ for the operation of a telephone number service that resolves
+ telephone numbers into Internet domain name addresses and service-
+ specific directory discovery. [ENUMPO] implements a three-level
+ approach where the first level is the mapping of the telephone
+ number delegation tree to the authority to which the number has been
+ delegated, the second level is the provision of the requested DNS
+ resource records from a service registrar, and the third level is
+ the provision of service specific data from the service provider
+ itself. NP certainly must be considered at the first level because
+ the telephony service providers do not "own" or control the
+ telephone numbers under the NP environment; therefore, they may not
+ be the proper entities to have the authority for a given E.164
+ number. Not only that, the donor network should not be relied on to
+ reach the delegated authority during the DNS process because there
+ is a regulatory requirement on NP in some countries. The delegated
+ authority for a given E.164 number is likely to be an entity
+ designated by the end user that owns/controls a specific telephone
+ number or a third-party designated by the end-user or by the
+ industry.
+
+ The IP-based networks also may need to support some forms of number
+ portability in the future if E.164 numbers [E164] are assigned to
+ the IP-based end users. One method is to assign a GSTN routing
+ number for each IP-based network domain or entity in a NP-capable
+ country. This may increase the number of digits in the routing
+ number to incorporate the IP entities and impact the existing
+ routing in the GSTN. Another method is to associate each IP entity
+ with a particular GSTN gateway. At that particular GSTN gateway,
+ the called directory number then is used to locate the IP-entity
+ that serves that dialed directory number. Yet, another method can
+ be to assign a special routing number so that the call to an end
+ user currently served by an IP entity is routed to the nearest GSTN
+ gateway. The called directory number then is used to locate the IP-
+ entity that serves that dialed directory number. Then a mechanism
+ is developed for the IP-based network to locate the IP entity that
+ serves a particular dialed directory number. Many other types of
+ networks use E.164 numbers to identify the end users or terminals in
+ those networks. Number portability among GSTN, IP-based network and
+ those various types of networks may also need to be supported in the
+ future.
+
+
+
+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 23
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+
+11. References
+
+ [ANSI OSS] ANSI Technical Requirements No. 1, "Number Portability -
+ Operator Services Switching Systems," April 1999.
+
+ [ANSI SS] ANSI Technical Requirements No. 2, "Number Portability -
+ Switching Systems," April 1999.
+
+ [ANSI DB] ANSI Technical Requirements No. 3, "Number Portability
+ Database and Global Title Translation," April 1999.
+
+ [CS1] ITU-T Q-series Recommendations - Supplement 4, "Number
+ portability Capability set 1 requirements for service provider
+ portability (All call query and onward routing)," May 1998.
+
+ [CS2] ITU-T Q-series Recommendations - Supplement 5, "Number
+ portability -Capability set 2 requirements for service provider
+ portability (Query on release and Dropback)," March 1999.
+
+ [E164] ITU-T Recommendation E.164, "The International Public
+ Telecommunications Numbering Plan," 1997.
+
+ [ENUM] P. Falstrom, "E.164 number and DNS," draft-ietf-enum-e164-
+ dns-00, April 25, 2000.
+
+ [ENUMPO] A. Brown and G. Vaudreuil, "ENUM Service Specific
+ Provisioning: Principles of Operations," April 27, 2000.
+
+ [FRS] NANC, "Functional Requirements Specification - NPAC SMS,
+ Version 2.0.2," September 1, 1999.
+
+ [GSM] GSM 09.02: "Digital cellular telecommunications system (Phase
+ 2+); Mobile Application Part (MAP) specification".
+
+
+ [ICC] ICC, "Generic Switching & Signaling Requirements for Number
+ Portability, Issue 1.05," August 1, 1997.
+
+ [IIS] NeuStar (formerly Lockheed Martin IMS Corporation), prepared
+ for the North American Numbering Council (NANC),"NPAC SMS
+ interoperable Interface Specification, Version 2.0.2,"
+ September 1, 1999.
+
+ [IS41] TIA/EIA IS-756 Rev. A, "TIA/EIA-41-D Enhancements for
+ Wireless Number Portability Phase II (December 1998)"Number
+ Portability Network Support," April 1998.
+
+ [ISUP] ITU-T COM 11-R 162-E, Draft Recommendation Q.769.1,
+ "Signaling System No. 7 - ISDN User Part Enhancements for the
+ Support of Number Portability," May 1999.
+
+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 24
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ [MNP] Draft GSM 03.66 V7.2.0 (1999-11) European Standard
+ (Telecommunications series) Digital cellular telecommunications
+ system (Phase 2+); Support of Mobile Number Portability (MNP);
+ Technical Realisation; Stage 2; (GSM 03.66 Version 7.2.0
+ Release 1998).
+
+ [RFC] Scott Bradner, RFC2026, "The Internet Standards Process --
+ Revision 3," October 1996.
+
+ [TEL] A. Vaha-Sipila, RFC2806, "URLs for Telephone Calls," April
+ 2000.
+
+ [SIP] M. Handley, H. Schulzrinne, E. Schooler and J. Rosenberg, RFC
+ 2543, "SIP: Session Initiation Protocl," March 1999.
+
+ [TEL] J. Yu, draft-yu-tel-url-00.txt, " Extensions to the "tel" and
+ "fax" URLs to Support Number Portability," July 2000, Work in
+ Progress.
+ [TRIP] J. Rosenberg, H. Salama and M. Squire, draft-ietf-iptel-trip-
+ 02.txt, "Telephony Routing Information Protocol (TRIP)," May
+ 2000.
+
+
+12. Acknowledgments
+
+ The authors would like to thank Monika Muench for providing
+ reference information on ISUP and MNP.
+
+
+13. Author's Addresses
+
+ Mark D. Foster
+ NeuStar, Inc.
+ 1120 Vermont Avenue, NW,
+ Suite 550
+ Washington, D.C. 20005
+ United States
+
+ Phone: +1-202-533-2800
+ Fax: +1-202-533-2975
+ Email: mark.foster@neustar.com
+
+
+ Tom McGarry
+ NeuStar, Inc.
+ 1120 Vermont Avenue, NW,
+ Suite 550
+ Washington, D.C. 20005
+ United States
+
+ Phone: +1-202-533-2810
+ Fax: +1-202-533-2975
+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 25
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+
+ James Yu
+ NeuStar, Inc.
+ 1120 Vermont Avenue, NW,
+ Suite 550
+ Washington, D.C. 20005
+ United States
+
+ Phone: +1-202-533-2814
+ Fax: +1-202-533-2975
+ Email: james.yu@neustar.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 26
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+APPENDICES
+
+APPENDIX A. NP Requirements in the North America
+
+A.1 Background
+
+ The North American telecommunications industry began to seriously
+ investigate methods of providing local number portability (LNP) in
+ late 1994. On July 13, 1995, the Federal Communications Commission
+ (FCC) in the U.S. issued a Notice of Proposed Rulemaking (NPRM) FCC
+ Docket Number 95-116 that opened discussion on NP and sought
+ comments on a wide variety of policy and technical issues related to
+ NP.
+
+ In 1995 and 1996 several state regulatory bodies, notably the
+ Illinois Commerce Commission (ICC), began the process of officially
+ selecting the architecture to be used for NP in their respective
+ states. After considerable discussion and deliberation, the
+ "Location Routing Number (LRN)" scheme was selected by Illinois, and
+ other states. The switching and signaling requirements for number
+ portability developed in the Illinois LNP workshop under the
+ auspices of the ICC became the basis of the de facto North American
+ industry standards [ICC]. The activities on number portability in
+ the North America also interacted with activities in many other
+ parts of world.
+
+A.2 Performance/Legal/Regulatory Requirements
+
+ After substantial industry discussion and debate, and extensive
+ comments filed with the FCC, the FCC and the US telecommunications
+ industry set the following minimum performance criteria for LNP:
+
+ 1. Support existing network services, features and capabilities.
+ 2. Efficiently use numbering resources.
+ 3. Not require end users to change their telecommunication numbers.
+ 4. Not require telecommunications carrier to rely on databases,
+ other network facilities, or services provided by other
+ telecommunications carriers in order to route calls to proper
+ termination point.
+ 5. Not result in unreasonable degradation in service quality or
+ network reliability when implemented.
+ 6. Not result in unreasonable degradation of service quality or
+ network reliability when customers switch carriers.
+ 7. Not result in a carrier having a proprietary interest.
+ 8. Be able to accommodate location and service portability in the
+ future.
+ 9. Have no significant adverse impact outside areas where number
+ portability is deployed.
+
+ In July 1996, the FCC issued the First Report and Order on LNP under
+ 95-116, calling for the deployment of LNP across the US starting in
+ 1997. The FCC did not mandate any specific implementation of LNP in
+ the US, but it did call upon the industry to develop and endorse a
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 27
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ national standard that would ensure interoperability with all
+ industry segments, including wireless. While providing overall
+ guidelines and requirements for LNP, it did explicitly state that
+ the LRN method met these requirements, whereas alternate proposals
+ (such as QoR) did not.
+
+ A core requirement was that a carrier who is serving ported numbers
+ need not be reliant on any other carrier (especially the donor
+ network) for completing calls, whether for call transport/routing or
+ for signaling. That's not to say that a carrier couldn't
+ voluntarily opt to use another carrier or the donor network for
+ queries or call routing. But the key is voluntarily. This
+ requirement was imposed on all NP implementations in the U.S. for
+ common carrier telephony services regardless of the network
+ technology employed.
+
+ Similar requirements were adopted by the Canadian Radio and
+ Television Commission (CRTC), the equivalent of the FCC in Canada,
+ and in a number of regulatory and industry bodies in other countries
+ (e.g., Belgium, Denmark, Spain, Switzerland) which resulted in the
+ use of centralized NPDBs to support number portability.
+
+ In the U.S. and Canada, the ACQ scheme was adopted because it does
+ not rely on the donor network for call routing (see requirements
+ numbers 4 and 7) and it can accommodate location and service
+ portability in the future.
+
+ In the U.S. and Canada, there is also the "N-1" guideline that
+ recommends that the network next to the destination network perform
+ the NPDB query if the NPDB query has not been done or the routing
+ information is not available (e.g., due to signaling interworking).
+ This is to prevent the call from being re-routed at the donor
+ network. In the U.S., the wireline carriers are required to support
+ NP in certain service areas in phases. The wireless carriers'
+ support of NP has been postponed until November 2002.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 28
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+APPENDIX B. NP Administration Process in the North America
+
+ B.1 Business Model
+
+ Figure B.1 shows the NP business model that was adopted in the U.S.
+ and Canada. The U.S. is divided into seven regions coinciding with
+ the boundaries of the original seven Regional Bell Operating Company
+ (RBOC) regions. This was done to facilitate the formation of
+ separate contracting and administrative areas (formed as limited
+ liability companies) for LNP in the US intentionally coinciding with
+ the original RBOC boundaries, thus enabling each RBOC to participate
+ singly in each of these areas.
+
+ NeuStar, Inc., formerly the Communication Industry Services business
+ unit with Lockheed Martin IMS, was selected in open competitive
+ procurements conducted by the industry to be the Number Portability
+ Administration Center (NPAC) provider for all the seven NPAC regions
+ (Midwest, Northeast, Mid-Atlantic, Southwest, Southeast, Western,
+ and West Coast) in the U.S. Lockheed Martin was subsequently named
+ as the NPAC provider in Canada as well. Each Limited Liability
+ Corp. (LLC) in the seven U.S. regions and Canadian Consortium
+ maintain largely identical contracts with NeuStar covering each
+ region.
+
+ The FCC and North American Numbering Council (NANC) oversee the
+ technical and operational standards, originally developed by
+ Lockheed Martin and offered as open industry standards, and cost
+ recovery rulemakings.
+ Each LLC signed a master contract with NeuStar that set the prices
+ and terms and provided the form of User Agreement for NeuStar to
+ sign with each individual NPAC user. NPAC users are any bona fide
+ entity that either ports numbers or subscribes to updates to the
+ NPDB provided by the NPAC.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 29
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+
+ +--------+ +----------+
+ | FCC |------------>| State |
+ | NANC |<---+ +--->| PUCs |
+ +--------+ | | +----------+
+ | |
+ v v (Master
+ +--------------+ Agreement) +----------+
+ | Regional LLC |<----------->| NPAC |
+ | Contract | | (NeuStar)|
+ | Administrator| +----------+
+ +--------------+ ^
+ ^ |
+ | |
+ v |
+ +----------+ |
+ | NPAC |<------------------+
+ | Users | (One User Agreement per User)
+ +----------+
+
+ Figure B.1 - NP Administration Business Model in US.
+
+
+ The User Agreements come under the Master Agreements and must be
+ signed by the individual Customers who wish to use NPAC services.
+ If a Customer plans on operating in more than one region, the
+ Customer must sign a separate User Agreement for each of the regions
+ where operations will take place.
+
+ The Interconnect Plan is another NeuStar confidential document that
+ the Customer must sign and return. This document provides an
+ overview of the customer interconnection to the NPAC.
+
+ The new customer process is shown below.
+
+ - Customer contacts Chicago NPAC (Help Desk) to request information.
+ - Introduction Package (Application, Non-Disclosure Agreement) sent
+ to customer.
+ - Customer signs and returns Non-disclosure Agreement.
+ - Master Agreement, User Agreement and Interconnect Plan sent to
+ Customer.
+ - Customer signs and returns User Agreement.
+ - Customer signs and returns Interconnect Plan.
+ - Customer data entered.
+
+
+B.2 NPAC Architecture
+
+ Figure B.2 shows the architecture for number portability
+ administration in the U.S. and Canada. NeuStar is the NPAC Service
+ Management System (SMS) service provider in the architecture
+ diagram.
+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 30
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+ (Carrier Facilities) : (NPAC Facilities)
+ +---------+ :
+ | SOA | :
+ | |-------------------+
+ +---------+ : |
+ : |
+ : +----------+
+ : | NPAC/SMS |
+ : | (NeuStar)|
+ : +----------+
+ : |
+ +---------+ +---------+ : |
+ | NPDB |---------| LSMS |-------------------+
+ |(e.g.SCP)| | | :
+ +---------+ +---------+ :
+ :
+
+ Figure B.2 - NPAC Architecture.
+
+
+ The interface between the Service Order Administration (SOA) and the
+ NPAC/SMS is for provisioning ported end-user data including the
+ support of the creation, cancellation, retrieval and update of
+ subscription, service provider, and network information. The SOAs
+ are operated by the local exchange carriers.
+
+ The interface between the Local Service Management System (LSMS) and
+ the NPAC/SMS is mainly used for downloading ported number
+ information from the NPAC/SMS to the LSMS. The LSMS then updates
+ the NPDB. A local exchange carrier may operate the LSMS if it
+ decides to deploy an NPDB itself. A service bureau can also operate
+ the LSMS to provision several LECs' NPDBs or operate the LSMS and
+ the NPDB for the operators (e.g., LECs or long distance carriers) to
+ query. The interface between the LSMS and the NPDB is up to the
+ entities that operate them.
+
+ The functional requirement specification developed under the
+ auspices of the North American Numbering Council (NANC) defines the
+ external functionality of the NPAC SMS [FRS]. The interfaces
+ between the NPAC/SMS and the SOA or LSMS use standards-based
+ communications and security technologies and are made public [IIS].
+ Please note that only the information about the ported numbers is
+ stored at the NPAC databases and the NPDBs at present.
+
+B.3 NPAC SMS Functions
+
+ This section provides a list of the NPAC SMS functions. Please see
+ [FRS] for details.
+
+ - Provisioning Service: For the new service provider to notify the
+ NPAC SMS of a provision request for a ported number and to send an
+ activation notice to activate the update from the NPAC SMS to the
+ LSMS.
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 31
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+
+ - Disconnect Service: For handling disconnection of the telephony
+ service for a ported number.
+
+ - Repair Service: For resolving problems detected either by a Service
+ Provider or by a customer contacting a Service Provider.
+
+ - Conflict Resolution: For resolving a conflict when there is
+ disagreement between the old and new Service Providers as to who
+ will be providing service for the telephone number (TN). Please
+ note that the processes for obtaining authorization from the
+ customer to port a number are defined by the Service Providers.
+ The NPAC is not involved in obtaining or verifying customer
+ approval to port a telephone number.
+
+ - Disaster Recovery and Backup: For having a backup facility and the
+ disaster recovery procedures in place for planned and unplanned
+ downtime at the primary facility.
+
+ - Order Cancellation: For the new Service Provider to cancel a
+ previously submitted but not activated provision request.
+
+ - Audit Request: For troubleshooting customer problems and also as a
+ maintenance process to ensure data integrity across the entire NP
+ network.
+
+ - Report Request: For supporting report generation for pre-defined
+ and ad-hoc reports.
+
+ - Data Management: For managing network, Service Provider, and
+ customer subscription data. The network data defines the
+ configuration of the NP service and network and includes such data
+ as: participating Service Providers, NPA-NXXs that are portable,
+ and LRNs associated with each Service Provider. The Service
+ Provider data indicates who the NP Service Providers are and
+ includes location, contact name, security, routing, and network
+ interface information. The subscription data indicates how local
+ number portability should operate to meet subscribers' needs.
+
+ - NPA-NXX Split Processing: For the administration of the
+ information for NPA split (the current NPA, the new NPA, and the
+ affected NXXs) plus the beginning and end date of the permissive
+ dialing period.
+
+ - Business Support: For supporting service providers that have
+ different needs for business hours and days available for porting.
+
+ - Notification Recovery: For allowing a Service Provider to capture,
+ via a recovery process, all notifications that were missed during
+ a downtime period for the Service Provider.
+
+
+B.4 Cost Recovery
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 32
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+
+ In the FCC's Third Report and Order, adopted May 5, 1998, released
+ May 12, 1998 and published in the Federal Registry July 29, 1998 the
+ Commission implemented section 251(e)(2) with regards to the costs
+ of providing long-term number portability. Section 251(e)(2) of the
+ Communications Act of 1934 (1934 Act), as amended requires that "the
+ cost of establishing telecommunications numbering administration
+ arrangements and number portability shall be borne by all
+ telecommunications carriers on a competitively neutral basis as
+ determined by the Commission."
+
+ The costs can be categorized below.
+
+ - Share costs incurred by industry as a whole for the NPACs:
+ * Non-recurring costs, e.g., administrator costs to implement
+ database hardware and software.
+ * Recurring costs, e.g., administrator costs to administer the
+ databases.
+ * Costs incurred by administrators to upload and download data to
+ and from databases. Shared costs of each regional database
+ distributed among telecommunications carriers with revenue
+ derived from providing telecommunications service in the area
+ served by the database, in proportion to carrier's share of
+ revenue for the region. Carriers without such revenue assessed
+ $100 per year.
+
+ - Carrier-specific costs incurred by each carrier that directly
+ relates to providing NP, e.g., querying calls, porting telephone
+ numbers between carriers.
+ * Dedicated costs, e.g., number portability software, NPDBs and
+ STPs reserved exclusively for NP.
+ * Joint costs, e.g., software generics, switch hardware, Operation
+ Support System (OSS), SS7 or AIN upgrade, incremental to
+ providing NP. Carriers may include incremental overhead incurred
+ specifically in providing NP.
+
+ Incumbent LECs may recover costs directly related to providing NP
+ through federally tariffed charges that can be query-service
+ charges, prearranged and default, and monthly end-user charges. For
+ example, the end-users in the metropolitan D.C. area pay 23 cents
+ per month for NP surcharge. Carriers, other than incumbent LECs, may
+ recover costs in any manner consistent with state and federal laws
+ and regulations.
+
+
+
+
+
+
+
+
+
+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 33
+
+ Number Portability in the GSTN: An Overview July 2000
+
+
+
+Full Copyright Statement
+
+ "Copyright (C) The Internet Society (date). All Rights Reserved.
+ This document and translations of it may be copied and furnished to
+ others, and derivative works that comment on or otherwise explain it
+ or assist in its implementation may be prepared, copied, published
+ and distributed, in whole or in part, without restriction of any
+ kind, provided that the above copyright notice and this paragraph
+ are included on all such copies and derivative works. However, this
+ document itself may not be modified in any way, such as by removing
+ the copyright notice or references to the Internet Society or other
+ Internet organizations, except as needed for the purpose of
+ developing Internet standards in which case the procedures for
+ copyrights defined in the Internet Standards process must be
+ followed, or as required to translate it into.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<Foster,McGarry,Yu> Informational - Expiration in January 2001 34
+
diff --git a/doc/draft/draft-ietf-enum-e164s2-np-00.txt b/doc/draft/draft-ietf-enum-e164s2-np-00.txt
new file mode 100644
index 00000000..136872b6
--- /dev/null
+++ b/doc/draft/draft-ietf-enum-e164s2-np-00.txt
@@ -0,0 +1,1596 @@
+
+ENUM Working Group A. Gallant
+Internet Draft Comsat Corporation
+Expires: January 6, 2001 July 7, 2000
+
+
+ The Number Portability Supplement to ITU-T Recommendation E.164
+ <draft-ietf-enum-e164s2-np-00.txt>
+
+
+Status of this Memo
+
+ This document is an Internet-Draft and is in full conformance with
+ all provisions of Section 10 of RFC2026 [1].
+
+ Internet-Drafts are working documents of the Internet Engineering
+ Task Force (IETF), its areas, and its working groups. Note that
+ other groups may also distribute working documents as Internet-
+ Drafts. Internet-Drafts are draft documents valid for a maximum of
+ six months and may be updated, replaced, or obsoleted by other
+ documents at any time. It is inappropriate to use Internet-Drafts
+ as reference material or to cite them other than as "work in
+ progress."
+
+ The list of current Internet-Drafts can be accessed at
+ http://www.ietf.org/ietf/1id-abstracts.txt.
+
+ The list of Internet-Draft Shadow Directories can be accessed at
+ http://www.ietf.org/shadow.html.
+
+
+1. Abstract
+
+ This document contains a text version of the Number Portability
+ Supplement (11/98) to ITU-T Recommendation E.164 (The international
+ public telecommunication numbering plan, 05/97) [2]. That
+ Supplement [3] defined terminology for number portability within an
+ E.164 numbering scheme; identified formats, call flows,
+ architectures, and routing approaches for some methods; and gave
+ examples of some processes needed to implement number portability.
+
+ A January 2000 workshop on IP-Telecomms interworking (focused on
+ numbering, naming, addressing, and routing) identified issues to be
+ addressed by the IETF and/or the ITU [4]. This Supplement was noted
+ as a document related to a joint IETF/ITU issue on E.164 number
+ portability. A text version was posted on the ITU's web site in
+ March 2000 and notified to the itu+ietf and enum mailing lists.
+
+ This Internet Draft is being submitted to support work of the ENUM
+ (Telephone Number Mapping) Working Group on impacts of local number
+ portability on a DNS-based architecture and protocols for mapping a
+ telephone number to a set of attributes (e.g., URLs) [5].
+
+
+
+Gallant Expires January 6, 2001 1
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+2. Convention used in this document
+
+ "e164s2" below flags the section numbering from the ITU original.
+
+
+3. Table of Contents
+
+ Status of this Memo . . . . . . . . . . . . . . . . . . . . . . . 1
+ 1. Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
+ 2. Convention Used in this Document . . . . . . . . . . . . . . . 2
+ 3. Table of Contents . . . . . . . . . . . . . . . . . . . . . . 2
+ 4. Text Version of the Number Portability Supplement . . . . . . 3
+ (e164s2) 1 Scope . . . . . . . . . . . . . . . . . . . . . . . . 3
+ (e164s2) 2 References . . . . . . . . . . . . . . . . . . . . . . 3
+ (e164s2) 3 Definitions and abbreviations . . . . . . . . . . . . 3
+ (e164s2) 4 E.164 number structures . . . . . . . . . . . . . . . 6
+ (e164s2) 4.1 International public telecommunication number for
+ geographic areas . . . . . . . . . . . . . . . . . . 7
+ (e164s2) 4.2 International public telecommunication number for
+ global services . . . . . . . . . . . . . . . . . . 7
+ (e164s2) 4.3 International public telecommunication number for
+ networks . . . . . . . . . . . . . . . . . . . . . . 8
+ (e164s2) 5 Number portability types . . . . . . . . . . . . . . . 8
+ (e164s2) 6 Generic implementation of number portability . . . . . 11
+ (e164s2) 7 Entities addressed by routing . . . . . . . . . . . . 12
+ (e164s2) 8 Number portability mechanisms . . . . . . . . . . . . 13
+ (e164s2) 8.1 Assumptions . . . . . . . . . . . . . . . . . . . . 13
+ (e164s2) 8.2 General description . . . . . . . . . . . . . . . . 13
+ (e164s2) 9 Types of addresses and numbers _ within networks and
+ across network boundaries . . . . . . . . . . . . . . 18
+ (e164s2) 9.1 Concatenated address . . . . . . . . . . . . . . . . 19
+ (e164s2) 9.2 Separated addresses . . . . . . . . . . . . . . . . 21
+ (e164s2) 9.3 RN only . . . . . . . . . . . . . . . . . . . . . . 22
+ (e164s2) 9.4 Only DN (normally across network boundaries) . . . . 22
+ (e164s2) 10 Combinations of addressing types, addressed entities
+ and mechanisms: general signalling requirements . . . 23
+ (e164s2) 11 Examples of locations of number portability
+ database(s) within networks . . . . . . . . . . . . . 24
+ (e164s2) 12 Administrative processes . . . . . . . . . . . . . . 25
+ 5. Front Matter from the ITU-T Published Version . . . . . . . . 26
+ 6. Security Considerations . . . . . . . . . . . . . . . . . . . 27
+ 7. References . . . . . . . . . . . . . . . . . . . . . . . . . . 27
+ 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 28
+ 9. Author's Address . . . . . . . . . . . . . . . . . . . . . . . 28
+ 10. Full Copyright Statement . . . . . . . . . . . . . . . . . . 28
+
+
+
+
+
+
+
+
+Gallant Expires January 6, 2001 2
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+4. Text Version of the Number Portability Supplement
+
+ This section contains the text of the Rec. E.164 Supplement on
+ Number Portability. It also contains text versions of all figures
+ and tables. The front matter of the ITU-T published version is
+ found in Section 6 of this document.
+
+ --------------------------------------------------------------------
+ SUPPLEMENT 2 to Recommendation E.164 (The international
+ public telecommunication numbering plan)
+
+ Number Portability
+ (Geneva, 1998)
+
+ (e164s2) 1 Scope
+
+ This Supplement defines standard terminology for a common
+ understanding of the different aspects of number portability within
+ an E.164 numbering scheme. It identifies numbering and addressing
+ formats, call flows, network architectures and routing approaches
+ that will provide alternative methods of implementation. It also
+ proposes some examples of the administrative and operational
+ processes required for the successful implementation of number
+ portability.
+
+ (e164s2) 2 References
+
+ - ITU-T Recommendation E.164 (1997), The international public
+ telecommunication numbering plan.
+
+ (e164s2) 3 Definitions and abbreviations
+
+ (e164s2) 3.1 Definitions
+
+ The following definitions and terms used in this Supplement are to
+ be used within the context of number portability.
+
+ (e164s2) 3.1.1 address (taken from E.164): A string or combination
+ of decimal digits, symbols and additional information which
+ identifies the specific termination point(s) of a connection in a
+ public network(s) or, where applicable, in interconnected private
+ network(s).
+
+ (e164s2) 3.1.2 directory number: See end user's number.
+
+ (e164s2) 3.1.3 donor network/exchange: The initial
+ network/exchange where a number was located before ever being
+ ported.
+
+ (e164s2) 3.1.4 donor service provider: The service provider from
+ whom the number was initially ported.
+
+
+Gallant Expires January 6, 2001 3
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+
+ (e164s2) 3.1.5 end user's number: The E.164 number used by the
+ calling party to establish a call to the end user. This number is
+ also used for presentation services like Calling Line Identification
+ (CLI) and Connected Line Identification Presentation (COLP).
+
+ The end user's number is equivalent to a directory number.
+
+ (e164s2) 3.1.6 Geographic Number (GN): An E.164 number which
+ corresponds to a discrete geographic area.
+
+ (e164s2) 3.1.7 location portability: The ability of an end user to
+ retain the same E.164 international public telecommunication number
+ when moving from one location to another.
+
+ (e164s2) 3.1.8 network operator: An entity that operates a network
+ in order to route calls.
+
+ (e164s2) 3.1.9 Non-Geographic Number (NGN): An E.164 number which
+ has no geographic significance.
+
+ (e164s2) 3.1.10 numbering plan: A numbering plan specifies the
+ format and structure of the numbers used within that plan. It
+ typically consists of decimal digits segmented into groups in order
+ to identify specific elements used for identification, routing and
+ charging capabilities, e.g. within E.164 to identify countries,
+ national destinations and subscribers.
+
+ A numbering plan does not include prefixes, suffixes and additional
+ information required to complete a call.
+
+ The national numbering plan is the national implementation of the
+ E.164 numbering plan.
+
+ (e164s2) 3.1.11 originating network/exchange: The network/exchange
+ serving a calling end user.
+
+ (e164s2) 3.1.12 portable number: An entire E.164 number identified
+ by an appropriate authority which is subject to number portability.
+
+ (e164s2) 3.1.13 ported number: An end user's E.164 number that has
+ been subject to number portability.
+
+ (e164s2) 3.1.14 recipient network/exchange: The network/exchange
+ where a number is located after being ported. [Footnote: The
+ recipient exchange may consist of a central processor and both co-
+ located and remote concentrator units. The routing number may
+ identify either this whole ensemble or a specific concentrator (in
+ which case the ensemble may use several different routing numbers).]
+
+
+
+
+Gallant Expires January 6, 2001 4
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ (e164s2) 3.1.15 recipient service provider: The service provider to
+ whom the number is ported.
+
+ (e164s2) 3.1.16 routing number: A number that is derived and used
+ by the network to route the call towards a ported number.
+
+ Four types of entities can be indicated by routing numbers as
+ follows:
+
+ - Recipient network: The routing number identifies the network
+ where the customer is now located. Therefore the routing process
+ will need additional information (i.e. DN) to be completed.
+
+ - Recipient exchange: The routing number identifies the exchange
+ where the customer is now located. Therefore the routing process
+ within the recipient exchange will need additional information (i.e.
+ DN) to be completed.
+
+ - Point of interconnection: The routing number identifies an
+ interface to the next network in the routing process. Therefore the
+ routing process will need additional information (i.e. DN) to be
+ completed.
+
+ - Network termination point: The routing number identifies the
+ subscriber/access line/service. The ported customer identified by
+ the RN is unique. Therefore the routing process in terms of number
+ portability can be completed without any additional information.
+
+ (e164s2) 3.1.17 serving network(s)/exchange(s): The
+ network(s)/exchange(s) that determines the status of a number in an
+ environment capable of supporting number portability and, if
+ necessary, obtains the routing information for ported numbers. The
+ functionality to provide these capabilities may reside in either the
+ originating, donor, recipient or transit network/exchange or in some
+ combination.
+
+ (e164s2) 3.1.18 service number: A non-geographic E.164 number
+ allocated to a specific category of services.
+
+ (e164s2) 3.1.19 service portability: The ability of an end user to
+ retain the same E.164 international public telecommunication number
+ when changing from one type of service to another.
+
+ (e164s2) 3.1.20 service provider: An entity that offers services to
+ users involving the use of network resources.
+
+ (e164s2) 3.1.21 service provider portability: The ability of an end
+ user to retain the same E.164 international public telecommunication
+ number when changing from one service provider to another.
+
+
+
+
+Gallant Expires January 6, 2001 5
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ (e164s2) 3.1.22 service provider portability for geographic
+ numbers: The ability of an end user to retain the same geographic
+ E.164 international public telecommunication number when changing
+ from one service provider to another without changing their location
+ and without changing the nature of the service offered.
+
+ (e164s2) 3.1.23 service provider portability for non-geographic
+ numbers: The ability of an end user to retain the same non-
+ geographic E.164 international public telecommunications number when
+ changing from one service provider to another without changing the
+ nature of the service offered.
+
+ (e164s2) 3.1.24 transit network(s)/exchange(s): A network/exchange
+ between two networks.
+
+ (e164s2) 3.2 Abbreviations
+
+ CCBS Completion of Calls to Busy Subscriber
+ DDI Direct-Dialling-In
+ DN Directory Number
+ GNP Geographic Number Portability
+ IN Intelligent Network
+ MSN Multiple Subscriber Number
+ NGNP Non-Geographic Number Portability
+ RN Routing Number
+ SP Service Provider
+
+ (e164s2) 4 E.164 number structures
+
+ This clause identifies three different structures for the
+ international public telecommunication number:
+
+ - international public telecommunication number for geographic
+ areas;
+ - international public telecommunication number for global
+ services;
+ - international public telecommunication number for networks.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Gallant Expires January 6, 2001 6
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ (e164s2) 4.1 International public telecommunication number for
+ geographic areas
+
+ +-------------+ +-----------------+ +---------------------+
+ | CC | | NDC | | SN |
+ +-------------+ +-----------------+ +---------------------+
+ | | | |
+ |1 to 3 digits| | Max (15-n) digits |
+ | | | |
+ | |<-----National (significant) number----->|
+ | |
+ |<---------------------Max 15 digits--------------------->|
+ | |
+ |<--------International public telecommunication--------->|
+ | number for geographic areas |
+
+ CC Country Code for geographic areas
+ NDC National Destination Code (optional)
+ SN Subscriber Number
+ n Number of digits in the country code
+
+ NOTE - National and international prefixes are not part of
+ the international public telecommunication number for
+ geographic areas.
+
+ Figure 1 - International public telecommunication
+ number structure for geographic areas
+
+ (e164s2) 4.2 International public telecommunication number
+ for global services
+
+ +-------------+ +-----------------------------------------+
+ | CC | | GSN |
+ +-------------+ +-----------------------------------------+
+ | | | |
+ | 3 digits | |<-------------Max 12 digits------------->|
+ | | | |
+ |<---------------------Max 15 digits--------------------->|
+ | |
+ |<--------International public telecommunication--------->|
+ | number for global services |
+
+ CC Country Code for global services
+ GSN Global Subscriber Number
+
+ NOTE - National and international prefixes are not
+ considered to be part of the international public
+ telecommunication number for global services.
+
+ Figure 2 - International public telecommunication
+ number structure for global services
+
+
+Gallant Expires January 6, 2001 7
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+
+ (e164s2) 4.3 International public telecommunication number for
+ networks
+
+ +-------------+ +-----------------+ +---------------------+
+ | CC | | IC | | SN |
+ +-------------+ +-----------------+ +---------------------+
+ | | | | | |
+ | 3 digits | | 1 to 4 digits | | Max (12-x) digits |
+ | | | |
+ | |<-------------Max 12 digits------------->|
+ | |
+ |<---------------------Max 15 digits--------------------->|
+ | |
+ |<--------International public telecommunication--------->|
+ | number for networks |
+
+ CC Country Code for networks
+ IC Identification Code
+ SN Subscriber Number
+ x Number of digits in Identification Code (IC)
+
+ NOTE - National and international prefixes are not part of
+ the international public telecommunication number for
+ networks.
+
+ Figure 3 - International public telecommunication
+ number structure for networks
+
+ (e164s2) 5 Number portability types
+
+ An E.164 number is classified into the following three types
+ of country codes:
+
+ 1) beginning with CC for geographic areas;
+ 2) beginning with CC for global services; and
+ 3) beginning with CC for networks.
+
+ The following tables provide an overview of the applicability of
+ each type of portability, when considered against the three number
+ types.
+
+
+
+
+
+
+
+
+
+
+
+
+Gallant Expires January 6, 2001 8
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ Table 1 - Service provider portability
+
+ +---------------------------------------------------------+
+ | Scope | | |
+ |-----------| | |
+ |CC type | Between CC domains | Within CC domains |
+ | (Note 1) | | |
+ |-----------+-----------+----------+-----------+----------|
+ |Geographic |Porting |Standards |Porting |Standards |
+ | |not |not |applicable |not |
+ | |applicable |required | |required |
+ | | | | | (Note 4) |
+ |-----------+-----------+----------+-----------+----------|
+ |Global |Porting |Standards |Porting |Standards |
+ |Services |not |not |applicable |not |
+ | |applicable |required | |required |
+ | | | | | (Note 2) |
+ |-----------+-----------+----------+-----------+----------|
+ |Network |Porting |Standards |Network |Network |
+ | (Note 3) |not |not |operator |operator |
+ | |applicable |required |matter |matter |
+ +---------------------------------------------------------+
+
+
+ Table 2 - Service portability
+
+ +---------------------------------------------------------+
+ | Scope | | |
+ |-----------| | |
+ |CC type | Between CC domains | Within CC domains |
+ | (Note 1) | | |
+ |-----------+-----------+----------+-----------+----------|
+ |Geographic |Porting |Standards |Porting |Standards |
+ | |not |not |applicable |not |
+ | |applicable |required | |required |
+ | | | | | (Note 4) |
+ |-----------+-----------+----------+-----------+----------|
+ |Global |Porting |Standards |Porting |Standards |
+ |Services |not |not |not |not |
+ | |applicable |required |applicable |required |
+ |-----------+-----------+----------+-----------+----------|
+ |Network |Porting |Standards |Network |Network |
+ | (Note 3) |not |not |operator |operator |
+ | |applicable |required |matter |matter |
+ +---------------------------------------------------------+
+
+
+
+
+
+
+
+
+Gallant Expires January 6, 2001 9
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ Table 3 - Location portability
+
+ +---------------------------------------------------------+
+ | Scope | | |
+ |-----------| | |
+ |CC type | Between CC domains | Within CC domains |
+ | (Note 1) | | |
+ |-----------+-----------+----------+-----------+----------|
+ |Geographic |Porting |Standards |Porting |Standards |
+ | |not |not |applicable |not |
+ | |applicable |required | |required |
+ | | | | | (Note 4) |
+ |-----------+-----------+----------+-----------+----------|
+ |Global |Porting |Standards |Porting |Standards |
+ |Services |not |not |applicable |not |
+ | |applicable |required | (Note 5) |required |
+ |-----------+-----------+----------+-----------+----------|
+ |Network |Porting |Standards |Network |Network |
+ | (Note 3) |not |not |operator |operator |
+ | |applicable |required |matter |matter |
+ +---------------------------------------------------------+
+
+
+ Notes to Tables 1, 2 and 3:
+
+ NOTE 1 - Portability not supported between CC types.
+
+ NOTE 2 - Requires international agreement(s) and infrastructure to
+ support number portability (e.g. UIFN).
+
+ NOTE 3 - Includes the CC + IC digits required to uniquely identify
+ the network.
+
+ NOTE 4 - International standardization not required but could be of
+ use.
+
+ NOTE 5 - These resources are "non-geographic" therefore location
+ portability is inherent.
+
+ NOTE 6 - For purposes of Tables 1, 2 and 3, "Standards" means ITU-T
+ Recommendations.
+
+
+
+
+
+
+
+
+
+
+
+
+Gallant Expires January 6, 2001 10
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ (e164s2) 6 Generic implementation of number portability
+
+ The following general routing scheme is assumed as the routing model
+ for calls routed to a ported customer.
+
+
+ incoming call
+ |
+ 1st step of the |
+ routing process, |
+ based on dialled digits |
+ |
+ +---------------------------+ +--------------------+
+ | Serving Network | | | Transit Network |
+ | v | | (optional) |
+ | +-+ | | |
+ | | | |-------------------+ |
+ | Serving Exchange +-+ | | | |
+ +---------------------------+ +---------------|----+
+ |
+ 2nd step of the |
+ routing process, |
+ based on routing number |
+ v
+ +---------------------------+
+ | Recipient Network | |
+ | v |
+ | +-+ |
+ | | | |
+ | Recipient Exchange +-+ |
+ +---------------------------+
+ |
+ |
+ +---+
+ customer with | |
+ ported number | |
+ +---+
+
+ NOTE - The serving network may be the originating network
+ and/or the donor or a transit network.
+
+ Figure 4 - Conceptual framework for incoming calls
+
+
+ NOTE 1 - The caller sets up the call by dialling the end user's
+ number which in this case is a ported number. The end user's number
+ is enough to initiate the routing process. Furthermore, number
+ portability, by definition, implies that the callers should continue
+ to dial the same end user's number and nothing more to set up a call
+ to a ported customer.
+
+
+
+Gallant Expires January 6, 2001 11
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ NOTE 2 - The routing process is split into two consecutive main
+ steps:
+
+ a) Normal routing based on end user's number towards a serving
+ exchange:
+
+ As a 1st step in the routing process, the originating network routes
+ the call up to a serving exchange clearly identified by the analysis
+ of a certain number of leading digits of the end user's number.
+
+ b) Routing to customer's interface based on routing number(s)
+ obtained by this serving exchange:
+
+ It should be noted that this step might be subdivided into sub-steps
+ (e.g. the serving exchange could provide information to route to a
+ database - within the recipient network or accessed by the recipient
+ network - which provides subsequent routing information identifying
+ the recipient exchange, information used for a subsequent sub- step
+ in the routing process).
+
+ NOTE 3 - If only the recipient network is identified, then it is the
+ responsibility of the recipient network to terminate the call at the
+ recipient exchange.
+
+ NOTE 4 - The internal routing process in the recipient exchange
+ shall unambiguously determine the called customer's interface and
+ complete the call taking into account the supplementary services
+ activated.
+
+ NOTE 5 - If a number is ported subsequently from service provider
+ No. 1 to service provider No. 2, then to service provider No. 3,
+ etc. this will change the routing number but not the routing
+ principles.
+
+ (e164s2) 7 Entities addressed by routing
+
+ Entities which need to be addressed by a Routing Number (RN) in one
+ or more routing solutions are identified in this clause.
+
+ According to the structure of the routing number, one or a
+ combination of several of the following entities should be
+ addressable:
+
+ - A recipient network: In this option, the routing number
+ identifies the network where the customer is now located. Therefore
+ the routing process will need additional information (i.e. DN) to be
+ completed.
+
+
+
+
+
+
+Gallant Expires January 6, 2001 12
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ - A Point of Interconnection (POI): In this option, the routing
+ number identifies an interface to the next network in the routing
+ process. Therefore the routing process will need additional
+ information (i.e. DN) to be completed.
+
+ - Recipient exchange: In this option, the routing number
+ identifies the exchange where the customer is now located. Therefore
+ the routing process within the recipient exchange will need an
+ additional information (i.e. DN) to be completed.
+
+ - Network Termination Point (NTP): In this option, the routing
+ number identifies the subscriber/access line/service. The ported
+ customer identified by the RN is unique. Therefore the routing
+ process, in terms of number portability, can be completed without
+ any additional information.
+
+ (e164s2) 8 Number portability mechanisms
+
+ (e164s2) 8.1 Assumptions
+
+ The following document internal assumptions that have been made:
+
+ a) that Calling Line Identification (CLI) is required to be
+ transported, with display information, unchanged to recipient
+ network;
+
+ b) that Connected Line Identification (COLI) is required to be
+ transported, with display information, unchanged to originating
+ network;
+
+ c) that initial routing arrangements have been defined and
+ implemented prior to the introduction of routing based on a routing
+ number;
+
+ d) that number portability is not allowed to influence the carrier
+ selection function;
+
+ e) that an NP solution shall not influence functions in PBXs.
+
+ (e164s2) 8.2 General description
+
+ (e164s2) 8.2.1 Call rerouted from donor network by use of onward
+ routing principles
+
+ The first step/solution discussed for number portability is often
+ that the donor network maintains the portability information, i.e.
+ the complete address to both recipient network and exchange, for
+ ported-out numbers and reroutes incoming calls to ported-out numbers
+ onward towards the recipient network according to onward routing
+ principles outlined in Figure 5.
+
+
+
+Gallant Expires January 6, 2001 13
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+
+ Originating Transit Donor
+ Network Network(s)(A) Network
+ +-------+ +-------+ +-------+
+ | | IAM | | IAM | +--+|
+ +-->| |------>| |------>| |DB||.....
+ | | | | | | +--+| .
+ | +-------+ +-------+ +-------+ .
+ | | | .
+ Calling a1)IAM | |b)IAM .
+ Subscriber +---------+ | .
+ | | Called
+ | | Subscriber
+ v v ^
+ +-------+ +-------+ |
+ | |a2)IAM | | |
+ | |------>| |----+
+ | | | |
+ +-------+ +-------+
+ Transit Recipient
+ Network(s)(B) Network
+
+ Figure 5 - Call rerouting to recipient network by
+ onward routing principles from donor network
+
+
+ In Figure 5, the donor network receives an incoming call. It then
+ detects that the called number has been ported-out to another
+ network and makes a DB query to retrieve a routing number. It
+ thereafter reroutes the call onward towards the recipient network
+ using retrieved routing information.
+
+ Please note that the transit network(s) are optional, i.e. direct
+ interconnections connections between originating network and donor
+ network might exist and the same also between donor network and
+ recipient network. Note also that the transit network(s) A and B can
+ be the same depending on network structure and call case.
+
+ (e164s2) 8.2.2 Call rerouted by dropback principles from donor
+ network
+
+ One possible enhancement of the previously described onward routing
+ solution, is that the donor network initiates the rerouting of the
+ call towards the recipient network according to "dropback"
+ principles outlined in Figure 6. Also, in this scenario, only the
+ donor network maintains NP information, i.e. the complete address to
+ both recipient network and exchange, for ported-out numbers.
+
+
+
+
+
+
+Gallant Expires January 6, 2001 14
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ Originating Transit Donor
+ Network Network(s)(A) Network
+ +-------+ +-------+ +-------+
+ | | IAM | | IAM | +--+|
+ +-->| |------>| |......>| |DB||.....
+ | | | | |<......| +--+| .
+ | +-------+ +-------+ Dropb.+-------+ .
+ | | | .
+ Calling a1)IAM| | b)IAM .
+ Subscriber | +---------+ .
+ | | Called
+ | | Subscriber
+ ----> v v ^
+ Lasting +-------+ +-------+ |
+ relation | |a2)IAM | | |
+ ....> | |------>| |----+
+ Temporary | | | |
+ relation +-------+ +-------+
+ Transit Recipient
+ Network(s)(B) Network
+
+ Figure 6 - Dropback with rerouting information and
+ onward rerouting performed by a transit network
+
+
+ The option b) is valid when direct interconnection exists between
+ transit network A and recipient network.
+
+ A further evolution is that the dropback indication is sent back to
+ the originating network. This is mainly of interest if the
+ originating network has direct interconnections to other networks
+ than the transit network used in the call attempt to the donor
+ network.
+
+ The dropback indication is also passed through to the originating
+ network if either the transit network A has no "dropback" capability
+ or determines that the preceding network has "dropback" capability.
+ The originating network, at reception of the release, reroutes the
+ call towards recipient network.
+
+ Please note that the transit networks are optional (i.e. direct
+ connections between originating network and donor network might
+ exist) but might exist [case a1) and a2)] between the onward routing
+ (transit or originating) network and recipient network.
+
+ When carrier selection is valid for the call, the originating
+ network reuses the carrier selection information after reception of
+ dropback indication. It could be debated if a selected carrier (e.g.
+ TN A) is allowed/recommended to transport the dropback to
+ originating network, but it has no option if it has no redirect on
+ "dropback" capability.
+
+
+Gallant Expires January 6, 2001 15
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+
+ (e164s2) 8.2.3 Call rerouting initiated by "Query on Release
+ (QoR)" principles from donor network
+
+ A similar case as the previously described "dropback" principle is
+ when the preceding network to donor initiates NP actions, i.e. an NP
+ DB query, at reception of a release message. This case is often
+ referred to as "Query on Release (QoR)".
+
+ In Figure 7, the donor network receives an incoming call. It then
+ detects that the called number has been ported out to another
+ network. It then determines that one of the preceding networks has
+ QoR capability by looking at received signalling information. It
+ thereafter releases the call with a special indication telling that
+ called number is ported out. The transit network then traps the
+ release, determines that preceding network has no QoR capability,
+ makes an NP database query and reroutes the call onward towards the
+ recipient network. In this scenario the transit network has access
+ to an NP DB with the complete address to the recipient network, at
+ least for ported-out numbers.
+
+ Options a1) and a2), in Figure 7, are valid when transit network A
+ either has no direct interconnection to recipient network or when
+ overflow traffic is placed via transit network B.
+
+
+ Originating Transit Donor
+ Network Network(s)(A) Network
+ +-------+ +-------+ +-------+
+ | | IAM | +--+| IAM | |
+ +-->| |------>| |DB||......>| |.....
+ | | | | +--+|<......| | .
+ | +-------+ +-------+ REL +-------+ .
+ | | | .
+ Calling a1)IAM| | b)IAM .
+ Subscriber | +---------+ .
+ | | Called
+ | | Subscriber
+ ----> v v ^
+ Lasting +-------+ +-------+ |
+ relation | |a2)IAM | | |
+ ....> | |------>| |----+
+ Temporary | | | |
+ relation +-------+ +-------+
+ Transit Recipient
+ Network(s)(B) Network
+
+ Figure 7 - Query on Release by transit network
+
+
+
+
+
+Gallant Expires January 6, 2001 16
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ The option b), in Figure 7, is valid when direct interconnection
+ exists between transit network A and recipient network.
+
+ Please note in this case that the DB query might take place also in
+ the originating network, i.e. that the DB could also exist in the
+ originating network.
+
+ That is what may occur if either the transit network A has no QoR
+ query capability or determines that the preceding network has QoR
+ capability. It therefore lets the release pass through to
+ originating network. The originating network, at reception of the
+ release, queries its NP database and reroutes the call towards
+ recipient network. In this scenario the originating network has
+ access to an NP DB with the complete address to both recipient
+ network and exchange, at least for ported-out numbers.
+
+ Sending back the release message to the originating network is also
+ of interest if the originating network has direct connections to
+ networks other than the transit network currently used.
+
+ When carrier selection is valid for the call, the originating
+ network reuses the carrier selection information after querying NP
+ DB. It could be debated if a selected carrier is allowed/recommended
+ to transport the release message to originating network, but it has
+ no option if it has no redirect on QoR capability.
+
+ (e164s2) 8.2.4 Routing initiated by "All call query" principles
+
+ In the scenario shown in Figure 8, the originating network has
+ access to an NP DB with the complete address to the recipient
+ exchange, at least for ported-out numbers. This implies that only
+ one NP DB look-up needs to be performed to complete the call.
+
+ Note however, that more than one DB look-up may be required if there
+ is not sufficient information to route to the recipient exchange.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Gallant Expires January 6, 2001 17
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ Originating Transit Donor
+ Network Network Network
+ +-------+ +-------+ +-------+
+ | +--+|a1)IAM | | | |
+ +-->| |DB||------>| | | |.....
+ | | +--+| | | | | .
+ | +-------+ +-------+ +-------+ .
+ | | | .
+ Calling | | a2)IAM .
+ Subscriber +---------+ +---------+ .
+ | | Called
+ | | Subscriber
+ ----> | v ^
+ Lasting | b)IAM +-------+ |
+ relation +------------->| | |
+ ....> | |----+
+ Temporary | |
+ relation +-------+
+ Recipient
+ Network
+
+ Figure 8 - All call query by originating network
+
+
+ As can be seen in Figure 8, the donor network is not involved in the
+ call set-up at all, however optionally the transit network [see
+ cases a1) and a2) above] might be transiting the call to the
+ recipient network.
+
+ Alternatively, a transit network, rather than the originating
+ network, could perform the NP DB look-up.
+
+ (e164s2) 9 Types of addresses and numbers - within networks
+ and across network boundaries
+
+ With service provider portability it may no longer be possible to
+ use an end user's number, dialled by the calling party, to route the
+ call to the customer. If a customer changes service provider, a
+ Routing Number (RN) is needed to be able to route the call. The
+ routing information may have one of the following:
+
+ - concatenated address (see 9.1);
+ - separated address (see 9.2);
+ - RN only, i.e. a plain network address, suppressed E.164 number
+ (see 9.3);
+ - DN only, i.e. a plain E.164 number (see 9.4).
+
+
+
+
+
+
+
+Gallant Expires January 6, 2001 18
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ (e164s2) 9.1 Concatenated address
+
+ (e164s2) 9.1.1 Description
+
+ In this type of address, two numbers are concatenated in the same
+ signalling field (the called party number) which is used to route
+ the call (Figure 9).
+
+ +-----------------------+-----------------------+
+ | RN | DN |
+ +-----------------------+-----------------------+
+
+ Figure 9 - Showing a concatenated address
+
+
+ RN is a routing number prefixed for a routing purpose. The length of
+ RN may vary from country to country.
+
+ If some non-ported numbers have DN leading digits identical to the
+ RN, this may imply a signalling field exists which indicates
+ "Routing information for a ported number"; otherwise, the routing
+ would be ambiguous.
+
+ The RN could take one of the following values:
+
+ Case 1: RN represents the first digits of a number block usually
+ handled by the addressed entity to which the call has to be routed.
+ In this case, specific information carried by the signalling
+ protocol is needed to indicate that it is a call to a ported number.
+
+ Case 2: One or more of the first digits of the RN are digits not
+ used as first digits in the national numbering plan used to indicate
+ that the call is to a ported number. The value of the digits could
+ be between 0 and 9 (spare in the national numbering plan). The rest
+ of the RN identifies the addressed entity to which the call has to
+ be routed and is used for this purpose.
+
+ Case 3: This case is similar to case 2, but the first (or first
+ two) digit(s) of the RN field is (are) one of the hexadecimal values
+ nationally spare in the Signalling System No. 7. RN is used to route
+ the call to the addressed entity.
+
+ (e164s2) 9.1.2 Brief analysis
+
+ Case 1
+
+ Pros:
+
+ This solution does not waste any numbering resource since the RN
+ value is formed by the first digits of the number block usually
+ handled by the addressed entity.
+
+
+Gallant Expires January 6, 2001 19
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+
+ This solution does not need a specific addressing scheme (for
+ identifying the addressed exchange) and can be accommodated in the
+ existing signalling.
+
+ Cons:
+
+ This solution requires the use of a specific identifier to qualify
+ the routing number as an address used for a ported call which
+ requires special treatment. The routing mechanisms in exchanges have
+ to be adapted to be able to provide this special treatment. As there
+ is a constraint on the maximum length of the complete concatenated
+ address, the numbering space available for RN may be insufficient;
+ limitations can be present on the maximum numbers of digits being
+ supported by the signalling system and the exchanges in the
+ different networks involved.
+
+ Case 2
+
+ Pros:
+
+ As for case 1, this solution can also be accommodated in the
+ existing signalling. In opposition to case 1, this solution does not
+ require any additional information to qualify the call as a ported
+ call since one of the first digits of the routing number is
+ dedicated to ported calls.
+
+ Cons:
+
+ This solution makes use of a part of the national numbering scheme.
+ To be able to handle the prefix, routing mechanisms in the exchanges
+ will have to be changed. As there is a constraint on the maximum
+ length of the complete concatenated address, the numbering space
+ available for RN may be insufficient.
+
+ Case 3
+
+ Pros:
+
+ This solution does not waste any resource from the national
+ numbering plan since the first digit(s) is (are) hexadecimal.
+ [Footnote: That is, one of the 6 values A, B, C, D, E or F.] The
+ advantages are similar to those already mentioned for case 2.
+
+
+
+
+
+
+
+
+
+
+Gallant Expires January 6, 2001 20
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ Cons:
+
+ The drawbacks are similar to those already mentioned for case 2.
+ However, since this solution makes use of hexadecimal character(s),
+ it requires changes (e.g. in signalling systems, switches and
+ support systems). Although the solution does not require any
+ resources from the national numbering plan, it does take up
+ numbering resources (it uses a spare value from the Signalling
+ System No. 7).
+
+ (e164s2) 9.2 Separated addresses
+
+ (e164s2) 9.2.1 Description
+
+ In this address type, the routing number and the directory number
+ are carried in two different fields in the signalling messages
+ (Figure 10). The address identifying the destination of the ported
+ call, routing number, is used to route the call. The DN is carried
+ transparently in a separate signalling parameter and is only used at
+ the called side to complete the call.
+
+ +-----------------------+
+ | RN |
+ +-----------------------+
+ +-----------------------+
+ | DN |
+ +-----------------------+
+
+ Figure 10 - Showing a separated address
+
+
+ (e164s2) 9.2.2 Brief analysis
+
+ Pros:
+
+ The routing number can either be an E.164 number or a non- E.164
+ number. In either case the routing number should be in the same
+ format as the national numbering plan. Since the called number and
+ routing number are carried in separate signalling parameters, the
+ possibility for mis-routing is minimized. If non-E.164 numbers are
+ used, all numbers from the national numbering plan can be used as
+ routing numbers. If E.164 numbers are used, numbers within the
+ national numbering plans must be identified and assigned only for
+ routing purposes. As opposed to prefix solutions, no special
+ treatment of routing numbers need to be provided by the routing
+ mechanisms of the exchange.
+
+
+
+
+
+
+
+Gallant Expires January 6, 2001 21
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ Cons:
+
+ Such a separated address solution requires, by definition, that
+ signalling systems used are able to carry both RN and DN in separate
+ signalling parameters.
+
+ (e164s2) 9.3 RN only
+
+ (e164s2) 9.3.1 Description
+
+ In this case the routing number is the only information being sent
+ between exchanges/networks (Figure 11). The directory number, E.164
+ number, is not sent between exchanges but is translated into a
+ routing number. The routing number must point out the access line to
+ which the called party is connected as no other method is available.
+
+ +-----------------------+
+ | RN |
+ +-----------------------+
+
+ Figure 11 - Showing a routing number only
+
+
+ (e164s2) 9.3.2 Brief analysis
+
+ Pros:
+
+ The advantages of this addressing method are that it is
+ internationally available today because the RNs are E.164 numbers
+ and that it does not require any changes in the signalling systems.
+
+ Cons:
+
+ To be able to provide information regarding the DN, in services like
+ COLP, a second query in the recipient exchange (or in the last
+ transit exchange) is needed. This solution can waste numbering
+ resources (depending on the solution).
+
+ (e164s2) 9.4 Only DN (normally across network boundaries)
+
+ (e164s2) 9.4.1 Description
+
+ In this case the directory number is the only information that is
+ being sent between networks.
+
+ +-----------------------+
+ | DN |
+ +-----------------------+
+
+ Figure 12 - Showing a directory number only
+
+
+
+Gallant Expires January 6, 2001 22
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+
+ (e164s2) 9.4.2 Brief analysis
+
+ Pros:
+
+ It is not mandatory to introduce RN transfer between networks, i.e.
+ this solution does not affect existing network interfaces. It allows
+ different addressing options of different operators to work
+ together. Operators will have to transport routing information with
+ ported calls inside their networks, regardless of which number
+ portability solution is chosen. There are multiple options to
+ transport this routing information. Separation or concatenation of
+ routing information and directory number is the main characteristic.
+
+ Internal routing is not dependent on information given by other
+ networks (no network interdependence).
+
+ Cons:
+
+ Use of this addressing method requires the use of "all call query
+ all networks" architecture at the network interface.
+
+ (e164s2) 10 Combinations of addressing types, addressed
+ entities and mechanisms: general signalling requirements
+
+ The previous clauses above have identified that there are three
+ components that must be determined in any implementation of service
+ provider number portability:
+
+ 1) the entity addressed by the routing number;
+ 2) the method of transporting the routing number;
+ 3) the architecture used to determine the routing number.
+
+ Addressed entity: Assuming a routing number is utilized (see below),
+ there are four possible entities that can be identified by the
+ routing number:
+
+ 1) network termination point;
+ 2) recipient exchange;
+ 3) recipient network;
+ 4) point of interconnection.
+
+ Transport of routing number: There are four transport methods
+ described:
+
+ 1) concatenated;
+ 2) separated;
+ 3) no routing number used;
+ 4) routing number only.
+
+
+
+
+Gallant Expires January 6, 2001 23
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ Architectures: There are four architectures described:
+
+ 1) onward routing;
+ 2) dropback;
+ 3) query on release;
+ 4) all call query.
+
+ With the exception of the "No routing number used/routing number
+ only" transport mechanisms, the three components are independent of
+ one another, allowing a multitude of theoretically possible
+ solutions by combining the components. For example, an
+ implementation could consist of:
+
+ - Routing number identifies the recipient exchange, is transported
+ concatenated with dialled digits and is derived using an onward
+ routing architecture.
+
+ Or, an alternate implementation could be:
+
+ - Routing number identifies the recipient network, is transported
+ in a separate field to the dialled digits and is derived using an
+ all call query architecture.
+
+ The various combinations provide flexibility of implementation to
+ take into account economical and technical parameters of each
+ individual situation. For this reason this Supplement does not
+ recommend one solution over another.
+
+ (e164s2) 11 Examples of locations of number portability
+ database(s) within networks
+
+ (e164s2) 11.1 General description
+
+ Depending on the evolutionary level in a particular network, the NP
+ database will be located in different places of the network or
+ possibly even external to the network. The following principles of
+ NP data storing have been identified, described and evaluated:
+
+ a) exchange-based (distributed) solutions;
+ b) exchange external (centralized) solutions.
+
+ The following options for NP data query places have been identified,
+ described and evaluated:
+
+ 1) originating local exchange;
+ 2) gateway exchange(s);
+ 3) transit or gateway exchange(s);
+ 4) donor local exchange(s).
+
+
+
+
+
+Gallant Expires January 6, 2001 24
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ Regardless of data storing place, the exchange/network can act
+ according to different NP principles, e.g. onward routing the call,
+ dropping back the rerouting information or even acting as a database
+ and responding a query with rerouting information.
+
+ (e164s2) 12 Administrative processes
+
+ In establishing number portability, processes that underpin its
+ introduction and management are a key requirement. The following
+ list provides top level guidance on specific areas of activity and
+ the steps that need to be covered.
+
+ Process activity Steps to be covered
+
+ Service Initial contact between operators
+ establishment Planning stage
+ Implementation planning
+ Network implementation and testing
+
+ Service Introduction of a new switch
+ maintenance Introduction of a new numbering block
+ Number change
+ New routing number
+
+ Service Request
+ ordering Validation
+ Scheduling
+ Contingency plans
+ Hours
+ Subsequent portability
+ Change of account name
+ Reasons for rejection
+ Installation
+ Cancellation
+
+ Fault and repair
+ handling
+
+ Directory number Directory entries
+ information Operator assistance
+ Emergency service
+ Number plan administration
+ Law enforcement agencies
+
+ Billing
+ --------------------------------------------------------------------
+
+
+
+
+
+
+
+Gallant Expires January 6, 2001 25
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ 5. Front Matter from the ITU-T Published Version
+
+ This section contains sections from the front matter of the ITU-T
+ published version of Supplement 2 to Rec. E.164, including the
+ Source, the Foreword, the note on "ROA," the text on intellectual
+ property rights, and the copyright notice. They are provided here
+ for information and reference. The text here was valid at the time
+ of publication, but there may have been revisions since then.
+
+
+ 5.1 Source (from the ITU-T published version)
+
+ Supplement 2 to ITU-T Recommendation E.164 was prepared by ITU-T
+ Study Group 2 (1997-2000) and was approved under the WTSC Resolution
+ No. 5 procedure on the 9th of November 1998.
+
+
+ 5.2 FOREWORD (from the ITU-T published version)
+
+ ITU (International Telecommunication Union) is the United Nations
+ Specialized Agency in the field of telecommunications. The ITU
+ Telecommunication Standardization Sector (ITU-T) is a permanent
+ organ of the ITU. The ITU-T is responsible for studying technical,
+ operating and tariff questions and issuing Recommendations on them
+ with a view to standardizing telecommunications on a worldwide
+ basis.
+
+ The World Telecommunication Standardization Conference (WTSC), which
+ meets every four years, establishes the topics for study by the
+ ITU-T Study Groups which, in their turn, produce Recommendations on
+ these topics.
+
+ The approval of Recommendations by the Members of the ITU-T is
+ covered by the procedure laid down in WTSC Resolution No. 1.
+
+ In some areas of information technology which fall within ITU-T's
+ purview, the necessary standards are prepared on a collaborative
+ basis with ISO and IEC.
+
+
+ 5.3 NOTE (from the ITU-T published version)
+
+ In this Recommendation the term "recognized operating agency" (ROA)
+ includes any individual, company, corporation or governmental
+ organization that operates a public correspondence service. The
+ terms "Administration," "ROA" and "public correspondence" are
+ defined in the "Constitution of the ITU (Geneva, 1992).
+
+
+
+
+
+
+Gallant Expires January 6, 2001 26
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+ 5.4 INTELLECTUAL PROPERTY RIGHTS (from the ITU-T published version)
+
+ The ITU draws attention to the possibility that the practice or
+ implementation of this Recommendation may involve the use of a
+ claimed Intellectual Property Right. The ITU takes no position
+ concerning the evidence, validity or applicability of claimed
+ Intellectual Property Rights, whether asserted by ITU members or
+ others outside of the Recommendation development process.
+
+ As of the date of approval of this Recommendation, the ITU had not
+ received notice of intellectual property, protected by patents,
+ which may be required to implement this Recommendation. However,
+ implementors are cautioned that this may not represent the latest
+ information and are therefore strongly urged to consult the TSB
+ patent database.
+
+
+ 5.5 Copyright Notice (from E.164 Supp. 2, ITU-T published version)
+
+ (c) ITU 1999
+
+ All rights reserved. No part of this publication may be reproduced
+ or utilized in any form or by any means, electronic or mechanical,
+ including photocopying and microfilm, without permission in writing
+ from the ITU.
+
+
+6. Security Considerations
+
+ None.
+
+
+7. References
+
+ 1 Bradner, S., "The Internet Standards Process -- Revision 3",
+ BCP 9, RFC 2026, October 1996.
+
+ 2 ITU-T Recommendation E.164 (05/97), "The international public
+ telecommunication numbering plan".
+
+ 3 Supplement 2 (11/98) to ITU-T Recommendation E.164 (05/97),
+ "Supplement 2: Number Portability".
+
+ 4 "Report of the IP-Telecoms Interworking Workshop (Numbering,
+ Naming, Addressing and Routing), ITU, Geneva 25-27 January 2000",
+ http://www.itu.int/ITU-T/ip-telecoms/ip-telecoms.htm, last
+ modified 2000-03-20.
+
+ 5 "Telephone Number Mapping (enum)", last modified 03-Jul-00,
+ http://www.ietf.org/html.charters/enum-charter.html.
+
+
+
+Gallant Expires January 6, 2001 27
+Internet-Draft Number Portability (E.164 Supp. 2) July 7, 2000
+
+
+8. Acknowledgments
+
+ I would like to thank the ITU TSB (Telecommunication Standardization
+ Bureau), and Mr. John Tar in particular, for helping to make the
+ text of Supplement 2 to E.164 freely available on the ITU web site.
+
+
+9. Author's Address
+
+ Andrew Gallant
+ Comsat Corporation
+ 6560 Rock Spring Drive
+ Bethesda, MD 20817 USA
+ Phone: +1 301 214 3264
+ Fax: +1 301 214 7226
+ Email: andrew.gallant@comsat.com
+
+
+Full Copyright Statement
+
+ Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+ This document and translations of it may be copied and furnished to
+ others, and derivative works that comment on or otherwise explain it
+ or assist in its implmentation may be prepared, copied, published
+ and distributed, in whole or in part, without restriction of any
+ kind, provided that the above copyright notice and this paragraph
+ are included on all such copies and derivative works. However, this
+ document itself may not be modified in any way, such as by removing
+ the copyright notice or references to the Internet Society or other
+ Internet organizations, except as needed for the purpose of
+ developing Internet standards in which case the procedures for
+ copyrights defined in the Internet Standards process must be
+ followed, or as required to translate it into languages other than
+ English.
+
+ The limited permissions granted above are perpetual and will not be
+ revoked by the Internet Society or its successors or assigns.
+
+ This document and the information contained herein is provided on an
+ "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+ TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
+ BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
+ HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+
+
+
+
+
+
+
+Gallant Expires January 6, 2001 28
+
diff --git a/doc/draft/draft-ietf-enum-operation-01.txt b/doc/draft/draft-ietf-enum-operation-01.txt
new file mode 100644
index 00000000..2dd1bb2e
--- /dev/null
+++ b/doc/draft/draft-ietf-enum-operation-01.txt
@@ -0,0 +1,882 @@
+
+
+Telephone Number Mapping A. Brown
+Internet Draft Nortel Networks
+Document: <draft-ietf-enum-operation-01.txt> Greg Vaudreuil
+ Lucent Technologies
+ October 27, 2000
+
+
+ ENUM Service Specific Provisioning:
+ Principles of Operation
+
+
+Status of this Memo
+
+ This document is an Internet-Draft and is in full conformance with
+ all provisions of Section 10 of RFC2026 [1].
+
+ Internet-Drafts are working documents of the Internet Engineering
+ Task Force (IETF), its areas, and its working groups. Note that
+ other groups may also distribute working documents as Internet-
+ Drafts. Internet-Drafts are draft documents valid for a maximum of
+ six months and may be updated, replaced, or obsoleted by other
+ documents at any time. It is inappropriate to use Internet-Drafts as
+ reference material or to cite them other than as "work in progress."
+
+ The list of current Internet-Drafts can be accessed at
+ http://www.ietf.org/ietf/1id-abstracts.txt
+
+ The list of Internet-Draft Shadow Directories can be accessed at
+ http://www.ietf.org/shadow.html.
+
+
+1. Abstract
+
+ This document outlines the principles for the operation of a
+ telephone number directory service. This service provides for the
+ resolution of telephone numbers into Internet domain name addresses
+ and service specific directory discovery.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Vaudreuil Expires March 2001 1
+ ENUM Operations Auguest 18, 2000
+
+
+ Table of Contents
+
+ 1. Abstract........................................................1
+ 2. Introduction....................................................2
+ 3. Scope...........................................................2
+
+ 4. Overview........................................................3
+ 4.1 Relationship with Dynamic Services.............................3
+ 4.2 Number Portability.............................................4
+ 5. The ENUM Service................................................4
+ 5.1 First Level: Determining the Delegated Authority...............4
+ 5.2 Second Level: Determining the Service Registrar................5
+ 5.3 Third Level: Retrieving Resource records.......................6
+ 5.4 Service-Specific Queries.......................................6
+
+ 6. Interesting Numbering Topologies...............................7
+ 6.1 Subaddressing..................................................7
+ 6.2 Default and Range-based Service Records........................8
+ 7 Illustrative System Examples.....................................9
+ 7.1 Example: Hypothetical Reachme Service..........................9
+ 7.2 Example: SIP Call Setup Service Request.......................10
+ 8. Security Considerations........................................11
+
+ 9. References.....................................................12
+ 10. Acknowledgments...............................................12
+ 11. Author's Addresses............................................12
+ 12. Full Copyright Statement......................................13
+ Appendix: changes from draft-ietf-enum-operations-00.txt..........14
+
+
+2. Introduction
+
+ This document outlines the principles for the operation of a
+ telephone number directory service. This service provides for the
+ resolution of telephone numbers into the address of a service
+ specific directory or where applicable for a given service, directly
+ into a service-specific endpoint addresses.
+
+ This directory service uses the algorithms and methods described in
+ RFC 2916.
+
+ Please send comments on this document to the ENUM working group.
+
+3. Scope
+
+ This document defines the architecture and mechanics necessary to
+ implement a telephone number-based Internet directory system. This
+ solution enables an extensible set of services to be provided for a
+ given telephone number. Example services may include IP telephony,
+ store and forward or real-time Internet Fax, VPIM voice messaging,
+ Internet paging, geographic phone location, and many others. Each
+ service is to be separately defined and identified using a unique,
+ registered service identifier.
+
+ This document does not specify the particulars of any telephone
+ number-based service. In particular, it does not describe how phone
+ calls are placed, routed, or terminated or how voice, fax, pager, or
+ email messages are routed.
+
+ Vaudreuil Expires January 2001 2
+ ENUM Operations Auguest 18, 2000
+
+
+4. Overview
+
+ This telephone number-based directory system implements a four-level
+ information model, the first two constituting the ENUM service
+ itself. This model is based on analysis of pre-existing
+ administrative structures, generalized service requirements, and the
+ capabilities of candidate protocols.
+
+ The mechanics of the ENUM service are specified in [ENUM]
+
+ The first level is the mapping of the telephone number delegation
+ tree to the authority to which the number has been delegated.
+ Conceptually, this delegated authority knows nothing about service-
+ specific information associated with the telephone number but can
+ provide a reference to the appropriate entity that does know the
+ specific information.
+
+ The second is the delegation from the authority to which the
+ telephone number has been delegated to the service registrar. The
+ registrar is conceptually responsible for maintaining the set of
+ service records for a given telephone number. Where this services
+ registrar is different from the delegated authority, a query
+ redirection from the delegated authority to the name server of the
+ service registrar for a given telephone number is necessary. Because
+ there may be multiple service providers for a given telephone
+ number, conceptually this registrar of services assumes a role of
+ managing service registrations and arbitrating conflicts between
+ service providers.
+
+ The third level is the set of service records themselves. The
+ service records indicate which of several services may be available
+ for a given telephone number. Multiple records indicating redundant
+ or competitive service providers may be provided. The set of records
+ may be provided or modified by any number of service providers. The
+ ENUM service defines these records to be NAPTR records yielding a
+ valid URL for a potentially useful service. It is up to the client
+ initiating the service request to sort through the set of NAPTR
+ records to determine which services are appropriate for the intended
+ action.
+
+ If necessary, an additional service-specific level of information
+ can be provided by the service provider itself. This level provides
+ specific attributes including any necessary attributes to place a
+ call, route a message, validate capabilities, or other data
+ necessary for that service that are known only by the provider of
+ that specific service.
+
+4.1 Relationship with Dynamic Services
+
+ ED Note: Text requested discussing FAST UPDATE VS SLOW UPDATE. WG
+ decided only slow update is in scope for ENUM. Discuss timing
+ considerations for propagation of changed records at various levels.
+
+ Illustrate how time-of-day services should be provided at the
+ service-specific level.
+
+
+ The telephone number delegation information changes infrequently.
+ However, when a change to this data is made, the information must be
+ Vaudreuil Expires January 2001 3
+ ENUM Operations Auguest 18, 2000
+
+
+ rapidly propagated through the directory system. Inconsistencies
+ between the authoritative data and cached data may result in loss of
+ service, misrouting of communications, and/or service loops. An
+ effective ENUM service requires that DNS time-to-live fields be set
+ to an appropriate value consistent with the telephone number
+ reassignment policies
+
+4.2 Number Portability
+
+ The concept of number portability generally refers to the ability of
+ a subscriber to change service providers, service types, or
+ locations without changing their telephone number. For a full
+ discussion of number portability, see [portability]. In support of
+ number portability, the ENUM service provides mechanism at the three
+ conceptual levels of the ENUM service.
+
+ 1. If the number has been redelegated to another authority, the
+ telephone number can be redelegated in the ENUM service to that
+ authority by changing the name server "NS" records to point to the
+ new authority. This may be the case where numbers are redelegated
+ from the incumbent service provider to another or to a portability
+ authority. The immediately higher delegated authority coordinates
+ the transfer.
+
+ 2. The service registrar may be reassigned. This may be the case
+ where an individual or corporation changes telephony service
+ providers and wishes that telephony service provider to also
+ provide service registrar functions. Assuming the delegated
+ authority and service registrar are separate entities, the DNAME
+ or CNAME redirection records pointing to the previous service
+ registrar would be changed to point to the new service registrar.
+ The appropriate service specific NAPTR records would be recreated
+ by the new service registrar and the delegated authority would
+ coordinate the transfer from one registrar to the other.
+
+ 3. If a specific service for a given telephone number was changed
+ from one provider to another, such as switching telephone
+ answering / voice messaging providers, the NATPR record indicating
+ the specific service would change. The service registrar would
+ coordinate the deletion of the record for the previous service
+ provider and the insertion of a record for the new service
+ provider.
+
+ It is anticipated that in the early stages of an ENUM deployment,
+ the delegated authority and the service registrar may be the same
+ entity.
+
+5. The ENUM Service
+
+5.1 First Level: Determining the Delegated Authority
+
+ The first level is the mapping of an E.164-formatted international
+ telecommunication number into the identity of the service registrar
+ for that number. This may or may not involve more than one referral
+ in DNS. From the client's perspective, this level is transparent,
+ bundled within the query for the service-specific resource records
+ stored at the second level.
+
+
+ Vaudreuil Expires January 2001 4
+ ENUM Operations Auguest 18, 2000
+
+
+ The delegation of telephone numbers from the root authority (the
+ ITU) down to individuals is a well-established system that can be
+ utilized. These telephone number registrars have a trusted
+ relationship with their delegated carriers or subsidiary registrars;
+ a valuable asset to ensure protection against various attacks. Note
+ that in this model, the delegation of telephone number blocks or
+ individual numbers to a corporation or to an individual can be
+ administratively and technically modeled as a subdelegation to
+ another carrier. With that additional information publicly
+ registered, the mapping between telephone numbers and these domain
+ names can be provided by any neutral entity. The delegated
+ authority, subdelegated authority, or individual may arrange to have
+ a third-party (e.g., a service provider) list their information. In
+ this case the service provider's domain would be returned in the
+ ENUM query.
+
+ The Internet Domain Name System provides an ideal technology for the
+ first-level directory due to its hierarchical structure, fast
+ connectionless queries, and distributed administrative model.
+ Earlier experimentation with the TPC.INT remote printing experiment
+ has shown how the hierarchical assignment of telephone numbers can
+ be mapped directly to the hierarchy of domains within the DNS. The
+ ENUM directory uses that approach to map any arbitrary telephone
+ number into a single domain name.
+
+ ITU standard E.164 defines the structure of the public telephone
+ number as follows: country code, followed by nationally significant
+ part, followed by subaddress. The country code may be from one to
+ three digits, and the total length may be up to 15 digits. The
+ nationally-significant portion may be arbitrarily divided on any
+ number boundary. In many countries numbering plans, the divisions
+ are not uniform, that is, the "area codes" or "city codes" may be of
+ varying lengths within a single country and the total number of
+ digits may be variable. Where supported by the relevant service, an
+ optional subaddress of up to four digits may be utilized to
+ designate an extension telephone number. Note that while sub-
+ addressing is not well supported in GSTN calling, it is more widely
+ supported for voice messaging. It is important to note that the
+ national long-distance access or international dialing prefix
+ sequence is not part of the canonical E.164 number.
+
+ Within this delegation flexibility, it is always the case that the
+ delegation of authority is always done left-to-right. With this
+ assumption, a numbering tree can be built on a digit-by-digit basis
+ that can represent any arbitrary hierarchical structure. DNS
+ permits the delegation of authority on arbitrary boundaries such
+ that a delegation to country code "1", "44", and "972" can all
+ coexist under a single numbering plan root. The same applies for
+ "service selectors", "area codes", "city codes", "line number", or
+ "additional address information " within numbering plans.
+
+5.2 Second Level: Determining the Service Registrar
+
+
+ In the event that the designated authority is not the same as the
+ service registrar, the DNAME and CNAME records provide the
+ redirection from the designated authority to the service registrar.
+ The DNAME provides a means for reforming and re-issuing a query for
+ a "non-terminal" domain name. As is standard for compliant DNS
+ Vaudreuil Expires January 2001 5
+ ENUM Operations Auguest 18, 2000
+
+
+ resolver libraries, clients must support the CNAME record type.
+ Servers that provide for substitution MAY support the DNAME record
+ to provide redirection for an entire telephone number range as a DNS
+ subtree. These servers MUST provide synthesized CNAME records for
+ the proper operation of older resolver libraries that have not been
+ extended to understand DNAME. Servers that redirect queries on a
+ per-telephone number basis MUST support CNAMES.
+
+
+ From the client's perspective, this level may be transparent based
+ on the capabilities of the resolver library in use. The client
+ (with the help of a suitable DNS library) must be able interpret
+ returned CNAME and should be able to resolve DNAME records into a
+ new domain name. The new domain name MUST be used to continue the
+ query for the requested service records.
+
+ It is important to ensure that DNS configurations provide only one
+ path from the e164.arpa tree to a single DNS leaf-node entry. If
+ multiple paths point to the same node, the substitution string
+ provided in the NAPTR may provide unintended results. In
+ particular, substitution expressions which use the original
+ telephone number string may result in different URI's depending upon
+ which number was used to initiate the ENUM query.
+
+5.3 Third Level: Retrieving Resource records.
+
+ The third level is the request for NAPTR RRs to discover the URL of
+ the appropriate service-specific directory such as an LDAP directory
+ server, H.323 gatekeeper, or specific endpoint addresses.
+
+ The service registrar is responsible for ensuring that multiple
+ services may be provided on behalf of a single telephone number,
+ potentially by different service providers. This function includes
+ an arbiter function to ensure that there is a deterministic instance
+ of any given service assigned to a single telephone number. The
+ service-specific directory locator function is a new service modeled
+ upon existing telcoservice provisioning models. Long-distance
+ carrier selection within the United States is one well-known example
+ of a service-specific registration requiring an arbiter function
+ within the current network.
+
+5.4 Service-Specific Queries
+
+ An additional level of query may be used to a service-specific
+ directory for service-specific information. As indicated in the
+ URI, such a query may include a SIP query to a designated gatekeeper
+ or an LDAP query to a designated directory server. This level is
+ specific to the service and is to be described in service-specific
+ documents. The service-specific directory is expected to be
+ dynamic. It is important that as little coordination as possible be
+ required between the directories of innovative and potentially
+ competing service-specific providers.
+
+
+
+
+
+
+
+ Vaudreuil Expires January 2001 6
+ ENUM Operations Auguest 18, 2000
+
+
+6. Interesting Numbering Topologies
+
+ The following numbering uses require special consideration in the
+ provision and use of ENUM services.
+
+6.1 Subaddressing
+
+ The E.164 standard provides for subaddressing through "additional
+ information" within the 16 digits of an E.164 number. This
+ information is passed through many telecommunications networks to be
+ used by terminal equipment to select between alternate services or
+ terminal devices. The subaddress digits are not processed by the
+ switching system and are not used by intermediate processes to
+ select services or route calls. In many cases, the network
+ numbering infrastructure may be unaware of the existence or use of
+ subaddressing by a given endpoint. Within ENUM, subaddressing may be
+ supported in two ways. The service registrar may explicitly
+ provision NAPTR records for each subaddress, or the service
+ registrar may provision default records for a range of subaddresses.
+
+ Using common DNS server implementations, the registrar may provision
+ default records for a block of subaddresses. A combination of
+ explicit entries and default entries may be provided in common DNS
+ server implementations using a longest-match algorithm. It is
+ important to note that if a NAPTR or any other RR is provisioned for
+ a subaddress, then all NAPTR records that are useful for that sub-
+ address must also be provisioned.
+
+ It is also important to note that numbers with optional subaddresses
+ may be queried without the subaddress component. For example, it
+ may be useful to dial an address when placing a PSTN telephone call.
+ The telephone number may terminate on an automated attendant
+ application which can prompt for the appropriate internal extension.
+ However, when placing a SIP call using IP telephony, the address
+ plus the subaddress may be queried.
+
+ The following set of records for company.com illustrate one
+ configuration where a PSTN caller will be directed to the automated
+ attendant application whether they dial the number or the number
+ plus a subaddress, and whether the subaddress is explicitly
+ provisioned or not. Calling using SIP to the explicitly provisioned
+ subaddress will result in a direct call to the intended recipient.
+
+ Example:
+
+ 1.2.3.4.5.6.7.8.9.e164.arpa
+ IN NAPTR 102 10 "u" "tel+E2U" "!^.*$!tel:+987654321!" .
+ IN NAPTR 10 10 "u" "sip+E2U" "!+(.*)!sip:AA@company.com!" .
+
+ *.1.2.3.4.5.6.7.8.9.e164.arpa
+ IN NAPTR 102 10 "u" "tel+E2U" "!^.*$!tel:+987654321!" .
+ IN NAPTR 10 10 "u" "sip+E2U" "!+(.*)!sip:AA@company.com!" .
+
+ 1.0.1.1.2.3.4.5.6.7.8.9.e164.arpa
+ IN NAPTR 10 10 "u" "sip+E2U" "!^.*$!sip:joe@company.com!" .
+ IN NAPTR 102 10 "u" "tel+E2U" "!^.*$!tel:+987654321!" .
+
+
+
+ Vaudreuil Expires January 2001 7
+ ENUM Operations Auguest 18, 2000
+
+
+6.2 Default and Range-based Service Records
+
+ It is envisioned that a corporation or service provider not subject
+ to number portability may wish to maintain a set of default NAPTR
+ records for all E.164 telephone numbers within a delegation block.
+ Similar to subaddressing, a service registrar may provision a set of
+ NAPTR records for a set of E.164 numbers with similar service
+ requirements.
+
+ Example:
+
+ *.3.4.5.6.7.8.9.SvcReg.company.com
+ IN NAPTR 102 10 "u" "tel+E2U" "!+(.*)!Tel:+\1" .
+ IN NAPTR 10 10 "u" "sip+E2U" "!^.*$!sip:AA@company.com!" .
+ IN NAPTR 10 10 "U" "mailto+E2U" \
+ "!+(.*)!mailto:+\1@company.com!" .
+
+ 1.0.3.4.5.6.7.8.9.SvcReg.company.com
+ IN NAPTR 102 10 "u" "tel+E2U" "!^.*$!tel:+987654310!" .
+ IN NAPTR 10 10 "u" "sip+E2U" "!^.*$!sip:AA@company.com!" .
+
+ 2.2.3.4.5.6.7.8.9.SvcReg.company.com
+ IN NAPTR 102 10 "u" "tel+E2U" "!^.*$!tel:+987654322!" .
+ IN NAPTR 10 10 "u" "sip+E2U" "!^.*$!sip:joe@company.com!" .
+ IN NAPTR 10 10 "U" "mailto+E2U" \
+ "!^.*$!tel:+987654322@company.com!" .
+
+ In this example, mail sent to a number within the 100's block that
+ does not have an explicit entry will be sent to tel#@company.com.
+ Mail is not accepted at the automated attendant number as indicted
+ by the lack of a mailto service record. Because extension 22 has an
+ explicit record, it must also have an explicit mailto: URL in a
+ NAPTR record.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Vaudreuil Expires January 2001 8
+ ENUM Operations Auguest 18, 2000
+
+
+7 Illustrative System Examples
+
+7.1 Example: Hypothetical Reachme Service
+
+ The following hypothetical service enables an end-user to discover
+ the various means by which she can reach a recipient represented by
+ their corporate telephone number +1 613-555-1212 using the
+ hypothetical "reachme" service. This service is hosted by directly
+ by the recipient's corporation.
+
+ The telephone number is transformed into a domain name form to be
+ used in a DNS query.
+
+ 2.1.2.1.5.5.5.6.1.3.1.e164.arpa
+
+ Sample configuration file for the top level delegations from ITU:
+
+ 1.e164.arpa. IN NS ns.NANP.phone.net. ;for NANP
+ 3.3.e164.arpa. IN NS ns.FR.phone.net. ; for France
+ 2.7.9.e164.arpa. IN NS ns.il.phone.net. ; for Israel
+
+ Sample configuration file for numbers delegated from the NANP node
+ in the DNS tree:
+
+ 5.5.5.3.1.6.1.e164.arpa. IN NS ns.ServiceProviderA.net.
+ ;for +1 613 555 XXXX
+
+ In this example, ServiceProviderA.net is the authority to which the
+ telephone number has been delegated. ServiceProviderA.net provides
+ a non-terminal redirection pointer to Zcorporation, the designated
+ service registrar for the block of 100 numbers +1 613 555 12XX. The
+ configuration for this block of numbers is:
+
+ 2.1.5.5.5.3.1.6.1.e164.arpa.
+ DNAME 2.1.5.5.3.1.6.1.Zcorporation.com.
+
+ Zcorporation provides the following service specific record for all
+ telephone numbers within it's 100 number block:
+
+ *.2.1.5.5.5.3.1.6.1.Zcorporation.com.
+ IN NAPTR 100 10 "u" "ldap+E2U"\
+ "$!ldap://ldap1.Zcorporation.com/cn=\1!" .
+
+ Assuming the resolver is using non-extended DNS, the query using
+ telephone number +1 613 555 1212 for the _reachme service is as
+ follows:
+
+ QueryType: NAPTR
+ QueryName: _ 2.1.2.1.5.5.5.3.1.6.1.e164.arpa.
+ Response:
+ IN CNAME 2.1.2.1.5.5.5.3.1.6.1.Zcorporation.com
+ IN NAPTR 10 10 "u" "Reachme+E2U" \
+ "!LDAP:\\ldap1.zcorporation.com\cn=\1!" .
+ The client can then apply the regular expression to yield an LDAP
+ URI of LDAP:\\ldap1.zcorporation.com\cn=16135551212 and then use
+ LDAP with the reachme schema to determine the set of communications
+ technologies available for +1 613 555 1212.
+
+
+ Vaudreuil Expires January 2001 9
+ ENUM Operations Auguest 18, 2000
+
+
+7.2 Example: SIP Call Setup Service Request
+
+ This example provides resolution of a telephone number to the
+ identifier for the SIP gatekeeper designated to support real-time
+ calling (Sipphonecall) to 972 555 1313. The telephone number is
+ part of a block of ported telephone numbers that have been ported
+ out of the donor carriers block to another carrier.
+
+ The telephone number is transformed into a domain name form to be
+ used in a DNS query.
+
+ Sample configuration file for the top level delegations from ITU:
+
+ 1.e164.arpa. IN NS ns.NANP.phone.net. ;for NANP
+ 3.3.e164.arpa. IN NS ns.FR.phone.net. ; for France
+ 2.7.9.e164.arpa. IN NS ns.il.phone.net. ; for Israel
+
+ Sample DNS configuration file for the ported number block serviced
+ by the 972 555 number portability authority delegated from the NANP
+ node in the DNS tree:
+
+ 5.5.5.2.7.9.1.e164.arpa. IN NS ns.972555Port.NANP.phone.net.
+ ;for 972 555
+
+ The number portability authority manages the delegation on a per-
+ telephone number basis. Logically, the ns.972555Port.NANP.phone.net
+ has the following record for the telephone number.
+
+ 3.1.3.1.5.5.5.2.7.9.1.e164.arpa. IN NS ns.ServiceProviderB.net.
+ ;for 972 555 1313
+
+ ServiceProviderB provides service registrar functions directly for
+ the telephone number and hosts the service records directly without
+ using a DNAME record. The following configuration entry is provided
+ for +1 972 555 1313.
+
+
+ 3.1.3.1.5.5.2.7.9.1.ServiceProviderB.net.
+ IN NAPTR 10 10 "u" "sip+E2U"\
+ "!^.*$!sip:19725551313@ServiceProviderB.net!" .
+ The DNS Query and response using telephone number +1 972 555 1313:
+
+ QueryType: NAPTR
+ QueryName: 3.1.3.1.5.5.5.2.7.9.1.e164.arpa
+ Result:
+ IN NAPTR 10 10 "u" "sip+E2U" \
+ "!^.*$!sip:19725551313@ServiceProviderB.net!" .
+
+ The client can now use the SIP protocols to contact the SIP gateway
+ to initiate a phone call.
+
+
+
+
+
+
+
+
+
+ Vaudreuil Expires January 2001 10
+ ENUM Operations Auguest 18, 2000
+
+
+8. Security Considerations
+
+ The following are known security issues taken into consideration in
+ the definition of this directory service.
+
+ 1. Service provider customer information is very sensitive,
+ especially in this time of local phone competition. Service
+ providers require the maximum flexibility to protect this data.
+
+ 2. Registration of a domain name for the telephone numbers
+ delegated to another carrier may result in messages being
+ misdirected to the wrong carrier. As subdelegations are
+ implemented, the risk that phone numbers delegated to one
+ enterprise may be incorrectly pointed at another will increase.
+
+ 3. Service providers operate in a regulated environment where
+ certain information about subscribers must not be disclosed.
+ Telephony services and Voice Messaging are subject to caller-ID
+ blocking restrictions, restrictions normally enforced in the
+ telephony network. No such protection is available on the
+ Internet. The protection of this data is essential, but is up
+ to the individual service providers to not disclose this
+ information outside of their control.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Vaudreuil Expires January 2001 11
+ ENUM Operations Auguest 18, 2000
+
+
+9. References
+
+ [DNS1] Mockapetris, P., "Domain names - implementation and
+ specification", RFC1035, Nov 1987.
+
+ [DNS2] Mockapetris, P., "Domain names - concepts and facilities",
+ RFC 1034, Nov 1987.
+
+ [SRV] Arnt Gulbrandsen, Paul Vixie, Levon Esibov, "A DNS RR for
+ specifying the location of services (DNS SRV)", Work in Progress
+
+ [E164] ITU, "CCITT Recommendation E.164 (1991), Telephone Network
+ and ISDN Operation, Numbering, Routing and Mobile Service -
+ Numbering Plan for the ISDN Era."
+
+ [TPC1] Malamud, Carl, Rose, Marshall, "Principles of Operation for
+ the TPC.INT Subdomain: Remote Printing -- Technical Procedures", RFC
+ 1530, October 1993.
+
+ [VPIM2] Vaudreuil, Greg, Parsons, Glen, "Voice Profile for Internet
+ Mail, Version 2", RFC 2421, September 1998.
+
+ [SRV] Gulbrandsen, A., Vixie, P., "A DNS RR for specifying the
+ location of services (DNS SRV)", RFC 2052, October 1996.
+
+ [REQ] Brown, Anne, "ENUM Requirements", work-in-progress, November
+ 1999
+
+ [ENUM] Faltstrom, Patrick, "E.164 number and DNS", RFC 2916,
+ September 2000.
+
+ [DNAME]
+
+ [NAPTR] M. Mealling, R. Daniel _The Naming Authority Pointer (NAPTR)
+ DNS Resource Record_, RFC 2915, September 2000.
+
+ [Portability]
+
+10. Acknowledgments
+
+11. Author's Addresses
+
+ Anne R. Brown
+ Nortel Networks
+ P.O. Box 3511, Station C
+ Ottawa, ON K1Y 4H7
+ Canada
+ Phone: +1-613-765-5274
+ Fax: +1-613-763-2697
+ Email: ARBrown@NortelNetworks.com
+
+ Gregory M. Vaudreuil
+ Lucent Technologies,
+ Communications Application Group
+ 17080 Dallas Parkway
+ Dallas, TX 75248-1905
+ United States
+ Phone/Fax: +1-972-733-2722
+ Email: GregV@IEEE.org
+ Vaudreuil Expires January 2001 12
+ ENUM Operations Auguest 18, 2000
+
+
+
+12. Full Copyright Statement
+
+ "Copyright (C) The Internet Society (2000). All Rights Reserved.
+ This document and translations of it may be copied and furnished to
+ others, and derivative works that comment on or otherwise explain it
+ or assist in its implementation may be prepared, copied, published
+ and distributed, in whole or in part, without restriction of any
+ kind, provided that the above copyright notice and this paragraph
+ are included on all such copies and derivative works. However, this
+ document itself may not be modified in any way, such as by removing
+ the copyright notice or references to the Internet Society or other
+ Internet organizations, except as needed for the purpose of
+ developing Internet standards in which case the procedures for
+ copyrights defined in the Internet Standards process must be
+ followed, or as required to translate it into
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Vaudreuil Expires January 2001 13
+ ENUM Operations Auguest 18, 2000
+
+
+Appendix: changes from draft-ietf-enum-operations-00.txt
+
+ o Discussion of interesting numbering topologies was added
+
+ o Retrieval of NAPTR records are now described in a separate step
+ from the determination of a service registrar.
+
+ o A new example was created to illustrate ENUM using sub-addressing.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Vaudreuil Expires January 2001 14
+ \ No newline at end of file
diff --git a/doc/draft/draft-ietf-ipngwg-default-addr-select-01.txt b/doc/draft/draft-ietf-ipngwg-default-addr-select-01.txt
deleted file mode 100644
index 2047267e..00000000
--- a/doc/draft/draft-ietf-ipngwg-default-addr-select-01.txt
+++ /dev/null
@@ -1,695 +0,0 @@
-
-
-IPng Working Group Richard Draves
-Internet Draft Microsoft Research
-Document: draft-ietf-ipngwg-default-addr-select-01.txt July 14, 2000
-Category: Standards Track
-
- Default Address Selection for IPv6
-
-Status of this Memo
-
- This document is an Internet-Draft and is in full conformance with
- all provisions of Section 10 of RFC 2026 [1].
-
- Internet-Drafts are working documents of the Internet Engineering
- Task Force (IETF), its areas, and its working groups. Note that
- other groups may also distribute working documents as Internet-
- Drafts.
-
- Internet-Drafts are draft documents valid for a maximum of six
- months and may be updated, replaced, or obsoleted by other documents
- at any time. It is inappropriate to use Internet-Drafts as reference
- material or to cite them other than as "work in progress."
-
- The list of current Internet-Drafts can be accessed at
- http://www.ietf.org/ietf/1id-abstracts.txt.
-
- The list of Internet-Draft Shadow Directories can be accessed at
- http://www.ietf.org/shadow.html.
-
-Abstract
-
- This document describes two algorithms, for source address selection
- and for destination address selection. The algorithms specify
- default behavior for all IPv6 implementations. They do not override
- choices made by applications or upper-layer protocols, nor do they
- preclude the development of more advanced mechanisms for address
- selection. The two algorithms share a common framework, including an
- optional mechanism for allowing administrators to provide policy
- that can override the default behavior. In dual stack
- implementations, the framework allows the destination address
- selection algorithm to consider both IPv4 and IPv6 addresses -
- depending on the available source addresses, the algorithm might
- prefer IPv6 addresses over IPv4 addresses, or vice-versa.
-
-1. Introduction
-
- The IPv6 addressing architecture [2] allows multiple unicast
- addresses to be assigned to interfaces. These addresses may have
- different reachability scopes (link-local, site-local, or global).
- These addresses may also be "preferred" or "deprecated" [3]. Privacy
- considerations have introduced the concepts of "public addresses"
- and "anonymous addresses" [4]. The mobility architecture introduces
- "home addresses" and "care-of addresses" [5]. In addition, multi-
- homing situations will result in more addresses per node. For
-
-Draves Standards Track - Expires January 2001 1
-Default Address Selection for IPv6 July 14, 2000
-
-
- example, a node may have multiple interfaces, some of them tunnels
- or virtual interfaces, or a site may have multiple ISP attachments
- with a global prefix per ISP.
-
- The end result is that IPv6 implementations will very often be faced
- with multiple possible source and destination addresses when
- initiating communication. It is desirable to have simple default
- algorithms, common across all implementations, for selecting source
- and destination addresses so that developers and administrators can
- reason about and predict the behavior of their systems.
-
- Furthermore, dual or hybrid stack implementations, which support
- both IPv6 and IPv4, will very often need to choose between IPv6 and
- IPv4 when initiating communication. For example, when DNS name
- resolution yields both IPv6 and IPv4 addresses and the network
- protocol stack has available both IPv6 and IPv4 source addresses. In
- such cases, a simple policy to always prefer IPv6 or always prefer
- IPv4 can produce poor behavior. As one example, suppose a DNS name
- resolves to a global IPv6 address and a global IPv4 address. If the
- node has assigned a global IPv6 address and a 169.254/16 "autonet"
- IPv4 address, then IPv6 is the best choice for communication. But if
- the node has assigned only a link-local IPv6 address and a global
- IPv4 address, then IPv4 is the best choice for communication. The
- destination address selection algorithm solves this with a unified
- procedure for choosing among both IPv6 and IPv4 addresses.
-
- This document specifies source address selection and destination
- address selection separately, but using a common framework so that
- together the two algorithms yield useful results. The algorithms
- attempt to choose source and destination addresses of appropriate
- scope and configuration status (preferred or deprecated).
- Furthermore, this document suggests a preferred method, longest
- matching prefix, for choosing among otherwise equivalent addresses
- in the absence of better information.
-
- The framework also has policy hooks to allow administrative override
- of the default behavior. For example, using these hooks an
- administrator can specify a preferred source prefix for use with a
- destination prefix, or prefer destination addresses with one prefix
- over addresses with another prefix. These hooks give an
- administrator flexibility in dealing with some multi-homing and
- transition scenarios, but they are certainly not a panacea.
-
- The rules specified in this document MUST NOT be construed to
- override an application or upper-layer's explicit choice of
- destination or source address.
-
-1.1. Conventions used in this document
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in
- this document are to be interpreted as described in RFC-2119 [6].
-
-
-Draves Standards Track - Expires May 2000 2
-Default Address Selection for IPv6 July 14, 2000
-
-
-2. Framework
-
- Our framework for address selection derives from the most common
- implementation architecture, which separates the choice of
- destination address from the choice of source address. Consequently,
- the framework specifies two separate algorithms for these tasks. The
- algorithms are designed to work well together and they share a
- mechanism for administrative policy override.
-
- In this implementation architecture, applications use APIs [7] like
- getaddrinfo() and getipnodebyname() that return a list of addresses
- to the application. This list might contain both IPv6 and IPv4
- addresses (sometimes represented as IPv4-mapped addresses). The
- application then passes a destination address to the network stack
- with connect() or sendto(). The application might use only the first
- address in the list, or it might loop over the list of addresses to
- find a working address. In any case, the network layer is never in a
- situation where it needs to choose a destination address from
- several alternatives. The application might also specify a source
- address with bind(), but often the source address is left
- unspecified. Therefore the network layer does often choose a source
- address from several alternatives.
-
- As a consequence, we intend that implementations of getaddrinfo()
- and getipnodebyname() will use the destination address selection
- algorithm specified here to sort the list of IPv6 and IPv4 addresses
- that they return. Separately, the IPv6 network layer will use the
- source address selection algorithm when an application or upper-
- layer has not specified a source address. Application of this
- framework to source address selection in an IPv4 network layer may
- be possible but this is not explored further here.
-
- The algorithms use several criteria in making their decisions. The
- combined effect is to prefer destination/source address pairs for
- which the two addresses are of equal scope or type, prefer smaller
- scopes over larger scopes for the destination address, prefer non-
- deprecated source addresses of sufficient scope to reach the
- destination, avoid the use of transitional addresses when native
- addresses are available, and all else being equal prefer address
- pairs having the longest possible common prefix. For source address
- selection, an anonymous address [4] is preferred over its
- corresponding public address. In mobile situations [5], home
- addresses are preferred over care-of addresses.
-
- The framework optionally allows for the possibility of
- administrative configuration of policy that can override the default
- behavior of the algorithms. The policy override takes the form of a
- configurable table that provides precedence values and preferred
- source prefixes for destination prefixes. If an implementation is
- not configurable, or if an implementation has not been configured,
- then the default policy table specified in this document SHOULD be
- used.
-
-
-Draves Standards Track - Expires May 2000 3
-Default Address Selection for IPv6 July 14, 2000
-
-
-2.1. Scope Comparisons
-
- Multicast destination addresses have a 4-bit scope field that
- controls the propagation of the multicast packet. The IPv6
- addressing architecture defines scope field values for node-local
- (0x1), link-local (0x2), site-local (0x5), organization-local (0x8),
- and global (0xE) scopes.
-
- Use of the source address selection algorithm in the presence of
- multicast destination addresses requires the comparison of a unicast
- address scope with a multicast address scope. We map unicast link-
- local to multicast link-local, unicast site-local to multicast site-
- local, and unicast global scope to multicast global scope. For
- example, unicast site-local is equal to multicast site-local, which
- is smaller than multicast organization-local, which is smaller than
- unicast global, which is equal to multicast global.
-
- We write Scope(A) to mean the scope of address A. For example, if A
- is a link-local unicast address and B is a site-local multicast
- address, then Scope(A) < Scope(B).
-
- This mapping implicitly conflates unicast site boundaries and
- multicast site boundaries.
-
-2.2. IPv4-Compatible Addresses and Other Format Prefixes
-
- For the purposes of this document, IPv4-compatible addresses have
- global scope and "preferred" configuration status.
-
- Similarly, NSAP addresses, IPX addresses, or addresses with as-yet-
- undefined format prefixes should be treated as having global scope
- and "preferred" configuration status. Later standards may supercede
- this treatment.
-
- The loopback address should be treated as having link-local scope
- and "preferred" configuration status.
-
-2.3. IPv4 Addresses and IPv4-Mapped Addresses
-
- The destination address selection algorithm operates on both IPv6
- and IPv4 addresses. For this purpose, IPv4 addresses should be
- represented as IPv4-mapped addresses. For example, to lookup the
- precedence or other attributes of an IPv4 address in the policy
- table, lookup the corresponding IPv4-mapped IPv6 address.
-
-2.4. Policy Table
-
- The policy table is a longest-matching-prefix lookup table, much
- like a routing table. Given an address A, a lookup in the policy
- table produces three values: a precedence value Precedence(A), a
- classification or label Label(A), and a second label
- MatchSrcLabel(A).
-
-
-Draves Standards Track - Expires May 2000 4
-Default Address Selection for IPv6 July 14, 2000
-
-
- The precedence value Precedence(A) is used for sorting destination
- addresses. If Precedence(A) > Precedence(B), we say that address A
- has higher precedence than address B, meaning that our algorithm
- will prefer to sort destination address A before destination address
- B.
-
- The labels Label(A) and MatchSrcLabel(A) allow for policies that
- prefer a particular source address prefix for use with a destination
- address prefix. The algorithms prefer to use a source address S with
- a destination address D if Label(S) = MatchSrcLabel(D).
-
- IPv6 implementations SHOULD support configurable address selection
- via a mechanism at least as powerful as the policy tables defined
- here. If an implementation is not configurable or has not been
- configured, then it SHOULD operate according to the algorithms
- specified here in conjunction with the following default policy
- table:
-
- Prefix Precedence Label MatchSrcLabel
- ::1/128 100 1 1
- fe80::/10 90 2 2
- fec0::/10 80 3 3
- ::/0 70 4 4
- 2002::/16 60 5 5
- ::/96 50 6 6
- ::ffff:169.254.0.0/112 30 7 7
- ::ffff:10.0.0.0/104 20 8 8
- ::ffff:172.16.0.0/108 20 9 9
- ::ffff:192.168.0.0/112 20 10 10
- ::ffff:0:0/96 10 11 11
-
- One effect of the default policy table is to prefer using native
- source addresses with native destination addresses, 6to4 source
- addresses with 6to4 destination addresses, and v4-compatible source
- addresses with v4-compatible destination addresses. Another effect
- of the default policy table is to prefer communication using IPv6
- addresses to communication using IPv4 addresses, if matching source
- addresses are available.
-
- Policy table entries for scoped address prefixes MAY be qualified
- with an optional scope-id. If so, a prefix table entry only matches
- against an address during a lookup if the scope-id also matches the
- address's scope-id.
-
-2.5. Common Prefix Length
-
- We define the common prefix length CommonPrefixLen(A, B) of two
- addresses A and B as the length of the longest prefix (looking at
- the most significant, or leftmost, bits) that the two addresses have
- in common. It ranges from 0 to 128.
-
-
-
-
-Draves Standards Track - Expires May 2000 5
-Default Address Selection for IPv6 July 14, 2000
-
-
-3. Candidate Source Addresses
-
- The source address selection algorithm uses the concept of a
- "candidate set" of potential source addresses for a given
- destination address. We write CandidateSource(A) to denote the
- candidate set for the address A.
-
- It is RECOMMENDED that the candidate source addresses be the set of
- unicast addresses assigned to the interface that will be used to
- send to the destination. (The "outgoing" interface.) On routers, the
- candidate set MAY include unicast addresses assigned to any
- interface that could forward the destination address to the outgoing
- interface.
-
- In some cases the destination address may be qualified with a scope-
- id or other information that will constrain the candidate set.
-
- For multicast and link-local destination addresses, the set of
- candidate source addresses MUST only include addresses assigned to
- interfaces belonging to the same link as the outgoing interface.
-
- For site-local destination addresses, the set of candidate source
- addresses MUST only include addresses assigned to interfaces
- belonging to the same site as the outgoing interface.
-
- In any case, anycast addresses, multicast addresses, and the
- unspecified address MUST NOT be included in a candidate set.
-
-4. Source Address Selection
-
- The source address selection algorithm chooses a source address for
- use with a destination address D. It is specified here in terms of
- the pair-wise comparison of addresses SA and SB. The pair-wise
- comparison can be used to select an address from the set
- CandidateSource(D).
-
- The pair-wise comparison consists of eight rules, which MUST be
- applied in order. If a rule chooses an address, then the remaining
- rules are not relevant and MUST be ignored. Subsequent rules act as
- tie-breakers for earlier rules. If the eight rules fail to choose an
- address, some unspecified tie-breaker must be used.
-
- Rule 1: Prefer same address.
- If SA = D, then choose SA. Similarly, if SB = D, then choose SB.
-
- Rule 2: Prefer matching label.
- If Label(SA) = MatchSrcLabel(D) and Label(SB) <> MatchSrcLabel(D),
- then choose SA. Similarly, if Label(SB) = MatchSrcLabel(D) and
- Label(SA) <> MatchSrcLabel(D), then choose SB.
-
-
-
-
-
-Draves Standards Track - Expires May 2000 6
-Default Address Selection for IPv6 July 14, 2000
-
-
- Rule 3: Prefer appropriate scope.
- If Scope(SA) < Scope(SB). If Scope(SA) < Scope(D), then choose SB.
- Otherwise, if one of the source addresses is "preferred" and one of
- them is "deprecated", then choose the "preferred" address.
- Otherwise, choose SA.
- Similarly, if Scope(SB) < Scope(SA). If Scope(SB) < Scope(D), then
- choose SA. Otherwise, if one of the source addresses is "preferred"
- and one of them is "deprecated", then choose the "preferred"
- address. Otherwise, choose SB.
-
- Rule 4: Avoid deprecated addresses.
- The addresses SA and SB have the same scope. If one of the source
- addresses is "preferred" and one of them is "deprecated", an
- implementation MUST choose the one that is preferred.
-
- Rule 5: Prefer home addresses.
- If SA is a home address and SB is a care-of address, then prefer SA.
- Similarly, if SB is a home address and SA is a care-of address, then
- prefer SB.
- An implementation MAY support a per-connection configuration
- mechanism (for example, a socket option) to reverse the sense of
- this preference and prefer care-of addresses over home addresses.
-
- Rule 6: Prefer outgoing interface.
- If SA is assigned to the interface that will be used to send to D
- and SB is assigned to a different interface, then prefer SA.
- Similarly, if SB is assigned to the interface that will be used to
- send to D and SA is assigned to a different interface, then prefer
- SB.
-
- Rule 7: Prefer anonymous addresses.
- If SA is an anonymous address and SB is its corresponding public
- address, then prefer SA. Similarly, if SB is an anonymous address
- and SA is its corresponding public address, then prefer SB.
- An implementation MAY support a per-connection configuration
- mechanism (for example, a socket option) to reverse the sense of
- this preference and prefer public addresses over anonymous
- addresses.
-
- Rule 8: Use longest matching prefix.
- If CommonPrefixLen(SA, D) > CommonPrefixLen(SB, D), then choose SA.
- Similarly, if CommonPrefixLen(SB, D) > CommonPrefixLen(SA, D), then
- choose SB.
-
- Rule 8 MAY be superceded if the implementation has other means of
- choosing among source addresses. For example, if the implementation
- somehow knows which source address will result in the "best"
- communications performance.
-
-5. Destination Address Selection
-
- The destination address selection algorithm takes a list of
- destination addresses and sorts the addresses to produce a new list.
-
-Draves Standards Track - Expires May 2000 7
-Default Address Selection for IPv6 July 14, 2000
-
-
- It is specified here in terms of the pair-wise comparison of
- addresses DA and DB, where DA appears before DB in the original
- list.
-
- The destination address selection algorithm uses the source address
- selection algorithm as a subroutine. We write Source(D) to indicate
- the selected source address for a destination D.
-
- The pair-wise comparison of destination addresses consists of four
- rules, which MUST be applied in order. If a rule determines a
- result, then the remaining rules are not relevant and MUST be
- ignored. Subsequent rules act as tie-breakers for earlier rules.
-
- Rule 1: Prefer destinations with a matching source.
- If Label(Source(DA)) = MatchSrcLabel(DA) and Label(Source(DB)) <>
- MatchSrcLabel(DB), then sort DA before DB. Similarly, if
- Label(Source(DB)) = MatchSrcLabel(DB) and Label(Source(DA)) <>
- MatchSrcLabel(DA), then sort DB before DA.
-
- Rule 2: Prefer higher precedence.
- If Precedence(DA) > Precedence(DB), then sort DA before DB.
- Similarly, if Precedence(DB) > Precedence(DA), then sort DB before
- DA.
-
- Rule 3: Use longest matching prefix.
- Applies only if Label(Source(DA)) = MatchSrcLabel(DA) and
- Label(Source(DB)) = MatchSrcLabel(DB).
- If CommonPrefixLen(DA, Source(DA)) > CommonPrefixLen(DB,
- Source(DB)), then sort DA before DB. Similarly, if
- CommonPrefixLen(DB, Source(DB)) > CommonPrefixLen(DA, Source(DA)),
- then sort DB before DA.
-
- Rule 4: Otherwise, leave the order unchanged.
- Sort DA before DB.
-
- The third and fourth rules MAY be superceded if the implementation
- has other means of sorting destination addresses. For example, if
- the implementation somehow knows which destination addresses will
- result in the "best" communications performance.
-
-6. Interactions with Routing
-
- All IPv6 nodes, including both hosts and routers, SHOULD conform to
- this specification.
-
- This specification of source address selection assumes that routing
- (more precisely, selecting an outgoing interface on a node with
- multiple interfaces) is done before source address selection.
- However, implementations MAY use source address considerations as a
- tiebreaker when choosing among otherwise equivalent routes.
-
- For example, suppose a node has interfaces on two different links,
- with both links having a working default router. Both of the
-
-Draves Standards Track - Expires May 2000 8
-Default Address Selection for IPv6 July 14, 2000
-
-
- interfaces have preferred global addresses. When sending to a global
- destination address, if there's no routing reason to prefer one
- interface over the other, then an implementation MAY preferentially
- choose the outgoing interface that will allow it to use the source
- address that shares a longer common prefix with the destination.
-
-7. Implementation Considerations
-
- The destination address selection algorithm needs information about
- potential source addresses. One possible implementation strategy is
- for getipnodebyname() and getaddrinfo() to call down to the IPv6
- network layer with a list of destination addresses, sort the list in
- the network layer with full current knowledge of available source
- addresses, and return the sorted list to getipnodebyname() or
- getaddrinfo(). This is simple and gives the best results but it
- introduces the overhead of another system call. One way to reduce
- this overhead is to cache the sorted address list in the resolver,
- so that subsequent calls for the same name do not need to resort the
- list.
-
- Another implementation strategy is to call down to the network layer
- to retrieve source address information and then sort the list of
- addresses directly in the context of getipnodebyname() or
- getaddrinfo(). To reduce overhead in this approach, the source
- address information can be cached, amortizing the overhead of
- retrieving it across multiple calls to getipnodebyname() and
- getaddrinfo().
-
- In any case, if the implementation uses cached and possibly stale
- information in its implementation of destination address selection,
- or if the ordering of a cached list of destination addresses is
- possibly stale, then it MUST ensure that the destination address
- ordering returned to the application is no more than one second out
- of date. For example, an implementation might make a system call to
- check if any routing table entries or source address assignments
- that might affect these algorithms have changed.
-
-8. Security Considerations
-
- This document has no direct impact on Internet infrastructure
- security.
-
-References
-
- 1 S. Bradner, "The Internet Standards Process -- Revision 3", BCP
- 9, RFC 2026, October 1996.
-
- 2 R. Hinden, S. Deering, "IP Version 6 Addressing Architecture",
- RFC 2373, July 1998.
-
- 3 S. Thompson, T. Narten, "IPv6 Stateless Address
- Autoconfiguration", RFC 2462 , December 1998.
-
-
-Draves Standards Track - Expires May 2000 9
-Default Address Selection for IPv6 July 14, 2000
-
-
-
- 4 T. Narten, R. Draves, "Privacy Extensions for Stateless Address
- Autoconfiguration in IPv6", draft-ietf-ipngwg-addrconf-privacy-
- 01.txt, July 2000.
-
- 5 D. Johnson, C. Perkins, "Mobility Support in IPv6", draft-ietf-
- mobileip-ipv6-12.txt, April 2000.
-
- 6 S. Bradner, "Key words for use in RFCs to Indicate Requirement
- Levels", BCP 14, RFC 2119, March 1997.
-
- 7 R. Gilligan, S. Thomson, J. Bound, W. Stevens, "Basic Socket
- Interface Extensions for IPv6", RFC 2553, March 1999.
-
-Acknowledgments
-
- The author would like to acknowledge the contributions of the IPng
- Working Group.
-
-Author's Address
-
- Richard Draves
- Microsoft Research
- One Microsoft Way
- Redmond, WA 98052
- Phone: 1-425-936-2268
- Email: richdr@microsoft.com
-
-Revision History
-
-Changes from draft-ietf-ipngwg-default-addr-select-00
-
- Changed the candidate set definition so that the strong host model
- is recommended but not required. Added a rule to source address
- selection to prefer addresses assigned to the outgoing interface.
-
- Simplified the destination address selection algorithm, by having it
- use source address selection as a subroutine.
-
- Added a rule to source address selection to handle anonymous/public
- addresses.
-
- Added a rule to source address selection to handle home/care-of
- addresses.
-
- Changed to allow destination address selection to sort both IPv6 and
- IPv4 addresses. Added entries in the default policy table for IPv4-
- mapped addresses.
-
- Changed default precedences, so v4-compatible addresses have lower
- precedence than 6to4 addresses.
-
-
-
-Draves Standards Track - Expires May 2000 10
-Default Address Selection for IPv6 July 14, 2000
-
-
-Changes from draft-draves-ipngwg-simple-srcaddr-01
-
- Added framework discussion.
-
- Added algorithm for destination address ordering.
-
- Added mechanism to allow the specification of administrative policy
- that can override the default behavior.
-
- Added section on routing interactions and TBD section on mobility
- interactions.
-
- Changed the candidate set definition for source address selection,
- so that only addresses assigned to the outgoing interface are
- allowed.
-
- Changed the loopback address treatment to link-local scope.
-
-Changes from draft-draves-ipngwg-simple-srcaddr-00
-
- Minor wording changes because DHCPv6 also supports "preferred" and
- "deprecated" addresses.
-
- Specified treatment of other format prefixes; now they are
- considered global scope, "preferred" addresses.
-
- Reiterated that anycast and multicast addresses are not allowed as
- source addresses.
-
- Recommended that source addresses be taken from the outgoing
- interface. Required this for multicast destinations. Added analogous
- requirements for link-local and site-local destinations.
-
- Specified treatment of the loopback address.
-
- Changed the second selection rule so that if both candidate source
- addresses have scope greater or equal than the destination address
- and only of them is preferred, the preferred address is chosen.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Draves Standards Track - Expires May 2000 11
-Default Address Selection for IPv6 July 14, 2000
-
-
- Full Copyright Statement
-
- Copyright (C) The Internet Society (1999). All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph
- are included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Draves Standards Track - Expires May 2000 12 \ No newline at end of file
diff --git a/doc/draft/draft-ietf-ipngwg-default-addr-select-02.txt b/doc/draft/draft-ietf-ipngwg-default-addr-select-02.txt
new file mode 100644
index 00000000..02de64b3
--- /dev/null
+++ b/doc/draft/draft-ietf-ipngwg-default-addr-select-02.txt
@@ -0,0 +1,1101 @@
+
+
+IPng Working Group Richard Draves
+Internet Draft Microsoft Research
+Document: draft-ietf-ipngwg-default-addr-select-02.txt November 24, 2000
+Category: Standards Track
+
+ Default Address Selection for IPv6
+
+Status of this Memo
+
+ This document is an Internet-Draft and is in full conformance with
+ all provisions of Section 10 of RFC 2026 [1].
+
+ Internet-Drafts are working documents of the Internet Engineering
+ Task Force (IETF), its areas, and its working groups. Note that
+ other groups may also distribute working documents as Internet-
+ Drafts.
+
+ Internet-Drafts are draft documents valid for a maximum of six
+ months and may be updated, replaced, or obsoleted by other documents
+ at any time. It is inappropriate to use Internet-Drafts as reference
+ material or to cite them other than as "work in progress."
+
+ The list of current Internet-Drafts can be accessed at
+ http://www.ietf.org/ietf/1id-abstracts.txt.
+
+ The list of Internet-Draft Shadow Directories can be accessed at
+ http://www.ietf.org/shadow.html.
+
+Abstract
+
+ This document describes two algorithms, for source address selection
+ and for destination address selection. The algorithms specify
+ default behavior for all IPv6 implementations. They do not override
+ choices made by applications or upper-layer protocols, nor do they
+ preclude the development of more advanced mechanisms for address
+ selection. The two algorithms share a common framework, including an
+ optional mechanism for allowing administrators to provide policy
+ that can override the default behavior. In dual stack
+ implementations, the framework allows the destination address
+ selection algorithm to consider both IPv4 and IPv6 addresses -
+ depending on the available source addresses, the algorithm might
+ prefer IPv6 addresses over IPv4 addresses, or vice-versa.
+
+ All IPv6 nodes, including both hosts and routers, must implement
+ default address selection as defined in this specification.
+
+1. Introduction
+
+ The IPv6 addressing architecture [2] allows multiple unicast
+ addresses to be assigned to interfaces. These addresses may have
+ different reachability scopes (link-local, site-local, or global).
+ These addresses may also be "preferred" or "deprecated" [3]. Privacy
+ considerations have introduced the concepts of "public addresses"
+
+Draves Standards Track - Expires June 2001 1
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+ and "temporary addresses" [4]. The mobility architecture introduces
+ "home addresses" and "care-of addresses" [5]. In addition, multi-
+ homing situations will result in more addresses per node. For
+ example, a node may have multiple interfaces, some of them tunnels
+ or virtual interfaces, or a site may have multiple ISP attachments
+ with a global prefix per ISP.
+
+ The end result is that IPv6 implementations will very often be faced
+ with multiple possible source and destination addresses when
+ initiating communication. It is desirable to have default
+ algorithms, common across all implementations, for selecting source
+ and destination addresses so that developers and administrators can
+ reason about and predict the behavior of their systems.
+
+ Furthermore, dual or hybrid stack implementations, which support
+ both IPv6 and IPv4, will very often need to choose between IPv6 and
+ IPv4 when initiating communication. For example, when DNS name
+ resolution yields both IPv6 and IPv4 addresses and the network
+ protocol stack has available both IPv6 and IPv4 source addresses. In
+ such cases, a simple policy to always prefer IPv6 or always prefer
+ IPv4 can produce poor behavior. As one example, suppose a DNS name
+ resolves to a global IPv6 address and a global IPv4 address. If the
+ node has assigned a global IPv6 address and a 169.254/16 auto-
+ configured IPv4 address [6], then IPv6 is the best choice for
+ communication. But if the node has assigned only a link-local IPv6
+ address and a global IPv4 address, then IPv4 is the best choice for
+ communication. The destination address selection algorithm solves
+ this with a unified procedure for choosing among both IPv6 and IPv4
+ addresses.
+
+ This document specifies source address selection and destination
+ address selection separately, but using a common framework so that
+ together the two algorithms yield useful results. The algorithms
+ attempt to choose source and destination addresses of appropriate
+ scope and configuration status (preferred or deprecated).
+ Furthermore, this document suggests a preferred method, longest
+ matching prefix, for choosing among otherwise equivalent addresses
+ in the absence of better information.
+
+ The framework also has policy hooks to allow administrative override
+ of the default behavior. For example, using these hooks an
+ administrator can specify a preferred source prefix for use with a
+ destination prefix, or prefer destination addresses with one prefix
+ over addresses with another prefix. These hooks give an
+ administrator flexibility in dealing with some multi-homing and
+ transition scenarios, but they are certainly not a panacea.
+
+ The selection rules specified in this document MUST NOT be construed
+ to override an application or upper-layer's explicit choice of
+ destination or source address.
+
+
+
+
+Draves Standards Track - Expires June 2001 2
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+1.1. Conventions used in this document
+
+ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
+ "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in
+ this document are to be interpreted as described in RFC 2119 [7].
+
+2. Framework
+
+ Our framework for address selection derives from the most common
+ implementation architecture, which separates the choice of
+ destination address from the choice of source address. Consequently,
+ the framework specifies two separate algorithms for these tasks. The
+ algorithms are designed to work well together and they share a
+ mechanism for administrative policy override.
+
+ In this implementation architecture, applications use APIs [8] like
+ getaddrinfo() and getipnodebyname() that return a list of addresses
+ to the application. This list might contain both IPv6 and IPv4
+ addresses (sometimes represented as IPv4-mapped addresses). The
+ application then passes a destination address to the network stack
+ with connect() or sendto(). The application might use only the first
+ address in the list, or it might loop over the list of addresses to
+ find a working address. In any case, the network layer is never in a
+ situation where it needs to choose a destination address from
+ several alternatives. The application might also specify a source
+ address with bind(), but often the source address is left
+ unspecified. Therefore the network layer does often choose a source
+ address from several alternatives.
+
+ As a consequence, we intend that implementations of getaddrinfo()
+ and getipnodebyname() will use the destination address selection
+ algorithm specified here to sort the list of IPv6 and IPv4 addresses
+ that they return. Separately, the IPv6 network layer will use the
+ source address selection algorithm when an application or upper-
+ layer has not specified a source address. Application of this
+ framework to source address selection in an IPv4 network layer may
+ be possible but this is not explored further here.
+
+ The algorithms use several criteria in making their decisions. The
+ combined effect is to prefer destination/source address pairs for
+ which the two addresses are of equal scope or type, prefer smaller
+ scopes over larger scopes for the destination address, prefer non-
+ deprecated source addresses, avoid the use of transitional addresses
+ when native addresses are available, and all else being equal prefer
+ address pairs having the longest possible common prefix. For source
+ address selection, temporary addresses [4] are preferred over public
+ addresses. In mobile situations [5], home addresses are preferred
+ over care-of addresses.
+
+ The framework optionally allows for the possibility of
+ administrative configuration of policy that can override the default
+ behavior of the algorithms. The policy override takes the form of a
+ configurable table that specifies precedence values and preferred
+
+Draves Standards Track - Expires June 2001 3
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+ source prefixes for destination prefixes. If an implementation is
+ not configurable, or if an implementation has not been configured,
+ then the default policy table specified in this document SHOULD be
+ used.
+
+2.1. Scope Comparisons
+
+ Multicast destination addresses have a 4-bit scope field that
+ controls the propagation of the multicast packet. The IPv6
+ addressing architecture defines scope field values for node-local
+ (0x1), link-local (0x2), site-local (0x5), organization-local (0x8),
+ and global (0xE) scopes [9].
+
+ Use of the source address selection algorithm in the presence of
+ multicast destination addresses requires the comparison of a unicast
+ address scope with a multicast address scope. We map unicast link-
+ local to multicast link-local, unicast site-local to multicast site-
+ local, and unicast global scope to multicast global scope. For
+ example, unicast site-local is equal to multicast site-local, which
+ is smaller than multicast organization-local, which is smaller than
+ unicast global, which is equal to multicast global.
+
+ We write Scope(A) to mean the scope of address A. For example, if A
+ is a link-local unicast address and B is a site-local multicast
+ address, then Scope(A) < Scope(B).
+
+ This mapping implicitly conflates unicast site boundaries and
+ multicast site boundaries [9].
+
+2.2. IPv4 Addresses and IPv4-Mapped Addresses
+
+ The destination address selection algorithm operates on both IPv6
+ and IPv4 addresses. For this purpose, IPv4 addresses should be
+ represented as IPv4-mapped addresses [2]. For example, to lookup the
+ precedence or other attributes of an IPv4 address in the policy
+ table, lookup the corresponding IPv4-mapped IPv6 address.
+
+ IPv4 addresses are assigned scopes as follows. IPv4 auto-
+ configuration addresses [6], which have the prefix 169.254/16, are
+ assigned link-local scope. IPv4 private addresses [10], which have
+ the prefixes 10/8, 172.16/12, and 192.168/16, are assigned site-
+ local scope. IPv4 loopback addresses [11, section 4.2.2.11], which
+ have the prefix 127/8, are assigned link-local scope. Other IPv4
+ addresses are assigned global scope.
+
+ IPv4 addresses should be treated as having "preferred" configuration
+ status.
+
+2.3. IPv6 Addresses with Embedded IPv4 Addresses
+
+ IPv4-compatible addresses [2] and 6to4 addresses [12] contain an
+ embedded IPv4 address. For the purposes of this document, these
+ addresses should be treated as having the scope of the embedded IPv4
+
+Draves Standards Track - Expires June 2001 4
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+ address. For example, the IPv6 address ::169.254.3.18 has link-local
+ scope and the address 2002:0a01:0203::1 has site-local scope.
+
+ IPv4-compatible addresses should be treated as having "preferred"
+ configuration status.
+
+2.4. Loopback Address and Other Format Prefixes
+
+ The loopback address should be treated as having link-local scope
+ and "preferred" configuration status.
+
+ NSAP addresses, IPX addresses, and other addresses with as-yet-
+ undefined format prefixes should be treated as having global scope
+ and "preferred" configuration status. Later standards may supercede
+ this treatment.
+
+2.5. Policy Table
+
+ The policy table is a longest-matching-prefix lookup table, much
+ like a routing table. Given an address A, a lookup in the policy
+ table produces three values: a precedence value Precedence(A), a
+ classification or label SrcLabel(A), and a second label DstLabel(A).
+
+ The precedence value Precedence(A) is used for sorting destination
+ addresses. If Precedence(A) > Precedence(B), we say that address A
+ has higher precedence than address B, meaning that our algorithm
+ will prefer to sort destination address A before destination address
+ B.
+
+ The labels SrcLabel(A) and DstLabel(A) allow for policies that
+ prefer a particular source address prefix for use with a destination
+ address prefix. The algorithms prefer to use a source address S with
+ a destination address D if SrcLabel(S) = DstLabel(D).
+
+ IPv6 implementations SHOULD support configurable address selection
+ via a mechanism at least as powerful as the policy tables defined
+ here. If an implementation is not configurable or has not been
+ configured, then it SHOULD operate according to the algorithms
+ specified here in conjunction with the following default policy
+ table:
+
+ Prefix Precedence SrcLabel DstLabel
+ ::1/128 50 0 0
+ ::/0 40 1 1
+ 2002::/16 30 2 2
+ ::/96 20 3 3
+ ::ffff:0:0/96 10 4 4
+
+ One effect of the default policy table is to prefer using native
+ source addresses with native destination addresses, 6to4 [12] source
+ addresses with 6to4 destination addresses, and v4-compatible [2]
+ source addresses with v4-compatible destination addresses. Another
+
+
+Draves Standards Track - Expires June 2001 5
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+ effect of the default policy table is to prefer communication using
+ IPv6 addresses to communication using IPv4 addresses, if matching
+ source addresses are available.
+
+ Policy table entries for scoped address prefixes MAY be qualified
+ with an optional scope-id. If so, a prefix table entry only matches
+ against an address during a lookup if the scope-id also matches the
+ address's scope-id.
+
+2.6. Common Prefix Length
+
+ We define the common prefix length CommonPrefixLen(A, B) of two
+ addresses A and B as the length of the longest prefix (looking at
+ the most significant, or leftmost, bits) that the two addresses have
+ in common. It ranges from 0 to 128.
+
+3. Candidate Source Addresses
+
+ The source address selection algorithm uses the concept of a
+ "candidate set" of potential source addresses for a given
+ destination address. We write CandidateSource(A) to denote the
+ candidate set for the address A.
+
+ It is RECOMMENDED that the candidate source addresses be the set of
+ unicast addresses assigned to the interface that will be used to
+ send to the destination. (The "outgoing" interface.) On routers, the
+ candidate set MAY include unicast addresses assigned to any
+ interface that could forward the destination address to the outgoing
+ interface.
+
+ In some cases the destination address may be qualified with a scope-
+ id or other information that will constrain the candidate set.
+
+ For multicast and link-local destination addresses, the set of
+ candidate source addresses MUST only include addresses assigned to
+ interfaces belonging to the same link as the outgoing interface.
+
+ For site-local destination addresses, the set of candidate source
+ addresses MUST only include addresses assigned to interfaces
+ belonging to the same site as the outgoing interface.
+
+ In any case, anycast addresses, multicast addresses, and the
+ unspecified address MUST NOT be included in a candidate set.
+
+ If an application or upper-layer specifies a source address that is
+ not in the candidate set for the destination, then the network layer
+ MUST treat this is an error. If the application or upper-layer
+ specifies a source address that is in the candidate set for the
+ destination, then the network layer MUST respect that choice. If the
+ application or upper-layer does not specify a source address, then
+ the network layer uses the source address selection algorithm
+ specified in the next section.
+
+
+Draves Standards Track - Expires June 2001 6
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+4. Source Address Selection
+
+ The source address selection algorithm chooses a source address for
+ use with a destination address D. It is specified here in terms of
+ the pair-wise comparison of addresses SA and SB. The pair-wise
+ comparison can be used to select an address from the set
+ CandidateSource(D).
+
+ This source address selection algorithm only applies to IPv6
+ destination addresses, not IPv4 addresses.
+
+ The pair-wise comparison consists of eight rules, which should be
+ applied in order. If a rule chooses an address, then the remaining
+ rules are not relevant and should be ignored. Subsequent rules act
+ as tie-breakers for earlier rules. If the eight rules fail to choose
+ an address, some unspecified tie-breaker should be used.
+
+ Rule 1: Prefer same address.
+ If SA = D, then choose SA. Similarly, if SB = D, then choose SB.
+
+ Rule 2: Prefer appropriate scope.
+ If Scope(SA) < Scope(SB). If Scope(SA) < Scope(D), then choose SB
+ and otherwise choose SA.
+ Similarly, if Scope(SB) < Scope(SA). If Scope(SB) < Scope(D), then
+ choose SA and otherwise choose SB.
+
+ Rule 3: Avoid deprecated addresses.
+ The addresses SA and SB have the same scope. If one of the source
+ addresses is "preferred" and one of them is "deprecated", choose the
+ one that is preferred.
+
+ Rule 4: Prefer home addresses.
+ If SA is a home address and SB is a care-of address, then prefer SA.
+ Similarly, if SB is a home address and SA is a care-of address, then
+ prefer SB.
+ An implementation may support a per-connection configuration
+ mechanism (for example, a socket option) to reverse the sense of
+ this preference and prefer care-of addresses over home addresses.
+
+ Rule 5: Prefer outgoing interface.
+ If SA is assigned to the interface that will be used to send to D
+ and SB is assigned to a different interface, then prefer SA.
+ Similarly, if SB is assigned to the interface that will be used to
+ send to D and SA is assigned to a different interface, then prefer
+ SB.
+
+ Rule 6: Prefer matching label.
+ If Label(SA) = MatchSrcLabel(D) and Label(SB) <> MatchSrcLabel(D),
+ then choose SA. Similarly, if Label(SB) = MatchSrcLabel(D) and
+ Label(SA) <> MatchSrcLabel(D), then choose SB.
+
+
+
+
+Draves Standards Track - Expires June 2001 7
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+ Rule 7: Prefer temporary addresses.
+ If SA is a temporary address and SB is a public address, then prefer
+ SA. Similarly, if SB is a temporary address and SA is a public
+ address, then prefer SB.
+ An implementation may support a per-connection configuration
+ mechanism (for example, a socket option) to reverse the sense of
+ this preference and prefer public addresses over temporary
+ addresses.
+
+ Rule 8: Use longest matching prefix.
+ If CommonPrefixLen(SA, D) > CommonPrefixLen(SB, D), then choose SA.
+ Similarly, if CommonPrefixLen(SB, D) > CommonPrefixLen(SA, D), then
+ choose SB.
+
+ Rule 8 may be superceded if the implementation has other means of
+ choosing among source addresses. For example, if the implementation
+ somehow knows which source address will result in the "best"
+ communications performance.
+
+ Rule 2 (prefer appropriate scope) MUST be implemented and given high
+ priority because it can affect interoperability.
+
+5. Destination Address Selection
+
+ The destination address selection algorithm takes a list of
+ destination addresses and sorts the addresses to produce a new list.
+ It is specified here in terms of the pair-wise comparison of
+ addresses DA and DB, where DA appears before DB in the original
+ list.
+
+ The algorithm sorts together both IPv6 and IPv4 addresses. To find
+ the attributes of an IPv4 address in the policy table, the IPv4
+ address should be represented as an IPv4-mapped address.
+
+ We write Source(D) to indicate the selected source address for a
+ destination D. For IPv6 addresses, the previous section specifies
+ the source address selection algorithm. Source address selection for
+ IPv4 addresses is not specified in this document.
+
+ We say that Source(D) is undefined if there is no source address
+ available for destination D. For IPv6 addresses, this is only the
+ case if CandidateSource(D) is the empty set.
+
+ The pair-wise comparison of destination addresses consists of nine
+ rules, which should be applied in order. If a rule determines a
+ result, then the remaining rules are not relevant and should be
+ ignored. Subsequent rules act as tie-breakers for earlier rules.
+
+ Rule 1: Avoid unusable destinations.
+ If there is no route to DB or if Source(DB) is undefined, then sort
+ DA before DB. Similarly, if there is no route to DA or if Source(DA)
+ is undefined, then sort DB before DA.
+
+
+Draves Standards Track - Expires June 2001 8
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+ Rule 2: Prefer matching scope.
+ If Scope(DA) = Scope(Source(DA)) and Scope(DB) <> Scope(Source(DB)),
+ then sort DA before DB. Similarly, if Scope(DA) <> Scope(Source(DA))
+ and Scope(DB) = Scope(Source(DB)), then sort DB before DA.
+
+ Rule 3: Avoid deprecated addresses.
+ If Source(DA) is deprecated and Source(DB) is not, then sort DB
+ before DA. Similarly, if Source(DA) is not deprecated and Source(DB)
+ is deprecated, then sort DA before DB.
+
+ Rule 4: Prefer home addresses.
+ If Source(DA) is a home address and Source(DB) is a care-of address,
+ then sort DA before DB. Similarly, if Source(DA) is a care-of
+ address and Source(DB) is a home address, then sort DB before DA.
+
+ Rule 5: Prefer matching label.
+ If SrcLabel(Source(DA)) = DstLabel(DA) and SrcLabel(Source(DB)) <>
+ DstLabel(DB), then sort DA before DB. Similarly, if
+ SrcLabel(Source(DA)) <> DstLabel(DA) and SrcLabel(Source(DB)) =
+ DstLabel(DB), then sort DB before DA.
+
+ Rule 6: Prefer higher precedence.
+ If Precedence(DA) > Precedence(DB), then sort DA before DB.
+ Similarly, if Precedence(DA) < Precedence(DB), then sort DB before
+ DA.
+
+ Rule 7: Prefer smaller scope.
+ If Scope(DA) < Scope(DB), then sort DA before DB. Similarly, if
+ Scope(DA) > Scope(DB), then sort DB before DA.
+
+ Rule 8: Use longest matching prefix.
+ If CommonPrefixLen(DA, Source(DA)) > CommonPrefixLen(DB,
+ Source(DB)), then sort DA before DB. Similarly, if
+ CommonPrefixLen(DA, Source(DA)) < CommonPrefixLen(DB, Source(DB)),
+ then sort DB before DA.
+
+ Rule 9: Otherwise, leave the order unchanged.
+ Sort DA before DB.
+
+ Rules 8 and 9 may be superceded if the implementation has other
+ means of sorting destination addresses. For example, if the
+ implementation somehow knows which destination addresses will result
+ in the "best" communications performance.
+
+6. Interactions with Routing
+
+ This specification of source address selection assumes that routing
+ (more precisely, selecting an outgoing interface on a node with
+ multiple interfaces) is done before source address selection.
+ However, implementations may use source address considerations as a
+ tiebreaker when choosing among otherwise equivalent routes.
+
+
+
+Draves Standards Track - Expires June 2001 9
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+ For example, suppose a node has interfaces on two different links,
+ with both links having a working default router. Both of the
+ interfaces have preferred global addresses. When sending to a global
+ destination address, if there's no routing reason to prefer one
+ interface over the other, then an implementation may preferentially
+ choose the outgoing interface that will allow it to use the source
+ address that shares a longer common prefix with the destination.
+
+ Implementations may also use the choice of router to influence the
+ choice of source address. For example, suppose a host is on a link
+ with two routers. One router is advertising a global prefix A and
+ the other route is advertising global prefix B. Then when sending
+ via the first router, the host may prefer source addresses with
+ prefix A and when sending via the second router, prefer source
+ addresses with prefix B.
+
+7. Implementation Considerations
+
+ The destination address selection algorithm needs information about
+ potential source addresses. One possible implementation strategy is
+ for getipnodebyname() and getaddrinfo() to call down to the IPv6
+ network layer with a list of destination addresses, sort the list in
+ the network layer with full current knowledge of available source
+ addresses, and return the sorted list to getipnodebyname() or
+ getaddrinfo(). This is simple and gives the best results but it
+ introduces the overhead of another system call. One way to reduce
+ this overhead is to cache the sorted address list in the resolver,
+ so that subsequent calls for the same name do not need to resort the
+ list.
+
+ Another implementation strategy is to call down to the network layer
+ to retrieve source address information and then sort the list of
+ addresses directly in the context of getipnodebyname() or
+ getaddrinfo(). To reduce overhead in this approach, the source
+ address information can be cached, amortizing the overhead of
+ retrieving it across multiple calls to getipnodebyname() and
+ getaddrinfo(). In this approach, the implementation may not have
+ knowledge of the outgoing interface for each destination, so it MAY
+ use a looser definition of the candidate set during destination
+ address ordering.
+
+ In any case, if the implementation uses cached and possibly stale
+ information in its implementation of destination address selection,
+ or if the ordering of a cached list of destination addresses is
+ possibly stale, then it should ensure that the destination address
+ ordering returned to the application is no more than one second out
+ of date. For example, an implementation might make a system call to
+ check if any routing table entries or source address assignments
+ that might affect these algorithms have changed.
+
+
+
+
+
+Draves Standards Track - Expires June 2001 10
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+8. Security Considerations
+
+ This document has no direct impact on Internet infrastructure
+ security.
+
+9. Examples
+
+ This section contains a number of examples, first of default
+ behavior and then demonstrating the utility of policy table
+ configuration.
+
+9.1. Default Source Address Selection
+
+ The source address selection rules, in conjunction with the default
+ policy table, produce the following behavior:
+
+ Destination: 2001::1
+ Sources: 3ffe::1 vs fe80::1
+ Result: 3ffe::1 (prefer appropriate scope)
+
+ Destination: 2001::1
+ Sources: fe80::1 vs fec0::1
+ Result: fec0::1 (prefer appropriate scope)
+
+ Destination: fec0::1
+ Sources: fe80::1 vs 2001::1
+ Result: 2001::1 (prefer appropriate scope)
+
+ Destination: ff05::1
+ Sources: fe80::1 vs fec0::1 vs 2001::1
+ Result: fec0::1 (prefer appropriate scope)
+
+ Destination: 2001::1
+ Sources: 2001::1 (deprecated) vs 2002::1
+ Result: 2001::1 (prefer same address)
+
+ Destination: fec0::1
+ Sources: fec0::2 (deprecated) vs 2001::1
+ Result: fec0::2 (prefer appropriate scope)
+
+ Destination: 2001::1
+ Sources: 2001::2 vs 3ffe::2
+ Result: 2001::2 (longest-matching-prefix)
+
+ Destination: 2001::1
+ Sources: 2001::2 (care-of address) vs 3ffe::2 (home address)
+ Result: 3ffe::2 (prefer home address)
+
+ Destination: 2002:836b:2179::1
+ Sources: 2002:836b:2179::2 vs 2001::d5e3:7953:13eb:22e8 (temporary)
+ Result: 2002:836b:2179::2 (prefer matching label)
+
+
+
+Draves Standards Track - Expires June 2001 11
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+ Destination: 2001::1
+ Sources: 2001::2 vs 2001::d5e3:7953:13eb:22e8 (temporary)
+ Result: 2001::d5e3:7953:13eb:22e8 (prefer temporary address)
+
+9.2. Default Destination Address Selection
+
+ The destination address selection rules, in conjunction with the
+ default policy table and the source address selection rules, produce
+ the following behavior:
+
+ Sources: 2001::2 or fe80::1 or 169.254.13.78
+ Destinations: 2001::1 vs 131.107.65.121
+ Result: 2001::1 (src 2001::2) then 131.107.65.121 (src
+ 169.254.13.78) (prefer matching scope)
+
+ Sources: fe80::1 or 131.107.65.117
+ Destinations: 2001::1 vs 131.107.65.121
+ Result: 131.107.65.121 (src 131.107.65.117) then 2001::1 (src
+ fe80::1) (prefer matching scope)
+
+ Sources: 2001::2 or fe80::1 or 10.1.2.4
+ Destinations: 2001::1 vs 10.1.2.3
+ Result: 2001::1 (src 2001::2) then 10.1.2.3 (src 10.1.2.4) (prefer
+ higher precedence)
+
+ Sources: 2001::2 or fec0::2 or fe80::2
+ Destinations: 2001::1 vs fec0::1 vs fe80::1
+ Result: fe80::1 (src fe80::2) then fec0::1 (src fec0::2) then
+ 2001::1 (src 2001::2) (prefer smaller scope)
+
+ Sources: 2001::2 (care-of address) or 3ffe::1 (home address) or
+ fec0::2 (care-of address) or fe80::2 (care-of address)
+ Destinations: 2001::1 vs fec0::1
+ Result: 2001:1 (src 3ffe::1) then fec0::1 (src fec0::2) (prefer home
+ address)
+
+ Sources: 2001::2 or fec0::2 (deprecated) or fe80::2
+ Destinations: 2001::1 vs fec0::1
+ Result: 2001::1 (src 2001::2) then fec0::1 (src fec0::2) (avoid
+ deprecated addresses)
+
+ Sources: 2001::2 or 3f44::2 or fe80::2
+ Destinations: 2001::1 vs 3ffe::1
+ Result: 2001::1 (src 2001::2) then 3ffe::1 (src 3f44::2) (longest
+ matching prefix)
+
+ Sources: 2002:836b:4179::2 or fe80::2
+ Destinations: 2002:836b:4179::1 vs 2001::1
+ Result: 2002:836b:4179::1 (src 2002:836b:4179::2) then 2001::1 (src
+ 2002:836b:4179::2) (prefer matching label)
+
+ Sources: 2002:836b:4179::2 or 2001::2 or fe80::2
+ Destinations: 2002:836b:4179::1 vs 2001::1
+
+Draves Standards Track - Expires June 2001 12
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+ Result: 2001::1 (src 2001::2) then 2002:836b:4179::1 (src
+ 2002:836b:4179::2) (prefer higher precedence)
+
+9.3. Configuring Preference for IPv6 vs IPv4
+
+ The default policy table gives IPv6 addresses higher precedence than
+ IPv4 addresses. This means that applications will use IPv6 in
+ preference to IPv4 when the two are equally suitable. An
+ administrator can change the policy table to prefer IPv4 addresses
+ by giving the ::ffff:0.0.0.0/96 prefix a higher precedence:
+
+ Prefix Precedence SrcLabel DstLabel
+ ::1/128 50 0 0
+ ::/0 40 1 1
+ 2002::/16 30 2 2
+ ::/96 20 3 3
+ ::ffff:0:0/96 100 4 4
+
+ This change to the default policy table produces the following
+ behavior:
+
+ Sources: 2001::2 or fe80::1 or 169.254.13.78
+ Destinations: 2001::1 vs 131.107.65.121
+ Unchanged Result: 2001::1 (src 2001::2) then 131.107.65.121 (src
+ 169.254.13.78) (prefer matching scope)
+
+ Sources: fe80::1 or 131.107.65.117
+ Destinations: 2001::1 vs 131.107.65.121
+ Unchanged Result: 131.107.65.121 (src 131.107.65.117) then 2001::1
+ (src fe80::1) (prefer matching scope)
+
+ Sources: 2001::2 or fe80::1 or 10.1.2.4
+ Destinations: 2001::1 vs 10.1.2.3
+ New Result: 10.1.2.3 (src 10.1.2.4) then 2001::1 (src 2001::2)
+ (prefer higher precedence)
+
+9.4. Configuring Preference for Scoped Addresses
+
+ The destination address selection rules give preference to
+ destinations of smaller scope. For example, a site-local destination
+ will be sorted before a global scope destination when the two are
+ otherwise equally suitable. An administrator can change the policy
+ table to reverse this preference and sort global destinations before
+ site-local destinations, and site-local destinations before link-
+ local destinations:
+
+
+
+
+
+
+
+
+
+Draves Standards Track - Expires June 2001 13
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+ Prefix Precedence SrcLabel DstLabel
+ ::1/128 50 0 0
+ ::/0 40 1 1
+ fec0::/10 37 1 1
+ fe80::/10 33 1 1
+ 2002::/16 30 2 2
+ ::/96 20 3 3
+ ::ffff:0:0/96 10 4 4
+
+ This change to the default policy table produces the following
+ behavior:
+
+ Sources: 2001::2 or fec0::2 or fe80::2
+ Destinations: 2001::1 vs fec0::1 vs fe80::1
+ New Result: 2001::1 (src 2001::2) then fec0::1 (src fec0::2) then
+ fe80::1 (src fe80::2) (prefer higher precedence)
+
+ Sources: 2001::2 (deprecated) or fec0::2 or fe80::2
+ Destinations: 2001::1 vs fec0::1
+ Unchanged Result: fec0::1 (src fec0::2) then 2001::1 (src 2001::2)
+ (avoid deprecated addresses)
+
+9.5. Configuring a Multi-Homed Site
+
+ Consider a site A that has a business-critical relationship with
+ another site B. To support their business needs, the two sites have
+ contracted for service with a special high-performance ISP. This is
+ in addition to the normal Internet connection that both sites have
+ with different ISPs. The high-performance ISP is expensive and the
+ two sites wish to use it only for their business-critical traffic
+ with each other.
+
+ Each site has two global prefixes, one from the high-performance ISP
+ and one from their normal ISP. Site A has prefix 2001:aaaa:aaaa::/48
+ from the high-performance ISP and prefix 2007:0:aaaa::/48 from its
+ normal ISP. Site B has prefix 2001:bbbb:bbbb::/48 from the high-
+ performance ISP and prefix 2007:0:bbbb::/48 from its normal ISP. All
+ hosts in both sites register two addresses in the DNS.
+
+ The routing within both sites directs most traffic to the egress to
+ the normal ISP, but the routing directs traffic sent to the other
+ site's 2001 prefix to the egress to the high-performance ISP. To
+ prevent unintended use of their high-performance ISP connection, the
+ two sites implement ingress filtering to discard traffic entering
+ from the high-performance ISP that is not from the other site.
+
+ The default policy table and address selection rules produce the
+ following behavior:
+
+ Sources: 2001:aaaa:aaaa::a or 2007:0:aaaa::a or fe80::a
+ Destinations: 2001:bbbb:bbbb::b vs 2007:0:bbbb::b
+
+
+
+Draves Standards Track - Expires June 2001 14
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+ Result: 2007:0:bbbb::b (src 2007:0:aaaa::a) then 2001:bbbb:bbbb::b
+ (src 2001:aaaa:aaaa::a) (longest matching prefix)
+
+ In other words, when a host in site A initiates a connection to a
+ host in site B, the traffic does not take advantage of their
+ connections to the high-performance ISP. This is not their desired
+ behavior.
+
+ Sources: 2001:aaaa:aaaa::a or 2007:0:aaaa::a or fe80::a
+ Destinations: 2001:cccc:cccc::c vs 2006:cccc:cccc::c
+ Result: 2001:cccc:cccc::c (src 2001:aaaa:aaaa::a) then
+ 2006:cccc:cccc::c (src 2007:0:aaaa::a) (longest matching prefix)
+
+ In other words, when a host in site A initiates a connection to a
+ host in some other site C, the reverse traffic may come back through
+ the high-performance ISP. Again, this is not their desired behavior.
+
+ This situation demonstrates the limitations of the longest-matching-
+ prefix heuristic in multi-homed situations.
+
+ However, the administrators of sites A and B can achieve their
+ desired behavior via policy table configuration. For example, they
+ can use the following policy table:
+
+ Prefix Precedence SrcLabel DstLabel
+ ::1 50 0 0
+ 2001:aaaa:aaaa::/48 45 5 5
+ 2001:bbbb:bbbb::/48 45 5 5
+ ::/0 40 1 1
+ 2002::/16 30 2 2
+ ::/96 20 3 3
+ ::ffff:0:0/96 10 4 4
+
+ This policy table produces the following behavior:
+
+ Sources: 2001:aaaa:aaaa::a or 2007:0:aaaa::a or fe80::a
+ Destinations: 2001:bbbb:bbbb::b vs 2007:0:bbbb::b
+ New Result: 2001:bbbb:bbbb::b (src 2001:aaaa:aaaa::a) then
+ 2007:0:bbbb::b (src 2007:0:aaaa::a) (prefer higher precedence)
+
+ In other words, when a host in site A initiates a connection to a
+ host in site B, the traffic uses the high-performance ISP as
+ desired.
+
+ Sources: 2001:aaaa:aaaa::a or 2007:0:aaaa::a or fe80::a
+ Destinations: 2001:cccc:cccc::c vs 2006:cccc:cccc::c
+ New Result: 2006:cccc:cccc::c (src 2007:0:aaaa::a) then
+ 2001:cccc:cccc::c (src 2007:0:aaaa::a) (longest matching prefix)
+
+ In other words, when a host in site A initiates a connection to a
+ host in some other site C, the traffic uses the normal ISP as
+ desired.
+
+
+Draves Standards Track - Expires June 2001 15
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+References
+
+ 1 S. Bradner, "The Internet Standards Process -- Revision 3", BCP
+ 9, RFC 2026, October 1996.
+
+ 2 R. Hinden, S. Deering, "IP Version 6 Addressing Architecture",
+ RFC 2373, July 1998.
+
+ 3 S. Thompson, T. Narten, "IPv6 Stateless Address Autoconfig-
+ uration", RFC 2462 , December 1998.
+
+ 4 T. Narten, R. Draves, "Privacy Extensions for Stateless Address
+ Autoconfiguration in IPv6", draft-ietf-ipngwg-addrconf-privacy-
+ 01.txt, July 2000.
+
+ 5 D. Johnson, C. Perkins, "Mobility Support in IPv6", draft-ietf-
+ mobileip-ipv6-12.txt, April 2000.
+
+ 6 R. Troll. "Automatically Choosing an IP Address in an Ad-Hoc IPv4
+ Network", draft-ietf-dhc-ipv4-autoconfig-05.txt, March 2000.
+
+ 7 S. Bradner, "Key words for use in RFCs to Indicate Requirement
+ Levels", BCP 14, RFC 2119, March 1997.
+
+ 8 R. Gilligan, S. Thomson, J. Bound, W. Stevens, "Basic Socket
+ Interface Extensions for IPv6", RFC 2553, March 1999.
+
+ 9 S. Deering, B. Haberman, B. Zill. "IP Version 6 Scoped Address
+ Architecture", draft-ietf-ipngwg-scoping-arch-01.txt, March 2000.
+
+ 10 Y. Rekhter et. al, "Address Allocation for Private Internets",
+ RFC 1918, February 1996.
+
+ 11 F. Baker, Editor. "Requirements for IP Version 4 Routers", RFC
+ 1812, June 1995.
+
+ 12 B. Carpenter, K. Moore. "Connection of IPv6 Domains via IPv4
+ Clouds", draft-ietf-ngtrans-6to4-07.txt, September 2000.
+
+Acknowledgments
+
+ The author would like to acknowledge the contributions of the IPng
+ Working Group, particularly Steve Deering and Ken Powell. Please let
+ the author know if you contributed to the development of this draft
+ and are not mentioned here.
+
+Author's Address
+
+ Richard Draves
+ Microsoft Research
+ One Microsoft Way
+ Redmond, WA 98052
+
+
+Draves Standards Track - Expires June 2001 16
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+ Phone: 1-425-936-2268
+ Email: richdr@microsoft.com
+
+Revision History
+
+Changes from draft-ietf-ipngwg-default-addr-select-01
+
+ Added Examples section, demonstrating default behavior and some
+ policy table configuration scenarios.
+
+ Removed many uses of MUST. Remaining uses concern the candidate set
+ of source addresses and the source address selection rule that
+ prefers source addresses of appropriate scope.
+
+ Simplified the default policy table. Reordered the source address
+ selection rules to reduce the influence of policy labels. Added more
+ destination address selection rules.
+
+ Added scoping of v4-compatible and 6to4 addresses based on the
+ embedded IPv4 address.
+
+ Changed references to anonymous addresses to use the new term,
+ temporary addresses.
+
+ Clarified that a user-level implementation of destination address
+ ordering, which does not have knowledge of the outgoing interface
+ for each destination, may use a looser definition of the candidate
+ set.
+
+ Clarified that an implementation should prevent an application or
+ upper-layer from choosing a source address that is not in the
+ candidate set and not prevent an application or upper-layer from
+ choosing a source address that is in the candidate set.
+
+ Miscellaneous editorial changes, including adding some missing
+ references.
+
+Changes from draft-ietf-ipngwg-default-addr-select-00
+
+ Changed the candidate set definition so that the strong host model
+ is recommended but not required. Added a rule to source address
+ selection to prefer addresses assigned to the outgoing interface.
+
+ Simplified the destination address selection algorithm, by having it
+ use source address selection as a subroutine.
+
+ Added a rule to source address selection to handle anonymous/public
+ addresses.
+
+ Added a rule to source address selection to handle home/care-of
+ addresses.
+
+
+
+Draves Standards Track - Expires June 2001 17
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+ Changed to allow destination address selection to sort both IPv6 and
+ IPv4 addresses. Added entries in the default policy table for IPv4-
+ mapped addresses.
+
+ Changed default precedences, so v4-compatible addresses have lower
+ precedence than 6to4 addresses.
+
+Changes from draft-draves-ipngwg-simple-srcaddr-01
+
+ Added framework discussion.
+
+ Added algorithm for destination address ordering.
+
+ Added mechanism to allow the specification of administrative policy
+ that can override the default behavior.
+
+ Added section on routing interactions and TBD section on mobility
+ interactions.
+
+ Changed the candidate set definition for source address selection,
+ so that only addresses assigned to the outgoing interface are
+ allowed.
+
+ Changed the loopback address treatment to link-local scope.
+
+Changes from draft-draves-ipngwg-simple-srcaddr-00
+
+ Minor wording changes because DHCPv6 also supports "preferred" and
+ "deprecated" addresses.
+
+ Specified treatment of other format prefixes; now they are
+ considered global scope, "preferred" addresses.
+
+ Reiterated that anycast and multicast addresses are not allowed as
+ source addresses.
+
+ Recommended that source addresses be taken from the outgoing
+ interface. Required this for multicast destinations. Added analogous
+ requirements for link-local and site-local destinations.
+
+ Specified treatment of the loopback address.
+
+ Changed the second selection rule so that if both candidate source
+ addresses have scope greater or equal than the destination address
+ and only of them is preferred, the preferred address is chosen.
+
+
+
+
+
+
+
+
+
+Draves Standards Track - Expires June 2001 18
+draft-ietf-ipngwg-default-addr-select-02 November 24, 2000
+
+
+ Full Copyright Statement
+
+ Copyright (C) The Internet Society (1999). All Rights Reserved.
+
+ This document and translations of it may be copied and furnished to
+ others, and derivative works that comment on or otherwise explain it
+ or assist in its implementation may be prepared, copied, published
+ and distributed, in whole or in part, without restriction of any
+ kind, provided that the above copyright notice and this paragraph
+ are included on all such copies and derivative works. However, this
+ document itself may not be modified in any way, such as by removing
+ the copyright notice or references to the Internet Society or other
+ Internet organizations, except as needed for the purpose of
+ developing Internet standards in which case the procedures for
+ copyrights defined in the Internet Standards process must be
+ followed, or as required to translate it into languages other than
+ English.
+
+ The limited permissions granted above are perpetual and will not be
+ revoked by the Internet Society or its successors or assigns.
+
+ This document and the information contained herein is provided on an
+ "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+ TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
+ BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
+ HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Draves Standards Track - Expires June 2001 19 \ No newline at end of file
diff --git a/doc/draft/draft-klensin-1591-reflections-01.txt b/doc/draft/draft-klensin-1591-reflections-01.txt
new file mode 100644
index 00000000..85c98b30
--- /dev/null
+++ b/doc/draft/draft-klensin-1591-reflections-01.txt
@@ -0,0 +1,393 @@
+INTERNET-DRAFT John C. Klensin
+Expires May 2001
+November 10, 2000
+
+ Reflections on the DNS, RFC 1591, and Categories of Domains
+
+ draft-klensin-1591-reflections-01.txt
+
+Status of this Memo
+
+ This document is an Internet-Draft and is in full conformance
+ with all provisions of Section 10 of RFC2026 except that the
+ right to produce derivative works is not granted.
+
+ Internet-Drafts are working documents of the Internet Engineering
+ Task Force (IETF), its areas, and its working groups. Note that
+ other groups may also distribute working documents as
+ Internet-Drafts.
+
+ Internet-Drafts are draft documents valid for a maximum of six
+ months and may be updated, replaced, or obsoleted by other
+ documents at any time. It is inappropriate to use Internet-
+ Drafts as reference material or to cite them other than as
+ "work in progress."
+
+ The list of current Internet-Drafts can be accessed at
+ http://www.ietf.org/ietf/1id-abstracts.txt
+
+ The list of Internet-Draft Shadow Directories can be accessed at
+ http://www.ietf.org/shadow.html.
+
+This document is purely informational, for comment, and to stimulate
+other discussions: it is not expected to be, or evolve into, a
+standard of any form.
+
+
+0. Abstract
+
+RFC 1591, "Domain Name System Structure and Delegation" [1] laid out
+the basic administrative design and principles for the allocation and
+administration of domains, from the top level down. It was written
+before the introduction of the world wide web and rapid growth of the
+Internet put significant market, social, and political pressure on
+domain name allocations. In recent years, 1591 has been cited by all
+sides in various debates, and attempts have been made by various
+bodies to update it or adjust its provisions, sometimes under
+pressures that have arguably produced policies that are less well
+thought out than the original. Some of those efforts have begun from
+misconceptions about the provisions of 1591 or the motivation for
+those provisions. This memo includes some thoughts about how 1591
+might be interpreted and adjusted by the IANA and ICANN to better
+reflect today's world while retaining characteristics and policies
+that have proven to be effective in supporting Internet growth and
+stability. An earlier variation of this memo was submitted to ICANN
+as a comment on its evolving TLD policies.
+
+
+
+1. Introduction
+
+RFC1591 has been heavily discussed and referenced in recent months,
+especially in discussions within ICANN and its predecessors about the
+creation, delegation, and management of top-level domains. In
+particular, the ICANN Domain Name Supporting Organization (DNSO), and
+especially its ccTLD constituency, have been the home of many
+discussions in which 1591 and interpretations of it have been cited
+in support of a variety of sometimes-contradictory positions. During
+that period, other discussions have gone on to try to reconstruct the
+thinking that went into RFC 1591. Those in turn have led me and
+others to muse on how that original thinking might relate to some of
+the issues being raised. 1591 is, I believe, one of Jon Postel's
+masterpieces, drawing together very different philosophies (e.g., his
+traditional view that people are basically reasonable and will do the
+right thing if told what it is with some stronger mechanisms when
+that model is not successful) into a single whole.
+
+RFC 1591 was written in the context of the assumption that what it
+described as generic TLDs would be bound to policies and categories
+of registration (see the "This domain is intended..." text in
+section 2) while ccTLDs were expected to be used primarily to support
+users and uses within and for a country and its residents. The
+notion that different domains would be run in different ways --albeit
+within the broad contexts of "public service on behalf of the
+Internet community" and "trustee... for the global Internet
+community"-- was considered a design feature and a safeguard against
+a variety of potential abuses. Obviously the world has changed in
+many ways in the five or six years since 1591 was written. In
+particular, the Internet has become more heavily used and, because
+the design of the world wide web has put domain names in front of
+users, top-level domain names and registrations in them have been
+heavily in demand: not only has the number of hosts increased
+dramatically during that time, but the ratio between registered
+domain names and physical hosts has increased very significantly.
+
+The issues 1591 attempted to address when it was written and those we
+face today have not changed significantly in principle. But we should
+take a step back to refine it into a model that can function
+effectively today. Therefore, it may be useful to try to reconstruct
+1591's principles and think about their applicability today as a
+model that can continue to be applied: not because it is historically
+significant, but because many of its elements have proven to work
+reasonably well, even in difficult situations. In particular, for
+many domains (some in 1591's "generic" list and others in its
+"country code" category) the notion of "public service" --expected
+then to imply being carried out at no or minimal cost to the users,
+not merely on a non-profit basis-- has yielded to profitability
+calculations. And, in most of the rest, considerations of at least
+calculating and recovering costs have crept in. While many of us
+feel some nostalgia for the old system, it is clear that its days are
+waning if not gone: perhaps the public service notions as understood
+when 1591 was written just don't scale to rapid internet growth and
+very large numbers of registrations.
+
+In particular, some ccTLDs have advertised for registrations outside
+the designated countries (or other entities), while others have made
+clear decisions to allow registrations by non-nationals (e.g., the UK
+or Australia). These decisions and others have produced protests
+from many sides, suggesting, in turn, that a recategorization is in
+order. For example, we have heard concerns by governments and
+managers of traditional, "public service", in-country, ccTLDs about
+excessive ICANN interference and fears of being forced to conform to
+internationally-set policies for dispute resolution when their
+domestic ones are considered more appropriate. We have also heard
+concerns from registrars and operators of externally-marketed ccTLDs
+about unreasonable government interference and from gTLD registrars
+and registries about unreasonable competition from aggressively
+marketed ccTLDs. The appropriate distinction is no longer between
+what RFC 1591 described as "generic" TLDs (but which were really
+intended to be "purpose-specific", a term I will use again below) and
+ccTLDs but among:
+
+ (i) true "generic" TLDs, in which any registration is acceptable
+ and, ordinarily, registrations from all sources are actively
+ promoted. This list currently includes (the formerly
+ purpose-specific) COM, NET, and ORG, and some ccTLDs. There have
+ been proposals from time to time for additional TLDs of this
+ variety in which, as with COM (and, more recently, NET and ORG)
+ anyone (generally subject only to name conflicts and national
+ law) could register who could pay the fees.
+
+ (ii) purpose-specific TLDs, in which registration is accepted
+ only from organizations or individuals meeting particular
+ qualifications, but where those qualifications are not tied to
+ national boundaries. This list currently includes INT, EDU, the
+ infrastructure domain ARPA, and, arguably, the specialized US
+ Government TLDs MIL and GOV. There have been proposals from
+ time to time for other international TLDs of this variety, e.g.,
+ for medical entities such as physicians and hospitals and for
+ museums. Some of these proposals are in front of ICANN as this
+ document is being written; ICANN describes them as "sponsored"
+ TLDs.
+
+ (iii) Country domains, operated according to the original
+ underlying assumptions of 1591, i.e., registrants are largely
+ expected to be people or other entities within the country.
+ While external registrations might be accepted by some of these,
+ the country does not aggressively advertise for such
+ registrations, nor does anyone expect to derive significant fee
+ revenue from them. All current domains in this category are
+ ccTLDs, but not all ccTLDs are in this category.
+
+These categories are clearly orthogonal to the association between
+the use of the IS 3166-1 registered code list [2] and two-letter
+"country" domain names. If that relationship is to be maintained
+(and I believe it is desirable), the only inherent requirement is
+that no two-letter TLDs be created except from that list (in order to
+avoid future conflicts). ICANN should control the allocation and
+delegation of TLDs using these, and other, criteria, but only
+registered 3166-1 two letter codes should be used as two-letter TLDs.
+
+
+2. Implications of the Categories
+
+If we adopt this type of three-way categorization and can make it
+work, I believe it presents several opportunities for ICANN and the
+community more generally to reduce controversies and move forward. Of
+course, there will be cases where the categorization of a particular
+domain and its operating style will not be completely clear-cut (see
+section 3, below). But having ICANN work out procedures for dealing
+with those (probably few) situations appears preferable to strategies
+that would tend to propel ICANN into areas that are beyond its
+competence or that might require significant expansion of its mandate.
+
+First, the internally-operated ccTLDs (category iii above) should not
+be required to have much interaction with ICANN or vice versa. Once
+a domain of this sort is established and delegated, and assuming that
+the "admin contact in the country" rule is strictly observed, the
+domain should be able to function effectively without ICANN
+intervention or oversight. In particular, while a country might
+choose to adopt the general ICANN policies about dispute resolution
+or name management, issues that arise in these areas might equally
+well be dealt with exclusively under applicable national laws. If a
+domain chooses to use ICANN services that cost resources to provide,
+it should contribute to ICANN's support, but, if it does not, ICANN
+should not presume to charge it for other than a reasonable fraction
+of the costs to ICANN of operating the root, root servers, and any
+directory systems that are generally agreed upon to be necessary and
+in which the domain participates.
+
+By contrast, ccTLDs operated as generic domains ought to be treated
+as generic domains. ICANN dispute resolution and name management
+policies and any special rules developed to protect the Internet
+public in multiple registrar or registry situations should reasonably
+apply.
+
+3. Telling TLD types apart
+
+If appropriate policies are adopted, ccTLDs operated as generic
+domains (category (i) above) and those operated as country domains
+(category (iii) above) ought to be able to be self-identified. There
+are several criteria that could be applied to make this
+determination. For example, either a domain is aggressively seeking
+outside registrations or it is not and either the vast majority of
+registrants in a domain are in-country or they are not. One could
+also think of this as the issue of having some tangible level of
+presence in the jurisdiction - e.g., is the administrative contact
+subject, in practical terms, to the in-country laws, or are the
+registration rules such that it is reasonably likely that a court in
+the jurisdiction of the country associated with the domain can
+exercise jurisdiction and enforce a judgment against the registrant.
+
+One (fairly non-intrusive) rule ICANN might well impose on all
+top-level domains is that they identify and publish the policies they
+intend to use. E.g., registrants in a domain that will use the laws
+of one particular country to resolve disputes should have a
+reasonable opportunity to understand those policies prior to
+registration and to make other arrangements (e.g., to register
+elsewhere) if that mechanism for dispute resolution is not
+acceptable. Giving IANA (as the root registrar) incorrect
+information about the purpose and use of a domain should be subject
+to challenge, and should be grounds for reviewing the appropriateness
+of the domain delegation, just as not acting consistently and
+equitably provides such grounds under the original provisions of RFC
+1591.
+
+In order to ensure the availability of accurate and up-to-date
+registration information the criteria must be consistent, and
+consistent with more traditional gTLDs, for all nominally country
+code domains operating as generic TLDs.
+
+
+4. The role of ICANN in country domains
+
+ICANN (and IANA) should, as described above, have as little
+involvement as possible in the direction of true country [code]
+domains (i.e., category (iii)). There is no particular reason why
+these domains should be subject to ICANN regulation beyond the basic
+principles of 1591 and associated arrangements needed to ensure
+Internet interoperability and stability.
+
+ICANN's avoiding such involvement strengthens it: the desirability of
+avoiding collisions with national sovereignty, determinations about
+government legitimacy, and the authority of someone proportedly
+writing on behalf of a government, is as important today as it was
+when 1591 was written. The alternatives take us quickly from
+"administration" into "internet governance" or, in the case of
+determining which claimant is the legitimate government of a country,
+"international relations", and the reasons for not moving in that
+particular direction are legion.
+
+5. The role of governments
+
+The history of IANA strategy in handling ccTLDs included three major
+"things to avoid" considerations:
+
+ * Never get involved in determining which entities were countries
+ and which ones were not.
+
+ * Never get involved in determining who was, or was not, the
+ legitimate government of a country. And, more generally, avoid
+ deciding what entity --government, religion, commercial,
+ academic, etc.-- has what legitimacy or rights.
+
+ * If possible, never become involved in in-country disputes.
+ Instead, very strongly encourage internal parties to work
+ problems out among themselves. At most, adopt a role as
+ mediator and educator, rather than judge, unless abuses are very
+ clear and clearly will not be settled by any internal mechanism.
+
+All three considerations were obviously intended to avoid IANA's
+being dragged into a political morass in which it had (and, I
+suggest, has) no competence to resolve the issues and could only get
+bogged down. The first consideration was the most visible (and the
+easiest) and was implemented by strict adherence to the ISO 3166
+registered Country Code list. If an entity had a code, it was
+eligible to be registered with a TLD (although IANA was free to apply
+other criteria-most of them stated in 1591). If it did not, there
+were no exceptions: the applicant's only recourse was a discussion
+with the 3166 Registration Authority (now Maintenance Agency, often
+known just as "3166/MA") or the UN Statistical Office (now Statistics
+Bureau), not with IANA.
+This, obviously, is also the argument against use of the "reserved"
+list, at least without explicit agreement with 3166/MA: since IANA
+(or ICANN) can ask that a name be placed on that list, there is no
+rule of an absolute determination by an external organization.
+Proported countries can come to ICANN, insist on having delegations
+made and persuade ICANN to ask that the names be reserved. Then,
+since the reserved name would exist, insist that the domain be
+delegated. Worse, someone could use another organization to request
+reservation of the name by 3166/MA; once it was reserved, ICANN might
+be hard-pressed not to do the delegation. Of course, ICANN could
+(and probably would be forced to) adopt additional criteria other
+than appearance on the "reserved list" in order to delegate such
+domains. But those criteria would almost certainly be nearly
+equivalent to determining which applicants were legitimate and stable
+enough to be considered a country, the exact decision process that
+1591 strove to avoid.
+
+The other two considerations were more subtle and not always
+successful: from time to time, both before and after the formal
+policy shifted toward "governments could have their way", IANA
+received letters from people proporting to be competent government
+authorities asking for changes. Some of them turned out later to not
+have that authority or those qualifications. The assumption of 1591
+itself was that, if the "administrative contact in country" rule was
+strictly observed, as was the rule that delegation changes requested
+by the administrative contact would be honored, then, if a government
+_really_ wanted to assert itself, it could pressure the
+administrative contact into requesting the changes it wanted, using
+whatever would pass for due process in that country. And the ability
+to apply that process and pressure would effectively determine who
+was the government and who wasn't, and would do so far more
+effectively than any IANA evaluation of, e.g., whether the letterhead
+on a request looked authentic (and far more safely for ICANN than
+asking the opinion of any particular other government).
+
+Specific language in 1591 permitted IANA to adopt a "work it our
+yourselves; if we have to decide, we will strive for a solution that
+is not satisfactory to any party" stance. That approach was used
+successfully, along with large doses of education, on many occasions
+over the years, to avoid IANA's having to assume the role of judge
+between conflicting parties.
+
+Similar principles could be applied to the boundary between country-
+code-based generic TLDs and country domains. Different countries,
+under different circumstances, might prefer to operate the ccTLD
+either as a national service or as a profit center where the
+"customers" were largely external. Whatever decisions were made
+historically, general Internet stability argues that changes should
+not be made lightly. At the same time, if a government wishes to
+make a change, the best mechanism for doing so is not to involve
+ICANN in a potential determination of legitimacy (or even to have the
+GAC try to formally make that decision for individual countries) but
+for the relevant government to use its own procedures to persuade the
+administrative contact to request the change.
+
+
+6. Implications for the current DNSO structure.
+
+The arguments by some of the ccTLD administrators that they are
+different from the rest of the ICANN and DNSO structures are (in this
+model) correct: they are different. The ccTLDs that are operating as
+generic TLDs should be separated from the ccTLD constituency and
+joined to the gTLD constituency (which could use a few more members).
+The country ccTLDs should be separated from ICANN's immediate
+Supporting Organization structure, and operate in a parallel and
+advisory capacity to ICANN, similar to the arrangements used with the
+GAC. The DNSO and country TLDs should not be required to interact
+with each other except on a mutually voluntary basis and, if ICANN
+needs interaction or advice from some of all of those TLDs, it would
+be more appropriate to get it in the form of an advisory body like
+the GAC rather than as DNSO constituency.
+
+7. References
+
+[1] Postel, Jon. Domain Name System Structure and Delegation,
+ RFC 1591. USC Information Sciences Institute: March 1994.
+
+[2] ISO 3166. Codes for the identification of names of countries (??)
+
+8. Acknowledgements and disclaimer
+
+These reflections have been prepared in my individual capacity and do
+not necessarily reflect the views of my past or present employers.
+Several people, including Randy Bush, Theresa Swinehart, Zita Wenzel
+and several anonymous reviewers, made suggestions about earlier
+versions of this document. Those comments contributed significantly
+to whatever clarity the document has, but the author bears
+responsibility for the selection of comments which were ultimately
+incorporated and the way in which the conclusions were presented.
+
+9. Security Considerations
+
+This memo addresses the context for a set of administrative decisions
+and procedures, and does not raise or address security issues.
+
+
+10. Author's address
+
+John C Klensin
+1770 Massachusetts Ave, Suite 322
+Cambridge, MA 02140, USA
+klensin@jck.com
diff --git a/doc/draft/draft-manning-multicast-dns-02.txt b/doc/draft/draft-manning-multicast-dns-02.txt
new file mode 100644
index 00000000..d25613d0
--- /dev/null
+++ b/doc/draft/draft-manning-multicast-dns-02.txt
@@ -0,0 +1,419 @@
+Network Working Group B. Woodcock
+Request for Comments: nnnn Zocalo
+Category: Experimental B. Manning
+ ISI
+ August 2000
+
+
+ Multicast Discovery of DNS Services
+ draft-manning-multicast-dns-02.txt
+
+Status of this Memo
+
+ This document is an Internet-Draft and is in full conformance
+ with all provisions of Section 10 of RFC2026 except that the right
+ to produce derivative works is not granted. Internet-Drafts are
+ working documents of the Internet Engineering Task Force (IETF),
+ its areas, and its working groups. Note that other groups may also
+ distribute working documents as Internet-Drafts.
+
+ Internet-Drafts are draft documents valid for a maximum of six
+ months and may be updated, replaced, or obsoleted by other
+ documents at any time. It is inappropriate to use Internet-
+ Drafts as reference material or to cite them other than as
+ "work in progress."
+
+ To view the list Internet-Draft Shadow Directories, see
+ http://www.ietf.org/shadow.html.
+
+ This memo defines an Experimental Protocol for the Internet
+ community. This memo does not specify an Internet standard of any
+ kind. Discussion and suggestions for improvement are requested.
+ Distribution of this memo is unlimited.
+
+Copyright Notice
+
+ Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+1. Introduction
+
+ This document describes a minimal extension to the method of a DNS
+ query which allows unconfigured hosts to locate a local DNS server,
+ or in the absence of a DNS server to nonetheless identify some
+ local network services.
+
+2. Acknowledgments
+
+ Vital contributions to this document were made by Paul Vixie, Dave
+ Meyer, Stuart Cheshire, Richard Ford, Tony McGregor, Erik Guttman,
+ Benard Aboba, and Peter Ford. Thanks also to Alex Hoppman for
+ discussion of text-encoding methods.
+
+3. Overview and rationale
+
+ This experimental extension to DNS is intended to provide a bootstrap
+ mechanism whereby unconfigured devices may find a local DNS server
+ and begin using it to perform the usual name resolution and service
+ lookup functions. This need is particularly acute in the absence of
+ a DHCP server.
+
+ Secondarily, it is anticipated that device vendors may implement the
+ server (query-receiving) portion of this extension, in order to
+ render unconfigured devices which may lack an out-of-band
+ configuration interface such as a screen or keyboard discoverable on
+ the local network. For example, if a newly-purchased laser printer
+ or router were connected to a network, this extension would allow a
+ system administrator to use the DNS to discover the IP address which
+ the device had selected or been DHCP-assigned, and begin
+ communicating with it through the network.
+
+ A tertiary objective of this extension is to make possible the
+ deprecation of the AppleTalk protocol, which has been prolonged as a
+ means of providing support for "network browsing."
+
+4. Discussion
+
+ This extension to the DNS protocol consists of a single change to the
+ method of use, and no change whatsoever to the current format of DNS
+ packets. Specifically, this extension allows UDP DNS queries, as
+ documented in RFC 1035, sections 4.1.1, 4.1.2 and 4.2.1, to be
+ addressed to port 53 of statically-assigned relative offset -2 within
+ the range of multicast addresses defined as "administratively scoped"
+ by RFC 2365, section 9. Within the full /8 of administratively
+ scoped addresses, this corresponds to the destination address
+ 239.255.255.253. Until MZAP or a similar protocol is implemented to
+ allow hosts to discover the extent of the local multicast scopes
+ which enclose them, it is anticipated that implementations will
+ simply utilize the destination address 239.255.255.253.
+
+ In order to receive multicasted queries, DNS server implementations
+ MUST listen on the -2 offset to their local scope (as above, in the
+ absence of a method of determining the scope, this will be assumed to
+ be relative to the full /8 allocated for administratively-scoped
+ multicast use, or 239.255.255.253), and respond via ordinary unicast
+ UDP to ONLY those queries for which they have or can find a positive
+ non-null answer. Multicast-enabled DNS servers MUST answer
+ multicasted queries non-authoritatively. That is, when responding to
+ a query which was received via multicast, they MAY NOT include an NS
+ record which contains data which resolves back to their own IP
+ address.
+
+ Resolvers SHOULD be liberal in their acceptance of wildcard queries.
+ That is, resolvers should anticipate receiving queries which will
+ contain the asterisk character in any position within the query's
+ data field. For example, a query for SRV RRs with data
+ "afp.tcp.*.domain.com." would match "afp.tcp.server.domain.com." but
+ not match "afp.tcp.". A query for "afp.tcp.*" would match both,
+ since the asterisk should be interpreted as matching zero or more
+ characters within the RR data.
+
+ Resolvers MUST anticipate receiving no replies to some multicasted
+ queries, in the event that no multicast-enabled DNS server
+ implementations are active within the local scope, or in the event
+ that no positive non-null responses exist to the transmitted query.
+ That is, a query for the MX record for host.domain.com would go
+ unanswered if no local server was able to resolve that request, if no
+ MX record exists for host.domain.com, or if no local servers were
+ capable of receiving multicast queries. The resolver which initiated
+ the query MUST treat such non-response as a non-cacheable negative
+ response. Since this multicast transmission does not provide
+ reliable delivery, resolvers MAY repeat the transmission of a query
+ in order to assure themselves that is has been reveived by any hosts
+ capable of answering, however any resolvers which repeat a query MUST
+ increase the interval between such repetitions exponentially over
+ time.
+
+ Resolvers MUST also anticipate receiving multiple replies to the same
+ multicasted query, in the event that several multicast-enabled DNS
+ servers receive the query and respond with valid answers. When this
+ occurs, the responses MAY first be concatenated, and then treated in
+ the same manner that multiple RRs received from the same server
+ would, ordinarily.
+
+
+5. Implementation Notes Appendix
+
+ It is anticipated that a major use of this extension to DNS will be
+ for the replacement of the AppleTalk Name Binding Protocol (NBP)
+ "distributed database," and the implementation of a similar service
+ within other operating systems and on other platforms. Such use
+ implies the existence of "stub DNS servers" on each participating
+ host, each containing only local information in its served zones, but
+ not to the exclusion of data which other servers may assert within
+ the same zones.
+
+ The following rather complex example shows the format by which an
+ implementor could assert the local information possessed by any
+ Macintosh in zones served by a stub DNS server on that host:
+
+ $ORIGIN .
+ @ SOA . . 1998082701 0 0 0 0
+ 0 IN NS dns.udp.
+ Jasons-Mac 0 IN A 169.254.101.218
+ 0 IN HINFO Macintosh-G3-400 MacOS-8.6
+ 0 IN LOC 37 52 N 122 20 W
+ 0 IN RP . owner-name.Jasons-Mac.
+ Jasons-Hard-Disk 0 IN A 169.254.101.218
+ 0 IN TXT "UTF8-encoded service-name"
+ Print-Spooler 0 IN A 169.254.101.218
+ 0 IN TXT "UTF8-encoded service-name"
+ dns.udp 0 IN SRV 0 0 53 Jasons-Mac.
+ afp.tcp 0 IN SRV 0 0 548 Jasons-Hard-Disk.
+ lpr.tcp 0 IN SRV 0 0 515 Print-Spooler.
+ http.tcp 0 IN SRV 0 0 80 www.jasonco.com.
+ https.tcp 0 IN SRV 0 0 443 secure.jasonco.com.
+
+ $ORIGIN jasonco.com.
+ www 0 IN A 169.254.101.218
+ 0 IN TXT "UTF8-encoded service-name"
+ secure 0 IN A 169.254.101.218
+ 0 IN TXT "UTF8-encoded service-name"
+
+ $ORIGIN Jasons-Mac.
+ dns.udp 0 IN SRV 0 0 53 Jasons-Mac.
+ owner-name 0 IN TXT "Jason A. Luser"
+ * 0 IN PTR afp.tcp.Jasons-Mac.
+ 0 IN PTR lpr.tcp.Jasons-Mac.
+ 0 IN PTR http.tcp.Jasons-Mac.
+ afp.tcp 0 IN SRV 0 0 548 Jasons-Hard-Disk.
+ lpr.tcp 0 IN SRV 0 0 515 Print-Spooler.
+ http.tcp 0 IN SRV 0 0 80 www.jasonco.com.
+
+ $ORIGIN 101.254.169.in-addr.arpa.
+ 218 0 IN PTR Jasons-Mac.
+
+ Windows and Unix hosts are possessed of many of the same, or
+ analogous, types of local information, and similar examples could be
+ constructed around hypothetical hosts of those types. A much
+ simpler example featuring a laser printer follows, in section 6 of
+ this document.
+
+ Note that in translating service and device names from high-bit-depth
+ character sets such as Unicode to DNS-compliant hostnames, a
+ character-mapping must occur, whereby spaces are mapped to hyphens,
+ punctuation other than periods is removed, and plain characters are
+ substituted for their accented equivalents. Implementors MUST perform
+ a uniqueness check, in order to guarantee that no other device within
+ the local multicast scope has already asserted a claim to the DNS
+ name which their device wishes to employ. Uniqueness checks at
+ service-registration time must be somewhat more strict than their
+ historical AppleTalk equivalents, comparing names which have already
+ been converted to their DNS-compliant state (containing only a-z,
+ A-Z, 0-9, and the hyphen character, and starting with a letter rather
+ than a hyphen or number), and must treat upper and lower-case as
+ equivalent. Note that periods in device and service names shall be
+ preserved and used to establish subdomains within the stub DNS
+ server's dataset. The high-bit-depth names are made available to
+ queriants in the form of UTF8-encoded RDATA in TXT RRs included as
+ Additional Information (as described in RFC 1035, sections 4.1
+ through 4.1.3) appended to any A RR response.
+
+ Implementors of multicast-enabled resolvers may expect the following
+ results of the following query-types:
+
+ Data Type Result
+
+ *.in-addr.arpa PTR All hostnames in the local scope
+ *.host.domain.com SRV All services on host.domain.com
+ lpr.tcp. SRV All printers/spoolers in the local scope
+
+ Duplicate identical records received in different responses to a
+ query may be treated as a single record in the concatenation of
+ responses. It is beyond the scope of this document to suggest
+ disposition of different responses which contain disagreeing pairs of
+ name NAME and RDATA.
+
+ Implementors should note that "virtual hosts" (that is, the support
+ of multiple IP addresses on a single host, and the binding of
+ different services to different addresses) are easily supported in
+ responses to multicast queries, but should also note that one of the
+ benefits afforded by the use of SRV RR-types is a reduction in the
+ need for virtual hosts, since multiple named services may be bound to
+ different (non-well-known) ports of the same IP address, and still be
+ individually identified and differentiated. For example, a single
+ host might support one HTTP server on port 80, a second on port 8001,
+ and an HTTPS server on port 443, and each could be reached via
+ different name.
+
+ Another major use of this extension to DNS is to allow bootstrapping
+ machines to find local DNS servers. It is anticipated that larger
+ enterprises may in the future possess one or more fully-featured DNS
+ servers which are also multicast-enabled. Once a bootstrapping host
+ has located such a server, that host need no longer use multicast at
+ all. That host may instead employ ordinary unicast DNS exactly as
+ any other host would, to query those DNS servers. The servers, in
+ turn, might well employ multicast queries to glean information about
+ the services contained within their local scope, which information
+ they might then use to respond to unicast queries (proxying, in
+ effect), and cache against future need. Note also that the ability
+ to answer multicast queries would prove particularly useful to a DNS
+ server which was resident on the same host as a NAT at the border of
+ an enterprise which employed 10.0.0.0/8 or 169.254.0.0/16 unicast
+ addresses internally.
+
+ Implementors MAY choose to employ an optimization whereby the
+ deleterious impact of large numbers of unconfigured hosts
+ simultaneously attempting to locate DNS servers during the bootstrap
+ process might be mitigated, and the process be made more efficient.
+ Specifically, high- and low-water marks are defined for frequency of
+ multicasted lookups for SRV RRs of "dns.udp.". When a
+ multicast-enabled DNS server observes the frequency of such lookups
+ exceeding a high-water mark (five queries per minute, perhaps), the
+ server MAY begin interspersing responses transmitted via multicast,
+ rather than unicast, until such time as the frequency of such lookups
+ falls below a low-water mark (one query per five minutes, perhaps).
+ In order for this to work, multicast-enabled resolvers would also
+ need to listen on the multicast address for responses, and cache them
+ briefly. Both the server and resolver portions of this optimized
+ behavior are optional, and it should be stressed that this
+ optimization need not be considered by implementors of stub servers
+ in devices such as printers, which do not provide generalized DNS
+ services. If DNS server implementors choose to employ multicast
+ responses, they MUST interleave multicast responses with unicast
+ responses in such a way that the multicast responses decrease over
+ time, rather than flooding the network, in order that servers not be
+ used to propagate denial-of-service attacks. In other words, a
+ reasonable approach might be while above the high-water mark to make
+ the first, second, fourth, eighth, sixteenth et cetera responses for
+ each RR multicast, while all inbetween would be unicast. Note that
+ this not only protects against multicast "storms," it also protects
+ against the mis-match condition which occurs in the case that a
+ non-optimized resolver is the presence only of optimized servers, all
+ of which are temporarily in multicast-response mode.
+
+ Implementors SHOULD also employ DNS Sec, or its equivalent, as soon
+ as such technology is standardized, in order to minimize the
+ possiblity of "spoofing" of information by nodes responding to
+ multicast queries.
+
+
+6. Use & Administration Notes Appendix
+
+ Administrators of networks employing this protocol are advised to
+ employ fully-qualified domain names (FQDNs) as their host names where
+ possible, such that the dots separating portions of the name shall be
+ interpreted by the stub-server implementations as subdomain
+ delimiters, and shall thus serve to remove the host from the local
+ view of the root domain to its correct and appropriate
+ globally-unique subdomain.
+
+ Administrators of service-providing devices, such as already-deployed
+ printers, which are not capable of receiving multicast DNS queries,
+ may wish to inject DNS records into a local multicast-enabled DNS
+ server on behalf of those devices. For example, an administrator
+ might wish to create records of the following nature in order to make
+ a non-multicast-capable laser printer visible to both multicast and
+ unicast queriants:
+
+ $ORIGIN .
+ lpr.tcp 0 IN SRV 0 0 515 laser2.sales.domain.com.
+
+ $ORIGIN sales.domain.com.
+ laser2 0 IN A 169.254.5.28
+ 0 IN TXT "Old Sales Dep't Laser Printer"
+
+ $ORIGIN laser2.sales.domain.com.
+ * 0 IN PTR lpr.tcp.laser2.sales.domain.com.
+ lpr.tcp 0 IN SRV 0 0 515 laser2.sales.domain.com.
+
+ $ORIGIN 5.254.169.in-addr.arpa.
+ 28 0 IN PTR laser2.sales.domain.com.
+
+ Administrators of networks which contain either multicast-capable
+ resolvers or multicast-capable DNS servers MUST employ filters
+ defining a contiguous border around their enterprises and prohibiting
+ passage of data to and from the 239.0.0.0/8 address space, as well as
+ routing information relating to the 239.0.0.0/8 prefix or any subnet
+ of it. This is the mechanism by which RFC 2365 administrative
+ scoping is enacted. The sole exception to this rule would be any
+ explicitly-configured interconnections with other specific
+ enterprises between which all involved administrators wish to share a
+ single browsable network space. This is anticipated to be a very
+ infrequent occurrence within the current regime of network security
+ policies.
+
+References
+
+ RFC 1035: Mockapetris, P., "Domain Names - Implementation and
+ Specification", RFC 1035, November, 1987.
+
+ RFC 2052: Gulbrandsen, A., Vixie, P., "A DNS RR for specifying the
+ location of services (DNS SRV)", RFC 2052, October, 1996.
+
+ RFC 2365: Meyer, D., "Administratively Scoped IP Multicast",
+ RFC 2365, July, 1998.
+
+ Handley, M., Thaler, D., "Multicast-Scope Zone Announcement
+ Protocol (MZAP)", MBoneD Internet Draft, October, 1998.
+
+ Sidhu, G.S., Andrews, R.F., and Oppenheimer, A., "Inside AppleTalk,
+ Second Edition", Addison-Wesley, 1990.
+
+Security Considerations
+
+ While this extension to DNS introduces no new security problems to
+ DNS or Multicast, it should be emphasized that distributed
+ directories, common to other networking protocols, have not hitherto
+ been widely used in the IP networking community. Distributed
+ directories do require that users and system administrators assume
+ some conscious balance between the level of trust which they accord
+ to the responding entities on their network, and the degree of
+ credence which they pay to the responses they receive. The level of
+ trust traditionally assumed in distributed directory environments
+ does not necessarily mix well with clear-text password transmission
+ such as is still found on some IP networks, for example.
+
+
+Authors' Addresses
+
+ Bill Woodcock
+ Zocalo
+ 2355 Virginia Street
+ Berkeley, CA 94709-1315
+ USA
+
+ Phone: +1 510 540 8000
+ EMail: woody@zocalo.net
+
+
+ Bill Manning
+ USC/ISI
+ 4676 Admiralty Way, #1001
+ Marina del Rey, CA. 90292
+ USA
+
+ Phone: +1 310 822 1511
+ EMail: bmanning@isi.edu
+
+Full Copyright Statement
+
+ Copyright (C) The Internet Society (1998). All Rights Reserved.
+
+ This document and translations of it may be copied and furnished
+ to others, and derivative works that comment on or otherwise
+ explain it or assist in its implementation may be prepared, copied,
+ published and distributed, in whole or in part, without
+ restriction of any kind, provided that the above copyright notice
+ and this paragraph are included on all such copies and derivative
+ works. However, this document itself may not be modified in any
+ way, such as by removing the copyright notice or references to the
+ Internet Society or other Internet organizations, except as needed
+ for the purpose of developing Internet standards in which case the
+ procedures for copyrights defined in the Internet Standards
+ process must be followed, or as required to translate it into
+ languages other than English.
+
+ The limited permissions granted above are perpetual and will not
+ be revoked by the Internet Society or its successors or assigns.
+
+ This document and the information contained herein is provided on
+ an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET
+
+......
+
+--------------1F985EC911030AB70E0CD7B9--
+
+
+
+--
+--bill
diff --git a/doc/draft/draft-skwan-gss-tsig-06.txt b/doc/draft/draft-skwan-gss-tsig-06.txt
deleted file mode 100644
index c760fda5..00000000
--- a/doc/draft/draft-skwan-gss-tsig-06.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-
-This document has been replaced by draft-ietf-dnsext-gss-tsig-00.txt.
-For more information or a copy of the document, contact the author directly.
-
-Draft Author(s):
-
-S. Kwan: skwan@microsoft.com
-J. Gilroy: jamesg@microsoft.com
-P. Garg: praeritg@microsoft.com
-
-
diff --git a/doc/man/bin/named-checkconf.1 b/doc/man/bin/named-checkconf.1
new file mode 100644
index 00000000..93cc8b3d
--- /dev/null
+++ b/doc/man/bin/named-checkconf.1
@@ -0,0 +1,48 @@
+.\" Copyright (C) 2000 Internet Software Consortium.
+.\"
+.\" 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 INTERNET SOFTWARE CONSORTIUM
+.\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+.\" INTERNET SOFTWARE CONSORTIUM 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.
+
+.\" $Id: named-checkconf.1,v 1.2 2000/12/19 19:48:09 gson Exp $
+
+.Dd Jun 14, 2000
+.Dt NAMED-CHECKCONF 1
+.Os BIND9 9
+.ds vT BIND9 Programmer's Manual
+.Sh NAME
+.Nm named-checkconf
+.Nd Configuration file syntax checking tool.
+.Sh SYNOPSIS
+.Nm named-checkconf
+.Op filename
+.Sh DESCRIPTION
+.Pp
+.Nm named-checkconf
+is a tool to check the syntax, but not sematics, of the configuration file
+for named.
+.Pp
+The options to
+.Nm named-checkconf
+are as follows:
+.Bl -tag -width Ds
+.It Ar filename
+the name of the configuration file to be checked.
+If not specified it defaults /etc/named.conf.
+.Sh RETURN VALUES
+.Pp
+.Nm named-checkconf
+return a an exit status of 1 if errors were detected,
+0 otherwise.
+.Sh SEE ALSO
+.Xr named 8 ,
+.Xr RFC1035 .
diff --git a/doc/man/bin/named-checkzone.1 b/doc/man/bin/named-checkzone.1
new file mode 100644
index 00000000..8eaa5a89
--- /dev/null
+++ b/doc/man/bin/named-checkzone.1
@@ -0,0 +1,61 @@
+.\" Copyright (C) 2000 Internet Software Consortium.
+.\"
+.\" 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 INTERNET SOFTWARE CONSORTIUM
+.\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+.\" INTERNET SOFTWARE CONSORTIUM 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.
+
+.\" $Id: named-checkzone.1,v 1.2 2000/12/19 19:48:10 gson Exp $
+
+.Dd Jun 13, 2000
+.Dt NAMED-CHECKZONE 1
+.Os BIND9 9
+.ds vT BIND9 Programmer's Manual
+.Sh NAME
+.Nm named-checkzone
+.Nd Zone validity checking tool.
+.Sh SYNOPSIS
+.Nm named-checkzone
+.Op Fl dq
+.Op Fl c Ar class
+.Ar zone
+.Op filename
+.Sh DESCRIPTION
+.Pp
+.Nm named-checkzone
+is a tool for performing integrity checks on a zones contents.
+It uses the same integrity checks as
+.Nm named .
+.Pp
+The options to
+.Nm named-checkzone
+are as follows:
+.Bl -tag -width Ds
+.It Fl d
+enable debugging.
+.It Fl q
+quiet mode - exit code only.
+.It Fl c Ar class
+specify the class of the zone.
+If not specified "IN" is assumed.
+.It Ar zone
+the name of the zone being loaded.
+.It Op filename
+the name of the file containing the zone.
+If not specified it defaults to the zone name.
+.Sh RETURN VALUES
+.Pp
+.Nm named-checkzone
+return a an exit status of 1 if errors were detected,
+0 otherwise.
+.Sh SEE ALSO
+.Xr named 8 ,
+.Xr RFC1035 .
diff --git a/doc/man/bin/rndc.conf.5 b/doc/man/bin/rndc.conf.5
index 9db04908..0248f841 100644
--- a/doc/man/bin/rndc.conf.5
+++ b/doc/man/bin/rndc.conf.5
@@ -13,7 +13,7 @@
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-.\" $Id: rndc.conf.5,v 1.8 2000/11/30 00:20:40 gson Exp $
+.\" $Id: rndc.conf.5,v 1.9 2000/12/15 00:24:10 gson Exp $
.Dd Jun 30, 2000
.Dt RDNC.CONF 5
@@ -182,6 +182,20 @@ To generate a secret from known input with
.Bd -literal indent
$ echo "known plaintext for a secret" | mmencode
.Ed
+.Sh NAME SERVER CONFIGURATION
+The name server must be configured to accept
+.Xr rndc
+connections and to recognize the key specified in
+the
+.Nm rndc.conf
+file, using the
+.Dv controls
+statement in
+.Nm named.conf .
+See the sections on the
+.Dv controls
+statement in the BIND 9 Administrator Reference Manual for
+details.
.Sh LIMITATIONS
There is currently no way to specify the port for
.Xr rndc
@@ -196,7 +210,6 @@ clause to the
statement.
.Sh SEE ALSO
.Xr rndc 8 ,
-.Xr named.conf 8 ,
.Xr dnssec-keygen 8 ,
.Xr mmencode 1 ,
-"BIND9 Administrators Manual".
+"BIND 9 Administrator Reference Manual".
diff --git a/doc/man/dnssec/dnssec-signzone.8 b/doc/man/dnssec/dnssec-signzone.8
index aae32ea1..5b8ee85b 100644
--- a/doc/man/dnssec/dnssec-signzone.8
+++ b/doc/man/dnssec/dnssec-signzone.8
@@ -13,7 +13,7 @@
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-.\" $Id: dnssec-signzone.8,v 1.15 2000/11/18 02:57:38 bwelling Exp $
+.\" $Id: dnssec-signzone.8,v 1.16 2000/12/07 02:20:07 bwelling Exp $
.Dd Jun 30, 2000
.Dt DNSSEC-SIGNZONE 8
@@ -36,6 +36,7 @@
.Op Fl r Ar randomdev
.Op Fl t
.Op Fl v Ar level
+.Op Fl n Ar nthreads
.Ar zonefile
.Op keyfile ....
.Sh DESCRIPTION
@@ -227,6 +228,15 @@ increases,
.Nm dnssec-signzone
generates increasingly detailed reports about what it is doing.
The default level is zero.
+.Pp
+The
+.Fl n
+option can be used to change the threading behavior. By default,
+.Nm dnssec-signzone
+attempts to determine the number of CPUs present, and create one thread
+per CPU. The
+.Fl n
+option causes a different number of threads to be created.
.Sh EXAMPLE
The example below shows how
.Nm dnssec-signzone
diff --git a/doc/misc/migration b/doc/misc/migration
index 9d97ba1f..975146ff 100644
--- a/doc/misc/migration
+++ b/doc/misc/migration
@@ -60,6 +60,10 @@ The source address and port for these is now controlled by
"notify-source" and "transfer-source", respectively, rather that
query-source as in BIND 8.
+1.6. Multiple Classes.
+
+Multiple classes have to be put into explicit views for each class.
+
2. Zone File Compatibility
2.1. Strict RFC1035 Interpretation of TTLs in Zone Files
@@ -158,4 +162,4 @@ see the man pages in doc/man/bin/rndc.1 and doc/man/bin/rndc.conf.5 for
details. Some of the ndc commands are still unimplemented in rndc.
-$Id: migration,v 1.16 2000/11/30 23:24:01 gson Exp $
+$Id: migration,v 1.17 2000/12/19 00:36:05 marka Exp $
diff --git a/doc/misc/options b/doc/misc/options
index 23e5aadc..fbdaefa8 100644
--- a/doc/misc/options
+++ b/doc/misc/options
@@ -1,7 +1,7 @@
Copyright (C) 2000 Internet Software Consortium.
See COPYRIGHT in the source root or http://isc.org/copyright.html for terms.
-$Id: options,v 1.52 2000/12/02 00:25:40 gson Exp $
+$Id: options,v 1.54 2000/12/15 21:17:25 gson Exp $
This is a summary of the implementation status of the various named.conf
options in BIND 9.
@@ -38,7 +38,7 @@ options {
[ version version_string; ] Yes
[ directory path_name; ] Yes
[ named-xfer path_name; ] Obsolete
- [ dump-file path_name; ] No
+ [ dump-file path_name; ] Yes
[ memstatistics-file path_name; ] No
[ pid-file path_name; ] Yes
[ statistics-file path_name; ] Yes
@@ -61,6 +61,7 @@ options {
[ forward ( only | first ); ] Yes
[ forwarders { [ in_addr ; [ in_addr ; ... ] ] }; ] Yes
[ check-names ... ] Obsolete
+ [ allow-notify { address_match_list }; ] Yes*
[ allow-query { address_match_list }; ] Yes@
[ allow-transfer { address_match_list }; ] Yes@
[ allow-recursion { address_match_list }; ] Yes@
@@ -172,6 +173,7 @@ zone "domain_name" [ ( in | hs | hesiod | chaos ) ] {
[ forward ( only | first ); ] Yes
[ forwarders { [ ip_addr ; [ ip_addr ; ... ] ] }; ] Yes
[ check-names ( warn | fail | ignore ); ] Obsolete
+ [ allow-notify { address_match_list };] Yes*
[ allow-update { address_match_list }; ] Obsolete
[ allow-update-forwarding { address_match_list }; ] No*
[ allow-query { address_match_list }; ] Yes@
@@ -242,6 +244,7 @@ view "view_name" [ ( in | hs | hesiod | chaos ) ] { Yes*
[ forward ( only | first ); ] Yes
[ forwarders { [ in_addr ; [ in_addr ; ... ] ] }; ] Yes
[ check-names ... ] Obsolete
+ [ allow-notify { address_match_list }; ] Yes
[ allow-query { address_match_list }; ] Yes
[ allow-transfer { address_match_list }; ] Yes
[ allow-recursion { address_match_list }; ] Yes
diff --git a/doc/rfc/index b/doc/rfc/index
index 7b321e8b..d43bb11d 100644
--- a/doc/rfc/index
+++ b/doc/rfc/index
@@ -34,6 +34,7 @@
2181: Clarifications to the DNS Specification
2230: Key Exchange Delegation Record for the DNS
2308: Negative Caching of DNS Queries (DNS NCACHE)
+2317: Classless IN-ADDR.ARPA delegation
2373: IP Version 6 Addressing Architecture
2374: An IPv6 Aggregatable Global Unicast Address Format
2375: IPv6 Multicast Address Assignments
@@ -50,8 +51,12 @@
2672: Non-Terminal DNS Name Redirection
2673: Binary Labels in the Domain Name System
2782: A DNS RR for specifying the location of services (DNS SRV)
+2825: A Tangled Web: Issues of I18N, Domain Names, and the
+ Other Internet protocols
+2826: IAB Technical Comment on the Unique DNS Root
2845: Secret Key Transaction Authentication for DNS (TSIG)
2874: DNS Extensions to Support IPv6 Address Aggregation and Renumbering
+2915: The Naming Authority Pointer (NAPTR) DNS Resource Record
2929: Domain Name System (DNS) IANA Considerations
2930: Secret Key Establishment for DNS (TKEY RR)
2931: DNS Request and Transaction Signatures ( SIG(0)s )
diff --git a/doc/rfc/rfc2317.txt b/doc/rfc/rfc2317.txt
new file mode 100644
index 00000000..c17bb41f
--- /dev/null
+++ b/doc/rfc/rfc2317.txt
@@ -0,0 +1,563 @@
+
+
+
+
+
+
+Network Working Group H. Eidnes
+Request for Comments: 2317 SINTEF RUNIT
+BCP: 20 G. de Groot
+Category: Best Current Practice Berkeley Software Design, Inc.
+ P. Vixie
+ Internet Software Consortium
+ March 1998
+
+
+ Classless IN-ADDR.ARPA delegation
+
+Status of this Memo
+
+ This document specifies an Internet Best Current Practices for the
+ Internet Community, and requests discussion and suggestions for
+ improvements. Distribution of this memo is unlimited.
+
+Copyright Notice
+
+ Copyright (C) The Internet Society (1998). All Rights Reserved.
+
+2. Introduction
+
+ This document describes a way to do IN-ADDR.ARPA delegation on non-
+ octet boundaries for address spaces covering fewer than 256
+ addresses. The proposed method should thus remove one of the
+ objections to subnet on non-octet boundaries but perhaps more
+ significantly, make it possible to assign IP address space in smaller
+ chunks than 24-bit prefixes, without losing the ability to delegate
+ authority for the corresponding IN-ADDR.ARPA mappings. The proposed
+ method is fully compatible with the original DNS lookup mechanisms
+ specified in [1], i.e. there is no need to modify the lookup
+ algorithm used, and there should be no need to modify any software
+ which does DNS lookups.
+
+ The document also discusses some operational considerations to
+ provide some guidance in implementing this method.
+
+3. Motivation
+
+ With the proliferation of classless routing technology, it has become
+ feasible to assign address space on non-octet boundaries. In case of
+ a very small organization with only a few hosts, assigning a full
+ 24-bit prefix (what was traditionally referred to as a "class C
+ network number") often leads to inefficient address space
+ utilization.
+
+
+
+
+
+Eidnes, et. al. Best Current Practice [Page 1]
+
+RFC 2317 Classless IN-ADDR.ARPA delegation March 1998
+
+
+ One of the problems encountered when assigning a longer prefix (less
+ address space) is that it seems impossible for such an organization
+ to maintain its own reverse ("IN-ADDR.ARPA") zone autonomously. By
+ use of the reverse delegation method described below, the most
+ important objection to assignment of longer prefixes to unrelated
+ organizations can be removed.
+
+ Let us assume we have assigned the address spaces to three different
+ parties as follows:
+
+ 192.0.2.0/25 to organization A
+ 192.0.2.128/26 to organization B
+ 192.0.2.192/26 to organization C
+
+ In the classical approach, this would lead to a single zone like
+ this:
+
+ $ORIGIN 2.0.192.in-addr.arpa.
+ ;
+ 1 PTR host1.A.domain.
+ 2 PTR host2.A.domain.
+ 3 PTR host3.A.domain.
+ ;
+ 129 PTR host1.B.domain.
+ 130 PTR host2.B.domain.
+ 131 PTR host3.B.domain.
+ ;
+ 193 PTR host1.C.domain.
+ 194 PTR host2.C.domain.
+ 195 PTR host3.C.domain.
+
+ The administration of this zone is problematic. Authority for this
+ zone can only be delegated once, and this usually translates into
+ "this zone can only be administered by one organization." The other
+ organizations with address space that corresponds to entries in this
+ zone would thus have to depend on another organization for their
+ address to name translation. With the proposed method, this
+ potential problem can be avoided.
+
+4. Classless IN-ADDR.ARPA delegation
+
+ Since a single zone can only be delegated once, we need more points
+ to do delegation on to solve the problem above. These extra points
+ of delegation can be introduced by extending the IN-ADDR.ARPA tree
+ downwards, e.g. by using the first address or the first address and
+ the network mask length (as shown below) in the corresponding address
+
+
+
+
+
+Eidnes, et. al. Best Current Practice [Page 2]
+
+RFC 2317 Classless IN-ADDR.ARPA delegation March 1998
+
+
+ space to form the the first component in the name for the zones. The
+ following four zone files show how the problem in the motivation
+ section could be solved using this method.
+
+ $ORIGIN 2.0.192.in-addr.arpa.
+ @ IN SOA my-ns.my.domain. hostmaster.my.domain. (...)
+ ;...
+ ; <<0-127>> /25
+ 0/25 NS ns.A.domain.
+ 0/25 NS some.other.name.server.
+ ;
+ 1 CNAME 1.0/25.2.0.192.in-addr.arpa.
+ 2 CNAME 2.0/25.2.0.192.in-addr.arpa.
+ 3 CNAME 3.0/25.2.0.192.in-addr.arpa.
+ ;
+ ; <<128-191>> /26
+ 128/26 NS ns.B.domain.
+ 128/26 NS some.other.name.server.too.
+ ;
+ 129 CNAME 129.128/26.2.0.192.in-addr.arpa.
+ 130 CNAME 130.128/26.2.0.192.in-addr.arpa.
+ 131 CNAME 131.128/26.2.0.192.in-addr.arpa.
+ ;
+ ; <<192-255>> /26
+ 192/26 NS ns.C.domain.
+ 192/26 NS some.other.third.name.server.
+ ;
+ 193 CNAME 193.192/26.2.0.192.in-addr.arpa.
+ 194 CNAME 194.192/26.2.0.192.in-addr.arpa.
+ 195 CNAME 195.192/26.2.0.192.in-addr.arpa.
+
+ $ORIGIN 0/25.2.0.192.in-addr.arpa.
+ @ IN SOA ns.A.domain. hostmaster.A.domain. (...)
+ @ NS ns.A.domain.
+ @ NS some.other.name.server.
+ ;
+ 1 PTR host1.A.domain.
+ 2 PTR host2.A.domain.
+ 3 PTR host3.A.domain.
+
+
+
+
+
+
+
+
+
+
+
+
+Eidnes, et. al. Best Current Practice [Page 3]
+
+RFC 2317 Classless IN-ADDR.ARPA delegation March 1998
+
+
+ $ORIGIN 128/26.2.0.192.in-addr.arpa.
+ @ IN SOA ns.B.domain. hostmaster.B.domain. (...)
+ @ NS ns.B.domain.
+ @ NS some.other.name.server.too.
+ ;
+ 129 PTR host1.B.domain.
+ 130 PTR host2.B.domain.
+ 131 PTR host3.B.domain.
+
+
+ $ORIGIN 192/26.2.0.192.in-addr.arpa.
+ @ IN SOA ns.C.domain. hostmaster.C.domain. (...)
+ @ NS ns.C.domain.
+ @ NS some.other.third.name.server.
+ ;
+ 193 PTR host1.C.domain.
+ 194 PTR host2.C.domain.
+ 195 PTR host3.C.domain.
+
+ For each size-256 chunk split up using this method, there is a need
+ to install close to 256 CNAME records in the parent zone. Some
+ people might view this as ugly; we will not argue that particular
+ point. It is however quite easy to automatically generate the CNAME
+ resource records in the parent zone once and for all, if the way the
+ address space is partitioned is known.
+
+ The advantage of this approach over the other proposed approaches for
+ dealing with this problem is that there should be no need to modify
+ any already-deployed software. In particular, the lookup mechanism
+ in the DNS does not have to be modified to accommodate this splitting
+ of the responsibility for the IPv4 address to name translation on
+ "non-dot" boundaries. Furthermore, this technique has been in use
+ for several years in many installations, apparently with no ill
+ effects.
+
+ As usual, a resource record like
+
+ $ORIGIN 2.0.192.in-addr.arpa.
+ 129 CNAME 129.128/26.2.0.192.in-addr.arpa.
+
+ can be convienently abbreviated to
+
+ $ORIGIN 2.0.192.in-addr.arpa.
+ 129 CNAME 129.128/26
+
+
+
+
+
+
+
+Eidnes, et. al. Best Current Practice [Page 4]
+
+RFC 2317 Classless IN-ADDR.ARPA delegation March 1998
+
+
+ Some DNS implementations are not kind to special characters in domain
+ names, e.g. the "/" used in the above examples. As [3] makes clear,
+ these are legal, though some might feel unsightly. Because these are
+ not host names the restriction of [2] does not apply. Modern clients
+ and servers have an option to act in the liberal and correct fashion.
+
+ The examples here use "/" because it was felt to be more visible and
+ pedantic reviewers felt that the 'these are not hostnames' argument
+ needed to be repeated. We advise you not to be so pedantic, and to
+ not precisely copy the above examples, e.g. substitute a more
+ conservative character, such as hyphen, for "/".
+
+5. Operational considerations
+
+ This technique is intended to be used for delegating address spaces
+ covering fewer than 256 addresses. For delegations covering larger
+ blocks of addresses the traditional methods (multiple delegations)
+ can be used instead.
+
+5.1 Recommended secondary name service
+
+ Some older versions of name server software will make no effort to
+ find and return the pointed-to name in CNAME records if the pointed-
+ to name is not already known locally as cached or as authoritative
+ data. This can cause some confusion in resolvers, as only the CNAME
+ record will be returned in the response. To avoid this problem it is
+ recommended that the authoritative name servers for the delegating
+ zone (the zone containing all the CNAME records) all run as slave
+ (secondary) name servers for the "child" zones delegated and pointed
+ into via the CNAME records.
+
+5.2 Alternative naming conventions
+
+ As a result of this method, the location of the zone containing the
+ actual PTR records is no longer predefined. This gives flexibility
+ and some examples will be presented here.
+
+ An alternative to using the first address, or the first address and
+ the network mask length in the corresponding address space, to name
+ the new zones is to use some other (non-numeric) name. Thus it is
+ also possible to point to an entirely different part of the DNS tree
+ (i.e. outside of the IN-ADDR.ARPA tree). It would be necessary to
+ use one of these alternate methods if two organizations somehow
+ shared the same physical subnet (and corresponding IP address space)
+ with no "neat" alignment of the addresses, but still wanted to
+ administrate their own IN-ADDR.ARPA mappings.
+
+
+
+
+
+Eidnes, et. al. Best Current Practice [Page 5]
+
+RFC 2317 Classless IN-ADDR.ARPA delegation March 1998
+
+
+ The following short example shows how you can point out of the IN-
+ ADDR.ARPA tree:
+
+ $ORIGIN 2.0.192.in-addr.arpa.
+ @ IN SOA my-ns.my.domain. hostmaster.my.domain. (...)
+ ; ...
+ 1 CNAME 1.A.domain.
+ 2 CNAME 2.A.domain.
+ ; ...
+ 129 CNAME 129.B.domain.
+ 130 CNAME 130.B.domain.
+ ;
+
+
+ $ORIGIN A.domain.
+ @ IN SOA my-ns.A.domain. hostmaster.A.domain. (...)
+ ; ...
+ ;
+ host1 A 192.0.2.1
+ 1 PTR host1
+ ;
+ host2 A 192.0.2.2
+ 2 PTR host2
+ ;
+
+ etc.
+
+ This way you can actually end up with the name->address and the
+ (pointed-to) address->name mapping data in the same zone file - some
+ may view this as an added bonus as no separate set of secondaries for
+ the reverse zone is required. Do however note that the traversal via
+ the IN-ADDR.ARPA tree will still be done, so the CNAME records
+ inserted there need to point in the right direction for this to work.
+
+ Sketched below is an alternative approach using the same solution:
+
+ $ORIGIN 2.0.192.in-addr.arpa.
+ @ SOA my-ns.my.domain. hostmaster.my.domain. (...)
+ ; ...
+ 1 CNAME 1.2.0.192.in-addr.A.domain.
+ 2 CNAME 2.2.0.192.in-addr.A.domain.
+
+ $ORIGIN A.domain.
+ @ SOA my-ns.A.domain. hostmaster.A.domain. (...)
+ ; ...
+ ;
+ host1 A 192.0.2.1
+ 1.2.0.192.in-addr PTR host1
+
+
+
+Eidnes, et. al. Best Current Practice [Page 6]
+
+RFC 2317 Classless IN-ADDR.ARPA delegation March 1998
+
+
+ host2 A 192.0.2.2
+ 2.2.0.192.in-addr PTR host2
+
+ It is clear that many possibilities exist which can be adapted to the
+ specific requirements of the situation at hand.
+
+5.3 Other operational issues
+
+ Note that one cannot provide CNAME referrals twice for the same
+ address space, i.e. you cannot allocate a /25 prefix to one
+ organisation, and run IN-ADDR.ARPA this way, and then have the
+ organisation subnet the /25 into longer prefixes, and attempt to
+ employ the same technique to give each subnet control of its own
+ number space. This would result in a CNAME record pointing to a CNAME
+ record, which may be less robust overall.
+
+ Unfortunately, some old beta releases of the popular DNS name server
+ implementation BIND 4.9.3 had a bug which caused problems if a CNAME
+ record was encountered when a reverse lookup was made. The beta
+ releases involved have since been obsoleted, and this issue is
+ resolved in the released code. Some software manufacturers have
+ included the defective beta code in their product. In the few cases
+ we know of, patches from the manufacturers are available or planned
+ to replace the obsolete beta code involved.
+
+6. Security Considerations
+
+ With this scheme, the "leaf sites" will need to rely on one more site
+ running their DNS name service correctly than they would be if they
+ had a /24 allocation of their own, and this may add an extra
+ component which will need to work for reliable name resolution.
+
+ Other than that, the authors are not aware of any additional security
+ issues introduced by this mechanism.
+
+7. Conclusion
+
+ The suggested scheme gives more flexibility in delegating authority
+ in the IN-ADDR.ARPA domain, thus making it possible to assign address
+ space more efficiently without losing the ability to delegate the DNS
+ authority over the corresponding address to name mappings.
+
+8. Acknowledgments
+
+ Glen A. Herrmannsfeldt described this trick on comp.protocols.tcp-
+ ip.domains some time ago. Alan Barrett and Sam Wilson provided
+ valuable comments on the newsgroup.
+
+
+
+
+Eidnes, et. al. Best Current Practice [Page 7]
+
+RFC 2317 Classless IN-ADDR.ARPA delegation March 1998
+
+
+ We would like to thank Rob Austein, Randy Bush, Matt Crawford, Robert
+ Elz, Glen A. Herrmannsfeldt, Daniel Karrenberg, David Kessens, Tony
+ Li, Paul Mockapetris, Eric Wassenaar, Michael Patton, Hans Maurer,
+ and Peter Koch for their review and constructive comments.
+
+9. References
+
+ [1] Mockapetris, P., "Domain Names - Concepts and Facilities",
+ STD 13, RFC 1034, November 1987.
+
+ [2] Harrenstien, K., Stahl, M., and E. Feinler, "DoD Internet Host
+ Table Specification", RFC 952, October 1985.
+
+ [3] Elz, R., and R. Bush, "Clarifications to the DNS
+ Specification", RFC 2181, July 1997.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Eidnes, et. al. Best Current Practice [Page 8]
+
+RFC 2317 Classless IN-ADDR.ARPA delegation March 1998
+
+
+10. Authors' Addresses
+
+ Havard Eidnes
+ SINTEF RUNIT
+ N-7034 Trondheim
+ Norway
+
+ Phone: +47 73 59 44 68
+ Fax: +47 73 59 17 00
+ EMail: Havard.Eidnes@runit.sintef.no
+
+
+ Geert Jan de Groot
+ Berkeley Software Design, Inc. (BSDI)
+ Hendrik Staetslaan 69
+ 5622 HM Eindhoven
+ The Netherlands
+
+ Phone: +31 40 2960509
+ Fax: +31 40 2960309
+ EMail: GeertJan.deGroot@bsdi.com
+
+
+ Paul Vixie
+ Internet Software Consortium
+ Star Route Box 159A
+ Woodside, CA 94062
+ USA
+
+ Phone: +1 415 747 0204
+ EMail: paul@vix.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Eidnes, et. al. Best Current Practice [Page 9]
+
+RFC 2317 Classless IN-ADDR.ARPA delegation March 1998
+
+
+11. Full Copyright Statement
+
+ Copyright (C) The Internet Society (1998). All Rights Reserved.
+
+ This document and translations of it may be copied and furnished to
+ others, and derivative works that comment on or otherwise explain it
+ or assist in its implementation may be prepared, copied, published
+ and distributed, in whole or in part, without restriction of any
+ kind, provided that the above copyright notice and this paragraph are
+ included on all such copies and derivative works. However, this
+ document itself may not be modified in any way, such as by removing
+ the copyright notice or references to the Internet Society or other
+ Internet organizations, except as needed for the purpose of
+ developing Internet standards in which case the procedures for
+ copyrights defined in the Internet Standards process must be
+ followed, or as required to translate it into languages other than
+ English.
+
+ The limited permissions granted above are perpetual and will not be
+ revoked by the Internet Society or its successors or assigns.
+
+ This document and the information contained herein is provided on an
+ "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+ TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
+ BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
+ HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Eidnes, et. al. Best Current Practice [Page 10]
+
diff --git a/doc/rfc/rfc2825.txt b/doc/rfc/rfc2825.txt
new file mode 100644
index 00000000..fd8ef7c8
--- /dev/null
+++ b/doc/rfc/rfc2825.txt
@@ -0,0 +1,395 @@
+
+
+
+
+
+
+Network Working Group Internet Architecture Board (IAB)
+Request for Comments: 2825 L. Daigle, Editor
+Category: Informational May 2000
+
+
+ A Tangled Web: Issues of I18N, Domain Names, and the
+ Other Internet protocols
+
+Status of this Memo
+
+ This memo provides information for the Internet community. It does
+ not specify an Internet standard of any kind. Distribution of this
+ memo is unlimited.
+
+Copyright Notice
+
+ Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+Abstract
+
+ The goals of the work to "internationalize" Internet protocols
+ include providing all users of the Internet with the capability of
+ using their own language and its standard character set to express
+ themselves, write names, and to navigate the network. This impacts
+ the domain names visible in e-mail addresses and so many of today's
+ URLs used to locate information on the World Wide Web, etc. However,
+ domain names are used by Internet protocols that are used across
+ national boundaries. These services must interoperate worldwide, or
+ we risk isolating components of the network from each other along
+ locale boundaries. This type of isolation could impede not only
+ communications among people, but opportunities of the areas involved
+ to participate effectively in e-commerce, distance learning, and
+ other activities at an international scale, thereby retarding
+ economic development.
+
+ There are several proposals for internationalizing domain names,
+ however it it is still to be determined whether any of them will
+ ensure this interoperability and global reach while addressing
+ visible-name representation. Some of them obviously do not. This
+ document does not attempt to review any specific proposals, as that
+ is the work of the Internationalized Domain Name (IDN) Working Group
+ of the IETF, which is tasked with evaluating them in consideration of
+ the continued global network interoperation that is the deserved
+ expectation of all Internet users.
+
+
+
+
+
+
+
+IAB Informational [Page 1]
+
+RFC 2825 Issues: I18N, Domain Names, and Internet Protocols May 2000
+
+
+ This document is a statement by the Internet Architecture Board. It
+ is not a protocol specification, but an attempt to clarify the range
+ of architectural issues that the internationalization of domain names
+ faces.
+
+1. A Definition of Success
+
+ The Internationalized Domain Names (IDN) Working Group is one
+ component of the IETF's continuing comprehensive effort to
+ internationalize language representation facilities in the protocols
+ that support the global functioning of the Internet.
+
+ In keeping with the principles of rough consensus, running code,
+ architectural integrity, and in the interest of ensuring the global
+ stability of the Internet, the IAB emphasizes that all solutions
+ proposed to the (IDN) Working Group will have to be evaluated not
+ only on their individual technical features, but also in terms of
+ impact on existing standards and operations of the Internet and the
+ total effect for end-users: solutions must not cause users to become
+ more isolated from their global neighbors even if they appear to
+ solve a local problem. In some cases, existing protocols have
+ limitations on allowable characters, and in other cases
+ implementations of protocols used in the core of the Internet (beyond
+ individual organizations) have in practice not implemented all the
+ requisite options of the standards.
+
+2. Technical Challenges within the Domain Name System (DNS)
+
+ In many technical respects, the IDN work is not different from any
+ other effort to enable multiple character set representations in
+ textual elements that were traditionally restricted to English
+ language characters.
+
+ One aspect of the challenge is to decide how to represent the names
+ users want in the DNS in a way that is clear, technically feasible,
+ and ensures that a name always means the same thing. Several
+ proposals have been suggested to address these issues.
+
+ These issues are being outlined in more detail in the IDN WG's
+ evolving draft requirements document; further discussion is deferred
+ to the WG and its documents.
+
+3. Integrating with Current Realities
+
+ Nevertheless, issues faced by the IDN working group are complex and
+ intricately intertwined with other operational components of the
+ Internet. A key challenge in evaluating any proposed solution is the
+ analysis of the impact on existing critical operational standards
+
+
+
+IAB Informational [Page 2]
+
+RFC 2825 Issues: I18N, Domain Names, and Internet Protocols May 2000
+
+
+ which use fully-qualified domain names [RFC1034], or simply host
+ names [RFC1123]. Standards-changes can be effected, but the best
+ path forward is one that takes into account current realities and
+ (re)deployment latencies. In the Internet's global context, it is not
+ enough to update a few isolated systems, or even most of the systems
+ in a country or region. Deployment must be nearly universal in order
+ to avoid the creation of "islands" of interoperation that provide
+ users with less access to and connection from the rest of the world.
+
+ These are not esoteric or ephemeral concerns. Some specific issues
+ have already been identified as part of the IDN WG's efforts. These
+ include (but are not limited to) the following examples.
+
+3.1 Domain Names and E-mail
+
+ As indicated in the IDN WG's draft requirements document, the issue
+ goes beyond standardization of DNS usage. Electronic mail has long
+ been one of the most-used and most important applications of the
+ Internet. Internet e-mail is also used as the bridge that permits
+ the users of a variety of local and proprietary mail systems to
+ communicate. The standard protocols that define its use (e.g., SMTP
+ [RFC821, RFC822] and MIME [RFC2045]) do not permit the full range of
+ characters allowed in the DNS specification. Certain characters are
+ not allowed in e-mail address domain portions of these
+ specifications. Some mailers, built to adhere to these
+ specifications, are known to fail when on mail having non-ASCII
+ domain names in its address -- by discarding, misrouting or damaging
+ the mail. Thus, it's not possible to simply switch to
+ internationalized domain names and expect global e-mail to continue
+ to work until most of the servers in the world are upgraded.
+
+3.2 Domain Names and Routing
+
+ At a lower level, the Routing Policy Specification Language (RPLS)
+ [RFC2622] makes use of "named objects" -- and inherits object naming
+ restrictions from older standards ([RFC822] for the same e-mail
+ address restrictions, [RFC1034] for hostnames). This means that
+ until routing registries and their protocols are updated, it is not
+ possible to enter or retrieve network descriptions utilizing
+ internationalized domain names.
+
+3.3 Domain Names and Network Management
+
+ Also, the Simple Network Management Protocol (SNMP) uses the textual
+ representation defined in [RFC2579]. While that specification does
+ allow for UTF-8-based domain names, an informal survey of deployed
+ implementations of software libraries being used to build SNMP-
+ compliant software uncovered the fact that few (if any) implement it.
+
+
+
+IAB Informational [Page 3]
+
+RFC 2825 Issues: I18N, Domain Names, and Internet Protocols May 2000
+
+
+ This may cause inability to enter or display correct data in network
+ management tools, if such names are internationalized domain names.
+
+3.4 Domain Names and Security
+
+ Critical components of Internet public key technologies (PKIX,
+ [RFC2459], IKE [RFC2409]) rely heavily on identification of servers
+ (hostnames, or fully qualified domain names) and users (e-mail
+ addresses). Failure to respect the character restrictions in these
+ protocols will impact security tools built to use them -- Transport
+ Layer Security protocol (TLS, [RFC2246]), and IPsec [RFC2401] to name
+ two.
+
+ Failure may not be obvious. For example, in TLS, it is common usage
+ for a server to display a certificate containing a domain name
+ purporting to be the domain name of the server, which the client can
+ then match with the server name he thought he used to reach the
+ service.
+
+ Unless comparison of domain names is properly defined, the client may
+ either fail to match the domain name of a legitimate server, or match
+ incorrectly the domain name of a server performing a man-in-the-
+ middle attack. Either failure could enable attacks on systems that
+ are now impossible or at least far more difficult.
+
+4. Conclusion
+
+ It is therefore clear that, although there are many possible ways to
+ assign internationalized names that are compatible with today's DNS
+ (or a version that is easily-deployable in the near future), not all
+ of them are compatible with the full range of necessary networking
+ tools. When designing a solution for internationalization of domain
+ names, the effects on the current Internet must be carefully
+ evaluated. Some types of solutions proposed would, if put into effect
+ immediately, cause Internet communications to fail in ways that would
+ be hard to detect by and pose problems for those who deploy the new
+ services, but also for those who do not; this would have the effect
+ of cutting those who deploy them off from effective use of the
+ Internet.
+
+ The IDN WG has been identified as the appropriate forum for
+ identifying and discussing solutions for such potential
+ interoperability issues.
+
+ Experience with deployment of other protocols has indicated that it
+ will take years before a new protocol or enhancement is used all over
+ the Internet. So far, the IDN WG has benefited from proposed
+ solutions from all quarters, including organizations hoping to
+
+
+
+IAB Informational [Page 4]
+
+RFC 2825 Issues: I18N, Domain Names, and Internet Protocols May 2000
+
+
+ provide services that address visible-name representation and
+ registration -- continuing this process with the aim of getting a
+ single, scalable and deployable solution to this problem is the only
+ way to ensure the continued global interoperation that is the
+ deserved expectation of all Internet users.
+
+5. Security Considerations
+
+ In general, assignment and use of names does not raise any special
+ security problems. However, as noted above, some existing security
+ mechanisms are reliant on the current specification of domain names
+ and may not be expected to work, as is, with Internationalized domain
+ names. Additionally, deployment of non-standard systems (e.g., in
+ response to current pressures to address national or regional
+ characterset representation) might result in name strings that are
+ not globally unique, thereby opening up the possibility of "spoofing"
+ hosts from one domain in another, as described in [RFC2826].
+
+6. Acknowledgements
+
+ This document is the outcome of the joint effort of the members of
+ the IAB. Additionally, valuable remarks were provided by Randy Bush,
+ Patrik Faltstrom, Ted Hardie, Paul Hoffman, and Mark Kosters.
+
+7. References
+
+ [RFC821] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC
+ 821, August 1982.
+
+ [RFC822] Crocker, D., "Standard for the Format of ARPA Internet Text
+ Messages", STD 11, RFC 822, August 1982.
+
+ [RFC1034] Mockapetris, P., "Domain Names - Concepts and Facilities",
+ STD 13, RFC 1034, November 1987.
+
+ [RFC1123] Braden, R., "Requirements for Internet Hosts -- Application
+ and Support", STD 3, RFC 1123, November 1989.
+
+ [RFC2401] Kent, S. and R. Atkinson, "Security Architecture for the
+ Internet Protocol", RFC 2401, November 1998.
+
+ [RFC2409] Harkins, D and D. Carrel, "The Internet Key Exchange
+ (IKE)", RFC 2409, November 1998.
+
+ [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
+ Extensions (MIME) Part One: Format of Internet Message
+ Bodies", RFC 2045, November 1996.
+
+
+
+
+IAB Informational [Page 5]
+
+RFC 2825 Issues: I18N, Domain Names, and Internet Protocols May 2000
+
+
+ [RFC2246] Dierks, T. and C. Allen, "The TLS Protocol Version 1.0",
+ RFC 2246, January 1999.
+
+ [RFC2459] Housley, R., Ford, W., Polk, W. and D. Solo, "Internet
+ X.509 Public Key Infrastructure Certificate and CRL
+ Profile", RFC 2459, January 1999.
+
+ [RFC2579] McCloghrie, K., Perkins, D., Schoenwaelder, J., Case, J.
+ and M. Rose, "Textual Conventions for SMIv2", RFC 2579,
+ April 1999.
+
+ [RFC2622] Alaettinoglu, C., Villamizar, C., Gerich, E., Kessens, D.,
+ Meyer, D., Bates, T., Karrenberg, D. and M. Terpstra,
+ "Routing Policy Specification Language (RPSL)", RFC 2622,
+ June 1999.
+
+ [RFC2826] IAB, "IAB Technical Comment on the Unique DNS Root", RFC
+ 2826, May 2000.
+
+8. Author's Address
+
+ Internet Architecture Board
+
+ EMail: iab@iab.org
+
+
+ Membership at time this document was completed:
+
+ Harald Alvestrand
+ Ran Atkinson
+ Rob Austein
+ Brian Carpenter
+ Steve Bellovin
+ Jon Crowcroft
+ Leslie Daigle
+ Steve Deering
+ Tony Hain
+ Geoff Huston
+ John Klensin
+ Henning Schulzrinne
+
+
+
+
+
+
+
+
+
+
+
+IAB Informational [Page 6]
+
+RFC 2825 Issues: I18N, Domain Names, and Internet Protocols May 2000
+
+
+9. Full Copyright Statement
+
+ Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+ This document and translations of it may be copied and furnished to
+ others, and derivative works that comment on or otherwise explain it
+ or assist in its implementation may be prepared, copied, published
+ and distributed, in whole or in part, without restriction of any
+ kind, provided that the above copyright notice and this paragraph are
+ included on all such copies and derivative works. However, this
+ document itself may not be modified in any way, such as by removing
+ the copyright notice or references to the Internet Society or other
+ Internet organizations, except as needed for the purpose of
+ developing Internet standards in which case the procedures for
+ copyrights defined in the Internet Standards process must be
+ followed, or as required to translate it into languages other than
+ English.
+
+ The limited permissions granted above are perpetual and will not be
+ revoked by the Internet Society or its successors or assigns.
+
+ This document and the information contained herein is provided on an
+ "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+ TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
+ BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
+ HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+Acknowledgement
+
+ Funding for the RFC Editor function is currently provided by the
+ Internet Society.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+IAB Informational [Page 7]
+
diff --git a/doc/rfc/rfc2826.txt b/doc/rfc/rfc2826.txt
new file mode 100644
index 00000000..b4d88696
--- /dev/null
+++ b/doc/rfc/rfc2826.txt
@@ -0,0 +1,339 @@
+
+
+
+
+
+
+Network Working Group Internet Architecture Board
+Request for Comments: 2826 May 2000
+Category: Informational
+
+
+ IAB Technical Comment on the Unique DNS Root
+
+Status of this Memo
+
+ This memo provides information for the Internet community. It does
+ not specify an Internet standard of any kind. Distribution of this
+ memo is unlimited.
+
+Copyright Notice
+
+ Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+Summary
+
+ To remain a global network, the Internet requires the existence of a
+ globally unique public name space. The DNS name space is a
+ hierarchical name space derived from a single, globally unique root.
+ This is a technical constraint inherent in the design of the DNS.
+ Therefore it is not technically feasible for there to be more than
+ one root in the public DNS. That one root must be supported by a set
+ of coordinated root servers administered by a unique naming
+ authority.
+
+ Put simply, deploying multiple public DNS roots would raise a very
+ strong possibility that users of different ISPs who click on the same
+ link on a web page could end up at different destinations, against
+ the will of the web page designers.
+
+ This does not preclude private networks from operating their own
+ private name spaces, but if they wish to make use of names uniquely
+ defined for the global Internet, they have to fetch that information
+ from the global DNS naming hierarchy, and in particular from the
+ coordinated root servers of the global DNS naming hierarchy.
+
+1. Detailed Explanation
+
+ There are several distinct reasons why the DNS requires a single root
+ in order to operate properly.
+
+1.1. Maintenance of a Common Symbol Set
+
+ Effective communications between two parties requires two essential
+ preconditions:
+
+
+
+IAB Informational [Page 1]
+
+RFC 2826 IAB Technical Comment on the Unique DNS Root May 2000
+
+
+ - The existence of a common symbol set, and
+
+ - The existence of a common semantic interpretation of these
+ symbols.
+
+ Failure to meet the first condition implies a failure to communicate
+ at all, while failure to meet the second implies that the meaning of
+ the communication is lost.
+
+ In the case of a public communications system this condition of a
+ common symbol set with a common semantic interpretation must be
+ further strengthened to that of a unique symbol set with a unique
+ semantic interpretation. This condition of uniqueness allows any
+ party to initiate a communication that can be received and understood
+ by any other party. Such a condition rules out the ability to define
+ a symbol within some bounded context. In such a case, once the
+ communication moves out of the context of interpretation in which it
+ was defined, the meaning of the symbol becomes lost.
+
+ Within public digital communications networks such as the Internet
+ this requirement for a uniquely defined symbol set with a uniquely
+ defined meaning exists at many levels, commencing with the binary
+ encoding scheme, extending to packet headers and payload formats and
+ the protocol that an application uses to interact. In each case a
+ variation of the symbol set or a difference of interpretation of the
+ symbols being used within the interaction causes a protocol failure,
+ and the communication fails. The property of uniqueness allows a
+ symbol to be used unambiguously in any context, allowing the symbol
+ to be passed on, referred to, and reused, while still preserving the
+ meaning of the original use.
+
+ The DNS fulfills an essential role within the Internet protocol
+ environment, allowing network locations to be referred to using a
+ label other than a protocol address. As with any other such symbol
+ set, DNS names are designed to be globally unique, that is, for any
+ one DNS name at any one time there must be a single set of DNS
+ records uniquely describing protocol addresses, network resources and
+ services associated with that DNS name. All of the applications
+ deployed on the Internet which use the DNS assume this, and Internet
+ users expect such behavior from DNS names. Names are then constant
+ symbols, whose interpretation does not specifically require knowledge
+ of the context of any individual party. A DNS name can be passed
+ from one party to another without altering the semantic intent of the
+ name.
+
+ Since the DNS is hierarchically structured into domains, the
+ uniqueness requirement for DNS names in their entirety implies that
+ each of the names (sub-domains) defined within a domain has a unique
+
+
+
+IAB Informational [Page 2]
+
+RFC 2826 IAB Technical Comment on the Unique DNS Root May 2000
+
+
+ meaning (i.e., set of DNS records) within that domain. This is as
+ true for the root domain as for any other DNS domain. The
+ requirement for uniqueness within a domain further implies that there
+ be some mechanism to prevent name conflicts within a domain. In DNS
+ this is accomplished by assigning a single owner or maintainer to
+ every domain, including the root domain, who is responsible for
+ ensuring that each sub-domain of that domain has the proper records
+ associated with it. This is a technical requirement, not a policy
+ choice.
+
+1.2. Coordination of Updates
+
+ Both the design and implementations of the DNS protocol are heavily
+ based on the assumption that there is a single owner or maintainer
+ for every domain, and that any set of resources records associated
+ with a domain is modified in a single-copy serializable fashion.
+ That is, even assuming that a single domain could somehow be "shared"
+ by uncooperating parties, there is no means within the DNS protocol
+ by which a user or client could discover, and choose between,
+ conflicting definitions of a DNS name made by different parties. The
+ client will simply return the first set of resource records that it
+ finds that matches the requested domain, and assume that these are
+ valid. This protocol is embedded in the operating software of
+ hundreds of millions of computer systems, and is not easily updated
+ to support a shared domain scenario.
+
+ Moreover, even supposing that some other means of resolving
+ conflicting definitions could be provided in the future, it would
+ have to be based on objective rules established in advance. For
+ example, zone A.B could declare that naming authority Y had been
+ delegated all subdomains of A.B with an odd number of characters, and
+ that naming authority Z had been delegated authority to define
+ subdomains of A.B with an even number of characters. Thus, a single
+ set of rules would have to be agreed to prevent Y and Z from making
+ conflicting assignments, and with this train of actions a single
+ unique space has been created in any case. Even this would not allow
+ multiple non-cooperating authorities to assign arbitrary sub-domains
+ within a single domain.
+
+ It seems that a degree of cooperation and agreed technical rules are
+ required in order to guarantee the uniqueness of names. In the DNS,
+ these rules are established independently for each part of the naming
+ hierarchy, and the root domain is no exception. Thus, there must be
+ a generally agreed single set of rules for the root.
+
+
+
+
+
+
+
+IAB Informational [Page 3]
+
+RFC 2826 IAB Technical Comment on the Unique DNS Root May 2000
+
+
+1.3. Difficulty of Relocating the Root Zone
+
+ There is one specific technical respect in which the root zone
+ differs from all other DNS zones: the addresses of the name servers
+ for the root zone come primarily from out-of-band information. This
+ out-of-band information is often poorly maintained and, unlike all
+ other data in the DNS, the out-of-band information has no automatic
+ timeout mechanism. It is not uncommon for this information to be
+ years out of date at many sites.
+
+ Like any other zone, the root zone contains a set of "name server"
+ resource records listing its servers, but a resolver with no valid
+ addresses for the current set of root servers will never be able to
+ obtain these records. More insidiously, a resolver that has a mixed
+ set of partially valid and partially stale out-of-band configuration
+ information will not be able to tell which are the "real" root
+ servers if it gets back conflicting answers; thus, it is very
+ difficult to revoke the status of a malicious root server, or even to
+ route around a buggy root server.
+
+ In effect, every full-service resolver in the world "delegates" the
+ root of the public tree to the public root server(s) of its choice.
+
+ As a direct consequence, any change to the list of IP addresses that
+ specify the public root zone is significantly more difficult than
+ changing any other aspect of the DNS delegation chain. Thus,
+ stability of the system calls for extremely conservative and cautious
+ management of the public root zone: the frequency of updates to the
+ root zone must be kept low, and the servers for the root zone must be
+ closely coordinated.
+
+ These problems can be ameliorated to some extent by the DNS Security
+ Extensions [DNSSEC], but a similar out-of-band configuration problem
+ exists for the cryptographic signature key to the root zone, so the
+ root zone still requires tight coupling and coordinated management
+ even in the presence of DNSSEC.
+
+2. Conclusion
+
+ The DNS type of unique naming and name-mapping system may not be
+ ideal for a number of purposes for which it was never designed, such
+ a locating information when the user doesn't precisely know the
+ correct names. As the Internet continues to expand, we would expect
+ directory systems to evolve which can assist the user in dealing with
+ vague or ambiguous references. To preserve the many important
+ features of the DNS and its multiple record types -- including the
+ Internet's equivalent of telephone number portability -- we would
+ expect the result of directory lookups and identification of the
+
+
+
+IAB Informational [Page 4]
+
+RFC 2826 IAB Technical Comment on the Unique DNS Root May 2000
+
+
+ correct names for a particular purpose to be unique DNS names that
+ are then resolved normally, rather than having directory systems
+ "replace" the DNS.
+
+ There is no getting away from the unique root of the public DNS.
+
+3. Security Considerations
+
+ This memo does not introduce any new security issues, but it does
+ attempt to identify some of the problems inherent in a family of
+ recurring technically naive proposals.
+
+4. IANA Considerations
+
+ This memo is not intended to create any new issues for IANA.
+
+5. References
+
+ [DNS-CONCEPTS] Mockapetris, P., "Domain Names - Concepts and
+ Facilities", STD 13, RFC 1034, November 1987.
+
+ [DNS-IMPLEMENTATION] Mockapetris, P., "Domain Names - Implementation
+ and Specification", STD 13, RFC 1035, November
+ 1987.
+
+ [DNSSEC] Eastlake, D., "Domain Name System Security
+ Extensions", RFC 2535, March 1999.
+
+6. Author's Address
+
+ Internet Architecture Board
+
+ EMail: iab@iab.org
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+IAB Informational [Page 5]
+
+RFC 2826 IAB Technical Comment on the Unique DNS Root May 2000
+
+
+7. Full Copyright Statement
+
+ Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+ This document and translations of it may be copied and furnished to
+ others, and derivative works that comment on or otherwise explain it
+ or assist in its implementation may be prepared, copied, published
+ and distributed, in whole or in part, without restriction of any
+ kind, provided that the above copyright notice and this paragraph are
+ included on all such copies and derivative works. However, this
+ document itself may not be modified in any way, such as by removing
+ the copyright notice or references to the Internet Society or other
+ Internet organizations, except as needed for the purpose of
+ developing Internet standards in which case the procedures for
+ copyrights defined in the Internet Standards process must be
+ followed, or as required to translate it into languages other than
+ English.
+
+ The limited permissions granted above are perpetual and will not be
+ revoked by the Internet Society or its successors or assigns.
+
+ This document and the information contained herein is provided on an
+ "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+ TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
+ BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
+ HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+Acknowledgement
+
+ Funding for the RFC Editor function is currently provided by the
+ Internet Society.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+IAB Informational [Page 6]
+
diff --git a/doc/rfc/rfc2915.txt b/doc/rfc/rfc2915.txt
new file mode 100644
index 00000000..2022ba11
--- /dev/null
+++ b/doc/rfc/rfc2915.txt
@@ -0,0 +1,1011 @@
+
+
+
+
+
+
+Network Working Group M. Mealling
+Request for Comments: 2915 Network Solutions, Inc.
+Updates: 2168 R. Daniel
+Category: Standards Track DATAFUSION, Inc.
+ September 2000
+
+
+ The Naming Authority Pointer (NAPTR) DNS Resource Record
+
+Status of this Memo
+
+ This document specifies an Internet standards track protocol for the
+ Internet community, and requests discussion and suggestions for
+ improvements. Please refer to the current edition of the "Internet
+ Official Protocol Standards" (STD 1) for the standardization state
+ and status of this protocol. Distribution of this memo is unlimited.
+
+Copyright Notice
+
+ Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+Abstract
+
+ This document describes a Domain Name System (DNS) resource record
+ which specifies a regular expression based rewrite rule that, when
+ applied to an existing string, will produce a new domain label or
+ Uniform Resource Identifier (URI). Depending on the value of the
+ flags field of the resource record, the resulting domain label or URI
+ may be used in subsequent queries for the Naming Authority Pointer
+ (NAPTR) resource records (to delegate the name lookup) or as the
+ output of the entire process for which this system is used (a
+ resolution server for URI resolution, a service URI for ENUM style
+ e.164 number to URI mapping, etc).
+
+ This allows the DNS to be used to lookup services for a wide variety
+ of resource names (including URIs) which are not in domain name
+ syntax. Reasons for doing this range from URN Resource Discovery
+ Systems to moving out-of-date services to new domains.
+
+ This document updates the portions of RFC 2168 specifically dealing
+ with the definition of the NAPTR records and how other, non-URI
+ specific applications, might use NAPTR.
+
+
+
+
+
+
+
+
+
+Mealling & Daniel Standards Track [Page 1]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+Table of Contents
+
+ 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
+ 2. NAPTR RR Format . . . . . . . . . . . . . . . . . . . . . . 3
+ 3. Substitution Expression Grammar . . . . . . . . . . . . . . 7
+ 4. The Basic NAPTR Algorithm . . . . . . . . . . . . . . . . . 8
+ 5. Concerning How NAPTR Uses SRV Records . . . . . . . . . . . 9
+ 6. Application Specifications . . . . . . . . . . . . . . . . . 10
+ 7. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 10
+ 7.1 Example 1 . . . . . . . . . . . . . . . . . . . . . . . . . 10
+ 7.2 Example 2 . . . . . . . . . . . . . . . . . . . . . . . . . 12
+ 7.3 Example 3 . . . . . . . . . . . . . . . . . . . . . . . . . 13
+ 8. DNS Packet Format . . . . . . . . . . . . . . . . . . . . . 13
+ 9. Master File Format . . . . . . . . . . . . . . . . . . . . . 14
+ 10. Advice for DNS Administrators . . . . . . . . . . . . . . . 14
+ 11. Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
+ 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . 15
+ 13. Security Considerations . . . . . . . . . . . . . . . . . . 15
+ 14. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . 16
+ References . . . . . . . . . . . . . . . . . . . . . . . . . 16
+ Authors' Addresses . . . . . . . . . . . . . . . . . . . . . 17
+ Full Copyright Statement . . . . . . . . . . . . . . . . . . 18
+
+1. Introduction
+
+ This RR was originally produced by the URN Working Group [3] as a way
+ to encode rule-sets in DNS so that the delegated sections of a URI
+ could be decomposed in such a way that they could be changed and re-
+ delegated over time. The result was a Resource Record that included
+ a regular expression that would be used by a client program to
+ rewrite a string into a domain name. Regular expressions were chosen
+ for their compactness to expressivity ratio allowing for a great deal
+ of information to be encoded in a rather small DNS packet.
+
+ The function of rewriting a string according to the rules in a record
+ has usefulness in several different applications. This document
+ defines the basic assumptions to which all of those applications must
+ adhere to. It does not define the reasons the rewrite is used, what
+ the expected outcomes are, or what they are used for. Those are
+ specified by applications that define how they use the NAPTR record
+ and algorithms within their contexts.
+
+ Flags and other fields are also specified in the RR to control the
+ rewrite procedure in various ways or to provide information on how to
+ communicate with the host at the domain name that was the result of
+ the rewrite.
+
+
+
+
+
+Mealling & Daniel Standards Track [Page 2]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+ The final result is a RR that has several fields that interact in a
+ non-trivial but implementable way. This document specifies those
+ fields and their values.
+
+ This document does not define applications that utilizes this rewrite
+ functionality. Instead it specifies just the mechanics of how it is
+ done. Why its done, what the rules concerning the inputs, and the
+ types of rules used are reserved for other documents that fully
+ specify a particular application. This separation is due to several
+ different applications all wanting to take advantage of the rewrite
+ rule lookup process. Each one has vastly different reasons for why
+ and how it uses the service, thus requiring that the definition of
+ the service be generic.
+
+ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
+ NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL"
+ in this document are to be interpreted as described in RFC 2119.
+
+ All references to Uniform Resource Identifiers in this document
+ adhere to the 'absoluteURI' production of the "Collected ABNF"
+ found in RFC 2396 [9]. Specifically, the semantics of URI
+ References do not apply since the concept of a Base makes no sense
+ here.
+
+2. NAPTR RR Format
+
+ The format of the NAPTR RR is given below. The DNS type code [1] for
+ NAPTR is 35.
+
+ Domain TTL Class Type Order Preference Flags Service Regexp
+ Replacement
+
+ Domain
+ The domain name to which this resource record refers. This is the
+ 'key' for this entry in the rule database. This value will either
+ be the first well known key (<something>.uri.arpa for example) or
+ a new key that is the output of a replacement or regexp rewrite.
+ Beyond this, it has the standard DNS requirements [1].
+
+ TTL
+ Standard DNS meaning [1].
+
+ Class
+ Standard DNS meaning [1].
+
+ Type
+ The Type Code [1] for NAPTR is 35.
+
+
+
+
+Mealling & Daniel Standards Track [Page 3]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+ Order
+ A 16-bit unsigned integer specifying the order in which the NAPTR
+ records MUST be processed to ensure the correct ordering of
+ rules. Low numbers are processed before high numbers, and once a
+ NAPTR is found whose rule "matches" the target, the client MUST
+ NOT consider any NAPTRs with a higher value for order (except as
+ noted below for the Flags field).
+
+ Preference
+ A 16-bit unsigned integer that specifies the order in which NAPTR
+ records with equal "order" values SHOULD be processed, low
+ numbers being processed before high numbers. This is similar to
+ the preference field in an MX record, and is used so domain
+ administrators can direct clients towards more capable hosts or
+ lighter weight protocols. A client MAY look at records with
+ higher preference values if it has a good reason to do so such as
+ not understanding the preferred protocol or service.
+
+ The important difference between Order and Preference is that
+ once a match is found the client MUST NOT consider records with a
+ different Order but they MAY process records with the same Order
+ but different Preferences. I.e., Preference is used to give weight
+ to rules that are considered the same from an authority
+ standpoint but not from a simple load balancing standpoint.
+
+ Flags
+ A <character-string> containing flags to control aspects of the
+ rewriting and interpretation of the fields in the record. Flags
+ are single characters from the set [A-Z0-9]. The case of the
+ alphabetic characters is not significant.
+
+ At this time only four flags, "S", "A", "U", and "P", are
+ defined. The "S", "A" and "U" flags denote a terminal lookup.
+ This means that this NAPTR record is the last one and that the
+ flag determines what the next stage should be. The "S" flag
+ means that the next lookup should be for SRV records [4]. See
+ Section 5 for additional information on how NAPTR uses the SRV
+ record type. "A" means that the next lookup should be for either
+ an A, AAAA, or A6 record. The "U" flag means that the next step
+ is not a DNS lookup but that the output of the Regexp field is an
+ URI that adheres to the 'absoluteURI' production found in the
+ ABNF of RFC 2396 [9]. Since there may be applications that use
+ NAPTR to also lookup aspects of URIs, implementors should be
+ aware that this may cause loop conditions and should act
+ accordingly.
+
+
+
+
+
+
+Mealling & Daniel Standards Track [Page 4]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+ The "P" flag says that the remainder of the application side
+ algorithm shall be carried out in a Protocol-specific fashion.
+ The new set of rules is identified by the Protocol specified in
+ the Services field. The record that contains the 'P' flag is the
+ last record that is interpreted by the rules specified in this
+ document. The new rules are dependent on the application for
+ which they are being used and the protocol specified. For
+ example, if the application is a URI RDS and the protocol is WIRE
+ then the new set of rules are governed by the algorithms
+ surrounding the WIRE HTTP specification and not this document.
+
+ The remaining alphabetic flags are reserved for future versions
+ of the NAPTR specification. The numeric flags may be used for
+ local experimentation. The S, A, U and P flags are all mutually
+ exclusive, and resolution libraries MAY signal an error if more
+ than one is given. (Experimental code and code for assisting in
+ the creation of NAPTRs would be more likely to signal such an
+ error than a client such as a browser). It is anticipated that
+ multiple flags will be allowed in the future, so implementers
+ MUST NOT assume that the flags field can only contain 0 or 1
+ characters. Finally, if a client encounters a record with an
+ unknown flag, it MUST ignore it and move to the next record. This
+ test takes precedence even over the "order" field. Since flags
+ can control the interpretation placed on fields, a novel flag
+ might change the interpretation of the regexp and/or replacement
+ fields such that it is impossible to determine if a record
+ matched a given target.
+
+ The "S", "A", and "U" flags are called 'terminal' flags since
+ they halt the looping rewrite algorithm. If those flags are not
+ present, clients may assume that another NAPTR RR exists at the
+ domain name produced by the current rewrite rule. Since the "P"
+ flag specifies a new algorithm, it may or may not be 'terminal'.
+ Thus, the client cannot assume that another NAPTR exists since
+ this case is determined elsewhere.
+
+ DNS servers MAY interpret these flags and values and use that
+ information to include appropriate SRV and A,AAAA, or A6 records
+ in the additional information portion of the DNS packet. Clients
+ are encouraged to check for additional information but are not
+ required to do so.
+
+ Service
+ Specifies the service(s) available down this rewrite path. It may
+ also specify the particular protocol that is used to talk with a
+ service. A protocol MUST be specified if the flags field states
+ that the NAPTR is terminal. If a protocol is specified, but the
+ flags field does not state that the NAPTR is terminal, the next
+
+
+
+Mealling & Daniel Standards Track [Page 5]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+ lookup MUST be for a NAPTR. The client MAY choose not to perform
+ the next lookup if the protocol is unknown, but that behavior
+ MUST NOT be relied upon.
+
+ The service field may take any of the values below (using the
+ Augmented BNF of RFC 2234 [5]):
+
+ service_field = [ [protocol] *("+" rs)]
+ protocol = ALPHA *31ALPHANUM
+ rs = ALPHA *31ALPHANUM
+ ; The protocol and rs fields are limited to 32
+ ; characters and must start with an alphabetic.
+
+ For example, an optional protocol specification followed by 0 or
+ more resolution services. Each resolution service is indicated by
+ an initial '+' character.
+
+ Note that the empty string is also a valid service field. This
+ will typically be seen at the beginning of a series of rules,
+ when it is impossible to know what services and protocols will be
+ offered by a particular service.
+
+ The actual format of the service request and response will be
+ determined by the resolution protocol, and is the subject for
+ other documents. Protocols need not offer all services. The
+ labels for service requests shall be formed from the set of
+ characters [A-Z0-9]. The case of the alphabetic characters is
+ not significant.
+
+ The list of "valid" protocols for any given NAPTR record is any
+ protocol that implements some or all of the services defined for
+ a NAPTR application. Currently, THTTP [6] is the only protocol
+ that is known to make that claim at the time of publication. Any
+ other protocol that is to be used must have documentation
+ specifying:
+
+ * how it implements the services of the application
+
+ * how it is to appear in the NAPTR record (i.e., the string id
+ of the protocol)
+
+ The list of valid Resolution Services is defined by the documents
+ that specify individual NAPTR based applications.
+
+ It is worth noting that the interpretation of this field is
+ subject to being changed by new flags, and that the current
+ specification is oriented towards telling clients how to talk
+ with a URN resolver.
+
+
+
+Mealling & Daniel Standards Track [Page 6]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+ Regexp
+ A STRING containing a substitution expression that is applied to
+ the original string held by the client in order to construct the
+ next domain name to lookup. The grammar of the substitution
+ expression is given in the next section.
+
+ The regular expressions MUST NOT be used in a cumulative fashion,
+ that is, they should only be applied to the original string held
+ by the client, never to the domain name produced by a previous
+ NAPTR rewrite. The latter is tempting in some applications but
+ experience has shown such use to be extremely fault sensitive,
+ very error prone, and extremely difficult to debug.
+
+ Replacement
+ The next NAME to query for NAPTR, SRV, or address records
+ depending on the value of the flags field. This MUST be a fully
+ qualified domain-name. Unless and until permitted by future
+ standards action, name compression is not to be used for this
+ field.
+
+3. Substitution Expression Grammar
+
+ The content of the regexp field is a substitution expression. True
+ sed(1) and Perl style substitution expressions are not appropriate
+ for use in this application for a variety of reasons stemming from
+ internationalization requirements and backref limitations, therefore
+ the contents of the regexp field MUST follow the grammar below:
+
+subst_expr = delim-char ere delim-char repl delim-char *flags
+delim-char = "/" / "!" / ... <Any non-digit or non-flag character
+ other than backslash '\'. All occurances of a delim_char
+ in a subst_expr must be the same character.>
+ere = POSIX Extended Regular Expression
+repl = 1 * ( OCTET / backref )
+backref = "\" 1POS_DIGIT
+flags = "i"
+POS_DIGIT = %x31-39 ; 0 is not an allowed backref
+
+ The definition of a POSIX Extended Regular Expression can be found in
+ [8], section 2.8.4.
+
+ The result of applying the substitution expression to the original
+ URI MUST result in either a string that obeys the syntax for DNS
+ domain-names [1] or a URI [9] if the Flags field contains a 'u'.
+ Since it is possible for the regexp field to be improperly specified,
+ such that a non-conforming domain-name can be constructed, client
+ software SHOULD verify that the result is a legal DNS domain-name
+ before making queries on it.
+
+
+
+Mealling & Daniel Standards Track [Page 7]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+ Backref expressions in the repl portion of the substitution
+ expression are replaced by the (possibly empty) string of characters
+ enclosed by '(' and ')' in the ERE portion of the substitution
+ expression. N is a single digit from 1 through 9, inclusive. It
+ specifies the N'th backref expression, the one that begins with the
+ N'th '(' and continues to the matching ')'. For example, the ERE
+
+ (A(B(C)DE)(F)G)
+
+ has backref expressions:
+
+ \1 = ABCDEFG
+ \2 = BCDE
+ \3 = C
+ \4 = F
+ \5..\9 = error - no matching subexpression
+
+ The "i" flag indicates that the ERE matching SHALL be performed in a
+ case-insensitive fashion. Furthermore, any backref replacements MAY
+ be normalized to lower case when the "i" flag is given.
+
+ The first character in the substitution expression shall be used as
+ the character that delimits the components of the substitution
+ expression. There must be exactly three non-escaped occurrences of
+ the delimiter character in a substitution expression. Since escaped
+ occurrences of the delimiter character will be interpreted as
+ occurrences of that character, digits MUST NOT be used as delimiters.
+ Backrefs would be confused with literal digits were this allowed.
+ Similarly, if flags are specified in the substitution expression, the
+ delimiter character must not also be a flag character.
+
+4. The Basic NAPTR Algorithm
+
+ The behavior and meaning of the flags and services assume an
+ algorithm where the output of one rewrite is a new key that points to
+ another rule. This looping algorithm allows NAPTR records to
+ incrementally specify a complete rule. These incremental rules can
+ be delegated which allows other entities to specify rules so that one
+ entity does not need to understand _all_ rules.
+
+ The algorithm starts with a string and some known key (domain).
+ NAPTR records for this key are retrieved, those with unknown Flags or
+ inappropriate Services are discarded and the remaining records are
+ sorted by their Order field. Within each value of Order, the records
+ are further sorted by the Preferences field.
+
+ The records are examined in sorted order until a matching record is
+ found. A record is considered a match iff:
+
+
+
+Mealling & Daniel Standards Track [Page 8]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+ o it has a Replacement field value instead of a Regexp field value.
+
+ o or the Regexp field matches the string held by the client.
+
+ The first match MUST be the match that is used. Once a match is
+ found, the Services field is examined for whether or not this rule
+ advances toward the desired result. If so, the rule is applied to
+ the target string. If not, the process halts. The domain that
+ results from the regular expression is then used as the domain of the
+ next loop through the NAPTR algorithm. Note that the same target
+ string is used throughout the algorithm.
+
+ This looping is extremely important since it is the method by which
+ complex rules are broken down into manageable delegated chunks. The
+ flags fields simply determine at which point the looping should stop
+ (or other specialized behavior).
+
+ Since flags are valid at any level of the algorithm, the degenerative
+ case is to never loop but to look up the NAPTR and then stop. In
+ many specialized cases this is all that is needed. Implementors
+ should be aware that the degenerative case should not become the
+ common case.
+
+5. Concerning How NAPTR Uses SRV Records
+
+ When the SRV record type was originally specified it assumed that the
+ client did not know the specific domain-name before hand. The client
+ would construct a domain-name more in the form of a question than the
+ usual case of knowing ahead of time that the domain-name should
+ exist. I.e., if the client wants to know if there is a TCP based
+ HTTP server running at a particular domain, the client would
+ construct the domain-name _http._tcp.somedomain.com and ask the DNS
+ if that records exists. The underscores are used to avoid collisions
+ with potentially 'real' domain-names.
+
+ In the case of NAPTR, the actual domain-name is specified by the
+ various fields in the NAPTR record. In this case the client isn't
+ asking a question but is instead attempting to get at information
+ that it has been told exists in an SRV record at that particular
+ domain-name. While this usage of SRV is slightly different than the
+ SRV authors originally intended it does not break any of the
+ assumptions concerning what SRV contains. Also, since the NAPTR
+ explicitly spells out the domain-name for which an SRV exists, that
+ domain-name MUST be used in SRV queries with NO transformations. Any
+ given NAPTR record may result in a domain-name to be used for SRV
+ queries that may or may not contain the SRV standardized underscore
+
+
+
+
+
+Mealling & Daniel Standards Track [Page 9]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+ characters. NAPTR applications that make use of SRV MUST NOT attempt
+ to understand these domains or use them according to how the SRV
+ specification structures its query domains.
+
+6. Application Specifications
+
+ It should be noted that the NAPTR algorithm is the basic assumption
+ about how NAPTR works. The reasons for the rewrite and the expected
+ output and its use are specified by documents that define what
+ applications the NAPTR record and algorithm are used for. Any
+ document that defines such an application must define the following:
+
+ o The first known domain-name or how to build it
+
+ o The valid Services and Protocols
+
+ o What the expected use is for the output of the last rewrite
+
+ o The validity and/or behavior of any 'P' flag protocols.
+
+ o The general semantics surrounding why and how NAPTR and its
+ algorithm are being used.
+
+7. Examples
+
+ NOTE: These are examples only. They are taken from ongoing work and
+ may not represent the end result of that work. They are here for
+ pedagogical reasons only.
+
+7.1 Example 1
+
+ NAPTR was originally specified for use with the a Uniform Resource
+ Name Resolver Discovery System. This example details how a
+ particular URN would use the NAPTR record to find a resolver service.
+
+ Consider a URN namespace based on MIME Content-Ids. The URN might
+ look like this:
+
+ urn:cid:39CB83F7.A8450130@fake.gatech.edu
+
+ (Note that this example is chosen for pedagogical purposes, and does
+ not conform to the CID URL scheme.)
+
+ The first step in the resolution process is to find out about the CID
+ namespace. The namespace identifier [3], 'cid', is extracted from
+ the URN, prepended to urn.arpa. 'cid.urn.arpa' then becomes the first
+ 'known' key in the NAPTR algorithm. The NAPTR records for
+ cid.urn.arpa looked up and return a single record:
+
+
+
+Mealling & Daniel Standards Track [Page 10]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+ cid.urn.arpa.
+ ;; order pref flags service regexp replacement
+ IN NAPTR 100 10 "" "" "/urn:cid:.+@([^\.]+\.)(.*)$/\2/i" .
+
+ There is only one NAPTR response, so ordering the responses is not a
+ problem. The replacement field is empty, so the pattern provided in
+ the regexp field is used. We apply that regexp to the entire URN to
+ see if it matches, which it does. The \2 part of the substitution
+ expression returns the string "gatech.edu". Since the flags field
+ does not contain "s" or "a", the lookup is not terminal and our next
+ probe to DNS is for more NAPTR records where the new domain is '
+ gatech.edu' and the string is the same string as before.
+
+ Note that the rule does not extract the full domain name from the
+ CID, instead it assumes the CID comes from a host and extracts its
+ domain. While all hosts, such as mordred, could have their very own
+ NAPTR, maintaining those records for all the machines at a site as
+ large as Georgia Tech would be an intolerable burden. Wildcards are
+ not appropriate here since they only return results when there is no
+ exactly matching names already in the system.
+
+ The record returned from the query on "gatech.edu" might look like:
+
+;; order pref flags service regexp replacement
+ IN NAPTR 100 50 "s" "z3950+I2L+I2C" "" _z3950._tcp.gatech.edu.
+ IN NAPTR 100 50 "s" "rcds+I2C" "" _rcds._udp.gatech.edu.
+ IN NAPTR 100 50 "s" "http+I2L+I2C+I2R" "" _http._tcp.gatech.edu.
+
+ Continuing with the example, note that the values of the order and
+ preference fields are equal in all records, so the client is free to
+ pick any record. The flags field tells us that these are the last
+ NAPTR patterns we should see, and after the rewrite (a simple
+ replacement in this case) we should look up SRV records to get
+ information on the hosts that can provide the necessary service.
+
+ Assuming we prefer the Z39.50 protocol, our lookup might return:
+
+ ;; Pref Weight Port Target
+ _z3950._tcp.gatech.edu. IN SRV 0 0 1000 z3950.gatech.edu.
+ IN SRV 0 0 1000 z3950.cc.gatech.edu.
+ IN SRV 0 0 1000 z3950.uga.edu.
+
+ telling us three hosts that could actually do the resolution, and
+ giving us the port we should use to talk to their Z39.50 server.
+
+ Recall that the regular expression used \2 to extract a domain name
+ from the CID, and \. for matching the literal '.' characters
+ separating the domain name components. Since '\' is the escape
+
+
+
+Mealling & Daniel Standards Track [Page 11]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+ character, literal occurances of a backslash must be escaped by
+ another backslash. For the case of the cid.urn.arpa record above,
+ the regular expression entered into the master file should be
+ "/urn:cid:.+@([^\\.]+\\.)(.*)$/\\2/i". When the client code actually
+ receives the record, the pattern will have been converted to
+ "/urn:cid:.+@([^\.]+\.)(.*)$/\2/i".
+
+7.2 Example 2
+
+ Even if URN systems were in place now, there would still be a
+ tremendous number of URLs. It should be possible to develop a URN
+ resolution system that can also provide location independence for
+ those URLs. This is related to the requirement that URNs be able to
+ grandfather in names from other naming systems, such as ISO Formal
+ Public Identifiers, Library of Congress Call Numbers, ISBNs, ISSNs,
+ etc.
+
+ The NAPTR RR could also be used for URLs that have already been
+ assigned. Assume we have the URL for a very popular piece of
+ software that the publisher wishes to mirror at multiple sites around
+ the world:
+
+ Using the rules specified for this application we extract the prefix,
+ "http", and lookup NAPTR records for http.uri.arpa. This might
+ return a record of the form
+
+ http.uri.arpa. IN NAPTR
+ ;; order pref flags service regexp replacement
+ 100 90 "" "" "!http://([^/:]+)!\1!i" .
+
+ This expression returns everything after the first double slash and
+ before the next slash or colon. (We use the '!' character to delimit
+ the parts of the substitution expression. Otherwise we would have to
+ use backslashes to escape the forward slashes and would have a regexp
+ in the zone file that looked like "/http:\\/\\/([^\\/:]+)/\\1/i".).
+
+ Applying this pattern to the URL extracts "www.foo.com". Looking up
+ NAPTR records for that might return:
+
+ www.foo.com.
+ ;; order pref flags service regexp replacement
+ IN NAPTR 100 100 "s" "http+I2R" "" _http._tcp.foo.com.
+ IN NAPTR 100 100 "s" "ftp+I2R" "" _ftp._tcp.foo.com.
+
+ Looking up SRV records for http.tcp.foo.com would return information
+ on the hosts that foo.com has designated to be its mirror sites. The
+ client can then pick one for the user.
+
+
+
+
+Mealling & Daniel Standards Track [Page 12]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+7.3 Example 3
+
+ A non-URI example is the ENUM application which uses a NAPTR record
+ to map an e.164 telephone number to a URI. In order to convert the
+ phone number to a domain name for the first iteration all characters
+ other than digits are removed from the the telephone number, the
+ entire number is inverted, periods are put between each digit and the
+ string ".e164.arpa" is put on the left-hand side. For example, the
+ E.164 phone number "+1-770-555-1212" converted to a domain-name it
+ would be "2.1.2.1.5.5.5.0.7.7.1.e164.arpa."
+
+ For this example telephone number we might get back the following
+ NAPTR records:
+
+$ORIGIN 2.1.2.1.5.5.5.0.7.7.1.e164.arpa.
+ IN NAPTR 100 10 "u" "sip+E2U" "!^.*$!sip:information@tele2.se!" .
+ IN NAPTR 102 10 "u" "mailto+E2U" "!^.*$!mailto:information@tele2.se!" .
+
+ This application uses the same 'u' flag as the URI Resolution
+ application. This flag states that the Rule is terminal and that the
+ output is a URI which contains the information needed to contact that
+ telephone service. ENUM also uses the same format for its Service
+ field except that it defines the 'E2U' service instead of the 'I2*'
+ services that URI resolution uses. The example above states that the
+ available protocols used to access that telephone's service are
+ either the Session Initiation Protocol or SMTP mail.
+
+8. DNS Packet Format
+
+ The packet format for the NAPTR record is:
+
+ 1 1 1 1 1 1
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ | ORDER |
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ | PREFERENCE |
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ / FLAGS /
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ / SERVICES /
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ / REGEXP /
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ / REPLACEMENT /
+ / /
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+
+
+
+
+Mealling & Daniel Standards Track [Page 13]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+ where:
+
+ FLAGS A <character-string> which contains various flags.
+
+ SERVICES A <character-string> which contains protocol and service
+ identifiers.
+
+ REGEXP A <character-string> which contains a regular expression.
+
+ REPLACEMENT A <domain-name> which specifies the new value in the
+ case where the regular expression is a simple replacement
+ operation.
+
+ <character-string> and <domain-name> as used here are defined in
+ RFC1035 [1].
+
+9. Master File Format
+
+ The master file format follows the standard rules in RFC-1035 [1].
+ Order and preference, being 16-bit unsigned integers, shall be an
+ integer between 0 and 65535. The Flags and Services and Regexp
+ fields are all quoted <character-string>s. Since the Regexp field
+ can contain numerous backslashes and thus should be treated with
+ care. See Section 10 for how to correctly enter and escape the
+ regular expression.
+
+10. Advice for DNS Administrators
+
+ Beware of regular expressions. Not only are they difficult to get
+ correct on their own, but there is the previously mentioned
+ interaction with DNS. Any backslashes in a regexp must be entered
+ twice in a zone file in order to appear once in a query response.
+ More seriously, the need for double backslashes has probably not been
+ tested by all implementors of DNS servers.
+
+ The "a" flag allows the next lookup to be for address records (A,
+ AAAA, A6) rather than SRV records. Since there is no place for a
+ port specification in the NAPTR record, when the "A" flag is used the
+ specified protocol must be running on its default port.
+
+ The URN Syntax draft defines a canonical form for each URN, which
+ requires %encoding characters outside a limited repertoire. The
+ regular expressions MUST be written to operate on that canonical
+ form. Since international character sets will end up with extensive
+ use of %encoded characters, regular expressions operating on them
+ will be essentially impossible to read or write by hand.
+
+
+
+
+
+Mealling & Daniel Standards Track [Page 14]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+11. Notes
+
+ o A client MUST process multiple NAPTR records in the order
+ specified by the "order" field, it MUST NOT simply use the first
+ record that provides a known protocol and service combination.
+
+ o When multiple RRs have the same "order" and all other criteria
+ being equal, the client should use the value of the preference
+ field to select the next NAPTR to consider. However, because it
+ will often be the case where preferred protocols or services
+ exist, clients may use this additional criteria to sort
+ the records.
+
+ o If the lookup after a rewrite fails, clients are strongly
+ encouraged to report a failure, rather than backing up to pursue
+ other rewrite paths.
+
+ o Note that SRV RRs impose additional requirements on clients.
+
+12. IANA Considerations
+
+ The only registration function that impacts the IANA is for the
+ values that are standardized for the Services and Flags fields. To
+ extend the valid values of the Flags field beyond what is specified
+ in this document requires a published specification that is approved
+ by the IESG.
+
+ The values for the Services field will be determined by the
+ application that makes use of the NAPTR record. Those values must be
+ specified in a published specification and approved by the IESG.
+
+13. Security Considerations
+
+ The interactions with DNSSEC are currently being studied. It is
+ expected that NAPTR records will be signed with SIG records once the
+ DNSSEC work is deployed.
+
+ The rewrite rules make identifiers from other namespaces subject to
+ the same attacks as normal domain names. Since they have not been
+ easily resolvable before, this may or may not be considered a
+ problem.
+
+ Regular expressions should be checked for sanity, not blindly passed
+ to something like PERL.
+
+ This document has discussed a way of locating a service, but has not
+ discussed any detail of how the communication with that service takes
+ place. There are significant security considerations attached to the
+
+
+
+Mealling & Daniel Standards Track [Page 15]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+ communication with a service. Those considerations are outside the
+ scope of this document, and must be addressed by the specifications
+ for particular communication protocols.
+
+14. Acknowledgments
+
+ The editors would like to thank Keith Moore for all his consultations
+ during the development of this memo. We would also like to thank
+ Paul Vixie for his assistance in debugging our implementation, and
+ his answers on our questions. Finally, we would like to acknowledge
+ our enormous intellectual debt to the participants in the Knoxville
+ series of meetings, as well as to the participants in the URI and URN
+ working groups.
+
+References
+
+ [1] Mockapetris, P., "Domain names - implementation and
+ specification", STD 13, RFC 1035, November 1987.
+
+ [2] Mockapetris, P., "Domain names - concepts and facilities", STD
+ 13, RFC 1034, November 1987.
+
+ [3] Moats, R., "URN Syntax", RFC 2141, May 1997.
+
+ [4] Gulbrandsen, A., Vixie, P. and L. Esibov, "A DNS RR for
+ specifying the location of services (DNS SRV)", RFC 2782,
+ February 2000.
+
+ [5] Crocker, D., "Augmented BNF for Syntax Specifications: ABNF",
+ RFC 2234, November 1997.
+
+ [6] Daniel, R., "A Trivial Convention for using HTTP in URN
+ Resolution", RFC 2169, June 1997.
+
+ [7] Daniel, R. and M. Mealling, "Resolution of Uniform Resource
+ Identifiers using the Domain Name System", RFC 2168, June 1997.
+
+ [8] IEEE, "IEEE Standard for Information Technology - Portable
+ Operating System Interface (POSIX) - Part 2: Shell and Utilities
+ (Vol. 1)", IEEE Std 1003.2-1992, January 1993.
+
+ [9] Berners-Lee, T., Fielding, R.T. and L. Masinter, "Uniform
+ Resource Identifiers (URI): Generic Syntax", RFC 2396, August
+ 1998.
+
+
+
+
+
+
+
+Mealling & Daniel Standards Track [Page 16]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+Authors' Addresses
+
+ Michael Mealling
+ Network Solutions, Inc.
+ 505 Huntmar Park Drive
+ Herndon, VA 22070
+ US
+
+ Phone: +1 770 921 2251
+ EMail: michaelm@netsol.com
+ URI: http://www.netsol.com
+
+
+ Ron Daniel
+ DATAFUSION, Inc.
+ 139 Townsend Street, Ste. 100
+ San Francisco, CA 94107
+ US
+
+ Phone: +1 415 222 0100
+ EMail: rdaniel@datafusion.net
+ URI: http://www.datafusion.net
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Mealling & Daniel Standards Track [Page 17]
+
+RFC 2915 NAPTR DNS RR September 2000
+
+
+Full Copyright Statement
+
+ Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+ This document and translations of it may be copied and furnished to
+ others, and derivative works that comment on or otherwise explain it
+ or assist in its implementation may be prepared, copied, published
+ and distributed, in whole or in part, without restriction of any
+ kind, provided that the above copyright notice and this paragraph are
+ included on all such copies and derivative works. However, this
+ document itself may not be modified in any way, such as by removing
+ the copyright notice or references to the Internet Society or other
+ Internet organizations, except as needed for the purpose of
+ developing Internet standards in which case the procedures for
+ copyrights defined in the Internet Standards process must be
+ followed, or as required to translate it into languages other than
+ English.
+
+ The limited permissions granted above are perpetual and will not be
+ revoked by the Internet Society or its successors or assigns.
+
+ This document and the information contained herein is provided on an
+ "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+ TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
+ BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
+ HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+Acknowledgement
+
+ Funding for the RFC Editor function is currently provided by the
+ Internet Society.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Mealling & Daniel Standards Track [Page 18]
+
diff --git a/lib/dns/Makefile.in b/lib/dns/Makefile.in
index 7e25bd20..a2553612 100644
--- a/lib/dns/Makefile.in
+++ b/lib/dns/Makefile.in
@@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.116 2000/12/04 23:21:40 bwelling Exp $
+# $Id: Makefile.in,v 1.117 2000/12/09 02:17:04 bwelling Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@@ -91,9 +91,10 @@ OPENSSLOBJS = sec/openssl/a_bitstr.@O@ sec/openssl/a_bytes.@O@ \
# Alphabetically
OBJS = a6.@O@ acl.@O@ adb.@O@ byaddr.@O@ \
cache.@O@ callbacks.@O@ compress.@O@ \
- db.@O@ dbiterator.@O@ dbtable.@O@ dispatch.@O@ dnssec.@O@ \
- forward.@O@ journal.@O@ keytable.@O@ lib.@O@ log.@O@ \
- lookup.@O@ master.@O@ masterdump.@O@ message.@O@ \
+ db.@O@ dbiterator.@O@ dbtable.@O@ diff.@O@ dispatch.@O@ \
+ dnssec.@O@ forward.@O@ journal.@O@ keytable.@O@ \
+ lib.@O@ log.@O@ lookup.@O@ \
+ master.@O@ masterdump.@O@ message.@O@ \
name.@O@ ncache.@O@ nxt.@O@ peer.@O@ \
rbt.@O@ rbtdb.@O@ rbtdb64.@O@ rdata.@O@ rdatalist.@O@ \
rdataset.@O@ rdatasetiter.@O@ rdataslab.@O@ request.@O@ \
@@ -106,9 +107,10 @@ OBJS = a6.@O@ acl.@O@ adb.@O@ byaddr.@O@ \
# Alphabetically
SRCS = a6.c acl.c adb.c byaddr.c \
cache.c callbacks.c compress.c \
- db.c dbiterator.c dbtable.c dispatch.c dnssec.c \
- forward.c journal.c keytable.c lib.c log.c \
- lookup.c master.c masterdump.c message.c \
+ db.c dbiterator.c dbtable.c diff.c dispatch.c \
+ dnssec.c forward.c journal.c keytable.c \
+ lib.c log.c lookup.c \
+ master.c masterdump.c message.c \
name.c ncache.c nxt.c peer.c \
rbt.c rbtdb.c rbtdb64.c rdata.c rdatalist.c \
rdataset.c rdatasetiter.c rdataslab.c request.c \
diff --git a/lib/dns/adb.c b/lib/dns/adb.c
index d5788aba..69d25918 100644
--- a/lib/dns/adb.c
+++ b/lib/dns/adb.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: adb.c,v 1.158 2000/11/11 02:14:25 gson Exp $ */
+/* $Id: adb.c,v 1.162 2000/12/20 23:31:04 bwelling Exp $ */
/*
* Implementation notes
@@ -39,6 +39,7 @@
#include <limits.h>
#include <isc/mutexblock.h>
+#include <isc/netaddr.h>
#include <isc/random.h>
#include <isc/string.h> /* Required for HP/UX (and others?) */
#include <isc/task.h>
@@ -293,9 +294,11 @@ static inline dns_adbname_t *find_name_and_lock(dns_adb_t *, dns_name_t *,
unsigned int, int *);
static inline dns_adbentry_t *find_entry_and_lock(dns_adb_t *,
isc_sockaddr_t *, int *);
-static void dump_adb(dns_adb_t *, FILE *);
+static void dump_adb(dns_adb_t *, FILE *, isc_boolean_t debug);
static void print_dns_name(FILE *, dns_name_t *);
-static void print_namehook_list(FILE *, dns_adbname_t *);
+static void print_namehook_list(FILE *, const char *legend,
+ dns_adbnamehooklist_t *list,
+ isc_stdtime_t now, isc_boolean_t debug);
static void print_find_list(FILE *, dns_adbname_t *);
static void print_fetch_list(FILE *, dns_adbname_t *);
static inline void dec_adb_irefcnt(dns_adb_t *);
@@ -420,7 +423,8 @@ static isc_result_t dbfind_a6(dns_adbname_t *, isc_stdtime_t);
#define NXDOMAIN_RESULT(r) ((r) == DNS_R_NXDOMAIN || \
(r) == DNS_R_NCACHENXDOMAIN)
#define NXRRSET_RESULT(r) ((r) == DNS_R_NCACHENXRRSET || \
- (r) == DNS_R_NXRRSET)
+ (r) == DNS_R_NXRRSET || \
+ (r) == DNS_R_HINTNXRRSET)
/*
* Error state rankings.
@@ -2104,7 +2108,7 @@ timer_cleanup(isc_task_t *task, isc_event_t *ev) {
if (adb->next_cleanbucket >= NBUCKETS) {
adb->next_cleanbucket = 0;
#ifdef DUMP_ADB_AFTER_CLEANING
- dump_adb(adb, stdout);
+ dump_adb(adb, stdout, ISC_TRUE);
#endif
}
}
@@ -2901,30 +2905,34 @@ dns_adb_dump(dns_adb_t *adb, FILE *f) {
* Lock the adb itself, lock all the name buckets, then lock all
* the entry buckets. This should put the adb into a state where
* nothing can change, so we can iterate through everything and
- * print at our leasure.
+ * print at our leisure.
*/
LOCK(&adb->lock);
- dump_adb(adb, f);
+ dump_adb(adb, f, ISC_TRUE);
UNLOCK(&adb->lock);
}
static void
-dump_adb(dns_adb_t *adb, FILE *f) {
+dump_ttl(FILE *f, const char *legend, isc_stdtime_t value, isc_stdtime_t now) {
+ if (value == INT_MAX)
+ return;
+ fprintf(f, " [%s TTL %d]", legend, value - now);
+}
+
+static void
+dump_adb(dns_adb_t *adb, FILE *f, isc_boolean_t debug) {
int i;
- isc_sockaddr_t *sa;
dns_adbname_t *name;
- dns_adbentry_t *entry;
- char tmp[512];
- const char *tmpp;
isc_stdtime_t now;
isc_stdtime_get(&now);
- fprintf(f, "ADB %p DUMP:\n", adb);
- fprintf(f, "erefcnt %u, irefcnt %u, finds out %u\n",
- adb->erefcnt, adb->irefcnt,
- isc_mempool_getallocated(adb->nhmp));
+ fprintf(f, ";\n; Address database dump\n;\n");
+ if (debug)
+ fprintf(f, "; addr %p, erefcnt %u, irefcnt %u, finds out %u\n",
+ adb, adb->erefcnt, adb->irefcnt,
+ isc_mempool_getallocated(adb->nhmp));
for (i = 0 ; i < NBUCKETS ; i++)
LOCK(&adb->namelocks[i]);
@@ -2934,89 +2942,42 @@ dump_adb(dns_adb_t *adb, FILE *f) {
/*
* Dump the names
*/
- fprintf(f, "Names:\n");
for (i = 0 ; i < NBUCKETS ; i++) {
name = ISC_LIST_HEAD(adb->names[i]);
if (name == NULL)
continue;
- fprintf(f, "Name bucket %d:\n", i);
- while (name != NULL) {
- fprintf(f, "name %p (flags %08x)\n",
- name, name->flags);
- if (!DNS_ADBNAME_VALID(name))
- fprintf(f, "\tMAGIC %08x\n", name->magic);
- fprintf(f, "\texpiry [");
- if (name->expire_v4 == INT_MAX)
- fprintf(f, "inf ");
- else
- fprintf(f, "%d ", name->expire_v4 - now);
- if (name->expire_v6 == INT_MAX)
- fprintf(f, "inf ");
- else
- fprintf(f, "%d ", name->expire_v6 - now);
- if (name->expire_target == INT_MAX)
- fprintf(f, "inf] ");
- else
- fprintf(f, "%d] ", name->expire_target - now);
+ if (debug)
+ fprintf(f, "; bucket %d\n", i);
+ for (;
+ name != NULL;
+ name = ISC_LIST_NEXT(name, plink))
+ {
+ if (debug)
+ fprintf(f, "; name %p (flags %08x)\n",
+ name, name->flags);
+
+ fprintf(f, "; ");
print_dns_name(f, &name->name);
if (dns_name_countlabels(&name->target) > 0) {
- fprintf(f, "\t\t alias for ");
+ fprintf(f, " alias ");
print_dns_name(f, &name->target);
}
- fprintf(f, "\n");
- fprintf(f, "\terr4: %u err6: %u\n",
- name->fetch_err, name->fetch6_err);
- print_namehook_list(f, name);
- print_fetch_list(f, name);
- print_find_list(f, name);
- fprintf(f, "\n");
- name = ISC_LIST_NEXT(name, plink);
- }
- }
+ dump_ttl(f, "v4", name->expire_v4, now);
+ dump_ttl(f, "v6", name->expire_v6, now);
+ dump_ttl(f, "target", name->expire_target, now);
- /*
- * Dump the entries
- */
- fprintf(f, "Entries:\n");
- for (i = 0 ; i < NBUCKETS ; i++) {
- entry = ISC_LIST_HEAD(adb->entries[i]);
- if (entry == NULL)
- continue;
- fprintf(f, "Entry bucket %d:\n", i);
- while (entry != NULL) {
- if (!DNS_ADBENTRY_VALID(entry))
- fprintf(f, "\tMAGIC %08x\n", entry->magic);
- if (entry->lock_bucket != i)
- fprintf(f, "\tWRONG BUCKET! lock_bucket %d\n",
- entry->lock_bucket);
-
- sa = &entry->sockaddr;
- switch (sa->type.sa.sa_family) {
- case AF_INET:
- tmpp = inet_ntop(AF_INET,
- &sa->type.sin.sin_addr,
- tmp, sizeof tmp);
- break;
- case AF_INET6:
- tmpp = inet_ntop(AF_INET6,
- &sa->type.sin6.sin6_addr,
- tmp, sizeof tmp);
- break;
- default:
- tmpp = "UnkFamily";
- }
+ fprintf(f, " [err4 %u] [err6 %u]\n",
+ name->fetch_err, name->fetch6_err);
- if (tmpp == NULL)
- tmpp = "BadAddress";
+ print_namehook_list(f, "v4", &name->v4, now, debug);
+ print_namehook_list(f, "v6", &name->v6, now, debug);
- fprintf(f, "\t%p: refcnt %u flags %08x goodness %d"
- " srtt %u addr %s, avoid_bitstring %u\n",
- entry, entry->refcnt, entry->flags,
- entry->goodness, entry->srtt, tmpp,
- entry->avoid_bitstring);
+ if (debug)
+ print_fetch_list(f, name);
+ if (debug)
+ print_find_list(f, name);
- entry = ISC_LIST_NEXT(entry, plink);
}
}
@@ -3029,6 +2990,28 @@ dump_adb(dns_adb_t *adb, FILE *f) {
UNLOCK(&adb->namelocks[i]);
}
+static void
+dump_entry(FILE *f, dns_adbentry_t *entry, isc_stdtime_t now, isc_boolean_t debug)
+{
+ char addrbuf[ISC_NETADDR_FORMATSIZE];
+ isc_netaddr_t netaddr;
+
+ isc_netaddr_fromsockaddr(&netaddr, &entry->sockaddr);
+ isc_netaddr_format(&netaddr, addrbuf, sizeof addrbuf);
+
+ if (debug)
+ fprintf(f, ";\t%p: refcnt %u flags %08x goodness %d\n",
+ entry, entry->refcnt, entry->flags,
+ entry->goodness);
+
+ fprintf(f, ";\t%s [srtt %u]", addrbuf, entry->srtt);
+
+ if (entry->avoid_bitstring != 0)
+ fprintf(f, " [avoid_bitstring %d]",
+ entry->avoid_bitstring - now);
+ fprintf(f, "\n");
+}
+
void
dns_adb_dumpfind(dns_adbfind_t *find, FILE *f) {
char tmp[512];
@@ -3043,11 +3026,11 @@ dns_adb_dumpfind(dns_adbfind_t *find, FILE *f) {
LOCK(&find->lock);
- fprintf(f, "Find %p\n", find);
- fprintf(f, "\tqpending %08x partial %08x options %08x flags %08x\n",
+ fprintf(f, ";Find %p\n", find);
+ fprintf(f, ";\tqpending %08x partial %08x options %08x flags %08x\n",
find->query_pending, find->partial_result,
find->options, find->flags);
- fprintf(f, "\tname_bucket %d, name %p, event sender %p\n",
+ fprintf(f, ";\tname_bucket %d, name %p, event sender %p\n",
find->name_bucket, find->adbname, find->event.ev_sender);
ai = ISC_LIST_HEAD(find->list);
@@ -3093,18 +3076,18 @@ print_dns_name(FILE *f, dns_name_t *name) {
}
static void
-print_namehook_list(FILE *f, dns_adbname_t *n) {
+print_namehook_list(FILE *f, const char *legend, dns_adbnamehooklist_t *list,
+ isc_stdtime_t now, isc_boolean_t debug)
+{
dns_adbnamehook_t *nh;
- nh = ISC_LIST_HEAD(n->v4);
- while (nh != NULL) {
- fprintf(f, "\t\tHook(V4) %p -> entry %p\n", nh, nh->entry);
- nh = ISC_LIST_NEXT(nh, plink);
- }
- nh = ISC_LIST_HEAD(n->v6);
- while (nh != NULL) {
- fprintf(f, "\t\tHook(V6) %p -> entry %p\n", nh, nh->entry);
- nh = ISC_LIST_NEXT(nh, plink);
+ for (nh = ISC_LIST_HEAD(*list);
+ nh != NULL;
+ nh = ISC_LIST_NEXT(nh, plink))
+ {
+ if (debug)
+ fprintf(f, ";\tHook(%s) %p\n", legend, nh);
+ dump_entry(f, nh->entry, now, debug);
}
}
@@ -3173,7 +3156,7 @@ dbfind_name(dns_adbname_t *adbname, isc_stdtime_t now, dns_rdatatype_t rdtype)
result = dns_view_find(adb->view, &adbname->name, rdtype, now,
NAME_GLUEOK(adbname),
ISC_TF(NAME_HINTOK(adbname)),
- fname, &rdataset, NULL);
+ NULL, NULL, fname, &rdataset, NULL);
switch (result) {
case DNS_R_GLUE:
@@ -3305,7 +3288,7 @@ dbfind_a6(dns_adbname_t *adbname, isc_stdtime_t now) {
result = dns_view_find(adb->view, &adbname->name, dns_rdatatype_a6,
now, NAME_GLUEOK(adbname),
ISC_TF(NAME_HINTOK(adbname)),
- fname, &rdataset, NULL);
+ NULL, NULL, fname, &rdataset, NULL);
switch (result) {
case DNS_R_GLUE:
diff --git a/lib/dns/cache.c b/lib/dns/cache.c
index 51beaac0..ef5fff47 100644
--- a/lib/dns/cache.c
+++ b/lib/dns/cache.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: cache.c,v 1.30 2000/08/31 12:15:08 marka Exp $ */
+/* $Id: cache.c,v 1.31 2000/12/11 19:24:03 bwelling Exp $ */
#include <config.h>
@@ -55,10 +55,10 @@ typedef enum {
* Convenience macros for comprehensive assertion checking.
*/
#define CLEANER_IDLE(c) ((c)->state == cleaner_s_idle && \
- (c)->iterator == NULL && \
+ (c)->iterator == NULL && \
(c)->resched_event != NULL)
#define CLEANER_BUSY(c) ((c)->state == cleaner_s_busy && \
- (c)->iterator != NULL && \
+ (c)->iterator != NULL && \
(c)->resched_event == NULL)
struct cache_cleaner {
@@ -343,7 +343,7 @@ static isc_result_t
cache_cleaner_init(dns_cache_t *cache, isc_taskmgr_t *taskmgr,
isc_timermgr_t *timermgr, cache_cleaner_t *cleaner)
{
- isc_result_t result;
+ isc_result_t result;
cleaner->increment = 100;
cleaner->state = cleaner_s_idle;
diff --git a/lib/dns/config/confcommon.c b/lib/dns/config/confcommon.c
index 920a59e1..070bed82 100644
--- a/lib/dns/config/confcommon.c
+++ b/lib/dns/config/confcommon.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: confcommon.c,v 1.34 2000/08/01 01:23:16 tale Exp $ */
+/* $Id: confcommon.c,v 1.35 2000/12/07 01:45:52 brister Exp $ */
#include <config.h>
@@ -652,6 +652,29 @@ dns_c_peerlist_print(FILE *fp, int indent,
return;
}
+isc_result_t
+dns_c_nameprint(dns_name_t *name, FILE *stream) {
+ isc_result_t result;
+ isc_buffer_t b;
+ isc_region_t r;
+ char t[1024];
+
+ /*
+ * Print 'name' on 'stream'.
+ */
+
+ REQUIRE(ISC_MAGIC_VALID(name, DNS_NAME_MAGIC));
+
+ isc_buffer_init(&b, t, sizeof(t));
+ result = dns_name_totext(name, ISC_TRUE, &b);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+ isc_buffer_usedregion(&b, &r);
+ fprintf(stream, "%.*s", (int)r.length, (char *)r.base);
+
+ return (ISC_R_SUCCESS);
+}
+
void
dns_c_peer_print(FILE *fp, int indent, dns_peer_t *peer) {
@@ -705,7 +728,7 @@ dns_c_peer_print(FILE *fp, int indent, dns_peer_t *peer) {
REQUIRE(name != NULL);
dns_c_printtabs(fp, indent + 1);
fprintf(fp, "keys { \"");
- dns_name_print(peer->key, fp);
+ dns_c_nameprint(peer->key, fp);
fprintf(fp, "\"; };\n");
}
diff --git a/lib/dns/config/confctl.c b/lib/dns/config/confctl.c
index 0ed27222..6c71cfff 100644
--- a/lib/dns/config/confctl.c
+++ b/lib/dns/config/confctl.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: confctl.c,v 1.30 2000/10/20 13:29:34 marka Exp $ */
+/* $Id: confctl.c,v 1.31 2000/12/06 20:36:00 gson Exp $ */
#include <config.h>
@@ -226,6 +226,8 @@ dns_c_ctrlunix_new(isc_mem_t *mem, dns_c_ctrl_t **control,
ctrl->keyidlist = NULL;
+ ISC_LINK_INIT(ctrl, next);
+
*control = ctrl;
return (ISC_R_SUCCESS);
diff --git a/lib/dns/config/confctx.c b/lib/dns/config/confctx.c
index bf8adb5b..97703586 100644
--- a/lib/dns/config/confctx.c
+++ b/lib/dns/config/confctx.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: confctx.c,v 1.109 2000/12/02 00:25:42 gson Exp $ */
+/* $Id: confctx.c,v 1.113 2000/12/13 00:15:18 tale Exp $ */
#include <config.h>
@@ -349,12 +349,6 @@ dns_c_checkconfig(dns_c_ctx_t *cfg)
"option 'named-xfer' is obsolete");
}
- if (dns_c_ctx_getdumpfilename(cfg, &cpval) != ISC_R_NOTFOUND) {
- isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
- DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
- "option 'dump-file' is not yet implemented");
- }
-
if (dns_c_ctx_getmemstatsfilename(cfg, &cpval) != ISC_R_NOTFOUND) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
@@ -528,6 +522,16 @@ dns_c_checkconfig(dns_c_ctx_t *cfg)
}
}
+ if (dns_c_ctx_getcachefile(cfg, &cpval) == ISC_R_SUCCESS &&
+ cfg->views != NULL)
+ {
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
+ DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
+ "option 'cachefile' cannot be present if views "
+ "are present");
+ result = ISC_R_FAILURE;
+ }
+
return (result);
}
@@ -866,10 +870,19 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options)
(unsigned long)(*options->FIELD / 60)); \
}
-#define PRINT_IF_EQUAL(VAL, STRVAL, FIELD, NAME) \
+#define PRINT_AS_DAYS(FIELD, NAME) \
if (options->FIELD != NULL) { \
dns_c_printtabs(fp, indent + 1); \
- fprintf(fp, "%s %s;\n", NAME, STRVAL); \
+ fprintf(fp, "%s %lu;\n",NAME, \
+ (unsigned long)(*options->FIELD / (24 * 60 * 60))); \
+ }
+
+#define PRINT_IF_EQUAL(VAL, STRVAL, FIELD, NAME) \
+ if (options->FIELD != NULL) { \
+ if ((*options->FIELD) == (VAL)) { \
+ dns_c_printtabs(fp, indent + 1); \
+ fprintf(fp, "%s %s;\n", NAME, STRVAL); \
+ } \
}
#define PRINT_AS_BOOLEAN(FIELD, NAME) \
@@ -902,7 +915,24 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options)
port = isc_sockaddr_getport(options->FIELD); \
\
dns_c_printtabs(fp, indent + 1); \
- fprintf(fp, NAME " address "); \
+ fprintf(fp, "%s ", NAME); \
+ \
+ dns_c_print_ipaddr(fp, options->FIELD); \
+ \
+ if (port == 0) { \
+ fprintf(fp, " port *"); \
+ } else { \
+ fprintf(fp, " port %d", port); \
+ } \
+ fprintf(fp, " ;\n"); \
+ }
+
+#define PRINT_QUERYSOURCE(FIELD, NAME) \
+ if (options->FIELD != NULL) { \
+ port = isc_sockaddr_getport(options->FIELD); \
+ \
+ dns_c_printtabs(fp, indent + 1); \
+ fprintf(fp, "%s address ", NAME); \
\
dns_c_print_ipaddr(fp, options->FIELD); \
\
@@ -950,6 +980,7 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options)
PRINT_CHAR_P(pid_filename, "pid-file");
PRINT_CHAR_P(stats_filename, "statistics-file");
PRINT_CHAR_P(memstats_filename, "memstatistics-file");
+ PRINT_CHAR_P(cache_filename, "cache-file");
PRINT_CHAR_P(named_xfer, "named-xfer");
PRINT_CHAR_P(random_device, "random-device");
PRINT_CHAR_P(random_seed_file, "random-seed-file");
@@ -977,14 +1008,13 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options)
PRINT_INTEGER(recursive_clients, "recursive-clients");
PRINT_INTEGER(min_roots, "min-roots");
PRINT_INTEGER(serial_queries, "serial-queries");
- PRINT_INTEGER(sig_valid_interval, "sig-validity-interval");
+ PRINT_AS_DAYS(sig_valid_interval, "sig-validity-interval");
PRINT_INTEGER(min_retry_time, "min-retry-time");
PRINT_INTEGER(max_retry_time, "max-retry-time");
PRINT_INTEGER(min_refresh_time, "min-refresh-time");
PRINT_INTEGER(max_refresh_time, "max-refresh-time");
-
PRINT_AS_SIZE_CLAUSE(max_cache_size, "max-cache-size");
PRINT_AS_SIZE_CLAUSE(data_size, "datasize");
@@ -1038,8 +1068,8 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options)
PRINT_IPANDPORT(transfer_source, "transfer-source");
PRINT_IPANDPORT(transfer_source_v6, "transfer-source-v6");
- PRINT_IPANDPORT(query_source, "query-source");
- PRINT_IPANDPORT(query_source_v6, "query-source-v6");
+ PRINT_QUERYSOURCE(query_source, "query-source");
+ PRINT_QUERYSOURCE(query_source_v6, "query-source-v6");
if (options->additional_data != NULL) {
dns_c_printtabs(fp, indent + 1);
@@ -1054,6 +1084,7 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options)
fprintf(fp, "\n");
+ PRINT_IPMLIST(queryacl, "allow-notify");
PRINT_IPMLIST(queryacl, "allow-query");
PRINT_IPMLIST(transferacl, "allow-transfer");
PRINT_IPMLIST(recursionacl, "allow-recursion");
@@ -1491,6 +1522,7 @@ dns_c_ctx_optionsnew(isc_mem_t *mem, dns_c_options_t **options)
opts->pid_filename = NULL;
opts->stats_filename = NULL;
opts->memstats_filename = NULL;
+ opts->cache_filename = NULL;
opts->named_xfer = NULL;
opts->random_device = NULL;
opts->random_seed_file = NULL;
@@ -1530,7 +1562,6 @@ dns_c_ctx_optionsnew(isc_mem_t *mem, dns_c_options_t **options)
opts->min_refresh_time = NULL;
opts->max_refresh_time = NULL;
-
opts->expert_mode = NULL;
opts->fake_iquery = NULL;
opts->recursion = NULL;
@@ -1576,6 +1607,7 @@ dns_c_ctx_optionsnew(isc_mem_t *mem, dns_c_options_t **options)
opts->transfer_format = NULL;
+ opts->notifyacl = NULL;
opts->queryacl = NULL;
opts->transferacl = NULL;
opts->recursionacl = NULL;
@@ -1638,6 +1670,7 @@ dns_c_ctx_optionsdelete(dns_c_options_t **opts)
FREESTRING(pid_filename);
FREESTRING(stats_filename);
FREESTRING(memstats_filename);
+ FREESTRING(cache_filename);
FREESTRING(named_xfer);
FREESTRING(random_device);
FREESTRING(random_seed_file);
@@ -1725,6 +1758,7 @@ dns_c_ctx_optionsdelete(dns_c_options_t **opts)
FREEFIELD(transfer_format);
+ FREEIPMLIST(notifyacl);
FREEIPMLIST(queryacl);
FREEIPMLIST(transferacl);
FREEIPMLIST(recursionacl);
@@ -1778,6 +1812,7 @@ STRING_FUNCS(dumpfilename, dump_filename)
STRING_FUNCS(pidfilename, pid_filename)
STRING_FUNCS(statsfilename, stats_filename)
STRING_FUNCS(memstatsfilename, memstats_filename)
+STRING_FUNCS(cachefile, cache_filename)
STRING_FUNCS(namedxfer, named_xfer)
STRING_FUNCS(randomdevice, random_device)
STRING_FUNCS(randomseedfile, random_seed_file)
@@ -1815,7 +1850,6 @@ UINT32_FUNCS(maxretrytime, max_retry_time)
UINT32_FUNCS(minrefreshtime, min_refresh_time)
UINT32_FUNCS(maxrefreshtime, max_refresh_time)
-
BOOL_FUNCS(expertmode, expert_mode)
BOOL_FUNCS(fakeiquery, fake_iquery)
BOOL_FUNCS(recursion, recursion)
@@ -2040,6 +2074,7 @@ dns_c_ctx_unsetchecknames(dns_c_ctx_t *cfg,
return (ISC_R_SUCCESS);
}
+IPMLIST_FUNCS(allownotify, notifyacl)
IPMLIST_FUNCS(allowquery, queryacl)
IPMLIST_FUNCS(allowtransfer, transferacl)
IPMLIST_FUNCS(allowrecursion, recursionacl)
diff --git a/lib/dns/config/confip.c b/lib/dns/config/confip.c
index 2354fbe1..4d4094cf 100644
--- a/lib/dns/config/confip.c
+++ b/lib/dns/config/confip.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: confip.c,v 1.37 2000/09/27 20:10:39 gson Exp $ */
+/* $Id: confip.c,v 1.38 2000/12/13 00:15:21 tale Exp $ */
#include <config.h>
@@ -778,6 +778,7 @@ isc_result_t
dns_c_iplist_new(isc_mem_t *mem, int length, dns_c_iplist_t **newlist) {
dns_c_iplist_t *list;
size_t bytes;
+ int i;
REQUIRE(mem != NULL);
REQUIRE(length > 0);
REQUIRE(newlist != NULL);
@@ -795,7 +796,15 @@ dns_c_iplist_new(isc_mem_t *mem, int length, dns_c_iplist_t **newlist) {
}
memset(list->ips, 0x0, bytes);
-
+ bytes = sizeof(dns_name_t *) * length;
+ list->keys = isc_mem_get(mem, bytes);
+ if (list->keys == NULL) {
+ isc_mem_put(mem, list->ips, sizeof(isc_sockaddr_t) * length);
+ isc_mem_put(mem, list, sizeof(*list));
+ return (ISC_R_NOMEMORY);
+ }
+ for (i = 0 ; i < length ; i++)
+ list->keys[i] = NULL;
list->magic = DNS_C_IPLIST_MAGIC;
list->size = length;
@@ -811,6 +820,7 @@ dns_c_iplist_new(isc_mem_t *mem, int length, dns_c_iplist_t **newlist) {
isc_result_t
dns_c_iplist_detach(dns_c_iplist_t **list) {
dns_c_iplist_t *l ;
+ unsigned int i;
REQUIRE(list != NULL);
@@ -824,6 +834,15 @@ dns_c_iplist_detach(dns_c_iplist_t **list) {
l->refcount--;
if (l->refcount == 0) {
+ for (i = 0 ; i < l->size ; i++) {
+ if (l->keys[i] != NULL) {
+ dns_name_free(l->keys[i], l->mem);
+ isc_mem_put(l->mem, l->keys[i],
+ sizeof(dns_name_t));
+ l->keys[i] = NULL;
+ }
+ }
+ isc_mem_put(l->mem, l->keys, sizeof(dns_name_t *) * l->size);
isc_mem_put(l->mem, l->ips, sizeof(isc_sockaddr_t) * l->size);
isc_mem_put(l->mem, l, sizeof(*l));
}
@@ -833,6 +852,21 @@ dns_c_iplist_detach(dns_c_iplist_t **list) {
return (ISC_R_SUCCESS);
}
+isc_boolean_t
+dns_c_iplist_haskeys(dns_c_iplist_t *list)
+{
+ unsigned int i;
+
+ if (list->keys == NULL)
+ return (ISC_FALSE);
+
+ for (i = 0 ; i < list->nextidx ; i++) {
+ if (list->keys[i] != NULL)
+ return (ISC_TRUE);
+ }
+
+ return (ISC_FALSE);
+}
void
dns_c_iplist_attach(dns_c_iplist_t *source, dns_c_iplist_t **target) {
@@ -858,6 +892,21 @@ dns_c_iplist_copy(isc_mem_t *mem, dns_c_iplist_t **dest, dns_c_iplist_t *src) {
for (i = 0 ; i < src->nextidx ; i++) {
newl->ips[i] = src->ips[i];
+ newl->keys[i] = NULL;
+ if (src->keys[i] != NULL) {
+ newl->keys[i] = isc_mem_get(mem, sizeof(dns_name_t));
+ if (newl->keys[i] == NULL) {
+ dns_c_iplist_detach(&newl);
+ return (ISC_R_NOMEMORY);
+ } else {
+ res = dns_name_dup(src->keys[i], mem,
+ newl->keys[i]);
+ if (res != ISC_R_SUCCESS) {
+ dns_c_iplist_detach(&newl);
+ return (res);
+ }
+ }
+ }
}
newl->nextidx = src->nextidx;
@@ -881,6 +930,13 @@ dns_c_iplist_equal(dns_c_iplist_t *list1, dns_c_iplist_t *list2) {
if (!isc_sockaddr_equal(&list1->ips[i], &list2->ips[i]))
return (ISC_FALSE);
+ if ((list1->keys[i] == NULL && list2->keys[i] != NULL) ||
+ (list1->keys[i] != NULL && list2->keys[i] == NULL))
+ return (ISC_FALSE);
+
+ if (list1->keys[i] != NULL &&
+ !dns_name_equal(list1->keys[i], list2->keys[i]))
+ return (ISC_FALSE);
}
return (ISC_TRUE);
@@ -930,6 +986,11 @@ dns_c_iplist_printfully(FILE *fp, int indent, isc_boolean_t porttoo,
fprintf(fp, " port %d",
isc_sockaddr_getport(&list->ips[i]));
}
+ if (list->keys[i] != NULL) {
+ fprintf(fp, " key \"");
+ dns_name_print(list->keys[i], fp);
+ fprintf(fp, "\" ");
+ }
fprintf(fp, ";\n");
}
dns_c_printtabs(fp, indent - 1);
@@ -945,7 +1006,9 @@ dns_c_iplist_print(FILE *fp, int indent, dns_c_iplist_t *list) {
}
isc_result_t
-dns_c_iplist_append(dns_c_iplist_t *list, isc_sockaddr_t newaddr) {
+dns_c_iplist_append(dns_c_iplist_t *list, isc_sockaddr_t newaddr,
+ const char *key)
+{
isc_uint32_t i;
isc_result_t res;
@@ -962,6 +1025,7 @@ dns_c_iplist_append(dns_c_iplist_t *list, isc_sockaddr_t newaddr) {
if (list->nextidx == list->size) {
isc_sockaddr_t *newlist;
+ dns_name_t **newkeys;
size_t newbytes;
size_t oldbytes = list->size * sizeof(list->ips[0]);
size_t newsize = list->size + 10;
@@ -977,6 +1041,21 @@ dns_c_iplist_append(dns_c_iplist_t *list, isc_sockaddr_t newaddr) {
isc_mem_put(list->mem, list->ips, oldbytes);
list->ips = newlist;
+ oldbytes = sizeof(dns_name_t *) * list->size;
+ newbytes = sizeof(dns_name_t *) * newsize;
+ newkeys = isc_mem_get(list->mem, newbytes);
+ if (newkeys == NULL)
+ return (ISC_R_NOMEMORY);
+
+ for (i = 0 ; i < list->size ; i++) {
+ newkeys[i] = list->keys[i];
+ list->keys[i] = NULL;
+ }
+ for (i = list->size ; i < newsize ; i++)
+ newkeys[i] = NULL;
+
+ isc_mem_put(list->mem, list->keys, oldbytes);
+ list->keys = newkeys;
i = list->size;
list->size = newsize;
@@ -987,6 +1066,16 @@ dns_c_iplist_append(dns_c_iplist_t *list, isc_sockaddr_t newaddr) {
res = ISC_R_SUCCESS;
+ if (key != NULL) {
+ if (list->keys[i] != NULL) {
+ dns_name_free(list->keys[i], list->mem);
+ isc_mem_put(list->mem, list->keys,
+ sizeof(dns_name_t));
+ list->keys[i] = NULL;
+ }
+
+ res = dns_c_charptoname(list->mem, key, &list->keys[i]);
+ }
return (res);
}
@@ -1011,9 +1100,14 @@ dns_c_iplist_remove(dns_c_iplist_t *list, isc_sockaddr_t newaddr) {
list->nextidx--;
+ if (list->keys[i] != NULL) {
+ dns_name_reset(list->keys[i]);
+ isc_mem_put(list->mem, list->keys[i], sizeof(dns_name_t));
+ }
for ( /* nothing */ ; i < list->nextidx ; i++) {
list->ips[i] = list->ips[i + 1];
+ list->keys[i] = list->keys[i + 1];
}
return (ISC_R_SUCCESS);
diff --git a/lib/dns/config/confkeys.c b/lib/dns/config/confkeys.c
index 0dc08a85..199c13e4 100644
--- a/lib/dns/config/confkeys.c
+++ b/lib/dns/config/confkeys.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: confkeys.c,v 1.29 2000/10/20 02:21:52 marka Exp $ */
+/* $Id: confkeys.c,v 1.30 2000/12/07 01:45:54 brister Exp $ */
#include <config.h>
@@ -797,6 +797,7 @@ dns_c_pubkey_new(isc_mem_t *mem, isc_uint32_t flags,
pkey->protocol = protocol;
pkey->algorithm = algorithm;
pkey->key = isc_mem_strdup(mem, key);
+ ISC_LINK_INIT(pkey, next);
if (pkey->key == NULL) {
isc_mem_put(mem, pkey, sizeof *pkey);
return (ISC_R_NOMEMORY);
diff --git a/lib/dns/config/confparser.y b/lib/dns/config/confparser.y
index 84525bd6..95e80faa 100644
--- a/lib/dns/config/confparser.y
+++ b/lib/dns/config/confparser.y
@@ -33,7 +33,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: confparser.y.dirty,v 1.36 2000/12/02 00:57:43 marka Exp $ */
+/* $Id: confparser.y.dirty,v 1.44 2000/12/20 03:36:19 marka Exp $ */
#include <config.h>
@@ -263,6 +263,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
%token L_ADDRESS
%token L_ALGID
%token L_ALLOW
+%token L_ALLOW_NOTIFY
%token L_ALLOW_QUERY
%token L_ALLOW_RECURSION
%token L_ALLOW_TRANSFER
@@ -273,7 +274,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
%token L_BANG
%token L_BLACKHOLE
%token L_BOGUS
-%token L_MAX_CACHE_SIZE
+%token L_CACHE_FILE
%token L_CATEGORY
%token L_CHANNEL
%token L_CHECK_NAMES
@@ -296,6 +297,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
%token L_END_INCLUDE
%token L_EOS
%token L_EXPERT_MODE
+%token L_EXPLICIT
%token L_FAIL
%token L_FAKE_IQUERY
%token L_FALSE
@@ -335,6 +337,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
%token L_MASTERS
%token L_MATCH_CLIENTS
%token L_MAXIMAL
+%token L_MAX_CACHE_SIZE
%token L_MAX_CACHE_TTL
%token L_MAX_LOG_SIZE_IXFR
%token L_MAX_NCACHE_TTL
@@ -433,7 +436,6 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
%token L_WILDCARD
%token L_YES
%token L_ZONE
-%token L_EXPLICIT
%type <addata> additional_data
@@ -487,6 +489,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
%type <text> channel_name
%type <text> domain_name
%type <text> key_value
+%type <text> maybe_key
%type <kidlist> control_keys
%type <kidlist> keyid_list
%type <searchlist> searchlist
@@ -783,6 +786,21 @@ option: /* Empty */
isc_mem_free(memctx, $2);
}
+ | L_CACHE_FILE L_QSTRING
+ {
+ tmpres = dns_c_ctx_setcachefile(currcfg, $2);
+ if (tmpres == ISC_R_EXISTS) {
+ parser_error(ISC_FALSE,
+ "cannot redefine cache-file");
+ YYABORT;
+ } else if (tmpres != ISC_R_SUCCESS) {
+ parser_error(ISC_FALSE, "set cachefile error %s: %s",
+ isc_result_totext(tmpres), $2);
+ YYABORT;
+ }
+
+ isc_mem_free(memctx, $2);
+ }
| L_EXPERT_MODE yea_or_nay
{
tmpres = dns_c_ctx_setexpertmode(currcfg, $2);
@@ -1161,6 +1179,23 @@ option: /* Empty */
YYABORT;
}
}
+ | L_ALLOW_NOTIFY L_LBRACE address_match_list L_RBRACE
+ {
+ if ($3 == NULL)
+ YYABORT;
+
+ tmpres = dns_c_ctx_setallownotify(currcfg, $3);
+ dns_c_ipmatchlist_detach(&$3);
+
+ if (tmpres == ISC_R_EXISTS) {
+ parser_error(ISC_FALSE,
+ "cannot redefine allow-notify list");
+ YYABORT;
+ } else if (tmpres != ISC_R_SUCCESS) {
+ parser_error(ISC_FALSE, "failed to set allow-notify");
+ YYABORT;
+ }
+ }
| L_ALLOW_QUERY L_LBRACE address_match_list L_RBRACE
{
if ($3 == NULL)
@@ -1278,7 +1313,7 @@ option: /* Empty */
}
| L_MAX_TRANSFER_TIME_IN L_INTEGER
{
- if ( int_too_big($2, 60) ) {
+ if (int_too_big($2, 60)) {
parser_error(ISC_FALSE,
"integer value too big: %u", $2);
YYABORT;
@@ -1311,7 +1346,7 @@ option: /* Empty */
}
| L_MAX_TRANSFER_TIME_OUT L_INTEGER
{
- if ( int_too_big($2, 60) ) {
+ if (int_too_big($2, 60)) {
parser_error(ISC_FALSE,
"integer value too big: %u", $2);
YYABORT;
@@ -1330,7 +1365,7 @@ option: /* Empty */
}
| L_MAX_TRANSFER_IDLE_IN L_INTEGER
{
- if ( int_too_big($2, 60) ) {
+ if (int_too_big($2, 60)) {
parser_error(ISC_FALSE,
"integer value too big: %u", $2);
YYABORT;
@@ -1349,7 +1384,7 @@ option: /* Empty */
}
| L_MAX_TRANSFER_IDLE_OUT L_INTEGER
{
- if ( int_too_big($2, 60) ) {
+ if (int_too_big($2, 60)) {
parser_error(ISC_FALSE,
"integer value too big: %u", $2);
YYABORT;
@@ -1381,7 +1416,13 @@ option: /* Empty */
}
| L_SIG_VALIDITY_INTERVAL L_INTEGER
{
- tmpres = dns_c_ctx_setsigvalidityinterval(currcfg, $2);
+ if (int_too_big($2, 60 * 60 * 24)) {
+ parser_error(ISC_FALSE,
+ "integer value too big: %u", $2);
+ YYABORT;
+ }
+ tmpres = dns_c_ctx_setsigvalidityinterval(currcfg,
+ $2 * 60 * 60 * 24);
if (tmpres == ISC_R_EXISTS) {
parser_error(ISC_FALSE,
"cannot redefine sig-validity-interval");
@@ -1444,7 +1485,7 @@ option: /* Empty */
}
| L_CLEAN_INTERVAL L_INTEGER
{
- if ( int_too_big($2, 60) ) {
+ if (int_too_big($2, 60)) {
parser_error(ISC_FALSE,
"integer value too big: %u", $2);
YYABORT;
@@ -1463,7 +1504,7 @@ option: /* Empty */
}
| L_INTERFACE_INTERVAL L_INTEGER
{
- if ( int_too_big($2, 60) ) {
+ if (int_too_big($2, 60)) {
parser_error(ISC_FALSE,
"integer value too big: %u", $2);
YYABORT;
@@ -1482,7 +1523,7 @@ option: /* Empty */
}
| L_STATS_INTERVAL L_INTEGER
{
- if ( int_too_big($2, 60) ) {
+ if (int_too_big($2, 60)) {
parser_error(ISC_FALSE,
"integer value too big: %u", $2);
YYABORT;
@@ -1592,7 +1633,7 @@ option: /* Empty */
}
| L_HEARTBEAT L_INTEGER
{
- if ( int_too_big($2, 60) ) {
+ if (int_too_big($2, 60)) {
parser_error(ISC_FALSE,
"integer value too big: %u", $2);
YYABORT;
@@ -1869,6 +1910,14 @@ transfer_format: L_ONE_ANSWER
}
;
+maybe_key: /* nothing */
+ {
+ $$ = NULL;
+ }
+ | L_SEC_KEY any_string
+ {
+ $$ = $2;
+ };
maybe_wild_addr: ip4_address
| ip6_address
@@ -1972,7 +2021,7 @@ ip_and_port_element: ip_address maybe_zero_port
};
-ip_and_port_list: ip_and_port_element L_EOS
+ip_and_port_list: ip_and_port_element maybe_key L_EOS
{
dns_c_iplist_t *list;
@@ -1983,25 +2032,31 @@ ip_and_port_list: ip_and_port_element L_EOS
YYABORT;
}
- tmpres = dns_c_iplist_append(list, $1);
+ tmpres = dns_c_iplist_append(list, $1, $2);
if (tmpres != ISC_R_SUCCESS) {
parser_error(ISC_TRUE,
"failed to append master address");
YYABORT;
}
+ if ($2 != NULL) {
+ isc_mem_free(memctx, $2);
+ }
$$ = list;
}
- | ip_and_port_list ip_and_port_element L_EOS
+ | ip_and_port_list ip_and_port_element maybe_key L_EOS
{
- tmpres = dns_c_iplist_append($1, $2);
+ tmpres = dns_c_iplist_append($1, $2, $3);
if (tmpres != ISC_R_SUCCESS) {
parser_error(ISC_TRUE,
"failed to append master address");
YYABORT;
}
+ if ($3 != NULL) {
+ isc_mem_free(memctx, $3);
+ }
$$ = $1;
}
@@ -2370,7 +2425,7 @@ forwarders_in_addr_list: forwarders_in_addr L_EOS
forwarders_in_addr: ip_address
{
tmpres = dns_c_iplist_append(currcfg->options->forwarders,
- $1);
+ $1, NULL);
if (tmpres != ISC_R_SUCCESS) {
parser_error(ISC_FALSE,
"failed to add forwarders "
@@ -3575,6 +3630,7 @@ secret: L_SECRET any_string L_EOS
view_stmt: L_VIEW any_string optional_class L_LBRACE
{
dns_c_view_t *view;
+ dns_rdataclass_t rdclass;
if (currcfg->views == NULL) {
tmpres = dns_c_viewtable_new(currcfg->mem,
@@ -3586,8 +3642,10 @@ view_stmt: L_VIEW any_string optional_class L_LBRACE
YYABORT;
}
}
+ rdclass = ($3 == dns_rdataclass_reserved0) ?
+ dns_rdataclass_in : $3;
- tmpres = dns_c_view_new(currcfg->mem, $2, $3, &view);
+ tmpres = dns_c_view_new(currcfg->mem, $2, rdclass, &view);
if (tmpres != ISC_R_SUCCESS) {
isc_mem_free(memctx, $2);
parser_error(ISC_FALSE,
@@ -3653,6 +3711,25 @@ view_option: L_FORWARD zone_forward_opt
YYABORT;
}
}
+ | L_ALLOW_NOTIFY L_LBRACE address_match_list L_RBRACE
+ {
+ dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg);
+
+ INSIST(view != NULL);
+
+ tmpres = dns_c_view_setallownotify(view, $3);
+ dns_c_ipmatchlist_detach(&$3);
+
+ if (tmpres == ISC_R_EXISTS) {
+ parser_error(ISC_FALSE,
+ "cannot redefine view allow-notify");
+ YYABORT;
+ } else if (tmpres != ISC_R_SUCCESS) {
+ parser_error(ISC_FALSE,
+ "failed to set view allow-notify");
+ YYABORT;
+ }
+ }
| L_ALLOW_QUERY L_LBRACE address_match_list L_RBRACE
{
dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg);
@@ -4142,7 +4219,7 @@ view_option: L_FORWARD zone_forward_opt
INSIST(view != NULL);
- if ( int_too_big($2, 60) ) {
+ if (int_too_big($2, 60)) {
parser_error(ISC_FALSE,
"integer value too big: %u", $2);
YYABORT;
@@ -4167,7 +4244,7 @@ view_option: L_FORWARD zone_forward_opt
INSIST(view != NULL);
- if ( int_too_big($2, 60) ) {
+ if (int_too_big($2, 60)) {
parser_error(ISC_FALSE,
"integer value too big: %u", $2);
YYABORT;
@@ -4192,7 +4269,7 @@ view_option: L_FORWARD zone_forward_opt
INSIST(view != NULL);
- if ( int_too_big($2, 60) ) {
+ if (int_too_big($2, 60)) {
parser_error(ISC_FALSE,
"integer value too big: %u", $2);
YYABORT;
@@ -4352,7 +4429,13 @@ view_option: L_FORWARD zone_forward_opt
INSIST(view != NULL);
- tmpres = dns_c_view_setsigvalidityinterval(view, $2);
+ if (int_too_big($2, 60 * 60 * 24)) {
+ parser_error(ISC_FALSE,
+ "integer value too big: %u", $2);
+ YYABORT;
+ }
+ tmpres = dns_c_view_setsigvalidityinterval(view,
+ $2 * 60 * 60 * 24);
if (tmpres == ISC_R_EXISTS) {
parser_error(ISC_FALSE,
"cannot redefine view "
@@ -4442,6 +4525,25 @@ view_option: L_FORWARD zone_forward_opt
YYABORT;
}
}
+ | L_CACHE_FILE L_QSTRING
+ {
+ dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg);
+
+ INSIST(view != NULL);
+
+ tmpres = dns_c_view_setcachefile(view, $2);
+ if (tmpres == ISC_R_EXISTS) {
+ parser_error(ISC_FALSE,
+ "cannot redefine cache-file");
+ YYABORT;
+ } else if (tmpres != ISC_R_SUCCESS) {
+ parser_error(ISC_FALSE, "set cachefile error %s: %s",
+ isc_result_totext(tmpres), $2);
+ YYABORT;
+ }
+
+ isc_mem_free(memctx, $2);
+ }
| key_stmt
| zone_stmt
| server_stmt
@@ -4699,6 +4801,8 @@ domain_name: L_QSTRING
zone_stmt: L_ZONE domain_name optional_class L_LBRACE L_TYPE zone_type L_EOS
{
dns_c_zone_t *zone;
+ dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg);
+ dns_rdataclass_t rdclass;
if (currcfg->zlist == NULL) {
tmpres = dns_c_zonelist_new(currcfg->mem,
@@ -4712,10 +4816,17 @@ zone_stmt: L_ZONE domain_name optional_class L_LBRACE L_TYPE zone_type L_EOS
YYABORT;
}
}
+ rdclass = $3;
+ if (rdclass == dns_rdataclass_reserved0) {
+ if (view != NULL)
+ (void)dns_c_view_getviewclass(view, &rdclass);
+ else
+ rdclass = dns_rdataclass_in;
+ }
/* XXX internal name support needed! */
tmpres = dns_c_zone_new(currcfg->mem,
- $6, $3, $2, $2, &zone);
+ $6, rdclass, $2, $2, &zone);
if (tmpres != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG,
@@ -4839,7 +4950,7 @@ wild_class_name: any_string
optional_class: /* Empty */
{
- $$ = dns_rdataclass_in;
+ $$ = dns_rdataclass_reserved0;
}
| class_name
;
@@ -4879,7 +4990,7 @@ zone_option_list: zone_option L_EOS
*/
zone_non_type_keywords: L_FILE | L_FILE_IXFR | L_IXFR_TMP | L_MASTERS |
L_TRANSFER_SOURCE | L_CHECK_NAMES | L_ALLOW_UPDATE |
- L_ALLOW_UPDATE_FORWARDING | L_ALLOW_QUERY |
+ L_ALLOW_UPDATE_FORWARDING | L_ALLOW_NOTIFY | L_ALLOW_QUERY |
L_ALLOW_TRANSFER | L_FORWARD | L_FORWARDERS | L_MAX_TRANSFER_TIME_IN |
L_TCP_CLIENTS | L_RECURSIVE_CLIENTS | L_UPDATE_POLICY | L_DENY |
L_MAX_TRANSFER_TIME_OUT | L_MAX_TRANSFER_IDLE_IN |
@@ -4887,8 +4998,7 @@ zone_non_type_keywords: L_FILE | L_FILE_IXFR | L_IXFR_TMP | L_MASTERS |
L_MAINTAIN_IXFR_BASE | L_PUBKEY | L_ALSO_NOTIFY | L_DIALUP |
L_ENABLE_ZONE | L_DATABASE | L_PORT | L_MIN_RETRY_TIME |
L_MAX_RETRY_TIME | L_MIN_REFRESH_TIME | L_MAX_REFRESH_TIME |
- L_ZONE_STATISTICS | L_NOTIFY_SOURCE |
- L_NOTIFY_SOURCE_V6
+ L_ZONE_STATISTICS | L_NOTIFY_SOURCE | L_NOTIFY_SOURCE_V6 |
;
@@ -5162,6 +5272,24 @@ zone_option: L_FILE L_QSTRING
YYABORT;
}
}
+ | L_ALLOW_NOTIFY L_LBRACE address_match_list L_RBRACE
+ {
+ dns_c_zone_t *zone = dns_c_ctx_getcurrzone(currcfg);
+
+ INSIST(zone != NULL);
+
+ tmpres = dns_c_zone_setallownotify(zone,
+ $3, ISC_FALSE);
+ if (tmpres == ISC_R_EXISTS) {
+ parser_error(ISC_FALSE,
+ "cannot redefine zone allow-notify");
+ YYABORT;
+ } else if (tmpres != ISC_R_SUCCESS) {
+ parser_error(ISC_FALSE,
+ "failed to set zone allow-notify");
+ YYABORT;
+ }
+ }
| L_ALLOW_QUERY L_LBRACE address_match_list L_RBRACE
{
dns_c_zone_t *zone = dns_c_ctx_getcurrzone(currcfg);
@@ -5253,7 +5381,7 @@ zone_option: L_FILE L_QSTRING
INSIST(zone != NULL);
- if ( int_too_big($2, 60) ) {
+ if (int_too_big($2, 60)) {
parser_error(ISC_FALSE,
"integer value too big: %u", $2);
YYABORT;
@@ -5278,7 +5406,7 @@ zone_option: L_FILE L_QSTRING
INSIST(zone != NULL);
- if ( int_too_big($2, 60) ) {
+ if (int_too_big($2, 60)) {
parser_error(ISC_FALSE,
"integer value too big: %u", $2);
YYABORT;
@@ -5303,7 +5431,7 @@ zone_option: L_FILE L_QSTRING
INSIST(zone != NULL);
- if ( int_too_big($2, 60) ) {
+ if (int_too_big($2, 60)) {
parser_error(ISC_FALSE,
"integer value too big: %u", $2);
YYABORT;
@@ -5328,7 +5456,7 @@ zone_option: L_FILE L_QSTRING
INSIST(zone != NULL);
- if ( int_too_big($2, 60) ) {
+ if (int_too_big($2, 60)) {
parser_error(ISC_FALSE,
"integer value too big: %u", $2);
YYABORT;
@@ -5353,7 +5481,13 @@ zone_option: L_FILE L_QSTRING
INSIST(zone != NULL);
- tmpres = dns_c_zone_setsigvalidityinterval(zone, $2);
+ if (int_too_big($2, 60 * 60 * 24)) {
+ parser_error(ISC_FALSE,
+ "integer value too big: %u", $2);
+ YYABORT;
+ }
+ tmpres = dns_c_zone_setsigvalidityinterval(zone,
+ $2 * 60 * 60 * 24);
if (tmpres == ISC_R_EXISTS) {
parser_error(ISC_FALSE,
"cannot redefine zone "
@@ -5659,7 +5793,7 @@ in_addr_list: in_addr_elem L_EOS
YYABORT;
}
- tmpres = dns_c_iplist_append(list, $1);
+ tmpres = dns_c_iplist_append(list, $1, NULL);
if (tmpres != ISC_R_SUCCESS) {
parser_error(ISC_TRUE,
"failed to append master address");
@@ -5670,7 +5804,7 @@ in_addr_list: in_addr_elem L_EOS
}
| in_addr_list in_addr_elem L_EOS
{
- tmpres = dns_c_iplist_append($1, $2);
+ tmpres = dns_c_iplist_append($1, $2, NULL);
if (tmpres != ISC_R_SUCCESS) {
parser_error(ISC_TRUE,
"failed to append master address");
@@ -5844,8 +5978,12 @@ lwres_option: L_LISTEN_ON port_ip_list
| L_VIEW any_string optional_class
{
dns_c_lwres_t *lwres;
+ dns_rdataclass_t rdclass;
+
lwres = ISC_LIST_TAIL(currcfg->lwres->lwreslist);
- tmpres = dns_c_lwres_setview(lwres, $2, $3);
+ rdclass = ($3 == dns_rdataclass_reserved0) ?
+ dns_rdataclass_in : $3;
+ tmpres = dns_c_lwres_setview(lwres, $2, rdclass);
if (tmpres == ISC_R_EXISTS) {
parser_error(ISC_FALSE, "cannot redefine view");
YYABORT;
@@ -5952,6 +6090,7 @@ static struct token keyword_tokens [] = {
{ "address", L_ADDRESS },
{ "algorithm", L_ALGID },
{ "allow", L_ALLOW },
+ { "allow-notify", L_ALLOW_NOTIFY },
{ "allow-query", L_ALLOW_QUERY },
{ "allow-recursion", L_ALLOW_RECURSION },
{ "allow-transfer", L_ALLOW_TRANSFER },
@@ -5961,6 +6100,7 @@ static struct token keyword_tokens [] = {
{ "auth-nxdomain", L_AUTH_NXDOMAIN },
{ "blackhole", L_BLACKHOLE },
{ "bogus", L_BOGUS },
+ { "cache-file", L_CACHE_FILE },
{ "category", L_CATEGORY },
{ "channel", L_CHANNEL },
{ "check-names", L_CHECK_NAMES },
@@ -6350,36 +6490,13 @@ yylex(void)
res = 0;
break;
- case ISC_R_UNBALANCED:
- parser_error(ISC_TRUE,
- "%s: %lu: unbalanced parentheses",
- isc_lex_getsourcename(mylexer),
- isc_lex_getsourceline(mylexer));
- res = -1;
- break;
-
case ISC_R_NOSPACE:
- parser_error(ISC_TRUE,
- "%s: %lu: token too big",
- isc_lex_getsourcename(mylexer),
- isc_lex_getsourceline(mylexer));
- res = -1;
- break;
-
- case ISC_R_UNEXPECTEDEND:
- parser_error(ISC_TRUE,
- "%s: %lu: unexpected EOF",
- isc_lex_getsourcename(mylexer),
- isc_lex_getsourceline(mylexer));
+ parser_error(ISC_TRUE, "token too big");
res = -1;
break;
default:
- parser_error(ISC_TRUE,
- "%s: %lu unknown lexer error (%d)",
- isc_lex_getsourcename(mylexer),
- isc_lex_getsourceline(mylexer),
- (int)res);
+ parser_error(ISC_TRUE, "%s", isc_result_totext(res));
res = -1;
break;
}
@@ -6397,6 +6514,7 @@ static char *
token_to_text(int token, YYSTYPE lval) {
static char buffer[1024];
const char *tk;
+ const char *p;
/*
* Yacc keeps token numbers above 128, it seems.
@@ -6404,6 +6522,8 @@ token_to_text(int token, YYSTYPE lval) {
if (token < 128) {
if (token == 0)
strncpy(buffer, "<end of file>", sizeof buffer);
+ else if (token < 0)
+ strncpy(buffer, "<invalid token>", sizeof buffer);
else
if ((unsigned int) sprintf(buffer, "'%c'", token)
>= sizeof buffer) {
@@ -6426,32 +6546,49 @@ token_to_text(int token, YYSTYPE lval) {
}
break;
case L_IP6ADDR:
- strcpy(buffer, "UNAVAILABLE-IPV6-ADDRESS");
- inet_ntop(AF_INET6, lval.ip6_addr.s6_addr,
- buffer, sizeof buffer);
+ p = inet_ntop(AF_INET6, lval.ip6_addr.s6_addr,
+ &buffer[1], (sizeof buffer) - 2);
+ if (p == NULL)
+ strcpy(buffer, "UNAVAILABLE-IPV6-ADDRESS");
+ else {
+ buffer[0] = '\'';
+ strcat(buffer, "'");
+ }
break;
case L_IP4ADDR:
- strcpy(buffer, "UNAVAILABLE-IPV4-ADDRESS");
- inet_ntop(AF_INET, &lval.ip4_addr.s_addr,
- buffer, sizeof buffer);
+ p = inet_ntop(AF_INET, &lval.ip4_addr.s_addr,
+ &buffer[1], (sizeof buffer) - 2);
+ if (p == NULL)
+ strcpy(buffer, "UNAVAILABLE-IPV4-ADDRESS");
+ else {
+ buffer[0] = '\'';
+ strcat(buffer, "'");
+ }
break;
case L_IP4PREFIX: {
int i;
- strcpy(buffer, "UNAVAILABLE-IPV4-ADDRESS");
- inet_ntop(AF_INET, &lval.ip4_addr.s_addr,
- buffer, sizeof buffer);
- /*
- * Remove trailing zeros added in. We may remove too
- * many but we need to remove at least one.
- */
- for (i = 0; i < 3; i++)
- if (strcmp(&buffer[strlen(buffer) - 2],
- ".0") == 0)
- buffer[strlen(buffer) - 2] = '\0';
+ p = inet_ntop(AF_INET, &lval.ip4_addr.s_addr,
+ &buffer[1], (sizeof buffer) - 2);
+ if (p == NULL)
+ strcpy(buffer, "UNAVAILABLE-IPV4-ADDRESS");
+ else {
+ buffer[0] = '\'';
+ /*
+ * Remove trailing zeros added in. We may
+ * remove too many but we need to remove at
+ * least one.
+ */
+ for (i = 0; i < 3; i++)
+ if (strcmp(&buffer[strlen(buffer) - 2],
+ ".0") == 0)
+ buffer[strlen(buffer) - 2] =
+ '\0';
+ strcat(buffer, "'");
+ }
break;
}
case L_INTEGER:
- sprintf(buffer, "%lu", (unsigned long)lval.ul_int);
+ sprintf(buffer, "'%lu'", (unsigned long)lval.ul_int);
break;
case L_END_INCLUDE:
strcpy (buffer, "<end of include>");
@@ -6519,10 +6656,10 @@ parser_complain(isc_boolean_t is_warning, isc_boolean_t print_last_token,
if (dns_lctx != NULL) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, level,
- "%s%s near '%s'", where, message,
+ "%s%s near %s", where, message,
token_to_text(lasttoken, lastyylval));
} else {
- fprintf(stderr, "%s%s near '%s'\n", where, message,
+ fprintf(stderr, "%s%s near %s\n", where, message,
token_to_text(lasttoken, lastyylval));
}
} else {
diff --git a/lib/dns/config/confview.c b/lib/dns/config/confview.c
index b272401e..9e38aaad 100644
--- a/lib/dns/config/confview.c
+++ b/lib/dns/config/confview.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: confview.c,v 1.62 2000/12/01 23:27:42 marka Exp $ */
+/* $Id: confview.c,v 1.66 2000/12/13 00:15:24 tale Exp $ */
#include <config.h>
@@ -143,6 +143,8 @@ PVT_CONCAT(dns_c_view_unset, FUNCNAME)(dns_c_view_t *view) { \
} \
}
+
+
#define BYTYPE_FUNCS(TYPE, FUNC, FIELD) \
SETBYTYPE(TYPE, FUNC, FIELD) \
GETBYTYPE(TYPE, FUNC, FIELD) \
@@ -210,6 +212,64 @@ PVT_CONCAT(dns_c_view_get, FUNCNAME)(dns_c_view_t *view, \
UNSETIPMLIST(FUNC, FIELD)
+#define SETSTRING(FUNC, FIELD) \
+isc_result_t \
+PVT_CONCAT(dns_c_view_set, FUNC)(dns_c_view_t *view, const char *newval) \
+{ \
+ char *p = NULL; \
+ \
+ REQUIRE(DNS_C_VIEW_VALID(view)); \
+ REQUIRE(newval != NULL); \
+ REQUIRE(*newval != '\0'); \
+ \
+ if (newval != NULL) { \
+ p = isc_mem_strdup(view->mem, newval); \
+ if (p == NULL) \
+ return (ISC_R_NOMEMORY); \
+ } \
+ if (view->FIELD != NULL) { \
+ isc_mem_free(view->mem, view->FIELD); \
+ view->FIELD = NULL; \
+ } \
+ view->FIELD = p; \
+ return (ISC_R_SUCCESS); \
+}
+
+
+#define GETSTRING(FUNC, FIELD) \
+isc_result_t \
+PVT_CONCAT(dns_c_view_get, FUNC)(dns_c_view_t *view, char **retval) \
+{ \
+ REQUIRE(DNS_C_VIEW_VALID(view)); \
+ REQUIRE(retval != NULL); \
+ \
+ *retval = view->FIELD; \
+ \
+ return (*retval == NULL ? ISC_R_NOTFOUND : ISC_R_SUCCESS); \
+}
+
+
+#define UNSETSTRING(FUNC, FIELD) \
+isc_result_t \
+PVT_CONCAT(dns_c_view_unset, FUNC)(dns_c_view_t *view) \
+{ \
+ REQUIRE(DNS_C_VIEW_VALID(view)); \
+ \
+ if (view->FIELD == NULL) { \
+ return (ISC_R_NOTFOUND); \
+ } \
+ \
+ isc_mem_free(view->mem, view->FIELD); \
+ view->FIELD = NULL; \
+ \
+ return (ISC_R_SUCCESS); \
+}
+
+#define STRING_FUNCS(FUNC, FIELD) \
+ SETSTRING(FUNC, FIELD) \
+ GETSTRING(FUNC, FIELD) \
+ UNSETSTRING(FUNC, FIELD)
+
isc_result_t
dns_c_viewtable_new(isc_mem_t *mem, dns_c_viewtable_t **viewtable) {
dns_c_viewtable_t *table;
@@ -470,6 +530,7 @@ dns_c_view_new(isc_mem_t *mem, const char *name, dns_rdataclass_t viewclass,
view->forwarders = NULL;
view->also_notify = NULL;
+ view->allownotify = NULL;
view->allowquery = NULL;
view->allowupdateforwarding = NULL;
view->transferacl = NULL;
@@ -526,6 +587,8 @@ dns_c_view_new(isc_mem_t *mem, const char *name, dns_rdataclass_t viewclass,
view->trusted_keys = NULL;
+ view->cache_file = NULL;
+
#if 0
view->max_transfer_time_in = NULL;
view->max_transfer_idle_in = NULL;
@@ -563,7 +626,24 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view) {
port = isc_sockaddr_getport(view->FIELD); \
\
dns_c_printtabs(fp, indent + 1); \
- fprintf(fp, NAME " address "); \
+ fprintf(fp, "%s ", NAME); \
+ \
+ dns_c_print_ipaddr(fp, view->FIELD); \
+ \
+ if (port == 0) { \
+ fprintf(fp, " port *"); \
+ } else { \
+ fprintf(fp, " port %d", port); \
+ } \
+ fprintf(fp, " ;\n"); \
+ }
+
+#define PRINT_QUERYSOURCE(FIELD, NAME) \
+ if (view->FIELD != NULL) { \
+ port = isc_sockaddr_getport(view->FIELD); \
+ \
+ dns_c_printtabs(fp, indent + 1); \
+ fprintf(fp, "%s address ", NAME); \
\
dns_c_print_ipaddr(fp, view->FIELD); \
\
@@ -610,6 +690,7 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view) {
fputs("no", fp); \
else \
fputs("explicit", fp); \
+ fprintf(fp, ";\n"); \
}
#define PRINT_AS_DIALUPTYPE(FIELD, NAME) \
@@ -644,6 +725,13 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view) {
(unsigned long)(*view->FIELD / 60)); \
}
+#define PRINT_AS_DAYS(FIELD, NAME) \
+ if (view->FIELD != NULL) { \
+ dns_c_printtabs(fp, indent + 1); \
+ fprintf(fp, "%s %lu;\n",NAME, \
+ (unsigned long)(*view->FIELD / (24 * 60 * 60))); \
+ }
+
#define PRINT_AS_SIZE_CLAUSE(FIELD, NAME) \
if (view->FIELD != NULL) { \
dns_c_printtabs(fp, indent + 1); \
@@ -679,6 +767,7 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view) {
fprintf(fp, ";\n");
}
+ PRINT_IPMLIST(allownotify, "allow-notify");
PRINT_IPMLIST(allowquery, "allow-query");
PRINT_IPMLIST(allowupdateforwarding, "allow-update-forwarding");
PRINT_IPMLIST(transferacl, "alllow-transfer");
@@ -737,8 +826,8 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view) {
PRINT_IPANDPORT(transfer_source, "transfer-source");
PRINT_IPANDPORT(transfer_source_v6, "transfer-source-v6");
- PRINT_IPANDPORT(query_source, "query-source");
- PRINT_IPANDPORT(query_source_v6, "query-source-v6");
+ PRINT_QUERYSOURCE(query_source, "query-source");
+ PRINT_QUERYSOURCE(query_source_v6, "query-source-v6");
PRINT_AS_MINUTES(max_transfer_time_out, "max-transfer-time-out");
PRINT_AS_MINUTES(max_transfer_idle_out, "max-transfer-idle-out");
@@ -748,14 +837,13 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view) {
PRINT_INT32(lamettl, "lame-ttl");
PRINT_INT32(max_ncache_ttl, "max-ncache-ttl");
PRINT_INT32(max_cache_ttl, "max-cache-ttl");
- PRINT_INT32(sig_valid_interval, "sig-validity-interval");
+ PRINT_AS_DAYS(sig_valid_interval, "sig-validity-interval");
PRINT_INT32(min_retry_time, "min-retry-time");
PRINT_INT32(max_retry_time, "max-retry-time");
PRINT_INT32(min_refresh_time, "min-refresh-time");
PRINT_INT32(max_refresh_time, "max-refresh-time");
-
PRINT_AS_SIZE_CLAUSE(max_cache_size, "max-cache-size");
if (view->additional_data != NULL) {
@@ -850,6 +938,7 @@ dns_c_view_delete(dns_c_view_t **viewptr) {
dns_c_iplist_detach(&view->also_notify);
}
+ FREEIPMLIST(allownotify);
FREEIPMLIST(allowquery);
FREEIPMLIST(allowupdateforwarding);
FREEIPMLIST(transferacl);
@@ -910,6 +999,8 @@ dns_c_view_delete(dns_c_view_t **viewptr) {
dns_c_view_unsettrustedkeys(view);
+ dns_c_view_unsetcachefile(view);
+
#if 0
FREEFIELD(max_transfer_time_in);
FREEFIELD(max_transfer_idle_in);
@@ -1494,6 +1585,7 @@ dns_c_view_settrustedkeys(dns_c_view_t *view, dns_c_tkeylist_t *newval,
**
*/
+IPMLIST_FUNCS(allownotify, allownotify)
IPMLIST_FUNCS(allowquery, allowquery)
IPMLIST_FUNCS(allowupdateforwarding, allowupdateforwarding)
IPMLIST_FUNCS(transferacl, transferacl)
@@ -1524,6 +1616,8 @@ SOCKADDR_FUNCS(transfersourcev6, transfer_source_v6)
SOCKADDR_FUNCS(querysource, query_source)
SOCKADDR_FUNCS(querysourcev6, query_source_v6)
+STRING_FUNCS(cachefile, cache_file)
+
UINT32_FUNCS(maxtransfertimeout, max_transfer_time_out)
UINT32_FUNCS(maxtransferidleout, max_transfer_idle_out)
UINT32_FUNCS(cleaninterval, clean_interval)
@@ -1539,7 +1633,6 @@ UINT32_FUNCS(maxretrytime, max_retry_time)
UINT32_FUNCS(minrefreshtime, min_refresh_time)
UINT32_FUNCS(maxrefreshtime, max_refresh_time)
-
BYTYPE_FUNCS(dns_c_addata_t, additionaldata, additional_data)
BYTYPE_FUNCS(dns_transfer_format_t, transferformat, transfer_format)
diff --git a/lib/dns/config/confzone.c b/lib/dns/config/confzone.c
index 7634bef9..a3bee14e 100644
--- a/lib/dns/config/confzone.c
+++ b/lib/dns/config/confzone.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: confzone.c,v 1.70 2000/12/01 19:50:51 gson Exp $ */
+/* $Id: confzone.c,v 1.72 2000/12/13 00:15:26 tale Exp $ */
#include <config.h>
@@ -42,6 +42,7 @@
#define MZ_MAX_TRANS_TIME_OUT_BIT 6
#define MZ_MAX_TRANS_IDLE_OUT_BIT 7
#define MZ_SIG_VALID_INTERVAL_BIT 8
+/* #define unused 9 */
#define MZ_MIN_RETRY_TIME_BIT 10
#define MZ_MAX_RETRY_TIME_BIT 11
#define MZ_MIN_REFRESH_TIME_BIT 12
@@ -68,6 +69,7 @@
#define SZ_MAINT_IXFR_BASE_BIT 10
#define SZ_MAX_IXFR_LOG_BIT 11
#define SZ_FORWARD_BIT 12
+/* #define unused 13 */
#define SZ_MIN_RETRY_TIME_BIT 14
#define SZ_MAX_RETRY_TIME_BIT 15
#define SZ_MIN_REFRESH_TIME_BIT 16
@@ -1230,11 +1232,115 @@ dns_c_zone_getssuauth(dns_c_zone_t *zone, dns_ssutable_t **retval) {
}
+isc_result_t
+dns_c_zone_setallownotify(dns_c_zone_t *zone,
+ dns_c_ipmatchlist_t *ipml,
+ isc_boolean_t deepcopy)
+{
+ dns_c_ipmatchlist_t **p = NULL;
+ isc_boolean_t existed;
+ isc_result_t res;
+
+ REQUIRE(DNS_C_ZONE_VALID(zone));
+ REQUIRE(DNS_C_IPMLIST_VALID(ipml));
+
+ switch (zone->ztype) {
+ case dns_c_zone_master:
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
+ DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL,
+ "master zones do not have an allow_notify field");
+ return (ISC_R_FAILURE);
+
+ case dns_c_zone_slave:
+ p = &zone->u.szone.allow_notify;
+ break;
+
+ case dns_c_zone_stub:
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
+ DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL,
+ "stub zones do not have an allow_notify field");
+ return (ISC_R_FAILURE);
+
+ case dns_c_zone_hint:
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
+ DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL,
+ "hint zones do not have an allow_notify field");
+ return (ISC_R_FAILURE);
+
+ case dns_c_zone_forward:
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
+ DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL,
+ "forward zones do not have an "
+ "allow_notify field");
+ return (ISC_R_FAILURE);
+ }
+
+ existed = (*p != NULL ? ISC_TRUE : ISC_FALSE);
+
+ res = set_ipmatch_list_field(zone->mem, p,
+ ipml, deepcopy);
+ if (res == ISC_R_SUCCESS && existed) {
+ res = ISC_R_EXISTS;
+ }
+
+ return (res);
+}
+
+
/*
*
*/
isc_result_t
+dns_c_zone_getallownotify(dns_c_zone_t *zone, dns_c_ipmatchlist_t **retval) {
+ dns_c_ipmatchlist_t *p = NULL;
+ isc_result_t res;
+
+ REQUIRE(DNS_C_ZONE_VALID(zone));
+ REQUIRE(retval != NULL);
+
+ switch (zone->ztype) {
+ case dns_c_zone_master:
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
+ DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL,
+ "master zones do not have an allow_notify field");
+ return (ISC_R_FAILURE);
+
+ case dns_c_zone_slave:
+ p = zone->u.szone.allow_notify;
+ break;
+
+ case dns_c_zone_stub:
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
+ DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL,
+ "stub zones do not have an allow_notify field");
+ return (ISC_R_FAILURE);
+
+ case dns_c_zone_hint:
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
+ DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL,
+ "hint zones do not have an allow_notify field");
+ return (ISC_R_FAILURE);
+
+ case dns_c_zone_forward:
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
+ DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL,
+ "forward zones do not have an "
+ "allow_notify field");
+ return (ISC_R_FAILURE);
+ }
+
+ if (p != NULL) {
+ dns_c_ipmatchlist_attach(p, retval);
+ res = ISC_R_SUCCESS;
+ } else {
+ res = ISC_R_NOTFOUND;
+ }
+
+ return (res);
+}
+
+isc_result_t
dns_c_zone_setallowquery(dns_c_zone_t *zone,
dns_c_ipmatchlist_t *ipml,
isc_boolean_t deepcopy)
@@ -3935,9 +4041,6 @@ dns_c_zone_getmaxrefreshtime(dns_c_zone_t *zone, isc_uint32_t *retval) {
return (res);
}
-
-
-
/*
*
*/
@@ -4737,7 +4840,7 @@ master_zone_print(FILE *fp, int indent, dns_c_masterzone_t *mzone) {
if (DNS_C_CHECKBIT(MZ_SIG_VALID_INTERVAL_BIT, &mzone->setflags)) {
dns_c_printtabs(fp, indent);
fprintf(fp, "sig-validity-interval %d;\n",
- mzone->sig_valid_interval);
+ mzone->sig_valid_interval / (60 * 60 * 24));
}
if (DNS_C_CHECKBIT(MZ_MIN_RETRY_TIME_BIT, &mzone->setflags)) {
@@ -4760,7 +4863,6 @@ master_zone_print(FILE *fp, int indent, dns_c_masterzone_t *mzone) {
fprintf(fp, "max-refresh-time %d;\n", mzone->max_refresh_time);
}
-
if (mzone->pubkeylist != NULL) {
fprintf(fp, "\n");
dns_c_pklist_print(fp, indent, mzone->pubkeylist);
@@ -4872,6 +4974,14 @@ slave_zone_print(FILE *fp, int indent, dns_c_slavezone_t *szone) {
fprintf(fp, ";\n");
}
+ if (szone->allow_notify != NULL &&
+ !ISC_LIST_EMPTY(szone->allow_notify->elements)) {
+ dns_c_printtabs(fp, indent);
+ fprintf(fp, "allow-notify ");
+ dns_c_ipmatchlist_print(fp, indent + 1,
+ szone->allow_notify);
+ fprintf(fp, ";\n");
+ }
if (szone->allow_query != NULL &&
!ISC_LIST_EMPTY(szone->allow_query->elements)) {
@@ -5283,6 +5393,7 @@ slave_zone_init(dns_c_slavezone_t *szone) {
szone->master_ips = NULL;
szone->allow_update = NULL;
szone->allow_update_forwarding = NULL;
+ szone->allow_notify = NULL;
szone->allow_query = NULL;
szone->allow_transfer = NULL;
szone->also_notify = NULL;
@@ -5483,6 +5594,8 @@ slave_zone_clear(isc_mem_t *mem, dns_c_slavezone_t *szone) {
if (szone->allow_update_forwarding != NULL)
dns_c_ipmatchlist_detach(&szone->allow_update_forwarding);
+ if (szone->allow_notify != NULL)
+ dns_c_ipmatchlist_detach(&szone->allow_notify);
if (szone->allow_query != NULL)
dns_c_ipmatchlist_detach(&szone->allow_query);
diff --git a/lib/dns/diff.c b/lib/dns/diff.c
new file mode 100644
index 00000000..2a37a2b1
--- /dev/null
+++ b/lib/dns/diff.c
@@ -0,0 +1,530 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * 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 INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM 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.
+ */
+
+/* $Id: diff.c,v 1.3 2000/12/11 19:24:04 bwelling Exp $ */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <isc/buffer.h>
+#include <isc/file.h>
+#include <isc/mem.h>
+#include <isc/string.h>
+#include <isc/util.h>
+
+#include <dns/db.h>
+#include <dns/diff.h>
+#include <dns/log.h>
+#include <dns/rdatalist.h>
+#include <dns/rdataset.h>
+#include <dns/result.h>
+
+#define CHECK(op) \
+ do { result = (op); \
+ if (result != ISC_R_SUCCESS) goto failure; \
+ } while (0)
+
+#define DIFF_COMMON_LOGARGS \
+ dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_DIFF
+
+static dns_rdatatype_t
+rdata_covers(dns_rdata_t *rdata) {
+ return (rdata->type == dns_rdatatype_sig ?
+ dns_rdata_covers(rdata) : 0);
+}
+
+isc_result_t
+dns_difftuple_create(isc_mem_t *mctx,
+ dns_diffop_t op, dns_name_t *name, dns_ttl_t ttl,
+ dns_rdata_t *rdata, dns_difftuple_t **tp)
+{
+ dns_difftuple_t *t;
+ unsigned int size;
+ unsigned char *datap;
+
+ REQUIRE(tp != NULL && *tp == NULL);
+
+ /*
+ * Create a new tuple. The variable-size wire-format name data and
+ * rdata immediately follow the dns_difftuple_t structure
+ * in memory.
+ */
+ size = sizeof(*t) + name->length + rdata->length;
+ t = isc_mem_allocate(mctx, size);
+ if (t == NULL)
+ return (ISC_R_NOMEMORY);
+ t->mctx = mctx;
+ t->op = op;
+
+ datap = (unsigned char *)(t + 1);
+
+ memcpy(datap, name->ndata, name->length);
+ dns_name_init(&t->name, NULL);
+ dns_name_clone(name, &t->name);
+ t->name.ndata = datap;
+ datap += name->length;
+
+ t->ttl = ttl;
+
+ memcpy(datap, rdata->data, rdata->length);
+ dns_rdata_init(&t->rdata);
+ dns_rdata_clone(rdata, &t->rdata);
+ t->rdata.data = datap;
+ datap += rdata->length;
+
+ ISC_LINK_INIT(&t->rdata, link);
+ ISC_LINK_INIT(t, link);
+ t->magic = DNS_DIFFTUPLE_MAGIC;
+
+ INSIST(datap == (unsigned char *)t + size);
+
+ *tp = t;
+ return (ISC_R_SUCCESS);
+}
+
+void
+dns_difftuple_free(dns_difftuple_t **tp) {
+ dns_difftuple_t *t = *tp;
+ REQUIRE(DNS_DIFFTUPLE_VALID(t));
+ dns_name_invalidate(&t->name);
+ t->magic = 0;
+ isc_mem_free(t->mctx, t);
+ *tp = NULL;
+}
+
+isc_result_t
+dns_difftuple_copy(dns_difftuple_t *orig, dns_difftuple_t **copyp) {
+ return (dns_difftuple_create(orig->mctx, orig->op, &orig->name,
+ orig->ttl, &orig->rdata, copyp));
+}
+
+void
+dns_diff_init(isc_mem_t *mctx, dns_diff_t *diff) {
+ diff->mctx = mctx;
+ ISC_LIST_INIT(diff->tuples);
+ diff->magic = DNS_DIFF_MAGIC;
+}
+
+void
+dns_diff_clear(dns_diff_t *diff) {
+ dns_difftuple_t *t;
+ REQUIRE(DNS_DIFF_VALID(diff));
+ while ((t = ISC_LIST_HEAD(diff->tuples)) != NULL) {
+ ISC_LIST_UNLINK(diff->tuples, t, link);
+ dns_difftuple_free(&t);
+ }
+ ENSURE(ISC_LIST_EMPTY(diff->tuples));
+}
+
+void
+dns_diff_append(dns_diff_t *diff, dns_difftuple_t **tuplep)
+{
+ ISC_LIST_APPEND(diff->tuples, *tuplep, link);
+ *tuplep = NULL;
+}
+
+/* XXX this is O(N) */
+
+void
+dns_diff_appendminimal(dns_diff_t *diff, dns_difftuple_t **tuplep)
+{
+ dns_difftuple_t *ot, *next_ot;
+
+ REQUIRE(DNS_DIFF_VALID(diff));
+ REQUIRE(DNS_DIFFTUPLE_VALID(*tuplep));
+
+ /*
+ * Look for an existing tuple with the same owner name,
+ * rdata, and TTL. If we are doing an addition and find a
+ * deletion or vice versa, remove both the old and the
+ * new tuple since they cancel each other out (assuming
+ * that we never delete nonexistent data or add existing
+ * data).
+ *
+ * If we find an old update of the same kind as
+ * the one we are doing, there must be a programming
+ * error. We report it but try to continue anyway.
+ */
+ for (ot = ISC_LIST_HEAD(diff->tuples); ot != NULL;
+ ot = next_ot)
+ {
+ next_ot = ISC_LIST_NEXT(ot, link);
+ if (dns_name_equal(&ot->name, &(*tuplep)->name) &&
+ dns_rdata_compare(&ot->rdata, &(*tuplep)->rdata) == 0 &&
+ ot->ttl == (*tuplep)->ttl)
+ {
+ ISC_LIST_UNLINK(diff->tuples, ot, link);
+ if ((*tuplep)->op == ot->op) {
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "unexpected non-minimal diff");
+ } else {
+ dns_difftuple_free(tuplep);
+ }
+ dns_difftuple_free(&ot);
+ break;
+ }
+ }
+
+ if (*tuplep != NULL) {
+ ISC_LIST_APPEND(diff->tuples, *tuplep, link);
+ *tuplep = NULL;
+ }
+
+ ENSURE(*tuplep == NULL);
+}
+
+isc_result_t
+dns_diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver)
+{
+ dns_difftuple_t *t;
+ dns_dbnode_t *node = NULL;
+ isc_result_t result;
+
+ REQUIRE(DNS_DIFF_VALID(diff));
+ REQUIRE(DNS_DB_VALID(db));
+
+ t = ISC_LIST_HEAD(diff->tuples);
+ while (t != NULL) {
+ dns_name_t *name;
+
+ INSIST(node == NULL);
+ name = &t->name;
+ /*
+ * Find the node.
+ * We create the node if it does not exist.
+ * This will cause an empty node to be created if the diff
+ * contains a deletion of an RR at a nonexistent name,
+ * but such diffs should never be created in the first
+ * place.
+ */
+ node = NULL;
+ CHECK(dns_db_findnode(db, name, ISC_TRUE, &node));
+
+ while (t != NULL && dns_name_equal(&t->name, name)) {
+ dns_rdatatype_t type, covers;
+ dns_diffop_t op;
+ dns_rdatalist_t rdl;
+ dns_rdataset_t rds;
+
+ op = t->op;
+ type = t->rdata.type;
+ covers = rdata_covers(&t->rdata);
+
+ /*
+ * Collect a contiguous set of updates with
+ * the same operation (add/delete) and RR type
+ * into a single rdatalist so that the
+ * database rrset merging/subtraction code
+ * can work more efficiently than if each
+ * RR were merged into / subtracted from
+ * the database separately.
+ *
+ * This is done by linking rdata structures from the
+ * diff into "rdatalist". This uses the rdata link
+ * field, not the diff link field, so the structure
+ * of the diff itself is not affected.
+ */
+
+ rdl.type = type;
+ rdl.covers = covers;
+ rdl.rdclass = t->rdata.rdclass;
+ rdl.ttl = t->ttl;
+ ISC_LIST_INIT(rdl.rdata);
+ ISC_LINK_INIT(&rdl, link);
+
+ while (t != NULL &&
+ dns_name_equal(&t->name, name) &&
+ t->op == op &&
+ t->rdata.type == type &&
+ rdata_covers(&t->rdata) == covers)
+ {
+ if (t->ttl != rdl.ttl) {
+ isc_log_write(DIFF_COMMON_LOGARGS,
+ ISC_LOG_WARNING,
+ "TTL differs in rdataset, "
+ "adjusting %lu -> %lu",
+ (unsigned long) t->ttl,
+ (unsigned long) rdl.ttl);
+ }
+ ISC_LIST_APPEND(rdl.rdata, &t->rdata, link);
+ t = ISC_LIST_NEXT(t, link);
+ }
+
+ /*
+ * Convert the rdatalist into a rdataset.
+ */
+ dns_rdataset_init(&rds);
+ CHECK(dns_rdatalist_tordataset(&rdl, &rds));
+
+ /*
+ * Merge the rdataset into the database.
+ */
+ if (op == DNS_DIFFOP_ADD) {
+ result = dns_db_addrdataset(db, node, ver,
+ 0, &rds,
+ DNS_DBADD_MERGE|
+ DNS_DBADD_EXACT|
+ DNS_DBADD_EXACTTTL,
+ NULL);
+ } else if (op == DNS_DIFFOP_DEL) {
+ result = dns_db_subtractrdataset(db, node, ver,
+ &rds,
+ DNS_DBSUB_EXACT,
+ NULL);
+ } else {
+ INSIST(0);
+ }
+ if (result == DNS_R_UNCHANGED) {
+ /*
+ * This will not happen when executing a
+ * dynamic update, because that code will
+ * generate strictly minimal diffs.
+ * It may happen when receiving an IXFR
+ * from a server that is not as careful.
+ * Issue a warning and continue.
+ */
+ isc_log_write(DIFF_COMMON_LOGARGS,
+ ISC_LOG_WARNING,
+ "update with no effect");
+ } else if (result == ISC_R_SUCCESS ||
+ result == DNS_R_NXRRSET) {
+ /*
+ * OK.
+ */
+ } else {
+ CHECK(result);
+ }
+ }
+ dns_db_detachnode(db, &node);
+ }
+ return (ISC_R_SUCCESS);
+
+ failure:
+ if (node != NULL)
+ dns_db_detachnode(db, &node);
+ return (result);
+}
+
+/* XXX this duplicates lots of code in dns_diff_apply(). */
+
+isc_result_t
+dns_diff_load(dns_diff_t *diff, dns_addrdatasetfunc_t addfunc,
+ void *add_private)
+{
+ dns_difftuple_t *t;
+ isc_result_t result;
+
+ REQUIRE(DNS_DIFF_VALID(diff));
+
+ t = ISC_LIST_HEAD(diff->tuples);
+ while (t != NULL) {
+ dns_name_t *name;
+
+ name = &t->name;
+ while (t != NULL && dns_name_equal(&t->name, name)) {
+ dns_rdatatype_t type, covers;
+ dns_diffop_t op;
+ dns_rdatalist_t rdl;
+ dns_rdataset_t rds;
+
+ op = t->op;
+ type = t->rdata.type;
+ covers = rdata_covers(&t->rdata);
+
+ rdl.type = type;
+ rdl.covers = covers;
+ rdl.rdclass = t->rdata.rdclass;
+ rdl.ttl = t->ttl;
+ ISC_LIST_INIT(rdl.rdata);
+ ISC_LINK_INIT(&rdl, link);
+
+ while (t != NULL && dns_name_equal(&t->name, name) &&
+ t->op == op && t->rdata.type == type &&
+ rdata_covers(&t->rdata) == covers)
+ {
+ ISC_LIST_APPEND(rdl.rdata, &t->rdata, link);
+ t = ISC_LIST_NEXT(t, link);
+ }
+
+ /*
+ * Convert the rdatalist into a rdataset.
+ */
+ dns_rdataset_init(&rds);
+ CHECK(dns_rdatalist_tordataset(&rdl, &rds));
+ rds.trust = dns_trust_ultimate;
+
+ INSIST(op == DNS_DIFFOP_ADD);
+ result = (*addfunc)(add_private, name, &rds);
+ if (result == DNS_R_UNCHANGED) {
+ isc_log_write(DIFF_COMMON_LOGARGS,
+ ISC_LOG_WARNING,
+ "update with no effect");
+ } else if (result == ISC_R_SUCCESS ||
+ result == DNS_R_NXRRSET) {
+ /*
+ * OK.
+ */
+ } else {
+ CHECK(result);
+ }
+ }
+ }
+ result = ISC_R_SUCCESS;
+ failure:
+ return (result);
+}
+
+/*
+ * XXX uses qsort(); a merge sort would be more natural for lists,
+ * and perhaps safer wrt thread stack overflow.
+ */
+isc_result_t
+dns_diff_sort(dns_diff_t *diff, dns_diff_compare_func *compare) {
+ unsigned int length = 0;
+ unsigned int i;
+ dns_difftuple_t **v;
+ dns_difftuple_t *p;
+ REQUIRE(DNS_DIFF_VALID(diff));
+
+ for (p = ISC_LIST_HEAD(diff->tuples);
+ p != NULL;
+ p = ISC_LIST_NEXT(p, link))
+ length++;
+ if (length == 0)
+ return (ISC_R_SUCCESS);
+ v = isc_mem_get(diff->mctx, length * sizeof(dns_difftuple_t *));
+ if (v == NULL)
+ return (ISC_R_NOMEMORY);
+ i = 0;
+ for (i = 0; i < length; i++) {
+ p = ISC_LIST_HEAD(diff->tuples);
+ v[i] = p;
+ ISC_LIST_UNLINK(diff->tuples, p, link);
+ }
+ INSIST(ISC_LIST_HEAD(diff->tuples) == NULL);
+ qsort(v, length, sizeof(v[0]), compare);
+ for (i = 0; i < length; i++) {
+ ISC_LIST_APPEND(diff->tuples, v[i], link);
+ }
+ isc_mem_put(diff->mctx, v, length * sizeof(dns_difftuple_t *));
+ return (ISC_R_SUCCESS);
+}
+
+
+/*
+ * Create an rdataset containing the single RR of the given
+ * tuple. The caller must allocate the the rdata, rdataset and
+ * an rdatalist structure for it to refer to.
+ */
+
+static isc_result_t
+diff_tuple_tordataset(dns_difftuple_t *t, dns_rdata_t *rdata,
+ dns_rdatalist_t *rdl, dns_rdataset_t *rds)
+{
+ REQUIRE(DNS_DIFFTUPLE_VALID(t));
+ REQUIRE(rdl != NULL);
+ REQUIRE(rds != NULL);
+
+ rdl->type = t->rdata.type;
+ rdl->rdclass = t->rdata.rdclass;
+ rdl->ttl = t->ttl;
+ ISC_LIST_INIT(rdl->rdata);
+ ISC_LINK_INIT(rdl, link);
+ dns_rdataset_init(rds);
+ ISC_LINK_INIT(rdata, link);
+ dns_rdata_clone(&t->rdata, rdata);
+ ISC_LIST_APPEND(rdl->rdata, rdata, link);
+ return (dns_rdatalist_tordataset(rdl, rds));
+}
+
+isc_result_t
+dns_diff_print(dns_diff_t *diff, FILE *file) {
+ isc_result_t result;
+ dns_difftuple_t *t;
+ char *mem = NULL;
+ unsigned int size = 2048;
+
+ REQUIRE(DNS_DIFF_VALID(diff));
+
+ mem = isc_mem_get(diff->mctx, size);
+ if (mem == NULL)
+ return (ISC_R_NOMEMORY);
+
+ for (t = ISC_LIST_HEAD(diff->tuples); t != NULL;
+ t = ISC_LIST_NEXT(t, link))
+ {
+ isc_buffer_t buf;
+ isc_region_t r;
+
+ dns_rdatalist_t rdl;
+ dns_rdataset_t rds;
+ dns_rdata_t rd = DNS_RDATA_INIT;
+
+ result = diff_tuple_tordataset(t, &rd, &rdl, &rds);
+ if (result != ISC_R_SUCCESS) {
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "diff_tuple_tordataset failed: %s",
+ dns_result_totext(result));
+ result = ISC_R_UNEXPECTED;
+ goto cleanup;
+ }
+ again:
+ isc_buffer_init(&buf, mem, size);
+ result = dns_rdataset_totext(&rds, &t->name,
+ ISC_FALSE, ISC_FALSE, &buf);
+
+ /*
+ * Get rid of final newline.
+ */
+ INSIST(buf.used >= 1 &&
+ ((char *) buf.base)[buf.used-1] == '\n');
+ buf.used--;
+
+ if (result == ISC_R_NOSPACE) {
+ isc_mem_put(diff->mctx, mem, size);
+ size += 1024;
+ mem = isc_mem_get(diff->mctx, size);
+ if (mem == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ goto again;
+ }
+ if (result == ISC_R_SUCCESS) {
+ isc_buffer_usedregion(&buf, &r);
+ if (file != NULL)
+ fprintf(file, "%s %.*s\n",
+ t->op == DNS_DIFFOP_ADD ?
+ "add" : "del", (int) r.length,
+ (char *) r.base);
+ else
+ isc_log_write(DIFF_COMMON_LOGARGS,
+ ISC_LOG_DEBUG(7),
+ "%s %.*s",
+ t->op == DNS_DIFFOP_ADD ?
+ "add" : "del",
+ (int) r.length, (char *) r.base);
+ } else
+ goto cleanup;
+ }
+ result = ISC_R_SUCCESS;
+ cleanup:
+ if (mem != NULL)
+ isc_mem_put(diff->mctx, mem, size);
+ return (result);
+}
diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c
index 2d0cb394..fe3dec8b 100644
--- a/lib/dns/dispatch.c
+++ b/lib/dns/dispatch.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dispatch.c,v 1.75 2000/11/10 03:08:57 gson Exp $ */
+/* $Id: dispatch.c,v 1.78 2000/12/26 09:48:41 bwelling Exp $ */
#include <config.h>
@@ -642,7 +642,7 @@ udp_recv(isc_task_t *task, isc_event_t *ev_in) {
UNLOCK(&qid->lock);
dispatch_log(disp, LVL(90),
"search for response in bucket %d: %s",
- bucket, (resp == NULL ? "NOT FOUND" : "FOUND"));
+ bucket, (resp == NULL ? "not found" : "found"));
if (resp == NULL) {
free_buffer(disp, ev->region.base, ev->region.length);
@@ -854,7 +854,7 @@ tcp_recv(isc_task_t *task, isc_event_t *ev_in) {
UNLOCK(&qid->lock);
dispatch_log(disp, LVL(90),
"search for response in bucket %d: %s",
- bucket, (resp == NULL ? "NOT FOUND" : "FOUND"));
+ bucket, (resp == NULL ? "not found" : "found"));
if (resp == NULL)
goto restart;
@@ -1155,7 +1155,8 @@ dns_dispatchmgr_create(isc_mem_t *mctx, isc_entropy_t *entropy,
void
dns_dispatchmgr_setblackhole(dns_dispatchmgr_t *mgr, dns_acl_t *blackhole) {
REQUIRE(VALID_DISPATCHMGR(mgr));
- REQUIRE(mgr->blackhole == NULL);
+ if (mgr->blackhole != NULL)
+ dns_acl_detach(&mgr->blackhole);
dns_acl_attach(blackhole, &mgr->blackhole);
}
@@ -2043,7 +2044,7 @@ dns_dispatch_addrequest(dns_dispatch_t *disp,
res->arg = arg;
res->item_out = ISC_FALSE;
ISC_LIST_INIT(res->items);
- ISC_LIST_APPENDUNSAFE(disp->rq_handlers, res, link);
+ ISC_LIST_INITANDAPPEND(disp->rq_handlers, res, link);
request_log(disp, res, LVL(90), "attaching task %p", res->task);
diff --git a/lib/dns/dnssec.c b/lib/dns/dnssec.c
index 2b50fe73..472bd6eb 100644
--- a/lib/dns/dnssec.c
+++ b/lib/dns/dnssec.c
@@ -16,7 +16,7 @@
*/
/*
- * $Id: dnssec.c,v 1.55 2000/10/31 03:21:51 marka Exp $
+ * $Id: dnssec.c,v 1.56 2000/12/11 19:24:05 bwelling Exp $
*/
@@ -782,5 +782,5 @@ dns_dnssec_iszonekey(dns_rdata_t *keyrdata) {
key.protocol != DNS_KEYPROTO_ANY)
iszonekey = ISC_FALSE;
- return (iszonekey);
+ return (iszonekey);
}
diff --git a/lib/dns/forward.c b/lib/dns/forward.c
index 3484cde8..94dd00f8 100644
--- a/lib/dns/forward.c
+++ b/lib/dns/forward.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: forward.c,v 1.1 2000/08/24 22:15:30 bwelling Exp $ */
+/* $Id: forward.c,v 1.2 2000/12/11 19:24:06 bwelling Exp $ */
#include <config.h>
@@ -32,7 +32,7 @@
struct dns_fwdtable {
/* Unlocked. */
- unsigned int magic;
+ unsigned int magic;
isc_mem_t *mctx;
isc_rwlock_t rwlock;
/* Locked by lock. */
@@ -116,7 +116,7 @@ dns_fwdtable_add(dns_fwdtable_t *fwdtable, dns_name_t *name,
}
forwarders->fwdpolicy = fwdpolicy;
- RWLOCK(&fwdtable->rwlock, isc_rwlocktype_write);
+ RWLOCK(&fwdtable->rwlock, isc_rwlocktype_write);
result = dns_rbt_addname(fwdtable->table, name, forwarders);
RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_write);
diff --git a/lib/dns/gen.c b/lib/dns/gen.c
index 86e9e590..2e437419 100644
--- a/lib/dns/gen.c
+++ b/lib/dns/gen.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: gen.c,v 1.58 2000/11/20 20:29:00 bwelling Exp $ */
+/* $Id: gen.c,v 1.59 2000/12/11 19:24:07 bwelling Exp $ */
#include <config.h>
@@ -225,7 +225,7 @@ doswitch(const char *name, const char *function, const char *args,
funname(tt->typename, buf1), args);
else
fprintf(stdout,
- "\t\tcase %d:%s %s_%s_%s(%s); break;",
+ "\t\tcase %d:%s %s_%s_%s(%s); break;",
tt->rdclass, result, function,
funname(tt->classname, buf1),
funname(tt->typename, buf2), args);
diff --git a/lib/dns/include/dns/Makefile.in b/lib/dns/include/dns/Makefile.in
index dbc45dc6..7f26db14 100644
--- a/lib/dns/include/dns/Makefile.in
+++ b/lib/dns/include/dns/Makefile.in
@@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.38 2000/12/01 00:50:28 gson Exp $
+# $Id: Makefile.in,v 1.39 2000/12/21 16:17:41 gson Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@@ -26,7 +26,7 @@ HEADERS = a6.h acl.h adb.h byaddr.h cache.h callbacks.h \
confacl.h confcache.h confcommon.h confctl.h confctx.h \
confip.h confkeys.h conflog.h conflsn.h conflwres.h \
confparser.h confresolv.h confrrset.h confview.h confzone.h \
- db.h dbiterator.h dbtable.h dispatch.h \
+ db.h dbiterator.h dbtable.h diff.h dispatch.h \
dnssec.h events.h fixedname.h journal.h keyflags.h \
keytable.h keyvalues.h lib.h log.h master.h masterdump.h \
message.h name.h namedconf.h ncache.h \
diff --git a/lib/dns/include/dns/compress.h b/lib/dns/include/dns/compress.h
index 6a0d1cab..c466544c 100644
--- a/lib/dns/include/dns/compress.h
+++ b/lib/dns/include/dns/compress.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: compress.h,v 1.19 2000/11/14 23:29:55 bwelling Exp $ */
+/* $Id: compress.h,v 1.20 2000/12/28 00:42:56 bwelling Exp $ */
#ifndef DNS_COMPRESS_H
#define DNS_COMPRESS_H 1
@@ -28,8 +28,7 @@ ISC_LANG_BEGINDECLS
#define DNS_COMPRESS_NONE 0x00 /* no compression */
#define DNS_COMPRESS_GLOBAL14 0x01 /* "normal" compression. */
-#define DNS_COMPRESS_GLOBAL16 0x02 /* 16-bit edns global comp. */
-#define DNS_COMPRESS_GLOBAL 0x03 /* all global comp. */
+#define DNS_COMPRESS_GLOBAL 0x01 /* all global comp. */
/*
* Synonymous with DNS_COMPRESS_GLOBAL. A genuine difference existed when
* local compression was an IETF draft, but that draft has been retired without
diff --git a/lib/dns/include/dns/confcommon.h b/lib/dns/include/dns/confcommon.h
index 09213b2c..df172ec4 100644
--- a/lib/dns/include/dns/confcommon.h
+++ b/lib/dns/include/dns/confcommon.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: confcommon.h,v 1.30 2000/10/19 01:25:38 gson Exp $ */
+/* $Id: confcommon.h,v 1.31 2000/12/07 22:42:22 tale Exp $ */
#ifndef DNS_CONFCOMMON_H
#define DNS_CONFCOMMON_H 1
@@ -301,6 +301,9 @@ dns_c_peer_print(FILE *fp, int indent, dns_peer_t *peer);
void
dns_c_peerlist_print(FILE *fp, int indent, dns_peerlist_t *peers);
+isc_result_t
+dns_c_nameprint(dns_name_t *name, FILE *stream);
+
void
dns_c_ssutable_print(FILE *fp, int indent, dns_ssutable_t *ssutable);
diff --git a/lib/dns/include/dns/confctx.h b/lib/dns/include/dns/confctx.h
index a1615729..89b767d6 100644
--- a/lib/dns/include/dns/confctx.h
+++ b/lib/dns/include/dns/confctx.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: confctx.h,v 1.58 2000/11/25 02:43:52 marka Exp $ */
+/* $Id: confctx.h,v 1.60 2000/12/13 00:15:30 tale Exp $ */
#ifndef DNS_CONFCTX_H
#define DNS_CONFCTX_H 1
@@ -118,6 +118,7 @@ struct dns_c_options {
char *pid_filename;
char *stats_filename;
char *memstats_filename;
+ char *cache_filename;
char *named_xfer;
char *random_device;
char *random_seed_file;
@@ -157,7 +158,6 @@ struct dns_c_options {
isc_uint32_t *min_refresh_time;
isc_uint32_t *max_refresh_time;
-
isc_boolean_t *expert_mode;
isc_boolean_t *fake_iquery;
isc_boolean_t *recursion;
@@ -202,6 +202,7 @@ struct dns_c_options {
dns_transfer_format_t *transfer_format;
+ dns_c_ipmatchlist_t *notifyacl;
dns_c_ipmatchlist_t *queryacl;
dns_c_ipmatchlist_t *transferacl;
dns_c_ipmatchlist_t *recursionacl;
@@ -327,6 +328,11 @@ isc_result_t dns_c_ctx_getmemstatsfilename(dns_c_ctx_t *ctx, char **retval);
isc_result_t dns_c_ctx_unsetmemstatsfilename(dns_c_ctx_t *ctx);
+isc_result_t dns_c_ctx_setcachefile(dns_c_ctx_t *ctx, const char *newval);
+isc_result_t dns_c_ctx_getcachefile(dns_c_ctx_t *ctx, char **retval);
+isc_result_t dns_c_ctx_unsetcachefile(dns_c_ctx_t *ctx);
+
+
isc_result_t dns_c_ctx_setnamedxfer(dns_c_ctx_t *ctx, const char *newval);
isc_result_t dns_c_ctx_getnamedxfer(dns_c_ctx_t *ctx, char **retval);
isc_result_t dns_c_ctx_unsetnamedxfer(dns_c_ctx_t *ctx);
@@ -507,7 +513,6 @@ isc_result_t dns_c_ctx_getmaxrefreshtime(dns_c_ctx_t *cfg,
isc_uint32_t *retval);
isc_result_t dns_c_ctx_unsetmaxrefreshtime(dns_c_ctx_t *cfg);
-
isc_result_t dns_c_ctx_setmaxncachettl(dns_c_ctx_t *cfg, isc_uint32_t newval);
isc_result_t dns_c_ctx_getmaxncachettl(dns_c_ctx_t *cfg, isc_uint32_t *retval);
isc_result_t dns_c_ctx_unsetmaxncachettl(dns_c_ctx_t *cfg);
@@ -732,6 +737,11 @@ isc_result_t dns_c_ctx_gettransferformat(dns_c_ctx_t *cfg,
dns_transfer_format_t *tformat);
isc_result_t dns_c_ctx_unsettransferformat(dns_c_ctx_t *cfg);
+isc_result_t dns_c_ctx_setallownotify(dns_c_ctx_t *cfg,
+ dns_c_ipmatchlist_t *iml);
+isc_result_t dns_c_ctx_getallownotify(dns_c_ctx_t *cfg,
+ dns_c_ipmatchlist_t **list);
+isc_result_t dns_c_ctx_unsetallownotify(dns_c_ctx_t *cfg);
isc_result_t dns_c_ctx_setallowquery(dns_c_ctx_t *cfg,
dns_c_ipmatchlist_t *iml);
diff --git a/lib/dns/include/dns/confip.h b/lib/dns/include/dns/confip.h
index d5ce5db5..cd09fac9 100644
--- a/lib/dns/include/dns/confip.h
+++ b/lib/dns/include/dns/confip.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: confip.h,v 1.27 2000/08/01 01:23:53 tale Exp $ */
+/* $Id: confip.h,v 1.28 2000/12/13 00:15:31 tale Exp $ */
#ifndef DNS_CONFIP_H
#define DNS_CONFIP_H 1
@@ -95,6 +95,7 @@ struct dns_c_iplist {
isc_mem_t *mem;
int refcount;
isc_sockaddr_t *ips;
+ dns_name_t **keys;
isc_uint32_t size;
isc_uint32_t nextidx;
};
@@ -226,11 +227,12 @@ isc_result_t dns_c_iplist_detach(dns_c_iplist_t **list);
isc_result_t dns_c_iplist_copy(isc_mem_t *mem, dns_c_iplist_t **dest,
dns_c_iplist_t *src);
+isc_boolean_t dns_c_iplist_haskeys(dns_c_iplist_t *list);
void dns_c_iplist_attach(dns_c_iplist_t *source, dns_c_iplist_t **target);
isc_result_t dns_c_iplist_append(dns_c_iplist_t *list,
- isc_sockaddr_t newaddr);
+ isc_sockaddr_t newaddr, const char *key);
isc_result_t dns_c_iplist_remove(dns_c_iplist_t *list, isc_sockaddr_t newaddr);
diff --git a/lib/dns/include/dns/confview.h b/lib/dns/include/dns/confview.h
index cd17cd75..a5d61f1f 100644
--- a/lib/dns/include/dns/confview.h
+++ b/lib/dns/include/dns/confview.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: confview.h,v 1.46 2000/12/01 23:27:43 marka Exp $ */
+/* $Id: confview.h,v 1.48 2000/12/13 00:15:33 tale Exp $ */
#ifndef DNS_CONFVIEW_H
#define DNS_CONFVIEW_H 1
@@ -102,6 +102,7 @@ struct dns_c_view {
dns_c_iplist_t *forwarders;
dns_c_iplist_t *also_notify;
+ dns_c_ipmatchlist_t *allownotify;
dns_c_ipmatchlist_t *allowquery;
dns_c_ipmatchlist_t *allowupdateforwarding;
dns_c_ipmatchlist_t *transferacl;
@@ -149,7 +150,6 @@ struct dns_c_view {
isc_uint32_t *min_refresh_time;
isc_uint32_t *max_refresh_time;
-
dns_c_addata_t *additional_data;
dns_transfer_format_t *transfer_format;
@@ -158,6 +158,8 @@ struct dns_c_view {
dns_c_tkeylist_t *trusted_keys;
+ char *cache_file;
+
#if 0
/*
* To implement later.
@@ -231,8 +233,11 @@ isc_result_t dns_c_view_unsetforwarders(dns_c_view_t *view);
isc_result_t dns_c_view_getforwarders(dns_c_view_t *view,
dns_c_iplist_t **ipl);
-
-
+isc_result_t dns_c_view_getallownotify(dns_c_view_t *view,
+ dns_c_ipmatchlist_t **retval);
+isc_result_t dns_c_view_setallownotify(dns_c_view_t *view,
+ dns_c_ipmatchlist_t *newval);
+isc_result_t dns_c_view_unsetallownotify(dns_c_view_t *view);
isc_result_t dns_c_view_getallowquery(dns_c_view_t *view,
dns_c_ipmatchlist_t **retval);
@@ -587,6 +592,12 @@ isc_result_t dns_c_view_settrustedkeys(dns_c_view_t *view,
dns_c_tkeylist_t *newval,
isc_boolean_t copy);
+isc_result_t dns_c_view_getcachefile(dns_c_view_t *view,
+ char **cachefile);
+isc_result_t dns_c_view_unsetcachefile(dns_c_view_t *view);
+isc_result_t dns_c_view_setcachefile(dns_c_view_t *view,
+ const char *newval);
+
#if 0
diff --git a/lib/dns/include/dns/confzone.h b/lib/dns/include/dns/confzone.h
index 76b117b8..47bcb819 100644
--- a/lib/dns/include/dns/confzone.h
+++ b/lib/dns/include/dns/confzone.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: confzone.h,v 1.49 2000/11/28 22:42:37 gson Exp $ */
+/* $Id: confzone.h,v 1.50 2000/12/13 00:15:34 tale Exp $ */
#ifndef DNS_CONFZONE_H
#define DNS_CONFZONE_H 1
@@ -116,7 +116,6 @@ struct dns_c_master_zone {
isc_uint32_t max_trans_idle_out;
isc_uint32_t sig_valid_interval;
-
isc_sockaddr_t notify_source;
isc_sockaddr_t notify_source_v6;
isc_sockaddr_t transfer_source;
@@ -138,6 +137,7 @@ struct dns_c_slave_zone {
dns_severity_t check_names;
dns_c_ipmatchlist_t *allow_update;
dns_c_ipmatchlist_t *allow_update_forwarding;
+ dns_c_ipmatchlist_t *allow_notify;
dns_c_ipmatchlist_t *allow_query;
dns_c_ipmatchlist_t *allow_transfer;
dns_c_iplist_t *also_notify;
@@ -160,7 +160,6 @@ struct dns_c_slave_zone {
isc_uint32_t max_trans_idle_in;
isc_uint32_t max_trans_idle_out;
-
isc_uint32_t min_retry_time;
isc_uint32_t max_retry_time;
isc_uint32_t min_refresh_time;
@@ -315,7 +314,11 @@ isc_result_t dns_c_zone_getssuauth(dns_c_zone_t *zone,
dns_ssutable_t **ssutable);
-
+isc_result_t dns_c_zone_setallownotify(dns_c_zone_t *zone,
+ dns_c_ipmatchlist_t *ipml,
+ isc_boolean_t deepcopy);
+isc_result_t dns_c_zone_getallownotify(dns_c_zone_t *zone,
+ dns_c_ipmatchlist_t **retval);
isc_result_t dns_c_zone_setallowquery(dns_c_zone_t *zone,
dns_c_ipmatchlist_t *ipml,
@@ -461,10 +464,6 @@ isc_result_t dns_c_zone_setmaxrefreshtime(dns_c_zone_t *zone,
isc_result_t dns_c_zone_getmaxrefreshtime(dns_c_zone_t *zone,
isc_uint32_t *retval);
-
-
-
-
isc_result_t dns_c_zone_setmaxixfrlog(dns_c_zone_t *zone,
isc_uint32_t newval);
isc_result_t dns_c_zone_getmaxixfrlog(dns_c_zone_t *zone,
diff --git a/lib/dns/include/dns/db.h b/lib/dns/include/dns/db.h
index 11efccab..41a019e7 100644
--- a/lib/dns/include/dns/db.h
+++ b/lib/dns/include/dns/db.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: db.h,v 1.62 2000/12/01 01:22:44 marka Exp $ */
+/* $Id: db.h,v 1.63 2000/12/07 19:51:58 marka Exp $ */
#ifndef DNS_DB_H
#define DNS_DB_H 1
@@ -193,6 +193,7 @@ struct dns_db {
#define DNS_DBADD_MERGE 0x01
#define DNS_DBADD_FORCE 0x02
#define DNS_DBADD_EXACT 0x04
+#define DNS_DBADD_EXACTTTL 0x08
/*
* Options that can be specified for dns_db_subtractrdataset().
@@ -1021,7 +1022,8 @@ dns_db_addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
* rdataset will only be added if its trust level is >= the trust level of
* any existing rdataset. Forcing is only meaningful for cache databases.
* If DNS_DBADD_EXACT is set then there must be no rdata in common between
- * the old and new rdata sets.
+ * the old and new rdata sets. If DNS_DBADD_EXACTTTL is set then both
+ * the old and new rdata sets must have the same ttl.
*
* The 'now' field is ignored if 'db' is a zone database. If 'db' is
* a cache database, then the added rdataset will expire no later than
diff --git a/lib/dns/include/dns/diff.h b/lib/dns/include/dns/diff.h
new file mode 100644
index 00000000..08300711
--- /dev/null
+++ b/lib/dns/include/dns/diff.h
@@ -0,0 +1,274 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * 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 INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM 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.
+ */
+
+/* $Id: diff.h,v 1.2 2000/12/22 22:56:55 bwelling Exp $ */
+
+#ifndef DNS_DIFF_H
+#define DNS_DIFF_H 1
+
+/*****
+ ***** Module Info
+ *****/
+
+/*
+ * A diff is a convenience type representing a list of changes to be
+ * made to a database.
+ */
+
+/***
+ *** Imports
+ ***/
+
+#include <isc/lang.h>
+#include <isc/magic.h>
+
+#include <dns/name.h>
+#include <dns/rdata.h>
+#include <dns/types.h>
+
+/***
+ *** Types
+ ***/
+
+/*
+ * A dns_difftuple_t represents a single RR being added or deleted.
+ * The RR type and class are in the 'rdata' member; the class is always
+ * the real one, not a DynDNS meta-class, so that the rdatas can be
+ * compared using dns_rdata_compare(). The TTL is significant
+ * even for deletions, because a deletion/addition pair cannot
+ * be canceled out if the TTL differs (it might be an explicit
+ * TTL update).
+ *
+ * Tuples are also used to represent complete RRs with owner
+ * names for a couple of other purposes, such as the
+ * individual RRs of a "RRset exists (value dependent)"
+ * prerequisite set. In this case, op==DNS_DIFFOP_EXISTS,
+ * and the TTL is ignored.
+ */
+
+typedef enum {
+ DNS_DIFFOP_ADD, /* Add an RR. */
+ DNS_DIFFOP_DEL, /* Delete an RR. */
+ DNS_DIFFOP_EXISTS /* Assert RR existence. */
+} dns_diffop_t;
+
+typedef struct dns_difftuple dns_difftuple_t;
+
+#define DNS_DIFFTUPLE_MAGIC 0x44494654U /* DIFT. */
+#define DNS_DIFFTUPLE_VALID(t) ISC_MAGIC_VALID(t, DNS_DIFFTUPLE_MAGIC)
+
+struct dns_difftuple {
+ unsigned int magic;
+ isc_mem_t *mctx;
+ dns_diffop_t op;
+ dns_name_t name;
+ dns_ttl_t ttl;
+ dns_rdata_t rdata;
+ ISC_LINK(dns_difftuple_t) link;
+ /* Variable-size name data and rdata follows. */
+};
+
+/*
+ * A dns_diff_t represents a set of changes being applied to
+ * a zone. Diffs are also used to represent "RRset exists
+ * (value dependent)" prerequisites.
+ */
+typedef struct dns_diff dns_diff_t;
+
+#define DNS_DIFF_MAGIC 0x44494646U /* DIFF. */
+#define DNS_DIFF_VALID(t) ISC_MAGIC_VALID(t, DNS_DIFF_MAGIC)
+
+struct dns_diff {
+ unsigned int magic;
+ isc_mem_t * mctx;
+ ISC_LIST(dns_difftuple_t) tuples;
+};
+
+/* Type of comparision function for sorting diffs. */
+typedef int dns_diff_compare_func(const void *, const void *);
+
+/***
+ *** Functions
+ ***/
+
+ISC_LANG_BEGINDECLS
+
+/**************************************************************************/
+/*
+ * Maniuplation of diffs and tuples.
+ */
+
+isc_result_t
+dns_difftuple_create(isc_mem_t *mctx,
+ dns_diffop_t op, dns_name_t *name, dns_ttl_t ttl,
+ dns_rdata_t *rdata, dns_difftuple_t **tp);
+/*
+ * Create a tuple. Deep copies are made of the name and rdata, so
+ * they need not remain valid after the call.
+ *
+ * Requires:
+ * *tp != NULL && *tp == NULL.
+ *
+ * Returns:
+ * ISC_R_SUCCESS
+ * ISC_R_NOMEMORY
+ */
+
+void
+dns_difftuple_free(dns_difftuple_t **tp);
+/*
+ * Free a tuple.
+ *
+ * Requires:
+ * **tp is a valid tuple.
+ *
+ * Ensures:
+ * *tp == NULL
+ * All memory used by the tuple is freed.
+ */
+
+isc_result_t
+dns_difftuple_copy(dns_difftuple_t *orig, dns_difftuple_t **copyp);
+/*
+ * Copy a tuple.
+ *
+ * Requires:
+ * 'orig' points to a valid tuple
+ * copyp != NULL && *copyp == NULL
+ */
+
+void
+dns_diff_init(isc_mem_t *mctx, dns_diff_t *diff);
+/*
+ * Initialize a diff.
+ *
+ * Requires:
+ * 'diff' points to an uninitialized dns_diff_t
+ * allocated by the caller.
+ *
+ * Ensures:
+ * '*diff' is a valid, empty diff.
+ */
+
+void
+dns_diff_clear(dns_diff_t *diff);
+/*
+ * Clear a diff, destroying all its tuples.
+ *
+ * Requires:
+ * 'diff' points to a valid dns_diff_t.
+ *
+ * Ensures:
+ * Any tuples in the diff are destroyed.
+ * The diff now empty, but it is still valid
+ * and may be reused without calling dns_diff_init
+ * again. The only memory used is that of the
+ * dns_diff_t structure itself.
+ *
+ * Notes:
+ * Managing the memory of the dns_diff_t structure itself
+ * is the caller's responsibility.
+ */
+
+void
+dns_diff_append(dns_diff_t *diff, dns_difftuple_t **tuple);
+/*
+ * Append a single tuple to a diff.
+ *
+ * 'diff' is a valid diff.
+ * '*tuple' is a valid tuple.
+ *
+ * Ensures:
+ * *tuple is NULL.
+ * The tuple has been freed, or will be freed when the diff is cleared.
+ */
+
+void
+dns_diff_appendminimal(dns_diff_t *diff, dns_difftuple_t **tuple);
+/*
+ * Append 'tuple' to 'diff', removing any duplicate
+ * or conflicting updates as needed to create a minimal diff.
+ *
+ * Requires:
+ * 'diff' is a minimal diff.
+ *
+ * Ensures:
+ * 'diff' is still a minimal diff.
+ * *tuple is NULL.
+ * The tuple has been freed, or will be freed when the diff is cleared.
+ *
+ */
+
+isc_result_t
+dns_diff_sort(dns_diff_t *diff, dns_diff_compare_func *compare);
+/*
+ * Sort 'diff' in-place according to the comparison function 'compare'.
+ */
+
+isc_result_t
+dns_diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver);
+/*
+ * Apply 'diff' to the database 'db'.
+ *
+ * For efficiency, the diff should be sorted by owner name.
+ * If it is not sorted, operation will still be correct,
+ * but less efficient.
+ *
+ * Requires:
+ * *diff is a valid diff (possibly empty), containing
+ * tuples of type DNS_DIFFOP_ADD and/or
+ * For DNS_DIFFOP_DEL tuples, the TTL is ignored.
+ *
+ */
+
+isc_result_t
+dns_diff_load(dns_diff_t *diff, dns_addrdatasetfunc_t addfunc,
+ void *add_private);
+/*
+ * Like dns_diff_apply, but for use when loading a new database
+ * instead of modifying an existing one. This bypasses the
+ * database transaction mechanisms.
+ *
+ * Requires:
+ * 'addfunc' is a valid dns_addradatasetfunc_t obtained from
+ * dns_db_beginload()
+ *
+ * 'add_private' points to a corresponding dns_dbload_t *
+ * (XXX why is it a void pointer, then?)
+ */
+
+isc_result_t
+dns_diff_print(dns_diff_t *diff, FILE *file);
+
+/*
+ * Print the differences to 'file' or if 'file' is NULL via the
+ * logging system.
+ *
+ * Require:
+ * 'diff' to be valid.
+ * 'file' to refer to a open file or NULL.
+ *
+ * Returns:
+ * ISC_R_SUCCESS
+ * ISC_R_NOMEMORY
+ * ISC_R_UNEXPECTED
+ * any error from dns_rdataset_totext()
+ */
+
+ISC_LANG_ENDDECLS
+
+#endif /* DNS_DIFF_H */
diff --git a/lib/dns/include/dns/journal.h b/lib/dns/include/dns/journal.h
index 23b22445..8de9e8c0 100644
--- a/lib/dns/include/dns/journal.h
+++ b/lib/dns/include/dns/journal.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: journal.h,v 1.20 2000/08/03 21:31:41 marka Exp $ */
+/* $Id: journal.h,v 1.21 2000/12/09 02:17:10 bwelling Exp $ */
#ifndef DNS_JOURNAL_H
#define DNS_JOURNAL_H 1
@@ -36,6 +36,7 @@
#include <isc/magic.h>
#include <dns/name.h>
+#include <dns/diff.h>
#include <dns/rdata.h>
#include <dns/types.h>
@@ -44,63 +45,6 @@
***/
/*
- * A dns_difftuple_t represents a single RR being added or deleted.
- * The RR type and class are in the 'rdata' member; the class is always
- * the real one, not a DynDNS meta-class, so that the rdatas can be
- * compared using dns_rdata_compare(). The TTL is significant
- * even for deletions, because a deletion/addition pair cannot
- * be canceled out if the TTL differs (it might be an explicit
- * TTL update).
- *
- * Tuples are also used to represent complete RRs with owner
- * names for a couple of other purposes, such as the
- * individual RRs of a "RRset exists (value dependent)"
- * prerequisite set. In this case, op==DNS_DIFFOP_EXISTS,
- * and the TTL is ignored.
- */
-
-typedef enum {
- DNS_DIFFOP_ADD, /* Add an RR. */
- DNS_DIFFOP_DEL, /* Delete an RR. */
- DNS_DIFFOP_EXISTS /* Assert RR existence. */
-} dns_diffop_t;
-
-typedef struct dns_difftuple dns_difftuple_t;
-
-#define DNS_DIFFTUPLE_MAGIC 0x44494654U /* DIFT. */
-#define DNS_DIFFTUPLE_VALID(t) ISC_MAGIC_VALID(t, DNS_DIFFTUPLE_MAGIC)
-
-struct dns_difftuple {
- unsigned int magic;
- isc_mem_t *mctx;
- dns_diffop_t op;
- dns_name_t name;
- dns_ttl_t ttl;
- dns_rdata_t rdata;
- ISC_LINK(dns_difftuple_t) link;
- /* Variable-size name data and rdata follows. */
-};
-
-/*
- * A dns_diff_t represents a set of changes being applied to
- * a zone. Diffs are also used to represent "RRset exists
- * (value dependent)" prerequisites.
- */
-typedef struct dns_diff dns_diff_t;
-
-#define DNS_DIFF_MAGIC 0x44494646U /* DIFF. */
-#define DNS_DIFF_VALID(t) ISC_MAGIC_VALID(t, DNS_DIFF_MAGIC)
-
-struct dns_diff {
- unsigned int magic;
- isc_mem_t * mctx;
- ISC_LIST(dns_difftuple_t) tuples;
-};
-
-/* Type of comparision function for sorting diffs. */
-typedef int dns_diff_compare_func(const void *, const void *);
-
-/*
* A dns_journal_t represents an open journal file. This is an opaque type.
*
* A particular dns_journal_t object may be opened for writing, in which case
@@ -120,168 +64,6 @@ ISC_LANG_BEGINDECLS
/**************************************************************************/
/*
- * Maniuplation of diffs and tuples.
- */
-
-isc_result_t
-dns_difftuple_create(isc_mem_t *mctx,
- dns_diffop_t op, dns_name_t *name, dns_ttl_t ttl,
- dns_rdata_t *rdata, dns_difftuple_t **tp);
-/*
- * Create a tuple. Deep copies are made of the name and rdata, so
- * they need not remain valid after the call.
- *
- * Requires:
- * *tp != NULL && *tp == NULL.
- *
- * Returns:
- * ISC_R_SUCCESS
- * ISC_R_NOMEMORY
- */
-
-void
-dns_difftuple_free(dns_difftuple_t **tp);
-/*
- * Free a tuple.
- *
- * Requires:
- * **tp is a valid tuple.
- *
- * Ensures:
- * *tp == NULL
- * All memory used by the tuple is freed.
- */
-
-isc_result_t
-dns_difftuple_copy(dns_difftuple_t *orig, dns_difftuple_t **copyp);
-/*
- * Copy a tuple.
- *
- * Requires:
- * 'orig' points to a valid tuple
- * copyp != NULL && *copyp == NULL
- */
-
-void
-dns_diff_init(isc_mem_t *mctx, dns_diff_t *diff);
-/*
- * Initialize a diff.
- *
- * Requires:
- * 'diff' points to an uninitialized dns_diff_t
- * allocated by the caller.
- *
- * Ensures:
- * '*diff' is a valid, empty diff.
- */
-
-void
-dns_diff_clear(dns_diff_t *diff);
-/*
- * Clear a diff, destroying all its tuples.
- *
- * Requires:
- * 'diff' points to a valid dns_diff_t.
- *
- * Ensures:
- * Any tuples in the diff are destroyed.
- * The diff now empty, but it is still valid
- * and may be reused without calling dns_diff_init
- * again. The only memory used is that of the
- * dns_diff_t structure itself.
- *
- * Notes:
- * Managing the memory of the dns_diff_t structure itself
- * is the caller's responsibility.
- */
-
-void
-dns_diff_append(dns_diff_t *diff, dns_difftuple_t **tuple);
-/*
- * Append a single tuple to a diff.
- *
- * 'diff' is a valid diff.
- * '*tuple' is a valid tuple.
- *
- * Ensures:
- * *tuple is NULL.
- * The tuple has been freed, or will be freed when the diff is cleared.
- */
-
-void
-dns_diff_appendminimal(dns_diff_t *diff, dns_difftuple_t **tuple);
-/*
- * Append 'tuple' to 'diff', removing any duplicate
- * or conflicting updates as needed to create a minimal diff.
- *
- * Requires:
- * 'diff' is a minimal diff.
- *
- * Ensures:
- * 'diff' is still a minimal diff.
- * *tuple is NULL.
- * The tuple has been freed, or will be freed when the diff is cleared.
- *
- */
-
-isc_result_t
-dns_diff_sort(dns_diff_t *diff, dns_diff_compare_func *compare);
-/*
- * Sort 'diff' in-place according to the comparison function 'compare'.
- */
-
-isc_result_t
-dns_diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver);
-/*
- * Apply 'diff' to the database 'db'.
- *
- * For efficiency, the diff should be sorted by owner name.
- * If it is not sorted, operation will still be correct,
- * but less efficient.
- *
- * Requires:
- * *diff is a valid diff (possibly empty), containing
- * tuples of type DNS_DIFFOP_ADD and/or
- * For DNS_DIFFOP_DEL tuples, the TTL is ignored.
- *
- */
-
-isc_result_t
-dns_diff_load(dns_diff_t *diff, dns_addrdatasetfunc_t addfunc,
- void *add_private);
-/*
- * Like dns_diff_apply, but for use when loading a new database
- * instead of modifying an existing one. This bypasses the
- * database transaction mechanisms.
- *
- * Requires:
- * 'addfunc' is a valid dns_addradatasetfunc_t obtained from
- * dns_db_beginload()
- *
- * 'add_private' points to a corresponding dns_dbload_t *
- * (XXX why is it a void pointer, then?)
- */
-
-isc_result_t
-dns_diff_print(dns_diff_t *diff, FILE *file);
-
-/*
- * Print the differences to 'file' or if 'file' is NULL via the
- * logging system.
- *
- * Require:
- * 'diff' to be valid.
- * 'file' to refer to a open file or NULL.
- *
- * Returns:
- * ISC_R_SUCCESS
- * ISC_R_NOMEMORY
- * ISC_R_UNEXPECTED
- * any error from dns_rdataset_totext()
- */
-
-/**************************************************************************/
-/*
* Misc. utilities
* XXX these belong in a general-purpose DNS library
*/
diff --git a/lib/dns/include/dns/log.h b/lib/dns/include/dns/log.h
index 3e32b1bb..89cd1a24 100644
--- a/lib/dns/include/dns/log.h
+++ b/lib/dns/include/dns/log.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log.h,v 1.25 2000/11/23 02:25:02 gson Exp $ */
+/* $Id: log.h,v 1.26 2000/12/09 02:17:11 bwelling Exp $ */
/* Principal Authors: DCL */
@@ -65,6 +65,7 @@ extern isc_logmodule_t dns_modules[];
#define DNS_LOGMODULE_TSIG (&dns_modules[20])
#define DNS_LOGMODULE_TKEY (&dns_modules[21])
#define DNS_LOGMODULE_SDB (&dns_modules[22])
+#define DNS_LOGMODULE_DIFF (&dns_modules[23])
ISC_LANG_BEGINDECLS
diff --git a/lib/dns/include/dns/lookup.h b/lib/dns/include/dns/lookup.h
index 6b3204eb..8b473bcd 100644
--- a/lib/dns/include/dns/lookup.h
+++ b/lib/dns/include/dns/lookup.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lookup.h,v 1.3 2000/11/02 00:55:41 bwelling Exp $ */
+/* $Id: lookup.h,v 1.4 2000/12/20 03:38:45 bwelling Exp $ */
#ifndef DNS_LOOKUP_H
#define DNS_LOOKUP_H 1
@@ -69,6 +69,8 @@ typedef struct dns_lookupevent {
dns_name_t *name;
dns_rdataset_t *rdataset;
dns_rdataset_t *sigrdataset;
+ dns_db_t *db;
+ dns_dbnode_t *node;
} dns_lookupevent_t;
isc_result_t
diff --git a/lib/dns/include/dns/master.h b/lib/dns/include/dns/master.h
index 269bbf4b..73d2a783 100644
--- a/lib/dns/include/dns/master.h
+++ b/lib/dns/include/dns/master.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: master.h,v 1.25 2000/10/17 07:22:36 marka Exp $ */
+/* $Id: master.h,v 1.26 2000/12/17 23:43:12 marka Exp $ */
#ifndef DNS_MASTER_H
#define DNS_MASTER_H 1
@@ -119,7 +119,8 @@ dns_master_loadfilequota(const char *master_file, dns_name_t *top,
* 'callbacks->warn' to generate any error messages required.
*
* 'done' is called with 'done_arg' and a result code when the loading
- * is completed or has failed if 'done' is non NULL.
+ * is completed or has failed. If the initial setup fails 'done' is
+ * not called.
*
* Requires:
* 'master_file' points to a valid string.
@@ -128,9 +129,8 @@ dns_master_loadfilequota(const char *master_file, dns_name_t *top,
* 'callbacks->commit' points to a valid function.
* 'callbacks->error' points to a valid function.
* 'callbacks->warn' points to a valid function.
- * 'callbacks->done' points to a valid function or NULL.
* 'mctx' points to a valid memory context.
- * 'task' and 'done' to be NULL or 'task' and 'done' to be valid.
+ * 'task' and 'done' to be valid.
* 'lmgr' to be valid.
* 'ctxp != NULL && ctxp == NULL'.
*
diff --git a/lib/dns/include/dns/name.h b/lib/dns/include/dns/name.h
index 42b4ce38..305f2213 100644
--- a/lib/dns/include/dns/name.h
+++ b/lib/dns/include/dns/name.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: name.h,v 1.82 2000/11/27 19:42:34 gson Exp $ */
+/* $Id: name.h,v 1.83 2000/12/28 00:42:58 bwelling Exp $ */
#ifndef DNS_NAME_H
#define DNS_NAME_H 1
@@ -93,7 +93,6 @@ ISC_LANG_BEGINDECLS
*** Extended Label Types
***/
-#define DNS_LABELTYPE_GLOBALCOMP16 0x40
#define DNS_LABELTYPE_BITSTRING 0x41
/***
diff --git a/lib/dns/include/dns/rdata.h b/lib/dns/include/dns/rdata.h
index 6508b2f1..72a6e852 100644
--- a/lib/dns/include/dns/rdata.h
+++ b/lib/dns/include/dns/rdata.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdata.h,v 1.48 2000/11/09 23:55:01 bwelling Exp $ */
+/* $Id: rdata.h,v 1.49 2000/12/19 19:20:15 gson Exp $ */
#ifndef DNS_RDATA_H
#define DNS_RDATA_H 1
@@ -170,8 +170,8 @@ dns_rdata_clone(const dns_rdata_t *src, dns_rdata_t *target);
* Clone 'target' from 'src'.
*
* Requires:
- * 'src' to be initalised.
- * 'target' to be initalised.
+ * 'src' to be initialized.
+ * 'target' to be initialized.
*/
/***
diff --git a/lib/dns/include/dns/rdataslab.h b/lib/dns/include/dns/rdataslab.h
index d7ba310a..c8071f27 100644
--- a/lib/dns/include/dns/rdataslab.h
+++ b/lib/dns/include/dns/rdataslab.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdataslab.h,v 1.18 2000/12/01 01:22:45 marka Exp $ */
+/* $Id: rdataslab.h,v 1.19 2000/12/06 22:19:05 bwelling Exp $ */
#ifndef DNS_RDATASLAB_H
#define DNS_RDATASLAB_H 1
@@ -102,8 +102,6 @@ dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab,
unsigned int flags, unsigned char **tslabp);
/*
* Merge 'oslab' and 'nslab'.
- *
- * DNS_RDATASLAB_FORCE and DNS_RDATASLAB_EXACT are mutually exclusive.
*/
isc_result_t
diff --git a/lib/dns/include/dns/result.h b/lib/dns/include/dns/result.h
index 05643c58..4978810e 100644
--- a/lib/dns/include/dns/result.h
+++ b/lib/dns/include/dns/result.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: result.h,v 1.74 2000/11/22 00:16:41 halley Exp $ */
+/* $Id: result.h,v 1.76 2000/12/20 23:31:10 bwelling Exp $ */
#ifndef DNS_RESULT_H
#define DNS_RESULT_H 1
@@ -98,7 +98,7 @@
#define DNS_R_NOVALIDSIG (ISC_RESULTCLASS_DNS + 59)
#define DNS_R_NOVALIDNXT (ISC_RESULTCLASS_DNS + 60)
#define DNS_R_NOTINSECURE (ISC_RESULTCLASS_DNS + 61)
-#define DNS_R_ZONETOOLARGE (ISC_RESULTCLASS_DNS + 62)
+/* #define DNS_R_unused (ISC_RESULTCLASS_DNS + 62) */
#define DNS_R_RECOVERABLE (ISC_RESULTCLASS_DNS + 63)
#define DNS_R_UNKNOWNOPT (ISC_RESULTCLASS_DNS + 64)
#define DNS_R_UNEXPECTEDID (ISC_RESULTCLASS_DNS + 65)
@@ -109,8 +109,9 @@
#define DNS_R_METATYPE (ISC_RESULTCLASS_DNS + 70)
#define DNS_R_CNAMEANDOTHER (ISC_RESULTCLASS_DNS + 71)
#define DNS_R_SINGLETON (ISC_RESULTCLASS_DNS + 72)
+#define DNS_R_HINTNXRRSET (ISC_RESULTCLASS_DNS + 73)
-#define DNS_R_NRESULTS 73 /* Number of results */
+#define DNS_R_NRESULTS 74 /* Number of results */
/*
* DNS wire format rcodes.
diff --git a/lib/dns/include/dns/sdb.h b/lib/dns/include/dns/sdb.h
index 86c9871b..28ef49c6 100644
--- a/lib/dns/include/dns/sdb.h
+++ b/lib/dns/include/dns/sdb.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sdb.h,v 1.10 2000/11/16 23:10:19 gson Exp $ */
+/* $Id: sdb.h,v 1.11 2000/12/06 01:08:39 bwelling Exp $ */
#ifndef DNS_SDB_H
#define DNS_SDB_H 1
@@ -90,6 +90,7 @@ ISC_LANG_BEGINDECLS
#define DNS_SDBFLAG_RELATIVEOWNER 0x00000001U
#define DNS_SDBFLAG_RELATIVERDATA 0x00000002U
+#define DNS_SDBFLAG_THREADSAFE 0x00000004U
isc_result_t
dns_sdb_register(const char *drivername, const dns_sdbmethods_t *methods,
@@ -144,6 +145,10 @@ dns_sdb_register(const char *drivername, const dns_sdbmethods_t *methods,
* include relative names. Otherwise, all names in the rdata string must
* be absolute. Be aware that if relative names are allowed, any
* absolute names must contain a trailing dot.
+ *
+ * If flags includes DNS_SDBFLAG_THREADSAFE, the driver must be able to
+ * handle multiple lookups in parallel. Otherwise, calls into the driver
+ * are serialized.
*/
void
diff --git a/lib/dns/include/dns/validator.h b/lib/dns/include/dns/validator.h
index 968fbc6b..7f632d93 100644
--- a/lib/dns/include/dns/validator.h
+++ b/lib/dns/include/dns/validator.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: validator.h,v 1.14 2000/12/01 01:03:12 gson Exp $ */
+/* $Id: validator.h,v 1.17 2000/12/22 23:01:56 gson Exp $ */
#ifndef DNS_VALIDATOR_H
#define DNS_VALIDATOR_H 1
@@ -52,6 +52,10 @@
#include <isc/mutex.h>
#include <dns/types.h>
+#include <dns/rdataset.h>
+#include <dns/rdatastruct.h> /* for dns_rdata_sig_t */
+
+#include <dst/dst.h>
/*
* A dns_validatorevent_t is sent when a 'validation' completes.
diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h
index affe2b78..6a0c6240 100644
--- a/lib/dns/include/dns/view.h
+++ b/lib/dns/include/dns/view.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: view.h,v 1.56 2000/11/10 03:16:26 gson Exp $ */
+/* $Id: view.h,v 1.61 2000/12/20 23:31:11 bwelling Exp $ */
#ifndef DNS_VIEW_H
#define DNS_VIEW_H 1
@@ -59,6 +59,8 @@
* None.
*/
+#include <stdio.h>
+
#include <isc/lang.h>
#include <isc/magic.h>
#include <isc/event.h>
@@ -112,6 +114,7 @@ struct dns_view {
dns_ttl_t maxcachettl;
dns_ttl_t maxncachettl;
in_port_t dstport;
+ char * cachefile;
/*
* Configurable data for server use only,
@@ -374,8 +377,8 @@ dns_view_freeze(dns_view_t *view);
isc_result_t
dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
- isc_stdtime_t now, unsigned int options,
- isc_boolean_t use_hints, dns_name_t *foundname,
+ isc_stdtime_t now, unsigned int options, isc_boolean_t use_hints,
+ dns_db_t **dbp, dns_dbnode_t **nodep, dns_name_t *foundname,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
/*
* Find an rdataset whose owner name is 'name', and whose type is
@@ -391,7 +394,9 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
*
* If 'use_hints' is ISC_TRUE, and the view has a hints database, then
* it will be searched last. If the answer is found in the hints
- * database, the result code will be DNS_R_HINT.
+ * database, the result code will be DNS_R_HINT. If the name is found
+ * in the hints database but not the type, the result code will be
+ * DNS_R_HINTNXRRSET.
*
* 'foundname' must meet the requirements of dns_db_find().
*
@@ -405,9 +410,13 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
* 'name' is valid name.
*
* 'type' is a valid dns_rdatatype_t, and is not a meta query type
- * (e.g. dns_rdatatype_any), or dns_rdatatype_sig.
+ * except dns_rdatatype_any.
+ *
+ * dbp == NULL || *dbp == NULL
+ *
+ * nodep == NULL || *nodep == NULL. If nodep != NULL, dbp != NULL.
*
- * 'foundname' is
+ * 'foundname' is a valid name with a dedicated buffer or NULL.
*
* 'rdataset' is a valid, disassociated rdataset.
*
@@ -418,6 +427,12 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
* In successful cases, 'rdataset', and possibly 'sigrdataset', are
* bound to the found data.
*
+ * If dbp != NULL, it points to the database containing the data.
+ *
+ * If nodep != NULL, it points to the database node containing the data.
+ *
+ * If foundname != NULL, it contains the full name of the found data.
+ *
* Returns:
*
* Any result that dns_db_find() can return, with the exception of
@@ -447,7 +462,9 @@ dns_view_simplefind(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
*
* If 'use_hints' is ISC_TRUE, and the view has a hints database, then
* it will be searched last. If the answer is found in the hints
- * database, the result code will be DNS_R_HINT.
+ * database, the result code will be DNS_R_HINT. If the name is found
+ * in the hints database but not the type, the result code will be
+ * DNS_R_HINTNXRRSET.
*
* If 'sigrdataset' is not NULL, and there is a SIG rdataset which
* covers 'type', then 'sigrdataset' will be bound to it.
@@ -626,6 +643,44 @@ dns_view_dialup(dns_view_t *view);
* Perform dialup-time maintenance on the zones of 'view'.
*/
+isc_result_t
+dns_view_dumpcache(dns_view_t *view);
+/*
+ * Dump the view's cache to the the view's cache file.
+ *
+ * Requires:
+ *
+ * 'view' is valid.
+ *
+ * Returns:
+ * ISC_R_SUCCESS The cache was successfully dumped.
+ * ISC_R_IGNORE No cachefile was specified.
+ * others An error occurred (see dns_master_dump)
+ */
+
+isc_result_t
+dns_view_dumpdbtostream(dns_view_t *view, FILE *fp);
+/*
+ * Dump the current state of the view 'view' to the stream 'fp'
+ * for purposes of analysis or debugging.
+ *
+ * Currently the dumped state includes the view's cache; in the future
+ * it may also include other state such as the address database.
+ * It will not not include authoritative data since it is voluminous and
+ * easily obtainable by other means.
+ *
+ * Requires:
+ *
+ * 'view' is valid.
+ *
+ * 'fp' refers to a file open for writing.
+ *
+ * Returns:
+ * ISC_R_SUCCESS The cache was successfully dumped.
+ * ISC_R_IGNORE No cachefile was specified.
+ * others An error occurred (see dns_master_dump)
+ */
+
ISC_LANG_ENDDECLS
#endif /* DNS_VIEW_H */
diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h
index 04924ffe..532edb1f 100644
--- a/lib/dns/include/dns/zone.h
+++ b/lib/dns/include/dns/zone.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zone.h,v 1.93 2000/12/01 23:49:57 gson Exp $ */
+/* $Id: zone.h,v 1.95 2000/12/28 01:29:08 marka Exp $ */
#ifndef DNS_ZONE_H
#define DNS_ZONE_H 1
@@ -375,6 +375,9 @@ dns_zone_maintenance(dns_zone_t *zone);
isc_result_t
dns_zone_setmasters(dns_zone_t *zone, isc_sockaddr_t *masters,
isc_uint32_t count);
+isc_result_t
+dns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *masters,
+ dns_name_t **keynames, isc_uint32_t count);
/*
* Set the list of master servers for the zone.
*
@@ -382,12 +385,17 @@ dns_zone_setmasters(dns_zone_t *zone, isc_sockaddr_t *masters,
* 'zone' to be a valid zone.
* 'masters' array of isc_sockaddr_t with port set or NULL.
* 'count' the number of masters.
+ * 'keynames' array of dns_name_t's for tsig keys or NULL.
+ *
+ * dns_zone_setmasters() is just a wrapper to setmasterswithkeys(),
+ * passing NULL in the keynames field.
*
* If 'masters' is NULL then 'count' must be zero.
*
* Returns:
* ISC_R_SUCCESS
* ISC_R_NOMEMORY
+ * Any result dns_name_dup() can return, if keynames!=NULL
*/
isc_result_t
@@ -488,7 +496,6 @@ dns_zone_setmaxretrytime(dns_zone_t *zone, isc_uint32_t val);
* val > 0.
*/
-
isc_result_t
dns_zone_setxfrsource4(dns_zone_t *zone, isc_sockaddr_t *xfrsource);
/*
@@ -582,6 +589,16 @@ dns_zone_getnotifysrc6(dns_zone_t *zone);
*/
void
+dns_zone_setnotifyacl(dns_zone_t *zone, dns_acl_t *acl);
+/*
+ * Sets the notify acl list for the zone.
+ *
+ * Require:
+ * 'zone' to be a valid zone.
+ * 'acl' to be a valid acl.
+ */
+
+void
dns_zone_setqueryacl(dns_zone_t *zone, dns_acl_t *acl);
/*
* Sets the query acl list for the zone.
@@ -621,6 +638,18 @@ dns_zone_setxfracl(dns_zone_t *zone, dns_acl_t *acl);
* 'acl' to be valid acl.
*/
+dns_acl_t *
+dns_zone_getnotifyacl(dns_zone_t *zone);
+/*
+ * Returns the current notify acl or NULL.
+ *
+ * Require:
+ * 'zone' to be a valid zone.
+ *
+ * Returns:
+ * acl a pointer to the acl.
+ * NULL
+ */
dns_acl_t *
dns_zone_getqueryacl(dns_zone_t *zone);
@@ -692,6 +721,14 @@ dns_zone_clearforwardacl(dns_zone_t *zone);
* 'zone' to be a valid zone.
*/
+void
+dns_zone_clearnotifyacl(dns_zone_t *zone);
+/*
+ * Clear the current notify acl.
+ *
+ * Require:
+ * 'zone' to be a valid zone.
+ */
void
dns_zone_clearqueryacl(dns_zone_t *zone);
@@ -1004,8 +1041,9 @@ dns_zone_forwardupdate(dns_zone_t *zone, dns_message_t *msg,
* Forward 'msg' to each master in turn until we get an answer or we
* have exausted the list of masters. 'callback' will be called with
* ISC_R_SUCCESS if we get an answer and the returned message will be
- * passed, otherwise a non ISC_R_SUCCESS result code will be passed and
- * msg will be NULL.
+ * passed as 'answer_message', otherwise a non ISC_R_SUCCESS result code
+ * will be passed and answer_message will be NULL. The callback function
+ * is responsible for destroying 'answer_message'.
* (callback)(callback_arg, result, answer_message);
*
* Require:
diff --git a/lib/dns/journal.c b/lib/dns/journal.c
index e97f38e1..e7f79c4d 100644
--- a/lib/dns/journal.c
+++ b/lib/dns/journal.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: journal.c,v 1.65 2000/12/01 01:22:39 marka Exp $ */
+/* $Id: journal.c,v 1.71 2000/12/22 23:47:00 gson Exp $ */
#include <config.h>
@@ -23,7 +23,6 @@
#include <isc/file.h>
#include <isc/mem.h>
-#include <isc/net.h> /* Required for ntohl. */
#include <isc/stdio.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -31,10 +30,10 @@
#include <dns/compress.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
+#include <dns/diff.h>
#include <dns/fixedname.h>
#include <dns/journal.h>
#include <dns/log.h>
-#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/result.h>
@@ -88,12 +87,6 @@ encode_uint32(isc_uint32_t val, unsigned char *p) {
p[3] = (isc_uint8_t)(val >> 0);
}
-static dns_rdatatype_t
-rdata_covers(dns_rdata_t *rdata) {
- return (rdata->type == dns_rdatatype_sig ?
- dns_rdata_covers(rdata) : 0);
-}
-
isc_uint32_t
dns_soa_getserial(dns_rdata_t *rdata) {
INSIST(rdata->type == dns_rdatatype_soa);
@@ -165,491 +158,6 @@ dns_db_createsoatuple(dns_db_t *db, dns_dbversion_t *ver, isc_mem_t *mctx,
/**************************************************************************/
/*
- * Diffs, aka Pending Journal Entries.
- */
-
-isc_result_t
-dns_difftuple_create(isc_mem_t *mctx,
- dns_diffop_t op, dns_name_t *name, dns_ttl_t ttl,
- dns_rdata_t *rdata, dns_difftuple_t **tp)
-{
- dns_difftuple_t *t;
- unsigned int size;
- unsigned char *datap;
-
- REQUIRE(tp != NULL && *tp == NULL);
-
- /*
- * Create a new tuple. The variable-size wire-format name data and
- * rdata immediately follow the dns_difftuple_t structure
- * in memory.
- */
- size = sizeof(*t) + name->length + rdata->length;
- t = isc_mem_allocate(mctx, size);
- if (t == NULL)
- return (ISC_R_NOMEMORY);
- t->mctx = mctx;
- t->op = op;
-
- datap = (unsigned char *)(t + 1);
-
- memcpy(datap, name->ndata, name->length);
- dns_name_init(&t->name, NULL);
- dns_name_clone(name, &t->name);
- t->name.ndata = datap;
- datap += name->length;
-
- t->ttl = ttl;
-
- memcpy(datap, rdata->data, rdata->length);
- dns_rdata_init(&t->rdata);
- dns_rdata_clone(rdata, &t->rdata);
- t->rdata.data = datap;
- datap += rdata->length;
-
- ISC_LINK_INIT(&t->rdata, link);
- ISC_LINK_INIT(t, link);
- t->magic = DNS_DIFFTUPLE_MAGIC;
-
- INSIST(datap == (unsigned char *)t + size);
-
- *tp = t;
- return (ISC_R_SUCCESS);
-}
-
-void
-dns_difftuple_free(dns_difftuple_t **tp) {
- dns_difftuple_t *t = *tp;
- REQUIRE(DNS_DIFFTUPLE_VALID(t));
- dns_name_invalidate(&t->name);
- t->magic = 0;
- isc_mem_free(t->mctx, t);
- *tp = NULL;
-}
-
-isc_result_t
-dns_difftuple_copy(dns_difftuple_t *orig, dns_difftuple_t **copyp) {
- return (dns_difftuple_create(orig->mctx, orig->op, &orig->name,
- orig->ttl, &orig->rdata, copyp));
-}
-
-void
-dns_diff_init(isc_mem_t *mctx, dns_diff_t *diff) {
- diff->mctx = mctx;
- ISC_LIST_INIT(diff->tuples);
- diff->magic = DNS_DIFF_MAGIC;
-}
-
-void
-dns_diff_clear(dns_diff_t *diff) {
- dns_difftuple_t *t;
- REQUIRE(DNS_DIFF_VALID(diff));
- while ((t = ISC_LIST_HEAD(diff->tuples)) != NULL) {
- ISC_LIST_UNLINK(diff->tuples, t, link);
- dns_difftuple_free(&t);
- }
- ENSURE(ISC_LIST_EMPTY(diff->tuples));
-}
-
-void
-dns_diff_append(dns_diff_t *diff, dns_difftuple_t **tuplep)
-{
- ISC_LIST_APPEND(diff->tuples, *tuplep, link);
- *tuplep = NULL;
-}
-
-/* XXX this is O(N) */
-
-void
-dns_diff_appendminimal(dns_diff_t *diff, dns_difftuple_t **tuplep)
-{
- dns_difftuple_t *ot, *next_ot;
-
- REQUIRE(DNS_DIFF_VALID(diff));
- REQUIRE(DNS_DIFFTUPLE_VALID(*tuplep));
-
- /*
- * Look for an existing tuple with the same owner name,
- * rdata, and TTL. If we are doing an addition and find a
- * deletion or vice versa, remove both the old and the
- * new tuple since they cancel each other out (assuming
- * that we never delete nonexistent data or add existing
- * data).
- *
- * If we find an old update of the same kind as
- * the one we are doing, there must be a programming
- * error. We report it but try to continue anyway.
- */
- for (ot = ISC_LIST_HEAD(diff->tuples); ot != NULL;
- ot = next_ot)
- {
- next_ot = ISC_LIST_NEXT(ot, link);
- if (dns_name_equal(&ot->name, &(*tuplep)->name) &&
- dns_rdata_compare(&ot->rdata, &(*tuplep)->rdata) == 0 &&
- ot->ttl == (*tuplep)->ttl)
- {
- ISC_LIST_UNLINK(diff->tuples, ot, link);
- if ((*tuplep)->op == ot->op) {
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "unexpected non-minimal diff");
- } else {
- dns_difftuple_free(tuplep);
- }
- dns_difftuple_free(&ot);
- break;
- }
- }
-
- if (*tuplep != NULL) {
- ISC_LIST_APPEND(diff->tuples, *tuplep, link);
- *tuplep = NULL;
- }
-
- ENSURE(*tuplep == NULL);
-}
-
-isc_result_t
-dns_diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver)
-{
- dns_difftuple_t *t;
- dns_dbnode_t *node = NULL;
- isc_result_t result;
-
- REQUIRE(DNS_DIFF_VALID(diff));
- REQUIRE(DNS_DB_VALID(db));
-
- t = ISC_LIST_HEAD(diff->tuples);
- while (t != NULL) {
- dns_name_t *name;
-
- INSIST(node == NULL);
- name = &t->name;
- /*
- * Find the node.
- * We create the node if it does not exist.
- * This will cause an empty node to be created if the diff
- * contains a deletion of an RR at a nonexistent name,
- * but such diffs should never be created in the first
- * place.
- */
- node = NULL;
- CHECK(dns_db_findnode(db, name, ISC_TRUE, &node));
-
- while (t != NULL && dns_name_equal(&t->name, name)) {
- dns_rdatatype_t type, covers;
- dns_diffop_t op;
- dns_rdatalist_t rdl;
- dns_rdataset_t rds;
-
- op = t->op;
- type = t->rdata.type;
- covers = rdata_covers(&t->rdata);
-
- /*
- * Collect a contiguous set of updates with
- * the same operation (add/delete) and RR type
- * into a single rdatalist so that the
- * database rrset merging/subtraction code
- * can work more efficiently than if each
- * RR were merged into / subtracted from
- * the database separately.
- *
- * This is done by linking rdata structures from the
- * diff into "rdatalist". This uses the rdata link
- * field, not the diff link field, so the structure
- * of the diff itself is not affected.
- */
-
- rdl.type = type;
- rdl.covers = covers;
- rdl.rdclass = t->rdata.rdclass;
- rdl.ttl = t->ttl;
- ISC_LIST_INIT(rdl.rdata);
- ISC_LINK_INIT(&rdl, link);
-
- while (t != NULL &&
- dns_name_equal(&t->name, name) &&
- t->op == op &&
- t->rdata.type == type &&
- rdata_covers(&t->rdata) == covers)
- {
- if (t->ttl != rdl.ttl) {
- isc_log_write(JOURNAL_COMMON_LOGARGS,
- ISC_LOG_WARNING,
- "TTL differs in rdataset, "
- "adjusting %lu -> %lu",
- (unsigned long) t->ttl,
- (unsigned long) rdl.ttl);
- }
- ISC_LIST_APPEND(rdl.rdata, &t->rdata, link);
- t = ISC_LIST_NEXT(t, link);
- }
-
- /*
- * Convert the rdatalist into a rdataset.
- */
- dns_rdataset_init(&rds);
- CHECK(dns_rdatalist_tordataset(&rdl, &rds));
-
- /*
- * Merge the rdataset into the database.
- */
- if (op == DNS_DIFFOP_ADD) {
- result = dns_db_addrdataset(db, node, ver,
- 0, &rds,
- DNS_DBADD_MERGE|
- DNS_DBADD_EXACT,
- NULL);
- } else if (op == DNS_DIFFOP_DEL) {
- result = dns_db_subtractrdataset(db, node, ver,
- &rds,
- DNS_DBSUB_EXACT,
- NULL);
- } else {
- INSIST(0);
- }
- if (result == DNS_R_UNCHANGED) {
- /*
- * This will not happen when executing a
- * dynamic update, because that code will
- * generate strictly minimal diffs.
- * It may happen when receiving an IXFR
- * from a server that is not as careful.
- * Issue a warning and continue.
- */
- isc_log_write(JOURNAL_COMMON_LOGARGS,
- ISC_LOG_WARNING,
- "update with no effect");
- } else if (result == ISC_R_SUCCESS ||
- result == DNS_R_NXRRSET) {
- /*
- * OK.
- */
- } else {
- CHECK(result);
- }
- }
- dns_db_detachnode(db, &node);
- }
- return (ISC_R_SUCCESS);
-
- failure:
- if (node != NULL)
- dns_db_detachnode(db, &node);
- return (result);
-}
-
-/* XXX this duplicates lots of code in dns_diff_apply(). */
-
-isc_result_t
-dns_diff_load(dns_diff_t *diff, dns_addrdatasetfunc_t addfunc,
- void *add_private)
-{
- dns_difftuple_t *t;
- isc_result_t result;
-
- REQUIRE(DNS_DIFF_VALID(diff));
-
- t = ISC_LIST_HEAD(diff->tuples);
- while (t != NULL) {
- dns_name_t *name;
-
- name = &t->name;
- while (t != NULL && dns_name_equal(&t->name, name)) {
- dns_rdatatype_t type, covers;
- dns_diffop_t op;
- dns_rdatalist_t rdl;
- dns_rdataset_t rds;
-
- op = t->op;
- type = t->rdata.type;
- covers = rdata_covers(&t->rdata);
-
- rdl.type = type;
- rdl.covers = covers;
- rdl.rdclass = t->rdata.rdclass;
- rdl.ttl = t->ttl;
- ISC_LIST_INIT(rdl.rdata);
- ISC_LINK_INIT(&rdl, link);
-
- while (t != NULL && dns_name_equal(&t->name, name) &&
- t->op == op && t->rdata.type == type &&
- rdata_covers(&t->rdata) == covers)
- {
- ISC_LIST_APPEND(rdl.rdata, &t->rdata, link);
- t = ISC_LIST_NEXT(t, link);
- }
-
- /*
- * Convert the rdatalist into a rdataset.
- */
- dns_rdataset_init(&rds);
- CHECK(dns_rdatalist_tordataset(&rdl, &rds));
- rds.trust = dns_trust_ultimate;
-
- INSIST(op == DNS_DIFFOP_ADD);
- result = (*addfunc)(add_private, name, &rds);
- if (result == DNS_R_UNCHANGED) {
- isc_log_write(JOURNAL_COMMON_LOGARGS,
- ISC_LOG_WARNING,
- "update with no effect");
- } else if (result == ISC_R_SUCCESS ||
- result == DNS_R_NXRRSET) {
- /*
- * OK.
- */
- } else {
- CHECK(result);
- }
- }
- }
- result = ISC_R_SUCCESS;
- failure:
- return (result);
-}
-
-/*
- * XXX uses qsort(); a merge sort would be more natural for lists,
- * and perhaps safer wrt thread stack overflow.
- */
-isc_result_t
-dns_diff_sort(dns_diff_t *diff, dns_diff_compare_func *compare) {
- unsigned int length = 0;
- unsigned int i;
- dns_difftuple_t **v;
- dns_difftuple_t *p;
- REQUIRE(DNS_DIFF_VALID(diff));
-
- for (p = ISC_LIST_HEAD(diff->tuples);
- p != NULL;
- p = ISC_LIST_NEXT(p, link))
- length++;
- if (length == 0)
- return (ISC_R_SUCCESS);
- v = isc_mem_get(diff->mctx, length * sizeof(dns_difftuple_t *));
- if (v == NULL)
- return (ISC_R_NOMEMORY);
- i = 0;
- for (i = 0; i < length; i++) {
- p = ISC_LIST_HEAD(diff->tuples);
- v[i] = p;
- ISC_LIST_UNLINK(diff->tuples, p, link);
- }
- INSIST(ISC_LIST_HEAD(diff->tuples) == NULL);
- qsort(v, length, sizeof(v[0]), compare);
- for (i = 0; i < length; i++) {
- ISC_LIST_APPEND(diff->tuples, v[i], link);
- }
- isc_mem_put(diff->mctx, v, length * sizeof(dns_difftuple_t *));
- return (ISC_R_SUCCESS);
-}
-
-
-/*
- * Create an rdataset containing the single RR of the given
- * tuple. The caller must allocate the the rdata, rdataset and
- * an rdatalist structure for it to refer to.
- */
-
-static isc_result_t
-diff_tuple_tordataset(dns_difftuple_t *t, dns_rdata_t *rdata,
- dns_rdatalist_t *rdl, dns_rdataset_t *rds)
-{
- REQUIRE(DNS_DIFFTUPLE_VALID(t));
- REQUIRE(rdl != NULL);
- REQUIRE(rds != NULL);
-
- rdl->type = t->rdata.type;
- rdl->rdclass = t->rdata.rdclass;
- rdl->ttl = t->ttl;
- ISC_LIST_INIT(rdl->rdata);
- ISC_LINK_INIT(rdl, link);
- dns_rdataset_init(rds);
- ISC_LINK_INIT(rdata, link);
- dns_rdata_clone(&t->rdata, rdata);
- ISC_LIST_APPEND(rdl->rdata, rdata, link);
- return (dns_rdatalist_tordataset(rdl, rds));
-}
-
-isc_result_t
-dns_diff_print(dns_diff_t *diff, FILE *file) {
- isc_result_t result;
- dns_difftuple_t *t;
- char *mem = NULL;
- unsigned int size = 2048;
-
- REQUIRE(DNS_DIFF_VALID(diff));
-
- mem = isc_mem_get(diff->mctx, size);
- if (mem == NULL)
- return (ISC_R_NOMEMORY);
-
- for (t = ISC_LIST_HEAD(diff->tuples); t != NULL;
- t = ISC_LIST_NEXT(t, link))
- {
- isc_buffer_t buf;
- isc_region_t r;
-
- dns_rdatalist_t rdl;
- dns_rdataset_t rds;
- dns_rdata_t rd = DNS_RDATA_INIT;
-
- result = diff_tuple_tordataset(t, &rd, &rdl, &rds);
- if (result != ISC_R_SUCCESS) {
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "diff_tuple_tordataset failed: %s",
- dns_result_totext(result));
- result = ISC_R_UNEXPECTED;
- goto cleanup;
- }
- again:
- isc_buffer_init(&buf, mem, size);
- result = dns_rdataset_totext(&rds, &t->name,
- ISC_FALSE, ISC_FALSE, &buf);
-
- /*
- * Get rid of final newline.
- */
- INSIST(buf.used >= 1 &&
- ((char *) buf.base)[buf.used-1] == '\n');
- buf.used--;
-
- if (result == ISC_R_NOSPACE) {
- isc_mem_put(diff->mctx, mem, size);
- size += 1024;
- mem = isc_mem_get(diff->mctx, size);
- if (mem == NULL) {
- result = ISC_R_NOMEMORY;
- goto cleanup;
- }
- goto again;
- }
- if (result == ISC_R_SUCCESS) {
- isc_buffer_usedregion(&buf, &r);
- if (file != NULL)
- fprintf(file, "%s %.*s\n",
- t->op == DNS_DIFFOP_ADD ?
- "add" : "del", (int) r.length,
- (char *) r.base);
- else
- isc_log_write(JOURNAL_COMMON_LOGARGS,
- ISC_LOG_DEBUG(7),
- "%s %.*s",
- t->op == DNS_DIFFOP_ADD ?
- "add" : "del",
- (int) r.length, (char *) r.base);
- } else
- goto cleanup;
- }
- result = ISC_R_SUCCESS;
- cleanup:
- if (mem != NULL)
- isc_mem_put(diff->mctx, mem, size);
- return (result);
-}
-
-/**************************************************************************/
-/*
* Journalling.
*/
@@ -1644,12 +1152,12 @@ dns_journal_commit(dns_journal_t *j) {
for (i = 0; i < j->header.index_size; i++) {
encode_uint32(j->index[i].serial, p);
p += 4;
- encode_uint32(j->index[i].serial, p);
+ encode_uint32(j->index[i].offset, p);
p += 4;
}
INSIST(p == j->rawindex + rawbytes);
- CHECK(journal_write(j, j->index, rawbytes));
+ CHECK(journal_write(j, j->rawindex, rawbytes));
}
/*
@@ -1753,7 +1261,7 @@ roll_forward(dns_journal_t *j, dns_db_t *db) {
* Locate a journal entry for the current database serial.
*/
CHECK(journal_find(j, db_serial, &pos));
- /*
+ /*
* XXX do more drastic things, like marking zone stale,
* if this fails?
*/
diff --git a/lib/dns/keytable.c b/lib/dns/keytable.c
index 18831b8e..883655e7 100644
--- a/lib/dns/keytable.c
+++ b/lib/dns/keytable.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: keytable.c,v 1.22 2000/08/26 01:36:50 bwelling Exp $ */
+/* $Id: keytable.c,v 1.23 2000/12/11 19:24:09 bwelling Exp $ */
#include <config.h>
@@ -31,7 +31,7 @@
struct dns_keytable {
/* Unlocked. */
- unsigned int magic;
+ unsigned int magic;
isc_mem_t *mctx;
isc_mutex_t lock;
isc_rwlock_t rwlock;
@@ -46,7 +46,7 @@ struct dns_keytable {
#define VALID_KEYTABLE(kt) ISC_MAGIC_VALID(kt, KEYTABLE_MAGIC)
struct dns_keynode {
- unsigned int magic;
+ unsigned int magic;
dst_key_t * key;
struct dns_keynode * next;
};
diff --git a/lib/dns/log.c b/lib/dns/log.c
index 3132c30d..4254dc7b 100644
--- a/lib/dns/log.c
+++ b/lib/dns/log.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log.c,v 1.28 2000/11/23 02:25:01 gson Exp $ */
+/* $Id: log.c,v 1.29 2000/12/09 02:17:07 bwelling Exp $ */
/* Principal Authors: DCL */
@@ -70,6 +70,7 @@ isc_logmodule_t dns_modules[] = {
{ "dns/tsig", 0 },
{ "dns/tkey", 0 },
{ "dns/sdb", 0 },
+ { "dns/diff", 0 },
{ NULL, 0 }
};
diff --git a/lib/dns/lookup.c b/lib/dns/lookup.c
index 8cb504b2..acb6aed5 100644
--- a/lib/dns/lookup.c
+++ b/lib/dns/lookup.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lookup.c,v 1.4 2000/11/02 00:55:40 bwelling Exp $ */
+/* $Id: lookup.c,v 1.7 2000/12/20 20:42:08 bwelling Exp $ */
#include <config.h>
@@ -116,13 +116,15 @@ build_event(dns_lookup_t *lookup) {
if (result != ISC_R_SUCCESS)
goto fail;
- rdataset = isc_mem_get(lookup->mctx, sizeof(dns_rdataset_t));
- if (rdataset == NULL) {
- result = ISC_R_NOMEMORY;
- goto fail;
+ if (dns_rdataset_isassociated(&lookup->rdataset)) {
+ rdataset = isc_mem_get(lookup->mctx, sizeof(dns_rdataset_t));
+ if (rdataset == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto fail;
+ }
+ dns_rdataset_init(rdataset);
+ dns_rdataset_clone(&lookup->rdataset, rdataset);
}
- dns_rdataset_init(rdataset);
- dns_rdataset_clone(&lookup->rdataset, rdataset);
if (dns_rdataset_isassociated(&lookup->sigrdataset)) {
sigrdataset = isc_mem_get(lookup->mctx,
@@ -160,6 +162,24 @@ build_event(dns_lookup_t *lookup) {
return (result);
}
+static isc_result_t
+view_find(dns_lookup_t *lookup, dns_name_t *foundname) {
+ isc_result_t result;
+ dns_name_t *name = dns_fixedname_name(&lookup->name);
+ dns_rdatatype_t type;
+
+ if (lookup->type == dns_rdatatype_sig)
+ type = dns_rdatatype_any;
+ else
+ type = lookup->type;
+
+ result = dns_view_find(lookup->view, name, type, 0, 0, ISC_FALSE,
+ &lookup->event->db, &lookup->event->node,
+ foundname, &lookup->rdataset,
+ &lookup->sigrdataset);
+ return (result);
+}
+
static void
lookup_find(dns_lookup_t *lookup, dns_fetchevent_t *event) {
isc_result_t result;
@@ -191,16 +211,19 @@ lookup_find(dns_lookup_t *lookup, dns_fetchevent_t *event) {
INSIST(!dns_rdataset_isassociated(&lookup->rdataset));
INSIST(!dns_rdataset_isassociated
(&lookup->sigrdataset));
- result = dns_view_find(lookup->view, name,
- lookup->type, 0, 0,
- ISC_FALSE, fname,
- &lookup->rdataset,
- &lookup->sigrdataset);
+ result = view_find(lookup, fname);
if (result == ISC_R_NOTFOUND) {
/*
* We don't know anything about the name.
* Launch a fetch.
*/
+ if (lookup->event->node != NULL) {
+ INSIST(lookup->event->db != NULL);
+ dns_db_detachnode(lookup->event->db,
+ &lookup->event->node);
+ }
+ if (lookup->event->db != NULL)
+ dns_db_detach(&lookup->event->db);
result = start_fetch(lookup);
if (result != ISC_R_SUCCESS)
send_event = ISC_TRUE;
@@ -212,14 +235,6 @@ lookup_find(dns_lookup_t *lookup, dns_fetchevent_t *event) {
dns_resolver_destroyfetch(&lookup->fetch);
INSIST(event->rdataset == &lookup->rdataset);
INSIST(event->sigrdataset == &lookup->sigrdataset);
- /*
- * Detach (if necessary) from things we know we
- * don't care about.
- */
- if (event->node != NULL)
- dns_db_detachnode(event->db, &event->node);
- if (event->db != NULL)
- dns_db_detach(&event->db);
}
/*
@@ -232,6 +247,14 @@ lookup_find(dns_lookup_t *lookup, dns_fetchevent_t *event) {
case ISC_R_SUCCESS:
result = build_event(lookup);
send_event = ISC_TRUE;
+ if (event == NULL)
+ break;
+ if (event->db != NULL)
+ dns_db_attach(event->db, &lookup->event->db);
+ if (event->node != NULL)
+ dns_db_attachnode(lookup->event->db,
+ event->node,
+ &lookup->event->node);
break;
case DNS_R_CNAME:
/*
@@ -288,14 +311,19 @@ lookup_find(dns_lookup_t *lookup, dns_fetchevent_t *event) {
send_event = ISC_TRUE;
}
- done:
if (dns_rdataset_isassociated(&lookup->rdataset))
dns_rdataset_disassociate(&lookup->rdataset);
if (dns_rdataset_isassociated(&lookup->sigrdataset))
dns_rdataset_disassociate(&lookup->sigrdataset);
- if (event != NULL)
+ done:
+ if (event != NULL) {
+ if (event->node != NULL)
+ dns_db_detachnode(event->db, &event->node);
+ if (event->db != NULL)
+ dns_db_detach(&event->db);
isc_event_free((isc_event_t **)&event);
+ }
/*
* Limit the number of restarts.
@@ -323,7 +351,7 @@ static void
levent_destroy(isc_event_t *event) {
dns_lookupevent_t *levent;
isc_mem_t *mctx;
-
+
REQUIRE(event->ev_type == DNS_EVENT_LOOKUPDONE);
mctx = event->ev_destroy_arg;
levent = (dns_lookupevent_t *)event;
@@ -341,6 +369,10 @@ levent_destroy(isc_event_t *event) {
dns_rdataset_disassociate(levent->sigrdataset);
isc_mem_put(mctx, levent->sigrdataset, sizeof(dns_rdataset_t));
}
+ if (levent->node != NULL)
+ dns_db_detachnode(levent->db, &levent->node);
+ if (levent->db != NULL)
+ dns_db_detach(&levent->db);
isc_mem_put(mctx, event, event->ev_size);
}
@@ -373,6 +405,8 @@ dns_lookup_create(isc_mem_t *mctx, dns_name_t *name, dns_rdatatype_t type,
lookup->event->name = NULL;
lookup->event->rdataset = NULL;
lookup->event->sigrdataset = NULL;
+ lookup->event->db = NULL;
+ lookup->event->node = NULL;
lookup->task = NULL;
isc_task_attach(task, &lookup->task);
diff --git a/lib/dns/master.c b/lib/dns/master.c
index 13c27ad6..55528d04 100644
--- a/lib/dns/master.c
+++ b/lib/dns/master.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: master.c,v 1.85 2000/12/04 04:17:00 marka Exp $ */
+/* $Id: master.c,v 1.88.2.1 2000/12/28 18:46:46 gson Exp $ */
#include <config.h>
@@ -612,6 +612,8 @@ generate(dns_loadctx_t *ctx, char *range, char *lhs, char *gtype, char *rhs) {
goto error_cleanup;
}
+ ISC_LIST_INIT(rdatalist.rdata);
+ ISC_LINK_INIT(&rdatalist, link);
for (i = start; i < stop; i += step) {
result = genname(lhs, i, lhsbuf, DNS_MASTER_BUFSZ);
if (result != ISC_R_SUCCESS)
@@ -648,7 +650,6 @@ generate(dns_loadctx_t *ctx, char *range, char *lhs, char *gtype, char *rhs) {
rdatalist.covers = 0;
rdatalist.rdclass = ctx->zclass;
rdatalist.ttl = ctx->ttl;
- ISC_LIST_INIT(rdatalist.rdata);
ISC_LIST_PREPEND(head, &rdatalist, link);
ISC_LIST_APPEND(rdatalist.rdata, &rdata, link);
result = commit(callbacks, ctx->lex, &head, owner,
@@ -1329,9 +1330,9 @@ load(dns_loadctx_t **ctxp) {
this->ttl = ctx->ttl;
ISC_LIST_INIT(this->rdata);
if (ctx->glue != NULL)
- ISC_LIST_PREPENDUNSAFE(glue_list, this, link);
+ ISC_LIST_INITANDPREPEND(glue_list, this, link);
else
- ISC_LIST_PREPENDUNSAFE(current_list, this,
+ ISC_LIST_INITANDPREPEND(current_list, this,
link);
} else if (this->ttl != ctx->ttl) {
(*callbacks->warn)(callbacks,
@@ -1608,8 +1609,10 @@ dns_master_loadfileinc(const char *master_file, dns_name_t *top,
void *done_arg, isc_mem_t *mctx)
{
dns_loadctx_t *ctx = NULL;
- isc_result_t tresult;
isc_result_t result;
+
+ REQUIRE(task != NULL);
+ REQUIRE(done != NULL);
result = loadctx_create(mctx, age_ttl, top, zclass, origin,
callbacks, task, done, done_arg, &ctx);
@@ -1620,15 +1623,9 @@ dns_master_loadfileinc(const char *master_file, dns_name_t *top,
if (result != ISC_R_SUCCESS)
goto cleanup;
- result = load(&ctx);
- if (result == DNS_R_CONTINUE) {
- tresult = task_send(ctx);
- if (tresult == ISC_R_SUCCESS)
- return (result);
- result = tresult;
- }
- if (ctx->done != NULL)
- (ctx->done)(ctx->done_arg, result);
+ result = task_send(ctx);
+ if (result == ISC_R_SUCCESS)
+ return (DNS_R_CONTINUE);
cleanup:
if (ctx != NULL)
@@ -1672,10 +1669,11 @@ dns_master_loadstreaminc(FILE *stream, dns_name_t *top, dns_name_t *origin,
isc_mem_t *mctx)
{
isc_result_t result;
- isc_result_t tresult;
dns_loadctx_t *ctx = NULL;
REQUIRE(stream != NULL);
+ REQUIRE(task != NULL);
+ REQUIRE(done != NULL);
result = loadctx_create(mctx, age_ttl, top, zclass, origin,
callbacks, task, done, done_arg, &ctx);
@@ -1686,15 +1684,9 @@ dns_master_loadstreaminc(FILE *stream, dns_name_t *top, dns_name_t *origin,
if (result != ISC_R_SUCCESS)
goto cleanup;
- result = load(&ctx);
- if (result == DNS_R_CONTINUE) {
- tresult = task_send(ctx);
- if (tresult == ISC_R_SUCCESS)
- return (result);
- result = tresult;
- }
- if (ctx->done != NULL)
- (ctx->done)(ctx->done_arg, result);
+ result = task_send(ctx);
+ if (result == ISC_R_SUCCESS)
+ return (DNS_R_CONTINUE);
cleanup:
if (ctx != NULL)
@@ -1740,10 +1732,11 @@ dns_master_loadbufferinc(isc_buffer_t *buffer, dns_name_t *top,
isc_mem_t *mctx)
{
isc_result_t result;
- isc_result_t tresult;
dns_loadctx_t *ctx = NULL;
REQUIRE(buffer != NULL);
+ REQUIRE(task != NULL);
+ REQUIRE(done != NULL);
result = loadctx_create(mctx, age_ttl, top, zclass, origin,
callbacks, task, done, done_arg, &ctx);
@@ -1754,15 +1747,9 @@ dns_master_loadbufferinc(isc_buffer_t *buffer, dns_name_t *top,
if (result != ISC_R_SUCCESS)
goto cleanup;
- result = load(&ctx);
- if (result == DNS_R_CONTINUE) {
- tresult = task_send(ctx);
- if (tresult == ISC_R_SUCCESS)
- return (result);
- result = tresult;
- }
- if (ctx->done != NULL)
- (ctx->done)(ctx->done_arg, result);
+ result = task_send(ctx);
+ if (result == ISC_R_SUCCESS)
+ return (DNS_R_CONTINUE);
cleanup:
if (ctx != NULL)
diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c
index e7467a0b..d37c203b 100644
--- a/lib/dns/masterdump.c
+++ b/lib/dns/masterdump.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: masterdump.c,v 1.36 2000/11/09 19:33:49 gson Exp $ */
+/* $Id: masterdump.c,v 1.38 2000/12/11 19:24:12 bwelling Exp $ */
#include <config.h>
@@ -163,7 +163,7 @@ dns_master_style_explicitttl = {
*/
dns_master_style_t
dns_masterfile_style_debug = {
- DNS_STYLEFLAG_REL_OWNER,
+ DNS_STYLEFLAG_REL_OWNER,
24, 32, 40, 48, 80, 8
};
@@ -306,7 +306,7 @@ totext_ctx_init(const dns_master_style_t *style, dns_totext_ctx_t *ctx) {
ctx->style.tab_width, target)) \
!= ISC_R_SUCCESS) \
return (result); \
- } while (0)
+ } while (0)
/*
@@ -678,8 +678,8 @@ dump_order(const dns_rdataset_t *rds) {
static int
dump_order_compare(const void *a, const void *b) {
- return (dump_order(*((const dns_rdataset_t **) a)) -
- dump_order(*((const dns_rdataset_t **) b)));
+ return (dump_order(*((const dns_rdataset_t * const *) a)) -
+ dump_order(*((const dns_rdataset_t * const *) b)));
}
/*
@@ -821,7 +821,7 @@ dns_master_dumptostream(isc_mem_t *mctx, dns_db_t *db,
result = dns_db_createiterator(db,
((ctx.style.flags & DNS_STYLEFLAG_REL_OWNER) != 0) ?
- ISC_TRUE : ISC_FALSE,
+ ISC_TRUE : ISC_FALSE,
&dbiter);
if (result != ISC_R_SUCCESS)
goto create_iter_failure;
diff --git a/lib/dns/message.c b/lib/dns/message.c
index 5a1fd50d..fe932273 100644
--- a/lib/dns/message.c
+++ b/lib/dns/message.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: message.c,v 1.163 2000/12/02 05:28:05 gson Exp $ */
+/* $Id: message.c,v 1.164 2000/12/11 19:24:13 bwelling Exp $ */
/***
*** Imports
@@ -53,10 +53,10 @@
&& ((s) < DNS_SECTION_MAX))
#define VALID_SECTION(s) (((s) >= DNS_SECTION_ANY) \
&& ((s) < DNS_SECTION_MAX))
-#define ADD_STRING(b, s) {if (strlen(s) >= \
- isc_buffer_availablelength(b)) \
- return(ISC_R_NOSPACE); else \
- isc_buffer_putstr(b, s);}
+#define ADD_STRING(b, s) {if (strlen(s) >= \
+ isc_buffer_availablelength(b)) \
+ return(ISC_R_NOSPACE); else \
+ isc_buffer_putstr(b, s);}
#define VALID_PSEUDOSECTION(s) (((s) >= DNS_PSEUDOSECTION_ANY) \
&& ((s) < DNS_PSEUDOSECTION_MAX))
diff --git a/lib/dns/name.c b/lib/dns/name.c
index 6eccfa84..55c2e130 100644
--- a/lib/dns/name.c
+++ b/lib/dns/name.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: name.c,v 1.108 2000/11/27 19:45:45 gson Exp $ */
+/* $Id: name.c,v 1.110 2000/12/28 00:42:55 bwelling Exp $ */
#include <config.h>
@@ -2290,16 +2290,6 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source,
*ndata++ = c;
saw_bitstring = ISC_TRUE;
state = fw_bitstring;
- } else if (c == DNS_LABELTYPE_GLOBALCOMP16) {
- /*
- * 16-bit pointer.
- */
- if ((dctx->allowed & DNS_COMPRESS_GLOBAL16) ==
- 0)
- return (DNS_R_DISALLOWED);
- new_current = 0;
- n = 2;
- state = fw_newcurrent;
} else
return (DNS_R_BADLABELTYPE);
break;
@@ -2431,9 +2421,16 @@ dns_name_towire(dns_name_t *name, dns_compress_t *cctx, isc_buffer_t *target) {
gf = ISC_FALSE;
/*
+ * If the offset is too high for 14 bit global compression, we're
+ * out of luck.
+ */
+ if (gf && go >= 0x4000)
+ gf = ISC_FALSE;
+
+ /*
* Will the compression pointer reduce the message size?
*/
- if (gf && (gp.length + ((go < 16384) ? 2 : 3)) >= name->length)
+ if (gf && (gp.length + 2) >= name->length)
gf = ISC_FALSE;
if (gf) {
@@ -2442,19 +2439,10 @@ dns_name_towire(dns_name_t *name, dns_compress_t *cctx, isc_buffer_t *target) {
(void)memcpy((unsigned char *)target->base + target->used,
gp.ndata, (size_t)gp.length);
isc_buffer_add(target, gp.length);
- if (go < 16384) {
- go |= 0xc000;
- if (target->length - target->used < 2)
- return (ISC_R_NOSPACE);
- isc_buffer_putuint16(target, go);
- } else {
- if (target->length - target->used < 3)
- return (ISC_R_NOSPACE);
- *((unsigned char*)target->base + target->used) =
- DNS_LABELTYPE_GLOBALCOMP16;
- isc_buffer_add(target, 1);
- isc_buffer_putuint16(target, go);
- }
+ go |= 0xc000;
+ if (target->length - target->used < 2)
+ return (ISC_R_NOSPACE);
+ isc_buffer_putuint16(target, go);
if (gp.length != 0)
dns_compress_add(cctx, &gp, &gs, offset);
} else {
@@ -2700,7 +2688,7 @@ dns_name_split(dns_name_t *name,
* wow. How bizarre could that be?
*/
INSIST(! (src <= dst && src + len > dst) ||
- (dst <= src && dst + len > src));
+ (dst <= src && dst + len > src));
memcpy(dst, src, len);
diff --git a/lib/dns/rbt.c b/lib/dns/rbt.c
index 6716ab8a..45f69d79 100644
--- a/lib/dns/rbt.c
+++ b/lib/dns/rbt.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rbt.c,v 1.95 2000/11/18 00:55:24 bwelling Exp $ */
+/* $Id: rbt.c,v 1.96 2000/12/11 19:24:16 bwelling Exp $ */
/* Principal Authors: DCL */
@@ -842,14 +842,14 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname,
while (current != NULL) {
NODENAME(current, &current_name);
compared = dns_name_fullcompare(search_name, &current_name,
- &order,
- &common_labels, &common_bits);
+ &order,
+ &common_labels, &common_bits);
last_compared = current;
if (compared == dns_namereln_equal)
break;
- if (compared == dns_namereln_none) {
+ if (compared == dns_namereln_none) {
#ifdef DNS_RBT_USEHASH
dns_name_t hash_name;
dns_rbtnode_t *hnode;
@@ -1162,7 +1162,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname,
while (current != NULL) {
NODENAME(current, &current_name);
compared = dns_name_fullcompare(
- search_name,
+ search_name,
&current_name,
&order,
&common_labels,
@@ -1603,13 +1603,13 @@ inithash(dns_rbt_t *rbt) {
unsigned int bytes;
rbt->hashsize = RBT_HASH_SIZE * 2;
- bytes = rbt->hashsize * sizeof(dns_rbtnode_t *);
+ bytes = rbt->hashsize * sizeof(dns_rbtnode_t *);
rbt->hashtable = isc_mem_get(rbt->mctx, bytes);
if (rbt->hashtable == NULL)
return (ISC_R_NOMEMORY);
- memset(rbt->hashtable, 0, bytes);
+ memset(rbt->hashtable, 0, bytes);
inithash_internal(rbt, rbt->root);
diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c
index 01bc4129..63802926 100644
--- a/lib/dns/rbtdb.c
+++ b/lib/dns/rbtdb.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rbtdb.c,v 1.136 2000/12/01 01:22:41 marka Exp $ */
+/* $Id: rbtdb.c,v 1.139 2000/12/07 23:37:52 marka Exp $ */
/*
* Principal Author: Bob Halley
@@ -501,7 +501,7 @@ add_changed(dns_rbtdb_t *rbtdb, rbtdb_version_t *version,
INSIST(node->references != 0);
changed->node = node;
changed->dirty = ISC_FALSE;
- ISC_LIST_APPENDUNSAFE(version->changed_list, changed, link);
+ ISC_LIST_INITANDAPPEND(version->changed_list, changed, link);
} else
version->commit_ok = ISC_FALSE;
@@ -3276,11 +3276,17 @@ add(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion,
unsigned int flags = 0;
INSIST(rbtversion->serial >= header->serial);
merged = NULL;
+ result = ISC_R_SUCCESS;
+
if ((options & DNS_DBADD_EXACT) != 0)
flags |= DNS_RDATASLAB_EXACT;
- if (newheader->ttl != header->ttl)
+ if ((options & DNS_DBADD_EXACTTTL) != 0 &&
+ newheader->ttl != header->ttl)
+ result = DNS_R_NOTEXACT;
+ else if (newheader->ttl != header->ttl)
flags |= DNS_RDATASLAB_FORCE;
- result = dns_rdataslab_merge(
+ if (result == ISC_R_SUCCESS)
+ result = dns_rdataslab_merge(
(unsigned char *)header,
(unsigned char *)newheader,
(unsigned int)(sizeof *newheader),
@@ -3492,7 +3498,7 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
if (result != ISC_R_SUCCESS)
return (result);
newheader = (rdatasetheader_t *)region.base;
- newheader->ttl = 0;
+ newheader->ttl = rdataset->ttl;
newheader->type = RBTDB_RDATATYPE_VALUE(rdataset->type,
rdataset->covers);
newheader->attributes = 0;
@@ -3526,9 +3532,14 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
if (header != NULL && EXISTS(header)) {
unsigned int flags = 0;
subresult = NULL;
- if ((options & DNS_DBSUB_EXACT) != 0)
+ result = ISC_R_SUCCESS;
+ if ((options & DNS_DBSUB_EXACT) != 0) {
flags |= DNS_RDATASLAB_EXACT;
- result = dns_rdataslab_subtract(
+ if (newheader->ttl != header->ttl)
+ result = DNS_R_NOTEXACT;
+ }
+ if (result == ISC_R_SUCCESS)
+ result = dns_rdataslab_subtract(
(unsigned char *)header,
(unsigned char *)newheader,
(unsigned int)(sizeof *newheader),
diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c
index 3b7a4c71..dee2647c 100644
--- a/lib/dns/rdata.c
+++ b/lib/dns/rdata.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdata.c,v 1.132 2000/11/20 21:58:01 gson Exp $ */
+/* $Id: rdata.c,v 1.137 2000/12/19 04:46:36 marka Exp $ */
#include <config.h>
#include <ctype.h>
@@ -171,7 +171,7 @@ static inline isc_result_t
name_duporclone(dns_name_t *source, isc_mem_t *mctx, dns_name_t *target) {
if (mctx != NULL)
- return (dns_name_dup(source, mctx, target));
+ return (dns_name_dup(source, mctx, target));
dns_name_clone(source, target);
return (ISC_R_SUCCESS);
}
@@ -328,10 +328,19 @@ dns_rdata_init(dns_rdata_t *rdata) {
/* ISC_LIST_INIT(rdata->list); */
}
+#if 0
#define DNS_RDATA_INITIALIZED(rdata) \
((rdata)->data == NULL && (rdata)->length == 0 && \
(rdata)->rdclass == 0 && (rdata)->type == 0 && (rdata)->flags == 0 && \
!ISC_LINK_LINKED((rdata), link))
+#else
+#ifdef ISC_LIST_CHECKINIT
+#define DNS_RDATA_INITIALIZED(rdata) \
+ (!ISC_LINK_LINKED((rdata), link))
+#else
+#define DNS_RDATA_INITIALIZED(rdata) ISC_TRUE
+#endif
+#endif
#define DNS_RDATA_VALIDFLAGS(rdata) \
(((rdata)->flags & ~DNS_RDATA_UPDATE) == 0)
@@ -496,7 +505,7 @@ dns_rdata_fromwire(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
isc_result_t
dns_rdata_towire(dns_rdata_t *rdata, dns_compress_t *cctx,
- isc_buffer_t *target)
+ isc_buffer_t *target)
{
isc_result_t result = ISC_R_NOTIMPLEMENTED;
isc_boolean_t use_default = ISC_FALSE;
@@ -575,7 +584,8 @@ unknown_fromtext(dns_rdataclass_t rdclass, dns_rdatatype_t type,
if (result != ISC_R_SUCCESS)
return (result);
- result = isc_hex_tobuffer(lexer, buf, token.value.as_ulong);
+ result = isc_hex_tobuffer(lexer, buf,
+ (unsigned int)token.value.as_ulong);
if (result != ISC_R_SUCCESS)
goto failure;
if (isc_buffer_usedlength(buf) != token.value.as_ulong) {
@@ -921,7 +931,7 @@ dns_mnemonic_fromtext(unsigned int *valuep, isc_textregion_t *source,
int i;
if (isdigit(source->base[0] & 0xff) &&
- source->length <= NUMBERSIZE - 1) {
+ source->length <= NUMBERSIZE - 1) {
unsigned int n;
char *e;
char buffer[NUMBERSIZE];
@@ -1555,7 +1565,7 @@ mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length) {
isc_region_t tr;
isc_buffer_availableregion(target, &tr);
- if (length > tr.length)
+ if (length > tr.length)
return (ISC_R_NOSPACE);
memcpy(tr.base, base, length);
isc_buffer_add(target, length);
diff --git a/lib/dns/rdataset.c b/lib/dns/rdataset.c
index 623cd1c4..782f193e 100644
--- a/lib/dns/rdataset.c
+++ b/lib/dns/rdataset.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdataset.c,v 1.52 2000/11/10 03:16:19 gson Exp $ */
+/* $Id: rdataset.c,v 1.54 2000/12/14 22:10:37 marka Exp $ */
#include <config.h>
@@ -278,7 +278,7 @@ dns_rdataset_towiresorted(dns_rdataset_t *rdataset,
void *order_arg,
unsigned int *countp)
{
- dns_rdata_t rdata;
+ dns_rdata_t rdata = DNS_RDATA_INIT;
isc_region_t r;
isc_result_t result;
unsigned int i, count;
@@ -411,7 +411,7 @@ dns_rdataset_towiresorted(dns_rdataset_t *rdataset,
if (shuffle)
rdata = *(sorted[i].rdata);
else {
- dns_rdata_init(&rdata);
+ dns_rdata_reset(&rdata);
dns_rdataset_current(rdataset, &rdata);
}
result = dns_rdata_towire(&rdata, cctx, target);
@@ -466,7 +466,7 @@ isc_result_t
dns_rdataset_additionaldata(dns_rdataset_t *rdataset,
dns_additionaldatafunc_t add, void *arg)
{
- dns_rdata_t rdata;
+ dns_rdata_t rdata = DNS_RDATA_INIT;
isc_result_t result;
/*
@@ -482,11 +482,11 @@ dns_rdataset_additionaldata(dns_rdataset_t *rdataset,
return (result);
do {
- dns_rdata_init(&rdata);
dns_rdataset_current(rdataset, &rdata);
result = dns_rdata_additionaldata(&rdata, add, arg);
if (result == ISC_R_SUCCESS)
result = dns_rdataset_next(rdataset);
+ dns_rdata_reset(&rdata);
} while (result == ISC_R_SUCCESS);
if (result != ISC_R_NOMORE)
diff --git a/lib/dns/rdataslab.c b/lib/dns/rdataslab.c
index fa69ce14..2f398c46 100644
--- a/lib/dns/rdataslab.c
+++ b/lib/dns/rdataslab.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdataslab.c,v 1.27 2000/12/01 01:22:42 marka Exp $ */
+/* $Id: rdataslab.c,v 1.28 2000/12/06 22:19:04 bwelling Exp $ */
#include <config.h>
@@ -244,8 +244,6 @@ dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab,
REQUIRE(tslabp != NULL && *tslabp == NULL);
REQUIRE(oslab != NULL && nslab != NULL);
- REQUIRE((flags & (DNS_RDATASLAB_FORCE|DNS_RDATASLAB_EXACT)) !=
- (DNS_RDATASLAB_FORCE|DNS_RDATASLAB_EXACT));
ocurrent = oslab + reservelen;
ocount = *ocurrent++ * 256;
diff --git a/lib/dns/request.c b/lib/dns/request.c
index 0ddc43c3..78841326 100644
--- a/lib/dns/request.c
+++ b/lib/dns/request.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: request.c,v 1.42 2000/11/03 08:54:18 marka Exp $ */
+/* $Id: request.c,v 1.45 2000/12/22 19:39:01 gson Exp $ */
#include <config.h>
@@ -88,11 +88,15 @@ struct dns_request {
#define DNS_REQUEST_F_CONNECTING 0x0001
#define DNS_REQUEST_F_CANCELED 0x0002
-#define DNS_REQUEST_F_TCP 0x0008 /* This request used TCP */
+#define DNS_REQUEST_F_TIMEDOUT 0x0004 /* cancelled due to a timeout */
+#define DNS_REQUEST_F_TCP 0x0008 /* This request used TCP */
#define DNS_REQUEST_CANCELED(r) \
(((r)->flags & DNS_REQUEST_F_CANCELED) != 0)
#define DNS_REQUEST_CONNECTING(r) \
(((r)->flags & DNS_REQUEST_F_CONNECTING) != 0)
+#define DNS_REQUEST_TIMEDOUT(r) \
+ (((r)->flags & DNS_REQUEST_F_TIMEDOUT) != 0)
+
/***
*** Forward
@@ -198,30 +202,30 @@ void
dns_requestmgr_whenshutdown(dns_requestmgr_t *requestmgr, isc_task_t *task,
isc_event_t **eventp)
{
- isc_task_t *clone;
- isc_event_t *event;
+ isc_task_t *clone;
+ isc_event_t *event;
req_log(ISC_LOG_DEBUG(3), "dns_requestmgr_whenshutdown");
- REQUIRE(VALID_REQUESTMGR(requestmgr));
- REQUIRE(eventp != NULL);
-
- event = *eventp;
- *eventp = NULL;
-
- LOCK(&requestmgr->lock);
-
- if (requestmgr->exiting) {
- /*
- * We're already shutdown. Send the event.
- */
- event->ev_sender = requestmgr;
- isc_task_send(task, &event);
- } else {
- clone = NULL;
- isc_task_attach(task, &clone);
- event->ev_sender = clone;
- ISC_LIST_APPEND(requestmgr->whenshutdown, event, ev_link);
+ REQUIRE(VALID_REQUESTMGR(requestmgr));
+ REQUIRE(eventp != NULL);
+
+ event = *eventp;
+ *eventp = NULL;
+
+ LOCK(&requestmgr->lock);
+
+ if (requestmgr->exiting) {
+ /*
+ * We're already shutdown. Send the event.
+ */
+ event->ev_sender = requestmgr;
+ isc_task_send(task, &event);
+ } else {
+ clone = NULL;
+ isc_task_attach(task, &clone);
+ event->ev_sender = clone;
+ ISC_LIST_APPEND(requestmgr->whenshutdown, event, ev_link);
}
UNLOCK(&requestmgr->lock);
}
@@ -229,7 +233,7 @@ dns_requestmgr_whenshutdown(dns_requestmgr_t *requestmgr, isc_task_t *task,
void
dns_requestmgr_shutdown(dns_requestmgr_t *requestmgr) {
- REQUIRE(VALID_REQUESTMGR(requestmgr));
+ REQUIRE(VALID_REQUESTMGR(requestmgr));
req_log(ISC_LOG_DEBUG(3), "dns_requestmgr_shutdown: %p", requestmgr);
@@ -268,8 +272,8 @@ requestmgr_attach(dns_requestmgr_t *source, dns_requestmgr_t **targetp) {
* Locked by caller.
*/
- REQUIRE(VALID_REQUESTMGR(source));
- REQUIRE(targetp != NULL && *targetp == NULL);
+ REQUIRE(VALID_REQUESTMGR(source));
+ REQUIRE(targetp != NULL && *targetp == NULL);
REQUIRE(!source->exiting);
@@ -283,7 +287,7 @@ requestmgr_attach(dns_requestmgr_t *source, dns_requestmgr_t **targetp) {
static void
requestmgr_detach(dns_requestmgr_t **requestmgrp) {
dns_requestmgr_t *requestmgr;
- isc_boolean_t need_destroy =ISC_FALSE;
+ isc_boolean_t need_destroy = ISC_FALSE;
REQUIRE(requestmgrp != NULL);
requestmgr = *requestmgrp;
@@ -312,8 +316,8 @@ requestmgr_detach(dns_requestmgr_t **requestmgrp) {
void
dns_requestmgr_attach(dns_requestmgr_t *source, dns_requestmgr_t **targetp) {
- REQUIRE(VALID_REQUESTMGR(source));
- REQUIRE(targetp != NULL && *targetp == NULL);
+ REQUIRE(VALID_REQUESTMGR(source));
+ REQUIRE(targetp != NULL && *targetp == NULL);
REQUIRE(!source->exiting);
LOCK(&source->lock);
@@ -1103,7 +1107,8 @@ dns_request_cancel(dns_request_t *request) {
LOCK(&request->requestmgr->locks[request->hash]);
if (!DNS_REQUEST_CANCELED(request)) {
req_cancel(request);
- req_sendevent(request, ISC_R_CANCELED);
+ if (!DNS_REQUEST_CONNECTING(request))
+ req_sendevent(request, ISC_R_CANCELED);
}
UNLOCK(&request->requestmgr->locks[request->hash]);
return (ISC_R_SUCCESS);
@@ -1141,7 +1146,6 @@ dns_request_usedtcp(dns_request_t *request) {
void
dns_request_destroy(dns_request_t **requestp) {
dns_request_t *request;
- isc_boolean_t need_destroy = ISC_FALSE;
REQUIRE(requestp != NULL && VALID_REQUEST(*requestp));
@@ -1153,12 +1157,10 @@ dns_request_destroy(dns_request_t **requestp) {
LOCK(&request->requestmgr->lock);
ISC_LIST_UNLINK(request->requestmgr->requests, request, link);
UNLOCK(&request->requestmgr->lock);
- if (!DNS_REQUEST_CONNECTING(request))
- need_destroy = ISC_TRUE;
+ INSIST(!DNS_REQUEST_CONNECTING(request));
UNLOCK(&request->requestmgr->locks[request->hash]);
- if (need_destroy)
- req_destroy(request);
+ req_destroy(request);
*requestp = NULL;
}
@@ -1179,19 +1181,29 @@ req_connected(isc_task_t *task, isc_event_t *event) {
req_log(ISC_LOG_DEBUG(3), "req_connected: request %p", request);
+ LOCK(&request->requestmgr->locks[request->hash]);
request->flags &= ~DNS_REQUEST_F_CONNECTING;
if (DNS_REQUEST_CANCELED(request)) {
- req_destroy(request);
+ /*
+ * Send delayed event.
+ */
+ if (DNS_REQUEST_TIMEDOUT(request))
+ req_sendevent(request, ISC_R_TIMEDOUT);
+ else
+ req_sendevent(request, ISC_R_CANCELED);
} else {
dns_dispatch_starttcp(request->dispatch);
result = sevent->result;
if (result == ISC_R_SUCCESS)
result = req_send(request, task, NULL);
- if (sevent->result != ISC_R_SUCCESS)
- dns_request_cancel(request);
+ if (sevent->result != ISC_R_SUCCESS) {
+ req_cancel(request);
+ req_sendevent(request, ISC_R_CANCELED);
+ }
}
+ UNLOCK(&request->requestmgr->locks[request->hash]);
isc_event_free(&event);
}
@@ -1267,8 +1279,10 @@ req_timeout(isc_task_t *task, isc_event_t *event) {
UNUSED(task);
LOCK(&request->requestmgr->locks[request->hash]);
+ request->flags |= DNS_REQUEST_F_TIMEDOUT;
req_cancel(request);
- req_sendevent(request, ISC_R_TIMEDOUT);
+ if (!DNS_REQUEST_CONNECTING(request))
+ req_sendevent(request, ISC_R_TIMEDOUT);
UNLOCK(&request->requestmgr->locks[request->hash]);
isc_event_free(&event);
}
diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c
index a77627df..75308b4e 100644
--- a/lib/dns/resolver.c
+++ b/lib/dns/resolver.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: resolver.c,v 1.184 2000/11/27 19:56:16 halley Exp $ */
+/* $Id: resolver.c,v 1.187 2000/12/20 23:18:37 gson Exp $ */
#include <config.h>
@@ -93,10 +93,10 @@
#define SEND_BUFFER_SIZE 2048 /* XXXRTH Constant. */
/*
- * This defines the maximum number of restarts we will permit before we
+ * This defines the maximum number of timeouts we will permit before we
* disable EDNS0 on the query.
*/
-#define NOEDNS0_RESTARTS 3
+#define MAX_EDNS0_TIMEOUTS 3
typedef struct fetchctx fetchctx_t;
@@ -177,7 +177,17 @@ struct fetchctx {
* # of events we're waiting for.
*/
unsigned int pending;
+ /*
+ * # of times we have started from the beginning
+ * of the name server set.
+ */
unsigned int restarts;
+ /*
+ * # of timeouts that have occurred since we last
+ * successfully received a response packet. This
+ * is used for EDNS0 black hole detectino.
+ */
+ unsigned int timeouts;
};
#define FCTX_MAGIC 0x46212121U /* F!!! */
@@ -904,9 +914,9 @@ resquery_send(resquery_t *query) {
* Use EDNS0, unless the caller doesn't want it, or we know that
* the remote server doesn't like it.
*/
- if (fctx->restarts > NOEDNS0_RESTARTS) {
+ if (fctx->timeouts >= MAX_EDNS0_TIMEOUTS) {
query->options |= DNS_FETCHOPT_NOEDNS0;
- FCTXTRACE("too many restarts, disabling EDNS0");
+ FCTXTRACE("too many timeouts, disabling EDNS0");
}
if ((query->options & DNS_FETCHOPT_NOEDNS0) == 0) {
@@ -1276,7 +1286,7 @@ add_bad(fetchctx_t *fctx, isc_sockaddr_t *address) {
if (sa == NULL)
return;
*sa = *address;
- ISC_LIST_APPENDUNSAFE(fctx->bad, sa, link);
+ ISC_LIST_INITANDAPPEND(fctx->bad, sa, link);
}
static void
@@ -1770,6 +1780,7 @@ fctx_timeout(isc_task_t *task, isc_event_t *event) {
if (event->ev_type == ISC_TIMEREVENT_LIFE) {
fctx_done(fctx, ISC_R_TIMEDOUT);
} else {
+ fctx->timeouts++;
/*
* We could cancel the running queries here, or we could let
* them keep going. Right now we choose the latter...
@@ -2047,6 +2058,7 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type,
fctx->find = NULL;
fctx->pending = 0;
fctx->restarts = 0;
+ fctx->timeouts = 0;
if (dns_name_requiresedns(name))
fctx->attributes = FCTX_ATTR_NEEDEDNS0;
else
@@ -3744,7 +3756,7 @@ answer_response(fetchctx_t *fctx) {
*/
dns_fixedname_init(&fqname);
result = dns_name_concatenate(
- dns_fixedname_name(&dname),
+ dns_fixedname_name(&dname),
NULL,
dns_fixedname_name(&fqname),
NULL);
@@ -3892,6 +3904,8 @@ resquery_response(isc_task_t *task, isc_event_t *event) {
truncated = ISC_FALSE;
finish = NULL;
+ fctx->timeouts = 0;
+
/*
* XXXRTH We should really get the current time just once. We
* need a routine to convert from an isc_time_t to an
diff --git a/lib/dns/result.c b/lib/dns/result.c
index 7b246edf..992f67d4 100644
--- a/lib/dns/result.c
+++ b/lib/dns/result.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: result.c,v 1.81 2000/11/29 05:59:33 tale Exp $ */
+/* $Id: result.c,v 1.84 2000/12/20 23:31:05 bwelling Exp $ */
#include <config.h>
@@ -100,9 +100,9 @@ static const char *text[DNS_R_NRESULTS] = {
"no valid NXT", /* 60 DNS_R_NOVALIDNXT */
"not insecure", /* 61 DNS_R_NOTINSECURE */
- "zone too large", /* 62 DNS_R_ZONETOOLARGE */
+ "<unused 62> ", /* 62 unused */
"recoverable error occurred", /* 63 DNS_R_RECOVERABLE */
- "unknown opt attribute record", /* 64 DNS_R_UNKNOWNOPT */
+ "unknown opt attribute record", /* 64 DNS_R_UNKNOWNOPT */
"unexpected message id", /* 65 DNS_R_UNEXPECTEDID */
"seen include file", /* 66 DNS_R_SEENINCLUDE */
@@ -112,7 +112,8 @@ static const char *text[DNS_R_NRESULTS] = {
"invalid use of a meta type", /* 70 DNS_R_METATYPE */
"CNAME and other data", /* 71 DNS_R_CNAMEANDOTHER */
- "multiple RRs of singleton type" /* 72 DNS_R_SINGLETON */
+ "multiple RRs of singleton type", /* 72 DNS_R_SINGLETON */
+ "hint nxrrset" /* 73 DNS_R_HINTNXRRSET */
};
static const char *rcode_text[DNS_R_NRCODERESULTS] = {
diff --git a/lib/dns/sdb.c b/lib/dns/sdb.c
index 97929807..394b0e41 100644
--- a/lib/dns/sdb.c
+++ b/lib/dns/sdb.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sdb.c,v 1.20 2000/12/01 01:22:43 marka Exp $ */
+/* $Id: sdb.c,v 1.23 2000/12/21 01:58:37 bwelling Exp $ */
#include <config.h>
@@ -114,6 +114,20 @@ typedef struct sdb_rdatasetiter {
/* This is a reasonable value */
#define SDB_DEFAULT_TTL (60 * 60 * 24)
+#define MAYBE_LOCK(sdb) \
+ do { \
+ unsigned int flags = sdb->implementation->flags; \
+ if ((flags & DNS_SDBFLAG_THREADSAFE) == 0) \
+ LOCK(&sdb->lock); \
+ } while (0)
+
+#define MAYBE_UNLOCK(sdb) \
+ do { \
+ unsigned int flags = sdb->implementation->flags; \
+ if ((flags & DNS_SDBFLAG_THREADSAFE) == 0) \
+ UNLOCK(&sdb->lock); \
+ } while (0)
+
static int dummy;
static isc_result_t dns_sdb_create(isc_mem_t *mctx, dns_name_t *origin,
@@ -193,6 +207,9 @@ dns_sdb_register(const char *drivername, const dns_sdbmethods_t *methods,
REQUIRE(methods->lookup != NULL);
REQUIRE(mctx != NULL);
REQUIRE(sdbimp != NULL && *sdbimp == NULL);
+ REQUIRE((flags & ~(DNS_SDBFLAG_RELATIVEOWNER |
+ DNS_SDBFLAG_RELATIVERDATA |
+ DNS_SDBFLAG_THREADSAFE)) == 0);
imp = isc_mem_get(mctx, sizeof(dns_sdbimplementation_t));
if (imp == NULL)
@@ -663,14 +680,18 @@ findnode(dns_db_t *db, dns_name_t *name, isc_boolean_t create,
isorigin = dns_name_equal(name, &sdb->common.origin);
+ MAYBE_LOCK(sdb);
result = imp->methods->lookup(sdb->zone, namestr, sdb->dbdata, node);
+ MAYBE_UNLOCK(sdb);
if (result != ISC_R_SUCCESS && !isorigin) {
destroynode(node);
return (result);
}
if (isorigin && imp->methods->authority != NULL) {
+ MAYBE_LOCK(sdb);
result = imp->methods->authority(sdb->zone, sdb->dbdata, node);
+ MAYBE_UNLOCK(sdb);
if (result != ISC_R_SUCCESS) {
destroynode(node);
return (result);
@@ -937,7 +958,9 @@ createiterator(dns_db_t *db, isc_boolean_t relative_names,
sdbiter->current = NULL;
sdbiter->origin = NULL;
+ MAYBE_LOCK(sdb);
result = imp->methods->allnodes(sdb->zone, sdb->dbdata, sdbiter);
+ MAYBE_UNLOCK(sdb);
if (result != ISC_R_SUCCESS) {
dbiterator_destroy((dns_dbiterator_t **)&sdbiter);
return (result);
@@ -1201,7 +1224,7 @@ dns_sdb_create(isc_mem_t *mctx, dns_name_t *origin, dns_dbtype_t type,
static void
disassociate(dns_rdataset_t *rdataset) {
- dns_dbnode_t *node = rdataset->private5;
+ dns_dbnode_t *node = rdataset->private5;
dns_sdbnode_t *sdbnode = (dns_sdbnode_t *) node;
dns_db_t *db = (dns_db_t *) sdbnode->sdb;
@@ -1309,7 +1332,7 @@ dbiterator_next(dns_dbiterator_t *iterator) {
static isc_result_t
dbiterator_current(dns_dbiterator_t *iterator, dns_dbnode_t **nodep,
- dns_name_t *name)
+ dns_name_t *name)
{
sdb_dbiterator_t *sdbiter = (sdb_dbiterator_t *)iterator;
@@ -1326,7 +1349,7 @@ dbiterator_pause(dns_dbiterator_t *iterator) {
return (ISC_R_SUCCESS);
}
-isc_result_t
+static isc_result_t
dbiterator_origin(dns_dbiterator_t *iterator, dns_name_t *name) {
UNUSED(iterator);
return (dns_name_concatenate(dns_rootname, NULL, name, NULL));
diff --git a/lib/dns/sec/dst/dst_api.c b/lib/dns/sec/dst/dst_api.c
index 2f0519a9..6fb95446 100644
--- a/lib/dns/sec/dst/dst_api.c
+++ b/lib/dns/sec/dst/dst_api.c
@@ -19,7 +19,7 @@
/*
* Principal Author: Brian Wellington
- * $Id: dst_api.c,v 1.66 2000/11/09 23:55:05 bwelling Exp $
+ * $Id: dst_api.c,v 1.67 2000/12/18 21:09:42 gson Exp $
*/
#include <config.h>
@@ -97,6 +97,8 @@ dst_lib_init(isc_mem_t *mctx, isc_entropy_t *ectx, unsigned int eflags) {
REQUIRE(mctx != NULL && ectx != NULL);
REQUIRE(dst_initialized == ISC_FALSE);
+ UNUSED(mctx);
+
dst_memory_pool = NULL;
/*
* When using --with-openssl, there seems to be no good way of not
diff --git a/lib/dns/sec/dst/opensslrsa_link.c b/lib/dns/sec/dst/opensslrsa_link.c
index df9dbc2b..3f786922 100644
--- a/lib/dns/sec/dst/opensslrsa_link.c
+++ b/lib/dns/sec/dst/opensslrsa_link.c
@@ -17,7 +17,7 @@
/*
* Principal Author: Brian Wellington
- * $Id: opensslrsa_link.c,v 1.5 2000/12/04 23:06:37 bwelling Exp $
+ * $Id: opensslrsa_link.c,v 1.6 2000/12/05 21:11:18 ogud Exp $
*/
#if defined(OPENSSL)
@@ -215,13 +215,13 @@ opensslrsa_generate(dst_key_t *key, int exp) {
else
e = RSA_F4;
rsa = RSA_generate_key(key->key_size, e, NULL, NULL);
- rsa->flags &= ~(RSA_FLAG_CACHE_PUBLIC | RSA_FLAG_CACHE_PRIVATE);
-
if (rsa == NULL) {
ERR_clear_error();
return (DST_R_OPENSSLFAILURE);
}
+ rsa->flags &= ~(RSA_FLAG_CACHE_PUBLIC | RSA_FLAG_CACHE_PRIVATE);
+
key->opaque = rsa;
isc_buffer_init(&dns, dns_array, sizeof(dns_array));
diff --git a/lib/dns/sec/openssl/rsa_oaep.c b/lib/dns/sec/openssl/rsa_oaep.c
index 30602ffa..a526e899 100644
--- a/lib/dns/sec/openssl/rsa_oaep.c
+++ b/lib/dns/sec/openssl/rsa_oaep.c
@@ -144,8 +144,8 @@ int MGF1(unsigned char *mask, long len, unsigned char *seed, long seedlen)
for (i = 0; outlen < len; i++)
{
- cnt[0] = (i >> 24) & 255, cnt[1] = (i >> 16) & 255,
- cnt[2] = (i >> 8) & 255, cnt[3] = i & 255;
+ cnt[0] = ((int)i >> 24) & 255, cnt[1] = ((int)i >> 16) & 255,
+ cnt[2] = ((int)i >> 8) & 255, cnt[3] = (int)i & 255;
SHA1_Init(&c);
SHA1_Update(&c, seed, seedlen);
SHA1_Update(&c, cnt, 4);
diff --git a/lib/dns/ssu.c b/lib/dns/ssu.c
index 2d18bc11..91f4caa9 100644
--- a/lib/dns/ssu.c
+++ b/lib/dns/ssu.c
@@ -16,7 +16,7 @@
*/
/*
- * $Id: ssu.c,v 1.14 2000/08/26 01:36:57 bwelling Exp $
+ * $Id: ssu.c,v 1.19 2000/12/09 02:14:53 brister Exp $
* Principal Author: Brian Wellington
*/
@@ -212,7 +212,7 @@ dns_ssutable_addrule(dns_ssutable_t *table, isc_boolean_t grant,
rule->types = NULL;
rule->magic = SSURULEMAGIC;
- ISC_LIST_APPEND(table->rules, rule, link);
+ ISC_LIST_INITANDAPPEND(table->rules, rule, link);
return (ISC_R_SUCCESS);
diff --git a/lib/dns/stats.c b/lib/dns/stats.c
index f05561d2..1740e0c5 100644
--- a/lib/dns/stats.c
+++ b/lib/dns/stats.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: stats.c,v 1.1 2000/12/01 23:49:54 gson Exp $ */
+/* $Id: stats.c,v 1.2 2000/12/11 19:24:24 bwelling Exp $ */
#include <config.h>
@@ -29,7 +29,7 @@ const char *dns_statscounter_names[DNS_STATS_NCOUNTERS] = {
"nxrrset",
"nxdomain",
"recursion",
- "failure"
+ "failure"
};
isc_result_t
diff --git a/lib/dns/tkey.c b/lib/dns/tkey.c
index b7fc1f37..ba1a2d03 100644
--- a/lib/dns/tkey.c
+++ b/lib/dns/tkey.c
@@ -16,7 +16,7 @@
*/
/*
- * $Id: tkey.c,v 1.54 2000/10/12 00:40:50 bwelling Exp $
+ * $Id: tkey.c,v 1.57 2000/12/11 23:09:47 marka Exp $
*/
#include <config.h>
@@ -52,12 +52,6 @@
goto failure; \
} while (0)
-#define TKEYTRACE(m) isc_log_write(dns_lctx, \
- DNS_LOGCATEGORY_RESOLVER, \
- DNS_LOGMODULE_RESOLVER, \
- ISC_LOG_DEBUG(3), \
- "tkey: %s", (m))
-
static void
tkey_log(const char *fmt, ...) {
va_list ap;
@@ -233,7 +227,7 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name,
isc_result_t result = ISC_R_SUCCESS;
dns_name_t *keyname, ourname;
dns_rdataset_t *keyset;
- dns_rdata_t keyrdata, ourkeyrdata;
+ dns_rdata_t keyrdata = DNS_RDATA_INIT, ourkeyrdata = DNS_RDATA_INIT;
isc_boolean_t found_key = ISC_FALSE, found_incompatible = ISC_FALSE;
dst_key_t *pubkey = NULL;
isc_buffer_t ourkeybuf, *shared = NULL;
@@ -541,7 +535,7 @@ dns_tkey_processquery(dns_message_t *msg, dns_tkeyctx_t *tctx,
dns_rdata_tkey_t tkeyin, tkeyout;
dns_name_t *qname, *name, *keyname, tempkeyname, *signer, tsigner;
dns_rdataset_t *tkeyset;
- dns_rdata_t tkeyrdata, *rdata = NULL;
+ dns_rdata_t tkeyrdata = DNS_RDATA_INIT, *rdata = NULL;
isc_buffer_t *dynbuf = NULL;
dns_namelist_t namelist;
isc_boolean_t freealg = ISC_FALSE;
@@ -1028,10 +1022,10 @@ dns_tkey_processdhresponse(dns_message_t *qmsg, dns_message_t *rmsg,
dst_key_t *key, isc_buffer_t *nonce,
dns_tsigkey_t **outkey, dns_tsig_keyring_t *ring)
{
- dns_rdata_t qtkeyrdata, rtkeyrdata;
+ dns_rdata_t qtkeyrdata = DNS_RDATA_INIT, rtkeyrdata = DNS_RDATA_INIT;
dns_name_t keyname, *tkeyname, *theirkeyname, *ourkeyname, *tempname;
dns_rdataset_t *theirkeyset = NULL, *ourkeyset = NULL;
- dns_rdata_t theirkeyrdata;
+ dns_rdata_t theirkeyrdata = DNS_RDATA_INIT;
dst_key_t *theirkey;
dns_rdata_tkey_t qtkey, rtkey;
unsigned char secretdata[256];
@@ -1099,8 +1093,8 @@ dns_tkey_processdhresponse(dns_message_t *qmsg, dns_message_t *rmsg,
break;
}
next:
- result = dns_message_nextname(rmsg, DNS_SECTION_ANSWER);
- }
+ result = dns_message_nextname(rmsg, DNS_SECTION_ANSWER);
+ }
if (theirkeyset == NULL) {
tkey_log("dns_tkey_processdhresponse: failed to find server "
@@ -1162,7 +1156,7 @@ dns_tkey_processgssresponse(dns_message_t *qmsg, dns_message_t *rmsg,
dns_name_t *gname, void *cred, void **context,
dns_tsigkey_t **outkey, dns_tsig_keyring_t *ring)
{
- dns_rdata_t rtkeyrdata, qtkeyrdata;
+ dns_rdata_t rtkeyrdata = DNS_RDATA_INIT, qtkeyrdata = DNS_RDATA_INIT;
dns_name_t *tkeyname;
dns_rdata_tkey_t rtkey, qtkey;
isc_buffer_t outtoken;
@@ -1222,7 +1216,7 @@ isc_result_t
dns_tkey_processdeleteresponse(dns_message_t *qmsg, dns_message_t *rmsg,
dns_tsig_keyring_t *ring)
{
- dns_rdata_t qtkeyrdata, rtkeyrdata;
+ dns_rdata_t qtkeyrdata = DNS_RDATA_INIT, rtkeyrdata = DNS_RDATA_INIT;
dns_name_t *tkeyname, *tempname;
dns_rdata_tkey_t qtkey, rtkey;
dns_tsigkey_t *tsigkey = NULL;
diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c
index 4096b068..d6342c04 100644
--- a/lib/dns/tsig.c
+++ b/lib/dns/tsig.c
@@ -16,7 +16,7 @@
*/
/*
- * $Id: tsig.c,v 1.96 2000/11/15 00:52:04 gson Exp $
+ * $Id: tsig.c,v 1.98 2000/12/08 03:10:32 bwelling Exp $
* Principal Author: Brian Wellington
*/
@@ -25,6 +25,7 @@
#include <isc/buffer.h>
#include <isc/mem.h>
+#include <isc/print.h>
#include <isc/string.h> /* Required for HP/UX (and others?) */
#include <isc/util.h>
@@ -108,6 +109,25 @@ dns_name_t *dns_tsig_gssapims_name = &gsstsigms.name;
static isc_result_t
tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg);
+static void
+tsig_log(dns_tsigkey_t *key, int level, const char *fmt, ...) {
+ va_list ap;
+ char message[4096];
+ char namestr[DNS_NAME_FORMATSIZE];
+
+ if (isc_log_wouldlog(dns_lctx, level) == ISC_FALSE)
+ return;
+ if (key != NULL)
+ dns_name_format(&key->name, namestr, sizeof(namestr));
+ else
+ strcpy(namestr, "<null>");
+ va_start(ap, fmt);
+ vsnprintf(message, sizeof(message), fmt, ap);
+ va_end(ap);
+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DNSSEC, DNS_LOGMODULE_TSIG,
+ level, "tsig key '%s': %s", namestr, message);
+}
+
isc_result_t
dns_tsigkey_createfromkey(dns_name_t *name, dns_name_t *algorithm,
dst_key_t *dstkey, isc_boolean_t generated,
@@ -680,6 +700,8 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg,
!dns_name_equal(&tsig.algorithm, &querytsig.algorithm)))
{
msg->tsigstatus = dns_tsigerror_badkey;
+ tsig_log(msg->tsigkey, 2,
+ "key name and algorithm do not match");
return (DNS_R_TSIGVERIFYFAILURE);
}
@@ -707,6 +729,7 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg,
mctx, NULL, &msg->tsigkey);
if (ret != ISC_R_SUCCESS)
return (ret);
+ tsig_log(msg->tsigkey, 2, "unknown key");
return (DNS_R_TSIGVERIFYFAILURE);
}
msg->tsigkey = tsigkey;
@@ -719,6 +742,12 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg,
*/
if (abs(now - tsig.timesigned) > tsig.fudge) {
msg->tsigstatus = dns_tsigerror_badtime;
+ if (now > tsig.timesigned + tsig.fudge)
+ tsig_log(msg->tsigkey, 2,
+ "signature has expired");
+ else
+ tsig_log(msg->tsigkey, 2,
+ "signature is in the future");
return (DNS_R_TSIGVERIFYFAILURE);
}
@@ -831,6 +860,8 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg,
if (ret == DST_R_VERIFYFAILURE) {
msg->tsigstatus = dns_tsigerror_badsig;
ret = DNS_R_TSIGVERIFYFAILURE;
+ tsig_log(msg->tsigkey, 2,
+ "signature failed to verify");
goto cleanup_context;
} else if (ret != ISC_R_SUCCESS)
goto cleanup_context;
@@ -840,6 +871,7 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg,
tsig.error != dns_tsigerror_badkey)
{
msg->tsigstatus = dns_tsigerror_badsig;
+ tsig_log(msg->tsigkey, 2, "signature was empty");
return (DNS_R_TSIGVERIFYFAILURE);
}
@@ -922,6 +954,8 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) {
{
msg->tsigstatus = dns_tsigerror_badkey;
ret = DNS_R_TSIGVERIFYFAILURE;
+ tsig_log(msg->tsigkey, 2,
+ "key name and algorithm do not match");
goto cleanup_querystruct;
}
@@ -932,6 +966,12 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) {
if (abs(now - tsig.timesigned) > tsig.fudge) {
msg->tsigstatus = dns_tsigerror_badtime;
ret = DNS_R_TSIGVERIFYFAILURE;
+ if (now > tsig.timesigned + tsig.fudge)
+ tsig_log(msg->tsigkey, 2,
+ "signature has expired");
+ else
+ tsig_log(msg->tsigkey, 2,
+ "signature is in the future");
goto cleanup_querystruct;
}
}
@@ -1029,14 +1069,19 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) {
if (tsig.siglen == 0) {
if (tsig.error != dns_rcode_noerror)
ret = DNS_R_TSIGERRORSET;
- else
+ else {
+ tsig_log(msg->tsigkey, 2,
+ "signature is empty");
ret = DNS_R_TSIGVERIFYFAILURE;
+ }
goto cleanup_context;
}
ret = dst_context_verify(msg->tsigctx, &sig_r);
if (ret == DST_R_VERIFYFAILURE) {
msg->tsigstatus = dns_tsigerror_badsig;
+ tsig_log(msg->tsigkey, 2,
+ "signature failed to verify");
ret = DNS_R_TSIGVERIFYFAILURE;
goto cleanup_context;
}
diff --git a/lib/dns/validator.c b/lib/dns/validator.c
index 2d18c6ef..33a6c30f 100644
--- a/lib/dns/validator.c
+++ b/lib/dns/validator.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: validator.c,v 1.85 2000/11/08 00:51:24 bwelling Exp $ */
+/* $Id: validator.c,v 1.87 2000/12/11 19:24:26 bwelling Exp $ */
#include <config.h>
@@ -364,7 +364,11 @@ nxtprovesnonexistence(dns_validator_t *val, dns_name_t *nxtname,
isc_result_t result;
result = dns_rdataset_first(nxtset);
- INSIST(result == ISC_R_SUCCESS);
+ if (result != ISC_R_SUCCESS) {
+ validator_log(val, ISC_LOG_DEBUG(3),
+ "failure processing NXT set");
+ return (ISC_FALSE);
+ }
dns_rdataset_current(nxtset, &rdata);
validator_log(val, ISC_LOG_DEBUG(3),
@@ -393,8 +397,9 @@ nxtprovesnonexistence(dns_validator_t *val, dns_name_t *nxtname,
* The NXT owner name is less than the nonexistent name.
*/
result = dns_rdata_tostruct(&rdata, &nxt, NULL);
+ if (result != ISC_R_SUCCESS)
+ return (ISC_FALSE);
dns_rdata_reset(&rdata);
- INSIST(result == ISC_R_SUCCESS);
order = dns_name_compare(val->event->name, &nxt.next);
if (order >= 0) {
/*
@@ -404,10 +409,20 @@ nxtprovesnonexistence(dns_validator_t *val, dns_name_t *nxtname,
*/
dns_rdata_sig_t siginfo;
result = dns_rdataset_first(signxtset);
- INSIST (result == ISC_R_SUCCESS);
+ if (result != ISC_R_SUCCESS) {
+ validator_log(val, ISC_LOG_DEBUG(3),
+ "failure processing SIG NXT set");
+ dns_rdata_freestruct(&nxt);
+ return (ISC_FALSE);
+ }
dns_rdataset_current(signxtset, &rdata);
result = dns_rdata_tostruct(&rdata, &siginfo, NULL);
- INSIST (result == ISC_R_SUCCESS);
+ if (result != ISC_R_SUCCESS) {
+ validator_log(val, ISC_LOG_DEBUG(3),
+ "failure processing SIG NXT set");
+ dns_rdata_freestruct(&nxt);
+ return (ISC_FALSE);
+ }
if (!dns_name_equal(&siginfo.signer, &nxt.next)) {
validator_log(val, ISC_LOG_DEBUG(3),
"next name is not greater");
@@ -1069,7 +1084,12 @@ validate(dns_validator_t *val, isc_boolean_t resume) {
"verify failure: %s",
isc_result_totext(result));
}
- INSIST(result == ISC_R_NOMORE);
+ if (result != ISC_R_NOMORE) {
+ validator_log(val, ISC_LOG_DEBUG(3),
+ "failed to iterate signatures: %s",
+ isc_result_totext(result));
+ return (result);
+ }
validator_log(val, ISC_LOG_INFO, "no valid signature found");
return (DNS_R_NOVALIDSIG);
@@ -1145,7 +1165,8 @@ nxtvalidate(dns_validator_t *val, isc_boolean_t resume) {
continue;
result = dns_rdataset_first(rdataset);
- INSIST(result == ISC_R_SUCCESS);
+ if (result != ISC_R_SUCCESS)
+ return (result);
dns_rdataset_current(rdataset, &nxt);
if (dns_nxt_typepresent(&nxt,
dns_rdatatype_soa))
@@ -1623,7 +1644,7 @@ validator_logv(dns_validator_t *val, isc_logcategory_t *category,
static void
validator_log(dns_validator_t *val, int level, const char *fmt, ...)
{
- va_list ap;
+ va_list ap;
if (! isc_log_wouldlog(dns_lctx, level))
return;
diff --git a/lib/dns/view.c b/lib/dns/view.c
index bf673bd7..e28ed36d 100644
--- a/lib/dns/view.c
+++ b/lib/dns/view.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: view.c,v 1.85 2000/11/10 03:16:20 gson Exp $ */
+/* $Id: view.c,v 1.89 2000/12/20 23:31:06 bwelling Exp $ */
#include <config.h>
@@ -31,6 +31,7 @@
#include <dns/forward.h>
#include <dns/keytable.h>
#include <dns/master.h>
+#include <dns/masterdump.h>
#include <dns/peer.h>
#include <dns/rdataset.h>
#include <dns/request.h>
@@ -162,6 +163,7 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
view->maxcachettl = 7 * 24 * 3600;
view->maxncachettl = 3 * 3600;
view->dstport = 53;
+ view->cachefile = NULL;
result = dns_peerlist_new(view->mctx, &view->peers);
if (result != ISC_R_SUCCESS)
@@ -251,6 +253,8 @@ destroy(dns_view_t *view) {
dns_acl_detach(&view->recursionacl);
if (view->sortlist != NULL)
dns_acl_detach(&view->sortlist);
+ if (view->cachefile != NULL)
+ isc_mem_free(view->mctx, view->cachefile);
dns_keytable_detach(&view->trustedkeys);
dns_keytable_detach(&view->secroots);
dns_fwdtable_destroy(&view->fwdtable);
@@ -607,12 +611,13 @@ dns_view_findzone(dns_view_t *view, dns_name_t *name, dns_zone_t **zonep) {
isc_result_t
dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
- isc_stdtime_t now, unsigned int options,
- isc_boolean_t use_hints, dns_name_t *foundname,
+ isc_stdtime_t now, unsigned int options, isc_boolean_t use_hints,
+ dns_db_t **dbp, dns_dbnode_t **nodep, dns_name_t *foundname,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
{
isc_result_t result;
- dns_db_t *db;
+ dns_db_t *db, *zdb;
+ dns_dbnode_t *node, *znode;
isc_boolean_t is_cache;
dns_rdataset_t zrdataset, zsigrdataset;
dns_zone_t *zone;
@@ -624,19 +629,23 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
REQUIRE(DNS_VIEW_VALID(view));
REQUIRE(view->frozen);
- REQUIRE(type != dns_rdatatype_any && type != dns_rdatatype_sig);
+ REQUIRE(type != dns_rdatatype_sig);
+ REQUIRE(rdataset != NULL); /* XXXBEW - remove this */
/*
* Initialize.
*/
dns_rdataset_init(&zrdataset);
dns_rdataset_init(&zsigrdataset);
+ zdb = NULL;
+ znode = NULL;
/*
* Find a database to answer the query.
*/
zone = NULL;
db = NULL;
+ node = NULL;
result = dns_zt_find(view->zonetable, name, 0, NULL, &zone);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
result = dns_zone_getdb(zone, &db);
@@ -656,7 +665,7 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
* Now look for an answer in the database.
*/
result = dns_db_find(db, name, NULL, type, options,
- now, NULL, foundname, rdataset, sigrdataset);
+ now, &node, foundname, rdataset, sigrdataset);
if (result == DNS_R_DELEGATION ||
result == ISC_R_NOTFOUND) {
@@ -665,14 +674,16 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
if (sigrdataset != NULL &&
dns_rdataset_isassociated(sigrdataset))
dns_rdataset_disassociate(sigrdataset);
+ if (node != NULL)
+ dns_db_detachnode(db, &node);
if (!is_cache) {
+ dns_db_detach(&db);
if (view->cachedb != NULL) {
/*
* Either the answer is in the cache, or we
* don't know it.
*/
is_cache = ISC_TRUE;
- dns_db_detach(&db);
dns_db_attach(view->cachedb, &db);
goto db_find;
}
@@ -688,6 +699,10 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
dns_rdataset_clone(&zsigrdataset,
sigrdataset);
result = DNS_R_GLUE;
+ if (db != NULL)
+ dns_db_detach(&db);
+ dns_db_attach(zdb, &db);
+ dns_db_attachnode(db, znode, &node);
goto cleanup;
}
}
@@ -709,6 +724,9 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
dns_rdataset_clone(sigrdataset, &zsigrdataset);
dns_rdataset_disassociate(sigrdataset);
}
+ dns_db_attach(db, &zdb);
+ dns_db_attachnode(zdb, node, &znode);
+ dns_db_detachnode(db, &node);
dns_db_detach(&db);
dns_db_attach(view->cachedb, &db);
goto db_find;
@@ -725,8 +743,13 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
if (sigrdataset != NULL &&
dns_rdataset_isassociated(sigrdataset))
dns_rdataset_disassociate(sigrdataset);
+ if (db != NULL) {
+ if (node != NULL)
+ dns_db_detachnode(db, &node);
+ dns_db_detach(&db);
+ }
result = dns_db_find(view->hints, name, NULL, type, options,
- now, NULL, foundname,
+ now, &node, foundname,
rdataset, sigrdataset);
if (result == ISC_R_SUCCESS || result == DNS_R_GLUE) {
/*
@@ -734,9 +757,12 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
* should consider priming.
*/
dns_resolver_prime(view->resolver);
+ dns_db_attach(view->hints, &db);
result = DNS_R_HINT;
- } else if (result == DNS_R_NXDOMAIN ||
- result == DNS_R_NXRRSET)
+ } else if (result == DNS_R_NXRRSET) {
+ dns_db_attach(view->hints, &db);
+ result = DNS_R_HINTNXRRSET;
+ } else if (result == DNS_R_NXDOMAIN)
result = ISC_R_NOTFOUND;
}
@@ -757,8 +783,26 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
if (dns_rdataset_isassociated(&zsigrdataset))
dns_rdataset_disassociate(&zsigrdataset);
}
- if (db != NULL)
- dns_db_detach(&db);
+
+ if (zdb != NULL) {
+ if (znode != NULL)
+ dns_db_detachnode(zdb, &znode);
+ dns_db_detach(&zdb);
+ }
+
+ if (db != NULL) {
+ if (node != NULL) {
+ if (nodep != NULL)
+ *nodep = node;
+ else
+ dns_db_detachnode(db, &node);
+ }
+ if (dbp != NULL)
+ *dbp = db;
+ else
+ dns_db_detach(&db);
+ }
+
if (zone != NULL)
dns_zone_detach(&zone);
@@ -776,7 +820,7 @@ dns_view_simplefind(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
dns_fixedname_init(&foundname);
result = dns_view_find(view, name, type, now, options, use_hints,
- dns_fixedname_name(&foundname),
+ NULL, NULL, dns_fixedname_name(&foundname),
rdataset, sigrdataset);
if (result == DNS_R_NXDOMAIN) {
/*
@@ -796,6 +840,7 @@ dns_view_simplefind(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
result != DNS_R_NCACHENXDOMAIN &&
result != DNS_R_NCACHENXRRSET &&
result != DNS_R_NXRRSET &&
+ result != DNS_R_HINTNXRRSET &&
result != ISC_R_NOTFOUND) {
if (dns_rdataset_isassociated(rdataset))
dns_rdataset_disassociate(rdataset);
@@ -1052,3 +1097,30 @@ dns_view_checksig(dns_view_t *view, isc_buffer_t *source, dns_message_t *msg) {
view->dynamickeys));
}
+isc_result_t
+dns_view_dumpcache(dns_view_t *view) {
+ REQUIRE(DNS_VIEW_VALID(view));
+
+ if (view->cachefile == NULL)
+ return (ISC_R_IGNORE);
+ return (dns_master_dump(view->mctx, view->cachedb, NULL,
+ &dns_master_style_default, view->cachefile));
+
+}
+
+isc_result_t
+dns_view_dumpdbtostream(dns_view_t *view, FILE *fp) {
+ isc_result_t result;
+
+ REQUIRE(DNS_VIEW_VALID(view));
+
+ (void)fprintf(fp, ";\n; Cache dump of view '%s'\n;\n", view->name);
+ result = dns_master_dumptostream(view->mctx, view->cachedb, NULL,
+ &dns_master_style_explicitttl, fp);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+#ifdef notyet /* clean up adb dump format first */
+ dns_adb_dump(view->adb, fp);
+#endif
+ return (ISC_R_SUCCESS);
+}
diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c
index 74dd9303..6ea8d795 100644
--- a/lib/dns/xfrin.c
+++ b/lib/dns/xfrin.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: xfrin.c,v 1.106 2000/11/17 19:04:47 gson Exp $ */
+/* $Id: xfrin.c,v 1.109 2000/12/13 00:15:14 tale Exp $ */
#include <config.h>
@@ -28,6 +28,7 @@
#include <isc/util.h>
#include <dns/db.h>
+#include <dns/diff.h>
#include <dns/events.h>
#include <dns/journal.h>
#include <dns/log.h>
@@ -286,7 +287,7 @@ static isc_result_t
axfr_apply(dns_xfrin_ctx_t *xfr) {
isc_result_t result;
- CHECK(dns_diff_load(&xfr->diff,
+ CHECK(dns_diff_load(&xfr->diff,
xfr->axfr.add_func, xfr->axfr.add_private));
xfr->difflen = 0;
dns_diff_clear(&xfr->diff);
@@ -367,7 +368,7 @@ ixfr_apply(dns_xfrin_ctx_t *xfr) {
if (xfr->ixfr.journal != NULL)
CHECK(dns_journal_begin_transaction(xfr->ixfr.journal));
}
- CHECK(dns_diff_apply(&xfr->diff, xfr->db, xfr->ver));
+ CHECK(dns_diff_apply(&xfr->diff, xfr->db, xfr->ver));
if (xfr->ixfr.journal != NULL)
dns_journal_writediff(xfr->ixfr.journal, &xfr->diff);
dns_diff_clear(&xfr->diff);
@@ -1168,7 +1169,6 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) {
}
}
-
/*
* Update the number of messages received.
*/
@@ -1313,7 +1313,7 @@ static void
xfrin_log1(int level, dns_name_t *zonename, isc_sockaddr_t *masteraddr,
const char *fmt, ...)
{
- va_list ap;
+ va_list ap;
if (isc_log_wouldlog(dns_lctx, level) == ISC_FALSE)
return;
@@ -1330,7 +1330,7 @@ xfrin_log1(int level, dns_name_t *zonename, isc_sockaddr_t *masteraddr,
static void
xfrin_log(dns_xfrin_ctx_t *xfr, unsigned int level, const char *fmt, ...)
{
- va_list ap;
+ va_list ap;
if (isc_log_wouldlog(dns_lctx, level) == ISC_FALSE)
return;
diff --git a/lib/dns/zone.c b/lib/dns/zone.c
index d03a3d9a..c0eebf5c 100644
--- a/lib/dns/zone.c
+++ b/lib/dns/zone.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zone.c,v 1.267 2000/12/04 23:58:27 gson Exp $ */
+/* $Id: zone.c,v 1.283 2000/12/28 01:29:06 marka Exp $ */
#include <config.h>
@@ -103,10 +103,29 @@ typedef struct dns_forward dns_forward_t;
typedef struct dns_io dns_io_t;
typedef ISC_LIST(dns_io_t) dns_iolist_t;
+#define DNS_ZONE_CHECKLOCK
+#ifdef DNS_ZONE_CHECKLOCK
+#define LOCK_ZONE(z) \
+ do { LOCK(&(z)->lock); \
+ INSIST((z)->locked == ISC_FALSE); \
+ (z)->locked = ISC_TRUE; \
+ } while (0)
+#define UNLOCK_ZONE(z) \
+ do { (z)->locked = ISC_FALSE; UNLOCK(&(z)->lock); } while (0)
+#define LOCKED_ZONE(z) ((z)->locked)
+#else
+#define LOCK_ZONE(z) LOCK(&(z)->lock)
+#define UNLOCK_ZONE(z) UNLOCK(&(z)->lock)
+#define LOCKED_ZONE(z) ISC_TRUE
+#endif
+
struct dns_zone {
/* Unlocked */
unsigned int magic;
isc_mutex_t lock;
+#ifdef DNS_ZONE_CHECKLOCK
+ isc_boolean_t locked;
+#endif
isc_mem_t *mctx;
/* Locked */
@@ -142,6 +161,7 @@ struct dns_zone {
isc_uint32_t minretry;
isc_sockaddr_t *masters;
+ dns_name_t **masterkeynames;
unsigned int masterscnt;
unsigned int curmaster;
unsigned int refreshcnt;
@@ -159,6 +179,7 @@ struct dns_zone {
/* Access Control Lists */
dns_acl_t *update_acl;
dns_acl_t *forward_acl;
+ dns_acl_t *notify_acl;
dns_acl_t *query_acl;
dns_acl_t *xfr_acl;
dns_severity_t check_names;
@@ -186,10 +207,18 @@ struct dns_zone {
/*
* Optional per-zone statistics counters (NULL if not present).
*/
- isc_uint64_t *counters;
+ isc_uint64_t *counters;
};
-#define DNS_ZONE_FLAG(z,f) (((z)->flags & (f)) != 0)
+#define DNS_ZONE_FLAG(z,f) (ISC_TF(((z)->flags & (f)) != 0))
+#define DNS_ZONE_SETFLAG(z,f) do { \
+ INSIST(LOCKED_ZONE(z)); \
+ (z)->flags |= (f); \
+ } while (0)
+#define DNS_ZONE_CLRFLAG(z,f) do { \
+ INSIST(LOCKED_ZONE(z)); \
+ (z)->flags &= ~(f); \
+ } while (0)
/* XXX MPA these may need to go back into zone.h */
#define DNS_ZONEFLG_REFRESH 0x00000001U /* refresh check in progress */
#define DNS_ZONEFLG_NEEDDUMP 0x00000002U /* zone need consolidation */
@@ -214,7 +243,7 @@ struct dns_zone {
* from SOA (if not set, we
* are still using
* default timer values) */
-#define DNS_ZONEFLG_FORCELOAD 0x00008000U /* Force a reload */
+#define DNS_ZONEFLG_FORCEXFER 0x00008000U /* Force a zone xfer */
#define DNS_ZONEFLG_NOREFRESH 0x00010000U
#define DNS_ZONEFLG_DIALNOTIFY 0x00020000U
#define DNS_ZONEFLG_DIALREFRESH 0x00040000U
@@ -322,7 +351,7 @@ struct dns_io {
isc_event_t *event;
};
-static isc_result_t zone_settimer(dns_zone_t *, isc_stdtime_t);
+static void zone_settimer(dns_zone_t *, isc_stdtime_t);
static void cancel_refresh(dns_zone_t *);
static void zone_log(dns_zone_t *zone, const char *, int, const char *msg,
@@ -334,7 +363,7 @@ static void zone_expire(dns_zone_t *zone);
static void zone_iattach(dns_zone_t *source, dns_zone_t **target);
void zone_idetach(dns_zone_t **zonep);
static isc_result_t zone_replacedb(dns_zone_t *zone, dns_db_t *db,
- isc_boolean_t dump);
+ isc_boolean_t dump);
static isc_result_t default_journal(dns_zone_t *zone);
static void zone_xfrdone(dns_zone_t *zone, isc_result_t result);
static isc_result_t zone_postload(dns_zone_t *zone, dns_db_t *db,
@@ -426,6 +455,9 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) {
/* XXX MPA check that all elements are initialised */
zone->mctx = NULL;
+#ifdef DNS_ZONE_CHECKLOCK
+ zone->locked = ISC_FALSE;
+#endif
isc_mem_attach(mctx, &zone->mctx);
zone->db = NULL;
zone->zmgr = NULL;
@@ -456,6 +488,7 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) {
zone->maxretry = DNS_ZONE_MAXRETRY;
zone->minretry = DNS_ZONE_MINRETRY;
zone->masters = NULL;
+ zone->masterkeynames = NULL;
zone->masterscnt = 0;
zone->curmaster = 0;
zone->refreshcnt = 0;
@@ -465,6 +498,7 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) {
zone->task = NULL;
zone->update_acl = NULL;
zone->forward_acl = NULL;
+ zone->notify_acl = NULL;
zone->query_acl = NULL;
zone->xfr_acl = NULL;
zone->check_names = dns_severity_ignore;
@@ -518,6 +552,7 @@ zone_free(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(zone->erefs == 0);
REQUIRE(zone->irefs == 0);
+ REQUIRE(!LOCKED_ZONE(zone));
/*
* Managed objects. Order is important.
@@ -547,13 +582,15 @@ zone_free(dns_zone_t *zone) {
if (zone->db != NULL)
dns_db_detach(&zone->db);
zone_freedbargs(zone);
- dns_zone_setmasters(zone, NULL, 0);
+ dns_zone_setmasterswithkeys(zone, NULL, NULL, 0);
dns_zone_setalsonotify(zone, NULL, 0);
zone->check_names = dns_severity_ignore;
if (zone->update_acl != NULL)
dns_acl_detach(&zone->update_acl);
if (zone->forward_acl != NULL)
dns_acl_detach(&zone->forward_acl);
+ if (zone->notify_acl != NULL)
+ dns_acl_detach(&zone->notify_acl);
if (zone->query_acl != NULL)
dns_acl_detach(&zone->query_acl);
if (zone->xfr_acl != NULL)
@@ -583,11 +620,11 @@ dns_zone_setclass(dns_zone_t *zone, dns_rdataclass_t rdclass) {
/*
* Test and set.
*/
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
REQUIRE(zone->rdclass == dns_rdataclass_none ||
zone->rdclass == rdclass);
zone->rdclass = rdclass;
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
dns_rdataclass_t
@@ -601,9 +638,9 @@ void
dns_zone_setnotifytype(dns_zone_t *zone, dns_notifytype_t notifytype) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
zone->notifytype = notifytype;
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
/*
@@ -618,10 +655,10 @@ dns_zone_settype(dns_zone_t *zone, dns_zonetype_t type) {
/*
* Test and set.
*/
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
REQUIRE(zone->type == dns_zone_none || zone->type == type);
zone->type = type;
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
static void
@@ -650,7 +687,7 @@ dns_zone_setdbtype(dns_zone_t *zone,
REQUIRE(dbargc >= 1);
REQUIRE(dbargv != NULL);
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
/* Set up a new database argument list. */
new = isc_mem_get(zone->mctx, dbargc * sizeof *new);
@@ -684,7 +721,7 @@ dns_zone_setdbtype(dns_zone_t *zone,
result = ISC_R_NOMEMORY;
unlock:
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (result);
}
@@ -692,9 +729,11 @@ void
dns_zone_setview(dns_zone_t *zone, dns_view_t *view) {
REQUIRE(DNS_ZONE_VALID(zone));
+ LOCK_ZONE(zone);
if (zone->view != NULL)
dns_view_weakdetach(&zone->view);
dns_view_weakattach(view, &zone->view);
+ UNLOCK_ZONE(zone);
}
@@ -713,13 +752,13 @@ dns_zone_setorigin(dns_zone_t *zone, dns_name_t *origin) {
REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(origin != NULL);
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (dns_name_dynamic(&zone->origin)) {
dns_name_free(&zone->origin, zone->mctx);
dns_name_init(&zone->origin, NULL);
}
result = dns_name_dup(origin, zone->mctx, &zone->origin);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (result);
}
@@ -727,6 +766,7 @@ dns_zone_setorigin(dns_zone_t *zone, dns_name_t *origin) {
static isc_result_t
dns_zone_setstring(dns_zone_t *zone, char **field, const char *value) {
char *copy;
+
if (value != NULL) {
copy = isc_mem_strdup(zone->mctx, value);
if (copy == NULL)
@@ -748,11 +788,11 @@ dns_zone_setfile(dns_zone_t *zone, const char *file) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
result = dns_zone_setstring(zone, &zone->masterfile, file);
if (result == ISC_R_SUCCESS)
result = default_journal(zone);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (result);
}
@@ -770,6 +810,7 @@ default_journal(dns_zone_t *zone) {
char *journal;
REQUIRE(DNS_ZONE_VALID(zone));
+ REQUIRE(LOCKED_ZONE(zone));
if (zone->masterfile != NULL) {
/* Calculate string length including '\0'. */
@@ -794,9 +835,9 @@ dns_zone_setjournal(dns_zone_t *zone, const char *journal) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
result = dns_zone_setstring(zone, &zone->journal, journal);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (result);
}
@@ -819,14 +860,17 @@ dns_zone_getjournal(dns_zone_t *zone) {
*/
static isc_boolean_t
zone_isdynamic(dns_zone_t *zone) {
+ REQUIRE(DNS_ZONE_VALID(zone));
+
return (ISC_TF(zone->type == dns_zone_slave ||
- zone->type == dns_zone_stub ||
- zone->ssutable != NULL ||
- (zone->update_acl != NULL &&
- ! (zone->update_acl->length == 0 &&
- zone->update_acl->elements[0].negative == ISC_TRUE &&
- zone->update_acl->elements[0].type ==
- dns_aclelementtype_any))));
+ zone->type == dns_zone_stub ||
+ zone->ssutable != NULL ||
+ (zone->update_acl != NULL &&
+ ! (zone->update_acl->length == 0 &&
+ zone->update_acl->elements[0].negative == ISC_TRUE
+ &&
+ zone->update_acl->elements[0].type ==
+ dns_aclelementtype_any))));
}
@@ -840,7 +884,7 @@ dns_zone_load(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
isc_stdtime_get(&now);
INSIST(zone->type != dns_zone_none);
@@ -925,7 +969,7 @@ dns_zone_load(dns_zone_t *zone) {
}
if (result == DNS_R_CONTINUE) {
- zone->flags |= DNS_ZONEFLG_LOADING;
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADING);
result = ISC_R_SUCCESS;
goto cleanup;
}
@@ -933,7 +977,7 @@ dns_zone_load(dns_zone_t *zone) {
result = zone_postload(zone, db, loadtime, result);
cleanup:
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
if (db != NULL)
dns_db_detach(&db);
return (result);
@@ -1062,9 +1106,9 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
zone_log(zone, me, ISC_LOG_DEBUG(1), "loaded");
if (result == DNS_R_SEENINCLUDE)
- zone->flags |= DNS_ZONEFLG_HASINCLUDE;
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_HASINCLUDE);
else
- zone->flags &= ~DNS_ZONEFLG_HASINCLUDE;
+ DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_HASINCLUDE);
/*
* Apply update log, if any.
*/
@@ -1118,10 +1162,13 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
zone_log(zone, me, ISC_LOG_ERROR,
"has %d SOA records", soacount);
result = DNS_R_BADZONE;
- goto cleanup;
}
- if (nscount == 0)
+ if (nscount == 0) {
zone_log(zone, me, ISC_LOG_ERROR, "no NS records");
+ result = DNS_R_BADZONE;
+ }
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
if (zone->db != NULL) {
if (!isc_serial_ge(serial, zone->serial)) {
zone_log(zone, me, ISC_LOG_ERROR,
@@ -1136,7 +1183,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
zone->expire = RANGE(expire, zone->refresh + zone->retry,
DNS_MAX_EXPIRE);
zone->minimum = minimum;
- zone->flags |= DNS_ZONEFLG_HAVETIMERS;
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_HAVETIMERS);
if (zone->type == dns_zone_slave ||
zone->type == dns_zone_stub) {
@@ -1178,13 +1225,14 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
goto cleanup;
} else {
dns_db_attach(db, &zone->db);
- zone->flags |= DNS_ZONEFLG_LOADED|DNS_ZONEFLG_NEEDNOTIFY;
+ DNS_ZONE_SETFLAG(zone,
+ DNS_ZONEFLG_LOADED|DNS_ZONEFLG_NEEDNOTIFY);
}
result = ISC_R_SUCCESS;
if (needdump)
zone_needdump(zone, DNS_DUMP_DELAY);
- if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING))
- (void) zone_settimer(zone, now);
+ if (zone->task != NULL)
+ zone_settimer(zone, now);
return (result);
cleanup:
@@ -1363,13 +1411,13 @@ void
dns_zone_attach(dns_zone_t *source, dns_zone_t **target) {
REQUIRE(DNS_ZONE_VALID(source));
REQUIRE(target != NULL && *target == NULL);
- LOCK(&source->lock);
+ LOCK_ZONE(source);
REQUIRE(source->erefs > 0);
source->erefs++;
INSIST(source->erefs != 0);
zone_log(source, "dns_zone_attach", ISC_LOG_DEBUG(10),
"eref = %d, irefs = %d", source->erefs, source->irefs);
- UNLOCK(&source->lock);
+ UNLOCK_ZONE(source);
*target = source;
}
@@ -1381,7 +1429,7 @@ dns_zone_detach(dns_zone_t **zonep) {
REQUIRE(zonep != NULL && DNS_ZONE_VALID(*zonep));
zone = *zonep;
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
REQUIRE(zone->erefs > 0);
zone->erefs--;
@@ -1416,7 +1464,7 @@ dns_zone_detach(dns_zone_t **zonep) {
}
zone_log(zone, "dns_zone_detach", ISC_LOG_DEBUG(10),
"eref = %d, irefs = %d", zone->erefs, zone->irefs);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
*zonep = NULL;
if (free_now)
zone_free(zone);
@@ -1426,13 +1474,18 @@ void
dns_zone_iattach(dns_zone_t *source, dns_zone_t **target) {
REQUIRE(DNS_ZONE_VALID(source));
REQUIRE(target != NULL && *target == NULL);
- LOCK(&source->lock);
+ LOCK_ZONE(source);
zone_iattach(source, target);
- UNLOCK(&source->lock);
+ UNLOCK_ZONE(source);
}
static void
zone_iattach(dns_zone_t *source, dns_zone_t **target) {
+
+ /*
+ * 'source' locked by caller.
+ */
+ REQUIRE(LOCKED_ZONE(source));
REQUIRE(DNS_ZONE_VALID(source));
REQUIRE(target != NULL && *target == NULL);
source->irefs++;
@@ -1446,9 +1499,12 @@ void
zone_idetach(dns_zone_t **zonep) {
dns_zone_t *zone;
+ /*
+ * 'zone' locked by caller.
+ */
REQUIRE(zonep != NULL && DNS_ZONE_VALID(*zonep));
zone = *zonep;
- REQUIRE(ISLOCKED(&zone->lock));
+ REQUIRE(LOCKED_ZONE(*zonep));
*zonep = NULL;
INSIST(zone->irefs > 0);
@@ -1466,12 +1522,12 @@ dns_zone_idetach(dns_zone_t **zonep) {
zone = *zonep;
*zonep = NULL;
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
INSIST(zone->irefs > 0);
zone->irefs--;
zone_log(zone, "dns_zone_idetach", ISC_LOG_DEBUG(10),
"eref = %d, irefs = %d", zone->erefs, zone->irefs);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
exit_check(zone);
}
@@ -1493,12 +1549,12 @@ void
dns_zone_setflag(dns_zone_t *zone, unsigned int flags, isc_boolean_t value) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (value)
- zone->flags |= flags;
+ DNS_ZONE_SETFLAG(zone, flags);
else
- zone->flags &= ~flags;
- UNLOCK(&zone->lock);
+ DNS_ZONE_CLRFLAG(zone, flags);
+ UNLOCK_ZONE(zone);
}
void
@@ -1506,12 +1562,12 @@ dns_zone_setoption(dns_zone_t *zone, unsigned int option, isc_boolean_t value)
{
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (value)
zone->options |= option;
else
zone->options &= ~option;
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
unsigned int
@@ -1526,9 +1582,9 @@ isc_result_t
dns_zone_setxfrsource4(dns_zone_t *zone, isc_sockaddr_t *xfrsource) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
zone->xfrsource4 = *xfrsource;
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (ISC_R_SUCCESS);
}
@@ -1543,9 +1599,9 @@ isc_result_t
dns_zone_setxfrsource6(dns_zone_t *zone, isc_sockaddr_t *xfrsource) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
zone->xfrsource6 = *xfrsource;
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (ISC_R_SUCCESS);
}
@@ -1560,9 +1616,9 @@ isc_result_t
dns_zone_setnotifysrc4(dns_zone_t *zone, isc_sockaddr_t *notifysrc) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
zone->notifysrc4 = *notifysrc;
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (ISC_R_SUCCESS);
}
@@ -1577,9 +1633,9 @@ isc_result_t
dns_zone_setnotifysrc6(dns_zone_t *zone, isc_sockaddr_t *notifysrc) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
zone->notifysrc6 = *notifysrc;
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (ISC_R_SUCCESS);
}
@@ -1600,7 +1656,7 @@ dns_zone_setalsonotify(dns_zone_t *zone, isc_sockaddr_t *notify,
REQUIRE((notify == NULL && count == 0) ||
(notify != NULL && count != 0));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->notify != NULL) {
isc_mem_put(zone->mctx, zone->notify,
zone->notifycnt * sizeof *new);
@@ -1612,7 +1668,7 @@ dns_zone_setalsonotify(dns_zone_t *zone, isc_sockaddr_t *notify,
new = isc_mem_get(zone->mctx, count * sizeof *new);
if (new == NULL) {
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (ISC_R_NOMEMORY);
}
memcpy(new, notify, count * sizeof *new);
@@ -1620,7 +1676,7 @@ dns_zone_setalsonotify(dns_zone_t *zone, isc_sockaddr_t *notify,
zone->notifycnt = count;
unlock:
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (ISC_R_SUCCESS);
}
@@ -1628,18 +1684,48 @@ isc_result_t
dns_zone_setmasters(dns_zone_t *zone, isc_sockaddr_t *masters,
isc_uint32_t count)
{
+ isc_result_t result;
+
+ result = dns_zone_setmasterswithkeys(zone, masters, NULL, count);
+ return (result);
+}
+
+isc_result_t
+dns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *masters,
+ dns_name_t **keynames, isc_uint32_t count)
+{
isc_sockaddr_t *new;
isc_result_t result = ISC_R_SUCCESS;
+ dns_name_t **newname;
+ unsigned int i;
REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(count == 0 || masters != NULL);
+ if (keynames != NULL) {
+ REQUIRE(count != 0);
+ }
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->masters != NULL) {
isc_mem_put(zone->mctx, zone->masters,
zone->masterscnt * sizeof *new);
zone->masters = NULL;
}
+ if (zone->masterkeynames != NULL) {
+ for (i = 0; i < zone->masterscnt; i++) {
+ if (zone->masterkeynames[i] != NULL) {
+ dns_name_free(zone->masterkeynames[i],
+ zone->mctx);
+ isc_mem_put(zone->mctx,
+ zone->masterkeynames[i],
+ sizeof(dns_name_t));
+ zone->masterkeynames[i] = NULL;
+ }
+ }
+ isc_mem_put(zone->mctx, zone->masterkeynames,
+ zone->masterscnt * sizeof(dns_name_t *));
+ zone->masterkeynames = NULL;
+ }
zone->masterscnt = 0;
/*
* If count == 0, don't allocate any space for masters or keynames
@@ -1660,10 +1746,50 @@ dns_zone_setmasters(dns_zone_t *zone, isc_sockaddr_t *masters,
memcpy(new, masters, count * sizeof *new);
zone->masters = new;
zone->masterscnt = count;
- zone->flags &= ~DNS_ZONEFLG_NOMASTERS;
+ DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_NOMASTERS);
+ /*
+ * if keynames is non-NULL, it must contain count elements!
+ */
+ if (keynames != NULL) {
+ newname = isc_mem_get(zone->mctx,
+ count * sizeof(dns_name_t *));
+ if (newname == NULL) {
+ result = ISC_R_NOMEMORY;
+ isc_mem_put(zone->mctx, zone->masters,
+ count * sizeof *new);
+ goto unlock;
+ }
+ for (i = 0; i < count; i++)
+ newname[i] = NULL;
+ for (i = 0; i < count; i++) {
+ if (keynames[i] != NULL) {
+ newname[i] = isc_mem_get(zone->mctx,
+ sizeof(dns_name_t));
+ if (newname[i] == NULL)
+ goto allocfail;
+ dns_name_init(newname[i], NULL);
+ result = dns_name_dup(keynames[i], zone->mctx,
+ newname[i]);
+ if (result != ISC_R_SUCCESS) {
+ allocfail:
+ for (i = 0; i < count; i++)
+ if (newname[i] != NULL)
+ dns_name_free(
+ newname[i],
+ zone->mctx);
+ isc_mem_put(zone->mctx, zone->masters,
+ count * sizeof *new);
+ isc_mem_put(zone->mctx, newname,
+ count * sizeof *newname);
+ goto unlock;
+ }
+ }
+ }
+ zone->masterkeynames = newname;
+ }
unlock:
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (result);
}
@@ -1673,12 +1799,12 @@ dns_zone_getdb(dns_zone_t *zone, dns_db_t **dpb) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->db == NULL)
result = DNS_R_NOTLOADED;
else
dns_db_attach(zone->db, dpb);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (result);
}
@@ -1695,11 +1821,10 @@ dns_zone_maintenance(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
DNS_ENTER;
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
isc_stdtime_get(&now);
- if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING))
- (void) zone_settimer(zone, now);
- UNLOCK(&zone->lock);
+ zone_settimer(zone, now);
+ UNLOCK_ZONE(zone);
}
static void
@@ -1729,13 +1854,13 @@ zone_maintenance(dns_zone_t *zone) {
switch (zone->type) {
case dns_zone_slave:
case dns_zone_stub:
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (now >= zone->expiretime &&
DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADED)) {
zone_expire(zone);
zone->refreshtime = now;
}
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
break;
default:
break;
@@ -1761,7 +1886,7 @@ zone_maintenance(dns_zone_t *zone) {
switch (zone->type) {
case dns_zone_master:
case dns_zone_slave:
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->masterfile != NULL &&
now >= zone->dumptime &&
DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADED) &&
@@ -1772,7 +1897,7 @@ zone_maintenance(dns_zone_t *zone) {
"failed: %s",
dns_result_totext(result));
}
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
break;
default:
break;
@@ -1790,25 +1915,24 @@ zone_maintenance(dns_zone_t *zone) {
default:
break;
}
- if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING))
- (void) zone_settimer(zone, now);
+ zone_settimer(zone, now);
}
void
dns_zone_markdirty(dns_zone_t *zone) {
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
zone_needdump(zone, DNS_DUMP_DELAY);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
void
dns_zone_expire(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
zone_expire(zone);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
static void
@@ -1819,7 +1943,8 @@ zone_expire(dns_zone_t *zone) {
* 'zone' locked by caller.
*/
- REQUIRE(ISLOCKED(&zone->lock));
+ REQUIRE(LOCKED_ZONE(zone));
+
zone_log(zone, "zone_expire", ISC_LOG_WARNING, "expired");
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDDUMP)) {
@@ -1828,10 +1953,10 @@ zone_expire(dns_zone_t *zone) {
zone_log(zone, "zone_dump", ISC_LOG_WARNING,
"failure: %s", dns_result_totext(result));
}
- zone->flags |= DNS_ZONEFLG_EXPIRED;
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_EXPIRED);
zone->refresh = DNS_ZONE_DEFAULTREFRESH;
zone->retry = DNS_ZONE_DEFAULTRETRY;
- zone->flags &= ~DNS_ZONEFLG_HAVETIMERS;
+ DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_HAVETIMERS);
zone_unload(zone);
}
@@ -1852,20 +1977,18 @@ dns_zone_refresh(dns_zone_t *zone) {
* in progress at a time.
*/
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
oldflags = zone->flags;
if (zone->masterscnt == 0) {
- zone->flags |= DNS_ZONEFLG_NOMASTERS;
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NOMASTERS);
if ((oldflags & DNS_ZONEFLG_NOMASTERS) == 0)
zone_log(zone, "dns_zone_refresh", ISC_LOG_ERROR,
"no masters");
- UNLOCK(&zone->lock);
- return;
+ goto unlock;
}
- zone->flags |= DNS_ZONEFLG_REFRESH;
- UNLOCK(&zone->lock);
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_REFRESH);
if ((oldflags & (DNS_ZONEFLG_REFRESH|DNS_ZONEFLG_LOADING)) != 0)
- return;
+ goto unlock;
/*
* Set the next refresh time as if refresh check has failed.
@@ -1890,6 +2013,8 @@ dns_zone_refresh(dns_zone_t *zone) {
zone->refreshcnt = 0;
/* initiate soa query */
queue_soa_query(zone);
+ unlock:
+ UNLOCK_ZONE(zone);
}
isc_result_t
@@ -1898,10 +2023,10 @@ dns_zone_flush(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDDUMP))
result = zone_dump(zone);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (result);
}
@@ -1912,9 +2037,9 @@ dns_zone_dump(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
result = zone_dump(zone);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (result);
}
@@ -1923,7 +2048,12 @@ static void
zone_needdump(dns_zone_t *zone, unsigned int delay) {
isc_stdtime_t now;
+ /*
+ * 'zone' locked by caller
+ */
+
REQUIRE(DNS_ZONE_VALID(zone));
+ REQUIRE(LOCKED_ZONE(zone));
/*
* Do we have a place to dump to and are we loaded?
@@ -1937,7 +2067,7 @@ zone_needdump(dns_zone_t *zone, unsigned int delay) {
/* add some noise */
delay = isc_random_jitter(delay, delay/4);
- zone->flags |= DNS_ZONEFLG_NEEDDUMP;
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NEEDDUMP);
if (zone->dumptime == 0 ||
zone->dumptime > now + delay)
zone->dumptime = now + delay;
@@ -1952,9 +2082,9 @@ zone_dump(dns_zone_t *zone) {
/*
* 'zone' locked by caller.
*/
- REQUIRE(DNS_ZONE_VALID(zone));
- REQUIRE(ISLOCKED(&zone->lock));
+ REQUIRE(DNS_ZONE_VALID(zone));
+ REQUIRE(LOCKED_ZONE(zone));
dns_db_currentversion(zone->db, &version);
@@ -1973,7 +2103,7 @@ zone_dump(dns_zone_t *zone) {
return (result);
}
- zone->flags &= ~DNS_ZONEFLG_NEEDDUMP;
+ DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_NEEDDUMP);
return (ISC_R_SUCCESS);
}
@@ -1998,9 +2128,9 @@ void
dns_zone_unload(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
zone_unload(zone);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
static void
@@ -2008,9 +2138,11 @@ notify_cancel(dns_zone_t *zone) {
dns_notify_t *notify;
/*
- * Locked by caller.
+ * 'zone' locked by caller.
*/
+ REQUIRE(LOCKED_ZONE(zone));
+
for (notify = ISC_LIST_HEAD(zone->notifies);
notify != NULL;
notify = ISC_LIST_NEXT(notify, link)) {
@@ -2025,16 +2157,15 @@ static void
zone_unload(dns_zone_t *zone) {
/*
- * Locked by caller.
+ * 'zone' locked by caller.
*/
- REQUIRE(ISLOCKED(&zone->lock));
+ REQUIRE(LOCKED_ZONE(zone));
dns_db_detach(&zone->db);
- zone->flags &= ~DNS_ZONEFLG_LOADED;
+ DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_LOADED);
}
-
void
dns_zone_setminrefreshtime(dns_zone_t *zone, isc_uint32_t val) {
REQUIRE(DNS_ZONE_VALID(zone));
@@ -2067,7 +2198,6 @@ dns_zone_setmaxretrytime(dns_zone_t *zone, isc_uint32_t val) {
zone->maxretry = val;
}
-
static isc_boolean_t
notify_isqueued(dns_zone_t *zone, dns_name_t *name, isc_sockaddr_t *addr) {
dns_notify_t *notify;
@@ -2097,11 +2227,12 @@ notify_destroy(dns_notify_t *notify, isc_boolean_t locked) {
if (notify->zone != NULL) {
if (!locked)
- LOCK(&notify->zone->lock);
+ LOCK_ZONE(notify->zone);
+ REQUIRE(LOCKED_ZONE(notify->zone));
if (ISC_LINK_LINKED(notify, link))
ISC_LIST_UNLINK(notify->zone->notifies, notify, link);
if (!locked)
- UNLOCK(&notify->zone->lock);
+ UNLOCK_ZONE(notify->zone);
dns_zone_idetach(&notify->zone);
}
if (notify->find != NULL)
@@ -2161,9 +2292,9 @@ process_adb_event(isc_task_t *task, isc_event_t *ev) {
return;
}
if (result == DNS_EVENT_ADBNOMOREADDRESSES) {
- LOCK(&notify->zone->lock);
+ LOCK_ZONE(notify->zone);
notify_send(notify);
- UNLOCK(&notify->zone->lock);
+ UNLOCK_ZONE(notify->zone);
}
notify_destroy(notify, ISC_FALSE);
}
@@ -2197,9 +2328,9 @@ notify_find_address(dns_notify_t *notify) {
return;
/* We have as many addresses as we can get. */
- LOCK(&notify->zone->lock);
+ LOCK_ZONE(notify->zone);
notify_send(notify);
- UNLOCK(&notify->zone->lock);
+ UNLOCK_ZONE(notify->zone);
destroy:
notify_destroy(notify, ISC_FALSE);
@@ -2241,7 +2372,7 @@ notify_send_toaddr(isc_task_t *task, isc_event_t *event) {
UNUSED(task);
- LOCK(&notify->zone->lock);
+ LOCK_ZONE(notify->zone);
if (DNS_ZONE_FLAG(notify->zone, DNS_ZONEFLG_LOADED) == 0) {
result = ISC_R_CANCELED;
@@ -2286,7 +2417,7 @@ notify_send_toaddr(isc_task_t *task, isc_event_t *event) {
dns_tsigkey_detach(&key);
dns_message_destroy(&message);
cleanup:
- UNLOCK(&notify->zone->lock);
+ UNLOCK_ZONE(notify->zone);
if (result != ISC_R_SUCCESS)
notify_destroy(notify, ISC_FALSE);
isc_event_free(&event);
@@ -2303,8 +2434,7 @@ notify_send(dns_notify_t *notify) {
* Zone lock held by caller.
*/
REQUIRE(DNS_NOTIFY_VALID(notify));
-
- REQUIRE(ISLOCKED(&notify->zone->lock));
+ REQUIRE(LOCKED_ZONE(notify->zone));
for (ai = ISC_LIST_HEAD(notify->find->list);
ai != NULL;
@@ -2339,13 +2469,12 @@ dns_zone_notify(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
- zone->flags |= DNS_ZONEFLG_NEEDNOTIFY;
+ LOCK_ZONE(zone);
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NEEDNOTIFY);
isc_stdtime_get(&now);
- if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING))
- (void) zone_settimer(zone, now);
- UNLOCK(&zone->lock);
+ zone_settimer(zone, now);
+ UNLOCK_ZONE(zone);
}
static void
@@ -2369,10 +2498,10 @@ zone_notify(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
- zone->flags &= ~DNS_ZONEFLG_NEEDNOTIFY;
+ LOCK_ZONE(zone);
+ DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_NEEDNOTIFY);
notifytype = zone->notifytype;
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
if (! DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADED))
return;
@@ -2394,14 +2523,14 @@ zone_notify(dns_zone_t *zone) {
/*
* Enqueue notify requests for 'also-notify' servers.
*/
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
for (i = 0; i < zone->notifycnt; i++) {
dst = zone->notify[i];
if (notify_isqueued(zone, NULL, &dst))
continue;
result = notify_create(zone->mctx, flags, &notify);
if (result != ISC_R_SUCCESS) {
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return;
}
zone_iattach(zone, &notify->zone);
@@ -2410,12 +2539,12 @@ zone_notify(dns_zone_t *zone) {
result = notify_send_queue(notify);
if (result != ISC_R_SUCCESS) {
notify_destroy(notify, ISC_TRUE);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return;
}
notify = NULL;
}
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
if (notifytype == dns_notifytype_explicit)
return;
@@ -2479,9 +2608,9 @@ zone_notify(dns_zone_t *zone) {
result = dns_rdataset_next(&nsrdset);
continue;
}
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
isqueued = notify_isqueued(zone, &ns.name, NULL);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
if (isqueued) {
result = dns_rdataset_next(&nsrdset);
continue;
@@ -2492,14 +2621,14 @@ zone_notify(dns_zone_t *zone) {
dns_zone_iattach(zone, &notify->zone);
result = dns_name_dup(&ns.name, zone->mctx, &notify->ns);
if (result != ISC_R_SUCCESS) {
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
notify_destroy(notify, ISC_TRUE);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
continue;
}
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
ISC_LIST_APPEND(zone->notifies, notify, link);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
notify_find_address(notify);
notify = NULL;
result = dns_rdataset_next(&nsrdset);
@@ -2656,7 +2785,7 @@ stub_callback(isc_task_t *task, isc_event_t *event) {
if (revent->result != ISC_R_SUCCESS) {
zone_log(zone, me, ISC_LOG_INFO, "failure for %s: %s",
- master, dns_result_totext(revent->result));
+ master, dns_result_totext(revent->result));
goto next_master;
}
@@ -2693,9 +2822,9 @@ stub_callback(isc_task_t *task, isc_event_t *event) {
"truncated TCP response from %s", master);
goto next_master;
}
- LOCK(&zone->lock);
- zone->flags |= DNS_ZONEFLG_USEVC;
- UNLOCK(&zone->lock);
+ LOCK_ZONE(zone);
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_USEVC);
+ UNLOCK_ZONE(zone);
goto same_master;
}
@@ -2740,10 +2869,10 @@ stub_callback(isc_task_t *task, isc_event_t *event) {
* Tidy up.
*/
dns_db_closeversion(stub->db, &stub->version, ISC_TRUE);
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->db == NULL)
dns_db_attach(stub->db, &zone->db);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
dns_db_detach(&stub->db);
if (zone->masterfile != NULL) {
@@ -2753,9 +2882,9 @@ stub_callback(isc_task_t *task, isc_event_t *event) {
dns_message_destroy(&msg);
isc_event_free(&event);
+ LOCK_ZONE(zone);
dns_request_destroy(&zone->request);
- LOCK(&zone->lock);
- zone->flags &= ~DNS_ZONEFLG_REFRESH;
+ DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_REFRESH);
zone->refreshtime = now +
isc_random_jitter(zone->refresh, zone->refresh / 4);
zone->expiretime = now + zone->expire;
@@ -2763,7 +2892,7 @@ stub_callback(isc_task_t *task, isc_event_t *event) {
"refresh time (%u/%u), now %u",
zone->refreshtime, zone->refresh, now);
zone_settimer(zone, now);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
goto free_stub;
next_master:
@@ -2773,31 +2902,31 @@ stub_callback(isc_task_t *task, isc_event_t *event) {
dns_db_detach(&stub->db);
if (msg != NULL)
dns_message_destroy(&msg);
- LOCK(&zone->lock);
isc_event_free(&event);
+ LOCK_ZONE(zone);
dns_request_destroy(&zone->request);
zone->curmaster++;
zone->refreshcnt = 0;
if (exiting || zone->curmaster >= zone->masterscnt) {
- zone->flags &= ~DNS_ZONEFLG_REFRESH;
+ DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_REFRESH);
zone_settimer(zone, now);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
goto free_stub;
}
- UNLOCK(&zone->lock);
queue_soa_query(zone);
+ UNLOCK_ZONE(zone);
goto free_stub;
same_master:
if (msg != NULL)
dns_message_destroy(&msg);
isc_event_free(&event);
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
dns_request_destroy(&zone->request);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
ns_query(zone, NULL, stub);
- goto detach;
+ goto done;
free_stub:
stub->magic = 0;
@@ -2806,7 +2935,7 @@ stub_callback(isc_task_t *task, isc_event_t *event) {
INSIST(stub->version == NULL);
isc_mem_put(stub->mctx, stub, sizeof(*stub));
- detach:
+ done:
INSIST(event == NULL);
return;
}
@@ -2846,7 +2975,7 @@ refresh_callback(isc_task_t *task, isc_event_t *event) {
if (revent->result != ISC_R_SUCCESS) {
zone_log(zone, me, ISC_LOG_INFO, "failure for %s: %s",
- master, dns_result_totext(revent->result));
+ master, dns_result_totext(revent->result));
if (revent->result == ISC_R_TIMEDOUT &&
!dns_request_usedtcp(revent->request)) {
if (zone->refreshcnt < 3)
@@ -2902,9 +3031,9 @@ refresh_callback(isc_task_t *task, isc_event_t *event) {
master);
goto next_master;
}
- LOCK(&zone->lock);
- zone->flags |= DNS_ZONEFLG_USEVC;
- UNLOCK(&zone->lock);
+ LOCK_ZONE(zone);
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_USEVC);
+ UNLOCK_ZONE(zone);
goto same_master;
}
}
@@ -2991,10 +3120,13 @@ refresh_callback(isc_task_t *task, isc_event_t *event) {
zone_log(zone, me, ISC_LOG_DEBUG(1), "Serial: new %u, old %u",
serial, zone->serial);
if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADED) ||
+ DNS_ZONE_FLAG(zone, DNS_ZONEFLG_FORCEXFER) ||
isc_serial_gt(serial, zone->serial)) {
tcp_transfer:
isc_event_free(&event);
+ LOCK_ZONE(zone);
dns_request_destroy(&zone->request);
+ UNLOCK_ZONE(zone);
if (zone->type == dns_zone_slave) {
queue_xfrin(zone);
} else {
@@ -3028,39 +3160,41 @@ refresh_callback(isc_task_t *task, isc_event_t *event) {
}
if (msg != NULL)
dns_message_destroy(&msg);
- return;
+ goto detach;
next_master:
if (msg != NULL)
dns_message_destroy(&msg);
- LOCK(&zone->lock);
isc_event_free(&event);
+ LOCK_ZONE(zone);
dns_request_destroy(&zone->request);
zone->curmaster++;
zone->refreshcnt = 0;
if (zone->curmaster >= zone->masterscnt) {
- zone->flags &= ~DNS_ZONEFLG_REFRESH;
- if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDREFRESH)) {
- zone->flags &= ~DNS_ZONEFLG_NEEDREFRESH;
+ DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_REFRESH);
+ if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDREFRESH)) {
+ DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_NEEDREFRESH);
zone->refreshtime = now;
}
zone_settimer(zone, now);
- UNLOCK(&zone->lock);
- return;
+ UNLOCK_ZONE(zone);
+ goto detach;
}
- UNLOCK(&zone->lock);
queue_soa_query(zone);
- return;
+ UNLOCK_ZONE(zone);
+ goto detach;
same_master:
zone->refreshcnt++;
if (msg != NULL)
dns_message_destroy(&msg);
- LOCK(&zone->lock);
isc_event_free(&event);
+ LOCK_ZONE(zone);
dns_request_destroy(&zone->request);
- UNLOCK(&zone->lock);
queue_soa_query(zone);
+ UNLOCK_ZONE(zone);
+ detach:
+ dns_zone_idetach(&zone);
return;
}
@@ -3072,6 +3206,10 @@ queue_soa_query(dns_zone_t *zone) {
isc_result_t result;
DNS_ENTER;
+ /*
+ * Locked by caller
+ */
+ REQUIRE(LOCKED_ZONE(zone));
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING)) {
cancel_refresh(zone);
@@ -3089,13 +3227,13 @@ queue_soa_query(dns_zone_t *zone) {
* Attach so that we won't clean up
* until the event is delivered.
*/
- dns_zone_iattach(zone, &dummy);
+ zone_iattach(zone, &dummy);
e->ev_arg = zone;
e->ev_sender = NULL;
result = isc_ratelimiter_enqueue(zone->zmgr->rl, zone->task, &e);
if (result != ISC_R_SUCCESS) {
- dns_zone_idetach(&dummy);
+ zone_idetach(&dummy);
isc_event_free(&e);
cancel_refresh(zone);
}
@@ -3155,10 +3293,12 @@ soa_query(isc_task_t *task, isc_event_t *event) {
isc_result_t result;
dns_message_t *message = NULL;
dns_zone_t *zone = event->ev_arg;
+ dns_zone_t *dummy = NULL;
isc_netaddr_t masterip;
dns_tsigkey_t *key = NULL;
isc_uint32_t options;
isc_sockaddr_t src;
+ isc_boolean_t cancel = ISC_TRUE;
REQUIRE(DNS_ZONE_VALID(zone));
@@ -3166,14 +3306,13 @@ soa_query(isc_task_t *task, isc_event_t *event) {
DNS_ENTER;
+ LOCK_ZONE(zone);
if (((event->ev_attributes & ISC_EVENTATTR_CANCELED) != 0) ||
DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING) ||
zone->view->requestmgr == NULL) {
- if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING))
- cancel_refresh(zone);
- isc_event_free(&event);
- dns_zone_idetach(&zone);
- return;
+ if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING))
+ cancel = ISC_FALSE;
+ goto cleanup;
}
/*
@@ -3183,11 +3322,9 @@ soa_query(isc_task_t *task, isc_event_t *event) {
if (result != ISC_R_SUCCESS)
goto cleanup;
- LOCK(&zone->lock);
INSIST(zone->masterscnt > 0);
INSIST(zone->curmaster < zone->masterscnt);
zone->masteraddr = zone->masters[zone->curmaster];
- UNLOCK(&zone->lock);
isc_netaddr_fromsockaddr(&masterip, &zone->masteraddr);
(void)dns_view_getpeertsig(zone->view, &masterip, &key);
@@ -3205,11 +3342,13 @@ soa_query(isc_task_t *task, isc_event_t *event) {
result = ISC_R_NOTIMPLEMENTED;
goto cleanup;
}
+ zone_iattach(zone, &dummy);
result = dns_request_createvia(zone->view->requestmgr, message,
&src, &zone->masteraddr, options, key,
15 /* XXX */, zone->task,
refresh_callback, zone, &zone->request);
if (result != ISC_R_SUCCESS) {
+ zone_idetach(&dummy);
zone_log(zone, me, ISC_LOG_DEBUG(1),
"dns_request_createvia failed: %s",
dns_result_totext(result));
@@ -3217,16 +3356,15 @@ soa_query(isc_task_t *task, isc_event_t *event) {
}
if (key != NULL)
dns_tsigkey_detach(&key);
- dns_message_destroy(&message);
- isc_event_free(&event);
- dns_zone_idetach(&zone);
- return;
+ cancel = ISC_FALSE;
cleanup:
if (message != NULL)
dns_message_destroy(&message);
- cancel_refresh(zone);
+ if (cancel)
+ cancel_refresh(zone);
isc_event_free(&event);
+ UNLOCK_ZONE(zone);
dns_zone_idetach(&zone);
return;
}
@@ -3248,6 +3386,7 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) {
DNS_ENTER;
+ LOCK_ZONE(zone);
if (stub == NULL) {
stub = isc_mem_get(zone->mctx, sizeof *stub);
if (stub == NULL)
@@ -3261,7 +3400,7 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) {
/*
* Attach so that the zone won't disappear from under us.
*/
- dns_zone_iattach(zone, &stub->zone);
+ zone_iattach(zone, &stub->zone);
/*
* If a db exists we will update it, otherwise we create a
@@ -3317,11 +3456,9 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) {
*/
result = create_query(zone, dns_rdatatype_ns, &message);
- LOCK(&zone->lock);
INSIST(zone->masterscnt > 0);
INSIST(zone->curmaster < zone->masterscnt);
zone->masteraddr = zone->masters[zone->curmaster];
- UNLOCK(&zone->lock);
isc_netaddr_fromsockaddr(&masterip, &zone->masteraddr);
(void)dns_view_getpeertsig(zone->view, &masterip, &key);
@@ -3352,9 +3489,10 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) {
goto cleanup;
}
dns_message_destroy(&message);
- return;
+ goto unlock;
cleanup:
+ cancel_refresh(zone);
if (stub != NULL) {
stub->magic = 0;
if (stub->version != NULL)
@@ -3363,10 +3501,12 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) {
if (stub->db != NULL)
dns_db_detach(&stub->db);
isc_mem_put(stub->mctx, stub, sizeof(*stub));
+ zone_idetach(&zone);
}
if (message != NULL)
dns_message_destroy(&message);
- cancel_refresh(zone);
+ unlock:
+ UNLOCK_ZONE(zone);
return;
}
@@ -3384,9 +3524,9 @@ zone_shutdown(isc_task_t *task, isc_event_t *event) {
INSIST(event->ev_type == DNS_EVENT_ZONECONTROL);
INSIST(zone->erefs == 0);
zone_log(zone, "zone_shutdown", ISC_LOG_DEBUG(3), "shutting down");
- LOCK(&zone->lock);
- zone->flags |= DNS_ZONEFLG_EXITING;
- UNLOCK(&zone->lock);
+ LOCK_ZONE(zone);
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_EXITING);
+ UNLOCK_ZONE(zone);
/*
* If we were waiting for xfrin quota, step out of
@@ -3403,13 +3543,18 @@ zone_shutdown(isc_task_t *task, isc_event_t *event) {
if (zone->xfr != NULL)
dns_xfrin_shutdown(zone->xfr);
- if (zone->request != NULL)
+ LOCK_ZONE(zone);
+ if (zone->request != NULL) {
dns_request_cancel(zone->request);
+ }
+ UNLOCK_ZONE(zone);
if (zone->readio != NULL)
zonemgr_cancelio(zone->readio);
+ LOCK_ZONE(zone);
notify_cancel(zone);
+ UNLOCK_ZONE(zone);
if (zone->timer != NULL) {
result = isc_timer_reset(zone->timer, isc_timertype_inactive,
@@ -3427,7 +3572,9 @@ static void
zone_timer(isc_task_t *task, isc_event_t *event) {
const char me[] = "zone_timer";
dns_zone_t *zone = (dns_zone_t *)event->ev_arg;
+
UNUSED(task);
+ REQUIRE(DNS_ZONE_VALID(zone));
DNS_ENTER;
@@ -3439,7 +3586,7 @@ zone_timer(isc_task_t *task, isc_event_t *event) {
isc_event_free(&event);
}
-static isc_result_t
+static void
zone_settimer(dns_zone_t *zone, isc_stdtime_t now) {
const char me[] = "zone_settimer";
isc_stdtime_t next = 0;
@@ -3448,6 +3595,8 @@ zone_settimer(dns_zone_t *zone, isc_stdtime_t now) {
isc_result_t result;
REQUIRE(DNS_ZONE_VALID(zone));
+ if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING))
+ return;
switch (zone->type) {
case dns_zone_master:
@@ -3489,6 +3638,10 @@ zone_settimer(dns_zone_t *zone, isc_stdtime_t now) {
"settimer inactive");
result = isc_timer_reset(zone->timer, isc_timertype_inactive,
NULL, NULL, ISC_TRUE);
+ if (result != ISC_R_SUCCESS)
+ zone_log(zone, me, ISC_LOG_ERROR,
+ "isc_timer_reset failed: %s",
+ isc_result_totext(result));
} else {
if (next <= now) {
next = now;
@@ -3503,10 +3656,11 @@ zone_settimer(dns_zone_t *zone, isc_stdtime_t now) {
next, now, next - now);
result = isc_timer_reset(zone->timer, isc_timertype_once,
&expires, &interval, ISC_TRUE);
+ if (result != ISC_R_SUCCESS)
+ zone_log(zone, me, ISC_LOG_ERROR,
+ "isc_timer_reset failed: %s",
+ isc_result_totext(result));
}
- if (result != ISC_R_SUCCESS)
- return (result);
- return (ISC_R_SUCCESS);
}
static void
@@ -3515,19 +3669,17 @@ cancel_refresh(dns_zone_t *zone) {
isc_stdtime_t now;
/*
- * Locked by caller.
+ * 'zone' locked by caller.
*/
REQUIRE(DNS_ZONE_VALID(zone));
-
- REQUIRE(ISLOCKED(&zone->lock));
+ REQUIRE(LOCKED_ZONE(zone));
DNS_ENTER;
- zone->flags &= ~DNS_ZONEFLG_REFRESH;
+ DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_REFRESH);
isc_stdtime_get(&now);
- if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING))
- zone_settimer(zone, now);
+ zone_settimer(zone, now);
}
static isc_result_t
@@ -3602,7 +3754,7 @@ notify_createmessage(dns_zone_t *zone, unsigned int flags,
dns_name_init(tempname, NULL);
dns_name_clone(&zone->origin, tempname);
dns_db_currentversion(zone->db, &version);
- result = dns_db_findnode(zone->db, tempname, ISC_FALSE, &node);
+ result = dns_db_findnode(zone->db, tempname, ISC_FALSE, &node);
if (result != ISC_R_SUCCESS)
goto soa_cleanup;
@@ -3689,6 +3841,8 @@ dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from,
isc_result_t result;
isc_stdtime_t now;
char fromtext[ISC_SOCKADDR_FORMATSIZE];
+ int match = 0;
+ isc_netaddr_t netaddr;
REQUIRE(DNS_ZONE_VALID(zone));
@@ -3717,12 +3871,12 @@ dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from,
/*
* We only handle NOTIFY (SOA) at the present.
*/
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (msg->counts[DNS_SECTION_QUESTION] == 0 ||
dns_message_findname(msg, DNS_SECTION_QUESTION, &zone->origin,
dns_rdatatype_soa, dns_rdatatype_none,
NULL, NULL) != ISC_R_SUCCESS) {
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
if (msg->counts[DNS_SECTION_QUESTION] == 0) {
zone_log(zone, me, ISC_LOG_NOTICE,
"FORMERR no question: %s", fromtext);
@@ -3737,7 +3891,7 @@ dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from,
* If we are a master zone just succeed.
*/
if (zone->type == dns_zone_master) {
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (ISC_R_SUCCESS);
}
@@ -3745,8 +3899,18 @@ dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from,
if (isc_sockaddr_eqaddr(from, &zone->masters[i]))
break;
- if (i >= zone->masterscnt) {
- UNLOCK(&zone->lock);
+ /*
+ * Accept notify requests from non masters if they are on
+ * 'zone->notify_acl'. If DNS_ZONEOPT_NOTIFYFORWARD is set
+ * then forward the notify.
+ */
+ isc_netaddr_fromsockaddr(&netaddr, from);
+ if (i >= zone->masterscnt && zone->notify_acl != NULL &&
+ dns_acl_match(&netaddr, NULL, zone->notify_acl, NULL, &match,
+ NULL) == ISC_R_SUCCESS && match > 0) {
+ /* Accept notify. */
+ } else if (i >= zone->masterscnt) {
+ UNLOCK_ZONE(zone);
zone_log(zone, me, ISC_LOG_DEBUG(3),
"REFUSED notify from non master: %s", fromtext);
return (DNS_R_REFUSED);
@@ -3779,7 +3943,7 @@ dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from,
zone_log(zone, me, ISC_LOG_DEBUG(3),
"zone up to date: %s",
fromtext);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (ISC_R_SUCCESS);
}
}
@@ -3793,9 +3957,9 @@ dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from,
* can perform a refresh check when the current one completes
*/
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_REFRESH)) {
- zone->flags |= DNS_ZONEFLG_NEEDREFRESH;
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NEEDREFRESH);
zone->notifyfrom = *from;
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
zone_log(zone, me, ISC_LOG_DEBUG(3),
"refresh in progress, refresh check queued: %s",
fromtext);
@@ -3803,22 +3967,33 @@ dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from,
}
isc_stdtime_get(&now);
zone->notifyfrom = *from;
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
dns_zone_refresh(zone);
return (ISC_R_SUCCESS);
}
+void
+dns_zone_setnotifyacl(dns_zone_t *zone, dns_acl_t *acl) {
+
+ REQUIRE(DNS_ZONE_VALID(zone));
+
+ LOCK_ZONE(zone);
+ if (zone->notify_acl != NULL)
+ dns_acl_detach(&zone->notify_acl);
+ dns_acl_attach(acl, &zone->notify_acl);
+ UNLOCK_ZONE(zone);
+}
void
dns_zone_setqueryacl(dns_zone_t *zone, dns_acl_t *acl) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->query_acl != NULL)
dns_acl_detach(&zone->query_acl);
dns_acl_attach(acl, &zone->query_acl);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
void
@@ -3826,11 +4001,11 @@ dns_zone_setupdateacl(dns_zone_t *zone, dns_acl_t *acl) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->update_acl != NULL)
dns_acl_detach(&zone->update_acl);
dns_acl_attach(acl, &zone->update_acl);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
void
@@ -3838,11 +4013,11 @@ dns_zone_setforwardacl(dns_zone_t *zone, dns_acl_t *acl) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->forward_acl != NULL)
dns_acl_detach(&zone->forward_acl);
dns_acl_attach(acl, &zone->forward_acl);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
void
@@ -3850,13 +4025,20 @@ dns_zone_setxfracl(dns_zone_t *zone, dns_acl_t *acl) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->xfr_acl != NULL)
dns_acl_detach(&zone->xfr_acl);
dns_acl_attach(acl, &zone->xfr_acl);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
+dns_acl_t *
+dns_zone_getnotifyacl(dns_zone_t *zone) {
+
+ REQUIRE(DNS_ZONE_VALID(zone));
+
+ return (zone->notify_acl);
+}
dns_acl_t *
dns_zone_getqueryacl(dns_zone_t *zone) {
@@ -3895,10 +4077,10 @@ dns_zone_clearupdateacl(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->update_acl != NULL)
dns_acl_detach(&zone->update_acl);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
void
@@ -3906,22 +4088,32 @@ dns_zone_clearforwardacl(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->forward_acl != NULL)
dns_acl_detach(&zone->forward_acl);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
+void
+dns_zone_clearnotifyacl(dns_zone_t *zone) {
+
+ REQUIRE(DNS_ZONE_VALID(zone));
+
+ LOCK_ZONE(zone);
+ if (zone->notify_acl != NULL)
+ dns_acl_detach(&zone->notify_acl);
+ UNLOCK_ZONE(zone);
+}
void
dns_zone_clearqueryacl(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->query_acl != NULL)
dns_acl_detach(&zone->query_acl);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
void
@@ -3929,10 +4121,10 @@ dns_zone_clearxfracl(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->xfr_acl != NULL)
dns_acl_detach(&zone->xfr_acl);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
void
@@ -3976,7 +4168,7 @@ zone_tostr(dns_zone_t *zone, char *buf, size_t length) {
REQUIRE(length > 1);
/*
- * Leave space for terminating '\0'.
+ * Leave space for terminating '\0'.
*/
isc_buffer_init(&buffer, buf, length - 1);
if (dns_name_dynamic(&zone->origin))
@@ -4093,11 +4285,11 @@ void
dns_zone_settask(dns_zone_t *zone, isc_task_t *task) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->task != NULL)
isc_task_detach(&zone->task);
isc_task_attach(task, &zone->task);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
void
@@ -4201,9 +4393,9 @@ dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) {
isc_result_t result;
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
result = zone_replacedb(zone, db, dump);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (result);
}
@@ -4212,7 +4404,11 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) {
dns_dbversion_t *ver;
isc_result_t result;
+ /*
+ * 'zone' locked by caller.
+ */
REQUIRE(DNS_ZONE_VALID(zone));
+ REQUIRE(LOCKED_ZONE(zone));
ver = NULL;
dns_db_currentversion(db, &ver);
@@ -4279,7 +4475,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) {
if (zone->db != NULL)
dns_db_detach(&zone->db);
dns_db_attach(db, &zone->db);
- zone->flags |= DNS_ZONEFLG_LOADED|DNS_ZONEFLG_NEEDNOTIFY;
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADED|DNS_ZONEFLG_NEEDNOTIFY);
return (ISC_R_SUCCESS);
fail:
@@ -4300,17 +4496,17 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) {
zone_log(zone, me, ISC_LOG_DEBUG(1), "%s", dns_result_totext(result));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
INSIST((zone->flags & DNS_ZONEFLG_REFRESH) != 0);
- zone->flags &= ~DNS_ZONEFLG_REFRESH;
+ DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_REFRESH);
isc_stdtime_get(&now);
switch (result) {
case ISC_R_SUCCESS:
- zone->flags |= DNS_ZONEFLG_NEEDNOTIFY;
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NEEDNOTIFY);
/*FALLTHROUGH*/
case DNS_R_UPTODATE:
- zone->flags &= ~DNS_ZONEFLG_FORCELOAD;
+ DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_FORCEXFER);
/*
* Has the zone expired underneath us?
*/
@@ -4359,14 +4555,14 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) {
zone->refresh + zone->retry,
DNS_MAX_EXPIRE);
zone->minimum = minimum;
- zone->flags |= DNS_ZONEFLG_HAVETIMERS;
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_HAVETIMERS);
}
/*
* Set our next update/expire times.
*/
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDREFRESH)) {
- zone->flags &= ~DNS_ZONEFLG_NEEDREFRESH;
+ DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_NEEDREFRESH);
zone->refreshtime = now;
zone->expiretime = now + zone->expire;
} else {
@@ -4388,13 +4584,12 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) {
if (zone->curmaster >= zone->masterscnt)
zone->curmaster = 0;
else {
- zone->flags |= DNS_ZONEFLG_REFRESH;
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_REFRESH);
again = ISC_TRUE;
}
break;
}
zone_settimer(zone, now);
- UNLOCK(&zone->lock);
/*
* If creating the transfer object failed, zone->xfr is NULL.
@@ -4408,7 +4603,7 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) {
/*
* This transfer finishing freed up a transfer quota slot.
- * Let any zones waiting for quota have it.
+ * Let any other zones waiting for quota have it.
*/
RWLOCK(&zone->zmgr->rwlock, isc_rwlocktype_write);
ISC_LIST_UNLINK(zone->zmgr->xfrin_in_progress, zone, statelink);
@@ -4422,6 +4617,7 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) {
*/
if (again && !DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING))
queue_soa_query(zone);
+ UNLOCK_ZONE(zone);
}
static void
@@ -4440,11 +4636,11 @@ zone_loaddone(void *arg, isc_result_t result) {
if (result == ISC_R_SUCCESS || result == DNS_R_SEENINCLUDE)
result = tresult;
- LOCK(&load->zone->lock);
+ LOCK_ZONE(load->zone);
(void)zone_postload(load->zone, load->db, load->loadtime, result);
zonemgr_putio(&load->zone->readio);
- load->zone->flags &= ~DNS_ZONEFLG_LOADING;
- UNLOCK(&load->zone->lock);
+ DNS_ZONE_CLRFLAG(load->zone, DNS_ZONEFLG_LOADING);
+ UNLOCK_ZONE(load->zone);
load->magic = 0;
dns_db_detach(&load->db);
@@ -4458,22 +4654,22 @@ dns_zone_getssutable(dns_zone_t *zone, dns_ssutable_t **table) {
REQUIRE(table != NULL);
REQUIRE(*table == NULL);
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->ssutable != NULL)
dns_ssutable_attach(zone->ssutable, table);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
void
dns_zone_setssutable(dns_zone_t *zone, dns_ssutable_t *table) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
if (zone->ssutable != NULL)
dns_ssutable_detach(&zone->ssutable);
if (table != NULL)
dns_ssutable_attach(table, &zone->ssutable);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
void
@@ -4586,6 +4782,16 @@ got_transfer_quota(isc_task_t *task, isc_event_t *event) {
* Determine if we should attempt to sign the request with TSIG.
*/
result = ISC_R_NOTFOUND;
+ /*
+ * First, look for a tsig key in the master statement, then
+ * try for a server key.
+ */
+ if ((zone->masterkeynames != NULL) &&
+ (zone->masterkeynames[zone->curmaster] != NULL)) {
+ dns_view_t *view = dns_zone_getview(zone);
+ dns_name_t *keyname = zone->masterkeynames[zone->curmaster];
+ result = dns_view_gettsig(view, keyname, &tsigkey);
+ }
if (tsigkey == NULL)
result = dns_view_getpeertsig(zone->view, &masterip, &tsigkey);
@@ -4641,9 +4847,9 @@ sendtomaster(dns_forward_t *forward) {
isc_result_t result;
isc_sockaddr_t src;
- LOCK(&forward->zone->lock);
+ LOCK_ZONE(forward->zone);
if (forward->which >= forward->zone->masterscnt) {
- UNLOCK(&forward->zone->lock);
+ UNLOCK_ZONE(forward->zone);
return (ISC_R_NOMORE);
}
@@ -4673,7 +4879,7 @@ sendtomaster(dns_forward_t *forward) {
forward_callback, forward,
&forward->request);
unlock:
- UNLOCK(&forward->zone->lock);
+ UNLOCK_ZONE(forward->zone);
return (result);
}
@@ -4702,7 +4908,7 @@ forward_callback(isc_task_t *task, isc_event_t *event) {
zone_log(zone, me, ISC_LOG_INFO, "failure for %s: %s",
master, dns_result_totext(revent->result));
goto next_master;
- }
+ }
result = dns_message_create(zone->mctx, DNS_MESSAGE_INTENTPARSE, &msg);
if (result != ISC_R_SUCCESS)
@@ -4750,7 +4956,7 @@ forward_callback(isc_task_t *task, isc_event_t *event) {
/* call callback */
(forward->callback)(forward->callback_arg, ISC_R_SUCCESS, msg);
- dns_message_destroy(&msg);
+ msg = NULL;
dns_request_destroy(&forward->request);
forward_destroy(forward);
isc_event_free(&event);
@@ -4958,7 +5164,7 @@ dns_zonemgr_managezone(dns_zonemgr_t *zmgr, dns_zone_t *zone) {
REQUIRE(DNS_ZONEMGR_VALID(zmgr));
RWLOCK(&zmgr->rwlock, isc_rwlocktype_write);
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
REQUIRE(zone->task == NULL);
REQUIRE(zone->timer == NULL);
REQUIRE(zone->zmgr == NULL);
@@ -4977,7 +5183,7 @@ dns_zonemgr_managezone(dns_zonemgr_t *zmgr, dns_zone_t *zone) {
result = isc_timer_create(zmgr->timermgr, isc_timertype_inactive,
NULL, NULL,
- zmgr->task, zone_timer, zone,
+ zone->task, zone_timer, zone,
&zone->timer);
if (result != ISC_R_SUCCESS)
goto cleanup_task;
@@ -4992,7 +5198,7 @@ dns_zonemgr_managezone(dns_zonemgr_t *zmgr, dns_zone_t *zone) {
isc_task_detach(&zone->task);
unlock:
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_write);
return (result);
}
@@ -5006,7 +5212,7 @@ dns_zonemgr_releasezone(dns_zonemgr_t *zmgr, dns_zone_t *zone) {
REQUIRE(zone->zmgr == zmgr);
RWLOCK(&zmgr->rwlock, isc_rwlocktype_write);
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
ISC_LIST_UNLINK(zmgr->zones, zone, link);
zone->zmgr = NULL;
@@ -5014,7 +5220,7 @@ dns_zonemgr_releasezone(dns_zonemgr_t *zmgr, dns_zone_t *zone) {
if (zmgr->refs == 0)
free_now = ISC_TRUE;
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_write);
if (free_now)
@@ -5270,7 +5476,7 @@ zmgr_start_xfrin_ifquota(dns_zonemgr_t *zmgr, dns_zone_t *zone) {
if (e == NULL)
return (ISC_R_NOMEMORY);
- LOCK(&zone->lock);
+ LOCK_ZONE(zone);
INSIST(zone->statelist == &zmgr->waiting_for_xfrin);
ISC_LIST_UNLINK(zmgr->waiting_for_xfrin, zone, statelink);
ISC_LIST_APPEND(zmgr->xfrin_in_progress, zone, statelink);
@@ -5284,7 +5490,7 @@ zmgr_start_xfrin_ifquota(dns_zonemgr_t *zmgr, dns_zone_t *zone) {
*/
zone->erefs++;
isc_task_send(zone->task, &e);
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (ISC_R_SUCCESS);
}
@@ -5336,9 +5542,9 @@ zonemgr_getio(dns_zonemgr_t *zmgr, isc_boolean_t high,
isc_mem_put(zmgr->mctx, io, sizeof(*io));
return (ISC_R_NOMEMORY);
}
- io->zmgr = zmgr;
- io->high = high;
- io->task = NULL;
+ io->zmgr = zmgr;
+ io->high = high;
+ io->task = NULL;
isc_task_attach(task, &io->task);
ISC_LINK_INIT(io, link);
io->magic = IO_MAGIC;
@@ -5473,7 +5679,9 @@ void
dns_zone_forcereload(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
- zone->flags |= DNS_ZONEFLG_FORCELOAD;
+ LOCK_ZONE(zone);
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_FORCEXFER);
+ UNLOCK_ZONE(zone);
dns_zone_refresh(zone);
}
@@ -5481,13 +5689,14 @@ isc_boolean_t
dns_zone_isforced(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
- return (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_FORCELOAD));
+ return (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_FORCEXFER));
}
isc_result_t
dns_zone_setstatistics(dns_zone_t *zone, isc_boolean_t on) {
isc_result_t result = ISC_R_SUCCESS;
- LOCK(&zone->lock);
+
+ LOCK_ZONE(zone);
if (on) {
if (zone->counters != NULL)
goto done;
@@ -5498,7 +5707,7 @@ dns_zone_setstatistics(dns_zone_t *zone, isc_boolean_t on) {
dns_stats_freecounters(zone->mctx, &zone->counters);
}
done:
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
return (result);
}
@@ -5527,35 +5736,36 @@ dns_zone_dialup(dns_zone_t *zone) {
void
dns_zone_setdialup(dns_zone_t *zone, dns_dialuptype_t dialup) {
REQUIRE(DNS_ZONE_VALID(zone));
- LOCK(&zone->lock);
- zone->flags &= ~(DNS_ZONEFLG_DIALNOTIFY |
+
+ LOCK_ZONE(zone);
+ DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_DIALNOTIFY |
DNS_ZONEFLG_DIALREFRESH |
DNS_ZONEFLG_NOREFRESH);
switch (dialup) {
case dns_dialuptype_no:
break;
case dns_dialuptype_yes:
- zone->flags |= (DNS_ZONEFLG_DIALNOTIFY |
+ DNS_ZONE_SETFLAG(zone, (DNS_ZONEFLG_DIALNOTIFY |
DNS_ZONEFLG_DIALREFRESH |
- DNS_ZONEFLG_NOREFRESH);
+ DNS_ZONEFLG_NOREFRESH));
break;
case dns_dialuptype_notify:
- zone->flags |= DNS_ZONEFLG_DIALNOTIFY;
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_DIALNOTIFY);
break;
case dns_dialuptype_notifypassive:
- zone->flags |= DNS_ZONEFLG_DIALNOTIFY;
- zone->flags |= DNS_ZONEFLG_NOREFRESH;
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_DIALNOTIFY);
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NOREFRESH);
break;
case dns_dialuptype_refresh:
- zone->flags |= DNS_ZONEFLG_DIALREFRESH;
- zone->flags |= DNS_ZONEFLG_NOREFRESH;
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_DIALREFRESH);
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NOREFRESH);
break;
case dns_dialuptype_passive:
- zone->flags |= DNS_ZONEFLG_NOREFRESH;
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NOREFRESH);
break;
default:
INSIST(0);
}
- UNLOCK(&zone->lock);
+ UNLOCK_ZONE(zone);
}
diff --git a/lib/dns/zt.c b/lib/dns/zt.c
index 45e9c727..bdbbbaad 100644
--- a/lib/dns/zt.c
+++ b/lib/dns/zt.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zt.c,v 1.26 2000/10/05 06:39:22 marka Exp $ */
+/* $Id: zt.c,v 1.27 2000/12/11 19:24:30 bwelling Exp $ */
#include <config.h>
@@ -30,7 +30,7 @@
struct dns_zt {
/* Unlocked. */
- unsigned int magic;
+ unsigned int magic;
isc_mem_t *mctx;
dns_rdataclass_t rdclass;
isc_rwlock_t rwlock;
diff --git a/lib/isc/assertions.c b/lib/isc/assertions.c
index 8011ca9d..2d1c7e96 100644
--- a/lib/isc/assertions.c
+++ b/lib/isc/assertions.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: assertions.c,v 1.12 2000/08/01 01:29:13 tale Exp $ */
+/* $Id: assertions.c,v 1.13 2000/12/06 00:29:55 tale Exp $ */
#include <config.h>
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <isc/assertions.h>
+#include <isc/msgs.h>
/*
* Forward.
@@ -49,6 +50,11 @@ const char *
isc_assertion_typetotext(isc_assertiontype_t type) {
const char *result;
+ /*
+ * These strings have purposefully not been internationalized
+ * because they are considered to essentially be keywords of
+ * the ISC development environment.
+ */
switch (type) {
case isc_assertiontype_require:
result = "REQUIRE";
@@ -76,8 +82,10 @@ static void
default_callback(const char *file, int line, isc_assertiontype_t type,
const char *cond)
{
- fprintf(stderr, "%s:%d: %s(%s) failed.\n",
- file, line, isc_assertion_typetotext(type), cond);
+ fprintf(stderr, "%s:%d: %s(%s) %s.\n",
+ file, line, isc_assertion_typetotext(type), cond,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
fflush(stderr);
abort();
/* NOTREACHED */
diff --git a/lib/isc/commandline.c b/lib/isc/commandline.c
index 62bda7ac..9faaa66e 100644
--- a/lib/isc/commandline.c
+++ b/lib/isc/commandline.c
@@ -48,7 +48,7 @@
* SUCH DAMAGE.
*/
-/* $Id: commandline.c,v 1.10 2000/08/01 01:29:19 tale Exp $ */
+/* $Id: commandline.c,v 1.11 2000/12/06 00:29:56 tale Exp $ */
/*
* This file was adapted from the NetBSD project's source tree, RCS ID:
@@ -68,6 +68,7 @@
#include <stdio.h>
#include <isc/commandline.h>
+#include <isc/msgs.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -140,8 +141,12 @@ isc_commandline_parse(int argc, char * const *argv, const char *options) {
isc_commandline_index++;
if (isc_commandline_errprint && *options != ':')
- fprintf(stderr, "%s: illegal option -- %c\n",
+ fprintf(stderr, "%s: %s -- %c\n",
isc_commandline_progname,
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_COMMANDLINE,
+ ISC_MSG_ILLEGALOPT,
+ "illegal option"),
isc_commandline_option);
return (BADOPT);
@@ -189,10 +194,14 @@ isc_commandline_parse(int argc, char * const *argv, const char *options) {
return (BADARG);
if (isc_commandline_errprint)
- fprintf(stderr,
- "%s: option requires an argument -- %c\n",
- isc_commandline_progname,
- isc_commandline_option);
+ fprintf(stderr, "%s: %s -- %c\n",
+ isc_commandline_progname,
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_COMMANDLINE,
+ ISC_MSG_OPTNEEDARG,
+ "option requires"
+ "an argument"),
+ isc_commandline_option);
return (BADOPT);
}
diff --git a/lib/isc/error.c b/lib/isc/error.c
index 3f58a57c..5b280000 100644
--- a/lib/isc/error.c
+++ b/lib/isc/error.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: error.c,v 1.13 2000/08/01 01:29:20 tale Exp $ */
+/* $Id: error.c,v 1.14 2000/12/06 00:29:57 tale Exp $ */
#include <config.h>
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <isc/error.h>
+#include <isc/msgs.h>
static void
default_unexpected_callback(const char *, int, const char *, va_list);
@@ -70,7 +71,9 @@ isc_error_fatal(const char *file, int line, const char *format, ...) {
void
isc_error_runtimecheck(const char *file, int line, const char *expression) {
- isc_error_fatal(file, line, "RUNTIME_CHECK(%s) failed", expression);
+ isc_error_fatal(file, line, "RUNTIME_CHECK(%s) %s", expression,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
}
static void
@@ -87,7 +90,9 @@ static void
default_fatal_callback(const char *file, int line, const char *format,
va_list args)
{
- fprintf(stderr, "%s:%d: fatal error: ", file, line);
+ fprintf(stderr, "%s:%d: %s: ", file, line,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FATALERROR, "fatal error"));
vfprintf(stderr, format, args);
fprintf(stderr, "\n");
fflush(stderr);
diff --git a/lib/isc/include/isc/Makefile.in b/lib/isc/include/isc/Makefile.in
index d55e02bc..064de55d 100644
--- a/lib/isc/include/isc/Makefile.in
+++ b/lib/isc/include/isc/Makefile.in
@@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.46 2000/11/14 23:39:14 tale Exp $
+# $Id: Makefile.in,v 1.47 2000/12/06 01:24:24 tale Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@@ -31,7 +31,7 @@ HEADERS = assertions.h base64.h bitstring.h boolean.h buffer.h \
eventclass.h \
file.h formatcheck.h fsaccess.h heap.h hex.h hmacmd5.h \
interfaceiter.h @ISC_IPV6_H@ lang.h lex.h \
- lfsr.h lib.h list.h log.h magic.h md5.h mem.h msgcat.h \
+ lfsr.h lib.h list.h log.h magic.h md5.h mem.h msgcat.h msgs.h \
mutexblock.h netaddr.h ondestroy.h os.h \
print.h quota.h random.h ratelimiter.h region.h resource.h \
result.h resultclass.h rwlock.h serial.h sha1.h sockaddr.h \
diff --git a/lib/isc/include/isc/buffer.h b/lib/isc/include/isc/buffer.h
index 6e174836..2c7caa47 100644
--- a/lib/isc/include/isc/buffer.h
+++ b/lib/isc/include/isc/buffer.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: buffer.h,v 1.36 2000/08/17 02:09:12 bwelling Exp $ */
+/* $Id: buffer.h,v 1.37 2000/12/26 20:51:14 tale Exp $ */
#ifndef ISC_BUFFER_H
#define ISC_BUFFER_H 1
@@ -112,9 +112,7 @@
* To make many functions be inline macros (via #define) define this.
* If it is undefined, a function will be used.
*/
-#if 0
-#define ISC_BUFFER_USEINLINE
-#endif
+/* #define ISC_BUFFER_USEINLINE */
ISC_LANG_BEGINDECLS
@@ -730,7 +728,7 @@ ISC_LANG_ENDDECLS
isc_uint8_t _val2 = (_val); \
_cp = isc_buffer_used(_b); \
(_b)->used++; \
- _cp[0] = (_val2 & 0x00ff); \
+ _cp[0] = _val2 & 0x00ff; \
} while (0)
#define ISC__BUFFER_PUTUINT16(_b, _val) \
@@ -739,8 +737,8 @@ ISC_LANG_ENDDECLS
isc_uint16_t _val2 = (_val); \
_cp = isc_buffer_used(_b); \
(_b)->used += 2; \
- _cp[0] = (_val2 & 0xff00U) >> 8; \
- _cp[1] = (_val2 & 0x00ffU); \
+ _cp[0] = (unsigned char)((_val2 & 0xff00U) >> 8); \
+ _cp[1] = (unsigned char)(_val2 & 0x00ffU); \
} while (0)
#define ISC__BUFFER_PUTUINT32(_b, _val) \
@@ -749,10 +747,10 @@ ISC_LANG_ENDDECLS
isc_uint32_t _val2 = (_val); \
_cp = isc_buffer_used(_b); \
(_b)->used += 4; \
- _cp[0] = (_val2 & 0xff000000) >> 24; \
- _cp[1] = (_val2 & 0x00ff0000) >> 16; \
- _cp[2] = (_val2 & 0x0000ff00) >> 8; \
- _cp[3] = (_val2 & 0x000000ff); \
+ _cp[0] = (unsigned char)((_val2 & 0xff000000) >> 24); \
+ _cp[1] = (unsigned char)((_val2 & 0x00ff0000) >> 16); \
+ _cp[2] = (unsigned char)((_val2 & 0x0000ff00) >> 8); \
+ _cp[3] = (unsigned char)((_val2 & 0x000000ff)); \
} while (0)
#if defined(ISC_BUFFER_USEINLINE)
diff --git a/lib/isc/include/isc/lex.h b/lib/isc/include/isc/lex.h
index 00574e89..bf46be43 100644
--- a/lib/isc/include/isc/lex.h
+++ b/lib/isc/include/isc/lex.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lex.h,v 1.23 2000/11/08 01:55:30 bwelling Exp $ */
+/* $Id: lex.h,v 1.24 2000/12/09 02:05:26 gson Exp $ */
#ifndef ISC_LEX_H
#define ISC_LEX_H 1
@@ -335,6 +335,21 @@ isc_lex_ungettoken(isc_lex_t *lex, isc_token_t *tokenp);
* There is no ungotten token already.
*/
+void
+isc_lex_getlasttokentext(isc_lex_t *lex, isc_token_t *tokenp, isc_region_t *r);
+/*
+ * Returns a region containing the text of the last token returned.
+ *
+ * Requires:
+ * 'lex' is a valid lexer.
+ *
+ * 'lex' has an input source.
+ *
+ * 'tokenp' points to a valid token.
+ *
+ * A token has been gotten and not ungotten.
+ */
+
char *
isc_lex_getsourcename(isc_lex_t *lex);
/*
diff --git a/lib/isc/include/isc/list.h b/lib/isc/include/isc/list.h
index f70884f5..e1bc8823 100644
--- a/lib/isc/include/isc/list.h
+++ b/lib/isc/include/isc/list.h
@@ -15,14 +15,14 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: list.h,v 1.15 2000/10/20 13:35:56 marka Exp $ */
+/* $Id: list.h,v 1.17 2000/12/15 00:20:53 gson Exp $ */
#ifndef ISC_LIST_H
#define ISC_LIST_H 1
#include <isc/boolean.h>
#include <isc/assertions.h>
-#if 1
+#ifdef ISC_LIST_CHECKINIT
#define ISC_LINK_INSIST(x) ISC_INSIST(x)
#else
#define ISC_LINK_INSIST(x)
@@ -44,7 +44,7 @@
#define ISC_LIST_TAIL(list) ((list).tail)
#define ISC_LIST_EMPTY(list) ISC_TF((list).head == NULL)
-#define ISC_LIST_PREPENDUNSAFE(list, elt, link) \
+#define __ISC_LIST_PREPENDUNSAFE(list, elt, link) \
do { \
if ((list).head != NULL) \
(list).head->link.prev = (elt); \
@@ -58,10 +58,13 @@
#define ISC_LIST_PREPEND(list, elt, link) \
do { \
ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \
- ISC_LIST_PREPENDUNSAFE(list, elt, link); \
+ __ISC_LIST_PREPENDUNSAFE(list, elt, link); \
} while (0)
-#define ISC_LIST_APPENDUNSAFE(list, elt, link) \
+#define ISC_LIST_INITANDPREPEND(list, elt, link) \
+ __ISC_LIST_PREPENDUNSAFE(list, elt, link)
+
+#define __ISC_LIST_APPENDUNSAFE(list, elt, link) \
do { \
if ((list).tail != NULL) \
(list).tail->link.next = (elt); \
@@ -75,10 +78,13 @@
#define ISC_LIST_APPEND(list, elt, link) \
do { \
ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \
- ISC_LIST_APPENDUNSAFE(list, elt, link); \
+ __ISC_LIST_APPENDUNSAFE(list, elt, link); \
} while (0)
-#define ISC_LIST_UNLINKUNSAFE(list, elt, link) \
+#define ISC_LIST_INITANDAPPEND(list, elt, link) \
+ __ISC_LIST_APPENDUNSAFE(list, elt, link)
+
+#define __ISC_LIST_UNLINKUNSAFE(list, elt, link) \
do { \
if ((elt)->link.next != NULL) \
(elt)->link.next->link.prev = (elt)->link.prev; \
@@ -95,13 +101,13 @@
#define ISC_LIST_UNLINK(list, elt, link) \
do { \
ISC_LINK_INSIST(ISC_LINK_LINKED(elt, link)); \
- ISC_LIST_UNLINKUNSAFE(list, elt, link); \
+ __ISC_LIST_UNLINKUNSAFE(list, elt, link); \
} while (0)
#define ISC_LIST_PREV(elt, link) ((elt)->link.prev)
#define ISC_LIST_NEXT(elt, link) ((elt)->link.next)
-#define ISC_LIST_INSERTBEFOREUNSAFE(list, before, elt, link) \
+#define __ISC_LIST_INSERTBEFOREUNSAFE(list, before, elt, link) \
do { \
if ((before)->link.prev == NULL) \
ISC_LIST_PREPEND(list, elt, link); \
@@ -117,10 +123,10 @@
do { \
ISC_LINK_INSIST(ISC_LINK_LINKED(before, link)); \
ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \
- ISC_LIST_INSERTBEFOREUNSAFE(list, before, elt, link); \
+ __ISC_LIST_INSERTBEFOREUNSAFE(list, before, elt, link); \
} while (0)
-#define ISC_LIST_INSERTAFTERUNSAFE(list, after, elt, link) \
+#define __ISC_LIST_INSERTAFTERUNSAFE(list, after, elt, link) \
do { \
if ((after)->link.next == NULL) \
ISC_LIST_APPEND(list, elt, link); \
@@ -136,7 +142,7 @@
do { \
ISC_LINK_INSIST(ISC_LINK_LINKED(after, link)); \
ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \
- ISC_LIST_INSERTAFTERUNSAFE(list, after, elt, link); \
+ __ISC_LIST_INSERTAFTERUNSAFE(list, after, elt, link); \
} while (0)
#define ISC_LIST_APPENDLIST(list1, list2, link) \
@@ -153,10 +159,10 @@
} while (0)
#define ISC_LIST_ENQUEUE(list, elt, link) ISC_LIST_APPEND(list, elt, link)
-#define ISC_LIST_ENQUEUEUNSAFE(list, elt, link) \
- ISC_LIST_APPENDUNSAFE(list, elt, link)
+#define __ISC_LIST_ENQUEUEUNSAFE(list, elt, link) \
+ __ISC_LIST_APPENDUNSAFE(list, elt, link)
#define ISC_LIST_DEQUEUE(list, elt, link) ISC_LIST_UNLINK(list, elt, link)
-#define ISC_LIST_DEQUEUEUNSAFE(list, elt, link) \
- ISC_LIST_UNLINKUNSAFE(list, elt, link)
+#define __ISC_LIST_DEQUEUEUNSAFE(list, elt, link) \
+ __ISC_LIST_UNLINKUNSAFE(list, elt, link)
#endif /* ISC_LIST_H */
diff --git a/lib/isc/include/isc/log.h b/lib/isc/include/isc/log.h
index 355d2965..d3ad6af0 100644
--- a/lib/isc/include/isc/log.h
+++ b/lib/isc/include/isc/log.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log.h,v 1.31 2000/11/27 17:49:41 gson Exp $ */
+/* $Id: log.h,v 1.35 2000/12/23 19:23:47 tale Exp $ */
#ifndef ISC_LOG_H
#define ISC_LOG_H 1
@@ -28,8 +28,6 @@
#include <isc/lang.h>
#include <isc/types.h>
-ISC_LANG_BEGINDECLS
-
/*
* Severity levels, patterned after Unix's syslog levels.
*
@@ -109,6 +107,7 @@ typedef struct isc_logfile {
* to a size large enough for the largest possible file on a system.
*/
isc_offset_t maximum_size;
+ isc_boolean_t maximum_reached; /* Private. */
} isc_logfile_t;
/*
@@ -140,6 +139,8 @@ extern isc_logmodule_t isc_modules[];
#define ISC_LOGMODULE_SOCKET (&isc_modules[0])
+ISC_LANG_BEGINDECLS
+
isc_result_t
isc_log_create(isc_mem_t *mctx, isc_log_t **lctxp, isc_logconfig_t **lcfgp);
/*
@@ -499,12 +500,16 @@ isc_log_usechannel(isc_logconfig_t *lcfg, const char *name,
void
isc_log_write(isc_log_t *lctx, isc_logcategory_t *category,
- isc_logmodule_t *module, int level, const char *format, ...)
+ isc_logmodule_t *module, int level,
+ const char *format, ...)
ISC_FORMAT_PRINTF(5, 6);
/*
* Write a message to the log channels.
*
* Notes:
+ * Log message containing natural language text should be logged with
+ * isc_log_iwrite() to allow for localization.
+ *
* lctx can be NULL; this is allowed so that programs which use
* libraries that use the ISC logging system are not required to
* also use it.
@@ -536,8 +541,8 @@ ISC_FORMAT_PRINTF(5, 6);
void
isc_log_vwrite(isc_log_t *lctx, isc_logcategory_t *category,
- isc_logmodule_t *module, int level, const char *format,
- va_list args)
+ isc_logmodule_t *module, int level,
+ const char *format, va_list args)
ISC_FORMAT_PRINTF(5, 0);
/*
* Write a message to the log channels.
@@ -574,7 +579,7 @@ ISC_FORMAT_PRINTF(5, 0);
void
isc_log_write1(isc_log_t *lctx, isc_logcategory_t *category,
- isc_logmodule_t *module, int level, const char *format, ...)
+ isc_logmodule_t *module, int level, const char *format, ...)
ISC_FORMAT_PRINTF(5, 6);
/*
* Write a message to the log channels, pruning duplicates that occur within
@@ -584,8 +589,8 @@ ISC_FORMAT_PRINTF(5, 6);
void
isc_log_vwrite1(isc_log_t *lctx, isc_logcategory_t *category,
- isc_logmodule_t *module, int level, const char *format,
- va_list args)
+ isc_logmodule_t *module, int level, const char *format,
+ va_list args)
ISC_FORMAT_PRINTF(5, 0);
/*
* Write a message to the log channels, pruning duplicates that occur within
@@ -594,6 +599,46 @@ ISC_FORMAT_PRINTF(5, 0);
*/
void
+isc_log_iwrite(isc_log_t *lctx, isc_logcategory_t *category,
+ isc_logmodule_t *module, int level,
+ isc_msgcat_t *msgcat, int msgset, int message,
+ const char *format, ...)
+ISC_FORMAT_PRINTF(8, 9);
+
+void
+isc_log_ivwrite(isc_log_t *lctx, isc_logcategory_t *category,
+ isc_logmodule_t *module, int level,
+ isc_msgcat_t *msgcat, int msgset, int message,
+ const char *format, va_list args)
+ISC_FORMAT_PRINTF(8, 0);
+
+void
+isc_log_iwrite1(isc_log_t *lctx, isc_logcategory_t *category,
+ isc_logmodule_t *module, int level,
+ isc_msgcat_t *msgcat, int msgset, int message,
+ const char *format, ...)
+ISC_FORMAT_PRINTF(8, 9);
+
+void
+isc_log_ivwrite1(isc_log_t *lctx, isc_logcategory_t *category,
+ isc_logmodule_t *module, int level,
+ isc_msgcat_t *msgcat, int msgset, int message,
+ const char *format, va_list args)
+ISC_FORMAT_PRINTF(8, 0);
+/*
+ * These are four internationalized versions of the the isc_log_[v]write[1]
+ * functions. The only difference is that they take arguments for a message
+ * catalog, message set, and message number, all immediately preceding the
+ * format argument. The format argument becomes the default text, a la
+ * isc_msgcat_get. If the message catalog is NULL, no lookup is attempted
+ * for a message -- which makes the message set and message number irrelevant,
+ * and the non-internationalized call should have probably been used instead.
+ *
+ * Yes, that means there are now *eight* interfaces to logging a message.
+ * Sheesh. Make the madness stop!
+ */
+
+void
isc_log_setdebuglevel(isc_log_t *lctx, unsigned int level);
/*
* Set the debugging level used for logging.
diff --git a/lib/isc/include/isc/msgs.h b/lib/isc/include/isc/msgs.h
new file mode 100644
index 00000000..ce71f1ab
--- /dev/null
+++ b/lib/isc/include/isc/msgs.h
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * 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 INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM 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.
+ */
+
+/* $Id: msgs.h,v 1.2 2000/12/19 20:35:37 bwelling Exp $ */
+
+#ifndef ISC_MSGS_H
+#define ISC_MSGS_H 1
+
+#include <isc/lib.h> /* Provide isc_msgcat global variable. */
+#include <isc/msgcat.h> /* Provide isc_msgcat_*() functions. */
+
+/*
+ * Message sets, named per source file, excepting "GENERAL".
+ * IMPORTANT: The original list is alphabetical, but any new sets must
+ * be added to the end.
+ */
+#define ISC_MSGSET_GENERAL 1
+/* ISC_RESULT_RESULTSET 2 */ /* XXX */
+/* ISC_RESULT_UNAVAILABLESET 3 */ /* XXX */
+#define ISC_MSGSET_APP 4
+#define ISC_MSGSET_COMMANDLINE 5
+#define ISC_MSGSET_ENTROPY 6
+#define ISC_MSGSET_IFITERIOCTL 7
+#define ISC_MSGSET_IFITERSYSCTL 8
+#define ISC_MSGSET_LEX 9
+#define ISC_MSGSET_LOG 10
+#define ISC_MSGSET_MEM 11
+#define ISC_MSGSET_NETADDR 12
+#define ISC_MSGSET_PRINT 13
+#define ISC_MSGSET_RESULT 14
+#define ISC_MSGSET_RWLOCK 15
+#define ISC_MSGSET_SOCKADDR 16
+#define ISC_MSGSET_SOCKET 17
+#define ISC_MSGSET_TASK 18
+#define ISC_MSGSET_TIMER 19
+#define ISC_MSGSET_UTIL 20
+
+/*
+ * Message numbers. They are only required to be unique per message set,
+ * but are unique throughout the entire catalog to not be as confusing when
+ * debugging.
+ *
+ * The initial numbering was done by multiply by 100 the set number the
+ * message appears in then adding the incremental message number.
+ */
+#define ISC_MSG_FAILED 101 /* "failed" */
+#define ISC_MSG_SUCCEEDED 102 /* Compatible with "failed" */
+#define ISC_MSG_SUCCESS 103 /* More usual way to say "success" */
+#define ISC_MSG_STARTING 104 /* As in "daemon: starting" */
+#define ISC_MSG_STOPING 105 /* As in "daemon: stopping" */
+#define ISC_MSG_ENTERING 106 /* As in "some_subr: entering" */
+#define ISC_MSG_EXITING 107 /* As in "some_subr: exiting" */
+#define ISC_MSG_CALLING 108 /* As in "calling some_subr()" */
+#define ISC_MSG_RETURNED 109 /* As in "some_subr: returned <foo>" */
+#define ISC_MSG_FATALERROR 110 /* "fatal error" */
+#define ISC_MSG_SHUTTINGDOWN 111 /* "shutting down" */
+#define ISC_MSG_RUNNING 112 /* "running" */
+#define ISC_MSG_WAIT 113 /* "wait" */
+#define ISC_MSG_WAITUNTIL 114 /* "waituntil" */
+
+#define ISC_MSG_SIGNALSETUP 201 /* "handle_signal() %d setup: %s" */
+
+#define ISC_MSG_ILLEGALOPT 301 /* "illegal option" */
+#define ISC_MSG_OPTNEEDARG 302 /* "option requires an argument" */
+
+#define ISC_MSG_ENTROPYSTATS 401 /* "Entropy pool %p: refcnt %u ..." */
+
+#define ISC_MSG_MAKESCANSOCKET 501 /* "making interface scan socket: %s" */
+#define ISC_MSG_GETIFCONFIG 502 /* "get interface configuration: %s" */
+#define ISC_MSG_BUFFERMAX 503 /* "... maximum buffer size exceeded" */
+#define ISC_MSG_GETDESTADDR 504 /* "%s: getting destination address: %s" */
+#define ISC_MSG_GETNETMASK 505 /* "%s: getting netmask: %s" */
+
+#define ISC_MSG_GETIFLISTSIZE 601 /* "getting interface list size: ..." */
+#define ISC_MSG_GETIFLIST 602 /* "getting interface list: ..." */
+#define ISC_MSG_UNEXPECTEDTYPE 603 /* "... unexpected ... message type" */
+
+#define ISC_MSG_UNEXPECTEDSTATE 701 /* "Unexpected state %d" */
+
+#define ISC_MSG_BADTIME 801 /* "Bad 00 99:99:99.999 " */
+#define ISC_MSG_LEVEL 802 /* "level %d: " */
+
+#define ISC_MSG_ADDTRACE 901 /* "add %p size %u " */
+#define ISC_MSG_DELTRACE 902 /* "del %p size %u " */
+#define ISC_MSG_POOLSTATS 903 /* "[Pool statistics]\n" */
+#define ISC_MSG_POOLNAME 904 /* "name" */
+#define ISC_MSG_POOLSIZE 905 /* "size" */
+#define ISC_MSG_POOLMAXALLOC 906 /* "maxalloc" */
+#define ISC_MSG_POOLALLOCATED 907 /* "allocated" */
+#define ISC_MSG_POOLFREECOUNT 908 /* "freecount" */
+#define ISC_MSG_POOLFREEMAX 909 /* "freemax" */
+#define ISC_MSG_POOLFILLCOUNT 910 /* "fillcount" */
+#define ISC_MSG_POOLGETS 911 /* "gets" */
+#define ISC_MSG_DUMPALLOC 912 /* "DUMP OF ALL OUTSTANDING MEMORY ..." */
+#define ISC_MSG_NONE 913 /* "\tNone.\n" */
+#define ISC_MSG_PTRFILELINE 914 /* "\tptr %p file %s line %u\n" */
+
+#define ISC_MSG_UNKNOWNADDR 1001 /* "<unknown address, family %u>" */
+
+#define ISC_MSG_USELD 1101 /* "use %ld instead of %D" */
+#define ISC_MSG_USELO 1102 /* "use %lo instead of %O" */
+#define ISC_MSG_USELU 1103 /* "use %lu instead of %U" */
+#define ISC_MSG_NOLONGDBL 1104 /* "long doubles are not supported" */
+
+#define ISC_MSG_PRINTLOCK 1201 /* "rwlock %p thread %lu ..." */
+#define ISC_MSG_READ 1202 /* "read" */
+#define ISC_MSG_WRITE 1203 /* "write" */
+#define ISC_MSG_READING 1204 /* "reading" */
+#define ISC_MSG_WRITING 1205 /* "writing" */
+#define ISC_MSG_PRELOCK 1206 /* "prelock" */
+#define ISC_MSG_POSTLOCK 1207 /* "postlock" */
+#define ISC_MSG_PREUNLOCK 1208 /* "preunlock" */
+#define ISC_MSG_POSTUNLOCK 1209 /* "postunlock" */
+
+#define ISC_MSG_UNKNOWNFAMILY 1301 /* "unknown address family: %d" */
+
+#define ISC_MSG_WRITEFAILED 1401 /* "write() failed during watcher ..." */
+#define ISC_MSG_READFAILED 1402 /* "read() failed during watcher ... " */
+#define ISC_MSG_PROCESSCMSG 1403 /* "processing cmsg %p" */
+#define ISC_MSG_IFRECEIVED 1404 /* "interface received on ifindex %u" */
+#define ISC_MSG_SENDTODATA 1405 /* "sendto pktinfo data, ifindex %u" */
+#define ISC_MSG_DOIORECV 1406 /* "doio_recv: recvmsg(%d) %d bytes ..." */
+#define ISC_MSG_PKTRECV 1407 /* "packet received correctly" */
+#define ISC_MSG_DESTROYING 1408 /* "destroying" */
+#define ISC_MSG_CREATED 1409 /* "created" */
+#define ISC_MSG_ACCEPTLOCK 1410 /* "internal_accept called, locked ..." */
+#define ISC_MSG_ACCEPTEDCXN 1411 /* "accepted connection, new socket %p" */
+#define ISC_MSG_INTERNALRECV 1412 /* "internal_recv: task %p got event %p" */
+#define ISC_MSG_INTERNALSEND 1413 /* "internal_send: task %p got event %p" */
+#define ISC_MSG_WATCHERMSG 1414 /* "watcher got message %d" */
+#define ISC_MSG_SOCKETSREMAIN 1415 /* "sockets exist" */
+#define ISC_MSG_PKTINFOPROVIDED 1416 /* "pktinfo structure provided, ..." */
+#define ISC_MSG_BOUND 1417 /* "bound" */
+#define ISC_MSG_ACCEPTRETURNED 1418 /* accept() returned %d/%s */
+
+#define ISC_MSG_AWAKE 1502 /* "awake" */
+#define ISC_MSG_WORKING 1503 /* "working" */
+#define ISC_MSG_EXECUTE 1504 /* "execute action" */
+#define ISC_MSG_EMPTY 1505 /* "empty" */
+#define ISC_MSG_DONE 1506 /* "done" */
+#define ISC_MSG_QUANTUM 1507 /* "quantum" */
+
+#define ISC_MSG_SCHEDULE 1601 /* "schedule" */
+#define ISC_MSG_SIGNALSCHED 1602 /* "signal (schedule)" */
+#define ISC_MSG_SIGNALDESCHED 1603 /* "signal (deschedule)" */
+#define ISC_MSG_SIGNALDESTROY 1604 /* "signal (destroy)" */
+#define ISC_MSG_IDLERESCHED 1605 /* "idle reschedule" */
+#define ISC_MSG_EVENTNOTALLOC 1606 /* "couldn't allocate event" */
+#define ISC_MSG_SCHEDFAIL 1607 /* "couldn't schedule timer: %u" */
+#define ISC_MSG_POSTING 1608 /* "posting" */
+#define ISC_MSG_WAKEUP 1609 /* "wakeup" */
+
+#define ISC_MSG_LOCK 1701 /* "LOCK" */
+#define ISC_MSG_LOCKING 1702 /* "LOCKING" */
+#define ISC_MSG_LOCKED 1703 /* "LOCKED" */
+#define ISC_MSG_UNLOCKED 1704 /* "UNLOCKED" */
+#define ISC_MSG_RWLOCK 1705 /* "RWLOCK" */
+#define ISC_MSG_RWLOCKED 1706 /* "RWLOCKED" */
+#define ISC_MSG_RWUNLOCK 1707 /* "RWUNLOCK" */
+#define ISC_MSG_BROADCAST 1708 /* "BROADCAST" */
+#define ISC_MSG_SIGNAL 1709 /* "SIGNAL" */
+#define ISC_MSG_UTILWAIT 1710 /* "WAIT" */
+#define ISC_MSG_WAITED 1711 /* "WAITED" */
+
+
+
+#endif /* ISC_MSGS_H */
diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in
index 2ba1258d..95e6b731 100644
--- a/lib/isc/include/isc/platform.h.in
+++ b/lib/isc/include/isc/platform.h.in
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: platform.h.in,v 1.15 2000/08/28 23:51:09 gson Exp $ */
+/* $Id: platform.h.in,v 1.16 2000/12/08 00:55:30 tale Exp $ */
#ifndef ISC_PLATFORM_H
#define ISC_PLATFORM_H 1
@@ -100,6 +100,12 @@
*/
@ISC_PLATFORM_BRACEPTHREADONCEINIT@
+/*
+ * Define on some UnixWare systems to fix erroneous definitions of various
+ * IN6_IS_ADDR_* macros.
+ */
+@ISC_PLATFORM_FIXIN6ISADDR@
+
/***
*** Printing.
***/
diff --git a/lib/isc/include/isc/print.h b/lib/isc/include/isc/print.h
index d02715fe..7dd100e7 100644
--- a/lib/isc/include/isc/print.h
+++ b/lib/isc/include/isc/print.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: print.h,v 1.11 2000/11/14 23:40:31 tale Exp $ */
+/* $Id: print.h,v 1.13 2000/12/26 21:06:49 tale Exp $ */
#ifndef ISC_PRINT_H
#define ISC_PRINT_H 1
@@ -28,6 +28,16 @@
#include <isc/lang.h>
#include <isc/platform.h>
+/*
+ * This block allows lib/isc/print.c to be cleanly compiled even if
+ * the platform does not need it. The standard Makefile will still
+ * not compile print.c or archive print.o, so this is just to make test
+ * compilation ("make print.o") easier.
+ */
+#if !defined(ISC_PLATFORM_NEEDVSNPRINTF) && defined(ISC__PRINT_SOURCE)
+#define ISC_PLATFORM_NEEDVSNPRINTF
+#endif
+
/***
*** Macros
***/
diff --git a/lib/isc/include/isc/result.h b/lib/isc/include/isc/result.h
index fa979d8c..3f2f7c7c 100644
--- a/lib/isc/include/isc/result.h
+++ b/lib/isc/include/isc/result.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: result.h,v 1.52 2000/11/18 02:56:47 gson Exp $ */
+/* $Id: result.h,v 1.53 2000/12/27 00:11:25 bwelling Exp $ */
#ifndef ISC_RESULT_H
#define ISC_RESULT_H 1
@@ -74,10 +74,11 @@
#define ISC_R_FAMILYNOSUPPORT 48 /* AF not supported */
#define ISC_R_BADHEX 49 /* bad hex encoding */
#define ISC_R_TOOMANYOPENFILES 50 /* too many open files */
+#define ISC_R_NOTBLOCKING 51 /* not blocking */
/*
* Not a result code: the number of results.
*/
-#define ISC_R_NRESULTS 51
+#define ISC_R_NRESULTS 52
ISC_LANG_BEGINDECLS
diff --git a/lib/isc/include/isc/symtab.h b/lib/isc/include/isc/symtab.h
index eab9b289..0b99a7d4 100644
--- a/lib/isc/include/isc/symtab.h
+++ b/lib/isc/include/isc/symtab.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: symtab.h,v 1.14 2000/08/01 01:30:50 tale Exp $ */
+/* $Id: symtab.h,v 1.15 2000/12/11 04:08:52 gson Exp $ */
#ifndef ISC_SYMTAB_H
#define ISC_SYMTAB_H 1
@@ -38,11 +38,11 @@
* tuple when a tuple with the given key and type already exists in the table.
* What to do in this case is specified by the client. Possible policies are:
*
- * Reject Disallow the define, returning ISC_R_EXISTS
- * Replace Replace the old value with the new. The
+ * isc_symexists_reject Disallow the define, returning ISC_R_EXISTS
+ * isc_symexists_replace Replace the old value with the new. The
* undefine action (if provided) will be called
* with the old <key, type, value> tuple.
- * Add Add the new tuple, leaving the old tuple in
+ * isc_symexists_add Add the new tuple, leaving the old tuple in
* the table. Subsequent lookups will retrieve
* the most-recently-defined tuple.
*
diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h
index 60cb20f2..b134b7db 100644
--- a/lib/isc/include/isc/util.h
+++ b/lib/isc/include/isc/util.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: util.h,v 1.19 2000/08/28 19:49:38 bwelling Exp $ */
+/* $Id: util.h,v 1.20 2000/12/06 00:30:15 tale Exp $ */
#ifndef ISC_UTIL_H
#define ISC_UTIL_H 1
@@ -75,6 +75,7 @@
#ifdef ISC_UTIL_TRACEON
#define ISC_UTIL_TRACE(a) a
#include <stdio.h> /* Required for fprintf/stderr when tracing. */
+#include <isc/msgs.h> /* Required for isc_msgcat when tracing. */
#else
#define ISC_UTIL_TRACE(a)
#endif
@@ -82,15 +83,21 @@
#include <isc/result.h> /* Contractual promise. */
#define LOCK(lp) do { \
- ISC_UTIL_TRACE(fprintf(stderr, "LOCKING %p %s %d\n", \
+ ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
+ ISC_MSG_LOCKING, "LOCKING"), \
(lp), __FILE__, __LINE__)); \
RUNTIME_CHECK(isc_mutex_lock((lp)) == ISC_R_SUCCESS); \
- ISC_UTIL_TRACE(fprintf(stderr, "LOCKED %p %s %d\n", (lp), \
- __FILE__, __LINE__)); \
+ ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
+ ISC_MSG_LOCKED, "LOCKED"), \
+ (lp), __FILE__, __LINE__)); \
} while (0)
#define UNLOCK(lp) do { \
RUNTIME_CHECK(isc_mutex_unlock((lp)) == ISC_R_SUCCESS); \
- ISC_UTIL_TRACE(fprintf(stderr, "UNLOCKED %p %s %d\n", \
+ ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
+ ISC_MSG_UNLOCKED, "UNLOCKED"), \
(lp), __FILE__, __LINE__)); \
} while (0)
#define ISLOCKED(lp) (1)
@@ -99,21 +106,35 @@
#define BROADCAST(cvp) do { \
- ISC_UTIL_TRACE(fprintf(stderr, "BROADCAST %p %s %d\n", \
+ ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
+ ISC_MSG_BROADCAST, "BROADCAST"),\
(cvp), __FILE__, __LINE__)); \
RUNTIME_CHECK(isc_condition_broadcast((cvp)) == ISC_R_SUCCESS); \
} while (0)
#define SIGNAL(cvp) do { \
- ISC_UTIL_TRACE(fprintf(stderr, "SIGNAL %p %s %d\n", \
+ ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
+ ISC_MSG_SIGNAL, "SIGNAL"), \
(cvp), __FILE__, __LINE__)); \
RUNTIME_CHECK(isc_condition_signal((cvp)) == ISC_R_SUCCESS); \
} while (0)
#define WAIT(cvp, lp) do { \
- ISC_UTIL_TRACE(fprintf(stderr, "WAIT %p LOCK %p %s %d\n", \
- (cvp), (lp), __FILE__, __LINE__)); \
+ ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %p %s %d\n", \
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
+ ISC_MSG_UTILWAIT, "WAIT"), \
+ (cvp), \
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
+ ISC_MSG_LOCK, "LOCK"), \
+ (lp), __FILE__, __LINE__)); \
RUNTIME_CHECK(isc_condition_wait((cvp), (lp)) == ISC_R_SUCCESS); \
- ISC_UTIL_TRACE(fprintf(stderr, "WAITED %p LOCKED %p %s %d\n", \
- (cvp), (lp), __FILE__, __LINE__)); \
+ ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %p %s %d\n", \
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
+ ISC_MSG_WAITED, "WAITED"), \
+ (cvp), \
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
+ ISC_MSG_LOCKED, "LOCKED"), \
+ (lp), __FILE__, __LINE__)); \
} while (0)
/*
@@ -127,14 +148,20 @@
isc_condition_waituntil((cvp), (lp), (tp))
#define RWLOCK(lp, t) do { \
- ISC_UTIL_TRACE(fprintf(stderr, "RWLOCK %p, %d %s %d\n", \
+ ISC_UTIL_TRACE(fprintf(stderr, "%s %p, %d %s %d\n", \
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
+ ISC_MSG_RWLOCK, "RWLOCK"), \
(lp), (t), __FILE__, __LINE__)); \
RUNTIME_CHECK(isc_rwlock_lock((lp), (t)) == ISC_R_SUCCESS); \
- ISC_UTIL_TRACE(fprintf(stderr, "RWLOCKED %p, %d %s %d\n", \
+ ISC_UTIL_TRACE(fprintf(stderr, "%s %p, %d %s %d\n", \
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
+ ISC_MSG_RWLOCKED, "RWLOCKED"), \
(lp), (t), __FILE__, __LINE__)); \
} while (0)
#define RWUNLOCK(lp, t) do { \
- ISC_UTIL_TRACE(fprintf(stderr, "RWUNLOCK %p, %d %s %d\n", \
+ ISC_UTIL_TRACE(fprintf(stderr, "%s %p, %d %s %d\n", \
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
+ ISC_MSG_RWUNLOCK, "RWUNLOCK"), \
(lp), (t), __FILE__, __LINE__)); \
RUNTIME_CHECK(isc_rwlock_unlock((lp), (t)) == ISC_R_SUCCESS); \
} while (0)
diff --git a/lib/isc/lex.c b/lib/isc/lex.c
index 506633c0..b37eb274 100644
--- a/lib/isc/lex.c
+++ b/lib/isc/lex.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lex.c,v 1.52 2000/11/20 00:41:50 bwelling Exp $ */
+/* $Id: lex.c,v 1.57 2000/12/09 03:20:05 marka Exp $ */
#include <config.h>
@@ -27,6 +27,7 @@
#include <isc/file.h>
#include <isc/lex.h>
#include <isc/mem.h>
+#include <isc/msgs.h>
#include <isc/stdio.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -37,9 +38,11 @@ typedef struct inputsource {
isc_boolean_t need_close;
isc_boolean_t at_eof;
isc_buffer_t * pushback;
+ unsigned int ignored;
void * input;
char * name;
unsigned long line;
+ unsigned long saved_line;
LINK(struct inputsource) link;
} inputsource;
@@ -211,8 +214,9 @@ new_source(isc_lex_t *lex, isc_boolean_t is_file, isc_boolean_t need_close,
isc_mem_put(lex->mctx, source, sizeof *source);
return (result);
}
+ source->ignored = 0;
source->line = 1;
- ISC_LIST_PREPENDUNSAFE(lex->sources, source, link);
+ ISC_LIST_INITANDPREPEND(lex->sources, source, link);
return (ISC_R_SUCCESS);
}
@@ -344,13 +348,14 @@ pushandgrow(isc_lex_t *lex, inputsource *source, int c) {
isc_buffer_usedregion(source->pushback, &used);
result = isc_buffer_copyregion(tbuf, &used);
INSIST(result == ISC_R_SUCCESS);
+ tbuf->current = source->pushback->current;
isc_buffer_free(&source->pushback);
source->pushback = tbuf;
}
isc_buffer_putuint8(source->pushback, (isc_uint8_t)c);
return (ISC_R_SUCCESS);
}
-
+
isc_result_t
isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
inputsource *source;
@@ -378,6 +383,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
REQUIRE(tokenp != NULL);
lex->saved_paren_count = lex->paren_count;
+ source->saved_line = source->line;
if (source == NULL) {
if ((options & ISC_LEXOPT_NOMORE) != 0) {
@@ -447,10 +453,16 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
return (source->result);
}
}
- if (!source->at_eof)
+
+ if (!source->at_eof) {
+ if (state == lexstate_start)
+ /* Token has not started yet. */
+ source->ignored =
+ isc_buffer_consumedlength(source->pushback);
c = isc_buffer_getuint8(source->pushback);
- else
+ } else {
c = EOF;
+ }
if (c == '\n')
source->line++;
@@ -724,7 +736,10 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
break;
default:
FATAL_ERROR(__FILE__, __LINE__,
- "Unexpected state %d", state);
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_LEX,
+ ISC_MSG_UNEXPECTEDSTATE,
+ "Unexpected state %d"),
+ state);
/* Does not return. */
}
@@ -783,9 +798,30 @@ isc_lex_ungettoken(isc_lex_t *lex, isc_token_t *tokenp) {
isc_buffer_first(source->pushback);
lex->paren_count = lex->saved_paren_count;
+ source->line = source->saved_line;
source->at_eof = ISC_FALSE;
}
+void
+isc_lex_getlasttokentext(isc_lex_t *lex, isc_token_t *tokenp, isc_region_t *r)
+{
+ inputsource *source;
+
+ REQUIRE(VALID_LEX(lex));
+ source = HEAD(lex->sources);
+ REQUIRE(source != NULL);
+ REQUIRE(tokenp != NULL);
+ REQUIRE(isc_buffer_consumedlength(source->pushback) != 0 ||
+ tokenp->type == isc_tokentype_eof);
+
+ UNUSED(tokenp);
+
+ INSIST(source->ignored <= isc_buffer_consumedlength(source->pushback));
+ r->base = (unsigned char *)isc_buffer_base(source->pushback) + source->ignored;
+ r->length = isc_buffer_consumedlength(source->pushback) - source->ignored;
+}
+
+
char *
isc_lex_getsourcename(isc_lex_t *lex) {
inputsource *source;
diff --git a/lib/isc/lib.c b/lib/isc/lib.c
index 0fbbf746..86cae919 100644
--- a/lib/isc/lib.c
+++ b/lib/isc/lib.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lib.c,v 1.6 2000/08/01 01:29:31 tale Exp $ */
+/* $Id: lib.c,v 1.7 2000/12/06 00:29:59 tale Exp $ */
#include <config.h>
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <isc/once.h>
-#include <isc/msgcat.h>
+#include <isc/msgs.h>
#include <isc/lib.h>
/***
@@ -63,9 +63,15 @@ isc_lib_initmsgcat(void) {
/*
* Normally we'd use RUNTIME_CHECK() or FATAL_ERROR(), but
* we can't do that here, since they might call us!
+ * (Note that the catalog might be open anyway, so we might
+ * as well try to provide an internationalized message.)
*/
- fprintf(stderr, "%s:%d: fatal error: isc_once_do() failed.\n",
- __FILE__, __LINE__);
+ fprintf(stderr, "%s:%d: %s: isc_once_do() %s.\n",
+ __FILE__, __LINE__,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FATALERROR, "fatal error"),
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
abort();
}
}
diff --git a/lib/isc/log.c b/lib/isc/log.c
index bd026fc3..423613d1 100644
--- a/lib/isc/log.c
+++ b/lib/isc/log.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log.c,v 1.49 2000/11/24 01:37:24 marka Exp $ */
+/* $Id: log.c,v 1.55 2000/12/23 19:23:48 tale Exp $ */
/* Principal Authors: DCL */
@@ -32,6 +32,7 @@
#include <isc/log.h>
#include <isc/magic.h>
#include <isc/mem.h>
+#include <isc/msgs.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/time.h>
@@ -225,17 +226,19 @@ roll_log(isc_logchannel_t *channel);
static void
isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
isc_logmodule_t *module, int level, isc_boolean_t write_once,
+ isc_msgcat_t *msgcat, int msgset, int msg,
const char *format, va_list args);
/*
* Convenience macros.
*/
-#define FACILITY(channel) (channel->destination.facility)
-#define FILE_NAME(channel) (channel->destination.file.name)
-#define FILE_STREAM(channel) (channel->destination.file.stream)
-#define FILE_VERSIONS(channel) (channel->destination.file.versions)
-#define FILE_MAXSIZE(channel) (channel->destination.file.maximum_size)
+#define FACILITY(channel) (channel->destination.facility)
+#define FILE_NAME(channel) (channel->destination.file.name)
+#define FILE_STREAM(channel) (channel->destination.file.stream)
+#define FILE_VERSIONS(channel) (channel->destination.file.versions)
+#define FILE_MAXSIZE(channel) (channel->destination.file.maximum_size)
+#define FILE_MAXREACHED(channel) (channel->destination.file.maximum_reached)
/****
**** Public interfaces.
@@ -722,8 +725,9 @@ isc_log_createchannel(isc_logconfig_t *lcfg, const char *name,
FILE_NAME(channel) =
isc_mem_strdup(mctx, destination->file.name);
FILE_STREAM(channel) = NULL;
- FILE_MAXSIZE(channel) = destination->file.maximum_size;
FILE_VERSIONS(channel) = destination->file.versions;
+ FILE_MAXSIZE(channel) = destination->file.maximum_size;
+ FILE_MAXREACHED(channel) = ISC_FALSE;
break;
case ISC_LOG_TOFILEDESC:
@@ -801,7 +805,6 @@ isc_log_usechannel(isc_logconfig_t *lcfg, const char *name,
void
isc_log_write(isc_log_t *lctx, isc_logcategory_t *category,
isc_logmodule_t *module, int level, const char *format, ...)
-
{
va_list args;
@@ -810,7 +813,8 @@ isc_log_write(isc_log_t *lctx, isc_logcategory_t *category,
*/
va_start(args, format);
- isc_log_doit(lctx, category, module, level, ISC_FALSE, format, args);
+ isc_log_doit(lctx, category, module, level, ISC_FALSE,
+ NULL, 0, 0, format, args);
va_end(args);
}
@@ -818,18 +822,17 @@ void
isc_log_vwrite(isc_log_t *lctx, isc_logcategory_t *category,
isc_logmodule_t *module, int level,
const char *format, va_list args)
-
{
/*
* Contract checking is done in isc_log_doit().
*/
- isc_log_doit(lctx, category, module, level, ISC_FALSE, format, args);
+ isc_log_doit(lctx, category, module, level, ISC_FALSE,
+ NULL, 0, 0, format, args);
}
void
isc_log_write1(isc_log_t *lctx, isc_logcategory_t *category,
isc_logmodule_t *module, int level, const char *format, ...)
-
{
va_list args;
@@ -838,7 +841,8 @@ isc_log_write1(isc_log_t *lctx, isc_logcategory_t *category,
*/
va_start(args, format);
- isc_log_doit(lctx, category, module, level, ISC_TRUE, format, args);
+ isc_log_doit(lctx, category, module, level, ISC_TRUE,
+ NULL, 0, 0, format, args);
va_end(args);
}
@@ -846,12 +850,74 @@ void
isc_log_vwrite1(isc_log_t *lctx, isc_logcategory_t *category,
isc_logmodule_t *module, int level,
const char *format, va_list args)
+{
+ /*
+ * Contract checking is done in isc_log_doit().
+ */
+ isc_log_doit(lctx, category, module, level, ISC_TRUE,
+ NULL, 0, 0, format, args);
+}
+
+void
+isc_log_iwrite(isc_log_t *lctx, isc_logcategory_t *category,
+ isc_logmodule_t *module, int level,
+ isc_msgcat_t *msgcat, int msgset, int msg,
+ const char *format, ...)
+{
+ va_list args;
+
+ /*
+ * Contract checking is done in isc_log_doit().
+ */
+
+ va_start(args, format);
+ isc_log_doit(lctx, category, module, level, ISC_FALSE,
+ msgcat, msgset, msg, format, args);
+ va_end(args);
+}
+
+void
+isc_log_ivwrite(isc_log_t *lctx, isc_logcategory_t *category,
+ isc_logmodule_t *module, int level,
+ isc_msgcat_t *msgcat, int msgset, int msg,
+ const char *format, va_list args)
+{
+ /*
+ * Contract checking is done in isc_log_doit().
+ */
+ isc_log_doit(lctx, category, module, level, ISC_FALSE,
+ msgcat, msgset, msg, format, args);
+}
+
+void
+isc_log_iwrite1(isc_log_t *lctx, isc_logcategory_t *category,
+ isc_logmodule_t *module, int level,
+ isc_msgcat_t *msgcat, int msgset, int msg,
+ const char *format, ...)
+{
+ va_list args;
+
+ /*
+ * Contract checking is done in isc_log_doit().
+ */
+
+ va_start(args, format);
+ isc_log_doit(lctx, category, module, level, ISC_TRUE,
+ msgcat, msgset, msg, format, args);
+ va_end(args);
+}
+void
+isc_log_ivwrite1(isc_log_t *lctx, isc_logcategory_t *category,
+ isc_logmodule_t *module, int level,
+ isc_msgcat_t *msgcat, int msgset, int msg,
+ const char *format, va_list args)
{
/*
* Contract checking is done in isc_log_doit().
*/
- isc_log_doit(lctx, category, module, level, ISC_TRUE, format, args);
+ isc_log_doit(lctx, category, module, level, ISC_TRUE,
+ msgcat, msgset, msg, format, args);
}
void
@@ -968,7 +1034,8 @@ assignchannel(isc_logconfig_t *lcfg, unsigned int category_id,
new_item->channel = channel;
new_item->module = module;
- ISC_LIST_PREPENDUNSAFE(lcfg->channellists[category_id], new_item, link);
+ ISC_LIST_INITANDPREPEND(lcfg->channellists[category_id],
+ new_item, link);
/*
* Remember the highest logging level set by any channel in the
@@ -1230,11 +1297,13 @@ isc_log_wouldlog(isc_log_t *lctx, int level) {
static void
isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
isc_logmodule_t *module, int level, isc_boolean_t write_once,
+ isc_msgcat_t *msgcat, int msgset, int msg,
const char *format, va_list args)
{
int syslog_level;
char time_string[64];
char level_string[24];
+ const char *iformat;
struct stat statbuf;
isc_boolean_t matched = ISC_FALSE;
isc_boolean_t printtime, printtag;
@@ -1265,6 +1334,11 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
if (! isc_log_wouldlog(lctx, level))
return;
+ if (msgcat != NULL)
+ iformat = isc_msgcat_get(msgcat, msgset, msg, format);
+ else
+ iformat = format;
+
time_string[0] = '\0';
level_string[0] = '\0';
@@ -1364,14 +1438,22 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
* "Should never happen."
*/
snprintf(time_string, sizeof(time_string),
- "Bad 00 99:99:99.999 ");
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_LOG,
+ ISC_MSG_BADTIME,
+ "Bad 00 99:99:99.999 "));
}
if ((channel->flags & ISC_LOG_PRINTLEVEL) != 0 &&
level_string[0] == '\0') {
if (level < ISC_LOG_CRITICAL)
- sprintf(level_string, "level %d: ", level);
+ sprintf(level_string,
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_LOG,
+ ISC_MSG_LEVEL,
+ "level %d: "),
+ level);
else if (level > ISC_LOG_DYNAMIC)
sprintf(level_string, "%s %d: ",
log_level_strings[0], level);
@@ -1385,7 +1467,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
*/
if (lctx->buffer[0] == '\0') {
(void)vsnprintf(lctx->buffer, sizeof(lctx->buffer),
- format, args);
+ iformat, args);
/*
* Check for duplicates.
@@ -1508,6 +1590,31 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
switch (channel->type) {
case ISC_LOG_TOFILE:
+ if (FILE_MAXREACHED(channel)) {
+ /*
+ * If the file can be rolled, OR
+ * If the file no longer exists, OR
+ * If the file is less than the maximum size,
+ * (such as if it had been renamed and
+ * a new one touched, or it was truncated
+ * in place)
+ * ... then close it to trigger reopening.
+ */
+ if (FILE_VERSIONS(channel) !=
+ ISC_LOG_ROLLNEVER ||
+ (stat(FILE_NAME(channel), &statbuf) != 0 &&
+ errno == ENOENT) ||
+ statbuf.st_size < FILE_MAXSIZE(channel)) {
+ fclose(FILE_STREAM(channel));
+ FILE_STREAM(channel) = NULL;
+ FILE_MAXREACHED(channel) = ISC_FALSE;
+ } else
+ /*
+ * Eh, skip it.
+ */
+ break;
+ }
+
if (FILE_STREAM(channel) == NULL) {
result = isc_log_open(channel);
if (result != ISC_R_SUCCESS)
@@ -1537,8 +1644,8 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
/*
* If the file now exceeds its maximum size
- * threshold, close it and mark it ready
- * for reopening the next time the channel is used.
+ * threshold, note it so that it will not be logged
+ * to any more.
*/
if (FILE_MAXSIZE(channel) != 0) {
INSIST(channel->type == ISC_LOG_TOFILE);
@@ -1547,10 +1654,8 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
/* XXXDCL complain if fstat fails? */
if (fstat(fileno(FILE_STREAM(channel)),
&statbuf) >= 0 &&
- statbuf.st_size > FILE_MAXSIZE(channel)) {
- fclose(FILE_STREAM(channel));
- FILE_STREAM(channel) = NULL;
- }
+ statbuf.st_size > FILE_MAXSIZE(channel))
+ FILE_MAXREACHED(channel) = ISC_TRUE;
}
break;
diff --git a/lib/isc/mem.c b/lib/isc/mem.c
index 0e361c61..30242fcc 100644
--- a/lib/isc/mem.c
+++ b/lib/isc/mem.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: mem.c,v 1.68 2000/12/01 00:52:38 gson Exp $ */
+/* $Id: mem.c,v 1.75 2000/12/22 18:30:26 gson Exp $ */
#include <config.h>
@@ -26,6 +26,7 @@
#include <limits.h>
#include <isc/mem.h>
+#include <isc/msgs.h>
#include <isc/ondestroy.h>
#include <isc/string.h>
@@ -175,7 +176,10 @@ add_trace_entry(isc_mem_t *mctx, const void *ptr, unsigned int size
unsigned int i;
if (MEM_TRACE)
- fprintf(stderr, "add %p size %u file %s line %u mctx %p\n",
+ fprintf(stderr, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
+ ISC_MSG_ADDTRACE,
+ "add %p size %u "
+ "file %s line %u mctx %p\n"),
ptr, size, file, line, mctx);
if (!MEM_RECORD)
@@ -224,7 +228,10 @@ delete_trace_entry(isc_mem_t *mctx, const void *ptr, unsigned int size,
unsigned int i;
if (MEM_TRACE)
- fprintf(stderr, "del %p size %u file %s line %u mctx %p\n",
+ fprintf(stderr, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
+ ISC_MSG_DELTRACE,
+ "del %p size %u "
+ "file %s line %u mctx %p\n"),
ptr, size, file, line, mctx);
if (!MEM_RECORD)
@@ -545,6 +552,21 @@ mem_getunlocked(isc_mem_t *ctx, size_t size) {
return (ret);
}
+#if ISC_MEM_FILL && ISC_MEM_CHECKOVERRUN
+static inline void
+check_overrun(void *mem, size_t size, size_t new_size) {
+ unsigned char *cp;
+
+ cp = (unsigned char *)mem;
+ cp += size;
+ while (size < new_size) {
+ INSIST(*cp == 0xbe);
+ cp++;
+ size++;
+ }
+}
+#endif
+
static inline void
mem_putunlocked(isc_mem_t *ctx, void *mem, size_t size) {
size_t new_size = quantize(size);
@@ -664,7 +686,9 @@ isc_mem_createx(size_t init_max_size, size_t target_size,
(memfree)(arg, ctx->freelists);
(memfree)(arg, ctx);
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_mutex_init() failed");
+ "isc_mutex_init() %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
return (ISC_R_UNEXPECTED);
}
ctx->references = 1;
@@ -822,7 +846,6 @@ isc__mem_putanddetach(isc_mem_t **ctxp, void *ptr, size_t size FLARG) {
void
isc_mem_destroy(isc_mem_t **ctxp) {
isc_mem_t *ctx;
- isc_boolean_t want_destroy = ISC_FALSE;
/*
* This routine provides legacy support for callers who use mctxs
@@ -836,12 +859,9 @@ isc_mem_destroy(isc_mem_t **ctxp) {
LOCK(&ctx->lock);
REQUIRE(ctx->references == 1);
ctx->references--;
- if (ctx->references == 0)
- want_destroy = ISC_TRUE;
UNLOCK(&ctx->lock);
- if (want_destroy)
- destroy(ctx);
+ destroy(ctx);
*ctxp = NULL;
}
@@ -869,21 +889,6 @@ isc_mem_restore(isc_mem_t *ctx) {
return (result);
}
-#if ISC_MEM_FILL && ISC_MEM_CHECKOVERRUN
-static inline void
-check_overrun(void *mem, size_t size, size_t new_size) {
- unsigned char *cp;
-
- cp = (unsigned char *)mem;
- cp += size;
- while (size < new_size) {
- INSIST(*cp == 0xbe);
- cp++;
- size++;
- }
-}
-#endif
-
void *
isc__mem_get(isc_mem_t *ctx, size_t size FLARG) {
void *ptr;
@@ -907,8 +912,10 @@ isc__mem_get(isc_mem_t *ctx, size_t size FLARG) {
if (call_water) {
/* XXX remove */
- fprintf(stderr, "calling water(%p,ISC_MEM_HIWATER)\n",
- ctx->water_arg);
+ fprintf(stderr, "%s water(%p, ISC_MEM_HIWATER)\n",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_CALLING, "calling"),
+ ctx->water_arg);
(ctx->water)(ctx->water_arg, ISC_MEM_HIWATER);
}
@@ -938,8 +945,10 @@ isc__mem_put(isc_mem_t *ctx, void *ptr, size_t size FLARG)
if (call_water) {
/* XXX remove */
- fprintf(stderr, "calling water(%p,ISC_MEM_LOWATER)\n",
- ctx->water_arg);
+ fprintf(stderr, "%s water(%p,ISC_MEM_LOWATER)\n",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_CALLING, "calling"),
+ ctx->water_arg);
(ctx->water)(ctx->water_arg, ISC_MEM_LOWATER);
}
}
@@ -1005,10 +1014,27 @@ isc_mem_stats(isc_mem_t *ctx, FILE *out) {
*/
pool = ISC_LIST_HEAD(ctx->pools);
if (pool != NULL) {
- fprintf(out, "[Pool statistics]\n");
+ fprintf(out, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
+ ISC_MSG_POOLSTATS,
+ "[Pool statistics]\n"));
fprintf(out, "%15s %10s %10s %10s %10s %10s %10s %10s %1s\n",
- "name", "size", "maxalloc", "allocated", "freecount",
- "freemax", "fillcount", "gets", "L");
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
+ ISC_MSG_POOLNAME, "name"),
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
+ ISC_MSG_POOLSIZE, "size"),
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
+ ISC_MSG_POOLMAXALLOC, "maxalloc"),
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
+ ISC_MSG_POOLALLOCATED, "allocated"),
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
+ ISC_MSG_POOLFREECOUNT, "freecount"),
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
+ ISC_MSG_POOLFREEMAX, "freemax"),
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
+ ISC_MSG_POOLFILLCOUNT, "fillcount"),
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
+ ISC_MSG_POOLGETS, "gets"),
+ "L");
}
while (pool != NULL) {
fprintf(out, "%15s %10lu %10u %10u %10u %10u %10u %10u %s\n",
@@ -1020,19 +1046,29 @@ isc_mem_stats(isc_mem_t *ctx, FILE *out) {
}
#if ISC_MEM_TRACKLINES
- if (isc_mem_debugging > 1) {
+ if (MEM_RECORD) {
debuglink_t *dl;
unsigned int i;
- fprintf(out, "DUMP OF ALL OUTSTANDING MEMORY ALLOCATIONS\n");
+ fprintf(out, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
+ ISC_MSG_DUMPALLOC,
+ "DUMP OF ALL OUTSTANDING "
+ "MEMORY ALLOCATIONS\n"));
dl = ISC_LIST_HEAD(ctx->debuglist);
if (dl == NULL)
- fprintf(out, "\tNone.\n");
+ fprintf(out, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
+ ISC_MSG_NONE,
+ "\tNone.\n"));
while (dl != NULL) {
for (i = 0 ; i < DEBUGLIST_COUNT ; i++)
if (dl->ptr[i] != NULL)
fprintf(out,
- "\tptr %p file %s line %u\n",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_MEM,
+ ISC_MSG_PTRFILELINE,
+ "\tptr %p "
+ "file %s "
+ "line %u\n"),
dl->ptr[i], dl->file[i],
dl->line[i]);
dl = ISC_LIST_NEXT(dl, link);
@@ -1330,7 +1366,7 @@ isc_mempool_create(isc_mem_t *mctx, size_t size, isc_mempool_t **mpctxp) {
*mpctxp = mpctx;
- ISC_LIST_APPENDUNSAFE(mctx->pools, mpctx, link);
+ ISC_LIST_INITANDAPPEND(mctx->pools, mpctx, link);
UNLOCK(&mctx->lock);
diff --git a/lib/isc/netaddr.c b/lib/isc/netaddr.c
index 0bf067c6..db7aca5a 100644
--- a/lib/isc/netaddr.c
+++ b/lib/isc/netaddr.c
@@ -15,13 +15,14 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: netaddr.c,v 1.12 2000/08/01 01:29:37 tale Exp $ */
+/* $Id: netaddr.c,v 1.13 2000/12/06 00:30:05 tale Exp $ */
#include <config.h>
#include <stdio.h>
#include <isc/buffer.h>
+#include <isc/msgs.h>
#include <isc/netaddr.h>
#include <isc/print.h>
#include <isc/sockaddr.h>
@@ -151,7 +152,9 @@ isc_netaddr_format(isc_netaddr_t *na, char *array, unsigned int size) {
if (result != ISC_R_SUCCESS) {
snprintf(array, size,
- "<unknown address, family %u>",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_NETADDR,
+ ISC_MSG_UNKNOWNADDR,
+ "<unknown address, family %u>"),
na->family);
array[size - 1] = '\0';
}
diff --git a/lib/isc/nothreads/include/isc/Makefile.in b/lib/isc/nothreads/include/isc/Makefile.in
index 5142f473..080636cc 100644
--- a/lib/isc/nothreads/include/isc/Makefile.in
+++ b/lib/isc/nothreads/include/isc/Makefile.in
@@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.2 2000/09/20 19:06:04 gson Exp $
+# $Id: Makefile.in,v 1.3 2000/12/21 16:14:49 gson Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@@ -21,7 +21,7 @@ top_srcdir = @top_srcdir@
@BIND9_VERSION@
-HEADERS = mutex.h once.h thread.h
+HEADERS = condition.h mutex.h once.h thread.h
SUBDIRS =
TARGETS =
diff --git a/lib/isc/nothreads/include/isc/thread.h b/lib/isc/nothreads/include/isc/thread.h
index 3bcc721e..07ba0ab0 100644
--- a/lib/isc/nothreads/include/isc/thread.h
+++ b/lib/isc/nothreads/include/isc/thread.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: thread.h,v 1.1 2000/08/28 23:16:50 bwelling Exp $ */
+/* $Id: thread.h,v 1.2 2000/12/11 19:17:29 gson Exp $ */
#ifndef ISC_THREAD_H
#define ISC_THREAD_H 1
@@ -28,7 +28,7 @@ ISC_LANG_BEGINDECLS
void
isc_thread_setconcurrency(unsigned int level);
-#define isc_thread_self (unsigned long)0
+#define isc_thread_self() ((unsigned long)0)
ISC_LANG_ENDDECLS
diff --git a/lib/isc/print.c b/lib/isc/print.c
index 2002fea5..68ff7dbf 100644
--- a/lib/isc/print.c
+++ b/lib/isc/print.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: print.c,v 1.14 2000/11/14 23:42:29 tale Exp $ */
+/* $Id: print.c,v 1.16 2000/12/26 21:00:41 tale Exp $ */
#include <config.h>
@@ -23,15 +23,14 @@
#include <stdio.h> /* for sprintf */
#include <stdlib.h>
+#define ISC__PRINT_SOURCE /* Used to get the isc_print_* prototypes. */
+
#include <isc/assertions.h>
+#include <isc/int.h>
+#include <isc/msgs.h>
#include <isc/print.h>
-#include <isc/platform.h>
#include <isc/util.h>
-#ifndef ISC_PLATFORM_NEEDVSNPRINTF
-#error ISC_PLATFORM_NEEDVSPRINTF needs to be defined to compile this file.
-#endif
-
/*
* Return length of string that would have been written if not truncated.
*/
@@ -64,16 +63,16 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
int space;
int neg;
long long tmpi;
- unsigned long long tmpui;
+ isc_uint64_t tmpui;
unsigned long width;
unsigned long precision;
unsigned int length;
char buf[1024];
- char *cp;
- char *save = str;
char c;
void *v;
- char *head;
+ char *save = str;
+ const char *cp;
+ const char *head;
int count = 0;
int pad;
int zeropad;
@@ -216,7 +215,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
case 'i':
case 'd':
if (q)
- tmpi = va_arg(ap, long long);
+ tmpi = va_arg(ap, isc_int64_t);
else if (l)
tmpi = va_arg(ap, long int);
else
@@ -238,7 +237,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
goto printint;
case 'o':
if (q)
- tmpui = va_arg(ap, unsigned long long);
+ tmpui = va_arg(ap, isc_uint64_t);
else if (l)
tmpui = va_arg(ap, long int);
else
@@ -250,7 +249,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
goto printint;
case 'u':
if (q)
- tmpui = va_arg(ap, unsigned long long);
+ tmpui = va_arg(ap, isc_uint64_t);
else if (l)
tmpui = va_arg(ap, unsigned long int);
else
@@ -260,7 +259,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
goto printint;
case 'x':
if (q)
- tmpui = va_arg(ap, unsigned long long);
+ tmpui = va_arg(ap, isc_uint64_t);
else if (l)
tmpui = va_arg(ap, unsigned long int);
else
@@ -275,7 +274,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
goto printint;
case 'X':
if (q)
- tmpui = va_arg(ap, unsigned long long);
+ tmpui = va_arg(ap, isc_uint64_t);
else if (l)
tmpui = va_arg(ap, unsigned long int);
else
@@ -344,7 +343,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
/*
* cp need not be NULL terminated.
*/
- char *tp;
+ const char *tp;
unsigned long n;
n = precision;
@@ -456,17 +455,29 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
}
break;
case 'D': /*deprecated*/
- INSIST("use %ld instead of %D" == NULL);
+ INSIST(isc_msgcat_get(isc_msgcat, ISC_MSGSET_PRINT,
+ ISC_MSG_USELD,
+ "use %ld instead of %D")
+ == NULL);
case 'O': /*deprecated*/
- INSIST("use %lo instead of %O" == NULL);
+ INSIST(isc_msgcat_get(isc_msgcat, ISC_MSGSET_PRINT,
+ ISC_MSG_USELO,
+ "use %lo instead of %O")
+ == NULL);
case 'U': /*deprecated*/
- INSIST("use %lu instead of %U" == NULL);
+ INSIST(isc_msgcat_get(isc_msgcat, ISC_MSGSET_PRINT,
+ ISC_MSG_USELU,
+ "use %lu instead of %U")
+ == NULL);
case 'L':
#ifdef HAVE_LONG_DOUBLE
l = 1;
#else
- INSIST("long doubles are not supported" == NULL);
+ INSIST(isc_msgcat_get(isc_msgcat, ISC_MSGSET_PRINT,
+ ISC_MSG_NOLONGDBL,
+ "long doubles are not supported")
+ == NULL);
#endif
/*FALLTHROUGH*/
case 'e':
@@ -482,7 +493,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
* MAX 1.7976931348623157E+308
* VAX floating point has a smaller range than IEEE.
*
- * precisions > 324 don't make much sence.
+ * precisions > 324 don't make much sense.
* if we cap the precision at 512 we will not
* overflow buf.
*/
diff --git a/lib/isc/pthreads/condition.c b/lib/isc/pthreads/condition.c
index a72d6977..6c96eba0 100644
--- a/lib/isc/pthreads/condition.c
+++ b/lib/isc/pthreads/condition.c
@@ -15,13 +15,14 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: condition.c,v 1.24 2000/08/01 01:31:00 tale Exp $ */
+/* $Id: condition.c,v 1.25 2000/12/06 00:30:17 tale Exp $ */
#include <config.h>
#include <errno.h>
#include <isc/condition.h>
+#include <isc/msgs.h>
#include <isc/string.h>
#include <isc/time.h>
#include <isc/util.h>
@@ -56,7 +57,9 @@ isc_condition_waituntil(isc_condition_t *c, isc_mutex_t *m, isc_time_t *t) {
} while (presult == EINTR);
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "pthread_cond_timedwait() returned %s",
+ "pthread_cond_timedwait() %s %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_RETURNED, "returned %s"),
strerror(presult));
return (ISC_R_UNEXPECTED);
}
diff --git a/lib/isc/pthreads/thread.c b/lib/isc/pthreads/thread.c
index 578d3d61..cac349f9 100644
--- a/lib/isc/pthreads/thread.c
+++ b/lib/isc/pthreads/thread.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: thread.c,v 1.7 2000/08/01 01:31:01 tale Exp $ */
+/* $Id: thread.c,v 1.8 2000/12/22 20:50:05 bwelling Exp $ */
#include <config.h>
@@ -36,6 +36,7 @@ isc_thread_create(isc_threadfunc_t func, isc_threadarg_t arg,
pthread_attr_init(&attr);
+#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
ret = pthread_attr_getstacksize(&attr, &stacksize);
if (ret != 0)
return (ISC_R_UNEXPECTED);
@@ -45,6 +46,7 @@ isc_thread_create(isc_threadfunc_t func, isc_threadarg_t arg,
if (ret != 0)
return (ISC_R_UNEXPECTED);
}
+#endif
ret = pthread_create(thread, &attr, func, arg);
if (ret != 0)
diff --git a/lib/isc/random.c b/lib/isc/random.c
index 4434345c..a84fb7b3 100644
--- a/lib/isc/random.c
+++ b/lib/isc/random.c
@@ -15,11 +15,12 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: random.c,v 1.13 2000/09/26 17:23:17 gson Exp $ */
+/* $Id: random.c,v 1.14 2000/12/26 21:02:14 tale Exp $ */
#include <config.h>
#include <stdlib.h>
+#include <time.h> /* Required for time(). */
#include <isc/mutex.h>
#include <isc/once.h>
diff --git a/lib/isc/result.c b/lib/isc/result.c
index 4e3d3e40..c0d116f4 100644
--- a/lib/isc/result.c
+++ b/lib/isc/result.c
@@ -15,14 +15,14 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: result.c,v 1.50 2000/11/18 02:56:45 gson Exp $ */
+/* $Id: result.c,v 1.52 2000/12/27 00:11:24 bwelling Exp $ */
#include <config.h>
#include <stdlib.h>
#include <isc/lib.h>
-#include <isc/msgcat.h>
+#include <isc/msgs.h>
#include <isc/mutex.h>
#include <isc/once.h>
#include <isc/resultclass.h>
@@ -88,7 +88,8 @@ static const char *text[ISC_R_NRESULTS] = {
"address family mismatch", /* 47 */
"address family not supported", /* 48 */
"bad hex encoding", /* 49 */
- "too many open files" /* 50 */
+ "too many open files", /* 50 */
+ "not blocking" /* 51 */
};
#define ISC_RESULT_RESULTSET 2
@@ -142,7 +143,10 @@ initialize_action(void) {
isc_msgcat, ISC_RESULT_RESULTSET);
if (result != ISC_R_SUCCESS)
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "register_table() failed: %u", result);
+ "register_table() %s: %u",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"),
+ result);
}
static void
diff --git a/lib/isc/rwlock.c b/lib/isc/rwlock.c
index f4c3bb01..a5cd9902 100644
--- a/lib/isc/rwlock.c
+++ b/lib/isc/rwlock.c
@@ -15,13 +15,14 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rwlock.c,v 1.25 2000/08/29 00:33:35 bwelling Exp $ */
+/* $Id: rwlock.c,v 1.26 2000/12/06 00:30:09 tale Exp $ */
#include <config.h>
#include <stddef.h>
#include <isc/magic.h>
+#include <isc/msgs.h>
#include <isc/platform.h>
#include <isc/rwlock.h>
#include <isc/util.h>
@@ -46,10 +47,21 @@
static void
print_lock(const char *operation, isc_rwlock_t *rwl, isc_rwlocktype_t type) {
fprintf(stderr,
- "rwlock %p thread %lu %s(%s): %s, %u active, %u granted, "
- "%u rwaiting, %u wwaiting\n", rwl, isc_thread_self(),
- operation, (type == isc_rwlocktype_read ? "read" : "write"),
- (rwl->type == isc_rwlocktype_read ? "reading" : "writing"),
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
+ ISC_MSG_PRINTLOCK,
+ "rwlock %p thread %lu %s(%s): %s, %u active, "
+ "%u granted, %u rwaiting, %u wwaiting\n"),
+ rwl, isc_thread_self(), operation,
+ (type == isc_rwlocktype_read ?
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
+ ISC_MSG_READ, "read") :
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
+ ISC_MSG_WRITE, "write")),
+ (rwl->type == isc_rwlocktype_read ?
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
+ ISC_MSG_READING, "reading") :
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
+ ISC_MSG_WRITING, "writing")),
rwl->active, rwl->granted, rwl->readers_waiting,
rwl->writers_waiting);
}
@@ -83,21 +95,27 @@ isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota,
result = isc_mutex_init(&rwl->lock);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_mutex_init() failed: %s",
+ "isc_mutex_init() %s: %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"),
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
}
result = isc_condition_init(&rwl->readable);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_condition_init(readable) failed: %s",
+ "isc_condition_init(readable) %s: %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"),
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
}
result = isc_condition_init(&rwl->writeable);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_condition_init(writeable) failed: %s",
+ "isc_condition_init(writeable) %s: %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"),
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
}
@@ -117,7 +135,8 @@ isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
LOCK(&rwl->lock);
#ifdef ISC_RWLOCK_TRACE
- print_lock("prelock", rwl, type);
+ print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
+ ISC_MSG_PRELOCK, "prelock"), rwl, type);
#endif
if (type == isc_rwlocktype_read) {
@@ -160,7 +179,8 @@ isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
}
#ifdef ISC_RWLOCK_TRACE
- print_lock("postlock", rwl, type);
+ print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
+ ISC_MSG_POSTLOCK, "postlock"), rwl, type);
#endif
UNLOCK(&rwl->lock);
@@ -178,7 +198,8 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
UNUSED(type);
#ifdef ISC_RWLOCK_TRACE
- print_lock("preunlock", rwl, type);
+ print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
+ ISC_MSG_PREUNLOCK, "preunlock"), rwl, type);
#endif
INSIST(rwl->active > 0);
@@ -213,7 +234,9 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
}
#ifdef ISC_RWLOCK_TRACE
- print_lock("postunlock", rwl, type);
+ print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
+ ISC_MSG_POSTUNLOCK, "postunlock"),
+ rwl, type);
#endif
UNLOCK(&rwl->lock);
diff --git a/lib/isc/sockaddr.c b/lib/isc/sockaddr.c
index e9cdc5e4..17fd90df 100644
--- a/lib/isc/sockaddr.c
+++ b/lib/isc/sockaddr.c
@@ -15,13 +15,14 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sockaddr.c,v 1.46 2000/08/09 19:09:08 gson Exp $ */
+/* $Id: sockaddr.c,v 1.47 2000/12/06 00:30:10 tale Exp $ */
#include <config.h>
#include <stdio.h>
#include <isc/buffer.h>
+#include <isc/msgs.h>
#include <isc/netaddr.h>
#include <isc/print.h>
#include <isc/region.h>
@@ -160,8 +161,13 @@ isc_sockaddr_format(isc_sockaddr_t *sa, char *array, unsigned int size) {
isc_buffer_init(&buf, array, size);
result = isc_sockaddr_totext(sa, &buf);
if (result != ISC_R_SUCCESS) {
+ /*
+ * The message is the same as in netaddr.c.
+ */
snprintf(array, size,
- "<unknown address, family %u>",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_NETADDR,
+ ISC_MSG_UNKNOWNADDR,
+ "<unknown address, family %u>"),
sa->type.sa.sa_family);
array[size - 1] = '\0';
}
@@ -187,7 +193,11 @@ isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only) {
break;
default:
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "unknown address family: %d",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_SOCKADDR,
+ ISC_MSG_UNKNOWNFAMILY,
+ "unknown "
+ "address family: %d"),
(int)sockaddr->type.sa.sa_family);
s = (const unsigned char *)&sockaddr->type;
length = sockaddr->length;
@@ -317,7 +327,11 @@ isc_sockaddr_pf(const isc_sockaddr_t *sockaddr) {
case AF_INET6:
return (PF_INET6);
default:
- FATAL_ERROR(__FILE__, __LINE__, "unknown address family");
+ FATAL_ERROR(__FILE__, __LINE__,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR,
+ ISC_MSG_UNKNOWNFAMILY,
+ "unknown address family: %d"),
+ (int)sockaddr->type.sa.sa_family);
}
#endif
}
@@ -361,7 +375,11 @@ isc_sockaddr_setport(isc_sockaddr_t *sockaddr, in_port_t port) {
sockaddr->type.sin6.sin6_port = htons(port);
break;
default:
- FATAL_ERROR(__FILE__, __LINE__, "unknown address family");
+ FATAL_ERROR(__FILE__, __LINE__,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR,
+ ISC_MSG_UNKNOWNFAMILY,
+ "unknown address family: %d"),
+ (int)sockaddr->type.sa.sa_family);
}
}
@@ -377,7 +395,11 @@ isc_sockaddr_getport(isc_sockaddr_t *sockaddr) {
port = ntohs(sockaddr->type.sin6.sin6_port);
break;
default:
- FATAL_ERROR(__FILE__, __LINE__, "unknown address family");
+ FATAL_ERROR(__FILE__, __LINE__,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR,
+ ISC_MSG_UNKNOWNFAMILY,
+ "unknown address family: %d"),
+ (int)sockaddr->type.sa.sa_family);
}
return (port);
diff --git a/lib/isc/task.c b/lib/isc/task.c
index 40375c3e..c4c6846c 100644
--- a/lib/isc/task.c
+++ b/lib/isc/task.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: task.c,v 1.75 2000/09/28 21:31:04 bwelling Exp $ */
+/* $Id: task.c,v 1.78 2000/12/26 21:45:04 tale Exp $ */
/*
* Principal Author: Bob Halley
@@ -31,6 +31,7 @@
#include <isc/condition.h>
#include <isc/event.h>
#include <isc/mem.h>
+#include <isc/msgs.h>
#include <isc/platform.h>
#include <isc/string.h>
#include <isc/task.h>
@@ -177,12 +178,14 @@ isc_task_create(isc_taskmgr_t *manager, unsigned int quantum,
task = isc_mem_get(manager->mctx, sizeof *task);
if (task == NULL)
return (ISC_R_NOMEMORY);
- XTRACE("create");
+ XTRACE("isc_task_create");
task->manager = manager;
if (isc_mutex_init(&task->lock) != ISC_R_SUCCESS) {
isc_mem_put(manager->mctx, task, sizeof *task);
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_mutex_init() failed");
+ "isc_mutex_init() %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
return (ISC_R_UNEXPECTED);
}
task->state = task_state_idle;
@@ -230,7 +233,7 @@ isc_task_attach(isc_task_t *source, isc_task_t **targetp) {
REQUIRE(VALID_TASK(source));
REQUIRE(targetp != NULL && *targetp == NULL);
- XTTRACE(source, "attach");
+ XTTRACE(source, "isc_task_attach");
LOCK(&source->lock);
source->references++;
@@ -251,7 +254,8 @@ task_shutdown(isc_task_t *task) {
XTRACE("task_shutdown");
if (! TASK_SHUTTINGDOWN(task)) {
- XTRACE("shutting down");
+ XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_SHUTTINGDOWN, "shutting down"));
task->flags |= TASK_F_SHUTTINGDOWN;
if (task->state == task_state_idle) {
INSIST(EMPTY(task->events));
@@ -785,16 +789,21 @@ dispatch(isc_taskmgr_t *manager) {
* task lock.
*/
while (EMPTY(manager->ready_tasks) && !FINISHED(manager)) {
- XTHREADTRACE("wait");
+ XTHREADTRACE(isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_GENERAL,
+ ISC_MSG_WAIT, "wait"));
WAIT(&manager->work_available, &manager->lock);
- XTHREADTRACE("awake");
+ XTHREADTRACE(isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_TASK,
+ ISC_MSG_AWAKE, "awake"));
}
#else /* ISC_PLATFORM_USETHREADS */
if (total_dispatch_count >= DEFAULT_TASKMGR_QUANTUM ||
EMPTY(manager->ready_tasks))
break;
#endif /* ISC_PLATFORM_USETHREADS */
- XTHREADTRACE("working");
+ XTHREADTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TASK,
+ ISC_MSG_WORKING, "working"));
task = HEAD(manager->ready_tasks);
if (task != NULL) {
@@ -817,7 +826,8 @@ dispatch(isc_taskmgr_t *manager) {
LOCK(&task->lock);
INSIST(task->state == task_state_ready);
task->state = task_state_running;
- XTRACE("running");
+ XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_RUNNING, "running"));
do {
if (!EMPTY(task->events)) {
event = HEAD(task->events);
@@ -826,7 +836,10 @@ dispatch(isc_taskmgr_t *manager) {
/*
* Execute the event action.
*/
- XTRACE("execute action");
+ XTRACE(isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_TASK,
+ ISC_MSG_EXECUTE,
+ "execute action"));
if (event->ev_action != NULL) {
UNLOCK(&task->lock);
(event->ev_action)(task,event);
@@ -874,13 +887,20 @@ dispatch(isc_taskmgr_t *manager) {
* Nothing else to do for this task
* right now.
*/
- XTRACE("empty");
+ XTRACE(isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_TASK,
+ ISC_MSG_EMPTY,
+ "empty"));
if (task->references == 0 &&
TASK_SHUTTINGDOWN(task)) {
/*
* The task is done.
*/
- XTRACE("done");
+ XTRACE(isc_msgcat_get(
+ isc_msgcat,
+ ISC_MSGSET_TASK,
+ ISC_MSG_DONE,
+ "done"));
finished = ISC_TRUE;
task->state = task_state_done;
} else
@@ -897,7 +917,10 @@ dispatch(isc_taskmgr_t *manager) {
* dispatching at least one event,
* so the minimum quantum is one.
*/
- XTRACE("quantum");
+ XTRACE(isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_TASK,
+ ISC_MSG_QUANTUM,
+ "quantum"));
task->state = task_state_ready;
requeue = ISC_TRUE;
done = ISC_TRUE;
@@ -945,11 +968,13 @@ WINAPI
run(void *uap) {
isc_taskmgr_t *manager = uap;
- XTHREADTRACE("start");
+ XTHREADTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_STARTING, "starting"));
dispatch(manager);
- XTHREADTRACE("exit");
+ XTHREADTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_EXITING, "exiting"));
return ((isc_threadresult_t)0);
}
@@ -1005,7 +1030,9 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
if (isc_mutex_init(&manager->lock) != ISC_R_SUCCESS) {
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_mutex_init() failed");
+ "isc_mutex_init() %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
return (ISC_R_UNEXPECTED);
}
#ifdef ISC_PLATFORM_USETHREADS
@@ -1021,7 +1048,9 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
workers * sizeof (isc_thread_t));
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_condition_init() failed");
+ "isc_condition_init() %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
return (ISC_R_UNEXPECTED);
}
#endif /* ISC_PLATFORM_USETHREADS */
diff --git a/lib/isc/timer.c b/lib/isc/timer.c
index 90c79811..449ea181 100644
--- a/lib/isc/timer.c
+++ b/lib/isc/timer.c
@@ -15,13 +15,14 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: timer.c,v 1.58 2000/10/20 02:21:58 marka Exp $ */
+/* $Id: timer.c,v 1.61 2000/12/26 21:45:05 tale Exp $ */
#include <config.h>
#include <isc/condition.h>
#include <isc/heap.h>
#include <isc/mem.h>
+#include <isc/msgs.h>
#include <isc/platform.h>
#include <isc/task.h>
#include <isc/thread.h>
@@ -167,7 +168,8 @@ schedule(isc_timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) {
manager->nscheduled++;
}
- XTRACETIMER("schedule", timer, due);
+ XTRACETIMER(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TIMER,
+ ISC_MSG_SCHEDULE, "schedule"), timer, due);
/*
* If this timer is at the head of the queue, we need to ensure
@@ -177,7 +179,9 @@ schedule(isc_timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) {
*/
#ifdef ISC_PLATFORM_USETHREADS
if (timer->index == 1 && signal_ok) {
- XTRACE("signal (schedule)");
+ XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TIMER,
+ ISC_MSG_SIGNALSCHED,
+ "signal (schedule)"));
SIGNAL(&manager->wakeup);
}
#else /* ISC_PLATFORM_USETHREADS */
@@ -208,7 +212,9 @@ deschedule(isc_timer_t *timer) {
manager->nscheduled--;
#ifdef ISC_PLATFORM_USETHREADS
if (need_wakeup) {
- XTRACE("signal (deschedule)");
+ XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TIMER,
+ ISC_MSG_SIGNALDESCHED,
+ "signal (deschedule)"));
SIGNAL(&manager->wakeup);
}
#endif /* ISC_PLATFORM_USETHREADS */
@@ -277,7 +283,11 @@ isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type,
result = isc_time_now(&now);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_time_now() failed: %s",
+ "isc_time_now() %s: %s",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED,
+ "failed"),
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
}
@@ -327,7 +337,9 @@ isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type,
isc_task_detach(&timer->task);
isc_mem_put(manager->mctx, timer, sizeof *timer);
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_mutex_init() failed");
+ "isc_mutex_init() %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
return (ISC_R_UNEXPECTED);
}
ISC_LINK_INIT(timer, link);
@@ -394,7 +406,11 @@ isc_timer_reset(isc_timer_t *timer, isc_timertype_t type,
result = isc_time_now(&now);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_time_now() failed: %s",
+ "isc_time_now() %s: %s",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED,
+ "failed"),
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
}
@@ -467,7 +483,9 @@ isc_timer_touch(isc_timer_t *timer) {
result = isc_time_now(&now);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_time_now() failed: %s",
+ "isc_time_now() %s: %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"),
isc_result_totext(result));
result = ISC_R_UNEXPECTED;
} else
@@ -556,13 +574,20 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) {
/*
* Idle timer has been touched; reschedule.
*/
- XTRACEID("idle reschedule", timer);
+ XTRACEID(isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_TIMER,
+ ISC_MSG_IDLERESCHED,
+ "idle reschedule"),
+ timer);
post_event = ISC_FALSE;
need_schedule = ISC_TRUE;
}
if (post_event) {
- XTRACEID("posting", timer);
+ XTRACEID(isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_TIMER,
+ ISC_MSG_POSTING,
+ "posting"), timer);
/*
* XXX We could preallocate this event.
*/
@@ -577,7 +602,11 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) {
isc_task_send(timer->task, &event);
else
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "couldn't allocate event");
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_TIMER,
+ ISC_MSG_EVENTNOTALLOC,
+ "couldn't "
+ "allocate event"));
}
timer->index = 0;
@@ -588,7 +617,11 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) {
result = schedule(timer, now, ISC_FALSE);
if (result != ISC_R_SUCCESS)
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "couldn't schedule timer: %u",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_TIMER,
+ ISC_MSG_SCHEDFAIL,
+ "couldn't "
+ "schedule timer: %u"),
result);
}
} else {
@@ -612,21 +645,29 @@ run(void *uap) {
while (!manager->done) {
RUNTIME_CHECK(isc_time_now(&now) == ISC_R_SUCCESS);
- XTRACETIME("running", now);
+ XTRACETIME(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_RUNNING,
+ "running"), now);
dispatch(manager, &now);
if (manager->nscheduled > 0) {
- XTRACETIME("waituntil", manager->due);
+ XTRACETIME(isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_GENERAL,
+ ISC_MSG_WAITUNTIL,
+ "waituntil"),
+ manager->due);
result = WAITUNTIL(&manager->wakeup, &manager->lock,
&manager->due);
INSIST(result == ISC_R_SUCCESS ||
result == ISC_R_TIMEDOUT);
} else {
- XTRACE("wait");
+ XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_WAIT, "wait"));
WAIT(&manager->wakeup, &manager->lock);
}
- XTRACE("wakeup");
+ XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TIMER,
+ ISC_MSG_WAKEUP, "wakeup"));
}
UNLOCK(&manager->lock);
@@ -698,7 +739,9 @@ isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
isc_heap_destroy(&manager->heap);
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_mutex_init() failed");
+ "isc_mutex_init() %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
return (ISC_R_UNEXPECTED);
}
isc_mem_attach(mctx, &manager->mctx);
@@ -709,7 +752,9 @@ isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
isc_heap_destroy(&manager->heap);
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_condition_init() failed");
+ "isc_condition_init() %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
return (ISC_R_UNEXPECTED);
}
if (isc_thread_create(run, manager, &manager->thread) !=
@@ -720,7 +765,9 @@ isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
isc_heap_destroy(&manager->heap);
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_thread_create() failed");
+ "isc_thread_create() %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
return (ISC_R_UNEXPECTED);
}
#else /* ISC_PLATFORM_USETHREADS */
@@ -763,7 +810,8 @@ isc_timermgr_destroy(isc_timermgr_t **managerp) {
manager->done = ISC_TRUE;
#ifdef ISC_PLATFORM_USETHREADS
- XTRACE("signal (destroy)");
+ XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TIMER,
+ ISC_MSG_SIGNALDESTROY, "signal (destroy)"));
SIGNAL(&manager->wakeup);
#endif /* ISC_PLATFORM_USETHREADS */
@@ -775,7 +823,9 @@ isc_timermgr_destroy(isc_timermgr_t **managerp) {
*/
if (isc_thread_join(manager->thread, NULL) != ISC_R_SUCCESS)
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_thread_join() failed");
+ "isc_thread_join() %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
#endif /* ISC_PLATFORM_USETHREADS */
/*
diff --git a/lib/isc/unix/app.c b/lib/isc/unix/app.c
index 27587b3c..3676d251 100644
--- a/lib/isc/unix/app.c
+++ b/lib/isc/unix/app.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: app.c,v 1.33 2000/11/29 01:51:54 gson Exp $ */
+/* $Id: app.c,v 1.36 2000/12/26 21:45:06 tale Exp $ */
#include <config.h>
@@ -30,6 +30,7 @@
#include <isc/app.h>
#include <isc/boolean.h>
#include <isc/condition.h>
+#include <isc/msgs.h>
#include <isc/mutex.h>
#include <isc/event.h>
#include <isc/platform.h>
@@ -102,8 +103,10 @@ handle_signal(int sig, void (*handler)(int)) {
if (sigfillset(&sa.sa_mask) != 0 ||
sigaction(sig, &sa, NULL) < 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "handle_signal() %d setup: %s", sig,
- strerror(errno));
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_APP,
+ ISC_MSG_SIGNALSETUP,
+ "handle_signal() %d setup: %s"),
+ sig, strerror(errno));
return (ISC_R_UNEXPECTED);
}
diff --git a/lib/isc/unix/entropy.c b/lib/isc/unix/entropy.c
index a3599dfd..1cefc858 100644
--- a/lib/isc/unix/entropy.c
+++ b/lib/isc/unix/entropy.c
@@ -15,10 +15,13 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: entropy.c,v 1.51 2000/11/23 01:04:00 bwelling Exp $ */
+/* $Id: entropy.c,v 1.54 2000/12/27 00:11:26 bwelling Exp $ */
#include <config.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
@@ -29,6 +32,7 @@
#include <isc/list.h>
#include <isc/magic.h>
#include <isc/mem.h>
+#include <isc/msgs.h>
#include <isc/mutex.h>
#include <isc/region.h>
#include <isc/sha1.h>
@@ -438,7 +442,8 @@ get_from_callback(isc_entropysource_t *source, unsigned int desired,
added += got;
desired -= ISC_MIN(got, desired);
result = ISC_R_SUCCESS;
- } else if (result != ISC_R_SUCCESS)
+ } else if (result != ISC_R_SUCCESS &&
+ result != ISC_R_NOTBLOCKING)
source->bad = ISC_TRUE;
}
@@ -1354,9 +1359,11 @@ isc_entropy_putdata(isc_entropy_t *ent, void *data, unsigned int length,
static void
dumpstats(isc_entropy_t *ent, FILE *out) {
fprintf(out,
- "Entropy pool %p: refcnt %u"
- " cursor %u, rotate %u entropy %u pseudo %u nsources %u"
- " nextsource %p initialized %u initcount %u\n",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_ENTROPY,
+ ISC_MSG_ENTROPYSTATS,
+ "Entropy pool %p: refcnt %u cursor %u,"
+ " rotate %u entropy %u pseudo %u nsources %u"
+ " nextsource %p initialized %u initcount %u\n"),
ent, ent->refcnt,
ent->pool.cursor, ent->pool.rotate,
ent->pool.entropy, ent->pool.pseudo,
diff --git a/lib/isc/unix/file.c b/lib/isc/unix/file.c
index 0eb2f860..682ff3f0 100644
--- a/lib/isc/unix/file.c
+++ b/lib/isc/unix/file.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: file.c,v 1.26 2000/10/20 22:09:01 gson Exp $ */
+/* $Id: file.c,v 1.27 2000/12/27 17:21:53 tale Exp $ */
#include <config.h>
@@ -163,8 +163,8 @@ isc_file_renameunique(const char *file, char *templet) {
if (result == ISC_R_SUCCESS) {
res = rename(file, templet);
if (res != 0) {
- (void)unlink(templet);
result = isc__errno2result(errno);
+ (void)unlink(templet);
}
}
if (fd != -1)
diff --git a/lib/isc/unix/ifiter_ioctl.c b/lib/isc/unix/ifiter_ioctl.c
index 526e1700..243046c4 100644
--- a/lib/isc/unix/ifiter_ioctl.c
+++ b/lib/isc/unix/ifiter_ioctl.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: ifiter_ioctl.c,v 1.13 2000/08/01 01:31:19 tale Exp $ */
+/* $Id: ifiter_ioctl.c,v 1.15 2000/12/06 01:28:02 tale Exp $ */
/*
* Obtain the list of network interfaces using the SIOCGLIFCONF ioctl.
@@ -90,7 +90,11 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
*/
if ((iter->socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "making interface scan socket: %s",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_IFITERIOCTL,
+ ISC_MSG_MAKESCANSOCKET,
+ "making interface "
+ "scan socket: %s"),
strerror(errno));
result = ISC_R_UNEXPECTED;
goto socket_failure;
@@ -127,7 +131,11 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
== -1) {
if (errno != EINVAL) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "get interface configuration: %s",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_IFITERIOCTL,
+ ISC_MSG_GETIFCONFIG,
+ "get interface "
+ "configuration: %s"),
strerror(errno));
result = ISC_R_UNEXPECTED;
goto ioctl_failure;
@@ -151,8 +159,13 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
}
if (iter->bufsize >= IFCONF_BUFSIZE_MAX) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "get interface configuration: "
- "maximum buffer size exceeded");
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_IFITERIOCTL,
+ ISC_MSG_BUFFERMAX,
+ "get interface "
+ "configuration: "
+ "maximum buffer "
+ "size exceeded"));
result = ISC_R_UNEXPECTED;
goto ioctl_failure;
}
@@ -258,7 +271,11 @@ internal_current(isc_interfaceiter_t *iter) {
if (ioctl(iter->socket, SIOCGLIFDSTADDR, (char *)&lifreq)
< 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "%s: getting destination address: %s",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_IFITERIOCTL,
+ ISC_MSG_GETDESTADDR,
+ "%s: getting "
+ "destination address: %s"),
lifreq.lifr_name,
strerror(errno));
return (ISC_R_IGNORE);
@@ -282,7 +299,10 @@ internal_current(isc_interfaceiter_t *iter) {
if (ioctl(iter->socket, SIOCGLIFNETMASK, (char *)&lifreq)
< 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "%s: getting netmask: %s",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_IFITERIOCTL,
+ ISC_MSG_GETNETMASK,
+ "%s: getting netmask: %s"),
lifreq.lifr_name,
strerror(errno));
return (ISC_R_IGNORE);
diff --git a/lib/isc/unix/ifiter_sysctl.c b/lib/isc/unix/ifiter_sysctl.c
index 7740188c..e9619694 100644
--- a/lib/isc/unix/ifiter_sysctl.c
+++ b/lib/isc/unix/ifiter_sysctl.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: ifiter_sysctl.c,v 1.10 2000/08/01 01:31:20 tale Exp $ */
+/* $Id: ifiter_sysctl.c,v 1.11 2000/12/06 00:30:25 tale Exp $ */
/*
* Obtain the list of network interfaces using sysctl.
@@ -86,7 +86,11 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
bufsize = 0;
if (sysctl(mib, 6, NULL, &bufsize, NULL, (size_t) 0) < 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "getting interface list size: sysctl: %s",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_IFITERSYSCTL,
+ ISC_MSG_GETIFLISTSIZE,
+ "getting interface "
+ "list size: sysctl: %s"),
strerror(errno));
result = ISC_R_UNEXPECTED;
goto failure;
@@ -102,7 +106,11 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
bufused = bufsize;
if (sysctl(mib, 6, iter->buf, &bufused, NULL, (size_t) 0) < 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "getting interface list: sysctl: %s",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_IFITERSYSCTL,
+ ISC_MSG_GETIFLIST,
+ "getting interface list: "
+ "sysctl: %s"),
strerror(errno));
result = ISC_R_UNEXPECTED;
goto failure;
@@ -241,7 +249,10 @@ internal_current(isc_interfaceiter_t *iter) {
return (ISC_R_SUCCESS);
} else {
- printf("warning: unexpected interface list message type\n");
+ printf(isc_msgcat_get(isc_msgcat, ISC_MSGSET_IFITERSYSCTL,
+ ISC_MSG_UNEXPECTEDTYPE,
+ "warning: unexpected interface list "
+ "message type\n"));
return (ISC_R_IGNORE);
}
}
diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h
index 4cd94e63..b01e9ceb 100644
--- a/lib/isc/unix/include/isc/net.h
+++ b/lib/isc/unix/include/isc/net.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: net.h,v 1.23 2000/08/01 01:31:38 tale Exp $ */
+/* $Id: net.h,v 1.24 2000/12/08 00:55:32 tale Exp $ */
#ifndef ISC_NET_H
#define ISC_NET_H 1
@@ -115,6 +115,26 @@ extern const struct in6_addr isc_net_in6addrany;
#endif
/*
+ * Fix UnixWare 7.1.1's broken IN6_IS_ADDR_* definitions.
+ */
+#ifdef ISC_PLATFORM_FIXIN6ISADDR
+#define IN6_IS_ADDR_GEOGRAPHIC
+#define IN6_IS_ADDR_GEOGRAPHIC(a) (((a)->S6_un.S6_l[0] & 0xE0) == 0x80)
+#define IN6_IS_ADDR_IPX
+#define IN6_IS_ADDR_IPX(a) (((a)->S6_un.S6_l[0] & 0xFE) == 0x04)
+#define IN6_IS_ADDR_LINKLOCAL
+#define IN6_IS_ADDR_LINKLOCAL(a) (((a)->S6_un.S6_l[0] & 0xC0FF) == 0x80FE)
+#define IN6_IS_ADDR_MULTICAST
+#define IN6_IS_ADDR_MULTICAST(a) (((a)->S6_un.S6_l[0] & 0xFF) == 0xFF)
+#define IN6_IS_ADDR_NSAP
+#define IN6_IS_ADDR_NSAP(a) (((a)->S6_un.S6_l[0] & 0xFE) == 0x02)
+#define IN6_IS_ADDR_PROVIDER
+#define IN6_IS_ADDR_PROVIDER(a) (((a)->S6_un.S6_l[0] & 0xE0) == 0x40)
+#define IN6_IS_ADDR_SITELOCAL
+#define IN6_IS_ADDR_SITELOCAL(a) (((a)->S6_un.S6_l[0] & 0xC0FF) == 0xC0FE)
+#endif /* ISC_PLATFORM_FIXIN6ISADDR */
+
+/*
* Ensure type in_port_t is defined.
*/
#ifdef ISC_PLATFORM_NEEDPORTT
diff --git a/lib/isc/unix/interfaceiter.c b/lib/isc/unix/interfaceiter.c
index f8ddb803..3c84c6aa 100644
--- a/lib/isc/unix/interfaceiter.c
+++ b/lib/isc/unix/interfaceiter.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: interfaceiter.c,v 1.19 2000/08/01 01:31:21 tale Exp $ */
+/* $Id: interfaceiter.c,v 1.20 2000/12/06 00:30:28 tale Exp $ */
#include <config.h>
@@ -31,6 +31,7 @@
#include <errno.h>
#include <isc/mem.h>
+#include <isc/msgs.h>
#include <isc/net.h>
#include <isc/result.h>
#include <isc/string.h>
diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c
index bc05fc56..41ed6265 100644
--- a/lib/isc/unix/net.c
+++ b/lib/isc/unix/net.c
@@ -15,13 +15,15 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: net.c,v 1.13 2000/09/15 20:52:27 bwelling Exp $ */
+/* $Id: net.c,v 1.16 2000/12/19 19:29:13 gson Exp $ */
#include <config.h>
#include <errno.h>
#include <unistd.h>
+#include <isc/log.h>
+#include <isc/msgs.h>
#include <isc/net.h>
#include <isc/once.h>
#include <isc/string.h>
@@ -38,6 +40,7 @@ static isc_result_t ipv6_result = ISC_R_NOTFOUND;
static isc_result_t
try_proto(int domain) {
int s;
+ isc_result_t result = ISC_R_SUCCESS;
s = socket(domain, SOCK_STREAM, 0);
if (s == -1) {
@@ -54,14 +57,62 @@ try_proto(int domain) {
return (ISC_R_NOTFOUND);
default:
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "socket() failed: %s",
+ "socket() %s: %s",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED,
+ "failed"),
strerror(errno));
return (ISC_R_UNEXPECTED);
}
}
- close (s);
- return (ISC_R_SUCCESS);
+#ifdef ISC_PLATFORM_HAVEIPV6
+#ifdef WANT_IPV6
+#ifdef ISC_PLATFORM_HAVEIN6PKTINFO
+ if (domain == PF_INET6) {
+ struct sockaddr_in6 sin6;
+ unsigned int len;
+
+ /*
+ * Check to see if IPv6 is broken, as is common on Linux.
+ */
+ len = sizeof(sin6);
+ if (getsockname(s, (struct sockaddr *)&sin6, (void *)&len) < 0) {
+ isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
+ ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR,
+ "Retrieving the address of an IPv6 "
+ "socket from the kernel failed.");
+ isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
+ ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR,
+ "IPv6 support is disabled.");
+ result = ISC_R_NOTFOUND;
+ } else {
+ if (len == sizeof(struct sockaddr_in6))
+ result = ISC_R_SUCCESS;
+ else {
+ isc_log_write(isc_lctx,
+ ISC_LOGCATEGORY_GENERAL,
+ ISC_LOGMODULE_SOCKET,
+ ISC_LOG_ERROR,
+ "IPv6 structures in kernel and "
+ "user space do not match.");
+ isc_log_write(isc_lctx,
+ ISC_LOGCATEGORY_GENERAL,
+ ISC_LOGMODULE_SOCKET,
+ ISC_LOG_ERROR,
+ "IPv6 support is disabled.");
+ result = ISC_R_NOTFOUND;
+ }
+ }
+ }
+#endif
+#endif
+#endif
+
+ close(s);
+
+ return (result);
}
static void
diff --git a/lib/isc/unix/resource.c b/lib/isc/unix/resource.c
index 0a6b06e9..f912a254 100644
--- a/lib/isc/unix/resource.c
+++ b/lib/isc/unix/resource.c
@@ -15,7 +15,9 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: resource.c,v 1.5 2000/11/28 21:40:52 gson Exp $ */
+/* $Id: resource.c,v 1.6 2000/12/23 02:45:44 tale Exp $ */
+
+#include <config.h>
#include <sys/types.h>
#include <sys/time.h> /* Required on some systems for <sys/resource.h>. */
@@ -27,6 +29,14 @@
#include "errno2result.h"
+#ifndef HAVE_RLIM_T
+/*
+ * quad_t is right for BSD/OS, the only system for which the lack of rlim_t
+ * has been observed so far.
+ */
+typedef quad_t rlim_t;
+#endif
+
static isc_result_t
resource2rlim(isc_resource_t resource, int *rlim_resource) {
isc_result_t result = ISC_R_SUCCESS;
diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c
index 98a8815c..8d582f6e 100644
--- a/lib/isc/unix/socket.c
+++ b/lib/isc/unix/socket.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: socket.c,v 1.172 2000/11/22 23:48:14 gson Exp $ */
+/* $Id: socket.c,v 1.178 2000/12/26 21:45:08 tale Exp $ */
#include <config.h>
@@ -38,6 +38,7 @@
#include <isc/list.h>
#include <isc/log.h>
#include <isc/mem.h>
+#include <isc/msgs.h>
#include <isc/mutex.h>
#include <isc/net.h>
#include <isc/platform.h>
@@ -261,6 +262,7 @@ manager_log(isc_socketmgr_t *sockmgr,
static void
socket_log(isc_socket_t *sock, isc_sockaddr_t *address,
isc_logcategory_t *category, isc_logmodule_t *module, int level,
+ isc_msgcat_t *msgcat, int msgset, int message,
const char *fmt, ...)
{
char msgbuf[2048];
@@ -275,12 +277,14 @@ socket_log(isc_socket_t *sock, isc_sockaddr_t *address,
va_end(ap);
if (address == NULL) {
- isc_log_write(isc_lctx, category, module, level,
- "socket %p: %s", sock, msgbuf);
+ isc_log_iwrite(isc_lctx, category, module, level,
+ msgcat, msgset, message,
+ "socket %p: %s", sock, msgbuf);
} else {
isc_sockaddr_format(address, peerbuf, sizeof peerbuf);
- isc_log_write(isc_lctx, category, module, level,
- "socket %p %s: %s", sock, peerbuf, msgbuf);
+ isc_log_iwrite(isc_lctx, category, module, level,
+ msgcat, msgset, message,
+ "socket %p %s: %s", sock, peerbuf, msgbuf);
}
}
@@ -344,7 +348,10 @@ select_poke(isc_socketmgr_t *mgr, int msg) {
if (cc < 0)
FATAL_ERROR(__FILE__, __LINE__,
- "write() failed during watcher poke: %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_WRITEFAILED,
+ "write() failed "
+ "during watcher poke: %s"),
strerror(errno));
INSIST(cc == sizeof(int));
@@ -364,7 +371,10 @@ select_readmsg(isc_socketmgr_t *mgr) {
return (SELECT_POKE_NOTHING);
FATAL_ERROR(__FILE__, __LINE__,
- "read() failed during watcher poke: %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_READFAILED,
+ "read() failed "
+ "during watcher poke: %s"),
strerror(errno));
return (SELECT_POKE_NOTHING);
@@ -470,7 +480,9 @@ process_cmsg(isc_socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
cmsgp = CMSG_FIRSTHDR(msg);
while (cmsgp != NULL) {
- socket_log(sock, NULL, TRACE, "processing cmsg %p", cmsgp);
+ socket_log(sock, NULL, TRACE,
+ isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_PROCESSCMSG,
+ "processing cmsg %p", cmsgp);
#ifdef ISC_PLATFORM_HAVEIPV6
if (cmsgp->cmsg_level == IPPROTO_IPV6
@@ -481,6 +493,8 @@ process_cmsg(isc_socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
sizeof(struct in6_pktinfo));
dev->attributes |= ISC_SOCKEVENTATTR_PKTINFO;
socket_log(sock, NULL, TRACE,
+ isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_IFRECEIVED,
"interface received on ifindex %u",
dev->pktinfo.ipi6_ifindex);
goto next;
@@ -601,6 +615,7 @@ build_msghdr_send(isc_socket_t *sock, isc_socketevent_t *dev,
struct in6_pktinfo *pktinfop;
socket_log(sock, NULL, TRACE,
+ isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_SENDTODATA,
"sendto pktinfo data, ifindex %u",
dev->pktinfo.ipi6_ifindex);
@@ -826,7 +841,9 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL))
socket_log(sock, NULL, IOEVENT,
- "doio_recv: recvmsg(%d) %d bytes, err %d/%s",
+ isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_DOIORECV,
+ "doio_recv: recvmsg(%d) %d bytes, err %d/%s",
sock->fd, cc, errno, strerror(errno));
#define SOFT_OR_HARD(_system, _isc) \
@@ -866,7 +883,9 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
if (sock->type == isc_sockettype_udp)
dev->address.length = msghdr.msg_namelen;
- socket_log(sock, &dev->address, IOEVENT, "packet received correctly");
+ socket_log(sock, &dev->address, IOEVENT,
+ isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_PKTRECV,
+ "packet received correctly");
/*
* Overflow bit detection. If we received MORE bytes than we should,
@@ -1005,7 +1024,9 @@ doio_send(isc_socket_t *sock, isc_socketevent_t *dev) {
if (cc == 0)
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "internal_send: send() returned 0");
+ "internal_send: send() %s 0",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_RETURNED, "returned"));
/*
* If we write less than we expected, update counters, poke.
@@ -1033,7 +1054,8 @@ destroy(isc_socket_t **sockp) {
isc_socket_t *sock = *sockp;
isc_socketmgr_t *manager = sock->manager;
- socket_log(sock, NULL, CREATION, "destroying");
+ socket_log(sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_DESTROYING, "destroying");
INSIST(ISC_LIST_EMPTY(sock->accept_list));
INSIST(ISC_LIST_EMPTY(sock->recv_list));
@@ -1124,7 +1146,9 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
if (isc_mutex_init(&sock->lock) != ISC_R_SUCCESS) {
sock->magic = 0;
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_mutex_init() failed");
+ "isc_mutex_init() %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
ret = ISC_R_UNEXPECTED;
goto err2;
}
@@ -1235,11 +1259,22 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
case EPROTONOSUPPORT:
case EPFNOSUPPORT:
case EAFNOSUPPORT:
+#ifdef LINUX
+ /*
+ * Linux 2.2 (and maybe others) return EINVAL instead of
+ * EAFNOSUPPORT.
+ */
+ case EINVAL:
+#endif
return (ISC_R_FAMILYNOSUPPORT);
default:
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "socket() failed: %s",
+ "socket() %s: %s",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED,
+ "failed"),
strerror(errno));
return (ISC_R_UNEXPECTED);
}
@@ -1254,8 +1289,11 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
if (setsockopt(sock->fd, SOL_SOCKET, SO_BSDCOMPAT,
(void *)&on, sizeof on) < 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "setsockopt(%d, SO_BSDCOMPAT) failed: %s",
- sock->fd, strerror(errno));
+ "setsockopt(%d, SO_BSDCOMPAT) %s: %s",
+ sock->fd,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"),
+ strerror(errno));
/* Press on... */
}
#endif
@@ -1268,9 +1306,13 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
(void *)&on, sizeof on) < 0
&& errno != ENOPROTOOPT) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "setsockopt(%d, SO_TIMESTAMP) "
- "failed: %s",
- sock->fd, strerror(errno));
+ "setsockopt(%d, SO_TIMESTAMP) %s: %s",
+ sock->fd,
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED,
+ "failed"),
+ strerror(errno));
/* Press on... */
}
#endif /* SO_TIMESTAMP */
@@ -1283,8 +1325,12 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
(void *)&on, sizeof (on)) < 0)) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"setsockopt(%d, IPV6_RECVPKTINFO) "
- "failed: %s",
- sock->fd, strerror(errno));
+ "%s: %s", sock->fd,
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED,
+ "failed"),
+ strerror(errno));
}
#else
/* 2292 */
@@ -1292,9 +1338,13 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
&& (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_PKTINFO,
(void *)&on, sizeof (on)) < 0)) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "setsockopt(%d, IPV6_PKTINFO) "
- "failed: %s",
- sock->fd, strerror(errno));
+ "setsockopt(%d, IPV6_PKTINFO) %s: %s",
+ sock->fd,
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED,
+ "failed"),
+ strerror(errno));
}
#endif /* IPV6_RECVPKTINFO */
#ifdef IPV6_USE_MIN_MTU /*2292bis, not too common yet*/
@@ -1328,7 +1378,8 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
UNLOCK(&manager->lock);
- socket_log(sock, NULL, CREATION, "created");
+ socket_log(sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_CREATED, "created");
return (ISC_R_SUCCESS);
}
@@ -1396,8 +1447,8 @@ dispatch_recv(isc_socket_t *sock) {
sock->pending_recv = 1;
iev = &sock->readable_ev;
- socket_log(sock, NULL, EVENT, "dispatch_recv: event %p -> task %p",
- ev, ev->ev_sender);
+ socket_log(sock, NULL, EVENT, NULL, 0, 0,
+ "dispatch_recv: event %p -> task %p", ev, ev->ev_sender);
sock->references++;
iev->ev_sender = sock;
@@ -1421,8 +1472,8 @@ dispatch_send(isc_socket_t *sock) {
sock->pending_send = 1;
iev = &sock->writable_ev;
- socket_log(sock, NULL, EVENT, "dispatch_send: event %p -> task %p",
- ev, ev->ev_sender);
+ socket_log(sock, NULL, EVENT, NULL, 0, 0,
+ "dispatch_send: event %p -> task %p", ev, ev->ev_sender);
sock->references++;
iev->ev_sender = sock;
@@ -1566,7 +1617,9 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
INSIST(VALID_SOCKET(sock));
LOCK(&sock->lock);
- socket_log(sock, NULL, TRACE, "internal_accept called, locked socket");
+ socket_log(sock, NULL, TRACE,
+ isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_ACCEPTLOCK,
+ "internal_accept called, locked socket");
manager = sock->manager;
INSIST(VALID_MANAGER(manager));
@@ -1614,14 +1667,18 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
* for the best, but log it.
*/
if (isc_log_wouldlog(isc_lctx, TRACE_LEVEL))
- socket_log(sock, NULL, TRACE,
- "accept() returned %d/%s", errno,
- strerror(errno));
+ socket_log(sock, NULL, TRACE, isc_msgcat,
+ ISC_MSGSET_SOCKET,
+ ISC_MSG_ACCEPTRETURNED,
+ "accept() returned %d/%s",
+ errno, strerror(errno));
fd = -1;
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "internal_accept: accept() failed: %s",
+ "internal_accept: accept() %s: %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"),
strerror(errno));
result = ISC_R_UNEXPECTED;
@@ -1645,7 +1702,9 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
fd = -1;
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "internal_accept: make_nonblock() failed: %s",
+ "internal_accept: make_nonblock() %s: %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"),
strerror(errno));
result = ISC_R_UNEXPECTED;
@@ -1673,6 +1732,7 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
manager->maxfd = fd;
socket_log(sock, &dev->newsocket->address, CREATION,
+ isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_ACCEPTEDCXN,
"accepted connection, new socket %p",
dev->newsocket);
}
@@ -1701,6 +1761,7 @@ internal_recv(isc_task_t *me, isc_event_t *ev) {
LOCK(&sock->lock);
socket_log(sock, NULL, IOEVENT,
+ isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_INTERNALRECV,
"internal_recv: task %p got event %p", me, ev, sock);
INSIST(sock->pending_recv == 1);
@@ -1780,6 +1841,7 @@ internal_send(isc_task_t *me, isc_event_t *ev) {
LOCK(&sock->lock);
socket_log(sock, NULL, IOEVENT,
+ isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_INTERNALSEND,
"internal_send: task %p got event %p", me, ev, sock);
INSIST(sock->pending_send == 1);
@@ -1936,7 +1998,11 @@ watcher(void *uap) {
if (cc < 0) {
if (!SOFT_ERROR(errno))
FATAL_ERROR(__FILE__, __LINE__,
- "select failed: %s",
+ "select() %s: %s",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED,
+ "failed"),
strerror(errno));
}
@@ -1952,7 +2018,11 @@ watcher(void *uap) {
msg = select_readmsg(manager);
manager_log(manager, IOEVENT,
- "watcher got message %d", msg);
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_SOCKET,
+ ISC_MSG_WATCHERMSG,
+ "watcher got message %d"),
+ msg);
/*
* Nothing to read?
@@ -1986,7 +2056,9 @@ watcher(void *uap) {
process_fds(manager, maxfd, &readfds, &writefds);
}
- manager_log(manager, TRACE, "watcher exiting");
+ manager_log(manager, TRACE,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_EXITING, "watcher exiting"));
UNLOCK(&manager->lock);
return ((isc_threadresult_t)0);
@@ -2021,7 +2093,9 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
if (isc_mutex_init(&manager->lock) != ISC_R_SUCCESS) {
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_mutex_init() failed");
+ "isc_mutex_init() %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
return (ISC_R_UNEXPECTED);
}
#ifdef ISC_PLATFORM_USETHREADS
@@ -2029,7 +2103,9 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
DESTROYLOCK(&manager->lock);
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_condition_init() failed");
+ "isc_condition_init() %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
return (ISC_R_UNEXPECTED);
}
@@ -2041,7 +2117,9 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
DESTROYLOCK(&manager->lock);
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "pipe() failed: %s",
+ "pipe() %s: %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"),
strerror(errno));
return (ISC_R_UNEXPECTED);
@@ -2077,7 +2155,9 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
DESTROYLOCK(&manager->lock);
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_thread_create() failed");
+ "isc_thread_create() %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
close(manager->pipe_fds[0]);
close(manager->pipe_fds[1]);
return (ISC_R_UNEXPECTED);
@@ -2122,7 +2202,10 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
* Wait for all sockets to be destroyed.
*/
while (!ISC_LIST_EMPTY(manager->socklist)) {
- manager_log(manager, CREATION, "sockets exist");
+ manager_log(manager, CREATION,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_SOCKETSREMAIN,
+ "sockets exist"));
WAIT(&manager->shutdown_ok, &manager->lock);
}
#else /* ISC_PLATFORM_USETHREADS */
@@ -2130,7 +2213,10 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
* Hope all sockets have been destroyed.
*/
if (!ISC_LIST_EMPTY(manager->socklist)) {
- manager_log(manager, CREATION, "sockets exist");
+ manager_log(manager, CREATION,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_SOCKETSREMAIN,
+ "sockets exist"));
INSIST(0);
}
#endif /* ISC_PLATFORM_USETHREADS */
@@ -2150,7 +2236,9 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
*/
if (isc_thread_join(manager->watcher, NULL) != ISC_R_SUCCESS)
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_thread_join() failed");
+ "isc_thread_join() %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
#endif /* ISC_PLATFORM_USETHREADS */
/*
@@ -2280,7 +2368,7 @@ isc_socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist,
if (was_empty)
select_poke(sock->manager, sock->fd);
- socket_log(sock, NULL, EVENT,
+ socket_log(sock, NULL, EVENT, NULL, 0, 0,
"isc_socket_recvv: event %p -> task %p", dev, ntask);
UNLOCK(&sock->lock);
@@ -2332,11 +2420,11 @@ isc_socket_recv(isc_socket_t *sock, isc_region_t *region, unsigned int minimum,
dev->region = *region;
dev->ev_sender = task;
- was_empty = ISC_LIST_EMPTY(sock->recv_list);
/*
* If the read queue is empty, try to do the I/O right now.
*/
+ was_empty = ISC_LIST_EMPTY(sock->recv_list);
if (!was_empty)
goto queue;
@@ -2373,7 +2461,7 @@ isc_socket_recv(isc_socket_t *sock, isc_region_t *region, unsigned int minimum,
if (was_empty)
select_poke(sock->manager, sock->fd);
- socket_log(sock, NULL, EVENT,
+ socket_log(sock, NULL, EVENT, NULL, 0, 0,
"isc_socket_recv: event %p -> task %p", dev, ntask);
UNLOCK(&sock->lock);
@@ -2424,7 +2512,8 @@ isc_socket_sendto(isc_socket_t *sock, isc_region_t *region,
set_dev_address(address, sock, dev);
if (pktinfo != NULL) {
- socket_log(sock, NULL, TRACE,
+ socket_log(sock, NULL, TRACE, isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_PKTINFOPROVIDED,
"pktinfo structure provided, ifindex %u (set to 0)",
pktinfo->ipi6_ifindex);
@@ -2470,7 +2559,7 @@ isc_socket_sendto(isc_socket_t *sock, isc_region_t *region,
if (was_empty)
select_poke(sock->manager, sock->fd);
- socket_log(sock, NULL, EVENT,
+ socket_log(sock, NULL, EVENT, NULL, 0, 0,
"isc_socket_sendto: event %p -> task %p", dev, ntask);
UNLOCK(&sock->lock);
@@ -2574,7 +2663,7 @@ isc_socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist,
if (was_empty)
select_poke(sock->manager, sock->fd);
- socket_log(sock, NULL, EVENT,
+ socket_log(sock, NULL, EVENT, NULL, 0, 0,
"isc_socket_sendtov: event %p -> task %p", dev, ntask);
UNLOCK(&sock->lock);
@@ -2595,8 +2684,10 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) {
}
if (setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on,
sizeof on) < 0) {
- UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d) failed",
- sock->fd);
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "setsockopt(%d) %s", sock->fd,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
/* Press on... */
}
if (bind(sock->fd, &sockaddr->type.sa, sockaddr->length) < 0) {
@@ -2617,7 +2708,8 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) {
}
}
- socket_log(sock, sockaddr, TRACE, "bound");
+ socket_log(sock, sockaddr, TRACE,
+ isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_BOUND, "bound");
sock->bound = 1;
UNLOCK(&sock->lock);
@@ -3172,7 +3264,7 @@ isc_socket_recvmark(isc_socket_t *sock,
ISC_LIST_ENQUEUE(sock->recv_list, dev, ev_link);
- socket_log(sock, NULL, EVENT,
+ socket_log(sock, NULL, EVENT, NULL, 0, 0,
"isc_socket_recvmark: event %p -> task %p", dev, ntask);
UNLOCK(&sock->lock);
@@ -3217,7 +3309,7 @@ isc_socket_sendmark(isc_socket_t *sock,
ISC_LIST_ENQUEUE(sock->send_list, dev, ev_link);
- socket_log(sock, NULL, EVENT,
+ socket_log(sock, NULL, EVENT, NULL, 0, 0,
"isc_socket_sendmark: event %p -> task %p", dev, ntask);
UNLOCK(&sock->lock);
diff --git a/lib/lwres/getaddrinfo.c b/lib/lwres/getaddrinfo.c
index e1fc87e5..79066e8d 100644
--- a/lib/lwres/getaddrinfo.c
+++ b/lib/lwres/getaddrinfo.c
@@ -19,7 +19,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: getaddrinfo.c,v 1.33 2000/10/05 22:27:50 bwelling Exp $ */
+/* $Id: getaddrinfo.c,v 1.34 2000/12/06 00:35:44 tale Exp $ */
#include <config.h>
@@ -352,7 +352,8 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
for (i = 0; i < FOUND_MAX; i++) {
if (net_order[i] == NULL)
break;
- err = (net_order[i])(hostname, flags, &ai_list, socktype, port);
+ err = (net_order[i])(hostname, flags, &ai_list,
+ socktype, port);
if (err != 0)
return (err);
}
diff --git a/lib/lwres/getrrset.c b/lib/lwres/getrrset.c
index a29c9034..5b95d46a 100644
--- a/lib/lwres/getrrset.c
+++ b/lib/lwres/getrrset.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: getrrset.c,v 1.3 2000/11/28 01:50:46 gson Exp $ */
+/* $Id: getrrset.c,v 1.5 2000/12/21 00:27:53 bwelling Exp $ */
#include <config.h>
@@ -87,6 +87,14 @@ lwres_getrrsetbyname(const char *hostname, unsigned int rdclass,
goto fail;
}
+ /*
+ * Don't allow queries of class or type ANY
+ */
+ if (rdclass == 0xff || rdtype == 0xff) {
+ result = ERRSET_INVAL;
+ goto fail;
+ }
+
lwresult = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
if (lwresult != LWRES_R_SUCCESS) {
result = lwresult_to_result(lwresult);
@@ -133,8 +141,6 @@ lwres_getrrsetbyname(const char *hostname, unsigned int rdclass,
if ((response->flags & LWRDATA_VALIDATED) != 0)
rrset->rri_flags |= RRSET_VALIDATED;
- if ((response->flags & LWRDATA_AUTHORITATIVE) != 0)
- rrset->rri_flags |= RRSET_AUTHORITATIVE;
rrset->rri_nrdatas = response->nrdatas;
rrset->rri_rdatas = sane_calloc(rrset->rri_nrdatas,
diff --git a/lib/lwres/include/lwres/lwres.h b/lib/lwres/include/lwres/lwres.h
index 48dcab36..be5d11d0 100644
--- a/lib/lwres/include/lwres/lwres.h
+++ b/lib/lwres/include/lwres/lwres.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lwres.h,v 1.45 2000/11/02 01:52:30 bwelling Exp $ */
+/* $Id: lwres.h,v 1.46 2000/12/21 00:27:55 bwelling Exp $ */
#ifndef LWRES_LWRES_H
#define LWRES_LWRES_H 1
@@ -213,7 +213,6 @@ typedef struct {
} lwres_grbnresponse_t;
#define LWRDATA_VALIDATED 0x00000001
-#define LWRDATA_AUTHORITATIVE 0x00000002
/*
* resolv.conf data
diff --git a/lib/lwres/include/lwres/netdb.h.in b/lib/lwres/include/lwres/netdb.h.in
index a08249e2..f711e4ef 100644
--- a/lib/lwres/include/lwres/netdb.h.in
+++ b/lib/lwres/include/lwres/netdb.h.in
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: netdb.h.in,v 1.29 2000/11/15 20:47:54 tale Exp $ */
+/* $Id: netdb.h.in,v 1.30 2000/12/21 00:27:56 bwelling Exp $ */
#ifndef LWRES_NETDB_H
#define LWRES_NETDB_H 1
@@ -178,8 +178,6 @@ struct rrsetinfo {
*/
#define RRSET_VALIDATED 0x00000001
/* Set was dnssec validated */
-#define RRSET_AUTHORITATIVE 0x00000002
- /* Set was returned by an authoritative server */
/*
* Return codes for getrrsetbyname()
diff --git a/lib/tests/t_api.c b/lib/tests/t_api.c
index 119e5d44..6c6997b4 100644
--- a/lib/tests/t_api.c
+++ b/lib/tests/t_api.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: t_api.c,v 1.44 2000/11/25 01:20:47 marka Exp $ */
+/* $Id: t_api.c,v 1.45 2000/12/28 00:42:59 bwelling Exp $ */
#include <config.h>
@@ -654,7 +654,6 @@ struct dc_method_map {
{ DNS_COMPRESS_NONE, "DNS_COMPRESS_NONE" },
{ DNS_COMPRESS_GLOBAL14, "DNS_COMPRESS_GLOBAL14" },
- { DNS_COMPRESS_GLOBAL16, "DNS_COMPRESS_GLOBAL16" },
{ DNS_COMPRESS_GLOBAL, "DNS_COMPRESS_GLOBAL" },
{ DNS_COMPRESS_ALL, "DNS_COMPRESS_ALL" },
{ 0, NULL }
diff --git a/make/rules.in b/make/rules.in
index ab23a59b..8a1bbbca 100644
--- a/make/rules.in
+++ b/make/rules.in
@@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: rules.in,v 1.23 2000/11/09 17:49:37 gson Exp $
+# $Id: rules.in,v 1.25 2000/12/15 08:28:45 gson Exp $
###
### Common Makefile rules for BIND 9.
diff --git a/version b/version
index 79fa15d2..9bbd3af2 100644
--- a/version
+++ b/version
@@ -1,4 +1,4 @@
-# $Id: version,v 1.17 2000/11/30 23:06:14 gson Exp $
+# $Id: version,v 1.18 2000/12/06 23:04:12 bwelling Exp $
#
# This file must follow /bin/sh rules. It is imported directly via
# configure.
@@ -7,4 +7,4 @@ MAJORVER=9
MINORVER=1
PATCHVER=0
RELEASETYPE=b
-RELEASEVER=1
+RELEASEVER=2